aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CREDITS19
-rw-r--r--Documentation/DocBook/networking.tmpl8
-rw-r--r--Documentation/blackfin/00-INDEX3
-rw-r--r--Documentation/blackfin/bfin-gpio-notes.txt71
-rw-r--r--Documentation/dell_rbu.txt4
-rw-r--r--Documentation/feature-removal-schedule.txt8
-rw-r--r--Documentation/filesystems/proc.txt1
-rw-r--r--Documentation/hwmon/abituguru-datasheet6
-rw-r--r--Documentation/hwmon/f71882fg89
-rw-r--r--Documentation/hwmon/it8720
-rw-r--r--Documentation/hwmon/lm7012
-rw-r--r--Documentation/hwmon/lm852
-rw-r--r--Documentation/hwmon/ltc424581
-rw-r--r--Documentation/kbuild/kbuild.txt7
-rw-r--r--Documentation/kbuild/modules.txt4
-rw-r--r--Documentation/kernel-parameters.txt36
-rw-r--r--Documentation/laptops/thinkpad-acpi.txt2
-rw-r--r--Documentation/networking/rxrpc.txt2
-rw-r--r--Documentation/networking/tuntap.txt2
-rw-r--r--Documentation/scsi/ChangeLog.lpfc2
-rw-r--r--Documentation/scsi/ChangeLog.ncr53c8xx2
-rw-r--r--Documentation/scsi/ChangeLog.sym53c8xx2
-rw-r--r--Documentation/spi/spi-lm70llp10
-rw-r--r--Documentation/usb/power-management.txt22
-rw-r--r--Documentation/wimax/README.i2400m260
-rw-r--r--Documentation/wimax/README.wimax81
-rw-r--r--MAINTAINERS20
-rw-r--r--Makefile3
-rw-r--r--arch/arm/plat-mxc/include/mach/usb.h23
-rw-r--r--arch/arm/plat-omap/usb.c32
-rw-r--r--arch/avr32/Kconfig19
-rw-r--r--arch/avr32/Makefile1
-rw-r--r--arch/avr32/boards/atngw100/setup.c2
-rw-r--r--arch/avr32/boards/atstk1000/atstk1002.c20
-rw-r--r--arch/avr32/boards/atstk1000/atstk1003.c20
-rw-r--r--arch/avr32/boards/atstk1000/atstk1004.c2
-rw-r--r--arch/avr32/boards/favr-32/setup.c31
-rw-r--r--arch/avr32/boards/hammerhead/Kconfig43
-rw-r--r--arch/avr32/boards/hammerhead/Makefile1
-rw-r--r--arch/avr32/boards/hammerhead/flash.c377
-rw-r--r--arch/avr32/boards/hammerhead/flash.h6
-rw-r--r--arch/avr32/boards/hammerhead/setup.c245
-rw-r--r--arch/avr32/boards/mimc200/setup.c4
-rw-r--r--arch/avr32/configs/atngw100_defconfig2
-rw-r--r--arch/avr32/configs/atstk1002_defconfig2
-rw-r--r--arch/avr32/configs/atstk1003_defconfig2
-rw-r--r--arch/avr32/configs/atstk1006_defconfig2
-rw-r--r--arch/avr32/configs/hammerhead_defconfig1467
-rw-r--r--arch/avr32/include/asm/kdebug.h1
-rw-r--r--arch/avr32/include/asm/syscalls.h39
-rw-r--r--arch/avr32/kernel/process.c1
-rw-r--r--arch/avr32/kernel/signal.c1
-rw-r--r--arch/avr32/kernel/sys_avr32.c1
-rw-r--r--arch/avr32/mach-at32ap/at32ap700x.c6
-rw-r--r--arch/avr32/mach-at32ap/clock.h3
-rw-r--r--arch/avr32/mach-at32ap/include/mach/at32ap700x.h3
-rw-r--r--arch/avr32/mach-at32ap/include/mach/portmux.h2
-rw-r--r--arch/avr32/mach-at32ap/pio.c19
-rw-r--r--arch/avr32/mm/cache.c1
-rw-r--r--arch/avr32/mm/init.c1
-rw-r--r--arch/blackfin/Kconfig204
-rw-r--r--arch/blackfin/Kconfig.debug30
-rw-r--r--arch/blackfin/Makefile18
-rw-r--r--arch/blackfin/configs/BF518F-EZBRD_defconfig1191
-rw-r--r--arch/blackfin/configs/BF526-EZBRD_defconfig345
-rw-r--r--arch/blackfin/configs/BF527-EZKIT_defconfig551
-rw-r--r--arch/blackfin/configs/BF533-EZKIT_defconfig316
-rw-r--r--arch/blackfin/configs/BF533-STAMP_defconfig403
-rw-r--r--arch/blackfin/configs/BF537-STAMP_defconfig463
-rw-r--r--arch/blackfin/configs/BF538-EZKIT_defconfig1368
-rw-r--r--arch/blackfin/configs/BF548-EZKIT_defconfig518
-rw-r--r--arch/blackfin/configs/BF561-EZKIT_defconfig321
-rw-r--r--arch/blackfin/configs/BlackStamp_defconfig3
-rw-r--r--arch/blackfin/configs/CM-BF527_defconfig24
-rw-r--r--arch/blackfin/configs/CM-BF533_defconfig6
-rw-r--r--arch/blackfin/configs/CM-BF537E_defconfig22
-rw-r--r--arch/blackfin/configs/CM-BF537U_defconfig22
-rw-r--r--arch/blackfin/configs/CM-BF548_defconfig10
-rw-r--r--arch/blackfin/configs/CM-BF561_defconfig6
-rw-r--r--arch/blackfin/configs/H8606_defconfig3
-rw-r--r--arch/blackfin/configs/IP0X_defconfig3
-rw-r--r--arch/blackfin/configs/PNAV-10_defconfig596
-rw-r--r--arch/blackfin/configs/SRV1_defconfig21
-rw-r--r--arch/blackfin/configs/TCM-BF537_defconfig165
-rw-r--r--arch/blackfin/include/asm/atomic.h151
-rw-r--r--arch/blackfin/include/asm/bfin-global.h7
-rw-r--r--arch/blackfin/include/asm/bfin5xx_spi.h28
-rw-r--r--arch/blackfin/include/asm/bfin_sdh.h19
-rw-r--r--arch/blackfin/include/asm/bfin_sport.h3
-rw-r--r--arch/blackfin/include/asm/bfrom.h5
-rw-r--r--arch/blackfin/include/asm/bitops.h203
-rw-r--r--arch/blackfin/include/asm/blackfin.h10
-rw-r--r--arch/blackfin/include/asm/cache.h29
-rw-r--r--arch/blackfin/include/asm/cacheflush.h20
-rw-r--r--arch/blackfin/include/asm/checksum.h3
-rw-r--r--arch/blackfin/include/asm/context.S47
-rw-r--r--arch/blackfin/include/asm/cplb-mpu.h61
-rw-r--r--arch/blackfin/include/asm/cplb.h25
-rw-r--r--arch/blackfin/include/asm/cplbinit.h83
-rw-r--r--arch/blackfin/include/asm/cpu.h41
-rw-r--r--arch/blackfin/include/asm/dma.h220
-rw-r--r--arch/blackfin/include/asm/entry.h11
-rw-r--r--arch/blackfin/include/asm/gpio.h226
-rw-r--r--arch/blackfin/include/asm/hardirq.h2
-rw-r--r--arch/blackfin/include/asm/io.h14
-rw-r--r--arch/blackfin/include/asm/ipipe.h278
-rw-r--r--arch/blackfin/include/asm/ipipe_base.h80
-rw-r--r--arch/blackfin/include/asm/irq.h296
-rw-r--r--arch/blackfin/include/asm/l1layout.h5
-rw-r--r--arch/blackfin/include/asm/mem_init.h (renamed from arch/blackfin/mach-bf527/include/mach/mem_init.h)164
-rw-r--r--arch/blackfin/include/asm/mem_map.h75
-rw-r--r--arch/blackfin/include/asm/mmu_context.h27
-rw-r--r--arch/blackfin/include/asm/mutex-dec.h112
-rw-r--r--arch/blackfin/include/asm/mutex.h63
-rw-r--r--arch/blackfin/include/asm/pda.h70
-rw-r--r--arch/blackfin/include/asm/percpu.h12
-rw-r--r--arch/blackfin/include/asm/pgtable.h1
-rw-r--r--arch/blackfin/include/asm/processor.h28
-rw-r--r--arch/blackfin/include/asm/reboot.h4
-rw-r--r--arch/blackfin/include/asm/rwlock.h6
-rw-r--r--arch/blackfin/include/asm/serial.h1
-rw-r--r--arch/blackfin/include/asm/smp.h44
-rw-r--r--arch/blackfin/include/asm/spinlock.h87
-rw-r--r--arch/blackfin/include/asm/spinlock_types.h22
-rw-r--r--arch/blackfin/include/asm/system.h185
-rw-r--r--arch/blackfin/include/asm/thread_info.h5
-rw-r--r--arch/blackfin/include/asm/uaccess.h89
-rw-r--r--arch/blackfin/include/asm/xor.h1
-rw-r--r--arch/blackfin/kernel/Makefile7
-rw-r--r--arch/blackfin/kernel/asm-offsets.c29
-rw-r--r--arch/blackfin/kernel/bfin_dma_5xx.c936
-rw-r--r--arch/blackfin/kernel/bfin_gpio.c448
-rw-r--r--arch/blackfin/kernel/bfin_ksyms.c101
-rw-r--r--arch/blackfin/kernel/cplb-mpu/Makefile6
-rw-r--r--arch/blackfin/kernel/cplb-mpu/cacheinit.c4
-rw-r--r--arch/blackfin/kernel/cplb-mpu/cplbinfo.c136
-rw-r--r--arch/blackfin/kernel/cplb-mpu/cplbinit.c48
-rw-r--r--arch/blackfin/kernel/cplb-mpu/cplbmgr.c119
-rw-r--r--arch/blackfin/kernel/cplb-nompu/Makefile8
-rw-r--r--arch/blackfin/kernel/cplb-nompu/cacheinit.c25
-rw-r--r--arch/blackfin/kernel/cplb-nompu/cplbhdlr.S130
-rw-r--r--arch/blackfin/kernel/cplb-nompu/cplbinfo.c195
-rw-r--r--arch/blackfin/kernel/cplb-nompu/cplbinit.c521
-rw-r--r--arch/blackfin/kernel/cplb-nompu/cplbmgr.S646
-rw-r--r--arch/blackfin/kernel/cplb-nompu/cplbmgr.c283
-rw-r--r--arch/blackfin/kernel/cplbinfo.c177
-rw-r--r--arch/blackfin/kernel/early_printk.c4
-rw-r--r--arch/blackfin/kernel/entry.S5
-rw-r--r--arch/blackfin/kernel/fixed_code.S6
-rw-r--r--arch/blackfin/kernel/ipipe.c428
-rw-r--r--arch/blackfin/kernel/irqchip.c46
-rw-r--r--arch/blackfin/kernel/kgdb.c127
-rw-r--r--arch/blackfin/kernel/kgdb_test.c123
-rw-r--r--arch/blackfin/kernel/mcount.S70
-rw-r--r--arch/blackfin/kernel/module.c152
-rw-r--r--arch/blackfin/kernel/process.c32
-rw-r--r--arch/blackfin/kernel/ptrace.c17
-rw-r--r--arch/blackfin/kernel/reboot.c24
-rw-r--r--arch/blackfin/kernel/setup.c218
-rw-r--r--arch/blackfin/kernel/time.c162
-rw-r--r--arch/blackfin/kernel/traps.c75
-rw-r--r--arch/blackfin/kernel/vmlinux.lds.S9
-rw-r--r--arch/blackfin/lib/checksum.c4
-rw-r--r--arch/blackfin/lib/ins.S272
-rw-r--r--arch/blackfin/lib/muldi3.S68
-rw-r--r--arch/blackfin/lib/muldi3.c99
-rw-r--r--arch/blackfin/mach-bf518/Kconfig233
-rw-r--r--arch/blackfin/mach-bf518/Makefile5
-rw-r--r--arch/blackfin/mach-bf518/boards/Kconfig12
-rw-r--r--arch/blackfin/mach-bf518/boards/Makefile5
-rw-r--r--arch/blackfin/mach-bf518/boards/ezbrd.c669
-rw-r--r--arch/blackfin/mach-bf518/dma.c118
-rw-r--r--arch/blackfin/mach-bf518/include/mach/anomaly.h79
-rw-r--r--arch/blackfin/mach-bf518/include/mach/bf518.h132
-rw-r--r--arch/blackfin/mach-bf518/include/mach/bfin_serial_5xx.h169
-rw-r--r--arch/blackfin/mach-bf518/include/mach/blackfin.h105
-rw-r--r--arch/blackfin/mach-bf518/include/mach/cdefBF512.h46
-rw-r--r--arch/blackfin/mach-bf518/include/mach/cdefBF514.h48
-rw-r--r--arch/blackfin/mach-bf518/include/mach/cdefBF516.h213
-rw-r--r--arch/blackfin/mach-bf518/include/mach/cdefBF518.h282
-rw-r--r--arch/blackfin/mach-bf518/include/mach/cdefBF51x_base.h1208
-rw-r--r--arch/blackfin/mach-bf518/include/mach/defBF512.h42
-rw-r--r--arch/blackfin/mach-bf518/include/mach/defBF514.h113
-rw-r--r--arch/blackfin/mach-bf518/include/mach/defBF516.h490
-rw-r--r--arch/blackfin/mach-bf518/include/mach/defBF518.h651
-rw-r--r--arch/blackfin/mach-bf518/include/mach/defBF51x_base.h1940
-rw-r--r--arch/blackfin/mach-bf518/include/mach/dma.h33
-rw-r--r--arch/blackfin/mach-bf518/include/mach/gpio.h60
-rw-r--r--arch/blackfin/mach-bf518/include/mach/irq.h260
-rw-r--r--arch/blackfin/mach-bf518/include/mach/mem_map.h108
-rw-r--r--arch/blackfin/mach-bf518/include/mach/portmux.h188
-rw-r--r--arch/blackfin/mach-bf518/ints-priority.c99
-rw-r--r--arch/blackfin/mach-bf527/Kconfig34
-rw-r--r--arch/blackfin/mach-bf527/Makefile2
-rw-r--r--arch/blackfin/mach-bf527/boards/cm_bf527.c111
-rw-r--r--arch/blackfin/mach-bf527/boards/ezbrd.c90
-rw-r--r--arch/blackfin/mach-bf527/boards/ezkit.c176
-rw-r--r--arch/blackfin/mach-bf527/dma.c2
-rw-r--r--arch/blackfin/mach-bf527/head.S146
-rw-r--r--arch/blackfin/mach-bf527/include/mach/anomaly.h10
-rw-r--r--arch/blackfin/mach-bf527/include/mach/bf527.h8
-rw-r--r--arch/blackfin/mach-bf527/include/mach/bfin_sir.h142
-rw-r--r--arch/blackfin/mach-bf527/include/mach/cdefBF52x_base.h102
-rw-r--r--arch/blackfin/mach-bf527/include/mach/dma.h32
-rw-r--r--arch/blackfin/mach-bf527/include/mach/gpio.h68
-rw-r--r--arch/blackfin/mach-bf527/include/mach/irq.h32
-rw-r--r--arch/blackfin/mach-bf527/include/mach/mem_map.h6
-rw-r--r--arch/blackfin/mach-bf527/ints-priority.c16
-rw-r--r--arch/blackfin/mach-bf533/Kconfig2
-rw-r--r--arch/blackfin/mach-bf533/Makefile2
-rw-r--r--arch/blackfin/mach-bf533/boards/H8606.c24
-rw-r--r--arch/blackfin/mach-bf533/boards/blackstamp.c24
-rw-r--r--arch/blackfin/mach-bf533/boards/cm_bf533.c39
-rw-r--r--arch/blackfin/mach-bf533/boards/ezkit.c26
-rw-r--r--arch/blackfin/mach-bf533/boards/generic_board.c35
-rw-r--r--arch/blackfin/mach-bf533/boards/ip0x.c24
-rw-r--r--arch/blackfin/mach-bf533/boards/stamp.c58
-rw-r--r--arch/blackfin/mach-bf533/dma.c2
-rw-r--r--arch/blackfin/mach-bf533/head.S137
-rw-r--r--arch/blackfin/mach-bf533/include/mach/anomaly.h11
-rw-r--r--arch/blackfin/mach-bf533/include/mach/bf533.h4
-rw-r--r--arch/blackfin/mach-bf533/include/mach/bfin_sir.h125
-rw-r--r--arch/blackfin/mach-bf533/include/mach/blackfin.h7
-rw-r--r--arch/blackfin/mach-bf533/include/mach/cdefBF532.h177
-rw-r--r--arch/blackfin/mach-bf533/include/mach/dma.h40
-rw-r--r--arch/blackfin/mach-bf533/include/mach/gpio.h34
-rw-r--r--arch/blackfin/mach-bf533/include/mach/irq.h14
-rw-r--r--arch/blackfin/mach-bf533/include/mach/mem_init.h297
-rw-r--r--arch/blackfin/mach-bf533/include/mach/mem_map.h6
-rw-r--r--arch/blackfin/mach-bf537/Kconfig34
-rw-r--r--arch/blackfin/mach-bf537/Makefile2
-rw-r--r--arch/blackfin/mach-bf537/boards/cm_bf537.c63
-rw-r--r--arch/blackfin/mach-bf537/boards/generic_board.c109
-rw-r--r--arch/blackfin/mach-bf537/boards/minotaur.c48
-rw-r--r--arch/blackfin/mach-bf537/boards/pnav10.c50
-rw-r--r--arch/blackfin/mach-bf537/boards/stamp.c280
-rw-r--r--arch/blackfin/mach-bf537/boards/tcm_bf537.c63
-rw-r--r--arch/blackfin/mach-bf537/dma.c2
-rw-r--r--arch/blackfin/mach-bf537/head.S146
-rw-r--r--arch/blackfin/mach-bf537/include/mach/anomaly.h13
-rw-r--r--arch/blackfin/mach-bf537/include/mach/bf537.h2
-rw-r--r--arch/blackfin/mach-bf537/include/mach/bfin_sir.h142
-rw-r--r--arch/blackfin/mach-bf537/include/mach/blackfin.h2
-rw-r--r--arch/blackfin/mach-bf537/include/mach/cdefBF534.h91
-rw-r--r--arch/blackfin/mach-bf537/include/mach/dma.h32
-rw-r--r--arch/blackfin/mach-bf537/include/mach/gpio.h68
-rw-r--r--arch/blackfin/mach-bf537/include/mach/irq.h32
-rw-r--r--arch/blackfin/mach-bf537/include/mach/mem_init.h303
-rw-r--r--arch/blackfin/mach-bf537/include/mach/mem_map.h6
-rw-r--r--arch/blackfin/mach-bf537/ints-priority.c16
-rw-r--r--arch/blackfin/mach-bf538/Kconfig164
-rw-r--r--arch/blackfin/mach-bf538/Makefile5
-rw-r--r--arch/blackfin/mach-bf538/boards/Kconfig12
-rw-r--r--arch/blackfin/mach-bf538/boards/Makefile5
-rw-r--r--arch/blackfin/mach-bf538/boards/ezkit.c606
-rw-r--r--arch/blackfin/mach-bf538/dma.c161
-rw-r--r--arch/blackfin/mach-bf538/include/mach/anomaly.h132
-rw-r--r--arch/blackfin/mach-bf538/include/mach/bf538.h124
-rw-r--r--arch/blackfin/mach-bf538/include/mach/bfin_serial_5xx.h183
-rw-r--r--arch/blackfin/mach-bf538/include/mach/blackfin.h101
-rw-r--r--arch/blackfin/mach-bf538/include/mach/cdefBF538.h2108
-rw-r--r--arch/blackfin/mach-bf538/include/mach/cdefBF539.h240
-rw-r--r--arch/blackfin/mach-bf538/include/mach/defBF539.h4243
-rw-r--r--arch/blackfin/mach-bf538/include/mach/dma.h41
-rw-r--r--arch/blackfin/mach-bf538/include/mach/gpio.h79
-rw-r--r--arch/blackfin/mach-bf538/include/mach/irq.h211
-rw-r--r--arch/blackfin/mach-bf538/include/mach/mem_map.h113
-rw-r--r--arch/blackfin/mach-bf538/include/mach/portmux.h106
-rw-r--r--arch/blackfin/mach-bf538/ints-priority.c94
-rw-r--r--arch/blackfin/mach-bf548/Kconfig2
-rw-r--r--arch/blackfin/mach-bf548/Makefile2
-rw-r--r--arch/blackfin/mach-bf548/boards/cm_bf548.c166
-rw-r--r--arch/blackfin/mach-bf548/boards/ezkit.c156
-rw-r--r--arch/blackfin/mach-bf548/dma.c2
-rw-r--r--arch/blackfin/mach-bf548/head.S158
-rw-r--r--arch/blackfin/mach-bf548/include/mach/anomaly.h5
-rw-r--r--arch/blackfin/mach-bf548/include/mach/bf548.h2
-rw-r--r--arch/blackfin/mach-bf548/include/mach/bfin_sir.h166
-rw-r--r--arch/blackfin/mach-bf548/include/mach/blackfin.h2
-rw-r--r--arch/blackfin/mach-bf548/include/mach/cdefBF54x_base.h114
-rw-r--r--arch/blackfin/mach-bf548/include/mach/dma.h32
-rw-r--r--arch/blackfin/mach-bf548/include/mach/irq.h2
-rw-r--r--arch/blackfin/mach-bf548/include/mach/mem_init.h255
-rw-r--r--arch/blackfin/mach-bf548/include/mach/mem_map.h6
-rw-r--r--arch/blackfin/mach-bf561/Kconfig8
-rw-r--r--arch/blackfin/mach-bf561/Makefile3
-rw-r--r--arch/blackfin/mach-bf561/atomic.S919
-rw-r--r--arch/blackfin/mach-bf561/boards/cm_bf561.c39
-rw-r--r--arch/blackfin/mach-bf561/boards/ezkit.c89
-rw-r--r--arch/blackfin/mach-bf561/boards/generic_board.c35
-rw-r--r--arch/blackfin/mach-bf561/boards/tepla.c34
-rw-r--r--arch/blackfin/mach-bf561/dma.c2
-rw-r--r--arch/blackfin/mach-bf561/head.S136
-rw-r--r--arch/blackfin/mach-bf561/include/mach/anomaly.h16
-rw-r--r--arch/blackfin/mach-bf561/include/mach/bf561.h2
-rw-r--r--arch/blackfin/mach-bf561/include/mach/bfin_sir.h125
-rw-r--r--arch/blackfin/mach-bf561/include/mach/blackfin.h4
-rw-r--r--arch/blackfin/mach-bf561/include/mach/cdefBF561.h103
-rw-r--r--arch/blackfin/mach-bf561/include/mach/defBF561.h3
-rw-r--r--arch/blackfin/mach-bf561/include/mach/dma.h16
-rw-r--r--arch/blackfin/mach-bf561/include/mach/gpio.h68
-rw-r--r--arch/blackfin/mach-bf561/include/mach/mem_init.h295
-rw-r--r--arch/blackfin/mach-bf561/include/mach/mem_map.h80
-rw-r--r--arch/blackfin/mach-bf561/include/mach/smp.h22
-rw-r--r--arch/blackfin/mach-bf561/secondary.S215
-rw-r--r--arch/blackfin/mach-bf561/smp.c167
-rw-r--r--arch/blackfin/mach-common/Makefile4
-rw-r--r--arch/blackfin/mach-common/cache-c.c24
-rw-r--r--arch/blackfin/mach-common/cache.S6
-rw-r--r--arch/blackfin/mach-common/clocks-init.c93
-rw-r--r--arch/blackfin/mach-common/cpufreq.c6
-rw-r--r--arch/blackfin/mach-common/dpmc_modes.S3
-rw-r--r--arch/blackfin/mach-common/entry.S132
-rw-r--r--arch/blackfin/mach-common/head.S117
-rw-r--r--arch/blackfin/mach-common/interrupt.S80
-rw-r--r--arch/blackfin/mach-common/ints-priority.c541
-rw-r--r--arch/blackfin/mach-common/irqpanic.c12
-rw-r--r--arch/blackfin/mach-common/lock.S4
-rw-r--r--arch/blackfin/mach-common/pm.c20
-rw-r--r--arch/blackfin/mach-common/smp.c476
-rw-r--r--arch/blackfin/mm/init.c50
-rw-r--r--arch/blackfin/mm/sram-alloc.c339
-rw-r--r--arch/blackfin/oprofile/Makefile3
-rw-r--r--arch/blackfin/oprofile/bfin_oprofile.c18
-rw-r--r--arch/blackfin/oprofile/common.c168
-rw-r--r--arch/blackfin/oprofile/op_blackfin.h98
-rw-r--r--arch/blackfin/oprofile/op_model_bf533.c161
-rw-r--r--arch/blackfin/oprofile/timer_int.c73
-rw-r--r--arch/cris/arch-v32/kernel/signal.c2
-rw-r--r--arch/ia64/kernel/kprobes.c2
-rw-r--r--arch/m68k/Kconfig2
-rw-r--r--arch/m68k/kernel/traps.c2
-rw-r--r--arch/mips/kernel/stacktrace.c24
-rw-r--r--arch/mips/pmc-sierra/yosemite/atmel_read_eeprom.c2
-rw-r--r--arch/powerpc/boot/Makefile2
-rw-r--r--arch/powerpc/boot/dts/sequoia.dts2
-rw-r--r--arch/powerpc/kernel/kprobes.c2
-rw-r--r--arch/powerpc/oprofile/cell/spu_profiler.c2
-rw-r--r--arch/s390/Kconfig2
-rw-r--r--arch/s390/kernel/kprobes.c2
-rw-r--r--arch/sparc/kernel/kprobes.c2
-rw-r--r--arch/x86/kernel/kprobes.c2
-rw-r--r--arch/x86/kernel/mfgpt_32.c2
-rw-r--r--arch/xtensa/Makefile28
-rw-r--r--arch/xtensa/boot/boot-elf/boot.lds.S2
-rw-r--r--arch/xtensa/boot/boot-redboot/bootstrap.S2
-rw-r--r--arch/xtensa/include/asm/Kbuild (renamed from include/asm-xtensa/Kbuild)2
-rw-r--r--arch/xtensa/include/asm/asmmacro.h (renamed from include/asm-xtensa/asmmacro.h)2
-rw-r--r--arch/xtensa/include/asm/atomic.h (renamed from include/asm-xtensa/atomic.h)0
-rw-r--r--arch/xtensa/include/asm/auxvec.h (renamed from include/asm-xtensa/auxvec.h)0
-rw-r--r--arch/xtensa/include/asm/bitops.h (renamed from include/asm-xtensa/bitops.h)0
-rw-r--r--arch/xtensa/include/asm/bootparam.h (renamed from include/asm-xtensa/bootparam.h)0
-rw-r--r--arch/xtensa/include/asm/bug.h (renamed from include/asm-xtensa/bug.h)0
-rw-r--r--arch/xtensa/include/asm/bugs.h (renamed from include/asm-xtensa/bugs.h)0
-rw-r--r--arch/xtensa/include/asm/byteorder.h14
-rw-r--r--arch/xtensa/include/asm/cache.h (renamed from include/asm-xtensa/cache.h)2
-rw-r--r--arch/xtensa/include/asm/cacheasm.h (renamed from include/asm-xtensa/cacheasm.h)0
-rw-r--r--arch/xtensa/include/asm/cacheflush.h (renamed from include/asm-xtensa/cacheflush.h)0
-rw-r--r--arch/xtensa/include/asm/checksum.h (renamed from include/asm-xtensa/checksum.h)2
-rw-r--r--arch/xtensa/include/asm/coprocessor.h (renamed from include/asm-xtensa/coprocessor.h)4
-rw-r--r--arch/xtensa/include/asm/cpumask.h (renamed from include/asm-xtensa/cpumask.h)0
-rw-r--r--arch/xtensa/include/asm/cputime.h (renamed from include/asm-xtensa/cputime.h)0
-rw-r--r--arch/xtensa/include/asm/current.h (renamed from include/asm-xtensa/current.h)0
-rw-r--r--arch/xtensa/include/asm/delay.h (renamed from include/asm-xtensa/delay.h)0
-rw-r--r--arch/xtensa/include/asm/device.h (renamed from include/asm-xtensa/device.h)0
-rw-r--r--arch/xtensa/include/asm/div64.h (renamed from include/asm-xtensa/div64.h)0
-rw-r--r--arch/xtensa/include/asm/dma-mapping.h (renamed from include/asm-xtensa/dma-mapping.h)0
-rw-r--r--arch/xtensa/include/asm/dma.h (renamed from include/asm-xtensa/dma.h)0
-rw-r--r--arch/xtensa/include/asm/elf.h (renamed from include/asm-xtensa/elf.h)0
-rw-r--r--arch/xtensa/include/asm/emergency-restart.h (renamed from include/asm-xtensa/emergency-restart.h)0
-rw-r--r--arch/xtensa/include/asm/errno.h (renamed from include/asm-xtensa/errno.h)0
-rw-r--r--arch/xtensa/include/asm/fb.h (renamed from include/asm-xtensa/fb.h)0
-rw-r--r--arch/xtensa/include/asm/fcntl.h (renamed from include/asm-xtensa/fcntl.h)0
-rw-r--r--arch/xtensa/include/asm/futex.h (renamed from include/asm-xtensa/futex.h)0
-rw-r--r--arch/xtensa/include/asm/hardirq.h (renamed from include/asm-xtensa/hardirq.h)0
-rw-r--r--arch/xtensa/include/asm/highmem.h (renamed from include/asm-xtensa/highmem.h)0
-rw-r--r--arch/xtensa/include/asm/hw_irq.h (renamed from include/asm-xtensa/hw_irq.h)0
-rw-r--r--arch/xtensa/include/asm/io.h (renamed from include/asm-xtensa/io.h)0
-rw-r--r--arch/xtensa/include/asm/ioctl.h (renamed from include/asm-xtensa/ioctl.h)0
-rw-r--r--arch/xtensa/include/asm/ioctls.h (renamed from include/asm-xtensa/ioctls.h)0
-rw-r--r--arch/xtensa/include/asm/ipcbuf.h (renamed from include/asm-xtensa/ipcbuf.h)0
-rw-r--r--arch/xtensa/include/asm/irq.h (renamed from include/asm-xtensa/irq.h)4
-rw-r--r--arch/xtensa/include/asm/irq_regs.h (renamed from include/asm-xtensa/irq_regs.h)0
-rw-r--r--arch/xtensa/include/asm/kdebug.h (renamed from include/asm-xtensa/kdebug.h)0
-rw-r--r--arch/xtensa/include/asm/kmap_types.h (renamed from include/asm-xtensa/kmap_types.h)0
-rw-r--r--arch/xtensa/include/asm/linkage.h (renamed from include/asm-xtensa/linkage.h)0
-rw-r--r--arch/xtensa/include/asm/local.h (renamed from include/asm-xtensa/local.h)0
-rw-r--r--arch/xtensa/include/asm/mman.h (renamed from include/asm-xtensa/mman.h)0
-rw-r--r--arch/xtensa/include/asm/mmu.h (renamed from include/asm-xtensa/mmu.h)0
-rw-r--r--arch/xtensa/include/asm/mmu_context.h (renamed from include/asm-xtensa/mmu_context.h)0
-rw-r--r--arch/xtensa/include/asm/module.h (renamed from include/asm-xtensa/module.h)0
-rw-r--r--arch/xtensa/include/asm/msgbuf.h (renamed from include/asm-xtensa/msgbuf.h)0
-rw-r--r--arch/xtensa/include/asm/mutex.h (renamed from include/asm-xtensa/mutex.h)0
-rw-r--r--arch/xtensa/include/asm/page.h (renamed from include/asm-xtensa/page.h)0
-rw-r--r--arch/xtensa/include/asm/param.h (renamed from include/asm-xtensa/param.h)0
-rw-r--r--arch/xtensa/include/asm/pci-bridge.h (renamed from include/asm-xtensa/pci-bridge.h)0
-rw-r--r--arch/xtensa/include/asm/pci.h (renamed from include/asm-xtensa/pci.h)0
-rw-r--r--arch/xtensa/include/asm/percpu.h (renamed from include/asm-xtensa/percpu.h)0
-rw-r--r--arch/xtensa/include/asm/pgalloc.h (renamed from include/asm-xtensa/pgalloc.h)0
-rw-r--r--arch/xtensa/include/asm/pgtable.h (renamed from include/asm-xtensa/pgtable.h)0
-rw-r--r--arch/xtensa/include/asm/platform.h (renamed from include/asm-xtensa/platform.h)2
-rw-r--r--arch/xtensa/include/asm/poll.h (renamed from include/asm-xtensa/poll.h)0
-rw-r--r--arch/xtensa/include/asm/posix_types.h (renamed from include/asm-xtensa/posix_types.h)0
-rw-r--r--arch/xtensa/include/asm/processor.h (renamed from include/asm-xtensa/processor.h)2
-rw-r--r--arch/xtensa/include/asm/ptrace.h (renamed from include/asm-xtensa/ptrace.h)2
-rw-r--r--arch/xtensa/include/asm/regs.h (renamed from include/asm-xtensa/regs.h)0
-rw-r--r--arch/xtensa/include/asm/resource.h (renamed from include/asm-xtensa/resource.h)0
-rw-r--r--arch/xtensa/include/asm/rmap.h (renamed from include/asm-xtensa/rmap.h)0
-rw-r--r--arch/xtensa/include/asm/rwsem.h (renamed from include/asm-xtensa/rwsem.h)0
-rw-r--r--arch/xtensa/include/asm/scatterlist.h (renamed from include/asm-xtensa/scatterlist.h)0
-rw-r--r--arch/xtensa/include/asm/sections.h (renamed from include/asm-xtensa/sections.h)0
-rw-r--r--arch/xtensa/include/asm/segment.h (renamed from include/asm-xtensa/segment.h)0
-rw-r--r--arch/xtensa/include/asm/sembuf.h (renamed from include/asm-xtensa/sembuf.h)0
-rw-r--r--arch/xtensa/include/asm/serial.h (renamed from include/asm-xtensa/serial.h)2
-rw-r--r--arch/xtensa/include/asm/setup.h (renamed from include/asm-xtensa/setup.h)0
-rw-r--r--arch/xtensa/include/asm/shmbuf.h (renamed from include/asm-xtensa/shmbuf.h)0
-rw-r--r--arch/xtensa/include/asm/shmparam.h (renamed from include/asm-xtensa/shmparam.h)0
-rw-r--r--arch/xtensa/include/asm/sigcontext.h (renamed from include/asm-xtensa/sigcontext.h)0
-rw-r--r--arch/xtensa/include/asm/siginfo.h (renamed from include/asm-xtensa/siginfo.h)0
-rw-r--r--arch/xtensa/include/asm/signal.h (renamed from include/asm-xtensa/signal.h)0
-rw-r--r--arch/xtensa/include/asm/smp.h (renamed from include/asm-xtensa/smp.h)0
-rw-r--r--arch/xtensa/include/asm/socket.h (renamed from include/asm-xtensa/socket.h)0
-rw-r--r--arch/xtensa/include/asm/sockios.h (renamed from include/asm-xtensa/sockios.h)0
-rw-r--r--arch/xtensa/include/asm/spinlock.h (renamed from include/asm-xtensa/spinlock.h)0
-rw-r--r--arch/xtensa/include/asm/stat.h (renamed from include/asm-xtensa/stat.h)0
-rw-r--r--arch/xtensa/include/asm/statfs.h (renamed from include/asm-xtensa/statfs.h)0
-rw-r--r--arch/xtensa/include/asm/string.h (renamed from include/asm-xtensa/string.h)0
-rw-r--r--arch/xtensa/include/asm/swab.h (renamed from include/asm-xtensa/byteorder.h)32
-rw-r--r--arch/xtensa/include/asm/syscall.h (renamed from include/asm-xtensa/syscall.h)0
-rw-r--r--arch/xtensa/include/asm/system.h (renamed from include/asm-xtensa/system.h)0
-rw-r--r--arch/xtensa/include/asm/termbits.h (renamed from include/asm-xtensa/termbits.h)0
-rw-r--r--arch/xtensa/include/asm/termios.h (renamed from include/asm-xtensa/termios.h)0
-rw-r--r--arch/xtensa/include/asm/thread_info.h (renamed from include/asm-xtensa/thread_info.h)0
-rw-r--r--arch/xtensa/include/asm/timex.h (renamed from include/asm-xtensa/timex.h)0
-rw-r--r--arch/xtensa/include/asm/tlb.h (renamed from include/asm-xtensa/tlb.h)0
-rw-r--r--arch/xtensa/include/asm/tlbflush.h (renamed from include/asm-xtensa/tlbflush.h)0
-rw-r--r--arch/xtensa/include/asm/topology.h (renamed from include/asm-xtensa/topology.h)0
-rw-r--r--arch/xtensa/include/asm/types.h (renamed from include/asm-xtensa/types.h)0
-rw-r--r--arch/xtensa/include/asm/uaccess.h (renamed from include/asm-xtensa/uaccess.h)0
-rw-r--r--arch/xtensa/include/asm/ucontext.h (renamed from include/asm-xtensa/ucontext.h)0
-rw-r--r--arch/xtensa/include/asm/unaligned.h (renamed from include/asm-xtensa/unaligned.h)12
-rw-r--r--arch/xtensa/include/asm/unistd.h (renamed from include/asm-xtensa/unistd.h)0
-rw-r--r--arch/xtensa/include/asm/user.h (renamed from include/asm-xtensa/user.h)0
-rw-r--r--arch/xtensa/include/asm/vga.h (renamed from include/asm-xtensa/vga.h)0
-rw-r--r--arch/xtensa/include/asm/xor.h (renamed from include/asm-xtensa/xor.h)0
-rw-r--r--arch/xtensa/kernel/entry.S2
-rw-r--r--arch/xtensa/kernel/vmlinux.lds.S2
-rw-r--r--arch/xtensa/lib/checksum.S2
-rw-r--r--arch/xtensa/lib/memcopy.S2
-rw-r--r--arch/xtensa/lib/memset.S2
-rw-r--r--arch/xtensa/lib/strncpy_user.S2
-rw-r--r--arch/xtensa/lib/strnlen_user.S2
-rw-r--r--arch/xtensa/lib/usercopy.S2
-rw-r--r--arch/xtensa/platforms/iss/console.c4
-rw-r--r--arch/xtensa/platforms/iss/include/platform/hardware.h (renamed from include/asm-xtensa/platform-iss/hardware.h)0
-rw-r--r--arch/xtensa/platforms/iss/include/platform/simcall.h (renamed from include/asm-xtensa/platform-iss/simcall.h)0
-rw-r--r--arch/xtensa/platforms/iss/io.c2
-rw-r--r--arch/xtensa/platforms/iss/network.c4
-rw-r--r--arch/xtensa/platforms/xt2000/Makefile5
-rw-r--r--arch/xtensa/platforms/xt2000/include/platform/hardware.h55
-rw-r--r--arch/xtensa/platforms/xt2000/include/platform/serial.h28
-rw-r--r--arch/xtensa/platforms/xt2000/setup.c181
-rw-r--r--arch/xtensa/variants/dc232b/include/variant/core.h (renamed from include/asm-xtensa/variant-dc232b/core.h)0
-rw-r--r--arch/xtensa/variants/dc232b/include/variant/tie-asm.h (renamed from include/asm-xtensa/variant-dc232b/tie-asm.h)0
-rw-r--r--arch/xtensa/variants/dc232b/include/variant/tie.h (renamed from include/asm-xtensa/variant-dc232b/tie.h)0
-rw-r--r--arch/xtensa/variants/fsf/include/variant/core.h (renamed from include/asm-xtensa/variant-fsf/core.h)0
-rw-r--r--arch/xtensa/variants/fsf/include/variant/tie-asm.h (renamed from include/asm-xtensa/variant-fsf/tie-asm.h)0
-rw-r--r--arch/xtensa/variants/fsf/include/variant/tie.h (renamed from include/asm-xtensa/variant-fsf/tie.h)0
-rw-r--r--drivers/Makefile1
-rw-r--r--drivers/acpi/acpi_memhotplug.c2
-rw-r--r--drivers/acpi/executer/exprep.c2
-rw-r--r--drivers/acpi/executer/exresolv.c2
-rw-r--r--drivers/acpi/executer/exstore.c2
-rw-r--r--drivers/acpi/resources/rscreate.c2
-rw-r--r--drivers/acpi/utilities/utobject.c4
-rw-r--r--drivers/ata/libata-core.c96
-rw-r--r--drivers/base/Kconfig2
-rw-r--r--drivers/base/topology.c1
-rw-r--r--drivers/block/ub.c11
-rw-r--r--drivers/char/epca.c2
-rw-r--r--drivers/cpufreq/Kconfig4
-rw-r--r--drivers/firewire/fw-card.c20
-rw-r--r--drivers/firewire/fw-device.c8
-rw-r--r--drivers/firewire/fw-device.h2
-rw-r--r--drivers/firewire/fw-sbp2.c21
-rw-r--r--drivers/firewire/fw-topology.c16
-rw-r--r--drivers/firewire/fw-transaction.c2
-rw-r--r--drivers/firewire/fw-transaction.h13
-rw-r--r--drivers/hid/usbhid/hid-core.c9
-rw-r--r--drivers/hid/usbhid/hiddev.c2
-rw-r--r--drivers/hwmon/Kconfig47
-rw-r--r--drivers/hwmon/Makefile1
-rw-r--r--drivers/hwmon/asb100.c5
-rw-r--r--drivers/hwmon/dme1737.c5
-rw-r--r--drivers/hwmon/f71805f.c5
-rw-r--r--drivers/hwmon/f71882fg.c1549
-rw-r--r--drivers/hwmon/fschmd.c450
-rw-r--r--drivers/hwmon/i5k_amb.c7
-rw-r--r--drivers/hwmon/it87.c37
-rw-r--r--drivers/hwmon/lm70.c91
-rw-r--r--drivers/hwmon/ltc4245.c567
-rw-r--r--drivers/hwmon/pc87360.c6
-rw-r--r--drivers/hwmon/pc87427.c5
-rw-r--r--drivers/hwmon/sis5595.c5
-rw-r--r--drivers/hwmon/smsc47b397.c5
-rw-r--r--drivers/hwmon/smsc47m1.c5
-rw-r--r--drivers/hwmon/via686a.c5
-rw-r--r--drivers/hwmon/vt1211.c5
-rw-r--r--drivers/hwmon/vt8231.c5
-rw-r--r--drivers/hwmon/w83627ehf.c8
-rw-r--r--drivers/hwmon/w83627hf.c5
-rw-r--r--drivers/hwmon/w83781d.c5
-rw-r--r--drivers/hwmon/w83791d.c5
-rw-r--r--drivers/hwmon/w83792d.c5
-rw-r--r--drivers/hwmon/w83793.c5
-rw-r--r--drivers/i2c/busses/i2c-ali1563.c4
-rw-r--r--drivers/i2c/busses/i2c-amd756-s4882.c4
-rw-r--r--drivers/i2c/busses/i2c-amd756.c5
-rw-r--r--drivers/i2c/busses/i2c-at91.c2
-rw-r--r--drivers/i2c/busses/i2c-bfin-twi.c2
-rw-r--r--drivers/i2c/busses/i2c-i801.c50
-rw-r--r--drivers/i2c/busses/i2c-pxa.c4
-rw-r--r--drivers/i2c/busses/i2c-s3c2410.c2
-rw-r--r--drivers/i2c/busses/i2c-sh7760.c2
-rw-r--r--drivers/i2c/busses/i2c-sh_mobile.c2
-rw-r--r--drivers/i2c/busses/i2c-sis5595.c4
-rw-r--r--drivers/i2c/busses/i2c-sis630.c4
-rw-r--r--drivers/i2c/chips/Kconfig12
-rw-r--r--drivers/i2c/chips/Makefile1
-rw-r--r--drivers/i2c/i2c-core.c8
-rw-r--r--drivers/ieee1394/csr.c12
-rw-r--r--drivers/ieee1394/csr.h10
-rw-r--r--drivers/ieee1394/csr1212.c45
-rw-r--r--drivers/ieee1394/csr1212.h9
-rw-r--r--drivers/ieee1394/dv1394-private.h44
-rw-r--r--drivers/ieee1394/dv1394.c12
-rw-r--r--drivers/ieee1394/eth1394.c28
-rw-r--r--drivers/ieee1394/eth1394.h16
-rw-r--r--drivers/ieee1394/highlevel.c9
-rw-r--r--drivers/ieee1394/highlevel.h7
-rw-r--r--drivers/ieee1394/hosts.c6
-rw-r--r--drivers/ieee1394/hosts.h2
-rw-r--r--drivers/ieee1394/ieee1394.h3
-rw-r--r--drivers/ieee1394/nodemgr.c20
-rw-r--r--drivers/ieee1394/nodemgr.h3
-rw-r--r--drivers/ieee1394/ohci1394.c26
-rw-r--r--drivers/ieee1394/pcilynx.c2
-rw-r--r--drivers/ieee1394/pcilynx.h2
-rw-r--r--drivers/ieee1394/raw1394.c2
-rw-r--r--drivers/ieee1394/sbp2.c4
-rw-r--r--drivers/infiniband/hw/mlx4/cq.c2
-rw-r--r--drivers/input/keyboard/atkbd.c2
-rw-r--r--drivers/input/misc/apanel.c81
-rw-r--r--drivers/input/touchscreen/da9034-ts.c1
-rw-r--r--drivers/macintosh/Kconfig2
-rw-r--r--drivers/media/video/cafe_ccic.c1
-rw-r--r--drivers/media/video/ov7670.c1
-rw-r--r--drivers/media/video/ovcamchip/ovcamchip_core.c1
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-hdw.c2
-rw-r--r--drivers/media/video/w9968cf.c1
-rw-r--r--drivers/message/i2o/i2o_scsi.c2
-rw-r--r--drivers/misc/ibmasm/event.c2
-rw-r--r--drivers/misc/phantom.c2
-rw-r--r--drivers/mmc/host/atmel-mci.c2
-rw-r--r--drivers/mtd/devices/pmc551.c2
-rw-r--r--drivers/mtd/ubi/eba.c2
-rw-r--r--drivers/mtd/ubi/io.c2
-rw-r--r--drivers/mtd/ubi/scan.c2
-rw-r--r--drivers/mtd/ubi/ubi-media.h4
-rw-r--r--drivers/mtd/ubi/vtbl.c2
-rw-r--r--drivers/mtd/ubi/wl.c4
-rw-r--r--drivers/net/Kconfig2
-rw-r--r--drivers/net/Makefile1
-rw-r--r--drivers/net/bnx2x_link.c2
-rw-r--r--drivers/net/e1000/e1000_hw.c4
-rw-r--r--drivers/net/slip.h2
-rw-r--r--drivers/net/tehuti.c4
-rw-r--r--drivers/net/tokenring/smctr.c2
-rw-r--r--drivers/net/usb/kaweth.c6
-rw-r--r--drivers/net/usb/pegasus.c12
-rw-r--r--drivers/net/wimax/Kconfig17
-rw-r--r--drivers/net/wimax/Makefile5
-rw-r--r--drivers/net/wimax/i2400m/Kconfig49
-rw-r--r--drivers/net/wimax/i2400m/Makefile29
-rw-r--r--drivers/net/wimax/i2400m/control.c1291
-rw-r--r--drivers/net/wimax/i2400m/debug-levels.h45
-rw-r--r--drivers/net/wimax/i2400m/debugfs.c392
-rw-r--r--drivers/net/wimax/i2400m/driver.c728
-rw-r--r--drivers/net/wimax/i2400m/fw.c1095
-rw-r--r--drivers/net/wimax/i2400m/i2400m-sdio.h132
-rw-r--r--drivers/net/wimax/i2400m/i2400m-usb.h264
-rw-r--r--drivers/net/wimax/i2400m/i2400m.h755
-rw-r--r--drivers/net/wimax/i2400m/netdev.c524
-rw-r--r--drivers/net/wimax/i2400m/op-rfkill.c207
-rw-r--r--drivers/net/wimax/i2400m/rx.c534
-rw-r--r--drivers/net/wimax/i2400m/sdio-debug-levels.h22
-rw-r--r--drivers/net/wimax/i2400m/sdio-fw.c224
-rw-r--r--drivers/net/wimax/i2400m/sdio-rx.c255
-rw-r--r--drivers/net/wimax/i2400m/sdio-tx.c153
-rw-r--r--drivers/net/wimax/i2400m/sdio.c511
-rw-r--r--drivers/net/wimax/i2400m/tx.c817
-rw-r--r--drivers/net/wimax/i2400m/usb-debug-levels.h42
-rw-r--r--drivers/net/wimax/i2400m/usb-fw.c340
-rw-r--r--drivers/net/wimax/i2400m/usb-notif.c269
-rw-r--r--drivers/net/wimax/i2400m/usb-rx.c417
-rw-r--r--drivers/net/wimax/i2400m/usb-tx.c229
-rw-r--r--drivers/net/wimax/i2400m/usb.c591
-rw-r--r--drivers/net/wireless/atmel.c2
-rw-r--r--drivers/net/wireless/ipw2x00/ipw2100.c4
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00crypto.c4
-rw-r--r--drivers/net/wireless/strip.c2
-rw-r--r--drivers/rtc/rtc-ds1511.c2
-rw-r--r--drivers/rtc/rtc-stk17ta8.c2
-rw-r--r--drivers/s390/block/dasd_eer.c4
-rw-r--r--drivers/s390/char/vmlogrdr.c4
-rw-r--r--drivers/scsi/a100u2w.c2
-rw-r--r--drivers/scsi/lpfc/lpfc_hbadisc.c4
-rw-r--r--drivers/scsi/lpfc/lpfc_sli.c10
-rw-r--r--drivers/scsi/megaraid.c4
-rw-r--r--drivers/scsi/qla1280.c4
-rw-r--r--drivers/scsi/qla4xxx/ql4_mbx.c2
-rw-r--r--drivers/scsi/scsi_error.c2
-rw-r--r--drivers/scsi/scsi_scan.c3
-rw-r--r--drivers/scsi/sd.c109
-rw-r--r--drivers/serial/8250.c2
-rw-r--r--drivers/serial/crisv10.c4
-rw-r--r--drivers/spi/spi_lm70llp.c33
-rw-r--r--drivers/usb/Kconfig2
-rw-r--r--drivers/usb/class/cdc-acm.c2
-rw-r--r--drivers/usb/class/cdc-wdm.c3
-rw-r--r--drivers/usb/class/usbtmc.c9
-rw-r--r--drivers/usb/core/devio.c7
-rw-r--r--drivers/usb/core/driver.c181
-rw-r--r--drivers/usb/core/endpoint.c4
-rw-r--r--drivers/usb/core/generic.c10
-rw-r--r--drivers/usb/core/hcd-pci.c201
-rw-r--r--drivers/usb/core/hcd.c20
-rw-r--r--drivers/usb/core/hcd.h16
-rw-r--r--drivers/usb/core/hub.c142
-rw-r--r--drivers/usb/core/message.c164
-rw-r--r--drivers/usb/core/sysfs.c49
-rw-r--r--drivers/usb/core/urb.c43
-rw-r--r--drivers/usb/core/usb.c79
-rw-r--r--drivers/usb/core/usb.h24
-rw-r--r--drivers/usb/gadget/Kconfig43
-rw-r--r--drivers/usb/gadget/Makefile2
-rw-r--r--drivers/usb/gadget/ci13xxx_udc.c2830
-rw-r--r--drivers/usb/gadget/ci13xxx_udc.h195
-rw-r--r--drivers/usb/gadget/epautoconf.c2
-rw-r--r--drivers/usb/gadget/file_storage.c177
-rw-r--r--drivers/usb/gadget/fsl_qe_udc.c12
-rw-r--r--drivers/usb/gadget/gadget_chips.h8
-rw-r--r--drivers/usb/gadget/goku_udc.c2
-rw-r--r--drivers/usb/gadget/imx_udc.c1516
-rw-r--r--drivers/usb/gadget/imx_udc.h344
-rw-r--r--drivers/usb/gadget/m66592-udc.c9
-rw-r--r--drivers/usb/gadget/net2280.c2
-rw-r--r--drivers/usb/gadget/omap_udc.c4
-rw-r--r--drivers/usb/gadget/pxa25x_udc.c2
-rw-r--r--drivers/usb/gadget/pxa27x_udc.c2
-rw-r--r--drivers/usb/gadget/s3c2410_udc.c34
-rw-r--r--drivers/usb/host/Kconfig13
-rw-r--r--drivers/usb/host/Makefile1
-rw-r--r--drivers/usb/host/ehci-dbg.c8
-rw-r--r--drivers/usb/host/ehci-hub.c27
-rw-r--r--drivers/usb/host/ehci-pci.c12
-rw-r--r--drivers/usb/host/ehci-ppc-of.c45
-rw-r--r--drivers/usb/host/ehci.h34
-rw-r--r--drivers/usb/host/isp1760-hcd.c13
-rw-r--r--drivers/usb/host/isp1760-hcd.h1
-rw-r--r--drivers/usb/host/isp1760-if.c116
-rw-r--r--drivers/usb/host/ohci-hcd.c12
-rw-r--r--drivers/usb/host/ohci-pci.c6
-rw-r--r--drivers/usb/host/ohci-pnx4008.c85
-rw-r--r--drivers/usb/host/ohci-ppc-of.c25
-rw-r--r--drivers/usb/host/ohci-tmio.c2
-rw-r--r--drivers/usb/host/oxu210hp-hcd.c3985
-rw-r--r--drivers/usb/host/oxu210hp.h447
-rw-r--r--drivers/usb/host/pci-quirks.c14
-rw-r--r--drivers/usb/host/r8a66597-hcd.c8
-rw-r--r--drivers/usb/host/uhci-hcd.c2
-rw-r--r--drivers/usb/image/microtek.c11
-rw-r--r--drivers/usb/misc/berry_charge.c5
-rw-r--r--drivers/usb/misc/emi26.c2
-rw-r--r--drivers/usb/misc/usbtest.c2
-rw-r--r--drivers/usb/mon/Kconfig13
-rw-r--r--drivers/usb/mon/Makefile3
-rw-r--r--drivers/usb/musb/Kconfig12
-rw-r--r--drivers/usb/musb/Makefile8
-rw-r--r--drivers/usb/musb/blackfin.c320
-rw-r--r--drivers/usb/musb/blackfin.h52
-rw-r--r--drivers/usb/musb/davinci.c18
-rw-r--r--drivers/usb/musb/musb_core.c84
-rw-r--r--drivers/usb/musb/musb_core.h73
-rw-r--r--drivers/usb/musb/musb_gadget.c2
-rw-r--r--drivers/usb/musb/musb_host.c45
-rw-r--r--drivers/usb/musb/musb_io.h26
-rw-r--r--drivers/usb/musb/musb_regs.h397
-rw-r--r--drivers/usb/musb/musbhsdma.c84
-rw-r--r--drivers/usb/musb/musbhsdma.h149
-rw-r--r--drivers/usb/musb/omap2430.c15
-rw-r--r--drivers/usb/musb/tusb6010.c7
-rw-r--r--drivers/usb/otg/Kconfig54
-rw-r--r--drivers/usb/otg/Makefile15
-rw-r--r--drivers/usb/otg/gpio_vbus.c335
-rw-r--r--drivers/usb/otg/isp1301_omap.c (renamed from drivers/i2c/chips/isp1301_omap.c)0
-rw-r--r--drivers/usb/otg/otg.c65
-rw-r--r--drivers/usb/otg/twl4030-usb.c721
-rw-r--r--drivers/usb/serial/Kconfig17
-rw-r--r--drivers/usb/serial/Makefile2
-rw-r--r--drivers/usb/serial/digi_acceleport.c28
-rw-r--r--drivers/usb/serial/garmin_gps.c2
-rw-r--r--drivers/usb/serial/ipw.c4
-rw-r--r--drivers/usb/serial/iuu_phoenix.c38
-rw-r--r--drivers/usb/serial/mos7840.c38
-rw-r--r--drivers/usb/serial/opticon.c358
-rw-r--r--drivers/usb/serial/option.c11
-rw-r--r--drivers/usb/serial/siemens_mpi.c77
-rw-r--r--drivers/usb/serial/spcp8x5.c20
-rw-r--r--drivers/usb/serial/usb_debug.c2
-rw-r--r--drivers/usb/storage/Kconfig11
-rw-r--r--drivers/usb/storage/Makefile3
-rw-r--r--drivers/usb/storage/dpcm.c86
-rw-r--r--drivers/usb/storage/dpcm.h32
-rw-r--r--drivers/usb/storage/libusual.c7
-rw-r--r--drivers/usb/storage/option_ms.c147
-rw-r--r--drivers/usb/storage/option_ms.h4
-rw-r--r--drivers/usb/storage/protocol.c24
-rw-r--r--drivers/usb/storage/protocol.h3
-rw-r--r--drivers/usb/storage/scsiglue.c43
-rw-r--r--drivers/usb/storage/sddr09.c43
-rw-r--r--drivers/usb/storage/sddr09.h5
-rw-r--r--drivers/usb/storage/transport.c219
-rw-r--r--drivers/usb/storage/transport.h2
-rw-r--r--drivers/usb/storage/unusual_devs.h354
-rw-r--r--drivers/usb/storage/usb.c106
-rw-r--r--drivers/usb/storage/usb.h5
-rw-r--r--drivers/usb/wusbcore/rh.c2
-rw-r--r--drivers/uwb/i1480/dfu/usb.c2
-rw-r--r--drivers/video/console/vgacon.c2
-rw-r--r--firmware/.gitignore1
-rw-r--r--firmware/Makefile10
-rw-r--r--fs/debugfs/file.c32
-rw-r--r--fs/gfs2/Kconfig2
-rw-r--r--fs/gfs2/ops_address.c1
-rw-r--r--fs/gfs2/ops_file.c2
-rw-r--r--fs/inode.c20
-rw-r--r--fs/ncpfs/ioctl.c2
-rw-r--r--fs/ocfs2/cluster/heartbeat.c2
-rw-r--r--fs/proc/base.c231
-rw-r--r--fs/proc/generic.c8
-rw-r--r--fs/proc/inode.c3
-rw-r--r--fs/proc/proc_net.c2
-rw-r--r--fs/proc/root.c8
-rw-r--r--fs/proc/task_nommu.c2
-rw-r--r--fs/super.c10
-rw-r--r--fs/ubifs/Kconfig2
-rw-r--r--fs/ubifs/budget.c4
-rw-r--r--fs/ubifs/gc.c2
-rw-r--r--fs/ubifs/journal.c2
-rw-r--r--fs/ubifs/shrinker.c2
-rw-r--r--fs/xfs/linux-2.6/xfs_super.c2
-rw-r--r--include/acpi/acmacros.h4
-rw-r--r--include/acpi/actypes.h2
-rw-r--r--include/linux/Kbuild2
-rw-r--r--include/linux/async.h25
-rw-r--r--include/linux/atmel-mci.h (renamed from arch/avr32/include/asm/atmel-mci.h)6
-rw-r--r--include/linux/debugfs.h2
-rw-r--r--include/linux/fs.h5
-rw-r--r--include/linux/i2c.h4
-rw-r--r--include/linux/mtd/mtd.h2
-rw-r--r--include/linux/ncp_fs.h2
-rw-r--r--include/linux/oxu210hp.h7
-rw-r--r--include/linux/qnx4_fs.h4
-rw-r--r--include/linux/qnxtypes.h5
-rw-r--r--include/linux/spi/spi.h4
-rw-r--r--include/linux/types.h3
-rw-r--r--include/linux/usb.h30
-rw-r--r--include/linux/usb/association.h22
-rw-r--r--include/linux/usb/gpio_vbus.h30
-rw-r--r--include/linux/usb/musb.h5
-rw-r--r--include/linux/usb/otg.h1
-rw-r--r--include/linux/usb_usual.h7
-rw-r--r--include/linux/wimax.h234
-rw-r--r--include/linux/wimax/Kbuild1
-rw-r--r--include/linux/wimax/debug.h453
-rw-r--r--include/linux/wimax/i2400m.h512
-rw-r--r--include/mtd/ubi-user.h2
-rw-r--r--include/net/wimax.h520
-rw-r--r--init/do_mounts.c2
-rw-r--r--init/main.c8
-rw-r--r--kernel/Makefile3
-rw-r--r--kernel/async.c321
-rw-r--r--kernel/cpu.c6
-rw-r--r--kernel/irq/autoprobe.c5
-rw-r--r--kernel/module.c2
-rw-r--r--kernel/pid.c2
-rw-r--r--kernel/printk.c2
-rw-r--r--kernel/time/jiffies.c2
-rw-r--r--lib/radix-tree.c11
-rw-r--r--mm/slub.c2
-rw-r--r--net/Kconfig2
-rw-r--r--net/Makefile1
-rw-r--r--net/netlink/genetlink.c1
-rw-r--r--net/sctp/auth.c4
-rw-r--r--net/sctp/sm_statefuns.c6
-rw-r--r--net/sctp/socket.c2
-rw-r--r--net/sctp/tsnmap.c2
-rw-r--r--net/wimax/Kconfig38
-rw-r--r--net/wimax/Makefile13
-rw-r--r--net/wimax/debug-levels.h42
-rw-r--r--net/wimax/debugfs.c90
-rw-r--r--net/wimax/id-table.c142
-rw-r--r--net/wimax/op-msg.c421
-rw-r--r--net/wimax/op-reset.c143
-rw-r--r--net/wimax/op-rfkill.c532
-rw-r--r--net/wimax/stack.c599
-rw-r--r--net/wimax/wimax-internal.h91
-rw-r--r--scripts/.gitignore1
-rw-r--r--scripts/Makefile3
-rw-r--r--scripts/bootgraph.pl16
-rwxr-xr-xscripts/config150
-rw-r--r--scripts/ihex2fw.c (renamed from firmware/ihex2fw.c)0
-rwxr-xr-xscripts/tags.sh18
-rw-r--r--sound/oss/aedsp16.c2
-rw-r--r--sound/usb/usx2y/usbusx2y.c2
826 files changed, 65680 insertions, 12522 deletions
diff --git a/CREDITS b/CREDITS
index abe05a0be4ed..939da46a87fb 100644
--- a/CREDITS
+++ b/CREDITS
@@ -464,6 +464,11 @@ S: 1200 Goldenrod Dr.
464S: Nampa, Idaho 83686 464S: Nampa, Idaho 83686
465S: USA 465S: USA
466 466
467N: Dirk J. Brandewie
468E: dirk.j.brandewie@intel.com
469E: linux-wimax@intel.com
470D: Intel Wireless WiMAX Connection 2400 SDIO driver
471
467N: Derrick J. Brashear 472N: Derrick J. Brashear
468E: shadow@dementia.org 473E: shadow@dementia.org
469W: http://www.dementia.org/~shadow 474W: http://www.dementia.org/~shadow
@@ -1681,7 +1686,7 @@ E: ajoshi@shell.unixbox.com
1681D: fbdev hacking 1686D: fbdev hacking
1682 1687
1683N: Jesper Juhl 1688N: Jesper Juhl
1684E: jesper.juhl@gmail.com 1689E: jj@chaosbits.net
1685D: Various fixes, cleanups and minor features all over the tree. 1690D: Various fixes, cleanups and minor features all over the tree.
1686D: Wrote initial version of the hdaps driver (since passed on to others). 1691D: Wrote initial version of the hdaps driver (since passed on to others).
1687S: Lemnosvej 1, 3.tv 1692S: Lemnosvej 1, 3.tv
@@ -2119,6 +2124,11 @@ N: H.J. Lu
2119E: hjl@gnu.ai.mit.edu 2124E: hjl@gnu.ai.mit.edu
2120D: GCC + libraries hacker 2125D: GCC + libraries hacker
2121 2126
2127N: Yanir Lubetkin
2128E: yanirx.lubatkin@intel.com
2129E: linux-wimax@intel.com
2130D: Intel Wireless WiMAX Connection 2400 driver
2131
2122N: Michal Ludvig 2132N: Michal Ludvig
2123E: michal@logix.cz 2133E: michal@logix.cz
2124E: michal.ludvig@asterisk.co.nz 2134E: michal.ludvig@asterisk.co.nz
@@ -2693,6 +2703,13 @@ S: RR #5, 497 Pole Line Road
2693S: Thunder Bay, Ontario 2703S: Thunder Bay, Ontario
2694S: CANADA P7C 5M9 2704S: CANADA P7C 5M9
2695 2705
2706N: Inaky Perez-Gonzalez
2707E: inaky.perez-gonzalez@intel.com
2708E: linux-wimax@intel.com
2709E: inakypg@yahoo.com
2710D: WiMAX stack
2711D: Intel Wireless WiMAX Connection 2400 driver
2712
2696N: Yuri Per 2713N: Yuri Per
2697E: yuri@pts.mipt.ru 2714E: yuri@pts.mipt.ru
2698D: Some smbfs fixes 2715D: Some smbfs fixes
diff --git a/Documentation/DocBook/networking.tmpl b/Documentation/DocBook/networking.tmpl
index 627707a3cb9d..59ad69a9d777 100644
--- a/Documentation/DocBook/networking.tmpl
+++ b/Documentation/DocBook/networking.tmpl
@@ -74,6 +74,14 @@
74!Enet/sunrpc/rpcb_clnt.c 74!Enet/sunrpc/rpcb_clnt.c
75!Enet/sunrpc/clnt.c 75!Enet/sunrpc/clnt.c
76 </sect1> 76 </sect1>
77 <sect1><title>WiMAX</title>
78!Enet/wimax/op-msg.c
79!Enet/wimax/op-reset.c
80!Enet/wimax/op-rfkill.c
81!Enet/wimax/stack.c
82!Iinclude/net/wimax.h
83!Iinclude/linux/wimax.h
84 </sect1>
77 </chapter> 85 </chapter>
78 86
79 <chapter id="netdev"> 87 <chapter id="netdev">
diff --git a/Documentation/blackfin/00-INDEX b/Documentation/blackfin/00-INDEX
index 7cb3b356b249..d6840a91e1e1 100644
--- a/Documentation/blackfin/00-INDEX
+++ b/Documentation/blackfin/00-INDEX
@@ -9,3 +9,6 @@ cachefeatures.txt
9 9
10Filesystems 10Filesystems
11 - Requirements for mounting the root file system. 11 - Requirements for mounting the root file system.
12
13bfin-gpio-note.txt
14 - Notes in developing/using bfin-gpio driver.
diff --git a/Documentation/blackfin/bfin-gpio-notes.txt b/Documentation/blackfin/bfin-gpio-notes.txt
new file mode 100644
index 000000000000..9898c7ded7d3
--- /dev/null
+++ b/Documentation/blackfin/bfin-gpio-notes.txt
@@ -0,0 +1,71 @@
1/*
2 * File: Documentation/blackfin/bfin-gpio-note.txt
3 * Based on:
4 * Author:
5 *
6 * Created: $Id: bfin-gpio-note.txt 2008-11-24 16:42 grafyang $
7 * Description: This file contains the notes in developing/using bfin-gpio.
8 *
9 *
10 * Rev:
11 *
12 * Modified:
13 * Copyright 2004-2008 Analog Devices Inc.
14 *
15 * Bugs: Enter bugs at http://blackfin.uclinux.org/
16 *
17 */
18
19
201. Blackfin GPIO introduction
21
22 There are many GPIO pins on Blackfin. Most of these pins are muxed to
23 multi-functions. They can be configured as peripheral, or just as GPIO,
24 configured to input with interrupt enabled, or output.
25
26 For detailed information, please see "arch/blackfin/kernel/bfin_gpio.c",
27 or the relevant HRM.
28
29
302. Avoiding resource conflict
31
32 Followed function groups are used to avoiding resource conflict,
33 - Use the pin as peripheral,
34 int peripheral_request(unsigned short per, const char *label);
35 int peripheral_request_list(const unsigned short per[], const char *label);
36 void peripheral_free(unsigned short per);
37 void peripheral_free_list(const unsigned short per[]);
38 - Use the pin as GPIO,
39 int bfin_gpio_request(unsigned gpio, const char *label);
40 void bfin_gpio_free(unsigned gpio);
41 - Use the pin as GPIO interrupt,
42 int bfin_gpio_irq_request(unsigned gpio, const char *label);
43 void bfin_gpio_irq_free(unsigned gpio);
44
45 The request functions will record the function state for a certain pin,
46 the free functions will clear it's function state.
47 Once a pin is requested, it can't be requested again before it is freed by
48 previous caller, otherwise kernel will dump stacks, and the request
49 function fail.
50 These functions are wrapped by other functions, most of the users need not
51 care.
52
53
543. But there are some exceptions
55 - Kernel permit the identical GPIO be requested both as GPIO and GPIO
56 interrut.
57 Some drivers, like gpio-keys, need this behavior. Kernel only print out
58 warning messages like,
59 bfin-gpio: GPIO 24 is already reserved by gpio-keys: BTN0, and you are
60configuring it as IRQ!
61
62 Note: Consider the case that, if there are two drivers need the
63 identical GPIO, one of them use it as GPIO, the other use it as
64 GPIO interrupt. This will really cause resource conflict. So if
65 there is any abnormal driver behavior, please check the bfin-gpio
66 warning messages.
67
68 - Kernel permit the identical GPIO be requested from the same driver twice.
69
70
71
diff --git a/Documentation/dell_rbu.txt b/Documentation/dell_rbu.txt
index 2c0d631de0cf..c11b931f8f98 100644
--- a/Documentation/dell_rbu.txt
+++ b/Documentation/dell_rbu.txt
@@ -81,8 +81,8 @@ Until this step is completed the driver cannot be unloaded.
81Also echoing either mono ,packet or init in to image_type will free up the 81Also echoing either mono ,packet or init in to image_type will free up the
82memory allocated by the driver. 82memory allocated by the driver.
83 83
84If an user by accident executes steps 1 and 3 above without executing step 2; 84If a user by accident executes steps 1 and 3 above without executing step 2;
85it will make the /sys/class/firmware/dell_rbu/ entries to disappear. 85it will make the /sys/class/firmware/dell_rbu/ entries disappear.
86The entries can be recreated by doing the following 86The entries can be recreated by doing the following
87echo init > /sys/devices/platform/dell_rbu/image_type 87echo init > /sys/devices/platform/dell_rbu/image_type
88NOTE: echoing init in image_type does not change it original value. 88NOTE: echoing init in image_type does not change it original value.
diff --git a/Documentation/feature-removal-schedule.txt b/Documentation/feature-removal-schedule.txt
index 2193be53e773..5ddbe350487a 100644
--- a/Documentation/feature-removal-schedule.txt
+++ b/Documentation/feature-removal-schedule.txt
@@ -318,6 +318,14 @@ Who: Jean Delvare <khali@linux-fr.org>
318 318
319--------------------------- 319---------------------------
320 320
321What: fscher and fscpos drivers
322When: June 2009
323Why: Deprecated by the new fschmd driver.
324Who: Hans de Goede <hdegoede@redhat.com>
325 Jean Delvare <khali@linux-fr.org>
326
327---------------------------
328
321What: SELinux "compat_net" functionality 329What: SELinux "compat_net" functionality
322When: 2.6.30 at the earliest 330When: 2.6.30 at the earliest
323Why: In 2.6.18 the Secmark concept was introduced to replace the "compat_net" 331Why: In 2.6.18 the Secmark concept was introduced to replace the "compat_net"
diff --git a/Documentation/filesystems/proc.txt b/Documentation/filesystems/proc.txt
index 32e94635484f..d105eb45282a 100644
--- a/Documentation/filesystems/proc.txt
+++ b/Documentation/filesystems/proc.txt
@@ -140,6 +140,7 @@ Table 1-1: Process specific entries in /proc
140 statm Process memory status information 140 statm Process memory status information
141 status Process status in human readable form 141 status Process status in human readable form
142 wchan If CONFIG_KALLSYMS is set, a pre-decoded wchan 142 wchan If CONFIG_KALLSYMS is set, a pre-decoded wchan
143 stack Report full stack trace, enable via CONFIG_STACKTRACE
143 smaps Extension based on maps, the rss size for each mapped file 144 smaps Extension based on maps, the rss size for each mapped file
144.............................................................................. 145..............................................................................
145 146
diff --git a/Documentation/hwmon/abituguru-datasheet b/Documentation/hwmon/abituguru-datasheet
index aef5a9b36846..4d184f2db0ea 100644
--- a/Documentation/hwmon/abituguru-datasheet
+++ b/Documentation/hwmon/abituguru-datasheet
@@ -74,7 +74,7 @@ a sensor.
74Notice that some banks have both a read and a write address this is how the 74Notice that some banks have both a read and a write address this is how the
75uGuru determines if a read from or a write to the bank is taking place, thus 75uGuru determines if a read from or a write to the bank is taking place, thus
76when reading you should always use the read address and when writing the 76when reading you should always use the read address and when writing the
77write address. The write address is always one (1) more then the read address. 77write address. The write address is always one (1) more than the read address.
78 78
79 79
80uGuru ready 80uGuru ready
@@ -224,7 +224,7 @@ Bit 3: Beep if alarm (RW)
224Bit 4: 1 if alarm cause measured temp is over the warning threshold (R) 224Bit 4: 1 if alarm cause measured temp is over the warning threshold (R)
225Bit 5: 1 if alarm cause measured volt is over the max threshold (R) 225Bit 5: 1 if alarm cause measured volt is over the max threshold (R)
226Bit 6: 1 if alarm cause measured volt is under the min threshold (R) 226Bit 6: 1 if alarm cause measured volt is under the min threshold (R)
227Bit 7: Volt sensor: Shutdown if alarm persist for more then 4 seconds (RW) 227Bit 7: Volt sensor: Shutdown if alarm persist for more than 4 seconds (RW)
228 Temp sensor: Shutdown if temp is over the shutdown threshold (RW) 228 Temp sensor: Shutdown if temp is over the shutdown threshold (RW)
229 229
230* This bit is only honored/used by the uGuru if a temp sensor is connected 230* This bit is only honored/used by the uGuru if a temp sensor is connected
@@ -293,7 +293,7 @@ Byte 0:
293Alarm behaviour for the selected sensor. A 1 enables the described behaviour. 293Alarm behaviour for the selected sensor. A 1 enables the described behaviour.
294Bit 0: Give an alarm if measured rpm is under the min threshold (RW) 294Bit 0: Give an alarm if measured rpm is under the min threshold (RW)
295Bit 3: Beep if alarm (RW) 295Bit 3: Beep if alarm (RW)
296Bit 7: Shutdown if alarm persist for more then 4 seconds (RW) 296Bit 7: Shutdown if alarm persist for more than 4 seconds (RW)
297 297
298Byte 1: 298Byte 1:
299min threshold (scale as bank 0x26) 299min threshold (scale as bank 0x26)
diff --git a/Documentation/hwmon/f71882fg b/Documentation/hwmon/f71882fg
new file mode 100644
index 000000000000..a8321267b5b6
--- /dev/null
+++ b/Documentation/hwmon/f71882fg
@@ -0,0 +1,89 @@
1Kernel driver f71882fg
2======================
3
4Supported chips:
5 * Fintek F71882FG and F71883FG
6 Prefix: 'f71882fg'
7 Addresses scanned: none, address read from Super I/O config space
8 Datasheet: Available from the Fintek website
9 * Fintek F71862FG and F71863FG
10 Prefix: 'f71862fg'
11 Addresses scanned: none, address read from Super I/O config space
12 Datasheet: Available from the Fintek website
13 * Fintek F8000
14 Prefix: 'f8000'
15 Addresses scanned: none, address read from Super I/O config space
16 Datasheet: Not public
17
18Author: Hans de Goede <hdegoede@redhat.com>
19
20
21Description
22-----------
23
24Fintek F718xxFG/F8000 Super I/O chips include complete hardware monitoring
25capabilities. They can monitor up to 9 voltages (3 for the F8000), 4 fans and
263 temperature sensors.
27
28These chips also have fan controlling features, using either DC or PWM, in
29three different modes (one manual, two automatic).
30
31The driver assumes that no more than one chip is present, which seems
32reasonable.
33
34
35Monitoring
36----------
37
38The Voltage, Fan and Temperature Monitoring uses the standard sysfs
39interface as documented in sysfs-interface, without any exceptions.
40
41
42Fan Control
43-----------
44
45Both PWM (pulse-width modulation) and DC fan speed control methods are
46supported. The right one to use depends on external circuitry on the
47motherboard, so the driver assumes that the BIOS set the method
48properly.
49
50There are 2 modes to specify the speed of the fan, PWM duty cycle (or DC
51voltage) mode, where 0-100% duty cycle (0-100% of 12V) is specified. And RPM
52mode where the actual RPM of the fan (as measured) is controlled and the speed
53gets specified as 0-100% of the fan#_full_speed file.
54
55Since both modes work in a 0-100% (mapped to 0-255) scale, there isn't a
56whole lot of a difference when modifying fan control settings. The only
57important difference is that in RPM mode the 0-100% controls the fan speed
58between 0-100% of fan#_full_speed. It is assumed that if the BIOS programs
59RPM mode, it will also set fan#_full_speed properly, if it does not then
60fan control will not work properly, unless you set a sane fan#_full_speed
61value yourself.
62
63Switching between these modes requires re-initializing a whole bunch of
64registers, so the mode which the BIOS has set is kept. The mode is
65printed when loading the driver.
66
67Three different fan control modes are supported; the mode number is written
68to the pwm#_enable file. Note that not all modes are supported on all
69chips, and some modes may only be available in RPM / PWM mode on the F8000.
70Writing an unsupported mode will result in an invalid parameter error.
71
72* 1: Manual mode
73 You ask for a specific PWM duty cycle / DC voltage or a specific % of
74 fan#_full_speed by writing to the pwm# file. This mode is only
75 available on the F8000 if the fan channel is in RPM mode.
76
77* 2: Normal auto mode
78 You can define a number of temperature/fan speed trip points, which % the
79 fan should run at at this temp and which temp a fan should follow using the
80 standard sysfs interface. The number and type of trip points is chip
81 depended, see which files are available in sysfs.
82 Fan/PWM channel 3 of the F8000 is always in this mode!
83
84* 3: Thermostat mode (Only available on the F8000 when in duty cycle mode)
85 The fan speed is regulated to keep the temp the fan is mapped to between
86 temp#_auto_point2_temp and temp#_auto_point3_temp.
87
88Both of the automatic modes require that pwm1 corresponds to fan1, pwm2 to
89fan2 and pwm3 to fan3.
diff --git a/Documentation/hwmon/it87 b/Documentation/hwmon/it87
index 042c0415140b..659315d98e00 100644
--- a/Documentation/hwmon/it87
+++ b/Documentation/hwmon/it87
@@ -26,6 +26,10 @@ Supported chips:
26 Datasheet: Publicly available at the ITE website 26 Datasheet: Publicly available at the ITE website
27 http://www.ite.com.tw/product_info/file/pc/IT8718F_V0.2.zip 27 http://www.ite.com.tw/product_info/file/pc/IT8718F_V0.2.zip
28 http://www.ite.com.tw/product_info/file/pc/IT8718F_V0%203_(for%20C%20version).zip 28 http://www.ite.com.tw/product_info/file/pc/IT8718F_V0%203_(for%20C%20version).zip
29 * IT8720F
30 Prefix: 'it8720'
31 Addresses scanned: from Super I/O config space (8 I/O ports)
32 Datasheet: Not yet publicly available.
29 * SiS950 [clone of IT8705F] 33 * SiS950 [clone of IT8705F]
30 Prefix: 'it87' 34 Prefix: 'it87'
31 Addresses scanned: from Super I/O config space (8 I/O ports) 35 Addresses scanned: from Super I/O config space (8 I/O ports)
@@ -71,7 +75,7 @@ Description
71----------- 75-----------
72 76
73This driver implements support for the IT8705F, IT8712F, IT8716F, 77This driver implements support for the IT8705F, IT8712F, IT8716F,
74IT8718F, IT8726F and SiS950 chips. 78IT8718F, IT8720F, IT8726F and SiS950 chips.
75 79
76These chips are 'Super I/O chips', supporting floppy disks, infrared ports, 80These chips are 'Super I/O chips', supporting floppy disks, infrared ports,
77joysticks and other miscellaneous stuff. For hardware monitoring, they 81joysticks and other miscellaneous stuff. For hardware monitoring, they
@@ -84,19 +88,19 @@ the IT8716F and late IT8712F have 6. They are shared with other functions
84though, so the functionality may not be available on a given system. 88though, so the functionality may not be available on a given system.
85The driver dumbly assume it is there. 89The driver dumbly assume it is there.
86 90
87The IT8718F also features VID inputs (up to 8 pins) but the value is 91The IT8718F and IT8720F also features VID inputs (up to 8 pins) but the value
88stored in the Super-I/O configuration space. Due to technical limitations, 92is stored in the Super-I/O configuration space. Due to technical limitations,
89this value can currently only be read once at initialization time, so 93this value can currently only be read once at initialization time, so
90the driver won't notice and report changes in the VID value. The two 94the driver won't notice and report changes in the VID value. The two
91upper VID bits share their pins with voltage inputs (in5 and in6) so you 95upper VID bits share their pins with voltage inputs (in5 and in6) so you
92can't have both on a given board. 96can't have both on a given board.
93 97
94The IT8716F, IT8718F and later IT8712F revisions have support for 98The IT8716F, IT8718F, IT8720F and later IT8712F revisions have support for
952 additional fans. The additional fans are supported by the driver. 992 additional fans. The additional fans are supported by the driver.
96 100
97The IT8716F and IT8718F, and late IT8712F and IT8705F also have optional 101The IT8716F, IT8718F and IT8720F, and late IT8712F and IT8705F also have
9816-bit tachometer counters for fans 1 to 3. This is better (no more fan 102optional 16-bit tachometer counters for fans 1 to 3. This is better (no more
99clock divider mess) but not compatible with the older chips and 103fan clock divider mess) but not compatible with the older chips and
100revisions. The 16-bit tachometer mode is enabled by the driver when one 104revisions. The 16-bit tachometer mode is enabled by the driver when one
101of the above chips is detected. 105of the above chips is detected.
102 106
@@ -122,7 +126,7 @@ zero'; this is important for negative voltage measurements. All voltage
122inputs can measure voltages between 0 and 4.08 volts, with a resolution of 126inputs can measure voltages between 0 and 4.08 volts, with a resolution of
1230.016 volt. The battery voltage in8 does not have limit registers. 1270.016 volt. The battery voltage in8 does not have limit registers.
124 128
125The VID lines (IT8712F/IT8716F/IT8718F) encode the core voltage value: 129The VID lines (IT8712F/IT8716F/IT8718F/IT8720F) encode the core voltage value:
126the voltage level your processor should work with. This is hardcoded by 130the voltage level your processor should work with. This is hardcoded by
127the mainboard and/or processor itself. It is a value in volts. 131the mainboard and/or processor itself. It is a value in volts.
128 132
diff --git a/Documentation/hwmon/lm70 b/Documentation/hwmon/lm70
index 2bdd3feebf53..0d240291e3cc 100644
--- a/Documentation/hwmon/lm70
+++ b/Documentation/hwmon/lm70
@@ -1,9 +1,11 @@
1Kernel driver lm70 1Kernel driver lm70
2================== 2==================
3 3
4Supported chip: 4Supported chips:
5 * National Semiconductor LM70 5 * National Semiconductor LM70
6 Datasheet: http://www.national.com/pf/LM/LM70.html 6 Datasheet: http://www.national.com/pf/LM/LM70.html
7 * Texas Instruments TMP121/TMP123
8 Information: http://focus.ti.com/docs/prod/folders/print/tmp121.html
7 9
8Author: 10Author:
9 Kaiwan N Billimoria <kaiwan@designergraphix.com> 11 Kaiwan N Billimoria <kaiwan@designergraphix.com>
@@ -25,6 +27,14 @@ complement digital temperature (sent via the SIO line), is available in the
25driver for interpretation. This driver makes use of the kernel's in-core 27driver for interpretation. This driver makes use of the kernel's in-core
26SPI support. 28SPI support.
27 29
30As a real (in-tree) example of this "SPI protocol driver" interfacing
31with a "SPI master controller driver", see drivers/spi/spi_lm70llp.c
32and its associated documentation.
33
34The TMP121/TMP123 are very similar; main differences are 4 wire SPI inter-
35face (read only) and 13-bit temperature data (0.0625 degrees celsius reso-
36lution).
37
28Thanks to 38Thanks to
29--------- 39---------
30Jean Delvare <khali@linux-fr.org> for mentoring the hwmon-side driver 40Jean Delvare <khali@linux-fr.org> for mentoring the hwmon-side driver
diff --git a/Documentation/hwmon/lm85 b/Documentation/hwmon/lm85
index 400620741290..a13680871bc7 100644
--- a/Documentation/hwmon/lm85
+++ b/Documentation/hwmon/lm85
@@ -164,7 +164,7 @@ configured individually according to the following options.
164 temperature. (PWM value from 0 to 255) 164 temperature. (PWM value from 0 to 255)
165 165
166* pwm#_auto_pwm_minctl - this flags selects for temp#_auto_temp_off temperature 166* pwm#_auto_pwm_minctl - this flags selects for temp#_auto_temp_off temperature
167 the bahaviour of fans. Write 1 to let fans spinning at 167 the behaviour of fans. Write 1 to let fans spinning at
168 pwm#_auto_pwm_min or write 0 to let them off. 168 pwm#_auto_pwm_min or write 0 to let them off.
169 169
170NOTE: It has been reported that there is a bug in the LM85 that causes the flag 170NOTE: It has been reported that there is a bug in the LM85 that causes the flag
diff --git a/Documentation/hwmon/ltc4245 b/Documentation/hwmon/ltc4245
new file mode 100644
index 000000000000..bae7a3adc5d8
--- /dev/null
+++ b/Documentation/hwmon/ltc4245
@@ -0,0 +1,81 @@
1Kernel driver ltc4245
2=====================
3
4Supported chips:
5 * Linear Technology LTC4245
6 Prefix: 'ltc4245'
7 Addresses scanned: 0x20-0x3f
8 Datasheet:
9 http://www.linear.com/pc/downloadDocument.do?navId=H0,C1,C1003,C1006,C1140,P19392,D13517
10
11Author: Ira W. Snyder <iws@ovro.caltech.edu>
12
13
14Description
15-----------
16
17The LTC4245 controller allows a board to be safely inserted and removed
18from a live backplane in multiple supply systems such as CompactPCI and
19PCI Express.
20
21
22Usage Notes
23-----------
24
25This driver does not probe for LTC4245 devices, due to the fact that some
26of the possible addresses are unfriendly to probing. You will need to use
27the "force" parameter to tell the driver where to find the device.
28
29Example: the following will load the driver for an LTC4245 at address 0x23
30on I2C bus #1:
31$ modprobe ltc4245 force=1,0x23
32
33
34Sysfs entries
35-------------
36
37The LTC4245 has built-in limits for over and under current warnings. This
38makes it very likely that the reference circuit will be used.
39
40This driver uses the values in the datasheet to change the register values
41into the values specified in the sysfs-interface document. The current readings
42rely on the sense resistors listed in Table 2: "Sense Resistor Values".
43
44in1_input 12v input voltage (mV)
45in2_input 5v input voltage (mV)
46in3_input 3v input voltage (mV)
47in4_input Vee (-12v) input voltage (mV)
48
49in1_min_alarm 12v input undervoltage alarm
50in2_min_alarm 5v input undervoltage alarm
51in3_min_alarm 3v input undervoltage alarm
52in4_min_alarm Vee (-12v) input undervoltage alarm
53
54curr1_input 12v current (mA)
55curr2_input 5v current (mA)
56curr3_input 3v current (mA)
57curr4_input Vee (-12v) current (mA)
58
59curr1_max_alarm 12v overcurrent alarm
60curr2_max_alarm 5v overcurrent alarm
61curr3_max_alarm 3v overcurrent alarm
62curr4_max_alarm Vee (-12v) overcurrent alarm
63
64in5_input 12v output voltage (mV)
65in6_input 5v output voltage (mV)
66in7_input 3v output voltage (mV)
67in8_input Vee (-12v) output voltage (mV)
68
69in5_min_alarm 12v output undervoltage alarm
70in6_min_alarm 5v output undervoltage alarm
71in7_min_alarm 3v output undervoltage alarm
72in8_min_alarm Vee (-12v) output undervoltage alarm
73
74in9_input GPIO #1 voltage data
75in10_input GPIO #2 voltage data
76in11_input GPIO #3 voltage data
77
78power1_input 12v power usage (mW)
79power2_input 5v power usage (mW)
80power3_input 3v power usage (mW)
81power4_input Vee (-12v) power usage (mW)
diff --git a/Documentation/kbuild/kbuild.txt b/Documentation/kbuild/kbuild.txt
index 51771847e816..923f9ddee8f6 100644
--- a/Documentation/kbuild/kbuild.txt
+++ b/Documentation/kbuild/kbuild.txt
@@ -124,3 +124,10 @@ KBUILD_EXTRA_SYMBOLS
124-------------------------------------------------- 124--------------------------------------------------
125For modules use symbols from another modules. 125For modules use symbols from another modules.
126See more details in modules.txt. 126See more details in modules.txt.
127
128ALLSOURCE_ARCHS
129--------------------------------------------------
130For tags/TAGS/cscope targets, you can specify more than one archs
131to be included in the databases, separated by blankspace. e.g.
132
133 $ make ALLSOURCE_ARCHS="x86 mips arm" tags
diff --git a/Documentation/kbuild/modules.txt b/Documentation/kbuild/modules.txt
index 1821c077b435..b1096da953c8 100644
--- a/Documentation/kbuild/modules.txt
+++ b/Documentation/kbuild/modules.txt
@@ -253,7 +253,7 @@ following files:
253 253
254 # Module specific targets 254 # Module specific targets
255 genbin: 255 genbin:
256 echo "X" > 8123_bin_shipped 256 echo "X" > 8123_bin.o_shipped
257 257
258 258
259 In example 2, we are down to two fairly simple files and for simple 259 In example 2, we are down to two fairly simple files and for simple
@@ -279,7 +279,7 @@ following files:
279 279
280 # Module specific targets 280 # Module specific targets
281 genbin: 281 genbin:
282 echo "X" > 8123_bin_shipped 282 echo "X" > 8123_bin.o_shipped
283 283
284 endif 284 endif
285 285
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
index 0072fabb1dd1..532eacbbed62 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -91,6 +91,7 @@ parameter is applicable:
91 SUSPEND System suspend states are enabled. 91 SUSPEND System suspend states are enabled.
92 FTRACE Function tracing enabled. 92 FTRACE Function tracing enabled.
93 TS Appropriate touchscreen support is enabled. 93 TS Appropriate touchscreen support is enabled.
94 UMS USB Mass Storage support is enabled.
94 USB USB support is enabled. 95 USB USB support is enabled.
95 USBHID USB Human Interface Device support is enabled. 96 USBHID USB Human Interface Device support is enabled.
96 V4L Video For Linux support is enabled. 97 V4L Video For Linux support is enabled.
@@ -2387,6 +2388,41 @@ and is between 256 and 4096 characters. It is defined in the file
2387 usbhid.mousepoll= 2388 usbhid.mousepoll=
2388 [USBHID] The interval which mice are to be polled at. 2389 [USBHID] The interval which mice are to be polled at.
2389 2390
2391 usb-storage.delay_use=
2392 [UMS] The delay in seconds before a new device is
2393 scanned for Logical Units (default 5).
2394
2395 usb-storage.quirks=
2396 [UMS] A list of quirks entries to supplement or
2397 override the built-in unusual_devs list. List
2398 entries are separated by commas. Each entry has
2399 the form VID:PID:Flags where VID and PID are Vendor
2400 and Product ID values (4-digit hex numbers) and
2401 Flags is a set of characters, each corresponding
2402 to a common usb-storage quirk flag as follows:
2403 a = SANE_SENSE (collect more than 18 bytes
2404 of sense data);
2405 c = FIX_CAPACITY (decrease the reported
2406 device capacity by one sector);
2407 h = CAPACITY_HEURISTICS (decrease the
2408 reported device capacity by one
2409 sector if the number is odd);
2410 i = IGNORE_DEVICE (don't bind to this
2411 device);
2412 l = NOT_LOCKABLE (don't try to lock and
2413 unlock ejectable media);
2414 m = MAX_SECTORS_64 (don't transfer more
2415 than 64 sectors = 32 KB at a time);
2416 o = CAPACITY_OK (accept the capacity
2417 reported by the device);
2418 r = IGNORE_RESIDUE (the device reports
2419 bogus residue values);
2420 s = SINGLE_LUN (the device has only one
2421 Logical Unit);
2422 w = NO_WP_DETECT (don't test whether the
2423 medium is write-protected).
2424 Example: quirks=0419:aaf5:rl,0421:0433:rc
2425
2390 add_efi_memmap [EFI; x86-32,X86-64] Include EFI memory map in 2426 add_efi_memmap [EFI; x86-32,X86-64] Include EFI memory map in
2391 kernel's map of available physical RAM. 2427 kernel's map of available physical RAM.
2392 2428
diff --git a/Documentation/laptops/thinkpad-acpi.txt b/Documentation/laptops/thinkpad-acpi.txt
index 71f0fe1fc1b0..898b4987bb80 100644
--- a/Documentation/laptops/thinkpad-acpi.txt
+++ b/Documentation/laptops/thinkpad-acpi.txt
@@ -1475,7 +1475,7 @@ Sysfs interface changelog:
1475 1475
14760x020100: Marker for thinkpad-acpi with hot key NVRAM polling 14760x020100: Marker for thinkpad-acpi with hot key NVRAM polling
1477 support. If you must, use it to know you should not 1477 support. If you must, use it to know you should not
1478 start an userspace NVRAM poller (allows to detect when 1478 start a userspace NVRAM poller (allows to detect when
1479 NVRAM is compiled out by the user because it is 1479 NVRAM is compiled out by the user because it is
1480 unneeded/undesired in the first place). 1480 unneeded/undesired in the first place).
14810x020101: Marker for thinkpad-acpi with hot key NVRAM polling 14810x020101: Marker for thinkpad-acpi with hot key NVRAM polling
diff --git a/Documentation/networking/rxrpc.txt b/Documentation/networking/rxrpc.txt
index c3669a3fb4af..60d05eb77c64 100644
--- a/Documentation/networking/rxrpc.txt
+++ b/Documentation/networking/rxrpc.txt
@@ -540,7 +540,7 @@ A client would issue an operation by:
540 MSG_MORE should be set in msghdr::msg_flags on all but the last part of 540 MSG_MORE should be set in msghdr::msg_flags on all but the last part of
541 the request. Multiple requests may be made simultaneously. 541 the request. Multiple requests may be made simultaneously.
542 542
543 If a call is intended to go to a destination other then the default 543 If a call is intended to go to a destination other than the default
544 specified through connect(), then msghdr::msg_name should be set on the 544 specified through connect(), then msghdr::msg_name should be set on the
545 first request message of that call. 545 first request message of that call.
546 546
diff --git a/Documentation/networking/tuntap.txt b/Documentation/networking/tuntap.txt
index 839cbb71388b..c0aab985bad9 100644
--- a/Documentation/networking/tuntap.txt
+++ b/Documentation/networking/tuntap.txt
@@ -118,7 +118,7 @@ As mentioned above, main purpose of TUN/TAP driver is tunneling.
118It is used by VTun (http://vtun.sourceforge.net). 118It is used by VTun (http://vtun.sourceforge.net).
119 119
120Another interesting application using TUN/TAP is pipsecd 120Another interesting application using TUN/TAP is pipsecd
121(http://perso.enst.fr/~beyssac/pipsec/), an userspace IPSec 121(http://perso.enst.fr/~beyssac/pipsec/), a userspace IPSec
122implementation that can use complete kernel routing (unlike FreeS/WAN). 122implementation that can use complete kernel routing (unlike FreeS/WAN).
123 123
1243. How does Virtual network device actually work ? 1243. How does Virtual network device actually work ?
diff --git a/Documentation/scsi/ChangeLog.lpfc b/Documentation/scsi/ChangeLog.lpfc
index ae3f962a7cfc..ff19a52fe004 100644
--- a/Documentation/scsi/ChangeLog.lpfc
+++ b/Documentation/scsi/ChangeLog.lpfc
@@ -733,7 +733,7 @@ Changes from 20040920 to 20041018
733 I/O completion path a little more, especially taking care of 733 I/O completion path a little more, especially taking care of
734 fast-pathing the non-error case. Also removes tons of dead 734 fast-pathing the non-error case. Also removes tons of dead
735 members and defines from lpfc_scsi.h - e.g. lpfc_target is down 735 members and defines from lpfc_scsi.h - e.g. lpfc_target is down
736 to nothing more then the lpfc_nodelist pointer. 736 to nothing more than the lpfc_nodelist pointer.
737 * Added binary sysfs file to issue mbox commands 737 * Added binary sysfs file to issue mbox commands
738 * Replaced #if __BIG_ENDIAN with #if __BIG_ENDIAN_BITFIELD for 738 * Replaced #if __BIG_ENDIAN with #if __BIG_ENDIAN_BITFIELD for
739 compatibility with the user space applications. 739 compatibility with the user space applications.
diff --git a/Documentation/scsi/ChangeLog.ncr53c8xx b/Documentation/scsi/ChangeLog.ncr53c8xx
index a9f721aeb11c..8b278c10edfd 100644
--- a/Documentation/scsi/ChangeLog.ncr53c8xx
+++ b/Documentation/scsi/ChangeLog.ncr53c8xx
@@ -19,7 +19,7 @@ Sun Sep 24 21:30 2000 Gerard Roudier (groudier@club-internet.fr)
19 19
20Wed Jul 26 23:30 2000 Gerard Roudier (groudier@club-internet.fr) 20Wed Jul 26 23:30 2000 Gerard Roudier (groudier@club-internet.fr)
21 * version ncr53c8xx-3.4.1 21 * version ncr53c8xx-3.4.1
22 - Provide OpenFirmare path through the proc FS on PPC. 22 - Provide OpenFirmware path through the proc FS on PPC.
23 - Remove trailing argument #2 from a couple of #undefs. 23 - Remove trailing argument #2 from a couple of #undefs.
24 24
25Sun Jul 09 16:30 2000 Gerard Roudier (groudier@club-internet.fr) 25Sun Jul 09 16:30 2000 Gerard Roudier (groudier@club-internet.fr)
diff --git a/Documentation/scsi/ChangeLog.sym53c8xx b/Documentation/scsi/ChangeLog.sym53c8xx
index ef985ec348e6..02ffbc1e8a84 100644
--- a/Documentation/scsi/ChangeLog.sym53c8xx
+++ b/Documentation/scsi/ChangeLog.sym53c8xx
@@ -81,7 +81,7 @@ Sun Sep 24 21:30 2000 Gerard Roudier (groudier@club-internet.fr)
81 81
82Wed Jul 26 23:30 2000 Gerard Roudier (groudier@club-internet.fr) 82Wed Jul 26 23:30 2000 Gerard Roudier (groudier@club-internet.fr)
83 * version sym53c8xx-1.7.1 83 * version sym53c8xx-1.7.1
84 - Provide OpenFirmare path through the proc FS on PPC. 84 - Provide OpenFirmware path through the proc FS on PPC.
85 - Download of on-chip SRAM using memcpy_toio() doesn't work 85 - Download of on-chip SRAM using memcpy_toio() doesn't work
86 on PPC. Restore previous method (MEMORY MOVE from SCRIPTS). 86 on PPC. Restore previous method (MEMORY MOVE from SCRIPTS).
87 - Remove trailing argument #2 from a couple of #undefs. 87 - Remove trailing argument #2 from a couple of #undefs.
diff --git a/Documentation/spi/spi-lm70llp b/Documentation/spi/spi-lm70llp
index 154bd02220b9..34a9cfd746bd 100644
--- a/Documentation/spi/spi-lm70llp
+++ b/Documentation/spi/spi-lm70llp
@@ -13,10 +13,20 @@ Description
13This driver provides glue code connecting a National Semiconductor LM70 LLP 13This driver provides glue code connecting a National Semiconductor LM70 LLP
14temperature sensor evaluation board to the kernel's SPI core subsystem. 14temperature sensor evaluation board to the kernel's SPI core subsystem.
15 15
16This is a SPI master controller driver. It can be used in conjunction with
17(layered under) the LM70 logical driver (a "SPI protocol driver").
16In effect, this driver turns the parallel port interface on the eval board 18In effect, this driver turns the parallel port interface on the eval board
17into a SPI bus with a single device, which will be driven by the generic 19into a SPI bus with a single device, which will be driven by the generic
18LM70 driver (drivers/hwmon/lm70.c). 20LM70 driver (drivers/hwmon/lm70.c).
19 21
22
23Hardware Interfacing
24--------------------
25The schematic for this particular board (the LM70EVAL-LLP) is
26available (on page 4) here:
27
28 http://www.national.com/appinfo/tempsensors/files/LM70LLPEVALmanual.pdf
29
20The hardware interfacing on the LM70 LLP eval board is as follows: 30The hardware interfacing on the LM70 LLP eval board is as follows:
21 31
22 Parallel LM70 LLP 32 Parallel LM70 LLP
diff --git a/Documentation/usb/power-management.txt b/Documentation/usb/power-management.txt
index e48ea1d51010..ad642615ad4c 100644
--- a/Documentation/usb/power-management.txt
+++ b/Documentation/usb/power-management.txt
@@ -313,11 +313,13 @@ three of the methods listed above. In addition, a driver indicates
313that it supports autosuspend by setting the .supports_autosuspend flag 313that it supports autosuspend by setting the .supports_autosuspend flag
314in its usb_driver structure. It is then responsible for informing the 314in its usb_driver structure. It is then responsible for informing the
315USB core whenever one of its interfaces becomes busy or idle. The 315USB core whenever one of its interfaces becomes busy or idle. The
316driver does so by calling these three functions: 316driver does so by calling these five functions:
317 317
318 int usb_autopm_get_interface(struct usb_interface *intf); 318 int usb_autopm_get_interface(struct usb_interface *intf);
319 void usb_autopm_put_interface(struct usb_interface *intf); 319 void usb_autopm_put_interface(struct usb_interface *intf);
320 int usb_autopm_set_interface(struct usb_interface *intf); 320 int usb_autopm_set_interface(struct usb_interface *intf);
321 int usb_autopm_get_interface_async(struct usb_interface *intf);
322 void usb_autopm_put_interface_async(struct usb_interface *intf);
321 323
322The functions work by maintaining a counter in the usb_interface 324The functions work by maintaining a counter in the usb_interface
323structure. When intf->pm_usage_count is > 0 then the interface is 325structure. When intf->pm_usage_count is > 0 then the interface is
@@ -330,10 +332,12 @@ associated with the device itself rather than any of its interfaces.
330This field is used only by the USB core.) 332This field is used only by the USB core.)
331 333
332The driver owns intf->pm_usage_count; it can modify the value however 334The driver owns intf->pm_usage_count; it can modify the value however
333and whenever it likes. A nice aspect of the usb_autopm_* routines is 335and whenever it likes. A nice aspect of the non-async usb_autopm_*
334that the changes they make are protected by the usb_device structure's 336routines is that the changes they make are protected by the usb_device
335PM mutex (udev->pm_mutex); however drivers may change pm_usage_count 337structure's PM mutex (udev->pm_mutex); however drivers may change
336without holding the mutex. 338pm_usage_count without holding the mutex. Drivers using the async
339routines are responsible for their own synchronization and mutual
340exclusion.
337 341
338 usb_autopm_get_interface() increments pm_usage_count and 342 usb_autopm_get_interface() increments pm_usage_count and
339 attempts an autoresume if the new value is > 0 and the 343 attempts an autoresume if the new value is > 0 and the
@@ -348,6 +352,14 @@ without holding the mutex.
348 is suspended, and it attempts an autosuspend if the value is 352 is suspended, and it attempts an autosuspend if the value is
349 <= 0 and the device isn't suspended. 353 <= 0 and the device isn't suspended.
350 354
355 usb_autopm_get_interface_async() and
356 usb_autopm_put_interface_async() do almost the same things as
357 their non-async counterparts. The differences are: they do
358 not acquire the PM mutex, and they use a workqueue to do their
359 jobs. As a result they can be called in an atomic context,
360 such as an URB's completion handler, but when they return the
361 device will not generally not yet be in the desired state.
362
351There also are a couple of utility routines drivers can use: 363There also are a couple of utility routines drivers can use:
352 364
353 usb_autopm_enable() sets pm_usage_cnt to 0 and then calls 365 usb_autopm_enable() sets pm_usage_cnt to 0 and then calls
diff --git a/Documentation/wimax/README.i2400m b/Documentation/wimax/README.i2400m
new file mode 100644
index 000000000000..7dffd8919cb0
--- /dev/null
+++ b/Documentation/wimax/README.i2400m
@@ -0,0 +1,260 @@
1
2 Driver for the Intel Wireless Wimax Connection 2400m
3
4 (C) 2008 Intel Corporation < linux-wimax@intel.com >
5
6 This provides a driver for the Intel Wireless WiMAX Connection 2400m
7 and a basic Linux kernel WiMAX stack.
8
91. Requirements
10
11 * Linux installation with Linux kernel 2.6.22 or newer (if building
12 from a separate tree)
13 * Intel i2400m Echo Peak or Baxter Peak; this includes the Intel
14 Wireless WiMAX/WiFi Link 5x50 series.
15 * build tools:
16 + Linux kernel development package for the target kernel; to
17 build against your currently running kernel, you need to have
18 the kernel development package corresponding to the running
19 image installed (usually if your kernel is named
20 linux-VERSION, the development package is called
21 linux-dev-VERSION or linux-headers-VERSION).
22 + GNU C Compiler, make
23
242. Compilation and installation
25
262.1. Compilation of the drivers included in the kernel
27
28 Configure the kernel; to enable the WiMAX drivers select Drivers >
29 Networking Drivers > WiMAX device support. Enable all of them as
30 modules (easier).
31
32 If USB or SDIO are not enabled in the kernel configuration, the options
33 to build the i2400m USB or SDIO drivers will not show. Enable said
34 subsystems and go back to the WiMAX menu to enable the drivers.
35
36 Compile and install your kernel as usual.
37
382.2. Compilation of the drivers distributed as an standalone module
39
40 To compile
41
42$ cd source/directory
43$ make
44
45 Once built you can load and unload using the provided load.sh script;
46 load.sh will load the modules, load.sh u will unload them.
47
48 To install in the default kernel directories (and enable auto loading
49 when the device is plugged):
50
51$ make install
52$ depmod -a
53
54 If your kernel development files are located in a non standard
55 directory or if you want to build for a kernel that is not the
56 currently running one, set KDIR to the right location:
57
58$ make KDIR=/path/to/kernel/dev/tree
59
60 For more information, please contact linux-wimax@intel.com.
61
623. Installing the firmware
63
64 The firmware can be obtained from http://linuxwimax.org or might have
65 been supplied with your hardware.
66
67 It has to be installed in the target system:
68 *
69$ cp FIRMWAREFILE.sbcf /lib/firmware/i2400m-fw-BUSTYPE-1.3.sbcf
70
71 * NOTE: if your firmware came in an .rpm or .deb file, just install
72 it as normal, with the rpm (rpm -i FIRMWARE.rpm) or dpkg
73 (dpkg -i FIRMWARE.deb) commands. No further action is needed.
74 * BUSTYPE will be usb or sdio, depending on the hardware you have.
75 Each hardware type comes with its own firmware and will not work
76 with other types.
77
784. Design
79
80 This package contains two major parts: a WiMAX kernel stack and a
81 driver for the Intel i2400m.
82
83 The WiMAX stack is designed to provide for common WiMAX control
84 services to current and future WiMAX devices from any vendor; please
85 see README.wimax for details.
86
87 The i2400m kernel driver is broken up in two main parts: the bus
88 generic driver and the bus-specific drivers. The bus generic driver
89 forms the drivercore and contain no knowledge of the actual method we
90 use to connect to the device. The bus specific drivers are just the
91 glue to connect the bus-generic driver and the device. Currently only
92 USB and SDIO are supported. See drivers/net/wimax/i2400m/i2400m.h for
93 more information.
94
95 The bus generic driver is logically broken up in two parts: OS-glue and
96 hardware-glue. The OS-glue interfaces with Linux. The hardware-glue
97 interfaces with the device on using an interface provided by the
98 bus-specific driver. The reason for this breakup is to be able to
99 easily reuse the hardware-glue to write drivers for other OSes; note
100 the hardware glue part is written as a native Linux driver; no
101 abstraction layers are used, so to port to another OS, the Linux kernel
102 API calls should be replaced with the target OS's.
103
1045. Usage
105
106 To load the driver, follow the instructions in the install section;
107 once the driver is loaded, plug in the device (unless it is permanently
108 plugged in). The driver will enumerate the device, upload the firmware
109 and output messages in the kernel log (dmesg, /var/log/messages or
110 /var/log/kern.log) such as:
111
112...
113i2400m_usb 5-4:1.0: firmware interface version 8.0.0
114i2400m_usb 5-4:1.0: WiMAX interface wmx0 (00:1d:e1:01:94:2c) ready
115
116 At this point the device is ready to work.
117
118 Current versions require the Intel WiMAX Network Service in userspace
119 to make things work. See the network service's README for instructions
120 on how to scan, connect and disconnect.
121
1225.1. Module parameters
123
124 Module parameters can be set at kernel or module load time or by
125 echoing values:
126
127$ echo VALUE > /sys/module/MODULENAME/parameters/PARAMETERNAME
128
129 To make changes permanent, for example, for the i2400m module, you can
130 also create a file named /etc/modprobe.d/i2400m containing:
131
132options i2400m idle_mode_disabled=1
133
134 To find which parameters are supported by a module, run:
135
136$ modinfo path/to/module.ko
137
138 During kernel bootup (if the driver is linked in the kernel), specify
139 the following to the kernel command line:
140
141i2400m.PARAMETER=VALUE
142
1435.1.1. i2400m: idle_mode_disabled
144
145 The i2400m module supports a parameter to disable idle mode. This
146 parameter, once set, will take effect only when the device is
147 reinitialized by the driver (eg: following a reset or a reconnect).
148
1495.2. Debug operations: debugfs entries
150
151 The driver will register debugfs entries that allow the user to tweak
152 debug settings. There are three main container directories where
153 entries are placed, which correspond to the three blocks a i2400m WiMAX
154 driver has:
155 * /sys/kernel/debug/wimax:DEVNAME/ for the generic WiMAX stack
156 controls
157 * /sys/kernel/debug/wimax:DEVNAME/i2400m for the i2400m generic
158 driver controls
159 * /sys/kernel/debug/wimax:DEVNAME/i2400m-usb (or -sdio) for the
160 bus-specific i2400m-usb or i2400m-sdio controls).
161
162 Of course, if debugfs is mounted in a directory other than
163 /sys/kernel/debug, those paths will change.
164
1655.2.1. Increasing debug output
166
167 The files named *dl_* indicate knobs for controlling the debug output
168 of different submodules:
169 *
170# find /sys/kernel/debug/wimax\:wmx0 -name \*dl_\*
171/sys/kernel/debug/wimax:wmx0/i2400m-usb/dl_tx
172/sys/kernel/debug/wimax:wmx0/i2400m-usb/dl_rx
173/sys/kernel/debug/wimax:wmx0/i2400m-usb/dl_notif
174/sys/kernel/debug/wimax:wmx0/i2400m-usb/dl_fw
175/sys/kernel/debug/wimax:wmx0/i2400m-usb/dl_usb
176/sys/kernel/debug/wimax:wmx0/i2400m/dl_tx
177/sys/kernel/debug/wimax:wmx0/i2400m/dl_rx
178/sys/kernel/debug/wimax:wmx0/i2400m/dl_rfkill
179/sys/kernel/debug/wimax:wmx0/i2400m/dl_netdev
180/sys/kernel/debug/wimax:wmx0/i2400m/dl_fw
181/sys/kernel/debug/wimax:wmx0/i2400m/dl_debugfs
182/sys/kernel/debug/wimax:wmx0/i2400m/dl_driver
183/sys/kernel/debug/wimax:wmx0/i2400m/dl_control
184/sys/kernel/debug/wimax:wmx0/wimax_dl_stack
185/sys/kernel/debug/wimax:wmx0/wimax_dl_op_rfkill
186/sys/kernel/debug/wimax:wmx0/wimax_dl_op_reset
187/sys/kernel/debug/wimax:wmx0/wimax_dl_op_msg
188/sys/kernel/debug/wimax:wmx0/wimax_dl_id_table
189/sys/kernel/debug/wimax:wmx0/wimax_dl_debugfs
190
191 By reading the file you can obtain the current value of said debug
192 level; by writing to it, you can set it.
193
194 To increase the debug level of, for example, the i2400m's generic TX
195 engine, just write:
196
197$ echo 3 > /sys/kernel/debug/wimax:wmx0/i2400m/dl_tx
198
199 Increasing numbers yield increasing debug information; for details of
200 what is printed and the available levels, check the source. The code
201 uses 0 for disabled and increasing values until 8.
202
2035.2.2. RX and TX statistics
204
205 The i2400m/rx_stats and i2400m/tx_stats provide statistics about the
206 data reception/delivery from the device:
207
208$ cat /sys/kernel/debug/wimax:wmx0/i2400m/rx_stats
20945 1 3 34 3104 48 480
210
211 The numbers reported are
212 * packets/RX-buffer: total, min, max
213 * RX-buffers: total RX buffers received, accumulated RX buffer size
214 in bytes, min size received, max size received
215
216 Thus, to find the average buffer size received, divide accumulated
217 RX-buffer / total RX-buffers.
218
219 To clear the statistics back to 0, write anything to the rx_stats file:
220
221$ echo 1 > /sys/kernel/debug/wimax:wmx0/i2400m_rx_stats
222
223 Likewise for TX.
224
225 Note the packets this debug file refers to are not network packet, but
226 packets in the sense of the device-specific protocol for communication
227 to the host. See drivers/net/wimax/i2400m/tx.c.
228
2295.2.3. Tracing messages received from user space
230
231 To echo messages received from user space into the trace pipe that the
232 i2400m driver creates, set the debug file i2400m/trace_msg_from_user to
233 1:
234 *
235$ echo 1 > /sys/kernel/debug/wimax:wmx0/i2400m/trace_msg_from_user
236
2375.2.4. Performing a device reset
238
239 By writing a 0, a 1 or a 2 to the file
240 /sys/kernel/debug/wimax:wmx0/reset, the driver performs a warm (without
241 disconnecting from the bus), cold (disconnecting from the bus) or bus
242 (bus specific) reset on the device.
243
2445.2.5. Asking the device to enter power saving mode
245
246 By writing any value to the /sys/kernel/debug/wimax:wmx0 file, the
247 device will attempt to enter power saving mode.
248
2496. Troubleshooting
250
2516.1. Driver complains about 'i2400m-fw-usb-1.2.sbcf: request failed'
252
253 If upon connecting the device, the following is output in the kernel
254 log:
255
256i2400m_usb 5-4:1.0: fw i2400m-fw-usb-1.3.sbcf: request failed: -2
257
258 This means that the driver cannot locate the firmware file named
259 /lib/firmware/i2400m-fw-usb-1.2.sbcf. Check that the file is present in
260 the right location.
diff --git a/Documentation/wimax/README.wimax b/Documentation/wimax/README.wimax
new file mode 100644
index 000000000000..b78c4378084e
--- /dev/null
+++ b/Documentation/wimax/README.wimax
@@ -0,0 +1,81 @@
1
2 Linux kernel WiMAX stack
3
4 (C) 2008 Intel Corporation < linux-wimax@intel.com >
5
6 This provides a basic Linux kernel WiMAX stack to provide a common
7 control API for WiMAX devices, usable from kernel and user space.
8
91. Design
10
11 The WiMAX stack is designed to provide for common WiMAX control
12 services to current and future WiMAX devices from any vendor.
13
14 Because currently there is only one and we don't know what would be the
15 common services, the APIs it currently provides are very minimal.
16 However, it is done in such a way that it is easily extensible to
17 accommodate future requirements.
18
19 The stack works by embedding a struct wimax_dev in your device's
20 control structures. This provides a set of callbacks that the WiMAX
21 stack will call in order to implement control operations requested by
22 the user. As well, the stack provides API functions that the driver
23 calls to notify about changes of state in the device.
24
25 The stack exports the API calls needed to control the device to user
26 space using generic netlink as a marshalling mechanism. You can access
27 them using your own code or use the wrappers provided for your
28 convenience in libwimax (in the wimax-tools package).
29
30 For detailed information on the stack, please see
31 include/linux/wimax.h.
32
332. Usage
34
35 For usage in a driver (registration, API, etc) please refer to the
36 instructions in the header file include/linux/wimax.h.
37
38 When a device is registered with the WiMAX stack, a set of debugfs
39 files will appear in /sys/kernel/debug/wimax:wmxX can tweak for
40 control.
41
422.1. Obtaining debug information: debugfs entries
43
44 The WiMAX stack is compiled, by default, with debug messages that can
45 be used to diagnose issues. By default, said messages are disabled.
46
47 The drivers will register debugfs entries that allow the user to tweak
48 debug settings.
49
50 Each driver, when registering with the stack, will cause a debugfs
51 directory named wimax:DEVICENAME to be created; optionally, it might
52 create more subentries below it.
53
542.1.1. Increasing debug output
55
56 The files named *dl_* indicate knobs for controlling the debug output
57 of different submodules of the WiMAX stack:
58 *
59# find /sys/kernel/debug/wimax\:wmx0 -name \*dl_\*
60/sys/kernel/debug/wimax:wmx0/wimax_dl_stack
61/sys/kernel/debug/wimax:wmx0/wimax_dl_op_rfkill
62/sys/kernel/debug/wimax:wmx0/wimax_dl_op_reset
63/sys/kernel/debug/wimax:wmx0/wimax_dl_op_msg
64/sys/kernel/debug/wimax:wmx0/wimax_dl_id_table
65/sys/kernel/debug/wimax:wmx0/wimax_dl_debugfs
66/sys/kernel/debug/wimax:wmx0/.... # other driver specific files
67
68 NOTE: Of course, if debugfs is mounted in a directory other than
69 /sys/kernel/debug, those paths will change.
70
71 By reading the file you can obtain the current value of said debug
72 level; by writing to it, you can set it.
73
74 To increase the debug level of, for example, the id-table submodule,
75 just write:
76
77$ echo 3 > /sys/kernel/debug/wimax:wmx0/wimax_dl_id_table
78
79 Increasing numbers yield increasing debug information; for details of
80 what is printed and the available levels, check the source. The code
81 uses 0 for disabled and increasing values until 8.
diff --git a/MAINTAINERS b/MAINTAINERS
index 094dd52d7309..ee3871e204e7 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -2305,6 +2305,14 @@ W: http://lists.sourceforge.net/mailman/listinfo/ipw2100-devel
2305W: http://ipw2200.sourceforge.net 2305W: http://ipw2200.sourceforge.net
2306S: Supported 2306S: Supported
2307 2307
2308INTEL WIRELESS WIMAX CONNECTION 2400
2309P: Inaky Perez-Gonzalez
2310M: inaky.perez-gonzalez@intel.com
2311M: linux-wimax@intel.com
2312L: wimax@linuxwimax.org
2313S: Supported
2314W: http://linuxwimax.org
2315
2308INTEL WIRELESS WIFI LINK (iwlwifi) 2316INTEL WIRELESS WIFI LINK (iwlwifi)
2309P: Zhu Yi 2317P: Zhu Yi
2310M: yi.zhu@intel.com 2318M: yi.zhu@intel.com
@@ -2982,6 +2990,7 @@ MUSB MULTIPOINT HIGH SPEED DUAL-ROLE CONTROLLER
2982P: Felipe Balbi 2990P: Felipe Balbi
2983M: felipe.balbi@nokia.com 2991M: felipe.balbi@nokia.com
2984L: linux-usb@vger.kernel.org 2992L: linux-usb@vger.kernel.org
2993T: git gitorious.org:/musb/mainline.git
2985S: Maintained 2994S: Maintained
2986 2995
2987MYRICOM MYRI-10G 10GbE DRIVER (MYRI10GE) 2996MYRICOM MYRI-10G 10GbE DRIVER (MYRI10GE)
@@ -4229,9 +4238,10 @@ L: tpmdd-devel@lists.sourceforge.net (moderated for non-subscribers)
4229S: Maintained 4238S: Maintained
4230 4239
4231TRIVIAL PATCHES 4240TRIVIAL PATCHES
4232P: Jesper Juhl 4241P: Jiri Kosina
4233M: trivial@kernel.org 4242M: trivial@kernel.org
4234L: linux-kernel@vger.kernel.org 4243L: linux-kernel@vger.kernel.org
4244T: git kernel.org:/pub/scm/linux/kernel/git/jikos/trivial.git
4235S: Maintained 4245S: Maintained
4236 4246
4237TTY LAYER 4247TTY LAYER
@@ -4732,6 +4742,14 @@ M: zaga@fly.cc.fer.hr
4732L: linux-scsi@vger.kernel.org 4742L: linux-scsi@vger.kernel.org
4733S: Maintained 4743S: Maintained
4734 4744
4745WIMAX STACK
4746P: Inaky Perez-Gonzalez
4747M: inaky.perez-gonzalez@intel.com
4748M: linux-wimax@intel.com
4749L: wimax@linuxwimax.org
4750S: Supported
4751W: http://linuxwimax.org
4752
4735WIMEDIA LLC PROTOCOL (WLP) SUBSYSTEM 4753WIMEDIA LLC PROTOCOL (WLP) SUBSYSTEM
4736P: David Vrabel 4754P: David Vrabel
4737M: david.vrabel@csr.com 4755M: david.vrabel@csr.com
diff --git a/Makefile b/Makefile
index f9006663f01e..28331288341f 100644
--- a/Makefile
+++ b/Makefile
@@ -965,6 +965,7 @@ ifneq ($(KBUILD_SRC),)
965 mkdir -p include2; \ 965 mkdir -p include2; \
966 ln -fsn $(srctree)/include/asm-$(SRCARCH) include2/asm; \ 966 ln -fsn $(srctree)/include/asm-$(SRCARCH) include2/asm; \
967 fi 967 fi
968 ln -fsn $(srctree) source
968endif 969endif
969 970
970# prepare2 creates a makefile if using a separate output directory 971# prepare2 creates a makefile if using a separate output directory
@@ -1008,7 +1009,7 @@ define check-symlink
1008endef 1009endef
1009 1010
1010# We create the target directory of the symlink if it does 1011# We create the target directory of the symlink if it does
1011# not exist so the test in chack-symlink works and we have a 1012# not exist so the test in check-symlink works and we have a
1012# directory for generated filesas used by some architectures. 1013# directory for generated filesas used by some architectures.
1013define create-symlink 1014define create-symlink
1014 if [ ! -L include/asm ]; then \ 1015 if [ ! -L include/asm ]; then \
diff --git a/arch/arm/plat-mxc/include/mach/usb.h b/arch/arm/plat-mxc/include/mach/usb.h
new file mode 100644
index 000000000000..2dacb3086f1c
--- /dev/null
+++ b/arch/arm/plat-mxc/include/mach/usb.h
@@ -0,0 +1,23 @@
1/*
2 * Copyright (C) 2008 Darius Augulis <augulis.darius@gmail.com>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 */
14
15#ifndef __ASM_ARCH_MXC_USB
16#define __ASM_ARCH_MXC_USB
17
18struct imxusb_platform_data {
19 int (*init)(struct device *);
20 int (*exit)(struct device *);
21};
22
23#endif /* __ASM_ARCH_MXC_USB */
diff --git a/arch/arm/plat-omap/usb.c b/arch/arm/plat-omap/usb.c
index 67ca1e216df7..add0485703b5 100644
--- a/arch/arm/plat-omap/usb.c
+++ b/arch/arm/plat-omap/usb.c
@@ -77,38 +77,6 @@
77 77
78/*-------------------------------------------------------------------------*/ 78/*-------------------------------------------------------------------------*/
79 79
80#if defined(CONFIG_ARCH_OMAP_OTG) || defined(CONFIG_USB_MUSB_OTG)
81
82static struct otg_transceiver *xceiv;
83
84/**
85 * otg_get_transceiver - find the (single) OTG transceiver driver
86 *
87 * Returns the transceiver driver, after getting a refcount to it; or
88 * null if there is no such transceiver. The caller is responsible for
89 * releasing that count.
90 */
91struct otg_transceiver *otg_get_transceiver(void)
92{
93 if (xceiv)
94 get_device(xceiv->dev);
95 return xceiv;
96}
97EXPORT_SYMBOL(otg_get_transceiver);
98
99int otg_set_transceiver(struct otg_transceiver *x)
100{
101 if (xceiv && x)
102 return -EBUSY;
103 xceiv = x;
104 return 0;
105}
106EXPORT_SYMBOL(otg_set_transceiver);
107
108#endif
109
110/*-------------------------------------------------------------------------*/
111
112#if defined(CONFIG_ARCH_OMAP_OTG) || defined(CONFIG_ARCH_OMAP15XX) 80#if defined(CONFIG_ARCH_OMAP_OTG) || defined(CONFIG_ARCH_OMAP15XX)
113 81
114static void omap2_usb_devconf_clear(u8 port, u32 mask) 82static void omap2_usb_devconf_clear(u8 port, u32 mask)
diff --git a/arch/avr32/Kconfig b/arch/avr32/Kconfig
index 26eca87f6735..b189680d18b0 100644
--- a/arch/avr32/Kconfig
+++ b/arch/avr32/Kconfig
@@ -122,6 +122,24 @@ config BOARD_ATNGW100
122 bool "ATNGW100 Network Gateway" 122 bool "ATNGW100 Network Gateway"
123 select CPU_AT32AP7000 123 select CPU_AT32AP7000
124 124
125config BOARD_HAMMERHEAD
126 bool "Hammerhead board"
127 select CPU_AT32AP7000
128 select USB_ARCH_HAS_HCD
129 help
130 The Hammerhead platform is built around a AVR32 32-bit microcontroller from Atmel.
131 It offers versatile peripherals, such as ethernet, usb device, usb host etc.
132
133 The board also incooperates a power supply and is a Power over Ethernet (PoE) Powered
134 Device (PD).
135
136 Additonally, a Cyclone III FPGA from Altera is integrated on the board. The FPGA is
137 mapped into the 32-bit AVR memory bus. The FPGA offers two DDR2 SDRAM interfaces, which
138 will cover even the most exceptional need of memory bandwidth. Together with the onboard
139 video decoder the board is ready for video processing.
140
141 For more information see: http://www.miromico.com/hammerhead
142
125config BOARD_FAVR_32 143config BOARD_FAVR_32
126 bool "Favr-32 LCD-board" 144 bool "Favr-32 LCD-board"
127 select CPU_AT32AP7000 145 select CPU_AT32AP7000
@@ -133,6 +151,7 @@ endchoice
133 151
134source "arch/avr32/boards/atstk1000/Kconfig" 152source "arch/avr32/boards/atstk1000/Kconfig"
135source "arch/avr32/boards/atngw100/Kconfig" 153source "arch/avr32/boards/atngw100/Kconfig"
154source "arch/avr32/boards/hammerhead/Kconfig"
136source "arch/avr32/boards/favr-32/Kconfig" 155source "arch/avr32/boards/favr-32/Kconfig"
137 156
138choice 157choice
diff --git a/arch/avr32/Makefile b/arch/avr32/Makefile
index b088e103e753..f3ef3bbf797c 100644
--- a/arch/avr32/Makefile
+++ b/arch/avr32/Makefile
@@ -33,6 +33,7 @@ head-y += arch/avr32/kernel/head.o
33core-y += $(machdirs) 33core-y += $(machdirs)
34core-$(CONFIG_BOARD_ATSTK1000) += arch/avr32/boards/atstk1000/ 34core-$(CONFIG_BOARD_ATSTK1000) += arch/avr32/boards/atstk1000/
35core-$(CONFIG_BOARD_ATNGW100) += arch/avr32/boards/atngw100/ 35core-$(CONFIG_BOARD_ATNGW100) += arch/avr32/boards/atngw100/
36core-$(CONFIG_BOARD_HAMMERHEAD) += arch/avr32/boards/hammerhead/
36core-$(CONFIG_BOARD_FAVR_32) += arch/avr32/boards/favr-32/ 37core-$(CONFIG_BOARD_FAVR_32) += arch/avr32/boards/favr-32/
37core-$(CONFIG_BOARD_MIMC200) += arch/avr32/boards/mimc200/ 38core-$(CONFIG_BOARD_MIMC200) += arch/avr32/boards/mimc200/
38core-$(CONFIG_LOADER_U_BOOT) += arch/avr32/boot/u-boot/ 39core-$(CONFIG_LOADER_U_BOOT) += arch/avr32/boot/u-boot/
diff --git a/arch/avr32/boards/atngw100/setup.c b/arch/avr32/boards/atngw100/setup.c
index 32fb9ba0fbdf..05d3722fff18 100644
--- a/arch/avr32/boards/atngw100/setup.c
+++ b/arch/avr32/boards/atngw100/setup.c
@@ -19,8 +19,8 @@
19#include <linux/types.h> 19#include <linux/types.h>
20#include <linux/leds.h> 20#include <linux/leds.h>
21#include <linux/spi/spi.h> 21#include <linux/spi/spi.h>
22#include <linux/atmel-mci.h>
22 23
23#include <asm/atmel-mci.h>
24#include <asm/io.h> 24#include <asm/io.h>
25#include <asm/setup.h> 25#include <asm/setup.h>
26 26
diff --git a/arch/avr32/boards/atstk1000/atstk1002.c b/arch/avr32/boards/atstk1000/atstk1002.c
index 5c5cdf3b464f..1f33a106905c 100644
--- a/arch/avr32/boards/atstk1000/atstk1002.c
+++ b/arch/avr32/boards/atstk1000/atstk1002.c
@@ -16,12 +16,12 @@
16#include <linux/types.h> 16#include <linux/types.h>
17#include <linux/spi/spi.h> 17#include <linux/spi/spi.h>
18#include <linux/spi/at73c213.h> 18#include <linux/spi/at73c213.h>
19#include <linux/atmel-mci.h>
19 20
20#include <video/atmel_lcdc.h> 21#include <video/atmel_lcdc.h>
21 22
22#include <asm/io.h> 23#include <asm/io.h>
23#include <asm/setup.h> 24#include <asm/setup.h>
24#include <asm/atmel-mci.h>
25 25
26#include <mach/at32ap700x.h> 26#include <mach/at32ap700x.h>
27#include <mach/board.h> 27#include <mach/board.h>
@@ -287,23 +287,7 @@ static int __init atstk1002_init(void)
287 * ATSTK1000 uses 32-bit SDRAM interface. Reserve the 287 * ATSTK1000 uses 32-bit SDRAM interface. Reserve the
288 * SDRAM-specific pins so that nobody messes with them. 288 * SDRAM-specific pins so that nobody messes with them.
289 */ 289 */
290 at32_reserve_pin(GPIO_PIN_PE(0)); /* DATA[16] */ 290 at32_reserve_pin(GPIO_PIOE_BASE, ATMEL_EBI_PE_DATA_ALL);
291 at32_reserve_pin(GPIO_PIN_PE(1)); /* DATA[17] */
292 at32_reserve_pin(GPIO_PIN_PE(2)); /* DATA[18] */
293 at32_reserve_pin(GPIO_PIN_PE(3)); /* DATA[19] */
294 at32_reserve_pin(GPIO_PIN_PE(4)); /* DATA[20] */
295 at32_reserve_pin(GPIO_PIN_PE(5)); /* DATA[21] */
296 at32_reserve_pin(GPIO_PIN_PE(6)); /* DATA[22] */
297 at32_reserve_pin(GPIO_PIN_PE(7)); /* DATA[23] */
298 at32_reserve_pin(GPIO_PIN_PE(8)); /* DATA[24] */
299 at32_reserve_pin(GPIO_PIN_PE(9)); /* DATA[25] */
300 at32_reserve_pin(GPIO_PIN_PE(10)); /* DATA[26] */
301 at32_reserve_pin(GPIO_PIN_PE(11)); /* DATA[27] */
302 at32_reserve_pin(GPIO_PIN_PE(12)); /* DATA[28] */
303 at32_reserve_pin(GPIO_PIN_PE(13)); /* DATA[29] */
304 at32_reserve_pin(GPIO_PIN_PE(14)); /* DATA[30] */
305 at32_reserve_pin(GPIO_PIN_PE(15)); /* DATA[31] */
306 at32_reserve_pin(GPIO_PIN_PE(26)); /* SDCS */
307 291
308#ifdef CONFIG_BOARD_ATSTK1006 292#ifdef CONFIG_BOARD_ATSTK1006
309 smc_set_timing(&nand_config, &nand_timing); 293 smc_set_timing(&nand_config, &nand_timing);
diff --git a/arch/avr32/boards/atstk1000/atstk1003.c b/arch/avr32/boards/atstk1000/atstk1003.c
index 134b566630b0..b3a23c88bcfe 100644
--- a/arch/avr32/boards/atstk1000/atstk1003.c
+++ b/arch/avr32/boards/atstk1000/atstk1003.c
@@ -17,9 +17,9 @@
17 17
18#include <linux/spi/at73c213.h> 18#include <linux/spi/at73c213.h>
19#include <linux/spi/spi.h> 19#include <linux/spi/spi.h>
20#include <linux/atmel-mci.h>
20 21
21#include <asm/setup.h> 22#include <asm/setup.h>
22#include <asm/atmel-mci.h>
23 23
24#include <mach/at32ap700x.h> 24#include <mach/at32ap700x.h>
25#include <mach/board.h> 25#include <mach/board.h>
@@ -131,23 +131,7 @@ static int __init atstk1003_init(void)
131 * ATSTK1000 uses 32-bit SDRAM interface. Reserve the 131 * ATSTK1000 uses 32-bit SDRAM interface. Reserve the
132 * SDRAM-specific pins so that nobody messes with them. 132 * SDRAM-specific pins so that nobody messes with them.
133 */ 133 */
134 at32_reserve_pin(GPIO_PIN_PE(0)); /* DATA[16] */ 134 at32_reserve_pin(GPIO_PIOE_BASE, ATMEL_EBI_PE_DATA_ALL);
135 at32_reserve_pin(GPIO_PIN_PE(1)); /* DATA[17] */
136 at32_reserve_pin(GPIO_PIN_PE(2)); /* DATA[18] */
137 at32_reserve_pin(GPIO_PIN_PE(3)); /* DATA[19] */
138 at32_reserve_pin(GPIO_PIN_PE(4)); /* DATA[20] */
139 at32_reserve_pin(GPIO_PIN_PE(5)); /* DATA[21] */
140 at32_reserve_pin(GPIO_PIN_PE(6)); /* DATA[22] */
141 at32_reserve_pin(GPIO_PIN_PE(7)); /* DATA[23] */
142 at32_reserve_pin(GPIO_PIN_PE(8)); /* DATA[24] */
143 at32_reserve_pin(GPIO_PIN_PE(9)); /* DATA[25] */
144 at32_reserve_pin(GPIO_PIN_PE(10)); /* DATA[26] */
145 at32_reserve_pin(GPIO_PIN_PE(11)); /* DATA[27] */
146 at32_reserve_pin(GPIO_PIN_PE(12)); /* DATA[28] */
147 at32_reserve_pin(GPIO_PIN_PE(13)); /* DATA[29] */
148 at32_reserve_pin(GPIO_PIN_PE(14)); /* DATA[30] */
149 at32_reserve_pin(GPIO_PIN_PE(15)); /* DATA[31] */
150 at32_reserve_pin(GPIO_PIN_PE(26)); /* SDCS */
151 135
152#ifdef CONFIG_BOARD_ATSTK100X_SW2_CUSTOM 136#ifdef CONFIG_BOARD_ATSTK100X_SW2_CUSTOM
153 at32_add_device_usart(1); 137 at32_add_device_usart(1);
diff --git a/arch/avr32/boards/atstk1000/atstk1004.c b/arch/avr32/boards/atstk1000/atstk1004.c
index cb32eb844aa7..29b35aca96cd 100644
--- a/arch/avr32/boards/atstk1000/atstk1004.c
+++ b/arch/avr32/boards/atstk1000/atstk1004.c
@@ -17,11 +17,11 @@
17 17
18#include <linux/spi/at73c213.h> 18#include <linux/spi/at73c213.h>
19#include <linux/spi/spi.h> 19#include <linux/spi/spi.h>
20#include <linux/atmel-mci.h>
20 21
21#include <video/atmel_lcdc.h> 22#include <video/atmel_lcdc.h>
22 23
23#include <asm/setup.h> 24#include <asm/setup.h>
24#include <asm/atmel-mci.h>
25 25
26#include <mach/at32ap700x.h> 26#include <mach/at32ap700x.h>
27#include <mach/board.h> 27#include <mach/board.h>
diff --git a/arch/avr32/boards/favr-32/setup.c b/arch/avr32/boards/favr-32/setup.c
index 1ee4faf0742d..745c408c2ac5 100644
--- a/arch/avr32/boards/favr-32/setup.c
+++ b/arch/avr32/boards/favr-32/setup.c
@@ -17,6 +17,7 @@
17#include <linux/linkage.h> 17#include <linux/linkage.h>
18#include <linux/gpio.h> 18#include <linux/gpio.h>
19#include <linux/leds.h> 19#include <linux/leds.h>
20#include <linux/atmel-mci.h>
20#include <linux/atmel-pwm-bl.h> 21#include <linux/atmel-pwm-bl.h>
21#include <linux/spi/spi.h> 22#include <linux/spi/spi.h>
22#include <linux/spi/ads7846.h> 23#include <linux/spi/ads7846.h>
@@ -79,6 +80,14 @@ static struct spi_board_info __initdata spi1_board_info[] = {
79 }, 80 },
80}; 81};
81 82
83static struct mci_platform_data __initdata mci0_data = {
84 .slot[0] = {
85 .bus_width = 4,
86 .detect_pin = -ENODEV,
87 .wp_pin = -ENODEV,
88 },
89};
90
82static struct fb_videomode __initdata lb104v03_modes[] = { 91static struct fb_videomode __initdata lb104v03_modes[] = {
83 { 92 {
84 .name = "640x480 @ 50", 93 .name = "640x480 @ 50",
@@ -307,28 +316,10 @@ static int __init favr32_init(void)
307 * Favr-32 uses 32-bit SDRAM interface. Reserve the SDRAM-specific 316 * Favr-32 uses 32-bit SDRAM interface. Reserve the SDRAM-specific
308 * pins so that nobody messes with them. 317 * pins so that nobody messes with them.
309 */ 318 */
310 at32_reserve_pin(GPIO_PIN_PE(0)); /* DATA[16] */ 319 at32_reserve_pin(GPIO_PIOE_BASE, ATMEL_EBI_PE_DATA_ALL);
311 at32_reserve_pin(GPIO_PIN_PE(1)); /* DATA[17] */
312 at32_reserve_pin(GPIO_PIN_PE(2)); /* DATA[18] */
313 at32_reserve_pin(GPIO_PIN_PE(3)); /* DATA[19] */
314 at32_reserve_pin(GPIO_PIN_PE(4)); /* DATA[20] */
315 at32_reserve_pin(GPIO_PIN_PE(5)); /* DATA[21] */
316 at32_reserve_pin(GPIO_PIN_PE(6)); /* DATA[22] */
317 at32_reserve_pin(GPIO_PIN_PE(7)); /* DATA[23] */
318 at32_reserve_pin(GPIO_PIN_PE(8)); /* DATA[24] */
319 at32_reserve_pin(GPIO_PIN_PE(9)); /* DATA[25] */
320 at32_reserve_pin(GPIO_PIN_PE(10)); /* DATA[26] */
321 at32_reserve_pin(GPIO_PIN_PE(11)); /* DATA[27] */
322 at32_reserve_pin(GPIO_PIN_PE(12)); /* DATA[28] */
323 at32_reserve_pin(GPIO_PIN_PE(13)); /* DATA[29] */
324 at32_reserve_pin(GPIO_PIN_PE(14)); /* DATA[30] */
325 at32_reserve_pin(GPIO_PIN_PE(15)); /* DATA[31] */
326 at32_reserve_pin(GPIO_PIN_PE(26)); /* SDCS */
327 320
328 at32_select_gpio(GPIO_PIN_PB(3), 0); /* IRQ from ADS7843 */ 321 at32_select_gpio(GPIO_PIN_PB(3), 0); /* IRQ from ADS7843 */
329 322
330 at32_add_system_devices();
331
332 at32_add_device_usart(0); 323 at32_add_device_usart(0);
333 324
334 set_hw_addr(at32_add_device_eth(0, &eth_data[0])); 325 set_hw_addr(at32_add_device_eth(0, &eth_data[0]));
@@ -339,7 +330,7 @@ static int __init favr32_init(void)
339 330
340 at32_add_device_pwm(1 << atmel_pwm_bl_pdata.pwm_channel); 331 at32_add_device_pwm(1 << atmel_pwm_bl_pdata.pwm_channel);
341 at32_add_device_spi(1, spi1_board_info, ARRAY_SIZE(spi1_board_info)); 332 at32_add_device_spi(1, spi1_board_info, ARRAY_SIZE(spi1_board_info));
342 at32_add_device_mci(0, NULL); 333 at32_add_device_mci(0, &mci0_data);
343 at32_add_device_usba(0, NULL); 334 at32_add_device_usba(0, NULL);
344 at32_add_device_lcdc(0, &favr32_lcdc_data, fbmem_start, fbmem_size, 0); 335 at32_add_device_lcdc(0, &favr32_lcdc_data, fbmem_start, fbmem_size, 0);
345 336
diff --git a/arch/avr32/boards/hammerhead/Kconfig b/arch/avr32/boards/hammerhead/Kconfig
new file mode 100644
index 000000000000..fda2331f9789
--- /dev/null
+++ b/arch/avr32/boards/hammerhead/Kconfig
@@ -0,0 +1,43 @@
1# Hammerhead customization
2
3if BOARD_HAMMERHEAD
4
5config BOARD_HAMMERHEAD_USB
6 bool "Philips ISP116x-hcd USB support"
7 help
8 This enables USB support for Hammerheads internal ISP116x
9 controller from Philips.
10
11 Choose 'Y' here if you want to have your board USB driven.
12
13config BOARD_HAMMERHEAD_LCD
14 bool "Atmel AT91/AT32 LCD support"
15 help
16 This enables LCD support for the Hammerhead board. You may
17 also add support for framebuffer devices (AT91/AT32 LCD Controller)
18 and framebuffer console support to get the most out of your LCD.
19
20 Choose 'Y' here if you have ordered a Corona daugther board and
21 want to have support for your Hantronix HDA-351T-LV LCD.
22
23config BOARD_HAMMERHEAD_SND
24 bool "Atmel AC97 Sound support"
25 help
26 This enables Sound support for the Hammerhead board. You may
27 also go trough the ALSA settings to get it working.
28
29 Choose 'Y' here if you have ordered a Corona daugther board and
30 want to make your board funky.
31
32config BOARD_HAMMERHEAD_FPGA
33 bool "Hammerhead FPGA Support"
34 default y
35 help
36 This adds support for the Cyclone III FPGA from Altera
37 found on Miromico's Hammerhead board.
38
39 Choose 'Y' here if you want to have FPGA support enabled.
40 You will have to choose the "Hammerhead FPGA Device Support" in
41 Device Drivers->Misc to be able to use FPGA functionality.
42
43endif # BOARD_ATNGW100
diff --git a/arch/avr32/boards/hammerhead/Makefile b/arch/avr32/boards/hammerhead/Makefile
new file mode 100644
index 000000000000..c740aa116755
--- /dev/null
+++ b/arch/avr32/boards/hammerhead/Makefile
@@ -0,0 +1 @@
obj-y += setup.o flash.o
diff --git a/arch/avr32/boards/hammerhead/flash.c b/arch/avr32/boards/hammerhead/flash.c
new file mode 100644
index 000000000000..a98c6dd3a028
--- /dev/null
+++ b/arch/avr32/boards/hammerhead/flash.c
@@ -0,0 +1,377 @@
1/*
2 * Hammerhead board-specific flash initialization
3 *
4 * Copyright (C) 2008 Miromico AG
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#include <linux/init.h>
12#include <linux/platform_device.h>
13#include <linux/mtd/mtd.h>
14#include <linux/mtd/partitions.h>
15#include <linux/mtd/physmap.h>
16#include <linux/usb/isp116x.h>
17#include <linux/dma-mapping.h>
18#include <linux/platform_device.h>
19#include <linux/delay.h>
20
21#include <mach/portmux.h>
22#include <mach/at32ap700x.h>
23#include <mach/smc.h>
24
25#include "../../mach-at32ap/clock.h"
26#include "flash.h"
27
28
29#define HAMMERHEAD_USB_PERIPH_GCLK0 0x40000000
30#define HAMMERHEAD_USB_PERIPH_CS2 0x02000000
31#define HAMMERHEAD_USB_PERIPH_EXTINT0 0x02000000
32
33#define HAMMERHEAD_FPGA_PERIPH_MOSI 0x00000002
34#define HAMMERHEAD_FPGA_PERIPH_SCK 0x00000020
35#define HAMMERHEAD_FPGA_PERIPH_EXTINT3 0x10000000
36
37static struct smc_timing flash_timing __initdata = {
38 .ncs_read_setup = 0,
39 .nrd_setup = 40,
40 .ncs_write_setup = 0,
41 .nwe_setup = 10,
42
43 .ncs_read_pulse = 80,
44 .nrd_pulse = 40,
45 .ncs_write_pulse = 65,
46 .nwe_pulse = 55,
47
48 .read_cycle = 120,
49 .write_cycle = 120,
50};
51
52static struct smc_config flash_config __initdata = {
53 .bus_width = 2,
54 .nrd_controlled = 1,
55 .nwe_controlled = 1,
56 .byte_write = 1,
57};
58
59static struct mtd_partition flash_parts[] = {
60 {
61 .name = "u-boot",
62 .offset = 0x00000000,
63 .size = 0x00020000, /* 128 KiB */
64 .mask_flags = MTD_WRITEABLE,
65 },
66 {
67 .name = "root",
68 .offset = 0x00020000,
69 .size = 0x007d0000,
70 },
71 {
72 .name = "env",
73 .offset = 0x007f0000,
74 .size = 0x00010000,
75 .mask_flags = MTD_WRITEABLE,
76 },
77};
78
79static struct physmap_flash_data flash_data = {
80 .width = 2,
81 .nr_parts = ARRAY_SIZE(flash_parts),
82 .parts = flash_parts,
83};
84
85static struct resource flash_resource = {
86 .start = 0x00000000,
87 .end = 0x007fffff,
88 .flags = IORESOURCE_MEM,
89};
90
91static struct platform_device flash_device = {
92 .name = "physmap-flash",
93 .id = 0,
94 .resource = &flash_resource,
95 .num_resources = 1,
96 .dev = { .platform_data = &flash_data, },
97};
98
99#ifdef CONFIG_BOARD_HAMMERHEAD_USB
100
101static struct smc_timing isp1160_timing __initdata = {
102 .ncs_read_setup = 75,
103 .nrd_setup = 75,
104 .ncs_write_setup = 75,
105 .nwe_setup = 75,
106
107
108 /* We use conservative timing settings, as the minimal settings aren't
109 stable. There may be room for tweaking. */
110 .ncs_read_pulse = 75, /* min. 33ns */
111 .nrd_pulse = 75, /* min. 33ns */
112 .ncs_write_pulse = 75, /* min. 26ns */
113 .nwe_pulse = 75, /* min. 26ns */
114
115 .read_cycle = 225, /* min. 143ns */
116 .write_cycle = 225, /* min. 136ns */
117};
118
119static struct smc_config isp1160_config __initdata = {
120 .bus_width = 2,
121 .nrd_controlled = 1,
122 .nwe_controlled = 1,
123 .byte_write = 0,
124};
125
126/*
127 * The platform delay function is only used to enforce the strange
128 * read to write delay. This can not be configured in the SMC. All other
129 * timings are controlled by the SMC (see timings obove)
130 * So in isp116x-hcd.c we should comment out USE_PLATFORM_DELAY
131 */
132void isp116x_delay(struct device *dev, int delay)
133{
134 if (delay > 150)
135 ndelay(delay - 150);
136}
137
138static struct isp116x_platform_data isp1160_data = {
139 .sel15Kres = 1, /* use internal downstream resistors */
140 .oc_enable = 0, /* external overcurrent detection */
141 .int_edge_triggered = 0, /* interrupt is level triggered */
142 .int_act_high = 0, /* interrupt is active low */
143 .delay = isp116x_delay, /* platform delay function */
144};
145
146static struct resource isp1160_resource[] = {
147 {
148 .start = 0x08000000,
149 .end = 0x08000001,
150 .flags = IORESOURCE_MEM,
151 },
152 {
153 .start = 0x08000002,
154 .end = 0x08000003,
155 .flags = IORESOURCE_MEM,
156 },
157 {
158 .start = 64,
159 .flags = IORESOURCE_IRQ,
160 },
161};
162
163static struct platform_device isp1160_device = {
164 .name = "isp116x-hcd",
165 .id = 0,
166 .resource = isp1160_resource,
167 .num_resources = 3,
168 .dev = {
169 .platform_data = &isp1160_data,
170 },
171};
172#endif
173
174#ifdef CONFIG_BOARD_HAMMERHEAD_USB
175static int __init hammerhead_usbh_init(void)
176{
177 struct clk *gclk;
178 struct clk *osc;
179
180 int ret;
181
182 /* setup smc for usbh */
183 smc_set_timing(&isp1160_config, &isp1160_timing);
184 ret = smc_set_configuration(2, &isp1160_config);
185
186 if (ret < 0) {
187 printk(KERN_ERR
188 "hammerhead: failed to set ISP1160 USBH timing\n");
189 return ret;
190 }
191
192 /* setup gclk0 to run from osc1 */
193 gclk = clk_get(NULL, "gclk0");
194 if (IS_ERR(gclk))
195 goto err_gclk;
196
197 osc = clk_get(NULL, "osc1");
198 if (IS_ERR(osc))
199 goto err_osc;
200
201 if (clk_set_parent(gclk, osc)) {
202 pr_debug("hammerhead: failed to set osc1 for USBH clock\n");
203 goto err_set_clk;
204 }
205
206 /* set clock to 6MHz */
207 clk_set_rate(gclk, 6000000);
208
209 /* and enable */
210 clk_enable(gclk);
211
212 /* select GCLK0 peripheral function */
213 at32_select_periph(GPIO_PIOA_BASE, HAMMERHEAD_USB_PERIPH_GCLK0,
214 GPIO_PERIPH_A, 0);
215
216 /* enable CS2 peripheral function */
217 at32_select_periph(GPIO_PIOE_BASE, HAMMERHEAD_USB_PERIPH_CS2,
218 GPIO_PERIPH_A, 0);
219
220 /* H_WAKEUP must be driven low */
221 at32_select_gpio(GPIO_PIN_PA(8), AT32_GPIOF_OUTPUT);
222
223 /* Select EXTINT0 for PB25 */
224 at32_select_periph(GPIO_PIOB_BASE, HAMMERHEAD_USB_PERIPH_EXTINT0,
225 GPIO_PERIPH_A, 0);
226
227 /* register usbh device driver */
228 platform_device_register(&isp1160_device);
229
230 err_set_clk:
231 clk_put(osc);
232 err_osc:
233 clk_put(gclk);
234 err_gclk:
235 return ret;
236}
237#endif
238
239#ifdef CONFIG_BOARD_HAMMERHEAD_FPGA
240static struct smc_timing fpga_timing __initdata = {
241 .ncs_read_setup = 16,
242 .nrd_setup = 32,
243 .ncs_read_pulse = 48,
244 .nrd_pulse = 32,
245 .read_cycle = 64,
246
247 .ncs_write_setup = 16,
248 .nwe_setup = 16,
249 .ncs_write_pulse = 32,
250 .nwe_pulse = 32,
251 .write_cycle = 64,
252};
253
254static struct smc_config fpga_config __initdata = {
255 .bus_width = 4,
256 .nrd_controlled = 1,
257 .nwe_controlled = 1,
258 .byte_write = 0,
259};
260
261static struct resource hh_fpga0_resource[] = {
262 {
263 .start = 0xffe00400,
264 .end = 0xffe00400 + 0x3ff,
265 .flags = IORESOURCE_MEM,
266 },
267 {
268 .start = 4,
269 .end = 4,
270 .flags = IORESOURCE_IRQ,
271 },
272 {
273 .start = 0x0c000000,
274 .end = 0x0c000100,
275 .flags = IORESOURCE_MEM,
276 },
277 {
278 .start = 67,
279 .end = 67,
280 .flags = IORESOURCE_IRQ,
281 },
282};
283
284static u64 hh_fpga0_dma_mask = DMA_32BIT_MASK;
285static struct platform_device hh_fpga0_device = {
286 .name = "hh_fpga",
287 .id = 0,
288 .dev = {
289 .dma_mask = &hh_fpga0_dma_mask,
290 .coherent_dma_mask = DMA_32BIT_MASK,
291 },
292 .resource = hh_fpga0_resource,
293 .num_resources = ARRAY_SIZE(hh_fpga0_resource),
294};
295
296static struct clk hh_fpga0_spi_clk = {
297 .name = "spi_clk",
298 .dev = &hh_fpga0_device.dev,
299 .mode = pba_clk_mode,
300 .get_rate = pba_clk_get_rate,
301 .index = 1,
302};
303
304struct platform_device *__init at32_add_device_hh_fpga(void)
305{
306 /* Select peripheral functionallity for SPI SCK and MOSI */
307 at32_select_periph(GPIO_PIOB_BASE, HAMMERHEAD_FPGA_PERIPH_SCK,
308 GPIO_PERIPH_B, 0);
309 at32_select_periph(GPIO_PIOB_BASE, HAMMERHEAD_FPGA_PERIPH_MOSI,
310 GPIO_PERIPH_B, 0);
311
312 /* reserve all other needed gpio
313 * We have on board pull ups, so there is no need
314 * to enable gpio pull ups */
315 /* INIT_DONE (input) */
316 at32_select_gpio(GPIO_PIN_PB(0), 0);
317
318 /* nSTATUS (input) */
319 at32_select_gpio(GPIO_PIN_PB(2), 0);
320
321 /* nCONFIG (output, low) */
322 at32_select_gpio(GPIO_PIN_PB(3), AT32_GPIOF_OUTPUT);
323
324 /* CONF_DONE (input) */
325 at32_select_gpio(GPIO_PIN_PB(4), 0);
326
327 /* Select EXTINT3 for PB28 (Interrupt from FPGA) */
328 at32_select_periph(GPIO_PIOB_BASE, HAMMERHEAD_FPGA_PERIPH_EXTINT3,
329 GPIO_PERIPH_A, 0);
330
331 /* Get our parent clock */
332 hh_fpga0_spi_clk.parent = clk_get(NULL, "pba");
333 clk_put(hh_fpga0_spi_clk.parent);
334
335 /* Register clock in at32 clock tree */
336 at32_clk_register(&hh_fpga0_spi_clk);
337
338 platform_device_register(&hh_fpga0_device);
339 return &hh_fpga0_device;
340}
341#endif
342
343/* This needs to be called after the SMC has been initialized */
344static int __init hammerhead_flash_init(void)
345{
346 int ret;
347
348 smc_set_timing(&flash_config, &flash_timing);
349 ret = smc_set_configuration(0, &flash_config);
350
351 if (ret < 0) {
352 printk(KERN_ERR "hammerhead: failed to set NOR flash timing\n");
353 return ret;
354 }
355
356 platform_device_register(&flash_device);
357
358#ifdef CONFIG_BOARD_HAMMERHEAD_USB
359 hammerhead_usbh_init();
360#endif
361
362#ifdef CONFIG_BOARD_HAMMERHEAD_FPGA
363 /* Setup SMC for FPGA interface */
364 smc_set_timing(&fpga_config, &fpga_timing);
365 ret = smc_set_configuration(3, &fpga_config);
366#endif
367
368
369 if (ret < 0) {
370 printk(KERN_ERR "hammerhead: failed to set FPGA timing\n");
371 return ret;
372 }
373
374 return 0;
375}
376
377device_initcall(hammerhead_flash_init);
diff --git a/arch/avr32/boards/hammerhead/flash.h b/arch/avr32/boards/hammerhead/flash.h
new file mode 100644
index 000000000000..ea70c626587b
--- /dev/null
+++ b/arch/avr32/boards/hammerhead/flash.h
@@ -0,0 +1,6 @@
1#ifndef __BOARDS_HAMMERHEAD_FLASH_H
2#define __BOARDS_HAMMERHEAD_FLASH_H
3
4struct platform_device *at32_add_device_hh_fpga(void);
5
6#endif /* __BOARDS_HAMMERHEAD_FLASH_H */
diff --git a/arch/avr32/boards/hammerhead/setup.c b/arch/avr32/boards/hammerhead/setup.c
new file mode 100644
index 000000000000..4d2fe82b2029
--- /dev/null
+++ b/arch/avr32/boards/hammerhead/setup.c
@@ -0,0 +1,245 @@
1/*
2 * Board-specific setup code for the Miromico Hammerhead board
3 *
4 * Copyright (C) 2008 Miromico AG
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10#include <linux/atmel-mci.h>
11#include <linux/clk.h>
12#include <linux/fb.h>
13#include <linux/etherdevice.h>
14#include <linux/i2c.h>
15#include <linux/i2c-gpio.h>
16#include <linux/init.h>
17#include <linux/linkage.h>
18#include <linux/platform_device.h>
19#include <linux/types.h>
20#include <linux/spi/spi.h>
21
22#include <video/atmel_lcdc.h>
23
24#include <linux/io.h>
25#include <asm/setup.h>
26
27#include <mach/at32ap700x.h>
28#include <mach/board.h>
29#include <mach/init.h>
30#include <mach/portmux.h>
31
32#include "../../mach-at32ap/clock.h"
33#include "flash.h"
34
35/* Oscillator frequencies. These are board-specific */
36unsigned long at32_board_osc_rates[3] = {
37 [0] = 32768, /* 32.768 kHz on RTC osc */
38 [1] = 25000000, /* 25MHz on osc0 */
39 [2] = 12000000, /* 12 MHz on osc1 */
40};
41
42/* Initialized by bootloader-specific startup code. */
43struct tag *bootloader_tags __initdata;
44
45#ifdef CONFIG_BOARD_HAMMERHEAD_LCD
46static struct fb_videomode __initdata hda350tlv_modes[] = {
47 {
48 .name = "320x240 @ 75",
49 .refresh = 75,
50 .xres = 320,
51 .yres = 240,
52 .pixclock = KHZ2PICOS(6891),
53
54 .left_margin = 48,
55 .right_margin = 18,
56 .upper_margin = 18,
57 .lower_margin = 4,
58 .hsync_len = 20,
59 .vsync_len = 2,
60
61 .sync = 0,
62 .vmode = FB_VMODE_NONINTERLACED,
63 },
64};
65
66static struct fb_monspecs __initdata hammerhead_hda350t_monspecs = {
67 .manufacturer = "HAN",
68 .monitor = "HDA350T-LV",
69 .modedb = hda350tlv_modes,
70 .modedb_len = ARRAY_SIZE(hda350tlv_modes),
71 .hfmin = 14900,
72 .hfmax = 22350,
73 .vfmin = 60,
74 .vfmax = 90,
75 .dclkmax = 10000000,
76};
77
78struct atmel_lcdfb_info __initdata hammerhead_lcdc_data = {
79 .default_bpp = 24,
80 .default_dmacon = ATMEL_LCDC_DMAEN | ATMEL_LCDC_DMA2DEN,
81 .default_lcdcon2 = (ATMEL_LCDC_DISTYPE_TFT
82 | ATMEL_LCDC_INVCLK
83 | ATMEL_LCDC_CLKMOD_ALWAYSACTIVE
84 | ATMEL_LCDC_MEMOR_BIG),
85 .default_monspecs = &hammerhead_hda350t_monspecs,
86 .guard_time = 2,
87};
88#endif
89
90static struct mci_platform_data __initdata mci0_data = {
91 .slot[0] = {
92 .bus_width = 4,
93 .detect_pin = -ENODEV,
94 .wp_pin = -ENODEV,
95 },
96};
97
98struct eth_addr {
99 u8 addr[6];
100};
101
102static struct eth_addr __initdata hw_addr[1];
103static struct eth_platform_data __initdata eth_data[1];
104
105/*
106 * The next two functions should go away as the boot loader is
107 * supposed to initialize the macb address registers with a valid
108 * ethernet address. But we need to keep it around for a while until
109 * we can be reasonably sure the boot loader does this.
110 *
111 * The phy_id is ignored as the driver will probe for it.
112 */
113static int __init parse_tag_ethernet(struct tag *tag)
114{
115 int i = tag->u.ethernet.mac_index;
116
117 if (i < ARRAY_SIZE(hw_addr))
118 memcpy(hw_addr[i].addr, tag->u.ethernet.hw_address,
119 sizeof(hw_addr[i].addr));
120
121 return 0;
122}
123__tagtable(ATAG_ETHERNET, parse_tag_ethernet);
124
125static void __init set_hw_addr(struct platform_device *pdev)
126{
127 struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
128 const u8 *addr;
129 void __iomem *regs;
130 struct clk *pclk;
131
132 if (!res)
133 return;
134
135 if (pdev->id >= ARRAY_SIZE(hw_addr))
136 return;
137
138 addr = hw_addr[pdev->id].addr;
139
140 if (!is_valid_ether_addr(addr))
141 return;
142
143 /*
144 * Since this is board-specific code, we'll cheat and use the
145 * physical address directly as we happen to know that it's
146 * the same as the virtual address.
147 */
148 regs = (void __iomem __force *)res->start;
149 pclk = clk_get(&pdev->dev, "pclk");
150
151 if (!pclk)
152 return;
153
154 clk_enable(pclk);
155
156 __raw_writel((addr[3] << 24) | (addr[2] << 16) | (addr[1] << 8) |
157 addr[0], regs + 0x98);
158 __raw_writel((addr[5] << 8) | addr[4], regs + 0x9c);
159
160 clk_disable(pclk);
161 clk_put(pclk);
162}
163
164void __init setup_board(void)
165{
166 at32_map_usart(1, 0); /* USART 1: /dev/ttyS0, DB9 */
167 at32_setup_serial_console(0);
168}
169
170static struct i2c_gpio_platform_data i2c_gpio_data = {
171 .sda_pin = GPIO_PIN_PA(6),
172 .scl_pin = GPIO_PIN_PA(7),
173 .sda_is_open_drain = 1,
174 .scl_is_open_drain = 1,
175 .udelay = 2, /* close to 100 kHz */
176};
177
178static struct platform_device i2c_gpio_device = {
179 .name = "i2c-gpio",
180 .id = 0,
181 .dev = { .platform_data = &i2c_gpio_data, },
182};
183
184static struct i2c_board_info __initdata i2c_info[] = {};
185
186#ifdef CONFIG_BOARD_HAMMERHEAD_SND
187static struct ac97c_platform_data ac97c_data = {
188 .reset_pin = GPIO_PIN_PA(16),
189};
190#endif
191
192static int __init hammerhead_init(void)
193{
194 /*
195 * Hammerhead uses 32-bit SDRAM interface. Reserve the
196 * SDRAM-specific pins so that nobody messes with them.
197 */
198 at32_reserve_pin(GPIO_PIOE_BASE, ATMEL_EBI_PE_DATA_ALL);
199
200 at32_add_device_usart(0);
201
202 /* Reserve PB29 (GCLK3). This pin is used as clock source
203 * for ETH PHY (25MHz). GCLK3 setup is done by U-Boot.
204 */
205 at32_reserve_pin(GPIO_PIOB_BASE, (1<<29));
206
207 /*
208 * Hammerhead uses only one ethernet port, so we don't set
209 * address of second port
210 */
211 set_hw_addr(at32_add_device_eth(0, &eth_data[0]));
212
213#ifdef CONFIG_BOARD_HAMMERHEAD_FPGA
214 at32_add_device_hh_fpga();
215#endif
216 at32_add_device_mci(0, &mci0_data);
217
218#ifdef CONFIG_BOARD_HAMMERHEAD_USB
219 at32_add_device_usba(0, NULL);
220#endif
221#ifdef CONFIG_BOARD_HAMMERHEAD_LCD
222 at32_add_device_lcdc(0, &hammerhead_lcdc_data, fbmem_start,
223 fbmem_size, ATMEL_LCDC_PRI_24BIT);
224#endif
225
226 at32_select_gpio(i2c_gpio_data.sda_pin,
227 AT32_GPIOF_MULTIDRV | AT32_GPIOF_OUTPUT |
228 AT32_GPIOF_HIGH);
229 at32_select_gpio(i2c_gpio_data.scl_pin,
230 AT32_GPIOF_MULTIDRV | AT32_GPIOF_OUTPUT |
231 AT32_GPIOF_HIGH);
232 platform_device_register(&i2c_gpio_device);
233 i2c_register_board_info(0, i2c_info, ARRAY_SIZE(i2c_info));
234
235#ifdef CONFIG_BOARD_HAMMERHEAD_SND
236 at32_add_device_ac97c(0, &ac97c_data);
237#endif
238
239 /* Select the Touchscreen interrupt pin mode */
240 at32_select_periph(GPIO_PIOB_BASE, 0x08000000, GPIO_PERIPH_A, 0);
241
242 return 0;
243}
244
245postcore_initcall(hammerhead_init);
diff --git a/arch/avr32/boards/mimc200/setup.c b/arch/avr32/boards/mimc200/setup.c
index 397cbb8f44c8..2b58d61f0afc 100644
--- a/arch/avr32/boards/mimc200/setup.c
+++ b/arch/avr32/boards/mimc200/setup.c
@@ -24,7 +24,7 @@ extern struct atmel_lcdfb_info mimc200_lcdc_data;
24#include <video/atmel_lcdc.h> 24#include <video/atmel_lcdc.h>
25#include <linux/fb.h> 25#include <linux/fb.h>
26 26
27#include <asm/atmel-mci.h> 27#include <linux/atmel-mci.h>
28#include <linux/io.h> 28#include <linux/io.h>
29#include <asm/setup.h> 29#include <asm/setup.h>
30 30
@@ -207,8 +207,6 @@ static int __init mimc200_init(void)
207 * reserve any pins for it. 207 * reserve any pins for it.
208 */ 208 */
209 209
210 at32_add_system_devices();
211
212 at32_add_device_usart(0); 210 at32_add_device_usart(0);
213 at32_add_device_usart(1); 211 at32_add_device_usart(1);
214 at32_add_device_usart(2); 212 at32_add_device_usart(2);
diff --git a/arch/avr32/configs/atngw100_defconfig b/arch/avr32/configs/atngw100_defconfig
index 541520912c55..164e2814ae78 100644
--- a/arch/avr32/configs/atngw100_defconfig
+++ b/arch/avr32/configs/atngw100_defconfig
@@ -892,7 +892,7 @@ CONFIG_DMA_ENGINE=y
892# DMA Clients 892# DMA Clients
893# 893#
894# CONFIG_NET_DMA is not set 894# CONFIG_NET_DMA is not set
895CONFIG_DMATEST=m 895# CONFIG_DMATEST is not set
896# CONFIG_UIO is not set 896# CONFIG_UIO is not set
897 897
898# 898#
diff --git a/arch/avr32/configs/atstk1002_defconfig b/arch/avr32/configs/atstk1002_defconfig
index 69fce6b6a783..c9dc64832a19 100644
--- a/arch/avr32/configs/atstk1002_defconfig
+++ b/arch/avr32/configs/atstk1002_defconfig
@@ -964,7 +964,7 @@ CONFIG_DMA_ENGINE=y
964# DMA Clients 964# DMA Clients
965# 965#
966# CONFIG_NET_DMA is not set 966# CONFIG_NET_DMA is not set
967CONFIG_DMATEST=m 967# CONFIG_DMATEST is not set
968# CONFIG_UIO is not set 968# CONFIG_UIO is not set
969 969
970# 970#
diff --git a/arch/avr32/configs/atstk1003_defconfig b/arch/avr32/configs/atstk1003_defconfig
index 5477ed3183b4..29ea1327b498 100644
--- a/arch/avr32/configs/atstk1003_defconfig
+++ b/arch/avr32/configs/atstk1003_defconfig
@@ -882,7 +882,7 @@ CONFIG_DMA_ENGINE=y
882# DMA Clients 882# DMA Clients
883# 883#
884# CONFIG_NET_DMA is not set 884# CONFIG_NET_DMA is not set
885CONFIG_DMATEST=m 885# CONFIG_DMATEST is not set
886# CONFIG_UIO is not set 886# CONFIG_UIO is not set
887 887
888# 888#
diff --git a/arch/avr32/configs/atstk1006_defconfig b/arch/avr32/configs/atstk1006_defconfig
index 6c45a3b77aa3..361c31c2af10 100644
--- a/arch/avr32/configs/atstk1006_defconfig
+++ b/arch/avr32/configs/atstk1006_defconfig
@@ -1014,7 +1014,7 @@ CONFIG_DMA_ENGINE=y
1014# DMA Clients 1014# DMA Clients
1015# 1015#
1016# CONFIG_NET_DMA is not set 1016# CONFIG_NET_DMA is not set
1017CONFIG_DMATEST=m 1017# CONFIG_DMATEST is not set
1018# CONFIG_UIO is not set 1018# CONFIG_UIO is not set
1019# CONFIG_STAGING is not set 1019# CONFIG_STAGING is not set
1020CONFIG_STAGING_EXCLUDE_BUILD=y 1020CONFIG_STAGING_EXCLUDE_BUILD=y
diff --git a/arch/avr32/configs/hammerhead_defconfig b/arch/avr32/configs/hammerhead_defconfig
new file mode 100644
index 000000000000..0d3d2982c8f5
--- /dev/null
+++ b/arch/avr32/configs/hammerhead_defconfig
@@ -0,0 +1,1467 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.27
4# Tue Dec 9 15:37:30 2008
5#
6CONFIG_AVR32=y
7CONFIG_GENERIC_GPIO=y
8CONFIG_GENERIC_HARDIRQS=y
9CONFIG_STACKTRACE_SUPPORT=y
10CONFIG_LOCKDEP_SUPPORT=y
11CONFIG_TRACE_IRQFLAGS_SUPPORT=y
12CONFIG_HARDIRQS_SW_RESEND=y
13CONFIG_GENERIC_IRQ_PROBE=y
14CONFIG_RWSEM_GENERIC_SPINLOCK=y
15CONFIG_GENERIC_TIME=y
16CONFIG_GENERIC_CLOCKEVENTS=y
17# CONFIG_RWSEM_XCHGADD_ALGORITHM is not set
18# CONFIG_ARCH_HAS_ILOG2_U32 is not set
19# CONFIG_ARCH_HAS_ILOG2_U64 is not set
20CONFIG_GENERIC_HWEIGHT=y
21CONFIG_GENERIC_CALIBRATE_DELAY=y
22CONFIG_GENERIC_BUG=y
23CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
24
25#
26# General setup
27#
28CONFIG_EXPERIMENTAL=y
29CONFIG_BROKEN_ON_SMP=y
30CONFIG_INIT_ENV_ARG_LIMIT=32
31CONFIG_LOCALVERSION=""
32# CONFIG_LOCALVERSION_AUTO is not set
33CONFIG_SWAP=y
34CONFIG_SYSVIPC=y
35CONFIG_SYSVIPC_SYSCTL=y
36CONFIG_POSIX_MQUEUE=y
37CONFIG_BSD_PROCESS_ACCT=y
38CONFIG_BSD_PROCESS_ACCT_V3=y
39# CONFIG_TASKSTATS is not set
40# CONFIG_AUDIT is not set
41# CONFIG_IKCONFIG is not set
42CONFIG_LOG_BUF_SHIFT=14
43# CONFIG_CGROUPS is not set
44# CONFIG_GROUP_SCHED is not set
45CONFIG_SYSFS_DEPRECATED=y
46CONFIG_SYSFS_DEPRECATED_V2=y
47# CONFIG_RELAY is not set
48# CONFIG_NAMESPACES is not set
49CONFIG_BLK_DEV_INITRD=y
50CONFIG_INITRAMFS_SOURCE=""
51CONFIG_CC_OPTIMIZE_FOR_SIZE=y
52CONFIG_SYSCTL=y
53CONFIG_EMBEDDED=y
54# CONFIG_SYSCTL_SYSCALL is not set
55CONFIG_KALLSYMS=y
56# CONFIG_KALLSYMS_ALL is not set
57# CONFIG_KALLSYMS_EXTRA_PASS is not set
58CONFIG_HOTPLUG=y
59CONFIG_PRINTK=y
60CONFIG_BUG=y
61CONFIG_ELF_CORE=y
62# CONFIG_COMPAT_BRK is not set
63# CONFIG_BASE_FULL is not set
64CONFIG_FUTEX=y
65CONFIG_ANON_INODES=y
66CONFIG_EPOLL=y
67CONFIG_SIGNALFD=y
68CONFIG_TIMERFD=y
69CONFIG_EVENTFD=y
70CONFIG_SHMEM=y
71CONFIG_AIO=y
72CONFIG_VM_EVENT_COUNTERS=y
73CONFIG_PCI_QUIRKS=y
74CONFIG_SLUB_DEBUG=y
75# CONFIG_SLAB is not set
76CONFIG_SLUB=y
77# CONFIG_SLOB is not set
78CONFIG_PROFILING=y
79# CONFIG_MARKERS is not set
80CONFIG_OPROFILE=m
81CONFIG_HAVE_OPROFILE=y
82CONFIG_KPROBES=y
83CONFIG_HAVE_KPROBES=y
84CONFIG_HAVE_CLK=y
85# CONFIG_HAVE_GENERIC_DMA_COHERENT is not set
86CONFIG_SLABINFO=y
87CONFIG_RT_MUTEXES=y
88# CONFIG_TINY_SHMEM is not set
89CONFIG_BASE_SMALL=1
90CONFIG_MODULES=y
91# CONFIG_MODULE_FORCE_LOAD is not set
92CONFIG_MODULE_UNLOAD=y
93CONFIG_MODULE_FORCE_UNLOAD=y
94# CONFIG_MODVERSIONS is not set
95# CONFIG_MODULE_SRCVERSION_ALL is not set
96CONFIG_KMOD=y
97CONFIG_BLOCK=y
98# CONFIG_LBD is not set
99# CONFIG_BLK_DEV_IO_TRACE is not set
100# CONFIG_LSF is not set
101# CONFIG_BLK_DEV_BSG is not set
102# CONFIG_BLK_DEV_INTEGRITY is not set
103
104#
105# IO Schedulers
106#
107CONFIG_IOSCHED_NOOP=y
108# CONFIG_IOSCHED_AS is not set
109# CONFIG_IOSCHED_DEADLINE is not set
110CONFIG_IOSCHED_CFQ=y
111# CONFIG_DEFAULT_AS is not set
112# CONFIG_DEFAULT_DEADLINE is not set
113CONFIG_DEFAULT_CFQ=y
114# CONFIG_DEFAULT_NOOP is not set
115CONFIG_DEFAULT_IOSCHED="cfq"
116CONFIG_CLASSIC_RCU=y
117# CONFIG_FREEZER is not set
118
119#
120# System Type and features
121#
122CONFIG_TICK_ONESHOT=y
123CONFIG_NO_HZ=y
124CONFIG_HIGH_RES_TIMERS=y
125CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
126CONFIG_SUBARCH_AVR32B=y
127CONFIG_MMU=y
128CONFIG_PERFORMANCE_COUNTERS=y
129CONFIG_PLATFORM_AT32AP=y
130CONFIG_CPU_AT32AP700X=y
131CONFIG_CPU_AT32AP7000=y
132# CONFIG_BOARD_ATSTK1000 is not set
133# CONFIG_BOARD_ATNGW100 is not set
134CONFIG_BOARD_HAMMERHEAD=y
135# CONFIG_BOARD_FAVR_32 is not set
136# CONFIG_BOARD_MIMC200 is not set
137CONFIG_BOARD_HAMMERHEAD_USB=y
138CONFIG_BOARD_HAMMERHEAD_LCD=y
139CONFIG_BOARD_HAMMERHEAD_SND=y
140# CONFIG_BOARD_HAMMERHEAD_FPGA is not set
141CONFIG_LOADER_U_BOOT=y
142
143#
144# Atmel AVR32 AP options
145#
146# CONFIG_AP700X_32_BIT_SMC is not set
147CONFIG_AP700X_16_BIT_SMC=y
148# CONFIG_AP700X_8_BIT_SMC is not set
149CONFIG_LOAD_ADDRESS=0x10000000
150CONFIG_ENTRY_ADDRESS=0x90000000
151CONFIG_PHYS_OFFSET=0x10000000
152CONFIG_PREEMPT_NONE=y
153# CONFIG_PREEMPT_VOLUNTARY is not set
154# CONFIG_PREEMPT is not set
155CONFIG_QUICKLIST=y
156# CONFIG_HAVE_ARCH_BOOTMEM_NODE is not set
157# CONFIG_ARCH_HAVE_MEMORY_PRESENT is not set
158# CONFIG_NEED_NODE_MEMMAP_SIZE is not set
159CONFIG_ARCH_FLATMEM_ENABLE=y
160# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set
161# CONFIG_ARCH_SPARSEMEM_ENABLE is not set
162CONFIG_SELECT_MEMORY_MODEL=y
163CONFIG_FLATMEM_MANUAL=y
164# CONFIG_DISCONTIGMEM_MANUAL is not set
165# CONFIG_SPARSEMEM_MANUAL is not set
166CONFIG_FLATMEM=y
167CONFIG_FLAT_NODE_MEM_MAP=y
168CONFIG_PAGEFLAGS_EXTENDED=y
169CONFIG_SPLIT_PTLOCK_CPUS=4
170# CONFIG_RESOURCES_64BIT is not set
171# CONFIG_PHYS_ADDR_T_64BIT is not set
172CONFIG_ZONE_DMA_FLAG=0
173CONFIG_NR_QUICK=2
174CONFIG_VIRT_TO_BUS=y
175CONFIG_UNEVICTABLE_LRU=y
176# CONFIG_OWNERSHIP_TRACE is not set
177# CONFIG_NMI_DEBUGGING is not set
178# CONFIG_HZ_100 is not set
179CONFIG_HZ_250=y
180# CONFIG_HZ_300 is not set
181# CONFIG_HZ_1000 is not set
182CONFIG_HZ=250
183CONFIG_SCHED_HRTICK=y
184CONFIG_CMDLINE=""
185
186#
187# Power management options
188#
189# CONFIG_PM is not set
190CONFIG_ARCH_SUSPEND_POSSIBLE=y
191
192#
193# CPU Frequency scaling
194#
195CONFIG_CPU_FREQ=y
196CONFIG_CPU_FREQ_TABLE=y
197# CONFIG_CPU_FREQ_DEBUG is not set
198# CONFIG_CPU_FREQ_STAT is not set
199# CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE is not set
200# CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE is not set
201# CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE is not set
202CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y
203# CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE is not set
204CONFIG_CPU_FREQ_GOV_PERFORMANCE=y
205# CONFIG_CPU_FREQ_GOV_POWERSAVE is not set
206CONFIG_CPU_FREQ_GOV_USERSPACE=y
207CONFIG_CPU_FREQ_GOV_ONDEMAND=y
208# CONFIG_CPU_FREQ_GOV_CONSERVATIVE is not set
209CONFIG_CPU_FREQ_AT32AP=y
210
211#
212# Bus options
213#
214# CONFIG_ARCH_SUPPORTS_MSI is not set
215# CONFIG_PCCARD is not set
216
217#
218# Executable file formats
219#
220CONFIG_BINFMT_ELF=y
221# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
222# CONFIG_HAVE_AOUT is not set
223# CONFIG_BINFMT_MISC is not set
224CONFIG_NET=y
225
226#
227# Networking options
228#
229CONFIG_PACKET=y
230CONFIG_PACKET_MMAP=y
231CONFIG_UNIX=y
232CONFIG_XFRM=y
233CONFIG_XFRM_USER=y
234# CONFIG_XFRM_SUB_POLICY is not set
235# CONFIG_XFRM_MIGRATE is not set
236# CONFIG_XFRM_STATISTICS is not set
237CONFIG_XFRM_IPCOMP=y
238CONFIG_NET_KEY=y
239# CONFIG_NET_KEY_MIGRATE is not set
240CONFIG_INET=y
241CONFIG_IP_MULTICAST=y
242CONFIG_IP_ADVANCED_ROUTER=y
243CONFIG_ASK_IP_FIB_HASH=y
244# CONFIG_IP_FIB_TRIE is not set
245CONFIG_IP_FIB_HASH=y
246# CONFIG_IP_MULTIPLE_TABLES is not set
247# CONFIG_IP_ROUTE_MULTIPATH is not set
248# CONFIG_IP_ROUTE_VERBOSE is not set
249CONFIG_IP_PNP=y
250CONFIG_IP_PNP_DHCP=y
251# CONFIG_IP_PNP_BOOTP is not set
252# CONFIG_IP_PNP_RARP is not set
253# CONFIG_NET_IPIP is not set
254# CONFIG_NET_IPGRE is not set
255CONFIG_IP_MROUTE=y
256CONFIG_IP_PIMSM_V1=y
257# CONFIG_IP_PIMSM_V2 is not set
258# CONFIG_ARPD is not set
259CONFIG_SYN_COOKIES=y
260CONFIG_INET_AH=y
261CONFIG_INET_ESP=y
262CONFIG_INET_IPCOMP=y
263CONFIG_INET_XFRM_TUNNEL=y
264CONFIG_INET_TUNNEL=y
265CONFIG_INET_XFRM_MODE_TRANSPORT=y
266CONFIG_INET_XFRM_MODE_TUNNEL=y
267CONFIG_INET_XFRM_MODE_BEET=y
268# CONFIG_INET_LRO is not set
269CONFIG_INET_DIAG=y
270CONFIG_INET_TCP_DIAG=y
271# CONFIG_TCP_CONG_ADVANCED is not set
272CONFIG_TCP_CONG_CUBIC=y
273CONFIG_DEFAULT_TCP_CONG="cubic"
274# CONFIG_TCP_MD5SIG is not set
275# CONFIG_IPV6 is not set
276# CONFIG_NETWORK_SECMARK is not set
277CONFIG_NETFILTER=y
278# CONFIG_NETFILTER_DEBUG is not set
279# CONFIG_NETFILTER_ADVANCED is not set
280
281#
282# Core Netfilter Configuration
283#
284CONFIG_NETFILTER_NETLINK=m
285CONFIG_NETFILTER_NETLINK_LOG=m
286CONFIG_NF_CONNTRACK=m
287CONFIG_NF_CONNTRACK_FTP=m
288CONFIG_NF_CONNTRACK_IRC=m
289CONFIG_NF_CONNTRACK_SIP=m
290CONFIG_NF_CT_NETLINK=m
291CONFIG_NETFILTER_XTABLES=y
292CONFIG_NETFILTER_XT_TARGET_MARK=m
293CONFIG_NETFILTER_XT_TARGET_NFLOG=m
294CONFIG_NETFILTER_XT_TARGET_TCPMSS=m
295CONFIG_NETFILTER_XT_MATCH_CONNTRACK=m
296CONFIG_NETFILTER_XT_MATCH_MARK=m
297CONFIG_NETFILTER_XT_MATCH_POLICY=m
298CONFIG_NETFILTER_XT_MATCH_STATE=m
299# CONFIG_IP_VS is not set
300
301#
302# IP: Netfilter Configuration
303#
304CONFIG_NF_DEFRAG_IPV4=m
305CONFIG_NF_CONNTRACK_IPV4=m
306CONFIG_NF_CONNTRACK_PROC_COMPAT=y
307CONFIG_IP_NF_IPTABLES=m
308CONFIG_IP_NF_FILTER=m
309CONFIG_IP_NF_TARGET_REJECT=m
310CONFIG_IP_NF_TARGET_LOG=m
311# CONFIG_IP_NF_TARGET_ULOG is not set
312CONFIG_NF_NAT=m
313CONFIG_NF_NAT_NEEDED=y
314CONFIG_IP_NF_TARGET_MASQUERADE=m
315CONFIG_NF_NAT_FTP=m
316CONFIG_NF_NAT_IRC=m
317# CONFIG_NF_NAT_TFTP is not set
318# CONFIG_NF_NAT_AMANDA is not set
319# CONFIG_NF_NAT_PPTP is not set
320# CONFIG_NF_NAT_H323 is not set
321CONFIG_NF_NAT_SIP=m
322CONFIG_IP_NF_MANGLE=m
323# CONFIG_IP_DCCP is not set
324# CONFIG_IP_SCTP is not set
325# CONFIG_TIPC is not set
326# CONFIG_ATM is not set
327# CONFIG_BRIDGE is not set
328# CONFIG_NET_DSA is not set
329# CONFIG_VLAN_8021Q is not set
330# CONFIG_DECNET is not set
331# CONFIG_LLC2 is not set
332# CONFIG_IPX is not set
333# CONFIG_ATALK is not set
334# CONFIG_X25 is not set
335# CONFIG_LAPB is not set
336# CONFIG_ECONET is not set
337# CONFIG_WAN_ROUTER is not set
338# CONFIG_NET_SCHED is not set
339
340#
341# Network testing
342#
343# CONFIG_NET_PKTGEN is not set
344# CONFIG_NET_TCPPROBE is not set
345# CONFIG_HAMRADIO is not set
346# CONFIG_CAN is not set
347# CONFIG_IRDA is not set
348# CONFIG_BT is not set
349# CONFIG_AF_RXRPC is not set
350# CONFIG_PHONET is not set
351CONFIG_WIRELESS=y
352# CONFIG_CFG80211 is not set
353# CONFIG_WIRELESS_OLD_REGULATORY is not set
354# CONFIG_WIRELESS_EXT is not set
355# CONFIG_MAC80211 is not set
356# CONFIG_IEEE80211 is not set
357# CONFIG_RFKILL is not set
358# CONFIG_NET_9P is not set
359
360#
361# Device Drivers
362#
363
364#
365# Generic Driver Options
366#
367CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
368CONFIG_STANDALONE=y
369# CONFIG_PREVENT_FIRMWARE_BUILD is not set
370# CONFIG_FW_LOADER is not set
371# CONFIG_DEBUG_DRIVER is not set
372# CONFIG_DEBUG_DEVRES is not set
373# CONFIG_SYS_HYPERVISOR is not set
374# CONFIG_CONNECTOR is not set
375CONFIG_MTD=y
376# CONFIG_MTD_DEBUG is not set
377# CONFIG_MTD_CONCAT is not set
378CONFIG_MTD_PARTITIONS=y
379# CONFIG_MTD_REDBOOT_PARTS is not set
380CONFIG_MTD_CMDLINE_PARTS=y
381# CONFIG_MTD_AR7_PARTS is not set
382
383#
384# User Modules And Translation Layers
385#
386CONFIG_MTD_CHAR=y
387CONFIG_MTD_BLKDEVS=y
388CONFIG_MTD_BLOCK=y
389# CONFIG_FTL is not set
390# CONFIG_NFTL is not set
391# CONFIG_INFTL is not set
392# CONFIG_RFD_FTL is not set
393# CONFIG_SSFDC is not set
394# CONFIG_MTD_OOPS is not set
395
396#
397# RAM/ROM/Flash chip drivers
398#
399CONFIG_MTD_CFI=y
400# CONFIG_MTD_JEDECPROBE is not set
401CONFIG_MTD_GEN_PROBE=y
402# CONFIG_MTD_CFI_ADV_OPTIONS is not set
403CONFIG_MTD_MAP_BANK_WIDTH_1=y
404CONFIG_MTD_MAP_BANK_WIDTH_2=y
405CONFIG_MTD_MAP_BANK_WIDTH_4=y
406# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
407# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
408# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
409CONFIG_MTD_CFI_I1=y
410CONFIG_MTD_CFI_I2=y
411# CONFIG_MTD_CFI_I4 is not set
412# CONFIG_MTD_CFI_I8 is not set
413# CONFIG_MTD_CFI_INTELEXT is not set
414CONFIG_MTD_CFI_AMDSTD=y
415# CONFIG_MTD_CFI_STAA is not set
416CONFIG_MTD_CFI_UTIL=y
417# CONFIG_MTD_RAM is not set
418# CONFIG_MTD_ROM is not set
419# CONFIG_MTD_ABSENT is not set
420
421#
422# Mapping drivers for chip access
423#
424# CONFIG_MTD_COMPLEX_MAPPINGS is not set
425CONFIG_MTD_PHYSMAP=y
426CONFIG_MTD_PHYSMAP_START=0x80000000
427CONFIG_MTD_PHYSMAP_LEN=0x0
428CONFIG_MTD_PHYSMAP_BANKWIDTH=2
429# CONFIG_MTD_PLATRAM is not set
430
431#
432# Self-contained MTD device drivers
433#
434CONFIG_MTD_DATAFLASH=y
435# CONFIG_MTD_DATAFLASH_WRITE_VERIFY is not set
436# CONFIG_MTD_DATAFLASH_OTP is not set
437# CONFIG_MTD_M25P80 is not set
438# CONFIG_MTD_SLRAM is not set
439# CONFIG_MTD_PHRAM is not set
440# CONFIG_MTD_MTDRAM is not set
441# CONFIG_MTD_BLOCK2MTD is not set
442
443#
444# Disk-On-Chip Device Drivers
445#
446# CONFIG_MTD_DOC2000 is not set
447# CONFIG_MTD_DOC2001 is not set
448# CONFIG_MTD_DOC2001PLUS is not set
449# CONFIG_MTD_NAND is not set
450# CONFIG_MTD_ONENAND is not set
451
452#
453# UBI - Unsorted block images
454#
455# CONFIG_MTD_UBI is not set
456# CONFIG_PARPORT is not set
457CONFIG_BLK_DEV=y
458# CONFIG_BLK_DEV_COW_COMMON is not set
459# CONFIG_BLK_DEV_LOOP is not set
460# CONFIG_BLK_DEV_NBD is not set
461# CONFIG_BLK_DEV_UB is not set
462CONFIG_BLK_DEV_RAM=m
463CONFIG_BLK_DEV_RAM_COUNT=16
464CONFIG_BLK_DEV_RAM_SIZE=4096
465# CONFIG_BLK_DEV_XIP is not set
466# CONFIG_CDROM_PKTCDVD is not set
467# CONFIG_ATA_OVER_ETH is not set
468CONFIG_MISC_DEVICES=y
469# CONFIG_ATMEL_PWM is not set
470CONFIG_ATMEL_TCLIB=y
471CONFIG_ATMEL_TCB_CLKSRC=y
472CONFIG_ATMEL_TCB_CLKSRC_BLOCK=0
473# CONFIG_EEPROM_93CX6 is not set
474# CONFIG_ATMEL_SSC is not set
475# CONFIG_ENCLOSURE_SERVICES is not set
476
477#
478# SCSI device support
479#
480# CONFIG_RAID_ATTRS is not set
481CONFIG_SCSI=m
482CONFIG_SCSI_DMA=y
483# CONFIG_SCSI_TGT is not set
484# CONFIG_SCSI_NETLINK is not set
485CONFIG_SCSI_PROC_FS=y
486
487#
488# SCSI support type (disk, tape, CD-ROM)
489#
490CONFIG_BLK_DEV_SD=m
491# CONFIG_CHR_DEV_ST is not set
492# CONFIG_CHR_DEV_OSST is not set
493# CONFIG_BLK_DEV_SR is not set
494# CONFIG_CHR_DEV_SG is not set
495# CONFIG_CHR_DEV_SCH is not set
496
497#
498# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
499#
500# CONFIG_SCSI_MULTI_LUN is not set
501# CONFIG_SCSI_CONSTANTS is not set
502# CONFIG_SCSI_LOGGING is not set
503# CONFIG_SCSI_SCAN_ASYNC is not set
504CONFIG_SCSI_WAIT_SCAN=m
505
506#
507# SCSI Transports
508#
509# CONFIG_SCSI_SPI_ATTRS is not set
510# CONFIG_SCSI_FC_ATTRS is not set
511# CONFIG_SCSI_ISCSI_ATTRS is not set
512# CONFIG_SCSI_SAS_LIBSAS is not set
513# CONFIG_SCSI_SRP_ATTRS is not set
514CONFIG_SCSI_LOWLEVEL=y
515# CONFIG_ISCSI_TCP is not set
516# CONFIG_SCSI_DEBUG is not set
517# CONFIG_SCSI_DH is not set
518# CONFIG_ATA is not set
519# CONFIG_MD is not set
520CONFIG_NETDEVICES=y
521# CONFIG_DUMMY is not set
522# CONFIG_BONDING is not set
523# CONFIG_MACVLAN is not set
524# CONFIG_EQUALIZER is not set
525# CONFIG_TUN is not set
526# CONFIG_VETH is not set
527CONFIG_PHYLIB=y
528
529#
530# MII PHY device drivers
531#
532# CONFIG_MARVELL_PHY is not set
533# CONFIG_DAVICOM_PHY is not set
534# CONFIG_QSEMI_PHY is not set
535# CONFIG_LXT_PHY is not set
536# CONFIG_CICADA_PHY is not set
537# CONFIG_VITESSE_PHY is not set
538# CONFIG_SMSC_PHY is not set
539# CONFIG_BROADCOM_PHY is not set
540# CONFIG_ICPLUS_PHY is not set
541# CONFIG_REALTEK_PHY is not set
542# CONFIG_FIXED_PHY is not set
543# CONFIG_MDIO_BITBANG is not set
544CONFIG_NET_ETHERNET=y
545# CONFIG_MII is not set
546CONFIG_MACB=y
547# CONFIG_ENC28J60 is not set
548# CONFIG_IBM_NEW_EMAC_ZMII is not set
549# CONFIG_IBM_NEW_EMAC_RGMII is not set
550# CONFIG_IBM_NEW_EMAC_TAH is not set
551# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
552# CONFIG_IBM_NEW_EMAC_NO_FLOW_CTRL is not set
553# CONFIG_IBM_NEW_EMAC_MAL_CLR_ICINTSTAT is not set
554# CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set
555# CONFIG_B44 is not set
556# CONFIG_NETDEV_1000 is not set
557# CONFIG_NETDEV_10000 is not set
558
559#
560# Wireless LAN
561#
562# CONFIG_WLAN_PRE80211 is not set
563# CONFIG_WLAN_80211 is not set
564# CONFIG_IWLWIFI_LEDS is not set
565
566#
567# USB Network Adapters
568#
569# CONFIG_USB_CATC is not set
570# CONFIG_USB_KAWETH is not set
571# CONFIG_USB_PEGASUS is not set
572# CONFIG_USB_RTL8150 is not set
573# CONFIG_USB_USBNET is not set
574# CONFIG_WAN is not set
575# CONFIG_PPP is not set
576# CONFIG_SLIP is not set
577# CONFIG_NETCONSOLE is not set
578# CONFIG_NETPOLL is not set
579# CONFIG_NET_POLL_CONTROLLER is not set
580# CONFIG_ISDN is not set
581# CONFIG_PHONE is not set
582
583#
584# Input device support
585#
586CONFIG_INPUT=y
587CONFIG_INPUT_FF_MEMLESS=m
588# CONFIG_INPUT_POLLDEV is not set
589
590#
591# Userland interfaces
592#
593CONFIG_INPUT_MOUSEDEV=y
594CONFIG_INPUT_MOUSEDEV_PSAUX=y
595CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
596CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
597# CONFIG_INPUT_JOYDEV is not set
598CONFIG_INPUT_EVDEV=m
599# CONFIG_INPUT_EVBUG is not set
600
601#
602# Input Device Drivers
603#
604CONFIG_INPUT_KEYBOARD=y
605CONFIG_KEYBOARD_ATKBD=y
606# CONFIG_KEYBOARD_SUNKBD is not set
607# CONFIG_KEYBOARD_LKKBD is not set
608# CONFIG_KEYBOARD_XTKBD is not set
609# CONFIG_KEYBOARD_NEWTON is not set
610# CONFIG_KEYBOARD_STOWAWAY is not set
611# CONFIG_KEYBOARD_GPIO is not set
612CONFIG_INPUT_MOUSE=y
613CONFIG_MOUSE_PS2=y
614CONFIG_MOUSE_PS2_ALPS=y
615CONFIG_MOUSE_PS2_LOGIPS2PP=y
616CONFIG_MOUSE_PS2_SYNAPTICS=y
617CONFIG_MOUSE_PS2_LIFEBOOK=y
618CONFIG_MOUSE_PS2_TRACKPOINT=y
619# CONFIG_MOUSE_PS2_TOUCHKIT is not set
620# CONFIG_MOUSE_SERIAL is not set
621# CONFIG_MOUSE_APPLETOUCH is not set
622# CONFIG_MOUSE_BCM5974 is not set
623# CONFIG_MOUSE_VSXXXAA is not set
624# CONFIG_MOUSE_GPIO is not set
625# CONFIG_INPUT_JOYSTICK is not set
626# CONFIG_INPUT_TABLET is not set
627CONFIG_INPUT_TOUCHSCREEN=y
628# CONFIG_TOUCHSCREEN_ADS7846 is not set
629# CONFIG_TOUCHSCREEN_FUJITSU is not set
630# CONFIG_TOUCHSCREEN_GUNZE is not set
631# CONFIG_TOUCHSCREEN_ELO is not set
632# CONFIG_TOUCHSCREEN_MTOUCH is not set
633# CONFIG_TOUCHSCREEN_INEXIO is not set
634# CONFIG_TOUCHSCREEN_MK712 is not set
635# CONFIG_TOUCHSCREEN_PENMOUNT is not set
636# CONFIG_TOUCHSCREEN_TOUCHRIGHT is not set
637# CONFIG_TOUCHSCREEN_TOUCHWIN is not set
638# CONFIG_TOUCHSCREEN_USB_COMPOSITE is not set
639# CONFIG_TOUCHSCREEN_TOUCHIT213 is not set
640# CONFIG_INPUT_MISC is not set
641
642#
643# Hardware I/O ports
644#
645CONFIG_SERIO=y
646CONFIG_SERIO_I8042=y
647CONFIG_SERIO_SERPORT=y
648# CONFIG_SERIO_AT32PSIF is not set
649CONFIG_SERIO_LIBPS2=y
650# CONFIG_SERIO_RAW is not set
651# CONFIG_GAMEPORT is not set
652
653#
654# Character devices
655#
656CONFIG_VT=y
657CONFIG_CONSOLE_TRANSLATIONS=y
658CONFIG_VT_CONSOLE=y
659CONFIG_HW_CONSOLE=y
660# CONFIG_VT_HW_CONSOLE_BINDING is not set
661CONFIG_DEVKMEM=y
662# CONFIG_SERIAL_NONSTANDARD is not set
663
664#
665# Serial drivers
666#
667# CONFIG_SERIAL_8250 is not set
668
669#
670# Non-8250 serial port support
671#
672CONFIG_SERIAL_ATMEL=y
673CONFIG_SERIAL_ATMEL_CONSOLE=y
674CONFIG_SERIAL_ATMEL_PDC=y
675# CONFIG_SERIAL_ATMEL_TTYAT is not set
676CONFIG_SERIAL_CORE=y
677CONFIG_SERIAL_CORE_CONSOLE=y
678CONFIG_UNIX98_PTYS=y
679# CONFIG_LEGACY_PTYS is not set
680# CONFIG_IPMI_HANDLER is not set
681# CONFIG_HW_RANDOM is not set
682# CONFIG_R3964 is not set
683# CONFIG_RAW_DRIVER is not set
684# CONFIG_TCG_TPM is not set
685CONFIG_I2C=m
686CONFIG_I2C_BOARDINFO=y
687CONFIG_I2C_CHARDEV=m
688CONFIG_I2C_HELPER_AUTO=y
689CONFIG_I2C_ALGOBIT=m
690
691#
692# I2C Hardware Bus support
693#
694
695#
696# I2C system bus drivers (mostly embedded / system-on-chip)
697#
698CONFIG_I2C_GPIO=m
699# CONFIG_I2C_OCORES is not set
700# CONFIG_I2C_SIMTEC is not set
701
702#
703# External I2C/SMBus adapter drivers
704#
705# CONFIG_I2C_PARPORT_LIGHT is not set
706# CONFIG_I2C_TAOS_EVM is not set
707# CONFIG_I2C_TINY_USB is not set
708
709#
710# Other I2C/SMBus bus drivers
711#
712# CONFIG_I2C_PCA_PLATFORM is not set
713# CONFIG_I2C_STUB is not set
714
715#
716# Miscellaneous I2C Chip support
717#
718# CONFIG_DS1682 is not set
719# CONFIG_AT24 is not set
720# CONFIG_SENSORS_EEPROM is not set
721# CONFIG_SENSORS_PCF8574 is not set
722# CONFIG_PCF8575 is not set
723# CONFIG_SENSORS_PCA9539 is not set
724# CONFIG_SENSORS_PCF8591 is not set
725# CONFIG_TPS65010 is not set
726# CONFIG_SENSORS_MAX6875 is not set
727# CONFIG_SENSORS_TSL2550 is not set
728# CONFIG_I2C_DEBUG_CORE is not set
729# CONFIG_I2C_DEBUG_ALGO is not set
730# CONFIG_I2C_DEBUG_BUS is not set
731# CONFIG_I2C_DEBUG_CHIP is not set
732CONFIG_SPI=y
733# CONFIG_SPI_DEBUG is not set
734CONFIG_SPI_MASTER=y
735
736#
737# SPI Master Controller Drivers
738#
739CONFIG_SPI_ATMEL=y
740# CONFIG_SPI_BITBANG is not set
741
742#
743# SPI Protocol Masters
744#
745# CONFIG_SPI_AT25 is not set
746CONFIG_SPI_SPIDEV=m
747# CONFIG_SPI_TLE62X0 is not set
748CONFIG_ARCH_REQUIRE_GPIOLIB=y
749CONFIG_GPIOLIB=y
750# CONFIG_DEBUG_GPIO is not set
751# CONFIG_GPIO_SYSFS is not set
752
753#
754# I2C GPIO expanders:
755#
756# CONFIG_GPIO_MAX732X is not set
757# CONFIG_GPIO_PCA953X is not set
758# CONFIG_GPIO_PCF857X is not set
759
760#
761# PCI GPIO expanders:
762#
763
764#
765# SPI GPIO expanders:
766#
767# CONFIG_GPIO_MAX7301 is not set
768# CONFIG_GPIO_MCP23S08 is not set
769# CONFIG_W1 is not set
770# CONFIG_POWER_SUPPLY is not set
771# CONFIG_HWMON is not set
772# CONFIG_THERMAL is not set
773# CONFIG_THERMAL_HWMON is not set
774CONFIG_WATCHDOG=y
775# CONFIG_WATCHDOG_NOWAYOUT is not set
776
777#
778# Watchdog Device Drivers
779#
780# CONFIG_SOFT_WATCHDOG is not set
781CONFIG_AT32AP700X_WDT=y
782
783#
784# USB-based Watchdog Cards
785#
786# CONFIG_USBPCWATCHDOG is not set
787
788#
789# Sonics Silicon Backplane
790#
791CONFIG_SSB_POSSIBLE=y
792# CONFIG_SSB is not set
793
794#
795# Multifunction device drivers
796#
797# CONFIG_MFD_CORE is not set
798# CONFIG_MFD_SM501 is not set
799# CONFIG_HTC_PASIC3 is not set
800# CONFIG_MFD_TMIO is not set
801# CONFIG_MFD_WM8400 is not set
802# CONFIG_MFD_WM8350_I2C is not set
803
804#
805# Multimedia devices
806#
807
808#
809# Multimedia core support
810#
811# CONFIG_VIDEO_DEV is not set
812# CONFIG_DVB_CORE is not set
813# CONFIG_VIDEO_MEDIA is not set
814
815#
816# Multimedia drivers
817#
818# CONFIG_DAB is not set
819
820#
821# Graphics support
822#
823# CONFIG_VGASTATE is not set
824# CONFIG_VIDEO_OUTPUT_CONTROL is not set
825CONFIG_FB=y
826# CONFIG_FIRMWARE_EDID is not set
827# CONFIG_FB_DDC is not set
828# CONFIG_FB_BOOT_VESA_SUPPORT is not set
829CONFIG_FB_CFB_FILLRECT=y
830CONFIG_FB_CFB_COPYAREA=y
831CONFIG_FB_CFB_IMAGEBLIT=y
832# CONFIG_FB_CFB_REV_PIXELS_IN_BYTE is not set
833# CONFIG_FB_SYS_FILLRECT is not set
834# CONFIG_FB_SYS_COPYAREA is not set
835# CONFIG_FB_SYS_IMAGEBLIT is not set
836# CONFIG_FB_FOREIGN_ENDIAN is not set
837# CONFIG_FB_SYS_FOPS is not set
838# CONFIG_FB_SVGALIB is not set
839# CONFIG_FB_MACMODES is not set
840# CONFIG_FB_BACKLIGHT is not set
841# CONFIG_FB_MODE_HELPERS is not set
842# CONFIG_FB_TILEBLITTING is not set
843
844#
845# Frame buffer hardware drivers
846#
847# CONFIG_FB_S1D13XXX is not set
848CONFIG_FB_ATMEL=y
849# CONFIG_FB_VIRTUAL is not set
850# CONFIG_FB_METRONOME is not set
851# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
852
853#
854# Display device support
855#
856# CONFIG_DISPLAY_SUPPORT is not set
857
858#
859# Console display driver support
860#
861CONFIG_DUMMY_CONSOLE=y
862CONFIG_FRAMEBUFFER_CONSOLE=y
863# CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY is not set
864# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set
865# CONFIG_FONTS is not set
866CONFIG_FONT_8x8=y
867CONFIG_FONT_8x16=y
868# CONFIG_LOGO is not set
869CONFIG_SOUND=m
870CONFIG_SOUND_OSS_CORE=y
871CONFIG_SND=m
872CONFIG_SND_TIMER=m
873CONFIG_SND_PCM=m
874CONFIG_SND_SEQUENCER=m
875# CONFIG_SND_SEQ_DUMMY is not set
876CONFIG_SND_OSSEMUL=y
877CONFIG_SND_MIXER_OSS=m
878CONFIG_SND_PCM_OSS=m
879CONFIG_SND_PCM_OSS_PLUGINS=y
880CONFIG_SND_SEQUENCER_OSS=y
881# CONFIG_SND_DYNAMIC_MINORS is not set
882# CONFIG_SND_SUPPORT_OLD_API is not set
883CONFIG_SND_VERBOSE_PROCFS=y
884# CONFIG_SND_VERBOSE_PRINTK is not set
885# CONFIG_SND_DEBUG is not set
886CONFIG_SND_DRIVERS=y
887# CONFIG_SND_DUMMY is not set
888# CONFIG_SND_VIRMIDI is not set
889# CONFIG_SND_MTPAV is not set
890# CONFIG_SND_SERIAL_U16550 is not set
891# CONFIG_SND_MPU401 is not set
892CONFIG_SND_SPI=y
893CONFIG_SND_USB=y
894# CONFIG_SND_USB_AUDIO is not set
895# CONFIG_SND_USB_CAIAQ is not set
896# CONFIG_SND_SOC is not set
897# CONFIG_SOUND_PRIME is not set
898CONFIG_HID_SUPPORT=y
899CONFIG_HID=y
900# CONFIG_HID_DEBUG is not set
901# CONFIG_HIDRAW is not set
902
903#
904# USB Input Devices
905#
906CONFIG_USB_HID=m
907# CONFIG_HID_PID is not set
908# CONFIG_USB_HIDDEV is not set
909
910#
911# USB HID Boot Protocol drivers
912#
913# CONFIG_USB_KBD is not set
914# CONFIG_USB_MOUSE is not set
915
916#
917# Special HID drivers
918#
919CONFIG_HID_COMPAT=y
920CONFIG_HID_A4TECH=m
921CONFIG_HID_APPLE=m
922CONFIG_HID_BELKIN=m
923CONFIG_HID_BRIGHT=m
924CONFIG_HID_CHERRY=m
925CONFIG_HID_CHICONY=m
926CONFIG_HID_CYPRESS=m
927CONFIG_HID_DELL=m
928CONFIG_HID_EZKEY=m
929CONFIG_HID_GYRATION=m
930CONFIG_HID_LOGITECH=m
931# CONFIG_LOGITECH_FF is not set
932# CONFIG_LOGIRUMBLEPAD2_FF is not set
933CONFIG_HID_MICROSOFT=m
934CONFIG_HID_MONTEREY=m
935CONFIG_HID_PANTHERLORD=m
936# CONFIG_PANTHERLORD_FF is not set
937CONFIG_HID_PETALYNX=m
938CONFIG_HID_SAMSUNG=m
939CONFIG_HID_SONY=m
940CONFIG_HID_SUNPLUS=m
941CONFIG_THRUSTMASTER_FF=m
942CONFIG_ZEROPLUS_FF=m
943CONFIG_USB_SUPPORT=y
944CONFIG_USB_ARCH_HAS_HCD=y
945# CONFIG_USB_ARCH_HAS_OHCI is not set
946# CONFIG_USB_ARCH_HAS_EHCI is not set
947CONFIG_USB=m
948# CONFIG_USB_DEBUG is not set
949# CONFIG_USB_ANNOUNCE_NEW_DEVICES is not set
950
951#
952# Miscellaneous USB options
953#
954CONFIG_USB_DEVICEFS=y
955# CONFIG_USB_DEVICE_CLASS is not set
956# CONFIG_USB_DYNAMIC_MINORS is not set
957# CONFIG_USB_OTG is not set
958# CONFIG_USB_OTG_WHITELIST is not set
959# CONFIG_USB_OTG_BLACKLIST_HUB is not set
960CONFIG_USB_MON=y
961
962#
963# USB Host Controller Drivers
964#
965# CONFIG_USB_C67X00_HCD is not set
966CONFIG_USB_ISP116X_HCD=m
967# CONFIG_USB_ISP1760_HCD is not set
968# CONFIG_USB_SL811_HCD is not set
969# CONFIG_USB_R8A66597_HCD is not set
970# CONFIG_USB_MUSB_HDRC is not set
971# CONFIG_USB_GADGET_MUSB_HDRC is not set
972
973#
974# USB Device Class drivers
975#
976# CONFIG_USB_ACM is not set
977# CONFIG_USB_PRINTER is not set
978# CONFIG_USB_WDM is not set
979# CONFIG_USB_TMC is not set
980
981#
982# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
983#
984
985#
986# may also be needed; see USB_STORAGE Help for more information
987#
988CONFIG_USB_STORAGE=m
989# CONFIG_USB_STORAGE_DEBUG is not set
990# CONFIG_USB_STORAGE_DATAFAB is not set
991# CONFIG_USB_STORAGE_FREECOM is not set
992# CONFIG_USB_STORAGE_ISD200 is not set
993# CONFIG_USB_STORAGE_DPCM is not set
994# CONFIG_USB_STORAGE_USBAT is not set
995# CONFIG_USB_STORAGE_SDDR09 is not set
996# CONFIG_USB_STORAGE_SDDR55 is not set
997# CONFIG_USB_STORAGE_JUMPSHOT is not set
998# CONFIG_USB_STORAGE_ALAUDA is not set
999# CONFIG_USB_STORAGE_ONETOUCH is not set
1000# CONFIG_USB_STORAGE_KARMA is not set
1001# CONFIG_USB_STORAGE_CYPRESS_ATACB is not set
1002# CONFIG_USB_LIBUSUAL is not set
1003
1004#
1005# USB Imaging devices
1006#
1007# CONFIG_USB_MDC800 is not set
1008# CONFIG_USB_MICROTEK is not set
1009
1010#
1011# USB port drivers
1012#
1013# CONFIG_USB_SERIAL is not set
1014
1015#
1016# USB Miscellaneous drivers
1017#
1018# CONFIG_USB_EMI62 is not set
1019# CONFIG_USB_EMI26 is not set
1020# CONFIG_USB_ADUTUX is not set
1021# CONFIG_USB_SEVSEG is not set
1022# CONFIG_USB_RIO500 is not set
1023# CONFIG_USB_LEGOTOWER is not set
1024# CONFIG_USB_LCD is not set
1025# CONFIG_USB_BERRY_CHARGE is not set
1026# CONFIG_USB_LED is not set
1027# CONFIG_USB_CYPRESS_CY7C63 is not set
1028# CONFIG_USB_CYTHERM is not set
1029# CONFIG_USB_PHIDGET is not set
1030# CONFIG_USB_IDMOUSE is not set
1031# CONFIG_USB_FTDI_ELAN is not set
1032# CONFIG_USB_APPLEDISPLAY is not set
1033# CONFIG_USB_LD is not set
1034# CONFIG_USB_TRANCEVIBRATOR is not set
1035# CONFIG_USB_IOWARRIOR is not set
1036# CONFIG_USB_TEST is not set
1037# CONFIG_USB_ISIGHTFW is not set
1038# CONFIG_USB_VST is not set
1039CONFIG_USB_GADGET=y
1040# CONFIG_USB_GADGET_DEBUG is not set
1041# CONFIG_USB_GADGET_DEBUG_FILES is not set
1042CONFIG_USB_GADGET_VBUS_DRAW=2
1043CONFIG_USB_GADGET_SELECTED=y
1044# CONFIG_USB_GADGET_AT91 is not set
1045CONFIG_USB_GADGET_ATMEL_USBA=y
1046CONFIG_USB_ATMEL_USBA=y
1047# CONFIG_USB_GADGET_FSL_USB2 is not set
1048# CONFIG_USB_GADGET_LH7A40X is not set
1049# CONFIG_USB_GADGET_OMAP is not set
1050# CONFIG_USB_GADGET_PXA25X is not set
1051# CONFIG_USB_GADGET_PXA27X is not set
1052# CONFIG_USB_GADGET_S3C2410 is not set
1053# CONFIG_USB_GADGET_M66592 is not set
1054# CONFIG_USB_GADGET_AMD5536UDC is not set
1055# CONFIG_USB_GADGET_FSL_QE is not set
1056# CONFIG_USB_GADGET_NET2280 is not set
1057# CONFIG_USB_GADGET_GOKU is not set
1058# CONFIG_USB_GADGET_DUMMY_HCD is not set
1059CONFIG_USB_GADGET_DUALSPEED=y
1060CONFIG_USB_ZERO=m
1061CONFIG_USB_ETH=m
1062CONFIG_USB_ETH_RNDIS=y
1063CONFIG_USB_GADGETFS=m
1064CONFIG_USB_FILE_STORAGE=m
1065# CONFIG_USB_FILE_STORAGE_TEST is not set
1066CONFIG_USB_G_SERIAL=m
1067# CONFIG_USB_MIDI_GADGET is not set
1068# CONFIG_USB_G_PRINTER is not set
1069# CONFIG_USB_CDC_COMPOSITE is not set
1070CONFIG_MMC=m
1071# CONFIG_MMC_DEBUG is not set
1072# CONFIG_MMC_UNSAFE_RESUME is not set
1073
1074#
1075# MMC/SD/SDIO Card Drivers
1076#
1077CONFIG_MMC_BLOCK=m
1078CONFIG_MMC_BLOCK_BOUNCE=y
1079# CONFIG_SDIO_UART is not set
1080# CONFIG_MMC_TEST is not set
1081
1082#
1083# MMC/SD/SDIO Host Controller Drivers
1084#
1085# CONFIG_MMC_SDHCI is not set
1086CONFIG_MMC_ATMELMCI=m
1087# CONFIG_MMC_SPI is not set
1088# CONFIG_MEMSTICK is not set
1089# CONFIG_NEW_LEDS is not set
1090# CONFIG_ACCESSIBILITY is not set
1091CONFIG_RTC_LIB=y
1092CONFIG_RTC_CLASS=y
1093CONFIG_RTC_HCTOSYS=y
1094CONFIG_RTC_HCTOSYS_DEVICE="rtc0"
1095# CONFIG_RTC_DEBUG is not set
1096
1097#
1098# RTC interfaces
1099#
1100CONFIG_RTC_INTF_SYSFS=y
1101CONFIG_RTC_INTF_PROC=y
1102CONFIG_RTC_INTF_DEV=y
1103# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set
1104# CONFIG_RTC_DRV_TEST is not set
1105
1106#
1107# I2C RTC drivers
1108#
1109# CONFIG_RTC_DRV_DS1307 is not set
1110# CONFIG_RTC_DRV_DS1374 is not set
1111# CONFIG_RTC_DRV_DS1672 is not set
1112# CONFIG_RTC_DRV_MAX6900 is not set
1113# CONFIG_RTC_DRV_RS5C372 is not set
1114# CONFIG_RTC_DRV_ISL1208 is not set
1115# CONFIG_RTC_DRV_X1205 is not set
1116# CONFIG_RTC_DRV_PCF8563 is not set
1117# CONFIG_RTC_DRV_PCF8583 is not set
1118# CONFIG_RTC_DRV_M41T80 is not set
1119# CONFIG_RTC_DRV_S35390A is not set
1120# CONFIG_RTC_DRV_FM3130 is not set
1121
1122#
1123# SPI RTC drivers
1124#
1125# CONFIG_RTC_DRV_M41T94 is not set
1126# CONFIG_RTC_DRV_DS1305 is not set
1127# CONFIG_RTC_DRV_MAX6902 is not set
1128# CONFIG_RTC_DRV_R9701 is not set
1129# CONFIG_RTC_DRV_RS5C348 is not set
1130# CONFIG_RTC_DRV_DS3234 is not set
1131
1132#
1133# Platform RTC drivers
1134#
1135# CONFIG_RTC_DRV_DS1286 is not set
1136# CONFIG_RTC_DRV_DS1511 is not set
1137# CONFIG_RTC_DRV_DS1553 is not set
1138# CONFIG_RTC_DRV_DS1742 is not set
1139# CONFIG_RTC_DRV_STK17TA8 is not set
1140# CONFIG_RTC_DRV_M48T86 is not set
1141# CONFIG_RTC_DRV_M48T35 is not set
1142# CONFIG_RTC_DRV_M48T59 is not set
1143# CONFIG_RTC_DRV_BQ4802 is not set
1144# CONFIG_RTC_DRV_V3020 is not set
1145
1146#
1147# on-CPU RTC drivers
1148#
1149CONFIG_RTC_DRV_AT32AP700X=y
1150# CONFIG_DMADEVICES is not set
1151# CONFIG_UIO is not set
1152# CONFIG_STAGING is not set
1153
1154#
1155# File systems
1156#
1157CONFIG_EXT2_FS=m
1158# CONFIG_EXT2_FS_XATTR is not set
1159# CONFIG_EXT2_FS_XIP is not set
1160# CONFIG_EXT3_FS is not set
1161# CONFIG_EXT4_FS is not set
1162# CONFIG_REISERFS_FS is not set
1163# CONFIG_JFS_FS is not set
1164# CONFIG_FS_POSIX_ACL is not set
1165CONFIG_FILE_LOCKING=y
1166# CONFIG_XFS_FS is not set
1167# CONFIG_OCFS2_FS is not set
1168# CONFIG_DNOTIFY is not set
1169CONFIG_INOTIFY=y
1170CONFIG_INOTIFY_USER=y
1171# CONFIG_QUOTA is not set
1172# CONFIG_AUTOFS_FS is not set
1173# CONFIG_AUTOFS4_FS is not set
1174# CONFIG_FUSE_FS is not set
1175
1176#
1177# CD-ROM/DVD Filesystems
1178#
1179# CONFIG_ISO9660_FS is not set
1180# CONFIG_UDF_FS is not set
1181
1182#
1183# DOS/FAT/NT Filesystems
1184#
1185CONFIG_FAT_FS=y
1186CONFIG_MSDOS_FS=y
1187CONFIG_VFAT_FS=m
1188CONFIG_FAT_DEFAULT_CODEPAGE=850
1189CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
1190# CONFIG_NTFS_FS is not set
1191
1192#
1193# Pseudo filesystems
1194#
1195CONFIG_PROC_FS=y
1196# CONFIG_PROC_KCORE is not set
1197CONFIG_PROC_SYSCTL=y
1198CONFIG_PROC_PAGE_MONITOR=y
1199CONFIG_SYSFS=y
1200CONFIG_TMPFS=y
1201# CONFIG_TMPFS_POSIX_ACL is not set
1202# CONFIG_HUGETLB_PAGE is not set
1203CONFIG_CONFIGFS_FS=y
1204
1205#
1206# Miscellaneous filesystems
1207#
1208# CONFIG_ADFS_FS is not set
1209# CONFIG_AFFS_FS is not set
1210# CONFIG_HFS_FS is not set
1211# CONFIG_HFSPLUS_FS is not set
1212# CONFIG_BEFS_FS is not set
1213# CONFIG_BFS_FS is not set
1214# CONFIG_EFS_FS is not set
1215CONFIG_JFFS2_FS=y
1216CONFIG_JFFS2_FS_DEBUG=0
1217CONFIG_JFFS2_FS_WRITEBUFFER=y
1218# CONFIG_JFFS2_FS_WBUF_VERIFY is not set
1219# CONFIG_JFFS2_SUMMARY is not set
1220# CONFIG_JFFS2_FS_XATTR is not set
1221# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set
1222CONFIG_JFFS2_ZLIB=y
1223# CONFIG_JFFS2_LZO is not set
1224CONFIG_JFFS2_RTIME=y
1225# CONFIG_JFFS2_RUBIN is not set
1226# CONFIG_CRAMFS is not set
1227# CONFIG_VXFS_FS is not set
1228# CONFIG_MINIX_FS is not set
1229# CONFIG_OMFS_FS is not set
1230# CONFIG_HPFS_FS is not set
1231# CONFIG_QNX4FS_FS is not set
1232# CONFIG_ROMFS_FS is not set
1233# CONFIG_SYSV_FS is not set
1234# CONFIG_UFS_FS is not set
1235CONFIG_NETWORK_FILESYSTEMS=y
1236CONFIG_NFS_FS=y
1237CONFIG_NFS_V3=y
1238# CONFIG_NFS_V3_ACL is not set
1239# CONFIG_NFS_V4 is not set
1240CONFIG_ROOT_NFS=y
1241# CONFIG_NFSD is not set
1242CONFIG_LOCKD=y
1243CONFIG_LOCKD_V4=y
1244CONFIG_NFS_COMMON=y
1245CONFIG_SUNRPC=y
1246# CONFIG_SUNRPC_REGISTER_V4 is not set
1247# CONFIG_RPCSEC_GSS_KRB5 is not set
1248# CONFIG_RPCSEC_GSS_SPKM3 is not set
1249# CONFIG_SMB_FS is not set
1250# CONFIG_CIFS is not set
1251# CONFIG_NCP_FS is not set
1252# CONFIG_CODA_FS is not set
1253# CONFIG_AFS_FS is not set
1254
1255#
1256# Partition Types
1257#
1258# CONFIG_PARTITION_ADVANCED is not set
1259CONFIG_MSDOS_PARTITION=y
1260CONFIG_NLS=y
1261CONFIG_NLS_DEFAULT="iso8859-1"
1262CONFIG_NLS_CODEPAGE_437=m
1263# CONFIG_NLS_CODEPAGE_737 is not set
1264# CONFIG_NLS_CODEPAGE_775 is not set
1265CONFIG_NLS_CODEPAGE_850=m
1266# CONFIG_NLS_CODEPAGE_852 is not set
1267# CONFIG_NLS_CODEPAGE_855 is not set
1268# CONFIG_NLS_CODEPAGE_857 is not set
1269# CONFIG_NLS_CODEPAGE_860 is not set
1270# CONFIG_NLS_CODEPAGE_861 is not set
1271# CONFIG_NLS_CODEPAGE_862 is not set
1272# CONFIG_NLS_CODEPAGE_863 is not set
1273# CONFIG_NLS_CODEPAGE_864 is not set
1274# CONFIG_NLS_CODEPAGE_865 is not set
1275# CONFIG_NLS_CODEPAGE_866 is not set
1276# CONFIG_NLS_CODEPAGE_869 is not set
1277# CONFIG_NLS_CODEPAGE_936 is not set
1278# CONFIG_NLS_CODEPAGE_950 is not set
1279# CONFIG_NLS_CODEPAGE_932 is not set
1280# CONFIG_NLS_CODEPAGE_949 is not set
1281# CONFIG_NLS_CODEPAGE_874 is not set
1282# CONFIG_NLS_ISO8859_8 is not set
1283# CONFIG_NLS_CODEPAGE_1250 is not set
1284# CONFIG_NLS_CODEPAGE_1251 is not set
1285# CONFIG_NLS_ASCII is not set
1286CONFIG_NLS_ISO8859_1=m
1287# CONFIG_NLS_ISO8859_2 is not set
1288# CONFIG_NLS_ISO8859_3 is not set
1289# CONFIG_NLS_ISO8859_4 is not set
1290# CONFIG_NLS_ISO8859_5 is not set
1291# CONFIG_NLS_ISO8859_6 is not set
1292# CONFIG_NLS_ISO8859_7 is not set
1293# CONFIG_NLS_ISO8859_9 is not set
1294# CONFIG_NLS_ISO8859_13 is not set
1295# CONFIG_NLS_ISO8859_14 is not set
1296# CONFIG_NLS_ISO8859_15 is not set
1297# CONFIG_NLS_KOI8_R is not set
1298# CONFIG_NLS_KOI8_U is not set
1299CONFIG_NLS_UTF8=m
1300# CONFIG_DLM is not set
1301
1302#
1303# Kernel hacking
1304#
1305# CONFIG_PRINTK_TIME is not set
1306CONFIG_ENABLE_WARN_DEPRECATED=y
1307CONFIG_ENABLE_MUST_CHECK=y
1308CONFIG_FRAME_WARN=1024
1309CONFIG_MAGIC_SYSRQ=y
1310# CONFIG_UNUSED_SYMBOLS is not set
1311# CONFIG_DEBUG_FS is not set
1312# CONFIG_HEADERS_CHECK is not set
1313CONFIG_DEBUG_KERNEL=y
1314# CONFIG_DEBUG_SHIRQ is not set
1315CONFIG_DETECT_SOFTLOCKUP=y
1316# CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC is not set
1317CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE=0
1318CONFIG_SCHED_DEBUG=y
1319# CONFIG_SCHEDSTATS is not set
1320# CONFIG_TIMER_STATS is not set
1321# CONFIG_DEBUG_OBJECTS is not set
1322# CONFIG_SLUB_DEBUG_ON is not set
1323# CONFIG_SLUB_STATS is not set
1324# CONFIG_DEBUG_RT_MUTEXES is not set
1325# CONFIG_RT_MUTEX_TESTER is not set
1326# CONFIG_DEBUG_SPINLOCK is not set
1327# CONFIG_DEBUG_MUTEXES is not set
1328# CONFIG_DEBUG_LOCK_ALLOC is not set
1329# CONFIG_PROVE_LOCKING is not set
1330# CONFIG_LOCK_STAT is not set
1331# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
1332# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
1333# CONFIG_DEBUG_KOBJECT is not set
1334CONFIG_DEBUG_BUGVERBOSE=y
1335# CONFIG_DEBUG_INFO is not set
1336# CONFIG_DEBUG_VM is not set
1337# CONFIG_DEBUG_WRITECOUNT is not set
1338# CONFIG_DEBUG_MEMORY_INIT is not set
1339# CONFIG_DEBUG_LIST is not set
1340# CONFIG_DEBUG_SG is not set
1341CONFIG_FRAME_POINTER=y
1342# CONFIG_BOOT_PRINTK_DELAY is not set
1343# CONFIG_RCU_TORTURE_TEST is not set
1344# CONFIG_RCU_CPU_STALL_DETECTOR is not set
1345# CONFIG_KPROBES_SANITY_TEST is not set
1346# CONFIG_BACKTRACE_SELF_TEST is not set
1347# CONFIG_DEBUG_BLOCK_EXT_DEVT is not set
1348# CONFIG_LKDTM is not set
1349# CONFIG_FAULT_INJECTION is not set
1350# CONFIG_DYNAMIC_PRINTK_DEBUG is not set
1351# CONFIG_SAMPLES is not set
1352
1353#
1354# Security options
1355#
1356# CONFIG_KEYS is not set
1357# CONFIG_SECURITY is not set
1358# CONFIG_SECURITYFS is not set
1359# CONFIG_SECURITY_FILE_CAPABILITIES is not set
1360CONFIG_CRYPTO=y
1361
1362#
1363# Crypto core or helper
1364#
1365# CONFIG_CRYPTO_FIPS is not set
1366CONFIG_CRYPTO_ALGAPI=y
1367CONFIG_CRYPTO_AEAD=y
1368CONFIG_CRYPTO_BLKCIPHER=y
1369CONFIG_CRYPTO_HASH=y
1370CONFIG_CRYPTO_RNG=y
1371CONFIG_CRYPTO_MANAGER=y
1372# CONFIG_CRYPTO_GF128MUL is not set
1373# CONFIG_CRYPTO_NULL is not set
1374# CONFIG_CRYPTO_CRYPTD is not set
1375CONFIG_CRYPTO_AUTHENC=y
1376# CONFIG_CRYPTO_TEST is not set
1377
1378#
1379# Authenticated Encryption with Associated Data
1380#
1381# CONFIG_CRYPTO_CCM is not set
1382# CONFIG_CRYPTO_GCM is not set
1383# CONFIG_CRYPTO_SEQIV is not set
1384
1385#
1386# Block modes
1387#
1388CONFIG_CRYPTO_CBC=y
1389# CONFIG_CRYPTO_CTR is not set
1390# CONFIG_CRYPTO_CTS is not set
1391CONFIG_CRYPTO_ECB=m
1392# CONFIG_CRYPTO_LRW is not set
1393CONFIG_CRYPTO_PCBC=m
1394# CONFIG_CRYPTO_XTS is not set
1395
1396#
1397# Hash modes
1398#
1399CONFIG_CRYPTO_HMAC=y
1400# CONFIG_CRYPTO_XCBC is not set
1401
1402#
1403# Digest
1404#
1405# CONFIG_CRYPTO_CRC32C is not set
1406# CONFIG_CRYPTO_MD4 is not set
1407CONFIG_CRYPTO_MD5=y
1408# CONFIG_CRYPTO_MICHAEL_MIC is not set
1409# CONFIG_CRYPTO_RMD128 is not set
1410# CONFIG_CRYPTO_RMD160 is not set
1411# CONFIG_CRYPTO_RMD256 is not set
1412# CONFIG_CRYPTO_RMD320 is not set
1413CONFIG_CRYPTO_SHA1=y
1414# CONFIG_CRYPTO_SHA256 is not set
1415# CONFIG_CRYPTO_SHA512 is not set
1416# CONFIG_CRYPTO_TGR192 is not set
1417# CONFIG_CRYPTO_WP512 is not set
1418
1419#
1420# Ciphers
1421#
1422# CONFIG_CRYPTO_AES is not set
1423# CONFIG_CRYPTO_ANUBIS is not set
1424CONFIG_CRYPTO_ARC4=m
1425# CONFIG_CRYPTO_BLOWFISH is not set
1426# CONFIG_CRYPTO_CAMELLIA is not set
1427# CONFIG_CRYPTO_CAST5 is not set
1428# CONFIG_CRYPTO_CAST6 is not set
1429CONFIG_CRYPTO_DES=y
1430# CONFIG_CRYPTO_FCRYPT is not set
1431# CONFIG_CRYPTO_KHAZAD is not set
1432# CONFIG_CRYPTO_SALSA20 is not set
1433# CONFIG_CRYPTO_SEED is not set
1434# CONFIG_CRYPTO_SERPENT is not set
1435# CONFIG_CRYPTO_TEA is not set
1436# CONFIG_CRYPTO_TWOFISH is not set
1437
1438#
1439# Compression
1440#
1441CONFIG_CRYPTO_DEFLATE=y
1442# CONFIG_CRYPTO_LZO is not set
1443
1444#
1445# Random Number Generation
1446#
1447# CONFIG_CRYPTO_ANSI_CPRNG is not set
1448CONFIG_CRYPTO_HW=y
1449
1450#
1451# Library routines
1452#
1453CONFIG_BITREVERSE=y
1454CONFIG_CRC_CCITT=m
1455# CONFIG_CRC16 is not set
1456# CONFIG_CRC_T10DIF is not set
1457CONFIG_CRC_ITU_T=m
1458CONFIG_CRC32=y
1459CONFIG_CRC7=m
1460# CONFIG_LIBCRC32C is not set
1461CONFIG_ZLIB_INFLATE=y
1462CONFIG_ZLIB_DEFLATE=y
1463CONFIG_GENERIC_ALLOCATOR=y
1464CONFIG_PLIST=y
1465CONFIG_HAS_IOMEM=y
1466CONFIG_HAS_IOPORT=y
1467CONFIG_HAS_DMA=y
diff --git a/arch/avr32/include/asm/kdebug.h b/arch/avr32/include/asm/kdebug.h
index ca4f9542365a..f930ce286803 100644
--- a/arch/avr32/include/asm/kdebug.h
+++ b/arch/avr32/include/asm/kdebug.h
@@ -6,6 +6,7 @@ enum die_val {
6 DIE_BREAKPOINT, 6 DIE_BREAKPOINT,
7 DIE_SSTEP, 7 DIE_SSTEP,
8 DIE_NMI, 8 DIE_NMI,
9 DIE_OOPS,
9}; 10};
10 11
11#endif /* __ASM_AVR32_KDEBUG_H */ 12#endif /* __ASM_AVR32_KDEBUG_H */
diff --git a/arch/avr32/include/asm/syscalls.h b/arch/avr32/include/asm/syscalls.h
new file mode 100644
index 000000000000..483d666c27c0
--- /dev/null
+++ b/arch/avr32/include/asm/syscalls.h
@@ -0,0 +1,39 @@
1/*
2 * syscalls.h - Linux syscall interfaces (arch-specific)
3 *
4 * Copyright (c) 2008 Jaswinder Singh
5 *
6 * This file is released under the GPLv2.
7 * See the file COPYING for more details.
8 */
9
10#ifndef _ASM_AVR32_SYSCALLS_H
11#define _ASM_AVR32_SYSCALLS_H
12
13#include <linux/compiler.h>
14#include <linux/linkage.h>
15#include <linux/types.h>
16#include <linux/signal.h>
17
18/* kernel/process.c */
19asmlinkage int sys_fork(struct pt_regs *);
20asmlinkage int sys_clone(unsigned long, unsigned long,
21 unsigned long, unsigned long,
22 struct pt_regs *);
23asmlinkage int sys_vfork(struct pt_regs *);
24asmlinkage int sys_execve(char __user *, char __user *__user *,
25 char __user *__user *, struct pt_regs *);
26
27/* kernel/signal.c */
28asmlinkage int sys_sigaltstack(const stack_t __user *, stack_t __user *,
29 struct pt_regs *);
30asmlinkage int sys_rt_sigreturn(struct pt_regs *);
31
32/* kernel/sys_avr32.c */
33asmlinkage long sys_mmap2(unsigned long, unsigned long, unsigned long,
34 unsigned long, unsigned long, off_t);
35
36/* mm/cache.c */
37asmlinkage int sys_cacheflush(int, void __user *, size_t);
38
39#endif /* _ASM_AVR32_SYSCALLS_H */
diff --git a/arch/avr32/kernel/process.c b/arch/avr32/kernel/process.c
index 134d5302b6dd..43ae555ecb33 100644
--- a/arch/avr32/kernel/process.c
+++ b/arch/avr32/kernel/process.c
@@ -18,6 +18,7 @@
18 18
19#include <asm/sysreg.h> 19#include <asm/sysreg.h>
20#include <asm/ocd.h> 20#include <asm/ocd.h>
21#include <asm/syscalls.h>
21 22
22#include <mach/pm.h> 23#include <mach/pm.h>
23 24
diff --git a/arch/avr32/kernel/signal.c b/arch/avr32/kernel/signal.c
index c5b11f9067f1..803d7be0938f 100644
--- a/arch/avr32/kernel/signal.c
+++ b/arch/avr32/kernel/signal.c
@@ -19,6 +19,7 @@
19 19
20#include <asm/uaccess.h> 20#include <asm/uaccess.h>
21#include <asm/ucontext.h> 21#include <asm/ucontext.h>
22#include <asm/syscalls.h>
22 23
23#define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) 24#define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP)))
24 25
diff --git a/arch/avr32/kernel/sys_avr32.c b/arch/avr32/kernel/sys_avr32.c
index 8e8911e55c8f..5d2daeaf356f 100644
--- a/arch/avr32/kernel/sys_avr32.c
+++ b/arch/avr32/kernel/sys_avr32.c
@@ -13,6 +13,7 @@
13 13
14#include <asm/mman.h> 14#include <asm/mman.h>
15#include <asm/uaccess.h> 15#include <asm/uaccess.h>
16#include <asm/syscalls.h>
16 17
17asmlinkage long sys_mmap2(unsigned long addr, unsigned long len, 18asmlinkage long sys_mmap2(unsigned long addr, unsigned long len,
18 unsigned long prot, unsigned long flags, 19 unsigned long prot, unsigned long flags,
diff --git a/arch/avr32/mach-at32ap/at32ap700x.c b/arch/avr32/mach-at32ap/at32ap700x.c
index 066252eebf61..ea7bc1e8562b 100644
--- a/arch/avr32/mach-at32ap/at32ap700x.c
+++ b/arch/avr32/mach-at32ap/at32ap700x.c
@@ -15,8 +15,8 @@
15#include <linux/gpio.h> 15#include <linux/gpio.h>
16#include <linux/spi/spi.h> 16#include <linux/spi/spi.h>
17#include <linux/usb/atmel_usba_udc.h> 17#include <linux/usb/atmel_usba_udc.h>
18#include <linux/atmel-mci.h>
18 19
19#include <asm/atmel-mci.h>
20#include <asm/io.h> 20#include <asm/io.h>
21#include <asm/irq.h> 21#include <asm/irq.h>
22 22
@@ -421,7 +421,7 @@ static unsigned long hsb_clk_get_rate(struct clk *clk)
421 return bus_clk_get_rate(clk, shift); 421 return bus_clk_get_rate(clk, shift);
422} 422}
423 423
424static void pba_clk_mode(struct clk *clk, int enabled) 424void pba_clk_mode(struct clk *clk, int enabled)
425{ 425{
426 unsigned long flags; 426 unsigned long flags;
427 u32 mask; 427 u32 mask;
@@ -436,7 +436,7 @@ static void pba_clk_mode(struct clk *clk, int enabled)
436 spin_unlock_irqrestore(&pm_lock, flags); 436 spin_unlock_irqrestore(&pm_lock, flags);
437} 437}
438 438
439static unsigned long pba_clk_get_rate(struct clk *clk) 439unsigned long pba_clk_get_rate(struct clk *clk)
440{ 440{
441 unsigned long cksel, shift = 0; 441 unsigned long cksel, shift = 0;
442 442
diff --git a/arch/avr32/mach-at32ap/clock.h b/arch/avr32/mach-at32ap/clock.h
index 623bf0e9a1e7..4c7ebbdc6dfa 100644
--- a/arch/avr32/mach-at32ap/clock.h
+++ b/arch/avr32/mach-at32ap/clock.h
@@ -30,3 +30,6 @@ struct clk {
30 u16 users; /* Enabled if non-zero */ 30 u16 users; /* Enabled if non-zero */
31 u16 index; /* Sibling index */ 31 u16 index; /* Sibling index */
32}; 32};
33
34unsigned long pba_clk_get_rate(struct clk *clk);
35void pba_clk_mode(struct clk *clk, int enabled);
diff --git a/arch/avr32/mach-at32ap/include/mach/at32ap700x.h b/arch/avr32/mach-at32ap/include/mach/at32ap700x.h
index a77d372f6f3e..5c4c971eed8e 100644
--- a/arch/avr32/mach-at32ap/include/mach/at32ap700x.h
+++ b/arch/avr32/mach-at32ap/include/mach/at32ap700x.h
@@ -211,4 +211,7 @@
211 211
212#define ATMEL_LCDC_ALT_15BIT (ATMEL_LCDC_CONTROL | ATMEL_LCDC_ALT_15B_DATA) 212#define ATMEL_LCDC_ALT_15BIT (ATMEL_LCDC_CONTROL | ATMEL_LCDC_ALT_15B_DATA)
213 213
214/* Bitmask for all EBI data (D16..D31) pins on port E */
215#define ATMEL_EBI_PE_DATA_ALL (0x0000FFFF)
216
214#endif /* __ASM_ARCH_AT32AP700X_H__ */ 217#endif /* __ASM_ARCH_AT32AP700X_H__ */
diff --git a/arch/avr32/mach-at32ap/include/mach/portmux.h b/arch/avr32/mach-at32ap/include/mach/portmux.h
index 21c79373b53f..4873024e3b96 100644
--- a/arch/avr32/mach-at32ap/include/mach/portmux.h
+++ b/arch/avr32/mach-at32ap/include/mach/portmux.h
@@ -25,6 +25,6 @@ void at32_select_periph(unsigned int port, unsigned int pin,
25 unsigned int periph, unsigned long flags); 25 unsigned int periph, unsigned long flags);
26void at32_select_gpio(unsigned int pin, unsigned long flags); 26void at32_select_gpio(unsigned int pin, unsigned long flags);
27void at32_deselect_pin(unsigned int pin); 27void at32_deselect_pin(unsigned int pin);
28void at32_reserve_pin(unsigned int pin); 28void at32_reserve_pin(unsigned int port, u32 pin_mask);
29 29
30#endif /* __ASM_ARCH_PORTMUX_H__ */ 30#endif /* __ASM_ARCH_PORTMUX_H__ */
diff --git a/arch/avr32/mach-at32ap/pio.c b/arch/avr32/mach-at32ap/pio.c
index ed81a8bcb22d..09a274c9d0b7 100644
--- a/arch/avr32/mach-at32ap/pio.c
+++ b/arch/avr32/mach-at32ap/pio.c
@@ -167,22 +167,29 @@ void at32_deselect_pin(unsigned int pin)
167} 167}
168 168
169/* Reserve a pin, preventing anyone else from changing its configuration. */ 169/* Reserve a pin, preventing anyone else from changing its configuration. */
170void __init at32_reserve_pin(unsigned int pin) 170void __init at32_reserve_pin(unsigned int port, u32 pin_mask)
171{ 171{
172 struct pio_device *pio; 172 struct pio_device *pio;
173 unsigned int pin_index = pin & 0x1f;
174 173
175 pio = gpio_to_pio(pin); 174 /* assign and verify pio */
175 pio = gpio_to_pio(port);
176 if (unlikely(!pio)) { 176 if (unlikely(!pio)) {
177 printk("pio: invalid pin %u\n", pin); 177 printk(KERN_WARNING "pio: invalid port %u\n", port);
178 goto fail; 178 goto fail;
179 } 179 }
180 180
181 if (unlikely(test_and_set_bit(pin_index, &pio->pinmux_mask))) { 181 /* Test if any of the requested pins is already muxed */
182 printk("%s: pin %u is busy\n", pio->name, pin_index); 182 spin_lock(&pio_lock);
183 if (unlikely(pio->pinmux_mask & pin_mask)) {
184 printk(KERN_WARNING "%s: pin(s) busy (req. 0x%x, busy 0x%x)\n",
185 pio->name, pin_mask, pio->pinmux_mask & pin_mask);
186 spin_unlock(&pio_lock);
183 goto fail; 187 goto fail;
184 } 188 }
185 189
190 /* Reserve pins */
191 pio->pinmux_mask |= pin_mask;
192 spin_unlock(&pio_lock);
186 return; 193 return;
187 194
188fail: 195fail:
diff --git a/arch/avr32/mm/cache.c b/arch/avr32/mm/cache.c
index 15a4e5e142c1..24a74d1ca7d9 100644
--- a/arch/avr32/mm/cache.c
+++ b/arch/avr32/mm/cache.c
@@ -13,6 +13,7 @@
13#include <asm/cachectl.h> 13#include <asm/cachectl.h>
14#include <asm/processor.h> 14#include <asm/processor.h>
15#include <asm/uaccess.h> 15#include <asm/uaccess.h>
16#include <asm/syscalls.h>
16 17
17/* 18/*
18 * If you attempt to flush anything more than this, you need superuser 19 * If you attempt to flush anything more than this, you need superuser
diff --git a/arch/avr32/mm/init.c b/arch/avr32/mm/init.c
index fa92ff6d95f7..e819fa69a90e 100644
--- a/arch/avr32/mm/init.c
+++ b/arch/avr32/mm/init.c
@@ -97,7 +97,6 @@ void __init paging_init(void)
97 97
98 mem_map = NODE_DATA(0)->node_mem_map; 98 mem_map = NODE_DATA(0)->node_mem_map;
99 99
100 memset(zero_page, 0, PAGE_SIZE);
101 empty_zero_page = virt_to_page(zero_page); 100 empty_zero_page = virt_to_page(zero_page);
102 flush_dcache_page(empty_zero_page); 101 flush_dcache_page(empty_zero_page);
103} 102}
diff --git a/arch/blackfin/Kconfig b/arch/blackfin/Kconfig
index 29e71ed6b8a7..a949c4fbbddd 100644
--- a/arch/blackfin/Kconfig
+++ b/arch/blackfin/Kconfig
@@ -26,6 +26,7 @@ config BLACKFIN
26 default y 26 default y
27 select HAVE_IDE 27 select HAVE_IDE
28 select HAVE_OPROFILE 28 select HAVE_OPROFILE
29 select ARCH_WANT_OPTIONAL_GPIOLIB
29 30
30config ZONE_DMA 31config ZONE_DMA
31 bool 32 bool
@@ -59,10 +60,6 @@ config GENERIC_CALIBRATE_DELAY
59 bool 60 bool
60 default y 61 default y
61 62
62config HARDWARE_PM
63 def_bool y
64 depends on OPROFILE
65
66source "init/Kconfig" 63source "init/Kconfig"
67 64
68source "kernel/Kconfig.preempt" 65source "kernel/Kconfig.preempt"
@@ -77,6 +74,26 @@ choice
77 prompt "CPU" 74 prompt "CPU"
78 default BF533 75 default BF533
79 76
77config BF512
78 bool "BF512"
79 help
80 BF512 Processor Support.
81
82config BF514
83 bool "BF514"
84 help
85 BF514 Processor Support.
86
87config BF516
88 bool "BF516"
89 help
90 BF516 Processor Support.
91
92config BF518
93 bool "BF518"
94 help
95 BF518 Processor Support.
96
80config BF522 97config BF522
81 bool "BF522" 98 bool "BF522"
82 help 99 help
@@ -137,6 +154,16 @@ config BF537
137 help 154 help
138 BF537 Processor Support. 155 BF537 Processor Support.
139 156
157config BF538
158 bool "BF538"
159 help
160 BF538 Processor Support.
161
162config BF539
163 bool "BF539"
164 help
165 BF539 Processor Support.
166
140config BF542 167config BF542
141 bool "BF542" 168 bool "BF542"
142 help 169 help
@@ -169,28 +196,55 @@ config BF561
169 196
170endchoice 197endchoice
171 198
199config SMP
200 depends on BF561
201 bool "Symmetric multi-processing support"
202 ---help---
203 This enables support for systems with more than one CPU,
204 like the dual core BF561. If you have a system with only one
205 CPU, say N. If you have a system with more than one CPU, say Y.
206
207 If you don't know what to do here, say N.
208
209config NR_CPUS
210 int
211 depends on SMP
212 default 2 if BF561
213
214config IRQ_PER_CPU
215 bool
216 depends on SMP
217 default y
218
219config TICK_SOURCE_SYSTMR0
220 bool
221 select BFIN_GPTIMERS
222 depends on SMP
223 default y
224
172config BF_REV_MIN 225config BF_REV_MIN
173 int 226 int
174 default 0 if (BF52x || BF54x) 227 default 0 if (BF51x || BF52x || BF54x)
175 default 2 if (BF537 || BF536 || BF534) 228 default 2 if (BF537 || BF536 || BF534)
176 default 3 if (BF561 ||BF533 || BF532 || BF531) 229 default 3 if (BF561 ||BF533 || BF532 || BF531)
230 default 4 if (BF538 || BF539)
177 231
178config BF_REV_MAX 232config BF_REV_MAX
179 int 233 int
180 default 2 if (BF52x || BF54x) 234 default 2 if (BF51x || BF52x || BF54x)
181 default 3 if (BF537 || BF536 || BF534) 235 default 3 if (BF537 || BF536 || BF534)
182 default 5 if (BF561) 236 default 5 if (BF561 || BF538 || BF539)
183 default 6 if (BF533 || BF532 || BF531) 237 default 6 if (BF533 || BF532 || BF531)
184 238
185choice 239choice
186 prompt "Silicon Rev" 240 prompt "Silicon Rev"
187 default BF_REV_0_1 if (BF52x || BF54x) 241 default BF_REV_0_1 if (BF51x || BF52x || BF54x)
188 default BF_REV_0_2 if (BF534 || BF536 || BF537) 242 default BF_REV_0_2 if (BF534 || BF536 || BF537)
189 default BF_REV_0_3 if (BF531 || BF532 || BF533 || BF561) 243 default BF_REV_0_3 if (BF531 || BF532 || BF533 || BF561)
190 244
191config BF_REV_0_0 245config BF_REV_0_0
192 bool "0.0" 246 bool "0.0"
193 depends on (BF52x || BF54x) 247 depends on (BF51x || BF52x || BF54x)
194 248
195config BF_REV_0_1 249config BF_REV_0_1
196 bool "0.1" 250 bool "0.1"
@@ -206,11 +260,11 @@ config BF_REV_0_3
206 260
207config BF_REV_0_4 261config BF_REV_0_4
208 bool "0.4" 262 bool "0.4"
209 depends on (BF561 || BF533 || BF532 || BF531) 263 depends on (BF561 || BF533 || BF532 || BF531 || BF538 || BF539)
210 264
211config BF_REV_0_5 265config BF_REV_0_5
212 bool "0.5" 266 bool "0.5"
213 depends on (BF561 || BF533 || BF532 || BF531) 267 depends on (BF561 || BF533 || BF532 || BF531 || BF538 || BF539)
214 268
215config BF_REV_0_6 269config BF_REV_0_6
216 bool "0.6" 270 bool "0.6"
@@ -224,6 +278,11 @@ config BF_REV_NONE
224 278
225endchoice 279endchoice
226 280
281config BF51x
282 bool
283 depends on (BF512 || BF514 || BF516 || BF518)
284 default y
285
227config BF52x 286config BF52x
228 bool 287 bool
229 depends on (BF522 || BF523 || BF524 || BF525 || BF526 || BF527) 288 depends on (BF522 || BF523 || BF524 || BF525 || BF526 || BF527)
@@ -258,7 +317,7 @@ config MEM_MT48LC16M16A2TG_75
258 317
259config MEM_MT48LC32M8A2_75 318config MEM_MT48LC32M8A2_75
260 bool 319 bool
261 depends on (BFIN537_STAMP || PNAV10) 320 depends on (BFIN537_STAMP || PNAV10 || BFIN538_EZKIT)
262 default y 321 default y
263 322
264config MEM_MT48LC8M32B2B5_7 323config MEM_MT48LC8M32B2B5_7
@@ -271,10 +330,17 @@ config MEM_MT48LC32M16A2TG_75
271 depends on (BFIN527_EZKIT || BFIN532_IP0X || BLACKSTAMP || BFIN526_EZBRD) 330 depends on (BFIN527_EZKIT || BFIN532_IP0X || BLACKSTAMP || BFIN526_EZBRD)
272 default y 331 default y
273 332
333config MEM_MT48LC32M8A2_75
334 bool
335 depends on (BFIN518F_EZBRD)
336 default y
337
338source "arch/blackfin/mach-bf518/Kconfig"
274source "arch/blackfin/mach-bf527/Kconfig" 339source "arch/blackfin/mach-bf527/Kconfig"
275source "arch/blackfin/mach-bf533/Kconfig" 340source "arch/blackfin/mach-bf533/Kconfig"
276source "arch/blackfin/mach-bf561/Kconfig" 341source "arch/blackfin/mach-bf561/Kconfig"
277source "arch/blackfin/mach-bf537/Kconfig" 342source "arch/blackfin/mach-bf537/Kconfig"
343source "arch/blackfin/mach-bf538/Kconfig"
278source "arch/blackfin/mach-bf548/Kconfig" 344source "arch/blackfin/mach-bf548/Kconfig"
279 345
280menu "Board customizations" 346menu "Board customizations"
@@ -307,6 +373,7 @@ config BOOT_LOAD
307 373
308config ROM_BASE 374config ROM_BASE
309 hex "Kernel ROM Base" 375 hex "Kernel ROM Base"
376 depends on ROMKERNEL
310 default "0x20040000" 377 default "0x20040000"
311 range 0x20000000 0x20400000 if !(BF54x || BF561) 378 range 0x20000000 0x20400000 if !(BF54x || BF561)
312 range 0x20000000 0x30000000 if (BF54x || BF561) 379 range 0x20000000 0x30000000 if (BF54x || BF561)
@@ -318,7 +385,7 @@ config CLKIN_HZ
318 int "Frequency of the crystal on the board in Hz" 385 int "Frequency of the crystal on the board in Hz"
319 default "11059200" if BFIN533_STAMP 386 default "11059200" if BFIN533_STAMP
320 default "27000000" if BFIN533_EZKIT 387 default "27000000" if BFIN533_EZKIT
321 default "25000000" if (BFIN537_STAMP || BFIN527_EZKIT || H8606_HVSISTEMAS || BLACKSTAMP || BFIN526_EZBRD) 388 default "25000000" if (BFIN537_STAMP || BFIN527_EZKIT || H8606_HVSISTEMAS || BLACKSTAMP || BFIN526_EZBRD || BFIN538_EZKIT || BFIN518F-EZBRD)
322 default "30000000" if BFIN561_EZKIT 389 default "30000000" if BFIN561_EZKIT
323 default "24576000" if PNAV10 390 default "24576000" if PNAV10
324 default "10000000" if BFIN532_IP0X 391 default "10000000" if BFIN532_IP0X
@@ -354,11 +421,11 @@ config VCO_MULT
354 range 1 64 421 range 1 64
355 default "22" if BFIN533_EZKIT 422 default "22" if BFIN533_EZKIT
356 default "45" if BFIN533_STAMP 423 default "45" if BFIN533_STAMP
357 default "20" if (BFIN537_STAMP || BFIN527_EZKIT || BFIN548_EZKIT || BFIN548_BLUETECHNIX_CM) 424 default "20" if (BFIN537_STAMP || BFIN527_EZKIT || BFIN548_EZKIT || BFIN548_BLUETECHNIX_CM || BFIN538_EZKIT)
358 default "22" if BFIN533_BLUETECHNIX_CM 425 default "22" if BFIN533_BLUETECHNIX_CM
359 default "20" if (BFIN537_BLUETECHNIX_CM || BFIN527_BLUETECHNIX_CM || BFIN561_BLUETECHNIX_CM) 426 default "20" if (BFIN537_BLUETECHNIX_CM || BFIN527_BLUETECHNIX_CM || BFIN561_BLUETECHNIX_CM)
360 default "20" if BFIN561_EZKIT 427 default "20" if BFIN561_EZKIT
361 default "16" if (H8606_HVSISTEMAS || BLACKSTAMP || BFIN526_EZBRD) 428 default "16" if (H8606_HVSISTEMAS || BLACKSTAMP || BFIN526_EZBRD || BFIN518F_EZBRD)
362 help 429 help
363 This controls the frequency of the on-chip PLL. This can be between 1 and 64. 430 This controls the frequency of the on-chip PLL. This can be between 1 and 64.
364 PLL Frequency = (Crystal Frequency) * (this setting) 431 PLL Frequency = (Crystal Frequency) * (this setting)
@@ -407,19 +474,70 @@ config MEM_MT46V32M16_5B
407 bool "MT46V32M16_5B" 474 bool "MT46V32M16_5B"
408endchoice 475endchoice
409 476
410config MAX_MEM_SIZE 477choice
411 int "Max SDRAM Memory Size in MBytes" 478 prompt "DDR/SDRAM Timing"
412 depends on !MPU 479 depends on BFIN_KERNEL_CLOCK
413 default 512 480 default BFIN_KERNEL_CLOCK_MEMINIT_CALC
414 help 481 help
415 This is the max memory size that the kernel will create CPLB 482 This option allows you to specify Blackfin SDRAM/DDR Timing parameters
416 tables for. Your system will not be able to handle any more. 483 The calculated SDRAM timing parameters may not be 100%
484 accurate - This option is therefore marked experimental.
485
486config BFIN_KERNEL_CLOCK_MEMINIT_CALC
487 bool "Calculate Timings (EXPERIMENTAL)"
488 depends on EXPERIMENTAL
489
490config BFIN_KERNEL_CLOCK_MEMINIT_SPEC
491 bool "Provide accurate Timings based on target SCLK"
492 help
493 Please consult the Blackfin Hardware Reference Manuals as well
494 as the memory device datasheet.
495 http://docs.blackfin.uclinux.org/doku.php?id=bfin:sdram
496endchoice
497
498menu "Memory Init Control"
499 depends on BFIN_KERNEL_CLOCK_MEMINIT_SPEC
500
501config MEM_DDRCTL0
502 depends on BF54x
503 hex "DDRCTL0"
504 default 0x0
505
506config MEM_DDRCTL1
507 depends on BF54x
508 hex "DDRCTL1"
509 default 0x0
510
511config MEM_DDRCTL2
512 depends on BF54x
513 hex "DDRCTL2"
514 default 0x0
515
516config MEM_EBIU_DDRQUE
517 depends on BF54x
518 hex "DDRQUE"
519 default 0x0
520
521config MEM_SDRRC
522 depends on !BF54x
523 hex "SDRRC"
524 default 0x0
525
526config MEM_SDGCTL
527 depends on !BF54x
528 hex "SDGCTL"
529 default 0x0
530endmenu
417 531
418# 532#
419# Max & Min Speeds for various Chips 533# Max & Min Speeds for various Chips
420# 534#
421config MAX_VCO_HZ 535config MAX_VCO_HZ
422 int 536 int
537 default 400000000 if BF512
538 default 400000000 if BF514
539 default 400000000 if BF516
540 default 400000000 if BF518
423 default 600000000 if BF522 541 default 600000000 if BF522
424 default 400000000 if BF523 542 default 400000000 if BF523
425 default 400000000 if BF524 543 default 400000000 if BF524
@@ -459,6 +577,7 @@ source kernel/Kconfig.hz
459 577
460config GENERIC_TIME 578config GENERIC_TIME
461 bool "Generic time" 579 bool "Generic time"
580 depends on !SMP
462 default y 581 default y
463 582
464config GENERIC_CLOCKEVENTS 583config GENERIC_CLOCKEVENTS
@@ -533,6 +652,7 @@ endmenu
533 652
534 653
535menu "Blackfin Kernel Optimizations" 654menu "Blackfin Kernel Optimizations"
655 depends on !SMP
536 656
537comment "Memory Optimizations" 657comment "Memory Optimizations"
538 658
@@ -655,6 +775,17 @@ config APP_STACK_L1
655 775
656 Currently only works with FLAT binaries. 776 Currently only works with FLAT binaries.
657 777
778config EXCEPTION_L1_SCRATCH
779 bool "Locate exception stack in L1 Scratch Memory"
780 default n
781 depends on !APP_STACK_L1 && !SYSCALL_TAB_L1
782 help
783 Whenever an exception occurs, use the L1 Scratch memory for
784 stack storage. You cannot place the stacks of FLAT binaries
785 in L1 when using this option.
786
787 If you don't use L1 Scratch, then you should say Y here.
788
658comment "Speed Optimizations" 789comment "Speed Optimizations"
659config BFIN_INS_LOWOVERHEAD 790config BFIN_INS_LOWOVERHEAD
660 bool "ins[bwl] low overhead, higher interrupt latency" 791 bool "ins[bwl] low overhead, higher interrupt latency"
@@ -684,7 +815,6 @@ config BFIN_INS_LOWOVERHEAD
684 815
685endmenu 816endmenu
686 817
687
688choice 818choice
689 prompt "Kernel executes from" 819 prompt "Kernel executes from"
690 help 820 help
@@ -714,17 +844,9 @@ config BFIN_GPTIMERS
714 To compile this driver as a module, choose M here: the module 844 To compile this driver as a module, choose M here: the module
715 will be called gptimers.ko. 845 will be called gptimers.ko.
716 846
717config BFIN_DMA_5XX
718 bool "Enable DMA Support"
719 depends on (BF52x || BF53x || BF561 || BF54x)
720 default y
721 help
722 DMA driver for BF5xx.
723
724choice 847choice
725 prompt "Uncached SDRAM region" 848 prompt "Uncached DMA region"
726 default DMA_UNCACHED_1M 849 default DMA_UNCACHED_1M
727 depends on BFIN_DMA_5XX
728config DMA_UNCACHED_4M 850config DMA_UNCACHED_4M
729 bool "Enable 4M DMA region" 851 bool "Enable 4M DMA region"
730config DMA_UNCACHED_2M 852config DMA_UNCACHED_2M
@@ -751,9 +873,11 @@ config BFIN_ICACHE_LOCK
751choice 873choice
752 prompt "Policy" 874 prompt "Policy"
753 depends on BFIN_DCACHE 875 depends on BFIN_DCACHE
754 default BFIN_WB 876 default BFIN_WB if !SMP
877 default BFIN_WT if SMP
755config BFIN_WB 878config BFIN_WB
756 bool "Write back" 879 bool "Write back"
880 depends on !SMP
757 help 881 help
758 Write Back Policy: 882 Write Back Policy:
759 Cached data will be written back to SDRAM only when needed. 883 Cached data will be written back to SDRAM only when needed.
@@ -790,7 +914,7 @@ endchoice
790 914
791config BFIN_L2_CACHEABLE 915config BFIN_L2_CACHEABLE
792 bool "Cache L2 SRAM" 916 bool "Cache L2 SRAM"
793 depends on (BFIN_DCACHE || BFIN_ICACHE) && (BF54x || BF561) 917 depends on (BFIN_DCACHE || BFIN_ICACHE) && (BF54x || (BF561 && !SMP))
794 default n 918 default n
795 help 919 help
796 Select to make L2 SRAM cacheable in L1 data and instruction cache. 920 Select to make L2 SRAM cacheable in L1 data and instruction cache.
@@ -980,7 +1104,7 @@ config PM_WAKEUP_GPIO_NUMBER
980 int "GPIO number" 1104 int "GPIO number"
981 range 0 47 1105 range 0 47
982 depends on PM_WAKEUP_BY_GPIO 1106 depends on PM_WAKEUP_BY_GPIO
983 default 2 if BFIN537_STAMP 1107 default 2
984 1108
985choice 1109choice
986 prompt "GPIO Polarity" 1110 prompt "GPIO Polarity"
@@ -1003,7 +1127,7 @@ comment "Possible Suspend Mem / Hibernate Wake-Up Sources"
1003 1127
1004config PM_BFIN_WAKE_PH6 1128config PM_BFIN_WAKE_PH6
1005 bool "Allow Wake-Up from on-chip PHY or PH6 GP" 1129 bool "Allow Wake-Up from on-chip PHY or PH6 GP"
1006 depends on PM && (BF52x || BF534 || BF536 || BF537) 1130 depends on PM && (BF51x || BF52x || BF534 || BF536 || BF537)
1007 default n 1131 default n
1008 help 1132 help
1009 Enable PHY and PH6 GP Wake-Up (Voltage Regulator Power-Up) 1133 Enable PHY and PH6 GP Wake-Up (Voltage Regulator Power-Up)
@@ -1020,15 +1144,21 @@ menu "CPU Frequency scaling"
1020 1144
1021source "drivers/cpufreq/Kconfig" 1145source "drivers/cpufreq/Kconfig"
1022 1146
1147config BFIN_CPU_FREQ
1148 bool
1149 depends on CPU_FREQ
1150 select CPU_FREQ_TABLE
1151 default y
1152
1023config CPU_VOLTAGE 1153config CPU_VOLTAGE
1024 bool "CPU Voltage scaling" 1154 bool "CPU Voltage scaling"
1025 depends on EXPERIMENTAL 1155 depends on EXPERIMENTAL
1026 depends on CPU_FREQ 1156 depends on CPU_FREQ
1027 default n 1157 default n
1028 help 1158 help
1029 Say Y here if you want CPU voltage scaling according to the CPU frequency. 1159 Say Y here if you want CPU voltage scaling according to the CPU frequency.
1030 This option violates the PLL BYPASS recommendation in the Blackfin Processor 1160 This option violates the PLL BYPASS recommendation in the Blackfin Processor
1031 manuals. There is a theoretical risk that during VDDINT transitions 1161 manuals. There is a theoretical risk that during VDDINT transitions
1032 the PLL may unlock. 1162 the PLL may unlock.
1033 1163
1034endmenu 1164endmenu
diff --git a/arch/blackfin/Kconfig.debug b/arch/blackfin/Kconfig.debug
index 3ad25983ec97..5f981d9ca625 100644
--- a/arch/blackfin/Kconfig.debug
+++ b/arch/blackfin/Kconfig.debug
@@ -2,8 +2,30 @@ menu "Kernel hacking"
2 2
3source "lib/Kconfig.debug" 3source "lib/Kconfig.debug"
4 4
5config DEBUG_STACKOVERFLOW
6 bool "Check for stack overflows"
7 depends on DEBUG_KERNEL
8 help
9 This option will cause messages to be printed if free stack space
10 drops below a certain limit.
11
12config DEBUG_STACK_USAGE
13 bool "Enable stack utilization instrumentation"
14 depends on DEBUG_KERNEL
15 help
16 Enables the display of the minimum amount of free stack which each
17 task has ever had available in the sysrq-T output.
18
19 This option will slow down process creation somewhat.
20
5config HAVE_ARCH_KGDB 21config HAVE_ARCH_KGDB
6 def_bool y 22 def_bool y
23
24config KGDB_TESTCASE
25 tristate "KGDB: for test case in expect"
26 default n
27 help
28 This is a kgdb test case for automated testing.
7 29
8config DEBUG_VERBOSE 30config DEBUG_VERBOSE
9 bool "Verbose fault messages" 31 bool "Verbose fault messages"
@@ -182,11 +204,11 @@ config DEBUG_BFIN_HWTRACE_EXPAND_LEN
182 4 for (2^4) 16k, or 4096 entries 204 4 for (2^4) 16k, or 4096 entries
183 205
184config DEBUG_BFIN_NO_KERN_HWTRACE 206config DEBUG_BFIN_NO_KERN_HWTRACE
185 bool "Trace user apps (turn off hwtrace in kernel)" 207 bool "Turn off hwtrace in CPLB handlers"
186 depends on DEBUG_BFIN_HWTRACE_ON 208 depends on DEBUG_BFIN_HWTRACE_ON
187 default n 209 default y
188 help 210 help
189 Some pieces of the kernel contain a lot of flow changes which can 211 The CPLB error handler contains a lot of flow changes which can
190 quickly fill up the hardware trace buffer. When debugging crashes, 212 quickly fill up the hardware trace buffer. When debugging crashes,
191 the hardware trace may indicate that the problem lies in kernel 213 the hardware trace may indicate that the problem lies in kernel
192 space when in reality an application is buggy. 214 space when in reality an application is buggy.
diff --git a/arch/blackfin/Makefile b/arch/blackfin/Makefile
index 6bf50977850c..e550c8d46066 100644
--- a/arch/blackfin/Makefile
+++ b/arch/blackfin/Makefile
@@ -21,6 +21,10 @@ KALLSYMS += --symbol-prefix=_
21KBUILD_DEFCONFIG := BF537-STAMP_defconfig 21KBUILD_DEFCONFIG := BF537-STAMP_defconfig
22 22
23# setup the machine name and the machine dependent settings 23# setup the machine name and the machine dependent settings
24machine-$(CONFIG_BF512) := bf518
25machine-$(CONFIG_BF514) := bf518
26machine-$(CONFIG_BF516) := bf518
27machine-$(CONFIG_BF518) := bf518
24machine-$(CONFIG_BF522) := bf527 28machine-$(CONFIG_BF522) := bf527
25machine-$(CONFIG_BF523) := bf527 29machine-$(CONFIG_BF523) := bf527
26machine-$(CONFIG_BF524) := bf527 30machine-$(CONFIG_BF524) := bf527
@@ -33,6 +37,8 @@ machine-$(CONFIG_BF533) := bf533
33machine-$(CONFIG_BF534) := bf537 37machine-$(CONFIG_BF534) := bf537
34machine-$(CONFIG_BF536) := bf537 38machine-$(CONFIG_BF536) := bf537
35machine-$(CONFIG_BF537) := bf537 39machine-$(CONFIG_BF537) := bf537
40machine-$(CONFIG_BF538) := bf538
41machine-$(CONFIG_BF539) := bf538
36machine-$(CONFIG_BF542) := bf548 42machine-$(CONFIG_BF542) := bf548
37machine-$(CONFIG_BF544) := bf548 43machine-$(CONFIG_BF544) := bf548
38machine-$(CONFIG_BF547) := bf548 44machine-$(CONFIG_BF547) := bf548
@@ -42,6 +48,10 @@ machine-$(CONFIG_BF561) := bf561
42MACHINE := $(machine-y) 48MACHINE := $(machine-y)
43export MACHINE 49export MACHINE
44 50
51cpu-$(CONFIG_BF512) := bf512
52cpu-$(CONFIG_BF514) := bf514
53cpu-$(CONFIG_BF516) := bf516
54cpu-$(CONFIG_BF518) := bf518
45cpu-$(CONFIG_BF522) := bf522 55cpu-$(CONFIG_BF522) := bf522
46cpu-$(CONFIG_BF523) := bf523 56cpu-$(CONFIG_BF523) := bf523
47cpu-$(CONFIG_BF524) := bf524 57cpu-$(CONFIG_BF524) := bf524
@@ -54,6 +64,8 @@ cpu-$(CONFIG_BF533) := bf533
54cpu-$(CONFIG_BF534) := bf534 64cpu-$(CONFIG_BF534) := bf534
55cpu-$(CONFIG_BF536) := bf536 65cpu-$(CONFIG_BF536) := bf536
56cpu-$(CONFIG_BF537) := bf537 66cpu-$(CONFIG_BF537) := bf537
67cpu-$(CONFIG_BF538) := bf538
68cpu-$(CONFIG_BF539) := bf539
57cpu-$(CONFIG_BF542) := bf542 69cpu-$(CONFIG_BF542) := bf542
58cpu-$(CONFIG_BF544) := bf544 70cpu-$(CONFIG_BF544) := bf544
59cpu-$(CONFIG_BF547) := bf547 71cpu-$(CONFIG_BF547) := bf547
@@ -79,7 +91,7 @@ KBUILD_AFLAGS += -mcpu=$(cpu-y)-$(rev-y)
79CHECKFLAGS_SILICON = $(shell echo "" | $(CPP) $(KBUILD_CFLAGS) -dD - 2>/dev/null | awk '$$2 == "__SILICON_REVISION__" { print $$3 }') 91CHECKFLAGS_SILICON = $(shell echo "" | $(CPP) $(KBUILD_CFLAGS) -dD - 2>/dev/null | awk '$$2 == "__SILICON_REVISION__" { print $$3 }')
80CHECKFLAGS += -D__SILICON_REVISION__=$(CHECKFLAGS_SILICON) -Dl1_text=__used__ 92CHECKFLAGS += -D__SILICON_REVISION__=$(CHECKFLAGS_SILICON) -Dl1_text=__used__
81 93
82head-y := arch/$(ARCH)/mach-$(MACHINE)/head.o arch/$(ARCH)/kernel/init_task.o 94head-y := arch/$(ARCH)/kernel/init_task.o
83 95
84core-y += arch/$(ARCH)/kernel/ arch/$(ARCH)/mm/ arch/$(ARCH)/mach-common/ 96core-y += arch/$(ARCH)/kernel/ arch/$(ARCH)/mm/ arch/$(ARCH)/mach-common/
85 97
@@ -95,10 +107,10 @@ else
95core-y += arch/$(ARCH)/kernel/cplb-nompu/ 107core-y += arch/$(ARCH)/kernel/cplb-nompu/
96endif 108endif
97 109
98libs-y += arch/$(ARCH)/lib/
99
100drivers-$(CONFIG_OPROFILE) += arch/$(ARCH)/oprofile/ 110drivers-$(CONFIG_OPROFILE) += arch/$(ARCH)/oprofile/
101 111
112libs-y += arch/$(ARCH)/lib/
113
102machdirs := $(patsubst %,arch/blackfin/mach-%/, $(machine-y)) 114machdirs := $(patsubst %,arch/blackfin/mach-%/, $(machine-y))
103 115
104KBUILD_CFLAGS += -Iarch/$(ARCH)/include/ 116KBUILD_CFLAGS += -Iarch/$(ARCH)/include/
diff --git a/arch/blackfin/configs/BF518F-EZBRD_defconfig b/arch/blackfin/configs/BF518F-EZBRD_defconfig
new file mode 100644
index 000000000000..e0b3f242b555
--- /dev/null
+++ b/arch/blackfin/configs/BF518F-EZBRD_defconfig
@@ -0,0 +1,1191 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.28-rc2
4#
5# CONFIG_MMU is not set
6# CONFIG_FPU is not set
7CONFIG_RWSEM_GENERIC_SPINLOCK=y
8# CONFIG_RWSEM_XCHGADD_ALGORITHM is not set
9CONFIG_BLACKFIN=y
10CONFIG_ZONE_DMA=y
11CONFIG_GENERIC_FIND_NEXT_BIT=y
12CONFIG_GENERIC_HWEIGHT=y
13CONFIG_GENERIC_HARDIRQS=y
14CONFIG_GENERIC_IRQ_PROBE=y
15CONFIG_GENERIC_GPIO=y
16CONFIG_FORCE_MAX_ZONEORDER=14
17CONFIG_GENERIC_CALIBRATE_DELAY=y
18CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
19
20#
21# General setup
22#
23CONFIG_EXPERIMENTAL=y
24CONFIG_BROKEN_ON_SMP=y
25CONFIG_INIT_ENV_ARG_LIMIT=32
26CONFIG_LOCALVERSION=""
27CONFIG_LOCALVERSION_AUTO=y
28CONFIG_SYSVIPC=y
29CONFIG_SYSVIPC_SYSCTL=y
30# CONFIG_POSIX_MQUEUE is not set
31# CONFIG_BSD_PROCESS_ACCT is not set
32# CONFIG_TASKSTATS is not set
33# CONFIG_AUDIT is not set
34CONFIG_IKCONFIG=y
35CONFIG_IKCONFIG_PROC=y
36CONFIG_LOG_BUF_SHIFT=14
37# CONFIG_CGROUPS is not set
38# CONFIG_GROUP_SCHED is not set
39# CONFIG_SYSFS_DEPRECATED_V2 is not set
40# CONFIG_RELAY is not set
41# CONFIG_NAMESPACES is not set
42CONFIG_BLK_DEV_INITRD=y
43CONFIG_INITRAMFS_SOURCE=""
44# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
45CONFIG_SYSCTL=y
46CONFIG_EMBEDDED=y
47CONFIG_UID16=y
48CONFIG_SYSCTL_SYSCALL=y
49CONFIG_KALLSYMS=y
50# CONFIG_KALLSYMS_ALL is not set
51# CONFIG_KALLSYMS_EXTRA_PASS is not set
52CONFIG_HOTPLUG=y
53CONFIG_PRINTK=y
54CONFIG_BUG=y
55# CONFIG_ELF_CORE is not set
56CONFIG_COMPAT_BRK=y
57CONFIG_BASE_FULL=y
58CONFIG_FUTEX=y
59CONFIG_ANON_INODES=y
60CONFIG_EPOLL=y
61CONFIG_SIGNALFD=y
62CONFIG_TIMERFD=y
63CONFIG_EVENTFD=y
64CONFIG_AIO=y
65CONFIG_VM_EVENT_COUNTERS=y
66CONFIG_SLAB=y
67# CONFIG_SLUB is not set
68# CONFIG_SLOB is not set
69# CONFIG_PROFILING is not set
70# CONFIG_MARKERS is not set
71CONFIG_HAVE_OPROFILE=y
72# CONFIG_HAVE_GENERIC_DMA_COHERENT is not set
73CONFIG_SLABINFO=y
74CONFIG_RT_MUTEXES=y
75CONFIG_TINY_SHMEM=y
76CONFIG_BASE_SMALL=0
77CONFIG_MODULES=y
78# CONFIG_MODULE_FORCE_LOAD is not set
79CONFIG_MODULE_UNLOAD=y
80# CONFIG_MODULE_FORCE_UNLOAD is not set
81# CONFIG_MODVERSIONS is not set
82# CONFIG_MODULE_SRCVERSION_ALL is not set
83CONFIG_KMOD=y
84CONFIG_BLOCK=y
85# CONFIG_LBD is not set
86# CONFIG_BLK_DEV_IO_TRACE is not set
87# CONFIG_LSF is not set
88# CONFIG_BLK_DEV_BSG is not set
89# CONFIG_BLK_DEV_INTEGRITY is not set
90
91#
92# IO Schedulers
93#
94CONFIG_IOSCHED_NOOP=y
95# CONFIG_IOSCHED_AS is not set
96# CONFIG_IOSCHED_DEADLINE is not set
97# CONFIG_IOSCHED_CFQ is not set
98# CONFIG_DEFAULT_AS is not set
99# CONFIG_DEFAULT_DEADLINE is not set
100# CONFIG_DEFAULT_CFQ is not set
101CONFIG_DEFAULT_NOOP=y
102CONFIG_DEFAULT_IOSCHED="noop"
103CONFIG_CLASSIC_RCU=y
104# CONFIG_PREEMPT_NONE is not set
105CONFIG_PREEMPT_VOLUNTARY=y
106# CONFIG_PREEMPT is not set
107# CONFIG_FREEZER is not set
108
109#
110# Blackfin Processor Options
111#
112
113#
114# Processor and Board Settings
115#
116# CONFIG_BF512 is not set
117# CONFIG_BF514 is not set
118# CONFIG_BF516 is not set
119CONFIG_BF518=y
120# CONFIG_BF522 is not set
121# CONFIG_BF523 is not set
122# CONFIG_BF524 is not set
123# CONFIG_BF525 is not set
124# CONFIG_BF526 is not set
125# CONFIG_BF527 is not set
126# CONFIG_BF531 is not set
127# CONFIG_BF532 is not set
128# CONFIG_BF533 is not set
129# CONFIG_BF534 is not set
130# CONFIG_BF536 is not set
131# CONFIG_BF537 is not set
132# CONFIG_BF538 is not set
133# CONFIG_BF539 is not set
134# CONFIG_BF542 is not set
135# CONFIG_BF544 is not set
136# CONFIG_BF547 is not set
137# CONFIG_BF548 is not set
138# CONFIG_BF549 is not set
139# CONFIG_BF561 is not set
140CONFIG_BF_REV_MIN=0
141CONFIG_BF_REV_MAX=2
142CONFIG_BF_REV_0_0=y
143# CONFIG_BF_REV_0_1 is not set
144# CONFIG_BF_REV_0_2 is not set
145# CONFIG_BF_REV_0_3 is not set
146# CONFIG_BF_REV_0_4 is not set
147# CONFIG_BF_REV_0_5 is not set
148# CONFIG_BF_REV_0_6 is not set
149# CONFIG_BF_REV_ANY is not set
150# CONFIG_BF_REV_NONE is not set
151CONFIG_BF51x=y
152CONFIG_BFIN518F_EZBRD=y
153
154#
155# BF518 Specific Configuration
156#
157
158#
159# Alternative Multiplexing Scheme
160#
161# CONFIG_BF518_SPORT0_PORTF is not set
162CONFIG_BF518_SPORT0_PORTG=y
163CONFIG_BF518_SPORT0_TSCLK_PG10=y
164# CONFIG_BF518_SPORT0_TSCLK_PG14 is not set
165CONFIG_BF518_UART1_PORTF=y
166# CONFIG_BF518_UART1_PORTG is not set
167
168#
169# Interrupt Priority Assignment
170#
171
172#
173# Priority
174#
175CONFIG_IRQ_PLL_WAKEUP=7
176CONFIG_IRQ_DMA0_ERROR=7
177CONFIG_IRQ_DMAR0_BLK=7
178CONFIG_IRQ_DMAR1_BLK=7
179CONFIG_IRQ_DMAR0_OVR=7
180CONFIG_IRQ_DMAR1_OVR=7
181CONFIG_IRQ_PPI_ERROR=7
182CONFIG_IRQ_MAC_ERROR=7
183CONFIG_IRQ_SPORT0_ERROR=7
184CONFIG_IRQ_SPORT1_ERROR=7
185CONFIG_IRQ_PTP_ERROR=7
186CONFIG_IRQ_UART0_ERROR=7
187CONFIG_IRQ_UART1_ERROR=7
188CONFIG_IRQ_RTC=8
189CONFIG_IRQ_PPI=8
190CONFIG_IRQ_SPORT0_RX=9
191CONFIG_IRQ_SPORT0_TX=9
192CONFIG_IRQ_SPORT1_RX=9
193CONFIG_IRQ_SPORT1_TX=9
194CONFIG_IRQ_TWI=10
195CONFIG_IRQ_SPI0=10
196CONFIG_IRQ_UART0_RX=10
197CONFIG_IRQ_UART0_TX=10
198CONFIG_IRQ_UART1_RX=10
199CONFIG_IRQ_UART1_TX=10
200CONFIG_IRQ_OPTSEC=11
201CONFIG_IRQ_CNT=11
202CONFIG_IRQ_MAC_RX=11
203CONFIG_IRQ_PORTH_INTA=11
204CONFIG_IRQ_MAC_TX=11
205CONFIG_IRQ_PORTH_INTB=11
206CONFIG_IRQ_TIMER0=12
207CONFIG_IRQ_TIMER1=12
208CONFIG_IRQ_TIMER2=12
209CONFIG_IRQ_TIMER3=12
210CONFIG_IRQ_TIMER4=12
211CONFIG_IRQ_TIMER5=12
212CONFIG_IRQ_TIMER6=12
213CONFIG_IRQ_TIMER7=12
214CONFIG_IRQ_PORTG_INTA=12
215CONFIG_IRQ_PORTG_INTB=12
216CONFIG_IRQ_MEM_DMA0=13
217CONFIG_IRQ_MEM_DMA1=13
218CONFIG_IRQ_WATCH=13
219CONFIG_IRQ_PORTF_INTA=13
220CONFIG_IRQ_PORTF_INTB=13
221CONFIG_IRQ_SPI0_ERROR=7
222CONFIG_IRQ_SPI1_ERROR=7
223CONFIG_IRQ_RSI_INT0=7
224CONFIG_IRQ_RSI_INT1=7
225CONFIG_IRQ_PWM_TRIP=10
226CONFIG_IRQ_PWM_SYNC=10
227CONFIG_IRQ_PTP_STAT=10
228
229#
230# Board customizations
231#
232# CONFIG_CMDLINE_BOOL is not set
233CONFIG_BOOT_LOAD=0x1000
234
235#
236# Clock/PLL Setup
237#
238CONFIG_CLKIN_HZ=25000000
239# CONFIG_BFIN_KERNEL_CLOCK is not set
240CONFIG_MAX_VCO_HZ=400000000
241CONFIG_MIN_VCO_HZ=50000000
242CONFIG_MAX_SCLK_HZ=133333333
243CONFIG_MIN_SCLK_HZ=27000000
244
245#
246# Kernel Timer/Scheduler
247#
248# CONFIG_HZ_100 is not set
249CONFIG_HZ_250=y
250# CONFIG_HZ_300 is not set
251# CONFIG_HZ_1000 is not set
252CONFIG_HZ=250
253# CONFIG_SCHED_HRTICK is not set
254CONFIG_GENERIC_TIME=y
255CONFIG_GENERIC_CLOCKEVENTS=y
256# CONFIG_CYCLES_CLOCKSOURCE is not set
257# CONFIG_NO_HZ is not set
258# CONFIG_HIGH_RES_TIMERS is not set
259CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
260
261#
262# Misc
263#
264CONFIG_BFIN_SCRATCH_REG_RETN=y
265# CONFIG_BFIN_SCRATCH_REG_RETE is not set
266# CONFIG_BFIN_SCRATCH_REG_CYCLES is not set
267
268#
269# Blackfin Kernel Optimizations
270#
271
272#
273# Memory Optimizations
274#
275CONFIG_I_ENTRY_L1=y
276CONFIG_EXCPT_IRQ_SYSC_L1=y
277CONFIG_DO_IRQ_L1=y
278CONFIG_CORE_TIMER_IRQ_L1=y
279CONFIG_IDLE_L1=y
280# CONFIG_SCHEDULE_L1 is not set
281CONFIG_ARITHMETIC_OPS_L1=y
282CONFIG_ACCESS_OK_L1=y
283# CONFIG_MEMSET_L1 is not set
284# CONFIG_MEMCPY_L1 is not set
285# CONFIG_SYS_BFIN_SPINLOCK_L1 is not set
286# CONFIG_IP_CHECKSUM_L1 is not set
287CONFIG_CACHELINE_ALIGNED_L1=y
288# CONFIG_SYSCALL_TAB_L1 is not set
289# CONFIG_CPLB_SWITCH_TAB_L1 is not set
290CONFIG_APP_STACK_L1=y
291
292#
293# Speed Optimizations
294#
295CONFIG_BFIN_INS_LOWOVERHEAD=y
296CONFIG_RAMKERNEL=y
297# CONFIG_ROMKERNEL is not set
298CONFIG_SELECT_MEMORY_MODEL=y
299CONFIG_FLATMEM_MANUAL=y
300# CONFIG_DISCONTIGMEM_MANUAL is not set
301# CONFIG_SPARSEMEM_MANUAL is not set
302CONFIG_FLATMEM=y
303CONFIG_FLAT_NODE_MEM_MAP=y
304CONFIG_PAGEFLAGS_EXTENDED=y
305CONFIG_SPLIT_PTLOCK_CPUS=4
306# CONFIG_RESOURCES_64BIT is not set
307# CONFIG_PHYS_ADDR_T_64BIT is not set
308CONFIG_ZONE_DMA_FLAG=1
309CONFIG_VIRT_TO_BUS=y
310CONFIG_BFIN_GPTIMERS=y
311# CONFIG_DMA_UNCACHED_4M is not set
312# CONFIG_DMA_UNCACHED_2M is not set
313CONFIG_DMA_UNCACHED_1M=y
314# CONFIG_DMA_UNCACHED_NONE is not set
315
316#
317# Cache Support
318#
319CONFIG_BFIN_ICACHE=y
320CONFIG_BFIN_DCACHE=y
321# CONFIG_BFIN_DCACHE_BANKA is not set
322# CONFIG_BFIN_ICACHE_LOCK is not set
323CONFIG_BFIN_WB=y
324# CONFIG_BFIN_WT is not set
325# CONFIG_MPU is not set
326
327#
328# Asynchonous Memory Configuration
329#
330
331#
332# EBIU_AMGCTL Global Control
333#
334CONFIG_C_AMCKEN=y
335CONFIG_C_CDPRIO=y
336# CONFIG_C_AMBEN is not set
337# CONFIG_C_AMBEN_B0 is not set
338# CONFIG_C_AMBEN_B0_B1 is not set
339# CONFIG_C_AMBEN_B0_B1_B2 is not set
340CONFIG_C_AMBEN_ALL=y
341
342#
343# EBIU_AMBCTL Control
344#
345CONFIG_BANK_0=0x7BB0
346CONFIG_BANK_1=0x5554
347CONFIG_BANK_2=0x7BB0
348CONFIG_BANK_3=0xFFC0
349
350#
351# Bus options (PCI, PCMCIA, EISA, MCA, ISA)
352#
353# CONFIG_ARCH_SUPPORTS_MSI is not set
354# CONFIG_PCCARD is not set
355
356#
357# Executable file formats
358#
359CONFIG_BINFMT_ELF_FDPIC=y
360CONFIG_BINFMT_FLAT=y
361CONFIG_BINFMT_ZFLAT=y
362# CONFIG_BINFMT_SHARED_FLAT is not set
363# CONFIG_HAVE_AOUT is not set
364# CONFIG_BINFMT_MISC is not set
365
366#
367# Power management options
368#
369# CONFIG_PM is not set
370CONFIG_ARCH_SUSPEND_POSSIBLE=y
371# CONFIG_PM_WAKEUP_BY_GPIO is not set
372
373#
374# CPU Frequency scaling
375#
376# CONFIG_CPU_FREQ is not set
377CONFIG_NET=y
378
379#
380# Networking options
381#
382CONFIG_PACKET=y
383# CONFIG_PACKET_MMAP is not set
384CONFIG_UNIX=y
385CONFIG_XFRM=y
386# CONFIG_XFRM_USER is not set
387# CONFIG_XFRM_SUB_POLICY is not set
388# CONFIG_XFRM_MIGRATE is not set
389# CONFIG_XFRM_STATISTICS is not set
390# CONFIG_NET_KEY is not set
391CONFIG_INET=y
392# CONFIG_IP_MULTICAST is not set
393# CONFIG_IP_ADVANCED_ROUTER is not set
394CONFIG_IP_FIB_HASH=y
395CONFIG_IP_PNP=y
396# CONFIG_IP_PNP_DHCP is not set
397# CONFIG_IP_PNP_BOOTP is not set
398# CONFIG_IP_PNP_RARP is not set
399# CONFIG_NET_IPIP is not set
400# CONFIG_NET_IPGRE is not set
401# CONFIG_ARPD is not set
402CONFIG_SYN_COOKIES=y
403# CONFIG_INET_AH is not set
404# CONFIG_INET_ESP is not set
405# CONFIG_INET_IPCOMP is not set
406# CONFIG_INET_XFRM_TUNNEL is not set
407# CONFIG_INET_TUNNEL is not set
408CONFIG_INET_XFRM_MODE_TRANSPORT=y
409CONFIG_INET_XFRM_MODE_TUNNEL=y
410CONFIG_INET_XFRM_MODE_BEET=y
411# CONFIG_INET_LRO is not set
412CONFIG_INET_DIAG=y
413CONFIG_INET_TCP_DIAG=y
414# CONFIG_TCP_CONG_ADVANCED is not set
415CONFIG_TCP_CONG_CUBIC=y
416CONFIG_DEFAULT_TCP_CONG="cubic"
417# CONFIG_TCP_MD5SIG is not set
418# CONFIG_IPV6 is not set
419# CONFIG_NETLABEL is not set
420# CONFIG_NETWORK_SECMARK is not set
421# CONFIG_NETFILTER is not set
422# CONFIG_IP_DCCP is not set
423# CONFIG_IP_SCTP is not set
424# CONFIG_TIPC is not set
425# CONFIG_ATM is not set
426# CONFIG_BRIDGE is not set
427# CONFIG_NET_DSA is not set
428# CONFIG_VLAN_8021Q is not set
429# CONFIG_DECNET is not set
430# CONFIG_LLC2 is not set
431# CONFIG_IPX is not set
432# CONFIG_ATALK is not set
433# CONFIG_X25 is not set
434# CONFIG_LAPB is not set
435# CONFIG_ECONET is not set
436# CONFIG_WAN_ROUTER is not set
437# CONFIG_NET_SCHED is not set
438
439#
440# Network testing
441#
442# CONFIG_NET_PKTGEN is not set
443# CONFIG_HAMRADIO is not set
444# CONFIG_CAN is not set
445# CONFIG_IRDA is not set
446# CONFIG_BT is not set
447# CONFIG_AF_RXRPC is not set
448# CONFIG_PHONET is not set
449CONFIG_WIRELESS=y
450# CONFIG_CFG80211 is not set
451CONFIG_WIRELESS_OLD_REGULATORY=y
452# CONFIG_WIRELESS_EXT is not set
453# CONFIG_MAC80211 is not set
454# CONFIG_IEEE80211 is not set
455# CONFIG_RFKILL is not set
456# CONFIG_NET_9P is not set
457
458#
459# Device Drivers
460#
461
462#
463# Generic Driver Options
464#
465CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
466CONFIG_STANDALONE=y
467CONFIG_PREVENT_FIRMWARE_BUILD=y
468# CONFIG_FW_LOADER is not set
469# CONFIG_DEBUG_DRIVER is not set
470# CONFIG_DEBUG_DEVRES is not set
471# CONFIG_SYS_HYPERVISOR is not set
472# CONFIG_CONNECTOR is not set
473CONFIG_MTD=y
474# CONFIG_MTD_DEBUG is not set
475# CONFIG_MTD_CONCAT is not set
476CONFIG_MTD_PARTITIONS=y
477# CONFIG_MTD_REDBOOT_PARTS is not set
478# CONFIG_MTD_CMDLINE_PARTS is not set
479# CONFIG_MTD_AR7_PARTS is not set
480
481#
482# User Modules And Translation Layers
483#
484CONFIG_MTD_CHAR=y
485CONFIG_MTD_BLKDEVS=y
486CONFIG_MTD_BLOCK=y
487# CONFIG_FTL is not set
488# CONFIG_NFTL is not set
489# CONFIG_INFTL is not set
490# CONFIG_RFD_FTL is not set
491# CONFIG_SSFDC is not set
492# CONFIG_MTD_OOPS is not set
493
494#
495# RAM/ROM/Flash chip drivers
496#
497# CONFIG_MTD_CFI is not set
498CONFIG_MTD_JEDECPROBE=m
499CONFIG_MTD_GEN_PROBE=m
500# CONFIG_MTD_CFI_ADV_OPTIONS is not set
501CONFIG_MTD_MAP_BANK_WIDTH_1=y
502CONFIG_MTD_MAP_BANK_WIDTH_2=y
503CONFIG_MTD_MAP_BANK_WIDTH_4=y
504# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
505# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
506# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
507CONFIG_MTD_CFI_I1=y
508CONFIG_MTD_CFI_I2=y
509# CONFIG_MTD_CFI_I4 is not set
510# CONFIG_MTD_CFI_I8 is not set
511# CONFIG_MTD_CFI_INTELEXT is not set
512# CONFIG_MTD_CFI_AMDSTD is not set
513# CONFIG_MTD_CFI_STAA is not set
514CONFIG_MTD_RAM=y
515CONFIG_MTD_ROM=m
516# CONFIG_MTD_ABSENT is not set
517
518#
519# Mapping drivers for chip access
520#
521CONFIG_MTD_COMPLEX_MAPPINGS=y
522# CONFIG_MTD_PHYSMAP is not set
523# CONFIG_MTD_GPIO_ADDR is not set
524# CONFIG_MTD_UCLINUX is not set
525# CONFIG_MTD_PLATRAM is not set
526
527#
528# Self-contained MTD device drivers
529#
530# CONFIG_MTD_SLRAM is not set
531# CONFIG_MTD_PHRAM is not set
532# CONFIG_MTD_MTDRAM is not set
533# CONFIG_MTD_BLOCK2MTD is not set
534
535#
536# Disk-On-Chip Device Drivers
537#
538# CONFIG_MTD_DOC2000 is not set
539# CONFIG_MTD_DOC2001 is not set
540# CONFIG_MTD_DOC2001PLUS is not set
541# CONFIG_MTD_NAND is not set
542# CONFIG_MTD_ONENAND is not set
543
544#
545# UBI - Unsorted block images
546#
547# CONFIG_MTD_UBI is not set
548# CONFIG_PARPORT is not set
549CONFIG_BLK_DEV=y
550# CONFIG_BLK_DEV_COW_COMMON is not set
551# CONFIG_BLK_DEV_LOOP is not set
552# CONFIG_BLK_DEV_NBD is not set
553CONFIG_BLK_DEV_RAM=y
554CONFIG_BLK_DEV_RAM_COUNT=16
555CONFIG_BLK_DEV_RAM_SIZE=4096
556# CONFIG_BLK_DEV_XIP is not set
557# CONFIG_CDROM_PKTCDVD is not set
558# CONFIG_ATA_OVER_ETH is not set
559# CONFIG_BLK_DEV_HD is not set
560CONFIG_MISC_DEVICES=y
561# CONFIG_EEPROM_93CX6 is not set
562# CONFIG_ENCLOSURE_SERVICES is not set
563CONFIG_HAVE_IDE=y
564# CONFIG_IDE is not set
565
566#
567# SCSI device support
568#
569# CONFIG_RAID_ATTRS is not set
570# CONFIG_SCSI is not set
571# CONFIG_SCSI_DMA is not set
572# CONFIG_SCSI_NETLINK is not set
573# CONFIG_ATA is not set
574# CONFIG_MD is not set
575CONFIG_NETDEVICES=y
576# CONFIG_DUMMY is not set
577# CONFIG_BONDING is not set
578# CONFIG_MACVLAN is not set
579# CONFIG_EQUALIZER is not set
580# CONFIG_TUN is not set
581# CONFIG_VETH is not set
582CONFIG_PHYLIB=y
583
584#
585# MII PHY device drivers
586#
587# CONFIG_MARVELL_PHY is not set
588# CONFIG_DAVICOM_PHY is not set
589# CONFIG_QSEMI_PHY is not set
590# CONFIG_LXT_PHY is not set
591# CONFIG_CICADA_PHY is not set
592# CONFIG_VITESSE_PHY is not set
593# CONFIG_SMSC_PHY is not set
594# CONFIG_BROADCOM_PHY is not set
595# CONFIG_ICPLUS_PHY is not set
596# CONFIG_REALTEK_PHY is not set
597# CONFIG_FIXED_PHY is not set
598# CONFIG_MDIO_BITBANG is not set
599CONFIG_NET_ETHERNET=y
600CONFIG_MII=y
601# CONFIG_BFIN_MAC is not set
602# CONFIG_SMC91X is not set
603# CONFIG_SMSC911X is not set
604# CONFIG_DM9000 is not set
605# CONFIG_IBM_NEW_EMAC_ZMII is not set
606# CONFIG_IBM_NEW_EMAC_RGMII is not set
607# CONFIG_IBM_NEW_EMAC_TAH is not set
608# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
609# CONFIG_IBM_NEW_EMAC_NO_FLOW_CTRL is not set
610# CONFIG_IBM_NEW_EMAC_MAL_CLR_ICINTSTAT is not set
611# CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set
612# CONFIG_NETDEV_1000 is not set
613# CONFIG_NETDEV_10000 is not set
614
615#
616# Wireless LAN
617#
618# CONFIG_WLAN_PRE80211 is not set
619# CONFIG_WLAN_80211 is not set
620# CONFIG_IWLWIFI_LEDS is not set
621# CONFIG_WAN is not set
622# CONFIG_PPP is not set
623# CONFIG_SLIP is not set
624# CONFIG_NETCONSOLE is not set
625# CONFIG_NETPOLL is not set
626# CONFIG_NET_POLL_CONTROLLER is not set
627# CONFIG_ISDN is not set
628# CONFIG_PHONE is not set
629
630#
631# Input device support
632#
633CONFIG_INPUT=y
634# CONFIG_INPUT_FF_MEMLESS is not set
635# CONFIG_INPUT_POLLDEV is not set
636
637#
638# Userland interfaces
639#
640# CONFIG_INPUT_MOUSEDEV is not set
641# CONFIG_INPUT_JOYDEV is not set
642# CONFIG_INPUT_EVDEV is not set
643# CONFIG_INPUT_EVBUG is not set
644
645#
646# Input Device Drivers
647#
648# CONFIG_INPUT_KEYBOARD is not set
649# CONFIG_INPUT_MOUSE is not set
650# CONFIG_INPUT_JOYSTICK is not set
651# CONFIG_INPUT_TABLET is not set
652# CONFIG_INPUT_TOUCHSCREEN is not set
653CONFIG_INPUT_MISC=y
654# CONFIG_INPUT_UINPUT is not set
655# CONFIG_CONFIG_INPUT_PCF8574 is not set
656
657#
658# Hardware I/O ports
659#
660# CONFIG_SERIO is not set
661# CONFIG_GAMEPORT is not set
662
663#
664# Character devices
665#
666# CONFIG_AD9960 is not set
667# CONFIG_SPI_ADC_BF533 is not set
668# CONFIG_BF5xx_PPIFCD is not set
669# CONFIG_BFIN_SIMPLE_TIMER is not set
670# CONFIG_BF5xx_PPI is not set
671# CONFIG_BFIN_SPORT is not set
672# CONFIG_BFIN_TIMER_LATENCY is not set
673# CONFIG_TWI_LCD is not set
674CONFIG_BFIN_DMA_INTERFACE=m
675CONFIG_SIMPLE_GPIO=m
676CONFIG_VT=y
677CONFIG_CONSOLE_TRANSLATIONS=y
678CONFIG_VT_CONSOLE=y
679CONFIG_HW_CONSOLE=y
680# CONFIG_VT_HW_CONSOLE_BINDING is not set
681# CONFIG_DEVKMEM is not set
682# CONFIG_BFIN_JTAG_COMM is not set
683# CONFIG_SERIAL_NONSTANDARD is not set
684
685#
686# Serial drivers
687#
688# CONFIG_SERIAL_8250 is not set
689
690#
691# Non-8250 serial port support
692#
693CONFIG_SERIAL_BFIN=y
694CONFIG_SERIAL_BFIN_CONSOLE=y
695CONFIG_SERIAL_BFIN_DMA=y
696# CONFIG_SERIAL_BFIN_PIO is not set
697CONFIG_SERIAL_BFIN_UART0=y
698# CONFIG_BFIN_UART0_CTSRTS is not set
699# CONFIG_SERIAL_BFIN_UART1 is not set
700CONFIG_SERIAL_CORE=y
701CONFIG_SERIAL_CORE_CONSOLE=y
702# CONFIG_SERIAL_BFIN_SPORT is not set
703CONFIG_UNIX98_PTYS=y
704# CONFIG_LEGACY_PTYS is not set
705
706#
707# CAN, the car bus and industrial fieldbus
708#
709# CONFIG_CAN4LINUX is not set
710# CONFIG_IPMI_HANDLER is not set
711# CONFIG_HW_RANDOM is not set
712# CONFIG_R3964 is not set
713# CONFIG_RAW_DRIVER is not set
714# CONFIG_TCG_TPM is not set
715CONFIG_I2C=y
716CONFIG_I2C_BOARDINFO=y
717CONFIG_I2C_CHARDEV=y
718CONFIG_I2C_HELPER_AUTO=y
719
720#
721# I2C Hardware Bus support
722#
723
724#
725# I2C system bus drivers (mostly embedded / system-on-chip)
726#
727CONFIG_I2C_BLACKFIN_TWI=y
728CONFIG_I2C_BLACKFIN_TWI_CLK_KHZ=100
729# CONFIG_I2C_GPIO is not set
730# CONFIG_I2C_OCORES is not set
731# CONFIG_I2C_SIMTEC is not set
732
733#
734# External I2C/SMBus adapter drivers
735#
736# CONFIG_I2C_PARPORT_LIGHT is not set
737# CONFIG_I2C_TAOS_EVM is not set
738
739#
740# Other I2C/SMBus bus drivers
741#
742# CONFIG_I2C_PCA_PLATFORM is not set
743# CONFIG_I2C_STUB is not set
744
745#
746# Miscellaneous I2C Chip support
747#
748# CONFIG_DS1682 is not set
749# CONFIG_AT24 is not set
750# CONFIG_SENSORS_AD5252 is not set
751# CONFIG_SENSORS_EEPROM is not set
752# CONFIG_SENSORS_PCF8574 is not set
753# CONFIG_PCF8575 is not set
754# CONFIG_SENSORS_PCA9539 is not set
755# CONFIG_SENSORS_PCF8591 is not set
756# CONFIG_SENSORS_MAX6875 is not set
757# CONFIG_SENSORS_TSL2550 is not set
758# CONFIG_I2C_DEBUG_CORE is not set
759# CONFIG_I2C_DEBUG_ALGO is not set
760# CONFIG_I2C_DEBUG_BUS is not set
761# CONFIG_I2C_DEBUG_CHIP is not set
762# CONFIG_SPI is not set
763CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y
764# CONFIG_GPIOLIB is not set
765# CONFIG_W1 is not set
766# CONFIG_POWER_SUPPLY is not set
767# CONFIG_HWMON is not set
768# CONFIG_THERMAL is not set
769# CONFIG_THERMAL_HWMON is not set
770CONFIG_WATCHDOG=y
771# CONFIG_WATCHDOG_NOWAYOUT is not set
772
773#
774# Watchdog Device Drivers
775#
776# CONFIG_SOFT_WATCHDOG is not set
777CONFIG_BFIN_WDT=y
778
779#
780# Multifunction device drivers
781#
782# CONFIG_MFD_CORE is not set
783# CONFIG_MFD_SM501 is not set
784# CONFIG_HTC_PASIC3 is not set
785# CONFIG_MFD_TMIO is not set
786# CONFIG_MFD_WM8400 is not set
787# CONFIG_MFD_WM8350_I2C is not set
788
789#
790# Multimedia devices
791#
792
793#
794# Multimedia core support
795#
796# CONFIG_VIDEO_DEV is not set
797# CONFIG_DVB_CORE is not set
798# CONFIG_VIDEO_MEDIA is not set
799
800#
801# Multimedia drivers
802#
803# CONFIG_DAB is not set
804
805#
806# Graphics support
807#
808# CONFIG_VGASTATE is not set
809# CONFIG_VIDEO_OUTPUT_CONTROL is not set
810# CONFIG_FB is not set
811# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
812
813#
814# Display device support
815#
816# CONFIG_DISPLAY_SUPPORT is not set
817
818#
819# Console display driver support
820#
821CONFIG_DUMMY_CONSOLE=y
822# CONFIG_SOUND is not set
823# CONFIG_HID_SUPPORT is not set
824# CONFIG_USB_SUPPORT is not set
825# CONFIG_MMC is not set
826# CONFIG_MEMSTICK is not set
827# CONFIG_NEW_LEDS is not set
828# CONFIG_ACCESSIBILITY is not set
829CONFIG_RTC_LIB=y
830CONFIG_RTC_CLASS=y
831CONFIG_RTC_HCTOSYS=y
832CONFIG_RTC_HCTOSYS_DEVICE="rtc0"
833# CONFIG_RTC_DEBUG is not set
834
835#
836# RTC interfaces
837#
838CONFIG_RTC_INTF_SYSFS=y
839CONFIG_RTC_INTF_PROC=y
840CONFIG_RTC_INTF_DEV=y
841# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set
842# CONFIG_RTC_DRV_TEST is not set
843
844#
845# I2C RTC drivers
846#
847# CONFIG_RTC_DRV_DS1307 is not set
848# CONFIG_RTC_DRV_DS1374 is not set
849# CONFIG_RTC_DRV_DS1672 is not set
850# CONFIG_RTC_DRV_MAX6900 is not set
851# CONFIG_RTC_DRV_RS5C372 is not set
852# CONFIG_RTC_DRV_ISL1208 is not set
853# CONFIG_RTC_DRV_X1205 is not set
854# CONFIG_RTC_DRV_PCF8563 is not set
855# CONFIG_RTC_DRV_PCF8583 is not set
856# CONFIG_RTC_DRV_M41T80 is not set
857# CONFIG_RTC_DRV_S35390A is not set
858# CONFIG_RTC_DRV_FM3130 is not set
859
860#
861# SPI RTC drivers
862#
863
864#
865# Platform RTC drivers
866#
867# CONFIG_RTC_DRV_DS1286 is not set
868# CONFIG_RTC_DRV_DS1511 is not set
869# CONFIG_RTC_DRV_DS1553 is not set
870# CONFIG_RTC_DRV_DS1742 is not set
871# CONFIG_RTC_DRV_STK17TA8 is not set
872# CONFIG_RTC_DRV_M48T86 is not set
873# CONFIG_RTC_DRV_M48T35 is not set
874# CONFIG_RTC_DRV_M48T59 is not set
875# CONFIG_RTC_DRV_BQ4802 is not set
876# CONFIG_RTC_DRV_V3020 is not set
877
878#
879# on-CPU RTC drivers
880#
881CONFIG_RTC_DRV_BFIN=y
882# CONFIG_DMADEVICES is not set
883# CONFIG_UIO is not set
884# CONFIG_STAGING is not set
885
886#
887# File systems
888#
889# CONFIG_EXT2_FS is not set
890# CONFIG_EXT3_FS is not set
891# CONFIG_EXT4_FS is not set
892# CONFIG_REISERFS_FS is not set
893# CONFIG_JFS_FS is not set
894# CONFIG_FS_POSIX_ACL is not set
895CONFIG_FILE_LOCKING=y
896# CONFIG_XFS_FS is not set
897# CONFIG_OCFS2_FS is not set
898# CONFIG_DNOTIFY is not set
899CONFIG_INOTIFY=y
900CONFIG_INOTIFY_USER=y
901# CONFIG_QUOTA is not set
902# CONFIG_AUTOFS_FS is not set
903# CONFIG_AUTOFS4_FS is not set
904# CONFIG_FUSE_FS is not set
905
906#
907# CD-ROM/DVD Filesystems
908#
909# CONFIG_ISO9660_FS is not set
910# CONFIG_UDF_FS is not set
911
912#
913# DOS/FAT/NT Filesystems
914#
915# CONFIG_MSDOS_FS is not set
916# CONFIG_VFAT_FS is not set
917# CONFIG_NTFS_FS is not set
918
919#
920# Pseudo filesystems
921#
922CONFIG_PROC_FS=y
923CONFIG_PROC_SYSCTL=y
924CONFIG_SYSFS=y
925# CONFIG_TMPFS is not set
926# CONFIG_HUGETLB_PAGE is not set
927# CONFIG_CONFIGFS_FS is not set
928
929#
930# Miscellaneous filesystems
931#
932# CONFIG_ADFS_FS is not set
933# CONFIG_AFFS_FS is not set
934# CONFIG_HFS_FS is not set
935# CONFIG_HFSPLUS_FS is not set
936# CONFIG_BEFS_FS is not set
937# CONFIG_BFS_FS is not set
938# CONFIG_EFS_FS is not set
939# CONFIG_YAFFS_FS is not set
940# CONFIG_JFFS2_FS is not set
941# CONFIG_CRAMFS is not set
942# CONFIG_VXFS_FS is not set
943# CONFIG_MINIX_FS is not set
944# CONFIG_OMFS_FS is not set
945# CONFIG_HPFS_FS is not set
946# CONFIG_QNX4FS_FS is not set
947# CONFIG_ROMFS_FS is not set
948# CONFIG_SYSV_FS is not set
949# CONFIG_UFS_FS is not set
950CONFIG_NETWORK_FILESYSTEMS=y
951CONFIG_NFS_FS=m
952CONFIG_NFS_V3=y
953# CONFIG_NFS_V3_ACL is not set
954# CONFIG_NFS_V4 is not set
955# CONFIG_NFSD is not set
956CONFIG_LOCKD=m
957CONFIG_LOCKD_V4=y
958CONFIG_NFS_COMMON=y
959CONFIG_SUNRPC=m
960# CONFIG_SUNRPC_REGISTER_V4 is not set
961# CONFIG_RPCSEC_GSS_KRB5 is not set
962# CONFIG_RPCSEC_GSS_SPKM3 is not set
963CONFIG_SMB_FS=m
964# CONFIG_SMB_NLS_DEFAULT is not set
965# CONFIG_CIFS is not set
966# CONFIG_NCP_FS is not set
967# CONFIG_CODA_FS is not set
968# CONFIG_AFS_FS is not set
969
970#
971# Partition Types
972#
973# CONFIG_PARTITION_ADVANCED is not set
974CONFIG_MSDOS_PARTITION=y
975CONFIG_NLS=y
976CONFIG_NLS_DEFAULT="iso8859-1"
977CONFIG_NLS_CODEPAGE_437=y
978# CONFIG_NLS_CODEPAGE_737 is not set
979# CONFIG_NLS_CODEPAGE_775 is not set
980# CONFIG_NLS_CODEPAGE_850 is not set
981# CONFIG_NLS_CODEPAGE_852 is not set
982# CONFIG_NLS_CODEPAGE_855 is not set
983# CONFIG_NLS_CODEPAGE_857 is not set
984# CONFIG_NLS_CODEPAGE_860 is not set
985# CONFIG_NLS_CODEPAGE_861 is not set
986# CONFIG_NLS_CODEPAGE_862 is not set
987# CONFIG_NLS_CODEPAGE_863 is not set
988# CONFIG_NLS_CODEPAGE_864 is not set
989# CONFIG_NLS_CODEPAGE_865 is not set
990# CONFIG_NLS_CODEPAGE_866 is not set
991# CONFIG_NLS_CODEPAGE_869 is not set
992# CONFIG_NLS_CODEPAGE_936 is not set
993# CONFIG_NLS_CODEPAGE_950 is not set
994# CONFIG_NLS_CODEPAGE_932 is not set
995# CONFIG_NLS_CODEPAGE_949 is not set
996# CONFIG_NLS_CODEPAGE_874 is not set
997# CONFIG_NLS_ISO8859_8 is not set
998# CONFIG_NLS_CODEPAGE_1250 is not set
999# CONFIG_NLS_CODEPAGE_1251 is not set
1000# CONFIG_NLS_ASCII is not set
1001CONFIG_NLS_ISO8859_1=y
1002# CONFIG_NLS_ISO8859_2 is not set
1003# CONFIG_NLS_ISO8859_3 is not set
1004# CONFIG_NLS_ISO8859_4 is not set
1005# CONFIG_NLS_ISO8859_5 is not set
1006# CONFIG_NLS_ISO8859_6 is not set
1007# CONFIG_NLS_ISO8859_7 is not set
1008# CONFIG_NLS_ISO8859_9 is not set
1009# CONFIG_NLS_ISO8859_13 is not set
1010# CONFIG_NLS_ISO8859_14 is not set
1011# CONFIG_NLS_ISO8859_15 is not set
1012# CONFIG_NLS_KOI8_R is not set
1013# CONFIG_NLS_KOI8_U is not set
1014# CONFIG_NLS_UTF8 is not set
1015# CONFIG_DLM is not set
1016
1017#
1018# Kernel hacking
1019#
1020# CONFIG_PRINTK_TIME is not set
1021CONFIG_ENABLE_WARN_DEPRECATED=y
1022CONFIG_ENABLE_MUST_CHECK=y
1023CONFIG_FRAME_WARN=1024
1024# CONFIG_MAGIC_SYSRQ is not set
1025# CONFIG_UNUSED_SYMBOLS is not set
1026CONFIG_DEBUG_FS=y
1027# CONFIG_HEADERS_CHECK is not set
1028CONFIG_DEBUG_KERNEL=y
1029# CONFIG_DEBUG_SHIRQ is not set
1030CONFIG_DETECT_SOFTLOCKUP=y
1031# CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC is not set
1032CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE=0
1033CONFIG_SCHED_DEBUG=y
1034# CONFIG_SCHEDSTATS is not set
1035# CONFIG_TIMER_STATS is not set
1036# CONFIG_DEBUG_OBJECTS is not set
1037# CONFIG_DEBUG_SLAB is not set
1038# CONFIG_DEBUG_RT_MUTEXES is not set
1039# CONFIG_RT_MUTEX_TESTER is not set
1040# CONFIG_DEBUG_SPINLOCK is not set
1041# CONFIG_DEBUG_MUTEXES is not set
1042# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
1043# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
1044# CONFIG_DEBUG_KOBJECT is not set
1045# CONFIG_DEBUG_BUGVERBOSE is not set
1046CONFIG_DEBUG_INFO=y
1047# CONFIG_DEBUG_VM is not set
1048# CONFIG_DEBUG_WRITECOUNT is not set
1049# CONFIG_DEBUG_MEMORY_INIT is not set
1050# CONFIG_DEBUG_LIST is not set
1051# CONFIG_DEBUG_SG is not set
1052# CONFIG_FRAME_POINTER is not set
1053# CONFIG_BOOT_PRINTK_DELAY is not set
1054# CONFIG_RCU_TORTURE_TEST is not set
1055# CONFIG_RCU_CPU_STALL_DETECTOR is not set
1056# CONFIG_BACKTRACE_SELF_TEST is not set
1057# CONFIG_DEBUG_BLOCK_EXT_DEVT is not set
1058# CONFIG_FAULT_INJECTION is not set
1059CONFIG_SYSCTL_SYSCALL_CHECK=y
1060# CONFIG_DYNAMIC_PRINTK_DEBUG is not set
1061# CONFIG_SAMPLES is not set
1062CONFIG_HAVE_ARCH_KGDB=y
1063# CONFIG_KGDB is not set
1064# CONFIG_DEBUG_STACKOVERFLOW is not set
1065# CONFIG_DEBUG_STACK_USAGE is not set
1066CONFIG_DEBUG_VERBOSE=y
1067CONFIG_DEBUG_MMRS=y
1068# CONFIG_DEBUG_HWERR is not set
1069# CONFIG_DEBUG_DOUBLEFAULT is not set
1070CONFIG_DEBUG_HUNT_FOR_ZERO=y
1071CONFIG_DEBUG_BFIN_HWTRACE_ON=y
1072CONFIG_DEBUG_BFIN_HWTRACE_COMPRESSION_OFF=y
1073# CONFIG_DEBUG_BFIN_HWTRACE_COMPRESSION_ONE is not set
1074# CONFIG_DEBUG_BFIN_HWTRACE_COMPRESSION_TWO is not set
1075CONFIG_DEBUG_BFIN_HWTRACE_COMPRESSION=0
1076# CONFIG_DEBUG_BFIN_HWTRACE_EXPAND is not set
1077# CONFIG_DEBUG_BFIN_NO_KERN_HWTRACE is not set
1078CONFIG_EARLY_PRINTK=y
1079CONFIG_CPLB_INFO=y
1080CONFIG_ACCESS_CHECK=y
1081
1082#
1083# Security options
1084#
1085# CONFIG_KEYS is not set
1086CONFIG_SECURITY=y
1087# CONFIG_SECURITYFS is not set
1088# CONFIG_SECURITY_NETWORK is not set
1089# CONFIG_SECURITY_FILE_CAPABILITIES is not set
1090CONFIG_SECURITY_DEFAULT_MMAP_MIN_ADDR=0
1091CONFIG_CRYPTO=y
1092
1093#
1094# Crypto core or helper
1095#
1096# CONFIG_CRYPTO_FIPS is not set
1097# CONFIG_CRYPTO_MANAGER is not set
1098# CONFIG_CRYPTO_GF128MUL is not set
1099# CONFIG_CRYPTO_NULL is not set
1100# CONFIG_CRYPTO_CRYPTD is not set
1101# CONFIG_CRYPTO_AUTHENC is not set
1102# CONFIG_CRYPTO_TEST is not set
1103
1104#
1105# Authenticated Encryption with Associated Data
1106#
1107# CONFIG_CRYPTO_CCM is not set
1108# CONFIG_CRYPTO_GCM is not set
1109# CONFIG_CRYPTO_SEQIV is not set
1110
1111#
1112# Block modes
1113#
1114# CONFIG_CRYPTO_CBC is not set
1115# CONFIG_CRYPTO_CTR is not set
1116# CONFIG_CRYPTO_CTS is not set
1117# CONFIG_CRYPTO_ECB is not set
1118# CONFIG_CRYPTO_LRW is not set
1119# CONFIG_CRYPTO_PCBC is not set
1120# CONFIG_CRYPTO_XTS is not set
1121
1122#
1123# Hash modes
1124#
1125# CONFIG_CRYPTO_HMAC is not set
1126# CONFIG_CRYPTO_XCBC is not set
1127
1128#
1129# Digest
1130#
1131# CONFIG_CRYPTO_CRC32C is not set
1132# CONFIG_CRYPTO_MD4 is not set
1133# CONFIG_CRYPTO_MD5 is not set
1134# CONFIG_CRYPTO_MICHAEL_MIC is not set
1135# CONFIG_CRYPTO_RMD128 is not set
1136# CONFIG_CRYPTO_RMD160 is not set
1137# CONFIG_CRYPTO_RMD256 is not set
1138# CONFIG_CRYPTO_RMD320 is not set
1139# CONFIG_CRYPTO_SHA1 is not set
1140# CONFIG_CRYPTO_SHA256 is not set
1141# CONFIG_CRYPTO_SHA512 is not set
1142# CONFIG_CRYPTO_TGR192 is not set
1143# CONFIG_CRYPTO_WP512 is not set
1144
1145#
1146# Ciphers
1147#
1148# CONFIG_CRYPTO_AES is not set
1149# CONFIG_CRYPTO_ANUBIS is not set
1150# CONFIG_CRYPTO_ARC4 is not set
1151# CONFIG_CRYPTO_BLOWFISH is not set
1152# CONFIG_CRYPTO_CAMELLIA is not set
1153# CONFIG_CRYPTO_CAST5 is not set
1154# CONFIG_CRYPTO_CAST6 is not set
1155# CONFIG_CRYPTO_DES is not set
1156# CONFIG_CRYPTO_FCRYPT is not set
1157# CONFIG_CRYPTO_KHAZAD is not set
1158# CONFIG_CRYPTO_SALSA20 is not set
1159# CONFIG_CRYPTO_SEED is not set
1160# CONFIG_CRYPTO_SERPENT is not set
1161# CONFIG_CRYPTO_TEA is not set
1162# CONFIG_CRYPTO_TWOFISH is not set
1163
1164#
1165# Compression
1166#
1167# CONFIG_CRYPTO_DEFLATE is not set
1168# CONFIG_CRYPTO_LZO is not set
1169
1170#
1171# Random Number Generation
1172#
1173# CONFIG_CRYPTO_ANSI_CPRNG is not set
1174CONFIG_CRYPTO_HW=y
1175
1176#
1177# Library routines
1178#
1179CONFIG_BITREVERSE=y
1180CONFIG_CRC_CCITT=m
1181# CONFIG_CRC16 is not set
1182# CONFIG_CRC_T10DIF is not set
1183# CONFIG_CRC_ITU_T is not set
1184CONFIG_CRC32=y
1185# CONFIG_CRC7 is not set
1186# CONFIG_LIBCRC32C is not set
1187CONFIG_ZLIB_INFLATE=y
1188CONFIG_PLIST=y
1189CONFIG_HAS_IOMEM=y
1190CONFIG_HAS_IOPORT=y
1191CONFIG_HAS_DMA=y
diff --git a/arch/blackfin/configs/BF526-EZBRD_defconfig b/arch/blackfin/configs/BF526-EZBRD_defconfig
index 4443a47e516f..69f66c35b2a5 100644
--- a/arch/blackfin/configs/BF526-EZBRD_defconfig
+++ b/arch/blackfin/configs/BF526-EZBRD_defconfig
@@ -1,7 +1,6 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.26.3 3# Linux kernel version: 2.6.28-rc2
4# Thu Aug 28 16:49:53 2008
5# 4#
6# CONFIG_MMU is not set 5# CONFIG_MMU is not set
7# CONFIG_FPU is not set 6# CONFIG_FPU is not set
@@ -37,8 +36,7 @@ CONFIG_IKCONFIG_PROC=y
37CONFIG_LOG_BUF_SHIFT=14 36CONFIG_LOG_BUF_SHIFT=14
38# CONFIG_CGROUPS is not set 37# CONFIG_CGROUPS is not set
39# CONFIG_GROUP_SCHED is not set 38# CONFIG_GROUP_SCHED is not set
40CONFIG_SYSFS_DEPRECATED=y 39# CONFIG_SYSFS_DEPRECATED_V2 is not set
41CONFIG_SYSFS_DEPRECATED_V2=y
42# CONFIG_RELAY is not set 40# CONFIG_RELAY is not set
43# CONFIG_NAMESPACES is not set 41# CONFIG_NAMESPACES is not set
44CONFIG_BLK_DEV_INITRD=y 42CONFIG_BLK_DEV_INITRD=y
@@ -48,13 +46,13 @@ CONFIG_SYSCTL=y
48CONFIG_EMBEDDED=y 46CONFIG_EMBEDDED=y
49CONFIG_UID16=y 47CONFIG_UID16=y
50CONFIG_SYSCTL_SYSCALL=y 48CONFIG_SYSCTL_SYSCALL=y
51CONFIG_SYSCTL_SYSCALL_CHECK=y
52CONFIG_KALLSYMS=y 49CONFIG_KALLSYMS=y
50# CONFIG_KALLSYMS_ALL is not set
53# CONFIG_KALLSYMS_EXTRA_PASS is not set 51# CONFIG_KALLSYMS_EXTRA_PASS is not set
54CONFIG_HOTPLUG=y 52CONFIG_HOTPLUG=y
55CONFIG_PRINTK=y 53CONFIG_PRINTK=y
56CONFIG_BUG=y 54CONFIG_BUG=y
57CONFIG_ELF_CORE=y 55# CONFIG_ELF_CORE is not set
58CONFIG_COMPAT_BRK=y 56CONFIG_COMPAT_BRK=y
59CONFIG_BASE_FULL=y 57CONFIG_BASE_FULL=y
60CONFIG_FUTEX=y 58CONFIG_FUTEX=y
@@ -63,6 +61,7 @@ CONFIG_EPOLL=y
63CONFIG_SIGNALFD=y 61CONFIG_SIGNALFD=y
64CONFIG_TIMERFD=y 62CONFIG_TIMERFD=y
65CONFIG_EVENTFD=y 63CONFIG_EVENTFD=y
64CONFIG_AIO=y
66CONFIG_VM_EVENT_COUNTERS=y 65CONFIG_VM_EVENT_COUNTERS=y
67CONFIG_SLAB=y 66CONFIG_SLAB=y
68# CONFIG_SLUB is not set 67# CONFIG_SLUB is not set
@@ -70,9 +69,7 @@ CONFIG_SLAB=y
70# CONFIG_PROFILING is not set 69# CONFIG_PROFILING is not set
71# CONFIG_MARKERS is not set 70# CONFIG_MARKERS is not set
72CONFIG_HAVE_OPROFILE=y 71CONFIG_HAVE_OPROFILE=y
73# CONFIG_HAVE_KPROBES is not set 72# CONFIG_HAVE_GENERIC_DMA_COHERENT is not set
74# CONFIG_HAVE_KRETPROBES is not set
75# CONFIG_HAVE_DMA_ATTRS is not set
76CONFIG_SLABINFO=y 73CONFIG_SLABINFO=y
77CONFIG_RT_MUTEXES=y 74CONFIG_RT_MUTEXES=y
78CONFIG_TINY_SHMEM=y 75CONFIG_TINY_SHMEM=y
@@ -89,6 +86,7 @@ CONFIG_BLOCK=y
89# CONFIG_BLK_DEV_IO_TRACE is not set 86# CONFIG_BLK_DEV_IO_TRACE is not set
90# CONFIG_LSF is not set 87# CONFIG_LSF is not set
91# CONFIG_BLK_DEV_BSG is not set 88# CONFIG_BLK_DEV_BSG is not set
89# CONFIG_BLK_DEV_INTEGRITY is not set
92 90
93# 91#
94# IO Schedulers 92# IO Schedulers
@@ -106,6 +104,7 @@ CONFIG_CLASSIC_RCU=y
106# CONFIG_PREEMPT_NONE is not set 104# CONFIG_PREEMPT_NONE is not set
107CONFIG_PREEMPT_VOLUNTARY=y 105CONFIG_PREEMPT_VOLUNTARY=y
108# CONFIG_PREEMPT is not set 106# CONFIG_PREEMPT is not set
107# CONFIG_FREEZER is not set
109 108
110# 109#
111# Blackfin Processor Options 110# Blackfin Processor Options
@@ -114,6 +113,10 @@ CONFIG_PREEMPT_VOLUNTARY=y
114# 113#
115# Processor and Board Settings 114# Processor and Board Settings
116# 115#
116# CONFIG_BF512 is not set
117# CONFIG_BF514 is not set
118# CONFIG_BF516 is not set
119# CONFIG_BF518 is not set
117# CONFIG_BF522 is not set 120# CONFIG_BF522 is not set
118# CONFIG_BF523 is not set 121# CONFIG_BF523 is not set
119# CONFIG_BF524 is not set 122# CONFIG_BF524 is not set
@@ -126,49 +129,27 @@ CONFIG_BF526=y
126# CONFIG_BF534 is not set 129# CONFIG_BF534 is not set
127# CONFIG_BF536 is not set 130# CONFIG_BF536 is not set
128# CONFIG_BF537 is not set 131# CONFIG_BF537 is not set
132# CONFIG_BF538 is not set
133# CONFIG_BF539 is not set
129# CONFIG_BF542 is not set 134# CONFIG_BF542 is not set
130# CONFIG_BF544 is not set 135# CONFIG_BF544 is not set
131# CONFIG_BF547 is not set 136# CONFIG_BF547 is not set
132# CONFIG_BF548 is not set 137# CONFIG_BF548 is not set
133# CONFIG_BF549 is not set 138# CONFIG_BF549 is not set
134# CONFIG_BF561 is not set 139# CONFIG_BF561 is not set
140CONFIG_BF_REV_MIN=0
141CONFIG_BF_REV_MAX=2
135CONFIG_BF_REV_0_0=y 142CONFIG_BF_REV_0_0=y
136# CONFIG_BF_REV_0_1 is not set 143# CONFIG_BF_REV_0_1 is not set
137# CONFIG_BF_REV_0_2 is not set 144# CONFIG_BF_REV_0_2 is not set
138# CONFIG_BF_REV_0_3 is not set 145# CONFIG_BF_REV_0_3 is not set
139# CONFIG_BF_REV_0_4 is not set 146# CONFIG_BF_REV_0_4 is not set
140# CONFIG_BF_REV_0_5 is not set 147# CONFIG_BF_REV_0_5 is not set
148# CONFIG_BF_REV_0_6 is not set
141# CONFIG_BF_REV_ANY is not set 149# CONFIG_BF_REV_ANY is not set
142# CONFIG_BF_REV_NONE is not set 150# CONFIG_BF_REV_NONE is not set
143CONFIG_BF52x=y 151CONFIG_BF52x=y
144CONFIG_MEM_MT48LC32M16A2TG_75=y 152CONFIG_MEM_MT48LC32M16A2TG_75=y
145# CONFIG_BFIN527_EZKIT is not set
146# CONFIG_BFIN527_BLUETECHNIX_CM is not set
147CONFIG_BFIN526_EZBRD=y
148
149#
150# BF527 Specific Configuration
151#
152
153#
154# Alternative Multiplexing Scheme
155#
156# CONFIG_BF527_SPORT0_PORTF is not set
157CONFIG_BF527_SPORT0_PORTG=y
158CONFIG_BF527_SPORT0_TSCLK_PG10=y
159# CONFIG_BF527_SPORT0_TSCLK_PG14 is not set
160CONFIG_BF527_UART1_PORTF=y
161# CONFIG_BF527_UART1_PORTG is not set
162# CONFIG_BF527_NAND_D_PORTF is not set
163CONFIG_BF527_NAND_D_PORTH=y
164
165#
166# Interrupt Priority Assignment
167#
168
169#
170# Priority
171#
172CONFIG_IRQ_PLL_WAKEUP=7 153CONFIG_IRQ_PLL_WAKEUP=7
173CONFIG_IRQ_DMA0_ERROR=7 154CONFIG_IRQ_DMA0_ERROR=7
174CONFIG_IRQ_DMAR0_BLK=7 155CONFIG_IRQ_DMAR0_BLK=7
@@ -188,7 +169,6 @@ CONFIG_IRQ_SPORT0_TX=9
188CONFIG_IRQ_SPORT1_RX=9 169CONFIG_IRQ_SPORT1_RX=9
189CONFIG_IRQ_SPORT1_TX=9 170CONFIG_IRQ_SPORT1_TX=9
190CONFIG_IRQ_TWI=10 171CONFIG_IRQ_TWI=10
191CONFIG_IRQ_SPI=10
192CONFIG_IRQ_UART0_RX=10 172CONFIG_IRQ_UART0_RX=10
193CONFIG_IRQ_UART0_TX=10 173CONFIG_IRQ_UART0_TX=10
194CONFIG_IRQ_UART1_RX=10 174CONFIG_IRQ_UART1_RX=10
@@ -199,14 +179,14 @@ CONFIG_IRQ_MAC_RX=11
199CONFIG_IRQ_PORTH_INTA=11 179CONFIG_IRQ_PORTH_INTA=11
200CONFIG_IRQ_MAC_TX=11 180CONFIG_IRQ_MAC_TX=11
201CONFIG_IRQ_PORTH_INTB=11 181CONFIG_IRQ_PORTH_INTB=11
202CONFIG_IRQ_TMR0=12 182CONFIG_IRQ_TIMER0=12
203CONFIG_IRQ_TMR1=12 183CONFIG_IRQ_TIMER1=12
204CONFIG_IRQ_TMR2=12 184CONFIG_IRQ_TIMER2=12
205CONFIG_IRQ_TMR3=12 185CONFIG_IRQ_TIMER3=12
206CONFIG_IRQ_TMR4=12 186CONFIG_IRQ_TIMER4=12
207CONFIG_IRQ_TMR5=12 187CONFIG_IRQ_TIMER5=12
208CONFIG_IRQ_TMR6=12 188CONFIG_IRQ_TIMER6=12
209CONFIG_IRQ_TMR7=12 189CONFIG_IRQ_TIMER7=12
210CONFIG_IRQ_PORTG_INTA=12 190CONFIG_IRQ_PORTG_INTA=12
211CONFIG_IRQ_PORTG_INTB=12 191CONFIG_IRQ_PORTG_INTB=12
212CONFIG_IRQ_MEM_DMA0=13 192CONFIG_IRQ_MEM_DMA0=13
@@ -214,6 +194,34 @@ CONFIG_IRQ_MEM_DMA1=13
214CONFIG_IRQ_WATCH=13 194CONFIG_IRQ_WATCH=13
215CONFIG_IRQ_PORTF_INTA=13 195CONFIG_IRQ_PORTF_INTA=13
216CONFIG_IRQ_PORTF_INTB=13 196CONFIG_IRQ_PORTF_INTB=13
197# CONFIG_BFIN527_EZKIT is not set
198# CONFIG_BFIN527_BLUETECHNIX_CM is not set
199CONFIG_BFIN526_EZBRD=y
200
201#
202# BF527 Specific Configuration
203#
204
205#
206# Alternative Multiplexing Scheme
207#
208# CONFIG_BF527_SPORT0_PORTF is not set
209CONFIG_BF527_SPORT0_PORTG=y
210CONFIG_BF527_SPORT0_TSCLK_PG10=y
211# CONFIG_BF527_SPORT0_TSCLK_PG14 is not set
212CONFIG_BF527_UART1_PORTF=y
213# CONFIG_BF527_UART1_PORTG is not set
214# CONFIG_BF527_NAND_D_PORTF is not set
215CONFIG_BF527_NAND_D_PORTH=y
216
217#
218# Interrupt Priority Assignment
219#
220
221#
222# Priority
223#
224CONFIG_IRQ_SPI=10
217CONFIG_IRQ_SPI_ERROR=7 225CONFIG_IRQ_SPI_ERROR=7
218CONFIG_IRQ_NFC_ERROR=7 226CONFIG_IRQ_NFC_ERROR=7
219CONFIG_IRQ_HDMA_ERROR=7 227CONFIG_IRQ_HDMA_ERROR=7
@@ -235,7 +243,6 @@ CONFIG_BOOT_LOAD=0x1000
235# 243#
236CONFIG_CLKIN_HZ=25000000 244CONFIG_CLKIN_HZ=25000000
237# CONFIG_BFIN_KERNEL_CLOCK is not set 245# CONFIG_BFIN_KERNEL_CLOCK is not set
238CONFIG_MAX_MEM_SIZE=512
239CONFIG_MAX_VCO_HZ=400000000 246CONFIG_MAX_VCO_HZ=400000000
240CONFIG_MIN_VCO_HZ=50000000 247CONFIG_MIN_VCO_HZ=50000000
241CONFIG_MAX_SCLK_HZ=133333333 248CONFIG_MAX_SCLK_HZ=133333333
@@ -253,16 +260,11 @@ CONFIG_HZ=250
253CONFIG_GENERIC_TIME=y 260CONFIG_GENERIC_TIME=y
254CONFIG_GENERIC_CLOCKEVENTS=y 261CONFIG_GENERIC_CLOCKEVENTS=y
255# CONFIG_CYCLES_CLOCKSOURCE is not set 262# CONFIG_CYCLES_CLOCKSOURCE is not set
256# CONFIG_TICK_ONESHOT is not set
257# CONFIG_NO_HZ is not set 263# CONFIG_NO_HZ is not set
258# CONFIG_HIGH_RES_TIMERS is not set 264# CONFIG_HIGH_RES_TIMERS is not set
259CONFIG_GENERIC_CLOCKEVENTS_BUILD=y 265CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
260 266
261# 267#
262# Memory Setup
263#
264
265#
266# Misc 268# Misc
267# 269#
268CONFIG_BFIN_SCRATCH_REG_RETN=y 270CONFIG_BFIN_SCRATCH_REG_RETN=y
@@ -291,6 +293,7 @@ CONFIG_ACCESS_OK_L1=y
291CONFIG_CACHELINE_ALIGNED_L1=y 293CONFIG_CACHELINE_ALIGNED_L1=y
292# CONFIG_SYSCALL_TAB_L1 is not set 294# CONFIG_SYSCALL_TAB_L1 is not set
293# CONFIG_CPLB_SWITCH_TAB_L1 is not set 295# CONFIG_CPLB_SWITCH_TAB_L1 is not set
296CONFIG_APP_STACK_L1=y
294 297
295# 298#
296# Speed Optimizations 299# Speed Optimizations
@@ -304,15 +307,13 @@ CONFIG_FLATMEM_MANUAL=y
304# CONFIG_SPARSEMEM_MANUAL is not set 307# CONFIG_SPARSEMEM_MANUAL is not set
305CONFIG_FLATMEM=y 308CONFIG_FLATMEM=y
306CONFIG_FLAT_NODE_MEM_MAP=y 309CONFIG_FLAT_NODE_MEM_MAP=y
307# CONFIG_SPARSEMEM_STATIC is not set
308# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
309CONFIG_PAGEFLAGS_EXTENDED=y 310CONFIG_PAGEFLAGS_EXTENDED=y
310CONFIG_SPLIT_PTLOCK_CPUS=4 311CONFIG_SPLIT_PTLOCK_CPUS=4
311# CONFIG_RESOURCES_64BIT is not set 312# CONFIG_RESOURCES_64BIT is not set
313# CONFIG_PHYS_ADDR_T_64BIT is not set
312CONFIG_ZONE_DMA_FLAG=1 314CONFIG_ZONE_DMA_FLAG=1
313CONFIG_VIRT_TO_BUS=y 315CONFIG_VIRT_TO_BUS=y
314CONFIG_BFIN_GPTIMERS=y 316CONFIG_BFIN_GPTIMERS=y
315CONFIG_BFIN_DMA_5XX=y
316# CONFIG_DMA_UNCACHED_4M is not set 317# CONFIG_DMA_UNCACHED_4M is not set
317# CONFIG_DMA_UNCACHED_2M is not set 318# CONFIG_DMA_UNCACHED_2M is not set
318CONFIG_DMA_UNCACHED_1M=y 319CONFIG_DMA_UNCACHED_1M=y
@@ -365,6 +366,7 @@ CONFIG_BINFMT_ELF_FDPIC=y
365CONFIG_BINFMT_FLAT=y 366CONFIG_BINFMT_FLAT=y
366CONFIG_BINFMT_ZFLAT=y 367CONFIG_BINFMT_ZFLAT=y
367# CONFIG_BINFMT_SHARED_FLAT is not set 368# CONFIG_BINFMT_SHARED_FLAT is not set
369# CONFIG_HAVE_AOUT is not set
368# CONFIG_BINFMT_MISC is not set 370# CONFIG_BINFMT_MISC is not set
369 371
370# 372#
@@ -378,10 +380,6 @@ CONFIG_ARCH_SUSPEND_POSSIBLE=y
378# CPU Frequency scaling 380# CPU Frequency scaling
379# 381#
380# CONFIG_CPU_FREQ is not set 382# CONFIG_CPU_FREQ is not set
381
382#
383# Networking
384#
385CONFIG_NET=y 383CONFIG_NET=y
386 384
387# 385#
@@ -432,6 +430,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
432# CONFIG_TIPC is not set 430# CONFIG_TIPC is not set
433# CONFIG_ATM is not set 431# CONFIG_ATM is not set
434# CONFIG_BRIDGE is not set 432# CONFIG_BRIDGE is not set
433# CONFIG_NET_DSA is not set
435# CONFIG_VLAN_8021Q is not set 434# CONFIG_VLAN_8021Q is not set
436# CONFIG_DECNET is not set 435# CONFIG_DECNET is not set
437# CONFIG_LLC2 is not set 436# CONFIG_LLC2 is not set
@@ -452,11 +451,10 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
452# CONFIG_IRDA is not set 451# CONFIG_IRDA is not set
453# CONFIG_BT is not set 452# CONFIG_BT is not set
454# CONFIG_AF_RXRPC is not set 453# CONFIG_AF_RXRPC is not set
455 454# CONFIG_PHONET is not set
456# 455CONFIG_WIRELESS=y
457# Wireless
458#
459# CONFIG_CFG80211 is not set 456# CONFIG_CFG80211 is not set
457CONFIG_WIRELESS_OLD_REGULATORY=y
460# CONFIG_WIRELESS_EXT is not set 458# CONFIG_WIRELESS_EXT is not set
461# CONFIG_MAC80211 is not set 459# CONFIG_MAC80211 is not set
462# CONFIG_IEEE80211 is not set 460# CONFIG_IEEE80211 is not set
@@ -474,6 +472,8 @@ CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
474CONFIG_STANDALONE=y 472CONFIG_STANDALONE=y
475CONFIG_PREVENT_FIRMWARE_BUILD=y 473CONFIG_PREVENT_FIRMWARE_BUILD=y
476# CONFIG_FW_LOADER is not set 474# CONFIG_FW_LOADER is not set
475# CONFIG_DEBUG_DRIVER is not set
476# CONFIG_DEBUG_DEVRES is not set
477# CONFIG_SYS_HYPERVISOR is not set 477# CONFIG_SYS_HYPERVISOR is not set
478# CONFIG_CONNECTOR is not set 478# CONFIG_CONNECTOR is not set
479CONFIG_MTD=y 479CONFIG_MTD=y
@@ -534,7 +534,8 @@ CONFIG_MTD_COMPLEX_MAPPINGS=y
534# Self-contained MTD device drivers 534# Self-contained MTD device drivers
535# 535#
536# CONFIG_MTD_DATAFLASH is not set 536# CONFIG_MTD_DATAFLASH is not set
537# CONFIG_MTD_M25P80 is not set 537CONFIG_MTD_M25P80=y
538CONFIG_M25PXX_USE_FAST_READ=y
538# CONFIG_MTD_SLRAM is not set 539# CONFIG_MTD_SLRAM is not set
539# CONFIG_MTD_PHRAM is not set 540# CONFIG_MTD_PHRAM is not set
540# CONFIG_MTD_MTDRAM is not set 541# CONFIG_MTD_MTDRAM is not set
@@ -579,6 +580,7 @@ CONFIG_BLK_DEV_RAM_SIZE=4096
579# CONFIG_BLK_DEV_XIP is not set 580# CONFIG_BLK_DEV_XIP is not set
580# CONFIG_CDROM_PKTCDVD is not set 581# CONFIG_CDROM_PKTCDVD is not set
581# CONFIG_ATA_OVER_ETH is not set 582# CONFIG_ATA_OVER_ETH is not set
583# CONFIG_BLK_DEV_HD is not set
582CONFIG_MISC_DEVICES=y 584CONFIG_MISC_DEVICES=y
583# CONFIG_EEPROM_93CX6 is not set 585# CONFIG_EEPROM_93CX6 is not set
584# CONFIG_ENCLOSURE_SERVICES is not set 586# CONFIG_ENCLOSURE_SERVICES is not set
@@ -595,7 +597,6 @@ CONFIG_HAVE_IDE=y
595# CONFIG_ATA is not set 597# CONFIG_ATA is not set
596# CONFIG_MD is not set 598# CONFIG_MD is not set
597CONFIG_NETDEVICES=y 599CONFIG_NETDEVICES=y
598# CONFIG_NETDEVICES_MULTIQUEUE is not set
599# CONFIG_DUMMY is not set 600# CONFIG_DUMMY is not set
600# CONFIG_BONDING is not set 601# CONFIG_BONDING is not set
601# CONFIG_MACVLAN is not set 602# CONFIG_MACVLAN is not set
@@ -633,9 +634,10 @@ CONFIG_BFIN_MAC_RMII=y
633# CONFIG_IBM_NEW_EMAC_RGMII is not set 634# CONFIG_IBM_NEW_EMAC_RGMII is not set
634# CONFIG_IBM_NEW_EMAC_TAH is not set 635# CONFIG_IBM_NEW_EMAC_TAH is not set
635# CONFIG_IBM_NEW_EMAC_EMAC4 is not set 636# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
636# CONFIG_B44 is not set 637# CONFIG_IBM_NEW_EMAC_NO_FLOW_CTRL is not set
638# CONFIG_IBM_NEW_EMAC_MAL_CLR_ICINTSTAT is not set
639# CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set
637CONFIG_NETDEV_1000=y 640CONFIG_NETDEV_1000=y
638# CONFIG_E1000E_ENABLED is not set
639# CONFIG_AX88180 is not set 641# CONFIG_AX88180 is not set
640CONFIG_NETDEV_10000=y 642CONFIG_NETDEV_10000=y
641 643
@@ -667,7 +669,7 @@ CONFIG_NETDEV_10000=y
667# Input device support 669# Input device support
668# 670#
669CONFIG_INPUT=y 671CONFIG_INPUT=y
670# CONFIG_INPUT_FF_MEMLESS is not set 672CONFIG_INPUT_FF_MEMLESS=m
671# CONFIG_INPUT_POLLDEV is not set 673# CONFIG_INPUT_POLLDEV is not set
672 674
673# 675#
@@ -692,8 +694,9 @@ CONFIG_INPUT_MISC=y
692# CONFIG_INPUT_KEYSPAN_REMOTE is not set 694# CONFIG_INPUT_KEYSPAN_REMOTE is not set
693# CONFIG_INPUT_POWERMATE is not set 695# CONFIG_INPUT_POWERMATE is not set
694# CONFIG_INPUT_YEALINK is not set 696# CONFIG_INPUT_YEALINK is not set
697# CONFIG_INPUT_CM109 is not set
695# CONFIG_INPUT_UINPUT is not set 698# CONFIG_INPUT_UINPUT is not set
696# CONFIG_TWI_KEYPAD is not set 699# CONFIG_CONFIG_INPUT_PCF8574 is not set
697 700
698# 701#
699# Hardware I/O ports 702# Hardware I/O ports
@@ -712,12 +715,15 @@ CONFIG_INPUT_MISC=y
712# CONFIG_BFIN_SPORT is not set 715# CONFIG_BFIN_SPORT is not set
713# CONFIG_BFIN_TIMER_LATENCY is not set 716# CONFIG_BFIN_TIMER_LATENCY is not set
714# CONFIG_TWI_LCD is not set 717# CONFIG_TWI_LCD is not set
718CONFIG_BFIN_DMA_INTERFACE=m
715CONFIG_SIMPLE_GPIO=m 719CONFIG_SIMPLE_GPIO=m
716CONFIG_VT=y 720CONFIG_VT=y
721CONFIG_CONSOLE_TRANSLATIONS=y
717CONFIG_VT_CONSOLE=y 722CONFIG_VT_CONSOLE=y
718CONFIG_HW_CONSOLE=y 723CONFIG_HW_CONSOLE=y
719# CONFIG_VT_HW_CONSOLE_BINDING is not set 724# CONFIG_VT_HW_CONSOLE_BINDING is not set
720CONFIG_DEVKMEM=y 725# CONFIG_DEVKMEM is not set
726# CONFIG_BFIN_JTAG_COMM is not set
721# CONFIG_SERIAL_NONSTANDARD is not set 727# CONFIG_SERIAL_NONSTANDARD is not set
722 728
723# 729#
@@ -760,25 +766,39 @@ CONFIG_I2C_HELPER_AUTO=y
760# 766#
761# I2C Hardware Bus support 767# I2C Hardware Bus support
762# 768#
769
770#
771# I2C system bus drivers (mostly embedded / system-on-chip)
772#
763CONFIG_I2C_BLACKFIN_TWI=y 773CONFIG_I2C_BLACKFIN_TWI=y
764CONFIG_I2C_BLACKFIN_TWI_CLK_KHZ=50 774CONFIG_I2C_BLACKFIN_TWI_CLK_KHZ=100
765# CONFIG_I2C_GPIO is not set 775# CONFIG_I2C_GPIO is not set
766# CONFIG_I2C_OCORES is not set 776# CONFIG_I2C_OCORES is not set
767# CONFIG_I2C_PARPORT_LIGHT is not set
768# CONFIG_I2C_SIMTEC is not set 777# CONFIG_I2C_SIMTEC is not set
778
779#
780# External I2C/SMBus adapter drivers
781#
782# CONFIG_I2C_PARPORT_LIGHT is not set
769# CONFIG_I2C_TAOS_EVM is not set 783# CONFIG_I2C_TAOS_EVM is not set
770# CONFIG_I2C_STUB is not set
771# CONFIG_I2C_TINY_USB is not set 784# CONFIG_I2C_TINY_USB is not set
785
786#
787# Other I2C/SMBus bus drivers
788#
772# CONFIG_I2C_PCA_PLATFORM is not set 789# CONFIG_I2C_PCA_PLATFORM is not set
790# CONFIG_I2C_STUB is not set
773 791
774# 792#
775# Miscellaneous I2C Chip support 793# Miscellaneous I2C Chip support
776# 794#
777# CONFIG_DS1682 is not set 795# CONFIG_DS1682 is not set
796# CONFIG_AT24 is not set
778# CONFIG_SENSORS_AD5252 is not set 797# CONFIG_SENSORS_AD5252 is not set
779# CONFIG_SENSORS_EEPROM is not set 798# CONFIG_SENSORS_EEPROM is not set
780# CONFIG_SENSORS_PCF8574 is not set 799# CONFIG_SENSORS_PCF8574 is not set
781# CONFIG_PCF8575 is not set 800# CONFIG_PCF8575 is not set
801# CONFIG_SENSORS_PCA9539 is not set
782# CONFIG_SENSORS_PCF8591 is not set 802# CONFIG_SENSORS_PCF8591 is not set
783# CONFIG_SENSORS_MAX6875 is not set 803# CONFIG_SENSORS_MAX6875 is not set
784# CONFIG_SENSORS_TSL2550 is not set 804# CONFIG_SENSORS_TSL2550 is not set
@@ -787,12 +807,14 @@ CONFIG_I2C_BLACKFIN_TWI_CLK_KHZ=50
787# CONFIG_I2C_DEBUG_BUS is not set 807# CONFIG_I2C_DEBUG_BUS is not set
788# CONFIG_I2C_DEBUG_CHIP is not set 808# CONFIG_I2C_DEBUG_CHIP is not set
789CONFIG_SPI=y 809CONFIG_SPI=y
810# CONFIG_SPI_DEBUG is not set
790CONFIG_SPI_MASTER=y 811CONFIG_SPI_MASTER=y
791 812
792# 813#
793# SPI Master Controller Drivers 814# SPI Master Controller Drivers
794# 815#
795CONFIG_SPI_BFIN=y 816CONFIG_SPI_BFIN=y
817# CONFIG_SPI_BFIN_LOCK is not set
796# CONFIG_SPI_BITBANG is not set 818# CONFIG_SPI_BITBANG is not set
797 819
798# 820#
@@ -801,11 +823,15 @@ CONFIG_SPI_BFIN=y
801# CONFIG_SPI_AT25 is not set 823# CONFIG_SPI_AT25 is not set
802# CONFIG_SPI_SPIDEV is not set 824# CONFIG_SPI_SPIDEV is not set
803# CONFIG_SPI_TLE62X0 is not set 825# CONFIG_SPI_TLE62X0 is not set
826CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y
827# CONFIG_GPIOLIB is not set
804# CONFIG_W1 is not set 828# CONFIG_W1 is not set
805# CONFIG_POWER_SUPPLY is not set 829# CONFIG_POWER_SUPPLY is not set
806CONFIG_HWMON=y 830CONFIG_HWMON=y
807# CONFIG_HWMON_VID is not set 831# CONFIG_HWMON_VID is not set
832# CONFIG_SENSORS_AD7414 is not set
808# CONFIG_SENSORS_AD7418 is not set 833# CONFIG_SENSORS_AD7418 is not set
834# CONFIG_SENSORS_ADCXX is not set
809# CONFIG_SENSORS_ADM1021 is not set 835# CONFIG_SENSORS_ADM1021 is not set
810# CONFIG_SENSORS_ADM1025 is not set 836# CONFIG_SENSORS_ADM1025 is not set
811# CONFIG_SENSORS_ADM1026 is not set 837# CONFIG_SENSORS_ADM1026 is not set
@@ -834,6 +860,7 @@ CONFIG_HWMON=y
834# CONFIG_SENSORS_LM90 is not set 860# CONFIG_SENSORS_LM90 is not set
835# CONFIG_SENSORS_LM92 is not set 861# CONFIG_SENSORS_LM92 is not set
836# CONFIG_SENSORS_LM93 is not set 862# CONFIG_SENSORS_LM93 is not set
863# CONFIG_SENSORS_MAX1111 is not set
837# CONFIG_SENSORS_MAX1619 is not set 864# CONFIG_SENSORS_MAX1619 is not set
838# CONFIG_SENSORS_MAX6650 is not set 865# CONFIG_SENSORS_MAX6650 is not set
839# CONFIG_SENSORS_PC87360 is not set 866# CONFIG_SENSORS_PC87360 is not set
@@ -871,16 +898,14 @@ CONFIG_BFIN_WDT=y
871# CONFIG_USBPCWATCHDOG is not set 898# CONFIG_USBPCWATCHDOG is not set
872 899
873# 900#
874# Sonics Silicon Backplane
875#
876CONFIG_SSB_POSSIBLE=y
877# CONFIG_SSB is not set
878
879#
880# Multifunction device drivers 901# Multifunction device drivers
881# 902#
903# CONFIG_MFD_CORE is not set
882# CONFIG_MFD_SM501 is not set 904# CONFIG_MFD_SM501 is not set
883# CONFIG_HTC_PASIC3 is not set 905# CONFIG_HTC_PASIC3 is not set
906# CONFIG_MFD_TMIO is not set
907# CONFIG_MFD_WM8400 is not set
908# CONFIG_MFD_WM8350_I2C is not set
884 909
885# 910#
886# Multimedia devices 911# Multimedia devices
@@ -915,15 +940,8 @@ CONFIG_SSB_POSSIBLE=y
915# Console display driver support 940# Console display driver support
916# 941#
917CONFIG_DUMMY_CONSOLE=y 942CONFIG_DUMMY_CONSOLE=y
918
919#
920# Sound
921#
922CONFIG_SOUND=m 943CONFIG_SOUND=m
923 944CONFIG_SOUND_OSS_CORE=y
924#
925# Advanced Linux Sound Architecture
926#
927CONFIG_SND=m 945CONFIG_SND=m
928CONFIG_SND_TIMER=m 946CONFIG_SND_TIMER=m
929CONFIG_SND_PCM=m 947CONFIG_SND_PCM=m
@@ -937,56 +955,40 @@ CONFIG_SND_SUPPORT_OLD_API=y
937CONFIG_SND_VERBOSE_PROCFS=y 955CONFIG_SND_VERBOSE_PROCFS=y
938# CONFIG_SND_VERBOSE_PRINTK is not set 956# CONFIG_SND_VERBOSE_PRINTK is not set
939# CONFIG_SND_DEBUG is not set 957# CONFIG_SND_DEBUG is not set
940 958CONFIG_SND_DRIVERS=y
941#
942# Generic devices
943#
944# CONFIG_SND_DUMMY is not set 959# CONFIG_SND_DUMMY is not set
945# CONFIG_SND_MTPAV is not set 960# CONFIG_SND_MTPAV is not set
946# CONFIG_SND_SERIAL_U16550 is not set 961# CONFIG_SND_SERIAL_U16550 is not set
947# CONFIG_SND_MPU401 is not set 962# CONFIG_SND_MPU401 is not set
948 963CONFIG_SND_SPI=y
949#
950# SPI devices
951#
952 964
953# 965#
954# ALSA Blackfin devices 966# ALSA Blackfin devices
955# 967#
956# CONFIG_SND_BLACKFIN_AD1836 is not set 968# CONFIG_SND_BLACKFIN_AD1836 is not set
957# CONFIG_SND_BFIN_AD73311 is not set
958# CONFIG_SND_BFIN_AD73322 is not set 969# CONFIG_SND_BFIN_AD73322 is not set
959 970CONFIG_SND_USB=y
960#
961# USB devices
962#
963# CONFIG_SND_USB_AUDIO is not set 971# CONFIG_SND_USB_AUDIO is not set
964# CONFIG_SND_USB_CAIAQ is not set 972# CONFIG_SND_USB_CAIAQ is not set
965
966#
967# System on Chip audio support
968#
969CONFIG_SND_SOC=m 973CONFIG_SND_SOC=m
974CONFIG_SND_SOC_AC97_BUS=y
970CONFIG_SND_BF5XX_I2S=m 975CONFIG_SND_BF5XX_I2S=m
971CONFIG_SND_BF5XX_SOC_SSM2602=m 976CONFIG_SND_BF5XX_SOC_SSM2602=m
972# CONFIG_SND_BF5XX_AC97 is not set 977# CONFIG_SND_BF5XX_SOC_AD73311 is not set
978CONFIG_SND_BF5XX_AC97=m
979CONFIG_SND_BF5XX_MMAP_SUPPORT=y
980# CONFIG_SND_BF5XX_MULTICHAN_SUPPORT is not set
973CONFIG_SND_BF5XX_SOC_SPORT=m 981CONFIG_SND_BF5XX_SOC_SPORT=m
974CONFIG_SND_BF5XX_SOC_I2S=m 982CONFIG_SND_BF5XX_SOC_I2S=m
983CONFIG_SND_BF5XX_SOC_AC97=m
984CONFIG_SND_BF5XX_SOC_AD1980=m
975CONFIG_SND_BF5XX_SPORT_NUM=0 985CONFIG_SND_BF5XX_SPORT_NUM=0
976 986# CONFIG_SND_BF5XX_HAVE_COLD_RESET is not set
977# 987# CONFIG_SND_SOC_ALL_CODECS is not set
978# ALSA SoC audio for Freescale SOCs 988CONFIG_SND_SOC_AD1980=m
979#
980
981#
982# SoC Audio for the Texas Instruments OMAP
983#
984CONFIG_SND_SOC_SSM2602=m 989CONFIG_SND_SOC_SSM2602=m
985
986#
987# Open Sound System
988#
989# CONFIG_SOUND_PRIME is not set 990# CONFIG_SOUND_PRIME is not set
991CONFIG_AC97_BUS=m
990CONFIG_HID_SUPPORT=y 992CONFIG_HID_SUPPORT=y
991CONFIG_HID=y 993CONFIG_HID=y
992# CONFIG_HID_DEBUG is not set 994# CONFIG_HID_DEBUG is not set
@@ -996,9 +998,36 @@ CONFIG_HID=y
996# USB Input Devices 998# USB Input Devices
997# 999#
998CONFIG_USB_HID=y 1000CONFIG_USB_HID=y
999# CONFIG_USB_HIDINPUT_POWERBOOK is not set 1001# CONFIG_HID_PID is not set
1000# CONFIG_HID_FF is not set
1001# CONFIG_USB_HIDDEV is not set 1002# CONFIG_USB_HIDDEV is not set
1003
1004#
1005# Special HID drivers
1006#
1007CONFIG_HID_COMPAT=y
1008CONFIG_HID_A4TECH=y
1009CONFIG_HID_APPLE=y
1010CONFIG_HID_BELKIN=y
1011CONFIG_HID_BRIGHT=y
1012CONFIG_HID_CHERRY=y
1013CONFIG_HID_CHICONY=y
1014CONFIG_HID_CYPRESS=y
1015CONFIG_HID_DELL=y
1016CONFIG_HID_EZKEY=y
1017CONFIG_HID_GYRATION=y
1018CONFIG_HID_LOGITECH=y
1019# CONFIG_LOGITECH_FF is not set
1020# CONFIG_LOGIRUMBLEPAD2_FF is not set
1021CONFIG_HID_MICROSOFT=y
1022CONFIG_HID_MONTEREY=y
1023CONFIG_HID_PANTHERLORD=y
1024# CONFIG_PANTHERLORD_FF is not set
1025CONFIG_HID_PETALYNX=y
1026CONFIG_HID_SAMSUNG=y
1027CONFIG_HID_SONY=y
1028CONFIG_HID_SUNPLUS=y
1029CONFIG_THRUSTMASTER_FF=m
1030CONFIG_ZEROPLUS_FF=m
1002CONFIG_USB_SUPPORT=y 1031CONFIG_USB_SUPPORT=y
1003CONFIG_USB_ARCH_HAS_HCD=y 1032CONFIG_USB_ARCH_HAS_HCD=y
1004# CONFIG_USB_ARCH_HAS_OHCI is not set 1033# CONFIG_USB_ARCH_HAS_OHCI is not set
@@ -1016,6 +1045,9 @@ CONFIG_USB_DEVICE_CLASS=y
1016# CONFIG_USB_OTG is not set 1045# CONFIG_USB_OTG is not set
1017# CONFIG_USB_OTG_WHITELIST is not set 1046# CONFIG_USB_OTG_WHITELIST is not set
1018CONFIG_USB_OTG_BLACKLIST_HUB=y 1047CONFIG_USB_OTG_BLACKLIST_HUB=y
1048CONFIG_USB_MON=y
1049# CONFIG_USB_WUSB is not set
1050# CONFIG_USB_WUSB_CBAF is not set
1019 1051
1020# 1052#
1021# USB Host Controller Drivers 1053# USB Host Controller Drivers
@@ -1026,6 +1058,7 @@ CONFIG_USB_OTG_BLACKLIST_HUB=y
1026# CONFIG_USB_ISP1362_HCD is not set 1058# CONFIG_USB_ISP1362_HCD is not set
1027# CONFIG_USB_SL811_HCD is not set 1059# CONFIG_USB_SL811_HCD is not set
1028# CONFIG_USB_R8A66597_HCD is not set 1060# CONFIG_USB_R8A66597_HCD is not set
1061# CONFIG_USB_HWA_HCD is not set
1029CONFIG_USB_MUSB_HDRC=y 1062CONFIG_USB_MUSB_HDRC=y
1030CONFIG_USB_MUSB_SOC=y 1063CONFIG_USB_MUSB_SOC=y
1031 1064
@@ -1037,7 +1070,7 @@ CONFIG_USB_MUSB_HOST=y
1037# CONFIG_USB_MUSB_OTG is not set 1070# CONFIG_USB_MUSB_OTG is not set
1038CONFIG_USB_MUSB_HDRC_HCD=y 1071CONFIG_USB_MUSB_HDRC_HCD=y
1039CONFIG_MUSB_PIO_ONLY=y 1072CONFIG_MUSB_PIO_ONLY=y
1040CONFIG_USB_MUSB_LOGLEVEL=0 1073# CONFIG_USB_MUSB_DEBUG is not set
1041 1074
1042# 1075#
1043# USB Device Class drivers 1076# USB Device Class drivers
@@ -1045,6 +1078,7 @@ CONFIG_USB_MUSB_LOGLEVEL=0
1045# CONFIG_USB_ACM is not set 1078# CONFIG_USB_ACM is not set
1046# CONFIG_USB_PRINTER is not set 1079# CONFIG_USB_PRINTER is not set
1047# CONFIG_USB_WDM is not set 1080# CONFIG_USB_WDM is not set
1081# CONFIG_USB_TMC is not set
1048 1082
1049# 1083#
1050# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' 1084# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
@@ -1059,7 +1093,6 @@ CONFIG_USB_MUSB_LOGLEVEL=0
1059# USB Imaging devices 1093# USB Imaging devices
1060# 1094#
1061# CONFIG_USB_MDC800 is not set 1095# CONFIG_USB_MDC800 is not set
1062CONFIG_USB_MON=y
1063 1096
1064# 1097#
1065# USB port drivers 1098# USB port drivers
@@ -1072,7 +1105,7 @@ CONFIG_USB_MON=y
1072# CONFIG_USB_EMI62 is not set 1105# CONFIG_USB_EMI62 is not set
1073# CONFIG_USB_EMI26 is not set 1106# CONFIG_USB_EMI26 is not set
1074# CONFIG_USB_ADUTUX is not set 1107# CONFIG_USB_ADUTUX is not set
1075# CONFIG_USB_AUERSWALD is not set 1108# CONFIG_USB_SEVSEG is not set
1076# CONFIG_USB_RIO500 is not set 1109# CONFIG_USB_RIO500 is not set
1077# CONFIG_USB_LEGOTOWER is not set 1110# CONFIG_USB_LEGOTOWER is not set
1078# CONFIG_USB_LCD is not set 1111# CONFIG_USB_LCD is not set
@@ -1089,6 +1122,7 @@ CONFIG_USB_MON=y
1089# CONFIG_USB_TRANCEVIBRATOR is not set 1122# CONFIG_USB_TRANCEVIBRATOR is not set
1090# CONFIG_USB_IOWARRIOR is not set 1123# CONFIG_USB_IOWARRIOR is not set
1091# CONFIG_USB_ISIGHTFW is not set 1124# CONFIG_USB_ISIGHTFW is not set
1125# CONFIG_USB_VST is not set
1092# CONFIG_USB_GADGET is not set 1126# CONFIG_USB_GADGET is not set
1093# CONFIG_MMC is not set 1127# CONFIG_MMC is not set
1094# CONFIG_MEMSTICK is not set 1128# CONFIG_MEMSTICK is not set
@@ -1128,36 +1162,45 @@ CONFIG_RTC_INTF_DEV=y
1128# 1162#
1129# SPI RTC drivers 1163# SPI RTC drivers
1130# 1164#
1165# CONFIG_RTC_DRV_M41T94 is not set
1166# CONFIG_RTC_DRV_DS1305 is not set
1131# CONFIG_RTC_DRV_MAX6902 is not set 1167# CONFIG_RTC_DRV_MAX6902 is not set
1132# CONFIG_RTC_DRV_R9701 is not set 1168# CONFIG_RTC_DRV_R9701 is not set
1133# CONFIG_RTC_DRV_RS5C348 is not set 1169# CONFIG_RTC_DRV_RS5C348 is not set
1170# CONFIG_RTC_DRV_DS3234 is not set
1134 1171
1135# 1172#
1136# Platform RTC drivers 1173# Platform RTC drivers
1137# 1174#
1175# CONFIG_RTC_DRV_DS1286 is not set
1138# CONFIG_RTC_DRV_DS1511 is not set 1176# CONFIG_RTC_DRV_DS1511 is not set
1139# CONFIG_RTC_DRV_DS1553 is not set 1177# CONFIG_RTC_DRV_DS1553 is not set
1140# CONFIG_RTC_DRV_DS1742 is not set 1178# CONFIG_RTC_DRV_DS1742 is not set
1141# CONFIG_RTC_DRV_STK17TA8 is not set 1179# CONFIG_RTC_DRV_STK17TA8 is not set
1142# CONFIG_RTC_DRV_M48T86 is not set 1180# CONFIG_RTC_DRV_M48T86 is not set
1181# CONFIG_RTC_DRV_M48T35 is not set
1143# CONFIG_RTC_DRV_M48T59 is not set 1182# CONFIG_RTC_DRV_M48T59 is not set
1183# CONFIG_RTC_DRV_BQ4802 is not set
1144# CONFIG_RTC_DRV_V3020 is not set 1184# CONFIG_RTC_DRV_V3020 is not set
1145 1185
1146# 1186#
1147# on-CPU RTC drivers 1187# on-CPU RTC drivers
1148# 1188#
1149CONFIG_RTC_DRV_BFIN=y 1189CONFIG_RTC_DRV_BFIN=y
1190# CONFIG_DMADEVICES is not set
1150# CONFIG_UIO is not set 1191# CONFIG_UIO is not set
1192# CONFIG_STAGING is not set
1151 1193
1152# 1194#
1153# File systems 1195# File systems
1154# 1196#
1155# CONFIG_EXT2_FS is not set 1197# CONFIG_EXT2_FS is not set
1156# CONFIG_EXT3_FS is not set 1198# CONFIG_EXT3_FS is not set
1157# CONFIG_EXT4DEV_FS is not set 1199# CONFIG_EXT4_FS is not set
1158# CONFIG_REISERFS_FS is not set 1200# CONFIG_REISERFS_FS is not set
1159# CONFIG_JFS_FS is not set 1201# CONFIG_JFS_FS is not set
1160# CONFIG_FS_POSIX_ACL is not set 1202# CONFIG_FS_POSIX_ACL is not set
1203CONFIG_FILE_LOCKING=y
1161# CONFIG_XFS_FS is not set 1204# CONFIG_XFS_FS is not set
1162# CONFIG_OCFS2_FS is not set 1205# CONFIG_OCFS2_FS is not set
1163# CONFIG_DNOTIFY is not set 1206# CONFIG_DNOTIFY is not set
@@ -1225,6 +1268,7 @@ CONFIG_JFFS2_RTIME=y
1225# CONFIG_CRAMFS is not set 1268# CONFIG_CRAMFS is not set
1226# CONFIG_VXFS_FS is not set 1269# CONFIG_VXFS_FS is not set
1227# CONFIG_MINIX_FS is not set 1270# CONFIG_MINIX_FS is not set
1271# CONFIG_OMFS_FS is not set
1228# CONFIG_HPFS_FS is not set 1272# CONFIG_HPFS_FS is not set
1229# CONFIG_QNX4FS_FS is not set 1273# CONFIG_QNX4FS_FS is not set
1230# CONFIG_ROMFS_FS is not set 1274# CONFIG_ROMFS_FS is not set
@@ -1240,7 +1284,7 @@ CONFIG_LOCKD=m
1240CONFIG_LOCKD_V4=y 1284CONFIG_LOCKD_V4=y
1241CONFIG_NFS_COMMON=y 1285CONFIG_NFS_COMMON=y
1242CONFIG_SUNRPC=m 1286CONFIG_SUNRPC=m
1243# CONFIG_SUNRPC_BIND34 is not set 1287# CONFIG_SUNRPC_REGISTER_V4 is not set
1244# CONFIG_RPCSEC_GSS_KRB5 is not set 1288# CONFIG_RPCSEC_GSS_KRB5 is not set
1245# CONFIG_RPCSEC_GSS_SPKM3 is not set 1289# CONFIG_RPCSEC_GSS_SPKM3 is not set
1246CONFIG_SMB_FS=m 1290CONFIG_SMB_FS=m
@@ -1308,10 +1352,48 @@ CONFIG_FRAME_WARN=1024
1308# CONFIG_UNUSED_SYMBOLS is not set 1352# CONFIG_UNUSED_SYMBOLS is not set
1309CONFIG_DEBUG_FS=y 1353CONFIG_DEBUG_FS=y
1310# CONFIG_HEADERS_CHECK is not set 1354# CONFIG_HEADERS_CHECK is not set
1311# CONFIG_DEBUG_KERNEL is not set 1355CONFIG_DEBUG_KERNEL=y
1356# CONFIG_DEBUG_SHIRQ is not set
1357CONFIG_DETECT_SOFTLOCKUP=y
1358# CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC is not set
1359CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE=0
1360CONFIG_SCHED_DEBUG=y
1361# CONFIG_SCHEDSTATS is not set
1362# CONFIG_TIMER_STATS is not set
1363# CONFIG_DEBUG_OBJECTS is not set
1364# CONFIG_DEBUG_SLAB is not set
1365# CONFIG_DEBUG_RT_MUTEXES is not set
1366# CONFIG_RT_MUTEX_TESTER is not set
1367# CONFIG_DEBUG_SPINLOCK is not set
1368# CONFIG_DEBUG_MUTEXES is not set
1369# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
1370# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
1371# CONFIG_DEBUG_KOBJECT is not set
1312# CONFIG_DEBUG_BUGVERBOSE is not set 1372# CONFIG_DEBUG_BUGVERBOSE is not set
1373CONFIG_DEBUG_INFO=y
1374# CONFIG_DEBUG_VM is not set
1375# CONFIG_DEBUG_WRITECOUNT is not set
1376# CONFIG_DEBUG_MEMORY_INIT is not set
1377# CONFIG_DEBUG_LIST is not set
1378# CONFIG_DEBUG_SG is not set
1379# CONFIG_FRAME_POINTER is not set
1380# CONFIG_BOOT_PRINTK_DELAY is not set
1381# CONFIG_RCU_TORTURE_TEST is not set
1382# CONFIG_RCU_CPU_STALL_DETECTOR is not set
1383# CONFIG_BACKTRACE_SELF_TEST is not set
1384# CONFIG_DEBUG_BLOCK_EXT_DEVT is not set
1385# CONFIG_FAULT_INJECTION is not set
1386CONFIG_SYSCTL_SYSCALL_CHECK=y
1387# CONFIG_DYNAMIC_PRINTK_DEBUG is not set
1313# CONFIG_SAMPLES is not set 1388# CONFIG_SAMPLES is not set
1389CONFIG_HAVE_ARCH_KGDB=y
1390# CONFIG_KGDB is not set
1391# CONFIG_DEBUG_STACKOVERFLOW is not set
1392# CONFIG_DEBUG_STACK_USAGE is not set
1393CONFIG_DEBUG_VERBOSE=y
1314CONFIG_DEBUG_MMRS=y 1394CONFIG_DEBUG_MMRS=y
1395# CONFIG_DEBUG_HWERR is not set
1396# CONFIG_DEBUG_DOUBLEFAULT is not set
1315CONFIG_DEBUG_HUNT_FOR_ZERO=y 1397CONFIG_DEBUG_HUNT_FOR_ZERO=y
1316CONFIG_DEBUG_BFIN_HWTRACE_ON=y 1398CONFIG_DEBUG_BFIN_HWTRACE_ON=y
1317CONFIG_DEBUG_BFIN_HWTRACE_COMPRESSION_OFF=y 1399CONFIG_DEBUG_BFIN_HWTRACE_COMPRESSION_OFF=y
@@ -1329,8 +1411,9 @@ CONFIG_ACCESS_CHECK=y
1329# 1411#
1330# CONFIG_KEYS is not set 1412# CONFIG_KEYS is not set
1331CONFIG_SECURITY=y 1413CONFIG_SECURITY=y
1414# CONFIG_SECURITYFS is not set
1332# CONFIG_SECURITY_NETWORK is not set 1415# CONFIG_SECURITY_NETWORK is not set
1333# CONFIG_SECURITY_CAPABILITIES is not set 1416# CONFIG_SECURITY_FILE_CAPABILITIES is not set
1334# CONFIG_SECURITY_ROOTPLUG is not set 1417# CONFIG_SECURITY_ROOTPLUG is not set
1335CONFIG_SECURITY_DEFAULT_MMAP_MIN_ADDR=0 1418CONFIG_SECURITY_DEFAULT_MMAP_MIN_ADDR=0
1336CONFIG_CRYPTO=y 1419CONFIG_CRYPTO=y
@@ -1338,6 +1421,7 @@ CONFIG_CRYPTO=y
1338# 1421#
1339# Crypto core or helper 1422# Crypto core or helper
1340# 1423#
1424# CONFIG_CRYPTO_FIPS is not set
1341# CONFIG_CRYPTO_MANAGER is not set 1425# CONFIG_CRYPTO_MANAGER is not set
1342# CONFIG_CRYPTO_GF128MUL is not set 1426# CONFIG_CRYPTO_GF128MUL is not set
1343# CONFIG_CRYPTO_NULL is not set 1427# CONFIG_CRYPTO_NULL is not set
@@ -1376,6 +1460,10 @@ CONFIG_CRYPTO=y
1376# CONFIG_CRYPTO_MD4 is not set 1460# CONFIG_CRYPTO_MD4 is not set
1377# CONFIG_CRYPTO_MD5 is not set 1461# CONFIG_CRYPTO_MD5 is not set
1378# CONFIG_CRYPTO_MICHAEL_MIC is not set 1462# CONFIG_CRYPTO_MICHAEL_MIC is not set
1463# CONFIG_CRYPTO_RMD128 is not set
1464# CONFIG_CRYPTO_RMD160 is not set
1465# CONFIG_CRYPTO_RMD256 is not set
1466# CONFIG_CRYPTO_RMD320 is not set
1379# CONFIG_CRYPTO_SHA1 is not set 1467# CONFIG_CRYPTO_SHA1 is not set
1380# CONFIG_CRYPTO_SHA256 is not set 1468# CONFIG_CRYPTO_SHA256 is not set
1381# CONFIG_CRYPTO_SHA512 is not set 1469# CONFIG_CRYPTO_SHA512 is not set
@@ -1406,15 +1494,20 @@ CONFIG_CRYPTO=y
1406# 1494#
1407# CONFIG_CRYPTO_DEFLATE is not set 1495# CONFIG_CRYPTO_DEFLATE is not set
1408# CONFIG_CRYPTO_LZO is not set 1496# CONFIG_CRYPTO_LZO is not set
1497
1498#
1499# Random Number Generation
1500#
1501# CONFIG_CRYPTO_ANSI_CPRNG is not set
1409CONFIG_CRYPTO_HW=y 1502CONFIG_CRYPTO_HW=y
1410 1503
1411# 1504#
1412# Library routines 1505# Library routines
1413# 1506#
1414CONFIG_BITREVERSE=y 1507CONFIG_BITREVERSE=y
1415# CONFIG_GENERIC_FIND_FIRST_BIT is not set
1416CONFIG_CRC_CCITT=m 1508CONFIG_CRC_CCITT=m
1417# CONFIG_CRC16 is not set 1509# CONFIG_CRC16 is not set
1510# CONFIG_CRC_T10DIF is not set
1418# CONFIG_CRC_ITU_T is not set 1511# CONFIG_CRC_ITU_T is not set
1419CONFIG_CRC32=y 1512CONFIG_CRC32=y
1420# CONFIG_CRC7 is not set 1513# CONFIG_CRC7 is not set
diff --git a/arch/blackfin/configs/BF527-EZKIT_defconfig b/arch/blackfin/configs/BF527-EZKIT_defconfig
index 4a2a660a6b35..f92668af00b0 100644
--- a/arch/blackfin/configs/BF527-EZKIT_defconfig
+++ b/arch/blackfin/configs/BF527-EZKIT_defconfig
@@ -1,6 +1,6 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.24.7 3# Linux kernel version: 2.6.28-rc2
4# 4#
5# CONFIG_MMU is not set 5# CONFIG_MMU is not set
6# CONFIG_FPU is not set 6# CONFIG_FPU is not set
@@ -8,7 +8,6 @@ CONFIG_RWSEM_GENERIC_SPINLOCK=y
8# CONFIG_RWSEM_XCHGADD_ALGORITHM is not set 8# CONFIG_RWSEM_XCHGADD_ALGORITHM is not set
9CONFIG_BLACKFIN=y 9CONFIG_BLACKFIN=y
10CONFIG_ZONE_DMA=y 10CONFIG_ZONE_DMA=y
11CONFIG_SEMAPHORE_SLEEPERS=y
12CONFIG_GENERIC_FIND_NEXT_BIT=y 11CONFIG_GENERIC_FIND_NEXT_BIT=y
13CONFIG_GENERIC_HWEIGHT=y 12CONFIG_GENERIC_HWEIGHT=y
14CONFIG_GENERIC_HARDIRQS=y 13CONFIG_GENERIC_HARDIRQS=y
@@ -31,18 +30,16 @@ CONFIG_SYSVIPC_SYSCTL=y
31# CONFIG_POSIX_MQUEUE is not set 30# CONFIG_POSIX_MQUEUE is not set
32# CONFIG_BSD_PROCESS_ACCT is not set 31# CONFIG_BSD_PROCESS_ACCT is not set
33# CONFIG_TASKSTATS is not set 32# CONFIG_TASKSTATS is not set
34# CONFIG_USER_NS is not set
35# CONFIG_PID_NS is not set
36# CONFIG_AUDIT is not set 33# CONFIG_AUDIT is not set
37CONFIG_IKCONFIG=y 34CONFIG_IKCONFIG=y
38CONFIG_IKCONFIG_PROC=y 35CONFIG_IKCONFIG_PROC=y
39CONFIG_LOG_BUF_SHIFT=14 36CONFIG_LOG_BUF_SHIFT=14
40# CONFIG_CGROUPS is not set 37# CONFIG_CGROUPS is not set
41CONFIG_FAIR_GROUP_SCHED=y 38# CONFIG_GROUP_SCHED is not set
42CONFIG_FAIR_USER_SCHED=y 39# CONFIG_SYSFS_DEPRECATED is not set
43# CONFIG_FAIR_CGROUP_SCHED is not set 40# CONFIG_SYSFS_DEPRECATED_V2 is not set
44CONFIG_SYSFS_DEPRECATED=y
45# CONFIG_RELAY is not set 41# CONFIG_RELAY is not set
42# CONFIG_NAMESPACES is not set
46CONFIG_BLK_DEV_INITRD=y 43CONFIG_BLK_DEV_INITRD=y
47CONFIG_INITRAMFS_SOURCE="" 44CONFIG_INITRAMFS_SOURCE=""
48# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 45# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
@@ -51,26 +48,35 @@ CONFIG_EMBEDDED=y
51CONFIG_UID16=y 48CONFIG_UID16=y
52CONFIG_SYSCTL_SYSCALL=y 49CONFIG_SYSCTL_SYSCALL=y
53CONFIG_KALLSYMS=y 50CONFIG_KALLSYMS=y
51# CONFIG_KALLSYMS_ALL is not set
54# CONFIG_KALLSYMS_EXTRA_PASS is not set 52# CONFIG_KALLSYMS_EXTRA_PASS is not set
55CONFIG_HOTPLUG=y 53CONFIG_HOTPLUG=y
56CONFIG_PRINTK=y 54CONFIG_PRINTK=y
57CONFIG_BUG=y 55CONFIG_BUG=y
58CONFIG_ELF_CORE=y 56# CONFIG_ELF_CORE is not set
57CONFIG_COMPAT_BRK=y
59CONFIG_BASE_FULL=y 58CONFIG_BASE_FULL=y
60CONFIG_FUTEX=y 59CONFIG_FUTEX=y
61CONFIG_ANON_INODES=y 60CONFIG_ANON_INODES=y
62CONFIG_EPOLL=y 61CONFIG_EPOLL=y
63CONFIG_SIGNALFD=y 62CONFIG_SIGNALFD=y
63CONFIG_TIMERFD=y
64CONFIG_EVENTFD=y 64CONFIG_EVENTFD=y
65CONFIG_AIO=y
65CONFIG_VM_EVENT_COUNTERS=y 66CONFIG_VM_EVENT_COUNTERS=y
66CONFIG_SLAB=y 67CONFIG_SLAB=y
67# CONFIG_SLUB is not set 68# CONFIG_SLUB is not set
68# CONFIG_SLOB is not set 69# CONFIG_SLOB is not set
70# CONFIG_PROFILING is not set
71# CONFIG_MARKERS is not set
72CONFIG_HAVE_OPROFILE=y
73# CONFIG_HAVE_GENERIC_DMA_COHERENT is not set
69CONFIG_SLABINFO=y 74CONFIG_SLABINFO=y
70CONFIG_RT_MUTEXES=y 75CONFIG_RT_MUTEXES=y
71CONFIG_TINY_SHMEM=y 76CONFIG_TINY_SHMEM=y
72CONFIG_BASE_SMALL=0 77CONFIG_BASE_SMALL=0
73CONFIG_MODULES=y 78CONFIG_MODULES=y
79# CONFIG_MODULE_FORCE_LOAD is not set
74CONFIG_MODULE_UNLOAD=y 80CONFIG_MODULE_UNLOAD=y
75# CONFIG_MODULE_FORCE_UNLOAD is not set 81# CONFIG_MODULE_FORCE_UNLOAD is not set
76# CONFIG_MODVERSIONS is not set 82# CONFIG_MODVERSIONS is not set
@@ -81,6 +87,7 @@ CONFIG_BLOCK=y
81# CONFIG_BLK_DEV_IO_TRACE is not set 87# CONFIG_BLK_DEV_IO_TRACE is not set
82# CONFIG_LSF is not set 88# CONFIG_LSF is not set
83# CONFIG_BLK_DEV_BSG is not set 89# CONFIG_BLK_DEV_BSG is not set
90# CONFIG_BLK_DEV_INTEGRITY is not set
84 91
85# 92#
86# IO Schedulers 93# IO Schedulers
@@ -94,9 +101,11 @@ CONFIG_DEFAULT_AS=y
94# CONFIG_DEFAULT_CFQ is not set 101# CONFIG_DEFAULT_CFQ is not set
95# CONFIG_DEFAULT_NOOP is not set 102# CONFIG_DEFAULT_NOOP is not set
96CONFIG_DEFAULT_IOSCHED="anticipatory" 103CONFIG_DEFAULT_IOSCHED="anticipatory"
104CONFIG_CLASSIC_RCU=y
97# CONFIG_PREEMPT_NONE is not set 105# CONFIG_PREEMPT_NONE is not set
98CONFIG_PREEMPT_VOLUNTARY=y 106CONFIG_PREEMPT_VOLUNTARY=y
99# CONFIG_PREEMPT is not set 107# CONFIG_PREEMPT is not set
108# CONFIG_FREEZER is not set
100 109
101# 110#
102# Blackfin Processor Options 111# Blackfin Processor Options
@@ -105,6 +114,10 @@ CONFIG_PREEMPT_VOLUNTARY=y
105# 114#
106# Processor and Board Settings 115# Processor and Board Settings
107# 116#
117# CONFIG_BF512 is not set
118# CONFIG_BF514 is not set
119# CONFIG_BF516 is not set
120# CONFIG_BF518 is not set
108# CONFIG_BF522 is not set 121# CONFIG_BF522 is not set
109# CONFIG_BF523 is not set 122# CONFIG_BF523 is not set
110# CONFIG_BF524 is not set 123# CONFIG_BF524 is not set
@@ -117,47 +130,27 @@ CONFIG_BF527=y
117# CONFIG_BF534 is not set 130# CONFIG_BF534 is not set
118# CONFIG_BF536 is not set 131# CONFIG_BF536 is not set
119# CONFIG_BF537 is not set 132# CONFIG_BF537 is not set
133# CONFIG_BF538 is not set
134# CONFIG_BF539 is not set
120# CONFIG_BF542 is not set 135# CONFIG_BF542 is not set
121# CONFIG_BF544 is not set 136# CONFIG_BF544 is not set
122# CONFIG_BF547 is not set 137# CONFIG_BF547 is not set
123# CONFIG_BF548 is not set 138# CONFIG_BF548 is not set
124# CONFIG_BF549 is not set 139# CONFIG_BF549 is not set
125# CONFIG_BF561 is not set 140# CONFIG_BF561 is not set
141CONFIG_BF_REV_MIN=0
142CONFIG_BF_REV_MAX=2
126CONFIG_BF_REV_0_0=y 143CONFIG_BF_REV_0_0=y
127# CONFIG_BF_REV_0_1 is not set 144# CONFIG_BF_REV_0_1 is not set
128# CONFIG_BF_REV_0_2 is not set 145# CONFIG_BF_REV_0_2 is not set
129# CONFIG_BF_REV_0_3 is not set 146# CONFIG_BF_REV_0_3 is not set
130# CONFIG_BF_REV_0_4 is not set 147# CONFIG_BF_REV_0_4 is not set
131# CONFIG_BF_REV_0_5 is not set 148# CONFIG_BF_REV_0_5 is not set
149# CONFIG_BF_REV_0_6 is not set
132# CONFIG_BF_REV_ANY is not set 150# CONFIG_BF_REV_ANY is not set
133# CONFIG_BF_REV_NONE is not set 151# CONFIG_BF_REV_NONE is not set
134CONFIG_BF52x=y 152CONFIG_BF52x=y
135CONFIG_MEM_MT48LC32M16A2TG_75=y 153CONFIG_MEM_MT48LC32M16A2TG_75=y
136CONFIG_BFIN527_EZKIT=y
137
138#
139# BF527 Specific Configuration
140#
141
142#
143# Alternative Multiplexing Scheme
144#
145# CONFIG_BF527_SPORT0_PORTF is not set
146CONFIG_BF527_SPORT0_PORTG=y
147CONFIG_BF527_SPORT0_TSCLK_PG10=y
148# CONFIG_BF527_SPORT0_TSCLK_PG14 is not set
149CONFIG_BF527_UART1_PORTF=y
150# CONFIG_BF527_UART1_PORTG is not set
151# CONFIG_BF527_NAND_D_PORTF is not set
152CONFIG_BF527_NAND_D_PORTH=y
153
154#
155# Interrupt Priority Assignment
156#
157
158#
159# Priority
160#
161CONFIG_IRQ_PLL_WAKEUP=7 154CONFIG_IRQ_PLL_WAKEUP=7
162CONFIG_IRQ_DMA0_ERROR=7 155CONFIG_IRQ_DMA0_ERROR=7
163CONFIG_IRQ_DMAR0_BLK=7 156CONFIG_IRQ_DMAR0_BLK=7
@@ -177,7 +170,6 @@ CONFIG_IRQ_SPORT0_TX=9
177CONFIG_IRQ_SPORT1_RX=9 170CONFIG_IRQ_SPORT1_RX=9
178CONFIG_IRQ_SPORT1_TX=9 171CONFIG_IRQ_SPORT1_TX=9
179CONFIG_IRQ_TWI=10 172CONFIG_IRQ_TWI=10
180CONFIG_IRQ_SPI=10
181CONFIG_IRQ_UART0_RX=10 173CONFIG_IRQ_UART0_RX=10
182CONFIG_IRQ_UART0_TX=10 174CONFIG_IRQ_UART0_TX=10
183CONFIG_IRQ_UART1_RX=10 175CONFIG_IRQ_UART1_RX=10
@@ -188,14 +180,14 @@ CONFIG_IRQ_MAC_RX=11
188CONFIG_IRQ_PORTH_INTA=11 180CONFIG_IRQ_PORTH_INTA=11
189CONFIG_IRQ_MAC_TX=11 181CONFIG_IRQ_MAC_TX=11
190CONFIG_IRQ_PORTH_INTB=11 182CONFIG_IRQ_PORTH_INTB=11
191CONFIG_IRQ_TMR0=12 183CONFIG_IRQ_TIMER0=8
192CONFIG_IRQ_TMR1=12 184CONFIG_IRQ_TIMER1=12
193CONFIG_IRQ_TMR2=12 185CONFIG_IRQ_TIMER2=12
194CONFIG_IRQ_TMR3=12 186CONFIG_IRQ_TIMER3=12
195CONFIG_IRQ_TMR4=12 187CONFIG_IRQ_TIMER4=12
196CONFIG_IRQ_TMR5=12 188CONFIG_IRQ_TIMER5=12
197CONFIG_IRQ_TMR6=12 189CONFIG_IRQ_TIMER6=12
198CONFIG_IRQ_TMR7=12 190CONFIG_IRQ_TIMER7=12
199CONFIG_IRQ_PORTG_INTA=12 191CONFIG_IRQ_PORTG_INTA=12
200CONFIG_IRQ_PORTG_INTB=12 192CONFIG_IRQ_PORTG_INTB=12
201CONFIG_IRQ_MEM_DMA0=13 193CONFIG_IRQ_MEM_DMA0=13
@@ -203,6 +195,34 @@ CONFIG_IRQ_MEM_DMA1=13
203CONFIG_IRQ_WATCH=13 195CONFIG_IRQ_WATCH=13
204CONFIG_IRQ_PORTF_INTA=13 196CONFIG_IRQ_PORTF_INTA=13
205CONFIG_IRQ_PORTF_INTB=13 197CONFIG_IRQ_PORTF_INTB=13
198CONFIG_BFIN527_EZKIT=y
199# CONFIG_BFIN527_BLUETECHNIX_CM is not set
200# CONFIG_BFIN526_EZBRD is not set
201
202#
203# BF527 Specific Configuration
204#
205
206#
207# Alternative Multiplexing Scheme
208#
209# CONFIG_BF527_SPORT0_PORTF is not set
210CONFIG_BF527_SPORT0_PORTG=y
211CONFIG_BF527_SPORT0_TSCLK_PG10=y
212# CONFIG_BF527_SPORT0_TSCLK_PG14 is not set
213CONFIG_BF527_UART1_PORTF=y
214# CONFIG_BF527_UART1_PORTG is not set
215# CONFIG_BF527_NAND_D_PORTF is not set
216CONFIG_BF527_NAND_D_PORTH=y
217
218#
219# Interrupt Priority Assignment
220#
221
222#
223# Priority
224#
225CONFIG_IRQ_SPI=10
206CONFIG_IRQ_SPI_ERROR=7 226CONFIG_IRQ_SPI_ERROR=7
207CONFIG_IRQ_NFC_ERROR=7 227CONFIG_IRQ_NFC_ERROR=7
208CONFIG_IRQ_HDMA_ERROR=7 228CONFIG_IRQ_HDMA_ERROR=7
@@ -224,7 +244,6 @@ CONFIG_BOOT_LOAD=0x1000
224# 244#
225CONFIG_CLKIN_HZ=25000000 245CONFIG_CLKIN_HZ=25000000
226# CONFIG_BFIN_KERNEL_CLOCK is not set 246# CONFIG_BFIN_KERNEL_CLOCK is not set
227CONFIG_MAX_MEM_SIZE=512
228CONFIG_MAX_VCO_HZ=600000000 247CONFIG_MAX_VCO_HZ=600000000
229CONFIG_MIN_VCO_HZ=50000000 248CONFIG_MIN_VCO_HZ=50000000
230CONFIG_MAX_SCLK_HZ=133333333 249CONFIG_MAX_SCLK_HZ=133333333
@@ -238,10 +257,10 @@ CONFIG_HZ_250=y
238# CONFIG_HZ_300 is not set 257# CONFIG_HZ_300 is not set
239# CONFIG_HZ_1000 is not set 258# CONFIG_HZ_1000 is not set
240CONFIG_HZ=250 259CONFIG_HZ=250
260# CONFIG_SCHED_HRTICK is not set
241CONFIG_GENERIC_TIME=y 261CONFIG_GENERIC_TIME=y
242CONFIG_GENERIC_CLOCKEVENTS=y 262CONFIG_GENERIC_CLOCKEVENTS=y
243# CONFIG_CYCLES_CLOCKSOURCE is not set 263# CONFIG_CYCLES_CLOCKSOURCE is not set
244# CONFIG_TICK_ONESHOT is not set
245# CONFIG_NO_HZ is not set 264# CONFIG_NO_HZ is not set
246# CONFIG_HIGH_RES_TIMERS is not set 265# CONFIG_HIGH_RES_TIMERS is not set
247CONFIG_GENERIC_CLOCKEVENTS_BUILD=y 266CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
@@ -275,6 +294,12 @@ CONFIG_ACCESS_OK_L1=y
275CONFIG_CACHELINE_ALIGNED_L1=y 294CONFIG_CACHELINE_ALIGNED_L1=y
276# CONFIG_SYSCALL_TAB_L1 is not set 295# CONFIG_SYSCALL_TAB_L1 is not set
277# CONFIG_CPLB_SWITCH_TAB_L1 is not set 296# CONFIG_CPLB_SWITCH_TAB_L1 is not set
297CONFIG_APP_STACK_L1=y
298
299#
300# Speed Optimizations
301#
302CONFIG_BFIN_INS_LOWOVERHEAD=y
278CONFIG_RAMKERNEL=y 303CONFIG_RAMKERNEL=y
279# CONFIG_ROMKERNEL is not set 304# CONFIG_ROMKERNEL is not set
280CONFIG_SELECT_MEMORY_MODEL=y 305CONFIG_SELECT_MEMORY_MODEL=y
@@ -283,14 +308,13 @@ CONFIG_FLATMEM_MANUAL=y
283# CONFIG_SPARSEMEM_MANUAL is not set 308# CONFIG_SPARSEMEM_MANUAL is not set
284CONFIG_FLATMEM=y 309CONFIG_FLATMEM=y
285CONFIG_FLAT_NODE_MEM_MAP=y 310CONFIG_FLAT_NODE_MEM_MAP=y
286# CONFIG_SPARSEMEM_STATIC is not set 311CONFIG_PAGEFLAGS_EXTENDED=y
287# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
288CONFIG_SPLIT_PTLOCK_CPUS=4 312CONFIG_SPLIT_PTLOCK_CPUS=4
289# CONFIG_RESOURCES_64BIT is not set 313# CONFIG_RESOURCES_64BIT is not set
314# CONFIG_PHYS_ADDR_T_64BIT is not set
290CONFIG_ZONE_DMA_FLAG=1 315CONFIG_ZONE_DMA_FLAG=1
291CONFIG_VIRT_TO_BUS=y 316CONFIG_VIRT_TO_BUS=y
292CONFIG_BFIN_GPTIMERS=y 317CONFIG_BFIN_GPTIMERS=y
293CONFIG_BFIN_DMA_5XX=y
294# CONFIG_DMA_UNCACHED_4M is not set 318# CONFIG_DMA_UNCACHED_4M is not set
295# CONFIG_DMA_UNCACHED_2M is not set 319# CONFIG_DMA_UNCACHED_2M is not set
296CONFIG_DMA_UNCACHED_1M=y 320CONFIG_DMA_UNCACHED_1M=y
@@ -305,7 +329,6 @@ CONFIG_BFIN_DCACHE=y
305# CONFIG_BFIN_ICACHE_LOCK is not set 329# CONFIG_BFIN_ICACHE_LOCK is not set
306# CONFIG_BFIN_WB is not set 330# CONFIG_BFIN_WB is not set
307CONFIG_BFIN_WT=y 331CONFIG_BFIN_WT=y
308CONFIG_L1_MAX_PIECE=16
309# CONFIG_MPU is not set 332# CONFIG_MPU is not set
310 333
311# 334#
@@ -334,7 +357,6 @@ CONFIG_BANK_3=0xFFC0
334# 357#
335# Bus options (PCI, PCMCIA, EISA, MCA, ISA) 358# Bus options (PCI, PCMCIA, EISA, MCA, ISA)
336# 359#
337# CONFIG_PCI is not set
338# CONFIG_ARCH_SUPPORTS_MSI is not set 360# CONFIG_ARCH_SUPPORTS_MSI is not set
339# CONFIG_PCCARD is not set 361# CONFIG_PCCARD is not set
340 362
@@ -345,23 +367,20 @@ CONFIG_BINFMT_ELF_FDPIC=y
345CONFIG_BINFMT_FLAT=y 367CONFIG_BINFMT_FLAT=y
346CONFIG_BINFMT_ZFLAT=y 368CONFIG_BINFMT_ZFLAT=y
347# CONFIG_BINFMT_SHARED_FLAT is not set 369# CONFIG_BINFMT_SHARED_FLAT is not set
370# CONFIG_HAVE_AOUT is not set
348# CONFIG_BINFMT_MISC is not set 371# CONFIG_BINFMT_MISC is not set
349 372
350# 373#
351# Power management options 374# Power management options
352# 375#
353# CONFIG_PM is not set 376# CONFIG_PM is not set
354CONFIG_SUSPEND_UP_POSSIBLE=y 377CONFIG_ARCH_SUSPEND_POSSIBLE=y
355# CONFIG_PM_WAKEUP_BY_GPIO is not set 378# CONFIG_PM_WAKEUP_BY_GPIO is not set
356 379
357# 380#
358# CPU Frequency scaling 381# CPU Frequency scaling
359# 382#
360# CONFIG_CPU_FREQ is not set 383# CONFIG_CPU_FREQ is not set
361
362#
363# Networking
364#
365CONFIG_NET=y 384CONFIG_NET=y
366 385
367# 386#
@@ -374,6 +393,7 @@ CONFIG_XFRM=y
374# CONFIG_XFRM_USER is not set 393# CONFIG_XFRM_USER is not set
375# CONFIG_XFRM_SUB_POLICY is not set 394# CONFIG_XFRM_SUB_POLICY is not set
376# CONFIG_XFRM_MIGRATE is not set 395# CONFIG_XFRM_MIGRATE is not set
396# CONFIG_XFRM_STATISTICS is not set
377# CONFIG_NET_KEY is not set 397# CONFIG_NET_KEY is not set
378CONFIG_INET=y 398CONFIG_INET=y
379# CONFIG_IP_MULTICAST is not set 399# CONFIG_IP_MULTICAST is not set
@@ -403,8 +423,6 @@ CONFIG_TCP_CONG_CUBIC=y
403CONFIG_DEFAULT_TCP_CONG="cubic" 423CONFIG_DEFAULT_TCP_CONG="cubic"
404# CONFIG_TCP_MD5SIG is not set 424# CONFIG_TCP_MD5SIG is not set
405# CONFIG_IPV6 is not set 425# CONFIG_IPV6 is not set
406# CONFIG_INET6_XFRM_TUNNEL is not set
407# CONFIG_INET6_TUNNEL is not set
408# CONFIG_NETLABEL is not set 426# CONFIG_NETLABEL is not set
409# CONFIG_NETWORK_SECMARK is not set 427# CONFIG_NETWORK_SECMARK is not set
410# CONFIG_NETFILTER is not set 428# CONFIG_NETFILTER is not set
@@ -413,6 +431,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
413# CONFIG_TIPC is not set 431# CONFIG_TIPC is not set
414# CONFIG_ATM is not set 432# CONFIG_ATM is not set
415# CONFIG_BRIDGE is not set 433# CONFIG_BRIDGE is not set
434# CONFIG_NET_DSA is not set
416# CONFIG_VLAN_8021Q is not set 435# CONFIG_VLAN_8021Q is not set
417# CONFIG_DECNET is not set 436# CONFIG_DECNET is not set
418# CONFIG_LLC2 is not set 437# CONFIG_LLC2 is not set
@@ -429,6 +448,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
429# 448#
430# CONFIG_NET_PKTGEN is not set 449# CONFIG_NET_PKTGEN is not set
431# CONFIG_HAMRADIO is not set 450# CONFIG_HAMRADIO is not set
451# CONFIG_CAN is not set
432CONFIG_IRDA=m 452CONFIG_IRDA=m
433 453
434# 454#
@@ -467,15 +487,6 @@ CONFIG_SIR_BFIN_DMA=y
467# CONFIG_KS959_DONGLE is not set 487# CONFIG_KS959_DONGLE is not set
468 488
469# 489#
470# Old SIR device drivers
471#
472# CONFIG_IRPORT_SIR is not set
473
474#
475# Old Serial dongle support
476#
477
478#
479# FIR device drivers 490# FIR device drivers
480# 491#
481# CONFIG_USB_IRDA is not set 492# CONFIG_USB_IRDA is not set
@@ -483,11 +494,10 @@ CONFIG_SIR_BFIN_DMA=y
483# CONFIG_MCS_FIR is not set 494# CONFIG_MCS_FIR is not set
484# CONFIG_BT is not set 495# CONFIG_BT is not set
485# CONFIG_AF_RXRPC is not set 496# CONFIG_AF_RXRPC is not set
486 497# CONFIG_PHONET is not set
487# 498CONFIG_WIRELESS=y
488# Wireless
489#
490# CONFIG_CFG80211 is not set 499# CONFIG_CFG80211 is not set
500CONFIG_WIRELESS_OLD_REGULATORY=y
491# CONFIG_WIRELESS_EXT is not set 501# CONFIG_WIRELESS_EXT is not set
492# CONFIG_MAC80211 is not set 502# CONFIG_MAC80211 is not set
493# CONFIG_IEEE80211 is not set 503# CONFIG_IEEE80211 is not set
@@ -505,6 +515,8 @@ CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
505CONFIG_STANDALONE=y 515CONFIG_STANDALONE=y
506CONFIG_PREVENT_FIRMWARE_BUILD=y 516CONFIG_PREVENT_FIRMWARE_BUILD=y
507# CONFIG_FW_LOADER is not set 517# CONFIG_FW_LOADER is not set
518# CONFIG_DEBUG_DRIVER is not set
519# CONFIG_DEBUG_DEVRES is not set
508# CONFIG_SYS_HYPERVISOR is not set 520# CONFIG_SYS_HYPERVISOR is not set
509# CONFIG_CONNECTOR is not set 521# CONFIG_CONNECTOR is not set
510CONFIG_MTD=y 522CONFIG_MTD=y
@@ -513,6 +525,7 @@ CONFIG_MTD=y
513CONFIG_MTD_PARTITIONS=y 525CONFIG_MTD_PARTITIONS=y
514# CONFIG_MTD_REDBOOT_PARTS is not set 526# CONFIG_MTD_REDBOOT_PARTS is not set
515# CONFIG_MTD_CMDLINE_PARTS is not set 527# CONFIG_MTD_CMDLINE_PARTS is not set
528# CONFIG_MTD_AR7_PARTS is not set
516 529
517# 530#
518# User Modules And Translation Layers 531# User Modules And Translation Layers
@@ -556,6 +569,7 @@ CONFIG_MTD_ROM=m
556# 569#
557CONFIG_MTD_COMPLEX_MAPPINGS=y 570CONFIG_MTD_COMPLEX_MAPPINGS=y
558# CONFIG_MTD_PHYSMAP is not set 571# CONFIG_MTD_PHYSMAP is not set
572# CONFIG_MTD_GPIO_ADDR is not set
559# CONFIG_MTD_UCLINUX is not set 573# CONFIG_MTD_UCLINUX is not set
560# CONFIG_MTD_PLATRAM is not set 574# CONFIG_MTD_PLATRAM is not set
561 575
@@ -563,7 +577,8 @@ CONFIG_MTD_COMPLEX_MAPPINGS=y
563# Self-contained MTD device drivers 577# Self-contained MTD device drivers
564# 578#
565# CONFIG_MTD_DATAFLASH is not set 579# CONFIG_MTD_DATAFLASH is not set
566# CONFIG_MTD_M25P80 is not set 580CONFIG_MTD_M25P80=y
581CONFIG_M25PXX_USE_FAST_READ=y
567# CONFIG_MTD_SLRAM is not set 582# CONFIG_MTD_SLRAM is not set
568# CONFIG_MTD_PHRAM is not set 583# CONFIG_MTD_PHRAM is not set
569# CONFIG_MTD_MTDRAM is not set 584# CONFIG_MTD_MTDRAM is not set
@@ -605,11 +620,14 @@ CONFIG_BLK_DEV=y
605CONFIG_BLK_DEV_RAM=y 620CONFIG_BLK_DEV_RAM=y
606CONFIG_BLK_DEV_RAM_COUNT=16 621CONFIG_BLK_DEV_RAM_COUNT=16
607CONFIG_BLK_DEV_RAM_SIZE=4096 622CONFIG_BLK_DEV_RAM_SIZE=4096
608CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024 623# CONFIG_BLK_DEV_XIP is not set
609# CONFIG_CDROM_PKTCDVD is not set 624# CONFIG_CDROM_PKTCDVD is not set
610# CONFIG_ATA_OVER_ETH is not set 625# CONFIG_ATA_OVER_ETH is not set
626# CONFIG_BLK_DEV_HD is not set
611CONFIG_MISC_DEVICES=y 627CONFIG_MISC_DEVICES=y
612# CONFIG_EEPROM_93CX6 is not set 628# CONFIG_EEPROM_93CX6 is not set
629# CONFIG_ENCLOSURE_SERVICES is not set
630CONFIG_HAVE_IDE=y
613# CONFIG_IDE is not set 631# CONFIG_IDE is not set
614 632
615# 633#
@@ -622,7 +640,6 @@ CONFIG_MISC_DEVICES=y
622# CONFIG_ATA is not set 640# CONFIG_ATA is not set
623# CONFIG_MD is not set 641# CONFIG_MD is not set
624CONFIG_NETDEVICES=y 642CONFIG_NETDEVICES=y
625# CONFIG_NETDEVICES_MULTIQUEUE is not set
626# CONFIG_DUMMY is not set 643# CONFIG_DUMMY is not set
627# CONFIG_BONDING is not set 644# CONFIG_BONDING is not set
628# CONFIG_MACVLAN is not set 645# CONFIG_MACVLAN is not set
@@ -643,6 +660,7 @@ CONFIG_PHYLIB=y
643# CONFIG_SMSC_PHY is not set 660# CONFIG_SMSC_PHY is not set
644# CONFIG_BROADCOM_PHY is not set 661# CONFIG_BROADCOM_PHY is not set
645# CONFIG_ICPLUS_PHY is not set 662# CONFIG_ICPLUS_PHY is not set
663# CONFIG_REALTEK_PHY is not set
646# CONFIG_FIXED_PHY is not set 664# CONFIG_FIXED_PHY is not set
647# CONFIG_MDIO_BITBANG is not set 665# CONFIG_MDIO_BITBANG is not set
648CONFIG_NET_ETHERNET=y 666CONFIG_NET_ETHERNET=y
@@ -655,11 +673,14 @@ CONFIG_BFIN_MAC_RMII=y
655# CONFIG_SMC91X is not set 673# CONFIG_SMC91X is not set
656# CONFIG_SMSC911X is not set 674# CONFIG_SMSC911X is not set
657# CONFIG_DM9000 is not set 675# CONFIG_DM9000 is not set
676# CONFIG_ENC28J60 is not set
658# CONFIG_IBM_NEW_EMAC_ZMII is not set 677# CONFIG_IBM_NEW_EMAC_ZMII is not set
659# CONFIG_IBM_NEW_EMAC_RGMII is not set 678# CONFIG_IBM_NEW_EMAC_RGMII is not set
660# CONFIG_IBM_NEW_EMAC_TAH is not set 679# CONFIG_IBM_NEW_EMAC_TAH is not set
661# CONFIG_IBM_NEW_EMAC_EMAC4 is not set 680# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
662# CONFIG_B44 is not set 681# CONFIG_IBM_NEW_EMAC_NO_FLOW_CTRL is not set
682# CONFIG_IBM_NEW_EMAC_MAL_CLR_ICINTSTAT is not set
683# CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set
663CONFIG_NETDEV_1000=y 684CONFIG_NETDEV_1000=y
664# CONFIG_AX88180 is not set 685# CONFIG_AX88180 is not set
665CONFIG_NETDEV_10000=y 686CONFIG_NETDEV_10000=y
@@ -669,6 +690,7 @@ CONFIG_NETDEV_10000=y
669# 690#
670# CONFIG_WLAN_PRE80211 is not set 691# CONFIG_WLAN_PRE80211 is not set
671# CONFIG_WLAN_80211 is not set 692# CONFIG_WLAN_80211 is not set
693# CONFIG_IWLWIFI_LEDS is not set
672 694
673# 695#
674# USB Network Adapters 696# USB Network Adapters
@@ -681,7 +703,6 @@ CONFIG_NETDEV_10000=y
681# CONFIG_WAN is not set 703# CONFIG_WAN is not set
682# CONFIG_PPP is not set 704# CONFIG_PPP is not set
683# CONFIG_SLIP is not set 705# CONFIG_SLIP is not set
684# CONFIG_SHAPER is not set
685# CONFIG_NETCONSOLE is not set 706# CONFIG_NETCONSOLE is not set
686# CONFIG_NETPOLL is not set 707# CONFIG_NETPOLL is not set
687# CONFIG_NET_POLL_CONTROLLER is not set 708# CONFIG_NET_POLL_CONTROLLER is not set
@@ -692,7 +713,7 @@ CONFIG_NETDEV_10000=y
692# Input device support 713# Input device support
693# 714#
694CONFIG_INPUT=y 715CONFIG_INPUT=y
695# CONFIG_INPUT_FF_MEMLESS is not set 716CONFIG_INPUT_FF_MEMLESS=m
696# CONFIG_INPUT_POLLDEV is not set 717# CONFIG_INPUT_POLLDEV is not set
697 718
698# 719#
@@ -717,8 +738,9 @@ CONFIG_INPUT_MISC=y
717# CONFIG_INPUT_KEYSPAN_REMOTE is not set 738# CONFIG_INPUT_KEYSPAN_REMOTE is not set
718# CONFIG_INPUT_POWERMATE is not set 739# CONFIG_INPUT_POWERMATE is not set
719# CONFIG_INPUT_YEALINK is not set 740# CONFIG_INPUT_YEALINK is not set
741# CONFIG_INPUT_CM109 is not set
720# CONFIG_INPUT_UINPUT is not set 742# CONFIG_INPUT_UINPUT is not set
721# CONFIG_TWI_KEYPAD is not set 743# CONFIG_CONFIG_INPUT_PCF8574 is not set
722 744
723# 745#
724# Hardware I/O ports 746# Hardware I/O ports
@@ -734,16 +756,18 @@ CONFIG_INPUT_MISC=y
734# CONFIG_BF5xx_PPIFCD is not set 756# CONFIG_BF5xx_PPIFCD is not set
735# CONFIG_BFIN_SIMPLE_TIMER is not set 757# CONFIG_BFIN_SIMPLE_TIMER is not set
736# CONFIG_BF5xx_PPI is not set 758# CONFIG_BF5xx_PPI is not set
737CONFIG_BFIN_OTP=y
738# CONFIG_BFIN_OTP_WRITE_ENABLE is not set
739# CONFIG_BFIN_SPORT is not set 759# CONFIG_BFIN_SPORT is not set
740# CONFIG_BFIN_TIMER_LATENCY is not set 760# CONFIG_BFIN_TIMER_LATENCY is not set
741# CONFIG_TWI_LCD is not set 761# CONFIG_TWI_LCD is not set
762CONFIG_BFIN_DMA_INTERFACE=m
742CONFIG_SIMPLE_GPIO=m 763CONFIG_SIMPLE_GPIO=m
743CONFIG_VT=y 764CONFIG_VT=y
765CONFIG_CONSOLE_TRANSLATIONS=y
744CONFIG_VT_CONSOLE=y 766CONFIG_VT_CONSOLE=y
745CONFIG_HW_CONSOLE=y 767CONFIG_HW_CONSOLE=y
746# CONFIG_VT_HW_CONSOLE_BINDING is not set 768# CONFIG_VT_HW_CONSOLE_BINDING is not set
769# CONFIG_DEVKMEM is not set
770# CONFIG_BFIN_JTAG_COMM is not set
747# CONFIG_SERIAL_NONSTANDARD is not set 771# CONFIG_SERIAL_NONSTANDARD is not set
748 772
749# 773#
@@ -766,6 +790,8 @@ CONFIG_SERIAL_CORE_CONSOLE=y
766# CONFIG_SERIAL_BFIN_SPORT is not set 790# CONFIG_SERIAL_BFIN_SPORT is not set
767CONFIG_UNIX98_PTYS=y 791CONFIG_UNIX98_PTYS=y
768# CONFIG_LEGACY_PTYS is not set 792# CONFIG_LEGACY_PTYS is not set
793CONFIG_BFIN_OTP=y
794# CONFIG_BFIN_OTP_WRITE_ENABLE is not set
769 795
770# 796#
771# CAN, the car bus and industrial fieldbus 797# CAN, the car bus and industrial fieldbus
@@ -773,44 +799,49 @@ CONFIG_UNIX98_PTYS=y
773# CONFIG_CAN4LINUX is not set 799# CONFIG_CAN4LINUX is not set
774# CONFIG_IPMI_HANDLER is not set 800# CONFIG_IPMI_HANDLER is not set
775# CONFIG_HW_RANDOM is not set 801# CONFIG_HW_RANDOM is not set
776# CONFIG_GEN_RTC is not set
777# CONFIG_R3964 is not set 802# CONFIG_R3964 is not set
778# CONFIG_RAW_DRIVER is not set 803# CONFIG_RAW_DRIVER is not set
779# CONFIG_TCG_TPM is not set 804# CONFIG_TCG_TPM is not set
780CONFIG_I2C=y 805CONFIG_I2C=y
781CONFIG_I2C_BOARDINFO=y 806CONFIG_I2C_BOARDINFO=y
782CONFIG_I2C_CHARDEV=m 807CONFIG_I2C_CHARDEV=m
808CONFIG_I2C_HELPER_AUTO=y
783 809
784# 810#
785# I2C Algorithms 811# I2C Hardware Bus support
786# 812#
787# CONFIG_I2C_ALGOBIT is not set
788# CONFIG_I2C_ALGOPCF is not set
789# CONFIG_I2C_ALGOPCA is not set
790 813
791# 814#
792# I2C Hardware Bus support 815# I2C system bus drivers (mostly embedded / system-on-chip)
793# 816#
794CONFIG_I2C_BLACKFIN_TWI=m 817CONFIG_I2C_BLACKFIN_TWI=m
795CONFIG_I2C_BLACKFIN_TWI_CLK_KHZ=50 818CONFIG_I2C_BLACKFIN_TWI_CLK_KHZ=100
796# CONFIG_I2C_GPIO is not set 819# CONFIG_I2C_GPIO is not set
797# CONFIG_I2C_OCORES is not set 820# CONFIG_I2C_OCORES is not set
798# CONFIG_I2C_PARPORT_LIGHT is not set
799# CONFIG_I2C_SIMTEC is not set 821# CONFIG_I2C_SIMTEC is not set
822
823#
824# External I2C/SMBus adapter drivers
825#
826# CONFIG_I2C_PARPORT_LIGHT is not set
800# CONFIG_I2C_TAOS_EVM is not set 827# CONFIG_I2C_TAOS_EVM is not set
801# CONFIG_I2C_STUB is not set
802# CONFIG_I2C_TINY_USB is not set 828# CONFIG_I2C_TINY_USB is not set
803 829
804# 830#
831# Other I2C/SMBus bus drivers
832#
833# CONFIG_I2C_PCA_PLATFORM is not set
834# CONFIG_I2C_STUB is not set
835
836#
805# Miscellaneous I2C Chip support 837# Miscellaneous I2C Chip support
806# 838#
807# CONFIG_SENSORS_DS1337 is not set
808# CONFIG_SENSORS_DS1374 is not set
809# CONFIG_DS1682 is not set 839# CONFIG_DS1682 is not set
840# CONFIG_AT24 is not set
810# CONFIG_SENSORS_AD5252 is not set 841# CONFIG_SENSORS_AD5252 is not set
811# CONFIG_SENSORS_EEPROM is not set 842# CONFIG_SENSORS_EEPROM is not set
812# CONFIG_SENSORS_PCF8574 is not set 843# CONFIG_SENSORS_PCF8574 is not set
813# CONFIG_SENSORS_PCF8575 is not set 844# CONFIG_PCF8575 is not set
814# CONFIG_SENSORS_PCA9539 is not set 845# CONFIG_SENSORS_PCA9539 is not set
815# CONFIG_SENSORS_PCF8591 is not set 846# CONFIG_SENSORS_PCF8591 is not set
816# CONFIG_SENSORS_MAX6875 is not set 847# CONFIG_SENSORS_MAX6875 is not set
@@ -819,17 +850,15 @@ CONFIG_I2C_BLACKFIN_TWI_CLK_KHZ=50
819# CONFIG_I2C_DEBUG_ALGO is not set 850# CONFIG_I2C_DEBUG_ALGO is not set
820# CONFIG_I2C_DEBUG_BUS is not set 851# CONFIG_I2C_DEBUG_BUS is not set
821# CONFIG_I2C_DEBUG_CHIP is not set 852# CONFIG_I2C_DEBUG_CHIP is not set
822
823#
824# SPI support
825#
826CONFIG_SPI=y 853CONFIG_SPI=y
854# CONFIG_SPI_DEBUG is not set
827CONFIG_SPI_MASTER=y 855CONFIG_SPI_MASTER=y
828 856
829# 857#
830# SPI Master Controller Drivers 858# SPI Master Controller Drivers
831# 859#
832CONFIG_SPI_BFIN=y 860CONFIG_SPI_BFIN=y
861# CONFIG_SPI_BFIN_LOCK is not set
833# CONFIG_SPI_BITBANG is not set 862# CONFIG_SPI_BITBANG is not set
834 863
835# 864#
@@ -838,11 +867,15 @@ CONFIG_SPI_BFIN=y
838# CONFIG_SPI_AT25 is not set 867# CONFIG_SPI_AT25 is not set
839# CONFIG_SPI_SPIDEV is not set 868# CONFIG_SPI_SPIDEV is not set
840# CONFIG_SPI_TLE62X0 is not set 869# CONFIG_SPI_TLE62X0 is not set
870CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y
871# CONFIG_GPIOLIB is not set
841# CONFIG_W1 is not set 872# CONFIG_W1 is not set
842# CONFIG_POWER_SUPPLY is not set 873# CONFIG_POWER_SUPPLY is not set
843CONFIG_HWMON=y 874CONFIG_HWMON=y
844# CONFIG_HWMON_VID is not set 875# CONFIG_HWMON_VID is not set
876# CONFIG_SENSORS_AD7414 is not set
845# CONFIG_SENSORS_AD7418 is not set 877# CONFIG_SENSORS_AD7418 is not set
878# CONFIG_SENSORS_ADCXX is not set
846# CONFIG_SENSORS_ADM1021 is not set 879# CONFIG_SENSORS_ADM1021 is not set
847# CONFIG_SENSORS_ADM1025 is not set 880# CONFIG_SENSORS_ADM1025 is not set
848# CONFIG_SENSORS_ADM1026 is not set 881# CONFIG_SENSORS_ADM1026 is not set
@@ -850,6 +883,7 @@ CONFIG_HWMON=y
850# CONFIG_SENSORS_ADM1031 is not set 883# CONFIG_SENSORS_ADM1031 is not set
851# CONFIG_SENSORS_ADM9240 is not set 884# CONFIG_SENSORS_ADM9240 is not set
852# CONFIG_SENSORS_ADT7470 is not set 885# CONFIG_SENSORS_ADT7470 is not set
886# CONFIG_SENSORS_ADT7473 is not set
853# CONFIG_SENSORS_ATXP1 is not set 887# CONFIG_SENSORS_ATXP1 is not set
854# CONFIG_SENSORS_DS1621 is not set 888# CONFIG_SENSORS_DS1621 is not set
855# CONFIG_SENSORS_F71805F is not set 889# CONFIG_SENSORS_F71805F is not set
@@ -870,6 +904,7 @@ CONFIG_HWMON=y
870# CONFIG_SENSORS_LM90 is not set 904# CONFIG_SENSORS_LM90 is not set
871# CONFIG_SENSORS_LM92 is not set 905# CONFIG_SENSORS_LM92 is not set
872# CONFIG_SENSORS_LM93 is not set 906# CONFIG_SENSORS_LM93 is not set
907# CONFIG_SENSORS_MAX1111 is not set
873# CONFIG_SENSORS_MAX1619 is not set 908# CONFIG_SENSORS_MAX1619 is not set
874# CONFIG_SENSORS_MAX6650 is not set 909# CONFIG_SENSORS_MAX6650 is not set
875# CONFIG_SENSORS_PC87360 is not set 910# CONFIG_SENSORS_PC87360 is not set
@@ -878,6 +913,7 @@ CONFIG_HWMON=y
878# CONFIG_SENSORS_SMSC47M1 is not set 913# CONFIG_SENSORS_SMSC47M1 is not set
879# CONFIG_SENSORS_SMSC47M192 is not set 914# CONFIG_SENSORS_SMSC47M192 is not set
880# CONFIG_SENSORS_SMSC47B397 is not set 915# CONFIG_SENSORS_SMSC47B397 is not set
916# CONFIG_SENSORS_ADS7828 is not set
881# CONFIG_SENSORS_THMC50 is not set 917# CONFIG_SENSORS_THMC50 is not set
882# CONFIG_SENSORS_VT1211 is not set 918# CONFIG_SENSORS_VT1211 is not set
883# CONFIG_SENSORS_W83781D is not set 919# CONFIG_SENSORS_W83781D is not set
@@ -885,9 +921,12 @@ CONFIG_HWMON=y
885# CONFIG_SENSORS_W83792D is not set 921# CONFIG_SENSORS_W83792D is not set
886# CONFIG_SENSORS_W83793 is not set 922# CONFIG_SENSORS_W83793 is not set
887# CONFIG_SENSORS_W83L785TS is not set 923# CONFIG_SENSORS_W83L785TS is not set
924# CONFIG_SENSORS_W83L786NG is not set
888# CONFIG_SENSORS_W83627HF is not set 925# CONFIG_SENSORS_W83627HF is not set
889# CONFIG_SENSORS_W83627EHF is not set 926# CONFIG_SENSORS_W83627EHF is not set
890# CONFIG_HWMON_DEBUG_CHIP is not set 927# CONFIG_HWMON_DEBUG_CHIP is not set
928# CONFIG_THERMAL is not set
929# CONFIG_THERMAL_HWMON is not set
891CONFIG_WATCHDOG=y 930CONFIG_WATCHDOG=y
892# CONFIG_WATCHDOG_NOWAYOUT is not set 931# CONFIG_WATCHDOG_NOWAYOUT is not set
893 932
@@ -903,21 +942,29 @@ CONFIG_BFIN_WDT=y
903# CONFIG_USBPCWATCHDOG is not set 942# CONFIG_USBPCWATCHDOG is not set
904 943
905# 944#
906# Sonics Silicon Backplane
907#
908CONFIG_SSB_POSSIBLE=y
909# CONFIG_SSB is not set
910
911#
912# Multifunction device drivers 945# Multifunction device drivers
913# 946#
947# CONFIG_MFD_CORE is not set
914# CONFIG_MFD_SM501 is not set 948# CONFIG_MFD_SM501 is not set
949# CONFIG_HTC_PASIC3 is not set
950# CONFIG_MFD_TMIO is not set
951# CONFIG_MFD_WM8400 is not set
952# CONFIG_MFD_WM8350_I2C is not set
915 953
916# 954#
917# Multimedia devices 955# Multimedia devices
918# 956#
957
958#
959# Multimedia core support
960#
919# CONFIG_VIDEO_DEV is not set 961# CONFIG_VIDEO_DEV is not set
920# CONFIG_DVB_CORE is not set 962# CONFIG_DVB_CORE is not set
963# CONFIG_VIDEO_MEDIA is not set
964
965#
966# Multimedia drivers
967#
921# CONFIG_DAB is not set 968# CONFIG_DAB is not set
922 969
923# 970#
@@ -928,6 +975,7 @@ CONFIG_SSB_POSSIBLE=y
928CONFIG_FB=y 975CONFIG_FB=y
929# CONFIG_FIRMWARE_EDID is not set 976# CONFIG_FIRMWARE_EDID is not set
930# CONFIG_FB_DDC is not set 977# CONFIG_FB_DDC is not set
978# CONFIG_FB_BOOT_VESA_SUPPORT is not set
931CONFIG_FB_CFB_FILLRECT=y 979CONFIG_FB_CFB_FILLRECT=y
932CONFIG_FB_CFB_COPYAREA=y 980CONFIG_FB_CFB_COPYAREA=y
933CONFIG_FB_CFB_IMAGEBLIT=y 981CONFIG_FB_CFB_IMAGEBLIT=y
@@ -935,8 +983,8 @@ CONFIG_FB_CFB_IMAGEBLIT=y
935# CONFIG_FB_SYS_FILLRECT is not set 983# CONFIG_FB_SYS_FILLRECT is not set
936# CONFIG_FB_SYS_COPYAREA is not set 984# CONFIG_FB_SYS_COPYAREA is not set
937# CONFIG_FB_SYS_IMAGEBLIT is not set 985# CONFIG_FB_SYS_IMAGEBLIT is not set
986# CONFIG_FB_FOREIGN_ENDIAN is not set
938# CONFIG_FB_SYS_FOPS is not set 987# CONFIG_FB_SYS_FOPS is not set
939CONFIG_FB_DEFERRED_IO=y
940# CONFIG_FB_SVGALIB is not set 988# CONFIG_FB_SVGALIB is not set
941# CONFIG_FB_MACMODES is not set 989# CONFIG_FB_MACMODES is not set
942# CONFIG_FB_BACKLIGHT is not set 990# CONFIG_FB_BACKLIGHT is not set
@@ -947,12 +995,18 @@ CONFIG_FB_DEFERRED_IO=y
947# Frame buffer hardware drivers 995# Frame buffer hardware drivers
948# 996#
949CONFIG_FB_BFIN_T350MCQB=y 997CONFIG_FB_BFIN_T350MCQB=y
998# CONFIG_FB_BFIN_LQ035Q1 is not set
950# CONFIG_FB_BFIN_7393 is not set 999# CONFIG_FB_BFIN_7393 is not set
951# CONFIG_FB_S1D13XXX is not set 1000# CONFIG_FB_S1D13XXX is not set
952# CONFIG_FB_VIRTUAL is not set 1001# CONFIG_FB_VIRTUAL is not set
1002# CONFIG_FB_METRONOME is not set
953CONFIG_BACKLIGHT_LCD_SUPPORT=y 1003CONFIG_BACKLIGHT_LCD_SUPPORT=y
954CONFIG_LCD_CLASS_DEVICE=m 1004CONFIG_LCD_CLASS_DEVICE=m
955CONFIG_LCD_LTV350QV=m 1005CONFIG_LCD_LTV350QV=m
1006# CONFIG_LCD_ILI9320 is not set
1007# CONFIG_LCD_TDO24M is not set
1008# CONFIG_LCD_VGG2432A4 is not set
1009# CONFIG_LCD_PLATFORM is not set
956CONFIG_BACKLIGHT_CLASS_DEVICE=m 1010CONFIG_BACKLIGHT_CLASS_DEVICE=m
957# CONFIG_BACKLIGHT_CORGI is not set 1011# CONFIG_BACKLIGHT_CORGI is not set
958 1012
@@ -977,15 +1031,8 @@ CONFIG_LOGO=y
977# CONFIG_LOGO_LINUX_CLUT224 is not set 1031# CONFIG_LOGO_LINUX_CLUT224 is not set
978# CONFIG_LOGO_BLACKFIN_VGA16 is not set 1032# CONFIG_LOGO_BLACKFIN_VGA16 is not set
979CONFIG_LOGO_BLACKFIN_CLUT224=y 1033CONFIG_LOGO_BLACKFIN_CLUT224=y
980
981#
982# Sound
983#
984CONFIG_SOUND=m 1034CONFIG_SOUND=m
985 1035# CONFIG_SOUND_OSS_CORE is not set
986#
987# Advanced Linux Sound Architecture
988#
989CONFIG_SND=m 1036CONFIG_SND=m
990CONFIG_SND_TIMER=m 1037CONFIG_SND_TIMER=m
991CONFIG_SND_PCM=m 1038CONFIG_SND_PCM=m
@@ -997,62 +1044,38 @@ CONFIG_SND_SUPPORT_OLD_API=y
997CONFIG_SND_VERBOSE_PROCFS=y 1044CONFIG_SND_VERBOSE_PROCFS=y
998# CONFIG_SND_VERBOSE_PRINTK is not set 1045# CONFIG_SND_VERBOSE_PRINTK is not set
999# CONFIG_SND_DEBUG is not set 1046# CONFIG_SND_DEBUG is not set
1000 1047CONFIG_SND_DRIVERS=y
1001#
1002# Generic devices
1003#
1004# CONFIG_SND_DUMMY is not set 1048# CONFIG_SND_DUMMY is not set
1005# CONFIG_SND_MTPAV is not set 1049# CONFIG_SND_MTPAV is not set
1006# CONFIG_SND_SERIAL_U16550 is not set 1050# CONFIG_SND_SERIAL_U16550 is not set
1007# CONFIG_SND_MPU401 is not set 1051# CONFIG_SND_MPU401 is not set
1008 1052CONFIG_SND_SPI=y
1009#
1010# SPI devices
1011#
1012 1053
1013# 1054#
1014# ALSA Blackfin devices 1055# ALSA Blackfin devices
1015# 1056#
1016# CONFIG_SND_BLACKFIN_AD1836 is not set 1057# CONFIG_SND_BLACKFIN_AD1836 is not set
1017# CONFIG_SND_BLACKFIN_AD1836_TDM is not set
1018# CONFIG_SND_BLACKFIN_AD1836_I2S is not set
1019# CONFIG_SND_BLACKFIN_AD1836_MULSUB is not set
1020# CONFIG_SND_BLACKFIN_AD1836_5P1 is not set
1021# CONFIG_SND_BFIN_AD73311 is not set
1022# CONFIG_SND_BFIN_AD73322 is not set 1058# CONFIG_SND_BFIN_AD73322 is not set
1023 1059CONFIG_SND_USB=y
1024#
1025# USB devices
1026#
1027# CONFIG_SND_USB_AUDIO is not set 1060# CONFIG_SND_USB_AUDIO is not set
1028# CONFIG_SND_USB_CAIAQ is not set 1061# CONFIG_SND_USB_CAIAQ is not set
1029
1030#
1031# System on Chip audio support
1032#
1033CONFIG_SND_SOC_AC97_BUS=y
1034CONFIG_SND_SOC=m 1062CONFIG_SND_SOC=m
1035CONFIG_SND_BF5XX_SOC=m 1063CONFIG_SND_SOC_AC97_BUS=y
1036CONFIG_SND_MMAP_SUPPORT=y 1064CONFIG_SND_BF5XX_I2S=m
1065CONFIG_SND_BF5XX_SOC_SSM2602=m
1066# CONFIG_SND_BF5XX_SOC_AD73311 is not set
1067CONFIG_SND_BF5XX_AC97=m
1068CONFIG_SND_BF5XX_MMAP_SUPPORT=y
1069# CONFIG_SND_BF5XX_MULTICHAN_SUPPORT is not set
1070CONFIG_SND_BF5XX_SOC_SPORT=m
1037CONFIG_SND_BF5XX_SOC_I2S=m 1071CONFIG_SND_BF5XX_SOC_I2S=m
1038CONFIG_SND_BF5XX_SOC_AC97=m 1072CONFIG_SND_BF5XX_SOC_AC97=m
1039# CONFIG_SND_BF5XX_SOC_WM8750 is not set 1073CONFIG_SND_BF5XX_SOC_AD1980=m
1040# CONFIG_SND_BF5XX_SOC_WM8731 is not set
1041CONFIG_SND_BF5XX_SOC_SSM2602=m
1042CONFIG_SND_BF5XX_SOC_BF5xx=m
1043CONFIG_SND_BF5XX_SPORT_NUM=0 1074CONFIG_SND_BF5XX_SPORT_NUM=0
1044# CONFIG_SND_BF5XX_HAVE_COLD_RESET is not set 1075# CONFIG_SND_BF5XX_HAVE_COLD_RESET is not set
1045 1076# CONFIG_SND_SOC_ALL_CODECS is not set
1046#
1047# SoC Audio support for SuperH
1048#
1049CONFIG_SND_SOC_SSM2602=m
1050# CONFIG_SND_SOC_SSM2602_SPI is not set
1051CONFIG_SND_SOC_AD1980=m 1077CONFIG_SND_SOC_AD1980=m
1052 1078CONFIG_SND_SOC_SSM2602=m
1053#
1054# Open Sound System
1055#
1056# CONFIG_SOUND_PRIME is not set 1079# CONFIG_SOUND_PRIME is not set
1057CONFIG_AC97_BUS=m 1080CONFIG_AC97_BUS=m
1058CONFIG_HID_SUPPORT=y 1081CONFIG_HID_SUPPORT=y
@@ -1064,15 +1087,43 @@ CONFIG_HID=y
1064# USB Input Devices 1087# USB Input Devices
1065# 1088#
1066CONFIG_USB_HID=y 1089CONFIG_USB_HID=y
1067# CONFIG_USB_HIDINPUT_POWERBOOK is not set 1090# CONFIG_HID_PID is not set
1068# CONFIG_HID_FF is not set
1069# CONFIG_USB_HIDDEV is not set 1091# CONFIG_USB_HIDDEV is not set
1092
1093#
1094# Special HID drivers
1095#
1096CONFIG_HID_COMPAT=y
1097CONFIG_HID_A4TECH=y
1098CONFIG_HID_APPLE=y
1099CONFIG_HID_BELKIN=y
1100CONFIG_HID_BRIGHT=y
1101CONFIG_HID_CHERRY=y
1102CONFIG_HID_CHICONY=y
1103CONFIG_HID_CYPRESS=y
1104CONFIG_HID_DELL=y
1105CONFIG_HID_EZKEY=y
1106CONFIG_HID_GYRATION=y
1107CONFIG_HID_LOGITECH=y
1108# CONFIG_LOGITECH_FF is not set
1109# CONFIG_LOGIRUMBLEPAD2_FF is not set
1110CONFIG_HID_MICROSOFT=y
1111CONFIG_HID_MONTEREY=y
1112CONFIG_HID_PANTHERLORD=y
1113# CONFIG_PANTHERLORD_FF is not set
1114CONFIG_HID_PETALYNX=y
1115CONFIG_HID_SAMSUNG=y
1116CONFIG_HID_SONY=y
1117CONFIG_HID_SUNPLUS=y
1118CONFIG_THRUSTMASTER_FF=m
1119CONFIG_ZEROPLUS_FF=m
1070CONFIG_USB_SUPPORT=y 1120CONFIG_USB_SUPPORT=y
1071CONFIG_USB_ARCH_HAS_HCD=y 1121CONFIG_USB_ARCH_HAS_HCD=y
1072# CONFIG_USB_ARCH_HAS_OHCI is not set 1122# CONFIG_USB_ARCH_HAS_OHCI is not set
1073# CONFIG_USB_ARCH_HAS_EHCI is not set 1123# CONFIG_USB_ARCH_HAS_EHCI is not set
1074CONFIG_USB=y 1124CONFIG_USB=y
1075# CONFIG_USB_DEBUG is not set 1125# CONFIG_USB_DEBUG is not set
1126# CONFIG_USB_ANNOUNCE_NEW_DEVICES is not set
1076 1127
1077# 1128#
1078# Miscellaneous USB options 1129# Miscellaneous USB options
@@ -1083,15 +1134,20 @@ CONFIG_USB_DEVICE_CLASS=y
1083# CONFIG_USB_OTG is not set 1134# CONFIG_USB_OTG is not set
1084# CONFIG_USB_OTG_WHITELIST is not set 1135# CONFIG_USB_OTG_WHITELIST is not set
1085CONFIG_USB_OTG_BLACKLIST_HUB=y 1136CONFIG_USB_OTG_BLACKLIST_HUB=y
1137CONFIG_USB_MON=y
1138# CONFIG_USB_WUSB is not set
1139# CONFIG_USB_WUSB_CBAF is not set
1086 1140
1087# 1141#
1088# USB Host Controller Drivers 1142# USB Host Controller Drivers
1089# 1143#
1144# CONFIG_USB_C67X00_HCD is not set
1090# CONFIG_USB_ISP116X_HCD is not set 1145# CONFIG_USB_ISP116X_HCD is not set
1091# CONFIG_USB_ISP1362_HCD is not set
1092# CONFIG_USB_ISP1760_HCD is not set 1146# CONFIG_USB_ISP1760_HCD is not set
1147# CONFIG_USB_ISP1362_HCD is not set
1093# CONFIG_USB_SL811_HCD is not set 1148# CONFIG_USB_SL811_HCD is not set
1094# CONFIG_USB_R8A66597_HCD is not set 1149# CONFIG_USB_R8A66597_HCD is not set
1150# CONFIG_USB_HWA_HCD is not set
1095CONFIG_USB_MUSB_HDRC=y 1151CONFIG_USB_MUSB_HDRC=y
1096CONFIG_USB_MUSB_SOC=y 1152CONFIG_USB_MUSB_SOC=y
1097 1153
@@ -1103,13 +1159,15 @@ CONFIG_USB_MUSB_HOST=y
1103# CONFIG_USB_MUSB_OTG is not set 1159# CONFIG_USB_MUSB_OTG is not set
1104CONFIG_USB_MUSB_HDRC_HCD=y 1160CONFIG_USB_MUSB_HDRC_HCD=y
1105CONFIG_MUSB_PIO_ONLY=y 1161CONFIG_MUSB_PIO_ONLY=y
1106CONFIG_USB_MUSB_LOGLEVEL=0 1162# CONFIG_USB_MUSB_DEBUG is not set
1107 1163
1108# 1164#
1109# USB Device Class drivers 1165# USB Device Class drivers
1110# 1166#
1111# CONFIG_USB_ACM is not set 1167# CONFIG_USB_ACM is not set
1112# CONFIG_USB_PRINTER is not set 1168# CONFIG_USB_PRINTER is not set
1169# CONFIG_USB_WDM is not set
1170# CONFIG_USB_TMC is not set
1113 1171
1114# 1172#
1115# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' 1173# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
@@ -1124,15 +1182,10 @@ CONFIG_USB_MUSB_LOGLEVEL=0
1124# USB Imaging devices 1182# USB Imaging devices
1125# 1183#
1126# CONFIG_USB_MDC800 is not set 1184# CONFIG_USB_MDC800 is not set
1127CONFIG_USB_MON=y
1128 1185
1129# 1186#
1130# USB port drivers 1187# USB port drivers
1131# 1188#
1132
1133#
1134# USB Serial Converter support
1135#
1136# CONFIG_USB_SERIAL is not set 1189# CONFIG_USB_SERIAL is not set
1137 1190
1138# 1191#
@@ -1141,7 +1194,7 @@ CONFIG_USB_MON=y
1141# CONFIG_USB_EMI62 is not set 1194# CONFIG_USB_EMI62 is not set
1142# CONFIG_USB_EMI26 is not set 1195# CONFIG_USB_EMI26 is not set
1143# CONFIG_USB_ADUTUX is not set 1196# CONFIG_USB_ADUTUX is not set
1144# CONFIG_USB_AUERSWALD is not set 1197# CONFIG_USB_SEVSEG is not set
1145# CONFIG_USB_RIO500 is not set 1198# CONFIG_USB_RIO500 is not set
1146# CONFIG_USB_LEGOTOWER is not set 1199# CONFIG_USB_LEGOTOWER is not set
1147# CONFIG_USB_LCD is not set 1200# CONFIG_USB_LCD is not set
@@ -1157,17 +1210,13 @@ CONFIG_USB_MON=y
1157# CONFIG_USB_LD is not set 1210# CONFIG_USB_LD is not set
1158# CONFIG_USB_TRANCEVIBRATOR is not set 1211# CONFIG_USB_TRANCEVIBRATOR is not set
1159# CONFIG_USB_IOWARRIOR is not set 1212# CONFIG_USB_IOWARRIOR is not set
1160 1213# CONFIG_USB_ISIGHTFW is not set
1161# 1214# CONFIG_USB_VST is not set
1162# USB DSL modem support
1163#
1164
1165#
1166# USB Gadget Support
1167#
1168# CONFIG_USB_GADGET is not set 1215# CONFIG_USB_GADGET is not set
1169# CONFIG_MMC is not set 1216# CONFIG_MMC is not set
1217# CONFIG_MEMSTICK is not set
1170# CONFIG_NEW_LEDS is not set 1218# CONFIG_NEW_LEDS is not set
1219# CONFIG_ACCESSIBILITY is not set
1171CONFIG_RTC_LIB=y 1220CONFIG_RTC_LIB=y
1172CONFIG_RTC_CLASS=y 1221CONFIG_RTC_CLASS=y
1173CONFIG_RTC_HCTOSYS=y 1222CONFIG_RTC_HCTOSYS=y
@@ -1196,51 +1245,57 @@ CONFIG_RTC_INTF_DEV=y
1196# CONFIG_RTC_DRV_PCF8563 is not set 1245# CONFIG_RTC_DRV_PCF8563 is not set
1197# CONFIG_RTC_DRV_PCF8583 is not set 1246# CONFIG_RTC_DRV_PCF8583 is not set
1198# CONFIG_RTC_DRV_M41T80 is not set 1247# CONFIG_RTC_DRV_M41T80 is not set
1248# CONFIG_RTC_DRV_S35390A is not set
1249# CONFIG_RTC_DRV_FM3130 is not set
1199 1250
1200# 1251#
1201# SPI RTC drivers 1252# SPI RTC drivers
1202# 1253#
1203# CONFIG_RTC_DRV_RS5C348 is not set 1254# CONFIG_RTC_DRV_M41T94 is not set
1255# CONFIG_RTC_DRV_DS1305 is not set
1204# CONFIG_RTC_DRV_MAX6902 is not set 1256# CONFIG_RTC_DRV_MAX6902 is not set
1257# CONFIG_RTC_DRV_R9701 is not set
1258# CONFIG_RTC_DRV_RS5C348 is not set
1259# CONFIG_RTC_DRV_DS3234 is not set
1205 1260
1206# 1261#
1207# Platform RTC drivers 1262# Platform RTC drivers
1208# 1263#
1264# CONFIG_RTC_DRV_DS1286 is not set
1265# CONFIG_RTC_DRV_DS1511 is not set
1209# CONFIG_RTC_DRV_DS1553 is not set 1266# CONFIG_RTC_DRV_DS1553 is not set
1210# CONFIG_RTC_DRV_STK17TA8 is not set
1211# CONFIG_RTC_DRV_DS1742 is not set 1267# CONFIG_RTC_DRV_DS1742 is not set
1268# CONFIG_RTC_DRV_STK17TA8 is not set
1212# CONFIG_RTC_DRV_M48T86 is not set 1269# CONFIG_RTC_DRV_M48T86 is not set
1270# CONFIG_RTC_DRV_M48T35 is not set
1213# CONFIG_RTC_DRV_M48T59 is not set 1271# CONFIG_RTC_DRV_M48T59 is not set
1272# CONFIG_RTC_DRV_BQ4802 is not set
1214# CONFIG_RTC_DRV_V3020 is not set 1273# CONFIG_RTC_DRV_V3020 is not set
1215 1274
1216# 1275#
1217# on-CPU RTC drivers 1276# on-CPU RTC drivers
1218# 1277#
1219CONFIG_RTC_DRV_BFIN=y 1278CONFIG_RTC_DRV_BFIN=y
1220 1279# CONFIG_DMADEVICES is not set
1221#
1222# Userspace I/O
1223#
1224# CONFIG_UIO is not set 1280# CONFIG_UIO is not set
1281# CONFIG_STAGING is not set
1225 1282
1226# 1283#
1227# File systems 1284# File systems
1228# 1285#
1229# CONFIG_EXT2_FS is not set 1286# CONFIG_EXT2_FS is not set
1230# CONFIG_EXT3_FS is not set 1287# CONFIG_EXT3_FS is not set
1231# CONFIG_EXT4DEV_FS is not set 1288# CONFIG_EXT4_FS is not set
1232# CONFIG_REISERFS_FS is not set 1289# CONFIG_REISERFS_FS is not set
1233# CONFIG_JFS_FS is not set 1290# CONFIG_JFS_FS is not set
1234# CONFIG_FS_POSIX_ACL is not set 1291# CONFIG_FS_POSIX_ACL is not set
1292CONFIG_FILE_LOCKING=y
1235# CONFIG_XFS_FS is not set 1293# CONFIG_XFS_FS is not set
1236# CONFIG_GFS2_FS is not set
1237# CONFIG_OCFS2_FS is not set 1294# CONFIG_OCFS2_FS is not set
1238# CONFIG_MINIX_FS is not set 1295# CONFIG_DNOTIFY is not set
1239# CONFIG_ROMFS_FS is not set
1240CONFIG_INOTIFY=y 1296CONFIG_INOTIFY=y
1241CONFIG_INOTIFY_USER=y 1297CONFIG_INOTIFY_USER=y
1242# CONFIG_QUOTA is not set 1298# CONFIG_QUOTA is not set
1243# CONFIG_DNOTIFY is not set
1244# CONFIG_AUTOFS_FS is not set 1299# CONFIG_AUTOFS_FS is not set
1245# CONFIG_AUTOFS4_FS is not set 1300# CONFIG_AUTOFS4_FS is not set
1246# CONFIG_FUSE_FS is not set 1301# CONFIG_FUSE_FS is not set
@@ -1280,11 +1335,11 @@ CONFIG_SYSFS=y
1280# CONFIG_EFS_FS is not set 1335# CONFIG_EFS_FS is not set
1281CONFIG_YAFFS_FS=m 1336CONFIG_YAFFS_FS=m
1282CONFIG_YAFFS_YAFFS1=y 1337CONFIG_YAFFS_YAFFS1=y
1338# CONFIG_YAFFS_9BYTE_TAGS is not set
1283# CONFIG_YAFFS_DOES_ECC is not set 1339# CONFIG_YAFFS_DOES_ECC is not set
1284CONFIG_YAFFS_YAFFS2=y 1340CONFIG_YAFFS_YAFFS2=y
1285CONFIG_YAFFS_AUTO_YAFFS2=y 1341CONFIG_YAFFS_AUTO_YAFFS2=y
1286# CONFIG_YAFFS_DISABLE_LAZY_LOAD is not set 1342# CONFIG_YAFFS_DISABLE_LAZY_LOAD is not set
1287CONFIG_YAFFS_CHECKPOINT_RESERVED_BLOCKS=10
1288# CONFIG_YAFFS_DISABLE_WIDE_TNODES is not set 1343# CONFIG_YAFFS_DISABLE_WIDE_TNODES is not set
1289# CONFIG_YAFFS_ALWAYS_CHECK_CHUNK_ERASED is not set 1344# CONFIG_YAFFS_ALWAYS_CHECK_CHUNK_ERASED is not set
1290CONFIG_YAFFS_SHORT_NAMES_IN_RAM=y 1345CONFIG_YAFFS_SHORT_NAMES_IN_RAM=y
@@ -1301,8 +1356,11 @@ CONFIG_JFFS2_RTIME=y
1301# CONFIG_JFFS2_RUBIN is not set 1356# CONFIG_JFFS2_RUBIN is not set
1302# CONFIG_CRAMFS is not set 1357# CONFIG_CRAMFS is not set
1303# CONFIG_VXFS_FS is not set 1358# CONFIG_VXFS_FS is not set
1359# CONFIG_MINIX_FS is not set
1360# CONFIG_OMFS_FS is not set
1304# CONFIG_HPFS_FS is not set 1361# CONFIG_HPFS_FS is not set
1305# CONFIG_QNX4FS_FS is not set 1362# CONFIG_QNX4FS_FS is not set
1363# CONFIG_ROMFS_FS is not set
1306# CONFIG_SYSV_FS is not set 1364# CONFIG_SYSV_FS is not set
1307# CONFIG_UFS_FS is not set 1365# CONFIG_UFS_FS is not set
1308CONFIG_NETWORK_FILESYSTEMS=y 1366CONFIG_NETWORK_FILESYSTEMS=y
@@ -1310,13 +1368,12 @@ CONFIG_NFS_FS=m
1310CONFIG_NFS_V3=y 1368CONFIG_NFS_V3=y
1311# CONFIG_NFS_V3_ACL is not set 1369# CONFIG_NFS_V3_ACL is not set
1312# CONFIG_NFS_V4 is not set 1370# CONFIG_NFS_V4 is not set
1313# CONFIG_NFS_DIRECTIO is not set
1314# CONFIG_NFSD is not set 1371# CONFIG_NFSD is not set
1315CONFIG_LOCKD=m 1372CONFIG_LOCKD=m
1316CONFIG_LOCKD_V4=y 1373CONFIG_LOCKD_V4=y
1317CONFIG_NFS_COMMON=y 1374CONFIG_NFS_COMMON=y
1318CONFIG_SUNRPC=m 1375CONFIG_SUNRPC=m
1319# CONFIG_SUNRPC_BIND34 is not set 1376# CONFIG_SUNRPC_REGISTER_V4 is not set
1320# CONFIG_RPCSEC_GSS_KRB5 is not set 1377# CONFIG_RPCSEC_GSS_KRB5 is not set
1321# CONFIG_RPCSEC_GSS_SPKM3 is not set 1378# CONFIG_RPCSEC_GSS_SPKM3 is not set
1322CONFIG_SMB_FS=m 1379CONFIG_SMB_FS=m
@@ -1372,9 +1429,6 @@ CONFIG_NLS_DEFAULT="iso8859-1"
1372# CONFIG_NLS_KOI8_U is not set 1429# CONFIG_NLS_KOI8_U is not set
1373# CONFIG_NLS_UTF8 is not set 1430# CONFIG_NLS_UTF8 is not set
1374# CONFIG_DLM is not set 1431# CONFIG_DLM is not set
1375CONFIG_INSTRUMENTATION=y
1376# CONFIG_PROFILING is not set
1377# CONFIG_MARKERS is not set
1378 1432
1379# 1433#
1380# Kernel hacking 1434# Kernel hacking
@@ -1382,14 +1436,53 @@ CONFIG_INSTRUMENTATION=y
1382# CONFIG_PRINTK_TIME is not set 1436# CONFIG_PRINTK_TIME is not set
1383CONFIG_ENABLE_WARN_DEPRECATED=y 1437CONFIG_ENABLE_WARN_DEPRECATED=y
1384CONFIG_ENABLE_MUST_CHECK=y 1438CONFIG_ENABLE_MUST_CHECK=y
1439CONFIG_FRAME_WARN=1024
1385# CONFIG_MAGIC_SYSRQ is not set 1440# CONFIG_MAGIC_SYSRQ is not set
1386# CONFIG_UNUSED_SYMBOLS is not set 1441# CONFIG_UNUSED_SYMBOLS is not set
1387CONFIG_DEBUG_FS=y 1442CONFIG_DEBUG_FS=y
1388# CONFIG_HEADERS_CHECK is not set 1443# CONFIG_HEADERS_CHECK is not set
1389# CONFIG_DEBUG_KERNEL is not set 1444CONFIG_DEBUG_KERNEL=y
1445# CONFIG_DEBUG_SHIRQ is not set
1446CONFIG_DETECT_SOFTLOCKUP=y
1447# CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC is not set
1448CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE=0
1449CONFIG_SCHED_DEBUG=y
1450# CONFIG_SCHEDSTATS is not set
1451# CONFIG_TIMER_STATS is not set
1452# CONFIG_DEBUG_OBJECTS is not set
1453# CONFIG_DEBUG_SLAB is not set
1454# CONFIG_DEBUG_RT_MUTEXES is not set
1455# CONFIG_RT_MUTEX_TESTER is not set
1456# CONFIG_DEBUG_SPINLOCK is not set
1457# CONFIG_DEBUG_MUTEXES is not set
1458# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
1459# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
1460# CONFIG_DEBUG_KOBJECT is not set
1390# CONFIG_DEBUG_BUGVERBOSE is not set 1461# CONFIG_DEBUG_BUGVERBOSE is not set
1462CONFIG_DEBUG_INFO=y
1463# CONFIG_DEBUG_VM is not set
1464# CONFIG_DEBUG_WRITECOUNT is not set
1465# CONFIG_DEBUG_MEMORY_INIT is not set
1466# CONFIG_DEBUG_LIST is not set
1467# CONFIG_DEBUG_SG is not set
1468# CONFIG_FRAME_POINTER is not set
1469# CONFIG_BOOT_PRINTK_DELAY is not set
1470# CONFIG_RCU_TORTURE_TEST is not set
1471# CONFIG_RCU_CPU_STALL_DETECTOR is not set
1472# CONFIG_BACKTRACE_SELF_TEST is not set
1473# CONFIG_DEBUG_BLOCK_EXT_DEVT is not set
1474# CONFIG_FAULT_INJECTION is not set
1475# CONFIG_SYSCTL_SYSCALL_CHECK is not set
1476# CONFIG_DYNAMIC_PRINTK_DEBUG is not set
1391# CONFIG_SAMPLES is not set 1477# CONFIG_SAMPLES is not set
1478CONFIG_HAVE_ARCH_KGDB=y
1479# CONFIG_KGDB is not set
1480# CONFIG_DEBUG_STACKOVERFLOW is not set
1481# CONFIG_DEBUG_STACK_USAGE is not set
1482CONFIG_DEBUG_VERBOSE=y
1392CONFIG_DEBUG_MMRS=y 1483CONFIG_DEBUG_MMRS=y
1484# CONFIG_DEBUG_HWERR is not set
1485# CONFIG_DEBUG_DOUBLEFAULT is not set
1393CONFIG_DEBUG_HUNT_FOR_ZERO=y 1486CONFIG_DEBUG_HUNT_FOR_ZERO=y
1394CONFIG_DEBUG_BFIN_HWTRACE_ON=y 1487CONFIG_DEBUG_BFIN_HWTRACE_ON=y
1395CONFIG_DEBUG_BFIN_HWTRACE_COMPRESSION_OFF=y 1488CONFIG_DEBUG_BFIN_HWTRACE_COMPRESSION_OFF=y
@@ -1407,10 +1500,95 @@ CONFIG_ACCESS_CHECK=y
1407# 1500#
1408# CONFIG_KEYS is not set 1501# CONFIG_KEYS is not set
1409CONFIG_SECURITY=y 1502CONFIG_SECURITY=y
1503# CONFIG_SECURITYFS is not set
1410# CONFIG_SECURITY_NETWORK is not set 1504# CONFIG_SECURITY_NETWORK is not set
1411# CONFIG_SECURITY_CAPABILITIES is not set 1505# CONFIG_SECURITY_FILE_CAPABILITIES is not set
1412# CONFIG_SECURITY_ROOTPLUG is not set 1506# CONFIG_SECURITY_ROOTPLUG is not set
1413# CONFIG_CRYPTO is not set 1507CONFIG_SECURITY_DEFAULT_MMAP_MIN_ADDR=0
1508CONFIG_CRYPTO=y
1509
1510#
1511# Crypto core or helper
1512#
1513# CONFIG_CRYPTO_FIPS is not set
1514# CONFIG_CRYPTO_MANAGER is not set
1515# CONFIG_CRYPTO_GF128MUL is not set
1516# CONFIG_CRYPTO_NULL is not set
1517# CONFIG_CRYPTO_CRYPTD is not set
1518# CONFIG_CRYPTO_AUTHENC is not set
1519# CONFIG_CRYPTO_TEST is not set
1520
1521#
1522# Authenticated Encryption with Associated Data
1523#
1524# CONFIG_CRYPTO_CCM is not set
1525# CONFIG_CRYPTO_GCM is not set
1526# CONFIG_CRYPTO_SEQIV is not set
1527
1528#
1529# Block modes
1530#
1531# CONFIG_CRYPTO_CBC is not set
1532# CONFIG_CRYPTO_CTR is not set
1533# CONFIG_CRYPTO_CTS is not set
1534# CONFIG_CRYPTO_ECB is not set
1535# CONFIG_CRYPTO_LRW is not set
1536# CONFIG_CRYPTO_PCBC is not set
1537# CONFIG_CRYPTO_XTS is not set
1538
1539#
1540# Hash modes
1541#
1542# CONFIG_CRYPTO_HMAC is not set
1543# CONFIG_CRYPTO_XCBC is not set
1544
1545#
1546# Digest
1547#
1548# CONFIG_CRYPTO_CRC32C is not set
1549# CONFIG_CRYPTO_MD4 is not set
1550# CONFIG_CRYPTO_MD5 is not set
1551# CONFIG_CRYPTO_MICHAEL_MIC is not set
1552# CONFIG_CRYPTO_RMD128 is not set
1553# CONFIG_CRYPTO_RMD160 is not set
1554# CONFIG_CRYPTO_RMD256 is not set
1555# CONFIG_CRYPTO_RMD320 is not set
1556# CONFIG_CRYPTO_SHA1 is not set
1557# CONFIG_CRYPTO_SHA256 is not set
1558# CONFIG_CRYPTO_SHA512 is not set
1559# CONFIG_CRYPTO_TGR192 is not set
1560# CONFIG_CRYPTO_WP512 is not set
1561
1562#
1563# Ciphers
1564#
1565# CONFIG_CRYPTO_AES is not set
1566# CONFIG_CRYPTO_ANUBIS is not set
1567# CONFIG_CRYPTO_ARC4 is not set
1568# CONFIG_CRYPTO_BLOWFISH is not set
1569# CONFIG_CRYPTO_CAMELLIA is not set
1570# CONFIG_CRYPTO_CAST5 is not set
1571# CONFIG_CRYPTO_CAST6 is not set
1572# CONFIG_CRYPTO_DES is not set
1573# CONFIG_CRYPTO_FCRYPT is not set
1574# CONFIG_CRYPTO_KHAZAD is not set
1575# CONFIG_CRYPTO_SALSA20 is not set
1576# CONFIG_CRYPTO_SEED is not set
1577# CONFIG_CRYPTO_SERPENT is not set
1578# CONFIG_CRYPTO_TEA is not set
1579# CONFIG_CRYPTO_TWOFISH is not set
1580
1581#
1582# Compression
1583#
1584# CONFIG_CRYPTO_DEFLATE is not set
1585# CONFIG_CRYPTO_LZO is not set
1586
1587#
1588# Random Number Generation
1589#
1590# CONFIG_CRYPTO_ANSI_CPRNG is not set
1591CONFIG_CRYPTO_HW=y
1414 1592
1415# 1593#
1416# Library routines 1594# Library routines
@@ -1418,6 +1596,7 @@ CONFIG_SECURITY=y
1418CONFIG_BITREVERSE=y 1596CONFIG_BITREVERSE=y
1419CONFIG_CRC_CCITT=m 1597CONFIG_CRC_CCITT=m
1420# CONFIG_CRC16 is not set 1598# CONFIG_CRC16 is not set
1599# CONFIG_CRC_T10DIF is not set
1421# CONFIG_CRC_ITU_T is not set 1600# CONFIG_CRC_ITU_T is not set
1422CONFIG_CRC32=y 1601CONFIG_CRC32=y
1423# CONFIG_CRC7 is not set 1602# CONFIG_CRC7 is not set
diff --git a/arch/blackfin/configs/BF533-EZKIT_defconfig b/arch/blackfin/configs/BF533-EZKIT_defconfig
index deeb5e45effb..92afd988449b 100644
--- a/arch/blackfin/configs/BF533-EZKIT_defconfig
+++ b/arch/blackfin/configs/BF533-EZKIT_defconfig
@@ -1,6 +1,6 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.24.7 3# Linux kernel version: 2.6.28-rc2
4# 4#
5# CONFIG_MMU is not set 5# CONFIG_MMU is not set
6# CONFIG_FPU is not set 6# CONFIG_FPU is not set
@@ -8,7 +8,6 @@ CONFIG_RWSEM_GENERIC_SPINLOCK=y
8# CONFIG_RWSEM_XCHGADD_ALGORITHM is not set 8# CONFIG_RWSEM_XCHGADD_ALGORITHM is not set
9CONFIG_BLACKFIN=y 9CONFIG_BLACKFIN=y
10CONFIG_ZONE_DMA=y 10CONFIG_ZONE_DMA=y
11CONFIG_SEMAPHORE_SLEEPERS=y
12CONFIG_GENERIC_FIND_NEXT_BIT=y 11CONFIG_GENERIC_FIND_NEXT_BIT=y
13CONFIG_GENERIC_HWEIGHT=y 12CONFIG_GENERIC_HWEIGHT=y
14CONFIG_GENERIC_HARDIRQS=y 13CONFIG_GENERIC_HARDIRQS=y
@@ -31,18 +30,16 @@ CONFIG_SYSVIPC_SYSCTL=y
31# CONFIG_POSIX_MQUEUE is not set 30# CONFIG_POSIX_MQUEUE is not set
32# CONFIG_BSD_PROCESS_ACCT is not set 31# CONFIG_BSD_PROCESS_ACCT is not set
33# CONFIG_TASKSTATS is not set 32# CONFIG_TASKSTATS is not set
34# CONFIG_USER_NS is not set
35# CONFIG_PID_NS is not set
36# CONFIG_AUDIT is not set 33# CONFIG_AUDIT is not set
37CONFIG_IKCONFIG=y 34CONFIG_IKCONFIG=y
38CONFIG_IKCONFIG_PROC=y 35CONFIG_IKCONFIG_PROC=y
39CONFIG_LOG_BUF_SHIFT=14 36CONFIG_LOG_BUF_SHIFT=14
40# CONFIG_CGROUPS is not set 37# CONFIG_CGROUPS is not set
41CONFIG_FAIR_GROUP_SCHED=y 38# CONFIG_GROUP_SCHED is not set
42CONFIG_FAIR_USER_SCHED=y 39# CONFIG_SYSFS_DEPRECATED is not set
43# CONFIG_FAIR_CGROUP_SCHED is not set 40# CONFIG_SYSFS_DEPRECATED_V2 is not set
44CONFIG_SYSFS_DEPRECATED=y
45# CONFIG_RELAY is not set 41# CONFIG_RELAY is not set
42# CONFIG_NAMESPACES is not set
46CONFIG_BLK_DEV_INITRD=y 43CONFIG_BLK_DEV_INITRD=y
47CONFIG_INITRAMFS_SOURCE="" 44CONFIG_INITRAMFS_SOURCE=""
48# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 45# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
@@ -51,26 +48,35 @@ CONFIG_EMBEDDED=y
51CONFIG_UID16=y 48CONFIG_UID16=y
52CONFIG_SYSCTL_SYSCALL=y 49CONFIG_SYSCTL_SYSCALL=y
53CONFIG_KALLSYMS=y 50CONFIG_KALLSYMS=y
51# CONFIG_KALLSYMS_ALL is not set
54# CONFIG_KALLSYMS_EXTRA_PASS is not set 52# CONFIG_KALLSYMS_EXTRA_PASS is not set
55CONFIG_HOTPLUG=y 53CONFIG_HOTPLUG=y
56CONFIG_PRINTK=y 54CONFIG_PRINTK=y
57CONFIG_BUG=y 55CONFIG_BUG=y
58CONFIG_ELF_CORE=y 56# CONFIG_ELF_CORE is not set
57CONFIG_COMPAT_BRK=y
59CONFIG_BASE_FULL=y 58CONFIG_BASE_FULL=y
60CONFIG_FUTEX=y 59CONFIG_FUTEX=y
61CONFIG_ANON_INODES=y 60CONFIG_ANON_INODES=y
62CONFIG_EPOLL=y 61CONFIG_EPOLL=y
63CONFIG_SIGNALFD=y 62CONFIG_SIGNALFD=y
63CONFIG_TIMERFD=y
64CONFIG_EVENTFD=y 64CONFIG_EVENTFD=y
65CONFIG_AIO=y
65CONFIG_VM_EVENT_COUNTERS=y 66CONFIG_VM_EVENT_COUNTERS=y
66CONFIG_SLAB=y 67CONFIG_SLAB=y
67# CONFIG_SLUB is not set 68# CONFIG_SLUB is not set
68# CONFIG_SLOB is not set 69# CONFIG_SLOB is not set
70# CONFIG_PROFILING is not set
71# CONFIG_MARKERS is not set
72CONFIG_HAVE_OPROFILE=y
73# CONFIG_HAVE_GENERIC_DMA_COHERENT is not set
69CONFIG_SLABINFO=y 74CONFIG_SLABINFO=y
70CONFIG_RT_MUTEXES=y 75CONFIG_RT_MUTEXES=y
71CONFIG_TINY_SHMEM=y 76CONFIG_TINY_SHMEM=y
72CONFIG_BASE_SMALL=0 77CONFIG_BASE_SMALL=0
73CONFIG_MODULES=y 78CONFIG_MODULES=y
79# CONFIG_MODULE_FORCE_LOAD is not set
74CONFIG_MODULE_UNLOAD=y 80CONFIG_MODULE_UNLOAD=y
75# CONFIG_MODULE_FORCE_UNLOAD is not set 81# CONFIG_MODULE_FORCE_UNLOAD is not set
76# CONFIG_MODVERSIONS is not set 82# CONFIG_MODVERSIONS is not set
@@ -81,6 +87,7 @@ CONFIG_BLOCK=y
81# CONFIG_BLK_DEV_IO_TRACE is not set 87# CONFIG_BLK_DEV_IO_TRACE is not set
82# CONFIG_LSF is not set 88# CONFIG_LSF is not set
83# CONFIG_BLK_DEV_BSG is not set 89# CONFIG_BLK_DEV_BSG is not set
90# CONFIG_BLK_DEV_INTEGRITY is not set
84 91
85# 92#
86# IO Schedulers 93# IO Schedulers
@@ -94,9 +101,11 @@ CONFIG_DEFAULT_AS=y
94# CONFIG_DEFAULT_CFQ is not set 101# CONFIG_DEFAULT_CFQ is not set
95# CONFIG_DEFAULT_NOOP is not set 102# CONFIG_DEFAULT_NOOP is not set
96CONFIG_DEFAULT_IOSCHED="anticipatory" 103CONFIG_DEFAULT_IOSCHED="anticipatory"
104CONFIG_CLASSIC_RCU=y
97# CONFIG_PREEMPT_NONE is not set 105# CONFIG_PREEMPT_NONE is not set
98CONFIG_PREEMPT_VOLUNTARY=y 106CONFIG_PREEMPT_VOLUNTARY=y
99# CONFIG_PREEMPT is not set 107# CONFIG_PREEMPT is not set
108CONFIG_FREEZER=y
100 109
101# 110#
102# Blackfin Processor Options 111# Blackfin Processor Options
@@ -105,6 +114,10 @@ CONFIG_PREEMPT_VOLUNTARY=y
105# 114#
106# Processor and Board Settings 115# Processor and Board Settings
107# 116#
117# CONFIG_BF512 is not set
118# CONFIG_BF514 is not set
119# CONFIG_BF516 is not set
120# CONFIG_BF518 is not set
108# CONFIG_BF522 is not set 121# CONFIG_BF522 is not set
109# CONFIG_BF523 is not set 122# CONFIG_BF523 is not set
110# CONFIG_BF524 is not set 123# CONFIG_BF524 is not set
@@ -117,24 +130,30 @@ CONFIG_BF533=y
117# CONFIG_BF534 is not set 130# CONFIG_BF534 is not set
118# CONFIG_BF536 is not set 131# CONFIG_BF536 is not set
119# CONFIG_BF537 is not set 132# CONFIG_BF537 is not set
133# CONFIG_BF538 is not set
134# CONFIG_BF539 is not set
120# CONFIG_BF542 is not set 135# CONFIG_BF542 is not set
121# CONFIG_BF544 is not set 136# CONFIG_BF544 is not set
122# CONFIG_BF547 is not set 137# CONFIG_BF547 is not set
123# CONFIG_BF548 is not set 138# CONFIG_BF548 is not set
124# CONFIG_BF549 is not set 139# CONFIG_BF549 is not set
125# CONFIG_BF561 is not set 140# CONFIG_BF561 is not set
141CONFIG_BF_REV_MIN=3
142CONFIG_BF_REV_MAX=6
126# CONFIG_BF_REV_0_0 is not set 143# CONFIG_BF_REV_0_0 is not set
127# CONFIG_BF_REV_0_1 is not set 144# CONFIG_BF_REV_0_1 is not set
128# CONFIG_BF_REV_0_2 is not set 145# CONFIG_BF_REV_0_2 is not set
129CONFIG_BF_REV_0_3=y 146CONFIG_BF_REV_0_3=y
130# CONFIG_BF_REV_0_4 is not set 147# CONFIG_BF_REV_0_4 is not set
131# CONFIG_BF_REV_0_5 is not set 148# CONFIG_BF_REV_0_5 is not set
149# CONFIG_BF_REV_0_6 is not set
132# CONFIG_BF_REV_ANY is not set 150# CONFIG_BF_REV_ANY is not set
133# CONFIG_BF_REV_NONE is not set 151# CONFIG_BF_REV_NONE is not set
134CONFIG_BF53x=y 152CONFIG_BF53x=y
135CONFIG_MEM_MT48LC16M16A2TG_75=y 153CONFIG_MEM_MT48LC16M16A2TG_75=y
136CONFIG_BFIN533_EZKIT=y 154CONFIG_BFIN533_EZKIT=y
137# CONFIG_BFIN533_STAMP is not set 155# CONFIG_BFIN533_STAMP is not set
156# CONFIG_BLACKSTAMP is not set
138# CONFIG_BFIN533_BLUETECHNIX_CM is not set 157# CONFIG_BFIN533_BLUETECHNIX_CM is not set
139# CONFIG_H8606_HVSISTEMAS is not set 158# CONFIG_H8606_HVSISTEMAS is not set
140# CONFIG_BFIN532_IP0X is not set 159# CONFIG_BFIN532_IP0X is not set
@@ -187,7 +206,6 @@ CONFIG_BOOT_LOAD=0x1000
187# 206#
188CONFIG_CLKIN_HZ=27000000 207CONFIG_CLKIN_HZ=27000000
189# CONFIG_BFIN_KERNEL_CLOCK is not set 208# CONFIG_BFIN_KERNEL_CLOCK is not set
190CONFIG_MAX_MEM_SIZE=512
191CONFIG_MAX_VCO_HZ=750000000 209CONFIG_MAX_VCO_HZ=750000000
192CONFIG_MIN_VCO_HZ=50000000 210CONFIG_MIN_VCO_HZ=50000000
193CONFIG_MAX_SCLK_HZ=133333333 211CONFIG_MAX_SCLK_HZ=133333333
@@ -201,6 +219,7 @@ CONFIG_HZ_250=y
201# CONFIG_HZ_300 is not set 219# CONFIG_HZ_300 is not set
202# CONFIG_HZ_1000 is not set 220# CONFIG_HZ_1000 is not set
203CONFIG_HZ=250 221CONFIG_HZ=250
222CONFIG_SCHED_HRTICK=y
204CONFIG_GENERIC_TIME=y 223CONFIG_GENERIC_TIME=y
205CONFIG_GENERIC_CLOCKEVENTS=y 224CONFIG_GENERIC_CLOCKEVENTS=y
206# CONFIG_CYCLES_CLOCKSOURCE is not set 225# CONFIG_CYCLES_CLOCKSOURCE is not set
@@ -238,6 +257,12 @@ CONFIG_SYS_BFIN_SPINLOCK_L1=y
238CONFIG_CACHELINE_ALIGNED_L1=y 257CONFIG_CACHELINE_ALIGNED_L1=y
239# CONFIG_SYSCALL_TAB_L1 is not set 258# CONFIG_SYSCALL_TAB_L1 is not set
240# CONFIG_CPLB_SWITCH_TAB_L1 is not set 259# CONFIG_CPLB_SWITCH_TAB_L1 is not set
260CONFIG_APP_STACK_L1=y
261
262#
263# Speed Optimizations
264#
265CONFIG_BFIN_INS_LOWOVERHEAD=y
241CONFIG_RAMKERNEL=y 266CONFIG_RAMKERNEL=y
242# CONFIG_ROMKERNEL is not set 267# CONFIG_ROMKERNEL is not set
243CONFIG_SELECT_MEMORY_MODEL=y 268CONFIG_SELECT_MEMORY_MODEL=y
@@ -246,14 +271,13 @@ CONFIG_FLATMEM_MANUAL=y
246# CONFIG_SPARSEMEM_MANUAL is not set 271# CONFIG_SPARSEMEM_MANUAL is not set
247CONFIG_FLATMEM=y 272CONFIG_FLATMEM=y
248CONFIG_FLAT_NODE_MEM_MAP=y 273CONFIG_FLAT_NODE_MEM_MAP=y
249# CONFIG_SPARSEMEM_STATIC is not set 274CONFIG_PAGEFLAGS_EXTENDED=y
250# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
251CONFIG_SPLIT_PTLOCK_CPUS=4 275CONFIG_SPLIT_PTLOCK_CPUS=4
252# CONFIG_RESOURCES_64BIT is not set 276# CONFIG_RESOURCES_64BIT is not set
277# CONFIG_PHYS_ADDR_T_64BIT is not set
253CONFIG_ZONE_DMA_FLAG=1 278CONFIG_ZONE_DMA_FLAG=1
254CONFIG_VIRT_TO_BUS=y 279CONFIG_VIRT_TO_BUS=y
255# CONFIG_BFIN_GPTIMERS is not set 280# CONFIG_BFIN_GPTIMERS is not set
256CONFIG_BFIN_DMA_5XX=y
257# CONFIG_DMA_UNCACHED_4M is not set 281# CONFIG_DMA_UNCACHED_4M is not set
258# CONFIG_DMA_UNCACHED_2M is not set 282# CONFIG_DMA_UNCACHED_2M is not set
259CONFIG_DMA_UNCACHED_1M=y 283CONFIG_DMA_UNCACHED_1M=y
@@ -268,7 +292,6 @@ CONFIG_BFIN_DCACHE=y
268# CONFIG_BFIN_ICACHE_LOCK is not set 292# CONFIG_BFIN_ICACHE_LOCK is not set
269# CONFIG_BFIN_WB is not set 293# CONFIG_BFIN_WB is not set
270CONFIG_BFIN_WT=y 294CONFIG_BFIN_WT=y
271CONFIG_L1_MAX_PIECE=16
272# CONFIG_MPU is not set 295# CONFIG_MPU is not set
273 296
274# 297#
@@ -297,7 +320,6 @@ CONFIG_BANK_3=0xAAC2
297# 320#
298# Bus options (PCI, PCMCIA, EISA, MCA, ISA) 321# Bus options (PCI, PCMCIA, EISA, MCA, ISA)
299# 322#
300# CONFIG_PCI is not set
301# CONFIG_ARCH_SUPPORTS_MSI is not set 323# CONFIG_ARCH_SUPPORTS_MSI is not set
302# CONFIG_PCCARD is not set 324# CONFIG_PCCARD is not set
303 325
@@ -308,29 +330,30 @@ CONFIG_BINFMT_ELF_FDPIC=y
308CONFIG_BINFMT_FLAT=y 330CONFIG_BINFMT_FLAT=y
309CONFIG_BINFMT_ZFLAT=y 331CONFIG_BINFMT_ZFLAT=y
310# CONFIG_BINFMT_SHARED_FLAT is not set 332# CONFIG_BINFMT_SHARED_FLAT is not set
333# CONFIG_HAVE_AOUT is not set
311# CONFIG_BINFMT_MISC is not set 334# CONFIG_BINFMT_MISC is not set
312 335
313# 336#
314# Power management options 337# Power management options
315# 338#
316CONFIG_PM=y 339CONFIG_PM=y
317# CONFIG_PM_LEGACY is not set
318# CONFIG_PM_DEBUG is not set 340# CONFIG_PM_DEBUG is not set
319CONFIG_PM_SLEEP=y 341CONFIG_PM_SLEEP=y
320CONFIG_SUSPEND_UP_POSSIBLE=y
321CONFIG_SUSPEND=y 342CONFIG_SUSPEND=y
343CONFIG_SUSPEND_FREEZER=y
344CONFIG_ARCH_SUSPEND_POSSIBLE=y
322CONFIG_PM_BFIN_SLEEP_DEEPER=y 345CONFIG_PM_BFIN_SLEEP_DEEPER=y
323# CONFIG_PM_BFIN_SLEEP is not set 346# CONFIG_PM_BFIN_SLEEP is not set
324# CONFIG_PM_WAKEUP_BY_GPIO is not set 347# CONFIG_PM_WAKEUP_BY_GPIO is not set
325 348
326# 349#
327# CPU Frequency scaling 350# Possible Suspend Mem / Hibernate Wake-Up Sources
328# 351#
329# CONFIG_CPU_FREQ is not set
330 352
331# 353#
332# Networking 354# CPU Frequency scaling
333# 355#
356# CONFIG_CPU_FREQ is not set
334CONFIG_NET=y 357CONFIG_NET=y
335 358
336# 359#
@@ -343,6 +366,7 @@ CONFIG_XFRM=y
343# CONFIG_XFRM_USER is not set 366# CONFIG_XFRM_USER is not set
344# CONFIG_XFRM_SUB_POLICY is not set 367# CONFIG_XFRM_SUB_POLICY is not set
345# CONFIG_XFRM_MIGRATE is not set 368# CONFIG_XFRM_MIGRATE is not set
369# CONFIG_XFRM_STATISTICS is not set
346# CONFIG_NET_KEY is not set 370# CONFIG_NET_KEY is not set
347CONFIG_INET=y 371CONFIG_INET=y
348# CONFIG_IP_MULTICAST is not set 372# CONFIG_IP_MULTICAST is not set
@@ -372,8 +396,6 @@ CONFIG_TCP_CONG_CUBIC=y
372CONFIG_DEFAULT_TCP_CONG="cubic" 396CONFIG_DEFAULT_TCP_CONG="cubic"
373# CONFIG_TCP_MD5SIG is not set 397# CONFIG_TCP_MD5SIG is not set
374# CONFIG_IPV6 is not set 398# CONFIG_IPV6 is not set
375# CONFIG_INET6_XFRM_TUNNEL is not set
376# CONFIG_INET6_TUNNEL is not set
377# CONFIG_NETLABEL is not set 399# CONFIG_NETLABEL is not set
378# CONFIG_NETWORK_SECMARK is not set 400# CONFIG_NETWORK_SECMARK is not set
379# CONFIG_NETFILTER is not set 401# CONFIG_NETFILTER is not set
@@ -382,6 +404,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
382# CONFIG_TIPC is not set 404# CONFIG_TIPC is not set
383# CONFIG_ATM is not set 405# CONFIG_ATM is not set
384# CONFIG_BRIDGE is not set 406# CONFIG_BRIDGE is not set
407# CONFIG_NET_DSA is not set
385# CONFIG_VLAN_8021Q is not set 408# CONFIG_VLAN_8021Q is not set
386# CONFIG_DECNET is not set 409# CONFIG_DECNET is not set
387# CONFIG_LLC2 is not set 410# CONFIG_LLC2 is not set
@@ -398,6 +421,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
398# 421#
399# CONFIG_NET_PKTGEN is not set 422# CONFIG_NET_PKTGEN is not set
400# CONFIG_HAMRADIO is not set 423# CONFIG_HAMRADIO is not set
424# CONFIG_CAN is not set
401CONFIG_IRDA=m 425CONFIG_IRDA=m
402 426
403# 427#
@@ -430,24 +454,14 @@ CONFIG_IRTTY_SIR=m
430# CONFIG_DONGLE is not set 454# CONFIG_DONGLE is not set
431 455
432# 456#
433# Old SIR device drivers
434#
435# CONFIG_IRPORT_SIR is not set
436
437#
438# Old Serial dongle support
439#
440
441#
442# FIR device drivers 457# FIR device drivers
443# 458#
444# CONFIG_BT is not set 459# CONFIG_BT is not set
445# CONFIG_AF_RXRPC is not set 460# CONFIG_AF_RXRPC is not set
446 461# CONFIG_PHONET is not set
447# 462CONFIG_WIRELESS=y
448# Wireless
449#
450# CONFIG_CFG80211 is not set 463# CONFIG_CFG80211 is not set
464CONFIG_WIRELESS_OLD_REGULATORY=y
451# CONFIG_WIRELESS_EXT is not set 465# CONFIG_WIRELESS_EXT is not set
452# CONFIG_MAC80211 is not set 466# CONFIG_MAC80211 is not set
453# CONFIG_IEEE80211 is not set 467# CONFIG_IEEE80211 is not set
@@ -465,6 +479,8 @@ CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
465CONFIG_STANDALONE=y 479CONFIG_STANDALONE=y
466CONFIG_PREVENT_FIRMWARE_BUILD=y 480CONFIG_PREVENT_FIRMWARE_BUILD=y
467# CONFIG_FW_LOADER is not set 481# CONFIG_FW_LOADER is not set
482# CONFIG_DEBUG_DRIVER is not set
483# CONFIG_DEBUG_DEVRES is not set
468# CONFIG_SYS_HYPERVISOR is not set 484# CONFIG_SYS_HYPERVISOR is not set
469# CONFIG_CONNECTOR is not set 485# CONFIG_CONNECTOR is not set
470CONFIG_MTD=y 486CONFIG_MTD=y
@@ -473,6 +489,7 @@ CONFIG_MTD=y
473CONFIG_MTD_PARTITIONS=y 489CONFIG_MTD_PARTITIONS=y
474# CONFIG_MTD_REDBOOT_PARTS is not set 490# CONFIG_MTD_REDBOOT_PARTS is not set
475# CONFIG_MTD_CMDLINE_PARTS is not set 491# CONFIG_MTD_CMDLINE_PARTS is not set
492# CONFIG_MTD_AR7_PARTS is not set
476 493
477# 494#
478# User Modules And Translation Layers 495# User Modules And Translation Layers
@@ -516,6 +533,7 @@ CONFIG_MTD_ROM=m
516# 533#
517CONFIG_MTD_COMPLEX_MAPPINGS=y 534CONFIG_MTD_COMPLEX_MAPPINGS=y
518# CONFIG_MTD_PHYSMAP is not set 535# CONFIG_MTD_PHYSMAP is not set
536# CONFIG_MTD_GPIO_ADDR is not set
519# CONFIG_MTD_UCLINUX is not set 537# CONFIG_MTD_UCLINUX is not set
520# CONFIG_MTD_PLATRAM is not set 538# CONFIG_MTD_PLATRAM is not set
521 539
@@ -550,11 +568,14 @@ CONFIG_BLK_DEV=y
550CONFIG_BLK_DEV_RAM=y 568CONFIG_BLK_DEV_RAM=y
551CONFIG_BLK_DEV_RAM_COUNT=16 569CONFIG_BLK_DEV_RAM_COUNT=16
552CONFIG_BLK_DEV_RAM_SIZE=4096 570CONFIG_BLK_DEV_RAM_SIZE=4096
553CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024 571# CONFIG_BLK_DEV_XIP is not set
554# CONFIG_CDROM_PKTCDVD is not set 572# CONFIG_CDROM_PKTCDVD is not set
555# CONFIG_ATA_OVER_ETH is not set 573# CONFIG_ATA_OVER_ETH is not set
574# CONFIG_BLK_DEV_HD is not set
556CONFIG_MISC_DEVICES=y 575CONFIG_MISC_DEVICES=y
557# CONFIG_EEPROM_93CX6 is not set 576# CONFIG_EEPROM_93CX6 is not set
577# CONFIG_ENCLOSURE_SERVICES is not set
578CONFIG_HAVE_IDE=y
558# CONFIG_IDE is not set 579# CONFIG_IDE is not set
559 580
560# 581#
@@ -567,7 +588,6 @@ CONFIG_MISC_DEVICES=y
567# CONFIG_ATA is not set 588# CONFIG_ATA is not set
568# CONFIG_MD is not set 589# CONFIG_MD is not set
569CONFIG_NETDEVICES=y 590CONFIG_NETDEVICES=y
570# CONFIG_NETDEVICES_MULTIQUEUE is not set
571# CONFIG_DUMMY is not set 591# CONFIG_DUMMY is not set
572# CONFIG_BONDING is not set 592# CONFIG_BONDING is not set
573# CONFIG_MACVLAN is not set 593# CONFIG_MACVLAN is not set
@@ -580,11 +600,14 @@ CONFIG_MII=y
580CONFIG_SMC91X=y 600CONFIG_SMC91X=y
581# CONFIG_SMSC911X is not set 601# CONFIG_SMSC911X is not set
582# CONFIG_DM9000 is not set 602# CONFIG_DM9000 is not set
603# CONFIG_ENC28J60 is not set
583# CONFIG_IBM_NEW_EMAC_ZMII is not set 604# CONFIG_IBM_NEW_EMAC_ZMII is not set
584# CONFIG_IBM_NEW_EMAC_RGMII is not set 605# CONFIG_IBM_NEW_EMAC_RGMII is not set
585# CONFIG_IBM_NEW_EMAC_TAH is not set 606# CONFIG_IBM_NEW_EMAC_TAH is not set
586# CONFIG_IBM_NEW_EMAC_EMAC4 is not set 607# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
587# CONFIG_B44 is not set 608# CONFIG_IBM_NEW_EMAC_NO_FLOW_CTRL is not set
609# CONFIG_IBM_NEW_EMAC_MAL_CLR_ICINTSTAT is not set
610# CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set
588CONFIG_NETDEV_1000=y 611CONFIG_NETDEV_1000=y
589# CONFIG_AX88180 is not set 612# CONFIG_AX88180 is not set
590CONFIG_NETDEV_10000=y 613CONFIG_NETDEV_10000=y
@@ -594,10 +617,10 @@ CONFIG_NETDEV_10000=y
594# 617#
595# CONFIG_WLAN_PRE80211 is not set 618# CONFIG_WLAN_PRE80211 is not set
596# CONFIG_WLAN_80211 is not set 619# CONFIG_WLAN_80211 is not set
620# CONFIG_IWLWIFI_LEDS is not set
597# CONFIG_WAN is not set 621# CONFIG_WAN is not set
598# CONFIG_PPP is not set 622# CONFIG_PPP is not set
599# CONFIG_SLIP is not set 623# CONFIG_SLIP is not set
600# CONFIG_SHAPER is not set
601# CONFIG_NETCONSOLE is not set 624# CONFIG_NETCONSOLE is not set
602# CONFIG_NETPOLL is not set 625# CONFIG_NETPOLL is not set
603# CONFIG_NET_POLL_CONTROLLER is not set 626# CONFIG_NET_POLL_CONTROLLER is not set
@@ -645,8 +668,11 @@ CONFIG_INPUT_EVDEV=m
645# CONFIG_BF5xx_PPI is not set 668# CONFIG_BF5xx_PPI is not set
646CONFIG_BFIN_SPORT=y 669CONFIG_BFIN_SPORT=y
647# CONFIG_BFIN_TIMER_LATENCY is not set 670# CONFIG_BFIN_TIMER_LATENCY is not set
671CONFIG_BFIN_DMA_INTERFACE=m
648CONFIG_SIMPLE_GPIO=m 672CONFIG_SIMPLE_GPIO=m
649# CONFIG_VT is not set 673# CONFIG_VT is not set
674# CONFIG_DEVKMEM is not set
675# CONFIG_BFIN_JTAG_COMM is not set
650# CONFIG_SERIAL_NONSTANDARD is not set 676# CONFIG_SERIAL_NONSTANDARD is not set
651 677
652# 678#
@@ -675,22 +701,19 @@ CONFIG_UNIX98_PTYS=y
675# CONFIG_CAN4LINUX is not set 701# CONFIG_CAN4LINUX is not set
676# CONFIG_IPMI_HANDLER is not set 702# CONFIG_IPMI_HANDLER is not set
677# CONFIG_HW_RANDOM is not set 703# CONFIG_HW_RANDOM is not set
678# CONFIG_GEN_RTC is not set
679# CONFIG_R3964 is not set 704# CONFIG_R3964 is not set
680# CONFIG_RAW_DRIVER is not set 705# CONFIG_RAW_DRIVER is not set
681# CONFIG_TCG_TPM is not set 706# CONFIG_TCG_TPM is not set
682# CONFIG_I2C is not set 707# CONFIG_I2C is not set
683
684#
685# SPI support
686#
687CONFIG_SPI=y 708CONFIG_SPI=y
709# CONFIG_SPI_DEBUG is not set
688CONFIG_SPI_MASTER=y 710CONFIG_SPI_MASTER=y
689 711
690# 712#
691# SPI Master Controller Drivers 713# SPI Master Controller Drivers
692# 714#
693CONFIG_SPI_BFIN=y 715CONFIG_SPI_BFIN=y
716# CONFIG_SPI_BFIN_LOCK is not set
694# CONFIG_SPI_BITBANG is not set 717# CONFIG_SPI_BITBANG is not set
695 718
696# 719#
@@ -699,14 +722,18 @@ CONFIG_SPI_BFIN=y
699# CONFIG_SPI_AT25 is not set 722# CONFIG_SPI_AT25 is not set
700# CONFIG_SPI_SPIDEV is not set 723# CONFIG_SPI_SPIDEV is not set
701# CONFIG_SPI_TLE62X0 is not set 724# CONFIG_SPI_TLE62X0 is not set
725CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y
726# CONFIG_GPIOLIB is not set
702# CONFIG_W1 is not set 727# CONFIG_W1 is not set
703# CONFIG_POWER_SUPPLY is not set 728# CONFIG_POWER_SUPPLY is not set
704CONFIG_HWMON=y 729CONFIG_HWMON=y
705# CONFIG_HWMON_VID is not set 730# CONFIG_HWMON_VID is not set
731# CONFIG_SENSORS_ADCXX is not set
706# CONFIG_SENSORS_F71805F is not set 732# CONFIG_SENSORS_F71805F is not set
707# CONFIG_SENSORS_F71882FG is not set 733# CONFIG_SENSORS_F71882FG is not set
708# CONFIG_SENSORS_IT87 is not set 734# CONFIG_SENSORS_IT87 is not set
709# CONFIG_SENSORS_LM70 is not set 735# CONFIG_SENSORS_LM70 is not set
736# CONFIG_SENSORS_MAX1111 is not set
710# CONFIG_SENSORS_PC87360 is not set 737# CONFIG_SENSORS_PC87360 is not set
711# CONFIG_SENSORS_PC87427 is not set 738# CONFIG_SENSORS_PC87427 is not set
712# CONFIG_SENSORS_SMSC47M1 is not set 739# CONFIG_SENSORS_SMSC47M1 is not set
@@ -715,6 +742,8 @@ CONFIG_HWMON=y
715# CONFIG_SENSORS_W83627HF is not set 742# CONFIG_SENSORS_W83627HF is not set
716# CONFIG_SENSORS_W83627EHF is not set 743# CONFIG_SENSORS_W83627EHF is not set
717# CONFIG_HWMON_DEBUG_CHIP is not set 744# CONFIG_HWMON_DEBUG_CHIP is not set
745# CONFIG_THERMAL is not set
746# CONFIG_THERMAL_HWMON is not set
718CONFIG_WATCHDOG=y 747CONFIG_WATCHDOG=y
719# CONFIG_WATCHDOG_NOWAYOUT is not set 748# CONFIG_WATCHDOG_NOWAYOUT is not set
720 749
@@ -725,21 +754,28 @@ CONFIG_WATCHDOG=y
725CONFIG_BFIN_WDT=y 754CONFIG_BFIN_WDT=y
726 755
727# 756#
728# Sonics Silicon Backplane
729#
730CONFIG_SSB_POSSIBLE=y
731# CONFIG_SSB is not set
732
733#
734# Multifunction device drivers 757# Multifunction device drivers
735# 758#
759# CONFIG_MFD_CORE is not set
736# CONFIG_MFD_SM501 is not set 760# CONFIG_MFD_SM501 is not set
761# CONFIG_HTC_PASIC3 is not set
762# CONFIG_MFD_TMIO is not set
763# CONFIG_MFD_WM8400 is not set
737 764
738# 765#
739# Multimedia devices 766# Multimedia devices
740# 767#
768
769#
770# Multimedia core support
771#
741# CONFIG_VIDEO_DEV is not set 772# CONFIG_VIDEO_DEV is not set
742# CONFIG_DVB_CORE is not set 773# CONFIG_DVB_CORE is not set
774# CONFIG_VIDEO_MEDIA is not set
775
776#
777# Multimedia drivers
778#
743# CONFIG_DAB is not set 779# CONFIG_DAB is not set
744 780
745# 781#
@@ -754,18 +790,22 @@ CONFIG_SSB_POSSIBLE=y
754# Display device support 790# Display device support
755# 791#
756# CONFIG_DISPLAY_SUPPORT is not set 792# CONFIG_DISPLAY_SUPPORT is not set
757
758#
759# Sound
760#
761# CONFIG_SOUND is not set 793# CONFIG_SOUND is not set
762CONFIG_HID_SUPPORT=y 794CONFIG_HID_SUPPORT=y
763CONFIG_HID=m 795CONFIG_HID=m
764# CONFIG_HID_DEBUG is not set 796# CONFIG_HID_DEBUG is not set
765# CONFIG_HIDRAW is not set 797# CONFIG_HIDRAW is not set
798# CONFIG_HID_PID is not set
799
800#
801# Special HID drivers
802#
803CONFIG_HID_COMPAT=y
766# CONFIG_USB_SUPPORT is not set 804# CONFIG_USB_SUPPORT is not set
767# CONFIG_MMC is not set 805# CONFIG_MMC is not set
806# CONFIG_MEMSTICK is not set
768# CONFIG_NEW_LEDS is not set 807# CONFIG_NEW_LEDS is not set
808# CONFIG_ACCESSIBILITY is not set
769CONFIG_RTC_LIB=y 809CONFIG_RTC_LIB=y
770CONFIG_RTC_CLASS=y 810CONFIG_RTC_CLASS=y
771CONFIG_RTC_HCTOSYS=y 811CONFIG_RTC_HCTOSYS=y
@@ -784,47 +824,51 @@ CONFIG_RTC_INTF_DEV=y
784# 824#
785# SPI RTC drivers 825# SPI RTC drivers
786# 826#
787# CONFIG_RTC_DRV_RS5C348 is not set 827# CONFIG_RTC_DRV_M41T94 is not set
828# CONFIG_RTC_DRV_DS1305 is not set
788# CONFIG_RTC_DRV_MAX6902 is not set 829# CONFIG_RTC_DRV_MAX6902 is not set
830# CONFIG_RTC_DRV_R9701 is not set
831# CONFIG_RTC_DRV_RS5C348 is not set
832# CONFIG_RTC_DRV_DS3234 is not set
789 833
790# 834#
791# Platform RTC drivers 835# Platform RTC drivers
792# 836#
837# CONFIG_RTC_DRV_DS1286 is not set
838# CONFIG_RTC_DRV_DS1511 is not set
793# CONFIG_RTC_DRV_DS1553 is not set 839# CONFIG_RTC_DRV_DS1553 is not set
794# CONFIG_RTC_DRV_STK17TA8 is not set
795# CONFIG_RTC_DRV_DS1742 is not set 840# CONFIG_RTC_DRV_DS1742 is not set
841# CONFIG_RTC_DRV_STK17TA8 is not set
796# CONFIG_RTC_DRV_M48T86 is not set 842# CONFIG_RTC_DRV_M48T86 is not set
843# CONFIG_RTC_DRV_M48T35 is not set
797# CONFIG_RTC_DRV_M48T59 is not set 844# CONFIG_RTC_DRV_M48T59 is not set
845# CONFIG_RTC_DRV_BQ4802 is not set
798# CONFIG_RTC_DRV_V3020 is not set 846# CONFIG_RTC_DRV_V3020 is not set
799 847
800# 848#
801# on-CPU RTC drivers 849# on-CPU RTC drivers
802# 850#
803CONFIG_RTC_DRV_BFIN=y 851CONFIG_RTC_DRV_BFIN=y
804 852# CONFIG_DMADEVICES is not set
805#
806# Userspace I/O
807#
808# CONFIG_UIO is not set 853# CONFIG_UIO is not set
854# CONFIG_STAGING is not set
809 855
810# 856#
811# File systems 857# File systems
812# 858#
813# CONFIG_EXT2_FS is not set 859# CONFIG_EXT2_FS is not set
814# CONFIG_EXT3_FS is not set 860# CONFIG_EXT3_FS is not set
815# CONFIG_EXT4DEV_FS is not set 861# CONFIG_EXT4_FS is not set
816# CONFIG_REISERFS_FS is not set 862# CONFIG_REISERFS_FS is not set
817# CONFIG_JFS_FS is not set 863# CONFIG_JFS_FS is not set
818# CONFIG_FS_POSIX_ACL is not set 864# CONFIG_FS_POSIX_ACL is not set
865CONFIG_FILE_LOCKING=y
819# CONFIG_XFS_FS is not set 866# CONFIG_XFS_FS is not set
820# CONFIG_GFS2_FS is not set
821# CONFIG_OCFS2_FS is not set 867# CONFIG_OCFS2_FS is not set
822# CONFIG_MINIX_FS is not set 868# CONFIG_DNOTIFY is not set
823# CONFIG_ROMFS_FS is not set
824CONFIG_INOTIFY=y 869CONFIG_INOTIFY=y
825CONFIG_INOTIFY_USER=y 870CONFIG_INOTIFY_USER=y
826# CONFIG_QUOTA is not set 871# CONFIG_QUOTA is not set
827# CONFIG_DNOTIFY is not set
828# CONFIG_AUTOFS_FS is not set 872# CONFIG_AUTOFS_FS is not set
829# CONFIG_AUTOFS4_FS is not set 873# CONFIG_AUTOFS4_FS is not set
830# CONFIG_FUSE_FS is not set 874# CONFIG_FUSE_FS is not set
@@ -864,11 +908,11 @@ CONFIG_SYSFS=y
864# CONFIG_EFS_FS is not set 908# CONFIG_EFS_FS is not set
865CONFIG_YAFFS_FS=m 909CONFIG_YAFFS_FS=m
866CONFIG_YAFFS_YAFFS1=y 910CONFIG_YAFFS_YAFFS1=y
911# CONFIG_YAFFS_9BYTE_TAGS is not set
867# CONFIG_YAFFS_DOES_ECC is not set 912# CONFIG_YAFFS_DOES_ECC is not set
868CONFIG_YAFFS_YAFFS2=y 913CONFIG_YAFFS_YAFFS2=y
869CONFIG_YAFFS_AUTO_YAFFS2=y 914CONFIG_YAFFS_AUTO_YAFFS2=y
870# CONFIG_YAFFS_DISABLE_LAZY_LOAD is not set 915# CONFIG_YAFFS_DISABLE_LAZY_LOAD is not set
871CONFIG_YAFFS_CHECKPOINT_RESERVED_BLOCKS=10
872# CONFIG_YAFFS_DISABLE_WIDE_TNODES is not set 916# CONFIG_YAFFS_DISABLE_WIDE_TNODES is not set
873# CONFIG_YAFFS_ALWAYS_CHECK_CHUNK_ERASED is not set 917# CONFIG_YAFFS_ALWAYS_CHECK_CHUNK_ERASED is not set
874CONFIG_YAFFS_SHORT_NAMES_IN_RAM=y 918CONFIG_YAFFS_SHORT_NAMES_IN_RAM=y
@@ -885,8 +929,11 @@ CONFIG_JFFS2_RTIME=y
885# CONFIG_JFFS2_RUBIN is not set 929# CONFIG_JFFS2_RUBIN is not set
886# CONFIG_CRAMFS is not set 930# CONFIG_CRAMFS is not set
887# CONFIG_VXFS_FS is not set 931# CONFIG_VXFS_FS is not set
932# CONFIG_MINIX_FS is not set
933# CONFIG_OMFS_FS is not set
888# CONFIG_HPFS_FS is not set 934# CONFIG_HPFS_FS is not set
889# CONFIG_QNX4FS_FS is not set 935# CONFIG_QNX4FS_FS is not set
936# CONFIG_ROMFS_FS is not set
890# CONFIG_SYSV_FS is not set 937# CONFIG_SYSV_FS is not set
891# CONFIG_UFS_FS is not set 938# CONFIG_UFS_FS is not set
892CONFIG_NETWORK_FILESYSTEMS=y 939CONFIG_NETWORK_FILESYSTEMS=y
@@ -894,13 +941,12 @@ CONFIG_NFS_FS=m
894CONFIG_NFS_V3=y 941CONFIG_NFS_V3=y
895# CONFIG_NFS_V3_ACL is not set 942# CONFIG_NFS_V3_ACL is not set
896# CONFIG_NFS_V4 is not set 943# CONFIG_NFS_V4 is not set
897# CONFIG_NFS_DIRECTIO is not set
898# CONFIG_NFSD is not set 944# CONFIG_NFSD is not set
899CONFIG_LOCKD=m 945CONFIG_LOCKD=m
900CONFIG_LOCKD_V4=y 946CONFIG_LOCKD_V4=y
901CONFIG_NFS_COMMON=y 947CONFIG_NFS_COMMON=y
902CONFIG_SUNRPC=m 948CONFIG_SUNRPC=m
903# CONFIG_SUNRPC_BIND34 is not set 949# CONFIG_SUNRPC_REGISTER_V4 is not set
904# CONFIG_RPCSEC_GSS_KRB5 is not set 950# CONFIG_RPCSEC_GSS_KRB5 is not set
905# CONFIG_RPCSEC_GSS_SPKM3 is not set 951# CONFIG_RPCSEC_GSS_SPKM3 is not set
906CONFIG_SMB_FS=m 952CONFIG_SMB_FS=m
@@ -956,9 +1002,6 @@ CONFIG_NLS_DEFAULT="iso8859-1"
956# CONFIG_NLS_KOI8_U is not set 1002# CONFIG_NLS_KOI8_U is not set
957# CONFIG_NLS_UTF8 is not set 1003# CONFIG_NLS_UTF8 is not set
958# CONFIG_DLM is not set 1004# CONFIG_DLM is not set
959CONFIG_INSTRUMENTATION=y
960# CONFIG_PROFILING is not set
961# CONFIG_MARKERS is not set
962 1005
963# 1006#
964# Kernel hacking 1007# Kernel hacking
@@ -966,14 +1009,53 @@ CONFIG_INSTRUMENTATION=y
966# CONFIG_PRINTK_TIME is not set 1009# CONFIG_PRINTK_TIME is not set
967CONFIG_ENABLE_WARN_DEPRECATED=y 1010CONFIG_ENABLE_WARN_DEPRECATED=y
968CONFIG_ENABLE_MUST_CHECK=y 1011CONFIG_ENABLE_MUST_CHECK=y
1012CONFIG_FRAME_WARN=1024
969# CONFIG_MAGIC_SYSRQ is not set 1013# CONFIG_MAGIC_SYSRQ is not set
970# CONFIG_UNUSED_SYMBOLS is not set 1014# CONFIG_UNUSED_SYMBOLS is not set
971CONFIG_DEBUG_FS=y 1015CONFIG_DEBUG_FS=y
972# CONFIG_HEADERS_CHECK is not set 1016# CONFIG_HEADERS_CHECK is not set
973# CONFIG_DEBUG_KERNEL is not set 1017CONFIG_DEBUG_KERNEL=y
1018# CONFIG_DEBUG_SHIRQ is not set
1019CONFIG_DETECT_SOFTLOCKUP=y
1020# CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC is not set
1021CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE=0
1022CONFIG_SCHED_DEBUG=y
1023# CONFIG_SCHEDSTATS is not set
1024# CONFIG_TIMER_STATS is not set
1025# CONFIG_DEBUG_OBJECTS is not set
1026# CONFIG_DEBUG_SLAB is not set
1027# CONFIG_DEBUG_RT_MUTEXES is not set
1028# CONFIG_RT_MUTEX_TESTER is not set
1029# CONFIG_DEBUG_SPINLOCK is not set
1030# CONFIG_DEBUG_MUTEXES is not set
1031# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
1032# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
1033# CONFIG_DEBUG_KOBJECT is not set
974# CONFIG_DEBUG_BUGVERBOSE is not set 1034# CONFIG_DEBUG_BUGVERBOSE is not set
1035CONFIG_DEBUG_INFO=y
1036# CONFIG_DEBUG_VM is not set
1037# CONFIG_DEBUG_WRITECOUNT is not set
1038# CONFIG_DEBUG_MEMORY_INIT is not set
1039# CONFIG_DEBUG_LIST is not set
1040# CONFIG_DEBUG_SG is not set
1041# CONFIG_FRAME_POINTER is not set
1042# CONFIG_BOOT_PRINTK_DELAY is not set
1043# CONFIG_RCU_TORTURE_TEST is not set
1044# CONFIG_RCU_CPU_STALL_DETECTOR is not set
1045# CONFIG_BACKTRACE_SELF_TEST is not set
1046# CONFIG_DEBUG_BLOCK_EXT_DEVT is not set
1047# CONFIG_FAULT_INJECTION is not set
1048# CONFIG_SYSCTL_SYSCALL_CHECK is not set
1049# CONFIG_DYNAMIC_PRINTK_DEBUG is not set
975# CONFIG_SAMPLES is not set 1050# CONFIG_SAMPLES is not set
1051CONFIG_HAVE_ARCH_KGDB=y
1052# CONFIG_KGDB is not set
1053# CONFIG_DEBUG_STACKOVERFLOW is not set
1054# CONFIG_DEBUG_STACK_USAGE is not set
1055CONFIG_DEBUG_VERBOSE=y
976CONFIG_DEBUG_MMRS=y 1056CONFIG_DEBUG_MMRS=y
1057# CONFIG_DEBUG_HWERR is not set
1058# CONFIG_DEBUG_DOUBLEFAULT is not set
977CONFIG_DEBUG_HUNT_FOR_ZERO=y 1059CONFIG_DEBUG_HUNT_FOR_ZERO=y
978CONFIG_DEBUG_BFIN_HWTRACE_ON=y 1060CONFIG_DEBUG_BFIN_HWTRACE_ON=y
979CONFIG_DEBUG_BFIN_HWTRACE_COMPRESSION_OFF=y 1061CONFIG_DEBUG_BFIN_HWTRACE_COMPRESSION_OFF=y
@@ -991,9 +1073,94 @@ CONFIG_ACCESS_CHECK=y
991# 1073#
992# CONFIG_KEYS is not set 1074# CONFIG_KEYS is not set
993CONFIG_SECURITY=y 1075CONFIG_SECURITY=y
1076# CONFIG_SECURITYFS is not set
994# CONFIG_SECURITY_NETWORK is not set 1077# CONFIG_SECURITY_NETWORK is not set
995# CONFIG_SECURITY_CAPABILITIES is not set 1078# CONFIG_SECURITY_FILE_CAPABILITIES is not set
996# CONFIG_CRYPTO is not set 1079CONFIG_SECURITY_DEFAULT_MMAP_MIN_ADDR=0
1080CONFIG_CRYPTO=y
1081
1082#
1083# Crypto core or helper
1084#
1085# CONFIG_CRYPTO_FIPS is not set
1086# CONFIG_CRYPTO_MANAGER is not set
1087# CONFIG_CRYPTO_GF128MUL is not set
1088# CONFIG_CRYPTO_NULL is not set
1089# CONFIG_CRYPTO_CRYPTD is not set
1090# CONFIG_CRYPTO_AUTHENC is not set
1091# CONFIG_CRYPTO_TEST is not set
1092
1093#
1094# Authenticated Encryption with Associated Data
1095#
1096# CONFIG_CRYPTO_CCM is not set
1097# CONFIG_CRYPTO_GCM is not set
1098# CONFIG_CRYPTO_SEQIV is not set
1099
1100#
1101# Block modes
1102#
1103# CONFIG_CRYPTO_CBC is not set
1104# CONFIG_CRYPTO_CTR is not set
1105# CONFIG_CRYPTO_CTS is not set
1106# CONFIG_CRYPTO_ECB is not set
1107# CONFIG_CRYPTO_LRW is not set
1108# CONFIG_CRYPTO_PCBC is not set
1109# CONFIG_CRYPTO_XTS is not set
1110
1111#
1112# Hash modes
1113#
1114# CONFIG_CRYPTO_HMAC is not set
1115# CONFIG_CRYPTO_XCBC is not set
1116
1117#
1118# Digest
1119#
1120# CONFIG_CRYPTO_CRC32C is not set
1121# CONFIG_CRYPTO_MD4 is not set
1122# CONFIG_CRYPTO_MD5 is not set
1123# CONFIG_CRYPTO_MICHAEL_MIC is not set
1124# CONFIG_CRYPTO_RMD128 is not set
1125# CONFIG_CRYPTO_RMD160 is not set
1126# CONFIG_CRYPTO_RMD256 is not set
1127# CONFIG_CRYPTO_RMD320 is not set
1128# CONFIG_CRYPTO_SHA1 is not set
1129# CONFIG_CRYPTO_SHA256 is not set
1130# CONFIG_CRYPTO_SHA512 is not set
1131# CONFIG_CRYPTO_TGR192 is not set
1132# CONFIG_CRYPTO_WP512 is not set
1133
1134#
1135# Ciphers
1136#
1137# CONFIG_CRYPTO_AES is not set
1138# CONFIG_CRYPTO_ANUBIS is not set
1139# CONFIG_CRYPTO_ARC4 is not set
1140# CONFIG_CRYPTO_BLOWFISH is not set
1141# CONFIG_CRYPTO_CAMELLIA is not set
1142# CONFIG_CRYPTO_CAST5 is not set
1143# CONFIG_CRYPTO_CAST6 is not set
1144# CONFIG_CRYPTO_DES is not set
1145# CONFIG_CRYPTO_FCRYPT is not set
1146# CONFIG_CRYPTO_KHAZAD is not set
1147# CONFIG_CRYPTO_SALSA20 is not set
1148# CONFIG_CRYPTO_SEED is not set
1149# CONFIG_CRYPTO_SERPENT is not set
1150# CONFIG_CRYPTO_TEA is not set
1151# CONFIG_CRYPTO_TWOFISH is not set
1152
1153#
1154# Compression
1155#
1156# CONFIG_CRYPTO_DEFLATE is not set
1157# CONFIG_CRYPTO_LZO is not set
1158
1159#
1160# Random Number Generation
1161#
1162# CONFIG_CRYPTO_ANSI_CPRNG is not set
1163CONFIG_CRYPTO_HW=y
997 1164
998# 1165#
999# Library routines 1166# Library routines
@@ -1001,6 +1168,7 @@ CONFIG_SECURITY=y
1001CONFIG_BITREVERSE=y 1168CONFIG_BITREVERSE=y
1002CONFIG_CRC_CCITT=m 1169CONFIG_CRC_CCITT=m
1003# CONFIG_CRC16 is not set 1170# CONFIG_CRC16 is not set
1171# CONFIG_CRC_T10DIF is not set
1004# CONFIG_CRC_ITU_T is not set 1172# CONFIG_CRC_ITU_T is not set
1005CONFIG_CRC32=y 1173CONFIG_CRC32=y
1006# CONFIG_CRC7 is not set 1174# CONFIG_CRC7 is not set
diff --git a/arch/blackfin/configs/BF533-STAMP_defconfig b/arch/blackfin/configs/BF533-STAMP_defconfig
index c23267ed880b..49eabb41e9e5 100644
--- a/arch/blackfin/configs/BF533-STAMP_defconfig
+++ b/arch/blackfin/configs/BF533-STAMP_defconfig
@@ -1,6 +1,6 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.24.7 3# Linux kernel version: 2.6.28-rc2
4# 4#
5# CONFIG_MMU is not set 5# CONFIG_MMU is not set
6# CONFIG_FPU is not set 6# CONFIG_FPU is not set
@@ -8,7 +8,6 @@ CONFIG_RWSEM_GENERIC_SPINLOCK=y
8# CONFIG_RWSEM_XCHGADD_ALGORITHM is not set 8# CONFIG_RWSEM_XCHGADD_ALGORITHM is not set
9CONFIG_BLACKFIN=y 9CONFIG_BLACKFIN=y
10CONFIG_ZONE_DMA=y 10CONFIG_ZONE_DMA=y
11CONFIG_SEMAPHORE_SLEEPERS=y
12CONFIG_GENERIC_FIND_NEXT_BIT=y 11CONFIG_GENERIC_FIND_NEXT_BIT=y
13CONFIG_GENERIC_HWEIGHT=y 12CONFIG_GENERIC_HWEIGHT=y
14CONFIG_GENERIC_HARDIRQS=y 13CONFIG_GENERIC_HARDIRQS=y
@@ -31,18 +30,16 @@ CONFIG_SYSVIPC_SYSCTL=y
31# CONFIG_POSIX_MQUEUE is not set 30# CONFIG_POSIX_MQUEUE is not set
32# CONFIG_BSD_PROCESS_ACCT is not set 31# CONFIG_BSD_PROCESS_ACCT is not set
33# CONFIG_TASKSTATS is not set 32# CONFIG_TASKSTATS is not set
34# CONFIG_USER_NS is not set
35# CONFIG_PID_NS is not set
36# CONFIG_AUDIT is not set 33# CONFIG_AUDIT is not set
37CONFIG_IKCONFIG=y 34CONFIG_IKCONFIG=y
38CONFIG_IKCONFIG_PROC=y 35CONFIG_IKCONFIG_PROC=y
39CONFIG_LOG_BUF_SHIFT=14 36CONFIG_LOG_BUF_SHIFT=14
40# CONFIG_CGROUPS is not set 37# CONFIG_CGROUPS is not set
41CONFIG_FAIR_GROUP_SCHED=y 38# CONFIG_GROUP_SCHED is not set
42CONFIG_FAIR_USER_SCHED=y 39# CONFIG_SYSFS_DEPRECATED is not set
43# CONFIG_FAIR_CGROUP_SCHED is not set 40# CONFIG_SYSFS_DEPRECATED_V2 is not set
44CONFIG_SYSFS_DEPRECATED=y
45# CONFIG_RELAY is not set 41# CONFIG_RELAY is not set
42# CONFIG_NAMESPACES is not set
46CONFIG_BLK_DEV_INITRD=y 43CONFIG_BLK_DEV_INITRD=y
47CONFIG_INITRAMFS_SOURCE="" 44CONFIG_INITRAMFS_SOURCE=""
48# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 45# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
@@ -51,26 +48,35 @@ CONFIG_EMBEDDED=y
51CONFIG_UID16=y 48CONFIG_UID16=y
52CONFIG_SYSCTL_SYSCALL=y 49CONFIG_SYSCTL_SYSCALL=y
53CONFIG_KALLSYMS=y 50CONFIG_KALLSYMS=y
51# CONFIG_KALLSYMS_ALL is not set
54# CONFIG_KALLSYMS_EXTRA_PASS is not set 52# CONFIG_KALLSYMS_EXTRA_PASS is not set
55CONFIG_HOTPLUG=y 53CONFIG_HOTPLUG=y
56CONFIG_PRINTK=y 54CONFIG_PRINTK=y
57CONFIG_BUG=y 55CONFIG_BUG=y
58CONFIG_ELF_CORE=y 56# CONFIG_ELF_CORE is not set
57CONFIG_COMPAT_BRK=y
59CONFIG_BASE_FULL=y 58CONFIG_BASE_FULL=y
60CONFIG_FUTEX=y 59CONFIG_FUTEX=y
61CONFIG_ANON_INODES=y 60CONFIG_ANON_INODES=y
62CONFIG_EPOLL=y 61CONFIG_EPOLL=y
63CONFIG_SIGNALFD=y 62CONFIG_SIGNALFD=y
63CONFIG_TIMERFD=y
64CONFIG_EVENTFD=y 64CONFIG_EVENTFD=y
65CONFIG_AIO=y
65CONFIG_VM_EVENT_COUNTERS=y 66CONFIG_VM_EVENT_COUNTERS=y
66CONFIG_SLAB=y 67CONFIG_SLAB=y
67# CONFIG_SLUB is not set 68# CONFIG_SLUB is not set
68# CONFIG_SLOB is not set 69# CONFIG_SLOB is not set
70# CONFIG_PROFILING is not set
71# CONFIG_MARKERS is not set
72CONFIG_HAVE_OPROFILE=y
73# CONFIG_HAVE_GENERIC_DMA_COHERENT is not set
69CONFIG_SLABINFO=y 74CONFIG_SLABINFO=y
70CONFIG_RT_MUTEXES=y 75CONFIG_RT_MUTEXES=y
71CONFIG_TINY_SHMEM=y 76CONFIG_TINY_SHMEM=y
72CONFIG_BASE_SMALL=0 77CONFIG_BASE_SMALL=0
73CONFIG_MODULES=y 78CONFIG_MODULES=y
79# CONFIG_MODULE_FORCE_LOAD is not set
74CONFIG_MODULE_UNLOAD=y 80CONFIG_MODULE_UNLOAD=y
75# CONFIG_MODULE_FORCE_UNLOAD is not set 81# CONFIG_MODULE_FORCE_UNLOAD is not set
76# CONFIG_MODVERSIONS is not set 82# CONFIG_MODVERSIONS is not set
@@ -81,6 +87,7 @@ CONFIG_BLOCK=y
81# CONFIG_BLK_DEV_IO_TRACE is not set 87# CONFIG_BLK_DEV_IO_TRACE is not set
82# CONFIG_LSF is not set 88# CONFIG_LSF is not set
83# CONFIG_BLK_DEV_BSG is not set 89# CONFIG_BLK_DEV_BSG is not set
90# CONFIG_BLK_DEV_INTEGRITY is not set
84 91
85# 92#
86# IO Schedulers 93# IO Schedulers
@@ -94,9 +101,11 @@ CONFIG_DEFAULT_AS=y
94# CONFIG_DEFAULT_CFQ is not set 101# CONFIG_DEFAULT_CFQ is not set
95# CONFIG_DEFAULT_NOOP is not set 102# CONFIG_DEFAULT_NOOP is not set
96CONFIG_DEFAULT_IOSCHED="anticipatory" 103CONFIG_DEFAULT_IOSCHED="anticipatory"
104CONFIG_CLASSIC_RCU=y
97# CONFIG_PREEMPT_NONE is not set 105# CONFIG_PREEMPT_NONE is not set
98CONFIG_PREEMPT_VOLUNTARY=y 106CONFIG_PREEMPT_VOLUNTARY=y
99# CONFIG_PREEMPT is not set 107# CONFIG_PREEMPT is not set
108CONFIG_FREEZER=y
100 109
101# 110#
102# Blackfin Processor Options 111# Blackfin Processor Options
@@ -105,6 +114,10 @@ CONFIG_PREEMPT_VOLUNTARY=y
105# 114#
106# Processor and Board Settings 115# Processor and Board Settings
107# 116#
117# CONFIG_BF512 is not set
118# CONFIG_BF514 is not set
119# CONFIG_BF516 is not set
120# CONFIG_BF518 is not set
108# CONFIG_BF522 is not set 121# CONFIG_BF522 is not set
109# CONFIG_BF523 is not set 122# CONFIG_BF523 is not set
110# CONFIG_BF524 is not set 123# CONFIG_BF524 is not set
@@ -117,24 +130,30 @@ CONFIG_BF533=y
117# CONFIG_BF534 is not set 130# CONFIG_BF534 is not set
118# CONFIG_BF536 is not set 131# CONFIG_BF536 is not set
119# CONFIG_BF537 is not set 132# CONFIG_BF537 is not set
133# CONFIG_BF538 is not set
134# CONFIG_BF539 is not set
120# CONFIG_BF542 is not set 135# CONFIG_BF542 is not set
121# CONFIG_BF544 is not set 136# CONFIG_BF544 is not set
122# CONFIG_BF547 is not set 137# CONFIG_BF547 is not set
123# CONFIG_BF548 is not set 138# CONFIG_BF548 is not set
124# CONFIG_BF549 is not set 139# CONFIG_BF549 is not set
125# CONFIG_BF561 is not set 140# CONFIG_BF561 is not set
141CONFIG_BF_REV_MIN=3
142CONFIG_BF_REV_MAX=6
126# CONFIG_BF_REV_0_0 is not set 143# CONFIG_BF_REV_0_0 is not set
127# CONFIG_BF_REV_0_1 is not set 144# CONFIG_BF_REV_0_1 is not set
128# CONFIG_BF_REV_0_2 is not set 145# CONFIG_BF_REV_0_2 is not set
129CONFIG_BF_REV_0_3=y 146CONFIG_BF_REV_0_3=y
130# CONFIG_BF_REV_0_4 is not set 147# CONFIG_BF_REV_0_4 is not set
131# CONFIG_BF_REV_0_5 is not set 148# CONFIG_BF_REV_0_5 is not set
149# CONFIG_BF_REV_0_6 is not set
132# CONFIG_BF_REV_ANY is not set 150# CONFIG_BF_REV_ANY is not set
133# CONFIG_BF_REV_NONE is not set 151# CONFIG_BF_REV_NONE is not set
134CONFIG_BF53x=y 152CONFIG_BF53x=y
135CONFIG_MEM_MT48LC64M4A2FB_7E=y 153CONFIG_MEM_MT48LC64M4A2FB_7E=y
136# CONFIG_BFIN533_EZKIT is not set 154# CONFIG_BFIN533_EZKIT is not set
137CONFIG_BFIN533_STAMP=y 155CONFIG_BFIN533_STAMP=y
156# CONFIG_BLACKSTAMP is not set
138# CONFIG_BFIN533_BLUETECHNIX_CM is not set 157# CONFIG_BFIN533_BLUETECHNIX_CM is not set
139# CONFIG_H8606_HVSISTEMAS is not set 158# CONFIG_H8606_HVSISTEMAS is not set
140# CONFIG_BFIN532_IP0X is not set 159# CONFIG_BFIN532_IP0X is not set
@@ -187,7 +206,6 @@ CONFIG_BOOT_LOAD=0x1000
187# 206#
188CONFIG_CLKIN_HZ=11059200 207CONFIG_CLKIN_HZ=11059200
189# CONFIG_BFIN_KERNEL_CLOCK is not set 208# CONFIG_BFIN_KERNEL_CLOCK is not set
190CONFIG_MAX_MEM_SIZE=512
191CONFIG_MAX_VCO_HZ=750000000 209CONFIG_MAX_VCO_HZ=750000000
192CONFIG_MIN_VCO_HZ=50000000 210CONFIG_MIN_VCO_HZ=50000000
193CONFIG_MAX_SCLK_HZ=133333333 211CONFIG_MAX_SCLK_HZ=133333333
@@ -201,6 +219,7 @@ CONFIG_HZ_250=y
201# CONFIG_HZ_300 is not set 219# CONFIG_HZ_300 is not set
202# CONFIG_HZ_1000 is not set 220# CONFIG_HZ_1000 is not set
203CONFIG_HZ=250 221CONFIG_HZ=250
222CONFIG_SCHED_HRTICK=y
204CONFIG_GENERIC_TIME=y 223CONFIG_GENERIC_TIME=y
205CONFIG_GENERIC_CLOCKEVENTS=y 224CONFIG_GENERIC_CLOCKEVENTS=y
206# CONFIG_CYCLES_CLOCKSOURCE is not set 225# CONFIG_CYCLES_CLOCKSOURCE is not set
@@ -238,6 +257,12 @@ CONFIG_SYS_BFIN_SPINLOCK_L1=y
238CONFIG_CACHELINE_ALIGNED_L1=y 257CONFIG_CACHELINE_ALIGNED_L1=y
239# CONFIG_SYSCALL_TAB_L1 is not set 258# CONFIG_SYSCALL_TAB_L1 is not set
240# CONFIG_CPLB_SWITCH_TAB_L1 is not set 259# CONFIG_CPLB_SWITCH_TAB_L1 is not set
260CONFIG_APP_STACK_L1=y
261
262#
263# Speed Optimizations
264#
265CONFIG_BFIN_INS_LOWOVERHEAD=y
241CONFIG_RAMKERNEL=y 266CONFIG_RAMKERNEL=y
242# CONFIG_ROMKERNEL is not set 267# CONFIG_ROMKERNEL is not set
243CONFIG_SELECT_MEMORY_MODEL=y 268CONFIG_SELECT_MEMORY_MODEL=y
@@ -246,14 +271,13 @@ CONFIG_FLATMEM_MANUAL=y
246# CONFIG_SPARSEMEM_MANUAL is not set 271# CONFIG_SPARSEMEM_MANUAL is not set
247CONFIG_FLATMEM=y 272CONFIG_FLATMEM=y
248CONFIG_FLAT_NODE_MEM_MAP=y 273CONFIG_FLAT_NODE_MEM_MAP=y
249# CONFIG_SPARSEMEM_STATIC is not set 274CONFIG_PAGEFLAGS_EXTENDED=y
250# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
251CONFIG_SPLIT_PTLOCK_CPUS=4 275CONFIG_SPLIT_PTLOCK_CPUS=4
252# CONFIG_RESOURCES_64BIT is not set 276# CONFIG_RESOURCES_64BIT is not set
277# CONFIG_PHYS_ADDR_T_64BIT is not set
253CONFIG_ZONE_DMA_FLAG=1 278CONFIG_ZONE_DMA_FLAG=1
254CONFIG_VIRT_TO_BUS=y 279CONFIG_VIRT_TO_BUS=y
255# CONFIG_BFIN_GPTIMERS is not set 280# CONFIG_BFIN_GPTIMERS is not set
256CONFIG_BFIN_DMA_5XX=y
257# CONFIG_DMA_UNCACHED_4M is not set 281# CONFIG_DMA_UNCACHED_4M is not set
258# CONFIG_DMA_UNCACHED_2M is not set 282# CONFIG_DMA_UNCACHED_2M is not set
259CONFIG_DMA_UNCACHED_1M=y 283CONFIG_DMA_UNCACHED_1M=y
@@ -268,7 +292,6 @@ CONFIG_BFIN_DCACHE=y
268# CONFIG_BFIN_ICACHE_LOCK is not set 292# CONFIG_BFIN_ICACHE_LOCK is not set
269# CONFIG_BFIN_WB is not set 293# CONFIG_BFIN_WB is not set
270CONFIG_BFIN_WT=y 294CONFIG_BFIN_WT=y
271CONFIG_L1_MAX_PIECE=16
272# CONFIG_MPU is not set 295# CONFIG_MPU is not set
273 296
274# 297#
@@ -297,7 +320,6 @@ CONFIG_BANK_3=0xAAC2
297# 320#
298# Bus options (PCI, PCMCIA, EISA, MCA, ISA) 321# Bus options (PCI, PCMCIA, EISA, MCA, ISA)
299# 322#
300# CONFIG_PCI is not set
301# CONFIG_ARCH_SUPPORTS_MSI is not set 323# CONFIG_ARCH_SUPPORTS_MSI is not set
302# CONFIG_PCCARD is not set 324# CONFIG_PCCARD is not set
303 325
@@ -308,29 +330,30 @@ CONFIG_BINFMT_ELF_FDPIC=y
308CONFIG_BINFMT_FLAT=y 330CONFIG_BINFMT_FLAT=y
309CONFIG_BINFMT_ZFLAT=y 331CONFIG_BINFMT_ZFLAT=y
310# CONFIG_BINFMT_SHARED_FLAT is not set 332# CONFIG_BINFMT_SHARED_FLAT is not set
333# CONFIG_HAVE_AOUT is not set
311# CONFIG_BINFMT_MISC is not set 334# CONFIG_BINFMT_MISC is not set
312 335
313# 336#
314# Power management options 337# Power management options
315# 338#
316CONFIG_PM=y 339CONFIG_PM=y
317# CONFIG_PM_LEGACY is not set
318# CONFIG_PM_DEBUG is not set 340# CONFIG_PM_DEBUG is not set
319CONFIG_PM_SLEEP=y 341CONFIG_PM_SLEEP=y
320CONFIG_SUSPEND_UP_POSSIBLE=y
321CONFIG_SUSPEND=y 342CONFIG_SUSPEND=y
343CONFIG_SUSPEND_FREEZER=y
344CONFIG_ARCH_SUSPEND_POSSIBLE=y
322CONFIG_PM_BFIN_SLEEP_DEEPER=y 345CONFIG_PM_BFIN_SLEEP_DEEPER=y
323# CONFIG_PM_BFIN_SLEEP is not set 346# CONFIG_PM_BFIN_SLEEP is not set
324# CONFIG_PM_WAKEUP_BY_GPIO is not set 347# CONFIG_PM_WAKEUP_BY_GPIO is not set
325 348
326# 349#
327# CPU Frequency scaling 350# Possible Suspend Mem / Hibernate Wake-Up Sources
328# 351#
329# CONFIG_CPU_FREQ is not set
330 352
331# 353#
332# Networking 354# CPU Frequency scaling
333# 355#
356# CONFIG_CPU_FREQ is not set
334CONFIG_NET=y 357CONFIG_NET=y
335 358
336# 359#
@@ -343,6 +366,7 @@ CONFIG_XFRM=y
343# CONFIG_XFRM_USER is not set 366# CONFIG_XFRM_USER is not set
344# CONFIG_XFRM_SUB_POLICY is not set 367# CONFIG_XFRM_SUB_POLICY is not set
345# CONFIG_XFRM_MIGRATE is not set 368# CONFIG_XFRM_MIGRATE is not set
369# CONFIG_XFRM_STATISTICS is not set
346# CONFIG_NET_KEY is not set 370# CONFIG_NET_KEY is not set
347CONFIG_INET=y 371CONFIG_INET=y
348# CONFIG_IP_MULTICAST is not set 372# CONFIG_IP_MULTICAST is not set
@@ -372,8 +396,6 @@ CONFIG_TCP_CONG_CUBIC=y
372CONFIG_DEFAULT_TCP_CONG="cubic" 396CONFIG_DEFAULT_TCP_CONG="cubic"
373# CONFIG_TCP_MD5SIG is not set 397# CONFIG_TCP_MD5SIG is not set
374# CONFIG_IPV6 is not set 398# CONFIG_IPV6 is not set
375# CONFIG_INET6_XFRM_TUNNEL is not set
376# CONFIG_INET6_TUNNEL is not set
377# CONFIG_NETLABEL is not set 399# CONFIG_NETLABEL is not set
378# CONFIG_NETWORK_SECMARK is not set 400# CONFIG_NETWORK_SECMARK is not set
379# CONFIG_NETFILTER is not set 401# CONFIG_NETFILTER is not set
@@ -382,6 +404,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
382# CONFIG_TIPC is not set 404# CONFIG_TIPC is not set
383# CONFIG_ATM is not set 405# CONFIG_ATM is not set
384# CONFIG_BRIDGE is not set 406# CONFIG_BRIDGE is not set
407# CONFIG_NET_DSA is not set
385# CONFIG_VLAN_8021Q is not set 408# CONFIG_VLAN_8021Q is not set
386# CONFIG_DECNET is not set 409# CONFIG_DECNET is not set
387# CONFIG_LLC2 is not set 410# CONFIG_LLC2 is not set
@@ -398,6 +421,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
398# 421#
399# CONFIG_NET_PKTGEN is not set 422# CONFIG_NET_PKTGEN is not set
400# CONFIG_HAMRADIO is not set 423# CONFIG_HAMRADIO is not set
424# CONFIG_CAN is not set
401CONFIG_IRDA=m 425CONFIG_IRDA=m
402 426
403# 427#
@@ -432,24 +456,14 @@ CONFIG_SIR_BFIN_DMA=y
432# CONFIG_DONGLE is not set 456# CONFIG_DONGLE is not set
433 457
434# 458#
435# Old SIR device drivers
436#
437# CONFIG_IRPORT_SIR is not set
438
439#
440# Old Serial dongle support
441#
442
443#
444# FIR device drivers 459# FIR device drivers
445# 460#
446# CONFIG_BT is not set 461# CONFIG_BT is not set
447# CONFIG_AF_RXRPC is not set 462# CONFIG_AF_RXRPC is not set
448 463# CONFIG_PHONET is not set
449# 464CONFIG_WIRELESS=y
450# Wireless
451#
452# CONFIG_CFG80211 is not set 465# CONFIG_CFG80211 is not set
466CONFIG_WIRELESS_OLD_REGULATORY=y
453# CONFIG_WIRELESS_EXT is not set 467# CONFIG_WIRELESS_EXT is not set
454# CONFIG_MAC80211 is not set 468# CONFIG_MAC80211 is not set
455# CONFIG_IEEE80211 is not set 469# CONFIG_IEEE80211 is not set
@@ -467,6 +481,8 @@ CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
467CONFIG_STANDALONE=y 481CONFIG_STANDALONE=y
468CONFIG_PREVENT_FIRMWARE_BUILD=y 482CONFIG_PREVENT_FIRMWARE_BUILD=y
469# CONFIG_FW_LOADER is not set 483# CONFIG_FW_LOADER is not set
484# CONFIG_DEBUG_DRIVER is not set
485# CONFIG_DEBUG_DEVRES is not set
470# CONFIG_SYS_HYPERVISOR is not set 486# CONFIG_SYS_HYPERVISOR is not set
471# CONFIG_CONNECTOR is not set 487# CONFIG_CONNECTOR is not set
472CONFIG_MTD=y 488CONFIG_MTD=y
@@ -475,6 +491,7 @@ CONFIG_MTD=y
475CONFIG_MTD_PARTITIONS=y 491CONFIG_MTD_PARTITIONS=y
476# CONFIG_MTD_REDBOOT_PARTS is not set 492# CONFIG_MTD_REDBOOT_PARTS is not set
477CONFIG_MTD_CMDLINE_PARTS=y 493CONFIG_MTD_CMDLINE_PARTS=y
494# CONFIG_MTD_AR7_PARTS is not set
478 495
479# 496#
480# User Modules And Translation Layers 497# User Modules And Translation Layers
@@ -520,6 +537,7 @@ CONFIG_MTD_ROM=m
520CONFIG_MTD_COMPLEX_MAPPINGS=y 537CONFIG_MTD_COMPLEX_MAPPINGS=y
521# CONFIG_MTD_PHYSMAP is not set 538# CONFIG_MTD_PHYSMAP is not set
522CONFIG_MTD_BFIN_ASYNC=m 539CONFIG_MTD_BFIN_ASYNC=m
540# CONFIG_MTD_GPIO_ADDR is not set
523# CONFIG_MTD_UCLINUX is not set 541# CONFIG_MTD_UCLINUX is not set
524# CONFIG_MTD_PLATRAM is not set 542# CONFIG_MTD_PLATRAM is not set
525 543
@@ -554,11 +572,14 @@ CONFIG_BLK_DEV=y
554CONFIG_BLK_DEV_RAM=y 572CONFIG_BLK_DEV_RAM=y
555CONFIG_BLK_DEV_RAM_COUNT=16 573CONFIG_BLK_DEV_RAM_COUNT=16
556CONFIG_BLK_DEV_RAM_SIZE=4096 574CONFIG_BLK_DEV_RAM_SIZE=4096
557CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024 575# CONFIG_BLK_DEV_XIP is not set
558# CONFIG_CDROM_PKTCDVD is not set 576# CONFIG_CDROM_PKTCDVD is not set
559# CONFIG_ATA_OVER_ETH is not set 577# CONFIG_ATA_OVER_ETH is not set
578# CONFIG_BLK_DEV_HD is not set
560CONFIG_MISC_DEVICES=y 579CONFIG_MISC_DEVICES=y
561# CONFIG_EEPROM_93CX6 is not set 580# CONFIG_EEPROM_93CX6 is not set
581# CONFIG_ENCLOSURE_SERVICES is not set
582CONFIG_HAVE_IDE=y
562# CONFIG_IDE is not set 583# CONFIG_IDE is not set
563 584
564# 585#
@@ -571,7 +592,6 @@ CONFIG_MISC_DEVICES=y
571# CONFIG_ATA is not set 592# CONFIG_ATA is not set
572# CONFIG_MD is not set 593# CONFIG_MD is not set
573CONFIG_NETDEVICES=y 594CONFIG_NETDEVICES=y
574# CONFIG_NETDEVICES_MULTIQUEUE is not set
575# CONFIG_DUMMY is not set 595# CONFIG_DUMMY is not set
576# CONFIG_BONDING is not set 596# CONFIG_BONDING is not set
577# CONFIG_MACVLAN is not set 597# CONFIG_MACVLAN is not set
@@ -584,11 +604,14 @@ CONFIG_MII=y
584CONFIG_SMC91X=y 604CONFIG_SMC91X=y
585# CONFIG_SMSC911X is not set 605# CONFIG_SMSC911X is not set
586# CONFIG_DM9000 is not set 606# CONFIG_DM9000 is not set
607# CONFIG_ENC28J60 is not set
587# CONFIG_IBM_NEW_EMAC_ZMII is not set 608# CONFIG_IBM_NEW_EMAC_ZMII is not set
588# CONFIG_IBM_NEW_EMAC_RGMII is not set 609# CONFIG_IBM_NEW_EMAC_RGMII is not set
589# CONFIG_IBM_NEW_EMAC_TAH is not set 610# CONFIG_IBM_NEW_EMAC_TAH is not set
590# CONFIG_IBM_NEW_EMAC_EMAC4 is not set 611# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
591# CONFIG_B44 is not set 612# CONFIG_IBM_NEW_EMAC_NO_FLOW_CTRL is not set
613# CONFIG_IBM_NEW_EMAC_MAL_CLR_ICINTSTAT is not set
614# CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set
592CONFIG_NETDEV_1000=y 615CONFIG_NETDEV_1000=y
593# CONFIG_AX88180 is not set 616# CONFIG_AX88180 is not set
594CONFIG_NETDEV_10000=y 617CONFIG_NETDEV_10000=y
@@ -598,10 +621,10 @@ CONFIG_NETDEV_10000=y
598# 621#
599# CONFIG_WLAN_PRE80211 is not set 622# CONFIG_WLAN_PRE80211 is not set
600# CONFIG_WLAN_80211 is not set 623# CONFIG_WLAN_80211 is not set
624# CONFIG_IWLWIFI_LEDS is not set
601# CONFIG_WAN is not set 625# CONFIG_WAN is not set
602# CONFIG_PPP is not set 626# CONFIG_PPP is not set
603# CONFIG_SLIP is not set 627# CONFIG_SLIP is not set
604# CONFIG_SHAPER is not set
605# CONFIG_NETCONSOLE is not set 628# CONFIG_NETCONSOLE is not set
606# CONFIG_NETPOLL is not set 629# CONFIG_NETPOLL is not set
607# CONFIG_NET_POLL_CONTROLLER is not set 630# CONFIG_NET_POLL_CONTROLLER is not set
@@ -633,7 +656,7 @@ CONFIG_INPUT_EVDEV=m
633# CONFIG_INPUT_TOUCHSCREEN is not set 656# CONFIG_INPUT_TOUCHSCREEN is not set
634CONFIG_INPUT_MISC=y 657CONFIG_INPUT_MISC=y
635# CONFIG_INPUT_UINPUT is not set 658# CONFIG_INPUT_UINPUT is not set
636CONFIG_TWI_KEYPAD=m 659CONFIG_CONFIG_INPUT_PCF8574=m
637 660
638# 661#
639# Hardware I/O ports 662# Hardware I/O ports
@@ -652,8 +675,11 @@ CONFIG_TWI_KEYPAD=m
652CONFIG_BFIN_SPORT=y 675CONFIG_BFIN_SPORT=y
653# CONFIG_BFIN_TIMER_LATENCY is not set 676# CONFIG_BFIN_TIMER_LATENCY is not set
654CONFIG_TWI_LCD=m 677CONFIG_TWI_LCD=m
678CONFIG_BFIN_DMA_INTERFACE=m
655CONFIG_SIMPLE_GPIO=m 679CONFIG_SIMPLE_GPIO=m
656# CONFIG_VT is not set 680# CONFIG_VT is not set
681# CONFIG_DEVKMEM is not set
682# CONFIG_BFIN_JTAG_COMM is not set
657# CONFIG_SERIAL_NONSTANDARD is not set 683# CONFIG_SERIAL_NONSTANDARD is not set
658 684
659# 685#
@@ -682,41 +708,46 @@ CONFIG_UNIX98_PTYS=y
682# CONFIG_CAN4LINUX is not set 708# CONFIG_CAN4LINUX is not set
683# CONFIG_IPMI_HANDLER is not set 709# CONFIG_IPMI_HANDLER is not set
684# CONFIG_HW_RANDOM is not set 710# CONFIG_HW_RANDOM is not set
685# CONFIG_GEN_RTC is not set
686# CONFIG_R3964 is not set 711# CONFIG_R3964 is not set
687# CONFIG_RAW_DRIVER is not set 712# CONFIG_RAW_DRIVER is not set
688# CONFIG_TCG_TPM is not set 713# CONFIG_TCG_TPM is not set
689CONFIG_I2C=m 714CONFIG_I2C=m
690CONFIG_I2C_BOARDINFO=y 715CONFIG_I2C_BOARDINFO=y
691CONFIG_I2C_CHARDEV=m 716CONFIG_I2C_CHARDEV=m
717CONFIG_I2C_HELPER_AUTO=y
692 718
693# 719#
694# I2C Algorithms 720# I2C Hardware Bus support
695# 721#
696CONFIG_I2C_ALGOBIT=m
697# CONFIG_I2C_ALGOPCF is not set
698# CONFIG_I2C_ALGOPCA is not set
699 722
700# 723#
701# I2C Hardware Bus support 724# I2C system bus drivers (mostly embedded / system-on-chip)
702# 725#
703# CONFIG_I2C_GPIO is not set 726# CONFIG_I2C_GPIO is not set
704# CONFIG_I2C_OCORES is not set 727# CONFIG_I2C_OCORES is not set
705# CONFIG_I2C_PARPORT_LIGHT is not set
706# CONFIG_I2C_SIMTEC is not set 728# CONFIG_I2C_SIMTEC is not set
729
730#
731# External I2C/SMBus adapter drivers
732#
733# CONFIG_I2C_PARPORT_LIGHT is not set
707# CONFIG_I2C_TAOS_EVM is not set 734# CONFIG_I2C_TAOS_EVM is not set
735
736#
737# Other I2C/SMBus bus drivers
738#
739# CONFIG_I2C_PCA_PLATFORM is not set
708# CONFIG_I2C_STUB is not set 740# CONFIG_I2C_STUB is not set
709 741
710# 742#
711# Miscellaneous I2C Chip support 743# Miscellaneous I2C Chip support
712# 744#
713# CONFIG_SENSORS_DS1337 is not set
714# CONFIG_SENSORS_DS1374 is not set
715# CONFIG_DS1682 is not set 745# CONFIG_DS1682 is not set
746# CONFIG_AT24 is not set
716# CONFIG_SENSORS_AD5252 is not set 747# CONFIG_SENSORS_AD5252 is not set
717# CONFIG_SENSORS_EEPROM is not set 748# CONFIG_SENSORS_EEPROM is not set
718# CONFIG_SENSORS_PCF8574 is not set 749# CONFIG_SENSORS_PCF8574 is not set
719# CONFIG_SENSORS_PCF8575 is not set 750# CONFIG_PCF8575 is not set
720# CONFIG_SENSORS_PCA9539 is not set 751# CONFIG_SENSORS_PCA9539 is not set
721# CONFIG_SENSORS_PCF8591 is not set 752# CONFIG_SENSORS_PCF8591 is not set
722# CONFIG_SENSORS_MAX6875 is not set 753# CONFIG_SENSORS_MAX6875 is not set
@@ -725,17 +756,15 @@ CONFIG_I2C_ALGOBIT=m
725# CONFIG_I2C_DEBUG_ALGO is not set 756# CONFIG_I2C_DEBUG_ALGO is not set
726# CONFIG_I2C_DEBUG_BUS is not set 757# CONFIG_I2C_DEBUG_BUS is not set
727# CONFIG_I2C_DEBUG_CHIP is not set 758# CONFIG_I2C_DEBUG_CHIP is not set
728
729#
730# SPI support
731#
732CONFIG_SPI=y 759CONFIG_SPI=y
760# CONFIG_SPI_DEBUG is not set
733CONFIG_SPI_MASTER=y 761CONFIG_SPI_MASTER=y
734 762
735# 763#
736# SPI Master Controller Drivers 764# SPI Master Controller Drivers
737# 765#
738CONFIG_SPI_BFIN=y 766CONFIG_SPI_BFIN=y
767# CONFIG_SPI_BFIN_LOCK is not set
739# CONFIG_SPI_BITBANG is not set 768# CONFIG_SPI_BITBANG is not set
740 769
741# 770#
@@ -744,11 +773,15 @@ CONFIG_SPI_BFIN=y
744# CONFIG_SPI_AT25 is not set 773# CONFIG_SPI_AT25 is not set
745# CONFIG_SPI_SPIDEV is not set 774# CONFIG_SPI_SPIDEV is not set
746# CONFIG_SPI_TLE62X0 is not set 775# CONFIG_SPI_TLE62X0 is not set
776CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y
777# CONFIG_GPIOLIB is not set
747# CONFIG_W1 is not set 778# CONFIG_W1 is not set
748# CONFIG_POWER_SUPPLY is not set 779# CONFIG_POWER_SUPPLY is not set
749CONFIG_HWMON=y 780CONFIG_HWMON=y
750# CONFIG_HWMON_VID is not set 781# CONFIG_HWMON_VID is not set
782# CONFIG_SENSORS_AD7414 is not set
751# CONFIG_SENSORS_AD7418 is not set 783# CONFIG_SENSORS_AD7418 is not set
784# CONFIG_SENSORS_ADCXX is not set
752# CONFIG_SENSORS_ADM1021 is not set 785# CONFIG_SENSORS_ADM1021 is not set
753# CONFIG_SENSORS_ADM1025 is not set 786# CONFIG_SENSORS_ADM1025 is not set
754# CONFIG_SENSORS_ADM1026 is not set 787# CONFIG_SENSORS_ADM1026 is not set
@@ -756,6 +789,7 @@ CONFIG_HWMON=y
756# CONFIG_SENSORS_ADM1031 is not set 789# CONFIG_SENSORS_ADM1031 is not set
757# CONFIG_SENSORS_ADM9240 is not set 790# CONFIG_SENSORS_ADM9240 is not set
758# CONFIG_SENSORS_ADT7470 is not set 791# CONFIG_SENSORS_ADT7470 is not set
792# CONFIG_SENSORS_ADT7473 is not set
759# CONFIG_SENSORS_ATXP1 is not set 793# CONFIG_SENSORS_ATXP1 is not set
760# CONFIG_SENSORS_DS1621 is not set 794# CONFIG_SENSORS_DS1621 is not set
761# CONFIG_SENSORS_F71805F is not set 795# CONFIG_SENSORS_F71805F is not set
@@ -776,6 +810,7 @@ CONFIG_HWMON=y
776# CONFIG_SENSORS_LM90 is not set 810# CONFIG_SENSORS_LM90 is not set
777# CONFIG_SENSORS_LM92 is not set 811# CONFIG_SENSORS_LM92 is not set
778# CONFIG_SENSORS_LM93 is not set 812# CONFIG_SENSORS_LM93 is not set
813# CONFIG_SENSORS_MAX1111 is not set
779# CONFIG_SENSORS_MAX1619 is not set 814# CONFIG_SENSORS_MAX1619 is not set
780# CONFIG_SENSORS_MAX6650 is not set 815# CONFIG_SENSORS_MAX6650 is not set
781# CONFIG_SENSORS_PC87360 is not set 816# CONFIG_SENSORS_PC87360 is not set
@@ -784,6 +819,7 @@ CONFIG_HWMON=y
784# CONFIG_SENSORS_SMSC47M1 is not set 819# CONFIG_SENSORS_SMSC47M1 is not set
785# CONFIG_SENSORS_SMSC47M192 is not set 820# CONFIG_SENSORS_SMSC47M192 is not set
786# CONFIG_SENSORS_SMSC47B397 is not set 821# CONFIG_SENSORS_SMSC47B397 is not set
822# CONFIG_SENSORS_ADS7828 is not set
787# CONFIG_SENSORS_THMC50 is not set 823# CONFIG_SENSORS_THMC50 is not set
788# CONFIG_SENSORS_VT1211 is not set 824# CONFIG_SENSORS_VT1211 is not set
789# CONFIG_SENSORS_W83781D is not set 825# CONFIG_SENSORS_W83781D is not set
@@ -791,9 +827,12 @@ CONFIG_HWMON=y
791# CONFIG_SENSORS_W83792D is not set 827# CONFIG_SENSORS_W83792D is not set
792# CONFIG_SENSORS_W83793 is not set 828# CONFIG_SENSORS_W83793 is not set
793# CONFIG_SENSORS_W83L785TS is not set 829# CONFIG_SENSORS_W83L785TS is not set
830# CONFIG_SENSORS_W83L786NG is not set
794# CONFIG_SENSORS_W83627HF is not set 831# CONFIG_SENSORS_W83627HF is not set
795# CONFIG_SENSORS_W83627EHF is not set 832# CONFIG_SENSORS_W83627EHF is not set
796# CONFIG_HWMON_DEBUG_CHIP is not set 833# CONFIG_HWMON_DEBUG_CHIP is not set
834# CONFIG_THERMAL is not set
835# CONFIG_THERMAL_HWMON is not set
797CONFIG_WATCHDOG=y 836CONFIG_WATCHDOG=y
798# CONFIG_WATCHDOG_NOWAYOUT is not set 837# CONFIG_WATCHDOG_NOWAYOUT is not set
799 838
@@ -804,21 +843,29 @@ CONFIG_WATCHDOG=y
804CONFIG_BFIN_WDT=y 843CONFIG_BFIN_WDT=y
805 844
806# 845#
807# Sonics Silicon Backplane
808#
809CONFIG_SSB_POSSIBLE=y
810# CONFIG_SSB is not set
811
812#
813# Multifunction device drivers 846# Multifunction device drivers
814# 847#
848# CONFIG_MFD_CORE is not set
815# CONFIG_MFD_SM501 is not set 849# CONFIG_MFD_SM501 is not set
850# CONFIG_HTC_PASIC3 is not set
851# CONFIG_MFD_TMIO is not set
852# CONFIG_MFD_WM8400 is not set
853# CONFIG_MFD_WM8350_I2C is not set
816 854
817# 855#
818# Multimedia devices 856# Multimedia devices
819# 857#
858
859#
860# Multimedia core support
861#
820# CONFIG_VIDEO_DEV is not set 862# CONFIG_VIDEO_DEV is not set
821# CONFIG_DVB_CORE is not set 863# CONFIG_DVB_CORE is not set
864# CONFIG_VIDEO_MEDIA is not set
865
866#
867# Multimedia drivers
868#
822# CONFIG_DAB is not set 869# CONFIG_DAB is not set
823 870
824# 871#
@@ -829,6 +876,7 @@ CONFIG_SSB_POSSIBLE=y
829CONFIG_FB=m 876CONFIG_FB=m
830CONFIG_FIRMWARE_EDID=y 877CONFIG_FIRMWARE_EDID=y
831# CONFIG_FB_DDC is not set 878# CONFIG_FB_DDC is not set
879# CONFIG_FB_BOOT_VESA_SUPPORT is not set
832CONFIG_FB_CFB_FILLRECT=m 880CONFIG_FB_CFB_FILLRECT=m
833CONFIG_FB_CFB_COPYAREA=m 881CONFIG_FB_CFB_COPYAREA=m
834CONFIG_FB_CFB_IMAGEBLIT=m 882CONFIG_FB_CFB_IMAGEBLIT=m
@@ -836,8 +884,8 @@ CONFIG_FB_CFB_IMAGEBLIT=m
836# CONFIG_FB_SYS_FILLRECT is not set 884# CONFIG_FB_SYS_FILLRECT is not set
837# CONFIG_FB_SYS_COPYAREA is not set 885# CONFIG_FB_SYS_COPYAREA is not set
838# CONFIG_FB_SYS_IMAGEBLIT is not set 886# CONFIG_FB_SYS_IMAGEBLIT is not set
887# CONFIG_FB_FOREIGN_ENDIAN is not set
839# CONFIG_FB_SYS_FOPS is not set 888# CONFIG_FB_SYS_FOPS is not set
840CONFIG_FB_DEFERRED_IO=y
841# CONFIG_FB_SVGALIB is not set 889# CONFIG_FB_SVGALIB is not set
842# CONFIG_FB_MACMODES is not set 890# CONFIG_FB_MACMODES is not set
843# CONFIG_FB_BACKLIGHT is not set 891# CONFIG_FB_BACKLIGHT is not set
@@ -848,6 +896,7 @@ CONFIG_FB_DEFERRED_IO=y
848# Frame buffer hardware drivers 896# Frame buffer hardware drivers
849# 897#
850# CONFIG_FB_BFIN_T350MCQB is not set 898# CONFIG_FB_BFIN_T350MCQB is not set
899# CONFIG_FB_BFIN_LQ035Q1 is not set
851CONFIG_FB_BFIN_7393=m 900CONFIG_FB_BFIN_7393=m
852CONFIG_NTSC=y 901CONFIG_NTSC=y
853# CONFIG_PAL is not set 902# CONFIG_PAL is not set
@@ -859,6 +908,7 @@ CONFIG_ADV7393_1XMEM=y
859# CONFIG_ADV7393_2XMEM is not set 908# CONFIG_ADV7393_2XMEM is not set
860# CONFIG_FB_S1D13XXX is not set 909# CONFIG_FB_S1D13XXX is not set
861# CONFIG_FB_VIRTUAL is not set 910# CONFIG_FB_VIRTUAL is not set
911# CONFIG_FB_METRONOME is not set
862# CONFIG_BACKLIGHT_LCD_SUPPORT is not set 912# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
863 913
864# 914#
@@ -866,15 +916,8 @@ CONFIG_ADV7393_1XMEM=y
866# 916#
867# CONFIG_DISPLAY_SUPPORT is not set 917# CONFIG_DISPLAY_SUPPORT is not set
868# CONFIG_LOGO is not set 918# CONFIG_LOGO is not set
869
870#
871# Sound
872#
873CONFIG_SOUND=m 919CONFIG_SOUND=m
874 920CONFIG_SOUND_OSS_CORE=y
875#
876# Advanced Linux Sound Architecture
877#
878CONFIG_SND=m 921CONFIG_SND=m
879CONFIG_SND_TIMER=m 922CONFIG_SND_TIMER=m
880CONFIG_SND_PCM=m 923CONFIG_SND_PCM=m
@@ -888,18 +931,12 @@ CONFIG_SND_SUPPORT_OLD_API=y
888CONFIG_SND_VERBOSE_PROCFS=y 931CONFIG_SND_VERBOSE_PROCFS=y
889# CONFIG_SND_VERBOSE_PRINTK is not set 932# CONFIG_SND_VERBOSE_PRINTK is not set
890# CONFIG_SND_DEBUG is not set 933# CONFIG_SND_DEBUG is not set
891 934CONFIG_SND_DRIVERS=y
892#
893# Generic devices
894#
895# CONFIG_SND_DUMMY is not set 935# CONFIG_SND_DUMMY is not set
896# CONFIG_SND_MTPAV is not set 936# CONFIG_SND_MTPAV is not set
897# CONFIG_SND_SERIAL_U16550 is not set 937# CONFIG_SND_SERIAL_U16550 is not set
898# CONFIG_SND_MPU401 is not set 938# CONFIG_SND_MPU401 is not set
899 939CONFIG_SND_SPI=y
900#
901# SPI devices
902#
903 940
904# 941#
905# ALSA Blackfin devices 942# ALSA Blackfin devices
@@ -911,46 +948,46 @@ CONFIG_SND_BLACKFIN_AD1836_MULSUB=y
911# CONFIG_SND_BLACKFIN_AD1836_5P1 is not set 948# CONFIG_SND_BLACKFIN_AD1836_5P1 is not set
912CONFIG_SND_BLACKFIN_SPORT=0 949CONFIG_SND_BLACKFIN_SPORT=0
913CONFIG_SND_BLACKFIN_SPI_PFBIT=4 950CONFIG_SND_BLACKFIN_SPI_PFBIT=4
914CONFIG_SND_BFIN_AD73311=m
915CONFIG_SND_BFIN_SPORT=0 951CONFIG_SND_BFIN_SPORT=0
916CONFIG_SND_BFIN_AD73311_SE=4
917CONFIG_SND_BFIN_AD73322=m 952CONFIG_SND_BFIN_AD73322=m
918CONFIG_SND_BFIN_AD73322_SPORT0_SE=10 953CONFIG_SND_BFIN_AD73322_SPORT0_SE=10
919CONFIG_SND_BFIN_AD73322_SPORT1_SE=14 954CONFIG_SND_BFIN_AD73322_SPORT1_SE=14
920CONFIG_SND_BFIN_AD73322_RESET=12 955CONFIG_SND_BFIN_AD73322_RESET=12
921
922#
923# System on Chip audio support
924#
925CONFIG_SND_SOC_AC97_BUS=y
926CONFIG_SND_SOC=m 956CONFIG_SND_SOC=m
927CONFIG_SND_BF5XX_SOC=m 957CONFIG_SND_SOC_AC97_BUS=y
928CONFIG_SND_MMAP_SUPPORT=y 958CONFIG_SND_BF5XX_I2S=m
929CONFIG_SND_BF5XX_SOC_AC97=m
930# CONFIG_SND_BF5XX_SOC_WM8750 is not set
931# CONFIG_SND_BF5XX_SOC_WM8731 is not set
932# CONFIG_SND_BF5XX_SOC_SSM2602 is not set 959# CONFIG_SND_BF5XX_SOC_SSM2602 is not set
933CONFIG_SND_BF5XX_SOC_BF5xx=m 960CONFIG_SND_BF5XX_SOC_AD73311=m
961CONFIG_SND_BFIN_AD73311_SE=4
962CONFIG_SND_BF5XX_AC97=m
963CONFIG_SND_BF5XX_MMAP_SUPPORT=y
964# CONFIG_SND_BF5XX_MULTICHAN_SUPPORT is not set
965CONFIG_SND_BF5XX_SOC_SPORT=m
966CONFIG_SND_BF5XX_SOC_I2S=m
967CONFIG_SND_BF5XX_SOC_AC97=m
968CONFIG_SND_BF5XX_SOC_AD1980=m
934CONFIG_SND_BF5XX_SPORT_NUM=0 969CONFIG_SND_BF5XX_SPORT_NUM=0
935# CONFIG_SND_BF5XX_HAVE_COLD_RESET is not set 970# CONFIG_SND_BF5XX_HAVE_COLD_RESET is not set
936 971# CONFIG_SND_SOC_ALL_CODECS is not set
937#
938# SoC Audio support for SuperH
939#
940CONFIG_SND_SOC_AD1980=m 972CONFIG_SND_SOC_AD1980=m
941 973CONFIG_SND_SOC_AD73311=m
942#
943# Open Sound System
944#
945# CONFIG_SOUND_PRIME is not set 974# CONFIG_SOUND_PRIME is not set
946CONFIG_AC97_BUS=m 975CONFIG_AC97_BUS=m
947CONFIG_HID_SUPPORT=y 976CONFIG_HID_SUPPORT=y
948CONFIG_HID=y 977CONFIG_HID=y
949# CONFIG_HID_DEBUG is not set 978# CONFIG_HID_DEBUG is not set
950# CONFIG_HIDRAW is not set 979# CONFIG_HIDRAW is not set
980# CONFIG_HID_PID is not set
981
982#
983# Special HID drivers
984#
985CONFIG_HID_COMPAT=y
951# CONFIG_USB_SUPPORT is not set 986# CONFIG_USB_SUPPORT is not set
952# CONFIG_MMC is not set 987# CONFIG_MMC is not set
988# CONFIG_MEMSTICK is not set
953# CONFIG_NEW_LEDS is not set 989# CONFIG_NEW_LEDS is not set
990# CONFIG_ACCESSIBILITY is not set
954CONFIG_RTC_LIB=y 991CONFIG_RTC_LIB=y
955CONFIG_RTC_CLASS=y 992CONFIG_RTC_CLASS=y
956CONFIG_RTC_HCTOSYS=y 993CONFIG_RTC_HCTOSYS=y
@@ -979,51 +1016,57 @@ CONFIG_RTC_INTF_DEV=y
979# CONFIG_RTC_DRV_PCF8563 is not set 1016# CONFIG_RTC_DRV_PCF8563 is not set
980# CONFIG_RTC_DRV_PCF8583 is not set 1017# CONFIG_RTC_DRV_PCF8583 is not set
981# CONFIG_RTC_DRV_M41T80 is not set 1018# CONFIG_RTC_DRV_M41T80 is not set
1019# CONFIG_RTC_DRV_S35390A is not set
1020# CONFIG_RTC_DRV_FM3130 is not set
982 1021
983# 1022#
984# SPI RTC drivers 1023# SPI RTC drivers
985# 1024#
986# CONFIG_RTC_DRV_RS5C348 is not set 1025# CONFIG_RTC_DRV_M41T94 is not set
1026# CONFIG_RTC_DRV_DS1305 is not set
987# CONFIG_RTC_DRV_MAX6902 is not set 1027# CONFIG_RTC_DRV_MAX6902 is not set
1028# CONFIG_RTC_DRV_R9701 is not set
1029# CONFIG_RTC_DRV_RS5C348 is not set
1030# CONFIG_RTC_DRV_DS3234 is not set
988 1031
989# 1032#
990# Platform RTC drivers 1033# Platform RTC drivers
991# 1034#
1035# CONFIG_RTC_DRV_DS1286 is not set
1036# CONFIG_RTC_DRV_DS1511 is not set
992# CONFIG_RTC_DRV_DS1553 is not set 1037# CONFIG_RTC_DRV_DS1553 is not set
993# CONFIG_RTC_DRV_STK17TA8 is not set
994# CONFIG_RTC_DRV_DS1742 is not set 1038# CONFIG_RTC_DRV_DS1742 is not set
1039# CONFIG_RTC_DRV_STK17TA8 is not set
995# CONFIG_RTC_DRV_M48T86 is not set 1040# CONFIG_RTC_DRV_M48T86 is not set
1041# CONFIG_RTC_DRV_M48T35 is not set
996# CONFIG_RTC_DRV_M48T59 is not set 1042# CONFIG_RTC_DRV_M48T59 is not set
1043# CONFIG_RTC_DRV_BQ4802 is not set
997# CONFIG_RTC_DRV_V3020 is not set 1044# CONFIG_RTC_DRV_V3020 is not set
998 1045
999# 1046#
1000# on-CPU RTC drivers 1047# on-CPU RTC drivers
1001# 1048#
1002CONFIG_RTC_DRV_BFIN=y 1049CONFIG_RTC_DRV_BFIN=y
1003 1050# CONFIG_DMADEVICES is not set
1004#
1005# Userspace I/O
1006#
1007# CONFIG_UIO is not set 1051# CONFIG_UIO is not set
1052# CONFIG_STAGING is not set
1008 1053
1009# 1054#
1010# File systems 1055# File systems
1011# 1056#
1012# CONFIG_EXT2_FS is not set 1057# CONFIG_EXT2_FS is not set
1013# CONFIG_EXT3_FS is not set 1058# CONFIG_EXT3_FS is not set
1014# CONFIG_EXT4DEV_FS is not set 1059# CONFIG_EXT4_FS is not set
1015# CONFIG_REISERFS_FS is not set 1060# CONFIG_REISERFS_FS is not set
1016# CONFIG_JFS_FS is not set 1061# CONFIG_JFS_FS is not set
1017# CONFIG_FS_POSIX_ACL is not set 1062# CONFIG_FS_POSIX_ACL is not set
1063CONFIG_FILE_LOCKING=y
1018# CONFIG_XFS_FS is not set 1064# CONFIG_XFS_FS is not set
1019# CONFIG_GFS2_FS is not set
1020# CONFIG_OCFS2_FS is not set 1065# CONFIG_OCFS2_FS is not set
1021# CONFIG_MINIX_FS is not set 1066# CONFIG_DNOTIFY is not set
1022# CONFIG_ROMFS_FS is not set
1023CONFIG_INOTIFY=y 1067CONFIG_INOTIFY=y
1024CONFIG_INOTIFY_USER=y 1068CONFIG_INOTIFY_USER=y
1025# CONFIG_QUOTA is not set 1069# CONFIG_QUOTA is not set
1026# CONFIG_DNOTIFY is not set
1027# CONFIG_AUTOFS_FS is not set 1070# CONFIG_AUTOFS_FS is not set
1028# CONFIG_AUTOFS4_FS is not set 1071# CONFIG_AUTOFS4_FS is not set
1029# CONFIG_FUSE_FS is not set 1072# CONFIG_FUSE_FS is not set
@@ -1063,11 +1106,11 @@ CONFIG_SYSFS=y
1063# CONFIG_EFS_FS is not set 1106# CONFIG_EFS_FS is not set
1064CONFIG_YAFFS_FS=m 1107CONFIG_YAFFS_FS=m
1065CONFIG_YAFFS_YAFFS1=y 1108CONFIG_YAFFS_YAFFS1=y
1109# CONFIG_YAFFS_9BYTE_TAGS is not set
1066# CONFIG_YAFFS_DOES_ECC is not set 1110# CONFIG_YAFFS_DOES_ECC is not set
1067CONFIG_YAFFS_YAFFS2=y 1111CONFIG_YAFFS_YAFFS2=y
1068CONFIG_YAFFS_AUTO_YAFFS2=y 1112CONFIG_YAFFS_AUTO_YAFFS2=y
1069# CONFIG_YAFFS_DISABLE_LAZY_LOAD is not set 1113# CONFIG_YAFFS_DISABLE_LAZY_LOAD is not set
1070CONFIG_YAFFS_CHECKPOINT_RESERVED_BLOCKS=10
1071# CONFIG_YAFFS_DISABLE_WIDE_TNODES is not set 1114# CONFIG_YAFFS_DISABLE_WIDE_TNODES is not set
1072# CONFIG_YAFFS_ALWAYS_CHECK_CHUNK_ERASED is not set 1115# CONFIG_YAFFS_ALWAYS_CHECK_CHUNK_ERASED is not set
1073CONFIG_YAFFS_SHORT_NAMES_IN_RAM=y 1116CONFIG_YAFFS_SHORT_NAMES_IN_RAM=y
@@ -1084,8 +1127,11 @@ CONFIG_JFFS2_RTIME=y
1084# CONFIG_JFFS2_RUBIN is not set 1127# CONFIG_JFFS2_RUBIN is not set
1085# CONFIG_CRAMFS is not set 1128# CONFIG_CRAMFS is not set
1086# CONFIG_VXFS_FS is not set 1129# CONFIG_VXFS_FS is not set
1130# CONFIG_MINIX_FS is not set
1131# CONFIG_OMFS_FS is not set
1087# CONFIG_HPFS_FS is not set 1132# CONFIG_HPFS_FS is not set
1088# CONFIG_QNX4FS_FS is not set 1133# CONFIG_QNX4FS_FS is not set
1134# CONFIG_ROMFS_FS is not set
1089# CONFIG_SYSV_FS is not set 1135# CONFIG_SYSV_FS is not set
1090# CONFIG_UFS_FS is not set 1136# CONFIG_UFS_FS is not set
1091CONFIG_NETWORK_FILESYSTEMS=y 1137CONFIG_NETWORK_FILESYSTEMS=y
@@ -1093,13 +1139,12 @@ CONFIG_NFS_FS=m
1093CONFIG_NFS_V3=y 1139CONFIG_NFS_V3=y
1094# CONFIG_NFS_V3_ACL is not set 1140# CONFIG_NFS_V3_ACL is not set
1095# CONFIG_NFS_V4 is not set 1141# CONFIG_NFS_V4 is not set
1096# CONFIG_NFS_DIRECTIO is not set
1097# CONFIG_NFSD is not set 1142# CONFIG_NFSD is not set
1098CONFIG_LOCKD=m 1143CONFIG_LOCKD=m
1099CONFIG_LOCKD_V4=y 1144CONFIG_LOCKD_V4=y
1100CONFIG_NFS_COMMON=y 1145CONFIG_NFS_COMMON=y
1101CONFIG_SUNRPC=m 1146CONFIG_SUNRPC=m
1102# CONFIG_SUNRPC_BIND34 is not set 1147# CONFIG_SUNRPC_REGISTER_V4 is not set
1103# CONFIG_RPCSEC_GSS_KRB5 is not set 1148# CONFIG_RPCSEC_GSS_KRB5 is not set
1104# CONFIG_RPCSEC_GSS_SPKM3 is not set 1149# CONFIG_RPCSEC_GSS_SPKM3 is not set
1105CONFIG_SMB_FS=m 1150CONFIG_SMB_FS=m
@@ -1155,9 +1200,6 @@ CONFIG_NLS_DEFAULT="iso8859-1"
1155# CONFIG_NLS_KOI8_U is not set 1200# CONFIG_NLS_KOI8_U is not set
1156# CONFIG_NLS_UTF8 is not set 1201# CONFIG_NLS_UTF8 is not set
1157# CONFIG_DLM is not set 1202# CONFIG_DLM is not set
1158CONFIG_INSTRUMENTATION=y
1159# CONFIG_PROFILING is not set
1160# CONFIG_MARKERS is not set
1161 1203
1162# 1204#
1163# Kernel hacking 1205# Kernel hacking
@@ -1165,14 +1207,53 @@ CONFIG_INSTRUMENTATION=y
1165# CONFIG_PRINTK_TIME is not set 1207# CONFIG_PRINTK_TIME is not set
1166CONFIG_ENABLE_WARN_DEPRECATED=y 1208CONFIG_ENABLE_WARN_DEPRECATED=y
1167CONFIG_ENABLE_MUST_CHECK=y 1209CONFIG_ENABLE_MUST_CHECK=y
1210CONFIG_FRAME_WARN=1024
1168# CONFIG_MAGIC_SYSRQ is not set 1211# CONFIG_MAGIC_SYSRQ is not set
1169# CONFIG_UNUSED_SYMBOLS is not set 1212# CONFIG_UNUSED_SYMBOLS is not set
1170CONFIG_DEBUG_FS=y 1213CONFIG_DEBUG_FS=y
1171# CONFIG_HEADERS_CHECK is not set 1214# CONFIG_HEADERS_CHECK is not set
1172# CONFIG_DEBUG_KERNEL is not set 1215CONFIG_DEBUG_KERNEL=y
1216# CONFIG_DEBUG_SHIRQ is not set
1217CONFIG_DETECT_SOFTLOCKUP=y
1218# CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC is not set
1219CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE=0
1220CONFIG_SCHED_DEBUG=y
1221# CONFIG_SCHEDSTATS is not set
1222# CONFIG_TIMER_STATS is not set
1223# CONFIG_DEBUG_OBJECTS is not set
1224# CONFIG_DEBUG_SLAB is not set
1225# CONFIG_DEBUG_RT_MUTEXES is not set
1226# CONFIG_RT_MUTEX_TESTER is not set
1227# CONFIG_DEBUG_SPINLOCK is not set
1228# CONFIG_DEBUG_MUTEXES is not set
1229# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
1230# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
1231# CONFIG_DEBUG_KOBJECT is not set
1173# CONFIG_DEBUG_BUGVERBOSE is not set 1232# CONFIG_DEBUG_BUGVERBOSE is not set
1233CONFIG_DEBUG_INFO=y
1234# CONFIG_DEBUG_VM is not set
1235# CONFIG_DEBUG_WRITECOUNT is not set
1236# CONFIG_DEBUG_MEMORY_INIT is not set
1237# CONFIG_DEBUG_LIST is not set
1238# CONFIG_DEBUG_SG is not set
1239# CONFIG_FRAME_POINTER is not set
1240# CONFIG_BOOT_PRINTK_DELAY is not set
1241# CONFIG_RCU_TORTURE_TEST is not set
1242# CONFIG_RCU_CPU_STALL_DETECTOR is not set
1243# CONFIG_BACKTRACE_SELF_TEST is not set
1244# CONFIG_DEBUG_BLOCK_EXT_DEVT is not set
1245# CONFIG_FAULT_INJECTION is not set
1246# CONFIG_SYSCTL_SYSCALL_CHECK is not set
1247# CONFIG_DYNAMIC_PRINTK_DEBUG is not set
1174# CONFIG_SAMPLES is not set 1248# CONFIG_SAMPLES is not set
1249CONFIG_HAVE_ARCH_KGDB=y
1250# CONFIG_KGDB is not set
1251# CONFIG_DEBUG_STACKOVERFLOW is not set
1252# CONFIG_DEBUG_STACK_USAGE is not set
1253CONFIG_DEBUG_VERBOSE=y
1175CONFIG_DEBUG_MMRS=y 1254CONFIG_DEBUG_MMRS=y
1255# CONFIG_DEBUG_HWERR is not set
1256# CONFIG_DEBUG_DOUBLEFAULT is not set
1176CONFIG_DEBUG_HUNT_FOR_ZERO=y 1257CONFIG_DEBUG_HUNT_FOR_ZERO=y
1177CONFIG_DEBUG_BFIN_HWTRACE_ON=y 1258CONFIG_DEBUG_BFIN_HWTRACE_ON=y
1178CONFIG_DEBUG_BFIN_HWTRACE_COMPRESSION_OFF=y 1259CONFIG_DEBUG_BFIN_HWTRACE_COMPRESSION_OFF=y
@@ -1190,9 +1271,94 @@ CONFIG_ACCESS_CHECK=y
1190# 1271#
1191# CONFIG_KEYS is not set 1272# CONFIG_KEYS is not set
1192CONFIG_SECURITY=y 1273CONFIG_SECURITY=y
1274# CONFIG_SECURITYFS is not set
1193# CONFIG_SECURITY_NETWORK is not set 1275# CONFIG_SECURITY_NETWORK is not set
1194# CONFIG_SECURITY_CAPABILITIES is not set 1276# CONFIG_SECURITY_FILE_CAPABILITIES is not set
1195# CONFIG_CRYPTO is not set 1277CONFIG_SECURITY_DEFAULT_MMAP_MIN_ADDR=0
1278CONFIG_CRYPTO=y
1279
1280#
1281# Crypto core or helper
1282#
1283# CONFIG_CRYPTO_FIPS is not set
1284# CONFIG_CRYPTO_MANAGER is not set
1285# CONFIG_CRYPTO_GF128MUL is not set
1286# CONFIG_CRYPTO_NULL is not set
1287# CONFIG_CRYPTO_CRYPTD is not set
1288# CONFIG_CRYPTO_AUTHENC is not set
1289# CONFIG_CRYPTO_TEST is not set
1290
1291#
1292# Authenticated Encryption with Associated Data
1293#
1294# CONFIG_CRYPTO_CCM is not set
1295# CONFIG_CRYPTO_GCM is not set
1296# CONFIG_CRYPTO_SEQIV is not set
1297
1298#
1299# Block modes
1300#
1301# CONFIG_CRYPTO_CBC is not set
1302# CONFIG_CRYPTO_CTR is not set
1303# CONFIG_CRYPTO_CTS is not set
1304# CONFIG_CRYPTO_ECB is not set
1305# CONFIG_CRYPTO_LRW is not set
1306# CONFIG_CRYPTO_PCBC is not set
1307# CONFIG_CRYPTO_XTS is not set
1308
1309#
1310# Hash modes
1311#
1312# CONFIG_CRYPTO_HMAC is not set
1313# CONFIG_CRYPTO_XCBC is not set
1314
1315#
1316# Digest
1317#
1318# CONFIG_CRYPTO_CRC32C is not set
1319# CONFIG_CRYPTO_MD4 is not set
1320# CONFIG_CRYPTO_MD5 is not set
1321# CONFIG_CRYPTO_MICHAEL_MIC is not set
1322# CONFIG_CRYPTO_RMD128 is not set
1323# CONFIG_CRYPTO_RMD160 is not set
1324# CONFIG_CRYPTO_RMD256 is not set
1325# CONFIG_CRYPTO_RMD320 is not set
1326# CONFIG_CRYPTO_SHA1 is not set
1327# CONFIG_CRYPTO_SHA256 is not set
1328# CONFIG_CRYPTO_SHA512 is not set
1329# CONFIG_CRYPTO_TGR192 is not set
1330# CONFIG_CRYPTO_WP512 is not set
1331
1332#
1333# Ciphers
1334#
1335# CONFIG_CRYPTO_AES is not set
1336# CONFIG_CRYPTO_ANUBIS is not set
1337# CONFIG_CRYPTO_ARC4 is not set
1338# CONFIG_CRYPTO_BLOWFISH is not set
1339# CONFIG_CRYPTO_CAMELLIA is not set
1340# CONFIG_CRYPTO_CAST5 is not set
1341# CONFIG_CRYPTO_CAST6 is not set
1342# CONFIG_CRYPTO_DES is not set
1343# CONFIG_CRYPTO_FCRYPT is not set
1344# CONFIG_CRYPTO_KHAZAD is not set
1345# CONFIG_CRYPTO_SALSA20 is not set
1346# CONFIG_CRYPTO_SEED is not set
1347# CONFIG_CRYPTO_SERPENT is not set
1348# CONFIG_CRYPTO_TEA is not set
1349# CONFIG_CRYPTO_TWOFISH is not set
1350
1351#
1352# Compression
1353#
1354# CONFIG_CRYPTO_DEFLATE is not set
1355# CONFIG_CRYPTO_LZO is not set
1356
1357#
1358# Random Number Generation
1359#
1360# CONFIG_CRYPTO_ANSI_CPRNG is not set
1361CONFIG_CRYPTO_HW=y
1196 1362
1197# 1363#
1198# Library routines 1364# Library routines
@@ -1200,6 +1366,7 @@ CONFIG_SECURITY=y
1200CONFIG_BITREVERSE=y 1366CONFIG_BITREVERSE=y
1201CONFIG_CRC_CCITT=m 1367CONFIG_CRC_CCITT=m
1202# CONFIG_CRC16 is not set 1368# CONFIG_CRC16 is not set
1369# CONFIG_CRC_T10DIF is not set
1203# CONFIG_CRC_ITU_T is not set 1370# CONFIG_CRC_ITU_T is not set
1204CONFIG_CRC32=y 1371CONFIG_CRC32=y
1205# CONFIG_CRC7 is not set 1372# CONFIG_CRC7 is not set
diff --git a/arch/blackfin/configs/BF537-STAMP_defconfig b/arch/blackfin/configs/BF537-STAMP_defconfig
index 63a0f854745c..332142f7f9b4 100644
--- a/arch/blackfin/configs/BF537-STAMP_defconfig
+++ b/arch/blackfin/configs/BF537-STAMP_defconfig
@@ -1,6 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.24.7 3# Linux kernel version: 2.6.28-rc2
4# Tue Dec 30 17:24:37 2008
4# 5#
5# CONFIG_MMU is not set 6# CONFIG_MMU is not set
6# CONFIG_FPU is not set 7# CONFIG_FPU is not set
@@ -8,7 +9,6 @@ CONFIG_RWSEM_GENERIC_SPINLOCK=y
8# CONFIG_RWSEM_XCHGADD_ALGORITHM is not set 9# CONFIG_RWSEM_XCHGADD_ALGORITHM is not set
9CONFIG_BLACKFIN=y 10CONFIG_BLACKFIN=y
10CONFIG_ZONE_DMA=y 11CONFIG_ZONE_DMA=y
11CONFIG_SEMAPHORE_SLEEPERS=y
12CONFIG_GENERIC_FIND_NEXT_BIT=y 12CONFIG_GENERIC_FIND_NEXT_BIT=y
13CONFIG_GENERIC_HWEIGHT=y 13CONFIG_GENERIC_HWEIGHT=y
14CONFIG_GENERIC_HARDIRQS=y 14CONFIG_GENERIC_HARDIRQS=y
@@ -31,18 +31,16 @@ CONFIG_SYSVIPC_SYSCTL=y
31# CONFIG_POSIX_MQUEUE is not set 31# CONFIG_POSIX_MQUEUE is not set
32# CONFIG_BSD_PROCESS_ACCT is not set 32# CONFIG_BSD_PROCESS_ACCT is not set
33# CONFIG_TASKSTATS is not set 33# CONFIG_TASKSTATS is not set
34# CONFIG_USER_NS is not set
35# CONFIG_PID_NS is not set
36# CONFIG_AUDIT is not set 34# CONFIG_AUDIT is not set
37CONFIG_IKCONFIG=y 35CONFIG_IKCONFIG=y
38CONFIG_IKCONFIG_PROC=y 36CONFIG_IKCONFIG_PROC=y
39CONFIG_LOG_BUF_SHIFT=14 37CONFIG_LOG_BUF_SHIFT=14
40# CONFIG_CGROUPS is not set 38# CONFIG_CGROUPS is not set
41CONFIG_FAIR_GROUP_SCHED=y 39# CONFIG_GROUP_SCHED is not set
42CONFIG_FAIR_USER_SCHED=y 40# CONFIG_SYSFS_DEPRECATED is not set
43# CONFIG_FAIR_CGROUP_SCHED is not set 41# CONFIG_SYSFS_DEPRECATED_V2 is not set
44CONFIG_SYSFS_DEPRECATED=y
45# CONFIG_RELAY is not set 42# CONFIG_RELAY is not set
43# CONFIG_NAMESPACES is not set
46CONFIG_BLK_DEV_INITRD=y 44CONFIG_BLK_DEV_INITRD=y
47CONFIG_INITRAMFS_SOURCE="" 45CONFIG_INITRAMFS_SOURCE=""
48# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 46# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
@@ -51,26 +49,35 @@ CONFIG_EMBEDDED=y
51CONFIG_UID16=y 49CONFIG_UID16=y
52CONFIG_SYSCTL_SYSCALL=y 50CONFIG_SYSCTL_SYSCALL=y
53CONFIG_KALLSYMS=y 51CONFIG_KALLSYMS=y
52# CONFIG_KALLSYMS_ALL is not set
54# CONFIG_KALLSYMS_EXTRA_PASS is not set 53# CONFIG_KALLSYMS_EXTRA_PASS is not set
55CONFIG_HOTPLUG=y 54CONFIG_HOTPLUG=y
56CONFIG_PRINTK=y 55CONFIG_PRINTK=y
57CONFIG_BUG=y 56CONFIG_BUG=y
58CONFIG_ELF_CORE=y 57# CONFIG_ELF_CORE is not set
58CONFIG_COMPAT_BRK=y
59CONFIG_BASE_FULL=y 59CONFIG_BASE_FULL=y
60CONFIG_FUTEX=y 60CONFIG_FUTEX=y
61CONFIG_ANON_INODES=y 61CONFIG_ANON_INODES=y
62CONFIG_EPOLL=y 62CONFIG_EPOLL=y
63CONFIG_SIGNALFD=y 63CONFIG_SIGNALFD=y
64CONFIG_TIMERFD=y
64CONFIG_EVENTFD=y 65CONFIG_EVENTFD=y
66CONFIG_AIO=y
65CONFIG_VM_EVENT_COUNTERS=y 67CONFIG_VM_EVENT_COUNTERS=y
66CONFIG_SLAB=y 68CONFIG_SLAB=y
67# CONFIG_SLUB is not set 69# CONFIG_SLUB is not set
68# CONFIG_SLOB is not set 70# CONFIG_SLOB is not set
71# CONFIG_PROFILING is not set
72# CONFIG_MARKERS is not set
73CONFIG_HAVE_OPROFILE=y
74# CONFIG_HAVE_GENERIC_DMA_COHERENT is not set
69CONFIG_SLABINFO=y 75CONFIG_SLABINFO=y
70CONFIG_RT_MUTEXES=y 76CONFIG_RT_MUTEXES=y
71CONFIG_TINY_SHMEM=y 77CONFIG_TINY_SHMEM=y
72CONFIG_BASE_SMALL=0 78CONFIG_BASE_SMALL=0
73CONFIG_MODULES=y 79CONFIG_MODULES=y
80# CONFIG_MODULE_FORCE_LOAD is not set
74CONFIG_MODULE_UNLOAD=y 81CONFIG_MODULE_UNLOAD=y
75# CONFIG_MODULE_FORCE_UNLOAD is not set 82# CONFIG_MODULE_FORCE_UNLOAD is not set
76# CONFIG_MODVERSIONS is not set 83# CONFIG_MODVERSIONS is not set
@@ -81,6 +88,7 @@ CONFIG_BLOCK=y
81# CONFIG_BLK_DEV_IO_TRACE is not set 88# CONFIG_BLK_DEV_IO_TRACE is not set
82# CONFIG_LSF is not set 89# CONFIG_LSF is not set
83# CONFIG_BLK_DEV_BSG is not set 90# CONFIG_BLK_DEV_BSG is not set
91# CONFIG_BLK_DEV_INTEGRITY is not set
84 92
85# 93#
86# IO Schedulers 94# IO Schedulers
@@ -94,9 +102,11 @@ CONFIG_DEFAULT_AS=y
94# CONFIG_DEFAULT_CFQ is not set 102# CONFIG_DEFAULT_CFQ is not set
95# CONFIG_DEFAULT_NOOP is not set 103# CONFIG_DEFAULT_NOOP is not set
96CONFIG_DEFAULT_IOSCHED="anticipatory" 104CONFIG_DEFAULT_IOSCHED="anticipatory"
105CONFIG_CLASSIC_RCU=y
97# CONFIG_PREEMPT_NONE is not set 106# CONFIG_PREEMPT_NONE is not set
98CONFIG_PREEMPT_VOLUNTARY=y 107CONFIG_PREEMPT_VOLUNTARY=y
99# CONFIG_PREEMPT is not set 108# CONFIG_PREEMPT is not set
109CONFIG_FREEZER=y
100 110
101# 111#
102# Blackfin Processor Options 112# Blackfin Processor Options
@@ -105,6 +115,10 @@ CONFIG_PREEMPT_VOLUNTARY=y
105# 115#
106# Processor and Board Settings 116# Processor and Board Settings
107# 117#
118# CONFIG_BF512 is not set
119# CONFIG_BF514 is not set
120# CONFIG_BF516 is not set
121# CONFIG_BF518 is not set
108# CONFIG_BF522 is not set 122# CONFIG_BF522 is not set
109# CONFIG_BF523 is not set 123# CONFIG_BF523 is not set
110# CONFIG_BF524 is not set 124# CONFIG_BF524 is not set
@@ -117,18 +131,23 @@ CONFIG_PREEMPT_VOLUNTARY=y
117# CONFIG_BF534 is not set 131# CONFIG_BF534 is not set
118# CONFIG_BF536 is not set 132# CONFIG_BF536 is not set
119CONFIG_BF537=y 133CONFIG_BF537=y
134# CONFIG_BF538 is not set
135# CONFIG_BF539 is not set
120# CONFIG_BF542 is not set 136# CONFIG_BF542 is not set
121# CONFIG_BF544 is not set 137# CONFIG_BF544 is not set
122# CONFIG_BF547 is not set 138# CONFIG_BF547 is not set
123# CONFIG_BF548 is not set 139# CONFIG_BF548 is not set
124# CONFIG_BF549 is not set 140# CONFIG_BF549 is not set
125# CONFIG_BF561 is not set 141# CONFIG_BF561 is not set
142CONFIG_BF_REV_MIN=2
143CONFIG_BF_REV_MAX=3
126# CONFIG_BF_REV_0_0 is not set 144# CONFIG_BF_REV_0_0 is not set
127# CONFIG_BF_REV_0_1 is not set 145# CONFIG_BF_REV_0_1 is not set
128CONFIG_BF_REV_0_2=y 146CONFIG_BF_REV_0_2=y
129# CONFIG_BF_REV_0_3 is not set 147# CONFIG_BF_REV_0_3 is not set
130# CONFIG_BF_REV_0_4 is not set 148# CONFIG_BF_REV_0_4 is not set
131# CONFIG_BF_REV_0_5 is not set 149# CONFIG_BF_REV_0_5 is not set
150# CONFIG_BF_REV_0_6 is not set
132# CONFIG_BF_REV_ANY is not set 151# CONFIG_BF_REV_ANY is not set
133# CONFIG_BF_REV_NONE is not set 152# CONFIG_BF_REV_NONE is not set
134CONFIG_BF53x=y 153CONFIG_BF53x=y
@@ -141,27 +160,28 @@ CONFIG_IRQ_SPORT0_TX=9
141CONFIG_IRQ_SPORT1_RX=9 160CONFIG_IRQ_SPORT1_RX=9
142CONFIG_IRQ_SPORT1_TX=9 161CONFIG_IRQ_SPORT1_TX=9
143CONFIG_IRQ_TWI=10 162CONFIG_IRQ_TWI=10
144CONFIG_IRQ_SPI=10
145CONFIG_IRQ_UART0_RX=10 163CONFIG_IRQ_UART0_RX=10
146CONFIG_IRQ_UART0_TX=10 164CONFIG_IRQ_UART0_TX=10
147CONFIG_IRQ_UART1_RX=10 165CONFIG_IRQ_UART1_RX=10
148CONFIG_IRQ_UART1_TX=10 166CONFIG_IRQ_UART1_TX=10
149CONFIG_IRQ_MAC_RX=11 167CONFIG_IRQ_MAC_RX=11
150CONFIG_IRQ_MAC_TX=11 168CONFIG_IRQ_MAC_TX=11
151CONFIG_IRQ_TMR0=12 169CONFIG_IRQ_TIMER0=8
152CONFIG_IRQ_TMR1=12 170CONFIG_IRQ_TIMER1=12
153CONFIG_IRQ_TMR2=12 171CONFIG_IRQ_TIMER2=12
154CONFIG_IRQ_TMR3=12 172CONFIG_IRQ_TIMER3=12
155CONFIG_IRQ_TMR4=12 173CONFIG_IRQ_TIMER4=12
156CONFIG_IRQ_TMR5=12 174CONFIG_IRQ_TIMER5=12
157CONFIG_IRQ_TMR6=12 175CONFIG_IRQ_TIMER6=12
158CONFIG_IRQ_TMR7=12 176CONFIG_IRQ_TIMER7=12
159CONFIG_IRQ_PORTG_INTB=12 177CONFIG_IRQ_PORTG_INTB=12
160CONFIG_IRQ_MEM_DMA0=13 178CONFIG_IRQ_MEM_DMA0=13
161CONFIG_IRQ_MEM_DMA1=13 179CONFIG_IRQ_MEM_DMA1=13
162CONFIG_IRQ_WATCH=13 180CONFIG_IRQ_WATCH=13
181CONFIG_IRQ_SPI=10
163CONFIG_BFIN537_STAMP=y 182CONFIG_BFIN537_STAMP=y
164# CONFIG_BFIN537_BLUETECHNIX_CM is not set 183# CONFIG_BFIN537_BLUETECHNIX_CM is not set
184# CONFIG_BFIN537_BLUETECHNIX_TCM is not set
165# CONFIG_PNAV10 is not set 185# CONFIG_PNAV10 is not set
166# CONFIG_CAMSIG_MINOTAUR is not set 186# CONFIG_CAMSIG_MINOTAUR is not set
167# CONFIG_GENERIC_BF537_BOARD is not set 187# CONFIG_GENERIC_BF537_BOARD is not set
@@ -194,7 +214,6 @@ CONFIG_BOOT_LOAD=0x1000
194# 214#
195CONFIG_CLKIN_HZ=25000000 215CONFIG_CLKIN_HZ=25000000
196# CONFIG_BFIN_KERNEL_CLOCK is not set 216# CONFIG_BFIN_KERNEL_CLOCK is not set
197CONFIG_MAX_MEM_SIZE=512
198CONFIG_MAX_VCO_HZ=600000000 217CONFIG_MAX_VCO_HZ=600000000
199CONFIG_MIN_VCO_HZ=50000000 218CONFIG_MIN_VCO_HZ=50000000
200CONFIG_MAX_SCLK_HZ=133333333 219CONFIG_MAX_SCLK_HZ=133333333
@@ -208,6 +227,7 @@ CONFIG_HZ_250=y
208# CONFIG_HZ_300 is not set 227# CONFIG_HZ_300 is not set
209# CONFIG_HZ_1000 is not set 228# CONFIG_HZ_1000 is not set
210CONFIG_HZ=250 229CONFIG_HZ=250
230CONFIG_SCHED_HRTICK=y
211CONFIG_GENERIC_TIME=y 231CONFIG_GENERIC_TIME=y
212CONFIG_GENERIC_CLOCKEVENTS=y 232CONFIG_GENERIC_CLOCKEVENTS=y
213# CONFIG_CYCLES_CLOCKSOURCE is not set 233# CONFIG_CYCLES_CLOCKSOURCE is not set
@@ -245,6 +265,12 @@ CONFIG_SYS_BFIN_SPINLOCK_L1=y
245CONFIG_CACHELINE_ALIGNED_L1=y 265CONFIG_CACHELINE_ALIGNED_L1=y
246# CONFIG_SYSCALL_TAB_L1 is not set 266# CONFIG_SYSCALL_TAB_L1 is not set
247# CONFIG_CPLB_SWITCH_TAB_L1 is not set 267# CONFIG_CPLB_SWITCH_TAB_L1 is not set
268CONFIG_APP_STACK_L1=y
269
270#
271# Speed Optimizations
272#
273CONFIG_BFIN_INS_LOWOVERHEAD=y
248CONFIG_RAMKERNEL=y 274CONFIG_RAMKERNEL=y
249# CONFIG_ROMKERNEL is not set 275# CONFIG_ROMKERNEL is not set
250CONFIG_SELECT_MEMORY_MODEL=y 276CONFIG_SELECT_MEMORY_MODEL=y
@@ -253,14 +279,13 @@ CONFIG_FLATMEM_MANUAL=y
253# CONFIG_SPARSEMEM_MANUAL is not set 279# CONFIG_SPARSEMEM_MANUAL is not set
254CONFIG_FLATMEM=y 280CONFIG_FLATMEM=y
255CONFIG_FLAT_NODE_MEM_MAP=y 281CONFIG_FLAT_NODE_MEM_MAP=y
256# CONFIG_SPARSEMEM_STATIC is not set 282CONFIG_PAGEFLAGS_EXTENDED=y
257# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
258CONFIG_SPLIT_PTLOCK_CPUS=4 283CONFIG_SPLIT_PTLOCK_CPUS=4
259# CONFIG_RESOURCES_64BIT is not set 284# CONFIG_RESOURCES_64BIT is not set
285# CONFIG_PHYS_ADDR_T_64BIT is not set
260CONFIG_ZONE_DMA_FLAG=1 286CONFIG_ZONE_DMA_FLAG=1
261CONFIG_VIRT_TO_BUS=y 287CONFIG_VIRT_TO_BUS=y
262# CONFIG_BFIN_GPTIMERS is not set 288CONFIG_BFIN_GPTIMERS=m
263CONFIG_BFIN_DMA_5XX=y
264# CONFIG_DMA_UNCACHED_4M is not set 289# CONFIG_DMA_UNCACHED_4M is not set
265# CONFIG_DMA_UNCACHED_2M is not set 290# CONFIG_DMA_UNCACHED_2M is not set
266CONFIG_DMA_UNCACHED_1M=y 291CONFIG_DMA_UNCACHED_1M=y
@@ -275,7 +300,6 @@ CONFIG_BFIN_DCACHE=y
275# CONFIG_BFIN_ICACHE_LOCK is not set 300# CONFIG_BFIN_ICACHE_LOCK is not set
276# CONFIG_BFIN_WB is not set 301# CONFIG_BFIN_WB is not set
277CONFIG_BFIN_WT=y 302CONFIG_BFIN_WT=y
278CONFIG_L1_MAX_PIECE=16
279# CONFIG_MPU is not set 303# CONFIG_MPU is not set
280 304
281# 305#
@@ -304,7 +328,6 @@ CONFIG_BANK_3=0x99B2
304# 328#
305# Bus options (PCI, PCMCIA, EISA, MCA, ISA) 329# Bus options (PCI, PCMCIA, EISA, MCA, ISA)
306# 330#
307# CONFIG_PCI is not set
308# CONFIG_ARCH_SUPPORTS_MSI is not set 331# CONFIG_ARCH_SUPPORTS_MSI is not set
309# CONFIG_PCCARD is not set 332# CONFIG_PCCARD is not set
310 333
@@ -315,29 +338,31 @@ CONFIG_BINFMT_ELF_FDPIC=y
315CONFIG_BINFMT_FLAT=y 338CONFIG_BINFMT_FLAT=y
316CONFIG_BINFMT_ZFLAT=y 339CONFIG_BINFMT_ZFLAT=y
317# CONFIG_BINFMT_SHARED_FLAT is not set 340# CONFIG_BINFMT_SHARED_FLAT is not set
341# CONFIG_HAVE_AOUT is not set
318# CONFIG_BINFMT_MISC is not set 342# CONFIG_BINFMT_MISC is not set
319 343
320# 344#
321# Power management options 345# Power management options
322# 346#
323CONFIG_PM=y 347CONFIG_PM=y
324# CONFIG_PM_LEGACY is not set
325# CONFIG_PM_DEBUG is not set 348# CONFIG_PM_DEBUG is not set
326CONFIG_PM_SLEEP=y 349CONFIG_PM_SLEEP=y
327CONFIG_SUSPEND_UP_POSSIBLE=y
328CONFIG_SUSPEND=y 350CONFIG_SUSPEND=y
351CONFIG_SUSPEND_FREEZER=y
352CONFIG_ARCH_SUSPEND_POSSIBLE=y
329CONFIG_PM_BFIN_SLEEP_DEEPER=y 353CONFIG_PM_BFIN_SLEEP_DEEPER=y
330# CONFIG_PM_BFIN_SLEEP is not set 354# CONFIG_PM_BFIN_SLEEP is not set
331# CONFIG_PM_WAKEUP_BY_GPIO is not set 355# CONFIG_PM_WAKEUP_BY_GPIO is not set
332 356
333# 357#
334# CPU Frequency scaling 358# Possible Suspend Mem / Hibernate Wake-Up Sources
335# 359#
336# CONFIG_CPU_FREQ is not set 360# CONFIG_PM_BFIN_WAKE_PH6 is not set
337 361
338# 362#
339# Networking 363# CPU Frequency scaling
340# 364#
365# CONFIG_CPU_FREQ is not set
341CONFIG_NET=y 366CONFIG_NET=y
342 367
343# 368#
@@ -350,6 +375,7 @@ CONFIG_XFRM=y
350# CONFIG_XFRM_USER is not set 375# CONFIG_XFRM_USER is not set
351# CONFIG_XFRM_SUB_POLICY is not set 376# CONFIG_XFRM_SUB_POLICY is not set
352# CONFIG_XFRM_MIGRATE is not set 377# CONFIG_XFRM_MIGRATE is not set
378# CONFIG_XFRM_STATISTICS is not set
353# CONFIG_NET_KEY is not set 379# CONFIG_NET_KEY is not set
354CONFIG_INET=y 380CONFIG_INET=y
355# CONFIG_IP_MULTICAST is not set 381# CONFIG_IP_MULTICAST is not set
@@ -379,8 +405,6 @@ CONFIG_TCP_CONG_CUBIC=y
379CONFIG_DEFAULT_TCP_CONG="cubic" 405CONFIG_DEFAULT_TCP_CONG="cubic"
380# CONFIG_TCP_MD5SIG is not set 406# CONFIG_TCP_MD5SIG is not set
381# CONFIG_IPV6 is not set 407# CONFIG_IPV6 is not set
382# CONFIG_INET6_XFRM_TUNNEL is not set
383# CONFIG_INET6_TUNNEL is not set
384# CONFIG_NETLABEL is not set 408# CONFIG_NETLABEL is not set
385# CONFIG_NETWORK_SECMARK is not set 409# CONFIG_NETWORK_SECMARK is not set
386# CONFIG_NETFILTER is not set 410# CONFIG_NETFILTER is not set
@@ -389,6 +413,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
389# CONFIG_TIPC is not set 413# CONFIG_TIPC is not set
390# CONFIG_ATM is not set 414# CONFIG_ATM is not set
391# CONFIG_BRIDGE is not set 415# CONFIG_BRIDGE is not set
416# CONFIG_NET_DSA is not set
392# CONFIG_VLAN_8021Q is not set 417# CONFIG_VLAN_8021Q is not set
393# CONFIG_DECNET is not set 418# CONFIG_DECNET is not set
394# CONFIG_LLC2 is not set 419# CONFIG_LLC2 is not set
@@ -405,6 +430,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
405# 430#
406# CONFIG_NET_PKTGEN is not set 431# CONFIG_NET_PKTGEN is not set
407# CONFIG_HAMRADIO is not set 432# CONFIG_HAMRADIO is not set
433# CONFIG_CAN is not set
408CONFIG_IRDA=m 434CONFIG_IRDA=m
409 435
410# 436#
@@ -440,24 +466,14 @@ CONFIG_SIR_BFIN_DMA=y
440# CONFIG_DONGLE is not set 466# CONFIG_DONGLE is not set
441 467
442# 468#
443# Old SIR device drivers
444#
445# CONFIG_IRPORT_SIR is not set
446
447#
448# Old Serial dongle support
449#
450
451#
452# FIR device drivers 469# FIR device drivers
453# 470#
454# CONFIG_BT is not set 471# CONFIG_BT is not set
455# CONFIG_AF_RXRPC is not set 472# CONFIG_AF_RXRPC is not set
456 473# CONFIG_PHONET is not set
457# 474CONFIG_WIRELESS=y
458# Wireless
459#
460# CONFIG_CFG80211 is not set 475# CONFIG_CFG80211 is not set
476CONFIG_WIRELESS_OLD_REGULATORY=y
461# CONFIG_WIRELESS_EXT is not set 477# CONFIG_WIRELESS_EXT is not set
462# CONFIG_MAC80211 is not set 478# CONFIG_MAC80211 is not set
463# CONFIG_IEEE80211 is not set 479# CONFIG_IEEE80211 is not set
@@ -475,6 +491,8 @@ CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
475CONFIG_STANDALONE=y 491CONFIG_STANDALONE=y
476CONFIG_PREVENT_FIRMWARE_BUILD=y 492CONFIG_PREVENT_FIRMWARE_BUILD=y
477# CONFIG_FW_LOADER is not set 493# CONFIG_FW_LOADER is not set
494# CONFIG_DEBUG_DRIVER is not set
495# CONFIG_DEBUG_DEVRES is not set
478# CONFIG_SYS_HYPERVISOR is not set 496# CONFIG_SYS_HYPERVISOR is not set
479# CONFIG_CONNECTOR is not set 497# CONFIG_CONNECTOR is not set
480CONFIG_MTD=y 498CONFIG_MTD=y
@@ -483,6 +501,7 @@ CONFIG_MTD=y
483CONFIG_MTD_PARTITIONS=y 501CONFIG_MTD_PARTITIONS=y
484# CONFIG_MTD_REDBOOT_PARTS is not set 502# CONFIG_MTD_REDBOOT_PARTS is not set
485CONFIG_MTD_CMDLINE_PARTS=y 503CONFIG_MTD_CMDLINE_PARTS=y
504# CONFIG_MTD_AR7_PARTS is not set
486 505
487# 506#
488# User Modules And Translation Layers 507# User Modules And Translation Layers
@@ -553,15 +572,11 @@ CONFIG_MTD_NAND=m
553# CONFIG_MTD_NAND_VERIFY_WRITE is not set 572# CONFIG_MTD_NAND_VERIFY_WRITE is not set
554# CONFIG_MTD_NAND_ECC_SMC is not set 573# CONFIG_MTD_NAND_ECC_SMC is not set
555# CONFIG_MTD_NAND_MUSEUM_IDS is not set 574# CONFIG_MTD_NAND_MUSEUM_IDS is not set
556CONFIG_MTD_NAND_BFIN=m 575# CONFIG_MTD_NAND_BFIN is not set
557CONFIG_BFIN_NAND_BASE=0x20212000
558CONFIG_BFIN_NAND_CLE=2
559CONFIG_BFIN_NAND_ALE=1
560CONFIG_BFIN_NAND_READY=3
561CONFIG_MTD_NAND_IDS=m 576CONFIG_MTD_NAND_IDS=m
562# CONFIG_MTD_NAND_DISKONCHIP is not set 577# CONFIG_MTD_NAND_DISKONCHIP is not set
563# CONFIG_MTD_NAND_NANDSIM is not set 578# CONFIG_MTD_NAND_NANDSIM is not set
564# CONFIG_MTD_NAND_PLATFORM is not set 579CONFIG_MTD_NAND_PLATFORM=m
565# CONFIG_MTD_ONENAND is not set 580# CONFIG_MTD_ONENAND is not set
566 581
567# 582#
@@ -576,11 +591,14 @@ CONFIG_BLK_DEV=y
576CONFIG_BLK_DEV_RAM=y 591CONFIG_BLK_DEV_RAM=y
577CONFIG_BLK_DEV_RAM_COUNT=16 592CONFIG_BLK_DEV_RAM_COUNT=16
578CONFIG_BLK_DEV_RAM_SIZE=4096 593CONFIG_BLK_DEV_RAM_SIZE=4096
579CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024 594# CONFIG_BLK_DEV_XIP is not set
580# CONFIG_CDROM_PKTCDVD is not set 595# CONFIG_CDROM_PKTCDVD is not set
581# CONFIG_ATA_OVER_ETH is not set 596# CONFIG_ATA_OVER_ETH is not set
597# CONFIG_BLK_DEV_HD is not set
582CONFIG_MISC_DEVICES=y 598CONFIG_MISC_DEVICES=y
583# CONFIG_EEPROM_93CX6 is not set 599# CONFIG_EEPROM_93CX6 is not set
600# CONFIG_ENCLOSURE_SERVICES is not set
601CONFIG_HAVE_IDE=y
584# CONFIG_IDE is not set 602# CONFIG_IDE is not set
585 603
586# 604#
@@ -593,7 +611,6 @@ CONFIG_MISC_DEVICES=y
593# CONFIG_ATA is not set 611# CONFIG_ATA is not set
594# CONFIG_MD is not set 612# CONFIG_MD is not set
595CONFIG_NETDEVICES=y 613CONFIG_NETDEVICES=y
596# CONFIG_NETDEVICES_MULTIQUEUE is not set
597# CONFIG_DUMMY is not set 614# CONFIG_DUMMY is not set
598# CONFIG_BONDING is not set 615# CONFIG_BONDING is not set
599# CONFIG_MACVLAN is not set 616# CONFIG_MACVLAN is not set
@@ -614,6 +631,7 @@ CONFIG_PHYLIB=y
614CONFIG_SMSC_PHY=y 631CONFIG_SMSC_PHY=y
615# CONFIG_BROADCOM_PHY is not set 632# CONFIG_BROADCOM_PHY is not set
616# CONFIG_ICPLUS_PHY is not set 633# CONFIG_ICPLUS_PHY is not set
634# CONFIG_REALTEK_PHY is not set
617# CONFIG_FIXED_PHY is not set 635# CONFIG_FIXED_PHY is not set
618# CONFIG_MDIO_BITBANG is not set 636# CONFIG_MDIO_BITBANG is not set
619CONFIG_NET_ETHERNET=y 637CONFIG_NET_ETHERNET=y
@@ -626,11 +644,14 @@ CONFIG_BFIN_RX_DESC_NUM=20
626# CONFIG_SMC91X is not set 644# CONFIG_SMC91X is not set
627# CONFIG_SMSC911X is not set 645# CONFIG_SMSC911X is not set
628# CONFIG_DM9000 is not set 646# CONFIG_DM9000 is not set
647# CONFIG_ENC28J60 is not set
629# CONFIG_IBM_NEW_EMAC_ZMII is not set 648# CONFIG_IBM_NEW_EMAC_ZMII is not set
630# CONFIG_IBM_NEW_EMAC_RGMII is not set 649# CONFIG_IBM_NEW_EMAC_RGMII is not set
631# CONFIG_IBM_NEW_EMAC_TAH is not set 650# CONFIG_IBM_NEW_EMAC_TAH is not set
632# CONFIG_IBM_NEW_EMAC_EMAC4 is not set 651# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
633# CONFIG_B44 is not set 652# CONFIG_IBM_NEW_EMAC_NO_FLOW_CTRL is not set
653# CONFIG_IBM_NEW_EMAC_MAL_CLR_ICINTSTAT is not set
654# CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set
634CONFIG_NETDEV_1000=y 655CONFIG_NETDEV_1000=y
635# CONFIG_AX88180 is not set 656# CONFIG_AX88180 is not set
636CONFIG_NETDEV_10000=y 657CONFIG_NETDEV_10000=y
@@ -640,10 +661,10 @@ CONFIG_NETDEV_10000=y
640# 661#
641# CONFIG_WLAN_PRE80211 is not set 662# CONFIG_WLAN_PRE80211 is not set
642# CONFIG_WLAN_80211 is not set 663# CONFIG_WLAN_80211 is not set
664# CONFIG_IWLWIFI_LEDS is not set
643# CONFIG_WAN is not set 665# CONFIG_WAN is not set
644# CONFIG_PPP is not set 666# CONFIG_PPP is not set
645# CONFIG_SLIP is not set 667# CONFIG_SLIP is not set
646# CONFIG_SHAPER is not set
647# CONFIG_NETCONSOLE is not set 668# CONFIG_NETCONSOLE is not set
648# CONFIG_NETPOLL is not set 669# CONFIG_NETPOLL is not set
649# CONFIG_NET_POLL_CONTROLLER is not set 670# CONFIG_NET_POLL_CONTROLLER is not set
@@ -675,12 +696,15 @@ CONFIG_INPUT_EVDEV=m
675# CONFIG_INPUT_TOUCHSCREEN is not set 696# CONFIG_INPUT_TOUCHSCREEN is not set
676CONFIG_INPUT_MISC=y 697CONFIG_INPUT_MISC=y
677# CONFIG_INPUT_UINPUT is not set 698# CONFIG_INPUT_UINPUT is not set
678CONFIG_TWI_KEYPAD=m 699CONFIG_CONFIG_INPUT_PCF8574=m
679 700
680# 701#
681# Hardware I/O ports 702# Hardware I/O ports
682# 703#
683# CONFIG_SERIO is not set 704CONFIG_SERIO=y
705CONFIG_SERIO_SERPORT=y
706CONFIG_SERIO_LIBPS2=y
707# CONFIG_SERIO_RAW is not set
684# CONFIG_GAMEPORT is not set 708# CONFIG_GAMEPORT is not set
685 709
686# 710#
@@ -691,11 +715,14 @@ CONFIG_TWI_KEYPAD=m
691# CONFIG_BF5xx_PPIFCD is not set 715# CONFIG_BF5xx_PPIFCD is not set
692# CONFIG_BFIN_SIMPLE_TIMER is not set 716# CONFIG_BFIN_SIMPLE_TIMER is not set
693# CONFIG_BF5xx_PPI is not set 717# CONFIG_BF5xx_PPI is not set
694CONFIG_BFIN_SPORT=y 718CONFIG_BFIN_SPORT=m
695# CONFIG_BFIN_TIMER_LATENCY is not set 719# CONFIG_BFIN_TIMER_LATENCY is not set
696CONFIG_TWI_LCD=m 720CONFIG_TWI_LCD=m
721CONFIG_BFIN_DMA_INTERFACE=m
697CONFIG_SIMPLE_GPIO=m 722CONFIG_SIMPLE_GPIO=m
698# CONFIG_VT is not set 723# CONFIG_VT is not set
724# CONFIG_DEVKMEM is not set
725# CONFIG_BFIN_JTAG_COMM is not set
699# CONFIG_SERIAL_NONSTANDARD is not set 726# CONFIG_SERIAL_NONSTANDARD is not set
700 727
701# 728#
@@ -727,48 +754,51 @@ CONFIG_CAN4LINUX=y
727# 754#
728# linux embedded drivers 755# linux embedded drivers
729# 756#
730# CONFIG_CAN_MCF5282 is not set
731# CONFIG_CAN_UNCTWINCAN is not set
732CONFIG_CAN_BLACKFIN=m 757CONFIG_CAN_BLACKFIN=m
733# CONFIG_IPMI_HANDLER is not set 758# CONFIG_IPMI_HANDLER is not set
734# CONFIG_HW_RANDOM is not set 759# CONFIG_HW_RANDOM is not set
735# CONFIG_GEN_RTC is not set
736# CONFIG_R3964 is not set 760# CONFIG_R3964 is not set
737# CONFIG_RAW_DRIVER is not set 761# CONFIG_RAW_DRIVER is not set
738# CONFIG_TCG_TPM is not set 762# CONFIG_TCG_TPM is not set
739CONFIG_I2C=m 763CONFIG_I2C=m
740CONFIG_I2C_BOARDINFO=y 764CONFIG_I2C_BOARDINFO=y
741CONFIG_I2C_CHARDEV=m 765CONFIG_I2C_CHARDEV=m
766CONFIG_I2C_HELPER_AUTO=y
742 767
743# 768#
744# I2C Algorithms 769# I2C Hardware Bus support
745# 770#
746# CONFIG_I2C_ALGOBIT is not set
747# CONFIG_I2C_ALGOPCF is not set
748# CONFIG_I2C_ALGOPCA is not set
749 771
750# 772#
751# I2C Hardware Bus support 773# I2C system bus drivers (mostly embedded / system-on-chip)
752# 774#
753CONFIG_I2C_BLACKFIN_TWI=m 775CONFIG_I2C_BLACKFIN_TWI=m
754CONFIG_I2C_BLACKFIN_TWI_CLK_KHZ=50 776CONFIG_I2C_BLACKFIN_TWI_CLK_KHZ=100
755# CONFIG_I2C_GPIO is not set 777# CONFIG_I2C_GPIO is not set
756# CONFIG_I2C_OCORES is not set 778# CONFIG_I2C_OCORES is not set
757# CONFIG_I2C_PARPORT_LIGHT is not set
758# CONFIG_I2C_SIMTEC is not set 779# CONFIG_I2C_SIMTEC is not set
780
781#
782# External I2C/SMBus adapter drivers
783#
784# CONFIG_I2C_PARPORT_LIGHT is not set
759# CONFIG_I2C_TAOS_EVM is not set 785# CONFIG_I2C_TAOS_EVM is not set
786
787#
788# Other I2C/SMBus bus drivers
789#
790# CONFIG_I2C_PCA_PLATFORM is not set
760# CONFIG_I2C_STUB is not set 791# CONFIG_I2C_STUB is not set
761 792
762# 793#
763# Miscellaneous I2C Chip support 794# Miscellaneous I2C Chip support
764# 795#
765# CONFIG_SENSORS_DS1337 is not set
766# CONFIG_SENSORS_DS1374 is not set
767# CONFIG_DS1682 is not set 796# CONFIG_DS1682 is not set
797# CONFIG_AT24 is not set
768CONFIG_SENSORS_AD5252=m 798CONFIG_SENSORS_AD5252=m
769# CONFIG_SENSORS_EEPROM is not set 799# CONFIG_SENSORS_EEPROM is not set
770# CONFIG_SENSORS_PCF8574 is not set 800# CONFIG_SENSORS_PCF8574 is not set
771# CONFIG_SENSORS_PCF8575 is not set 801# CONFIG_PCF8575 is not set
772# CONFIG_SENSORS_PCA9539 is not set 802# CONFIG_SENSORS_PCA9539 is not set
773# CONFIG_SENSORS_PCF8591 is not set 803# CONFIG_SENSORS_PCF8591 is not set
774# CONFIG_SENSORS_MAX6875 is not set 804# CONFIG_SENSORS_MAX6875 is not set
@@ -777,17 +807,15 @@ CONFIG_SENSORS_AD5252=m
777# CONFIG_I2C_DEBUG_ALGO is not set 807# CONFIG_I2C_DEBUG_ALGO is not set
778# CONFIG_I2C_DEBUG_BUS is not set 808# CONFIG_I2C_DEBUG_BUS is not set
779# CONFIG_I2C_DEBUG_CHIP is not set 809# CONFIG_I2C_DEBUG_CHIP is not set
780
781#
782# SPI support
783#
784CONFIG_SPI=y 810CONFIG_SPI=y
811# CONFIG_SPI_DEBUG is not set
785CONFIG_SPI_MASTER=y 812CONFIG_SPI_MASTER=y
786 813
787# 814#
788# SPI Master Controller Drivers 815# SPI Master Controller Drivers
789# 816#
790CONFIG_SPI_BFIN=y 817CONFIG_SPI_BFIN=y
818# CONFIG_SPI_BFIN_LOCK is not set
791# CONFIG_SPI_BITBANG is not set 819# CONFIG_SPI_BITBANG is not set
792 820
793# 821#
@@ -796,11 +824,15 @@ CONFIG_SPI_BFIN=y
796# CONFIG_SPI_AT25 is not set 824# CONFIG_SPI_AT25 is not set
797# CONFIG_SPI_SPIDEV is not set 825# CONFIG_SPI_SPIDEV is not set
798# CONFIG_SPI_TLE62X0 is not set 826# CONFIG_SPI_TLE62X0 is not set
827CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y
828# CONFIG_GPIOLIB is not set
799# CONFIG_W1 is not set 829# CONFIG_W1 is not set
800# CONFIG_POWER_SUPPLY is not set 830# CONFIG_POWER_SUPPLY is not set
801CONFIG_HWMON=y 831CONFIG_HWMON=y
802# CONFIG_HWMON_VID is not set 832# CONFIG_HWMON_VID is not set
833# CONFIG_SENSORS_AD7414 is not set
803# CONFIG_SENSORS_AD7418 is not set 834# CONFIG_SENSORS_AD7418 is not set
835# CONFIG_SENSORS_ADCXX is not set
804# CONFIG_SENSORS_ADM1021 is not set 836# CONFIG_SENSORS_ADM1021 is not set
805# CONFIG_SENSORS_ADM1025 is not set 837# CONFIG_SENSORS_ADM1025 is not set
806# CONFIG_SENSORS_ADM1026 is not set 838# CONFIG_SENSORS_ADM1026 is not set
@@ -808,6 +840,7 @@ CONFIG_HWMON=y
808# CONFIG_SENSORS_ADM1031 is not set 840# CONFIG_SENSORS_ADM1031 is not set
809# CONFIG_SENSORS_ADM9240 is not set 841# CONFIG_SENSORS_ADM9240 is not set
810# CONFIG_SENSORS_ADT7470 is not set 842# CONFIG_SENSORS_ADT7470 is not set
843# CONFIG_SENSORS_ADT7473 is not set
811# CONFIG_SENSORS_ATXP1 is not set 844# CONFIG_SENSORS_ATXP1 is not set
812# CONFIG_SENSORS_DS1621 is not set 845# CONFIG_SENSORS_DS1621 is not set
813# CONFIG_SENSORS_F71805F is not set 846# CONFIG_SENSORS_F71805F is not set
@@ -828,6 +861,7 @@ CONFIG_HWMON=y
828# CONFIG_SENSORS_LM90 is not set 861# CONFIG_SENSORS_LM90 is not set
829# CONFIG_SENSORS_LM92 is not set 862# CONFIG_SENSORS_LM92 is not set
830# CONFIG_SENSORS_LM93 is not set 863# CONFIG_SENSORS_LM93 is not set
864# CONFIG_SENSORS_MAX1111 is not set
831# CONFIG_SENSORS_MAX1619 is not set 865# CONFIG_SENSORS_MAX1619 is not set
832# CONFIG_SENSORS_MAX6650 is not set 866# CONFIG_SENSORS_MAX6650 is not set
833# CONFIG_SENSORS_PC87360 is not set 867# CONFIG_SENSORS_PC87360 is not set
@@ -836,6 +870,7 @@ CONFIG_HWMON=y
836# CONFIG_SENSORS_SMSC47M1 is not set 870# CONFIG_SENSORS_SMSC47M1 is not set
837# CONFIG_SENSORS_SMSC47M192 is not set 871# CONFIG_SENSORS_SMSC47M192 is not set
838# CONFIG_SENSORS_SMSC47B397 is not set 872# CONFIG_SENSORS_SMSC47B397 is not set
873# CONFIG_SENSORS_ADS7828 is not set
839# CONFIG_SENSORS_THMC50 is not set 874# CONFIG_SENSORS_THMC50 is not set
840# CONFIG_SENSORS_VT1211 is not set 875# CONFIG_SENSORS_VT1211 is not set
841# CONFIG_SENSORS_W83781D is not set 876# CONFIG_SENSORS_W83781D is not set
@@ -843,9 +878,12 @@ CONFIG_HWMON=y
843# CONFIG_SENSORS_W83792D is not set 878# CONFIG_SENSORS_W83792D is not set
844# CONFIG_SENSORS_W83793 is not set 879# CONFIG_SENSORS_W83793 is not set
845# CONFIG_SENSORS_W83L785TS is not set 880# CONFIG_SENSORS_W83L785TS is not set
881# CONFIG_SENSORS_W83L786NG is not set
846# CONFIG_SENSORS_W83627HF is not set 882# CONFIG_SENSORS_W83627HF is not set
847# CONFIG_SENSORS_W83627EHF is not set 883# CONFIG_SENSORS_W83627EHF is not set
848# CONFIG_HWMON_DEBUG_CHIP is not set 884# CONFIG_HWMON_DEBUG_CHIP is not set
885# CONFIG_THERMAL is not set
886# CONFIG_THERMAL_HWMON is not set
849CONFIG_WATCHDOG=y 887CONFIG_WATCHDOG=y
850# CONFIG_WATCHDOG_NOWAYOUT is not set 888# CONFIG_WATCHDOG_NOWAYOUT is not set
851 889
@@ -856,21 +894,29 @@ CONFIG_WATCHDOG=y
856CONFIG_BFIN_WDT=y 894CONFIG_BFIN_WDT=y
857 895
858# 896#
859# Sonics Silicon Backplane
860#
861CONFIG_SSB_POSSIBLE=y
862# CONFIG_SSB is not set
863
864#
865# Multifunction device drivers 897# Multifunction device drivers
866# 898#
899# CONFIG_MFD_CORE is not set
867# CONFIG_MFD_SM501 is not set 900# CONFIG_MFD_SM501 is not set
901# CONFIG_HTC_PASIC3 is not set
902# CONFIG_MFD_TMIO is not set
903# CONFIG_MFD_WM8400 is not set
904# CONFIG_MFD_WM8350_I2C is not set
868 905
869# 906#
870# Multimedia devices 907# Multimedia devices
871# 908#
909
910#
911# Multimedia core support
912#
872# CONFIG_VIDEO_DEV is not set 913# CONFIG_VIDEO_DEV is not set
873# CONFIG_DVB_CORE is not set 914# CONFIG_DVB_CORE is not set
915# CONFIG_VIDEO_MEDIA is not set
916
917#
918# Multimedia drivers
919#
874# CONFIG_DAB is not set 920# CONFIG_DAB is not set
875 921
876# 922#
@@ -881,6 +927,7 @@ CONFIG_SSB_POSSIBLE=y
881CONFIG_FB=m 927CONFIG_FB=m
882CONFIG_FIRMWARE_EDID=y 928CONFIG_FIRMWARE_EDID=y
883# CONFIG_FB_DDC is not set 929# CONFIG_FB_DDC is not set
930# CONFIG_FB_BOOT_VESA_SUPPORT is not set
884CONFIG_FB_CFB_FILLRECT=m 931CONFIG_FB_CFB_FILLRECT=m
885CONFIG_FB_CFB_COPYAREA=m 932CONFIG_FB_CFB_COPYAREA=m
886CONFIG_FB_CFB_IMAGEBLIT=m 933CONFIG_FB_CFB_IMAGEBLIT=m
@@ -888,8 +935,8 @@ CONFIG_FB_CFB_IMAGEBLIT=m
888# CONFIG_FB_SYS_FILLRECT is not set 935# CONFIG_FB_SYS_FILLRECT is not set
889# CONFIG_FB_SYS_COPYAREA is not set 936# CONFIG_FB_SYS_COPYAREA is not set
890# CONFIG_FB_SYS_IMAGEBLIT is not set 937# CONFIG_FB_SYS_IMAGEBLIT is not set
938# CONFIG_FB_FOREIGN_ENDIAN is not set
891# CONFIG_FB_SYS_FOPS is not set 939# CONFIG_FB_SYS_FOPS is not set
892CONFIG_FB_DEFERRED_IO=y
893# CONFIG_FB_SVGALIB is not set 940# CONFIG_FB_SVGALIB is not set
894# CONFIG_FB_MACMODES is not set 941# CONFIG_FB_MACMODES is not set
895# CONFIG_FB_BACKLIGHT is not set 942# CONFIG_FB_BACKLIGHT is not set
@@ -899,8 +946,12 @@ CONFIG_FB_DEFERRED_IO=y
899# 946#
900# Frame buffer hardware drivers 947# Frame buffer hardware drivers
901# 948#
902# CONFIG_FB_HITACHI_TX09 is not set
903# CONFIG_FB_BFIN_T350MCQB is not set 949# CONFIG_FB_BFIN_T350MCQB is not set
950# CONFIG_FB_BFIN_LQ035Q1 is not set
951CONFIG_FB_BF537_LQ035=m
952CONFIG_LQ035_SLAVE_ADDR=0x58
953# CONFIG_FB_BFIN_LANDSCAPE is not set
954# CONFIG_FB_BFIN_BGR is not set
904CONFIG_FB_BFIN_7393=m 955CONFIG_FB_BFIN_7393=m
905CONFIG_NTSC=y 956CONFIG_NTSC=y
906# CONFIG_PAL is not set 957# CONFIG_PAL is not set
@@ -910,15 +961,17 @@ CONFIG_NTSC=y
910# CONFIG_PAL_YCBCR is not set 961# CONFIG_PAL_YCBCR is not set
911CONFIG_ADV7393_1XMEM=y 962CONFIG_ADV7393_1XMEM=y
912# CONFIG_ADV7393_2XMEM is not set 963# CONFIG_ADV7393_2XMEM is not set
913CONFIG_FB_BF537_LQ035=m 964# CONFIG_FB_HITACHI_TX09 is not set
914CONFIG_LQ035_SLAVE_ADDR=0x58
915# CONFIG_FB_BFIN_LANDSCAPE is not set
916# CONFIG_FB_BFIN_BGR is not set
917# CONFIG_FB_S1D13XXX is not set 965# CONFIG_FB_S1D13XXX is not set
918# CONFIG_FB_VIRTUAL is not set 966# CONFIG_FB_VIRTUAL is not set
967# CONFIG_FB_METRONOME is not set
919CONFIG_BACKLIGHT_LCD_SUPPORT=y 968CONFIG_BACKLIGHT_LCD_SUPPORT=y
920CONFIG_LCD_CLASS_DEVICE=m 969CONFIG_LCD_CLASS_DEVICE=m
921# CONFIG_LCD_LTV350QV is not set 970# CONFIG_LCD_LTV350QV is not set
971# CONFIG_LCD_ILI9320 is not set
972# CONFIG_LCD_TDO24M is not set
973# CONFIG_LCD_VGG2432A4 is not set
974# CONFIG_LCD_PLATFORM is not set
922CONFIG_BACKLIGHT_CLASS_DEVICE=m 975CONFIG_BACKLIGHT_CLASS_DEVICE=m
923CONFIG_BACKLIGHT_CORGI=m 976CONFIG_BACKLIGHT_CORGI=m
924 977
@@ -927,15 +980,8 @@ CONFIG_BACKLIGHT_CORGI=m
927# 980#
928# CONFIG_DISPLAY_SUPPORT is not set 981# CONFIG_DISPLAY_SUPPORT is not set
929# CONFIG_LOGO is not set 982# CONFIG_LOGO is not set
930
931#
932# Sound
933#
934CONFIG_SOUND=m 983CONFIG_SOUND=m
935 984CONFIG_SOUND_OSS_CORE=y
936#
937# Advanced Linux Sound Architecture
938#
939CONFIG_SND=m 985CONFIG_SND=m
940CONFIG_SND_TIMER=m 986CONFIG_SND_TIMER=m
941CONFIG_SND_PCM=m 987CONFIG_SND_PCM=m
@@ -949,18 +995,12 @@ CONFIG_SND_SUPPORT_OLD_API=y
949CONFIG_SND_VERBOSE_PROCFS=y 995CONFIG_SND_VERBOSE_PROCFS=y
950# CONFIG_SND_VERBOSE_PRINTK is not set 996# CONFIG_SND_VERBOSE_PRINTK is not set
951# CONFIG_SND_DEBUG is not set 997# CONFIG_SND_DEBUG is not set
952 998CONFIG_SND_DRIVERS=y
953#
954# Generic devices
955#
956# CONFIG_SND_DUMMY is not set 999# CONFIG_SND_DUMMY is not set
957# CONFIG_SND_MTPAV is not set 1000# CONFIG_SND_MTPAV is not set
958# CONFIG_SND_SERIAL_U16550 is not set 1001# CONFIG_SND_SERIAL_U16550 is not set
959# CONFIG_SND_MPU401 is not set 1002# CONFIG_SND_MPU401 is not set
960 1003CONFIG_SND_SPI=y
961#
962# SPI devices
963#
964 1004
965# 1005#
966# ALSA Blackfin devices 1006# ALSA Blackfin devices
@@ -972,51 +1012,46 @@ CONFIG_SND_BLACKFIN_AD1836_MULSUB=y
972# CONFIG_SND_BLACKFIN_AD1836_5P1 is not set 1012# CONFIG_SND_BLACKFIN_AD1836_5P1 is not set
973CONFIG_SND_BLACKFIN_SPORT=0 1013CONFIG_SND_BLACKFIN_SPORT=0
974CONFIG_SND_BLACKFIN_SPI_PFBIT=4 1014CONFIG_SND_BLACKFIN_SPI_PFBIT=4
975CONFIG_SND_BFIN_AD73311=m
976CONFIG_SND_BFIN_SPORT=0 1015CONFIG_SND_BFIN_SPORT=0
977CONFIG_SND_BFIN_AD73311_SE=4
978CONFIG_SND_BFIN_AD73322=m 1016CONFIG_SND_BFIN_AD73322=m
979CONFIG_SND_BFIN_AD73322_SPORT0_SE=10 1017CONFIG_SND_BFIN_AD73322_SPORT0_SE=10
980CONFIG_SND_BFIN_AD73322_SPORT1_SE=14 1018CONFIG_SND_BFIN_AD73322_SPORT1_SE=14
981CONFIG_SND_BFIN_AD73322_RESET=12 1019CONFIG_SND_BFIN_AD73322_RESET=12
982
983#
984# System on Chip audio support
985#
986CONFIG_SND_SOC_AC97_BUS=y
987CONFIG_SND_SOC=m 1020CONFIG_SND_SOC=m
988CONFIG_SND_BF5XX_SOC=m 1021CONFIG_SND_SOC_AC97_BUS=y
989CONFIG_SND_MMAP_SUPPORT=y 1022CONFIG_SND_BF5XX_I2S=m
990CONFIG_SND_BF5XX_SOC_AC97=m
991# CONFIG_SND_BF5XX_SOC_WM8750 is not set
992# CONFIG_SND_BF5XX_SOC_WM8731 is not set
993# CONFIG_SND_BF5XX_SOC_SSM2602 is not set 1023# CONFIG_SND_BF5XX_SOC_SSM2602 is not set
994CONFIG_SND_BF5XX_SOC_BF5xx=m 1024CONFIG_SND_BF5XX_SOC_AD73311=m
1025CONFIG_SND_BFIN_AD73311_SE=4
1026CONFIG_SND_BF5XX_AC97=m
1027CONFIG_SND_BF5XX_MMAP_SUPPORT=y
1028# CONFIG_SND_BF5XX_MULTICHAN_SUPPORT is not set
1029CONFIG_SND_BF5XX_SOC_SPORT=m
1030CONFIG_SND_BF5XX_SOC_I2S=m
1031CONFIG_SND_BF5XX_SOC_AC97=m
1032CONFIG_SND_BF5XX_SOC_AD1980=m
995CONFIG_SND_BF5XX_SPORT_NUM=0 1033CONFIG_SND_BF5XX_SPORT_NUM=0
996# CONFIG_SND_BF5XX_HAVE_COLD_RESET is not set 1034# CONFIG_SND_BF5XX_HAVE_COLD_RESET is not set
997 1035# CONFIG_SND_SOC_ALL_CODECS is not set
998#
999# SoC Audio support for SuperH
1000#
1001CONFIG_SND_SOC_AD1980=m 1036CONFIG_SND_SOC_AD1980=m
1002 1037CONFIG_SND_SOC_AD73311=m
1003#
1004# Open Sound System
1005#
1006# CONFIG_SOUND_PRIME is not set 1038# CONFIG_SOUND_PRIME is not set
1007CONFIG_AC97_BUS=m 1039CONFIG_AC97_BUS=m
1008CONFIG_HID_SUPPORT=y 1040CONFIG_HID_SUPPORT=y
1009CONFIG_HID=y 1041CONFIG_HID=y
1010# CONFIG_HID_DEBUG is not set 1042# CONFIG_HID_DEBUG is not set
1011# CONFIG_HIDRAW is not set 1043# CONFIG_HIDRAW is not set
1044# CONFIG_HID_PID is not set
1045
1046#
1047# Special HID drivers
1048#
1049CONFIG_HID_COMPAT=y
1012# CONFIG_USB_SUPPORT is not set 1050# CONFIG_USB_SUPPORT is not set
1013# CONFIG_NO_DUMMY_DELAY is not set
1014# CONFIG_DUMMY_DELAY_BANK0 is not set
1015# CONFIG_DUMMY_DELAY_BANK1 is not set
1016# CONFIG_DUMMY_DELAY_BANK2 is not set
1017# CONFIG_DUMMY_DELAY_BANK3 is not set
1018# CONFIG_MMC is not set 1051# CONFIG_MMC is not set
1052# CONFIG_MEMSTICK is not set
1019# CONFIG_NEW_LEDS is not set 1053# CONFIG_NEW_LEDS is not set
1054# CONFIG_ACCESSIBILITY is not set
1020CONFIG_RTC_LIB=y 1055CONFIG_RTC_LIB=y
1021CONFIG_RTC_CLASS=y 1056CONFIG_RTC_CLASS=y
1022CONFIG_RTC_HCTOSYS=y 1057CONFIG_RTC_HCTOSYS=y
@@ -1045,51 +1080,57 @@ CONFIG_RTC_INTF_DEV=y
1045# CONFIG_RTC_DRV_PCF8563 is not set 1080# CONFIG_RTC_DRV_PCF8563 is not set
1046# CONFIG_RTC_DRV_PCF8583 is not set 1081# CONFIG_RTC_DRV_PCF8583 is not set
1047# CONFIG_RTC_DRV_M41T80 is not set 1082# CONFIG_RTC_DRV_M41T80 is not set
1083# CONFIG_RTC_DRV_S35390A is not set
1084# CONFIG_RTC_DRV_FM3130 is not set
1048 1085
1049# 1086#
1050# SPI RTC drivers 1087# SPI RTC drivers
1051# 1088#
1052# CONFIG_RTC_DRV_RS5C348 is not set 1089# CONFIG_RTC_DRV_M41T94 is not set
1090# CONFIG_RTC_DRV_DS1305 is not set
1053# CONFIG_RTC_DRV_MAX6902 is not set 1091# CONFIG_RTC_DRV_MAX6902 is not set
1092# CONFIG_RTC_DRV_R9701 is not set
1093# CONFIG_RTC_DRV_RS5C348 is not set
1094# CONFIG_RTC_DRV_DS3234 is not set
1054 1095
1055# 1096#
1056# Platform RTC drivers 1097# Platform RTC drivers
1057# 1098#
1099# CONFIG_RTC_DRV_DS1286 is not set
1100# CONFIG_RTC_DRV_DS1511 is not set
1058# CONFIG_RTC_DRV_DS1553 is not set 1101# CONFIG_RTC_DRV_DS1553 is not set
1059# CONFIG_RTC_DRV_STK17TA8 is not set
1060# CONFIG_RTC_DRV_DS1742 is not set 1102# CONFIG_RTC_DRV_DS1742 is not set
1103# CONFIG_RTC_DRV_STK17TA8 is not set
1061# CONFIG_RTC_DRV_M48T86 is not set 1104# CONFIG_RTC_DRV_M48T86 is not set
1105# CONFIG_RTC_DRV_M48T35 is not set
1062# CONFIG_RTC_DRV_M48T59 is not set 1106# CONFIG_RTC_DRV_M48T59 is not set
1107# CONFIG_RTC_DRV_BQ4802 is not set
1063# CONFIG_RTC_DRV_V3020 is not set 1108# CONFIG_RTC_DRV_V3020 is not set
1064 1109
1065# 1110#
1066# on-CPU RTC drivers 1111# on-CPU RTC drivers
1067# 1112#
1068CONFIG_RTC_DRV_BFIN=y 1113CONFIG_RTC_DRV_BFIN=y
1069 1114# CONFIG_DMADEVICES is not set
1070#
1071# Userspace I/O
1072#
1073# CONFIG_UIO is not set 1115# CONFIG_UIO is not set
1116# CONFIG_STAGING is not set
1074 1117
1075# 1118#
1076# File systems 1119# File systems
1077# 1120#
1078# CONFIG_EXT2_FS is not set 1121# CONFIG_EXT2_FS is not set
1079# CONFIG_EXT3_FS is not set 1122# CONFIG_EXT3_FS is not set
1080# CONFIG_EXT4DEV_FS is not set 1123# CONFIG_EXT4_FS is not set
1081# CONFIG_REISERFS_FS is not set 1124# CONFIG_REISERFS_FS is not set
1082# CONFIG_JFS_FS is not set 1125# CONFIG_JFS_FS is not set
1083# CONFIG_FS_POSIX_ACL is not set 1126# CONFIG_FS_POSIX_ACL is not set
1127CONFIG_FILE_LOCKING=y
1084# CONFIG_XFS_FS is not set 1128# CONFIG_XFS_FS is not set
1085# CONFIG_GFS2_FS is not set
1086# CONFIG_OCFS2_FS is not set 1129# CONFIG_OCFS2_FS is not set
1087# CONFIG_MINIX_FS is not set 1130# CONFIG_DNOTIFY is not set
1088# CONFIG_ROMFS_FS is not set
1089CONFIG_INOTIFY=y 1131CONFIG_INOTIFY=y
1090CONFIG_INOTIFY_USER=y 1132CONFIG_INOTIFY_USER=y
1091# CONFIG_QUOTA is not set 1133# CONFIG_QUOTA is not set
1092# CONFIG_DNOTIFY is not set
1093# CONFIG_AUTOFS_FS is not set 1134# CONFIG_AUTOFS_FS is not set
1094# CONFIG_AUTOFS4_FS is not set 1135# CONFIG_AUTOFS4_FS is not set
1095# CONFIG_FUSE_FS is not set 1136# CONFIG_FUSE_FS is not set
@@ -1129,11 +1170,11 @@ CONFIG_SYSFS=y
1129# CONFIG_EFS_FS is not set 1170# CONFIG_EFS_FS is not set
1130CONFIG_YAFFS_FS=m 1171CONFIG_YAFFS_FS=m
1131CONFIG_YAFFS_YAFFS1=y 1172CONFIG_YAFFS_YAFFS1=y
1173# CONFIG_YAFFS_9BYTE_TAGS is not set
1132# CONFIG_YAFFS_DOES_ECC is not set 1174# CONFIG_YAFFS_DOES_ECC is not set
1133CONFIG_YAFFS_YAFFS2=y 1175CONFIG_YAFFS_YAFFS2=y
1134CONFIG_YAFFS_AUTO_YAFFS2=y 1176CONFIG_YAFFS_AUTO_YAFFS2=y
1135# CONFIG_YAFFS_DISABLE_LAZY_LOAD is not set 1177# CONFIG_YAFFS_DISABLE_LAZY_LOAD is not set
1136CONFIG_YAFFS_CHECKPOINT_RESERVED_BLOCKS=10
1137# CONFIG_YAFFS_DISABLE_WIDE_TNODES is not set 1178# CONFIG_YAFFS_DISABLE_WIDE_TNODES is not set
1138# CONFIG_YAFFS_ALWAYS_CHECK_CHUNK_ERASED is not set 1179# CONFIG_YAFFS_ALWAYS_CHECK_CHUNK_ERASED is not set
1139CONFIG_YAFFS_SHORT_NAMES_IN_RAM=y 1180CONFIG_YAFFS_SHORT_NAMES_IN_RAM=y
@@ -1150,8 +1191,11 @@ CONFIG_JFFS2_RTIME=y
1150# CONFIG_JFFS2_RUBIN is not set 1191# CONFIG_JFFS2_RUBIN is not set
1151# CONFIG_CRAMFS is not set 1192# CONFIG_CRAMFS is not set
1152# CONFIG_VXFS_FS is not set 1193# CONFIG_VXFS_FS is not set
1194# CONFIG_MINIX_FS is not set
1195# CONFIG_OMFS_FS is not set
1153# CONFIG_HPFS_FS is not set 1196# CONFIG_HPFS_FS is not set
1154# CONFIG_QNX4FS_FS is not set 1197# CONFIG_QNX4FS_FS is not set
1198# CONFIG_ROMFS_FS is not set
1155# CONFIG_SYSV_FS is not set 1199# CONFIG_SYSV_FS is not set
1156# CONFIG_UFS_FS is not set 1200# CONFIG_UFS_FS is not set
1157CONFIG_NETWORK_FILESYSTEMS=y 1201CONFIG_NETWORK_FILESYSTEMS=y
@@ -1159,13 +1203,12 @@ CONFIG_NFS_FS=m
1159CONFIG_NFS_V3=y 1203CONFIG_NFS_V3=y
1160# CONFIG_NFS_V3_ACL is not set 1204# CONFIG_NFS_V3_ACL is not set
1161# CONFIG_NFS_V4 is not set 1205# CONFIG_NFS_V4 is not set
1162# CONFIG_NFS_DIRECTIO is not set
1163# CONFIG_NFSD is not set 1206# CONFIG_NFSD is not set
1164CONFIG_LOCKD=m 1207CONFIG_LOCKD=m
1165CONFIG_LOCKD_V4=y 1208CONFIG_LOCKD_V4=y
1166CONFIG_NFS_COMMON=y 1209CONFIG_NFS_COMMON=y
1167CONFIG_SUNRPC=m 1210CONFIG_SUNRPC=m
1168# CONFIG_SUNRPC_BIND34 is not set 1211# CONFIG_SUNRPC_REGISTER_V4 is not set
1169# CONFIG_RPCSEC_GSS_KRB5 is not set 1212# CONFIG_RPCSEC_GSS_KRB5 is not set
1170# CONFIG_RPCSEC_GSS_SPKM3 is not set 1213# CONFIG_RPCSEC_GSS_SPKM3 is not set
1171CONFIG_SMB_FS=m 1214CONFIG_SMB_FS=m
@@ -1221,9 +1264,6 @@ CONFIG_NLS_DEFAULT="iso8859-1"
1221# CONFIG_NLS_KOI8_U is not set 1264# CONFIG_NLS_KOI8_U is not set
1222# CONFIG_NLS_UTF8 is not set 1265# CONFIG_NLS_UTF8 is not set
1223# CONFIG_DLM is not set 1266# CONFIG_DLM is not set
1224CONFIG_INSTRUMENTATION=y
1225# CONFIG_PROFILING is not set
1226# CONFIG_MARKERS is not set
1227 1267
1228# 1268#
1229# Kernel hacking 1269# Kernel hacking
@@ -1231,14 +1271,53 @@ CONFIG_INSTRUMENTATION=y
1231# CONFIG_PRINTK_TIME is not set 1271# CONFIG_PRINTK_TIME is not set
1232CONFIG_ENABLE_WARN_DEPRECATED=y 1272CONFIG_ENABLE_WARN_DEPRECATED=y
1233CONFIG_ENABLE_MUST_CHECK=y 1273CONFIG_ENABLE_MUST_CHECK=y
1274CONFIG_FRAME_WARN=1024
1234# CONFIG_MAGIC_SYSRQ is not set 1275# CONFIG_MAGIC_SYSRQ is not set
1235# CONFIG_UNUSED_SYMBOLS is not set 1276# CONFIG_UNUSED_SYMBOLS is not set
1236CONFIG_DEBUG_FS=y 1277CONFIG_DEBUG_FS=y
1237# CONFIG_HEADERS_CHECK is not set 1278# CONFIG_HEADERS_CHECK is not set
1238# CONFIG_DEBUG_KERNEL is not set 1279CONFIG_DEBUG_KERNEL=y
1280# CONFIG_DEBUG_SHIRQ is not set
1281CONFIG_DETECT_SOFTLOCKUP=y
1282# CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC is not set
1283CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE=0
1284CONFIG_SCHED_DEBUG=y
1285# CONFIG_SCHEDSTATS is not set
1286# CONFIG_TIMER_STATS is not set
1287# CONFIG_DEBUG_OBJECTS is not set
1288# CONFIG_DEBUG_SLAB is not set
1289# CONFIG_DEBUG_RT_MUTEXES is not set
1290# CONFIG_RT_MUTEX_TESTER is not set
1291# CONFIG_DEBUG_SPINLOCK is not set
1292# CONFIG_DEBUG_MUTEXES is not set
1293# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
1294# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
1295# CONFIG_DEBUG_KOBJECT is not set
1239# CONFIG_DEBUG_BUGVERBOSE is not set 1296# CONFIG_DEBUG_BUGVERBOSE is not set
1297CONFIG_DEBUG_INFO=y
1298# CONFIG_DEBUG_VM is not set
1299# CONFIG_DEBUG_WRITECOUNT is not set
1300# CONFIG_DEBUG_MEMORY_INIT is not set
1301# CONFIG_DEBUG_LIST is not set
1302# CONFIG_DEBUG_SG is not set
1303# CONFIG_FRAME_POINTER is not set
1304# CONFIG_BOOT_PRINTK_DELAY is not set
1305# CONFIG_RCU_TORTURE_TEST is not set
1306# CONFIG_RCU_CPU_STALL_DETECTOR is not set
1307# CONFIG_BACKTRACE_SELF_TEST is not set
1308# CONFIG_DEBUG_BLOCK_EXT_DEVT is not set
1309# CONFIG_FAULT_INJECTION is not set
1310# CONFIG_SYSCTL_SYSCALL_CHECK is not set
1311# CONFIG_DYNAMIC_PRINTK_DEBUG is not set
1240# CONFIG_SAMPLES is not set 1312# CONFIG_SAMPLES is not set
1313CONFIG_HAVE_ARCH_KGDB=y
1314# CONFIG_KGDB is not set
1315# CONFIG_DEBUG_STACKOVERFLOW is not set
1316# CONFIG_DEBUG_STACK_USAGE is not set
1317CONFIG_DEBUG_VERBOSE=y
1241CONFIG_DEBUG_MMRS=y 1318CONFIG_DEBUG_MMRS=y
1319# CONFIG_DEBUG_HWERR is not set
1320# CONFIG_DEBUG_DOUBLEFAULT is not set
1242CONFIG_DEBUG_HUNT_FOR_ZERO=y 1321CONFIG_DEBUG_HUNT_FOR_ZERO=y
1243CONFIG_DEBUG_BFIN_HWTRACE_ON=y 1322CONFIG_DEBUG_BFIN_HWTRACE_ON=y
1244CONFIG_DEBUG_BFIN_HWTRACE_COMPRESSION_OFF=y 1323CONFIG_DEBUG_BFIN_HWTRACE_COMPRESSION_OFF=y
@@ -1256,9 +1335,94 @@ CONFIG_ACCESS_CHECK=y
1256# 1335#
1257# CONFIG_KEYS is not set 1336# CONFIG_KEYS is not set
1258CONFIG_SECURITY=y 1337CONFIG_SECURITY=y
1338# CONFIG_SECURITYFS is not set
1259# CONFIG_SECURITY_NETWORK is not set 1339# CONFIG_SECURITY_NETWORK is not set
1260# CONFIG_SECURITY_CAPABILITIES is not set 1340# CONFIG_SECURITY_FILE_CAPABILITIES is not set
1261# CONFIG_CRYPTO is not set 1341CONFIG_SECURITY_DEFAULT_MMAP_MIN_ADDR=0
1342CONFIG_CRYPTO=y
1343
1344#
1345# Crypto core or helper
1346#
1347# CONFIG_CRYPTO_FIPS is not set
1348# CONFIG_CRYPTO_MANAGER is not set
1349# CONFIG_CRYPTO_GF128MUL is not set
1350# CONFIG_CRYPTO_NULL is not set
1351# CONFIG_CRYPTO_CRYPTD is not set
1352# CONFIG_CRYPTO_AUTHENC is not set
1353# CONFIG_CRYPTO_TEST is not set
1354
1355#
1356# Authenticated Encryption with Associated Data
1357#
1358# CONFIG_CRYPTO_CCM is not set
1359# CONFIG_CRYPTO_GCM is not set
1360# CONFIG_CRYPTO_SEQIV is not set
1361
1362#
1363# Block modes
1364#
1365# CONFIG_CRYPTO_CBC is not set
1366# CONFIG_CRYPTO_CTR is not set
1367# CONFIG_CRYPTO_CTS is not set
1368# CONFIG_CRYPTO_ECB is not set
1369# CONFIG_CRYPTO_LRW is not set
1370# CONFIG_CRYPTO_PCBC is not set
1371# CONFIG_CRYPTO_XTS is not set
1372
1373#
1374# Hash modes
1375#
1376# CONFIG_CRYPTO_HMAC is not set
1377# CONFIG_CRYPTO_XCBC is not set
1378
1379#
1380# Digest
1381#
1382# CONFIG_CRYPTO_CRC32C is not set
1383# CONFIG_CRYPTO_MD4 is not set
1384# CONFIG_CRYPTO_MD5 is not set
1385# CONFIG_CRYPTO_MICHAEL_MIC is not set
1386# CONFIG_CRYPTO_RMD128 is not set
1387# CONFIG_CRYPTO_RMD160 is not set
1388# CONFIG_CRYPTO_RMD256 is not set
1389# CONFIG_CRYPTO_RMD320 is not set
1390# CONFIG_CRYPTO_SHA1 is not set
1391# CONFIG_CRYPTO_SHA256 is not set
1392# CONFIG_CRYPTO_SHA512 is not set
1393# CONFIG_CRYPTO_TGR192 is not set
1394# CONFIG_CRYPTO_WP512 is not set
1395
1396#
1397# Ciphers
1398#
1399# CONFIG_CRYPTO_AES is not set
1400# CONFIG_CRYPTO_ANUBIS is not set
1401# CONFIG_CRYPTO_ARC4 is not set
1402# CONFIG_CRYPTO_BLOWFISH is not set
1403# CONFIG_CRYPTO_CAMELLIA is not set
1404# CONFIG_CRYPTO_CAST5 is not set
1405# CONFIG_CRYPTO_CAST6 is not set
1406# CONFIG_CRYPTO_DES is not set
1407# CONFIG_CRYPTO_FCRYPT is not set
1408# CONFIG_CRYPTO_KHAZAD is not set
1409# CONFIG_CRYPTO_SALSA20 is not set
1410# CONFIG_CRYPTO_SEED is not set
1411# CONFIG_CRYPTO_SERPENT is not set
1412# CONFIG_CRYPTO_TEA is not set
1413# CONFIG_CRYPTO_TWOFISH is not set
1414
1415#
1416# Compression
1417#
1418# CONFIG_CRYPTO_DEFLATE is not set
1419# CONFIG_CRYPTO_LZO is not set
1420
1421#
1422# Random Number Generation
1423#
1424# CONFIG_CRYPTO_ANSI_CPRNG is not set
1425CONFIG_CRYPTO_HW=y
1262 1426
1263# 1427#
1264# Library routines 1428# Library routines
@@ -1266,6 +1430,7 @@ CONFIG_SECURITY=y
1266CONFIG_BITREVERSE=y 1430CONFIG_BITREVERSE=y
1267CONFIG_CRC_CCITT=m 1431CONFIG_CRC_CCITT=m
1268# CONFIG_CRC16 is not set 1432# CONFIG_CRC16 is not set
1433# CONFIG_CRC_T10DIF is not set
1269# CONFIG_CRC_ITU_T is not set 1434# CONFIG_CRC_ITU_T is not set
1270CONFIG_CRC32=y 1435CONFIG_CRC32=y
1271# CONFIG_CRC7 is not set 1436# CONFIG_CRC7 is not set
diff --git a/arch/blackfin/configs/BF538-EZKIT_defconfig b/arch/blackfin/configs/BF538-EZKIT_defconfig
new file mode 100644
index 000000000000..ed15934c67c2
--- /dev/null
+++ b/arch/blackfin/configs/BF538-EZKIT_defconfig
@@ -0,0 +1,1368 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.28-rc2
4#
5# CONFIG_MMU is not set
6# CONFIG_FPU is not set
7CONFIG_RWSEM_GENERIC_SPINLOCK=y
8# CONFIG_RWSEM_XCHGADD_ALGORITHM is not set
9CONFIG_BLACKFIN=y
10CONFIG_ZONE_DMA=y
11CONFIG_GENERIC_FIND_NEXT_BIT=y
12CONFIG_GENERIC_HWEIGHT=y
13CONFIG_GENERIC_HARDIRQS=y
14CONFIG_GENERIC_IRQ_PROBE=y
15CONFIG_GENERIC_GPIO=y
16CONFIG_FORCE_MAX_ZONEORDER=14
17CONFIG_GENERIC_CALIBRATE_DELAY=y
18CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
19
20#
21# General setup
22#
23CONFIG_EXPERIMENTAL=y
24CONFIG_BROKEN_ON_SMP=y
25CONFIG_INIT_ENV_ARG_LIMIT=32
26CONFIG_LOCALVERSION=""
27CONFIG_LOCALVERSION_AUTO=y
28CONFIG_SYSVIPC=y
29CONFIG_SYSVIPC_SYSCTL=y
30# CONFIG_POSIX_MQUEUE is not set
31# CONFIG_BSD_PROCESS_ACCT is not set
32# CONFIG_TASKSTATS is not set
33# CONFIG_AUDIT is not set
34CONFIG_IKCONFIG=y
35CONFIG_IKCONFIG_PROC=y
36CONFIG_LOG_BUF_SHIFT=14
37# CONFIG_CGROUPS is not set
38# CONFIG_GROUP_SCHED is not set
39# CONFIG_SYSFS_DEPRECATED_V2 is not set
40# CONFIG_RELAY is not set
41# CONFIG_NAMESPACES is not set
42CONFIG_BLK_DEV_INITRD=y
43CONFIG_INITRAMFS_SOURCE=""
44# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
45CONFIG_SYSCTL=y
46CONFIG_EMBEDDED=y
47CONFIG_UID16=y
48CONFIG_SYSCTL_SYSCALL=y
49CONFIG_KALLSYMS=y
50# CONFIG_KALLSYMS_ALL is not set
51# CONFIG_KALLSYMS_EXTRA_PASS is not set
52CONFIG_HOTPLUG=y
53CONFIG_PRINTK=y
54CONFIG_BUG=y
55# CONFIG_ELF_CORE is not set
56CONFIG_COMPAT_BRK=y
57CONFIG_BASE_FULL=y
58CONFIG_FUTEX=y
59CONFIG_ANON_INODES=y
60CONFIG_EPOLL=y
61CONFIG_SIGNALFD=y
62CONFIG_TIMERFD=y
63CONFIG_EVENTFD=y
64CONFIG_AIO=y
65CONFIG_VM_EVENT_COUNTERS=y
66CONFIG_SLAB=y
67# CONFIG_SLUB is not set
68# CONFIG_SLOB is not set
69# CONFIG_PROFILING is not set
70# CONFIG_MARKERS is not set
71CONFIG_HAVE_OPROFILE=y
72# CONFIG_HAVE_GENERIC_DMA_COHERENT is not set
73CONFIG_SLABINFO=y
74CONFIG_RT_MUTEXES=y
75CONFIG_TINY_SHMEM=y
76CONFIG_BASE_SMALL=0
77CONFIG_MODULES=y
78# CONFIG_MODULE_FORCE_LOAD is not set
79CONFIG_MODULE_UNLOAD=y
80# CONFIG_MODULE_FORCE_UNLOAD is not set
81# CONFIG_MODVERSIONS is not set
82# CONFIG_MODULE_SRCVERSION_ALL is not set
83CONFIG_KMOD=y
84CONFIG_BLOCK=y
85# CONFIG_LBD is not set
86# CONFIG_BLK_DEV_IO_TRACE is not set
87# CONFIG_LSF is not set
88# CONFIG_BLK_DEV_BSG is not set
89# CONFIG_BLK_DEV_INTEGRITY is not set
90
91#
92# IO Schedulers
93#
94CONFIG_IOSCHED_NOOP=y
95CONFIG_IOSCHED_AS=y
96# CONFIG_IOSCHED_DEADLINE is not set
97CONFIG_IOSCHED_CFQ=y
98CONFIG_DEFAULT_AS=y
99# CONFIG_DEFAULT_DEADLINE is not set
100# CONFIG_DEFAULT_CFQ is not set
101# CONFIG_DEFAULT_NOOP is not set
102CONFIG_DEFAULT_IOSCHED="anticipatory"
103CONFIG_CLASSIC_RCU=y
104# CONFIG_PREEMPT_NONE is not set
105CONFIG_PREEMPT_VOLUNTARY=y
106# CONFIG_PREEMPT is not set
107# CONFIG_FREEZER is not set
108
109#
110# Blackfin Processor Options
111#
112
113#
114# Processor and Board Settings
115#
116# CONFIG_BF512 is not set
117# CONFIG_BF514 is not set
118# CONFIG_BF516 is not set
119# CONFIG_BF518 is not set
120# CONFIG_BF522 is not set
121# CONFIG_BF523 is not set
122# CONFIG_BF524 is not set
123# CONFIG_BF525 is not set
124# CONFIG_BF526 is not set
125# CONFIG_BF527 is not set
126# CONFIG_BF531 is not set
127# CONFIG_BF532 is not set
128# CONFIG_BF533 is not set
129# CONFIG_BF534 is not set
130# CONFIG_BF536 is not set
131# CONFIG_BF537 is not set
132CONFIG_BF538=y
133# CONFIG_BF539 is not set
134# CONFIG_BF542 is not set
135# CONFIG_BF544 is not set
136# CONFIG_BF547 is not set
137# CONFIG_BF548 is not set
138# CONFIG_BF549 is not set
139# CONFIG_BF561 is not set
140CONFIG_BF_REV_MIN=4
141CONFIG_BF_REV_MAX=5
142# CONFIG_BF_REV_0_0 is not set
143# CONFIG_BF_REV_0_1 is not set
144# CONFIG_BF_REV_0_2 is not set
145# CONFIG_BF_REV_0_3 is not set
146CONFIG_BF_REV_0_4=y
147# CONFIG_BF_REV_0_5 is not set
148# CONFIG_BF_REV_0_6 is not set
149# CONFIG_BF_REV_ANY is not set
150# CONFIG_BF_REV_NONE is not set
151CONFIG_MEM_MT48LC32M8A2_75=y
152CONFIG_IRQ_PLL_WAKEUP=7
153CONFIG_IRQ_DMA0_ERROR=7
154CONFIG_IRQ_PPI_ERROR=7
155CONFIG_IRQ_SPORT0_ERROR=7
156CONFIG_IRQ_SPORT1_ERROR=7
157CONFIG_IRQ_UART0_ERROR=7
158CONFIG_IRQ_UART1_ERROR=7
159CONFIG_IRQ_RTC=8
160CONFIG_IRQ_PPI=8
161CONFIG_IRQ_SPORT0_RX=9
162CONFIG_IRQ_SPORT0_TX=9
163CONFIG_IRQ_SPORT1_RX=9
164CONFIG_IRQ_SPORT1_TX=9
165CONFIG_IRQ_SPI0=10
166CONFIG_IRQ_UART0_RX=10
167CONFIG_IRQ_UART0_TX=10
168CONFIG_IRQ_UART1_RX=10
169CONFIG_IRQ_UART1_TX=10
170CONFIG_IRQ_TIMER0=12
171CONFIG_IRQ_TIMER1=12
172CONFIG_IRQ_TIMER2=12
173CONFIG_IRQ_WATCH=13
174CONFIG_IRQ_PORTF_INTA=12
175CONFIG_IRQ_PORTF_INTB=12
176CONFIG_IRQ_SPI0_ERROR=7
177CONFIG_IRQ_SPI1_ERROR=7
178CONFIG_IRQ_DMA1_ERROR=7
179CONFIG_IRQ_CAN_RX=11
180CONFIG_IRQ_CAN_TX=11
181CONFIG_BFIN538_EZKIT=y
182
183#
184# BF538 Specific Configuration
185#
186
187#
188# Interrupt Priority Assignment
189#
190
191#
192# Priority
193#
194CONFIG_IRQ_MEM0_DMA0=13
195CONFIG_IRQ_MEM0_DMA1=13
196CONFIG_IRQ_SPORT2_ERROR=7
197CONFIG_IRQ_SPORT3_ERROR=7
198CONFIG_IRQ_SPI2_ERROR=7
199CONFIG_IRQ_UART2_ERROR=7
200CONFIG_IRQ_CAN_ERROR=7
201CONFIG_IRQ_SPORT2_RX=9
202CONFIG_IRQ_SPORT2_TX=9
203CONFIG_IRQ_SPORT3_RX=9
204CONFIG_IRQ_SPORT3_TX=9
205CONFIG_IRQ_SPI1=10
206CONFIG_IRQ_SPI2=10
207CONFIG_IRQ_UART2_RX=10
208CONFIG_IRQ_UART2_TX=10
209CONFIG_IRQ_TWI0=11
210CONFIG_IRQ_TWI1=11
211CONFIG_IRQ_MEM1_DMA0=13
212CONFIG_IRQ_MEM1_DMA1=13
213
214#
215# Board customizations
216#
217# CONFIG_CMDLINE_BOOL is not set
218CONFIG_BOOT_LOAD=0x1000
219
220#
221# Clock/PLL Setup
222#
223CONFIG_CLKIN_HZ=25000000
224# CONFIG_BFIN_KERNEL_CLOCK is not set
225CONFIG_MAX_VCO_HZ=533333333
226CONFIG_MIN_VCO_HZ=50000000
227CONFIG_MAX_SCLK_HZ=133333333
228CONFIG_MIN_SCLK_HZ=27000000
229
230#
231# Kernel Timer/Scheduler
232#
233# CONFIG_HZ_100 is not set
234CONFIG_HZ_250=y
235# CONFIG_HZ_300 is not set
236# CONFIG_HZ_1000 is not set
237CONFIG_HZ=250
238CONFIG_SCHED_HRTICK=y
239CONFIG_GENERIC_TIME=y
240CONFIG_GENERIC_CLOCKEVENTS=y
241# CONFIG_CYCLES_CLOCKSOURCE is not set
242CONFIG_TICK_ONESHOT=y
243# CONFIG_NO_HZ is not set
244CONFIG_HIGH_RES_TIMERS=y
245CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
246
247#
248# Misc
249#
250CONFIG_BFIN_SCRATCH_REG_RETN=y
251# CONFIG_BFIN_SCRATCH_REG_RETE is not set
252# CONFIG_BFIN_SCRATCH_REG_CYCLES is not set
253
254#
255# Blackfin Kernel Optimizations
256#
257
258#
259# Memory Optimizations
260#
261CONFIG_I_ENTRY_L1=y
262CONFIG_EXCPT_IRQ_SYSC_L1=y
263CONFIG_DO_IRQ_L1=y
264CONFIG_CORE_TIMER_IRQ_L1=y
265CONFIG_IDLE_L1=y
266CONFIG_SCHEDULE_L1=y
267CONFIG_ARITHMETIC_OPS_L1=y
268CONFIG_ACCESS_OK_L1=y
269CONFIG_MEMSET_L1=y
270CONFIG_MEMCPY_L1=y
271CONFIG_SYS_BFIN_SPINLOCK_L1=y
272# CONFIG_IP_CHECKSUM_L1 is not set
273CONFIG_CACHELINE_ALIGNED_L1=y
274# CONFIG_SYSCALL_TAB_L1 is not set
275# CONFIG_CPLB_SWITCH_TAB_L1 is not set
276CONFIG_APP_STACK_L1=y
277
278#
279# Speed Optimizations
280#
281CONFIG_BFIN_INS_LOWOVERHEAD=y
282CONFIG_RAMKERNEL=y
283# CONFIG_ROMKERNEL is not set
284CONFIG_SELECT_MEMORY_MODEL=y
285CONFIG_FLATMEM_MANUAL=y
286# CONFIG_DISCONTIGMEM_MANUAL is not set
287# CONFIG_SPARSEMEM_MANUAL is not set
288CONFIG_FLATMEM=y
289CONFIG_FLAT_NODE_MEM_MAP=y
290CONFIG_PAGEFLAGS_EXTENDED=y
291CONFIG_SPLIT_PTLOCK_CPUS=4
292# CONFIG_RESOURCES_64BIT is not set
293# CONFIG_PHYS_ADDR_T_64BIT is not set
294CONFIG_ZONE_DMA_FLAG=1
295CONFIG_VIRT_TO_BUS=y
296CONFIG_BFIN_GPTIMERS=y
297# CONFIG_DMA_UNCACHED_4M is not set
298# CONFIG_DMA_UNCACHED_2M is not set
299CONFIG_DMA_UNCACHED_1M=y
300# CONFIG_DMA_UNCACHED_NONE is not set
301
302#
303# Cache Support
304#
305CONFIG_BFIN_ICACHE=y
306CONFIG_BFIN_DCACHE=y
307# CONFIG_BFIN_DCACHE_BANKA is not set
308# CONFIG_BFIN_ICACHE_LOCK is not set
309# CONFIG_BFIN_WB is not set
310CONFIG_BFIN_WT=y
311# CONFIG_MPU is not set
312
313#
314# Asynchonous Memory Configuration
315#
316
317#
318# EBIU_AMGCTL Global Control
319#
320CONFIG_C_AMCKEN=y
321CONFIG_C_CDPRIO=y
322# CONFIG_C_AMBEN is not set
323# CONFIG_C_AMBEN_B0 is not set
324# CONFIG_C_AMBEN_B0_B1 is not set
325# CONFIG_C_AMBEN_B0_B1_B2 is not set
326CONFIG_C_AMBEN_ALL=y
327
328#
329# EBIU_AMBCTL Control
330#
331CONFIG_BANK_0=0x7BB0
332CONFIG_BANK_1=0x7BB0
333CONFIG_BANK_2=0x7BB0
334CONFIG_BANK_3=0x99B2
335
336#
337# Bus options (PCI, PCMCIA, EISA, MCA, ISA)
338#
339# CONFIG_ARCH_SUPPORTS_MSI is not set
340# CONFIG_PCCARD is not set
341
342#
343# Executable file formats
344#
345CONFIG_BINFMT_ELF_FDPIC=y
346CONFIG_BINFMT_FLAT=y
347CONFIG_BINFMT_ZFLAT=y
348# CONFIG_BINFMT_SHARED_FLAT is not set
349# CONFIG_HAVE_AOUT is not set
350# CONFIG_BINFMT_MISC is not set
351
352#
353# Power management options
354#
355# CONFIG_PM is not set
356CONFIG_ARCH_SUSPEND_POSSIBLE=y
357# CONFIG_PM_WAKEUP_BY_GPIO is not set
358
359#
360# CPU Frequency scaling
361#
362# CONFIG_CPU_FREQ is not set
363CONFIG_NET=y
364
365#
366# Networking options
367#
368CONFIG_PACKET=y
369# CONFIG_PACKET_MMAP is not set
370CONFIG_UNIX=y
371CONFIG_XFRM=y
372# CONFIG_XFRM_USER is not set
373# CONFIG_XFRM_SUB_POLICY is not set
374# CONFIG_XFRM_MIGRATE is not set
375# CONFIG_XFRM_STATISTICS is not set
376# CONFIG_NET_KEY is not set
377CONFIG_INET=y
378# CONFIG_IP_MULTICAST is not set
379# CONFIG_IP_ADVANCED_ROUTER is not set
380CONFIG_IP_FIB_HASH=y
381CONFIG_IP_PNP=y
382# CONFIG_IP_PNP_DHCP is not set
383# CONFIG_IP_PNP_BOOTP is not set
384# CONFIG_IP_PNP_RARP is not set
385# CONFIG_NET_IPIP is not set
386# CONFIG_NET_IPGRE is not set
387# CONFIG_ARPD is not set
388CONFIG_SYN_COOKIES=y
389# CONFIG_INET_AH is not set
390# CONFIG_INET_ESP is not set
391# CONFIG_INET_IPCOMP is not set
392# CONFIG_INET_XFRM_TUNNEL is not set
393# CONFIG_INET_TUNNEL is not set
394CONFIG_INET_XFRM_MODE_TRANSPORT=y
395CONFIG_INET_XFRM_MODE_TUNNEL=y
396CONFIG_INET_XFRM_MODE_BEET=y
397# CONFIG_INET_LRO is not set
398CONFIG_INET_DIAG=y
399CONFIG_INET_TCP_DIAG=y
400# CONFIG_TCP_CONG_ADVANCED is not set
401CONFIG_TCP_CONG_CUBIC=y
402CONFIG_DEFAULT_TCP_CONG="cubic"
403# CONFIG_TCP_MD5SIG is not set
404# CONFIG_IPV6 is not set
405# CONFIG_NETLABEL is not set
406# CONFIG_NETWORK_SECMARK is not set
407# CONFIG_NETFILTER is not set
408# CONFIG_IP_DCCP is not set
409# CONFIG_IP_SCTP is not set
410# CONFIG_TIPC is not set
411# CONFIG_ATM is not set
412# CONFIG_BRIDGE is not set
413# CONFIG_NET_DSA is not set
414# CONFIG_VLAN_8021Q is not set
415# CONFIG_DECNET is not set
416# CONFIG_LLC2 is not set
417# CONFIG_IPX is not set
418# CONFIG_ATALK is not set
419# CONFIG_X25 is not set
420# CONFIG_LAPB is not set
421# CONFIG_ECONET is not set
422# CONFIG_WAN_ROUTER is not set
423# CONFIG_NET_SCHED is not set
424
425#
426# Network testing
427#
428# CONFIG_NET_PKTGEN is not set
429# CONFIG_HAMRADIO is not set
430# CONFIG_CAN is not set
431CONFIG_IRDA=m
432
433#
434# IrDA protocols
435#
436CONFIG_IRLAN=m
437CONFIG_IRCOMM=m
438# CONFIG_IRDA_ULTRA is not set
439
440#
441# IrDA options
442#
443CONFIG_IRDA_CACHE_LAST_LSAP=y
444# CONFIG_IRDA_FAST_RR is not set
445# CONFIG_IRDA_DEBUG is not set
446
447#
448# Infrared-port device drivers
449#
450
451#
452# SIR device drivers
453#
454CONFIG_IRTTY_SIR=m
455CONFIG_BFIN_SIR=m
456CONFIG_SIR_BFIN_DMA=y
457# CONFIG_SIR_BFIN_PIO is not set
458
459#
460# Dongle support
461#
462# CONFIG_DONGLE is not set
463
464#
465# FIR device drivers
466#
467# CONFIG_BT is not set
468# CONFIG_AF_RXRPC is not set
469# CONFIG_PHONET is not set
470CONFIG_WIRELESS=y
471# CONFIG_CFG80211 is not set
472CONFIG_WIRELESS_OLD_REGULATORY=y
473# CONFIG_WIRELESS_EXT is not set
474# CONFIG_MAC80211 is not set
475# CONFIG_IEEE80211 is not set
476# CONFIG_RFKILL is not set
477# CONFIG_NET_9P is not set
478
479#
480# Device Drivers
481#
482
483#
484# Generic Driver Options
485#
486CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
487CONFIG_STANDALONE=y
488CONFIG_PREVENT_FIRMWARE_BUILD=y
489# CONFIG_FW_LOADER is not set
490# CONFIG_DEBUG_DRIVER is not set
491# CONFIG_DEBUG_DEVRES is not set
492# CONFIG_SYS_HYPERVISOR is not set
493# CONFIG_CONNECTOR is not set
494CONFIG_MTD=y
495# CONFIG_MTD_DEBUG is not set
496# CONFIG_MTD_CONCAT is not set
497CONFIG_MTD_PARTITIONS=y
498# CONFIG_MTD_REDBOOT_PARTS is not set
499CONFIG_MTD_CMDLINE_PARTS=y
500# CONFIG_MTD_AR7_PARTS is not set
501
502#
503# User Modules And Translation Layers
504#
505CONFIG_MTD_CHAR=m
506CONFIG_MTD_BLKDEVS=y
507CONFIG_MTD_BLOCK=y
508# CONFIG_FTL is not set
509# CONFIG_NFTL is not set
510# CONFIG_INFTL is not set
511# CONFIG_RFD_FTL is not set
512# CONFIG_SSFDC is not set
513# CONFIG_MTD_OOPS is not set
514
515#
516# RAM/ROM/Flash chip drivers
517#
518CONFIG_MTD_CFI=m
519# CONFIG_MTD_JEDECPROBE is not set
520CONFIG_MTD_GEN_PROBE=m
521# CONFIG_MTD_CFI_ADV_OPTIONS is not set
522CONFIG_MTD_MAP_BANK_WIDTH_1=y
523CONFIG_MTD_MAP_BANK_WIDTH_2=y
524CONFIG_MTD_MAP_BANK_WIDTH_4=y
525# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
526# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
527# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
528CONFIG_MTD_CFI_I1=y
529CONFIG_MTD_CFI_I2=y
530# CONFIG_MTD_CFI_I4 is not set
531# CONFIG_MTD_CFI_I8 is not set
532# CONFIG_MTD_CFI_INTELEXT is not set
533CONFIG_MTD_CFI_AMDSTD=m
534# CONFIG_MTD_CFI_STAA is not set
535CONFIG_MTD_CFI_UTIL=m
536CONFIG_MTD_RAM=y
537CONFIG_MTD_ROM=m
538# CONFIG_MTD_ABSENT is not set
539
540#
541# Mapping drivers for chip access
542#
543# CONFIG_MTD_COMPLEX_MAPPINGS is not set
544CONFIG_MTD_PHYSMAP=m
545CONFIG_MTD_PHYSMAP_START=0x20000000
546CONFIG_MTD_PHYSMAP_LEN=0x0
547CONFIG_MTD_PHYSMAP_BANKWIDTH=2
548# CONFIG_MTD_UCLINUX is not set
549# CONFIG_MTD_PLATRAM is not set
550
551#
552# Self-contained MTD device drivers
553#
554# CONFIG_MTD_DATAFLASH is not set
555# CONFIG_MTD_M25P80 is not set
556# CONFIG_MTD_SLRAM is not set
557# CONFIG_MTD_PHRAM is not set
558# CONFIG_MTD_MTDRAM is not set
559# CONFIG_MTD_BLOCK2MTD is not set
560
561#
562# Disk-On-Chip Device Drivers
563#
564# CONFIG_MTD_DOC2000 is not set
565# CONFIG_MTD_DOC2001 is not set
566# CONFIG_MTD_DOC2001PLUS is not set
567CONFIG_MTD_NAND=m
568# CONFIG_MTD_NAND_VERIFY_WRITE is not set
569# CONFIG_MTD_NAND_ECC_SMC is not set
570# CONFIG_MTD_NAND_MUSEUM_IDS is not set
571CONFIG_MTD_NAND_BFIN=m
572CONFIG_BFIN_NAND_BASE=0x20212000
573CONFIG_BFIN_NAND_CLE=2
574CONFIG_BFIN_NAND_ALE=1
575CONFIG_BFIN_NAND_READY=3
576CONFIG_MTD_NAND_IDS=m
577# CONFIG_MTD_NAND_DISKONCHIP is not set
578# CONFIG_MTD_NAND_NANDSIM is not set
579# CONFIG_MTD_NAND_PLATFORM is not set
580# CONFIG_MTD_ONENAND is not set
581
582#
583# UBI - Unsorted block images
584#
585# CONFIG_MTD_UBI is not set
586# CONFIG_PARPORT is not set
587CONFIG_BLK_DEV=y
588# CONFIG_BLK_DEV_COW_COMMON is not set
589# CONFIG_BLK_DEV_LOOP is not set
590# CONFIG_BLK_DEV_NBD is not set
591CONFIG_BLK_DEV_RAM=y
592CONFIG_BLK_DEV_RAM_COUNT=16
593CONFIG_BLK_DEV_RAM_SIZE=4096
594# CONFIG_BLK_DEV_XIP is not set
595# CONFIG_CDROM_PKTCDVD is not set
596# CONFIG_ATA_OVER_ETH is not set
597# CONFIG_BLK_DEV_HD is not set
598# CONFIG_MISC_DEVICES is not set
599CONFIG_HAVE_IDE=y
600# CONFIG_IDE is not set
601
602#
603# SCSI device support
604#
605# CONFIG_RAID_ATTRS is not set
606# CONFIG_SCSI is not set
607# CONFIG_SCSI_DMA is not set
608# CONFIG_SCSI_NETLINK is not set
609# CONFIG_ATA is not set
610# CONFIG_MD is not set
611CONFIG_NETDEVICES=y
612# CONFIG_DUMMY is not set
613# CONFIG_BONDING is not set
614# CONFIG_MACVLAN is not set
615# CONFIG_EQUALIZER is not set
616# CONFIG_TUN is not set
617# CONFIG_VETH is not set
618CONFIG_PHYLIB=y
619
620#
621# MII PHY device drivers
622#
623# CONFIG_MARVELL_PHY is not set
624# CONFIG_DAVICOM_PHY is not set
625# CONFIG_QSEMI_PHY is not set
626# CONFIG_LXT_PHY is not set
627# CONFIG_CICADA_PHY is not set
628# CONFIG_VITESSE_PHY is not set
629CONFIG_SMSC_PHY=y
630# CONFIG_BROADCOM_PHY is not set
631# CONFIG_ICPLUS_PHY is not set
632# CONFIG_REALTEK_PHY is not set
633# CONFIG_FIXED_PHY is not set
634# CONFIG_MDIO_BITBANG is not set
635CONFIG_NET_ETHERNET=y
636CONFIG_MII=y
637CONFIG_SMC91X=y
638# CONFIG_SMSC911X is not set
639# CONFIG_DM9000 is not set
640# CONFIG_ENC28J60 is not set
641# CONFIG_IBM_NEW_EMAC_ZMII is not set
642# CONFIG_IBM_NEW_EMAC_RGMII is not set
643# CONFIG_IBM_NEW_EMAC_TAH is not set
644# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
645# CONFIG_IBM_NEW_EMAC_NO_FLOW_CTRL is not set
646# CONFIG_IBM_NEW_EMAC_MAL_CLR_ICINTSTAT is not set
647# CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set
648# CONFIG_NETDEV_1000 is not set
649# CONFIG_NETDEV_10000 is not set
650
651#
652# Wireless LAN
653#
654# CONFIG_WLAN_PRE80211 is not set
655# CONFIG_WLAN_80211 is not set
656# CONFIG_IWLWIFI_LEDS is not set
657# CONFIG_WAN is not set
658# CONFIG_PPP is not set
659# CONFIG_SLIP is not set
660# CONFIG_NETCONSOLE is not set
661# CONFIG_NETPOLL is not set
662# CONFIG_NET_POLL_CONTROLLER is not set
663# CONFIG_ISDN is not set
664# CONFIG_PHONE is not set
665
666#
667# Input device support
668#
669CONFIG_INPUT=y
670# CONFIG_INPUT_FF_MEMLESS is not set
671# CONFIG_INPUT_POLLDEV is not set
672
673#
674# Userland interfaces
675#
676# CONFIG_INPUT_MOUSEDEV is not set
677# CONFIG_INPUT_JOYDEV is not set
678CONFIG_INPUT_EVDEV=m
679# CONFIG_INPUT_EVBUG is not set
680
681#
682# Input Device Drivers
683#
684# CONFIG_INPUT_KEYBOARD is not set
685# CONFIG_INPUT_MOUSE is not set
686# CONFIG_INPUT_JOYSTICK is not set
687# CONFIG_INPUT_TABLET is not set
688CONFIG_INPUT_TOUCHSCREEN=y
689# CONFIG_TOUCHSCREEN_ADS7846 is not set
690# CONFIG_TOUCHSCREEN_AD7877 is not set
691# CONFIG_TOUCHSCREEN_AD7879_I2C is not set
692CONFIG_TOUCHSCREEN_AD7879_SPI=y
693CONFIG_TOUCHSCREEN_AD7879=m
694# CONFIG_TOUCHSCREEN_FUJITSU is not set
695# CONFIG_TOUCHSCREEN_GUNZE is not set
696# CONFIG_TOUCHSCREEN_ELO is not set
697# CONFIG_TOUCHSCREEN_MTOUCH is not set
698# CONFIG_TOUCHSCREEN_INEXIO is not set
699# CONFIG_TOUCHSCREEN_MK712 is not set
700# CONFIG_TOUCHSCREEN_PENMOUNT is not set
701# CONFIG_TOUCHSCREEN_TOUCHRIGHT is not set
702# CONFIG_TOUCHSCREEN_TOUCHWIN is not set
703# CONFIG_TOUCHSCREEN_TOUCHIT213 is not set
704CONFIG_INPUT_MISC=y
705# CONFIG_INPUT_UINPUT is not set
706# CONFIG_CONFIG_INPUT_PCF8574 is not set
707
708#
709# Hardware I/O ports
710#
711# CONFIG_SERIO is not set
712# CONFIG_GAMEPORT is not set
713
714#
715# Character devices
716#
717# CONFIG_AD9960 is not set
718# CONFIG_SPI_ADC_BF533 is not set
719# CONFIG_BF5xx_PPIFCD is not set
720# CONFIG_BFIN_SIMPLE_TIMER is not set
721# CONFIG_BF5xx_PPI is not set
722CONFIG_BFIN_SPORT=y
723# CONFIG_BFIN_TIMER_LATENCY is not set
724# CONFIG_TWI_LCD is not set
725CONFIG_BFIN_DMA_INTERFACE=m
726CONFIG_SIMPLE_GPIO=m
727# CONFIG_VT is not set
728# CONFIG_DEVKMEM is not set
729# CONFIG_BFIN_JTAG_COMM is not set
730# CONFIG_SERIAL_NONSTANDARD is not set
731
732#
733# Serial drivers
734#
735# CONFIG_SERIAL_8250 is not set
736
737#
738# Non-8250 serial port support
739#
740CONFIG_SERIAL_BFIN=y
741CONFIG_SERIAL_BFIN_CONSOLE=y
742CONFIG_SERIAL_BFIN_DMA=y
743# CONFIG_SERIAL_BFIN_PIO is not set
744CONFIG_SERIAL_BFIN_UART0=y
745# CONFIG_BFIN_UART0_CTSRTS is not set
746CONFIG_SERIAL_BFIN_UART1=y
747# CONFIG_BFIN_UART1_CTSRTS is not set
748CONFIG_SERIAL_BFIN_UART2=y
749# CONFIG_BFIN_UART2_CTSRTS is not set
750CONFIG_SERIAL_CORE=y
751CONFIG_SERIAL_CORE_CONSOLE=y
752# CONFIG_SERIAL_BFIN_SPORT is not set
753CONFIG_UNIX98_PTYS=y
754# CONFIG_LEGACY_PTYS is not set
755
756#
757# CAN, the car bus and industrial fieldbus
758#
759# CONFIG_CAN4LINUX is not set
760# CONFIG_IPMI_HANDLER is not set
761# CONFIG_HW_RANDOM is not set
762# CONFIG_R3964 is not set
763# CONFIG_RAW_DRIVER is not set
764# CONFIG_TCG_TPM is not set
765CONFIG_I2C=y
766CONFIG_I2C_BOARDINFO=y
767# CONFIG_I2C_CHARDEV is not set
768CONFIG_I2C_HELPER_AUTO=y
769
770#
771# I2C Hardware Bus support
772#
773
774#
775# I2C system bus drivers (mostly embedded / system-on-chip)
776#
777CONFIG_I2C_BLACKFIN_TWI=y
778CONFIG_I2C_BLACKFIN_TWI_CLK_KHZ=100
779# CONFIG_I2C_GPIO is not set
780# CONFIG_I2C_OCORES is not set
781# CONFIG_I2C_SIMTEC is not set
782
783#
784# External I2C/SMBus adapter drivers
785#
786# CONFIG_I2C_PARPORT_LIGHT is not set
787# CONFIG_I2C_TAOS_EVM is not set
788
789#
790# Other I2C/SMBus bus drivers
791#
792# CONFIG_I2C_PCA_PLATFORM is not set
793# CONFIG_I2C_STUB is not set
794
795#
796# Miscellaneous I2C Chip support
797#
798# CONFIG_DS1682 is not set
799# CONFIG_AT24 is not set
800# CONFIG_SENSORS_AD5252 is not set
801# CONFIG_SENSORS_EEPROM is not set
802# CONFIG_SENSORS_PCF8574 is not set
803# CONFIG_PCF8575 is not set
804# CONFIG_SENSORS_PCA9539 is not set
805# CONFIG_SENSORS_PCF8591 is not set
806# CONFIG_SENSORS_MAX6875 is not set
807# CONFIG_SENSORS_TSL2550 is not set
808# CONFIG_I2C_DEBUG_CORE is not set
809# CONFIG_I2C_DEBUG_ALGO is not set
810# CONFIG_I2C_DEBUG_BUS is not set
811# CONFIG_I2C_DEBUG_CHIP is not set
812CONFIG_SPI=y
813# CONFIG_SPI_DEBUG is not set
814CONFIG_SPI_MASTER=y
815
816#
817# SPI Master Controller Drivers
818#
819CONFIG_SPI_BFIN=y
820# CONFIG_SPI_BFIN_LOCK is not set
821# CONFIG_SPI_BITBANG is not set
822
823#
824# SPI Protocol Masters
825#
826# CONFIG_SPI_AT25 is not set
827# CONFIG_SPI_SPIDEV is not set
828# CONFIG_SPI_TLE62X0 is not set
829CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y
830# CONFIG_GPIOLIB is not set
831# CONFIG_W1 is not set
832# CONFIG_POWER_SUPPLY is not set
833CONFIG_HWMON=y
834# CONFIG_HWMON_VID is not set
835# CONFIG_SENSORS_AD7414 is not set
836# CONFIG_SENSORS_AD7418 is not set
837# CONFIG_SENSORS_ADCXX is not set
838# CONFIG_SENSORS_ADM1021 is not set
839# CONFIG_SENSORS_ADM1025 is not set
840# CONFIG_SENSORS_ADM1026 is not set
841# CONFIG_SENSORS_ADM1029 is not set
842# CONFIG_SENSORS_ADM1031 is not set
843# CONFIG_SENSORS_ADM9240 is not set
844# CONFIG_SENSORS_ADT7470 is not set
845# CONFIG_SENSORS_ADT7473 is not set
846# CONFIG_SENSORS_ATXP1 is not set
847# CONFIG_SENSORS_DS1621 is not set
848# CONFIG_SENSORS_F71805F is not set
849# CONFIG_SENSORS_F71882FG is not set
850# CONFIG_SENSORS_F75375S is not set
851# CONFIG_SENSORS_GL518SM is not set
852# CONFIG_SENSORS_GL520SM is not set
853# CONFIG_SENSORS_IT87 is not set
854# CONFIG_SENSORS_LM63 is not set
855# CONFIG_SENSORS_LM70 is not set
856# CONFIG_SENSORS_LM75 is not set
857# CONFIG_SENSORS_LM77 is not set
858# CONFIG_SENSORS_LM78 is not set
859# CONFIG_SENSORS_LM80 is not set
860# CONFIG_SENSORS_LM83 is not set
861# CONFIG_SENSORS_LM85 is not set
862# CONFIG_SENSORS_LM87 is not set
863# CONFIG_SENSORS_LM90 is not set
864# CONFIG_SENSORS_LM92 is not set
865# CONFIG_SENSORS_LM93 is not set
866# CONFIG_SENSORS_MAX1111 is not set
867# CONFIG_SENSORS_MAX1619 is not set
868# CONFIG_SENSORS_MAX6650 is not set
869# CONFIG_SENSORS_PC87360 is not set
870# CONFIG_SENSORS_PC87427 is not set
871# CONFIG_SENSORS_DME1737 is not set
872# CONFIG_SENSORS_SMSC47M1 is not set
873# CONFIG_SENSORS_SMSC47M192 is not set
874# CONFIG_SENSORS_SMSC47B397 is not set
875# CONFIG_SENSORS_ADS7828 is not set
876# CONFIG_SENSORS_THMC50 is not set
877# CONFIG_SENSORS_VT1211 is not set
878# CONFIG_SENSORS_W83781D is not set
879# CONFIG_SENSORS_W83791D is not set
880# CONFIG_SENSORS_W83792D is not set
881# CONFIG_SENSORS_W83793 is not set
882# CONFIG_SENSORS_W83L785TS is not set
883# CONFIG_SENSORS_W83L786NG is not set
884# CONFIG_SENSORS_W83627HF is not set
885# CONFIG_SENSORS_W83627EHF is not set
886# CONFIG_HWMON_DEBUG_CHIP is not set
887# CONFIG_THERMAL is not set
888# CONFIG_THERMAL_HWMON is not set
889CONFIG_WATCHDOG=y
890# CONFIG_WATCHDOG_NOWAYOUT is not set
891
892#
893# Watchdog Device Drivers
894#
895# CONFIG_SOFT_WATCHDOG is not set
896CONFIG_BFIN_WDT=y
897
898#
899# Multifunction device drivers
900#
901# CONFIG_MFD_CORE is not set
902# CONFIG_MFD_SM501 is not set
903# CONFIG_HTC_PASIC3 is not set
904# CONFIG_MFD_TMIO is not set
905# CONFIG_MFD_WM8400 is not set
906# CONFIG_MFD_WM8350_I2C is not set
907
908#
909# Multimedia devices
910#
911
912#
913# Multimedia core support
914#
915# CONFIG_VIDEO_DEV is not set
916# CONFIG_DVB_CORE is not set
917# CONFIG_VIDEO_MEDIA is not set
918
919#
920# Multimedia drivers
921#
922# CONFIG_DAB is not set
923
924#
925# Graphics support
926#
927# CONFIG_VGASTATE is not set
928# CONFIG_VIDEO_OUTPUT_CONTROL is not set
929CONFIG_FB=m
930# CONFIG_FIRMWARE_EDID is not set
931# CONFIG_FB_DDC is not set
932# CONFIG_FB_BOOT_VESA_SUPPORT is not set
933CONFIG_FB_CFB_FILLRECT=m
934CONFIG_FB_CFB_COPYAREA=m
935CONFIG_FB_CFB_IMAGEBLIT=m
936# CONFIG_FB_CFB_REV_PIXELS_IN_BYTE is not set
937# CONFIG_FB_SYS_FILLRECT is not set
938# CONFIG_FB_SYS_COPYAREA is not set
939# CONFIG_FB_SYS_IMAGEBLIT is not set
940# CONFIG_FB_FOREIGN_ENDIAN is not set
941# CONFIG_FB_SYS_FOPS is not set
942# CONFIG_FB_SVGALIB is not set
943# CONFIG_FB_MACMODES is not set
944# CONFIG_FB_BACKLIGHT is not set
945# CONFIG_FB_MODE_HELPERS is not set
946# CONFIG_FB_TILEBLITTING is not set
947
948#
949# Frame buffer hardware drivers
950#
951# CONFIG_FB_BFIN_T350MCQB is not set
952CONFIG_FB_BFIN_LQ035Q1=m
953# CONFIG_FB_BFIN_7393 is not set
954# CONFIG_FB_S1D13XXX is not set
955# CONFIG_FB_VIRTUAL is not set
956# CONFIG_FB_METRONOME is not set
957# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
958
959#
960# Display device support
961#
962# CONFIG_DISPLAY_SUPPORT is not set
963# CONFIG_LOGO is not set
964# CONFIG_SOUND is not set
965CONFIG_HID_SUPPORT=y
966CONFIG_HID=y
967# CONFIG_HID_DEBUG is not set
968# CONFIG_HIDRAW is not set
969# CONFIG_HID_PID is not set
970
971#
972# Special HID drivers
973#
974CONFIG_HID_COMPAT=y
975# CONFIG_USB_SUPPORT is not set
976# CONFIG_MMC is not set
977# CONFIG_MEMSTICK is not set
978# CONFIG_NEW_LEDS is not set
979# CONFIG_ACCESSIBILITY is not set
980CONFIG_RTC_LIB=y
981CONFIG_RTC_CLASS=y
982CONFIG_RTC_HCTOSYS=y
983CONFIG_RTC_HCTOSYS_DEVICE="rtc0"
984# CONFIG_RTC_DEBUG is not set
985
986#
987# RTC interfaces
988#
989CONFIG_RTC_INTF_SYSFS=y
990CONFIG_RTC_INTF_PROC=y
991CONFIG_RTC_INTF_DEV=y
992# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set
993# CONFIG_RTC_DRV_TEST is not set
994
995#
996# I2C RTC drivers
997#
998# CONFIG_RTC_DRV_DS1307 is not set
999# CONFIG_RTC_DRV_DS1374 is not set
1000# CONFIG_RTC_DRV_DS1672 is not set
1001# CONFIG_RTC_DRV_MAX6900 is not set
1002# CONFIG_RTC_DRV_RS5C372 is not set
1003# CONFIG_RTC_DRV_ISL1208 is not set
1004# CONFIG_RTC_DRV_X1205 is not set
1005# CONFIG_RTC_DRV_PCF8563 is not set
1006# CONFIG_RTC_DRV_PCF8583 is not set
1007# CONFIG_RTC_DRV_M41T80 is not set
1008# CONFIG_RTC_DRV_S35390A is not set
1009# CONFIG_RTC_DRV_FM3130 is not set
1010
1011#
1012# SPI RTC drivers
1013#
1014# CONFIG_RTC_DRV_M41T94 is not set
1015# CONFIG_RTC_DRV_DS1305 is not set
1016# CONFIG_RTC_DRV_MAX6902 is not set
1017# CONFIG_RTC_DRV_R9701 is not set
1018# CONFIG_RTC_DRV_RS5C348 is not set
1019# CONFIG_RTC_DRV_DS3234 is not set
1020
1021#
1022# Platform RTC drivers
1023#
1024# CONFIG_RTC_DRV_DS1286 is not set
1025# CONFIG_RTC_DRV_DS1511 is not set
1026# CONFIG_RTC_DRV_DS1553 is not set
1027# CONFIG_RTC_DRV_DS1742 is not set
1028# CONFIG_RTC_DRV_STK17TA8 is not set
1029# CONFIG_RTC_DRV_M48T86 is not set
1030# CONFIG_RTC_DRV_M48T35 is not set
1031# CONFIG_RTC_DRV_M48T59 is not set
1032# CONFIG_RTC_DRV_BQ4802 is not set
1033# CONFIG_RTC_DRV_V3020 is not set
1034
1035#
1036# on-CPU RTC drivers
1037#
1038CONFIG_RTC_DRV_BFIN=y
1039# CONFIG_DMADEVICES is not set
1040# CONFIG_UIO is not set
1041# CONFIG_STAGING is not set
1042
1043#
1044# File systems
1045#
1046# CONFIG_EXT2_FS is not set
1047# CONFIG_EXT3_FS is not set
1048# CONFIG_EXT4_FS is not set
1049# CONFIG_REISERFS_FS is not set
1050# CONFIG_JFS_FS is not set
1051# CONFIG_FS_POSIX_ACL is not set
1052CONFIG_FILE_LOCKING=y
1053# CONFIG_XFS_FS is not set
1054# CONFIG_OCFS2_FS is not set
1055# CONFIG_DNOTIFY is not set
1056CONFIG_INOTIFY=y
1057CONFIG_INOTIFY_USER=y
1058# CONFIG_QUOTA is not set
1059# CONFIG_AUTOFS_FS is not set
1060# CONFIG_AUTOFS4_FS is not set
1061# CONFIG_FUSE_FS is not set
1062
1063#
1064# CD-ROM/DVD Filesystems
1065#
1066# CONFIG_ISO9660_FS is not set
1067# CONFIG_UDF_FS is not set
1068
1069#
1070# DOS/FAT/NT Filesystems
1071#
1072# CONFIG_MSDOS_FS is not set
1073# CONFIG_VFAT_FS is not set
1074# CONFIG_NTFS_FS is not set
1075
1076#
1077# Pseudo filesystems
1078#
1079CONFIG_PROC_FS=y
1080CONFIG_PROC_SYSCTL=y
1081CONFIG_SYSFS=y
1082# CONFIG_TMPFS is not set
1083# CONFIG_HUGETLB_PAGE is not set
1084# CONFIG_CONFIGFS_FS is not set
1085
1086#
1087# Miscellaneous filesystems
1088#
1089# CONFIG_ADFS_FS is not set
1090# CONFIG_AFFS_FS is not set
1091# CONFIG_HFS_FS is not set
1092# CONFIG_HFSPLUS_FS is not set
1093# CONFIG_BEFS_FS is not set
1094# CONFIG_BFS_FS is not set
1095# CONFIG_EFS_FS is not set
1096CONFIG_YAFFS_FS=m
1097CONFIG_YAFFS_YAFFS1=y
1098# CONFIG_YAFFS_9BYTE_TAGS is not set
1099# CONFIG_YAFFS_DOES_ECC is not set
1100CONFIG_YAFFS_YAFFS2=y
1101CONFIG_YAFFS_AUTO_YAFFS2=y
1102# CONFIG_YAFFS_DISABLE_LAZY_LOAD is not set
1103# CONFIG_YAFFS_DISABLE_WIDE_TNODES is not set
1104# CONFIG_YAFFS_ALWAYS_CHECK_CHUNK_ERASED is not set
1105CONFIG_YAFFS_SHORT_NAMES_IN_RAM=y
1106CONFIG_JFFS2_FS=m
1107CONFIG_JFFS2_FS_DEBUG=0
1108CONFIG_JFFS2_FS_WRITEBUFFER=y
1109# CONFIG_JFFS2_FS_WBUF_VERIFY is not set
1110# CONFIG_JFFS2_SUMMARY is not set
1111# CONFIG_JFFS2_FS_XATTR is not set
1112# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set
1113CONFIG_JFFS2_ZLIB=y
1114# CONFIG_JFFS2_LZO is not set
1115CONFIG_JFFS2_RTIME=y
1116# CONFIG_JFFS2_RUBIN is not set
1117# CONFIG_CRAMFS is not set
1118# CONFIG_VXFS_FS is not set
1119# CONFIG_MINIX_FS is not set
1120# CONFIG_OMFS_FS is not set
1121# CONFIG_HPFS_FS is not set
1122# CONFIG_QNX4FS_FS is not set
1123# CONFIG_ROMFS_FS is not set
1124# CONFIG_SYSV_FS is not set
1125# CONFIG_UFS_FS is not set
1126CONFIG_NETWORK_FILESYSTEMS=y
1127CONFIG_NFS_FS=m
1128CONFIG_NFS_V3=y
1129# CONFIG_NFS_V3_ACL is not set
1130# CONFIG_NFS_V4 is not set
1131# CONFIG_NFSD is not set
1132CONFIG_LOCKD=m
1133CONFIG_LOCKD_V4=y
1134CONFIG_NFS_COMMON=y
1135CONFIG_SUNRPC=m
1136# CONFIG_SUNRPC_REGISTER_V4 is not set
1137# CONFIG_RPCSEC_GSS_KRB5 is not set
1138# CONFIG_RPCSEC_GSS_SPKM3 is not set
1139CONFIG_SMB_FS=m
1140# CONFIG_SMB_NLS_DEFAULT is not set
1141# CONFIG_CIFS is not set
1142# CONFIG_NCP_FS is not set
1143# CONFIG_CODA_FS is not set
1144# CONFIG_AFS_FS is not set
1145
1146#
1147# Partition Types
1148#
1149# CONFIG_PARTITION_ADVANCED is not set
1150CONFIG_MSDOS_PARTITION=y
1151CONFIG_NLS=m
1152CONFIG_NLS_DEFAULT="iso8859-1"
1153# CONFIG_NLS_CODEPAGE_437 is not set
1154# CONFIG_NLS_CODEPAGE_737 is not set
1155# CONFIG_NLS_CODEPAGE_775 is not set
1156# CONFIG_NLS_CODEPAGE_850 is not set
1157# CONFIG_NLS_CODEPAGE_852 is not set
1158# CONFIG_NLS_CODEPAGE_855 is not set
1159# CONFIG_NLS_CODEPAGE_857 is not set
1160# CONFIG_NLS_CODEPAGE_860 is not set
1161# CONFIG_NLS_CODEPAGE_861 is not set
1162# CONFIG_NLS_CODEPAGE_862 is not set
1163# CONFIG_NLS_CODEPAGE_863 is not set
1164# CONFIG_NLS_CODEPAGE_864 is not set
1165# CONFIG_NLS_CODEPAGE_865 is not set
1166# CONFIG_NLS_CODEPAGE_866 is not set
1167# CONFIG_NLS_CODEPAGE_869 is not set
1168# CONFIG_NLS_CODEPAGE_936 is not set
1169# CONFIG_NLS_CODEPAGE_950 is not set
1170# CONFIG_NLS_CODEPAGE_932 is not set
1171# CONFIG_NLS_CODEPAGE_949 is not set
1172# CONFIG_NLS_CODEPAGE_874 is not set
1173# CONFIG_NLS_ISO8859_8 is not set
1174# CONFIG_NLS_CODEPAGE_1250 is not set
1175# CONFIG_NLS_CODEPAGE_1251 is not set
1176# CONFIG_NLS_ASCII is not set
1177# CONFIG_NLS_ISO8859_1 is not set
1178# CONFIG_NLS_ISO8859_2 is not set
1179# CONFIG_NLS_ISO8859_3 is not set
1180# CONFIG_NLS_ISO8859_4 is not set
1181# CONFIG_NLS_ISO8859_5 is not set
1182# CONFIG_NLS_ISO8859_6 is not set
1183# CONFIG_NLS_ISO8859_7 is not set
1184# CONFIG_NLS_ISO8859_9 is not set
1185# CONFIG_NLS_ISO8859_13 is not set
1186# CONFIG_NLS_ISO8859_14 is not set
1187# CONFIG_NLS_ISO8859_15 is not set
1188# CONFIG_NLS_KOI8_R is not set
1189# CONFIG_NLS_KOI8_U is not set
1190# CONFIG_NLS_UTF8 is not set
1191# CONFIG_DLM is not set
1192
1193#
1194# Kernel hacking
1195#
1196# CONFIG_PRINTK_TIME is not set
1197CONFIG_ENABLE_WARN_DEPRECATED=y
1198CONFIG_ENABLE_MUST_CHECK=y
1199CONFIG_FRAME_WARN=1024
1200# CONFIG_MAGIC_SYSRQ is not set
1201# CONFIG_UNUSED_SYMBOLS is not set
1202CONFIG_DEBUG_FS=y
1203# CONFIG_HEADERS_CHECK is not set
1204CONFIG_DEBUG_KERNEL=y
1205# CONFIG_DEBUG_SHIRQ is not set
1206CONFIG_DETECT_SOFTLOCKUP=y
1207# CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC is not set
1208CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE=0
1209CONFIG_SCHED_DEBUG=y
1210# CONFIG_SCHEDSTATS is not set
1211# CONFIG_TIMER_STATS is not set
1212# CONFIG_DEBUG_OBJECTS is not set
1213# CONFIG_DEBUG_SLAB is not set
1214# CONFIG_DEBUG_RT_MUTEXES is not set
1215# CONFIG_RT_MUTEX_TESTER is not set
1216# CONFIG_DEBUG_SPINLOCK is not set
1217# CONFIG_DEBUG_MUTEXES is not set
1218# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
1219# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
1220# CONFIG_DEBUG_KOBJECT is not set
1221# CONFIG_DEBUG_BUGVERBOSE is not set
1222CONFIG_DEBUG_INFO=y
1223# CONFIG_DEBUG_VM is not set
1224# CONFIG_DEBUG_WRITECOUNT is not set
1225# CONFIG_DEBUG_MEMORY_INIT is not set
1226# CONFIG_DEBUG_LIST is not set
1227# CONFIG_DEBUG_SG is not set
1228# CONFIG_FRAME_POINTER is not set
1229# CONFIG_BOOT_PRINTK_DELAY is not set
1230# CONFIG_RCU_TORTURE_TEST is not set
1231# CONFIG_RCU_CPU_STALL_DETECTOR is not set
1232# CONFIG_BACKTRACE_SELF_TEST is not set
1233# CONFIG_DEBUG_BLOCK_EXT_DEVT is not set
1234# CONFIG_FAULT_INJECTION is not set
1235CONFIG_SYSCTL_SYSCALL_CHECK=y
1236# CONFIG_DYNAMIC_PRINTK_DEBUG is not set
1237# CONFIG_SAMPLES is not set
1238CONFIG_HAVE_ARCH_KGDB=y
1239# CONFIG_KGDB is not set
1240# CONFIG_DEBUG_STACKOVERFLOW is not set
1241# CONFIG_DEBUG_STACK_USAGE is not set
1242CONFIG_DEBUG_VERBOSE=y
1243CONFIG_DEBUG_MMRS=y
1244# CONFIG_DEBUG_HWERR is not set
1245# CONFIG_DEBUG_DOUBLEFAULT is not set
1246CONFIG_DEBUG_HUNT_FOR_ZERO=y
1247CONFIG_DEBUG_BFIN_HWTRACE_ON=y
1248CONFIG_DEBUG_BFIN_HWTRACE_COMPRESSION_OFF=y
1249# CONFIG_DEBUG_BFIN_HWTRACE_COMPRESSION_ONE is not set
1250# CONFIG_DEBUG_BFIN_HWTRACE_COMPRESSION_TWO is not set
1251CONFIG_DEBUG_BFIN_HWTRACE_COMPRESSION=0
1252# CONFIG_DEBUG_BFIN_HWTRACE_EXPAND is not set
1253# CONFIG_DEBUG_BFIN_NO_KERN_HWTRACE is not set
1254CONFIG_EARLY_PRINTK=y
1255CONFIG_CPLB_INFO=y
1256CONFIG_ACCESS_CHECK=y
1257
1258#
1259# Security options
1260#
1261# CONFIG_KEYS is not set
1262CONFIG_SECURITY=y
1263# CONFIG_SECURITYFS is not set
1264# CONFIG_SECURITY_NETWORK is not set
1265# CONFIG_SECURITY_FILE_CAPABILITIES is not set
1266CONFIG_SECURITY_DEFAULT_MMAP_MIN_ADDR=0
1267CONFIG_CRYPTO=y
1268
1269#
1270# Crypto core or helper
1271#
1272# CONFIG_CRYPTO_FIPS is not set
1273# CONFIG_CRYPTO_MANAGER is not set
1274# CONFIG_CRYPTO_GF128MUL is not set
1275# CONFIG_CRYPTO_NULL is not set
1276# CONFIG_CRYPTO_CRYPTD is not set
1277# CONFIG_CRYPTO_AUTHENC is not set
1278# CONFIG_CRYPTO_TEST is not set
1279
1280#
1281# Authenticated Encryption with Associated Data
1282#
1283# CONFIG_CRYPTO_CCM is not set
1284# CONFIG_CRYPTO_GCM is not set
1285# CONFIG_CRYPTO_SEQIV is not set
1286
1287#
1288# Block modes
1289#
1290# CONFIG_CRYPTO_CBC is not set
1291# CONFIG_CRYPTO_CTR is not set
1292# CONFIG_CRYPTO_CTS is not set
1293# CONFIG_CRYPTO_ECB is not set
1294# CONFIG_CRYPTO_LRW is not set
1295# CONFIG_CRYPTO_PCBC is not set
1296# CONFIG_CRYPTO_XTS is not set
1297
1298#
1299# Hash modes
1300#
1301# CONFIG_CRYPTO_HMAC is not set
1302# CONFIG_CRYPTO_XCBC is not set
1303
1304#
1305# Digest
1306#
1307# CONFIG_CRYPTO_CRC32C is not set
1308# CONFIG_CRYPTO_MD4 is not set
1309# CONFIG_CRYPTO_MD5 is not set
1310# CONFIG_CRYPTO_MICHAEL_MIC is not set
1311# CONFIG_CRYPTO_RMD128 is not set
1312# CONFIG_CRYPTO_RMD160 is not set
1313# CONFIG_CRYPTO_RMD256 is not set
1314# CONFIG_CRYPTO_RMD320 is not set
1315# CONFIG_CRYPTO_SHA1 is not set
1316# CONFIG_CRYPTO_SHA256 is not set
1317# CONFIG_CRYPTO_SHA512 is not set
1318# CONFIG_CRYPTO_TGR192 is not set
1319# CONFIG_CRYPTO_WP512 is not set
1320
1321#
1322# Ciphers
1323#
1324# CONFIG_CRYPTO_AES is not set
1325# CONFIG_CRYPTO_ANUBIS is not set
1326# CONFIG_CRYPTO_ARC4 is not set
1327# CONFIG_CRYPTO_BLOWFISH is not set
1328# CONFIG_CRYPTO_CAMELLIA is not set
1329# CONFIG_CRYPTO_CAST5 is not set
1330# CONFIG_CRYPTO_CAST6 is not set
1331# CONFIG_CRYPTO_DES is not set
1332# CONFIG_CRYPTO_FCRYPT is not set
1333# CONFIG_CRYPTO_KHAZAD is not set
1334# CONFIG_CRYPTO_SALSA20 is not set
1335# CONFIG_CRYPTO_SEED is not set
1336# CONFIG_CRYPTO_SERPENT is not set
1337# CONFIG_CRYPTO_TEA is not set
1338# CONFIG_CRYPTO_TWOFISH is not set
1339
1340#
1341# Compression
1342#
1343# CONFIG_CRYPTO_DEFLATE is not set
1344# CONFIG_CRYPTO_LZO is not set
1345
1346#
1347# Random Number Generation
1348#
1349# CONFIG_CRYPTO_ANSI_CPRNG is not set
1350CONFIG_CRYPTO_HW=y
1351
1352#
1353# Library routines
1354#
1355CONFIG_BITREVERSE=y
1356CONFIG_CRC_CCITT=m
1357# CONFIG_CRC16 is not set
1358# CONFIG_CRC_T10DIF is not set
1359# CONFIG_CRC_ITU_T is not set
1360CONFIG_CRC32=y
1361# CONFIG_CRC7 is not set
1362# CONFIG_LIBCRC32C is not set
1363CONFIG_ZLIB_INFLATE=y
1364CONFIG_ZLIB_DEFLATE=m
1365CONFIG_PLIST=y
1366CONFIG_HAS_IOMEM=y
1367CONFIG_HAS_IOPORT=y
1368CONFIG_HAS_DMA=y
diff --git a/arch/blackfin/configs/BF548-EZKIT_defconfig b/arch/blackfin/configs/BF548-EZKIT_defconfig
index bf63660815b9..d4ed9ce1f62f 100644
--- a/arch/blackfin/configs/BF548-EZKIT_defconfig
+++ b/arch/blackfin/configs/BF548-EZKIT_defconfig
@@ -1,6 +1,6 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.24.7 3# Linux kernel version: 2.6.28-rc2
4# 4#
5# CONFIG_MMU is not set 5# CONFIG_MMU is not set
6# CONFIG_FPU is not set 6# CONFIG_FPU is not set
@@ -8,7 +8,6 @@ CONFIG_RWSEM_GENERIC_SPINLOCK=y
8# CONFIG_RWSEM_XCHGADD_ALGORITHM is not set 8# CONFIG_RWSEM_XCHGADD_ALGORITHM is not set
9CONFIG_BLACKFIN=y 9CONFIG_BLACKFIN=y
10CONFIG_ZONE_DMA=y 10CONFIG_ZONE_DMA=y
11CONFIG_SEMAPHORE_SLEEPERS=y
12CONFIG_GENERIC_FIND_NEXT_BIT=y 11CONFIG_GENERIC_FIND_NEXT_BIT=y
13CONFIG_GENERIC_HWEIGHT=y 12CONFIG_GENERIC_HWEIGHT=y
14CONFIG_GENERIC_HARDIRQS=y 13CONFIG_GENERIC_HARDIRQS=y
@@ -31,18 +30,16 @@ CONFIG_SYSVIPC_SYSCTL=y
31# CONFIG_POSIX_MQUEUE is not set 30# CONFIG_POSIX_MQUEUE is not set
32# CONFIG_BSD_PROCESS_ACCT is not set 31# CONFIG_BSD_PROCESS_ACCT is not set
33# CONFIG_TASKSTATS is not set 32# CONFIG_TASKSTATS is not set
34# CONFIG_USER_NS is not set
35# CONFIG_PID_NS is not set
36# CONFIG_AUDIT is not set 33# CONFIG_AUDIT is not set
37CONFIG_IKCONFIG=y 34CONFIG_IKCONFIG=y
38CONFIG_IKCONFIG_PROC=y 35CONFIG_IKCONFIG_PROC=y
39CONFIG_LOG_BUF_SHIFT=14 36CONFIG_LOG_BUF_SHIFT=14
40# CONFIG_CGROUPS is not set 37# CONFIG_CGROUPS is not set
41CONFIG_FAIR_GROUP_SCHED=y 38# CONFIG_GROUP_SCHED is not set
42CONFIG_FAIR_USER_SCHED=y 39# CONFIG_SYSFS_DEPRECATED is not set
43# CONFIG_FAIR_CGROUP_SCHED is not set 40# CONFIG_SYSFS_DEPRECATED_V2 is not set
44CONFIG_SYSFS_DEPRECATED=y
45# CONFIG_RELAY is not set 41# CONFIG_RELAY is not set
42# CONFIG_NAMESPACES is not set
46CONFIG_BLK_DEV_INITRD=y 43CONFIG_BLK_DEV_INITRD=y
47CONFIG_INITRAMFS_SOURCE="" 44CONFIG_INITRAMFS_SOURCE=""
48# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 45# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
@@ -51,26 +48,35 @@ CONFIG_EMBEDDED=y
51CONFIG_UID16=y 48CONFIG_UID16=y
52CONFIG_SYSCTL_SYSCALL=y 49CONFIG_SYSCTL_SYSCALL=y
53CONFIG_KALLSYMS=y 50CONFIG_KALLSYMS=y
51# CONFIG_KALLSYMS_ALL is not set
54# CONFIG_KALLSYMS_EXTRA_PASS is not set 52# CONFIG_KALLSYMS_EXTRA_PASS is not set
55CONFIG_HOTPLUG=y 53CONFIG_HOTPLUG=y
56CONFIG_PRINTK=y 54CONFIG_PRINTK=y
57CONFIG_BUG=y 55CONFIG_BUG=y
58CONFIG_ELF_CORE=y 56# CONFIG_ELF_CORE is not set
57CONFIG_COMPAT_BRK=y
59CONFIG_BASE_FULL=y 58CONFIG_BASE_FULL=y
60CONFIG_FUTEX=y 59CONFIG_FUTEX=y
61CONFIG_ANON_INODES=y 60CONFIG_ANON_INODES=y
62CONFIG_EPOLL=y 61CONFIG_EPOLL=y
63CONFIG_SIGNALFD=y 62CONFIG_SIGNALFD=y
63CONFIG_TIMERFD=y
64CONFIG_EVENTFD=y 64CONFIG_EVENTFD=y
65CONFIG_AIO=y
65CONFIG_VM_EVENT_COUNTERS=y 66CONFIG_VM_EVENT_COUNTERS=y
66CONFIG_SLAB=y 67CONFIG_SLAB=y
67# CONFIG_SLUB is not set 68# CONFIG_SLUB is not set
68# CONFIG_SLOB is not set 69# CONFIG_SLOB is not set
70# CONFIG_PROFILING is not set
71# CONFIG_MARKERS is not set
72CONFIG_HAVE_OPROFILE=y
73# CONFIG_HAVE_GENERIC_DMA_COHERENT is not set
69CONFIG_SLABINFO=y 74CONFIG_SLABINFO=y
70CONFIG_RT_MUTEXES=y 75CONFIG_RT_MUTEXES=y
71CONFIG_TINY_SHMEM=y 76CONFIG_TINY_SHMEM=y
72CONFIG_BASE_SMALL=0 77CONFIG_BASE_SMALL=0
73CONFIG_MODULES=y 78CONFIG_MODULES=y
79# CONFIG_MODULE_FORCE_LOAD is not set
74CONFIG_MODULE_UNLOAD=y 80CONFIG_MODULE_UNLOAD=y
75# CONFIG_MODULE_FORCE_UNLOAD is not set 81# CONFIG_MODULE_FORCE_UNLOAD is not set
76# CONFIG_MODVERSIONS is not set 82# CONFIG_MODVERSIONS is not set
@@ -81,6 +87,7 @@ CONFIG_BLOCK=y
81# CONFIG_BLK_DEV_IO_TRACE is not set 87# CONFIG_BLK_DEV_IO_TRACE is not set
82# CONFIG_LSF is not set 88# CONFIG_LSF is not set
83# CONFIG_BLK_DEV_BSG is not set 89# CONFIG_BLK_DEV_BSG is not set
90# CONFIG_BLK_DEV_INTEGRITY is not set
84 91
85# 92#
86# IO Schedulers 93# IO Schedulers
@@ -94,9 +101,11 @@ CONFIG_DEFAULT_AS=y
94# CONFIG_DEFAULT_CFQ is not set 101# CONFIG_DEFAULT_CFQ is not set
95# CONFIG_DEFAULT_NOOP is not set 102# CONFIG_DEFAULT_NOOP is not set
96CONFIG_DEFAULT_IOSCHED="anticipatory" 103CONFIG_DEFAULT_IOSCHED="anticipatory"
104CONFIG_CLASSIC_RCU=y
97# CONFIG_PREEMPT_NONE is not set 105# CONFIG_PREEMPT_NONE is not set
98CONFIG_PREEMPT_VOLUNTARY=y 106CONFIG_PREEMPT_VOLUNTARY=y
99# CONFIG_PREEMPT is not set 107# CONFIG_PREEMPT is not set
108# CONFIG_FREEZER is not set
100 109
101# 110#
102# Blackfin Processor Options 111# Blackfin Processor Options
@@ -105,6 +114,10 @@ CONFIG_PREEMPT_VOLUNTARY=y
105# 114#
106# Processor and Board Settings 115# Processor and Board Settings
107# 116#
117# CONFIG_BF512 is not set
118# CONFIG_BF514 is not set
119# CONFIG_BF516 is not set
120# CONFIG_BF518 is not set
108# CONFIG_BF522 is not set 121# CONFIG_BF522 is not set
109# CONFIG_BF523 is not set 122# CONFIG_BF523 is not set
110# CONFIG_BF524 is not set 123# CONFIG_BF524 is not set
@@ -117,18 +130,23 @@ CONFIG_PREEMPT_VOLUNTARY=y
117# CONFIG_BF534 is not set 130# CONFIG_BF534 is not set
118# CONFIG_BF536 is not set 131# CONFIG_BF536 is not set
119# CONFIG_BF537 is not set 132# CONFIG_BF537 is not set
133# CONFIG_BF538 is not set
134# CONFIG_BF539 is not set
120# CONFIG_BF542 is not set 135# CONFIG_BF542 is not set
121# CONFIG_BF544 is not set 136# CONFIG_BF544 is not set
122# CONFIG_BF547 is not set 137# CONFIG_BF547 is not set
123CONFIG_BF548=y 138CONFIG_BF548=y
124# CONFIG_BF549 is not set 139# CONFIG_BF549 is not set
125# CONFIG_BF561 is not set 140# CONFIG_BF561 is not set
141CONFIG_BF_REV_MIN=0
142CONFIG_BF_REV_MAX=2
126CONFIG_BF_REV_0_0=y 143CONFIG_BF_REV_0_0=y
127# CONFIG_BF_REV_0_1 is not set 144# CONFIG_BF_REV_0_1 is not set
128# CONFIG_BF_REV_0_2 is not set 145# CONFIG_BF_REV_0_2 is not set
129# CONFIG_BF_REV_0_3 is not set 146# CONFIG_BF_REV_0_3 is not set
130# CONFIG_BF_REV_0_4 is not set 147# CONFIG_BF_REV_0_4 is not set
131# CONFIG_BF_REV_0_5 is not set 148# CONFIG_BF_REV_0_5 is not set
149# CONFIG_BF_REV_0_6 is not set
132# CONFIG_BF_REV_ANY is not set 150# CONFIG_BF_REV_ANY is not set
133# CONFIG_BF_REV_NONE is not set 151# CONFIG_BF_REV_NONE is not set
134CONFIG_BF54x=y 152CONFIG_BF54x=y
@@ -138,15 +156,12 @@ CONFIG_IRQ_SPORT0_RX=9
138CONFIG_IRQ_SPORT0_TX=9 156CONFIG_IRQ_SPORT0_TX=9
139CONFIG_IRQ_SPORT1_RX=9 157CONFIG_IRQ_SPORT1_RX=9
140CONFIG_IRQ_SPORT1_TX=9 158CONFIG_IRQ_SPORT1_TX=9
159CONFIG_IRQ_SPI0=10
141CONFIG_IRQ_UART0_RX=10 160CONFIG_IRQ_UART0_RX=10
142CONFIG_IRQ_UART0_TX=10 161CONFIG_IRQ_UART0_TX=10
143CONFIG_IRQ_UART1_RX=10 162CONFIG_IRQ_UART1_RX=10
144CONFIG_IRQ_UART1_TX=10 163CONFIG_IRQ_UART1_TX=10
145CONFIG_IRQ_CNT=8 164CONFIG_IRQ_CNT=8
146CONFIG_IRQ_USB_INT0=11
147CONFIG_IRQ_USB_INT1=11
148CONFIG_IRQ_USB_INT2=11
149CONFIG_IRQ_USB_DMA=11
150CONFIG_IRQ_TIMER0=11 165CONFIG_IRQ_TIMER0=11
151CONFIG_IRQ_TIMER1=11 166CONFIG_IRQ_TIMER1=11
152CONFIG_IRQ_TIMER2=11 167CONFIG_IRQ_TIMER2=11
@@ -155,9 +170,21 @@ CONFIG_IRQ_TIMER4=11
155CONFIG_IRQ_TIMER5=11 170CONFIG_IRQ_TIMER5=11
156CONFIG_IRQ_TIMER6=11 171CONFIG_IRQ_TIMER6=11
157CONFIG_IRQ_TIMER7=11 172CONFIG_IRQ_TIMER7=11
173CONFIG_IRQ_USB_INT0=11
174CONFIG_IRQ_USB_INT1=11
175CONFIG_IRQ_USB_INT2=11
176CONFIG_IRQ_USB_DMA=11
158CONFIG_IRQ_TIMER8=11 177CONFIG_IRQ_TIMER8=11
159CONFIG_IRQ_TIMER9=11 178CONFIG_IRQ_TIMER9=11
160CONFIG_IRQ_TIMER10=11 179CONFIG_IRQ_TIMER10=11
180CONFIG_IRQ_SPORT2_RX=9
181CONFIG_IRQ_SPORT2_TX=9
182CONFIG_IRQ_SPORT3_RX=9
183CONFIG_IRQ_SPORT3_TX=9
184CONFIG_IRQ_SPI1=10
185CONFIG_IRQ_SPI2=10
186CONFIG_IRQ_TWI0=11
187CONFIG_IRQ_TWI1=11
161CONFIG_BFIN548_EZKIT=y 188CONFIG_BFIN548_EZKIT=y
162# CONFIG_BFIN548_BLUETECHNIX_CM is not set 189# CONFIG_BFIN548_BLUETECHNIX_CM is not set
163 190
@@ -180,7 +207,6 @@ CONFIG_IRQ_SPORT1_ERR=7
180CONFIG_IRQ_SPI0_ERR=7 207CONFIG_IRQ_SPI0_ERR=7
181CONFIG_IRQ_UART0_ERR=7 208CONFIG_IRQ_UART0_ERR=7
182CONFIG_IRQ_EPPI0=8 209CONFIG_IRQ_EPPI0=8
183CONFIG_IRQ_SPI0=10
184CONFIG_IRQ_PINT0=12 210CONFIG_IRQ_PINT0=12
185CONFIG_IRQ_PINT1=12 211CONFIG_IRQ_PINT1=12
186CONFIG_IRQ_MDMAS0=13 212CONFIG_IRQ_MDMAS0=13
@@ -195,18 +221,10 @@ CONFIG_IRQ_SPI2_ERR=7
195CONFIG_IRQ_UART1_ERR=7 221CONFIG_IRQ_UART1_ERR=7
196CONFIG_IRQ_UART2_ERR=7 222CONFIG_IRQ_UART2_ERR=7
197CONFIG_IRQ_CAN0_ERR=7 223CONFIG_IRQ_CAN0_ERR=7
198CONFIG_IRQ_SPORT2_RX=9
199CONFIG_IRQ_SPORT2_TX=9
200CONFIG_IRQ_SPORT3_RX=9
201CONFIG_IRQ_SPORT3_TX=9
202CONFIG_IRQ_EPPI1=9 224CONFIG_IRQ_EPPI1=9
203CONFIG_IRQ_EPPI2=9 225CONFIG_IRQ_EPPI2=9
204CONFIG_IRQ_SPI1=10
205CONFIG_IRQ_SPI2=10
206CONFIG_IRQ_ATAPI_RX=10 226CONFIG_IRQ_ATAPI_RX=10
207CONFIG_IRQ_ATAPI_TX=10 227CONFIG_IRQ_ATAPI_TX=10
208CONFIG_IRQ_TWI0=11
209CONFIG_IRQ_TWI1=11
210CONFIG_IRQ_CAN0_RX=11 228CONFIG_IRQ_CAN0_RX=11
211CONFIG_IRQ_CAN0_TX=11 229CONFIG_IRQ_CAN0_TX=11
212CONFIG_IRQ_MDMAS2=13 230CONFIG_IRQ_MDMAS2=13
@@ -260,7 +278,6 @@ CONFIG_BOOT_LOAD=0x1000
260# 278#
261CONFIG_CLKIN_HZ=25000000 279CONFIG_CLKIN_HZ=25000000
262# CONFIG_BFIN_KERNEL_CLOCK is not set 280# CONFIG_BFIN_KERNEL_CLOCK is not set
263CONFIG_MAX_MEM_SIZE=512
264CONFIG_MAX_VCO_HZ=600000000 281CONFIG_MAX_VCO_HZ=600000000
265CONFIG_MIN_VCO_HZ=50000000 282CONFIG_MIN_VCO_HZ=50000000
266CONFIG_MAX_SCLK_HZ=133333333 283CONFIG_MAX_SCLK_HZ=133333333
@@ -274,10 +291,10 @@ CONFIG_HZ_250=y
274# CONFIG_HZ_300 is not set 291# CONFIG_HZ_300 is not set
275# CONFIG_HZ_1000 is not set 292# CONFIG_HZ_1000 is not set
276CONFIG_HZ=250 293CONFIG_HZ=250
294# CONFIG_SCHED_HRTICK is not set
277CONFIG_GENERIC_TIME=y 295CONFIG_GENERIC_TIME=y
278CONFIG_GENERIC_CLOCKEVENTS=y 296CONFIG_GENERIC_CLOCKEVENTS=y
279# CONFIG_CYCLES_CLOCKSOURCE is not set 297# CONFIG_CYCLES_CLOCKSOURCE is not set
280# CONFIG_TICK_ONESHOT is not set
281# CONFIG_NO_HZ is not set 298# CONFIG_NO_HZ is not set
282# CONFIG_HIGH_RES_TIMERS is not set 299# CONFIG_HIGH_RES_TIMERS is not set
283CONFIG_GENERIC_CLOCKEVENTS_BUILD=y 300CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
@@ -311,6 +328,12 @@ CONFIG_ACCESS_OK_L1=y
311CONFIG_CACHELINE_ALIGNED_L1=y 328CONFIG_CACHELINE_ALIGNED_L1=y
312# CONFIG_SYSCALL_TAB_L1 is not set 329# CONFIG_SYSCALL_TAB_L1 is not set
313# CONFIG_CPLB_SWITCH_TAB_L1 is not set 330# CONFIG_CPLB_SWITCH_TAB_L1 is not set
331CONFIG_APP_STACK_L1=y
332
333#
334# Speed Optimizations
335#
336CONFIG_BFIN_INS_LOWOVERHEAD=y
314CONFIG_RAMKERNEL=y 337CONFIG_RAMKERNEL=y
315# CONFIG_ROMKERNEL is not set 338# CONFIG_ROMKERNEL is not set
316CONFIG_SELECT_MEMORY_MODEL=y 339CONFIG_SELECT_MEMORY_MODEL=y
@@ -319,14 +342,13 @@ CONFIG_FLATMEM_MANUAL=y
319# CONFIG_SPARSEMEM_MANUAL is not set 342# CONFIG_SPARSEMEM_MANUAL is not set
320CONFIG_FLATMEM=y 343CONFIG_FLATMEM=y
321CONFIG_FLAT_NODE_MEM_MAP=y 344CONFIG_FLAT_NODE_MEM_MAP=y
322# CONFIG_SPARSEMEM_STATIC is not set 345CONFIG_PAGEFLAGS_EXTENDED=y
323# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
324CONFIG_SPLIT_PTLOCK_CPUS=4 346CONFIG_SPLIT_PTLOCK_CPUS=4
325# CONFIG_RESOURCES_64BIT is not set 347# CONFIG_RESOURCES_64BIT is not set
348# CONFIG_PHYS_ADDR_T_64BIT is not set
326CONFIG_ZONE_DMA_FLAG=1 349CONFIG_ZONE_DMA_FLAG=1
327CONFIG_VIRT_TO_BUS=y 350CONFIG_VIRT_TO_BUS=y
328# CONFIG_BFIN_GPTIMERS is not set 351# CONFIG_BFIN_GPTIMERS is not set
329CONFIG_BFIN_DMA_5XX=y
330# CONFIG_DMA_UNCACHED_4M is not set 352# CONFIG_DMA_UNCACHED_4M is not set
331CONFIG_DMA_UNCACHED_2M=y 353CONFIG_DMA_UNCACHED_2M=y
332# CONFIG_DMA_UNCACHED_1M is not set 354# CONFIG_DMA_UNCACHED_1M is not set
@@ -341,7 +363,7 @@ CONFIG_BFIN_DCACHE=y
341# CONFIG_BFIN_ICACHE_LOCK is not set 363# CONFIG_BFIN_ICACHE_LOCK is not set
342# CONFIG_BFIN_WB is not set 364# CONFIG_BFIN_WB is not set
343CONFIG_BFIN_WT=y 365CONFIG_BFIN_WT=y
344CONFIG_L1_MAX_PIECE=16 366# CONFIG_BFIN_L2_CACHEABLE is not set
345# CONFIG_MPU is not set 367# CONFIG_MPU is not set
346 368
347# 369#
@@ -373,7 +395,6 @@ CONFIG_EBIU_FCTLVAL=0x6
373# 395#
374# Bus options (PCI, PCMCIA, EISA, MCA, ISA) 396# Bus options (PCI, PCMCIA, EISA, MCA, ISA)
375# 397#
376# CONFIG_PCI is not set
377# CONFIG_ARCH_SUPPORTS_MSI is not set 398# CONFIG_ARCH_SUPPORTS_MSI is not set
378# CONFIG_PCCARD is not set 399# CONFIG_PCCARD is not set
379 400
@@ -384,23 +405,20 @@ CONFIG_BINFMT_ELF_FDPIC=y
384CONFIG_BINFMT_FLAT=y 405CONFIG_BINFMT_FLAT=y
385CONFIG_BINFMT_ZFLAT=y 406CONFIG_BINFMT_ZFLAT=y
386# CONFIG_BINFMT_SHARED_FLAT is not set 407# CONFIG_BINFMT_SHARED_FLAT is not set
408# CONFIG_HAVE_AOUT is not set
387# CONFIG_BINFMT_MISC is not set 409# CONFIG_BINFMT_MISC is not set
388 410
389# 411#
390# Power management options 412# Power management options
391# 413#
392# CONFIG_PM is not set 414# CONFIG_PM is not set
393CONFIG_SUSPEND_UP_POSSIBLE=y 415CONFIG_ARCH_SUSPEND_POSSIBLE=y
394# CONFIG_PM_WAKEUP_BY_GPIO is not set 416# CONFIG_PM_WAKEUP_BY_GPIO is not set
395 417
396# 418#
397# CPU Frequency scaling 419# CPU Frequency scaling
398# 420#
399# CONFIG_CPU_FREQ is not set 421# CONFIG_CPU_FREQ is not set
400
401#
402# Networking
403#
404CONFIG_NET=y 422CONFIG_NET=y
405 423
406# 424#
@@ -413,6 +431,7 @@ CONFIG_XFRM=y
413# CONFIG_XFRM_USER is not set 431# CONFIG_XFRM_USER is not set
414# CONFIG_XFRM_SUB_POLICY is not set 432# CONFIG_XFRM_SUB_POLICY is not set
415# CONFIG_XFRM_MIGRATE is not set 433# CONFIG_XFRM_MIGRATE is not set
434# CONFIG_XFRM_STATISTICS is not set
416# CONFIG_NET_KEY is not set 435# CONFIG_NET_KEY is not set
417CONFIG_INET=y 436CONFIG_INET=y
418# CONFIG_IP_MULTICAST is not set 437# CONFIG_IP_MULTICAST is not set
@@ -442,8 +461,6 @@ CONFIG_TCP_CONG_CUBIC=y
442CONFIG_DEFAULT_TCP_CONG="cubic" 461CONFIG_DEFAULT_TCP_CONG="cubic"
443# CONFIG_TCP_MD5SIG is not set 462# CONFIG_TCP_MD5SIG is not set
444# CONFIG_IPV6 is not set 463# CONFIG_IPV6 is not set
445# CONFIG_INET6_XFRM_TUNNEL is not set
446# CONFIG_INET6_TUNNEL is not set
447# CONFIG_NETLABEL is not set 464# CONFIG_NETLABEL is not set
448# CONFIG_NETWORK_SECMARK is not set 465# CONFIG_NETWORK_SECMARK is not set
449# CONFIG_NETFILTER is not set 466# CONFIG_NETFILTER is not set
@@ -452,6 +469,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
452# CONFIG_TIPC is not set 469# CONFIG_TIPC is not set
453# CONFIG_ATM is not set 470# CONFIG_ATM is not set
454# CONFIG_BRIDGE is not set 471# CONFIG_BRIDGE is not set
472# CONFIG_NET_DSA is not set
455# CONFIG_VLAN_8021Q is not set 473# CONFIG_VLAN_8021Q is not set
456# CONFIG_DECNET is not set 474# CONFIG_DECNET is not set
457# CONFIG_LLC2 is not set 475# CONFIG_LLC2 is not set
@@ -468,6 +486,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
468# 486#
469# CONFIG_NET_PKTGEN is not set 487# CONFIG_NET_PKTGEN is not set
470# CONFIG_HAMRADIO is not set 488# CONFIG_HAMRADIO is not set
489# CONFIG_CAN is not set
471CONFIG_IRDA=m 490CONFIG_IRDA=m
472 491
473# 492#
@@ -493,9 +512,9 @@ CONFIG_IRCOMM=m
493# 512#
494CONFIG_IRTTY_SIR=m 513CONFIG_IRTTY_SIR=m
495CONFIG_BFIN_SIR=m 514CONFIG_BFIN_SIR=m
515CONFIG_BFIN_SIR3=y
496# CONFIG_BFIN_SIR0 is not set 516# CONFIG_BFIN_SIR0 is not set
497# CONFIG_BFIN_SIR2 is not set 517# CONFIG_BFIN_SIR2 is not set
498CONFIG_BFIN_SIR3=y
499CONFIG_SIR_BFIN_DMA=y 518CONFIG_SIR_BFIN_DMA=y
500# CONFIG_SIR_BFIN_PIO is not set 519# CONFIG_SIR_BFIN_PIO is not set
501 520
@@ -508,15 +527,6 @@ CONFIG_SIR_BFIN_DMA=y
508# CONFIG_KS959_DONGLE is not set 527# CONFIG_KS959_DONGLE is not set
509 528
510# 529#
511# Old SIR device drivers
512#
513# CONFIG_IRPORT_SIR is not set
514
515#
516# Old Serial dongle support
517#
518
519#
520# FIR device drivers 530# FIR device drivers
521# 531#
522# CONFIG_USB_IRDA is not set 532# CONFIG_USB_IRDA is not set
@@ -524,11 +534,10 @@ CONFIG_SIR_BFIN_DMA=y
524# CONFIG_MCS_FIR is not set 534# CONFIG_MCS_FIR is not set
525# CONFIG_BT is not set 535# CONFIG_BT is not set
526# CONFIG_AF_RXRPC is not set 536# CONFIG_AF_RXRPC is not set
527 537# CONFIG_PHONET is not set
528# 538CONFIG_WIRELESS=y
529# Wireless
530#
531# CONFIG_CFG80211 is not set 539# CONFIG_CFG80211 is not set
540CONFIG_WIRELESS_OLD_REGULATORY=y
532# CONFIG_WIRELESS_EXT is not set 541# CONFIG_WIRELESS_EXT is not set
533# CONFIG_MAC80211 is not set 542# CONFIG_MAC80211 is not set
534# CONFIG_IEEE80211 is not set 543# CONFIG_IEEE80211 is not set
@@ -546,6 +555,8 @@ CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
546CONFIG_STANDALONE=y 555CONFIG_STANDALONE=y
547CONFIG_PREVENT_FIRMWARE_BUILD=y 556CONFIG_PREVENT_FIRMWARE_BUILD=y
548# CONFIG_FW_LOADER is not set 557# CONFIG_FW_LOADER is not set
558# CONFIG_DEBUG_DRIVER is not set
559# CONFIG_DEBUG_DEVRES is not set
549# CONFIG_SYS_HYPERVISOR is not set 560# CONFIG_SYS_HYPERVISOR is not set
550# CONFIG_CONNECTOR is not set 561# CONFIG_CONNECTOR is not set
551CONFIG_MTD=y 562CONFIG_MTD=y
@@ -554,6 +565,7 @@ CONFIG_MTD=y
554CONFIG_MTD_PARTITIONS=y 565CONFIG_MTD_PARTITIONS=y
555# CONFIG_MTD_REDBOOT_PARTS is not set 566# CONFIG_MTD_REDBOOT_PARTS is not set
556CONFIG_MTD_CMDLINE_PARTS=y 567CONFIG_MTD_CMDLINE_PARTS=y
568# CONFIG_MTD_AR7_PARTS is not set
557 569
558# 570#
559# User Modules And Translation Layers 571# User Modules And Translation Layers
@@ -601,6 +613,7 @@ CONFIG_MTD_PHYSMAP=y
601CONFIG_MTD_PHYSMAP_START=0x20000000 613CONFIG_MTD_PHYSMAP_START=0x20000000
602CONFIG_MTD_PHYSMAP_LEN=0 614CONFIG_MTD_PHYSMAP_LEN=0
603CONFIG_MTD_PHYSMAP_BANKWIDTH=2 615CONFIG_MTD_PHYSMAP_BANKWIDTH=2
616# CONFIG_MTD_GPIO_ADDR is not set
604# CONFIG_MTD_UCLINUX is not set 617# CONFIG_MTD_UCLINUX is not set
605# CONFIG_MTD_PLATRAM is not set 618# CONFIG_MTD_PLATRAM is not set
606 619
@@ -608,7 +621,8 @@ CONFIG_MTD_PHYSMAP_BANKWIDTH=2
608# Self-contained MTD device drivers 621# Self-contained MTD device drivers
609# 622#
610# CONFIG_MTD_DATAFLASH is not set 623# CONFIG_MTD_DATAFLASH is not set
611# CONFIG_MTD_M25P80 is not set 624CONFIG_MTD_M25P80=y
625CONFIG_M25PXX_USE_FAST_READ=y
612# CONFIG_MTD_SLRAM is not set 626# CONFIG_MTD_SLRAM is not set
613# CONFIG_MTD_PHRAM is not set 627# CONFIG_MTD_PHRAM is not set
614# CONFIG_MTD_MTDRAM is not set 628# CONFIG_MTD_MTDRAM is not set
@@ -648,11 +662,14 @@ CONFIG_BLK_DEV=y
648CONFIG_BLK_DEV_RAM=y 662CONFIG_BLK_DEV_RAM=y
649CONFIG_BLK_DEV_RAM_COUNT=16 663CONFIG_BLK_DEV_RAM_COUNT=16
650CONFIG_BLK_DEV_RAM_SIZE=4096 664CONFIG_BLK_DEV_RAM_SIZE=4096
651CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024 665# CONFIG_BLK_DEV_XIP is not set
652# CONFIG_CDROM_PKTCDVD is not set 666# CONFIG_CDROM_PKTCDVD is not set
653# CONFIG_ATA_OVER_ETH is not set 667# CONFIG_ATA_OVER_ETH is not set
668# CONFIG_BLK_DEV_HD is not set
654CONFIG_MISC_DEVICES=y 669CONFIG_MISC_DEVICES=y
655# CONFIG_EEPROM_93CX6 is not set 670# CONFIG_EEPROM_93CX6 is not set
671# CONFIG_ENCLOSURE_SERVICES is not set
672CONFIG_HAVE_IDE=y
656# CONFIG_IDE is not set 673# CONFIG_IDE is not set
657 674
658# 675#
@@ -696,13 +713,16 @@ CONFIG_SCSI_WAIT_SCAN=m
696CONFIG_SCSI_LOWLEVEL=y 713CONFIG_SCSI_LOWLEVEL=y
697# CONFIG_ISCSI_TCP is not set 714# CONFIG_ISCSI_TCP is not set
698# CONFIG_SCSI_DEBUG is not set 715# CONFIG_SCSI_DEBUG is not set
716# CONFIG_SCSI_DH is not set
699CONFIG_ATA=y 717CONFIG_ATA=y
700# CONFIG_ATA_NONSTANDARD is not set 718# CONFIG_ATA_NONSTANDARD is not set
719CONFIG_SATA_PMP=y
720CONFIG_ATA_SFF=y
721# CONFIG_SATA_MV is not set
701# CONFIG_PATA_PLATFORM is not set 722# CONFIG_PATA_PLATFORM is not set
702CONFIG_PATA_BF54X=y 723CONFIG_PATA_BF54X=y
703# CONFIG_MD is not set 724# CONFIG_MD is not set
704CONFIG_NETDEVICES=y 725CONFIG_NETDEVICES=y
705# CONFIG_NETDEVICES_MULTIQUEUE is not set
706# CONFIG_DUMMY is not set 726# CONFIG_DUMMY is not set
707# CONFIG_BONDING is not set 727# CONFIG_BONDING is not set
708# CONFIG_MACVLAN is not set 728# CONFIG_MACVLAN is not set
@@ -715,11 +735,14 @@ CONFIG_MII=y
715# CONFIG_SMC91X is not set 735# CONFIG_SMC91X is not set
716CONFIG_SMSC911X=y 736CONFIG_SMSC911X=y
717# CONFIG_DM9000 is not set 737# CONFIG_DM9000 is not set
738# CONFIG_ENC28J60 is not set
718# CONFIG_IBM_NEW_EMAC_ZMII is not set 739# CONFIG_IBM_NEW_EMAC_ZMII is not set
719# CONFIG_IBM_NEW_EMAC_RGMII is not set 740# CONFIG_IBM_NEW_EMAC_RGMII is not set
720# CONFIG_IBM_NEW_EMAC_TAH is not set 741# CONFIG_IBM_NEW_EMAC_TAH is not set
721# CONFIG_IBM_NEW_EMAC_EMAC4 is not set 742# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
722# CONFIG_B44 is not set 743# CONFIG_IBM_NEW_EMAC_NO_FLOW_CTRL is not set
744# CONFIG_IBM_NEW_EMAC_MAL_CLR_ICINTSTAT is not set
745# CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set
723CONFIG_NETDEV_1000=y 746CONFIG_NETDEV_1000=y
724# CONFIG_AX88180 is not set 747# CONFIG_AX88180 is not set
725CONFIG_NETDEV_10000=y 748CONFIG_NETDEV_10000=y
@@ -729,6 +752,7 @@ CONFIG_NETDEV_10000=y
729# 752#
730# CONFIG_WLAN_PRE80211 is not set 753# CONFIG_WLAN_PRE80211 is not set
731# CONFIG_WLAN_80211 is not set 754# CONFIG_WLAN_80211 is not set
755# CONFIG_IWLWIFI_LEDS is not set
732 756
733# 757#
734# USB Network Adapters 758# USB Network Adapters
@@ -741,7 +765,6 @@ CONFIG_NETDEV_10000=y
741# CONFIG_WAN is not set 765# CONFIG_WAN is not set
742# CONFIG_PPP is not set 766# CONFIG_PPP is not set
743# CONFIG_SLIP is not set 767# CONFIG_SLIP is not set
744# CONFIG_SHAPER is not set
745# CONFIG_NETCONSOLE is not set 768# CONFIG_NETCONSOLE is not set
746# CONFIG_NETPOLL is not set 769# CONFIG_NETPOLL is not set
747# CONFIG_NET_POLL_CONTROLLER is not set 770# CONFIG_NET_POLL_CONTROLLER is not set
@@ -752,7 +775,7 @@ CONFIG_NETDEV_10000=y
752# Input device support 775# Input device support
753# 776#
754CONFIG_INPUT=y 777CONFIG_INPUT=y
755# CONFIG_INPUT_FF_MEMLESS is not set 778CONFIG_INPUT_FF_MEMLESS=m
756# CONFIG_INPUT_POLLDEV is not set 779# CONFIG_INPUT_POLLDEV is not set
757 780
758# 781#
@@ -776,30 +799,37 @@ CONFIG_INPUT_KEYBOARD=y
776# CONFIG_KEYBOARD_GPIO is not set 799# CONFIG_KEYBOARD_GPIO is not set
777CONFIG_KEYBOARD_BFIN=y 800CONFIG_KEYBOARD_BFIN=y
778# CONFIG_KEYBOARD_OPENCORES is not set 801# CONFIG_KEYBOARD_OPENCORES is not set
802# CONFIG_KEYBOARD_ADP5588 is not set
779# CONFIG_INPUT_MOUSE is not set 803# CONFIG_INPUT_MOUSE is not set
780# CONFIG_INPUT_JOYSTICK is not set 804# CONFIG_INPUT_JOYSTICK is not set
781# CONFIG_INPUT_TABLET is not set 805# CONFIG_INPUT_TABLET is not set
782CONFIG_INPUT_TOUCHSCREEN=y 806CONFIG_INPUT_TOUCHSCREEN=y
783# CONFIG_TOUCHSCREEN_ADS7846 is not set 807# CONFIG_TOUCHSCREEN_ADS7846 is not set
784CONFIG_TOUCHSCREEN_AD7877=m 808CONFIG_TOUCHSCREEN_AD7877=m
809# CONFIG_TOUCHSCREEN_AD7879_I2C is not set
810# CONFIG_TOUCHSCREEN_AD7879_SPI is not set
811# CONFIG_TOUCHSCREEN_AD7879 is not set
785# CONFIG_TOUCHSCREEN_FUJITSU is not set 812# CONFIG_TOUCHSCREEN_FUJITSU is not set
786# CONFIG_TOUCHSCREEN_GUNZE is not set 813# CONFIG_TOUCHSCREEN_GUNZE is not set
787# CONFIG_TOUCHSCREEN_ELO is not set 814# CONFIG_TOUCHSCREEN_ELO is not set
788# CONFIG_TOUCHSCREEN_MTOUCH is not set 815# CONFIG_TOUCHSCREEN_MTOUCH is not set
816# CONFIG_TOUCHSCREEN_INEXIO is not set
789# CONFIG_TOUCHSCREEN_MK712 is not set 817# CONFIG_TOUCHSCREEN_MK712 is not set
790# CONFIG_TOUCHSCREEN_PENMOUNT is not set 818# CONFIG_TOUCHSCREEN_PENMOUNT is not set
791# CONFIG_TOUCHSCREEN_TOUCHRIGHT is not set 819# CONFIG_TOUCHSCREEN_TOUCHRIGHT is not set
792# CONFIG_TOUCHSCREEN_TOUCHWIN is not set 820# CONFIG_TOUCHSCREEN_TOUCHWIN is not set
793# CONFIG_TOUCHSCREEN_UCB1400 is not set 821# CONFIG_TOUCHSCREEN_WM97XX is not set
794# CONFIG_TOUCHSCREEN_USB_COMPOSITE is not set 822# CONFIG_TOUCHSCREEN_USB_COMPOSITE is not set
823# CONFIG_TOUCHSCREEN_TOUCHIT213 is not set
795CONFIG_INPUT_MISC=y 824CONFIG_INPUT_MISC=y
796# CONFIG_INPUT_ATI_REMOTE is not set 825# CONFIG_INPUT_ATI_REMOTE is not set
797# CONFIG_INPUT_ATI_REMOTE2 is not set 826# CONFIG_INPUT_ATI_REMOTE2 is not set
798# CONFIG_INPUT_KEYSPAN_REMOTE is not set 827# CONFIG_INPUT_KEYSPAN_REMOTE is not set
799# CONFIG_INPUT_POWERMATE is not set 828# CONFIG_INPUT_POWERMATE is not set
800# CONFIG_INPUT_YEALINK is not set 829# CONFIG_INPUT_YEALINK is not set
830# CONFIG_INPUT_CM109 is not set
801# CONFIG_INPUT_UINPUT is not set 831# CONFIG_INPUT_UINPUT is not set
802# CONFIG_TWI_KEYPAD is not set 832# CONFIG_CONFIG_INPUT_PCF8574 is not set
803 833
804# 834#
805# Hardware I/O ports 835# Hardware I/O ports
@@ -815,16 +845,18 @@ CONFIG_INPUT_MISC=y
815# CONFIG_BF5xx_PPIFCD is not set 845# CONFIG_BF5xx_PPIFCD is not set
816# CONFIG_BFIN_SIMPLE_TIMER is not set 846# CONFIG_BFIN_SIMPLE_TIMER is not set
817# CONFIG_BF5xx_PPI is not set 847# CONFIG_BF5xx_PPI is not set
818CONFIG_BFIN_OTP=y
819# CONFIG_BFIN_OTP_WRITE_ENABLE is not set
820# CONFIG_BFIN_SPORT is not set 848# CONFIG_BFIN_SPORT is not set
821# CONFIG_BFIN_TIMER_LATENCY is not set 849# CONFIG_BFIN_TIMER_LATENCY is not set
822# CONFIG_TWI_LCD is not set 850# CONFIG_TWI_LCD is not set
851CONFIG_BFIN_DMA_INTERFACE=m
823CONFIG_SIMPLE_GPIO=m 852CONFIG_SIMPLE_GPIO=m
824CONFIG_VT=y 853CONFIG_VT=y
854CONFIG_CONSOLE_TRANSLATIONS=y
825CONFIG_VT_CONSOLE=y 855CONFIG_VT_CONSOLE=y
826CONFIG_HW_CONSOLE=y 856CONFIG_HW_CONSOLE=y
827# CONFIG_VT_HW_CONSOLE_BINDING is not set 857# CONFIG_VT_HW_CONSOLE_BINDING is not set
858# CONFIG_DEVKMEM is not set
859# CONFIG_BFIN_JTAG_COMM is not set
828# CONFIG_SERIAL_NONSTANDARD is not set 860# CONFIG_SERIAL_NONSTANDARD is not set
829 861
830# 862#
@@ -849,6 +881,8 @@ CONFIG_SERIAL_CORE_CONSOLE=y
849# CONFIG_SERIAL_BFIN_SPORT is not set 881# CONFIG_SERIAL_BFIN_SPORT is not set
850CONFIG_UNIX98_PTYS=y 882CONFIG_UNIX98_PTYS=y
851# CONFIG_LEGACY_PTYS is not set 883# CONFIG_LEGACY_PTYS is not set
884CONFIG_BFIN_OTP=y
885# CONFIG_BFIN_OTP_WRITE_ENABLE is not set
852 886
853# 887#
854# CAN, the car bus and industrial fieldbus 888# CAN, the car bus and industrial fieldbus
@@ -856,44 +890,49 @@ CONFIG_UNIX98_PTYS=y
856# CONFIG_CAN4LINUX is not set 890# CONFIG_CAN4LINUX is not set
857# CONFIG_IPMI_HANDLER is not set 891# CONFIG_IPMI_HANDLER is not set
858# CONFIG_HW_RANDOM is not set 892# CONFIG_HW_RANDOM is not set
859# CONFIG_GEN_RTC is not set
860# CONFIG_R3964 is not set 893# CONFIG_R3964 is not set
861# CONFIG_RAW_DRIVER is not set 894# CONFIG_RAW_DRIVER is not set
862# CONFIG_TCG_TPM is not set 895# CONFIG_TCG_TPM is not set
863CONFIG_I2C=y 896CONFIG_I2C=y
864CONFIG_I2C_BOARDINFO=y 897CONFIG_I2C_BOARDINFO=y
865CONFIG_I2C_CHARDEV=y 898CONFIG_I2C_CHARDEV=y
899CONFIG_I2C_HELPER_AUTO=y
866 900
867# 901#
868# I2C Algorithms 902# I2C Hardware Bus support
869# 903#
870# CONFIG_I2C_ALGOBIT is not set
871# CONFIG_I2C_ALGOPCF is not set
872# CONFIG_I2C_ALGOPCA is not set
873 904
874# 905#
875# I2C Hardware Bus support 906# I2C system bus drivers (mostly embedded / system-on-chip)
876# 907#
877CONFIG_I2C_BLACKFIN_TWI=y 908CONFIG_I2C_BLACKFIN_TWI=y
878CONFIG_I2C_BLACKFIN_TWI_CLK_KHZ=50 909CONFIG_I2C_BLACKFIN_TWI_CLK_KHZ=100
879# CONFIG_I2C_GPIO is not set 910# CONFIG_I2C_GPIO is not set
880# CONFIG_I2C_OCORES is not set 911# CONFIG_I2C_OCORES is not set
881# CONFIG_I2C_PARPORT_LIGHT is not set
882# CONFIG_I2C_SIMTEC is not set 912# CONFIG_I2C_SIMTEC is not set
913
914#
915# External I2C/SMBus adapter drivers
916#
917# CONFIG_I2C_PARPORT_LIGHT is not set
883# CONFIG_I2C_TAOS_EVM is not set 918# CONFIG_I2C_TAOS_EVM is not set
884# CONFIG_I2C_STUB is not set
885# CONFIG_I2C_TINY_USB is not set 919# CONFIG_I2C_TINY_USB is not set
886 920
887# 921#
922# Other I2C/SMBus bus drivers
923#
924# CONFIG_I2C_PCA_PLATFORM is not set
925# CONFIG_I2C_STUB is not set
926
927#
888# Miscellaneous I2C Chip support 928# Miscellaneous I2C Chip support
889# 929#
890# CONFIG_SENSORS_DS1337 is not set
891# CONFIG_SENSORS_DS1374 is not set
892# CONFIG_DS1682 is not set 930# CONFIG_DS1682 is not set
931# CONFIG_AT24 is not set
893# CONFIG_SENSORS_AD5252 is not set 932# CONFIG_SENSORS_AD5252 is not set
894# CONFIG_SENSORS_EEPROM is not set 933# CONFIG_SENSORS_EEPROM is not set
895# CONFIG_SENSORS_PCF8574 is not set 934# CONFIG_SENSORS_PCF8574 is not set
896# CONFIG_SENSORS_PCF8575 is not set 935# CONFIG_PCF8575 is not set
897# CONFIG_SENSORS_PCA9539 is not set 936# CONFIG_SENSORS_PCA9539 is not set
898# CONFIG_SENSORS_PCF8591 is not set 937# CONFIG_SENSORS_PCF8591 is not set
899# CONFIG_SENSORS_MAX6875 is not set 938# CONFIG_SENSORS_MAX6875 is not set
@@ -902,17 +941,15 @@ CONFIG_I2C_BLACKFIN_TWI_CLK_KHZ=50
902# CONFIG_I2C_DEBUG_ALGO is not set 941# CONFIG_I2C_DEBUG_ALGO is not set
903# CONFIG_I2C_DEBUG_BUS is not set 942# CONFIG_I2C_DEBUG_BUS is not set
904# CONFIG_I2C_DEBUG_CHIP is not set 943# CONFIG_I2C_DEBUG_CHIP is not set
905
906#
907# SPI support
908#
909CONFIG_SPI=y 944CONFIG_SPI=y
945# CONFIG_SPI_DEBUG is not set
910CONFIG_SPI_MASTER=y 946CONFIG_SPI_MASTER=y
911 947
912# 948#
913# SPI Master Controller Drivers 949# SPI Master Controller Drivers
914# 950#
915CONFIG_SPI_BFIN=y 951CONFIG_SPI_BFIN=y
952# CONFIG_SPI_BFIN_LOCK is not set
916# CONFIG_SPI_BITBANG is not set 953# CONFIG_SPI_BITBANG is not set
917 954
918# 955#
@@ -921,11 +958,15 @@ CONFIG_SPI_BFIN=y
921# CONFIG_SPI_AT25 is not set 958# CONFIG_SPI_AT25 is not set
922# CONFIG_SPI_SPIDEV is not set 959# CONFIG_SPI_SPIDEV is not set
923# CONFIG_SPI_TLE62X0 is not set 960# CONFIG_SPI_TLE62X0 is not set
961CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y
962# CONFIG_GPIOLIB is not set
924# CONFIG_W1 is not set 963# CONFIG_W1 is not set
925# CONFIG_POWER_SUPPLY is not set 964# CONFIG_POWER_SUPPLY is not set
926CONFIG_HWMON=y 965CONFIG_HWMON=y
927# CONFIG_HWMON_VID is not set 966# CONFIG_HWMON_VID is not set
967# CONFIG_SENSORS_AD7414 is not set
928# CONFIG_SENSORS_AD7418 is not set 968# CONFIG_SENSORS_AD7418 is not set
969# CONFIG_SENSORS_ADCXX is not set
929# CONFIG_SENSORS_ADM1021 is not set 970# CONFIG_SENSORS_ADM1021 is not set
930# CONFIG_SENSORS_ADM1025 is not set 971# CONFIG_SENSORS_ADM1025 is not set
931# CONFIG_SENSORS_ADM1026 is not set 972# CONFIG_SENSORS_ADM1026 is not set
@@ -933,6 +974,7 @@ CONFIG_HWMON=y
933# CONFIG_SENSORS_ADM1031 is not set 974# CONFIG_SENSORS_ADM1031 is not set
934# CONFIG_SENSORS_ADM9240 is not set 975# CONFIG_SENSORS_ADM9240 is not set
935# CONFIG_SENSORS_ADT7470 is not set 976# CONFIG_SENSORS_ADT7470 is not set
977# CONFIG_SENSORS_ADT7473 is not set
936# CONFIG_SENSORS_ATXP1 is not set 978# CONFIG_SENSORS_ATXP1 is not set
937# CONFIG_SENSORS_DS1621 is not set 979# CONFIG_SENSORS_DS1621 is not set
938# CONFIG_SENSORS_F71805F is not set 980# CONFIG_SENSORS_F71805F is not set
@@ -953,6 +995,7 @@ CONFIG_HWMON=y
953# CONFIG_SENSORS_LM90 is not set 995# CONFIG_SENSORS_LM90 is not set
954# CONFIG_SENSORS_LM92 is not set 996# CONFIG_SENSORS_LM92 is not set
955# CONFIG_SENSORS_LM93 is not set 997# CONFIG_SENSORS_LM93 is not set
998# CONFIG_SENSORS_MAX1111 is not set
956# CONFIG_SENSORS_MAX1619 is not set 999# CONFIG_SENSORS_MAX1619 is not set
957# CONFIG_SENSORS_MAX6650 is not set 1000# CONFIG_SENSORS_MAX6650 is not set
958# CONFIG_SENSORS_PC87360 is not set 1001# CONFIG_SENSORS_PC87360 is not set
@@ -961,6 +1004,7 @@ CONFIG_HWMON=y
961# CONFIG_SENSORS_SMSC47M1 is not set 1004# CONFIG_SENSORS_SMSC47M1 is not set
962# CONFIG_SENSORS_SMSC47M192 is not set 1005# CONFIG_SENSORS_SMSC47M192 is not set
963# CONFIG_SENSORS_SMSC47B397 is not set 1006# CONFIG_SENSORS_SMSC47B397 is not set
1007# CONFIG_SENSORS_ADS7828 is not set
964# CONFIG_SENSORS_THMC50 is not set 1008# CONFIG_SENSORS_THMC50 is not set
965# CONFIG_SENSORS_VT1211 is not set 1009# CONFIG_SENSORS_VT1211 is not set
966# CONFIG_SENSORS_W83781D is not set 1010# CONFIG_SENSORS_W83781D is not set
@@ -968,9 +1012,12 @@ CONFIG_HWMON=y
968# CONFIG_SENSORS_W83792D is not set 1012# CONFIG_SENSORS_W83792D is not set
969# CONFIG_SENSORS_W83793 is not set 1013# CONFIG_SENSORS_W83793 is not set
970# CONFIG_SENSORS_W83L785TS is not set 1014# CONFIG_SENSORS_W83L785TS is not set
1015# CONFIG_SENSORS_W83L786NG is not set
971# CONFIG_SENSORS_W83627HF is not set 1016# CONFIG_SENSORS_W83627HF is not set
972# CONFIG_SENSORS_W83627EHF is not set 1017# CONFIG_SENSORS_W83627EHF is not set
973# CONFIG_HWMON_DEBUG_CHIP is not set 1018# CONFIG_HWMON_DEBUG_CHIP is not set
1019# CONFIG_THERMAL is not set
1020# CONFIG_THERMAL_HWMON is not set
974CONFIG_WATCHDOG=y 1021CONFIG_WATCHDOG=y
975# CONFIG_WATCHDOG_NOWAYOUT is not set 1022# CONFIG_WATCHDOG_NOWAYOUT is not set
976 1023
@@ -986,23 +1033,30 @@ CONFIG_BFIN_WDT=y
986# CONFIG_USBPCWATCHDOG is not set 1033# CONFIG_USBPCWATCHDOG is not set
987 1034
988# 1035#
989# Sonics Silicon Backplane
990#
991CONFIG_SSB_POSSIBLE=y
992# CONFIG_SSB is not set
993
994#
995# Multifunction device drivers 1036# Multifunction device drivers
996# 1037#
1038# CONFIG_MFD_CORE is not set
997# CONFIG_MFD_SM501 is not set 1039# CONFIG_MFD_SM501 is not set
1040# CONFIG_HTC_PASIC3 is not set
1041# CONFIG_MFD_TMIO is not set
1042# CONFIG_MFD_WM8400 is not set
1043# CONFIG_MFD_WM8350_I2C is not set
998 1044
999# 1045#
1000# Multimedia devices 1046# Multimedia devices
1001# 1047#
1048
1049#
1050# Multimedia core support
1051#
1002# CONFIG_VIDEO_DEV is not set 1052# CONFIG_VIDEO_DEV is not set
1003# CONFIG_DVB_CORE is not set 1053# CONFIG_DVB_CORE is not set
1054# CONFIG_VIDEO_MEDIA is not set
1055
1056#
1057# Multimedia drivers
1058#
1004# CONFIG_DAB is not set 1059# CONFIG_DAB is not set
1005# CONFIG_USB_DABUSB is not set
1006 1060
1007# 1061#
1008# Graphics support 1062# Graphics support
@@ -1012,6 +1066,7 @@ CONFIG_SSB_POSSIBLE=y
1012CONFIG_FB=y 1066CONFIG_FB=y
1013CONFIG_FIRMWARE_EDID=y 1067CONFIG_FIRMWARE_EDID=y
1014# CONFIG_FB_DDC is not set 1068# CONFIG_FB_DDC is not set
1069# CONFIG_FB_BOOT_VESA_SUPPORT is not set
1015CONFIG_FB_CFB_FILLRECT=y 1070CONFIG_FB_CFB_FILLRECT=y
1016CONFIG_FB_CFB_COPYAREA=y 1071CONFIG_FB_CFB_COPYAREA=y
1017CONFIG_FB_CFB_IMAGEBLIT=y 1072CONFIG_FB_CFB_IMAGEBLIT=y
@@ -1019,8 +1074,8 @@ CONFIG_FB_CFB_IMAGEBLIT=y
1019# CONFIG_FB_SYS_FILLRECT is not set 1074# CONFIG_FB_SYS_FILLRECT is not set
1020# CONFIG_FB_SYS_COPYAREA is not set 1075# CONFIG_FB_SYS_COPYAREA is not set
1021# CONFIG_FB_SYS_IMAGEBLIT is not set 1076# CONFIG_FB_SYS_IMAGEBLIT is not set
1077# CONFIG_FB_FOREIGN_ENDIAN is not set
1022# CONFIG_FB_SYS_FOPS is not set 1078# CONFIG_FB_SYS_FOPS is not set
1023CONFIG_FB_DEFERRED_IO=y
1024# CONFIG_FB_SVGALIB is not set 1079# CONFIG_FB_SVGALIB is not set
1025# CONFIG_FB_MACMODES is not set 1080# CONFIG_FB_MACMODES is not set
1026# CONFIG_FB_BACKLIGHT is not set 1081# CONFIG_FB_BACKLIGHT is not set
@@ -1032,9 +1087,11 @@ CONFIG_FB_DEFERRED_IO=y
1032# 1087#
1033CONFIG_FB_BF54X_LQ043=y 1088CONFIG_FB_BF54X_LQ043=y
1034# CONFIG_FB_BFIN_T350MCQB is not set 1089# CONFIG_FB_BFIN_T350MCQB is not set
1090# CONFIG_FB_BFIN_LQ035Q1 is not set
1035# CONFIG_FB_BFIN_7393 is not set 1091# CONFIG_FB_BFIN_7393 is not set
1036# CONFIG_FB_S1D13XXX is not set 1092# CONFIG_FB_S1D13XXX is not set
1037# CONFIG_FB_VIRTUAL is not set 1093# CONFIG_FB_VIRTUAL is not set
1094# CONFIG_FB_METRONOME is not set
1038# CONFIG_BACKLIGHT_LCD_SUPPORT is not set 1095# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
1039 1096
1040# 1097#
@@ -1066,15 +1123,8 @@ CONFIG_LOGO=y
1066# CONFIG_LOGO_LINUX_CLUT224 is not set 1123# CONFIG_LOGO_LINUX_CLUT224 is not set
1067# CONFIG_LOGO_BLACKFIN_VGA16 is not set 1124# CONFIG_LOGO_BLACKFIN_VGA16 is not set
1068CONFIG_LOGO_BLACKFIN_CLUT224=y 1125CONFIG_LOGO_BLACKFIN_CLUT224=y
1069
1070#
1071# Sound
1072#
1073CONFIG_SOUND=y 1126CONFIG_SOUND=y
1074 1127CONFIG_SOUND_OSS_CORE=y
1075#
1076# Advanced Linux Sound Architecture
1077#
1078CONFIG_SND=y 1128CONFIG_SND=y
1079CONFIG_SND_TIMER=y 1129CONFIG_SND_TIMER=y
1080CONFIG_SND_PCM=y 1130CONFIG_SND_PCM=y
@@ -1088,56 +1138,35 @@ CONFIG_SND_SUPPORT_OLD_API=y
1088CONFIG_SND_VERBOSE_PROCFS=y 1138CONFIG_SND_VERBOSE_PROCFS=y
1089# CONFIG_SND_VERBOSE_PRINTK is not set 1139# CONFIG_SND_VERBOSE_PRINTK is not set
1090# CONFIG_SND_DEBUG is not set 1140# CONFIG_SND_DEBUG is not set
1091 1141CONFIG_SND_DRIVERS=y
1092#
1093# Generic devices
1094#
1095# CONFIG_SND_DUMMY is not set 1142# CONFIG_SND_DUMMY is not set
1096# CONFIG_SND_MTPAV is not set 1143# CONFIG_SND_MTPAV is not set
1097# CONFIG_SND_SERIAL_U16550 is not set 1144# CONFIG_SND_SERIAL_U16550 is not set
1098# CONFIG_SND_MPU401 is not set 1145# CONFIG_SND_MPU401 is not set
1099 1146CONFIG_SND_SPI=y
1100#
1101# SPI devices
1102#
1103 1147
1104# 1148#
1105# ALSA Blackfin devices 1149# ALSA Blackfin devices
1106# 1150#
1107# CONFIG_SND_BLACKFIN_AD1836 is not set 1151# CONFIG_SND_BLACKFIN_AD1836 is not set
1108# CONFIG_SND_BFIN_AD73311 is not set
1109# CONFIG_SND_BFIN_AD73322 is not set 1152# CONFIG_SND_BFIN_AD73322 is not set
1110 1153CONFIG_SND_USB=y
1111#
1112# USB devices
1113#
1114# CONFIG_SND_USB_AUDIO is not set 1154# CONFIG_SND_USB_AUDIO is not set
1115# CONFIG_SND_USB_CAIAQ is not set 1155# CONFIG_SND_USB_CAIAQ is not set
1116
1117#
1118# System on Chip audio support
1119#
1120CONFIG_SND_SOC_AC97_BUS=y
1121CONFIG_SND_SOC=y 1156CONFIG_SND_SOC=y
1122CONFIG_SND_BF5XX_SOC=y 1157CONFIG_SND_SOC_AC97_BUS=y
1123CONFIG_SND_MMAP_SUPPORT=y 1158# CONFIG_SND_BF5XX_I2S is not set
1159CONFIG_SND_BF5XX_AC97=y
1160CONFIG_SND_BF5XX_MMAP_SUPPORT=y
1161# CONFIG_SND_BF5XX_MULTICHAN_SUPPORT is not set
1162CONFIG_SND_BF5XX_SOC_SPORT=y
1124CONFIG_SND_BF5XX_SOC_AC97=y 1163CONFIG_SND_BF5XX_SOC_AC97=y
1125CONFIG_SND_BF5XX_SOC_BF548_EZKIT=y 1164CONFIG_SND_BF5XX_SOC_AD1980=y
1126# CONFIG_SND_BF5XX_SOC_WM8750 is not set
1127# CONFIG_SND_BF5XX_SOC_WM8731 is not set
1128# CONFIG_SND_BF5XX_SOC_SSM2602 is not set
1129CONFIG_SND_BF5XX_SPORT_NUM=0 1165CONFIG_SND_BF5XX_SPORT_NUM=0
1130CONFIG_SND_BF5XX_HAVE_COLD_RESET=y 1166CONFIG_SND_BF5XX_HAVE_COLD_RESET=y
1131CONFIG_SND_BF5XX_RESET_GPIO_NUM=19 1167CONFIG_SND_BF5XX_RESET_GPIO_NUM=19
1132 1168# CONFIG_SND_SOC_ALL_CODECS is not set
1133#
1134# SoC Audio support for SuperH
1135#
1136CONFIG_SND_SOC_AD1980=y 1169CONFIG_SND_SOC_AD1980=y
1137
1138#
1139# Open Sound System
1140#
1141# CONFIG_SOUND_PRIME is not set 1170# CONFIG_SOUND_PRIME is not set
1142CONFIG_AC97_BUS=y 1171CONFIG_AC97_BUS=y
1143CONFIG_HID_SUPPORT=y 1172CONFIG_HID_SUPPORT=y
@@ -1149,15 +1178,43 @@ CONFIG_HID=y
1149# USB Input Devices 1178# USB Input Devices
1150# 1179#
1151CONFIG_USB_HID=y 1180CONFIG_USB_HID=y
1152# CONFIG_USB_HIDINPUT_POWERBOOK is not set 1181# CONFIG_HID_PID is not set
1153# CONFIG_HID_FF is not set
1154# CONFIG_USB_HIDDEV is not set 1182# CONFIG_USB_HIDDEV is not set
1183
1184#
1185# Special HID drivers
1186#
1187CONFIG_HID_COMPAT=y
1188CONFIG_HID_A4TECH=y
1189CONFIG_HID_APPLE=y
1190CONFIG_HID_BELKIN=y
1191CONFIG_HID_BRIGHT=y
1192CONFIG_HID_CHERRY=y
1193CONFIG_HID_CHICONY=y
1194CONFIG_HID_CYPRESS=y
1195CONFIG_HID_DELL=y
1196CONFIG_HID_EZKEY=y
1197CONFIG_HID_GYRATION=y
1198CONFIG_HID_LOGITECH=y
1199# CONFIG_LOGITECH_FF is not set
1200# CONFIG_LOGIRUMBLEPAD2_FF is not set
1201CONFIG_HID_MICROSOFT=y
1202CONFIG_HID_MONTEREY=y
1203CONFIG_HID_PANTHERLORD=y
1204# CONFIG_PANTHERLORD_FF is not set
1205CONFIG_HID_PETALYNX=y
1206CONFIG_HID_SAMSUNG=y
1207CONFIG_HID_SONY=y
1208CONFIG_HID_SUNPLUS=y
1209CONFIG_THRUSTMASTER_FF=m
1210CONFIG_ZEROPLUS_FF=m
1155CONFIG_USB_SUPPORT=y 1211CONFIG_USB_SUPPORT=y
1156CONFIG_USB_ARCH_HAS_HCD=y 1212CONFIG_USB_ARCH_HAS_HCD=y
1157# CONFIG_USB_ARCH_HAS_OHCI is not set 1213# CONFIG_USB_ARCH_HAS_OHCI is not set
1158# CONFIG_USB_ARCH_HAS_EHCI is not set 1214# CONFIG_USB_ARCH_HAS_EHCI is not set
1159CONFIG_USB=y 1215CONFIG_USB=y
1160# CONFIG_USB_DEBUG is not set 1216# CONFIG_USB_DEBUG is not set
1217# CONFIG_USB_ANNOUNCE_NEW_DEVICES is not set
1161 1218
1162# 1219#
1163# Miscellaneous USB options 1220# Miscellaneous USB options
@@ -1168,15 +1225,20 @@ CONFIG_USB_DEVICE_CLASS=y
1168# CONFIG_USB_OTG is not set 1225# CONFIG_USB_OTG is not set
1169# CONFIG_USB_OTG_WHITELIST is not set 1226# CONFIG_USB_OTG_WHITELIST is not set
1170CONFIG_USB_OTG_BLACKLIST_HUB=y 1227CONFIG_USB_OTG_BLACKLIST_HUB=y
1228CONFIG_USB_MON=y
1229# CONFIG_USB_WUSB is not set
1230# CONFIG_USB_WUSB_CBAF is not set
1171 1231
1172# 1232#
1173# USB Host Controller Drivers 1233# USB Host Controller Drivers
1174# 1234#
1235# CONFIG_USB_C67X00_HCD is not set
1175# CONFIG_USB_ISP116X_HCD is not set 1236# CONFIG_USB_ISP116X_HCD is not set
1176# CONFIG_USB_ISP1362_HCD is not set
1177# CONFIG_USB_ISP1760_HCD is not set 1237# CONFIG_USB_ISP1760_HCD is not set
1238# CONFIG_USB_ISP1362_HCD is not set
1178# CONFIG_USB_SL811_HCD is not set 1239# CONFIG_USB_SL811_HCD is not set
1179# CONFIG_USB_R8A66597_HCD is not set 1240# CONFIG_USB_R8A66597_HCD is not set
1241# CONFIG_USB_HWA_HCD is not set
1180CONFIG_USB_MUSB_HDRC=y 1242CONFIG_USB_MUSB_HDRC=y
1181CONFIG_USB_MUSB_SOC=y 1243CONFIG_USB_MUSB_SOC=y
1182 1244
@@ -1190,13 +1252,15 @@ CONFIG_USB_MUSB_HDRC_HCD=y
1190# CONFIG_MUSB_PIO_ONLY is not set 1252# CONFIG_MUSB_PIO_ONLY is not set
1191CONFIG_USB_INVENTRA_DMA=y 1253CONFIG_USB_INVENTRA_DMA=y
1192# CONFIG_USB_TI_CPPI_DMA is not set 1254# CONFIG_USB_TI_CPPI_DMA is not set
1193CONFIG_USB_MUSB_LOGLEVEL=0 1255# CONFIG_USB_MUSB_DEBUG is not set
1194 1256
1195# 1257#
1196# USB Device Class drivers 1258# USB Device Class drivers
1197# 1259#
1198# CONFIG_USB_ACM is not set 1260# CONFIG_USB_ACM is not set
1199# CONFIG_USB_PRINTER is not set 1261# CONFIG_USB_PRINTER is not set
1262# CONFIG_USB_WDM is not set
1263# CONFIG_USB_TMC is not set
1200 1264
1201# 1265#
1202# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' 1266# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
@@ -1218,6 +1282,7 @@ CONFIG_USB_STORAGE=m
1218# CONFIG_USB_STORAGE_ALAUDA is not set 1282# CONFIG_USB_STORAGE_ALAUDA is not set
1219# CONFIG_USB_STORAGE_ONETOUCH is not set 1283# CONFIG_USB_STORAGE_ONETOUCH is not set
1220# CONFIG_USB_STORAGE_KARMA is not set 1284# CONFIG_USB_STORAGE_KARMA is not set
1285# CONFIG_USB_STORAGE_CYPRESS_ATACB is not set
1221# CONFIG_USB_LIBUSUAL is not set 1286# CONFIG_USB_LIBUSUAL is not set
1222 1287
1223# 1288#
@@ -1225,15 +1290,10 @@ CONFIG_USB_STORAGE=m
1225# 1290#
1226# CONFIG_USB_MDC800 is not set 1291# CONFIG_USB_MDC800 is not set
1227# CONFIG_USB_MICROTEK is not set 1292# CONFIG_USB_MICROTEK is not set
1228CONFIG_USB_MON=y
1229 1293
1230# 1294#
1231# USB port drivers 1295# USB port drivers
1232# 1296#
1233
1234#
1235# USB Serial Converter support
1236#
1237# CONFIG_USB_SERIAL is not set 1297# CONFIG_USB_SERIAL is not set
1238 1298
1239# 1299#
@@ -1242,7 +1302,7 @@ CONFIG_USB_MON=y
1242# CONFIG_USB_EMI62 is not set 1302# CONFIG_USB_EMI62 is not set
1243# CONFIG_USB_EMI26 is not set 1303# CONFIG_USB_EMI26 is not set
1244# CONFIG_USB_ADUTUX is not set 1304# CONFIG_USB_ADUTUX is not set
1245# CONFIG_USB_AUERSWALD is not set 1305# CONFIG_USB_SEVSEG is not set
1246# CONFIG_USB_RIO500 is not set 1306# CONFIG_USB_RIO500 is not set
1247# CONFIG_USB_LEGOTOWER is not set 1307# CONFIG_USB_LEGOTOWER is not set
1248# CONFIG_USB_LCD is not set 1308# CONFIG_USB_LCD is not set
@@ -1258,34 +1318,31 @@ CONFIG_USB_MON=y
1258# CONFIG_USB_LD is not set 1318# CONFIG_USB_LD is not set
1259# CONFIG_USB_TRANCEVIBRATOR is not set 1319# CONFIG_USB_TRANCEVIBRATOR is not set
1260# CONFIG_USB_IOWARRIOR is not set 1320# CONFIG_USB_IOWARRIOR is not set
1261 1321# CONFIG_USB_ISIGHTFW is not set
1262# 1322# CONFIG_USB_VST is not set
1263# USB DSL modem support
1264#
1265
1266#
1267# USB Gadget Support
1268#
1269# CONFIG_USB_GADGET is not set 1323# CONFIG_USB_GADGET is not set
1270CONFIG_MMC=m 1324CONFIG_MMC=m
1271# CONFIG_MMC_DEBUG is not set 1325# CONFIG_MMC_DEBUG is not set
1272# CONFIG_MMC_UNSAFE_RESUME is not set 1326# CONFIG_MMC_UNSAFE_RESUME is not set
1273 1327
1274# 1328#
1275# MMC/SD Card Drivers 1329# MMC/SD/SDIO Card Drivers
1276# 1330#
1277CONFIG_MMC_BLOCK=m 1331CONFIG_MMC_BLOCK=m
1278CONFIG_MMC_BLOCK_BOUNCE=y 1332CONFIG_MMC_BLOCK_BOUNCE=y
1279# CONFIG_SDIO_UART is not set 1333# CONFIG_SDIO_UART is not set
1334# CONFIG_MMC_TEST is not set
1280 1335
1281# 1336#
1282# MMC/SD Host Controller Drivers 1337# MMC/SD/SDIO Host Controller Drivers
1283# 1338#
1339# CONFIG_MMC_SDHCI is not set
1284CONFIG_SDH_BFIN=m 1340CONFIG_SDH_BFIN=m
1285# CONFIG_SDH_BFIN_MISSING_CMD_PULLUP_WORKAROUND is not set 1341# CONFIG_SDH_BFIN_MISSING_CMD_PULLUP_WORKAROUND is not set
1286# CONFIG_MMC_SPI is not set 1342# CONFIG_MMC_SPI is not set
1287# CONFIG_SPI_MMC is not set 1343# CONFIG_MEMSTICK is not set
1288# CONFIG_NEW_LEDS is not set 1344# CONFIG_NEW_LEDS is not set
1345# CONFIG_ACCESSIBILITY is not set
1289CONFIG_RTC_LIB=y 1346CONFIG_RTC_LIB=y
1290CONFIG_RTC_CLASS=y 1347CONFIG_RTC_CLASS=y
1291CONFIG_RTC_HCTOSYS=y 1348CONFIG_RTC_HCTOSYS=y
@@ -1314,32 +1371,40 @@ CONFIG_RTC_INTF_DEV=y
1314# CONFIG_RTC_DRV_PCF8563 is not set 1371# CONFIG_RTC_DRV_PCF8563 is not set
1315# CONFIG_RTC_DRV_PCF8583 is not set 1372# CONFIG_RTC_DRV_PCF8583 is not set
1316# CONFIG_RTC_DRV_M41T80 is not set 1373# CONFIG_RTC_DRV_M41T80 is not set
1374# CONFIG_RTC_DRV_S35390A is not set
1375# CONFIG_RTC_DRV_FM3130 is not set
1317 1376
1318# 1377#
1319# SPI RTC drivers 1378# SPI RTC drivers
1320# 1379#
1321# CONFIG_RTC_DRV_RS5C348 is not set 1380# CONFIG_RTC_DRV_M41T94 is not set
1381# CONFIG_RTC_DRV_DS1305 is not set
1322# CONFIG_RTC_DRV_MAX6902 is not set 1382# CONFIG_RTC_DRV_MAX6902 is not set
1383# CONFIG_RTC_DRV_R9701 is not set
1384# CONFIG_RTC_DRV_RS5C348 is not set
1385# CONFIG_RTC_DRV_DS3234 is not set
1323 1386
1324# 1387#
1325# Platform RTC drivers 1388# Platform RTC drivers
1326# 1389#
1390# CONFIG_RTC_DRV_DS1286 is not set
1391# CONFIG_RTC_DRV_DS1511 is not set
1327# CONFIG_RTC_DRV_DS1553 is not set 1392# CONFIG_RTC_DRV_DS1553 is not set
1328# CONFIG_RTC_DRV_STK17TA8 is not set
1329# CONFIG_RTC_DRV_DS1742 is not set 1393# CONFIG_RTC_DRV_DS1742 is not set
1394# CONFIG_RTC_DRV_STK17TA8 is not set
1330# CONFIG_RTC_DRV_M48T86 is not set 1395# CONFIG_RTC_DRV_M48T86 is not set
1396# CONFIG_RTC_DRV_M48T35 is not set
1331# CONFIG_RTC_DRV_M48T59 is not set 1397# CONFIG_RTC_DRV_M48T59 is not set
1398# CONFIG_RTC_DRV_BQ4802 is not set
1332# CONFIG_RTC_DRV_V3020 is not set 1399# CONFIG_RTC_DRV_V3020 is not set
1333 1400
1334# 1401#
1335# on-CPU RTC drivers 1402# on-CPU RTC drivers
1336# 1403#
1337CONFIG_RTC_DRV_BFIN=y 1404CONFIG_RTC_DRV_BFIN=y
1338 1405# CONFIG_DMADEVICES is not set
1339#
1340# Userspace I/O
1341#
1342# CONFIG_UIO is not set 1406# CONFIG_UIO is not set
1407# CONFIG_STAGING is not set
1343 1408
1344# 1409#
1345# File systems 1410# File systems
@@ -1352,22 +1417,20 @@ CONFIG_EXT3_FS=y
1352CONFIG_EXT3_FS_XATTR=y 1417CONFIG_EXT3_FS_XATTR=y
1353# CONFIG_EXT3_FS_POSIX_ACL is not set 1418# CONFIG_EXT3_FS_POSIX_ACL is not set
1354# CONFIG_EXT3_FS_SECURITY is not set 1419# CONFIG_EXT3_FS_SECURITY is not set
1355# CONFIG_EXT4DEV_FS is not set 1420# CONFIG_EXT4_FS is not set
1356CONFIG_JBD=y 1421CONFIG_JBD=y
1357# CONFIG_JBD_DEBUG is not set 1422# CONFIG_JBD_DEBUG is not set
1358CONFIG_FS_MBCACHE=y 1423CONFIG_FS_MBCACHE=y
1359# CONFIG_REISERFS_FS is not set 1424# CONFIG_REISERFS_FS is not set
1360# CONFIG_JFS_FS is not set 1425# CONFIG_JFS_FS is not set
1361# CONFIG_FS_POSIX_ACL is not set 1426# CONFIG_FS_POSIX_ACL is not set
1427CONFIG_FILE_LOCKING=y
1362# CONFIG_XFS_FS is not set 1428# CONFIG_XFS_FS is not set
1363# CONFIG_GFS2_FS is not set
1364# CONFIG_OCFS2_FS is not set 1429# CONFIG_OCFS2_FS is not set
1365# CONFIG_MINIX_FS is not set 1430# CONFIG_DNOTIFY is not set
1366# CONFIG_ROMFS_FS is not set
1367CONFIG_INOTIFY=y 1431CONFIG_INOTIFY=y
1368CONFIG_INOTIFY_USER=y 1432CONFIG_INOTIFY_USER=y
1369# CONFIG_QUOTA is not set 1433# CONFIG_QUOTA is not set
1370# CONFIG_DNOTIFY is not set
1371# CONFIG_AUTOFS_FS is not set 1434# CONFIG_AUTOFS_FS is not set
1372# CONFIG_AUTOFS4_FS is not set 1435# CONFIG_AUTOFS4_FS is not set
1373# CONFIG_FUSE_FS is not set 1436# CONFIG_FUSE_FS is not set
@@ -1414,11 +1477,11 @@ CONFIG_SYSFS=y
1414# CONFIG_EFS_FS is not set 1477# CONFIG_EFS_FS is not set
1415CONFIG_YAFFS_FS=m 1478CONFIG_YAFFS_FS=m
1416CONFIG_YAFFS_YAFFS1=y 1479CONFIG_YAFFS_YAFFS1=y
1480# CONFIG_YAFFS_9BYTE_TAGS is not set
1417# CONFIG_YAFFS_DOES_ECC is not set 1481# CONFIG_YAFFS_DOES_ECC is not set
1418CONFIG_YAFFS_YAFFS2=y 1482CONFIG_YAFFS_YAFFS2=y
1419CONFIG_YAFFS_AUTO_YAFFS2=y 1483CONFIG_YAFFS_AUTO_YAFFS2=y
1420# CONFIG_YAFFS_DISABLE_LAZY_LOAD is not set 1484# CONFIG_YAFFS_DISABLE_LAZY_LOAD is not set
1421CONFIG_YAFFS_CHECKPOINT_RESERVED_BLOCKS=10
1422# CONFIG_YAFFS_DISABLE_WIDE_TNODES is not set 1485# CONFIG_YAFFS_DISABLE_WIDE_TNODES is not set
1423# CONFIG_YAFFS_ALWAYS_CHECK_CHUNK_ERASED is not set 1486# CONFIG_YAFFS_ALWAYS_CHECK_CHUNK_ERASED is not set
1424CONFIG_YAFFS_SHORT_NAMES_IN_RAM=y 1487CONFIG_YAFFS_SHORT_NAMES_IN_RAM=y
@@ -1435,8 +1498,11 @@ CONFIG_JFFS2_RTIME=y
1435# CONFIG_JFFS2_RUBIN is not set 1498# CONFIG_JFFS2_RUBIN is not set
1436# CONFIG_CRAMFS is not set 1499# CONFIG_CRAMFS is not set
1437# CONFIG_VXFS_FS is not set 1500# CONFIG_VXFS_FS is not set
1501# CONFIG_MINIX_FS is not set
1502# CONFIG_OMFS_FS is not set
1438# CONFIG_HPFS_FS is not set 1503# CONFIG_HPFS_FS is not set
1439# CONFIG_QNX4FS_FS is not set 1504# CONFIG_QNX4FS_FS is not set
1505# CONFIG_ROMFS_FS is not set
1440# CONFIG_SYSV_FS is not set 1506# CONFIG_SYSV_FS is not set
1441# CONFIG_UFS_FS is not set 1507# CONFIG_UFS_FS is not set
1442CONFIG_NETWORK_FILESYSTEMS=y 1508CONFIG_NETWORK_FILESYSTEMS=y
@@ -1444,18 +1510,16 @@ CONFIG_NFS_FS=m
1444CONFIG_NFS_V3=y 1510CONFIG_NFS_V3=y
1445# CONFIG_NFS_V3_ACL is not set 1511# CONFIG_NFS_V3_ACL is not set
1446# CONFIG_NFS_V4 is not set 1512# CONFIG_NFS_V4 is not set
1447# CONFIG_NFS_DIRECTIO is not set
1448CONFIG_NFSD=m 1513CONFIG_NFSD=m
1449CONFIG_NFSD_V3=y 1514CONFIG_NFSD_V3=y
1450# CONFIG_NFSD_V3_ACL is not set 1515# CONFIG_NFSD_V3_ACL is not set
1451# CONFIG_NFSD_V4 is not set 1516# CONFIG_NFSD_V4 is not set
1452CONFIG_NFSD_TCP=y
1453CONFIG_LOCKD=m 1517CONFIG_LOCKD=m
1454CONFIG_LOCKD_V4=y 1518CONFIG_LOCKD_V4=y
1455CONFIG_EXPORTFS=m 1519CONFIG_EXPORTFS=m
1456CONFIG_NFS_COMMON=y 1520CONFIG_NFS_COMMON=y
1457CONFIG_SUNRPC=m 1521CONFIG_SUNRPC=m
1458# CONFIG_SUNRPC_BIND34 is not set 1522# CONFIG_SUNRPC_REGISTER_V4 is not set
1459# CONFIG_RPCSEC_GSS_KRB5 is not set 1523# CONFIG_RPCSEC_GSS_KRB5 is not set
1460# CONFIG_RPCSEC_GSS_SPKM3 is not set 1524# CONFIG_RPCSEC_GSS_SPKM3 is not set
1461CONFIG_SMB_FS=m 1525CONFIG_SMB_FS=m
@@ -1533,9 +1597,6 @@ CONFIG_NLS_KOI8_R=m
1533CONFIG_NLS_KOI8_U=m 1597CONFIG_NLS_KOI8_U=m
1534CONFIG_NLS_UTF8=m 1598CONFIG_NLS_UTF8=m
1535# CONFIG_DLM is not set 1599# CONFIG_DLM is not set
1536CONFIG_INSTRUMENTATION=y
1537# CONFIG_PROFILING is not set
1538# CONFIG_MARKERS is not set
1539 1600
1540# 1601#
1541# Kernel hacking 1602# Kernel hacking
@@ -1543,14 +1604,53 @@ CONFIG_INSTRUMENTATION=y
1543# CONFIG_PRINTK_TIME is not set 1604# CONFIG_PRINTK_TIME is not set
1544CONFIG_ENABLE_WARN_DEPRECATED=y 1605CONFIG_ENABLE_WARN_DEPRECATED=y
1545CONFIG_ENABLE_MUST_CHECK=y 1606CONFIG_ENABLE_MUST_CHECK=y
1607CONFIG_FRAME_WARN=1024
1546# CONFIG_MAGIC_SYSRQ is not set 1608# CONFIG_MAGIC_SYSRQ is not set
1547# CONFIG_UNUSED_SYMBOLS is not set 1609# CONFIG_UNUSED_SYMBOLS is not set
1548CONFIG_DEBUG_FS=y 1610CONFIG_DEBUG_FS=y
1549# CONFIG_HEADERS_CHECK is not set 1611# CONFIG_HEADERS_CHECK is not set
1550# CONFIG_DEBUG_KERNEL is not set 1612CONFIG_DEBUG_KERNEL=y
1613# CONFIG_DEBUG_SHIRQ is not set
1614CONFIG_DETECT_SOFTLOCKUP=y
1615# CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC is not set
1616CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE=0
1617CONFIG_SCHED_DEBUG=y
1618# CONFIG_SCHEDSTATS is not set
1619# CONFIG_TIMER_STATS is not set
1620# CONFIG_DEBUG_OBJECTS is not set
1621# CONFIG_DEBUG_SLAB is not set
1622# CONFIG_DEBUG_RT_MUTEXES is not set
1623# CONFIG_RT_MUTEX_TESTER is not set
1624# CONFIG_DEBUG_SPINLOCK is not set
1625# CONFIG_DEBUG_MUTEXES is not set
1626# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
1627# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
1628# CONFIG_DEBUG_KOBJECT is not set
1551# CONFIG_DEBUG_BUGVERBOSE is not set 1629# CONFIG_DEBUG_BUGVERBOSE is not set
1630CONFIG_DEBUG_INFO=y
1631# CONFIG_DEBUG_VM is not set
1632# CONFIG_DEBUG_WRITECOUNT is not set
1633# CONFIG_DEBUG_MEMORY_INIT is not set
1634# CONFIG_DEBUG_LIST is not set
1635# CONFIG_DEBUG_SG is not set
1636# CONFIG_FRAME_POINTER is not set
1637# CONFIG_BOOT_PRINTK_DELAY is not set
1638# CONFIG_RCU_TORTURE_TEST is not set
1639# CONFIG_RCU_CPU_STALL_DETECTOR is not set
1640# CONFIG_BACKTRACE_SELF_TEST is not set
1641# CONFIG_DEBUG_BLOCK_EXT_DEVT is not set
1642# CONFIG_FAULT_INJECTION is not set
1643# CONFIG_SYSCTL_SYSCALL_CHECK is not set
1644# CONFIG_DYNAMIC_PRINTK_DEBUG is not set
1552# CONFIG_SAMPLES is not set 1645# CONFIG_SAMPLES is not set
1646CONFIG_HAVE_ARCH_KGDB=y
1647# CONFIG_KGDB is not set
1648# CONFIG_DEBUG_STACKOVERFLOW is not set
1649# CONFIG_DEBUG_STACK_USAGE is not set
1650CONFIG_DEBUG_VERBOSE=y
1553CONFIG_DEBUG_MMRS=y 1651CONFIG_DEBUG_MMRS=y
1652# CONFIG_DEBUG_HWERR is not set
1653# CONFIG_DEBUG_DOUBLEFAULT is not set
1554CONFIG_DEBUG_HUNT_FOR_ZERO=y 1654CONFIG_DEBUG_HUNT_FOR_ZERO=y
1555CONFIG_DEBUG_BFIN_HWTRACE_ON=y 1655CONFIG_DEBUG_BFIN_HWTRACE_ON=y
1556CONFIG_DEBUG_BFIN_HWTRACE_COMPRESSION_OFF=y 1656CONFIG_DEBUG_BFIN_HWTRACE_COMPRESSION_OFF=y
@@ -1568,10 +1668,95 @@ CONFIG_ACCESS_CHECK=y
1568# 1668#
1569# CONFIG_KEYS is not set 1669# CONFIG_KEYS is not set
1570CONFIG_SECURITY=y 1670CONFIG_SECURITY=y
1671# CONFIG_SECURITYFS is not set
1571# CONFIG_SECURITY_NETWORK is not set 1672# CONFIG_SECURITY_NETWORK is not set
1572# CONFIG_SECURITY_CAPABILITIES is not set 1673# CONFIG_SECURITY_FILE_CAPABILITIES is not set
1573# CONFIG_SECURITY_ROOTPLUG is not set 1674# CONFIG_SECURITY_ROOTPLUG is not set
1574# CONFIG_CRYPTO is not set 1675CONFIG_SECURITY_DEFAULT_MMAP_MIN_ADDR=0
1676CONFIG_CRYPTO=y
1677
1678#
1679# Crypto core or helper
1680#
1681# CONFIG_CRYPTO_FIPS is not set
1682# CONFIG_CRYPTO_MANAGER is not set
1683# CONFIG_CRYPTO_GF128MUL is not set
1684# CONFIG_CRYPTO_NULL is not set
1685# CONFIG_CRYPTO_CRYPTD is not set
1686# CONFIG_CRYPTO_AUTHENC is not set
1687# CONFIG_CRYPTO_TEST is not set
1688
1689#
1690# Authenticated Encryption with Associated Data
1691#
1692# CONFIG_CRYPTO_CCM is not set
1693# CONFIG_CRYPTO_GCM is not set
1694# CONFIG_CRYPTO_SEQIV is not set
1695
1696#
1697# Block modes
1698#
1699# CONFIG_CRYPTO_CBC is not set
1700# CONFIG_CRYPTO_CTR is not set
1701# CONFIG_CRYPTO_CTS is not set
1702# CONFIG_CRYPTO_ECB is not set
1703# CONFIG_CRYPTO_LRW is not set
1704# CONFIG_CRYPTO_PCBC is not set
1705# CONFIG_CRYPTO_XTS is not set
1706
1707#
1708# Hash modes
1709#
1710# CONFIG_CRYPTO_HMAC is not set
1711# CONFIG_CRYPTO_XCBC is not set
1712
1713#
1714# Digest
1715#
1716# CONFIG_CRYPTO_CRC32C is not set
1717# CONFIG_CRYPTO_MD4 is not set
1718# CONFIG_CRYPTO_MD5 is not set
1719# CONFIG_CRYPTO_MICHAEL_MIC is not set
1720# CONFIG_CRYPTO_RMD128 is not set
1721# CONFIG_CRYPTO_RMD160 is not set
1722# CONFIG_CRYPTO_RMD256 is not set
1723# CONFIG_CRYPTO_RMD320 is not set
1724# CONFIG_CRYPTO_SHA1 is not set
1725# CONFIG_CRYPTO_SHA256 is not set
1726# CONFIG_CRYPTO_SHA512 is not set
1727# CONFIG_CRYPTO_TGR192 is not set
1728# CONFIG_CRYPTO_WP512 is not set
1729
1730#
1731# Ciphers
1732#
1733# CONFIG_CRYPTO_AES is not set
1734# CONFIG_CRYPTO_ANUBIS is not set
1735# CONFIG_CRYPTO_ARC4 is not set
1736# CONFIG_CRYPTO_BLOWFISH is not set
1737# CONFIG_CRYPTO_CAMELLIA is not set
1738# CONFIG_CRYPTO_CAST5 is not set
1739# CONFIG_CRYPTO_CAST6 is not set
1740# CONFIG_CRYPTO_DES is not set
1741# CONFIG_CRYPTO_FCRYPT is not set
1742# CONFIG_CRYPTO_KHAZAD is not set
1743# CONFIG_CRYPTO_SALSA20 is not set
1744# CONFIG_CRYPTO_SEED is not set
1745# CONFIG_CRYPTO_SERPENT is not set
1746# CONFIG_CRYPTO_TEA is not set
1747# CONFIG_CRYPTO_TWOFISH is not set
1748
1749#
1750# Compression
1751#
1752# CONFIG_CRYPTO_DEFLATE is not set
1753# CONFIG_CRYPTO_LZO is not set
1754
1755#
1756# Random Number Generation
1757#
1758# CONFIG_CRYPTO_ANSI_CPRNG is not set
1759CONFIG_CRYPTO_HW=y
1575 1760
1576# 1761#
1577# Library routines 1762# Library routines
@@ -1579,6 +1764,7 @@ CONFIG_SECURITY=y
1579CONFIG_BITREVERSE=y 1764CONFIG_BITREVERSE=y
1580CONFIG_CRC_CCITT=m 1765CONFIG_CRC_CCITT=m
1581# CONFIG_CRC16 is not set 1766# CONFIG_CRC16 is not set
1767# CONFIG_CRC_T10DIF is not set
1582# CONFIG_CRC_ITU_T is not set 1768# CONFIG_CRC_ITU_T is not set
1583CONFIG_CRC32=y 1769CONFIG_CRC32=y
1584# CONFIG_CRC7 is not set 1770# CONFIG_CRC7 is not set
diff --git a/arch/blackfin/configs/BF561-EZKIT_defconfig b/arch/blackfin/configs/BF561-EZKIT_defconfig
index 3c70d6230a12..1ecb7a38c905 100644
--- a/arch/blackfin/configs/BF561-EZKIT_defconfig
+++ b/arch/blackfin/configs/BF561-EZKIT_defconfig
@@ -1,6 +1,6 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.24.7 3# Linux kernel version: 2.6.28-rc2
4# 4#
5# CONFIG_MMU is not set 5# CONFIG_MMU is not set
6# CONFIG_FPU is not set 6# CONFIG_FPU is not set
@@ -8,7 +8,6 @@ CONFIG_RWSEM_GENERIC_SPINLOCK=y
8# CONFIG_RWSEM_XCHGADD_ALGORITHM is not set 8# CONFIG_RWSEM_XCHGADD_ALGORITHM is not set
9CONFIG_BLACKFIN=y 9CONFIG_BLACKFIN=y
10CONFIG_ZONE_DMA=y 10CONFIG_ZONE_DMA=y
11CONFIG_SEMAPHORE_SLEEPERS=y
12CONFIG_GENERIC_FIND_NEXT_BIT=y 11CONFIG_GENERIC_FIND_NEXT_BIT=y
13CONFIG_GENERIC_HWEIGHT=y 12CONFIG_GENERIC_HWEIGHT=y
14CONFIG_GENERIC_HARDIRQS=y 13CONFIG_GENERIC_HARDIRQS=y
@@ -31,18 +30,16 @@ CONFIG_SYSVIPC_SYSCTL=y
31# CONFIG_POSIX_MQUEUE is not set 30# CONFIG_POSIX_MQUEUE is not set
32# CONFIG_BSD_PROCESS_ACCT is not set 31# CONFIG_BSD_PROCESS_ACCT is not set
33# CONFIG_TASKSTATS is not set 32# CONFIG_TASKSTATS is not set
34# CONFIG_USER_NS is not set
35# CONFIG_PID_NS is not set
36# CONFIG_AUDIT is not set 33# CONFIG_AUDIT is not set
37CONFIG_IKCONFIG=y 34CONFIG_IKCONFIG=y
38CONFIG_IKCONFIG_PROC=y 35CONFIG_IKCONFIG_PROC=y
39CONFIG_LOG_BUF_SHIFT=14 36CONFIG_LOG_BUF_SHIFT=14
40# CONFIG_CGROUPS is not set 37# CONFIG_CGROUPS is not set
41CONFIG_FAIR_GROUP_SCHED=y 38# CONFIG_GROUP_SCHED is not set
42CONFIG_FAIR_USER_SCHED=y 39# CONFIG_SYSFS_DEPRECATED is not set
43# CONFIG_FAIR_CGROUP_SCHED is not set 40# CONFIG_SYSFS_DEPRECATED_V2 is not set
44CONFIG_SYSFS_DEPRECATED=y
45# CONFIG_RELAY is not set 41# CONFIG_RELAY is not set
42# CONFIG_NAMESPACES is not set
46CONFIG_BLK_DEV_INITRD=y 43CONFIG_BLK_DEV_INITRD=y
47CONFIG_INITRAMFS_SOURCE="" 44CONFIG_INITRAMFS_SOURCE=""
48# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 45# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
@@ -51,26 +48,35 @@ CONFIG_EMBEDDED=y
51CONFIG_UID16=y 48CONFIG_UID16=y
52CONFIG_SYSCTL_SYSCALL=y 49CONFIG_SYSCTL_SYSCALL=y
53CONFIG_KALLSYMS=y 50CONFIG_KALLSYMS=y
51# CONFIG_KALLSYMS_ALL is not set
54# CONFIG_KALLSYMS_EXTRA_PASS is not set 52# CONFIG_KALLSYMS_EXTRA_PASS is not set
55CONFIG_HOTPLUG=y 53CONFIG_HOTPLUG=y
56CONFIG_PRINTK=y 54CONFIG_PRINTK=y
57CONFIG_BUG=y 55CONFIG_BUG=y
58CONFIG_ELF_CORE=y 56# CONFIG_ELF_CORE is not set
57CONFIG_COMPAT_BRK=y
59CONFIG_BASE_FULL=y 58CONFIG_BASE_FULL=y
60CONFIG_FUTEX=y 59CONFIG_FUTEX=y
61CONFIG_ANON_INODES=y 60CONFIG_ANON_INODES=y
62CONFIG_EPOLL=y 61CONFIG_EPOLL=y
63CONFIG_SIGNALFD=y 62CONFIG_SIGNALFD=y
63CONFIG_TIMERFD=y
64CONFIG_EVENTFD=y 64CONFIG_EVENTFD=y
65CONFIG_AIO=y
65CONFIG_VM_EVENT_COUNTERS=y 66CONFIG_VM_EVENT_COUNTERS=y
66CONFIG_SLAB=y 67CONFIG_SLAB=y
67# CONFIG_SLUB is not set 68# CONFIG_SLUB is not set
68# CONFIG_SLOB is not set 69# CONFIG_SLOB is not set
70# CONFIG_PROFILING is not set
71# CONFIG_MARKERS is not set
72CONFIG_HAVE_OPROFILE=y
73# CONFIG_HAVE_GENERIC_DMA_COHERENT is not set
69CONFIG_SLABINFO=y 74CONFIG_SLABINFO=y
70CONFIG_RT_MUTEXES=y 75CONFIG_RT_MUTEXES=y
71CONFIG_TINY_SHMEM=y 76CONFIG_TINY_SHMEM=y
72CONFIG_BASE_SMALL=0 77CONFIG_BASE_SMALL=0
73CONFIG_MODULES=y 78CONFIG_MODULES=y
79# CONFIG_MODULE_FORCE_LOAD is not set
74CONFIG_MODULE_UNLOAD=y 80CONFIG_MODULE_UNLOAD=y
75# CONFIG_MODULE_FORCE_UNLOAD is not set 81# CONFIG_MODULE_FORCE_UNLOAD is not set
76# CONFIG_MODVERSIONS is not set 82# CONFIG_MODVERSIONS is not set
@@ -81,6 +87,7 @@ CONFIG_BLOCK=y
81# CONFIG_BLK_DEV_IO_TRACE is not set 87# CONFIG_BLK_DEV_IO_TRACE is not set
82# CONFIG_LSF is not set 88# CONFIG_LSF is not set
83# CONFIG_BLK_DEV_BSG is not set 89# CONFIG_BLK_DEV_BSG is not set
90# CONFIG_BLK_DEV_INTEGRITY is not set
84 91
85# 92#
86# IO Schedulers 93# IO Schedulers
@@ -94,9 +101,11 @@ CONFIG_DEFAULT_AS=y
94# CONFIG_DEFAULT_CFQ is not set 101# CONFIG_DEFAULT_CFQ is not set
95# CONFIG_DEFAULT_NOOP is not set 102# CONFIG_DEFAULT_NOOP is not set
96CONFIG_DEFAULT_IOSCHED="anticipatory" 103CONFIG_DEFAULT_IOSCHED="anticipatory"
104CONFIG_CLASSIC_RCU=y
97# CONFIG_PREEMPT_NONE is not set 105# CONFIG_PREEMPT_NONE is not set
98CONFIG_PREEMPT_VOLUNTARY=y 106CONFIG_PREEMPT_VOLUNTARY=y
99# CONFIG_PREEMPT is not set 107# CONFIG_PREEMPT is not set
108# CONFIG_FREEZER is not set
100 109
101# 110#
102# Blackfin Processor Options 111# Blackfin Processor Options
@@ -105,6 +114,10 @@ CONFIG_PREEMPT_VOLUNTARY=y
105# 114#
106# Processor and Board Settings 115# Processor and Board Settings
107# 116#
117# CONFIG_BF512 is not set
118# CONFIG_BF514 is not set
119# CONFIG_BF516 is not set
120# CONFIG_BF518 is not set
108# CONFIG_BF522 is not set 121# CONFIG_BF522 is not set
109# CONFIG_BF523 is not set 122# CONFIG_BF523 is not set
110# CONFIG_BF524 is not set 123# CONFIG_BF524 is not set
@@ -117,24 +130,38 @@ CONFIG_PREEMPT_VOLUNTARY=y
117# CONFIG_BF534 is not set 130# CONFIG_BF534 is not set
118# CONFIG_BF536 is not set 131# CONFIG_BF536 is not set
119# CONFIG_BF537 is not set 132# CONFIG_BF537 is not set
133# CONFIG_BF538 is not set
134# CONFIG_BF539 is not set
120# CONFIG_BF542 is not set 135# CONFIG_BF542 is not set
121# CONFIG_BF544 is not set 136# CONFIG_BF544 is not set
122# CONFIG_BF547 is not set 137# CONFIG_BF547 is not set
123# CONFIG_BF548 is not set 138# CONFIG_BF548 is not set
124# CONFIG_BF549 is not set 139# CONFIG_BF549 is not set
125CONFIG_BF561=y 140CONFIG_BF561=y
141# CONFIG_SMP is not set
142CONFIG_BF_REV_MIN=3
143CONFIG_BF_REV_MAX=5
126# CONFIG_BF_REV_0_0 is not set 144# CONFIG_BF_REV_0_0 is not set
127# CONFIG_BF_REV_0_1 is not set 145# CONFIG_BF_REV_0_1 is not set
128# CONFIG_BF_REV_0_2 is not set 146# CONFIG_BF_REV_0_2 is not set
129CONFIG_BF_REV_0_3=y 147CONFIG_BF_REV_0_3=y
130# CONFIG_BF_REV_0_4 is not set 148# CONFIG_BF_REV_0_4 is not set
131# CONFIG_BF_REV_0_5 is not set 149# CONFIG_BF_REV_0_5 is not set
150# CONFIG_BF_REV_0_6 is not set
132# CONFIG_BF_REV_ANY is not set 151# CONFIG_BF_REV_ANY is not set
133# CONFIG_BF_REV_NONE is not set 152# CONFIG_BF_REV_NONE is not set
134CONFIG_MEM_MT48LC16M16A2TG_75=y 153CONFIG_MEM_MT48LC16M16A2TG_75=y
135CONFIG_IRQ_PLL_WAKEUP=7 154CONFIG_IRQ_PLL_WAKEUP=7
136CONFIG_IRQ_SPORT0_ERROR=7 155CONFIG_IRQ_SPORT0_ERROR=7
137CONFIG_IRQ_SPORT1_ERROR=7 156CONFIG_IRQ_SPORT1_ERROR=7
157CONFIG_IRQ_TIMER0=10
158CONFIG_IRQ_TIMER1=10
159CONFIG_IRQ_TIMER2=10
160CONFIG_IRQ_TIMER3=10
161CONFIG_IRQ_TIMER4=10
162CONFIG_IRQ_TIMER5=10
163CONFIG_IRQ_TIMER6=10
164CONFIG_IRQ_TIMER7=10
138CONFIG_IRQ_SPI_ERROR=7 165CONFIG_IRQ_SPI_ERROR=7
139CONFIG_BFIN561_EZKIT=y 166CONFIG_BFIN561_EZKIT=y
140# CONFIG_BFIN561_TEPLA is not set 167# CONFIG_BFIN561_TEPLA is not set
@@ -148,10 +175,6 @@ CONFIG_BFIN561_EZKIT=y
148# 175#
149# Core B Support 176# Core B Support
150# 177#
151
152#
153# Core B Support
154#
155CONFIG_BF561_COREB=y 178CONFIG_BF561_COREB=y
156CONFIG_BF561_COREB_RESET=y 179CONFIG_BF561_COREB_RESET=y
157 180
@@ -193,14 +216,6 @@ CONFIG_IRQ_DMA2_8=9
193CONFIG_IRQ_DMA2_9=9 216CONFIG_IRQ_DMA2_9=9
194CONFIG_IRQ_DMA2_10=9 217CONFIG_IRQ_DMA2_10=9
195CONFIG_IRQ_DMA2_11=9 218CONFIG_IRQ_DMA2_11=9
196CONFIG_IRQ_TIMER0=10
197CONFIG_IRQ_TIMER1=10
198CONFIG_IRQ_TIMER2=10
199CONFIG_IRQ_TIMER3=10
200CONFIG_IRQ_TIMER4=10
201CONFIG_IRQ_TIMER5=10
202CONFIG_IRQ_TIMER6=10
203CONFIG_IRQ_TIMER7=10
204CONFIG_IRQ_TIMER8=10 219CONFIG_IRQ_TIMER8=10
205CONFIG_IRQ_TIMER9=10 220CONFIG_IRQ_TIMER9=10
206CONFIG_IRQ_TIMER10=10 221CONFIG_IRQ_TIMER10=10
@@ -230,7 +245,6 @@ CONFIG_BOOT_LOAD=0x1000
230# 245#
231CONFIG_CLKIN_HZ=30000000 246CONFIG_CLKIN_HZ=30000000
232# CONFIG_BFIN_KERNEL_CLOCK is not set 247# CONFIG_BFIN_KERNEL_CLOCK is not set
233CONFIG_MAX_MEM_SIZE=512
234CONFIG_MAX_VCO_HZ=600000000 248CONFIG_MAX_VCO_HZ=600000000
235CONFIG_MIN_VCO_HZ=50000000 249CONFIG_MIN_VCO_HZ=50000000
236CONFIG_MAX_SCLK_HZ=133333333 250CONFIG_MAX_SCLK_HZ=133333333
@@ -244,6 +258,7 @@ CONFIG_HZ_250=y
244# CONFIG_HZ_300 is not set 258# CONFIG_HZ_300 is not set
245# CONFIG_HZ_1000 is not set 259# CONFIG_HZ_1000 is not set
246CONFIG_HZ=250 260CONFIG_HZ=250
261CONFIG_SCHED_HRTICK=y
247CONFIG_GENERIC_TIME=y 262CONFIG_GENERIC_TIME=y
248CONFIG_GENERIC_CLOCKEVENTS=y 263CONFIG_GENERIC_CLOCKEVENTS=y
249# CONFIG_CYCLES_CLOCKSOURCE is not set 264# CONFIG_CYCLES_CLOCKSOURCE is not set
@@ -281,6 +296,12 @@ CONFIG_SYS_BFIN_SPINLOCK_L1=y
281CONFIG_CACHELINE_ALIGNED_L1=y 296CONFIG_CACHELINE_ALIGNED_L1=y
282# CONFIG_SYSCALL_TAB_L1 is not set 297# CONFIG_SYSCALL_TAB_L1 is not set
283# CONFIG_CPLB_SWITCH_TAB_L1 is not set 298# CONFIG_CPLB_SWITCH_TAB_L1 is not set
299CONFIG_APP_STACK_L1=y
300
301#
302# Speed Optimizations
303#
304CONFIG_BFIN_INS_LOWOVERHEAD=y
284CONFIG_RAMKERNEL=y 305CONFIG_RAMKERNEL=y
285# CONFIG_ROMKERNEL is not set 306# CONFIG_ROMKERNEL is not set
286CONFIG_SELECT_MEMORY_MODEL=y 307CONFIG_SELECT_MEMORY_MODEL=y
@@ -289,14 +310,13 @@ CONFIG_FLATMEM_MANUAL=y
289# CONFIG_SPARSEMEM_MANUAL is not set 310# CONFIG_SPARSEMEM_MANUAL is not set
290CONFIG_FLATMEM=y 311CONFIG_FLATMEM=y
291CONFIG_FLAT_NODE_MEM_MAP=y 312CONFIG_FLAT_NODE_MEM_MAP=y
292# CONFIG_SPARSEMEM_STATIC is not set 313CONFIG_PAGEFLAGS_EXTENDED=y
293# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
294CONFIG_SPLIT_PTLOCK_CPUS=4 314CONFIG_SPLIT_PTLOCK_CPUS=4
295# CONFIG_RESOURCES_64BIT is not set 315# CONFIG_RESOURCES_64BIT is not set
316# CONFIG_PHYS_ADDR_T_64BIT is not set
296CONFIG_ZONE_DMA_FLAG=1 317CONFIG_ZONE_DMA_FLAG=1
297CONFIG_VIRT_TO_BUS=y 318CONFIG_VIRT_TO_BUS=y
298# CONFIG_BFIN_GPTIMERS is not set 319# CONFIG_BFIN_GPTIMERS is not set
299CONFIG_BFIN_DMA_5XX=y
300# CONFIG_DMA_UNCACHED_4M is not set 320# CONFIG_DMA_UNCACHED_4M is not set
301# CONFIG_DMA_UNCACHED_2M is not set 321# CONFIG_DMA_UNCACHED_2M is not set
302CONFIG_DMA_UNCACHED_1M=y 322CONFIG_DMA_UNCACHED_1M=y
@@ -311,7 +331,7 @@ CONFIG_BFIN_DCACHE=y
311# CONFIG_BFIN_ICACHE_LOCK is not set 331# CONFIG_BFIN_ICACHE_LOCK is not set
312# CONFIG_BFIN_WB is not set 332# CONFIG_BFIN_WB is not set
313CONFIG_BFIN_WT=y 333CONFIG_BFIN_WT=y
314CONFIG_L1_MAX_PIECE=16 334# CONFIG_BFIN_L2_CACHEABLE is not set
315# CONFIG_MPU is not set 335# CONFIG_MPU is not set
316 336
317# 337#
@@ -344,7 +364,6 @@ CONFIG_BANK_3=0xAAC2
344# 364#
345# Bus options (PCI, PCMCIA, EISA, MCA, ISA) 365# Bus options (PCI, PCMCIA, EISA, MCA, ISA)
346# 366#
347# CONFIG_PCI is not set
348# CONFIG_ARCH_SUPPORTS_MSI is not set 367# CONFIG_ARCH_SUPPORTS_MSI is not set
349# CONFIG_PCCARD is not set 368# CONFIG_PCCARD is not set
350 369
@@ -355,23 +374,20 @@ CONFIG_BINFMT_ELF_FDPIC=y
355CONFIG_BINFMT_FLAT=y 374CONFIG_BINFMT_FLAT=y
356CONFIG_BINFMT_ZFLAT=y 375CONFIG_BINFMT_ZFLAT=y
357# CONFIG_BINFMT_SHARED_FLAT is not set 376# CONFIG_BINFMT_SHARED_FLAT is not set
377# CONFIG_HAVE_AOUT is not set
358# CONFIG_BINFMT_MISC is not set 378# CONFIG_BINFMT_MISC is not set
359 379
360# 380#
361# Power management options 381# Power management options
362# 382#
363# CONFIG_PM is not set 383# CONFIG_PM is not set
364CONFIG_SUSPEND_UP_POSSIBLE=y 384CONFIG_ARCH_SUSPEND_POSSIBLE=y
365# CONFIG_PM_WAKEUP_BY_GPIO is not set 385# CONFIG_PM_WAKEUP_BY_GPIO is not set
366 386
367# 387#
368# CPU Frequency scaling 388# CPU Frequency scaling
369# 389#
370# CONFIG_CPU_FREQ is not set 390# CONFIG_CPU_FREQ is not set
371
372#
373# Networking
374#
375CONFIG_NET=y 391CONFIG_NET=y
376 392
377# 393#
@@ -384,6 +400,7 @@ CONFIG_XFRM=y
384# CONFIG_XFRM_USER is not set 400# CONFIG_XFRM_USER is not set
385# CONFIG_XFRM_SUB_POLICY is not set 401# CONFIG_XFRM_SUB_POLICY is not set
386# CONFIG_XFRM_MIGRATE is not set 402# CONFIG_XFRM_MIGRATE is not set
403# CONFIG_XFRM_STATISTICS is not set
387# CONFIG_NET_KEY is not set 404# CONFIG_NET_KEY is not set
388CONFIG_INET=y 405CONFIG_INET=y
389# CONFIG_IP_MULTICAST is not set 406# CONFIG_IP_MULTICAST is not set
@@ -413,8 +430,6 @@ CONFIG_TCP_CONG_CUBIC=y
413CONFIG_DEFAULT_TCP_CONG="cubic" 430CONFIG_DEFAULT_TCP_CONG="cubic"
414# CONFIG_TCP_MD5SIG is not set 431# CONFIG_TCP_MD5SIG is not set
415# CONFIG_IPV6 is not set 432# CONFIG_IPV6 is not set
416# CONFIG_INET6_XFRM_TUNNEL is not set
417# CONFIG_INET6_TUNNEL is not set
418# CONFIG_NETLABEL is not set 433# CONFIG_NETLABEL is not set
419# CONFIG_NETWORK_SECMARK is not set 434# CONFIG_NETWORK_SECMARK is not set
420# CONFIG_NETFILTER is not set 435# CONFIG_NETFILTER is not set
@@ -423,6 +438,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
423# CONFIG_TIPC is not set 438# CONFIG_TIPC is not set
424# CONFIG_ATM is not set 439# CONFIG_ATM is not set
425# CONFIG_BRIDGE is not set 440# CONFIG_BRIDGE is not set
441# CONFIG_NET_DSA is not set
426# CONFIG_VLAN_8021Q is not set 442# CONFIG_VLAN_8021Q is not set
427# CONFIG_DECNET is not set 443# CONFIG_DECNET is not set
428# CONFIG_LLC2 is not set 444# CONFIG_LLC2 is not set
@@ -439,6 +455,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
439# 455#
440# CONFIG_NET_PKTGEN is not set 456# CONFIG_NET_PKTGEN is not set
441# CONFIG_HAMRADIO is not set 457# CONFIG_HAMRADIO is not set
458# CONFIG_CAN is not set
442CONFIG_IRDA=m 459CONFIG_IRDA=m
443 460
444# 461#
@@ -471,24 +488,14 @@ CONFIG_IRTTY_SIR=m
471# CONFIG_DONGLE is not set 488# CONFIG_DONGLE is not set
472 489
473# 490#
474# Old SIR device drivers
475#
476# CONFIG_IRPORT_SIR is not set
477
478#
479# Old Serial dongle support
480#
481
482#
483# FIR device drivers 491# FIR device drivers
484# 492#
485# CONFIG_BT is not set 493# CONFIG_BT is not set
486# CONFIG_AF_RXRPC is not set 494# CONFIG_AF_RXRPC is not set
487 495# CONFIG_PHONET is not set
488# 496CONFIG_WIRELESS=y
489# Wireless
490#
491# CONFIG_CFG80211 is not set 497# CONFIG_CFG80211 is not set
498CONFIG_WIRELESS_OLD_REGULATORY=y
492# CONFIG_WIRELESS_EXT is not set 499# CONFIG_WIRELESS_EXT is not set
493# CONFIG_MAC80211 is not set 500# CONFIG_MAC80211 is not set
494# CONFIG_IEEE80211 is not set 501# CONFIG_IEEE80211 is not set
@@ -506,6 +513,8 @@ CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
506CONFIG_STANDALONE=y 513CONFIG_STANDALONE=y
507CONFIG_PREVENT_FIRMWARE_BUILD=y 514CONFIG_PREVENT_FIRMWARE_BUILD=y
508# CONFIG_FW_LOADER is not set 515# CONFIG_FW_LOADER is not set
516# CONFIG_DEBUG_DRIVER is not set
517# CONFIG_DEBUG_DEVRES is not set
509# CONFIG_SYS_HYPERVISOR is not set 518# CONFIG_SYS_HYPERVISOR is not set
510# CONFIG_CONNECTOR is not set 519# CONFIG_CONNECTOR is not set
511CONFIG_MTD=y 520CONFIG_MTD=y
@@ -514,6 +523,7 @@ CONFIG_MTD=y
514CONFIG_MTD_PARTITIONS=y 523CONFIG_MTD_PARTITIONS=y
515# CONFIG_MTD_REDBOOT_PARTS is not set 524# CONFIG_MTD_REDBOOT_PARTS is not set
516CONFIG_MTD_CMDLINE_PARTS=y 525CONFIG_MTD_CMDLINE_PARTS=y
526# CONFIG_MTD_AR7_PARTS is not set
517 527
518# 528#
519# User Modules And Translation Layers 529# User Modules And Translation Layers
@@ -595,11 +605,14 @@ CONFIG_BLK_DEV=y
595CONFIG_BLK_DEV_RAM=y 605CONFIG_BLK_DEV_RAM=y
596CONFIG_BLK_DEV_RAM_COUNT=16 606CONFIG_BLK_DEV_RAM_COUNT=16
597CONFIG_BLK_DEV_RAM_SIZE=4096 607CONFIG_BLK_DEV_RAM_SIZE=4096
598CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024 608# CONFIG_BLK_DEV_XIP is not set
599# CONFIG_CDROM_PKTCDVD is not set 609# CONFIG_CDROM_PKTCDVD is not set
600# CONFIG_ATA_OVER_ETH is not set 610# CONFIG_ATA_OVER_ETH is not set
611# CONFIG_BLK_DEV_HD is not set
601CONFIG_MISC_DEVICES=y 612CONFIG_MISC_DEVICES=y
602# CONFIG_EEPROM_93CX6 is not set 613# CONFIG_EEPROM_93CX6 is not set
614# CONFIG_ENCLOSURE_SERVICES is not set
615CONFIG_HAVE_IDE=y
603# CONFIG_IDE is not set 616# CONFIG_IDE is not set
604 617
605# 618#
@@ -612,7 +625,6 @@ CONFIG_MISC_DEVICES=y
612# CONFIG_ATA is not set 625# CONFIG_ATA is not set
613# CONFIG_MD is not set 626# CONFIG_MD is not set
614CONFIG_NETDEVICES=y 627CONFIG_NETDEVICES=y
615# CONFIG_NETDEVICES_MULTIQUEUE is not set
616# CONFIG_DUMMY is not set 628# CONFIG_DUMMY is not set
617# CONFIG_BONDING is not set 629# CONFIG_BONDING is not set
618# CONFIG_MACVLAN is not set 630# CONFIG_MACVLAN is not set
@@ -625,11 +637,14 @@ CONFIG_MII=y
625CONFIG_SMC91X=y 637CONFIG_SMC91X=y
626# CONFIG_SMSC911X is not set 638# CONFIG_SMSC911X is not set
627# CONFIG_DM9000 is not set 639# CONFIG_DM9000 is not set
640# CONFIG_ENC28J60 is not set
628# CONFIG_IBM_NEW_EMAC_ZMII is not set 641# CONFIG_IBM_NEW_EMAC_ZMII is not set
629# CONFIG_IBM_NEW_EMAC_RGMII is not set 642# CONFIG_IBM_NEW_EMAC_RGMII is not set
630# CONFIG_IBM_NEW_EMAC_TAH is not set 643# CONFIG_IBM_NEW_EMAC_TAH is not set
631# CONFIG_IBM_NEW_EMAC_EMAC4 is not set 644# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
632# CONFIG_B44 is not set 645# CONFIG_IBM_NEW_EMAC_NO_FLOW_CTRL is not set
646# CONFIG_IBM_NEW_EMAC_MAL_CLR_ICINTSTAT is not set
647# CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set
633CONFIG_NETDEV_1000=y 648CONFIG_NETDEV_1000=y
634# CONFIG_AX88180 is not set 649# CONFIG_AX88180 is not set
635CONFIG_NETDEV_10000=y 650CONFIG_NETDEV_10000=y
@@ -639,10 +654,10 @@ CONFIG_NETDEV_10000=y
639# 654#
640# CONFIG_WLAN_PRE80211 is not set 655# CONFIG_WLAN_PRE80211 is not set
641# CONFIG_WLAN_80211 is not set 656# CONFIG_WLAN_80211 is not set
657# CONFIG_IWLWIFI_LEDS is not set
642# CONFIG_WAN is not set 658# CONFIG_WAN is not set
643# CONFIG_PPP is not set 659# CONFIG_PPP is not set
644# CONFIG_SLIP is not set 660# CONFIG_SLIP is not set
645# CONFIG_SHAPER is not set
646# CONFIG_NETCONSOLE is not set 661# CONFIG_NETCONSOLE is not set
647# CONFIG_NETPOLL is not set 662# CONFIG_NETPOLL is not set
648# CONFIG_NET_POLL_CONTROLLER is not set 663# CONFIG_NET_POLL_CONTROLLER is not set
@@ -690,8 +705,11 @@ CONFIG_INPUT_EVDEV=m
690# CONFIG_BF5xx_PPI is not set 705# CONFIG_BF5xx_PPI is not set
691# CONFIG_BFIN_SPORT is not set 706# CONFIG_BFIN_SPORT is not set
692# CONFIG_BFIN_TIMER_LATENCY is not set 707# CONFIG_BFIN_TIMER_LATENCY is not set
708CONFIG_BFIN_DMA_INTERFACE=m
693CONFIG_SIMPLE_GPIO=m 709CONFIG_SIMPLE_GPIO=m
694# CONFIG_VT is not set 710# CONFIG_VT is not set
711# CONFIG_DEVKMEM is not set
712# CONFIG_BFIN_JTAG_COMM is not set
695# CONFIG_SERIAL_NONSTANDARD is not set 713# CONFIG_SERIAL_NONSTANDARD is not set
696 714
697# 715#
@@ -720,22 +738,19 @@ CONFIG_UNIX98_PTYS=y
720# CONFIG_CAN4LINUX is not set 738# CONFIG_CAN4LINUX is not set
721# CONFIG_IPMI_HANDLER is not set 739# CONFIG_IPMI_HANDLER is not set
722# CONFIG_HW_RANDOM is not set 740# CONFIG_HW_RANDOM is not set
723# CONFIG_GEN_RTC is not set
724# CONFIG_R3964 is not set 741# CONFIG_R3964 is not set
725# CONFIG_RAW_DRIVER is not set 742# CONFIG_RAW_DRIVER is not set
726# CONFIG_TCG_TPM is not set 743# CONFIG_TCG_TPM is not set
727# CONFIG_I2C is not set 744# CONFIG_I2C is not set
728
729#
730# SPI support
731#
732CONFIG_SPI=y 745CONFIG_SPI=y
746# CONFIG_SPI_DEBUG is not set
733CONFIG_SPI_MASTER=y 747CONFIG_SPI_MASTER=y
734 748
735# 749#
736# SPI Master Controller Drivers 750# SPI Master Controller Drivers
737# 751#
738CONFIG_SPI_BFIN=y 752CONFIG_SPI_BFIN=y
753# CONFIG_SPI_BFIN_LOCK is not set
739# CONFIG_SPI_BITBANG is not set 754# CONFIG_SPI_BITBANG is not set
740 755
741# 756#
@@ -744,14 +759,18 @@ CONFIG_SPI_BFIN=y
744# CONFIG_SPI_AT25 is not set 759# CONFIG_SPI_AT25 is not set
745# CONFIG_SPI_SPIDEV is not set 760# CONFIG_SPI_SPIDEV is not set
746# CONFIG_SPI_TLE62X0 is not set 761# CONFIG_SPI_TLE62X0 is not set
762CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y
763# CONFIG_GPIOLIB is not set
747# CONFIG_W1 is not set 764# CONFIG_W1 is not set
748# CONFIG_POWER_SUPPLY is not set 765# CONFIG_POWER_SUPPLY is not set
749CONFIG_HWMON=y 766CONFIG_HWMON=y
750# CONFIG_HWMON_VID is not set 767# CONFIG_HWMON_VID is not set
768# CONFIG_SENSORS_ADCXX is not set
751# CONFIG_SENSORS_F71805F is not set 769# CONFIG_SENSORS_F71805F is not set
752# CONFIG_SENSORS_F71882FG is not set 770# CONFIG_SENSORS_F71882FG is not set
753# CONFIG_SENSORS_IT87 is not set 771# CONFIG_SENSORS_IT87 is not set
754# CONFIG_SENSORS_LM70 is not set 772# CONFIG_SENSORS_LM70 is not set
773# CONFIG_SENSORS_MAX1111 is not set
755# CONFIG_SENSORS_PC87360 is not set 774# CONFIG_SENSORS_PC87360 is not set
756# CONFIG_SENSORS_PC87427 is not set 775# CONFIG_SENSORS_PC87427 is not set
757# CONFIG_SENSORS_SMSC47M1 is not set 776# CONFIG_SENSORS_SMSC47M1 is not set
@@ -760,6 +779,8 @@ CONFIG_HWMON=y
760# CONFIG_SENSORS_W83627HF is not set 779# CONFIG_SENSORS_W83627HF is not set
761# CONFIG_SENSORS_W83627EHF is not set 780# CONFIG_SENSORS_W83627EHF is not set
762# CONFIG_HWMON_DEBUG_CHIP is not set 781# CONFIG_HWMON_DEBUG_CHIP is not set
782# CONFIG_THERMAL is not set
783# CONFIG_THERMAL_HWMON is not set
763CONFIG_WATCHDOG=y 784CONFIG_WATCHDOG=y
764# CONFIG_WATCHDOG_NOWAYOUT is not set 785# CONFIG_WATCHDOG_NOWAYOUT is not set
765 786
@@ -770,21 +791,28 @@ CONFIG_WATCHDOG=y
770CONFIG_BFIN_WDT=y 791CONFIG_BFIN_WDT=y
771 792
772# 793#
773# Sonics Silicon Backplane
774#
775CONFIG_SSB_POSSIBLE=y
776# CONFIG_SSB is not set
777
778#
779# Multifunction device drivers 794# Multifunction device drivers
780# 795#
796# CONFIG_MFD_CORE is not set
781# CONFIG_MFD_SM501 is not set 797# CONFIG_MFD_SM501 is not set
798# CONFIG_HTC_PASIC3 is not set
799# CONFIG_MFD_TMIO is not set
800# CONFIG_MFD_WM8400 is not set
782 801
783# 802#
784# Multimedia devices 803# Multimedia devices
785# 804#
805
806#
807# Multimedia core support
808#
786# CONFIG_VIDEO_DEV is not set 809# CONFIG_VIDEO_DEV is not set
787# CONFIG_DVB_CORE is not set 810# CONFIG_DVB_CORE is not set
811# CONFIG_VIDEO_MEDIA is not set
812
813#
814# Multimedia drivers
815#
788# CONFIG_DAB is not set 816# CONFIG_DAB is not set
789 817
790# 818#
@@ -799,43 +827,43 @@ CONFIG_SSB_POSSIBLE=y
799# Display device support 827# Display device support
800# 828#
801# CONFIG_DISPLAY_SUPPORT is not set 829# CONFIG_DISPLAY_SUPPORT is not set
802
803#
804# Sound
805#
806# CONFIG_SOUND is not set 830# CONFIG_SOUND is not set
807CONFIG_HID_SUPPORT=y 831CONFIG_HID_SUPPORT=y
808CONFIG_HID=m 832CONFIG_HID=m
809# CONFIG_HID_DEBUG is not set 833# CONFIG_HID_DEBUG is not set
810# CONFIG_HIDRAW is not set 834# CONFIG_HIDRAW is not set
835# CONFIG_HID_PID is not set
836
837#
838# Special HID drivers
839#
840CONFIG_HID_COMPAT=y
811# CONFIG_USB_SUPPORT is not set 841# CONFIG_USB_SUPPORT is not set
812# CONFIG_MMC is not set 842# CONFIG_MMC is not set
843# CONFIG_MEMSTICK is not set
813# CONFIG_NEW_LEDS is not set 844# CONFIG_NEW_LEDS is not set
845# CONFIG_ACCESSIBILITY is not set
814# CONFIG_RTC_CLASS is not set 846# CONFIG_RTC_CLASS is not set
815 847# CONFIG_DMADEVICES is not set
816#
817# Userspace I/O
818#
819# CONFIG_UIO is not set 848# CONFIG_UIO is not set
849# CONFIG_STAGING is not set
820 850
821# 851#
822# File systems 852# File systems
823# 853#
824# CONFIG_EXT2_FS is not set 854# CONFIG_EXT2_FS is not set
825# CONFIG_EXT3_FS is not set 855# CONFIG_EXT3_FS is not set
826# CONFIG_EXT4DEV_FS is not set 856# CONFIG_EXT4_FS is not set
827# CONFIG_REISERFS_FS is not set 857# CONFIG_REISERFS_FS is not set
828# CONFIG_JFS_FS is not set 858# CONFIG_JFS_FS is not set
829# CONFIG_FS_POSIX_ACL is not set 859# CONFIG_FS_POSIX_ACL is not set
860CONFIG_FILE_LOCKING=y
830# CONFIG_XFS_FS is not set 861# CONFIG_XFS_FS is not set
831# CONFIG_GFS2_FS is not set
832# CONFIG_OCFS2_FS is not set 862# CONFIG_OCFS2_FS is not set
833# CONFIG_MINIX_FS is not set 863# CONFIG_DNOTIFY is not set
834# CONFIG_ROMFS_FS is not set
835CONFIG_INOTIFY=y 864CONFIG_INOTIFY=y
836CONFIG_INOTIFY_USER=y 865CONFIG_INOTIFY_USER=y
837# CONFIG_QUOTA is not set 866# CONFIG_QUOTA is not set
838# CONFIG_DNOTIFY is not set
839# CONFIG_AUTOFS_FS is not set 867# CONFIG_AUTOFS_FS is not set
840# CONFIG_AUTOFS4_FS is not set 868# CONFIG_AUTOFS4_FS is not set
841# CONFIG_FUSE_FS is not set 869# CONFIG_FUSE_FS is not set
@@ -875,11 +903,11 @@ CONFIG_SYSFS=y
875# CONFIG_EFS_FS is not set 903# CONFIG_EFS_FS is not set
876CONFIG_YAFFS_FS=m 904CONFIG_YAFFS_FS=m
877CONFIG_YAFFS_YAFFS1=y 905CONFIG_YAFFS_YAFFS1=y
906# CONFIG_YAFFS_9BYTE_TAGS is not set
878# CONFIG_YAFFS_DOES_ECC is not set 907# CONFIG_YAFFS_DOES_ECC is not set
879CONFIG_YAFFS_YAFFS2=y 908CONFIG_YAFFS_YAFFS2=y
880CONFIG_YAFFS_AUTO_YAFFS2=y 909CONFIG_YAFFS_AUTO_YAFFS2=y
881# CONFIG_YAFFS_DISABLE_LAZY_LOAD is not set 910# CONFIG_YAFFS_DISABLE_LAZY_LOAD is not set
882CONFIG_YAFFS_CHECKPOINT_RESERVED_BLOCKS=10
883# CONFIG_YAFFS_DISABLE_WIDE_TNODES is not set 911# CONFIG_YAFFS_DISABLE_WIDE_TNODES is not set
884# CONFIG_YAFFS_ALWAYS_CHECK_CHUNK_ERASED is not set 912# CONFIG_YAFFS_ALWAYS_CHECK_CHUNK_ERASED is not set
885CONFIG_YAFFS_SHORT_NAMES_IN_RAM=y 913CONFIG_YAFFS_SHORT_NAMES_IN_RAM=y
@@ -896,8 +924,11 @@ CONFIG_JFFS2_RTIME=y
896# CONFIG_JFFS2_RUBIN is not set 924# CONFIG_JFFS2_RUBIN is not set
897# CONFIG_CRAMFS is not set 925# CONFIG_CRAMFS is not set
898# CONFIG_VXFS_FS is not set 926# CONFIG_VXFS_FS is not set
927# CONFIG_MINIX_FS is not set
928# CONFIG_OMFS_FS is not set
899# CONFIG_HPFS_FS is not set 929# CONFIG_HPFS_FS is not set
900# CONFIG_QNX4FS_FS is not set 930# CONFIG_QNX4FS_FS is not set
931# CONFIG_ROMFS_FS is not set
901# CONFIG_SYSV_FS is not set 932# CONFIG_SYSV_FS is not set
902# CONFIG_UFS_FS is not set 933# CONFIG_UFS_FS is not set
903CONFIG_NETWORK_FILESYSTEMS=y 934CONFIG_NETWORK_FILESYSTEMS=y
@@ -905,13 +936,12 @@ CONFIG_NFS_FS=m
905CONFIG_NFS_V3=y 936CONFIG_NFS_V3=y
906# CONFIG_NFS_V3_ACL is not set 937# CONFIG_NFS_V3_ACL is not set
907# CONFIG_NFS_V4 is not set 938# CONFIG_NFS_V4 is not set
908# CONFIG_NFS_DIRECTIO is not set
909# CONFIG_NFSD is not set 939# CONFIG_NFSD is not set
910CONFIG_LOCKD=m 940CONFIG_LOCKD=m
911CONFIG_LOCKD_V4=y 941CONFIG_LOCKD_V4=y
912CONFIG_NFS_COMMON=y 942CONFIG_NFS_COMMON=y
913CONFIG_SUNRPC=m 943CONFIG_SUNRPC=m
914# CONFIG_SUNRPC_BIND34 is not set 944# CONFIG_SUNRPC_REGISTER_V4 is not set
915# CONFIG_RPCSEC_GSS_KRB5 is not set 945# CONFIG_RPCSEC_GSS_KRB5 is not set
916# CONFIG_RPCSEC_GSS_SPKM3 is not set 946# CONFIG_RPCSEC_GSS_SPKM3 is not set
917CONFIG_SMB_FS=m 947CONFIG_SMB_FS=m
@@ -967,9 +997,6 @@ CONFIG_NLS_DEFAULT="iso8859-1"
967# CONFIG_NLS_KOI8_U is not set 997# CONFIG_NLS_KOI8_U is not set
968# CONFIG_NLS_UTF8 is not set 998# CONFIG_NLS_UTF8 is not set
969# CONFIG_DLM is not set 999# CONFIG_DLM is not set
970CONFIG_INSTRUMENTATION=y
971# CONFIG_PROFILING is not set
972# CONFIG_MARKERS is not set
973 1000
974# 1001#
975# Kernel hacking 1002# Kernel hacking
@@ -977,14 +1004,53 @@ CONFIG_INSTRUMENTATION=y
977# CONFIG_PRINTK_TIME is not set 1004# CONFIG_PRINTK_TIME is not set
978CONFIG_ENABLE_WARN_DEPRECATED=y 1005CONFIG_ENABLE_WARN_DEPRECATED=y
979CONFIG_ENABLE_MUST_CHECK=y 1006CONFIG_ENABLE_MUST_CHECK=y
1007CONFIG_FRAME_WARN=1024
980# CONFIG_MAGIC_SYSRQ is not set 1008# CONFIG_MAGIC_SYSRQ is not set
981# CONFIG_UNUSED_SYMBOLS is not set 1009# CONFIG_UNUSED_SYMBOLS is not set
982CONFIG_DEBUG_FS=y 1010CONFIG_DEBUG_FS=y
983# CONFIG_HEADERS_CHECK is not set 1011# CONFIG_HEADERS_CHECK is not set
984# CONFIG_DEBUG_KERNEL is not set 1012CONFIG_DEBUG_KERNEL=y
1013# CONFIG_DEBUG_SHIRQ is not set
1014CONFIG_DETECT_SOFTLOCKUP=y
1015# CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC is not set
1016CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE=0
1017CONFIG_SCHED_DEBUG=y
1018# CONFIG_SCHEDSTATS is not set
1019# CONFIG_TIMER_STATS is not set
1020# CONFIG_DEBUG_OBJECTS is not set
1021# CONFIG_DEBUG_SLAB is not set
1022# CONFIG_DEBUG_RT_MUTEXES is not set
1023# CONFIG_RT_MUTEX_TESTER is not set
1024# CONFIG_DEBUG_SPINLOCK is not set
1025# CONFIG_DEBUG_MUTEXES is not set
1026# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
1027# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
1028# CONFIG_DEBUG_KOBJECT is not set
985# CONFIG_DEBUG_BUGVERBOSE is not set 1029# CONFIG_DEBUG_BUGVERBOSE is not set
1030CONFIG_DEBUG_INFO=y
1031# CONFIG_DEBUG_VM is not set
1032# CONFIG_DEBUG_WRITECOUNT is not set
1033# CONFIG_DEBUG_MEMORY_INIT is not set
1034# CONFIG_DEBUG_LIST is not set
1035# CONFIG_DEBUG_SG is not set
1036# CONFIG_FRAME_POINTER is not set
1037# CONFIG_BOOT_PRINTK_DELAY is not set
1038# CONFIG_RCU_TORTURE_TEST is not set
1039# CONFIG_RCU_CPU_STALL_DETECTOR is not set
1040# CONFIG_BACKTRACE_SELF_TEST is not set
1041# CONFIG_DEBUG_BLOCK_EXT_DEVT is not set
1042# CONFIG_FAULT_INJECTION is not set
1043# CONFIG_SYSCTL_SYSCALL_CHECK is not set
1044# CONFIG_DYNAMIC_PRINTK_DEBUG is not set
986# CONFIG_SAMPLES is not set 1045# CONFIG_SAMPLES is not set
1046CONFIG_HAVE_ARCH_KGDB=y
1047# CONFIG_KGDB is not set
1048# CONFIG_DEBUG_STACKOVERFLOW is not set
1049# CONFIG_DEBUG_STACK_USAGE is not set
1050CONFIG_DEBUG_VERBOSE=y
987CONFIG_DEBUG_MMRS=y 1051CONFIG_DEBUG_MMRS=y
1052# CONFIG_DEBUG_HWERR is not set
1053# CONFIG_DEBUG_DOUBLEFAULT is not set
988CONFIG_DEBUG_HUNT_FOR_ZERO=y 1054CONFIG_DEBUG_HUNT_FOR_ZERO=y
989CONFIG_DEBUG_BFIN_HWTRACE_ON=y 1055CONFIG_DEBUG_BFIN_HWTRACE_ON=y
990CONFIG_DEBUG_BFIN_HWTRACE_COMPRESSION_OFF=y 1056CONFIG_DEBUG_BFIN_HWTRACE_COMPRESSION_OFF=y
@@ -994,7 +1060,6 @@ CONFIG_DEBUG_BFIN_HWTRACE_COMPRESSION=0
994# CONFIG_DEBUG_BFIN_HWTRACE_EXPAND is not set 1060# CONFIG_DEBUG_BFIN_HWTRACE_EXPAND is not set
995# CONFIG_DEBUG_BFIN_NO_KERN_HWTRACE is not set 1061# CONFIG_DEBUG_BFIN_NO_KERN_HWTRACE is not set
996CONFIG_EARLY_PRINTK=y 1062CONFIG_EARLY_PRINTK=y
997# CONFIG_DUAL_CORE_TEST_MODULE is not set
998CONFIG_CPLB_INFO=y 1063CONFIG_CPLB_INFO=y
999CONFIG_ACCESS_CHECK=y 1064CONFIG_ACCESS_CHECK=y
1000 1065
@@ -1003,9 +1068,94 @@ CONFIG_ACCESS_CHECK=y
1003# 1068#
1004# CONFIG_KEYS is not set 1069# CONFIG_KEYS is not set
1005CONFIG_SECURITY=y 1070CONFIG_SECURITY=y
1071# CONFIG_SECURITYFS is not set
1006# CONFIG_SECURITY_NETWORK is not set 1072# CONFIG_SECURITY_NETWORK is not set
1007# CONFIG_SECURITY_CAPABILITIES is not set 1073# CONFIG_SECURITY_FILE_CAPABILITIES is not set
1008# CONFIG_CRYPTO is not set 1074CONFIG_SECURITY_DEFAULT_MMAP_MIN_ADDR=0
1075CONFIG_CRYPTO=y
1076
1077#
1078# Crypto core or helper
1079#
1080# CONFIG_CRYPTO_FIPS is not set
1081# CONFIG_CRYPTO_MANAGER is not set
1082# CONFIG_CRYPTO_GF128MUL is not set
1083# CONFIG_CRYPTO_NULL is not set
1084# CONFIG_CRYPTO_CRYPTD is not set
1085# CONFIG_CRYPTO_AUTHENC is not set
1086# CONFIG_CRYPTO_TEST is not set
1087
1088#
1089# Authenticated Encryption with Associated Data
1090#
1091# CONFIG_CRYPTO_CCM is not set
1092# CONFIG_CRYPTO_GCM is not set
1093# CONFIG_CRYPTO_SEQIV is not set
1094
1095#
1096# Block modes
1097#
1098# CONFIG_CRYPTO_CBC is not set
1099# CONFIG_CRYPTO_CTR is not set
1100# CONFIG_CRYPTO_CTS is not set
1101# CONFIG_CRYPTO_ECB is not set
1102# CONFIG_CRYPTO_LRW is not set
1103# CONFIG_CRYPTO_PCBC is not set
1104# CONFIG_CRYPTO_XTS is not set
1105
1106#
1107# Hash modes
1108#
1109# CONFIG_CRYPTO_HMAC is not set
1110# CONFIG_CRYPTO_XCBC is not set
1111
1112#
1113# Digest
1114#
1115# CONFIG_CRYPTO_CRC32C is not set
1116# CONFIG_CRYPTO_MD4 is not set
1117# CONFIG_CRYPTO_MD5 is not set
1118# CONFIG_CRYPTO_MICHAEL_MIC is not set
1119# CONFIG_CRYPTO_RMD128 is not set
1120# CONFIG_CRYPTO_RMD160 is not set
1121# CONFIG_CRYPTO_RMD256 is not set
1122# CONFIG_CRYPTO_RMD320 is not set
1123# CONFIG_CRYPTO_SHA1 is not set
1124# CONFIG_CRYPTO_SHA256 is not set
1125# CONFIG_CRYPTO_SHA512 is not set
1126# CONFIG_CRYPTO_TGR192 is not set
1127# CONFIG_CRYPTO_WP512 is not set
1128
1129#
1130# Ciphers
1131#
1132# CONFIG_CRYPTO_AES is not set
1133# CONFIG_CRYPTO_ANUBIS is not set
1134# CONFIG_CRYPTO_ARC4 is not set
1135# CONFIG_CRYPTO_BLOWFISH is not set
1136# CONFIG_CRYPTO_CAMELLIA is not set
1137# CONFIG_CRYPTO_CAST5 is not set
1138# CONFIG_CRYPTO_CAST6 is not set
1139# CONFIG_CRYPTO_DES is not set
1140# CONFIG_CRYPTO_FCRYPT is not set
1141# CONFIG_CRYPTO_KHAZAD is not set
1142# CONFIG_CRYPTO_SALSA20 is not set
1143# CONFIG_CRYPTO_SEED is not set
1144# CONFIG_CRYPTO_SERPENT is not set
1145# CONFIG_CRYPTO_TEA is not set
1146# CONFIG_CRYPTO_TWOFISH is not set
1147
1148#
1149# Compression
1150#
1151# CONFIG_CRYPTO_DEFLATE is not set
1152# CONFIG_CRYPTO_LZO is not set
1153
1154#
1155# Random Number Generation
1156#
1157# CONFIG_CRYPTO_ANSI_CPRNG is not set
1158CONFIG_CRYPTO_HW=y
1009 1159
1010# 1160#
1011# Library routines 1161# Library routines
@@ -1013,6 +1163,7 @@ CONFIG_SECURITY=y
1013CONFIG_BITREVERSE=y 1163CONFIG_BITREVERSE=y
1014CONFIG_CRC_CCITT=m 1164CONFIG_CRC_CCITT=m
1015# CONFIG_CRC16 is not set 1165# CONFIG_CRC16 is not set
1166# CONFIG_CRC_T10DIF is not set
1016# CONFIG_CRC_ITU_T is not set 1167# CONFIG_CRC_ITU_T is not set
1017CONFIG_CRC32=y 1168CONFIG_CRC32=y
1018# CONFIG_CRC7 is not set 1169# CONFIG_CRC7 is not set
diff --git a/arch/blackfin/configs/BlackStamp_defconfig b/arch/blackfin/configs/BlackStamp_defconfig
index 2921f9952d5f..9683b2e13097 100644
--- a/arch/blackfin/configs/BlackStamp_defconfig
+++ b/arch/blackfin/configs/BlackStamp_defconfig
@@ -53,7 +53,7 @@ CONFIG_KALLSYMS=y
53CONFIG_HOTPLUG=y 53CONFIG_HOTPLUG=y
54CONFIG_PRINTK=y 54CONFIG_PRINTK=y
55CONFIG_BUG=y 55CONFIG_BUG=y
56CONFIG_ELF_CORE=y 56# CONFIG_ELF_CORE is not set
57CONFIG_COMPAT_BRK=y 57CONFIG_COMPAT_BRK=y
58CONFIG_BASE_FULL=y 58CONFIG_BASE_FULL=y
59CONFIG_FUTEX=y 59CONFIG_FUTEX=y
@@ -276,7 +276,6 @@ CONFIG_SPLIT_PTLOCK_CPUS=4
276CONFIG_ZONE_DMA_FLAG=1 276CONFIG_ZONE_DMA_FLAG=1
277CONFIG_VIRT_TO_BUS=y 277CONFIG_VIRT_TO_BUS=y
278CONFIG_BFIN_GPTIMERS=y 278CONFIG_BFIN_GPTIMERS=y
279CONFIG_BFIN_DMA_5XX=y
280# CONFIG_DMA_UNCACHED_4M is not set 279# CONFIG_DMA_UNCACHED_4M is not set
281# CONFIG_DMA_UNCACHED_2M is not set 280# CONFIG_DMA_UNCACHED_2M is not set
282CONFIG_DMA_UNCACHED_1M=y 281CONFIG_DMA_UNCACHED_1M=y
diff --git a/arch/blackfin/configs/CM-BF527_defconfig b/arch/blackfin/configs/CM-BF527_defconfig
index b6a14635fb91..a041e7eba770 100644
--- a/arch/blackfin/configs/CM-BF527_defconfig
+++ b/arch/blackfin/configs/CM-BF527_defconfig
@@ -42,7 +42,7 @@ CONFIG_LOG_BUF_SHIFT=14
42CONFIG_FAIR_GROUP_SCHED=y 42CONFIG_FAIR_GROUP_SCHED=y
43CONFIG_FAIR_USER_SCHED=y 43CONFIG_FAIR_USER_SCHED=y
44# CONFIG_FAIR_CGROUP_SCHED is not set 44# CONFIG_FAIR_CGROUP_SCHED is not set
45CONFIG_SYSFS_DEPRECATED=y 45# CONFIG_SYSFS_DEPRECATED is not set
46# CONFIG_RELAY is not set 46# CONFIG_RELAY is not set
47CONFIG_BLK_DEV_INITRD=y 47CONFIG_BLK_DEV_INITRD=y
48CONFIG_INITRAMFS_SOURCE="" 48CONFIG_INITRAMFS_SOURCE=""
@@ -56,7 +56,7 @@ CONFIG_KALLSYMS=y
56CONFIG_HOTPLUG=y 56CONFIG_HOTPLUG=y
57CONFIG_PRINTK=y 57CONFIG_PRINTK=y
58CONFIG_BUG=y 58CONFIG_BUG=y
59CONFIG_ELF_CORE=y 59# CONFIG_ELF_CORE is not set
60CONFIG_BASE_FULL=y 60CONFIG_BASE_FULL=y
61CONFIG_FUTEX=y 61CONFIG_FUTEX=y
62CONFIG_ANON_INODES=y 62CONFIG_ANON_INODES=y
@@ -190,14 +190,14 @@ CONFIG_IRQ_MAC_RX=11
190CONFIG_IRQ_PORTH_INTA=11 190CONFIG_IRQ_PORTH_INTA=11
191CONFIG_IRQ_MAC_TX=11 191CONFIG_IRQ_MAC_TX=11
192CONFIG_IRQ_PORTH_INTB=11 192CONFIG_IRQ_PORTH_INTB=11
193CONFIG_IRQ_TMR0=12 193CONFIG_IRQ_TIMER0=12
194CONFIG_IRQ_TMR1=12 194CONFIG_IRQ_TIMER1=12
195CONFIG_IRQ_TMR2=12 195CONFIG_IRQ_TIMER2=12
196CONFIG_IRQ_TMR3=12 196CONFIG_IRQ_TIMER3=12
197CONFIG_IRQ_TMR4=12 197CONFIG_IRQ_TIMER4=12
198CONFIG_IRQ_TMR5=12 198CONFIG_IRQ_TIMER5=12
199CONFIG_IRQ_TMR6=12 199CONFIG_IRQ_TIMER6=12
200CONFIG_IRQ_TMR7=12 200CONFIG_IRQ_TIMER7=12
201CONFIG_IRQ_PORTG_INTA=12 201CONFIG_IRQ_PORTG_INTA=12
202CONFIG_IRQ_PORTG_INTB=12 202CONFIG_IRQ_PORTG_INTB=12
203CONFIG_IRQ_MEM_DMA0=13 203CONFIG_IRQ_MEM_DMA0=13
@@ -292,7 +292,6 @@ CONFIG_SPLIT_PTLOCK_CPUS=4
292CONFIG_ZONE_DMA_FLAG=1 292CONFIG_ZONE_DMA_FLAG=1
293CONFIG_VIRT_TO_BUS=y 293CONFIG_VIRT_TO_BUS=y
294CONFIG_BFIN_GPTIMERS=y 294CONFIG_BFIN_GPTIMERS=y
295CONFIG_BFIN_DMA_5XX=y
296# CONFIG_DMA_UNCACHED_4M is not set 295# CONFIG_DMA_UNCACHED_4M is not set
297# CONFIG_DMA_UNCACHED_2M is not set 296# CONFIG_DMA_UNCACHED_2M is not set
298CONFIG_DMA_UNCACHED_1M=y 297CONFIG_DMA_UNCACHED_1M=y
@@ -650,6 +649,7 @@ CONFIG_BFIN_OTP=y
650# CONFIG_TWI_LCD is not set 649# CONFIG_TWI_LCD is not set
651CONFIG_SIMPLE_GPIO=m 650CONFIG_SIMPLE_GPIO=m
652# CONFIG_VT is not set 651# CONFIG_VT is not set
652# CONFIG_DEVKMEM is not set
653# CONFIG_SERIAL_NONSTANDARD is not set 653# CONFIG_SERIAL_NONSTANDARD is not set
654 654
655# 655#
@@ -699,7 +699,7 @@ CONFIG_I2C_CHARDEV=m
699# I2C Hardware Bus support 699# I2C Hardware Bus support
700# 700#
701CONFIG_I2C_BLACKFIN_TWI=m 701CONFIG_I2C_BLACKFIN_TWI=m
702CONFIG_I2C_BLACKFIN_TWI_CLK_KHZ=50 702CONFIG_I2C_BLACKFIN_TWI_CLK_KHZ=100
703# CONFIG_I2C_GPIO is not set 703# CONFIG_I2C_GPIO is not set
704# CONFIG_I2C_OCORES is not set 704# CONFIG_I2C_OCORES is not set
705# CONFIG_I2C_PARPORT_LIGHT is not set 705# CONFIG_I2C_PARPORT_LIGHT is not set
diff --git a/arch/blackfin/configs/CM-BF533_defconfig b/arch/blackfin/configs/CM-BF533_defconfig
index c3ba9066b935..085211b9e4e4 100644
--- a/arch/blackfin/configs/CM-BF533_defconfig
+++ b/arch/blackfin/configs/CM-BF533_defconfig
@@ -42,7 +42,7 @@ CONFIG_SYSVIPC_SYSCTL=y
42CONFIG_IKCONFIG=y 42CONFIG_IKCONFIG=y
43CONFIG_IKCONFIG_PROC=y 43CONFIG_IKCONFIG_PROC=y
44CONFIG_LOG_BUF_SHIFT=14 44CONFIG_LOG_BUF_SHIFT=14
45CONFIG_SYSFS_DEPRECATED=y 45# CONFIG_SYSFS_DEPRECATED is not set
46# CONFIG_RELAY is not set 46# CONFIG_RELAY is not set
47# CONFIG_BLK_DEV_INITRD is not set 47# CONFIG_BLK_DEV_INITRD is not set
48# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 48# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
@@ -55,7 +55,7 @@ CONFIG_KALLSYMS=y
55# CONFIG_HOTPLUG is not set 55# CONFIG_HOTPLUG is not set
56CONFIG_PRINTK=y 56CONFIG_PRINTK=y
57CONFIG_BUG=y 57CONFIG_BUG=y
58CONFIG_ELF_CORE=y 58# CONFIG_ELF_CORE is not set
59CONFIG_BASE_FULL=y 59CONFIG_BASE_FULL=y
60CONFIG_FUTEX=y 60CONFIG_FUTEX=y
61CONFIG_ANON_INODES=y 61CONFIG_ANON_INODES=y
@@ -254,7 +254,6 @@ CONFIG_SPLIT_PTLOCK_CPUS=4
254CONFIG_ZONE_DMA_FLAG=1 254CONFIG_ZONE_DMA_FLAG=1
255CONFIG_LARGE_ALLOCS=y 255CONFIG_LARGE_ALLOCS=y
256# CONFIG_BFIN_GPTIMERS is not set 256# CONFIG_BFIN_GPTIMERS is not set
257CONFIG_BFIN_DMA_5XX=y
258# CONFIG_DMA_UNCACHED_2M is not set 257# CONFIG_DMA_UNCACHED_2M is not set
259CONFIG_DMA_UNCACHED_1M=y 258CONFIG_DMA_UNCACHED_1M=y
260# CONFIG_DMA_UNCACHED_NONE is not set 259# CONFIG_DMA_UNCACHED_NONE is not set
@@ -598,6 +597,7 @@ CONFIG_NETDEV_10000=y
598CONFIG_BFIN_SPORT=y 597CONFIG_BFIN_SPORT=y
599# CONFIG_BFIN_TIMER_LATENCY is not set 598# CONFIG_BFIN_TIMER_LATENCY is not set
600# CONFIG_VT is not set 599# CONFIG_VT is not set
600# CONFIG_DEVKMEM is not set
601# CONFIG_SERIAL_NONSTANDARD is not set 601# CONFIG_SERIAL_NONSTANDARD is not set
602 602
603# 603#
diff --git a/arch/blackfin/configs/CM-BF537E_defconfig b/arch/blackfin/configs/CM-BF537E_defconfig
index cdc6b7feb59e..750203e27a46 100644
--- a/arch/blackfin/configs/CM-BF537E_defconfig
+++ b/arch/blackfin/configs/CM-BF537E_defconfig
@@ -42,7 +42,7 @@ CONFIG_SYSVIPC_SYSCTL=y
42CONFIG_IKCONFIG=y 42CONFIG_IKCONFIG=y
43CONFIG_IKCONFIG_PROC=y 43CONFIG_IKCONFIG_PROC=y
44CONFIG_LOG_BUF_SHIFT=14 44CONFIG_LOG_BUF_SHIFT=14
45CONFIG_SYSFS_DEPRECATED=y 45# CONFIG_SYSFS_DEPRECATED is not set
46# CONFIG_RELAY is not set 46# CONFIG_RELAY is not set
47# CONFIG_BLK_DEV_INITRD is not set 47# CONFIG_BLK_DEV_INITRD is not set
48# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 48# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
@@ -55,7 +55,7 @@ CONFIG_KALLSYMS=y
55# CONFIG_HOTPLUG is not set 55# CONFIG_HOTPLUG is not set
56CONFIG_PRINTK=y 56CONFIG_PRINTK=y
57CONFIG_BUG=y 57CONFIG_BUG=y
58CONFIG_ELF_CORE=y 58# CONFIG_ELF_CORE is not set
59CONFIG_BASE_FULL=y 59CONFIG_BASE_FULL=y
60CONFIG_FUTEX=y 60CONFIG_FUTEX=y
61CONFIG_ANON_INODES=y 61CONFIG_ANON_INODES=y
@@ -157,14 +157,14 @@ CONFIG_IRQ_UART1_RX=10
157CONFIG_IRQ_UART1_TX=10 157CONFIG_IRQ_UART1_TX=10
158CONFIG_IRQ_MAC_RX=11 158CONFIG_IRQ_MAC_RX=11
159CONFIG_IRQ_MAC_TX=11 159CONFIG_IRQ_MAC_TX=11
160CONFIG_IRQ_TMR0=12 160CONFIG_IRQ_TIMER0=12
161CONFIG_IRQ_TMR1=12 161CONFIG_IRQ_TIMER1=12
162CONFIG_IRQ_TMR2=12 162CONFIG_IRQ_TIMER2=12
163CONFIG_IRQ_TMR3=12 163CONFIG_IRQ_TIMER3=12
164CONFIG_IRQ_TMR4=12 164CONFIG_IRQ_TIMER4=12
165CONFIG_IRQ_TMR5=12 165CONFIG_IRQ_TIMER5=12
166CONFIG_IRQ_TMR6=12 166CONFIG_IRQ_TIMER6=12
167CONFIG_IRQ_TMR7=12 167CONFIG_IRQ_TIMER7=12
168CONFIG_IRQ_PORTG_INTB=12 168CONFIG_IRQ_PORTG_INTB=12
169CONFIG_IRQ_MEM_DMA0=13 169CONFIG_IRQ_MEM_DMA0=13
170CONFIG_IRQ_MEM_DMA1=13 170CONFIG_IRQ_MEM_DMA1=13
@@ -262,7 +262,6 @@ CONFIG_SPLIT_PTLOCK_CPUS=4
262CONFIG_ZONE_DMA_FLAG=1 262CONFIG_ZONE_DMA_FLAG=1
263CONFIG_LARGE_ALLOCS=y 263CONFIG_LARGE_ALLOCS=y
264# CONFIG_BFIN_GPTIMERS is not set 264# CONFIG_BFIN_GPTIMERS is not set
265CONFIG_BFIN_DMA_5XX=y
266# CONFIG_DMA_UNCACHED_2M is not set 265# CONFIG_DMA_UNCACHED_2M is not set
267CONFIG_DMA_UNCACHED_1M=y 266CONFIG_DMA_UNCACHED_1M=y
268# CONFIG_DMA_UNCACHED_NONE is not set 267# CONFIG_DMA_UNCACHED_NONE is not set
@@ -627,6 +626,7 @@ CONFIG_NETDEV_10000=y
627CONFIG_BFIN_SPORT=y 626CONFIG_BFIN_SPORT=y
628# CONFIG_BFIN_TIMER_LATENCY is not set 627# CONFIG_BFIN_TIMER_LATENCY is not set
629# CONFIG_VT is not set 628# CONFIG_VT is not set
629# CONFIG_DEVKMEM is not set
630# CONFIG_SERIAL_NONSTANDARD is not set 630# CONFIG_SERIAL_NONSTANDARD is not set
631 631
632# 632#
diff --git a/arch/blackfin/configs/CM-BF537U_defconfig b/arch/blackfin/configs/CM-BF537U_defconfig
index f074bdcd1ce5..dec8a7d5cc0e 100644
--- a/arch/blackfin/configs/CM-BF537U_defconfig
+++ b/arch/blackfin/configs/CM-BF537U_defconfig
@@ -42,7 +42,7 @@ CONFIG_SYSVIPC_SYSCTL=y
42CONFIG_IKCONFIG=y 42CONFIG_IKCONFIG=y
43CONFIG_IKCONFIG_PROC=y 43CONFIG_IKCONFIG_PROC=y
44CONFIG_LOG_BUF_SHIFT=14 44CONFIG_LOG_BUF_SHIFT=14
45CONFIG_SYSFS_DEPRECATED=y 45# CONFIG_SYSFS_DEPRECATED is not set
46# CONFIG_RELAY is not set 46# CONFIG_RELAY is not set
47# CONFIG_BLK_DEV_INITRD is not set 47# CONFIG_BLK_DEV_INITRD is not set
48# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 48# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
@@ -55,7 +55,7 @@ CONFIG_KALLSYMS=y
55# CONFIG_HOTPLUG is not set 55# CONFIG_HOTPLUG is not set
56CONFIG_PRINTK=y 56CONFIG_PRINTK=y
57CONFIG_BUG=y 57CONFIG_BUG=y
58CONFIG_ELF_CORE=y 58# CONFIG_ELF_CORE is not set
59CONFIG_BASE_FULL=y 59CONFIG_BASE_FULL=y
60CONFIG_FUTEX=y 60CONFIG_FUTEX=y
61CONFIG_ANON_INODES=y 61CONFIG_ANON_INODES=y
@@ -157,14 +157,14 @@ CONFIG_IRQ_UART1_RX=10
157CONFIG_IRQ_UART1_TX=10 157CONFIG_IRQ_UART1_TX=10
158CONFIG_IRQ_MAC_RX=11 158CONFIG_IRQ_MAC_RX=11
159CONFIG_IRQ_MAC_TX=11 159CONFIG_IRQ_MAC_TX=11
160CONFIG_IRQ_TMR0=12 160CONFIG_IRQ_TIMER0=12
161CONFIG_IRQ_TMR1=12 161CONFIG_IRQ_TIMER1=12
162CONFIG_IRQ_TMR2=12 162CONFIG_IRQ_TIMER2=12
163CONFIG_IRQ_TMR3=12 163CONFIG_IRQ_TIMER3=12
164CONFIG_IRQ_TMR4=12 164CONFIG_IRQ_TIMER4=12
165CONFIG_IRQ_TMR5=12 165CONFIG_IRQ_TIMER5=12
166CONFIG_IRQ_TMR6=12 166CONFIG_IRQ_TIMER6=12
167CONFIG_IRQ_TMR7=12 167CONFIG_IRQ_TIMER7=12
168CONFIG_IRQ_PORTG_INTB=12 168CONFIG_IRQ_PORTG_INTB=12
169CONFIG_IRQ_MEM_DMA0=13 169CONFIG_IRQ_MEM_DMA0=13
170CONFIG_IRQ_MEM_DMA1=13 170CONFIG_IRQ_MEM_DMA1=13
@@ -262,7 +262,6 @@ CONFIG_SPLIT_PTLOCK_CPUS=4
262CONFIG_ZONE_DMA_FLAG=1 262CONFIG_ZONE_DMA_FLAG=1
263CONFIG_LARGE_ALLOCS=y 263CONFIG_LARGE_ALLOCS=y
264# CONFIG_BFIN_GPTIMERS is not set 264# CONFIG_BFIN_GPTIMERS is not set
265CONFIG_BFIN_DMA_5XX=y
266# CONFIG_DMA_UNCACHED_2M is not set 265# CONFIG_DMA_UNCACHED_2M is not set
267CONFIG_DMA_UNCACHED_1M=y 266CONFIG_DMA_UNCACHED_1M=y
268# CONFIG_DMA_UNCACHED_NONE is not set 267# CONFIG_DMA_UNCACHED_NONE is not set
@@ -607,6 +606,7 @@ CONFIG_NETDEV_10000=y
607CONFIG_BFIN_SPORT=y 606CONFIG_BFIN_SPORT=y
608# CONFIG_BFIN_TIMER_LATENCY is not set 607# CONFIG_BFIN_TIMER_LATENCY is not set
609# CONFIG_VT is not set 608# CONFIG_VT is not set
609# CONFIG_DEVKMEM is not set
610# CONFIG_SERIAL_NONSTANDARD is not set 610# CONFIG_SERIAL_NONSTANDARD is not set
611 611
612# 612#
diff --git a/arch/blackfin/configs/CM-BF548_defconfig b/arch/blackfin/configs/CM-BF548_defconfig
index 5c44fdb8e6e3..efd68bc78f35 100644
--- a/arch/blackfin/configs/CM-BF548_defconfig
+++ b/arch/blackfin/configs/CM-BF548_defconfig
@@ -41,7 +41,7 @@ CONFIG_LOG_BUF_SHIFT=14
41CONFIG_FAIR_GROUP_SCHED=y 41CONFIG_FAIR_GROUP_SCHED=y
42CONFIG_FAIR_USER_SCHED=y 42CONFIG_FAIR_USER_SCHED=y
43# CONFIG_FAIR_CGROUP_SCHED is not set 43# CONFIG_FAIR_CGROUP_SCHED is not set
44CONFIG_SYSFS_DEPRECATED=y 44# CONFIG_SYSFS_DEPRECATED is not set
45# CONFIG_RELAY is not set 45# CONFIG_RELAY is not set
46CONFIG_BLK_DEV_INITRD=y 46CONFIG_BLK_DEV_INITRD=y
47CONFIG_INITRAMFS_SOURCE="" 47CONFIG_INITRAMFS_SOURCE=""
@@ -55,7 +55,7 @@ CONFIG_KALLSYMS=y
55CONFIG_HOTPLUG=y 55CONFIG_HOTPLUG=y
56CONFIG_PRINTK=y 56CONFIG_PRINTK=y
57CONFIG_BUG=y 57CONFIG_BUG=y
58CONFIG_ELF_CORE=y 58# CONFIG_ELF_CORE is not set
59CONFIG_BASE_FULL=y 59CONFIG_BASE_FULL=y
60CONFIG_FUTEX=y 60CONFIG_FUTEX=y
61CONFIG_ANON_INODES=y 61CONFIG_ANON_INODES=y
@@ -325,7 +325,6 @@ CONFIG_SPLIT_PTLOCK_CPUS=4
325CONFIG_ZONE_DMA_FLAG=1 325CONFIG_ZONE_DMA_FLAG=1
326CONFIG_VIRT_TO_BUS=y 326CONFIG_VIRT_TO_BUS=y
327# CONFIG_BFIN_GPTIMERS is not set 327# CONFIG_BFIN_GPTIMERS is not set
328CONFIG_BFIN_DMA_5XX=y
329# CONFIG_DMA_UNCACHED_2M is not set 328# CONFIG_DMA_UNCACHED_2M is not set
330CONFIG_DMA_UNCACHED_1M=y 329CONFIG_DMA_UNCACHED_1M=y
331# CONFIG_DMA_UNCACHED_NONE is not set 330# CONFIG_DMA_UNCACHED_NONE is not set
@@ -544,7 +543,7 @@ CONFIG_MTD_RAM=y
544CONFIG_MTD_COMPLEX_MAPPINGS=y 543CONFIG_MTD_COMPLEX_MAPPINGS=y
545CONFIG_MTD_PHYSMAP=y 544CONFIG_MTD_PHYSMAP=y
546CONFIG_MTD_PHYSMAP_START=0x20000000 545CONFIG_MTD_PHYSMAP_START=0x20000000
547CONFIG_MTD_PHYSMAP_LEN=0x800000 546CONFIG_MTD_PHYSMAP_LEN=0
548CONFIG_MTD_PHYSMAP_BANKWIDTH=2 547CONFIG_MTD_PHYSMAP_BANKWIDTH=2
549# CONFIG_MTD_UCLINUX is not set 548# CONFIG_MTD_UCLINUX is not set
550# CONFIG_MTD_PLATRAM is not set 549# CONFIG_MTD_PLATRAM is not set
@@ -732,6 +731,7 @@ CONFIG_BFIN_OTP=y
732# CONFIG_TWI_LCD is not set 731# CONFIG_TWI_LCD is not set
733# CONFIG_SIMPLE_GPIO is not set 732# CONFIG_SIMPLE_GPIO is not set
734# CONFIG_VT is not set 733# CONFIG_VT is not set
734# CONFIG_DEVKMEM is not set
735# CONFIG_SERIAL_NONSTANDARD is not set 735# CONFIG_SERIAL_NONSTANDARD is not set
736 736
737# 737#
@@ -782,7 +782,7 @@ CONFIG_I2C_CHARDEV=y
782# I2C Hardware Bus support 782# I2C Hardware Bus support
783# 783#
784CONFIG_I2C_BLACKFIN_TWI=y 784CONFIG_I2C_BLACKFIN_TWI=y
785CONFIG_I2C_BLACKFIN_TWI_CLK_KHZ=50 785CONFIG_I2C_BLACKFIN_TWI_CLK_KHZ=100
786# CONFIG_I2C_GPIO is not set 786# CONFIG_I2C_GPIO is not set
787# CONFIG_I2C_OCORES is not set 787# CONFIG_I2C_OCORES is not set
788# CONFIG_I2C_PARPORT_LIGHT is not set 788# CONFIG_I2C_PARPORT_LIGHT is not set
diff --git a/arch/blackfin/configs/CM-BF561_defconfig b/arch/blackfin/configs/CM-BF561_defconfig
index 086fe5dda495..346bc7af8f42 100644
--- a/arch/blackfin/configs/CM-BF561_defconfig
+++ b/arch/blackfin/configs/CM-BF561_defconfig
@@ -42,7 +42,7 @@ CONFIG_LOG_BUF_SHIFT=14
42CONFIG_FAIR_GROUP_SCHED=y 42CONFIG_FAIR_GROUP_SCHED=y
43CONFIG_FAIR_USER_SCHED=y 43CONFIG_FAIR_USER_SCHED=y
44# CONFIG_FAIR_CGROUP_SCHED is not set 44# CONFIG_FAIR_CGROUP_SCHED is not set
45CONFIG_SYSFS_DEPRECATED=y 45# CONFIG_SYSFS_DEPRECATED is not set
46# CONFIG_RELAY is not set 46# CONFIG_RELAY is not set
47# CONFIG_BLK_DEV_INITRD is not set 47# CONFIG_BLK_DEV_INITRD is not set
48# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 48# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
@@ -55,7 +55,7 @@ CONFIG_KALLSYMS=y
55# CONFIG_HOTPLUG is not set 55# CONFIG_HOTPLUG is not set
56CONFIG_PRINTK=y 56CONFIG_PRINTK=y
57CONFIG_BUG=y 57CONFIG_BUG=y
58CONFIG_ELF_CORE=y 58# CONFIG_ELF_CORE is not set
59CONFIG_BASE_FULL=y 59CONFIG_BASE_FULL=y
60CONFIG_FUTEX=y 60CONFIG_FUTEX=y
61CONFIG_ANON_INODES=y 61CONFIG_ANON_INODES=y
@@ -300,7 +300,6 @@ CONFIG_ZONE_DMA_FLAG=1
300CONFIG_VIRT_TO_BUS=y 300CONFIG_VIRT_TO_BUS=y
301CONFIG_LARGE_ALLOCS=y 301CONFIG_LARGE_ALLOCS=y
302# CONFIG_BFIN_GPTIMERS is not set 302# CONFIG_BFIN_GPTIMERS is not set
303CONFIG_BFIN_DMA_5XX=y
304# CONFIG_DMA_UNCACHED_2M is not set 303# CONFIG_DMA_UNCACHED_2M is not set
305CONFIG_DMA_UNCACHED_1M=y 304CONFIG_DMA_UNCACHED_1M=y
306# CONFIG_DMA_UNCACHED_NONE is not set 305# CONFIG_DMA_UNCACHED_NONE is not set
@@ -612,6 +611,7 @@ CONFIG_NETDEV_10000=y
612# CONFIG_BFIN_TIMER_LATENCY is not set 611# CONFIG_BFIN_TIMER_LATENCY is not set
613# CONFIG_SIMPLE_GPIO is not set 612# CONFIG_SIMPLE_GPIO is not set
614# CONFIG_VT is not set 613# CONFIG_VT is not set
614# CONFIG_DEVKMEM is not set
615# CONFIG_SERIAL_NONSTANDARD is not set 615# CONFIG_SERIAL_NONSTANDARD is not set
616 616
617# 617#
diff --git a/arch/blackfin/configs/H8606_defconfig b/arch/blackfin/configs/H8606_defconfig
index 1fc31f1b762b..5d3901d23fd1 100644
--- a/arch/blackfin/configs/H8606_defconfig
+++ b/arch/blackfin/configs/H8606_defconfig
@@ -54,7 +54,7 @@ CONFIG_KALLSYMS=y
54CONFIG_HOTPLUG=y 54CONFIG_HOTPLUG=y
55CONFIG_PRINTK=y 55CONFIG_PRINTK=y
56CONFIG_BUG=y 56CONFIG_BUG=y
57CONFIG_ELF_CORE=y 57# CONFIG_ELF_CORE is not set
58CONFIG_BASE_FULL=y 58CONFIG_BASE_FULL=y
59CONFIG_FUTEX=y 59CONFIG_FUTEX=y
60CONFIG_ANON_INODES=y 60CONFIG_ANON_INODES=y
@@ -250,7 +250,6 @@ CONFIG_SPLIT_PTLOCK_CPUS=4
250CONFIG_ZONE_DMA_FLAG=1 250CONFIG_ZONE_DMA_FLAG=1
251CONFIG_LARGE_ALLOCS=y 251CONFIG_LARGE_ALLOCS=y
252CONFIG_BFIN_GPTIMERS=y 252CONFIG_BFIN_GPTIMERS=y
253CONFIG_BFIN_DMA_5XX=y
254# CONFIG_DMA_UNCACHED_2M is not set 253# CONFIG_DMA_UNCACHED_2M is not set
255CONFIG_DMA_UNCACHED_1M=y 254CONFIG_DMA_UNCACHED_1M=y
256# CONFIG_DMA_UNCACHED_NONE is not set 255# CONFIG_DMA_UNCACHED_NONE is not set
diff --git a/arch/blackfin/configs/IP0X_defconfig b/arch/blackfin/configs/IP0X_defconfig
index 285d2241df26..e66f5daaa828 100644
--- a/arch/blackfin/configs/IP0X_defconfig
+++ b/arch/blackfin/configs/IP0X_defconfig
@@ -55,7 +55,7 @@ CONFIG_KALLSYMS=y
55# CONFIG_HOTPLUG is not set 55# CONFIG_HOTPLUG is not set
56CONFIG_PRINTK=y 56CONFIG_PRINTK=y
57CONFIG_BUG=y 57CONFIG_BUG=y
58CONFIG_ELF_CORE=y 58# CONFIG_ELF_CORE is not set
59CONFIG_BASE_FULL=y 59CONFIG_BASE_FULL=y
60CONFIG_FUTEX=y 60CONFIG_FUTEX=y
61CONFIG_ANON_INODES=y 61CONFIG_ANON_INODES=y
@@ -262,7 +262,6 @@ CONFIG_SPLIT_PTLOCK_CPUS=4
262CONFIG_ZONE_DMA_FLAG=1 262CONFIG_ZONE_DMA_FLAG=1
263CONFIG_LARGE_ALLOCS=y 263CONFIG_LARGE_ALLOCS=y
264# CONFIG_BFIN_GPTIMERS is not set 264# CONFIG_BFIN_GPTIMERS is not set
265CONFIG_BFIN_DMA_5XX=y
266# CONFIG_DMA_UNCACHED_2M is not set 265# CONFIG_DMA_UNCACHED_2M is not set
267CONFIG_DMA_UNCACHED_1M=y 266CONFIG_DMA_UNCACHED_1M=y
268# CONFIG_DMA_UNCACHED_NONE is not set 267# CONFIG_DMA_UNCACHED_NONE is not set
diff --git a/arch/blackfin/configs/PNAV-10_defconfig b/arch/blackfin/configs/PNAV-10_defconfig
index bffca7de65d4..ce5dde9de9db 100644
--- a/arch/blackfin/configs/PNAV-10_defconfig
+++ b/arch/blackfin/configs/PNAV-10_defconfig
@@ -1,6 +1,6 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.22.12 3# Linux kernel version: 2.6.28-rc2
4# 4#
5# CONFIG_MMU is not set 5# CONFIG_MMU is not set
6# CONFIG_FPU is not set 6# CONFIG_FPU is not set
@@ -8,41 +8,37 @@ CONFIG_RWSEM_GENERIC_SPINLOCK=y
8# CONFIG_RWSEM_XCHGADD_ALGORITHM is not set 8# CONFIG_RWSEM_XCHGADD_ALGORITHM is not set
9CONFIG_BLACKFIN=y 9CONFIG_BLACKFIN=y
10CONFIG_ZONE_DMA=y 10CONFIG_ZONE_DMA=y
11CONFIG_SEMAPHORE_SLEEPERS=y
12CONFIG_GENERIC_FIND_NEXT_BIT=y 11CONFIG_GENERIC_FIND_NEXT_BIT=y
13CONFIG_GENERIC_HWEIGHT=y 12CONFIG_GENERIC_HWEIGHT=y
14CONFIG_GENERIC_HARDIRQS=y 13CONFIG_GENERIC_HARDIRQS=y
15CONFIG_GENERIC_IRQ_PROBE=y 14CONFIG_GENERIC_IRQ_PROBE=y
16CONFIG_GENERIC_TIME=y
17CONFIG_GENERIC_GPIO=y 15CONFIG_GENERIC_GPIO=y
18CONFIG_FORCE_MAX_ZONEORDER=14 16CONFIG_FORCE_MAX_ZONEORDER=14
19CONFIG_GENERIC_CALIBRATE_DELAY=y 17CONFIG_GENERIC_CALIBRATE_DELAY=y
20CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 18CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
21 19
22# 20#
23# Code maturity level options 21# General setup
24# 22#
25CONFIG_EXPERIMENTAL=y 23CONFIG_EXPERIMENTAL=y
26CONFIG_BROKEN_ON_SMP=y 24CONFIG_BROKEN_ON_SMP=y
27CONFIG_INIT_ENV_ARG_LIMIT=32 25CONFIG_INIT_ENV_ARG_LIMIT=32
28
29#
30# General setup
31#
32CONFIG_LOCALVERSION="" 26CONFIG_LOCALVERSION=""
33CONFIG_LOCALVERSION_AUTO=y 27CONFIG_LOCALVERSION_AUTO=y
34CONFIG_SYSVIPC=y 28CONFIG_SYSVIPC=y
35# CONFIG_IPC_NS is not set
36CONFIG_SYSVIPC_SYSCTL=y 29CONFIG_SYSVIPC_SYSCTL=y
37# CONFIG_POSIX_MQUEUE is not set 30# CONFIG_POSIX_MQUEUE is not set
38# CONFIG_BSD_PROCESS_ACCT is not set 31# CONFIG_BSD_PROCESS_ACCT is not set
39# CONFIG_TASKSTATS is not set 32# CONFIG_TASKSTATS is not set
40# CONFIG_UTS_NS is not set
41# CONFIG_AUDIT is not set 33# CONFIG_AUDIT is not set
42# CONFIG_IKCONFIG is not set 34# CONFIG_IKCONFIG is not set
43CONFIG_LOG_BUF_SHIFT=14 35CONFIG_LOG_BUF_SHIFT=14
44CONFIG_SYSFS_DEPRECATED=y 36# CONFIG_CGROUPS is not set
37# CONFIG_GROUP_SCHED is not set
38# CONFIG_SYSFS_DEPRECATED is not set
39# CONFIG_SYSFS_DEPRECATED_V2 is not set
45# CONFIG_RELAY is not set 40# CONFIG_RELAY is not set
41# CONFIG_NAMESPACES is not set
46# CONFIG_BLK_DEV_INITRD is not set 42# CONFIG_BLK_DEV_INITRD is not set
47# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 43# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
48CONFIG_SYSCTL=y 44CONFIG_SYSCTL=y
@@ -54,40 +50,41 @@ CONFIG_KALLSYMS=y
54CONFIG_HOTPLUG=y 50CONFIG_HOTPLUG=y
55CONFIG_PRINTK=y 51CONFIG_PRINTK=y
56CONFIG_BUG=y 52CONFIG_BUG=y
57CONFIG_ELF_CORE=y 53# CONFIG_ELF_CORE is not set
54CONFIG_COMPAT_BRK=y
58CONFIG_BASE_FULL=y 55CONFIG_BASE_FULL=y
59CONFIG_FUTEX=y 56CONFIG_FUTEX=y
60CONFIG_ANON_INODES=y 57CONFIG_ANON_INODES=y
61CONFIG_EPOLL=y 58CONFIG_EPOLL=y
62CONFIG_SIGNALFD=y 59CONFIG_SIGNALFD=y
60CONFIG_TIMERFD=y
63CONFIG_EVENTFD=y 61CONFIG_EVENTFD=y
62CONFIG_AIO=y
64CONFIG_VM_EVENT_COUNTERS=y 63CONFIG_VM_EVENT_COUNTERS=y
65CONFIG_BIG_ORDER_ALLOC_NOFAIL_MAGIC=9
66# CONFIG_NP2 is not set
67CONFIG_SLAB=y 64CONFIG_SLAB=y
68# CONFIG_SLUB is not set 65# CONFIG_SLUB is not set
69# CONFIG_SLOB is not set 66# CONFIG_SLOB is not set
67# CONFIG_PROFILING is not set
68# CONFIG_MARKERS is not set
69CONFIG_HAVE_OPROFILE=y
70# CONFIG_HAVE_GENERIC_DMA_COHERENT is not set
71CONFIG_SLABINFO=y
70CONFIG_RT_MUTEXES=y 72CONFIG_RT_MUTEXES=y
71CONFIG_TINY_SHMEM=y 73CONFIG_TINY_SHMEM=y
72CONFIG_BASE_SMALL=0 74CONFIG_BASE_SMALL=0
73
74#
75# Loadable module support
76#
77CONFIG_MODULES=y 75CONFIG_MODULES=y
76# CONFIG_MODULE_FORCE_LOAD is not set
78CONFIG_MODULE_UNLOAD=y 77CONFIG_MODULE_UNLOAD=y
79# CONFIG_MODULE_FORCE_UNLOAD is not set 78# CONFIG_MODULE_FORCE_UNLOAD is not set
80# CONFIG_MODVERSIONS is not set 79# CONFIG_MODVERSIONS is not set
81# CONFIG_MODULE_SRCVERSION_ALL is not set 80# CONFIG_MODULE_SRCVERSION_ALL is not set
82CONFIG_KMOD=y 81CONFIG_KMOD=y
83
84#
85# Block layer
86#
87CONFIG_BLOCK=y 82CONFIG_BLOCK=y
88# CONFIG_LBD is not set 83# CONFIG_LBD is not set
89# CONFIG_BLK_DEV_IO_TRACE is not set 84# CONFIG_BLK_DEV_IO_TRACE is not set
90# CONFIG_LSF is not set 85# CONFIG_LSF is not set
86# CONFIG_BLK_DEV_BSG is not set
87# CONFIG_BLK_DEV_INTEGRITY is not set
91 88
92# 89#
93# IO Schedulers 90# IO Schedulers
@@ -101,9 +98,11 @@ CONFIG_DEFAULT_AS=y
101# CONFIG_DEFAULT_CFQ is not set 98# CONFIG_DEFAULT_CFQ is not set
102# CONFIG_DEFAULT_NOOP is not set 99# CONFIG_DEFAULT_NOOP is not set
103CONFIG_DEFAULT_IOSCHED="anticipatory" 100CONFIG_DEFAULT_IOSCHED="anticipatory"
101CONFIG_CLASSIC_RCU=y
104# CONFIG_PREEMPT_NONE is not set 102# CONFIG_PREEMPT_NONE is not set
105CONFIG_PREEMPT_VOLUNTARY=y 103CONFIG_PREEMPT_VOLUNTARY=y
106# CONFIG_PREEMPT is not set 104# CONFIG_PREEMPT is not set
105# CONFIG_FREEZER is not set
107 106
108# 107#
109# Blackfin Processor Options 108# Blackfin Processor Options
@@ -112,8 +111,15 @@ CONFIG_PREEMPT_VOLUNTARY=y
112# 111#
113# Processor and Board Settings 112# Processor and Board Settings
114# 113#
114# CONFIG_BF512 is not set
115# CONFIG_BF514 is not set
116# CONFIG_BF516 is not set
117# CONFIG_BF518 is not set
115# CONFIG_BF522 is not set 118# CONFIG_BF522 is not set
119# CONFIG_BF523 is not set
120# CONFIG_BF524 is not set
116# CONFIG_BF525 is not set 121# CONFIG_BF525 is not set
122# CONFIG_BF526 is not set
117# CONFIG_BF527 is not set 123# CONFIG_BF527 is not set
118# CONFIG_BF531 is not set 124# CONFIG_BF531 is not set
119# CONFIG_BF532 is not set 125# CONFIG_BF532 is not set
@@ -121,22 +127,26 @@ CONFIG_PREEMPT_VOLUNTARY=y
121# CONFIG_BF534 is not set 127# CONFIG_BF534 is not set
122# CONFIG_BF536 is not set 128# CONFIG_BF536 is not set
123CONFIG_BF537=y 129CONFIG_BF537=y
130# CONFIG_BF538 is not set
131# CONFIG_BF539 is not set
124# CONFIG_BF542 is not set 132# CONFIG_BF542 is not set
125# CONFIG_BF544 is not set 133# CONFIG_BF544 is not set
126# CONFIG_BF547 is not set 134# CONFIG_BF547 is not set
127# CONFIG_BF548 is not set 135# CONFIG_BF548 is not set
128# CONFIG_BF549 is not set 136# CONFIG_BF549 is not set
129# CONFIG_BF561 is not set 137# CONFIG_BF561 is not set
138CONFIG_BF_REV_MIN=2
139CONFIG_BF_REV_MAX=3
130# CONFIG_BF_REV_0_0 is not set 140# CONFIG_BF_REV_0_0 is not set
131# CONFIG_BF_REV_0_1 is not set 141# CONFIG_BF_REV_0_1 is not set
132CONFIG_BF_REV_0_2=y 142CONFIG_BF_REV_0_2=y
133# CONFIG_BF_REV_0_3 is not set 143# CONFIG_BF_REV_0_3 is not set
134# CONFIG_BF_REV_0_4 is not set 144# CONFIG_BF_REV_0_4 is not set
135# CONFIG_BF_REV_0_5 is not set 145# CONFIG_BF_REV_0_5 is not set
146# CONFIG_BF_REV_0_6 is not set
136# CONFIG_BF_REV_ANY is not set 147# CONFIG_BF_REV_ANY is not set
137# CONFIG_BF_REV_NONE is not set 148# CONFIG_BF_REV_NONE is not set
138CONFIG_BF53x=y 149CONFIG_BF53x=y
139CONFIG_BFIN_SINGLE_CORE=y
140CONFIG_MEM_MT48LC32M8A2_75=y 150CONFIG_MEM_MT48LC32M8A2_75=y
141CONFIG_IRQ_PLL_WAKEUP=7 151CONFIG_IRQ_PLL_WAKEUP=7
142CONFIG_IRQ_RTC=8 152CONFIG_IRQ_RTC=8
@@ -146,28 +156,30 @@ CONFIG_IRQ_SPORT0_TX=9
146CONFIG_IRQ_SPORT1_RX=9 156CONFIG_IRQ_SPORT1_RX=9
147CONFIG_IRQ_SPORT1_TX=9 157CONFIG_IRQ_SPORT1_TX=9
148CONFIG_IRQ_TWI=10 158CONFIG_IRQ_TWI=10
149CONFIG_IRQ_SPI=10
150CONFIG_IRQ_UART0_RX=10 159CONFIG_IRQ_UART0_RX=10
151CONFIG_IRQ_UART0_TX=10 160CONFIG_IRQ_UART0_TX=10
152CONFIG_IRQ_UART1_RX=10 161CONFIG_IRQ_UART1_RX=10
153CONFIG_IRQ_UART1_TX=10 162CONFIG_IRQ_UART1_TX=10
154CONFIG_IRQ_MAC_RX=11 163CONFIG_IRQ_MAC_RX=11
155CONFIG_IRQ_MAC_TX=11 164CONFIG_IRQ_MAC_TX=11
156CONFIG_IRQ_TMR0=12 165CONFIG_IRQ_TIMER0=12
157CONFIG_IRQ_TMR1=12 166CONFIG_IRQ_TIMER1=12
158CONFIG_IRQ_TMR2=12 167CONFIG_IRQ_TIMER2=12
159CONFIG_IRQ_TMR3=12 168CONFIG_IRQ_TIMER3=12
160CONFIG_IRQ_TMR4=12 169CONFIG_IRQ_TIMER4=12
161CONFIG_IRQ_TMR5=12 170CONFIG_IRQ_TIMER5=12
162CONFIG_IRQ_TMR6=12 171CONFIG_IRQ_TIMER6=12
163CONFIG_IRQ_TMR7=12 172CONFIG_IRQ_TIMER7=12
164CONFIG_IRQ_PORTG_INTB=12 173CONFIG_IRQ_PORTG_INTB=12
165CONFIG_IRQ_MEM_DMA0=13 174CONFIG_IRQ_MEM_DMA0=13
166CONFIG_IRQ_MEM_DMA1=13 175CONFIG_IRQ_MEM_DMA1=13
167CONFIG_IRQ_WATCH=13 176CONFIG_IRQ_WATCH=13
177CONFIG_IRQ_SPI=10
168# CONFIG_BFIN537_STAMP is not set 178# CONFIG_BFIN537_STAMP is not set
169# CONFIG_BFIN537_BLUETECHNIX_CM is not set 179# CONFIG_BFIN537_BLUETECHNIX_CM is not set
180# CONFIG_BFIN537_BLUETECHNIX_TCM is not set
170CONFIG_PNAV10=y 181CONFIG_PNAV10=y
182# CONFIG_CAMSIG_MINOTAUR is not set
171# CONFIG_GENERIC_BF537_BOARD is not set 183# CONFIG_GENERIC_BF537_BOARD is not set
172 184
173# 185#
@@ -191,6 +203,7 @@ CONFIG_IRQ_PROG_INTA=12
191# Board customizations 203# Board customizations
192# 204#
193# CONFIG_CMDLINE_BOOL is not set 205# CONFIG_CMDLINE_BOOL is not set
206CONFIG_BOOT_LOAD=0x1000
194 207
195# 208#
196# Clock/PLL Setup 209# Clock/PLL Setup
@@ -199,7 +212,7 @@ CONFIG_CLKIN_HZ=24576000
199# CONFIG_BFIN_KERNEL_CLOCK is not set 212# CONFIG_BFIN_KERNEL_CLOCK is not set
200CONFIG_MAX_VCO_HZ=600000000 213CONFIG_MAX_VCO_HZ=600000000
201CONFIG_MIN_VCO_HZ=50000000 214CONFIG_MIN_VCO_HZ=50000000
202CONFIG_MAX_SCLK_HZ=133000000 215CONFIG_MAX_SCLK_HZ=133333333
203CONFIG_MIN_SCLK_HZ=27000000 216CONFIG_MIN_SCLK_HZ=27000000
204 217
205# 218#
@@ -210,13 +223,17 @@ CONFIG_HZ_250=y
210# CONFIG_HZ_300 is not set 223# CONFIG_HZ_300 is not set
211# CONFIG_HZ_1000 is not set 224# CONFIG_HZ_1000 is not set
212CONFIG_HZ=250 225CONFIG_HZ=250
226# CONFIG_SCHED_HRTICK is not set
227CONFIG_GENERIC_TIME=y
228CONFIG_GENERIC_CLOCKEVENTS=y
229# CONFIG_CYCLES_CLOCKSOURCE is not set
230# CONFIG_NO_HZ is not set
231# CONFIG_HIGH_RES_TIMERS is not set
232CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
213 233
214# 234#
215# Memory Setup 235# Misc
216# 236#
217CONFIG_MAX_MEM_SIZE=64
218CONFIG_MEM_ADD_WIDTH=10
219CONFIG_BOOT_LOAD=0x1000
220CONFIG_BFIN_SCRATCH_REG_RETN=y 237CONFIG_BFIN_SCRATCH_REG_RETN=y
221# CONFIG_BFIN_SCRATCH_REG_RETE is not set 238# CONFIG_BFIN_SCRATCH_REG_RETE is not set
222# CONFIG_BFIN_SCRATCH_REG_CYCLES is not set 239# CONFIG_BFIN_SCRATCH_REG_CYCLES is not set
@@ -243,6 +260,12 @@ CONFIG_IP_CHECKSUM_L1=y
243CONFIG_CACHELINE_ALIGNED_L1=y 260CONFIG_CACHELINE_ALIGNED_L1=y
244CONFIG_SYSCALL_TAB_L1=y 261CONFIG_SYSCALL_TAB_L1=y
245CONFIG_CPLB_SWITCH_TAB_L1=y 262CONFIG_CPLB_SWITCH_TAB_L1=y
263CONFIG_APP_STACK_L1=y
264
265#
266# Speed Optimizations
267#
268CONFIG_BFIN_INS_LOWOVERHEAD=y
246CONFIG_RAMKERNEL=y 269CONFIG_RAMKERNEL=y
247# CONFIG_ROMKERNEL is not set 270# CONFIG_ROMKERNEL is not set
248CONFIG_SELECT_MEMORY_MODEL=y 271CONFIG_SELECT_MEMORY_MODEL=y
@@ -251,13 +274,14 @@ CONFIG_FLATMEM_MANUAL=y
251# CONFIG_SPARSEMEM_MANUAL is not set 274# CONFIG_SPARSEMEM_MANUAL is not set
252CONFIG_FLATMEM=y 275CONFIG_FLATMEM=y
253CONFIG_FLAT_NODE_MEM_MAP=y 276CONFIG_FLAT_NODE_MEM_MAP=y
254# CONFIG_SPARSEMEM_STATIC is not set 277CONFIG_PAGEFLAGS_EXTENDED=y
255CONFIG_SPLIT_PTLOCK_CPUS=4 278CONFIG_SPLIT_PTLOCK_CPUS=4
256# CONFIG_RESOURCES_64BIT is not set 279# CONFIG_RESOURCES_64BIT is not set
280# CONFIG_PHYS_ADDR_T_64BIT is not set
257CONFIG_ZONE_DMA_FLAG=1 281CONFIG_ZONE_DMA_FLAG=1
258CONFIG_LARGE_ALLOCS=y 282CONFIG_VIRT_TO_BUS=y
259# CONFIG_BFIN_GPTIMERS is not set 283CONFIG_BFIN_GPTIMERS=y
260CONFIG_BFIN_DMA_5XX=y 284# CONFIG_DMA_UNCACHED_4M is not set
261# CONFIG_DMA_UNCACHED_2M is not set 285# CONFIG_DMA_UNCACHED_2M is not set
262CONFIG_DMA_UNCACHED_1M=y 286CONFIG_DMA_UNCACHED_1M=y
263# CONFIG_DMA_UNCACHED_NONE is not set 287# CONFIG_DMA_UNCACHED_NONE is not set
@@ -271,7 +295,7 @@ CONFIG_BFIN_DCACHE=y
271# CONFIG_BFIN_ICACHE_LOCK is not set 295# CONFIG_BFIN_ICACHE_LOCK is not set
272CONFIG_BFIN_WB=y 296CONFIG_BFIN_WB=y
273# CONFIG_BFIN_WT is not set 297# CONFIG_BFIN_WT is not set
274CONFIG_L1_MAX_PIECE=16 298# CONFIG_MPU is not set
275 299
276# 300#
277# Asynchonous Memory Configuration 301# Asynchonous Memory Configuration
@@ -299,12 +323,7 @@ CONFIG_BANK_3=0x99B2
299# 323#
300# Bus options (PCI, PCMCIA, EISA, MCA, ISA) 324# Bus options (PCI, PCMCIA, EISA, MCA, ISA)
301# 325#
302# CONFIG_PCI is not set
303# CONFIG_ARCH_SUPPORTS_MSI is not set 326# CONFIG_ARCH_SUPPORTS_MSI is not set
304
305#
306# PCCARD (PCMCIA/CardBus) support
307#
308# CONFIG_PCCARD is not set 327# CONFIG_PCCARD is not set
309 328
310# 329#
@@ -314,21 +333,20 @@ CONFIG_BINFMT_ELF_FDPIC=y
314CONFIG_BINFMT_FLAT=y 333CONFIG_BINFMT_FLAT=y
315CONFIG_BINFMT_ZFLAT=y 334CONFIG_BINFMT_ZFLAT=y
316# CONFIG_BINFMT_SHARED_FLAT is not set 335# CONFIG_BINFMT_SHARED_FLAT is not set
336# CONFIG_HAVE_AOUT is not set
317# CONFIG_BINFMT_MISC is not set 337# CONFIG_BINFMT_MISC is not set
318 338
319# 339#
320# Power management options 340# Power management options
321# 341#
322# CONFIG_PM is not set 342# CONFIG_PM is not set
343CONFIG_ARCH_SUSPEND_POSSIBLE=y
344# CONFIG_PM_WAKEUP_BY_GPIO is not set
323 345
324# 346#
325# CPU Frequency scaling 347# CPU Frequency scaling
326# 348#
327# CONFIG_CPU_FREQ is not set 349# CONFIG_CPU_FREQ is not set
328
329#
330# Networking
331#
332CONFIG_NET=y 350CONFIG_NET=y
333 351
334# 352#
@@ -341,6 +359,7 @@ CONFIG_XFRM=y
341# CONFIG_XFRM_USER is not set 359# CONFIG_XFRM_USER is not set
342# CONFIG_XFRM_SUB_POLICY is not set 360# CONFIG_XFRM_SUB_POLICY is not set
343# CONFIG_XFRM_MIGRATE is not set 361# CONFIG_XFRM_MIGRATE is not set
362# CONFIG_XFRM_STATISTICS is not set
344# CONFIG_NET_KEY is not set 363# CONFIG_NET_KEY is not set
345CONFIG_INET=y 364CONFIG_INET=y
346# CONFIG_IP_MULTICAST is not set 365# CONFIG_IP_MULTICAST is not set
@@ -362,6 +381,7 @@ CONFIG_SYN_COOKIES=y
362CONFIG_INET_XFRM_MODE_TRANSPORT=y 381CONFIG_INET_XFRM_MODE_TRANSPORT=y
363CONFIG_INET_XFRM_MODE_TUNNEL=y 382CONFIG_INET_XFRM_MODE_TUNNEL=y
364CONFIG_INET_XFRM_MODE_BEET=y 383CONFIG_INET_XFRM_MODE_BEET=y
384# CONFIG_INET_LRO is not set
365CONFIG_INET_DIAG=y 385CONFIG_INET_DIAG=y
366CONFIG_INET_TCP_DIAG=y 386CONFIG_INET_TCP_DIAG=y
367# CONFIG_TCP_CONG_ADVANCED is not set 387# CONFIG_TCP_CONG_ADVANCED is not set
@@ -369,8 +389,6 @@ CONFIG_TCP_CONG_CUBIC=y
369CONFIG_DEFAULT_TCP_CONG="cubic" 389CONFIG_DEFAULT_TCP_CONG="cubic"
370# CONFIG_TCP_MD5SIG is not set 390# CONFIG_TCP_MD5SIG is not set
371# CONFIG_IPV6 is not set 391# CONFIG_IPV6 is not set
372# CONFIG_INET6_XFRM_TUNNEL is not set
373# CONFIG_INET6_TUNNEL is not set
374# CONFIG_NETLABEL is not set 392# CONFIG_NETLABEL is not set
375# CONFIG_NETWORK_SECMARK is not set 393# CONFIG_NETWORK_SECMARK is not set
376# CONFIG_NETFILTER is not set 394# CONFIG_NETFILTER is not set
@@ -379,6 +397,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
379# CONFIG_TIPC is not set 397# CONFIG_TIPC is not set
380# CONFIG_ATM is not set 398# CONFIG_ATM is not set
381# CONFIG_BRIDGE is not set 399# CONFIG_BRIDGE is not set
400# CONFIG_NET_DSA is not set
382# CONFIG_VLAN_8021Q is not set 401# CONFIG_VLAN_8021Q is not set
383# CONFIG_DECNET is not set 402# CONFIG_DECNET is not set
384# CONFIG_LLC2 is not set 403# CONFIG_LLC2 is not set
@@ -388,10 +407,6 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
388# CONFIG_LAPB is not set 407# CONFIG_LAPB is not set
389# CONFIG_ECONET is not set 408# CONFIG_ECONET is not set
390# CONFIG_WAN_ROUTER is not set 409# CONFIG_WAN_ROUTER is not set
391
392#
393# QoS and/or fair queueing
394#
395# CONFIG_NET_SCHED is not set 410# CONFIG_NET_SCHED is not set
396 411
397# 412#
@@ -399,18 +414,19 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
399# 414#
400# CONFIG_NET_PKTGEN is not set 415# CONFIG_NET_PKTGEN is not set
401# CONFIG_HAMRADIO is not set 416# CONFIG_HAMRADIO is not set
417# CONFIG_CAN is not set
402# CONFIG_IRDA is not set 418# CONFIG_IRDA is not set
403# CONFIG_BT is not set 419# CONFIG_BT is not set
404# CONFIG_AF_RXRPC is not set 420# CONFIG_AF_RXRPC is not set
405 421# CONFIG_PHONET is not set
406# 422CONFIG_WIRELESS=y
407# Wireless
408#
409# CONFIG_CFG80211 is not set 423# CONFIG_CFG80211 is not set
424CONFIG_WIRELESS_OLD_REGULATORY=y
410# CONFIG_WIRELESS_EXT is not set 425# CONFIG_WIRELESS_EXT is not set
411# CONFIG_MAC80211 is not set 426# CONFIG_MAC80211 is not set
412# CONFIG_IEEE80211 is not set 427# CONFIG_IEEE80211 is not set
413# CONFIG_RFKILL is not set 428# CONFIG_RFKILL is not set
429# CONFIG_NET_9P is not set
414 430
415# 431#
416# Device Drivers 432# Device Drivers
@@ -419,14 +435,11 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
419# 435#
420# Generic Driver Options 436# Generic Driver Options
421# 437#
438CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
422CONFIG_STANDALONE=y 439CONFIG_STANDALONE=y
423CONFIG_PREVENT_FIRMWARE_BUILD=y 440CONFIG_PREVENT_FIRMWARE_BUILD=y
424# CONFIG_FW_LOADER is not set 441# CONFIG_FW_LOADER is not set
425# CONFIG_SYS_HYPERVISOR is not set 442# CONFIG_SYS_HYPERVISOR is not set
426
427#
428# Connector - unified userspace <-> kernelspace linker
429#
430# CONFIG_CONNECTOR is not set 443# CONFIG_CONNECTOR is not set
431CONFIG_MTD=y 444CONFIG_MTD=y
432# CONFIG_MTD_DEBUG is not set 445# CONFIG_MTD_DEBUG is not set
@@ -434,6 +447,7 @@ CONFIG_MTD=y
434CONFIG_MTD_PARTITIONS=y 447CONFIG_MTD_PARTITIONS=y
435# CONFIG_MTD_REDBOOT_PARTS is not set 448# CONFIG_MTD_REDBOOT_PARTS is not set
436# CONFIG_MTD_CMDLINE_PARTS is not set 449# CONFIG_MTD_CMDLINE_PARTS is not set
450# CONFIG_MTD_AR7_PARTS is not set
437 451
438# 452#
439# User Modules And Translation Layers 453# User Modules And Translation Layers
@@ -446,6 +460,7 @@ CONFIG_MTD_BLOCK=y
446# CONFIG_INFTL is not set 460# CONFIG_INFTL is not set
447# CONFIG_RFD_FTL is not set 461# CONFIG_RFD_FTL is not set
448# CONFIG_SSFDC is not set 462# CONFIG_SSFDC is not set
463# CONFIG_MTD_OOPS is not set
449 464
450# 465#
451# RAM/ROM/Flash chip drivers 466# RAM/ROM/Flash chip drivers
@@ -470,7 +485,7 @@ CONFIG_MTD_RAM=y
470# Mapping drivers for chip access 485# Mapping drivers for chip access
471# 486#
472CONFIG_MTD_COMPLEX_MAPPINGS=y 487CONFIG_MTD_COMPLEX_MAPPINGS=y
473# CONFIG_MTD_BF5xx is not set 488# CONFIG_MTD_GPIO_ADDR is not set
474CONFIG_MTD_UCLINUX=y 489CONFIG_MTD_UCLINUX=y
475# CONFIG_MTD_PLATRAM is not set 490# CONFIG_MTD_PLATRAM is not set
476 491
@@ -509,33 +524,22 @@ CONFIG_MTD_NAND_IDS=y
509# UBI - Unsorted block images 524# UBI - Unsorted block images
510# 525#
511# CONFIG_MTD_UBI is not set 526# CONFIG_MTD_UBI is not set
512
513#
514# Parallel port support
515#
516# CONFIG_PARPORT is not set 527# CONFIG_PARPORT is not set
517 528CONFIG_BLK_DEV=y
518#
519# Plug and Play support
520#
521# CONFIG_PNPACPI is not set
522
523#
524# Block devices
525#
526# CONFIG_BLK_DEV_COW_COMMON is not set 529# CONFIG_BLK_DEV_COW_COMMON is not set
527# CONFIG_BLK_DEV_LOOP is not set 530# CONFIG_BLK_DEV_LOOP is not set
528# CONFIG_BLK_DEV_NBD is not set 531# CONFIG_BLK_DEV_NBD is not set
529CONFIG_BLK_DEV_RAM=y 532CONFIG_BLK_DEV_RAM=y
530CONFIG_BLK_DEV_RAM_COUNT=16 533CONFIG_BLK_DEV_RAM_COUNT=16
531CONFIG_BLK_DEV_RAM_SIZE=4096 534CONFIG_BLK_DEV_RAM_SIZE=4096
532CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024 535# CONFIG_BLK_DEV_XIP is not set
533# CONFIG_CDROM_PKTCDVD is not set 536# CONFIG_CDROM_PKTCDVD is not set
534# CONFIG_ATA_OVER_ETH is not set 537# CONFIG_ATA_OVER_ETH is not set
535 538# CONFIG_BLK_DEV_HD is not set
536# 539CONFIG_MISC_DEVICES=y
537# Misc devices 540# CONFIG_EEPROM_93CX6 is not set
538# 541# CONFIG_ENCLOSURE_SERVICES is not set
542CONFIG_HAVE_IDE=y
539# CONFIG_IDE is not set 543# CONFIG_IDE is not set
540 544
541# 545#
@@ -543,22 +547,17 @@ CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024
543# 547#
544# CONFIG_RAID_ATTRS is not set 548# CONFIG_RAID_ATTRS is not set
545# CONFIG_SCSI is not set 549# CONFIG_SCSI is not set
550# CONFIG_SCSI_DMA is not set
546# CONFIG_SCSI_NETLINK is not set 551# CONFIG_SCSI_NETLINK is not set
547# CONFIG_ATA is not set 552# CONFIG_ATA is not set
548
549#
550# Multi-device support (RAID and LVM)
551#
552# CONFIG_MD is not set 553# CONFIG_MD is not set
553
554#
555# Network device support
556#
557CONFIG_NETDEVICES=y 554CONFIG_NETDEVICES=y
558# CONFIG_DUMMY is not set 555# CONFIG_DUMMY is not set
559# CONFIG_BONDING is not set 556# CONFIG_BONDING is not set
557# CONFIG_MACVLAN is not set
560# CONFIG_EQUALIZER is not set 558# CONFIG_EQUALIZER is not set
561# CONFIG_TUN is not set 559# CONFIG_TUN is not set
560# CONFIG_VETH is not set
562CONFIG_PHYLIB=y 561CONFIG_PHYLIB=y
563 562
564# 563#
@@ -572,46 +571,45 @@ CONFIG_PHYLIB=y
572# CONFIG_VITESSE_PHY is not set 571# CONFIG_VITESSE_PHY is not set
573# CONFIG_SMSC_PHY is not set 572# CONFIG_SMSC_PHY is not set
574# CONFIG_BROADCOM_PHY is not set 573# CONFIG_BROADCOM_PHY is not set
574# CONFIG_ICPLUS_PHY is not set
575# CONFIG_REALTEK_PHY is not set
575# CONFIG_FIXED_PHY is not set 576# CONFIG_FIXED_PHY is not set
576 577# CONFIG_MDIO_BITBANG is not set
577#
578# Ethernet (10 or 100Mbit)
579#
580CONFIG_NET_ETHERNET=y 578CONFIG_NET_ETHERNET=y
581CONFIG_MII=y 579CONFIG_MII=y
582# CONFIG_SMC91X is not set
583CONFIG_BFIN_MAC=y 580CONFIG_BFIN_MAC=y
584# CONFIG_BFIN_MAC_USE_L1 is not set 581# CONFIG_BFIN_MAC_USE_L1 is not set
585CONFIG_BFIN_TX_DESC_NUM=100 582CONFIG_BFIN_TX_DESC_NUM=100
586CONFIG_BFIN_RX_DESC_NUM=100 583CONFIG_BFIN_RX_DESC_NUM=100
587CONFIG_BFIN_MAC_RMII=y 584CONFIG_BFIN_MAC_RMII=y
585# CONFIG_SMC91X is not set
588# CONFIG_SMSC911X is not set 586# CONFIG_SMSC911X is not set
589# CONFIG_DM9000 is not set 587# CONFIG_DM9000 is not set
588# CONFIG_ENC28J60 is not set
589# CONFIG_IBM_NEW_EMAC_ZMII is not set
590# CONFIG_IBM_NEW_EMAC_RGMII is not set
591# CONFIG_IBM_NEW_EMAC_TAH is not set
592# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
593# CONFIG_IBM_NEW_EMAC_NO_FLOW_CTRL is not set
594# CONFIG_IBM_NEW_EMAC_MAL_CLR_ICINTSTAT is not set
595# CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set
590CONFIG_NETDEV_1000=y 596CONFIG_NETDEV_1000=y
591CONFIG_NETDEV_10000=y
592# CONFIG_AX88180 is not set 597# CONFIG_AX88180 is not set
598CONFIG_NETDEV_10000=y
593 599
594# 600#
595# Wireless LAN 601# Wireless LAN
596# 602#
597# CONFIG_WLAN_PRE80211 is not set 603# CONFIG_WLAN_PRE80211 is not set
598# CONFIG_WLAN_80211 is not set 604# CONFIG_WLAN_80211 is not set
605# CONFIG_IWLWIFI_LEDS is not set
599# CONFIG_WAN is not set 606# CONFIG_WAN is not set
600# CONFIG_PPP is not set 607# CONFIG_PPP is not set
601# CONFIG_SLIP is not set 608# CONFIG_SLIP is not set
602# CONFIG_SHAPER is not set
603# CONFIG_NETCONSOLE is not set 609# CONFIG_NETCONSOLE is not set
604# CONFIG_NETPOLL is not set 610# CONFIG_NETPOLL is not set
605# CONFIG_NET_POLL_CONTROLLER is not set 611# CONFIG_NET_POLL_CONTROLLER is not set
606
607#
608# ISDN subsystem
609#
610# CONFIG_ISDN is not set 612# CONFIG_ISDN is not set
611
612#
613# Telephony Support
614#
615# CONFIG_PHONE is not set 613# CONFIG_PHONE is not set
616 614
617# 615#
@@ -626,9 +624,6 @@ CONFIG_INPUT=y
626# 624#
627# CONFIG_INPUT_MOUSEDEV is not set 625# CONFIG_INPUT_MOUSEDEV is not set
628# CONFIG_INPUT_JOYDEV is not set 626# CONFIG_INPUT_JOYDEV is not set
629CONFIG_INPUT_TSDEV=y
630CONFIG_INPUT_TSDEV_SCREEN_X=240
631CONFIG_INPUT_TSDEV_SCREEN_Y=320
632CONFIG_INPUT_EVDEV=y 627CONFIG_INPUT_EVDEV=y
633# CONFIG_INPUT_EVBUG is not set 628# CONFIG_INPUT_EVBUG is not set
634 629
@@ -642,24 +637,29 @@ CONFIG_INPUT_EVDEV=y
642CONFIG_INPUT_TOUCHSCREEN=y 637CONFIG_INPUT_TOUCHSCREEN=y
643# CONFIG_TOUCHSCREEN_ADS7846 is not set 638# CONFIG_TOUCHSCREEN_ADS7846 is not set
644CONFIG_TOUCHSCREEN_AD7877=y 639CONFIG_TOUCHSCREEN_AD7877=y
640# CONFIG_TOUCHSCREEN_AD7879_I2C is not set
641# CONFIG_TOUCHSCREEN_AD7879_SPI is not set
642# CONFIG_TOUCHSCREEN_AD7879 is not set
643# CONFIG_TOUCHSCREEN_FUJITSU is not set
645# CONFIG_TOUCHSCREEN_GUNZE is not set 644# CONFIG_TOUCHSCREEN_GUNZE is not set
646# CONFIG_TOUCHSCREEN_ELO is not set 645# CONFIG_TOUCHSCREEN_ELO is not set
647# CONFIG_TOUCHSCREEN_MTOUCH is not set 646# CONFIG_TOUCHSCREEN_MTOUCH is not set
647# CONFIG_TOUCHSCREEN_INEXIO is not set
648# CONFIG_TOUCHSCREEN_MK712 is not set 648# CONFIG_TOUCHSCREEN_MK712 is not set
649# CONFIG_TOUCHSCREEN_PENMOUNT is not set 649# CONFIG_TOUCHSCREEN_PENMOUNT is not set
650# CONFIG_TOUCHSCREEN_TOUCHRIGHT is not set 650# CONFIG_TOUCHSCREEN_TOUCHRIGHT is not set
651# CONFIG_TOUCHSCREEN_TOUCHWIN is not set 651# CONFIG_TOUCHSCREEN_TOUCHWIN is not set
652# CONFIG_TOUCHSCREEN_UCB1400 is not set
653# CONFIG_TOUCHSCREEN_USB_COMPOSITE is not set 652# CONFIG_TOUCHSCREEN_USB_COMPOSITE is not set
653# CONFIG_TOUCHSCREEN_TOUCHIT213 is not set
654CONFIG_INPUT_MISC=y 654CONFIG_INPUT_MISC=y
655# CONFIG_INPUT_ATI_REMOTE is not set 655# CONFIG_INPUT_ATI_REMOTE is not set
656# CONFIG_INPUT_ATI_REMOTE2 is not set 656# CONFIG_INPUT_ATI_REMOTE2 is not set
657# CONFIG_INPUT_KEYSPAN_REMOTE is not set 657# CONFIG_INPUT_KEYSPAN_REMOTE is not set
658# CONFIG_INPUT_POWERMATE is not set 658# CONFIG_INPUT_POWERMATE is not set
659# CONFIG_INPUT_YEALINK is not set 659# CONFIG_INPUT_YEALINK is not set
660# CONFIG_INPUT_CM109 is not set
660CONFIG_INPUT_UINPUT=y 661CONFIG_INPUT_UINPUT=y
661# CONFIG_BF53X_PFBUTTONS is not set 662# CONFIG_CONFIG_INPUT_PCF8574 is not set
662# CONFIG_TWI_KEYPAD is not set
663 663
664# 664#
665# Hardware I/O ports 665# Hardware I/O ports
@@ -672,18 +672,17 @@ CONFIG_INPUT_UINPUT=y
672# 672#
673# CONFIG_AD9960 is not set 673# CONFIG_AD9960 is not set
674# CONFIG_SPI_ADC_BF533 is not set 674# CONFIG_SPI_ADC_BF533 is not set
675# CONFIG_BF5xx_PFLAGS is not set
676# CONFIG_BF5xx_PPIFCD is not set 675# CONFIG_BF5xx_PPIFCD is not set
677# CONFIG_BFIN_SIMPLE_TIMER is not set 676# CONFIG_BFIN_SIMPLE_TIMER is not set
678# CONFIG_BF5xx_PPI is not set 677# CONFIG_BF5xx_PPI is not set
679CONFIG_BFIN_SPORT=y 678CONFIG_BFIN_SPORT=y
680# CONFIG_BFIN_TIMER_LATENCY is not set 679# CONFIG_BFIN_TIMER_LATENCY is not set
681CONFIG_TWI_LCD=m 680CONFIG_TWI_LCD=m
682CONFIG_TWI_LCD_SLAVE_ADDR=34 681CONFIG_BFIN_DMA_INTERFACE=m
683# CONFIG_AD5304 is not set 682# CONFIG_SIMPLE_GPIO is not set
684# CONFIG_BF5xx_TEA5764 is not set
685# CONFIG_BF5xx_FBDMA is not set
686# CONFIG_VT is not set 683# CONFIG_VT is not set
684CONFIG_DEVKMEM=y
685# CONFIG_BFIN_JTAG_COMM is not set
687# CONFIG_SERIAL_NONSTANDARD is not set 686# CONFIG_SERIAL_NONSTANDARD is not set
688 687
689# 688#
@@ -716,68 +715,59 @@ CONFIG_CAN4LINUX=y
716# 715#
717# linux embedded drivers 716# linux embedded drivers
718# 717#
719# CONFIG_CAN_MCF5282 is not set
720# CONFIG_CAN_UNCTWINCAN is not set
721CONFIG_CAN_BLACKFIN=m 718CONFIG_CAN_BLACKFIN=m
722
723#
724# IPMI
725#
726# CONFIG_IPMI_HANDLER is not set 719# CONFIG_IPMI_HANDLER is not set
727# CONFIG_WATCHDOG is not set
728CONFIG_HW_RANDOM=y 720CONFIG_HW_RANDOM=y
729# CONFIG_GEN_RTC is not set
730# CONFIG_R3964 is not set 721# CONFIG_R3964 is not set
731# CONFIG_RAW_DRIVER is not set 722# CONFIG_RAW_DRIVER is not set
732
733#
734# TPM devices
735#
736# CONFIG_TCG_TPM is not set 723# CONFIG_TCG_TPM is not set
737CONFIG_I2C=y 724CONFIG_I2C=y
738CONFIG_I2C_BOARDINFO=y 725CONFIG_I2C_BOARDINFO=y
739CONFIG_I2C_CHARDEV=y 726CONFIG_I2C_CHARDEV=y
727CONFIG_I2C_HELPER_AUTO=y
740 728
741# 729#
742# I2C Algorithms 730# I2C Hardware Bus support
743# 731#
744# CONFIG_I2C_ALGOBIT is not set
745# CONFIG_I2C_ALGOPCF is not set
746# CONFIG_I2C_ALGOPCA is not set
747 732
748# 733#
749# I2C Hardware Bus support 734# I2C system bus drivers (mostly embedded / system-on-chip)
750# 735#
751# CONFIG_I2C_BLACKFIN_GPIO is not set
752CONFIG_I2C_BLACKFIN_TWI=y 736CONFIG_I2C_BLACKFIN_TWI=y
753CONFIG_I2C_BLACKFIN_TWI_CLK_KHZ=50 737CONFIG_I2C_BLACKFIN_TWI_CLK_KHZ=100
754# CONFIG_I2C_GPIO is not set 738# CONFIG_I2C_GPIO is not set
755# CONFIG_I2C_OCORES is not set 739# CONFIG_I2C_OCORES is not set
756# CONFIG_I2C_PARPORT_LIGHT is not set
757# CONFIG_I2C_SIMTEC is not set 740# CONFIG_I2C_SIMTEC is not set
741
742#
743# External I2C/SMBus adapter drivers
744#
745# CONFIG_I2C_PARPORT_LIGHT is not set
746# CONFIG_I2C_TAOS_EVM is not set
747
748#
749# Other I2C/SMBus bus drivers
750#
751# CONFIG_I2C_PCA_PLATFORM is not set
758# CONFIG_I2C_STUB is not set 752# CONFIG_I2C_STUB is not set
759 753
760# 754#
761# Miscellaneous I2C Chip support 755# Miscellaneous I2C Chip support
762# 756#
763# CONFIG_SENSORS_DS1337 is not set 757# CONFIG_DS1682 is not set
764# CONFIG_SENSORS_DS1374 is not set 758# CONFIG_AT24 is not set
765# CONFIG_SENSORS_AD5252 is not set 759# CONFIG_SENSORS_AD5252 is not set
766# CONFIG_SENSORS_EEPROM is not set 760# CONFIG_SENSORS_EEPROM is not set
767CONFIG_SENSORS_PCF8574=m 761CONFIG_SENSORS_PCF8574=m
768CONFIG_SENSORS_PCF8575=y 762# CONFIG_PCF8575 is not set
769# CONFIG_SENSORS_PCA9543 is not set
770# CONFIG_SENSORS_PCA9539 is not set 763# CONFIG_SENSORS_PCA9539 is not set
771# CONFIG_SENSORS_PCF8591 is not set 764# CONFIG_SENSORS_PCF8591 is not set
772# CONFIG_SENSORS_MAX6875 is not set 765# CONFIG_SENSORS_MAX6875 is not set
766# CONFIG_SENSORS_TSL2550 is not set
773# CONFIG_I2C_DEBUG_CORE is not set 767# CONFIG_I2C_DEBUG_CORE is not set
774# CONFIG_I2C_DEBUG_ALGO is not set 768# CONFIG_I2C_DEBUG_ALGO is not set
775# CONFIG_I2C_DEBUG_BUS is not set 769# CONFIG_I2C_DEBUG_BUS is not set
776# CONFIG_I2C_DEBUG_CHIP is not set 770# CONFIG_I2C_DEBUG_CHIP is not set
777
778#
779# SPI support
780#
781CONFIG_SPI=y 771CONFIG_SPI=y
782CONFIG_SPI_MASTER=y 772CONFIG_SPI_MASTER=y
783 773
@@ -785,6 +775,7 @@ CONFIG_SPI_MASTER=y
785# SPI Master Controller Drivers 775# SPI Master Controller Drivers
786# 776#
787CONFIG_SPI_BFIN=y 777CONFIG_SPI_BFIN=y
778# CONFIG_SPI_BFIN_LOCK is not set
788# CONFIG_SPI_BITBANG is not set 779# CONFIG_SPI_BITBANG is not set
789 780
790# 781#
@@ -792,27 +783,29 @@ CONFIG_SPI_BFIN=y
792# 783#
793# CONFIG_SPI_AT25 is not set 784# CONFIG_SPI_AT25 is not set
794# CONFIG_SPI_SPIDEV is not set 785# CONFIG_SPI_SPIDEV is not set
795 786# CONFIG_SPI_TLE62X0 is not set
796# 787CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y
797# Dallas's 1-wire bus 788# CONFIG_GPIOLIB is not set
798#
799# CONFIG_W1 is not set 789# CONFIG_W1 is not set
790# CONFIG_POWER_SUPPLY is not set
800CONFIG_HWMON=y 791CONFIG_HWMON=y
801# CONFIG_HWMON_VID is not set 792# CONFIG_HWMON_VID is not set
802# CONFIG_SENSORS_ABITUGURU is not set 793# CONFIG_SENSORS_AD7414 is not set
803# CONFIG_SENSORS_AD7418 is not set 794# CONFIG_SENSORS_AD7418 is not set
795# CONFIG_SENSORS_ADCXX is not set
804# CONFIG_SENSORS_ADM1021 is not set 796# CONFIG_SENSORS_ADM1021 is not set
805# CONFIG_SENSORS_ADM1025 is not set 797# CONFIG_SENSORS_ADM1025 is not set
806# CONFIG_SENSORS_ADM1026 is not set 798# CONFIG_SENSORS_ADM1026 is not set
807# CONFIG_SENSORS_ADM1029 is not set 799# CONFIG_SENSORS_ADM1029 is not set
808# CONFIG_SENSORS_ADM1031 is not set 800# CONFIG_SENSORS_ADM1031 is not set
809# CONFIG_SENSORS_ADM9240 is not set 801# CONFIG_SENSORS_ADM9240 is not set
810# CONFIG_SENSORS_ASB100 is not set 802# CONFIG_SENSORS_ADT7470 is not set
803# CONFIG_SENSORS_ADT7473 is not set
811# CONFIG_SENSORS_ATXP1 is not set 804# CONFIG_SENSORS_ATXP1 is not set
812# CONFIG_SENSORS_DS1621 is not set 805# CONFIG_SENSORS_DS1621 is not set
813# CONFIG_SENSORS_F71805F is not set 806# CONFIG_SENSORS_F71805F is not set
814# CONFIG_SENSORS_FSCHER is not set 807# CONFIG_SENSORS_F71882FG is not set
815# CONFIG_SENSORS_FSCPOS is not set 808# CONFIG_SENSORS_F75375S is not set
816# CONFIG_SENSORS_GL518SM is not set 809# CONFIG_SENSORS_GL518SM is not set
817# CONFIG_SENSORS_GL520SM is not set 810# CONFIG_SENSORS_GL520SM is not set
818# CONFIG_SENSORS_IT87 is not set 811# CONFIG_SENSORS_IT87 is not set
@@ -827,58 +820,76 @@ CONFIG_HWMON=y
827# CONFIG_SENSORS_LM87 is not set 820# CONFIG_SENSORS_LM87 is not set
828# CONFIG_SENSORS_LM90 is not set 821# CONFIG_SENSORS_LM90 is not set
829# CONFIG_SENSORS_LM92 is not set 822# CONFIG_SENSORS_LM92 is not set
823# CONFIG_SENSORS_LM93 is not set
824# CONFIG_SENSORS_MAX1111 is not set
830# CONFIG_SENSORS_MAX1619 is not set 825# CONFIG_SENSORS_MAX1619 is not set
831# CONFIG_SENSORS_MAX6650 is not set 826# CONFIG_SENSORS_MAX6650 is not set
832# CONFIG_SENSORS_PC87360 is not set 827# CONFIG_SENSORS_PC87360 is not set
833# CONFIG_SENSORS_PC87427 is not set 828# CONFIG_SENSORS_PC87427 is not set
829# CONFIG_SENSORS_DME1737 is not set
834# CONFIG_SENSORS_SMSC47M1 is not set 830# CONFIG_SENSORS_SMSC47M1 is not set
835# CONFIG_SENSORS_SMSC47M192 is not set 831# CONFIG_SENSORS_SMSC47M192 is not set
836# CONFIG_SENSORS_SMSC47B397 is not set 832# CONFIG_SENSORS_SMSC47B397 is not set
833# CONFIG_SENSORS_ADS7828 is not set
834# CONFIG_SENSORS_THMC50 is not set
837# CONFIG_SENSORS_VT1211 is not set 835# CONFIG_SENSORS_VT1211 is not set
838# CONFIG_SENSORS_W83781D is not set 836# CONFIG_SENSORS_W83781D is not set
839# CONFIG_SENSORS_W83791D is not set 837# CONFIG_SENSORS_W83791D is not set
840# CONFIG_SENSORS_W83792D is not set 838# CONFIG_SENSORS_W83792D is not set
841# CONFIG_SENSORS_W83793 is not set 839# CONFIG_SENSORS_W83793 is not set
842# CONFIG_SENSORS_W83L785TS is not set 840# CONFIG_SENSORS_W83L785TS is not set
841# CONFIG_SENSORS_W83L786NG is not set
843# CONFIG_SENSORS_W83627HF is not set 842# CONFIG_SENSORS_W83627HF is not set
844# CONFIG_SENSORS_W83627EHF is not set 843# CONFIG_SENSORS_W83627EHF is not set
845# CONFIG_HWMON_DEBUG_CHIP is not set 844# CONFIG_HWMON_DEBUG_CHIP is not set
845# CONFIG_THERMAL is not set
846# CONFIG_THERMAL_HWMON is not set
847# CONFIG_WATCHDOG is not set
846 848
847# 849#
848# Multifunction device drivers 850# Multifunction device drivers
849# 851#
852# CONFIG_MFD_CORE is not set
850# CONFIG_MFD_SM501 is not set 853# CONFIG_MFD_SM501 is not set
854# CONFIG_HTC_PASIC3 is not set
855# CONFIG_MFD_TMIO is not set
856# CONFIG_MFD_WM8400 is not set
857# CONFIG_MFD_WM8350_I2C is not set
851 858
852# 859#
853# Multimedia devices 860# Multimedia devices
854# 861#
862
863#
864# Multimedia core support
865#
855# CONFIG_VIDEO_DEV is not set 866# CONFIG_VIDEO_DEV is not set
856# CONFIG_DVB_CORE is not set 867# CONFIG_DVB_CORE is not set
857CONFIG_DAB=y 868# CONFIG_VIDEO_MEDIA is not set
858 869
859# 870#
860# Graphics support 871# Multimedia drivers
861# 872#
862CONFIG_BACKLIGHT_LCD_SUPPORT=y 873CONFIG_DAB=y
863CONFIG_BACKLIGHT_CLASS_DEVICE=y
864CONFIG_LCD_CLASS_DEVICE=y
865 874
866# 875#
867# Display device support 876# Graphics support
868# 877#
869# CONFIG_DISPLAY_SUPPORT is not set
870# CONFIG_VGASTATE is not set 878# CONFIG_VGASTATE is not set
879# CONFIG_VIDEO_OUTPUT_CONTROL is not set
871CONFIG_FB=y 880CONFIG_FB=y
872CONFIG_FIRMWARE_EDID=y 881CONFIG_FIRMWARE_EDID=y
873# CONFIG_FB_DDC is not set 882# CONFIG_FB_DDC is not set
883# CONFIG_FB_BOOT_VESA_SUPPORT is not set
874CONFIG_FB_CFB_FILLRECT=y 884CONFIG_FB_CFB_FILLRECT=y
875CONFIG_FB_CFB_COPYAREA=y 885CONFIG_FB_CFB_COPYAREA=y
876CONFIG_FB_CFB_IMAGEBLIT=y 886CONFIG_FB_CFB_IMAGEBLIT=y
887# CONFIG_FB_CFB_REV_PIXELS_IN_BYTE is not set
877# CONFIG_FB_SYS_FILLRECT is not set 888# CONFIG_FB_SYS_FILLRECT is not set
878# CONFIG_FB_SYS_COPYAREA is not set 889# CONFIG_FB_SYS_COPYAREA is not set
879# CONFIG_FB_SYS_IMAGEBLIT is not set 890# CONFIG_FB_SYS_IMAGEBLIT is not set
891# CONFIG_FB_FOREIGN_ENDIAN is not set
880# CONFIG_FB_SYS_FOPS is not set 892# CONFIG_FB_SYS_FOPS is not set
881CONFIG_FB_DEFERRED_IO=y
882# CONFIG_FB_SVGALIB is not set 893# CONFIG_FB_SVGALIB is not set
883# CONFIG_FB_MACMODES is not set 894# CONFIG_FB_MACMODES is not set
884# CONFIG_FB_BACKLIGHT is not set 895# CONFIG_FB_BACKLIGHT is not set
@@ -888,25 +899,34 @@ CONFIG_FB_DEFERRED_IO=y
888# 899#
889# Frame buffer hardware drivers 900# Frame buffer hardware drivers
890# 901#
891# CONFIG_FB_BFIN_7171 is not set 902# CONFIG_FB_BFIN_T350MCQB is not set
892# CONFIG_FB_BFIN_7393 is not set 903# CONFIG_FB_BFIN_LQ035Q1 is not set
893CONFIG_FB_BF537_LQ035=y 904CONFIG_FB_BF537_LQ035=y
894CONFIG_LQ035_SLAVE_ADDR=0x58 905CONFIG_LQ035_SLAVE_ADDR=0x58
895CONFIG_FB_BFIN_LANDSCAPE=y 906CONFIG_FB_BFIN_LANDSCAPE=y
896# CONFIG_FB_BFIN_BGR is not set 907# CONFIG_FB_BFIN_BGR is not set
897# CONFIG_FB_BFIN_T350MCQB is not set 908# CONFIG_FB_BFIN_7393 is not set
909# CONFIG_FB_HITACHI_TX09 is not set
898# CONFIG_FB_S1D13XXX is not set 910# CONFIG_FB_S1D13XXX is not set
899# CONFIG_FB_VIRTUAL is not set 911# CONFIG_FB_VIRTUAL is not set
900# CONFIG_LOGO is not set 912# CONFIG_FB_METRONOME is not set
913CONFIG_BACKLIGHT_LCD_SUPPORT=y
914CONFIG_LCD_CLASS_DEVICE=y
915# CONFIG_LCD_LTV350QV is not set
916# CONFIG_LCD_ILI9320 is not set
917# CONFIG_LCD_TDO24M is not set
918# CONFIG_LCD_VGG2432A4 is not set
919# CONFIG_LCD_PLATFORM is not set
920CONFIG_BACKLIGHT_CLASS_DEVICE=y
921# CONFIG_BACKLIGHT_CORGI is not set
901 922
902# 923#
903# Sound 924# Display device support
904# 925#
926# CONFIG_DISPLAY_SUPPORT is not set
927# CONFIG_LOGO is not set
905CONFIG_SOUND=y 928CONFIG_SOUND=y
906 929CONFIG_SOUND_OSS_CORE=y
907#
908# Advanced Linux Sound Architecture
909#
910CONFIG_SND=m 930CONFIG_SND=m
911# CONFIG_SND_SEQUENCER is not set 931# CONFIG_SND_SEQUENCER is not set
912# CONFIG_SND_MIXER_OSS is not set 932# CONFIG_SND_MIXER_OSS is not set
@@ -916,46 +936,30 @@ CONFIG_SND=m
916# CONFIG_SND_VERBOSE_PROCFS is not set 936# CONFIG_SND_VERBOSE_PROCFS is not set
917# CONFIG_SND_VERBOSE_PRINTK is not set 937# CONFIG_SND_VERBOSE_PRINTK is not set
918# CONFIG_SND_DEBUG is not set 938# CONFIG_SND_DEBUG is not set
919 939CONFIG_SND_DRIVERS=y
920#
921# Generic devices
922#
923# CONFIG_SND_DUMMY is not set 940# CONFIG_SND_DUMMY is not set
924# CONFIG_SND_MTPAV is not set 941# CONFIG_SND_MTPAV is not set
925# CONFIG_SND_SERIAL_U16550 is not set 942# CONFIG_SND_SERIAL_U16550 is not set
926# CONFIG_SND_MPU401 is not set 943# CONFIG_SND_MPU401 is not set
944CONFIG_SND_SPI=y
927 945
928# 946#
929# ALSA Blackfin devices 947# ALSA Blackfin devices
930# 948#
931# CONFIG_SND_BLACKFIN_AD1836 is not set 949# CONFIG_SND_BLACKFIN_AD1836 is not set
932# CONFIG_SND_BFIN_AD73311 is not set 950# CONFIG_SND_BFIN_AD73322 is not set
933
934#
935# System on Chip audio support
936#
937# CONFIG_SND_SOC is not set 951# CONFIG_SND_SOC is not set
938
939#
940# Open Sound System
941#
942CONFIG_SOUND_PRIME=y 952CONFIG_SOUND_PRIME=y
943# CONFIG_OSS_OBSOLETE is not set 953CONFIG_HID_SUPPORT=y
944# CONFIG_SOUND_MSNDCLAS is not set
945# CONFIG_SOUND_MSNDPIN is not set
946
947#
948# HID Devices
949#
950# CONFIG_HID is not set 954# CONFIG_HID is not set
951 955# CONFIG_HID_PID is not set
952# 956CONFIG_USB_SUPPORT=y
953# USB support
954#
955CONFIG_USB_ARCH_HAS_HCD=y 957CONFIG_USB_ARCH_HAS_HCD=y
956# CONFIG_USB_ARCH_HAS_OHCI is not set 958# CONFIG_USB_ARCH_HAS_OHCI is not set
957# CONFIG_USB_ARCH_HAS_EHCI is not set 959# CONFIG_USB_ARCH_HAS_EHCI is not set
958# CONFIG_USB is not set 960# CONFIG_USB is not set
961# CONFIG_USB_OTG_WHITELIST is not set
962# CONFIG_USB_OTG_BLACKLIST_HUB is not set
959 963
960# 964#
961# Enable Host or Gadget support to see Inventra options 965# Enable Host or Gadget support to see Inventra options
@@ -964,37 +968,11 @@ CONFIG_USB_ARCH_HAS_HCD=y
964# 968#
965# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' 969# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
966# 970#
967
968#
969# USB Gadget Support
970#
971# CONFIG_USB_GADGET is not set 971# CONFIG_USB_GADGET is not set
972# CONFIG_MMC is not set 972# CONFIG_MMC is not set
973 973# CONFIG_MEMSTICK is not set
974#
975# LED devices
976#
977# CONFIG_NEW_LEDS is not set 974# CONFIG_NEW_LEDS is not set
978 975# CONFIG_ACCESSIBILITY is not set
979#
980# LED drivers
981#
982
983#
984# LED Triggers
985#
986
987#
988# InfiniBand support
989#
990
991#
992# EDAC - error detection and reporting (RAS) (EXPERIMENTAL)
993#
994
995#
996# Real Time Clock
997#
998CONFIG_RTC_LIB=y 976CONFIG_RTC_LIB=y
999CONFIG_RTC_CLASS=y 977CONFIG_RTC_CLASS=y
1000CONFIG_RTC_HCTOSYS=y 978CONFIG_RTC_HCTOSYS=y
@@ -1014,6 +992,7 @@ CONFIG_RTC_INTF_DEV=y
1014# I2C RTC drivers 992# I2C RTC drivers
1015# 993#
1016# CONFIG_RTC_DRV_DS1307 is not set 994# CONFIG_RTC_DRV_DS1307 is not set
995# CONFIG_RTC_DRV_DS1374 is not set
1017# CONFIG_RTC_DRV_DS1672 is not set 996# CONFIG_RTC_DRV_DS1672 is not set
1018# CONFIG_RTC_DRV_MAX6900 is not set 997# CONFIG_RTC_DRV_MAX6900 is not set
1019# CONFIG_RTC_DRV_RS5C372 is not set 998# CONFIG_RTC_DRV_RS5C372 is not set
@@ -1021,43 +1000,41 @@ CONFIG_RTC_INTF_DEV=y
1021# CONFIG_RTC_DRV_X1205 is not set 1000# CONFIG_RTC_DRV_X1205 is not set
1022# CONFIG_RTC_DRV_PCF8563 is not set 1001# CONFIG_RTC_DRV_PCF8563 is not set
1023# CONFIG_RTC_DRV_PCF8583 is not set 1002# CONFIG_RTC_DRV_PCF8583 is not set
1003# CONFIG_RTC_DRV_M41T80 is not set
1004# CONFIG_RTC_DRV_S35390A is not set
1005# CONFIG_RTC_DRV_FM3130 is not set
1024 1006
1025# 1007#
1026# SPI RTC drivers 1008# SPI RTC drivers
1027# 1009#
1028# CONFIG_RTC_DRV_RS5C348 is not set 1010# CONFIG_RTC_DRV_M41T94 is not set
1011# CONFIG_RTC_DRV_DS1305 is not set
1029# CONFIG_RTC_DRV_MAX6902 is not set 1012# CONFIG_RTC_DRV_MAX6902 is not set
1013# CONFIG_RTC_DRV_R9701 is not set
1014# CONFIG_RTC_DRV_RS5C348 is not set
1015# CONFIG_RTC_DRV_DS3234 is not set
1030 1016
1031# 1017#
1032# Platform RTC drivers 1018# Platform RTC drivers
1033# 1019#
1020# CONFIG_RTC_DRV_DS1286 is not set
1021# CONFIG_RTC_DRV_DS1511 is not set
1034# CONFIG_RTC_DRV_DS1553 is not set 1022# CONFIG_RTC_DRV_DS1553 is not set
1035# CONFIG_RTC_DRV_DS1742 is not set 1023# CONFIG_RTC_DRV_DS1742 is not set
1024# CONFIG_RTC_DRV_STK17TA8 is not set
1036# CONFIG_RTC_DRV_M48T86 is not set 1025# CONFIG_RTC_DRV_M48T86 is not set
1026# CONFIG_RTC_DRV_M48T35 is not set
1027# CONFIG_RTC_DRV_M48T59 is not set
1028# CONFIG_RTC_DRV_BQ4802 is not set
1037# CONFIG_RTC_DRV_V3020 is not set 1029# CONFIG_RTC_DRV_V3020 is not set
1038 1030
1039# 1031#
1040# on-CPU RTC drivers 1032# on-CPU RTC drivers
1041# 1033#
1042CONFIG_RTC_DRV_BFIN=y 1034CONFIG_RTC_DRV_BFIN=y
1043 1035# CONFIG_DMADEVICES is not set
1044# 1036# CONFIG_UIO is not set
1045# DMA Engine support 1037# CONFIG_STAGING is not set
1046#
1047# CONFIG_DMA_ENGINE is not set
1048
1049#
1050# DMA Clients
1051#
1052
1053#
1054# DMA Devices
1055#
1056
1057#
1058# PBX support
1059#
1060# CONFIG_PBX is not set
1061 1038
1062# 1039#
1063# File systems 1040# File systems
@@ -1067,20 +1044,18 @@ CONFIG_EXT2_FS_XATTR=y
1067# CONFIG_EXT2_FS_POSIX_ACL is not set 1044# CONFIG_EXT2_FS_POSIX_ACL is not set
1068# CONFIG_EXT2_FS_SECURITY is not set 1045# CONFIG_EXT2_FS_SECURITY is not set
1069# CONFIG_EXT3_FS is not set 1046# CONFIG_EXT3_FS is not set
1070# CONFIG_EXT4DEV_FS is not set 1047# CONFIG_EXT4_FS is not set
1071CONFIG_FS_MBCACHE=y 1048CONFIG_FS_MBCACHE=y
1072# CONFIG_REISERFS_FS is not set 1049# CONFIG_REISERFS_FS is not set
1073# CONFIG_JFS_FS is not set 1050# CONFIG_JFS_FS is not set
1074# CONFIG_FS_POSIX_ACL is not set 1051# CONFIG_FS_POSIX_ACL is not set
1052CONFIG_FILE_LOCKING=y
1075# CONFIG_XFS_FS is not set 1053# CONFIG_XFS_FS is not set
1076# CONFIG_GFS2_FS is not set
1077# CONFIG_OCFS2_FS is not set 1054# CONFIG_OCFS2_FS is not set
1078# CONFIG_MINIX_FS is not set 1055# CONFIG_DNOTIFY is not set
1079# CONFIG_ROMFS_FS is not set
1080CONFIG_INOTIFY=y 1056CONFIG_INOTIFY=y
1081CONFIG_INOTIFY_USER=y 1057CONFIG_INOTIFY_USER=y
1082# CONFIG_QUOTA is not set 1058# CONFIG_QUOTA is not set
1083# CONFIG_DNOTIFY is not set
1084# CONFIG_AUTOFS_FS is not set 1059# CONFIG_AUTOFS_FS is not set
1085# CONFIG_AUTOFS4_FS is not set 1060# CONFIG_AUTOFS4_FS is not set
1086# CONFIG_FUSE_FS is not set 1061# CONFIG_FUSE_FS is not set
@@ -1106,7 +1081,6 @@ CONFIG_PROC_SYSCTL=y
1106CONFIG_SYSFS=y 1081CONFIG_SYSFS=y
1107# CONFIG_TMPFS is not set 1082# CONFIG_TMPFS is not set
1108# CONFIG_HUGETLB_PAGE is not set 1083# CONFIG_HUGETLB_PAGE is not set
1109CONFIG_RAMFS=y
1110# CONFIG_CONFIGFS_FS is not set 1084# CONFIG_CONFIGFS_FS is not set
1111 1085
1112# 1086#
@@ -1121,36 +1095,35 @@ CONFIG_RAMFS=y
1121# CONFIG_EFS_FS is not set 1095# CONFIG_EFS_FS is not set
1122CONFIG_YAFFS_FS=y 1096CONFIG_YAFFS_FS=y
1123CONFIG_YAFFS_YAFFS1=y 1097CONFIG_YAFFS_YAFFS1=y
1098# CONFIG_YAFFS_9BYTE_TAGS is not set
1124# CONFIG_YAFFS_DOES_ECC is not set 1099# CONFIG_YAFFS_DOES_ECC is not set
1125CONFIG_YAFFS_YAFFS2=y 1100CONFIG_YAFFS_YAFFS2=y
1126CONFIG_YAFFS_AUTO_YAFFS2=y 1101CONFIG_YAFFS_AUTO_YAFFS2=y
1127# CONFIG_YAFFS_DISABLE_LAZY_LOAD is not set 1102# CONFIG_YAFFS_DISABLE_LAZY_LOAD is not set
1128CONFIG_YAFFS_CHECKPOINT_RESERVED_BLOCKS=10
1129# CONFIG_YAFFS_DISABLE_WIDE_TNODES is not set 1103# CONFIG_YAFFS_DISABLE_WIDE_TNODES is not set
1130# CONFIG_YAFFS_ALWAYS_CHECK_CHUNK_ERASED is not set 1104# CONFIG_YAFFS_ALWAYS_CHECK_CHUNK_ERASED is not set
1131CONFIG_YAFFS_SHORT_NAMES_IN_RAM=y 1105CONFIG_YAFFS_SHORT_NAMES_IN_RAM=y
1132# CONFIG_JFFS2_FS is not set 1106# CONFIG_JFFS2_FS is not set
1133# CONFIG_CRAMFS is not set 1107# CONFIG_CRAMFS is not set
1134# CONFIG_VXFS_FS is not set 1108# CONFIG_VXFS_FS is not set
1109# CONFIG_MINIX_FS is not set
1110# CONFIG_OMFS_FS is not set
1135# CONFIG_HPFS_FS is not set 1111# CONFIG_HPFS_FS is not set
1136# CONFIG_QNX4FS_FS is not set 1112# CONFIG_QNX4FS_FS is not set
1113# CONFIG_ROMFS_FS is not set
1137# CONFIG_SYSV_FS is not set 1114# CONFIG_SYSV_FS is not set
1138# CONFIG_UFS_FS is not set 1115# CONFIG_UFS_FS is not set
1139 1116CONFIG_NETWORK_FILESYSTEMS=y
1140#
1141# Network File Systems
1142#
1143CONFIG_NFS_FS=m 1117CONFIG_NFS_FS=m
1144CONFIG_NFS_V3=y 1118CONFIG_NFS_V3=y
1145# CONFIG_NFS_V3_ACL is not set 1119# CONFIG_NFS_V3_ACL is not set
1146# CONFIG_NFS_V4 is not set 1120# CONFIG_NFS_V4 is not set
1147# CONFIG_NFS_DIRECTIO is not set
1148# CONFIG_NFSD is not set 1121# CONFIG_NFSD is not set
1149CONFIG_LOCKD=m 1122CONFIG_LOCKD=m
1150CONFIG_LOCKD_V4=y 1123CONFIG_LOCKD_V4=y
1151CONFIG_NFS_COMMON=y 1124CONFIG_NFS_COMMON=y
1152CONFIG_SUNRPC=m 1125CONFIG_SUNRPC=m
1153# CONFIG_SUNRPC_BIND34 is not set 1126# CONFIG_SUNRPC_REGISTER_V4 is not set
1154# CONFIG_RPCSEC_GSS_KRB5 is not set 1127# CONFIG_RPCSEC_GSS_KRB5 is not set
1155# CONFIG_RPCSEC_GSS_SPKM3 is not set 1128# CONFIG_RPCSEC_GSS_SPKM3 is not set
1156CONFIG_SMB_FS=m 1129CONFIG_SMB_FS=m
@@ -1159,17 +1132,12 @@ CONFIG_SMB_FS=m
1159# CONFIG_NCP_FS is not set 1132# CONFIG_NCP_FS is not set
1160# CONFIG_CODA_FS is not set 1133# CONFIG_CODA_FS is not set
1161# CONFIG_AFS_FS is not set 1134# CONFIG_AFS_FS is not set
1162# CONFIG_9P_FS is not set
1163 1135
1164# 1136#
1165# Partition Types 1137# Partition Types
1166# 1138#
1167# CONFIG_PARTITION_ADVANCED is not set 1139# CONFIG_PARTITION_ADVANCED is not set
1168CONFIG_MSDOS_PARTITION=y 1140CONFIG_MSDOS_PARTITION=y
1169
1170#
1171# Native Language Support
1172#
1173CONFIG_NLS=m 1141CONFIG_NLS=m
1174CONFIG_NLS_DEFAULT="iso8859-1" 1142CONFIG_NLS_DEFAULT="iso8859-1"
1175# CONFIG_NLS_CODEPAGE_437 is not set 1143# CONFIG_NLS_CODEPAGE_437 is not set
@@ -1210,29 +1178,30 @@ CONFIG_NLS_DEFAULT="iso8859-1"
1210# CONFIG_NLS_KOI8_R is not set 1178# CONFIG_NLS_KOI8_R is not set
1211# CONFIG_NLS_KOI8_U is not set 1179# CONFIG_NLS_KOI8_U is not set
1212# CONFIG_NLS_UTF8 is not set 1180# CONFIG_NLS_UTF8 is not set
1213
1214#
1215# Distributed Lock Manager
1216#
1217# CONFIG_DLM is not set 1181# CONFIG_DLM is not set
1218 1182
1219# 1183#
1220# Profiling support
1221#
1222# CONFIG_PROFILING is not set
1223
1224#
1225# Kernel hacking 1184# Kernel hacking
1226# 1185#
1227# CONFIG_PRINTK_TIME is not set 1186# CONFIG_PRINTK_TIME is not set
1187CONFIG_ENABLE_WARN_DEPRECATED=y
1228CONFIG_ENABLE_MUST_CHECK=y 1188CONFIG_ENABLE_MUST_CHECK=y
1189CONFIG_FRAME_WARN=1024
1229# CONFIG_MAGIC_SYSRQ is not set 1190# CONFIG_MAGIC_SYSRQ is not set
1230# CONFIG_UNUSED_SYMBOLS is not set 1191# CONFIG_UNUSED_SYMBOLS is not set
1231# CONFIG_DEBUG_FS is not set 1192# CONFIG_DEBUG_FS is not set
1232# CONFIG_HEADERS_CHECK is not set 1193# CONFIG_HEADERS_CHECK is not set
1233# CONFIG_DEBUG_KERNEL is not set 1194# CONFIG_DEBUG_KERNEL is not set
1234# CONFIG_DEBUG_BUGVERBOSE is not set 1195# CONFIG_DEBUG_BUGVERBOSE is not set
1196# CONFIG_DEBUG_MEMORY_INIT is not set
1197# CONFIG_RCU_CPU_STALL_DETECTOR is not set
1198# CONFIG_SYSCTL_SYSCALL_CHECK is not set
1199# CONFIG_DYNAMIC_PRINTK_DEBUG is not set
1200# CONFIG_SAMPLES is not set
1201CONFIG_HAVE_ARCH_KGDB=y
1202CONFIG_DEBUG_VERBOSE=y
1235# CONFIG_DEBUG_MMRS is not set 1203# CONFIG_DEBUG_MMRS is not set
1204# CONFIG_DEBUG_DOUBLEFAULT is not set
1236# CONFIG_DEBUG_HUNT_FOR_ZERO is not set 1205# CONFIG_DEBUG_HUNT_FOR_ZERO is not set
1237CONFIG_DEBUG_BFIN_HWTRACE_ON=y 1206CONFIG_DEBUG_BFIN_HWTRACE_ON=y
1238CONFIG_DEBUG_BFIN_HWTRACE_COMPRESSION_OFF=y 1207CONFIG_DEBUG_BFIN_HWTRACE_COMPRESSION_OFF=y
@@ -1250,13 +1219,94 @@ CONFIG_DEBUG_BFIN_HWTRACE_COMPRESSION=0
1250# 1219#
1251# CONFIG_KEYS is not set 1220# CONFIG_KEYS is not set
1252CONFIG_SECURITY=y 1221CONFIG_SECURITY=y
1222# CONFIG_SECURITYFS is not set
1253# CONFIG_SECURITY_NETWORK is not set 1223# CONFIG_SECURITY_NETWORK is not set
1254CONFIG_SECURITY_CAPABILITIES=y 1224# CONFIG_SECURITY_FILE_CAPABILITIES is not set
1225CONFIG_SECURITY_DEFAULT_MMAP_MIN_ADDR=0
1226CONFIG_CRYPTO=y
1227
1228#
1229# Crypto core or helper
1230#
1231# CONFIG_CRYPTO_FIPS is not set
1232# CONFIG_CRYPTO_MANAGER is not set
1233# CONFIG_CRYPTO_GF128MUL is not set
1234# CONFIG_CRYPTO_NULL is not set
1235# CONFIG_CRYPTO_CRYPTD is not set
1236# CONFIG_CRYPTO_AUTHENC is not set
1237# CONFIG_CRYPTO_TEST is not set
1238
1239#
1240# Authenticated Encryption with Associated Data
1241#
1242# CONFIG_CRYPTO_CCM is not set
1243# CONFIG_CRYPTO_GCM is not set
1244# CONFIG_CRYPTO_SEQIV is not set
1245
1246#
1247# Block modes
1248#
1249# CONFIG_CRYPTO_CBC is not set
1250# CONFIG_CRYPTO_CTR is not set
1251# CONFIG_CRYPTO_CTS is not set
1252# CONFIG_CRYPTO_ECB is not set
1253# CONFIG_CRYPTO_LRW is not set
1254# CONFIG_CRYPTO_PCBC is not set
1255# CONFIG_CRYPTO_XTS is not set
1256
1257#
1258# Hash modes
1259#
1260# CONFIG_CRYPTO_HMAC is not set
1261# CONFIG_CRYPTO_XCBC is not set
1262
1263#
1264# Digest
1265#
1266# CONFIG_CRYPTO_CRC32C is not set
1267# CONFIG_CRYPTO_MD4 is not set
1268# CONFIG_CRYPTO_MD5 is not set
1269# CONFIG_CRYPTO_MICHAEL_MIC is not set
1270# CONFIG_CRYPTO_RMD128 is not set
1271# CONFIG_CRYPTO_RMD160 is not set
1272# CONFIG_CRYPTO_RMD256 is not set
1273# CONFIG_CRYPTO_RMD320 is not set
1274# CONFIG_CRYPTO_SHA1 is not set
1275# CONFIG_CRYPTO_SHA256 is not set
1276# CONFIG_CRYPTO_SHA512 is not set
1277# CONFIG_CRYPTO_TGR192 is not set
1278# CONFIG_CRYPTO_WP512 is not set
1279
1280#
1281# Ciphers
1282#
1283# CONFIG_CRYPTO_AES is not set
1284# CONFIG_CRYPTO_ANUBIS is not set
1285# CONFIG_CRYPTO_ARC4 is not set
1286# CONFIG_CRYPTO_BLOWFISH is not set
1287# CONFIG_CRYPTO_CAMELLIA is not set
1288# CONFIG_CRYPTO_CAST5 is not set
1289# CONFIG_CRYPTO_CAST6 is not set
1290# CONFIG_CRYPTO_DES is not set
1291# CONFIG_CRYPTO_FCRYPT is not set
1292# CONFIG_CRYPTO_KHAZAD is not set
1293# CONFIG_CRYPTO_SALSA20 is not set
1294# CONFIG_CRYPTO_SEED is not set
1295# CONFIG_CRYPTO_SERPENT is not set
1296# CONFIG_CRYPTO_TEA is not set
1297# CONFIG_CRYPTO_TWOFISH is not set
1298
1299#
1300# Compression
1301#
1302# CONFIG_CRYPTO_DEFLATE is not set
1303# CONFIG_CRYPTO_LZO is not set
1255 1304
1256# 1305#
1257# Cryptographic options 1306# Random Number Generation
1258# 1307#
1259# CONFIG_CRYPTO is not set 1308# CONFIG_CRYPTO_ANSI_CPRNG is not set
1309CONFIG_CRYPTO_HW=y
1260 1310
1261# 1311#
1262# Library routines 1312# Library routines
@@ -1264,8 +1314,10 @@ CONFIG_SECURITY_CAPABILITIES=y
1264CONFIG_BITREVERSE=y 1314CONFIG_BITREVERSE=y
1265CONFIG_CRC_CCITT=m 1315CONFIG_CRC_CCITT=m
1266# CONFIG_CRC16 is not set 1316# CONFIG_CRC16 is not set
1317# CONFIG_CRC_T10DIF is not set
1267# CONFIG_CRC_ITU_T is not set 1318# CONFIG_CRC_ITU_T is not set
1268CONFIG_CRC32=y 1319CONFIG_CRC32=y
1320# CONFIG_CRC7 is not set
1269# CONFIG_LIBCRC32C is not set 1321# CONFIG_LIBCRC32C is not set
1270CONFIG_ZLIB_INFLATE=y 1322CONFIG_ZLIB_INFLATE=y
1271CONFIG_PLIST=y 1323CONFIG_PLIST=y
diff --git a/arch/blackfin/configs/SRV1_defconfig b/arch/blackfin/configs/SRV1_defconfig
index b1309f878fcd..7c8250d6fa66 100644
--- a/arch/blackfin/configs/SRV1_defconfig
+++ b/arch/blackfin/configs/SRV1_defconfig
@@ -59,7 +59,7 @@ CONFIG_KALLSYMS_ALL=y
59CONFIG_HOTPLUG=y 59CONFIG_HOTPLUG=y
60CONFIG_PRINTK=y 60CONFIG_PRINTK=y
61CONFIG_BUG=y 61CONFIG_BUG=y
62CONFIG_ELF_CORE=y 62# CONFIG_ELF_CORE is not set
63CONFIG_BASE_FULL=y 63CONFIG_BASE_FULL=y
64CONFIG_FUTEX=y 64CONFIG_FUTEX=y
65CONFIG_ANON_INODES=y 65CONFIG_ANON_INODES=y
@@ -172,14 +172,14 @@ CONFIG_IRQ_UART1_RX=10
172CONFIG_IRQ_UART1_TX=10 172CONFIG_IRQ_UART1_TX=10
173CONFIG_IRQ_MAC_RX=11 173CONFIG_IRQ_MAC_RX=11
174CONFIG_IRQ_MAC_TX=11 174CONFIG_IRQ_MAC_TX=11
175CONFIG_IRQ_TMR0=12 175CONFIG_IRQ_TIMER0=12
176CONFIG_IRQ_TMR1=12 176CONFIG_IRQ_TIMER1=12
177CONFIG_IRQ_TMR2=12 177CONFIG_IRQ_TIMER2=12
178CONFIG_IRQ_TMR3=12 178CONFIG_IRQ_TIMER3=12
179CONFIG_IRQ_TMR4=12 179CONFIG_IRQ_TIMER4=12
180CONFIG_IRQ_TMR5=12 180CONFIG_IRQ_TIMER5=12
181CONFIG_IRQ_TMR6=12 181CONFIG_IRQ_TIMER6=12
182CONFIG_IRQ_TMR7=12 182CONFIG_IRQ_TIMER7=12
183CONFIG_IRQ_PORTG_INTB=12 183CONFIG_IRQ_PORTG_INTB=12
184CONFIG_IRQ_MEM_DMA0=13 184CONFIG_IRQ_MEM_DMA0=13
185CONFIG_IRQ_MEM_DMA1=13 185CONFIG_IRQ_MEM_DMA1=13
@@ -271,7 +271,6 @@ CONFIG_SPLIT_PTLOCK_CPUS=4
271# CONFIG_RESOURCES_64BIT is not set 271# CONFIG_RESOURCES_64BIT is not set
272CONFIG_ZONE_DMA_FLAG=1 272CONFIG_ZONE_DMA_FLAG=1
273CONFIG_LARGE_ALLOCS=y 273CONFIG_LARGE_ALLOCS=y
274CONFIG_BFIN_DMA_5XX=y
275CONFIG_DMA_UNCACHED_2M=y 274CONFIG_DMA_UNCACHED_2M=y
276# CONFIG_DMA_UNCACHED_1M is not set 275# CONFIG_DMA_UNCACHED_1M is not set
277# CONFIG_DMA_UNCACHED_NONE is not set 276# CONFIG_DMA_UNCACHED_NONE is not set
@@ -786,7 +785,7 @@ CONFIG_I2C_CHARDEV=y
786# 785#
787# CONFIG_I2C_BLACKFIN_GPIO is not set 786# CONFIG_I2C_BLACKFIN_GPIO is not set
788CONFIG_I2C_BLACKFIN_TWI=y 787CONFIG_I2C_BLACKFIN_TWI=y
789CONFIG_I2C_BLACKFIN_TWI_CLK_KHZ=50 788CONFIG_I2C_BLACKFIN_TWI_CLK_KHZ=100
790# CONFIG_I2C_GPIO is not set 789# CONFIG_I2C_GPIO is not set
791# CONFIG_I2C_OCORES is not set 790# CONFIG_I2C_OCORES is not set
792# CONFIG_I2C_PARPORT_LIGHT is not set 791# CONFIG_I2C_PARPORT_LIGHT is not set
diff --git a/arch/blackfin/configs/TCM-BF537_defconfig b/arch/blackfin/configs/TCM-BF537_defconfig
index c482ee171f9e..9af522c7dadf 100644
--- a/arch/blackfin/configs/TCM-BF537_defconfig
+++ b/arch/blackfin/configs/TCM-BF537_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.24.7 3# Linux kernel version: 2.6.28-rc2
4# Thu Jul 31 00:53:15 2008 4# Tue Jan 6 09:22:17 2009
5# 5#
6# CONFIG_MMU is not set 6# CONFIG_MMU is not set
7# CONFIG_FPU is not set 7# CONFIG_FPU is not set
@@ -9,7 +9,6 @@ CONFIG_RWSEM_GENERIC_SPINLOCK=y
9# CONFIG_RWSEM_XCHGADD_ALGORITHM is not set 9# CONFIG_RWSEM_XCHGADD_ALGORITHM is not set
10CONFIG_BLACKFIN=y 10CONFIG_BLACKFIN=y
11CONFIG_ZONE_DMA=y 11CONFIG_ZONE_DMA=y
12CONFIG_SEMAPHORE_SLEEPERS=y
13CONFIG_GENERIC_FIND_NEXT_BIT=y 12CONFIG_GENERIC_FIND_NEXT_BIT=y
14CONFIG_GENERIC_HWEIGHT=y 13CONFIG_GENERIC_HWEIGHT=y
15CONFIG_GENERIC_HARDIRQS=y 14CONFIG_GENERIC_HARDIRQS=y
@@ -30,17 +29,14 @@ CONFIG_LOCALVERSION_AUTO=y
30CONFIG_SYSVIPC=y 29CONFIG_SYSVIPC=y
31CONFIG_SYSVIPC_SYSCTL=y 30CONFIG_SYSVIPC_SYSCTL=y
32# CONFIG_BSD_PROCESS_ACCT is not set 31# CONFIG_BSD_PROCESS_ACCT is not set
33# CONFIG_USER_NS is not set
34# CONFIG_PID_NS is not set
35CONFIG_IKCONFIG=y 32CONFIG_IKCONFIG=y
36CONFIG_IKCONFIG_PROC=y 33CONFIG_IKCONFIG_PROC=y
37CONFIG_LOG_BUF_SHIFT=14 34CONFIG_LOG_BUF_SHIFT=14
38# CONFIG_CGROUPS is not set 35# CONFIG_CGROUPS is not set
39CONFIG_FAIR_GROUP_SCHED=y 36# CONFIG_GROUP_SCHED is not set
40CONFIG_FAIR_USER_SCHED=y 37# CONFIG_SYSFS_DEPRECATED_V2 is not set
41# CONFIG_FAIR_CGROUP_SCHED is not set
42CONFIG_SYSFS_DEPRECATED=y
43# CONFIG_RELAY is not set 38# CONFIG_RELAY is not set
39# CONFIG_NAMESPACES is not set
44# CONFIG_BLK_DEV_INITRD is not set 40# CONFIG_BLK_DEV_INITRD is not set
45# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 41# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
46CONFIG_SYSCTL=y 42CONFIG_SYSCTL=y
@@ -52,22 +48,30 @@ CONFIG_KALLSYMS=y
52# CONFIG_HOTPLUG is not set 48# CONFIG_HOTPLUG is not set
53CONFIG_PRINTK=y 49CONFIG_PRINTK=y
54CONFIG_BUG=y 50CONFIG_BUG=y
55CONFIG_ELF_CORE=y 51# CONFIG_ELF_CORE is not set
52CONFIG_COMPAT_BRK=y
56CONFIG_BASE_FULL=y 53CONFIG_BASE_FULL=y
57CONFIG_FUTEX=y 54CONFIG_FUTEX=y
58CONFIG_ANON_INODES=y 55CONFIG_ANON_INODES=y
59CONFIG_EPOLL=y 56CONFIG_EPOLL=y
60CONFIG_SIGNALFD=y 57CONFIG_SIGNALFD=y
58CONFIG_TIMERFD=y
61CONFIG_EVENTFD=y 59CONFIG_EVENTFD=y
60CONFIG_AIO=y
62CONFIG_VM_EVENT_COUNTERS=y 61CONFIG_VM_EVENT_COUNTERS=y
63CONFIG_SLAB=y 62CONFIG_SLAB=y
64# CONFIG_SLUB is not set 63# CONFIG_SLUB is not set
65# CONFIG_SLOB is not set 64# CONFIG_SLOB is not set
65# CONFIG_PROFILING is not set
66# CONFIG_MARKERS is not set
67CONFIG_HAVE_OPROFILE=y
68# CONFIG_HAVE_GENERIC_DMA_COHERENT is not set
66CONFIG_SLABINFO=y 69CONFIG_SLABINFO=y
67CONFIG_RT_MUTEXES=y 70CONFIG_RT_MUTEXES=y
68CONFIG_TINY_SHMEM=y 71CONFIG_TINY_SHMEM=y
69CONFIG_BASE_SMALL=0 72CONFIG_BASE_SMALL=0
70CONFIG_MODULES=y 73CONFIG_MODULES=y
74# CONFIG_MODULE_FORCE_LOAD is not set
71CONFIG_MODULE_UNLOAD=y 75CONFIG_MODULE_UNLOAD=y
72# CONFIG_MODULE_FORCE_UNLOAD is not set 76# CONFIG_MODULE_FORCE_UNLOAD is not set
73# CONFIG_MODVERSIONS is not set 77# CONFIG_MODVERSIONS is not set
@@ -78,6 +82,7 @@ CONFIG_BLOCK=y
78# CONFIG_BLK_DEV_IO_TRACE is not set 82# CONFIG_BLK_DEV_IO_TRACE is not set
79# CONFIG_LSF is not set 83# CONFIG_LSF is not set
80# CONFIG_BLK_DEV_BSG is not set 84# CONFIG_BLK_DEV_BSG is not set
85# CONFIG_BLK_DEV_INTEGRITY is not set
81 86
82# 87#
83# IO Schedulers 88# IO Schedulers
@@ -91,9 +96,11 @@ CONFIG_IOSCHED_CFQ=y
91# CONFIG_DEFAULT_CFQ is not set 96# CONFIG_DEFAULT_CFQ is not set
92CONFIG_DEFAULT_NOOP=y 97CONFIG_DEFAULT_NOOP=y
93CONFIG_DEFAULT_IOSCHED="noop" 98CONFIG_DEFAULT_IOSCHED="noop"
99CONFIG_CLASSIC_RCU=y
94CONFIG_PREEMPT_NONE=y 100CONFIG_PREEMPT_NONE=y
95# CONFIG_PREEMPT_VOLUNTARY is not set 101# CONFIG_PREEMPT_VOLUNTARY is not set
96# CONFIG_PREEMPT is not set 102# CONFIG_PREEMPT is not set
103# CONFIG_FREEZER is not set
97 104
98# 105#
99# Blackfin Processor Options 106# Blackfin Processor Options
@@ -102,6 +109,10 @@ CONFIG_PREEMPT_NONE=y
102# 109#
103# Processor and Board Settings 110# Processor and Board Settings
104# 111#
112# CONFIG_BF512 is not set
113# CONFIG_BF514 is not set
114# CONFIG_BF516 is not set
115# CONFIG_BF518 is not set
105# CONFIG_BF522 is not set 116# CONFIG_BF522 is not set
106# CONFIG_BF523 is not set 117# CONFIG_BF523 is not set
107# CONFIG_BF524 is not set 118# CONFIG_BF524 is not set
@@ -114,18 +125,23 @@ CONFIG_PREEMPT_NONE=y
114# CONFIG_BF534 is not set 125# CONFIG_BF534 is not set
115# CONFIG_BF536 is not set 126# CONFIG_BF536 is not set
116CONFIG_BF537=y 127CONFIG_BF537=y
128# CONFIG_BF538 is not set
129# CONFIG_BF539 is not set
117# CONFIG_BF542 is not set 130# CONFIG_BF542 is not set
118# CONFIG_BF544 is not set 131# CONFIG_BF544 is not set
119# CONFIG_BF547 is not set 132# CONFIG_BF547 is not set
120# CONFIG_BF548 is not set 133# CONFIG_BF548 is not set
121# CONFIG_BF549 is not set 134# CONFIG_BF549 is not set
122# CONFIG_BF561 is not set 135# CONFIG_BF561 is not set
136CONFIG_BF_REV_MIN=2
137CONFIG_BF_REV_MAX=3
123# CONFIG_BF_REV_0_0 is not set 138# CONFIG_BF_REV_0_0 is not set
124# CONFIG_BF_REV_0_1 is not set 139# CONFIG_BF_REV_0_1 is not set
125CONFIG_BF_REV_0_2=y 140CONFIG_BF_REV_0_2=y
126# CONFIG_BF_REV_0_3 is not set 141# CONFIG_BF_REV_0_3 is not set
127# CONFIG_BF_REV_0_4 is not set 142# CONFIG_BF_REV_0_4 is not set
128# CONFIG_BF_REV_0_5 is not set 143# CONFIG_BF_REV_0_5 is not set
144# CONFIG_BF_REV_0_6 is not set
129# CONFIG_BF_REV_ANY is not set 145# CONFIG_BF_REV_ANY is not set
130# CONFIG_BF_REV_NONE is not set 146# CONFIG_BF_REV_NONE is not set
131CONFIG_BF53x=y 147CONFIG_BF53x=y
@@ -137,25 +153,25 @@ CONFIG_IRQ_SPORT0_TX=9
137CONFIG_IRQ_SPORT1_RX=9 153CONFIG_IRQ_SPORT1_RX=9
138CONFIG_IRQ_SPORT1_TX=9 154CONFIG_IRQ_SPORT1_TX=9
139CONFIG_IRQ_TWI=10 155CONFIG_IRQ_TWI=10
140CONFIG_IRQ_SPI=10
141CONFIG_IRQ_UART0_RX=10 156CONFIG_IRQ_UART0_RX=10
142CONFIG_IRQ_UART0_TX=10 157CONFIG_IRQ_UART0_TX=10
143CONFIG_IRQ_UART1_RX=10 158CONFIG_IRQ_UART1_RX=10
144CONFIG_IRQ_UART1_TX=10 159CONFIG_IRQ_UART1_TX=10
145CONFIG_IRQ_MAC_RX=11 160CONFIG_IRQ_MAC_RX=11
146CONFIG_IRQ_MAC_TX=11 161CONFIG_IRQ_MAC_TX=11
147CONFIG_IRQ_TMR0=12 162CONFIG_IRQ_TIMER0=12
148CONFIG_IRQ_TMR1=12 163CONFIG_IRQ_TIMER1=12
149CONFIG_IRQ_TMR2=12 164CONFIG_IRQ_TIMER2=12
150CONFIG_IRQ_TMR3=12 165CONFIG_IRQ_TIMER3=12
151CONFIG_IRQ_TMR4=12 166CONFIG_IRQ_TIMER4=12
152CONFIG_IRQ_TMR5=12 167CONFIG_IRQ_TIMER5=12
153CONFIG_IRQ_TMR6=12 168CONFIG_IRQ_TIMER6=12
154CONFIG_IRQ_TMR7=12 169CONFIG_IRQ_TIMER7=12
155CONFIG_IRQ_PORTG_INTB=12 170CONFIG_IRQ_PORTG_INTB=12
156CONFIG_IRQ_MEM_DMA0=13 171CONFIG_IRQ_MEM_DMA0=13
157CONFIG_IRQ_MEM_DMA1=13 172CONFIG_IRQ_MEM_DMA1=13
158CONFIG_IRQ_WATCH=13 173CONFIG_IRQ_WATCH=13
174CONFIG_IRQ_SPI=10
159# CONFIG_BFIN537_STAMP is not set 175# CONFIG_BFIN537_STAMP is not set
160# CONFIG_BFIN537_BLUETECHNIX_CM is not set 176# CONFIG_BFIN537_BLUETECHNIX_CM is not set
161CONFIG_BFIN537_BLUETECHNIX_TCM=y 177CONFIG_BFIN537_BLUETECHNIX_TCM=y
@@ -191,7 +207,6 @@ CONFIG_BOOT_LOAD=0x1000
191# 207#
192CONFIG_CLKIN_HZ=25000000 208CONFIG_CLKIN_HZ=25000000
193# CONFIG_BFIN_KERNEL_CLOCK is not set 209# CONFIG_BFIN_KERNEL_CLOCK is not set
194CONFIG_MAX_MEM_SIZE=32
195CONFIG_MAX_VCO_HZ=600000000 210CONFIG_MAX_VCO_HZ=600000000
196CONFIG_MIN_VCO_HZ=50000000 211CONFIG_MIN_VCO_HZ=50000000
197CONFIG_MAX_SCLK_HZ=133333333 212CONFIG_MAX_SCLK_HZ=133333333
@@ -205,10 +220,10 @@ CONFIG_HZ_250=y
205# CONFIG_HZ_300 is not set 220# CONFIG_HZ_300 is not set
206# CONFIG_HZ_1000 is not set 221# CONFIG_HZ_1000 is not set
207CONFIG_HZ=250 222CONFIG_HZ=250
223# CONFIG_SCHED_HRTICK is not set
208CONFIG_GENERIC_TIME=y 224CONFIG_GENERIC_TIME=y
209CONFIG_GENERIC_CLOCKEVENTS=y 225CONFIG_GENERIC_CLOCKEVENTS=y
210# CONFIG_CYCLES_CLOCKSOURCE is not set 226# CONFIG_CYCLES_CLOCKSOURCE is not set
211# CONFIG_TICK_ONESHOT is not set
212# CONFIG_NO_HZ is not set 227# CONFIG_NO_HZ is not set
213# CONFIG_HIGH_RES_TIMERS is not set 228# CONFIG_HIGH_RES_TIMERS is not set
214CONFIG_GENERIC_CLOCKEVENTS_BUILD=y 229CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
@@ -242,6 +257,12 @@ CONFIG_IP_CHECKSUM_L1=y
242CONFIG_CACHELINE_ALIGNED_L1=y 257CONFIG_CACHELINE_ALIGNED_L1=y
243CONFIG_SYSCALL_TAB_L1=y 258CONFIG_SYSCALL_TAB_L1=y
244CONFIG_CPLB_SWITCH_TAB_L1=y 259CONFIG_CPLB_SWITCH_TAB_L1=y
260CONFIG_APP_STACK_L1=y
261
262#
263# Speed Optimizations
264#
265CONFIG_BFIN_INS_LOWOVERHEAD=y
245CONFIG_RAMKERNEL=y 266CONFIG_RAMKERNEL=y
246# CONFIG_ROMKERNEL is not set 267# CONFIG_ROMKERNEL is not set
247CONFIG_SELECT_MEMORY_MODEL=y 268CONFIG_SELECT_MEMORY_MODEL=y
@@ -250,14 +271,13 @@ CONFIG_FLATMEM_MANUAL=y
250# CONFIG_SPARSEMEM_MANUAL is not set 271# CONFIG_SPARSEMEM_MANUAL is not set
251CONFIG_FLATMEM=y 272CONFIG_FLATMEM=y
252CONFIG_FLAT_NODE_MEM_MAP=y 273CONFIG_FLAT_NODE_MEM_MAP=y
253# CONFIG_SPARSEMEM_STATIC is not set 274CONFIG_PAGEFLAGS_EXTENDED=y
254# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
255CONFIG_SPLIT_PTLOCK_CPUS=4 275CONFIG_SPLIT_PTLOCK_CPUS=4
256# CONFIG_RESOURCES_64BIT is not set 276# CONFIG_RESOURCES_64BIT is not set
277# CONFIG_PHYS_ADDR_T_64BIT is not set
257CONFIG_ZONE_DMA_FLAG=1 278CONFIG_ZONE_DMA_FLAG=1
258CONFIG_VIRT_TO_BUS=y 279CONFIG_VIRT_TO_BUS=y
259# CONFIG_BFIN_GPTIMERS is not set 280# CONFIG_BFIN_GPTIMERS is not set
260CONFIG_BFIN_DMA_5XX=y
261# CONFIG_DMA_UNCACHED_4M is not set 281# CONFIG_DMA_UNCACHED_4M is not set
262# CONFIG_DMA_UNCACHED_2M is not set 282# CONFIG_DMA_UNCACHED_2M is not set
263CONFIG_DMA_UNCACHED_1M=y 283CONFIG_DMA_UNCACHED_1M=y
@@ -300,7 +320,6 @@ CONFIG_BANK_3=0xFFC2
300# 320#
301# Bus options (PCI, PCMCIA, EISA, MCA, ISA) 321# Bus options (PCI, PCMCIA, EISA, MCA, ISA)
302# 322#
303# CONFIG_PCI is not set
304# CONFIG_ARCH_SUPPORTS_MSI is not set 323# CONFIG_ARCH_SUPPORTS_MSI is not set
305 324
306# 325#
@@ -310,23 +329,20 @@ CONFIG_BINFMT_ELF_FDPIC=y
310CONFIG_BINFMT_FLAT=y 329CONFIG_BINFMT_FLAT=y
311CONFIG_BINFMT_ZFLAT=y 330CONFIG_BINFMT_ZFLAT=y
312CONFIG_BINFMT_SHARED_FLAT=y 331CONFIG_BINFMT_SHARED_FLAT=y
332# CONFIG_HAVE_AOUT is not set
313# CONFIG_BINFMT_MISC is not set 333# CONFIG_BINFMT_MISC is not set
314 334
315# 335#
316# Power management options 336# Power management options
317# 337#
318# CONFIG_PM is not set 338# CONFIG_PM is not set
319CONFIG_SUSPEND_UP_POSSIBLE=y 339CONFIG_ARCH_SUSPEND_POSSIBLE=y
320# CONFIG_PM_WAKEUP_BY_GPIO is not set 340# CONFIG_PM_WAKEUP_BY_GPIO is not set
321 341
322# 342#
323# CPU Frequency scaling 343# CPU Frequency scaling
324# 344#
325# CONFIG_CPU_FREQ is not set 345# CONFIG_CPU_FREQ is not set
326
327#
328# Networking
329#
330# CONFIG_NET is not set 346# CONFIG_NET is not set
331 347
332# 348#
@@ -345,6 +361,7 @@ CONFIG_MTD=y
345CONFIG_MTD_PARTITIONS=y 361CONFIG_MTD_PARTITIONS=y
346# CONFIG_MTD_REDBOOT_PARTS is not set 362# CONFIG_MTD_REDBOOT_PARTS is not set
347# CONFIG_MTD_CMDLINE_PARTS is not set 363# CONFIG_MTD_CMDLINE_PARTS is not set
364# CONFIG_MTD_AR7_PARTS is not set
348 365
349# 366#
350# User Modules And Translation Layers 367# User Modules And Translation Layers
@@ -362,8 +379,10 @@ CONFIG_MTD_BLOCK=y
362# 379#
363# RAM/ROM/Flash chip drivers 380# RAM/ROM/Flash chip drivers
364# 381#
365# CONFIG_MTD_CFI is not set 382CONFIG_MTD_CFI=y
366# CONFIG_MTD_JEDECPROBE is not set 383# CONFIG_MTD_JEDECPROBE is not set
384CONFIG_MTD_GEN_PROBE=y
385# CONFIG_MTD_CFI_ADV_OPTIONS is not set
367CONFIG_MTD_MAP_BANK_WIDTH_1=y 386CONFIG_MTD_MAP_BANK_WIDTH_1=y
368CONFIG_MTD_MAP_BANK_WIDTH_2=y 387CONFIG_MTD_MAP_BANK_WIDTH_2=y
369CONFIG_MTD_MAP_BANK_WIDTH_4=y 388CONFIG_MTD_MAP_BANK_WIDTH_4=y
@@ -374,6 +393,10 @@ CONFIG_MTD_CFI_I1=y
374CONFIG_MTD_CFI_I2=y 393CONFIG_MTD_CFI_I2=y
375# CONFIG_MTD_CFI_I4 is not set 394# CONFIG_MTD_CFI_I4 is not set
376# CONFIG_MTD_CFI_I8 is not set 395# CONFIG_MTD_CFI_I8 is not set
396CONFIG_MTD_CFI_INTELEXT=y
397# CONFIG_MTD_CFI_AMDSTD is not set
398# CONFIG_MTD_CFI_STAA is not set
399CONFIG_MTD_CFI_UTIL=y
377CONFIG_MTD_RAM=y 400CONFIG_MTD_RAM=y
378# CONFIG_MTD_ROM is not set 401# CONFIG_MTD_ROM is not set
379# CONFIG_MTD_ABSENT is not set 402# CONFIG_MTD_ABSENT is not set
@@ -381,8 +404,9 @@ CONFIG_MTD_RAM=y
381# 404#
382# Mapping drivers for chip access 405# Mapping drivers for chip access
383# 406#
384# CONFIG_MTD_COMPLEX_MAPPINGS is not set 407CONFIG_MTD_COMPLEX_MAPPINGS=y
385# CONFIG_MTD_GPIO_ADDR is not set 408# CONFIG_MTD_PHYSMAP is not set
409CONFIG_MTD_GPIO_ADDR=y
386CONFIG_MTD_UCLINUX=y 410CONFIG_MTD_UCLINUX=y
387# CONFIG_MTD_PLATRAM is not set 411# CONFIG_MTD_PLATRAM is not set
388 412
@@ -416,10 +440,13 @@ CONFIG_BLK_DEV=y
416CONFIG_BLK_DEV_RAM=y 440CONFIG_BLK_DEV_RAM=y
417CONFIG_BLK_DEV_RAM_COUNT=16 441CONFIG_BLK_DEV_RAM_COUNT=16
418CONFIG_BLK_DEV_RAM_SIZE=4096 442CONFIG_BLK_DEV_RAM_SIZE=4096
419CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024 443# CONFIG_BLK_DEV_XIP is not set
420# CONFIG_CDROM_PKTCDVD is not set 444# CONFIG_CDROM_PKTCDVD is not set
445# CONFIG_BLK_DEV_HD is not set
421CONFIG_MISC_DEVICES=y 446CONFIG_MISC_DEVICES=y
422# CONFIG_EEPROM_93CX6 is not set 447# CONFIG_EEPROM_93CX6 is not set
448# CONFIG_ENCLOSURE_SERVICES is not set
449CONFIG_HAVE_IDE=y
423# CONFIG_IDE is not set 450# CONFIG_IDE is not set
424 451
425# 452#
@@ -454,8 +481,11 @@ CONFIG_MISC_DEVICES=y
454# CONFIG_BF5xx_PPI is not set 481# CONFIG_BF5xx_PPI is not set
455CONFIG_BFIN_SPORT=y 482CONFIG_BFIN_SPORT=y
456# CONFIG_BFIN_TIMER_LATENCY is not set 483# CONFIG_BFIN_TIMER_LATENCY is not set
484CONFIG_BFIN_DMA_INTERFACE=m
457# CONFIG_SIMPLE_GPIO is not set 485# CONFIG_SIMPLE_GPIO is not set
458# CONFIG_VT is not set 486# CONFIG_VT is not set
487# CONFIG_DEVKMEM is not set
488# CONFIG_BFIN_JTAG_COMM is not set
459# CONFIG_SERIAL_NONSTANDARD is not set 489# CONFIG_SERIAL_NONSTANDARD is not set
460 490
461# 491#
@@ -486,15 +516,10 @@ CONFIG_UNIX98_PTYS=y
486# CONFIG_CAN4LINUX is not set 516# CONFIG_CAN4LINUX is not set
487# CONFIG_IPMI_HANDLER is not set 517# CONFIG_IPMI_HANDLER is not set
488# CONFIG_HW_RANDOM is not set 518# CONFIG_HW_RANDOM is not set
489# CONFIG_GEN_RTC is not set
490# CONFIG_R3964 is not set 519# CONFIG_R3964 is not set
491# CONFIG_RAW_DRIVER is not set 520# CONFIG_RAW_DRIVER is not set
492# CONFIG_TCG_TPM is not set 521# CONFIG_TCG_TPM is not set
493# CONFIG_I2C is not set 522# CONFIG_I2C is not set
494
495#
496# SPI support
497#
498CONFIG_SPI=y 523CONFIG_SPI=y
499CONFIG_SPI_MASTER=y 524CONFIG_SPI_MASTER=y
500 525
@@ -502,6 +527,7 @@ CONFIG_SPI_MASTER=y
502# SPI Master Controller Drivers 527# SPI Master Controller Drivers
503# 528#
504CONFIG_SPI_BFIN=y 529CONFIG_SPI_BFIN=y
530# CONFIG_SPI_BFIN_LOCK is not set
505# CONFIG_SPI_BITBANG is not set 531# CONFIG_SPI_BITBANG is not set
506 532
507# 533#
@@ -510,9 +536,13 @@ CONFIG_SPI_BFIN=y
510# CONFIG_SPI_AT25 is not set 536# CONFIG_SPI_AT25 is not set
511# CONFIG_SPI_SPIDEV is not set 537# CONFIG_SPI_SPIDEV is not set
512# CONFIG_SPI_TLE62X0 is not set 538# CONFIG_SPI_TLE62X0 is not set
539CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y
540# CONFIG_GPIOLIB is not set
513# CONFIG_W1 is not set 541# CONFIG_W1 is not set
514# CONFIG_POWER_SUPPLY is not set 542# CONFIG_POWER_SUPPLY is not set
515# CONFIG_HWMON is not set 543# CONFIG_HWMON is not set
544# CONFIG_THERMAL is not set
545# CONFIG_THERMAL_HWMON is not set
516CONFIG_WATCHDOG=y 546CONFIG_WATCHDOG=y
517# CONFIG_WATCHDOG_NOWAYOUT is not set 547# CONFIG_WATCHDOG_NOWAYOUT is not set
518 548
@@ -523,20 +553,27 @@ CONFIG_WATCHDOG=y
523CONFIG_BFIN_WDT=y 553CONFIG_BFIN_WDT=y
524 554
525# 555#
526# Sonics Silicon Backplane
527#
528CONFIG_SSB_POSSIBLE=y
529# CONFIG_SSB is not set
530
531#
532# Multifunction device drivers 556# Multifunction device drivers
533# 557#
558# CONFIG_MFD_CORE is not set
534# CONFIG_MFD_SM501 is not set 559# CONFIG_MFD_SM501 is not set
560# CONFIG_HTC_PASIC3 is not set
561# CONFIG_MFD_TMIO is not set
562# CONFIG_MFD_WM8400 is not set
535 563
536# 564#
537# Multimedia devices 565# Multimedia devices
538# 566#
567
568#
569# Multimedia core support
570#
539# CONFIG_VIDEO_DEV is not set 571# CONFIG_VIDEO_DEV is not set
572# CONFIG_VIDEO_MEDIA is not set
573
574#
575# Multimedia drivers
576#
540# CONFIG_DAB is not set 577# CONFIG_DAB is not set
541 578
542# 579#
@@ -551,20 +588,16 @@ CONFIG_SSB_POSSIBLE=y
551# Display device support 588# Display device support
552# 589#
553# CONFIG_DISPLAY_SUPPORT is not set 590# CONFIG_DISPLAY_SUPPORT is not set
554
555#
556# Sound
557#
558# CONFIG_SOUND is not set 591# CONFIG_SOUND is not set
559# CONFIG_USB_SUPPORT is not set 592# CONFIG_USB_SUPPORT is not set
560# CONFIG_MMC is not set 593# CONFIG_MMC is not set
594# CONFIG_MEMSTICK is not set
561# CONFIG_NEW_LEDS is not set 595# CONFIG_NEW_LEDS is not set
596# CONFIG_ACCESSIBILITY is not set
562# CONFIG_RTC_CLASS is not set 597# CONFIG_RTC_CLASS is not set
563 598# CONFIG_DMADEVICES is not set
564#
565# Userspace I/O
566#
567# CONFIG_UIO is not set 599# CONFIG_UIO is not set
600# CONFIG_STAGING is not set
568 601
569# 602#
570# File systems 603# File systems
@@ -574,19 +607,17 @@ CONFIG_EXT2_FS_XATTR=y
574# CONFIG_EXT2_FS_POSIX_ACL is not set 607# CONFIG_EXT2_FS_POSIX_ACL is not set
575# CONFIG_EXT2_FS_SECURITY is not set 608# CONFIG_EXT2_FS_SECURITY is not set
576# CONFIG_EXT3_FS is not set 609# CONFIG_EXT3_FS is not set
577# CONFIG_EXT4DEV_FS is not set 610# CONFIG_EXT4_FS is not set
578CONFIG_FS_MBCACHE=y 611CONFIG_FS_MBCACHE=y
579# CONFIG_REISERFS_FS is not set 612# CONFIG_REISERFS_FS is not set
580# CONFIG_JFS_FS is not set 613# CONFIG_JFS_FS is not set
581# CONFIG_FS_POSIX_ACL is not set 614# CONFIG_FS_POSIX_ACL is not set
615CONFIG_FILE_LOCKING=y
582# CONFIG_XFS_FS is not set 616# CONFIG_XFS_FS is not set
583# CONFIG_GFS2_FS is not set 617# CONFIG_DNOTIFY is not set
584# CONFIG_MINIX_FS is not set
585# CONFIG_ROMFS_FS is not set
586CONFIG_INOTIFY=y 618CONFIG_INOTIFY=y
587CONFIG_INOTIFY_USER=y 619CONFIG_INOTIFY_USER=y
588# CONFIG_QUOTA is not set 620# CONFIG_QUOTA is not set
589# CONFIG_DNOTIFY is not set
590# CONFIG_AUTOFS_FS is not set 621# CONFIG_AUTOFS_FS is not set
591# CONFIG_AUTOFS4_FS is not set 622# CONFIG_AUTOFS4_FS is not set
592# CONFIG_FUSE_FS is not set 623# CONFIG_FUSE_FS is not set
@@ -628,8 +659,11 @@ CONFIG_SYSFS=y
628# CONFIG_JFFS2_FS is not set 659# CONFIG_JFFS2_FS is not set
629# CONFIG_CRAMFS is not set 660# CONFIG_CRAMFS is not set
630# CONFIG_VXFS_FS is not set 661# CONFIG_VXFS_FS is not set
662# CONFIG_MINIX_FS is not set
663# CONFIG_OMFS_FS is not set
631# CONFIG_HPFS_FS is not set 664# CONFIG_HPFS_FS is not set
632# CONFIG_QNX4FS_FS is not set 665# CONFIG_QNX4FS_FS is not set
666# CONFIG_ROMFS_FS is not set
633# CONFIG_SYSV_FS is not set 667# CONFIG_SYSV_FS is not set
634# CONFIG_UFS_FS is not set 668# CONFIG_UFS_FS is not set
635 669
@@ -639,7 +673,6 @@ CONFIG_SYSFS=y
639# CONFIG_PARTITION_ADVANCED is not set 673# CONFIG_PARTITION_ADVANCED is not set
640CONFIG_MSDOS_PARTITION=y 674CONFIG_MSDOS_PARTITION=y
641# CONFIG_NLS is not set 675# CONFIG_NLS is not set
642# CONFIG_INSTRUMENTATION is not set
643 676
644# 677#
645# Kernel hacking 678# Kernel hacking
@@ -647,14 +680,22 @@ CONFIG_MSDOS_PARTITION=y
647# CONFIG_PRINTK_TIME is not set 680# CONFIG_PRINTK_TIME is not set
648CONFIG_ENABLE_WARN_DEPRECATED=y 681CONFIG_ENABLE_WARN_DEPRECATED=y
649CONFIG_ENABLE_MUST_CHECK=y 682CONFIG_ENABLE_MUST_CHECK=y
683CONFIG_FRAME_WARN=1024
650# CONFIG_MAGIC_SYSRQ is not set 684# CONFIG_MAGIC_SYSRQ is not set
651# CONFIG_UNUSED_SYMBOLS is not set 685# CONFIG_UNUSED_SYMBOLS is not set
652CONFIG_DEBUG_FS=y 686CONFIG_DEBUG_FS=y
653# CONFIG_HEADERS_CHECK is not set 687# CONFIG_HEADERS_CHECK is not set
654# CONFIG_DEBUG_KERNEL is not set 688# CONFIG_DEBUG_KERNEL is not set
655# CONFIG_DEBUG_BUGVERBOSE is not set 689# CONFIG_DEBUG_BUGVERBOSE is not set
690# CONFIG_DEBUG_MEMORY_INIT is not set
691# CONFIG_RCU_CPU_STALL_DETECTOR is not set
692# CONFIG_SYSCTL_SYSCALL_CHECK is not set
693# CONFIG_DYNAMIC_PRINTK_DEBUG is not set
656# CONFIG_SAMPLES is not set 694# CONFIG_SAMPLES is not set
695CONFIG_HAVE_ARCH_KGDB=y
696CONFIG_DEBUG_VERBOSE=y
657CONFIG_DEBUG_MMRS=y 697CONFIG_DEBUG_MMRS=y
698# CONFIG_DEBUG_DOUBLEFAULT is not set
658CONFIG_DEBUG_HUNT_FOR_ZERO=y 699CONFIG_DEBUG_HUNT_FOR_ZERO=y
659CONFIG_DEBUG_BFIN_HWTRACE_ON=y 700CONFIG_DEBUG_BFIN_HWTRACE_ON=y
660CONFIG_DEBUG_BFIN_HWTRACE_COMPRESSION_OFF=y 701CONFIG_DEBUG_BFIN_HWTRACE_COMPRESSION_OFF=y
@@ -671,9 +712,8 @@ CONFIG_ACCESS_CHECK=y
671# Security options 712# Security options
672# 713#
673# CONFIG_KEYS is not set 714# CONFIG_KEYS is not set
674CONFIG_SECURITY=y 715# CONFIG_SECURITY is not set
675# CONFIG_SECURITY_NETWORK is not set 716# CONFIG_SECURITYFS is not set
676CONFIG_SECURITY_CAPABILITIES=y
677# CONFIG_SECURITY_FILE_CAPABILITIES is not set 717# CONFIG_SECURITY_FILE_CAPABILITIES is not set
678# CONFIG_CRYPTO is not set 718# CONFIG_CRYPTO is not set
679 719
@@ -682,6 +722,7 @@ CONFIG_SECURITY_CAPABILITIES=y
682# 722#
683# CONFIG_CRC_CCITT is not set 723# CONFIG_CRC_CCITT is not set
684# CONFIG_CRC16 is not set 724# CONFIG_CRC16 is not set
725# CONFIG_CRC_T10DIF is not set
685# CONFIG_CRC_ITU_T is not set 726# CONFIG_CRC_ITU_T is not set
686# CONFIG_CRC32 is not set 727# CONFIG_CRC32 is not set
687# CONFIG_CRC7 is not set 728# CONFIG_CRC7 is not set
diff --git a/arch/blackfin/include/asm/atomic.h b/arch/blackfin/include/asm/atomic.h
index 25776c19064b..94b2a9b19451 100644
--- a/arch/blackfin/include/asm/atomic.h
+++ b/arch/blackfin/include/asm/atomic.h
@@ -15,104 +15,159 @@
15 */ 15 */
16 16
17#define ATOMIC_INIT(i) { (i) } 17#define ATOMIC_INIT(i) { (i) }
18
19#define atomic_read(v) ((v)->counter)
20#define atomic_set(v, i) (((v)->counter) = i) 18#define atomic_set(v, i) (((v)->counter) = i)
21 19
22static __inline__ void atomic_add(int i, atomic_t * v) 20#ifdef CONFIG_SMP
21
22#define atomic_read(v) __raw_uncached_fetch_asm(&(v)->counter)
23
24asmlinkage int __raw_uncached_fetch_asm(const volatile int *ptr);
25
26asmlinkage int __raw_atomic_update_asm(volatile int *ptr, int value);
27
28asmlinkage int __raw_atomic_clear_asm(volatile int *ptr, int value);
29
30asmlinkage int __raw_atomic_set_asm(volatile int *ptr, int value);
31
32asmlinkage int __raw_atomic_xor_asm(volatile int *ptr, int value);
33
34asmlinkage int __raw_atomic_test_asm(const volatile int *ptr, int value);
35
36static inline void atomic_add(int i, atomic_t *v)
37{
38 __raw_atomic_update_asm(&v->counter, i);
39}
40
41static inline void atomic_sub(int i, atomic_t *v)
42{
43 __raw_atomic_update_asm(&v->counter, -i);
44}
45
46static inline int atomic_add_return(int i, atomic_t *v)
47{
48 return __raw_atomic_update_asm(&v->counter, i);
49}
50
51static inline int atomic_sub_return(int i, atomic_t *v)
52{
53 return __raw_atomic_update_asm(&v->counter, -i);
54}
55
56static inline void atomic_inc(volatile atomic_t *v)
57{
58 __raw_atomic_update_asm(&v->counter, 1);
59}
60
61static inline void atomic_dec(volatile atomic_t *v)
62{
63 __raw_atomic_update_asm(&v->counter, -1);
64}
65
66static inline void atomic_clear_mask(int mask, atomic_t *v)
67{
68 __raw_atomic_clear_asm(&v->counter, mask);
69}
70
71static inline void atomic_set_mask(int mask, atomic_t *v)
72{
73 __raw_atomic_set_asm(&v->counter, mask);
74}
75
76static inline int atomic_test_mask(int mask, atomic_t *v)
77{
78 return __raw_atomic_test_asm(&v->counter, mask);
79}
80
81/* Atomic operations are already serializing */
82#define smp_mb__before_atomic_dec() barrier()
83#define smp_mb__after_atomic_dec() barrier()
84#define smp_mb__before_atomic_inc() barrier()
85#define smp_mb__after_atomic_inc() barrier()
86
87#else /* !CONFIG_SMP */
88
89#define atomic_read(v) ((v)->counter)
90
91static inline void atomic_add(int i, atomic_t *v)
23{ 92{
24 long flags; 93 long flags;
25 94
26 local_irq_save(flags); 95 local_irq_save_hw(flags);
27 v->counter += i; 96 v->counter += i;
28 local_irq_restore(flags); 97 local_irq_restore_hw(flags);
29} 98}
30 99
31static __inline__ void atomic_sub(int i, atomic_t * v) 100static inline void atomic_sub(int i, atomic_t *v)
32{ 101{
33 long flags; 102 long flags;
34 103
35 local_irq_save(flags); 104 local_irq_save_hw(flags);
36 v->counter -= i; 105 v->counter -= i;
37 local_irq_restore(flags); 106 local_irq_restore_hw(flags);
38 107
39} 108}
40 109
41static inline int atomic_add_return(int i, atomic_t * v) 110static inline int atomic_add_return(int i, atomic_t *v)
42{ 111{
43 int __temp = 0; 112 int __temp = 0;
44 long flags; 113 long flags;
45 114
46 local_irq_save(flags); 115 local_irq_save_hw(flags);
47 v->counter += i; 116 v->counter += i;
48 __temp = v->counter; 117 __temp = v->counter;
49 local_irq_restore(flags); 118 local_irq_restore_hw(flags);
50 119
51 120
52 return __temp; 121 return __temp;
53} 122}
54 123
55#define atomic_add_negative(a, v) (atomic_add_return((a), (v)) < 0) 124static inline int atomic_sub_return(int i, atomic_t *v)
56static inline int atomic_sub_return(int i, atomic_t * v)
57{ 125{
58 int __temp = 0; 126 int __temp = 0;
59 long flags; 127 long flags;
60 128
61 local_irq_save(flags); 129 local_irq_save_hw(flags);
62 v->counter -= i; 130 v->counter -= i;
63 __temp = v->counter; 131 __temp = v->counter;
64 local_irq_restore(flags); 132 local_irq_restore_hw(flags);
65 133
66 return __temp; 134 return __temp;
67} 135}
68 136
69static __inline__ void atomic_inc(volatile atomic_t * v) 137static inline void atomic_inc(volatile atomic_t *v)
70{ 138{
71 long flags; 139 long flags;
72 140
73 local_irq_save(flags); 141 local_irq_save_hw(flags);
74 v->counter++; 142 v->counter++;
75 local_irq_restore(flags); 143 local_irq_restore_hw(flags);
76} 144}
77 145
78#define atomic_cmpxchg(v, o, n) ((int)cmpxchg(&((v)->counter), (o), (n))) 146static inline void atomic_dec(volatile atomic_t *v)
79#define atomic_xchg(v, new) (xchg(&((v)->counter), new))
80
81#define atomic_add_unless(v, a, u) \
82({ \
83 int c, old; \
84 c = atomic_read(v); \
85 while (c != (u) && (old = atomic_cmpxchg((v), c, c + (a))) != c) \
86 c = old; \
87 c != (u); \
88})
89#define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0)
90
91static __inline__ void atomic_dec(volatile atomic_t * v)
92{ 147{
93 long flags; 148 long flags;
94 149
95 local_irq_save(flags); 150 local_irq_save_hw(flags);
96 v->counter--; 151 v->counter--;
97 local_irq_restore(flags); 152 local_irq_restore_hw(flags);
98} 153}
99 154
100static __inline__ void atomic_clear_mask(unsigned int mask, atomic_t * v) 155static inline void atomic_clear_mask(unsigned int mask, atomic_t *v)
101{ 156{
102 long flags; 157 long flags;
103 158
104 local_irq_save(flags); 159 local_irq_save_hw(flags);
105 v->counter &= ~mask; 160 v->counter &= ~mask;
106 local_irq_restore(flags); 161 local_irq_restore_hw(flags);
107} 162}
108 163
109static __inline__ void atomic_set_mask(unsigned int mask, atomic_t * v) 164static inline void atomic_set_mask(unsigned int mask, atomic_t *v)
110{ 165{
111 long flags; 166 long flags;
112 167
113 local_irq_save(flags); 168 local_irq_save_hw(flags);
114 v->counter |= mask; 169 v->counter |= mask;
115 local_irq_restore(flags); 170 local_irq_restore_hw(flags);
116} 171}
117 172
118/* Atomic operations are already serializing */ 173/* Atomic operations are already serializing */
@@ -121,9 +176,25 @@ static __inline__ void atomic_set_mask(unsigned int mask, atomic_t * v)
121#define smp_mb__before_atomic_inc() barrier() 176#define smp_mb__before_atomic_inc() barrier()
122#define smp_mb__after_atomic_inc() barrier() 177#define smp_mb__after_atomic_inc() barrier()
123 178
179#endif /* !CONFIG_SMP */
180
181#define atomic_add_negative(a, v) (atomic_add_return((a), (v)) < 0)
124#define atomic_dec_return(v) atomic_sub_return(1,(v)) 182#define atomic_dec_return(v) atomic_sub_return(1,(v))
125#define atomic_inc_return(v) atomic_add_return(1,(v)) 183#define atomic_inc_return(v) atomic_add_return(1,(v))
126 184
185#define atomic_cmpxchg(v, o, n) ((int)cmpxchg(&((v)->counter), (o), (n)))
186#define atomic_xchg(v, new) (xchg(&((v)->counter), new))
187
188#define atomic_add_unless(v, a, u) \
189({ \
190 int c, old; \
191 c = atomic_read(v); \
192 while (c != (u) && (old = atomic_cmpxchg((v), c, c + (a))) != c) \
193 c = old; \
194 c != (u); \
195})
196#define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0)
197
127/* 198/*
128 * atomic_inc_and_test - increment and test 199 * atomic_inc_and_test - increment and test
129 * @v: pointer of type atomic_t 200 * @v: pointer of type atomic_t
diff --git a/arch/blackfin/include/asm/bfin-global.h b/arch/blackfin/include/asm/bfin-global.h
index 77295666c34b..daffc0684e75 100644
--- a/arch/blackfin/include/asm/bfin-global.h
+++ b/arch/blackfin/include/asm/bfin-global.h
@@ -47,6 +47,9 @@
47# define DMA_UNCACHED_REGION (0) 47# define DMA_UNCACHED_REGION (0)
48#endif 48#endif
49 49
50extern void bfin_setup_caches(unsigned int cpu);
51extern void bfin_setup_cpudata(unsigned int cpu);
52
50extern unsigned long get_cclk(void); 53extern unsigned long get_cclk(void);
51extern unsigned long get_sclk(void); 54extern unsigned long get_sclk(void);
52extern unsigned long sclk_to_usecs(unsigned long sclk); 55extern unsigned long sclk_to_usecs(unsigned long sclk);
@@ -58,8 +61,6 @@ extern void dump_bfin_trace_buffer(void);
58 61
59/* init functions only */ 62/* init functions only */
60extern int init_arch_irq(void); 63extern int init_arch_irq(void);
61extern void bfin_icache_init(void);
62extern void bfin_dcache_init(void);
63extern void init_exception_vectors(void); 64extern void init_exception_vectors(void);
64extern void program_IAR(void); 65extern void program_IAR(void);
65 66
@@ -110,7 +111,7 @@ extern unsigned long memory_mtd_start, memory_mtd_end, mtd_size;
110 111
111#ifdef CONFIG_BFIN_ICACHE_LOCK 112#ifdef CONFIG_BFIN_ICACHE_LOCK
112extern void cache_grab_lock(int way); 113extern void cache_grab_lock(int way);
113extern void cache_lock(int way); 114extern void bfin_cache_lock(int way);
114#endif 115#endif
115 116
116#endif 117#endif
diff --git a/arch/blackfin/include/asm/bfin5xx_spi.h b/arch/blackfin/include/asm/bfin5xx_spi.h
index 9fa19158e38d..1306e6b22946 100644
--- a/arch/blackfin/include/asm/bfin5xx_spi.h
+++ b/arch/blackfin/include/asm/bfin5xx_spi.h
@@ -1,22 +1,12 @@
1/************************************************************ 1/*
2 2 * Blackfin On-Chip SPI Driver
3* Copyright (C) 2006-2008, Analog Devices. All Rights Reserved 3 *
4* 4 * Copyright 2004-2008 Analog Devices Inc.
5* FILE bfin5xx_spi.h 5 *
6* PROGRAMMER(S): Luke Yang (Analog Devices Inc.) 6 * Enter bugs at http://blackfin.uclinux.org/
7* 7 *
8* 8 * Licensed under the GPL-2 or later.
9* DATE OF CREATION: March. 10th 2006 9 */
10*
11* SYNOPSIS:
12*
13* DESCRIPTION: header file for SPI controller driver for Blackfin5xx.
14**************************************************************
15
16* MODIFICATION HISTORY:
17* March 10, 2006 bfin5xx_spi.h Created. (Luke Yang)
18
19************************************************************/
20 10
21#ifndef _SPI_CHANNEL_H_ 11#ifndef _SPI_CHANNEL_H_
22#define _SPI_CHANNEL_H_ 12#define _SPI_CHANNEL_H_
diff --git a/arch/blackfin/include/asm/bfin_sdh.h b/arch/blackfin/include/asm/bfin_sdh.h
new file mode 100644
index 000000000000..d61d5497c590
--- /dev/null
+++ b/arch/blackfin/include/asm/bfin_sdh.h
@@ -0,0 +1,19 @@
1/*
2 * bfin_sdh.h - Blackfin SDH definitions
3 *
4 * Copyright 2008 Analog Devices Inc.
5 *
6 * Licensed under the GPL-2 or later.
7 */
8
9#ifndef __BFIN_SDH_H__
10#define __BFIN_SDH_H__
11
12struct bfin_sd_host {
13 int dma_chan;
14 int irq_int0;
15 int irq_int1;
16 u16 pin_req[7];
17};
18
19#endif
diff --git a/arch/blackfin/include/asm/bfin_sport.h b/arch/blackfin/include/asm/bfin_sport.h
index c76ed8def302..fe88a2c19213 100644
--- a/arch/blackfin/include/asm/bfin_sport.h
+++ b/arch/blackfin/include/asm/bfin_sport.h
@@ -120,9 +120,6 @@ struct sport_register {
120#define SPORT_IOC_MAGIC 'P' 120#define SPORT_IOC_MAGIC 'P'
121#define SPORT_IOC_CONFIG _IOWR('P', 0x01, struct sport_config) 121#define SPORT_IOC_CONFIG _IOWR('P', 0x01, struct sport_config)
122 122
123/* Test purpose */
124#define ENABLE_AD73311 _IOWR('P', 0x02, int)
125
126struct sport_dev { 123struct sport_dev {
127 struct cdev cdev; /* Char device structure */ 124 struct cdev cdev; /* Char device structure */
128 125
diff --git a/arch/blackfin/include/asm/bfrom.h b/arch/blackfin/include/asm/bfrom.h
index cfe8024c3b2f..9e4be5e5e767 100644
--- a/arch/blackfin/include/asm/bfrom.h
+++ b/arch/blackfin/include/asm/bfrom.h
@@ -43,6 +43,11 @@ __attribute__((__noreturn__))
43static inline void bfrom_SoftReset(void *new_stack) 43static inline void bfrom_SoftReset(void *new_stack)
44{ 44{
45 while (1) 45 while (1)
46 /*
47 * We don't declare the SP as clobbered on purpose, since
48 * it confuses the heck out of the compiler, and this function
49 * never returns
50 */
46 __asm__ __volatile__( 51 __asm__ __volatile__(
47 "sp = %[stack];" 52 "sp = %[stack];"
48 "jump (%[bfrom_syscontrol]);" 53 "jump (%[bfrom_syscontrol]);"
diff --git a/arch/blackfin/include/asm/bitops.h b/arch/blackfin/include/asm/bitops.h
index c428e4106f89..21b036eadab1 100644
--- a/arch/blackfin/include/asm/bitops.h
+++ b/arch/blackfin/include/asm/bitops.h
@@ -7,7 +7,6 @@
7 7
8#include <linux/compiler.h> 8#include <linux/compiler.h>
9#include <asm/byteorder.h> /* swab32 */ 9#include <asm/byteorder.h> /* swab32 */
10#include <asm/system.h> /* save_flags */
11 10
12#ifdef __KERNEL__ 11#ifdef __KERNEL__
13 12
@@ -20,80 +19,107 @@
20#include <asm-generic/bitops/sched.h> 19#include <asm-generic/bitops/sched.h>
21#include <asm-generic/bitops/ffz.h> 20#include <asm-generic/bitops/ffz.h>
22 21
23static __inline__ void set_bit(int nr, volatile unsigned long *addr) 22#ifdef CONFIG_SMP
23
24#include <linux/linkage.h>
25
26asmlinkage int __raw_bit_set_asm(volatile unsigned long *addr, int nr);
27
28asmlinkage int __raw_bit_clear_asm(volatile unsigned long *addr, int nr);
29
30asmlinkage int __raw_bit_toggle_asm(volatile unsigned long *addr, int nr);
31
32asmlinkage int __raw_bit_test_set_asm(volatile unsigned long *addr, int nr);
33
34asmlinkage int __raw_bit_test_clear_asm(volatile unsigned long *addr, int nr);
35
36asmlinkage int __raw_bit_test_toggle_asm(volatile unsigned long *addr, int nr);
37
38asmlinkage int __raw_bit_test_asm(const volatile unsigned long *addr, int nr);
39
40static inline void set_bit(int nr, volatile unsigned long *addr)
24{ 41{
25 int *a = (int *)addr; 42 volatile unsigned long *a = addr + (nr >> 5);
26 int mask; 43 __raw_bit_set_asm(a, nr & 0x1f);
27 unsigned long flags; 44}
28 45
29 a += nr >> 5; 46static inline void clear_bit(int nr, volatile unsigned long *addr)
30 mask = 1 << (nr & 0x1f); 47{
31 local_irq_save(flags); 48 volatile unsigned long *a = addr + (nr >> 5);
32 *a |= mask; 49 __raw_bit_clear_asm(a, nr & 0x1f);
33 local_irq_restore(flags);
34} 50}
35 51
36static __inline__ void __set_bit(int nr, volatile unsigned long *addr) 52static inline void change_bit(int nr, volatile unsigned long *addr)
37{ 53{
38 int *a = (int *)addr; 54 volatile unsigned long *a = addr + (nr >> 5);
39 int mask; 55 __raw_bit_toggle_asm(a, nr & 0x1f);
56}
40 57
41 a += nr >> 5; 58static inline int test_bit(int nr, const volatile unsigned long *addr)
42 mask = 1 << (nr & 0x1f); 59{
43 *a |= mask; 60 volatile const unsigned long *a = addr + (nr >> 5);
61 return __raw_bit_test_asm(a, nr & 0x1f) != 0;
44} 62}
45 63
46/* 64static inline int test_and_set_bit(int nr, volatile unsigned long *addr)
47 * clear_bit() doesn't provide any barrier for the compiler. 65{
48 */ 66 volatile unsigned long *a = addr + (nr >> 5);
49#define smp_mb__before_clear_bit() barrier() 67 return __raw_bit_test_set_asm(a, nr & 0x1f);
50#define smp_mb__after_clear_bit() barrier() 68}
69
70static inline int test_and_clear_bit(int nr, volatile unsigned long *addr)
71{
72 volatile unsigned long *a = addr + (nr >> 5);
73 return __raw_bit_test_clear_asm(a, nr & 0x1f);
74}
75
76static inline int test_and_change_bit(int nr, volatile unsigned long *addr)
77{
78 volatile unsigned long *a = addr + (nr >> 5);
79 return __raw_bit_test_toggle_asm(a, nr & 0x1f);
80}
81
82#else /* !CONFIG_SMP */
83
84#include <asm/system.h> /* save_flags */
51 85
52static __inline__ void clear_bit(int nr, volatile unsigned long *addr) 86static inline void set_bit(int nr, volatile unsigned long *addr)
53{ 87{
54 int *a = (int *)addr; 88 int *a = (int *)addr;
55 int mask; 89 int mask;
56 unsigned long flags; 90 unsigned long flags;
57 a += nr >> 5; 91 a += nr >> 5;
58 mask = 1 << (nr & 0x1f); 92 mask = 1 << (nr & 0x1f);
59 local_irq_save(flags); 93 local_irq_save_hw(flags);
60 *a &= ~mask; 94 *a |= mask;
61 local_irq_restore(flags); 95 local_irq_restore_hw(flags);
62} 96}
63 97
64static __inline__ void __clear_bit(int nr, volatile unsigned long *addr) 98static inline void clear_bit(int nr, volatile unsigned long *addr)
65{ 99{
66 int *a = (int *)addr; 100 int *a = (int *)addr;
67 int mask; 101 int mask;
68 102 unsigned long flags;
69 a += nr >> 5; 103 a += nr >> 5;
70 mask = 1 << (nr & 0x1f); 104 mask = 1 << (nr & 0x1f);
105 local_irq_save_hw(flags);
71 *a &= ~mask; 106 *a &= ~mask;
107 local_irq_restore_hw(flags);
72} 108}
73 109
74static __inline__ void change_bit(int nr, volatile unsigned long *addr) 110static inline void change_bit(int nr, volatile unsigned long *addr)
75{ 111{
76 int mask, flags; 112 int mask, flags;
77 unsigned long *ADDR = (unsigned long *)addr; 113 unsigned long *ADDR = (unsigned long *)addr;
78 114
79 ADDR += nr >> 5; 115 ADDR += nr >> 5;
80 mask = 1 << (nr & 31); 116 mask = 1 << (nr & 31);
81 local_irq_save(flags); 117 local_irq_save_hw(flags);
82 *ADDR ^= mask;
83 local_irq_restore(flags);
84}
85
86static __inline__ void __change_bit(int nr, volatile unsigned long *addr)
87{
88 int mask;
89 unsigned long *ADDR = (unsigned long *)addr;
90
91 ADDR += nr >> 5;
92 mask = 1 << (nr & 31);
93 *ADDR ^= mask; 118 *ADDR ^= mask;
119 local_irq_restore_hw(flags);
94} 120}
95 121
96static __inline__ int test_and_set_bit(int nr, void *addr) 122static inline int test_and_set_bit(int nr, volatile unsigned long *addr)
97{ 123{
98 int mask, retval; 124 int mask, retval;
99 volatile unsigned int *a = (volatile unsigned int *)addr; 125 volatile unsigned int *a = (volatile unsigned int *)addr;
@@ -101,27 +127,31 @@ static __inline__ int test_and_set_bit(int nr, void *addr)
101 127
102 a += nr >> 5; 128 a += nr >> 5;
103 mask = 1 << (nr & 0x1f); 129 mask = 1 << (nr & 0x1f);
104 local_irq_save(flags); 130 local_irq_save_hw(flags);
105 retval = (mask & *a) != 0; 131 retval = (mask & *a) != 0;
106 *a |= mask; 132 *a |= mask;
107 local_irq_restore(flags); 133 local_irq_restore_hw(flags);
108 134
109 return retval; 135 return retval;
110} 136}
111 137
112static __inline__ int __test_and_set_bit(int nr, volatile unsigned long *addr) 138static inline int test_and_clear_bit(int nr, volatile unsigned long *addr)
113{ 139{
114 int mask, retval; 140 int mask, retval;
115 volatile unsigned int *a = (volatile unsigned int *)addr; 141 volatile unsigned int *a = (volatile unsigned int *)addr;
142 unsigned long flags;
116 143
117 a += nr >> 5; 144 a += nr >> 5;
118 mask = 1 << (nr & 0x1f); 145 mask = 1 << (nr & 0x1f);
146 local_irq_save_hw(flags);
119 retval = (mask & *a) != 0; 147 retval = (mask & *a) != 0;
120 *a |= mask; 148 *a &= ~mask;
149 local_irq_restore_hw(flags);
150
121 return retval; 151 return retval;
122} 152}
123 153
124static __inline__ int test_and_clear_bit(int nr, volatile unsigned long *addr) 154static inline int test_and_change_bit(int nr, volatile unsigned long *addr)
125{ 155{
126 int mask, retval; 156 int mask, retval;
127 volatile unsigned int *a = (volatile unsigned int *)addr; 157 volatile unsigned int *a = (volatile unsigned int *)addr;
@@ -129,15 +159,52 @@ static __inline__ int test_and_clear_bit(int nr, volatile unsigned long *addr)
129 159
130 a += nr >> 5; 160 a += nr >> 5;
131 mask = 1 << (nr & 0x1f); 161 mask = 1 << (nr & 0x1f);
132 local_irq_save(flags); 162 local_irq_save_hw(flags);
133 retval = (mask & *a) != 0; 163 retval = (mask & *a) != 0;
164 *a ^= mask;
165 local_irq_restore_hw(flags);
166 return retval;
167}
168
169#endif /* CONFIG_SMP */
170
171/*
172 * clear_bit() doesn't provide any barrier for the compiler.
173 */
174#define smp_mb__before_clear_bit() barrier()
175#define smp_mb__after_clear_bit() barrier()
176
177static inline void __set_bit(int nr, volatile unsigned long *addr)
178{
179 int *a = (int *)addr;
180 int mask;
181
182 a += nr >> 5;
183 mask = 1 << (nr & 0x1f);
184 *a |= mask;
185}
186
187static inline void __clear_bit(int nr, volatile unsigned long *addr)
188{
189 int *a = (int *)addr;
190 int mask;
191
192 a += nr >> 5;
193 mask = 1 << (nr & 0x1f);
134 *a &= ~mask; 194 *a &= ~mask;
135 local_irq_restore(flags); 195}
136 196
137 return retval; 197static inline void __change_bit(int nr, volatile unsigned long *addr)
198{
199 int mask;
200 unsigned long *ADDR = (unsigned long *)addr;
201
202 ADDR += nr >> 5;
203 mask = 1 << (nr & 31);
204 *ADDR ^= mask;
138} 205}
139 206
140static __inline__ int __test_and_clear_bit(int nr, volatile unsigned long *addr) 207static inline int __test_and_set_bit(int nr, volatile unsigned long *addr)
141{ 208{
142 int mask, retval; 209 int mask, retval;
143 volatile unsigned int *a = (volatile unsigned int *)addr; 210 volatile unsigned int *a = (volatile unsigned int *)addr;
@@ -145,26 +212,23 @@ static __inline__ int __test_and_clear_bit(int nr, volatile unsigned long *addr)
145 a += nr >> 5; 212 a += nr >> 5;
146 mask = 1 << (nr & 0x1f); 213 mask = 1 << (nr & 0x1f);
147 retval = (mask & *a) != 0; 214 retval = (mask & *a) != 0;
148 *a &= ~mask; 215 *a |= mask;
149 return retval; 216 return retval;
150} 217}
151 218
152static __inline__ int test_and_change_bit(int nr, volatile unsigned long *addr) 219static inline int __test_and_clear_bit(int nr, volatile unsigned long *addr)
153{ 220{
154 int mask, retval; 221 int mask, retval;
155 volatile unsigned int *a = (volatile unsigned int *)addr; 222 volatile unsigned int *a = (volatile unsigned int *)addr;
156 unsigned long flags;
157 223
158 a += nr >> 5; 224 a += nr >> 5;
159 mask = 1 << (nr & 0x1f); 225 mask = 1 << (nr & 0x1f);
160 local_irq_save(flags);
161 retval = (mask & *a) != 0; 226 retval = (mask & *a) != 0;
162 *a ^= mask; 227 *a &= ~mask;
163 local_irq_restore(flags);
164 return retval; 228 return retval;
165} 229}
166 230
167static __inline__ int __test_and_change_bit(int nr, 231static inline int __test_and_change_bit(int nr,
168 volatile unsigned long *addr) 232 volatile unsigned long *addr)
169{ 233{
170 int mask, retval; 234 int mask, retval;
@@ -177,16 +241,7 @@ static __inline__ int __test_and_change_bit(int nr,
177 return retval; 241 return retval;
178} 242}
179 243
180/* 244static inline int __test_bit(int nr, const void *addr)
181 * This routine doesn't need to be atomic.
182 */
183static __inline__ int __constant_test_bit(int nr, const void *addr)
184{
185 return ((1UL << (nr & 31)) &
186 (((const volatile unsigned int *)addr)[nr >> 5])) != 0;
187}
188
189static __inline__ int __test_bit(int nr, const void *addr)
190{ 245{
191 int *a = (int *)addr; 246 int *a = (int *)addr;
192 int mask; 247 int mask;
@@ -196,10 +251,16 @@ static __inline__ int __test_bit(int nr, const void *addr)
196 return ((mask & *a) != 0); 251 return ((mask & *a) != 0);
197} 252}
198 253
199#define test_bit(nr,addr) \ 254#ifndef CONFIG_SMP
200(__builtin_constant_p(nr) ? \ 255/*
201 __constant_test_bit((nr),(addr)) : \ 256 * This routine doesn't need irq save and restore ops in UP
202 __test_bit((nr),(addr))) 257 * context.
258 */
259static inline int test_bit(int nr, const void *addr)
260{
261 return __test_bit(nr, addr);
262}
263#endif
203 264
204#include <asm-generic/bitops/find.h> 265#include <asm-generic/bitops/find.h>
205#include <asm-generic/bitops/hweight.h> 266#include <asm-generic/bitops/hweight.h>
diff --git a/arch/blackfin/include/asm/blackfin.h b/arch/blackfin/include/asm/blackfin.h
index 8749b0e321ab..8bb2cb139756 100644
--- a/arch/blackfin/include/asm/blackfin.h
+++ b/arch/blackfin/include/asm/blackfin.h
@@ -6,11 +6,6 @@
6#ifndef _BLACKFIN_H_ 6#ifndef _BLACKFIN_H_
7#define _BLACKFIN_H_ 7#define _BLACKFIN_H_
8 8
9#define LO(con32) ((con32) & 0xFFFF)
10#define lo(con32) ((con32) & 0xFFFF)
11#define HI(con32) (((con32) >> 16) & 0xFFFF)
12#define hi(con32) (((con32) >> 16) & 0xFFFF)
13
14#include <mach/anomaly.h> 9#include <mach/anomaly.h>
15 10
16#ifndef __ASSEMBLY__ 11#ifndef __ASSEMBLY__
@@ -65,6 +60,11 @@ static inline void CSYNC(void)
65 60
66#else /* __ASSEMBLY__ */ 61#else /* __ASSEMBLY__ */
67 62
63#define LO(con32) ((con32) & 0xFFFF)
64#define lo(con32) ((con32) & 0xFFFF)
65#define HI(con32) (((con32) >> 16) & 0xFFFF)
66#define hi(con32) (((con32) >> 16) & 0xFFFF)
67
68/* SSYNC & CSYNC implementations for assembly files */ 68/* SSYNC & CSYNC implementations for assembly files */
69 69
70#define ssync(x) SSYNC(x) 70#define ssync(x) SSYNC(x)
diff --git a/arch/blackfin/include/asm/cache.h b/arch/blackfin/include/asm/cache.h
index 023d72133b5a..86637814cf25 100644
--- a/arch/blackfin/include/asm/cache.h
+++ b/arch/blackfin/include/asm/cache.h
@@ -12,6 +12,11 @@
12#define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT) 12#define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT)
13#define SMP_CACHE_BYTES L1_CACHE_BYTES 13#define SMP_CACHE_BYTES L1_CACHE_BYTES
14 14
15#ifdef CONFIG_SMP
16#define __cacheline_aligned
17#else
18#define ____cacheline_aligned
19
15/* 20/*
16 * Put cacheline_aliged data to L1 data memory 21 * Put cacheline_aliged data to L1 data memory
17 */ 22 */
@@ -21,9 +26,33 @@
21 __section__(".data_l1.cacheline_aligned"))) 26 __section__(".data_l1.cacheline_aligned")))
22#endif 27#endif
23 28
29#endif
30
24/* 31/*
25 * largest L1 which this arch supports 32 * largest L1 which this arch supports
26 */ 33 */
27#define L1_CACHE_SHIFT_MAX 5 34#define L1_CACHE_SHIFT_MAX 5
28 35
36#if defined(CONFIG_SMP) && \
37 !defined(CONFIG_BFIN_CACHE_COHERENT) && \
38 defined(CONFIG_BFIN_DCACHE)
39#define __ARCH_SYNC_CORE_DCACHE
40#ifndef __ASSEMBLY__
41asmlinkage void __raw_smp_mark_barrier_asm(void);
42asmlinkage void __raw_smp_check_barrier_asm(void);
43
44static inline void smp_mark_barrier(void)
45{
46 __raw_smp_mark_barrier_asm();
47}
48static inline void smp_check_barrier(void)
49{
50 __raw_smp_check_barrier_asm();
51}
52
53void resync_core_dcache(void);
54#endif
55#endif
56
57
29#endif 58#endif
diff --git a/arch/blackfin/include/asm/cacheflush.h b/arch/blackfin/include/asm/cacheflush.h
index 4403415583fa..1b040f5b4feb 100644
--- a/arch/blackfin/include/asm/cacheflush.h
+++ b/arch/blackfin/include/asm/cacheflush.h
@@ -35,6 +35,7 @@ extern void blackfin_icache_flush_range(unsigned long start_address, unsigned lo
35extern void blackfin_dcache_flush_range(unsigned long start_address, unsigned long end_address); 35extern void blackfin_dcache_flush_range(unsigned long start_address, unsigned long end_address);
36extern void blackfin_dcache_invalidate_range(unsigned long start_address, unsigned long end_address); 36extern void blackfin_dcache_invalidate_range(unsigned long start_address, unsigned long end_address);
37extern void blackfin_dflush_page(void *page); 37extern void blackfin_dflush_page(void *page);
38extern void blackfin_invalidate_entire_dcache(void);
38 39
39#define flush_dcache_mmap_lock(mapping) do { } while (0) 40#define flush_dcache_mmap_lock(mapping) do { } while (0)
40#define flush_dcache_mmap_unlock(mapping) do { } while (0) 41#define flush_dcache_mmap_unlock(mapping) do { } while (0)
@@ -44,12 +45,20 @@ extern void blackfin_dflush_page(void *page);
44#define flush_cache_vmap(start, end) do { } while (0) 45#define flush_cache_vmap(start, end) do { } while (0)
45#define flush_cache_vunmap(start, end) do { } while (0) 46#define flush_cache_vunmap(start, end) do { } while (0)
46 47
48#ifdef CONFIG_SMP
49#define flush_icache_range_others(start, end) \
50 smp_icache_flush_range_others((start), (end))
51#else
52#define flush_icache_range_others(start, end) do { } while (0)
53#endif
54
47static inline void flush_icache_range(unsigned start, unsigned end) 55static inline void flush_icache_range(unsigned start, unsigned end)
48{ 56{
49#if defined(CONFIG_BFIN_DCACHE) && defined(CONFIG_BFIN_ICACHE) 57#if defined(CONFIG_BFIN_DCACHE) && defined(CONFIG_BFIN_ICACHE)
50 58
51# if defined(CONFIG_BFIN_WT) 59# if defined(CONFIG_BFIN_WT)
52 blackfin_icache_flush_range((start), (end)); 60 blackfin_icache_flush_range((start), (end));
61 flush_icache_range_others(start, end);
53# else 62# else
54 blackfin_icache_dcache_flush_range((start), (end)); 63 blackfin_icache_dcache_flush_range((start), (end));
55# endif 64# endif
@@ -58,6 +67,7 @@ static inline void flush_icache_range(unsigned start, unsigned end)
58 67
59# if defined(CONFIG_BFIN_ICACHE) 68# if defined(CONFIG_BFIN_ICACHE)
60 blackfin_icache_flush_range((start), (end)); 69 blackfin_icache_flush_range((start), (end));
70 flush_icache_range_others(start, end);
61# endif 71# endif
62# if defined(CONFIG_BFIN_DCACHE) 72# if defined(CONFIG_BFIN_DCACHE)
63 blackfin_dcache_flush_range((start), (end)); 73 blackfin_dcache_flush_range((start), (end));
@@ -66,10 +76,12 @@ static inline void flush_icache_range(unsigned start, unsigned end)
66#endif 76#endif
67} 77}
68 78
69#define copy_to_user_page(vma, page, vaddr, dst, src, len) \ 79#define copy_to_user_page(vma, page, vaddr, dst, src, len) \
70do { memcpy(dst, src, len); \ 80do { memcpy(dst, src, len); \
71 flush_icache_range ((unsigned) (dst), (unsigned) (dst) + (len)); \ 81 flush_icache_range((unsigned) (dst), (unsigned) (dst) + (len)); \
82 flush_icache_range_others((unsigned long) (dst), (unsigned long) (dst) + (len));\
72} while (0) 83} while (0)
84
73#define copy_from_user_page(vma, page, vaddr, dst, src, len) memcpy(dst, src, len) 85#define copy_from_user_page(vma, page, vaddr, dst, src, len) memcpy(dst, src, len)
74 86
75#if defined(CONFIG_BFIN_DCACHE) 87#if defined(CONFIG_BFIN_DCACHE)
@@ -82,7 +94,7 @@ do { memcpy(dst, src, len); \
82# define flush_dcache_page(page) blackfin_dflush_page(page_address(page)) 94# define flush_dcache_page(page) blackfin_dflush_page(page_address(page))
83#else 95#else
84# define flush_dcache_range(start,end) do { } while (0) 96# define flush_dcache_range(start,end) do { } while (0)
85# define flush_dcache_page(page) do { } while (0) 97# define flush_dcache_page(page) do { } while (0)
86#endif 98#endif
87 99
88extern unsigned long reserved_mem_dcache_on; 100extern unsigned long reserved_mem_dcache_on;
diff --git a/arch/blackfin/include/asm/checksum.h b/arch/blackfin/include/asm/checksum.h
index 6f6af2b8e9e0..f67289a0d8d2 100644
--- a/arch/blackfin/include/asm/checksum.h
+++ b/arch/blackfin/include/asm/checksum.h
@@ -78,7 +78,8 @@ csum_tcpudp_nofold(__be32 saddr, __be32 daddr, unsigned short len,
78 "%0 = %0 + %4;\n\t" 78 "%0 = %0 + %4;\n\t"
79 "NOP;\n\t" 79 "NOP;\n\t"
80 : "=d" (sum) 80 : "=d" (sum)
81 : "d" (daddr), "d" (saddr), "d" ((ntohs(len)<<16)+proto*256), "d" (1), "0"(sum)); 81 : "d" (daddr), "d" (saddr), "d" ((ntohs(len)<<16)+proto*256), "d" (1), "0"(sum)
82 : "CC");
82 83
83 return (sum); 84 return (sum);
84} 85}
diff --git a/arch/blackfin/include/asm/context.S b/arch/blackfin/include/asm/context.S
index c0e630edfb9a..16561ab18b38 100644
--- a/arch/blackfin/include/asm/context.S
+++ b/arch/blackfin/include/asm/context.S
@@ -303,9 +303,14 @@
303 RETI = [sp++]; 303 RETI = [sp++];
304 RETS = [sp++]; 304 RETS = [sp++];
305 305
306 p0.h = _irq_flags; 306#ifdef CONFIG_SMP
307 p0.l = _irq_flags; 307 GET_PDA(p0, r0);
308 r0 = [p0 + PDA_IRQFLAGS];
309#else
310 p0.h = _bfin_irq_flags;
311 p0.l = _bfin_irq_flags;
308 r0 = [p0]; 312 r0 = [p0];
313#endif
309 sti r0; 314 sti r0;
310 315
311 sp += 4; /* Skip Reserved */ 316 sp += 4; /* Skip Reserved */
@@ -353,3 +358,41 @@
353 csync; 358 csync;
354.endm 359.endm
355 360
361.macro save_context_cplb
362 [--sp] = (R7:0, P5:0);
363 [--sp] = fp;
364
365 [--sp] = a0.x;
366 [--sp] = a0.w;
367 [--sp] = a1.x;
368 [--sp] = a1.w;
369
370 [--sp] = LC0;
371 [--sp] = LC1;
372 [--sp] = LT0;
373 [--sp] = LT1;
374 [--sp] = LB0;
375 [--sp] = LB1;
376
377 [--sp] = RETS;
378.endm
379
380.macro restore_context_cplb
381 RETS = [sp++];
382
383 LB1 = [sp++];
384 LB0 = [sp++];
385 LT1 = [sp++];
386 LT0 = [sp++];
387 LC1 = [sp++];
388 LC0 = [sp++];
389
390 a1.w = [sp++];
391 a1.x = [sp++];
392 a0.w = [sp++];
393 a0.x = [sp++];
394
395 fp = [sp++];
396
397 (R7:0, P5:0) = [SP++];
398.endm
diff --git a/arch/blackfin/include/asm/cplb-mpu.h b/arch/blackfin/include/asm/cplb-mpu.h
deleted file mode 100644
index 75c67b99d607..000000000000
--- a/arch/blackfin/include/asm/cplb-mpu.h
+++ /dev/null
@@ -1,61 +0,0 @@
1/*
2 * File: include/asm-blackfin/cplbinit.h
3 * Based on:
4 * Author:
5 *
6 * Created:
7 * Description:
8 *
9 * Modified:
10 * Copyright 2004-2006 Analog Devices Inc.
11 *
12 * Bugs: Enter bugs at http://blackfin.uclinux.org/
13 *
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 2 of the License, or
17 * (at your option) any later version.
18 *
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
23 *
24 * You should have received a copy of the GNU General Public License
25 * along with this program; if not, see the file COPYING, or write
26 * to the Free Software Foundation, Inc.,
27 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
28 */
29#ifndef __ASM_BFIN_CPLB_MPU_H
30#define __ASM_BFIN_CPLB_MPU_H
31
32struct cplb_entry {
33 unsigned long data, addr;
34};
35
36struct mem_region {
37 unsigned long start, end;
38 unsigned long dcplb_data;
39 unsigned long icplb_data;
40};
41
42extern struct cplb_entry dcplb_tbl[MAX_CPLBS];
43extern struct cplb_entry icplb_tbl[MAX_CPLBS];
44extern int first_switched_icplb;
45extern int first_mask_dcplb;
46extern int first_switched_dcplb;
47
48extern int nr_dcplb_miss, nr_icplb_miss, nr_icplb_supv_miss, nr_dcplb_prot;
49extern int nr_cplb_flush;
50
51extern int page_mask_order;
52extern int page_mask_nelts;
53
54extern unsigned long *current_rwx_mask;
55
56extern void flush_switched_cplbs(void);
57extern void set_mask_dcplbs(unsigned long *);
58
59extern void __noreturn panic_cplb_error(int seqstat, struct pt_regs *);
60
61#endif /* __ASM_BFIN_CPLB_MPU_H */
diff --git a/arch/blackfin/include/asm/cplb.h b/arch/blackfin/include/asm/cplb.h
index 9e8b4035fcec..ad566ff9ad16 100644
--- a/arch/blackfin/include/asm/cplb.h
+++ b/arch/blackfin/include/asm/cplb.h
@@ -30,7 +30,6 @@
30#ifndef _CPLB_H 30#ifndef _CPLB_H
31#define _CPLB_H 31#define _CPLB_H
32 32
33#include <asm/blackfin.h>
34#include <mach/anomaly.h> 33#include <mach/anomaly.h>
35 34
36#define SDRAM_IGENERIC (CPLB_L1_CHBL | CPLB_USER_RD | CPLB_VALID | CPLB_PORTPRIO) 35#define SDRAM_IGENERIC (CPLB_L1_CHBL | CPLB_USER_RD | CPLB_VALID | CPLB_PORTPRIO)
@@ -55,13 +54,24 @@
55#endif 54#endif
56 55
57#define L1_DMEMORY (CPLB_LOCK | CPLB_COMMON) 56#define L1_DMEMORY (CPLB_LOCK | CPLB_COMMON)
57
58#ifdef CONFIG_SMP
59#define L2_ATTR (INITIAL_T | I_CPLB | D_CPLB)
60#define L2_IMEMORY (CPLB_COMMON | CPLB_LOCK)
61#define L2_DMEMORY (CPLB_COMMON | CPLB_LOCK)
62
63#else
58#ifdef CONFIG_BFIN_L2_CACHEABLE 64#ifdef CONFIG_BFIN_L2_CACHEABLE
59#define L2_IMEMORY (SDRAM_IGENERIC) 65#define L2_IMEMORY (SDRAM_IGENERIC)
60#define L2_DMEMORY (SDRAM_DGENERIC) 66#define L2_DMEMORY (SDRAM_DGENERIC)
61#else 67#else
62#define L2_IMEMORY (CPLB_COMMON) 68#define L2_IMEMORY (CPLB_COMMON)
63#define L2_DMEMORY (CPLB_COMMON) 69#define L2_DMEMORY (CPLB_COMMON)
64#endif 70#endif /* CONFIG_BFIN_L2_CACHEABLE */
71
72#define L2_ATTR (INITIAL_T | SWITCH_T | I_CPLB | D_CPLB)
73#endif /* CONFIG_SMP */
74
65#define SDRAM_DNON_CHBL (CPLB_COMMON) 75#define SDRAM_DNON_CHBL (CPLB_COMMON)
66#define SDRAM_EBIU (CPLB_COMMON) 76#define SDRAM_EBIU (CPLB_COMMON)
67#define SDRAM_OOPS (CPLB_VALID | ANOMALY_05000158_WORKAROUND | CPLB_LOCK | CPLB_DIRTY) 77#define SDRAM_OOPS (CPLB_VALID | ANOMALY_05000158_WORKAROUND | CPLB_LOCK | CPLB_DIRTY)
@@ -71,14 +81,7 @@
71#define SIZE_1M 0x00100000 /* 1M */ 81#define SIZE_1M 0x00100000 /* 1M */
72#define SIZE_4M 0x00400000 /* 4M */ 82#define SIZE_4M 0x00400000 /* 4M */
73 83
74#ifdef CONFIG_MPU
75#define MAX_CPLBS 16 84#define MAX_CPLBS 16
76#else
77#define MAX_CPLBS (16 * 2)
78#endif
79
80#define ASYNC_MEMORY_CPLB_COVERAGE ((ASYNC_BANK0_SIZE + ASYNC_BANK1_SIZE + \
81 ASYNC_BANK2_SIZE + ASYNC_BANK3_SIZE) / SIZE_4M)
82 85
83#define CPLB_ENABLE_ICACHE_P 0 86#define CPLB_ENABLE_ICACHE_P 0
84#define CPLB_ENABLE_DCACHE_P 1 87#define CPLB_ENABLE_DCACHE_P 1
@@ -113,4 +116,8 @@
113#define CPLB_INOCACHE CPLB_USER_RD | CPLB_VALID 116#define CPLB_INOCACHE CPLB_USER_RD | CPLB_VALID
114#define CPLB_IDOCACHE CPLB_INOCACHE | CPLB_L1_CHBL 117#define CPLB_IDOCACHE CPLB_INOCACHE | CPLB_L1_CHBL
115 118
119#define FAULT_RW (1 << 16)
120#define FAULT_USERSUPV (1 << 17)
121#define FAULT_CPLBBITS 0x0000ffff
122
116#endif /* _CPLB_H */ 123#endif /* _CPLB_H */
diff --git a/arch/blackfin/include/asm/cplbinit.h b/arch/blackfin/include/asm/cplbinit.h
index f845b41147ba..05b14a631d0c 100644
--- a/arch/blackfin/include/asm/cplbinit.h
+++ b/arch/blackfin/include/asm/cplbinit.h
@@ -32,61 +32,56 @@
32 32
33#include <asm/blackfin.h> 33#include <asm/blackfin.h>
34#include <asm/cplb.h> 34#include <asm/cplb.h>
35#include <linux/threads.h>
35 36
36#ifdef CONFIG_MPU 37#ifdef CONFIG_CPLB_SWITCH_TAB_L1
37 38# define PDT_ATTR __attribute__((l1_data))
38#include <asm/cplb-mpu.h>
39
40#else 39#else
40# define PDT_ATTR
41#endif
41 42
42#define INITIAL_T 0x1 43struct cplb_entry {
43#define SWITCH_T 0x2 44 unsigned long data, addr;
44#define I_CPLB 0x4
45#define D_CPLB 0x8
46
47#define IN_KERNEL 1
48
49enum
50{ZERO_P, L1I_MEM, L1D_MEM, SDRAM_KERN , SDRAM_RAM_MTD, SDRAM_DMAZ, RES_MEM, ASYNC_MEM, L2_MEM};
51
52struct cplb_desc {
53 u32 start; /* start address */
54 u32 end; /* end address */
55 u32 psize; /* prefered size if any otherwise 1MB or 4MB*/
56 u16 attr;/* attributes */
57 u16 i_conf;/* I-CPLB DATA */
58 u16 d_conf;/* D-CPLB DATA */
59 u16 valid;/* valid */
60 const s8 name[30];/* name */
61}; 45};
62 46
63struct cplb_tab { 47struct cplb_boundary {
64 u_long *tab; 48 unsigned long eaddr; /* End of this region. */
65 u16 pos; 49 unsigned long data; /* CPLB data value. */
66 u16 size;
67}; 50};
68 51
69extern u_long icplb_table[]; 52extern struct cplb_boundary dcplb_bounds[];
70extern u_long dcplb_table[]; 53extern struct cplb_boundary icplb_bounds[];
54extern int dcplb_nr_bounds, icplb_nr_bounds;
71 55
72/* Till here we are discussing about the static memory management model. 56extern struct cplb_entry dcplb_tbl[NR_CPUS][MAX_CPLBS];
73 * However, the operating envoronments commonly define more CPLB 57extern struct cplb_entry icplb_tbl[NR_CPUS][MAX_CPLBS];
74 * descriptors to cover the entire addressable memory than will fit into 58extern int first_switched_icplb;
75 * the available on-chip 16 CPLB MMRs. When this happens, the below table 59extern int first_switched_dcplb;
76 * will be used which will hold all the potentially required CPLB descriptors
77 *
78 * This is how Page descriptor Table is implemented in uClinux/Blackfin.
79 */
80 60
81extern u_long ipdt_table[]; 61extern int nr_dcplb_miss[], nr_icplb_miss[], nr_icplb_supv_miss[];
82extern u_long dpdt_table[]; 62extern int nr_dcplb_prot[], nr_cplb_flush[];
83#ifdef CONFIG_CPLB_INFO 63
84extern u_long ipdt_swapcount_table[]; 64#ifdef CONFIG_MPU
85extern u_long dpdt_swapcount_table[]; 65
86#endif 66extern int first_mask_dcplb;
67
68extern int page_mask_order;
69extern int page_mask_nelts;
70
71extern unsigned long *current_rwx_mask[NR_CPUS];
72
73extern void flush_switched_cplbs(unsigned int);
74extern void set_mask_dcplbs(unsigned long *, unsigned int);
75
76extern void __noreturn panic_cplb_error(int seqstat, struct pt_regs *);
87 77
88#endif /* CONFIG_MPU */ 78#endif /* CONFIG_MPU */
89 79
90extern void generate_cplb_tables(void); 80extern void bfin_icache_init(struct cplb_entry *icplb_tbl);
81extern void bfin_dcache_init(struct cplb_entry *icplb_tbl);
91 82
83#if defined(CONFIG_BFIN_DCACHE) || defined(CONFIG_BFIN_ICACHE)
84extern void generate_cplb_tables_all(void);
85extern void generate_cplb_tables_cpu(unsigned int cpu);
86#endif
92#endif 87#endif
diff --git a/arch/blackfin/include/asm/cpu.h b/arch/blackfin/include/asm/cpu.h
new file mode 100644
index 000000000000..c2594ef877f6
--- /dev/null
+++ b/arch/blackfin/include/asm/cpu.h
@@ -0,0 +1,41 @@
1/*
2 * File: arch/blackfin/include/asm/cpu.h.
3 * Author: Philippe Gerum <rpm@xenomai.org>
4 *
5 * Copyright 2007 Analog Devices Inc.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, see the file COPYING, or write
19 * to the Free Software Foundation, Inc.,
20 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21 */
22
23#ifndef __ASM_BLACKFIN_CPU_H
24#define __ASM_BLACKFIN_CPU_H
25
26#include <linux/percpu.h>
27
28struct task_struct;
29
30struct blackfin_cpudata {
31 struct cpu cpu;
32 struct task_struct *idle;
33 unsigned int imemctl;
34 unsigned int dmemctl;
35 unsigned long loops_per_jiffy;
36 unsigned long dcache_invld_count;
37};
38
39DECLARE_PER_CPU(struct blackfin_cpudata, cpu_data);
40
41#endif
diff --git a/arch/blackfin/include/asm/dma.h b/arch/blackfin/include/asm/dma.h
index 6509733bb0f6..e4f7b8043f02 100644
--- a/arch/blackfin/include/asm/dma.h
+++ b/arch/blackfin/include/asm/dma.h
@@ -1,44 +1,17 @@
1/* 1/*
2 * File: include/asm-blackfin/simple_bf533_dma.h 2 * dma.h - Blackfin DMA defines/structures/etc...
3 * Based on: none - original work
4 * Author: LG Soft India
5 * Copyright (C) 2004-2005 Analog Devices Inc.
6 * Created: Tue Sep 21 2004
7 * Description: This file contains the major Data structures and constants
8 * used for DMA Implementation in BF533
9 * Modified:
10 * 3 *
11 * Bugs: Enter bugs at http://blackfin.uclinux.org/ 4 * Copyright 2004-2008 Analog Devices Inc.
12 * 5 * Licensed under the GPL-2 or later.
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 2, or (at your option)
16 * any later version.
17 *
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
22 *
23 * You should have received a copy of the GNU General Public License
24 * along with this program; see the file COPYING.
25 * If not, write to the Free Software Foundation,
26 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
27 */ 6 */
28 7
29#ifndef _BLACKFIN_DMA_H_ 8#ifndef _BLACKFIN_DMA_H_
30#define _BLACKFIN_DMA_H_ 9#define _BLACKFIN_DMA_H_
31 10
32#include <asm/io.h>
33#include <linux/slab.h>
34#include <asm/irq.h>
35#include <asm/signal.h>
36
37#include <linux/kernel.h>
38#include <mach/dma.h>
39#include <linux/mm.h>
40#include <linux/interrupt.h> 11#include <linux/interrupt.h>
12#include <mach/dma.h>
41#include <asm/blackfin.h> 13#include <asm/blackfin.h>
14#include <asm/page.h>
42 15
43#define MAX_DMA_ADDRESS PAGE_OFFSET 16#define MAX_DMA_ADDRESS PAGE_OFFSET
44 17
@@ -79,7 +52,7 @@ enum dma_chan_status {
79#define DMA_SYNC_RESTART 1 52#define DMA_SYNC_RESTART 1
80 53
81struct dmasg { 54struct dmasg {
82 unsigned long next_desc_addr; 55 void *next_desc_addr;
83 unsigned long start_addr; 56 unsigned long start_addr;
84 unsigned short cfg; 57 unsigned short cfg;
85 unsigned short x_count; 58 unsigned short x_count;
@@ -89,7 +62,7 @@ struct dmasg {
89} __attribute__((packed)); 62} __attribute__((packed));
90 63
91struct dma_register { 64struct dma_register {
92 unsigned long next_desc_ptr; /* DMA Next Descriptor Pointer register */ 65 void *next_desc_ptr; /* DMA Next Descriptor Pointer register */
93 unsigned long start_addr; /* DMA Start address register */ 66 unsigned long start_addr; /* DMA Start address register */
94 67
95 unsigned short cfg; /* DMA Configuration register */ 68 unsigned short cfg; /* DMA Configuration register */
@@ -109,7 +82,7 @@ struct dma_register {
109 short y_modify; /* DMA y_modify register */ 82 short y_modify; /* DMA y_modify register */
110 unsigned short dummy5; 83 unsigned short dummy5;
111 84
112 unsigned long curr_desc_ptr; /* DMA Current Descriptor Pointer 85 void *curr_desc_ptr; /* DMA Current Descriptor Pointer
113 register */ 86 register */
114 unsigned long curr_addr_ptr; /* DMA Current Address Pointer 87 unsigned long curr_addr_ptr; /* DMA Current Address Pointer
115 register */ 88 register */
@@ -131,19 +104,15 @@ struct dma_register {
131 104
132}; 105};
133 106
134typedef irqreturn_t(*dma_interrupt_t) (int irq, void *dev_id); 107struct mutex;
135
136struct dma_channel { 108struct dma_channel {
137 struct mutex dmalock; 109 struct mutex dmalock;
138 char *device_id; 110 const char *device_id;
139 enum dma_chan_status chan_status; 111 enum dma_chan_status chan_status;
140 struct dma_register *regs; 112 volatile struct dma_register *regs;
141 struct dmasg *sg; /* large mode descriptor */ 113 struct dmasg *sg; /* large mode descriptor */
142 unsigned int ctrl_num; /* controller number */ 114 unsigned int irq;
143 dma_interrupt_t irq_callback;
144 void *data; 115 void *data;
145 unsigned int dma_enable_flag;
146 unsigned int loopback_flag;
147#ifdef CONFIG_PM 116#ifdef CONFIG_PM
148 unsigned short saved_peripheral_map; 117 unsigned short saved_peripheral_map;
149#endif 118#endif
@@ -157,49 +126,132 @@ void blackfin_dma_resume(void);
157/******************************************************************************* 126/*******************************************************************************
158* DMA API's 127* DMA API's
159*******************************************************************************/ 128*******************************************************************************/
160/* functions to set register mode */ 129extern struct dma_channel dma_ch[MAX_DMA_CHANNELS];
161void set_dma_start_addr(unsigned int channel, unsigned long addr); 130extern struct dma_register *dma_io_base_addr[MAX_DMA_CHANNELS];
162void set_dma_next_desc_addr(unsigned int channel, unsigned long addr); 131extern int channel2irq(unsigned int channel);
163void set_dma_curr_desc_addr(unsigned int channel, unsigned long addr); 132
164void set_dma_x_count(unsigned int channel, unsigned short x_count); 133static inline void set_dma_start_addr(unsigned int channel, unsigned long addr)
165void set_dma_x_modify(unsigned int channel, short x_modify); 134{
166void set_dma_y_count(unsigned int channel, unsigned short y_count); 135 dma_ch[channel].regs->start_addr = addr;
167void set_dma_y_modify(unsigned int channel, short y_modify); 136}
168void set_dma_config(unsigned int channel, unsigned short config); 137static inline void set_dma_next_desc_addr(unsigned int channel, void *addr)
169unsigned short set_bfin_dma_config(char direction, char flow_mode, 138{
170 char intr_mode, char dma_mode, char width, 139 dma_ch[channel].regs->next_desc_ptr = addr;
171 char syncmode); 140}
172void set_dma_curr_addr(unsigned int channel, unsigned long addr); 141static inline void set_dma_curr_desc_addr(unsigned int channel, void *addr)
173 142{
174/* get curr status for polling */ 143 dma_ch[channel].regs->curr_desc_ptr = addr;
175unsigned short get_dma_curr_irqstat(unsigned int channel); 144}
176unsigned short get_dma_curr_xcount(unsigned int channel); 145static inline void set_dma_x_count(unsigned int channel, unsigned short x_count)
177unsigned short get_dma_curr_ycount(unsigned int channel); 146{
178unsigned long get_dma_next_desc_ptr(unsigned int channel); 147 dma_ch[channel].regs->x_count = x_count;
179unsigned long get_dma_curr_desc_ptr(unsigned int channel); 148}
180unsigned long get_dma_curr_addr(unsigned int channel); 149static inline void set_dma_y_count(unsigned int channel, unsigned short y_count)
181 150{
182/* set large DMA mode descriptor */ 151 dma_ch[channel].regs->y_count = y_count;
183void set_dma_sg(unsigned int channel, struct dmasg *sg, int nr_sg); 152}
184 153static inline void set_dma_x_modify(unsigned int channel, short x_modify)
185/* check if current channel is in use */ 154{
186int dma_channel_active(unsigned int channel); 155 dma_ch[channel].regs->x_modify = x_modify;
187 156}
188/* common functions must be called in any mode */ 157static inline void set_dma_y_modify(unsigned int channel, short y_modify)
158{
159 dma_ch[channel].regs->y_modify = y_modify;
160}
161static inline void set_dma_config(unsigned int channel, unsigned short config)
162{
163 dma_ch[channel].regs->cfg = config;
164}
165static inline void set_dma_curr_addr(unsigned int channel, unsigned long addr)
166{
167 dma_ch[channel].regs->curr_addr_ptr = addr;
168}
169
170static inline unsigned short
171set_bfin_dma_config(char direction, char flow_mode,
172 char intr_mode, char dma_mode, char width, char syncmode)
173{
174 return (direction << 1) | (width << 2) | (dma_mode << 4) |
175 (intr_mode << 6) | (flow_mode << 12) | (syncmode << 5);
176}
177
178static inline unsigned short get_dma_curr_irqstat(unsigned int channel)
179{
180 return dma_ch[channel].regs->irq_status;
181}
182static inline unsigned short get_dma_curr_xcount(unsigned int channel)
183{
184 return dma_ch[channel].regs->curr_x_count;
185}
186static inline unsigned short get_dma_curr_ycount(unsigned int channel)
187{
188 return dma_ch[channel].regs->curr_y_count;
189}
190static inline void *get_dma_next_desc_ptr(unsigned int channel)
191{
192 return dma_ch[channel].regs->next_desc_ptr;
193}
194static inline void *get_dma_curr_desc_ptr(unsigned int channel)
195{
196 return dma_ch[channel].regs->curr_desc_ptr;
197}
198static inline unsigned short get_dma_config(unsigned int channel)
199{
200 return dma_ch[channel].regs->cfg;
201}
202static inline unsigned long get_dma_curr_addr(unsigned int channel)
203{
204 return dma_ch[channel].regs->curr_addr_ptr;
205}
206
207static inline void set_dma_sg(unsigned int channel, struct dmasg *sg, int ndsize)
208{
209 dma_ch[channel].regs->cfg =
210 (dma_ch[channel].regs->cfg & ~(0xf << 8)) |
211 ((ndsize & 0xf) << 8);
212 dma_ch[channel].regs->next_desc_ptr = sg;
213}
214
215static inline int dma_channel_active(unsigned int channel)
216{
217 if (dma_ch[channel].chan_status == DMA_CHANNEL_FREE)
218 return 0;
219 else
220 return 1;
221}
222
223static inline void disable_dma(unsigned int channel)
224{
225 dma_ch[channel].regs->cfg &= ~DMAEN;
226 SSYNC();
227 dma_ch[channel].chan_status = DMA_CHANNEL_REQUESTED;
228}
229static inline void enable_dma(unsigned int channel)
230{
231 dma_ch[channel].regs->curr_x_count = 0;
232 dma_ch[channel].regs->curr_y_count = 0;
233 dma_ch[channel].regs->cfg |= DMAEN;
234 dma_ch[channel].chan_status = DMA_CHANNEL_ENABLED;
235}
189void free_dma(unsigned int channel); 236void free_dma(unsigned int channel);
190int dma_channel_active(unsigned int channel); /* check if a channel is in use */ 237int request_dma(unsigned int channel, const char *device_id);
191void disable_dma(unsigned int channel); 238int set_dma_callback(unsigned int channel, irq_handler_t callback, void *data);
192void enable_dma(unsigned int channel); 239
193int request_dma(unsigned int channel, char *device_id); 240static inline void dma_disable_irq(unsigned int channel)
194int set_dma_callback(unsigned int channel, dma_interrupt_t callback, 241{
195 void *data); 242 disable_irq(dma_ch[channel].irq);
196void dma_disable_irq(unsigned int channel); 243}
197void dma_enable_irq(unsigned int channel); 244static inline void dma_enable_irq(unsigned int channel)
198void clear_dma_irqstat(unsigned int channel); 245{
246 enable_irq(dma_ch[channel].irq);
247}
248static inline void clear_dma_irqstat(unsigned int channel)
249{
250 dma_ch[channel].regs->irq_status = DMA_DONE | DMA_ERR;
251}
252
199void *dma_memcpy(void *dest, const void *src, size_t count); 253void *dma_memcpy(void *dest, const void *src, size_t count);
200void *safe_dma_memcpy(void *dest, const void *src, size_t count); 254void *safe_dma_memcpy(void *dest, const void *src, size_t count);
201 255void blackfin_dma_early_init(void);
202extern int channel2irq(unsigned int channel);
203extern struct dma_register *dma_io_base_addr[MAX_BLACKFIN_DMA_CHANNEL];
204 256
205#endif 257#endif
diff --git a/arch/blackfin/include/asm/entry.h b/arch/blackfin/include/asm/entry.h
index c4f721e0d00d..b30a2968e274 100644
--- a/arch/blackfin/include/asm/entry.h
+++ b/arch/blackfin/include/asm/entry.h
@@ -27,6 +27,14 @@
27#define SAVE_ALL_SYS save_context_no_interrupts 27#define SAVE_ALL_SYS save_context_no_interrupts
28/* This is used for all normal interrupts. It saves a minimum of registers 28/* This is used for all normal interrupts. It saves a minimum of registers
29 to the stack, loads the IRQ number, and jumps to common code. */ 29 to the stack, loads the IRQ number, and jumps to common code. */
30#ifdef CONFIG_IPIPE
31# define LOAD_IPIPE_IPEND \
32 P0.l = lo(IPEND); \
33 P0.h = hi(IPEND); \
34 R1 = [P0];
35#else
36# define LOAD_IPIPE_IPEND
37#endif
30#define INTERRUPT_ENTRY(N) \ 38#define INTERRUPT_ENTRY(N) \
31 [--sp] = SYSCFG; \ 39 [--sp] = SYSCFG; \
32 \ 40 \
@@ -34,6 +42,7 @@
34 [--sp] = R0; /*orig_r0*/ \ 42 [--sp] = R0; /*orig_r0*/ \
35 [--sp] = (R7:0,P5:0); \ 43 [--sp] = (R7:0,P5:0); \
36 R0 = (N); \ 44 R0 = (N); \
45 LOAD_IPIPE_IPEND \
37 jump __common_int_entry; 46 jump __common_int_entry;
38 47
39/* For timer interrupts, we need to save IPEND, since the user_mode 48/* For timer interrupts, we need to save IPEND, since the user_mode
@@ -53,9 +62,11 @@
53/* This one pushes RETI without using CLI. Interrupts are enabled. */ 62/* This one pushes RETI without using CLI. Interrupts are enabled. */
54#define SAVE_CONTEXT_SYSCALL save_context_syscall 63#define SAVE_CONTEXT_SYSCALL save_context_syscall
55#define SAVE_CONTEXT save_context_with_interrupts 64#define SAVE_CONTEXT save_context_with_interrupts
65#define SAVE_CONTEXT_CPLB save_context_cplb
56 66
57#define RESTORE_ALL_SYS restore_context_no_interrupts 67#define RESTORE_ALL_SYS restore_context_no_interrupts
58#define RESTORE_CONTEXT restore_context_with_interrupts 68#define RESTORE_CONTEXT restore_context_with_interrupts
69#define RESTORE_CONTEXT_CPLB restore_context_cplb
59 70
60#endif /* __ASSEMBLY__ */ 71#endif /* __ASSEMBLY__ */
61#endif /* __BFIN_ENTRY_H */ 72#endif /* __BFIN_ENTRY_H */
diff --git a/arch/blackfin/include/asm/gpio.h b/arch/blackfin/include/asm/gpio.h
index ad33ac271fd9..9477d82fcad2 100644
--- a/arch/blackfin/include/asm/gpio.h
+++ b/arch/blackfin/include/asm/gpio.h
@@ -84,11 +84,14 @@
84#ifndef __ARCH_BLACKFIN_GPIO_H__ 84#ifndef __ARCH_BLACKFIN_GPIO_H__
85#define __ARCH_BLACKFIN_GPIO_H__ 85#define __ARCH_BLACKFIN_GPIO_H__
86 86
87#define gpio_bank(x) ((x) >> 4) 87#define gpio_bank(x) ((x) >> 4)
88#define gpio_bit(x) (1<<((x) & 0xF)) 88#define gpio_bit(x) (1<<((x) & 0xF))
89#define gpio_sub_n(x) ((x) & 0xF) 89#define gpio_sub_n(x) ((x) & 0xF)
90 90
91#define GPIO_BANKSIZE 16 91#define GPIO_BANKSIZE 16
92#define GPIO_BANK_NUM DIV_ROUND_UP(MAX_BLACKFIN_GPIOS, GPIO_BANKSIZE)
93
94#include <mach/gpio.h>
92 95
93#define GPIO_0 0 96#define GPIO_0 0
94#define GPIO_1 1 97#define GPIO_1 1
@@ -139,151 +142,9 @@
139#define GPIO_46 46 142#define GPIO_46 46
140#define GPIO_47 47 143#define GPIO_47 47
141 144
142
143#define PERIPHERAL_USAGE 1 145#define PERIPHERAL_USAGE 1
144#define GPIO_USAGE 0 146#define GPIO_USAGE 0
145 147
146#ifdef BF533_FAMILY
147#define MAX_BLACKFIN_GPIOS 16
148
149#define GPIO_PF0 0
150#define GPIO_PF1 1
151#define GPIO_PF2 2
152#define GPIO_PF3 3
153#define GPIO_PF4 4
154#define GPIO_PF5 5
155#define GPIO_PF6 6
156#define GPIO_PF7 7
157#define GPIO_PF8 8
158#define GPIO_PF9 9
159#define GPIO_PF10 10
160#define GPIO_PF11 11
161#define GPIO_PF12 12
162#define GPIO_PF13 13
163#define GPIO_PF14 14
164#define GPIO_PF15 15
165
166#endif
167
168#if defined(BF527_FAMILY) || defined(BF537_FAMILY)
169#define MAX_BLACKFIN_GPIOS 48
170
171#define GPIO_PF0 0
172#define GPIO_PF1 1
173#define GPIO_PF2 2
174#define GPIO_PF3 3
175#define GPIO_PF4 4
176#define GPIO_PF5 5
177#define GPIO_PF6 6
178#define GPIO_PF7 7
179#define GPIO_PF8 8
180#define GPIO_PF9 9
181#define GPIO_PF10 10
182#define GPIO_PF11 11
183#define GPIO_PF12 12
184#define GPIO_PF13 13
185#define GPIO_PF14 14
186#define GPIO_PF15 15
187#define GPIO_PG0 16
188#define GPIO_PG1 17
189#define GPIO_PG2 18
190#define GPIO_PG3 19
191#define GPIO_PG4 20
192#define GPIO_PG5 21
193#define GPIO_PG6 22
194#define GPIO_PG7 23
195#define GPIO_PG8 24
196#define GPIO_PG9 25
197#define GPIO_PG10 26
198#define GPIO_PG11 27
199#define GPIO_PG12 28
200#define GPIO_PG13 29
201#define GPIO_PG14 30
202#define GPIO_PG15 31
203#define GPIO_PH0 32
204#define GPIO_PH1 33
205#define GPIO_PH2 34
206#define GPIO_PH3 35
207#define GPIO_PH4 36
208#define GPIO_PH5 37
209#define GPIO_PH6 38
210#define GPIO_PH7 39
211#define GPIO_PH8 40
212#define GPIO_PH9 41
213#define GPIO_PH10 42
214#define GPIO_PH11 43
215#define GPIO_PH12 44
216#define GPIO_PH13 45
217#define GPIO_PH14 46
218#define GPIO_PH15 47
219
220#define PORT_F GPIO_PF0
221#define PORT_G GPIO_PG0
222#define PORT_H GPIO_PH0
223
224#endif
225
226#ifdef BF548_FAMILY
227#include <mach/gpio.h>
228#endif
229
230#ifdef BF561_FAMILY
231#define MAX_BLACKFIN_GPIOS 48
232
233#define GPIO_PF0 0
234#define GPIO_PF1 1
235#define GPIO_PF2 2
236#define GPIO_PF3 3
237#define GPIO_PF4 4
238#define GPIO_PF5 5
239#define GPIO_PF6 6
240#define GPIO_PF7 7
241#define GPIO_PF8 8
242#define GPIO_PF9 9
243#define GPIO_PF10 10
244#define GPIO_PF11 11
245#define GPIO_PF12 12
246#define GPIO_PF13 13
247#define GPIO_PF14 14
248#define GPIO_PF15 15
249#define GPIO_PF16 16
250#define GPIO_PF17 17
251#define GPIO_PF18 18
252#define GPIO_PF19 19
253#define GPIO_PF20 20
254#define GPIO_PF21 21
255#define GPIO_PF22 22
256#define GPIO_PF23 23
257#define GPIO_PF24 24
258#define GPIO_PF25 25
259#define GPIO_PF26 26
260#define GPIO_PF27 27
261#define GPIO_PF28 28
262#define GPIO_PF29 29
263#define GPIO_PF30 30
264#define GPIO_PF31 31
265#define GPIO_PF32 32
266#define GPIO_PF33 33
267#define GPIO_PF34 34
268#define GPIO_PF35 35
269#define GPIO_PF36 36
270#define GPIO_PF37 37
271#define GPIO_PF38 38
272#define GPIO_PF39 39
273#define GPIO_PF40 40
274#define GPIO_PF41 41
275#define GPIO_PF42 42
276#define GPIO_PF43 43
277#define GPIO_PF44 44
278#define GPIO_PF45 45
279#define GPIO_PF46 46
280#define GPIO_PF47 47
281
282#define PORT_FIO0 GPIO_0
283#define PORT_FIO1 GPIO_16
284#define PORT_FIO2 GPIO_32
285#endif
286
287#ifndef __ASSEMBLY__ 148#ifndef __ASSEMBLY__
288 149
289/*********************************************************** 150/***********************************************************
@@ -425,20 +286,77 @@ struct gpio_port_s {
425* MODIFICATION HISTORY : 286* MODIFICATION HISTORY :
426**************************************************************/ 287**************************************************************/
427 288
428int gpio_request(unsigned, const char *); 289int bfin_gpio_request(unsigned gpio, const char *label);
429void gpio_free(unsigned); 290void bfin_gpio_free(unsigned gpio);
430 291int bfin_gpio_irq_request(unsigned gpio, const char *label);
431void gpio_set_value(unsigned gpio, int arg); 292void bfin_gpio_irq_free(unsigned gpio);
432int gpio_get_value(unsigned gpio); 293int bfin_gpio_direction_input(unsigned gpio);
294int bfin_gpio_direction_output(unsigned gpio, int value);
295int bfin_gpio_get_value(unsigned gpio);
296void bfin_gpio_set_value(unsigned gpio, int value);
433 297
434#ifndef BF548_FAMILY 298#ifndef BF548_FAMILY
435#define gpio_set_value(gpio, value) set_gpio_data(gpio, value) 299#define bfin_gpio_set_value(gpio, value) set_gpio_data(gpio, value)
436#endif 300#endif
437 301
438int gpio_direction_input(unsigned gpio); 302#ifdef CONFIG_GPIOLIB
439int gpio_direction_output(unsigned gpio, int value); 303#include <asm-generic/gpio.h> /* cansleep wrappers */
304
305static inline int gpio_get_value(unsigned int gpio)
306{
307 if (gpio < MAX_BLACKFIN_GPIOS)
308 return bfin_gpio_get_value(gpio);
309 else
310 return __gpio_get_value(gpio);
311}
312
313static inline void gpio_set_value(unsigned int gpio, int value)
314{
315 if (gpio < MAX_BLACKFIN_GPIOS)
316 bfin_gpio_set_value(gpio, value);
317 else
318 __gpio_set_value(gpio, value);
319}
320
321static inline int gpio_cansleep(unsigned int gpio)
322{
323 return __gpio_cansleep(gpio);
324}
325
326#else /* !CONFIG_GPIOLIB */
327
328static inline int gpio_request(unsigned gpio, const char *label)
329{
330 return bfin_gpio_request(gpio, label);
331}
332
333static inline void gpio_free(unsigned gpio)
334{
335 return bfin_gpio_free(gpio);
336}
337
338static inline int gpio_direction_input(unsigned gpio)
339{
340 return bfin_gpio_direction_input(gpio);
341}
342
343static inline int gpio_direction_output(unsigned gpio, int value)
344{
345 return bfin_gpio_direction_output(gpio, value);
346}
347
348static inline int gpio_get_value(unsigned gpio)
349{
350 return bfin_gpio_get_value(gpio);
351}
352
353static inline void gpio_set_value(unsigned gpio, int value)
354{
355 return bfin_gpio_set_value(gpio, value);
356}
440 357
441#include <asm-generic/gpio.h> /* cansleep wrappers */ 358#include <asm-generic/gpio.h> /* cansleep wrappers */
359#endif /* !CONFIG_GPIOLIB */
442#include <asm/irq.h> 360#include <asm/irq.h>
443 361
444static inline int gpio_to_irq(unsigned gpio) 362static inline int gpio_to_irq(unsigned gpio)
diff --git a/arch/blackfin/include/asm/hardirq.h b/arch/blackfin/include/asm/hardirq.h
index b6b19f1b9dab..717181a1749b 100644
--- a/arch/blackfin/include/asm/hardirq.h
+++ b/arch/blackfin/include/asm/hardirq.h
@@ -42,4 +42,6 @@ typedef struct {
42 42
43#define __ARCH_IRQ_EXIT_IRQS_DISABLED 1 43#define __ARCH_IRQ_EXIT_IRQS_DISABLED 1
44 44
45extern void ack_bad_irq(unsigned int irq);
46
45#endif 47#endif
diff --git a/arch/blackfin/include/asm/io.h b/arch/blackfin/include/asm/io.h
index 7dc77a21fdf3..63b2d8c78570 100644
--- a/arch/blackfin/include/asm/io.h
+++ b/arch/blackfin/include/asm/io.h
@@ -94,12 +94,12 @@ static inline unsigned int readl(const volatile void __iomem *addr)
94#define outw_p(x,addr) outw(x,addr) 94#define outw_p(x,addr) outw(x,addr)
95#define outl_p(x,addr) outl(x,addr) 95#define outl_p(x,addr) outl(x,addr)
96 96
97#define ioread8_rep(a,d,c) insb(a,d,c) 97#define ioread8_rep(a,d,c) readsb(a,d,c)
98#define ioread16_rep(a,d,c) insw(a,d,c) 98#define ioread16_rep(a,d,c) readsw(a,d,c)
99#define ioread32_rep(a,d,c) insl(a,d,c) 99#define ioread32_rep(a,d,c) readsl(a,d,c)
100#define iowrite8_rep(a,s,c) outsb(a,s,c) 100#define iowrite8_rep(a,s,c) writesb(a,s,c)
101#define iowrite16_rep(a,s,c) outsw(a,s,c) 101#define iowrite16_rep(a,s,c) writesw(a,s,c)
102#define iowrite32_rep(a,s,c) outsl(a,s,c) 102#define iowrite32_rep(a,s,c) writesl(a,s,c)
103 103
104#define ioread8(X) readb(X) 104#define ioread8(X) readb(X)
105#define ioread16(X) readw(X) 105#define ioread16(X) readw(X)
@@ -108,6 +108,8 @@ static inline unsigned int readl(const volatile void __iomem *addr)
108#define iowrite16(val,X) writew(val,X) 108#define iowrite16(val,X) writew(val,X)
109#define iowrite32(val,X) writel(val,X) 109#define iowrite32(val,X) writel(val,X)
110 110
111#define mmiowb() wmb()
112
111#define IO_SPACE_LIMIT 0xffffffff 113#define IO_SPACE_LIMIT 0xffffffff
112 114
113/* Values for nocacheflag and cmode */ 115/* Values for nocacheflag and cmode */
diff --git a/arch/blackfin/include/asm/ipipe.h b/arch/blackfin/include/asm/ipipe.h
new file mode 100644
index 000000000000..76f53d8b9a0d
--- /dev/null
+++ b/arch/blackfin/include/asm/ipipe.h
@@ -0,0 +1,278 @@
1/* -*- linux-c -*-
2 * include/asm-blackfin/ipipe.h
3 *
4 * Copyright (C) 2002-2007 Philippe Gerum.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, Inc., 675 Mass Ave, Cambridge MA 02139,
9 * USA; either version 2 of the License, or (at your option) any later
10 * version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 */
21
22#ifndef __ASM_BLACKFIN_IPIPE_H
23#define __ASM_BLACKFIN_IPIPE_H
24
25#ifdef CONFIG_IPIPE
26
27#include <linux/cpumask.h>
28#include <linux/list.h>
29#include <linux/threads.h>
30#include <linux/irq.h>
31#include <linux/ipipe_percpu.h>
32#include <asm/ptrace.h>
33#include <asm/irq.h>
34#include <asm/bitops.h>
35#include <asm/atomic.h>
36#include <asm/traps.h>
37
38#define IPIPE_ARCH_STRING "1.8-00"
39#define IPIPE_MAJOR_NUMBER 1
40#define IPIPE_MINOR_NUMBER 8
41#define IPIPE_PATCH_NUMBER 0
42
43#ifdef CONFIG_SMP
44#error "I-pipe/blackfin: SMP not implemented"
45#else /* !CONFIG_SMP */
46#define ipipe_processor_id() 0
47#endif /* CONFIG_SMP */
48
49#define prepare_arch_switch(next) \
50do { \
51 ipipe_schedule_notify(current, next); \
52 local_irq_disable_hw(); \
53} while (0)
54
55#define task_hijacked(p) \
56 ({ \
57 int __x__ = ipipe_current_domain != ipipe_root_domain; \
58 /* We would need to clear the SYNC flag for the root domain */ \
59 /* over the current processor in SMP mode. */ \
60 local_irq_enable_hw(); __x__; \
61 })
62
63struct ipipe_domain;
64
65struct ipipe_sysinfo {
66
67 int ncpus; /* Number of CPUs on board */
68 u64 cpufreq; /* CPU frequency (in Hz) */
69
70 /* Arch-dependent block */
71
72 struct {
73 unsigned tmirq; /* Timer tick IRQ */
74 u64 tmfreq; /* Timer frequency */
75 } archdep;
76};
77
78#define ipipe_read_tsc(t) \
79 ({ \
80 unsigned long __cy2; \
81 __asm__ __volatile__ ("1: %0 = CYCLES2\n" \
82 "%1 = CYCLES\n" \
83 "%2 = CYCLES2\n" \
84 "CC = %2 == %0\n" \
85 "if ! CC jump 1b\n" \
86 : "=r" (((unsigned long *)&t)[1]), \
87 "=r" (((unsigned long *)&t)[0]), \
88 "=r" (__cy2) \
89 : /*no input*/ : "CC"); \
90 t; \
91 })
92
93#define ipipe_cpu_freq() __ipipe_core_clock
94#define ipipe_tsc2ns(_t) (((unsigned long)(_t)) * __ipipe_freq_scale)
95#define ipipe_tsc2us(_t) (ipipe_tsc2ns(_t) / 1000 + 1)
96
97/* Private interface -- Internal use only */
98
99#define __ipipe_check_platform() do { } while (0)
100
101#define __ipipe_init_platform() do { } while (0)
102
103extern atomic_t __ipipe_irq_lvdepth[IVG15 + 1];
104
105extern unsigned long __ipipe_irq_lvmask;
106
107extern struct ipipe_domain ipipe_root;
108
109/* enable/disable_irqdesc _must_ be used in pairs. */
110
111void __ipipe_enable_irqdesc(struct ipipe_domain *ipd,
112 unsigned irq);
113
114void __ipipe_disable_irqdesc(struct ipipe_domain *ipd,
115 unsigned irq);
116
117#define __ipipe_enable_irq(irq) (irq_desc[irq].chip->unmask(irq))
118
119#define __ipipe_disable_irq(irq) (irq_desc[irq].chip->mask(irq))
120
121#define __ipipe_lock_root() \
122 set_bit(IPIPE_ROOTLOCK_FLAG, &ipipe_root_domain->flags)
123
124#define __ipipe_unlock_root() \
125 clear_bit(IPIPE_ROOTLOCK_FLAG, &ipipe_root_domain->flags)
126
127void __ipipe_enable_pipeline(void);
128
129#define __ipipe_hook_critical_ipi(ipd) do { } while (0)
130
131#define __ipipe_sync_pipeline(syncmask) \
132 do { \
133 struct ipipe_domain *ipd = ipipe_current_domain; \
134 if (likely(ipd != ipipe_root_domain || !test_bit(IPIPE_ROOTLOCK_FLAG, &ipd->flags))) \
135 __ipipe_sync_stage(syncmask); \
136 } while (0)
137
138void __ipipe_handle_irq(unsigned irq, struct pt_regs *regs);
139
140int __ipipe_get_irq_priority(unsigned irq);
141
142int __ipipe_get_irqthread_priority(unsigned irq);
143
144void __ipipe_stall_root_raw(void);
145
146void __ipipe_unstall_root_raw(void);
147
148void __ipipe_serial_debug(const char *fmt, ...);
149
150DECLARE_PER_CPU(struct pt_regs, __ipipe_tick_regs);
151
152extern unsigned long __ipipe_core_clock;
153
154extern unsigned long __ipipe_freq_scale;
155
156extern unsigned long __ipipe_irq_tail_hook;
157
158static inline unsigned long __ipipe_ffnz(unsigned long ul)
159{
160 return ffs(ul) - 1;
161}
162
163#define __ipipe_run_irqtail() /* Must be a macro */ \
164 do { \
165 asmlinkage void __ipipe_call_irqtail(void); \
166 unsigned long __pending; \
167 CSYNC(); \
168 __pending = bfin_read_IPEND(); \
169 if (__pending & 0x8000) { \
170 __pending &= ~0x8010; \
171 if (__pending && (__pending & (__pending - 1)) == 0) \
172 __ipipe_call_irqtail(); \
173 } \
174 } while (0)
175
176#define __ipipe_run_isr(ipd, irq) \
177 do { \
178 if (ipd == ipipe_root_domain) { \
179 /* \
180 * Note: the I-pipe implements a threaded interrupt model on \
181 * this arch for Linux external IRQs. The interrupt handler we \
182 * call here only wakes up the associated IRQ thread. \
183 */ \
184 if (ipipe_virtual_irq_p(irq)) { \
185 /* No irqtail here; virtual interrupts have no effect \
186 on IPEND so there is no need for processing \
187 deferral. */ \
188 local_irq_enable_nohead(ipd); \
189 ipd->irqs[irq].handler(irq, ipd->irqs[irq].cookie); \
190 local_irq_disable_nohead(ipd); \
191 } else \
192 /* \
193 * No need to run the irqtail here either; \
194 * we can't be preempted by hw IRQs, so \
195 * non-Linux IRQs cannot stack over the short \
196 * thread wakeup code. Which in turn means \
197 * that no irqtail condition could be pending \
198 * for domains above Linux in the pipeline. \
199 */ \
200 ipd->irqs[irq].handler(irq, &__raw_get_cpu_var(__ipipe_tick_regs)); \
201 } else { \
202 __clear_bit(IPIPE_SYNC_FLAG, &ipipe_cpudom_var(ipd, status)); \
203 local_irq_enable_nohead(ipd); \
204 ipd->irqs[irq].handler(irq, ipd->irqs[irq].cookie); \
205 /* Attempt to exit the outer interrupt level before \
206 * starting the deferred IRQ processing. */ \
207 local_irq_disable_nohead(ipd); \
208 __ipipe_run_irqtail(); \
209 __set_bit(IPIPE_SYNC_FLAG, &ipipe_cpudom_var(ipd, status)); \
210 } \
211 } while (0)
212
213#define __ipipe_syscall_watched_p(p, sc) \
214 (((p)->flags & PF_EVNOTIFY) || (unsigned long)sc >= NR_syscalls)
215
216void ipipe_init_irq_threads(void);
217
218int ipipe_start_irq_thread(unsigned irq, struct irq_desc *desc);
219
220#define IS_SYSIRQ(irq) ((irq) > IRQ_CORETMR && (irq) <= SYS_IRQS)
221#define IS_GPIOIRQ(irq) ((irq) >= GPIO_IRQ_BASE && (irq) < NR_IRQS)
222
223#define IRQ_SYSTMR IRQ_TIMER0
224#define IRQ_PRIOTMR CONFIG_IRQ_TIMER0
225
226#if defined(CONFIG_BF531) || defined(CONFIG_BF532) || defined(CONFIG_BF533)
227#define PRIO_GPIODEMUX(irq) CONFIG_PFA
228#elif defined(CONFIG_BF534) || defined(CONFIG_BF536) || defined(CONFIG_BF537)
229#define PRIO_GPIODEMUX(irq) CONFIG_IRQ_PROG_INTA
230#elif defined(CONFIG_BF52x)
231#define PRIO_GPIODEMUX(irq) ((irq) == IRQ_PORTF_INTA ? CONFIG_IRQ_PORTF_INTA : \
232 (irq) == IRQ_PORTG_INTA ? CONFIG_IRQ_PORTG_INTA : \
233 (irq) == IRQ_PORTH_INTA ? CONFIG_IRQ_PORTH_INTA : \
234 -1)
235#elif defined(CONFIG_BF561)
236#define PRIO_GPIODEMUX(irq) ((irq) == IRQ_PROG0_INTA ? CONFIG_IRQ_PROG0_INTA : \
237 (irq) == IRQ_PROG1_INTA ? CONFIG_IRQ_PROG1_INTA : \
238 (irq) == IRQ_PROG2_INTA ? CONFIG_IRQ_PROG2_INTA : \
239 -1)
240#define bfin_write_TIMER_DISABLE(val) bfin_write_TMRS8_DISABLE(val)
241#define bfin_write_TIMER_ENABLE(val) bfin_write_TMRS8_ENABLE(val)
242#define bfin_write_TIMER_STATUS(val) bfin_write_TMRS8_STATUS(val)
243#define bfin_read_TIMER_STATUS() bfin_read_TMRS8_STATUS()
244#elif defined(CONFIG_BF54x)
245#define PRIO_GPIODEMUX(irq) ((irq) == IRQ_PINT0 ? CONFIG_IRQ_PINT0 : \
246 (irq) == IRQ_PINT1 ? CONFIG_IRQ_PINT1 : \
247 (irq) == IRQ_PINT2 ? CONFIG_IRQ_PINT2 : \
248 (irq) == IRQ_PINT3 ? CONFIG_IRQ_PINT3 : \
249 -1)
250#define bfin_write_TIMER_DISABLE(val) bfin_write_TIMER_DISABLE0(val)
251#define bfin_write_TIMER_ENABLE(val) bfin_write_TIMER_ENABLE0(val)
252#define bfin_write_TIMER_STATUS(val) bfin_write_TIMER_STATUS0(val)
253#define bfin_read_TIMER_STATUS(val) bfin_read_TIMER_STATUS0(val)
254#else
255# error "no PRIO_GPIODEMUX() for this part"
256#endif
257
258#define __ipipe_root_tick_p(regs) ((regs->ipend & 0x10) != 0)
259
260#else /* !CONFIG_IPIPE */
261
262#define task_hijacked(p) 0
263#define ipipe_trap_notify(t, r) 0
264
265#define __ipipe_stall_root_raw() do { } while (0)
266#define __ipipe_unstall_root_raw() do { } while (0)
267
268#define ipipe_init_irq_threads() do { } while (0)
269#define ipipe_start_irq_thread(irq, desc) 0
270
271#define IRQ_SYSTMR IRQ_CORETMR
272#define IRQ_PRIOTMR IRQ_CORETMR
273
274#define __ipipe_root_tick_p(regs) 1
275
276#endif /* !CONFIG_IPIPE */
277
278#endif /* !__ASM_BLACKFIN_IPIPE_H */
diff --git a/arch/blackfin/include/asm/ipipe_base.h b/arch/blackfin/include/asm/ipipe_base.h
new file mode 100644
index 000000000000..cb1025aeabcf
--- /dev/null
+++ b/arch/blackfin/include/asm/ipipe_base.h
@@ -0,0 +1,80 @@
1/* -*- linux-c -*-
2 * include/asm-blackfin/_baseipipe.h
3 *
4 * Copyright (C) 2007 Philippe Gerum.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, Inc., 675 Mass Ave, Cambridge MA 02139,
9 * USA; either version 2 of the License, or (at your option) any later
10 * version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 */
21
22#ifndef __ASM_BLACKFIN_IPIPE_BASE_H
23#define __ASM_BLACKFIN_IPIPE_BASE_H
24
25#ifdef CONFIG_IPIPE
26
27#define IPIPE_NR_XIRQS NR_IRQS
28#define IPIPE_IRQ_ISHIFT 5 /* 2^5 for 32bits arch. */
29
30/* Blackfin-specific, global domain flags */
31#define IPIPE_ROOTLOCK_FLAG 1 /* Lock pipeline for root */
32
33 /* Blackfin traps -- i.e. exception vector numbers */
34#define IPIPE_NR_FAULTS 52 /* We leave a gap after VEC_ILL_RES. */
35/* Pseudo-vectors used for kernel events */
36#define IPIPE_FIRST_EVENT IPIPE_NR_FAULTS
37#define IPIPE_EVENT_SYSCALL (IPIPE_FIRST_EVENT)
38#define IPIPE_EVENT_SCHEDULE (IPIPE_FIRST_EVENT + 1)
39#define IPIPE_EVENT_SIGWAKE (IPIPE_FIRST_EVENT + 2)
40#define IPIPE_EVENT_SETSCHED (IPIPE_FIRST_EVENT + 3)
41#define IPIPE_EVENT_INIT (IPIPE_FIRST_EVENT + 4)
42#define IPIPE_EVENT_EXIT (IPIPE_FIRST_EVENT + 5)
43#define IPIPE_EVENT_CLEANUP (IPIPE_FIRST_EVENT + 6)
44#define IPIPE_LAST_EVENT IPIPE_EVENT_CLEANUP
45#define IPIPE_NR_EVENTS (IPIPE_LAST_EVENT + 1)
46
47#define IPIPE_TIMER_IRQ IRQ_CORETMR
48
49#ifndef __ASSEMBLY__
50
51#include <linux/bitops.h>
52
53extern int test_bit(int nr, const void *addr);
54
55
56extern unsigned long __ipipe_root_status; /* Alias to ipipe_root_cpudom_var(status) */
57
58static inline void __ipipe_stall_root(void)
59{
60 volatile unsigned long *p = &__ipipe_root_status;
61 set_bit(0, p);
62}
63
64static inline unsigned long __ipipe_test_and_stall_root(void)
65{
66 volatile unsigned long *p = &__ipipe_root_status;
67 return test_and_set_bit(0, p);
68}
69
70static inline unsigned long __ipipe_test_root(void)
71{
72 const unsigned long *p = &__ipipe_root_status;
73 return test_bit(0, p);
74}
75
76#endif /* !__ASSEMBLY__ */
77
78#endif /* CONFIG_IPIPE */
79
80#endif /* !__ASM_BLACKFIN_IPIPE_BASE_H */
diff --git a/arch/blackfin/include/asm/irq.h b/arch/blackfin/include/asm/irq.h
index 89f59e18af93..3d977909ce7d 100644
--- a/arch/blackfin/include/asm/irq.h
+++ b/arch/blackfin/include/asm/irq.h
@@ -17,56 +17,272 @@
17#ifndef _BFIN_IRQ_H_ 17#ifndef _BFIN_IRQ_H_
18#define _BFIN_IRQ_H_ 18#define _BFIN_IRQ_H_
19 19
20/* SYS_IRQS and NR_IRQS are defined in <mach-bf5xx/irq.h>*/
20#include <mach/irq.h> 21#include <mach/irq.h>
21#include <asm/ptrace.h> 22#include <asm/pda.h>
22 23#include <asm/processor.h>
23/*******************************************************************************
24 ***** INTRODUCTION ***********
25 * On the Blackfin, the interrupt structure allows remmapping of the hardware
26 * levels.
27 * - I'm going to assume that the H/W level is going to stay at the default
28 * settings. If someone wants to go through and abstart this out, feel free
29 * to mod the interrupt numbering scheme.
30 * - I'm abstracting the interrupts so that uClinux does not know anything
31 * about the H/W levels. If you want to change the H/W AND keep the abstracted
32 * levels that uClinux sees, you should be able to do most of it here.
33 * - I've left the "abstract" numbering sparce in case someone wants to pull the
34 * interrupts apart (just the TX/RX for the various devices)
35 *******************************************************************************/
36 24
37/* SYS_IRQS and NR_IRQS are defined in <mach-bf5xx/irq.h>*/ 25#ifdef CONFIG_SMP
26/* Forward decl needed due to cdef inter dependencies */
27static inline uint32_t __pure bfin_dspid(void);
28# define blackfin_core_id() (bfin_dspid() & 0xff)
29# define bfin_irq_flags cpu_pda[blackfin_core_id()].imask
30#else
31extern unsigned long bfin_irq_flags;
32#endif
38 33
39/* 34#ifdef CONFIG_IPIPE
40 * Machine specific interrupt sources. 35
41 * 36#include <linux/ipipe_trace.h>
42 * Adding an interrupt service routine for a source with this bit 37
43 * set indicates a special machine specific interrupt source. 38void __ipipe_unstall_root(void);
44 * The machine specific files define these sources. 39
45 * 40void __ipipe_restore_root(unsigned long flags);
46 * The IRQ_MACHSPEC bit is now gone - the only thing it did was to 41
47 * introduce unnecessary overhead. 42#ifdef CONFIG_DEBUG_HWERR
48 * 43# define __all_masked_irq_flags 0x3f
49 * All interrupt handling is actually machine specific so it is better 44# define __save_and_cli_hw(x) \
50 * to use function pointers, as used by the Sparc port, and select the 45 __asm__ __volatile__( \
51 * interrupt handling functions when initializing the kernel. This way 46 "cli %0;" \
52 * we save some unnecessary overhead at run-time. 47 "sti %1;" \
53 * 01/11/97 - Jes 48 : "=&d"(x) \
54 */ 49 : "d" (0x3F) \
50 )
51#else
52# define __all_masked_irq_flags 0x1f
53# define __save_and_cli_hw(x) \
54 __asm__ __volatile__( \
55 "cli %0;" \
56 : "=&d"(x) \
57 )
58#endif
59
60#define irqs_enabled_from_flags_hw(x) ((x) != __all_masked_irq_flags)
61#define raw_irqs_disabled_flags(flags) (!irqs_enabled_from_flags_hw(flags))
62#define local_test_iflag_hw(x) irqs_enabled_from_flags_hw(x)
55 63
56extern void ack_bad_irq(unsigned int irq); 64#define local_save_flags(x) \
65 do { \
66 (x) = __ipipe_test_root() ? \
67 __all_masked_irq_flags : bfin_irq_flags; \
68 } while (0)
57 69
58static __inline__ int irq_canonicalize(int irq) 70#define local_irq_save(x) \
71 do { \
72 (x) = __ipipe_test_and_stall_root(); \
73 } while (0)
74
75#define local_irq_restore(x) __ipipe_restore_root(x)
76#define local_irq_disable() __ipipe_stall_root()
77#define local_irq_enable() __ipipe_unstall_root()
78#define irqs_disabled() __ipipe_test_root()
79
80#define local_save_flags_hw(x) \
81 __asm__ __volatile__( \
82 "cli %0;" \
83 "sti %0;" \
84 : "=d"(x) \
85 )
86
87#define irqs_disabled_hw() \
88 ({ \
89 unsigned long flags; \
90 local_save_flags_hw(flags); \
91 !irqs_enabled_from_flags_hw(flags); \
92 })
93
94static inline unsigned long raw_mangle_irq_bits(int virt, unsigned long real)
59{ 95{
60 return irq; 96 /* Merge virtual and real interrupt mask bits into a single
97 32bit word. */
98 return (real & ~(1 << 31)) | ((virt != 0) << 31);
99}
100
101static inline int raw_demangle_irq_bits(unsigned long *x)
102{
103 int virt = (*x & (1 << 31)) != 0;
104 *x &= ~(1L << 31);
105 return virt;
61} 106}
62 107
63/* count of spurious interrupts */ 108#ifdef CONFIG_IPIPE_TRACE_IRQSOFF
64/* extern volatile unsigned int num_spurious; */ 109
110#define local_irq_disable_hw() \
111 do { \
112 int _tmp_dummy; \
113 if (!irqs_disabled_hw()) \
114 ipipe_trace_begin(0x80000000); \
115 __asm__ __volatile__ ("cli %0;" : "=d" (_tmp_dummy) : ); \
116 } while (0)
117
118#define local_irq_enable_hw() \
119 do { \
120 if (irqs_disabled_hw()) \
121 ipipe_trace_end(0x80000000); \
122 __asm__ __volatile__ ("sti %0;" : : "d"(bfin_irq_flags)); \
123 } while (0)
124
125#define local_irq_save_hw(x) \
126 do { \
127 __save_and_cli_hw(x); \
128 if (local_test_iflag_hw(x)) \
129 ipipe_trace_begin(0x80000001); \
130 } while (0)
131
132#define local_irq_restore_hw(x) \
133 do { \
134 if (local_test_iflag_hw(x)) { \
135 ipipe_trace_end(0x80000001); \
136 local_irq_enable_hw_notrace(); \
137 } \
138 } while (0)
139
140#define local_irq_disable_hw_notrace() \
141 do { \
142 int _tmp_dummy; \
143 __asm__ __volatile__ ("cli %0;" : "=d" (_tmp_dummy) : ); \
144 } while (0)
145
146#define local_irq_enable_hw_notrace() \
147 __asm__ __volatile__( \
148 "sti %0;" \
149 : \
150 : "d"(bfin_irq_flags) \
151 )
65 152
66#ifndef NO_IRQ 153#define local_irq_save_hw_notrace(x) __save_and_cli_hw(x)
67#define NO_IRQ ((unsigned int)(-1)) 154
155#define local_irq_restore_hw_notrace(x) \
156 do { \
157 if (local_test_iflag_hw(x)) \
158 local_irq_enable_hw_notrace(); \
159 } while (0)
160
161#else /* CONFIG_IPIPE_TRACE_IRQSOFF */
162
163#define local_irq_enable_hw() \
164 __asm__ __volatile__( \
165 "sti %0;" \
166 : \
167 : "d"(bfin_irq_flags) \
168 )
169
170#define local_irq_disable_hw() \
171 do { \
172 int _tmp_dummy; \
173 __asm__ __volatile__ ( \
174 "cli %0;" \
175 : "=d" (_tmp_dummy)); \
176 } while (0)
177
178#define local_irq_restore_hw(x) \
179 do { \
180 if (irqs_enabled_from_flags_hw(x)) \
181 local_irq_enable_hw(); \
182 } while (0)
183
184#define local_irq_save_hw(x) __save_and_cli_hw(x)
185
186#define local_irq_disable_hw_notrace() local_irq_disable_hw()
187#define local_irq_enable_hw_notrace() local_irq_enable_hw()
188#define local_irq_save_hw_notrace(x) local_irq_save_hw(x)
189#define local_irq_restore_hw_notrace(x) local_irq_restore_hw(x)
190
191#endif /* CONFIG_IPIPE_TRACE_IRQSOFF */
192
193#else /* !CONFIG_IPIPE */
194
195/*
196 * Interrupt configuring macros.
197 */
198#define local_irq_disable() \
199 do { \
200 int __tmp_dummy; \
201 __asm__ __volatile__( \
202 "cli %0;" \
203 : "=d" (__tmp_dummy) \
204 ); \
205 } while (0)
206
207#define local_irq_enable() \
208 __asm__ __volatile__( \
209 "sti %0;" \
210 : \
211 : "d" (bfin_irq_flags) \
212 )
213
214#ifdef CONFIG_DEBUG_HWERR
215# define __save_and_cli(x) \
216 __asm__ __volatile__( \
217 "cli %0;" \
218 "sti %1;" \
219 : "=&d" (x) \
220 : "d" (0x3F) \
221 )
222#else
223# define __save_and_cli(x) \
224 __asm__ __volatile__( \
225 "cli %0;" \
226 : "=&d" (x) \
227 )
68#endif 228#endif
69 229
70#define SIC_SYSIRQ(irq) (irq - (IRQ_CORETMR + 1)) 230#define local_save_flags(x) \
231 __asm__ __volatile__( \
232 "cli %0;" \
233 "sti %0;" \
234 : "=d" (x) \
235 )
236
237#ifdef CONFIG_DEBUG_HWERR
238#define irqs_enabled_from_flags(x) (((x) & ~0x3f) != 0)
239#else
240#define irqs_enabled_from_flags(x) ((x) != 0x1f)
241#endif
242
243#define local_irq_restore(x) \
244 do { \
245 if (irqs_enabled_from_flags(x)) \
246 local_irq_enable(); \
247 } while (0)
248
249/* For spinlocks etc */
250#define local_irq_save(x) __save_and_cli(x)
251
252#define irqs_disabled() \
253({ \
254 unsigned long flags; \
255 local_save_flags(flags); \
256 !irqs_enabled_from_flags(flags); \
257})
258
259#define local_irq_save_hw(x) local_irq_save(x)
260#define local_irq_restore_hw(x) local_irq_restore(x)
261#define local_irq_enable_hw() local_irq_enable()
262#define local_irq_disable_hw() local_irq_disable()
263#define irqs_disabled_hw() irqs_disabled()
264
265#endif /* !CONFIG_IPIPE */
266
267#if ANOMALY_05000244 && defined(CONFIG_BFIN_ICACHE)
268# define NOP_PAD_ANOMALY_05000244 "nop; nop;"
269#else
270# define NOP_PAD_ANOMALY_05000244
271#endif
272
273#define idle_with_irq_disabled() \
274 __asm__ __volatile__( \
275 NOP_PAD_ANOMALY_05000244 \
276 ".align 8;" \
277 "sti %0;" \
278 "idle;" \
279 : \
280 : "d" (bfin_irq_flags) \
281 )
282
283static inline int irq_canonicalize(int irq)
284{
285 return irq;
286}
71 287
72#endif /* _BFIN_IRQ_H_ */ 288#endif /* _BFIN_IRQ_H_ */
diff --git a/arch/blackfin/include/asm/l1layout.h b/arch/blackfin/include/asm/l1layout.h
index c13ded777828..79dbefaa5bef 100644
--- a/arch/blackfin/include/asm/l1layout.h
+++ b/arch/blackfin/include/asm/l1layout.h
@@ -8,6 +8,7 @@
8 8
9#include <asm/blackfin.h> 9#include <asm/blackfin.h>
10 10
11#ifndef CONFIG_SMP
11#ifndef __ASSEMBLY__ 12#ifndef __ASSEMBLY__
12 13
13/* Data that is "mapped" into the process VM at the start of the L1 scratch 14/* Data that is "mapped" into the process VM at the start of the L1 scratch
@@ -24,8 +25,10 @@ struct l1_scratch_task_info
24}; 25};
25 26
26/* A pointer to the structure in memory. */ 27/* A pointer to the structure in memory. */
27#define L1_SCRATCH_TASK_INFO ((struct l1_scratch_task_info *)L1_SCRATCH_START) 28#define L1_SCRATCH_TASK_INFO ((struct l1_scratch_task_info *)\
29 get_l1_scratch_start())
28 30
29#endif 31#endif
32#endif
30 33
31#endif 34#endif
diff --git a/arch/blackfin/mach-bf527/include/mach/mem_init.h b/arch/blackfin/include/asm/mem_init.h
index cbe03f4a5698..255a9316ad36 100644
--- a/arch/blackfin/mach-bf527/include/mach/mem_init.h
+++ b/arch/blackfin/include/asm/mem_init.h
@@ -1,35 +1,20 @@
1/* 1/*
2 * File: include/asm-blackfin/mach-bf527/mem_init.h 2 * arch/blackfin/include/asm/mem_init.h - reprogram clocks / memory
3 * Based on:
4 * Author:
5 * 3 *
6 * Created: 4 * Copyright 2004-2008 Analog Devices Inc.
7 * Description:
8 * 5 *
9 * Rev: 6 * Licensed under the GPL-2 or later.
10 *
11 * Modified:
12 * Copyright 2004-2007 Analog Devices Inc.
13 *
14 * Bugs: Enter bugs at http://blackfin.uclinux.org/
15 *
16 * This program is free software; you can redistribute it and/or modify
17 * it under the terms of the GNU General Public License as published by
18 * the Free Software Foundation; either version 2, or (at your option)
19 * any later version.
20 *
21 * This program is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 * GNU General Public License for more details.
25 *
26 * You should have received a copy of the GNU General Public License
27 * along with this program; see the file COPYING.
28 * If not, write to the Free Software Foundation,
29 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
30 */ 7 */
31 8
32#if (CONFIG_MEM_MT48LC16M16A2TG_75 || CONFIG_MEM_MT48LC64M4A2FB_7E || CONFIG_MEM_MT48LC16M8A2TG_75 || CONFIG_MEM_GENERIC_BOARD || CONFIG_MEM_MT48LC32M8A2_75 || CONFIG_MEM_MT48LC32M16A2TG_75) 9#if defined(EBIU_SDGCTL)
10#if defined(CONFIG_MEM_MT48LC16M16A2TG_75) || \
11 defined(CONFIG_MEM_MT48LC64M4A2FB_7E) || \
12 defined(CONFIG_MEM_MT48LC16M8A2TG_75) || \
13 defined(CONFIG_MEM_GENERIC_BOARD) || \
14 defined(CONFIG_MEM_MT48LC32M8A2_75) || \
15 defined(CONFIG_MEM_MT48LC8M32B2B5_7) || \
16 defined(CONFIG_MEM_MT48LC32M16A2TG_75) || \
17 defined(CONFIG_MEM_MT48LC32M8A2_75)
33#if (CONFIG_SCLK_HZ > 119402985) 18#if (CONFIG_SCLK_HZ > 119402985)
34#define SDRAM_tRP TRP_2 19#define SDRAM_tRP TRP_2
35#define SDRAM_tRP_num 2 20#define SDRAM_tRP_num 2
@@ -104,53 +89,114 @@
104#endif 89#endif
105#endif 90#endif
106 91
107#if (CONFIG_MEM_MT48LC16M16A2TG_75) 92#if defined(CONFIG_MEM_MT48LC16M8A2TG_75) || \
108 /*SDRAM INFORMATION: */ 93 defined(CONFIG_MEM_MT48LC8M32B2B5_7)
109#define SDRAM_Tref 64 /* Refresh period in milliseconds */
110#define SDRAM_NRA 8192 /* Number of row addresses in SDRAM */
111#define SDRAM_CL CL_3
112#endif
113
114#if (CONFIG_MEM_MT48LC16M8A2TG_75)
115 /*SDRAM INFORMATION: */ 94 /*SDRAM INFORMATION: */
116#define SDRAM_Tref 64 /* Refresh period in milliseconds */ 95#define SDRAM_Tref 64 /* Refresh period in milliseconds */
117#define SDRAM_NRA 4096 /* Number of row addresses in SDRAM */ 96#define SDRAM_NRA 4096 /* Number of row addresses in SDRAM */
118#define SDRAM_CL CL_3 97#define SDRAM_CL CL_3
119#endif 98#endif
120 99
121#if (CONFIG_MEM_MT48LC32M8A2_75) 100#if defined(CONFIG_MEM_MT48LC32M8A2_75) || \
101 defined(CONFIG_MEM_MT48LC64M4A2FB_7E) || \
102 defined(CONFIG_MEM_GENERIC_BOARD) || \
103 defined(CONFIG_MEM_MT48LC32M16A2TG_75) || \
104 defined(CONFIG_MEM_MT48LC16M16A2TG_75) || \
105 defined(CONFIG_MEM_MT48LC32M8A2_75)
122 /*SDRAM INFORMATION: */ 106 /*SDRAM INFORMATION: */
123#define SDRAM_Tref 64 /* Refresh period in milliseconds */ 107#define SDRAM_Tref 64 /* Refresh period in milliseconds */
124#define SDRAM_NRA 8192 /* Number of row addresses in SDRAM */ 108#define SDRAM_NRA 8192 /* Number of row addresses in SDRAM */
125#define SDRAM_CL CL_3 109#define SDRAM_CL CL_3
126#endif 110#endif
127 111
128#if (CONFIG_MEM_MT48LC64M4A2FB_7E) 112
129 /*SDRAM INFORMATION: */ 113#ifdef CONFIG_BFIN_KERNEL_CLOCK_MEMINIT_CALC
130#define SDRAM_Tref 64 /* Refresh period in milliseconds */ 114/* Equation from section 17 (p17-46) of BF533 HRM */
131#define SDRAM_NRA 8192 /* Number of row addresses in SDRAM */ 115#define mem_SDRRC (((CONFIG_SCLK_HZ / 1000) * SDRAM_Tref) / SDRAM_NRA) - (SDRAM_tRAS_num + SDRAM_tRP_num)
132#define SDRAM_CL CL_3 116
117/* Enable SCLK Out */
118#define mem_SDGCTL (0x80000000 | SCTLE | SDRAM_CL | SDRAM_tRAS | SDRAM_tRP | SDRAM_tRCD | SDRAM_tWR | PSS)
119#else
120#define mem_SDRRC CONFIG_MEM_SDRRC
121#define mem_SDGCTL CONFIG_MEM_SDGCTL
122#endif
133#endif 123#endif
134 124
135#if (CONFIG_MEM_GENERIC_BOARD) 125
136 /*SDRAM INFORMATION: Modify this for your board */ 126#if defined(EBIU_DDRCTL0)
137#define SDRAM_Tref 64 /* Refresh period in milliseconds */ 127#define MIN_DDR_SCLK(x) (x*(CONFIG_SCLK_HZ/1000/1000)/1000 + 1)
138#define SDRAM_NRA 8192 /* Number of row addresses in SDRAM */ 128#define MAX_DDR_SCLK(x) (x*(CONFIG_SCLK_HZ/1000/1000)/1000)
139#define SDRAM_CL CL_3 129#define DDR_CLK_HZ(x) (1000*1000*1000/x)
130
131#if defined(CONFIG_MEM_MT46V32M16_6T)
132#define DDR_SIZE DEVSZ_512
133#define DDR_WIDTH DEVWD_16
134#define DDR_MAX_tCK 13
135
136#define DDR_tRC DDR_TRC(MIN_DDR_SCLK(60))
137#define DDR_tRAS DDR_TRAS(MIN_DDR_SCLK(42))
138#define DDR_tRP DDR_TRP(MIN_DDR_SCLK(15))
139#define DDR_tRFC DDR_TRFC(MIN_DDR_SCLK(72))
140#define DDR_tREFI DDR_TREFI(MAX_DDR_SCLK(7800))
141
142#define DDR_tRCD DDR_TRCD(MIN_DDR_SCLK(15))
143#define DDR_tWTR DDR_TWTR(1)
144#define DDR_tMRD DDR_TMRD(MIN_DDR_SCLK(12))
145#define DDR_tWR DDR_TWR(MIN_DDR_SCLK(15))
140#endif 146#endif
141 147
142#if (CONFIG_MEM_MT48LC32M16A2TG_75) 148#if defined(CONFIG_MEM_MT46V32M16_5B)
143 /*SDRAM INFORMATION: */ 149#define DDR_SIZE DEVSZ_512
144#define SDRAM_Tref 64 /* Refresh period in milliseconds */ 150#define DDR_WIDTH DEVWD_16
145#define SDRAM_NRA 8192 /* Number of row addresses in SDRAM */ 151#define DDR_MAX_tCK 13
146#define SDRAM_CL CL_3 152
153#define DDR_tRC DDR_TRC(MIN_DDR_SCLK(55))
154#define DDR_tRAS DDR_TRAS(MIN_DDR_SCLK(40))
155#define DDR_tRP DDR_TRP(MIN_DDR_SCLK(15))
156#define DDR_tRFC DDR_TRFC(MIN_DDR_SCLK(70))
157#define DDR_tREFI DDR_TREFI(MAX_DDR_SCLK(7800))
158
159#define DDR_tRCD DDR_TRCD(MIN_DDR_SCLK(15))
160#define DDR_tWTR DDR_TWTR(2)
161#define DDR_tMRD DDR_TMRD(MIN_DDR_SCLK(10))
162#define DDR_tWR DDR_TWR(MIN_DDR_SCLK(15))
147#endif 163#endif
148 164
149/* Equation from section 17 (p17-46) of BF533 HRM */ 165#if defined(CONFIG_MEM_GENERIC_BOARD)
150#define mem_SDRRC (((CONFIG_SCLK_HZ / 1000) * SDRAM_Tref) / SDRAM_NRA) - (SDRAM_tRAS_num + SDRAM_tRP_num) 166#define DDR_SIZE DEVSZ_512
167#define DDR_WIDTH DEVWD_16
168#define DDR_MAX_tCK 13
151 169
152/* Enable SCLK Out */ 170#define DDR_tRCD DDR_TRCD(3)
153#define mem_SDGCTL (SCTLE | SDRAM_CL | SDRAM_tRAS | SDRAM_tRP | SDRAM_tRCD | SDRAM_tWR | PSS) 171#define DDR_tWTR DDR_TWTR(2)
172#define DDR_tWR DDR_TWR(2)
173#define DDR_tMRD DDR_TMRD(2)
174#define DDR_tRP DDR_TRP(3)
175#define DDR_tRAS DDR_TRAS(7)
176#define DDR_tRC DDR_TRC(10)
177#define DDR_tRFC DDR_TRFC(12)
178#define DDR_tREFI DDR_TREFI(1288)
179#endif
180
181#if (CONFIG_SCLK_HZ < DDR_CLK_HZ(DDR_MAX_tCK))
182# error "CONFIG_SCLK_HZ is too small (<DDR_CLK_HZ(DDR_MAX_tCK) Hz)."
183#elif(CONFIG_SCLK_HZ <= 133333333)
184# define DDR_CL CL_2
185#else
186# error "CONFIG_SCLK_HZ is too large (>133333333 Hz)."
187#endif
188
189#ifdef CONFIG_BFIN_KERNEL_CLOCK_MEMINIT_CALC
190#define mem_DDRCTL0 (DDR_tRP | DDR_tRAS | DDR_tRC | DDR_tRFC | DDR_tREFI)
191#define mem_DDRCTL1 (DDR_DATWIDTH | EXTBANK_1 | DDR_SIZE | DDR_WIDTH | DDR_tWTR \
192 | DDR_tMRD | DDR_tWR | DDR_tRCD)
193#define mem_DDRCTL2 DDR_CL
194#else
195#define mem_DDRCTL0 CONFIG_MEM_DDRCTL0
196#define mem_DDRCTL1 CONFIG_MEM_DDRCTL1
197#define mem_DDRCTL2 CONFIG_MEM_DDRCTL2
198#endif
199#endif
154 200
155#if defined CONFIG_CLKIN_HALF 201#if defined CONFIG_CLKIN_HALF
156#define CLKIN_HALF 1 202#define CLKIN_HALF 1
@@ -165,6 +211,13 @@
165#endif 211#endif
166 212
167/***************************************Currently Not Being Used *********************************/ 213/***************************************Currently Not Being Used *********************************/
214
215#if defined(CONFIG_FLASH_SPEED_BWAT) && \
216defined(CONFIG_FLASH_SPEED_BRAT) && \
217defined(CONFIG_FLASH_SPEED_BHT) && \
218defined(CONFIG_FLASH_SPEED_BST) && \
219defined(CONFIG_FLASH_SPEED_BTT)
220
168#define flash_EBIU_AMBCTL_WAT ((CONFIG_FLASH_SPEED_BWAT * 4) / (4000000000 / CONFIG_SCLK_HZ)) + 1 221#define flash_EBIU_AMBCTL_WAT ((CONFIG_FLASH_SPEED_BWAT * 4) / (4000000000 / CONFIG_SCLK_HZ)) + 1
169#define flash_EBIU_AMBCTL_RAT ((CONFIG_FLASH_SPEED_BRAT * 4) / (4000000000 / CONFIG_SCLK_HZ)) + 1 222#define flash_EBIU_AMBCTL_RAT ((CONFIG_FLASH_SPEED_BRAT * 4) / (4000000000 / CONFIG_SCLK_HZ)) + 1
170#define flash_EBIU_AMBCTL_HT ((CONFIG_FLASH_SPEED_BHT * 4) / (4000000000 / CONFIG_SCLK_HZ)) 223#define flash_EBIU_AMBCTL_HT ((CONFIG_FLASH_SPEED_BHT * 4) / (4000000000 / CONFIG_SCLK_HZ))
@@ -308,3 +361,4 @@
308#define flash_EBIU_AMBCTL0 \ 361#define flash_EBIU_AMBCTL0 \
309 (flash_EBIU_AMBCTL0_WAT | flash_EBIU_AMBCTL0_RAT | flash_EBIU_AMBCTL0_HT | \ 362 (flash_EBIU_AMBCTL0_WAT | flash_EBIU_AMBCTL0_RAT | flash_EBIU_AMBCTL0_HT | \
310 flash_EBIU_AMBCTL0_ST | flash_EBIU_AMBCTL0_TT | CONFIG_FLASH_SPEED_RDYEN) 363 flash_EBIU_AMBCTL0_ST | flash_EBIU_AMBCTL0_TT | CONFIG_FLASH_SPEED_RDYEN)
364#endif
diff --git a/arch/blackfin/include/asm/mem_map.h b/arch/blackfin/include/asm/mem_map.h
index 88d04a707708..e92b31051bb7 100644
--- a/arch/blackfin/include/asm/mem_map.h
+++ b/arch/blackfin/include/asm/mem_map.h
@@ -9,4 +9,79 @@
9 9
10#include <mach/mem_map.h> 10#include <mach/mem_map.h>
11 11
12#ifndef __ASSEMBLY__
13
14#ifdef CONFIG_SMP
15static inline ulong get_l1_scratch_start_cpu(int cpu)
16{
17 return (cpu) ? COREB_L1_SCRATCH_START : COREA_L1_SCRATCH_START;
18}
19static inline ulong get_l1_code_start_cpu(int cpu)
20{
21 return (cpu) ? COREB_L1_CODE_START : COREA_L1_CODE_START;
22}
23static inline ulong get_l1_data_a_start_cpu(int cpu)
24{
25 return (cpu) ? COREB_L1_DATA_A_START : COREA_L1_DATA_A_START;
26}
27static inline ulong get_l1_data_b_start_cpu(int cpu)
28{
29 return (cpu) ? COREB_L1_DATA_B_START : COREA_L1_DATA_B_START;
30}
31
32static inline ulong get_l1_scratch_start(void)
33{
34 return get_l1_scratch_start_cpu(blackfin_core_id());
35}
36static inline ulong get_l1_code_start(void)
37{
38 return get_l1_code_start_cpu(blackfin_core_id());
39}
40static inline ulong get_l1_data_a_start(void)
41{
42 return get_l1_data_a_start_cpu(blackfin_core_id());
43}
44static inline ulong get_l1_data_b_start(void)
45{
46 return get_l1_data_b_start_cpu(blackfin_core_id());
47}
48
49#else /* !CONFIG_SMP */
50
51static inline ulong get_l1_scratch_start_cpu(int cpu)
52{
53 return L1_SCRATCH_START;
54}
55static inline ulong get_l1_code_start_cpu(int cpu)
56{
57 return L1_CODE_START;
58}
59static inline ulong get_l1_data_a_start_cpu(int cpu)
60{
61 return L1_DATA_A_START;
62}
63static inline ulong get_l1_data_b_start_cpu(int cpu)
64{
65 return L1_DATA_B_START;
66}
67static inline ulong get_l1_scratch_start(void)
68{
69 return get_l1_scratch_start_cpu(0);
70}
71static inline ulong get_l1_code_start(void)
72{
73 return get_l1_code_start_cpu(0);
74}
75static inline ulong get_l1_data_a_start(void)
76{
77 return get_l1_data_a_start_cpu(0);
78}
79static inline ulong get_l1_data_b_start(void)
80{
81 return get_l1_data_b_start_cpu(0);
82}
83
84#endif /* CONFIG_SMP */
85#endif /* __ASSEMBLY__ */
86
12#endif /* _MEM_MAP_H_ */ 87#endif /* _MEM_MAP_H_ */
diff --git a/arch/blackfin/include/asm/mmu_context.h b/arch/blackfin/include/asm/mmu_context.h
index 35593dda2a4d..944e29faae48 100644
--- a/arch/blackfin/include/asm/mmu_context.h
+++ b/arch/blackfin/include/asm/mmu_context.h
@@ -37,6 +37,10 @@
37#include <asm/pgalloc.h> 37#include <asm/pgalloc.h>
38#include <asm/cplbinit.h> 38#include <asm/cplbinit.h>
39 39
40/* Note: L1 stacks are CPU-private things, so we bluntly disable this
41 feature in SMP mode, and use the per-CPU scratch SRAM bank only to
42 store the PDA instead. */
43
40extern void *current_l1_stack_save; 44extern void *current_l1_stack_save;
41extern int nr_l1stack_tasks; 45extern int nr_l1stack_tasks;
42extern void *l1_stack_base; 46extern void *l1_stack_base;
@@ -88,12 +92,15 @@ activate_l1stack(struct mm_struct *mm, unsigned long sp_base)
88static inline void switch_mm(struct mm_struct *prev_mm, struct mm_struct *next_mm, 92static inline void switch_mm(struct mm_struct *prev_mm, struct mm_struct *next_mm,
89 struct task_struct *tsk) 93 struct task_struct *tsk)
90{ 94{
95#ifdef CONFIG_MPU
96 unsigned int cpu = smp_processor_id();
97#endif
91 if (prev_mm == next_mm) 98 if (prev_mm == next_mm)
92 return; 99 return;
93#ifdef CONFIG_MPU 100#ifdef CONFIG_MPU
94 if (prev_mm->context.page_rwx_mask == current_rwx_mask) { 101 if (prev_mm->context.page_rwx_mask == current_rwx_mask[cpu]) {
95 flush_switched_cplbs(); 102 flush_switched_cplbs(cpu);
96 set_mask_dcplbs(next_mm->context.page_rwx_mask); 103 set_mask_dcplbs(next_mm->context.page_rwx_mask, cpu);
97 } 104 }
98#endif 105#endif
99 106
@@ -138,9 +145,10 @@ static inline void protect_page(struct mm_struct *mm, unsigned long addr,
138 145
139static inline void update_protections(struct mm_struct *mm) 146static inline void update_protections(struct mm_struct *mm)
140{ 147{
141 if (mm->context.page_rwx_mask == current_rwx_mask) { 148 unsigned int cpu = smp_processor_id();
142 flush_switched_cplbs(); 149 if (mm->context.page_rwx_mask == current_rwx_mask[cpu]) {
143 set_mask_dcplbs(mm->context.page_rwx_mask); 150 flush_switched_cplbs(cpu);
151 set_mask_dcplbs(mm->context.page_rwx_mask, cpu);
144 } 152 }
145} 153}
146#endif 154#endif
@@ -165,6 +173,9 @@ init_new_context(struct task_struct *tsk, struct mm_struct *mm)
165static inline void destroy_context(struct mm_struct *mm) 173static inline void destroy_context(struct mm_struct *mm)
166{ 174{
167 struct sram_list_struct *tmp; 175 struct sram_list_struct *tmp;
176#ifdef CONFIG_MPU
177 unsigned int cpu = smp_processor_id();
178#endif
168 179
169#ifdef CONFIG_APP_STACK_L1 180#ifdef CONFIG_APP_STACK_L1
170 if (current_l1_stack_save == mm->context.l1_stack_save) 181 if (current_l1_stack_save == mm->context.l1_stack_save)
@@ -179,8 +190,8 @@ static inline void destroy_context(struct mm_struct *mm)
179 kfree(tmp); 190 kfree(tmp);
180 } 191 }
181#ifdef CONFIG_MPU 192#ifdef CONFIG_MPU
182 if (current_rwx_mask == mm->context.page_rwx_mask) 193 if (current_rwx_mask[cpu] == mm->context.page_rwx_mask)
183 current_rwx_mask = NULL; 194 current_rwx_mask[cpu] = NULL;
184 free_pages((unsigned long)mm->context.page_rwx_mask, page_mask_order); 195 free_pages((unsigned long)mm->context.page_rwx_mask, page_mask_order);
185#endif 196#endif
186} 197}
diff --git a/arch/blackfin/include/asm/mutex-dec.h b/arch/blackfin/include/asm/mutex-dec.h
new file mode 100644
index 000000000000..0134151656af
--- /dev/null
+++ b/arch/blackfin/include/asm/mutex-dec.h
@@ -0,0 +1,112 @@
1/*
2 * include/asm-generic/mutex-dec.h
3 *
4 * Generic implementation of the mutex fastpath, based on atomic
5 * decrement/increment.
6 */
7#ifndef _ASM_GENERIC_MUTEX_DEC_H
8#define _ASM_GENERIC_MUTEX_DEC_H
9
10/**
11 * __mutex_fastpath_lock - try to take the lock by moving the count
12 * from 1 to a 0 value
13 * @count: pointer of type atomic_t
14 * @fail_fn: function to call if the original value was not 1
15 *
16 * Change the count from 1 to a value lower than 1, and call <fail_fn> if
17 * it wasn't 1 originally. This function MUST leave the value lower than
18 * 1 even when the "1" assertion wasn't true.
19 */
20static inline void
21__mutex_fastpath_lock(atomic_t *count, fastcall void (*fail_fn)(atomic_t *))
22{
23 if (unlikely(atomic_dec_return(count) < 0))
24 fail_fn(count);
25 else
26 smp_mb();
27}
28
29/**
30 * __mutex_fastpath_lock_retval - try to take the lock by moving the count
31 * from 1 to a 0 value
32 * @count: pointer of type atomic_t
33 * @fail_fn: function to call if the original value was not 1
34 *
35 * Change the count from 1 to a value lower than 1, and call <fail_fn> if
36 * it wasn't 1 originally. This function returns 0 if the fastpath succeeds,
37 * or anything the slow path function returns.
38 */
39static inline int
40__mutex_fastpath_lock_retval(atomic_t *count, fastcall int (*fail_fn)(atomic_t *))
41{
42 if (unlikely(atomic_dec_return(count) < 0))
43 return fail_fn(count);
44 else {
45 smp_mb();
46 return 0;
47 }
48}
49
50/**
51 * __mutex_fastpath_unlock - try to promote the count from 0 to 1
52 * @count: pointer of type atomic_t
53 * @fail_fn: function to call if the original value was not 0
54 *
55 * Try to promote the count from 0 to 1. If it wasn't 0, call <fail_fn>.
56 * In the failure case, this function is allowed to either set the value to
57 * 1, or to set it to a value lower than 1.
58 *
59 * If the implementation sets it to a value of lower than 1, then the
60 * __mutex_slowpath_needs_to_unlock() macro needs to return 1, it needs
61 * to return 0 otherwise.
62 */
63static inline void
64__mutex_fastpath_unlock(atomic_t *count, fastcall void (*fail_fn)(atomic_t *))
65{
66 smp_mb();
67 if (unlikely(atomic_inc_return(count) <= 0))
68 fail_fn(count);
69}
70
71#define __mutex_slowpath_needs_to_unlock() 1
72
73/**
74 * __mutex_fastpath_trylock - try to acquire the mutex, without waiting
75 *
76 * @count: pointer of type atomic_t
77 * @fail_fn: fallback function
78 *
79 * Change the count from 1 to a value lower than 1, and return 0 (failure)
80 * if it wasn't 1 originally, or return 1 (success) otherwise. This function
81 * MUST leave the value lower than 1 even when the "1" assertion wasn't true.
82 * Additionally, if the value was < 0 originally, this function must not leave
83 * it to 0 on failure.
84 *
85 * If the architecture has no effective trylock variant, it should call the
86 * <fail_fn> spinlock-based trylock variant unconditionally.
87 */
88static inline int
89__mutex_fastpath_trylock(atomic_t *count, int (*fail_fn)(atomic_t *))
90{
91 /*
92 * We have two variants here. The cmpxchg based one is the best one
93 * because it never induce a false contention state. It is included
94 * here because architectures using the inc/dec algorithms over the
95 * xchg ones are much more likely to support cmpxchg natively.
96 *
97 * If not we fall back to the spinlock based variant - that is
98 * just as efficient (and simpler) as a 'destructive' probing of
99 * the mutex state would be.
100 */
101#ifdef __HAVE_ARCH_CMPXCHG
102 if (likely(atomic_cmpxchg(count, 1, 0) == 1)) {
103 smp_mb();
104 return 1;
105 }
106 return 0;
107#else
108 return fail_fn(count);
109#endif
110}
111
112#endif
diff --git a/arch/blackfin/include/asm/mutex.h b/arch/blackfin/include/asm/mutex.h
index 458c1f7fbc18..5d399256bf06 100644
--- a/arch/blackfin/include/asm/mutex.h
+++ b/arch/blackfin/include/asm/mutex.h
@@ -6,4 +6,67 @@
6 * implementation. (see asm-generic/mutex-xchg.h for details) 6 * implementation. (see asm-generic/mutex-xchg.h for details)
7 */ 7 */
8 8
9#ifndef _ASM_MUTEX_H
10#define _ASM_MUTEX_H
11
12#ifndef CONFIG_SMP
9#include <asm-generic/mutex-dec.h> 13#include <asm-generic/mutex-dec.h>
14#else
15
16static inline void
17__mutex_fastpath_lock(atomic_t *count, void (*fail_fn)(atomic_t *))
18{
19 if (unlikely(atomic_dec_return(count) < 0))
20 fail_fn(count);
21 else
22 smp_mb();
23}
24
25static inline int
26__mutex_fastpath_lock_retval(atomic_t *count, int (*fail_fn)(atomic_t *))
27{
28 if (unlikely(atomic_dec_return(count) < 0))
29 return fail_fn(count);
30 else {
31 smp_mb();
32 return 0;
33 }
34}
35
36static inline void
37__mutex_fastpath_unlock(atomic_t *count, void (*fail_fn)(atomic_t *))
38{
39 smp_mb();
40 if (unlikely(atomic_inc_return(count) <= 0))
41 fail_fn(count);
42}
43
44#define __mutex_slowpath_needs_to_unlock() 1
45
46static inline int
47__mutex_fastpath_trylock(atomic_t *count, int (*fail_fn)(atomic_t *))
48{
49 /*
50 * We have two variants here. The cmpxchg based one is the best one
51 * because it never induce a false contention state. It is included
52 * here because architectures using the inc/dec algorithms over the
53 * xchg ones are much more likely to support cmpxchg natively.
54 *
55 * If not we fall back to the spinlock based variant - that is
56 * just as efficient (and simpler) as a 'destructive' probing of
57 * the mutex state would be.
58 */
59#ifdef __HAVE_ARCH_CMPXCHG
60 if (likely(atomic_cmpxchg(count, 1, 0) == 1)) {
61 smp_mb();
62 return 1;
63 }
64 return 0;
65#else
66 return fail_fn(count);
67#endif
68}
69
70#endif
71
72#endif
diff --git a/arch/blackfin/include/asm/pda.h b/arch/blackfin/include/asm/pda.h
new file mode 100644
index 000000000000..bd8d4a7efeb2
--- /dev/null
+++ b/arch/blackfin/include/asm/pda.h
@@ -0,0 +1,70 @@
1/*
2 * File: arch/blackfin/include/asm/pda.h
3 * Author: Philippe Gerum <rpm@xenomai.org>
4 *
5 * Copyright 2007 Analog Devices Inc.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, see the file COPYING, or write
19 * to the Free Software Foundation, Inc.,
20 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21 */
22
23#ifndef _ASM_BLACKFIN_PDA_H
24#define _ASM_BLACKFIN_PDA_H
25
26#include <mach/anomaly.h>
27
28#ifndef __ASSEMBLY__
29
30struct blackfin_pda { /* Per-processor Data Area */
31 struct blackfin_pda *next;
32
33 unsigned long syscfg;
34#ifdef CONFIG_SMP
35 unsigned long imask; /* Current IMASK value */
36#endif
37
38 unsigned long *ipdt; /* Start of switchable I-CPLB table */
39 unsigned long *ipdt_swapcount; /* Number of swaps in ipdt */
40 unsigned long *dpdt; /* Start of switchable D-CPLB table */
41 unsigned long *dpdt_swapcount; /* Number of swaps in dpdt */
42
43 /*
44 * Single instructions can have multiple faults, which
45 * need to be handled by traps.c, in irq5. We store
46 * the exception cause to ensure we don't miss a
47 * double fault condition
48 */
49 unsigned long ex_iptr;
50 unsigned long ex_optr;
51 unsigned long ex_buf[4];
52 unsigned long ex_imask; /* Saved imask from exception */
53 unsigned long *ex_stack; /* Exception stack space */
54
55#ifdef ANOMALY_05000261
56 unsigned long last_cplb_fault_retx;
57#endif
58 unsigned long dcplb_fault_addr;
59 unsigned long icplb_fault_addr;
60 unsigned long retx;
61 unsigned long seqstat;
62};
63
64extern struct blackfin_pda cpu_pda[];
65
66void reserve_pda(void);
67
68#endif /* __ASSEMBLY__ */
69
70#endif /* _ASM_BLACKFIN_PDA_H */
diff --git a/arch/blackfin/include/asm/percpu.h b/arch/blackfin/include/asm/percpu.h
index 78dd61f6b39f..797c0c165069 100644
--- a/arch/blackfin/include/asm/percpu.h
+++ b/arch/blackfin/include/asm/percpu.h
@@ -3,4 +3,14 @@
3 3
4#include <asm-generic/percpu.h> 4#include <asm-generic/percpu.h>
5 5
6#endif /* __ARCH_BLACKFIN_PERCPU__ */ 6#ifdef CONFIG_MODULES
7#define PERCPU_MODULE_RESERVE 8192
8#else
9#define PERCPU_MODULE_RESERVE 0
10#endif
11
12#define PERCPU_ENOUGH_ROOM \
13 (ALIGN(__per_cpu_end - __per_cpu_start, SMP_CACHE_BYTES) + \
14 PERCPU_MODULE_RESERVE)
15
16#endif /* __ARCH_BLACKFIN_PERCPU__ */
diff --git a/arch/blackfin/include/asm/pgtable.h b/arch/blackfin/include/asm/pgtable.h
index f11684e4ade7..783c8f7f8f8c 100644
--- a/arch/blackfin/include/asm/pgtable.h
+++ b/arch/blackfin/include/asm/pgtable.h
@@ -29,6 +29,7 @@ typedef pte_t *pte_addr_t;
29#define PAGE_COPY __pgprot(0) /* these mean nothing to NO_MM */ 29#define PAGE_COPY __pgprot(0) /* these mean nothing to NO_MM */
30#define PAGE_READONLY __pgprot(0) /* these mean nothing to NO_MM */ 30#define PAGE_READONLY __pgprot(0) /* these mean nothing to NO_MM */
31#define PAGE_KERNEL __pgprot(0) /* these mean nothing to NO_MM */ 31#define PAGE_KERNEL __pgprot(0) /* these mean nothing to NO_MM */
32#define pgprot_noncached(prot) (prot)
32 33
33extern void paging_init(void); 34extern void paging_init(void);
34 35
diff --git a/arch/blackfin/include/asm/processor.h b/arch/blackfin/include/asm/processor.h
index e3e9b41fa8db..0eece23b41c7 100644
--- a/arch/blackfin/include/asm/processor.h
+++ b/arch/blackfin/include/asm/processor.h
@@ -24,6 +24,14 @@ static inline void wrusp(unsigned long usp)
24 __asm__ __volatile__("usp = %0;\n\t"::"da"(usp)); 24 __asm__ __volatile__("usp = %0;\n\t"::"da"(usp));
25} 25}
26 26
27static inline unsigned long __get_SP(void)
28{
29 unsigned long sp;
30
31 __asm__ __volatile__("%0 = sp;\n\t" : "=da"(sp));
32 return sp;
33}
34
27/* 35/*
28 * User space process size: 1st byte beyond user address space. 36 * User space process size: 1st byte beyond user address space.
29 * Fairly meaningless on nommu. Parts of user programs can be scattered 37 * Fairly meaningless on nommu. Parts of user programs can be scattered
@@ -57,6 +65,7 @@ struct thread_struct {
57 * pass the data segment into user programs if it exists, 65 * pass the data segment into user programs if it exists,
58 * it can't hurt anything as far as I can tell 66 * it can't hurt anything as far as I can tell
59 */ 67 */
68#ifndef CONFIG_SMP
60#define start_thread(_regs, _pc, _usp) \ 69#define start_thread(_regs, _pc, _usp) \
61do { \ 70do { \
62 set_fs(USER_DS); \ 71 set_fs(USER_DS); \
@@ -70,6 +79,16 @@ do { \
70 sizeof(*L1_SCRATCH_TASK_INFO)); \ 79 sizeof(*L1_SCRATCH_TASK_INFO)); \
71 wrusp(_usp); \ 80 wrusp(_usp); \
72} while(0) 81} while(0)
82#else
83#define start_thread(_regs, _pc, _usp) \
84do { \
85 set_fs(USER_DS); \
86 (_regs)->pc = (_pc); \
87 if (current->mm) \
88 (_regs)->p5 = current->mm->start_data; \
89 wrusp(_usp); \
90} while (0)
91#endif
73 92
74/* Forward declaration, a strange C thing */ 93/* Forward declaration, a strange C thing */
75struct task_struct; 94struct task_struct;
@@ -106,7 +125,8 @@ unsigned long get_wchan(struct task_struct *p);
106 eip; }) 125 eip; })
107#define KSTK_ESP(tsk) ((tsk) == current ? rdusp() : (tsk)->thread.usp) 126#define KSTK_ESP(tsk) ((tsk) == current ? rdusp() : (tsk)->thread.usp)
108 127
109#define cpu_relax() barrier() 128#define cpu_relax() smp_mb()
129
110 130
111/* Get the Silicon Revision of the chip */ 131/* Get the Silicon Revision of the chip */
112static inline uint32_t __pure bfin_revid(void) 132static inline uint32_t __pure bfin_revid(void)
@@ -137,7 +157,11 @@ static inline uint32_t __pure bfin_revid(void)
137static inline uint16_t __pure bfin_cpuid(void) 157static inline uint16_t __pure bfin_cpuid(void)
138{ 158{
139 return (bfin_read_CHIPID() & CHIPID_FAMILY) >> 12; 159 return (bfin_read_CHIPID() & CHIPID_FAMILY) >> 12;
160}
140 161
162static inline uint32_t __pure bfin_dspid(void)
163{
164 return bfin_read_DSPID();
141} 165}
142 166
143static inline uint32_t __pure bfin_compiled_revid(void) 167static inline uint32_t __pure bfin_compiled_revid(void)
@@ -154,6 +178,8 @@ static inline uint32_t __pure bfin_compiled_revid(void)
154 return 4; 178 return 4;
155#elif defined(CONFIG_BF_REV_0_5) 179#elif defined(CONFIG_BF_REV_0_5)
156 return 5; 180 return 5;
181#elif defined(CONFIG_BF_REV_0_6)
182 return 6;
157#elif defined(CONFIG_BF_REV_ANY) 183#elif defined(CONFIG_BF_REV_ANY)
158 return 0xffff; 184 return 0xffff;
159#else 185#else
diff --git a/arch/blackfin/include/asm/reboot.h b/arch/blackfin/include/asm/reboot.h
index 6d448b5f5985..4856d62b7467 100644
--- a/arch/blackfin/include/asm/reboot.h
+++ b/arch/blackfin/include/asm/reboot.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * include/asm-blackfin/reboot.h - shutdown/reboot header 2 * reboot.h - shutdown/reboot header
3 * 3 *
4 * Copyright 2004-2007 Analog Devices Inc. 4 * Copyright 2004-2008 Analog Devices Inc.
5 * 5 *
6 * Licensed under the GPL-2 or later. 6 * Licensed under the GPL-2 or later.
7 */ 7 */
diff --git a/arch/blackfin/include/asm/rwlock.h b/arch/blackfin/include/asm/rwlock.h
new file mode 100644
index 000000000000..4a724b378971
--- /dev/null
+++ b/arch/blackfin/include/asm/rwlock.h
@@ -0,0 +1,6 @@
1#ifndef _ASM_BLACKFIN_RWLOCK_H
2#define _ASM_BLACKFIN_RWLOCK_H
3
4#define RW_LOCK_BIAS 0x01000000
5
6#endif
diff --git a/arch/blackfin/include/asm/serial.h b/arch/blackfin/include/asm/serial.h
index 994dd869558c..3a47606c858b 100644
--- a/arch/blackfin/include/asm/serial.h
+++ b/arch/blackfin/include/asm/serial.h
@@ -3,3 +3,4 @@
3 */ 3 */
4 4
5#define SERIAL_EXTRA_IRQ_FLAGS IRQF_TRIGGER_HIGH 5#define SERIAL_EXTRA_IRQ_FLAGS IRQF_TRIGGER_HIGH
6#define BASE_BAUD (1843200 / 16)
diff --git a/arch/blackfin/include/asm/smp.h b/arch/blackfin/include/asm/smp.h
new file mode 100644
index 000000000000..118deeeae7c0
--- /dev/null
+++ b/arch/blackfin/include/asm/smp.h
@@ -0,0 +1,44 @@
1/*
2 * File: arch/blackfin/include/asm/smp.h
3 * Author: Philippe Gerum <rpm@xenomai.org>
4 *
5 * Copyright 2007 Analog Devices Inc.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, see the file COPYING, or write
19 * to the Free Software Foundation, Inc.,
20 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21 */
22
23#ifndef __ASM_BLACKFIN_SMP_H
24#define __ASM_BLACKFIN_SMP_H
25
26#include <linux/kernel.h>
27#include <linux/threads.h>
28#include <linux/cpumask.h>
29#include <linux/cache.h>
30#include <asm/blackfin.h>
31#include <mach/smp.h>
32
33#define raw_smp_processor_id() blackfin_core_id()
34
35extern char coreb_trampoline_start, coreb_trampoline_end;
36
37struct corelock_slot {
38 int lock;
39};
40
41void smp_icache_flush_range_others(unsigned long start,
42 unsigned long end);
43
44#endif /* !__ASM_BLACKFIN_SMP_H */
diff --git a/arch/blackfin/include/asm/spinlock.h b/arch/blackfin/include/asm/spinlock.h
index 64e908a50646..0249ac319476 100644
--- a/arch/blackfin/include/asm/spinlock.h
+++ b/arch/blackfin/include/asm/spinlock.h
@@ -1,6 +1,89 @@
1#ifndef __BFIN_SPINLOCK_H 1#ifndef __BFIN_SPINLOCK_H
2#define __BFIN_SPINLOCK_H 2#define __BFIN_SPINLOCK_H
3 3
4#error blackfin architecture does not support SMP spin lock yet 4#include <asm/atomic.h>
5 5
6#endif 6asmlinkage int __raw_spin_is_locked_asm(volatile int *ptr);
7asmlinkage void __raw_spin_lock_asm(volatile int *ptr);
8asmlinkage int __raw_spin_trylock_asm(volatile int *ptr);
9asmlinkage void __raw_spin_unlock_asm(volatile int *ptr);
10asmlinkage void __raw_read_lock_asm(volatile int *ptr);
11asmlinkage int __raw_read_trylock_asm(volatile int *ptr);
12asmlinkage void __raw_read_unlock_asm(volatile int *ptr);
13asmlinkage void __raw_write_lock_asm(volatile int *ptr);
14asmlinkage int __raw_write_trylock_asm(volatile int *ptr);
15asmlinkage void __raw_write_unlock_asm(volatile int *ptr);
16
17static inline int __raw_spin_is_locked(raw_spinlock_t *lock)
18{
19 return __raw_spin_is_locked_asm(&lock->lock);
20}
21
22static inline void __raw_spin_lock(raw_spinlock_t *lock)
23{
24 __raw_spin_lock_asm(&lock->lock);
25}
26
27#define __raw_spin_lock_flags(lock, flags) __raw_spin_lock(lock)
28
29static inline int __raw_spin_trylock(raw_spinlock_t *lock)
30{
31 return __raw_spin_trylock_asm(&lock->lock);
32}
33
34static inline void __raw_spin_unlock(raw_spinlock_t *lock)
35{
36 __raw_spin_unlock_asm(&lock->lock);
37}
38
39static inline void __raw_spin_unlock_wait(raw_spinlock_t *lock)
40{
41 while (__raw_spin_is_locked(lock))
42 cpu_relax();
43}
44
45static inline int __raw_read_can_lock(raw_rwlock_t *rw)
46{
47 return __raw_uncached_fetch_asm(&rw->lock) > 0;
48}
49
50static inline int __raw_write_can_lock(raw_rwlock_t *rw)
51{
52 return __raw_uncached_fetch_asm(&rw->lock) == RW_LOCK_BIAS;
53}
54
55static inline void __raw_read_lock(raw_rwlock_t *rw)
56{
57 __raw_read_lock_asm(&rw->lock);
58}
59
60static inline int __raw_read_trylock(raw_rwlock_t *rw)
61{
62 return __raw_read_trylock_asm(&rw->lock);
63}
64
65static inline void __raw_read_unlock(raw_rwlock_t *rw)
66{
67 __raw_read_unlock_asm(&rw->lock);
68}
69
70static inline void __raw_write_lock(raw_rwlock_t *rw)
71{
72 __raw_write_lock_asm(&rw->lock);
73}
74
75static inline int __raw_write_trylock(raw_rwlock_t *rw)
76{
77 return __raw_write_trylock_asm(&rw->lock);
78}
79
80static inline void __raw_write_unlock(raw_rwlock_t *rw)
81{
82 __raw_write_unlock_asm(&rw->lock);
83}
84
85#define _raw_spin_relax(lock) cpu_relax()
86#define _raw_read_relax(lock) cpu_relax()
87#define _raw_write_relax(lock) cpu_relax()
88
89#endif /* !__BFIN_SPINLOCK_H */
diff --git a/arch/blackfin/include/asm/spinlock_types.h b/arch/blackfin/include/asm/spinlock_types.h
new file mode 100644
index 000000000000..b1e3c4c7b382
--- /dev/null
+++ b/arch/blackfin/include/asm/spinlock_types.h
@@ -0,0 +1,22 @@
1#ifndef __ASM_SPINLOCK_TYPES_H
2#define __ASM_SPINLOCK_TYPES_H
3
4#ifndef __LINUX_SPINLOCK_TYPES_H
5# error "please don't include this file directly"
6#endif
7
8#include <asm/rwlock.h>
9
10typedef struct {
11 volatile unsigned int lock;
12} raw_spinlock_t;
13
14#define __RAW_SPIN_LOCK_UNLOCKED { 0 }
15
16typedef struct {
17 volatile unsigned int lock;
18} raw_rwlock_t;
19
20#define __RAW_RW_LOCK_UNLOCKED { RW_LOCK_BIAS }
21
22#endif
diff --git a/arch/blackfin/include/asm/system.h b/arch/blackfin/include/asm/system.h
index 8f1627d8bf09..a4c8254bec55 100644
--- a/arch/blackfin/include/asm/system.h
+++ b/arch/blackfin/include/asm/system.h
@@ -37,114 +37,98 @@
37#include <linux/linkage.h> 37#include <linux/linkage.h>
38#include <linux/compiler.h> 38#include <linux/compiler.h>
39#include <mach/anomaly.h> 39#include <mach/anomaly.h>
40#include <asm/pda.h>
41#include <asm/processor.h>
42#include <asm/irq.h>
40 43
41/* 44/*
42 * Interrupt configuring macros. 45 * Force strict CPU ordering.
43 */ 46 */
47#define nop() __asm__ __volatile__ ("nop;\n\t" : : )
48#define mb() __asm__ __volatile__ ("" : : : "memory")
49#define rmb() __asm__ __volatile__ ("" : : : "memory")
50#define wmb() __asm__ __volatile__ ("" : : : "memory")
51#define set_mb(var, value) do { (void) xchg(&var, value); } while (0)
52#define read_barrier_depends() do { } while(0)
44 53
45extern unsigned long irq_flags; 54#ifdef CONFIG_SMP
46 55asmlinkage unsigned long __raw_xchg_1_asm(volatile void *ptr, unsigned long value);
47#define local_irq_enable() \ 56asmlinkage unsigned long __raw_xchg_2_asm(volatile void *ptr, unsigned long value);
48 __asm__ __volatile__( \ 57asmlinkage unsigned long __raw_xchg_4_asm(volatile void *ptr, unsigned long value);
49 "sti %0;" \ 58asmlinkage unsigned long __raw_cmpxchg_1_asm(volatile void *ptr,
50 : \ 59 unsigned long new, unsigned long old);
51 : "d" (irq_flags) \ 60asmlinkage unsigned long __raw_cmpxchg_2_asm(volatile void *ptr,
52 ) 61 unsigned long new, unsigned long old);
53 62asmlinkage unsigned long __raw_cmpxchg_4_asm(volatile void *ptr,
54#define local_irq_disable() \ 63 unsigned long new, unsigned long old);
55 do { \ 64
56 int __tmp_dummy; \ 65#ifdef __ARCH_SYNC_CORE_DCACHE
57 __asm__ __volatile__( \ 66# define smp_mb() do { barrier(); smp_check_barrier(); smp_mark_barrier(); } while (0)
58 "cli %0;" \ 67# define smp_rmb() do { barrier(); smp_check_barrier(); } while (0)
59 : "=d" (__tmp_dummy) \ 68# define smp_wmb() do { barrier(); smp_mark_barrier(); } while (0)
60 ); \ 69#define smp_read_barrier_depends() do { barrier(); smp_check_barrier(); } while (0)
61 } while (0)
62
63#if ANOMALY_05000244 && defined(CONFIG_BFIN_ICACHE)
64# define NOP_PAD_ANOMALY_05000244 "nop; nop;"
65#else
66# define NOP_PAD_ANOMALY_05000244
67#endif
68
69#define idle_with_irq_disabled() \
70 __asm__ __volatile__( \
71 NOP_PAD_ANOMALY_05000244 \
72 ".align 8;" \
73 "sti %0;" \
74 "idle;" \
75 : \
76 : "d" (irq_flags) \
77 )
78
79#ifdef CONFIG_DEBUG_HWERR
80# define __save_and_cli(x) \
81 __asm__ __volatile__( \
82 "cli %0;" \
83 "sti %1;" \
84 : "=&d" (x) \
85 : "d" (0x3F) \
86 )
87#else
88# define __save_and_cli(x) \
89 __asm__ __volatile__( \
90 "cli %0;" \
91 : "=&d" (x) \
92 )
93#endif
94
95#define local_save_flags(x) \
96 __asm__ __volatile__( \
97 "cli %0;" \
98 "sti %0;" \
99 : "=d" (x) \
100 )
101 70
102#ifdef CONFIG_DEBUG_HWERR
103#define irqs_enabled_from_flags(x) (((x) & ~0x3f) != 0)
104#else 71#else
105#define irqs_enabled_from_flags(x) ((x) != 0x1f) 72# define smp_mb() barrier()
73# define smp_rmb() barrier()
74# define smp_wmb() barrier()
75#define smp_read_barrier_depends() barrier()
106#endif 76#endif
107 77
108#define local_irq_restore(x) \ 78static inline unsigned long __xchg(unsigned long x, volatile void *ptr,
109 do { \ 79 int size)
110 if (irqs_enabled_from_flags(x)) \ 80{
111 local_irq_enable(); \ 81 unsigned long tmp;
112 } while (0)
113 82
114/* For spinlocks etc */ 83 switch (size) {
115#define local_irq_save(x) __save_and_cli(x) 84 case 1:
85 tmp = __raw_xchg_1_asm(ptr, x);
86 break;
87 case 2:
88 tmp = __raw_xchg_2_asm(ptr, x);
89 break;
90 case 4:
91 tmp = __raw_xchg_4_asm(ptr, x);
92 break;
93 }
116 94
117#define irqs_disabled() \ 95 return tmp;
118({ \ 96}
119 unsigned long flags; \
120 local_save_flags(flags); \
121 !irqs_enabled_from_flags(flags); \
122})
123 97
124/* 98/*
125 * Force strict CPU ordering. 99 * Atomic compare and exchange. Compare OLD with MEM, if identical,
100 * store NEW in MEM. Return the initial value in MEM. Success is
101 * indicated by comparing RETURN with OLD.
126 */ 102 */
127#define nop() asm volatile ("nop;\n\t"::) 103static inline unsigned long __cmpxchg(volatile void *ptr, unsigned long old,
128#define mb() asm volatile ("" : : :"memory") 104 unsigned long new, int size)
129#define rmb() asm volatile ("" : : :"memory") 105{
130#define wmb() asm volatile ("" : : :"memory") 106 unsigned long tmp;
131#define set_mb(var, value) do { (void) xchg(&var, value); } while (0)
132 107
133#define read_barrier_depends() do { } while(0) 108 switch (size) {
109 case 1:
110 tmp = __raw_cmpxchg_1_asm(ptr, new, old);
111 break;
112 case 2:
113 tmp = __raw_cmpxchg_2_asm(ptr, new, old);
114 break;
115 case 4:
116 tmp = __raw_cmpxchg_4_asm(ptr, new, old);
117 break;
118 }
119
120 return tmp;
121}
122#define cmpxchg(ptr, o, n) \
123 ((__typeof__(*(ptr)))__cmpxchg((ptr), (unsigned long)(o), \
124 (unsigned long)(n), sizeof(*(ptr))))
125
126#else /* !CONFIG_SMP */
134 127
135#ifdef CONFIG_SMP
136#define smp_mb() mb()
137#define smp_rmb() rmb()
138#define smp_wmb() wmb()
139#define smp_read_barrier_depends() read_barrier_depends()
140#else
141#define smp_mb() barrier() 128#define smp_mb() barrier()
142#define smp_rmb() barrier() 129#define smp_rmb() barrier()
143#define smp_wmb() barrier() 130#define smp_wmb() barrier()
144#define smp_read_barrier_depends() do { } while(0) 131#define smp_read_barrier_depends() do { } while(0)
145#endif
146
147#define xchg(ptr,x) ((__typeof__(*(ptr)))__xchg((unsigned long)(x),(ptr),sizeof(*(ptr))))
148 132
149struct __xchg_dummy { 133struct __xchg_dummy {
150 unsigned long a[100]; 134 unsigned long a[100];
@@ -157,7 +141,7 @@ static inline unsigned long __xchg(unsigned long x, volatile void *ptr,
157 unsigned long tmp = 0; 141 unsigned long tmp = 0;
158 unsigned long flags = 0; 142 unsigned long flags = 0;
159 143
160 local_irq_save(flags); 144 local_irq_save_hw(flags);
161 145
162 switch (size) { 146 switch (size) {
163 case 1: 147 case 1:
@@ -179,7 +163,7 @@ static inline unsigned long __xchg(unsigned long x, volatile void *ptr,
179 : "=&d" (tmp) : "d" (x), "m" (*__xg(ptr)) : "memory"); 163 : "=&d" (tmp) : "d" (x), "m" (*__xg(ptr)) : "memory");
180 break; 164 break;
181 } 165 }
182 local_irq_restore(flags); 166 local_irq_restore_hw(flags);
183 return tmp; 167 return tmp;
184} 168}
185 169
@@ -194,9 +178,12 @@ static inline unsigned long __xchg(unsigned long x, volatile void *ptr,
194 (unsigned long)(n), sizeof(*(ptr)))) 178 (unsigned long)(n), sizeof(*(ptr))))
195#define cmpxchg64_local(ptr, o, n) __cmpxchg64_local_generic((ptr), (o), (n)) 179#define cmpxchg64_local(ptr, o, n) __cmpxchg64_local_generic((ptr), (o), (n))
196 180
197#ifndef CONFIG_SMP
198#include <asm-generic/cmpxchg.h> 181#include <asm-generic/cmpxchg.h>
199#endif 182
183#endif /* !CONFIG_SMP */
184
185#define xchg(ptr, x) ((__typeof__(*(ptr)))__xchg((unsigned long)(x), (ptr), sizeof(*(ptr))))
186#define tas(ptr) ((void)xchg((ptr), 1))
200 187
201#define prepare_to_switch() do { } while(0) 188#define prepare_to_switch() do { } while(0)
202 189
@@ -205,10 +192,12 @@ static inline unsigned long __xchg(unsigned long x, volatile void *ptr,
205 * ptr isn't the current task, in which case it does nothing. 192 * ptr isn't the current task, in which case it does nothing.
206 */ 193 */
207 194
208#include <asm/blackfin.h> 195#include <asm/l1layout.h>
196#include <asm/mem_map.h>
209 197
210asmlinkage struct task_struct *resume(struct task_struct *prev, struct task_struct *next); 198asmlinkage struct task_struct *resume(struct task_struct *prev, struct task_struct *next);
211 199
200#ifndef CONFIG_SMP
212#define switch_to(prev,next,last) \ 201#define switch_to(prev,next,last) \
213do { \ 202do { \
214 memcpy (&task_thread_info(prev)->l1_task_info, L1_SCRATCH_TASK_INFO, \ 203 memcpy (&task_thread_info(prev)->l1_task_info, L1_SCRATCH_TASK_INFO, \
@@ -217,5 +206,11 @@ do { \
217 sizeof *L1_SCRATCH_TASK_INFO); \ 206 sizeof *L1_SCRATCH_TASK_INFO); \
218 (last) = resume (prev, next); \ 207 (last) = resume (prev, next); \
219} while (0) 208} while (0)
209#else
210#define switch_to(prev, next, last) \
211do { \
212 (last) = resume(prev, next); \
213} while (0)
214#endif
220 215
221#endif /* _BLACKFIN_SYSTEM_H */ 216#endif /* _BLACKFIN_SYSTEM_H */
diff --git a/arch/blackfin/include/asm/thread_info.h b/arch/blackfin/include/asm/thread_info.h
index 642769329d12..e721ce55956c 100644
--- a/arch/blackfin/include/asm/thread_info.h
+++ b/arch/blackfin/include/asm/thread_info.h
@@ -44,6 +44,7 @@
44 */ 44 */
45#define THREAD_SIZE_ORDER 1 45#define THREAD_SIZE_ORDER 1
46#define THREAD_SIZE 8192 /* 2 pages */ 46#define THREAD_SIZE 8192 /* 2 pages */
47#define STACK_WARN (THREAD_SIZE/8)
47 48
48#ifndef __ASSEMBLY__ 49#ifndef __ASSEMBLY__
49 50
@@ -62,7 +63,9 @@ struct thread_info {
62 int preempt_count; /* 0 => preemptable, <0 => BUG */ 63 int preempt_count; /* 0 => preemptable, <0 => BUG */
63 mm_segment_t addr_limit; /* address limit */ 64 mm_segment_t addr_limit; /* address limit */
64 struct restart_block restart_block; 65 struct restart_block restart_block;
66#ifndef CONFIG_SMP
65 struct l1_scratch_task_info l1_task_info; 67 struct l1_scratch_task_info l1_task_info;
68#endif
66}; 69};
67 70
68/* 71/*
@@ -90,7 +93,7 @@ __attribute_const__
90static inline struct thread_info *current_thread_info(void) 93static inline struct thread_info *current_thread_info(void)
91{ 94{
92 struct thread_info *ti; 95 struct thread_info *ti;
93 __asm__("%0 = sp;": "=&d"(ti): 96 __asm__("%0 = sp;" : "=da"(ti) :
94 ); 97 );
95 return (struct thread_info *)((long)ti & ~((long)THREAD_SIZE-1)); 98 return (struct thread_info *)((long)ti & ~((long)THREAD_SIZE-1));
96} 99}
diff --git a/arch/blackfin/include/asm/uaccess.h b/arch/blackfin/include/asm/uaccess.h
index d928b8099056..3248033531e6 100644
--- a/arch/blackfin/include/asm/uaccess.h
+++ b/arch/blackfin/include/asm/uaccess.h
@@ -149,54 +149,42 @@ static inline int bad_user_access_length(void)
149 : /* no outputs */ \ 149 : /* no outputs */ \
150 :"d" (x),"a" (__ptr(p)) : "memory") 150 :"d" (x),"a" (__ptr(p)) : "memory")
151 151
152#define get_user(x,p) \ 152#define get_user(x, ptr) \
153 ({ \ 153({ \
154 int _err = 0; \ 154 int _err = 0; \
155 typeof(*(p)) *_p = (p); \ 155 unsigned long _val = 0; \
156 if (!access_ok(VERIFY_READ, _p, sizeof(*(_p)))) { \ 156 const typeof(*(ptr)) __user *_p = (ptr); \
157 _err = -EFAULT; \ 157 const size_t ptr_size = sizeof(*(_p)); \
158 } \ 158 if (likely(access_ok(VERIFY_READ, _p, ptr_size))) { \
159 else { \ 159 BUILD_BUG_ON(ptr_size >= 8); \
160 switch (sizeof(*(_p))) { \ 160 switch (ptr_size) { \
161 case 1: \ 161 case 1: \
162 __get_user_asm(x, _p, B,(Z)); \ 162 __get_user_asm(_val, _p, B,(Z)); \
163 break; \ 163 break; \
164 case 2: \ 164 case 2: \
165 __get_user_asm(x, _p, W,(Z)); \ 165 __get_user_asm(_val, _p, W,(Z)); \
166 break; \ 166 break; \
167 case 4: \ 167 case 4: \
168 __get_user_asm(x, _p, , ); \ 168 __get_user_asm(_val, _p, , ); \
169 break; \ 169 break; \
170 case 8: { \ 170 } \
171 unsigned long _xl, _xh; \ 171 } else \
172 __get_user_asm(_xl, ((unsigned long *)_p)+0, , ); \ 172 _err = -EFAULT; \
173 __get_user_asm(_xh, ((unsigned long *)_p)+1, , ); \ 173 x = (typeof(*(ptr)))_val; \
174 ((unsigned long *)&x)[0] = _xl; \ 174 _err; \
175 ((unsigned long *)&x)[1] = _xh; \ 175})
176 } break; \
177 default: \
178 x = 0; \
179 printk(KERN_INFO "get_user_bad: %s:%d %s\n", \
180 __FILE__, __LINE__, __func__); \
181 _err = __get_user_bad(); \
182 break; \
183 } \
184 } \
185 _err; \
186 })
187 176
188#define __get_user(x,p) get_user(x,p) 177#define __get_user(x,p) get_user(x,p)
189 178
190#define __get_user_bad() (bad_user_access_length(), (-EFAULT)) 179#define __get_user_bad() (bad_user_access_length(), (-EFAULT))
191 180
192#define __get_user_asm(x,p,bhw,option) \ 181#define __get_user_asm(x, ptr, bhw, option) \
193 { \ 182({ \
194 unsigned long _tmp; \ 183 __asm__ __volatile__ ( \
195 __asm__ ("%0 =" #bhw "[%1]"#option";\n\t" \ 184 "%0 =" #bhw "[%1]" #option ";" \
196 : "=d" (_tmp) \ 185 : "=d" (x) \
197 : "a" (__ptr(p))); \ 186 : "a" (__ptr(ptr))); \
198 (x) = (__typeof__(*(p))) _tmp; \ 187})
199 }
200 188
201#define __copy_from_user(to, from, n) copy_from_user(to, from, n) 189#define __copy_from_user(to, from, n) copy_from_user(to, from, n)
202#define __copy_to_user(to, from, n) copy_to_user(to, from, n) 190#define __copy_to_user(to, from, n) copy_to_user(to, from, n)
@@ -209,8 +197,8 @@ static inline int bad_user_access_length(void)
209#define copy_from_user_ret(to,from,n,retval) ({ if (copy_from_user(to,from,n))\ 197#define copy_from_user_ret(to,from,n,retval) ({ if (copy_from_user(to,from,n))\
210 return retval; }) 198 return retval; })
211 199
212static inline long copy_from_user(void *to, 200static inline unsigned long __must_check
213 const void __user * from, unsigned long n) 201copy_from_user(void *to, const void __user *from, unsigned long n)
214{ 202{
215 if (access_ok(VERIFY_READ, from, n)) 203 if (access_ok(VERIFY_READ, from, n))
216 memcpy(to, from, n); 204 memcpy(to, from, n);
@@ -219,8 +207,8 @@ static inline long copy_from_user(void *to,
219 return 0; 207 return 0;
220} 208}
221 209
222static inline long copy_to_user(void *to, 210static inline unsigned long __must_check
223 const void __user * from, unsigned long n) 211copy_to_user(void *to, const void __user *from, unsigned long n)
224{ 212{
225 if (access_ok(VERIFY_WRITE, to, n)) 213 if (access_ok(VERIFY_WRITE, to, n))
226 memcpy(to, from, n); 214 memcpy(to, from, n);
@@ -233,8 +221,8 @@ static inline long copy_to_user(void *to,
233 * Copy a null terminated string from userspace. 221 * Copy a null terminated string from userspace.
234 */ 222 */
235 223
236static inline long strncpy_from_user(char *dst, 224static inline long __must_check
237 const char *src, long count) 225strncpy_from_user(char *dst, const char *src, long count)
238{ 226{
239 char *tmp; 227 char *tmp;
240 if (!access_ok(VERIFY_READ, src, 1)) 228 if (!access_ok(VERIFY_READ, src, 1))
@@ -260,7 +248,8 @@ static inline long strnlen_user(const char *src, long n)
260 * Zero Userspace 248 * Zero Userspace
261 */ 249 */
262 250
263static inline unsigned long __clear_user(void *to, unsigned long n) 251static inline unsigned long __must_check
252__clear_user(void *to, unsigned long n)
264{ 253{
265 memset(to, 0, n); 254 memset(to, 0, n);
266 return 0; 255 return 0;
diff --git a/arch/blackfin/include/asm/xor.h b/arch/blackfin/include/asm/xor.h
new file mode 100644
index 000000000000..c82eb12a5b18
--- /dev/null
+++ b/arch/blackfin/include/asm/xor.h
@@ -0,0 +1 @@
#include <asm-generic/xor.h>
diff --git a/arch/blackfin/kernel/Makefile b/arch/blackfin/kernel/Makefile
index 606adc78aa85..38a233374f07 100644
--- a/arch/blackfin/kernel/Makefile
+++ b/arch/blackfin/kernel/Makefile
@@ -7,7 +7,7 @@ extra-y := init_task.o vmlinux.lds
7obj-y := \ 7obj-y := \
8 entry.o process.o bfin_ksyms.o ptrace.o setup.o signal.o \ 8 entry.o process.o bfin_ksyms.o ptrace.o setup.o signal.o \
9 sys_bfin.o traps.o irqchip.o dma-mapping.o flat.o \ 9 sys_bfin.o traps.o irqchip.o dma-mapping.o flat.o \
10 fixed_code.o reboot.o bfin_gpio.o 10 fixed_code.o reboot.o bfin_gpio.o bfin_dma_5xx.o
11 11
12ifeq ($(CONFIG_GENERIC_CLOCKEVENTS),y) 12ifeq ($(CONFIG_GENERIC_CLOCKEVENTS),y)
13 obj-y += time-ts.o 13 obj-y += time-ts.o
@@ -15,8 +15,11 @@ else
15 obj-y += time.o 15 obj-y += time.o
16endif 16endif
17 17
18obj-$(CONFIG_IPIPE) += ipipe.o
19obj-$(CONFIG_IPIPE_TRACE_MCOUNT) += mcount.o
18obj-$(CONFIG_BFIN_GPTIMERS) += gptimers.o 20obj-$(CONFIG_BFIN_GPTIMERS) += gptimers.o
21obj-$(CONFIG_CPLB_INFO) += cplbinfo.o
19obj-$(CONFIG_MODULES) += module.o 22obj-$(CONFIG_MODULES) += module.o
20obj-$(CONFIG_BFIN_DMA_5XX) += bfin_dma_5xx.o
21obj-$(CONFIG_KGDB) += kgdb.o 23obj-$(CONFIG_KGDB) += kgdb.o
24obj-$(CONFIG_KGDB_TESTCASE) += kgdb_test.o
22obj-$(CONFIG_EARLY_PRINTK) += early_printk.o 25obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
diff --git a/arch/blackfin/kernel/asm-offsets.c b/arch/blackfin/kernel/asm-offsets.c
index 9bb85dd5ccb3..b5df9459d6d5 100644
--- a/arch/blackfin/kernel/asm-offsets.c
+++ b/arch/blackfin/kernel/asm-offsets.c
@@ -56,6 +56,9 @@ int main(void)
56 /* offsets into the thread struct */ 56 /* offsets into the thread struct */
57 DEFINE(THREAD_KSP, offsetof(struct thread_struct, ksp)); 57 DEFINE(THREAD_KSP, offsetof(struct thread_struct, ksp));
58 DEFINE(THREAD_USP, offsetof(struct thread_struct, usp)); 58 DEFINE(THREAD_USP, offsetof(struct thread_struct, usp));
59 DEFINE(THREAD_SR, offsetof(struct thread_struct, seqstat));
60 DEFINE(PT_SR, offsetof(struct thread_struct, seqstat));
61 DEFINE(THREAD_ESP0, offsetof(struct thread_struct, esp0));
59 DEFINE(THREAD_PC, offsetof(struct thread_struct, pc)); 62 DEFINE(THREAD_PC, offsetof(struct thread_struct, pc));
60 DEFINE(KERNEL_STACK_SIZE, THREAD_SIZE); 63 DEFINE(KERNEL_STACK_SIZE, THREAD_SIZE);
61 64
@@ -128,5 +131,31 @@ int main(void)
128 DEFINE(SIGSEGV, SIGSEGV); 131 DEFINE(SIGSEGV, SIGSEGV);
129 DEFINE(SIGTRAP, SIGTRAP); 132 DEFINE(SIGTRAP, SIGTRAP);
130 133
134 /* PDA management (in L1 scratchpad) */
135 DEFINE(PDA_SYSCFG, offsetof(struct blackfin_pda, syscfg));
136#ifdef CONFIG_SMP
137 DEFINE(PDA_IRQFLAGS, offsetof(struct blackfin_pda, imask));
138#endif
139 DEFINE(PDA_IPDT, offsetof(struct blackfin_pda, ipdt));
140 DEFINE(PDA_IPDT_SWAPCOUNT, offsetof(struct blackfin_pda, ipdt_swapcount));
141 DEFINE(PDA_DPDT, offsetof(struct blackfin_pda, dpdt));
142 DEFINE(PDA_DPDT_SWAPCOUNT, offsetof(struct blackfin_pda, dpdt_swapcount));
143 DEFINE(PDA_EXIPTR, offsetof(struct blackfin_pda, ex_iptr));
144 DEFINE(PDA_EXOPTR, offsetof(struct blackfin_pda, ex_optr));
145 DEFINE(PDA_EXBUF, offsetof(struct blackfin_pda, ex_buf));
146 DEFINE(PDA_EXIMASK, offsetof(struct blackfin_pda, ex_imask));
147 DEFINE(PDA_EXSTACK, offsetof(struct blackfin_pda, ex_stack));
148#ifdef ANOMALY_05000261
149 DEFINE(PDA_LFRETX, offsetof(struct blackfin_pda, last_cplb_fault_retx));
150#endif
151 DEFINE(PDA_DCPLB, offsetof(struct blackfin_pda, dcplb_fault_addr));
152 DEFINE(PDA_ICPLB, offsetof(struct blackfin_pda, icplb_fault_addr));
153 DEFINE(PDA_RETX, offsetof(struct blackfin_pda, retx));
154 DEFINE(PDA_SEQSTAT, offsetof(struct blackfin_pda, seqstat));
155#ifdef CONFIG_SMP
156 /* Inter-core lock (in L2 SRAM) */
157 DEFINE(SIZEOF_CORELOCK, sizeof(struct corelock_slot));
158#endif
159
131 return 0; 160 return 0;
132} 161}
diff --git a/arch/blackfin/kernel/bfin_dma_5xx.c b/arch/blackfin/kernel/bfin_dma_5xx.c
index 339293d677cc..07e02c0d1c07 100644
--- a/arch/blackfin/kernel/bfin_dma_5xx.c
+++ b/arch/blackfin/kernel/bfin_dma_5xx.c
@@ -1,63 +1,27 @@
1/* 1/*
2 * File: arch/blackfin/kernel/bfin_dma_5xx.c 2 * bfin_dma_5xx.c - Blackfin DMA implementation
3 * Based on:
4 * Author:
5 * 3 *
6 * Created: 4 * Copyright 2004-2008 Analog Devices Inc.
7 * Description: This file contains the simple DMA Implementation for Blackfin 5 * Licensed under the GPL-2 or later.
8 *
9 * Modified:
10 * Copyright 2004-2006 Analog Devices Inc.
11 *
12 * Bugs: Enter bugs at http://blackfin.uclinux.org/
13 *
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 2 of the License, or
17 * (at your option) any later version.
18 *
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
23 *
24 * You should have received a copy of the GNU General Public License
25 * along with this program; if not, see the file COPYING, or write
26 * to the Free Software Foundation, Inc.,
27 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
28 */ 6 */
29 7
30#include <linux/errno.h> 8#include <linux/errno.h>
31#include <linux/module.h>
32#include <linux/sched.h>
33#include <linux/interrupt.h> 9#include <linux/interrupt.h>
34#include <linux/kernel.h> 10#include <linux/kernel.h>
11#include <linux/module.h>
35#include <linux/param.h> 12#include <linux/param.h>
13#include <linux/proc_fs.h>
14#include <linux/sched.h>
15#include <linux/seq_file.h>
16#include <linux/spinlock.h>
36 17
37#include <asm/blackfin.h> 18#include <asm/blackfin.h>
38#include <asm/dma.h>
39#include <asm/cacheflush.h> 19#include <asm/cacheflush.h>
20#include <asm/dma.h>
21#include <asm/uaccess.h>
40 22
41/* Remove unused code not exported by symbol or internally called */ 23struct dma_channel dma_ch[MAX_DMA_CHANNELS];
42#define REMOVE_DEAD_CODE 24EXPORT_SYMBOL(dma_ch);
43
44/**************************************************************************
45 * Global Variables
46***************************************************************************/
47
48static struct dma_channel dma_ch[MAX_BLACKFIN_DMA_CHANNEL];
49
50/*------------------------------------------------------------------------------
51 * Set the Buffer Clear bit in the Configuration register of specific DMA
52 * channel. This will stop the descriptor based DMA operation.
53 *-----------------------------------------------------------------------------*/
54static void clear_dma_buffer(unsigned int channel)
55{
56 dma_ch[channel].regs->cfg |= RESTART;
57 SSYNC();
58 dma_ch[channel].regs->cfg &= ~RESTART;
59 SSYNC();
60}
61 25
62static int __init blackfin_dma_init(void) 26static int __init blackfin_dma_init(void)
63{ 27{
@@ -65,32 +29,67 @@ static int __init blackfin_dma_init(void)
65 29
66 printk(KERN_INFO "Blackfin DMA Controller\n"); 30 printk(KERN_INFO "Blackfin DMA Controller\n");
67 31
68 for (i = 0; i < MAX_BLACKFIN_DMA_CHANNEL; i++) { 32 for (i = 0; i < MAX_DMA_CHANNELS; i++) {
69 dma_ch[i].chan_status = DMA_CHANNEL_FREE; 33 dma_ch[i].chan_status = DMA_CHANNEL_FREE;
70 dma_ch[i].regs = dma_io_base_addr[i]; 34 dma_ch[i].regs = dma_io_base_addr[i];
71 mutex_init(&(dma_ch[i].dmalock)); 35 mutex_init(&(dma_ch[i].dmalock));
72 } 36 }
73 /* Mark MEMDMA Channel 0 as requested since we're using it internally */ 37 /* Mark MEMDMA Channel 0 as requested since we're using it internally */
74 dma_ch[CH_MEM_STREAM0_DEST].chan_status = DMA_CHANNEL_REQUESTED; 38 request_dma(CH_MEM_STREAM0_DEST, "Blackfin dma_memcpy");
75 dma_ch[CH_MEM_STREAM0_SRC].chan_status = DMA_CHANNEL_REQUESTED; 39 request_dma(CH_MEM_STREAM0_SRC, "Blackfin dma_memcpy");
76 40
77#if defined(CONFIG_DEB_DMA_URGENT) 41#if defined(CONFIG_DEB_DMA_URGENT)
78 bfin_write_EBIU_DDRQUE(bfin_read_EBIU_DDRQUE() 42 bfin_write_EBIU_DDRQUE(bfin_read_EBIU_DDRQUE()
79 | DEB1_URGENT | DEB2_URGENT | DEB3_URGENT); 43 | DEB1_URGENT | DEB2_URGENT | DEB3_URGENT);
80#endif 44#endif
45
81 return 0; 46 return 0;
82} 47}
83
84arch_initcall(blackfin_dma_init); 48arch_initcall(blackfin_dma_init);
85 49
86/*------------------------------------------------------------------------------ 50#ifdef CONFIG_PROC_FS
87 * Request the specific DMA channel from the system. 51static int proc_dma_show(struct seq_file *m, void *v)
88 *-----------------------------------------------------------------------------*/
89int request_dma(unsigned int channel, char *device_id)
90{ 52{
53 int i;
54
55 for (i = 0; i < MAX_DMA_CHANNELS; ++i)
56 if (dma_ch[i].chan_status != DMA_CHANNEL_FREE)
57 seq_printf(m, "%2d: %s\n", i, dma_ch[i].device_id);
58
59 return 0;
60}
91 61
62static int proc_dma_open(struct inode *inode, struct file *file)
63{
64 return single_open(file, proc_dma_show, NULL);
65}
66
67static const struct file_operations proc_dma_operations = {
68 .open = proc_dma_open,
69 .read = seq_read,
70 .llseek = seq_lseek,
71 .release = single_release,
72};
73
74static int __init proc_dma_init(void)
75{
76 return proc_create("dma", 0, NULL, &proc_dma_operations) != NULL;
77}
78late_initcall(proc_dma_init);
79#endif
80
81/**
82 * request_dma - request a DMA channel
83 *
84 * Request the specific DMA channel from the system if it's available.
85 */
86int request_dma(unsigned int channel, const char *device_id)
87{
92 pr_debug("request_dma() : BEGIN \n"); 88 pr_debug("request_dma() : BEGIN \n");
93 89
90 if (device_id == NULL)
91 printk(KERN_WARNING "request_dma(%u): no device_id given\n", channel);
92
94#if defined(CONFIG_BF561) && ANOMALY_05000182 93#if defined(CONFIG_BF561) && ANOMALY_05000182
95 if (channel >= CH_IMEM_STREAM0_DEST && channel <= CH_IMEM_STREAM1_DEST) { 94 if (channel >= CH_IMEM_STREAM0_DEST && channel <= CH_IMEM_STREAM1_DEST) {
96 if (get_cclk() > 500000000) { 95 if (get_cclk() > 500000000) {
@@ -129,60 +128,63 @@ int request_dma(unsigned int channel, char *device_id)
129#endif 128#endif
130 129
131 dma_ch[channel].device_id = device_id; 130 dma_ch[channel].device_id = device_id;
132 dma_ch[channel].irq_callback = NULL; 131 dma_ch[channel].irq = 0;
133 132
134 /* This is to be enabled by putting a restriction - 133 /* This is to be enabled by putting a restriction -
135 * you have to request DMA, before doing any operations on 134 * you have to request DMA, before doing any operations on
136 * descriptor/channel 135 * descriptor/channel
137 */ 136 */
138 pr_debug("request_dma() : END \n"); 137 pr_debug("request_dma() : END \n");
139 return channel; 138 return 0;
140} 139}
141EXPORT_SYMBOL(request_dma); 140EXPORT_SYMBOL(request_dma);
142 141
143int set_dma_callback(unsigned int channel, dma_interrupt_t callback, void *data) 142int set_dma_callback(unsigned int channel, irq_handler_t callback, void *data)
144{ 143{
145 int ret_irq = 0;
146
147 BUG_ON(!(dma_ch[channel].chan_status != DMA_CHANNEL_FREE 144 BUG_ON(!(dma_ch[channel].chan_status != DMA_CHANNEL_FREE
148 && channel < MAX_BLACKFIN_DMA_CHANNEL)); 145 && channel < MAX_DMA_CHANNELS));
149 146
150 if (callback != NULL) { 147 if (callback != NULL) {
151 int ret_val; 148 int ret;
152 ret_irq = channel2irq(channel); 149 unsigned int irq = channel2irq(channel);
153 150
154 dma_ch[channel].data = data; 151 ret = request_irq(irq, callback, IRQF_DISABLED,
152 dma_ch[channel].device_id, data);
153 if (ret)
154 return ret;
155 155
156 ret_val = 156 dma_ch[channel].irq = irq;
157 request_irq(ret_irq, (void *)callback, IRQF_DISABLED, 157 dma_ch[channel].data = data;
158 dma_ch[channel].device_id, data);
159 if (ret_val) {
160 printk(KERN_NOTICE
161 "Request irq in DMA engine failed.\n");
162 return -EPERM;
163 }
164 dma_ch[channel].irq_callback = callback;
165 } 158 }
166 return 0; 159 return 0;
167} 160}
168EXPORT_SYMBOL(set_dma_callback); 161EXPORT_SYMBOL(set_dma_callback);
169 162
170void free_dma(unsigned int channel) 163/**
164 * clear_dma_buffer - clear DMA fifos for specified channel
165 *
166 * Set the Buffer Clear bit in the Configuration register of specific DMA
167 * channel. This will stop the descriptor based DMA operation.
168 */
169static void clear_dma_buffer(unsigned int channel)
171{ 170{
172 int ret_irq; 171 dma_ch[channel].regs->cfg |= RESTART;
172 SSYNC();
173 dma_ch[channel].regs->cfg &= ~RESTART;
174}
173 175
176void free_dma(unsigned int channel)
177{
174 pr_debug("freedma() : BEGIN \n"); 178 pr_debug("freedma() : BEGIN \n");
175 BUG_ON(!(dma_ch[channel].chan_status != DMA_CHANNEL_FREE 179 BUG_ON(!(dma_ch[channel].chan_status != DMA_CHANNEL_FREE
176 && channel < MAX_BLACKFIN_DMA_CHANNEL)); 180 && channel < MAX_DMA_CHANNELS));
177 181
178 /* Halt the DMA */ 182 /* Halt the DMA */
179 disable_dma(channel); 183 disable_dma(channel);
180 clear_dma_buffer(channel); 184 clear_dma_buffer(channel);
181 185
182 if (dma_ch[channel].irq_callback != NULL) { 186 if (dma_ch[channel].irq)
183 ret_irq = channel2irq(channel); 187 free_irq(dma_ch[channel].irq, dma_ch[channel].data);
184 free_irq(ret_irq, dma_ch[channel].data);
185 }
186 188
187 /* Clear the DMA Variable in the Channel */ 189 /* Clear the DMA Variable in the Channel */
188 mutex_lock(&(dma_ch[channel].dmalock)); 190 mutex_lock(&(dma_ch[channel].dmalock));
@@ -193,294 +195,15 @@ void free_dma(unsigned int channel)
193} 195}
194EXPORT_SYMBOL(free_dma); 196EXPORT_SYMBOL(free_dma);
195 197
196void dma_enable_irq(unsigned int channel)
197{
198 int ret_irq;
199
200 pr_debug("dma_enable_irq() : BEGIN \n");
201 BUG_ON(!(dma_ch[channel].chan_status != DMA_CHANNEL_FREE
202 && channel < MAX_BLACKFIN_DMA_CHANNEL));
203
204 ret_irq = channel2irq(channel);
205 enable_irq(ret_irq);
206}
207EXPORT_SYMBOL(dma_enable_irq);
208
209void dma_disable_irq(unsigned int channel)
210{
211 int ret_irq;
212
213 pr_debug("dma_disable_irq() : BEGIN \n");
214 BUG_ON(!(dma_ch[channel].chan_status != DMA_CHANNEL_FREE
215 && channel < MAX_BLACKFIN_DMA_CHANNEL));
216
217 ret_irq = channel2irq(channel);
218 disable_irq(ret_irq);
219}
220EXPORT_SYMBOL(dma_disable_irq);
221
222int dma_channel_active(unsigned int channel)
223{
224 if (dma_ch[channel].chan_status == DMA_CHANNEL_FREE) {
225 return 0;
226 } else {
227 return 1;
228 }
229}
230EXPORT_SYMBOL(dma_channel_active);
231
232/*------------------------------------------------------------------------------
233* stop the specific DMA channel.
234*-----------------------------------------------------------------------------*/
235void disable_dma(unsigned int channel)
236{
237 pr_debug("stop_dma() : BEGIN \n");
238
239 BUG_ON(!(dma_ch[channel].chan_status != DMA_CHANNEL_FREE
240 && channel < MAX_BLACKFIN_DMA_CHANNEL));
241
242 dma_ch[channel].regs->cfg &= ~DMAEN; /* Clean the enable bit */
243 SSYNC();
244 dma_ch[channel].chan_status = DMA_CHANNEL_REQUESTED;
245 /* Needs to be enabled Later */
246 pr_debug("stop_dma() : END \n");
247 return;
248}
249EXPORT_SYMBOL(disable_dma);
250
251void enable_dma(unsigned int channel)
252{
253 pr_debug("enable_dma() : BEGIN \n");
254
255 BUG_ON(!(dma_ch[channel].chan_status != DMA_CHANNEL_FREE
256 && channel < MAX_BLACKFIN_DMA_CHANNEL));
257
258 dma_ch[channel].chan_status = DMA_CHANNEL_ENABLED;
259 dma_ch[channel].regs->curr_x_count = 0;
260 dma_ch[channel].regs->curr_y_count = 0;
261
262 dma_ch[channel].regs->cfg |= DMAEN; /* Set the enable bit */
263 SSYNC();
264 pr_debug("enable_dma() : END \n");
265 return;
266}
267EXPORT_SYMBOL(enable_dma);
268
269/*------------------------------------------------------------------------------
270* Set the Start Address register for the specific DMA channel
271* This function can be used for register based DMA,
272* to setup the start address
273* addr: Starting address of the DMA Data to be transferred.
274*-----------------------------------------------------------------------------*/
275void set_dma_start_addr(unsigned int channel, unsigned long addr)
276{
277 pr_debug("set_dma_start_addr() : BEGIN \n");
278
279 BUG_ON(!(dma_ch[channel].chan_status != DMA_CHANNEL_FREE
280 && channel < MAX_BLACKFIN_DMA_CHANNEL));
281
282 dma_ch[channel].regs->start_addr = addr;
283 SSYNC();
284 pr_debug("set_dma_start_addr() : END\n");
285}
286EXPORT_SYMBOL(set_dma_start_addr);
287
288void set_dma_next_desc_addr(unsigned int channel, unsigned long addr)
289{
290 pr_debug("set_dma_next_desc_addr() : BEGIN \n");
291
292 BUG_ON(!(dma_ch[channel].chan_status != DMA_CHANNEL_FREE
293 && channel < MAX_BLACKFIN_DMA_CHANNEL));
294
295 dma_ch[channel].regs->next_desc_ptr = addr;
296 SSYNC();
297 pr_debug("set_dma_next_desc_addr() : END\n");
298}
299EXPORT_SYMBOL(set_dma_next_desc_addr);
300
301void set_dma_curr_desc_addr(unsigned int channel, unsigned long addr)
302{
303 pr_debug("set_dma_curr_desc_addr() : BEGIN \n");
304
305 BUG_ON(!(dma_ch[channel].chan_status != DMA_CHANNEL_FREE
306 && channel < MAX_BLACKFIN_DMA_CHANNEL));
307
308 dma_ch[channel].regs->curr_desc_ptr = addr;
309 SSYNC();
310 pr_debug("set_dma_curr_desc_addr() : END\n");
311}
312EXPORT_SYMBOL(set_dma_curr_desc_addr);
313
314void set_dma_x_count(unsigned int channel, unsigned short x_count)
315{
316 BUG_ON(!(dma_ch[channel].chan_status != DMA_CHANNEL_FREE
317 && channel < MAX_BLACKFIN_DMA_CHANNEL));
318
319 dma_ch[channel].regs->x_count = x_count;
320 SSYNC();
321}
322EXPORT_SYMBOL(set_dma_x_count);
323
324void set_dma_y_count(unsigned int channel, unsigned short y_count)
325{
326 BUG_ON(!(dma_ch[channel].chan_status != DMA_CHANNEL_FREE
327 && channel < MAX_BLACKFIN_DMA_CHANNEL));
328
329 dma_ch[channel].regs->y_count = y_count;
330 SSYNC();
331}
332EXPORT_SYMBOL(set_dma_y_count);
333
334void set_dma_x_modify(unsigned int channel, short x_modify)
335{
336 BUG_ON(!(dma_ch[channel].chan_status != DMA_CHANNEL_FREE
337 && channel < MAX_BLACKFIN_DMA_CHANNEL));
338
339 dma_ch[channel].regs->x_modify = x_modify;
340 SSYNC();
341}
342EXPORT_SYMBOL(set_dma_x_modify);
343
344void set_dma_y_modify(unsigned int channel, short y_modify)
345{
346 BUG_ON(!(dma_ch[channel].chan_status != DMA_CHANNEL_FREE
347 && channel < MAX_BLACKFIN_DMA_CHANNEL));
348
349 dma_ch[channel].regs->y_modify = y_modify;
350 SSYNC();
351}
352EXPORT_SYMBOL(set_dma_y_modify);
353
354void set_dma_config(unsigned int channel, unsigned short config)
355{
356 BUG_ON(!(dma_ch[channel].chan_status != DMA_CHANNEL_FREE
357 && channel < MAX_BLACKFIN_DMA_CHANNEL));
358
359 dma_ch[channel].regs->cfg = config;
360 SSYNC();
361}
362EXPORT_SYMBOL(set_dma_config);
363
364unsigned short
365set_bfin_dma_config(char direction, char flow_mode,
366 char intr_mode, char dma_mode, char width, char syncmode)
367{
368 unsigned short config;
369
370 config =
371 ((direction << 1) | (width << 2) | (dma_mode << 4) |
372 (intr_mode << 6) | (flow_mode << 12) | (syncmode << 5));
373 return config;
374}
375EXPORT_SYMBOL(set_bfin_dma_config);
376
377void set_dma_sg(unsigned int channel, struct dmasg *sg, int nr_sg)
378{
379 BUG_ON(!(dma_ch[channel].chan_status != DMA_CHANNEL_FREE
380 && channel < MAX_BLACKFIN_DMA_CHANNEL));
381
382 dma_ch[channel].regs->cfg |= ((nr_sg & 0x0F) << 8);
383
384 dma_ch[channel].regs->next_desc_ptr = (unsigned int)sg;
385
386 SSYNC();
387}
388EXPORT_SYMBOL(set_dma_sg);
389
390void set_dma_curr_addr(unsigned int channel, unsigned long addr)
391{
392 BUG_ON(!(dma_ch[channel].chan_status != DMA_CHANNEL_FREE
393 && channel < MAX_BLACKFIN_DMA_CHANNEL));
394
395 dma_ch[channel].regs->curr_addr_ptr = addr;
396 SSYNC();
397}
398EXPORT_SYMBOL(set_dma_curr_addr);
399
400/*------------------------------------------------------------------------------
401 * Get the DMA status of a specific DMA channel from the system.
402 *-----------------------------------------------------------------------------*/
403unsigned short get_dma_curr_irqstat(unsigned int channel)
404{
405 BUG_ON(!(dma_ch[channel].chan_status != DMA_CHANNEL_FREE
406 && channel < MAX_BLACKFIN_DMA_CHANNEL));
407
408 return dma_ch[channel].regs->irq_status;
409}
410EXPORT_SYMBOL(get_dma_curr_irqstat);
411
412/*------------------------------------------------------------------------------
413 * Clear the DMA_DONE bit in DMA status. Stop the DMA completion interrupt.
414 *-----------------------------------------------------------------------------*/
415void clear_dma_irqstat(unsigned int channel)
416{
417 BUG_ON(!(dma_ch[channel].chan_status != DMA_CHANNEL_FREE
418 && channel < MAX_BLACKFIN_DMA_CHANNEL));
419 dma_ch[channel].regs->irq_status |= 3;
420}
421EXPORT_SYMBOL(clear_dma_irqstat);
422
423/*------------------------------------------------------------------------------
424 * Get current DMA xcount of a specific DMA channel from the system.
425 *-----------------------------------------------------------------------------*/
426unsigned short get_dma_curr_xcount(unsigned int channel)
427{
428 BUG_ON(!(dma_ch[channel].chan_status != DMA_CHANNEL_FREE
429 && channel < MAX_BLACKFIN_DMA_CHANNEL));
430
431 return dma_ch[channel].regs->curr_x_count;
432}
433EXPORT_SYMBOL(get_dma_curr_xcount);
434
435/*------------------------------------------------------------------------------
436 * Get current DMA ycount of a specific DMA channel from the system.
437 *-----------------------------------------------------------------------------*/
438unsigned short get_dma_curr_ycount(unsigned int channel)
439{
440 BUG_ON(!(dma_ch[channel].chan_status != DMA_CHANNEL_FREE
441 && channel < MAX_BLACKFIN_DMA_CHANNEL));
442
443 return dma_ch[channel].regs->curr_y_count;
444}
445EXPORT_SYMBOL(get_dma_curr_ycount);
446
447unsigned long get_dma_next_desc_ptr(unsigned int channel)
448{
449 BUG_ON(!(dma_ch[channel].chan_status != DMA_CHANNEL_FREE
450 && channel < MAX_BLACKFIN_DMA_CHANNEL));
451
452 return dma_ch[channel].regs->next_desc_ptr;
453}
454EXPORT_SYMBOL(get_dma_next_desc_ptr);
455
456unsigned long get_dma_curr_desc_ptr(unsigned int channel)
457{
458 BUG_ON(!(dma_ch[channel].chan_status != DMA_CHANNEL_FREE
459 && channel < MAX_BLACKFIN_DMA_CHANNEL));
460
461 return dma_ch[channel].regs->curr_desc_ptr;
462}
463EXPORT_SYMBOL(get_dma_curr_desc_ptr);
464
465unsigned long get_dma_curr_addr(unsigned int channel)
466{
467 BUG_ON(!(dma_ch[channel].chan_status != DMA_CHANNEL_FREE
468 && channel < MAX_BLACKFIN_DMA_CHANNEL));
469
470 return dma_ch[channel].regs->curr_addr_ptr;
471}
472EXPORT_SYMBOL(get_dma_curr_addr);
473
474#ifdef CONFIG_PM 198#ifdef CONFIG_PM
199# ifndef MAX_DMA_SUSPEND_CHANNELS
200# define MAX_DMA_SUSPEND_CHANNELS MAX_DMA_CHANNELS
201# endif
475int blackfin_dma_suspend(void) 202int blackfin_dma_suspend(void)
476{ 203{
477 int i; 204 int i;
478 205
479#ifdef CONFIG_BF561 /* IMDMA channels doesn't have a PERIPHERAL_MAP */ 206 for (i = 0; i < MAX_DMA_SUSPEND_CHANNELS; ++i) {
480 for (i = 0; i <= CH_MEM_STREAM3_SRC; i++) {
481#else
482 for (i = 0; i < MAX_BLACKFIN_DMA_CHANNEL; i++) {
483#endif
484 if (dma_ch[i].chan_status == DMA_CHANNEL_ENABLED) { 207 if (dma_ch[i].chan_status == DMA_CHANNEL_ENABLED) {
485 printk(KERN_ERR "DMA Channel %d failed to suspend\n", i); 208 printk(KERN_ERR "DMA Channel %d failed to suspend\n", i);
486 return -EBUSY; 209 return -EBUSY;
@@ -495,388 +218,201 @@ int blackfin_dma_suspend(void)
495void blackfin_dma_resume(void) 218void blackfin_dma_resume(void)
496{ 219{
497 int i; 220 int i;
498 221 for (i = 0; i < MAX_DMA_SUSPEND_CHANNELS; ++i)
499#ifdef CONFIG_BF561 /* IMDMA channels doesn't have a PERIPHERAL_MAP */
500 for (i = 0; i <= CH_MEM_STREAM3_SRC; i++)
501#else
502 for (i = 0; i < MAX_BLACKFIN_DMA_CHANNEL; i++)
503#endif
504 dma_ch[i].regs->peripheral_map = dma_ch[i].saved_peripheral_map; 222 dma_ch[i].regs->peripheral_map = dma_ch[i].saved_peripheral_map;
505} 223}
506#endif 224#endif
507 225
508static void *__dma_memcpy(void *dest, const void *src, size_t size) 226/**
227 * blackfin_dma_early_init - minimal DMA init
228 *
229 * Setup a few DMA registers so we can safely do DMA transfers early on in
230 * the kernel booting process. Really this just means using dma_memcpy().
231 */
232void __init blackfin_dma_early_init(void)
509{ 233{
510 int direction; /* 1 - address decrease, 0 - address increase */
511 int flag_align; /* 1 - address aligned, 0 - address unaligned */
512 int flag_2D; /* 1 - 2D DMA needed, 0 - 1D DMA needed */
513 unsigned long flags;
514
515 if (size <= 0)
516 return NULL;
517
518 local_irq_save(flags);
519
520 if ((unsigned long)src < memory_end)
521 blackfin_dcache_flush_range((unsigned int)src,
522 (unsigned int)(src + size));
523
524 if ((unsigned long)dest < memory_end)
525 blackfin_dcache_invalidate_range((unsigned int)dest,
526 (unsigned int)(dest + size));
527
528 bfin_write_MDMA_D0_IRQ_STATUS(DMA_DONE | DMA_ERR);
529
530 if ((unsigned long)src < (unsigned long)dest)
531 direction = 1;
532 else
533 direction = 0;
534
535 if ((((unsigned long)dest % 2) == 0) && (((unsigned long)src % 2) == 0)
536 && ((size % 2) == 0))
537 flag_align = 1;
538 else
539 flag_align = 0;
540
541 if (size > 0x10000) /* size > 64K */
542 flag_2D = 1;
543 else
544 flag_2D = 0;
545
546 /* Setup destination and source start address */
547 if (direction) {
548 if (flag_align) {
549 bfin_write_MDMA_D0_START_ADDR(dest + size - 2);
550 bfin_write_MDMA_S0_START_ADDR(src + size - 2);
551 } else {
552 bfin_write_MDMA_D0_START_ADDR(dest + size - 1);
553 bfin_write_MDMA_S0_START_ADDR(src + size - 1);
554 }
555 } else {
556 bfin_write_MDMA_D0_START_ADDR(dest);
557 bfin_write_MDMA_S0_START_ADDR(src);
558 }
559
560 /* Setup destination and source xcount */
561 if (flag_2D) {
562 if (flag_align) {
563 bfin_write_MDMA_D0_X_COUNT(1024 / 2);
564 bfin_write_MDMA_S0_X_COUNT(1024 / 2);
565 } else {
566 bfin_write_MDMA_D0_X_COUNT(1024);
567 bfin_write_MDMA_S0_X_COUNT(1024);
568 }
569 bfin_write_MDMA_D0_Y_COUNT(size >> 10);
570 bfin_write_MDMA_S0_Y_COUNT(size >> 10);
571 } else {
572 if (flag_align) {
573 bfin_write_MDMA_D0_X_COUNT(size / 2);
574 bfin_write_MDMA_S0_X_COUNT(size / 2);
575 } else {
576 bfin_write_MDMA_D0_X_COUNT(size);
577 bfin_write_MDMA_S0_X_COUNT(size);
578 }
579 }
580
581 /* Setup destination and source xmodify and ymodify */
582 if (direction) {
583 if (flag_align) {
584 bfin_write_MDMA_D0_X_MODIFY(-2);
585 bfin_write_MDMA_S0_X_MODIFY(-2);
586 if (flag_2D) {
587 bfin_write_MDMA_D0_Y_MODIFY(-2);
588 bfin_write_MDMA_S0_Y_MODIFY(-2);
589 }
590 } else {
591 bfin_write_MDMA_D0_X_MODIFY(-1);
592 bfin_write_MDMA_S0_X_MODIFY(-1);
593 if (flag_2D) {
594 bfin_write_MDMA_D0_Y_MODIFY(-1);
595 bfin_write_MDMA_S0_Y_MODIFY(-1);
596 }
597 }
598 } else {
599 if (flag_align) {
600 bfin_write_MDMA_D0_X_MODIFY(2);
601 bfin_write_MDMA_S0_X_MODIFY(2);
602 if (flag_2D) {
603 bfin_write_MDMA_D0_Y_MODIFY(2);
604 bfin_write_MDMA_S0_Y_MODIFY(2);
605 }
606 } else {
607 bfin_write_MDMA_D0_X_MODIFY(1);
608 bfin_write_MDMA_S0_X_MODIFY(1);
609 if (flag_2D) {
610 bfin_write_MDMA_D0_Y_MODIFY(1);
611 bfin_write_MDMA_S0_Y_MODIFY(1);
612 }
613 }
614 }
615
616 /* Enable source DMA */
617 if (flag_2D) {
618 if (flag_align) {
619 bfin_write_MDMA_S0_CONFIG(DMAEN | DMA2D | WDSIZE_16);
620 bfin_write_MDMA_D0_CONFIG(WNR | DI_EN | DMAEN | DMA2D | WDSIZE_16);
621 } else {
622 bfin_write_MDMA_S0_CONFIG(DMAEN | DMA2D);
623 bfin_write_MDMA_D0_CONFIG(WNR | DI_EN | DMAEN | DMA2D);
624 }
625 } else {
626 if (flag_align) {
627 bfin_write_MDMA_S0_CONFIG(DMAEN | WDSIZE_16);
628 bfin_write_MDMA_D0_CONFIG(WNR | DI_EN | DMAEN | WDSIZE_16);
629 } else {
630 bfin_write_MDMA_S0_CONFIG(DMAEN);
631 bfin_write_MDMA_D0_CONFIG(WNR | DI_EN | DMAEN);
632 }
633 }
634
635 SSYNC();
636
637 while (!(bfin_read_MDMA_D0_IRQ_STATUS() & DMA_DONE))
638 ;
639
640 bfin_write_MDMA_D0_IRQ_STATUS(bfin_read_MDMA_D0_IRQ_STATUS() |
641 (DMA_DONE | DMA_ERR));
642
643 bfin_write_MDMA_S0_CONFIG(0); 234 bfin_write_MDMA_S0_CONFIG(0);
644 bfin_write_MDMA_D0_CONFIG(0);
645
646 local_irq_restore(flags);
647
648 return dest;
649} 235}
650 236
651void *dma_memcpy(void *dest, const void *src, size_t size) 237/**
652{ 238 * __dma_memcpy - program the MDMA registers
653 size_t bulk; 239 *
654 size_t rest; 240 * Actually program MDMA0 and wait for the transfer to finish. Disable IRQs
655 void * addr; 241 * while programming registers so that everything is fully configured. Wait
656 242 * for DMA to finish with IRQs enabled. If interrupted, the initial DMA_DONE
657 bulk = (size >> 16) << 16; 243 * check will make sure we don't clobber any existing transfer.
658 rest = size - bulk; 244 */
659 if (bulk) 245static void __dma_memcpy(u32 daddr, s16 dmod, u32 saddr, s16 smod, size_t cnt, u32 conf)
660 __dma_memcpy(dest, src, bulk);
661 addr = __dma_memcpy(dest+bulk, src+bulk, rest);
662 return addr;
663}
664EXPORT_SYMBOL(dma_memcpy);
665
666void *safe_dma_memcpy(void *dest, const void *src, size_t size)
667{
668 void *addr;
669 addr = dma_memcpy(dest, src, size);
670 return addr;
671}
672EXPORT_SYMBOL(safe_dma_memcpy);
673
674void dma_outsb(unsigned long addr, const void *buf, unsigned short len)
675{ 246{
247 static DEFINE_SPINLOCK(mdma_lock);
676 unsigned long flags; 248 unsigned long flags;
677 249
678 local_irq_save(flags); 250 spin_lock_irqsave(&mdma_lock, flags);
679 251
680 blackfin_dcache_flush_range((unsigned int)buf, 252 if (bfin_read_MDMA_S0_CONFIG())
681 (unsigned int)(buf) + len); 253 while (!(bfin_read_MDMA_D0_IRQ_STATUS() & DMA_DONE))
254 continue;
255
256 if (conf & DMA2D) {
257 /* For larger bit sizes, we've already divided down cnt so it
258 * is no longer a multiple of 64k. So we have to break down
259 * the limit here so it is a multiple of the incoming size.
260 * There is no limitation here in terms of total size other
261 * than the hardware though as the bits lost in the shift are
262 * made up by MODIFY (== we can hit the whole address space).
263 * X: (2^(16 - 0)) * 1 == (2^(16 - 1)) * 2 == (2^(16 - 2)) * 4
264 */
265 u32 shift = abs(dmod) >> 1;
266 size_t ycnt = cnt >> (16 - shift);
267 cnt = 1 << (16 - shift);
268 bfin_write_MDMA_D0_Y_COUNT(ycnt);
269 bfin_write_MDMA_S0_Y_COUNT(ycnt);
270 bfin_write_MDMA_D0_Y_MODIFY(dmod);
271 bfin_write_MDMA_S0_Y_MODIFY(smod);
272 }
682 273
683 bfin_write_MDMA_D0_START_ADDR(addr); 274 bfin_write_MDMA_D0_START_ADDR(daddr);
684 bfin_write_MDMA_D0_X_COUNT(len); 275 bfin_write_MDMA_D0_X_COUNT(cnt);
685 bfin_write_MDMA_D0_X_MODIFY(0); 276 bfin_write_MDMA_D0_X_MODIFY(dmod);
686 bfin_write_MDMA_D0_IRQ_STATUS(DMA_DONE | DMA_ERR); 277 bfin_write_MDMA_D0_IRQ_STATUS(DMA_DONE | DMA_ERR);
687 278
688 bfin_write_MDMA_S0_START_ADDR(buf); 279 bfin_write_MDMA_S0_START_ADDR(saddr);
689 bfin_write_MDMA_S0_X_COUNT(len); 280 bfin_write_MDMA_S0_X_COUNT(cnt);
690 bfin_write_MDMA_S0_X_MODIFY(1); 281 bfin_write_MDMA_S0_X_MODIFY(smod);
691 bfin_write_MDMA_S0_IRQ_STATUS(DMA_DONE | DMA_ERR); 282 bfin_write_MDMA_S0_IRQ_STATUS(DMA_DONE | DMA_ERR);
692 283
693 bfin_write_MDMA_S0_CONFIG(DMAEN | WDSIZE_8); 284 bfin_write_MDMA_S0_CONFIG(DMAEN | conf);
694 bfin_write_MDMA_D0_CONFIG(WNR | DI_EN | DMAEN | WDSIZE_8); 285 bfin_write_MDMA_D0_CONFIG(WNR | DI_EN | DMAEN | conf);
286
287 spin_unlock_irqrestore(&mdma_lock, flags);
695 288
696 SSYNC(); 289 SSYNC();
697 290
698 while (!(bfin_read_MDMA_D0_IRQ_STATUS() & DMA_DONE)); 291 while (!(bfin_read_MDMA_D0_IRQ_STATUS() & DMA_DONE))
292 if (bfin_read_MDMA_S0_CONFIG())
293 continue;
294 else
295 return;
699 296
700 bfin_write_MDMA_D0_IRQ_STATUS(DMA_DONE | DMA_ERR); 297 bfin_write_MDMA_D0_IRQ_STATUS(DMA_DONE | DMA_ERR);
701 298
702 bfin_write_MDMA_S0_CONFIG(0); 299 bfin_write_MDMA_S0_CONFIG(0);
703 bfin_write_MDMA_D0_CONFIG(0); 300 bfin_write_MDMA_D0_CONFIG(0);
704 local_irq_restore(flags);
705
706} 301}
707EXPORT_SYMBOL(dma_outsb);
708
709 302
710void dma_insb(unsigned long addr, void *buf, unsigned short len) 303/**
304 * _dma_memcpy - translate C memcpy settings into MDMA settings
305 *
306 * Handle all the high level steps before we touch the MDMA registers. So
307 * handle direction, tweaking of sizes, and formatting of addresses.
308 */
309static void *_dma_memcpy(void *pdst, const void *psrc, size_t size)
711{ 310{
712 unsigned long flags; 311 u32 conf, shift;
713 312 s16 mod;
714 blackfin_dcache_invalidate_range((unsigned int)buf, 313 unsigned long dst = (unsigned long)pdst;
715 (unsigned int)(buf) + len); 314 unsigned long src = (unsigned long)psrc;
716
717 local_irq_save(flags);
718 bfin_write_MDMA_D0_START_ADDR(buf);
719 bfin_write_MDMA_D0_X_COUNT(len);
720 bfin_write_MDMA_D0_X_MODIFY(1);
721 bfin_write_MDMA_D0_IRQ_STATUS(DMA_DONE | DMA_ERR);
722
723 bfin_write_MDMA_S0_START_ADDR(addr);
724 bfin_write_MDMA_S0_X_COUNT(len);
725 bfin_write_MDMA_S0_X_MODIFY(0);
726 bfin_write_MDMA_S0_IRQ_STATUS(DMA_DONE | DMA_ERR);
727 315
728 bfin_write_MDMA_S0_CONFIG(DMAEN | WDSIZE_8); 316 if (size == 0)
729 bfin_write_MDMA_D0_CONFIG(WNR | DI_EN | DMAEN | WDSIZE_8); 317 return NULL;
730 318
731 SSYNC(); 319 if (dst % 4 == 0 && src % 4 == 0 && size % 4 == 0) {
320 conf = WDSIZE_32;
321 shift = 2;
322 } else if (dst % 2 == 0 && src % 2 == 0 && size % 2 == 0) {
323 conf = WDSIZE_16;
324 shift = 1;
325 } else {
326 conf = WDSIZE_8;
327 shift = 0;
328 }
732 329
733 while (!(bfin_read_MDMA_D0_IRQ_STATUS() & DMA_DONE)); 330 /* If the two memory regions have a chance of overlapping, make
331 * sure the memcpy still works as expected. Do this by having the
332 * copy run backwards instead.
333 */
334 mod = 1 << shift;
335 if (src < dst) {
336 mod *= -1;
337 dst += size + mod;
338 src += size + mod;
339 }
340 size >>= shift;
734 341
735 bfin_write_MDMA_D0_IRQ_STATUS(DMA_DONE | DMA_ERR); 342 if (size > 0x10000)
343 conf |= DMA2D;
736 344
737 bfin_write_MDMA_S0_CONFIG(0); 345 __dma_memcpy(dst, mod, src, mod, size, conf);
738 bfin_write_MDMA_D0_CONFIG(0);
739 local_irq_restore(flags);
740 346
347 return pdst;
741} 348}
742EXPORT_SYMBOL(dma_insb);
743 349
744void dma_outsw(unsigned long addr, const void *buf, unsigned short len) 350/**
351 * dma_memcpy - DMA memcpy under mutex lock
352 *
353 * Do not check arguments before starting the DMA memcpy. Break the transfer
354 * up into two pieces. The first transfer is in multiples of 64k and the
355 * second transfer is the piece smaller than 64k.
356 */
357void *dma_memcpy(void *pdst, const void *psrc, size_t size)
745{ 358{
746 unsigned long flags; 359 unsigned long dst = (unsigned long)pdst;
747 360 unsigned long src = (unsigned long)psrc;
748 local_irq_save(flags); 361 size_t bulk, rest;
749 362
750 blackfin_dcache_flush_range((unsigned int)buf, 363 if (bfin_addr_dcachable(src))
751 (unsigned int)(buf) + len * sizeof(short)); 364 blackfin_dcache_flush_range(src, src + size);
752 365
753 bfin_write_MDMA_D0_START_ADDR(addr); 366 if (bfin_addr_dcachable(dst))
754 bfin_write_MDMA_D0_X_COUNT(len); 367 blackfin_dcache_invalidate_range(dst, dst + size);
755 bfin_write_MDMA_D0_X_MODIFY(0);
756 bfin_write_MDMA_D0_IRQ_STATUS(DMA_DONE | DMA_ERR);
757
758 bfin_write_MDMA_S0_START_ADDR(buf);
759 bfin_write_MDMA_S0_X_COUNT(len);
760 bfin_write_MDMA_S0_X_MODIFY(2);
761 bfin_write_MDMA_S0_IRQ_STATUS(DMA_DONE | DMA_ERR);
762
763 bfin_write_MDMA_S0_CONFIG(DMAEN | WDSIZE_16);
764 bfin_write_MDMA_D0_CONFIG(WNR | DI_EN | DMAEN | WDSIZE_16);
765
766 SSYNC();
767
768 while (!(bfin_read_MDMA_D0_IRQ_STATUS() & DMA_DONE));
769
770 bfin_write_MDMA_D0_IRQ_STATUS(DMA_DONE | DMA_ERR);
771
772 bfin_write_MDMA_S0_CONFIG(0);
773 bfin_write_MDMA_D0_CONFIG(0);
774 local_irq_restore(flags);
775 368
369 bulk = size & ~0xffff;
370 rest = size - bulk;
371 if (bulk)
372 _dma_memcpy(pdst, psrc, bulk);
373 _dma_memcpy(pdst + bulk, psrc + bulk, rest);
374 return pdst;
776} 375}
777EXPORT_SYMBOL(dma_outsw); 376EXPORT_SYMBOL(dma_memcpy);
778 377
779void dma_insw(unsigned long addr, void *buf, unsigned short len) 378/**
379 * safe_dma_memcpy - DMA memcpy w/argument checking
380 *
381 * Verify arguments are safe before heading to dma_memcpy().
382 */
383void *safe_dma_memcpy(void *dst, const void *src, size_t size)
780{ 384{
781 unsigned long flags; 385 if (!access_ok(VERIFY_WRITE, dst, size))
782 386 return NULL;
783 blackfin_dcache_invalidate_range((unsigned int)buf, 387 if (!access_ok(VERIFY_READ, src, size))
784 (unsigned int)(buf) + len * sizeof(short)); 388 return NULL;
785 389 return dma_memcpy(dst, src, size);
786 local_irq_save(flags);
787
788 bfin_write_MDMA_D0_START_ADDR(buf);
789 bfin_write_MDMA_D0_X_COUNT(len);
790 bfin_write_MDMA_D0_X_MODIFY(2);
791 bfin_write_MDMA_D0_IRQ_STATUS(DMA_DONE | DMA_ERR);
792
793 bfin_write_MDMA_S0_START_ADDR(addr);
794 bfin_write_MDMA_S0_X_COUNT(len);
795 bfin_write_MDMA_S0_X_MODIFY(0);
796 bfin_write_MDMA_S0_IRQ_STATUS(DMA_DONE | DMA_ERR);
797
798 bfin_write_MDMA_S0_CONFIG(DMAEN | WDSIZE_16);
799 bfin_write_MDMA_D0_CONFIG(WNR | DI_EN | DMAEN | WDSIZE_16);
800
801 SSYNC();
802
803 while (!(bfin_read_MDMA_D0_IRQ_STATUS() & DMA_DONE));
804
805 bfin_write_MDMA_D0_IRQ_STATUS(DMA_DONE | DMA_ERR);
806
807 bfin_write_MDMA_S0_CONFIG(0);
808 bfin_write_MDMA_D0_CONFIG(0);
809 local_irq_restore(flags);
810
811} 390}
812EXPORT_SYMBOL(dma_insw); 391EXPORT_SYMBOL(safe_dma_memcpy);
813 392
814void dma_outsl(unsigned long addr, const void *buf, unsigned short len) 393static void _dma_out(unsigned long addr, unsigned long buf, unsigned short len,
394 u16 size, u16 dma_size)
815{ 395{
816 unsigned long flags; 396 blackfin_dcache_flush_range(buf, buf + len * size);
817 397 __dma_memcpy(addr, 0, buf, size, len, dma_size);
818 local_irq_save(flags);
819
820 blackfin_dcache_flush_range((unsigned int)buf,
821 (unsigned int)(buf) + len * sizeof(long));
822
823 bfin_write_MDMA_D0_START_ADDR(addr);
824 bfin_write_MDMA_D0_X_COUNT(len);
825 bfin_write_MDMA_D0_X_MODIFY(0);
826 bfin_write_MDMA_D0_IRQ_STATUS(DMA_DONE | DMA_ERR);
827
828 bfin_write_MDMA_S0_START_ADDR(buf);
829 bfin_write_MDMA_S0_X_COUNT(len);
830 bfin_write_MDMA_S0_X_MODIFY(4);
831 bfin_write_MDMA_S0_IRQ_STATUS(DMA_DONE | DMA_ERR);
832
833 bfin_write_MDMA_S0_CONFIG(DMAEN | WDSIZE_32);
834 bfin_write_MDMA_D0_CONFIG(WNR | DI_EN | DMAEN | WDSIZE_32);
835
836 SSYNC();
837
838 while (!(bfin_read_MDMA_D0_IRQ_STATUS() & DMA_DONE));
839
840 bfin_write_MDMA_D0_IRQ_STATUS(DMA_DONE | DMA_ERR);
841
842 bfin_write_MDMA_S0_CONFIG(0);
843 bfin_write_MDMA_D0_CONFIG(0);
844 local_irq_restore(flags);
845
846} 398}
847EXPORT_SYMBOL(dma_outsl);
848 399
849void dma_insl(unsigned long addr, void *buf, unsigned short len) 400static void _dma_in(unsigned long addr, unsigned long buf, unsigned short len,
401 u16 size, u16 dma_size)
850{ 402{
851 unsigned long flags; 403 blackfin_dcache_invalidate_range(buf, buf + len * size);
852 404 __dma_memcpy(buf, size, addr, 0, len, dma_size);
853 blackfin_dcache_invalidate_range((unsigned int)buf,
854 (unsigned int)(buf) + len * sizeof(long));
855
856 local_irq_save(flags);
857
858 bfin_write_MDMA_D0_START_ADDR(buf);
859 bfin_write_MDMA_D0_X_COUNT(len);
860 bfin_write_MDMA_D0_X_MODIFY(4);
861 bfin_write_MDMA_D0_IRQ_STATUS(DMA_DONE | DMA_ERR);
862
863 bfin_write_MDMA_S0_START_ADDR(addr);
864 bfin_write_MDMA_S0_X_COUNT(len);
865 bfin_write_MDMA_S0_X_MODIFY(0);
866 bfin_write_MDMA_S0_IRQ_STATUS(DMA_DONE | DMA_ERR);
867
868 bfin_write_MDMA_S0_CONFIG(DMAEN | WDSIZE_32);
869 bfin_write_MDMA_D0_CONFIG(WNR | DI_EN | DMAEN | WDSIZE_32);
870
871 SSYNC();
872
873 while (!(bfin_read_MDMA_D0_IRQ_STATUS() & DMA_DONE));
874
875 bfin_write_MDMA_D0_IRQ_STATUS(DMA_DONE | DMA_ERR);
876
877 bfin_write_MDMA_S0_CONFIG(0);
878 bfin_write_MDMA_D0_CONFIG(0);
879 local_irq_restore(flags);
880
881} 405}
882EXPORT_SYMBOL(dma_insl); 406
407#define MAKE_DMA_IO(io, bwl, isize, dmasize, cnst) \
408void dma_##io##s##bwl(unsigned long addr, cnst void *buf, unsigned short len) \
409{ \
410 _dma_##io(addr, (unsigned long)buf, len, isize, WDSIZE_##dmasize); \
411} \
412EXPORT_SYMBOL(dma_##io##s##bwl)
413MAKE_DMA_IO(out, b, 1, 8, const);
414MAKE_DMA_IO(in, b, 1, 8, );
415MAKE_DMA_IO(out, w, 2, 16, const);
416MAKE_DMA_IO(in, w, 2, 16, );
417MAKE_DMA_IO(out, l, 4, 32, const);
418MAKE_DMA_IO(in, l, 4, 32, );
diff --git a/arch/blackfin/kernel/bfin_gpio.c b/arch/blackfin/kernel/bfin_gpio.c
index 5c0800adb4dd..4c14331978f6 100644
--- a/arch/blackfin/kernel/bfin_gpio.c
+++ b/arch/blackfin/kernel/bfin_gpio.c
@@ -119,28 +119,28 @@ enum {
119#define AWA_DUMMY_READ(...) do { } while (0) 119#define AWA_DUMMY_READ(...) do { } while (0)
120#endif 120#endif
121 121
122#ifdef BF533_FAMILY 122#if defined(BF533_FAMILY) || defined(BF538_FAMILY)
123static struct gpio_port_t *gpio_bankb[gpio_bank(MAX_BLACKFIN_GPIOS)] = { 123static struct gpio_port_t *gpio_bankb[] = {
124 (struct gpio_port_t *) FIO_FLAG_D, 124 (struct gpio_port_t *) FIO_FLAG_D,
125}; 125};
126#endif 126#endif
127 127
128#if defined(BF527_FAMILY) || defined(BF537_FAMILY) 128#if defined(BF527_FAMILY) || defined(BF537_FAMILY) || defined(BF518_FAMILY)
129static struct gpio_port_t *gpio_bankb[gpio_bank(MAX_BLACKFIN_GPIOS)] = { 129static struct gpio_port_t *gpio_bankb[] = {
130 (struct gpio_port_t *) PORTFIO, 130 (struct gpio_port_t *) PORTFIO,
131 (struct gpio_port_t *) PORTGIO, 131 (struct gpio_port_t *) PORTGIO,
132 (struct gpio_port_t *) PORTHIO, 132 (struct gpio_port_t *) PORTHIO,
133}; 133};
134 134
135static unsigned short *port_fer[gpio_bank(MAX_BLACKFIN_GPIOS)] = { 135static unsigned short *port_fer[] = {
136 (unsigned short *) PORTF_FER, 136 (unsigned short *) PORTF_FER,
137 (unsigned short *) PORTG_FER, 137 (unsigned short *) PORTG_FER,
138 (unsigned short *) PORTH_FER, 138 (unsigned short *) PORTH_FER,
139}; 139};
140#endif 140#endif
141 141
142#ifdef BF527_FAMILY 142#if defined(BF527_FAMILY) || defined(BF518_FAMILY)
143static unsigned short *port_mux[gpio_bank(MAX_BLACKFIN_GPIOS)] = { 143static unsigned short *port_mux[] = {
144 (unsigned short *) PORTF_MUX, 144 (unsigned short *) PORTF_MUX,
145 (unsigned short *) PORTG_MUX, 145 (unsigned short *) PORTG_MUX,
146 (unsigned short *) PORTH_MUX, 146 (unsigned short *) PORTH_MUX,
@@ -155,7 +155,7 @@ u8 pmux_offset[][16] =
155#endif 155#endif
156 156
157#ifdef BF561_FAMILY 157#ifdef BF561_FAMILY
158static struct gpio_port_t *gpio_bankb[gpio_bank(MAX_BLACKFIN_GPIOS)] = { 158static struct gpio_port_t *gpio_bankb[] = {
159 (struct gpio_port_t *) FIO0_FLAG_D, 159 (struct gpio_port_t *) FIO0_FLAG_D,
160 (struct gpio_port_t *) FIO1_FLAG_D, 160 (struct gpio_port_t *) FIO1_FLAG_D,
161 (struct gpio_port_t *) FIO2_FLAG_D, 161 (struct gpio_port_t *) FIO2_FLAG_D,
@@ -163,7 +163,7 @@ static struct gpio_port_t *gpio_bankb[gpio_bank(MAX_BLACKFIN_GPIOS)] = {
163#endif 163#endif
164 164
165#ifdef BF548_FAMILY 165#ifdef BF548_FAMILY
166static struct gpio_port_t *gpio_array[gpio_bank(MAX_BLACKFIN_GPIOS)] = { 166static struct gpio_port_t *gpio_array[] = {
167 (struct gpio_port_t *)PORTA_FER, 167 (struct gpio_port_t *)PORTA_FER,
168 (struct gpio_port_t *)PORTB_FER, 168 (struct gpio_port_t *)PORTB_FER,
169 (struct gpio_port_t *)PORTC_FER, 169 (struct gpio_port_t *)PORTC_FER,
@@ -177,8 +177,9 @@ static struct gpio_port_t *gpio_array[gpio_bank(MAX_BLACKFIN_GPIOS)] = {
177}; 177};
178#endif 178#endif
179 179
180static unsigned short reserved_gpio_map[gpio_bank(MAX_BLACKFIN_GPIOS)]; 180static unsigned short reserved_gpio_map[GPIO_BANK_NUM];
181static unsigned short reserved_peri_map[gpio_bank(MAX_RESOURCES)]; 181static unsigned short reserved_peri_map[gpio_bank(MAX_RESOURCES)];
182static unsigned short reserved_gpio_irq_map[GPIO_BANK_NUM];
182 183
183#define RESOURCE_LABEL_SIZE 16 184#define RESOURCE_LABEL_SIZE 16
184 185
@@ -188,48 +189,46 @@ static struct str_ident {
188 189
189#if defined(CONFIG_PM) 190#if defined(CONFIG_PM)
190#if defined(CONFIG_BF54x) 191#if defined(CONFIG_BF54x)
191static struct gpio_port_s gpio_bank_saved[gpio_bank(MAX_BLACKFIN_GPIOS)]; 192static struct gpio_port_s gpio_bank_saved[GPIO_BANK_NUM];
192#else 193#else
193static unsigned short wakeup_map[gpio_bank(MAX_BLACKFIN_GPIOS)]; 194static unsigned short wakeup_map[GPIO_BANK_NUM];
194static unsigned char wakeup_flags_map[MAX_BLACKFIN_GPIOS]; 195static unsigned char wakeup_flags_map[MAX_BLACKFIN_GPIOS];
195static struct gpio_port_s gpio_bank_saved[gpio_bank(MAX_BLACKFIN_GPIOS)]; 196static struct gpio_port_s gpio_bank_saved[GPIO_BANK_NUM];
196 197
197#ifdef BF533_FAMILY 198#ifdef BF533_FAMILY
198static unsigned int sic_iwr_irqs[gpio_bank(MAX_BLACKFIN_GPIOS)] = {IRQ_PROG_INTB}; 199static unsigned int sic_iwr_irqs[] = {IRQ_PROG_INTB};
199#endif 200#endif
200 201
201#ifdef BF537_FAMILY 202#ifdef BF537_FAMILY
202static unsigned int sic_iwr_irqs[gpio_bank(MAX_BLACKFIN_GPIOS)] = {IRQ_PROG_INTB, IRQ_PORTG_INTB, IRQ_MAC_TX}; 203static unsigned int sic_iwr_irqs[] = {IRQ_PROG_INTB, IRQ_PORTG_INTB, IRQ_MAC_TX};
204#endif
205
206#ifdef BF538_FAMILY
207static unsigned int sic_iwr_irqs[] = {IRQ_PORTF_INTB};
203#endif 208#endif
204 209
205#ifdef BF527_FAMILY 210#if defined(BF527_FAMILY) || defined(BF518_FAMILY)
206static unsigned int sic_iwr_irqs[gpio_bank(MAX_BLACKFIN_GPIOS)] = {IRQ_PORTF_INTB, IRQ_PORTG_INTB, IRQ_PORTH_INTB}; 211static unsigned int sic_iwr_irqs[] = {IRQ_PORTF_INTB, IRQ_PORTG_INTB, IRQ_PORTH_INTB};
207#endif 212#endif
208 213
209#ifdef BF561_FAMILY 214#ifdef BF561_FAMILY
210static unsigned int sic_iwr_irqs[gpio_bank(MAX_BLACKFIN_GPIOS)] = {IRQ_PROG0_INTB, IRQ_PROG1_INTB, IRQ_PROG2_INTB}; 215static unsigned int sic_iwr_irqs[] = {IRQ_PROG0_INTB, IRQ_PROG1_INTB, IRQ_PROG2_INTB};
211#endif 216#endif
212#endif 217#endif
213#endif /* CONFIG_PM */ 218#endif /* CONFIG_PM */
214 219
215#if defined(BF548_FAMILY)
216inline int check_gpio(unsigned gpio) 220inline int check_gpio(unsigned gpio)
217{ 221{
222#if defined(BF548_FAMILY)
218 if (gpio == GPIO_PB15 || gpio == GPIO_PC14 || gpio == GPIO_PC15 223 if (gpio == GPIO_PB15 || gpio == GPIO_PC14 || gpio == GPIO_PC15
219 || gpio == GPIO_PH14 || gpio == GPIO_PH15 224 || gpio == GPIO_PH14 || gpio == GPIO_PH15
220 || gpio == GPIO_PJ14 || gpio == GPIO_PJ15 225 || gpio == GPIO_PJ14 || gpio == GPIO_PJ15)
221 || gpio >= MAX_BLACKFIN_GPIOS)
222 return -EINVAL; 226 return -EINVAL;
223 return 0; 227#endif
224}
225#else
226inline int check_gpio(unsigned gpio)
227{
228 if (gpio >= MAX_BLACKFIN_GPIOS) 228 if (gpio >= MAX_BLACKFIN_GPIOS)
229 return -EINVAL; 229 return -EINVAL;
230 return 0; 230 return 0;
231} 231}
232#endif
233 232
234static void gpio_error(unsigned gpio) 233static void gpio_error(unsigned gpio)
235{ 234{
@@ -258,35 +257,30 @@ static int cmp_label(unsigned short ident, const char *label)
258 } 257 }
259 258
260 if (label) 259 if (label)
261 return strncmp(str_ident[ident].name, 260 return strcmp(str_ident[ident].name, label);
262 label, strlen(label));
263 else 261 else
264 return -EINVAL; 262 return -EINVAL;
265} 263}
266 264
267#if defined(BF527_FAMILY) || defined(BF537_FAMILY)
268static void port_setup(unsigned gpio, unsigned short usage) 265static void port_setup(unsigned gpio, unsigned short usage)
269{ 266{
270 if (!check_gpio(gpio)) { 267 if (check_gpio(gpio))
271 if (usage == GPIO_USAGE) 268 return;
272 *port_fer[gpio_bank(gpio)] &= ~gpio_bit(gpio); 269
273 else 270#if defined(BF527_FAMILY) || defined(BF537_FAMILY) || defined(BF518_FAMILY)
274 *port_fer[gpio_bank(gpio)] |= gpio_bit(gpio); 271 if (usage == GPIO_USAGE)
275 SSYNC(); 272 *port_fer[gpio_bank(gpio)] &= ~gpio_bit(gpio);
276 } 273 else
277} 274 *port_fer[gpio_bank(gpio)] |= gpio_bit(gpio);
275 SSYNC();
278#elif defined(BF548_FAMILY) 276#elif defined(BF548_FAMILY)
279static void port_setup(unsigned gpio, unsigned short usage)
280{
281 if (usage == GPIO_USAGE) 277 if (usage == GPIO_USAGE)
282 gpio_array[gpio_bank(gpio)]->port_fer &= ~gpio_bit(gpio); 278 gpio_array[gpio_bank(gpio)]->port_fer &= ~gpio_bit(gpio);
283 else 279 else
284 gpio_array[gpio_bank(gpio)]->port_fer |= gpio_bit(gpio); 280 gpio_array[gpio_bank(gpio)]->port_fer |= gpio_bit(gpio);
285 SSYNC(); 281 SSYNC();
286}
287#else
288# define port_setup(...) do { } while (0)
289#endif 282#endif
283}
290 284
291#ifdef BF537_FAMILY 285#ifdef BF537_FAMILY
292static struct { 286static struct {
@@ -379,7 +373,7 @@ inline u16 get_portmux(unsigned short portno)
379 373
380 return (pmux >> (2 * gpio_sub_n(portno)) & 0x3); 374 return (pmux >> (2 * gpio_sub_n(portno)) & 0x3);
381} 375}
382#elif defined(BF527_FAMILY) 376#elif defined(BF527_FAMILY) || defined(BF518_FAMILY)
383inline void portmux_setup(unsigned short portno, unsigned short function) 377inline void portmux_setup(unsigned short portno, unsigned short function)
384{ 378{
385 u16 pmux, ident = P_IDENT(portno); 379 u16 pmux, ident = P_IDENT(portno);
@@ -428,13 +422,13 @@ arch_initcall(bfin_gpio_init);
428void set_gpio_ ## name(unsigned gpio, unsigned short arg) \ 422void set_gpio_ ## name(unsigned gpio, unsigned short arg) \
429{ \ 423{ \
430 unsigned long flags; \ 424 unsigned long flags; \
431 local_irq_save(flags); \ 425 local_irq_save_hw(flags); \
432 if (arg) \ 426 if (arg) \
433 gpio_bankb[gpio_bank(gpio)]->name |= gpio_bit(gpio); \ 427 gpio_bankb[gpio_bank(gpio)]->name |= gpio_bit(gpio); \
434 else \ 428 else \
435 gpio_bankb[gpio_bank(gpio)]->name &= ~gpio_bit(gpio); \ 429 gpio_bankb[gpio_bank(gpio)]->name &= ~gpio_bit(gpio); \
436 AWA_DUMMY_READ(name); \ 430 AWA_DUMMY_READ(name); \
437 local_irq_restore(flags); \ 431 local_irq_restore_hw(flags); \
438} \ 432} \
439EXPORT_SYMBOL(set_gpio_ ## name); 433EXPORT_SYMBOL(set_gpio_ ## name);
440 434
@@ -450,13 +444,13 @@ SET_GPIO(both)
450void set_gpio_ ## name(unsigned gpio, unsigned short arg) \ 444void set_gpio_ ## name(unsigned gpio, unsigned short arg) \
451{ \ 445{ \
452 unsigned long flags; \ 446 unsigned long flags; \
453 local_irq_save(flags); \ 447 local_irq_save_hw(flags); \
454 if (arg) \ 448 if (arg) \
455 gpio_bankb[gpio_bank(gpio)]->name ## _set = gpio_bit(gpio); \ 449 gpio_bankb[gpio_bank(gpio)]->name ## _set = gpio_bit(gpio); \
456 else \ 450 else \
457 gpio_bankb[gpio_bank(gpio)]->name ## _clear = gpio_bit(gpio); \ 451 gpio_bankb[gpio_bank(gpio)]->name ## _clear = gpio_bit(gpio); \
458 AWA_DUMMY_READ(name); \ 452 AWA_DUMMY_READ(name); \
459 local_irq_restore(flags); \ 453 local_irq_restore_hw(flags); \
460} \ 454} \
461EXPORT_SYMBOL(set_gpio_ ## name); 455EXPORT_SYMBOL(set_gpio_ ## name);
462#else 456#else
@@ -479,10 +473,10 @@ SET_GPIO_SC(data)
479void set_gpio_toggle(unsigned gpio) 473void set_gpio_toggle(unsigned gpio)
480{ 474{
481 unsigned long flags; 475 unsigned long flags;
482 local_irq_save(flags); 476 local_irq_save_hw(flags);
483 gpio_bankb[gpio_bank(gpio)]->toggle = gpio_bit(gpio); 477 gpio_bankb[gpio_bank(gpio)]->toggle = gpio_bit(gpio);
484 AWA_DUMMY_READ(toggle); 478 AWA_DUMMY_READ(toggle);
485 local_irq_restore(flags); 479 local_irq_restore_hw(flags);
486} 480}
487#else 481#else
488void set_gpio_toggle(unsigned gpio) 482void set_gpio_toggle(unsigned gpio)
@@ -500,10 +494,10 @@ EXPORT_SYMBOL(set_gpio_toggle);
500void set_gpiop_ ## name(unsigned gpio, unsigned short arg) \ 494void set_gpiop_ ## name(unsigned gpio, unsigned short arg) \
501{ \ 495{ \
502 unsigned long flags; \ 496 unsigned long flags; \
503 local_irq_save(flags); \ 497 local_irq_save_hw(flags); \
504 gpio_bankb[gpio_bank(gpio)]->name = arg; \ 498 gpio_bankb[gpio_bank(gpio)]->name = arg; \
505 AWA_DUMMY_READ(name); \ 499 AWA_DUMMY_READ(name); \
506 local_irq_restore(flags); \ 500 local_irq_restore_hw(flags); \
507} \ 501} \
508EXPORT_SYMBOL(set_gpiop_ ## name); 502EXPORT_SYMBOL(set_gpiop_ ## name);
509#else 503#else
@@ -531,10 +525,10 @@ unsigned short get_gpio_ ## name(unsigned gpio) \
531{ \ 525{ \
532 unsigned long flags; \ 526 unsigned long flags; \
533 unsigned short ret; \ 527 unsigned short ret; \
534 local_irq_save(flags); \ 528 local_irq_save_hw(flags); \
535 ret = 0x01 & (gpio_bankb[gpio_bank(gpio)]->name >> gpio_sub_n(gpio)); \ 529 ret = 0x01 & (gpio_bankb[gpio_bank(gpio)]->name >> gpio_sub_n(gpio)); \
536 AWA_DUMMY_READ(name); \ 530 AWA_DUMMY_READ(name); \
537 local_irq_restore(flags); \ 531 local_irq_restore_hw(flags); \
538 return ret; \ 532 return ret; \
539} \ 533} \
540EXPORT_SYMBOL(get_gpio_ ## name); 534EXPORT_SYMBOL(get_gpio_ ## name);
@@ -564,10 +558,10 @@ unsigned short get_gpiop_ ## name(unsigned gpio) \
564{ \ 558{ \
565 unsigned long flags; \ 559 unsigned long flags; \
566 unsigned short ret; \ 560 unsigned short ret; \
567 local_irq_save(flags); \ 561 local_irq_save_hw(flags); \
568 ret = (gpio_bankb[gpio_bank(gpio)]->name); \ 562 ret = (gpio_bankb[gpio_bank(gpio)]->name); \
569 AWA_DUMMY_READ(name); \ 563 AWA_DUMMY_READ(name); \
570 local_irq_restore(flags); \ 564 local_irq_restore_hw(flags); \
571 return ret; \ 565 return ret; \
572} \ 566} \
573EXPORT_SYMBOL(get_gpiop_ ## name); 567EXPORT_SYMBOL(get_gpiop_ ## name);
@@ -617,10 +611,10 @@ int gpio_pm_wakeup_request(unsigned gpio, unsigned char type)
617 if ((check_gpio(gpio) < 0) || !type) 611 if ((check_gpio(gpio) < 0) || !type)
618 return -EINVAL; 612 return -EINVAL;
619 613
620 local_irq_save(flags); 614 local_irq_save_hw(flags);
621 wakeup_map[gpio_bank(gpio)] |= gpio_bit(gpio); 615 wakeup_map[gpio_bank(gpio)] |= gpio_bit(gpio);
622 wakeup_flags_map[gpio] = type; 616 wakeup_flags_map[gpio] = type;
623 local_irq_restore(flags); 617 local_irq_restore_hw(flags);
624 618
625 return 0; 619 return 0;
626} 620}
@@ -633,11 +627,11 @@ void gpio_pm_wakeup_free(unsigned gpio)
633 if (check_gpio(gpio) < 0) 627 if (check_gpio(gpio) < 0)
634 return; 628 return;
635 629
636 local_irq_save(flags); 630 local_irq_save_hw(flags);
637 631
638 wakeup_map[gpio_bank(gpio)] &= ~gpio_bit(gpio); 632 wakeup_map[gpio_bank(gpio)] &= ~gpio_bit(gpio);
639 633
640 local_irq_restore(flags); 634 local_irq_restore_hw(flags);
641} 635}
642EXPORT_SYMBOL(gpio_pm_wakeup_free); 636EXPORT_SYMBOL(gpio_pm_wakeup_free);
643 637
@@ -679,7 +673,7 @@ u32 bfin_pm_standby_setup(void)
679 gpio_bankb[bank]->maskb = 0; 673 gpio_bankb[bank]->maskb = 0;
680 674
681 if (mask) { 675 if (mask) {
682#if defined(BF527_FAMILY) || defined(BF537_FAMILY) 676#if defined(BF527_FAMILY) || defined(BF537_FAMILY) || defined(BF518_FAMILY)
683 gpio_bank_saved[bank].fer = *port_fer[bank]; 677 gpio_bank_saved[bank].fer = *port_fer[bank];
684#endif 678#endif
685 gpio_bank_saved[bank].inen = gpio_bankb[bank]->inen; 679 gpio_bank_saved[bank].inen = gpio_bankb[bank]->inen;
@@ -724,7 +718,7 @@ void bfin_pm_standby_restore(void)
724 bank = gpio_bank(i); 718 bank = gpio_bank(i);
725 719
726 if (mask) { 720 if (mask) {
727#if defined(BF527_FAMILY) || defined(BF537_FAMILY) 721#if defined(BF527_FAMILY) || defined(BF537_FAMILY) || defined(BF518_FAMILY)
728 *port_fer[bank] = gpio_bank_saved[bank].fer; 722 *port_fer[bank] = gpio_bank_saved[bank].fer;
729#endif 723#endif
730 gpio_bankb[bank]->inen = gpio_bank_saved[bank].inen; 724 gpio_bankb[bank]->inen = gpio_bank_saved[bank].inen;
@@ -750,9 +744,9 @@ void bfin_gpio_pm_hibernate_suspend(void)
750 for (i = 0; i < MAX_BLACKFIN_GPIOS; i += GPIO_BANKSIZE) { 744 for (i = 0; i < MAX_BLACKFIN_GPIOS; i += GPIO_BANKSIZE) {
751 bank = gpio_bank(i); 745 bank = gpio_bank(i);
752 746
753#if defined(BF527_FAMILY) || defined(BF537_FAMILY) 747#if defined(BF527_FAMILY) || defined(BF537_FAMILY) || defined(BF518_FAMILY)
754 gpio_bank_saved[bank].fer = *port_fer[bank]; 748 gpio_bank_saved[bank].fer = *port_fer[bank];
755#ifdef BF527_FAMILY 749#if defined(BF527_FAMILY) || defined(BF518_FAMILY)
756 gpio_bank_saved[bank].mux = *port_mux[bank]; 750 gpio_bank_saved[bank].mux = *port_mux[bank];
757#else 751#else
758 if (bank == 0) 752 if (bank == 0)
@@ -778,8 +772,8 @@ void bfin_gpio_pm_hibernate_restore(void)
778 for (i = 0; i < MAX_BLACKFIN_GPIOS; i += GPIO_BANKSIZE) { 772 for (i = 0; i < MAX_BLACKFIN_GPIOS; i += GPIO_BANKSIZE) {
779 bank = gpio_bank(i); 773 bank = gpio_bank(i);
780 774
781#if defined(BF527_FAMILY) || defined(BF537_FAMILY) 775#if defined(BF527_FAMILY) || defined(BF537_FAMILY) || defined(BF518_FAMILY)
782#ifdef BF527_FAMILY 776#if defined(BF527_FAMILY) || defined(BF518_FAMILY)
783 *port_mux[bank] = gpio_bank_saved[bank].mux; 777 *port_mux[bank] = gpio_bank_saved[bank].mux;
784#else 778#else
785 if (bank == 0) 779 if (bank == 0)
@@ -873,7 +867,6 @@ EXPORT_SYMBOL(get_gpio_dir);
873* MODIFICATION HISTORY : 867* MODIFICATION HISTORY :
874**************************************************************/ 868**************************************************************/
875 869
876#ifdef BF548_FAMILY
877int peripheral_request(unsigned short per, const char *label) 870int peripheral_request(unsigned short per, const char *label)
878{ 871{
879 unsigned long flags; 872 unsigned long flags;
@@ -889,31 +882,35 @@ int peripheral_request(unsigned short per, const char *label)
889 if (!(per & P_DEFINED)) 882 if (!(per & P_DEFINED))
890 return -ENODEV; 883 return -ENODEV;
891 884
892 if (check_gpio(ident) < 0) 885 local_irq_save_hw(flags);
893 return -EINVAL;
894 886
895 local_irq_save(flags); 887 /* If a pin can be muxed as either GPIO or peripheral, make
896 888 * sure it is not already a GPIO pin when we request it.
897 if (unlikely(reserved_gpio_map[gpio_bank(ident)] & gpio_bit(ident))) { 889 */
890 if (unlikely(!check_gpio(ident) &&
891 reserved_gpio_map[gpio_bank(ident)] & gpio_bit(ident))) {
898 dump_stack(); 892 dump_stack();
899 printk(KERN_ERR 893 printk(KERN_ERR
900 "%s: Peripheral %d is already reserved as GPIO by %s !\n", 894 "%s: Peripheral %d is already reserved as GPIO by %s !\n",
901 __func__, ident, get_label(ident)); 895 __func__, ident, get_label(ident));
902 local_irq_restore(flags); 896 local_irq_restore_hw(flags);
903 return -EBUSY; 897 return -EBUSY;
904 } 898 }
905 899
906 if (unlikely(reserved_peri_map[gpio_bank(ident)] & gpio_bit(ident))) { 900 if (unlikely(reserved_peri_map[gpio_bank(ident)] & gpio_bit(ident))) {
907 901
908 u16 funct = get_portmux(ident);
909
910 /* 902 /*
911 * Pin functions like AMC address strobes my 903 * Pin functions like AMC address strobes my
912 * be requested and used by several drivers 904 * be requested and used by several drivers
913 */ 905 */
914 906
915 if (!((per & P_MAYSHARE) && (funct == P_FUNCT2MUX(per)))) { 907#ifdef BF548_FAMILY
908 u16 funct = get_portmux(ident);
916 909
910 if (!((per & P_MAYSHARE) && (funct == P_FUNCT2MUX(per)))) {
911#else
912 if (!(per & P_MAYSHARE)) {
913#endif
917 /* 914 /*
918 * Allow that the identical pin function can 915 * Allow that the identical pin function can
919 * be requested from the same driver twice 916 * be requested from the same driver twice
@@ -926,7 +923,7 @@ int peripheral_request(unsigned short per, const char *label)
926 printk(KERN_ERR 923 printk(KERN_ERR
927 "%s: Peripheral %d function %d is already reserved by %s !\n", 924 "%s: Peripheral %d function %d is already reserved by %s !\n",
928 __func__, ident, P_FUNCT2MUX(per), get_label(ident)); 925 __func__, ident, P_FUNCT2MUX(per), get_label(ident));
929 local_irq_restore(flags); 926 local_irq_restore_hw(flags);
930 return -EBUSY; 927 return -EBUSY;
931 } 928 }
932 } 929 }
@@ -934,89 +931,19 @@ int peripheral_request(unsigned short per, const char *label)
934 anyway: 931 anyway:
935 reserved_peri_map[gpio_bank(ident)] |= gpio_bit(ident); 932 reserved_peri_map[gpio_bank(ident)] |= gpio_bit(ident);
936 933
934#ifdef BF548_FAMILY
937 portmux_setup(ident, P_FUNCT2MUX(per)); 935 portmux_setup(ident, P_FUNCT2MUX(per));
938 port_setup(ident, PERIPHERAL_USAGE);
939
940 local_irq_restore(flags);
941 set_label(ident, label);
942
943 return 0;
944}
945EXPORT_SYMBOL(peripheral_request);
946#else 936#else
947
948int peripheral_request(unsigned short per, const char *label)
949{
950 unsigned long flags;
951 unsigned short ident = P_IDENT(per);
952
953 /*
954 * Don't cares are pins with only one dedicated function
955 */
956
957 if (per & P_DONTCARE)
958 return 0;
959
960 if (!(per & P_DEFINED))
961 return -ENODEV;
962
963 local_irq_save(flags);
964
965 if (!check_gpio(ident)) {
966
967 if (unlikely(reserved_gpio_map[gpio_bank(ident)] & gpio_bit(ident))) {
968 dump_stack();
969 printk(KERN_ERR
970 "%s: Peripheral %d is already reserved as GPIO by %s !\n",
971 __func__, ident, get_label(ident));
972 local_irq_restore(flags);
973 return -EBUSY;
974 }
975
976 }
977
978 if (unlikely(reserved_peri_map[gpio_bank(ident)] & gpio_bit(ident))) {
979
980 /*
981 * Pin functions like AMC address strobes my
982 * be requested and used by several drivers
983 */
984
985 if (!(per & P_MAYSHARE)) {
986
987 /*
988 * Allow that the identical pin function can
989 * be requested from the same driver twice
990 */
991
992 if (cmp_label(ident, label) == 0)
993 goto anyway;
994
995 dump_stack();
996 printk(KERN_ERR
997 "%s: Peripheral %d function %d is already"
998 " reserved by %s !\n",
999 __func__, ident, P_FUNCT2MUX(per),
1000 get_label(ident));
1001 local_irq_restore(flags);
1002 return -EBUSY;
1003 }
1004
1005 }
1006
1007 anyway:
1008 portmux_setup(per, P_FUNCT2MUX(per)); 937 portmux_setup(per, P_FUNCT2MUX(per));
1009 938#endif
1010 port_setup(ident, PERIPHERAL_USAGE); 939 port_setup(ident, PERIPHERAL_USAGE);
1011 940
1012 reserved_peri_map[gpio_bank(ident)] |= gpio_bit(ident); 941 local_irq_restore_hw(flags);
1013 local_irq_restore(flags);
1014 set_label(ident, label); 942 set_label(ident, label);
1015 943
1016 return 0; 944 return 0;
1017} 945}
1018EXPORT_SYMBOL(peripheral_request); 946EXPORT_SYMBOL(peripheral_request);
1019#endif
1020 947
1021int peripheral_request_list(const unsigned short per[], const char *label) 948int peripheral_request_list(const unsigned short per[], const char *label)
1022{ 949{
@@ -1053,10 +980,10 @@ void peripheral_free(unsigned short per)
1053 if (check_gpio(ident) < 0) 980 if (check_gpio(ident) < 0)
1054 return; 981 return;
1055 982
1056 local_irq_save(flags); 983 local_irq_save_hw(flags);
1057 984
1058 if (unlikely(!(reserved_peri_map[gpio_bank(ident)] & gpio_bit(ident)))) { 985 if (unlikely(!(reserved_peri_map[gpio_bank(ident)] & gpio_bit(ident)))) {
1059 local_irq_restore(flags); 986 local_irq_restore_hw(flags);
1060 return; 987 return;
1061 } 988 }
1062 989
@@ -1067,7 +994,7 @@ void peripheral_free(unsigned short per)
1067 994
1068 set_label(ident, "free"); 995 set_label(ident, "free");
1069 996
1070 local_irq_restore(flags); 997 local_irq_restore_hw(flags);
1071} 998}
1072EXPORT_SYMBOL(peripheral_free); 999EXPORT_SYMBOL(peripheral_free);
1073 1000
@@ -1094,14 +1021,14 @@ EXPORT_SYMBOL(peripheral_free_list);
1094* MODIFICATION HISTORY : 1021* MODIFICATION HISTORY :
1095**************************************************************/ 1022**************************************************************/
1096 1023
1097int gpio_request(unsigned gpio, const char *label) 1024int bfin_gpio_request(unsigned gpio, const char *label)
1098{ 1025{
1099 unsigned long flags; 1026 unsigned long flags;
1100 1027
1101 if (check_gpio(gpio) < 0) 1028 if (check_gpio(gpio) < 0)
1102 return -EINVAL; 1029 return -EINVAL;
1103 1030
1104 local_irq_save(flags); 1031 local_irq_save_hw(flags);
1105 1032
1106 /* 1033 /*
1107 * Allow that the identical GPIO can 1034 * Allow that the identical GPIO can
@@ -1110,15 +1037,15 @@ int gpio_request(unsigned gpio, const char *label)
1110 */ 1037 */
1111 1038
1112 if (cmp_label(gpio, label) == 0) { 1039 if (cmp_label(gpio, label) == 0) {
1113 local_irq_restore(flags); 1040 local_irq_restore_hw(flags);
1114 return 0; 1041 return 0;
1115 } 1042 }
1116 1043
1117 if (unlikely(reserved_gpio_map[gpio_bank(gpio)] & gpio_bit(gpio))) { 1044 if (unlikely(reserved_gpio_map[gpio_bank(gpio)] & gpio_bit(gpio))) {
1118 dump_stack(); 1045 dump_stack();
1119 printk(KERN_ERR "bfin-gpio: GPIO %d is already reserved by %s !\n", 1046 printk(KERN_ERR "bfin-gpio: GPIO %d is already reserved by %s !\n",
1120 gpio, get_label(gpio)); 1047 gpio, get_label(gpio));
1121 local_irq_restore(flags); 1048 local_irq_restore_hw(flags);
1122 return -EBUSY; 1049 return -EBUSY;
1123 } 1050 }
1124 if (unlikely(reserved_peri_map[gpio_bank(gpio)] & gpio_bit(gpio))) { 1051 if (unlikely(reserved_peri_map[gpio_bank(gpio)] & gpio_bit(gpio))) {
@@ -1126,34 +1053,37 @@ int gpio_request(unsigned gpio, const char *label)
1126 printk(KERN_ERR 1053 printk(KERN_ERR
1127 "bfin-gpio: GPIO %d is already reserved as Peripheral by %s !\n", 1054 "bfin-gpio: GPIO %d is already reserved as Peripheral by %s !\n",
1128 gpio, get_label(gpio)); 1055 gpio, get_label(gpio));
1129 local_irq_restore(flags); 1056 local_irq_restore_hw(flags);
1130 return -EBUSY; 1057 return -EBUSY;
1131 } 1058 }
1059 if (unlikely(reserved_gpio_irq_map[gpio_bank(gpio)] & gpio_bit(gpio)))
1060 printk(KERN_NOTICE "bfin-gpio: GPIO %d is already reserved as gpio-irq!"
1061 " (Documentation/blackfin/bfin-gpio-notes.txt)\n", gpio);
1132 1062
1133 reserved_gpio_map[gpio_bank(gpio)] |= gpio_bit(gpio); 1063 reserved_gpio_map[gpio_bank(gpio)] |= gpio_bit(gpio);
1064 set_label(gpio, label);
1134 1065
1135 local_irq_restore(flags); 1066 local_irq_restore_hw(flags);
1136 1067
1137 port_setup(gpio, GPIO_USAGE); 1068 port_setup(gpio, GPIO_USAGE);
1138 set_label(gpio, label);
1139 1069
1140 return 0; 1070 return 0;
1141} 1071}
1142EXPORT_SYMBOL(gpio_request); 1072EXPORT_SYMBOL(bfin_gpio_request);
1143 1073
1144void gpio_free(unsigned gpio) 1074void bfin_gpio_free(unsigned gpio)
1145{ 1075{
1146 unsigned long flags; 1076 unsigned long flags;
1147 1077
1148 if (check_gpio(gpio) < 0) 1078 if (check_gpio(gpio) < 0)
1149 return; 1079 return;
1150 1080
1151 local_irq_save(flags); 1081 local_irq_save_hw(flags);
1152 1082
1153 if (unlikely(!(reserved_gpio_map[gpio_bank(gpio)] & gpio_bit(gpio)))) { 1083 if (unlikely(!(reserved_gpio_map[gpio_bank(gpio)] & gpio_bit(gpio)))) {
1154 dump_stack(); 1084 dump_stack();
1155 gpio_error(gpio); 1085 gpio_error(gpio);
1156 local_irq_restore(flags); 1086 local_irq_restore_hw(flags);
1157 return; 1087 return;
1158 } 1088 }
1159 1089
@@ -1161,13 +1091,76 @@ void gpio_free(unsigned gpio)
1161 1091
1162 set_label(gpio, "free"); 1092 set_label(gpio, "free");
1163 1093
1164 local_irq_restore(flags); 1094 local_irq_restore_hw(flags);
1095}
1096EXPORT_SYMBOL(bfin_gpio_free);
1097
1098int bfin_gpio_irq_request(unsigned gpio, const char *label)
1099{
1100 unsigned long flags;
1101
1102 if (check_gpio(gpio) < 0)
1103 return -EINVAL;
1104
1105 local_irq_save_hw(flags);
1106
1107 if (unlikely(reserved_gpio_irq_map[gpio_bank(gpio)] & gpio_bit(gpio))) {
1108 dump_stack();
1109 printk(KERN_ERR
1110 "bfin-gpio: GPIO %d is already reserved as gpio-irq !\n",
1111 gpio);
1112 local_irq_restore_hw(flags);
1113 return -EBUSY;
1114 }
1115 if (unlikely(reserved_peri_map[gpio_bank(gpio)] & gpio_bit(gpio))) {
1116 dump_stack();
1117 printk(KERN_ERR
1118 "bfin-gpio: GPIO %d is already reserved as Peripheral by %s !\n",
1119 gpio, get_label(gpio));
1120 local_irq_restore_hw(flags);
1121 return -EBUSY;
1122 }
1123 if (unlikely(reserved_gpio_map[gpio_bank(gpio)] & gpio_bit(gpio)))
1124 printk(KERN_NOTICE "bfin-gpio: GPIO %d is already reserved by %s! "
1125 "(Documentation/blackfin/bfin-gpio-notes.txt)\n",
1126 gpio, get_label(gpio));
1127
1128 reserved_gpio_irq_map[gpio_bank(gpio)] |= gpio_bit(gpio);
1129 set_label(gpio, label);
1130
1131 local_irq_restore_hw(flags);
1132
1133 port_setup(gpio, GPIO_USAGE);
1134
1135 return 0;
1136}
1137
1138void bfin_gpio_irq_free(unsigned gpio)
1139{
1140 unsigned long flags;
1141
1142 if (check_gpio(gpio) < 0)
1143 return;
1144
1145 local_irq_save_hw(flags);
1146
1147 if (unlikely(!(reserved_gpio_irq_map[gpio_bank(gpio)] & gpio_bit(gpio)))) {
1148 dump_stack();
1149 gpio_error(gpio);
1150 local_irq_restore_hw(flags);
1151 return;
1152 }
1153
1154 reserved_gpio_irq_map[gpio_bank(gpio)] &= ~gpio_bit(gpio);
1155
1156 set_label(gpio, "free");
1157
1158 local_irq_restore_hw(flags);
1165} 1159}
1166EXPORT_SYMBOL(gpio_free);
1167 1160
1168 1161
1169#ifdef BF548_FAMILY 1162#ifdef BF548_FAMILY
1170int gpio_direction_input(unsigned gpio) 1163int bfin_gpio_direction_input(unsigned gpio)
1171{ 1164{
1172 unsigned long flags; 1165 unsigned long flags;
1173 1166
@@ -1176,16 +1169,16 @@ int gpio_direction_input(unsigned gpio)
1176 return -EINVAL; 1169 return -EINVAL;
1177 } 1170 }
1178 1171
1179 local_irq_save(flags); 1172 local_irq_save_hw(flags);
1180 gpio_array[gpio_bank(gpio)]->port_dir_clear = gpio_bit(gpio); 1173 gpio_array[gpio_bank(gpio)]->port_dir_clear = gpio_bit(gpio);
1181 gpio_array[gpio_bank(gpio)]->port_inen |= gpio_bit(gpio); 1174 gpio_array[gpio_bank(gpio)]->port_inen |= gpio_bit(gpio);
1182 local_irq_restore(flags); 1175 local_irq_restore_hw(flags);
1183 1176
1184 return 0; 1177 return 0;
1185} 1178}
1186EXPORT_SYMBOL(gpio_direction_input); 1179EXPORT_SYMBOL(bfin_gpio_direction_input);
1187 1180
1188int gpio_direction_output(unsigned gpio, int value) 1181int bfin_gpio_direction_output(unsigned gpio, int value)
1189{ 1182{
1190 unsigned long flags; 1183 unsigned long flags;
1191 1184
@@ -1194,30 +1187,30 @@ int gpio_direction_output(unsigned gpio, int value)
1194 return -EINVAL; 1187 return -EINVAL;
1195 } 1188 }
1196 1189
1197 local_irq_save(flags); 1190 local_irq_save_hw(flags);
1198 gpio_array[gpio_bank(gpio)]->port_inen &= ~gpio_bit(gpio); 1191 gpio_array[gpio_bank(gpio)]->port_inen &= ~gpio_bit(gpio);
1199 gpio_set_value(gpio, value); 1192 gpio_set_value(gpio, value);
1200 gpio_array[gpio_bank(gpio)]->port_dir_set = gpio_bit(gpio); 1193 gpio_array[gpio_bank(gpio)]->port_dir_set = gpio_bit(gpio);
1201 local_irq_restore(flags); 1194 local_irq_restore_hw(flags);
1202 1195
1203 return 0; 1196 return 0;
1204} 1197}
1205EXPORT_SYMBOL(gpio_direction_output); 1198EXPORT_SYMBOL(bfin_gpio_direction_output);
1206 1199
1207void gpio_set_value(unsigned gpio, int arg) 1200void bfin_gpio_set_value(unsigned gpio, int arg)
1208{ 1201{
1209 if (arg) 1202 if (arg)
1210 gpio_array[gpio_bank(gpio)]->port_set = gpio_bit(gpio); 1203 gpio_array[gpio_bank(gpio)]->port_set = gpio_bit(gpio);
1211 else 1204 else
1212 gpio_array[gpio_bank(gpio)]->port_clear = gpio_bit(gpio); 1205 gpio_array[gpio_bank(gpio)]->port_clear = gpio_bit(gpio);
1213} 1206}
1214EXPORT_SYMBOL(gpio_set_value); 1207EXPORT_SYMBOL(bfin_gpio_set_value);
1215 1208
1216int gpio_get_value(unsigned gpio) 1209int bfin_gpio_get_value(unsigned gpio)
1217{ 1210{
1218 return (1 & (gpio_array[gpio_bank(gpio)]->port_data >> gpio_sub_n(gpio))); 1211 return (1 & (gpio_array[gpio_bank(gpio)]->port_data >> gpio_sub_n(gpio)));
1219} 1212}
1220EXPORT_SYMBOL(gpio_get_value); 1213EXPORT_SYMBOL(bfin_gpio_get_value);
1221 1214
1222void bfin_gpio_irq_prepare(unsigned gpio) 1215void bfin_gpio_irq_prepare(unsigned gpio)
1223{ 1216{
@@ -1225,34 +1218,34 @@ void bfin_gpio_irq_prepare(unsigned gpio)
1225 1218
1226 port_setup(gpio, GPIO_USAGE); 1219 port_setup(gpio, GPIO_USAGE);
1227 1220
1228 local_irq_save(flags); 1221 local_irq_save_hw(flags);
1229 gpio_array[gpio_bank(gpio)]->port_dir_clear = gpio_bit(gpio); 1222 gpio_array[gpio_bank(gpio)]->port_dir_clear = gpio_bit(gpio);
1230 gpio_array[gpio_bank(gpio)]->port_inen |= gpio_bit(gpio); 1223 gpio_array[gpio_bank(gpio)]->port_inen |= gpio_bit(gpio);
1231 local_irq_restore(flags); 1224 local_irq_restore_hw(flags);
1232} 1225}
1233 1226
1234#else 1227#else
1235 1228
1236int gpio_get_value(unsigned gpio) 1229int bfin_gpio_get_value(unsigned gpio)
1237{ 1230{
1238 unsigned long flags; 1231 unsigned long flags;
1239 int ret; 1232 int ret;
1240 1233
1241 if (unlikely(get_gpio_edge(gpio))) { 1234 if (unlikely(get_gpio_edge(gpio))) {
1242 local_irq_save(flags); 1235 local_irq_save_hw(flags);
1243 set_gpio_edge(gpio, 0); 1236 set_gpio_edge(gpio, 0);
1244 ret = get_gpio_data(gpio); 1237 ret = get_gpio_data(gpio);
1245 set_gpio_edge(gpio, 1); 1238 set_gpio_edge(gpio, 1);
1246 local_irq_restore(flags); 1239 local_irq_restore_hw(flags);
1247 1240
1248 return ret; 1241 return ret;
1249 } else 1242 } else
1250 return get_gpio_data(gpio); 1243 return get_gpio_data(gpio);
1251} 1244}
1252EXPORT_SYMBOL(gpio_get_value); 1245EXPORT_SYMBOL(bfin_gpio_get_value);
1253 1246
1254 1247
1255int gpio_direction_input(unsigned gpio) 1248int bfin_gpio_direction_input(unsigned gpio)
1256{ 1249{
1257 unsigned long flags; 1250 unsigned long flags;
1258 1251
@@ -1261,17 +1254,17 @@ int gpio_direction_input(unsigned gpio)
1261 return -EINVAL; 1254 return -EINVAL;
1262 } 1255 }
1263 1256
1264 local_irq_save(flags); 1257 local_irq_save_hw(flags);
1265 gpio_bankb[gpio_bank(gpio)]->dir &= ~gpio_bit(gpio); 1258 gpio_bankb[gpio_bank(gpio)]->dir &= ~gpio_bit(gpio);
1266 gpio_bankb[gpio_bank(gpio)]->inen |= gpio_bit(gpio); 1259 gpio_bankb[gpio_bank(gpio)]->inen |= gpio_bit(gpio);
1267 AWA_DUMMY_READ(inen); 1260 AWA_DUMMY_READ(inen);
1268 local_irq_restore(flags); 1261 local_irq_restore_hw(flags);
1269 1262
1270 return 0; 1263 return 0;
1271} 1264}
1272EXPORT_SYMBOL(gpio_direction_input); 1265EXPORT_SYMBOL(bfin_gpio_direction_input);
1273 1266
1274int gpio_direction_output(unsigned gpio, int value) 1267int bfin_gpio_direction_output(unsigned gpio, int value)
1275{ 1268{
1276 unsigned long flags; 1269 unsigned long flags;
1277 1270
@@ -1280,7 +1273,7 @@ int gpio_direction_output(unsigned gpio, int value)
1280 return -EINVAL; 1273 return -EINVAL;
1281 } 1274 }
1282 1275
1283 local_irq_save(flags); 1276 local_irq_save_hw(flags);
1284 gpio_bankb[gpio_bank(gpio)]->inen &= ~gpio_bit(gpio); 1277 gpio_bankb[gpio_bank(gpio)]->inen &= ~gpio_bit(gpio);
1285 1278
1286 if (value) 1279 if (value)
@@ -1290,11 +1283,11 @@ int gpio_direction_output(unsigned gpio, int value)
1290 1283
1291 gpio_bankb[gpio_bank(gpio)]->dir |= gpio_bit(gpio); 1284 gpio_bankb[gpio_bank(gpio)]->dir |= gpio_bit(gpio);
1292 AWA_DUMMY_READ(dir); 1285 AWA_DUMMY_READ(dir);
1293 local_irq_restore(flags); 1286 local_irq_restore_hw(flags);
1294 1287
1295 return 0; 1288 return 0;
1296} 1289}
1297EXPORT_SYMBOL(gpio_direction_output); 1290EXPORT_SYMBOL(bfin_gpio_direction_output);
1298 1291
1299/* If we are booting from SPI and our board lacks a strong enough pull up, 1292/* If we are booting from SPI and our board lacks a strong enough pull up,
1300 * the core can reset and execute the bootrom faster than the resistor can 1293 * the core can reset and execute the bootrom faster than the resistor can
@@ -1327,14 +1320,17 @@ void bfin_gpio_irq_prepare(unsigned gpio)
1327static int gpio_proc_read(char *buf, char **start, off_t offset, 1320static int gpio_proc_read(char *buf, char **start, off_t offset,
1328 int len, int *unused_i, void *unused_v) 1321 int len, int *unused_i, void *unused_v)
1329{ 1322{
1330 int c, outlen = 0; 1323 int c, irq, gpio, outlen = 0;
1331 1324
1332 for (c = 0; c < MAX_RESOURCES; c++) { 1325 for (c = 0; c < MAX_RESOURCES; c++) {
1333 if (!check_gpio(c) && (reserved_gpio_map[gpio_bank(c)] & gpio_bit(c))) 1326 irq = reserved_gpio_irq_map[gpio_bank(c)] & gpio_bit(c);
1334 len = sprintf(buf, "GPIO_%d: %s \t\tGPIO %s\n", c, 1327 gpio = reserved_gpio_map[gpio_bank(c)] & gpio_bit(c);
1335 get_label(c), get_gpio_dir(c) ? "OUTPUT" : "INPUT"); 1328 if (!check_gpio(c) && (gpio || irq))
1329 len = sprintf(buf, "GPIO_%d: \t%s%s \t\tGPIO %s\n", c,
1330 get_label(c), (gpio && irq) ? " *" : "",
1331 get_gpio_dir(c) ? "OUTPUT" : "INPUT");
1336 else if (reserved_peri_map[gpio_bank(c)] & gpio_bit(c)) 1332 else if (reserved_peri_map[gpio_bank(c)] & gpio_bit(c))
1337 len = sprintf(buf, "GPIO_%d: %s \t\tPeripheral\n", c, get_label(c)); 1333 len = sprintf(buf, "GPIO_%d: \t%s \t\tPeripheral\n", c, get_label(c));
1338 else 1334 else
1339 continue; 1335 continue;
1340 buf += len; 1336 buf += len;
@@ -1354,3 +1350,57 @@ static __init int gpio_register_proc(void)
1354} 1350}
1355__initcall(gpio_register_proc); 1351__initcall(gpio_register_proc);
1356#endif 1352#endif
1353
1354#ifdef CONFIG_GPIOLIB
1355int bfin_gpiolib_direction_input(struct gpio_chip *chip, unsigned gpio)
1356{
1357 return bfin_gpio_direction_input(gpio);
1358}
1359
1360int bfin_gpiolib_direction_output(struct gpio_chip *chip, unsigned gpio, int level)
1361{
1362 return bfin_gpio_direction_output(gpio, level);
1363}
1364
1365int bfin_gpiolib_get_value(struct gpio_chip *chip, unsigned gpio)
1366{
1367 return bfin_gpio_get_value(gpio);
1368}
1369
1370void bfin_gpiolib_set_value(struct gpio_chip *chip, unsigned gpio, int value)
1371{
1372#ifdef BF548_FAMILY
1373 return bfin_gpio_set_value(gpio, value);
1374#else
1375 return set_gpio_data(gpio, value);
1376#endif
1377}
1378
1379int bfin_gpiolib_gpio_request(struct gpio_chip *chip, unsigned gpio)
1380{
1381 return bfin_gpio_request(gpio, chip->label);
1382}
1383
1384void bfin_gpiolib_gpio_free(struct gpio_chip *chip, unsigned gpio)
1385{
1386 return bfin_gpio_free(gpio);
1387}
1388
1389static struct gpio_chip bfin_chip = {
1390 .label = "Blackfin-GPIOlib",
1391 .direction_input = bfin_gpiolib_direction_input,
1392 .get = bfin_gpiolib_get_value,
1393 .direction_output = bfin_gpiolib_direction_output,
1394 .set = bfin_gpiolib_set_value,
1395 .request = bfin_gpiolib_gpio_request,
1396 .free = bfin_gpiolib_gpio_free,
1397 .base = 0,
1398 .ngpio = MAX_BLACKFIN_GPIOS,
1399};
1400
1401static int __init bfin_gpiolib_setup(void)
1402{
1403 return gpiochip_add(&bfin_chip);
1404}
1405arch_initcall(bfin_gpiolib_setup);
1406#endif
diff --git a/arch/blackfin/kernel/bfin_ksyms.c b/arch/blackfin/kernel/bfin_ksyms.c
index 4367330909b2..01f917d58b59 100644
--- a/arch/blackfin/kernel/bfin_ksyms.c
+++ b/arch/blackfin/kernel/bfin_ksyms.c
@@ -1,52 +1,25 @@
1/* 1/*
2 * File: arch/blackfin/kernel/bfin_ksyms.c 2 * arch/blackfin/kernel/bfin_ksyms.c - exports for random symbols
3 * Based on: none - original work
4 * Author:
5 * 3 *
6 * Created: 4 * Copyright 2004-2008 Analog Devices Inc.
7 * Description:
8 * 5 *
9 * Modified: 6 * Licensed under the GPL-2 or later.
10 * Copyright 2004-2006 Analog Devices Inc.
11 *
12 * Bugs: Enter bugs at http://blackfin.uclinux.org/
13 *
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 2 of the License, or
17 * (at your option) any later version.
18 *
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
23 *
24 * You should have received a copy of the GNU General Public License
25 * along with this program; if not, see the file COPYING, or write
26 * to the Free Software Foundation, Inc.,
27 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
28 */ 7 */
29 8
30#include <linux/module.h> 9#include <linux/module.h>
31#include <linux/irq.h>
32#include <linux/uaccess.h> 10#include <linux/uaccess.h>
33 11
34#include <asm/checksum.h>
35#include <asm/cacheflush.h> 12#include <asm/cacheflush.h>
36 13
37/* platform dependent support */ 14/* Allow people to have their own Blackfin exception handler in a module */
38
39EXPORT_SYMBOL(__ioremap);
40
41EXPORT_SYMBOL(ip_fast_csum);
42
43EXPORT_SYMBOL(kernel_thread);
44
45EXPORT_SYMBOL(is_in_rom);
46EXPORT_SYMBOL(bfin_return_from_exception); 15EXPORT_SYMBOL(bfin_return_from_exception);
47 16
48/* Networking helper routines. */ 17/* All the Blackfin cache functions: mach-common/cache.S */
49EXPORT_SYMBOL(csum_partial_copy); 18EXPORT_SYMBOL(blackfin_dcache_invalidate_range);
19EXPORT_SYMBOL(blackfin_icache_dcache_flush_range);
20EXPORT_SYMBOL(blackfin_icache_flush_range);
21EXPORT_SYMBOL(blackfin_dcache_flush_range);
22EXPORT_SYMBOL(blackfin_dflush_page);
50 23
51/* The following are special because they're not called 24/* The following are special because they're not called
52 * explicitly (the C compiler generates them). Fortunately, 25 * explicitly (the C compiler generates them). Fortunately,
@@ -74,8 +47,6 @@ extern void __modsi3(void);
74extern void __muldi3(void); 47extern void __muldi3(void);
75extern void __udivsi3(void); 48extern void __udivsi3(void);
76extern void __umodsi3(void); 49extern void __umodsi3(void);
77
78/* gcc lib functions */
79EXPORT_SYMBOL(__ashldi3); 50EXPORT_SYMBOL(__ashldi3);
80EXPORT_SYMBOL(__ashrdi3); 51EXPORT_SYMBOL(__ashrdi3);
81EXPORT_SYMBOL(__umulsi3_highpart); 52EXPORT_SYMBOL(__umulsi3_highpart);
@@ -87,6 +58,7 @@ EXPORT_SYMBOL(__muldi3);
87EXPORT_SYMBOL(__udivsi3); 58EXPORT_SYMBOL(__udivsi3);
88EXPORT_SYMBOL(__umodsi3); 59EXPORT_SYMBOL(__umodsi3);
89 60
61/* Input/output symbols: lib/{in,out}s.S */
90EXPORT_SYMBOL(outsb); 62EXPORT_SYMBOL(outsb);
91EXPORT_SYMBOL(insb); 63EXPORT_SYMBOL(insb);
92EXPORT_SYMBOL(outsw); 64EXPORT_SYMBOL(outsw);
@@ -96,20 +68,39 @@ EXPORT_SYMBOL(insw_8);
96EXPORT_SYMBOL(outsl); 68EXPORT_SYMBOL(outsl);
97EXPORT_SYMBOL(insl); 69EXPORT_SYMBOL(insl);
98EXPORT_SYMBOL(insl_16); 70EXPORT_SYMBOL(insl_16);
99EXPORT_SYMBOL(irq_flags);
100EXPORT_SYMBOL(iounmap);
101EXPORT_SYMBOL(blackfin_dcache_invalidate_range);
102EXPORT_SYMBOL(blackfin_icache_dcache_flush_range);
103EXPORT_SYMBOL(blackfin_icache_flush_range);
104EXPORT_SYMBOL(blackfin_dcache_flush_range);
105EXPORT_SYMBOL(blackfin_dflush_page);
106 71
107EXPORT_SYMBOL(csum_partial); 72#ifdef CONFIG_SMP
108EXPORT_SYMBOL(__init_begin); 73EXPORT_SYMBOL(__raw_atomic_update_asm);
109EXPORT_SYMBOL(__init_end); 74EXPORT_SYMBOL(__raw_atomic_clear_asm);
110EXPORT_SYMBOL(_ebss_l1); 75EXPORT_SYMBOL(__raw_atomic_set_asm);
111EXPORT_SYMBOL(_stext_l1); 76EXPORT_SYMBOL(__raw_atomic_xor_asm);
112EXPORT_SYMBOL(_etext_l1); 77EXPORT_SYMBOL(__raw_atomic_test_asm);
113EXPORT_SYMBOL(_sdata_l1); 78EXPORT_SYMBOL(__raw_xchg_1_asm);
114EXPORT_SYMBOL(_ebss_b_l1); 79EXPORT_SYMBOL(__raw_xchg_2_asm);
115EXPORT_SYMBOL(_sdata_b_l1); 80EXPORT_SYMBOL(__raw_xchg_4_asm);
81EXPORT_SYMBOL(__raw_cmpxchg_1_asm);
82EXPORT_SYMBOL(__raw_cmpxchg_2_asm);
83EXPORT_SYMBOL(__raw_cmpxchg_4_asm);
84EXPORT_SYMBOL(__raw_spin_is_locked_asm);
85EXPORT_SYMBOL(__raw_spin_lock_asm);
86EXPORT_SYMBOL(__raw_spin_trylock_asm);
87EXPORT_SYMBOL(__raw_spin_unlock_asm);
88EXPORT_SYMBOL(__raw_read_lock_asm);
89EXPORT_SYMBOL(__raw_read_trylock_asm);
90EXPORT_SYMBOL(__raw_read_unlock_asm);
91EXPORT_SYMBOL(__raw_write_lock_asm);
92EXPORT_SYMBOL(__raw_write_trylock_asm);
93EXPORT_SYMBOL(__raw_write_unlock_asm);
94EXPORT_SYMBOL(__raw_bit_set_asm);
95EXPORT_SYMBOL(__raw_bit_clear_asm);
96EXPORT_SYMBOL(__raw_bit_toggle_asm);
97EXPORT_SYMBOL(__raw_bit_test_asm);
98EXPORT_SYMBOL(__raw_bit_test_set_asm);
99EXPORT_SYMBOL(__raw_bit_test_clear_asm);
100EXPORT_SYMBOL(__raw_bit_test_toggle_asm);
101EXPORT_SYMBOL(__raw_uncached_fetch_asm);
102#ifdef __ARCH_SYNC_CORE_DCACHE
103EXPORT_SYMBOL(__raw_smp_mark_barrier_asm);
104EXPORT_SYMBOL(__raw_smp_check_barrier_asm);
105#endif
106#endif
diff --git a/arch/blackfin/kernel/cplb-mpu/Makefile b/arch/blackfin/kernel/cplb-mpu/Makefile
index 286b69357f97..7d70d3bf3212 100644
--- a/arch/blackfin/kernel/cplb-mpu/Makefile
+++ b/arch/blackfin/kernel/cplb-mpu/Makefile
@@ -4,5 +4,7 @@
4 4
5obj-y := cplbinit.o cacheinit.o cplbmgr.o 5obj-y := cplbinit.o cacheinit.o cplbmgr.o
6 6
7obj-$(CONFIG_CPLB_INFO) += cplbinfo.o 7CFLAGS_cplbmgr.o := -ffixed-I0 -ffixed-I1 -ffixed-I2 -ffixed-I3 \
8 8 -ffixed-L0 -ffixed-L1 -ffixed-L2 -ffixed-L3 \
9 -ffixed-M0 -ffixed-M1 -ffixed-M2 -ffixed-M3 \
10 -ffixed-B0 -ffixed-B1 -ffixed-B2 -ffixed-B3
diff --git a/arch/blackfin/kernel/cplb-mpu/cacheinit.c b/arch/blackfin/kernel/cplb-mpu/cacheinit.c
index a8b712a24c59..c6ff947f9d37 100644
--- a/arch/blackfin/kernel/cplb-mpu/cacheinit.c
+++ b/arch/blackfin/kernel/cplb-mpu/cacheinit.c
@@ -25,7 +25,7 @@
25#include <asm/cplbinit.h> 25#include <asm/cplbinit.h>
26 26
27#if defined(CONFIG_BFIN_ICACHE) 27#if defined(CONFIG_BFIN_ICACHE)
28void __init bfin_icache_init(void) 28void __cpuinit bfin_icache_init(struct cplb_entry *icplb_tbl)
29{ 29{
30 unsigned long ctrl; 30 unsigned long ctrl;
31 int i; 31 int i;
@@ -43,7 +43,7 @@ void __init bfin_icache_init(void)
43#endif 43#endif
44 44
45#if defined(CONFIG_BFIN_DCACHE) 45#if defined(CONFIG_BFIN_DCACHE)
46void __init bfin_dcache_init(void) 46void __cpuinit bfin_dcache_init(struct cplb_entry *dcplb_tbl)
47{ 47{
48 unsigned long ctrl; 48 unsigned long ctrl;
49 int i; 49 int i;
diff --git a/arch/blackfin/kernel/cplb-mpu/cplbinfo.c b/arch/blackfin/kernel/cplb-mpu/cplbinfo.c
deleted file mode 100644
index 822beefa3a4b..000000000000
--- a/arch/blackfin/kernel/cplb-mpu/cplbinfo.c
+++ /dev/null
@@ -1,136 +0,0 @@
1/*
2 * File: arch/blackfin/mach-common/cplbinfo.c
3 * Based on:
4 * Author: Sonic Zhang <sonic.zhang@analog.com>
5 *
6 * Created: Jan. 2005
7 * Description: Display CPLB status
8 *
9 * Modified:
10 * Copyright 2004-2006 Analog Devices Inc.
11 *
12 * Bugs: Enter bugs at http://blackfin.uclinux.org/
13 *
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 2 of the License, or
17 * (at your option) any later version.
18 *
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
23 *
24 * You should have received a copy of the GNU General Public License
25 * along with this program; if not, see the file COPYING, or write
26 * to the Free Software Foundation, Inc.,
27 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
28 */
29
30#include <linux/module.h>
31#include <linux/kernel.h>
32#include <linux/init.h>
33#include <linux/proc_fs.h>
34#include <linux/uaccess.h>
35
36#include <asm/current.h>
37#include <asm/system.h>
38#include <asm/cplb.h>
39#include <asm/cplbinit.h>
40#include <asm/blackfin.h>
41
42static char page_size_string_table[][4] = { "1K", "4K", "1M", "4M" };
43
44static char *cplb_print_entry(char *buf, struct cplb_entry *tbl, int switched)
45{
46 int i;
47 buf += sprintf(buf, "Index\tAddress\t\tData\tSize\tU/RD\tU/WR\tS/WR\tSwitch\n");
48 for (i = 0; i < MAX_CPLBS; i++) {
49 unsigned long data = tbl[i].data;
50 unsigned long addr = tbl[i].addr;
51 if (!(data & CPLB_VALID))
52 continue;
53
54 buf +=
55 sprintf(buf,
56 "%d\t0x%08lx\t%06lx\t%s\t%c\t%c\t%c\t%c\n",
57 i, addr, data,
58 page_size_string_table[(data & 0x30000) >> 16],
59 (data & CPLB_USER_RD) ? 'Y' : 'N',
60 (data & CPLB_USER_WR) ? 'Y' : 'N',
61 (data & CPLB_SUPV_WR) ? 'Y' : 'N',
62 i < switched ? 'N' : 'Y');
63 }
64 buf += sprintf(buf, "\n");
65
66 return buf;
67}
68
69int cplbinfo_proc_output(char *buf)
70{
71 char *p;
72
73 p = buf;
74
75 p += sprintf(p, "------------------ CPLB Information ------------------\n\n");
76
77 if (bfin_read_IMEM_CONTROL() & ENICPLB) {
78 p += sprintf(p, "Instruction CPLB entry:\n");
79 p = cplb_print_entry(p, icplb_tbl, first_switched_icplb);
80 } else
81 p += sprintf(p, "Instruction CPLB is disabled.\n\n");
82
83 if (1 || bfin_read_DMEM_CONTROL() & ENDCPLB) {
84 p += sprintf(p, "Data CPLB entry:\n");
85 p = cplb_print_entry(p, dcplb_tbl, first_switched_dcplb);
86 } else
87 p += sprintf(p, "Data CPLB is disabled.\n");
88
89 p += sprintf(p, "ICPLB miss: %d\nICPLB supervisor miss: %d\n",
90 nr_icplb_miss, nr_icplb_supv_miss);
91 p += sprintf(p, "DCPLB miss: %d\nDCPLB protection fault:%d\n",
92 nr_dcplb_miss, nr_dcplb_prot);
93 p += sprintf(p, "CPLB flushes: %d\n",
94 nr_cplb_flush);
95
96 return p - buf;
97}
98
99static int cplbinfo_read_proc(char *page, char **start, off_t off,
100 int count, int *eof, void *data)
101{
102 int len;
103
104 len = cplbinfo_proc_output(page);
105 if (len <= off + count)
106 *eof = 1;
107 *start = page + off;
108 len -= off;
109 if (len > count)
110 len = count;
111 if (len < 0)
112 len = 0;
113 return len;
114}
115
116static int __init cplbinfo_init(void)
117{
118 struct proc_dir_entry *entry;
119
120 entry = create_proc_entry("cplbinfo", 0, NULL);
121 if (!entry)
122 return -ENOMEM;
123
124 entry->read_proc = cplbinfo_read_proc;
125 entry->data = NULL;
126
127 return 0;
128}
129
130static void __exit cplbinfo_exit(void)
131{
132 remove_proc_entry("cplbinfo", NULL);
133}
134
135module_init(cplbinfo_init);
136module_exit(cplbinfo_exit);
diff --git a/arch/blackfin/kernel/cplb-mpu/cplbinit.c b/arch/blackfin/kernel/cplb-mpu/cplbinit.c
index 55af729f8495..bdb958486e76 100644
--- a/arch/blackfin/kernel/cplb-mpu/cplbinit.c
+++ b/arch/blackfin/kernel/cplb-mpu/cplbinit.c
@@ -25,18 +25,19 @@
25#include <asm/blackfin.h> 25#include <asm/blackfin.h>
26#include <asm/cplb.h> 26#include <asm/cplb.h>
27#include <asm/cplbinit.h> 27#include <asm/cplbinit.h>
28#include <asm/mem_map.h>
28 29
29#if ANOMALY_05000263 30#if ANOMALY_05000263
30# error the MPU will not function safely while Anomaly 05000263 applies 31# error the MPU will not function safely while Anomaly 05000263 applies
31#endif 32#endif
32 33
33struct cplb_entry icplb_tbl[MAX_CPLBS]; 34struct cplb_entry icplb_tbl[NR_CPUS][MAX_CPLBS];
34struct cplb_entry dcplb_tbl[MAX_CPLBS]; 35struct cplb_entry dcplb_tbl[NR_CPUS][MAX_CPLBS];
35 36
36int first_switched_icplb, first_switched_dcplb; 37int first_switched_icplb, first_switched_dcplb;
37int first_mask_dcplb; 38int first_mask_dcplb;
38 39
39void __init generate_cplb_tables(void) 40void __init generate_cplb_tables_cpu(unsigned int cpu)
40{ 41{
41 int i_d, i_i; 42 int i_d, i_i;
42 unsigned long addr; 43 unsigned long addr;
@@ -55,15 +56,16 @@ void __init generate_cplb_tables(void)
55 d_cache |= CPLB_L1_AOW | CPLB_WT; 56 d_cache |= CPLB_L1_AOW | CPLB_WT;
56#endif 57#endif
57#endif 58#endif
59
58 i_d = i_i = 0; 60 i_d = i_i = 0;
59 61
60 /* Set up the zero page. */ 62 /* Set up the zero page. */
61 dcplb_tbl[i_d].addr = 0; 63 dcplb_tbl[cpu][i_d].addr = 0;
62 dcplb_tbl[i_d++].data = SDRAM_OOPS | PAGE_SIZE_1KB; 64 dcplb_tbl[cpu][i_d++].data = SDRAM_OOPS | PAGE_SIZE_1KB;
63 65
64#if 0 66#if 0
65 icplb_tbl[i_i].addr = 0; 67 icplb_tbl[cpu][i_i].addr = 0;
66 icplb_tbl[i_i++].data = i_cache | CPLB_USER_RD | PAGE_SIZE_4KB; 68 icplb_tbl[cpu][i_i++].data = i_cache | CPLB_USER_RD | PAGE_SIZE_4KB;
67#endif 69#endif
68 70
69 /* Cover kernel memory with 4M pages. */ 71 /* Cover kernel memory with 4M pages. */
@@ -72,28 +74,28 @@ void __init generate_cplb_tables(void)
72 i_data = i_cache | CPLB_VALID | CPLB_PORTPRIO | PAGE_SIZE_4MB; 74 i_data = i_cache | CPLB_VALID | CPLB_PORTPRIO | PAGE_SIZE_4MB;
73 75
74 for (; addr < memory_start; addr += 4 * 1024 * 1024) { 76 for (; addr < memory_start; addr += 4 * 1024 * 1024) {
75 dcplb_tbl[i_d].addr = addr; 77 dcplb_tbl[cpu][i_d].addr = addr;
76 dcplb_tbl[i_d++].data = d_data; 78 dcplb_tbl[cpu][i_d++].data = d_data;
77 icplb_tbl[i_i].addr = addr; 79 icplb_tbl[cpu][i_i].addr = addr;
78 icplb_tbl[i_i++].data = i_data | (addr == 0 ? CPLB_USER_RD : 0); 80 icplb_tbl[cpu][i_i++].data = i_data | (addr == 0 ? CPLB_USER_RD : 0);
79 } 81 }
80 82
81 /* Cover L1 memory. One 4M area for code and data each is enough. */ 83 /* Cover L1 memory. One 4M area for code and data each is enough. */
82#if L1_DATA_A_LENGTH > 0 || L1_DATA_B_LENGTH > 0 84#if L1_DATA_A_LENGTH > 0 || L1_DATA_B_LENGTH > 0
83 dcplb_tbl[i_d].addr = L1_DATA_A_START; 85 dcplb_tbl[cpu][i_d].addr = get_l1_data_a_start_cpu(cpu);
84 dcplb_tbl[i_d++].data = L1_DMEMORY | PAGE_SIZE_4MB; 86 dcplb_tbl[cpu][i_d++].data = L1_DMEMORY | PAGE_SIZE_4MB;
85#endif 87#endif
86#if L1_CODE_LENGTH > 0 88#if L1_CODE_LENGTH > 0
87 icplb_tbl[i_i].addr = L1_CODE_START; 89 icplb_tbl[cpu][i_i].addr = get_l1_code_start_cpu(cpu);
88 icplb_tbl[i_i++].data = L1_IMEMORY | PAGE_SIZE_4MB; 90 icplb_tbl[cpu][i_i++].data = L1_IMEMORY | PAGE_SIZE_4MB;
89#endif 91#endif
90 92
91 /* Cover L2 memory */ 93 /* Cover L2 memory */
92#if L2_LENGTH > 0 94#if L2_LENGTH > 0
93 dcplb_tbl[i_d].addr = L2_START; 95 dcplb_tbl[cpu][i_d].addr = L2_START;
94 dcplb_tbl[i_d++].data = L2_DMEMORY | PAGE_SIZE_1MB; 96 dcplb_tbl[cpu][i_d++].data = L2_DMEMORY | PAGE_SIZE_1MB;
95 icplb_tbl[i_i].addr = L2_START; 97 icplb_tbl[cpu][i_i].addr = L2_START;
96 icplb_tbl[i_i++].data = L2_IMEMORY | PAGE_SIZE_1MB; 98 icplb_tbl[cpu][i_i++].data = L2_IMEMORY | PAGE_SIZE_1MB;
97#endif 99#endif
98 100
99 first_mask_dcplb = i_d; 101 first_mask_dcplb = i_d;
@@ -101,7 +103,11 @@ void __init generate_cplb_tables(void)
101 first_switched_icplb = i_i; 103 first_switched_icplb = i_i;
102 104
103 while (i_d < MAX_CPLBS) 105 while (i_d < MAX_CPLBS)
104 dcplb_tbl[i_d++].data = 0; 106 dcplb_tbl[cpu][i_d++].data = 0;
105 while (i_i < MAX_CPLBS) 107 while (i_i < MAX_CPLBS)
106 icplb_tbl[i_i++].data = 0; 108 icplb_tbl[cpu][i_i++].data = 0;
109}
110
111void generate_cplb_tables_all(void)
112{
107} 113}
diff --git a/arch/blackfin/kernel/cplb-mpu/cplbmgr.c b/arch/blackfin/kernel/cplb-mpu/cplbmgr.c
index baa52e261f0d..87463ce87f5a 100644
--- a/arch/blackfin/kernel/cplb-mpu/cplbmgr.c
+++ b/arch/blackfin/kernel/cplb-mpu/cplbmgr.c
@@ -25,15 +25,21 @@
25#include <asm/cplbinit.h> 25#include <asm/cplbinit.h>
26#include <asm/mmu_context.h> 26#include <asm/mmu_context.h>
27 27
28#define FAULT_RW (1 << 16) 28/*
29#define FAULT_USERSUPV (1 << 17) 29 * WARNING
30 *
31 * This file is compiled with certain -ffixed-reg options. We have to
32 * make sure not to call any functions here that could clobber these
33 * registers.
34 */
30 35
31int page_mask_nelts; 36int page_mask_nelts;
32int page_mask_order; 37int page_mask_order;
33unsigned long *current_rwx_mask; 38unsigned long *current_rwx_mask[NR_CPUS];
34 39
35int nr_dcplb_miss, nr_icplb_miss, nr_icplb_supv_miss, nr_dcplb_prot; 40int nr_dcplb_miss[NR_CPUS], nr_icplb_miss[NR_CPUS];
36int nr_cplb_flush; 41int nr_icplb_supv_miss[NR_CPUS], nr_dcplb_prot[NR_CPUS];
42int nr_cplb_flush[NR_CPUS];
37 43
38static inline void disable_dcplb(void) 44static inline void disable_dcplb(void)
39{ 45{
@@ -98,42 +104,42 @@ static inline int write_permitted(int status, unsigned long data)
98} 104}
99 105
100/* Counters to implement round-robin replacement. */ 106/* Counters to implement round-robin replacement. */
101static int icplb_rr_index, dcplb_rr_index; 107static int icplb_rr_index[NR_CPUS], dcplb_rr_index[NR_CPUS];
102 108
103/* 109/*
104 * Find an ICPLB entry to be evicted and return its index. 110 * Find an ICPLB entry to be evicted and return its index.
105 */ 111 */
106static int evict_one_icplb(void) 112static int evict_one_icplb(unsigned int cpu)
107{ 113{
108 int i; 114 int i;
109 for (i = first_switched_icplb; i < MAX_CPLBS; i++) 115 for (i = first_switched_icplb; i < MAX_CPLBS; i++)
110 if ((icplb_tbl[i].data & CPLB_VALID) == 0) 116 if ((icplb_tbl[cpu][i].data & CPLB_VALID) == 0)
111 return i; 117 return i;
112 i = first_switched_icplb + icplb_rr_index; 118 i = first_switched_icplb + icplb_rr_index[cpu];
113 if (i >= MAX_CPLBS) { 119 if (i >= MAX_CPLBS) {
114 i -= MAX_CPLBS - first_switched_icplb; 120 i -= MAX_CPLBS - first_switched_icplb;
115 icplb_rr_index -= MAX_CPLBS - first_switched_icplb; 121 icplb_rr_index[cpu] -= MAX_CPLBS - first_switched_icplb;
116 } 122 }
117 icplb_rr_index++; 123 icplb_rr_index[cpu]++;
118 return i; 124 return i;
119} 125}
120 126
121static int evict_one_dcplb(void) 127static int evict_one_dcplb(unsigned int cpu)
122{ 128{
123 int i; 129 int i;
124 for (i = first_switched_dcplb; i < MAX_CPLBS; i++) 130 for (i = first_switched_dcplb; i < MAX_CPLBS; i++)
125 if ((dcplb_tbl[i].data & CPLB_VALID) == 0) 131 if ((dcplb_tbl[cpu][i].data & CPLB_VALID) == 0)
126 return i; 132 return i;
127 i = first_switched_dcplb + dcplb_rr_index; 133 i = first_switched_dcplb + dcplb_rr_index[cpu];
128 if (i >= MAX_CPLBS) { 134 if (i >= MAX_CPLBS) {
129 i -= MAX_CPLBS - first_switched_dcplb; 135 i -= MAX_CPLBS - first_switched_dcplb;
130 dcplb_rr_index -= MAX_CPLBS - first_switched_dcplb; 136 dcplb_rr_index[cpu] -= MAX_CPLBS - first_switched_dcplb;
131 } 137 }
132 dcplb_rr_index++; 138 dcplb_rr_index[cpu]++;
133 return i; 139 return i;
134} 140}
135 141
136static noinline int dcplb_miss(void) 142static noinline int dcplb_miss(unsigned int cpu)
137{ 143{
138 unsigned long addr = bfin_read_DCPLB_FAULT_ADDR(); 144 unsigned long addr = bfin_read_DCPLB_FAULT_ADDR();
139 int status = bfin_read_DCPLB_STATUS(); 145 int status = bfin_read_DCPLB_STATUS();
@@ -141,7 +147,7 @@ static noinline int dcplb_miss(void)
141 int idx; 147 int idx;
142 unsigned long d_data; 148 unsigned long d_data;
143 149
144 nr_dcplb_miss++; 150 nr_dcplb_miss[cpu]++;
145 151
146 d_data = CPLB_SUPV_WR | CPLB_VALID | CPLB_DIRTY | PAGE_SIZE_4KB; 152 d_data = CPLB_SUPV_WR | CPLB_VALID | CPLB_DIRTY | PAGE_SIZE_4KB;
147#ifdef CONFIG_BFIN_DCACHE 153#ifdef CONFIG_BFIN_DCACHE
@@ -168,25 +174,25 @@ static noinline int dcplb_miss(void)
168 } else if (addr >= _ramend) { 174 } else if (addr >= _ramend) {
169 d_data |= CPLB_USER_RD | CPLB_USER_WR; 175 d_data |= CPLB_USER_RD | CPLB_USER_WR;
170 } else { 176 } else {
171 mask = current_rwx_mask; 177 mask = current_rwx_mask[cpu];
172 if (mask) { 178 if (mask) {
173 int page = addr >> PAGE_SHIFT; 179 int page = addr >> PAGE_SHIFT;
174 int offs = page >> 5; 180 int idx = page >> 5;
175 int bit = 1 << (page & 31); 181 int bit = 1 << (page & 31);
176 182
177 if (mask[offs] & bit) 183 if (mask[idx] & bit)
178 d_data |= CPLB_USER_RD; 184 d_data |= CPLB_USER_RD;
179 185
180 mask += page_mask_nelts; 186 mask += page_mask_nelts;
181 if (mask[offs] & bit) 187 if (mask[idx] & bit)
182 d_data |= CPLB_USER_WR; 188 d_data |= CPLB_USER_WR;
183 } 189 }
184 } 190 }
185 idx = evict_one_dcplb(); 191 idx = evict_one_dcplb(cpu);
186 192
187 addr &= PAGE_MASK; 193 addr &= PAGE_MASK;
188 dcplb_tbl[idx].addr = addr; 194 dcplb_tbl[cpu][idx].addr = addr;
189 dcplb_tbl[idx].data = d_data; 195 dcplb_tbl[cpu][idx].data = d_data;
190 196
191 disable_dcplb(); 197 disable_dcplb();
192 bfin_write32(DCPLB_DATA0 + idx * 4, d_data); 198 bfin_write32(DCPLB_DATA0 + idx * 4, d_data);
@@ -196,21 +202,21 @@ static noinline int dcplb_miss(void)
196 return 0; 202 return 0;
197} 203}
198 204
199static noinline int icplb_miss(void) 205static noinline int icplb_miss(unsigned int cpu)
200{ 206{
201 unsigned long addr = bfin_read_ICPLB_FAULT_ADDR(); 207 unsigned long addr = bfin_read_ICPLB_FAULT_ADDR();
202 int status = bfin_read_ICPLB_STATUS(); 208 int status = bfin_read_ICPLB_STATUS();
203 int idx; 209 int idx;
204 unsigned long i_data; 210 unsigned long i_data;
205 211
206 nr_icplb_miss++; 212 nr_icplb_miss[cpu]++;
207 213
208 /* If inside the uncached DMA region, fault. */ 214 /* If inside the uncached DMA region, fault. */
209 if (addr >= _ramend - DMA_UNCACHED_REGION && addr < _ramend) 215 if (addr >= _ramend - DMA_UNCACHED_REGION && addr < _ramend)
210 return CPLB_PROT_VIOL; 216 return CPLB_PROT_VIOL;
211 217
212 if (status & FAULT_USERSUPV) 218 if (status & FAULT_USERSUPV)
213 nr_icplb_supv_miss++; 219 nr_icplb_supv_miss[cpu]++;
214 220
215 /* 221 /*
216 * First, try to find a CPLB that matches this address. If we 222 * First, try to find a CPLB that matches this address. If we
@@ -218,8 +224,8 @@ static noinline int icplb_miss(void)
218 * that the instruction crosses a page boundary. 224 * that the instruction crosses a page boundary.
219 */ 225 */
220 for (idx = first_switched_icplb; idx < MAX_CPLBS; idx++) { 226 for (idx = first_switched_icplb; idx < MAX_CPLBS; idx++) {
221 if (icplb_tbl[idx].data & CPLB_VALID) { 227 if (icplb_tbl[cpu][idx].data & CPLB_VALID) {
222 unsigned long this_addr = icplb_tbl[idx].addr; 228 unsigned long this_addr = icplb_tbl[cpu][idx].addr;
223 if (this_addr <= addr && this_addr + PAGE_SIZE > addr) { 229 if (this_addr <= addr && this_addr + PAGE_SIZE > addr) {
224 addr += PAGE_SIZE; 230 addr += PAGE_SIZE;
225 break; 231 break;
@@ -257,23 +263,23 @@ static noinline int icplb_miss(void)
257 * Otherwise, check the x bitmap of the current process. 263 * Otherwise, check the x bitmap of the current process.
258 */ 264 */
259 if (!(status & FAULT_USERSUPV)) { 265 if (!(status & FAULT_USERSUPV)) {
260 unsigned long *mask = current_rwx_mask; 266 unsigned long *mask = current_rwx_mask[cpu];
261 267
262 if (mask) { 268 if (mask) {
263 int page = addr >> PAGE_SHIFT; 269 int page = addr >> PAGE_SHIFT;
264 int offs = page >> 5; 270 int idx = page >> 5;
265 int bit = 1 << (page & 31); 271 int bit = 1 << (page & 31);
266 272
267 mask += 2 * page_mask_nelts; 273 mask += 2 * page_mask_nelts;
268 if (mask[offs] & bit) 274 if (mask[idx] & bit)
269 i_data |= CPLB_USER_RD; 275 i_data |= CPLB_USER_RD;
270 } 276 }
271 } 277 }
272 } 278 }
273 idx = evict_one_icplb(); 279 idx = evict_one_icplb(cpu);
274 addr &= PAGE_MASK; 280 addr &= PAGE_MASK;
275 icplb_tbl[idx].addr = addr; 281 icplb_tbl[cpu][idx].addr = addr;
276 icplb_tbl[idx].data = i_data; 282 icplb_tbl[cpu][idx].data = i_data;
277 283
278 disable_icplb(); 284 disable_icplb();
279 bfin_write32(ICPLB_DATA0 + idx * 4, i_data); 285 bfin_write32(ICPLB_DATA0 + idx * 4, i_data);
@@ -283,19 +289,19 @@ static noinline int icplb_miss(void)
283 return 0; 289 return 0;
284} 290}
285 291
286static noinline int dcplb_protection_fault(void) 292static noinline int dcplb_protection_fault(unsigned int cpu)
287{ 293{
288 int status = bfin_read_DCPLB_STATUS(); 294 int status = bfin_read_DCPLB_STATUS();
289 295
290 nr_dcplb_prot++; 296 nr_dcplb_prot[cpu]++;
291 297
292 if (status & FAULT_RW) { 298 if (status & FAULT_RW) {
293 int idx = faulting_cplb_index(status); 299 int idx = faulting_cplb_index(status);
294 unsigned long data = dcplb_tbl[idx].data; 300 unsigned long data = dcplb_tbl[cpu][idx].data;
295 if (!(data & CPLB_WT) && !(data & CPLB_DIRTY) && 301 if (!(data & CPLB_WT) && !(data & CPLB_DIRTY) &&
296 write_permitted(status, data)) { 302 write_permitted(status, data)) {
297 data |= CPLB_DIRTY; 303 data |= CPLB_DIRTY;
298 dcplb_tbl[idx].data = data; 304 dcplb_tbl[cpu][idx].data = data;
299 bfin_write32(DCPLB_DATA0 + idx * 4, data); 305 bfin_write32(DCPLB_DATA0 + idx * 4, data);
300 return 0; 306 return 0;
301 } 307 }
@@ -306,44 +312,45 @@ static noinline int dcplb_protection_fault(void)
306int cplb_hdr(int seqstat, struct pt_regs *regs) 312int cplb_hdr(int seqstat, struct pt_regs *regs)
307{ 313{
308 int cause = seqstat & 0x3f; 314 int cause = seqstat & 0x3f;
315 unsigned int cpu = smp_processor_id();
309 switch (cause) { 316 switch (cause) {
310 case 0x23: 317 case 0x23:
311 return dcplb_protection_fault(); 318 return dcplb_protection_fault(cpu);
312 case 0x2C: 319 case 0x2C:
313 return icplb_miss(); 320 return icplb_miss(cpu);
314 case 0x26: 321 case 0x26:
315 return dcplb_miss(); 322 return dcplb_miss(cpu);
316 default: 323 default:
317 return 1; 324 return 1;
318 } 325 }
319} 326}
320 327
321void flush_switched_cplbs(void) 328void flush_switched_cplbs(unsigned int cpu)
322{ 329{
323 int i; 330 int i;
324 unsigned long flags; 331 unsigned long flags;
325 332
326 nr_cplb_flush++; 333 nr_cplb_flush[cpu]++;
327 334
328 local_irq_save(flags); 335 local_irq_save_hw(flags);
329 disable_icplb(); 336 disable_icplb();
330 for (i = first_switched_icplb; i < MAX_CPLBS; i++) { 337 for (i = first_switched_icplb; i < MAX_CPLBS; i++) {
331 icplb_tbl[i].data = 0; 338 icplb_tbl[cpu][i].data = 0;
332 bfin_write32(ICPLB_DATA0 + i * 4, 0); 339 bfin_write32(ICPLB_DATA0 + i * 4, 0);
333 } 340 }
334 enable_icplb(); 341 enable_icplb();
335 342
336 disable_dcplb(); 343 disable_dcplb();
337 for (i = first_switched_dcplb; i < MAX_CPLBS; i++) { 344 for (i = first_switched_dcplb; i < MAX_CPLBS; i++) {
338 dcplb_tbl[i].data = 0; 345 dcplb_tbl[cpu][i].data = 0;
339 bfin_write32(DCPLB_DATA0 + i * 4, 0); 346 bfin_write32(DCPLB_DATA0 + i * 4, 0);
340 } 347 }
341 enable_dcplb(); 348 enable_dcplb();
342 local_irq_restore(flags); 349 local_irq_restore_hw(flags);
343 350
344} 351}
345 352
346void set_mask_dcplbs(unsigned long *masks) 353void set_mask_dcplbs(unsigned long *masks, unsigned int cpu)
347{ 354{
348 int i; 355 int i;
349 unsigned long addr = (unsigned long)masks; 356 unsigned long addr = (unsigned long)masks;
@@ -351,12 +358,12 @@ void set_mask_dcplbs(unsigned long *masks)
351 unsigned long flags; 358 unsigned long flags;
352 359
353 if (!masks) { 360 if (!masks) {
354 current_rwx_mask = masks; 361 current_rwx_mask[cpu] = masks;
355 return; 362 return;
356 } 363 }
357 364
358 local_irq_save(flags); 365 local_irq_save_hw(flags);
359 current_rwx_mask = masks; 366 current_rwx_mask[cpu] = masks;
360 367
361 d_data = CPLB_SUPV_WR | CPLB_VALID | CPLB_DIRTY | PAGE_SIZE_4KB; 368 d_data = CPLB_SUPV_WR | CPLB_VALID | CPLB_DIRTY | PAGE_SIZE_4KB;
362#ifdef CONFIG_BFIN_DCACHE 369#ifdef CONFIG_BFIN_DCACHE
@@ -368,12 +375,12 @@ void set_mask_dcplbs(unsigned long *masks)
368 375
369 disable_dcplb(); 376 disable_dcplb();
370 for (i = first_mask_dcplb; i < first_switched_dcplb; i++) { 377 for (i = first_mask_dcplb; i < first_switched_dcplb; i++) {
371 dcplb_tbl[i].addr = addr; 378 dcplb_tbl[cpu][i].addr = addr;
372 dcplb_tbl[i].data = d_data; 379 dcplb_tbl[cpu][i].data = d_data;
373 bfin_write32(DCPLB_DATA0 + i * 4, d_data); 380 bfin_write32(DCPLB_DATA0 + i * 4, d_data);
374 bfin_write32(DCPLB_ADDR0 + i * 4, addr); 381 bfin_write32(DCPLB_ADDR0 + i * 4, addr);
375 addr += PAGE_SIZE; 382 addr += PAGE_SIZE;
376 } 383 }
377 enable_dcplb(); 384 enable_dcplb();
378 local_irq_restore(flags); 385 local_irq_restore_hw(flags);
379} 386}
diff --git a/arch/blackfin/kernel/cplb-nompu/Makefile b/arch/blackfin/kernel/cplb-nompu/Makefile
index d36ea9b5382e..7d70d3bf3212 100644
--- a/arch/blackfin/kernel/cplb-nompu/Makefile
+++ b/arch/blackfin/kernel/cplb-nompu/Makefile
@@ -2,7 +2,9 @@
2# arch/blackfin/kernel/cplb-nompu/Makefile 2# arch/blackfin/kernel/cplb-nompu/Makefile
3# 3#
4 4
5obj-y := cplbinit.o cacheinit.o cplbhdlr.o cplbmgr.o 5obj-y := cplbinit.o cacheinit.o cplbmgr.o
6
7obj-$(CONFIG_CPLB_INFO) += cplbinfo.o
8 6
7CFLAGS_cplbmgr.o := -ffixed-I0 -ffixed-I1 -ffixed-I2 -ffixed-I3 \
8 -ffixed-L0 -ffixed-L1 -ffixed-L2 -ffixed-L3 \
9 -ffixed-M0 -ffixed-M1 -ffixed-M2 -ffixed-M3 \
10 -ffixed-B0 -ffixed-B1 -ffixed-B2 -ffixed-B3
diff --git a/arch/blackfin/kernel/cplb-nompu/cacheinit.c b/arch/blackfin/kernel/cplb-nompu/cacheinit.c
index bd0831592c2c..c6ff947f9d37 100644
--- a/arch/blackfin/kernel/cplb-nompu/cacheinit.c
+++ b/arch/blackfin/kernel/cplb-nompu/cacheinit.c
@@ -25,19 +25,15 @@
25#include <asm/cplbinit.h> 25#include <asm/cplbinit.h>
26 26
27#if defined(CONFIG_BFIN_ICACHE) 27#if defined(CONFIG_BFIN_ICACHE)
28void __init bfin_icache_init(void) 28void __cpuinit bfin_icache_init(struct cplb_entry *icplb_tbl)
29{ 29{
30 unsigned long *table = icplb_table;
31 unsigned long ctrl; 30 unsigned long ctrl;
32 int i; 31 int i;
33 32
33 SSYNC();
34 for (i = 0; i < MAX_CPLBS; i++) { 34 for (i = 0; i < MAX_CPLBS; i++) {
35 unsigned long addr = *table++; 35 bfin_write32(ICPLB_ADDR0 + i * 4, icplb_tbl[i].addr);
36 unsigned long data = *table++; 36 bfin_write32(ICPLB_DATA0 + i * 4, icplb_tbl[i].data);
37 if (addr == (unsigned long)-1)
38 break;
39 bfin_write32(ICPLB_ADDR0 + i * 4, addr);
40 bfin_write32(ICPLB_DATA0 + i * 4, data);
41 } 37 }
42 ctrl = bfin_read_IMEM_CONTROL(); 38 ctrl = bfin_read_IMEM_CONTROL();
43 ctrl |= IMC | ENICPLB; 39 ctrl |= IMC | ENICPLB;
@@ -47,20 +43,17 @@ void __init bfin_icache_init(void)
47#endif 43#endif
48 44
49#if defined(CONFIG_BFIN_DCACHE) 45#if defined(CONFIG_BFIN_DCACHE)
50void __init bfin_dcache_init(void) 46void __cpuinit bfin_dcache_init(struct cplb_entry *dcplb_tbl)
51{ 47{
52 unsigned long *table = dcplb_table;
53 unsigned long ctrl; 48 unsigned long ctrl;
54 int i; 49 int i;
55 50
51 SSYNC();
56 for (i = 0; i < MAX_CPLBS; i++) { 52 for (i = 0; i < MAX_CPLBS; i++) {
57 unsigned long addr = *table++; 53 bfin_write32(DCPLB_ADDR0 + i * 4, dcplb_tbl[i].addr);
58 unsigned long data = *table++; 54 bfin_write32(DCPLB_DATA0 + i * 4, dcplb_tbl[i].data);
59 if (addr == (unsigned long)-1)
60 break;
61 bfin_write32(DCPLB_ADDR0 + i * 4, addr);
62 bfin_write32(DCPLB_DATA0 + i * 4, data);
63 } 55 }
56
64 ctrl = bfin_read_DMEM_CONTROL(); 57 ctrl = bfin_read_DMEM_CONTROL();
65 ctrl |= DMEM_CNTR; 58 ctrl |= DMEM_CNTR;
66 bfin_write_DMEM_CONTROL(ctrl); 59 bfin_write_DMEM_CONTROL(ctrl);
diff --git a/arch/blackfin/kernel/cplb-nompu/cplbhdlr.S b/arch/blackfin/kernel/cplb-nompu/cplbhdlr.S
deleted file mode 100644
index ecbabc0a1fed..000000000000
--- a/arch/blackfin/kernel/cplb-nompu/cplbhdlr.S
+++ /dev/null
@@ -1,130 +0,0 @@
1/*
2 * File: arch/blackfin/mach-common/cplbhdlr.S
3 * Based on:
4 * Author: LG Soft India
5 *
6 * Created: ?
7 * Description: CPLB exception handler
8 *
9 * Modified:
10 * Copyright 2004-2006 Analog Devices Inc.
11 *
12 * Bugs: Enter bugs at http://blackfin.uclinux.org/
13 *
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 2 of the License, or
17 * (at your option) any later version.
18 *
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
23 *
24 * You should have received a copy of the GNU General Public License
25 * along with this program; if not, see the file COPYING, or write
26 * to the Free Software Foundation, Inc.,
27 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
28 */
29
30#include <linux/linkage.h>
31#include <asm/cplb.h>
32#include <asm/entry.h>
33
34#ifdef CONFIG_EXCPT_IRQ_SYSC_L1
35.section .l1.text
36#else
37.text
38#endif
39
40.type _cplb_mgr, STT_FUNC;
41.type _panic_cplb_error, STT_FUNC;
42
43.align 2
44
45ENTRY(__cplb_hdr)
46 R2 = SEQSTAT;
47
48 /* Mask the contents of SEQSTAT and leave only EXCAUSE in R2 */
49 R2 <<= 26;
50 R2 >>= 26;
51
52 R1 = 0x23; /* Data access CPLB protection violation */
53 CC = R2 == R1;
54 IF !CC JUMP .Lnot_data_write;
55 R0 = 2; /* is a write to data space*/
56 JUMP .Lis_icplb_miss;
57
58.Lnot_data_write:
59 R1 = 0x2C; /* CPLB miss on an instruction fetch */
60 CC = R2 == R1;
61 R0 = 0; /* is_data_miss == False*/
62 IF CC JUMP .Lis_icplb_miss;
63
64 R1 = 0x26;
65 CC = R2 == R1;
66 IF !CC JUMP .Lunknown;
67
68 R0 = 1; /* is_data_miss == True*/
69
70.Lis_icplb_miss:
71
72#if defined(CONFIG_BFIN_ICACHE) || defined(CONFIG_BFIN_DCACHE)
73# if defined(CONFIG_BFIN_ICACHE) && !defined(CONFIG_BFIN_DCACHE)
74 R1 = CPLB_ENABLE_ICACHE;
75# endif
76# if !defined(CONFIG_BFIN_ICACHE) && defined(CONFIG_BFIN_DCACHE)
77 R1 = CPLB_ENABLE_DCACHE;
78# endif
79# if defined(CONFIG_BFIN_ICACHE) && defined(CONFIG_BFIN_DCACHE)
80 R1 = CPLB_ENABLE_DCACHE | CPLB_ENABLE_ICACHE;
81# endif
82#else
83 R1 = 0;
84#endif
85
86 [--SP] = RETS;
87 CALL _cplb_mgr;
88 RETS = [SP++];
89 CC = R0 == 0;
90 IF !CC JUMP .Lnot_replaced;
91 RTS;
92
93/*
94 * Diagnostic exception handlers
95 */
96.Lunknown:
97 R0 = CPLB_UNKNOWN_ERR;
98 JUMP .Lcplb_error;
99
100.Lnot_replaced:
101 CC = R0 == CPLB_NO_UNLOCKED;
102 IF !CC JUMP .Lnext_check;
103 R0 = CPLB_NO_UNLOCKED;
104 JUMP .Lcplb_error;
105
106.Lnext_check:
107 CC = R0 == CPLB_NO_ADDR_MATCH;
108 IF !CC JUMP .Lnext_check2;
109 R0 = CPLB_NO_ADDR_MATCH;
110 JUMP .Lcplb_error;
111
112.Lnext_check2:
113 CC = R0 == CPLB_PROT_VIOL;
114 IF !CC JUMP .Lstrange_return_from_cplb_mgr;
115 R0 = CPLB_PROT_VIOL;
116 JUMP .Lcplb_error;
117
118.Lstrange_return_from_cplb_mgr:
119 IDLE;
120 CSYNC;
121 JUMP .Lstrange_return_from_cplb_mgr;
122
123.Lcplb_error:
124 R1 = sp;
125 SP += -12;
126 call _panic_cplb_error;
127 SP += 12;
128 JUMP.L _handle_bad_cplb;
129
130ENDPROC(__cplb_hdr)
diff --git a/arch/blackfin/kernel/cplb-nompu/cplbinfo.c b/arch/blackfin/kernel/cplb-nompu/cplbinfo.c
deleted file mode 100644
index 1e74f0b97996..000000000000
--- a/arch/blackfin/kernel/cplb-nompu/cplbinfo.c
+++ /dev/null
@@ -1,195 +0,0 @@
1/*
2 * File: arch/blackfin/mach-common/cplbinfo.c
3 * Based on:
4 * Author: Sonic Zhang <sonic.zhang@analog.com>
5 *
6 * Created: Jan. 2005
7 * Description: Display CPLB status
8 *
9 * Modified:
10 * Copyright 2004-2006 Analog Devices Inc.
11 *
12 * Bugs: Enter bugs at http://blackfin.uclinux.org/
13 *
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 2 of the License, or
17 * (at your option) any later version.
18 *
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
23 *
24 * You should have received a copy of the GNU General Public License
25 * along with this program; if not, see the file COPYING, or write
26 * to the Free Software Foundation, Inc.,
27 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
28 */
29
30#include <linux/module.h>
31#include <linux/kernel.h>
32#include <linux/init.h>
33#include <linux/proc_fs.h>
34#include <linux/uaccess.h>
35
36#include <asm/cplbinit.h>
37#include <asm/blackfin.h>
38
39#define CPLB_I 1
40#define CPLB_D 2
41
42#define SYNC_SYS SSYNC()
43#define SYNC_CORE CSYNC()
44
45#define CPLB_BIT_PAGESIZE 0x30000
46
47static int page_size_table[4] = {
48 0x00000400, /* 1K */
49 0x00001000, /* 4K */
50 0x00100000, /* 1M */
51 0x00400000 /* 4M */
52};
53
54static char page_size_string_table[][4] = { "1K", "4K", "1M", "4M" };
55
56static int cplb_find_entry(unsigned long *cplb_addr,
57 unsigned long *cplb_data, unsigned long addr,
58 unsigned long data)
59{
60 int ii;
61
62 for (ii = 0; ii < 16; ii++)
63 if (addr >= cplb_addr[ii] && addr < cplb_addr[ii] +
64 page_size_table[(cplb_data[ii] & CPLB_BIT_PAGESIZE) >> 16]
65 && (cplb_data[ii] == data))
66 return ii;
67
68 return -1;
69}
70
71static char *cplb_print_entry(char *buf, int type)
72{
73 unsigned long *p_addr = dpdt_table;
74 unsigned long *p_data = dpdt_table + 1;
75 unsigned long *p_icount = dpdt_swapcount_table;
76 unsigned long *p_ocount = dpdt_swapcount_table + 1;
77 unsigned long *cplb_addr = (unsigned long *)DCPLB_ADDR0;
78 unsigned long *cplb_data = (unsigned long *)DCPLB_DATA0;
79 int entry = 0, used_cplb = 0;
80
81 if (type == CPLB_I) {
82 buf += sprintf(buf, "Instruction CPLB entry:\n");
83 p_addr = ipdt_table;
84 p_data = ipdt_table + 1;
85 p_icount = ipdt_swapcount_table;
86 p_ocount = ipdt_swapcount_table + 1;
87 cplb_addr = (unsigned long *)ICPLB_ADDR0;
88 cplb_data = (unsigned long *)ICPLB_DATA0;
89 } else
90 buf += sprintf(buf, "Data CPLB entry:\n");
91
92 buf += sprintf(buf, "Address\t\tData\tSize\tValid\tLocked\tSwapin\tiCount\toCount\n");
93
94 while (*p_addr != 0xffffffff) {
95 entry = cplb_find_entry(cplb_addr, cplb_data, *p_addr, *p_data);
96 if (entry >= 0)
97 used_cplb |= 1 << entry;
98
99 buf +=
100 sprintf(buf,
101 "0x%08lx\t0x%05lx\t%s\t%c\t%c\t%2d\t%ld\t%ld\n",
102 *p_addr, *p_data,
103 page_size_string_table[(*p_data & 0x30000) >> 16],
104 (*p_data & CPLB_VALID) ? 'Y' : 'N',
105 (*p_data & CPLB_LOCK) ? 'Y' : 'N', entry, *p_icount,
106 *p_ocount);
107
108 p_addr += 2;
109 p_data += 2;
110 p_icount += 2;
111 p_ocount += 2;
112 }
113
114 if (used_cplb != 0xffff) {
115 buf += sprintf(buf, "Unused/mismatched CPLBs:\n");
116
117 for (entry = 0; entry < 16; entry++)
118 if (0 == ((1 << entry) & used_cplb)) {
119 int flags = cplb_data[entry];
120 buf +=
121 sprintf(buf,
122 "%2d: 0x%08lx\t0x%05x\t%s\t%c\t%c\n",
123 entry, cplb_addr[entry], flags,
124 page_size_string_table[(flags &
125 0x30000) >>
126 16],
127 (flags & CPLB_VALID) ? 'Y' : 'N',
128 (flags & CPLB_LOCK) ? 'Y' : 'N');
129 }
130 }
131
132 buf += sprintf(buf, "\n");
133
134 return buf;
135}
136
137static int cplbinfo_proc_output(char *buf)
138{
139 char *p;
140
141 p = buf;
142
143 p += sprintf(p, "------------------ CPLB Information ------------------\n\n");
144
145 if (bfin_read_IMEM_CONTROL() & ENICPLB)
146 p = cplb_print_entry(p, CPLB_I);
147 else
148 p += sprintf(p, "Instruction CPLB is disabled.\n\n");
149
150 if (bfin_read_DMEM_CONTROL() & ENDCPLB)
151 p = cplb_print_entry(p, CPLB_D);
152 else
153 p += sprintf(p, "Data CPLB is disabled.\n");
154
155 return p - buf;
156}
157
158static int cplbinfo_read_proc(char *page, char **start, off_t off,
159 int count, int *eof, void *data)
160{
161 int len;
162
163 len = cplbinfo_proc_output(page);
164 if (len <= off + count)
165 *eof = 1;
166 *start = page + off;
167 len -= off;
168 if (len > count)
169 len = count;
170 if (len < 0)
171 len = 0;
172 return len;
173}
174
175static int __init cplbinfo_init(void)
176{
177 struct proc_dir_entry *entry;
178
179 entry = create_proc_entry("cplbinfo", 0, NULL);
180 if (!entry)
181 return -ENOMEM;
182
183 entry->read_proc = cplbinfo_read_proc;
184 entry->data = NULL;
185
186 return 0;
187}
188
189static void __exit cplbinfo_exit(void)
190{
191 remove_proc_entry("cplbinfo", NULL);
192}
193
194module_init(cplbinfo_init);
195module_exit(cplbinfo_exit);
diff --git a/arch/blackfin/kernel/cplb-nompu/cplbinit.c b/arch/blackfin/kernel/cplb-nompu/cplbinit.c
index 2debc900e246..0e28f7595733 100644
--- a/arch/blackfin/kernel/cplb-nompu/cplbinit.c
+++ b/arch/blackfin/kernel/cplb-nompu/cplbinit.c
@@ -20,445 +20,152 @@
20 * to the Free Software Foundation, Inc., 20 * to the Free Software Foundation, Inc.,
21 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 21 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 */ 22 */
23
23#include <linux/module.h> 24#include <linux/module.h>
24 25
25#include <asm/blackfin.h> 26#include <asm/blackfin.h>
26#include <asm/cacheflush.h> 27#include <asm/cacheflush.h>
27#include <asm/cplb.h> 28#include <asm/cplb.h>
28#include <asm/cplbinit.h> 29#include <asm/cplbinit.h>
30#include <asm/mem_map.h>
29 31
30#define CPLB_MEM CONFIG_MAX_MEM_SIZE 32struct cplb_entry icplb_tbl[NR_CPUS][MAX_CPLBS] PDT_ATTR;
31 33struct cplb_entry dcplb_tbl[NR_CPUS][MAX_CPLBS] PDT_ATTR;
32/*
33* Number of required data CPLB switchtable entries
34* MEMSIZE / 4 (we mostly install 4M page size CPLBs
35* approx 16 for smaller 1MB page size CPLBs for allignment purposes
36* 1 for L1 Data Memory
37* possibly 1 for L2 Data Memory
38* 1 for CONFIG_DEBUG_HUNT_FOR_ZERO
39* 1 for ASYNC Memory
40*/
41#define MAX_SWITCH_D_CPLBS (((CPLB_MEM / 4) + 16 + 1 + 1 + 1 \
42 + ASYNC_MEMORY_CPLB_COVERAGE) * 2)
43
44/*
45* Number of required instruction CPLB switchtable entries
46* MEMSIZE / 4 (we mostly install 4M page size CPLBs
47* approx 12 for smaller 1MB page size CPLBs for allignment purposes
48* 1 for L1 Instruction Memory
49* possibly 1 for L2 Instruction Memory
50* 1 for CONFIG_DEBUG_HUNT_FOR_ZERO
51*/
52#define MAX_SWITCH_I_CPLBS (((CPLB_MEM / 4) + 12 + 1 + 1 + 1) * 2)
53
54
55u_long icplb_table[MAX_CPLBS + 1];
56u_long dcplb_table[MAX_CPLBS + 1];
57
58#ifdef CONFIG_CPLB_SWITCH_TAB_L1
59# define PDT_ATTR __attribute__((l1_data))
60#else
61# define PDT_ATTR
62#endif
63
64u_long ipdt_table[MAX_SWITCH_I_CPLBS + 1] PDT_ATTR;
65u_long dpdt_table[MAX_SWITCH_D_CPLBS + 1] PDT_ATTR;
66 34
67#ifdef CONFIG_CPLB_INFO 35int first_switched_icplb PDT_ATTR;
68u_long ipdt_swapcount_table[MAX_SWITCH_I_CPLBS] PDT_ATTR; 36int first_switched_dcplb PDT_ATTR;
69u_long dpdt_swapcount_table[MAX_SWITCH_D_CPLBS] PDT_ATTR;
70#endif
71 37
72struct s_cplb { 38struct cplb_boundary dcplb_bounds[9] PDT_ATTR;
73 struct cplb_tab init_i; 39struct cplb_boundary icplb_bounds[7] PDT_ATTR;
74 struct cplb_tab init_d;
75 struct cplb_tab switch_i;
76 struct cplb_tab switch_d;
77};
78 40
79#if defined(CONFIG_BFIN_DCACHE) || defined(CONFIG_BFIN_ICACHE) 41int icplb_nr_bounds PDT_ATTR;
80static struct cplb_desc cplb_data[] = { 42int dcplb_nr_bounds PDT_ATTR;
81 {
82 .start = 0,
83 .end = SIZE_1K,
84 .psize = SIZE_1K,
85 .attr = INITIAL_T | SWITCH_T | I_CPLB | D_CPLB,
86 .i_conf = SDRAM_OOPS,
87 .d_conf = SDRAM_OOPS,
88#if defined(CONFIG_DEBUG_HUNT_FOR_ZERO)
89 .valid = 1,
90#else
91 .valid = 0,
92#endif
93 .name = "Zero Pointer Guard Page",
94 },
95 {
96 .start = L1_CODE_START,
97 .end = L1_CODE_START + L1_CODE_LENGTH,
98 .psize = SIZE_4M,
99 .attr = INITIAL_T | SWITCH_T | I_CPLB,
100 .i_conf = L1_IMEMORY,
101 .d_conf = 0,
102 .valid = 1,
103 .name = "L1 I-Memory",
104 },
105 {
106 .start = L1_DATA_A_START,
107 .end = L1_DATA_B_START + L1_DATA_B_LENGTH,
108 .psize = SIZE_4M,
109 .attr = INITIAL_T | SWITCH_T | D_CPLB,
110 .i_conf = 0,
111 .d_conf = L1_DMEMORY,
112#if ((L1_DATA_A_LENGTH > 0) || (L1_DATA_B_LENGTH > 0))
113 .valid = 1,
114#else
115 .valid = 0,
116#endif
117 .name = "L1 D-Memory",
118 },
119 {
120 .start = 0,
121 .end = 0, /* dynamic */
122 .psize = 0,
123 .attr = INITIAL_T | SWITCH_T | I_CPLB | D_CPLB,
124 .i_conf = SDRAM_IGENERIC,
125 .d_conf = SDRAM_DGENERIC,
126 .valid = 1,
127 .name = "Kernel Memory",
128 },
129 {
130 .start = 0, /* dynamic */
131 .end = 0, /* dynamic */
132 .psize = 0,
133 .attr = INITIAL_T | SWITCH_T | D_CPLB,
134 .i_conf = SDRAM_IGENERIC,
135 .d_conf = SDRAM_DNON_CHBL,
136 .valid = 1,
137 .name = "uClinux MTD Memory",
138 },
139 {
140 .start = 0, /* dynamic */
141 .end = 0, /* dynamic */
142 .psize = SIZE_1M,
143 .attr = INITIAL_T | SWITCH_T | D_CPLB,
144 .d_conf = SDRAM_DNON_CHBL,
145 .valid = 1,
146 .name = "Uncached DMA Zone",
147 },
148 {
149 .start = 0, /* dynamic */
150 .end = 0, /* dynamic */
151 .psize = 0,
152 .attr = SWITCH_T | D_CPLB,
153 .i_conf = 0, /* dynamic */
154 .d_conf = 0, /* dynamic */
155 .valid = 1,
156 .name = "Reserved Memory",
157 },
158 {
159 .start = ASYNC_BANK0_BASE,
160 .end = ASYNC_BANK3_BASE + ASYNC_BANK3_SIZE,
161 .psize = 0,
162 .attr = SWITCH_T | D_CPLB,
163 .d_conf = SDRAM_EBIU,
164 .valid = 1,
165 .name = "Asynchronous Memory Banks",
166 },
167 {
168 .start = L2_START,
169 .end = L2_START + L2_LENGTH,
170 .psize = SIZE_1M,
171 .attr = SWITCH_T | I_CPLB | D_CPLB,
172 .i_conf = L2_IMEMORY,
173 .d_conf = L2_DMEMORY,
174 .valid = (L2_LENGTH > 0),
175 .name = "L2 Memory",
176 },
177 {
178 .start = BOOT_ROM_START,
179 .end = BOOT_ROM_START + BOOT_ROM_LENGTH,
180 .psize = SIZE_1M,
181 .attr = SWITCH_T | I_CPLB | D_CPLB,
182 .i_conf = SDRAM_IGENERIC,
183 .d_conf = SDRAM_DGENERIC,
184 .valid = 1,
185 .name = "On-Chip BootROM",
186 },
187};
188 43
189static u16 __init lock_kernel_check(u32 start, u32 end) 44void __init generate_cplb_tables_cpu(unsigned int cpu)
190{ 45{
191 if (start >= (u32)_end || end <= (u32)_stext) 46 int i_d, i_i;
192 return 0; 47 unsigned long addr;
193 48
194 /* This cplb block overlapped with kernel area. */ 49 struct cplb_entry *d_tbl = dcplb_tbl[cpu];
195 return IN_KERNEL; 50 struct cplb_entry *i_tbl = icplb_tbl[cpu];
196}
197 51
198static unsigned short __init 52 printk(KERN_INFO "NOMPU: setting up cplb tables\n");
199fill_cplbtab(struct cplb_tab *table,
200 unsigned long start, unsigned long end,
201 unsigned long block_size, unsigned long cplb_data)
202{
203 int i;
204 53
205 switch (block_size) { 54 i_d = i_i = 0;
206 case SIZE_4M:
207 i = 3;
208 break;
209 case SIZE_1M:
210 i = 2;
211 break;
212 case SIZE_4K:
213 i = 1;
214 break;
215 case SIZE_1K:
216 default:
217 i = 0;
218 break;
219 }
220
221 cplb_data = (cplb_data & ~(3 << 16)) | (i << 16);
222
223 while ((start < end) && (table->pos < table->size)) {
224 55
225 table->tab[table->pos++] = start; 56 /* Set up the zero page. */
57 d_tbl[i_d].addr = 0;
58 d_tbl[i_d++].data = SDRAM_OOPS | PAGE_SIZE_1KB;
226 59
227 if (lock_kernel_check(start, start + block_size) == IN_KERNEL) 60 /* Cover kernel memory with 4M pages. */
228 table->tab[table->pos++] = 61 addr = 0;
229 cplb_data | CPLB_LOCK | CPLB_DIRTY;
230 else
231 table->tab[table->pos++] = cplb_data;
232 62
233 start += block_size; 63 for (; addr < memory_start; addr += 4 * 1024 * 1024) {
64 d_tbl[i_d].addr = addr;
65 d_tbl[i_d++].data = SDRAM_DGENERIC | PAGE_SIZE_4MB;
66 i_tbl[i_i].addr = addr;
67 i_tbl[i_i++].data = SDRAM_IGENERIC | PAGE_SIZE_4MB;
234 } 68 }
235 return 0;
236}
237 69
238static unsigned short __init 70 /* Cover L1 memory. One 4M area for code and data each is enough. */
239close_cplbtab(struct cplb_tab *table) 71 if (L1_DATA_A_LENGTH || L1_DATA_B_LENGTH) {
240{ 72 d_tbl[i_d].addr = L1_DATA_A_START;
241 73 d_tbl[i_d++].data = L1_DMEMORY | PAGE_SIZE_4MB;
242 while (table->pos < table->size) {
243
244 table->tab[table->pos++] = 0;
245 table->tab[table->pos++] = 0; /* !CPLB_VALID */
246 } 74 }
247 return 0; 75 i_tbl[i_i].addr = L1_CODE_START;
248} 76 i_tbl[i_i++].data = L1_IMEMORY | PAGE_SIZE_4MB;
249 77
250/* helper function */ 78 first_switched_dcplb = i_d;
251static void __init 79 first_switched_icplb = i_i;
252__fill_code_cplbtab(struct cplb_tab *t, int i, u32 a_start, u32 a_end)
253{
254 if (cplb_data[i].psize) {
255 fill_cplbtab(t,
256 cplb_data[i].start,
257 cplb_data[i].end,
258 cplb_data[i].psize,
259 cplb_data[i].i_conf);
260 } else {
261#if defined(CONFIG_BFIN_ICACHE)
262 if (ANOMALY_05000263 && i == SDRAM_KERN) {
263 fill_cplbtab(t,
264 cplb_data[i].start,
265 cplb_data[i].end,
266 SIZE_4M,
267 cplb_data[i].i_conf);
268 } else
269#endif
270 {
271 fill_cplbtab(t,
272 cplb_data[i].start,
273 a_start,
274 SIZE_1M,
275 cplb_data[i].i_conf);
276 fill_cplbtab(t,
277 a_start,
278 a_end,
279 SIZE_4M,
280 cplb_data[i].i_conf);
281 fill_cplbtab(t, a_end,
282 cplb_data[i].end,
283 SIZE_1M,
284 cplb_data[i].i_conf);
285 }
286 }
287}
288 80
289static void __init 81 BUG_ON(first_switched_dcplb > MAX_CPLBS);
290__fill_data_cplbtab(struct cplb_tab *t, int i, u32 a_start, u32 a_end) 82 BUG_ON(first_switched_icplb > MAX_CPLBS);
291{ 83
292 if (cplb_data[i].psize) { 84 while (i_d < MAX_CPLBS)
293 fill_cplbtab(t, 85 d_tbl[i_d++].data = 0;
294 cplb_data[i].start, 86 while (i_i < MAX_CPLBS)
295 cplb_data[i].end, 87 i_tbl[i_i++].data = 0;
296 cplb_data[i].psize,
297 cplb_data[i].d_conf);
298 } else {
299 fill_cplbtab(t,
300 cplb_data[i].start,
301 a_start, SIZE_1M,
302 cplb_data[i].d_conf);
303 fill_cplbtab(t, a_start,
304 a_end, SIZE_4M,
305 cplb_data[i].d_conf);
306 fill_cplbtab(t, a_end,
307 cplb_data[i].end,
308 SIZE_1M,
309 cplb_data[i].d_conf);
310 }
311} 88}
312 89
313void __init generate_cplb_tables(void) 90void __init generate_cplb_tables_all(void)
314{ 91{
92 int i_d, i_i;
315 93
316 u16 i, j, process; 94 i_d = 0;
317 u32 a_start, a_end, as, ae, as_1m; 95 /* Normal RAM, including MTD FS. */
318
319 struct cplb_tab *t_i = NULL;
320 struct cplb_tab *t_d = NULL;
321 struct s_cplb cplb;
322
323 printk(KERN_INFO "NOMPU: setting up cplb tables for global access\n");
324
325 cplb.init_i.size = MAX_CPLBS;
326 cplb.init_d.size = MAX_CPLBS;
327 cplb.switch_i.size = MAX_SWITCH_I_CPLBS;
328 cplb.switch_d.size = MAX_SWITCH_D_CPLBS;
329
330 cplb.init_i.pos = 0;
331 cplb.init_d.pos = 0;
332 cplb.switch_i.pos = 0;
333 cplb.switch_d.pos = 0;
334
335 cplb.init_i.tab = icplb_table;
336 cplb.init_d.tab = dcplb_table;
337 cplb.switch_i.tab = ipdt_table;
338 cplb.switch_d.tab = dpdt_table;
339
340 cplb_data[SDRAM_KERN].end = memory_end;
341
342#ifdef CONFIG_MTD_UCLINUX 96#ifdef CONFIG_MTD_UCLINUX
343 cplb_data[SDRAM_RAM_MTD].start = memory_mtd_start; 97 dcplb_bounds[i_d].eaddr = memory_mtd_start + mtd_size;
344 cplb_data[SDRAM_RAM_MTD].end = memory_mtd_start + mtd_size;
345 cplb_data[SDRAM_RAM_MTD].valid = mtd_size > 0;
346# if defined(CONFIG_ROMFS_FS)
347 cplb_data[SDRAM_RAM_MTD].attr |= I_CPLB;
348
349 /*
350 * The ROMFS_FS size is often not multiple of 1MB.
351 * This can cause multiple CPLB sets covering the same memory area.
352 * This will then cause multiple CPLB hit exceptions.
353 * Workaround: We ensure a contiguous memory area by extending the kernel
354 * memory section over the mtd section.
355 * For ROMFS_FS memory must be covered with ICPLBs anyways.
356 * So there is no difference between kernel and mtd memory setup.
357 */
358
359 cplb_data[SDRAM_KERN].end = memory_mtd_start + mtd_size;;
360 cplb_data[SDRAM_RAM_MTD].valid = 0;
361
362# endif
363#else 98#else
364 cplb_data[SDRAM_RAM_MTD].valid = 0; 99 dcplb_bounds[i_d].eaddr = memory_end;
365#endif 100#endif
101 dcplb_bounds[i_d++].data = SDRAM_DGENERIC;
102 /* DMA uncached region. */
103 if (DMA_UNCACHED_REGION) {
104 dcplb_bounds[i_d].eaddr = _ramend;
105 dcplb_bounds[i_d++].data = SDRAM_DNON_CHBL;
106 }
107 if (_ramend != physical_mem_end) {
108 /* Reserved memory. */
109 dcplb_bounds[i_d].eaddr = physical_mem_end;
110 dcplb_bounds[i_d++].data = (reserved_mem_dcache_on ?
111 SDRAM_DGENERIC : SDRAM_DNON_CHBL);
112 }
113 /* Addressing hole up to the async bank. */
114 dcplb_bounds[i_d].eaddr = ASYNC_BANK0_BASE;
115 dcplb_bounds[i_d++].data = 0;
116 /* ASYNC banks. */
117 dcplb_bounds[i_d].eaddr = ASYNC_BANK3_BASE + ASYNC_BANK3_SIZE;
118 dcplb_bounds[i_d++].data = SDRAM_EBIU;
119 /* Addressing hole up to BootROM. */
120 dcplb_bounds[i_d].eaddr = BOOT_ROM_START;
121 dcplb_bounds[i_d++].data = 0;
122 /* BootROM -- largest one should be less than 1 meg. */
123 dcplb_bounds[i_d].eaddr = BOOT_ROM_START + (1 * 1024 * 1024);
124 dcplb_bounds[i_d++].data = SDRAM_DGENERIC;
125 if (L2_LENGTH) {
126 /* Addressing hole up to L2 SRAM. */
127 dcplb_bounds[i_d].eaddr = L2_START;
128 dcplb_bounds[i_d++].data = 0;
129 /* L2 SRAM. */
130 dcplb_bounds[i_d].eaddr = L2_START + L2_LENGTH;
131 dcplb_bounds[i_d++].data = L2_DMEMORY;
132 }
133 dcplb_nr_bounds = i_d;
134 BUG_ON(dcplb_nr_bounds > ARRAY_SIZE(dcplb_bounds));
366 135
367 cplb_data[SDRAM_DMAZ].start = _ramend - DMA_UNCACHED_REGION; 136 i_i = 0;
368 cplb_data[SDRAM_DMAZ].end = _ramend; 137 /* Normal RAM, including MTD FS. */
369
370 cplb_data[RES_MEM].start = _ramend;
371 cplb_data[RES_MEM].end = physical_mem_end;
372
373 if (reserved_mem_dcache_on)
374 cplb_data[RES_MEM].d_conf = SDRAM_DGENERIC;
375 else
376 cplb_data[RES_MEM].d_conf = SDRAM_DNON_CHBL;
377
378 if (reserved_mem_icache_on)
379 cplb_data[RES_MEM].i_conf = SDRAM_IGENERIC;
380 else
381 cplb_data[RES_MEM].i_conf = SDRAM_INON_CHBL;
382
383 for (i = ZERO_P; i < ARRAY_SIZE(cplb_data); ++i) {
384 if (!cplb_data[i].valid)
385 continue;
386
387 as_1m = cplb_data[i].start % SIZE_1M;
388
389 /* We need to make sure all sections are properly 1M aligned
390 * However between Kernel Memory and the Kernel mtd section, depending on the
391 * rootfs size, there can be overlapping memory areas.
392 */
393
394 if (as_1m && i != L1I_MEM && i != L1D_MEM) {
395#ifdef CONFIG_MTD_UCLINUX 138#ifdef CONFIG_MTD_UCLINUX
396 if (i == SDRAM_RAM_MTD) { 139 icplb_bounds[i_i].eaddr = memory_mtd_start + mtd_size;
397 if ((cplb_data[SDRAM_KERN].end + 1) > cplb_data[SDRAM_RAM_MTD].start) 140#else
398 cplb_data[SDRAM_RAM_MTD].start = (cplb_data[i].start & (-2*SIZE_1M)) + SIZE_1M; 141 icplb_bounds[i_i].eaddr = memory_end;
399 else
400 cplb_data[SDRAM_RAM_MTD].start = (cplb_data[i].start & (-2*SIZE_1M));
401 } else
402#endif 142#endif
403 printk(KERN_WARNING "Unaligned Start of %s at 0x%X\n", 143 icplb_bounds[i_i++].data = SDRAM_IGENERIC;
404 cplb_data[i].name, cplb_data[i].start); 144 /* DMA uncached region. */
405 } 145 if (DMA_UNCACHED_REGION) {
406 146 icplb_bounds[i_i].eaddr = _ramend;
407 as = cplb_data[i].start % SIZE_4M; 147 icplb_bounds[i_i++].data = 0;
408 ae = cplb_data[i].end % SIZE_4M;
409
410 if (as)
411 a_start = cplb_data[i].start + (SIZE_4M - (as));
412 else
413 a_start = cplb_data[i].start;
414
415 a_end = cplb_data[i].end - ae;
416
417 for (j = INITIAL_T; j <= SWITCH_T; j++) {
418
419 switch (j) {
420 case INITIAL_T:
421 if (cplb_data[i].attr & INITIAL_T) {
422 t_i = &cplb.init_i;
423 t_d = &cplb.init_d;
424 process = 1;
425 } else
426 process = 0;
427 break;
428 case SWITCH_T:
429 if (cplb_data[i].attr & SWITCH_T) {
430 t_i = &cplb.switch_i;
431 t_d = &cplb.switch_d;
432 process = 1;
433 } else
434 process = 0;
435 break;
436 default:
437 process = 0;
438 break;
439 }
440
441 if (!process)
442 continue;
443 if (cplb_data[i].attr & I_CPLB)
444 __fill_code_cplbtab(t_i, i, a_start, a_end);
445
446 if (cplb_data[i].attr & D_CPLB)
447 __fill_data_cplbtab(t_d, i, a_start, a_end);
448 }
449 } 148 }
450 149 if (_ramend != physical_mem_end) {
451/* close tables */ 150 /* Reserved memory. */
452 151 icplb_bounds[i_i].eaddr = physical_mem_end;
453 close_cplbtab(&cplb.init_i); 152 icplb_bounds[i_i++].data = (reserved_mem_icache_on ?
454 close_cplbtab(&cplb.init_d); 153 SDRAM_IGENERIC : SDRAM_INON_CHBL);
455 154 }
456 cplb.init_i.tab[cplb.init_i.pos] = -1; 155 /* Addressing hole up to BootROM. */
457 cplb.init_d.tab[cplb.init_d.pos] = -1; 156 icplb_bounds[i_i].eaddr = BOOT_ROM_START;
458 cplb.switch_i.tab[cplb.switch_i.pos] = -1; 157 icplb_bounds[i_i++].data = 0;
459 cplb.switch_d.tab[cplb.switch_d.pos] = -1; 158 /* BootROM -- largest one should be less than 1 meg. */
460 159 icplb_bounds[i_i].eaddr = BOOT_ROM_START + (1 * 1024 * 1024);
160 icplb_bounds[i_i++].data = SDRAM_IGENERIC;
161 if (L2_LENGTH) {
162 /* Addressing hole up to L2 SRAM, including the async bank. */
163 icplb_bounds[i_i].eaddr = L2_START;
164 icplb_bounds[i_i++].data = 0;
165 /* L2 SRAM. */
166 icplb_bounds[i_i].eaddr = L2_START + L2_LENGTH;
167 icplb_bounds[i_i++].data = L2_IMEMORY;
168 }
169 icplb_nr_bounds = i_i;
170 BUG_ON(icplb_nr_bounds > ARRAY_SIZE(icplb_bounds));
461} 171}
462
463#endif
464
diff --git a/arch/blackfin/kernel/cplb-nompu/cplbmgr.S b/arch/blackfin/kernel/cplb-nompu/cplbmgr.S
deleted file mode 100644
index f5cf3accef37..000000000000
--- a/arch/blackfin/kernel/cplb-nompu/cplbmgr.S
+++ /dev/null
@@ -1,646 +0,0 @@
1/*
2 * File: arch/blackfin/mach-common/cplbmgtr.S
3 * Based on:
4 * Author: LG Soft India
5 *
6 * Created: ?
7 * Description: CPLB replacement routine for CPLB mismatch
8 *
9 * Modified:
10 * Copyright 2004-2006 Analog Devices Inc.
11 *
12 * Bugs: Enter bugs at http://blackfin.uclinux.org/
13 *
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 2 of the License, or
17 * (at your option) any later version.
18 *
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
23 *
24 * You should have received a copy of the GNU General Public License
25 * along with this program; if not, see the file COPYING, or write
26 * to the Free Software Foundation, Inc.,
27 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
28 */
29
30/* Usage: int _cplb_mgr(is_data_miss,int enable_cache)
31 * is_data_miss==2 => Mark as Dirty, write to the clean data page
32 * is_data_miss==1 => Replace a data CPLB.
33 * is_data_miss==0 => Replace an instruction CPLB.
34 *
35 * Returns:
36 * CPLB_RELOADED => Successfully updated CPLB table.
37 * CPLB_NO_UNLOCKED => All CPLBs are locked, so cannot be evicted.
38 * This indicates that the CPLBs in the configuration
39 * tablei are badly configured, as this should never
40 * occur.
41 * CPLB_NO_ADDR_MATCH => The address being accessed, that triggered the
42 * exception, is not covered by any of the CPLBs in
43 * the configuration table. The application is
44 * presumably misbehaving.
45 * CPLB_PROT_VIOL => The address being accessed, that triggered the
46 * exception, was not a first-write to a clean Write
47 * Back Data page, and so presumably is a genuine
48 * violation of the page's protection attributes.
49 * The application is misbehaving.
50 */
51
52#include <linux/linkage.h>
53#include <asm/blackfin.h>
54#include <asm/cplb.h>
55
56#ifdef CONFIG_EXCPT_IRQ_SYSC_L1
57.section .l1.text
58#else
59.text
60#endif
61
62.align 2;
63ENTRY(_cplb_mgr)
64
65 [--SP]=( R7:4,P5:3 );
66
67 CC = R0 == 2;
68 IF CC JUMP .Ldcplb_write;
69
70 CC = R0 == 0;
71 IF !CC JUMP .Ldcplb_miss_compare;
72
73 /* ICPLB Miss Exception. We need to choose one of the
74 * currently-installed CPLBs, and replace it with one
75 * from the configuration table.
76 */
77
78 /* A multi-word instruction can cross a page boundary. This means the
79 * first part of the instruction can be in a valid page, but the
80 * second part is not, and hence generates the instruction miss.
81 * However, the fault address is for the start of the instruction,
82 * not the part that's in the bad page. Therefore, we have to check
83 * whether the fault address applies to a page that is already present
84 * in the table.
85 */
86
87 P4.L = LO(ICPLB_FAULT_ADDR);
88 P4.H = HI(ICPLB_FAULT_ADDR);
89
90 P1 = 16;
91 P5.L = _page_size_table;
92 P5.H = _page_size_table;
93
94 P0.L = LO(ICPLB_DATA0);
95 P0.H = HI(ICPLB_DATA0);
96 R4 = [P4]; /* Get faulting address*/
97 R6 = 64; /* Advance past the fault address, which*/
98 R6 = R6 + R4; /* we'll use if we find a match*/
99 R3 = ((16 << 8) | 2); /* Extract mask, two bits at posn 16 */
100
101 R5 = 0;
102.Lisearch:
103
104 R1 = [P0-0x100]; /* Address for this CPLB */
105
106 R0 = [P0++]; /* Info for this CPLB*/
107 CC = BITTST(R0,0); /* Is the CPLB valid?*/
108 IF !CC JUMP .Lnomatch; /* Skip it, if not.*/
109 CC = R4 < R1(IU); /* If fault address less than page start*/
110 IF CC JUMP .Lnomatch; /* then skip this one.*/
111 R2 = EXTRACT(R0,R3.L) (Z); /* Get page size*/
112 P1 = R2;
113 P1 = P5 + (P1<<2); /* index into page-size table*/
114 R2 = [P1]; /* Get the page size*/
115 R1 = R1 + R2; /* and add to page start, to get page end*/
116 CC = R4 < R1(IU); /* and see whether fault addr is in page.*/
117 IF !CC R4 = R6; /* If so, advance the address and finish loop.*/
118 IF !CC JUMP .Lisearch_done;
119.Lnomatch:
120 /* Go around again*/
121 R5 += 1;
122 CC = BITTST(R5, 4); /* i.e CC = R5 >= 16*/
123 IF !CC JUMP .Lisearch;
124
125.Lisearch_done:
126 I0 = R4; /* Fault address we'll search for*/
127
128 /* set up pointers */
129 P0.L = LO(ICPLB_DATA0);
130 P0.H = HI(ICPLB_DATA0);
131
132 /* The replacement procedure for ICPLBs */
133
134 P4.L = LO(IMEM_CONTROL);
135 P4.H = HI(IMEM_CONTROL);
136
137 /* Turn off CPLBs while we work, necessary according to HRM before
138 * modifying CPLB descriptors
139 */
140 R5 = [P4]; /* Control Register*/
141 BITCLR(R5,ENICPLB_P);
142 CLI R1;
143 SSYNC; /* SSYNC required before writing to IMEM_CONTROL. */
144 .align 8;
145 [P4] = R5;
146 SSYNC;
147 STI R1;
148
149 R1 = -1; /* end point comparison */
150 R3 = 16; /* counter */
151
152 /* Search through CPLBs for first non-locked entry */
153 /* Overwrite it by moving everyone else up by 1 */
154.Licheck_lock:
155 R0 = [P0++];
156 R3 = R3 + R1;
157 CC = R3 == R1;
158 IF CC JUMP .Lall_locked;
159 CC = BITTST(R0, 0); /* an invalid entry is good */
160 IF !CC JUMP .Lifound_victim;
161 CC = BITTST(R0,1); /* but a locked entry isn't */
162 IF CC JUMP .Licheck_lock;
163
164.Lifound_victim:
165#ifdef CONFIG_CPLB_INFO
166 R7 = [P0 - 0x104];
167 P2.L = _ipdt_table;
168 P2.H = _ipdt_table;
169 P3.L = _ipdt_swapcount_table;
170 P3.H = _ipdt_swapcount_table;
171 P3 += -4;
172.Licount:
173 R2 = [P2]; /* address from config table */
174 P2 += 8;
175 P3 += 8;
176 CC = R2==-1;
177 IF CC JUMP .Licount_done;
178 CC = R7==R2;
179 IF !CC JUMP .Licount;
180 R7 = [P3];
181 R7 += 1;
182 [P3] = R7;
183 CSYNC;
184.Licount_done:
185#endif
186 LC0=R3;
187 LSETUP(.Lis_move,.Lie_move) LC0;
188.Lis_move:
189 R0 = [P0];
190 [P0 - 4] = R0;
191 R0 = [P0 - 0x100];
192 [P0-0x104] = R0;
193.Lie_move:
194 P0+=4;
195
196 /* Clear ICPLB_DATA15, in case we don't find a replacement
197 * otherwise, we would have a duplicate entry, and will crash
198 */
199 R0 = 0;
200 [P0 - 4] = R0;
201
202 /* We've made space in the ICPLB table, so that ICPLB15
203 * is now free to be overwritten. Next, we have to determine
204 * which CPLB we need to install, from the configuration
205 * table. This is a matter of getting the start-of-page
206 * addresses and page-lengths from the config table, and
207 * determining whether the fault address falls within that
208 * range.
209 */
210
211 P2.L = _ipdt_table;
212 P2.H = _ipdt_table;
213#ifdef CONFIG_CPLB_INFO
214 P3.L = _ipdt_swapcount_table;
215 P3.H = _ipdt_swapcount_table;
216 P3 += -8;
217#endif
218 P0.L = _page_size_table;
219 P0.H = _page_size_table;
220
221 /* Retrieve our fault address (which may have been advanced
222 * because the faulting instruction crossed a page boundary).
223 */
224
225 R0 = I0;
226
227 /* An extraction pattern, to get the page-size bits from
228 * the CPLB data entry. Bits 16-17, so two bits at posn 16.
229 */
230
231 R1 = ((16<<8)|2);
232.Linext: R4 = [P2++]; /* address from config table */
233 R2 = [P2++]; /* data from config table */
234#ifdef CONFIG_CPLB_INFO
235 P3 += 8;
236#endif
237
238 CC = R4 == -1; /* End of config table*/
239 IF CC JUMP .Lno_page_in_table;
240
241 /* See if failed address > start address */
242 CC = R4 <= R0(IU);
243 IF !CC JUMP .Linext;
244
245 /* extract page size (17:16)*/
246 R3 = EXTRACT(R2, R1.L) (Z);
247
248 /* add page size to addr to get range */
249
250 P5 = R3;
251 P5 = P0 + (P5 << 2); /* scaled, for int access*/
252 R3 = [P5];
253 R3 = R3 + R4;
254
255 /* See if failed address < (start address + page size) */
256 CC = R0 < R3(IU);
257 IF !CC JUMP .Linext;
258
259 /* We've found a CPLB in the config table that covers
260 * the faulting address, so install this CPLB into the
261 * last entry of the table.
262 */
263
264 P1.L = LO(ICPLB_DATA15); /* ICPLB_DATA15 */
265 P1.H = HI(ICPLB_DATA15);
266 [P1] = R2;
267 [P1-0x100] = R4;
268#ifdef CONFIG_CPLB_INFO
269 R3 = [P3];
270 R3 += 1;
271 [P3] = R3;
272#endif
273
274 /* P4 points to IMEM_CONTROL, and R5 contains its old
275 * value, after we disabled ICPLBS. Re-enable them.
276 */
277
278 BITSET(R5,ENICPLB_P);
279 CLI R2;
280 SSYNC; /* SSYNC required before writing to IMEM_CONTROL. */
281 .align 8;
282 [P4] = R5;
283 SSYNC;
284 STI R2;
285
286 ( R7:4,P5:3 ) = [SP++];
287 R0 = CPLB_RELOADED;
288 RTS;
289
290/* FAILED CASES*/
291.Lno_page_in_table:
292 R0 = CPLB_NO_ADDR_MATCH;
293 JUMP .Lfail_ret;
294
295.Lall_locked:
296 R0 = CPLB_NO_UNLOCKED;
297 JUMP .Lfail_ret;
298
299.Lprot_violation:
300 R0 = CPLB_PROT_VIOL;
301
302.Lfail_ret:
303 /* Make sure we turn protection/cache back on, even in the failing case */
304 BITSET(R5,ENICPLB_P);
305 CLI R2;
306 SSYNC; /* SSYNC required before writing to IMEM_CONTROL. */
307 .align 8;
308 [P4] = R5;
309 SSYNC;
310 STI R2;
311
312 ( R7:4,P5:3 ) = [SP++];
313 RTS;
314
315.Ldcplb_write:
316
317 /* if a DCPLB is marked as write-back (CPLB_WT==0), and
318 * it is clean (CPLB_DIRTY==0), then a write to the
319 * CPLB's page triggers a protection violation. We have to
320 * mark the CPLB as dirty, to indicate that there are
321 * pending writes associated with the CPLB.
322 */
323
324 P4.L = LO(DCPLB_STATUS);
325 P4.H = HI(DCPLB_STATUS);
326 P3.L = LO(DCPLB_DATA0);
327 P3.H = HI(DCPLB_DATA0);
328 R5 = [P4];
329
330 /* A protection violation can be caused by more than just writes
331 * to a clean WB page, so we have to ensure that:
332 * - It's a write
333 * - to a clean WB page
334 * - and is allowed in the mode the access occurred.
335 */
336
337 CC = BITTST(R5, 16); /* ensure it was a write*/
338 IF !CC JUMP .Lprot_violation;
339
340 /* to check the rest, we have to retrieve the DCPLB.*/
341
342 /* The low half of DCPLB_STATUS is a bit mask*/
343
344 R2 = R5.L (Z); /* indicating which CPLB triggered the event.*/
345 R3 = 30; /* so we can use this to determine the offset*/
346 R2.L = SIGNBITS R2;
347 R2 = R2.L (Z); /* into the DCPLB table.*/
348 R3 = R3 - R2;
349 P4 = R3;
350 P3 = P3 + (P4<<2);
351 R3 = [P3]; /* Retrieve the CPLB*/
352
353 /* Now we can check whether it's a clean WB page*/
354
355 CC = BITTST(R3, 14); /* 0==WB, 1==WT*/
356 IF CC JUMP .Lprot_violation;
357 CC = BITTST(R3, 7); /* 0 == clean, 1 == dirty*/
358 IF CC JUMP .Lprot_violation;
359
360 /* Check whether the write is allowed in the mode that was active.*/
361
362 R2 = 1<<3; /* checking write in user mode*/
363 CC = BITTST(R5, 17); /* 0==was user, 1==was super*/
364 R5 = CC;
365 R2 <<= R5; /* if was super, check write in super mode*/
366 R2 = R3 & R2;
367 CC = R2 == 0;
368 IF CC JUMP .Lprot_violation;
369
370 /* It's a genuine write-to-clean-page.*/
371
372 BITSET(R3, 7); /* mark as dirty*/
373 [P3] = R3; /* and write back.*/
374 NOP;
375 CSYNC;
376 ( R7:4,P5:3 ) = [SP++];
377 R0 = CPLB_RELOADED;
378 RTS;
379
380.Ldcplb_miss_compare:
381
382 /* Data CPLB Miss event. We need to choose a CPLB to
383 * evict, and then locate a new CPLB to install from the
384 * config table, that covers the faulting address.
385 */
386
387 P1.L = LO(DCPLB_DATA15);
388 P1.H = HI(DCPLB_DATA15);
389
390 P4.L = LO(DCPLB_FAULT_ADDR);
391 P4.H = HI(DCPLB_FAULT_ADDR);
392 R4 = [P4];
393 I0 = R4;
394
395 /* The replacement procedure for DCPLBs*/
396
397 R6 = R1; /* Save for later*/
398
399 /* Turn off CPLBs while we work.*/
400 P4.L = LO(DMEM_CONTROL);
401 P4.H = HI(DMEM_CONTROL);
402 R5 = [P4];
403 BITCLR(R5,ENDCPLB_P);
404 CLI R0;
405 SSYNC; /* SSYNC required before writing to DMEM_CONTROL. */
406 .align 8;
407 [P4] = R5;
408 SSYNC;
409 STI R0;
410
411 /* Start looking for a CPLB to evict. Our order of preference
412 * is: invalid CPLBs, clean CPLBs, dirty CPLBs. Locked CPLBs
413 * are no good.
414 */
415
416 I1.L = LO(DCPLB_DATA0);
417 I1.H = HI(DCPLB_DATA0);
418 P1 = 2;
419 P2 = 16;
420 I2.L = _dcplb_preference;
421 I2.H = _dcplb_preference;
422 LSETUP(.Lsdsearch1, .Ledsearch1) LC0 = P1;
423.Lsdsearch1:
424 R0 = [I2++]; /* Get the bits we're interested in*/
425 P0 = I1; /* Go back to start of table*/
426 LSETUP (.Lsdsearch2, .Ledsearch2) LC1 = P2;
427.Lsdsearch2:
428 R1 = [P0++]; /* Fetch each installed CPLB in turn*/
429 R2 = R1 & R0; /* and test for interesting bits.*/
430 CC = R2 == 0; /* If none are set, it'll do.*/
431 IF !CC JUMP .Lskip_stack_check;
432
433 R2 = [P0 - 0x104]; /* R2 - PageStart */
434 P3.L = _page_size_table; /* retrieve end address */
435 P3.H = _page_size_table; /* retrieve end address */
436 R3 = 0x1002; /* 16th - position, 2 bits -length */
437#if ANOMALY_05000209
438 nop; /* Anomaly 05000209 */
439#endif
440 R7 = EXTRACT(R1,R3.l);
441 R7 = R7 << 2; /* Page size index offset */
442 P5 = R7;
443 P3 = P3 + P5;
444 R7 = [P3]; /* page size in bytes */
445
446 R7 = R2 + R7; /* R7 - PageEnd */
447 R4 = SP; /* Test SP is in range */
448
449 CC = R7 < R4; /* if PageEnd < SP */
450 IF CC JUMP .Ldfound_victim;
451 R3 = 0x284; /* stack length from start of trap till
452 * the point.
453 * 20 stack locations for future modifications
454 */
455 R4 = R4 + R3;
456 CC = R4 < R2; /* if SP + stacklen < PageStart */
457 IF CC JUMP .Ldfound_victim;
458.Lskip_stack_check:
459
460.Ledsearch2: NOP;
461.Ledsearch1: NOP;
462
463 /* If we got here, we didn't find a DCPLB we considered
464 * replacable, which means all of them were locked.
465 */
466
467 JUMP .Lall_locked;
468.Ldfound_victim:
469
470#ifdef CONFIG_CPLB_INFO
471 R7 = [P0 - 0x104];
472 P2.L = _dpdt_table;
473 P2.H = _dpdt_table;
474 P3.L = _dpdt_swapcount_table;
475 P3.H = _dpdt_swapcount_table;
476 P3 += -4;
477.Ldicount:
478 R2 = [P2];
479 P2 += 8;
480 P3 += 8;
481 CC = R2==-1;
482 IF CC JUMP .Ldicount_done;
483 CC = R7==R2;
484 IF !CC JUMP .Ldicount;
485 R7 = [P3];
486 R7 += 1;
487 [P3] = R7;
488.Ldicount_done:
489#endif
490
491 /* Clean down the hardware loops*/
492 R2 = 0;
493 LC1 = R2;
494 LC0 = R2;
495
496 /* There's a suitable victim in [P0-4] (because we've
497 * advanced already).
498 */
499
500.LDdoverwrite:
501
502 /* [P0-4] is a suitable victim CPLB, so we want to
503 * overwrite it by moving all the following CPLBs
504 * one space closer to the start.
505 */
506
507 R1.L = LO(DCPLB_DATA16); /* DCPLB_DATA15 + 4 */
508 R1.H = HI(DCPLB_DATA16);
509 R0 = P0;
510
511 /* If the victim happens to be in DCPLB15,
512 * we don't need to move anything.
513 */
514
515 CC = R1 == R0;
516 IF CC JUMP .Lde_moved;
517 R1 = R1 - R0;
518 R1 >>= 2;
519 P1 = R1;
520 LSETUP(.Lds_move, .Lde_move) LC0=P1;
521.Lds_move:
522 R0 = [P0++]; /* move data */
523 [P0 - 8] = R0;
524 R0 = [P0-0x104] /* move address */
525.Lde_move:
526 [P0-0x108] = R0;
527
528.Lde_moved:
529 NOP;
530
531 /* Clear DCPLB_DATA15, in case we don't find a replacement
532 * otherwise, we would have a duplicate entry, and will crash
533 */
534 R0 = 0;
535 [P0 - 0x4] = R0;
536
537 /* We've now made space in DCPLB15 for the new CPLB to be
538 * installed. The next stage is to locate a CPLB in the
539 * config table that covers the faulting address.
540 */
541
542 R0 = I0; /* Our faulting address */
543
544 P2.L = _dpdt_table;
545 P2.H = _dpdt_table;
546#ifdef CONFIG_CPLB_INFO
547 P3.L = _dpdt_swapcount_table;
548 P3.H = _dpdt_swapcount_table;
549 P3 += -8;
550#endif
551
552 P1.L = _page_size_table;
553 P1.H = _page_size_table;
554
555 /* An extraction pattern, to retrieve bits 17:16.*/
556
557 R1 = (16<<8)|2;
558.Ldnext: R4 = [P2++]; /* address */
559 R2 = [P2++]; /* data */
560#ifdef CONFIG_CPLB_INFO
561 P3 += 8;
562#endif
563
564 CC = R4 == -1;
565 IF CC JUMP .Lno_page_in_table;
566
567 /* See if failed address > start address */
568 CC = R4 <= R0(IU);
569 IF !CC JUMP .Ldnext;
570
571 /* extract page size (17:16)*/
572 R3 = EXTRACT(R2, R1.L) (Z);
573
574 /* add page size to addr to get range */
575
576 P5 = R3;
577 P5 = P1 + (P5 << 2);
578 R3 = [P5];
579 R3 = R3 + R4;
580
581 /* See if failed address < (start address + page size) */
582 CC = R0 < R3(IU);
583 IF !CC JUMP .Ldnext;
584
585 /* We've found the CPLB that should be installed, so
586 * write it into CPLB15, masking off any caching bits
587 * if necessary.
588 */
589
590 P1.L = LO(DCPLB_DATA15);
591 P1.H = HI(DCPLB_DATA15);
592
593 /* If the DCPLB has cache bits set, but caching hasn't
594 * been enabled, then we want to mask off the cache-in-L1
595 * bit before installing. Moreover, if caching is off, we
596 * also want to ensure that the DCPLB has WT mode set, rather
597 * than WB, since WB pages still trigger first-write exceptions
598 * even when not caching is off, and the page isn't marked as
599 * cachable. Finally, we could mark the page as clean, not dirty,
600 * but we choose to leave that decision to the user; if the user
601 * chooses to have a CPLB pre-defined as dirty, then they always
602 * pay the cost of flushing during eviction, but don't pay the
603 * cost of first-write exceptions to mark the page as dirty.
604 */
605
606#ifdef CONFIG_BFIN_WT
607 BITSET(R6, 14); /* Set WT*/
608#endif
609
610 [P1] = R2;
611 [P1-0x100] = R4;
612#ifdef CONFIG_CPLB_INFO
613 R3 = [P3];
614 R3 += 1;
615 [P3] = R3;
616#endif
617
618 /* We've installed the CPLB, so re-enable CPLBs. P4
619 * points to DMEM_CONTROL, and R5 is the value we
620 * last wrote to it, when we were disabling CPLBs.
621 */
622
623 BITSET(R5,ENDCPLB_P);
624 CLI R2;
625 .align 8;
626 [P4] = R5;
627 SSYNC;
628 STI R2;
629
630 ( R7:4,P5:3 ) = [SP++];
631 R0 = CPLB_RELOADED;
632 RTS;
633ENDPROC(_cplb_mgr)
634
635.data
636.align 4;
637_page_size_table:
638.byte4 0x00000400; /* 1K */
639.byte4 0x00001000; /* 4K */
640.byte4 0x00100000; /* 1M */
641.byte4 0x00400000; /* 4M */
642
643.align 4;
644_dcplb_preference:
645.byte4 0x00000001; /* valid bit */
646.byte4 0x00000002; /* lock bit */
diff --git a/arch/blackfin/kernel/cplb-nompu/cplbmgr.c b/arch/blackfin/kernel/cplb-nompu/cplbmgr.c
new file mode 100644
index 000000000000..376249ab2694
--- /dev/null
+++ b/arch/blackfin/kernel/cplb-nompu/cplbmgr.c
@@ -0,0 +1,283 @@
1/*
2 * File: arch/blackfin/kernel/cplb-nompu-c/cplbmgr.c
3 * Based on: arch/blackfin/kernel/cplb-mpu/cplbmgr.c
4 * Author: Michael McTernan <mmcternan@airvana.com>
5 *
6 * Created: 01Nov2008
7 * Description: CPLB miss handler.
8 *
9 * Modified:
10 * Copyright 2008 Airvana Inc.
11 * Copyright 2004-2007 Analog Devices Inc.
12 *
13 * Bugs: Enter bugs at http://blackfin.uclinux.org/
14 *
15 * This program is free software; you can redistribute it and/or modify
16 * it under the terms of the GNU General Public License as published by
17 * the Free Software Foundation; either version 2 of the License, or
18 * (at your option) any later version.
19 *
20 * This program is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
24 */
25
26#include <linux/kernel.h>
27#include <asm/blackfin.h>
28#include <asm/cplbinit.h>
29#include <asm/cplb.h>
30#include <asm/mmu_context.h>
31
32/*
33 * WARNING
34 *
35 * This file is compiled with certain -ffixed-reg options. We have to
36 * make sure not to call any functions here that could clobber these
37 * registers.
38 */
39
40int nr_dcplb_miss[NR_CPUS], nr_icplb_miss[NR_CPUS];
41int nr_dcplb_supv_miss[NR_CPUS], nr_icplb_supv_miss[NR_CPUS];
42int nr_cplb_flush[NR_CPUS], nr_dcplb_prot[NR_CPUS];
43
44#ifdef CONFIG_EXCPT_IRQ_SYSC_L1
45#define MGR_ATTR __attribute__((l1_text))
46#else
47#define MGR_ATTR
48#endif
49
50/*
51 * We're in an exception handler. The normal cli nop nop workaround
52 * isn't going to do very much, as the only thing that can interrupt
53 * us is an NMI, and the cli isn't going to stop that.
54 */
55#define NOWA_SSYNC __asm__ __volatile__ ("ssync;")
56
57/* Anomaly handlers provide SSYNCs, so avoid extra if anomaly is present */
58#if ANOMALY_05000125
59
60#define bfin_write_DMEM_CONTROL_SSYNC(v) bfin_write_DMEM_CONTROL(v)
61#define bfin_write_IMEM_CONTROL_SSYNC(v) bfin_write_IMEM_CONTROL(v)
62
63#else
64
65#define bfin_write_DMEM_CONTROL_SSYNC(v) \
66 do { NOWA_SSYNC; bfin_write_DMEM_CONTROL(v); NOWA_SSYNC; } while (0)
67#define bfin_write_IMEM_CONTROL_SSYNC(v) \
68 do { NOWA_SSYNC; bfin_write_IMEM_CONTROL(v); NOWA_SSYNC; } while (0)
69
70#endif
71
72static inline void write_dcplb_data(int cpu, int idx, unsigned long data,
73 unsigned long addr)
74{
75 unsigned long ctrl = bfin_read_DMEM_CONTROL();
76 bfin_write_DMEM_CONTROL_SSYNC(ctrl & ~ENDCPLB);
77 bfin_write32(DCPLB_DATA0 + idx * 4, data);
78 bfin_write32(DCPLB_ADDR0 + idx * 4, addr);
79 bfin_write_DMEM_CONTROL_SSYNC(ctrl);
80
81#ifdef CONFIG_CPLB_INFO
82 dcplb_tbl[cpu][idx].addr = addr;
83 dcplb_tbl[cpu][idx].data = data;
84#endif
85}
86
87static inline void write_icplb_data(int cpu, int idx, unsigned long data,
88 unsigned long addr)
89{
90 unsigned long ctrl = bfin_read_IMEM_CONTROL();
91
92 bfin_write_IMEM_CONTROL_SSYNC(ctrl & ~ENICPLB);
93 bfin_write32(ICPLB_DATA0 + idx * 4, data);
94 bfin_write32(ICPLB_ADDR0 + idx * 4, addr);
95 bfin_write_IMEM_CONTROL_SSYNC(ctrl);
96
97#ifdef CONFIG_CPLB_INFO
98 icplb_tbl[cpu][idx].addr = addr;
99 icplb_tbl[cpu][idx].data = data;
100#endif
101}
102
103/*
104 * Given the contents of the status register, return the index of the
105 * CPLB that caused the fault.
106 */
107static inline int faulting_cplb_index(int status)
108{
109 int signbits = __builtin_bfin_norm_fr1x32(status & 0xFFFF);
110 return 30 - signbits;
111}
112
113/*
114 * Given the contents of the status register and the DCPLB_DATA contents,
115 * return true if a write access should be permitted.
116 */
117static inline int write_permitted(int status, unsigned long data)
118{
119 if (status & FAULT_USERSUPV)
120 return !!(data & CPLB_SUPV_WR);
121 else
122 return !!(data & CPLB_USER_WR);
123}
124
125/* Counters to implement round-robin replacement. */
126static int icplb_rr_index[NR_CPUS] PDT_ATTR;
127static int dcplb_rr_index[NR_CPUS] PDT_ATTR;
128
129/*
130 * Find an ICPLB entry to be evicted and return its index.
131 */
132static int evict_one_icplb(int cpu)
133{
134 int i = first_switched_icplb + icplb_rr_index[cpu];
135 if (i >= MAX_CPLBS) {
136 i -= MAX_CPLBS - first_switched_icplb;
137 icplb_rr_index[cpu] -= MAX_CPLBS - first_switched_icplb;
138 }
139 icplb_rr_index[cpu]++;
140 return i;
141}
142
143static int evict_one_dcplb(int cpu)
144{
145 int i = first_switched_dcplb + dcplb_rr_index[cpu];
146 if (i >= MAX_CPLBS) {
147 i -= MAX_CPLBS - first_switched_dcplb;
148 dcplb_rr_index[cpu] -= MAX_CPLBS - first_switched_dcplb;
149 }
150 dcplb_rr_index[cpu]++;
151 return i;
152}
153
154MGR_ATTR static int icplb_miss(int cpu)
155{
156 unsigned long addr = bfin_read_ICPLB_FAULT_ADDR();
157 int status = bfin_read_ICPLB_STATUS();
158 int idx;
159 unsigned long i_data, base, addr1, eaddr;
160
161 nr_icplb_miss[cpu]++;
162 if (unlikely(status & FAULT_USERSUPV))
163 nr_icplb_supv_miss[cpu]++;
164
165 base = 0;
166 for (idx = 0; idx < icplb_nr_bounds; idx++) {
167 eaddr = icplb_bounds[idx].eaddr;
168 if (addr < eaddr)
169 break;
170 base = eaddr;
171 }
172 if (unlikely(idx == icplb_nr_bounds))
173 return CPLB_NO_ADDR_MATCH;
174
175 i_data = icplb_bounds[idx].data;
176 if (unlikely(i_data == 0))
177 return CPLB_NO_ADDR_MATCH;
178
179 addr1 = addr & ~(SIZE_4M - 1);
180 addr &= ~(SIZE_1M - 1);
181 i_data |= PAGE_SIZE_1MB;
182 if (addr1 >= base && (addr1 + SIZE_4M) <= eaddr) {
183 /*
184 * This works because
185 * (PAGE_SIZE_4MB & PAGE_SIZE_1MB) == PAGE_SIZE_1MB.
186 */
187 i_data |= PAGE_SIZE_4MB;
188 addr = addr1;
189 }
190
191 /* Pick entry to evict */
192 idx = evict_one_icplb(cpu);
193
194 write_icplb_data(cpu, idx, i_data, addr);
195
196 return CPLB_RELOADED;
197}
198
199MGR_ATTR static int dcplb_miss(int cpu)
200{
201 unsigned long addr = bfin_read_DCPLB_FAULT_ADDR();
202 int status = bfin_read_DCPLB_STATUS();
203 int idx;
204 unsigned long d_data, base, addr1, eaddr;
205
206 nr_dcplb_miss[cpu]++;
207 if (unlikely(status & FAULT_USERSUPV))
208 nr_dcplb_supv_miss[cpu]++;
209
210 base = 0;
211 for (idx = 0; idx < dcplb_nr_bounds; idx++) {
212 eaddr = dcplb_bounds[idx].eaddr;
213 if (addr < eaddr)
214 break;
215 base = eaddr;
216 }
217 if (unlikely(idx == dcplb_nr_bounds))
218 return CPLB_NO_ADDR_MATCH;
219
220 d_data = dcplb_bounds[idx].data;
221 if (unlikely(d_data == 0))
222 return CPLB_NO_ADDR_MATCH;
223
224 addr1 = addr & ~(SIZE_4M - 1);
225 addr &= ~(SIZE_1M - 1);
226 d_data |= PAGE_SIZE_1MB;
227 if (addr1 >= base && (addr1 + SIZE_4M) <= eaddr) {
228 /*
229 * This works because
230 * (PAGE_SIZE_4MB & PAGE_SIZE_1MB) == PAGE_SIZE_1MB.
231 */
232 d_data |= PAGE_SIZE_4MB;
233 addr = addr1;
234 }
235
236 /* Pick entry to evict */
237 idx = evict_one_dcplb(cpu);
238
239 write_dcplb_data(cpu, idx, d_data, addr);
240
241 return CPLB_RELOADED;
242}
243
244MGR_ATTR static noinline int dcplb_protection_fault(int cpu)
245{
246 int status = bfin_read_DCPLB_STATUS();
247
248 nr_dcplb_prot[cpu]++;
249
250 if (likely(status & FAULT_RW)) {
251 int idx = faulting_cplb_index(status);
252 unsigned long regaddr = DCPLB_DATA0 + idx * 4;
253 unsigned long data = bfin_read32(regaddr);
254
255 /* Check if fault is to dirty a clean page */
256 if (!(data & CPLB_WT) && !(data & CPLB_DIRTY) &&
257 write_permitted(status, data)) {
258
259 dcplb_tbl[cpu][idx].data = data;
260 bfin_write32(regaddr, data);
261 return CPLB_RELOADED;
262 }
263 }
264
265 return CPLB_PROT_VIOL;
266}
267
268MGR_ATTR int cplb_hdr(int seqstat, struct pt_regs *regs)
269{
270 int cause = seqstat & 0x3f;
271 unsigned int cpu = smp_processor_id();
272 switch (cause) {
273 case 0x2C:
274 return icplb_miss(cpu);
275 case 0x26:
276 return dcplb_miss(cpu);
277 default:
278 if (unlikely(cause == 0x23))
279 return dcplb_protection_fault(cpu);
280
281 return CPLB_UNKNOWN_ERR;
282 }
283}
diff --git a/arch/blackfin/kernel/cplbinfo.c b/arch/blackfin/kernel/cplbinfo.c
new file mode 100644
index 000000000000..64d78300dd08
--- /dev/null
+++ b/arch/blackfin/kernel/cplbinfo.c
@@ -0,0 +1,177 @@
1/*
2 * arch/blackfin/kernel/cplbinfo.c - display CPLB status
3 *
4 * Copyright 2004-2008 Analog Devices Inc.
5 * Licensed under the GPL-2 or later.
6 */
7
8#include <linux/ctype.h>
9#include <linux/module.h>
10#include <linux/kernel.h>
11#include <linux/init.h>
12#include <linux/proc_fs.h>
13#include <linux/seq_file.h>
14#include <linux/uaccess.h>
15
16#include <asm/cplbinit.h>
17#include <asm/blackfin.h>
18
19static char const page_strtbl[][3] = { "1K", "4K", "1M", "4M" };
20#define page(flags) (((flags) & 0x30000) >> 16)
21#define strpage(flags) page_strtbl[page(flags)]
22
23struct cplbinfo_data {
24 loff_t pos;
25 char cplb_type;
26 u32 mem_control;
27 struct cplb_entry *tbl;
28 int switched;
29};
30
31static void cplbinfo_print_header(struct seq_file *m)
32{
33 seq_printf(m, "Index\tAddress\t\tData\tSize\tU/RD\tU/WR\tS/WR\tSwitch\n");
34}
35
36static int cplbinfo_nomore(struct cplbinfo_data *cdata)
37{
38 return cdata->pos >= MAX_CPLBS;
39}
40
41static int cplbinfo_show(struct seq_file *m, void *p)
42{
43 struct cplbinfo_data *cdata;
44 unsigned long data, addr;
45 loff_t pos;
46
47 cdata = p;
48 pos = cdata->pos;
49 addr = cdata->tbl[pos].addr;
50 data = cdata->tbl[pos].data;
51
52 seq_printf(m,
53 "%d\t0x%08lx\t%05lx\t%s\t%c\t%c\t%c\t%c\n",
54 (int)pos, addr, data, strpage(data),
55 (data & CPLB_USER_RD) ? 'Y' : 'N',
56 (data & CPLB_USER_WR) ? 'Y' : 'N',
57 (data & CPLB_SUPV_WR) ? 'Y' : 'N',
58 pos < cdata->switched ? 'N' : 'Y');
59
60 return 0;
61}
62
63static void cplbinfo_seq_init(struct cplbinfo_data *cdata, unsigned int cpu)
64{
65 if (cdata->cplb_type == 'I') {
66 cdata->mem_control = bfin_read_IMEM_CONTROL();
67 cdata->tbl = icplb_tbl[cpu];
68 cdata->switched = first_switched_icplb;
69 } else {
70 cdata->mem_control = bfin_read_DMEM_CONTROL();
71 cdata->tbl = dcplb_tbl[cpu];
72 cdata->switched = first_switched_dcplb;
73 }
74}
75
76static void *cplbinfo_start(struct seq_file *m, loff_t *pos)
77{
78 struct cplbinfo_data *cdata = m->private;
79
80 if (!*pos) {
81 seq_printf(m, "%cCPLBs are %sabled: 0x%x\n", cdata->cplb_type,
82 (cdata->mem_control & ENDCPLB ? "en" : "dis"),
83 cdata->mem_control);
84 cplbinfo_print_header(m);
85 } else if (cplbinfo_nomore(cdata))
86 return NULL;
87
88 get_cpu();
89 return cdata;
90}
91
92static void *cplbinfo_next(struct seq_file *m, void *p, loff_t *pos)
93{
94 struct cplbinfo_data *cdata = p;
95 cdata->pos = ++(*pos);
96 if (cplbinfo_nomore(cdata))
97 return NULL;
98 else
99 return cdata;
100}
101
102static void cplbinfo_stop(struct seq_file *m, void *p)
103{
104 put_cpu();
105}
106
107static const struct seq_operations cplbinfo_sops = {
108 .start = cplbinfo_start,
109 .next = cplbinfo_next,
110 .stop = cplbinfo_stop,
111 .show = cplbinfo_show,
112};
113
114static int cplbinfo_open(struct inode *inode, struct file *file)
115{
116 char buf[256], *path, *p;
117 unsigned int cpu;
118 char *s_cpu, *s_cplb;
119 int ret;
120 struct seq_file *m;
121 struct cplbinfo_data *cdata;
122
123 path = d_path(&file->f_path, buf, sizeof(buf));
124 if (IS_ERR(path))
125 return PTR_ERR(path);
126 s_cpu = strstr(path, "/cpu");
127 s_cplb = strrchr(path, '/');
128 if (!s_cpu || !s_cplb)
129 return -EINVAL;
130
131 cpu = simple_strtoul(s_cpu + 4, &p, 10);
132 if (!cpu_online(cpu))
133 return -ENODEV;
134
135 ret = seq_open_private(file, &cplbinfo_sops, sizeof(*cdata));
136 if (ret)
137 return ret;
138 m = file->private_data;
139 cdata = m->private;
140
141 cdata->pos = 0;
142 cdata->cplb_type = toupper(s_cplb[1]);
143 cplbinfo_seq_init(cdata, cpu);
144
145 return 0;
146}
147
148static const struct file_operations cplbinfo_fops = {
149 .open = cplbinfo_open,
150 .read = seq_read,
151 .llseek = seq_lseek,
152 .release = seq_release_private,
153};
154
155static int __init cplbinfo_init(void)
156{
157 struct proc_dir_entry *cplb_dir, *cpu_dir;
158 char buf[10];
159 unsigned int cpu;
160
161 cplb_dir = proc_mkdir("cplbinfo", NULL);
162 if (!cplb_dir)
163 return -ENOMEM;
164
165 for_each_possible_cpu(cpu) {
166 sprintf(buf, "cpu%i", cpu);
167 cpu_dir = proc_mkdir(buf, cplb_dir);
168 if (!cpu_dir)
169 return -ENOMEM;
170
171 proc_create("icplb", S_IRUGO, cpu_dir, &cplbinfo_fops);
172 proc_create("dcplb", S_IRUGO, cpu_dir, &cplbinfo_fops);
173 }
174
175 return 0;
176}
177late_initcall(cplbinfo_init);
diff --git a/arch/blackfin/kernel/early_printk.c b/arch/blackfin/kernel/early_printk.c
index 1f4e3d2e0901..c8ad051742e2 100644
--- a/arch/blackfin/kernel/early_printk.c
+++ b/arch/blackfin/kernel/early_printk.c
@@ -105,10 +105,10 @@ static struct console * __init earlyserial_init(char *buf)
105 cflag |= CS5; 105 cflag |= CS5;
106 break; 106 break;
107 case 6: 107 case 6:
108 cflag |= CS5; 108 cflag |= CS6;
109 break; 109 break;
110 case 7: 110 case 7:
111 cflag |= CS5; 111 cflag |= CS7;
112 break; 112 break;
113 default: 113 default:
114 cflag |= CS8; 114 cflag |= CS8;
diff --git a/arch/blackfin/kernel/entry.S b/arch/blackfin/kernel/entry.S
index faea88ebb2ef..a9cfba9946b5 100644
--- a/arch/blackfin/kernel/entry.S
+++ b/arch/blackfin/kernel/entry.S
@@ -30,6 +30,7 @@
30#include <linux/linkage.h> 30#include <linux/linkage.h>
31#include <asm/thread_info.h> 31#include <asm/thread_info.h>
32#include <asm/errno.h> 32#include <asm/errno.h>
33#include <asm/blackfin.h>
33#include <asm/asm-offsets.h> 34#include <asm/asm-offsets.h>
34 35
35#include <asm/context.S> 36#include <asm/context.S>
@@ -41,6 +42,10 @@
41#endif 42#endif
42 43
43ENTRY(_ret_from_fork) 44ENTRY(_ret_from_fork)
45#ifdef CONFIG_IPIPE
46 [--sp] = reti; /* IRQs on. */
47 SP += 4;
48#endif /* CONFIG_IPIPE */
44 SP += -12; 49 SP += -12;
45 call _schedule_tail; 50 call _schedule_tail;
46 SP += 12; 51 SP += 12;
diff --git a/arch/blackfin/kernel/fixed_code.S b/arch/blackfin/kernel/fixed_code.S
index 4b03ba025488..0d2d9e0968c8 100644
--- a/arch/blackfin/kernel/fixed_code.S
+++ b/arch/blackfin/kernel/fixed_code.S
@@ -8,10 +8,12 @@
8 * BF561 SMP). 8 * BF561 SMP).
9 */ 9 */
10#include <linux/linkage.h> 10#include <linux/linkage.h>
11#include <linux/init.h>
11#include <linux/unistd.h> 12#include <linux/unistd.h>
12#include <asm/entry.h> 13#include <asm/entry.h>
13 14
14.text 15__INIT
16
15ENTRY(_fixed_code_start) 17ENTRY(_fixed_code_start)
16 18
17.align 16 19.align 16
@@ -144,3 +146,5 @@ ENTRY(_safe_user_instruction)
144ENDPROC(_safe_user_instruction) 146ENDPROC(_safe_user_instruction)
145 147
146ENTRY(_fixed_code_end) 148ENTRY(_fixed_code_end)
149
150__FINIT
diff --git a/arch/blackfin/kernel/ipipe.c b/arch/blackfin/kernel/ipipe.c
new file mode 100644
index 000000000000..339be5a3ae6a
--- /dev/null
+++ b/arch/blackfin/kernel/ipipe.c
@@ -0,0 +1,428 @@
1/* -*- linux-c -*-
2 * linux/arch/blackfin/kernel/ipipe.c
3 *
4 * Copyright (C) 2005-2007 Philippe Gerum.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, Inc., 675 Mass Ave, Cambridge MA 02139,
9 * USA; either version 2 of the License, or (at your option) any later
10 * version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 *
21 * Architecture-dependent I-pipe support for the Blackfin.
22 */
23
24#include <linux/kernel.h>
25#include <linux/sched.h>
26#include <linux/module.h>
27#include <linux/interrupt.h>
28#include <linux/percpu.h>
29#include <linux/bitops.h>
30#include <linux/slab.h>
31#include <linux/errno.h>
32#include <linux/kthread.h>
33#include <asm/unistd.h>
34#include <asm/system.h>
35#include <asm/atomic.h>
36#include <asm/io.h>
37
38static int create_irq_threads;
39
40DEFINE_PER_CPU(struct pt_regs, __ipipe_tick_regs);
41
42static DEFINE_PER_CPU(unsigned long, pending_irqthread_mask);
43
44static DEFINE_PER_CPU(int [IVG13 + 1], pending_irq_count);
45
46asmlinkage void asm_do_IRQ(unsigned int irq, struct pt_regs *regs);
47
48static void __ipipe_no_irqtail(void);
49
50unsigned long __ipipe_irq_tail_hook = (unsigned long)&__ipipe_no_irqtail;
51EXPORT_SYMBOL(__ipipe_irq_tail_hook);
52
53unsigned long __ipipe_core_clock;
54EXPORT_SYMBOL(__ipipe_core_clock);
55
56unsigned long __ipipe_freq_scale;
57EXPORT_SYMBOL(__ipipe_freq_scale);
58
59atomic_t __ipipe_irq_lvdepth[IVG15 + 1];
60
61unsigned long __ipipe_irq_lvmask = __all_masked_irq_flags;
62EXPORT_SYMBOL(__ipipe_irq_lvmask);
63
64static void __ipipe_ack_irq(unsigned irq, struct irq_desc *desc)
65{
66 desc->ipipe_ack(irq, desc);
67}
68
69/*
70 * __ipipe_enable_pipeline() -- We are running on the boot CPU, hw
71 * interrupts are off, and secondary CPUs are still lost in space.
72 */
73void __ipipe_enable_pipeline(void)
74{
75 unsigned irq;
76
77 __ipipe_core_clock = get_cclk(); /* Fetch this once. */
78 __ipipe_freq_scale = 1000000000UL / __ipipe_core_clock;
79
80 for (irq = 0; irq < NR_IRQS; ++irq)
81 ipipe_virtualize_irq(ipipe_root_domain,
82 irq,
83 (ipipe_irq_handler_t)&asm_do_IRQ,
84 NULL,
85 &__ipipe_ack_irq,
86 IPIPE_HANDLE_MASK | IPIPE_PASS_MASK);
87}
88
89/*
90 * __ipipe_handle_irq() -- IPIPE's generic IRQ handler. An optimistic
91 * interrupt protection log is maintained here for each domain. Hw
92 * interrupts are masked on entry.
93 */
94void __ipipe_handle_irq(unsigned irq, struct pt_regs *regs)
95{
96 struct ipipe_domain *this_domain, *next_domain;
97 struct list_head *head, *pos;
98 int m_ack, s = -1;
99
100 /*
101 * Software-triggered IRQs do not need any ack. The contents
102 * of the register frame should only be used when processing
103 * the timer interrupt, but not for handling any other
104 * interrupt.
105 */
106 m_ack = (regs == NULL || irq == IRQ_SYSTMR || irq == IRQ_CORETMR);
107
108 this_domain = ipipe_current_domain;
109
110 if (unlikely(test_bit(IPIPE_STICKY_FLAG, &this_domain->irqs[irq].control)))
111 head = &this_domain->p_link;
112 else {
113 head = __ipipe_pipeline.next;
114 next_domain = list_entry(head, struct ipipe_domain, p_link);
115 if (likely(test_bit(IPIPE_WIRED_FLAG, &next_domain->irqs[irq].control))) {
116 if (!m_ack && next_domain->irqs[irq].acknowledge != NULL)
117 next_domain->irqs[irq].acknowledge(irq, irq_desc + irq);
118 if (test_bit(IPIPE_ROOTLOCK_FLAG, &ipipe_root_domain->flags))
119 s = __test_and_set_bit(IPIPE_STALL_FLAG,
120 &ipipe_root_cpudom_var(status));
121 __ipipe_dispatch_wired(next_domain, irq);
122 goto finalize;
123 return;
124 }
125 }
126
127 /* Ack the interrupt. */
128
129 pos = head;
130
131 while (pos != &__ipipe_pipeline) {
132 next_domain = list_entry(pos, struct ipipe_domain, p_link);
133 /*
134 * For each domain handling the incoming IRQ, mark it
135 * as pending in its log.
136 */
137 if (test_bit(IPIPE_HANDLE_FLAG, &next_domain->irqs[irq].control)) {
138 /*
139 * Domains that handle this IRQ are polled for
140 * acknowledging it by decreasing priority
141 * order. The interrupt must be made pending
142 * _first_ in the domain's status flags before
143 * the PIC is unlocked.
144 */
145 __ipipe_set_irq_pending(next_domain, irq);
146
147 if (!m_ack && next_domain->irqs[irq].acknowledge != NULL) {
148 next_domain->irqs[irq].acknowledge(irq, irq_desc + irq);
149 m_ack = 1;
150 }
151 }
152
153 /*
154 * If the domain does not want the IRQ to be passed
155 * down the interrupt pipe, exit the loop now.
156 */
157 if (!test_bit(IPIPE_PASS_FLAG, &next_domain->irqs[irq].control))
158 break;
159
160 pos = next_domain->p_link.next;
161 }
162
163 /*
164 * Now walk the pipeline, yielding control to the highest
165 * priority domain that has pending interrupt(s) or
166 * immediately to the current domain if the interrupt has been
167 * marked as 'sticky'. This search does not go beyond the
168 * current domain in the pipeline. We also enforce the
169 * additional root stage lock (blackfin-specific). */
170
171 if (test_bit(IPIPE_ROOTLOCK_FLAG, &ipipe_root_domain->flags))
172 s = __test_and_set_bit(IPIPE_STALL_FLAG,
173 &ipipe_root_cpudom_var(status));
174finalize:
175
176 __ipipe_walk_pipeline(head);
177
178 if (!s)
179 __clear_bit(IPIPE_STALL_FLAG,
180 &ipipe_root_cpudom_var(status));
181}
182
183int __ipipe_check_root(void)
184{
185 return ipipe_root_domain_p;
186}
187
188void __ipipe_enable_irqdesc(struct ipipe_domain *ipd, unsigned irq)
189{
190 struct irq_desc *desc = irq_desc + irq;
191 int prio = desc->ic_prio;
192
193 desc->depth = 0;
194 if (ipd != &ipipe_root &&
195 atomic_inc_return(&__ipipe_irq_lvdepth[prio]) == 1)
196 __set_bit(prio, &__ipipe_irq_lvmask);
197}
198EXPORT_SYMBOL(__ipipe_enable_irqdesc);
199
200void __ipipe_disable_irqdesc(struct ipipe_domain *ipd, unsigned irq)
201{
202 struct irq_desc *desc = irq_desc + irq;
203 int prio = desc->ic_prio;
204
205 if (ipd != &ipipe_root &&
206 atomic_dec_and_test(&__ipipe_irq_lvdepth[prio]))
207 __clear_bit(prio, &__ipipe_irq_lvmask);
208}
209EXPORT_SYMBOL(__ipipe_disable_irqdesc);
210
211void __ipipe_stall_root_raw(void)
212{
213 /*
214 * This code is called by the ins{bwl} routines (see
215 * arch/blackfin/lib/ins.S), which are heavily used by the
216 * network stack. It masks all interrupts but those handled by
217 * non-root domains, so that we keep decent network transfer
218 * rates for Linux without inducing pathological jitter for
219 * the real-time domain.
220 */
221 __asm__ __volatile__ ("sti %0;" : : "d"(__ipipe_irq_lvmask));
222
223 __set_bit(IPIPE_STALL_FLAG,
224 &ipipe_root_cpudom_var(status));
225}
226
227void __ipipe_unstall_root_raw(void)
228{
229 __clear_bit(IPIPE_STALL_FLAG,
230 &ipipe_root_cpudom_var(status));
231
232 __asm__ __volatile__ ("sti %0;" : : "d"(bfin_irq_flags));
233}
234
235int __ipipe_syscall_root(struct pt_regs *regs)
236{
237 unsigned long flags;
238
239 /* We need to run the IRQ tail hook whenever we don't
240 * propagate a syscall to higher domains, because we know that
241 * important operations might be pending there (e.g. Xenomai
242 * deferred rescheduling). */
243
244 if (!__ipipe_syscall_watched_p(current, regs->orig_p0)) {
245 void (*hook)(void) = (void (*)(void))__ipipe_irq_tail_hook;
246 hook();
247 return 0;
248 }
249
250 /*
251 * This routine either returns:
252 * 0 -- if the syscall is to be passed to Linux;
253 * 1 -- if the syscall should not be passed to Linux, and no
254 * tail work should be performed;
255 * -1 -- if the syscall should not be passed to Linux but the
256 * tail work has to be performed (for handling signals etc).
257 */
258
259 if (__ipipe_event_monitored_p(IPIPE_EVENT_SYSCALL) &&
260 __ipipe_dispatch_event(IPIPE_EVENT_SYSCALL, regs) > 0) {
261 if (ipipe_root_domain_p && !in_atomic()) {
262 /*
263 * Sync pending VIRQs before _TIF_NEED_RESCHED
264 * is tested.
265 */
266 local_irq_save_hw(flags);
267 if ((ipipe_root_cpudom_var(irqpend_himask) & IPIPE_IRQMASK_VIRT) != 0)
268 __ipipe_sync_pipeline(IPIPE_IRQMASK_VIRT);
269 local_irq_restore_hw(flags);
270 return -1;
271 }
272 return 1;
273 }
274
275 return 0;
276}
277
278unsigned long ipipe_critical_enter(void (*syncfn) (void))
279{
280 unsigned long flags;
281
282 local_irq_save_hw(flags);
283
284 return flags;
285}
286
287void ipipe_critical_exit(unsigned long flags)
288{
289 local_irq_restore_hw(flags);
290}
291
292static void __ipipe_no_irqtail(void)
293{
294}
295
296int ipipe_get_sysinfo(struct ipipe_sysinfo *info)
297{
298 info->ncpus = num_online_cpus();
299 info->cpufreq = ipipe_cpu_freq();
300 info->archdep.tmirq = IPIPE_TIMER_IRQ;
301 info->archdep.tmfreq = info->cpufreq;
302
303 return 0;
304}
305
306/*
307 * ipipe_trigger_irq() -- Push the interrupt at front of the pipeline
308 * just like if it has been actually received from a hw source. Also
309 * works for virtual interrupts.
310 */
311int ipipe_trigger_irq(unsigned irq)
312{
313 unsigned long flags;
314
315 if (irq >= IPIPE_NR_IRQS ||
316 (ipipe_virtual_irq_p(irq)
317 && !test_bit(irq - IPIPE_VIRQ_BASE, &__ipipe_virtual_irq_map)))
318 return -EINVAL;
319
320 local_irq_save_hw(flags);
321
322 __ipipe_handle_irq(irq, NULL);
323
324 local_irq_restore_hw(flags);
325
326 return 1;
327}
328
329/* Move Linux IRQ to threads. */
330
331static int do_irqd(void *__desc)
332{
333 struct irq_desc *desc = __desc;
334 unsigned irq = desc - irq_desc;
335 int thrprio = desc->thr_prio;
336 int thrmask = 1 << thrprio;
337 int cpu = smp_processor_id();
338 cpumask_t cpumask;
339
340 sigfillset(&current->blocked);
341 current->flags |= PF_NOFREEZE;
342 cpumask = cpumask_of_cpu(cpu);
343 set_cpus_allowed(current, cpumask);
344 ipipe_setscheduler_root(current, SCHED_FIFO, 50 + thrprio);
345
346 while (!kthread_should_stop()) {
347 local_irq_disable();
348 if (!(desc->status & IRQ_SCHEDULED)) {
349 set_current_state(TASK_INTERRUPTIBLE);
350resched:
351 local_irq_enable();
352 schedule();
353 local_irq_disable();
354 }
355 __set_current_state(TASK_RUNNING);
356 /*
357 * If higher priority interrupt servers are ready to
358 * run, reschedule immediately. We need this for the
359 * GPIO demux IRQ handler to unmask the interrupt line
360 * _last_, after all GPIO IRQs have run.
361 */
362 if (per_cpu(pending_irqthread_mask, cpu) & ~(thrmask|(thrmask-1)))
363 goto resched;
364 if (--per_cpu(pending_irq_count[thrprio], cpu) == 0)
365 per_cpu(pending_irqthread_mask, cpu) &= ~thrmask;
366 desc->status &= ~IRQ_SCHEDULED;
367 desc->thr_handler(irq, &__raw_get_cpu_var(__ipipe_tick_regs));
368 local_irq_enable();
369 }
370 __set_current_state(TASK_RUNNING);
371 return 0;
372}
373
374static void kick_irqd(unsigned irq, void *cookie)
375{
376 struct irq_desc *desc = irq_desc + irq;
377 int thrprio = desc->thr_prio;
378 int thrmask = 1 << thrprio;
379 int cpu = smp_processor_id();
380
381 if (!(desc->status & IRQ_SCHEDULED)) {
382 desc->status |= IRQ_SCHEDULED;
383 per_cpu(pending_irqthread_mask, cpu) |= thrmask;
384 ++per_cpu(pending_irq_count[thrprio], cpu);
385 wake_up_process(desc->thread);
386 }
387}
388
389int ipipe_start_irq_thread(unsigned irq, struct irq_desc *desc)
390{
391 if (desc->thread || !create_irq_threads)
392 return 0;
393
394 desc->thread = kthread_create(do_irqd, desc, "IRQ %d", irq);
395 if (desc->thread == NULL) {
396 printk(KERN_ERR "irqd: could not create IRQ thread %d!\n", irq);
397 return -ENOMEM;
398 }
399
400 wake_up_process(desc->thread);
401
402 desc->thr_handler = ipipe_root_domain->irqs[irq].handler;
403 ipipe_root_domain->irqs[irq].handler = &kick_irqd;
404
405 return 0;
406}
407
408void __init ipipe_init_irq_threads(void)
409{
410 unsigned irq;
411 struct irq_desc *desc;
412
413 create_irq_threads = 1;
414
415 for (irq = 0; irq < NR_IRQS; irq++) {
416 desc = irq_desc + irq;
417 if (desc->action != NULL ||
418 (desc->status & IRQ_NOREQUEST) != 0)
419 ipipe_start_irq_thread(irq, desc);
420 }
421}
422
423EXPORT_SYMBOL(show_stack);
424
425#ifdef CONFIG_IPIPE_TRACE_MCOUNT
426void notrace _mcount(void);
427EXPORT_SYMBOL(_mcount);
428#endif /* CONFIG_IPIPE_TRACE_MCOUNT */
diff --git a/arch/blackfin/kernel/irqchip.c b/arch/blackfin/kernel/irqchip.c
index 07402f57c9de..ab8209cbbad0 100644
--- a/arch/blackfin/kernel/irqchip.c
+++ b/arch/blackfin/kernel/irqchip.c
@@ -36,7 +36,7 @@
36#include <linux/irq.h> 36#include <linux/irq.h>
37#include <asm/trace.h> 37#include <asm/trace.h>
38 38
39static unsigned long irq_err_count; 39static atomic_t irq_err_count;
40static spinlock_t irq_controller_lock; 40static spinlock_t irq_controller_lock;
41 41
42/* 42/*
@@ -48,10 +48,9 @@ void dummy_mask_unmask_irq(unsigned int irq)
48 48
49void ack_bad_irq(unsigned int irq) 49void ack_bad_irq(unsigned int irq)
50{ 50{
51 irq_err_count += 1; 51 atomic_inc(&irq_err_count);
52 printk(KERN_ERR "IRQ: spurious interrupt %d\n", irq); 52 printk(KERN_ERR "IRQ: spurious interrupt %d\n", irq);
53} 53}
54EXPORT_SYMBOL(ack_bad_irq);
55 54
56static struct irq_chip bad_chip = { 55static struct irq_chip bad_chip = {
57 .ack = dummy_mask_unmask_irq, 56 .ack = dummy_mask_unmask_irq,
@@ -72,7 +71,7 @@ static struct irq_desc bad_irq_desc = {
72 71
73int show_interrupts(struct seq_file *p, void *v) 72int show_interrupts(struct seq_file *p, void *v)
74{ 73{
75 int i = *(loff_t *) v; 74 int i = *(loff_t *) v, j;
76 struct irqaction *action; 75 struct irqaction *action;
77 unsigned long flags; 76 unsigned long flags;
78 77
@@ -80,19 +79,20 @@ int show_interrupts(struct seq_file *p, void *v)
80 spin_lock_irqsave(&irq_desc[i].lock, flags); 79 spin_lock_irqsave(&irq_desc[i].lock, flags);
81 action = irq_desc[i].action; 80 action = irq_desc[i].action;
82 if (!action) 81 if (!action)
83 goto unlock; 82 goto skip;
84 83 seq_printf(p, "%3d: ", i);
85 seq_printf(p, "%3d: %10u ", i, kstat_irqs(i)); 84 for_each_online_cpu(j)
85 seq_printf(p, "%10u ", kstat_cpu(j).irqs[i]);
86 seq_printf(p, " %8s", irq_desc[i].chip->name);
86 seq_printf(p, " %s", action->name); 87 seq_printf(p, " %s", action->name);
87 for (action = action->next; action; action = action->next) 88 for (action = action->next; action; action = action->next)
88 seq_printf(p, ", %s", action->name); 89 seq_printf(p, " %s", action->name);
89 90
90 seq_putc(p, '\n'); 91 seq_putc(p, '\n');
91 unlock: 92 skip:
92 spin_unlock_irqrestore(&irq_desc[i].lock, flags); 93 spin_unlock_irqrestore(&irq_desc[i].lock, flags);
93 } else if (i == NR_IRQS) { 94 } else if (i == NR_IRQS)
94 seq_printf(p, "Err: %10lu\n", irq_err_count); 95 seq_printf(p, "Err: %10u\n", atomic_read(&irq_err_count));
95 }
96 return 0; 96 return 0;
97} 97}
98 98
@@ -101,7 +101,6 @@ int show_interrupts(struct seq_file *p, void *v)
101 * come via this function. Instead, they should provide their 101 * come via this function. Instead, they should provide their
102 * own 'handler' 102 * own 'handler'
103 */ 103 */
104
105#ifdef CONFIG_DO_IRQ_L1 104#ifdef CONFIG_DO_IRQ_L1
106__attribute__((l1_text)) 105__attribute__((l1_text))
107#endif 106#endif
@@ -109,8 +108,9 @@ asmlinkage void asm_do_IRQ(unsigned int irq, struct pt_regs *regs)
109{ 108{
110 struct pt_regs *old_regs; 109 struct pt_regs *old_regs;
111 struct irq_desc *desc = irq_desc + irq; 110 struct irq_desc *desc = irq_desc + irq;
111#ifndef CONFIG_IPIPE
112 unsigned short pending, other_ints; 112 unsigned short pending, other_ints;
113 113#endif
114 old_regs = set_irq_regs(regs); 114 old_regs = set_irq_regs(regs);
115 115
116 /* 116 /*
@@ -121,9 +121,24 @@ asmlinkage void asm_do_IRQ(unsigned int irq, struct pt_regs *regs)
121 desc = &bad_irq_desc; 121 desc = &bad_irq_desc;
122 122
123 irq_enter(); 123 irq_enter();
124 124#ifdef CONFIG_DEBUG_STACKOVERFLOW
125 /* Debugging check for stack overflow: is there less than STACK_WARN free? */
126 {
127 long sp;
128
129 sp = __get_SP() & (THREAD_SIZE-1);
130
131 if (unlikely(sp < (sizeof(struct thread_info) + STACK_WARN))) {
132 dump_stack();
133 printk(KERN_EMERG "%s: possible stack overflow while handling irq %i "
134 " only %ld bytes free\n",
135 __func__, irq, sp - sizeof(struct thread_info));
136 }
137 }
138#endif
125 generic_handle_irq(irq); 139 generic_handle_irq(irq);
126 140
141#ifndef CONFIG_IPIPE /* Useless and bugous over the I-pipe: IRQs are threaded. */
127 /* If we're the only interrupt running (ignoring IRQ15 which is for 142 /* If we're the only interrupt running (ignoring IRQ15 which is for
128 syscalls), lower our priority to IRQ14 so that softirqs run at 143 syscalls), lower our priority to IRQ14 so that softirqs run at
129 that level. If there's another, lower-level interrupt, irq_exit 144 that level. If there's another, lower-level interrupt, irq_exit
@@ -133,6 +148,7 @@ asmlinkage void asm_do_IRQ(unsigned int irq, struct pt_regs *regs)
133 other_ints = pending & (pending - 1); 148 other_ints = pending & (pending - 1);
134 if (other_ints == 0) 149 if (other_ints == 0)
135 lower_to_irq14(); 150 lower_to_irq14();
151#endif /* !CONFIG_IPIPE */
136 irq_exit(); 152 irq_exit();
137 153
138 set_irq_regs(old_regs); 154 set_irq_regs(old_regs);
diff --git a/arch/blackfin/kernel/kgdb.c b/arch/blackfin/kernel/kgdb.c
index b795a207742c..b163f6d3330d 100644
--- a/arch/blackfin/kernel/kgdb.c
+++ b/arch/blackfin/kernel/kgdb.c
@@ -34,9 +34,14 @@ int gdb_bfin_vector = -1;
34#error change the definition of slavecpulocks 34#error change the definition of slavecpulocks
35#endif 35#endif
36 36
37#ifdef CONFIG_BFIN_WDT 37#define IN_MEM(addr, size, l1_addr, l1_size) \
38# error "Please unselect blackfin watchdog driver before build KGDB." 38({ \
39#endif 39 unsigned long __addr = (unsigned long)(addr); \
40 (l1_size && __addr >= l1_addr && __addr + (size) <= l1_addr + l1_size); \
41})
42#define ASYNC_BANK_SIZE \
43 (ASYNC_BANK0_SIZE + ASYNC_BANK1_SIZE + \
44 ASYNC_BANK2_SIZE + ASYNC_BANK3_SIZE)
40 45
41void pt_regs_to_gdb_regs(unsigned long *gdb_regs, struct pt_regs *regs) 46void pt_regs_to_gdb_regs(unsigned long *gdb_regs, struct pt_regs *regs)
42{ 47{
@@ -105,7 +110,7 @@ void pt_regs_to_gdb_regs(unsigned long *gdb_regs, struct pt_regs *regs)
105 * Extracts ebp, esp and eip values understandable by gdb from the values 110 * Extracts ebp, esp and eip values understandable by gdb from the values
106 * saved by switch_to. 111 * saved by switch_to.
107 * thread.esp points to ebp. flags and ebp are pushed in switch_to hence esp 112 * thread.esp points to ebp. flags and ebp are pushed in switch_to hence esp
108 * prior to entering switch_to is 8 greater then the value that is saved. 113 * prior to entering switch_to is 8 greater than the value that is saved.
109 * If switch_to changes, change following code appropriately. 114 * If switch_to changes, change following code appropriately.
110 */ 115 */
111void sleeping_thread_to_gdb_regs(unsigned long *gdb_regs, struct task_struct *p) 116void sleeping_thread_to_gdb_regs(unsigned long *gdb_regs, struct task_struct *p)
@@ -219,6 +224,7 @@ int bfin_set_hw_break(unsigned long addr, int len, enum kgdb_bptype type)
219 if (bfin_type == breakinfo[breakno].type 224 if (bfin_type == breakinfo[breakno].type
220 && !breakinfo[breakno].occupied) { 225 && !breakinfo[breakno].occupied) {
221 breakinfo[breakno].occupied = 1; 226 breakinfo[breakno].occupied = 1;
227 breakinfo[breakno].skip = 0;
222 breakinfo[breakno].enabled = 1; 228 breakinfo[breakno].enabled = 1;
223 breakinfo[breakno].addr = addr; 229 breakinfo[breakno].addr = addr;
224 breakinfo[breakno].dataacc = dataacc; 230 breakinfo[breakno].dataacc = dataacc;
@@ -363,12 +369,12 @@ void kgdb_passive_cpu_callback(void *info)
363 369
364void kgdb_roundup_cpus(unsigned long flags) 370void kgdb_roundup_cpus(unsigned long flags)
365{ 371{
366 smp_call_function(kgdb_passive_cpu_callback, NULL, 0, 0); 372 smp_call_function(kgdb_passive_cpu_callback, NULL, 0);
367} 373}
368 374
369void kgdb_roundup_cpu(int cpu, unsigned long flags) 375void kgdb_roundup_cpu(int cpu, unsigned long flags)
370{ 376{
371 smp_call_function_single(cpu, kgdb_passive_cpu_callback, NULL, 0, 0); 377 smp_call_function_single(cpu, kgdb_passive_cpu_callback, NULL, 0);
372} 378}
373#endif 379#endif
374 380
@@ -385,10 +391,8 @@ int kgdb_arch_handle_exception(int vector, int signo,
385 struct pt_regs *regs) 391 struct pt_regs *regs)
386{ 392{
387 long addr; 393 long addr;
388 long breakno;
389 char *ptr; 394 char *ptr;
390 int newPC; 395 int newPC;
391 int wp_status;
392 int i; 396 int i;
393 397
394 switch (remcom_in_buffer[0]) { 398 switch (remcom_in_buffer[0]) {
@@ -426,17 +430,6 @@ int kgdb_arch_handle_exception(int vector, int signo,
426 kgdb_single_step = i + 1; 430 kgdb_single_step = i + 1;
427 } 431 }
428 432
429 if (vector == VEC_WATCH) {
430 wp_status = bfin_read_WPSTAT();
431 for (breakno = 0; breakno < HW_WATCHPOINT_NUM; breakno++) {
432 if (wp_status & (1 << breakno)) {
433 breakinfo->skip = 1;
434 break;
435 }
436 }
437 bfin_write_WPSTAT(0);
438 }
439
440 bfin_correct_hw_break(); 433 bfin_correct_hw_break();
441 434
442 return 0; 435 return 0;
@@ -478,57 +471,32 @@ static int validate_memory_access_address(unsigned long addr, int size)
478 return 0; 471 return 0;
479 if (addr >= SYSMMR_BASE) 472 if (addr >= SYSMMR_BASE)
480 return 0; 473 return 0;
481 if (addr >= ASYNC_BANK0_BASE 474 if (IN_MEM(addr, size, ASYNC_BANK0_BASE, ASYNC_BANK_SIZE))
482 && addr + size <= ASYNC_BANK3_BASE + ASYNC_BANK3_SIZE)
483 return 0; 475 return 0;
484 if (cpu == 0) { 476 if (cpu == 0) {
485 if (addr >= L1_SCRATCH_START 477 if (IN_MEM(addr, size, L1_SCRATCH_START, L1_SCRATCH_LENGTH))
486 && (addr + size <= L1_SCRATCH_START + L1_SCRATCH_LENGTH))
487 return 0; 478 return 0;
488#if L1_CODE_LENGTH != 0 479 if (IN_MEM(addr, size, L1_CODE_START, L1_CODE_LENGTH))
489 if (addr >= L1_CODE_START
490 && (addr + size <= L1_CODE_START + L1_CODE_LENGTH))
491 return 0; 480 return 0;
492#endif 481 if (IN_MEM(addr, size, L1_DATA_A_START, L1_DATA_A_LENGTH))
493#if L1_DATA_A_LENGTH != 0
494 if (addr >= L1_DATA_A_START
495 && (addr + size <= L1_DATA_A_START + L1_DATA_A_LENGTH))
496 return 0; 482 return 0;
497#endif 483 if (IN_MEM(addr, size, L1_DATA_B_START, L1_DATA_B_LENGTH))
498#if L1_DATA_B_LENGTH != 0
499 if (addr >= L1_DATA_B_START
500 && (addr + size <= L1_DATA_B_START + L1_DATA_B_LENGTH))
501 return 0; 484 return 0;
502#endif
503#ifdef CONFIG_SMP 485#ifdef CONFIG_SMP
504 } else if (cpu == 1) { 486 } else if (cpu == 1) {
505 if (addr >= COREB_L1_SCRATCH_START 487 if (IN_MEM(addr, size, COREB_L1_SCRATCH_START, L1_SCRATCH_LENGTH))
506 && (addr + size <= COREB_L1_SCRATCH_START
507 + L1_SCRATCH_LENGTH))
508 return 0; 488 return 0;
509# if L1_CODE_LENGTH != 0 489 if (IN_MEM(addr, size, COREB_L1_CODE_START, L1_CODE_LENGTH))
510 if (addr >= COREB_L1_CODE_START
511 && (addr + size <= COREB_L1_CODE_START + L1_CODE_LENGTH))
512 return 0; 490 return 0;
513# endif 491 if (IN_MEM(addr, size, COREB_L1_DATA_A_START, L1_DATA_A_LENGTH))
514# if L1_DATA_A_LENGTH != 0
515 if (addr >= COREB_L1_DATA_A_START
516 && (addr + size <= COREB_L1_DATA_A_START + L1_DATA_A_LENGTH))
517 return 0; 492 return 0;
518# endif 493 if (IN_MEM(addr, size, COREB_L1_DATA_B_START, L1_DATA_B_LENGTH))
519# if L1_DATA_B_LENGTH != 0
520 if (addr >= COREB_L1_DATA_B_START
521 && (addr + size <= COREB_L1_DATA_B_START + L1_DATA_B_LENGTH))
522 return 0; 494 return 0;
523# endif
524#endif 495#endif
525 } 496 }
526 497
527#if L2_LENGTH != 0 498 if (IN_MEM(addr, size, L2_START, L2_LENGTH))
528 if (addr >= L2_START
529 && addr + size <= L2_START + L2_LENGTH)
530 return 0; 499 return 0;
531#endif
532 500
533 return EFAULT; 501 return EFAULT;
534} 502}
@@ -582,12 +550,9 @@ int kgdb_mem2hex(char *mem, char *buf, int count)
582 default: 550 default:
583 err = EFAULT; 551 err = EFAULT;
584 } 552 }
585 } else if (cpu == 0 && (unsigned int)mem >= L1_CODE_START && 553 } else if ((cpu == 0 && IN_MEM(mem, count, L1_CODE_START, L1_CODE_LENGTH))
586 (unsigned int)(mem + count) <= L1_CODE_START + L1_CODE_LENGTH
587#ifdef CONFIG_SMP 554#ifdef CONFIG_SMP
588 || cpu == 1 && (unsigned int)mem >= COREB_L1_CODE_START && 555 || (cpu == 1 && IN_MEM(mem, count, COREB_L1_CODE_START, L1_CODE_LENGTH))
589 (unsigned int)(mem + count) <=
590 COREB_L1_CODE_START + L1_CODE_LENGTH
591#endif 556#endif
592 ) { 557 ) {
593 /* access L1 instruction SRAM*/ 558 /* access L1 instruction SRAM*/
@@ -658,12 +623,9 @@ int kgdb_ebin2mem(char *buf, char *mem, int count)
658 default: 623 default:
659 return EFAULT; 624 return EFAULT;
660 } 625 }
661 } else if (cpu == 0 && (unsigned int)mem >= L1_CODE_START && 626 } else if ((cpu == 0 && IN_MEM(mem, count, L1_CODE_START, L1_CODE_LENGTH))
662 (unsigned int)(mem + count) < L1_CODE_START + L1_CODE_LENGTH
663#ifdef CONFIG_SMP 627#ifdef CONFIG_SMP
664 || cpu == 1 && (unsigned int)mem >= COREB_L1_CODE_START && 628 || (cpu == 1 && IN_MEM(mem, count, COREB_L1_CODE_START, L1_CODE_LENGTH))
665 (unsigned int)(mem + count) <=
666 COREB_L1_CODE_START + L1_CODE_LENGTH
667#endif 629#endif
668 ) { 630 ) {
669 /* access L1 instruction SRAM */ 631 /* access L1 instruction SRAM */
@@ -723,12 +685,9 @@ int kgdb_hex2mem(char *buf, char *mem, int count)
723 default: 685 default:
724 return EFAULT; 686 return EFAULT;
725 } 687 }
726 } else if (cpu == 0 && (unsigned int)mem >= L1_CODE_START && 688 } else if ((cpu == 0 && IN_MEM(mem, count, L1_CODE_START, L1_CODE_LENGTH))
727 (unsigned int)(mem + count) <= L1_CODE_START + L1_CODE_LENGTH
728#ifdef CONFIG_SMP 689#ifdef CONFIG_SMP
729 || cpu == 1 && (unsigned int)mem >= COREB_L1_CODE_START && 690 || (cpu == 1 && IN_MEM(mem, count, COREB_L1_CODE_START, L1_CODE_LENGTH))
730 (unsigned int)(mem + count) <=
731 COREB_L1_CODE_START + L1_CODE_LENGTH
732#endif 691#endif
733 ) { 692 ) {
734 /* access L1 instruction SRAM */ 693 /* access L1 instruction SRAM */
@@ -745,24 +704,16 @@ int kgdb_validate_break_address(unsigned long addr)
745 704
746 if (addr >= 0x1000 && (addr + BREAK_INSTR_SIZE) <= physical_mem_end) 705 if (addr >= 0x1000 && (addr + BREAK_INSTR_SIZE) <= physical_mem_end)
747 return 0; 706 return 0;
748 if (addr >= ASYNC_BANK0_BASE 707 if (IN_MEM(addr, BREAK_INSTR_SIZE, ASYNC_BANK0_BASE, ASYNC_BANK_SIZE))
749 && addr + BREAK_INSTR_SIZE <= ASYNC_BANK3_BASE + ASYNC_BANK3_BASE)
750 return 0; 708 return 0;
751#if L1_CODE_LENGTH != 0 709 if (cpu == 0 && IN_MEM(addr, BREAK_INSTR_SIZE, L1_CODE_START, L1_CODE_LENGTH))
752 if (cpu == 0 && addr >= L1_CODE_START
753 && addr + BREAK_INSTR_SIZE <= L1_CODE_START + L1_CODE_LENGTH)
754 return 0; 710 return 0;
755# ifdef CONFIG_SMP 711#ifdef CONFIG_SMP
756 else if (cpu == 1 && addr >= COREB_L1_CODE_START 712 else if (cpu == 1 && IN_MEM(addr, BREAK_INSTR_SIZE, COREB_L1_CODE_START, L1_CODE_LENGTH))
757 && addr + BREAK_INSTR_SIZE <= COREB_L1_CODE_START + L1_CODE_LENGTH)
758 return 0; 713 return 0;
759# endif
760#endif 714#endif
761#if L2_LENGTH != 0 715 if (IN_MEM(addr, BREAK_INSTR_SIZE, L2_START, L2_LENGTH))
762 if (addr >= L2_START
763 && addr + BREAK_INSTR_SIZE <= L2_START + L2_LENGTH)
764 return 0; 716 return 0;
765#endif
766 717
767 return EFAULT; 718 return EFAULT;
768} 719}
@@ -772,13 +723,9 @@ int kgdb_arch_set_breakpoint(unsigned long addr, char *saved_instr)
772 int err; 723 int err;
773 int cpu = raw_smp_processor_id(); 724 int cpu = raw_smp_processor_id();
774 725
775 if ((cpu == 0 && (unsigned int)addr >= L1_CODE_START 726 if ((cpu == 0 && IN_MEM(addr, BREAK_INSTR_SIZE, L1_CODE_START, L1_CODE_LENGTH))
776 && (unsigned int)(addr + BREAK_INSTR_SIZE)
777 < L1_CODE_START + L1_CODE_LENGTH)
778#ifdef CONFIG_SMP 727#ifdef CONFIG_SMP
779 || (cpu == 1 && (unsigned int)addr >= COREB_L1_CODE_START 728 || (cpu == 1 && IN_MEM(addr, BREAK_INSTR_SIZE, COREB_L1_CODE_START, L1_CODE_LENGTH))
780 && (unsigned int)(addr + BREAK_INSTR_SIZE)
781 < COREB_L1_CODE_START + L1_CODE_LENGTH)
782#endif 729#endif
783 ) { 730 ) {
784 /* access L1 instruction SRAM */ 731 /* access L1 instruction SRAM */
@@ -804,9 +751,7 @@ int kgdb_arch_set_breakpoint(unsigned long addr, char *saved_instr)
804 751
805int kgdb_arch_remove_breakpoint(unsigned long addr, char *bundle) 752int kgdb_arch_remove_breakpoint(unsigned long addr, char *bundle)
806{ 753{
807 if ((unsigned int)addr >= L1_CODE_START && 754 if (IN_MEM(addr, BREAK_INSTR_SIZE, L1_CODE_START, L1_CODE_LENGTH)) {
808 (unsigned int)(addr + BREAK_INSTR_SIZE) <
809 L1_CODE_START + L1_CODE_LENGTH) {
810 /* access L1 instruction SRAM */ 755 /* access L1 instruction SRAM */
811 if (dma_memcpy((void *)addr, bundle, BREAK_INSTR_SIZE) == NULL) 756 if (dma_memcpy((void *)addr, bundle, BREAK_INSTR_SIZE) == NULL)
812 return -EFAULT; 757 return -EFAULT;
diff --git a/arch/blackfin/kernel/kgdb_test.c b/arch/blackfin/kernel/kgdb_test.c
new file mode 100644
index 000000000000..3dba9c17304a
--- /dev/null
+++ b/arch/blackfin/kernel/kgdb_test.c
@@ -0,0 +1,123 @@
1/*
2 * arch/blackfin/kernel/kgdb_test.c - Blackfin kgdb tests
3 *
4 * Copyright 2005-2008 Analog Devices Inc.
5 *
6 * Licensed under the GPL-2 or later.
7 */
8
9#include <linux/module.h>
10#include <linux/kernel.h>
11#include <linux/init.h>
12#include <linux/proc_fs.h>
13
14#include <asm/current.h>
15#include <asm/uaccess.h>
16#include <asm/system.h>
17
18#include <asm/blackfin.h>
19
20static char cmdline[256];
21static unsigned long len;
22
23static int num1 __attribute__((l1_data));
24
25void kgdb_l1_test(void) __attribute__((l1_text));
26
27void kgdb_l1_test(void)
28{
29 printk(KERN_ALERT "L1(before change) : data variable addr = 0x%p, data value is %d\n", &num1, num1);
30 printk(KERN_ALERT "L1 : code function addr = 0x%p\n", kgdb_l1_test);
31 num1 = num1 + 10 ;
32 printk(KERN_ALERT "L1(after change) : data variable addr = 0x%p, data value is %d\n", &num1, num1);
33 return ;
34}
35#if L2_LENGTH
36
37static int num2 __attribute__((l2));
38void kgdb_l2_test(void) __attribute__((l2));
39
40void kgdb_l2_test(void)
41{
42 printk(KERN_ALERT "L2(before change) : data variable addr = 0x%p, data value is %d\n", &num2, num2);
43 printk(KERN_ALERT "L2 : code function addr = 0x%p\n", kgdb_l2_test);
44 num2 = num2 + 20 ;
45 printk(KERN_ALERT "L2(after change) : data variable addr = 0x%p, data value is %d\n", &num2, num2);
46 return ;
47}
48
49#endif
50
51
52int kgdb_test(char *name, int len, int count, int z)
53{
54 printk(KERN_DEBUG "kgdb name(%d): %s, %d, %d\n", len, name, count, z);
55 count = z;
56 return count;
57}
58
59static int test_proc_output(char *buf)
60{
61 kgdb_test("hello world!", 12, 0x55, 0x10);
62 kgdb_l1_test();
63 #if L2_LENGTH
64 kgdb_l2_test();
65 #endif
66
67 return 0;
68}
69
70static int test_read_proc(char *page, char **start, off_t off,
71 int count, int *eof, void *data)
72{
73 int len;
74
75 len = test_proc_output(page);
76 if (len <= off+count)
77 *eof = 1;
78 *start = page + off;
79 len -= off;
80 if (len > count)
81 len = count;
82 if (len < 0)
83 len = 0;
84 return len;
85}
86
87static int test_write_proc(struct file *file, const char *buffer,
88 unsigned long count, void *data)
89{
90 if (count >= 256)
91 len = 255;
92 else
93 len = count;
94
95 memcpy(cmdline, buffer, count);
96 cmdline[len] = 0;
97
98 return len;
99}
100
101static int __init kgdbtest_init(void)
102{
103 struct proc_dir_entry *entry;
104
105 entry = create_proc_entry("kgdbtest", 0, NULL);
106 if (entry == NULL)
107 return -ENOMEM;
108
109 entry->read_proc = test_read_proc;
110 entry->write_proc = test_write_proc;
111 entry->data = NULL;
112
113 return 0;
114}
115
116static void __exit kgdbtest_exit(void)
117{
118 remove_proc_entry("kgdbtest", NULL);
119}
120
121module_init(kgdbtest_init);
122module_exit(kgdbtest_exit);
123MODULE_LICENSE("GPL");
diff --git a/arch/blackfin/kernel/mcount.S b/arch/blackfin/kernel/mcount.S
new file mode 100644
index 000000000000..edcfb3865f46
--- /dev/null
+++ b/arch/blackfin/kernel/mcount.S
@@ -0,0 +1,70 @@
1/*
2 * linux/arch/blackfin/mcount.S
3 *
4 * Copyright (C) 2006 Analog Devices Inc.
5 *
6 * 2007/04/12 Save index, length, modify and base registers. --rpm
7 */
8
9#include <linux/linkage.h>
10#include <asm/blackfin.h>
11
12.text
13
14.align 4 /* just in case */
15
16ENTRY(__mcount)
17 [--sp] = i0;
18 [--sp] = i1;
19 [--sp] = i2;
20 [--sp] = i3;
21 [--sp] = l0;
22 [--sp] = l1;
23 [--sp] = l2;
24 [--sp] = l3;
25 [--sp] = m0;
26 [--sp] = m1;
27 [--sp] = m2;
28 [--sp] = m3;
29 [--sp] = b0;
30 [--sp] = b1;
31 [--sp] = b2;
32 [--sp] = b3;
33 [--sp] = ( r7:0, p5:0 );
34 [--sp] = ASTAT;
35
36 p1.L = _ipipe_trace_enable;
37 p1.H = _ipipe_trace_enable;
38 r7 = [p1];
39 CC = r7 == 0;
40 if CC jump out;
41 link 0x10;
42 r0 = 0x0;
43 [sp + 0xc] = r0; /* v */
44 r0 = 0x0; /* type: IPIPE_TRACE_FN */
45 r1 = rets;
46 p0 = [fp]; /* p0: Prior FP */
47 r2 = [p0 + 4]; /* r2: Prior RETS */
48 call ___ipipe_trace;
49 unlink;
50out:
51 ASTAT = [sp++];
52 ( r7:0, p5:0 ) = [sp++];
53 b3 = [sp++];
54 b2 = [sp++];
55 b1 = [sp++];
56 b0 = [sp++];
57 m3 = [sp++];
58 m2 = [sp++];
59 m1 = [sp++];
60 m0 = [sp++];
61 l3 = [sp++];
62 l2 = [sp++];
63 l1 = [sp++];
64 l0 = [sp++];
65 i3 = [sp++];
66 i2 = [sp++];
67 i1 = [sp++];
68 i0 = [sp++];
69 rts;
70ENDPROC(__mcount)
diff --git a/arch/blackfin/kernel/module.c b/arch/blackfin/kernel/module.c
index e1bebc80a5bf..1bd7f2d018a8 100644
--- a/arch/blackfin/kernel/module.c
+++ b/arch/blackfin/kernel/module.c
@@ -37,111 +37,6 @@
37#include <asm/dma.h> 37#include <asm/dma.h>
38#include <asm/cacheflush.h> 38#include <asm/cacheflush.h>
39 39
40/*
41 * handle arithmetic relocations.
42 * See binutils/bfd/elf32-bfin.c for more details
43 */
44#define RELOC_STACK_SIZE 100
45static uint32_t reloc_stack[RELOC_STACK_SIZE];
46static unsigned int reloc_stack_tos;
47
48#define is_reloc_stack_empty() ((reloc_stack_tos > 0)?0:1)
49
50static void reloc_stack_push(uint32_t value)
51{
52 reloc_stack[reloc_stack_tos++] = value;
53}
54
55static uint32_t reloc_stack_pop(void)
56{
57 return reloc_stack[--reloc_stack_tos];
58}
59
60static uint32_t reloc_stack_operate(unsigned int oper, struct module *mod)
61{
62 uint32_t value;
63
64 switch (oper) {
65 case R_add:
66 value = reloc_stack[reloc_stack_tos - 2] +
67 reloc_stack[reloc_stack_tos - 1];
68 reloc_stack_tos -= 2;
69 break;
70 case R_sub:
71 value = reloc_stack[reloc_stack_tos - 2] -
72 reloc_stack[reloc_stack_tos - 1];
73 reloc_stack_tos -= 2;
74 break;
75 case R_mult:
76 value = reloc_stack[reloc_stack_tos - 2] *
77 reloc_stack[reloc_stack_tos - 1];
78 reloc_stack_tos -= 2;
79 break;
80 case R_div:
81 value = reloc_stack[reloc_stack_tos - 2] /
82 reloc_stack[reloc_stack_tos - 1];
83 reloc_stack_tos -= 2;
84 break;
85 case R_mod:
86 value = reloc_stack[reloc_stack_tos - 2] %
87 reloc_stack[reloc_stack_tos - 1];
88 reloc_stack_tos -= 2;
89 break;
90 case R_lshift:
91 value = reloc_stack[reloc_stack_tos - 2] <<
92 reloc_stack[reloc_stack_tos - 1];
93 reloc_stack_tos -= 2;
94 break;
95 case R_rshift:
96 value = reloc_stack[reloc_stack_tos - 2] >>
97 reloc_stack[reloc_stack_tos - 1];
98 reloc_stack_tos -= 2;
99 break;
100 case R_and:
101 value = reloc_stack[reloc_stack_tos - 2] &
102 reloc_stack[reloc_stack_tos - 1];
103 reloc_stack_tos -= 2;
104 break;
105 case R_or:
106 value = reloc_stack[reloc_stack_tos - 2] |
107 reloc_stack[reloc_stack_tos - 1];
108 reloc_stack_tos -= 2;
109 break;
110 case R_xor:
111 value = reloc_stack[reloc_stack_tos - 2] ^
112 reloc_stack[reloc_stack_tos - 1];
113 reloc_stack_tos -= 2;
114 break;
115 case R_land:
116 value = reloc_stack[reloc_stack_tos - 2] &&
117 reloc_stack[reloc_stack_tos - 1];
118 reloc_stack_tos -= 2;
119 break;
120 case R_lor:
121 value = reloc_stack[reloc_stack_tos - 2] ||
122 reloc_stack[reloc_stack_tos - 1];
123 reloc_stack_tos -= 2;
124 break;
125 case R_neg:
126 value = -reloc_stack[reloc_stack_tos - 1];
127 reloc_stack_tos--;
128 break;
129 case R_comp:
130 value = ~reloc_stack[reloc_stack_tos - 1];
131 reloc_stack_tos -= 1;
132 break;
133 default:
134 printk(KERN_WARNING "module %s: unhandled reloction\n",
135 mod->name);
136 return 0;
137 }
138
139 /* now push the new value back on stack */
140 reloc_stack_push(value);
141
142 return value;
143}
144
145void *module_alloc(unsigned long size) 40void *module_alloc(unsigned long size)
146{ 41{
147 if (size == 0) 42 if (size == 0)
@@ -334,16 +229,18 @@ apply_relocate_add(Elf_Shdr * sechdrs, const char *strtab,
334 undefined symbols have been resolved. */ 229 undefined symbols have been resolved. */
335 sym = (Elf32_Sym *) sechdrs[symindex].sh_addr 230 sym = (Elf32_Sym *) sechdrs[symindex].sh_addr
336 + ELF32_R_SYM(rel[i].r_info); 231 + ELF32_R_SYM(rel[i].r_info);
337 if (is_reloc_stack_empty()) { 232 value = sym->st_value;
338 value = sym->st_value;
339 } else {
340 value = reloc_stack_pop();
341 }
342 value += rel[i].r_addend; 233 value += rel[i].r_addend;
343 pr_debug("location is %x, value is %x type is %d \n", 234 pr_debug("location is %x, value is %x type is %d \n",
344 (unsigned int) location32, value, 235 (unsigned int) location32, value,
345 ELF32_R_TYPE(rel[i].r_info)); 236 ELF32_R_TYPE(rel[i].r_info));
346 237#ifdef CONFIG_SMP
238 if ((unsigned long)location16 >= COREB_L1_DATA_A_START) {
239 printk(KERN_ERR "module %s: cannot relocate in L1: %u (SMP kernel)",
240 mod->name, ELF32_R_TYPE(rel[i].r_info));
241 return -ENOEXEC;
242 }
243#endif
347 switch (ELF32_R_TYPE(rel[i].r_info)) { 244 switch (ELF32_R_TYPE(rel[i].r_info)) {
348 245
349 case R_pcrel24: 246 case R_pcrel24:
@@ -355,6 +252,12 @@ apply_relocate_add(Elf_Shdr * sechdrs, const char *strtab,
355 location32 = (uint32_t *) location16; 252 location32 = (uint32_t *) location16;
356 value -= (uint32_t) location32; 253 value -= (uint32_t) location32;
357 value >>= 1; 254 value >>= 1;
255 if ((value & 0xFF000000) != 0 &&
256 (value & 0xFF000000) != 0xFF000000) {
257 printk(KERN_ERR "module %s: relocation overflow\n",
258 mod->name);
259 return -ENOEXEC;
260 }
358 pr_debug("value is %x, before %x-%x after %x-%x\n", value, 261 pr_debug("value is %x, before %x-%x after %x-%x\n", value,
359 *location16, *(location16 + 1), 262 *location16, *(location16 + 1),
360 (*location16 & 0xff00) | (value >> 16 & 0x00ff), 263 (*location16 & 0xff00) | (value >> 16 & 0x00ff),
@@ -399,28 +302,6 @@ apply_relocate_add(Elf_Shdr * sechdrs, const char *strtab,
399 pr_debug("before %x after %x\n", *location32, value); 302 pr_debug("before %x after %x\n", *location32, value);
400 *location32 = value; 303 *location32 = value;
401 break; 304 break;
402 case R_push:
403 reloc_stack_push(value);
404 break;
405 case R_const:
406 reloc_stack_push(rel[i].r_addend);
407 break;
408 case R_add:
409 case R_sub:
410 case R_mult:
411 case R_div:
412 case R_mod:
413 case R_lshift:
414 case R_rshift:
415 case R_and:
416 case R_or:
417 case R_xor:
418 case R_land:
419 case R_lor:
420 case R_neg:
421 case R_comp:
422 reloc_stack_operate(ELF32_R_TYPE(rel[i].r_info), mod);
423 break;
424 default: 305 default:
425 printk(KERN_ERR "module %s: Unknown relocation: %u\n", 306 printk(KERN_ERR "module %s: Unknown relocation: %u\n",
426 mod->name, ELF32_R_TYPE(rel[i].r_info)); 307 mod->name, ELF32_R_TYPE(rel[i].r_info));
@@ -436,6 +317,7 @@ module_finalize(const Elf_Ehdr * hdr,
436{ 317{
437 unsigned int i, strindex = 0, symindex = 0; 318 unsigned int i, strindex = 0, symindex = 0;
438 char *secstrings; 319 char *secstrings;
320 long err = 0;
439 321
440 secstrings = (void *)hdr + sechdrs[hdr->e_shstrndx].sh_offset; 322 secstrings = (void *)hdr + sechdrs[hdr->e_shstrndx].sh_offset;
441 323
@@ -460,8 +342,10 @@ module_finalize(const Elf_Ehdr * hdr,
460 (strcmp(".rela.l1.text", secstrings + sechdrs[i].sh_name) == 0) || 342 (strcmp(".rela.l1.text", secstrings + sechdrs[i].sh_name) == 0) ||
461 ((strcmp(".rela.text", secstrings + sechdrs[i].sh_name) == 0) && 343 ((strcmp(".rela.text", secstrings + sechdrs[i].sh_name) == 0) &&
462 (hdr->e_flags & (EF_BFIN_CODE_IN_L1|EF_BFIN_CODE_IN_L2))))) { 344 (hdr->e_flags & (EF_BFIN_CODE_IN_L1|EF_BFIN_CODE_IN_L2))))) {
463 apply_relocate_add((Elf_Shdr *) sechdrs, strtab, 345 err = apply_relocate_add((Elf_Shdr *) sechdrs, strtab,
464 symindex, i, mod); 346 symindex, i, mod);
347 if (err < 0)
348 return -ENOEXEC;
465 } 349 }
466 } 350 }
467 return 0; 351 return 0;
diff --git a/arch/blackfin/kernel/process.c b/arch/blackfin/kernel/process.c
index 0c3ea118b657..33e2e8993f7f 100644
--- a/arch/blackfin/kernel/process.c
+++ b/arch/blackfin/kernel/process.c
@@ -39,6 +39,7 @@
39 39
40#include <asm/blackfin.h> 40#include <asm/blackfin.h>
41#include <asm/fixed_code.h> 41#include <asm/fixed_code.h>
42#include <asm/mem_map.h>
42 43
43asmlinkage void ret_from_fork(void); 44asmlinkage void ret_from_fork(void);
44 45
@@ -81,11 +82,14 @@ void cpu_idle(void)__attribute__((l1_text));
81 */ 82 */
82static void default_idle(void) 83static void default_idle(void)
83{ 84{
84 local_irq_disable(); 85#ifdef CONFIG_IPIPE
86 ipipe_suspend_domain();
87#endif
88 local_irq_disable_hw();
85 if (!need_resched()) 89 if (!need_resched())
86 idle_with_irq_disabled(); 90 idle_with_irq_disabled();
87 91
88 local_irq_enable(); 92 local_irq_enable_hw();
89} 93}
90 94
91/* 95/*
@@ -154,6 +158,7 @@ pid_t kernel_thread(int (*fn) (void *), void *arg, unsigned long flags)
154 return do_fork(flags | CLONE_VM | CLONE_UNTRACED, 0, &regs, 0, NULL, 158 return do_fork(flags | CLONE_VM | CLONE_UNTRACED, 0, &regs, 0, NULL,
155 NULL); 159 NULL);
156} 160}
161EXPORT_SYMBOL(kernel_thread);
157 162
158void flush_thread(void) 163void flush_thread(void)
159{ 164{
@@ -170,6 +175,13 @@ asmlinkage int bfin_clone(struct pt_regs *regs)
170 unsigned long clone_flags; 175 unsigned long clone_flags;
171 unsigned long newsp; 176 unsigned long newsp;
172 177
178#ifdef __ARCH_SYNC_CORE_DCACHE
179 if (current->rt.nr_cpus_allowed == num_possible_cpus()) {
180 current->cpus_allowed = cpumask_of_cpu(smp_processor_id());
181 current->rt.nr_cpus_allowed = 1;
182 }
183#endif
184
173 /* syscall2 puts clone_flags in r0 and usp in r1 */ 185 /* syscall2 puts clone_flags in r0 and usp in r1 */
174 clone_flags = regs->r0; 186 clone_flags = regs->r0;
175 newsp = regs->r1; 187 newsp = regs->r1;
@@ -337,22 +349,22 @@ int _access_ok(unsigned long addr, unsigned long size)
337 if (addr >= (unsigned long)__init_begin && 349 if (addr >= (unsigned long)__init_begin &&
338 addr + size <= (unsigned long)__init_end) 350 addr + size <= (unsigned long)__init_end)
339 return 1; 351 return 1;
340 if (addr >= L1_SCRATCH_START 352 if (addr >= get_l1_scratch_start()
341 && addr + size <= L1_SCRATCH_START + L1_SCRATCH_LENGTH) 353 && addr + size <= get_l1_scratch_start() + L1_SCRATCH_LENGTH)
342 return 1; 354 return 1;
343#if L1_CODE_LENGTH != 0 355#if L1_CODE_LENGTH != 0
344 if (addr >= L1_CODE_START + (_etext_l1 - _stext_l1) 356 if (addr >= get_l1_code_start() + (_etext_l1 - _stext_l1)
345 && addr + size <= L1_CODE_START + L1_CODE_LENGTH) 357 && addr + size <= get_l1_code_start() + L1_CODE_LENGTH)
346 return 1; 358 return 1;
347#endif 359#endif
348#if L1_DATA_A_LENGTH != 0 360#if L1_DATA_A_LENGTH != 0
349 if (addr >= L1_DATA_A_START + (_ebss_l1 - _sdata_l1) 361 if (addr >= get_l1_data_a_start() + (_ebss_l1 - _sdata_l1)
350 && addr + size <= L1_DATA_A_START + L1_DATA_A_LENGTH) 362 && addr + size <= get_l1_data_a_start() + L1_DATA_A_LENGTH)
351 return 1; 363 return 1;
352#endif 364#endif
353#if L1_DATA_B_LENGTH != 0 365#if L1_DATA_B_LENGTH != 0
354 if (addr >= L1_DATA_B_START + (_ebss_b_l1 - _sdata_b_l1) 366 if (addr >= get_l1_data_b_start() + (_ebss_b_l1 - _sdata_b_l1)
355 && addr + size <= L1_DATA_B_START + L1_DATA_B_LENGTH) 367 && addr + size <= get_l1_data_b_start() + L1_DATA_B_LENGTH)
356 return 1; 368 return 1;
357#endif 369#endif
358#if L2_LENGTH != 0 370#if L2_LENGTH != 0
diff --git a/arch/blackfin/kernel/ptrace.c b/arch/blackfin/kernel/ptrace.c
index 140bf00e9974..d2d388536630 100644
--- a/arch/blackfin/kernel/ptrace.c
+++ b/arch/blackfin/kernel/ptrace.c
@@ -45,6 +45,7 @@
45#include <asm/asm-offsets.h> 45#include <asm/asm-offsets.h>
46#include <asm/dma.h> 46#include <asm/dma.h>
47#include <asm/fixed_code.h> 47#include <asm/fixed_code.h>
48#include <asm/mem_map.h>
48 49
49#define TEXT_OFFSET 0 50#define TEXT_OFFSET 0
50/* 51/*
@@ -80,10 +81,12 @@ static inline struct pt_regs *get_user_regs(struct task_struct *task)
80/* 81/*
81 * Get all user integer registers. 82 * Get all user integer registers.
82 */ 83 */
83static inline int ptrace_getregs(struct task_struct *tsk, void __user * uregs) 84static inline int ptrace_getregs(struct task_struct *tsk, void __user *uregs)
84{ 85{
85 struct pt_regs *regs = get_user_regs(tsk); 86 struct pt_regs regs;
86 return copy_to_user(uregs, regs, sizeof(struct pt_regs)) ? -EFAULT : 0; 87 memcpy(&regs, get_user_regs(tsk), sizeof(regs));
88 regs.usp = tsk->thread.usp;
89 return copy_to_user(uregs, &regs, sizeof(struct pt_regs)) ? -EFAULT : 0;
87} 90}
88 91
89/* Mapping from PT_xxx to the stack offset at which the register is 92/* Mapping from PT_xxx to the stack offset at which the register is
@@ -220,8 +223,8 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
220 break; 223 break;
221 pr_debug("ptrace: user address is valid\n"); 224 pr_debug("ptrace: user address is valid\n");
222 225
223 if (L1_CODE_LENGTH != 0 && addr >= L1_CODE_START 226 if (L1_CODE_LENGTH != 0 && addr >= get_l1_code_start()
224 && addr + sizeof(tmp) <= L1_CODE_START + L1_CODE_LENGTH) { 227 && addr + sizeof(tmp) <= get_l1_code_start() + L1_CODE_LENGTH) {
225 safe_dma_memcpy (&tmp, (const void *)(addr), sizeof(tmp)); 228 safe_dma_memcpy (&tmp, (const void *)(addr), sizeof(tmp));
226 copied = sizeof(tmp); 229 copied = sizeof(tmp);
227 230
@@ -300,8 +303,8 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
300 break; 303 break;
301 pr_debug("ptrace: user address is valid\n"); 304 pr_debug("ptrace: user address is valid\n");
302 305
303 if (L1_CODE_LENGTH != 0 && addr >= L1_CODE_START 306 if (L1_CODE_LENGTH != 0 && addr >= get_l1_code_start()
304 && addr + sizeof(data) <= L1_CODE_START + L1_CODE_LENGTH) { 307 && addr + sizeof(data) <= get_l1_code_start() + L1_CODE_LENGTH) {
305 safe_dma_memcpy ((void *)(addr), &data, sizeof(data)); 308 safe_dma_memcpy ((void *)(addr), &data, sizeof(data));
306 copied = sizeof(data); 309 copied = sizeof(data);
307 310
diff --git a/arch/blackfin/kernel/reboot.c b/arch/blackfin/kernel/reboot.c
index ae97ca407b0d..eeee8cb43360 100644
--- a/arch/blackfin/kernel/reboot.c
+++ b/arch/blackfin/kernel/reboot.c
@@ -21,7 +21,7 @@
21 * the core reset. 21 * the core reset.
22 */ 22 */
23__attribute__((l1_text)) 23__attribute__((l1_text))
24static void bfin_reset(void) 24static void _bfin_reset(void)
25{ 25{
26 /* Wait for completion of "system" events such as cache line 26 /* Wait for completion of "system" events such as cache line
27 * line fills so that we avoid infinite stalls later on as 27 * line fills so that we avoid infinite stalls later on as
@@ -66,6 +66,18 @@ static void bfin_reset(void)
66 } 66 }
67} 67}
68 68
69static void bfin_reset(void)
70{
71 if (ANOMALY_05000353 || ANOMALY_05000386)
72 _bfin_reset();
73 else
74 /* the bootrom checks to see how it was reset and will
75 * automatically perform a software reset for us when
76 * it starts executing boot
77 */
78 asm("raise 1;");
79}
80
69__attribute__((weak)) 81__attribute__((weak))
70void native_machine_restart(char *cmd) 82void native_machine_restart(char *cmd)
71{ 83{
@@ -75,14 +87,10 @@ void machine_restart(char *cmd)
75{ 87{
76 native_machine_restart(cmd); 88 native_machine_restart(cmd);
77 local_irq_disable(); 89 local_irq_disable();
78 if (ANOMALY_05000353 || ANOMALY_05000386) 90 if (smp_processor_id())
79 bfin_reset(); 91 smp_call_function((void *)bfin_reset, 0, 1);
80 else 92 else
81 /* the bootrom checks to see how it was reset and will 93 bfin_reset();
82 * automatically perform a software reset for us when
83 * it starts executing boot
84 */
85 asm("raise 1;");
86} 94}
87 95
88__attribute__((weak)) 96__attribute__((weak))
diff --git a/arch/blackfin/kernel/setup.c b/arch/blackfin/kernel/setup.c
index 71a9a8c53cea..b2a811347b65 100644
--- a/arch/blackfin/kernel/setup.c
+++ b/arch/blackfin/kernel/setup.c
@@ -13,6 +13,7 @@
13#include <linux/bootmem.h> 13#include <linux/bootmem.h>
14#include <linux/seq_file.h> 14#include <linux/seq_file.h>
15#include <linux/cpu.h> 15#include <linux/cpu.h>
16#include <linux/mm.h>
16#include <linux/module.h> 17#include <linux/module.h>
17#include <linux/tty.h> 18#include <linux/tty.h>
18#include <linux/pfn.h> 19#include <linux/pfn.h>
@@ -26,11 +27,10 @@
26#include <asm/blackfin.h> 27#include <asm/blackfin.h>
27#include <asm/cplbinit.h> 28#include <asm/cplbinit.h>
28#include <asm/div64.h> 29#include <asm/div64.h>
30#include <asm/cpu.h>
29#include <asm/fixed_code.h> 31#include <asm/fixed_code.h>
30#include <asm/early_printk.h> 32#include <asm/early_printk.h>
31 33
32static DEFINE_PER_CPU(struct cpu, cpu_devices);
33
34u16 _bfin_swrst; 34u16 _bfin_swrst;
35EXPORT_SYMBOL(_bfin_swrst); 35EXPORT_SYMBOL(_bfin_swrst);
36 36
@@ -79,27 +79,68 @@ static struct change_member *change_point[2*BFIN_MEMMAP_MAX] __initdata;
79static struct bfin_memmap_entry *overlap_list[BFIN_MEMMAP_MAX] __initdata; 79static struct bfin_memmap_entry *overlap_list[BFIN_MEMMAP_MAX] __initdata;
80static struct bfin_memmap_entry new_map[BFIN_MEMMAP_MAX] __initdata; 80static struct bfin_memmap_entry new_map[BFIN_MEMMAP_MAX] __initdata;
81 81
82void __init bfin_cache_init(void) 82DEFINE_PER_CPU(struct blackfin_cpudata, cpu_data);
83{ 83
84static int early_init_clkin_hz(char *buf);
85
84#if defined(CONFIG_BFIN_DCACHE) || defined(CONFIG_BFIN_ICACHE) 86#if defined(CONFIG_BFIN_DCACHE) || defined(CONFIG_BFIN_ICACHE)
85 generate_cplb_tables(); 87void __init generate_cplb_tables(void)
88{
89 unsigned int cpu;
90
91 generate_cplb_tables_all();
92 /* Generate per-CPU I&D CPLB tables */
93 for (cpu = 0; cpu < num_possible_cpus(); ++cpu)
94 generate_cplb_tables_cpu(cpu);
95}
86#endif 96#endif
87 97
98void __cpuinit bfin_setup_caches(unsigned int cpu)
99{
88#ifdef CONFIG_BFIN_ICACHE 100#ifdef CONFIG_BFIN_ICACHE
89 bfin_icache_init(); 101 bfin_icache_init(icplb_tbl[cpu]);
90 printk(KERN_INFO "Instruction Cache Enabled\n");
91#endif 102#endif
92 103
93#ifdef CONFIG_BFIN_DCACHE 104#ifdef CONFIG_BFIN_DCACHE
94 bfin_dcache_init(); 105 bfin_dcache_init(dcplb_tbl[cpu]);
95 printk(KERN_INFO "Data Cache Enabled" 106#endif
107
108 /*
109 * In cache coherence emulation mode, we need to have the
110 * D-cache enabled before running any atomic operation which
111 * might invove cache invalidation (i.e. spinlock, rwlock).
112 * So printk's are deferred until then.
113 */
114#ifdef CONFIG_BFIN_ICACHE
115 printk(KERN_INFO "Instruction Cache Enabled for CPU%u\n", cpu);
116#endif
117#ifdef CONFIG_BFIN_DCACHE
118 printk(KERN_INFO "Data Cache Enabled for CPU%u"
96# if defined CONFIG_BFIN_WB 119# if defined CONFIG_BFIN_WB
97 " (write-back)" 120 " (write-back)"
98# elif defined CONFIG_BFIN_WT 121# elif defined CONFIG_BFIN_WT
99 " (write-through)" 122 " (write-through)"
100# endif 123# endif
101 "\n"); 124 "\n", cpu);
125#endif
126}
127
128void __cpuinit bfin_setup_cpudata(unsigned int cpu)
129{
130 struct blackfin_cpudata *cpudata = &per_cpu(cpu_data, cpu);
131
132 cpudata->idle = current;
133 cpudata->loops_per_jiffy = loops_per_jiffy;
134 cpudata->imemctl = bfin_read_IMEM_CONTROL();
135 cpudata->dmemctl = bfin_read_DMEM_CONTROL();
136}
137
138void __init bfin_cache_init(void)
139{
140#if defined(CONFIG_BFIN_DCACHE) || defined(CONFIG_BFIN_ICACHE)
141 generate_cplb_tables();
102#endif 142#endif
143 bfin_setup_caches(0);
103} 144}
104 145
105void __init bfin_relocate_l1_mem(void) 146void __init bfin_relocate_l1_mem(void)
@@ -109,6 +150,8 @@ void __init bfin_relocate_l1_mem(void)
109 unsigned long l1_data_b_length; 150 unsigned long l1_data_b_length;
110 unsigned long l2_length; 151 unsigned long l2_length;
111 152
153 blackfin_dma_early_init();
154
112 l1_code_length = _etext_l1 - _stext_l1; 155 l1_code_length = _etext_l1 - _stext_l1;
113 if (l1_code_length > L1_CODE_LENGTH) 156 if (l1_code_length > L1_CODE_LENGTH)
114 panic("L1 Instruction SRAM Overflow\n"); 157 panic("L1 Instruction SRAM Overflow\n");
@@ -230,7 +273,7 @@ static int __init sanitize_memmap(struct bfin_memmap_entry *map, int *pnr_map)
230 /* record all known change-points (starting and ending addresses), 273 /* record all known change-points (starting and ending addresses),
231 omitting those that are for empty memory regions */ 274 omitting those that are for empty memory regions */
232 chgidx = 0; 275 chgidx = 0;
233 for (i = 0; i < old_nr; i++) { 276 for (i = 0; i < old_nr; i++) {
234 if (map[i].size != 0) { 277 if (map[i].size != 0) {
235 change_point[chgidx]->addr = map[i].addr; 278 change_point[chgidx]->addr = map[i].addr;
236 change_point[chgidx++]->pentry = &map[i]; 279 change_point[chgidx++]->pentry = &map[i];
@@ -238,13 +281,13 @@ static int __init sanitize_memmap(struct bfin_memmap_entry *map, int *pnr_map)
238 change_point[chgidx++]->pentry = &map[i]; 281 change_point[chgidx++]->pentry = &map[i];
239 } 282 }
240 } 283 }
241 chg_nr = chgidx; /* true number of change-points */ 284 chg_nr = chgidx; /* true number of change-points */
242 285
243 /* sort change-point list by memory addresses (low -> high) */ 286 /* sort change-point list by memory addresses (low -> high) */
244 still_changing = 1; 287 still_changing = 1;
245 while (still_changing) { 288 while (still_changing) {
246 still_changing = 0; 289 still_changing = 0;
247 for (i = 1; i < chg_nr; i++) { 290 for (i = 1; i < chg_nr; i++) {
248 /* if <current_addr> > <last_addr>, swap */ 291 /* if <current_addr> > <last_addr>, swap */
249 /* or, if current=<start_addr> & last=<end_addr>, swap */ 292 /* or, if current=<start_addr> & last=<end_addr>, swap */
250 if ((change_point[i]->addr < change_point[i-1]->addr) || 293 if ((change_point[i]->addr < change_point[i-1]->addr) ||
@@ -261,10 +304,10 @@ static int __init sanitize_memmap(struct bfin_memmap_entry *map, int *pnr_map)
261 } 304 }
262 305
263 /* create a new memmap, removing overlaps */ 306 /* create a new memmap, removing overlaps */
264 overlap_entries = 0; /* number of entries in the overlap table */ 307 overlap_entries = 0; /* number of entries in the overlap table */
265 new_entry = 0; /* index for creating new memmap entries */ 308 new_entry = 0; /* index for creating new memmap entries */
266 last_type = 0; /* start with undefined memory type */ 309 last_type = 0; /* start with undefined memory type */
267 last_addr = 0; /* start with 0 as last starting address */ 310 last_addr = 0; /* start with 0 as last starting address */
268 /* loop through change-points, determining affect on the new memmap */ 311 /* loop through change-points, determining affect on the new memmap */
269 for (chgidx = 0; chgidx < chg_nr; chgidx++) { 312 for (chgidx = 0; chgidx < chg_nr; chgidx++) {
270 /* keep track of all overlapping memmap entries */ 313 /* keep track of all overlapping memmap entries */
@@ -286,14 +329,14 @@ static int __init sanitize_memmap(struct bfin_memmap_entry *map, int *pnr_map)
286 if (overlap_list[i]->type > current_type) 329 if (overlap_list[i]->type > current_type)
287 current_type = overlap_list[i]->type; 330 current_type = overlap_list[i]->type;
288 /* continue building up new memmap based on this information */ 331 /* continue building up new memmap based on this information */
289 if (current_type != last_type) { 332 if (current_type != last_type) {
290 if (last_type != 0) { 333 if (last_type != 0) {
291 new_map[new_entry].size = 334 new_map[new_entry].size =
292 change_point[chgidx]->addr - last_addr; 335 change_point[chgidx]->addr - last_addr;
293 /* move forward only if the new size was non-zero */ 336 /* move forward only if the new size was non-zero */
294 if (new_map[new_entry].size != 0) 337 if (new_map[new_entry].size != 0)
295 if (++new_entry >= BFIN_MEMMAP_MAX) 338 if (++new_entry >= BFIN_MEMMAP_MAX)
296 break; /* no more space left for new entries */ 339 break; /* no more space left for new entries */
297 } 340 }
298 if (current_type != 0) { 341 if (current_type != 0) {
299 new_map[new_entry].addr = change_point[chgidx]->addr; 342 new_map[new_entry].addr = change_point[chgidx]->addr;
@@ -303,9 +346,9 @@ static int __init sanitize_memmap(struct bfin_memmap_entry *map, int *pnr_map)
303 last_type = current_type; 346 last_type = current_type;
304 } 347 }
305 } 348 }
306 new_nr = new_entry; /* retain count for new entries */ 349 new_nr = new_entry; /* retain count for new entries */
307 350
308 /* copy new mapping into original location */ 351 /* copy new mapping into original location */
309 memcpy(map, new_map, new_nr*sizeof(struct bfin_memmap_entry)); 352 memcpy(map, new_map, new_nr*sizeof(struct bfin_memmap_entry));
310 *pnr_map = new_nr; 353 *pnr_map = new_nr;
311 354
@@ -361,7 +404,6 @@ static __init int parse_memmap(char *arg)
361 * - "memmap=XXX[KkmM][@][$]XXX[KkmM]" defines a memory region 404 * - "memmap=XXX[KkmM][@][$]XXX[KkmM]" defines a memory region
362 * @ from <start> to <start>+<mem>, type RAM 405 * @ from <start> to <start>+<mem>, type RAM
363 * $ from <start> to <start>+<mem>, type RESERVED 406 * $ from <start> to <start>+<mem>, type RESERVED
364 *
365 */ 407 */
366static __init void parse_cmdline_early(char *cmdline_p) 408static __init void parse_cmdline_early(char *cmdline_p)
367{ 409{
@@ -383,14 +425,15 @@ static __init void parse_cmdline_early(char *cmdline_p)
383 if (*to != ' ') { 425 if (*to != ' ') {
384 if (*to == '$' 426 if (*to == '$'
385 || *(to + 1) == '$') 427 || *(to + 1) == '$')
386 reserved_mem_dcache_on = 428 reserved_mem_dcache_on = 1;
387 1;
388 if (*to == '#' 429 if (*to == '#'
389 || *(to + 1) == '#') 430 || *(to + 1) == '#')
390 reserved_mem_icache_on = 431 reserved_mem_icache_on = 1;
391 1;
392 } 432 }
393 } 433 }
434 } else if (!memcmp(to, "clkin_hz=", 9)) {
435 to += 9;
436 early_init_clkin_hz(to);
394 } else if (!memcmp(to, "earlyprintk=", 12)) { 437 } else if (!memcmp(to, "earlyprintk=", 12)) {
395 to += 12; 438 to += 12;
396 setup_early_printk(to); 439 setup_early_printk(to);
@@ -417,9 +460,8 @@ static __init void parse_cmdline_early(char *cmdline_p)
417 * [_ramend - DMA_UNCACHED_REGION, 460 * [_ramend - DMA_UNCACHED_REGION,
418 * _ramend]: uncached DMA region 461 * _ramend]: uncached DMA region
419 * [_ramend, physical_mem_end]: memory not managed by kernel 462 * [_ramend, physical_mem_end]: memory not managed by kernel
420 *
421 */ 463 */
422static __init void memory_setup(void) 464static __init void memory_setup(void)
423{ 465{
424#ifdef CONFIG_MTD_UCLINUX 466#ifdef CONFIG_MTD_UCLINUX
425 unsigned long mtd_phys = 0; 467 unsigned long mtd_phys = 0;
@@ -436,7 +478,7 @@ static __init void memory_setup(void)
436 memory_end = _ramend - DMA_UNCACHED_REGION; 478 memory_end = _ramend - DMA_UNCACHED_REGION;
437 479
438#ifdef CONFIG_MPU 480#ifdef CONFIG_MPU
439 /* Round up to multiple of 4MB. */ 481 /* Round up to multiple of 4MB */
440 memory_start = (_ramstart + 0x3fffff) & ~0x3fffff; 482 memory_start = (_ramstart + 0x3fffff) & ~0x3fffff;
441#else 483#else
442 memory_start = PAGE_ALIGN(_ramstart); 484 memory_start = PAGE_ALIGN(_ramstart);
@@ -616,7 +658,7 @@ static __init void setup_bootmem_allocator(void)
616 end_pfn = memory_end >> PAGE_SHIFT; 658 end_pfn = memory_end >> PAGE_SHIFT;
617 659
618 /* 660 /*
619 * give all the memory to the bootmap allocator, tell it to put the 661 * give all the memory to the bootmap allocator, tell it to put the
620 * boot mem_map at the start of memory. 662 * boot mem_map at the start of memory.
621 */ 663 */
622 bootmap_size = init_bootmem_node(NODE_DATA(0), 664 bootmap_size = init_bootmem_node(NODE_DATA(0),
@@ -791,7 +833,11 @@ void __init setup_arch(char **cmdline_p)
791 bfin_write_SWRST(_bfin_swrst | DOUBLE_FAULT); 833 bfin_write_SWRST(_bfin_swrst | DOUBLE_FAULT);
792#endif 834#endif
793 835
836#ifdef CONFIG_SMP
837 if (_bfin_swrst & SWRST_DBL_FAULT_A) {
838#else
794 if (_bfin_swrst & RESET_DOUBLE) { 839 if (_bfin_swrst & RESET_DOUBLE) {
840#endif
795 printk(KERN_EMERG "Recovering from DOUBLE FAULT event\n"); 841 printk(KERN_EMERG "Recovering from DOUBLE FAULT event\n");
796#ifdef CONFIG_DEBUG_DOUBLEFAULT 842#ifdef CONFIG_DEBUG_DOUBLEFAULT
797 /* We assume the crashing kernel, and the current symbol table match */ 843 /* We assume the crashing kernel, and the current symbol table match */
@@ -823,9 +869,12 @@ void __init setup_arch(char **cmdline_p)
823 if (bfin_compiled_revid() == -1) 869 if (bfin_compiled_revid() == -1)
824 printk(KERN_ERR "Warning: Compiled for Rev none, but running on Rev %d\n", 870 printk(KERN_ERR "Warning: Compiled for Rev none, but running on Rev %d\n",
825 bfin_revid()); 871 bfin_revid());
826 else if (bfin_compiled_revid() != 0xffff) 872 else if (bfin_compiled_revid() != 0xffff) {
827 printk(KERN_ERR "Warning: Compiled for Rev %d, but running on Rev %d\n", 873 printk(KERN_ERR "Warning: Compiled for Rev %d, but running on Rev %d\n",
828 bfin_compiled_revid(), bfin_revid()); 874 bfin_compiled_revid(), bfin_revid());
875 if (bfin_compiled_revid() > bfin_revid())
876 panic("Error: you are missing anomaly workarounds for this rev\n");
877 }
829 } 878 }
830 if (bfin_revid() < CONFIG_BF_REV_MIN || bfin_revid() > CONFIG_BF_REV_MAX) 879 if (bfin_revid() < CONFIG_BF_REV_MIN || bfin_revid() > CONFIG_BF_REV_MAX)
831 printk(KERN_ERR "Warning: Unsupported Chip Revision ADSP-%s Rev 0.%d detected\n", 880 printk(KERN_ERR "Warning: Unsupported Chip Revision ADSP-%s Rev 0.%d detected\n",
@@ -835,7 +884,7 @@ void __init setup_arch(char **cmdline_p)
835 printk(KERN_INFO "Blackfin Linux support by http://blackfin.uclinux.org/\n"); 884 printk(KERN_INFO "Blackfin Linux support by http://blackfin.uclinux.org/\n");
836 885
837 printk(KERN_INFO "Processor Speed: %lu MHz core clock and %lu MHz System Clock\n", 886 printk(KERN_INFO "Processor Speed: %lu MHz core clock and %lu MHz System Clock\n",
838 cclk / 1000000, sclk / 1000000); 887 cclk / 1000000, sclk / 1000000);
839 888
840 if (ANOMALY_05000273 && (cclk >> 1) <= sclk) 889 if (ANOMALY_05000273 && (cclk >> 1) <= sclk)
841 printk("\n\n\nANOMALY_05000273: CCLK must be >= 2*SCLK !!!\n\n\n"); 890 printk("\n\n\nANOMALY_05000273: CCLK must be >= 2*SCLK !!!\n\n\n");
@@ -867,18 +916,21 @@ void __init setup_arch(char **cmdline_p)
867 BUG_ON((char *)&safe_user_instruction - (char *)&fixed_code_start 916 BUG_ON((char *)&safe_user_instruction - (char *)&fixed_code_start
868 != SAFE_USER_INSTRUCTION - FIXED_CODE_START); 917 != SAFE_USER_INSTRUCTION - FIXED_CODE_START);
869 918
919#ifdef CONFIG_SMP
920 platform_init_cpus();
921#endif
870 init_exception_vectors(); 922 init_exception_vectors();
871 bfin_cache_init(); 923 bfin_cache_init(); /* Initialize caches for the boot CPU */
872} 924}
873 925
874static int __init topology_init(void) 926static int __init topology_init(void)
875{ 927{
876 int cpu; 928 unsigned int cpu;
929 /* Record CPU-private information for the boot processor. */
930 bfin_setup_cpudata(0);
877 931
878 for_each_possible_cpu(cpu) { 932 for_each_possible_cpu(cpu) {
879 struct cpu *c = &per_cpu(cpu_devices, cpu); 933 register_cpu(&per_cpu(cpu_data, cpu).cpu, cpu);
880
881 register_cpu(c, cpu);
882 } 934 }
883 935
884 return 0; 936 return 0;
@@ -886,36 +938,54 @@ static int __init topology_init(void)
886 938
887subsys_initcall(topology_init); 939subsys_initcall(topology_init);
888 940
941/* Get the input clock frequency */
942static u_long cached_clkin_hz = CONFIG_CLKIN_HZ;
943static u_long get_clkin_hz(void)
944{
945 return cached_clkin_hz;
946}
947static int __init early_init_clkin_hz(char *buf)
948{
949 cached_clkin_hz = simple_strtoul(buf, NULL, 0);
950#ifdef BFIN_KERNEL_CLOCK
951 if (cached_clkin_hz != CONFIG_CLKIN_HZ)
952 panic("cannot change clkin_hz when reprogramming clocks");
953#endif
954 return 1;
955}
956early_param("clkin_hz=", early_init_clkin_hz);
957
889/* Get the voltage input multiplier */ 958/* Get the voltage input multiplier */
890static u_long cached_vco_pll_ctl, cached_vco;
891static u_long get_vco(void) 959static u_long get_vco(void)
892{ 960{
893 u_long msel; 961 static u_long cached_vco;
962 u_long msel, pll_ctl;
894 963
895 u_long pll_ctl = bfin_read_PLL_CTL(); 964 /* The assumption here is that VCO never changes at runtime.
896 if (pll_ctl == cached_vco_pll_ctl) 965 * If, someday, we support that, then we'll have to change this.
966 */
967 if (cached_vco)
897 return cached_vco; 968 return cached_vco;
898 else
899 cached_vco_pll_ctl = pll_ctl;
900 969
970 pll_ctl = bfin_read_PLL_CTL();
901 msel = (pll_ctl >> 9) & 0x3F; 971 msel = (pll_ctl >> 9) & 0x3F;
902 if (0 == msel) 972 if (0 == msel)
903 msel = 64; 973 msel = 64;
904 974
905 cached_vco = CONFIG_CLKIN_HZ; 975 cached_vco = get_clkin_hz();
906 cached_vco >>= (1 & pll_ctl); /* DF bit */ 976 cached_vco >>= (1 & pll_ctl); /* DF bit */
907 cached_vco *= msel; 977 cached_vco *= msel;
908 return cached_vco; 978 return cached_vco;
909} 979}
910 980
911/* Get the Core clock */ 981/* Get the Core clock */
912static u_long cached_cclk_pll_div, cached_cclk;
913u_long get_cclk(void) 982u_long get_cclk(void)
914{ 983{
984 static u_long cached_cclk_pll_div, cached_cclk;
915 u_long csel, ssel; 985 u_long csel, ssel;
916 986
917 if (bfin_read_PLL_STAT() & 0x1) 987 if (bfin_read_PLL_STAT() & 0x1)
918 return CONFIG_CLKIN_HZ; 988 return get_clkin_hz();
919 989
920 ssel = bfin_read_PLL_DIV(); 990 ssel = bfin_read_PLL_DIV();
921 if (ssel == cached_cclk_pll_div) 991 if (ssel == cached_cclk_pll_div)
@@ -934,21 +1004,21 @@ u_long get_cclk(void)
934EXPORT_SYMBOL(get_cclk); 1004EXPORT_SYMBOL(get_cclk);
935 1005
936/* Get the System clock */ 1006/* Get the System clock */
937static u_long cached_sclk_pll_div, cached_sclk;
938u_long get_sclk(void) 1007u_long get_sclk(void)
939{ 1008{
1009 static u_long cached_sclk;
940 u_long ssel; 1010 u_long ssel;
941 1011
942 if (bfin_read_PLL_STAT() & 0x1) 1012 /* The assumption here is that SCLK never changes at runtime.
943 return CONFIG_CLKIN_HZ; 1013 * If, someday, we support that, then we'll have to change this.
944 1014 */
945 ssel = bfin_read_PLL_DIV(); 1015 if (cached_sclk)
946 if (ssel == cached_sclk_pll_div)
947 return cached_sclk; 1016 return cached_sclk;
948 else
949 cached_sclk_pll_div = ssel;
950 1017
951 ssel &= 0xf; 1018 if (bfin_read_PLL_STAT() & 0x1)
1019 return get_clkin_hz();
1020
1021 ssel = bfin_read_PLL_DIV() & 0xf;
952 if (0 == ssel) { 1022 if (0 == ssel) {
953 printk(KERN_WARNING "Invalid System Clock\n"); 1023 printk(KERN_WARNING "Invalid System Clock\n");
954 ssel = 1; 1024 ssel = 1;
@@ -982,17 +1052,18 @@ static int show_cpuinfo(struct seq_file *m, void *v)
982{ 1052{
983 char *cpu, *mmu, *fpu, *vendor, *cache; 1053 char *cpu, *mmu, *fpu, *vendor, *cache;
984 uint32_t revid; 1054 uint32_t revid;
985 1055 int cpu_num = *(unsigned int *)v;
986 u_long cclk = 0, sclk = 0; 1056 u_long sclk, cclk;
987 u_int icache_size = BFIN_ICACHESIZE / 1024, dcache_size = 0, dsup_banks = 0; 1057 u_int icache_size = BFIN_ICACHESIZE / 1024, dcache_size = 0, dsup_banks = 0;
1058 struct blackfin_cpudata *cpudata = &per_cpu(cpu_data, cpu_num);
988 1059
989 cpu = CPU; 1060 cpu = CPU;
990 mmu = "none"; 1061 mmu = "none";
991 fpu = "none"; 1062 fpu = "none";
992 revid = bfin_revid(); 1063 revid = bfin_revid();
993 1064
994 cclk = get_cclk();
995 sclk = get_sclk(); 1065 sclk = get_sclk();
1066 cclk = get_cclk();
996 1067
997 switch (bfin_read_CHIPID() & CHIPID_MANUFACTURE) { 1068 switch (bfin_read_CHIPID() & CHIPID_MANUFACTURE) {
998 case 0xca: 1069 case 0xca:
@@ -1003,10 +1074,7 @@ static int show_cpuinfo(struct seq_file *m, void *v)
1003 break; 1074 break;
1004 } 1075 }
1005 1076
1006 seq_printf(m, "processor\t: %d\n" 1077 seq_printf(m, "processor\t: %d\n" "vendor_id\t: %s\n", cpu_num, vendor);
1007 "vendor_id\t: %s\n",
1008 *(unsigned int *)v,
1009 vendor);
1010 1078
1011 if (CPUID == bfin_cpuid()) 1079 if (CPUID == bfin_cpuid())
1012 seq_printf(m, "cpu family\t: 0x%04x\n", CPUID); 1080 seq_printf(m, "cpu family\t: 0x%04x\n", CPUID);
@@ -1029,12 +1097,12 @@ static int show_cpuinfo(struct seq_file *m, void *v)
1029 sclk/1000000, sclk%1000000); 1097 sclk/1000000, sclk%1000000);
1030 seq_printf(m, "bogomips\t: %lu.%02lu\n" 1098 seq_printf(m, "bogomips\t: %lu.%02lu\n"
1031 "Calibration\t: %lu loops\n", 1099 "Calibration\t: %lu loops\n",
1032 (loops_per_jiffy * HZ) / 500000, 1100 (cpudata->loops_per_jiffy * HZ) / 500000,
1033 ((loops_per_jiffy * HZ) / 5000) % 100, 1101 ((cpudata->loops_per_jiffy * HZ) / 5000) % 100,
1034 (loops_per_jiffy * HZ)); 1102 (cpudata->loops_per_jiffy * HZ));
1035 1103
1036 /* Check Cache configutation */ 1104 /* Check Cache configutation */
1037 switch (bfin_read_DMEM_CONTROL() & (1 << DMC0_P | 1 << DMC1_P)) { 1105 switch (cpudata->dmemctl & (1 << DMC0_P | 1 << DMC1_P)) {
1038 case ACACHE_BSRAM: 1106 case ACACHE_BSRAM:
1039 cache = "dbank-A/B\t: cache/sram"; 1107 cache = "dbank-A/B\t: cache/sram";
1040 dcache_size = 16; 1108 dcache_size = 16;
@@ -1058,10 +1126,10 @@ static int show_cpuinfo(struct seq_file *m, void *v)
1058 } 1126 }
1059 1127
1060 /* Is it turned on? */ 1128 /* Is it turned on? */
1061 if ((bfin_read_DMEM_CONTROL() & (ENDCPLB | DMC_ENABLE)) != (ENDCPLB | DMC_ENABLE)) 1129 if ((cpudata->dmemctl & (ENDCPLB | DMC_ENABLE)) != (ENDCPLB | DMC_ENABLE))
1062 dcache_size = 0; 1130 dcache_size = 0;
1063 1131
1064 if ((bfin_read_IMEM_CONTROL() & (IMC | ENICPLB)) != (IMC | ENICPLB)) 1132 if ((cpudata->imemctl & (IMC | ENICPLB)) != (IMC | ENICPLB))
1065 icache_size = 0; 1133 icache_size = 0;
1066 1134
1067 seq_printf(m, "cache size\t: %d KB(L1 icache) " 1135 seq_printf(m, "cache size\t: %d KB(L1 icache) "
@@ -1086,8 +1154,11 @@ static int show_cpuinfo(struct seq_file *m, void *v)
1086 "dcache setup\t: %d Super-banks/%d Sub-banks/%d Ways, %d Lines/Way\n", 1154 "dcache setup\t: %d Super-banks/%d Sub-banks/%d Ways, %d Lines/Way\n",
1087 dsup_banks, BFIN_DSUBBANKS, BFIN_DWAYS, 1155 dsup_banks, BFIN_DSUBBANKS, BFIN_DWAYS,
1088 BFIN_DLINES); 1156 BFIN_DLINES);
1157#ifdef __ARCH_SYNC_CORE_DCACHE
1158 seq_printf(m, "SMP Dcache Flushes\t: %lu\n\n", cpudata->dcache_invld_count);
1159#endif
1089#ifdef CONFIG_BFIN_ICACHE_LOCK 1160#ifdef CONFIG_BFIN_ICACHE_LOCK
1090 switch ((bfin_read_IMEM_CONTROL() >> 3) & WAYALL_L) { 1161 switch ((cpudata->imemctl >> 3) & WAYALL_L) {
1091 case WAY0_L: 1162 case WAY0_L:
1092 seq_printf(m, "Way0 Locked-Down\n"); 1163 seq_printf(m, "Way0 Locked-Down\n");
1093 break; 1164 break;
@@ -1137,6 +1208,12 @@ static int show_cpuinfo(struct seq_file *m, void *v)
1137 seq_printf(m, "No Ways are locked\n"); 1208 seq_printf(m, "No Ways are locked\n");
1138 } 1209 }
1139#endif 1210#endif
1211
1212 if (cpu_num != num_possible_cpus() - 1)
1213 return 0;
1214
1215 if (L2_LENGTH)
1216 seq_printf(m, "L2 SRAM\t\t: %dKB\n", L2_LENGTH/0x400);
1140 seq_printf(m, "board name\t: %s\n", bfin_board_name); 1217 seq_printf(m, "board name\t: %s\n", bfin_board_name);
1141 seq_printf(m, "board memory\t: %ld kB (0x%p -> 0x%p)\n", 1218 seq_printf(m, "board memory\t: %ld kB (0x%p -> 0x%p)\n",
1142 physical_mem_end >> 10, (void *)0, (void *)physical_mem_end); 1219 physical_mem_end >> 10, (void *)0, (void *)physical_mem_end);
@@ -1144,6 +1221,7 @@ static int show_cpuinfo(struct seq_file *m, void *v)
1144 ((int)memory_end - (int)_stext) >> 10, 1221 ((int)memory_end - (int)_stext) >> 10,
1145 _stext, 1222 _stext,
1146 (void *)memory_end); 1223 (void *)memory_end);
1224 seq_printf(m, "\n");
1147 1225
1148 return 0; 1226 return 0;
1149} 1227}
diff --git a/arch/blackfin/kernel/time.c b/arch/blackfin/kernel/time.c
index eb2352320454..172b4c588467 100644
--- a/arch/blackfin/kernel/time.c
+++ b/arch/blackfin/kernel/time.c
@@ -1,32 +1,11 @@
1/* 1/*
2 * File: arch/blackfin/kernel/time.c 2 * arch/blackfin/kernel/time.c
3 * Based on: none - original work
4 * Author:
5 * 3 *
6 * Created: 4 * This file contains the Blackfin-specific time handling details.
7 * Description: This file contains the bfin-specific time handling details. 5 * Most of the stuff is located in the machine specific files.
8 * Most of the stuff is located in the machine specific files.
9 * FIXME: (This file is subject for removal)
10 * 6 *
11 * Modified: 7 * Copyright 2004-2008 Analog Devices Inc.
12 * Copyright 2004-2008 Analog Devices Inc. 8 * Licensed under the GPL-2 or later.
13 *
14 * Bugs: Enter bugs at http://blackfin.uclinux.org/
15 *
16 * This program is free software; you can redistribute it and/or modify
17 * it under the terms of the GNU General Public License as published by
18 * the Free Software Foundation; either version 2 of the License, or
19 * (at your option) any later version.
20 *
21 * This program is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 * GNU General Public License for more details.
25 *
26 * You should have received a copy of the GNU General Public License
27 * along with this program; if not, see the file COPYING, or write
28 * to the Free Software Foundation, Inc.,
29 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
30 */ 9 */
31 10
32#include <linux/module.h> 11#include <linux/module.h>
@@ -34,23 +13,43 @@
34#include <linux/interrupt.h> 13#include <linux/interrupt.h>
35#include <linux/time.h> 14#include <linux/time.h>
36#include <linux/irq.h> 15#include <linux/irq.h>
16#include <linux/delay.h>
37 17
38#include <asm/blackfin.h> 18#include <asm/blackfin.h>
39#include <asm/time.h> 19#include <asm/time.h>
20#include <asm/gptimers.h>
40 21
41/* This is an NTP setting */ 22/* This is an NTP setting */
42#define TICK_SIZE (tick_nsec / 1000) 23#define TICK_SIZE (tick_nsec / 1000)
43 24
44static void time_sched_init(irq_handler_t timer_routine);
45static unsigned long gettimeoffset(void);
46
47static struct irqaction bfin_timer_irq = { 25static struct irqaction bfin_timer_irq = {
48 .name = "BFIN Timer Tick", 26 .name = "Blackfin Timer Tick",
27#ifdef CONFIG_IRQ_PER_CPU
28 .flags = IRQF_DISABLED | IRQF_PERCPU,
29#else
49 .flags = IRQF_DISABLED 30 .flags = IRQF_DISABLED
31#endif
50}; 32};
51 33
52static void 34#if defined(CONFIG_TICK_SOURCE_SYSTMR0) || defined(CONFIG_IPIPE)
53time_sched_init(irq_handler_t timer_routine) 35void __init setup_system_timer0(void)
36{
37 /* Power down the core timer, just to play safe. */
38 bfin_write_TCNTL(0);
39
40 disable_gptimers(TIMER0bit);
41 set_gptimer_status(0, TIMER_STATUS_TRUN0);
42 while (get_gptimer_status(0) & TIMER_STATUS_TRUN0)
43 udelay(10);
44
45 set_gptimer_config(0, 0x59); /* IRQ enable, periodic, PWM_OUT, SCLKed, OUT PAD disabled */
46 set_gptimer_period(TIMER0_id, get_sclk() / HZ);
47 set_gptimer_pwidth(TIMER0_id, 1);
48 SSYNC();
49 enable_gptimers(TIMER0bit);
50}
51#else
52void __init setup_core_timer(void)
54{ 53{
55 u32 tcount; 54 u32 tcount;
56 55
@@ -58,10 +57,8 @@ time_sched_init(irq_handler_t timer_routine)
58 bfin_write_TCNTL(1); 57 bfin_write_TCNTL(1);
59 CSYNC(); 58 CSYNC();
60 59
61 /* 60 /* the TSCALE prescaler counter */
62 * the TSCALE prescaler counter. 61 bfin_write_TSCALE(TIME_SCALE - 1);
63 */
64 bfin_write_TSCALE((TIME_SCALE - 1));
65 62
66 tcount = ((get_cclk() / (HZ * TIME_SCALE)) - 1); 63 tcount = ((get_cclk() / (HZ * TIME_SCALE)) - 1);
67 bfin_write_TPERIOD(tcount); 64 bfin_write_TPERIOD(tcount);
@@ -71,35 +68,52 @@ time_sched_init(irq_handler_t timer_routine)
71 CSYNC(); 68 CSYNC();
72 69
73 bfin_write_TCNTL(7); 70 bfin_write_TCNTL(7);
71}
72#endif
74 73
75 bfin_timer_irq.handler = (irq_handler_t)timer_routine; 74static void __init
76 /* call setup_irq instead of request_irq because request_irq calls 75time_sched_init(irqreturn_t(*timer_routine) (int, void *))
77 * kmalloc which has not been initialized yet 76{
78 */ 77#if defined(CONFIG_TICK_SOURCE_SYSTMR0) || defined(CONFIG_IPIPE)
78 setup_system_timer0();
79 bfin_timer_irq.handler = timer_routine;
80 setup_irq(IRQ_TIMER0, &bfin_timer_irq);
81#else
82 setup_core_timer();
83 bfin_timer_irq.handler = timer_routine;
79 setup_irq(IRQ_CORETMR, &bfin_timer_irq); 84 setup_irq(IRQ_CORETMR, &bfin_timer_irq);
85#endif
80} 86}
81 87
82/* 88/*
83 * Should return useconds since last timer tick 89 * Should return useconds since last timer tick
84 */ 90 */
91#ifndef CONFIG_GENERIC_TIME
85static unsigned long gettimeoffset(void) 92static unsigned long gettimeoffset(void)
86{ 93{
87 unsigned long offset; 94 unsigned long offset;
88 unsigned long clocks_per_jiffy; 95 unsigned long clocks_per_jiffy;
89 96
97#if defined(CONFIG_TICK_SOURCE_SYSTMR0) || defined(CONFIG_IPIPE)
98 clocks_per_jiffy = bfin_read_TIMER0_PERIOD();
99 offset = bfin_read_TIMER0_COUNTER() / \
100 (((clocks_per_jiffy + 1) * HZ) / USEC_PER_SEC);
101
102 if ((get_gptimer_status(0) & TIMER_STATUS_TIMIL0) && offset < (100000 / HZ / 2))
103 offset += (USEC_PER_SEC / HZ);
104#else
90 clocks_per_jiffy = bfin_read_TPERIOD(); 105 clocks_per_jiffy = bfin_read_TPERIOD();
91 offset = 106 offset = (clocks_per_jiffy - bfin_read_TCOUNT()) / \
92 (clocks_per_jiffy - 107 (((clocks_per_jiffy + 1) * HZ) / USEC_PER_SEC);
93 bfin_read_TCOUNT()) / (((clocks_per_jiffy + 1) * HZ) /
94 USEC_PER_SEC);
95 108
96 /* Check if we just wrapped the counters and maybe missed a tick */ 109 /* Check if we just wrapped the counters and maybe missed a tick */
97 if ((bfin_read_ILAT() & (1 << IRQ_CORETMR)) 110 if ((bfin_read_ILAT() & (1 << IRQ_CORETMR))
98 && (offset < (100000 / HZ / 2))) 111 && (offset < (100000 / HZ / 2)))
99 offset += (USEC_PER_SEC / HZ); 112 offset += (USEC_PER_SEC / HZ);
100 113#endif
101 return offset; 114 return offset;
102} 115}
116#endif
103 117
104static inline int set_rtc_mmss(unsigned long nowtime) 118static inline int set_rtc_mmss(unsigned long nowtime)
105{ 119{
@@ -111,43 +125,49 @@ static inline int set_rtc_mmss(unsigned long nowtime)
111 * as well as call the "do_timer()" routine every clocktick 125 * as well as call the "do_timer()" routine every clocktick
112 */ 126 */
113#ifdef CONFIG_CORE_TIMER_IRQ_L1 127#ifdef CONFIG_CORE_TIMER_IRQ_L1
114irqreturn_t timer_interrupt(int irq, void *dummy)__attribute__((l1_text)); 128__attribute__((l1_text))
115#endif 129#endif
116
117irqreturn_t timer_interrupt(int irq, void *dummy) 130irqreturn_t timer_interrupt(int irq, void *dummy)
118{ 131{
119 /* last time the cmos clock got updated */ 132 /* last time the cmos clock got updated */
120 static long last_rtc_update; 133 static long last_rtc_update;
121 134
122 write_seqlock(&xtime_lock); 135 write_seqlock(&xtime_lock);
123 136#if defined(CONFIG_TICK_SOURCE_SYSTMR0) && !defined(CONFIG_IPIPE)
124 do_timer(1); 137/* FIXME: Here TIMIL0 is not set when IPIPE enabled, why? */
125 138 if (get_gptimer_status(0) & TIMER_STATUS_TIMIL0) {
126 profile_tick(CPU_PROFILING); 139#endif
127 140 do_timer(1);
128 /* 141
129 * If we have an externally synchronized Linux clock, then update 142 /*
130 * CMOS clock accordingly every ~11 minutes. Set_rtc_mmss() has to be 143 * If we have an externally synchronized Linux clock, then update
131 * called as close as possible to 500 ms before the new second starts. 144 * CMOS clock accordingly every ~11 minutes. Set_rtc_mmss() has to be
132 */ 145 * called as close as possible to 500 ms before the new second starts.
133 146 */
134 if (ntp_synced() && 147 if (ntp_synced() &&
135 xtime.tv_sec > last_rtc_update + 660 && 148 xtime.tv_sec > last_rtc_update + 660 &&
136 (xtime.tv_nsec / NSEC_PER_USEC) >= 149 (xtime.tv_nsec / NSEC_PER_USEC) >=
137 500000 - ((unsigned)TICK_SIZE) / 2 150 500000 - ((unsigned)TICK_SIZE) / 2
138 && (xtime.tv_nsec / NSEC_PER_USEC) <= 151 && (xtime.tv_nsec / NSEC_PER_USEC) <=
139 500000 + ((unsigned)TICK_SIZE) / 2) { 152 500000 + ((unsigned)TICK_SIZE) / 2) {
140 if (set_rtc_mmss(xtime.tv_sec) == 0) 153 if (set_rtc_mmss(xtime.tv_sec) == 0)
141 last_rtc_update = xtime.tv_sec; 154 last_rtc_update = xtime.tv_sec;
142 else 155 else
143 /* Do it again in 60s. */ 156 /* Do it again in 60s. */
144 last_rtc_update = xtime.tv_sec - 600; 157 last_rtc_update = xtime.tv_sec - 600;
158 }
159#if defined(CONFIG_TICK_SOURCE_SYSTMR0) && !defined(CONFIG_IPIPE)
160 set_gptimer_status(0, TIMER_STATUS_TIMIL0);
145 } 161 }
162#endif
146 write_sequnlock(&xtime_lock); 163 write_sequnlock(&xtime_lock);
147 164
148#ifndef CONFIG_SMP 165#ifdef CONFIG_IPIPE
166 update_root_process_times(get_irq_regs());
167#else
149 update_process_times(user_mode(get_irq_regs())); 168 update_process_times(user_mode(get_irq_regs()));
150#endif 169#endif
170 profile_tick(CPU_PROFILING);
151 171
152 return IRQ_HANDLED; 172 return IRQ_HANDLED;
153} 173}
diff --git a/arch/blackfin/kernel/traps.c b/arch/blackfin/kernel/traps.c
index bef025b07443..17d8e4172896 100644
--- a/arch/blackfin/kernel/traps.c
+++ b/arch/blackfin/kernel/traps.c
@@ -75,16 +75,6 @@ void __init trap_init(void)
75 CSYNC(); 75 CSYNC();
76} 76}
77 77
78/*
79 * Used to save the RETX, SEQSTAT, I/D CPLB FAULT ADDR
80 * values across the transition from exception to IRQ5.
81 * We put these in L1, so they are going to be in a valid
82 * location during exception context
83 */
84__attribute__((l1_data))
85unsigned long saved_retx, saved_seqstat,
86 saved_icplb_fault_addr, saved_dcplb_fault_addr;
87
88static void decode_address(char *buf, unsigned long address) 78static void decode_address(char *buf, unsigned long address)
89{ 79{
90#ifdef CONFIG_DEBUG_VERBOSE 80#ifdef CONFIG_DEBUG_VERBOSE
@@ -211,18 +201,18 @@ asmlinkage void double_fault_c(struct pt_regs *fp)
211 printk(KERN_EMERG "\n" KERN_EMERG "Double Fault\n"); 201 printk(KERN_EMERG "\n" KERN_EMERG "Double Fault\n");
212#ifdef CONFIG_DEBUG_DOUBLEFAULT_PRINT 202#ifdef CONFIG_DEBUG_DOUBLEFAULT_PRINT
213 if (((long)fp->seqstat & SEQSTAT_EXCAUSE) == VEC_UNCOV) { 203 if (((long)fp->seqstat & SEQSTAT_EXCAUSE) == VEC_UNCOV) {
204 unsigned int cpu = smp_processor_id();
214 char buf[150]; 205 char buf[150];
215 decode_address(buf, saved_retx); 206 decode_address(buf, cpu_pda[cpu].retx);
216 printk(KERN_EMERG "While handling exception (EXCAUSE = 0x%x) at %s:\n", 207 printk(KERN_EMERG "While handling exception (EXCAUSE = 0x%x) at %s:\n",
217 (int)saved_seqstat & SEQSTAT_EXCAUSE, buf); 208 (unsigned int)cpu_pda[cpu].seqstat & SEQSTAT_EXCAUSE, buf);
218 decode_address(buf, saved_dcplb_fault_addr); 209 decode_address(buf, cpu_pda[cpu].dcplb_fault_addr);
219 printk(KERN_NOTICE " DCPLB_FAULT_ADDR: %s\n", buf); 210 printk(KERN_NOTICE " DCPLB_FAULT_ADDR: %s\n", buf);
220 decode_address(buf, saved_icplb_fault_addr); 211 decode_address(buf, cpu_pda[cpu].icplb_fault_addr);
221 printk(KERN_NOTICE " ICPLB_FAULT_ADDR: %s\n", buf); 212 printk(KERN_NOTICE " ICPLB_FAULT_ADDR: %s\n", buf);
222 213
223 decode_address(buf, fp->retx); 214 decode_address(buf, fp->retx);
224 printk(KERN_NOTICE "The instruction at %s caused a double exception\n", 215 printk(KERN_NOTICE "The instruction at %s caused a double exception\n", buf);
225 buf);
226 } else 216 } else
227#endif 217#endif
228 { 218 {
@@ -240,6 +230,9 @@ asmlinkage void trap_c(struct pt_regs *fp)
240#ifdef CONFIG_DEBUG_BFIN_HWTRACE_ON 230#ifdef CONFIG_DEBUG_BFIN_HWTRACE_ON
241 int j; 231 int j;
242#endif 232#endif
233#ifdef CONFIG_DEBUG_HUNT_FOR_ZERO
234 unsigned int cpu = smp_processor_id();
235#endif
243 int sig = 0; 236 int sig = 0;
244 siginfo_t info; 237 siginfo_t info;
245 unsigned long trapnr = fp->seqstat & SEQSTAT_EXCAUSE; 238 unsigned long trapnr = fp->seqstat & SEQSTAT_EXCAUSE;
@@ -417,7 +410,7 @@ asmlinkage void trap_c(struct pt_regs *fp)
417 info.si_code = ILL_CPLB_MULHIT; 410 info.si_code = ILL_CPLB_MULHIT;
418 sig = SIGSEGV; 411 sig = SIGSEGV;
419#ifdef CONFIG_DEBUG_HUNT_FOR_ZERO 412#ifdef CONFIG_DEBUG_HUNT_FOR_ZERO
420 if (saved_dcplb_fault_addr < FIXED_CODE_START) 413 if (cpu_pda[cpu].dcplb_fault_addr < FIXED_CODE_START)
421 verbose_printk(KERN_NOTICE "NULL pointer access\n"); 414 verbose_printk(KERN_NOTICE "NULL pointer access\n");
422 else 415 else
423#endif 416#endif
@@ -471,7 +464,7 @@ asmlinkage void trap_c(struct pt_regs *fp)
471 info.si_code = ILL_CPLB_MULHIT; 464 info.si_code = ILL_CPLB_MULHIT;
472 sig = SIGSEGV; 465 sig = SIGSEGV;
473#ifdef CONFIG_DEBUG_HUNT_FOR_ZERO 466#ifdef CONFIG_DEBUG_HUNT_FOR_ZERO
474 if (saved_icplb_fault_addr < FIXED_CODE_START) 467 if (cpu_pda[cpu].icplb_fault_addr < FIXED_CODE_START)
475 verbose_printk(KERN_NOTICE "Jump to NULL address\n"); 468 verbose_printk(KERN_NOTICE "Jump to NULL address\n");
476 else 469 else
477#endif 470#endif
@@ -584,10 +577,15 @@ asmlinkage void trap_c(struct pt_regs *fp)
584 } 577 }
585 } 578 }
586 579
587 info.si_signo = sig; 580#ifdef CONFIG_IPIPE
588 info.si_errno = 0; 581 if (!ipipe_trap_notify(fp->seqstat & 0x3f, fp))
589 info.si_addr = (void __user *)fp->pc; 582#endif
590 force_sig_info(sig, &info, current); 583 {
584 info.si_signo = sig;
585 info.si_errno = 0;
586 info.si_addr = (void __user *)fp->pc;
587 force_sig_info(sig, &info, current);
588 }
591 589
592 trace_buffer_restore(j); 590 trace_buffer_restore(j);
593 return; 591 return;
@@ -656,13 +654,13 @@ static bool get_instruction(unsigned short *val, unsigned short *address)
656 return false; 654 return false;
657} 655}
658 656
659/* 657/*
660 * decode the instruction if we are printing out the trace, as it 658 * decode the instruction if we are printing out the trace, as it
661 * makes things easier to follow, without running it through objdump 659 * makes things easier to follow, without running it through objdump
662 * These are the normal instructions which cause change of flow, which 660 * These are the normal instructions which cause change of flow, which
663 * would be at the source of the trace buffer 661 * would be at the source of the trace buffer
664 */ 662 */
665#ifdef CONFIG_DEBUG_VERBOSE 663#if defined(CONFIG_DEBUG_VERBOSE) && defined(CONFIG_DEBUG_BFIN_HWTRACE_ON)
666static void decode_instruction(unsigned short *address) 664static void decode_instruction(unsigned short *address)
667{ 665{
668 unsigned short opcode; 666 unsigned short opcode;
@@ -846,7 +844,7 @@ void show_stack(struct task_struct *task, unsigned long *stack)
846 } 844 }
847 if (fp) { 845 if (fp) {
848 frame = fp; 846 frame = fp;
849 printk(" FP: (0x%p)\n", fp); 847 printk(KERN_NOTICE " FP: (0x%p)\n", fp);
850 } else 848 } else
851 frame = 0; 849 frame = 0;
852 850
@@ -960,6 +958,7 @@ void dump_bfin_process(struct pt_regs *fp)
960 else 958 else
961 verbose_printk(KERN_NOTICE "COMM= invalid\n"); 959 verbose_printk(KERN_NOTICE "COMM= invalid\n");
962 960
961 printk(KERN_NOTICE "CPU = %d\n", current_thread_info()->cpu);
963 if (!((unsigned long)current->mm & 0x3) && (unsigned long)current->mm >= FIXED_CODE_START) 962 if (!((unsigned long)current->mm & 0x3) && (unsigned long)current->mm >= FIXED_CODE_START)
964 verbose_printk(KERN_NOTICE "TEXT = 0x%p-0x%p DATA = 0x%p-0x%p\n" 963 verbose_printk(KERN_NOTICE "TEXT = 0x%p-0x%p DATA = 0x%p-0x%p\n"
965 KERN_NOTICE " BSS = 0x%p-0x%p USER-STACK = 0x%p\n" 964 KERN_NOTICE " BSS = 0x%p-0x%p USER-STACK = 0x%p\n"
@@ -1053,6 +1052,7 @@ void show_regs(struct pt_regs *fp)
1053 struct irqaction *action; 1052 struct irqaction *action;
1054 unsigned int i; 1053 unsigned int i;
1055 unsigned long flags; 1054 unsigned long flags;
1055 unsigned int cpu = smp_processor_id();
1056 1056
1057 verbose_printk(KERN_NOTICE "\n" KERN_NOTICE "SEQUENCER STATUS:\t\t%s\n", print_tainted()); 1057 verbose_printk(KERN_NOTICE "\n" KERN_NOTICE "SEQUENCER STATUS:\t\t%s\n", print_tainted());
1058 verbose_printk(KERN_NOTICE " SEQSTAT: %08lx IPEND: %04lx SYSCFG: %04lx\n", 1058 verbose_printk(KERN_NOTICE " SEQSTAT: %08lx IPEND: %04lx SYSCFG: %04lx\n",
@@ -1112,9 +1112,9 @@ unlock:
1112 1112
1113 if (((long)fp->seqstat & SEQSTAT_EXCAUSE) && 1113 if (((long)fp->seqstat & SEQSTAT_EXCAUSE) &&
1114 (((long)fp->seqstat & SEQSTAT_EXCAUSE) != VEC_HWERR)) { 1114 (((long)fp->seqstat & SEQSTAT_EXCAUSE) != VEC_HWERR)) {
1115 decode_address(buf, saved_dcplb_fault_addr); 1115 decode_address(buf, cpu_pda[cpu].dcplb_fault_addr);
1116 verbose_printk(KERN_NOTICE "DCPLB_FAULT_ADDR: %s\n", buf); 1116 verbose_printk(KERN_NOTICE "DCPLB_FAULT_ADDR: %s\n", buf);
1117 decode_address(buf, saved_icplb_fault_addr); 1117 decode_address(buf, cpu_pda[cpu].icplb_fault_addr);
1118 verbose_printk(KERN_NOTICE "ICPLB_FAULT_ADDR: %s\n", buf); 1118 verbose_printk(KERN_NOTICE "ICPLB_FAULT_ADDR: %s\n", buf);
1119 } 1119 }
1120 1120
@@ -1153,20 +1153,21 @@ unlock:
1153asmlinkage int sys_bfin_spinlock(int *spinlock)__attribute__((l1_text)); 1153asmlinkage int sys_bfin_spinlock(int *spinlock)__attribute__((l1_text));
1154#endif 1154#endif
1155 1155
1156asmlinkage int sys_bfin_spinlock(int *spinlock) 1156static DEFINE_SPINLOCK(bfin_spinlock_lock);
1157
1158asmlinkage int sys_bfin_spinlock(int *p)
1157{ 1159{
1158 int ret = 0; 1160 int ret, tmp = 0;
1159 int tmp = 0;
1160 1161
1161 local_irq_disable(); 1162 spin_lock(&bfin_spinlock_lock); /* This would also hold kernel preemption. */
1162 ret = get_user(tmp, spinlock); 1163 ret = get_user(tmp, p);
1163 if (ret == 0) { 1164 if (likely(ret == 0)) {
1164 if (tmp) 1165 if (unlikely(tmp))
1165 ret = 1; 1166 ret = 1;
1166 tmp = 1; 1167 else
1167 put_user(tmp, spinlock); 1168 put_user(1, p);
1168 } 1169 }
1169 local_irq_enable(); 1170 spin_unlock(&bfin_spinlock_lock);
1170 return ret; 1171 return ret;
1171} 1172}
1172 1173
diff --git a/arch/blackfin/kernel/vmlinux.lds.S b/arch/blackfin/kernel/vmlinux.lds.S
index 7d12c6692a65..4b4341da0585 100644
--- a/arch/blackfin/kernel/vmlinux.lds.S
+++ b/arch/blackfin/kernel/vmlinux.lds.S
@@ -68,6 +68,8 @@ SECTIONS
68 __etext = .; 68 __etext = .;
69 } 69 }
70 70
71 NOTES
72
71 /* Just in case the first read only is a 32-bit access */ 73 /* Just in case the first read only is a 32-bit access */
72 RO_DATA(4) 74 RO_DATA(4)
73 75
@@ -109,7 +111,6 @@ SECTIONS
109#endif 111#endif
110 112
111 DATA_DATA 113 DATA_DATA
112 *(.data.*)
113 CONSTRUCTORS 114 CONSTRUCTORS
114 115
115 /* make sure the init_task is aligned to the 116 /* make sure the init_task is aligned to the
@@ -161,12 +162,14 @@ SECTIONS
161 *(.con_initcall.init) 162 *(.con_initcall.init)
162 ___con_initcall_end = .; 163 ___con_initcall_end = .;
163 } 164 }
165 PERCPU(4)
164 SECURITY_INIT 166 SECURITY_INIT
165 .init.ramfs : 167 .init.ramfs :
166 { 168 {
167 . = ALIGN(4); 169 . = ALIGN(4);
168 ___initramfs_start = .; 170 ___initramfs_start = .;
169 *(.init.ramfs) 171 *(.init.ramfs)
172 . = ALIGN(4);
170 ___initramfs_end = .; 173 ___initramfs_end = .;
171 } 174 }
172 175
@@ -212,7 +215,7 @@ SECTIONS
212 __ebss_b_l1 = .; 215 __ebss_b_l1 = .;
213 } 216 }
214 217
215 __l2_lma_start = .; 218 __l2_lma_start = LOADADDR(.data_b_l1) + SIZEOF(.data_b_l1);
216 219
217 .text_data_l2 L2_START : AT(LOADADDR(.data_b_l1) + SIZEOF(.data_b_l1)) 220 .text_data_l2 L2_START : AT(LOADADDR(.data_b_l1) + SIZEOF(.data_b_l1))
218 { 221 {
@@ -240,7 +243,7 @@ SECTIONS
240 /* Force trailing alignment of our init section so that when we 243 /* Force trailing alignment of our init section so that when we
241 * free our init memory, we don't leave behind a partial page. 244 * free our init memory, we don't leave behind a partial page.
242 */ 245 */
243 . = LOADADDR(.data_b_l1) + SIZEOF(.data_b_l1); 246 . = LOADADDR(.text_data_l2) + SIZEOF(.text_data_l2);
244 . = ALIGN(PAGE_SIZE); 247 . = ALIGN(PAGE_SIZE);
245 ___init_end = .; 248 ___init_end = .;
246 249
diff --git a/arch/blackfin/lib/checksum.c b/arch/blackfin/lib/checksum.c
index 5c87505165d3..762a7f02970a 100644
--- a/arch/blackfin/lib/checksum.c
+++ b/arch/blackfin/lib/checksum.c
@@ -29,6 +29,7 @@
29 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 29 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
30 */ 30 */
31 31
32#include <linux/module.h>
32#include <net/checksum.h> 33#include <net/checksum.h>
33#include <asm/checksum.h> 34#include <asm/checksum.h>
34 35
@@ -76,6 +77,7 @@ __sum16 ip_fast_csum(unsigned char *iph, unsigned int ihl)
76{ 77{
77 return (__force __sum16)~do_csum(iph, ihl * 4); 78 return (__force __sum16)~do_csum(iph, ihl * 4);
78} 79}
80EXPORT_SYMBOL(ip_fast_csum);
79 81
80/* 82/*
81 * computes the checksum of a memory block at buff, length len, 83 * computes the checksum of a memory block at buff, length len,
@@ -104,6 +106,7 @@ __wsum csum_partial(const void *buff, int len, __wsum sum)
104 106
105 return sum; 107 return sum;
106} 108}
109EXPORT_SYMBOL(csum_partial);
107 110
108/* 111/*
109 * this routine is used for miscellaneous IP-like checksums, mainly 112 * this routine is used for miscellaneous IP-like checksums, mainly
@@ -137,3 +140,4 @@ __wsum csum_partial_copy(const void *src, void *dst, int len, __wsum sum)
137 memcpy(dst, src, len); 140 memcpy(dst, src, len);
138 return csum_partial(dst, len, sum); 141 return csum_partial(dst, len, sum);
139} 142}
143EXPORT_SYMBOL(csum_partial_copy);
diff --git a/arch/blackfin/lib/ins.S b/arch/blackfin/lib/ins.S
index d60554dce87b..1863a6ba507c 100644
--- a/arch/blackfin/lib/ins.S
+++ b/arch/blackfin/lib/ins.S
@@ -1,31 +1,9 @@
1/* 1/*
2 * File: arch/blackfin/lib/ins.S 2 * arch/blackfin/lib/ins.S - ins{bwl} using hardware loops
3 * Based on:
4 * Author: Bas Vermeulen <bas@buyways.nl>
5 * 3 *
6 * Created: Tue Mar 22 15:27:24 CEST 2005 4 * Copyright 2004-2008 Analog Devices Inc.
7 * Description: Implementation of ins{bwl} for BlackFin processors using zero overhead loops. 5 * Copyright (C) 2005 Bas Vermeulen, BuyWays BV <bas@buyways.nl>
8 * 6 * Licensed under the GPL-2 or later.
9 * Modified:
10 * Copyright 2004-2008 Analog Devices Inc.
11 * Copyright (C) 2005 Bas Vermeulen, BuyWays BV <bas@buyways.nl>
12 *
13 * Bugs: Enter bugs at http://blackfin.uclinux.org/
14 *
15 * This program is free software; you can redistribute it and/or modify
16 * it under the terms of the GNU General Public License as published by
17 * the Free Software Foundation; either version 2 of the License, or
18 * (at your option) any later version.
19 *
20 * This program is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
24 *
25 * You should have received a copy of the GNU General Public License
26 * along with this program; if not, see the file COPYING, or write
27 * to the Free Software Foundation, Inc.,
28 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
29 */ 7 */
30 8
31#include <linux/linkage.h> 9#include <linux/linkage.h>
@@ -33,6 +11,46 @@
33 11
34.align 2 12.align 2
35 13
14#ifdef CONFIG_IPIPE
15# define DO_CLI \
16 [--sp] = rets; \
17 [--sp] = (P5:0); \
18 sp += -12; \
19 call ___ipipe_stall_root_raw; \
20 sp += 12; \
21 (P5:0) = [sp++];
22# define CLI_INNER_NOP
23#else
24# define DO_CLI cli R3;
25# define CLI_INNER_NOP nop; nop; nop;
26#endif
27
28#ifdef CONFIG_IPIPE
29# define DO_STI \
30 sp += -12; \
31 call ___ipipe_unstall_root_raw; \
32 sp += 12; \
332: rets = [sp++];
34#else
35# define DO_STI 2: sti R3;
36#endif
37
38#ifdef CONFIG_BFIN_INS_LOWOVERHEAD
39# define CLI_OUTER DO_CLI;
40# define STI_OUTER DO_STI;
41# define CLI_INNER 1:
42# if ANOMALY_05000416
43# define STI_INNER nop; 2: nop;
44# else
45# define STI_INNER 2:
46# endif
47#else
48# define CLI_OUTER
49# define STI_OUTER
50# define CLI_INNER 1: DO_CLI; CLI_INNER_NOP;
51# define STI_INNER DO_STI;
52#endif
53
36/* 54/*
37 * Reads on the Blackfin are speculative. In Blackfin terms, this means they 55 * Reads on the Blackfin are speculative. In Blackfin terms, this means they
38 * can be interrupted at any time (even after they have been issued on to the 56 * can be interrupted at any time (even after they have been issued on to the
@@ -53,170 +71,48 @@
53 * buffers in/out of FIFOs. 71 * buffers in/out of FIFOs.
54 */ 72 */
55 73
56ENTRY(_insl) 74#define COMMON_INS(func, ops) \
57#ifdef CONFIG_BFIN_INS_LOWOVERHEAD 75ENTRY(_ins##func) \
58 P0 = R0; /* P0 = port */ 76 P0 = R0; /* P0 = port */ \
59 cli R3; 77 CLI_OUTER; /* 3 instructions before first read access */ \
60 P1 = R1; /* P1 = address */ 78 P1 = R1; /* P1 = address */ \
61 P2 = R2; /* P2 = count */ 79 P2 = R2; /* P2 = count */ \
62 SSYNC; 80 SSYNC; \
63 LSETUP( .Llong_loop_s, .Llong_loop_e) LC0 = P2; 81 \
64.Llong_loop_s: R0 = [P0]; 82 LSETUP(1f, 2f) LC0 = P2; \
65 [P1++] = R0; 83 CLI_INNER; \
66 NOP; 84 ops; \
67.Llong_loop_e: NOP; 85 STI_INNER; \
68 sti R3; 86 \
69 RTS; 87 STI_OUTER; \
70#else 88 RTS; \
71 P0 = R0; /* P0 = port */ 89ENDPROC(_ins##func)
72 P1 = R1; /* P1 = address */
73 P2 = R2; /* P2 = count */
74 SSYNC;
75 LSETUP( .Llong_loop_s, .Llong_loop_e) LC0 = P2;
76.Llong_loop_s:
77 CLI R3;
78 NOP; NOP; NOP;
79 R0 = [P0];
80 [P1++] = R0;
81.Llong_loop_e:
82 STI R3;
83 90
84 RTS; 91COMMON_INS(l, \
85#endif 92 R0 = [P0]; \
86ENDPROC(_insl) 93 [P1++] = R0; \
87 94)
88ENTRY(_insw)
89#ifdef CONFIG_BFIN_INS_LOWOVERHEAD
90 P0 = R0; /* P0 = port */
91 cli R3;
92 P1 = R1; /* P1 = address */
93 P2 = R2; /* P2 = count */
94 SSYNC;
95 LSETUP( .Lword_loop_s, .Lword_loop_e) LC0 = P2;
96.Lword_loop_s: R0 = W[P0];
97 W[P1++] = R0;
98 NOP;
99.Lword_loop_e: NOP;
100 sti R3;
101 RTS;
102#else
103 P0 = R0; /* P0 = port */
104 P1 = R1; /* P1 = address */
105 P2 = R2; /* P2 = count */
106 SSYNC;
107 LSETUP( .Lword_loop_s, .Lword_loop_e) LC0 = P2;
108.Lword_loop_s:
109 CLI R3;
110 NOP; NOP; NOP;
111 R0 = W[P0];
112 W[P1++] = R0;
113.Lword_loop_e:
114 STI R3;
115 RTS;
116
117#endif
118ENDPROC(_insw)
119
120ENTRY(_insw_8)
121#ifdef CONFIG_BFIN_INS_LOWOVERHEAD
122 P0 = R0; /* P0 = port */
123 cli R3;
124 P1 = R1; /* P1 = address */
125 P2 = R2; /* P2 = count */
126 SSYNC;
127 LSETUP( .Lword8_loop_s, .Lword8_loop_e) LC0 = P2;
128.Lword8_loop_s: R0 = W[P0];
129 B[P1++] = R0;
130 R0 = R0 >> 8;
131 B[P1++] = R0;
132 NOP;
133.Lword8_loop_e: NOP;
134 sti R3;
135 RTS;
136#else
137 P0 = R0; /* P0 = port */
138 P1 = R1; /* P1 = address */
139 P2 = R2; /* P2 = count */
140 SSYNC;
141 LSETUP( .Lword8_loop_s, .Lword8_loop_e) LC0 = P2;
142.Lword8_loop_s:
143 CLI R3;
144 NOP; NOP; NOP;
145 R0 = W[P0];
146 B[P1++] = R0;
147 R0 = R0 >> 8;
148 B[P1++] = R0;
149 NOP;
150.Lword8_loop_e:
151 STI R3;
152 95
153 RTS; 96COMMON_INS(w, \
154#endif 97 R0 = W[P0]; \
155ENDPROC(_insw_8) 98 W[P1++] = R0; \
99)
156 100
157ENTRY(_insb) 101COMMON_INS(w_8, \
158#ifdef CONFIG_BFIN_INS_LOWOVERHEAD 102 R0 = W[P0]; \
159 P0 = R0; /* P0 = port */ 103 B[P1++] = R0; \
160 cli R3; 104 R0 = R0 >> 8; \
161 P1 = R1; /* P1 = address */ 105 B[P1++] = R0; \
162 P2 = R2; /* P2 = count */ 106)
163 SSYNC;
164 LSETUP( .Lbyte_loop_s, .Lbyte_loop_e) LC0 = P2;
165.Lbyte_loop_s: R0 = B[P0];
166 B[P1++] = R0;
167 NOP;
168.Lbyte_loop_e: NOP;
169 sti R3;
170 RTS;
171#else
172 P0 = R0; /* P0 = port */
173 P1 = R1; /* P1 = address */
174 P2 = R2; /* P2 = count */
175 SSYNC;
176 LSETUP( .Lbyte_loop_s, .Lbyte_loop_e) LC0 = P2;
177.Lbyte_loop_s:
178 CLI R3;
179 NOP; NOP; NOP;
180 R0 = B[P0];
181 B[P1++] = R0;
182.Lbyte_loop_e:
183 STI R3;
184 107
185 RTS; 108COMMON_INS(b, \
186#endif 109 R0 = B[P0]; \
187ENDPROC(_insb) 110 B[P1++] = R0; \
111)
188 112
189ENTRY(_insl_16) 113COMMON_INS(l_16, \
190#ifdef CONFIG_BFIN_INS_LOWOVERHEAD 114 R0 = [P0]; \
191 P0 = R0; /* P0 = port */ 115 W[P1++] = R0; \
192 cli R3; 116 R0 = R0 >> 16; \
193 P1 = R1; /* P1 = address */ 117 W[P1++] = R0; \
194 P2 = R2; /* P2 = count */ 118)
195 SSYNC;
196 LSETUP( .Llong16_loop_s, .Llong16_loop_e) LC0 = P2;
197.Llong16_loop_s: R0 = [P0];
198 W[P1++] = R0;
199 R0 = R0 >> 16;
200 W[P1++] = R0;
201 NOP;
202.Llong16_loop_e: NOP;
203 sti R3;
204 RTS;
205#else
206 P0 = R0; /* P0 = port */
207 P1 = R1; /* P1 = address */
208 P2 = R2; /* P2 = count */
209 SSYNC;
210 LSETUP( .Llong16_loop_s, .Llong16_loop_e) LC0 = P2;
211.Llong16_loop_s:
212 CLI R3;
213 NOP; NOP; NOP;
214 R0 = [P0];
215 W[P1++] = R0;
216 R0 = R0 >> 16;
217 W[P1++] = R0;
218.Llong16_loop_e:
219 STI R3;
220 RTS;
221#endif
222ENDPROC(_insl_16)
diff --git a/arch/blackfin/lib/muldi3.S b/arch/blackfin/lib/muldi3.S
new file mode 100644
index 000000000000..abde120ee230
--- /dev/null
+++ b/arch/blackfin/lib/muldi3.S
@@ -0,0 +1,68 @@
1.align 2
2.global ___muldi3;
3.type ___muldi3, STT_FUNC;
4
5#ifdef CONFIG_ARITHMETIC_OPS_L1
6.section .l1.text
7#else
8.text
9#endif
10
11/*
12 R1:R0 * R3:R2
13 = R1.h:R1.l:R0.h:R0.l * R3.h:R3.l:R2.h:R2.l
14[X] = (R1.h * R3.h) * 2^96
15[X] + (R1.h * R3.l + R1.l * R3.h) * 2^80
16[X] + (R1.h * R2.h + R1.l * R3.l + R3.h * R0.h) * 2^64
17[T1] + (R1.h * R2.l + R3.h * R0.l + R1.l * R2.h + R3.l * R0.h) * 2^48
18[T2] + (R1.l * R2.l + R3.l * R0.l + R0.h * R2.h) * 2^32
19[T3] + (R0.l * R2.h + R2.l * R0.h) * 2^16
20[T4] + (R0.l * R2.l)
21
22 We can discard the first three lines marked "X" since we produce
23 only a 64 bit result. So, we need ten 16-bit multiplies.
24
25 Individual mul-acc results:
26[E1] = R1.h * R2.l + R3.h * R0.l + R1.l * R2.h + R3.l * R0.h
27[E2] = R1.l * R2.l + R3.l * R0.l + R0.h * R2.h
28[E3] = R0.l * R2.h + R2.l * R0.h
29[E4] = R0.l * R2.l
30
31 We also need to add high parts from lower-level results to higher ones:
32 E[n]c = E[n] + (E[n+1]c >> 16), where E4c := E4
33
34 One interesting property is that all parts of the result that depend
35 on the sign of the multiplication are discarded. Those would be the
36 multiplications involving R1.h and R3.h, but only the top 16 bit of
37 the 32 bit result depend on the sign, and since R1.h and R3.h only
38 occur in E1, the top half of these results is cut off.
39 So, we can just use FU mode for all of the 16-bit multiplies, and
40 ignore questions of when to use mixed mode. */
41
42___muldi3:
43 /* [SP] technically is part of the caller's frame, but we can
44 use it as scratch space. */
45 A0 = R2.H * R1.L, A1 = R2.L * R1.H (FU) || R3 = [SP + 12]; /* E1 */
46 A0 += R3.H * R0.L, A1 += R3.L * R0.H (FU) || [SP] = R4; /* E1 */
47 A0 += A1; /* E1 */
48 R4 = A0.w;
49 A0 = R0.l * R3.l (FU); /* E2 */
50 A0 += R2.l * R1.l (FU); /* E2 */
51
52 A1 = R2.L * R0.L (FU); /* E4 */
53 R3 = A1.w;
54 A1 = A1 >> 16; /* E3c */
55 A0 += R2.H * R0.H, A1 += R2.L * R0.H (FU); /* E2, E3c */
56 A1 += R0.L * R2.H (FU); /* E3c */
57 R0 = A1.w;
58 A1 = A1 >> 16; /* E2c */
59 A0 += A1; /* E2c */
60 R1 = A0.w;
61
62 /* low(result) = low(E3c):low(E4) */
63 R0 = PACK (R0.l, R3.l);
64 /* high(result) = E2c + (E1 << 16) */
65 R1.h = R1.h + R4.l (NS) || R4 = [SP];
66 RTS;
67
68.size ___muldi3, .-___muldi3
diff --git a/arch/blackfin/lib/muldi3.c b/arch/blackfin/lib/muldi3.c
deleted file mode 100644
index 303d0c6a6dba..000000000000
--- a/arch/blackfin/lib/muldi3.c
+++ /dev/null
@@ -1,99 +0,0 @@
1/*
2 * File: arch/blackfin/lib/muldi3.c
3 * Based on:
4 * Author:
5 *
6 * Created:
7 * Description:
8 *
9 * Modified:
10 * Copyright 2004-2006 Analog Devices Inc.
11 *
12 * Bugs: Enter bugs at http://blackfin.uclinux.org/
13 *
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 2 of the License, or
17 * (at your option) any later version.
18 *
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
23 *
24 * You should have received a copy of the GNU General Public License
25 * along with this program; if not, see the file COPYING, or write
26 * to the Free Software Foundation, Inc.,
27 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
28 */
29
30#ifndef SI_TYPE_SIZE
31#define SI_TYPE_SIZE 32
32#endif
33#define __ll_b (1L << (SI_TYPE_SIZE / 2))
34#define __ll_lowpart(t) ((usitype) (t) % __ll_b)
35#define __ll_highpart(t) ((usitype) (t) / __ll_b)
36#define BITS_PER_UNIT 8
37
38#if !defined(umul_ppmm)
39#define umul_ppmm(w1, w0, u, v) \
40 do { \
41 usitype __x0, __x1, __x2, __x3; \
42 usitype __ul, __vl, __uh, __vh; \
43 \
44 __ul = __ll_lowpart (u); \
45 __uh = __ll_highpart (u); \
46 __vl = __ll_lowpart (v); \
47 __vh = __ll_highpart (v); \
48 \
49 __x0 = (usitype) __ul * __vl; \
50 __x1 = (usitype) __ul * __vh; \
51 __x2 = (usitype) __uh * __vl; \
52 __x3 = (usitype) __uh * __vh; \
53 \
54 __x1 += __ll_highpart (__x0);/* this can't give carry */ \
55 __x1 += __x2; /* but this indeed can */ \
56 if (__x1 < __x2) /* did we get it? */ \
57 __x3 += __ll_b; /* yes, add it in the proper pos. */ \
58 \
59 (w1) = __x3 + __ll_highpart (__x1); \
60 (w0) = __ll_lowpart (__x1) * __ll_b + __ll_lowpart (__x0); \
61 } while (0)
62#endif
63
64#if !defined(__umulsidi3)
65#define __umulsidi3(u, v) \
66 ({diunion __w; \
67 umul_ppmm (__w.s.high, __w.s.low, u, v); \
68 __w.ll; })
69#endif
70
71typedef unsigned int usitype __attribute__ ((mode(SI)));
72typedef int sitype __attribute__ ((mode(SI)));
73typedef int ditype __attribute__ ((mode(DI)));
74typedef int word_type __attribute__ ((mode(__word__)));
75
76struct distruct {
77 sitype low, high;
78};
79typedef union {
80 struct distruct s;
81 ditype ll;
82} diunion;
83
84#ifdef CONFIG_ARITHMETIC_OPS_L1
85ditype __muldi3(ditype u, ditype v)__attribute__((l1_text));
86#endif
87
88ditype __muldi3(ditype u, ditype v)
89{
90 diunion w;
91 diunion uu, vv;
92
93 uu.ll = u, vv.ll = v;
94 w.ll = __umulsidi3(uu.s.low, vv.s.low);
95 w.s.high += ((usitype) uu.s.low * (usitype) vv.s.high
96 + (usitype) uu.s.high * (usitype) vv.s.low);
97
98 return w.ll;
99}
diff --git a/arch/blackfin/mach-bf518/Kconfig b/arch/blackfin/mach-bf518/Kconfig
new file mode 100644
index 000000000000..f397ede006bf
--- /dev/null
+++ b/arch/blackfin/mach-bf518/Kconfig
@@ -0,0 +1,233 @@
1if (BF51x)
2
3source "arch/blackfin/mach-bf518/boards/Kconfig"
4
5menu "BF518 Specific Configuration"
6
7comment "Alternative Multiplexing Scheme"
8
9choice
10 prompt "SPORT0"
11 default BF518_SPORT0_PORTG
12 help
13 Select PORT used for SPORT0. See Hardware Reference Manual
14
15config BF518_SPORT0_PORTF
16 bool "PORT F"
17 help
18 PORT F
19
20config BF518_SPORT0_PORTG
21 bool "PORT G"
22 help
23 PORT G
24endchoice
25
26choice
27 prompt "SPORT0 TSCLK Location"
28 depends on BF518_SPORT0_PORTG
29 default BF518_SPORT0_TSCLK_PG10
30 help
31 Select PIN used for SPORT0_TSCLK. See Hardware Reference Manual
32
33config BF518_SPORT0_TSCLK_PG10
34 bool "PORT PG10"
35 help
36 PORT PG10
37
38config BF518_SPORT0_TSCLK_PG14
39 bool "PORT PG14"
40 help
41 PORT PG14
42endchoice
43
44choice
45 prompt "UART1"
46 default BF518_UART1_PORTF
47 help
48 Select PORT used for UART1. See Hardware Reference Manual
49
50config BF518_UART1_PORTF
51 bool "PORT F"
52 help
53 PORT F
54
55config BF518_UART1_PORTG
56 bool "PORT G"
57 help
58 PORT G
59endchoice
60
61comment "Interrupt Priority Assignment"
62menu "Priority"
63
64config IRQ_PLL_WAKEUP
65 int "IRQ_PLL_WAKEUP"
66 default 7
67config IRQ_DMA0_ERROR
68 int "IRQ_DMA0_ERROR"
69 default 7
70config IRQ_DMAR0_BLK
71 int "IRQ_DMAR0_BLK"
72 default 7
73config IRQ_DMAR1_BLK
74 int "IRQ_DMAR1_BLK"
75 default 7
76config IRQ_DMAR0_OVR
77 int "IRQ_DMAR0_OVR"
78 default 7
79config IRQ_DMAR1_OVR
80 int "IRQ_DMAR1_OVR"
81 default 7
82config IRQ_PPI_ERROR
83 int "IRQ_PPI_ERROR"
84 default 7
85config IRQ_MAC_ERROR
86 int "IRQ_MAC_ERROR"
87 default 7
88config IRQ_SPORT0_ERROR
89 int "IRQ_SPORT0_ERROR"
90 default 7
91config IRQ_SPORT1_ERROR
92 int "IRQ_SPORT1_ERROR"
93 default 7
94config IRQ_PTP_ERROR
95 int "IRQ_PTP_ERROR"
96 default 7
97config IRQ_UART0_ERROR
98 int "IRQ_UART0_ERROR"
99 default 7
100config IRQ_UART1_ERROR
101 int "IRQ_UART1_ERROR"
102 default 7
103config IRQ_RTC
104 int "IRQ_RTC"
105 default 8
106config IRQ_PPI
107 int "IRQ_PPI"
108 default 8
109config IRQ_SPORT0_RX
110 int "IRQ_SPORT0_RX"
111 default 9
112config IRQ_SPORT0_TX
113 int "IRQ_SPORT0_TX"
114 default 9
115config IRQ_SPORT1_RX
116 int "IRQ_SPORT1_RX"
117 default 9
118config IRQ_SPORT1_TX
119 int "IRQ_SPORT1_TX"
120 default 9
121config IRQ_TWI
122 int "IRQ_TWI"
123 default 10
124config IRQ_SPI0
125 int "IRQ_SPI"
126 default 10
127config IRQ_UART0_RX
128 int "IRQ_UART0_RX"
129 default 10
130config IRQ_UART0_TX
131 int "IRQ_UART0_TX"
132 default 10
133config IRQ_UART1_RX
134 int "IRQ_UART1_RX"
135 default 10
136config IRQ_UART1_TX
137 int "IRQ_UART1_TX"
138 default 10
139config IRQ_OPTSEC
140 int "IRQ_OPTSEC"
141 default 11
142config IRQ_CNT
143 int "IRQ_CNT"
144 default 11
145config IRQ_MAC_RX
146 int "IRQ_MAC_RX"
147 default 11
148config IRQ_PORTH_INTA
149 int "IRQ_PORTH_INTA"
150 default 11
151config IRQ_MAC_TX
152 int "IRQ_MAC_TX/NFC"
153 default 11
154config IRQ_PORTH_INTB
155 int "IRQ_PORTH_INTB"
156 default 11
157config IRQ_TIMER0
158 int "IRQ_TIMER0"
159 default 8
160config IRQ_TIMER1
161 int "IRQ_TIMER1"
162 default 12
163config IRQ_TIMER2
164 int "IRQ_TIMER2"
165 default 12
166config IRQ_TIMER3
167 int "IRQ_TIMER3"
168 default 12
169config IRQ_TIMER4
170 int "IRQ_TIMER4"
171 default 12
172config IRQ_TIMER5
173 int "IRQ_TIMER5"
174 default 12
175config IRQ_TIMER6
176 int "IRQ_TIMER6"
177 default 12
178config IRQ_TIMER7
179 int "IRQ_TIMER7"
180 default 12
181config IRQ_PORTG_INTA
182 int "IRQ_PORTG_INTA"
183 default 12
184config IRQ_PORTG_INTB
185 int "IRQ_PORTG_INTB"
186 default 12
187config IRQ_MEM_DMA0
188 int "IRQ_MEM_DMA0"
189 default 13
190config IRQ_MEM_DMA1
191 int "IRQ_MEM_DMA1"
192 default 13
193config IRQ_WATCH
194 int "IRQ_WATCH"
195 default 13
196config IRQ_PORTF_INTA
197 int "IRQ_PORTF_INTA"
198 default 13
199config IRQ_PORTF_INTB
200 int "IRQ_PORTF_INTB"
201 default 13
202config IRQ_SPI0_ERROR
203 int "IRQ_SPI0_ERROR"
204 default 7
205config IRQ_SPI1_ERROR
206 int "IRQ_SPI1_ERROR"
207 default 7
208config IRQ_RSI_INT0
209 int "IRQ_RSI_INT0"
210 default 7
211config IRQ_RSI_INT1
212 int "IRQ_RSI_INT1"
213 default 7
214config IRQ_PWM_TRIP
215 int "IRQ_PWM_TRIP"
216 default 10
217config IRQ_PWM_SYNC
218 int "IRQ_PWM_SYNC"
219 default 10
220config IRQ_PTP_STAT
221 int "IRQ_PTP_STAT"
222 default 10
223
224 help
225 Enter the priority numbers between 7-13 ONLY. Others are Reserved.
226 This applies to all the above. It is not recommended to assign the
227 highest priority number 7 to UART or any other device.
228
229endmenu
230
231endmenu
232
233endif
diff --git a/arch/blackfin/mach-bf518/Makefile b/arch/blackfin/mach-bf518/Makefile
new file mode 100644
index 000000000000..168a193f9f9a
--- /dev/null
+++ b/arch/blackfin/mach-bf518/Makefile
@@ -0,0 +1,5 @@
1#
2# arch/blackfin/mach-bf518/Makefile
3#
4
5obj-y := ints-priority.o dma.o
diff --git a/arch/blackfin/mach-bf518/boards/Kconfig b/arch/blackfin/mach-bf518/boards/Kconfig
new file mode 100644
index 000000000000..96163514ed22
--- /dev/null
+++ b/arch/blackfin/mach-bf518/boards/Kconfig
@@ -0,0 +1,12 @@
1choice
2 prompt "System type"
3 default BFIN518F_EZBRD
4 help
5 Select your board!
6
7config BFIN518F_EZBRD
8 bool "BF518F-EZBRD"
9 help
10 BF518-EZBRD board support.
11
12endchoice
diff --git a/arch/blackfin/mach-bf518/boards/Makefile b/arch/blackfin/mach-bf518/boards/Makefile
new file mode 100644
index 000000000000..172e859c3a7f
--- /dev/null
+++ b/arch/blackfin/mach-bf518/boards/Makefile
@@ -0,0 +1,5 @@
1#
2# arch/blackfin/mach-bf518/boards/Makefile
3#
4
5obj-$(CONFIG_BFIN518F_EZBRD) += ezbrd.o
diff --git a/arch/blackfin/mach-bf518/boards/ezbrd.c b/arch/blackfin/mach-bf518/boards/ezbrd.c
new file mode 100644
index 000000000000..15f1351c8645
--- /dev/null
+++ b/arch/blackfin/mach-bf518/boards/ezbrd.c
@@ -0,0 +1,669 @@
1/*
2 * File: arch/blackfin/mach-bf518/boards/ezbrd.c
3 * Based on: arch/blackfin/mach-bf527/boards/ezbrd.c
4 * Author: Bryan Wu <cooloney@kernel.org>
5 *
6 * Created:
7 * Description:
8 *
9 * Modified:
10 * Copyright 2005 National ICT Australia (NICTA)
11 * Copyright 2004-2008 Analog Devices Inc.
12 *
13 * Bugs: Enter bugs at http://blackfin.uclinux.org/
14 *
15 * This program is free software; you can redistribute it and/or modify
16 * it under the terms of the GNU General Public License as published by
17 * the Free Software Foundation; either version 2 of the License, or
18 * (at your option) any later version.
19 *
20 * This program is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
24 *
25 * You should have received a copy of the GNU General Public License
26 * along with this program; if not, see the file COPYING, or write
27 * to the Free Software Foundation, Inc.,
28 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
29 */
30
31#include <linux/device.h>
32#include <linux/platform_device.h>
33#include <linux/mtd/mtd.h>
34#include <linux/mtd/partitions.h>
35#include <linux/mtd/physmap.h>
36#include <linux/spi/spi.h>
37#include <linux/spi/flash.h>
38
39#include <linux/i2c.h>
40#include <linux/irq.h>
41#include <linux/interrupt.h>
42#include <asm/dma.h>
43#include <asm/bfin5xx_spi.h>
44#include <asm/reboot.h>
45#include <asm/portmux.h>
46#include <asm/dpmc.h>
47#include <asm/bfin_sdh.h>
48#include <linux/spi/ad7877.h>
49
50/*
51 * Name the Board for the /proc/cpuinfo
52 */
53const char bfin_board_name[] = "ADI BF518F-EZBRD";
54
55/*
56 * Driver needs to know address, irq and flag pin.
57 */
58
59#if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
60static struct mtd_partition ezbrd_partitions[] = {
61 {
62 .name = "bootloader(nor)",
63 .size = 0x40000,
64 .offset = 0,
65 }, {
66 .name = "linux kernel(nor)",
67 .size = 0x1C0000,
68 .offset = MTDPART_OFS_APPEND,
69 }, {
70 .name = "file system(nor)",
71 .size = MTDPART_SIZ_FULL,
72 .offset = MTDPART_OFS_APPEND,
73 }
74};
75
76static struct physmap_flash_data ezbrd_flash_data = {
77 .width = 2,
78 .parts = ezbrd_partitions,
79 .nr_parts = ARRAY_SIZE(ezbrd_partitions),
80};
81
82static struct resource ezbrd_flash_resource = {
83 .start = 0x20000000,
84 .end = 0x203fffff,
85 .flags = IORESOURCE_MEM,
86};
87
88static struct platform_device ezbrd_flash_device = {
89 .name = "physmap-flash",
90 .id = 0,
91 .dev = {
92 .platform_data = &ezbrd_flash_data,
93 },
94 .num_resources = 1,
95 .resource = &ezbrd_flash_resource,
96};
97#endif
98
99#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
100static struct platform_device rtc_device = {
101 .name = "rtc-bfin",
102 .id = -1,
103};
104#endif
105
106#if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
107static struct platform_device bfin_mac_device = {
108 .name = "bfin_mac",
109};
110#endif
111
112#if defined(CONFIG_MTD_M25P80) \
113 || defined(CONFIG_MTD_M25P80_MODULE)
114static struct mtd_partition bfin_spi_flash_partitions[] = {
115 {
116 .name = "bootloader(spi)",
117 .size = 0x00040000,
118 .offset = 0,
119 .mask_flags = MTD_CAP_ROM
120 }, {
121 .name = "linux kernel(spi)",
122 .size = MTDPART_SIZ_FULL,
123 .offset = MTDPART_OFS_APPEND,
124 }
125};
126
127static struct flash_platform_data bfin_spi_flash_data = {
128 .name = "m25p80",
129 .parts = bfin_spi_flash_partitions,
130 .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
131 .type = "m25p16",
132};
133
134/* SPI flash chip (m25p64) */
135static struct bfin5xx_spi_chip spi_flash_chip_info = {
136 .enable_dma = 0, /* use dma transfer with this chip*/
137 .bits_per_word = 8,
138};
139#endif
140
141#if defined(CONFIG_SPI_ADC_BF533) \
142 || defined(CONFIG_SPI_ADC_BF533_MODULE)
143/* SPI ADC chip */
144static struct bfin5xx_spi_chip spi_adc_chip_info = {
145 .enable_dma = 1, /* use dma transfer with this chip*/
146 .bits_per_word = 16,
147};
148#endif
149
150#if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE)
151static struct bfin5xx_spi_chip spi_mmc_chip_info = {
152 .enable_dma = 1,
153 .bits_per_word = 8,
154};
155#endif
156
157#if defined(CONFIG_PBX)
158static struct bfin5xx_spi_chip spi_si3xxx_chip_info = {
159 .ctl_reg = 0x4, /* send zero */
160 .enable_dma = 0,
161 .bits_per_word = 8,
162 .cs_change_per_word = 1,
163};
164#endif
165
166#if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
167static struct bfin5xx_spi_chip spi_ad7877_chip_info = {
168 .enable_dma = 0,
169 .bits_per_word = 16,
170};
171
172static const struct ad7877_platform_data bfin_ad7877_ts_info = {
173 .model = 7877,
174 .vref_delay_usecs = 50, /* internal, no capacitor */
175 .x_plate_ohms = 419,
176 .y_plate_ohms = 486,
177 .pressure_max = 1000,
178 .pressure_min = 0,
179 .stopacq_polarity = 1,
180 .first_conversion_delay = 3,
181 .acquisition_time = 1,
182 .averaging = 1,
183 .pen_down_acc_interval = 1,
184};
185#endif
186
187#if defined(CONFIG_SND_SOC_WM8731) || defined(CONFIG_SND_SOC_WM8731_MODULE) \
188 && defined(CONFIG_SND_SOC_WM8731_SPI)
189static struct bfin5xx_spi_chip spi_wm8731_chip_info = {
190 .enable_dma = 0,
191 .bits_per_word = 16,
192};
193#endif
194
195#if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
196static struct bfin5xx_spi_chip spidev_chip_info = {
197 .enable_dma = 0,
198 .bits_per_word = 8,
199};
200#endif
201
202static struct spi_board_info bfin_spi_board_info[] __initdata = {
203#if defined(CONFIG_MTD_M25P80) \
204 || defined(CONFIG_MTD_M25P80_MODULE)
205 {
206 /* the modalias must be the same as spi device driver name */
207 .modalias = "m25p80", /* Name of spi_driver for this device */
208 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
209 .bus_num = 0, /* Framework bus number */
210 .chip_select = 1, /* Framework chip select. On STAMP537 it is SPISSEL1*/
211 .platform_data = &bfin_spi_flash_data,
212 .controller_data = &spi_flash_chip_info,
213 .mode = SPI_MODE_3,
214 },
215#endif
216
217#if defined(CONFIG_SPI_ADC_BF533) \
218 || defined(CONFIG_SPI_ADC_BF533_MODULE)
219 {
220 .modalias = "bfin_spi_adc", /* Name of spi_driver for this device */
221 .max_speed_hz = 6250000, /* max spi clock (SCK) speed in HZ */
222 .bus_num = 0, /* Framework bus number */
223 .chip_select = 1, /* Framework chip select. */
224 .platform_data = NULL, /* No spi_driver specific config */
225 .controller_data = &spi_adc_chip_info,
226 },
227#endif
228
229#if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE)
230 {
231 .modalias = "spi_mmc_dummy",
232 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
233 .bus_num = 0,
234 .chip_select = 0,
235 .platform_data = NULL,
236 .controller_data = &spi_mmc_chip_info,
237 .mode = SPI_MODE_3,
238 },
239 {
240 .modalias = "spi_mmc",
241 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
242 .bus_num = 0,
243 .chip_select = CONFIG_SPI_MMC_CS_CHAN,
244 .platform_data = NULL,
245 .controller_data = &spi_mmc_chip_info,
246 .mode = SPI_MODE_3,
247 },
248#endif
249#if defined(CONFIG_PBX)
250 {
251 .modalias = "fxs-spi",
252 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
253 .bus_num = 0,
254 .chip_select = 8 - CONFIG_J11_JUMPER,
255 .controller_data = &spi_si3xxx_chip_info,
256 .mode = SPI_MODE_3,
257 },
258 {
259 .modalias = "fxo-spi",
260 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
261 .bus_num = 0,
262 .chip_select = 8 - CONFIG_J19_JUMPER,
263 .controller_data = &spi_si3xxx_chip_info,
264 .mode = SPI_MODE_3,
265 },
266#endif
267#if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
268 {
269 .modalias = "ad7877",
270 .platform_data = &bfin_ad7877_ts_info,
271 .irq = IRQ_PF8,
272 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
273 .bus_num = 0,
274 .chip_select = 2,
275 .controller_data = &spi_ad7877_chip_info,
276 },
277#endif
278#if defined(CONFIG_SND_SOC_WM8731) || defined(CONFIG_SND_SOC_WM8731_MODULE) \
279 && defined(CONFIG_SND_SOC_WM8731_SPI)
280 {
281 .modalias = "wm8731",
282 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
283 .bus_num = 0,
284 .chip_select = 5,
285 .controller_data = &spi_wm8731_chip_info,
286 .mode = SPI_MODE_0,
287 },
288#endif
289#if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
290 {
291 .modalias = "spidev",
292 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
293 .bus_num = 0,
294 .chip_select = 1,
295 .controller_data = &spidev_chip_info,
296 },
297#endif
298#if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)
299 {
300 .modalias = "bfin-lq035q1-spi",
301 .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
302 .bus_num = 0,
303 .chip_select = 1,
304 .controller_data = &lq035q1_spi_chip_info,
305 .mode = SPI_CPHA | SPI_CPOL,
306 },
307#endif
308};
309
310/* SPI controller data */
311#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
312/* SPI (0) */
313static struct bfin5xx_spi_master bfin_spi0_info = {
314 .num_chipselect = 5,
315 .enable_dma = 1, /* master has the ability to do dma transfer */
316 .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
317};
318
319static struct resource bfin_spi0_resource[] = {
320 [0] = {
321 .start = SPI0_REGBASE,
322 .end = SPI0_REGBASE + 0xFF,
323 .flags = IORESOURCE_MEM,
324 },
325 [1] = {
326 .start = CH_SPI0,
327 .end = CH_SPI0,
328 .flags = IORESOURCE_IRQ,
329 },
330};
331
332static struct platform_device bfin_spi0_device = {
333 .name = "bfin-spi",
334 .id = 0, /* Bus number */
335 .num_resources = ARRAY_SIZE(bfin_spi0_resource),
336 .resource = bfin_spi0_resource,
337 .dev = {
338 .platform_data = &bfin_spi0_info, /* Passed to driver */
339 },
340};
341
342/* SPI (1) */
343static struct bfin5xx_spi_master bfin_spi1_info = {
344 .num_chipselect = 5,
345 .enable_dma = 1, /* master has the ability to do dma transfer */
346 .pin_req = {P_SPI1_SCK, P_SPI1_MISO, P_SPI1_MOSI, 0},
347};
348
349static struct resource bfin_spi1_resource[] = {
350 [0] = {
351 .start = SPI1_REGBASE,
352 .end = SPI1_REGBASE + 0xFF,
353 .flags = IORESOURCE_MEM,
354 },
355 [1] = {
356 .start = CH_SPI1,
357 .end = CH_SPI1,
358 .flags = IORESOURCE_IRQ,
359 },
360};
361
362static struct platform_device bfin_spi1_device = {
363 .name = "bfin-spi",
364 .id = 1, /* Bus number */
365 .num_resources = ARRAY_SIZE(bfin_spi1_resource),
366 .resource = bfin_spi1_resource,
367 .dev = {
368 .platform_data = &bfin_spi1_info, /* Passed to driver */
369 },
370};
371#endif /* spi master and devices */
372
373#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
374static struct resource bfin_uart_resources[] = {
375#ifdef CONFIG_SERIAL_BFIN_UART0
376 {
377 .start = 0xFFC00400,
378 .end = 0xFFC004FF,
379 .flags = IORESOURCE_MEM,
380 },
381#endif
382#ifdef CONFIG_SERIAL_BFIN_UART1
383 {
384 .start = 0xFFC02000,
385 .end = 0xFFC020FF,
386 .flags = IORESOURCE_MEM,
387 },
388#endif
389};
390
391static struct platform_device bfin_uart_device = {
392 .name = "bfin-uart",
393 .id = 1,
394 .num_resources = ARRAY_SIZE(bfin_uart_resources),
395 .resource = bfin_uart_resources,
396};
397#endif
398
399#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
400#ifdef CONFIG_BFIN_SIR0
401static struct resource bfin_sir0_resources[] = {
402 {
403 .start = 0xFFC00400,
404 .end = 0xFFC004FF,
405 .flags = IORESOURCE_MEM,
406 },
407 {
408 .start = IRQ_UART0_RX,
409 .end = IRQ_UART0_RX+1,
410 .flags = IORESOURCE_IRQ,
411 },
412 {
413 .start = CH_UART0_RX,
414 .end = CH_UART0_RX+1,
415 .flags = IORESOURCE_DMA,
416 },
417};
418
419static struct platform_device bfin_sir0_device = {
420 .name = "bfin_sir",
421 .id = 0,
422 .num_resources = ARRAY_SIZE(bfin_sir0_resources),
423 .resource = bfin_sir0_resources,
424};
425#endif
426#ifdef CONFIG_BFIN_SIR1
427static struct resource bfin_sir1_resources[] = {
428 {
429 .start = 0xFFC02000,
430 .end = 0xFFC020FF,
431 .flags = IORESOURCE_MEM,
432 },
433 {
434 .start = IRQ_UART1_RX,
435 .end = IRQ_UART1_RX+1,
436 .flags = IORESOURCE_IRQ,
437 },
438 {
439 .start = CH_UART1_RX,
440 .end = CH_UART1_RX+1,
441 .flags = IORESOURCE_DMA,
442 },
443};
444
445static struct platform_device bfin_sir1_device = {
446 .name = "bfin_sir",
447 .id = 1,
448 .num_resources = ARRAY_SIZE(bfin_sir1_resources),
449 .resource = bfin_sir1_resources,
450};
451#endif
452#endif
453
454#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
455static struct resource bfin_twi0_resource[] = {
456 [0] = {
457 .start = TWI0_REGBASE,
458 .end = TWI0_REGBASE,
459 .flags = IORESOURCE_MEM,
460 },
461 [1] = {
462 .start = IRQ_TWI,
463 .end = IRQ_TWI,
464 .flags = IORESOURCE_IRQ,
465 },
466};
467
468static struct platform_device i2c_bfin_twi_device = {
469 .name = "i2c-bfin-twi",
470 .id = 0,
471 .num_resources = ARRAY_SIZE(bfin_twi0_resource),
472 .resource = bfin_twi0_resource,
473};
474#endif
475
476#ifdef CONFIG_I2C_BOARDINFO
477static struct i2c_board_info __initdata bfin_i2c_board_info[] = {
478#if defined(CONFIG_TWI_LCD) || defined(CONFIG_TWI_LCD_MODULE)
479 {
480 I2C_BOARD_INFO("pcf8574_lcd", 0x22),
481 },
482#endif
483#if defined(CONFIG_TWI_KEYPAD) || defined(CONFIG_TWI_KEYPAD_MODULE)
484 {
485 I2C_BOARD_INFO("pcf8574_keypad", 0x27),
486 .irq = IRQ_PF8,
487 },
488#endif
489};
490#endif
491
492#if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
493static struct platform_device bfin_sport0_uart_device = {
494 .name = "bfin-sport-uart",
495 .id = 0,
496};
497
498static struct platform_device bfin_sport1_uart_device = {
499 .name = "bfin-sport-uart",
500 .id = 1,
501};
502#endif
503
504#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
505#include <linux/input.h>
506#include <linux/gpio_keys.h>
507
508static struct gpio_keys_button bfin_gpio_keys_table[] = {
509 {BTN_0, GPIO_PG0, 1, "gpio-keys: BTN0"},
510 {BTN_1, GPIO_PG13, 1, "gpio-keys: BTN1"},
511};
512
513static struct gpio_keys_platform_data bfin_gpio_keys_data = {
514 .buttons = bfin_gpio_keys_table,
515 .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table),
516};
517
518static struct platform_device bfin_device_gpiokeys = {
519 .name = "gpio-keys",
520 .dev = {
521 .platform_data = &bfin_gpio_keys_data,
522 },
523};
524#endif
525
526#if defined(CONFIG_SDH_BFIN) || defined(CONFIG_SDH_BFIN_MODULE)
527
528static struct bfin_sd_host bfin_sdh_data = {
529 .dma_chan = CH_RSI,
530 .irq_int0 = IRQ_RSI_INT0,
531 .pin_req = {P_RSI_DATA0, P_RSI_DATA1, P_RSI_DATA2, P_RSI_DATA3, P_RSI_CMD, P_RSI_CLK, 0},
532};
533
534static struct platform_device bf51x_sdh_device = {
535 .name = "bfin-sdh",
536 .id = 0,
537 .dev = {
538 .platform_data = &bfin_sdh_data,
539 },
540};
541#endif
542
543static struct resource bfin_gpios_resources = {
544 .start = 0,
545 .end = MAX_BLACKFIN_GPIOS - 1,
546 .flags = IORESOURCE_IRQ,
547};
548
549static struct platform_device bfin_gpios_device = {
550 .name = "simple-gpio",
551 .id = -1,
552 .num_resources = 1,
553 .resource = &bfin_gpios_resources,
554};
555
556static const unsigned int cclk_vlev_datasheet[] =
557{
558 VRPAIR(VLEV_100, 400000000),
559 VRPAIR(VLEV_105, 426000000),
560 VRPAIR(VLEV_110, 500000000),
561 VRPAIR(VLEV_115, 533000000),
562 VRPAIR(VLEV_120, 600000000),
563};
564
565static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = {
566 .tuple_tab = cclk_vlev_datasheet,
567 .tabsize = ARRAY_SIZE(cclk_vlev_datasheet),
568 .vr_settling_time = 25 /* us */,
569};
570
571static struct platform_device bfin_dpmc = {
572 .name = "bfin dpmc",
573 .dev = {
574 .platform_data = &bfin_dmpc_vreg_data,
575 },
576};
577
578static struct platform_device *stamp_devices[] __initdata = {
579
580 &bfin_dpmc,
581
582#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
583 &rtc_device,
584#endif
585
586#if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
587 &bfin_mac_device,
588#endif
589
590#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
591 &bfin_spi0_device,
592 &bfin_spi1_device,
593#endif
594
595#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
596 &bfin_uart_device,
597#endif
598
599#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
600#ifdef CONFIG_BFIN_SIR0
601 &bfin_sir0_device,
602#endif
603#ifdef CONFIG_BFIN_SIR1
604 &bfin_sir1_device,
605#endif
606#endif
607
608#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
609 &i2c_bfin_twi_device,
610#endif
611
612#if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
613 &bfin_sport0_uart_device,
614 &bfin_sport1_uart_device,
615#endif
616
617#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
618 &bfin_device_gpiokeys,
619#endif
620
621#if defined(CONFIG_SDH_BFIN) || defined(CONFIG_SDH_BFIN_MODULE)
622 &bf51x_sdh_device,
623#endif
624
625#if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
626 &ezbrd_flash_device,
627#endif
628
629 &bfin_gpios_device,
630};
631
632static int __init ezbrd_init(void)
633{
634 printk(KERN_INFO "%s(): registering device resources\n", __func__);
635
636#ifdef CONFIG_I2C_BOARDINFO
637 i2c_register_board_info(0, bfin_i2c_board_info,
638 ARRAY_SIZE(bfin_i2c_board_info));
639#endif
640
641 platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices));
642 spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
643 return 0;
644}
645
646arch_initcall(ezbrd_init);
647
648void native_machine_restart(char *cmd)
649{
650 /* workaround reboot hang when booting from SPI */
651 if ((bfin_read_SYSCR() & 0x7) == 0x3)
652 bfin_gpio_reset_spi0_ssel1();
653}
654
655void bfin_get_ether_addr(char *addr)
656{
657 /* the MAC is stored in OTP memory page 0xDF */
658 u32 ret;
659 u64 otp_mac;
660 u32 (*otp_read)(u32 page, u32 flags, u64 *page_content) = (void *)0xEF00001A;
661
662 ret = otp_read(0xDF, 0x00, &otp_mac);
663 if (!(ret & 0x1)) {
664 char *otp_mac_p = (char *)&otp_mac;
665 for (ret = 0; ret < 6; ++ret)
666 addr[ret] = otp_mac_p[5 - ret];
667 }
668}
669EXPORT_SYMBOL(bfin_get_ether_addr);
diff --git a/arch/blackfin/mach-bf518/dma.c b/arch/blackfin/mach-bf518/dma.c
new file mode 100644
index 000000000000..698e88ca5104
--- /dev/null
+++ b/arch/blackfin/mach-bf518/dma.c
@@ -0,0 +1,118 @@
1/*
2 * File: arch/blackfin/mach-bf518/dma.c
3 * Based on:
4 * Author: Bryan Wu <cooloney@kernel.org>
5 *
6 * Created:
7 * Description: This file contains the simple DMA Implementation for Blackfin
8 *
9 * Modified:
10 * Copyright 2004-2008 Analog Devices Inc.
11 *
12 * Bugs: Enter bugs at http://blackfin.uclinux.org/
13 *
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 2 of the License, or
17 * (at your option) any later version.
18 *
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
23 *
24 * You should have received a copy of the GNU General Public License
25 * along with this program; if not, see the file COPYING, or write
26 * to the Free Software Foundation, Inc.,
27 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
28 */
29#include <linux/module.h>
30
31#include <asm/blackfin.h>
32#include <asm/dma.h>
33
34struct dma_register *dma_io_base_addr[MAX_DMA_CHANNELS] = {
35 (struct dma_register *) DMA0_NEXT_DESC_PTR,
36 (struct dma_register *) DMA1_NEXT_DESC_PTR,
37 (struct dma_register *) DMA2_NEXT_DESC_PTR,
38 (struct dma_register *) DMA3_NEXT_DESC_PTR,
39 (struct dma_register *) DMA4_NEXT_DESC_PTR,
40 (struct dma_register *) DMA5_NEXT_DESC_PTR,
41 (struct dma_register *) DMA6_NEXT_DESC_PTR,
42 (struct dma_register *) DMA7_NEXT_DESC_PTR,
43 (struct dma_register *) DMA8_NEXT_DESC_PTR,
44 (struct dma_register *) DMA9_NEXT_DESC_PTR,
45 (struct dma_register *) DMA10_NEXT_DESC_PTR,
46 (struct dma_register *) DMA11_NEXT_DESC_PTR,
47 (struct dma_register *) MDMA_S0_NEXT_DESC_PTR,
48 (struct dma_register *) MDMA_D0_NEXT_DESC_PTR,
49 (struct dma_register *) MDMA_S1_NEXT_DESC_PTR,
50 (struct dma_register *) MDMA_D1_NEXT_DESC_PTR,
51};
52EXPORT_SYMBOL(dma_io_base_addr);
53
54int channel2irq(unsigned int channel)
55{
56 int ret_irq = -1;
57
58 switch (channel) {
59 case CH_PPI:
60 ret_irq = IRQ_PPI;
61 break;
62
63 case CH_EMAC_RX:
64 ret_irq = IRQ_MAC_RX;
65 break;
66
67 case CH_EMAC_TX:
68 ret_irq = IRQ_MAC_TX;
69 break;
70
71 case CH_UART1_RX:
72 ret_irq = IRQ_UART1_RX;
73 break;
74
75 case CH_UART1_TX:
76 ret_irq = IRQ_UART1_TX;
77 break;
78
79 case CH_SPORT0_RX:
80 ret_irq = IRQ_SPORT0_RX;
81 break;
82
83 case CH_SPORT0_TX:
84 ret_irq = IRQ_SPORT0_TX;
85 break;
86
87 case CH_SPORT1_RX:
88 ret_irq = IRQ_SPORT1_RX;
89 break;
90
91 case CH_SPORT1_TX:
92 ret_irq = IRQ_SPORT1_TX;
93 break;
94
95 case CH_SPI0:
96 ret_irq = IRQ_SPI0;
97 break;
98
99 case CH_UART0_RX:
100 ret_irq = IRQ_UART0_RX;
101 break;
102
103 case CH_UART0_TX:
104 ret_irq = IRQ_UART0_TX;
105 break;
106
107 case CH_MEM_STREAM0_SRC:
108 case CH_MEM_STREAM0_DEST:
109 ret_irq = IRQ_MEM_DMA0;
110 break;
111
112 case CH_MEM_STREAM1_SRC:
113 case CH_MEM_STREAM1_DEST:
114 ret_irq = IRQ_MEM_DMA1;
115 break;
116 }
117 return ret_irq;
118}
diff --git a/arch/blackfin/mach-bf518/include/mach/anomaly.h b/arch/blackfin/mach-bf518/include/mach/anomaly.h
new file mode 100644
index 000000000000..e5b4bef0edae
--- /dev/null
+++ b/arch/blackfin/mach-bf518/include/mach/anomaly.h
@@ -0,0 +1,79 @@
1/*
2 * File: include/asm-blackfin/mach-bf518/anomaly.h
3 * Bugs: Enter bugs at http://blackfin.uclinux.org/
4 *
5 * Copyright (C) 2004-2008 Analog Devices Inc.
6 * Licensed under the GPL-2 or later.
7 */
8
9/* This file shoule be up to date with:
10 * - ????
11 */
12
13#ifndef _MACH_ANOMALY_H_
14#define _MACH_ANOMALY_H_
15
16/* Multi-Issue Instruction with dsp32shiftimm in slot1 and P-reg Store in slot2 Not Supported */
17#define ANOMALY_05000074 (1)
18/* Rx.H Cannot Be Used to Access 16-bit System MMR Registers */
19#define ANOMALY_05000122 (1)
20/* False Hardware Error from an Access in the Shadow of a Conditional Branch */
21#define ANOMALY_05000245 (1)
22/* Sensitivity To Noise with Slow Input Edge Rates on External SPORT TX and RX Clocks */
23#define ANOMALY_05000265 (1)
24/* False Hardware Errors Caused by Fetches at the Boundary of Reserved Memory */
25#define ANOMALY_05000310 (1)
26/* PPI Underflow Error Goes Undetected in ITU-R 656 Mode */
27#define ANOMALY_05000366 (1)
28/* Lockbox SESR Firmware Does Not Save/Restore Full Context */
29#define ANOMALY_05000405 (1)
30/* Lockbox Firmware Memory Cleanup Routine Does not Clear Registers */
31#define ANOMALY_05000408 (1)
32/* Speculative Fetches Can Cause Undesired External FIFO Operations */
33#define ANOMALY_05000416 (1)
34/* TWI Fall Time (Tof) May Violate the Minimum I2C Specification */
35#define ANOMALY_05000421 (1)
36/* TWI Input Capacitance (Ci) May Violate the Maximum I2C Specification */
37#define ANOMALY_05000422 (1)
38/* Speculative Fetches of Indirect-Pointer Instructions Can Cause False Hardware Errors */
39#define ANOMALY_05000426 (1)
40/* Software System Reset Corrupts PLL_LOCKCNT Register */
41#define ANOMALY_05000430 (1)
42/* Incorrect Use of Stack in Lockbox Firmware During Authentication */
43#define ANOMALY_05000431 (1)
44/* Certain SIC Registers are not Reset After Soft or Core Double Fault Reset */
45#define ANOMALY_05000435 (1)
46/* PORTx_DRIVE and PORTx_HYSTERESIS Registers Read Back Incorrect Values */
47#define ANOMALY_05000438 (1)
48/* Preboot Cannot be Used to Program the PLL_DIV Register */
49#define ANOMALY_05000439 (1)
50/* bfrom_SysControl() Cannot be Used to Write the PLL_DIV Register */
51#define ANOMALY_05000440 (1)
52/* IFLUSH Instruction at End of Hardware Loop Causes Infinite Stall */
53#define ANOMALY_05000443 (1)
54/* Incorrect L1 Instruction Bank B Memory Map Location */
55#define ANOMALY_05000444 (1)
56
57/* Anomalies that don't exist on this proc */
58#define ANOMALY_05000125 (0)
59#define ANOMALY_05000158 (0)
60#define ANOMALY_05000183 (0)
61#define ANOMALY_05000198 (0)
62#define ANOMALY_05000230 (0)
63#define ANOMALY_05000244 (0)
64#define ANOMALY_05000261 (0)
65#define ANOMALY_05000263 (0)
66#define ANOMALY_05000266 (0)
67#define ANOMALY_05000273 (0)
68#define ANOMALY_05000285 (0)
69#define ANOMALY_05000307 (0)
70#define ANOMALY_05000311 (0)
71#define ANOMALY_05000312 (0)
72#define ANOMALY_05000323 (0)
73#define ANOMALY_05000353 (0)
74#define ANOMALY_05000363 (0)
75#define ANOMALY_05000386 (0)
76#define ANOMALY_05000412 (0)
77#define ANOMALY_05000432 (0)
78
79#endif
diff --git a/arch/blackfin/mach-bf518/include/mach/bf518.h b/arch/blackfin/mach-bf518/include/mach/bf518.h
new file mode 100644
index 000000000000..78da1a07ee73
--- /dev/null
+++ b/arch/blackfin/mach-bf518/include/mach/bf518.h
@@ -0,0 +1,132 @@
1/*
2 * File: include/asm-blackfin/mach-bf518/bf518.h
3 * Based on: include/asm-blackfin/mach-bf527/bf527.h
4 * Author: Michael Hennerich (michael.hennerich@analog.com)
5 *
6 * Created:
7 * Description: SYSTEM MMR REGISTER AND MEMORY MAP FOR ADSP-BF518
8 *
9 * Modified:
10 * Copyright 2004-2007 Analog Devices Inc.
11 *
12 * Bugs: Enter bugs at http://blackfin.uclinux.org/
13 *
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 2 of the License, or
17 * (at your option) any later version.
18 *
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
23 *
24 * You should have received a copy of the GNU General Public License
25 * along with this program; if not, see the file COPYING, or write
26 * to the Free Software Foundation, Inc.,
27 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
28 */
29
30#ifndef __MACH_BF518_H__
31#define __MACH_BF518_H__
32
33#define OFFSET_(x) ((x) & 0x0000FFFF)
34
35/*some misc defines*/
36#define IMASK_IVG15 0x8000
37#define IMASK_IVG14 0x4000
38#define IMASK_IVG13 0x2000
39#define IMASK_IVG12 0x1000
40
41#define IMASK_IVG11 0x0800
42#define IMASK_IVG10 0x0400
43#define IMASK_IVG9 0x0200
44#define IMASK_IVG8 0x0100
45
46#define IMASK_IVG7 0x0080
47#define IMASK_IVGTMR 0x0040
48#define IMASK_IVGHW 0x0020
49
50/***************************/
51
52#define BFIN_DSUBBANKS 4
53#define BFIN_DWAYS 2
54#define BFIN_DLINES 64
55#define BFIN_ISUBBANKS 4
56#define BFIN_IWAYS 4
57#define BFIN_ILINES 32
58
59#define WAY0_L 0x1
60#define WAY1_L 0x2
61#define WAY01_L 0x3
62#define WAY2_L 0x4
63#define WAY02_L 0x5
64#define WAY12_L 0x6
65#define WAY012_L 0x7
66
67#define WAY3_L 0x8
68#define WAY03_L 0x9
69#define WAY13_L 0xA
70#define WAY013_L 0xB
71
72#define WAY32_L 0xC
73#define WAY320_L 0xD
74#define WAY321_L 0xE
75#define WAYALL_L 0xF
76
77#define DMC_ENABLE (2<<2) /*yes, 2, not 1 */
78
79/********************************* EBIU Settings ************************************/
80#define AMBCTL0VAL ((CONFIG_BANK_1 << 16) | CONFIG_BANK_0)
81#define AMBCTL1VAL ((CONFIG_BANK_3 << 16) | CONFIG_BANK_2)
82
83#ifdef CONFIG_C_AMBEN_ALL
84#define V_AMBEN AMBEN_ALL
85#endif
86#ifdef CONFIG_C_AMBEN
87#define V_AMBEN 0x0
88#endif
89#ifdef CONFIG_C_AMBEN_B0
90#define V_AMBEN AMBEN_B0
91#endif
92#ifdef CONFIG_C_AMBEN_B0_B1
93#define V_AMBEN AMBEN_B0_B1
94#endif
95#ifdef CONFIG_C_AMBEN_B0_B1_B2
96#define V_AMBEN AMBEN_B0_B1_B2
97#endif
98#ifdef CONFIG_C_AMCKEN
99#define V_AMCKEN AMCKEN
100#else
101#define V_AMCKEN 0x0
102#endif
103#ifdef CONFIG_C_CDPRIO
104#define V_CDPRIO 0x100
105#else
106#define V_CDPRIO 0x0
107#endif
108
109#define AMGCTLVAL (V_AMBEN | V_AMCKEN | V_CDPRIO)
110
111#ifdef CONFIG_BF518
112#define CPU "BF518"
113#define CPUID 0x27e8
114#endif
115#ifdef CONFIG_BF516
116#define CPU "BF516"
117#define CPUID 0x27e8
118#endif
119#ifdef CONFIG_BF514
120#define CPU "BF514"
121#define CPUID 0x27e8
122#endif
123#ifdef CONFIG_BF512
124#define CPU "BF512"
125#define CPUID 0x27e8
126#endif
127
128#ifndef CPU
129#error "Unknown CPU type - This kernel doesn't seem to be configured properly"
130#endif
131
132#endif /* __MACH_BF518_H__ */
diff --git a/arch/blackfin/mach-bf518/include/mach/bfin_serial_5xx.h b/arch/blackfin/mach-bf518/include/mach/bfin_serial_5xx.h
new file mode 100644
index 000000000000..b50a63b975a2
--- /dev/null
+++ b/arch/blackfin/mach-bf518/include/mach/bfin_serial_5xx.h
@@ -0,0 +1,169 @@
1/*
2 * file: include/asm-blackfin/mach-bf518/bfin_serial_5xx.h
3 * based on:
4 * author:
5 *
6 * created:
7 * description:
8 * blackfin serial driver head file
9 * rev:
10 *
11 * modified:
12 *
13 *
14 * bugs: enter bugs at http://blackfin.uclinux.org/
15 *
16 * this program is free software; you can redistribute it and/or modify
17 * it under the terms of the gnu general public license as published by
18 * the free software foundation; either version 2, or (at your option)
19 * any later version.
20 *
21 * this program is distributed in the hope that it will be useful,
22 * but without any warranty; without even the implied warranty of
23 * merchantability or fitness for a particular purpose. see the
24 * gnu general public license for more details.
25 *
26 * you should have received a copy of the gnu general public license
27 * along with this program; see the file copying.
28 * if not, write to the free software foundation,
29 * 59 temple place - suite 330, boston, ma 02111-1307, usa.
30 */
31
32#include <linux/serial.h>
33#include <asm/dma.h>
34#include <asm/portmux.h>
35
36#define UART_GET_CHAR(uart) bfin_read16(((uart)->port.membase + OFFSET_RBR))
37#define UART_GET_DLL(uart) bfin_read16(((uart)->port.membase + OFFSET_DLL))
38#define UART_GET_IER(uart) bfin_read16(((uart)->port.membase + OFFSET_IER))
39#define UART_GET_DLH(uart) bfin_read16(((uart)->port.membase + OFFSET_DLH))
40#define UART_GET_IIR(uart) bfin_read16(((uart)->port.membase + OFFSET_IIR))
41#define UART_GET_LCR(uart) bfin_read16(((uart)->port.membase + OFFSET_LCR))
42#define UART_GET_GCTL(uart) bfin_read16(((uart)->port.membase + OFFSET_GCTL))
43
44#define UART_PUT_CHAR(uart, v) bfin_write16(((uart)->port.membase + OFFSET_THR), v)
45#define UART_PUT_DLL(uart, v) bfin_write16(((uart)->port.membase + OFFSET_DLL), v)
46#define UART_PUT_IER(uart, v) bfin_write16(((uart)->port.membase + OFFSET_IER), v)
47#define UART_SET_IER(uart, v) UART_PUT_IER(uart, UART_GET_IER(uart) | (v))
48#define UART_CLEAR_IER(uart, v) UART_PUT_IER(uart, UART_GET_IER(uart) & ~(v))
49#define UART_PUT_DLH(uart, v) bfin_write16(((uart)->port.membase + OFFSET_DLH), v)
50#define UART_PUT_LCR(uart, v) bfin_write16(((uart)->port.membase + OFFSET_LCR), v)
51#define UART_PUT_GCTL(uart, v) bfin_write16(((uart)->port.membase + OFFSET_GCTL), v)
52
53#define UART_SET_DLAB(uart) do { UART_PUT_LCR(uart, UART_GET_LCR(uart) | DLAB); SSYNC(); } while (0)
54#define UART_CLEAR_DLAB(uart) do { UART_PUT_LCR(uart, UART_GET_LCR(uart) & ~DLAB); SSYNC(); } while (0)
55
56#define UART_GET_CTS(x) gpio_get_value(x->cts_pin)
57#define UART_SET_RTS(x) gpio_set_value(x->rts_pin, 1)
58#define UART_CLEAR_RTS(x) gpio_set_value(x->rts_pin, 0)
59#define UART_ENABLE_INTS(x, v) UART_PUT_IER(x, v)
60#define UART_DISABLE_INTS(x) UART_PUT_IER(x, 0)
61
62#if defined(CONFIG_BFIN_UART0_CTSRTS) || defined(CONFIG_BFIN_UART1_CTSRTS)
63# define CONFIG_SERIAL_BFIN_CTSRTS
64
65# ifndef CONFIG_UART0_CTS_PIN
66# define CONFIG_UART0_CTS_PIN -1
67# endif
68
69# ifndef CONFIG_UART0_RTS_PIN
70# define CONFIG_UART0_RTS_PIN -1
71# endif
72
73# ifndef CONFIG_UART1_CTS_PIN
74# define CONFIG_UART1_CTS_PIN -1
75# endif
76
77# ifndef CONFIG_UART1_RTS_PIN
78# define CONFIG_UART1_RTS_PIN -1
79# endif
80#endif
81
82#define BFIN_UART_TX_FIFO_SIZE 2
83
84/*
85 * The pin configuration is different from schematic
86 */
87struct bfin_serial_port {
88 struct uart_port port;
89 unsigned int old_status;
90 unsigned int lsr;
91#ifdef CONFIG_SERIAL_BFIN_DMA
92 int tx_done;
93 int tx_count;
94 struct circ_buf rx_dma_buf;
95 struct timer_list rx_dma_timer;
96 int rx_dma_nrows;
97 unsigned int tx_dma_channel;
98 unsigned int rx_dma_channel;
99 struct work_struct tx_dma_workqueue;
100#endif
101#ifdef CONFIG_SERIAL_BFIN_CTSRTS
102 struct timer_list cts_timer;
103 int cts_pin;
104 int rts_pin;
105#endif
106};
107
108/* The hardware clears the LSR bits upon read, so we need to cache
109 * some of the more fun bits in software so they don't get lost
110 * when checking the LSR in other code paths (TX).
111 */
112static inline unsigned int UART_GET_LSR(struct bfin_serial_port *uart)
113{
114 unsigned int lsr = bfin_read16(uart->port.membase + OFFSET_LSR);
115 uart->lsr |= (lsr & (BI|FE|PE|OE));
116 return lsr | uart->lsr;
117}
118
119static inline void UART_CLEAR_LSR(struct bfin_serial_port *uart)
120{
121 uart->lsr = 0;
122 bfin_write16(uart->port.membase + OFFSET_LSR, -1);
123}
124
125struct bfin_serial_res {
126 unsigned long uart_base_addr;
127 int uart_irq;
128#ifdef CONFIG_SERIAL_BFIN_DMA
129 unsigned int uart_tx_dma_channel;
130 unsigned int uart_rx_dma_channel;
131#endif
132#ifdef CONFIG_SERIAL_BFIN_CTSRTS
133 int uart_cts_pin;
134 int uart_rts_pin;
135#endif
136};
137
138struct bfin_serial_res bfin_serial_resource[] = {
139#ifdef CONFIG_SERIAL_BFIN_UART0
140 {
141 0xFFC00400,
142 IRQ_UART0_RX,
143#ifdef CONFIG_SERIAL_BFIN_DMA
144 CH_UART0_TX,
145 CH_UART0_RX,
146#endif
147#ifdef CONFIG_BFIN_UART0_CTSRTS
148 CONFIG_UART0_CTS_PIN,
149 CONFIG_UART0_RTS_PIN,
150#endif
151 },
152#endif
153#ifdef CONFIG_SERIAL_BFIN_UART1
154 {
155 0xFFC02000,
156 IRQ_UART1_RX,
157#ifdef CONFIG_SERIAL_BFIN_DMA
158 CH_UART1_TX,
159 CH_UART1_RX,
160#endif
161#ifdef CONFIG_BFIN_UART1_CTSRTS
162 CONFIG_UART1_CTS_PIN,
163 CONFIG_UART1_RTS_PIN,
164#endif
165 },
166#endif
167};
168
169#define DRIVER_NAME "bfin-uart"
diff --git a/arch/blackfin/mach-bf518/include/mach/blackfin.h b/arch/blackfin/mach-bf518/include/mach/blackfin.h
new file mode 100644
index 000000000000..d1a2b9ca6227
--- /dev/null
+++ b/arch/blackfin/mach-bf518/include/mach/blackfin.h
@@ -0,0 +1,105 @@
1/*
2 * File: include/asm-blackfin/mach-bf518/blackfin.h
3 * Based on:
4 * Author:
5 *
6 * Created:
7 * Description:
8 *
9 * Rev:
10 *
11 * Modified:
12 *
13 *
14 * Bugs: Enter bugs at http://blackfin.uclinux.org/
15 *
16 * This program is free software; you can redistribute it and/or modify
17 * it under the terms of the GNU General Public License as published by
18 * the Free Software Foundation; either version 2, or (at your option)
19 * any later version.
20 *
21 * This program is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 * GNU General Public License for more details.
25 *
26 * You should have received a copy of the GNU General Public License
27 * along with this program; see the file COPYING.
28 * If not, write to the Free Software Foundation,
29 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
30 */
31
32#ifndef _MACH_BLACKFIN_H_
33#define _MACH_BLACKFIN_H_
34
35#define BF518_FAMILY
36
37#include "bf518.h"
38#include "mem_map.h"
39#include "defBF512.h"
40#include "anomaly.h"
41
42#if defined(CONFIG_BF518)
43#include "defBF518.h"
44#endif
45
46#if defined(CONFIG_BF516)
47#include "defBF516.h"
48#endif
49
50#if defined(CONFIG_BF514)
51#include "defBF514.h"
52#endif
53
54#if defined(CONFIG_BF512)
55#include "defBF512.h"
56#endif
57
58#if !defined(__ASSEMBLY__)
59#include "cdefBF512.h"
60
61#if defined(CONFIG_BF518)
62#include "cdefBF518.h"
63#endif
64
65#if defined(CONFIG_BF516)
66#include "cdefBF516.h"
67#endif
68
69#if defined(CONFIG_BF514)
70#include "cdefBF514.h"
71#endif
72#endif
73
74/* UART_IIR Register */
75#define STATUS(x) ((x << 1) & 0x06)
76#define STATUS_P1 0x02
77#define STATUS_P0 0x01
78
79#define BFIN_UART_NR_PORTS 2
80
81#define OFFSET_THR 0x00 /* Transmit Holding register */
82#define OFFSET_RBR 0x00 /* Receive Buffer register */
83#define OFFSET_DLL 0x00 /* Divisor Latch (Low-Byte) */
84#define OFFSET_IER 0x04 /* Interrupt Enable Register */
85#define OFFSET_DLH 0x04 /* Divisor Latch (High-Byte) */
86#define OFFSET_IIR 0x08 /* Interrupt Identification Register */
87#define OFFSET_LCR 0x0C /* Line Control Register */
88#define OFFSET_MCR 0x10 /* Modem Control Register */
89#define OFFSET_LSR 0x14 /* Line Status Register */
90#define OFFSET_MSR 0x18 /* Modem Status Register */
91#define OFFSET_SCR 0x1C /* SCR Scratch Register */
92#define OFFSET_GCTL 0x24 /* Global Control Register */
93
94/* DPMC*/
95#define bfin_read_STOPCK_OFF() bfin_read_STOPCK()
96#define bfin_write_STOPCK_OFF(val) bfin_write_STOPCK(val)
97#define STOPCK_OFF STOPCK
98
99/* PLL_DIV Masks */
100#define CCLK_DIV1 CSEL_DIV1 /* CCLK = VCO / 1 */
101#define CCLK_DIV2 CSEL_DIV2 /* CCLK = VCO / 2 */
102#define CCLK_DIV4 CSEL_DIV4 /* CCLK = VCO / 4 */
103#define CCLK_DIV8 CSEL_DIV8 /* CCLK = VCO / 8 */
104
105#endif
diff --git a/arch/blackfin/mach-bf518/include/mach/cdefBF512.h b/arch/blackfin/mach-bf518/include/mach/cdefBF512.h
new file mode 100644
index 000000000000..820c13c4daaa
--- /dev/null
+++ b/arch/blackfin/mach-bf518/include/mach/cdefBF512.h
@@ -0,0 +1,46 @@
1/*
2 * File: include/asm-blackfin/mach-bf518/cdefbf512.h
3 * Based on:
4 * Author:
5 *
6 * Created:
7 * Description: system mmr register map
8 *
9 * Rev:
10 *
11 * Modified:
12 *
13 *
14 * Bugs: Enter bugs at http://blackfin.uclinux.org/
15 *
16 * This program is free software; you can redistribute it and/or modify
17 * it under the terms of the GNU General Public License as published by
18 * the Free Software Foundation; either version 2, or (at your option)
19 * any later version.
20 *
21 * This program is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 * GNU General Public License for more details.
25 *
26 * You should have received a copy of the GNU General Public License
27 * along with this program; see the file COPYING.
28 * If not, write to the Free Software Foundation,
29 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
30 */
31
32#ifndef _CDEF_BF512_H
33#define _CDEF_BF512_H
34
35/* include all Core registers and bit definitions */
36#include "defBF512.h"
37
38/* include core specific register pointer definitions */
39#include <asm/cdef_LPBlackfin.h>
40
41/* SYSTEM & MMR ADDRESS DEFINITIONS FOR ADSP-BF512 */
42
43/* include cdefBF51x_base.h for the set of #defines that are common to all ADSP-BF51x processors */
44#include "cdefBF51x_base.h"
45
46#endif /* _CDEF_BF512_H */
diff --git a/arch/blackfin/mach-bf518/include/mach/cdefBF514.h b/arch/blackfin/mach-bf518/include/mach/cdefBF514.h
new file mode 100644
index 000000000000..9521e178fb28
--- /dev/null
+++ b/arch/blackfin/mach-bf518/include/mach/cdefBF514.h
@@ -0,0 +1,48 @@
1/*
2 * File: include/asm-blackfin/mach-bf518/cdefbf514.h
3 * Based on:
4 * Author:
5 *
6 * Created:
7 * Description: system mmr register map
8 *
9 * Rev:
10 *
11 * Modified:
12 *
13 *
14 * Bugs: Enter bugs at http://blackfin.uclinux.org/
15 *
16 * This program is free software; you can redistribute it and/or modify
17 * it under the terms of the GNU General Public License as published by
18 * the Free Software Foundation; either version 2, or (at your option)
19 * any later version.
20 *
21 * This program is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 * GNU General Public License for more details.
25 *
26 * You should have received a copy of the GNU General Public License
27 * along with this program; see the file COPYING.
28 * If not, write to the Free Software Foundation,
29 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
30 */
31
32#ifndef _CDEF_BF514_H
33#define _CDEF_BF514_H
34
35/* include all Core registers and bit definitions */
36#include "defBF514.h"
37
38/* include core specific register pointer definitions */
39#include <asm/cdef_LPBlackfin.h>
40
41/* SYSTEM & MMR ADDRESS DEFINITIONS FOR ADSP-BF514 */
42
43/* include cdefBF51x_base.h for the set of #defines that are common to all ADSP-BF51x processors */
44#include "cdefBF51x_base.h"
45
46/* The following are the #defines needed by ADSP-BF514 that are not in the common header */
47
48#endif /* _CDEF_BF514_H */
diff --git a/arch/blackfin/mach-bf518/include/mach/cdefBF516.h b/arch/blackfin/mach-bf518/include/mach/cdefBF516.h
new file mode 100644
index 000000000000..4e26ccfcef97
--- /dev/null
+++ b/arch/blackfin/mach-bf518/include/mach/cdefBF516.h
@@ -0,0 +1,213 @@
1/*
2 * File: include/asm-blackfin/mach-bf518/cdefbf516.h
3 * Based on:
4 * Author:
5 *
6 * Created:
7 * Description: system mmr register map
8 *
9 * Rev:
10 *
11 * Modified:
12 *
13 *
14 * Bugs: Enter bugs at http://blackfin.uclinux.org/
15 *
16 * This program is free software; you can redistribute it and/or modify
17 * it under the terms of the GNU General Public License as published by
18 * the Free Software Foundation; either version 2, or (at your option)
19 * any later version.
20 *
21 * This program is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 * GNU General Public License for more details.
25 *
26 * You should have received a copy of the GNU General Public License
27 * along with this program; see the file COPYING.
28 * If not, write to the Free Software Foundation,
29 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
30 */
31
32#ifndef _CDEF_BF516_H
33#define _CDEF_BF516_H
34
35/* include all Core registers and bit definitions */
36#include "defBF516.h"
37
38/* include core specific register pointer definitions */
39#include <asm/cdef_LPBlackfin.h>
40
41/* SYSTEM & MMR ADDRESS DEFINITIONS FOR ADSP-BF516 */
42
43/* include cdefBF51x_base.h for the set of #defines that are common to all ADSP-BF51x processors */
44#include "cdefBF51x_base.h"
45
46/* The following are the #defines needed by ADSP-BF516 that are not in the common header */
47
48/* 10/100 Ethernet Controller (0xFFC03000 - 0xFFC031FF) */
49
50#define bfin_read_EMAC_OPMODE() bfin_read32(EMAC_OPMODE)
51#define bfin_write_EMAC_OPMODE(val) bfin_write32(EMAC_OPMODE, val)
52#define bfin_read_EMAC_ADDRLO() bfin_read32(EMAC_ADDRLO)
53#define bfin_write_EMAC_ADDRLO(val) bfin_write32(EMAC_ADDRLO, val)
54#define bfin_read_EMAC_ADDRHI() bfin_read32(EMAC_ADDRHI)
55#define bfin_write_EMAC_ADDRHI(val) bfin_write32(EMAC_ADDRHI, val)
56#define bfin_read_EMAC_HASHLO() bfin_read32(EMAC_HASHLO)
57#define bfin_write_EMAC_HASHLO(val) bfin_write32(EMAC_HASHLO, val)
58#define bfin_read_EMAC_HASHHI() bfin_read32(EMAC_HASHHI)
59#define bfin_write_EMAC_HASHHI(val) bfin_write32(EMAC_HASHHI, val)
60#define bfin_read_EMAC_STAADD() bfin_read32(EMAC_STAADD)
61#define bfin_write_EMAC_STAADD(val) bfin_write32(EMAC_STAADD, val)
62#define bfin_read_EMAC_STADAT() bfin_read32(EMAC_STADAT)
63#define bfin_write_EMAC_STADAT(val) bfin_write32(EMAC_STADAT, val)
64#define bfin_read_EMAC_FLC() bfin_read32(EMAC_FLC)
65#define bfin_write_EMAC_FLC(val) bfin_write32(EMAC_FLC, val)
66#define bfin_read_EMAC_VLAN1() bfin_read32(EMAC_VLAN1)
67#define bfin_write_EMAC_VLAN1(val) bfin_write32(EMAC_VLAN1, val)
68#define bfin_read_EMAC_VLAN2() bfin_read32(EMAC_VLAN2)
69#define bfin_write_EMAC_VLAN2(val) bfin_write32(EMAC_VLAN2, val)
70#define bfin_read_EMAC_WKUP_CTL() bfin_read32(EMAC_WKUP_CTL)
71#define bfin_write_EMAC_WKUP_CTL(val) bfin_write32(EMAC_WKUP_CTL, val)
72#define bfin_read_EMAC_WKUP_FFMSK0() bfin_read32(EMAC_WKUP_FFMSK0)
73#define bfin_write_EMAC_WKUP_FFMSK0(val) bfin_write32(EMAC_WKUP_FFMSK0, val)
74#define bfin_read_EMAC_WKUP_FFMSK1() bfin_read32(EMAC_WKUP_FFMSK1)
75#define bfin_write_EMAC_WKUP_FFMSK1(val) bfin_write32(EMAC_WKUP_FFMSK1, val)
76#define bfin_read_EMAC_WKUP_FFMSK2() bfin_read32(EMAC_WKUP_FFMSK2)
77#define bfin_write_EMAC_WKUP_FFMSK2(val) bfin_write32(EMAC_WKUP_FFMSK2, val)
78#define bfin_read_EMAC_WKUP_FFMSK3() bfin_read32(EMAC_WKUP_FFMSK3)
79#define bfin_write_EMAC_WKUP_FFMSK3(val) bfin_write32(EMAC_WKUP_FFMSK3, val)
80#define bfin_read_EMAC_WKUP_FFCMD() bfin_read32(EMAC_WKUP_FFCMD)
81#define bfin_write_EMAC_WKUP_FFCMD(val) bfin_write32(EMAC_WKUP_FFCMD, val)
82#define bfin_read_EMAC_WKUP_FFOFF() bfin_read32(EMAC_WKUP_FFOFF)
83#define bfin_write_EMAC_WKUP_FFOFF(val) bfin_write32(EMAC_WKUP_FFOFF, val)
84#define bfin_read_EMAC_WKUP_FFCRC0() bfin_read32(EMAC_WKUP_FFCRC0)
85#define bfin_write_EMAC_WKUP_FFCRC0(val) bfin_write32(EMAC_WKUP_FFCRC0, val)
86#define bfin_read_EMAC_WKUP_FFCRC1() bfin_read32(EMAC_WKUP_FFCRC1)
87#define bfin_write_EMAC_WKUP_FFCRC1(val) bfin_write32(EMAC_WKUP_FFCRC1, val)
88
89#define bfin_read_EMAC_SYSCTL() bfin_read32(EMAC_SYSCTL)
90#define bfin_write_EMAC_SYSCTL(val) bfin_write32(EMAC_SYSCTL, val)
91#define bfin_read_EMAC_SYSTAT() bfin_read32(EMAC_SYSTAT)
92#define bfin_write_EMAC_SYSTAT(val) bfin_write32(EMAC_SYSTAT, val)
93#define bfin_read_EMAC_RX_STAT() bfin_read32(EMAC_RX_STAT)
94#define bfin_write_EMAC_RX_STAT(val) bfin_write32(EMAC_RX_STAT, val)
95#define bfin_read_EMAC_RX_STKY() bfin_read32(EMAC_RX_STKY)
96#define bfin_write_EMAC_RX_STKY(val) bfin_write32(EMAC_RX_STKY, val)
97#define bfin_read_EMAC_RX_IRQE() bfin_read32(EMAC_RX_IRQE)
98#define bfin_write_EMAC_RX_IRQE(val) bfin_write32(EMAC_RX_IRQE, val)
99#define bfin_read_EMAC_TX_STAT() bfin_read32(EMAC_TX_STAT)
100#define bfin_write_EMAC_TX_STAT(val) bfin_write32(EMAC_TX_STAT, val)
101#define bfin_read_EMAC_TX_STKY() bfin_read32(EMAC_TX_STKY)
102#define bfin_write_EMAC_TX_STKY(val) bfin_write32(EMAC_TX_STKY, val)
103#define bfin_read_EMAC_TX_IRQE() bfin_read32(EMAC_TX_IRQE)
104#define bfin_write_EMAC_TX_IRQE(val) bfin_write32(EMAC_TX_IRQE, val)
105
106#define bfin_read_EMAC_MMC_CTL() bfin_read32(EMAC_MMC_CTL)
107#define bfin_write_EMAC_MMC_CTL(val) bfin_write32(EMAC_MMC_CTL, val)
108#define bfin_read_EMAC_MMC_RIRQS() bfin_read32(EMAC_MMC_RIRQS)
109#define bfin_write_EMAC_MMC_RIRQS(val) bfin_write32(EMAC_MMC_RIRQS, val)
110#define bfin_read_EMAC_MMC_RIRQE() bfin_read32(EMAC_MMC_RIRQE)
111#define bfin_write_EMAC_MMC_RIRQE(val) bfin_write32(EMAC_MMC_RIRQE, val)
112#define bfin_read_EMAC_MMC_TIRQS() bfin_read32(EMAC_MMC_TIRQS)
113#define bfin_write_EMAC_MMC_TIRQS(val) bfin_write32(EMAC_MMC_TIRQS, val)
114#define bfin_read_EMAC_MMC_TIRQE() bfin_read32(EMAC_MMC_TIRQE)
115#define bfin_write_EMAC_MMC_TIRQE(val) bfin_write32(EMAC_MMC_TIRQE, val)
116
117#define bfin_read_EMAC_RXC_OK() bfin_read32(EMAC_RXC_OK)
118#define bfin_write_EMAC_RXC_OK(val) bfin_write32(EMAC_RXC_OK, val)
119#define bfin_read_EMAC_RXC_FCS() bfin_read32(EMAC_RXC_FCS)
120#define bfin_write_EMAC_RXC_FCS(val) bfin_write32(EMAC_RXC_FCS, val)
121#define bfin_read_EMAC_RXC_ALIGN() bfin_read32(EMAC_RXC_ALIGN)
122#define bfin_write_EMAC_RXC_ALIGN(val) bfin_write32(EMAC_RXC_ALIGN, val)
123#define bfin_read_EMAC_RXC_OCTET() bfin_read32(EMAC_RXC_OCTET)
124#define bfin_write_EMAC_RXC_OCTET(val) bfin_write32(EMAC_RXC_OCTET, val)
125#define bfin_read_EMAC_RXC_DMAOVF() bfin_read32(EMAC_RXC_DMAOVF)
126#define bfin_write_EMAC_RXC_DMAOVF(val) bfin_write32(EMAC_RXC_DMAOVF, val)
127#define bfin_read_EMAC_RXC_UNICST() bfin_read32(EMAC_RXC_UNICST)
128#define bfin_write_EMAC_RXC_UNICST(val) bfin_write32(EMAC_RXC_UNICST, val)
129#define bfin_read_EMAC_RXC_MULTI() bfin_read32(EMAC_RXC_MULTI)
130#define bfin_write_EMAC_RXC_MULTI(val) bfin_write32(EMAC_RXC_MULTI, val)
131#define bfin_read_EMAC_RXC_BROAD() bfin_read32(EMAC_RXC_BROAD)
132#define bfin_write_EMAC_RXC_BROAD(val) bfin_write32(EMAC_RXC_BROAD, val)
133#define bfin_read_EMAC_RXC_LNERRI() bfin_read32(EMAC_RXC_LNERRI)
134#define bfin_write_EMAC_RXC_LNERRI(val) bfin_write32(EMAC_RXC_LNERRI, val)
135#define bfin_read_EMAC_RXC_LNERRO() bfin_read32(EMAC_RXC_LNERRO)
136#define bfin_write_EMAC_RXC_LNERRO(val) bfin_write32(EMAC_RXC_LNERRO, val)
137#define bfin_read_EMAC_RXC_LONG() bfin_read32(EMAC_RXC_LONG)
138#define bfin_write_EMAC_RXC_LONG(val) bfin_write32(EMAC_RXC_LONG, val)
139#define bfin_read_EMAC_RXC_MACCTL() bfin_read32(EMAC_RXC_MACCTL)
140#define bfin_write_EMAC_RXC_MACCTL(val) bfin_write32(EMAC_RXC_MACCTL, val)
141#define bfin_read_EMAC_RXC_OPCODE() bfin_read32(EMAC_RXC_OPCODE)
142#define bfin_write_EMAC_RXC_OPCODE(val) bfin_write32(EMAC_RXC_OPCODE, val)
143#define bfin_read_EMAC_RXC_PAUSE() bfin_read32(EMAC_RXC_PAUSE)
144#define bfin_write_EMAC_RXC_PAUSE(val) bfin_write32(EMAC_RXC_PAUSE, val)
145#define bfin_read_EMAC_RXC_ALLFRM() bfin_read32(EMAC_RXC_ALLFRM)
146#define bfin_write_EMAC_RXC_ALLFRM(val) bfin_write32(EMAC_RXC_ALLFRM, val)
147#define bfin_read_EMAC_RXC_ALLOCT() bfin_read32(EMAC_RXC_ALLOCT)
148#define bfin_write_EMAC_RXC_ALLOCT(val) bfin_write32(EMAC_RXC_ALLOCT, val)
149#define bfin_read_EMAC_RXC_TYPED() bfin_read32(EMAC_RXC_TYPED)
150#define bfin_write_EMAC_RXC_TYPED(val) bfin_write32(EMAC_RXC_TYPED, val)
151#define bfin_read_EMAC_RXC_SHORT() bfin_read32(EMAC_RXC_SHORT)
152#define bfin_write_EMAC_RXC_SHORT(val) bfin_write32(EMAC_RXC_SHORT, val)
153#define bfin_read_EMAC_RXC_EQ64() bfin_read32(EMAC_RXC_EQ64)
154#define bfin_write_EMAC_RXC_EQ64(val) bfin_write32(EMAC_RXC_EQ64, val)
155#define bfin_read_EMAC_RXC_LT128() bfin_read32(EMAC_RXC_LT128)
156#define bfin_write_EMAC_RXC_LT128(val) bfin_write32(EMAC_RXC_LT128, val)
157#define bfin_read_EMAC_RXC_LT256() bfin_read32(EMAC_RXC_LT256)
158#define bfin_write_EMAC_RXC_LT256(val) bfin_write32(EMAC_RXC_LT256, val)
159#define bfin_read_EMAC_RXC_LT512() bfin_read32(EMAC_RXC_LT512)
160#define bfin_write_EMAC_RXC_LT512(val) bfin_write32(EMAC_RXC_LT512, val)
161#define bfin_read_EMAC_RXC_LT1024() bfin_read32(EMAC_RXC_LT1024)
162#define bfin_write_EMAC_RXC_LT1024(val) bfin_write32(EMAC_RXC_LT1024, val)
163#define bfin_read_EMAC_RXC_GE1024() bfin_read32(EMAC_RXC_GE1024)
164#define bfin_write_EMAC_RXC_GE1024(val) bfin_write32(EMAC_RXC_GE1024, val)
165
166#define bfin_read_EMAC_TXC_OK() bfin_read32(EMAC_TXC_OK)
167#define bfin_write_EMAC_TXC_OK(val) bfin_write32(EMAC_TXC_OK, val)
168#define bfin_read_EMAC_TXC_1COL() bfin_read32(EMAC_TXC_1COL)
169#define bfin_write_EMAC_TXC_1COL(val) bfin_write32(EMAC_TXC_1COL, val)
170#define bfin_read_EMAC_TXC_GT1COL() bfin_read32(EMAC_TXC_GT1COL)
171#define bfin_write_EMAC_TXC_GT1COL(val) bfin_write32(EMAC_TXC_GT1COL, val)
172#define bfin_read_EMAC_TXC_OCTET() bfin_read32(EMAC_TXC_OCTET)
173#define bfin_write_EMAC_TXC_OCTET(val) bfin_write32(EMAC_TXC_OCTET, val)
174#define bfin_read_EMAC_TXC_DEFER() bfin_read32(EMAC_TXC_DEFER)
175#define bfin_write_EMAC_TXC_DEFER(val) bfin_write32(EMAC_TXC_DEFER, val)
176#define bfin_read_EMAC_TXC_LATECL() bfin_read32(EMAC_TXC_LATECL)
177#define bfin_write_EMAC_TXC_LATECL(val) bfin_write32(EMAC_TXC_LATECL, val)
178#define bfin_read_EMAC_TXC_XS_COL() bfin_read32(EMAC_TXC_XS_COL)
179#define bfin_write_EMAC_TXC_XS_COL(val) bfin_write32(EMAC_TXC_XS_COL, val)
180#define bfin_read_EMAC_TXC_DMAUND() bfin_read32(EMAC_TXC_DMAUND)
181#define bfin_write_EMAC_TXC_DMAUND(val) bfin_write32(EMAC_TXC_DMAUND, val)
182#define bfin_read_EMAC_TXC_CRSERR() bfin_read32(EMAC_TXC_CRSERR)
183#define bfin_write_EMAC_TXC_CRSERR(val) bfin_write32(EMAC_TXC_CRSERR, val)
184#define bfin_read_EMAC_TXC_UNICST() bfin_read32(EMAC_TXC_UNICST)
185#define bfin_write_EMAC_TXC_UNICST(val) bfin_write32(EMAC_TXC_UNICST, val)
186#define bfin_read_EMAC_TXC_MULTI() bfin_read32(EMAC_TXC_MULTI)
187#define bfin_write_EMAC_TXC_MULTI(val) bfin_write32(EMAC_TXC_MULTI, val)
188#define bfin_read_EMAC_TXC_BROAD() bfin_read32(EMAC_TXC_BROAD)
189#define bfin_write_EMAC_TXC_BROAD(val) bfin_write32(EMAC_TXC_BROAD, val)
190#define bfin_read_EMAC_TXC_XS_DFR() bfin_read32(EMAC_TXC_XS_DFR)
191#define bfin_write_EMAC_TXC_XS_DFR(val) bfin_write32(EMAC_TXC_XS_DFR, val)
192#define bfin_read_EMAC_TXC_MACCTL() bfin_read32(EMAC_TXC_MACCTL)
193#define bfin_write_EMAC_TXC_MACCTL(val) bfin_write32(EMAC_TXC_MACCTL, val)
194#define bfin_read_EMAC_TXC_ALLFRM() bfin_read32(EMAC_TXC_ALLFRM)
195#define bfin_write_EMAC_TXC_ALLFRM(val) bfin_write32(EMAC_TXC_ALLFRM, val)
196#define bfin_read_EMAC_TXC_ALLOCT() bfin_read32(EMAC_TXC_ALLOCT)
197#define bfin_write_EMAC_TXC_ALLOCT(val) bfin_write32(EMAC_TXC_ALLOCT, val)
198#define bfin_read_EMAC_TXC_EQ64() bfin_read32(EMAC_TXC_EQ64)
199#define bfin_write_EMAC_TXC_EQ64(val) bfin_write32(EMAC_TXC_EQ64, val)
200#define bfin_read_EMAC_TXC_LT128() bfin_read32(EMAC_TXC_LT128)
201#define bfin_write_EMAC_TXC_LT128(val) bfin_write32(EMAC_TXC_LT128, val)
202#define bfin_read_EMAC_TXC_LT256() bfin_read32(EMAC_TXC_LT256)
203#define bfin_write_EMAC_TXC_LT256(val) bfin_write32(EMAC_TXC_LT256, val)
204#define bfin_read_EMAC_TXC_LT512() bfin_read32(EMAC_TXC_LT512)
205#define bfin_write_EMAC_TXC_LT512(val) bfin_write32(EMAC_TXC_LT512, val)
206#define bfin_read_EMAC_TXC_LT1024() bfin_read32(EMAC_TXC_LT1024)
207#define bfin_write_EMAC_TXC_LT1024(val) bfin_write32(EMAC_TXC_LT1024, val)
208#define bfin_read_EMAC_TXC_GE1024() bfin_read32(EMAC_TXC_GE1024)
209#define bfin_write_EMAC_TXC_GE1024(val) bfin_write32(EMAC_TXC_GE1024, val)
210#define bfin_read_EMAC_TXC_ABORT() bfin_read32(EMAC_TXC_ABORT)
211#define bfin_write_EMAC_TXC_ABORT(val) bfin_write32(EMAC_TXC_ABORT, val)
212
213#endif /* _CDEF_BF516_H */
diff --git a/arch/blackfin/mach-bf518/include/mach/cdefBF518.h b/arch/blackfin/mach-bf518/include/mach/cdefBF518.h
new file mode 100644
index 000000000000..bafb370cfb3c
--- /dev/null
+++ b/arch/blackfin/mach-bf518/include/mach/cdefBF518.h
@@ -0,0 +1,282 @@
1/*
2 * File: include/asm-blackfin/mach-bf518/cdefbf518.h
3 * Based on:
4 * Author:
5 *
6 * Created:
7 * Description: system mmr register map
8 *
9 * Rev:
10 *
11 * Modified:
12 *
13 *
14 * Bugs: Enter bugs at http://blackfin.uclinux.org/
15 *
16 * This program is free software; you can redistribute it and/or modify
17 * it under the terms of the GNU General Public License as published by
18 * the Free Software Foundation; either version 2, or (at your option)
19 * any later version.
20 *
21 * This program is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 * GNU General Public License for more details.
25 *
26 * You should have received a copy of the GNU General Public License
27 * along with this program; see the file COPYING.
28 * If not, write to the Free Software Foundation,
29 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
30 */
31
32#ifndef _CDEF_BF518_H
33#define _CDEF_BF518_H
34
35/* include all Core registers and bit definitions */
36#include "defBF518.h"
37
38/* include core specific register pointer definitions */
39#include <asm/cdef_LPBlackfin.h>
40
41/* SYSTEM & MMR ADDRESS DEFINITIONS FOR ADSP-BF518 */
42
43/* include cdefBF51x_base.h for the set of #defines that are common to all ADSP-BF51x processors */
44#include "cdefBF51x_base.h"
45
46/* The following are the #defines needed by ADSP-BF518 that are not in the common header */
47
48
49/* 10/100 Ethernet Controller (0xFFC03000 - 0xFFC031FF) */
50
51#define bfin_read_EMAC_OPMODE() bfin_read32(EMAC_OPMODE)
52#define bfin_write_EMAC_OPMODE(val) bfin_write32(EMAC_OPMODE, val)
53#define bfin_read_EMAC_ADDRLO() bfin_read32(EMAC_ADDRLO)
54#define bfin_write_EMAC_ADDRLO(val) bfin_write32(EMAC_ADDRLO, val)
55#define bfin_read_EMAC_ADDRHI() bfin_read32(EMAC_ADDRHI)
56#define bfin_write_EMAC_ADDRHI(val) bfin_write32(EMAC_ADDRHI, val)
57#define bfin_read_EMAC_HASHLO() bfin_read32(EMAC_HASHLO)
58#define bfin_write_EMAC_HASHLO(val) bfin_write32(EMAC_HASHLO, val)
59#define bfin_read_EMAC_HASHHI() bfin_read32(EMAC_HASHHI)
60#define bfin_write_EMAC_HASHHI(val) bfin_write32(EMAC_HASHHI, val)
61#define bfin_read_EMAC_STAADD() bfin_read32(EMAC_STAADD)
62#define bfin_write_EMAC_STAADD(val) bfin_write32(EMAC_STAADD, val)
63#define bfin_read_EMAC_STADAT() bfin_read32(EMAC_STADAT)
64#define bfin_write_EMAC_STADAT(val) bfin_write32(EMAC_STADAT, val)
65#define bfin_read_EMAC_FLC() bfin_read32(EMAC_FLC)
66#define bfin_write_EMAC_FLC(val) bfin_write32(EMAC_FLC, val)
67#define bfin_read_EMAC_VLAN1() bfin_read32(EMAC_VLAN1)
68#define bfin_write_EMAC_VLAN1(val) bfin_write32(EMAC_VLAN1, val)
69#define bfin_read_EMAC_VLAN2() bfin_read32(EMAC_VLAN2)
70#define bfin_write_EMAC_VLAN2(val) bfin_write32(EMAC_VLAN2, val)
71#define bfin_read_EMAC_WKUP_CTL() bfin_read32(EMAC_WKUP_CTL)
72#define bfin_write_EMAC_WKUP_CTL(val) bfin_write32(EMAC_WKUP_CTL, val)
73#define bfin_read_EMAC_WKUP_FFMSK0() bfin_read32(EMAC_WKUP_FFMSK0)
74#define bfin_write_EMAC_WKUP_FFMSK0(val) bfin_write32(EMAC_WKUP_FFMSK0, val)
75#define bfin_read_EMAC_WKUP_FFMSK1() bfin_read32(EMAC_WKUP_FFMSK1)
76#define bfin_write_EMAC_WKUP_FFMSK1(val) bfin_write32(EMAC_WKUP_FFMSK1, val)
77#define bfin_read_EMAC_WKUP_FFMSK2() bfin_read32(EMAC_WKUP_FFMSK2)
78#define bfin_write_EMAC_WKUP_FFMSK2(val) bfin_write32(EMAC_WKUP_FFMSK2, val)
79#define bfin_read_EMAC_WKUP_FFMSK3() bfin_read32(EMAC_WKUP_FFMSK3)
80#define bfin_write_EMAC_WKUP_FFMSK3(val) bfin_write32(EMAC_WKUP_FFMSK3, val)
81#define bfin_read_EMAC_WKUP_FFCMD() bfin_read32(EMAC_WKUP_FFCMD)
82#define bfin_write_EMAC_WKUP_FFCMD(val) bfin_write32(EMAC_WKUP_FFCMD, val)
83#define bfin_read_EMAC_WKUP_FFOFF() bfin_read32(EMAC_WKUP_FFOFF)
84#define bfin_write_EMAC_WKUP_FFOFF(val) bfin_write32(EMAC_WKUP_FFOFF, val)
85#define bfin_read_EMAC_WKUP_FFCRC0() bfin_read32(EMAC_WKUP_FFCRC0)
86#define bfin_write_EMAC_WKUP_FFCRC0(val) bfin_write32(EMAC_WKUP_FFCRC0, val)
87#define bfin_read_EMAC_WKUP_FFCRC1() bfin_read32(EMAC_WKUP_FFCRC1)
88#define bfin_write_EMAC_WKUP_FFCRC1(val) bfin_write32(EMAC_WKUP_FFCRC1, val)
89
90#define bfin_read_EMAC_SYSCTL() bfin_read32(EMAC_SYSCTL)
91#define bfin_write_EMAC_SYSCTL(val) bfin_write32(EMAC_SYSCTL, val)
92#define bfin_read_EMAC_SYSTAT() bfin_read32(EMAC_SYSTAT)
93#define bfin_write_EMAC_SYSTAT(val) bfin_write32(EMAC_SYSTAT, val)
94#define bfin_read_EMAC_RX_STAT() bfin_read32(EMAC_RX_STAT)
95#define bfin_write_EMAC_RX_STAT(val) bfin_write32(EMAC_RX_STAT, val)
96#define bfin_read_EMAC_RX_STKY() bfin_read32(EMAC_RX_STKY)
97#define bfin_write_EMAC_RX_STKY(val) bfin_write32(EMAC_RX_STKY, val)
98#define bfin_read_EMAC_RX_IRQE() bfin_read32(EMAC_RX_IRQE)
99#define bfin_write_EMAC_RX_IRQE(val) bfin_write32(EMAC_RX_IRQE, val)
100#define bfin_read_EMAC_TX_STAT() bfin_read32(EMAC_TX_STAT)
101#define bfin_write_EMAC_TX_STAT(val) bfin_write32(EMAC_TX_STAT, val)
102#define bfin_read_EMAC_TX_STKY() bfin_read32(EMAC_TX_STKY)
103#define bfin_write_EMAC_TX_STKY(val) bfin_write32(EMAC_TX_STKY, val)
104#define bfin_read_EMAC_TX_IRQE() bfin_read32(EMAC_TX_IRQE)
105#define bfin_write_EMAC_TX_IRQE(val) bfin_write32(EMAC_TX_IRQE, val)
106
107#define bfin_read_EMAC_MMC_CTL() bfin_read32(EMAC_MMC_CTL)
108#define bfin_write_EMAC_MMC_CTL(val) bfin_write32(EMAC_MMC_CTL, val)
109#define bfin_read_EMAC_MMC_RIRQS() bfin_read32(EMAC_MMC_RIRQS)
110#define bfin_write_EMAC_MMC_RIRQS(val) bfin_write32(EMAC_MMC_RIRQS, val)
111#define bfin_read_EMAC_MMC_RIRQE() bfin_read32(EMAC_MMC_RIRQE)
112#define bfin_write_EMAC_MMC_RIRQE(val) bfin_write32(EMAC_MMC_RIRQE, val)
113#define bfin_read_EMAC_MMC_TIRQS() bfin_read32(EMAC_MMC_TIRQS)
114#define bfin_write_EMAC_MMC_TIRQS(val) bfin_write32(EMAC_MMC_TIRQS, val)
115#define bfin_read_EMAC_MMC_TIRQE() bfin_read32(EMAC_MMC_TIRQE)
116#define bfin_write_EMAC_MMC_TIRQE(val) bfin_write32(EMAC_MMC_TIRQE, val)
117
118#define bfin_read_EMAC_RXC_OK() bfin_read32(EMAC_RXC_OK)
119#define bfin_write_EMAC_RXC_OK(val) bfin_write32(EMAC_RXC_OK, val)
120#define bfin_read_EMAC_RXC_FCS() bfin_read32(EMAC_RXC_FCS)
121#define bfin_write_EMAC_RXC_FCS(val) bfin_write32(EMAC_RXC_FCS, val)
122#define bfin_read_EMAC_RXC_ALIGN() bfin_read32(EMAC_RXC_ALIGN)
123#define bfin_write_EMAC_RXC_ALIGN(val) bfin_write32(EMAC_RXC_ALIGN, val)
124#define bfin_read_EMAC_RXC_OCTET() bfin_read32(EMAC_RXC_OCTET)
125#define bfin_write_EMAC_RXC_OCTET(val) bfin_write32(EMAC_RXC_OCTET, val)
126#define bfin_read_EMAC_RXC_DMAOVF() bfin_read32(EMAC_RXC_DMAOVF)
127#define bfin_write_EMAC_RXC_DMAOVF(val) bfin_write32(EMAC_RXC_DMAOVF, val)
128#define bfin_read_EMAC_RXC_UNICST() bfin_read32(EMAC_RXC_UNICST)
129#define bfin_write_EMAC_RXC_UNICST(val) bfin_write32(EMAC_RXC_UNICST, val)
130#define bfin_read_EMAC_RXC_MULTI() bfin_read32(EMAC_RXC_MULTI)
131#define bfin_write_EMAC_RXC_MULTI(val) bfin_write32(EMAC_RXC_MULTI, val)
132#define bfin_read_EMAC_RXC_BROAD() bfin_read32(EMAC_RXC_BROAD)
133#define bfin_write_EMAC_RXC_BROAD(val) bfin_write32(EMAC_RXC_BROAD, val)
134#define bfin_read_EMAC_RXC_LNERRI() bfin_read32(EMAC_RXC_LNERRI)
135#define bfin_write_EMAC_RXC_LNERRI(val) bfin_write32(EMAC_RXC_LNERRI, val)
136#define bfin_read_EMAC_RXC_LNERRO() bfin_read32(EMAC_RXC_LNERRO)
137#define bfin_write_EMAC_RXC_LNERRO(val) bfin_write32(EMAC_RXC_LNERRO, val)
138#define bfin_read_EMAC_RXC_LONG() bfin_read32(EMAC_RXC_LONG)
139#define bfin_write_EMAC_RXC_LONG(val) bfin_write32(EMAC_RXC_LONG, val)
140#define bfin_read_EMAC_RXC_MACCTL() bfin_read32(EMAC_RXC_MACCTL)
141#define bfin_write_EMAC_RXC_MACCTL(val) bfin_write32(EMAC_RXC_MACCTL, val)
142#define bfin_read_EMAC_RXC_OPCODE() bfin_read32(EMAC_RXC_OPCODE)
143#define bfin_write_EMAC_RXC_OPCODE(val) bfin_write32(EMAC_RXC_OPCODE, val)
144#define bfin_read_EMAC_RXC_PAUSE() bfin_read32(EMAC_RXC_PAUSE)
145#define bfin_write_EMAC_RXC_PAUSE(val) bfin_write32(EMAC_RXC_PAUSE, val)
146#define bfin_read_EMAC_RXC_ALLFRM() bfin_read32(EMAC_RXC_ALLFRM)
147#define bfin_write_EMAC_RXC_ALLFRM(val) bfin_write32(EMAC_RXC_ALLFRM, val)
148#define bfin_read_EMAC_RXC_ALLOCT() bfin_read32(EMAC_RXC_ALLOCT)
149#define bfin_write_EMAC_RXC_ALLOCT(val) bfin_write32(EMAC_RXC_ALLOCT, val)
150#define bfin_read_EMAC_RXC_TYPED() bfin_read32(EMAC_RXC_TYPED)
151#define bfin_write_EMAC_RXC_TYPED(val) bfin_write32(EMAC_RXC_TYPED, val)
152#define bfin_read_EMAC_RXC_SHORT() bfin_read32(EMAC_RXC_SHORT)
153#define bfin_write_EMAC_RXC_SHORT(val) bfin_write32(EMAC_RXC_SHORT, val)
154#define bfin_read_EMAC_RXC_EQ64() bfin_read32(EMAC_RXC_EQ64)
155#define bfin_write_EMAC_RXC_EQ64(val) bfin_write32(EMAC_RXC_EQ64, val)
156#define bfin_read_EMAC_RXC_LT128() bfin_read32(EMAC_RXC_LT128)
157#define bfin_write_EMAC_RXC_LT128(val) bfin_write32(EMAC_RXC_LT128, val)
158#define bfin_read_EMAC_RXC_LT256() bfin_read32(EMAC_RXC_LT256)
159#define bfin_write_EMAC_RXC_LT256(val) bfin_write32(EMAC_RXC_LT256, val)
160#define bfin_read_EMAC_RXC_LT512() bfin_read32(EMAC_RXC_LT512)
161#define bfin_write_EMAC_RXC_LT512(val) bfin_write32(EMAC_RXC_LT512, val)
162#define bfin_read_EMAC_RXC_LT1024() bfin_read32(EMAC_RXC_LT1024)
163#define bfin_write_EMAC_RXC_LT1024(val) bfin_write32(EMAC_RXC_LT1024, val)
164#define bfin_read_EMAC_RXC_GE1024() bfin_read32(EMAC_RXC_GE1024)
165#define bfin_write_EMAC_RXC_GE1024(val) bfin_write32(EMAC_RXC_GE1024, val)
166
167#define bfin_read_EMAC_TXC_OK() bfin_read32(EMAC_TXC_OK)
168#define bfin_write_EMAC_TXC_OK(val) bfin_write32(EMAC_TXC_OK, val)
169#define bfin_read_EMAC_TXC_1COL() bfin_read32(EMAC_TXC_1COL)
170#define bfin_write_EMAC_TXC_1COL(val) bfin_write32(EMAC_TXC_1COL, val)
171#define bfin_read_EMAC_TXC_GT1COL() bfin_read32(EMAC_TXC_GT1COL)
172#define bfin_write_EMAC_TXC_GT1COL(val) bfin_write32(EMAC_TXC_GT1COL, val)
173#define bfin_read_EMAC_TXC_OCTET() bfin_read32(EMAC_TXC_OCTET)
174#define bfin_write_EMAC_TXC_OCTET(val) bfin_write32(EMAC_TXC_OCTET, val)
175#define bfin_read_EMAC_TXC_DEFER() bfin_read32(EMAC_TXC_DEFER)
176#define bfin_write_EMAC_TXC_DEFER(val) bfin_write32(EMAC_TXC_DEFER, val)
177#define bfin_read_EMAC_TXC_LATECL() bfin_read32(EMAC_TXC_LATECL)
178#define bfin_write_EMAC_TXC_LATECL(val) bfin_write32(EMAC_TXC_LATECL, val)
179#define bfin_read_EMAC_TXC_XS_COL() bfin_read32(EMAC_TXC_XS_COL)
180#define bfin_write_EMAC_TXC_XS_COL(val) bfin_write32(EMAC_TXC_XS_COL, val)
181#define bfin_read_EMAC_TXC_DMAUND() bfin_read32(EMAC_TXC_DMAUND)
182#define bfin_write_EMAC_TXC_DMAUND(val) bfin_write32(EMAC_TXC_DMAUND, val)
183#define bfin_read_EMAC_TXC_CRSERR() bfin_read32(EMAC_TXC_CRSERR)
184#define bfin_write_EMAC_TXC_CRSERR(val) bfin_write32(EMAC_TXC_CRSERR, val)
185#define bfin_read_EMAC_TXC_UNICST() bfin_read32(EMAC_TXC_UNICST)
186#define bfin_write_EMAC_TXC_UNICST(val) bfin_write32(EMAC_TXC_UNICST, val)
187#define bfin_read_EMAC_TXC_MULTI() bfin_read32(EMAC_TXC_MULTI)
188#define bfin_write_EMAC_TXC_MULTI(val) bfin_write32(EMAC_TXC_MULTI, val)
189#define bfin_read_EMAC_TXC_BROAD() bfin_read32(EMAC_TXC_BROAD)
190#define bfin_write_EMAC_TXC_BROAD(val) bfin_write32(EMAC_TXC_BROAD, val)
191#define bfin_read_EMAC_TXC_XS_DFR() bfin_read32(EMAC_TXC_XS_DFR)
192#define bfin_write_EMAC_TXC_XS_DFR(val) bfin_write32(EMAC_TXC_XS_DFR, val)
193#define bfin_read_EMAC_TXC_MACCTL() bfin_read32(EMAC_TXC_MACCTL)
194#define bfin_write_EMAC_TXC_MACCTL(val) bfin_write32(EMAC_TXC_MACCTL, val)
195#define bfin_read_EMAC_TXC_ALLFRM() bfin_read32(EMAC_TXC_ALLFRM)
196#define bfin_write_EMAC_TXC_ALLFRM(val) bfin_write32(EMAC_TXC_ALLFRM, val)
197#define bfin_read_EMAC_TXC_ALLOCT() bfin_read32(EMAC_TXC_ALLOCT)
198#define bfin_write_EMAC_TXC_ALLOCT(val) bfin_write32(EMAC_TXC_ALLOCT, val)
199#define bfin_read_EMAC_TXC_EQ64() bfin_read32(EMAC_TXC_EQ64)
200#define bfin_write_EMAC_TXC_EQ64(val) bfin_write32(EMAC_TXC_EQ64, val)
201#define bfin_read_EMAC_TXC_LT128() bfin_read32(EMAC_TXC_LT128)
202#define bfin_write_EMAC_TXC_LT128(val) bfin_write32(EMAC_TXC_LT128, val)
203#define bfin_read_EMAC_TXC_LT256() bfin_read32(EMAC_TXC_LT256)
204#define bfin_write_EMAC_TXC_LT256(val) bfin_write32(EMAC_TXC_LT256, val)
205#define bfin_read_EMAC_TXC_LT512() bfin_read32(EMAC_TXC_LT512)
206#define bfin_write_EMAC_TXC_LT512(val) bfin_write32(EMAC_TXC_LT512, val)
207#define bfin_read_EMAC_TXC_LT1024() bfin_read32(EMAC_TXC_LT1024)
208#define bfin_write_EMAC_TXC_LT1024(val) bfin_write32(EMAC_TXC_LT1024, val)
209#define bfin_read_EMAC_TXC_GE1024() bfin_read32(EMAC_TXC_GE1024)
210#define bfin_write_EMAC_TXC_GE1024(val) bfin_write32(EMAC_TXC_GE1024, val)
211#define bfin_read_EMAC_TXC_ABORT() bfin_read32(EMAC_TXC_ABORT)
212#define bfin_write_EMAC_TXC_ABORT(val) bfin_write32(EMAC_TXC_ABORT, val)
213
214/* Removable Storage Interface Registers */
215
216#define bfin_read_RSI_PWR_CTL() bfin_read16(RSI_PWR_CONTROL)
217#define bfin_write_RSI_PWR_CTL(val) bfin_write16(RSI_PWR_CONTROL, val)
218#define bfin_read_RSI_CLK_CTL() bfin_read16(RSI_CLK_CONTROL)
219#define bfin_write_RSI_CLK_CTL(val) bfin_write16(RSI_CLK_CONTROL, val)
220#define bfin_read_RSI_ARGUMENT() bfin_read32(RSI_ARGUMENT)
221#define bfin_write_RSI_ARGUMENT(val) bfin_write32(RSI_ARGUMENT, val)
222#define bfin_read_RSI_COMMAND() bfin_read16(RSI_COMMAND)
223#define bfin_write_RSI_COMMAND(val) bfin_write16(RSI_COMMAND, val)
224#define bfin_read_RSI_RESP_CMD() bfin_read16(RSI_RESP_CMD)
225#define bfin_write_RSI_RESP_CMD(val) bfin_write16(RSI_RESP_CMD, val)
226#define bfin_read_RSI_RESPONSE0() bfin_read32(RSI_RESPONSE0)
227#define bfin_write_RSI_RESPONSE0(val) bfin_write32(RSI_RESPONSE0, val)
228#define bfin_read_RSI_RESPONSE1() bfin_read32(RSI_RESPONSE1)
229#define bfin_write_RSI_RESPONSE1(val) bfin_write32(RSI_RESPONSE1, val)
230#define bfin_read_RSI_RESPONSE2() bfin_read32(RSI_RESPONSE2)
231#define bfin_write_RSI_RESPONSE2(val) bfin_write32(RSI_RESPONSE2, val)
232#define bfin_read_RSI_RESPONSE3() bfin_read32(RSI_RESPONSE3)
233#define bfin_write_RSI_RESPONSE3(val) bfin_write32(RSI_RESPONSE3, val)
234#define bfin_read_RSI_DATA_TIMER() bfin_read32(RSI_DATA_TIMER)
235#define bfin_write_RSI_DATA_TIMER(val) bfin_write32(RSI_DATA_TIMER, val)
236#define bfin_read_RSI_DATA_LGTH() bfin_read16(RSI_DATA_LGTH)
237#define bfin_write_RSI_DATA_LGTH(val) bfin_write16(RSI_DATA_LGTH, val)
238#define bfin_read_RSI_DATA_CTL() bfin_read16(RSI_DATA_CONTROL)
239#define bfin_write_RSI_DATA_CTL(val) bfin_write16(RSI_DATA_CONTROL, val)
240#define bfin_read_RSI_DATA_CNT() bfin_read16(RSI_DATA_CNT)
241#define bfin_write_RSI_DATA_CNT(val) bfin_write16(RSI_DATA_CNT, val)
242#define bfin_read_RSI_STATUS() bfin_read32(RSI_STATUS)
243#define bfin_write_RSI_STATUS(val) bfin_write32(RSI_STATUS, val)
244#define bfin_read_RSI_STATUS_CLR() bfin_read16(RSI_STATUSCL)
245#define bfin_write_RSI_STATUS_CLR(val) bfin_write16(RSI_STATUSCL, val)
246#define bfin_read_RSI_MASK0() bfin_read32(RSI_MASK0)
247#define bfin_write_RSI_MASK0(val) bfin_write32(RSI_MASK0, val)
248#define bfin_read_RSI_MASK1() bfin_read32(RSI_MASK1)
249#define bfin_write_RSI_MASK1(val) bfin_write32(RSI_MASK1, val)
250#define bfin_read_RSI_FIFO_CNT() bfin_read16(RSI_FIFO_CNT)
251#define bfin_write_RSI_FIFO_CNT(val) bfin_write16(RSI_FIFO_CNT, val)
252#define bfin_read_RSI_CEATA_CTL() bfin_read16(RSI_CEATA_CONTROL)
253#define bfin_write_RSI_CEATA_CTL(val) bfin_write16(RSI_CEATA_CONTROL, val)
254#define bfin_read_RSI_FIFO() bfin_read32(RSI_FIFO)
255#define bfin_write_RSI_FIFO(val) bfin_write32(RSI_FIFO, val)
256#define bfin_read_RSI_E_STATUS() bfin_read16(RSI_ESTAT)
257#define bfin_write_RSI_E_STATUS(val) bfin_write16(RSI_ESTAT, val)
258#define bfin_read_RSI_E_MASK() bfin_read16(RSI_EMASK)
259#define bfin_write_RSI_E_MASK(val) bfin_write16(RSI_EMASK, val)
260#define bfin_read_RSI_CFG() bfin_read16(RSI_CONFIG)
261#define bfin_write_RSI_CFG(val) bfin_write16(RSI_CONFIG, val)
262#define bfin_read_RSI_RD_WAIT_EN() bfin_read16(RSI_RD_WAIT_EN)
263#define bfin_write_RSI_RD_WAIT_EN(val) bfin_write16(RSI_RD_WAIT_EN, val)
264#define bfin_read_RSI_PID0() bfin_read16(RSI_PID0)
265#define bfin_write_RSI_PID0(val) bfin_write16(RSI_PID0, val)
266#define bfin_read_RSI_PID1() bfin_read16(RSI_PID1)
267#define bfin_write_RSI_PID1(val) bfin_write16(RSI_PID1, val)
268#define bfin_read_RSI_PID2() bfin_read16(RSI_PID2)
269#define bfin_write_RSI_PID2(val) bfin_write16(RSI_PID2, val)
270#define bfin_read_RSI_PID3() bfin_read16(RSI_PID3)
271#define bfin_write_RSI_PID3(val) bfin_write16(RSI_PID3, val)
272#define bfin_read_RSI_PID4() bfin_read16(RSI_PID4)
273#define bfin_write_RSI_PID4(val) bfin_write16(RSI_PID4, val)
274#define bfin_read_RSI_PID5() bfin_read16(RSI_PID5)
275#define bfin_write_RSI_PID5(val) bfin_write16(RSI_PID5, val)
276#define bfin_read_RSI_PID6() bfin_read16(RSI_PID6)
277#define bfin_write_RSI_PID6(val) bfin_write16(RSI_PID6, val)
278#define bfin_read_RSI_PID7() bfin_read16(RSI_PID7)
279#define bfin_write_RSI_PID7(val) bfin_write16(RSI_PID7, val)
280
281
282#endif /* _CDEF_BF518_H */
diff --git a/arch/blackfin/mach-bf518/include/mach/cdefBF51x_base.h b/arch/blackfin/mach-bf518/include/mach/cdefBF51x_base.h
new file mode 100644
index 000000000000..ee3d4733369c
--- /dev/null
+++ b/arch/blackfin/mach-bf518/include/mach/cdefBF51x_base.h
@@ -0,0 +1,1208 @@
1/*
2 * File: include/asm-blackfin/mach-bf518/cdefBF51x_base.h
3 * Based on:
4 * Author:
5 *
6 * Created:
7 * Description:
8 *
9 * Rev:
10 *
11 * Modified:
12 *
13 * Bugs: Enter bugs at http://blackfin.uclinux.org/
14 *
15 * This program is free software; you can redistribute it and/or modify
16 * it under the terms of the GNU General Public License as published by
17 * the Free Software Foundation; either version 2, or (at your option)
18 * any later version.
19 *
20 * This program is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
24 *
25 * You should have received a copy of the GNU General Public License
26 * along with this program; see the file COPYING.
27 * If not, write to the Free Software Foundation,
28 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
29 */
30
31#ifndef _CDEF_BF52X_H
32#define _CDEF_BF52X_H
33
34#include <asm/blackfin.h>
35
36#include "defBF51x_base.h"
37
38/* Include core specific register pointer definitions */
39#include <asm/cdef_LPBlackfin.h>
40
41/* ==== begin from cdefBF534.h ==== */
42
43/* Clock and System Control (0xFFC00000 - 0xFFC000FF) */
44#define bfin_read_PLL_CTL() bfin_read16(PLL_CTL)
45#define bfin_read_PLL_DIV() bfin_read16(PLL_DIV)
46#define bfin_write_PLL_DIV(val) bfin_write16(PLL_DIV, val)
47#define bfin_read_VR_CTL() bfin_read16(VR_CTL)
48#define bfin_read_PLL_STAT() bfin_read16(PLL_STAT)
49#define bfin_write_PLL_STAT(val) bfin_write16(PLL_STAT, val)
50#define bfin_read_PLL_LOCKCNT() bfin_read16(PLL_LOCKCNT)
51#define bfin_write_PLL_LOCKCNT(val) bfin_write16(PLL_LOCKCNT, val)
52#define bfin_read_CHIPID() bfin_read32(CHIPID)
53#define bfin_write_CHIPID(val) bfin_write32(CHIPID, val)
54
55
56/* System Interrupt Controller (0xFFC00100 - 0xFFC001FF) */
57#define bfin_read_SWRST() bfin_read16(SWRST)
58#define bfin_write_SWRST(val) bfin_write16(SWRST, val)
59#define bfin_read_SYSCR() bfin_read16(SYSCR)
60#define bfin_write_SYSCR(val) bfin_write16(SYSCR, val)
61
62#define bfin_read_SIC_RVECT() bfin_read32(SIC_RVECT)
63#define bfin_write_SIC_RVECT(val) bfin_write32(SIC_RVECT, val)
64#define bfin_read_SIC_IMASK0() bfin_read32(SIC_IMASK0)
65#define bfin_write_SIC_IMASK0(val) bfin_write32(SIC_IMASK0, val)
66#define bfin_read_SIC_IMASK(x) bfin_read32(SIC_IMASK0 + (x << 6))
67#define bfin_write_SIC_IMASK(x, val) bfin_write32((SIC_IMASK0 + (x << 6)), val)
68
69#define bfin_read_SIC_IAR0() bfin_read32(SIC_IAR0)
70#define bfin_write_SIC_IAR0(val) bfin_write32(SIC_IAR0, val)
71#define bfin_read_SIC_IAR1() bfin_read32(SIC_IAR1)
72#define bfin_write_SIC_IAR1(val) bfin_write32(SIC_IAR1, val)
73#define bfin_read_SIC_IAR2() bfin_read32(SIC_IAR2)
74#define bfin_write_SIC_IAR2(val) bfin_write32(SIC_IAR2, val)
75#define bfin_read_SIC_IAR3() bfin_read32(SIC_IAR3)
76#define bfin_write_SIC_IAR3(val) bfin_write32(SIC_IAR3, val)
77
78#define bfin_read_SIC_ISR0() bfin_read32(SIC_ISR0)
79#define bfin_write_SIC_ISR0(val) bfin_write32(SIC_ISR0, val)
80#define bfin_read_SIC_ISR(x) bfin_read32(SIC_ISR0 + (x << 6))
81#define bfin_write_SIC_ISR(x, val) bfin_write32((SIC_ISR0 + (x << 6)), val)
82
83#define bfin_read_SIC_IWR0() bfin_read32(SIC_IWR0)
84#define bfin_write_SIC_IWR0(val) bfin_write32(SIC_IWR0, val)
85#define bfin_read_SIC_IWR(x) bfin_read32(SIC_IWR0 + (x << 6))
86#define bfin_write_SIC_IWR(x, val) bfin_write32((SIC_IWR0 + (x << 6)), val)
87
88/* SIC Additions to ADSP-BF51x (0xFFC0014C - 0xFFC00162) */
89
90#define bfin_read_SIC_IMASK1() bfin_read32(SIC_IMASK1)
91#define bfin_write_SIC_IMASK1(val) bfin_write32(SIC_IMASK1, val)
92#define bfin_read_SIC_IAR4() bfin_read32(SIC_IAR4)
93#define bfin_write_SIC_IAR4(val) bfin_write32(SIC_IAR4, val)
94#define bfin_read_SIC_IAR5() bfin_read32(SIC_IAR5)
95#define bfin_write_SIC_IAR5(val) bfin_write32(SIC_IAR5, val)
96#define bfin_read_SIC_IAR6() bfin_read32(SIC_IAR6)
97#define bfin_write_SIC_IAR6(val) bfin_write32(SIC_IAR6, val)
98#define bfin_read_SIC_IAR7() bfin_read32(SIC_IAR7)
99#define bfin_write_SIC_IAR7(val) bfin_write32(SIC_IAR7, val)
100#define bfin_read_SIC_ISR1() bfin_read32(SIC_ISR1)
101#define bfin_write_SIC_ISR1(val) bfin_write32(SIC_ISR1, val)
102#define bfin_read_SIC_IWR1() bfin_read32(SIC_IWR1)
103#define bfin_write_SIC_IWR1(val) bfin_write32(SIC_IWR1, val)
104
105/* Watchdog Timer (0xFFC00200 - 0xFFC002FF) */
106#define bfin_read_WDOG_CTL() bfin_read16(WDOG_CTL)
107#define bfin_write_WDOG_CTL(val) bfin_write16(WDOG_CTL, val)
108#define bfin_read_WDOG_CNT() bfin_read32(WDOG_CNT)
109#define bfin_write_WDOG_CNT(val) bfin_write32(WDOG_CNT, val)
110#define bfin_read_WDOG_STAT() bfin_read32(WDOG_STAT)
111#define bfin_write_WDOG_STAT(val) bfin_write32(WDOG_STAT, val)
112
113
114/* Real Time Clock (0xFFC00300 - 0xFFC003FF) */
115#define bfin_read_RTC_STAT() bfin_read32(RTC_STAT)
116#define bfin_write_RTC_STAT(val) bfin_write32(RTC_STAT, val)
117#define bfin_read_RTC_ICTL() bfin_read16(RTC_ICTL)
118#define bfin_write_RTC_ICTL(val) bfin_write16(RTC_ICTL, val)
119#define bfin_read_RTC_ISTAT() bfin_read16(RTC_ISTAT)
120#define bfin_write_RTC_ISTAT(val) bfin_write16(RTC_ISTAT, val)
121#define bfin_read_RTC_SWCNT() bfin_read16(RTC_SWCNT)
122#define bfin_write_RTC_SWCNT(val) bfin_write16(RTC_SWCNT, val)
123#define bfin_read_RTC_ALARM() bfin_read32(RTC_ALARM)
124#define bfin_write_RTC_ALARM(val) bfin_write32(RTC_ALARM, val)
125#define bfin_read_RTC_FAST() bfin_read16(RTC_FAST)
126#define bfin_write_RTC_FAST(val) bfin_write16(RTC_FAST, val)
127#define bfin_read_RTC_PREN() bfin_read16(RTC_PREN)
128#define bfin_write_RTC_PREN(val) bfin_write16(RTC_PREN, val)
129
130
131/* UART0 Controller (0xFFC00400 - 0xFFC004FF) */
132#define bfin_read_UART0_THR() bfin_read16(UART0_THR)
133#define bfin_write_UART0_THR(val) bfin_write16(UART0_THR, val)
134#define bfin_read_UART0_RBR() bfin_read16(UART0_RBR)
135#define bfin_write_UART0_RBR(val) bfin_write16(UART0_RBR, val)
136#define bfin_read_UART0_DLL() bfin_read16(UART0_DLL)
137#define bfin_write_UART0_DLL(val) bfin_write16(UART0_DLL, val)
138#define bfin_read_UART0_IER() bfin_read16(UART0_IER)
139#define bfin_write_UART0_IER(val) bfin_write16(UART0_IER, val)
140#define bfin_read_UART0_DLH() bfin_read16(UART0_DLH)
141#define bfin_write_UART0_DLH(val) bfin_write16(UART0_DLH, val)
142#define bfin_read_UART0_IIR() bfin_read16(UART0_IIR)
143#define bfin_write_UART0_IIR(val) bfin_write16(UART0_IIR, val)
144#define bfin_read_UART0_LCR() bfin_read16(UART0_LCR)
145#define bfin_write_UART0_LCR(val) bfin_write16(UART0_LCR, val)
146#define bfin_read_UART0_MCR() bfin_read16(UART0_MCR)
147#define bfin_write_UART0_MCR(val) bfin_write16(UART0_MCR, val)
148#define bfin_read_UART0_LSR() bfin_read16(UART0_LSR)
149#define bfin_write_UART0_LSR(val) bfin_write16(UART0_LSR, val)
150#define bfin_read_UART0_MSR() bfin_read16(UART0_MSR)
151#define bfin_write_UART0_MSR(val) bfin_write16(UART0_MSR, val)
152#define bfin_read_UART0_SCR() bfin_read16(UART0_SCR)
153#define bfin_write_UART0_SCR(val) bfin_write16(UART0_SCR, val)
154#define bfin_read_UART0_GCTL() bfin_read16(UART0_GCTL)
155#define bfin_write_UART0_GCTL(val) bfin_write16(UART0_GCTL, val)
156
157
158/* SPI Controller (0xFFC00500 - 0xFFC005FF) */
159#define bfin_read_SPI_CTL() bfin_read16(SPI_CTL)
160#define bfin_write_SPI_CTL(val) bfin_write16(SPI_CTL, val)
161#define bfin_read_SPI_FLG() bfin_read16(SPI_FLG)
162#define bfin_write_SPI_FLG(val) bfin_write16(SPI_FLG, val)
163#define bfin_read_SPI_STAT() bfin_read16(SPI_STAT)
164#define bfin_write_SPI_STAT(val) bfin_write16(SPI_STAT, val)
165#define bfin_read_SPI_TDBR() bfin_read16(SPI_TDBR)
166#define bfin_write_SPI_TDBR(val) bfin_write16(SPI_TDBR, val)
167#define bfin_read_SPI_RDBR() bfin_read16(SPI_RDBR)
168#define bfin_write_SPI_RDBR(val) bfin_write16(SPI_RDBR, val)
169#define bfin_read_SPI_BAUD() bfin_read16(SPI_BAUD)
170#define bfin_write_SPI_BAUD(val) bfin_write16(SPI_BAUD, val)
171#define bfin_read_SPI_SHADOW() bfin_read16(SPI_SHADOW)
172#define bfin_write_SPI_SHADOW(val) bfin_write16(SPI_SHADOW, val)
173
174
175/* TIMER0-7 Registers (0xFFC00600 - 0xFFC006FF) */
176#define bfin_read_TIMER0_CONFIG() bfin_read16(TIMER0_CONFIG)
177#define bfin_write_TIMER0_CONFIG(val) bfin_write16(TIMER0_CONFIG, val)
178#define bfin_read_TIMER0_COUNTER() bfin_read32(TIMER0_COUNTER)
179#define bfin_write_TIMER0_COUNTER(val) bfin_write32(TIMER0_COUNTER, val)
180#define bfin_read_TIMER0_PERIOD() bfin_read32(TIMER0_PERIOD)
181#define bfin_write_TIMER0_PERIOD(val) bfin_write32(TIMER0_PERIOD, val)
182#define bfin_read_TIMER0_WIDTH() bfin_read32(TIMER0_WIDTH)
183#define bfin_write_TIMER0_WIDTH(val) bfin_write32(TIMER0_WIDTH, val)
184
185#define bfin_read_TIMER1_CONFIG() bfin_read16(TIMER1_CONFIG)
186#define bfin_write_TIMER1_CONFIG(val) bfin_write16(TIMER1_CONFIG, val)
187#define bfin_read_TIMER1_COUNTER() bfin_read32(TIMER1_COUNTER)
188#define bfin_write_TIMER1_COUNTER(val) bfin_write32(TIMER1_COUNTER, val)
189#define bfin_read_TIMER1_PERIOD() bfin_read32(TIMER1_PERIOD)
190#define bfin_write_TIMER1_PERIOD(val) bfin_write32(TIMER1_PERIOD, val)
191#define bfin_read_TIMER1_WIDTH() bfin_read32(TIMER1_WIDTH)
192#define bfin_write_TIMER1_WIDTH(val) bfin_write32(TIMER1_WIDTH, val)
193
194#define bfin_read_TIMER2_CONFIG() bfin_read16(TIMER2_CONFIG)
195#define bfin_write_TIMER2_CONFIG(val) bfin_write16(TIMER2_CONFIG, val)
196#define bfin_read_TIMER2_COUNTER() bfin_read32(TIMER2_COUNTER)
197#define bfin_write_TIMER2_COUNTER(val) bfin_write32(TIMER2_COUNTER, val)
198#define bfin_read_TIMER2_PERIOD() bfin_read32(TIMER2_PERIOD)
199#define bfin_write_TIMER2_PERIOD(val) bfin_write32(TIMER2_PERIOD, val)
200#define bfin_read_TIMER2_WIDTH() bfin_read32(TIMER2_WIDTH)
201#define bfin_write_TIMER2_WIDTH(val) bfin_write32(TIMER2_WIDTH, val)
202
203#define bfin_read_TIMER3_CONFIG() bfin_read16(TIMER3_CONFIG)
204#define bfin_write_TIMER3_CONFIG(val) bfin_write16(TIMER3_CONFIG, val)
205#define bfin_read_TIMER3_COUNTER() bfin_read32(TIMER3_COUNTER)
206#define bfin_write_TIMER3_COUNTER(val) bfin_write32(TIMER3_COUNTER, val)
207#define bfin_read_TIMER3_PERIOD() bfin_read32(TIMER3_PERIOD)
208#define bfin_write_TIMER3_PERIOD(val) bfin_write32(TIMER3_PERIOD, val)
209#define bfin_read_TIMER3_WIDTH() bfin_read32(TIMER3_WIDTH)
210#define bfin_write_TIMER3_WIDTH(val) bfin_write32(TIMER3_WIDTH, val)
211
212#define bfin_read_TIMER4_CONFIG() bfin_read16(TIMER4_CONFIG)
213#define bfin_write_TIMER4_CONFIG(val) bfin_write16(TIMER4_CONFIG, val)
214#define bfin_read_TIMER4_COUNTER() bfin_read32(TIMER4_COUNTER)
215#define bfin_write_TIMER4_COUNTER(val) bfin_write32(TIMER4_COUNTER, val)
216#define bfin_read_TIMER4_PERIOD() bfin_read32(TIMER4_PERIOD)
217#define bfin_write_TIMER4_PERIOD(val) bfin_write32(TIMER4_PERIOD, val)
218#define bfin_read_TIMER4_WIDTH() bfin_read32(TIMER4_WIDTH)
219#define bfin_write_TIMER4_WIDTH(val) bfin_write32(TIMER4_WIDTH, val)
220
221#define bfin_read_TIMER5_CONFIG() bfin_read16(TIMER5_CONFIG)
222#define bfin_write_TIMER5_CONFIG(val) bfin_write16(TIMER5_CONFIG, val)
223#define bfin_read_TIMER5_COUNTER() bfin_read32(TIMER5_COUNTER)
224#define bfin_write_TIMER5_COUNTER(val) bfin_write32(TIMER5_COUNTER, val)
225#define bfin_read_TIMER5_PERIOD() bfin_read32(TIMER5_PERIOD)
226#define bfin_write_TIMER5_PERIOD(val) bfin_write32(TIMER5_PERIOD, val)
227#define bfin_read_TIMER5_WIDTH() bfin_read32(TIMER5_WIDTH)
228#define bfin_write_TIMER5_WIDTH(val) bfin_write32(TIMER5_WIDTH, val)
229
230#define bfin_read_TIMER6_CONFIG() bfin_read16(TIMER6_CONFIG)
231#define bfin_write_TIMER6_CONFIG(val) bfin_write16(TIMER6_CONFIG, val)
232#define bfin_read_TIMER6_COUNTER() bfin_read32(TIMER6_COUNTER)
233#define bfin_write_TIMER6_COUNTER(val) bfin_write32(TIMER6_COUNTER, val)
234#define bfin_read_TIMER6_PERIOD() bfin_read32(TIMER6_PERIOD)
235#define bfin_write_TIMER6_PERIOD(val) bfin_write32(TIMER6_PERIOD, val)
236#define bfin_read_TIMER6_WIDTH() bfin_read32(TIMER6_WIDTH)
237#define bfin_write_TIMER6_WIDTH(val) bfin_write32(TIMER6_WIDTH, val)
238
239#define bfin_read_TIMER7_CONFIG() bfin_read16(TIMER7_CONFIG)
240#define bfin_write_TIMER7_CONFIG(val) bfin_write16(TIMER7_CONFIG, val)
241#define bfin_read_TIMER7_COUNTER() bfin_read32(TIMER7_COUNTER)
242#define bfin_write_TIMER7_COUNTER(val) bfin_write32(TIMER7_COUNTER, val)
243#define bfin_read_TIMER7_PERIOD() bfin_read32(TIMER7_PERIOD)
244#define bfin_write_TIMER7_PERIOD(val) bfin_write32(TIMER7_PERIOD, val)
245#define bfin_read_TIMER7_WIDTH() bfin_read32(TIMER7_WIDTH)
246#define bfin_write_TIMER7_WIDTH(val) bfin_write32(TIMER7_WIDTH, val)
247
248#define bfin_read_TIMER_ENABLE() bfin_read16(TIMER_ENABLE)
249#define bfin_write_TIMER_ENABLE(val) bfin_write16(TIMER_ENABLE, val)
250#define bfin_read_TIMER_DISABLE() bfin_read16(TIMER_DISABLE)
251#define bfin_write_TIMER_DISABLE(val) bfin_write16(TIMER_DISABLE, val)
252#define bfin_read_TIMER_STATUS() bfin_read32(TIMER_STATUS)
253#define bfin_write_TIMER_STATUS(val) bfin_write32(TIMER_STATUS, val)
254
255
256/* General Purpose I/O Port F (0xFFC00700 - 0xFFC007FF) */
257#define bfin_read_PORTFIO() bfin_read16(PORTFIO)
258#define bfin_write_PORTFIO(val) bfin_write16(PORTFIO, val)
259#define bfin_read_PORTFIO_CLEAR() bfin_read16(PORTFIO_CLEAR)
260#define bfin_write_PORTFIO_CLEAR(val) bfin_write16(PORTFIO_CLEAR, val)
261#define bfin_read_PORTFIO_SET() bfin_read16(PORTFIO_SET)
262#define bfin_write_PORTFIO_SET(val) bfin_write16(PORTFIO_SET, val)
263#define bfin_read_PORTFIO_TOGGLE() bfin_read16(PORTFIO_TOGGLE)
264#define bfin_write_PORTFIO_TOGGLE(val) bfin_write16(PORTFIO_TOGGLE, val)
265#define bfin_read_PORTFIO_MASKA() bfin_read16(PORTFIO_MASKA)
266#define bfin_write_PORTFIO_MASKA(val) bfin_write16(PORTFIO_MASKA, val)
267#define bfin_read_PORTFIO_MASKA_CLEAR() bfin_read16(PORTFIO_MASKA_CLEAR)
268#define bfin_write_PORTFIO_MASKA_CLEAR(val) bfin_write16(PORTFIO_MASKA_CLEAR, val)
269#define bfin_read_PORTFIO_MASKA_SET() bfin_read16(PORTFIO_MASKA_SET)
270#define bfin_write_PORTFIO_MASKA_SET(val) bfin_write16(PORTFIO_MASKA_SET, val)
271#define bfin_read_PORTFIO_MASKA_TOGGLE() bfin_read16(PORTFIO_MASKA_TOGGLE)
272#define bfin_write_PORTFIO_MASKA_TOGGLE(val) bfin_write16(PORTFIO_MASKA_TOGGLE, val)
273#define bfin_read_PORTFIO_MASKB() bfin_read16(PORTFIO_MASKB)
274#define bfin_write_PORTFIO_MASKB(val) bfin_write16(PORTFIO_MASKB, val)
275#define bfin_read_PORTFIO_MASKB_CLEAR() bfin_read16(PORTFIO_MASKB_CLEAR)
276#define bfin_write_PORTFIO_MASKB_CLEAR(val) bfin_write16(PORTFIO_MASKB_CLEAR, val)
277#define bfin_read_PORTFIO_MASKB_SET() bfin_read16(PORTFIO_MASKB_SET)
278#define bfin_write_PORTFIO_MASKB_SET(val) bfin_write16(PORTFIO_MASKB_SET, val)
279#define bfin_read_PORTFIO_MASKB_TOGGLE() bfin_read16(PORTFIO_MASKB_TOGGLE)
280#define bfin_write_PORTFIO_MASKB_TOGGLE(val) bfin_write16(PORTFIO_MASKB_TOGGLE, val)
281#define bfin_read_PORTFIO_DIR() bfin_read16(PORTFIO_DIR)
282#define bfin_write_PORTFIO_DIR(val) bfin_write16(PORTFIO_DIR, val)
283#define bfin_read_PORTFIO_POLAR() bfin_read16(PORTFIO_POLAR)
284#define bfin_write_PORTFIO_POLAR(val) bfin_write16(PORTFIO_POLAR, val)
285#define bfin_read_PORTFIO_EDGE() bfin_read16(PORTFIO_EDGE)
286#define bfin_write_PORTFIO_EDGE(val) bfin_write16(PORTFIO_EDGE, val)
287#define bfin_read_PORTFIO_BOTH() bfin_read16(PORTFIO_BOTH)
288#define bfin_write_PORTFIO_BOTH(val) bfin_write16(PORTFIO_BOTH, val)
289#define bfin_read_PORTFIO_INEN() bfin_read16(PORTFIO_INEN)
290#define bfin_write_PORTFIO_INEN(val) bfin_write16(PORTFIO_INEN, val)
291
292
293/* SPORT0 Controller (0xFFC00800 - 0xFFC008FF) */
294#define bfin_read_SPORT0_TCR1() bfin_read16(SPORT0_TCR1)
295#define bfin_write_SPORT0_TCR1(val) bfin_write16(SPORT0_TCR1, val)
296#define bfin_read_SPORT0_TCR2() bfin_read16(SPORT0_TCR2)
297#define bfin_write_SPORT0_TCR2(val) bfin_write16(SPORT0_TCR2, val)
298#define bfin_read_SPORT0_TCLKDIV() bfin_read16(SPORT0_TCLKDIV)
299#define bfin_write_SPORT0_TCLKDIV(val) bfin_write16(SPORT0_TCLKDIV, val)
300#define bfin_read_SPORT0_TFSDIV() bfin_read16(SPORT0_TFSDIV)
301#define bfin_write_SPORT0_TFSDIV(val) bfin_write16(SPORT0_TFSDIV, val)
302#define bfin_read_SPORT0_TX() bfin_read32(SPORT0_TX)
303#define bfin_write_SPORT0_TX(val) bfin_write32(SPORT0_TX, val)
304#define bfin_read_SPORT0_RX() bfin_read32(SPORT0_RX)
305#define bfin_write_SPORT0_RX(val) bfin_write32(SPORT0_RX, val)
306#define bfin_read_SPORT0_TX32() bfin_read32(SPORT0_TX32)
307#define bfin_write_SPORT0_TX32(val) bfin_write32(SPORT0_TX32, val)
308#define bfin_read_SPORT0_RX32() bfin_read32(SPORT0_RX32)
309#define bfin_write_SPORT0_RX32(val) bfin_write32(SPORT0_RX32, val)
310#define bfin_read_SPORT0_TX16() bfin_read16(SPORT0_TX16)
311#define bfin_write_SPORT0_TX16(val) bfin_write16(SPORT0_TX16, val)
312#define bfin_read_SPORT0_RX16() bfin_read16(SPORT0_RX16)
313#define bfin_write_SPORT0_RX16(val) bfin_write16(SPORT0_RX16, val)
314#define bfin_read_SPORT0_RCR1() bfin_read16(SPORT0_RCR1)
315#define bfin_write_SPORT0_RCR1(val) bfin_write16(SPORT0_RCR1, val)
316#define bfin_read_SPORT0_RCR2() bfin_read16(SPORT0_RCR2)
317#define bfin_write_SPORT0_RCR2(val) bfin_write16(SPORT0_RCR2, val)
318#define bfin_read_SPORT0_RCLKDIV() bfin_read16(SPORT0_RCLKDIV)
319#define bfin_write_SPORT0_RCLKDIV(val) bfin_write16(SPORT0_RCLKDIV, val)
320#define bfin_read_SPORT0_RFSDIV() bfin_read16(SPORT0_RFSDIV)
321#define bfin_write_SPORT0_RFSDIV(val) bfin_write16(SPORT0_RFSDIV, val)
322#define bfin_read_SPORT0_STAT() bfin_read16(SPORT0_STAT)
323#define bfin_write_SPORT0_STAT(val) bfin_write16(SPORT0_STAT, val)
324#define bfin_read_SPORT0_CHNL() bfin_read16(SPORT0_CHNL)
325#define bfin_write_SPORT0_CHNL(val) bfin_write16(SPORT0_CHNL, val)
326#define bfin_read_SPORT0_MCMC1() bfin_read16(SPORT0_MCMC1)
327#define bfin_write_SPORT0_MCMC1(val) bfin_write16(SPORT0_MCMC1, val)
328#define bfin_read_SPORT0_MCMC2() bfin_read16(SPORT0_MCMC2)
329#define bfin_write_SPORT0_MCMC2(val) bfin_write16(SPORT0_MCMC2, val)
330#define bfin_read_SPORT0_MTCS0() bfin_read32(SPORT0_MTCS0)
331#define bfin_write_SPORT0_MTCS0(val) bfin_write32(SPORT0_MTCS0, val)
332#define bfin_read_SPORT0_MTCS1() bfin_read32(SPORT0_MTCS1)
333#define bfin_write_SPORT0_MTCS1(val) bfin_write32(SPORT0_MTCS1, val)
334#define bfin_read_SPORT0_MTCS2() bfin_read32(SPORT0_MTCS2)
335#define bfin_write_SPORT0_MTCS2(val) bfin_write32(SPORT0_MTCS2, val)
336#define bfin_read_SPORT0_MTCS3() bfin_read32(SPORT0_MTCS3)
337#define bfin_write_SPORT0_MTCS3(val) bfin_write32(SPORT0_MTCS3, val)
338#define bfin_read_SPORT0_MRCS0() bfin_read32(SPORT0_MRCS0)
339#define bfin_write_SPORT0_MRCS0(val) bfin_write32(SPORT0_MRCS0, val)
340#define bfin_read_SPORT0_MRCS1() bfin_read32(SPORT0_MRCS1)
341#define bfin_write_SPORT0_MRCS1(val) bfin_write32(SPORT0_MRCS1, val)
342#define bfin_read_SPORT0_MRCS2() bfin_read32(SPORT0_MRCS2)
343#define bfin_write_SPORT0_MRCS2(val) bfin_write32(SPORT0_MRCS2, val)
344#define bfin_read_SPORT0_MRCS3() bfin_read32(SPORT0_MRCS3)
345#define bfin_write_SPORT0_MRCS3(val) bfin_write32(SPORT0_MRCS3, val)
346
347
348/* SPORT1 Controller (0xFFC00900 - 0xFFC009FF) */
349#define bfin_read_SPORT1_TCR1() bfin_read16(SPORT1_TCR1)
350#define bfin_write_SPORT1_TCR1(val) bfin_write16(SPORT1_TCR1, val)
351#define bfin_read_SPORT1_TCR2() bfin_read16(SPORT1_TCR2)
352#define bfin_write_SPORT1_TCR2(val) bfin_write16(SPORT1_TCR2, val)
353#define bfin_read_SPORT1_TCLKDIV() bfin_read16(SPORT1_TCLKDIV)
354#define bfin_write_SPORT1_TCLKDIV(val) bfin_write16(SPORT1_TCLKDIV, val)
355#define bfin_read_SPORT1_TFSDIV() bfin_read16(SPORT1_TFSDIV)
356#define bfin_write_SPORT1_TFSDIV(val) bfin_write16(SPORT1_TFSDIV, val)
357#define bfin_read_SPORT1_TX() bfin_read32(SPORT1_TX)
358#define bfin_write_SPORT1_TX(val) bfin_write32(SPORT1_TX, val)
359#define bfin_read_SPORT1_RX() bfin_read32(SPORT1_RX)
360#define bfin_write_SPORT1_RX(val) bfin_write32(SPORT1_RX, val)
361#define bfin_read_SPORT1_TX32() bfin_read32(SPORT1_TX32)
362#define bfin_write_SPORT1_TX32(val) bfin_write32(SPORT1_TX32, val)
363#define bfin_read_SPORT1_RX32() bfin_read32(SPORT1_RX32)
364#define bfin_write_SPORT1_RX32(val) bfin_write32(SPORT1_RX32, val)
365#define bfin_read_SPORT1_TX16() bfin_read16(SPORT1_TX16)
366#define bfin_write_SPORT1_TX16(val) bfin_write16(SPORT1_TX16, val)
367#define bfin_read_SPORT1_RX16() bfin_read16(SPORT1_RX16)
368#define bfin_write_SPORT1_RX16(val) bfin_write16(SPORT1_RX16, val)
369#define bfin_read_SPORT1_RCR1() bfin_read16(SPORT1_RCR1)
370#define bfin_write_SPORT1_RCR1(val) bfin_write16(SPORT1_RCR1, val)
371#define bfin_read_SPORT1_RCR2() bfin_read16(SPORT1_RCR2)
372#define bfin_write_SPORT1_RCR2(val) bfin_write16(SPORT1_RCR2, val)
373#define bfin_read_SPORT1_RCLKDIV() bfin_read16(SPORT1_RCLKDIV)
374#define bfin_write_SPORT1_RCLKDIV(val) bfin_write16(SPORT1_RCLKDIV, val)
375#define bfin_read_SPORT1_RFSDIV() bfin_read16(SPORT1_RFSDIV)
376#define bfin_write_SPORT1_RFSDIV(val) bfin_write16(SPORT1_RFSDIV, val)
377#define bfin_read_SPORT1_STAT() bfin_read16(SPORT1_STAT)
378#define bfin_write_SPORT1_STAT(val) bfin_write16(SPORT1_STAT, val)
379#define bfin_read_SPORT1_CHNL() bfin_read16(SPORT1_CHNL)
380#define bfin_write_SPORT1_CHNL(val) bfin_write16(SPORT1_CHNL, val)
381#define bfin_read_SPORT1_MCMC1() bfin_read16(SPORT1_MCMC1)
382#define bfin_write_SPORT1_MCMC1(val) bfin_write16(SPORT1_MCMC1, val)
383#define bfin_read_SPORT1_MCMC2() bfin_read16(SPORT1_MCMC2)
384#define bfin_write_SPORT1_MCMC2(val) bfin_write16(SPORT1_MCMC2, val)
385#define bfin_read_SPORT1_MTCS0() bfin_read32(SPORT1_MTCS0)
386#define bfin_write_SPORT1_MTCS0(val) bfin_write32(SPORT1_MTCS0, val)
387#define bfin_read_SPORT1_MTCS1() bfin_read32(SPORT1_MTCS1)
388#define bfin_write_SPORT1_MTCS1(val) bfin_write32(SPORT1_MTCS1, val)
389#define bfin_read_SPORT1_MTCS2() bfin_read32(SPORT1_MTCS2)
390#define bfin_write_SPORT1_MTCS2(val) bfin_write32(SPORT1_MTCS2, val)
391#define bfin_read_SPORT1_MTCS3() bfin_read32(SPORT1_MTCS3)
392#define bfin_write_SPORT1_MTCS3(val) bfin_write32(SPORT1_MTCS3, val)
393#define bfin_read_SPORT1_MRCS0() bfin_read32(SPORT1_MRCS0)
394#define bfin_write_SPORT1_MRCS0(val) bfin_write32(SPORT1_MRCS0, val)
395#define bfin_read_SPORT1_MRCS1() bfin_read32(SPORT1_MRCS1)
396#define bfin_write_SPORT1_MRCS1(val) bfin_write32(SPORT1_MRCS1, val)
397#define bfin_read_SPORT1_MRCS2() bfin_read32(SPORT1_MRCS2)
398#define bfin_write_SPORT1_MRCS2(val) bfin_write32(SPORT1_MRCS2, val)
399#define bfin_read_SPORT1_MRCS3() bfin_read32(SPORT1_MRCS3)
400#define bfin_write_SPORT1_MRCS3(val) bfin_write32(SPORT1_MRCS3, val)
401
402
403/* External Bus Interface Unit (0xFFC00A00 - 0xFFC00AFF) */
404#define bfin_read_EBIU_AMGCTL() bfin_read16(EBIU_AMGCTL)
405#define bfin_write_EBIU_AMGCTL(val) bfin_write16(EBIU_AMGCTL, val)
406#define bfin_read_EBIU_AMBCTL0() bfin_read32(EBIU_AMBCTL0)
407#define bfin_write_EBIU_AMBCTL0(val) bfin_write32(EBIU_AMBCTL0, val)
408#define bfin_read_EBIU_AMBCTL1() bfin_read32(EBIU_AMBCTL1)
409#define bfin_write_EBIU_AMBCTL1(val) bfin_write32(EBIU_AMBCTL1, val)
410#define bfin_read_EBIU_SDGCTL() bfin_read32(EBIU_SDGCTL)
411#define bfin_write_EBIU_SDGCTL(val) bfin_write32(EBIU_SDGCTL, val)
412#define bfin_read_EBIU_SDBCTL() bfin_read16(EBIU_SDBCTL)
413#define bfin_write_EBIU_SDBCTL(val) bfin_write16(EBIU_SDBCTL, val)
414#define bfin_read_EBIU_SDRRC() bfin_read16(EBIU_SDRRC)
415#define bfin_write_EBIU_SDRRC(val) bfin_write16(EBIU_SDRRC, val)
416#define bfin_read_EBIU_SDSTAT() bfin_read16(EBIU_SDSTAT)
417#define bfin_write_EBIU_SDSTAT(val) bfin_write16(EBIU_SDSTAT, val)
418
419
420/* DMA Traffic Control Registers */
421#define bfin_read_DMA_TC_PER() bfin_read16(DMA_TC_PER)
422#define bfin_write_DMA_TC_PER(val) bfin_write16(DMA_TC_PER, val)
423#define bfin_read_DMA_TC_CNT() bfin_read16(DMA_TC_CNT)
424#define bfin_write_DMA_TC_CNT(val) bfin_write16(DMA_TC_CNT, val)
425
426/* Alternate deprecated register names (below) provided for backwards code compatibility */
427#define bfin_read_DMA_TCPER() bfin_read16(DMA_TCPER)
428#define bfin_write_DMA_TCPER(val) bfin_write16(DMA_TCPER, val)
429#define bfin_read_DMA_TCCNT() bfin_read16(DMA_TCCNT)
430#define bfin_write_DMA_TCCNT(val) bfin_write16(DMA_TCCNT, val)
431
432/* DMA Controller */
433#define bfin_read_DMA0_CONFIG() bfin_read16(DMA0_CONFIG)
434#define bfin_write_DMA0_CONFIG(val) bfin_write16(DMA0_CONFIG, val)
435#define bfin_read_DMA0_NEXT_DESC_PTR() bfin_read32(DMA0_NEXT_DESC_PTR)
436#define bfin_write_DMA0_NEXT_DESC_PTR(val) bfin_write32(DMA0_NEXT_DESC_PTR, val)
437#define bfin_read_DMA0_START_ADDR() bfin_read32(DMA0_START_ADDR)
438#define bfin_write_DMA0_START_ADDR(val) bfin_write32(DMA0_START_ADDR, val)
439#define bfin_read_DMA0_X_COUNT() bfin_read16(DMA0_X_COUNT)
440#define bfin_write_DMA0_X_COUNT(val) bfin_write16(DMA0_X_COUNT, val)
441#define bfin_read_DMA0_Y_COUNT() bfin_read16(DMA0_Y_COUNT)
442#define bfin_write_DMA0_Y_COUNT(val) bfin_write16(DMA0_Y_COUNT, val)
443#define bfin_read_DMA0_X_MODIFY() bfin_read16(DMA0_X_MODIFY)
444#define bfin_write_DMA0_X_MODIFY(val) bfin_write16(DMA0_X_MODIFY, val)
445#define bfin_read_DMA0_Y_MODIFY() bfin_read16(DMA0_Y_MODIFY)
446#define bfin_write_DMA0_Y_MODIFY(val) bfin_write16(DMA0_Y_MODIFY, val)
447#define bfin_read_DMA0_CURR_DESC_PTR() bfin_read32(DMA0_CURR_DESC_PTR)
448#define bfin_write_DMA0_CURR_DESC_PTR(val) bfin_write32(DMA0_CURR_DESC_PTR, val)
449#define bfin_read_DMA0_CURR_ADDR() bfin_read32(DMA0_CURR_ADDR)
450#define bfin_write_DMA0_CURR_ADDR(val) bfin_write32(DMA0_CURR_ADDR, val)
451#define bfin_read_DMA0_CURR_X_COUNT() bfin_read16(DMA0_CURR_X_COUNT)
452#define bfin_write_DMA0_CURR_X_COUNT(val) bfin_write16(DMA0_CURR_X_COUNT, val)
453#define bfin_read_DMA0_CURR_Y_COUNT() bfin_read16(DMA0_CURR_Y_COUNT)
454#define bfin_write_DMA0_CURR_Y_COUNT(val) bfin_write16(DMA0_CURR_Y_COUNT, val)
455#define bfin_read_DMA0_IRQ_STATUS() bfin_read16(DMA0_IRQ_STATUS)
456#define bfin_write_DMA0_IRQ_STATUS(val) bfin_write16(DMA0_IRQ_STATUS, val)
457#define bfin_read_DMA0_PERIPHERAL_MAP() bfin_read16(DMA0_PERIPHERAL_MAP)
458#define bfin_write_DMA0_PERIPHERAL_MAP(val) bfin_write16(DMA0_PERIPHERAL_MAP, val)
459
460#define bfin_read_DMA1_CONFIG() bfin_read16(DMA1_CONFIG)
461#define bfin_write_DMA1_CONFIG(val) bfin_write16(DMA1_CONFIG, val)
462#define bfin_read_DMA1_NEXT_DESC_PTR() bfin_read32(DMA1_NEXT_DESC_PTR)
463#define bfin_write_DMA1_NEXT_DESC_PTR(val) bfin_write32(DMA1_NEXT_DESC_PTR, val)
464#define bfin_read_DMA1_START_ADDR() bfin_read32(DMA1_START_ADDR)
465#define bfin_write_DMA1_START_ADDR(val) bfin_write32(DMA1_START_ADDR, val)
466#define bfin_read_DMA1_X_COUNT() bfin_read16(DMA1_X_COUNT)
467#define bfin_write_DMA1_X_COUNT(val) bfin_write16(DMA1_X_COUNT, val)
468#define bfin_read_DMA1_Y_COUNT() bfin_read16(DMA1_Y_COUNT)
469#define bfin_write_DMA1_Y_COUNT(val) bfin_write16(DMA1_Y_COUNT, val)
470#define bfin_read_DMA1_X_MODIFY() bfin_read16(DMA1_X_MODIFY)
471#define bfin_write_DMA1_X_MODIFY(val) bfin_write16(DMA1_X_MODIFY, val)
472#define bfin_read_DMA1_Y_MODIFY() bfin_read16(DMA1_Y_MODIFY)
473#define bfin_write_DMA1_Y_MODIFY(val) bfin_write16(DMA1_Y_MODIFY, val)
474#define bfin_read_DMA1_CURR_DESC_PTR() bfin_read32(DMA1_CURR_DESC_PTR)
475#define bfin_write_DMA1_CURR_DESC_PTR(val) bfin_write32(DMA1_CURR_DESC_PTR, val)
476#define bfin_read_DMA1_CURR_ADDR() bfin_read32(DMA1_CURR_ADDR)
477#define bfin_write_DMA1_CURR_ADDR(val) bfin_write32(DMA1_CURR_ADDR, val)
478#define bfin_read_DMA1_CURR_X_COUNT() bfin_read16(DMA1_CURR_X_COUNT)
479#define bfin_write_DMA1_CURR_X_COUNT(val) bfin_write16(DMA1_CURR_X_COUNT, val)
480#define bfin_read_DMA1_CURR_Y_COUNT() bfin_read16(DMA1_CURR_Y_COUNT)
481#define bfin_write_DMA1_CURR_Y_COUNT(val) bfin_write16(DMA1_CURR_Y_COUNT, val)
482#define bfin_read_DMA1_IRQ_STATUS() bfin_read16(DMA1_IRQ_STATUS)
483#define bfin_write_DMA1_IRQ_STATUS(val) bfin_write16(DMA1_IRQ_STATUS, val)
484#define bfin_read_DMA1_PERIPHERAL_MAP() bfin_read16(DMA1_PERIPHERAL_MAP)
485#define bfin_write_DMA1_PERIPHERAL_MAP(val) bfin_write16(DMA1_PERIPHERAL_MAP, val)
486
487#define bfin_read_DMA2_CONFIG() bfin_read16(DMA2_CONFIG)
488#define bfin_write_DMA2_CONFIG(val) bfin_write16(DMA2_CONFIG, val)
489#define bfin_read_DMA2_NEXT_DESC_PTR() bfin_read32(DMA2_NEXT_DESC_PTR)
490#define bfin_write_DMA2_NEXT_DESC_PTR(val) bfin_write32(DMA2_NEXT_DESC_PTR, val)
491#define bfin_read_DMA2_START_ADDR() bfin_read32(DMA2_START_ADDR)
492#define bfin_write_DMA2_START_ADDR(val) bfin_write32(DMA2_START_ADDR, val)
493#define bfin_read_DMA2_X_COUNT() bfin_read16(DMA2_X_COUNT)
494#define bfin_write_DMA2_X_COUNT(val) bfin_write16(DMA2_X_COUNT, val)
495#define bfin_read_DMA2_Y_COUNT() bfin_read16(DMA2_Y_COUNT)
496#define bfin_write_DMA2_Y_COUNT(val) bfin_write16(DMA2_Y_COUNT, val)
497#define bfin_read_DMA2_X_MODIFY() bfin_read16(DMA2_X_MODIFY)
498#define bfin_write_DMA2_X_MODIFY(val) bfin_write16(DMA2_X_MODIFY, val)
499#define bfin_read_DMA2_Y_MODIFY() bfin_read16(DMA2_Y_MODIFY)
500#define bfin_write_DMA2_Y_MODIFY(val) bfin_write16(DMA2_Y_MODIFY, val)
501#define bfin_read_DMA2_CURR_DESC_PTR() bfin_read32(DMA2_CURR_DESC_PTR)
502#define bfin_write_DMA2_CURR_DESC_PTR(val) bfin_write32(DMA2_CURR_DESC_PTR, val)
503#define bfin_read_DMA2_CURR_ADDR() bfin_read32(DMA2_CURR_ADDR)
504#define bfin_write_DMA2_CURR_ADDR(val) bfin_write32(DMA2_CURR_ADDR, val)
505#define bfin_read_DMA2_CURR_X_COUNT() bfin_read16(DMA2_CURR_X_COUNT)
506#define bfin_write_DMA2_CURR_X_COUNT(val) bfin_write16(DMA2_CURR_X_COUNT, val)
507#define bfin_read_DMA2_CURR_Y_COUNT() bfin_read16(DMA2_CURR_Y_COUNT)
508#define bfin_write_DMA2_CURR_Y_COUNT(val) bfin_write16(DMA2_CURR_Y_COUNT, val)
509#define bfin_read_DMA2_IRQ_STATUS() bfin_read16(DMA2_IRQ_STATUS)
510#define bfin_write_DMA2_IRQ_STATUS(val) bfin_write16(DMA2_IRQ_STATUS, val)
511#define bfin_read_DMA2_PERIPHERAL_MAP() bfin_read16(DMA2_PERIPHERAL_MAP)
512#define bfin_write_DMA2_PERIPHERAL_MAP(val) bfin_write16(DMA2_PERIPHERAL_MAP, val)
513
514#define bfin_read_DMA3_CONFIG() bfin_read16(DMA3_CONFIG)
515#define bfin_write_DMA3_CONFIG(val) bfin_write16(DMA3_CONFIG, val)
516#define bfin_read_DMA3_NEXT_DESC_PTR() bfin_read32(DMA3_NEXT_DESC_PTR)
517#define bfin_write_DMA3_NEXT_DESC_PTR(val) bfin_write32(DMA3_NEXT_DESC_PTR, val)
518#define bfin_read_DMA3_START_ADDR() bfin_read32(DMA3_START_ADDR)
519#define bfin_write_DMA3_START_ADDR(val) bfin_write32(DMA3_START_ADDR, val)
520#define bfin_read_DMA3_X_COUNT() bfin_read16(DMA3_X_COUNT)
521#define bfin_write_DMA3_X_COUNT(val) bfin_write16(DMA3_X_COUNT, val)
522#define bfin_read_DMA3_Y_COUNT() bfin_read16(DMA3_Y_COUNT)
523#define bfin_write_DMA3_Y_COUNT(val) bfin_write16(DMA3_Y_COUNT, val)
524#define bfin_read_DMA3_X_MODIFY() bfin_read16(DMA3_X_MODIFY)
525#define bfin_write_DMA3_X_MODIFY(val) bfin_write16(DMA3_X_MODIFY, val)
526#define bfin_read_DMA3_Y_MODIFY() bfin_read16(DMA3_Y_MODIFY)
527#define bfin_write_DMA3_Y_MODIFY(val) bfin_write16(DMA3_Y_MODIFY, val)
528#define bfin_read_DMA3_CURR_DESC_PTR() bfin_read32(DMA3_CURR_DESC_PTR)
529#define bfin_write_DMA3_CURR_DESC_PTR(val) bfin_write32(DMA3_CURR_DESC_PTR, val)
530#define bfin_read_DMA3_CURR_ADDR() bfin_read32(DMA3_CURR_ADDR)
531#define bfin_write_DMA3_CURR_ADDR(val) bfin_write32(DMA3_CURR_ADDR, val)
532#define bfin_read_DMA3_CURR_X_COUNT() bfin_read16(DMA3_CURR_X_COUNT)
533#define bfin_write_DMA3_CURR_X_COUNT(val) bfin_write16(DMA3_CURR_X_COUNT, val)
534#define bfin_read_DMA3_CURR_Y_COUNT() bfin_read16(DMA3_CURR_Y_COUNT)
535#define bfin_write_DMA3_CURR_Y_COUNT(val) bfin_write16(DMA3_CURR_Y_COUNT, val)
536#define bfin_read_DMA3_IRQ_STATUS() bfin_read16(DMA3_IRQ_STATUS)
537#define bfin_write_DMA3_IRQ_STATUS(val) bfin_write16(DMA3_IRQ_STATUS, val)
538#define bfin_read_DMA3_PERIPHERAL_MAP() bfin_read16(DMA3_PERIPHERAL_MAP)
539#define bfin_write_DMA3_PERIPHERAL_MAP(val) bfin_write16(DMA3_PERIPHERAL_MAP, val)
540
541#define bfin_read_DMA4_CONFIG() bfin_read16(DMA4_CONFIG)
542#define bfin_write_DMA4_CONFIG(val) bfin_write16(DMA4_CONFIG, val)
543#define bfin_read_DMA4_NEXT_DESC_PTR() bfin_read32(DMA4_NEXT_DESC_PTR)
544#define bfin_write_DMA4_NEXT_DESC_PTR(val) bfin_write32(DMA4_NEXT_DESC_PTR, val)
545#define bfin_read_DMA4_START_ADDR() bfin_read32(DMA4_START_ADDR)
546#define bfin_write_DMA4_START_ADDR(val) bfin_write32(DMA4_START_ADDR, val)
547#define bfin_read_DMA4_X_COUNT() bfin_read16(DMA4_X_COUNT)
548#define bfin_write_DMA4_X_COUNT(val) bfin_write16(DMA4_X_COUNT, val)
549#define bfin_read_DMA4_Y_COUNT() bfin_read16(DMA4_Y_COUNT)
550#define bfin_write_DMA4_Y_COUNT(val) bfin_write16(DMA4_Y_COUNT, val)
551#define bfin_read_DMA4_X_MODIFY() bfin_read16(DMA4_X_MODIFY)
552#define bfin_write_DMA4_X_MODIFY(val) bfin_write16(DMA4_X_MODIFY, val)
553#define bfin_read_DMA4_Y_MODIFY() bfin_read16(DMA4_Y_MODIFY)
554#define bfin_write_DMA4_Y_MODIFY(val) bfin_write16(DMA4_Y_MODIFY, val)
555#define bfin_read_DMA4_CURR_DESC_PTR() bfin_read32(DMA4_CURR_DESC_PTR)
556#define bfin_write_DMA4_CURR_DESC_PTR(val) bfin_write32(DMA4_CURR_DESC_PTR, val)
557#define bfin_read_DMA4_CURR_ADDR() bfin_read32(DMA4_CURR_ADDR)
558#define bfin_write_DMA4_CURR_ADDR(val) bfin_write32(DMA4_CURR_ADDR, val)
559#define bfin_read_DMA4_CURR_X_COUNT() bfin_read16(DMA4_CURR_X_COUNT)
560#define bfin_write_DMA4_CURR_X_COUNT(val) bfin_write16(DMA4_CURR_X_COUNT, val)
561#define bfin_read_DMA4_CURR_Y_COUNT() bfin_read16(DMA4_CURR_Y_COUNT)
562#define bfin_write_DMA4_CURR_Y_COUNT(val) bfin_write16(DMA4_CURR_Y_COUNT, val)
563#define bfin_read_DMA4_IRQ_STATUS() bfin_read16(DMA4_IRQ_STATUS)
564#define bfin_write_DMA4_IRQ_STATUS(val) bfin_write16(DMA4_IRQ_STATUS, val)
565#define bfin_read_DMA4_PERIPHERAL_MAP() bfin_read16(DMA4_PERIPHERAL_MAP)
566#define bfin_write_DMA4_PERIPHERAL_MAP(val) bfin_write16(DMA4_PERIPHERAL_MAP, val)
567
568#define bfin_read_DMA5_CONFIG() bfin_read16(DMA5_CONFIG)
569#define bfin_write_DMA5_CONFIG(val) bfin_write16(DMA5_CONFIG, val)
570#define bfin_read_DMA5_NEXT_DESC_PTR() bfin_read32(DMA5_NEXT_DESC_PTR)
571#define bfin_write_DMA5_NEXT_DESC_PTR(val) bfin_write32(DMA5_NEXT_DESC_PTR, val)
572#define bfin_read_DMA5_START_ADDR() bfin_read32(DMA5_START_ADDR)
573#define bfin_write_DMA5_START_ADDR(val) bfin_write32(DMA5_START_ADDR, val)
574#define bfin_read_DMA5_X_COUNT() bfin_read16(DMA5_X_COUNT)
575#define bfin_write_DMA5_X_COUNT(val) bfin_write16(DMA5_X_COUNT, val)
576#define bfin_read_DMA5_Y_COUNT() bfin_read16(DMA5_Y_COUNT)
577#define bfin_write_DMA5_Y_COUNT(val) bfin_write16(DMA5_Y_COUNT, val)
578#define bfin_read_DMA5_X_MODIFY() bfin_read16(DMA5_X_MODIFY)
579#define bfin_write_DMA5_X_MODIFY(val) bfin_write16(DMA5_X_MODIFY, val)
580#define bfin_read_DMA5_Y_MODIFY() bfin_read16(DMA5_Y_MODIFY)
581#define bfin_write_DMA5_Y_MODIFY(val) bfin_write16(DMA5_Y_MODIFY, val)
582#define bfin_read_DMA5_CURR_DESC_PTR() bfin_read32(DMA5_CURR_DESC_PTR)
583#define bfin_write_DMA5_CURR_DESC_PTR(val) bfin_write32(DMA5_CURR_DESC_PTR, val)
584#define bfin_read_DMA5_CURR_ADDR() bfin_read32(DMA5_CURR_ADDR)
585#define bfin_write_DMA5_CURR_ADDR(val) bfin_write32(DMA5_CURR_ADDR, val)
586#define bfin_read_DMA5_CURR_X_COUNT() bfin_read16(DMA5_CURR_X_COUNT)
587#define bfin_write_DMA5_CURR_X_COUNT(val) bfin_write16(DMA5_CURR_X_COUNT, val)
588#define bfin_read_DMA5_CURR_Y_COUNT() bfin_read16(DMA5_CURR_Y_COUNT)
589#define bfin_write_DMA5_CURR_Y_COUNT(val) bfin_write16(DMA5_CURR_Y_COUNT, val)
590#define bfin_read_DMA5_IRQ_STATUS() bfin_read16(DMA5_IRQ_STATUS)
591#define bfin_write_DMA5_IRQ_STATUS(val) bfin_write16(DMA5_IRQ_STATUS, val)
592#define bfin_read_DMA5_PERIPHERAL_MAP() bfin_read16(DMA5_PERIPHERAL_MAP)
593#define bfin_write_DMA5_PERIPHERAL_MAP(val) bfin_write16(DMA5_PERIPHERAL_MAP, val)
594
595#define bfin_read_DMA6_CONFIG() bfin_read16(DMA6_CONFIG)
596#define bfin_write_DMA6_CONFIG(val) bfin_write16(DMA6_CONFIG, val)
597#define bfin_read_DMA6_NEXT_DESC_PTR() bfin_read32(DMA6_NEXT_DESC_PTR)
598#define bfin_write_DMA6_NEXT_DESC_PTR(val) bfin_write32(DMA6_NEXT_DESC_PTR, val)
599#define bfin_read_DMA6_START_ADDR() bfin_read32(DMA6_START_ADDR)
600#define bfin_write_DMA6_START_ADDR(val) bfin_write32(DMA6_START_ADDR, val)
601#define bfin_read_DMA6_X_COUNT() bfin_read16(DMA6_X_COUNT)
602#define bfin_write_DMA6_X_COUNT(val) bfin_write16(DMA6_X_COUNT, val)
603#define bfin_read_DMA6_Y_COUNT() bfin_read16(DMA6_Y_COUNT)
604#define bfin_write_DMA6_Y_COUNT(val) bfin_write16(DMA6_Y_COUNT, val)
605#define bfin_read_DMA6_X_MODIFY() bfin_read16(DMA6_X_MODIFY)
606#define bfin_write_DMA6_X_MODIFY(val) bfin_write16(DMA6_X_MODIFY, val)
607#define bfin_read_DMA6_Y_MODIFY() bfin_read16(DMA6_Y_MODIFY)
608#define bfin_write_DMA6_Y_MODIFY(val) bfin_write16(DMA6_Y_MODIFY, val)
609#define bfin_read_DMA6_CURR_DESC_PTR() bfin_read32(DMA6_CURR_DESC_PTR)
610#define bfin_write_DMA6_CURR_DESC_PTR(val) bfin_write32(DMA6_CURR_DESC_PTR, val)
611#define bfin_read_DMA6_CURR_ADDR() bfin_read32(DMA6_CURR_ADDR)
612#define bfin_write_DMA6_CURR_ADDR(val) bfin_write32(DMA6_CURR_ADDR, val)
613#define bfin_read_DMA6_CURR_X_COUNT() bfin_read16(DMA6_CURR_X_COUNT)
614#define bfin_write_DMA6_CURR_X_COUNT(val) bfin_write16(DMA6_CURR_X_COUNT, val)
615#define bfin_read_DMA6_CURR_Y_COUNT() bfin_read16(DMA6_CURR_Y_COUNT)
616#define bfin_write_DMA6_CURR_Y_COUNT(val) bfin_write16(DMA6_CURR_Y_COUNT, val)
617#define bfin_read_DMA6_IRQ_STATUS() bfin_read16(DMA6_IRQ_STATUS)
618#define bfin_write_DMA6_IRQ_STATUS(val) bfin_write16(DMA6_IRQ_STATUS, val)
619#define bfin_read_DMA6_PERIPHERAL_MAP() bfin_read16(DMA6_PERIPHERAL_MAP)
620#define bfin_write_DMA6_PERIPHERAL_MAP(val) bfin_write16(DMA6_PERIPHERAL_MAP, val)
621
622#define bfin_read_DMA7_CONFIG() bfin_read16(DMA7_CONFIG)
623#define bfin_write_DMA7_CONFIG(val) bfin_write16(DMA7_CONFIG, val)
624#define bfin_read_DMA7_NEXT_DESC_PTR() bfin_read32(DMA7_NEXT_DESC_PTR)
625#define bfin_write_DMA7_NEXT_DESC_PTR(val) bfin_write32(DMA7_NEXT_DESC_PTR, val)
626#define bfin_read_DMA7_START_ADDR() bfin_read32(DMA7_START_ADDR)
627#define bfin_write_DMA7_START_ADDR(val) bfin_write32(DMA7_START_ADDR, val)
628#define bfin_read_DMA7_X_COUNT() bfin_read16(DMA7_X_COUNT)
629#define bfin_write_DMA7_X_COUNT(val) bfin_write16(DMA7_X_COUNT, val)
630#define bfin_read_DMA7_Y_COUNT() bfin_read16(DMA7_Y_COUNT)
631#define bfin_write_DMA7_Y_COUNT(val) bfin_write16(DMA7_Y_COUNT, val)
632#define bfin_read_DMA7_X_MODIFY() bfin_read16(DMA7_X_MODIFY)
633#define bfin_write_DMA7_X_MODIFY(val) bfin_write16(DMA7_X_MODIFY, val)
634#define bfin_read_DMA7_Y_MODIFY() bfin_read16(DMA7_Y_MODIFY)
635#define bfin_write_DMA7_Y_MODIFY(val) bfin_write16(DMA7_Y_MODIFY, val)
636#define bfin_read_DMA7_CURR_DESC_PTR() bfin_read32(DMA7_CURR_DESC_PTR)
637#define bfin_write_DMA7_CURR_DESC_PTR(val) bfin_write32(DMA7_CURR_DESC_PTR, val)
638#define bfin_read_DMA7_CURR_ADDR() bfin_read32(DMA7_CURR_ADDR)
639#define bfin_write_DMA7_CURR_ADDR(val) bfin_write32(DMA7_CURR_ADDR, val)
640#define bfin_read_DMA7_CURR_X_COUNT() bfin_read16(DMA7_CURR_X_COUNT)
641#define bfin_write_DMA7_CURR_X_COUNT(val) bfin_write16(DMA7_CURR_X_COUNT, val)
642#define bfin_read_DMA7_CURR_Y_COUNT() bfin_read16(DMA7_CURR_Y_COUNT)
643#define bfin_write_DMA7_CURR_Y_COUNT(val) bfin_write16(DMA7_CURR_Y_COUNT, val)
644#define bfin_read_DMA7_IRQ_STATUS() bfin_read16(DMA7_IRQ_STATUS)
645#define bfin_write_DMA7_IRQ_STATUS(val) bfin_write16(DMA7_IRQ_STATUS, val)
646#define bfin_read_DMA7_PERIPHERAL_MAP() bfin_read16(DMA7_PERIPHERAL_MAP)
647#define bfin_write_DMA7_PERIPHERAL_MAP(val) bfin_write16(DMA7_PERIPHERAL_MAP, val)
648
649#define bfin_read_DMA8_CONFIG() bfin_read16(DMA8_CONFIG)
650#define bfin_write_DMA8_CONFIG(val) bfin_write16(DMA8_CONFIG, val)
651#define bfin_read_DMA8_NEXT_DESC_PTR() bfin_read32(DMA8_NEXT_DESC_PTR)
652#define bfin_write_DMA8_NEXT_DESC_PTR(val) bfin_write32(DMA8_NEXT_DESC_PTR, val)
653#define bfin_read_DMA8_START_ADDR() bfin_read32(DMA8_START_ADDR)
654#define bfin_write_DMA8_START_ADDR(val) bfin_write32(DMA8_START_ADDR, val)
655#define bfin_read_DMA8_X_COUNT() bfin_read16(DMA8_X_COUNT)
656#define bfin_write_DMA8_X_COUNT(val) bfin_write16(DMA8_X_COUNT, val)
657#define bfin_read_DMA8_Y_COUNT() bfin_read16(DMA8_Y_COUNT)
658#define bfin_write_DMA8_Y_COUNT(val) bfin_write16(DMA8_Y_COUNT, val)
659#define bfin_read_DMA8_X_MODIFY() bfin_read16(DMA8_X_MODIFY)
660#define bfin_write_DMA8_X_MODIFY(val) bfin_write16(DMA8_X_MODIFY, val)
661#define bfin_read_DMA8_Y_MODIFY() bfin_read16(DMA8_Y_MODIFY)
662#define bfin_write_DMA8_Y_MODIFY(val) bfin_write16(DMA8_Y_MODIFY, val)
663#define bfin_read_DMA8_CURR_DESC_PTR() bfin_read32(DMA8_CURR_DESC_PTR)
664#define bfin_write_DMA8_CURR_DESC_PTR(val) bfin_write32(DMA8_CURR_DESC_PTR, val)
665#define bfin_read_DMA8_CURR_ADDR() bfin_read32(DMA8_CURR_ADDR)
666#define bfin_write_DMA8_CURR_ADDR(val) bfin_write32(DMA8_CURR_ADDR, val)
667#define bfin_read_DMA8_CURR_X_COUNT() bfin_read16(DMA8_CURR_X_COUNT)
668#define bfin_write_DMA8_CURR_X_COUNT(val) bfin_write16(DMA8_CURR_X_COUNT, val)
669#define bfin_read_DMA8_CURR_Y_COUNT() bfin_read16(DMA8_CURR_Y_COUNT)
670#define bfin_write_DMA8_CURR_Y_COUNT(val) bfin_write16(DMA8_CURR_Y_COUNT, val)
671#define bfin_read_DMA8_IRQ_STATUS() bfin_read16(DMA8_IRQ_STATUS)
672#define bfin_write_DMA8_IRQ_STATUS(val) bfin_write16(DMA8_IRQ_STATUS, val)
673#define bfin_read_DMA8_PERIPHERAL_MAP() bfin_read16(DMA8_PERIPHERAL_MAP)
674#define bfin_write_DMA8_PERIPHERAL_MAP(val) bfin_write16(DMA8_PERIPHERAL_MAP, val)
675
676#define bfin_read_DMA9_CONFIG() bfin_read16(DMA9_CONFIG)
677#define bfin_write_DMA9_CONFIG(val) bfin_write16(DMA9_CONFIG, val)
678#define bfin_read_DMA9_NEXT_DESC_PTR() bfin_read32(DMA9_NEXT_DESC_PTR)
679#define bfin_write_DMA9_NEXT_DESC_PTR(val) bfin_write32(DMA9_NEXT_DESC_PTR, val)
680#define bfin_read_DMA9_START_ADDR() bfin_read32(DMA9_START_ADDR)
681#define bfin_write_DMA9_START_ADDR(val) bfin_write32(DMA9_START_ADDR, val)
682#define bfin_read_DMA9_X_COUNT() bfin_read16(DMA9_X_COUNT)
683#define bfin_write_DMA9_X_COUNT(val) bfin_write16(DMA9_X_COUNT, val)
684#define bfin_read_DMA9_Y_COUNT() bfin_read16(DMA9_Y_COUNT)
685#define bfin_write_DMA9_Y_COUNT(val) bfin_write16(DMA9_Y_COUNT, val)
686#define bfin_read_DMA9_X_MODIFY() bfin_read16(DMA9_X_MODIFY)
687#define bfin_write_DMA9_X_MODIFY(val) bfin_write16(DMA9_X_MODIFY, val)
688#define bfin_read_DMA9_Y_MODIFY() bfin_read16(DMA9_Y_MODIFY)
689#define bfin_write_DMA9_Y_MODIFY(val) bfin_write16(DMA9_Y_MODIFY, val)
690#define bfin_read_DMA9_CURR_DESC_PTR() bfin_read32(DMA9_CURR_DESC_PTR)
691#define bfin_write_DMA9_CURR_DESC_PTR(val) bfin_write32(DMA9_CURR_DESC_PTR, val)
692#define bfin_read_DMA9_CURR_ADDR() bfin_read32(DMA9_CURR_ADDR)
693#define bfin_write_DMA9_CURR_ADDR(val) bfin_write32(DMA9_CURR_ADDR, val)
694#define bfin_read_DMA9_CURR_X_COUNT() bfin_read16(DMA9_CURR_X_COUNT)
695#define bfin_write_DMA9_CURR_X_COUNT(val) bfin_write16(DMA9_CURR_X_COUNT, val)
696#define bfin_read_DMA9_CURR_Y_COUNT() bfin_read16(DMA9_CURR_Y_COUNT)
697#define bfin_write_DMA9_CURR_Y_COUNT(val) bfin_write16(DMA9_CURR_Y_COUNT, val)
698#define bfin_read_DMA9_IRQ_STATUS() bfin_read16(DMA9_IRQ_STATUS)
699#define bfin_write_DMA9_IRQ_STATUS(val) bfin_write16(DMA9_IRQ_STATUS, val)
700#define bfin_read_DMA9_PERIPHERAL_MAP() bfin_read16(DMA9_PERIPHERAL_MAP)
701#define bfin_write_DMA9_PERIPHERAL_MAP(val) bfin_write16(DMA9_PERIPHERAL_MAP, val)
702
703#define bfin_read_DMA10_CONFIG() bfin_read16(DMA10_CONFIG)
704#define bfin_write_DMA10_CONFIG(val) bfin_write16(DMA10_CONFIG, val)
705#define bfin_read_DMA10_NEXT_DESC_PTR() bfin_read32(DMA10_NEXT_DESC_PTR)
706#define bfin_write_DMA10_NEXT_DESC_PTR(val) bfin_write32(DMA10_NEXT_DESC_PTR, val)
707#define bfin_read_DMA10_START_ADDR() bfin_read32(DMA10_START_ADDR)
708#define bfin_write_DMA10_START_ADDR(val) bfin_write32(DMA10_START_ADDR, val)
709#define bfin_read_DMA10_X_COUNT() bfin_read16(DMA10_X_COUNT)
710#define bfin_write_DMA10_X_COUNT(val) bfin_write16(DMA10_X_COUNT, val)
711#define bfin_read_DMA10_Y_COUNT() bfin_read16(DMA10_Y_COUNT)
712#define bfin_write_DMA10_Y_COUNT(val) bfin_write16(DMA10_Y_COUNT, val)
713#define bfin_read_DMA10_X_MODIFY() bfin_read16(DMA10_X_MODIFY)
714#define bfin_write_DMA10_X_MODIFY(val) bfin_write16(DMA10_X_MODIFY, val)
715#define bfin_read_DMA10_Y_MODIFY() bfin_read16(DMA10_Y_MODIFY)
716#define bfin_write_DMA10_Y_MODIFY(val) bfin_write16(DMA10_Y_MODIFY, val)
717#define bfin_read_DMA10_CURR_DESC_PTR() bfin_read32(DMA10_CURR_DESC_PTR)
718#define bfin_write_DMA10_CURR_DESC_PTR(val) bfin_write32(DMA10_CURR_DESC_PTR, val)
719#define bfin_read_DMA10_CURR_ADDR() bfin_read32(DMA10_CURR_ADDR)
720#define bfin_write_DMA10_CURR_ADDR(val) bfin_write32(DMA10_CURR_ADDR, val)
721#define bfin_read_DMA10_CURR_X_COUNT() bfin_read16(DMA10_CURR_X_COUNT)
722#define bfin_write_DMA10_CURR_X_COUNT(val) bfin_write16(DMA10_CURR_X_COUNT, val)
723#define bfin_read_DMA10_CURR_Y_COUNT() bfin_read16(DMA10_CURR_Y_COUNT)
724#define bfin_write_DMA10_CURR_Y_COUNT(val) bfin_write16(DMA10_CURR_Y_COUNT, val)
725#define bfin_read_DMA10_IRQ_STATUS() bfin_read16(DMA10_IRQ_STATUS)
726#define bfin_write_DMA10_IRQ_STATUS(val) bfin_write16(DMA10_IRQ_STATUS, val)
727#define bfin_read_DMA10_PERIPHERAL_MAP() bfin_read16(DMA10_PERIPHERAL_MAP)
728#define bfin_write_DMA10_PERIPHERAL_MAP(val) bfin_write16(DMA10_PERIPHERAL_MAP, val)
729
730#define bfin_read_DMA11_CONFIG() bfin_read16(DMA11_CONFIG)
731#define bfin_write_DMA11_CONFIG(val) bfin_write16(DMA11_CONFIG, val)
732#define bfin_read_DMA11_NEXT_DESC_PTR() bfin_read32(DMA11_NEXT_DESC_PTR)
733#define bfin_write_DMA11_NEXT_DESC_PTR(val) bfin_write32(DMA11_NEXT_DESC_PTR, val)
734#define bfin_read_DMA11_START_ADDR() bfin_read32(DMA11_START_ADDR)
735#define bfin_write_DMA11_START_ADDR(val) bfin_write32(DMA11_START_ADDR, val)
736#define bfin_read_DMA11_X_COUNT() bfin_read16(DMA11_X_COUNT)
737#define bfin_write_DMA11_X_COUNT(val) bfin_write16(DMA11_X_COUNT, val)
738#define bfin_read_DMA11_Y_COUNT() bfin_read16(DMA11_Y_COUNT)
739#define bfin_write_DMA11_Y_COUNT(val) bfin_write16(DMA11_Y_COUNT, val)
740#define bfin_read_DMA11_X_MODIFY() bfin_read16(DMA11_X_MODIFY)
741#define bfin_write_DMA11_X_MODIFY(val) bfin_write16(DMA11_X_MODIFY, val)
742#define bfin_read_DMA11_Y_MODIFY() bfin_read16(DMA11_Y_MODIFY)
743#define bfin_write_DMA11_Y_MODIFY(val) bfin_write16(DMA11_Y_MODIFY, val)
744#define bfin_read_DMA11_CURR_DESC_PTR() bfin_read32(DMA11_CURR_DESC_PTR)
745#define bfin_write_DMA11_CURR_DESC_PTR(val) bfin_write32(DMA11_CURR_DESC_PTR, val)
746#define bfin_read_DMA11_CURR_ADDR() bfin_read32(DMA11_CURR_ADDR)
747#define bfin_write_DMA11_CURR_ADDR(val) bfin_write32(DMA11_CURR_ADDR, val)
748#define bfin_read_DMA11_CURR_X_COUNT() bfin_read16(DMA11_CURR_X_COUNT)
749#define bfin_write_DMA11_CURR_X_COUNT(val) bfin_write16(DMA11_CURR_X_COUNT, val)
750#define bfin_read_DMA11_CURR_Y_COUNT() bfin_read16(DMA11_CURR_Y_COUNT)
751#define bfin_write_DMA11_CURR_Y_COUNT(val) bfin_write16(DMA11_CURR_Y_COUNT, val)
752#define bfin_read_DMA11_IRQ_STATUS() bfin_read16(DMA11_IRQ_STATUS)
753#define bfin_write_DMA11_IRQ_STATUS(val) bfin_write16(DMA11_IRQ_STATUS, val)
754#define bfin_read_DMA11_PERIPHERAL_MAP() bfin_read16(DMA11_PERIPHERAL_MAP)
755#define bfin_write_DMA11_PERIPHERAL_MAP(val) bfin_write16(DMA11_PERIPHERAL_MAP, val)
756
757#define bfin_read_MDMA_D0_CONFIG() bfin_read16(MDMA_D0_CONFIG)
758#define bfin_write_MDMA_D0_CONFIG(val) bfin_write16(MDMA_D0_CONFIG, val)
759#define bfin_read_MDMA_D0_NEXT_DESC_PTR() bfin_read32(MDMA_D0_NEXT_DESC_PTR)
760#define bfin_write_MDMA_D0_NEXT_DESC_PTR(val) bfin_write32(MDMA_D0_NEXT_DESC_PTR, val)
761#define bfin_read_MDMA_D0_START_ADDR() bfin_read32(MDMA_D0_START_ADDR)
762#define bfin_write_MDMA_D0_START_ADDR(val) bfin_write32(MDMA_D0_START_ADDR, val)
763#define bfin_read_MDMA_D0_X_COUNT() bfin_read16(MDMA_D0_X_COUNT)
764#define bfin_write_MDMA_D0_X_COUNT(val) bfin_write16(MDMA_D0_X_COUNT, val)
765#define bfin_read_MDMA_D0_Y_COUNT() bfin_read16(MDMA_D0_Y_COUNT)
766#define bfin_write_MDMA_D0_Y_COUNT(val) bfin_write16(MDMA_D0_Y_COUNT, val)
767#define bfin_read_MDMA_D0_X_MODIFY() bfin_read16(MDMA_D0_X_MODIFY)
768#define bfin_write_MDMA_D0_X_MODIFY(val) bfin_write16(MDMA_D0_X_MODIFY, val)
769#define bfin_read_MDMA_D0_Y_MODIFY() bfin_read16(MDMA_D0_Y_MODIFY)
770#define bfin_write_MDMA_D0_Y_MODIFY(val) bfin_write16(MDMA_D0_Y_MODIFY, val)
771#define bfin_read_MDMA_D0_CURR_DESC_PTR() bfin_read32(MDMA_D0_CURR_DESC_PTR)
772#define bfin_write_MDMA_D0_CURR_DESC_PTR(val) bfin_write32(MDMA_D0_CURR_DESC_PTR, val)
773#define bfin_read_MDMA_D0_CURR_ADDR() bfin_read32(MDMA_D0_CURR_ADDR)
774#define bfin_write_MDMA_D0_CURR_ADDR(val) bfin_write32(MDMA_D0_CURR_ADDR, val)
775#define bfin_read_MDMA_D0_CURR_X_COUNT() bfin_read16(MDMA_D0_CURR_X_COUNT)
776#define bfin_write_MDMA_D0_CURR_X_COUNT(val) bfin_write16(MDMA_D0_CURR_X_COUNT, val)
777#define bfin_read_MDMA_D0_CURR_Y_COUNT() bfin_read16(MDMA_D0_CURR_Y_COUNT)
778#define bfin_write_MDMA_D0_CURR_Y_COUNT(val) bfin_write16(MDMA_D0_CURR_Y_COUNT, val)
779#define bfin_read_MDMA_D0_IRQ_STATUS() bfin_read16(MDMA_D0_IRQ_STATUS)
780#define bfin_write_MDMA_D0_IRQ_STATUS(val) bfin_write16(MDMA_D0_IRQ_STATUS, val)
781#define bfin_read_MDMA_D0_PERIPHERAL_MAP() bfin_read16(MDMA_D0_PERIPHERAL_MAP)
782#define bfin_write_MDMA_D0_PERIPHERAL_MAP(val) bfin_write16(MDMA_D0_PERIPHERAL_MAP, val)
783
784#define bfin_read_MDMA_S0_CONFIG() bfin_read16(MDMA_S0_CONFIG)
785#define bfin_write_MDMA_S0_CONFIG(val) bfin_write16(MDMA_S0_CONFIG, val)
786#define bfin_read_MDMA_S0_NEXT_DESC_PTR() bfin_read32(MDMA_S0_NEXT_DESC_PTR)
787#define bfin_write_MDMA_S0_NEXT_DESC_PTR(val) bfin_write32(MDMA_S0_NEXT_DESC_PTR, val)
788#define bfin_read_MDMA_S0_START_ADDR() bfin_read32(MDMA_S0_START_ADDR)
789#define bfin_write_MDMA_S0_START_ADDR(val) bfin_write32(MDMA_S0_START_ADDR, val)
790#define bfin_read_MDMA_S0_X_COUNT() bfin_read16(MDMA_S0_X_COUNT)
791#define bfin_write_MDMA_S0_X_COUNT(val) bfin_write16(MDMA_S0_X_COUNT, val)
792#define bfin_read_MDMA_S0_Y_COUNT() bfin_read16(MDMA_S0_Y_COUNT)
793#define bfin_write_MDMA_S0_Y_COUNT(val) bfin_write16(MDMA_S0_Y_COUNT, val)
794#define bfin_read_MDMA_S0_X_MODIFY() bfin_read16(MDMA_S0_X_MODIFY)
795#define bfin_write_MDMA_S0_X_MODIFY(val) bfin_write16(MDMA_S0_X_MODIFY, val)
796#define bfin_read_MDMA_S0_Y_MODIFY() bfin_read16(MDMA_S0_Y_MODIFY)
797#define bfin_write_MDMA_S0_Y_MODIFY(val) bfin_write16(MDMA_S0_Y_MODIFY, val)
798#define bfin_read_MDMA_S0_CURR_DESC_PTR() bfin_read32(MDMA_S0_CURR_DESC_PTR)
799#define bfin_write_MDMA_S0_CURR_DESC_PTR(val) bfin_write32(MDMA_S0_CURR_DESC_PTR, val)
800#define bfin_read_MDMA_S0_CURR_ADDR() bfin_read32(MDMA_S0_CURR_ADDR)
801#define bfin_write_MDMA_S0_CURR_ADDR(val) bfin_write32(MDMA_S0_CURR_ADDR, val)
802#define bfin_read_MDMA_S0_CURR_X_COUNT() bfin_read16(MDMA_S0_CURR_X_COUNT)
803#define bfin_write_MDMA_S0_CURR_X_COUNT(val) bfin_write16(MDMA_S0_CURR_X_COUNT, val)
804#define bfin_read_MDMA_S0_CURR_Y_COUNT() bfin_read16(MDMA_S0_CURR_Y_COUNT)
805#define bfin_write_MDMA_S0_CURR_Y_COUNT(val) bfin_write16(MDMA_S0_CURR_Y_COUNT, val)
806#define bfin_read_MDMA_S0_IRQ_STATUS() bfin_read16(MDMA_S0_IRQ_STATUS)
807#define bfin_write_MDMA_S0_IRQ_STATUS(val) bfin_write16(MDMA_S0_IRQ_STATUS, val)
808#define bfin_read_MDMA_S0_PERIPHERAL_MAP() bfin_read16(MDMA_S0_PERIPHERAL_MAP)
809#define bfin_write_MDMA_S0_PERIPHERAL_MAP(val) bfin_write16(MDMA_S0_PERIPHERAL_MAP, val)
810
811#define bfin_read_MDMA_D1_CONFIG() bfin_read16(MDMA_D1_CONFIG)
812#define bfin_write_MDMA_D1_CONFIG(val) bfin_write16(MDMA_D1_CONFIG, val)
813#define bfin_read_MDMA_D1_NEXT_DESC_PTR() bfin_read32(MDMA_D1_NEXT_DESC_PTR)
814#define bfin_write_MDMA_D1_NEXT_DESC_PTR(val) bfin_write32(MDMA_D1_NEXT_DESC_PTR, val)
815#define bfin_read_MDMA_D1_START_ADDR() bfin_read32(MDMA_D1_START_ADDR)
816#define bfin_write_MDMA_D1_START_ADDR(val) bfin_write32(MDMA_D1_START_ADDR, val)
817#define bfin_read_MDMA_D1_X_COUNT() bfin_read16(MDMA_D1_X_COUNT)
818#define bfin_write_MDMA_D1_X_COUNT(val) bfin_write16(MDMA_D1_X_COUNT, val)
819#define bfin_read_MDMA_D1_Y_COUNT() bfin_read16(MDMA_D1_Y_COUNT)
820#define bfin_write_MDMA_D1_Y_COUNT(val) bfin_write16(MDMA_D1_Y_COUNT, val)
821#define bfin_read_MDMA_D1_X_MODIFY() bfin_read16(MDMA_D1_X_MODIFY)
822#define bfin_write_MDMA_D1_X_MODIFY(val) bfin_write16(MDMA_D1_X_MODIFY, val)
823#define bfin_read_MDMA_D1_Y_MODIFY() bfin_read16(MDMA_D1_Y_MODIFY)
824#define bfin_write_MDMA_D1_Y_MODIFY(val) bfin_write16(MDMA_D1_Y_MODIFY, val)
825#define bfin_read_MDMA_D1_CURR_DESC_PTR() bfin_read32(MDMA_D1_CURR_DESC_PTR)
826#define bfin_write_MDMA_D1_CURR_DESC_PTR(val) bfin_write32(MDMA_D1_CURR_DESC_PTR, val)
827#define bfin_read_MDMA_D1_CURR_ADDR() bfin_read32(MDMA_D1_CURR_ADDR)
828#define bfin_write_MDMA_D1_CURR_ADDR(val) bfin_write32(MDMA_D1_CURR_ADDR, val)
829#define bfin_read_MDMA_D1_CURR_X_COUNT() bfin_read16(MDMA_D1_CURR_X_COUNT)
830#define bfin_write_MDMA_D1_CURR_X_COUNT(val) bfin_write16(MDMA_D1_CURR_X_COUNT, val)
831#define bfin_read_MDMA_D1_CURR_Y_COUNT() bfin_read16(MDMA_D1_CURR_Y_COUNT)
832#define bfin_write_MDMA_D1_CURR_Y_COUNT(val) bfin_write16(MDMA_D1_CURR_Y_COUNT, val)
833#define bfin_read_MDMA_D1_IRQ_STATUS() bfin_read16(MDMA_D1_IRQ_STATUS)
834#define bfin_write_MDMA_D1_IRQ_STATUS(val) bfin_write16(MDMA_D1_IRQ_STATUS, val)
835#define bfin_read_MDMA_D1_PERIPHERAL_MAP() bfin_read16(MDMA_D1_PERIPHERAL_MAP)
836#define bfin_write_MDMA_D1_PERIPHERAL_MAP(val) bfin_write16(MDMA_D1_PERIPHERAL_MAP, val)
837
838#define bfin_read_MDMA_S1_CONFIG() bfin_read16(MDMA_S1_CONFIG)
839#define bfin_write_MDMA_S1_CONFIG(val) bfin_write16(MDMA_S1_CONFIG, val)
840#define bfin_read_MDMA_S1_NEXT_DESC_PTR() bfin_read32(MDMA_S1_NEXT_DESC_PTR)
841#define bfin_write_MDMA_S1_NEXT_DESC_PTR(val) bfin_write32(MDMA_S1_NEXT_DESC_PTR, val)
842#define bfin_read_MDMA_S1_START_ADDR() bfin_read32(MDMA_S1_START_ADDR)
843#define bfin_write_MDMA_S1_START_ADDR(val) bfin_write32(MDMA_S1_START_ADDR, val)
844#define bfin_read_MDMA_S1_X_COUNT() bfin_read16(MDMA_S1_X_COUNT)
845#define bfin_write_MDMA_S1_X_COUNT(val) bfin_write16(MDMA_S1_X_COUNT, val)
846#define bfin_read_MDMA_S1_Y_COUNT() bfin_read16(MDMA_S1_Y_COUNT)
847#define bfin_write_MDMA_S1_Y_COUNT(val) bfin_write16(MDMA_S1_Y_COUNT, val)
848#define bfin_read_MDMA_S1_X_MODIFY() bfin_read16(MDMA_S1_X_MODIFY)
849#define bfin_write_MDMA_S1_X_MODIFY(val) bfin_write16(MDMA_S1_X_MODIFY, val)
850#define bfin_read_MDMA_S1_Y_MODIFY() bfin_read16(MDMA_S1_Y_MODIFY)
851#define bfin_write_MDMA_S1_Y_MODIFY(val) bfin_write16(MDMA_S1_Y_MODIFY, val)
852#define bfin_read_MDMA_S1_CURR_DESC_PTR() bfin_read32(MDMA_S1_CURR_DESC_PTR)
853#define bfin_write_MDMA_S1_CURR_DESC_PTR(val) bfin_write32(MDMA_S1_CURR_DESC_PTR, val)
854#define bfin_read_MDMA_S1_CURR_ADDR() bfin_read32(MDMA_S1_CURR_ADDR)
855#define bfin_write_MDMA_S1_CURR_ADDR(val) bfin_write32(MDMA_S1_CURR_ADDR, val)
856#define bfin_read_MDMA_S1_CURR_X_COUNT() bfin_read16(MDMA_S1_CURR_X_COUNT)
857#define bfin_write_MDMA_S1_CURR_X_COUNT(val) bfin_write16(MDMA_S1_CURR_X_COUNT, val)
858#define bfin_read_MDMA_S1_CURR_Y_COUNT() bfin_read16(MDMA_S1_CURR_Y_COUNT)
859#define bfin_write_MDMA_S1_CURR_Y_COUNT(val) bfin_write16(MDMA_S1_CURR_Y_COUNT, val)
860#define bfin_read_MDMA_S1_IRQ_STATUS() bfin_read16(MDMA_S1_IRQ_STATUS)
861#define bfin_write_MDMA_S1_IRQ_STATUS(val) bfin_write16(MDMA_S1_IRQ_STATUS, val)
862#define bfin_read_MDMA_S1_PERIPHERAL_MAP() bfin_read16(MDMA_S1_PERIPHERAL_MAP)
863#define bfin_write_MDMA_S1_PERIPHERAL_MAP(val) bfin_write16(MDMA_S1_PERIPHERAL_MAP, val)
864
865
866/* Parallel Peripheral Interface (0xFFC01000 - 0xFFC010FF) */
867#define bfin_read_PPI_CONTROL() bfin_read16(PPI_CONTROL)
868#define bfin_write_PPI_CONTROL(val) bfin_write16(PPI_CONTROL, val)
869#define bfin_read_PPI_STATUS() bfin_read16(PPI_STATUS)
870#define bfin_write_PPI_STATUS(val) bfin_write16(PPI_STATUS, val)
871#define bfin_read_PPI_DELAY() bfin_read16(PPI_DELAY)
872#define bfin_write_PPI_DELAY(val) bfin_write16(PPI_DELAY, val)
873#define bfin_read_PPI_COUNT() bfin_read16(PPI_COUNT)
874#define bfin_write_PPI_COUNT(val) bfin_write16(PPI_COUNT, val)
875#define bfin_read_PPI_FRAME() bfin_read16(PPI_FRAME)
876#define bfin_write_PPI_FRAME(val) bfin_write16(PPI_FRAME, val)
877
878
879/* Two-Wire Interface (0xFFC01400 - 0xFFC014FF) */
880
881/* General Purpose I/O Port G (0xFFC01500 - 0xFFC015FF) */
882#define bfin_read_PORTGIO() bfin_read16(PORTGIO)
883#define bfin_write_PORTGIO(val) bfin_write16(PORTGIO, val)
884#define bfin_read_PORTGIO_CLEAR() bfin_read16(PORTGIO_CLEAR)
885#define bfin_write_PORTGIO_CLEAR(val) bfin_write16(PORTGIO_CLEAR, val)
886#define bfin_read_PORTGIO_SET() bfin_read16(PORTGIO_SET)
887#define bfin_write_PORTGIO_SET(val) bfin_write16(PORTGIO_SET, val)
888#define bfin_read_PORTGIO_TOGGLE() bfin_read16(PORTGIO_TOGGLE)
889#define bfin_write_PORTGIO_TOGGLE(val) bfin_write16(PORTGIO_TOGGLE, val)
890#define bfin_read_PORTGIO_MASKA() bfin_read16(PORTGIO_MASKA)
891#define bfin_write_PORTGIO_MASKA(val) bfin_write16(PORTGIO_MASKA, val)
892#define bfin_read_PORTGIO_MASKA_CLEAR() bfin_read16(PORTGIO_MASKA_CLEAR)
893#define bfin_write_PORTGIO_MASKA_CLEAR(val) bfin_write16(PORTGIO_MASKA_CLEAR, val)
894#define bfin_read_PORTGIO_MASKA_SET() bfin_read16(PORTGIO_MASKA_SET)
895#define bfin_write_PORTGIO_MASKA_SET(val) bfin_write16(PORTGIO_MASKA_SET, val)
896#define bfin_read_PORTGIO_MASKA_TOGGLE() bfin_read16(PORTGIO_MASKA_TOGGLE)
897#define bfin_write_PORTGIO_MASKA_TOGGLE(val) bfin_write16(PORTGIO_MASKA_TOGGLE, val)
898#define bfin_read_PORTGIO_MASKB() bfin_read16(PORTGIO_MASKB)
899#define bfin_write_PORTGIO_MASKB(val) bfin_write16(PORTGIO_MASKB, val)
900#define bfin_read_PORTGIO_MASKB_CLEAR() bfin_read16(PORTGIO_MASKB_CLEAR)
901#define bfin_write_PORTGIO_MASKB_CLEAR(val) bfin_write16(PORTGIO_MASKB_CLEAR, val)
902#define bfin_read_PORTGIO_MASKB_SET() bfin_read16(PORTGIO_MASKB_SET)
903#define bfin_write_PORTGIO_MASKB_SET(val) bfin_write16(PORTGIO_MASKB_SET, val)
904#define bfin_read_PORTGIO_MASKB_TOGGLE() bfin_read16(PORTGIO_MASKB_TOGGLE)
905#define bfin_write_PORTGIO_MASKB_TOGGLE(val) bfin_write16(PORTGIO_MASKB_TOGGLE, val)
906#define bfin_read_PORTGIO_DIR() bfin_read16(PORTGIO_DIR)
907#define bfin_write_PORTGIO_DIR(val) bfin_write16(PORTGIO_DIR, val)
908#define bfin_read_PORTGIO_POLAR() bfin_read16(PORTGIO_POLAR)
909#define bfin_write_PORTGIO_POLAR(val) bfin_write16(PORTGIO_POLAR, val)
910#define bfin_read_PORTGIO_EDGE() bfin_read16(PORTGIO_EDGE)
911#define bfin_write_PORTGIO_EDGE(val) bfin_write16(PORTGIO_EDGE, val)
912#define bfin_read_PORTGIO_BOTH() bfin_read16(PORTGIO_BOTH)
913#define bfin_write_PORTGIO_BOTH(val) bfin_write16(PORTGIO_BOTH, val)
914#define bfin_read_PORTGIO_INEN() bfin_read16(PORTGIO_INEN)
915#define bfin_write_PORTGIO_INEN(val) bfin_write16(PORTGIO_INEN, val)
916
917
918/* General Purpose I/O Port H (0xFFC01700 - 0xFFC017FF) */
919#define bfin_read_PORTHIO() bfin_read16(PORTHIO)
920#define bfin_write_PORTHIO(val) bfin_write16(PORTHIO, val)
921#define bfin_read_PORTHIO_CLEAR() bfin_read16(PORTHIO_CLEAR)
922#define bfin_write_PORTHIO_CLEAR(val) bfin_write16(PORTHIO_CLEAR, val)
923#define bfin_read_PORTHIO_SET() bfin_read16(PORTHIO_SET)
924#define bfin_write_PORTHIO_SET(val) bfin_write16(PORTHIO_SET, val)
925#define bfin_read_PORTHIO_TOGGLE() bfin_read16(PORTHIO_TOGGLE)
926#define bfin_write_PORTHIO_TOGGLE(val) bfin_write16(PORTHIO_TOGGLE, val)
927#define bfin_read_PORTHIO_MASKA() bfin_read16(PORTHIO_MASKA)
928#define bfin_write_PORTHIO_MASKA(val) bfin_write16(PORTHIO_MASKA, val)
929#define bfin_read_PORTHIO_MASKA_CLEAR() bfin_read16(PORTHIO_MASKA_CLEAR)
930#define bfin_write_PORTHIO_MASKA_CLEAR(val) bfin_write16(PORTHIO_MASKA_CLEAR, val)
931#define bfin_read_PORTHIO_MASKA_SET() bfin_read16(PORTHIO_MASKA_SET)
932#define bfin_write_PORTHIO_MASKA_SET(val) bfin_write16(PORTHIO_MASKA_SET, val)
933#define bfin_read_PORTHIO_MASKA_TOGGLE() bfin_read16(PORTHIO_MASKA_TOGGLE)
934#define bfin_write_PORTHIO_MASKA_TOGGLE(val) bfin_write16(PORTHIO_MASKA_TOGGLE, val)
935#define bfin_read_PORTHIO_MASKB() bfin_read16(PORTHIO_MASKB)
936#define bfin_write_PORTHIO_MASKB(val) bfin_write16(PORTHIO_MASKB, val)
937#define bfin_read_PORTHIO_MASKB_CLEAR() bfin_read16(PORTHIO_MASKB_CLEAR)
938#define bfin_write_PORTHIO_MASKB_CLEAR(val) bfin_write16(PORTHIO_MASKB_CLEAR, val)
939#define bfin_read_PORTHIO_MASKB_SET() bfin_read16(PORTHIO_MASKB_SET)
940#define bfin_write_PORTHIO_MASKB_SET(val) bfin_write16(PORTHIO_MASKB_SET, val)
941#define bfin_read_PORTHIO_MASKB_TOGGLE() bfin_read16(PORTHIO_MASKB_TOGGLE)
942#define bfin_write_PORTHIO_MASKB_TOGGLE(val) bfin_write16(PORTHIO_MASKB_TOGGLE, val)
943#define bfin_read_PORTHIO_DIR() bfin_read16(PORTHIO_DIR)
944#define bfin_write_PORTHIO_DIR(val) bfin_write16(PORTHIO_DIR, val)
945#define bfin_read_PORTHIO_POLAR() bfin_read16(PORTHIO_POLAR)
946#define bfin_write_PORTHIO_POLAR(val) bfin_write16(PORTHIO_POLAR, val)
947#define bfin_read_PORTHIO_EDGE() bfin_read16(PORTHIO_EDGE)
948#define bfin_write_PORTHIO_EDGE(val) bfin_write16(PORTHIO_EDGE, val)
949#define bfin_read_PORTHIO_BOTH() bfin_read16(PORTHIO_BOTH)
950#define bfin_write_PORTHIO_BOTH(val) bfin_write16(PORTHIO_BOTH, val)
951#define bfin_read_PORTHIO_INEN() bfin_read16(PORTHIO_INEN)
952#define bfin_write_PORTHIO_INEN(val) bfin_write16(PORTHIO_INEN, val)
953
954
955/* UART1 Controller (0xFFC02000 - 0xFFC020FF) */
956#define bfin_read_UART1_THR() bfin_read16(UART1_THR)
957#define bfin_write_UART1_THR(val) bfin_write16(UART1_THR, val)
958#define bfin_read_UART1_RBR() bfin_read16(UART1_RBR)
959#define bfin_write_UART1_RBR(val) bfin_write16(UART1_RBR, val)
960#define bfin_read_UART1_DLL() bfin_read16(UART1_DLL)
961#define bfin_write_UART1_DLL(val) bfin_write16(UART1_DLL, val)
962#define bfin_read_UART1_IER() bfin_read16(UART1_IER)
963#define bfin_write_UART1_IER(val) bfin_write16(UART1_IER, val)
964#define bfin_read_UART1_DLH() bfin_read16(UART1_DLH)
965#define bfin_write_UART1_DLH(val) bfin_write16(UART1_DLH, val)
966#define bfin_read_UART1_IIR() bfin_read16(UART1_IIR)
967#define bfin_write_UART1_IIR(val) bfin_write16(UART1_IIR, val)
968#define bfin_read_UART1_LCR() bfin_read16(UART1_LCR)
969#define bfin_write_UART1_LCR(val) bfin_write16(UART1_LCR, val)
970#define bfin_read_UART1_MCR() bfin_read16(UART1_MCR)
971#define bfin_write_UART1_MCR(val) bfin_write16(UART1_MCR, val)
972#define bfin_read_UART1_LSR() bfin_read16(UART1_LSR)
973#define bfin_write_UART1_LSR(val) bfin_write16(UART1_LSR, val)
974#define bfin_read_UART1_MSR() bfin_read16(UART1_MSR)
975#define bfin_write_UART1_MSR(val) bfin_write16(UART1_MSR, val)
976#define bfin_read_UART1_SCR() bfin_read16(UART1_SCR)
977#define bfin_write_UART1_SCR(val) bfin_write16(UART1_SCR, val)
978#define bfin_read_UART1_GCTL() bfin_read16(UART1_GCTL)
979#define bfin_write_UART1_GCTL(val) bfin_write16(UART1_GCTL, val)
980
981/* Omit CAN register sets from the cdefBF534.h (CAN is not in the ADSP-BF51x processor) */
982
983/* Pin Control Registers (0xFFC03200 - 0xFFC032FF) */
984#define bfin_read_PORTF_FER() bfin_read16(PORTF_FER)
985#define bfin_write_PORTF_FER(val) bfin_write16(PORTF_FER, val)
986#define bfin_read_PORTG_FER() bfin_read16(PORTG_FER)
987#define bfin_write_PORTG_FER(val) bfin_write16(PORTG_FER, val)
988#define bfin_read_PORTH_FER() bfin_read16(PORTH_FER)
989#define bfin_write_PORTH_FER(val) bfin_write16(PORTH_FER, val)
990#define bfin_read_PORT_MUX() bfin_read16(PORT_MUX)
991#define bfin_write_PORT_MUX(val) bfin_write16(PORT_MUX, val)
992
993
994/* Handshake MDMA Registers (0xFFC03300 - 0xFFC033FF) */
995#define bfin_read_HMDMA0_CONTROL() bfin_read16(HMDMA0_CONTROL)
996#define bfin_write_HMDMA0_CONTROL(val) bfin_write16(HMDMA0_CONTROL, val)
997#define bfin_read_HMDMA0_ECINIT() bfin_read16(HMDMA0_ECINIT)
998#define bfin_write_HMDMA0_ECINIT(val) bfin_write16(HMDMA0_ECINIT, val)
999#define bfin_read_HMDMA0_BCINIT() bfin_read16(HMDMA0_BCINIT)
1000#define bfin_write_HMDMA0_BCINIT(val) bfin_write16(HMDMA0_BCINIT, val)
1001#define bfin_read_HMDMA0_ECURGENT() bfin_read16(HMDMA0_ECURGENT)
1002#define bfin_write_HMDMA0_ECURGENT(val) bfin_write16(HMDMA0_ECURGENT, val)
1003#define bfin_read_HMDMA0_ECOVERFLOW() bfin_read16(HMDMA0_ECOVERFLOW)
1004#define bfin_write_HMDMA0_ECOVERFLOW(val) bfin_write16(HMDMA0_ECOVERFLOW, val)
1005#define bfin_read_HMDMA0_ECOUNT() bfin_read16(HMDMA0_ECOUNT)
1006#define bfin_write_HMDMA0_ECOUNT(val) bfin_write16(HMDMA0_ECOUNT, val)
1007#define bfin_read_HMDMA0_BCOUNT() bfin_read16(HMDMA0_BCOUNT)
1008#define bfin_write_HMDMA0_BCOUNT(val) bfin_write16(HMDMA0_BCOUNT, val)
1009
1010#define bfin_read_HMDMA1_CONTROL() bfin_read16(HMDMA1_CONTROL)
1011#define bfin_write_HMDMA1_CONTROL(val) bfin_write16(HMDMA1_CONTROL, val)
1012#define bfin_read_HMDMA1_ECINIT() bfin_read16(HMDMA1_ECINIT)
1013#define bfin_write_HMDMA1_ECINIT(val) bfin_write16(HMDMA1_ECINIT, val)
1014#define bfin_read_HMDMA1_BCINIT() bfin_read16(HMDMA1_BCINIT)
1015#define bfin_write_HMDMA1_BCINIT(val) bfin_write16(HMDMA1_BCINIT, val)
1016#define bfin_read_HMDMA1_ECURGENT() bfin_read16(HMDMA1_ECURGENT)
1017#define bfin_write_HMDMA1_ECURGENT(val) bfin_write16(HMDMA1_ECURGENT, val)
1018#define bfin_read_HMDMA1_ECOVERFLOW() bfin_read16(HMDMA1_ECOVERFLOW)
1019#define bfin_write_HMDMA1_ECOVERFLOW(val) bfin_write16(HMDMA1_ECOVERFLOW, val)
1020#define bfin_read_HMDMA1_ECOUNT() bfin_read16(HMDMA1_ECOUNT)
1021#define bfin_write_HMDMA1_ECOUNT(val) bfin_write16(HMDMA1_ECOUNT, val)
1022#define bfin_read_HMDMA1_BCOUNT() bfin_read16(HMDMA1_BCOUNT)
1023#define bfin_write_HMDMA1_BCOUNT(val) bfin_write16(HMDMA1_BCOUNT, val)
1024
1025/* ==== end from cdefBF534.h ==== */
1026
1027/* GPIO PIN mux (0xFFC03210 - OxFFC03288) */
1028
1029#define bfin_read_PORTF_MUX() bfin_read16(PORTF_MUX)
1030#define bfin_write_PORTF_MUX(val) bfin_write16(PORTF_MUX, val)
1031#define bfin_read_PORTG_MUX() bfin_read16(PORTG_MUX)
1032#define bfin_write_PORTG_MUX(val) bfin_write16(PORTG_MUX, val)
1033#define bfin_read_PORTH_MUX() bfin_read16(PORTH_MUX)
1034#define bfin_write_PORTH_MUX(val) bfin_write16(PORTH_MUX, val)
1035
1036#define bfin_read_PORTF_DRIVE() bfin_read16(PORTF_DRIVE)
1037#define bfin_write_PORTF_DRIVE(val) bfin_write16(PORTF_DRIVE, val)
1038#define bfin_read_PORTG_DRIVE() bfin_read16(PORTG_DRIVE)
1039#define bfin_write_PORTG_DRIVE(val) bfin_write16(PORTG_DRIVE, val)
1040#define bfin_read_PORTH_DRIVE() bfin_read16(PORTH_DRIVE)
1041#define bfin_write_PORTH_DRIVE(val) bfin_write16(PORTH_DRIVE, val)
1042#define bfin_read_PORTF_SLEW() bfin_read16(PORTF_SLEW)
1043#define bfin_write_PORTF_SLEW(val) bfin_write16(PORTF_SLEW, val)
1044#define bfin_read_PORTG_SLEW() bfin_read16(PORTG_SLEW)
1045#define bfin_write_PORTG_SLEW(val) bfin_write16(PORTG_SLEW, val)
1046#define bfin_read_PORTH_SLEW() bfin_read16(PORTH_SLEW)
1047#define bfin_write_PORTH_SLEW(val) bfin_write16(PORTH_SLEW, val)
1048#define bfin_read_PORTF_HYSTERISIS() bfin_read16(PORTF_HYSTERISIS)
1049#define bfin_write_PORTF_HYSTERISIS(val) bfin_write16(PORTF_HYSTERISIS, val)
1050#define bfin_read_PORTG_HYSTERISIS() bfin_read16(PORTG_HYSTERISIS)
1051#define bfin_write_PORTG_HYSTERISIS(val) bfin_write16(PORTG_HYSTERISIS, val)
1052#define bfin_read_PORTH_HYSTERISIS() bfin_read16(PORTH_HYSTERISIS)
1053#define bfin_write_PORTH_HYSTERISIS(val) bfin_write16(PORTH_HYSTERISIS, val)
1054#define bfin_read_MISCPORT_DRIVE() bfin_read16(MISCPORT_DRIVE)
1055#define bfin_write_MISCPORT_DRIVE(val) bfin_write16(MISCPORT_DRIVE, val)
1056#define bfin_read_MISCPORT_SLEW() bfin_read16(MISCPORT_SLEW)
1057#define bfin_write_MISCPORT_SLEW(val) bfin_write16(MISCPORT_SLEW, val)
1058#define bfin_read_MISCPORT_HYSTERISIS() bfin_read16(MISCPORT_HYSTERISIS)
1059#define bfin_write_MISCPORT_HYSTERISIS(val) bfin_write16(MISCPORT_HYSTERISIS, val)
1060
1061/* HOST Port Registers */
1062
1063#define bfin_read_HOST_CONTROL() bfin_read16(HOST_CONTROL)
1064#define bfin_write_HOST_CONTROL(val) bfin_write16(HOST_CONTROL, val)
1065#define bfin_read_HOST_STATUS() bfin_read16(HOST_STATUS)
1066#define bfin_write_HOST_STATUS(val) bfin_write16(HOST_STATUS, val)
1067#define bfin_read_HOST_TIMEOUT() bfin_read16(HOST_TIMEOUT)
1068#define bfin_write_HOST_TIMEOUT(val) bfin_write16(HOST_TIMEOUT, val)
1069
1070/* Counter Registers */
1071
1072#define bfin_read_CNT_CONFIG() bfin_read16(CNT_CONFIG)
1073#define bfin_write_CNT_CONFIG(val) bfin_write16(CNT_CONFIG, val)
1074#define bfin_read_CNT_IMASK() bfin_read16(CNT_IMASK)
1075#define bfin_write_CNT_IMASK(val) bfin_write16(CNT_IMASK, val)
1076#define bfin_read_CNT_STATUS() bfin_read16(CNT_STATUS)
1077#define bfin_write_CNT_STATUS(val) bfin_write16(CNT_STATUS, val)
1078#define bfin_read_CNT_COMMAND() bfin_read16(CNT_COMMAND)
1079#define bfin_write_CNT_COMMAND(val) bfin_write16(CNT_COMMAND, val)
1080#define bfin_read_CNT_DEBOUNCE() bfin_read16(CNT_DEBOUNCE)
1081#define bfin_write_CNT_DEBOUNCE(val) bfin_write16(CNT_DEBOUNCE, val)
1082#define bfin_read_CNT_COUNTER() bfin_read32(CNT_COUNTER)
1083#define bfin_write_CNT_COUNTER(val) bfin_write32(CNT_COUNTER, val)
1084#define bfin_read_CNT_MAX() bfin_read32(CNT_MAX)
1085#define bfin_write_CNT_MAX(val) bfin_write32(CNT_MAX, val)
1086#define bfin_read_CNT_MIN() bfin_read32(CNT_MIN)
1087#define bfin_write_CNT_MIN(val) bfin_write32(CNT_MIN, val)
1088
1089/* OTP/FUSE Registers */
1090
1091#define bfin_read_OTP_CONTROL() bfin_read16(OTP_CONTROL)
1092#define bfin_write_OTP_CONTROL(val) bfin_write16(OTP_CONTROL, val)
1093#define bfin_read_OTP_BEN() bfin_read16(OTP_BEN)
1094#define bfin_write_OTP_BEN(val) bfin_write16(OTP_BEN, val)
1095#define bfin_read_OTP_STATUS() bfin_read16(OTP_STATUS)
1096#define bfin_write_OTP_STATUS(val) bfin_write16(OTP_STATUS, val)
1097#define bfin_read_OTP_TIMING() bfin_read32(OTP_TIMING)
1098#define bfin_write_OTP_TIMING(val) bfin_write32(OTP_TIMING, val)
1099
1100/* Security Registers */
1101
1102#define bfin_read_SECURE_SYSSWT() bfin_read32(SECURE_SYSSWT)
1103#define bfin_write_SECURE_SYSSWT(val) bfin_write32(SECURE_SYSSWT, val)
1104#define bfin_read_SECURE_CONTROL() bfin_read16(SECURE_CONTROL)
1105#define bfin_write_SECURE_CONTROL(val) bfin_write16(SECURE_CONTROL, val)
1106#define bfin_read_SECURE_STATUS() bfin_read16(SECURE_STATUS)
1107#define bfin_write_SECURE_STATUS(val) bfin_write16(SECURE_STATUS, val)
1108
1109/* OTP Read/Write Data Buffer Registers */
1110
1111#define bfin_read_OTP_DATA0() bfin_read32(OTP_DATA0)
1112#define bfin_write_OTP_DATA0(val) bfin_write32(OTP_DATA0, val)
1113#define bfin_read_OTP_DATA1() bfin_read32(OTP_DATA1)
1114#define bfin_write_OTP_DATA1(val) bfin_write32(OTP_DATA1, val)
1115#define bfin_read_OTP_DATA2() bfin_read32(OTP_DATA2)
1116#define bfin_write_OTP_DATA2(val) bfin_write32(OTP_DATA2, val)
1117#define bfin_read_OTP_DATA3() bfin_read32(OTP_DATA3)
1118#define bfin_write_OTP_DATA3(val) bfin_write32(OTP_DATA3, val)
1119
1120/* NFC Registers */
1121
1122#define bfin_read_NFC_CTL() bfin_read16(NFC_CTL)
1123#define bfin_write_NFC_CTL(val) bfin_write16(NFC_CTL, val)
1124#define bfin_read_NFC_STAT() bfin_read16(NFC_STAT)
1125#define bfin_write_NFC_STAT(val) bfin_write16(NFC_STAT, val)
1126#define bfin_read_NFC_IRQSTAT() bfin_read16(NFC_IRQSTAT)
1127#define bfin_write_NFC_IRQSTAT(val) bfin_write16(NFC_IRQSTAT, val)
1128#define bfin_read_NFC_IRQMASK() bfin_read16(NFC_IRQMASK)
1129#define bfin_write_NFC_IRQMASK(val) bfin_write16(NFC_IRQMASK, val)
1130#define bfin_read_NFC_ECC0() bfin_read16(NFC_ECC0)
1131#define bfin_write_NFC_ECC0(val) bfin_write16(NFC_ECC0, val)
1132#define bfin_read_NFC_ECC1() bfin_read16(NFC_ECC1)
1133#define bfin_write_NFC_ECC1(val) bfin_write16(NFC_ECC1, val)
1134#define bfin_read_NFC_ECC2() bfin_read16(NFC_ECC2)
1135#define bfin_write_NFC_ECC2(val) bfin_write16(NFC_ECC2, val)
1136#define bfin_read_NFC_ECC3() bfin_read16(NFC_ECC3)
1137#define bfin_write_NFC_ECC3(val) bfin_write16(NFC_ECC3, val)
1138#define bfin_read_NFC_COUNT() bfin_read16(NFC_COUNT)
1139#define bfin_write_NFC_COUNT(val) bfin_write16(NFC_COUNT, val)
1140#define bfin_read_NFC_RST() bfin_read16(NFC_RST)
1141#define bfin_write_NFC_RST(val) bfin_write16(NFC_RST, val)
1142#define bfin_read_NFC_PGCTL() bfin_read16(NFC_PGCTL)
1143#define bfin_write_NFC_PGCTL(val) bfin_write16(NFC_PGCTL, val)
1144#define bfin_read_NFC_READ() bfin_read16(NFC_READ)
1145#define bfin_write_NFC_READ(val) bfin_write16(NFC_READ, val)
1146#define bfin_read_NFC_ADDR() bfin_read16(NFC_ADDR)
1147#define bfin_write_NFC_ADDR(val) bfin_write16(NFC_ADDR, val)
1148#define bfin_read_NFC_CMD() bfin_read16(NFC_CMD)
1149#define bfin_write_NFC_CMD(val) bfin_write16(NFC_CMD, val)
1150#define bfin_read_NFC_DATA_WR() bfin_read16(NFC_DATA_WR)
1151#define bfin_write_NFC_DATA_WR(val) bfin_write16(NFC_DATA_WR, val)
1152#define bfin_read_NFC_DATA_RD() bfin_read16(NFC_DATA_RD)
1153#define bfin_write_NFC_DATA_RD(val) bfin_write16(NFC_DATA_RD, val)
1154
1155/* These need to be last due to the cdef/linux inter-dependencies */
1156#include <asm/irq.h>
1157
1158/* Writing to PLL_CTL initiates a PLL relock sequence. */
1159static __inline__ void bfin_write_PLL_CTL(unsigned int val)
1160{
1161 unsigned long flags, iwr0, iwr1;
1162
1163 if (val == bfin_read_PLL_CTL())
1164 return;
1165
1166 local_irq_save_hw(flags);
1167 /* Enable the PLL Wakeup bit in SIC IWR */
1168 iwr0 = bfin_read32(SIC_IWR0);
1169 iwr1 = bfin_read32(SIC_IWR1);
1170 /* Only allow PPL Wakeup) */
1171 bfin_write32(SIC_IWR0, IWR_ENABLE(0));
1172 bfin_write32(SIC_IWR1, 0);
1173
1174 bfin_write16(PLL_CTL, val);
1175 SSYNC();
1176 asm("IDLE;");
1177
1178 bfin_write32(SIC_IWR0, iwr0);
1179 bfin_write32(SIC_IWR1, iwr1);
1180 local_irq_restore_hw(flags);
1181}
1182
1183/* Writing to VR_CTL initiates a PLL relock sequence. */
1184static __inline__ void bfin_write_VR_CTL(unsigned int val)
1185{
1186 unsigned long flags, iwr0, iwr1;
1187
1188 if (val == bfin_read_VR_CTL())
1189 return;
1190
1191 local_irq_save_hw(flags);
1192 /* Enable the PLL Wakeup bit in SIC IWR */
1193 iwr0 = bfin_read32(SIC_IWR0);
1194 iwr1 = bfin_read32(SIC_IWR1);
1195 /* Only allow PPL Wakeup) */
1196 bfin_write32(SIC_IWR0, IWR_ENABLE(0));
1197 bfin_write32(SIC_IWR1, 0);
1198
1199 bfin_write16(VR_CTL, val);
1200 SSYNC();
1201 asm("IDLE;");
1202
1203 bfin_write32(SIC_IWR0, iwr0);
1204 bfin_write32(SIC_IWR1, iwr1);
1205 local_irq_restore_hw(flags);
1206}
1207
1208#endif /* _CDEF_BF52X_H */
diff --git a/arch/blackfin/mach-bf518/include/mach/defBF512.h b/arch/blackfin/mach-bf518/include/mach/defBF512.h
new file mode 100644
index 000000000000..a96ca90154dd
--- /dev/null
+++ b/arch/blackfin/mach-bf518/include/mach/defBF512.h
@@ -0,0 +1,42 @@
1/*
2 * File: include/asm-blackfin/mach-bf518/defBF512.h
3 * Based on:
4 * Author:
5 *
6 * Created:
7 * Description:
8 *
9 * Rev:
10 *
11 * Modified:
12 *
13 * Bugs: Enter bugs at http://blackfin.uclinux.org/
14 *
15 * This program is free software; you can redistribute it and/or modify
16 * it under the terms of the GNU General Public License as published by
17 * the Free Software Foundation; either version 2, or (at your option)
18 * any later version.
19 *
20 * This program is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
24 *
25 * You should have received a copy of the GNU General Public License
26 * along with this program; see the file COPYING.
27 * If not, write to the Free Software Foundation,
28 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
29 */
30
31#ifndef _DEF_BF512_H
32#define _DEF_BF512_H
33
34/* Include all Core registers and bit definitions */
35#include <asm/def_LPBlackfin.h>
36
37/* SYSTEM & MMR ADDRESS DEFINITIONS FOR ADSP-BF512 */
38
39/* Include defBF51x_base.h for the set of #defines that are common to all ADSP-BF51x processors */
40#include "defBF51x_base.h"
41
42#endif /* _DEF_BF512_H */
diff --git a/arch/blackfin/mach-bf518/include/mach/defBF514.h b/arch/blackfin/mach-bf518/include/mach/defBF514.h
new file mode 100644
index 000000000000..543f2913b3f5
--- /dev/null
+++ b/arch/blackfin/mach-bf518/include/mach/defBF514.h
@@ -0,0 +1,113 @@
1/*
2 * File: include/asm-blackfin/mach-bf518/defBF514.h
3 * Based on:
4 * Author:
5 *
6 * Created:
7 * Description:
8 *
9 * Rev:
10 *
11 * Modified:
12 *
13 * Bugs: Enter bugs at http://blackfin.uclinux.org/
14 *
15 * This program is free software; you can redistribute it and/or modify
16 * it under the terms of the GNU General Public License as published by
17 * the Free Software Foundation; either version 2, or (at your option)
18 * any later version.
19 *
20 * This program is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
24 *
25 * You should have received a copy of the GNU General Public License
26 * along with this program; see the file COPYING.
27 * If not, write to the Free Software Foundation,
28 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
29 */
30
31#ifndef _DEF_BF514_H
32#define _DEF_BF514_H
33
34/* Include all Core registers and bit definitions */
35#include <asm/def_LPBlackfin.h>
36
37/* SYSTEM & MMR ADDRESS DEFINITIONS FOR ADSP-BF514 */
38
39/* Include defBF51x_base.h for the set of #defines that are common to all ADSP-BF51x processors */
40#include "defBF51x_base.h"
41
42/* The following are the #defines needed by ADSP-BF514 that are not in the common header */
43
44/* SDH Registers */
45
46#define SDH_PWR_CTL 0xFFC03900 /* SDH Power Control */
47#define SDH_CLK_CTL 0xFFC03904 /* SDH Clock Control */
48#define SDH_ARGUMENT 0xFFC03908 /* SDH Argument */
49#define SDH_COMMAND 0xFFC0390C /* SDH Command */
50#define SDH_RESP_CMD 0xFFC03910 /* SDH Response Command */
51#define SDH_RESPONSE0 0xFFC03914 /* SDH Response0 */
52#define SDH_RESPONSE1 0xFFC03918 /* SDH Response1 */
53#define SDH_RESPONSE2 0xFFC0391C /* SDH Response2 */
54#define SDH_RESPONSE3 0xFFC03920 /* SDH Response3 */
55#define SDH_DATA_TIMER 0xFFC03924 /* SDH Data Timer */
56#define SDH_DATA_LGTH 0xFFC03928 /* SDH Data Length */
57#define SDH_DATA_CTL 0xFFC0392C /* SDH Data Control */
58#define SDH_DATA_CNT 0xFFC03930 /* SDH Data Counter */
59#define SDH_STATUS 0xFFC03934 /* SDH Status */
60#define SDH_STATUS_CLR 0xFFC03938 /* SDH Status Clear */
61#define SDH_MASK0 0xFFC0393C /* SDH Interrupt0 Mask */
62#define SDH_MASK1 0xFFC03940 /* SDH Interrupt1 Mask */
63#define SDH_FIFO_CNT 0xFFC03948 /* SDH FIFO Counter */
64#define SDH_FIFO 0xFFC03980 /* SDH Data FIFO */
65#define SDH_E_STATUS 0xFFC039C0 /* SDH Exception Status */
66#define SDH_E_MASK 0xFFC039C4 /* SDH Exception Mask */
67#define SDH_CFG 0xFFC039C8 /* SDH Configuration */
68#define SDH_RD_WAIT_EN 0xFFC039CC /* SDH Read Wait Enable */
69#define SDH_PID0 0xFFC039D0 /* SDH Peripheral Identification0 */
70#define SDH_PID1 0xFFC039D4 /* SDH Peripheral Identification1 */
71#define SDH_PID2 0xFFC039D8 /* SDH Peripheral Identification2 */
72#define SDH_PID3 0xFFC039DC /* SDH Peripheral Identification3 */
73#define SDH_PID4 0xFFC039E0 /* SDH Peripheral Identification4 */
74#define SDH_PID5 0xFFC039E4 /* SDH Peripheral Identification5 */
75#define SDH_PID6 0xFFC039E8 /* SDH Peripheral Identification6 */
76#define SDH_PID7 0xFFC039EC /* SDH Peripheral Identification7 */
77
78/* Removable Storage Interface Registers */
79
80#define RSI_PWR_CONTROL 0xFFC03800 /* RSI Power Control Register */
81#define RSI_CLK_CONTROL 0xFFC03804 /* RSI Clock Control Register */
82#define RSI_ARGUMENT 0xFFC03808 /* RSI Argument Register */
83#define RSI_COMMAND 0xFFC0380C /* RSI Command Register */
84#define RSI_RESP_CMD 0xFFC03810 /* RSI Response Command Register */
85#define RSI_RESPONSE0 0xFFC03814 /* RSI Response Register */
86#define RSI_RESPONSE1 0xFFC03818 /* RSI Response Register */
87#define RSI_RESPONSE2 0xFFC0381C /* RSI Response Register */
88#define RSI_RESPONSE3 0xFFC03820 /* RSI Response Register */
89#define RSI_DATA_TIMER 0xFFC03824 /* RSI Data Timer Register */
90#define RSI_DATA_LGTH 0xFFC03828 /* RSI Data Length Register */
91#define RSI_DATA_CONTROL 0xFFC0382C /* RSI Data Control Register */
92#define RSI_DATA_CNT 0xFFC03830 /* RSI Data Counter Register */
93#define RSI_STATUS 0xFFC03834 /* RSI Status Register */
94#define RSI_STATUSCL 0xFFC03838 /* RSI Status Clear Register */
95#define RSI_MASK0 0xFFC0383C /* RSI Interrupt 0 Mask Register */
96#define RSI_MASK1 0xFFC03840 /* RSI Interrupt 1 Mask Register */
97#define RSI_FIFO_CNT 0xFFC03848 /* RSI FIFO Counter Register */
98#define RSI_CEATA_CONTROL 0xFFC0384C /* RSI CEATA Register */
99#define RSI_FIFO 0xFFC03880 /* RSI Data FIFO Register */
100#define RSI_ESTAT 0xFFC038C0 /* RSI Exception Status Register */
101#define RSI_EMASK 0xFFC038C4 /* RSI Exception Mask Register */
102#define RSI_CONFIG 0xFFC038C8 /* RSI Configuration Register */
103#define RSI_RD_WAIT_EN 0xFFC038CC /* RSI Read Wait Enable Register */
104#define RSI_PID0 0xFFC03FE0 /* RSI Peripheral ID Register 0 */
105#define RSI_PID1 0xFFC03FE4 /* RSI Peripheral ID Register 1 */
106#define RSI_PID2 0xFFC03FE8 /* RSI Peripheral ID Register 2 */
107#define RSI_PID3 0xFFC03FEC /* RSI Peripheral ID Register 3 */
108#define RSI_PID4 0xFFC03FF0 /* RSI Peripheral ID Register 4 */
109#define RSI_PID5 0xFFC03FF4 /* RSI Peripheral ID Register 5 */
110#define RSI_PID6 0xFFC03FF8 /* RSI Peripheral ID Register 6 */
111#define RSI_PID7 0xFFC03FFC /* RSI Peripheral ID Register 7 */
112
113#endif /* _DEF_BF514_H */
diff --git a/arch/blackfin/mach-bf518/include/mach/defBF516.h b/arch/blackfin/mach-bf518/include/mach/defBF516.h
new file mode 100644
index 000000000000..149a269306c5
--- /dev/null
+++ b/arch/blackfin/mach-bf518/include/mach/defBF516.h
@@ -0,0 +1,490 @@
1/*
2 * File: include/asm-blackfin/mach-bf518/defBF516.h
3 * Based on:
4 * Author:
5 *
6 * Created:
7 * Description:
8 *
9 * Rev:
10 *
11 * Modified:
12 *
13 * Bugs: Enter bugs at http://blackfin.uclinux.org/
14 *
15 * This program is free software; you can redistribute it and/or modify
16 * it under the terms of the GNU General Public License as published by
17 * the Free Software Foundation; either version 2, or (at your option)
18 * any later version.
19 *
20 * This program is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
24 *
25 * You should have received a copy of the GNU General Public License
26 * along with this program; see the file COPYING.
27 * If not, write to the Free Software Foundation,
28 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
29 */
30
31#ifndef _DEF_BF516_H
32#define _DEF_BF516_H
33
34/* Include all Core registers and bit definitions */
35#include <asm/def_LPBlackfin.h>
36
37/* SYSTEM & MMR ADDRESS DEFINITIONS FOR ADSP-BF516 */
38
39/* Include defBF51x_base.h for the set of #defines that are common to all ADSP-BF51x processors */
40#include "defBF51x_base.h"
41
42/* The following are the #defines needed by ADSP-BF516 that are not in the common header */
43/* 10/100 Ethernet Controller (0xFFC03000 - 0xFFC031FF) */
44
45#define EMAC_OPMODE 0xFFC03000 /* Operating Mode Register */
46#define EMAC_ADDRLO 0xFFC03004 /* Address Low (32 LSBs) Register */
47#define EMAC_ADDRHI 0xFFC03008 /* Address High (16 MSBs) Register */
48#define EMAC_HASHLO 0xFFC0300C /* Multicast Hash Table Low (Bins 31-0) Register */
49#define EMAC_HASHHI 0xFFC03010 /* Multicast Hash Table High (Bins 63-32) Register */
50#define EMAC_STAADD 0xFFC03014 /* Station Management Address Register */
51#define EMAC_STADAT 0xFFC03018 /* Station Management Data Register */
52#define EMAC_FLC 0xFFC0301C /* Flow Control Register */
53#define EMAC_VLAN1 0xFFC03020 /* VLAN1 Tag Register */
54#define EMAC_VLAN2 0xFFC03024 /* VLAN2 Tag Register */
55#define EMAC_WKUP_CTL 0xFFC0302C /* Wake-Up Control/Status Register */
56#define EMAC_WKUP_FFMSK0 0xFFC03030 /* Wake-Up Frame Filter 0 Byte Mask Register */
57#define EMAC_WKUP_FFMSK1 0xFFC03034 /* Wake-Up Frame Filter 1 Byte Mask Register */
58#define EMAC_WKUP_FFMSK2 0xFFC03038 /* Wake-Up Frame Filter 2 Byte Mask Register */
59#define EMAC_WKUP_FFMSK3 0xFFC0303C /* Wake-Up Frame Filter 3 Byte Mask Register */
60#define EMAC_WKUP_FFCMD 0xFFC03040 /* Wake-Up Frame Filter Commands Register */
61#define EMAC_WKUP_FFOFF 0xFFC03044 /* Wake-Up Frame Filter Offsets Register */
62#define EMAC_WKUP_FFCRC0 0xFFC03048 /* Wake-Up Frame Filter 0,1 CRC-16 Register */
63#define EMAC_WKUP_FFCRC1 0xFFC0304C /* Wake-Up Frame Filter 2,3 CRC-16 Register */
64
65#define EMAC_SYSCTL 0xFFC03060 /* EMAC System Control Register */
66#define EMAC_SYSTAT 0xFFC03064 /* EMAC System Status Register */
67#define EMAC_RX_STAT 0xFFC03068 /* RX Current Frame Status Register */
68#define EMAC_RX_STKY 0xFFC0306C /* RX Sticky Frame Status Register */
69#define EMAC_RX_IRQE 0xFFC03070 /* RX Frame Status Interrupt Enables Register */
70#define EMAC_TX_STAT 0xFFC03074 /* TX Current Frame Status Register */
71#define EMAC_TX_STKY 0xFFC03078 /* TX Sticky Frame Status Register */
72#define EMAC_TX_IRQE 0xFFC0307C /* TX Frame Status Interrupt Enables Register */
73
74#define EMAC_MMC_CTL 0xFFC03080 /* MMC Counter Control Register */
75#define EMAC_MMC_RIRQS 0xFFC03084 /* MMC RX Interrupt Status Register */
76#define EMAC_MMC_RIRQE 0xFFC03088 /* MMC RX Interrupt Enables Register */
77#define EMAC_MMC_TIRQS 0xFFC0308C /* MMC TX Interrupt Status Register */
78#define EMAC_MMC_TIRQE 0xFFC03090 /* MMC TX Interrupt Enables Register */
79
80#define EMAC_RXC_OK 0xFFC03100 /* RX Frame Successful Count */
81#define EMAC_RXC_FCS 0xFFC03104 /* RX Frame FCS Failure Count */
82#define EMAC_RXC_ALIGN 0xFFC03108 /* RX Alignment Error Count */
83#define EMAC_RXC_OCTET 0xFFC0310C /* RX Octets Successfully Received Count */
84#define EMAC_RXC_DMAOVF 0xFFC03110 /* Internal MAC Sublayer Error RX Frame Count */
85#define EMAC_RXC_UNICST 0xFFC03114 /* Unicast RX Frame Count */
86#define EMAC_RXC_MULTI 0xFFC03118 /* Multicast RX Frame Count */
87#define EMAC_RXC_BROAD 0xFFC0311C /* Broadcast RX Frame Count */
88#define EMAC_RXC_LNERRI 0xFFC03120 /* RX Frame In Range Error Count */
89#define EMAC_RXC_LNERRO 0xFFC03124 /* RX Frame Out Of Range Error Count */
90#define EMAC_RXC_LONG 0xFFC03128 /* RX Frame Too Long Count */
91#define EMAC_RXC_MACCTL 0xFFC0312C /* MAC Control RX Frame Count */
92#define EMAC_RXC_OPCODE 0xFFC03130 /* Unsupported Op-Code RX Frame Count */
93#define EMAC_RXC_PAUSE 0xFFC03134 /* MAC Control Pause RX Frame Count */
94#define EMAC_RXC_ALLFRM 0xFFC03138 /* Overall RX Frame Count */
95#define EMAC_RXC_ALLOCT 0xFFC0313C /* Overall RX Octet Count */
96#define EMAC_RXC_TYPED 0xFFC03140 /* Type/Length Consistent RX Frame Count */
97#define EMAC_RXC_SHORT 0xFFC03144 /* RX Frame Fragment Count - Byte Count x < 64 */
98#define EMAC_RXC_EQ64 0xFFC03148 /* Good RX Frame Count - Byte Count x = 64 */
99#define EMAC_RXC_LT128 0xFFC0314C /* Good RX Frame Count - Byte Count 64 < x < 128 */
100#define EMAC_RXC_LT256 0xFFC03150 /* Good RX Frame Count - Byte Count 128 <= x < 256 */
101#define EMAC_RXC_LT512 0xFFC03154 /* Good RX Frame Count - Byte Count 256 <= x < 512 */
102#define EMAC_RXC_LT1024 0xFFC03158 /* Good RX Frame Count - Byte Count 512 <= x < 1024 */
103#define EMAC_RXC_GE1024 0xFFC0315C /* Good RX Frame Count - Byte Count x >= 1024 */
104
105#define EMAC_TXC_OK 0xFFC03180 /* TX Frame Successful Count */
106#define EMAC_TXC_1COL 0xFFC03184 /* TX Frames Successful After Single Collision Count */
107#define EMAC_TXC_GT1COL 0xFFC03188 /* TX Frames Successful After Multiple Collisions Count */
108#define EMAC_TXC_OCTET 0xFFC0318C /* TX Octets Successfully Received Count */
109#define EMAC_TXC_DEFER 0xFFC03190 /* TX Frame Delayed Due To Busy Count */
110#define EMAC_TXC_LATECL 0xFFC03194 /* Late TX Collisions Count */
111#define EMAC_TXC_XS_COL 0xFFC03198 /* TX Frame Failed Due To Excessive Collisions Count */
112#define EMAC_TXC_DMAUND 0xFFC0319C /* Internal MAC Sublayer Error TX Frame Count */
113#define EMAC_TXC_CRSERR 0xFFC031A0 /* Carrier Sense Deasserted During TX Frame Count */
114#define EMAC_TXC_UNICST 0xFFC031A4 /* Unicast TX Frame Count */
115#define EMAC_TXC_MULTI 0xFFC031A8 /* Multicast TX Frame Count */
116#define EMAC_TXC_BROAD 0xFFC031AC /* Broadcast TX Frame Count */
117#define EMAC_TXC_XS_DFR 0xFFC031B0 /* TX Frames With Excessive Deferral Count */
118#define EMAC_TXC_MACCTL 0xFFC031B4 /* MAC Control TX Frame Count */
119#define EMAC_TXC_ALLFRM 0xFFC031B8 /* Overall TX Frame Count */
120#define EMAC_TXC_ALLOCT 0xFFC031BC /* Overall TX Octet Count */
121#define EMAC_TXC_EQ64 0xFFC031C0 /* Good TX Frame Count - Byte Count x = 64 */
122#define EMAC_TXC_LT128 0xFFC031C4 /* Good TX Frame Count - Byte Count 64 < x < 128 */
123#define EMAC_TXC_LT256 0xFFC031C8 /* Good TX Frame Count - Byte Count 128 <= x < 256 */
124#define EMAC_TXC_LT512 0xFFC031CC /* Good TX Frame Count - Byte Count 256 <= x < 512 */
125#define EMAC_TXC_LT1024 0xFFC031D0 /* Good TX Frame Count - Byte Count 512 <= x < 1024 */
126#define EMAC_TXC_GE1024 0xFFC031D4 /* Good TX Frame Count - Byte Count x >= 1024 */
127#define EMAC_TXC_ABORT 0xFFC031D8 /* Total TX Frames Aborted Count */
128
129/* Listing for IEEE-Supported Count Registers */
130
131#define FramesReceivedOK EMAC_RXC_OK /* RX Frame Successful Count */
132#define FrameCheckSequenceErrors EMAC_RXC_FCS /* RX Frame FCS Failure Count */
133#define AlignmentErrors EMAC_RXC_ALIGN /* RX Alignment Error Count */
134#define OctetsReceivedOK EMAC_RXC_OCTET /* RX Octets Successfully Received Count */
135#define FramesLostDueToIntMACRcvError EMAC_RXC_DMAOVF /* Internal MAC Sublayer Error RX Frame Count */
136#define UnicastFramesReceivedOK EMAC_RXC_UNICST /* Unicast RX Frame Count */
137#define MulticastFramesReceivedOK EMAC_RXC_MULTI /* Multicast RX Frame Count */
138#define BroadcastFramesReceivedOK EMAC_RXC_BROAD /* Broadcast RX Frame Count */
139#define InRangeLengthErrors EMAC_RXC_LNERRI /* RX Frame In Range Error Count */
140#define OutOfRangeLengthField EMAC_RXC_LNERRO /* RX Frame Out Of Range Error Count */
141#define FrameTooLongErrors EMAC_RXC_LONG /* RX Frame Too Long Count */
142#define MACControlFramesReceived EMAC_RXC_MACCTL /* MAC Control RX Frame Count */
143#define UnsupportedOpcodesReceived EMAC_RXC_OPCODE /* Unsupported Op-Code RX Frame Count */
144#define PAUSEMACCtrlFramesReceived EMAC_RXC_PAUSE /* MAC Control Pause RX Frame Count */
145#define FramesReceivedAll EMAC_RXC_ALLFRM /* Overall RX Frame Count */
146#define OctetsReceivedAll EMAC_RXC_ALLOCT /* Overall RX Octet Count */
147#define TypedFramesReceived EMAC_RXC_TYPED /* Type/Length Consistent RX Frame Count */
148#define FramesLenLt64Received EMAC_RXC_SHORT /* RX Frame Fragment Count - Byte Count x < 64 */
149#define FramesLenEq64Received EMAC_RXC_EQ64 /* Good RX Frame Count - Byte Count x = 64 */
150#define FramesLen65_127Received EMAC_RXC_LT128 /* Good RX Frame Count - Byte Count 64 < x < 128 */
151#define FramesLen128_255Received EMAC_RXC_LT256 /* Good RX Frame Count - Byte Count 128 <= x < 256 */
152#define FramesLen256_511Received EMAC_RXC_LT512 /* Good RX Frame Count - Byte Count 256 <= x < 512 */
153#define FramesLen512_1023Received EMAC_RXC_LT1024 /* Good RX Frame Count - Byte Count 512 <= x < 1024 */
154#define FramesLen1024_MaxReceived EMAC_RXC_GE1024 /* Good RX Frame Count - Byte Count x >= 1024 */
155
156#define FramesTransmittedOK EMAC_TXC_OK /* TX Frame Successful Count */
157#define SingleCollisionFrames EMAC_TXC_1COL /* TX Frames Successful After Single Collision Count */
158#define MultipleCollisionFrames EMAC_TXC_GT1COL /* TX Frames Successful After Multiple Collisions Count */
159#define OctetsTransmittedOK EMAC_TXC_OCTET /* TX Octets Successfully Received Count */
160#define FramesWithDeferredXmissions EMAC_TXC_DEFER /* TX Frame Delayed Due To Busy Count */
161#define LateCollisions EMAC_TXC_LATECL /* Late TX Collisions Count */
162#define FramesAbortedDueToXSColls EMAC_TXC_XS_COL /* TX Frame Failed Due To Excessive Collisions Count */
163#define FramesLostDueToIntMacXmitError EMAC_TXC_DMAUND /* Internal MAC Sublayer Error TX Frame Count */
164#define CarrierSenseErrors EMAC_TXC_CRSERR /* Carrier Sense Deasserted During TX Frame Count */
165#define UnicastFramesXmittedOK EMAC_TXC_UNICST /* Unicast TX Frame Count */
166#define MulticastFramesXmittedOK EMAC_TXC_MULTI /* Multicast TX Frame Count */
167#define BroadcastFramesXmittedOK EMAC_TXC_BROAD /* Broadcast TX Frame Count */
168#define FramesWithExcessiveDeferral EMAC_TXC_XS_DFR /* TX Frames With Excessive Deferral Count */
169#define MACControlFramesTransmitted EMAC_TXC_MACCTL /* MAC Control TX Frame Count */
170#define FramesTransmittedAll EMAC_TXC_ALLFRM /* Overall TX Frame Count */
171#define OctetsTransmittedAll EMAC_TXC_ALLOCT /* Overall TX Octet Count */
172#define FramesLenEq64Transmitted EMAC_TXC_EQ64 /* Good TX Frame Count - Byte Count x = 64 */
173#define FramesLen65_127Transmitted EMAC_TXC_LT128 /* Good TX Frame Count - Byte Count 64 < x < 128 */
174#define FramesLen128_255Transmitted EMAC_TXC_LT256 /* Good TX Frame Count - Byte Count 128 <= x < 256 */
175#define FramesLen256_511Transmitted EMAC_TXC_LT512 /* Good TX Frame Count - Byte Count 256 <= x < 512 */
176#define FramesLen512_1023Transmitted EMAC_TXC_LT1024 /* Good TX Frame Count - Byte Count 512 <= x < 1024 */
177#define FramesLen1024_MaxTransmitted EMAC_TXC_GE1024 /* Good TX Frame Count - Byte Count x >= 1024 */
178#define TxAbortedFrames EMAC_TXC_ABORT /* Total TX Frames Aborted Count */
179
180/***********************************************************************************
181** System MMR Register Bits And Macros
182**
183** Disclaimer: All macros are intended to make C and Assembly code more readable.
184** Use these macros carefully, as any that do left shifts for field
185** depositing will result in the lower order bits being destroyed. Any
186** macro that shifts left to properly position the bit-field should be
187** used as part of an OR to initialize a register and NOT as a dynamic
188** modifier UNLESS the lower order bits are saved and ORed back in when
189** the macro is used.
190*************************************************************************************/
191
192/************************ ETHERNET 10/100 CONTROLLER MASKS ************************/
193
194/* EMAC_OPMODE Masks */
195
196#define RE 0x00000001 /* Receiver Enable */
197#define ASTP 0x00000002 /* Enable Automatic Pad Stripping On RX Frames */
198#define HU 0x00000010 /* Hash Filter Unicast Address */
199#define HM 0x00000020 /* Hash Filter Multicast Address */
200#define PAM 0x00000040 /* Pass-All-Multicast Mode Enable */
201#define PR 0x00000080 /* Promiscuous Mode Enable */
202#define IFE 0x00000100 /* Inverse Filtering Enable */
203#define DBF 0x00000200 /* Disable Broadcast Frame Reception */
204#define PBF 0x00000400 /* Pass Bad Frames Enable */
205#define PSF 0x00000800 /* Pass Short Frames Enable */
206#define RAF 0x00001000 /* Receive-All Mode */
207#define TE 0x00010000 /* Transmitter Enable */
208#define DTXPAD 0x00020000 /* Disable Automatic TX Padding */
209#define DTXCRC 0x00040000 /* Disable Automatic TX CRC Generation */
210#define DC 0x00080000 /* Deferral Check */
211#define BOLMT 0x00300000 /* Back-Off Limit */
212#define BOLMT_10 0x00000000 /* 10-bit range */
213#define BOLMT_8 0x00100000 /* 8-bit range */
214#define BOLMT_4 0x00200000 /* 4-bit range */
215#define BOLMT_1 0x00300000 /* 1-bit range */
216#define DRTY 0x00400000 /* Disable TX Retry On Collision */
217#define LCTRE 0x00800000 /* Enable TX Retry On Late Collision */
218#define RMII 0x01000000 /* RMII/MII* Mode */
219#define RMII_10 0x02000000 /* Speed Select for RMII Port (10MBit/100MBit*) */
220#define FDMODE 0x04000000 /* Duplex Mode Enable (Full/Half*) */
221#define LB 0x08000000 /* Internal Loopback Enable */
222#define DRO 0x10000000 /* Disable Receive Own Frames (Half-Duplex Mode) */
223
224/* EMAC_STAADD Masks */
225
226#define STABUSY 0x00000001 /* Initiate Station Mgt Reg Access / STA Busy Stat */
227#define STAOP 0x00000002 /* Station Management Operation Code (Write/Read*) */
228#define STADISPRE 0x00000004 /* Disable Preamble Generation */
229#define STAIE 0x00000008 /* Station Mgt. Transfer Done Interrupt Enable */
230#define REGAD 0x000007C0 /* STA Register Address */
231#define PHYAD 0x0000F800 /* PHY Device Address */
232
233#define SET_REGAD(x) (((x)&0x1F)<< 6 ) /* Set STA Register Address */
234#define SET_PHYAD(x) (((x)&0x1F)<< 11 ) /* Set PHY Device Address */
235
236/* EMAC_STADAT Mask */
237
238#define STADATA 0x0000FFFF /* Station Management Data */
239
240/* EMAC_FLC Masks */
241
242#define FLCBUSY 0x00000001 /* Send Flow Ctrl Frame / Flow Ctrl Busy Status */
243#define FLCE 0x00000002 /* Flow Control Enable */
244#define PCF 0x00000004 /* Pass Control Frames */
245#define BKPRSEN 0x00000008 /* Enable Backpressure */
246#define FLCPAUSE 0xFFFF0000 /* Pause Time */
247
248#define SET_FLCPAUSE(x) (((x)&0xFFFF)<< 16) /* Set Pause Time */
249
250/* EMAC_WKUP_CTL Masks */
251
252#define CAPWKFRM 0x00000001 /* Capture Wake-Up Frames */
253#define MPKE 0x00000002 /* Magic Packet Enable */
254#define RWKE 0x00000004 /* Remote Wake-Up Frame Enable */
255#define GUWKE 0x00000008 /* Global Unicast Wake Enable */
256#define MPKS 0x00000020 /* Magic Packet Received Status */
257#define RWKS 0x00000F00 /* Wake-Up Frame Received Status, Filters 3:0 */
258
259/* EMAC_WKUP_FFCMD Masks */
260
261#define WF0_E 0x00000001 /* Enable Wake-Up Filter 0 */
262#define WF0_T 0x00000008 /* Wake-Up Filter 0 Addr Type (Multicast/Unicast*) */
263#define WF1_E 0x00000100 /* Enable Wake-Up Filter 1 */
264#define WF1_T 0x00000800 /* Wake-Up Filter 1 Addr Type (Multicast/Unicast*) */
265#define WF2_E 0x00010000 /* Enable Wake-Up Filter 2 */
266#define WF2_T 0x00080000 /* Wake-Up Filter 2 Addr Type (Multicast/Unicast*) */
267#define WF3_E 0x01000000 /* Enable Wake-Up Filter 3 */
268#define WF3_T 0x08000000 /* Wake-Up Filter 3 Addr Type (Multicast/Unicast*) */
269
270/* EMAC_WKUP_FFOFF Masks */
271
272#define WF0_OFF 0x000000FF /* Wake-Up Filter 0 Pattern Offset */
273#define WF1_OFF 0x0000FF00 /* Wake-Up Filter 1 Pattern Offset */
274#define WF2_OFF 0x00FF0000 /* Wake-Up Filter 2 Pattern Offset */
275#define WF3_OFF 0xFF000000 /* Wake-Up Filter 3 Pattern Offset */
276
277#define SET_WF0_OFF(x) (((x)&0xFF)<< 0 ) /* Set Wake-Up Filter 0 Byte Offset */
278#define SET_WF1_OFF(x) (((x)&0xFF)<< 8 ) /* Set Wake-Up Filter 1 Byte Offset */
279#define SET_WF2_OFF(x) (((x)&0xFF)<< 16 ) /* Set Wake-Up Filter 2 Byte Offset */
280#define SET_WF3_OFF(x) (((x)&0xFF)<< 24 ) /* Set Wake-Up Filter 3 Byte Offset */
281/* Set ALL Offsets */
282#define SET_WF_OFFS(x0,x1,x2,x3) (SET_WF0_OFF((x0))|SET_WF1_OFF((x1))|SET_WF2_OFF((x2))|SET_WF3_OFF((x3)))
283
284/* EMAC_WKUP_FFCRC0 Masks */
285
286#define WF0_CRC 0x0000FFFF /* Wake-Up Filter 0 Pattern CRC */
287#define WF1_CRC 0xFFFF0000 /* Wake-Up Filter 1 Pattern CRC */
288
289#define SET_WF0_CRC(x) (((x)&0xFFFF)<< 0 ) /* Set Wake-Up Filter 0 Target CRC */
290#define SET_WF1_CRC(x) (((x)&0xFFFF)<< 16 ) /* Set Wake-Up Filter 1 Target CRC */
291
292/* EMAC_WKUP_FFCRC1 Masks */
293
294#define WF2_CRC 0x0000FFFF /* Wake-Up Filter 2 Pattern CRC */
295#define WF3_CRC 0xFFFF0000 /* Wake-Up Filter 3 Pattern CRC */
296
297#define SET_WF2_CRC(x) (((x)&0xFFFF)<< 0 ) /* Set Wake-Up Filter 2 Target CRC */
298#define SET_WF3_CRC(x) (((x)&0xFFFF)<< 16 ) /* Set Wake-Up Filter 3 Target CRC */
299
300/* EMAC_SYSCTL Masks */
301
302#define PHYIE 0x00000001 /* PHY_INT Interrupt Enable */
303#define RXDWA 0x00000002 /* Receive Frame DMA Word Alignment (Odd/Even*) */
304#define RXCKS 0x00000004 /* Enable RX Frame TCP/UDP Checksum Computation */
305#define TXDWA 0x00000010 /* Transmit Frame DMA Word Alignment (Odd/Even*) */
306#define MDCDIV 0x00003F00 /* SCLK:MDC Clock Divisor [MDC=SCLK/(2*(N+1))] */
307
308#define SET_MDCDIV(x) (((x)&0x3F)<< 8) /* Set MDC Clock Divisor */
309
310/* EMAC_SYSTAT Masks */
311
312#define PHYINT 0x00000001 /* PHY_INT Interrupt Status */
313#define MMCINT 0x00000002 /* MMC Counter Interrupt Status */
314#define RXFSINT 0x00000004 /* RX Frame-Status Interrupt Status */
315#define TXFSINT 0x00000008 /* TX Frame-Status Interrupt Status */
316#define WAKEDET 0x00000010 /* Wake-Up Detected Status */
317#define RXDMAERR 0x00000020 /* RX DMA Direction Error Status */
318#define TXDMAERR 0x00000040 /* TX DMA Direction Error Status */
319#define STMDONE 0x00000080 /* Station Mgt. Transfer Done Interrupt Status */
320
321/* EMAC_RX_STAT, EMAC_RX_STKY, and EMAC_RX_IRQE Masks */
322
323#define RX_FRLEN 0x000007FF /* Frame Length In Bytes */
324#define RX_COMP 0x00001000 /* RX Frame Complete */
325#define RX_OK 0x00002000 /* RX Frame Received With No Errors */
326#define RX_LONG 0x00004000 /* RX Frame Too Long Error */
327#define RX_ALIGN 0x00008000 /* RX Frame Alignment Error */
328#define RX_CRC 0x00010000 /* RX Frame CRC Error */
329#define RX_LEN 0x00020000 /* RX Frame Length Error */
330#define RX_FRAG 0x00040000 /* RX Frame Fragment Error */
331#define RX_ADDR 0x00080000 /* RX Frame Address Filter Failed Error */
332#define RX_DMAO 0x00100000 /* RX Frame DMA Overrun Error */
333#define RX_PHY 0x00200000 /* RX Frame PHY Error */
334#define RX_LATE 0x00400000 /* RX Frame Late Collision Error */
335#define RX_RANGE 0x00800000 /* RX Frame Length Field Out of Range Error */
336#define RX_MULTI 0x01000000 /* RX Multicast Frame Indicator */
337#define RX_BROAD 0x02000000 /* RX Broadcast Frame Indicator */
338#define RX_CTL 0x04000000 /* RX Control Frame Indicator */
339#define RX_UCTL 0x08000000 /* Unsupported RX Control Frame Indicator */
340#define RX_TYPE 0x10000000 /* RX Typed Frame Indicator */
341#define RX_VLAN1 0x20000000 /* RX VLAN1 Frame Indicator */
342#define RX_VLAN2 0x40000000 /* RX VLAN2 Frame Indicator */
343#define RX_ACCEPT 0x80000000 /* RX Frame Accepted Indicator */
344
345/* EMAC_TX_STAT, EMAC_TX_STKY, and EMAC_TX_IRQE Masks */
346
347#define TX_COMP 0x00000001 /* TX Frame Complete */
348#define TX_OK 0x00000002 /* TX Frame Sent With No Errors */
349#define TX_ECOLL 0x00000004 /* TX Frame Excessive Collision Error */
350#define TX_LATE 0x00000008 /* TX Frame Late Collision Error */
351#define TX_DMAU 0x00000010 /* TX Frame DMA Underrun Error (STAT) */
352#define TX_MACE 0x00000010 /* Internal MAC Error Detected (STKY and IRQE) */
353#define TX_EDEFER 0x00000020 /* TX Frame Excessive Deferral Error */
354#define TX_BROAD 0x00000040 /* TX Broadcast Frame Indicator */
355#define TX_MULTI 0x00000080 /* TX Multicast Frame Indicator */
356#define TX_CCNT 0x00000F00 /* TX Frame Collision Count */
357#define TX_DEFER 0x00001000 /* TX Frame Deferred Indicator */
358#define TX_CRS 0x00002000 /* TX Frame Carrier Sense Not Asserted Error */
359#define TX_LOSS 0x00004000 /* TX Frame Carrier Lost During TX Error */
360#define TX_RETRY 0x00008000 /* TX Frame Successful After Retry */
361#define TX_FRLEN 0x07FF0000 /* TX Frame Length (Bytes) */
362
363/* EMAC_MMC_CTL Masks */
364#define RSTC 0x00000001 /* Reset All Counters */
365#define CROLL 0x00000002 /* Counter Roll-Over Enable */
366#define CCOR 0x00000004 /* Counter Clear-On-Read Mode Enable */
367#define MMCE 0x00000008 /* Enable MMC Counter Operation */
368
369/* EMAC_MMC_RIRQS and EMAC_MMC_RIRQE Masks */
370#define RX_OK_CNT 0x00000001 /* RX Frames Received With No Errors */
371#define RX_FCS_CNT 0x00000002 /* RX Frames W/Frame Check Sequence Errors */
372#define RX_ALIGN_CNT 0x00000004 /* RX Frames With Alignment Errors */
373#define RX_OCTET_CNT 0x00000008 /* RX Octets Received OK */
374#define RX_LOST_CNT 0x00000010 /* RX Frames Lost Due To Internal MAC RX Error */
375#define RX_UNI_CNT 0x00000020 /* Unicast RX Frames Received OK */
376#define RX_MULTI_CNT 0x00000040 /* Multicast RX Frames Received OK */
377#define RX_BROAD_CNT 0x00000080 /* Broadcast RX Frames Received OK */
378#define RX_IRL_CNT 0x00000100 /* RX Frames With In-Range Length Errors */
379#define RX_ORL_CNT 0x00000200 /* RX Frames With Out-Of-Range Length Errors */
380#define RX_LONG_CNT 0x00000400 /* RX Frames With Frame Too Long Errors */
381#define RX_MACCTL_CNT 0x00000800 /* MAC Control RX Frames Received */
382#define RX_OPCODE_CTL 0x00001000 /* Unsupported Op-Code RX Frames Received */
383#define RX_PAUSE_CNT 0x00002000 /* PAUSEMAC Control RX Frames Received */
384#define RX_ALLF_CNT 0x00004000 /* All RX Frames Received */
385#define RX_ALLO_CNT 0x00008000 /* All RX Octets Received */
386#define RX_TYPED_CNT 0x00010000 /* Typed RX Frames Received */
387#define RX_SHORT_CNT 0x00020000 /* RX Frame Fragments (< 64 Bytes) Received */
388#define RX_EQ64_CNT 0x00040000 /* 64-Byte RX Frames Received */
389#define RX_LT128_CNT 0x00080000 /* 65-127-Byte RX Frames Received */
390#define RX_LT256_CNT 0x00100000 /* 128-255-Byte RX Frames Received */
391#define RX_LT512_CNT 0x00200000 /* 256-511-Byte RX Frames Received */
392#define RX_LT1024_CNT 0x00400000 /* 512-1023-Byte RX Frames Received */
393#define RX_GE1024_CNT 0x00800000 /* 1024-Max-Byte RX Frames Received */
394
395/* EMAC_MMC_TIRQS and EMAC_MMC_TIRQE Masks */
396
397#define TX_OK_CNT 0x00000001 /* TX Frames Sent OK */
398#define TX_SCOLL_CNT 0x00000002 /* TX Frames With Single Collisions */
399#define TX_MCOLL_CNT 0x00000004 /* TX Frames With Multiple Collisions */
400#define TX_OCTET_CNT 0x00000008 /* TX Octets Sent OK */
401#define TX_DEFER_CNT 0x00000010 /* TX Frames With Deferred Transmission */
402#define TX_LATE_CNT 0x00000020 /* TX Frames With Late Collisions */
403#define TX_ABORTC_CNT 0x00000040 /* TX Frames Aborted Due To Excess Collisions */
404#define TX_LOST_CNT 0x00000080 /* TX Frames Lost Due To Internal MAC TX Error */
405#define TX_CRS_CNT 0x00000100 /* TX Frames With Carrier Sense Errors */
406#define TX_UNI_CNT 0x00000200 /* Unicast TX Frames Sent */
407#define TX_MULTI_CNT 0x00000400 /* Multicast TX Frames Sent */
408#define TX_BROAD_CNT 0x00000800 /* Broadcast TX Frames Sent */
409#define TX_EXDEF_CTL 0x00001000 /* TX Frames With Excessive Deferral */
410#define TX_MACCTL_CNT 0x00002000 /* MAC Control TX Frames Sent */
411#define TX_ALLF_CNT 0x00004000 /* All TX Frames Sent */
412#define TX_ALLO_CNT 0x00008000 /* All TX Octets Sent */
413#define TX_EQ64_CNT 0x00010000 /* 64-Byte TX Frames Sent */
414#define TX_LT128_CNT 0x00020000 /* 65-127-Byte TX Frames Sent */
415#define TX_LT256_CNT 0x00040000 /* 128-255-Byte TX Frames Sent */
416#define TX_LT512_CNT 0x00080000 /* 256-511-Byte TX Frames Sent */
417#define TX_LT1024_CNT 0x00100000 /* 512-1023-Byte TX Frames Sent */
418#define TX_GE1024_CNT 0x00200000 /* 1024-Max-Byte TX Frames Sent */
419#define TX_ABORT_CNT 0x00400000 /* TX Frames Aborted */
420
421/* SDH Registers */
422
423#define SDH_PWR_CTL 0xFFC03900 /* SDH Power Control */
424#define SDH_CLK_CTL 0xFFC03904 /* SDH Clock Control */
425#define SDH_ARGUMENT 0xFFC03908 /* SDH Argument */
426#define SDH_COMMAND 0xFFC0390C /* SDH Command */
427#define SDH_RESP_CMD 0xFFC03910 /* SDH Response Command */
428#define SDH_RESPONSE0 0xFFC03914 /* SDH Response0 */
429#define SDH_RESPONSE1 0xFFC03918 /* SDH Response1 */
430#define SDH_RESPONSE2 0xFFC0391C /* SDH Response2 */
431#define SDH_RESPONSE3 0xFFC03920 /* SDH Response3 */
432#define SDH_DATA_TIMER 0xFFC03924 /* SDH Data Timer */
433#define SDH_DATA_LGTH 0xFFC03928 /* SDH Data Length */
434#define SDH_DATA_CTL 0xFFC0392C /* SDH Data Control */
435#define SDH_DATA_CNT 0xFFC03930 /* SDH Data Counter */
436#define SDH_STATUS 0xFFC03934 /* SDH Status */
437#define SDH_STATUS_CLR 0xFFC03938 /* SDH Status Clear */
438#define SDH_MASK0 0xFFC0393C /* SDH Interrupt0 Mask */
439#define SDH_MASK1 0xFFC03940 /* SDH Interrupt1 Mask */
440#define SDH_FIFO_CNT 0xFFC03948 /* SDH FIFO Counter */
441#define SDH_FIFO 0xFFC03980 /* SDH Data FIFO */
442#define SDH_E_STATUS 0xFFC039C0 /* SDH Exception Status */
443#define SDH_E_MASK 0xFFC039C4 /* SDH Exception Mask */
444#define SDH_CFG 0xFFC039C8 /* SDH Configuration */
445#define SDH_RD_WAIT_EN 0xFFC039CC /* SDH Read Wait Enable */
446#define SDH_PID0 0xFFC039D0 /* SDH Peripheral Identification0 */
447#define SDH_PID1 0xFFC039D4 /* SDH Peripheral Identification1 */
448#define SDH_PID2 0xFFC039D8 /* SDH Peripheral Identification2 */
449#define SDH_PID3 0xFFC039DC /* SDH Peripheral Identification3 */
450#define SDH_PID4 0xFFC039E0 /* SDH Peripheral Identification4 */
451#define SDH_PID5 0xFFC039E4 /* SDH Peripheral Identification5 */
452#define SDH_PID6 0xFFC039E8 /* SDH Peripheral Identification6 */
453#define SDH_PID7 0xFFC039EC /* SDH Peripheral Identification7 */
454
455/* Removable Storage Interface Registers */
456
457#define RSI_PWR_CONTROL 0xFFC03800 /* RSI Power Control Register */
458#define RSI_CLK_CONTROL 0xFFC03804 /* RSI Clock Control Register */
459#define RSI_ARGUMENT 0xFFC03808 /* RSI Argument Register */
460#define RSI_COMMAND 0xFFC0380C /* RSI Command Register */
461#define RSI_RESP_CMD 0xFFC03810 /* RSI Response Command Register */
462#define RSI_RESPONSE0 0xFFC03814 /* RSI Response Register */
463#define RSI_RESPONSE1 0xFFC03818 /* RSI Response Register */
464#define RSI_RESPONSE2 0xFFC0381C /* RSI Response Register */
465#define RSI_RESPONSE3 0xFFC03820 /* RSI Response Register */
466#define RSI_DATA_TIMER 0xFFC03824 /* RSI Data Timer Register */
467#define RSI_DATA_LGTH 0xFFC03828 /* RSI Data Length Register */
468#define RSI_DATA_CONTROL 0xFFC0382C /* RSI Data Control Register */
469#define RSI_DATA_CNT 0xFFC03830 /* RSI Data Counter Register */
470#define RSI_STATUS 0xFFC03834 /* RSI Status Register */
471#define RSI_STATUSCL 0xFFC03838 /* RSI Status Clear Register */
472#define RSI_MASK0 0xFFC0383C /* RSI Interrupt 0 Mask Register */
473#define RSI_MASK1 0xFFC03840 /* RSI Interrupt 1 Mask Register */
474#define RSI_FIFO_CNT 0xFFC03848 /* RSI FIFO Counter Register */
475#define RSI_CEATA_CONTROL 0xFFC0384C /* RSI CEATA Register */
476#define RSI_FIFO 0xFFC03880 /* RSI Data FIFO Register */
477#define RSI_ESTAT 0xFFC038C0 /* RSI Exception Status Register */
478#define RSI_EMASK 0xFFC038C4 /* RSI Exception Mask Register */
479#define RSI_CONFIG 0xFFC038C8 /* RSI Configuration Register */
480#define RSI_RD_WAIT_EN 0xFFC038CC /* RSI Read Wait Enable Register */
481#define RSI_PID0 0xFFC03FE0 /* RSI Peripheral ID Register 0 */
482#define RSI_PID1 0xFFC03FE4 /* RSI Peripheral ID Register 1 */
483#define RSI_PID2 0xFFC03FE8 /* RSI Peripheral ID Register 2 */
484#define RSI_PID3 0xFFC03FEC /* RSI Peripheral ID Register 3 */
485#define RSI_PID4 0xFFC03FF0 /* RSI Peripheral ID Register 4 */
486#define RSI_PID5 0xFFC03FF4 /* RSI Peripheral ID Register 5 */
487#define RSI_PID6 0xFFC03FF8 /* RSI Peripheral ID Register 6 */
488#define RSI_PID7 0xFFC03FFC /* RSI Peripheral ID Register 7 */
489
490#endif /* _DEF_BF516_H */
diff --git a/arch/blackfin/mach-bf518/include/mach/defBF518.h b/arch/blackfin/mach-bf518/include/mach/defBF518.h
new file mode 100644
index 000000000000..6e982abf4ede
--- /dev/null
+++ b/arch/blackfin/mach-bf518/include/mach/defBF518.h
@@ -0,0 +1,651 @@
1/*
2 * File: include/asm-blackfin/mach-bf518/defBF518.h
3 * Based on:
4 * Author:
5 *
6 * Created:
7 * Description:
8 *
9 * Rev:
10 *
11 * Modified:
12 *
13 * Bugs: Enter bugs at http://blackfin.uclinux.org/
14 *
15 * This program is free software; you can redistribute it and/or modify
16 * it under the terms of the GNU General Public License as published by
17 * the Free Software Foundation; either version 2, or (at your option)
18 * any later version.
19 *
20 * This program is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
24 *
25 * You should have received a copy of the GNU General Public License
26 * along with this program; see the file COPYING.
27 * If not, write to the Free Software Foundation,
28 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
29 */
30
31#ifndef _DEF_BF518_H
32#define _DEF_BF518_H
33
34/* Include all Core registers and bit definitions */
35#include <asm/def_LPBlackfin.h>
36
37/* SYSTEM & MMR ADDRESS DEFINITIONS FOR ADSP-BF518 */
38
39/* Include defBF51x_base.h for the set of #defines that are common to all ADSP-BF51x processors */
40#include "defBF51x_base.h"
41
42/* The following are the #defines needed by ADSP-BF518 that are not in the common header */
43/* 10/100 Ethernet Controller (0xFFC03000 - 0xFFC031FF) */
44
45#define EMAC_OPMODE 0xFFC03000 /* Operating Mode Register */
46#define EMAC_ADDRLO 0xFFC03004 /* Address Low (32 LSBs) Register */
47#define EMAC_ADDRHI 0xFFC03008 /* Address High (16 MSBs) Register */
48#define EMAC_HASHLO 0xFFC0300C /* Multicast Hash Table Low (Bins 31-0) Register */
49#define EMAC_HASHHI 0xFFC03010 /* Multicast Hash Table High (Bins 63-32) Register */
50#define EMAC_STAADD 0xFFC03014 /* Station Management Address Register */
51#define EMAC_STADAT 0xFFC03018 /* Station Management Data Register */
52#define EMAC_FLC 0xFFC0301C /* Flow Control Register */
53#define EMAC_VLAN1 0xFFC03020 /* VLAN1 Tag Register */
54#define EMAC_VLAN2 0xFFC03024 /* VLAN2 Tag Register */
55#define EMAC_WKUP_CTL 0xFFC0302C /* Wake-Up Control/Status Register */
56#define EMAC_WKUP_FFMSK0 0xFFC03030 /* Wake-Up Frame Filter 0 Byte Mask Register */
57#define EMAC_WKUP_FFMSK1 0xFFC03034 /* Wake-Up Frame Filter 1 Byte Mask Register */
58#define EMAC_WKUP_FFMSK2 0xFFC03038 /* Wake-Up Frame Filter 2 Byte Mask Register */
59#define EMAC_WKUP_FFMSK3 0xFFC0303C /* Wake-Up Frame Filter 3 Byte Mask Register */
60#define EMAC_WKUP_FFCMD 0xFFC03040 /* Wake-Up Frame Filter Commands Register */
61#define EMAC_WKUP_FFOFF 0xFFC03044 /* Wake-Up Frame Filter Offsets Register */
62#define EMAC_WKUP_FFCRC0 0xFFC03048 /* Wake-Up Frame Filter 0,1 CRC-16 Register */
63#define EMAC_WKUP_FFCRC1 0xFFC0304C /* Wake-Up Frame Filter 2,3 CRC-16 Register */
64
65#define EMAC_SYSCTL 0xFFC03060 /* EMAC System Control Register */
66#define EMAC_SYSTAT 0xFFC03064 /* EMAC System Status Register */
67#define EMAC_RX_STAT 0xFFC03068 /* RX Current Frame Status Register */
68#define EMAC_RX_STKY 0xFFC0306C /* RX Sticky Frame Status Register */
69#define EMAC_RX_IRQE 0xFFC03070 /* RX Frame Status Interrupt Enables Register */
70#define EMAC_TX_STAT 0xFFC03074 /* TX Current Frame Status Register */
71#define EMAC_TX_STKY 0xFFC03078 /* TX Sticky Frame Status Register */
72#define EMAC_TX_IRQE 0xFFC0307C /* TX Frame Status Interrupt Enables Register */
73
74#define EMAC_MMC_CTL 0xFFC03080 /* MMC Counter Control Register */
75#define EMAC_MMC_RIRQS 0xFFC03084 /* MMC RX Interrupt Status Register */
76#define EMAC_MMC_RIRQE 0xFFC03088 /* MMC RX Interrupt Enables Register */
77#define EMAC_MMC_TIRQS 0xFFC0308C /* MMC TX Interrupt Status Register */
78#define EMAC_MMC_TIRQE 0xFFC03090 /* MMC TX Interrupt Enables Register */
79
80#define EMAC_RXC_OK 0xFFC03100 /* RX Frame Successful Count */
81#define EMAC_RXC_FCS 0xFFC03104 /* RX Frame FCS Failure Count */
82#define EMAC_RXC_ALIGN 0xFFC03108 /* RX Alignment Error Count */
83#define EMAC_RXC_OCTET 0xFFC0310C /* RX Octets Successfully Received Count */
84#define EMAC_RXC_DMAOVF 0xFFC03110 /* Internal MAC Sublayer Error RX Frame Count */
85#define EMAC_RXC_UNICST 0xFFC03114 /* Unicast RX Frame Count */
86#define EMAC_RXC_MULTI 0xFFC03118 /* Multicast RX Frame Count */
87#define EMAC_RXC_BROAD 0xFFC0311C /* Broadcast RX Frame Count */
88#define EMAC_RXC_LNERRI 0xFFC03120 /* RX Frame In Range Error Count */
89#define EMAC_RXC_LNERRO 0xFFC03124 /* RX Frame Out Of Range Error Count */
90#define EMAC_RXC_LONG 0xFFC03128 /* RX Frame Too Long Count */
91#define EMAC_RXC_MACCTL 0xFFC0312C /* MAC Control RX Frame Count */
92#define EMAC_RXC_OPCODE 0xFFC03130 /* Unsupported Op-Code RX Frame Count */
93#define EMAC_RXC_PAUSE 0xFFC03134 /* MAC Control Pause RX Frame Count */
94#define EMAC_RXC_ALLFRM 0xFFC03138 /* Overall RX Frame Count */
95#define EMAC_RXC_ALLOCT 0xFFC0313C /* Overall RX Octet Count */
96#define EMAC_RXC_TYPED 0xFFC03140 /* Type/Length Consistent RX Frame Count */
97#define EMAC_RXC_SHORT 0xFFC03144 /* RX Frame Fragment Count - Byte Count x < 64 */
98#define EMAC_RXC_EQ64 0xFFC03148 /* Good RX Frame Count - Byte Count x = 64 */
99#define EMAC_RXC_LT128 0xFFC0314C /* Good RX Frame Count - Byte Count 64 < x < 128 */
100#define EMAC_RXC_LT256 0xFFC03150 /* Good RX Frame Count - Byte Count 128 <= x < 256 */
101#define EMAC_RXC_LT512 0xFFC03154 /* Good RX Frame Count - Byte Count 256 <= x < 512 */
102#define EMAC_RXC_LT1024 0xFFC03158 /* Good RX Frame Count - Byte Count 512 <= x < 1024 */
103#define EMAC_RXC_GE1024 0xFFC0315C /* Good RX Frame Count - Byte Count x >= 1024 */
104
105#define EMAC_TXC_OK 0xFFC03180 /* TX Frame Successful Count */
106#define EMAC_TXC_1COL 0xFFC03184 /* TX Frames Successful After Single Collision Count */
107#define EMAC_TXC_GT1COL 0xFFC03188 /* TX Frames Successful After Multiple Collisions Count */
108#define EMAC_TXC_OCTET 0xFFC0318C /* TX Octets Successfully Received Count */
109#define EMAC_TXC_DEFER 0xFFC03190 /* TX Frame Delayed Due To Busy Count */
110#define EMAC_TXC_LATECL 0xFFC03194 /* Late TX Collisions Count */
111#define EMAC_TXC_XS_COL 0xFFC03198 /* TX Frame Failed Due To Excessive Collisions Count */
112#define EMAC_TXC_DMAUND 0xFFC0319C /* Internal MAC Sublayer Error TX Frame Count */
113#define EMAC_TXC_CRSERR 0xFFC031A0 /* Carrier Sense Deasserted During TX Frame Count */
114#define EMAC_TXC_UNICST 0xFFC031A4 /* Unicast TX Frame Count */
115#define EMAC_TXC_MULTI 0xFFC031A8 /* Multicast TX Frame Count */
116#define EMAC_TXC_BROAD 0xFFC031AC /* Broadcast TX Frame Count */
117#define EMAC_TXC_XS_DFR 0xFFC031B0 /* TX Frames With Excessive Deferral Count */
118#define EMAC_TXC_MACCTL 0xFFC031B4 /* MAC Control TX Frame Count */
119#define EMAC_TXC_ALLFRM 0xFFC031B8 /* Overall TX Frame Count */
120#define EMAC_TXC_ALLOCT 0xFFC031BC /* Overall TX Octet Count */
121#define EMAC_TXC_EQ64 0xFFC031C0 /* Good TX Frame Count - Byte Count x = 64 */
122#define EMAC_TXC_LT128 0xFFC031C4 /* Good TX Frame Count - Byte Count 64 < x < 128 */
123#define EMAC_TXC_LT256 0xFFC031C8 /* Good TX Frame Count - Byte Count 128 <= x < 256 */
124#define EMAC_TXC_LT512 0xFFC031CC /* Good TX Frame Count - Byte Count 256 <= x < 512 */
125#define EMAC_TXC_LT1024 0xFFC031D0 /* Good TX Frame Count - Byte Count 512 <= x < 1024 */
126#define EMAC_TXC_GE1024 0xFFC031D4 /* Good TX Frame Count - Byte Count x >= 1024 */
127#define EMAC_TXC_ABORT 0xFFC031D8 /* Total TX Frames Aborted Count */
128
129/* Listing for IEEE-Supported Count Registers */
130
131#define FramesReceivedOK EMAC_RXC_OK /* RX Frame Successful Count */
132#define FrameCheckSequenceErrors EMAC_RXC_FCS /* RX Frame FCS Failure Count */
133#define AlignmentErrors EMAC_RXC_ALIGN /* RX Alignment Error Count */
134#define OctetsReceivedOK EMAC_RXC_OCTET /* RX Octets Successfully Received Count */
135#define FramesLostDueToIntMACRcvError EMAC_RXC_DMAOVF /* Internal MAC Sublayer Error RX Frame Count */
136#define UnicastFramesReceivedOK EMAC_RXC_UNICST /* Unicast RX Frame Count */
137#define MulticastFramesReceivedOK EMAC_RXC_MULTI /* Multicast RX Frame Count */
138#define BroadcastFramesReceivedOK EMAC_RXC_BROAD /* Broadcast RX Frame Count */
139#define InRangeLengthErrors EMAC_RXC_LNERRI /* RX Frame In Range Error Count */
140#define OutOfRangeLengthField EMAC_RXC_LNERRO /* RX Frame Out Of Range Error Count */
141#define FrameTooLongErrors EMAC_RXC_LONG /* RX Frame Too Long Count */
142#define MACControlFramesReceived EMAC_RXC_MACCTL /* MAC Control RX Frame Count */
143#define UnsupportedOpcodesReceived EMAC_RXC_OPCODE /* Unsupported Op-Code RX Frame Count */
144#define PAUSEMACCtrlFramesReceived EMAC_RXC_PAUSE /* MAC Control Pause RX Frame Count */
145#define FramesReceivedAll EMAC_RXC_ALLFRM /* Overall RX Frame Count */
146#define OctetsReceivedAll EMAC_RXC_ALLOCT /* Overall RX Octet Count */
147#define TypedFramesReceived EMAC_RXC_TYPED /* Type/Length Consistent RX Frame Count */
148#define FramesLenLt64Received EMAC_RXC_SHORT /* RX Frame Fragment Count - Byte Count x < 64 */
149#define FramesLenEq64Received EMAC_RXC_EQ64 /* Good RX Frame Count - Byte Count x = 64 */
150#define FramesLen65_127Received EMAC_RXC_LT128 /* Good RX Frame Count - Byte Count 64 < x < 128 */
151#define FramesLen128_255Received EMAC_RXC_LT256 /* Good RX Frame Count - Byte Count 128 <= x < 256 */
152#define FramesLen256_511Received EMAC_RXC_LT512 /* Good RX Frame Count - Byte Count 256 <= x < 512 */
153#define FramesLen512_1023Received EMAC_RXC_LT1024 /* Good RX Frame Count - Byte Count 512 <= x < 1024 */
154#define FramesLen1024_MaxReceived EMAC_RXC_GE1024 /* Good RX Frame Count - Byte Count x >= 1024 */
155
156#define FramesTransmittedOK EMAC_TXC_OK /* TX Frame Successful Count */
157#define SingleCollisionFrames EMAC_TXC_1COL /* TX Frames Successful After Single Collision Count */
158#define MultipleCollisionFrames EMAC_TXC_GT1COL /* TX Frames Successful After Multiple Collisions Count */
159#define OctetsTransmittedOK EMAC_TXC_OCTET /* TX Octets Successfully Received Count */
160#define FramesWithDeferredXmissions EMAC_TXC_DEFER /* TX Frame Delayed Due To Busy Count */
161#define LateCollisions EMAC_TXC_LATECL /* Late TX Collisions Count */
162#define FramesAbortedDueToXSColls EMAC_TXC_XS_COL /* TX Frame Failed Due To Excessive Collisions Count */
163#define FramesLostDueToIntMacXmitError EMAC_TXC_DMAUND /* Internal MAC Sublayer Error TX Frame Count */
164#define CarrierSenseErrors EMAC_TXC_CRSERR /* Carrier Sense Deasserted During TX Frame Count */
165#define UnicastFramesXmittedOK EMAC_TXC_UNICST /* Unicast TX Frame Count */
166#define MulticastFramesXmittedOK EMAC_TXC_MULTI /* Multicast TX Frame Count */
167#define BroadcastFramesXmittedOK EMAC_TXC_BROAD /* Broadcast TX Frame Count */
168#define FramesWithExcessiveDeferral EMAC_TXC_XS_DFR /* TX Frames With Excessive Deferral Count */
169#define MACControlFramesTransmitted EMAC_TXC_MACCTL /* MAC Control TX Frame Count */
170#define FramesTransmittedAll EMAC_TXC_ALLFRM /* Overall TX Frame Count */
171#define OctetsTransmittedAll EMAC_TXC_ALLOCT /* Overall TX Octet Count */
172#define FramesLenEq64Transmitted EMAC_TXC_EQ64 /* Good TX Frame Count - Byte Count x = 64 */
173#define FramesLen65_127Transmitted EMAC_TXC_LT128 /* Good TX Frame Count - Byte Count 64 < x < 128 */
174#define FramesLen128_255Transmitted EMAC_TXC_LT256 /* Good TX Frame Count - Byte Count 128 <= x < 256 */
175#define FramesLen256_511Transmitted EMAC_TXC_LT512 /* Good TX Frame Count - Byte Count 256 <= x < 512 */
176#define FramesLen512_1023Transmitted EMAC_TXC_LT1024 /* Good TX Frame Count - Byte Count 512 <= x < 1024 */
177#define FramesLen1024_MaxTransmitted EMAC_TXC_GE1024 /* Good TX Frame Count - Byte Count x >= 1024 */
178#define TxAbortedFrames EMAC_TXC_ABORT /* Total TX Frames Aborted Count */
179
180/***********************************************************************************
181** System MMR Register Bits And Macros
182**
183** Disclaimer: All macros are intended to make C and Assembly code more readable.
184** Use these macros carefully, as any that do left shifts for field
185** depositing will result in the lower order bits being destroyed. Any
186** macro that shifts left to properly position the bit-field should be
187** used as part of an OR to initialize a register and NOT as a dynamic
188** modifier UNLESS the lower order bits are saved and ORed back in when
189** the macro is used.
190*************************************************************************************/
191
192/************************ ETHERNET 10/100 CONTROLLER MASKS ************************/
193
194/* EMAC_OPMODE Masks */
195
196#define RE 0x00000001 /* Receiver Enable */
197#define ASTP 0x00000002 /* Enable Automatic Pad Stripping On RX Frames */
198#define HU 0x00000010 /* Hash Filter Unicast Address */
199#define HM 0x00000020 /* Hash Filter Multicast Address */
200#define PAM 0x00000040 /* Pass-All-Multicast Mode Enable */
201#define PR 0x00000080 /* Promiscuous Mode Enable */
202#define IFE 0x00000100 /* Inverse Filtering Enable */
203#define DBF 0x00000200 /* Disable Broadcast Frame Reception */
204#define PBF 0x00000400 /* Pass Bad Frames Enable */
205#define PSF 0x00000800 /* Pass Short Frames Enable */
206#define RAF 0x00001000 /* Receive-All Mode */
207#define TE 0x00010000 /* Transmitter Enable */
208#define DTXPAD 0x00020000 /* Disable Automatic TX Padding */
209#define DTXCRC 0x00040000 /* Disable Automatic TX CRC Generation */
210#define DC 0x00080000 /* Deferral Check */
211#define BOLMT 0x00300000 /* Back-Off Limit */
212#define BOLMT_10 0x00000000 /* 10-bit range */
213#define BOLMT_8 0x00100000 /* 8-bit range */
214#define BOLMT_4 0x00200000 /* 4-bit range */
215#define BOLMT_1 0x00300000 /* 1-bit range */
216#define DRTY 0x00400000 /* Disable TX Retry On Collision */
217#define LCTRE 0x00800000 /* Enable TX Retry On Late Collision */
218#define RMII 0x01000000 /* RMII/MII* Mode */
219#define RMII_10 0x02000000 /* Speed Select for RMII Port (10MBit/100MBit*) */
220#define FDMODE 0x04000000 /* Duplex Mode Enable (Full/Half*) */
221#define LB 0x08000000 /* Internal Loopback Enable */
222#define DRO 0x10000000 /* Disable Receive Own Frames (Half-Duplex Mode) */
223
224/* EMAC_STAADD Masks */
225
226#define STABUSY 0x00000001 /* Initiate Station Mgt Reg Access / STA Busy Stat */
227#define STAOP 0x00000002 /* Station Management Operation Code (Write/Read*) */
228#define STADISPRE 0x00000004 /* Disable Preamble Generation */
229#define STAIE 0x00000008 /* Station Mgt. Transfer Done Interrupt Enable */
230#define REGAD 0x000007C0 /* STA Register Address */
231#define PHYAD 0x0000F800 /* PHY Device Address */
232
233#define SET_REGAD(x) (((x)&0x1F)<< 6 ) /* Set STA Register Address */
234#define SET_PHYAD(x) (((x)&0x1F)<< 11 ) /* Set PHY Device Address */
235
236/* EMAC_STADAT Mask */
237
238#define STADATA 0x0000FFFF /* Station Management Data */
239
240/* EMAC_FLC Masks */
241
242#define FLCBUSY 0x00000001 /* Send Flow Ctrl Frame / Flow Ctrl Busy Status */
243#define FLCE 0x00000002 /* Flow Control Enable */
244#define PCF 0x00000004 /* Pass Control Frames */
245#define BKPRSEN 0x00000008 /* Enable Backpressure */
246#define FLCPAUSE 0xFFFF0000 /* Pause Time */
247
248#define SET_FLCPAUSE(x) (((x)&0xFFFF)<< 16) /* Set Pause Time */
249
250/* EMAC_WKUP_CTL Masks */
251
252#define CAPWKFRM 0x00000001 /* Capture Wake-Up Frames */
253#define MPKE 0x00000002 /* Magic Packet Enable */
254#define RWKE 0x00000004 /* Remote Wake-Up Frame Enable */
255#define GUWKE 0x00000008 /* Global Unicast Wake Enable */
256#define MPKS 0x00000020 /* Magic Packet Received Status */
257#define RWKS 0x00000F00 /* Wake-Up Frame Received Status, Filters 3:0 */
258
259/* EMAC_WKUP_FFCMD Masks */
260
261#define WF0_E 0x00000001 /* Enable Wake-Up Filter 0 */
262#define WF0_T 0x00000008 /* Wake-Up Filter 0 Addr Type (Multicast/Unicast*) */
263#define WF1_E 0x00000100 /* Enable Wake-Up Filter 1 */
264#define WF1_T 0x00000800 /* Wake-Up Filter 1 Addr Type (Multicast/Unicast*) */
265#define WF2_E 0x00010000 /* Enable Wake-Up Filter 2 */
266#define WF2_T 0x00080000 /* Wake-Up Filter 2 Addr Type (Multicast/Unicast*) */
267#define WF3_E 0x01000000 /* Enable Wake-Up Filter 3 */
268#define WF3_T 0x08000000 /* Wake-Up Filter 3 Addr Type (Multicast/Unicast*) */
269
270/* EMAC_WKUP_FFOFF Masks */
271
272#define WF0_OFF 0x000000FF /* Wake-Up Filter 0 Pattern Offset */
273#define WF1_OFF 0x0000FF00 /* Wake-Up Filter 1 Pattern Offset */
274#define WF2_OFF 0x00FF0000 /* Wake-Up Filter 2 Pattern Offset */
275#define WF3_OFF 0xFF000000 /* Wake-Up Filter 3 Pattern Offset */
276
277#define SET_WF0_OFF(x) (((x)&0xFF)<< 0 ) /* Set Wake-Up Filter 0 Byte Offset */
278#define SET_WF1_OFF(x) (((x)&0xFF)<< 8 ) /* Set Wake-Up Filter 1 Byte Offset */
279#define SET_WF2_OFF(x) (((x)&0xFF)<< 16 ) /* Set Wake-Up Filter 2 Byte Offset */
280#define SET_WF3_OFF(x) (((x)&0xFF)<< 24 ) /* Set Wake-Up Filter 3 Byte Offset */
281/* Set ALL Offsets */
282#define SET_WF_OFFS(x0,x1,x2,x3) (SET_WF0_OFF((x0))|SET_WF1_OFF((x1))|SET_WF2_OFF((x2))|SET_WF3_OFF((x3)))
283
284/* EMAC_WKUP_FFCRC0 Masks */
285
286#define WF0_CRC 0x0000FFFF /* Wake-Up Filter 0 Pattern CRC */
287#define WF1_CRC 0xFFFF0000 /* Wake-Up Filter 1 Pattern CRC */
288
289#define SET_WF0_CRC(x) (((x)&0xFFFF)<< 0 ) /* Set Wake-Up Filter 0 Target CRC */
290#define SET_WF1_CRC(x) (((x)&0xFFFF)<< 16 ) /* Set Wake-Up Filter 1 Target CRC */
291
292/* EMAC_WKUP_FFCRC1 Masks */
293
294#define WF2_CRC 0x0000FFFF /* Wake-Up Filter 2 Pattern CRC */
295#define WF3_CRC 0xFFFF0000 /* Wake-Up Filter 3 Pattern CRC */
296
297#define SET_WF2_CRC(x) (((x)&0xFFFF)<< 0 ) /* Set Wake-Up Filter 2 Target CRC */
298#define SET_WF3_CRC(x) (((x)&0xFFFF)<< 16 ) /* Set Wake-Up Filter 3 Target CRC */
299
300/* EMAC_SYSCTL Masks */
301
302#define PHYIE 0x00000001 /* PHY_INT Interrupt Enable */
303#define RXDWA 0x00000002 /* Receive Frame DMA Word Alignment (Odd/Even*) */
304#define RXCKS 0x00000004 /* Enable RX Frame TCP/UDP Checksum Computation */
305#define TXDWA 0x00000010 /* Transmit Frame DMA Word Alignment (Odd/Even*) */
306#define MDCDIV 0x00003F00 /* SCLK:MDC Clock Divisor [MDC=SCLK/(2*(N+1))] */
307
308#define SET_MDCDIV(x) (((x)&0x3F)<< 8) /* Set MDC Clock Divisor */
309
310/* EMAC_SYSTAT Masks */
311
312#define PHYINT 0x00000001 /* PHY_INT Interrupt Status */
313#define MMCINT 0x00000002 /* MMC Counter Interrupt Status */
314#define RXFSINT 0x00000004 /* RX Frame-Status Interrupt Status */
315#define TXFSINT 0x00000008 /* TX Frame-Status Interrupt Status */
316#define WAKEDET 0x00000010 /* Wake-Up Detected Status */
317#define RXDMAERR 0x00000020 /* RX DMA Direction Error Status */
318#define TXDMAERR 0x00000040 /* TX DMA Direction Error Status */
319#define STMDONE 0x00000080 /* Station Mgt. Transfer Done Interrupt Status */
320
321/* EMAC_RX_STAT, EMAC_RX_STKY, and EMAC_RX_IRQE Masks */
322
323#define RX_FRLEN 0x000007FF /* Frame Length In Bytes */
324#define RX_COMP 0x00001000 /* RX Frame Complete */
325#define RX_OK 0x00002000 /* RX Frame Received With No Errors */
326#define RX_LONG 0x00004000 /* RX Frame Too Long Error */
327#define RX_ALIGN 0x00008000 /* RX Frame Alignment Error */
328#define RX_CRC 0x00010000 /* RX Frame CRC Error */
329#define RX_LEN 0x00020000 /* RX Frame Length Error */
330#define RX_FRAG 0x00040000 /* RX Frame Fragment Error */
331#define RX_ADDR 0x00080000 /* RX Frame Address Filter Failed Error */
332#define RX_DMAO 0x00100000 /* RX Frame DMA Overrun Error */
333#define RX_PHY 0x00200000 /* RX Frame PHY Error */
334#define RX_LATE 0x00400000 /* RX Frame Late Collision Error */
335#define RX_RANGE 0x00800000 /* RX Frame Length Field Out of Range Error */
336#define RX_MULTI 0x01000000 /* RX Multicast Frame Indicator */
337#define RX_BROAD 0x02000000 /* RX Broadcast Frame Indicator */
338#define RX_CTL 0x04000000 /* RX Control Frame Indicator */
339#define RX_UCTL 0x08000000 /* Unsupported RX Control Frame Indicator */
340#define RX_TYPE 0x10000000 /* RX Typed Frame Indicator */
341#define RX_VLAN1 0x20000000 /* RX VLAN1 Frame Indicator */
342#define RX_VLAN2 0x40000000 /* RX VLAN2 Frame Indicator */
343#define RX_ACCEPT 0x80000000 /* RX Frame Accepted Indicator */
344
345/* EMAC_TX_STAT, EMAC_TX_STKY, and EMAC_TX_IRQE Masks */
346
347#define TX_COMP 0x00000001 /* TX Frame Complete */
348#define TX_OK 0x00000002 /* TX Frame Sent With No Errors */
349#define TX_ECOLL 0x00000004 /* TX Frame Excessive Collision Error */
350#define TX_LATE 0x00000008 /* TX Frame Late Collision Error */
351#define TX_DMAU 0x00000010 /* TX Frame DMA Underrun Error (STAT) */
352#define TX_MACE 0x00000010 /* Internal MAC Error Detected (STKY and IRQE) */
353#define TX_EDEFER 0x00000020 /* TX Frame Excessive Deferral Error */
354#define TX_BROAD 0x00000040 /* TX Broadcast Frame Indicator */
355#define TX_MULTI 0x00000080 /* TX Multicast Frame Indicator */
356#define TX_CCNT 0x00000F00 /* TX Frame Collision Count */
357#define TX_DEFER 0x00001000 /* TX Frame Deferred Indicator */
358#define TX_CRS 0x00002000 /* TX Frame Carrier Sense Not Asserted Error */
359#define TX_LOSS 0x00004000 /* TX Frame Carrier Lost During TX Error */
360#define TX_RETRY 0x00008000 /* TX Frame Successful After Retry */
361#define TX_FRLEN 0x07FF0000 /* TX Frame Length (Bytes) */
362
363/* EMAC_MMC_CTL Masks */
364#define RSTC 0x00000001 /* Reset All Counters */
365#define CROLL 0x00000002 /* Counter Roll-Over Enable */
366#define CCOR 0x00000004 /* Counter Clear-On-Read Mode Enable */
367#define MMCE 0x00000008 /* Enable MMC Counter Operation */
368
369/* EMAC_MMC_RIRQS and EMAC_MMC_RIRQE Masks */
370#define RX_OK_CNT 0x00000001 /* RX Frames Received With No Errors */
371#define RX_FCS_CNT 0x00000002 /* RX Frames W/Frame Check Sequence Errors */
372#define RX_ALIGN_CNT 0x00000004 /* RX Frames With Alignment Errors */
373#define RX_OCTET_CNT 0x00000008 /* RX Octets Received OK */
374#define RX_LOST_CNT 0x00000010 /* RX Frames Lost Due To Internal MAC RX Error */
375#define RX_UNI_CNT 0x00000020 /* Unicast RX Frames Received OK */
376#define RX_MULTI_CNT 0x00000040 /* Multicast RX Frames Received OK */
377#define RX_BROAD_CNT 0x00000080 /* Broadcast RX Frames Received OK */
378#define RX_IRL_CNT 0x00000100 /* RX Frames With In-Range Length Errors */
379#define RX_ORL_CNT 0x00000200 /* RX Frames With Out-Of-Range Length Errors */
380#define RX_LONG_CNT 0x00000400 /* RX Frames With Frame Too Long Errors */
381#define RX_MACCTL_CNT 0x00000800 /* MAC Control RX Frames Received */
382#define RX_OPCODE_CTL 0x00001000 /* Unsupported Op-Code RX Frames Received */
383#define RX_PAUSE_CNT 0x00002000 /* PAUSEMAC Control RX Frames Received */
384#define RX_ALLF_CNT 0x00004000 /* All RX Frames Received */
385#define RX_ALLO_CNT 0x00008000 /* All RX Octets Received */
386#define RX_TYPED_CNT 0x00010000 /* Typed RX Frames Received */
387#define RX_SHORT_CNT 0x00020000 /* RX Frame Fragments (< 64 Bytes) Received */
388#define RX_EQ64_CNT 0x00040000 /* 64-Byte RX Frames Received */
389#define RX_LT128_CNT 0x00080000 /* 65-127-Byte RX Frames Received */
390#define RX_LT256_CNT 0x00100000 /* 128-255-Byte RX Frames Received */
391#define RX_LT512_CNT 0x00200000 /* 256-511-Byte RX Frames Received */
392#define RX_LT1024_CNT 0x00400000 /* 512-1023-Byte RX Frames Received */
393#define RX_GE1024_CNT 0x00800000 /* 1024-Max-Byte RX Frames Received */
394
395/* EMAC_MMC_TIRQS and EMAC_MMC_TIRQE Masks */
396
397#define TX_OK_CNT 0x00000001 /* TX Frames Sent OK */
398#define TX_SCOLL_CNT 0x00000002 /* TX Frames With Single Collisions */
399#define TX_MCOLL_CNT 0x00000004 /* TX Frames With Multiple Collisions */
400#define TX_OCTET_CNT 0x00000008 /* TX Octets Sent OK */
401#define TX_DEFER_CNT 0x00000010 /* TX Frames With Deferred Transmission */
402#define TX_LATE_CNT 0x00000020 /* TX Frames With Late Collisions */
403#define TX_ABORTC_CNT 0x00000040 /* TX Frames Aborted Due To Excess Collisions */
404#define TX_LOST_CNT 0x00000080 /* TX Frames Lost Due To Internal MAC TX Error */
405#define TX_CRS_CNT 0x00000100 /* TX Frames With Carrier Sense Errors */
406#define TX_UNI_CNT 0x00000200 /* Unicast TX Frames Sent */
407#define TX_MULTI_CNT 0x00000400 /* Multicast TX Frames Sent */
408#define TX_BROAD_CNT 0x00000800 /* Broadcast TX Frames Sent */
409#define TX_EXDEF_CTL 0x00001000 /* TX Frames With Excessive Deferral */
410#define TX_MACCTL_CNT 0x00002000 /* MAC Control TX Frames Sent */
411#define TX_ALLF_CNT 0x00004000 /* All TX Frames Sent */
412#define TX_ALLO_CNT 0x00008000 /* All TX Octets Sent */
413#define TX_EQ64_CNT 0x00010000 /* 64-Byte TX Frames Sent */
414#define TX_LT128_CNT 0x00020000 /* 65-127-Byte TX Frames Sent */
415#define TX_LT256_CNT 0x00040000 /* 128-255-Byte TX Frames Sent */
416#define TX_LT512_CNT 0x00080000 /* 256-511-Byte TX Frames Sent */
417#define TX_LT1024_CNT 0x00100000 /* 512-1023-Byte TX Frames Sent */
418#define TX_GE1024_CNT 0x00200000 /* 1024-Max-Byte TX Frames Sent */
419#define TX_ABORT_CNT 0x00400000 /* TX Frames Aborted */
420
421/* SDH Registers */
422
423#define SDH_PWR_CTL 0xFFC03900 /* SDH Power Control */
424#define SDH_CLK_CTL 0xFFC03904 /* SDH Clock Control */
425#define SDH_ARGUMENT 0xFFC03908 /* SDH Argument */
426#define SDH_COMMAND 0xFFC0390C /* SDH Command */
427#define SDH_RESP_CMD 0xFFC03910 /* SDH Response Command */
428#define SDH_RESPONSE0 0xFFC03914 /* SDH Response0 */
429#define SDH_RESPONSE1 0xFFC03918 /* SDH Response1 */
430#define SDH_RESPONSE2 0xFFC0391C /* SDH Response2 */
431#define SDH_RESPONSE3 0xFFC03920 /* SDH Response3 */
432#define SDH_DATA_TIMER 0xFFC03924 /* SDH Data Timer */
433#define SDH_DATA_LGTH 0xFFC03928 /* SDH Data Length */
434#define SDH_DATA_CTL 0xFFC0392C /* SDH Data Control */
435#define SDH_DATA_CNT 0xFFC03930 /* SDH Data Counter */
436#define SDH_STATUS 0xFFC03934 /* SDH Status */
437#define SDH_STATUS_CLR 0xFFC03938 /* SDH Status Clear */
438#define SDH_MASK0 0xFFC0393C /* SDH Interrupt0 Mask */
439#define SDH_MASK1 0xFFC03940 /* SDH Interrupt1 Mask */
440#define SDH_FIFO_CNT 0xFFC03948 /* SDH FIFO Counter */
441#define SDH_FIFO 0xFFC03980 /* SDH Data FIFO */
442#define SDH_E_STATUS 0xFFC039C0 /* SDH Exception Status */
443#define SDH_E_MASK 0xFFC039C4 /* SDH Exception Mask */
444#define SDH_CFG 0xFFC039C8 /* SDH Configuration */
445#define SDH_RD_WAIT_EN 0xFFC039CC /* SDH Read Wait Enable */
446#define SDH_PID0 0xFFC039D0 /* SDH Peripheral Identification0 */
447#define SDH_PID1 0xFFC039D4 /* SDH Peripheral Identification1 */
448#define SDH_PID2 0xFFC039D8 /* SDH Peripheral Identification2 */
449#define SDH_PID3 0xFFC039DC /* SDH Peripheral Identification3 */
450#define SDH_PID4 0xFFC039E0 /* SDH Peripheral Identification4 */
451#define SDH_PID5 0xFFC039E4 /* SDH Peripheral Identification5 */
452#define SDH_PID6 0xFFC039E8 /* SDH Peripheral Identification6 */
453#define SDH_PID7 0xFFC039EC /* SDH Peripheral Identification7 */
454
455/* Removable Storage Interface Registers */
456
457#define RSI_PWR_CONTROL 0xFFC03800 /* RSI Power Control Register */
458#define RSI_CLK_CONTROL 0xFFC03804 /* RSI Clock Control Register */
459#define RSI_ARGUMENT 0xFFC03808 /* RSI Argument Register */
460#define RSI_COMMAND 0xFFC0380C /* RSI Command Register */
461#define RSI_RESP_CMD 0xFFC03810 /* RSI Response Command Register */
462#define RSI_RESPONSE0 0xFFC03814 /* RSI Response Register */
463#define RSI_RESPONSE1 0xFFC03818 /* RSI Response Register */
464#define RSI_RESPONSE2 0xFFC0381C /* RSI Response Register */
465#define RSI_RESPONSE3 0xFFC03820 /* RSI Response Register */
466#define RSI_DATA_TIMER 0xFFC03824 /* RSI Data Timer Register */
467#define RSI_DATA_LGTH 0xFFC03828 /* RSI Data Length Register */
468#define RSI_DATA_CONTROL 0xFFC0382C /* RSI Data Control Register */
469#define RSI_DATA_CNT 0xFFC03830 /* RSI Data Counter Register */
470#define RSI_STATUS 0xFFC03834 /* RSI Status Register */
471#define RSI_STATUSCL 0xFFC03838 /* RSI Status Clear Register */
472#define RSI_MASK0 0xFFC0383C /* RSI Interrupt 0 Mask Register */
473#define RSI_MASK1 0xFFC03840 /* RSI Interrupt 1 Mask Register */
474#define RSI_FIFO_CNT 0xFFC03848 /* RSI FIFO Counter Register */
475#define RSI_CEATA_CONTROL 0xFFC0384C /* RSI CEATA Register */
476#define RSI_FIFO 0xFFC03880 /* RSI Data FIFO Register */
477#define RSI_ESTAT 0xFFC038C0 /* RSI Exception Status Register */
478#define RSI_EMASK 0xFFC038C4 /* RSI Exception Mask Register */
479#define RSI_CONFIG 0xFFC038C8 /* RSI Configuration Register */
480#define RSI_RD_WAIT_EN 0xFFC038CC /* RSI Read Wait Enable Register */
481#define RSI_PID0 0xFFC03FE0 /* RSI Peripheral ID Register 0 */
482#define RSI_PID1 0xFFC03FE4 /* RSI Peripheral ID Register 1 */
483#define RSI_PID2 0xFFC03FE8 /* RSI Peripheral ID Register 2 */
484#define RSI_PID3 0xFFC03FEC /* RSI Peripheral ID Register 3 */
485#define RSI_PID4 0xFFC03FF0 /* RSI Peripheral ID Register 4 */
486#define RSI_PID5 0xFFC03FF4 /* RSI Peripheral ID Register 5 */
487#define RSI_PID6 0xFFC03FF8 /* RSI Peripheral ID Register 6 */
488#define RSI_PID7 0xFFC03FFC /* RSI Peripheral ID Register 7 */
489
490/* PTP TSYNC Registers */
491
492#define EMAC_PTP_CTL 0xFFC030A0 /* PTP Block Control */
493#define EMAC_PTP_IE 0xFFC030A4 /* PTP Block Interrupt Enable */
494#define EMAC_PTP_ISTAT 0xFFC030A8 /* PTP Block Interrupt Status */
495#define EMAC_PTP_FOFF 0xFFC030AC /* PTP Filter offset Register */
496#define EMAC_PTP_FV1 0xFFC030B0 /* PTP Filter Value Register 1 */
497#define EMAC_PTP_FV2 0xFFC030B4 /* PTP Filter Value Register 2 */
498#define EMAC_PTP_FV3 0xFFC030B8 /* PTP Filter Value Register 3 */
499#define EMAC_PTP_ADDEND 0xFFC030BC /* PTP Addend for Frequency Compensation */
500#define EMAC_PTP_ACCR 0xFFC030C0 /* PTP Accumulator for Frequency Compensation */
501#define EMAC_PTP_OFFSET 0xFFC030C4 /* PTP Time Offset Register */
502#define EMAC_PTP_TIMELO 0xFFC030C8 /* PTP Precision Clock Time Low */
503#define EMAC_PTP_TIMEHI 0xFFC030CC /* PTP Precision Clock Time High */
504#define EMAC_PTP_RXSNAPLO 0xFFC030D0 /* PTP Receive Snapshot Register Low */
505#define EMAC_PTP_RXSNAPHI 0xFFC030D4 /* PTP Receive Snapshot Register High */
506#define EMAC_PTP_TXSNAPLO 0xFFC030D8 /* PTP Transmit Snapshot Register Low */
507#define EMAC_PTP_TXSNAPHI 0xFFC030DC /* PTP Transmit Snapshot Register High */
508#define EMAC_PTP_ALARMLO 0xFFC030E0 /* PTP Alarm time Low */
509#define EMAC_PTP_ALARMHI 0xFFC030E4 /* PTP Alarm time High */
510#define EMAC_PTP_ID_OFF 0xFFC030E8 /* PTP Capture ID offset register */
511#define EMAC_PTP_ID_SNAP 0xFFC030EC /* PTP Capture ID register */
512#define EMAC_PTP_PPS_STARTLO 0xFFC030F0 /* PPS Start Time Low */
513#define EMAC_PTP_PPS_STARTHI 0xFFC030F4 /* PPS Start Time High */
514#define EMAC_PTP_PPS_PERIOD 0xFFC030F8 /* PPS Count Register */
515
516/* ********************************************************** */
517/* SINGLE BIT MACRO PAIRS (bit mask and negated one) */
518/* and MULTI BIT READ MACROS */
519/* ********************************************************** */
520
521/* Bit masks for SDH_COMMAND */
522
523#define CMD_IDX 0x3f /* Command Index */
524#define CMD_RSP 0x40 /* Response */
525#define CMD_L_RSP 0x80 /* Long Response */
526#define CMD_INT_E 0x100 /* Command Interrupt */
527#define CMD_PEND_E 0x200 /* Command Pending */
528#define CMD_E 0x400 /* Command Enable */
529
530/* Bit masks for SDH_PWR_CTL */
531
532#define PWR_ON 0x3 /* Power On */
533#if 0
534#define TBD 0x3c /* TBD */
535#endif
536#define SD_CMD_OD 0x40 /* Open Drain Output */
537#define ROD_CTL 0x80 /* Rod Control */
538
539/* Bit masks for SDH_CLK_CTL */
540
541#define CLKDIV 0xff /* MC_CLK Divisor */
542#define CLK_E 0x100 /* MC_CLK Bus Clock Enable */
543#define PWR_SV_E 0x200 /* Power Save Enable */
544#define CLKDIV_BYPASS 0x400 /* Bypass Divisor */
545#define WIDE_BUS 0x800 /* Wide Bus Mode Enable */
546
547/* Bit masks for SDH_RESP_CMD */
548
549#define RESP_CMD 0x3f /* Response Command */
550
551/* Bit masks for SDH_DATA_CTL */
552
553#define DTX_E 0x1 /* Data Transfer Enable */
554#define DTX_DIR 0x2 /* Data Transfer Direction */
555#define DTX_MODE 0x4 /* Data Transfer Mode */
556#define DTX_DMA_E 0x8 /* Data Transfer DMA Enable */
557#define DTX_BLK_LGTH 0xf0 /* Data Transfer Block Length */
558
559/* Bit masks for SDH_STATUS */
560
561#define CMD_CRC_FAIL 0x1 /* CMD CRC Fail */
562#define DAT_CRC_FAIL 0x2 /* Data CRC Fail */
563#define CMD_TIME_OUT 0x4 /* CMD Time Out */
564#define DAT_TIME_OUT 0x8 /* Data Time Out */
565#define TX_UNDERRUN 0x10 /* Transmit Underrun */
566#define RX_OVERRUN 0x20 /* Receive Overrun */
567#define CMD_RESP_END 0x40 /* CMD Response End */
568#define CMD_SENT 0x80 /* CMD Sent */
569#define DAT_END 0x100 /* Data End */
570#define START_BIT_ERR 0x200 /* Start Bit Error */
571#define DAT_BLK_END 0x400 /* Data Block End */
572#define CMD_ACT 0x800 /* CMD Active */
573#define TX_ACT 0x1000 /* Transmit Active */
574#define RX_ACT 0x2000 /* Receive Active */
575#define TX_FIFO_STAT 0x4000 /* Transmit FIFO Status */
576#define RX_FIFO_STAT 0x8000 /* Receive FIFO Status */
577#define TX_FIFO_FULL 0x10000 /* Transmit FIFO Full */
578#define RX_FIFO_FULL 0x20000 /* Receive FIFO Full */
579#define TX_FIFO_ZERO 0x40000 /* Transmit FIFO Empty */
580#define RX_DAT_ZERO 0x80000 /* Receive FIFO Empty */
581#define TX_DAT_RDY 0x100000 /* Transmit Data Available */
582#define RX_FIFO_RDY 0x200000 /* Receive Data Available */
583
584/* Bit masks for SDH_STATUS_CLR */
585
586#define CMD_CRC_FAIL_STAT 0x1 /* CMD CRC Fail Status */
587#define DAT_CRC_FAIL_STAT 0x2 /* Data CRC Fail Status */
588#define CMD_TIMEOUT_STAT 0x4 /* CMD Time Out Status */
589#define DAT_TIMEOUT_STAT 0x8 /* Data Time Out status */
590#define TX_UNDERRUN_STAT 0x10 /* Transmit Underrun Status */
591#define RX_OVERRUN_STAT 0x20 /* Receive Overrun Status */
592#define CMD_RESP_END_STAT 0x40 /* CMD Response End Status */
593#define CMD_SENT_STAT 0x80 /* CMD Sent Status */
594#define DAT_END_STAT 0x100 /* Data End Status */
595#define START_BIT_ERR_STAT 0x200 /* Start Bit Error Status */
596#define DAT_BLK_END_STAT 0x400 /* Data Block End Status */
597
598/* Bit masks for SDH_MASK0 */
599
600#define CMD_CRC_FAIL_MASK 0x1 /* CMD CRC Fail Mask */
601#define DAT_CRC_FAIL_MASK 0x2 /* Data CRC Fail Mask */
602#define CMD_TIMEOUT_MASK 0x4 /* CMD Time Out Mask */
603#define DAT_TIMEOUT_MASK 0x8 /* Data Time Out Mask */
604#define TX_UNDERRUN_MASK 0x10 /* Transmit Underrun Mask */
605#define RX_OVERRUN_MASK 0x20 /* Receive Overrun Mask */
606#define CMD_RESP_END_MASK 0x40 /* CMD Response End Mask */
607#define CMD_SENT_MASK 0x80 /* CMD Sent Mask */
608#define DAT_END_MASK 0x100 /* Data End Mask */
609#define START_BIT_ERR_MASK 0x200 /* Start Bit Error Mask */
610#define DAT_BLK_END_MASK 0x400 /* Data Block End Mask */
611#define CMD_ACT_MASK 0x800 /* CMD Active Mask */
612#define TX_ACT_MASK 0x1000 /* Transmit Active Mask */
613#define RX_ACT_MASK 0x2000 /* Receive Active Mask */
614#define TX_FIFO_STAT_MASK 0x4000 /* Transmit FIFO Status Mask */
615#define RX_FIFO_STAT_MASK 0x8000 /* Receive FIFO Status Mask */
616#define TX_FIFO_FULL_MASK 0x10000 /* Transmit FIFO Full Mask */
617#define RX_FIFO_FULL_MASK 0x20000 /* Receive FIFO Full Mask */
618#define TX_FIFO_ZERO_MASK 0x40000 /* Transmit FIFO Empty Mask */
619#define RX_DAT_ZERO_MASK 0x80000 /* Receive FIFO Empty Mask */
620#define TX_DAT_RDY_MASK 0x100000 /* Transmit Data Available Mask */
621#define RX_FIFO_RDY_MASK 0x200000 /* Receive Data Available Mask */
622
623/* Bit masks for SDH_FIFO_CNT */
624
625#define FIFO_COUNT 0x7fff /* FIFO Count */
626
627/* Bit masks for SDH_E_STATUS */
628
629#define SDIO_INT_DET 0x2 /* SDIO Int Detected */
630#define SD_CARD_DET 0x10 /* SD Card Detect */
631
632/* Bit masks for SDH_E_MASK */
633
634#define SDIO_MSK 0x2 /* Mask SDIO Int Detected */
635#define SCD_MSK 0x40 /* Mask Card Detect */
636
637/* Bit masks for SDH_CFG */
638
639#define CLKS_EN 0x1 /* Clocks Enable */
640#define SD4E 0x4 /* SDIO 4-Bit Enable */
641#define MWE 0x8 /* Moving Window Enable */
642#define SD_RST 0x10 /* SDMMC Reset */
643#define PUP_SDDAT 0x20 /* Pull-up SD_DAT */
644#define PUP_SDDAT3 0x40 /* Pull-up SD_DAT3 */
645#define PD_SDDAT3 0x80 /* Pull-down SD_DAT3 */
646
647/* Bit masks for SDH_RD_WAIT_EN */
648
649#define RWR 0x1 /* Read Wait Request */
650
651#endif /* _DEF_BF518_H */
diff --git a/arch/blackfin/mach-bf518/include/mach/defBF51x_base.h b/arch/blackfin/mach-bf518/include/mach/defBF51x_base.h
new file mode 100644
index 000000000000..1bec8d1c2a73
--- /dev/null
+++ b/arch/blackfin/mach-bf518/include/mach/defBF51x_base.h
@@ -0,0 +1,1940 @@
1/*
2 * File: include/asm-blackfin/mach-bf518/defBF51x_base.h
3 * Based on:
4 * Author:
5 *
6 * Created:
7 * Description:
8 *
9 * Rev:
10 *
11 * Modified:
12 *
13 * Bugs: Enter bugs at http://blackfin.uclinux.org/
14 *
15 * This program is free software; you can redistribute it and/or modify
16 * it under the terms of the GNU General Public License as published by
17 * the Free Software Foundation; either version 2, or (at your option)
18 * any later version.
19 *
20 * This program is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
24 *
25 * You should have received a copy of the GNU General Public License
26 * along with this program; see the file COPYING.
27 * If not, write to the Free Software Foundation,
28 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
29 */
30
31#ifndef _DEF_BF51X_H
32#define _DEF_BF51X_H
33
34
35/* ************************************************************** */
36/* SYSTEM & MMR ADDRESS DEFINITIONS COMMON TO ALL ADSP-BF51x */
37/* ************************************************************** */
38
39/* Clock and System Control (0xFFC00000 - 0xFFC000FF) */
40#define PLL_CTL 0xFFC00000 /* PLL Control Register */
41#define PLL_DIV 0xFFC00004 /* PLL Divide Register */
42#define VR_CTL 0xFFC00008 /* Voltage Regulator Control Register */
43#define PLL_STAT 0xFFC0000C /* PLL Status Register */
44#define PLL_LOCKCNT 0xFFC00010 /* PLL Lock Count Register */
45#define CHIPID 0xFFC00014 /* Device ID Register */
46
47/* System Interrupt Controller (0xFFC00100 - 0xFFC001FF) */
48#define SWRST 0xFFC00100 /* Software Reset Register */
49#define SYSCR 0xFFC00104 /* System Configuration Register */
50#define SIC_RVECT 0xFFC00108 /* Interrupt Reset Vector Address Register */
51
52#define SIC_IMASK0 0xFFC0010C /* Interrupt Mask Register */
53#define SIC_IAR0 0xFFC00110 /* Interrupt Assignment Register 0 */
54#define SIC_IAR1 0xFFC00114 /* Interrupt Assignment Register 1 */
55#define SIC_IAR2 0xFFC00118 /* Interrupt Assignment Register 2 */
56#define SIC_IAR3 0xFFC0011C /* Interrupt Assignment Register 3 */
57#define SIC_ISR0 0xFFC00120 /* Interrupt Status Register */
58#define SIC_IWR0 0xFFC00124 /* Interrupt Wakeup Register */
59
60/* SIC Additions to ADSP-BF51x (0xFFC0014C - 0xFFC00162) */
61#define SIC_IMASK1 0xFFC0014C /* Interrupt Mask register of SIC2 */
62#define SIC_IAR4 0xFFC00150 /* Interrupt Assignment register4 */
63#define SIC_IAR5 0xFFC00154 /* Interrupt Assignment register5 */
64#define SIC_IAR6 0xFFC00158 /* Interrupt Assignment register6 */
65#define SIC_IAR7 0xFFC0015C /* Interrupt Assignment register7 */
66#define SIC_ISR1 0xFFC00160 /* Interrupt Statur register */
67#define SIC_IWR1 0xFFC00164 /* Interrupt Wakeup register */
68
69
70/* Watchdog Timer (0xFFC00200 - 0xFFC002FF) */
71#define WDOG_CTL 0xFFC00200 /* Watchdog Control Register */
72#define WDOG_CNT 0xFFC00204 /* Watchdog Count Register */
73#define WDOG_STAT 0xFFC00208 /* Watchdog Status Register */
74
75
76/* Real Time Clock (0xFFC00300 - 0xFFC003FF) */
77#define RTC_STAT 0xFFC00300 /* RTC Status Register */
78#define RTC_ICTL 0xFFC00304 /* RTC Interrupt Control Register */
79#define RTC_ISTAT 0xFFC00308 /* RTC Interrupt Status Register */
80#define RTC_SWCNT 0xFFC0030C /* RTC Stopwatch Count Register */
81#define RTC_ALARM 0xFFC00310 /* RTC Alarm Time Register */
82#define RTC_FAST 0xFFC00314 /* RTC Prescaler Enable Register */
83#define RTC_PREN 0xFFC00314 /* RTC Prescaler Enable Alternate Macro */
84
85
86/* UART0 Controller (0xFFC00400 - 0xFFC004FF) */
87#define UART0_THR 0xFFC00400 /* Transmit Holding register */
88#define UART0_RBR 0xFFC00400 /* Receive Buffer register */
89#define UART0_DLL 0xFFC00400 /* Divisor Latch (Low-Byte) */
90#define UART0_IER 0xFFC00404 /* Interrupt Enable Register */
91#define UART0_DLH 0xFFC00404 /* Divisor Latch (High-Byte) */
92#define UART0_IIR 0xFFC00408 /* Interrupt Identification Register */
93#define UART0_LCR 0xFFC0040C /* Line Control Register */
94#define UART0_MCR 0xFFC00410 /* Modem Control Register */
95#define UART0_LSR 0xFFC00414 /* Line Status Register */
96#define UART0_MSR 0xFFC00418 /* Modem Status Register */
97#define UART0_SCR 0xFFC0041C /* SCR Scratch Register */
98#define UART0_GCTL 0xFFC00424 /* Global Control Register */
99
100/* SPI0 Controller (0xFFC00500 - 0xFFC005FF) */
101#define SPI0_REGBASE 0xFFC00500
102#define SPI0_CTL 0xFFC00500 /* SPI Control Register */
103#define SPI0_FLG 0xFFC00504 /* SPI Flag register */
104#define SPI0_STAT 0xFFC00508 /* SPI Status register */
105#define SPI0_TDBR 0xFFC0050C /* SPI Transmit Data Buffer Register */
106#define SPI0_RDBR 0xFFC00510 /* SPI Receive Data Buffer Register */
107#define SPI0_BAUD 0xFFC00514 /* SPI Baud rate Register */
108#define SPI0_SHADOW 0xFFC00518 /* SPI_RDBR Shadow Register */
109
110/* SPI1 Controller (0xFFC03400 - 0xFFC034FF) */
111#define SPI1_REGBASE 0xFFC03400
112#define SPI1_CTL 0xFFC03400 /* SPI Control Register */
113#define SPI1_FLG 0xFFC03404 /* SPI Flag register */
114#define SPI1_STAT 0xFFC03408 /* SPI Status register */
115#define SPI1_TDBR 0xFFC0340C /* SPI Transmit Data Buffer Register */
116#define SPI1_RDBR 0xFFC03410 /* SPI Receive Data Buffer Register */
117#define SPI1_BAUD 0xFFC03414 /* SPI Baud rate Register */
118#define SPI1_SHADOW 0xFFC03418 /* SPI_RDBR Shadow Register */
119
120/* TIMER0-7 Registers (0xFFC00600 - 0xFFC006FF) */
121#define TIMER0_CONFIG 0xFFC00600 /* Timer 0 Configuration Register */
122#define TIMER0_COUNTER 0xFFC00604 /* Timer 0 Counter Register */
123#define TIMER0_PERIOD 0xFFC00608 /* Timer 0 Period Register */
124#define TIMER0_WIDTH 0xFFC0060C /* Timer 0 Width Register */
125
126#define TIMER1_CONFIG 0xFFC00610 /* Timer 1 Configuration Register */
127#define TIMER1_COUNTER 0xFFC00614 /* Timer 1 Counter Register */
128#define TIMER1_PERIOD 0xFFC00618 /* Timer 1 Period Register */
129#define TIMER1_WIDTH 0xFFC0061C /* Timer 1 Width Register */
130
131#define TIMER2_CONFIG 0xFFC00620 /* Timer 2 Configuration Register */
132#define TIMER2_COUNTER 0xFFC00624 /* Timer 2 Counter Register */
133#define TIMER2_PERIOD 0xFFC00628 /* Timer 2 Period Register */
134#define TIMER2_WIDTH 0xFFC0062C /* Timer 2 Width Register */
135
136#define TIMER3_CONFIG 0xFFC00630 /* Timer 3 Configuration Register */
137#define TIMER3_COUNTER 0xFFC00634 /* Timer 3 Counter Register */
138#define TIMER3_PERIOD 0xFFC00638 /* Timer 3 Period Register */
139#define TIMER3_WIDTH 0xFFC0063C /* Timer 3 Width Register */
140
141#define TIMER4_CONFIG 0xFFC00640 /* Timer 4 Configuration Register */
142#define TIMER4_COUNTER 0xFFC00644 /* Timer 4 Counter Register */
143#define TIMER4_PERIOD 0xFFC00648 /* Timer 4 Period Register */
144#define TIMER4_WIDTH 0xFFC0064C /* Timer 4 Width Register */
145
146#define TIMER5_CONFIG 0xFFC00650 /* Timer 5 Configuration Register */
147#define TIMER5_COUNTER 0xFFC00654 /* Timer 5 Counter Register */
148#define TIMER5_PERIOD 0xFFC00658 /* Timer 5 Period Register */
149#define TIMER5_WIDTH 0xFFC0065C /* Timer 5 Width Register */
150
151#define TIMER6_CONFIG 0xFFC00660 /* Timer 6 Configuration Register */
152#define TIMER6_COUNTER 0xFFC00664 /* Timer 6 Counter Register */
153#define TIMER6_PERIOD 0xFFC00668 /* Timer 6 Period Register */
154#define TIMER6_WIDTH 0xFFC0066C /* Timer 6 Width Register */
155
156#define TIMER7_CONFIG 0xFFC00670 /* Timer 7 Configuration Register */
157#define TIMER7_COUNTER 0xFFC00674 /* Timer 7 Counter Register */
158#define TIMER7_PERIOD 0xFFC00678 /* Timer 7 Period Register */
159#define TIMER7_WIDTH 0xFFC0067C /* Timer 7 Width Register */
160
161#define TIMER_ENABLE 0xFFC00680 /* Timer Enable Register */
162#define TIMER_DISABLE 0xFFC00684 /* Timer Disable Register */
163#define TIMER_STATUS 0xFFC00688 /* Timer Status Register */
164
165/* General Purpose I/O Port F (0xFFC00700 - 0xFFC007FF) */
166#define PORTFIO 0xFFC00700 /* Port F I/O Pin State Specify Register */
167#define PORTFIO_CLEAR 0xFFC00704 /* Port F I/O Peripheral Interrupt Clear Register */
168#define PORTFIO_SET 0xFFC00708 /* Port F I/O Peripheral Interrupt Set Register */
169#define PORTFIO_TOGGLE 0xFFC0070C /* Port F I/O Pin State Toggle Register */
170#define PORTFIO_MASKA 0xFFC00710 /* Port F I/O Mask State Specify Interrupt A Register */
171#define PORTFIO_MASKA_CLEAR 0xFFC00714 /* Port F I/O Mask Disable Interrupt A Register */
172#define PORTFIO_MASKA_SET 0xFFC00718 /* Port F I/O Mask Enable Interrupt A Register */
173#define PORTFIO_MASKA_TOGGLE 0xFFC0071C /* Port F I/O Mask Toggle Enable Interrupt A Register */
174#define PORTFIO_MASKB 0xFFC00720 /* Port F I/O Mask State Specify Interrupt B Register */
175#define PORTFIO_MASKB_CLEAR 0xFFC00724 /* Port F I/O Mask Disable Interrupt B Register */
176#define PORTFIO_MASKB_SET 0xFFC00728 /* Port F I/O Mask Enable Interrupt B Register */
177#define PORTFIO_MASKB_TOGGLE 0xFFC0072C /* Port F I/O Mask Toggle Enable Interrupt B Register */
178#define PORTFIO_DIR 0xFFC00730 /* Port F I/O Direction Register */
179#define PORTFIO_POLAR 0xFFC00734 /* Port F I/O Source Polarity Register */
180#define PORTFIO_EDGE 0xFFC00738 /* Port F I/O Source Sensitivity Register */
181#define PORTFIO_BOTH 0xFFC0073C /* Port F I/O Set on BOTH Edges Register */
182#define PORTFIO_INEN 0xFFC00740 /* Port F I/O Input Enable Register */
183
184/* SPORT0 Controller (0xFFC00800 - 0xFFC008FF) */
185#define SPORT0_TCR1 0xFFC00800 /* SPORT0 Transmit Configuration 1 Register */
186#define SPORT0_TCR2 0xFFC00804 /* SPORT0 Transmit Configuration 2 Register */
187#define SPORT0_TCLKDIV 0xFFC00808 /* SPORT0 Transmit Clock Divider */
188#define SPORT0_TFSDIV 0xFFC0080C /* SPORT0 Transmit Frame Sync Divider */
189#define SPORT0_TX 0xFFC00810 /* SPORT0 TX Data Register */
190#define SPORT0_RX 0xFFC00818 /* SPORT0 RX Data Register */
191#define SPORT0_RCR1 0xFFC00820 /* SPORT0 Transmit Configuration 1 Register */
192#define SPORT0_RCR2 0xFFC00824 /* SPORT0 Transmit Configuration 2 Register */
193#define SPORT0_RCLKDIV 0xFFC00828 /* SPORT0 Receive Clock Divider */
194#define SPORT0_RFSDIV 0xFFC0082C /* SPORT0 Receive Frame Sync Divider */
195#define SPORT0_STAT 0xFFC00830 /* SPORT0 Status Register */
196#define SPORT0_CHNL 0xFFC00834 /* SPORT0 Current Channel Register */
197#define SPORT0_MCMC1 0xFFC00838 /* SPORT0 Multi-Channel Configuration Register 1 */
198#define SPORT0_MCMC2 0xFFC0083C /* SPORT0 Multi-Channel Configuration Register 2 */
199#define SPORT0_MTCS0 0xFFC00840 /* SPORT0 Multi-Channel Transmit Select Register 0 */
200#define SPORT0_MTCS1 0xFFC00844 /* SPORT0 Multi-Channel Transmit Select Register 1 */
201#define SPORT0_MTCS2 0xFFC00848 /* SPORT0 Multi-Channel Transmit Select Register 2 */
202#define SPORT0_MTCS3 0xFFC0084C /* SPORT0 Multi-Channel Transmit Select Register 3 */
203#define SPORT0_MRCS0 0xFFC00850 /* SPORT0 Multi-Channel Receive Select Register 0 */
204#define SPORT0_MRCS1 0xFFC00854 /* SPORT0 Multi-Channel Receive Select Register 1 */
205#define SPORT0_MRCS2 0xFFC00858 /* SPORT0 Multi-Channel Receive Select Register 2 */
206#define SPORT0_MRCS3 0xFFC0085C /* SPORT0 Multi-Channel Receive Select Register 3 */
207
208/* SPORT1 Controller (0xFFC00900 - 0xFFC009FF) */
209#define SPORT1_TCR1 0xFFC00900 /* SPORT1 Transmit Configuration 1 Register */
210#define SPORT1_TCR2 0xFFC00904 /* SPORT1 Transmit Configuration 2 Register */
211#define SPORT1_TCLKDIV 0xFFC00908 /* SPORT1 Transmit Clock Divider */
212#define SPORT1_TFSDIV 0xFFC0090C /* SPORT1 Transmit Frame Sync Divider */
213#define SPORT1_TX 0xFFC00910 /* SPORT1 TX Data Register */
214#define SPORT1_RX 0xFFC00918 /* SPORT1 RX Data Register */
215#define SPORT1_RCR1 0xFFC00920 /* SPORT1 Transmit Configuration 1 Register */
216#define SPORT1_RCR2 0xFFC00924 /* SPORT1 Transmit Configuration 2 Register */
217#define SPORT1_RCLKDIV 0xFFC00928 /* SPORT1 Receive Clock Divider */
218#define SPORT1_RFSDIV 0xFFC0092C /* SPORT1 Receive Frame Sync Divider */
219#define SPORT1_STAT 0xFFC00930 /* SPORT1 Status Register */
220#define SPORT1_CHNL 0xFFC00934 /* SPORT1 Current Channel Register */
221#define SPORT1_MCMC1 0xFFC00938 /* SPORT1 Multi-Channel Configuration Register 1 */
222#define SPORT1_MCMC2 0xFFC0093C /* SPORT1 Multi-Channel Configuration Register 2 */
223#define SPORT1_MTCS0 0xFFC00940 /* SPORT1 Multi-Channel Transmit Select Register 0 */
224#define SPORT1_MTCS1 0xFFC00944 /* SPORT1 Multi-Channel Transmit Select Register 1 */
225#define SPORT1_MTCS2 0xFFC00948 /* SPORT1 Multi-Channel Transmit Select Register 2 */
226#define SPORT1_MTCS3 0xFFC0094C /* SPORT1 Multi-Channel Transmit Select Register 3 */
227#define SPORT1_MRCS0 0xFFC00950 /* SPORT1 Multi-Channel Receive Select Register 0 */
228#define SPORT1_MRCS1 0xFFC00954 /* SPORT1 Multi-Channel Receive Select Register 1 */
229#define SPORT1_MRCS2 0xFFC00958 /* SPORT1 Multi-Channel Receive Select Register 2 */
230#define SPORT1_MRCS3 0xFFC0095C /* SPORT1 Multi-Channel Receive Select Register 3 */
231
232/* External Bus Interface Unit (0xFFC00A00 - 0xFFC00AFF) */
233#define EBIU_AMGCTL 0xFFC00A00 /* Asynchronous Memory Global Control Register */
234#define EBIU_AMBCTL0 0xFFC00A04 /* Asynchronous Memory Bank Control Register 0 */
235#define EBIU_AMBCTL1 0xFFC00A08 /* Asynchronous Memory Bank Control Register 1 */
236#define EBIU_SDGCTL 0xFFC00A10 /* SDRAM Global Control Register */
237#define EBIU_SDBCTL 0xFFC00A14 /* SDRAM Bank Control Register */
238#define EBIU_SDRRC 0xFFC00A18 /* SDRAM Refresh Rate Control Register */
239#define EBIU_SDSTAT 0xFFC00A1C /* SDRAM Status Register */
240
241/* DMA Traffic Control Registers */
242#define DMA_TC_PER 0xFFC00B0C /* Traffic Control Periods Register */
243#define DMA_TC_CNT 0xFFC00B10 /* Traffic Control Current Counts Register */
244
245/* Alternate deprecated register names (below) provided for backwards code compatibility */
246#define DMA_TCPER 0xFFC00B0C /* Traffic Control Periods Register */
247#define DMA_TCCNT 0xFFC00B10 /* Traffic Control Current Counts Register */
248
249/* DMA Controller (0xFFC00C00 - 0xFFC00FFF) */
250#define DMA0_NEXT_DESC_PTR 0xFFC00C00 /* DMA Channel 0 Next Descriptor Pointer Register */
251#define DMA0_START_ADDR 0xFFC00C04 /* DMA Channel 0 Start Address Register */
252#define DMA0_CONFIG 0xFFC00C08 /* DMA Channel 0 Configuration Register */
253#define DMA0_X_COUNT 0xFFC00C10 /* DMA Channel 0 X Count Register */
254#define DMA0_X_MODIFY 0xFFC00C14 /* DMA Channel 0 X Modify Register */
255#define DMA0_Y_COUNT 0xFFC00C18 /* DMA Channel 0 Y Count Register */
256#define DMA0_Y_MODIFY 0xFFC00C1C /* DMA Channel 0 Y Modify Register */
257#define DMA0_CURR_DESC_PTR 0xFFC00C20 /* DMA Channel 0 Current Descriptor Pointer Register */
258#define DMA0_CURR_ADDR 0xFFC00C24 /* DMA Channel 0 Current Address Register */
259#define DMA0_IRQ_STATUS 0xFFC00C28 /* DMA Channel 0 Interrupt/Status Register */
260#define DMA0_PERIPHERAL_MAP 0xFFC00C2C /* DMA Channel 0 Peripheral Map Register */
261#define DMA0_CURR_X_COUNT 0xFFC00C30 /* DMA Channel 0 Current X Count Register */
262#define DMA0_CURR_Y_COUNT 0xFFC00C38 /* DMA Channel 0 Current Y Count Register */
263
264#define DMA1_NEXT_DESC_PTR 0xFFC00C40 /* DMA Channel 1 Next Descriptor Pointer Register */
265#define DMA1_START_ADDR 0xFFC00C44 /* DMA Channel 1 Start Address Register */
266#define DMA1_CONFIG 0xFFC00C48 /* DMA Channel 1 Configuration Register */
267#define DMA1_X_COUNT 0xFFC00C50 /* DMA Channel 1 X Count Register */
268#define DMA1_X_MODIFY 0xFFC00C54 /* DMA Channel 1 X Modify Register */
269#define DMA1_Y_COUNT 0xFFC00C58 /* DMA Channel 1 Y Count Register */
270#define DMA1_Y_MODIFY 0xFFC00C5C /* DMA Channel 1 Y Modify Register */
271#define DMA1_CURR_DESC_PTR 0xFFC00C60 /* DMA Channel 1 Current Descriptor Pointer Register */
272#define DMA1_CURR_ADDR 0xFFC00C64 /* DMA Channel 1 Current Address Register */
273#define DMA1_IRQ_STATUS 0xFFC00C68 /* DMA Channel 1 Interrupt/Status Register */
274#define DMA1_PERIPHERAL_MAP 0xFFC00C6C /* DMA Channel 1 Peripheral Map Register */
275#define DMA1_CURR_X_COUNT 0xFFC00C70 /* DMA Channel 1 Current X Count Register */
276#define DMA1_CURR_Y_COUNT 0xFFC00C78 /* DMA Channel 1 Current Y Count Register */
277
278#define DMA2_NEXT_DESC_PTR 0xFFC00C80 /* DMA Channel 2 Next Descriptor Pointer Register */
279#define DMA2_START_ADDR 0xFFC00C84 /* DMA Channel 2 Start Address Register */
280#define DMA2_CONFIG 0xFFC00C88 /* DMA Channel 2 Configuration Register */
281#define DMA2_X_COUNT 0xFFC00C90 /* DMA Channel 2 X Count Register */
282#define DMA2_X_MODIFY 0xFFC00C94 /* DMA Channel 2 X Modify Register */
283#define DMA2_Y_COUNT 0xFFC00C98 /* DMA Channel 2 Y Count Register */
284#define DMA2_Y_MODIFY 0xFFC00C9C /* DMA Channel 2 Y Modify Register */
285#define DMA2_CURR_DESC_PTR 0xFFC00CA0 /* DMA Channel 2 Current Descriptor Pointer Register */
286#define DMA2_CURR_ADDR 0xFFC00CA4 /* DMA Channel 2 Current Address Register */
287#define DMA2_IRQ_STATUS 0xFFC00CA8 /* DMA Channel 2 Interrupt/Status Register */
288#define DMA2_PERIPHERAL_MAP 0xFFC00CAC /* DMA Channel 2 Peripheral Map Register */
289#define DMA2_CURR_X_COUNT 0xFFC00CB0 /* DMA Channel 2 Current X Count Register */
290#define DMA2_CURR_Y_COUNT 0xFFC00CB8 /* DMA Channel 2 Current Y Count Register */
291
292#define DMA3_NEXT_DESC_PTR 0xFFC00CC0 /* DMA Channel 3 Next Descriptor Pointer Register */
293#define DMA3_START_ADDR 0xFFC00CC4 /* DMA Channel 3 Start Address Register */
294#define DMA3_CONFIG 0xFFC00CC8 /* DMA Channel 3 Configuration Register */
295#define DMA3_X_COUNT 0xFFC00CD0 /* DMA Channel 3 X Count Register */
296#define DMA3_X_MODIFY 0xFFC00CD4 /* DMA Channel 3 X Modify Register */
297#define DMA3_Y_COUNT 0xFFC00CD8 /* DMA Channel 3 Y Count Register */
298#define DMA3_Y_MODIFY 0xFFC00CDC /* DMA Channel 3 Y Modify Register */
299#define DMA3_CURR_DESC_PTR 0xFFC00CE0 /* DMA Channel 3 Current Descriptor Pointer Register */
300#define DMA3_CURR_ADDR 0xFFC00CE4 /* DMA Channel 3 Current Address Register */
301#define DMA3_IRQ_STATUS 0xFFC00CE8 /* DMA Channel 3 Interrupt/Status Register */
302#define DMA3_PERIPHERAL_MAP 0xFFC00CEC /* DMA Channel 3 Peripheral Map Register */
303#define DMA3_CURR_X_COUNT 0xFFC00CF0 /* DMA Channel 3 Current X Count Register */
304#define DMA3_CURR_Y_COUNT 0xFFC00CF8 /* DMA Channel 3 Current Y Count Register */
305
306#define DMA4_NEXT_DESC_PTR 0xFFC00D00 /* DMA Channel 4 Next Descriptor Pointer Register */
307#define DMA4_START_ADDR 0xFFC00D04 /* DMA Channel 4 Start Address Register */
308#define DMA4_CONFIG 0xFFC00D08 /* DMA Channel 4 Configuration Register */
309#define DMA4_X_COUNT 0xFFC00D10 /* DMA Channel 4 X Count Register */
310#define DMA4_X_MODIFY 0xFFC00D14 /* DMA Channel 4 X Modify Register */
311#define DMA4_Y_COUNT 0xFFC00D18 /* DMA Channel 4 Y Count Register */
312#define DMA4_Y_MODIFY 0xFFC00D1C /* DMA Channel 4 Y Modify Register */
313#define DMA4_CURR_DESC_PTR 0xFFC00D20 /* DMA Channel 4 Current Descriptor Pointer Register */
314#define DMA4_CURR_ADDR 0xFFC00D24 /* DMA Channel 4 Current Address Register */
315#define DMA4_IRQ_STATUS 0xFFC00D28 /* DMA Channel 4 Interrupt/Status Register */
316#define DMA4_PERIPHERAL_MAP 0xFFC00D2C /* DMA Channel 4 Peripheral Map Register */
317#define DMA4_CURR_X_COUNT 0xFFC00D30 /* DMA Channel 4 Current X Count Register */
318#define DMA4_CURR_Y_COUNT 0xFFC00D38 /* DMA Channel 4 Current Y Count Register */
319
320#define DMA5_NEXT_DESC_PTR 0xFFC00D40 /* DMA Channel 5 Next Descriptor Pointer Register */
321#define DMA5_START_ADDR 0xFFC00D44 /* DMA Channel 5 Start Address Register */
322#define DMA5_CONFIG 0xFFC00D48 /* DMA Channel 5 Configuration Register */
323#define DMA5_X_COUNT 0xFFC00D50 /* DMA Channel 5 X Count Register */
324#define DMA5_X_MODIFY 0xFFC00D54 /* DMA Channel 5 X Modify Register */
325#define DMA5_Y_COUNT 0xFFC00D58 /* DMA Channel 5 Y Count Register */
326#define DMA5_Y_MODIFY 0xFFC00D5C /* DMA Channel 5 Y Modify Register */
327#define DMA5_CURR_DESC_PTR 0xFFC00D60 /* DMA Channel 5 Current Descriptor Pointer Register */
328#define DMA5_CURR_ADDR 0xFFC00D64 /* DMA Channel 5 Current Address Register */
329#define DMA5_IRQ_STATUS 0xFFC00D68 /* DMA Channel 5 Interrupt/Status Register */
330#define DMA5_PERIPHERAL_MAP 0xFFC00D6C /* DMA Channel 5 Peripheral Map Register */
331#define DMA5_CURR_X_COUNT 0xFFC00D70 /* DMA Channel 5 Current X Count Register */
332#define DMA5_CURR_Y_COUNT 0xFFC00D78 /* DMA Channel 5 Current Y Count Register */
333
334#define DMA6_NEXT_DESC_PTR 0xFFC00D80 /* DMA Channel 6 Next Descriptor Pointer Register */
335#define DMA6_START_ADDR 0xFFC00D84 /* DMA Channel 6 Start Address Register */
336#define DMA6_CONFIG 0xFFC00D88 /* DMA Channel 6 Configuration Register */
337#define DMA6_X_COUNT 0xFFC00D90 /* DMA Channel 6 X Count Register */
338#define DMA6_X_MODIFY 0xFFC00D94 /* DMA Channel 6 X Modify Register */
339#define DMA6_Y_COUNT 0xFFC00D98 /* DMA Channel 6 Y Count Register */
340#define DMA6_Y_MODIFY 0xFFC00D9C /* DMA Channel 6 Y Modify Register */
341#define DMA6_CURR_DESC_PTR 0xFFC00DA0 /* DMA Channel 6 Current Descriptor Pointer Register */
342#define DMA6_CURR_ADDR 0xFFC00DA4 /* DMA Channel 6 Current Address Register */
343#define DMA6_IRQ_STATUS 0xFFC00DA8 /* DMA Channel 6 Interrupt/Status Register */
344#define DMA6_PERIPHERAL_MAP 0xFFC00DAC /* DMA Channel 6 Peripheral Map Register */
345#define DMA6_CURR_X_COUNT 0xFFC00DB0 /* DMA Channel 6 Current X Count Register */
346#define DMA6_CURR_Y_COUNT 0xFFC00DB8 /* DMA Channel 6 Current Y Count Register */
347
348#define DMA7_NEXT_DESC_PTR 0xFFC00DC0 /* DMA Channel 7 Next Descriptor Pointer Register */
349#define DMA7_START_ADDR 0xFFC00DC4 /* DMA Channel 7 Start Address Register */
350#define DMA7_CONFIG 0xFFC00DC8 /* DMA Channel 7 Configuration Register */
351#define DMA7_X_COUNT 0xFFC00DD0 /* DMA Channel 7 X Count Register */
352#define DMA7_X_MODIFY 0xFFC00DD4 /* DMA Channel 7 X Modify Register */
353#define DMA7_Y_COUNT 0xFFC00DD8 /* DMA Channel 7 Y Count Register */
354#define DMA7_Y_MODIFY 0xFFC00DDC /* DMA Channel 7 Y Modify Register */
355#define DMA7_CURR_DESC_PTR 0xFFC00DE0 /* DMA Channel 7 Current Descriptor Pointer Register */
356#define DMA7_CURR_ADDR 0xFFC00DE4 /* DMA Channel 7 Current Address Register */
357#define DMA7_IRQ_STATUS 0xFFC00DE8 /* DMA Channel 7 Interrupt/Status Register */
358#define DMA7_PERIPHERAL_MAP 0xFFC00DEC /* DMA Channel 7 Peripheral Map Register */
359#define DMA7_CURR_X_COUNT 0xFFC00DF0 /* DMA Channel 7 Current X Count Register */
360#define DMA7_CURR_Y_COUNT 0xFFC00DF8 /* DMA Channel 7 Current Y Count Register */
361
362#define DMA8_NEXT_DESC_PTR 0xFFC00E00 /* DMA Channel 8 Next Descriptor Pointer Register */
363#define DMA8_START_ADDR 0xFFC00E04 /* DMA Channel 8 Start Address Register */
364#define DMA8_CONFIG 0xFFC00E08 /* DMA Channel 8 Configuration Register */
365#define DMA8_X_COUNT 0xFFC00E10 /* DMA Channel 8 X Count Register */
366#define DMA8_X_MODIFY 0xFFC00E14 /* DMA Channel 8 X Modify Register */
367#define DMA8_Y_COUNT 0xFFC00E18 /* DMA Channel 8 Y Count Register */
368#define DMA8_Y_MODIFY 0xFFC00E1C /* DMA Channel 8 Y Modify Register */
369#define DMA8_CURR_DESC_PTR 0xFFC00E20 /* DMA Channel 8 Current Descriptor Pointer Register */
370#define DMA8_CURR_ADDR 0xFFC00E24 /* DMA Channel 8 Current Address Register */
371#define DMA8_IRQ_STATUS 0xFFC00E28 /* DMA Channel 8 Interrupt/Status Register */
372#define DMA8_PERIPHERAL_MAP 0xFFC00E2C /* DMA Channel 8 Peripheral Map Register */
373#define DMA8_CURR_X_COUNT 0xFFC00E30 /* DMA Channel 8 Current X Count Register */
374#define DMA8_CURR_Y_COUNT 0xFFC00E38 /* DMA Channel 8 Current Y Count Register */
375
376#define DMA9_NEXT_DESC_PTR 0xFFC00E40 /* DMA Channel 9 Next Descriptor Pointer Register */
377#define DMA9_START_ADDR 0xFFC00E44 /* DMA Channel 9 Start Address Register */
378#define DMA9_CONFIG 0xFFC00E48 /* DMA Channel 9 Configuration Register */
379#define DMA9_X_COUNT 0xFFC00E50 /* DMA Channel 9 X Count Register */
380#define DMA9_X_MODIFY 0xFFC00E54 /* DMA Channel 9 X Modify Register */
381#define DMA9_Y_COUNT 0xFFC00E58 /* DMA Channel 9 Y Count Register */
382#define DMA9_Y_MODIFY 0xFFC00E5C /* DMA Channel 9 Y Modify Register */
383#define DMA9_CURR_DESC_PTR 0xFFC00E60 /* DMA Channel 9 Current Descriptor Pointer Register */
384#define DMA9_CURR_ADDR 0xFFC00E64 /* DMA Channel 9 Current Address Register */
385#define DMA9_IRQ_STATUS 0xFFC00E68 /* DMA Channel 9 Interrupt/Status Register */
386#define DMA9_PERIPHERAL_MAP 0xFFC00E6C /* DMA Channel 9 Peripheral Map Register */
387#define DMA9_CURR_X_COUNT 0xFFC00E70 /* DMA Channel 9 Current X Count Register */
388#define DMA9_CURR_Y_COUNT 0xFFC00E78 /* DMA Channel 9 Current Y Count Register */
389
390#define DMA10_NEXT_DESC_PTR 0xFFC00E80 /* DMA Channel 10 Next Descriptor Pointer Register */
391#define DMA10_START_ADDR 0xFFC00E84 /* DMA Channel 10 Start Address Register */
392#define DMA10_CONFIG 0xFFC00E88 /* DMA Channel 10 Configuration Register */
393#define DMA10_X_COUNT 0xFFC00E90 /* DMA Channel 10 X Count Register */
394#define DMA10_X_MODIFY 0xFFC00E94 /* DMA Channel 10 X Modify Register */
395#define DMA10_Y_COUNT 0xFFC00E98 /* DMA Channel 10 Y Count Register */
396#define DMA10_Y_MODIFY 0xFFC00E9C /* DMA Channel 10 Y Modify Register */
397#define DMA10_CURR_DESC_PTR 0xFFC00EA0 /* DMA Channel 10 Current Descriptor Pointer Register */
398#define DMA10_CURR_ADDR 0xFFC00EA4 /* DMA Channel 10 Current Address Register */
399#define DMA10_IRQ_STATUS 0xFFC00EA8 /* DMA Channel 10 Interrupt/Status Register */
400#define DMA10_PERIPHERAL_MAP 0xFFC00EAC /* DMA Channel 10 Peripheral Map Register */
401#define DMA10_CURR_X_COUNT 0xFFC00EB0 /* DMA Channel 10 Current X Count Register */
402#define DMA10_CURR_Y_COUNT 0xFFC00EB8 /* DMA Channel 10 Current Y Count Register */
403
404#define DMA11_NEXT_DESC_PTR 0xFFC00EC0 /* DMA Channel 11 Next Descriptor Pointer Register */
405#define DMA11_START_ADDR 0xFFC00EC4 /* DMA Channel 11 Start Address Register */
406#define DMA11_CONFIG 0xFFC00EC8 /* DMA Channel 11 Configuration Register */
407#define DMA11_X_COUNT 0xFFC00ED0 /* DMA Channel 11 X Count Register */
408#define DMA11_X_MODIFY 0xFFC00ED4 /* DMA Channel 11 X Modify Register */
409#define DMA11_Y_COUNT 0xFFC00ED8 /* DMA Channel 11 Y Count Register */
410#define DMA11_Y_MODIFY 0xFFC00EDC /* DMA Channel 11 Y Modify Register */
411#define DMA11_CURR_DESC_PTR 0xFFC00EE0 /* DMA Channel 11 Current Descriptor Pointer Register */
412#define DMA11_CURR_ADDR 0xFFC00EE4 /* DMA Channel 11 Current Address Register */
413#define DMA11_IRQ_STATUS 0xFFC00EE8 /* DMA Channel 11 Interrupt/Status Register */
414#define DMA11_PERIPHERAL_MAP 0xFFC00EEC /* DMA Channel 11 Peripheral Map Register */
415#define DMA11_CURR_X_COUNT 0xFFC00EF0 /* DMA Channel 11 Current X Count Register */
416#define DMA11_CURR_Y_COUNT 0xFFC00EF8 /* DMA Channel 11 Current Y Count Register */
417
418#define MDMA_D0_NEXT_DESC_PTR 0xFFC00F00 /* MemDMA Stream 0 Destination Next Descriptor Pointer Register */
419#define MDMA_D0_START_ADDR 0xFFC00F04 /* MemDMA Stream 0 Destination Start Address Register */
420#define MDMA_D0_CONFIG 0xFFC00F08 /* MemDMA Stream 0 Destination Configuration Register */
421#define MDMA_D0_X_COUNT 0xFFC00F10 /* MemDMA Stream 0 Destination X Count Register */
422#define MDMA_D0_X_MODIFY 0xFFC00F14 /* MemDMA Stream 0 Destination X Modify Register */
423#define MDMA_D0_Y_COUNT 0xFFC00F18 /* MemDMA Stream 0 Destination Y Count Register */
424#define MDMA_D0_Y_MODIFY 0xFFC00F1C /* MemDMA Stream 0 Destination Y Modify Register */
425#define MDMA_D0_CURR_DESC_PTR 0xFFC00F20 /* MemDMA Stream 0 Destination Current Descriptor Pointer Register */
426#define MDMA_D0_CURR_ADDR 0xFFC00F24 /* MemDMA Stream 0 Destination Current Address Register */
427#define MDMA_D0_IRQ_STATUS 0xFFC00F28 /* MemDMA Stream 0 Destination Interrupt/Status Register */
428#define MDMA_D0_PERIPHERAL_MAP 0xFFC00F2C /* MemDMA Stream 0 Destination Peripheral Map Register */
429#define MDMA_D0_CURR_X_COUNT 0xFFC00F30 /* MemDMA Stream 0 Destination Current X Count Register */
430#define MDMA_D0_CURR_Y_COUNT 0xFFC00F38 /* MemDMA Stream 0 Destination Current Y Count Register */
431
432#define MDMA_S0_NEXT_DESC_PTR 0xFFC00F40 /* MemDMA Stream 0 Source Next Descriptor Pointer Register */
433#define MDMA_S0_START_ADDR 0xFFC00F44 /* MemDMA Stream 0 Source Start Address Register */
434#define MDMA_S0_CONFIG 0xFFC00F48 /* MemDMA Stream 0 Source Configuration Register */
435#define MDMA_S0_X_COUNT 0xFFC00F50 /* MemDMA Stream 0 Source X Count Register */
436#define MDMA_S0_X_MODIFY 0xFFC00F54 /* MemDMA Stream 0 Source X Modify Register */
437#define MDMA_S0_Y_COUNT 0xFFC00F58 /* MemDMA Stream 0 Source Y Count Register */
438#define MDMA_S0_Y_MODIFY 0xFFC00F5C /* MemDMA Stream 0 Source Y Modify Register */
439#define MDMA_S0_CURR_DESC_PTR 0xFFC00F60 /* MemDMA Stream 0 Source Current Descriptor Pointer Register */
440#define MDMA_S0_CURR_ADDR 0xFFC00F64 /* MemDMA Stream 0 Source Current Address Register */
441#define MDMA_S0_IRQ_STATUS 0xFFC00F68 /* MemDMA Stream 0 Source Interrupt/Status Register */
442#define MDMA_S0_PERIPHERAL_MAP 0xFFC00F6C /* MemDMA Stream 0 Source Peripheral Map Register */
443#define MDMA_S0_CURR_X_COUNT 0xFFC00F70 /* MemDMA Stream 0 Source Current X Count Register */
444#define MDMA_S0_CURR_Y_COUNT 0xFFC00F78 /* MemDMA Stream 0 Source Current Y Count Register */
445
446#define MDMA_D1_NEXT_DESC_PTR 0xFFC00F80 /* MemDMA Stream 1 Destination Next Descriptor Pointer Register */
447#define MDMA_D1_START_ADDR 0xFFC00F84 /* MemDMA Stream 1 Destination Start Address Register */
448#define MDMA_D1_CONFIG 0xFFC00F88 /* MemDMA Stream 1 Destination Configuration Register */
449#define MDMA_D1_X_COUNT 0xFFC00F90 /* MemDMA Stream 1 Destination X Count Register */
450#define MDMA_D1_X_MODIFY 0xFFC00F94 /* MemDMA Stream 1 Destination X Modify Register */
451#define MDMA_D1_Y_COUNT 0xFFC00F98 /* MemDMA Stream 1 Destination Y Count Register */
452#define MDMA_D1_Y_MODIFY 0xFFC00F9C /* MemDMA Stream 1 Destination Y Modify Register */
453#define MDMA_D1_CURR_DESC_PTR 0xFFC00FA0 /* MemDMA Stream 1 Destination Current Descriptor Pointer Register */
454#define MDMA_D1_CURR_ADDR 0xFFC00FA4 /* MemDMA Stream 1 Destination Current Address Register */
455#define MDMA_D1_IRQ_STATUS 0xFFC00FA8 /* MemDMA Stream 1 Destination Interrupt/Status Register */
456#define MDMA_D1_PERIPHERAL_MAP 0xFFC00FAC /* MemDMA Stream 1 Destination Peripheral Map Register */
457#define MDMA_D1_CURR_X_COUNT 0xFFC00FB0 /* MemDMA Stream 1 Destination Current X Count Register */
458#define MDMA_D1_CURR_Y_COUNT 0xFFC00FB8 /* MemDMA Stream 1 Destination Current Y Count Register */
459
460#define MDMA_S1_NEXT_DESC_PTR 0xFFC00FC0 /* MemDMA Stream 1 Source Next Descriptor Pointer Register */
461#define MDMA_S1_START_ADDR 0xFFC00FC4 /* MemDMA Stream 1 Source Start Address Register */
462#define MDMA_S1_CONFIG 0xFFC00FC8 /* MemDMA Stream 1 Source Configuration Register */
463#define MDMA_S1_X_COUNT 0xFFC00FD0 /* MemDMA Stream 1 Source X Count Register */
464#define MDMA_S1_X_MODIFY 0xFFC00FD4 /* MemDMA Stream 1 Source X Modify Register */
465#define MDMA_S1_Y_COUNT 0xFFC00FD8 /* MemDMA Stream 1 Source Y Count Register */
466#define MDMA_S1_Y_MODIFY 0xFFC00FDC /* MemDMA Stream 1 Source Y Modify Register */
467#define MDMA_S1_CURR_DESC_PTR 0xFFC00FE0 /* MemDMA Stream 1 Source Current Descriptor Pointer Register */
468#define MDMA_S1_CURR_ADDR 0xFFC00FE4 /* MemDMA Stream 1 Source Current Address Register */
469#define MDMA_S1_IRQ_STATUS 0xFFC00FE8 /* MemDMA Stream 1 Source Interrupt/Status Register */
470#define MDMA_S1_PERIPHERAL_MAP 0xFFC00FEC /* MemDMA Stream 1 Source Peripheral Map Register */
471#define MDMA_S1_CURR_X_COUNT 0xFFC00FF0 /* MemDMA Stream 1 Source Current X Count Register */
472#define MDMA_S1_CURR_Y_COUNT 0xFFC00FF8 /* MemDMA Stream 1 Source Current Y Count Register */
473
474
475/* Parallel Peripheral Interface (0xFFC01000 - 0xFFC010FF) */
476#define PPI_CONTROL 0xFFC01000 /* PPI Control Register */
477#define PPI_STATUS 0xFFC01004 /* PPI Status Register */
478#define PPI_COUNT 0xFFC01008 /* PPI Transfer Count Register */
479#define PPI_DELAY 0xFFC0100C /* PPI Delay Count Register */
480#define PPI_FRAME 0xFFC01010 /* PPI Frame Length Register */
481
482
483/* Two-Wire Interface (0xFFC01400 - 0xFFC014FF) */
484#define TWI0_REGBASE 0xFFC01400
485#define TWI_CLKDIV 0xFFC01400 /* Serial Clock Divider Register */
486#define TWI_CONTROL 0xFFC01404 /* TWI Control Register */
487#define TWI_SLAVE_CTL 0xFFC01408 /* Slave Mode Control Register */
488#define TWI_SLAVE_STAT 0xFFC0140C /* Slave Mode Status Register */
489#define TWI_SLAVE_ADDR 0xFFC01410 /* Slave Mode Address Register */
490#define TWI_MASTER_CTL 0xFFC01414 /* Master Mode Control Register */
491#define TWI_MASTER_STAT 0xFFC01418 /* Master Mode Status Register */
492#define TWI_MASTER_ADDR 0xFFC0141C /* Master Mode Address Register */
493#define TWI_INT_STAT 0xFFC01420 /* TWI Interrupt Status Register */
494#define TWI_INT_MASK 0xFFC01424 /* TWI Master Interrupt Mask Register */
495#define TWI_FIFO_CTL 0xFFC01428 /* FIFO Control Register */
496#define TWI_FIFO_STAT 0xFFC0142C /* FIFO Status Register */
497#define TWI_XMT_DATA8 0xFFC01480 /* FIFO Transmit Data Single Byte Register */
498#define TWI_XMT_DATA16 0xFFC01484 /* FIFO Transmit Data Double Byte Register */
499#define TWI_RCV_DATA8 0xFFC01488 /* FIFO Receive Data Single Byte Register */
500#define TWI_RCV_DATA16 0xFFC0148C /* FIFO Receive Data Double Byte Register */
501
502
503/* General Purpose I/O Port G (0xFFC01500 - 0xFFC015FF) */
504#define PORTGIO 0xFFC01500 /* Port G I/O Pin State Specify Register */
505#define PORTGIO_CLEAR 0xFFC01504 /* Port G I/O Peripheral Interrupt Clear Register */
506#define PORTGIO_SET 0xFFC01508 /* Port G I/O Peripheral Interrupt Set Register */
507#define PORTGIO_TOGGLE 0xFFC0150C /* Port G I/O Pin State Toggle Register */
508#define PORTGIO_MASKA 0xFFC01510 /* Port G I/O Mask State Specify Interrupt A Register */
509#define PORTGIO_MASKA_CLEAR 0xFFC01514 /* Port G I/O Mask Disable Interrupt A Register */
510#define PORTGIO_MASKA_SET 0xFFC01518 /* Port G I/O Mask Enable Interrupt A Register */
511#define PORTGIO_MASKA_TOGGLE 0xFFC0151C /* Port G I/O Mask Toggle Enable Interrupt A Register */
512#define PORTGIO_MASKB 0xFFC01520 /* Port G I/O Mask State Specify Interrupt B Register */
513#define PORTGIO_MASKB_CLEAR 0xFFC01524 /* Port G I/O Mask Disable Interrupt B Register */
514#define PORTGIO_MASKB_SET 0xFFC01528 /* Port G I/O Mask Enable Interrupt B Register */
515#define PORTGIO_MASKB_TOGGLE 0xFFC0152C /* Port G I/O Mask Toggle Enable Interrupt B Register */
516#define PORTGIO_DIR 0xFFC01530 /* Port G I/O Direction Register */
517#define PORTGIO_POLAR 0xFFC01534 /* Port G I/O Source Polarity Register */
518#define PORTGIO_EDGE 0xFFC01538 /* Port G I/O Source Sensitivity Register */
519#define PORTGIO_BOTH 0xFFC0153C /* Port G I/O Set on BOTH Edges Register */
520#define PORTGIO_INEN 0xFFC01540 /* Port G I/O Input Enable Register */
521
522
523/* General Purpose I/O Port H (0xFFC01700 - 0xFFC017FF) */
524#define PORTHIO 0xFFC01700 /* Port H I/O Pin State Specify Register */
525#define PORTHIO_CLEAR 0xFFC01704 /* Port H I/O Peripheral Interrupt Clear Register */
526#define PORTHIO_SET 0xFFC01708 /* Port H I/O Peripheral Interrupt Set Register */
527#define PORTHIO_TOGGLE 0xFFC0170C /* Port H I/O Pin State Toggle Register */
528#define PORTHIO_MASKA 0xFFC01710 /* Port H I/O Mask State Specify Interrupt A Register */
529#define PORTHIO_MASKA_CLEAR 0xFFC01714 /* Port H I/O Mask Disable Interrupt A Register */
530#define PORTHIO_MASKA_SET 0xFFC01718 /* Port H I/O Mask Enable Interrupt A Register */
531#define PORTHIO_MASKA_TOGGLE 0xFFC0171C /* Port H I/O Mask Toggle Enable Interrupt A Register */
532#define PORTHIO_MASKB 0xFFC01720 /* Port H I/O Mask State Specify Interrupt B Register */
533#define PORTHIO_MASKB_CLEAR 0xFFC01724 /* Port H I/O Mask Disable Interrupt B Register */
534#define PORTHIO_MASKB_SET 0xFFC01728 /* Port H I/O Mask Enable Interrupt B Register */
535#define PORTHIO_MASKB_TOGGLE 0xFFC0172C /* Port H I/O Mask Toggle Enable Interrupt B Register */
536#define PORTHIO_DIR 0xFFC01730 /* Port H I/O Direction Register */
537#define PORTHIO_POLAR 0xFFC01734 /* Port H I/O Source Polarity Register */
538#define PORTHIO_EDGE 0xFFC01738 /* Port H I/O Source Sensitivity Register */
539#define PORTHIO_BOTH 0xFFC0173C /* Port H I/O Set on BOTH Edges Register */
540#define PORTHIO_INEN 0xFFC01740 /* Port H I/O Input Enable Register */
541
542
543/* UART1 Controller (0xFFC02000 - 0xFFC020FF) */
544#define UART1_THR 0xFFC02000 /* Transmit Holding register */
545#define UART1_RBR 0xFFC02000 /* Receive Buffer register */
546#define UART1_DLL 0xFFC02000 /* Divisor Latch (Low-Byte) */
547#define UART1_IER 0xFFC02004 /* Interrupt Enable Register */
548#define UART1_DLH 0xFFC02004 /* Divisor Latch (High-Byte) */
549#define UART1_IIR 0xFFC02008 /* Interrupt Identification Register */
550#define UART1_LCR 0xFFC0200C /* Line Control Register */
551#define UART1_MCR 0xFFC02010 /* Modem Control Register */
552#define UART1_LSR 0xFFC02014 /* Line Status Register */
553#define UART1_MSR 0xFFC02018 /* Modem Status Register */
554#define UART1_SCR 0xFFC0201C /* SCR Scratch Register */
555#define UART1_GCTL 0xFFC02024 /* Global Control Register */
556
557
558/* Pin Control Registers (0xFFC03200 - 0xFFC032FF) */
559#define PORTF_FER 0xFFC03200 /* Port F Function Enable Register (Alternate/Flag*) */
560#define PORTG_FER 0xFFC03204 /* Port G Function Enable Register (Alternate/Flag*) */
561#define PORTH_FER 0xFFC03208 /* Port H Function Enable Register (Alternate/Flag*) */
562#define BFIN_PORT_MUX 0xFFC0320C /* Port Multiplexer Control Register */
563
564
565/* Handshake MDMA Registers (0xFFC03300 - 0xFFC033FF) */
566#define HMDMA0_CONTROL 0xFFC03300 /* Handshake MDMA0 Control Register */
567#define HMDMA0_ECINIT 0xFFC03304 /* HMDMA0 Initial Edge Count Register */
568#define HMDMA0_BCINIT 0xFFC03308 /* HMDMA0 Initial Block Count Register */
569#define HMDMA0_ECURGENT 0xFFC0330C /* HMDMA0 Urgent Edge Count Threshhold Register */
570#define HMDMA0_ECOVERFLOW 0xFFC03310 /* HMDMA0 Edge Count Overflow Interrupt Register */
571#define HMDMA0_ECOUNT 0xFFC03314 /* HMDMA0 Current Edge Count Register */
572#define HMDMA0_BCOUNT 0xFFC03318 /* HMDMA0 Current Block Count Register */
573
574#define HMDMA1_CONTROL 0xFFC03340 /* Handshake MDMA1 Control Register */
575#define HMDMA1_ECINIT 0xFFC03344 /* HMDMA1 Initial Edge Count Register */
576#define HMDMA1_BCINIT 0xFFC03348 /* HMDMA1 Initial Block Count Register */
577#define HMDMA1_ECURGENT 0xFFC0334C /* HMDMA1 Urgent Edge Count Threshhold Register */
578#define HMDMA1_ECOVERFLOW 0xFFC03350 /* HMDMA1 Edge Count Overflow Interrupt Register */
579#define HMDMA1_ECOUNT 0xFFC03354 /* HMDMA1 Current Edge Count Register */
580#define HMDMA1_BCOUNT 0xFFC03358 /* HMDMA1 Current Block Count Register */
581
582
583/* GPIO PIN mux (0xFFC03210 - OxFFC03288) */
584#define PORTF_MUX 0xFFC03210 /* Port F mux control */
585#define PORTG_MUX 0xFFC03214 /* Port G mux control */
586#define PORTH_MUX 0xFFC03218 /* Port H mux control */
587#define PORTF_DRIVE 0xFFC03220 /* Port F drive strength control */
588#define PORTG_DRIVE 0xFFC03224 /* Port G drive strength control */
589#define PORTH_DRIVE 0xFFC03228 /* Port H drive strength control */
590#define PORTF_SLEW 0xFFC03230 /* Port F slew control */
591#define PORTG_SLEW 0xFFC03234 /* Port G slew control */
592#define PORTH_SLEW 0xFFC03238 /* Port H slew control */
593#define PORTF_HYSTERISIS 0xFFC03240 /* Port F Schmitt trigger control */
594#define PORTG_HYSTERISIS 0xFFC03244 /* Port G Schmitt trigger control */
595#define PORTH_HYSTERISIS 0xFFC03248 /* Port H Schmitt trigger control */
596#define MISCPORT_DRIVE 0xFFC03280 /* Misc Port drive strength control */
597#define MISCPORT_SLEW 0xFFC03284 /* Misc Port slew control */
598#define MISCPORT_HYSTERISIS 0xFFC03288 /* Misc Port Schmitt trigger control */
599
600
601/***********************************************************************************
602** System MMR Register Bits And Macros
603**
604** Disclaimer: All macros are intended to make C and Assembly code more readable.
605** Use these macros carefully, as any that do left shifts for field
606** depositing will result in the lower order bits being destroyed. Any
607** macro that shifts left to properly position the bit-field should be
608** used as part of an OR to initialize a register and NOT as a dynamic
609** modifier UNLESS the lower order bits are saved and ORed back in when
610** the macro is used.
611*************************************************************************************/
612/*
613** ********************* PLL AND RESET MASKS ****************************************/
614/* PLL_CTL Masks */
615#define DF 0x0001 /* 0: PLL = CLKIN, 1: PLL = CLKIN/2 */
616#define PLL_OFF 0x0002 /* PLL Not Powered */
617#define STOPCK 0x0008 /* Core Clock Off */
618#define PDWN 0x0020 /* Enter Deep Sleep Mode */
619#define IN_DELAY 0x0040 /* Add 200ps Delay To EBIU Input Latches */
620#define OUT_DELAY 0x0080 /* Add 200ps Delay To EBIU Output Signals */
621#define BYPASS 0x0100 /* Bypass the PLL */
622#define MSEL 0x7E00 /* Multiplier Select For CCLK/VCO Factors */
623/* PLL_CTL Macros (Only Use With Logic OR While Setting Lower Order Bits) */
624#define SET_MSEL(x) (((x)&0x3F) << 0x9) /* Set MSEL = 0-63 --> VCO = CLKIN*MSEL */
625
626/* PLL_DIV Masks */
627#define SSEL 0x000F /* System Select */
628#define CSEL 0x0030 /* Core Select */
629#define CSEL_DIV1 0x0000 /* CCLK = VCO / 1 */
630#define CSEL_DIV2 0x0010 /* CCLK = VCO / 2 */
631#define CSEL_DIV4 0x0020 /* CCLK = VCO / 4 */
632#define CSEL_DIV8 0x0030 /* CCLK = VCO / 8 */
633/* PLL_DIV Macros */
634#define SET_SSEL(x) ((x)&0xF) /* Set SSEL = 0-15 --> SCLK = VCO/SSEL */
635
636/* VR_CTL Masks */
637#define FREQ 0x3000 /* Switching Oscillator Frequency For Regulator */
638#define HIBERNATE 0x0000 /* Powerdown/Bypass On-Board Regulation */
639
640#define VLEV 0x00F0 /* Internal Voltage Level */
641#define VLEV_085 0x0060 /* VLEV = 0.85 V (-5% - +10% Accuracy) */
642#define VLEV_090 0x0070 /* VLEV = 0.90 V (-5% - +10% Accuracy) */
643#define VLEV_095 0x0080 /* VLEV = 0.95 V (-5% - +10% Accuracy) */
644#define VLEV_100 0x0090 /* VLEV = 1.00 V (-5% - +10% Accuracy) */
645#define VLEV_105 0x00A0 /* VLEV = 1.05 V (-5% - +10% Accuracy) */
646#define VLEV_110 0x00B0 /* VLEV = 1.10 V (-5% - +10% Accuracy) */
647#define VLEV_115 0x00C0 /* VLEV = 1.15 V (-5% - +10% Accuracy) */
648#define VLEV_120 0x00D0 /* VLEV = 1.20 V (-5% - +10% Accuracy) */
649#define VLEV_125 0x00E0 /* VLEV = 1.25 V (-5% - +10% Accuracy) */
650#define VLEV_130 0x00F0 /* VLEV = 1.30 V (-5% - +10% Accuracy) */
651
652#define WAKE 0x0100 /* Enable RTC/Reset Wakeup From Hibernate */
653#define USBWE 0x0200 /* Enable USB Wakeup From Hibernate */
654#define PHYWE 0x0400 /* Enable PHY Wakeup From Hibernate */
655#define CLKBUFOE 0x4000 /* CLKIN Buffer Output Enable */
656#define PHYCLKOE CLKBUFOE /* Alternative legacy name for the above */
657#define SCKELOW 0x8000 /* Enable Drive CKE Low During Reset */
658
659/* PLL_STAT Masks */
660#define ACTIVE_PLLENABLED 0x0001 /* Processor In Active Mode With PLL Enabled */
661#define FULL_ON 0x0002 /* Processor In Full On Mode */
662#define ACTIVE_PLLDISABLED 0x0004 /* Processor In Active Mode With PLL Disabled */
663#define PLL_LOCKED 0x0020 /* PLL_LOCKCNT Has Been Reached */
664
665/* CHIPID Masks */
666#define CHIPID_VERSION 0xF0000000
667#define CHIPID_FAMILY 0x0FFFF000
668#define CHIPID_MANUFACTURE 0x00000FFE
669
670/* SWRST Masks */
671#define SYSTEM_RESET 0x0007 /* Initiates A System Software Reset */
672#define DOUBLE_FAULT 0x0008 /* Core Double Fault Causes Reset */
673#define RESET_DOUBLE 0x2000 /* SW Reset Generated By Core Double-Fault */
674#define RESET_WDOG 0x4000 /* SW Reset Generated By Watchdog Timer */
675#define RESET_SOFTWARE 0x8000 /* SW Reset Occurred Since Last Read Of SWRST */
676
677/* SYSCR Masks */
678#define BMODE 0x0007 /* Boot Mode - Latched During HW Reset From Mode Pins */
679#define NOBOOT 0x0010 /* Execute From L1 or ASYNC Bank 0 When BMODE = 0 */
680
681
682/* ************* SYSTEM INTERRUPT CONTROLLER MASKS *************************************/
683/* Peripheral Masks For SIC_ISR, SIC_IWR, SIC_IMASK */
684
685#if 0
686#define IRQ_PLL_WAKEUP 0x00000001 /* PLL Wakeup Interrupt */
687
688#define IRQ_ERROR1 0x00000002 /* Error Interrupt (DMA, DMARx Block, DMARx Overflow) */
689#define IRQ_ERROR2 0x00000004 /* Error Interrupt (CAN, Ethernet, SPORTx, PPI, SPI, UARTx) */
690#define IRQ_RTC 0x00000008 /* Real Time Clock Interrupt */
691#define IRQ_DMA0 0x00000010 /* DMA Channel 0 (PPI) Interrupt */
692#define IRQ_DMA3 0x00000020 /* DMA Channel 3 (SPORT0 RX) Interrupt */
693#define IRQ_DMA4 0x00000040 /* DMA Channel 4 (SPORT0 TX) Interrupt */
694#define IRQ_DMA5 0x00000080 /* DMA Channel 5 (SPORT1 RX) Interrupt */
695
696#define IRQ_DMA6 0x00000100 /* DMA Channel 6 (SPORT1 TX) Interrupt */
697#define IRQ_TWI 0x00000200 /* TWI Interrupt */
698#define IRQ_DMA7 0x00000400 /* DMA Channel 7 (SPI) Interrupt */
699#define IRQ_DMA8 0x00000800 /* DMA Channel 8 (UART0 RX) Interrupt */
700#define IRQ_DMA9 0x00001000 /* DMA Channel 9 (UART0 TX) Interrupt */
701#define IRQ_DMA10 0x00002000 /* DMA Channel 10 (UART1 RX) Interrupt */
702#define IRQ_DMA11 0x00004000 /* DMA Channel 11 (UART1 TX) Interrupt */
703#define IRQ_CAN_RX 0x00008000 /* CAN Receive Interrupt */
704
705#define IRQ_CAN_TX 0x00010000 /* CAN Transmit Interrupt */
706#define IRQ_DMA1 0x00020000 /* DMA Channel 1 (Ethernet RX) Interrupt */
707#define IRQ_PFA_PORTH 0x00020000 /* PF Port H (PF47:32) Interrupt A */
708#define IRQ_DMA2 0x00040000 /* DMA Channel 2 (Ethernet TX) Interrupt */
709#define IRQ_PFB_PORTH 0x00040000 /* PF Port H (PF47:32) Interrupt B */
710#define IRQ_TIMER0 0x00080000 /* Timer 0 Interrupt */
711#define IRQ_TIMER1 0x00100000 /* Timer 1 Interrupt */
712#define IRQ_TIMER2 0x00200000 /* Timer 2 Interrupt */
713#define IRQ_TIMER3 0x00400000 /* Timer 3 Interrupt */
714#define IRQ_TIMER4 0x00800000 /* Timer 4 Interrupt */
715
716#define IRQ_TIMER5 0x01000000 /* Timer 5 Interrupt */
717#define IRQ_TIMER6 0x02000000 /* Timer 6 Interrupt */
718#define IRQ_TIMER7 0x04000000 /* Timer 7 Interrupt */
719#define IRQ_PFA_PORTFG 0x08000000 /* PF Ports F&G (PF31:0) Interrupt A */
720#define IRQ_PFB_PORTF 0x80000000 /* PF Port F (PF15:0) Interrupt B */
721#define IRQ_DMA12 0x20000000 /* DMA Channels 12 (MDMA1 Source) RX Interrupt */
722#define IRQ_DMA13 0x20000000 /* DMA Channels 13 (MDMA1 Destination) TX Interrupt */
723#define IRQ_DMA14 0x40000000 /* DMA Channels 14 (MDMA0 Source) RX Interrupt */
724#define IRQ_DMA15 0x40000000 /* DMA Channels 15 (MDMA0 Destination) TX Interrupt */
725#define IRQ_WDOG 0x80000000 /* Software Watchdog Timer Interrupt */
726#define IRQ_PFB_PORTG 0x10000000 /* PF Port G (PF31:16) Interrupt B */
727#endif
728
729/* SIC_IAR0 Macros */
730#define P0_IVG(x) (((x)&0xF)-7) /* Peripheral #0 assigned IVG #x */
731#define P1_IVG(x) (((x)&0xF)-7) << 0x4 /* Peripheral #1 assigned IVG #x */
732#define P2_IVG(x) (((x)&0xF)-7) << 0x8 /* Peripheral #2 assigned IVG #x */
733#define P3_IVG(x) (((x)&0xF)-7) << 0xC /* Peripheral #3 assigned IVG #x */
734#define P4_IVG(x) (((x)&0xF)-7) << 0x10 /* Peripheral #4 assigned IVG #x */
735#define P5_IVG(x) (((x)&0xF)-7) << 0x14 /* Peripheral #5 assigned IVG #x */
736#define P6_IVG(x) (((x)&0xF)-7) << 0x18 /* Peripheral #6 assigned IVG #x */
737#define P7_IVG(x) (((x)&0xF)-7) << 0x1C /* Peripheral #7 assigned IVG #x */
738
739/* SIC_IAR1 Macros */
740#define P8_IVG(x) (((x)&0xF)-7) /* Peripheral #8 assigned IVG #x */
741#define P9_IVG(x) (((x)&0xF)-7) << 0x4 /* Peripheral #9 assigned IVG #x */
742#define P10_IVG(x) (((x)&0xF)-7) << 0x8 /* Peripheral #10 assigned IVG #x */
743#define P11_IVG(x) (((x)&0xF)-7) << 0xC /* Peripheral #11 assigned IVG #x */
744#define P12_IVG(x) (((x)&0xF)-7) << 0x10 /* Peripheral #12 assigned IVG #x */
745#define P13_IVG(x) (((x)&0xF)-7) << 0x14 /* Peripheral #13 assigned IVG #x */
746#define P14_IVG(x) (((x)&0xF)-7) << 0x18 /* Peripheral #14 assigned IVG #x */
747#define P15_IVG(x) (((x)&0xF)-7) << 0x1C /* Peripheral #15 assigned IVG #x */
748
749/* SIC_IAR2 Macros */
750#define P16_IVG(x) (((x)&0xF)-7) /* Peripheral #16 assigned IVG #x */
751#define P17_IVG(x) (((x)&0xF)-7) << 0x4 /* Peripheral #17 assigned IVG #x */
752#define P18_IVG(x) (((x)&0xF)-7) << 0x8 /* Peripheral #18 assigned IVG #x */
753#define P19_IVG(x) (((x)&0xF)-7) << 0xC /* Peripheral #19 assigned IVG #x */
754#define P20_IVG(x) (((x)&0xF)-7) << 0x10 /* Peripheral #20 assigned IVG #x */
755#define P21_IVG(x) (((x)&0xF)-7) << 0x14 /* Peripheral #21 assigned IVG #x */
756#define P22_IVG(x) (((x)&0xF)-7) << 0x18 /* Peripheral #22 assigned IVG #x */
757#define P23_IVG(x) (((x)&0xF)-7) << 0x1C /* Peripheral #23 assigned IVG #x */
758
759/* SIC_IAR3 Macros */
760#define P24_IVG(x) (((x)&0xF)-7) /* Peripheral #24 assigned IVG #x */
761#define P25_IVG(x) (((x)&0xF)-7) << 0x4 /* Peripheral #25 assigned IVG #x */
762#define P26_IVG(x) (((x)&0xF)-7) << 0x8 /* Peripheral #26 assigned IVG #x */
763#define P27_IVG(x) (((x)&0xF)-7) << 0xC /* Peripheral #27 assigned IVG #x */
764#define P28_IVG(x) (((x)&0xF)-7) << 0x10 /* Peripheral #28 assigned IVG #x */
765#define P29_IVG(x) (((x)&0xF)-7) << 0x14 /* Peripheral #29 assigned IVG #x */
766#define P30_IVG(x) (((x)&0xF)-7) << 0x18 /* Peripheral #30 assigned IVG #x */
767#define P31_IVG(x) (((x)&0xF)-7) << 0x1C /* Peripheral #31 assigned IVG #x */
768
769
770/* SIC_IMASK Masks */
771#define SIC_UNMASK_ALL 0x00000000 /* Unmask all peripheral interrupts */
772#define SIC_MASK_ALL 0xFFFFFFFF /* Mask all peripheral interrupts */
773#define SIC_MASK(x) (1 << ((x)&0x1F)) /* Mask Peripheral #x interrupt */
774#define SIC_UNMASK(x) (0xFFFFFFFF ^ (1 << ((x)&0x1F))) /* Unmask Peripheral #x interrupt */
775
776/* SIC_IWR Masks */
777#define IWR_DISABLE_ALL 0x00000000 /* Wakeup Disable all peripherals */
778#define IWR_ENABLE_ALL 0xFFFFFFFF /* Wakeup Enable all peripherals */
779#define IWR_ENABLE(x) (1 << ((x)&0x1F)) /* Wakeup Enable Peripheral #x */
780#define IWR_DISABLE(x) (0xFFFFFFFF ^ (1 << ((x)&0x1F))) /* Wakeup Disable Peripheral #x */
781
782
783/* ********* WATCHDOG TIMER MASKS ******************** */
784
785/* Watchdog Timer WDOG_CTL Register Masks */
786
787#define WDEV(x) (((x)<<1) & 0x0006) /* event generated on roll over */
788#define WDEV_RESET 0x0000 /* generate reset event on roll over */
789#define WDEV_NMI 0x0002 /* generate NMI event on roll over */
790#define WDEV_GPI 0x0004 /* generate GP IRQ on roll over */
791#define WDEV_NONE 0x0006 /* no event on roll over */
792#define WDEN 0x0FF0 /* enable watchdog */
793#define WDDIS 0x0AD0 /* disable watchdog */
794#define WDRO 0x8000 /* watchdog rolled over latch */
795
796/* depreciated WDOG_CTL Register Masks for legacy code */
797
798
799#define ICTL WDEV
800#define ENABLE_RESET WDEV_RESET
801#define WDOG_RESET WDEV_RESET
802#define ENABLE_NMI WDEV_NMI
803#define WDOG_NMI WDEV_NMI
804#define ENABLE_GPI WDEV_GPI
805#define WDOG_GPI WDEV_GPI
806#define DISABLE_EVT WDEV_NONE
807#define WDOG_NONE WDEV_NONE
808
809#define TMR_EN WDEN
810#define TMR_DIS WDDIS
811#define TRO WDRO
812#define ICTL_P0 0x01
813 #define ICTL_P1 0x02
814#define TRO_P 0x0F
815
816
817
818/* *************** REAL TIME CLOCK MASKS **************************/
819/* RTC_STAT and RTC_ALARM Masks */
820#define RTC_SEC 0x0000003F /* Real-Time Clock Seconds */
821#define RTC_MIN 0x00000FC0 /* Real-Time Clock Minutes */
822#define RTC_HR 0x0001F000 /* Real-Time Clock Hours */
823#define RTC_DAY 0xFFFE0000 /* Real-Time Clock Days */
824
825/* RTC_ALARM Macro z=day y=hr x=min w=sec */
826#define SET_ALARM(z,y,x,w) ((((z)&0x7FFF)<<0x11)|(((y)&0x1F)<<0xC)|(((x)&0x3F)<<0x6)|((w)&0x3F))
827
828/* RTC_ICTL and RTC_ISTAT Masks */
829#define STOPWATCH 0x0001 /* Stopwatch Interrupt Enable */
830#define ALARM 0x0002 /* Alarm Interrupt Enable */
831#define SECOND 0x0004 /* Seconds (1 Hz) Interrupt Enable */
832#define MINUTE 0x0008 /* Minutes Interrupt Enable */
833#define HOUR 0x0010 /* Hours Interrupt Enable */
834#define DAY 0x0020 /* 24 Hours (Days) Interrupt Enable */
835#define DAY_ALARM 0x0040 /* Day Alarm (Day, Hour, Minute, Second) Interrupt Enable */
836#define WRITE_PENDING 0x4000 /* Write Pending Status */
837#define WRITE_COMPLETE 0x8000 /* Write Complete Interrupt Enable */
838
839/* RTC_FAST / RTC_PREN Mask */
840#define PREN 0x0001 /* Enable Prescaler, RTC Runs @1 Hz */
841
842
843/* ************** UART CONTROLLER MASKS *************************/
844/* UARTx_LCR Masks */
845#define WLS(x) (((x)-5) & 0x03) /* Word Length Select */
846#define STB 0x04 /* Stop Bits */
847#define PEN 0x08 /* Parity Enable */
848#define EPS 0x10 /* Even Parity Select */
849#define STP 0x20 /* Stick Parity */
850#define SB 0x40 /* Set Break */
851#define DLAB 0x80 /* Divisor Latch Access */
852
853/* UARTx_MCR Mask */
854#define LOOP_ENA 0x10 /* Loopback Mode Enable */
855#define LOOP_ENA_P 0x04
856
857/* UARTx_LSR Masks */
858#define DR 0x01 /* Data Ready */
859#define OE 0x02 /* Overrun Error */
860#define PE 0x04 /* Parity Error */
861#define FE 0x08 /* Framing Error */
862#define BI 0x10 /* Break Interrupt */
863#define THRE 0x20 /* THR Empty */
864#define TEMT 0x40 /* TSR and UART_THR Empty */
865
866/* UARTx_IER Masks */
867#define ERBFI 0x01 /* Enable Receive Buffer Full Interrupt */
868#define ETBEI 0x02 /* Enable Transmit Buffer Empty Interrupt */
869#define ELSI 0x04 /* Enable RX Status Interrupt */
870
871/* UARTx_IIR Masks */
872#define NINT 0x01 /* Pending Interrupt */
873#define IIR_TX_READY 0x02 /* UART_THR empty */
874#define IIR_RX_READY 0x04 /* Receive data ready */
875#define IIR_LINE_CHANGE 0x06 /* Receive line status */
876#define IIR_STATUS 0x06 /* Highest Priority Pending Interrupt */
877
878/* UARTx_GCTL Masks */
879#define UCEN 0x01 /* Enable UARTx Clocks */
880#define IREN 0x02 /* Enable IrDA Mode */
881#define TPOLC 0x04 /* IrDA TX Polarity Change */
882#define RPOLC 0x08 /* IrDA RX Polarity Change */
883#define FPE 0x10 /* Force Parity Error On Transmit */
884#define FFE 0x20 /* Force Framing Error On Transmit */
885
886
887/* *********** SERIAL PERIPHERAL INTERFACE (SPI) MASKS ****************************/
888/* SPI_CTL Masks */
889#define TIMOD 0x0003 /* Transfer Initiate Mode */
890#define RDBR_CORE 0x0000 /* RDBR Read Initiates, IRQ When RDBR Full */
891#define TDBR_CORE 0x0001 /* TDBR Write Initiates, IRQ When TDBR Empty */
892#define RDBR_DMA 0x0002 /* DMA Read, DMA Until FIFO Empty */
893#define TDBR_DMA 0x0003 /* DMA Write, DMA Until FIFO Full */
894#define SZ 0x0004 /* Send Zero (When TDBR Empty, Send Zero/Last*) */
895#define GM 0x0008 /* Get More (When RDBR Full, Overwrite/Discard*) */
896#define PSSE 0x0010 /* Slave-Select Input Enable */
897#define EMISO 0x0020 /* Enable MISO As Output */
898#define SIZE 0x0100 /* Size of Words (16/8* Bits) */
899#define LSBF 0x0200 /* LSB First */
900#define CPHA 0x0400 /* Clock Phase */
901#define CPOL 0x0800 /* Clock Polarity */
902#define MSTR 0x1000 /* Master/Slave* */
903#define WOM 0x2000 /* Write Open Drain Master */
904#define SPE 0x4000 /* SPI Enable */
905
906/* SPI_FLG Masks */
907#define FLS1 0x0002 /* Enables SPI_FLOUT1 as SPI Slave-Select Output */
908#define FLS2 0x0004 /* Enables SPI_FLOUT2 as SPI Slave-Select Output */
909#define FLS3 0x0008 /* Enables SPI_FLOUT3 as SPI Slave-Select Output */
910#define FLS4 0x0010 /* Enables SPI_FLOUT4 as SPI Slave-Select Output */
911#define FLS5 0x0020 /* Enables SPI_FLOUT5 as SPI Slave-Select Output */
912#define FLS6 0x0040 /* Enables SPI_FLOUT6 as SPI Slave-Select Output */
913#define FLS7 0x0080 /* Enables SPI_FLOUT7 as SPI Slave-Select Output */
914#define FLG1 0xFDFF /* Activates SPI_FLOUT1 */
915#define FLG2 0xFBFF /* Activates SPI_FLOUT2 */
916#define FLG3 0xF7FF /* Activates SPI_FLOUT3 */
917#define FLG4 0xEFFF /* Activates SPI_FLOUT4 */
918#define FLG5 0xDFFF /* Activates SPI_FLOUT5 */
919#define FLG6 0xBFFF /* Activates SPI_FLOUT6 */
920#define FLG7 0x7FFF /* Activates SPI_FLOUT7 */
921
922/* SPI_STAT Masks */
923#define SPIF 0x0001 /* SPI Finished (Single-Word Transfer Complete) */
924#define MODF 0x0002 /* Mode Fault Error (Another Device Tried To Become Master) */
925#define TXE 0x0004 /* Transmission Error (Data Sent With No New Data In TDBR) */
926#define TXS 0x0008 /* SPI_TDBR Data Buffer Status (Full/Empty*) */
927#define RBSY 0x0010 /* Receive Error (Data Received With RDBR Full) */
928#define RXS 0x0020 /* SPI_RDBR Data Buffer Status (Full/Empty*) */
929#define TXCOL 0x0040 /* Transmit Collision Error (Corrupt Data May Have Been Sent) */
930
931
932/* **************** GENERAL PURPOSE TIMER MASKS **********************/
933/* TIMER_ENABLE Masks */
934#define TIMEN0 0x0001 /* Enable Timer 0 */
935#define TIMEN1 0x0002 /* Enable Timer 1 */
936#define TIMEN2 0x0004 /* Enable Timer 2 */
937#define TIMEN3 0x0008 /* Enable Timer 3 */
938#define TIMEN4 0x0010 /* Enable Timer 4 */
939#define TIMEN5 0x0020 /* Enable Timer 5 */
940#define TIMEN6 0x0040 /* Enable Timer 6 */
941#define TIMEN7 0x0080 /* Enable Timer 7 */
942
943/* TIMER_DISABLE Masks */
944#define TIMDIS0 TIMEN0 /* Disable Timer 0 */
945#define TIMDIS1 TIMEN1 /* Disable Timer 1 */
946#define TIMDIS2 TIMEN2 /* Disable Timer 2 */
947#define TIMDIS3 TIMEN3 /* Disable Timer 3 */
948#define TIMDIS4 TIMEN4 /* Disable Timer 4 */
949#define TIMDIS5 TIMEN5 /* Disable Timer 5 */
950#define TIMDIS6 TIMEN6 /* Disable Timer 6 */
951#define TIMDIS7 TIMEN7 /* Disable Timer 7 */
952
953/* TIMER_STATUS Masks */
954#define TIMIL0 0x00000001 /* Timer 0 Interrupt */
955#define TIMIL1 0x00000002 /* Timer 1 Interrupt */
956#define TIMIL2 0x00000004 /* Timer 2 Interrupt */
957#define TIMIL3 0x00000008 /* Timer 3 Interrupt */
958#define TOVF_ERR0 0x00000010 /* Timer 0 Counter Overflow */
959#define TOVF_ERR1 0x00000020 /* Timer 1 Counter Overflow */
960#define TOVF_ERR2 0x00000040 /* Timer 2 Counter Overflow */
961#define TOVF_ERR3 0x00000080 /* Timer 3 Counter Overflow */
962#define TRUN0 0x00001000 /* Timer 0 Slave Enable Status */
963#define TRUN1 0x00002000 /* Timer 1 Slave Enable Status */
964#define TRUN2 0x00004000 /* Timer 2 Slave Enable Status */
965#define TRUN3 0x00008000 /* Timer 3 Slave Enable Status */
966#define TIMIL4 0x00010000 /* Timer 4 Interrupt */
967#define TIMIL5 0x00020000 /* Timer 5 Interrupt */
968#define TIMIL6 0x00040000 /* Timer 6 Interrupt */
969#define TIMIL7 0x00080000 /* Timer 7 Interrupt */
970#define TOVF_ERR4 0x00100000 /* Timer 4 Counter Overflow */
971#define TOVF_ERR5 0x00200000 /* Timer 5 Counter Overflow */
972#define TOVF_ERR6 0x00400000 /* Timer 6 Counter Overflow */
973#define TOVF_ERR7 0x00800000 /* Timer 7 Counter Overflow */
974#define TRUN4 0x10000000 /* Timer 4 Slave Enable Status */
975#define TRUN5 0x20000000 /* Timer 5 Slave Enable Status */
976#define TRUN6 0x40000000 /* Timer 6 Slave Enable Status */
977#define TRUN7 0x80000000 /* Timer 7 Slave Enable Status */
978
979/* Alternate Deprecated Macros Provided For Backwards Code Compatibility */
980#define TOVL_ERR0 TOVF_ERR0
981#define TOVL_ERR1 TOVF_ERR1
982#define TOVL_ERR2 TOVF_ERR2
983#define TOVL_ERR3 TOVF_ERR3
984#define TOVL_ERR4 TOVF_ERR4
985#define TOVL_ERR5 TOVF_ERR5
986#define TOVL_ERR6 TOVF_ERR6
987#define TOVL_ERR7 TOVF_ERR7
988
989/* TIMERx_CONFIG Masks */
990#define PWM_OUT 0x0001 /* Pulse-Width Modulation Output Mode */
991#define WDTH_CAP 0x0002 /* Width Capture Input Mode */
992#define EXT_CLK 0x0003 /* External Clock Mode */
993#define PULSE_HI 0x0004 /* Action Pulse (Positive/Negative*) */
994#define PERIOD_CNT 0x0008 /* Period Count */
995#define IRQ_ENA 0x0010 /* Interrupt Request Enable */
996#define TIN_SEL 0x0020 /* Timer Input Select */
997#define OUT_DIS 0x0040 /* Output Pad Disable */
998#define CLK_SEL 0x0080 /* Timer Clock Select */
999#define TOGGLE_HI 0x0100 /* PWM_OUT PULSE_HI Toggle Mode */
1000#define EMU_RUN 0x0200 /* Emulation Behavior Select */
1001#define ERR_TYP 0xC000 /* Error Type */
1002
1003
1004/* ****************** GPIO PORTS F, G, H MASKS ***********************/
1005/* General Purpose IO (0xFFC00700 - 0xFFC007FF) Masks */
1006/* Port F Masks */
1007#define PF0 0x0001
1008#define PF1 0x0002
1009#define PF2 0x0004
1010#define PF3 0x0008
1011#define PF4 0x0010
1012#define PF5 0x0020
1013#define PF6 0x0040
1014#define PF7 0x0080
1015#define PF8 0x0100
1016#define PF9 0x0200
1017#define PF10 0x0400
1018#define PF11 0x0800
1019#define PF12 0x1000
1020#define PF13 0x2000
1021#define PF14 0x4000
1022#define PF15 0x8000
1023
1024/* Port G Masks */
1025#define PG0 0x0001
1026#define PG1 0x0002
1027#define PG2 0x0004
1028#define PG3 0x0008
1029#define PG4 0x0010
1030#define PG5 0x0020
1031#define PG6 0x0040
1032#define PG7 0x0080
1033#define PG8 0x0100
1034#define PG9 0x0200
1035#define PG10 0x0400
1036#define PG11 0x0800
1037#define PG12 0x1000
1038#define PG13 0x2000
1039#define PG14 0x4000
1040#define PG15 0x8000
1041
1042/* Port H Masks */
1043#define PH0 0x0001
1044#define PH1 0x0002
1045#define PH2 0x0004
1046#define PH3 0x0008
1047#define PH4 0x0010
1048#define PH5 0x0020
1049#define PH6 0x0040
1050#define PH7 0x0080
1051
1052
1053/* ******************* SERIAL PORT MASKS **************************************/
1054/* SPORTx_TCR1 Masks */
1055#define TSPEN 0x0001 /* Transmit Enable */
1056#define ITCLK 0x0002 /* Internal Transmit Clock Select */
1057#define DTYPE_NORM 0x0004 /* Data Format Normal */
1058#define DTYPE_ULAW 0x0008 /* Compand Using u-Law */
1059#define DTYPE_ALAW 0x000C /* Compand Using A-Law */
1060#define TLSBIT 0x0010 /* Transmit Bit Order */
1061#define ITFS 0x0200 /* Internal Transmit Frame Sync Select */
1062#define TFSR 0x0400 /* Transmit Frame Sync Required Select */
1063#define DITFS 0x0800 /* Data-Independent Transmit Frame Sync Select */
1064#define LTFS 0x1000 /* Low Transmit Frame Sync Select */
1065#define LATFS 0x2000 /* Late Transmit Frame Sync Select */
1066#define TCKFE 0x4000 /* Clock Falling Edge Select */
1067
1068/* SPORTx_TCR2 Masks and Macro */
1069#define SLEN(x) ((x)&0x1F) /* SPORT TX Word Length (2 - 31) */
1070#define TXSE 0x0100 /* TX Secondary Enable */
1071#define TSFSE 0x0200 /* Transmit Stereo Frame Sync Enable */
1072#define TRFST 0x0400 /* Left/Right Order (1 = Right Channel 1st) */
1073
1074/* SPORTx_RCR1 Masks */
1075#define RSPEN 0x0001 /* Receive Enable */
1076#define IRCLK 0x0002 /* Internal Receive Clock Select */
1077#define DTYPE_NORM 0x0004 /* Data Format Normal */
1078#define DTYPE_ULAW 0x0008 /* Compand Using u-Law */
1079#define DTYPE_ALAW 0x000C /* Compand Using A-Law */
1080#define RLSBIT 0x0010 /* Receive Bit Order */
1081#define IRFS 0x0200 /* Internal Receive Frame Sync Select */
1082#define RFSR 0x0400 /* Receive Frame Sync Required Select */
1083#define LRFS 0x1000 /* Low Receive Frame Sync Select */
1084#define LARFS 0x2000 /* Late Receive Frame Sync Select */
1085#define RCKFE 0x4000 /* Clock Falling Edge Select */
1086
1087/* SPORTx_RCR2 Masks */
1088#define SLEN(x) ((x)&0x1F) /* SPORT RX Word Length (2 - 31) */
1089#define RXSE 0x0100 /* RX Secondary Enable */
1090#define RSFSE 0x0200 /* RX Stereo Frame Sync Enable */
1091#define RRFST 0x0400 /* Right-First Data Order */
1092
1093/* SPORTx_STAT Masks */
1094#define RXNE 0x0001 /* Receive FIFO Not Empty Status */
1095#define RUVF 0x0002 /* Sticky Receive Underflow Status */
1096#define ROVF 0x0004 /* Sticky Receive Overflow Status */
1097#define TXF 0x0008 /* Transmit FIFO Full Status */
1098#define TUVF 0x0010 /* Sticky Transmit Underflow Status */
1099#define TOVF 0x0020 /* Sticky Transmit Overflow Status */
1100#define TXHRE 0x0040 /* Transmit Hold Register Empty */
1101
1102/* SPORTx_MCMC1 Macros */
1103#define SP_WOFF(x) ((x) & 0x3FF) /* Multichannel Window Offset Field */
1104
1105/* Only use WSIZE Macro With Logic OR While Setting Lower Order Bits */
1106#define SP_WSIZE(x) (((((x)>>0x3)-1)&0xF) << 0xC) /* Multichannel Window Size = (x/8)-1 */
1107
1108/* SPORTx_MCMC2 Masks */
1109#define REC_BYPASS 0x0000 /* Bypass Mode (No Clock Recovery) */
1110#define REC_2FROM4 0x0002 /* Recover 2 MHz Clock from 4 MHz Clock */
1111#define REC_8FROM16 0x0003 /* Recover 8 MHz Clock from 16 MHz Clock */
1112#define MCDTXPE 0x0004 /* Multichannel DMA Transmit Packing */
1113#define MCDRXPE 0x0008 /* Multichannel DMA Receive Packing */
1114#define MCMEN 0x0010 /* Multichannel Frame Mode Enable */
1115#define FSDR 0x0080 /* Multichannel Frame Sync to Data Relationship */
1116#define MFD_0 0x0000 /* Multichannel Frame Delay = 0 */
1117#define MFD_1 0x1000 /* Multichannel Frame Delay = 1 */
1118#define MFD_2 0x2000 /* Multichannel Frame Delay = 2 */
1119#define MFD_3 0x3000 /* Multichannel Frame Delay = 3 */
1120#define MFD_4 0x4000 /* Multichannel Frame Delay = 4 */
1121#define MFD_5 0x5000 /* Multichannel Frame Delay = 5 */
1122#define MFD_6 0x6000 /* Multichannel Frame Delay = 6 */
1123#define MFD_7 0x7000 /* Multichannel Frame Delay = 7 */
1124#define MFD_8 0x8000 /* Multichannel Frame Delay = 8 */
1125#define MFD_9 0x9000 /* Multichannel Frame Delay = 9 */
1126#define MFD_10 0xA000 /* Multichannel Frame Delay = 10 */
1127#define MFD_11 0xB000 /* Multichannel Frame Delay = 11 */
1128#define MFD_12 0xC000 /* Multichannel Frame Delay = 12 */
1129#define MFD_13 0xD000 /* Multichannel Frame Delay = 13 */
1130#define MFD_14 0xE000 /* Multichannel Frame Delay = 14 */
1131#define MFD_15 0xF000 /* Multichannel Frame Delay = 15 */
1132
1133
1134/* ********************* ASYNCHRONOUS MEMORY CONTROLLER MASKS *************************/
1135/* EBIU_AMGCTL Masks */
1136#define AMCKEN 0x0001 /* Enable CLKOUT */
1137#define AMBEN_NONE 0x0000 /* All Banks Disabled */
1138#define AMBEN_B0 0x0002 /* Enable Async Memory Bank 0 only */
1139#define AMBEN_B0_B1 0x0004 /* Enable Async Memory Banks 0 & 1 only */
1140#define AMBEN_B0_B1_B2 0x0006 /* Enable Async Memory Banks 0, 1, and 2 */
1141#define AMBEN_ALL 0x0008 /* Enable Async Memory Banks (all) 0, 1, 2, and 3 */
1142
1143/* EBIU_AMBCTL0 Masks */
1144#define B0RDYEN 0x00000001 /* Bank 0 (B0) RDY Enable */
1145#define B0RDYPOL 0x00000002 /* B0 RDY Active High */
1146#define B0TT_1 0x00000004 /* B0 Transition Time (Read to Write) = 1 cycle */
1147#define B0TT_2 0x00000008 /* B0 Transition Time (Read to Write) = 2 cycles */
1148#define B0TT_3 0x0000000C /* B0 Transition Time (Read to Write) = 3 cycles */
1149#define B0TT_4 0x00000000 /* B0 Transition Time (Read to Write) = 4 cycles */
1150#define B0ST_1 0x00000010 /* B0 Setup Time (AOE to Read/Write) = 1 cycle */
1151#define B0ST_2 0x00000020 /* B0 Setup Time (AOE to Read/Write) = 2 cycles */
1152#define B0ST_3 0x00000030 /* B0 Setup Time (AOE to Read/Write) = 3 cycles */
1153#define B0ST_4 0x00000000 /* B0 Setup Time (AOE to Read/Write) = 4 cycles */
1154#define B0HT_1 0x00000040 /* B0 Hold Time (~Read/Write to ~AOE) = 1 cycle */
1155#define B0HT_2 0x00000080 /* B0 Hold Time (~Read/Write to ~AOE) = 2 cycles */
1156#define B0HT_3 0x000000C0 /* B0 Hold Time (~Read/Write to ~AOE) = 3 cycles */
1157#define B0HT_0 0x00000000 /* B0 Hold Time (~Read/Write to ~AOE) = 0 cycles */
1158#define B0RAT_1 0x00000100 /* B0 Read Access Time = 1 cycle */
1159#define B0RAT_2 0x00000200 /* B0 Read Access Time = 2 cycles */
1160#define B0RAT_3 0x00000300 /* B0 Read Access Time = 3 cycles */
1161#define B0RAT_4 0x00000400 /* B0 Read Access Time = 4 cycles */
1162#define B0RAT_5 0x00000500 /* B0 Read Access Time = 5 cycles */
1163#define B0RAT_6 0x00000600 /* B0 Read Access Time = 6 cycles */
1164#define B0RAT_7 0x00000700 /* B0 Read Access Time = 7 cycles */
1165#define B0RAT_8 0x00000800 /* B0 Read Access Time = 8 cycles */
1166#define B0RAT_9 0x00000900 /* B0 Read Access Time = 9 cycles */
1167#define B0RAT_10 0x00000A00 /* B0 Read Access Time = 10 cycles */
1168#define B0RAT_11 0x00000B00 /* B0 Read Access Time = 11 cycles */
1169#define B0RAT_12 0x00000C00 /* B0 Read Access Time = 12 cycles */
1170#define B0RAT_13 0x00000D00 /* B0 Read Access Time = 13 cycles */
1171#define B0RAT_14 0x00000E00 /* B0 Read Access Time = 14 cycles */
1172#define B0RAT_15 0x00000F00 /* B0 Read Access Time = 15 cycles */
1173#define B0WAT_1 0x00001000 /* B0 Write Access Time = 1 cycle */
1174#define B0WAT_2 0x00002000 /* B0 Write Access Time = 2 cycles */
1175#define B0WAT_3 0x00003000 /* B0 Write Access Time = 3 cycles */
1176#define B0WAT_4 0x00004000 /* B0 Write Access Time = 4 cycles */
1177#define B0WAT_5 0x00005000 /* B0 Write Access Time = 5 cycles */
1178#define B0WAT_6 0x00006000 /* B0 Write Access Time = 6 cycles */
1179#define B0WAT_7 0x00007000 /* B0 Write Access Time = 7 cycles */
1180#define B0WAT_8 0x00008000 /* B0 Write Access Time = 8 cycles */
1181#define B0WAT_9 0x00009000 /* B0 Write Access Time = 9 cycles */
1182#define B0WAT_10 0x0000A000 /* B0 Write Access Time = 10 cycles */
1183#define B0WAT_11 0x0000B000 /* B0 Write Access Time = 11 cycles */
1184#define B0WAT_12 0x0000C000 /* B0 Write Access Time = 12 cycles */
1185#define B0WAT_13 0x0000D000 /* B0 Write Access Time = 13 cycles */
1186#define B0WAT_14 0x0000E000 /* B0 Write Access Time = 14 cycles */
1187#define B0WAT_15 0x0000F000 /* B0 Write Access Time = 15 cycles */
1188
1189#define B1RDYEN 0x00010000 /* Bank 1 (B1) RDY Enable */
1190#define B1RDYPOL 0x00020000 /* B1 RDY Active High */
1191#define B1TT_1 0x00040000 /* B1 Transition Time (Read to Write) = 1 cycle */
1192#define B1TT_2 0x00080000 /* B1 Transition Time (Read to Write) = 2 cycles */
1193#define B1TT_3 0x000C0000 /* B1 Transition Time (Read to Write) = 3 cycles */
1194#define B1TT_4 0x00000000 /* B1 Transition Time (Read to Write) = 4 cycles */
1195#define B1ST_1 0x00100000 /* B1 Setup Time (AOE to Read/Write) = 1 cycle */
1196#define B1ST_2 0x00200000 /* B1 Setup Time (AOE to Read/Write) = 2 cycles */
1197#define B1ST_3 0x00300000 /* B1 Setup Time (AOE to Read/Write) = 3 cycles */
1198#define B1ST_4 0x00000000 /* B1 Setup Time (AOE to Read/Write) = 4 cycles */
1199#define B1HT_1 0x00400000 /* B1 Hold Time (~Read/Write to ~AOE) = 1 cycle */
1200#define B1HT_2 0x00800000 /* B1 Hold Time (~Read/Write to ~AOE) = 2 cycles */
1201#define B1HT_3 0x00C00000 /* B1 Hold Time (~Read/Write to ~AOE) = 3 cycles */
1202#define B1HT_0 0x00000000 /* B1 Hold Time (~Read/Write to ~AOE) = 0 cycles */
1203#define B1RAT_1 0x01000000 /* B1 Read Access Time = 1 cycle */
1204#define B1RAT_2 0x02000000 /* B1 Read Access Time = 2 cycles */
1205#define B1RAT_3 0x03000000 /* B1 Read Access Time = 3 cycles */
1206#define B1RAT_4 0x04000000 /* B1 Read Access Time = 4 cycles */
1207#define B1RAT_5 0x05000000 /* B1 Read Access Time = 5 cycles */
1208#define B1RAT_6 0x06000000 /* B1 Read Access Time = 6 cycles */
1209#define B1RAT_7 0x07000000 /* B1 Read Access Time = 7 cycles */
1210#define B1RAT_8 0x08000000 /* B1 Read Access Time = 8 cycles */
1211#define B1RAT_9 0x09000000 /* B1 Read Access Time = 9 cycles */
1212#define B1RAT_10 0x0A000000 /* B1 Read Access Time = 10 cycles */
1213#define B1RAT_11 0x0B000000 /* B1 Read Access Time = 11 cycles */
1214#define B1RAT_12 0x0C000000 /* B1 Read Access Time = 12 cycles */
1215#define B1RAT_13 0x0D000000 /* B1 Read Access Time = 13 cycles */
1216#define B1RAT_14 0x0E000000 /* B1 Read Access Time = 14 cycles */
1217#define B1RAT_15 0x0F000000 /* B1 Read Access Time = 15 cycles */
1218#define B1WAT_1 0x10000000 /* B1 Write Access Time = 1 cycle */
1219#define B1WAT_2 0x20000000 /* B1 Write Access Time = 2 cycles */
1220#define B1WAT_3 0x30000000 /* B1 Write Access Time = 3 cycles */
1221#define B1WAT_4 0x40000000 /* B1 Write Access Time = 4 cycles */
1222#define B1WAT_5 0x50000000 /* B1 Write Access Time = 5 cycles */
1223#define B1WAT_6 0x60000000 /* B1 Write Access Time = 6 cycles */
1224#define B1WAT_7 0x70000000 /* B1 Write Access Time = 7 cycles */
1225#define B1WAT_8 0x80000000 /* B1 Write Access Time = 8 cycles */
1226#define B1WAT_9 0x90000000 /* B1 Write Access Time = 9 cycles */
1227#define B1WAT_10 0xA0000000 /* B1 Write Access Time = 10 cycles */
1228#define B1WAT_11 0xB0000000 /* B1 Write Access Time = 11 cycles */
1229#define B1WAT_12 0xC0000000 /* B1 Write Access Time = 12 cycles */
1230#define B1WAT_13 0xD0000000 /* B1 Write Access Time = 13 cycles */
1231#define B1WAT_14 0xE0000000 /* B1 Write Access Time = 14 cycles */
1232#define B1WAT_15 0xF0000000 /* B1 Write Access Time = 15 cycles */
1233
1234/* EBIU_AMBCTL1 Masks */
1235#define B2RDYEN 0x00000001 /* Bank 2 (B2) RDY Enable */
1236#define B2RDYPOL 0x00000002 /* B2 RDY Active High */
1237#define B2TT_1 0x00000004 /* B2 Transition Time (Read to Write) = 1 cycle */
1238#define B2TT_2 0x00000008 /* B2 Transition Time (Read to Write) = 2 cycles */
1239#define B2TT_3 0x0000000C /* B2 Transition Time (Read to Write) = 3 cycles */
1240#define B2TT_4 0x00000000 /* B2 Transition Time (Read to Write) = 4 cycles */
1241#define B2ST_1 0x00000010 /* B2 Setup Time (AOE to Read/Write) = 1 cycle */
1242#define B2ST_2 0x00000020 /* B2 Setup Time (AOE to Read/Write) = 2 cycles */
1243#define B2ST_3 0x00000030 /* B2 Setup Time (AOE to Read/Write) = 3 cycles */
1244#define B2ST_4 0x00000000 /* B2 Setup Time (AOE to Read/Write) = 4 cycles */
1245#define B2HT_1 0x00000040 /* B2 Hold Time (~Read/Write to ~AOE) = 1 cycle */
1246#define B2HT_2 0x00000080 /* B2 Hold Time (~Read/Write to ~AOE) = 2 cycles */
1247#define B2HT_3 0x000000C0 /* B2 Hold Time (~Read/Write to ~AOE) = 3 cycles */
1248#define B2HT_0 0x00000000 /* B2 Hold Time (~Read/Write to ~AOE) = 0 cycles */
1249#define B2RAT_1 0x00000100 /* B2 Read Access Time = 1 cycle */
1250#define B2RAT_2 0x00000200 /* B2 Read Access Time = 2 cycles */
1251#define B2RAT_3 0x00000300 /* B2 Read Access Time = 3 cycles */
1252#define B2RAT_4 0x00000400 /* B2 Read Access Time = 4 cycles */
1253#define B2RAT_5 0x00000500 /* B2 Read Access Time = 5 cycles */
1254#define B2RAT_6 0x00000600 /* B2 Read Access Time = 6 cycles */
1255#define B2RAT_7 0x00000700 /* B2 Read Access Time = 7 cycles */
1256#define B2RAT_8 0x00000800 /* B2 Read Access Time = 8 cycles */
1257#define B2RAT_9 0x00000900 /* B2 Read Access Time = 9 cycles */
1258#define B2RAT_10 0x00000A00 /* B2 Read Access Time = 10 cycles */
1259#define B2RAT_11 0x00000B00 /* B2 Read Access Time = 11 cycles */
1260#define B2RAT_12 0x00000C00 /* B2 Read Access Time = 12 cycles */
1261#define B2RAT_13 0x00000D00 /* B2 Read Access Time = 13 cycles */
1262#define B2RAT_14 0x00000E00 /* B2 Read Access Time = 14 cycles */
1263#define B2RAT_15 0x00000F00 /* B2 Read Access Time = 15 cycles */
1264#define B2WAT_1 0x00001000 /* B2 Write Access Time = 1 cycle */
1265#define B2WAT_2 0x00002000 /* B2 Write Access Time = 2 cycles */
1266#define B2WAT_3 0x00003000 /* B2 Write Access Time = 3 cycles */
1267#define B2WAT_4 0x00004000 /* B2 Write Access Time = 4 cycles */
1268#define B2WAT_5 0x00005000 /* B2 Write Access Time = 5 cycles */
1269#define B2WAT_6 0x00006000 /* B2 Write Access Time = 6 cycles */
1270#define B2WAT_7 0x00007000 /* B2 Write Access Time = 7 cycles */
1271#define B2WAT_8 0x00008000 /* B2 Write Access Time = 8 cycles */
1272#define B2WAT_9 0x00009000 /* B2 Write Access Time = 9 cycles */
1273#define B2WAT_10 0x0000A000 /* B2 Write Access Time = 10 cycles */
1274#define B2WAT_11 0x0000B000 /* B2 Write Access Time = 11 cycles */
1275#define B2WAT_12 0x0000C000 /* B2 Write Access Time = 12 cycles */
1276#define B2WAT_13 0x0000D000 /* B2 Write Access Time = 13 cycles */
1277#define B2WAT_14 0x0000E000 /* B2 Write Access Time = 14 cycles */
1278#define B2WAT_15 0x0000F000 /* B2 Write Access Time = 15 cycles */
1279
1280#define B3RDYEN 0x00010000 /* Bank 3 (B3) RDY Enable */
1281#define B3RDYPOL 0x00020000 /* B3 RDY Active High */
1282#define B3TT_1 0x00040000 /* B3 Transition Time (Read to Write) = 1 cycle */
1283#define B3TT_2 0x00080000 /* B3 Transition Time (Read to Write) = 2 cycles */
1284#define B3TT_3 0x000C0000 /* B3 Transition Time (Read to Write) = 3 cycles */
1285#define B3TT_4 0x00000000 /* B3 Transition Time (Read to Write) = 4 cycles */
1286#define B3ST_1 0x00100000 /* B3 Setup Time (AOE to Read/Write) = 1 cycle */
1287#define B3ST_2 0x00200000 /* B3 Setup Time (AOE to Read/Write) = 2 cycles */
1288#define B3ST_3 0x00300000 /* B3 Setup Time (AOE to Read/Write) = 3 cycles */
1289#define B3ST_4 0x00000000 /* B3 Setup Time (AOE to Read/Write) = 4 cycles */
1290#define B3HT_1 0x00400000 /* B3 Hold Time (~Read/Write to ~AOE) = 1 cycle */
1291#define B3HT_2 0x00800000 /* B3 Hold Time (~Read/Write to ~AOE) = 2 cycles */
1292#define B3HT_3 0x00C00000 /* B3 Hold Time (~Read/Write to ~AOE) = 3 cycles */
1293#define B3HT_0 0x00000000 /* B3 Hold Time (~Read/Write to ~AOE) = 0 cycles */
1294#define B3RAT_1 0x01000000 /* B3 Read Access Time = 1 cycle */
1295#define B3RAT_2 0x02000000 /* B3 Read Access Time = 2 cycles */
1296#define B3RAT_3 0x03000000 /* B3 Read Access Time = 3 cycles */
1297#define B3RAT_4 0x04000000 /* B3 Read Access Time = 4 cycles */
1298#define B3RAT_5 0x05000000 /* B3 Read Access Time = 5 cycles */
1299#define B3RAT_6 0x06000000 /* B3 Read Access Time = 6 cycles */
1300#define B3RAT_7 0x07000000 /* B3 Read Access Time = 7 cycles */
1301#define B3RAT_8 0x08000000 /* B3 Read Access Time = 8 cycles */
1302#define B3RAT_9 0x09000000 /* B3 Read Access Time = 9 cycles */
1303#define B3RAT_10 0x0A000000 /* B3 Read Access Time = 10 cycles */
1304#define B3RAT_11 0x0B000000 /* B3 Read Access Time = 11 cycles */
1305#define B3RAT_12 0x0C000000 /* B3 Read Access Time = 12 cycles */
1306#define B3RAT_13 0x0D000000 /* B3 Read Access Time = 13 cycles */
1307#define B3RAT_14 0x0E000000 /* B3 Read Access Time = 14 cycles */
1308#define B3RAT_15 0x0F000000 /* B3 Read Access Time = 15 cycles */
1309#define B3WAT_1 0x10000000 /* B3 Write Access Time = 1 cycle */
1310#define B3WAT_2 0x20000000 /* B3 Write Access Time = 2 cycles */
1311#define B3WAT_3 0x30000000 /* B3 Write Access Time = 3 cycles */
1312#define B3WAT_4 0x40000000 /* B3 Write Access Time = 4 cycles */
1313#define B3WAT_5 0x50000000 /* B3 Write Access Time = 5 cycles */
1314#define B3WAT_6 0x60000000 /* B3 Write Access Time = 6 cycles */
1315#define B3WAT_7 0x70000000 /* B3 Write Access Time = 7 cycles */
1316#define B3WAT_8 0x80000000 /* B3 Write Access Time = 8 cycles */
1317#define B3WAT_9 0x90000000 /* B3 Write Access Time = 9 cycles */
1318#define B3WAT_10 0xA0000000 /* B3 Write Access Time = 10 cycles */
1319#define B3WAT_11 0xB0000000 /* B3 Write Access Time = 11 cycles */
1320#define B3WAT_12 0xC0000000 /* B3 Write Access Time = 12 cycles */
1321#define B3WAT_13 0xD0000000 /* B3 Write Access Time = 13 cycles */
1322#define B3WAT_14 0xE0000000 /* B3 Write Access Time = 14 cycles */
1323#define B3WAT_15 0xF0000000 /* B3 Write Access Time = 15 cycles */
1324
1325
1326/* ********************** SDRAM CONTROLLER MASKS **********************************************/
1327/* EBIU_SDGCTL Masks */
1328#define SCTLE 0x00000001 /* Enable SDRAM Signals */
1329#define CL_2 0x00000008 /* SDRAM CAS Latency = 2 cycles */
1330#define CL_3 0x0000000C /* SDRAM CAS Latency = 3 cycles */
1331#define PASR_ALL 0x00000000 /* All 4 SDRAM Banks Refreshed In Self-Refresh */
1332#define PASR_B0_B1 0x00000010 /* SDRAM Banks 0 and 1 Are Refreshed In Self-Refresh */
1333#define PASR_B0 0x00000020 /* Only SDRAM Bank 0 Is Refreshed In Self-Refresh */
1334#define TRAS_1 0x00000040 /* SDRAM tRAS = 1 cycle */
1335#define TRAS_2 0x00000080 /* SDRAM tRAS = 2 cycles */
1336#define TRAS_3 0x000000C0 /* SDRAM tRAS = 3 cycles */
1337#define TRAS_4 0x00000100 /* SDRAM tRAS = 4 cycles */
1338#define TRAS_5 0x00000140 /* SDRAM tRAS = 5 cycles */
1339#define TRAS_6 0x00000180 /* SDRAM tRAS = 6 cycles */
1340#define TRAS_7 0x000001C0 /* SDRAM tRAS = 7 cycles */
1341#define TRAS_8 0x00000200 /* SDRAM tRAS = 8 cycles */
1342#define TRAS_9 0x00000240 /* SDRAM tRAS = 9 cycles */
1343#define TRAS_10 0x00000280 /* SDRAM tRAS = 10 cycles */
1344#define TRAS_11 0x000002C0 /* SDRAM tRAS = 11 cycles */
1345#define TRAS_12 0x00000300 /* SDRAM tRAS = 12 cycles */
1346#define TRAS_13 0x00000340 /* SDRAM tRAS = 13 cycles */
1347#define TRAS_14 0x00000380 /* SDRAM tRAS = 14 cycles */
1348#define TRAS_15 0x000003C0 /* SDRAM tRAS = 15 cycles */
1349#define TRP_1 0x00000800 /* SDRAM tRP = 1 cycle */
1350#define TRP_2 0x00001000 /* SDRAM tRP = 2 cycles */
1351#define TRP_3 0x00001800 /* SDRAM tRP = 3 cycles */
1352#define TRP_4 0x00002000 /* SDRAM tRP = 4 cycles */
1353#define TRP_5 0x00002800 /* SDRAM tRP = 5 cycles */
1354#define TRP_6 0x00003000 /* SDRAM tRP = 6 cycles */
1355#define TRP_7 0x00003800 /* SDRAM tRP = 7 cycles */
1356#define TRCD_1 0x00008000 /* SDRAM tRCD = 1 cycle */
1357#define TRCD_2 0x00010000 /* SDRAM tRCD = 2 cycles */
1358#define TRCD_3 0x00018000 /* SDRAM tRCD = 3 cycles */
1359#define TRCD_4 0x00020000 /* SDRAM tRCD = 4 cycles */
1360#define TRCD_5 0x00028000 /* SDRAM tRCD = 5 cycles */
1361#define TRCD_6 0x00030000 /* SDRAM tRCD = 6 cycles */
1362#define TRCD_7 0x00038000 /* SDRAM tRCD = 7 cycles */
1363#define TWR_1 0x00080000 /* SDRAM tWR = 1 cycle */
1364#define TWR_2 0x00100000 /* SDRAM tWR = 2 cycles */
1365#define TWR_3 0x00180000 /* SDRAM tWR = 3 cycles */
1366#define PUPSD 0x00200000 /* Power-Up Start Delay (15 SCLK Cycles Delay) */
1367#define PSM 0x00400000 /* Power-Up Sequence (Mode Register Before/After* Refresh) */
1368#define PSS 0x00800000 /* Enable Power-Up Sequence on Next SDRAM Access */
1369#define SRFS 0x01000000 /* Enable SDRAM Self-Refresh Mode */
1370#define EBUFE 0x02000000 /* Enable External Buffering Timing */
1371#define FBBRW 0x04000000 /* Enable Fast Back-To-Back Read To Write */
1372#define EMREN 0x10000000 /* Extended Mode Register Enable */
1373#define TCSR 0x20000000 /* Temp-Compensated Self-Refresh Value (85/45* Deg C) */
1374#define CDDBG 0x40000000 /* Tristate SDRAM Controls During Bus Grant */
1375
1376/* EBIU_SDBCTL Masks */
1377#define EBE 0x0001 /* Enable SDRAM External Bank */
1378#define EBSZ_16 0x0000 /* SDRAM External Bank Size = 16MB */
1379#define EBSZ_32 0x0002 /* SDRAM External Bank Size = 32MB */
1380#define EBSZ_64 0x0004 /* SDRAM External Bank Size = 64MB */
1381#define EBSZ_128 0x0006 /* SDRAM External Bank Size = 128MB */
1382#define EBSZ_256 0x0008 /* SDRAM External Bank Size = 256MB */
1383#define EBSZ_512 0x000A /* SDRAM External Bank Size = 512MB */
1384#define EBCAW_8 0x0000 /* SDRAM External Bank Column Address Width = 8 Bits */
1385#define EBCAW_9 0x0010 /* SDRAM External Bank Column Address Width = 9 Bits */
1386#define EBCAW_10 0x0020 /* SDRAM External Bank Column Address Width = 10 Bits */
1387#define EBCAW_11 0x0030 /* SDRAM External Bank Column Address Width = 11 Bits */
1388
1389/* EBIU_SDSTAT Masks */
1390#define SDCI 0x0001 /* SDRAM Controller Idle */
1391#define SDSRA 0x0002 /* SDRAM Self-Refresh Active */
1392#define SDPUA 0x0004 /* SDRAM Power-Up Active */
1393#define SDRS 0x0008 /* SDRAM Will Power-Up On Next Access */
1394#define SDEASE 0x0010 /* SDRAM EAB Sticky Error Status */
1395#define BGSTAT 0x0020 /* Bus Grant Status */
1396
1397
1398/* ************************** DMA CONTROLLER MASKS ********************************/
1399/* DMAx_CONFIG, MDMA_yy_CONFIG Masks */
1400#define DMAEN 0x0001 /* DMA Channel Enable */
1401#define WNR 0x0002 /* Channel Direction (W/R*) */
1402#define WDSIZE_8 0x0000 /* Transfer Word Size = 8 */
1403#define WDSIZE_16 0x0004 /* Transfer Word Size = 16 */
1404#define WDSIZE_32 0x0008 /* Transfer Word Size = 32 */
1405#define DMA2D 0x0010 /* DMA Mode (2D/1D*) */
1406#define RESTART 0x0020 /* DMA Buffer Clear */
1407#define DI_SEL 0x0040 /* Data Interrupt Timing Select */
1408#define DI_EN 0x0080 /* Data Interrupt Enable */
1409#define NDSIZE_0 0x0000 /* Next Descriptor Size = 0 (Stop/Autobuffer) */
1410#define NDSIZE_1 0x0100 /* Next Descriptor Size = 1 */
1411#define NDSIZE_2 0x0200 /* Next Descriptor Size = 2 */
1412#define NDSIZE_3 0x0300 /* Next Descriptor Size = 3 */
1413#define NDSIZE_4 0x0400 /* Next Descriptor Size = 4 */
1414#define NDSIZE_5 0x0500 /* Next Descriptor Size = 5 */
1415#define NDSIZE_6 0x0600 /* Next Descriptor Size = 6 */
1416#define NDSIZE_7 0x0700 /* Next Descriptor Size = 7 */
1417#define NDSIZE_8 0x0800 /* Next Descriptor Size = 8 */
1418#define NDSIZE_9 0x0900 /* Next Descriptor Size = 9 */
1419#define NDSIZE 0x0900 /* Next Descriptor Size */
1420#define DMAFLOW 0x7000 /* Flow Control */
1421#define DMAFLOW_STOP 0x0000 /* Stop Mode */
1422#define DMAFLOW_AUTO 0x1000 /* Autobuffer Mode */
1423#define DMAFLOW_ARRAY 0x4000 /* Descriptor Array Mode */
1424#define DMAFLOW_SMALL 0x6000 /* Small Model Descriptor List Mode */
1425#define DMAFLOW_LARGE 0x7000 /* Large Model Descriptor List Mode */
1426
1427/* DMAx_PERIPHERAL_MAP, MDMA_yy_PERIPHERAL_MAP Masks */
1428#define CTYPE 0x0040 /* DMA Channel Type Indicator (Memory/Peripheral*) */
1429#define PMAP 0xF000 /* Peripheral Mapped To This Channel */
1430#define PMAP_PPI 0x0000 /* PPI Port DMA */
1431#define PMAP_EMACRX 0x1000 /* Ethernet Receive DMA */
1432#define PMAP_EMACTX 0x2000 /* Ethernet Transmit DMA */
1433#define PMAP_SPORT0RX 0x3000 /* SPORT0 Receive DMA */
1434#define PMAP_SPORT0TX 0x4000 /* SPORT0 Transmit DMA */
1435#define PMAP_SPORT1RX 0x5000 /* SPORT1 Receive DMA */
1436#define PMAP_SPORT1TX 0x6000 /* SPORT1 Transmit DMA */
1437#define PMAP_SPI 0x7000 /* SPI Port DMA */
1438#define PMAP_UART0RX 0x8000 /* UART0 Port Receive DMA */
1439#define PMAP_UART0TX 0x9000 /* UART0 Port Transmit DMA */
1440#define PMAP_UART1RX 0xA000 /* UART1 Port Receive DMA */
1441#define PMAP_UART1TX 0xB000 /* UART1 Port Transmit DMA */
1442
1443/* DMAx_IRQ_STATUS, MDMA_yy_IRQ_STATUS Masks */
1444#define DMA_DONE 0x0001 /* DMA Completion Interrupt Status */
1445#define DMA_ERR 0x0002 /* DMA Error Interrupt Status */
1446#define DFETCH 0x0004 /* DMA Descriptor Fetch Indicator */
1447#define DMA_RUN 0x0008 /* DMA Channel Running Indicator */
1448
1449
1450/* ************ PARALLEL PERIPHERAL INTERFACE (PPI) MASKS *************/
1451/* PPI_CONTROL Masks */
1452#define PORT_EN 0x0001 /* PPI Port Enable */
1453#define PORT_DIR 0x0002 /* PPI Port Direction */
1454#define XFR_TYPE 0x000C /* PPI Transfer Type */
1455#define PORT_CFG 0x0030 /* PPI Port Configuration */
1456#define FLD_SEL 0x0040 /* PPI Active Field Select */
1457#define PACK_EN 0x0080 /* PPI Packing Mode */
1458#define DMA32 0x0100 /* PPI 32-bit DMA Enable */
1459#define SKIP_EN 0x0200 /* PPI Skip Element Enable */
1460#define SKIP_EO 0x0400 /* PPI Skip Even/Odd Elements */
1461#define DLEN_8 0x0000 /* Data Length = 8 Bits */
1462#define DLEN_10 0x0800 /* Data Length = 10 Bits */
1463#define DLEN_11 0x1000 /* Data Length = 11 Bits */
1464#define DLEN_12 0x1800 /* Data Length = 12 Bits */
1465#define DLEN_13 0x2000 /* Data Length = 13 Bits */
1466#define DLEN_14 0x2800 /* Data Length = 14 Bits */
1467#define DLEN_15 0x3000 /* Data Length = 15 Bits */
1468#define DLEN_16 0x3800 /* Data Length = 16 Bits */
1469#define DLENGTH 0x3800 /* PPI Data Length */
1470#define POLC 0x4000 /* PPI Clock Polarity */
1471#define POLS 0x8000 /* PPI Frame Sync Polarity */
1472
1473/* PPI_STATUS Masks */
1474#define FLD 0x0400 /* Field Indicator */
1475#define FT_ERR 0x0800 /* Frame Track Error */
1476#define OVR 0x1000 /* FIFO Overflow Error */
1477#define UNDR 0x2000 /* FIFO Underrun Error */
1478#define ERR_DET 0x4000 /* Error Detected Indicator */
1479#define ERR_NCOR 0x8000 /* Error Not Corrected Indicator */
1480
1481
1482/* ******************** TWO-WIRE INTERFACE (TWI) MASKS ***********************/
1483/* TWI_CLKDIV Macros (Use: *pTWI_CLKDIV = CLKLOW(x)|CLKHI(y); ) */
1484#define CLKLOW(x) ((x) & 0xFF) /* Periods Clock Is Held Low */
1485#define CLKHI(y) (((y)&0xFF)<<0x8) /* Periods Before New Clock Low */
1486
1487/* TWI_PRESCALE Masks */
1488#define PRESCALE 0x007F /* SCLKs Per Internal Time Reference (10MHz) */
1489#define TWI_ENA 0x0080 /* TWI Enable */
1490#define SCCB 0x0200 /* SCCB Compatibility Enable */
1491
1492/* TWI_SLAVE_CTRL Masks */
1493#define SEN 0x0001 /* Slave Enable */
1494#define SADD_LEN 0x0002 /* Slave Address Length */
1495#define STDVAL 0x0004 /* Slave Transmit Data Valid */
1496#define NAK 0x0008 /* NAK/ACK* Generated At Conclusion Of Transfer */
1497#define GEN 0x0010 /* General Call Adrress Matching Enabled */
1498
1499/* TWI_SLAVE_STAT Masks */
1500#define SDIR 0x0001 /* Slave Transfer Direction (Transmit/Receive*) */
1501#define GCALL 0x0002 /* General Call Indicator */
1502
1503/* TWI_MASTER_CTRL Masks */
1504#define MEN 0x0001 /* Master Mode Enable */
1505#define MADD_LEN 0x0002 /* Master Address Length */
1506#define MDIR 0x0004 /* Master Transmit Direction (RX/TX*) */
1507#define FAST 0x0008 /* Use Fast Mode Timing Specs */
1508#define STOP 0x0010 /* Issue Stop Condition */
1509#define RSTART 0x0020 /* Repeat Start or Stop* At End Of Transfer */
1510#define DCNT 0x3FC0 /* Data Bytes To Transfer */
1511#define SDAOVR 0x4000 /* Serial Data Override */
1512#define SCLOVR 0x8000 /* Serial Clock Override */
1513
1514/* TWI_MASTER_STAT Masks */
1515#define MPROG 0x0001 /* Master Transfer In Progress */
1516#define LOSTARB 0x0002 /* Lost Arbitration Indicator (Xfer Aborted) */
1517#define ANAK 0x0004 /* Address Not Acknowledged */
1518#define DNAK 0x0008 /* Data Not Acknowledged */
1519#define BUFRDERR 0x0010 /* Buffer Read Error */
1520#define BUFWRERR 0x0020 /* Buffer Write Error */
1521#define SDASEN 0x0040 /* Serial Data Sense */
1522#define SCLSEN 0x0080 /* Serial Clock Sense */
1523#define BUSBUSY 0x0100 /* Bus Busy Indicator */
1524
1525/* TWI_INT_SRC and TWI_INT_ENABLE Masks */
1526#define SINIT 0x0001 /* Slave Transfer Initiated */
1527#define SCOMP 0x0002 /* Slave Transfer Complete */
1528#define SERR 0x0004 /* Slave Transfer Error */
1529#define SOVF 0x0008 /* Slave Overflow */
1530#define MCOMP 0x0010 /* Master Transfer Complete */
1531#define MERR 0x0020 /* Master Transfer Error */
1532#define XMTSERV 0x0040 /* Transmit FIFO Service */
1533#define RCVSERV 0x0080 /* Receive FIFO Service */
1534
1535/* TWI_FIFO_CTRL Masks */
1536#define XMTFLUSH 0x0001 /* Transmit Buffer Flush */
1537#define RCVFLUSH 0x0002 /* Receive Buffer Flush */
1538#define XMTINTLEN 0x0004 /* Transmit Buffer Interrupt Length */
1539#define RCVINTLEN 0x0008 /* Receive Buffer Interrupt Length */
1540
1541/* TWI_FIFO_STAT Masks */
1542#define XMTSTAT 0x0003 /* Transmit FIFO Status */
1543#define XMT_EMPTY 0x0000 /* Transmit FIFO Empty */
1544#define XMT_HALF 0x0001 /* Transmit FIFO Has 1 Byte To Write */
1545#define XMT_FULL 0x0003 /* Transmit FIFO Full (2 Bytes To Write) */
1546
1547#define RCVSTAT 0x000C /* Receive FIFO Status */
1548#define RCV_EMPTY 0x0000 /* Receive FIFO Empty */
1549#define RCV_HALF 0x0004 /* Receive FIFO Has 1 Byte To Read */
1550#define RCV_FULL 0x000C /* Receive FIFO Full (2 Bytes To Read) */
1551
1552
1553/* ******************* PIN CONTROL REGISTER MASKS ************************/
1554/* PORT_MUX Masks */
1555#define PJSE 0x0001 /* Port J SPI/SPORT Enable */
1556#define PJSE_SPORT 0x0000 /* Enable TFS0/DT0PRI */
1557#define PJSE_SPI 0x0001 /* Enable SPI_SSEL3:2 */
1558
1559#define PJCE(x) (((x)&0x3)<<1) /* Port J CAN/SPI/SPORT Enable */
1560#define PJCE_SPORT 0x0000 /* Enable DR0SEC/DT0SEC */
1561#define PJCE_CAN 0x0002 /* Enable CAN RX/TX */
1562#define PJCE_SPI 0x0004 /* Enable SPI_SSEL7 */
1563
1564#define PFDE 0x0008 /* Port F DMA Request Enable */
1565#define PFDE_UART 0x0000 /* Enable UART0 RX/TX */
1566#define PFDE_DMA 0x0008 /* Enable DMAR1:0 */
1567
1568#define PFTE 0x0010 /* Port F Timer Enable */
1569#define PFTE_UART 0x0000 /* Enable UART1 RX/TX */
1570#define PFTE_TIMER 0x0010 /* Enable TMR7:6 */
1571
1572#define PFS6E 0x0020 /* Port F SPI SSEL 6 Enable */
1573#define PFS6E_TIMER 0x0000 /* Enable TMR5 */
1574#define PFS6E_SPI 0x0020 /* Enable SPI_SSEL6 */
1575
1576#define PFS5E 0x0040 /* Port F SPI SSEL 5 Enable */
1577#define PFS5E_TIMER 0x0000 /* Enable TMR4 */
1578#define PFS5E_SPI 0x0040 /* Enable SPI_SSEL5 */
1579
1580#define PFS4E 0x0080 /* Port F SPI SSEL 4 Enable */
1581#define PFS4E_TIMER 0x0000 /* Enable TMR3 */
1582#define PFS4E_SPI 0x0080 /* Enable SPI_SSEL4 */
1583
1584#define PFFE 0x0100 /* Port F PPI Frame Sync Enable */
1585#define PFFE_TIMER 0x0000 /* Enable TMR2 */
1586#define PFFE_PPI 0x0100 /* Enable PPI FS3 */
1587
1588#define PGSE 0x0200 /* Port G SPORT1 Secondary Enable */
1589#define PGSE_PPI 0x0000 /* Enable PPI D9:8 */
1590#define PGSE_SPORT 0x0200 /* Enable DR1SEC/DT1SEC */
1591
1592#define PGRE 0x0400 /* Port G SPORT1 Receive Enable */
1593#define PGRE_PPI 0x0000 /* Enable PPI D12:10 */
1594#define PGRE_SPORT 0x0400 /* Enable DR1PRI/RFS1/RSCLK1 */
1595
1596#define PGTE 0x0800 /* Port G SPORT1 Transmit Enable */
1597#define PGTE_PPI 0x0000 /* Enable PPI D15:13 */
1598#define PGTE_SPORT 0x0800 /* Enable DT1PRI/TFS1/TSCLK1 */
1599
1600
1601/* ****************** HANDSHAKE DMA (HDMA) MASKS *********************/
1602/* HDMAx_CTL Masks */
1603#define HMDMAEN 0x0001 /* Enable Handshake DMA 0/1 */
1604#define REP 0x0002 /* HDMA Request Polarity */
1605#define UTE 0x0004 /* Urgency Threshold Enable */
1606#define OIE 0x0010 /* Overflow Interrupt Enable */
1607#define BDIE 0x0020 /* Block Done Interrupt Enable */
1608#define MBDI 0x0040 /* Mask Block Done IRQ If Pending ECNT */
1609#define DRQ 0x0300 /* HDMA Request Type */
1610#define DRQ_NONE 0x0000 /* No Request */
1611#define DRQ_SINGLE 0x0100 /* Channels Request Single */
1612#define DRQ_MULTI 0x0200 /* Channels Request Multi (Default) */
1613#define DRQ_URGENT 0x0300 /* Channels Request Multi Urgent */
1614#define RBC 0x1000 /* Reload BCNT With IBCNT */
1615#define PS 0x2000 /* HDMA Pin Status */
1616#define OI 0x4000 /* Overflow Interrupt Generated */
1617#define BDI 0x8000 /* Block Done Interrupt Generated */
1618
1619/* entry addresses of the user-callable Boot ROM functions */
1620
1621#define _BOOTROM_RESET 0xEF000000
1622#define _BOOTROM_FINAL_INIT 0xEF000002
1623#define _BOOTROM_DO_MEMORY_DMA 0xEF000006
1624#define _BOOTROM_BOOT_DXE_FLASH 0xEF000008
1625#define _BOOTROM_BOOT_DXE_SPI 0xEF00000A
1626#define _BOOTROM_BOOT_DXE_TWI 0xEF00000C
1627#define _BOOTROM_GET_DXE_ADDRESS_FLASH 0xEF000010
1628#define _BOOTROM_GET_DXE_ADDRESS_SPI 0xEF000012
1629#define _BOOTROM_GET_DXE_ADDRESS_TWI 0xEF000014
1630
1631/* Alternate Deprecated Macros Provided For Backwards Code Compatibility */
1632#define PGDE_UART PFDE_UART
1633#define PGDE_DMA PFDE_DMA
1634#define CKELOW SCKELOW
1635
1636/* HOST Port Registers */
1637
1638#define HOST_CONTROL 0xffc03400 /* HOST Control Register */
1639#define HOST_STATUS 0xffc03404 /* HOST Status Register */
1640#define HOST_TIMEOUT 0xffc03408 /* HOST Acknowledge Mode Timeout Register */
1641
1642/* Counter Registers */
1643
1644#define CNT_CONFIG 0xffc03500 /* Configuration Register */
1645#define CNT_IMASK 0xffc03504 /* Interrupt Mask Register */
1646#define CNT_STATUS 0xffc03508 /* Status Register */
1647#define CNT_COMMAND 0xffc0350c /* Command Register */
1648#define CNT_DEBOUNCE 0xffc03510 /* Debounce Register */
1649#define CNT_COUNTER 0xffc03514 /* Counter Register */
1650#define CNT_MAX 0xffc03518 /* Maximal Count Register */
1651#define CNT_MIN 0xffc0351c /* Minimal Count Register */
1652
1653/* OTP/FUSE Registers */
1654
1655#define OTP_CONTROL 0xffc03600 /* OTP/Fuse Control Register */
1656#define OTP_BEN 0xffc03604 /* OTP/Fuse Byte Enable */
1657#define OTP_STATUS 0xffc03608 /* OTP/Fuse Status */
1658#define OTP_TIMING 0xffc0360c /* OTP/Fuse Access Timing */
1659
1660/* Security Registers */
1661
1662#define SECURE_SYSSWT 0xffc03620 /* Secure System Switches */
1663#define SECURE_CONTROL 0xffc03624 /* Secure Control */
1664#define SECURE_STATUS 0xffc03628 /* Secure Status */
1665
1666/* OTP Read/Write Data Buffer Registers */
1667
1668#define OTP_DATA0 0xffc03680 /* OTP/Fuse Data (OTP_DATA0-3) accesses the fuse read write buffer */
1669#define OTP_DATA1 0xffc03684 /* OTP/Fuse Data (OTP_DATA0-3) accesses the fuse read write buffer */
1670#define OTP_DATA2 0xffc03688 /* OTP/Fuse Data (OTP_DATA0-3) accesses the fuse read write buffer */
1671#define OTP_DATA3 0xffc0368c /* OTP/Fuse Data (OTP_DATA0-3) accesses the fuse read write buffer */
1672
1673/* Motor Control PWM Registers */
1674
1675#define PWM_CTRL 0xffc03700 /* PWM Control Register */
1676#define PWM_STAT 0xffc03704 /* PWM Status Register */
1677#define PWM_TM 0xffc03708 /* PWM Period Register */
1678#define PWM_DT 0xffc0370c /* PWM Dead Time Register */
1679#define PWM_GATE 0xffc03710 /* PWM Chopping Control */
1680#define PWM_CHA 0xffc03714 /* PWM Channel A Duty Control */
1681#define PWM_CHB 0xffc03718 /* PWM Channel B Duty Control */
1682#define PWM_CHC 0xffc0371c /* PWM Channel C Duty Control */
1683#define PWM_SEG 0xffc03720 /* PWM Crossover and Output Enable */
1684#define PWM_SYNCWT 0xffc03724 /* PWM Sync Pluse Width Control */
1685#define PWM_CHAL 0xffc03728 /* PWM Channel AL Duty Control (SR mode only) */
1686#define PWM_CHBL 0xffc0372c /* PWM Channel BL Duty Control (SR mode only) */
1687#define PWM_CHCL 0xffc03730 /* PWM Channel CL Duty Control (SR mode only) */
1688#define PWM_LSI 0xffc03734 /* PWM Low Side Invert (SR mode only) */
1689#define PWM_STAT2 0xffc03738 /* PWM Status Register 2 */
1690
1691
1692/* ********************************************************** */
1693/* SINGLE BIT MACRO PAIRS (bit mask and negated one) */
1694/* and MULTI BIT READ MACROS */
1695/* ********************************************************** */
1696
1697/* Bit masks for HOST_CONTROL */
1698
1699#define HOST_CNTR_HOST_EN 0x1 /* Host Enable */
1700#define HOST_CNTR_nHOST_EN 0x0
1701#define HOST_CNTR_HOST_END 0x2 /* Host Endianess */
1702#define HOST_CNTR_nHOST_END 0x0
1703#define HOST_CNTR_DATA_SIZE 0x4 /* Data Size */
1704#define HOST_CNTR_nDATA_SIZE 0x0
1705#define HOST_CNTR_HOST_RST 0x8 /* Host Reset */
1706#define HOST_CNTR_nHOST_RST 0x0
1707#define HOST_CNTR_HRDY_OVR 0x20 /* Host Ready Override */
1708#define HOST_CNTR_nHRDY_OVR 0x0
1709#define HOST_CNTR_INT_MODE 0x40 /* Interrupt Mode */
1710#define HOST_CNTR_nINT_MODE 0x0
1711#define HOST_CNTR_BT_EN 0x80 /* Bus Timeout Enable */
1712#define HOST_CNTR_ nBT_EN 0x0
1713#define HOST_CNTR_EHW 0x100 /* Enable Host Write */
1714#define HOST_CNTR_nEHW 0x0
1715#define HOST_CNTR_EHR 0x200 /* Enable Host Read */
1716#define HOST_CNTR_nEHR 0x0
1717#define HOST_CNTR_BDR 0x400 /* Burst DMA Requests */
1718#define HOST_CNTR_nBDR 0x0
1719
1720/* Bit masks for HOST_STATUS */
1721
1722#define HOST_STAT_READY 0x1 /* DMA Ready */
1723#define HOST_STAT_nREADY 0x0
1724#define HOST_STAT_FIFOFULL 0x2 /* FIFO Full */
1725#define HOST_STAT_nFIFOFULL 0x0
1726#define HOST_STAT_FIFOEMPTY 0x4 /* FIFO Empty */
1727#define HOST_STAT_nFIFOEMPTY 0x0
1728#define HOST_STAT_COMPLETE 0x8 /* DMA Complete */
1729#define HOST_STAT_nCOMPLETE 0x0
1730#define HOST_STAT_HSHK 0x10 /* Host Handshake */
1731#define HOST_STAT_nHSHK 0x0
1732#define HOST_STAT_TIMEOUT 0x20 /* Host Timeout */
1733#define HOST_STAT_nTIMEOUT 0x0
1734#define HOST_STAT_HIRQ 0x40 /* Host Interrupt Request */
1735#define HOST_STAT_nHIRQ 0x0
1736#define HOST_STAT_ALLOW_CNFG 0x80 /* Allow New Configuration */
1737#define HOST_STAT_nALLOW_CNFG 0x0
1738#define HOST_STAT_DMA_DIR 0x100 /* DMA Direction */
1739#define HOST_STAT_nDMA_DIR 0x0
1740#define HOST_STAT_BTE 0x200 /* Bus Timeout Enabled */
1741#define HOST_STAT_nBTE 0x0
1742#define HOST_STAT_HOSTRD_DONE 0x8000 /* Host Read Completion Interrupt */
1743#define HOST_STAT_nHOSTRD_DONE 0x0
1744
1745/* Bit masks for HOST_TIMEOUT */
1746
1747#define HOST_COUNT_TIMEOUT 0x7ff /* Host Timeout count */
1748
1749/* Bit masks for CNT_CONFIG */
1750
1751#define CNTE 0x1 /* Counter Enable */
1752#define nCNTE 0x0
1753#define DEBE 0x2 /* Debounce Enable */
1754#define nDEBE 0x0
1755#define CDGINV 0x10 /* CDG Pin Polarity Invert */
1756#define nCDGINV 0x0
1757#define CUDINV 0x20 /* CUD Pin Polarity Invert */
1758#define nCUDINV 0x0
1759#define CZMINV 0x40 /* CZM Pin Polarity Invert */
1760#define nCZMINV 0x0
1761#define CNTMODE 0x700 /* Counter Operating Mode */
1762#define ZMZC 0x800 /* CZM Zeroes Counter Enable */
1763#define nZMZC 0x0
1764#define BNDMODE 0x3000 /* Boundary register Mode */
1765#define INPDIS 0x8000 /* CUG and CDG Input Disable */
1766#define nINPDIS 0x0
1767
1768/* Bit masks for CNT_IMASK */
1769
1770#define ICIE 0x1 /* Illegal Gray/Binary Code Interrupt Enable */
1771#define nICIE 0x0
1772#define UCIE 0x2 /* Up count Interrupt Enable */
1773#define nUCIE 0x0
1774#define DCIE 0x4 /* Down count Interrupt Enable */
1775#define nDCIE 0x0
1776#define MINCIE 0x8 /* Min Count Interrupt Enable */
1777#define nMINCIE 0x0
1778#define MAXCIE 0x10 /* Max Count Interrupt Enable */
1779#define nMAXCIE 0x0
1780#define COV31IE 0x20 /* Bit 31 Overflow Interrupt Enable */
1781#define nCOV31IE 0x0
1782#define COV15IE 0x40 /* Bit 15 Overflow Interrupt Enable */
1783#define nCOV15IE 0x0
1784#define CZEROIE 0x80 /* Count to Zero Interrupt Enable */
1785#define nCZEROIE 0x0
1786#define CZMIE 0x100 /* CZM Pin Interrupt Enable */
1787#define nCZMIE 0x0
1788#define CZMEIE 0x200 /* CZM Error Interrupt Enable */
1789#define nCZMEIE 0x0
1790#define CZMZIE 0x400 /* CZM Zeroes Counter Interrupt Enable */
1791#define nCZMZIE 0x0
1792
1793/* Bit masks for CNT_STATUS */
1794
1795#define ICII 0x1 /* Illegal Gray/Binary Code Interrupt Identifier */
1796#define nICII 0x0
1797#define UCII 0x2 /* Up count Interrupt Identifier */
1798#define nUCII 0x0
1799#define DCII 0x4 /* Down count Interrupt Identifier */
1800#define nDCII 0x0
1801#define MINCII 0x8 /* Min Count Interrupt Identifier */
1802#define nMINCII 0x0
1803#define MAXCII 0x10 /* Max Count Interrupt Identifier */
1804#define nMAXCII 0x0
1805#define COV31II 0x20 /* Bit 31 Overflow Interrupt Identifier */
1806#define nCOV31II 0x0
1807#define COV15II 0x40 /* Bit 15 Overflow Interrupt Identifier */
1808#define nCOV15II 0x0
1809#define CZEROII 0x80 /* Count to Zero Interrupt Identifier */
1810#define nCZEROII 0x0
1811#define CZMII 0x100 /* CZM Pin Interrupt Identifier */
1812#define nCZMII 0x0
1813#define CZMEII 0x200 /* CZM Error Interrupt Identifier */
1814#define nCZMEII 0x0
1815#define CZMZII 0x400 /* CZM Zeroes Counter Interrupt Identifier */
1816#define nCZMZII 0x0
1817
1818/* Bit masks for CNT_COMMAND */
1819
1820#define W1LCNT 0xf /* Load Counter Register */
1821#define W1LMIN 0xf0 /* Load Min Register */
1822#define W1LMAX 0xf00 /* Load Max Register */
1823#define W1ZMONCE 0x1000 /* Enable CZM Clear Counter Once */
1824#define nW1ZMONCE 0x0
1825
1826/* Bit masks for CNT_DEBOUNCE */
1827
1828#define DPRESCALE 0xf /* Load Counter Register */
1829
1830/* CNT_COMMAND bit field options */
1831
1832#define W1LCNT_ZERO 0x0001 /* write 1 to load CNT_COUNTER with zero */
1833#define W1LCNT_MIN 0x0004 /* write 1 to load CNT_COUNTER from CNT_MIN */
1834#define W1LCNT_MAX 0x0008 /* write 1 to load CNT_COUNTER from CNT_MAX */
1835
1836#define W1LMIN_ZERO 0x0010 /* write 1 to load CNT_MIN with zero */
1837#define W1LMIN_CNT 0x0020 /* write 1 to load CNT_MIN from CNT_COUNTER */
1838#define W1LMIN_MAX 0x0080 /* write 1 to load CNT_MIN from CNT_MAX */
1839
1840#define W1LMAX_ZERO 0x0100 /* write 1 to load CNT_MAX with zero */
1841#define W1LMAX_CNT 0x0200 /* write 1 to load CNT_MAX from CNT_COUNTER */
1842#define W1LMAX_MIN 0x0400 /* write 1 to load CNT_MAX from CNT_MIN */
1843
1844/* CNT_CONFIG bit field options */
1845
1846#define CNTMODE_QUADENC 0x0000 /* quadrature encoder mode */
1847#define CNTMODE_BINENC 0x0100 /* binary encoder mode */
1848#define CNTMODE_UDCNT 0x0200 /* up/down counter mode */
1849#define CNTMODE_DIRCNT 0x0400 /* direction counter mode */
1850#define CNTMODE_DIRTMR 0x0500 /* direction timer mode */
1851
1852#define BNDMODE_COMP 0x0000 /* boundary compare mode */
1853#define BNDMODE_ZERO 0x1000 /* boundary compare and zero mode */
1854#define BNDMODE_CAPT 0x2000 /* boundary capture mode */
1855#define BNDMODE_AEXT 0x3000 /* boundary auto-extend mode */
1856
1857/* Bit masks for OTP_CONTROL */
1858
1859#define FUSE_FADDR 0x1ff /* OTP/Fuse Address */
1860#define FIEN 0x800 /* OTP/Fuse Interrupt Enable */
1861#define nFIEN 0x0
1862#define FTESTDEC 0x1000 /* OTP/Fuse Test Decoder */
1863#define nFTESTDEC 0x0
1864#define FWRTEST 0x2000 /* OTP/Fuse Write Test */
1865#define nFWRTEST 0x0
1866#define FRDEN 0x4000 /* OTP/Fuse Read Enable */
1867#define nFRDEN 0x0
1868#define FWREN 0x8000 /* OTP/Fuse Write Enable */
1869#define nFWREN 0x0
1870
1871/* Bit masks for OTP_BEN */
1872
1873#define FBEN 0xffff /* OTP/Fuse Byte Enable */
1874
1875/* Bit masks for OTP_STATUS */
1876
1877#define FCOMP 0x1 /* OTP/Fuse Access Complete */
1878#define nFCOMP 0x0
1879#define FERROR 0x2 /* OTP/Fuse Access Error */
1880#define nFERROR 0x0
1881#define MMRGLOAD 0x10 /* Memory Mapped Register Gasket Load */
1882#define nMMRGLOAD 0x0
1883#define MMRGLOCK 0x20 /* Memory Mapped Register Gasket Lock */
1884#define nMMRGLOCK 0x0
1885#define FPGMEN 0x40 /* OTP/Fuse Program Enable */
1886#define nFPGMEN 0x0
1887
1888/* Bit masks for OTP_TIMING */
1889
1890#define USECDIV 0xff /* Micro Second Divider */
1891#define READACC 0x7f00 /* Read Access Time */
1892#define CPUMPRL 0x38000 /* Charge Pump Release Time */
1893#define CPUMPSU 0xc0000 /* Charge Pump Setup Time */
1894#define CPUMPHD 0xf00000 /* Charge Pump Hold Time */
1895#define PGMTIME 0xff000000 /* Program Time */
1896
1897/* Bit masks for SECURE_SYSSWT */
1898
1899#define EMUDABL 0x1 /* Emulation Disable. */
1900#define nEMUDABL 0x0
1901#define RSTDABL 0x2 /* Reset Disable */
1902#define nRSTDABL 0x0
1903#define L1IDABL 0x1c /* L1 Instruction Memory Disable. */
1904#define L1DADABL 0xe0 /* L1 Data Bank A Memory Disable. */
1905#define L1DBDABL 0x700 /* L1 Data Bank B Memory Disable. */
1906#define DMA0OVR 0x800 /* DMA0 Memory Access Override */
1907#define nDMA0OVR 0x0
1908#define DMA1OVR 0x1000 /* DMA1 Memory Access Override */
1909#define nDMA1OVR 0x0
1910#define EMUOVR 0x4000 /* Emulation Override */
1911#define nEMUOVR 0x0
1912#define OTPSEN 0x8000 /* OTP Secrets Enable. */
1913#define nOTPSEN 0x0
1914#define L2DABL 0x70000 /* L2 Memory Disable. */
1915
1916/* Bit masks for SECURE_CONTROL */
1917
1918#define SECURE0 0x1 /* SECURE 0 */
1919#define nSECURE0 0x0
1920#define SECURE1 0x2 /* SECURE 1 */
1921#define nSECURE1 0x0
1922#define SECURE2 0x4 /* SECURE 2 */
1923#define nSECURE2 0x0
1924#define SECURE3 0x8 /* SECURE 3 */
1925#define nSECURE3 0x0
1926
1927/* Bit masks for SECURE_STATUS */
1928
1929#define SECMODE 0x3 /* Secured Mode Control State */
1930#define NMI 0x4 /* Non Maskable Interrupt */
1931#define nNMI 0x0
1932#define AFVALID 0x8 /* Authentication Firmware Valid */
1933#define nAFVALID 0x0
1934#define AFEXIT 0x10 /* Authentication Firmware Exit */
1935#define nAFEXIT 0x0
1936#define SECSTAT 0xe0 /* Secure Status */
1937
1938
1939
1940#endif /* _DEF_BF51X_H */
diff --git a/arch/blackfin/mach-bf518/include/mach/dma.h b/arch/blackfin/mach-bf518/include/mach/dma.h
new file mode 100644
index 000000000000..bbd33c1706e2
--- /dev/null
+++ b/arch/blackfin/mach-bf518/include/mach/dma.h
@@ -0,0 +1,33 @@
1/* mach/dma.h - arch-specific DMA defines
2 *
3 * Copyright 2004-2008 Analog Devices Inc.
4 *
5 * Licensed under the GPL-2 or later.
6 */
7
8#ifndef _MACH_DMA_H_
9#define _MACH_DMA_H_
10
11#define MAX_DMA_CHANNELS 16
12
13#define CH_PPI 0 /* PPI receive/transmit */
14#define CH_EMAC_RX 1 /* Ethernet MAC receive */
15#define CH_EMAC_TX 2 /* Ethernet MAC transmit */
16#define CH_SPORT0_RX 3 /* SPORT0 receive */
17#define CH_SPORT0_TX 4 /* SPORT0 transmit */
18#define CH_RSI 4 /* RSI */
19#define CH_SPORT1_RX 5 /* SPORT1 receive */
20#define CH_SPI1 5 /* SPI1 transmit/receive */
21#define CH_SPORT1_TX 6 /* SPORT1 transmit */
22#define CH_SPI0 7 /* SPI0 transmit/receive */
23#define CH_UART0_RX 8 /* UART0 receive */
24#define CH_UART0_TX 9 /* UART0 transmit */
25#define CH_UART1_RX 10 /* UART1 receive */
26#define CH_UART1_TX 11 /* UART1 transmit */
27
28#define CH_MEM_STREAM0_SRC 12 /* RX */
29#define CH_MEM_STREAM0_DEST 13 /* TX */
30#define CH_MEM_STREAM1_SRC 14 /* RX */
31#define CH_MEM_STREAM1_DEST 15 /* TX */
32
33#endif
diff --git a/arch/blackfin/mach-bf518/include/mach/gpio.h b/arch/blackfin/mach-bf518/include/mach/gpio.h
new file mode 100644
index 000000000000..9757683c3948
--- /dev/null
+++ b/arch/blackfin/mach-bf518/include/mach/gpio.h
@@ -0,0 +1,60 @@
1/*
2 * File: arch/blackfin/mach-bf518/include/mach/gpio.h
3 * Bugs: Enter bugs at http://blackfin.uclinux.org/
4 *
5 * Copyright (C) 2008 Analog Devices Inc.
6 * Licensed under the GPL-2 or later.
7 */
8
9
10#ifndef _MACH_GPIO_H_
11#define _MACH_GPIO_H_
12
13#define MAX_BLACKFIN_GPIOS 40
14
15#define GPIO_PF0 0
16#define GPIO_PF1 1
17#define GPIO_PF2 2
18#define GPIO_PF3 3
19#define GPIO_PF4 4
20#define GPIO_PF5 5
21#define GPIO_PF6 6
22#define GPIO_PF7 7
23#define GPIO_PF8 8
24#define GPIO_PF9 9
25#define GPIO_PF10 10
26#define GPIO_PF11 11
27#define GPIO_PF12 12
28#define GPIO_PF13 13
29#define GPIO_PF14 14
30#define GPIO_PF15 15
31#define GPIO_PG0 16
32#define GPIO_PG1 17
33#define GPIO_PG2 18
34#define GPIO_PG3 19
35#define GPIO_PG4 20
36#define GPIO_PG5 21
37#define GPIO_PG6 22
38#define GPIO_PG7 23
39#define GPIO_PG8 24
40#define GPIO_PG9 25
41#define GPIO_PG10 26
42#define GPIO_PG11 27
43#define GPIO_PG12 28
44#define GPIO_PG13 29
45#define GPIO_PG14 30
46#define GPIO_PG15 31
47#define GPIO_PH0 32
48#define GPIO_PH1 33
49#define GPIO_PH2 34
50#define GPIO_PH3 35
51#define GPIO_PH4 36
52#define GPIO_PH5 37
53#define GPIO_PH6 38
54#define GPIO_PH7 39
55
56#define PORT_F GPIO_PF0
57#define PORT_G GPIO_PG0
58#define PORT_H GPIO_PH0
59
60#endif /* _MACH_GPIO_H_ */
diff --git a/arch/blackfin/mach-bf518/include/mach/irq.h b/arch/blackfin/mach-bf518/include/mach/irq.h
new file mode 100644
index 000000000000..3ff0f093313d
--- /dev/null
+++ b/arch/blackfin/mach-bf518/include/mach/irq.h
@@ -0,0 +1,260 @@
1/*
2 * file: include/asm-blackfin/mach-bf518/irq.h
3 * based on: include/asm-blackfin/mach-bf527/irq.h
4 * author: Michael Hennerich (michael.hennerich@analog.com)
5 *
6 * created:
7 * description:
8 * system mmr register map
9 * rev:
10 *
11 * modified:
12 *
13 *
14 * bugs: enter bugs at http://blackfin.uclinux.org/
15 *
16 * this program is free software; you can redistribute it and/or modify
17 * it under the terms of the gnu general public license as published by
18 * the free software foundation; either version 2, or (at your option)
19 * any later version.
20 *
21 * this program is distributed in the hope that it will be useful,
22 * but without any warranty; without even the implied warranty of
23 * merchantability or fitness for a particular purpose. see the
24 * gnu general public license for more details.
25 *
26 * you should have received a copy of the gnu general public license
27 * along with this program; see the file copying.
28 * if not, write to the free software foundation,
29 * 59 temple place - suite 330, boston, ma 02111-1307, usa.
30 */
31
32#ifndef _BF518_IRQ_H_
33#define _BF518_IRQ_H_
34
35/*
36 * Interrupt source definitions
37 Event Source Core Event Name
38 Core Emulation **
39 Events (highest priority) EMU 0
40 Reset RST 1
41 NMI NMI 2
42 Exception EVX 3
43 Reserved -- 4
44 Hardware Error IVHW 5
45 Core Timer IVTMR 6 *
46
47 .....
48
49 Software Interrupt 1 IVG14 31
50 Software Interrupt 2 --
51 (lowest priority) IVG15 32 *
52*/
53
54#define NR_PERI_INTS (2 * 32)
55
56/* The ABSTRACT IRQ definitions */
57/** the first seven of the following are fixed, the rest you change if you need to **/
58#define IRQ_EMU 0 /* Emulation */
59#define IRQ_RST 1 /* reset */
60#define IRQ_NMI 2 /* Non Maskable */
61#define IRQ_EVX 3 /* Exception */
62#define IRQ_UNUSED 4 /* - unused interrupt */
63#define IRQ_HWERR 5 /* Hardware Error */
64#define IRQ_CORETMR 6 /* Core timer */
65
66#define BFIN_IRQ(x) ((x) + 7)
67
68#define IRQ_PLL_WAKEUP BFIN_IRQ(0) /* PLL Wakeup Interrupt */
69#define IRQ_DMA0_ERROR BFIN_IRQ(1) /* DMA Error 0 (generic) */
70#define IRQ_DMAR0_BLK BFIN_IRQ(2) /* DMAR0 Block Interrupt */
71#define IRQ_DMAR1_BLK BFIN_IRQ(3) /* DMAR1 Block Interrupt */
72#define IRQ_DMAR0_OVR BFIN_IRQ(4) /* DMAR0 Overflow Error */
73#define IRQ_DMAR1_OVR BFIN_IRQ(5) /* DMAR1 Overflow Error */
74#define IRQ_PPI_ERROR BFIN_IRQ(6) /* PPI Error */
75#define IRQ_MAC_ERROR BFIN_IRQ(7) /* MAC Status */
76#define IRQ_SPORT0_ERROR BFIN_IRQ(8) /* SPORT0 Status */
77#define IRQ_SPORT1_ERROR BFIN_IRQ(9) /* SPORT1 Status */
78#define IRQ_PTP_ERROR BFIN_IRQ(10) /* PTP Error Interrupt */
79#define IRQ_UART0_ERROR BFIN_IRQ(12) /* UART0 Status */
80#define IRQ_UART1_ERROR BFIN_IRQ(13) /* UART1 Status */
81#define IRQ_RTC BFIN_IRQ(14) /* RTC */
82#define IRQ_PPI BFIN_IRQ(15) /* DMA Channel 0 (PPI) */
83#define IRQ_SPORT0_RX BFIN_IRQ(16) /* DMA 3 Channel (SPORT0 RX) */
84#define IRQ_SPORT0_TX BFIN_IRQ(17) /* DMA 4 Channel (SPORT0 TX) */
85#define IRQ_RSI BFIN_IRQ(17) /* DMA 4 Channel (RSI) */
86#define IRQ_SPORT1_RX BFIN_IRQ(18) /* DMA 5 Channel (SPORT1 RX/SPI) */
87#define IRQ_SPI1 BFIN_IRQ(18) /* DMA 5 Channel (SPI1) */
88#define IRQ_SPORT1_TX BFIN_IRQ(19) /* DMA 6 Channel (SPORT1 TX) */
89#define IRQ_TWI BFIN_IRQ(20) /* TWI */
90#define IRQ_SPI0 BFIN_IRQ(21) /* DMA 7 Channel (SPI0) */
91#define IRQ_UART0_RX BFIN_IRQ(22) /* DMA8 Channel (UART0 RX) */
92#define IRQ_UART0_TX BFIN_IRQ(23) /* DMA9 Channel (UART0 TX) */
93#define IRQ_UART1_RX BFIN_IRQ(24) /* DMA10 Channel (UART1 RX) */
94#define IRQ_UART1_TX BFIN_IRQ(25) /* DMA11 Channel (UART1 TX) */
95#define IRQ_OPTSEC BFIN_IRQ(26) /* OTPSEC Interrupt */
96#define IRQ_CNT BFIN_IRQ(27) /* GP Counter */
97#define IRQ_MAC_RX BFIN_IRQ(28) /* DMA1 Channel (MAC RX) */
98#define IRQ_PORTH_INTA BFIN_IRQ(29) /* Port H Interrupt A */
99#define IRQ_MAC_TX BFIN_IRQ(30) /* DMA2 Channel (MAC TX) */
100#define IRQ_PORTH_INTB BFIN_IRQ(31) /* Port H Interrupt B */
101#define IRQ_TIMER0 BFIN_IRQ(32) /* Timer 0 */
102#define IRQ_TIMER1 BFIN_IRQ(33) /* Timer 1 */
103#define IRQ_TIMER2 BFIN_IRQ(34) /* Timer 2 */
104#define IRQ_TIMER3 BFIN_IRQ(35) /* Timer 3 */
105#define IRQ_TIMER4 BFIN_IRQ(36) /* Timer 4 */
106#define IRQ_TIMER5 BFIN_IRQ(37) /* Timer 5 */
107#define IRQ_TIMER6 BFIN_IRQ(38) /* Timer 6 */
108#define IRQ_TIMER7 BFIN_IRQ(39) /* Timer 7 */
109#define IRQ_PORTG_INTA BFIN_IRQ(40) /* Port G Interrupt A */
110#define IRQ_PORTG_INTB BFIN_IRQ(41) /* Port G Interrupt B */
111#define IRQ_MEM_DMA0 BFIN_IRQ(42) /* MDMA Stream 0 */
112#define IRQ_MEM_DMA1 BFIN_IRQ(43) /* MDMA Stream 1 */
113#define IRQ_WATCH BFIN_IRQ(44) /* Software Watchdog Timer */
114#define IRQ_PORTF_INTA BFIN_IRQ(45) /* Port F Interrupt A */
115#define IRQ_PORTF_INTB BFIN_IRQ(46) /* Port F Interrupt B */
116#define IRQ_SPI0_ERROR BFIN_IRQ(47) /* SPI0 Status */
117#define IRQ_SPI1_ERROR BFIN_IRQ(48) /* SPI1 Error */
118#define IRQ_RSI_INT0 BFIN_IRQ(51) /* RSI Interrupt0 */
119#define IRQ_RSI_INT1 BFIN_IRQ(52) /* RSI Interrupt1 */
120#define IRQ_PWM_TRIP BFIN_IRQ(53) /* PWM Trip Interrupt */
121#define IRQ_PWM_SYNC BFIN_IRQ(54) /* PWM Sync Interrupt */
122#define IRQ_PTP_STAT BFIN_IRQ(55) /* PTP Stat Interrupt */
123
124#define SYS_IRQS BFIN_IRQ(63) /* 70 */
125
126#define IRQ_PF0 71
127#define IRQ_PF1 72
128#define IRQ_PF2 73
129#define IRQ_PF3 74
130#define IRQ_PF4 75
131#define IRQ_PF5 76
132#define IRQ_PF6 77
133#define IRQ_PF7 78
134#define IRQ_PF8 79
135#define IRQ_PF9 80
136#define IRQ_PF10 81
137#define IRQ_PF11 82
138#define IRQ_PF12 83
139#define IRQ_PF13 84
140#define IRQ_PF14 85
141#define IRQ_PF15 86
142
143#define IRQ_PG0 87
144#define IRQ_PG1 88
145#define IRQ_PG2 89
146#define IRQ_PG3 90
147#define IRQ_PG4 91
148#define IRQ_PG5 92
149#define IRQ_PG6 93
150#define IRQ_PG7 94
151#define IRQ_PG8 95
152#define IRQ_PG9 96
153#define IRQ_PG10 97
154#define IRQ_PG11 98
155#define IRQ_PG12 99
156#define IRQ_PG13 100
157#define IRQ_PG14 101
158#define IRQ_PG15 102
159
160#define IRQ_PH0 103
161#define IRQ_PH1 104
162#define IRQ_PH2 105
163#define IRQ_PH3 106
164#define IRQ_PH4 107
165#define IRQ_PH5 108
166#define IRQ_PH6 109
167#define IRQ_PH7 110
168#define IRQ_PH8 111
169#define IRQ_PH9 112
170#define IRQ_PH10 113
171#define IRQ_PH11 114
172#define IRQ_PH12 115
173#define IRQ_PH13 116
174#define IRQ_PH14 117
175#define IRQ_PH15 118
176
177#define GPIO_IRQ_BASE IRQ_PF0
178
179#define NR_IRQS (IRQ_PH15 + 1)
180
181#define IVG7 7
182#define IVG8 8
183#define IVG9 9
184#define IVG10 10
185#define IVG11 11
186#define IVG12 12
187#define IVG13 13
188#define IVG14 14
189#define IVG15 15
190
191/* IAR0 BIT FIELDS */
192#define IRQ_PLL_WAKEUP_POS 0
193#define IRQ_DMA0_ERROR_POS 4
194#define IRQ_DMAR0_BLK_POS 8
195#define IRQ_DMAR1_BLK_POS 12
196#define IRQ_DMAR0_OVR_POS 16
197#define IRQ_DMAR1_OVR_POS 20
198#define IRQ_PPI_ERROR_POS 24
199#define IRQ_MAC_ERROR_POS 28
200
201/* IAR1 BIT FIELDS */
202#define IRQ_SPORT0_ERROR_POS 0
203#define IRQ_SPORT1_ERROR_POS 4
204#define IRQ_PTP_ERROR_POS 8
205#define IRQ_UART0_ERROR_POS 16
206#define IRQ_UART1_ERROR_POS 20
207#define IRQ_RTC_POS 24
208#define IRQ_PPI_POS 28
209
210/* IAR2 BIT FIELDS */
211#define IRQ_SPORT0_RX_POS 0
212#define IRQ_SPORT0_TX_POS 4
213#define IRQ_RSI_POS 4
214#define IRQ_SPORT1_RX_POS 8
215#define IRQ_SPI1_POS 8
216#define IRQ_SPORT1_TX_POS 12
217#define IRQ_TWI_POS 16
218#define IRQ_SPI0_POS 20
219#define IRQ_UART0_RX_POS 24
220#define IRQ_UART0_TX_POS 28
221
222/* IAR3 BIT FIELDS */
223#define IRQ_UART1_RX_POS 0
224#define IRQ_UART1_TX_POS 4
225#define IRQ_OPTSEC_POS 8
226#define IRQ_CNT_POS 12
227#define IRQ_MAC_RX_POS 16
228#define IRQ_PORTH_INTA_POS 20
229#define IRQ_MAC_TX_POS 24
230#define IRQ_PORTH_INTB_POS 28
231
232/* IAR4 BIT FIELDS */
233#define IRQ_TIMER0_POS 0
234#define IRQ_TIMER1_POS 4
235#define IRQ_TIMER2_POS 8
236#define IRQ_TIMER3_POS 12
237#define IRQ_TIMER4_POS 16
238#define IRQ_TIMER5_POS 20
239#define IRQ_TIMER6_POS 24
240#define IRQ_TIMER7_POS 28
241
242/* IAR5 BIT FIELDS */
243#define IRQ_PORTG_INTA_POS 0
244#define IRQ_PORTG_INTB_POS 4
245#define IRQ_MEM_DMA0_POS 8
246#define IRQ_MEM_DMA1_POS 12
247#define IRQ_WATCH_POS 16
248#define IRQ_PORTF_INTA_POS 20
249#define IRQ_PORTF_INTB_POS 24
250#define IRQ_SPI0_ERROR_POS 28
251
252/* IAR6 BIT FIELDS */
253#define IRQ_SPI1_ERROR_POS 0
254#define IRQ_RSI_INT0_POS 12
255#define IRQ_RSI_INT1_POS 16
256#define IRQ_PWM_TRIP_POS 20
257#define IRQ_PWM_SYNC_POS 24
258#define IRQ_PTP_STAT_POS 28
259
260#endif /* _BF518_IRQ_H_ */
diff --git a/arch/blackfin/mach-bf518/include/mach/mem_map.h b/arch/blackfin/mach-bf518/include/mach/mem_map.h
new file mode 100644
index 000000000000..62bcc781bfaa
--- /dev/null
+++ b/arch/blackfin/mach-bf518/include/mach/mem_map.h
@@ -0,0 +1,108 @@
1/*
2 * file: include/asm-blackfin/mach-bf518/mem_map.h
3 * based on: include/asm-blackfin/mach-bf527/mem_map.h
4 * author: Bryan Wu <cooloney@kernel.org>
5 *
6 * created:
7 * description:
8 * Memory MAP Common header file for blackfin BF518/6/4/2 of processors.
9 * rev:
10 *
11 * modified:
12 *
13 * bugs: enter bugs at http://blackfin.uclinux.org/
14 *
15 * this program is free software; you can redistribute it and/or modify
16 * it under the terms of the gnu general public license as published by
17 * the free software foundation; either version 2, or (at your option)
18 * any later version.
19 *
20 * this program is distributed in the hope that it will be useful,
21 * but without any warranty; without even the implied warranty of
22 * merchantability or fitness for a particular purpose. see the
23 * gnu general public license for more details.
24 *
25 * you should have received a copy of the gnu general public license
26 * along with this program; see the file copying.
27 * if not, write to the free software foundation,
28 * 59 temple place - suite 330, boston, ma 02111-1307, usa.
29 */
30
31#ifndef _MEM_MAP_518_H_
32#define _MEM_MAP_518_H_
33
34#define COREMMR_BASE 0xFFE00000 /* Core MMRs */
35#define SYSMMR_BASE 0xFFC00000 /* System MMRs */
36
37/* Async Memory Banks */
38#define ASYNC_BANK3_BASE 0x20300000 /* Async Bank 3 */
39#define ASYNC_BANK3_SIZE 0x00100000 /* 1M */
40#define ASYNC_BANK2_BASE 0x20200000 /* Async Bank 2 */
41#define ASYNC_BANK2_SIZE 0x00100000 /* 1M */
42#define ASYNC_BANK1_BASE 0x20100000 /* Async Bank 1 */
43#define ASYNC_BANK1_SIZE 0x00100000 /* 1M */
44#define ASYNC_BANK0_BASE 0x20000000 /* Async Bank 0 */
45#define ASYNC_BANK0_SIZE 0x00100000 /* 1M */
46
47/* Boot ROM Memory */
48
49#define BOOT_ROM_START 0xEF000000
50#define BOOT_ROM_LENGTH 0x8000
51
52/* Level 1 Memory */
53
54/* Memory Map for ADSP-BF518/6/4/2 processors */
55
56#ifdef CONFIG_BFIN_ICACHE
57#define BFIN_ICACHESIZE (16 * 1024)
58#else
59#define BFIN_ICACHESIZE (0)
60#endif
61
62#define L1_CODE_START 0xFFA00000
63#define L1_DATA_A_START 0xFF800000
64#define L1_DATA_B_START 0xFF900000
65
66#define L1_CODE_LENGTH 0xC000
67
68#ifdef CONFIG_BFIN_DCACHE
69
70#ifdef CONFIG_BFIN_DCACHE_BANKA
71#define DMEM_CNTR (ACACHE_BSRAM | ENDCPLB | PORT_PREF0)
72#define L1_DATA_A_LENGTH (0x8000 - 0x4000)
73#define L1_DATA_B_LENGTH 0x8000
74#define BFIN_DCACHESIZE (16 * 1024)
75#define BFIN_DSUPBANKS 1
76#else
77#define DMEM_CNTR (ACACHE_BCACHE | ENDCPLB | PORT_PREF0)
78#define L1_DATA_A_LENGTH (0x8000 - 0x4000)
79#define L1_DATA_B_LENGTH (0x8000 - 0x4000)
80#define BFIN_DCACHESIZE (32 * 1024)
81#define BFIN_DSUPBANKS 2
82#endif
83
84#else
85#define DMEM_CNTR (ASRAM_BSRAM | ENDCPLB | PORT_PREF0)
86#define L1_DATA_A_LENGTH 0x8000
87#define L1_DATA_B_LENGTH 0x8000
88#define BFIN_DCACHESIZE 0
89#define BFIN_DSUPBANKS 0
90#endif /*CONFIG_BFIN_DCACHE */
91
92/* Level 2 Memory - none */
93
94#define L2_START 0
95#define L2_LENGTH 0
96
97/* Scratch Pad Memory */
98
99#define L1_SCRATCH_START 0xFFB00000
100#define L1_SCRATCH_LENGTH 0x1000
101
102#define GET_PDA_SAFE(preg) \
103 preg.l = _cpu_pda; \
104 preg.h = _cpu_pda;
105
106#define GET_PDA(preg, dreg) GET_PDA_SAFE(preg)
107
108#endif /* _MEM_MAP_518_H_ */
diff --git a/arch/blackfin/mach-bf518/include/mach/portmux.h b/arch/blackfin/mach-bf518/include/mach/portmux.h
new file mode 100644
index 000000000000..ac16d54734d4
--- /dev/null
+++ b/arch/blackfin/mach-bf518/include/mach/portmux.h
@@ -0,0 +1,188 @@
1#ifndef _MACH_PORTMUX_H_
2#define _MACH_PORTMUX_H_
3
4#define MAX_RESOURCES MAX_BLACKFIN_GPIOS
5
6/* EMAC MII/RMII Port Mux */
7#define P_MII0_ETxD2 (P_DEFINED | P_IDENT(GPIO_PF0) | P_FUNCT(0))
8#define P_MII0_ERxD2 (P_DEFINED | P_IDENT(GPIO_PF1) | P_FUNCT(0))
9#define P_MII0_ETxD3 (P_DEFINED | P_IDENT(GPIO_PF2) | P_FUNCT(0))
10#define P_MII0_ERxD3 (P_DEFINED | P_IDENT(GPIO_PF3) | P_FUNCT(0))
11#define P_MII0_ERxCLK (P_DEFINED | P_IDENT(GPIO_PF4) | P_FUNCT(0))
12#define P_MII0_ERxDV (P_DEFINED | P_IDENT(GPIO_PF5) | P_FUNCT(0))
13#define P_MII0_COL (P_DEFINED | P_IDENT(GPIO_PF6) | P_FUNCT(0))
14
15#define P_MII0_MDC (P_DEFINED | P_IDENT(GPIO_PF8) | P_FUNCT(0))
16#define P_MII0_MDIO (P_DEFINED | P_IDENT(GPIO_PF9) | P_FUNCT(0))
17#define P_MII0_ETxD0 (P_DEFINED | P_IDENT(GPIO_PF10) | P_FUNCT(0))
18#define P_MII0_ERxD0 (P_DEFINED | P_IDENT(GPIO_PF11) | P_FUNCT(0))
19#define P_MII0_ETxD1 (P_DEFINED | P_IDENT(GPIO_PF12) | P_FUNCT(0))
20#define P_MII0_ERxD1 (P_DEFINED | P_IDENT(GPIO_PF13) | P_FUNCT(0))
21#define P_MII0_ETxEN (P_DEFINED | P_IDENT(GPIO_PF14) | P_FUNCT(0))
22#define P_MII0_PHYINT (P_DEFINED | P_IDENT(GPIO_PF15) | P_FUNCT(0))
23#define P_MII0_CRS (P_DEFINED | P_IDENT(GPIO_PG0) | P_FUNCT(0))
24#define P_MII0_ERxER (P_DEFINED | P_IDENT(GPIO_PG1) | P_FUNCT(0))
25#define P_MII0_TxCLK (P_DEFINED | P_IDENT(GPIO_PG2) | P_FUNCT(0))
26
27#define P_MII0 {\
28 P_MII0_ETxD0, \
29 P_MII0_ETxD1, \
30 P_MII0_ETxD2, \
31 P_MII0_ETxD3, \
32 P_MII0_ETxEN, \
33 P_MII0_TxCLK, \
34 P_MII0_PHYINT, \
35 P_MII0_COL, \
36 P_MII0_ERxD0, \
37 P_MII0_ERxD1, \
38 P_MII0_ERxD2, \
39 P_MII0_ERxD3, \
40 P_MII0_ERxDV, \
41 P_MII0_ERxCLK, \
42 P_MII0_ERxER, \
43 P_MII0_CRS, \
44 P_MII0_MDC, \
45 P_MII0_MDIO, 0}
46
47#define P_RMII0 {\
48 P_MII0_ETxD0, \
49 P_MII0_ETxD1, \
50 P_MII0_ETxEN, \
51 P_MII0_ERxD0, \
52 P_MII0_ERxD1, \
53 P_MII0_ERxER, \
54 P_MII0_TxCLK, \
55 P_MII0_PHYINT, \
56 P_MII0_CRS, \
57 P_MII0_MDC, \
58 P_MII0_MDIO, 0}
59
60/* PPI Port Mux */
61#define P_PPI0_D0 (P_DEFINED | P_IDENT(GPIO_PF0) | P_FUNCT(1))
62#define P_PPI0_D1 (P_DEFINED | P_IDENT(GPIO_PF1) | P_FUNCT(1))
63#define P_PPI0_D2 (P_DEFINED | P_IDENT(GPIO_PF2) | P_FUNCT(1))
64#define P_PPI0_D3 (P_DEFINED | P_IDENT(GPIO_PF3) | P_FUNCT(1))
65#define P_PPI0_D4 (P_DEFINED | P_IDENT(GPIO_PF4) | P_FUNCT(1))
66#define P_PPI0_D5 (P_DEFINED | P_IDENT(GPIO_PF5) | P_FUNCT(1))
67#define P_PPI0_D6 (P_DEFINED | P_IDENT(GPIO_PF6) | P_FUNCT(1))
68#define P_PPI0_D7 (P_DEFINED | P_IDENT(GPIO_PF7) | P_FUNCT(1))
69#define P_PPI0_D8 (P_DEFINED | P_IDENT(GPIO_PF8) | P_FUNCT(1))
70#define P_PPI0_D9 (P_DEFINED | P_IDENT(GPIO_PF9) | P_FUNCT(1))
71#define P_PPI0_D10 (P_DEFINED | P_IDENT(GPIO_PF10) | P_FUNCT(1))
72#define P_PPI0_D11 (P_DEFINED | P_IDENT(GPIO_PF11) | P_FUNCT(1))
73#define P_PPI0_D12 (P_DEFINED | P_IDENT(GPIO_PF12) | P_FUNCT(1))
74#define P_PPI0_D13 (P_DEFINED | P_IDENT(GPIO_PF13) | P_FUNCT(1))
75#define P_PPI0_D14 (P_DEFINED | P_IDENT(GPIO_PF14) | P_FUNCT(1))
76#define P_PPI0_D15 (P_DEFINED | P_IDENT(GPIO_PF15) | P_FUNCT(1))
77
78#define P_PPI0_CLK (P_DEFINED | P_IDENT(GPIO_PG12) | P_FUNCT(1))
79#define P_PPI0_FS1 (P_DEFINED | P_IDENT(GPIO_PG13) | P_FUNCT(1))
80#define P_PPI0_FS2 (P_DEFINED | P_IDENT(GPIO_PG14) | P_FUNCT(1))
81#define P_PPI0_FS3 (P_DEFINED | P_IDENT(GPIO_PG15) | P_FUNCT(1))
82
83/* SPI Port Mux */
84#define P_SPI0_SS (P_DEFINED | P_IDENT(GPIO_PG11) | P_FUNCT(0))
85#define P_SPI0_SCK (P_DEFINED | P_IDENT(GPIO_PG12) | P_FUNCT(0))
86#define P_SPI0_MISO (P_DEFINED | P_IDENT(GPIO_PG13) | P_FUNCT(0))
87#define P_SPI0_MOSI (P_DEFINED | P_IDENT(GPIO_PG14) | P_FUNCT(0))
88
89#define P_SPI0_SSEL1 (P_DEFINED | P_IDENT(GPIO_PF7) | P_FUNCT(0))
90#define P_SPI0_SSEL2 (P_DEFINED | P_IDENT(GPIO_PG15) | P_FUNCT(0))
91#define P_SPI0_SSEL3 (P_DEFINED | P_IDENT(GPIO_PH4) | P_FUNCT(2))
92#define P_SPI0_SSEL4 (P_DEFINED | P_IDENT(GPIO_PG10) | P_FUNCT(2))
93#define P_SPI0_SSEL5 (P_DEFINED | P_IDENT(GPIO_PG3) | P_FUNCT(2))
94
95#define P_SPI1_SS (P_DEFINED | P_IDENT(GPIO_PH0) | P_FUNCT(1))
96#define P_SPI1_SCK (P_DEFINED | P_IDENT(GPIO_PH1) | P_FUNCT(1))
97#define P_SPI1_MISO (P_DEFINED | P_IDENT(GPIO_PH2) | P_FUNCT(1))
98#define P_SPI1_MOSI (P_DEFINED | P_IDENT(GPIO_PH3) | P_FUNCT(1))
99
100#define P_SPI1_SSEL1 (P_DEFINED | P_IDENT(GPIO_PH6) | P_FUNCT(2))
101#define P_SPI1_SSEL2 (P_DEFINED | P_IDENT(GPIO_PF0) | P_FUNCT(2))
102#define P_SPI1_SSEL3 (P_DEFINED | P_IDENT(GPIO_PG0) | P_FUNCT(2))
103#define P_SPI1_SSEL4 (P_DEFINED | P_IDENT(GPIO_PF8) | P_FUNCT(2))
104#define P_SPI1_SSEL5 (P_DEFINED | P_IDENT(GPIO_PG11) | P_FUNCT(2))
105
106/* SPORT Port Mux */
107#define P_SPORT0_DRPRI (P_DEFINED | P_IDENT(GPIO_PG3) | P_FUNCT(0))
108#define P_SPORT0_RSCLK (P_DEFINED | P_IDENT(GPIO_PG4) | P_FUNCT(0))
109#define P_SPORT0_RFS (P_DEFINED | P_IDENT(GPIO_PG5) | P_FUNCT(0))
110#define P_SPORT0_TFS (P_DEFINED | P_IDENT(GPIO_PG6) | P_FUNCT(0))
111#define P_SPORT0_DTPRI (P_DEFINED | P_IDENT(GPIO_PG7) | P_FUNCT(0))
112#define P_SPORT0_TSCLK (P_DEFINED | P_IDENT(GPIO_PG8) | P_FUNCT(0))
113#define P_SPORT0_DTSEC (P_DEFINED | P_IDENT(GPIO_PG9) | P_FUNCT(0))
114#define P_SPORT0_DRSEC (P_DEFINED | P_IDENT(GPIO_PG10) | P_FUNCT(0))
115
116#define P_SPORT1_DRPRI (P_DEFINED | P_IDENT(GPIO_PH0) | P_FUNCT(0))
117#define P_SPORT1_RFS (P_DEFINED | P_IDENT(GPIO_PH1) | P_FUNCT(0))
118#define P_SPORT1_RSCLK (P_DEFINED | P_IDENT(GPIO_PH2) | P_FUNCT(0))
119#define P_SPORT1_DTPRI (P_DEFINED | P_IDENT(GPIO_PH3) | P_FUNCT(0))
120#define P_SPORT1_TFS (P_DEFINED | P_IDENT(GPIO_PH4) | P_FUNCT(0))
121#define P_SPORT1_TSCLK (P_DEFINED | P_IDENT(GPIO_PH5) | P_FUNCT(0))
122#define P_SPORT1_DTSEC (P_DEFINED | P_IDENT(GPIO_PH6) | P_FUNCT(0))
123#define P_SPORT1_DRSEC (P_DEFINED | P_IDENT(GPIO_PH7) | P_FUNCT(0))
124
125/* UART Port Mux */
126#define P_UART0_TX (P_DEFINED | P_IDENT(GPIO_PG9) | P_FUNCT(1))
127#define P_UART0_RX (P_DEFINED | P_IDENT(GPIO_PG10) | P_FUNCT(1))
128
129#define P_UART1_TX (P_DEFINED | P_IDENT(GPIO_PH6) | P_FUNCT(1))
130#define P_UART1_RX (P_DEFINED | P_IDENT(GPIO_PH7) | P_FUNCT(1))
131
132/* Timer */
133#define P_TMRCLK (P_DEFINED | P_IDENT(GPIO_PG5) | P_FUNCT(2))
134#define P_TMR0 (P_DEFINED | P_IDENT(GPIO_PG6) | P_FUNCT(2))
135#define P_TMR1 (P_DEFINED | P_IDENT(GPIO_PG7) | P_FUNCT(2))
136#define P_TMR2 (P_DEFINED | P_IDENT(GPIO_PF9) | P_FUNCT(2))
137#define P_TMR3 (P_DEFINED | P_IDENT(GPIO_PF10) | P_FUNCT(2))
138#define P_TMR4 (P_DEFINED | P_IDENT(GPIO_PG9) | P_FUNCT(2))
139#define P_TMR5 (P_DEFINED | P_IDENT(GPIO_PG4) | P_FUNCT(2))
140#define P_TMR6 (P_DEFINED | P_IDENT(GPIO_PG8) | P_FUNCT(2))
141#define P_TMR7 (P_DEFINED | P_IDENT(GPIO_PH7) | P_FUNCT(2))
142
143/* DMA */
144#define P_DMAR1 (P_DEFINED | P_IDENT(GPIO_PG1) | P_FUNCT(1))
145#define P_DMAR0 (P_DEFINED | P_IDENT(GPIO_PG2) | P_FUNCT(1))
146
147/* TWI */
148#define P_TWI0_SCL (P_DONTCARE)
149#define P_TWI0_SDA (P_DONTCARE)
150
151/* PWM */
152#define P_PWM0_AH (P_DEFINED | P_IDENT(GPIO_PF1) | P_FUNCT(2))
153#define P_PWM0_AL (P_DEFINED | P_IDENT(GPIO_PF2) | P_FUNCT(2))
154#define P_PWM0_BH (P_DEFINED | P_IDENT(GPIO_PF3) | P_FUNCT(2))
155#define P_PWM0_BL (P_DEFINED | P_IDENT(GPIO_PF4) | P_FUNCT(2))
156#define P_PWM0_CH (P_DEFINED | P_IDENT(GPIO_PF5) | P_FUNCT(2))
157#define P_PWM0_CL (P_DEFINED | P_IDENT(GPIO_PF6) | P_FUNCT(2))
158#define P_PWM0_SYNC (P_DEFINED | P_IDENT(GPIO_PF7) | P_FUNCT(2))
159
160#define P_PWM1_AH (P_DEFINED | P_IDENT(GPIO_PF11) | P_FUNCT(2))
161#define P_PWM1_AL (P_DEFINED | P_IDENT(GPIO_PF12) | P_FUNCT(2))
162#define P_PWM1_BH (P_DEFINED | P_IDENT(GPIO_PF13) | P_FUNCT(2))
163#define P_PWM1_BL (P_DEFINED | P_IDENT(GPIO_PF14) | P_FUNCT(2))
164#define P_PWM1_CH (P_DEFINED | P_IDENT(GPIO_PG1) | P_FUNCT(2))
165#define P_PWM1_CL (P_DEFINED | P_IDENT(GPIO_PG2) | P_FUNCT(2))
166#define P_PWM1_SYNC (P_DEFINED | P_IDENT(GPIO_PF15) | P_FUNCT(2))
167
168#define P_PWM_TRIPB (P_DEFINED | P_IDENT(GPIO_PG14) | P_FUNCT(2))
169
170/* RSI */
171#define P_RSI_DATA0 (P_DEFINED | P_IDENT(GPIO_PG3) | P_FUNCT(1))
172#define P_RSI_DATA1 (P_DEFINED | P_IDENT(GPIO_PG4) | P_FUNCT(1))
173#define P_RSI_DATA2 (P_DEFINED | P_IDENT(GPIO_PG5) | P_FUNCT(1))
174#define P_RSI_DATA3 (P_DEFINED | P_IDENT(GPIO_PG6) | P_FUNCT(1))
175#define P_RSI_DATA4 (P_DEFINED | P_IDENT(GPIO_PH0) | P_FUNCT(2))
176#define P_RSI_DATA5 (P_DEFINED | P_IDENT(GPIO_PH1) | P_FUNCT(2))
177#define P_RSI_DATA6 (P_DEFINED | P_IDENT(GPIO_PH2) | P_FUNCT(2))
178#define P_RSI_DATA7 (P_DEFINED | P_IDENT(GPIO_PH3) | P_FUNCT(2))
179#define P_RSI_CMD (P_DEFINED | P_IDENT(GPIO_PG7) | P_FUNCT(1))
180#define P_RSI_CLK (P_DEFINED | P_IDENT(GPIO_PG8) | P_FUNCT(1))
181
182/* PTP */
183#define P_PTP_PPS (P_DEFINED | P_IDENT(GPIO_PG12) | P_FUNCT(2))
184#define P_PTP_CLKOUT (P_DEFINED | P_IDENT(GPIO_PG13) | P_FUNCT(2))
185
186#define P_HWAIT (P_DEFINED | P_IDENT(GPIO_PG000000000) | P_FUNCT(1))
187
188#endif /* _MACH_PORTMUX_H_ */
diff --git a/arch/blackfin/mach-bf518/ints-priority.c b/arch/blackfin/mach-bf518/ints-priority.c
new file mode 100644
index 000000000000..3151fd5501ca
--- /dev/null
+++ b/arch/blackfin/mach-bf518/ints-priority.c
@@ -0,0 +1,99 @@
1/*
2 * File: arch/blackfin/mach-bf518/ints-priority.c
3 * Based on: arch/blackfin/mach-bf527/ints-priority.c
4 * Author: Bryan Wu <cooloney@kernel.org>
5 *
6 * Created:
7 * Description: Set up the interrupt priorities
8 *
9 * Modified:
10 * Copyright 2004-2007 Analog Devices Inc.
11 *
12 * Bugs: Enter bugs at http://blackfin.uclinux.org/
13 *
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 2 of the License, or
17 * (at your option) any later version.
18 *
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
23 *
24 * You should have received a copy of the GNU General Public License
25 * along with this program; if not, see the file COPYING, or write
26 * to the Free Software Foundation, Inc.,
27 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
28 */
29
30#include <linux/module.h>
31#include <linux/irq.h>
32#include <asm/blackfin.h>
33
34void __init program_IAR(void)
35{
36 /* Program the IAR0 Register with the configured priority */
37 bfin_write_SIC_IAR0(((CONFIG_IRQ_PLL_WAKEUP - 7) << IRQ_PLL_WAKEUP_POS) |
38 ((CONFIG_IRQ_DMA0_ERROR - 7) << IRQ_DMA0_ERROR_POS) |
39 ((CONFIG_IRQ_DMAR0_BLK - 7) << IRQ_DMAR0_BLK_POS) |
40 ((CONFIG_IRQ_DMAR1_BLK - 7) << IRQ_DMAR1_BLK_POS) |
41 ((CONFIG_IRQ_DMAR0_OVR - 7) << IRQ_DMAR0_OVR_POS) |
42 ((CONFIG_IRQ_DMAR1_OVR - 7) << IRQ_DMAR1_OVR_POS) |
43 ((CONFIG_IRQ_PPI_ERROR - 7) << IRQ_PPI_ERROR_POS) |
44 ((CONFIG_IRQ_MAC_ERROR - 7) << IRQ_MAC_ERROR_POS));
45
46
47 bfin_write_SIC_IAR1(((CONFIG_IRQ_SPORT0_ERROR - 7) << IRQ_SPORT0_ERROR_POS) |
48 ((CONFIG_IRQ_SPORT1_ERROR - 7) << IRQ_SPORT1_ERROR_POS) |
49 ((CONFIG_IRQ_PTP_ERROR - 7) << IRQ_PTP_ERROR_POS) |
50 ((CONFIG_IRQ_UART0_ERROR - 7) << IRQ_UART0_ERROR_POS) |
51 ((CONFIG_IRQ_UART1_ERROR - 7) << IRQ_UART1_ERROR_POS) |
52 ((CONFIG_IRQ_RTC - 7) << IRQ_RTC_POS) |
53 ((CONFIG_IRQ_PPI - 7) << IRQ_PPI_POS));
54
55 bfin_write_SIC_IAR2(((CONFIG_IRQ_SPORT0_RX - 7) << IRQ_SPORT0_RX_POS) |
56 ((CONFIG_IRQ_SPORT0_TX - 7) << IRQ_SPORT0_TX_POS) |
57 ((CONFIG_IRQ_SPORT1_RX - 7) << IRQ_SPORT1_RX_POS) |
58 ((CONFIG_IRQ_SPORT1_TX - 7) << IRQ_SPORT1_TX_POS) |
59 ((CONFIG_IRQ_TWI - 7) << IRQ_TWI_POS) |
60 ((CONFIG_IRQ_SPI0 - 7) << IRQ_SPI0_POS) |
61 ((CONFIG_IRQ_UART0_RX - 7) << IRQ_UART0_RX_POS) |
62 ((CONFIG_IRQ_UART0_TX - 7) << IRQ_UART0_TX_POS));
63
64 bfin_write_SIC_IAR3(((CONFIG_IRQ_UART1_RX - 7) << IRQ_UART1_RX_POS) |
65 ((CONFIG_IRQ_UART1_TX - 7) << IRQ_UART1_TX_POS) |
66 ((CONFIG_IRQ_OPTSEC - 7) << IRQ_OPTSEC_POS) |
67 ((CONFIG_IRQ_CNT - 7) << IRQ_CNT_POS) |
68 ((CONFIG_IRQ_MAC_RX - 7) << IRQ_MAC_RX_POS) |
69 ((CONFIG_IRQ_PORTH_INTA - 7) << IRQ_PORTH_INTA_POS) |
70 ((CONFIG_IRQ_MAC_TX - 7) << IRQ_MAC_TX_POS) |
71 ((CONFIG_IRQ_PORTH_INTB - 7) << IRQ_PORTH_INTB_POS));
72
73 bfin_write_SIC_IAR4(((CONFIG_IRQ_TIMER0 - 7) << IRQ_TIMER0_POS) |
74 ((CONFIG_IRQ_TIMER1 - 7) << IRQ_TIMER1_POS) |
75 ((CONFIG_IRQ_TIMER2 - 7) << IRQ_TIMER2_POS) |
76 ((CONFIG_IRQ_TIMER3 - 7) << IRQ_TIMER3_POS) |
77 ((CONFIG_IRQ_TIMER4 - 7) << IRQ_TIMER4_POS) |
78 ((CONFIG_IRQ_TIMER5 - 7) << IRQ_TIMER5_POS) |
79 ((CONFIG_IRQ_TIMER6 - 7) << IRQ_TIMER6_POS) |
80 ((CONFIG_IRQ_TIMER7 - 7) << IRQ_TIMER7_POS));
81
82 bfin_write_SIC_IAR5(((CONFIG_IRQ_PORTG_INTA - 7) << IRQ_PORTG_INTA_POS) |
83 ((CONFIG_IRQ_PORTG_INTB - 7) << IRQ_PORTG_INTB_POS) |
84 ((CONFIG_IRQ_MEM_DMA0 - 7) << IRQ_MEM_DMA0_POS) |
85 ((CONFIG_IRQ_MEM_DMA1 - 7) << IRQ_MEM_DMA1_POS) |
86 ((CONFIG_IRQ_WATCH - 7) << IRQ_WATCH_POS) |
87 ((CONFIG_IRQ_PORTF_INTA - 7) << IRQ_PORTF_INTA_POS) |
88 ((CONFIG_IRQ_PORTF_INTB - 7) << IRQ_PORTF_INTB_POS) |
89 ((CONFIG_IRQ_SPI0_ERROR - 7) << IRQ_SPI0_ERROR_POS));
90
91 bfin_write_SIC_IAR6(((CONFIG_IRQ_SPI1_ERROR - 7) << IRQ_SPI1_ERROR_POS) |
92 ((CONFIG_IRQ_RSI_INT0 - 7) << IRQ_RSI_INT0_POS) |
93 ((CONFIG_IRQ_RSI_INT1 - 7) << IRQ_RSI_INT1_POS) |
94 ((CONFIG_IRQ_PWM_TRIP - 7) << IRQ_PWM_TRIP_POS) |
95 ((CONFIG_IRQ_PWM_SYNC - 7) << IRQ_PWM_SYNC_POS) |
96 ((CONFIG_IRQ_PTP_STAT - 7) << IRQ_PTP_STAT_POS));
97
98 SSYNC();
99}
diff --git a/arch/blackfin/mach-bf527/Kconfig b/arch/blackfin/mach-bf527/Kconfig
index 3cde4beeb214..8438ec6d6679 100644
--- a/arch/blackfin/mach-bf527/Kconfig
+++ b/arch/blackfin/mach-bf527/Kconfig
@@ -168,29 +168,29 @@ config IRQ_MAC_TX
168config IRQ_PORTH_INTB 168config IRQ_PORTH_INTB
169 int "IRQ_PORTH_INTB" 169 int "IRQ_PORTH_INTB"
170 default 11 170 default 11
171config IRQ_TMR0 171config IRQ_TIMER0
172 int "IRQ_TMR0" 172 int "IRQ_TIMER0"
173 default 12 173 default 8
174config IRQ_TMR1 174config IRQ_TIMER1
175 int "IRQ_TMR1" 175 int "IRQ_TIMER1"
176 default 12 176 default 12
177config IRQ_TMR2 177config IRQ_TIMER2
178 int "IRQ_TMR2" 178 int "IRQ_TIMER2"
179 default 12 179 default 12
180config IRQ_TMR3 180config IRQ_TIMER3
181 int "IRQ_TMR3" 181 int "IRQ_TIMER3"
182 default 12 182 default 12
183config IRQ_TMR4 183config IRQ_TIMER4
184 int "IRQ_TMR4" 184 int "IRQ_TIMER4"
185 default 12 185 default 12
186config IRQ_TMR5 186config IRQ_TIMER5
187 int "IRQ_TMR5" 187 int "IRQ_TIMER5"
188 default 12 188 default 12
189config IRQ_TMR6 189config IRQ_TIMER6
190 int "IRQ_TMR6" 190 int "IRQ_TIMER6"
191 default 12 191 default 12
192config IRQ_TMR7 192config IRQ_TIMER7
193 int "IRQ_TMR7" 193 int "IRQ_TIMER7"
194 default 12 194 default 12
195config IRQ_PORTG_INTA 195config IRQ_PORTG_INTA
196 int "IRQ_PORTG_INTA" 196 int "IRQ_PORTG_INTA"
diff --git a/arch/blackfin/mach-bf527/Makefile b/arch/blackfin/mach-bf527/Makefile
index 4eddb580319c..4a6cdafab8ce 100644
--- a/arch/blackfin/mach-bf527/Makefile
+++ b/arch/blackfin/mach-bf527/Makefile
@@ -2,6 +2,4 @@
2# arch/blackfin/mach-bf527/Makefile 2# arch/blackfin/mach-bf527/Makefile
3# 3#
4 4
5extra-y := head.o
6
7obj-y := ints-priority.o dma.o 5obj-y := ints-priority.o dma.o
diff --git a/arch/blackfin/mach-bf527/boards/cm_bf527.c b/arch/blackfin/mach-bf527/boards/cm_bf527.c
index 9ea440bbb13d..a2c3578f4b6c 100644
--- a/arch/blackfin/mach-bf527/boards/cm_bf527.c
+++ b/arch/blackfin/mach-bf527/boards/cm_bf527.c
@@ -61,51 +61,40 @@ const char bfin_board_name[] = "Bluetechnix CM-BF527";
61 * Driver needs to know address, irq and flag pin. 61 * Driver needs to know address, irq and flag pin.
62 */ 62 */
63 63
64#define ISP1761_BASE 0x203C0000
65#define ISP1761_IRQ IRQ_PF7
66
67#if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE) 64#if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
68static struct resource bfin_isp1761_resources[] = { 65#include <linux/usb/isp1760.h>
66static struct resource bfin_isp1760_resources[] = {
69 [0] = { 67 [0] = {
70 .name = "isp1761-regs", 68 .start = 0x203C0000,
71 .start = ISP1761_BASE + 0x00000000, 69 .end = 0x203C0000 + 0x000fffff,
72 .end = ISP1761_BASE + 0x000fffff,
73 .flags = IORESOURCE_MEM, 70 .flags = IORESOURCE_MEM,
74 }, 71 },
75 [1] = { 72 [1] = {
76 .start = ISP1761_IRQ, 73 .start = IRQ_PF7,
77 .end = ISP1761_IRQ, 74 .end = IRQ_PF7,
78 .flags = IORESOURCE_IRQ, 75 .flags = IORESOURCE_IRQ,
79 }, 76 },
80}; 77};
81 78
82static struct platform_device bfin_isp1761_device = { 79static struct isp1760_platform_data isp1760_priv = {
83 .name = "isp1761", 80 .is_isp1761 = 0,
84 .id = 0, 81 .port1_disable = 0,
85 .num_resources = ARRAY_SIZE(bfin_isp1761_resources), 82 .bus_width_16 = 1,
86 .resource = bfin_isp1761_resources, 83 .port1_otg = 0,
84 .analog_oc = 0,
85 .dack_polarity_high = 0,
86 .dreq_polarity_high = 0,
87}; 87};
88 88
89static struct platform_device *bfin_isp1761_devices[] = { 89static struct platform_device bfin_isp1760_device = {
90 &bfin_isp1761_device, 90 .name = "isp1760-hcd",
91 .id = 0,
92 .dev = {
93 .platform_data = &isp1760_priv,
94 },
95 .num_resources = ARRAY_SIZE(bfin_isp1760_resources),
96 .resource = bfin_isp1760_resources,
91}; 97};
92
93int __init bfin_isp1761_init(void)
94{
95 unsigned int num_devices = ARRAY_SIZE(bfin_isp1761_devices);
96
97 printk(KERN_INFO "%s(): registering device resources\n", __func__);
98 set_irq_type(ISP1761_IRQ, IRQF_TRIGGER_FALLING);
99
100 return platform_add_devices(bfin_isp1761_devices, num_devices);
101}
102
103void __exit bfin_isp1761_exit(void)
104{
105 platform_device_unregister(&bfin_isp1761_device);
106}
107
108arch_initcall(bfin_isp1761_init);
109#endif 98#endif
110 99
111#if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE) 100#if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
@@ -132,8 +121,8 @@ static struct musb_hdrc_config musb_config = {
132 .dyn_fifo = 0, 121 .dyn_fifo = 0,
133 .soft_con = 1, 122 .soft_con = 1,
134 .dma = 1, 123 .dma = 1,
135 .num_eps = 7, 124 .num_eps = 8,
136 .dma_channels = 7, 125 .dma_channels = 8,
137 .gpio_vrsel = GPIO_PF11, 126 .gpio_vrsel = GPIO_PF11,
138}; 127};
139 128
@@ -728,30 +717,59 @@ static struct platform_device bfin_uart_device = {
728#endif 717#endif
729 718
730#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE) 719#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
731static struct resource bfin_sir_resources[] = {
732#ifdef CONFIG_BFIN_SIR0 720#ifdef CONFIG_BFIN_SIR0
721static struct resource bfin_sir0_resources[] = {
733 { 722 {
734 .start = 0xFFC00400, 723 .start = 0xFFC00400,
735 .end = 0xFFC004FF, 724 .end = 0xFFC004FF,
736 .flags = IORESOURCE_MEM, 725 .flags = IORESOURCE_MEM,
737 }, 726 },
727 {
728 .start = IRQ_UART0_RX,
729 .end = IRQ_UART0_RX+1,
730 .flags = IORESOURCE_IRQ,
731 },
732 {
733 .start = CH_UART0_RX,
734 .end = CH_UART0_RX+1,
735 .flags = IORESOURCE_DMA,
736 },
737};
738
739static struct platform_device bfin_sir0_device = {
740 .name = "bfin_sir",
741 .id = 0,
742 .num_resources = ARRAY_SIZE(bfin_sir0_resources),
743 .resource = bfin_sir0_resources,
744};
738#endif 745#endif
739#ifdef CONFIG_BFIN_SIR1 746#ifdef CONFIG_BFIN_SIR1
747static struct resource bfin_sir1_resources[] = {
740 { 748 {
741 .start = 0xFFC02000, 749 .start = 0xFFC02000,
742 .end = 0xFFC020FF, 750 .end = 0xFFC020FF,
743 .flags = IORESOURCE_MEM, 751 .flags = IORESOURCE_MEM,
744 }, 752 },
745#endif 753 {
754 .start = IRQ_UART1_RX,
755 .end = IRQ_UART1_RX+1,
756 .flags = IORESOURCE_IRQ,
757 },
758 {
759 .start = CH_UART1_RX,
760 .end = CH_UART1_RX+1,
761 .flags = IORESOURCE_DMA,
762 },
746}; 763};
747 764
748static struct platform_device bfin_sir_device = { 765static struct platform_device bfin_sir1_device = {
749 .name = "bfin_sir", 766 .name = "bfin_sir",
750 .id = 0, 767 .id = 1,
751 .num_resources = ARRAY_SIZE(bfin_sir_resources), 768 .num_resources = ARRAY_SIZE(bfin_sir1_resources),
752 .resource = bfin_sir_resources, 769 .resource = bfin_sir1_resources,
753}; 770};
754#endif 771#endif
772#endif
755 773
756#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE) 774#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
757static struct resource bfin_twi0_resource[] = { 775static struct resource bfin_twi0_resource[] = {
@@ -885,6 +903,10 @@ static struct platform_device *stamp_devices[] __initdata = {
885 &isp1362_hcd_device, 903 &isp1362_hcd_device,
886#endif 904#endif
887 905
906#if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
907 &bfin_isp1760_device,
908#endif
909
888#if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE) 910#if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
889 &musb_device, 911 &musb_device,
890#endif 912#endif
@@ -918,7 +940,12 @@ static struct platform_device *stamp_devices[] __initdata = {
918#endif 940#endif
919 941
920#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE) 942#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
921 &bfin_sir_device, 943#ifdef CONFIG_BFIN_SIR0
944 &bfin_sir0_device,
945#endif
946#ifdef CONFIG_BFIN_SIR1
947 &bfin_sir1_device,
948#endif
922#endif 949#endif
923 950
924#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE) 951#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
diff --git a/arch/blackfin/mach-bf527/boards/ezbrd.c b/arch/blackfin/mach-bf527/boards/ezbrd.c
index 36c87b6fbdec..0314bd3355eb 100644
--- a/arch/blackfin/mach-bf527/boards/ezbrd.c
+++ b/arch/blackfin/mach-bf527/boards/ezbrd.c
@@ -51,7 +51,7 @@
51/* 51/*
52 * Name the Board for the /proc/cpuinfo 52 * Name the Board for the /proc/cpuinfo
53 */ 53 */
54const char bfin_board_name[] = "BF526-EZBRD"; 54const char bfin_board_name[] = "ADI BF526-EZBRD";
55 55
56/* 56/*
57 * Driver needs to know address, irq and flag pin. 57 * Driver needs to know address, irq and flag pin.
@@ -81,8 +81,8 @@ static struct musb_hdrc_config musb_config = {
81 .dyn_fifo = 0, 81 .dyn_fifo = 0,
82 .soft_con = 1, 82 .soft_con = 1,
83 .dma = 1, 83 .dma = 1,
84 .num_eps = 7, 84 .num_eps = 8,
85 .dma_channels = 7, 85 .dma_channels = 8,
86 .gpio_vrsel = GPIO_PG13, 86 .gpio_vrsel = GPIO_PG13,
87}; 87};
88 88
@@ -288,6 +288,30 @@ static const struct ad7877_platform_data bfin_ad7877_ts_info = {
288}; 288};
289#endif 289#endif
290 290
291#if defined(CONFIG_TOUCHSCREEN_AD7879) || defined(CONFIG_TOUCHSCREEN_AD7879_MODULE)
292#include <linux/spi/ad7879.h>
293static const struct ad7879_platform_data bfin_ad7879_ts_info = {
294 .model = 7879, /* Model = AD7879 */
295 .x_plate_ohms = 620, /* 620 Ohm from the touch datasheet */
296 .pressure_max = 10000,
297 .pressure_min = 0,
298 .first_conversion_delay = 3, /* wait 512us before do a first conversion */
299 .acquisition_time = 1, /* 4us acquisition time per sample */
300 .median = 2, /* do 8 measurements */
301 .averaging = 1, /* take the average of 4 middle samples */
302 .pen_down_acc_interval = 255, /* 9.4 ms */
303 .gpio_output = 1, /* configure AUX/VBAT/GPIO as GPIO output */
304 .gpio_default = 1, /* During initialization set GPIO = HIGH */
305};
306#endif
307
308#if defined(CONFIG_TOUCHSCREEN_AD7879_SPI) || defined(CONFIG_TOUCHSCREEN_AD7879_SPI_MODULE)
309static struct bfin5xx_spi_chip spi_ad7879_chip_info = {
310 .enable_dma = 0,
311 .bits_per_word = 16,
312};
313#endif
314
291#if defined(CONFIG_SND_SOC_WM8731) || defined(CONFIG_SND_SOC_WM8731_MODULE) \ 315#if defined(CONFIG_SND_SOC_WM8731) || defined(CONFIG_SND_SOC_WM8731_MODULE) \
292 && defined(CONFIG_SND_SOC_WM8731_SPI) 316 && defined(CONFIG_SND_SOC_WM8731_SPI)
293static struct bfin5xx_spi_chip spi_wm8731_chip_info = { 317static struct bfin5xx_spi_chip spi_wm8731_chip_info = {
@@ -386,6 +410,18 @@ static struct spi_board_info bfin_spi_board_info[] __initdata = {
386 .controller_data = &spi_ad7877_chip_info, 410 .controller_data = &spi_ad7877_chip_info,
387 }, 411 },
388#endif 412#endif
413#if defined(CONFIG_TOUCHSCREEN_AD7879_SPI) || defined(CONFIG_TOUCHSCREEN_AD7879_SPI_MODULE)
414 {
415 .modalias = "ad7879",
416 .platform_data = &bfin_ad7879_ts_info,
417 .irq = IRQ_PG0,
418 .max_speed_hz = 5000000, /* max spi clock (SCK) speed in HZ */
419 .bus_num = 0,
420 .chip_select = 5,
421 .controller_data = &spi_ad7879_chip_info,
422 .mode = SPI_CPHA | SPI_CPOL,
423 },
424#endif
389#if defined(CONFIG_SND_SOC_WM8731) || defined(CONFIG_SND_SOC_WM8731_MODULE) \ 425#if defined(CONFIG_SND_SOC_WM8731) || defined(CONFIG_SND_SOC_WM8731_MODULE) \
390 && defined(CONFIG_SND_SOC_WM8731_SPI) 426 && defined(CONFIG_SND_SOC_WM8731_SPI)
391 { 427 {
@@ -478,30 +514,59 @@ static struct platform_device bfin_uart_device = {
478#endif 514#endif
479 515
480#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE) 516#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
481static struct resource bfin_sir_resources[] = {
482#ifdef CONFIG_BFIN_SIR0 517#ifdef CONFIG_BFIN_SIR0
518static struct resource bfin_sir0_resources[] = {
483 { 519 {
484 .start = 0xFFC00400, 520 .start = 0xFFC00400,
485 .end = 0xFFC004FF, 521 .end = 0xFFC004FF,
486 .flags = IORESOURCE_MEM, 522 .flags = IORESOURCE_MEM,
487 }, 523 },
524 {
525 .start = IRQ_UART0_RX,
526 .end = IRQ_UART0_RX+1,
527 .flags = IORESOURCE_IRQ,
528 },
529 {
530 .start = CH_UART0_RX,
531 .end = CH_UART0_RX+1,
532 .flags = IORESOURCE_DMA,
533 },
534};
535
536static struct platform_device bfin_sir0_device = {
537 .name = "bfin_sir",
538 .id = 0,
539 .num_resources = ARRAY_SIZE(bfin_sir0_resources),
540 .resource = bfin_sir0_resources,
541};
488#endif 542#endif
489#ifdef CONFIG_BFIN_SIR1 543#ifdef CONFIG_BFIN_SIR1
544static struct resource bfin_sir1_resources[] = {
490 { 545 {
491 .start = 0xFFC02000, 546 .start = 0xFFC02000,
492 .end = 0xFFC020FF, 547 .end = 0xFFC020FF,
493 .flags = IORESOURCE_MEM, 548 .flags = IORESOURCE_MEM,
494 }, 549 },
495#endif 550 {
551 .start = IRQ_UART1_RX,
552 .end = IRQ_UART1_RX+1,
553 .flags = IORESOURCE_IRQ,
554 },
555 {
556 .start = CH_UART1_RX,
557 .end = CH_UART1_RX+1,
558 .flags = IORESOURCE_DMA,
559 },
496}; 560};
497 561
498static struct platform_device bfin_sir_device = { 562static struct platform_device bfin_sir1_device = {
499 .name = "bfin_sir", 563 .name = "bfin_sir",
500 .id = 0, 564 .id = 1,
501 .num_resources = ARRAY_SIZE(bfin_sir_resources), 565 .num_resources = ARRAY_SIZE(bfin_sir1_resources),
502 .resource = bfin_sir_resources, 566 .resource = bfin_sir1_resources,
503}; 567};
504#endif 568#endif
569#endif
505 570
506#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE) 571#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
507static struct resource bfin_twi0_resource[] = { 572static struct resource bfin_twi0_resource[] = {
@@ -671,7 +736,12 @@ static struct platform_device *stamp_devices[] __initdata = {
671#endif 736#endif
672 737
673#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE) 738#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
674 &bfin_sir_device, 739#ifdef CONFIG_BFIN_SIR0
740 &bfin_sir0_device,
741#endif
742#ifdef CONFIG_BFIN_SIR1
743 &bfin_sir1_device,
744#endif
675#endif 745#endif
676 746
677#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE) 747#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
diff --git a/arch/blackfin/mach-bf527/boards/ezkit.c b/arch/blackfin/mach-bf527/boards/ezkit.c
index 8ee2b744e234..9454fb7b18c3 100644
--- a/arch/blackfin/mach-bf527/boards/ezkit.c
+++ b/arch/blackfin/mach-bf527/boards/ezkit.c
@@ -54,57 +54,46 @@
54/* 54/*
55 * Name the Board for the /proc/cpuinfo 55 * Name the Board for the /proc/cpuinfo
56 */ 56 */
57const char bfin_board_name[] = "ADDS-BF527-EZKIT"; 57const char bfin_board_name[] = "ADI BF527-EZKIT";
58 58
59/* 59/*
60 * Driver needs to know address, irq and flag pin. 60 * Driver needs to know address, irq and flag pin.
61 */ 61 */
62 62
63#define ISP1761_BASE 0x203C0000
64#define ISP1761_IRQ IRQ_PF7
65
66#if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE) 63#if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
67static struct resource bfin_isp1761_resources[] = { 64#include <linux/usb/isp1760.h>
65static struct resource bfin_isp1760_resources[] = {
68 [0] = { 66 [0] = {
69 .name = "isp1761-regs", 67 .start = 0x203C0000,
70 .start = ISP1761_BASE + 0x00000000, 68 .end = 0x203C0000 + 0x000fffff,
71 .end = ISP1761_BASE + 0x000fffff,
72 .flags = IORESOURCE_MEM, 69 .flags = IORESOURCE_MEM,
73 }, 70 },
74 [1] = { 71 [1] = {
75 .start = ISP1761_IRQ, 72 .start = IRQ_PF7,
76 .end = ISP1761_IRQ, 73 .end = IRQ_PF7,
77 .flags = IORESOURCE_IRQ, 74 .flags = IORESOURCE_IRQ,
78 }, 75 },
79}; 76};
80 77
81static struct platform_device bfin_isp1761_device = { 78static struct isp1760_platform_data isp1760_priv = {
82 .name = "isp1761", 79 .is_isp1761 = 0,
83 .id = 0, 80 .port1_disable = 0,
84 .num_resources = ARRAY_SIZE(bfin_isp1761_resources), 81 .bus_width_16 = 1,
85 .resource = bfin_isp1761_resources, 82 .port1_otg = 0,
83 .analog_oc = 0,
84 .dack_polarity_high = 0,
85 .dreq_polarity_high = 0,
86}; 86};
87 87
88static struct platform_device *bfin_isp1761_devices[] = { 88static struct platform_device bfin_isp1760_device = {
89 &bfin_isp1761_device, 89 .name = "isp1760-hcd",
90 .id = 0,
91 .dev = {
92 .platform_data = &isp1760_priv,
93 },
94 .num_resources = ARRAY_SIZE(bfin_isp1760_resources),
95 .resource = bfin_isp1760_resources,
90}; 96};
91
92int __init bfin_isp1761_init(void)
93{
94 unsigned int num_devices = ARRAY_SIZE(bfin_isp1761_devices);
95
96 printk(KERN_INFO "%s(): registering device resources\n", __func__);
97 set_irq_type(ISP1761_IRQ, IRQF_TRIGGER_FALLING);
98
99 return platform_add_devices(bfin_isp1761_devices, num_devices);
100}
101
102void __exit bfin_isp1761_exit(void)
103{
104 platform_device_unregister(&bfin_isp1761_device);
105}
106
107arch_initcall(bfin_isp1761_init);
108#endif 97#endif
109 98
110#if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE) 99#if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
@@ -131,8 +120,8 @@ static struct musb_hdrc_config musb_config = {
131 .dyn_fifo = 0, 120 .dyn_fifo = 0,
132 .soft_con = 1, 121 .soft_con = 1,
133 .dma = 1, 122 .dma = 1,
134 .num_eps = 7, 123 .num_eps = 8,
135 .dma_channels = 7, 124 .dma_channels = 8,
136 .gpio_vrsel = GPIO_PG13, 125 .gpio_vrsel = GPIO_PG13,
137}; 126};
138 127
@@ -515,13 +504,6 @@ static struct bfin5xx_spi_chip ad9960_spi_chip_info = {
515}; 504};
516#endif 505#endif
517 506
518#if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE)
519static struct bfin5xx_spi_chip spi_mmc_chip_info = {
520 .enable_dma = 1,
521 .bits_per_word = 8,
522};
523#endif
524
525#if defined(CONFIG_PBX) 507#if defined(CONFIG_PBX)
526static struct bfin5xx_spi_chip spi_si3xxx_chip_info = { 508static struct bfin5xx_spi_chip spi_si3xxx_chip_info = {
527 .ctl_reg = 0x4, /* send zero */ 509 .ctl_reg = 0x4, /* send zero */
@@ -552,6 +534,30 @@ static const struct ad7877_platform_data bfin_ad7877_ts_info = {
552}; 534};
553#endif 535#endif
554 536
537#if defined(CONFIG_TOUCHSCREEN_AD7879) || defined(CONFIG_TOUCHSCREEN_AD7879_MODULE)
538#include <linux/spi/ad7879.h>
539static const struct ad7879_platform_data bfin_ad7879_ts_info = {
540 .model = 7879, /* Model = AD7879 */
541 .x_plate_ohms = 620, /* 620 Ohm from the touch datasheet */
542 .pressure_max = 10000,
543 .pressure_min = 0,
544 .first_conversion_delay = 3, /* wait 512us before do a first conversion */
545 .acquisition_time = 1, /* 4us acquisition time per sample */
546 .median = 2, /* do 8 measurements */
547 .averaging = 1, /* take the average of 4 middle samples */
548 .pen_down_acc_interval = 255, /* 9.4 ms */
549 .gpio_output = 1, /* configure AUX/VBAT/GPIO as GPIO output */
550 .gpio_default = 1, /* During initialization set GPIO = HIGH */
551};
552#endif
553
554#if defined(CONFIG_TOUCHSCREEN_AD7879_SPI) || defined(CONFIG_TOUCHSCREEN_AD7879_SPI_MODULE)
555static struct bfin5xx_spi_chip spi_ad7879_chip_info = {
556 .enable_dma = 0,
557 .bits_per_word = 16,
558};
559#endif
560
555#if defined(CONFIG_SND_SOC_WM8731) || defined(CONFIG_SND_SOC_WM8731_MODULE) \ 561#if defined(CONFIG_SND_SOC_WM8731) || defined(CONFIG_SND_SOC_WM8731_MODULE) \
556 && defined(CONFIG_SND_SOC_WM8731_SPI) 562 && defined(CONFIG_SND_SOC_WM8731_SPI)
557static struct bfin5xx_spi_chip spi_wm8731_chip_info = { 563static struct bfin5xx_spi_chip spi_wm8731_chip_info = {
@@ -613,26 +619,6 @@ static struct spi_board_info bfin_spi_board_info[] __initdata = {
613 .controller_data = &ad9960_spi_chip_info, 619 .controller_data = &ad9960_spi_chip_info,
614 }, 620 },
615#endif 621#endif
616#if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE)
617 {
618 .modalias = "spi_mmc_dummy",
619 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
620 .bus_num = 0,
621 .chip_select = 0,
622 .platform_data = NULL,
623 .controller_data = &spi_mmc_chip_info,
624 .mode = SPI_MODE_3,
625 },
626 {
627 .modalias = "spi_mmc",
628 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
629 .bus_num = 0,
630 .chip_select = CONFIG_SPI_MMC_CS_CHAN,
631 .platform_data = NULL,
632 .controller_data = &spi_mmc_chip_info,
633 .mode = SPI_MODE_3,
634 },
635#endif
636#if defined(CONFIG_PBX) 622#if defined(CONFIG_PBX)
637 { 623 {
638 .modalias = "fxs-spi", 624 .modalias = "fxs-spi",
@@ -662,6 +648,18 @@ static struct spi_board_info bfin_spi_board_info[] __initdata = {
662 .controller_data = &spi_ad7877_chip_info, 648 .controller_data = &spi_ad7877_chip_info,
663 }, 649 },
664#endif 650#endif
651#if defined(CONFIG_TOUCHSCREEN_AD7879_SPI) || defined(CONFIG_TOUCHSCREEN_AD7879_SPI_MODULE)
652 {
653 .modalias = "ad7879",
654 .platform_data = &bfin_ad7879_ts_info,
655 .irq = IRQ_PF8,
656 .max_speed_hz = 5000000, /* max spi clock (SCK) speed in HZ */
657 .bus_num = 0,
658 .chip_select = 3,
659 .controller_data = &spi_ad7879_chip_info,
660 .mode = SPI_CPHA | SPI_CPOL,
661 },
662#endif
665#if defined(CONFIG_SND_SOC_WM8731) || defined(CONFIG_SND_SOC_WM8731_MODULE) \ 663#if defined(CONFIG_SND_SOC_WM8731) || defined(CONFIG_SND_SOC_WM8731_MODULE) \
666 && defined(CONFIG_SND_SOC_WM8731_SPI) 664 && defined(CONFIG_SND_SOC_WM8731_SPI)
667 { 665 {
@@ -756,30 +754,59 @@ static struct platform_device bfin_uart_device = {
756#endif 754#endif
757 755
758#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE) 756#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
759static struct resource bfin_sir_resources[] = {
760#ifdef CONFIG_BFIN_SIR0 757#ifdef CONFIG_BFIN_SIR0
758static struct resource bfin_sir0_resources[] = {
761 { 759 {
762 .start = 0xFFC00400, 760 .start = 0xFFC00400,
763 .end = 0xFFC004FF, 761 .end = 0xFFC004FF,
764 .flags = IORESOURCE_MEM, 762 .flags = IORESOURCE_MEM,
765 }, 763 },
764 {
765 .start = IRQ_UART0_RX,
766 .end = IRQ_UART0_RX+1,
767 .flags = IORESOURCE_IRQ,
768 },
769 {
770 .start = CH_UART0_RX,
771 .end = CH_UART0_RX+1,
772 .flags = IORESOURCE_DMA,
773 },
774};
775
776static struct platform_device bfin_sir0_device = {
777 .name = "bfin_sir",
778 .id = 0,
779 .num_resources = ARRAY_SIZE(bfin_sir0_resources),
780 .resource = bfin_sir0_resources,
781};
766#endif 782#endif
767#ifdef CONFIG_BFIN_SIR1 783#ifdef CONFIG_BFIN_SIR1
784static struct resource bfin_sir1_resources[] = {
768 { 785 {
769 .start = 0xFFC02000, 786 .start = 0xFFC02000,
770 .end = 0xFFC020FF, 787 .end = 0xFFC020FF,
771 .flags = IORESOURCE_MEM, 788 .flags = IORESOURCE_MEM,
772 }, 789 },
773#endif 790 {
791 .start = IRQ_UART1_RX,
792 .end = IRQ_UART1_RX+1,
793 .flags = IORESOURCE_IRQ,
794 },
795 {
796 .start = CH_UART1_RX,
797 .end = CH_UART1_RX+1,
798 .flags = IORESOURCE_DMA,
799 },
774}; 800};
775 801
776static struct platform_device bfin_sir_device = { 802static struct platform_device bfin_sir1_device = {
777 .name = "bfin_sir", 803 .name = "bfin_sir",
778 .id = 0, 804 .id = 1,
779 .num_resources = ARRAY_SIZE(bfin_sir_resources), 805 .num_resources = ARRAY_SIZE(bfin_sir1_resources),
780 .resource = bfin_sir_resources, 806 .resource = bfin_sir1_resources,
781}; 807};
782#endif 808#endif
809#endif
783 810
784#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE) 811#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
785static struct resource bfin_twi0_resource[] = { 812static struct resource bfin_twi0_resource[] = {
@@ -944,6 +971,10 @@ static struct platform_device *stamp_devices[] __initdata = {
944 &isp1362_hcd_device, 971 &isp1362_hcd_device,
945#endif 972#endif
946 973
974#if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
975 &bfin_isp1760_device,
976#endif
977
947#if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE) 978#if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
948 &musb_device, 979 &musb_device,
949#endif 980#endif
@@ -985,7 +1016,12 @@ static struct platform_device *stamp_devices[] __initdata = {
985#endif 1016#endif
986 1017
987#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE) 1018#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
988 &bfin_sir_device, 1019#ifdef CONFIG_BFIN_SIR0
1020 &bfin_sir0_device,
1021#endif
1022#ifdef CONFIG_BFIN_SIR1
1023 &bfin_sir1_device,
1024#endif
989#endif 1025#endif
990 1026
991#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE) 1027#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
diff --git a/arch/blackfin/mach-bf527/dma.c b/arch/blackfin/mach-bf527/dma.c
index dfd080cda787..231877578243 100644
--- a/arch/blackfin/mach-bf527/dma.c
+++ b/arch/blackfin/mach-bf527/dma.c
@@ -31,7 +31,7 @@
31#include <asm/blackfin.h> 31#include <asm/blackfin.h>
32#include <asm/dma.h> 32#include <asm/dma.h>
33 33
34struct dma_register *dma_io_base_addr[MAX_BLACKFIN_DMA_CHANNEL] = { 34struct dma_register *dma_io_base_addr[MAX_DMA_CHANNELS] = {
35 (struct dma_register *) DMA0_NEXT_DESC_PTR, 35 (struct dma_register *) DMA0_NEXT_DESC_PTR,
36 (struct dma_register *) DMA1_NEXT_DESC_PTR, 36 (struct dma_register *) DMA1_NEXT_DESC_PTR,
37 (struct dma_register *) DMA2_NEXT_DESC_PTR, 37 (struct dma_register *) DMA2_NEXT_DESC_PTR,
diff --git a/arch/blackfin/mach-bf527/head.S b/arch/blackfin/mach-bf527/head.S
deleted file mode 100644
index 0eb1da85db73..000000000000
--- a/arch/blackfin/mach-bf527/head.S
+++ /dev/null
@@ -1,146 +0,0 @@
1/*
2 * File: arch/blackfin/mach-bf527/head.S
3 * Based on: arch/blackfin/mach-bf533/head.S
4 * Author: Jeff Dionne <jeff@uclinux.org> COPYRIGHT 1998 D. Jeff Dionne
5 *
6 * Created: 1998
7 * Description: Startup code for Blackfin BF537
8 *
9 * Modified:
10 * Copyright 2004-2007 Analog Devices Inc.
11 *
12 * Bugs: Enter bugs at http://blackfin.uclinux.org/
13 *
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 2 of the License, or
17 * (at your option) any later version.
18 *
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
23 *
24 * You should have received a copy of the GNU General Public License
25 * along with this program; if not, see the file COPYING, or write
26 * to the Free Software Foundation, Inc.,
27 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
28 */
29
30#include <linux/linkage.h>
31#include <linux/init.h>
32#include <asm/blackfin.h>
33#ifdef CONFIG_BFIN_KERNEL_CLOCK
34#include <asm/clocks.h>
35#include <mach/mem_init.h>
36#endif
37
38.section .l1.text
39#ifdef CONFIG_BFIN_KERNEL_CLOCK
40ENTRY(_start_dma_code)
41
42 /* Enable PHY CLK buffer output */
43 p0.h = hi(VR_CTL);
44 p0.l = lo(VR_CTL);
45 r0.l = w[p0];
46 bitset(r0, 14);
47 w[p0] = r0.l;
48 ssync;
49
50 p0.h = hi(SIC_IWR0);
51 p0.l = lo(SIC_IWR0);
52 r0.l = 0x1;
53 r0.h = 0x0;
54 [p0] = r0;
55 SSYNC;
56
57 /*
58 * Set PLL_CTL
59 * - [14:09] = MSEL[5:0] : CLKIN / VCO multiplication factors
60 * - [8] = BYPASS : BYPASS the PLL, run CLKIN into CCLK/SCLK
61 * - [7] = output delay (add 200ps of delay to mem signals)
62 * - [6] = input delay (add 200ps of input delay to mem signals)
63 * - [5] = PDWN : 1=All Clocks off
64 * - [3] = STOPCK : 1=Core Clock off
65 * - [1] = PLL_OFF : 1=Disable Power to PLL
66 * - [0] = DF : 1=Pass CLKIN/2 to PLL / 0=Pass CLKIN to PLL
67 * all other bits set to zero
68 */
69
70 p0.h = hi(PLL_LOCKCNT);
71 p0.l = lo(PLL_LOCKCNT);
72 r0 = 0x300(Z);
73 w[p0] = r0.l;
74 ssync;
75
76 P2.H = hi(EBIU_SDGCTL);
77 P2.L = lo(EBIU_SDGCTL);
78 R0 = [P2];
79 BITSET (R0, 24);
80 [P2] = R0;
81 SSYNC;
82
83 r0 = CONFIG_VCO_MULT & 63; /* Load the VCO multiplier */
84 r0 = r0 << 9; /* Shift it over, */
85 r1 = CLKIN_HALF; /* Do we need to divide CLKIN by 2?*/
86 r0 = r1 | r0;
87 r1 = PLL_BYPASS; /* Bypass the PLL? */
88 r1 = r1 << 8; /* Shift it over */
89 r0 = r1 | r0; /* add them all together */
90#ifdef ANOMALY_05000265
91 BITSET(r0, 15); /* Add 250 mV of hysteresis to SPORT input pins */
92#endif
93
94 p0.h = hi(PLL_CTL);
95 p0.l = lo(PLL_CTL); /* Load the address */
96 cli r2; /* Disable interrupts */
97 ssync;
98 w[p0] = r0.l; /* Set the value */
99 idle; /* Wait for the PLL to stablize */
100 sti r2; /* Enable interrupts */
101
102.Lcheck_again:
103 p0.h = hi(PLL_STAT);
104 p0.l = lo(PLL_STAT);
105 R0 = W[P0](Z);
106 CC = BITTST(R0,5);
107 if ! CC jump .Lcheck_again;
108
109 /* Configure SCLK & CCLK Dividers */
110 r0 = (CONFIG_CCLK_ACT_DIV | CONFIG_SCLK_DIV);
111 p0.h = hi(PLL_DIV);
112 p0.l = lo(PLL_DIV);
113 w[p0] = r0.l;
114 ssync;
115
116 p0.l = lo(EBIU_SDRRC);
117 p0.h = hi(EBIU_SDRRC);
118 r0 = mem_SDRRC;
119 w[p0] = r0.l;
120 ssync;
121
122 P2.H = hi(EBIU_SDGCTL);
123 P2.L = lo(EBIU_SDGCTL);
124 R0 = [P2];
125 BITCLR (R0, 24);
126 p0.h = hi(EBIU_SDSTAT);
127 p0.l = lo(EBIU_SDSTAT);
128 r2.l = w[p0];
129 cc = bittst(r2,3);
130 if !cc jump .Lskip;
131 NOP;
132 BITSET (R0, 23);
133.Lskip:
134 [P2] = R0;
135 SSYNC;
136
137 R0.L = lo(mem_SDGCTL);
138 R0.H = hi(mem_SDGCTL);
139 R1 = [p2];
140 R1 = R1 | R0;
141 [P2] = R1;
142 SSYNC;
143
144 RTS;
145ENDPROC(_start_dma_code)
146#endif /* CONFIG_BFIN_KERNEL_CLOCK */
diff --git a/arch/blackfin/mach-bf527/include/mach/anomaly.h b/arch/blackfin/mach-bf527/include/mach/anomaly.h
index 62373e61c585..035e8d835058 100644
--- a/arch/blackfin/mach-bf527/include/mach/anomaly.h
+++ b/arch/blackfin/mach-bf527/include/mach/anomaly.h
@@ -28,7 +28,7 @@
28/* Multi-Issue Instruction with dsp32shiftimm in slot1 and P-reg Store in slot2 Not Supported */ 28/* Multi-Issue Instruction with dsp32shiftimm in slot1 and P-reg Store in slot2 Not Supported */
29#define ANOMALY_05000074 (1) 29#define ANOMALY_05000074 (1)
30/* DMA_RUN Bit Is Not Valid after a Peripheral Receive Channel DMA Stops */ 30/* DMA_RUN Bit Is Not Valid after a Peripheral Receive Channel DMA Stops */
31#define ANOMALY_05000119 (1) 31#define ANOMALY_05000119 (1) /* note: brokenness is noted in documentation, not anomaly sheet */
32/* Rx.H Cannot Be Used to Access 16-bit System MMR Registers */ 32/* Rx.H Cannot Be Used to Access 16-bit System MMR Registers */
33#define ANOMALY_05000122 (1) 33#define ANOMALY_05000122 (1)
34/* Spurious Hardware Error from an Access in the Shadow of a Conditional Branch */ 34/* Spurious Hardware Error from an Access in the Shadow of a Conditional Branch */
@@ -37,8 +37,6 @@
37#define ANOMALY_05000265 (1) 37#define ANOMALY_05000265 (1)
38/* False Hardware Errors Caused by Fetches at the Boundary of Reserved Memory */ 38/* False Hardware Errors Caused by Fetches at the Boundary of Reserved Memory */
39#define ANOMALY_05000310 (1) 39#define ANOMALY_05000310 (1)
40/* Errors when SSYNC, CSYNC, or Loads to LT, LB and LC Registers Are Interrupted */
41#define ANOMALY_05000312 (ANOMALY_BF527)
42/* PPI Is Level-Sensitive on First Transfer In Single Frame Sync Modes */ 40/* PPI Is Level-Sensitive on First Transfer In Single Frame Sync Modes */
43#define ANOMALY_05000313 (__SILICON_REVISION__ < 2) 41#define ANOMALY_05000313 (__SILICON_REVISION__ < 2)
44/* Incorrect Access of OTP_STATUS During otp_write() Function */ 42/* Incorrect Access of OTP_STATUS During otp_write() Function */
@@ -153,6 +151,10 @@
153#define ANOMALY_05000430 (ANOMALY_BF527 && __SILICON_REVISION__ > 1) 151#define ANOMALY_05000430 (ANOMALY_BF527 && __SILICON_REVISION__ > 1)
154/* bfrom_SysControl() Does Not Clear SIC_IWR1 Before Executing PLL Programming Sequence */ 152/* bfrom_SysControl() Does Not Clear SIC_IWR1 Before Executing PLL Programming Sequence */
155#define ANOMALY_05000432 (ANOMALY_BF526) 153#define ANOMALY_05000432 (ANOMALY_BF526)
154/* Certain SIC Registers are not Reset After Soft or Core Double Fault Reset */
155#define ANOMALY_05000435 ((ANOMALY_BF526 && __SILICON_REVISION__ < 1) || ANOMALY_BF527)
156/* IFLUSH Instruction at End of Hardware Loop Causes Infinite Stall */
157#define ANOMALY_05000443 (1)
156 158
157/* Anomalies that don't exist on this proc */ 159/* Anomalies that don't exist on this proc */
158#define ANOMALY_05000125 (0) 160#define ANOMALY_05000125 (0)
@@ -168,7 +170,9 @@
168#define ANOMALY_05000285 (0) 170#define ANOMALY_05000285 (0)
169#define ANOMALY_05000307 (0) 171#define ANOMALY_05000307 (0)
170#define ANOMALY_05000311 (0) 172#define ANOMALY_05000311 (0)
173#define ANOMALY_05000312 (0)
171#define ANOMALY_05000323 (0) 174#define ANOMALY_05000323 (0)
172#define ANOMALY_05000363 (0) 175#define ANOMALY_05000363 (0)
176#define ANOMALY_05000412 (0)
173 177
174#endif 178#endif
diff --git a/arch/blackfin/mach-bf527/include/mach/bf527.h b/arch/blackfin/mach-bf527/include/mach/bf527.h
index 144f08d3f8ea..3832aab11e9a 100644
--- a/arch/blackfin/mach-bf527/include/mach/bf527.h
+++ b/arch/blackfin/mach-bf527/include/mach/bf527.h
@@ -110,7 +110,7 @@
110 110
111#ifdef CONFIG_BF527 111#ifdef CONFIG_BF527
112#define CPU "BF527" 112#define CPU "BF527"
113#define CPUID 0x27e4 113#define CPUID 0x27e0
114#endif 114#endif
115#ifdef CONFIG_BF526 115#ifdef CONFIG_BF526
116#define CPU "BF526" 116#define CPU "BF526"
@@ -118,7 +118,7 @@
118#endif 118#endif
119#ifdef CONFIG_BF525 119#ifdef CONFIG_BF525
120#define CPU "BF525" 120#define CPU "BF525"
121#define CPUID 0x27e4 121#define CPUID 0x27e0
122#endif 122#endif
123#ifdef CONFIG_BF524 123#ifdef CONFIG_BF524
124#define CPU "BF524" 124#define CPU "BF524"
@@ -126,7 +126,7 @@
126#endif 126#endif
127#ifdef CONFIG_BF523 127#ifdef CONFIG_BF523
128#define CPU "BF523" 128#define CPU "BF523"
129#define CPUID 0x27e4 129#define CPUID 0x27e0
130#endif 130#endif
131#ifdef CONFIG_BF522 131#ifdef CONFIG_BF522
132#define CPU "BF522" 132#define CPU "BF522"
@@ -134,7 +134,7 @@
134#endif 134#endif
135 135
136#ifndef CPU 136#ifndef CPU
137#error Unknown CPU type - This kernel doesn't seem to be configured properly 137#error "Unknown CPU type - This kernel doesn't seem to be configured properly"
138#endif 138#endif
139 139
140#endif /* __MACH_BF527_H__ */ 140#endif /* __MACH_BF527_H__ */
diff --git a/arch/blackfin/mach-bf527/include/mach/bfin_sir.h b/arch/blackfin/mach-bf527/include/mach/bfin_sir.h
deleted file mode 100644
index cfd8ad4f1f2c..000000000000
--- a/arch/blackfin/mach-bf527/include/mach/bfin_sir.h
+++ /dev/null
@@ -1,142 +0,0 @@
1/*
2 * Blackfin Infra-red Driver
3 *
4 * Copyright 2006-2008 Analog Devices Inc.
5 *
6 * Enter bugs at http://blackfin.uclinux.org/
7 *
8 * Licensed under the GPL-2 or later.
9 *
10 */
11
12#include <linux/serial.h>
13#include <asm/dma.h>
14#include <asm/portmux.h>
15
16#define SIR_UART_GET_CHAR(port) bfin_read16((port)->membase + OFFSET_RBR)
17#define SIR_UART_GET_DLL(port) bfin_read16((port)->membase + OFFSET_DLL)
18#define SIR_UART_GET_IER(port) bfin_read16((port)->membase + OFFSET_IER)
19#define SIR_UART_GET_DLH(port) bfin_read16((port)->membase + OFFSET_DLH)
20#define SIR_UART_GET_IIR(port) bfin_read16((port)->membase + OFFSET_IIR)
21#define SIR_UART_GET_LCR(port) bfin_read16((port)->membase + OFFSET_LCR)
22#define SIR_UART_GET_GCTL(port) bfin_read16((port)->membase + OFFSET_GCTL)
23
24#define SIR_UART_PUT_CHAR(port, v) bfin_write16(((port)->membase + OFFSET_THR), v)
25#define SIR_UART_PUT_DLL(port, v) bfin_write16(((port)->membase + OFFSET_DLL), v)
26#define SIR_UART_PUT_IER(port, v) bfin_write16(((port)->membase + OFFSET_IER), v)
27#define SIR_UART_PUT_DLH(port, v) bfin_write16(((port)->membase + OFFSET_DLH), v)
28#define SIR_UART_PUT_LCR(port, v) bfin_write16(((port)->membase + OFFSET_LCR), v)
29#define SIR_UART_PUT_GCTL(port, v) bfin_write16(((port)->membase + OFFSET_GCTL), v)
30
31#ifdef CONFIG_SIR_BFIN_DMA
32struct dma_rx_buf {
33 char *buf;
34 int head;
35 int tail;
36 };
37#endif /* CONFIG_SIR_BFIN_DMA */
38
39struct bfin_sir_port {
40 unsigned char __iomem *membase;
41 unsigned int irq;
42 unsigned int lsr;
43 unsigned long clk;
44 struct net_device *dev;
45#ifdef CONFIG_SIR_BFIN_DMA
46 int tx_done;
47 struct dma_rx_buf rx_dma_buf;
48 struct timer_list rx_dma_timer;
49 int rx_dma_nrows;
50#endif /* CONFIG_SIR_BFIN_DMA */
51 unsigned int tx_dma_channel;
52 unsigned int rx_dma_channel;
53};
54
55struct bfin_sir_port sir_ports[BFIN_UART_NR_PORTS];
56
57struct bfin_sir_port_res {
58 unsigned long base_addr;
59 int irq;
60 unsigned int rx_dma_channel;
61 unsigned int tx_dma_channel;
62};
63
64struct bfin_sir_port_res bfin_sir_port_resource[] = {
65#ifdef CONFIG_BFIN_SIR0
66 {
67 0xFFC00400,
68 IRQ_UART0_RX,
69 CH_UART0_RX,
70 CH_UART0_TX,
71 },
72#endif
73#ifdef CONFIG_BFIN_SIR1
74 {
75 0xFFC02000,
76 IRQ_UART1_RX,
77 CH_UART1_RX,
78 CH_UART1_TX,
79 },
80#endif
81};
82
83int nr_sirs = ARRAY_SIZE(bfin_sir_port_resource);
84
85struct bfin_sir_self {
86 struct bfin_sir_port *sir_port;
87 spinlock_t lock;
88 unsigned int open;
89 int speed;
90 int newspeed;
91
92 struct sk_buff *txskb;
93 struct sk_buff *rxskb;
94 struct net_device_stats stats;
95 struct device *dev;
96 struct irlap_cb *irlap;
97 struct qos_info qos;
98
99 iobuff_t tx_buff;
100 iobuff_t rx_buff;
101
102 struct work_struct work;
103 int mtt;
104};
105
106static inline unsigned int SIR_UART_GET_LSR(struct bfin_sir_port *port)
107{
108 unsigned int lsr = bfin_read16(port->membase + OFFSET_LSR);
109 port->lsr |= (lsr & (BI|FE|PE|OE));
110 return lsr | port->lsr;
111}
112
113static inline void SIR_UART_CLEAR_LSR(struct bfin_sir_port *port)
114{
115 port->lsr = 0;
116 bfin_read16(port->membase + OFFSET_LSR);
117}
118
119#define DRIVER_NAME "bfin_sir"
120
121static int bfin_sir_hw_init(void)
122{
123 int ret = -ENODEV;
124#ifdef CONFIG_BFIN_SIR0
125 ret = peripheral_request(P_UART0_TX, DRIVER_NAME);
126 if (ret)
127 return ret;
128 ret = peripheral_request(P_UART0_RX, DRIVER_NAME);
129 if (ret)
130 return ret;
131#endif
132
133#ifdef CONFIG_BFIN_SIR1
134 ret = peripheral_request(P_UART1_TX, DRIVER_NAME);
135 if (ret)
136 return ret;
137 ret = peripheral_request(P_UART1_RX, DRIVER_NAME);
138 if (ret)
139 return ret;
140#endif
141 return ret;
142}
diff --git a/arch/blackfin/mach-bf527/include/mach/cdefBF52x_base.h b/arch/blackfin/mach-bf527/include/mach/cdefBF52x_base.h
index 9a814b9a12b9..1fe76d8e0403 100644
--- a/arch/blackfin/mach-bf527/include/mach/cdefBF52x_base.h
+++ b/arch/blackfin/mach-bf527/include/mach/cdefBF52x_base.h
@@ -31,7 +31,6 @@
31#ifndef _CDEF_BF52X_H 31#ifndef _CDEF_BF52X_H
32#define _CDEF_BF52X_H 32#define _CDEF_BF52X_H
33 33
34#include <asm/system.h>
35#include <asm/blackfin.h> 34#include <asm/blackfin.h>
36 35
37#include "defBF52x_base.h" 36#include "defBF52x_base.h"
@@ -43,57 +42,9 @@
43 42
44/* Clock and System Control (0xFFC00000 - 0xFFC000FF) */ 43/* Clock and System Control (0xFFC00000 - 0xFFC000FF) */
45#define bfin_read_PLL_CTL() bfin_read16(PLL_CTL) 44#define bfin_read_PLL_CTL() bfin_read16(PLL_CTL)
46/* Writing to PLL_CTL initiates a PLL relock sequence. */
47static __inline__ void bfin_write_PLL_CTL(unsigned int val)
48{
49 unsigned long flags, iwr0, iwr1;
50
51 if (val == bfin_read_PLL_CTL())
52 return;
53
54 local_irq_save(flags);
55 /* Enable the PLL Wakeup bit in SIC IWR */
56 iwr0 = bfin_read32(SIC_IWR0);
57 iwr1 = bfin_read32(SIC_IWR1);
58 /* Only allow PPL Wakeup) */
59 bfin_write32(SIC_IWR0, IWR_ENABLE(0));
60 bfin_write32(SIC_IWR1, 0);
61
62 bfin_write16(PLL_CTL, val);
63 SSYNC();
64 asm("IDLE;");
65
66 bfin_write32(SIC_IWR0, iwr0);
67 bfin_write32(SIC_IWR1, iwr1);
68 local_irq_restore(flags);
69}
70#define bfin_read_PLL_DIV() bfin_read16(PLL_DIV) 45#define bfin_read_PLL_DIV() bfin_read16(PLL_DIV)
71#define bfin_write_PLL_DIV(val) bfin_write16(PLL_DIV, val) 46#define bfin_write_PLL_DIV(val) bfin_write16(PLL_DIV, val)
72#define bfin_read_VR_CTL() bfin_read16(VR_CTL) 47#define bfin_read_VR_CTL() bfin_read16(VR_CTL)
73/* Writing to VR_CTL initiates a PLL relock sequence. */
74static __inline__ void bfin_write_VR_CTL(unsigned int val)
75{
76 unsigned long flags, iwr0, iwr1;
77
78 if (val == bfin_read_VR_CTL())
79 return;
80
81 local_irq_save(flags);
82 /* Enable the PLL Wakeup bit in SIC IWR */
83 iwr0 = bfin_read32(SIC_IWR0);
84 iwr1 = bfin_read32(SIC_IWR1);
85 /* Only allow PPL Wakeup) */
86 bfin_write32(SIC_IWR0, IWR_ENABLE(0));
87 bfin_write32(SIC_IWR1, 0);
88
89 bfin_write16(VR_CTL, val);
90 SSYNC();
91 asm("IDLE;");
92
93 bfin_write32(SIC_IWR0, iwr0);
94 bfin_write32(SIC_IWR1, iwr1);
95 local_irq_restore(flags);
96}
97#define bfin_read_PLL_STAT() bfin_read16(PLL_STAT) 48#define bfin_read_PLL_STAT() bfin_read16(PLL_STAT)
98#define bfin_write_PLL_STAT(val) bfin_write16(PLL_STAT, val) 49#define bfin_write_PLL_STAT(val) bfin_write16(PLL_STAT, val)
99#define bfin_read_PLL_LOCKCNT() bfin_read16(PLL_LOCKCNT) 50#define bfin_read_PLL_LOCKCNT() bfin_read16(PLL_LOCKCNT)
@@ -1201,4 +1152,57 @@ static __inline__ void bfin_write_VR_CTL(unsigned int val)
1201#define bfin_read_NFC_DATA_RD() bfin_read16(NFC_DATA_RD) 1152#define bfin_read_NFC_DATA_RD() bfin_read16(NFC_DATA_RD)
1202#define bfin_write_NFC_DATA_RD(val) bfin_write16(NFC_DATA_RD, val) 1153#define bfin_write_NFC_DATA_RD(val) bfin_write16(NFC_DATA_RD, val)
1203 1154
1155/* These need to be last due to the cdef/linux inter-dependencies */
1156#include <asm/irq.h>
1157
1158/* Writing to PLL_CTL initiates a PLL relock sequence. */
1159static __inline__ void bfin_write_PLL_CTL(unsigned int val)
1160{
1161 unsigned long flags, iwr0, iwr1;
1162
1163 if (val == bfin_read_PLL_CTL())
1164 return;
1165
1166 local_irq_save_hw(flags);
1167 /* Enable the PLL Wakeup bit in SIC IWR */
1168 iwr0 = bfin_read32(SIC_IWR0);
1169 iwr1 = bfin_read32(SIC_IWR1);
1170 /* Only allow PPL Wakeup) */
1171 bfin_write32(SIC_IWR0, IWR_ENABLE(0));
1172 bfin_write32(SIC_IWR1, 0);
1173
1174 bfin_write16(PLL_CTL, val);
1175 SSYNC();
1176 asm("IDLE;");
1177
1178 bfin_write32(SIC_IWR0, iwr0);
1179 bfin_write32(SIC_IWR1, iwr1);
1180 local_irq_restore_hw(flags);
1181}
1182
1183/* Writing to VR_CTL initiates a PLL relock sequence. */
1184static __inline__ void bfin_write_VR_CTL(unsigned int val)
1185{
1186 unsigned long flags, iwr0, iwr1;
1187
1188 if (val == bfin_read_VR_CTL())
1189 return;
1190
1191 local_irq_save_hw(flags);
1192 /* Enable the PLL Wakeup bit in SIC IWR */
1193 iwr0 = bfin_read32(SIC_IWR0);
1194 iwr1 = bfin_read32(SIC_IWR1);
1195 /* Only allow PPL Wakeup) */
1196 bfin_write32(SIC_IWR0, IWR_ENABLE(0));
1197 bfin_write32(SIC_IWR1, 0);
1198
1199 bfin_write16(VR_CTL, val);
1200 SSYNC();
1201 asm("IDLE;");
1202
1203 bfin_write32(SIC_IWR0, iwr0);
1204 bfin_write32(SIC_IWR1, iwr1);
1205 local_irq_restore_hw(flags);
1206}
1207
1204#endif /* _CDEF_BF52X_H */ 1208#endif /* _CDEF_BF52X_H */
diff --git a/arch/blackfin/mach-bf527/include/mach/dma.h b/arch/blackfin/mach-bf527/include/mach/dma.h
index 49dd693223e8..eb287da101a2 100644
--- a/arch/blackfin/mach-bf527/include/mach/dma.h
+++ b/arch/blackfin/mach-bf527/include/mach/dma.h
@@ -1,38 +1,14 @@
1/* 1/* mach/dma.h - arch-specific DMA defines
2 * file: include/asm-blackfin/mach-bf527/dma.h
3 * based on: include/asm-blackfin/mach-bf537/dma.h
4 * author: Michael Hennerich (michael.hennerich@analog.com)
5 * 2 *
6 * created: 3 * Copyright 2004-2008 Analog Devices Inc.
7 * description:
8 * system DMA map
9 * rev:
10 * 4 *
11 * modified: 5 * Licensed under the GPL-2 or later.
12 *
13 *
14 * bugs: enter bugs at http://blackfin.uclinux.org/
15 *
16 * this program is free software; you can redistribute it and/or modify
17 * it under the terms of the gnu general public license as published by
18 * the free software foundation; either version 2, or (at your option)
19 * any later version.
20 *
21 * this program is distributed in the hope that it will be useful,
22 * but without any warranty; without even the implied warranty of
23 * merchantability or fitness for a particular purpose. see the
24 * gnu general public license for more details.
25 *
26 * you should have received a copy of the gnu general public license
27 * along with this program; see the file copying.
28 * if not, write to the free software foundation,
29 * 59 temple place - suite 330, boston, ma 02111-1307, usa.
30 */ 6 */
31 7
32#ifndef _MACH_DMA_H_ 8#ifndef _MACH_DMA_H_
33#define _MACH_DMA_H_ 9#define _MACH_DMA_H_
34 10
35#define MAX_BLACKFIN_DMA_CHANNEL 16 11#define MAX_DMA_CHANNELS 16
36 12
37#define CH_PPI 0 /* PPI receive/transmit or NFC */ 13#define CH_PPI 0 /* PPI receive/transmit or NFC */
38#define CH_EMAC_RX 1 /* Ethernet MAC receive or HOSTDP */ 14#define CH_EMAC_RX 1 /* Ethernet MAC receive or HOSTDP */
diff --git a/arch/blackfin/mach-bf527/include/mach/gpio.h b/arch/blackfin/mach-bf527/include/mach/gpio.h
new file mode 100644
index 000000000000..06b6eebf0d49
--- /dev/null
+++ b/arch/blackfin/mach-bf527/include/mach/gpio.h
@@ -0,0 +1,68 @@
1/*
2 * File: arch/blackfin/mach-bf527/include/mach/gpio.h
3 * Bugs: Enter bugs at http://blackfin.uclinux.org/
4 *
5 * Copyright (C) 2008 Analog Devices Inc.
6 * Licensed under the GPL-2 or later.
7 */
8
9
10#ifndef _MACH_GPIO_H_
11#define _MACH_GPIO_H_
12
13#define MAX_BLACKFIN_GPIOS 48
14
15#define GPIO_PF0 0
16#define GPIO_PF1 1
17#define GPIO_PF2 2
18#define GPIO_PF3 3
19#define GPIO_PF4 4
20#define GPIO_PF5 5
21#define GPIO_PF6 6
22#define GPIO_PF7 7
23#define GPIO_PF8 8
24#define GPIO_PF9 9
25#define GPIO_PF10 10
26#define GPIO_PF11 11
27#define GPIO_PF12 12
28#define GPIO_PF13 13
29#define GPIO_PF14 14
30#define GPIO_PF15 15
31#define GPIO_PG0 16
32#define GPIO_PG1 17
33#define GPIO_PG2 18
34#define GPIO_PG3 19
35#define GPIO_PG4 20
36#define GPIO_PG5 21
37#define GPIO_PG6 22
38#define GPIO_PG7 23
39#define GPIO_PG8 24
40#define GPIO_PG9 25
41#define GPIO_PG10 26
42#define GPIO_PG11 27
43#define GPIO_PG12 28
44#define GPIO_PG13 29
45#define GPIO_PG14 30
46#define GPIO_PG15 31
47#define GPIO_PH0 32
48#define GPIO_PH1 33
49#define GPIO_PH2 34
50#define GPIO_PH3 35
51#define GPIO_PH4 36
52#define GPIO_PH5 37
53#define GPIO_PH6 38
54#define GPIO_PH7 39
55#define GPIO_PH8 40
56#define GPIO_PH9 41
57#define GPIO_PH10 42
58#define GPIO_PH11 43
59#define GPIO_PH12 44
60#define GPIO_PH13 45
61#define GPIO_PH14 46
62#define GPIO_PH15 47
63
64#define PORT_F GPIO_PF0
65#define PORT_G GPIO_PG0
66#define PORT_H GPIO_PH0
67
68#endif /* _MACH_GPIO_H_ */
diff --git a/arch/blackfin/mach-bf527/include/mach/irq.h b/arch/blackfin/mach-bf527/include/mach/irq.h
index 4e2b3f2020e5..8ea660d8151f 100644
--- a/arch/blackfin/mach-bf527/include/mach/irq.h
+++ b/arch/blackfin/mach-bf527/include/mach/irq.h
@@ -96,14 +96,14 @@
96#define IRQ_MAC_TX BFIN_IRQ(30) /* DMA2 Channel (MAC TX/NAND) */ 96#define IRQ_MAC_TX BFIN_IRQ(30) /* DMA2 Channel (MAC TX/NAND) */
97#define IRQ_NFC BFIN_IRQ(30) /* DMA2 Channel (MAC TX/NAND) */ 97#define IRQ_NFC BFIN_IRQ(30) /* DMA2 Channel (MAC TX/NAND) */
98#define IRQ_PORTH_INTB BFIN_IRQ(31) /* Port H Interrupt B */ 98#define IRQ_PORTH_INTB BFIN_IRQ(31) /* Port H Interrupt B */
99#define IRQ_TMR0 BFIN_IRQ(32) /* Timer 0 */ 99#define IRQ_TIMER0 BFIN_IRQ(32) /* Timer 0 */
100#define IRQ_TMR1 BFIN_IRQ(33) /* Timer 1 */ 100#define IRQ_TIMER1 BFIN_IRQ(33) /* Timer 1 */
101#define IRQ_TMR2 BFIN_IRQ(34) /* Timer 2 */ 101#define IRQ_TIMER2 BFIN_IRQ(34) /* Timer 2 */
102#define IRQ_TMR3 BFIN_IRQ(35) /* Timer 3 */ 102#define IRQ_TIMER3 BFIN_IRQ(35) /* Timer 3 */
103#define IRQ_TMR4 BFIN_IRQ(36) /* Timer 4 */ 103#define IRQ_TIMER4 BFIN_IRQ(36) /* Timer 4 */
104#define IRQ_TMR5 BFIN_IRQ(37) /* Timer 5 */ 104#define IRQ_TIMER5 BFIN_IRQ(37) /* Timer 5 */
105#define IRQ_TMR6 BFIN_IRQ(38) /* Timer 6 */ 105#define IRQ_TIMER6 BFIN_IRQ(38) /* Timer 6 */
106#define IRQ_TMR7 BFIN_IRQ(39) /* Timer 7 */ 106#define IRQ_TIMER7 BFIN_IRQ(39) /* Timer 7 */
107#define IRQ_PORTG_INTA BFIN_IRQ(40) /* Port G Interrupt A */ 107#define IRQ_PORTG_INTA BFIN_IRQ(40) /* Port G Interrupt A */
108#define IRQ_PORTG_INTB BFIN_IRQ(41) /* Port G Interrupt B */ 108#define IRQ_PORTG_INTB BFIN_IRQ(41) /* Port G Interrupt B */
109#define IRQ_MEM_DMA0 BFIN_IRQ(42) /* MDMA Stream 0 */ 109#define IRQ_MEM_DMA0 BFIN_IRQ(42) /* MDMA Stream 0 */
@@ -227,14 +227,14 @@
227#define IRQ_PORTH_INTB_POS 28 227#define IRQ_PORTH_INTB_POS 28
228 228
229/* IAR4 BIT FIELDS */ 229/* IAR4 BIT FIELDS */
230#define IRQ_TMR0_POS 0 230#define IRQ_TIMER0_POS 0
231#define IRQ_TMR1_POS 4 231#define IRQ_TIMER1_POS 4
232#define IRQ_TMR2_POS 8 232#define IRQ_TIMER2_POS 8
233#define IRQ_TMR3_POS 12 233#define IRQ_TIMER3_POS 12
234#define IRQ_TMR4_POS 16 234#define IRQ_TIMER4_POS 16
235#define IRQ_TMR5_POS 20 235#define IRQ_TIMER5_POS 20
236#define IRQ_TMR6_POS 24 236#define IRQ_TIMER6_POS 24
237#define IRQ_TMR7_POS 28 237#define IRQ_TIMER7_POS 28
238 238
239/* IAR5 BIT FIELDS */ 239/* IAR5 BIT FIELDS */
240#define IRQ_PORTG_INTA_POS 0 240#define IRQ_PORTG_INTA_POS 0
diff --git a/arch/blackfin/mach-bf527/include/mach/mem_map.h b/arch/blackfin/mach-bf527/include/mach/mem_map.h
index ef46dc991cd4..019e0017ad81 100644
--- a/arch/blackfin/mach-bf527/include/mach/mem_map.h
+++ b/arch/blackfin/mach-bf527/include/mach/mem_map.h
@@ -99,4 +99,10 @@
99#define L1_SCRATCH_START 0xFFB00000 99#define L1_SCRATCH_START 0xFFB00000
100#define L1_SCRATCH_LENGTH 0x1000 100#define L1_SCRATCH_LENGTH 0x1000
101 101
102#define GET_PDA_SAFE(preg) \
103 preg.l = _cpu_pda; \
104 preg.h = _cpu_pda;
105
106#define GET_PDA(preg, dreg) GET_PDA_SAFE(preg)
107
102#endif /* _MEM_MAP_527_H_ */ 108#endif /* _MEM_MAP_527_H_ */
diff --git a/arch/blackfin/mach-bf527/ints-priority.c b/arch/blackfin/mach-bf527/ints-priority.c
index 8a2367403d2b..f8c8acd73e30 100644
--- a/arch/blackfin/mach-bf527/ints-priority.c
+++ b/arch/blackfin/mach-bf527/ints-priority.c
@@ -69,14 +69,14 @@ void __init program_IAR(void)
69 ((CONFIG_IRQ_MAC_TX - 7) << IRQ_MAC_TX_POS) | 69 ((CONFIG_IRQ_MAC_TX - 7) << IRQ_MAC_TX_POS) |
70 ((CONFIG_IRQ_PORTH_INTB - 7) << IRQ_PORTH_INTB_POS)); 70 ((CONFIG_IRQ_PORTH_INTB - 7) << IRQ_PORTH_INTB_POS));
71 71
72 bfin_write_SIC_IAR4(((CONFIG_IRQ_TMR0 - 7) << IRQ_TMR0_POS) | 72 bfin_write_SIC_IAR4(((CONFIG_IRQ_TIMER0 - 7) << IRQ_TIMER0_POS) |
73 ((CONFIG_IRQ_TMR1 - 7) << IRQ_TMR1_POS) | 73 ((CONFIG_IRQ_TIMER1 - 7) << IRQ_TIMER1_POS) |
74 ((CONFIG_IRQ_TMR2 - 7) << IRQ_TMR2_POS) | 74 ((CONFIG_IRQ_TIMER2 - 7) << IRQ_TIMER2_POS) |
75 ((CONFIG_IRQ_TMR3 - 7) << IRQ_TMR3_POS) | 75 ((CONFIG_IRQ_TIMER3 - 7) << IRQ_TIMER3_POS) |
76 ((CONFIG_IRQ_TMR4 - 7) << IRQ_TMR4_POS) | 76 ((CONFIG_IRQ_TIMER4 - 7) << IRQ_TIMER4_POS) |
77 ((CONFIG_IRQ_TMR5 - 7) << IRQ_TMR5_POS) | 77 ((CONFIG_IRQ_TIMER5 - 7) << IRQ_TIMER5_POS) |
78 ((CONFIG_IRQ_TMR6 - 7) << IRQ_TMR6_POS) | 78 ((CONFIG_IRQ_TIMER6 - 7) << IRQ_TIMER6_POS) |
79 ((CONFIG_IRQ_TMR7 - 7) << IRQ_TMR7_POS)); 79 ((CONFIG_IRQ_TIMER7 - 7) << IRQ_TIMER7_POS));
80 80
81 bfin_write_SIC_IAR5(((CONFIG_IRQ_PORTG_INTA - 7) << IRQ_PORTG_INTA_POS) | 81 bfin_write_SIC_IAR5(((CONFIG_IRQ_PORTG_INTA - 7) << IRQ_PORTG_INTA_POS) |
82 ((CONFIG_IRQ_PORTG_INTB - 7) << IRQ_PORTG_INTB_POS) | 82 ((CONFIG_IRQ_PORTG_INTB - 7) << IRQ_PORTG_INTB_POS) |
diff --git a/arch/blackfin/mach-bf533/Kconfig b/arch/blackfin/mach-bf533/Kconfig
index 76beb75f12da..14427de7d77f 100644
--- a/arch/blackfin/mach-bf533/Kconfig
+++ b/arch/blackfin/mach-bf533/Kconfig
@@ -59,7 +59,7 @@ config DMA7_UARTTX
59 default 10 59 default 10
60config TIMER0 60config TIMER0
61 int "TIMER0" 61 int "TIMER0"
62 default 11 62 default 8
63config TIMER1 63config TIMER1
64 int "TIMER1" 64 int "TIMER1"
65 default 11 65 default 11
diff --git a/arch/blackfin/mach-bf533/Makefile b/arch/blackfin/mach-bf533/Makefile
index aa9f2647ee0c..874840f76028 100644
--- a/arch/blackfin/mach-bf533/Makefile
+++ b/arch/blackfin/mach-bf533/Makefile
@@ -2,6 +2,4 @@
2# arch/blackfin/mach-bf533/Makefile 2# arch/blackfin/mach-bf533/Makefile
3# 3#
4 4
5extra-y := head.o
6
7obj-y := ints-priority.o dma.o 5obj-y := ints-priority.o dma.o
diff --git a/arch/blackfin/mach-bf533/boards/H8606.c b/arch/blackfin/mach-bf533/boards/H8606.c
index 72ac3ac8ef76..0c66bf44cfab 100644
--- a/arch/blackfin/mach-bf533/boards/H8606.c
+++ b/arch/blackfin/mach-bf533/boards/H8606.c
@@ -313,23 +313,33 @@ static struct platform_device bfin_uart_device = {
313#endif 313#endif
314 314
315#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE) 315#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
316static struct resource bfin_sir_resources[] = {
317#ifdef CONFIG_BFIN_SIR0 316#ifdef CONFIG_BFIN_SIR0
317static struct resource bfin_sir0_resources[] = {
318 { 318 {
319 .start = 0xFFC00400, 319 .start = 0xFFC00400,
320 .end = 0xFFC004FF, 320 .end = 0xFFC004FF,
321 .flags = IORESOURCE_MEM, 321 .flags = IORESOURCE_MEM,
322 }, 322 },
323#endif 323 {
324 .start = IRQ_UART0_RX,
325 .end = IRQ_UART0_RX+1,
326 .flags = IORESOURCE_IRQ,
327 },
328 {
329 .start = CH_UART0_RX,
330 .end = CH_UART0_RX+1,
331 .flags = IORESOURCE_DMA,
332 },
324}; 333};
325 334
326static struct platform_device bfin_sir_device = { 335static struct platform_device bfin_sir0_device = {
327 .name = "bfin_sir", 336 .name = "bfin_sir",
328 .id = 0, 337 .id = 0,
329 .num_resources = ARRAY_SIZE(bfin_sir_resources), 338 .num_resources = ARRAY_SIZE(bfin_sir0_resources),
330 .resource = bfin_sir_resources, 339 .resource = bfin_sir0_resources,
331}; 340};
332#endif 341#endif
342#endif
333 343
334#if defined(CONFIG_SERIAL_8250) || defined(CONFIG_SERIAL_8250_MODULE) 344#if defined(CONFIG_SERIAL_8250) || defined(CONFIG_SERIAL_8250_MODULE)
335 345
@@ -431,7 +441,9 @@ static struct platform_device *h8606_devices[] __initdata = {
431#endif 441#endif
432 442
433#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE) 443#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
434 &bfin_sir_device, 444#ifdef CONFIG_BFIN_SIR0
445 &bfin_sir0_device,
446#endif
435#endif 447#endif
436 448
437#if defined(CONFIG_KEYBOARD_OPENCORES) || defined(CONFIG_KEYBOARD_OPENCORES_MODULE) 449#if defined(CONFIG_KEYBOARD_OPENCORES) || defined(CONFIG_KEYBOARD_OPENCORES_MODULE)
diff --git a/arch/blackfin/mach-bf533/boards/blackstamp.c b/arch/blackfin/mach-bf533/boards/blackstamp.c
index d064ded87719..6ee607c259ac 100644
--- a/arch/blackfin/mach-bf533/boards/blackstamp.c
+++ b/arch/blackfin/mach-bf533/boards/blackstamp.c
@@ -212,23 +212,33 @@ static struct platform_device bfin_uart_device = {
212#endif 212#endif
213 213
214#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE) 214#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
215static struct resource bfin_sir_resources[] = {
216#ifdef CONFIG_BFIN_SIR0 215#ifdef CONFIG_BFIN_SIR0
216static struct resource bfin_sir0_resources[] = {
217 { 217 {
218 .start = 0xFFC00400, 218 .start = 0xFFC00400,
219 .end = 0xFFC004FF, 219 .end = 0xFFC004FF,
220 .flags = IORESOURCE_MEM, 220 .flags = IORESOURCE_MEM,
221 }, 221 },
222#endif 222 {
223 .start = IRQ_UART0_RX,
224 .end = IRQ_UART0_RX+1,
225 .flags = IORESOURCE_IRQ,
226 },
227 {
228 .start = CH_UART0_RX,
229 .end = CH_UART0_RX+1,
230 .flags = IORESOURCE_DMA,
231 },
223}; 232};
224 233
225static struct platform_device bfin_sir_device = { 234static struct platform_device bfin_sir0_device = {
226 .name = "bfin_sir", 235 .name = "bfin_sir",
227 .id = 0, 236 .id = 0,
228 .num_resources = ARRAY_SIZE(bfin_sir_resources), 237 .num_resources = ARRAY_SIZE(bfin_sir0_resources),
229 .resource = bfin_sir_resources, 238 .resource = bfin_sir0_resources,
230}; 239};
231#endif 240#endif
241#endif
232 242
233#if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE) 243#if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
234static struct platform_device bfin_sport0_uart_device = { 244static struct platform_device bfin_sport0_uart_device = {
@@ -353,7 +363,9 @@ static struct platform_device *stamp_devices[] __initdata = {
353#endif 363#endif
354 364
355#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE) 365#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
356 &bfin_sir_device, 366#ifdef CONFIG_BFIN_SIR0
367 &bfin_sir0_device,
368#endif
357#endif 369#endif
358 370
359#if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE) 371#if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
diff --git a/arch/blackfin/mach-bf533/boards/cm_bf533.c b/arch/blackfin/mach-bf533/boards/cm_bf533.c
index 575843f6d9ef..e7061c7e8c42 100644
--- a/arch/blackfin/mach-bf533/boards/cm_bf533.c
+++ b/arch/blackfin/mach-bf533/boards/cm_bf533.c
@@ -219,6 +219,19 @@ static struct platform_device smc91x_device = {
219}; 219};
220#endif 220#endif
221 221
222static struct resource bfin_gpios_resources = {
223 .start = 0,
224 .end = MAX_BLACKFIN_GPIOS - 1,
225 .flags = IORESOURCE_IRQ,
226};
227
228static struct platform_device bfin_gpios_device = {
229 .name = "simple-gpio",
230 .id = -1,
231 .num_resources = 1,
232 .resource = &bfin_gpios_resources,
233};
234
222#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE) 235#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
223static struct resource bfin_uart_resources[] = { 236static struct resource bfin_uart_resources[] = {
224 { 237 {
@@ -237,23 +250,33 @@ static struct platform_device bfin_uart_device = {
237#endif 250#endif
238 251
239#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE) 252#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
240static struct resource bfin_sir_resources[] = {
241#ifdef CONFIG_BFIN_SIR0 253#ifdef CONFIG_BFIN_SIR0
254static struct resource bfin_sir0_resources[] = {
242 { 255 {
243 .start = 0xFFC00400, 256 .start = 0xFFC00400,
244 .end = 0xFFC004FF, 257 .end = 0xFFC004FF,
245 .flags = IORESOURCE_MEM, 258 .flags = IORESOURCE_MEM,
246 }, 259 },
247#endif 260 {
261 .start = IRQ_UART0_RX,
262 .end = IRQ_UART0_RX+1,
263 .flags = IORESOURCE_IRQ,
264 },
265 {
266 .start = CH_UART0_RX,
267 .end = CH_UART0_RX+1,
268 .flags = IORESOURCE_DMA,
269 },
248}; 270};
249 271
250static struct platform_device bfin_sir_device = { 272static struct platform_device bfin_sir0_device = {
251 .name = "bfin_sir", 273 .name = "bfin_sir",
252 .id = 0, 274 .id = 0,
253 .num_resources = ARRAY_SIZE(bfin_sir_resources), 275 .num_resources = ARRAY_SIZE(bfin_sir0_resources),
254 .resource = bfin_sir_resources, 276 .resource = bfin_sir0_resources,
255}; 277};
256#endif 278#endif
279#endif
257 280
258#if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE) 281#if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
259static struct platform_device bfin_sport0_uart_device = { 282static struct platform_device bfin_sport0_uart_device = {
@@ -342,7 +365,9 @@ static struct platform_device *cm_bf533_devices[] __initdata = {
342#endif 365#endif
343 366
344#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE) 367#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
345 &bfin_sir_device, 368#ifdef CONFIG_BFIN_SIR0
369 &bfin_sir0_device,
370#endif
346#endif 371#endif
347 372
348#if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE) 373#if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
@@ -365,6 +390,8 @@ static struct platform_device *cm_bf533_devices[] __initdata = {
365#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE) 390#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
366 &bfin_spi0_device, 391 &bfin_spi0_device,
367#endif 392#endif
393
394 &bfin_gpios_device,
368}; 395};
369 396
370static int __init cm_bf533_init(void) 397static int __init cm_bf533_init(void)
diff --git a/arch/blackfin/mach-bf533/boards/ezkit.c b/arch/blackfin/mach-bf533/boards/ezkit.c
index cc2e7eeb1d5a..08cd0969de47 100644
--- a/arch/blackfin/mach-bf533/boards/ezkit.c
+++ b/arch/blackfin/mach-bf533/boards/ezkit.c
@@ -46,7 +46,7 @@
46/* 46/*
47 * Name the Board for the /proc/cpuinfo 47 * Name the Board for the /proc/cpuinfo
48 */ 48 */
49const char bfin_board_name[] = "ADDS-BF533-EZKIT"; 49const char bfin_board_name[] = "ADI BF533-EZKIT";
50 50
51#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE) 51#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
52static struct platform_device rtc_device = { 52static struct platform_device rtc_device = {
@@ -236,23 +236,33 @@ static struct platform_device bfin_uart_device = {
236#endif 236#endif
237 237
238#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE) 238#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
239static struct resource bfin_sir_resources[] = {
240#ifdef CONFIG_BFIN_SIR0 239#ifdef CONFIG_BFIN_SIR0
240static struct resource bfin_sir0_resources[] = {
241 { 241 {
242 .start = 0xFFC00400, 242 .start = 0xFFC00400,
243 .end = 0xFFC004FF, 243 .end = 0xFFC004FF,
244 .flags = IORESOURCE_MEM, 244 .flags = IORESOURCE_MEM,
245 }, 245 },
246#endif 246 {
247 .start = IRQ_UART0_RX,
248 .end = IRQ_UART0_RX+1,
249 .flags = IORESOURCE_IRQ,
250 },
251 {
252 .start = CH_UART0_RX,
253 .end = CH_UART0_RX+1,
254 .flags = IORESOURCE_DMA,
255 },
247}; 256};
248 257
249static struct platform_device bfin_sir_device = { 258static struct platform_device bfin_sir0_device = {
250 .name = "bfin_sir", 259 .name = "bfin_sir",
251 .id = 0, 260 .id = 0,
252 .num_resources = ARRAY_SIZE(bfin_sir_resources), 261 .num_resources = ARRAY_SIZE(bfin_sir0_resources),
253 .resource = bfin_sir_resources, 262 .resource = bfin_sir0_resources,
254}; 263};
255#endif 264#endif
265#endif
256 266
257#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE) 267#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
258#include <linux/input.h> 268#include <linux/input.h>
@@ -363,7 +373,9 @@ static struct platform_device *ezkit_devices[] __initdata = {
363#endif 373#endif
364 374
365#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE) 375#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
366 &bfin_sir_device, 376#ifdef CONFIG_BFIN_SIR0
377 &bfin_sir0_device,
378#endif
367#endif 379#endif
368 380
369#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE) 381#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
diff --git a/arch/blackfin/mach-bf533/boards/generic_board.c b/arch/blackfin/mach-bf533/boards/generic_board.c
index 82b1f6a60e3f..986eeec53b1f 100644
--- a/arch/blackfin/mach-bf533/boards/generic_board.c
+++ b/arch/blackfin/mach-bf533/boards/generic_board.c
@@ -72,6 +72,35 @@ static struct platform_device smc91x_device = {
72}; 72};
73#endif 73#endif
74 74
75#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
76#ifdef CONFIG_BFIN_SIR0
77static struct resource bfin_sir0_resources[] = {
78 {
79 .start = 0xFFC00400,
80 .end = 0xFFC004FF,
81 .flags = IORESOURCE_MEM,
82 },
83 {
84 .start = IRQ_UART0_RX,
85 .end = IRQ_UART0_RX+1,
86 .flags = IORESOURCE_IRQ,
87 },
88 {
89 .start = CH_UART0_RX,
90 .end = CH_UART0_RX+1,
91 .flags = IORESOURCE_DMA,
92 },
93};
94
95static struct platform_device bfin_sir0_device = {
96 .name = "bfin_sir",
97 .id = 0,
98 .num_resources = ARRAY_SIZE(bfin_sir0_resources),
99 .resource = bfin_sir0_resources,
100};
101#endif
102#endif
103
75static struct platform_device *generic_board_devices[] __initdata = { 104static struct platform_device *generic_board_devices[] __initdata = {
76#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE) 105#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
77 &rtc_device, 106 &rtc_device,
@@ -80,6 +109,12 @@ static struct platform_device *generic_board_devices[] __initdata = {
80#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE) 109#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
81 &smc91x_device, 110 &smc91x_device,
82#endif 111#endif
112
113#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
114#ifdef CONFIG_BFIN_SIR0
115 &bfin_sir0_device,
116#endif
117#endif
83}; 118};
84 119
85static int __init generic_board_init(void) 120static int __init generic_board_init(void)
diff --git a/arch/blackfin/mach-bf533/boards/ip0x.c b/arch/blackfin/mach-bf533/boards/ip0x.c
index 5864892de314..e30b1b7d1442 100644
--- a/arch/blackfin/mach-bf533/boards/ip0x.c
+++ b/arch/blackfin/mach-bf533/boards/ip0x.c
@@ -197,23 +197,33 @@ static struct platform_device bfin_uart_device = {
197#endif 197#endif
198 198
199#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE) 199#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
200static struct resource bfin_sir_resources[] = {
201#ifdef CONFIG_BFIN_SIR0 200#ifdef CONFIG_BFIN_SIR0
201static struct resource bfin_sir0_resources[] = {
202 { 202 {
203 .start = 0xFFC00400, 203 .start = 0xFFC00400,
204 .end = 0xFFC004FF, 204 .end = 0xFFC004FF,
205 .flags = IORESOURCE_MEM, 205 .flags = IORESOURCE_MEM,
206 }, 206 },
207#endif 207 {
208 .start = IRQ_UART0_RX,
209 .end = IRQ_UART0_RX+1,
210 .flags = IORESOURCE_IRQ,
211 },
212 {
213 .start = CH_UART0_RX,
214 .end = CH_UART0_RX+1,
215 .flags = IORESOURCE_DMA,
216 },
208}; 217};
209 218
210static struct platform_device bfin_sir_device = { 219static struct platform_device bfin_sir0_device = {
211 .name = "bfin_sir", 220 .name = "bfin_sir",
212 .id = 0, 221 .id = 0,
213 .num_resources = ARRAY_SIZE(bfin_sir_resources), 222 .num_resources = ARRAY_SIZE(bfin_sir0_resources),
214 .resource = bfin_sir_resources, 223 .resource = bfin_sir0_resources,
215}; 224};
216#endif 225#endif
226#endif
217 227
218#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE) 228#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
219static struct resource isp1362_hcd_resources[] = { 229static struct resource isp1362_hcd_resources[] = {
@@ -272,7 +282,9 @@ static struct platform_device *ip0x_devices[] __initdata = {
272#endif 282#endif
273 283
274#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE) 284#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
275 &bfin_sir_device, 285#ifdef CONFIG_BFIN_SIR0
286 &bfin_sir0_device,
287#endif
276#endif 288#endif
277 289
278#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE) 290#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
diff --git a/arch/blackfin/mach-bf533/boards/stamp.c b/arch/blackfin/mach-bf533/boards/stamp.c
index 050ffca53530..07f9ad1e189c 100644
--- a/arch/blackfin/mach-bf533/boards/stamp.c
+++ b/arch/blackfin/mach-bf533/boards/stamp.c
@@ -49,7 +49,7 @@
49/* 49/*
50 * Name the Board for the /proc/cpuinfo 50 * Name the Board for the /proc/cpuinfo
51 */ 51 */
52const char bfin_board_name[] = "ADDS-BF533-STAMP"; 52const char bfin_board_name[] = "ADI BF533-STAMP";
53 53
54#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE) 54#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
55static struct platform_device rtc_device = { 55static struct platform_device rtc_device = {
@@ -118,7 +118,7 @@ static struct mtd_partition stamp_partitions[] = {
118 .offset = 0, 118 .offset = 0,
119 }, { 119 }, {
120 .name = "linux kernel(nor)", 120 .name = "linux kernel(nor)",
121 .size = 0xE0000, 121 .size = 0x180000,
122 .offset = MTDPART_OFS_APPEND, 122 .offset = MTDPART_OFS_APPEND,
123 }, { 123 }, {
124 .name = "file system(nor)", 124 .name = "file system(nor)",
@@ -169,7 +169,7 @@ static struct mtd_partition bfin_spi_flash_partitions[] = {
169 .mask_flags = MTD_CAP_ROM 169 .mask_flags = MTD_CAP_ROM
170 }, { 170 }, {
171 .name = "linux kernel(spi)", 171 .name = "linux kernel(spi)",
172 .size = 0xe0000, 172 .size = 0x180000,
173 .offset = MTDPART_OFS_APPEND, 173 .offset = MTDPART_OFS_APPEND,
174 }, { 174 }, {
175 .name = "file system(spi)", 175 .name = "file system(spi)",
@@ -216,13 +216,6 @@ static struct bfin5xx_spi_chip spi_si3xxx_chip_info = {
216}; 216};
217#endif 217#endif
218 218
219#if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE)
220static struct bfin5xx_spi_chip spi_mmc_chip_info = {
221 .enable_dma = 1,
222 .bits_per_word = 8,
223};
224#endif
225
226#if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE) 219#if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
227static struct bfin5xx_spi_chip spidev_chip_info = { 220static struct bfin5xx_spi_chip spidev_chip_info = {
228 .enable_dma = 0, 221 .enable_dma = 0,
@@ -265,27 +258,6 @@ static struct spi_board_info bfin_spi_board_info[] __initdata = {
265 }, 258 },
266#endif 259#endif
267 260
268#if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE)
269 {
270 .modalias = "spi_mmc_dummy",
271 .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
272 .bus_num = 0,
273 .chip_select = 0,
274 .platform_data = NULL,
275 .controller_data = &spi_mmc_chip_info,
276 .mode = SPI_MODE_3,
277 },
278 {
279 .modalias = "spi_mmc",
280 .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
281 .bus_num = 0,
282 .chip_select = CONFIG_SPI_MMC_CS_CHAN,
283 .platform_data = NULL,
284 .controller_data = &spi_mmc_chip_info,
285 .mode = SPI_MODE_3,
286 },
287#endif
288
289#if defined(CONFIG_PBX) 261#if defined(CONFIG_PBX)
290 { 262 {
291 .modalias = "fxs-spi", 263 .modalias = "fxs-spi",
@@ -373,23 +345,33 @@ static struct platform_device bfin_uart_device = {
373#endif 345#endif
374 346
375#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE) 347#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
376static struct resource bfin_sir_resources[] = {
377#ifdef CONFIG_BFIN_SIR0 348#ifdef CONFIG_BFIN_SIR0
349static struct resource bfin_sir0_resources[] = {
378 { 350 {
379 .start = 0xFFC00400, 351 .start = 0xFFC00400,
380 .end = 0xFFC004FF, 352 .end = 0xFFC004FF,
381 .flags = IORESOURCE_MEM, 353 .flags = IORESOURCE_MEM,
382 }, 354 },
383#endif 355 {
356 .start = IRQ_UART0_RX,
357 .end = IRQ_UART0_RX+1,
358 .flags = IORESOURCE_IRQ,
359 },
360 {
361 .start = CH_UART0_RX,
362 .end = CH_UART0_RX+1,
363 .flags = IORESOURCE_DMA,
364 },
384}; 365};
385 366
386static struct platform_device bfin_sir_device = { 367static struct platform_device bfin_sir0_device = {
387 .name = "bfin_sir", 368 .name = "bfin_sir",
388 .id = 0, 369 .id = 0,
389 .num_resources = ARRAY_SIZE(bfin_sir_resources), 370 .num_resources = ARRAY_SIZE(bfin_sir0_resources),
390 .resource = bfin_sir_resources, 371 .resource = bfin_sir0_resources,
391}; 372};
392#endif 373#endif
374#endif
393 375
394#if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE) 376#if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
395static struct platform_device bfin_sport0_uart_device = { 377static struct platform_device bfin_sport0_uart_device = {
@@ -537,7 +519,9 @@ static struct platform_device *stamp_devices[] __initdata = {
537#endif 519#endif
538 520
539#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE) 521#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
540 &bfin_sir_device, 522#ifdef CONFIG_BFIN_SIR0
523 &bfin_sir0_device,
524#endif
541#endif 525#endif
542 526
543#if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE) 527#if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
diff --git a/arch/blackfin/mach-bf533/dma.c b/arch/blackfin/mach-bf533/dma.c
index 28655c1cb7dc..0a6eb8f24d98 100644
--- a/arch/blackfin/mach-bf533/dma.c
+++ b/arch/blackfin/mach-bf533/dma.c
@@ -31,7 +31,7 @@
31#include <asm/blackfin.h> 31#include <asm/blackfin.h>
32#include <asm/dma.h> 32#include <asm/dma.h>
33 33
34struct dma_register *dma_io_base_addr[MAX_BLACKFIN_DMA_CHANNEL] = { 34struct dma_register *dma_io_base_addr[MAX_DMA_CHANNELS] = {
35 (struct dma_register *) DMA0_NEXT_DESC_PTR, 35 (struct dma_register *) DMA0_NEXT_DESC_PTR,
36 (struct dma_register *) DMA1_NEXT_DESC_PTR, 36 (struct dma_register *) DMA1_NEXT_DESC_PTR,
37 (struct dma_register *) DMA2_NEXT_DESC_PTR, 37 (struct dma_register *) DMA2_NEXT_DESC_PTR,
diff --git a/arch/blackfin/mach-bf533/head.S b/arch/blackfin/mach-bf533/head.S
deleted file mode 100644
index 9fc95aaca439..000000000000
--- a/arch/blackfin/mach-bf533/head.S
+++ /dev/null
@@ -1,137 +0,0 @@
1/*
2 * File: arch/blackfin/mach-bf533/head.S
3 * Based on:
4 * Author: Jeff Dionne <jeff@uclinux.org> COPYRIGHT 1998 D. Jeff Dionne
5 *
6 * Created: 1998
7 * Description: bf533 startup file
8 *
9 * Modified:
10 * Copyright 2004-2006 Analog Devices Inc.
11 *
12 * Bugs: Enter bugs at http://blackfin.uclinux.org/
13 *
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 2 of the License, or
17 * (at your option) any later version.
18 *
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
23 *
24 * You should have received a copy of the GNU General Public License
25 * along with this program; if not, see the file COPYING, or write
26 * to the Free Software Foundation, Inc.,
27 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
28 */
29
30#include <linux/linkage.h>
31#include <linux/init.h>
32#include <asm/blackfin.h>
33#ifdef CONFIG_BFIN_KERNEL_CLOCK
34#include <asm/clocks.h>
35#include <mach/mem_init.h>
36#endif
37
38.section .l1.text
39#ifdef CONFIG_BFIN_KERNEL_CLOCK
40ENTRY(_start_dma_code)
41 p0.h = hi(SIC_IWR);
42 p0.l = lo(SIC_IWR);
43 r0.l = 0x1;
44 r0.h = 0x0;
45 [p0] = r0;
46 SSYNC;
47
48 /*
49 * Set PLL_CTL
50 * - [14:09] = MSEL[5:0] : CLKIN / VCO multiplication factors
51 * - [8] = BYPASS : BYPASS the PLL, run CLKIN into CCLK/SCLK
52 * - [7] = output delay (add 200ps of delay to mem signals)
53 * - [6] = input delay (add 200ps of input delay to mem signals)
54 * - [5] = PDWN : 1=All Clocks off
55 * - [3] = STOPCK : 1=Core Clock off
56 * - [1] = PLL_OFF : 1=Disable Power to PLL
57 * - [0] = DF : 1=Pass CLKIN/2 to PLL / 0=Pass CLKIN to PLL
58 * all other bits set to zero
59 */
60
61 p0.h = hi(PLL_LOCKCNT);
62 p0.l = lo(PLL_LOCKCNT);
63 r0 = 0x300(Z);
64 w[p0] = r0.l;
65 ssync;
66
67 P2.H = hi(EBIU_SDGCTL);
68 P2.L = lo(EBIU_SDGCTL);
69 R0 = [P2];
70 BITSET (R0, 24);
71 [P2] = R0;
72 SSYNC;
73
74 r0 = CONFIG_VCO_MULT & 63; /* Load the VCO multiplier */
75 r0 = r0 << 9; /* Shift it over, */
76 r1 = CLKIN_HALF; /* Do we need to divide CLKIN by 2?*/
77 r0 = r1 | r0;
78 r1 = PLL_BYPASS; /* Bypass the PLL? */
79 r1 = r1 << 8; /* Shift it over */
80 r0 = r1 | r0; /* add them all together */
81#ifdef ANOMALY_05000265
82 BITSET(r0, 15); /* Add 250 mV of hysteresis to SPORT input pins */
83#endif
84
85 p0.h = hi(PLL_CTL);
86 p0.l = lo(PLL_CTL); /* Load the address */
87 cli r2; /* Disable interrupts */
88 ssync;
89 w[p0] = r0.l; /* Set the value */
90 idle; /* Wait for the PLL to stablize */
91 sti r2; /* Enable interrupts */
92
93.Lcheck_again:
94 p0.h = hi(PLL_STAT);
95 p0.l = lo(PLL_STAT);
96 R0 = W[P0](Z);
97 CC = BITTST(R0,5);
98 if ! CC jump .Lcheck_again;
99
100 /* Configure SCLK & CCLK Dividers */
101 r0 = (CONFIG_CCLK_ACT_DIV | CONFIG_SCLK_DIV);
102 p0.h = hi(PLL_DIV);
103 p0.l = lo(PLL_DIV);
104 w[p0] = r0.l;
105 ssync;
106
107 p0.l = lo(EBIU_SDRRC);
108 p0.h = hi(EBIU_SDRRC);
109 r0 = mem_SDRRC;
110 w[p0] = r0.l;
111 ssync;
112
113 P2.H = hi(EBIU_SDGCTL);
114 P2.L = lo(EBIU_SDGCTL);
115 R0 = [P2];
116 BITCLR (R0, 24);
117 p0.h = hi(EBIU_SDSTAT);
118 p0.l = lo(EBIU_SDSTAT);
119 r2.l = w[p0];
120 cc = bittst(r2,3);
121 if !cc jump .Lskip;
122 NOP;
123 BITSET (R0, 23);
124.Lskip:
125 [P2] = R0;
126 SSYNC;
127
128 R0.L = lo(mem_SDGCTL);
129 R0.H = hi(mem_SDGCTL);
130 R1 = [p2];
131 R1 = R1 | R0;
132 [P2] = R1;
133 SSYNC;
134
135 RTS;
136ENDPROC(_start_dma_code)
137#endif /* CONFIG_BFIN_KERNEL_CLOCK */
diff --git a/arch/blackfin/mach-bf533/include/mach/anomaly.h b/arch/blackfin/mach-bf533/include/mach/anomaly.h
index f544fc56959a..0d3a03429fb9 100644
--- a/arch/blackfin/mach-bf533/include/mach/anomaly.h
+++ b/arch/blackfin/mach-bf533/include/mach/anomaly.h
@@ -7,7 +7,7 @@
7 */ 7 */
8 8
9/* This file shoule be up to date with: 9/* This file shoule be up to date with:
10 * - Revision D, 06/18/2008; ADSP-BF531/BF532/BF533 Blackfin Processor Anomaly List 10 * - Revision E, 09/18/2008; ADSP-BF531/BF532/BF533 Blackfin Processor Anomaly List
11 */ 11 */
12 12
13#ifndef _MACH_ANOMALY_H_ 13#ifndef _MACH_ANOMALY_H_
@@ -194,6 +194,12 @@
194#define ANOMALY_05000403 (1) 194#define ANOMALY_05000403 (1)
195/* Speculative Fetches Can Cause Undesired External FIFO Operations */ 195/* Speculative Fetches Can Cause Undesired External FIFO Operations */
196#define ANOMALY_05000416 (1) 196#define ANOMALY_05000416 (1)
197/* Multichannel SPORT Channel Misalignment Under Specific Configuration */
198#define ANOMALY_05000425 (1)
199/* Speculative Fetches of Indirect-Pointer Instructions Can Cause False Hardware Errors */
200#define ANOMALY_05000426 (1)
201/* IFLUSH Instruction at End of Hardware Loop Causes Infinite Stall */
202#define ANOMALY_05000443 (1)
197 203
198/* These anomalies have been "phased" out of analog.com anomaly sheets and are 204/* These anomalies have been "phased" out of analog.com anomaly sheets and are
199 * here to show running on older silicon just isn't feasible. 205 * here to show running on older silicon just isn't feasible.
@@ -273,5 +279,8 @@
273#define ANOMALY_05000323 (0) 279#define ANOMALY_05000323 (0)
274#define ANOMALY_05000353 (1) 280#define ANOMALY_05000353 (1)
275#define ANOMALY_05000386 (1) 281#define ANOMALY_05000386 (1)
282#define ANOMALY_05000412 (0)
283#define ANOMALY_05000432 (0)
284#define ANOMALY_05000435 (0)
276 285
277#endif 286#endif
diff --git a/arch/blackfin/mach-bf533/include/mach/bf533.h b/arch/blackfin/mach-bf533/include/mach/bf533.h
index dfc8c1ad2d7a..cf4427cd3f72 100644
--- a/arch/blackfin/mach-bf533/include/mach/bf533.h
+++ b/arch/blackfin/mach-bf533/include/mach/bf533.h
@@ -145,7 +145,7 @@
145#endif 145#endif
146#ifdef CONFIG_BF532 146#ifdef CONFIG_BF532
147#define CPU "BF532" 147#define CPU "BF532"
148#define CPUID 0x275A 148#define CPUID 0x27a5
149#endif 149#endif
150#ifdef CONFIG_BF531 150#ifdef CONFIG_BF531
151#define CPU "BF531" 151#define CPU "BF531"
@@ -153,7 +153,7 @@
153#endif 153#endif
154 154
155#ifndef CPU 155#ifndef CPU
156#error Unknown CPU type - This kernel doesn't seem to be configured properly 156#error "Unknown CPU type - This kernel doesn't seem to be configured properly"
157#endif 157#endif
158 158
159#endif /* __MACH_BF533_H__ */ 159#endif /* __MACH_BF533_H__ */
diff --git a/arch/blackfin/mach-bf533/include/mach/bfin_sir.h b/arch/blackfin/mach-bf533/include/mach/bfin_sir.h
deleted file mode 100644
index 9bb87e9e2e9b..000000000000
--- a/arch/blackfin/mach-bf533/include/mach/bfin_sir.h
+++ /dev/null
@@ -1,125 +0,0 @@
1/*
2 * Blackfin Infra-red Driver
3 *
4 * Copyright 2006-2008 Analog Devices Inc.
5 *
6 * Enter bugs at http://blackfin.uclinux.org/
7 *
8 * Licensed under the GPL-2 or later.
9 *
10 */
11
12#include <linux/serial.h>
13#include <asm/dma.h>
14#include <asm/portmux.h>
15
16#define SIR_UART_GET_CHAR(port) bfin_read16((port)->membase + OFFSET_RBR)
17#define SIR_UART_GET_DLL(port) bfin_read16((port)->membase + OFFSET_DLL)
18#define SIR_UART_GET_IER(port) bfin_read16((port)->membase + OFFSET_IER)
19#define SIR_UART_GET_DLH(port) bfin_read16((port)->membase + OFFSET_DLH)
20#define SIR_UART_GET_IIR(port) bfin_read16((port)->membase + OFFSET_IIR)
21#define SIR_UART_GET_LCR(port) bfin_read16((port)->membase + OFFSET_LCR)
22#define SIR_UART_GET_GCTL(port) bfin_read16((port)->membase + OFFSET_GCTL)
23
24#define SIR_UART_PUT_CHAR(port, v) bfin_write16(((port)->membase + OFFSET_THR), v)
25#define SIR_UART_PUT_DLL(port, v) bfin_write16(((port)->membase + OFFSET_DLL), v)
26#define SIR_UART_PUT_IER(port, v) bfin_write16(((port)->membase + OFFSET_IER), v)
27#define SIR_UART_PUT_DLH(port, v) bfin_write16(((port)->membase + OFFSET_DLH), v)
28#define SIR_UART_PUT_LCR(port, v) bfin_write16(((port)->membase + OFFSET_LCR), v)
29#define SIR_UART_PUT_GCTL(port, v) bfin_write16(((port)->membase + OFFSET_GCTL), v)
30
31#ifdef CONFIG_SIR_BFIN_DMA
32struct dma_rx_buf {
33 char *buf;
34 int head;
35 int tail;
36 };
37#endif /* CONFIG_SIR_BFIN_DMA */
38
39struct bfin_sir_port {
40 unsigned char __iomem *membase;
41 unsigned int irq;
42 unsigned int lsr;
43 unsigned long clk;
44 struct net_device *dev;
45#ifdef CONFIG_SIR_BFIN_DMA
46 int tx_done;
47 struct dma_rx_buf rx_dma_buf;
48 struct timer_list rx_dma_timer;
49 int rx_dma_nrows;
50#endif /* CONFIG_SIR_BFIN_DMA */
51 unsigned int tx_dma_channel;
52 unsigned int rx_dma_channel;
53};
54
55struct bfin_sir_port sir_ports[BFIN_UART_NR_PORTS];
56
57struct bfin_sir_port_res {
58 unsigned long base_addr;
59 int irq;
60 unsigned int rx_dma_channel;
61 unsigned int tx_dma_channel;
62};
63
64struct bfin_sir_port_res bfin_sir_port_resource[] = {
65#ifdef CONFIG_BFIN_SIR0
66 {
67 0xFFC00400,
68 IRQ_UART_RX,
69 CH_UART_RX,
70 CH_UART_TX,
71 },
72#endif
73};
74
75int nr_sirs = ARRAY_SIZE(bfin_sir_port_resource);
76
77struct bfin_sir_self {
78 struct bfin_sir_port *sir_port;
79 spinlock_t lock;
80 unsigned int open;
81 int speed;
82 int newspeed;
83
84 struct sk_buff *txskb;
85 struct sk_buff *rxskb;
86 struct net_device_stats stats;
87 struct device *dev;
88 struct irlap_cb *irlap;
89 struct qos_info qos;
90
91 iobuff_t tx_buff;
92 iobuff_t rx_buff;
93
94 struct work_struct work;
95 int mtt;
96};
97
98static inline unsigned int SIR_UART_GET_LSR(struct bfin_sir_port *port)
99{
100 unsigned int lsr = bfin_read16(port->membase + OFFSET_LSR);
101 port->lsr |= (lsr & (BI|FE|PE|OE));
102 return lsr | port->lsr;
103}
104
105static inline void SIR_UART_CLEAR_LSR(struct bfin_sir_port *port)
106{
107 port->lsr = 0;
108 bfin_read16(port->membase + OFFSET_LSR);
109}
110
111#define DRIVER_NAME "bfin_sir"
112
113static int bfin_sir_hw_init(void)
114{
115 int ret = -ENODEV;
116#ifdef CONFIG_BFIN_SIR0
117 ret = peripheral_request(P_UART0_TX, DRIVER_NAME);
118 if (ret)
119 return ret;
120 ret = peripheral_request(P_UART0_RX, DRIVER_NAME);
121 if (ret)
122 return ret;
123#endif
124 return ret;
125}
diff --git a/arch/blackfin/mach-bf533/include/mach/blackfin.h b/arch/blackfin/mach-bf533/include/mach/blackfin.h
index d80971b4e3aa..045184f81a29 100644
--- a/arch/blackfin/mach-bf533/include/mach/blackfin.h
+++ b/arch/blackfin/mach-bf533/include/mach/blackfin.h
@@ -44,6 +44,13 @@
44 44
45#define BFIN_UART_NR_PORTS 1 45#define BFIN_UART_NR_PORTS 1
46 46
47#define CH_UART_RX CH_UART0_RX
48#define CH_UART_TX CH_UART0_TX
49
50#define IRQ_UART_ERROR IRQ_UART0_ERROR
51#define IRQ_UART_RX IRQ_UART0_RX
52#define IRQ_UART_TX IRQ_UART0_TX
53
47#define OFFSET_THR 0x00 /* Transmit Holding register */ 54#define OFFSET_THR 0x00 /* Transmit Holding register */
48#define OFFSET_RBR 0x00 /* Receive Buffer register */ 55#define OFFSET_RBR 0x00 /* Receive Buffer register */
49#define OFFSET_DLL 0x00 /* Divisor Latch (Low-Byte) */ 56#define OFFSET_DLL 0x00 /* Divisor Latch (Low-Byte) */
diff --git a/arch/blackfin/mach-bf533/include/mach/cdefBF532.h b/arch/blackfin/mach-bf533/include/mach/cdefBF532.h
index 3d8978a52c17..bbc3c8386d48 100644
--- a/arch/blackfin/mach-bf533/include/mach/cdefBF532.h
+++ b/arch/blackfin/mach-bf533/include/mach/cdefBF532.h
@@ -39,31 +39,8 @@
39/*include core specific register pointer definitions*/ 39/*include core specific register pointer definitions*/
40#include <asm/cdef_LPBlackfin.h> 40#include <asm/cdef_LPBlackfin.h>
41 41
42#include <asm/system.h>
43
44/* Clock and System Control (0xFFC0 0400-0xFFC0 07FF) */ 42/* Clock and System Control (0xFFC0 0400-0xFFC0 07FF) */
45#define bfin_read_PLL_CTL() bfin_read16(PLL_CTL) 43#define bfin_read_PLL_CTL() bfin_read16(PLL_CTL)
46/* Writing to PLL_CTL initiates a PLL relock sequence. */
47static __inline__ void bfin_write_PLL_CTL(unsigned int val)
48{
49 unsigned long flags, iwr;
50
51 if (val == bfin_read_PLL_CTL())
52 return;
53
54 local_irq_save(flags);
55 /* Enable the PLL Wakeup bit in SIC IWR */
56 iwr = bfin_read32(SIC_IWR);
57 /* Only allow PPL Wakeup) */
58 bfin_write32(SIC_IWR, IWR_ENABLE(0));
59
60 bfin_write16(PLL_CTL, val);
61 SSYNC();
62 asm("IDLE;");
63
64 bfin_write32(SIC_IWR, iwr);
65 local_irq_restore(flags);
66}
67#define bfin_read_PLL_STAT() bfin_read16(PLL_STAT) 44#define bfin_read_PLL_STAT() bfin_read16(PLL_STAT)
68#define bfin_write_PLL_STAT(val) bfin_write16(PLL_STAT,val) 45#define bfin_write_PLL_STAT(val) bfin_write16(PLL_STAT,val)
69#define bfin_read_PLL_LOCKCNT() bfin_read16(PLL_LOCKCNT) 46#define bfin_read_PLL_LOCKCNT() bfin_read16(PLL_LOCKCNT)
@@ -72,27 +49,6 @@ static __inline__ void bfin_write_PLL_CTL(unsigned int val)
72#define bfin_read_PLL_DIV() bfin_read16(PLL_DIV) 49#define bfin_read_PLL_DIV() bfin_read16(PLL_DIV)
73#define bfin_write_PLL_DIV(val) bfin_write16(PLL_DIV,val) 50#define bfin_write_PLL_DIV(val) bfin_write16(PLL_DIV,val)
74#define bfin_read_VR_CTL() bfin_read16(VR_CTL) 51#define bfin_read_VR_CTL() bfin_read16(VR_CTL)
75/* Writing to VR_CTL initiates a PLL relock sequence. */
76static __inline__ void bfin_write_VR_CTL(unsigned int val)
77{
78 unsigned long flags, iwr;
79
80 if (val == bfin_read_VR_CTL())
81 return;
82
83 local_irq_save(flags);
84 /* Enable the PLL Wakeup bit in SIC IWR */
85 iwr = bfin_read32(SIC_IWR);
86 /* Only allow PPL Wakeup) */
87 bfin_write32(SIC_IWR, IWR_ENABLE(0));
88
89 bfin_write16(VR_CTL, val);
90 SSYNC();
91 asm("IDLE;");
92
93 bfin_write32(SIC_IWR, iwr);
94 local_irq_restore(flags);
95}
96 52
97/* System Interrupt Controller (0xFFC0 0C00-0xFFC0 0FFF) */ 53/* System Interrupt Controller (0xFFC0 0C00-0xFFC0 0FFF) */
98#define bfin_read_SWRST() bfin_read16(SWRST) 54#define bfin_read_SWRST() bfin_read16(SWRST)
@@ -178,50 +134,6 @@ static __inline__ void bfin_write_VR_CTL(unsigned int val)
178#define bfin_read_FIO_MASKB_T() bfin_read16(FIO_MASKB_T) 134#define bfin_read_FIO_MASKB_T() bfin_read16(FIO_MASKB_T)
179#define bfin_write_FIO_MASKB_T(val) bfin_write16(FIO_MASKB_T,val) 135#define bfin_write_FIO_MASKB_T(val) bfin_write16(FIO_MASKB_T,val)
180 136
181
182#if ANOMALY_05000311
183#define BFIN_WRITE_FIO_FLAG(name) \
184static __inline__ void bfin_write_FIO_FLAG_ ## name (unsigned short val)\
185{\
186 unsigned long flags;\
187 local_irq_save(flags);\
188 bfin_write16(FIO_FLAG_ ## name,val);\
189 bfin_read_CHIPID();\
190 local_irq_restore(flags);\
191}
192BFIN_WRITE_FIO_FLAG(D)
193BFIN_WRITE_FIO_FLAG(C)
194BFIN_WRITE_FIO_FLAG(S)
195BFIN_WRITE_FIO_FLAG(T)
196
197#define BFIN_READ_FIO_FLAG(name) \
198static __inline__ unsigned short bfin_read_FIO_FLAG_ ## name (void)\
199{\
200 unsigned long flags;\
201 unsigned short ret;\
202 local_irq_save(flags);\
203 ret = bfin_read16(FIO_FLAG_ ## name);\
204 bfin_read_CHIPID();\
205 local_irq_restore(flags);\
206 return ret;\
207}
208BFIN_READ_FIO_FLAG(D)
209BFIN_READ_FIO_FLAG(C)
210BFIN_READ_FIO_FLAG(S)
211BFIN_READ_FIO_FLAG(T)
212
213#else
214#define bfin_write_FIO_FLAG_D(val) bfin_write16(FIO_FLAG_D,val)
215#define bfin_write_FIO_FLAG_C(val) bfin_write16(FIO_FLAG_C,val)
216#define bfin_write_FIO_FLAG_S(val) bfin_write16(FIO_FLAG_S,val)
217#define bfin_write_FIO_FLAG_T(val) bfin_write16(FIO_FLAG_T,val)
218#define bfin_read_FIO_FLAG_T() bfin_read16(FIO_FLAG_T)
219#define bfin_read_FIO_FLAG_C() bfin_read16(FIO_FLAG_C)
220#define bfin_read_FIO_FLAG_S() bfin_read16(FIO_FLAG_S)
221#define bfin_read_FIO_FLAG_D() bfin_read16(FIO_FLAG_D)
222#endif
223
224
225/* DMA Controller */ 137/* DMA Controller */
226#define bfin_read_DMA0_CONFIG() bfin_read16(DMA0_CONFIG) 138#define bfin_read_DMA0_CONFIG() bfin_read16(DMA0_CONFIG)
227#define bfin_write_DMA0_CONFIG(val) bfin_write16(DMA0_CONFIG,val) 139#define bfin_write_DMA0_CONFIG(val) bfin_write16(DMA0_CONFIG,val)
@@ -764,4 +676,93 @@ BFIN_READ_FIO_FLAG(T)
764#define bfin_read_PPI_FRAME() bfin_read16(PPI_FRAME) 676#define bfin_read_PPI_FRAME() bfin_read16(PPI_FRAME)
765#define bfin_write_PPI_FRAME(val) bfin_write16(PPI_FRAME,val) 677#define bfin_write_PPI_FRAME(val) bfin_write16(PPI_FRAME,val)
766 678
679/* These need to be last due to the cdef/linux inter-dependencies */
680#include <asm/irq.h>
681
682#if ANOMALY_05000311
683#define BFIN_WRITE_FIO_FLAG(name) \
684static inline void bfin_write_FIO_FLAG_##name(unsigned short val) \
685{ \
686 unsigned long flags; \
687 local_irq_save_hw(flags); \
688 bfin_write16(FIO_FLAG_##name, val); \
689 bfin_read_CHIPID(); \
690 local_irq_restore_hw(flags); \
691}
692BFIN_WRITE_FIO_FLAG(D)
693BFIN_WRITE_FIO_FLAG(C)
694BFIN_WRITE_FIO_FLAG(S)
695BFIN_WRITE_FIO_FLAG(T)
696
697#define BFIN_READ_FIO_FLAG(name) \
698static inline u16 bfin_read_FIO_FLAG_##name(void) \
699{ \
700 unsigned long flags; \
701 u16 ret; \
702 local_irq_save_hw(flags); \
703 ret = bfin_read16(FIO_FLAG_##name); \
704 bfin_read_CHIPID(); \
705 local_irq_restore_hw(flags); \
706 return ret; \
707}
708BFIN_READ_FIO_FLAG(D)
709BFIN_READ_FIO_FLAG(C)
710BFIN_READ_FIO_FLAG(S)
711BFIN_READ_FIO_FLAG(T)
712
713#else
714#define bfin_write_FIO_FLAG_D(val) bfin_write16(FIO_FLAG_D, val)
715#define bfin_write_FIO_FLAG_C(val) bfin_write16(FIO_FLAG_C, val)
716#define bfin_write_FIO_FLAG_S(val) bfin_write16(FIO_FLAG_S, val)
717#define bfin_write_FIO_FLAG_T(val) bfin_write16(FIO_FLAG_T, val)
718#define bfin_read_FIO_FLAG_T() bfin_read16(FIO_FLAG_T)
719#define bfin_read_FIO_FLAG_C() bfin_read16(FIO_FLAG_C)
720#define bfin_read_FIO_FLAG_S() bfin_read16(FIO_FLAG_S)
721#define bfin_read_FIO_FLAG_D() bfin_read16(FIO_FLAG_D)
722#endif
723
724/* Writing to PLL_CTL initiates a PLL relock sequence. */
725static __inline__ void bfin_write_PLL_CTL(unsigned int val)
726{
727 unsigned long flags, iwr;
728
729 if (val == bfin_read_PLL_CTL())
730 return;
731
732 local_irq_save_hw(flags);
733 /* Enable the PLL Wakeup bit in SIC IWR */
734 iwr = bfin_read32(SIC_IWR);
735 /* Only allow PPL Wakeup) */
736 bfin_write32(SIC_IWR, IWR_ENABLE(0));
737
738 bfin_write16(PLL_CTL, val);
739 SSYNC();
740 asm("IDLE;");
741
742 bfin_write32(SIC_IWR, iwr);
743 local_irq_restore_hw(flags);
744}
745
746/* Writing to VR_CTL initiates a PLL relock sequence. */
747static __inline__ void bfin_write_VR_CTL(unsigned int val)
748{
749 unsigned long flags, iwr;
750
751 if (val == bfin_read_VR_CTL())
752 return;
753
754 local_irq_save_hw(flags);
755 /* Enable the PLL Wakeup bit in SIC IWR */
756 iwr = bfin_read32(SIC_IWR);
757 /* Only allow PPL Wakeup) */
758 bfin_write32(SIC_IWR, IWR_ENABLE(0));
759
760 bfin_write16(VR_CTL, val);
761 SSYNC();
762 asm("IDLE;");
763
764 bfin_write32(SIC_IWR, iwr);
765 local_irq_restore_hw(flags);
766}
767
767#endif /* _CDEF_BF532_H */ 768#endif /* _CDEF_BF532_H */
diff --git a/arch/blackfin/mach-bf533/include/mach/dma.h b/arch/blackfin/mach-bf533/include/mach/dma.h
index bd9d5e94307d..fb34934c5ba8 100644
--- a/arch/blackfin/mach-bf533/include/mach/dma.h
+++ b/arch/blackfin/mach-bf533/include/mach/dma.h
@@ -1,42 +1,14 @@
1/***************************************************************************** 1/* mach/dma.h - arch-specific DMA defines
2*
3* BF-533/2/1 Specific Declarations
4*
5****************************************************************************/
6/*
7 * File: include/asm-blackfin/mach-bf533/dma.h
8 * Based on:
9 * Author:
10 * 2 *
11 * Created: 3 * Copyright 2004-2008 Analog Devices Inc.
12 * Description:
13 * 4 *
14 * Rev: 5 * Licensed under the GPL-2 or later.
15 *
16 * Modified:
17 *
18 * Bugs: Enter bugs at http://blackfin.uclinux.org/
19 *
20 * This program is free software; you can redistribute it and/or modify
21 * it under the terms of the GNU General Public License as published by
22 * the Free Software Foundation; either version 2, or (at your option)
23 * any later version.
24 *
25 * This program is distributed in the hope that it will be useful,
26 * but WITHOUT ANY WARRANTY; without even the implied warranty of
27 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
28 * GNU General Public License for more details.
29 *
30 * You should have received a copy of the GNU General Public License
31 * along with this program; see the file COPYING.
32 * If not, write to the Free Software Foundation,
33 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
34 */ 6 */
35 7
36#ifndef _MACH_DMA_H_ 8#ifndef _MACH_DMA_H_
37#define _MACH_DMA_H_ 9#define _MACH_DMA_H_
38 10
39#define MAX_BLACKFIN_DMA_CHANNEL 12 11#define MAX_DMA_CHANNELS 12
40 12
41#define CH_PPI 0 13#define CH_PPI 0
42#define CH_SPORT0_RX 1 14#define CH_SPORT0_RX 1
@@ -44,8 +16,8 @@
44#define CH_SPORT1_RX 3 16#define CH_SPORT1_RX 3
45#define CH_SPORT1_TX 4 17#define CH_SPORT1_TX 4
46#define CH_SPI 5 18#define CH_SPI 5
47#define CH_UART_RX 6 19#define CH_UART0_RX 6
48#define CH_UART_TX 7 20#define CH_UART0_TX 7
49#define CH_MEM_STREAM0_DEST 8 /* TX */ 21#define CH_MEM_STREAM0_DEST 8 /* TX */
50#define CH_MEM_STREAM0_SRC 9 /* RX */ 22#define CH_MEM_STREAM0_SRC 9 /* RX */
51#define CH_MEM_STREAM1_DEST 10 /* TX */ 23#define CH_MEM_STREAM1_DEST 10 /* TX */
diff --git a/arch/blackfin/mach-bf533/include/mach/gpio.h b/arch/blackfin/mach-bf533/include/mach/gpio.h
new file mode 100644
index 000000000000..e45c17077aff
--- /dev/null
+++ b/arch/blackfin/mach-bf533/include/mach/gpio.h
@@ -0,0 +1,34 @@
1/*
2 * File: arch/blackfin/mach-bf533/include/mach/gpio.h
3 * Bugs: Enter bugs at http://blackfin.uclinux.org/
4 *
5 * Copyright (C) 2008 Analog Devices Inc.
6 * Licensed under the GPL-2 or later.
7 */
8
9
10#ifndef _MACH_GPIO_H_
11#define _MACH_GPIO_H_
12
13#define MAX_BLACKFIN_GPIOS 16
14
15#define GPIO_PF0 0
16#define GPIO_PF1 1
17#define GPIO_PF2 2
18#define GPIO_PF3 3
19#define GPIO_PF4 4
20#define GPIO_PF5 5
21#define GPIO_PF6 6
22#define GPIO_PF7 7
23#define GPIO_PF8 8
24#define GPIO_PF9 9
25#define GPIO_PF10 10
26#define GPIO_PF11 11
27#define GPIO_PF12 12
28#define GPIO_PF13 13
29#define GPIO_PF14 14
30#define GPIO_PF15 15
31
32#define PORT_F GPIO_PF0
33
34#endif /* _MACH_GPIO_H_ */
diff --git a/arch/blackfin/mach-bf533/include/mach/irq.h b/arch/blackfin/mach-bf533/include/mach/irq.h
index 5aa38e5da6b7..db1e346cd1aa 100644
--- a/arch/blackfin/mach-bf533/include/mach/irq.h
+++ b/arch/blackfin/mach-bf533/include/mach/irq.h
@@ -90,19 +90,19 @@ Core Emulation **
90#define IRQ_SPORT0_ERROR 10 /*SPORT0 Error Interrupt */ 90#define IRQ_SPORT0_ERROR 10 /*SPORT0 Error Interrupt */
91#define IRQ_SPORT1_ERROR 11 /*SPORT1 Error Interrupt */ 91#define IRQ_SPORT1_ERROR 11 /*SPORT1 Error Interrupt */
92#define IRQ_SPI_ERROR 12 /*SPI Error Interrupt */ 92#define IRQ_SPI_ERROR 12 /*SPI Error Interrupt */
93#define IRQ_UART_ERROR 13 /*UART Error Interrupt */ 93#define IRQ_UART0_ERROR 13 /*UART Error Interrupt */
94#define IRQ_RTC 14 /*RTC Interrupt */ 94#define IRQ_RTC 14 /*RTC Interrupt */
95#define IRQ_PPI 15 /*DMA0 Interrupt (PPI) */ 95#define IRQ_PPI 15 /*DMA0 Interrupt (PPI) */
96#define IRQ_SPORT0_RX 16 /*DMA1 Interrupt (SPORT0 RX) */ 96#define IRQ_SPORT0_RX 16 /*DMA1 Interrupt (SPORT0 RX) */
97#define IRQ_SPORT0_TX 17 /*DMA2 Interrupt (SPORT0 TX) */ 97#define IRQ_SPORT0_TX 17 /*DMA2 Interrupt (SPORT0 TX) */
98#define IRQ_SPORT1_RX 18 /*DMA3 Interrupt (SPORT1 RX) */ 98#define IRQ_SPORT1_RX 18 /*DMA3 Interrupt (SPORT1 RX) */
99#define IRQ_SPORT1_TX 19 /*DMA4 Interrupt (SPORT1 TX) */ 99#define IRQ_SPORT1_TX 19 /*DMA4 Interrupt (SPORT1 TX) */
100#define IRQ_SPI 20 /*DMA5 Interrupt (SPI) */ 100#define IRQ_SPI 20 /*DMA5 Interrupt (SPI) */
101#define IRQ_UART_RX 21 /*DMA6 Interrupt (UART RX) */ 101#define IRQ_UART0_RX 21 /*DMA6 Interrupt (UART RX) */
102#define IRQ_UART_TX 22 /*DMA7 Interrupt (UART TX) */ 102#define IRQ_UART0_TX 22 /*DMA7 Interrupt (UART TX) */
103#define IRQ_TMR0 23 /*Timer 0 */ 103#define IRQ_TIMER0 23 /*Timer 0 */
104#define IRQ_TMR1 24 /*Timer 1 */ 104#define IRQ_TIMER1 24 /*Timer 1 */
105#define IRQ_TMR2 25 /*Timer 2 */ 105#define IRQ_TIMER2 25 /*Timer 2 */
106#define IRQ_PROG_INTA 26 /*Programmable Flags A (8) */ 106#define IRQ_PROG_INTA 26 /*Programmable Flags A (8) */
107#define IRQ_PROG_INTB 27 /*Programmable Flags B (8) */ 107#define IRQ_PROG_INTB 27 /*Programmable Flags B (8) */
108#define IRQ_MEM_DMA0 28 /*DMA8/9 Interrupt (Memory DMA Stream 0) */ 108#define IRQ_MEM_DMA0 28 /*DMA8/9 Interrupt (Memory DMA Stream 0) */
diff --git a/arch/blackfin/mach-bf533/include/mach/mem_init.h b/arch/blackfin/mach-bf533/include/mach/mem_init.h
deleted file mode 100644
index ed2034bf10ec..000000000000
--- a/arch/blackfin/mach-bf533/include/mach/mem_init.h
+++ /dev/null
@@ -1,297 +0,0 @@
1/*
2 * File: include/asm-blackfin/mach-bf533/mem_init.h
3 * Based on:
4 * Author:
5 *
6 * Created:
7 * Description:
8 *
9 * Rev:
10 *
11 * Modified:
12 * Copyright 2004-2006 Analog Devices Inc.
13 *
14 * Bugs: Enter bugs at http://blackfin.uclinux.org/
15 *
16 * This program is free software; you can redistribute it and/or modify
17 * it under the terms of the GNU General Public License as published by
18 * the Free Software Foundation; either version 2, or (at your option)
19 * any later version.
20 *
21 * This program is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 * GNU General Public License for more details.
25 *
26 * You should have received a copy of the GNU General Public License
27 * along with this program; see the file COPYING.
28 * If not, write to the Free Software Foundation,
29 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
30 */
31
32#if (CONFIG_MEM_MT48LC16M16A2TG_75 || CONFIG_MEM_MT48LC64M4A2FB_7E || \
33 CONFIG_MEM_MT48LC32M16A2TG_75 || CONFIG_MEM_GENERIC_BOARD)
34#if (CONFIG_SCLK_HZ > 119402985)
35#define SDRAM_tRP TRP_2
36#define SDRAM_tRP_num 2
37#define SDRAM_tRAS TRAS_7
38#define SDRAM_tRAS_num 7
39#define SDRAM_tRCD TRCD_2
40#define SDRAM_tWR TWR_2
41#endif
42#if (CONFIG_SCLK_HZ > 104477612) && (CONFIG_SCLK_HZ <= 119402985)
43#define SDRAM_tRP TRP_2
44#define SDRAM_tRP_num 2
45#define SDRAM_tRAS TRAS_6
46#define SDRAM_tRAS_num 6
47#define SDRAM_tRCD TRCD_2
48#define SDRAM_tWR TWR_2
49#endif
50#if (CONFIG_SCLK_HZ > 89552239) && (CONFIG_SCLK_HZ <= 104477612)
51#define SDRAM_tRP TRP_2
52#define SDRAM_tRP_num 2
53#define SDRAM_tRAS TRAS_5
54#define SDRAM_tRAS_num 5
55#define SDRAM_tRCD TRCD_2
56#define SDRAM_tWR TWR_2
57#endif
58#if (CONFIG_SCLK_HZ > 74626866) && (CONFIG_SCLK_HZ <= 89552239)
59#define SDRAM_tRP TRP_2
60#define SDRAM_tRP_num 2
61#define SDRAM_tRAS TRAS_4
62#define SDRAM_tRAS_num 4
63#define SDRAM_tRCD TRCD_2
64#define SDRAM_tWR TWR_2
65#endif
66#if (CONFIG_SCLK_HZ > 66666667) && (CONFIG_SCLK_HZ <= 74626866)
67#define SDRAM_tRP TRP_2
68#define SDRAM_tRP_num 2
69#define SDRAM_tRAS TRAS_3
70#define SDRAM_tRAS_num 3
71#define SDRAM_tRCD TRCD_2
72#define SDRAM_tWR TWR_2
73#endif
74#if (CONFIG_SCLK_HZ > 59701493) && (CONFIG_SCLK_HZ <= 66666667)
75#define SDRAM_tRP TRP_1
76#define SDRAM_tRP_num 1
77#define SDRAM_tRAS TRAS_4
78#define SDRAM_tRAS_num 3
79#define SDRAM_tRCD TRCD_1
80#define SDRAM_tWR TWR_2
81#endif
82#if (CONFIG_SCLK_HZ > 44776119) && (CONFIG_SCLK_HZ <= 59701493)
83#define SDRAM_tRP TRP_1
84#define SDRAM_tRP_num 1
85#define SDRAM_tRAS TRAS_3
86#define SDRAM_tRAS_num 3
87#define SDRAM_tRCD TRCD_1
88#define SDRAM_tWR TWR_2
89#endif
90#if (CONFIG_SCLK_HZ > 29850746) && (CONFIG_SCLK_HZ <= 44776119)
91#define SDRAM_tRP TRP_1
92#define SDRAM_tRP_num 1
93#define SDRAM_tRAS TRAS_2
94#define SDRAM_tRAS_num 2
95#define SDRAM_tRCD TRCD_1
96#define SDRAM_tWR TWR_2
97#endif
98#if (CONFIG_SCLK_HZ <= 29850746)
99#define SDRAM_tRP TRP_1
100#define SDRAM_tRP_num 1
101#define SDRAM_tRAS TRAS_1
102#define SDRAM_tRAS_num 1
103#define SDRAM_tRCD TRCD_1
104#define SDRAM_tWR TWR_2
105#endif
106#endif
107
108#if (CONFIG_MEM_MT48LC16M16A2TG_75)
109 /*SDRAM INFORMATION: */
110#define SDRAM_Tref 64 /* Refresh period in milliseconds */
111#define SDRAM_NRA 8192 /* Number of row addresses in SDRAM */
112#define SDRAM_CL CL_3
113#endif
114
115#if (CONFIG_MEM_MT48LC64M4A2FB_7E)
116 /*SDRAM INFORMATION: */
117#define SDRAM_Tref 64 /* Refresh period in milliseconds */
118#define SDRAM_NRA 8192 /* Number of row addresses in SDRAM */
119#define SDRAM_CL CL_3
120#endif
121
122#if (CONFIG_MEM_MT48LC32M16A2TG_75)
123 /*SDRAM INFORMATION: */
124#define SDRAM_Tref 64 /* Refresh period in milliseconds */
125#define SDRAM_NRA 8192 /* Number of row addresses in SDRAM */
126#define SDRAM_CL CL_3
127#endif
128
129#if (CONFIG_MEM_GENERIC_BOARD)
130 /*SDRAM INFORMATION: Modify this for your board */
131#define SDRAM_Tref 64 /* Refresh period in milliseconds */
132#define SDRAM_NRA 8192 /* Number of row addresses in SDRAM */
133#define SDRAM_CL CL_3
134#endif
135
136/* Equation from section 17 (p17-46) of BF533 HRM */
137#define mem_SDRRC (((CONFIG_SCLK_HZ / 1000) * SDRAM_Tref) / SDRAM_NRA) - (SDRAM_tRAS_num + SDRAM_tRP_num)
138
139/* Enable SCLK Out */
140#define mem_SDGCTL (SCTLE | SDRAM_CL | SDRAM_tRAS | SDRAM_tRP | SDRAM_tRCD | SDRAM_tWR | PSS)
141
142#if defined CONFIG_CLKIN_HALF
143#define CLKIN_HALF 1
144#else
145#define CLKIN_HALF 0
146#endif
147
148#if defined CONFIG_PLL_BYPASS
149#define PLL_BYPASS 1
150#else
151#define PLL_BYPASS 0
152#endif
153
154/***************************************Currently Not Being Used *********************************/
155#define flash_EBIU_AMBCTL_WAT ((CONFIG_FLASH_SPEED_BWAT * 4) / (4000000000 / CONFIG_SCLK_HZ)) + 1
156#define flash_EBIU_AMBCTL_RAT ((CONFIG_FLASH_SPEED_BRAT * 4) / (4000000000 / CONFIG_SCLK_HZ)) + 1
157#define flash_EBIU_AMBCTL_HT ((CONFIG_FLASH_SPEED_BHT * 4) / (4000000000 / CONFIG_SCLK_HZ))
158#define flash_EBIU_AMBCTL_ST ((CONFIG_FLASH_SPEED_BST * 4) / (4000000000 / CONFIG_SCLK_HZ)) + 1
159#define flash_EBIU_AMBCTL_TT ((CONFIG_FLASH_SPEED_BTT * 4) / (4000000000 / CONFIG_SCLK_HZ)) + 1
160
161#if (flash_EBIU_AMBCTL_TT > 3)
162#define flash_EBIU_AMBCTL0_TT B0TT_4
163#endif
164#if (flash_EBIU_AMBCTL_TT == 3)
165#define flash_EBIU_AMBCTL0_TT B0TT_3
166#endif
167#if (flash_EBIU_AMBCTL_TT == 2)
168#define flash_EBIU_AMBCTL0_TT B0TT_2
169#endif
170#if (flash_EBIU_AMBCTL_TT < 2)
171#define flash_EBIU_AMBCTL0_TT B0TT_1
172#endif
173
174#if (flash_EBIU_AMBCTL_ST > 3)
175#define flash_EBIU_AMBCTL0_ST B0ST_4
176#endif
177#if (flash_EBIU_AMBCTL_ST == 3)
178#define flash_EBIU_AMBCTL0_ST B0ST_3
179#endif
180#if (flash_EBIU_AMBCTL_ST == 2)
181#define flash_EBIU_AMBCTL0_ST B0ST_2
182#endif
183#if (flash_EBIU_AMBCTL_ST < 2)
184#define flash_EBIU_AMBCTL0_ST B0ST_1
185#endif
186
187#if (flash_EBIU_AMBCTL_HT > 2)
188#define flash_EBIU_AMBCTL0_HT B0HT_3
189#endif
190#if (flash_EBIU_AMBCTL_HT == 2)
191#define flash_EBIU_AMBCTL0_HT B0HT_2
192#endif
193#if (flash_EBIU_AMBCTL_HT == 1)
194#define flash_EBIU_AMBCTL0_HT B0HT_1
195#endif
196#if (flash_EBIU_AMBCTL_HT == 0 && CONFIG_FLASH_SPEED_BHT == 0)
197#define flash_EBIU_AMBCTL0_HT B0HT_0
198#endif
199#if (flash_EBIU_AMBCTL_HT == 0 && CONFIG_FLASH_SPEED_BHT != 0)
200#define flash_EBIU_AMBCTL0_HT B0HT_1
201#endif
202
203#if (flash_EBIU_AMBCTL_WAT > 14)
204#define flash_EBIU_AMBCTL0_WAT B0WAT_15
205#endif
206#if (flash_EBIU_AMBCTL_WAT == 14)
207#define flash_EBIU_AMBCTL0_WAT B0WAT_14
208#endif
209#if (flash_EBIU_AMBCTL_WAT == 13)
210#define flash_EBIU_AMBCTL0_WAT B0WAT_13
211#endif
212#if (flash_EBIU_AMBCTL_WAT == 12)
213#define flash_EBIU_AMBCTL0_WAT B0WAT_12
214#endif
215#if (flash_EBIU_AMBCTL_WAT == 11)
216#define flash_EBIU_AMBCTL0_WAT B0WAT_11
217#endif
218#if (flash_EBIU_AMBCTL_WAT == 10)
219#define flash_EBIU_AMBCTL0_WAT B0WAT_10
220#endif
221#if (flash_EBIU_AMBCTL_WAT == 9)
222#define flash_EBIU_AMBCTL0_WAT B0WAT_9
223#endif
224#if (flash_EBIU_AMBCTL_WAT == 8)
225#define flash_EBIU_AMBCTL0_WAT B0WAT_8
226#endif
227#if (flash_EBIU_AMBCTL_WAT == 7)
228#define flash_EBIU_AMBCTL0_WAT B0WAT_7
229#endif
230#if (flash_EBIU_AMBCTL_WAT == 6)
231#define flash_EBIU_AMBCTL0_WAT B0WAT_6
232#endif
233#if (flash_EBIU_AMBCTL_WAT == 5)
234#define flash_EBIU_AMBCTL0_WAT B0WAT_5
235#endif
236#if (flash_EBIU_AMBCTL_WAT == 4)
237#define flash_EBIU_AMBCTL0_WAT B0WAT_4
238#endif
239#if (flash_EBIU_AMBCTL_WAT == 3)
240#define flash_EBIU_AMBCTL0_WAT B0WAT_3
241#endif
242#if (flash_EBIU_AMBCTL_WAT == 2)
243#define flash_EBIU_AMBCTL0_WAT B0WAT_2
244#endif
245#if (flash_EBIU_AMBCTL_WAT == 1)
246#define flash_EBIU_AMBCTL0_WAT B0WAT_1
247#endif
248
249#if (flash_EBIU_AMBCTL_RAT > 14)
250#define flash_EBIU_AMBCTL0_RAT B0RAT_15
251#endif
252#if (flash_EBIU_AMBCTL_RAT == 14)
253#define flash_EBIU_AMBCTL0_RAT B0RAT_14
254#endif
255#if (flash_EBIU_AMBCTL_RAT == 13)
256#define flash_EBIU_AMBCTL0_RAT B0RAT_13
257#endif
258#if (flash_EBIU_AMBCTL_RAT == 12)
259#define flash_EBIU_AMBCTL0_RAT B0RAT_12
260#endif
261#if (flash_EBIU_AMBCTL_RAT == 11)
262#define flash_EBIU_AMBCTL0_RAT B0RAT_11
263#endif
264#if (flash_EBIU_AMBCTL_RAT == 10)
265#define flash_EBIU_AMBCTL0_RAT B0RAT_10
266#endif
267#if (flash_EBIU_AMBCTL_RAT == 9)
268#define flash_EBIU_AMBCTL0_RAT B0RAT_9
269#endif
270#if (flash_EBIU_AMBCTL_RAT == 8)
271#define flash_EBIU_AMBCTL0_RAT B0RAT_8
272#endif
273#if (flash_EBIU_AMBCTL_RAT == 7)
274#define flash_EBIU_AMBCTL0_RAT B0RAT_7
275#endif
276#if (flash_EBIU_AMBCTL_RAT == 6)
277#define flash_EBIU_AMBCTL0_RAT B0RAT_6
278#endif
279#if (flash_EBIU_AMBCTL_RAT == 5)
280#define flash_EBIU_AMBCTL0_RAT B0RAT_5
281#endif
282#if (flash_EBIU_AMBCTL_RAT == 4)
283#define flash_EBIU_AMBCTL0_RAT B0RAT_4
284#endif
285#if (flash_EBIU_AMBCTL_RAT == 3)
286#define flash_EBIU_AMBCTL0_RAT B0RAT_3
287#endif
288#if (flash_EBIU_AMBCTL_RAT == 2)
289#define flash_EBIU_AMBCTL0_RAT B0RAT_2
290#endif
291#if (flash_EBIU_AMBCTL_RAT == 1)
292#define flash_EBIU_AMBCTL0_RAT B0RAT_1
293#endif
294
295#define flash_EBIU_AMBCTL0 \
296 (flash_EBIU_AMBCTL0_WAT | flash_EBIU_AMBCTL0_RAT | flash_EBIU_AMBCTL0_HT | \
297 flash_EBIU_AMBCTL0_ST | flash_EBIU_AMBCTL0_TT | CONFIG_FLASH_SPEED_RDYEN)
diff --git a/arch/blackfin/mach-bf533/include/mach/mem_map.h b/arch/blackfin/mach-bf533/include/mach/mem_map.h
index 581fc6eea789..fc33b7cb9937 100644
--- a/arch/blackfin/mach-bf533/include/mach/mem_map.h
+++ b/arch/blackfin/mach-bf533/include/mach/mem_map.h
@@ -168,4 +168,10 @@
168#define L1_SCRATCH_START 0xFFB00000 168#define L1_SCRATCH_START 0xFFB00000
169#define L1_SCRATCH_LENGTH 0x1000 169#define L1_SCRATCH_LENGTH 0x1000
170 170
171#define GET_PDA_SAFE(preg) \
172 preg.l = _cpu_pda; \
173 preg.h = _cpu_pda;
174
175#define GET_PDA(preg, dreg) GET_PDA_SAFE(preg)
176
171#endif /* _MEM_MAP_533_H_ */ 177#endif /* _MEM_MAP_533_H_ */
diff --git a/arch/blackfin/mach-bf537/Kconfig b/arch/blackfin/mach-bf537/Kconfig
index 8255374c04aa..bbc08fd4f122 100644
--- a/arch/blackfin/mach-bf537/Kconfig
+++ b/arch/blackfin/mach-bf537/Kconfig
@@ -64,29 +64,29 @@ config IRQ_MAC_RX
64config IRQ_MAC_TX 64config IRQ_MAC_TX
65 int "IRQ_MAC_TX" 65 int "IRQ_MAC_TX"
66 default 11 66 default 11
67config IRQ_TMR0 67config IRQ_TIMER0
68 int "IRQ_TMR0" 68 int "IRQ_TIMER0"
69 default 12 69 default 8
70config IRQ_TMR1 70config IRQ_TIMER1
71 int "IRQ_TMR1" 71 int "IRQ_TIMER1"
72 default 12 72 default 12
73config IRQ_TMR2 73config IRQ_TIMER2
74 int "IRQ_TMR2" 74 int "IRQ_TIMER2"
75 default 12 75 default 12
76config IRQ_TMR3 76config IRQ_TIMER3
77 int "IRQ_TMR3" 77 int "IRQ_TIMER3"
78 default 12 78 default 12
79config IRQ_TMR4 79config IRQ_TIMER4
80 int "IRQ_TMR4" 80 int "IRQ_TIMER4"
81 default 12 81 default 12
82config IRQ_TMR5 82config IRQ_TIMER5
83 int "IRQ_TMR5" 83 int "IRQ_TIMER5"
84 default 12 84 default 12
85config IRQ_TMR6 85config IRQ_TIMER6
86 int "IRQ_TMR6" 86 int "IRQ_TIMER6"
87 default 12 87 default 12
88config IRQ_TMR7 88config IRQ_TIMER7
89 int "IRQ_TMR7" 89 int "IRQ_TIMER7"
90 default 12 90 default 12
91config IRQ_PROG_INTA 91config IRQ_PROG_INTA
92 int "IRQ_PROG_INTA" 92 int "IRQ_PROG_INTA"
diff --git a/arch/blackfin/mach-bf537/Makefile b/arch/blackfin/mach-bf537/Makefile
index 68e5478e95a9..56994b675f9c 100644
--- a/arch/blackfin/mach-bf537/Makefile
+++ b/arch/blackfin/mach-bf537/Makefile
@@ -2,6 +2,4 @@
2# arch/blackfin/mach-bf537/Makefile 2# arch/blackfin/mach-bf537/Makefile
3# 3#
4 4
5extra-y := head.o
6
7obj-y := ints-priority.o dma.o 5obj-y := ints-priority.o dma.o
diff --git a/arch/blackfin/mach-bf537/boards/cm_bf537.c b/arch/blackfin/mach-bf537/boards/cm_bf537.c
index dde14720b0ea..6ac8e4d5bd38 100644
--- a/arch/blackfin/mach-bf537/boards/cm_bf537.c
+++ b/arch/blackfin/mach-bf537/boards/cm_bf537.c
@@ -308,6 +308,19 @@ static struct platform_device net2272_bfin_device = {
308}; 308};
309#endif 309#endif
310 310
311static struct resource bfin_gpios_resources = {
312 .start = 0,
313 .end = MAX_BLACKFIN_GPIOS - 1,
314 .flags = IORESOURCE_IRQ,
315};
316
317static struct platform_device bfin_gpios_device = {
318 .name = "simple-gpio",
319 .id = -1,
320 .num_resources = 1,
321 .resource = &bfin_gpios_resources,
322};
323
311#if defined(CONFIG_MTD_GPIO_ADDR) || defined(CONFIG_MTD_GPIO_ADDR_MODULE) 324#if defined(CONFIG_MTD_GPIO_ADDR) || defined(CONFIG_MTD_GPIO_ADDR_MODULE)
312static struct mtd_partition cm_partitions[] = { 325static struct mtd_partition cm_partitions[] = {
313 { 326 {
@@ -379,30 +392,57 @@ static struct platform_device bfin_uart_device = {
379#endif 392#endif
380 393
381#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE) 394#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
382static struct resource bfin_sir_resources[] = {
383#ifdef CONFIG_BFIN_SIR0 395#ifdef CONFIG_BFIN_SIR0
396static struct resource bfin_sir0_resources[] = {
384 { 397 {
385 .start = 0xFFC00400, 398 .start = 0xFFC00400,
386 .end = 0xFFC004FF, 399 .end = 0xFFC004FF,
387 .flags = IORESOURCE_MEM, 400 .flags = IORESOURCE_MEM,
388 }, 401 },
402 {
403 .start = IRQ_UART0_RX,
404 .end = IRQ_UART0_RX+1,
405 .flags = IORESOURCE_IRQ,
406 },
407 {
408 .start = CH_UART0_RX,
409 .end = CH_UART0_RX+1,
410 .flags = IORESOURCE_DMA,
411 },
412};
413static struct platform_device bfin_sir0_device = {
414 .name = "bfin_sir",
415 .id = 0,
416 .num_resources = ARRAY_SIZE(bfin_sir0_resources),
417 .resource = bfin_sir0_resources,
418};
389#endif 419#endif
390#ifdef CONFIG_BFIN_SIR1 420#ifdef CONFIG_BFIN_SIR1
421static struct resource bfin_sir1_resources[] = {
391 { 422 {
392 .start = 0xFFC02000, 423 .start = 0xFFC02000,
393 .end = 0xFFC020FF, 424 .end = 0xFFC020FF,
394 .flags = IORESOURCE_MEM, 425 .flags = IORESOURCE_MEM,
395 }, 426 },
396#endif 427 {
428 .start = IRQ_UART1_RX,
429 .end = IRQ_UART1_RX+1,
430 .flags = IORESOURCE_IRQ,
431 },
432 {
433 .start = CH_UART1_RX,
434 .end = CH_UART1_RX+1,
435 .flags = IORESOURCE_DMA,
436 },
397}; 437};
398 438static struct platform_device bfin_sir1_device = {
399static struct platform_device bfin_sir_device = {
400 .name = "bfin_sir", 439 .name = "bfin_sir",
401 .id = 0, 440 .id = 1,
402 .num_resources = ARRAY_SIZE(bfin_sir_resources), 441 .num_resources = ARRAY_SIZE(bfin_sir1_resources),
403 .resource = bfin_sir_resources, 442 .resource = bfin_sir1_resources,
404}; 443};
405#endif 444#endif
445#endif
406 446
407#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE) 447#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
408static struct resource bfin_twi0_resource[] = { 448static struct resource bfin_twi0_resource[] = {
@@ -525,7 +565,12 @@ static struct platform_device *cm_bf537_devices[] __initdata = {
525#endif 565#endif
526 566
527#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE) 567#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
528 &bfin_sir_device, 568#ifdef CONFIG_BFIN_SIR0
569 &bfin_sir0_device,
570#endif
571#ifdef CONFIG_BFIN_SIR1
572 &bfin_sir1_device,
573#endif
529#endif 574#endif
530 575
531#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE) 576#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
@@ -564,6 +609,8 @@ static struct platform_device *cm_bf537_devices[] __initdata = {
564#if defined(CONFIG_MTD_GPIO_ADDR) || defined(CONFIG_MTD_GPIO_ADDR_MODULE) 609#if defined(CONFIG_MTD_GPIO_ADDR) || defined(CONFIG_MTD_GPIO_ADDR_MODULE)
565 &cm_flash_device, 610 &cm_flash_device,
566#endif 611#endif
612
613 &bfin_gpios_device,
567}; 614};
568 615
569static int __init cm_bf537_init(void) 616static int __init cm_bf537_init(void)
diff --git a/arch/blackfin/mach-bf537/boards/generic_board.c b/arch/blackfin/mach-bf537/boards/generic_board.c
index 78a13d5bfd55..dd6e6bfb98ea 100644
--- a/arch/blackfin/mach-bf537/boards/generic_board.c
+++ b/arch/blackfin/mach-bf537/boards/generic_board.c
@@ -50,57 +50,46 @@
50/* 50/*
51 * Name the Board for the /proc/cpuinfo 51 * Name the Board for the /proc/cpuinfo
52 */ 52 */
53const char bfin_board_name[] = "GENERIC Board"; 53const char bfin_board_name[] = "UNKNOWN BOARD";
54 54
55/* 55/*
56 * Driver needs to know address, irq and flag pin. 56 * Driver needs to know address, irq and flag pin.
57 */ 57 */
58 58
59#define ISP1761_BASE 0x203C0000
60#define ISP1761_IRQ IRQ_PF7
61
62#if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE) 59#if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
63static struct resource bfin_isp1761_resources[] = { 60#include <linux/usb/isp1760.h>
61static struct resource bfin_isp1760_resources[] = {
64 [0] = { 62 [0] = {
65 .name = "isp1761-regs", 63 .start = 0x203C0000,
66 .start = ISP1761_BASE + 0x00000000, 64 .end = 0x203C0000 + 0x000fffff,
67 .end = ISP1761_BASE + 0x000fffff,
68 .flags = IORESOURCE_MEM, 65 .flags = IORESOURCE_MEM,
69 }, 66 },
70 [1] = { 67 [1] = {
71 .start = ISP1761_IRQ, 68 .start = IRQ_PF7,
72 .end = ISP1761_IRQ, 69 .end = IRQ_PF7,
73 .flags = IORESOURCE_IRQ, 70 .flags = IORESOURCE_IRQ,
74 }, 71 },
75}; 72};
76 73
77static struct platform_device bfin_isp1761_device = { 74static struct isp1760_platform_data isp1760_priv = {
78 .name = "isp1761", 75 .is_isp1761 = 0,
79 .id = 0, 76 .port1_disable = 0,
80 .num_resources = ARRAY_SIZE(bfin_isp1761_resources), 77 .bus_width_16 = 1,
81 .resource = bfin_isp1761_resources, 78 .port1_otg = 0,
79 .analog_oc = 0,
80 .dack_polarity_high = 0,
81 .dreq_polarity_high = 0,
82}; 82};
83 83
84static struct platform_device *bfin_isp1761_devices[] = { 84static struct platform_device bfin_isp1760_device = {
85 &bfin_isp1761_device, 85 .name = "isp1760-hcd",
86 .id = 0,
87 .dev = {
88 .platform_data = &isp1760_priv,
89 },
90 .num_resources = ARRAY_SIZE(bfin_isp1760_resources),
91 .resource = bfin_isp1760_resources,
86}; 92};
87
88int __init bfin_isp1761_init(void)
89{
90 unsigned int num_devices = ARRAY_SIZE(bfin_isp1761_devices);
91
92 printk(KERN_INFO "%s(): registering device resources\n", __func__);
93 set_irq_type(ISP1761_IRQ, IRQF_TRIGGER_FALLING);
94
95 return platform_add_devices(bfin_isp1761_devices, num_devices);
96}
97
98void __exit bfin_isp1761_exit(void)
99{
100 platform_device_unregister(&bfin_isp1761_device);
101}
102
103arch_initcall(bfin_isp1761_init);
104#endif 93#endif
105 94
106#if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE) 95#if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
@@ -559,30 +548,59 @@ static struct platform_device bfin_uart_device = {
559#endif 548#endif
560 549
561#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE) 550#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
562static struct resource bfin_sir_resources[] = {
563#ifdef CONFIG_BFIN_SIR0 551#ifdef CONFIG_BFIN_SIR0
552static struct resource bfin_sir0_resources[] = {
564 { 553 {
565 .start = 0xFFC00400, 554 .start = 0xFFC00400,
566 .end = 0xFFC004FF, 555 .end = 0xFFC004FF,
567 .flags = IORESOURCE_MEM, 556 .flags = IORESOURCE_MEM,
568 }, 557 },
558 {
559 .start = IRQ_UART0_RX,
560 .end = IRQ_UART0_RX+1,
561 .flags = IORESOURCE_IRQ,
562 },
563 {
564 .start = CH_UART0_RX,
565 .end = CH_UART0_RX+1,
566 .flags = IORESOURCE_DMA,
567 },
568};
569
570static struct platform_device bfin_sir0_device = {
571 .name = "bfin_sir",
572 .id = 0,
573 .num_resources = ARRAY_SIZE(bfin_sir0_resources),
574 .resource = bfin_sir0_resources,
575};
569#endif 576#endif
570#ifdef CONFIG_BFIN_SIR1 577#ifdef CONFIG_BFIN_SIR1
578static struct resource bfin_sir1_resources[] = {
571 { 579 {
572 .start = 0xFFC02000, 580 .start = 0xFFC02000,
573 .end = 0xFFC020FF, 581 .end = 0xFFC020FF,
574 .flags = IORESOURCE_MEM, 582 .flags = IORESOURCE_MEM,
575 }, 583 },
576#endif 584 {
585 .start = IRQ_UART1_RX,
586 .end = IRQ_UART1_RX+1,
587 .flags = IORESOURCE_IRQ,
588 },
589 {
590 .start = CH_UART1_RX,
591 .end = CH_UART1_RX+1,
592 .flags = IORESOURCE_DMA,
593 },
577}; 594};
578 595
579static struct platform_device bfin_sir_device = { 596static struct platform_device bfin_sir1_device = {
580 .name = "bfin_sir", 597 .name = "bfin_sir",
581 .id = 0, 598 .id = 1,
582 .num_resources = ARRAY_SIZE(bfin_sir_resources), 599 .num_resources = ARRAY_SIZE(bfin_sir1_resources),
583 .resource = bfin_sir_resources, 600 .resource = bfin_sir1_resources,
584}; 601};
585#endif 602#endif
603#endif
586 604
587#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE) 605#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
588static struct resource bfin_twi0_resource[] = { 606static struct resource bfin_twi0_resource[] = {
@@ -651,6 +669,10 @@ static struct platform_device *stamp_devices[] __initdata = {
651 &net2272_bfin_device, 669 &net2272_bfin_device,
652#endif 670#endif
653 671
672#if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
673 &bfin_isp1760_device,
674#endif
675
654#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE) 676#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
655 &bfin_spi0_device, 677 &bfin_spi0_device,
656#endif 678#endif
@@ -668,7 +690,12 @@ static struct platform_device *stamp_devices[] __initdata = {
668#endif 690#endif
669 691
670#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE) 692#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
671 &bfin_sir_device, 693#ifdef CONFIG_BFIN_SIR0
694 &bfin_sir0_device,
695#endif
696#ifdef CONFIG_BFIN_SIR1
697 &bfin_sir1_device,
698#endif
672#endif 699#endif
673 700
674#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE) 701#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
diff --git a/arch/blackfin/mach-bf537/boards/minotaur.c b/arch/blackfin/mach-bf537/boards/minotaur.c
index 48c4cd2d1be6..bb795341cb17 100644
--- a/arch/blackfin/mach-bf537/boards/minotaur.c
+++ b/arch/blackfin/mach-bf537/boards/minotaur.c
@@ -226,30 +226,59 @@ static struct platform_device bfin_uart_device = {
226#endif 226#endif
227 227
228#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE) 228#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
229static struct resource bfin_sir_resources[] = {
230#ifdef CONFIG_BFIN_SIR0 229#ifdef CONFIG_BFIN_SIR0
230static struct resource bfin_sir0_resources[] = {
231 { 231 {
232 .start = 0xFFC00400, 232 .start = 0xFFC00400,
233 .end = 0xFFC004FF, 233 .end = 0xFFC004FF,
234 .flags = IORESOURCE_MEM, 234 .flags = IORESOURCE_MEM,
235 }, 235 },
236 {
237 .start = IRQ_UART0_RX,
238 .end = IRQ_UART0_RX+1,
239 .flags = IORESOURCE_IRQ,
240 },
241 {
242 .start = CH_UART0_RX,
243 .end = CH_UART0_RX+1,
244 .flags = IORESOURCE_DMA,
245 },
246};
247
248static struct platform_device bfin_sir0_device = {
249 .name = "bfin_sir",
250 .id = 0,
251 .num_resources = ARRAY_SIZE(bfin_sir0_resources),
252 .resource = bfin_sir0_resources,
253};
236#endif 254#endif
237#ifdef CONFIG_BFIN_SIR1 255#ifdef CONFIG_BFIN_SIR1
256static struct resource bfin_sir1_resources[] = {
238 { 257 {
239 .start = 0xFFC02000, 258 .start = 0xFFC02000,
240 .end = 0xFFC020FF, 259 .end = 0xFFC020FF,
241 .flags = IORESOURCE_MEM, 260 .flags = IORESOURCE_MEM,
242 }, 261 },
243#endif 262 {
263 .start = IRQ_UART1_RX,
264 .end = IRQ_UART1_RX+1,
265 .flags = IORESOURCE_IRQ,
266 },
267 {
268 .start = CH_UART1_RX,
269 .end = CH_UART1_RX+1,
270 .flags = IORESOURCE_DMA,
271 },
244}; 272};
245 273
246static struct platform_device bfin_sir_device = { 274static struct platform_device bfin_sir1_device = {
247 .name = "bfin_sir", 275 .name = "bfin_sir",
248 .id = 0, 276 .id = 1,
249 .num_resources = ARRAY_SIZE(bfin_sir_resources), 277 .num_resources = ARRAY_SIZE(bfin_sir1_resources),
250 .resource = bfin_sir_resources, 278 .resource = bfin_sir1_resources,
251}; 279};
252#endif 280#endif
281#endif
253 282
254#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE) 283#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
255static struct resource bfin_twi0_resource[] = { 284static struct resource bfin_twi0_resource[] = {
@@ -311,7 +340,12 @@ static struct platform_device *minotaur_devices[] __initdata = {
311#endif 340#endif
312 341
313#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE) 342#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
314 &bfin_sir_device, 343#ifdef CONFIG_BFIN_SIR0
344 &bfin_sir0_device,
345#endif
346#ifdef CONFIG_BFIN_SIR1
347 &bfin_sir1_device,
348#endif
315#endif 349#endif
316 350
317#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE) 351#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
diff --git a/arch/blackfin/mach-bf537/boards/pnav10.c b/arch/blackfin/mach-bf537/boards/pnav10.c
index f9174c11cbd4..89de94f4545d 100644
--- a/arch/blackfin/mach-bf537/boards/pnav10.c
+++ b/arch/blackfin/mach-bf537/boards/pnav10.c
@@ -49,7 +49,7 @@
49/* 49/*
50 * Name the Board for the /proc/cpuinfo 50 * Name the Board for the /proc/cpuinfo
51 */ 51 */
52const char bfin_board_name[] = "PNAV-1.0"; 52const char bfin_board_name[] = "ADI PNAV-1.0";
53 53
54/* 54/*
55 * Driver needs to know address, irq and flag pin. 55 * Driver needs to know address, irq and flag pin.
@@ -453,30 +453,59 @@ static struct platform_device bfin_uart_device = {
453#endif 453#endif
454 454
455#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE) 455#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
456static struct resource bfin_sir_resources[] = {
457#ifdef CONFIG_BFIN_SIR0 456#ifdef CONFIG_BFIN_SIR0
457static struct resource bfin_sir0_resources[] = {
458 { 458 {
459 .start = 0xFFC00400, 459 .start = 0xFFC00400,
460 .end = 0xFFC004FF, 460 .end = 0xFFC004FF,
461 .flags = IORESOURCE_MEM, 461 .flags = IORESOURCE_MEM,
462 }, 462 },
463 {
464 .start = IRQ_UART0_RX,
465 .end = IRQ_UART0_RX+1,
466 .flags = IORESOURCE_IRQ,
467 },
468 {
469 .start = CH_UART0_RX,
470 .end = CH_UART0_RX+1,
471 .flags = IORESOURCE_DMA,
472 },
473};
474
475static struct platform_device bfin_sir0_device = {
476 .name = "bfin_sir",
477 .id = 0,
478 .num_resources = ARRAY_SIZE(bfin_sir0_resources),
479 .resource = bfin_sir0_resources,
480};
463#endif 481#endif
464#ifdef CONFIG_BFIN_SIR1 482#ifdef CONFIG_BFIN_SIR1
483static struct resource bfin_sir1_resources[] = {
465 { 484 {
466 .start = 0xFFC02000, 485 .start = 0xFFC02000,
467 .end = 0xFFC020FF, 486 .end = 0xFFC020FF,
468 .flags = IORESOURCE_MEM, 487 .flags = IORESOURCE_MEM,
469 }, 488 },
470#endif 489 {
490 .start = IRQ_UART1_RX,
491 .end = IRQ_UART1_RX+1,
492 .flags = IORESOURCE_IRQ,
493 },
494 {
495 .start = CH_UART1_RX,
496 .end = CH_UART1_RX+1,
497 .flags = IORESOURCE_DMA,
498 },
471}; 499};
472 500
473static struct platform_device bfin_sir_device = { 501static struct platform_device bfin_sir1_device = {
474 .name = "bfin_sir", 502 .name = "bfin_sir",
475 .id = 0, 503 .id = 1,
476 .num_resources = ARRAY_SIZE(bfin_sir_resources), 504 .num_resources = ARRAY_SIZE(bfin_sir1_resources),
477 .resource = bfin_sir_resources, 505 .resource = bfin_sir1_resources,
478}; 506};
479#endif 507#endif
508#endif
480 509
481static struct platform_device *stamp_devices[] __initdata = { 510static struct platform_device *stamp_devices[] __initdata = {
482#if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE) 511#if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
@@ -520,7 +549,12 @@ static struct platform_device *stamp_devices[] __initdata = {
520#endif 549#endif
521 550
522#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE) 551#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
523 &bfin_sir_device, 552#ifdef CONFIG_BFIN_SIR0
553 &bfin_sir0_device,
554#endif
555#ifdef CONFIG_BFIN_SIR1
556 &bfin_sir1_device,
557#endif
524#endif 558#endif
525}; 559};
526 560
diff --git a/arch/blackfin/mach-bf537/boards/stamp.c b/arch/blackfin/mach-bf537/boards/stamp.c
index 8d394393201f..d812e2514a2f 100644
--- a/arch/blackfin/mach-bf537/boards/stamp.c
+++ b/arch/blackfin/mach-bf537/boards/stamp.c
@@ -46,6 +46,7 @@
46#include <linux/interrupt.h> 46#include <linux/interrupt.h>
47#include <linux/i2c.h> 47#include <linux/i2c.h>
48#include <linux/usb/sl811.h> 48#include <linux/usb/sl811.h>
49#include <linux/spi/mmc_spi.h>
49#include <asm/dma.h> 50#include <asm/dma.h>
50#include <asm/bfin5xx_spi.h> 51#include <asm/bfin5xx_spi.h>
51#include <asm/reboot.h> 52#include <asm/reboot.h>
@@ -55,57 +56,46 @@
55/* 56/*
56 * Name the Board for the /proc/cpuinfo 57 * Name the Board for the /proc/cpuinfo
57 */ 58 */
58const char bfin_board_name[] = "ADDS-BF537-STAMP"; 59const char bfin_board_name[] = "ADI BF537-STAMP";
59 60
60/* 61/*
61 * Driver needs to know address, irq and flag pin. 62 * Driver needs to know address, irq and flag pin.
62 */ 63 */
63 64
64#define ISP1761_BASE 0x203C0000
65#define ISP1761_IRQ IRQ_PF7
66
67#if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE) 65#if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
68static struct resource bfin_isp1761_resources[] = { 66#include <linux/usb/isp1760.h>
67static struct resource bfin_isp1760_resources[] = {
69 [0] = { 68 [0] = {
70 .name = "isp1761-regs", 69 .start = 0x203C0000,
71 .start = ISP1761_BASE + 0x00000000, 70 .end = 0x203C0000 + 0x000fffff,
72 .end = ISP1761_BASE + 0x000fffff,
73 .flags = IORESOURCE_MEM, 71 .flags = IORESOURCE_MEM,
74 }, 72 },
75 [1] = { 73 [1] = {
76 .start = ISP1761_IRQ, 74 .start = IRQ_PF7,
77 .end = ISP1761_IRQ, 75 .end = IRQ_PF7,
78 .flags = IORESOURCE_IRQ, 76 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
79 }, 77 },
80}; 78};
81 79
82static struct platform_device bfin_isp1761_device = { 80static struct isp1760_platform_data isp1760_priv = {
83 .name = "isp1761", 81 .is_isp1761 = 0,
84 .id = 0, 82 .port1_disable = 0,
85 .num_resources = ARRAY_SIZE(bfin_isp1761_resources), 83 .bus_width_16 = 1,
86 .resource = bfin_isp1761_resources, 84 .port1_otg = 0,
85 .analog_oc = 0,
86 .dack_polarity_high = 0,
87 .dreq_polarity_high = 0,
87}; 88};
88 89
89static struct platform_device *bfin_isp1761_devices[] = { 90static struct platform_device bfin_isp1760_device = {
90 &bfin_isp1761_device, 91 .name = "isp1760-hcd",
92 .id = 0,
93 .dev = {
94 .platform_data = &isp1760_priv,
95 },
96 .num_resources = ARRAY_SIZE(bfin_isp1760_resources),
97 .resource = bfin_isp1760_resources,
91}; 98};
92
93int __init bfin_isp1761_init(void)
94{
95 unsigned int num_devices = ARRAY_SIZE(bfin_isp1761_devices);
96
97 printk(KERN_INFO "%s(): registering device resources\n", __func__);
98 set_irq_type(ISP1761_IRQ, IRQF_TRIGGER_FALLING);
99
100 return platform_add_devices(bfin_isp1761_devices, num_devices);
101}
102
103void __exit bfin_isp1761_exit(void)
104{
105 platform_device_unregister(&bfin_isp1761_device);
106}
107
108arch_initcall(bfin_isp1761_init);
109#endif 99#endif
110 100
111#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE) 101#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
@@ -443,11 +433,11 @@ static struct mtd_partition stamp_partitions[] = {
443 .offset = 0, 433 .offset = 0,
444 }, { 434 }, {
445 .name = "linux kernel(nor)", 435 .name = "linux kernel(nor)",
446 .size = 0xE0000, 436 .size = 0x180000,
447 .offset = MTDPART_OFS_APPEND, 437 .offset = MTDPART_OFS_APPEND,
448 }, { 438 }, {
449 .name = "file system(nor)", 439 .name = "file system(nor)",
450 .size = 0x400000 - 0x40000 - 0xE0000 - 0x10000, 440 .size = 0x400000 - 0x40000 - 0x180000 - 0x10000,
451 .offset = MTDPART_OFS_APPEND, 441 .offset = MTDPART_OFS_APPEND,
452 }, { 442 }, {
453 .name = "MAC Address(nor)", 443 .name = "MAC Address(nor)",
@@ -490,7 +480,7 @@ static struct mtd_partition bfin_spi_flash_partitions[] = {
490 .mask_flags = MTD_CAP_ROM 480 .mask_flags = MTD_CAP_ROM
491 }, { 481 }, {
492 .name = "linux kernel(spi)", 482 .name = "linux kernel(spi)",
493 .size = 0xe0000, 483 .size = 0x180000,
494 .offset = MTDPART_OFS_APPEND, 484 .offset = MTDPART_OFS_APPEND,
495 }, { 485 }, {
496 .name = "file system(spi)", 486 .name = "file system(spi)",
@@ -503,7 +493,7 @@ static struct flash_platform_data bfin_spi_flash_data = {
503 .name = "m25p80", 493 .name = "m25p80",
504 .parts = bfin_spi_flash_partitions, 494 .parts = bfin_spi_flash_partitions,
505 .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions), 495 .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
506 .type = "m25p64", 496 /* .type = "m25p64", */
507}; 497};
508 498
509/* SPI flash chip (m25p64) */ 499/* SPI flash chip (m25p64) */
@@ -537,9 +527,29 @@ static struct bfin5xx_spi_chip ad9960_spi_chip_info = {
537}; 527};
538#endif 528#endif
539 529
540#if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE) 530#if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
541static struct bfin5xx_spi_chip spi_mmc_chip_info = { 531#define MMC_SPI_CARD_DETECT_INT IRQ_PF5
542 .enable_dma = 1, 532
533static int bfin_mmc_spi_init(struct device *dev,
534 irqreturn_t (*detect_int)(int, void *), void *data)
535{
536 return request_irq(MMC_SPI_CARD_DETECT_INT, detect_int,
537 IRQF_TRIGGER_FALLING, "mmc-spi-detect", data);
538}
539
540static void bfin_mmc_spi_exit(struct device *dev, void *data)
541{
542 free_irq(MMC_SPI_CARD_DETECT_INT, data);
543}
544
545static struct mmc_spi_platform_data bfin_mmc_spi_pdata = {
546 .init = bfin_mmc_spi_init,
547 .exit = bfin_mmc_spi_exit,
548 .detect_delay = 100, /* msecs */
549};
550
551static struct bfin5xx_spi_chip mmc_spi_chip_info = {
552 .enable_dma = 0,
543 .bits_per_word = 8, 553 .bits_per_word = 8,
544}; 554};
545#endif 555#endif
@@ -613,6 +623,14 @@ static struct bfin5xx_spi_chip lq035q1_spi_chip_info = {
613}; 623};
614#endif 624#endif
615 625
626#if defined(CONFIG_ENC28J60) || defined(CONFIG_ENC28J60_MODULE)
627static struct bfin5xx_spi_chip enc28j60_spi_chip_info = {
628 .enable_dma = 1,
629 .bits_per_word = 8,
630 .cs_gpio = GPIO_PF10,
631};
632#endif
633
616#if defined(CONFIG_MTD_DATAFLASH) \ 634#if defined(CONFIG_MTD_DATAFLASH) \
617 || defined(CONFIG_MTD_DATAFLASH_MODULE) 635 || defined(CONFIG_MTD_DATAFLASH_MODULE)
618 636
@@ -624,7 +642,7 @@ static struct mtd_partition bfin_spi_dataflash_partitions[] = {
624 .mask_flags = MTD_CAP_ROM 642 .mask_flags = MTD_CAP_ROM
625 }, { 643 }, {
626 .name = "linux kernel(spi)", 644 .name = "linux kernel(spi)",
627 .size = 0xe0000, 645 .size = 0x180000,
628 .offset = MTDPART_OFS_APPEND, 646 .offset = MTDPART_OFS_APPEND,
629 }, { 647 }, {
630 .name = "file system(spi)", 648 .name = "file system(spi)",
@@ -703,23 +721,14 @@ static struct spi_board_info bfin_spi_board_info[] __initdata = {
703 .controller_data = &ad9960_spi_chip_info, 721 .controller_data = &ad9960_spi_chip_info,
704 }, 722 },
705#endif 723#endif
706#if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE) 724#if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
707 { 725 {
708 .modalias = "spi_mmc_dummy", 726 .modalias = "mmc_spi",
709 .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */ 727 .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
710 .bus_num = 0, 728 .bus_num = 0,
711 .chip_select = 0, 729 .chip_select = 4,
712 .platform_data = NULL, 730 .platform_data = &bfin_mmc_spi_pdata,
713 .controller_data = &spi_mmc_chip_info, 731 .controller_data = &mmc_spi_chip_info,
714 .mode = SPI_MODE_3,
715 },
716 {
717 .modalias = "spi_mmc",
718 .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
719 .bus_num = 0,
720 .chip_select = CONFIG_SPI_MMC_CS_CHAN,
721 .platform_data = NULL,
722 .controller_data = &spi_mmc_chip_info,
723 .mode = SPI_MODE_3, 732 .mode = SPI_MODE_3,
724 }, 733 },
725#endif 734#endif
@@ -783,6 +792,17 @@ static struct spi_board_info bfin_spi_board_info[] __initdata = {
783 .mode = SPI_CPHA | SPI_CPOL, 792 .mode = SPI_CPHA | SPI_CPOL,
784 }, 793 },
785#endif 794#endif
795#if defined(CONFIG_ENC28J60) || defined(CONFIG_ENC28J60_MODULE)
796 {
797 .modalias = "enc28j60",
798 .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
799 .irq = IRQ_PF6,
800 .bus_num = 0,
801 .chip_select = 0, /* GPIO controlled SSEL */
802 .controller_data = &enc28j60_spi_chip_info,
803 .mode = SPI_MODE_0,
804 },
805#endif
786}; 806};
787 807
788#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE) 808#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
@@ -885,30 +905,59 @@ static struct platform_device bfin_uart_device = {
885#endif 905#endif
886 906
887#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE) 907#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
888static struct resource bfin_sir_resources[] = {
889#ifdef CONFIG_BFIN_SIR0 908#ifdef CONFIG_BFIN_SIR0
909static struct resource bfin_sir0_resources[] = {
890 { 910 {
891 .start = 0xFFC00400, 911 .start = 0xFFC00400,
892 .end = 0xFFC004FF, 912 .end = 0xFFC004FF,
893 .flags = IORESOURCE_MEM, 913 .flags = IORESOURCE_MEM,
894 }, 914 },
915 {
916 .start = IRQ_UART0_RX,
917 .end = IRQ_UART0_RX+1,
918 .flags = IORESOURCE_IRQ,
919 },
920 {
921 .start = CH_UART0_RX,
922 .end = CH_UART0_RX+1,
923 .flags = IORESOURCE_DMA,
924 },
925};
926
927static struct platform_device bfin_sir0_device = {
928 .name = "bfin_sir",
929 .id = 0,
930 .num_resources = ARRAY_SIZE(bfin_sir0_resources),
931 .resource = bfin_sir0_resources,
932};
895#endif 933#endif
896#ifdef CONFIG_BFIN_SIR1 934#ifdef CONFIG_BFIN_SIR1
935static struct resource bfin_sir1_resources[] = {
897 { 936 {
898 .start = 0xFFC02000, 937 .start = 0xFFC02000,
899 .end = 0xFFC020FF, 938 .end = 0xFFC020FF,
900 .flags = IORESOURCE_MEM, 939 .flags = IORESOURCE_MEM,
901 }, 940 },
902#endif 941 {
942 .start = IRQ_UART1_RX,
943 .end = IRQ_UART1_RX+1,
944 .flags = IORESOURCE_IRQ,
945 },
946 {
947 .start = CH_UART1_RX,
948 .end = CH_UART1_RX+1,
949 .flags = IORESOURCE_DMA,
950 },
903}; 951};
904 952
905static struct platform_device bfin_sir_device = { 953static struct platform_device bfin_sir1_device = {
906 .name = "bfin_sir", 954 .name = "bfin_sir",
907 .id = 0, 955 .id = 1,
908 .num_resources = ARRAY_SIZE(bfin_sir_resources), 956 .num_resources = ARRAY_SIZE(bfin_sir1_resources),
909 .resource = bfin_sir_resources, 957 .resource = bfin_sir1_resources,
910}; 958};
911#endif 959#endif
960#endif
912 961
913#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE) 962#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
914static struct resource bfin_twi0_resource[] = { 963static struct resource bfin_twi0_resource[] = {
@@ -932,6 +981,93 @@ static struct platform_device i2c_bfin_twi_device = {
932}; 981};
933#endif 982#endif
934 983
984#if defined(CONFIG_KEYBOARD_ADP5588) || defined(CONFIG_KEYBOARD_ADP5588_MODULE)
985#include <linux/input.h>
986#include <linux/i2c/adp5588_keys.h>
987static const unsigned short adp5588_keymap[ADP5588_KEYMAPSIZE] = {
988 [0] = KEY_GRAVE,
989 [1] = KEY_1,
990 [2] = KEY_2,
991 [3] = KEY_3,
992 [4] = KEY_4,
993 [5] = KEY_5,
994 [6] = KEY_6,
995 [7] = KEY_7,
996 [8] = KEY_8,
997 [9] = KEY_9,
998 [10] = KEY_0,
999 [11] = KEY_MINUS,
1000 [12] = KEY_EQUAL,
1001 [13] = KEY_BACKSLASH,
1002 [15] = KEY_KP0,
1003 [16] = KEY_Q,
1004 [17] = KEY_W,
1005 [18] = KEY_E,
1006 [19] = KEY_R,
1007 [20] = KEY_T,
1008 [21] = KEY_Y,
1009 [22] = KEY_U,
1010 [23] = KEY_I,
1011 [24] = KEY_O,
1012 [25] = KEY_P,
1013 [26] = KEY_LEFTBRACE,
1014 [27] = KEY_RIGHTBRACE,
1015 [29] = KEY_KP1,
1016 [30] = KEY_KP2,
1017 [31] = KEY_KP3,
1018 [32] = KEY_A,
1019 [33] = KEY_S,
1020 [34] = KEY_D,
1021 [35] = KEY_F,
1022 [36] = KEY_G,
1023 [37] = KEY_H,
1024 [38] = KEY_J,
1025 [39] = KEY_K,
1026 [40] = KEY_L,
1027 [41] = KEY_SEMICOLON,
1028 [42] = KEY_APOSTROPHE,
1029 [43] = KEY_BACKSLASH,
1030 [45] = KEY_KP4,
1031 [46] = KEY_KP5,
1032 [47] = KEY_KP6,
1033 [48] = KEY_102ND,
1034 [49] = KEY_Z,
1035 [50] = KEY_X,
1036 [51] = KEY_C,
1037 [52] = KEY_V,
1038 [53] = KEY_B,
1039 [54] = KEY_N,
1040 [55] = KEY_M,
1041 [56] = KEY_COMMA,
1042 [57] = KEY_DOT,
1043 [58] = KEY_SLASH,
1044 [60] = KEY_KPDOT,
1045 [61] = KEY_KP7,
1046 [62] = KEY_KP8,
1047 [63] = KEY_KP9,
1048 [64] = KEY_SPACE,
1049 [65] = KEY_BACKSPACE,
1050 [66] = KEY_TAB,
1051 [67] = KEY_KPENTER,
1052 [68] = KEY_ENTER,
1053 [69] = KEY_ESC,
1054 [70] = KEY_DELETE,
1055 [74] = KEY_KPMINUS,
1056 [76] = KEY_UP,
1057 [77] = KEY_DOWN,
1058 [78] = KEY_RIGHT,
1059 [79] = KEY_LEFT,
1060};
1061
1062static struct adp5588_kpad_platform_data adp5588_kpad_data = {
1063 .rows = 8,
1064 .cols = 10,
1065 .keymap = adp5588_keymap,
1066 .keymapsize = ARRAY_SIZE(adp5588_keymap),
1067 .repeat = 0,
1068};
1069#endif
1070
935#ifdef CONFIG_I2C_BOARDINFO 1071#ifdef CONFIG_I2C_BOARDINFO
936static struct i2c_board_info __initdata bfin_i2c_board_info[] = { 1072static struct i2c_board_info __initdata bfin_i2c_board_info[] = {
937#if defined(CONFIG_JOYSTICK_AD7142) || defined(CONFIG_JOYSTICK_AD7142_MODULE) 1073#if defined(CONFIG_JOYSTICK_AD7142) || defined(CONFIG_JOYSTICK_AD7142_MODULE)
@@ -958,6 +1094,13 @@ static struct i2c_board_info __initdata bfin_i2c_board_info[] = {
958 .platform_data = (void *)&bfin_ad7879_ts_info, 1094 .platform_data = (void *)&bfin_ad7879_ts_info,
959 }, 1095 },
960#endif 1096#endif
1097#if defined(CONFIG_KEYBOARD_ADP5588) || defined(CONFIG_KEYBOARD_ADP5588_MODULE)
1098 {
1099 I2C_BOARD_INFO("adp5588-keys", 0x34),
1100 .irq = IRQ_PG0,
1101 .platform_data = (void *)&adp5588_kpad_data,
1102 },
1103#endif
961}; 1104};
962#endif 1105#endif
963 1106
@@ -1057,6 +1200,10 @@ static struct platform_device *stamp_devices[] __initdata = {
1057 &isp1362_hcd_device, 1200 &isp1362_hcd_device,
1058#endif 1201#endif
1059 1202
1203#if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
1204 &bfin_isp1760_device,
1205#endif
1206
1060#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE) 1207#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
1061 &smc91x_device, 1208 &smc91x_device,
1062#endif 1209#endif
@@ -1098,7 +1245,12 @@ static struct platform_device *stamp_devices[] __initdata = {
1098#endif 1245#endif
1099 1246
1100#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE) 1247#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
1101 &bfin_sir_device, 1248#ifdef CONFIG_BFIN_SIR0
1249 &bfin_sir0_device,
1250#endif
1251#ifdef CONFIG_BFIN_SIR1
1252 &bfin_sir1_device,
1253#endif
1102#endif 1254#endif
1103 1255
1104#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE) 1256#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
diff --git a/arch/blackfin/mach-bf537/boards/tcm_bf537.c b/arch/blackfin/mach-bf537/boards/tcm_bf537.c
index d5ff705a5129..2f4b066153c5 100644
--- a/arch/blackfin/mach-bf537/boards/tcm_bf537.c
+++ b/arch/blackfin/mach-bf537/boards/tcm_bf537.c
@@ -308,6 +308,19 @@ static struct platform_device net2272_bfin_device = {
308}; 308};
309#endif 309#endif
310 310
311static struct resource bfin_gpios_resources = {
312 .start = 0,
313 .end = MAX_BLACKFIN_GPIOS - 1,
314 .flags = IORESOURCE_IRQ,
315};
316
317static struct platform_device bfin_gpios_device = {
318 .name = "simple-gpio",
319 .id = -1,
320 .num_resources = 1,
321 .resource = &bfin_gpios_resources,
322};
323
311#if defined(CONFIG_MTD_GPIO_ADDR) || defined(CONFIG_MTD_GPIO_ADDR_MODULE) 324#if defined(CONFIG_MTD_GPIO_ADDR) || defined(CONFIG_MTD_GPIO_ADDR_MODULE)
312static struct mtd_partition cm_partitions[] = { 325static struct mtd_partition cm_partitions[] = {
313 { 326 {
@@ -379,30 +392,59 @@ static struct platform_device bfin_uart_device = {
379#endif 392#endif
380 393
381#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE) 394#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
382static struct resource bfin_sir_resources[] = {
383#ifdef CONFIG_BFIN_SIR0 395#ifdef CONFIG_BFIN_SIR0
396static struct resource bfin_sir0_resources[] = {
384 { 397 {
385 .start = 0xFFC00400, 398 .start = 0xFFC00400,
386 .end = 0xFFC004FF, 399 .end = 0xFFC004FF,
387 .flags = IORESOURCE_MEM, 400 .flags = IORESOURCE_MEM,
388 }, 401 },
402 {
403 .start = IRQ_UART0_RX,
404 .end = IRQ_UART0_RX+1,
405 .flags = IORESOURCE_IRQ,
406 },
407 {
408 .start = CH_UART0_RX,
409 .end = CH_UART0_RX+1,
410 .flags = IORESOURCE_DMA,
411 },
412};
413
414static struct platform_device bfin_sir0_device = {
415 .name = "bfin_sir",
416 .id = 0,
417 .num_resources = ARRAY_SIZE(bfin_sir0_resources),
418 .resource = bfin_sir0_resources,
419};
389#endif 420#endif
390#ifdef CONFIG_BFIN_SIR1 421#ifdef CONFIG_BFIN_SIR1
422static struct resource bfin_sir1_resources[] = {
391 { 423 {
392 .start = 0xFFC02000, 424 .start = 0xFFC02000,
393 .end = 0xFFC020FF, 425 .end = 0xFFC020FF,
394 .flags = IORESOURCE_MEM, 426 .flags = IORESOURCE_MEM,
395 }, 427 },
396#endif 428 {
429 .start = IRQ_UART1_RX,
430 .end = IRQ_UART1_RX+1,
431 .flags = IORESOURCE_IRQ,
432 },
433 {
434 .start = CH_UART1_RX,
435 .end = CH_UART1_RX+1,
436 .flags = IORESOURCE_DMA,
437 },
397}; 438};
398 439
399static struct platform_device bfin_sir_device = { 440static struct platform_device bfin_sir1_device = {
400 .name = "bfin_sir", 441 .name = "bfin_sir",
401 .id = 0, 442 .id = 1,
402 .num_resources = ARRAY_SIZE(bfin_sir_resources), 443 .num_resources = ARRAY_SIZE(bfin_sir1_resources),
403 .resource = bfin_sir_resources, 444 .resource = bfin_sir1_resources,
404}; 445};
405#endif 446#endif
447#endif
406 448
407#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE) 449#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
408static struct resource bfin_twi0_resource[] = { 450static struct resource bfin_twi0_resource[] = {
@@ -525,7 +567,12 @@ static struct platform_device *cm_bf537_devices[] __initdata = {
525#endif 567#endif
526 568
527#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE) 569#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
528 &bfin_sir_device, 570#ifdef CONFIG_BFIN_SIR0
571 &bfin_sir0_device,
572#endif
573#ifdef CONFIG_BFIN_SIR1
574 &bfin_sir1_device,
575#endif
529#endif 576#endif
530 577
531#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE) 578#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
@@ -564,6 +611,8 @@ static struct platform_device *cm_bf537_devices[] __initdata = {
564#if defined(CONFIG_MTD_GPIO_ADDR) || defined(CONFIG_MTD_GPIO_ADDR_MODULE) 611#if defined(CONFIG_MTD_GPIO_ADDR) || defined(CONFIG_MTD_GPIO_ADDR_MODULE)
565 &cm_flash_device, 612 &cm_flash_device,
566#endif 613#endif
614
615 &bfin_gpios_device,
567}; 616};
568 617
569static int __init cm_bf537_init(void) 618static int __init cm_bf537_init(void)
diff --git a/arch/blackfin/mach-bf537/dma.c b/arch/blackfin/mach-bf537/dma.c
index 4edb363ff99c..81185051de91 100644
--- a/arch/blackfin/mach-bf537/dma.c
+++ b/arch/blackfin/mach-bf537/dma.c
@@ -31,7 +31,7 @@
31#include <asm/blackfin.h> 31#include <asm/blackfin.h>
32#include <asm/dma.h> 32#include <asm/dma.h>
33 33
34struct dma_register *dma_io_base_addr[MAX_BLACKFIN_DMA_CHANNEL] = { 34struct dma_register *dma_io_base_addr[MAX_DMA_CHANNELS] = {
35 (struct dma_register *) DMA0_NEXT_DESC_PTR, 35 (struct dma_register *) DMA0_NEXT_DESC_PTR,
36 (struct dma_register *) DMA1_NEXT_DESC_PTR, 36 (struct dma_register *) DMA1_NEXT_DESC_PTR,
37 (struct dma_register *) DMA2_NEXT_DESC_PTR, 37 (struct dma_register *) DMA2_NEXT_DESC_PTR,
diff --git a/arch/blackfin/mach-bf537/head.S b/arch/blackfin/mach-bf537/head.S
deleted file mode 100644
index f5c94bf80e3b..000000000000
--- a/arch/blackfin/mach-bf537/head.S
+++ /dev/null
@@ -1,146 +0,0 @@
1/*
2 * File: arch/blackfin/mach-bf537/head.S
3 * Based on: arch/blackfin/mach-bf533/head.S
4 * Author: Jeff Dionne <jeff@uclinux.org> COPYRIGHT 1998 D. Jeff Dionne
5 *
6 * Created: 1998
7 * Description: Startup code for Blackfin BF537
8 *
9 * Modified:
10 * Copyright 2004-2006 Analog Devices Inc.
11 *
12 * Bugs: Enter bugs at http://blackfin.uclinux.org/
13 *
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 2 of the License, or
17 * (at your option) any later version.
18 *
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
23 *
24 * You should have received a copy of the GNU General Public License
25 * along with this program; if not, see the file COPYING, or write
26 * to the Free Software Foundation, Inc.,
27 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
28 */
29
30#include <linux/linkage.h>
31#include <linux/init.h>
32#include <asm/blackfin.h>
33#ifdef CONFIG_BFIN_KERNEL_CLOCK
34#include <asm/clocks.h>
35#include <mach/mem_init.h>
36#endif
37
38.section .l1.text
39#ifdef CONFIG_BFIN_KERNEL_CLOCK
40ENTRY(_start_dma_code)
41
42 /* Enable PHY CLK buffer output */
43 p0.h = hi(VR_CTL);
44 p0.l = lo(VR_CTL);
45 r0.l = w[p0];
46 bitset(r0, 14);
47 w[p0] = r0.l;
48 ssync;
49
50 p0.h = hi(SIC_IWR);
51 p0.l = lo(SIC_IWR);
52 r0.l = 0x1;
53 r0.h = 0x0;
54 [p0] = r0;
55 SSYNC;
56
57 /*
58 * Set PLL_CTL
59 * - [14:09] = MSEL[5:0] : CLKIN / VCO multiplication factors
60 * - [8] = BYPASS : BYPASS the PLL, run CLKIN into CCLK/SCLK
61 * - [7] = output delay (add 200ps of delay to mem signals)
62 * - [6] = input delay (add 200ps of input delay to mem signals)
63 * - [5] = PDWN : 1=All Clocks off
64 * - [3] = STOPCK : 1=Core Clock off
65 * - [1] = PLL_OFF : 1=Disable Power to PLL
66 * - [0] = DF : 1=Pass CLKIN/2 to PLL / 0=Pass CLKIN to PLL
67 * all other bits set to zero
68 */
69
70 p0.h = hi(PLL_LOCKCNT);
71 p0.l = lo(PLL_LOCKCNT);
72 r0 = 0x300(Z);
73 w[p0] = r0.l;
74 ssync;
75
76 P2.H = hi(EBIU_SDGCTL);
77 P2.L = lo(EBIU_SDGCTL);
78 R0 = [P2];
79 BITSET (R0, 24);
80 [P2] = R0;
81 SSYNC;
82
83 r0 = CONFIG_VCO_MULT & 63; /* Load the VCO multiplier */
84 r0 = r0 << 9; /* Shift it over, */
85 r1 = CLKIN_HALF; /* Do we need to divide CLKIN by 2?*/
86 r0 = r1 | r0;
87 r1 = PLL_BYPASS; /* Bypass the PLL? */
88 r1 = r1 << 8; /* Shift it over */
89 r0 = r1 | r0; /* add them all together */
90#ifdef ANOMALY_05000265
91 BITSET(r0, 15); /* Add 250 mV of hysteresis to SPORT input pins */
92#endif
93
94 p0.h = hi(PLL_CTL);
95 p0.l = lo(PLL_CTL); /* Load the address */
96 cli r2; /* Disable interrupts */
97 ssync;
98 w[p0] = r0.l; /* Set the value */
99 idle; /* Wait for the PLL to stablize */
100 sti r2; /* Enable interrupts */
101
102.Lcheck_again:
103 p0.h = hi(PLL_STAT);
104 p0.l = lo(PLL_STAT);
105 R0 = W[P0](Z);
106 CC = BITTST(R0,5);
107 if ! CC jump .Lcheck_again;
108
109 /* Configure SCLK & CCLK Dividers */
110 r0 = (CONFIG_CCLK_ACT_DIV | CONFIG_SCLK_DIV);
111 p0.h = hi(PLL_DIV);
112 p0.l = lo(PLL_DIV);
113 w[p0] = r0.l;
114 ssync;
115
116 p0.l = lo(EBIU_SDRRC);
117 p0.h = hi(EBIU_SDRRC);
118 r0 = mem_SDRRC;
119 w[p0] = r0.l;
120 ssync;
121
122 P2.H = hi(EBIU_SDGCTL);
123 P2.L = lo(EBIU_SDGCTL);
124 R0 = [P2];
125 BITCLR (R0, 24);
126 p0.h = hi(EBIU_SDSTAT);
127 p0.l = lo(EBIU_SDSTAT);
128 r2.l = w[p0];
129 cc = bittst(r2,3);
130 if !cc jump .Lskip;
131 NOP;
132 BITSET (R0, 23);
133.Lskip:
134 [P2] = R0;
135 SSYNC;
136
137 R0.L = lo(mem_SDGCTL);
138 R0.H = hi(mem_SDGCTL);
139 R1 = [p2];
140 R1 = R1 | R0;
141 [P2] = R1;
142 SSYNC;
143
144 RTS;
145ENDPROC(_start_dma_code)
146#endif /* CONFIG_BFIN_KERNEL_CLOCK */
diff --git a/arch/blackfin/mach-bf537/include/mach/anomaly.h b/arch/blackfin/mach-bf537/include/mach/anomaly.h
index c68992494f9e..9cb39121d1cb 100644
--- a/arch/blackfin/mach-bf537/include/mach/anomaly.h
+++ b/arch/blackfin/mach-bf537/include/mach/anomaly.h
@@ -7,7 +7,7 @@
7 */ 7 */
8 8
9/* This file shoule be up to date with: 9/* This file shoule be up to date with:
10 * - Revision C, 02/08/2008; ADSP-BF534/ADSP-BF536/ADSP-BF537 Blackfin Processor Anomaly List 10 * - Revision D, 09/18/2008; ADSP-BF534/ADSP-BF536/ADSP-BF537 Blackfin Processor Anomaly List
11 */ 11 */
12 12
13#ifndef _MACH_ANOMALY_H_ 13#ifndef _MACH_ANOMALY_H_
@@ -148,6 +148,14 @@
148#define ANOMALY_05000402 (__SILICON_REVISION__ >= 5) 148#define ANOMALY_05000402 (__SILICON_REVISION__ >= 5)
149/* Level-Sensitive External GPIO Wakeups May Cause Indefinite Stall */ 149/* Level-Sensitive External GPIO Wakeups May Cause Indefinite Stall */
150#define ANOMALY_05000403 (1) 150#define ANOMALY_05000403 (1)
151/* Speculative Fetches Can Cause Undesired External FIFO Operations */
152#define ANOMALY_05000416 (1)
153/* Multichannel SPORT Channel Misalignment Under Specific Configuration */
154#define ANOMALY_05000425 (1)
155/* Speculative Fetches of Indirect-Pointer Instructions Can Cause False Hardware Errors */
156#define ANOMALY_05000426 (1)
157/* IFLUSH Instruction at End of Hardware Loop Causes Infinite Stall */
158#define ANOMALY_05000443 (1)
151 159
152/* Anomalies that don't exist on this proc */ 160/* Anomalies that don't exist on this proc */
153#define ANOMALY_05000125 (0) 161#define ANOMALY_05000125 (0)
@@ -161,5 +169,8 @@
161#define ANOMALY_05000353 (1) 169#define ANOMALY_05000353 (1)
162#define ANOMALY_05000363 (0) 170#define ANOMALY_05000363 (0)
163#define ANOMALY_05000386 (1) 171#define ANOMALY_05000386 (1)
172#define ANOMALY_05000412 (0)
173#define ANOMALY_05000432 (0)
174#define ANOMALY_05000435 (0)
164 175
165#endif 176#endif
diff --git a/arch/blackfin/mach-bf537/include/mach/bf537.h b/arch/blackfin/mach-bf537/include/mach/bf537.h
index 24d5c9d42323..f194a848ae8e 100644
--- a/arch/blackfin/mach-bf537/include/mach/bf537.h
+++ b/arch/blackfin/mach-bf537/include/mach/bf537.h
@@ -133,7 +133,7 @@
133#endif 133#endif
134 134
135#ifndef CPU 135#ifndef CPU
136#error Unknown CPU type - This kernel doesn't seem to be configured properly 136#error "Unknown CPU type - This kernel doesn't seem to be configured properly"
137#endif 137#endif
138 138
139#endif /* __MACH_BF537_H__ */ 139#endif /* __MACH_BF537_H__ */
diff --git a/arch/blackfin/mach-bf537/include/mach/bfin_sir.h b/arch/blackfin/mach-bf537/include/mach/bfin_sir.h
deleted file mode 100644
index cfd8ad4f1f2c..000000000000
--- a/arch/blackfin/mach-bf537/include/mach/bfin_sir.h
+++ /dev/null
@@ -1,142 +0,0 @@
1/*
2 * Blackfin Infra-red Driver
3 *
4 * Copyright 2006-2008 Analog Devices Inc.
5 *
6 * Enter bugs at http://blackfin.uclinux.org/
7 *
8 * Licensed under the GPL-2 or later.
9 *
10 */
11
12#include <linux/serial.h>
13#include <asm/dma.h>
14#include <asm/portmux.h>
15
16#define SIR_UART_GET_CHAR(port) bfin_read16((port)->membase + OFFSET_RBR)
17#define SIR_UART_GET_DLL(port) bfin_read16((port)->membase + OFFSET_DLL)
18#define SIR_UART_GET_IER(port) bfin_read16((port)->membase + OFFSET_IER)
19#define SIR_UART_GET_DLH(port) bfin_read16((port)->membase + OFFSET_DLH)
20#define SIR_UART_GET_IIR(port) bfin_read16((port)->membase + OFFSET_IIR)
21#define SIR_UART_GET_LCR(port) bfin_read16((port)->membase + OFFSET_LCR)
22#define SIR_UART_GET_GCTL(port) bfin_read16((port)->membase + OFFSET_GCTL)
23
24#define SIR_UART_PUT_CHAR(port, v) bfin_write16(((port)->membase + OFFSET_THR), v)
25#define SIR_UART_PUT_DLL(port, v) bfin_write16(((port)->membase + OFFSET_DLL), v)
26#define SIR_UART_PUT_IER(port, v) bfin_write16(((port)->membase + OFFSET_IER), v)
27#define SIR_UART_PUT_DLH(port, v) bfin_write16(((port)->membase + OFFSET_DLH), v)
28#define SIR_UART_PUT_LCR(port, v) bfin_write16(((port)->membase + OFFSET_LCR), v)
29#define SIR_UART_PUT_GCTL(port, v) bfin_write16(((port)->membase + OFFSET_GCTL), v)
30
31#ifdef CONFIG_SIR_BFIN_DMA
32struct dma_rx_buf {
33 char *buf;
34 int head;
35 int tail;
36 };
37#endif /* CONFIG_SIR_BFIN_DMA */
38
39struct bfin_sir_port {
40 unsigned char __iomem *membase;
41 unsigned int irq;
42 unsigned int lsr;
43 unsigned long clk;
44 struct net_device *dev;
45#ifdef CONFIG_SIR_BFIN_DMA
46 int tx_done;
47 struct dma_rx_buf rx_dma_buf;
48 struct timer_list rx_dma_timer;
49 int rx_dma_nrows;
50#endif /* CONFIG_SIR_BFIN_DMA */
51 unsigned int tx_dma_channel;
52 unsigned int rx_dma_channel;
53};
54
55struct bfin_sir_port sir_ports[BFIN_UART_NR_PORTS];
56
57struct bfin_sir_port_res {
58 unsigned long base_addr;
59 int irq;
60 unsigned int rx_dma_channel;
61 unsigned int tx_dma_channel;
62};
63
64struct bfin_sir_port_res bfin_sir_port_resource[] = {
65#ifdef CONFIG_BFIN_SIR0
66 {
67 0xFFC00400,
68 IRQ_UART0_RX,
69 CH_UART0_RX,
70 CH_UART0_TX,
71 },
72#endif
73#ifdef CONFIG_BFIN_SIR1
74 {
75 0xFFC02000,
76 IRQ_UART1_RX,
77 CH_UART1_RX,
78 CH_UART1_TX,
79 },
80#endif
81};
82
83int nr_sirs = ARRAY_SIZE(bfin_sir_port_resource);
84
85struct bfin_sir_self {
86 struct bfin_sir_port *sir_port;
87 spinlock_t lock;
88 unsigned int open;
89 int speed;
90 int newspeed;
91
92 struct sk_buff *txskb;
93 struct sk_buff *rxskb;
94 struct net_device_stats stats;
95 struct device *dev;
96 struct irlap_cb *irlap;
97 struct qos_info qos;
98
99 iobuff_t tx_buff;
100 iobuff_t rx_buff;
101
102 struct work_struct work;
103 int mtt;
104};
105
106static inline unsigned int SIR_UART_GET_LSR(struct bfin_sir_port *port)
107{
108 unsigned int lsr = bfin_read16(port->membase + OFFSET_LSR);
109 port->lsr |= (lsr & (BI|FE|PE|OE));
110 return lsr | port->lsr;
111}
112
113static inline void SIR_UART_CLEAR_LSR(struct bfin_sir_port *port)
114{
115 port->lsr = 0;
116 bfin_read16(port->membase + OFFSET_LSR);
117}
118
119#define DRIVER_NAME "bfin_sir"
120
121static int bfin_sir_hw_init(void)
122{
123 int ret = -ENODEV;
124#ifdef CONFIG_BFIN_SIR0
125 ret = peripheral_request(P_UART0_TX, DRIVER_NAME);
126 if (ret)
127 return ret;
128 ret = peripheral_request(P_UART0_RX, DRIVER_NAME);
129 if (ret)
130 return ret;
131#endif
132
133#ifdef CONFIG_BFIN_SIR1
134 ret = peripheral_request(P_UART1_TX, DRIVER_NAME);
135 if (ret)
136 return ret;
137 ret = peripheral_request(P_UART1_RX, DRIVER_NAME);
138 if (ret)
139 return ret;
140#endif
141 return ret;
142}
diff --git a/arch/blackfin/mach-bf537/include/mach/blackfin.h b/arch/blackfin/mach-bf537/include/mach/blackfin.h
index cffc786b2a2b..7d6069c886f1 100644
--- a/arch/blackfin/mach-bf537/include/mach/blackfin.h
+++ b/arch/blackfin/mach-bf537/include/mach/blackfin.h
@@ -82,7 +82,7 @@
82#define STATUS_P1 0x02 82#define STATUS_P1 0x02
83#define STATUS_P0 0x01 83#define STATUS_P0 0x01
84 84
85/* DMA Channnel */ 85/* DMA Channel */
86#define bfin_read_CH_UART_RX() bfin_read_CH_UART0_RX() 86#define bfin_read_CH_UART_RX() bfin_read_CH_UART0_RX()
87#define bfin_write_CH_UART_RX(val) bfin_write_CH_UART0_RX(val) 87#define bfin_write_CH_UART_RX(val) bfin_write_CH_UART0_RX(val)
88#define CH_UART_RX CH_UART0_RX 88#define CH_UART_RX CH_UART0_RX
diff --git a/arch/blackfin/mach-bf537/include/mach/cdefBF534.h b/arch/blackfin/mach-bf537/include/mach/cdefBF534.h
index 88d491cd9f36..5f8b5f845be6 100644
--- a/arch/blackfin/mach-bf537/include/mach/cdefBF534.h
+++ b/arch/blackfin/mach-bf537/include/mach/cdefBF534.h
@@ -40,55 +40,11 @@
40/* Include core specific register pointer definitions */ 40/* Include core specific register pointer definitions */
41#include <asm/cdef_LPBlackfin.h> 41#include <asm/cdef_LPBlackfin.h>
42 42
43#include <asm/system.h>
44
45/* Clock and System Control (0xFFC00000 - 0xFFC000FF) */ 43/* Clock and System Control (0xFFC00000 - 0xFFC000FF) */
46#define bfin_read_PLL_CTL() bfin_read16(PLL_CTL) 44#define bfin_read_PLL_CTL() bfin_read16(PLL_CTL)
47/* Writing to PLL_CTL initiates a PLL relock sequence. */
48static __inline__ void bfin_write_PLL_CTL(unsigned int val)
49{
50 unsigned long flags, iwr;
51
52 if (val == bfin_read_PLL_CTL())
53 return;
54
55 local_irq_save(flags);
56 /* Enable the PLL Wakeup bit in SIC IWR */
57 iwr = bfin_read32(SIC_IWR);
58 /* Only allow PPL Wakeup) */
59 bfin_write32(SIC_IWR, IWR_ENABLE(0));
60
61 bfin_write16(PLL_CTL, val);
62 SSYNC();
63 asm("IDLE;");
64
65 bfin_write32(SIC_IWR, iwr);
66 local_irq_restore(flags);
67}
68#define bfin_read_PLL_DIV() bfin_read16(PLL_DIV) 45#define bfin_read_PLL_DIV() bfin_read16(PLL_DIV)
69#define bfin_write_PLL_DIV(val) bfin_write16(PLL_DIV,val) 46#define bfin_write_PLL_DIV(val) bfin_write16(PLL_DIV,val)
70#define bfin_read_VR_CTL() bfin_read16(VR_CTL) 47#define bfin_read_VR_CTL() bfin_read16(VR_CTL)
71/* Writing to VR_CTL initiates a PLL relock sequence. */
72static __inline__ void bfin_write_VR_CTL(unsigned int val)
73{
74 unsigned long flags, iwr;
75
76 if (val == bfin_read_VR_CTL())
77 return;
78
79 local_irq_save(flags);
80 /* Enable the PLL Wakeup bit in SIC IWR */
81 iwr = bfin_read32(SIC_IWR);
82 /* Only allow PPL Wakeup) */
83 bfin_write32(SIC_IWR, IWR_ENABLE(0));
84
85 bfin_write16(VR_CTL, val);
86 SSYNC();
87 asm("IDLE;");
88
89 bfin_write32(SIC_IWR, iwr);
90 local_irq_restore(flags);
91}
92#define bfin_read_PLL_STAT() bfin_read16(PLL_STAT) 48#define bfin_read_PLL_STAT() bfin_read16(PLL_STAT)
93#define bfin_write_PLL_STAT(val) bfin_write16(PLL_STAT,val) 49#define bfin_write_PLL_STAT(val) bfin_write16(PLL_STAT,val)
94#define bfin_read_PLL_LOCKCNT() bfin_read16(PLL_LOCKCNT) 50#define bfin_read_PLL_LOCKCNT() bfin_read16(PLL_LOCKCNT)
@@ -1816,4 +1772,51 @@ static __inline__ void bfin_write_VR_CTL(unsigned int val)
1816#define bfin_read_HMDMA1_BCOUNT() bfin_read16(HMDMA1_BCOUNT) 1772#define bfin_read_HMDMA1_BCOUNT() bfin_read16(HMDMA1_BCOUNT)
1817#define bfin_write_HMDMA1_BCOUNT(val) bfin_write16(HMDMA1_BCOUNT,val) 1773#define bfin_write_HMDMA1_BCOUNT(val) bfin_write16(HMDMA1_BCOUNT,val)
1818 1774
1775/* These need to be last due to the cdef/linux inter-dependencies */
1776#include <asm/irq.h>
1777
1778/* Writing to PLL_CTL initiates a PLL relock sequence. */
1779static __inline__ void bfin_write_PLL_CTL(unsigned int val)
1780{
1781 unsigned long flags, iwr;
1782
1783 if (val == bfin_read_PLL_CTL())
1784 return;
1785
1786 local_irq_save_hw(flags);
1787 /* Enable the PLL Wakeup bit in SIC IWR */
1788 iwr = bfin_read32(SIC_IWR);
1789 /* Only allow PPL Wakeup) */
1790 bfin_write32(SIC_IWR, IWR_ENABLE(0));
1791
1792 bfin_write16(PLL_CTL, val);
1793 SSYNC();
1794 asm("IDLE;");
1795
1796 bfin_write32(SIC_IWR, iwr);
1797 local_irq_restore_hw(flags);
1798}
1799
1800/* Writing to VR_CTL initiates a PLL relock sequence. */
1801static __inline__ void bfin_write_VR_CTL(unsigned int val)
1802{
1803 unsigned long flags, iwr;
1804
1805 if (val == bfin_read_VR_CTL())
1806 return;
1807
1808 local_irq_save_hw(flags);
1809 /* Enable the PLL Wakeup bit in SIC IWR */
1810 iwr = bfin_read32(SIC_IWR);
1811 /* Only allow PPL Wakeup) */
1812 bfin_write32(SIC_IWR, IWR_ENABLE(0));
1813
1814 bfin_write16(VR_CTL, val);
1815 SSYNC();
1816 asm("IDLE;");
1817
1818 bfin_write32(SIC_IWR, iwr);
1819 local_irq_restore_hw(flags);
1820}
1821
1819#endif /* _CDEF_BF534_H */ 1822#endif /* _CDEF_BF534_H */
diff --git a/arch/blackfin/mach-bf537/include/mach/dma.h b/arch/blackfin/mach-bf537/include/mach/dma.h
index 7a964040870a..5ae83b1183a1 100644
--- a/arch/blackfin/mach-bf537/include/mach/dma.h
+++ b/arch/blackfin/mach-bf537/include/mach/dma.h
@@ -1,38 +1,14 @@
1/* 1/* mach/dma.h - arch-specific DMA defines
2 * file: include/asm-blackfin/mach-bf537/dma.h
3 * based on:
4 * author:
5 * 2 *
6 * created: 3 * Copyright 2004-2008 Analog Devices Inc.
7 * description:
8 * system mmr register map
9 * rev:
10 * 4 *
11 * modified: 5 * Licensed under the GPL-2 or later.
12 *
13 *
14 * bugs: enter bugs at http://blackfin.uclinux.org/
15 *
16 * this program is free software; you can redistribute it and/or modify
17 * it under the terms of the gnu general public license as published by
18 * the free software foundation; either version 2, or (at your option)
19 * any later version.
20 *
21 * this program is distributed in the hope that it will be useful,
22 * but without any warranty; without even the implied warranty of
23 * merchantability or fitness for a particular purpose. see the
24 * gnu general public license for more details.
25 *
26 * you should have received a copy of the gnu general public license
27 * along with this program; see the file copying.
28 * if not, write to the free software foundation,
29 * 59 temple place - suite 330, boston, ma 02111-1307, usa.
30 */ 6 */
31 7
32#ifndef _MACH_DMA_H_ 8#ifndef _MACH_DMA_H_
33#define _MACH_DMA_H_ 9#define _MACH_DMA_H_
34 10
35#define MAX_BLACKFIN_DMA_CHANNEL 16 11#define MAX_DMA_CHANNELS 16
36 12
37#define CH_PPI 0 13#define CH_PPI 0
38#define CH_EMAC_RX 1 14#define CH_EMAC_RX 1
diff --git a/arch/blackfin/mach-bf537/include/mach/gpio.h b/arch/blackfin/mach-bf537/include/mach/gpio.h
new file mode 100644
index 000000000000..d77a31e45a30
--- /dev/null
+++ b/arch/blackfin/mach-bf537/include/mach/gpio.h
@@ -0,0 +1,68 @@
1/*
2 * File: arch/blackfin/mach-bf537/include/mach/gpio.h
3 * Bugs: Enter bugs at http://blackfin.uclinux.org/
4 *
5 * Copyright (C) 2008 Analog Devices Inc.
6 * Licensed under the GPL-2 or later.
7 */
8
9
10#ifndef _MACH_GPIO_H_
11#define _MACH_GPIO_H_
12
13#define MAX_BLACKFIN_GPIOS 48
14
15#define GPIO_PF0 0
16#define GPIO_PF1 1
17#define GPIO_PF2 2
18#define GPIO_PF3 3
19#define GPIO_PF4 4
20#define GPIO_PF5 5
21#define GPIO_PF6 6
22#define GPIO_PF7 7
23#define GPIO_PF8 8
24#define GPIO_PF9 9
25#define GPIO_PF10 10
26#define GPIO_PF11 11
27#define GPIO_PF12 12
28#define GPIO_PF13 13
29#define GPIO_PF14 14
30#define GPIO_PF15 15
31#define GPIO_PG0 16
32#define GPIO_PG1 17
33#define GPIO_PG2 18
34#define GPIO_PG3 19
35#define GPIO_PG4 20
36#define GPIO_PG5 21
37#define GPIO_PG6 22
38#define GPIO_PG7 23
39#define GPIO_PG8 24
40#define GPIO_PG9 25
41#define GPIO_PG10 26
42#define GPIO_PG11 27
43#define GPIO_PG12 28
44#define GPIO_PG13 29
45#define GPIO_PG14 30
46#define GPIO_PG15 31
47#define GPIO_PH0 32
48#define GPIO_PH1 33
49#define GPIO_PH2 34
50#define GPIO_PH3 35
51#define GPIO_PH4 36
52#define GPIO_PH5 37
53#define GPIO_PH6 38
54#define GPIO_PH7 39
55#define GPIO_PH8 40
56#define GPIO_PH9 41
57#define GPIO_PH10 42
58#define GPIO_PH11 43
59#define GPIO_PH12 44
60#define GPIO_PH13 45
61#define GPIO_PH14 46
62#define GPIO_PH15 47
63
64#define PORT_F GPIO_PF0
65#define PORT_G GPIO_PG0
66#define PORT_H GPIO_PH0
67
68#endif /* _MACH_GPIO_H_ */
diff --git a/arch/blackfin/mach-bf537/include/mach/irq.h b/arch/blackfin/mach-bf537/include/mach/irq.h
index 2e68a8a1e730..b2a71d5d4e5f 100644
--- a/arch/blackfin/mach-bf537/include/mach/irq.h
+++ b/arch/blackfin/mach-bf537/include/mach/irq.h
@@ -82,14 +82,14 @@
82#define IRQ_CAN_TX 23 /*CAN Transmit Interrupt */ 82#define IRQ_CAN_TX 23 /*CAN Transmit Interrupt */
83#define IRQ_MAC_RX 24 /*DMA1 (Ethernet RX) Interrupt */ 83#define IRQ_MAC_RX 24 /*DMA1 (Ethernet RX) Interrupt */
84#define IRQ_MAC_TX 25 /*DMA2 (Ethernet TX) Interrupt */ 84#define IRQ_MAC_TX 25 /*DMA2 (Ethernet TX) Interrupt */
85#define IRQ_TMR0 26 /*Timer 0 */ 85#define IRQ_TIMER0 26 /*Timer 0 */
86#define IRQ_TMR1 27 /*Timer 1 */ 86#define IRQ_TIMER1 27 /*Timer 1 */
87#define IRQ_TMR2 28 /*Timer 2 */ 87#define IRQ_TIMER2 28 /*Timer 2 */
88#define IRQ_TMR3 29 /*Timer 3 */ 88#define IRQ_TIMER3 29 /*Timer 3 */
89#define IRQ_TMR4 30 /*Timer 4 */ 89#define IRQ_TIMER4 30 /*Timer 4 */
90#define IRQ_TMR5 31 /*Timer 5 */ 90#define IRQ_TIMER5 31 /*Timer 5 */
91#define IRQ_TMR6 32 /*Timer 6 */ 91#define IRQ_TIMER6 32 /*Timer 6 */
92#define IRQ_TMR7 33 /*Timer 7 */ 92#define IRQ_TIMER7 33 /*Timer 7 */
93#define IRQ_PROG_INTA 34 /* PF Ports F&G (PF15:0) Interrupt A */ 93#define IRQ_PROG_INTA 34 /* PF Ports F&G (PF15:0) Interrupt A */
94#define IRQ_PORTG_INTB 35 /* PF Port G (PF15:0) Interrupt B */ 94#define IRQ_PORTG_INTB 35 /* PF Port G (PF15:0) Interrupt B */
95#define IRQ_MEM_DMA0 36 /*(Memory DMA Stream 0) */ 95#define IRQ_MEM_DMA0 36 /*(Memory DMA Stream 0) */
@@ -195,16 +195,16 @@
195#define IRQ_CAN_TX_POS 0 195#define IRQ_CAN_TX_POS 0
196#define IRQ_MAC_RX_POS 4 196#define IRQ_MAC_RX_POS 4
197#define IRQ_MAC_TX_POS 8 197#define IRQ_MAC_TX_POS 8
198#define IRQ_TMR0_POS 12 198#define IRQ_TIMER0_POS 12
199#define IRQ_TMR1_POS 16 199#define IRQ_TIMER1_POS 16
200#define IRQ_TMR2_POS 20 200#define IRQ_TIMER2_POS 20
201#define IRQ_TMR3_POS 24 201#define IRQ_TIMER3_POS 24
202#define IRQ_TMR4_POS 28 202#define IRQ_TIMER4_POS 28
203 203
204/* IAR3 BIT FIELDS*/ 204/* IAR3 BIT FIELDS*/
205#define IRQ_TMR5_POS 0 205#define IRQ_TIMER5_POS 0
206#define IRQ_TMR6_POS 4 206#define IRQ_TIMER6_POS 4
207#define IRQ_TMR7_POS 8 207#define IRQ_TIMER7_POS 8
208#define IRQ_PROG_INTA_POS 12 208#define IRQ_PROG_INTA_POS 12
209#define IRQ_PORTG_INTB_POS 16 209#define IRQ_PORTG_INTB_POS 16
210#define IRQ_MEM_DMA0_POS 20 210#define IRQ_MEM_DMA0_POS 20
diff --git a/arch/blackfin/mach-bf537/include/mach/mem_init.h b/arch/blackfin/mach-bf537/include/mach/mem_init.h
deleted file mode 100644
index f67698f670ca..000000000000
--- a/arch/blackfin/mach-bf537/include/mach/mem_init.h
+++ /dev/null
@@ -1,303 +0,0 @@
1/*
2 * File: include/asm-blackfin/mach-bf537/mem_init.h
3 * Based on:
4 * Author:
5 *
6 * Created:
7 * Description:
8 *
9 * Rev:
10 *
11 * Modified:
12 * Copyright 2004-2006 Analog Devices Inc.
13 *
14 * Bugs: Enter bugs at http://blackfin.uclinux.org/
15 *
16 * This program is free software; you can redistribute it and/or modify
17 * it under the terms of the GNU General Public License as published by
18 * the Free Software Foundation; either version 2, or (at your option)
19 * any later version.
20 *
21 * This program is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 * GNU General Public License for more details.
25 *
26 * You should have received a copy of the GNU General Public License
27 * along with this program; see the file COPYING.
28 * If not, write to the Free Software Foundation,
29 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
30 */
31
32#if (CONFIG_MEM_MT48LC16M16A2TG_75 || CONFIG_MEM_MT48LC64M4A2FB_7E || CONFIG_MEM_MT48LC16M8A2TG_75 || CONFIG_MEM_GENERIC_BOARD || CONFIG_MEM_MT48LC32M8A2_75)
33#if (CONFIG_SCLK_HZ > 119402985)
34#define SDRAM_tRP TRP_2
35#define SDRAM_tRP_num 2
36#define SDRAM_tRAS TRAS_7
37#define SDRAM_tRAS_num 7
38#define SDRAM_tRCD TRCD_2
39#define SDRAM_tWR TWR_2
40#endif
41#if (CONFIG_SCLK_HZ > 104477612) && (CONFIG_SCLK_HZ <= 119402985)
42#define SDRAM_tRP TRP_2
43#define SDRAM_tRP_num 2
44#define SDRAM_tRAS TRAS_6
45#define SDRAM_tRAS_num 6
46#define SDRAM_tRCD TRCD_2
47#define SDRAM_tWR TWR_2
48#endif
49#if (CONFIG_SCLK_HZ > 89552239) && (CONFIG_SCLK_HZ <= 104477612)
50#define SDRAM_tRP TRP_2
51#define SDRAM_tRP_num 2
52#define SDRAM_tRAS TRAS_5
53#define SDRAM_tRAS_num 5
54#define SDRAM_tRCD TRCD_2
55#define SDRAM_tWR TWR_2
56#endif
57#if (CONFIG_SCLK_HZ > 74626866) && (CONFIG_SCLK_HZ <= 89552239)
58#define SDRAM_tRP TRP_2
59#define SDRAM_tRP_num 2
60#define SDRAM_tRAS TRAS_4
61#define SDRAM_tRAS_num 4
62#define SDRAM_tRCD TRCD_2
63#define SDRAM_tWR TWR_2
64#endif
65#if (CONFIG_SCLK_HZ > 66666667) && (CONFIG_SCLK_HZ <= 74626866)
66#define SDRAM_tRP TRP_2
67#define SDRAM_tRP_num 2
68#define SDRAM_tRAS TRAS_3
69#define SDRAM_tRAS_num 3
70#define SDRAM_tRCD TRCD_2
71#define SDRAM_tWR TWR_2
72#endif
73#if (CONFIG_SCLK_HZ > 59701493) && (CONFIG_SCLK_HZ <= 66666667)
74#define SDRAM_tRP TRP_1
75#define SDRAM_tRP_num 1
76#define SDRAM_tRAS TRAS_4
77#define SDRAM_tRAS_num 3
78#define SDRAM_tRCD TRCD_1
79#define SDRAM_tWR TWR_2
80#endif
81#if (CONFIG_SCLK_HZ > 44776119) && (CONFIG_SCLK_HZ <= 59701493)
82#define SDRAM_tRP TRP_1
83#define SDRAM_tRP_num 1
84#define SDRAM_tRAS TRAS_3
85#define SDRAM_tRAS_num 3
86#define SDRAM_tRCD TRCD_1
87#define SDRAM_tWR TWR_2
88#endif
89#if (CONFIG_SCLK_HZ > 29850746) && (CONFIG_SCLK_HZ <= 44776119)
90#define SDRAM_tRP TRP_1
91#define SDRAM_tRP_num 1
92#define SDRAM_tRAS TRAS_2
93#define SDRAM_tRAS_num 2
94#define SDRAM_tRCD TRCD_1
95#define SDRAM_tWR TWR_2
96#endif
97#if (CONFIG_SCLK_HZ <= 29850746)
98#define SDRAM_tRP TRP_1
99#define SDRAM_tRP_num 1
100#define SDRAM_tRAS TRAS_1
101#define SDRAM_tRAS_num 1
102#define SDRAM_tRCD TRCD_1
103#define SDRAM_tWR TWR_2
104#endif
105#endif
106
107#if (CONFIG_MEM_MT48LC16M16A2TG_75)
108 /*SDRAM INFORMATION: */
109#define SDRAM_Tref 64 /* Refresh period in milliseconds */
110#define SDRAM_NRA 8192 /* Number of row addresses in SDRAM */
111#define SDRAM_CL CL_3
112#endif
113
114#if (CONFIG_MEM_MT48LC16M8A2TG_75)
115 /*SDRAM INFORMATION: */
116#define SDRAM_Tref 64 /* Refresh period in milliseconds */
117#define SDRAM_NRA 4096 /* Number of row addresses in SDRAM */
118#define SDRAM_CL CL_3
119#endif
120
121#if (CONFIG_MEM_MT48LC32M8A2_75)
122 /*SDRAM INFORMATION: */
123#define SDRAM_Tref 64 /* Refresh period in milliseconds */
124#define SDRAM_NRA 8192 /* Number of row addresses in SDRAM */
125#define SDRAM_CL CL_3
126#endif
127
128#if (CONFIG_MEM_MT48LC64M4A2FB_7E)
129 /*SDRAM INFORMATION: */
130#define SDRAM_Tref 64 /* Refresh period in milliseconds */
131#define SDRAM_NRA 8192 /* Number of row addresses in SDRAM */
132#define SDRAM_CL CL_3
133#endif
134
135#if (CONFIG_MEM_GENERIC_BOARD)
136 /*SDRAM INFORMATION: Modify this for your board */
137#define SDRAM_Tref 64 /* Refresh period in milliseconds */
138#define SDRAM_NRA 8192 /* Number of row addresses in SDRAM */
139#define SDRAM_CL CL_3
140#endif
141
142/* Equation from section 17 (p17-46) of BF533 HRM */
143#define mem_SDRRC (((CONFIG_SCLK_HZ / 1000) * SDRAM_Tref) / SDRAM_NRA) - (SDRAM_tRAS_num + SDRAM_tRP_num)
144
145/* Enable SCLK Out */
146#define mem_SDGCTL (SCTLE | SDRAM_CL | SDRAM_tRAS | SDRAM_tRP | SDRAM_tRCD | SDRAM_tWR | PSS)
147
148#if defined CONFIG_CLKIN_HALF
149#define CLKIN_HALF 1
150#else
151#define CLKIN_HALF 0
152#endif
153
154#if defined CONFIG_PLL_BYPASS
155#define PLL_BYPASS 1
156#else
157#define PLL_BYPASS 0
158#endif
159
160/***************************************Currently Not Being Used *********************************/
161#define flash_EBIU_AMBCTL_WAT ((CONFIG_FLASH_SPEED_BWAT * 4) / (4000000000 / CONFIG_SCLK_HZ)) + 1
162#define flash_EBIU_AMBCTL_RAT ((CONFIG_FLASH_SPEED_BRAT * 4) / (4000000000 / CONFIG_SCLK_HZ)) + 1
163#define flash_EBIU_AMBCTL_HT ((CONFIG_FLASH_SPEED_BHT * 4) / (4000000000 / CONFIG_SCLK_HZ))
164#define flash_EBIU_AMBCTL_ST ((CONFIG_FLASH_SPEED_BST * 4) / (4000000000 / CONFIG_SCLK_HZ)) + 1
165#define flash_EBIU_AMBCTL_TT ((CONFIG_FLASH_SPEED_BTT * 4) / (4000000000 / CONFIG_SCLK_HZ)) + 1
166
167#if (flash_EBIU_AMBCTL_TT > 3)
168#define flash_EBIU_AMBCTL0_TT B0TT_4
169#endif
170#if (flash_EBIU_AMBCTL_TT == 3)
171#define flash_EBIU_AMBCTL0_TT B0TT_3
172#endif
173#if (flash_EBIU_AMBCTL_TT == 2)
174#define flash_EBIU_AMBCTL0_TT B0TT_2
175#endif
176#if (flash_EBIU_AMBCTL_TT < 2)
177#define flash_EBIU_AMBCTL0_TT B0TT_1
178#endif
179
180#if (flash_EBIU_AMBCTL_ST > 3)
181#define flash_EBIU_AMBCTL0_ST B0ST_4
182#endif
183#if (flash_EBIU_AMBCTL_ST == 3)
184#define flash_EBIU_AMBCTL0_ST B0ST_3
185#endif
186#if (flash_EBIU_AMBCTL_ST == 2)
187#define flash_EBIU_AMBCTL0_ST B0ST_2
188#endif
189#if (flash_EBIU_AMBCTL_ST < 2)
190#define flash_EBIU_AMBCTL0_ST B0ST_1
191#endif
192
193#if (flash_EBIU_AMBCTL_HT > 2)
194#define flash_EBIU_AMBCTL0_HT B0HT_3
195#endif
196#if (flash_EBIU_AMBCTL_HT == 2)
197#define flash_EBIU_AMBCTL0_HT B0HT_2
198#endif
199#if (flash_EBIU_AMBCTL_HT == 1)
200#define flash_EBIU_AMBCTL0_HT B0HT_1
201#endif
202#if (flash_EBIU_AMBCTL_HT == 0 && CONFIG_FLASH_SPEED_BHT == 0)
203#define flash_EBIU_AMBCTL0_HT B0HT_0
204#endif
205#if (flash_EBIU_AMBCTL_HT == 0 && CONFIG_FLASH_SPEED_BHT != 0)
206#define flash_EBIU_AMBCTL0_HT B0HT_1
207#endif
208
209#if (flash_EBIU_AMBCTL_WAT > 14)
210#define flash_EBIU_AMBCTL0_WAT B0WAT_15
211#endif
212#if (flash_EBIU_AMBCTL_WAT == 14)
213#define flash_EBIU_AMBCTL0_WAT B0WAT_14
214#endif
215#if (flash_EBIU_AMBCTL_WAT == 13)
216#define flash_EBIU_AMBCTL0_WAT B0WAT_13
217#endif
218#if (flash_EBIU_AMBCTL_WAT == 12)
219#define flash_EBIU_AMBCTL0_WAT B0WAT_12
220#endif
221#if (flash_EBIU_AMBCTL_WAT == 11)
222#define flash_EBIU_AMBCTL0_WAT B0WAT_11
223#endif
224#if (flash_EBIU_AMBCTL_WAT == 10)
225#define flash_EBIU_AMBCTL0_WAT B0WAT_10
226#endif
227#if (flash_EBIU_AMBCTL_WAT == 9)
228#define flash_EBIU_AMBCTL0_WAT B0WAT_9
229#endif
230#if (flash_EBIU_AMBCTL_WAT == 8)
231#define flash_EBIU_AMBCTL0_WAT B0WAT_8
232#endif
233#if (flash_EBIU_AMBCTL_WAT == 7)
234#define flash_EBIU_AMBCTL0_WAT B0WAT_7
235#endif
236#if (flash_EBIU_AMBCTL_WAT == 6)
237#define flash_EBIU_AMBCTL0_WAT B0WAT_6
238#endif
239#if (flash_EBIU_AMBCTL_WAT == 5)
240#define flash_EBIU_AMBCTL0_WAT B0WAT_5
241#endif
242#if (flash_EBIU_AMBCTL_WAT == 4)
243#define flash_EBIU_AMBCTL0_WAT B0WAT_4
244#endif
245#if (flash_EBIU_AMBCTL_WAT == 3)
246#define flash_EBIU_AMBCTL0_WAT B0WAT_3
247#endif
248#if (flash_EBIU_AMBCTL_WAT == 2)
249#define flash_EBIU_AMBCTL0_WAT B0WAT_2
250#endif
251#if (flash_EBIU_AMBCTL_WAT == 1)
252#define flash_EBIU_AMBCTL0_WAT B0WAT_1
253#endif
254
255#if (flash_EBIU_AMBCTL_RAT > 14)
256#define flash_EBIU_AMBCTL0_RAT B0RAT_15
257#endif
258#if (flash_EBIU_AMBCTL_RAT == 14)
259#define flash_EBIU_AMBCTL0_RAT B0RAT_14
260#endif
261#if (flash_EBIU_AMBCTL_RAT == 13)
262#define flash_EBIU_AMBCTL0_RAT B0RAT_13
263#endif
264#if (flash_EBIU_AMBCTL_RAT == 12)
265#define flash_EBIU_AMBCTL0_RAT B0RAT_12
266#endif
267#if (flash_EBIU_AMBCTL_RAT == 11)
268#define flash_EBIU_AMBCTL0_RAT B0RAT_11
269#endif
270#if (flash_EBIU_AMBCTL_RAT == 10)
271#define flash_EBIU_AMBCTL0_RAT B0RAT_10
272#endif
273#if (flash_EBIU_AMBCTL_RAT == 9)
274#define flash_EBIU_AMBCTL0_RAT B0RAT_9
275#endif
276#if (flash_EBIU_AMBCTL_RAT == 8)
277#define flash_EBIU_AMBCTL0_RAT B0RAT_8
278#endif
279#if (flash_EBIU_AMBCTL_RAT == 7)
280#define flash_EBIU_AMBCTL0_RAT B0RAT_7
281#endif
282#if (flash_EBIU_AMBCTL_RAT == 6)
283#define flash_EBIU_AMBCTL0_RAT B0RAT_6
284#endif
285#if (flash_EBIU_AMBCTL_RAT == 5)
286#define flash_EBIU_AMBCTL0_RAT B0RAT_5
287#endif
288#if (flash_EBIU_AMBCTL_RAT == 4)
289#define flash_EBIU_AMBCTL0_RAT B0RAT_4
290#endif
291#if (flash_EBIU_AMBCTL_RAT == 3)
292#define flash_EBIU_AMBCTL0_RAT B0RAT_3
293#endif
294#if (flash_EBIU_AMBCTL_RAT == 2)
295#define flash_EBIU_AMBCTL0_RAT B0RAT_2
296#endif
297#if (flash_EBIU_AMBCTL_RAT == 1)
298#define flash_EBIU_AMBCTL0_RAT B0RAT_1
299#endif
300
301#define flash_EBIU_AMBCTL0 \
302 (flash_EBIU_AMBCTL0_WAT | flash_EBIU_AMBCTL0_RAT | flash_EBIU_AMBCTL0_HT | \
303 flash_EBIU_AMBCTL0_ST | flash_EBIU_AMBCTL0_TT | CONFIG_FLASH_SPEED_RDYEN)
diff --git a/arch/blackfin/mach-bf537/include/mach/mem_map.h b/arch/blackfin/mach-bf537/include/mach/mem_map.h
index 5078b669431f..f9010c4b4bf3 100644
--- a/arch/blackfin/mach-bf537/include/mach/mem_map.h
+++ b/arch/blackfin/mach-bf537/include/mach/mem_map.h
@@ -176,4 +176,10 @@
176#define L1_SCRATCH_START 0xFFB00000 176#define L1_SCRATCH_START 0xFFB00000
177#define L1_SCRATCH_LENGTH 0x1000 177#define L1_SCRATCH_LENGTH 0x1000
178 178
179#define GET_PDA_SAFE(preg) \
180 preg.l = _cpu_pda; \
181 preg.h = _cpu_pda;
182
183#define GET_PDA(preg, dreg) GET_PDA_SAFE(preg)
184
179#endif /* _MEM_MAP_537_H_ */ 185#endif /* _MEM_MAP_537_H_ */
diff --git a/arch/blackfin/mach-bf537/ints-priority.c b/arch/blackfin/mach-bf537/ints-priority.c
index b1300b3f1812..51c48087e03b 100644
--- a/arch/blackfin/mach-bf537/ints-priority.c
+++ b/arch/blackfin/mach-bf537/ints-priority.c
@@ -55,15 +55,15 @@ void __init program_IAR(void)
55 bfin_write_SIC_IAR2(((CONFIG_IRQ_CAN_TX - 7) << IRQ_CAN_TX_POS) | 55 bfin_write_SIC_IAR2(((CONFIG_IRQ_CAN_TX - 7) << IRQ_CAN_TX_POS) |
56 ((CONFIG_IRQ_MAC_RX - 7) << IRQ_MAC_RX_POS) | 56 ((CONFIG_IRQ_MAC_RX - 7) << IRQ_MAC_RX_POS) |
57 ((CONFIG_IRQ_MAC_TX - 7) << IRQ_MAC_TX_POS) | 57 ((CONFIG_IRQ_MAC_TX - 7) << IRQ_MAC_TX_POS) |
58 ((CONFIG_IRQ_TMR0 - 7) << IRQ_TMR0_POS) | 58 ((CONFIG_IRQ_TIMER0 - 7) << IRQ_TIMER0_POS) |
59 ((CONFIG_IRQ_TMR1 - 7) << IRQ_TMR1_POS) | 59 ((CONFIG_IRQ_TIMER1 - 7) << IRQ_TIMER1_POS) |
60 ((CONFIG_IRQ_TMR2 - 7) << IRQ_TMR2_POS) | 60 ((CONFIG_IRQ_TIMER2 - 7) << IRQ_TIMER2_POS) |
61 ((CONFIG_IRQ_TMR3 - 7) << IRQ_TMR3_POS) | 61 ((CONFIG_IRQ_TIMER3 - 7) << IRQ_TIMER3_POS) |
62 ((CONFIG_IRQ_TMR4 - 7) << IRQ_TMR4_POS)); 62 ((CONFIG_IRQ_TIMER4 - 7) << IRQ_TIMER4_POS));
63 63
64 bfin_write_SIC_IAR3(((CONFIG_IRQ_TMR5 - 7) << IRQ_TMR5_POS) | 64 bfin_write_SIC_IAR3(((CONFIG_IRQ_TIMER5 - 7) << IRQ_TIMER5_POS) |
65 ((CONFIG_IRQ_TMR6 - 7) << IRQ_TMR6_POS) | 65 ((CONFIG_IRQ_TIMER6 - 7) << IRQ_TIMER6_POS) |
66 ((CONFIG_IRQ_TMR7 - 7) << IRQ_TMR7_POS) | 66 ((CONFIG_IRQ_TIMER7 - 7) << IRQ_TIMER7_POS) |
67 ((CONFIG_IRQ_PROG_INTA - 7) << IRQ_PROG_INTA_POS) | 67 ((CONFIG_IRQ_PROG_INTA - 7) << IRQ_PROG_INTA_POS) |
68 ((CONFIG_IRQ_PORTG_INTB - 7) << IRQ_PORTG_INTB_POS) | 68 ((CONFIG_IRQ_PORTG_INTB - 7) << IRQ_PORTG_INTB_POS) |
69 ((CONFIG_IRQ_MEM_DMA0 - 7) << IRQ_MEM_DMA0_POS) | 69 ((CONFIG_IRQ_MEM_DMA0 - 7) << IRQ_MEM_DMA0_POS) |
diff --git a/arch/blackfin/mach-bf538/Kconfig b/arch/blackfin/mach-bf538/Kconfig
new file mode 100644
index 000000000000..f068c3523cdc
--- /dev/null
+++ b/arch/blackfin/mach-bf538/Kconfig
@@ -0,0 +1,164 @@
1if (BF538 || BF539)
2
3source "arch/blackfin/mach-bf538/boards/Kconfig"
4
5menu "BF538 Specific Configuration"
6
7comment "Interrupt Priority Assignment"
8menu "Priority"
9
10config IRQ_PLL_WAKEUP
11 int "IRQ_PLL_WAKEUP"
12 default 7
13config IRQ_DMA0_ERROR
14 int "IRQ_DMA0_ERROR"
15 default 7
16config IRQ_PPI_ERROR
17 int "IRQ_PPI_ERROR"
18 default 7
19config IRQ_SPORT0_ERROR
20 int "IRQ_SPORT0_ERROR"
21 default 7
22config IRQ_SPORT1_ERROR
23 int "IRQ_SPORT1_ERROR"
24 default 7
25config IRQ_SPI0_ERROR
26 int "IRQ_SPI0_ERROR"
27 default 7
28config IRQ_UART0_ERROR
29 int "IRQ_UART0_ERROR"
30 default 7
31config IRQ_RTC
32 int "IRQ_RTC"
33 default 8
34config IRQ_PPI
35 int "IRQ_PPI"
36 default 8
37config IRQ_SPORT0_RX
38 int "IRQ_SPORT0_RX"
39 default 9
40config IRQ_SPORT0_TX
41 int "IRQ_SPORT0_TX"
42 default 9
43config IRQ_SPORT1_RX
44 int "IRQ_SPORT1_RX"
45 default 9
46config IRQ_SPORT1_TX
47 int "IRQ_SPORT1_TX"
48 default 9
49config IRQ_SPI0
50 int "IRQ_SPI0"
51 default 10
52config IRQ_UART0_RX
53 int "IRQ_UART0_RX"
54 default 10
55config IRQ_UART0_TX
56 int "IRQ_UART0_TX"
57 default 10
58config IRQ_TIMER0
59 int "IRQ_TIMER0"
60 default 8
61config IRQ_TIMER1
62 int "IRQ_TIMER1"
63 default 11
64config IRQ_TIMER2
65 int "IRQ_TIMER2"
66 default 11
67config IRQ_PORTF_INTA
68 int "IRQ_PORTF_INTA"
69 default 12
70config IRQ_PORTF_INTB
71 int "IRQ_PORTF_INTB"
72 default 12
73config IRQ_MEM0_DMA0
74 int "IRQ_MEM0_DMA0"
75 default 13
76config IRQ_MEM0_DMA1
77 int "IRQ_MEM0_DMA1"
78 default 13
79config IRQ_WATCH
80 int "IRQ_WATCH"
81 default 13
82config IRQ_DMA1_ERROR
83 int "IRQ_DMA1_ERROR"
84 default 7
85config IRQ_SPORT2_ERROR
86 int "IRQ_SPORT2_ERROR"
87 default 7
88config IRQ_SPORT3_ERROR
89 int "IRQ_SPORT3_ERROR"
90 default 7
91config IRQ_SPI1_ERROR
92 int "IRQ_SPI1_ERROR"
93 default 7
94config IRQ_SPI2_ERROR
95 int "IRQ_SPI2_ERROR"
96 default 7
97config IRQ_UART1_ERROR
98 int "IRQ_UART1_ERROR"
99 default 7
100config IRQ_UART2_ERROR
101 int "IRQ_UART2_ERROR"
102 default 7
103config IRQ_CAN_ERROR
104 int "IRQ_CAN_ERROR"
105 default 7
106config IRQ_SPORT2_RX
107 int "IRQ_SPORT2_RX"
108 default 9
109config IRQ_SPORT2_TX
110 int "IRQ_SPORT2_TX"
111 default 9
112config IRQ_SPORT3_RX
113 int "IRQ_SPORT3_RX"
114 default 9
115config IRQ_SPORT3_TX
116 int "IRQ_SPORT3_TX"
117 default 9
118config IRQ_SPI1
119 int "IRQ_SPI1"
120 default 10
121config IRQ_SPI2
122 int "IRQ_SPI2"
123 default 10
124config IRQ_UART1_RX
125 int "IRQ_UART1_RX"
126 default 10
127config IRQ_UART1_TX
128 int "IRQ_UART1_TX"
129 default 10
130config IRQ_UART2_RX
131 int "IRQ_UART2_RX"
132 default 10
133config IRQ_UART2_TX
134 int "IRQ_UART2_TX"
135 default 10
136config IRQ_TWI0
137 int "IRQ_TWI0"
138 default 11
139config IRQ_TWI1
140 int "IRQ_TWI1"
141 default 11
142config IRQ_CAN_RX
143 int "IRQ_CAN_RX"
144 default 11
145config IRQ_CAN_TX
146 int "IRQ_CAN_TX"
147 default 11
148config IRQ_MEM1_DMA0
149 int "IRQ_MEM1_DMA0"
150 default 13
151config IRQ_MEM1_DMA1
152 int "IRQ_MEM1_DMA1"
153 default 13
154
155 help
156 Enter the priority numbers between 7-13 ONLY. Others are Reserved.
157 This applies to all the above. It is not recommended to assign the
158 highest priority number 7 to UART or any other device.
159
160endmenu
161
162endmenu
163
164endif
diff --git a/arch/blackfin/mach-bf538/Makefile b/arch/blackfin/mach-bf538/Makefile
new file mode 100644
index 000000000000..8cd2719684db
--- /dev/null
+++ b/arch/blackfin/mach-bf538/Makefile
@@ -0,0 +1,5 @@
1#
2# arch/blackfin/mach-bf538/Makefile
3#
4
5obj-y := ints-priority.o dma.o
diff --git a/arch/blackfin/mach-bf538/boards/Kconfig b/arch/blackfin/mach-bf538/boards/Kconfig
new file mode 100644
index 000000000000..215249ba58bb
--- /dev/null
+++ b/arch/blackfin/mach-bf538/boards/Kconfig
@@ -0,0 +1,12 @@
1choice
2 prompt "System type"
3 default BFIN538_EZKIT
4 help
5 Select your board!
6
7config BFIN538_EZKIT
8 bool "BF538-EZKIT"
9 help
10 BF538-EZKIT-LITE board support.
11
12endchoice
diff --git a/arch/blackfin/mach-bf538/boards/Makefile b/arch/blackfin/mach-bf538/boards/Makefile
new file mode 100644
index 000000000000..6143b320d585
--- /dev/null
+++ b/arch/blackfin/mach-bf538/boards/Makefile
@@ -0,0 +1,5 @@
1#
2# arch/blackfin/mach-bf538/boards/Makefile
3#
4
5obj-$(CONFIG_BFIN538_EZKIT) += ezkit.o
diff --git a/arch/blackfin/mach-bf538/boards/ezkit.c b/arch/blackfin/mach-bf538/boards/ezkit.c
new file mode 100644
index 000000000000..e37cb9378884
--- /dev/null
+++ b/arch/blackfin/mach-bf538/boards/ezkit.c
@@ -0,0 +1,606 @@
1/*
2 * File: arch/blackfin/mach-bf538/boards/ezkit.c
3 * Based on: arch/blackfin/mach-bf537/boards/ezkit.c
4 * Author: Aidan Williams <aidan@nicta.com.au>
5 *
6 * Created:
7 * Description:
8 *
9 * Modified:
10 * Copyright 2005 National ICT Australia (NICTA)
11 * Copyright 2004-2008 Analog Devices Inc.
12 *
13 * Bugs: Enter bugs at http://blackfin.uclinux.org/
14 *
15 * This program is free software; you can redistribute it and/or modify
16 * it under the terms of the GNU General Public License as published by
17 * the Free Software Foundation; either version 2 of the License, or
18 * (at your option) any later version.
19 *
20 * This program is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
24 *
25 * You should have received a copy of the GNU General Public License
26 * along with this program; if not, see the file COPYING, or write
27 * to the Free Software Foundation, Inc.,
28 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
29 */
30
31#include <linux/device.h>
32#include <linux/platform_device.h>
33#include <linux/mtd/mtd.h>
34#include <linux/mtd/partitions.h>
35#include <linux/spi/spi.h>
36#include <linux/spi/flash.h>
37#include <linux/irq.h>
38#include <linux/interrupt.h>
39#include <asm/bfin5xx_spi.h>
40#include <asm/dma.h>
41#include <asm/gpio.h>
42#include <asm/nand.h>
43#include <asm/portmux.h>
44#include <asm/dpmc.h>
45#include <linux/input.h>
46
47/*
48 * Name the Board for the /proc/cpuinfo
49 */
50const char bfin_board_name[] = "ADI BF538-EZKIT";
51
52/*
53 * Driver needs to know address, irq and flag pin.
54 */
55
56
57#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
58static struct platform_device rtc_device = {
59 .name = "rtc-bfin",
60 .id = -1,
61};
62#endif
63
64#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
65static struct resource bfin_uart_resources[] = {
66#ifdef CONFIG_SERIAL_BFIN_UART0
67 {
68 .start = 0xFFC00400,
69 .end = 0xFFC004FF,
70 .flags = IORESOURCE_MEM,
71 },
72#endif
73#ifdef CONFIG_SERIAL_BFIN_UART1
74 {
75 .start = 0xFFC02000,
76 .end = 0xFFC020FF,
77 .flags = IORESOURCE_MEM,
78 },
79#endif
80#ifdef CONFIG_SERIAL_BFIN_UART2
81 {
82 .start = 0xFFC02100,
83 .end = 0xFFC021FF,
84 .flags = IORESOURCE_MEM,
85 },
86#endif
87};
88
89static struct platform_device bfin_uart_device = {
90 .name = "bfin-uart",
91 .id = 1,
92 .num_resources = ARRAY_SIZE(bfin_uart_resources),
93 .resource = bfin_uart_resources,
94};
95#endif
96
97#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
98#ifdef CONFIG_BFIN_SIR0
99static struct resource bfin_sir0_resources[] = {
100 {
101 .start = 0xFFC00400,
102 .end = 0xFFC004FF,
103 .flags = IORESOURCE_MEM,
104 },
105 {
106 .start = IRQ_UART0_RX,
107 .end = IRQ_UART0_RX+1,
108 .flags = IORESOURCE_IRQ,
109 },
110 {
111 .start = CH_UART0_RX,
112 .end = CH_UART0_RX+1,
113 .flags = IORESOURCE_DMA,
114 },
115};
116static struct platform_device bfin_sir0_device = {
117 .name = "bfin_sir",
118 .id = 0,
119 .num_resources = ARRAY_SIZE(bfin_sir0_resources),
120 .resource = bfin_sir0_resources,
121};
122#endif
123#ifdef CONFIG_BFIN_SIR1
124static struct resource bfin_sir1_resources[] = {
125 {
126 .start = 0xFFC02000,
127 .end = 0xFFC020FF,
128 .flags = IORESOURCE_MEM,
129 },
130 {
131 .start = IRQ_UART1_RX,
132 .end = IRQ_UART1_RX+1,
133 .flags = IORESOURCE_IRQ,
134 },
135 {
136 .start = CH_UART1_RX,
137 .end = CH_UART1_RX+1,
138 .flags = IORESOURCE_DMA,
139 },
140};
141static struct platform_device bfin_sir1_device = {
142 .name = "bfin_sir",
143 .id = 1,
144 .num_resources = ARRAY_SIZE(bfin_sir1_resources),
145 .resource = bfin_sir1_resources,
146};
147#endif
148#ifdef CONFIG_BFIN_SIR2
149static struct resource bfin_sir2_resources[] = {
150 {
151 .start = 0xFFC02100,
152 .end = 0xFFC021FF,
153 .flags = IORESOURCE_MEM,
154 },
155 {
156 .start = IRQ_UART2_RX,
157 .end = IRQ_UART2_RX+1,
158 .flags = IORESOURCE_IRQ,
159 },
160 {
161 .start = CH_UART2_RX,
162 .end = CH_UART2_RX+1,
163 .flags = IORESOURCE_DMA,
164 },
165};
166static struct platform_device bfin_sir2_device = {
167 .name = "bfin_sir",
168 .id = 2,
169 .num_resources = ARRAY_SIZE(bfin_sir2_resources),
170 .resource = bfin_sir2_resources,
171};
172#endif
173#endif
174
175/*
176 * USB-LAN EzExtender board
177 * Driver needs to know address, irq and flag pin.
178 */
179#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
180static struct resource smc91x_resources[] = {
181 {
182 .name = "smc91x-regs",
183 .start = 0x20310300,
184 .end = 0x20310300 + 16,
185 .flags = IORESOURCE_MEM,
186 }, {
187 .start = IRQ_PF0,
188 .end = IRQ_PF0,
189 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
190 },
191};
192static struct platform_device smc91x_device = {
193 .name = "smc91x",
194 .id = 0,
195 .num_resources = ARRAY_SIZE(smc91x_resources),
196 .resource = smc91x_resources,
197};
198#endif
199
200#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
201/* all SPI peripherals info goes here */
202#if defined(CONFIG_MTD_M25P80) \
203 || defined(CONFIG_MTD_M25P80_MODULE)
204/* SPI flash chip (m25p16) */
205static struct mtd_partition bfin_spi_flash_partitions[] = {
206 {
207 .name = "bootloader(spi)",
208 .size = 0x00040000,
209 .offset = 0,
210 .mask_flags = MTD_CAP_ROM
211 }, {
212 .name = "linux kernel(spi)",
213 .size = 0x1c0000,
214 .offset = 0x40000
215 }
216};
217
218static struct flash_platform_data bfin_spi_flash_data = {
219 .name = "m25p80",
220 .parts = bfin_spi_flash_partitions,
221 .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
222 .type = "m25p16",
223};
224
225static struct bfin5xx_spi_chip spi_flash_chip_info = {
226 .enable_dma = 0, /* use dma transfer with this chip*/
227 .bits_per_word = 8,
228 .cs_change_per_word = 0,
229};
230#endif
231
232#if defined(CONFIG_TOUCHSCREEN_AD7879) || defined(CONFIG_TOUCHSCREEN_AD7879_MODULE)
233#include <linux/spi/ad7879.h>
234static const struct ad7879_platform_data bfin_ad7879_ts_info = {
235 .model = 7879, /* Model = AD7879 */
236 .x_plate_ohms = 620, /* 620 Ohm from the touch datasheet */
237 .pressure_max = 10000,
238 .pressure_min = 0,
239 .first_conversion_delay = 3, /* wait 512us before do a first conversion */
240 .acquisition_time = 1, /* 4us acquisition time per sample */
241 .median = 2, /* do 8 measurements */
242 .averaging = 1, /* take the average of 4 middle samples */
243 .pen_down_acc_interval = 255, /* 9.4 ms */
244 .gpio_output = 1, /* configure AUX/VBAT/GPIO as GPIO output */
245 .gpio_default = 1, /* During initialization set GPIO = HIGH */
246};
247#endif
248
249#if defined(CONFIG_TOUCHSCREEN_AD7879_SPI) || defined(CONFIG_TOUCHSCREEN_AD7879_SPI_MODULE)
250static struct bfin5xx_spi_chip spi_ad7879_chip_info = {
251 .enable_dma = 0,
252 .bits_per_word = 16,
253};
254#endif
255
256#if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)
257#include <asm/bfin-lq035q1.h>
258
259static struct bfin_lq035q1fb_disp_info bfin_lq035q1_data = {
260 .mode = LQ035_NORM | LQ035_RGB | LQ035_RL | LQ035_TB,
261 .use_bl = 0, /* let something else control the LCD Blacklight */
262 .gpio_bl = GPIO_PF7,
263};
264
265static struct resource bfin_lq035q1_resources[] = {
266 {
267 .start = IRQ_PPI_ERROR,
268 .end = IRQ_PPI_ERROR,
269 .flags = IORESOURCE_IRQ,
270 },
271};
272
273static struct platform_device bfin_lq035q1_device = {
274 .name = "bfin-lq035q1",
275 .id = -1,
276 .num_resources = ARRAY_SIZE(bfin_lq035q1_resources),
277 .resource = bfin_lq035q1_resources,
278 .dev = {
279 .platform_data = &bfin_lq035q1_data,
280 },
281};
282#endif
283
284#if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
285static struct bfin5xx_spi_chip spidev_chip_info = {
286 .enable_dma = 0,
287 .bits_per_word = 8,
288};
289#endif
290
291#if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)
292static struct bfin5xx_spi_chip lq035q1_spi_chip_info = {
293 .enable_dma = 0,
294 .bits_per_word = 8,
295};
296#endif
297
298static struct spi_board_info bf538_spi_board_info[] __initdata = {
299#if defined(CONFIG_MTD_M25P80) \
300 || defined(CONFIG_MTD_M25P80_MODULE)
301 {
302 /* the modalias must be the same as spi device driver name */
303 .modalias = "m25p80", /* Name of spi_driver for this device */
304 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
305 .bus_num = 0, /* Framework bus number */
306 .chip_select = 1, /* SPI_SSEL1*/
307 .platform_data = &bfin_spi_flash_data,
308 .controller_data = &spi_flash_chip_info,
309 .mode = SPI_MODE_3,
310 },
311#endif
312#if defined(CONFIG_TOUCHSCREEN_AD7879_SPI) || defined(CONFIG_TOUCHSCREEN_AD7879_SPI_MODULE)
313 {
314 .modalias = "ad7879",
315 .platform_data = &bfin_ad7879_ts_info,
316 .irq = IRQ_PF3,
317 .max_speed_hz = 5000000, /* max spi clock (SCK) speed in HZ */
318 .bus_num = 0,
319 .chip_select = 1,
320 .controller_data = &spi_ad7879_chip_info,
321 .mode = SPI_CPHA | SPI_CPOL,
322 },
323#endif
324#if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)
325 {
326 .modalias = "bfin-lq035q1-spi",
327 .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
328 .bus_num = 0,
329 .chip_select = 2,
330 .controller_data = &lq035q1_spi_chip_info,
331 .mode = SPI_CPHA | SPI_CPOL,
332 },
333#endif
334#if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
335 {
336 .modalias = "spidev",
337 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
338 .bus_num = 0,
339 .chip_select = 1,
340 .controller_data = &spidev_chip_info,
341 },
342#endif
343};
344
345/* SPI (0) */
346static struct resource bfin_spi0_resource[] = {
347 [0] = {
348 .start = SPI0_REGBASE,
349 .end = SPI0_REGBASE + 0xFF,
350 .flags = IORESOURCE_MEM,
351 },
352 [1] = {
353 .start = CH_SPI0,
354 .end = CH_SPI0,
355 .flags = IORESOURCE_IRQ,
356 }
357};
358
359/* SPI (1) */
360static struct resource bfin_spi1_resource[] = {
361 [0] = {
362 .start = SPI1_REGBASE,
363 .end = SPI1_REGBASE + 0xFF,
364 .flags = IORESOURCE_MEM,
365 },
366 [1] = {
367 .start = CH_SPI1,
368 .end = CH_SPI1,
369 .flags = IORESOURCE_IRQ,
370 }
371};
372
373/* SPI (2) */
374static struct resource bfin_spi2_resource[] = {
375 [0] = {
376 .start = SPI2_REGBASE,
377 .end = SPI2_REGBASE + 0xFF,
378 .flags = IORESOURCE_MEM,
379 },
380 [1] = {
381 .start = CH_SPI2,
382 .end = CH_SPI2,
383 .flags = IORESOURCE_IRQ,
384 }
385};
386
387/* SPI controller data */
388static struct bfin5xx_spi_master bf538_spi_master_info0 = {
389 .num_chipselect = 8,
390 .enable_dma = 1, /* master has the ability to do dma transfer */
391 .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
392};
393
394static struct platform_device bf538_spi_master0 = {
395 .name = "bfin-spi",
396 .id = 0, /* Bus number */
397 .num_resources = ARRAY_SIZE(bfin_spi0_resource),
398 .resource = bfin_spi0_resource,
399 .dev = {
400 .platform_data = &bf538_spi_master_info0, /* Passed to driver */
401 },
402};
403
404static struct bfin5xx_spi_master bf538_spi_master_info1 = {
405 .num_chipselect = 8,
406 .enable_dma = 1, /* master has the ability to do dma transfer */
407 .pin_req = {P_SPI1_SCK, P_SPI1_MISO, P_SPI1_MOSI, 0},
408};
409
410static struct platform_device bf538_spi_master1 = {
411 .name = "bfin-spi",
412 .id = 1, /* Bus number */
413 .num_resources = ARRAY_SIZE(bfin_spi1_resource),
414 .resource = bfin_spi1_resource,
415 .dev = {
416 .platform_data = &bf538_spi_master_info1, /* Passed to driver */
417 },
418};
419
420static struct bfin5xx_spi_master bf538_spi_master_info2 = {
421 .num_chipselect = 8,
422 .enable_dma = 1, /* master has the ability to do dma transfer */
423 .pin_req = {P_SPI2_SCK, P_SPI2_MISO, P_SPI2_MOSI, 0},
424};
425
426static struct platform_device bf538_spi_master2 = {
427 .name = "bfin-spi",
428 .id = 2, /* Bus number */
429 .num_resources = ARRAY_SIZE(bfin_spi2_resource),
430 .resource = bfin_spi2_resource,
431 .dev = {
432 .platform_data = &bf538_spi_master_info2, /* Passed to driver */
433 },
434};
435
436#endif /* spi master and devices */
437
438#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
439static struct resource bfin_twi0_resource[] = {
440 [0] = {
441 .start = TWI0_REGBASE,
442 .end = TWI0_REGBASE + 0xFF,
443 .flags = IORESOURCE_MEM,
444 },
445 [1] = {
446 .start = IRQ_TWI0,
447 .end = IRQ_TWI0,
448 .flags = IORESOURCE_IRQ,
449 },
450};
451
452static struct platform_device i2c_bfin_twi0_device = {
453 .name = "i2c-bfin-twi",
454 .id = 0,
455 .num_resources = ARRAY_SIZE(bfin_twi0_resource),
456 .resource = bfin_twi0_resource,
457};
458
459#if !defined(CONFIG_BF542) /* The BF542 only has 1 TWI */
460static struct resource bfin_twi1_resource[] = {
461 [0] = {
462 .start = TWI1_REGBASE,
463 .end = TWI1_REGBASE + 0xFF,
464 .flags = IORESOURCE_MEM,
465 },
466 [1] = {
467 .start = IRQ_TWI1,
468 .end = IRQ_TWI1,
469 .flags = IORESOURCE_IRQ,
470 },
471};
472
473static struct platform_device i2c_bfin_twi1_device = {
474 .name = "i2c-bfin-twi",
475 .id = 1,
476 .num_resources = ARRAY_SIZE(bfin_twi1_resource),
477 .resource = bfin_twi1_resource,
478};
479#endif
480#endif
481
482static struct resource bfin_gpios_resources = {
483 .start = 0,
484 .end = MAX_BLACKFIN_GPIOS - 1,
485 .flags = IORESOURCE_IRQ,
486};
487
488static struct platform_device bfin_gpios_device = {
489 .name = "simple-gpio",
490 .id = -1,
491 .num_resources = 1,
492 .resource = &bfin_gpios_resources,
493};
494
495#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
496#include <linux/gpio_keys.h>
497
498static struct gpio_keys_button bfin_gpio_keys_table[] = {
499 {BTN_0, GPIO_PC7, 1, "gpio-keys: BTN0"},
500};
501
502static struct gpio_keys_platform_data bfin_gpio_keys_data = {
503 .buttons = bfin_gpio_keys_table,
504 .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table),
505};
506
507static struct platform_device bfin_device_gpiokeys = {
508 .name = "gpio-keys",
509 .dev = {
510 .platform_data = &bfin_gpio_keys_data,
511 },
512};
513#endif
514
515static const unsigned int cclk_vlev_datasheet[] =
516{
517/*
518 * Internal VLEV BF538SBBC1533
519 ****temporarily using these values until data sheet is updated
520 */
521 VRPAIR(VLEV_100, 150000000),
522 VRPAIR(VLEV_100, 250000000),
523 VRPAIR(VLEV_110, 276000000),
524 VRPAIR(VLEV_115, 301000000),
525 VRPAIR(VLEV_120, 525000000),
526 VRPAIR(VLEV_125, 550000000),
527 VRPAIR(VLEV_130, 600000000),
528};
529
530static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = {
531 .tuple_tab = cclk_vlev_datasheet,
532 .tabsize = ARRAY_SIZE(cclk_vlev_datasheet),
533 .vr_settling_time = 25 /* us */,
534};
535
536static struct platform_device bfin_dpmc = {
537 .name = "bfin dpmc",
538 .dev = {
539 .platform_data = &bfin_dmpc_vreg_data,
540 },
541};
542
543static struct platform_device *cm_bf538_devices[] __initdata = {
544
545 &bfin_dpmc,
546
547#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
548 &rtc_device,
549#endif
550
551#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
552 &bfin_uart_device,
553#endif
554
555#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
556 &bf538_spi_master0,
557 &bf538_spi_master1,
558 &bf538_spi_master2,
559#endif
560
561#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
562 &i2c_bfin_twi0_device,
563 &i2c_bfin_twi1_device,
564#endif
565
566#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
567#ifdef CONFIG_BFIN_SIR0
568 &bfin_sir0_device,
569#endif
570#ifdef CONFIG_BFIN_SIR1
571 &bfin_sir1_device,
572#endif
573#ifdef CONFIG_BFIN_SIR2
574 &bfin_sir2_device,
575#endif
576#endif
577
578#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
579 &smc91x_device,
580#endif
581
582#if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)
583 &bfin_lq035q1_device,
584#endif
585
586#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
587 &bfin_device_gpiokeys,
588#endif
589
590 &bfin_gpios_device,
591};
592
593static int __init ezkit_init(void)
594{
595 printk(KERN_INFO "%s(): registering device resources\n", __func__);
596 platform_add_devices(cm_bf538_devices, ARRAY_SIZE(cm_bf538_devices));
597
598#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
599 spi_register_board_info(bf538_spi_board_info,
600 ARRAY_SIZE(bf538_spi_board_info));
601#endif
602
603 return 0;
604}
605
606arch_initcall(ezkit_init);
diff --git a/arch/blackfin/mach-bf538/dma.c b/arch/blackfin/mach-bf538/dma.c
new file mode 100644
index 000000000000..d6837fbf94ea
--- /dev/null
+++ b/arch/blackfin/mach-bf538/dma.c
@@ -0,0 +1,161 @@
1/*
2 * File: arch/blackfin/mach-bf538/dma.c
3 * Based on:
4 * Author:
5 *
6 * Created:
7 * Description: This file contains the simple DMA Implementation for Blackfin
8 *
9 * Modified:
10 * Copyright 2008 Analog Devices Inc.
11 *
12 * Bugs: Enter bugs at http://blackfin.uclinux.org/
13 *
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 2 of the License, or
17 * (at your option) any later version.
18 *
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
23 *
24 * You should have received a copy of the GNU General Public License
25 * along with this program; if not, see the file COPYING, or write
26 * to the Free Software Foundation, Inc.,
27 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
28 */
29#include <linux/module.h>
30
31#include <asm/blackfin.h>
32#include <asm/dma.h>
33
34struct dma_register *dma_io_base_addr[MAX_DMA_CHANNELS] = {
35 (struct dma_register *) DMA0_NEXT_DESC_PTR,
36 (struct dma_register *) DMA1_NEXT_DESC_PTR,
37 (struct dma_register *) DMA2_NEXT_DESC_PTR,
38 (struct dma_register *) DMA3_NEXT_DESC_PTR,
39 (struct dma_register *) DMA4_NEXT_DESC_PTR,
40 (struct dma_register *) DMA5_NEXT_DESC_PTR,
41 (struct dma_register *) DMA6_NEXT_DESC_PTR,
42 (struct dma_register *) DMA7_NEXT_DESC_PTR,
43 (struct dma_register *) DMA8_NEXT_DESC_PTR,
44 (struct dma_register *) DMA9_NEXT_DESC_PTR,
45 (struct dma_register *) DMA10_NEXT_DESC_PTR,
46 (struct dma_register *) DMA11_NEXT_DESC_PTR,
47 (struct dma_register *) DMA12_NEXT_DESC_PTR,
48 (struct dma_register *) DMA13_NEXT_DESC_PTR,
49 (struct dma_register *) DMA14_NEXT_DESC_PTR,
50 (struct dma_register *) DMA15_NEXT_DESC_PTR,
51 (struct dma_register *) DMA16_NEXT_DESC_PTR,
52 (struct dma_register *) DMA17_NEXT_DESC_PTR,
53 (struct dma_register *) DMA18_NEXT_DESC_PTR,
54 (struct dma_register *) DMA19_NEXT_DESC_PTR,
55 (struct dma_register *) MDMA0_D0_NEXT_DESC_PTR,
56 (struct dma_register *) MDMA0_S0_NEXT_DESC_PTR,
57 (struct dma_register *) MDMA0_D1_NEXT_DESC_PTR,
58 (struct dma_register *) MDMA0_S1_NEXT_DESC_PTR,
59 (struct dma_register *) MDMA1_D0_NEXT_DESC_PTR,
60 (struct dma_register *) MDMA1_S0_NEXT_DESC_PTR,
61 (struct dma_register *) MDMA1_D1_NEXT_DESC_PTR,
62 (struct dma_register *) MDMA1_S1_NEXT_DESC_PTR,
63};
64EXPORT_SYMBOL(dma_io_base_addr);
65
66int channel2irq(unsigned int channel)
67{
68 int ret_irq = -1;
69
70 switch (channel) {
71 case CH_PPI:
72 ret_irq = IRQ_PPI;
73 break;
74
75 case CH_UART0_RX:
76 ret_irq = IRQ_UART0_RX;
77 break;
78
79 case CH_UART0_TX:
80 ret_irq = IRQ_UART0_TX;
81 break;
82
83 case CH_UART1_RX:
84 ret_irq = IRQ_UART1_RX;
85 break;
86
87 case CH_UART1_TX:
88 ret_irq = IRQ_UART1_TX;
89 break;
90
91 case CH_UART2_RX:
92 ret_irq = IRQ_UART2_RX;
93 break;
94
95 case CH_UART2_TX:
96 ret_irq = IRQ_UART2_TX;
97 break;
98
99 case CH_SPORT0_RX:
100 ret_irq = IRQ_SPORT0_RX;
101 break;
102
103 case CH_SPORT0_TX:
104 ret_irq = IRQ_SPORT0_TX;
105 break;
106
107 case CH_SPORT1_RX:
108 ret_irq = IRQ_SPORT1_RX;
109 break;
110
111 case CH_SPORT1_TX:
112 ret_irq = IRQ_SPORT1_TX;
113 break;
114
115 case CH_SPORT2_RX:
116 ret_irq = IRQ_SPORT2_RX;
117 break;
118
119 case CH_SPORT2_TX:
120 ret_irq = IRQ_SPORT2_TX;
121 break;
122
123 case CH_SPORT3_RX:
124 ret_irq = IRQ_SPORT3_RX;
125 break;
126
127 case CH_SPORT3_TX:
128 ret_irq = IRQ_SPORT3_TX;
129 break;
130
131 case CH_SPI0:
132 ret_irq = IRQ_SPI0;
133 break;
134
135 case CH_SPI1:
136 ret_irq = IRQ_SPI1;
137 break;
138
139 case CH_SPI2:
140 ret_irq = IRQ_SPI2;
141 break;
142
143 case CH_MEM_STREAM0_SRC:
144 case CH_MEM_STREAM0_DEST:
145 ret_irq = IRQ_MEM0_DMA0;
146 break;
147 case CH_MEM_STREAM1_SRC:
148 case CH_MEM_STREAM1_DEST:
149 ret_irq = IRQ_MEM0_DMA1;
150 break;
151 case CH_MEM_STREAM2_SRC:
152 case CH_MEM_STREAM2_DEST:
153 ret_irq = IRQ_MEM1_DMA0;
154 break;
155 case CH_MEM_STREAM3_SRC:
156 case CH_MEM_STREAM3_DEST:
157 ret_irq = IRQ_MEM1_DMA1;
158 break;
159 }
160 return ret_irq;
161}
diff --git a/arch/blackfin/mach-bf538/include/mach/anomaly.h b/arch/blackfin/mach-bf538/include/mach/anomaly.h
new file mode 100644
index 000000000000..e130b4f8a05d
--- /dev/null
+++ b/arch/blackfin/mach-bf538/include/mach/anomaly.h
@@ -0,0 +1,132 @@
1/*
2 * File: include/asm-blackfin/mach-bf538/anomaly.h
3 * Bugs: Enter bugs at http://blackfin.uclinux.org/
4 *
5 * Copyright (C) 2004-2008 Analog Devices Inc.
6 * Licensed under the GPL-2 or later.
7 */
8
9/* This file shoule be up to date with:
10 * - Revision G, 09/18/2008; ADSP-BF538/BF538F Blackfin Processor Anomaly List
11 * - Revision L, 09/18/2008; ADSP-BF539/BF539F Blackfin Processor Anomaly List
12 */
13
14#ifndef _MACH_ANOMALY_H_
15#define _MACH_ANOMALY_H_
16
17#if __SILICON_REVISION__ < 4
18# error will not work on BF538 silicon version 0.0, 0.1, 0.2, or 0.3
19#endif
20
21/* Multi-Issue Instruction with dsp32shiftimm in slot1 and P-reg Store in slot2 Not Supported */
22#define ANOMALY_05000074 (1)
23/* DMA_RUN Bit Is Not Valid after a Peripheral Receive Channel DMA Stops */
24#define ANOMALY_05000119 (1)
25/* Rx.H Cannot Be Used to Access 16-bit System MMR Registers */
26#define ANOMALY_05000122 (1)
27/* PPI Data Lengths between 8 and 16 Do Not Zero Out Upper Bits */
28#define ANOMALY_05000166 (1)
29/* PPI_COUNT Cannot Be Programmed to 0 in General Purpose TX or RX Modes */
30#define ANOMALY_05000179 (1)
31/* PPI_DELAY Not Functional in PPI Modes with 0 Frame Syncs */
32#define ANOMALY_05000180 (1)
33/* False I/O Pin Interrupts on Edge-Sensitive Inputs When Polarity Setting Is Changed */
34#define ANOMALY_05000193 (1)
35/* Current DMA Address Shows Wrong Value During Carry Fix */
36#define ANOMALY_05000199 (__SILICON_REVISION__ < 4)
37/* NMI Event at Boot Time Results in Unpredictable State */
38#define ANOMALY_05000219 (1)
39/* SPI Slave Boot Mode Modifies Registers from Reset Value */
40#define ANOMALY_05000229 (1)
41/* PPI_FS3 Is Not Driven in 2 or 3 Internal Frame Sync Transmit Modes */
42#define ANOMALY_05000233 (1)
43/* If i-cache is on, CSYNC/SSYNC/IDLE around Change of Control causes failures */
44#define ANOMALY_05000244 (__SILICON_REVISION__ < 3)
45/* Spurious Hardware Error from an Access in the Shadow of a Conditional Branch */
46#define ANOMALY_05000245 (1)
47/* Maximum External Clock Speed for Timers */
48#define ANOMALY_05000253 (1)
49/* DCPLB_FAULT_ADDR MMR register may be corrupted */
50#define ANOMALY_05000261 (__SILICON_REVISION__ < 3)
51/* High I/O Activity Causes Output Voltage of Internal Voltage Regulator (Vddint) to Decrease */
52#define ANOMALY_05000270 (__SILICON_REVISION__ < 4)
53/* Certain Data Cache Writethrough Modes Fail for Vddint <= 0.9V */
54#define ANOMALY_05000272 (1)
55/* Writes to Synchronous SDRAM Memory May Be Lost */
56#define ANOMALY_05000273 (__SILICON_REVISION__ < 4)
57/* Writes to an I/O Data Register One SCLK Cycle after an Edge Is Detected May Clear Interrupt */
58#define ANOMALY_05000277 (__SILICON_REVISION__ < 4)
59/* Disabling Peripherals with DMA Running May Cause DMA System Instability */
60#define ANOMALY_05000278 (__SILICON_REVISION__ < 4)
61/* False Hardware Error Exception when ISR Context Is Not Restored */
62#define ANOMALY_05000281 (__SILICON_REVISION__ < 4)
63/* Memory DMA Corruption with 32-Bit Data and Traffic Control */
64#define ANOMALY_05000282 (__SILICON_REVISION__ < 4)
65/* System MMR Write Is Stalled Indefinitely when Killed in a Particular Stage */
66#define ANOMALY_05000283 (__SILICON_REVISION__ < 4)
67/* SPORTs May Receive Bad Data If FIFOs Fill Up */
68#define ANOMALY_05000288 (__SILICON_REVISION__ < 4)
69/* Reads from CAN Mailbox and Acceptance Mask Area Can Fail */
70#define ANOMALY_05000291 (__SILICON_REVISION__ < 4)
71/* Hibernate Leakage Current Is Higher Than Specified */
72#define ANOMALY_05000293 (__SILICON_REVISION__ < 4)
73/* Timer Pin Limitations for PPI TX Modes with External Frame Syncs */
74#define ANOMALY_05000294 (1)
75/* Memory-To-Memory DMA Source/Destination Descriptors Must Be in Same Memory Space */
76#define ANOMALY_05000301 (__SILICON_REVISION__ < 4)
77/* SSYNCs After Writes To CAN/DMA MMR Registers Are Not Always Handled Correctly */
78#define ANOMALY_05000304 (__SILICON_REVISION__ < 4)
79/* SCKELOW Bit Does Not Maintain State Through Hibernate */
80#define ANOMALY_05000307 (__SILICON_REVISION__ < 4)
81/* False Hardware Errors Caused by Fetches at the Boundary of Reserved Memory */
82#define ANOMALY_05000310 (1)
83/* Errors when SSYNC, CSYNC, or Loads to LT, LB and LC Registers Are Interrupted */
84#define ANOMALY_05000312 (__SILICON_REVISION__ < 5)
85/* PPI Is Level-Sensitive on First Transfer */
86#define ANOMALY_05000313 (__SILICON_REVISION__ < 4)
87/* Killed System MMR Write Completes Erroneously on Next System MMR Access */
88#define ANOMALY_05000315 (__SILICON_REVISION__ < 4)
89/* PFx Glitch on Write to FIO_FLAG_D or FIO_FLAG_T */
90#define ANOMALY_05000318 (__SILICON_REVISION__ < 4)
91/* Regulator Programming Blocked when Hibernate Wakeup Source Remains Active */
92#define ANOMALY_05000355 (__SILICON_REVISION__ < 5)
93/* Serial Port (SPORT) Multichannel Transmit Failure when Channel 0 Is Disabled */
94#define ANOMALY_05000357 (__SILICON_REVISION__ < 5)
95/* PPI Underflow Error Goes Undetected in ITU-R 656 Mode */
96#define ANOMALY_05000366 (1)
97/* Possible RETS Register Corruption when Subroutine Is under 5 Cycles in Duration */
98#define ANOMALY_05000371 (__SILICON_REVISION__ < 5)
99/* Entering Hibernate State with Peripheral Wakeups Enabled Draws Excess Current */
100#define ANOMALY_05000374 (__SILICON_REVISION__ == 4)
101/* New Feature: Open-Drain GPIO Outputs on PC1 and PC4 (Not Available on Older Silicon) */
102#define ANOMALY_05000375 (__SILICON_REVISION__ < 4)
103/* SSYNC Stalls Processor when Executed from Non-Cacheable Memory */
104#define ANOMALY_05000402 (__SILICON_REVISION__ < 4)
105/* Level-Sensitive External GPIO Wakeups May Cause Indefinite Stall */
106#define ANOMALY_05000403 (1)
107/* Speculative Fetches Can Cause Undesired External FIFO Operations */
108#define ANOMALY_05000416 (1)
109/* Multichannel SPORT Channel Misalignment Under Specific Configuration */
110#define ANOMALY_05000425 (1)
111/* Speculative Fetches of Indirect-Pointer Instructions Can Cause False Hardware Errors */
112#define ANOMALY_05000426 (1)
113/* Specific GPIO Pins May Change State when Entering Hibernate */
114#define ANOMALY_05000436 (__SILICON_REVISION__ > 3)
115/* IFLUSH Instruction at End of Hardware Loop Causes Infinite Stall */
116#define ANOMALY_05000443 (1)
117
118/* Anomalies that don't exist on this proc */
119#define ANOMALY_05000158 (0)
120#define ANOMALY_05000198 (0)
121#define ANOMALY_05000230 (0)
122#define ANOMALY_05000263 (0)
123#define ANOMALY_05000311 (0)
124#define ANOMALY_05000323 (0)
125#define ANOMALY_05000353 (1)
126#define ANOMALY_05000363 (0)
127#define ANOMALY_05000386 (1)
128#define ANOMALY_05000412 (0)
129#define ANOMALY_05000432 (0)
130#define ANOMALY_05000435 (0)
131
132#endif
diff --git a/arch/blackfin/mach-bf538/include/mach/bf538.h b/arch/blackfin/mach-bf538/include/mach/bf538.h
new file mode 100644
index 000000000000..9c8abb307908
--- /dev/null
+++ b/arch/blackfin/mach-bf538/include/mach/bf538.h
@@ -0,0 +1,124 @@
1/*
2 * File: include/asm-blackfin/mach-bf538/bf538.h
3 * Based on: include/asm-blackfin/mach-bf537/bf537.h
4 * Author: Michael Hennerich (michael.hennerich@analog.com)
5 *
6 * Created:
7 * Description: SYSTEM MMR REGISTER AND MEMORY MAP FOR ADSP-BF527
8 *
9 * Modified:
10 * Copyright 2004-2007 Analog Devices Inc.
11 *
12 * Bugs: Enter bugs at http://blackfin.uclinux.org/
13 *
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 2 of the License, or
17 * (at your option) any later version.
18 *
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
23 *
24 * You should have received a copy of the GNU General Public License
25 * along with this program; if not, see the file COPYING, or write
26 * to the Free Software Foundation, Inc.,
27 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
28 */
29
30#ifndef __MACH_BF538_H__
31#define __MACH_BF538_H__
32
33#define OFFSET_(x) ((x) & 0x0000FFFF)
34
35/*some misc defines*/
36#define IMASK_IVG15 0x8000
37#define IMASK_IVG14 0x4000
38#define IMASK_IVG13 0x2000
39#define IMASK_IVG12 0x1000
40
41#define IMASK_IVG11 0x0800
42#define IMASK_IVG10 0x0400
43#define IMASK_IVG9 0x0200
44#define IMASK_IVG8 0x0100
45
46#define IMASK_IVG7 0x0080
47#define IMASK_IVGTMR 0x0040
48#define IMASK_IVGHW 0x0020
49
50/***************************/
51
52#define BFIN_DSUBBANKS 4
53#define BFIN_DWAYS 2
54#define BFIN_DLINES 64
55#define BFIN_ISUBBANKS 4
56#define BFIN_IWAYS 4
57#define BFIN_ILINES 32
58
59#define WAY0_L 0x1
60#define WAY1_L 0x2
61#define WAY01_L 0x3
62#define WAY2_L 0x4
63#define WAY02_L 0x5
64#define WAY12_L 0x6
65#define WAY012_L 0x7
66
67#define WAY3_L 0x8
68#define WAY03_L 0x9
69#define WAY13_L 0xA
70#define WAY013_L 0xB
71
72#define WAY32_L 0xC
73#define WAY320_L 0xD
74#define WAY321_L 0xE
75#define WAYALL_L 0xF
76
77#define DMC_ENABLE (2<<2) /*yes, 2, not 1 */
78
79/********************************* EBIU Settings ************************************/
80#define AMBCTL0VAL ((CONFIG_BANK_1 << 16) | CONFIG_BANK_0)
81#define AMBCTL1VAL ((CONFIG_BANK_3 << 16) | CONFIG_BANK_2)
82
83#ifdef CONFIG_C_AMBEN_ALL
84#define V_AMBEN AMBEN_ALL
85#endif
86#ifdef CONFIG_C_AMBEN
87#define V_AMBEN 0x0
88#endif
89#ifdef CONFIG_C_AMBEN_B0
90#define V_AMBEN AMBEN_B0
91#endif
92#ifdef CONFIG_C_AMBEN_B0_B1
93#define V_AMBEN AMBEN_B0_B1
94#endif
95#ifdef CONFIG_C_AMBEN_B0_B1_B2
96#define V_AMBEN AMBEN_B0_B1_B2
97#endif
98#ifdef CONFIG_C_AMCKEN
99#define V_AMCKEN AMCKEN
100#else
101#define V_AMCKEN 0x0
102#endif
103#ifdef CONFIG_C_CDPRIO
104#define V_CDPRIO 0x100
105#else
106#define V_CDPRIO 0x0
107#endif
108
109#define AMGCTLVAL (V_AMBEN | V_AMCKEN | V_CDPRIO)
110
111#ifdef CONFIG_BF538
112#define CPU "BF538"
113#define CPUID 0x27C4
114#endif
115#ifdef CONFIG_BF539
116#define CPU "BF539"
117#define CPUID 0x27C4 /* FXIME:? */
118#endif
119
120#ifndef CPU
121#error "Unknown CPU type - This kernel doesn't seem to be configured properly"
122#endif
123
124#endif /* __MACH_BF538_H__ */
diff --git a/arch/blackfin/mach-bf538/include/mach/bfin_serial_5xx.h b/arch/blackfin/mach-bf538/include/mach/bfin_serial_5xx.h
new file mode 100644
index 000000000000..40503b6b89a3
--- /dev/null
+++ b/arch/blackfin/mach-bf538/include/mach/bfin_serial_5xx.h
@@ -0,0 +1,183 @@
1/*
2 * file: include/asm-blackfin/mach-bf538/bfin_serial_5xx.h
3 * based on:
4 * author:
5 *
6 * created:
7 * description:
8 * blackfin serial driver header files
9 * rev:
10 *
11 * modified:
12 *
13 *
14 * bugs: enter bugs at http://blackfin.uclinux.org/
15 *
16 * this program is free software; you can redistribute it and/or modify
17 * it under the terms of the gnu general public license as published by
18 * the free software foundation; either version 2, or (at your option)
19 * any later version.
20 *
21 * this program is distributed in the hope that it will be useful,
22 * but without any warranty; without even the implied warranty of
23 * merchantability or fitness for a particular purpose. see the
24 * gnu general public license for more details.
25 *
26 * you should have received a copy of the gnu general public license
27 * along with this program; see the file copying.
28 * if not, write to the free software foundation,
29 * 59 temple place - suite 330, boston, ma 02111-1307, usa.
30 */
31
32#include <linux/serial.h>
33#include <asm/dma.h>
34#include <asm/portmux.h>
35
36#define UART_GET_CHAR(uart) bfin_read16(((uart)->port.membase + OFFSET_RBR))
37#define UART_GET_DLL(uart) bfin_read16(((uart)->port.membase + OFFSET_DLL))
38#define UART_GET_IER(uart) bfin_read16(((uart)->port.membase + OFFSET_IER))
39#define UART_GET_DLH(uart) bfin_read16(((uart)->port.membase + OFFSET_DLH))
40#define UART_GET_IIR(uart) bfin_read16(((uart)->port.membase + OFFSET_IIR))
41#define UART_GET_LCR(uart) bfin_read16(((uart)->port.membase + OFFSET_LCR))
42#define UART_GET_GCTL(uart) bfin_read16(((uart)->port.membase + OFFSET_GCTL))
43
44#define UART_PUT_CHAR(uart, v) bfin_write16(((uart)->port.membase + OFFSET_THR), v)
45#define UART_PUT_DLL(uart, v) bfin_write16(((uart)->port.membase + OFFSET_DLL), v)
46#define UART_PUT_IER(uart, v) bfin_write16(((uart)->port.membase + OFFSET_IER), v)
47#define UART_SET_IER(uart, v) UART_PUT_IER(uart, UART_GET_IER(uart) | (v))
48#define UART_CLEAR_IER(uart, v) UART_PUT_IER(uart, UART_GET_IER(uart) & ~(v))
49#define UART_PUT_DLH(uart, v) bfin_write16(((uart)->port.membase + OFFSET_DLH), v)
50#define UART_PUT_LCR(uart, v) bfin_write16(((uart)->port.membase + OFFSET_LCR), v)
51#define UART_PUT_GCTL(uart, v) bfin_write16(((uart)->port.membase + OFFSET_GCTL), v)
52
53#define UART_SET_DLAB(uart) do { UART_PUT_LCR(uart, UART_GET_LCR(uart) | DLAB); SSYNC(); } while (0)
54#define UART_CLEAR_DLAB(uart) do { UART_PUT_LCR(uart, UART_GET_LCR(uart) & ~DLAB); SSYNC(); } while (0)
55
56#define UART_GET_CTS(x) gpio_get_value(x->cts_pin)
57#define UART_SET_RTS(x) gpio_set_value(x->rts_pin, 1)
58#define UART_CLEAR_RTS(x) gpio_set_value(x->rts_pin, 0)
59#define UART_ENABLE_INTS(x, v) UART_PUT_IER(x, v)
60#define UART_DISABLE_INTS(x) UART_PUT_IER(x, 0)
61
62#if defined(CONFIG_BFIN_UART0_CTSRTS) || defined(CONFIG_BFIN_UART1_CTSRTS)
63# define CONFIG_SERIAL_BFIN_CTSRTS
64
65# ifndef CONFIG_UART0_CTS_PIN
66# define CONFIG_UART0_CTS_PIN -1
67# endif
68
69# ifndef CONFIG_UART0_RTS_PIN
70# define CONFIG_UART0_RTS_PIN -1
71# endif
72
73# ifndef CONFIG_UART1_CTS_PIN
74# define CONFIG_UART1_CTS_PIN -1
75# endif
76
77# ifndef CONFIG_UART1_RTS_PIN
78# define CONFIG_UART1_RTS_PIN -1
79# endif
80#endif
81
82#define BFIN_UART_TX_FIFO_SIZE 2
83
84/*
85 * The pin configuration is different from schematic
86 */
87struct bfin_serial_port {
88 struct uart_port port;
89 unsigned int old_status;
90 unsigned int lsr;
91#ifdef CONFIG_SERIAL_BFIN_DMA
92 int tx_done;
93 int tx_count;
94 struct circ_buf rx_dma_buf;
95 struct timer_list rx_dma_timer;
96 int rx_dma_nrows;
97 unsigned int tx_dma_channel;
98 unsigned int rx_dma_channel;
99 struct work_struct tx_dma_workqueue;
100#endif
101#ifdef CONFIG_SERIAL_BFIN_CTSRTS
102 struct timer_list cts_timer;
103 int cts_pin;
104 int rts_pin;
105#endif
106};
107
108/* The hardware clears the LSR bits upon read, so we need to cache
109 * some of the more fun bits in software so they don't get lost
110 * when checking the LSR in other code paths (TX).
111 */
112static inline unsigned int UART_GET_LSR(struct bfin_serial_port *uart)
113{
114 unsigned int lsr = bfin_read16(uart->port.membase + OFFSET_LSR);
115 uart->lsr |= (lsr & (BI|FE|PE|OE));
116 return lsr | uart->lsr;
117}
118
119static inline void UART_CLEAR_LSR(struct bfin_serial_port *uart)
120{
121 uart->lsr = 0;
122 bfin_write16(uart->port.membase + OFFSET_LSR, -1);
123}
124
125struct bfin_serial_res {
126 unsigned long uart_base_addr;
127 int uart_irq;
128#ifdef CONFIG_SERIAL_BFIN_DMA
129 unsigned int uart_tx_dma_channel;
130 unsigned int uart_rx_dma_channel;
131#endif
132#ifdef CONFIG_SERIAL_BFIN_CTSRTS
133 int uart_cts_pin;
134 int uart_rts_pin;
135#endif
136};
137
138struct bfin_serial_res bfin_serial_resource[] = {
139#ifdef CONFIG_SERIAL_BFIN_UART0
140 {
141 0xFFC00400,
142 IRQ_UART0_RX,
143#ifdef CONFIG_SERIAL_BFIN_DMA
144 CH_UART0_TX,
145 CH_UART0_RX,
146#endif
147#ifdef CONFIG_BFIN_UART0_CTSRTS
148 CONFIG_UART0_CTS_PIN,
149 CONFIG_UART0_RTS_PIN,
150#endif
151 },
152#endif
153#ifdef CONFIG_SERIAL_BFIN_UART1
154 {
155 0xFFC02000,
156 IRQ_UART1_RX,
157#ifdef CONFIG_SERIAL_BFIN_DMA
158 CH_UART1_TX,
159 CH_UART1_RX,
160#endif
161#ifdef CONFIG_BFIN_UART1_CTSRTS
162 CONFIG_UART1_CTS_PIN,
163 CONFIG_UART1_RTS_PIN,
164#endif
165 },
166#endif
167#ifdef CONFIG_SERIAL_BFIN_UART2
168 {
169 0xFFC02100,
170 IRQ_UART2_RX,
171#ifdef CONFIG_SERIAL_BFIN_DMA
172 CH_UART2_TX,
173 CH_UART2_RX,
174#endif
175#ifdef CONFIG_BFIN_UART2_CTSRTS
176 CONFIG_UART2_CTS_PIN,
177 CONFIG_UART2_RTS_PIN,
178#endif
179 },
180#endif
181};
182
183#define DRIVER_NAME "bfin-uart"
diff --git a/arch/blackfin/mach-bf538/include/mach/blackfin.h b/arch/blackfin/mach-bf538/include/mach/blackfin.h
new file mode 100644
index 000000000000..ea25371a922b
--- /dev/null
+++ b/arch/blackfin/mach-bf538/include/mach/blackfin.h
@@ -0,0 +1,101 @@
1/*
2 * File: include/asm-blackfin/mach-bf538/blackfin.h
3 * Based on:
4 * Author:
5 *
6 * Created:
7 * Description:
8 *
9 * Rev:
10 *
11 * Modified:
12 *
13 *
14 * Bugs: Enter bugs at http://blackfin.uclinux.org/
15 *
16 * This program is free software; you can redistribute it and/or modify
17 * it under the terms of the GNU General Public License as published by
18 * the Free Software Foundation; either version 2, or (at your option)
19 * any later version.
20 *
21 * This program is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 * GNU General Public License for more details.
25 *
26 * You should have received a copy of the GNU General Public License
27 * along with this program; see the file COPYING.
28 * If not, write to the Free Software Foundation,
29 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
30 */
31
32#ifndef _MACH_BLACKFIN_H_
33#define _MACH_BLACKFIN_H_
34
35#define BF538_FAMILY
36
37#include "bf538.h"
38#include "mem_map.h"
39#include "defBF539.h"
40#include "anomaly.h"
41
42
43#if !defined(__ASSEMBLY__)
44#include "cdefBF538.h"
45
46#if defined(CONFIG_BF539)
47#include "cdefBF539.h"
48#endif
49#endif
50
51/* UART_IIR Register */
52#define STATUS(x) ((x << 1) & 0x06)
53#define STATUS_P1 0x02
54#define STATUS_P0 0x01
55
56#define BFIN_UART_NR_PORTS 3
57
58#define OFFSET_THR 0x00 /* Transmit Holding register */
59#define OFFSET_RBR 0x00 /* Receive Buffer register */
60#define OFFSET_DLL 0x00 /* Divisor Latch (Low-Byte) */
61#define OFFSET_IER 0x04 /* Interrupt Enable Register */
62#define OFFSET_DLH 0x04 /* Divisor Latch (High-Byte) */
63#define OFFSET_IIR 0x08 /* Interrupt Identification Register */
64#define OFFSET_LCR 0x0C /* Line Control Register */
65#define OFFSET_MCR 0x10 /* Modem Control Register */
66#define OFFSET_LSR 0x14 /* Line Status Register */
67#define OFFSET_MSR 0x18 /* Modem Status Register */
68#define OFFSET_SCR 0x1C /* SCR Scratch Register */
69#define OFFSET_GCTL 0x24 /* Global Control Register */
70
71
72#define bfin_write_MDMA_D0_IRQ_STATUS bfin_write_MDMA0_D0_IRQ_STATUS
73#define bfin_write_MDMA_D0_START_ADDR bfin_write_MDMA0_D0_START_ADDR
74#define bfin_write_MDMA_S0_START_ADDR bfin_write_MDMA0_S0_START_ADDR
75#define bfin_write_MDMA_D0_X_COUNT bfin_write_MDMA0_D0_X_COUNT
76#define bfin_write_MDMA_S0_X_COUNT bfin_write_MDMA0_S0_X_COUNT
77#define bfin_write_MDMA_D0_Y_COUNT bfin_write_MDMA0_D0_Y_COUNT
78#define bfin_write_MDMA_S0_Y_COUNT bfin_write_MDMA0_S0_Y_COUNT
79#define bfin_write_MDMA_D0_X_MODIFY bfin_write_MDMA0_D0_X_MODIFY
80#define bfin_write_MDMA_S0_X_MODIFY bfin_write_MDMA0_S0_X_MODIFY
81#define bfin_write_MDMA_D0_Y_MODIFY bfin_write_MDMA0_D0_Y_MODIFY
82#define bfin_write_MDMA_S0_Y_MODIFY bfin_write_MDMA0_S0_Y_MODIFY
83#define bfin_write_MDMA_S0_CONFIG bfin_write_MDMA0_S0_CONFIG
84#define bfin_write_MDMA_D0_CONFIG bfin_write_MDMA0_D0_CONFIG
85#define bfin_read_MDMA_S0_CONFIG bfin_read_MDMA0_S0_CONFIG
86#define bfin_read_MDMA_D0_IRQ_STATUS bfin_read_MDMA0_D0_IRQ_STATUS
87#define bfin_write_MDMA_S0_IRQ_STATUS bfin_write_MDMA0_S0_IRQ_STATUS
88
89
90/* DPMC*/
91#define bfin_read_STOPCK_OFF() bfin_read_STOPCK()
92#define bfin_write_STOPCK_OFF(val) bfin_write_STOPCK(val)
93#define STOPCK_OFF STOPCK
94
95/* PLL_DIV Masks */
96#define CCLK_DIV1 CSEL_DIV1 /* CCLK = VCO / 1 */
97#define CCLK_DIV2 CSEL_DIV2 /* CCLK = VCO / 2 */
98#define CCLK_DIV4 CSEL_DIV4 /* CCLK = VCO / 4 */
99#define CCLK_DIV8 CSEL_DIV8 /* CCLK = VCO / 8 */
100
101#endif
diff --git a/arch/blackfin/mach-bf538/include/mach/cdefBF538.h b/arch/blackfin/mach-bf538/include/mach/cdefBF538.h
new file mode 100644
index 000000000000..241725bc6988
--- /dev/null
+++ b/arch/blackfin/mach-bf538/include/mach/cdefBF538.h
@@ -0,0 +1,2108 @@
1/*
2 * File: include/asm-blackfin/mach-bf538/cdefBF538.h
3 * Based on:
4 * Author:
5 *
6 * Created:
7 * Description:
8 *
9 * Rev:
10 *
11 * Modified:
12 *
13 * Bugs: Enter bugs at http://blackfin.uclinux.org/
14 *
15 * This program is free software; you can redistribute it and/or modify
16 * it under the terms of the GNU General Public License as published by
17 * the Free Software Foundation; either version 2, or (at your option)
18 * any later version.
19 *
20 * This program is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
24 *
25 * You should have received a copy of the GNU General Public License
26 * along with this program; see the file COPYING.
27 * If not, write to the Free Software Foundation,
28 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
29 */
30
31#ifndef _CDEF_BF538_H
32#define _CDEF_BF538_H
33
34#include <asm/blackfin.h>
35
36/*include all Core registers and bit definitions*/
37#include "defBF539.h"
38
39/*include core specific register pointer definitions*/
40#include <asm/cdef_LPBlackfin.h>
41
42#define bfin_writePTR(addr, val) bfin_write32(addr, val)
43
44#define bfin_read_PLL_CTL() bfin_read16(PLL_CTL)
45#define bfin_read_PLL_DIV() bfin_read16(PLL_DIV)
46#define bfin_write_PLL_DIV(val) bfin_write16(PLL_DIV, val)
47#define bfin_read_VR_CTL() bfin_read16(VR_CTL)
48#define bfin_read_PLL_STAT() bfin_read16(PLL_STAT)
49#define bfin_write_PLL_STAT(val) bfin_write16(PLL_STAT, val)
50#define bfin_read_PLL_LOCKCNT() bfin_read16(PLL_LOCKCNT)
51#define bfin_write_PLL_LOCKCNT(val) bfin_write16(PLL_LOCKCNT, val)
52#define bfin_read_CHIPID() bfin_read32(CHIPID)
53#define bfin_write_CHIPID(val) bfin_write32(CHIPID, val)
54#define bfin_read_SWRST() bfin_read16(SWRST)
55#define bfin_write_SWRST(val) bfin_write16(SWRST, val)
56#define bfin_read_SYSCR() bfin_read16(SYSCR)
57#define bfin_write_SYSCR(val) bfin_write16(SYSCR, val)
58#define bfin_read_SIC_RVECT() bfin_readPTR(SIC_RVECT)
59#define bfin_write_SIC_RVECT(val) bfin_writePTR(SIC_RVECT, val)
60#define bfin_read_SIC_IMASK0() bfin_read32(SIC_IMASK0)
61#define bfin_write_SIC_IMASK0(val) bfin_write32(SIC_IMASK0, val)
62#define bfin_read_SIC_IMASK1() bfin_read32(SIC_IMASK1)
63#define bfin_write_SIC_IMASK1(val) bfin_write32(SIC_IMASK1, val)
64#define bfin_read_SIC_IMASK(x) bfin_read32(SIC_IMASK0 + x * (SIC_IMASK1 - SIC_IMASK0))
65#define bfin_write_SIC_IMASK(x, val) bfin_write32(SIC_IMASK0 + x * (SIC_IMASK1 - SIC_IMASK0), val)
66#define bfin_read_SIC_ISR0() bfin_read32(SIC_ISR0)
67#define bfin_write_SIC_ISR0(val) bfin_write32(SIC_ISR0, val)
68#define bfin_read_SIC_ISR1() bfin_read32(SIC_ISR1)
69#define bfin_write_SIC_ISR1(val) bfin_write32(SIC_ISR1, val)
70#define bfin_read_SIC_ISR(x) bfin_read32(SIC_ISR0 + x * (SIC_ISR1 - SIC_ISR0))
71#define bfin_write_SIC_ISR(x, val) bfin_write32(SIC_ISR0 + x * (SIC_ISR1 - SIC_ISR0), val)
72#define bfin_read_SIC_IWR0() bfin_read32(SIC_IWR0)
73#define bfin_write_SIC_IWR0(val) bfin_write32(SIC_IWR0, val)
74#define bfin_read_SIC_IWR1() bfin_read32(SIC_IWR1)
75#define bfin_write_SIC_IWR1(val) bfin_write32(SIC_IWR1, val)
76#define bfin_read_SIC_IWR(x) bfin_read32(SIC_IWR0 + x * (SIC_IWR1 - SIC_IWR0))
77#define bfin_write_SIC_IWR(x, val) bfin_write32((SIC_IWR0 + x * (SIC_IWR1 - SIC_IWR0), val)
78#define bfin_read_SIC_IAR0() bfin_read32(SIC_IAR0)
79#define bfin_write_SIC_IAR0(val) bfin_write32(SIC_IAR0, val)
80#define bfin_read_SIC_IAR1() bfin_read32(SIC_IAR1)
81#define bfin_write_SIC_IAR1(val) bfin_write32(SIC_IAR1, val)
82#define bfin_read_SIC_IAR2() bfin_read32(SIC_IAR2)
83#define bfin_write_SIC_IAR2(val) bfin_write32(SIC_IAR2, val)
84#define bfin_read_SIC_IAR3() bfin_read32(SIC_IAR3)
85#define bfin_write_SIC_IAR3(val) bfin_write32(SIC_IAR3, val)
86#define bfin_read_SIC_IAR4() bfin_read32(SIC_IAR4)
87#define bfin_write_SIC_IAR4(val) bfin_write32(SIC_IAR4, val)
88#define bfin_read_SIC_IAR5() bfin_read32(SIC_IAR5)
89#define bfin_write_SIC_IAR5(val) bfin_write32(SIC_IAR5, val)
90#define bfin_read_SIC_IAR6() bfin_read32(SIC_IAR6)
91#define bfin_write_SIC_IAR6(val) bfin_write32(SIC_IAR6, val)
92#define bfin_read_WDOG_CTL() bfin_read16(WDOG_CTL)
93#define bfin_write_WDOG_CTL(val) bfin_write16(WDOG_CTL, val)
94#define bfin_read_WDOG_CNT() bfin_read32(WDOG_CNT)
95#define bfin_write_WDOG_CNT(val) bfin_write32(WDOG_CNT, val)
96#define bfin_read_WDOG_STAT() bfin_read32(WDOG_STAT)
97#define bfin_write_WDOG_STAT(val) bfin_write32(WDOG_STAT, val)
98#define bfin_read_RTC_STAT() bfin_read32(RTC_STAT)
99#define bfin_write_RTC_STAT(val) bfin_write32(RTC_STAT, val)
100#define bfin_read_RTC_ICTL() bfin_read16(RTC_ICTL)
101#define bfin_write_RTC_ICTL(val) bfin_write16(RTC_ICTL, val)
102#define bfin_read_RTC_ISTAT() bfin_read16(RTC_ISTAT)
103#define bfin_write_RTC_ISTAT(val) bfin_write16(RTC_ISTAT, val)
104#define bfin_read_RTC_SWCNT() bfin_read16(RTC_SWCNT)
105#define bfin_write_RTC_SWCNT(val) bfin_write16(RTC_SWCNT, val)
106#define bfin_read_RTC_ALARM() bfin_read32(RTC_ALARM)
107#define bfin_write_RTC_ALARM(val) bfin_write32(RTC_ALARM, val)
108#define bfin_read_RTC_PREN() bfin_read16(RTC_PREN)
109#define bfin_write_RTC_PREN(val) bfin_write16(RTC_PREN, val)
110#define bfin_read_UART0_THR() bfin_read16(UART0_THR)
111#define bfin_write_UART0_THR(val) bfin_write16(UART0_THR, val)
112#define bfin_read_UART0_RBR() bfin_read16(UART0_RBR)
113#define bfin_write_UART0_RBR(val) bfin_write16(UART0_RBR, val)
114#define bfin_read_UART0_DLL() bfin_read16(UART0_DLL)
115#define bfin_write_UART0_DLL(val) bfin_write16(UART0_DLL, val)
116#define bfin_read_UART0_DLH() bfin_read16(UART0_DLH)
117#define bfin_write_UART0_DLH(val) bfin_write16(UART0_DLH, val)
118#define bfin_read_UART0_IER() bfin_read16(UART0_IER)
119#define bfin_write_UART0_IER(val) bfin_write16(UART0_IER, val)
120#define bfin_read_UART0_IIR() bfin_read16(UART0_IIR)
121#define bfin_write_UART0_IIR(val) bfin_write16(UART0_IIR, val)
122#define bfin_read_UART0_LCR() bfin_read16(UART0_LCR)
123#define bfin_write_UART0_LCR(val) bfin_write16(UART0_LCR, val)
124#define bfin_read_UART0_MCR() bfin_read16(UART0_MCR)
125#define bfin_write_UART0_MCR(val) bfin_write16(UART0_MCR, val)
126#define bfin_read_UART0_LSR() bfin_read16(UART0_LSR)
127#define bfin_write_UART0_LSR(val) bfin_write16(UART0_LSR, val)
128#define bfin_read_UART0_SCR() bfin_read16(UART0_SCR)
129#define bfin_write_UART0_SCR(val) bfin_write16(UART0_SCR, val)
130#define bfin_read_UART0_GCTL() bfin_read16(UART0_GCTL)
131#define bfin_write_UART0_GCTL(val) bfin_write16(UART0_GCTL, val)
132#define bfin_read_UART1_THR() bfin_read16(UART1_THR)
133#define bfin_write_UART1_THR(val) bfin_write16(UART1_THR, val)
134#define bfin_read_UART1_RBR() bfin_read16(UART1_RBR)
135#define bfin_write_UART1_RBR(val) bfin_write16(UART1_RBR, val)
136#define bfin_read_UART1_DLL() bfin_read16(UART1_DLL)
137#define bfin_write_UART1_DLL(val) bfin_write16(UART1_DLL, val)
138#define bfin_read_UART1_DLH() bfin_read16(UART1_DLH)
139#define bfin_write_UART1_DLH(val) bfin_write16(UART1_DLH, val)
140#define bfin_read_UART1_IER() bfin_read16(UART1_IER)
141#define bfin_write_UART1_IER(val) bfin_write16(UART1_IER, val)
142#define bfin_read_UART1_IIR() bfin_read16(UART1_IIR)
143#define bfin_write_UART1_IIR(val) bfin_write16(UART1_IIR, val)
144#define bfin_read_UART1_LCR() bfin_read16(UART1_LCR)
145#define bfin_write_UART1_LCR(val) bfin_write16(UART1_LCR, val)
146#define bfin_read_UART1_MCR() bfin_read16(UART1_MCR)
147#define bfin_write_UART1_MCR(val) bfin_write16(UART1_MCR, val)
148#define bfin_read_UART1_LSR() bfin_read16(UART1_LSR)
149#define bfin_write_UART1_LSR(val) bfin_write16(UART1_LSR, val)
150#define bfin_read_UART1_SCR() bfin_read16(UART1_SCR)
151#define bfin_write_UART1_SCR(val) bfin_write16(UART1_SCR, val)
152#define bfin_read_UART1_GCTL() bfin_read16(UART1_GCTL)
153#define bfin_write_UART1_GCTL(val) bfin_write16(UART1_GCTL, val)
154#define bfin_read_UART2_THR() bfin_read16(UART2_THR)
155#define bfin_write_UART2_THR(val) bfin_write16(UART2_THR, val)
156#define bfin_read_UART2_RBR() bfin_read16(UART2_RBR)
157#define bfin_write_UART2_RBR(val) bfin_write16(UART2_RBR, val)
158#define bfin_read_UART2_DLL() bfin_read16(UART2_DLL)
159#define bfin_write_UART2_DLL(val) bfin_write16(UART2_DLL, val)
160#define bfin_read_UART2_DLH() bfin_read16(UART2_DLH)
161#define bfin_write_UART2_DLH(val) bfin_write16(UART2_DLH, val)
162#define bfin_read_UART2_IER() bfin_read16(UART2_IER)
163#define bfin_write_UART2_IER(val) bfin_write16(UART2_IER, val)
164#define bfin_read_UART2_IIR() bfin_read16(UART2_IIR)
165#define bfin_write_UART2_IIR(val) bfin_write16(UART2_IIR, val)
166#define bfin_read_UART2_LCR() bfin_read16(UART2_LCR)
167#define bfin_write_UART2_LCR(val) bfin_write16(UART2_LCR, val)
168#define bfin_read_UART2_MCR() bfin_read16(UART2_MCR)
169#define bfin_write_UART2_MCR(val) bfin_write16(UART2_MCR, val)
170#define bfin_read_UART2_LSR() bfin_read16(UART2_LSR)
171#define bfin_write_UART2_LSR(val) bfin_write16(UART2_LSR, val)
172#define bfin_read_UART2_SCR() bfin_read16(UART2_SCR)
173#define bfin_write_UART2_SCR(val) bfin_write16(UART2_SCR, val)
174#define bfin_read_UART2_GCTL() bfin_read16(UART2_GCTL)
175#define bfin_write_UART2_GCTL(val) bfin_write16(UART2_GCTL, val)
176#define bfin_read_SPI0_CTL() bfin_read16(SPI0_CTL)
177#define bfin_write_SPI0_CTL(val) bfin_write16(SPI0_CTL, val)
178#define bfin_read_SPI0_FLG() bfin_read16(SPI0_FLG)
179#define bfin_write_SPI0_FLG(val) bfin_write16(SPI0_FLG, val)
180#define bfin_read_SPI0_STAT() bfin_read16(SPI0_STAT)
181#define bfin_write_SPI0_STAT(val) bfin_write16(SPI0_STAT, val)
182#define bfin_read_SPI0_TDBR() bfin_read16(SPI0_TDBR)
183#define bfin_write_SPI0_TDBR(val) bfin_write16(SPI0_TDBR, val)
184#define bfin_read_SPI0_RDBR() bfin_read16(SPI0_RDBR)
185#define bfin_write_SPI0_RDBR(val) bfin_write16(SPI0_RDBR, val)
186#define bfin_read_SPI0_BAUD() bfin_read16(SPI0_BAUD)
187#define bfin_write_SPI0_BAUD(val) bfin_write16(SPI0_BAUD, val)
188#define bfin_read_SPI0_SHADOW() bfin_read16(SPI0_SHADOW)
189#define bfin_write_SPI0_SHADOW(val) bfin_write16(SPI0_SHADOW, val)
190#define bfin_read_SPI1_CTL() bfin_read16(SPI1_CTL)
191#define bfin_write_SPI1_CTL(val) bfin_write16(SPI1_CTL, val)
192#define bfin_read_SPI1_FLG() bfin_read16(SPI1_FLG)
193#define bfin_write_SPI1_FLG(val) bfin_write16(SPI1_FLG, val)
194#define bfin_read_SPI1_STAT() bfin_read16(SPI1_STAT)
195#define bfin_write_SPI1_STAT(val) bfin_write16(SPI1_STAT, val)
196#define bfin_read_SPI1_TDBR() bfin_read16(SPI1_TDBR)
197#define bfin_write_SPI1_TDBR(val) bfin_write16(SPI1_TDBR, val)
198#define bfin_read_SPI1_RDBR() bfin_read16(SPI1_RDBR)
199#define bfin_write_SPI1_RDBR(val) bfin_write16(SPI1_RDBR, val)
200#define bfin_read_SPI1_BAUD() bfin_read16(SPI1_BAUD)
201#define bfin_write_SPI1_BAUD(val) bfin_write16(SPI1_BAUD, val)
202#define bfin_read_SPI1_SHADOW() bfin_read16(SPI1_SHADOW)
203#define bfin_write_SPI1_SHADOW(val) bfin_write16(SPI1_SHADOW, val)
204#define bfin_read_SPI2_CTL() bfin_read16(SPI2_CTL)
205#define bfin_write_SPI2_CTL(val) bfin_write16(SPI2_CTL, val)
206#define bfin_read_SPI2_FLG() bfin_read16(SPI2_FLG)
207#define bfin_write_SPI2_FLG(val) bfin_write16(SPI2_FLG, val)
208#define bfin_read_SPI2_STAT() bfin_read16(SPI2_STAT)
209#define bfin_write_SPI2_STAT(val) bfin_write16(SPI2_STAT, val)
210#define bfin_read_SPI2_TDBR() bfin_read16(SPI2_TDBR)
211#define bfin_write_SPI2_TDBR(val) bfin_write16(SPI2_TDBR, val)
212#define bfin_read_SPI2_RDBR() bfin_read16(SPI2_RDBR)
213#define bfin_write_SPI2_RDBR(val) bfin_write16(SPI2_RDBR, val)
214#define bfin_read_SPI2_BAUD() bfin_read16(SPI2_BAUD)
215#define bfin_write_SPI2_BAUD(val) bfin_write16(SPI2_BAUD, val)
216#define bfin_read_SPI2_SHADOW() bfin_read16(SPI2_SHADOW)
217#define bfin_write_SPI2_SHADOW(val) bfin_write16(SPI2_SHADOW, val)
218#define bfin_read_TIMER0_CONFIG() bfin_read16(TIMER0_CONFIG)
219#define bfin_write_TIMER0_CONFIG(val) bfin_write16(TIMER0_CONFIG, val)
220#define bfin_read_TIMER0_COUNTER() bfin_read32(TIMER0_COUNTER)
221#define bfin_write_TIMER0_COUNTER(val) bfin_write32(TIMER0_COUNTER, val)
222#define bfin_read_TIMER0_PERIOD() bfin_read32(TIMER0_PERIOD)
223#define bfin_write_TIMER0_PERIOD(val) bfin_write32(TIMER0_PERIOD, val)
224#define bfin_read_TIMER0_WIDTH() bfin_read32(TIMER0_WIDTH)
225#define bfin_write_TIMER0_WIDTH(val) bfin_write32(TIMER0_WIDTH, val)
226#define bfin_read_TIMER1_CONFIG() bfin_read16(TIMER1_CONFIG)
227#define bfin_write_TIMER1_CONFIG(val) bfin_write16(TIMER1_CONFIG, val)
228#define bfin_read_TIMER1_COUNTER() bfin_read32(TIMER1_COUNTER)
229#define bfin_write_TIMER1_COUNTER(val) bfin_write32(TIMER1_COUNTER, val)
230#define bfin_read_TIMER1_PERIOD() bfin_read32(TIMER1_PERIOD)
231#define bfin_write_TIMER1_PERIOD(val) bfin_write32(TIMER1_PERIOD, val)
232#define bfin_read_TIMER1_WIDTH() bfin_read32(TIMER1_WIDTH)
233#define bfin_write_TIMER1_WIDTH(val) bfin_write32(TIMER1_WIDTH, val)
234#define bfin_read_TIMER2_CONFIG() bfin_read16(TIMER2_CONFIG)
235#define bfin_write_TIMER2_CONFIG(val) bfin_write16(TIMER2_CONFIG, val)
236#define bfin_read_TIMER2_COUNTER() bfin_read32(TIMER2_COUNTER)
237#define bfin_write_TIMER2_COUNTER(val) bfin_write32(TIMER2_COUNTER, val)
238#define bfin_read_TIMER2_PERIOD() bfin_read32(TIMER2_PERIOD)
239#define bfin_write_TIMER2_PERIOD(val) bfin_write32(TIMER2_PERIOD, val)
240#define bfin_read_TIMER2_WIDTH() bfin_read32(TIMER2_WIDTH)
241#define bfin_write_TIMER2_WIDTH(val) bfin_write32(TIMER2_WIDTH, val)
242#define bfin_read_TIMER_ENABLE() bfin_read16(TIMER_ENABLE)
243#define bfin_write_TIMER_ENABLE(val) bfin_write16(TIMER_ENABLE, val)
244#define bfin_read_TIMER_DISABLE() bfin_read16(TIMER_DISABLE)
245#define bfin_write_TIMER_DISABLE(val) bfin_write16(TIMER_DISABLE, val)
246#define bfin_read_TIMER_STATUS() bfin_read16(TIMER_STATUS)
247#define bfin_write_TIMER_STATUS(val) bfin_write16(TIMER_STATUS, val)
248#define bfin_read_SPORT0_TCR1() bfin_read16(SPORT0_TCR1)
249#define bfin_write_SPORT0_TCR1(val) bfin_write16(SPORT0_TCR1, val)
250#define bfin_read_SPORT0_TCR2() bfin_read16(SPORT0_TCR2)
251#define bfin_write_SPORT0_TCR2(val) bfin_write16(SPORT0_TCR2, val)
252#define bfin_read_SPORT0_TCLKDIV() bfin_read16(SPORT0_TCLKDIV)
253#define bfin_write_SPORT0_TCLKDIV(val) bfin_write16(SPORT0_TCLKDIV, val)
254#define bfin_read_SPORT0_TFSDIV() bfin_read16(SPORT0_TFSDIV)
255#define bfin_write_SPORT0_TFSDIV(val) bfin_write16(SPORT0_TFSDIV, val)
256#define bfin_read_SPORT0_TX() bfin_read32(SPORT0_TX)
257#define bfin_write_SPORT0_TX(val) bfin_write32(SPORT0_TX, val)
258#define bfin_read_SPORT0_RX() bfin_read32(SPORT0_RX)
259#define bfin_write_SPORT0_RX(val) bfin_write32(SPORT0_RX, val)
260#define bfin_read_SPORT0_RCR1() bfin_read16(SPORT0_RCR1)
261#define bfin_write_SPORT0_RCR1(val) bfin_write16(SPORT0_RCR1, val)
262#define bfin_read_SPORT0_RCR2() bfin_read16(SPORT0_RCR2)
263#define bfin_write_SPORT0_RCR2(val) bfin_write16(SPORT0_RCR2, val)
264#define bfin_read_SPORT0_RCLKDIV() bfin_read16(SPORT0_RCLKDIV)
265#define bfin_write_SPORT0_RCLKDIV(val) bfin_write16(SPORT0_RCLKDIV, val)
266#define bfin_read_SPORT0_RFSDIV() bfin_read16(SPORT0_RFSDIV)
267#define bfin_write_SPORT0_RFSDIV(val) bfin_write16(SPORT0_RFSDIV, val)
268#define bfin_read_SPORT0_STAT() bfin_read16(SPORT0_STAT)
269#define bfin_write_SPORT0_STAT(val) bfin_write16(SPORT0_STAT, val)
270#define bfin_read_SPORT0_CHNL() bfin_read16(SPORT0_CHNL)
271#define bfin_write_SPORT0_CHNL(val) bfin_write16(SPORT0_CHNL, val)
272#define bfin_read_SPORT0_MCMC1() bfin_read16(SPORT0_MCMC1)
273#define bfin_write_SPORT0_MCMC1(val) bfin_write16(SPORT0_MCMC1, val)
274#define bfin_read_SPORT0_MCMC2() bfin_read16(SPORT0_MCMC2)
275#define bfin_write_SPORT0_MCMC2(val) bfin_write16(SPORT0_MCMC2, val)
276#define bfin_read_SPORT0_MTCS0() bfin_read32(SPORT0_MTCS0)
277#define bfin_write_SPORT0_MTCS0(val) bfin_write32(SPORT0_MTCS0, val)
278#define bfin_read_SPORT0_MTCS1() bfin_read32(SPORT0_MTCS1)
279#define bfin_write_SPORT0_MTCS1(val) bfin_write32(SPORT0_MTCS1, val)
280#define bfin_read_SPORT0_MTCS2() bfin_read32(SPORT0_MTCS2)
281#define bfin_write_SPORT0_MTCS2(val) bfin_write32(SPORT0_MTCS2, val)
282#define bfin_read_SPORT0_MTCS3() bfin_read32(SPORT0_MTCS3)
283#define bfin_write_SPORT0_MTCS3(val) bfin_write32(SPORT0_MTCS3, val)
284#define bfin_read_SPORT0_MRCS0() bfin_read32(SPORT0_MRCS0)
285#define bfin_write_SPORT0_MRCS0(val) bfin_write32(SPORT0_MRCS0, val)
286#define bfin_read_SPORT0_MRCS1() bfin_read32(SPORT0_MRCS1)
287#define bfin_write_SPORT0_MRCS1(val) bfin_write32(SPORT0_MRCS1, val)
288#define bfin_read_SPORT0_MRCS2() bfin_read32(SPORT0_MRCS2)
289#define bfin_write_SPORT0_MRCS2(val) bfin_write32(SPORT0_MRCS2, val)
290#define bfin_read_SPORT0_MRCS3() bfin_read32(SPORT0_MRCS3)
291#define bfin_write_SPORT0_MRCS3(val) bfin_write32(SPORT0_MRCS3, val)
292#define bfin_read_SPORT1_TCR1() bfin_read16(SPORT1_TCR1)
293#define bfin_write_SPORT1_TCR1(val) bfin_write16(SPORT1_TCR1, val)
294#define bfin_read_SPORT1_TCR2() bfin_read16(SPORT1_TCR2)
295#define bfin_write_SPORT1_TCR2(val) bfin_write16(SPORT1_TCR2, val)
296#define bfin_read_SPORT1_TCLKDIV() bfin_read16(SPORT1_TCLKDIV)
297#define bfin_write_SPORT1_TCLKDIV(val) bfin_write16(SPORT1_TCLKDIV, val)
298#define bfin_read_SPORT1_TFSDIV() bfin_read16(SPORT1_TFSDIV)
299#define bfin_write_SPORT1_TFSDIV(val) bfin_write16(SPORT1_TFSDIV, val)
300#define bfin_read_SPORT1_TX() bfin_read32(SPORT1_TX)
301#define bfin_write_SPORT1_TX(val) bfin_write32(SPORT1_TX, val)
302#define bfin_read_SPORT1_RX() bfin_read32(SPORT1_RX)
303#define bfin_write_SPORT1_RX(val) bfin_write32(SPORT1_RX, val)
304#define bfin_read_SPORT1_RCR1() bfin_read16(SPORT1_RCR1)
305#define bfin_write_SPORT1_RCR1(val) bfin_write16(SPORT1_RCR1, val)
306#define bfin_read_SPORT1_RCR2() bfin_read16(SPORT1_RCR2)
307#define bfin_write_SPORT1_RCR2(val) bfin_write16(SPORT1_RCR2, val)
308#define bfin_read_SPORT1_RCLKDIV() bfin_read16(SPORT1_RCLKDIV)
309#define bfin_write_SPORT1_RCLKDIV(val) bfin_write16(SPORT1_RCLKDIV, val)
310#define bfin_read_SPORT1_RFSDIV() bfin_read16(SPORT1_RFSDIV)
311#define bfin_write_SPORT1_RFSDIV(val) bfin_write16(SPORT1_RFSDIV, val)
312#define bfin_read_SPORT1_STAT() bfin_read16(SPORT1_STAT)
313#define bfin_write_SPORT1_STAT(val) bfin_write16(SPORT1_STAT, val)
314#define bfin_read_SPORT1_CHNL() bfin_read16(SPORT1_CHNL)
315#define bfin_write_SPORT1_CHNL(val) bfin_write16(SPORT1_CHNL, val)
316#define bfin_read_SPORT1_MCMC1() bfin_read16(SPORT1_MCMC1)
317#define bfin_write_SPORT1_MCMC1(val) bfin_write16(SPORT1_MCMC1, val)
318#define bfin_read_SPORT1_MCMC2() bfin_read16(SPORT1_MCMC2)
319#define bfin_write_SPORT1_MCMC2(val) bfin_write16(SPORT1_MCMC2, val)
320#define bfin_read_SPORT1_MTCS0() bfin_read32(SPORT1_MTCS0)
321#define bfin_write_SPORT1_MTCS0(val) bfin_write32(SPORT1_MTCS0, val)
322#define bfin_read_SPORT1_MTCS1() bfin_read32(SPORT1_MTCS1)
323#define bfin_write_SPORT1_MTCS1(val) bfin_write32(SPORT1_MTCS1, val)
324#define bfin_read_SPORT1_MTCS2() bfin_read32(SPORT1_MTCS2)
325#define bfin_write_SPORT1_MTCS2(val) bfin_write32(SPORT1_MTCS2, val)
326#define bfin_read_SPORT1_MTCS3() bfin_read32(SPORT1_MTCS3)
327#define bfin_write_SPORT1_MTCS3(val) bfin_write32(SPORT1_MTCS3, val)
328#define bfin_read_SPORT1_MRCS0() bfin_read32(SPORT1_MRCS0)
329#define bfin_write_SPORT1_MRCS0(val) bfin_write32(SPORT1_MRCS0, val)
330#define bfin_read_SPORT1_MRCS1() bfin_read32(SPORT1_MRCS1)
331#define bfin_write_SPORT1_MRCS1(val) bfin_write32(SPORT1_MRCS1, val)
332#define bfin_read_SPORT1_MRCS2() bfin_read32(SPORT1_MRCS2)
333#define bfin_write_SPORT1_MRCS2(val) bfin_write32(SPORT1_MRCS2, val)
334#define bfin_read_SPORT1_MRCS3() bfin_read32(SPORT1_MRCS3)
335#define bfin_write_SPORT1_MRCS3(val) bfin_write32(SPORT1_MRCS3, val)
336#define bfin_read_SPORT2_TCR1() bfin_read16(SPORT2_TCR1)
337#define bfin_write_SPORT2_TCR1(val) bfin_write16(SPORT2_TCR1, val)
338#define bfin_read_SPORT2_TCR2() bfin_read16(SPORT2_TCR2)
339#define bfin_write_SPORT2_TCR2(val) bfin_write16(SPORT2_TCR2, val)
340#define bfin_read_SPORT2_TCLKDIV() bfin_read16(SPORT2_TCLKDIV)
341#define bfin_write_SPORT2_TCLKDIV(val) bfin_write16(SPORT2_TCLKDIV, val)
342#define bfin_read_SPORT2_TFSDIV() bfin_read16(SPORT2_TFSDIV)
343#define bfin_write_SPORT2_TFSDIV(val) bfin_write16(SPORT2_TFSDIV, val)
344#define bfin_read_SPORT2_TX() bfin_read32(SPORT2_TX)
345#define bfin_write_SPORT2_TX(val) bfin_write32(SPORT2_TX, val)
346#define bfin_read_SPORT2_RX() bfin_read32(SPORT2_RX)
347#define bfin_write_SPORT2_RX(val) bfin_write32(SPORT2_RX, val)
348#define bfin_read_SPORT2_RCR1() bfin_read16(SPORT2_RCR1)
349#define bfin_write_SPORT2_RCR1(val) bfin_write16(SPORT2_RCR1, val)
350#define bfin_read_SPORT2_RCR2() bfin_read16(SPORT2_RCR2)
351#define bfin_write_SPORT2_RCR2(val) bfin_write16(SPORT2_RCR2, val)
352#define bfin_read_SPORT2_RCLKDIV() bfin_read16(SPORT2_RCLKDIV)
353#define bfin_write_SPORT2_RCLKDIV(val) bfin_write16(SPORT2_RCLKDIV, val)
354#define bfin_read_SPORT2_RFSDIV() bfin_read16(SPORT2_RFSDIV)
355#define bfin_write_SPORT2_RFSDIV(val) bfin_write16(SPORT2_RFSDIV, val)
356#define bfin_read_SPORT2_STAT() bfin_read16(SPORT2_STAT)
357#define bfin_write_SPORT2_STAT(val) bfin_write16(SPORT2_STAT, val)
358#define bfin_read_SPORT2_CHNL() bfin_read16(SPORT2_CHNL)
359#define bfin_write_SPORT2_CHNL(val) bfin_write16(SPORT2_CHNL, val)
360#define bfin_read_SPORT2_MCMC1() bfin_read16(SPORT2_MCMC1)
361#define bfin_write_SPORT2_MCMC1(val) bfin_write16(SPORT2_MCMC1, val)
362#define bfin_read_SPORT2_MCMC2() bfin_read16(SPORT2_MCMC2)
363#define bfin_write_SPORT2_MCMC2(val) bfin_write16(SPORT2_MCMC2, val)
364#define bfin_read_SPORT2_MTCS0() bfin_read32(SPORT2_MTCS0)
365#define bfin_write_SPORT2_MTCS0(val) bfin_write32(SPORT2_MTCS0, val)
366#define bfin_read_SPORT2_MTCS1() bfin_read32(SPORT2_MTCS1)
367#define bfin_write_SPORT2_MTCS1(val) bfin_write32(SPORT2_MTCS1, val)
368#define bfin_read_SPORT2_MTCS2() bfin_read32(SPORT2_MTCS2)
369#define bfin_write_SPORT2_MTCS2(val) bfin_write32(SPORT2_MTCS2, val)
370#define bfin_read_SPORT2_MTCS3() bfin_read32(SPORT2_MTCS3)
371#define bfin_write_SPORT2_MTCS3(val) bfin_write32(SPORT2_MTCS3, val)
372#define bfin_read_SPORT2_MRCS0() bfin_read32(SPORT2_MRCS0)
373#define bfin_write_SPORT2_MRCS0(val) bfin_write32(SPORT2_MRCS0, val)
374#define bfin_read_SPORT2_MRCS1() bfin_read32(SPORT2_MRCS1)
375#define bfin_write_SPORT2_MRCS1(val) bfin_write32(SPORT2_MRCS1, val)
376#define bfin_read_SPORT2_MRCS2() bfin_read32(SPORT2_MRCS2)
377#define bfin_write_SPORT2_MRCS2(val) bfin_write32(SPORT2_MRCS2, val)
378#define bfin_read_SPORT2_MRCS3() bfin_read32(SPORT2_MRCS3)
379#define bfin_write_SPORT2_MRCS3(val) bfin_write32(SPORT2_MRCS3, val)
380#define bfin_read_SPORT3_TCR1() bfin_read16(SPORT3_TCR1)
381#define bfin_write_SPORT3_TCR1(val) bfin_write16(SPORT3_TCR1, val)
382#define bfin_read_SPORT3_TCR2() bfin_read16(SPORT3_TCR2)
383#define bfin_write_SPORT3_TCR2(val) bfin_write16(SPORT3_TCR2, val)
384#define bfin_read_SPORT3_TCLKDIV() bfin_read16(SPORT3_TCLKDIV)
385#define bfin_write_SPORT3_TCLKDIV(val) bfin_write16(SPORT3_TCLKDIV, val)
386#define bfin_read_SPORT3_TFSDIV() bfin_read16(SPORT3_TFSDIV)
387#define bfin_write_SPORT3_TFSDIV(val) bfin_write16(SPORT3_TFSDIV, val)
388#define bfin_read_SPORT3_TX() bfin_read32(SPORT3_TX)
389#define bfin_write_SPORT3_TX(val) bfin_write32(SPORT3_TX, val)
390#define bfin_read_SPORT3_RX() bfin_read32(SPORT3_RX)
391#define bfin_write_SPORT3_RX(val) bfin_write32(SPORT3_RX, val)
392#define bfin_read_SPORT3_RCR1() bfin_read16(SPORT3_RCR1)
393#define bfin_write_SPORT3_RCR1(val) bfin_write16(SPORT3_RCR1, val)
394#define bfin_read_SPORT3_RCR2() bfin_read16(SPORT3_RCR2)
395#define bfin_write_SPORT3_RCR2(val) bfin_write16(SPORT3_RCR2, val)
396#define bfin_read_SPORT3_RCLKDIV() bfin_read16(SPORT3_RCLKDIV)
397#define bfin_write_SPORT3_RCLKDIV(val) bfin_write16(SPORT3_RCLKDIV, val)
398#define bfin_read_SPORT3_RFSDIV() bfin_read16(SPORT3_RFSDIV)
399#define bfin_write_SPORT3_RFSDIV(val) bfin_write16(SPORT3_RFSDIV, val)
400#define bfin_read_SPORT3_STAT() bfin_read16(SPORT3_STAT)
401#define bfin_write_SPORT3_STAT(val) bfin_write16(SPORT3_STAT, val)
402#define bfin_read_SPORT3_CHNL() bfin_read16(SPORT3_CHNL)
403#define bfin_write_SPORT3_CHNL(val) bfin_write16(SPORT3_CHNL, val)
404#define bfin_read_SPORT3_MCMC1() bfin_read16(SPORT3_MCMC1)
405#define bfin_write_SPORT3_MCMC1(val) bfin_write16(SPORT3_MCMC1, val)
406#define bfin_read_SPORT3_MCMC2() bfin_read16(SPORT3_MCMC2)
407#define bfin_write_SPORT3_MCMC2(val) bfin_write16(SPORT3_MCMC2, val)
408#define bfin_read_SPORT3_MTCS0() bfin_read32(SPORT3_MTCS0)
409#define bfin_write_SPORT3_MTCS0(val) bfin_write32(SPORT3_MTCS0, val)
410#define bfin_read_SPORT3_MTCS1() bfin_read32(SPORT3_MTCS1)
411#define bfin_write_SPORT3_MTCS1(val) bfin_write32(SPORT3_MTCS1, val)
412#define bfin_read_SPORT3_MTCS2() bfin_read32(SPORT3_MTCS2)
413#define bfin_write_SPORT3_MTCS2(val) bfin_write32(SPORT3_MTCS2, val)
414#define bfin_read_SPORT3_MTCS3() bfin_read32(SPORT3_MTCS3)
415#define bfin_write_SPORT3_MTCS3(val) bfin_write32(SPORT3_MTCS3, val)
416#define bfin_read_SPORT3_MRCS0() bfin_read32(SPORT3_MRCS0)
417#define bfin_write_SPORT3_MRCS0(val) bfin_write32(SPORT3_MRCS0, val)
418#define bfin_read_SPORT3_MRCS1() bfin_read32(SPORT3_MRCS1)
419#define bfin_write_SPORT3_MRCS1(val) bfin_write32(SPORT3_MRCS1, val)
420#define bfin_read_SPORT3_MRCS2() bfin_read32(SPORT3_MRCS2)
421#define bfin_write_SPORT3_MRCS2(val) bfin_write32(SPORT3_MRCS2, val)
422#define bfin_read_SPORT3_MRCS3() bfin_read32(SPORT3_MRCS3)
423#define bfin_write_SPORT3_MRCS3(val) bfin_write32(SPORT3_MRCS3, val)
424#define bfin_read_PORTFIO() bfin_read16(PORTFIO)
425#define bfin_write_PORTFIO(val) bfin_write16(PORTFIO, val)
426#define bfin_read_PORTFIO_CLEAR() bfin_read16(PORTFIO_CLEAR)
427#define bfin_write_PORTFIO_CLEAR(val) bfin_write16(PORTFIO_CLEAR, val)
428#define bfin_read_PORTFIO_SET() bfin_read16(PORTFIO_SET)
429#define bfin_write_PORTFIO_SET(val) bfin_write16(PORTFIO_SET, val)
430#define bfin_read_PORTFIO_TOGGLE() bfin_read16(PORTFIO_TOGGLE)
431#define bfin_write_PORTFIO_TOGGLE(val) bfin_write16(PORTFIO_TOGGLE, val)
432#define bfin_read_PORTFIO_MASKA() bfin_read16(PORTFIO_MASKA)
433#define bfin_write_PORTFIO_MASKA(val) bfin_write16(PORTFIO_MASKA, val)
434#define bfin_read_PORTFIO_MASKA_CLEAR() bfin_read16(PORTFIO_MASKA_CLEAR)
435#define bfin_write_PORTFIO_MASKA_CLEAR(val) bfin_write16(PORTFIO_MASKA_CLEAR, val)
436#define bfin_read_PORTFIO_MASKA_SET() bfin_read16(PORTFIO_MASKA_SET)
437#define bfin_write_PORTFIO_MASKA_SET(val) bfin_write16(PORTFIO_MASKA_SET, val)
438#define bfin_read_PORTFIO_MASKA_TOGGLE() bfin_read16(PORTFIO_MASKA_TOGGLE)
439#define bfin_write_PORTFIO_MASKA_TOGGLE(val) bfin_write16(PORTFIO_MASKA_TOGGLE, val)
440#define bfin_read_PORTFIO_MASKB() bfin_read16(PORTFIO_MASKB)
441#define bfin_write_PORTFIO_MASKB(val) bfin_write16(PORTFIO_MASKB, val)
442#define bfin_read_PORTFIO_MASKB_CLEAR() bfin_read16(PORTFIO_MASKB_CLEAR)
443#define bfin_write_PORTFIO_MASKB_CLEAR(val) bfin_write16(PORTFIO_MASKB_CLEAR, val)
444#define bfin_read_PORTFIO_MASKB_SET() bfin_read16(PORTFIO_MASKB_SET)
445#define bfin_write_PORTFIO_MASKB_SET(val) bfin_write16(PORTFIO_MASKB_SET, val)
446#define bfin_read_PORTFIO_MASKB_TOGGLE() bfin_read16(PORTFIO_MASKB_TOGGLE)
447#define bfin_write_PORTFIO_MASKB_TOGGLE(val) bfin_write16(PORTFIO_MASKB_TOGGLE, val)
448#define bfin_read_PORTFIO_DIR() bfin_read16(PORTFIO_DIR)
449#define bfin_write_PORTFIO_DIR(val) bfin_write16(PORTFIO_DIR, val)
450#define bfin_read_PORTFIO_POLAR() bfin_read16(PORTFIO_POLAR)
451#define bfin_write_PORTFIO_POLAR(val) bfin_write16(PORTFIO_POLAR, val)
452#define bfin_read_PORTFIO_EDGE() bfin_read16(PORTFIO_EDGE)
453#define bfin_write_PORTFIO_EDGE(val) bfin_write16(PORTFIO_EDGE, val)
454#define bfin_read_PORTFIO_BOTH() bfin_read16(PORTFIO_BOTH)
455#define bfin_write_PORTFIO_BOTH(val) bfin_write16(PORTFIO_BOTH, val)
456#define bfin_read_PORTFIO_INEN() bfin_read16(PORTFIO_INEN)
457#define bfin_write_PORTFIO_INEN(val) bfin_write16(PORTFIO_INEN, val)
458#define bfin_read_PORTCIO_FER() bfin_read16(PORTCIO_FER)
459#define bfin_write_PORTCIO_FER(val) bfin_write16(PORTCIO_FER, val)
460#define bfin_read_PORTCIO() bfin_read16(PORTCIO)
461#define bfin_write_PORTCIO(val) bfin_write16(PORTCIO, val)
462#define bfin_read_PORTCIO_CLEAR() bfin_read16(PORTCIO_CLEAR)
463#define bfin_write_PORTCIO_CLEAR(val) bfin_write16(PORTCIO_CLEAR, val)
464#define bfin_read_PORTCIO_SET() bfin_read16(PORTCIO_SET)
465#define bfin_write_PORTCIO_SET(val) bfin_write16(PORTCIO_SET, val)
466#define bfin_read_PORTCIO_TOGGLE() bfin_read16(PORTCIO_TOGGLE)
467#define bfin_write_PORTCIO_TOGGLE(val) bfin_write16(PORTCIO_TOGGLE, val)
468#define bfin_read_PORTCIO_DIR() bfin_read16(PORTCIO_DIR)
469#define bfin_write_PORTCIO_DIR(val) bfin_write16(PORTCIO_DIR, val)
470#define bfin_read_PORTCIO_INEN() bfin_read16(PORTCIO_INEN)
471#define bfin_write_PORTCIO_INEN(val) bfin_write16(PORTCIO_INEN, val)
472#define bfin_read_PORTDIO_FER() bfin_read16(PORTDIO_FER)
473#define bfin_write_PORTDIO_FER(val) bfin_write16(PORTDIO_FER, val)
474#define bfin_read_PORTDIO() bfin_read16(PORTDIO)
475#define bfin_write_PORTDIO(val) bfin_write16(PORTDIO, val)
476#define bfin_read_PORTDIO_CLEAR() bfin_read16(PORTDIO_CLEAR)
477#define bfin_write_PORTDIO_CLEAR(val) bfin_write16(PORTDIO_CLEAR, val)
478#define bfin_read_PORTDIO_SET() bfin_read16(PORTDIO_SET)
479#define bfin_write_PORTDIO_SET(val) bfin_write16(PORTDIO_SET, val)
480#define bfin_read_PORTDIO_TOGGLE() bfin_read16(PORTDIO_TOGGLE)
481#define bfin_write_PORTDIO_TOGGLE(val) bfin_write16(PORTDIO_TOGGLE, val)
482#define bfin_read_PORTDIO_DIR() bfin_read16(PORTDIO_DIR)
483#define bfin_write_PORTDIO_DIR(val) bfin_write16(PORTDIO_DIR, val)
484#define bfin_read_PORTDIO_INEN() bfin_read16(PORTDIO_INEN)
485#define bfin_write_PORTDIO_INEN(val) bfin_write16(PORTDIO_INEN, val)
486#define bfin_read_PORTEIO_FER() bfin_read16(PORTEIO_FER)
487#define bfin_write_PORTEIO_FER(val) bfin_write16(PORTEIO_FER, val)
488#define bfin_read_PORTEIO() bfin_read16(PORTEIO)
489#define bfin_write_PORTEIO(val) bfin_write16(PORTEIO, val)
490#define bfin_read_PORTEIO_CLEAR() bfin_read16(PORTEIO_CLEAR)
491#define bfin_write_PORTEIO_CLEAR(val) bfin_write16(PORTEIO_CLEAR, val)
492#define bfin_read_PORTEIO_SET() bfin_read16(PORTEIO_SET)
493#define bfin_write_PORTEIO_SET(val) bfin_write16(PORTEIO_SET, val)
494#define bfin_read_PORTEIO_TOGGLE() bfin_read16(PORTEIO_TOGGLE)
495#define bfin_write_PORTEIO_TOGGLE(val) bfin_write16(PORTEIO_TOGGLE, val)
496#define bfin_read_PORTEIO_DIR() bfin_read16(PORTEIO_DIR)
497#define bfin_write_PORTEIO_DIR(val) bfin_write16(PORTEIO_DIR, val)
498#define bfin_read_PORTEIO_INEN() bfin_read16(PORTEIO_INEN)
499#define bfin_write_PORTEIO_INEN(val) bfin_write16(PORTEIO_INEN, val)
500#define bfin_read_EBIU_AMGCTL() bfin_read16(EBIU_AMGCTL)
501#define bfin_write_EBIU_AMGCTL(val) bfin_write16(EBIU_AMGCTL, val)
502#define bfin_read_EBIU_AMBCTL0() bfin_read32(EBIU_AMBCTL0)
503#define bfin_write_EBIU_AMBCTL0(val) bfin_write32(EBIU_AMBCTL0, val)
504#define bfin_read_EBIU_AMBCTL1() bfin_read32(EBIU_AMBCTL1)
505#define bfin_write_EBIU_AMBCTL1(val) bfin_write32(EBIU_AMBCTL1, val)
506#define bfin_read_EBIU_SDGCTL() bfin_read32(EBIU_SDGCTL)
507#define bfin_write_EBIU_SDGCTL(val) bfin_write32(EBIU_SDGCTL, val)
508#define bfin_read_EBIU_SDBCTL() bfin_read16(EBIU_SDBCTL)
509#define bfin_write_EBIU_SDBCTL(val) bfin_write16(EBIU_SDBCTL, val)
510#define bfin_read_EBIU_SDRRC() bfin_read16(EBIU_SDRRC)
511#define bfin_write_EBIU_SDRRC(val) bfin_write16(EBIU_SDRRC, val)
512#define bfin_read_EBIU_SDSTAT() bfin_read16(EBIU_SDSTAT)
513#define bfin_write_EBIU_SDSTAT(val) bfin_write16(EBIU_SDSTAT, val)
514#define bfin_read_DMA0_TC_PER() bfin_read16(DMA0_TC_PER)
515#define bfin_write_DMA0_TC_PER(val) bfin_write16(DMA0_TC_PER, val)
516#define bfin_read_DMA0_TC_CNT() bfin_read16(DMA0_TC_CNT)
517#define bfin_write_DMA0_TC_CNT(val) bfin_write16(DMA0_TC_CNT, val)
518#define bfin_read_DMA0_NEXT_DESC_PTR() bfin_readPTR(DMA0_NEXT_DESC_PTR)
519#define bfin_write_DMA0_NEXT_DESC_PTR(val) bfin_writePTR(DMA0_NEXT_DESC_PTR, val)
520#define bfin_read_DMA0_START_ADDR() bfin_readPTR(DMA0_START_ADDR)
521#define bfin_write_DMA0_START_ADDR(val) bfin_writePTR(DMA0_START_ADDR, val)
522#define bfin_read_DMA0_CONFIG() bfin_read16(DMA0_CONFIG)
523#define bfin_write_DMA0_CONFIG(val) bfin_write16(DMA0_CONFIG, val)
524#define bfin_read_DMA0_X_COUNT() bfin_read16(DMA0_X_COUNT)
525#define bfin_write_DMA0_X_COUNT(val) bfin_write16(DMA0_X_COUNT, val)
526#define bfin_read_DMA0_X_MODIFY() bfin_read16(DMA0_X_MODIFY)
527#define bfin_write_DMA0_X_MODIFY(val) bfin_write16(DMA0_X_MODIFY, val)
528#define bfin_read_DMA0_Y_COUNT() bfin_read16(DMA0_Y_COUNT)
529#define bfin_write_DMA0_Y_COUNT(val) bfin_write16(DMA0_Y_COUNT, val)
530#define bfin_read_DMA0_Y_MODIFY() bfin_read16(DMA0_Y_MODIFY)
531#define bfin_write_DMA0_Y_MODIFY(val) bfin_write16(DMA0_Y_MODIFY, val)
532#define bfin_read_DMA0_CURR_DESC_PTR() bfin_readPTR(DMA0_CURR_DESC_PTR)
533#define bfin_write_DMA0_CURR_DESC_PTR(val) bfin_writePTR(DMA0_CURR_DESC_PTR, val)
534#define bfin_read_DMA0_CURR_ADDR() bfin_readPTR(DMA0_CURR_ADDR)
535#define bfin_write_DMA0_CURR_ADDR(val) bfin_writePTR(DMA0_CURR_ADDR, val)
536#define bfin_read_DMA0_IRQ_STATUS() bfin_read16(DMA0_IRQ_STATUS)
537#define bfin_write_DMA0_IRQ_STATUS(val) bfin_write16(DMA0_IRQ_STATUS, val)
538#define bfin_read_DMA0_PERIPHERAL_MAP() bfin_read16(DMA0_PERIPHERAL_MAP)
539#define bfin_write_DMA0_PERIPHERAL_MAP(val) bfin_write16(DMA0_PERIPHERAL_MAP, val)
540#define bfin_read_DMA0_CURR_X_COUNT() bfin_read16(DMA0_CURR_X_COUNT)
541#define bfin_write_DMA0_CURR_X_COUNT(val) bfin_write16(DMA0_CURR_X_COUNT, val)
542#define bfin_read_DMA0_CURR_Y_COUNT() bfin_read16(DMA0_CURR_Y_COUNT)
543#define bfin_write_DMA0_CURR_Y_COUNT(val) bfin_write16(DMA0_CURR_Y_COUNT, val)
544#define bfin_read_DMA1_NEXT_DESC_PTR() bfin_readPTR(DMA1_NEXT_DESC_PTR)
545#define bfin_write_DMA1_NEXT_DESC_PTR(val) bfin_writePTR(DMA1_NEXT_DESC_PTR, val)
546#define bfin_read_DMA1_START_ADDR() bfin_readPTR(DMA1_START_ADDR)
547#define bfin_write_DMA1_START_ADDR(val) bfin_writePTR(DMA1_START_ADDR, val)
548#define bfin_read_DMA1_CONFIG() bfin_read16(DMA1_CONFIG)
549#define bfin_write_DMA1_CONFIG(val) bfin_write16(DMA1_CONFIG, val)
550#define bfin_read_DMA1_X_COUNT() bfin_read16(DMA1_X_COUNT)
551#define bfin_write_DMA1_X_COUNT(val) bfin_write16(DMA1_X_COUNT, val)
552#define bfin_read_DMA1_X_MODIFY() bfin_read16(DMA1_X_MODIFY)
553#define bfin_write_DMA1_X_MODIFY(val) bfin_write16(DMA1_X_MODIFY, val)
554#define bfin_read_DMA1_Y_COUNT() bfin_read16(DMA1_Y_COUNT)
555#define bfin_write_DMA1_Y_COUNT(val) bfin_write16(DMA1_Y_COUNT, val)
556#define bfin_read_DMA1_Y_MODIFY() bfin_read16(DMA1_Y_MODIFY)
557#define bfin_write_DMA1_Y_MODIFY(val) bfin_write16(DMA1_Y_MODIFY, val)
558#define bfin_read_DMA1_CURR_DESC_PTR() bfin_readPTR(DMA1_CURR_DESC_PTR)
559#define bfin_write_DMA1_CURR_DESC_PTR(val) bfin_writePTR(DMA1_CURR_DESC_PTR, val)
560#define bfin_read_DMA1_CURR_ADDR() bfin_readPTR(DMA1_CURR_ADDR)
561#define bfin_write_DMA1_CURR_ADDR(val) bfin_writePTR(DMA1_CURR_ADDR, val)
562#define bfin_read_DMA1_IRQ_STATUS() bfin_read16(DMA1_IRQ_STATUS)
563#define bfin_write_DMA1_IRQ_STATUS(val) bfin_write16(DMA1_IRQ_STATUS, val)
564#define bfin_read_DMA1_PERIPHERAL_MAP() bfin_read16(DMA1_PERIPHERAL_MAP)
565#define bfin_write_DMA1_PERIPHERAL_MAP(val) bfin_write16(DMA1_PERIPHERAL_MAP, val)
566#define bfin_read_DMA1_CURR_X_COUNT() bfin_read16(DMA1_CURR_X_COUNT)
567#define bfin_write_DMA1_CURR_X_COUNT(val) bfin_write16(DMA1_CURR_X_COUNT, val)
568#define bfin_read_DMA1_CURR_Y_COUNT() bfin_read16(DMA1_CURR_Y_COUNT)
569#define bfin_write_DMA1_CURR_Y_COUNT(val) bfin_write16(DMA1_CURR_Y_COUNT, val)
570#define bfin_read_DMA2_NEXT_DESC_PTR() bfin_readPTR(DMA2_NEXT_DESC_PTR)
571#define bfin_write_DMA2_NEXT_DESC_PTR(val) bfin_writePTR(DMA2_NEXT_DESC_PTR, val)
572#define bfin_read_DMA2_START_ADDR() bfin_readPTR(DMA2_START_ADDR)
573#define bfin_write_DMA2_START_ADDR(val) bfin_writePTR(DMA2_START_ADDR, val)
574#define bfin_read_DMA2_CONFIG() bfin_read16(DMA2_CONFIG)
575#define bfin_write_DMA2_CONFIG(val) bfin_write16(DMA2_CONFIG, val)
576#define bfin_read_DMA2_X_COUNT() bfin_read16(DMA2_X_COUNT)
577#define bfin_write_DMA2_X_COUNT(val) bfin_write16(DMA2_X_COUNT, val)
578#define bfin_read_DMA2_X_MODIFY() bfin_read16(DMA2_X_MODIFY)
579#define bfin_write_DMA2_X_MODIFY(val) bfin_write16(DMA2_X_MODIFY, val)
580#define bfin_read_DMA2_Y_COUNT() bfin_read16(DMA2_Y_COUNT)
581#define bfin_write_DMA2_Y_COUNT(val) bfin_write16(DMA2_Y_COUNT, val)
582#define bfin_read_DMA2_Y_MODIFY() bfin_read16(DMA2_Y_MODIFY)
583#define bfin_write_DMA2_Y_MODIFY(val) bfin_write16(DMA2_Y_MODIFY, val)
584#define bfin_read_DMA2_CURR_DESC_PTR() bfin_readPTR(DMA2_CURR_DESC_PTR)
585#define bfin_write_DMA2_CURR_DESC_PTR(val) bfin_writePTR(DMA2_CURR_DESC_PTR, val)
586#define bfin_read_DMA2_CURR_ADDR() bfin_readPTR(DMA2_CURR_ADDR)
587#define bfin_write_DMA2_CURR_ADDR(val) bfin_writePTR(DMA2_CURR_ADDR, val)
588#define bfin_read_DMA2_IRQ_STATUS() bfin_read16(DMA2_IRQ_STATUS)
589#define bfin_write_DMA2_IRQ_STATUS(val) bfin_write16(DMA2_IRQ_STATUS, val)
590#define bfin_read_DMA2_PERIPHERAL_MAP() bfin_read16(DMA2_PERIPHERAL_MAP)
591#define bfin_write_DMA2_PERIPHERAL_MAP(val) bfin_write16(DMA2_PERIPHERAL_MAP, val)
592#define bfin_read_DMA2_CURR_X_COUNT() bfin_read16(DMA2_CURR_X_COUNT)
593#define bfin_write_DMA2_CURR_X_COUNT(val) bfin_write16(DMA2_CURR_X_COUNT, val)
594#define bfin_read_DMA2_CURR_Y_COUNT() bfin_read16(DMA2_CURR_Y_COUNT)
595#define bfin_write_DMA2_CURR_Y_COUNT(val) bfin_write16(DMA2_CURR_Y_COUNT, val)
596#define bfin_read_DMA3_NEXT_DESC_PTR() bfin_readPTR(DMA3_NEXT_DESC_PTR)
597#define bfin_write_DMA3_NEXT_DESC_PTR(val) bfin_writePTR(DMA3_NEXT_DESC_PTR, val)
598#define bfin_read_DMA3_START_ADDR() bfin_readPTR(DMA3_START_ADDR)
599#define bfin_write_DMA3_START_ADDR(val) bfin_writePTR(DMA3_START_ADDR, val)
600#define bfin_read_DMA3_CONFIG() bfin_read16(DMA3_CONFIG)
601#define bfin_write_DMA3_CONFIG(val) bfin_write16(DMA3_CONFIG, val)
602#define bfin_read_DMA3_X_COUNT() bfin_read16(DMA3_X_COUNT)
603#define bfin_write_DMA3_X_COUNT(val) bfin_write16(DMA3_X_COUNT, val)
604#define bfin_read_DMA3_X_MODIFY() bfin_read16(DMA3_X_MODIFY)
605#define bfin_write_DMA3_X_MODIFY(val) bfin_write16(DMA3_X_MODIFY, val)
606#define bfin_read_DMA3_Y_COUNT() bfin_read16(DMA3_Y_COUNT)
607#define bfin_write_DMA3_Y_COUNT(val) bfin_write16(DMA3_Y_COUNT, val)
608#define bfin_read_DMA3_Y_MODIFY() bfin_read16(DMA3_Y_MODIFY)
609#define bfin_write_DMA3_Y_MODIFY(val) bfin_write16(DMA3_Y_MODIFY, val)
610#define bfin_read_DMA3_CURR_DESC_PTR() bfin_readPTR(DMA3_CURR_DESC_PTR)
611#define bfin_write_DMA3_CURR_DESC_PTR(val) bfin_writePTR(DMA3_CURR_DESC_PTR, val)
612#define bfin_read_DMA3_CURR_ADDR() bfin_readPTR(DMA3_CURR_ADDR)
613#define bfin_write_DMA3_CURR_ADDR(val) bfin_writePTR(DMA3_CURR_ADDR, val)
614#define bfin_read_DMA3_IRQ_STATUS() bfin_read16(DMA3_IRQ_STATUS)
615#define bfin_write_DMA3_IRQ_STATUS(val) bfin_write16(DMA3_IRQ_STATUS, val)
616#define bfin_read_DMA3_PERIPHERAL_MAP() bfin_read16(DMA3_PERIPHERAL_MAP)
617#define bfin_write_DMA3_PERIPHERAL_MAP(val) bfin_write16(DMA3_PERIPHERAL_MAP, val)
618#define bfin_read_DMA3_CURR_X_COUNT() bfin_read16(DMA3_CURR_X_COUNT)
619#define bfin_write_DMA3_CURR_X_COUNT(val) bfin_write16(DMA3_CURR_X_COUNT, val)
620#define bfin_read_DMA3_CURR_Y_COUNT() bfin_read16(DMA3_CURR_Y_COUNT)
621#define bfin_write_DMA3_CURR_Y_COUNT(val) bfin_write16(DMA3_CURR_Y_COUNT, val)
622#define bfin_read_DMA4_NEXT_DESC_PTR() bfin_readPTR(DMA4_NEXT_DESC_PTR)
623#define bfin_write_DMA4_NEXT_DESC_PTR(val) bfin_writePTR(DMA4_NEXT_DESC_PTR, val)
624#define bfin_read_DMA4_START_ADDR() bfin_readPTR(DMA4_START_ADDR)
625#define bfin_write_DMA4_START_ADDR(val) bfin_writePTR(DMA4_START_ADDR, val)
626#define bfin_read_DMA4_CONFIG() bfin_read16(DMA4_CONFIG)
627#define bfin_write_DMA4_CONFIG(val) bfin_write16(DMA4_CONFIG, val)
628#define bfin_read_DMA4_X_COUNT() bfin_read16(DMA4_X_COUNT)
629#define bfin_write_DMA4_X_COUNT(val) bfin_write16(DMA4_X_COUNT, val)
630#define bfin_read_DMA4_X_MODIFY() bfin_read16(DMA4_X_MODIFY)
631#define bfin_write_DMA4_X_MODIFY(val) bfin_write16(DMA4_X_MODIFY, val)
632#define bfin_read_DMA4_Y_COUNT() bfin_read16(DMA4_Y_COUNT)
633#define bfin_write_DMA4_Y_COUNT(val) bfin_write16(DMA4_Y_COUNT, val)
634#define bfin_read_DMA4_Y_MODIFY() bfin_read16(DMA4_Y_MODIFY)
635#define bfin_write_DMA4_Y_MODIFY(val) bfin_write16(DMA4_Y_MODIFY, val)
636#define bfin_read_DMA4_CURR_DESC_PTR() bfin_readPTR(DMA4_CURR_DESC_PTR)
637#define bfin_write_DMA4_CURR_DESC_PTR(val) bfin_writePTR(DMA4_CURR_DESC_PTR, val)
638#define bfin_read_DMA4_CURR_ADDR() bfin_readPTR(DMA4_CURR_ADDR)
639#define bfin_write_DMA4_CURR_ADDR(val) bfin_writePTR(DMA4_CURR_ADDR, val)
640#define bfin_read_DMA4_IRQ_STATUS() bfin_read16(DMA4_IRQ_STATUS)
641#define bfin_write_DMA4_IRQ_STATUS(val) bfin_write16(DMA4_IRQ_STATUS, val)
642#define bfin_read_DMA4_PERIPHERAL_MAP() bfin_read16(DMA4_PERIPHERAL_MAP)
643#define bfin_write_DMA4_PERIPHERAL_MAP(val) bfin_write16(DMA4_PERIPHERAL_MAP, val)
644#define bfin_read_DMA4_CURR_X_COUNT() bfin_read16(DMA4_CURR_X_COUNT)
645#define bfin_write_DMA4_CURR_X_COUNT(val) bfin_write16(DMA4_CURR_X_COUNT, val)
646#define bfin_read_DMA4_CURR_Y_COUNT() bfin_read16(DMA4_CURR_Y_COUNT)
647#define bfin_write_DMA4_CURR_Y_COUNT(val) bfin_write16(DMA4_CURR_Y_COUNT, val)
648#define bfin_read_DMA5_NEXT_DESC_PTR() bfin_readPTR(DMA5_NEXT_DESC_PTR)
649#define bfin_write_DMA5_NEXT_DESC_PTR(val) bfin_writePTR(DMA5_NEXT_DESC_PTR, val)
650#define bfin_read_DMA5_START_ADDR() bfin_readPTR(DMA5_START_ADDR)
651#define bfin_write_DMA5_START_ADDR(val) bfin_writePTR(DMA5_START_ADDR, val)
652#define bfin_read_DMA5_CONFIG() bfin_read16(DMA5_CONFIG)
653#define bfin_write_DMA5_CONFIG(val) bfin_write16(DMA5_CONFIG, val)
654#define bfin_read_DMA5_X_COUNT() bfin_read16(DMA5_X_COUNT)
655#define bfin_write_DMA5_X_COUNT(val) bfin_write16(DMA5_X_COUNT, val)
656#define bfin_read_DMA5_X_MODIFY() bfin_read16(DMA5_X_MODIFY)
657#define bfin_write_DMA5_X_MODIFY(val) bfin_write16(DMA5_X_MODIFY, val)
658#define bfin_read_DMA5_Y_COUNT() bfin_read16(DMA5_Y_COUNT)
659#define bfin_write_DMA5_Y_COUNT(val) bfin_write16(DMA5_Y_COUNT, val)
660#define bfin_read_DMA5_Y_MODIFY() bfin_read16(DMA5_Y_MODIFY)
661#define bfin_write_DMA5_Y_MODIFY(val) bfin_write16(DMA5_Y_MODIFY, val)
662#define bfin_read_DMA5_CURR_DESC_PTR() bfin_readPTR(DMA5_CURR_DESC_PTR)
663#define bfin_write_DMA5_CURR_DESC_PTR(val) bfin_writePTR(DMA5_CURR_DESC_PTR, val)
664#define bfin_read_DMA5_CURR_ADDR() bfin_readPTR(DMA5_CURR_ADDR)
665#define bfin_write_DMA5_CURR_ADDR(val) bfin_writePTR(DMA5_CURR_ADDR, val)
666#define bfin_read_DMA5_IRQ_STATUS() bfin_read16(DMA5_IRQ_STATUS)
667#define bfin_write_DMA5_IRQ_STATUS(val) bfin_write16(DMA5_IRQ_STATUS, val)
668#define bfin_read_DMA5_PERIPHERAL_MAP() bfin_read16(DMA5_PERIPHERAL_MAP)
669#define bfin_write_DMA5_PERIPHERAL_MAP(val) bfin_write16(DMA5_PERIPHERAL_MAP, val)
670#define bfin_read_DMA5_CURR_X_COUNT() bfin_read16(DMA5_CURR_X_COUNT)
671#define bfin_write_DMA5_CURR_X_COUNT(val) bfin_write16(DMA5_CURR_X_COUNT, val)
672#define bfin_read_DMA5_CURR_Y_COUNT() bfin_read16(DMA5_CURR_Y_COUNT)
673#define bfin_write_DMA5_CURR_Y_COUNT(val) bfin_write16(DMA5_CURR_Y_COUNT, val)
674#define bfin_read_DMA6_NEXT_DESC_PTR() bfin_readPTR(DMA6_NEXT_DESC_PTR)
675#define bfin_write_DMA6_NEXT_DESC_PTR(val) bfin_writePTR(DMA6_NEXT_DESC_PTR, val)
676#define bfin_read_DMA6_START_ADDR() bfin_readPTR(DMA6_START_ADDR)
677#define bfin_write_DMA6_START_ADDR(val) bfin_writePTR(DMA6_START_ADDR, val)
678#define bfin_read_DMA6_CONFIG() bfin_read16(DMA6_CONFIG)
679#define bfin_write_DMA6_CONFIG(val) bfin_write16(DMA6_CONFIG, val)
680#define bfin_read_DMA6_X_COUNT() bfin_read16(DMA6_X_COUNT)
681#define bfin_write_DMA6_X_COUNT(val) bfin_write16(DMA6_X_COUNT, val)
682#define bfin_read_DMA6_X_MODIFY() bfin_read16(DMA6_X_MODIFY)
683#define bfin_write_DMA6_X_MODIFY(val) bfin_write16(DMA6_X_MODIFY, val)
684#define bfin_read_DMA6_Y_COUNT() bfin_read16(DMA6_Y_COUNT)
685#define bfin_write_DMA6_Y_COUNT(val) bfin_write16(DMA6_Y_COUNT, val)
686#define bfin_read_DMA6_Y_MODIFY() bfin_read16(DMA6_Y_MODIFY)
687#define bfin_write_DMA6_Y_MODIFY(val) bfin_write16(DMA6_Y_MODIFY, val)
688#define bfin_read_DMA6_CURR_DESC_PTR() bfin_readPTR(DMA6_CURR_DESC_PTR)
689#define bfin_write_DMA6_CURR_DESC_PTR(val) bfin_writePTR(DMA6_CURR_DESC_PTR, val)
690#define bfin_read_DMA6_CURR_ADDR() bfin_readPTR(DMA6_CURR_ADDR)
691#define bfin_write_DMA6_CURR_ADDR(val) bfin_writePTR(DMA6_CURR_ADDR, val)
692#define bfin_read_DMA6_IRQ_STATUS() bfin_read16(DMA6_IRQ_STATUS)
693#define bfin_write_DMA6_IRQ_STATUS(val) bfin_write16(DMA6_IRQ_STATUS, val)
694#define bfin_read_DMA6_PERIPHERAL_MAP() bfin_read16(DMA6_PERIPHERAL_MAP)
695#define bfin_write_DMA6_PERIPHERAL_MAP(val) bfin_write16(DMA6_PERIPHERAL_MAP, val)
696#define bfin_read_DMA6_CURR_X_COUNT() bfin_read16(DMA6_CURR_X_COUNT)
697#define bfin_write_DMA6_CURR_X_COUNT(val) bfin_write16(DMA6_CURR_X_COUNT, val)
698#define bfin_read_DMA6_CURR_Y_COUNT() bfin_read16(DMA6_CURR_Y_COUNT)
699#define bfin_write_DMA6_CURR_Y_COUNT(val) bfin_write16(DMA6_CURR_Y_COUNT, val)
700#define bfin_read_DMA7_NEXT_DESC_PTR() bfin_readPTR(DMA7_NEXT_DESC_PTR)
701#define bfin_write_DMA7_NEXT_DESC_PTR(val) bfin_writePTR(DMA7_NEXT_DESC_PTR, val)
702#define bfin_read_DMA7_START_ADDR() bfin_readPTR(DMA7_START_ADDR)
703#define bfin_write_DMA7_START_ADDR(val) bfin_writePTR(DMA7_START_ADDR, val)
704#define bfin_read_DMA7_CONFIG() bfin_read16(DMA7_CONFIG)
705#define bfin_write_DMA7_CONFIG(val) bfin_write16(DMA7_CONFIG, val)
706#define bfin_read_DMA7_X_COUNT() bfin_read16(DMA7_X_COUNT)
707#define bfin_write_DMA7_X_COUNT(val) bfin_write16(DMA7_X_COUNT, val)
708#define bfin_read_DMA7_X_MODIFY() bfin_read16(DMA7_X_MODIFY)
709#define bfin_write_DMA7_X_MODIFY(val) bfin_write16(DMA7_X_MODIFY, val)
710#define bfin_read_DMA7_Y_COUNT() bfin_read16(DMA7_Y_COUNT)
711#define bfin_write_DMA7_Y_COUNT(val) bfin_write16(DMA7_Y_COUNT, val)
712#define bfin_read_DMA7_Y_MODIFY() bfin_read16(DMA7_Y_MODIFY)
713#define bfin_write_DMA7_Y_MODIFY(val) bfin_write16(DMA7_Y_MODIFY, val)
714#define bfin_read_DMA7_CURR_DESC_PTR() bfin_readPTR(DMA7_CURR_DESC_PTR)
715#define bfin_write_DMA7_CURR_DESC_PTR(val) bfin_writePTR(DMA7_CURR_DESC_PTR, val)
716#define bfin_read_DMA7_CURR_ADDR() bfin_readPTR(DMA7_CURR_ADDR)
717#define bfin_write_DMA7_CURR_ADDR(val) bfin_writePTR(DMA7_CURR_ADDR, val)
718#define bfin_read_DMA7_IRQ_STATUS() bfin_read16(DMA7_IRQ_STATUS)
719#define bfin_write_DMA7_IRQ_STATUS(val) bfin_write16(DMA7_IRQ_STATUS, val)
720#define bfin_read_DMA7_PERIPHERAL_MAP() bfin_read16(DMA7_PERIPHERAL_MAP)
721#define bfin_write_DMA7_PERIPHERAL_MAP(val) bfin_write16(DMA7_PERIPHERAL_MAP, val)
722#define bfin_read_DMA7_CURR_X_COUNT() bfin_read16(DMA7_CURR_X_COUNT)
723#define bfin_write_DMA7_CURR_X_COUNT(val) bfin_write16(DMA7_CURR_X_COUNT, val)
724#define bfin_read_DMA7_CURR_Y_COUNT() bfin_read16(DMA7_CURR_Y_COUNT)
725#define bfin_write_DMA7_CURR_Y_COUNT(val) bfin_write16(DMA7_CURR_Y_COUNT, val)
726#define bfin_read_DMA1_TC_PER() bfin_read16(DMA1_TC_PER)
727#define bfin_write_DMA1_TC_PER(val) bfin_write16(DMA1_TC_PER, val)
728#define bfin_read_DMA1_TC_CNT() bfin_read16(DMA1_TC_CNT)
729#define bfin_write_DMA1_TC_CNT(val) bfin_write16(DMA1_TC_CNT, val)
730#define bfin_read_DMA8_NEXT_DESC_PTR() bfin_readPTR(DMA8_NEXT_DESC_PTR)
731#define bfin_write_DMA8_NEXT_DESC_PTR(val) bfin_writePTR(DMA8_NEXT_DESC_PTR, val)
732#define bfin_read_DMA8_START_ADDR() bfin_readPTR(DMA8_START_ADDR)
733#define bfin_write_DMA8_START_ADDR(val) bfin_writePTR(DMA8_START_ADDR, val)
734#define bfin_read_DMA8_CONFIG() bfin_read16(DMA8_CONFIG)
735#define bfin_write_DMA8_CONFIG(val) bfin_write16(DMA8_CONFIG, val)
736#define bfin_read_DMA8_X_COUNT() bfin_read16(DMA8_X_COUNT)
737#define bfin_write_DMA8_X_COUNT(val) bfin_write16(DMA8_X_COUNT, val)
738#define bfin_read_DMA8_X_MODIFY() bfin_read16(DMA8_X_MODIFY)
739#define bfin_write_DMA8_X_MODIFY(val) bfin_write16(DMA8_X_MODIFY, val)
740#define bfin_read_DMA8_Y_COUNT() bfin_read16(DMA8_Y_COUNT)
741#define bfin_write_DMA8_Y_COUNT(val) bfin_write16(DMA8_Y_COUNT, val)
742#define bfin_read_DMA8_Y_MODIFY() bfin_read16(DMA8_Y_MODIFY)
743#define bfin_write_DMA8_Y_MODIFY(val) bfin_write16(DMA8_Y_MODIFY, val)
744#define bfin_read_DMA8_CURR_DESC_PTR() bfin_readPTR(DMA8_CURR_DESC_PTR)
745#define bfin_write_DMA8_CURR_DESC_PTR(val) bfin_writePTR(DMA8_CURR_DESC_PTR, val)
746#define bfin_read_DMA8_CURR_ADDR() bfin_readPTR(DMA8_CURR_ADDR)
747#define bfin_write_DMA8_CURR_ADDR(val) bfin_writePTR(DMA8_CURR_ADDR, val)
748#define bfin_read_DMA8_IRQ_STATUS() bfin_read16(DMA8_IRQ_STATUS)
749#define bfin_write_DMA8_IRQ_STATUS(val) bfin_write16(DMA8_IRQ_STATUS, val)
750#define bfin_read_DMA8_PERIPHERAL_MAP() bfin_read16(DMA8_PERIPHERAL_MAP)
751#define bfin_write_DMA8_PERIPHERAL_MAP(val) bfin_write16(DMA8_PERIPHERAL_MAP, val)
752#define bfin_read_DMA8_CURR_X_COUNT() bfin_read16(DMA8_CURR_X_COUNT)
753#define bfin_write_DMA8_CURR_X_COUNT(val) bfin_write16(DMA8_CURR_X_COUNT, val)
754#define bfin_read_DMA8_CURR_Y_COUNT() bfin_read16(DMA8_CURR_Y_COUNT)
755#define bfin_write_DMA8_CURR_Y_COUNT(val) bfin_write16(DMA8_CURR_Y_COUNT, val)
756#define bfin_read_DMA9_NEXT_DESC_PTR() bfin_readPTR(DMA9_NEXT_DESC_PTR)
757#define bfin_write_DMA9_NEXT_DESC_PTR(val) bfin_writePTR(DMA9_NEXT_DESC_PTR, val)
758#define bfin_read_DMA9_START_ADDR() bfin_readPTR(DMA9_START_ADDR)
759#define bfin_write_DMA9_START_ADDR(val) bfin_writePTR(DMA9_START_ADDR, val)
760#define bfin_read_DMA9_CONFIG() bfin_read16(DMA9_CONFIG)
761#define bfin_write_DMA9_CONFIG(val) bfin_write16(DMA9_CONFIG, val)
762#define bfin_read_DMA9_X_COUNT() bfin_read16(DMA9_X_COUNT)
763#define bfin_write_DMA9_X_COUNT(val) bfin_write16(DMA9_X_COUNT, val)
764#define bfin_read_DMA9_X_MODIFY() bfin_read16(DMA9_X_MODIFY)
765#define bfin_write_DMA9_X_MODIFY(val) bfin_write16(DMA9_X_MODIFY, val)
766#define bfin_read_DMA9_Y_COUNT() bfin_read16(DMA9_Y_COUNT)
767#define bfin_write_DMA9_Y_COUNT(val) bfin_write16(DMA9_Y_COUNT, val)
768#define bfin_read_DMA9_Y_MODIFY() bfin_read16(DMA9_Y_MODIFY)
769#define bfin_write_DMA9_Y_MODIFY(val) bfin_write16(DMA9_Y_MODIFY, val)
770#define bfin_read_DMA9_CURR_DESC_PTR() bfin_readPTR(DMA9_CURR_DESC_PTR)
771#define bfin_write_DMA9_CURR_DESC_PTR(val) bfin_writePTR(DMA9_CURR_DESC_PTR, val)
772#define bfin_read_DMA9_CURR_ADDR() bfin_readPTR(DMA9_CURR_ADDR)
773#define bfin_write_DMA9_CURR_ADDR(val) bfin_writePTR(DMA9_CURR_ADDR, val)
774#define bfin_read_DMA9_IRQ_STATUS() bfin_read16(DMA9_IRQ_STATUS)
775#define bfin_write_DMA9_IRQ_STATUS(val) bfin_write16(DMA9_IRQ_STATUS, val)
776#define bfin_read_DMA9_PERIPHERAL_MAP() bfin_read16(DMA9_PERIPHERAL_MAP)
777#define bfin_write_DMA9_PERIPHERAL_MAP(val) bfin_write16(DMA9_PERIPHERAL_MAP, val)
778#define bfin_read_DMA9_CURR_X_COUNT() bfin_read16(DMA9_CURR_X_COUNT)
779#define bfin_write_DMA9_CURR_X_COUNT(val) bfin_write16(DMA9_CURR_X_COUNT, val)
780#define bfin_read_DMA9_CURR_Y_COUNT() bfin_read16(DMA9_CURR_Y_COUNT)
781#define bfin_write_DMA9_CURR_Y_COUNT(val) bfin_write16(DMA9_CURR_Y_COUNT, val)
782#define bfin_read_DMA10_NEXT_DESC_PTR() bfin_readPTR(DMA10_NEXT_DESC_PTR)
783#define bfin_write_DMA10_NEXT_DESC_PTR(val) bfin_writePTR(DMA10_NEXT_DESC_PTR, val)
784#define bfin_read_DMA10_START_ADDR() bfin_readPTR(DMA10_START_ADDR)
785#define bfin_write_DMA10_START_ADDR(val) bfin_writePTR(DMA10_START_ADDR, val)
786#define bfin_read_DMA10_CONFIG() bfin_read16(DMA10_CONFIG)
787#define bfin_write_DMA10_CONFIG(val) bfin_write16(DMA10_CONFIG, val)
788#define bfin_read_DMA10_X_COUNT() bfin_read16(DMA10_X_COUNT)
789#define bfin_write_DMA10_X_COUNT(val) bfin_write16(DMA10_X_COUNT, val)
790#define bfin_read_DMA10_X_MODIFY() bfin_read16(DMA10_X_MODIFY)
791#define bfin_write_DMA10_X_MODIFY(val) bfin_write16(DMA10_X_MODIFY, val)
792#define bfin_read_DMA10_Y_COUNT() bfin_read16(DMA10_Y_COUNT)
793#define bfin_write_DMA10_Y_COUNT(val) bfin_write16(DMA10_Y_COUNT, val)
794#define bfin_read_DMA10_Y_MODIFY() bfin_read16(DMA10_Y_MODIFY)
795#define bfin_write_DMA10_Y_MODIFY(val) bfin_write16(DMA10_Y_MODIFY, val)
796#define bfin_read_DMA10_CURR_DESC_PTR() bfin_readPTR(DMA10_CURR_DESC_PTR)
797#define bfin_write_DMA10_CURR_DESC_PTR(val) bfin_writePTR(DMA10_CURR_DESC_PTR, val)
798#define bfin_read_DMA10_CURR_ADDR() bfin_readPTR(DMA10_CURR_ADDR)
799#define bfin_write_DMA10_CURR_ADDR(val) bfin_writePTR(DMA10_CURR_ADDR, val)
800#define bfin_read_DMA10_IRQ_STATUS() bfin_read16(DMA10_IRQ_STATUS)
801#define bfin_write_DMA10_IRQ_STATUS(val) bfin_write16(DMA10_IRQ_STATUS, val)
802#define bfin_read_DMA10_PERIPHERAL_MAP() bfin_read16(DMA10_PERIPHERAL_MAP)
803#define bfin_write_DMA10_PERIPHERAL_MAP(val) bfin_write16(DMA10_PERIPHERAL_MAP, val)
804#define bfin_read_DMA10_CURR_X_COUNT() bfin_read16(DMA10_CURR_X_COUNT)
805#define bfin_write_DMA10_CURR_X_COUNT(val) bfin_write16(DMA10_CURR_X_COUNT, val)
806#define bfin_read_DMA10_CURR_Y_COUNT() bfin_read16(DMA10_CURR_Y_COUNT)
807#define bfin_write_DMA10_CURR_Y_COUNT(val) bfin_write16(DMA10_CURR_Y_COUNT, val)
808#define bfin_read_DMA11_NEXT_DESC_PTR() bfin_readPTR(DMA11_NEXT_DESC_PTR)
809#define bfin_write_DMA11_NEXT_DESC_PTR(val) bfin_writePTR(DMA11_NEXT_DESC_PTR, val)
810#define bfin_read_DMA11_START_ADDR() bfin_readPTR(DMA11_START_ADDR)
811#define bfin_write_DMA11_START_ADDR(val) bfin_writePTR(DMA11_START_ADDR, val)
812#define bfin_read_DMA11_CONFIG() bfin_read16(DMA11_CONFIG)
813#define bfin_write_DMA11_CONFIG(val) bfin_write16(DMA11_CONFIG, val)
814#define bfin_read_DMA11_X_COUNT() bfin_read16(DMA11_X_COUNT)
815#define bfin_write_DMA11_X_COUNT(val) bfin_write16(DMA11_X_COUNT, val)
816#define bfin_read_DMA11_X_MODIFY() bfin_read16(DMA11_X_MODIFY)
817#define bfin_write_DMA11_X_MODIFY(val) bfin_write16(DMA11_X_MODIFY, val)
818#define bfin_read_DMA11_Y_COUNT() bfin_read16(DMA11_Y_COUNT)
819#define bfin_write_DMA11_Y_COUNT(val) bfin_write16(DMA11_Y_COUNT, val)
820#define bfin_read_DMA11_Y_MODIFY() bfin_read16(DMA11_Y_MODIFY)
821#define bfin_write_DMA11_Y_MODIFY(val) bfin_write16(DMA11_Y_MODIFY, val)
822#define bfin_read_DMA11_CURR_DESC_PTR() bfin_readPTR(DMA11_CURR_DESC_PTR)
823#define bfin_write_DMA11_CURR_DESC_PTR(val) bfin_writePTR(DMA11_CURR_DESC_PTR, val)
824#define bfin_read_DMA11_CURR_ADDR() bfin_readPTR(DMA11_CURR_ADDR)
825#define bfin_write_DMA11_CURR_ADDR(val) bfin_writePTR(DMA11_CURR_ADDR, val)
826#define bfin_read_DMA11_IRQ_STATUS() bfin_read16(DMA11_IRQ_STATUS)
827#define bfin_write_DMA11_IRQ_STATUS(val) bfin_write16(DMA11_IRQ_STATUS, val)
828#define bfin_read_DMA11_PERIPHERAL_MAP() bfin_read16(DMA11_PERIPHERAL_MAP)
829#define bfin_write_DMA11_PERIPHERAL_MAP(val) bfin_write16(DMA11_PERIPHERAL_MAP, val)
830#define bfin_read_DMA11_CURR_X_COUNT() bfin_read16(DMA11_CURR_X_COUNT)
831#define bfin_write_DMA11_CURR_X_COUNT(val) bfin_write16(DMA11_CURR_X_COUNT, val)
832#define bfin_read_DMA11_CURR_Y_COUNT() bfin_read16(DMA11_CURR_Y_COUNT)
833#define bfin_write_DMA11_CURR_Y_COUNT(val) bfin_write16(DMA11_CURR_Y_COUNT, val)
834#define bfin_read_DMA12_NEXT_DESC_PTR() bfin_readPTR(DMA12_NEXT_DESC_PTR)
835#define bfin_write_DMA12_NEXT_DESC_PTR(val) bfin_writePTR(DMA12_NEXT_DESC_PTR, val)
836#define bfin_read_DMA12_START_ADDR() bfin_readPTR(DMA12_START_ADDR)
837#define bfin_write_DMA12_START_ADDR(val) bfin_writePTR(DMA12_START_ADDR, val)
838#define bfin_read_DMA12_CONFIG() bfin_read16(DMA12_CONFIG)
839#define bfin_write_DMA12_CONFIG(val) bfin_write16(DMA12_CONFIG, val)
840#define bfin_read_DMA12_X_COUNT() bfin_read16(DMA12_X_COUNT)
841#define bfin_write_DMA12_X_COUNT(val) bfin_write16(DMA12_X_COUNT, val)
842#define bfin_read_DMA12_X_MODIFY() bfin_read16(DMA12_X_MODIFY)
843#define bfin_write_DMA12_X_MODIFY(val) bfin_write16(DMA12_X_MODIFY, val)
844#define bfin_read_DMA12_Y_COUNT() bfin_read16(DMA12_Y_COUNT)
845#define bfin_write_DMA12_Y_COUNT(val) bfin_write16(DMA12_Y_COUNT, val)
846#define bfin_read_DMA12_Y_MODIFY() bfin_read16(DMA12_Y_MODIFY)
847#define bfin_write_DMA12_Y_MODIFY(val) bfin_write16(DMA12_Y_MODIFY, val)
848#define bfin_read_DMA12_CURR_DESC_PTR() bfin_readPTR(DMA12_CURR_DESC_PTR)
849#define bfin_write_DMA12_CURR_DESC_PTR(val) bfin_writePTR(DMA12_CURR_DESC_PTR, val)
850#define bfin_read_DMA12_CURR_ADDR() bfin_readPTR(DMA12_CURR_ADDR)
851#define bfin_write_DMA12_CURR_ADDR(val) bfin_writePTR(DMA12_CURR_ADDR, val)
852#define bfin_read_DMA12_IRQ_STATUS() bfin_read16(DMA12_IRQ_STATUS)
853#define bfin_write_DMA12_IRQ_STATUS(val) bfin_write16(DMA12_IRQ_STATUS, val)
854#define bfin_read_DMA12_PERIPHERAL_MAP() bfin_read16(DMA12_PERIPHERAL_MAP)
855#define bfin_write_DMA12_PERIPHERAL_MAP(val) bfin_write16(DMA12_PERIPHERAL_MAP, val)
856#define bfin_read_DMA12_CURR_X_COUNT() bfin_read16(DMA12_CURR_X_COUNT)
857#define bfin_write_DMA12_CURR_X_COUNT(val) bfin_write16(DMA12_CURR_X_COUNT, val)
858#define bfin_read_DMA12_CURR_Y_COUNT() bfin_read16(DMA12_CURR_Y_COUNT)
859#define bfin_write_DMA12_CURR_Y_COUNT(val) bfin_write16(DMA12_CURR_Y_COUNT, val)
860#define bfin_read_DMA13_NEXT_DESC_PTR() bfin_readPTR(DMA13_NEXT_DESC_PTR)
861#define bfin_write_DMA13_NEXT_DESC_PTR(val) bfin_writePTR(DMA13_NEXT_DESC_PTR, val)
862#define bfin_read_DMA13_START_ADDR() bfin_readPTR(DMA13_START_ADDR)
863#define bfin_write_DMA13_START_ADDR(val) bfin_writePTR(DMA13_START_ADDR, val)
864#define bfin_read_DMA13_CONFIG() bfin_read16(DMA13_CONFIG)
865#define bfin_write_DMA13_CONFIG(val) bfin_write16(DMA13_CONFIG, val)
866#define bfin_read_DMA13_X_COUNT() bfin_read16(DMA13_X_COUNT)
867#define bfin_write_DMA13_X_COUNT(val) bfin_write16(DMA13_X_COUNT, val)
868#define bfin_read_DMA13_X_MODIFY() bfin_read16(DMA13_X_MODIFY)
869#define bfin_write_DMA13_X_MODIFY(val) bfin_write16(DMA13_X_MODIFY, val)
870#define bfin_read_DMA13_Y_COUNT() bfin_read16(DMA13_Y_COUNT)
871#define bfin_write_DMA13_Y_COUNT(val) bfin_write16(DMA13_Y_COUNT, val)
872#define bfin_read_DMA13_Y_MODIFY() bfin_read16(DMA13_Y_MODIFY)
873#define bfin_write_DMA13_Y_MODIFY(val) bfin_write16(DMA13_Y_MODIFY, val)
874#define bfin_read_DMA13_CURR_DESC_PTR() bfin_readPTR(DMA13_CURR_DESC_PTR)
875#define bfin_write_DMA13_CURR_DESC_PTR(val) bfin_writePTR(DMA13_CURR_DESC_PTR, val)
876#define bfin_read_DMA13_CURR_ADDR() bfin_readPTR(DMA13_CURR_ADDR)
877#define bfin_write_DMA13_CURR_ADDR(val) bfin_writePTR(DMA13_CURR_ADDR, val)
878#define bfin_read_DMA13_IRQ_STATUS() bfin_read16(DMA13_IRQ_STATUS)
879#define bfin_write_DMA13_IRQ_STATUS(val) bfin_write16(DMA13_IRQ_STATUS, val)
880#define bfin_read_DMA13_PERIPHERAL_MAP() bfin_read16(DMA13_PERIPHERAL_MAP)
881#define bfin_write_DMA13_PERIPHERAL_MAP(val) bfin_write16(DMA13_PERIPHERAL_MAP, val)
882#define bfin_read_DMA13_CURR_X_COUNT() bfin_read16(DMA13_CURR_X_COUNT)
883#define bfin_write_DMA13_CURR_X_COUNT(val) bfin_write16(DMA13_CURR_X_COUNT, val)
884#define bfin_read_DMA13_CURR_Y_COUNT() bfin_read16(DMA13_CURR_Y_COUNT)
885#define bfin_write_DMA13_CURR_Y_COUNT(val) bfin_write16(DMA13_CURR_Y_COUNT, val)
886#define bfin_read_DMA14_NEXT_DESC_PTR() bfin_readPTR(DMA14_NEXT_DESC_PTR)
887#define bfin_write_DMA14_NEXT_DESC_PTR(val) bfin_writePTR(DMA14_NEXT_DESC_PTR, val)
888#define bfin_read_DMA14_START_ADDR() bfin_readPTR(DMA14_START_ADDR)
889#define bfin_write_DMA14_START_ADDR(val) bfin_writePTR(DMA14_START_ADDR, val)
890#define bfin_read_DMA14_CONFIG() bfin_read16(DMA14_CONFIG)
891#define bfin_write_DMA14_CONFIG(val) bfin_write16(DMA14_CONFIG, val)
892#define bfin_read_DMA14_X_COUNT() bfin_read16(DMA14_X_COUNT)
893#define bfin_write_DMA14_X_COUNT(val) bfin_write16(DMA14_X_COUNT, val)
894#define bfin_read_DMA14_X_MODIFY() bfin_read16(DMA14_X_MODIFY)
895#define bfin_write_DMA14_X_MODIFY(val) bfin_write16(DMA14_X_MODIFY, val)
896#define bfin_read_DMA14_Y_COUNT() bfin_read16(DMA14_Y_COUNT)
897#define bfin_write_DMA14_Y_COUNT(val) bfin_write16(DMA14_Y_COUNT, val)
898#define bfin_read_DMA14_Y_MODIFY() bfin_read16(DMA14_Y_MODIFY)
899#define bfin_write_DMA14_Y_MODIFY(val) bfin_write16(DMA14_Y_MODIFY, val)
900#define bfin_read_DMA14_CURR_DESC_PTR() bfin_readPTR(DMA14_CURR_DESC_PTR)
901#define bfin_write_DMA14_CURR_DESC_PTR(val) bfin_writePTR(DMA14_CURR_DESC_PTR, val)
902#define bfin_read_DMA14_CURR_ADDR() bfin_readPTR(DMA14_CURR_ADDR)
903#define bfin_write_DMA14_CURR_ADDR(val) bfin_writePTR(DMA14_CURR_ADDR, val)
904#define bfin_read_DMA14_IRQ_STATUS() bfin_read16(DMA14_IRQ_STATUS)
905#define bfin_write_DMA14_IRQ_STATUS(val) bfin_write16(DMA14_IRQ_STATUS, val)
906#define bfin_read_DMA14_PERIPHERAL_MAP() bfin_read16(DMA14_PERIPHERAL_MAP)
907#define bfin_write_DMA14_PERIPHERAL_MAP(val) bfin_write16(DMA14_PERIPHERAL_MAP, val)
908#define bfin_read_DMA14_CURR_X_COUNT() bfin_read16(DMA14_CURR_X_COUNT)
909#define bfin_write_DMA14_CURR_X_COUNT(val) bfin_write16(DMA14_CURR_X_COUNT, val)
910#define bfin_read_DMA14_CURR_Y_COUNT() bfin_read16(DMA14_CURR_Y_COUNT)
911#define bfin_write_DMA14_CURR_Y_COUNT(val) bfin_write16(DMA14_CURR_Y_COUNT, val)
912#define bfin_read_DMA15_NEXT_DESC_PTR() bfin_readPTR(DMA15_NEXT_DESC_PTR)
913#define bfin_write_DMA15_NEXT_DESC_PTR(val) bfin_writePTR(DMA15_NEXT_DESC_PTR, val)
914#define bfin_read_DMA15_START_ADDR() bfin_readPTR(DMA15_START_ADDR)
915#define bfin_write_DMA15_START_ADDR(val) bfin_writePTR(DMA15_START_ADDR, val)
916#define bfin_read_DMA15_CONFIG() bfin_read16(DMA15_CONFIG)
917#define bfin_write_DMA15_CONFIG(val) bfin_write16(DMA15_CONFIG, val)
918#define bfin_read_DMA15_X_COUNT() bfin_read16(DMA15_X_COUNT)
919#define bfin_write_DMA15_X_COUNT(val) bfin_write16(DMA15_X_COUNT, val)
920#define bfin_read_DMA15_X_MODIFY() bfin_read16(DMA15_X_MODIFY)
921#define bfin_write_DMA15_X_MODIFY(val) bfin_write16(DMA15_X_MODIFY, val)
922#define bfin_read_DMA15_Y_COUNT() bfin_read16(DMA15_Y_COUNT)
923#define bfin_write_DMA15_Y_COUNT(val) bfin_write16(DMA15_Y_COUNT, val)
924#define bfin_read_DMA15_Y_MODIFY() bfin_read16(DMA15_Y_MODIFY)
925#define bfin_write_DMA15_Y_MODIFY(val) bfin_write16(DMA15_Y_MODIFY, val)
926#define bfin_read_DMA15_CURR_DESC_PTR() bfin_readPTR(DMA15_CURR_DESC_PTR)
927#define bfin_write_DMA15_CURR_DESC_PTR(val) bfin_writePTR(DMA15_CURR_DESC_PTR, val)
928#define bfin_read_DMA15_CURR_ADDR() bfin_readPTR(DMA15_CURR_ADDR)
929#define bfin_write_DMA15_CURR_ADDR(val) bfin_writePTR(DMA15_CURR_ADDR, val)
930#define bfin_read_DMA15_IRQ_STATUS() bfin_read16(DMA15_IRQ_STATUS)
931#define bfin_write_DMA15_IRQ_STATUS(val) bfin_write16(DMA15_IRQ_STATUS, val)
932#define bfin_read_DMA15_PERIPHERAL_MAP() bfin_read16(DMA15_PERIPHERAL_MAP)
933#define bfin_write_DMA15_PERIPHERAL_MAP(val) bfin_write16(DMA15_PERIPHERAL_MAP, val)
934#define bfin_read_DMA15_CURR_X_COUNT() bfin_read16(DMA15_CURR_X_COUNT)
935#define bfin_write_DMA15_CURR_X_COUNT(val) bfin_write16(DMA15_CURR_X_COUNT, val)
936#define bfin_read_DMA15_CURR_Y_COUNT() bfin_read16(DMA15_CURR_Y_COUNT)
937#define bfin_write_DMA15_CURR_Y_COUNT(val) bfin_write16(DMA15_CURR_Y_COUNT, val)
938#define bfin_read_DMA16_NEXT_DESC_PTR() bfin_readPTR(DMA16_NEXT_DESC_PTR)
939#define bfin_write_DMA16_NEXT_DESC_PTR(val) bfin_writePTR(DMA16_NEXT_DESC_PTR, val)
940#define bfin_read_DMA16_START_ADDR() bfin_readPTR(DMA16_START_ADDR)
941#define bfin_write_DMA16_START_ADDR(val) bfin_writePTR(DMA16_START_ADDR, val)
942#define bfin_read_DMA16_CONFIG() bfin_read16(DMA16_CONFIG)
943#define bfin_write_DMA16_CONFIG(val) bfin_write16(DMA16_CONFIG, val)
944#define bfin_read_DMA16_X_COUNT() bfin_read16(DMA16_X_COUNT)
945#define bfin_write_DMA16_X_COUNT(val) bfin_write16(DMA16_X_COUNT, val)
946#define bfin_read_DMA16_X_MODIFY() bfin_read16(DMA16_X_MODIFY)
947#define bfin_write_DMA16_X_MODIFY(val) bfin_write16(DMA16_X_MODIFY, val)
948#define bfin_read_DMA16_Y_COUNT() bfin_read16(DMA16_Y_COUNT)
949#define bfin_write_DMA16_Y_COUNT(val) bfin_write16(DMA16_Y_COUNT, val)
950#define bfin_read_DMA16_Y_MODIFY() bfin_read16(DMA16_Y_MODIFY)
951#define bfin_write_DMA16_Y_MODIFY(val) bfin_write16(DMA16_Y_MODIFY, val)
952#define bfin_read_DMA16_CURR_DESC_PTR() bfin_readPTR(DMA16_CURR_DESC_PTR)
953#define bfin_write_DMA16_CURR_DESC_PTR(val) bfin_writePTR(DMA16_CURR_DESC_PTR, val)
954#define bfin_read_DMA16_CURR_ADDR() bfin_readPTR(DMA16_CURR_ADDR)
955#define bfin_write_DMA16_CURR_ADDR(val) bfin_writePTR(DMA16_CURR_ADDR, val)
956#define bfin_read_DMA16_IRQ_STATUS() bfin_read16(DMA16_IRQ_STATUS)
957#define bfin_write_DMA16_IRQ_STATUS(val) bfin_write16(DMA16_IRQ_STATUS, val)
958#define bfin_read_DMA16_PERIPHERAL_MAP() bfin_read16(DMA16_PERIPHERAL_MAP)
959#define bfin_write_DMA16_PERIPHERAL_MAP(val) bfin_write16(DMA16_PERIPHERAL_MAP, val)
960#define bfin_read_DMA16_CURR_X_COUNT() bfin_read16(DMA16_CURR_X_COUNT)
961#define bfin_write_DMA16_CURR_X_COUNT(val) bfin_write16(DMA16_CURR_X_COUNT, val)
962#define bfin_read_DMA16_CURR_Y_COUNT() bfin_read16(DMA16_CURR_Y_COUNT)
963#define bfin_write_DMA16_CURR_Y_COUNT(val) bfin_write16(DMA16_CURR_Y_COUNT, val)
964#define bfin_read_DMA17_NEXT_DESC_PTR() bfin_readPTR(DMA17_NEXT_DESC_PTR)
965#define bfin_write_DMA17_NEXT_DESC_PTR(val) bfin_writePTR(DMA17_NEXT_DESC_PTR, val)
966#define bfin_read_DMA17_START_ADDR() bfin_readPTR(DMA17_START_ADDR)
967#define bfin_write_DMA17_START_ADDR(val) bfin_writePTR(DMA17_START_ADDR, val)
968#define bfin_read_DMA17_CONFIG() bfin_read16(DMA17_CONFIG)
969#define bfin_write_DMA17_CONFIG(val) bfin_write16(DMA17_CONFIG, val)
970#define bfin_read_DMA17_X_COUNT() bfin_read16(DMA17_X_COUNT)
971#define bfin_write_DMA17_X_COUNT(val) bfin_write16(DMA17_X_COUNT, val)
972#define bfin_read_DMA17_X_MODIFY() bfin_read16(DMA17_X_MODIFY)
973#define bfin_write_DMA17_X_MODIFY(val) bfin_write16(DMA17_X_MODIFY, val)
974#define bfin_read_DMA17_Y_COUNT() bfin_read16(DMA17_Y_COUNT)
975#define bfin_write_DMA17_Y_COUNT(val) bfin_write16(DMA17_Y_COUNT, val)
976#define bfin_read_DMA17_Y_MODIFY() bfin_read16(DMA17_Y_MODIFY)
977#define bfin_write_DMA17_Y_MODIFY(val) bfin_write16(DMA17_Y_MODIFY, val)
978#define bfin_read_DMA17_CURR_DESC_PTR() bfin_readPTR(DMA17_CURR_DESC_PTR)
979#define bfin_write_DMA17_CURR_DESC_PTR(val) bfin_writePTR(DMA17_CURR_DESC_PTR, val)
980#define bfin_read_DMA17_CURR_ADDR() bfin_readPTR(DMA17_CURR_ADDR)
981#define bfin_write_DMA17_CURR_ADDR(val) bfin_writePTR(DMA17_CURR_ADDR, val)
982#define bfin_read_DMA17_IRQ_STATUS() bfin_read16(DMA17_IRQ_STATUS)
983#define bfin_write_DMA17_IRQ_STATUS(val) bfin_write16(DMA17_IRQ_STATUS, val)
984#define bfin_read_DMA17_PERIPHERAL_MAP() bfin_read16(DMA17_PERIPHERAL_MAP)
985#define bfin_write_DMA17_PERIPHERAL_MAP(val) bfin_write16(DMA17_PERIPHERAL_MAP, val)
986#define bfin_read_DMA17_CURR_X_COUNT() bfin_read16(DMA17_CURR_X_COUNT)
987#define bfin_write_DMA17_CURR_X_COUNT(val) bfin_write16(DMA17_CURR_X_COUNT, val)
988#define bfin_read_DMA17_CURR_Y_COUNT() bfin_read16(DMA17_CURR_Y_COUNT)
989#define bfin_write_DMA17_CURR_Y_COUNT(val) bfin_write16(DMA17_CURR_Y_COUNT, val)
990#define bfin_read_DMA18_NEXT_DESC_PTR() bfin_readPTR(DMA18_NEXT_DESC_PTR)
991#define bfin_write_DMA18_NEXT_DESC_PTR(val) bfin_writePTR(DMA18_NEXT_DESC_PTR, val)
992#define bfin_read_DMA18_START_ADDR() bfin_readPTR(DMA18_START_ADDR)
993#define bfin_write_DMA18_START_ADDR(val) bfin_writePTR(DMA18_START_ADDR, val)
994#define bfin_read_DMA18_CONFIG() bfin_read16(DMA18_CONFIG)
995#define bfin_write_DMA18_CONFIG(val) bfin_write16(DMA18_CONFIG, val)
996#define bfin_read_DMA18_X_COUNT() bfin_read16(DMA18_X_COUNT)
997#define bfin_write_DMA18_X_COUNT(val) bfin_write16(DMA18_X_COUNT, val)
998#define bfin_read_DMA18_X_MODIFY() bfin_read16(DMA18_X_MODIFY)
999#define bfin_write_DMA18_X_MODIFY(val) bfin_write16(DMA18_X_MODIFY, val)
1000#define bfin_read_DMA18_Y_COUNT() bfin_read16(DMA18_Y_COUNT)
1001#define bfin_write_DMA18_Y_COUNT(val) bfin_write16(DMA18_Y_COUNT, val)
1002#define bfin_read_DMA18_Y_MODIFY() bfin_read16(DMA18_Y_MODIFY)
1003#define bfin_write_DMA18_Y_MODIFY(val) bfin_write16(DMA18_Y_MODIFY, val)
1004#define bfin_read_DMA18_CURR_DESC_PTR() bfin_readPTR(DMA18_CURR_DESC_PTR)
1005#define bfin_write_DMA18_CURR_DESC_PTR(val) bfin_writePTR(DMA18_CURR_DESC_PTR, val)
1006#define bfin_read_DMA18_CURR_ADDR() bfin_readPTR(DMA18_CURR_ADDR)
1007#define bfin_write_DMA18_CURR_ADDR(val) bfin_writePTR(DMA18_CURR_ADDR, val)
1008#define bfin_read_DMA18_IRQ_STATUS() bfin_read16(DMA18_IRQ_STATUS)
1009#define bfin_write_DMA18_IRQ_STATUS(val) bfin_write16(DMA18_IRQ_STATUS, val)
1010#define bfin_read_DMA18_PERIPHERAL_MAP() bfin_read16(DMA18_PERIPHERAL_MAP)
1011#define bfin_write_DMA18_PERIPHERAL_MAP(val) bfin_write16(DMA18_PERIPHERAL_MAP, val)
1012#define bfin_read_DMA18_CURR_X_COUNT() bfin_read16(DMA18_CURR_X_COUNT)
1013#define bfin_write_DMA18_CURR_X_COUNT(val) bfin_write16(DMA18_CURR_X_COUNT, val)
1014#define bfin_read_DMA18_CURR_Y_COUNT() bfin_read16(DMA18_CURR_Y_COUNT)
1015#define bfin_write_DMA18_CURR_Y_COUNT(val) bfin_write16(DMA18_CURR_Y_COUNT, val)
1016#define bfin_read_DMA19_NEXT_DESC_PTR() bfin_readPTR(DMA19_NEXT_DESC_PTR)
1017#define bfin_write_DMA19_NEXT_DESC_PTR(val) bfin_writePTR(DMA19_NEXT_DESC_PTR, val)
1018#define bfin_read_DMA19_START_ADDR() bfin_readPTR(DMA19_START_ADDR)
1019#define bfin_write_DMA19_START_ADDR(val) bfin_writePTR(DMA19_START_ADDR, val)
1020#define bfin_read_DMA19_CONFIG() bfin_read16(DMA19_CONFIG)
1021#define bfin_write_DMA19_CONFIG(val) bfin_write16(DMA19_CONFIG, val)
1022#define bfin_read_DMA19_X_COUNT() bfin_read16(DMA19_X_COUNT)
1023#define bfin_write_DMA19_X_COUNT(val) bfin_write16(DMA19_X_COUNT, val)
1024#define bfin_read_DMA19_X_MODIFY() bfin_read16(DMA19_X_MODIFY)
1025#define bfin_write_DMA19_X_MODIFY(val) bfin_write16(DMA19_X_MODIFY, val)
1026#define bfin_read_DMA19_Y_COUNT() bfin_read16(DMA19_Y_COUNT)
1027#define bfin_write_DMA19_Y_COUNT(val) bfin_write16(DMA19_Y_COUNT, val)
1028#define bfin_read_DMA19_Y_MODIFY() bfin_read16(DMA19_Y_MODIFY)
1029#define bfin_write_DMA19_Y_MODIFY(val) bfin_write16(DMA19_Y_MODIFY, val)
1030#define bfin_read_DMA19_CURR_DESC_PTR() bfin_readPTR(DMA19_CURR_DESC_PTR)
1031#define bfin_write_DMA19_CURR_DESC_PTR(val) bfin_writePTR(DMA19_CURR_DESC_PTR, val)
1032#define bfin_read_DMA19_CURR_ADDR() bfin_readPTR(DMA19_CURR_ADDR)
1033#define bfin_write_DMA19_CURR_ADDR(val) bfin_writePTR(DMA19_CURR_ADDR, val)
1034#define bfin_read_DMA19_IRQ_STATUS() bfin_read16(DMA19_IRQ_STATUS)
1035#define bfin_write_DMA19_IRQ_STATUS(val) bfin_write16(DMA19_IRQ_STATUS, val)
1036#define bfin_read_DMA19_PERIPHERAL_MAP() bfin_read16(DMA19_PERIPHERAL_MAP)
1037#define bfin_write_DMA19_PERIPHERAL_MAP(val) bfin_write16(DMA19_PERIPHERAL_MAP, val)
1038#define bfin_read_DMA19_CURR_X_COUNT() bfin_read16(DMA19_CURR_X_COUNT)
1039#define bfin_write_DMA19_CURR_X_COUNT(val) bfin_write16(DMA19_CURR_X_COUNT, val)
1040#define bfin_read_DMA19_CURR_Y_COUNT() bfin_read16(DMA19_CURR_Y_COUNT)
1041#define bfin_write_DMA19_CURR_Y_COUNT(val) bfin_write16(DMA19_CURR_Y_COUNT, val)
1042#define bfin_read_MDMA0_D0_NEXT_DESC_PTR() bfin_readPTR(MDMA0_D0_NEXT_DESC_PTR)
1043#define bfin_write_MDMA0_D0_NEXT_DESC_PTR(val) bfin_writePTR(MDMA0_D0_NEXT_DESC_PTR, val)
1044#define bfin_read_MDMA0_D0_START_ADDR() bfin_readPTR(MDMA0_D0_START_ADDR)
1045#define bfin_write_MDMA0_D0_START_ADDR(val) bfin_writePTR(MDMA0_D0_START_ADDR, val)
1046#define bfin_read_MDMA0_D0_CONFIG() bfin_read16(MDMA0_D0_CONFIG)
1047#define bfin_write_MDMA0_D0_CONFIG(val) bfin_write16(MDMA0_D0_CONFIG, val)
1048#define bfin_read_MDMA0_D0_X_COUNT() bfin_read16(MDMA0_D0_X_COUNT)
1049#define bfin_write_MDMA0_D0_X_COUNT(val) bfin_write16(MDMA0_D0_X_COUNT, val)
1050#define bfin_read_MDMA0_D0_X_MODIFY() bfin_read16(MDMA0_D0_X_MODIFY)
1051#define bfin_write_MDMA0_D0_X_MODIFY(val) bfin_write16(MDMA0_D0_X_MODIFY, val)
1052#define bfin_read_MDMA0_D0_Y_COUNT() bfin_read16(MDMA0_D0_Y_COUNT)
1053#define bfin_write_MDMA0_D0_Y_COUNT(val) bfin_write16(MDMA0_D0_Y_COUNT, val)
1054#define bfin_read_MDMA0_D0_Y_MODIFY() bfin_read16(MDMA0_D0_Y_MODIFY)
1055#define bfin_write_MDMA0_D0_Y_MODIFY(val) bfin_write16(MDMA0_D0_Y_MODIFY, val)
1056#define bfin_read_MDMA0_D0_CURR_DESC_PTR() bfin_readPTR(MDMA0_D0_CURR_DESC_PTR)
1057#define bfin_write_MDMA0_D0_CURR_DESC_PTR(val) bfin_writePTR(MDMA0_D0_CURR_DESC_PTR, val)
1058#define bfin_read_MDMA0_D0_CURR_ADDR() bfin_readPTR(MDMA0_D0_CURR_ADDR)
1059#define bfin_write_MDMA0_D0_CURR_ADDR(val) bfin_writePTR(MDMA0_D0_CURR_ADDR, val)
1060#define bfin_read_MDMA0_D0_IRQ_STATUS() bfin_read16(MDMA0_D0_IRQ_STATUS)
1061#define bfin_write_MDMA0_D0_IRQ_STATUS(val) bfin_write16(MDMA0_D0_IRQ_STATUS, val)
1062#define bfin_read_MDMA0_D0_PERIPHERAL_MAP() bfin_read16(MDMA0_D0_PERIPHERAL_MAP)
1063#define bfin_write_MDMA0_D0_PERIPHERAL_MAP(val) bfin_write16(MDMA0_D0_PERIPHERAL_MAP, val)
1064#define bfin_read_MDMA0_D0_CURR_X_COUNT() bfin_read16(MDMA0_D0_CURR_X_COUNT)
1065#define bfin_write_MDMA0_D0_CURR_X_COUNT(val) bfin_write16(MDMA0_D0_CURR_X_COUNT, val)
1066#define bfin_read_MDMA0_D0_CURR_Y_COUNT() bfin_read16(MDMA0_D0_CURR_Y_COUNT)
1067#define bfin_write_MDMA0_D0_CURR_Y_COUNT(val) bfin_write16(MDMA0_D0_CURR_Y_COUNT, val)
1068#define bfin_read_MDMA0_S0_NEXT_DESC_PTR() bfin_readPTR(MDMA0_S0_NEXT_DESC_PTR)
1069#define bfin_write_MDMA0_S0_NEXT_DESC_PTR(val) bfin_writePTR(MDMA0_S0_NEXT_DESC_PTR, val)
1070#define bfin_read_MDMA0_S0_START_ADDR() bfin_readPTR(MDMA0_S0_START_ADDR)
1071#define bfin_write_MDMA0_S0_START_ADDR(val) bfin_writePTR(MDMA0_S0_START_ADDR, val)
1072#define bfin_read_MDMA0_S0_CONFIG() bfin_read16(MDMA0_S0_CONFIG)
1073#define bfin_write_MDMA0_S0_CONFIG(val) bfin_write16(MDMA0_S0_CONFIG, val)
1074#define bfin_read_MDMA0_S0_X_COUNT() bfin_read16(MDMA0_S0_X_COUNT)
1075#define bfin_write_MDMA0_S0_X_COUNT(val) bfin_write16(MDMA0_S0_X_COUNT, val)
1076#define bfin_read_MDMA0_S0_X_MODIFY() bfin_read16(MDMA0_S0_X_MODIFY)
1077#define bfin_write_MDMA0_S0_X_MODIFY(val) bfin_write16(MDMA0_S0_X_MODIFY, val)
1078#define bfin_read_MDMA0_S0_Y_COUNT() bfin_read16(MDMA0_S0_Y_COUNT)
1079#define bfin_write_MDMA0_S0_Y_COUNT(val) bfin_write16(MDMA0_S0_Y_COUNT, val)
1080#define bfin_read_MDMA0_S0_Y_MODIFY() bfin_read16(MDMA0_S0_Y_MODIFY)
1081#define bfin_write_MDMA0_S0_Y_MODIFY(val) bfin_write16(MDMA0_S0_Y_MODIFY, val)
1082#define bfin_read_MDMA0_S0_CURR_DESC_PTR() bfin_readPTR(MDMA0_S0_CURR_DESC_PTR)
1083#define bfin_write_MDMA0_S0_CURR_DESC_PTR(val) bfin_writePTR(MDMA0_S0_CURR_DESC_PTR, val)
1084#define bfin_read_MDMA0_S0_CURR_ADDR() bfin_readPTR(MDMA0_S0_CURR_ADDR)
1085#define bfin_write_MDMA0_S0_CURR_ADDR(val) bfin_writePTR(MDMA0_S0_CURR_ADDR, val)
1086#define bfin_read_MDMA0_S0_IRQ_STATUS() bfin_read16(MDMA0_S0_IRQ_STATUS)
1087#define bfin_write_MDMA0_S0_IRQ_STATUS(val) bfin_write16(MDMA0_S0_IRQ_STATUS, val)
1088#define bfin_read_MDMA0_S0_PERIPHERAL_MAP() bfin_read16(MDMA0_S0_PERIPHERAL_MAP)
1089#define bfin_write_MDMA0_S0_PERIPHERAL_MAP(val) bfin_write16(MDMA0_S0_PERIPHERAL_MAP, val)
1090#define bfin_read_MDMA0_S0_CURR_X_COUNT() bfin_read16(MDMA0_S0_CURR_X_COUNT)
1091#define bfin_write_MDMA0_S0_CURR_X_COUNT(val) bfin_write16(MDMA0_S0_CURR_X_COUNT, val)
1092#define bfin_read_MDMA0_S0_CURR_Y_COUNT() bfin_read16(MDMA0_S0_CURR_Y_COUNT)
1093#define bfin_write_MDMA0_S0_CURR_Y_COUNT(val) bfin_write16(MDMA0_S0_CURR_Y_COUNT, val)
1094#define bfin_read_MDMA0_D1_NEXT_DESC_PTR() bfin_readPTR(MDMA0_D1_NEXT_DESC_PTR)
1095#define bfin_write_MDMA0_D1_NEXT_DESC_PTR(val) bfin_writePTR(MDMA0_D1_NEXT_DESC_PTR, val)
1096#define bfin_read_MDMA0_D1_START_ADDR() bfin_readPTR(MDMA0_D1_START_ADDR)
1097#define bfin_write_MDMA0_D1_START_ADDR(val) bfin_writePTR(MDMA0_D1_START_ADDR, val)
1098#define bfin_read_MDMA0_D1_CONFIG() bfin_read16(MDMA0_D1_CONFIG)
1099#define bfin_write_MDMA0_D1_CONFIG(val) bfin_write16(MDMA0_D1_CONFIG, val)
1100#define bfin_read_MDMA0_D1_X_COUNT() bfin_read16(MDMA0_D1_X_COUNT)
1101#define bfin_write_MDMA0_D1_X_COUNT(val) bfin_write16(MDMA0_D1_X_COUNT, val)
1102#define bfin_read_MDMA0_D1_X_MODIFY() bfin_read16(MDMA0_D1_X_MODIFY)
1103#define bfin_write_MDMA0_D1_X_MODIFY(val) bfin_write16(MDMA0_D1_X_MODIFY, val)
1104#define bfin_read_MDMA0_D1_Y_COUNT() bfin_read16(MDMA0_D1_Y_COUNT)
1105#define bfin_write_MDMA0_D1_Y_COUNT(val) bfin_write16(MDMA0_D1_Y_COUNT, val)
1106#define bfin_read_MDMA0_D1_Y_MODIFY() bfin_read16(MDMA0_D1_Y_MODIFY)
1107#define bfin_write_MDMA0_D1_Y_MODIFY(val) bfin_write16(MDMA0_D1_Y_MODIFY, val)
1108#define bfin_read_MDMA0_D1_CURR_DESC_PTR() bfin_readPTR(MDMA0_D1_CURR_DESC_PTR)
1109#define bfin_write_MDMA0_D1_CURR_DESC_PTR(val) bfin_writePTR(MDMA0_D1_CURR_DESC_PTR, val)
1110#define bfin_read_MDMA0_D1_CURR_ADDR() bfin_readPTR(MDMA0_D1_CURR_ADDR)
1111#define bfin_write_MDMA0_D1_CURR_ADDR(val) bfin_writePTR(MDMA0_D1_CURR_ADDR, val)
1112#define bfin_read_MDMA0_D1_IRQ_STATUS() bfin_read16(MDMA0_D1_IRQ_STATUS)
1113#define bfin_write_MDMA0_D1_IRQ_STATUS(val) bfin_write16(MDMA0_D1_IRQ_STATUS, val)
1114#define bfin_read_MDMA0_D1_PERIPHERAL_MAP() bfin_read16(MDMA0_D1_PERIPHERAL_MAP)
1115#define bfin_write_MDMA0_D1_PERIPHERAL_MAP(val) bfin_write16(MDMA0_D1_PERIPHERAL_MAP, val)
1116#define bfin_read_MDMA0_D1_CURR_X_COUNT() bfin_read16(MDMA0_D1_CURR_X_COUNT)
1117#define bfin_write_MDMA0_D1_CURR_X_COUNT(val) bfin_write16(MDMA0_D1_CURR_X_COUNT, val)
1118#define bfin_read_MDMA0_D1_CURR_Y_COUNT() bfin_read16(MDMA0_D1_CURR_Y_COUNT)
1119#define bfin_write_MDMA0_D1_CURR_Y_COUNT(val) bfin_write16(MDMA0_D1_CURR_Y_COUNT, val)
1120#define bfin_read_MDMA0_S1_NEXT_DESC_PTR() bfin_readPTR(MDMA0_S1_NEXT_DESC_PTR)
1121#define bfin_write_MDMA0_S1_NEXT_DESC_PTR(val) bfin_writePTR(MDMA0_S1_NEXT_DESC_PTR, val)
1122#define bfin_read_MDMA0_S1_START_ADDR() bfin_readPTR(MDMA0_S1_START_ADDR)
1123#define bfin_write_MDMA0_S1_START_ADDR(val) bfin_writePTR(MDMA0_S1_START_ADDR, val)
1124#define bfin_read_MDMA0_S1_CONFIG() bfin_read16(MDMA0_S1_CONFIG)
1125#define bfin_write_MDMA0_S1_CONFIG(val) bfin_write16(MDMA0_S1_CONFIG, val)
1126#define bfin_read_MDMA0_S1_X_COUNT() bfin_read16(MDMA0_S1_X_COUNT)
1127#define bfin_write_MDMA0_S1_X_COUNT(val) bfin_write16(MDMA0_S1_X_COUNT, val)
1128#define bfin_read_MDMA0_S1_X_MODIFY() bfin_read16(MDMA0_S1_X_MODIFY)
1129#define bfin_write_MDMA0_S1_X_MODIFY(val) bfin_write16(MDMA0_S1_X_MODIFY, val)
1130#define bfin_read_MDMA0_S1_Y_COUNT() bfin_read16(MDMA0_S1_Y_COUNT)
1131#define bfin_write_MDMA0_S1_Y_COUNT(val) bfin_write16(MDMA0_S1_Y_COUNT, val)
1132#define bfin_read_MDMA0_S1_Y_MODIFY() bfin_read16(MDMA0_S1_Y_MODIFY)
1133#define bfin_write_MDMA0_S1_Y_MODIFY(val) bfin_write16(MDMA0_S1_Y_MODIFY, val)
1134#define bfin_read_MDMA0_S1_CURR_DESC_PTR() bfin_readPTR(MDMA0_S1_CURR_DESC_PTR)
1135#define bfin_write_MDMA0_S1_CURR_DESC_PTR(val) bfin_writePTR(MDMA0_S1_CURR_DESC_PTR, val)
1136#define bfin_read_MDMA0_S1_CURR_ADDR() bfin_readPTR(MDMA0_S1_CURR_ADDR)
1137#define bfin_write_MDMA0_S1_CURR_ADDR(val) bfin_writePTR(MDMA0_S1_CURR_ADDR, val)
1138#define bfin_read_MDMA0_S1_IRQ_STATUS() bfin_read16(MDMA0_S1_IRQ_STATUS)
1139#define bfin_write_MDMA0_S1_IRQ_STATUS(val) bfin_write16(MDMA0_S1_IRQ_STATUS, val)
1140#define bfin_read_MDMA0_S1_PERIPHERAL_MAP() bfin_read16(MDMA0_S1_PERIPHERAL_MAP)
1141#define bfin_write_MDMA0_S1_PERIPHERAL_MAP(val) bfin_write16(MDMA0_S1_PERIPHERAL_MAP, val)
1142#define bfin_read_MDMA0_S1_CURR_X_COUNT() bfin_read16(MDMA0_S1_CURR_X_COUNT)
1143#define bfin_write_MDMA0_S1_CURR_X_COUNT(val) bfin_write16(MDMA0_S1_CURR_X_COUNT, val)
1144#define bfin_read_MDMA0_S1_CURR_Y_COUNT() bfin_read16(MDMA0_S1_CURR_Y_COUNT)
1145#define bfin_write_MDMA0_S1_CURR_Y_COUNT(val) bfin_write16(MDMA0_S1_CURR_Y_COUNT, val)
1146#define bfin_read_MDMA1_D0_NEXT_DESC_PTR() bfin_readPTR(MDMA1_D0_NEXT_DESC_PTR)
1147#define bfin_write_MDMA1_D0_NEXT_DESC_PTR(val) bfin_writePTR(MDMA1_D0_NEXT_DESC_PTR, val)
1148#define bfin_read_MDMA1_D0_START_ADDR() bfin_readPTR(MDMA1_D0_START_ADDR)
1149#define bfin_write_MDMA1_D0_START_ADDR(val) bfin_writePTR(MDMA1_D0_START_ADDR, val)
1150#define bfin_read_MDMA1_D0_CONFIG() bfin_read16(MDMA1_D0_CONFIG)
1151#define bfin_write_MDMA1_D0_CONFIG(val) bfin_write16(MDMA1_D0_CONFIG, val)
1152#define bfin_read_MDMA1_D0_X_COUNT() bfin_read16(MDMA1_D0_X_COUNT)
1153#define bfin_write_MDMA1_D0_X_COUNT(val) bfin_write16(MDMA1_D0_X_COUNT, val)
1154#define bfin_read_MDMA1_D0_X_MODIFY() bfin_read16(MDMA1_D0_X_MODIFY)
1155#define bfin_write_MDMA1_D0_X_MODIFY(val) bfin_write16(MDMA1_D0_X_MODIFY, val)
1156#define bfin_read_MDMA1_D0_Y_COUNT() bfin_read16(MDMA1_D0_Y_COUNT)
1157#define bfin_write_MDMA1_D0_Y_COUNT(val) bfin_write16(MDMA1_D0_Y_COUNT, val)
1158#define bfin_read_MDMA1_D0_Y_MODIFY() bfin_read16(MDMA1_D0_Y_MODIFY)
1159#define bfin_write_MDMA1_D0_Y_MODIFY(val) bfin_write16(MDMA1_D0_Y_MODIFY, val)
1160#define bfin_read_MDMA1_D0_CURR_DESC_PTR() bfin_readPTR(MDMA1_D0_CURR_DESC_PTR)
1161#define bfin_write_MDMA1_D0_CURR_DESC_PTR(val) bfin_writePTR(MDMA1_D0_CURR_DESC_PTR, val)
1162#define bfin_read_MDMA1_D0_CURR_ADDR() bfin_readPTR(MDMA1_D0_CURR_ADDR)
1163#define bfin_write_MDMA1_D0_CURR_ADDR(val) bfin_writePTR(MDMA1_D0_CURR_ADDR, val)
1164#define bfin_read_MDMA1_D0_IRQ_STATUS() bfin_read16(MDMA1_D0_IRQ_STATUS)
1165#define bfin_write_MDMA1_D0_IRQ_STATUS(val) bfin_write16(MDMA1_D0_IRQ_STATUS, val)
1166#define bfin_read_MDMA1_D0_PERIPHERAL_MAP() bfin_read16(MDMA1_D0_PERIPHERAL_MAP)
1167#define bfin_write_MDMA1_D0_PERIPHERAL_MAP(val) bfin_write16(MDMA1_D0_PERIPHERAL_MAP, val)
1168#define bfin_read_MDMA1_D0_CURR_X_COUNT() bfin_read16(MDMA1_D0_CURR_X_COUNT)
1169#define bfin_write_MDMA1_D0_CURR_X_COUNT(val) bfin_write16(MDMA1_D0_CURR_X_COUNT, val)
1170#define bfin_read_MDMA1_D0_CURR_Y_COUNT() bfin_read16(MDMA1_D0_CURR_Y_COUNT)
1171#define bfin_write_MDMA1_D0_CURR_Y_COUNT(val) bfin_write16(MDMA1_D0_CURR_Y_COUNT, val)
1172#define bfin_read_MDMA1_S0_NEXT_DESC_PTR() bfin_readPTR(MDMA1_S0_NEXT_DESC_PTR)
1173#define bfin_write_MDMA1_S0_NEXT_DESC_PTR(val) bfin_writePTR(MDMA1_S0_NEXT_DESC_PTR, val)
1174#define bfin_read_MDMA1_S0_START_ADDR() bfin_readPTR(MDMA1_S0_START_ADDR)
1175#define bfin_write_MDMA1_S0_START_ADDR(val) bfin_writePTR(MDMA1_S0_START_ADDR, val)
1176#define bfin_read_MDMA1_S0_CONFIG() bfin_read16(MDMA1_S0_CONFIG)
1177#define bfin_write_MDMA1_S0_CONFIG(val) bfin_write16(MDMA1_S0_CONFIG, val)
1178#define bfin_read_MDMA1_S0_X_COUNT() bfin_read16(MDMA1_S0_X_COUNT)
1179#define bfin_write_MDMA1_S0_X_COUNT(val) bfin_write16(MDMA1_S0_X_COUNT, val)
1180#define bfin_read_MDMA1_S0_X_MODIFY() bfin_read16(MDMA1_S0_X_MODIFY)
1181#define bfin_write_MDMA1_S0_X_MODIFY(val) bfin_write16(MDMA1_S0_X_MODIFY, val)
1182#define bfin_read_MDMA1_S0_Y_COUNT() bfin_read16(MDMA1_S0_Y_COUNT)
1183#define bfin_write_MDMA1_S0_Y_COUNT(val) bfin_write16(MDMA1_S0_Y_COUNT, val)
1184#define bfin_read_MDMA1_S0_Y_MODIFY() bfin_read16(MDMA1_S0_Y_MODIFY)
1185#define bfin_write_MDMA1_S0_Y_MODIFY(val) bfin_write16(MDMA1_S0_Y_MODIFY, val)
1186#define bfin_read_MDMA1_S0_CURR_DESC_PTR() bfin_readPTR(MDMA1_S0_CURR_DESC_PTR)
1187#define bfin_write_MDMA1_S0_CURR_DESC_PTR(val) bfin_writePTR(MDMA1_S0_CURR_DESC_PTR, val)
1188#define bfin_read_MDMA1_S0_CURR_ADDR() bfin_readPTR(MDMA1_S0_CURR_ADDR)
1189#define bfin_write_MDMA1_S0_CURR_ADDR(val) bfin_writePTR(MDMA1_S0_CURR_ADDR, val)
1190#define bfin_read_MDMA1_S0_IRQ_STATUS() bfin_read16(MDMA1_S0_IRQ_STATUS)
1191#define bfin_write_MDMA1_S0_IRQ_STATUS(val) bfin_write16(MDMA1_S0_IRQ_STATUS, val)
1192#define bfin_read_MDMA1_S0_PERIPHERAL_MAP() bfin_read16(MDMA1_S0_PERIPHERAL_MAP)
1193#define bfin_write_MDMA1_S0_PERIPHERAL_MAP(val) bfin_write16(MDMA1_S0_PERIPHERAL_MAP, val)
1194#define bfin_read_MDMA1_S0_CURR_X_COUNT() bfin_read16(MDMA1_S0_CURR_X_COUNT)
1195#define bfin_write_MDMA1_S0_CURR_X_COUNT(val) bfin_write16(MDMA1_S0_CURR_X_COUNT, val)
1196#define bfin_read_MDMA1_S0_CURR_Y_COUNT() bfin_read16(MDMA1_S0_CURR_Y_COUNT)
1197#define bfin_write_MDMA1_S0_CURR_Y_COUNT(val) bfin_write16(MDMA1_S0_CURR_Y_COUNT, val)
1198#define bfin_read_MDMA1_D1_NEXT_DESC_PTR() bfin_readPTR(MDMA1_D1_NEXT_DESC_PTR)
1199#define bfin_write_MDMA1_D1_NEXT_DESC_PTR(val) bfin_writePTR(MDMA1_D1_NEXT_DESC_PTR, val)
1200#define bfin_read_MDMA1_D1_START_ADDR() bfin_readPTR(MDMA1_D1_START_ADDR)
1201#define bfin_write_MDMA1_D1_START_ADDR(val) bfin_writePTR(MDMA1_D1_START_ADDR, val)
1202#define bfin_read_MDMA1_D1_CONFIG() bfin_read16(MDMA1_D1_CONFIG)
1203#define bfin_write_MDMA1_D1_CONFIG(val) bfin_write16(MDMA1_D1_CONFIG, val)
1204#define bfin_read_MDMA1_D1_X_COUNT() bfin_read16(MDMA1_D1_X_COUNT)
1205#define bfin_write_MDMA1_D1_X_COUNT(val) bfin_write16(MDMA1_D1_X_COUNT, val)
1206#define bfin_read_MDMA1_D1_X_MODIFY() bfin_read16(MDMA1_D1_X_MODIFY)
1207#define bfin_write_MDMA1_D1_X_MODIFY(val) bfin_write16(MDMA1_D1_X_MODIFY, val)
1208#define bfin_read_MDMA1_D1_Y_COUNT() bfin_read16(MDMA1_D1_Y_COUNT)
1209#define bfin_write_MDMA1_D1_Y_COUNT(val) bfin_write16(MDMA1_D1_Y_COUNT, val)
1210#define bfin_read_MDMA1_D1_Y_MODIFY() bfin_read16(MDMA1_D1_Y_MODIFY)
1211#define bfin_write_MDMA1_D1_Y_MODIFY(val) bfin_write16(MDMA1_D1_Y_MODIFY, val)
1212#define bfin_read_MDMA1_D1_CURR_DESC_PTR() bfin_readPTR(MDMA1_D1_CURR_DESC_PTR)
1213#define bfin_write_MDMA1_D1_CURR_DESC_PTR(val) bfin_writePTR(MDMA1_D1_CURR_DESC_PTR, val)
1214#define bfin_read_MDMA1_D1_CURR_ADDR() bfin_readPTR(MDMA1_D1_CURR_ADDR)
1215#define bfin_write_MDMA1_D1_CURR_ADDR(val) bfin_writePTR(MDMA1_D1_CURR_ADDR, val)
1216#define bfin_read_MDMA1_D1_IRQ_STATUS() bfin_read16(MDMA1_D1_IRQ_STATUS)
1217#define bfin_write_MDMA1_D1_IRQ_STATUS(val) bfin_write16(MDMA1_D1_IRQ_STATUS, val)
1218#define bfin_read_MDMA1_D1_PERIPHERAL_MAP() bfin_read16(MDMA1_D1_PERIPHERAL_MAP)
1219#define bfin_write_MDMA1_D1_PERIPHERAL_MAP(val) bfin_write16(MDMA1_D1_PERIPHERAL_MAP, val)
1220#define bfin_read_MDMA1_D1_CURR_X_COUNT() bfin_read16(MDMA1_D1_CURR_X_COUNT)
1221#define bfin_write_MDMA1_D1_CURR_X_COUNT(val) bfin_write16(MDMA1_D1_CURR_X_COUNT, val)
1222#define bfin_read_MDMA1_D1_CURR_Y_COUNT() bfin_read16(MDMA1_D1_CURR_Y_COUNT)
1223#define bfin_write_MDMA1_D1_CURR_Y_COUNT(val) bfin_write16(MDMA1_D1_CURR_Y_COUNT, val)
1224#define bfin_read_MDMA1_S1_NEXT_DESC_PTR() bfin_readPTR(MDMA1_S1_NEXT_DESC_PTR)
1225#define bfin_write_MDMA1_S1_NEXT_DESC_PTR(val) bfin_writePTR(MDMA1_S1_NEXT_DESC_PTR, val)
1226#define bfin_read_MDMA1_S1_START_ADDR() bfin_readPTR(MDMA1_S1_START_ADDR)
1227#define bfin_write_MDMA1_S1_START_ADDR(val) bfin_writePTR(MDMA1_S1_START_ADDR, val)
1228#define bfin_read_MDMA1_S1_CONFIG() bfin_read16(MDMA1_S1_CONFIG)
1229#define bfin_write_MDMA1_S1_CONFIG(val) bfin_write16(MDMA1_S1_CONFIG, val)
1230#define bfin_read_MDMA1_S1_X_COUNT() bfin_read16(MDMA1_S1_X_COUNT)
1231#define bfin_write_MDMA1_S1_X_COUNT(val) bfin_write16(MDMA1_S1_X_COUNT, val)
1232#define bfin_read_MDMA1_S1_X_MODIFY() bfin_read16(MDMA1_S1_X_MODIFY)
1233#define bfin_write_MDMA1_S1_X_MODIFY(val) bfin_write16(MDMA1_S1_X_MODIFY, val)
1234#define bfin_read_MDMA1_S1_Y_COUNT() bfin_read16(MDMA1_S1_Y_COUNT)
1235#define bfin_write_MDMA1_S1_Y_COUNT(val) bfin_write16(MDMA1_S1_Y_COUNT, val)
1236#define bfin_read_MDMA1_S1_Y_MODIFY() bfin_read16(MDMA1_S1_Y_MODIFY)
1237#define bfin_write_MDMA1_S1_Y_MODIFY(val) bfin_write16(MDMA1_S1_Y_MODIFY, val)
1238#define bfin_read_MDMA1_S1_CURR_DESC_PTR() bfin_readPTR(MDMA1_S1_CURR_DESC_PTR)
1239#define bfin_write_MDMA1_S1_CURR_DESC_PTR(val) bfin_writePTR(MDMA1_S1_CURR_DESC_PTR, val)
1240#define bfin_read_MDMA1_S1_CURR_ADDR() bfin_readPTR(MDMA1_S1_CURR_ADDR)
1241#define bfin_write_MDMA1_S1_CURR_ADDR(val) bfin_writePTR(MDMA1_S1_CURR_ADDR, val)
1242#define bfin_read_MDMA1_S1_IRQ_STATUS() bfin_read16(MDMA1_S1_IRQ_STATUS)
1243#define bfin_write_MDMA1_S1_IRQ_STATUS(val) bfin_write16(MDMA1_S1_IRQ_STATUS, val)
1244#define bfin_read_MDMA1_S1_PERIPHERAL_MAP() bfin_read16(MDMA1_S1_PERIPHERAL_MAP)
1245#define bfin_write_MDMA1_S1_PERIPHERAL_MAP(val) bfin_write16(MDMA1_S1_PERIPHERAL_MAP, val)
1246#define bfin_read_MDMA1_S1_CURR_X_COUNT() bfin_read16(MDMA1_S1_CURR_X_COUNT)
1247#define bfin_write_MDMA1_S1_CURR_X_COUNT(val) bfin_write16(MDMA1_S1_CURR_X_COUNT, val)
1248#define bfin_read_MDMA1_S1_CURR_Y_COUNT() bfin_read16(MDMA1_S1_CURR_Y_COUNT)
1249#define bfin_write_MDMA1_S1_CURR_Y_COUNT(val) bfin_write16(MDMA1_S1_CURR_Y_COUNT, val)
1250#define bfin_read_PPI_CONTROL() bfin_read16(PPI_CONTROL)
1251#define bfin_write_PPI_CONTROL(val) bfin_write16(PPI_CONTROL, val)
1252#define bfin_read_PPI_STATUS() bfin_read16(PPI_STATUS)
1253#define bfin_write_PPI_STATUS(val) bfin_write16(PPI_STATUS, val)
1254#define bfin_read_PPI_DELAY() bfin_read16(PPI_DELAY)
1255#define bfin_write_PPI_DELAY(val) bfin_write16(PPI_DELAY, val)
1256#define bfin_read_PPI_COUNT() bfin_read16(PPI_COUNT)
1257#define bfin_write_PPI_COUNT(val) bfin_write16(PPI_COUNT, val)
1258#define bfin_read_PPI_FRAME() bfin_read16(PPI_FRAME)
1259#define bfin_write_PPI_FRAME(val) bfin_write16(PPI_FRAME, val)
1260#define bfin_read_TWI0_CLKDIV() bfin_read16(TWI0_CLKDIV)
1261#define bfin_write_TWI0_CLKDIV(val) bfin_write16(TWI0_CLKDIV, val)
1262#define bfin_read_TWI0_CONTROL() bfin_read16(TWI0_CONTROL)
1263#define bfin_write_TWI0_CONTROL(val) bfin_write16(TWI0_CONTROL, val)
1264#define bfin_read_TWI0_SLAVE_CTRL() bfin_read16(TWI0_SLAVE_CTRL)
1265#define bfin_write_TWI0_SLAVE_CTRL(val) bfin_write16(TWI0_SLAVE_CTRL, val)
1266#define bfin_read_TWI0_SLAVE_STAT() bfin_read16(TWI0_SLAVE_STAT)
1267#define bfin_write_TWI0_SLAVE_STAT(val) bfin_write16(TWI0_SLAVE_STAT, val)
1268#define bfin_read_TWI0_SLAVE_ADDR() bfin_read16(TWI0_SLAVE_ADDR)
1269#define bfin_write_TWI0_SLAVE_ADDR(val) bfin_write16(TWI0_SLAVE_ADDR, val)
1270#define bfin_read_TWI0_MASTER_CTL() bfin_read16(TWI0_MASTER_CTL)
1271#define bfin_write_TWI0_MASTER_CTL(val) bfin_write16(TWI0_MASTER_CTL, val)
1272#define bfin_read_TWI0_MASTER_STAT() bfin_read16(TWI0_MASTER_STAT)
1273#define bfin_write_TWI0_MASTER_STAT(val) bfin_write16(TWI0_MASTER_STAT, val)
1274#define bfin_read_TWI0_MASTER_ADDR() bfin_read16(TWI0_MASTER_ADDR)
1275#define bfin_write_TWI0_MASTER_ADDR(val) bfin_write16(TWI0_MASTER_ADDR, val)
1276#define bfin_read_TWI0_INT_STAT() bfin_read16(TWI0_INT_STAT)
1277#define bfin_write_TWI0_INT_STAT(val) bfin_write16(TWI0_INT_STAT, val)
1278#define bfin_read_TWI0_INT_MASK() bfin_read16(TWI0_INT_MASK)
1279#define bfin_write_TWI0_INT_MASK(val) bfin_write16(TWI0_INT_MASK, val)
1280#define bfin_read_TWI0_FIFO_CTL() bfin_read16(TWI0_FIFO_CTL)
1281#define bfin_write_TWI0_FIFO_CTL(val) bfin_write16(TWI0_FIFO_CTL, val)
1282#define bfin_read_TWI0_FIFO_STAT() bfin_read16(TWI0_FIFO_STAT)
1283#define bfin_write_TWI0_FIFO_STAT(val) bfin_write16(TWI0_FIFO_STAT, val)
1284#define bfin_read_TWI0_XMT_DATA8() bfin_read16(TWI0_XMT_DATA8)
1285#define bfin_write_TWI0_XMT_DATA8(val) bfin_write16(TWI0_XMT_DATA8, val)
1286#define bfin_read_TWI0_XMT_DATA16() bfin_read16(TWI0_XMT_DATA16)
1287#define bfin_write_TWI0_XMT_DATA16(val) bfin_write16(TWI0_XMT_DATA16, val)
1288#define bfin_read_TWI0_RCV_DATA8() bfin_read16(TWI0_RCV_DATA8)
1289#define bfin_write_TWI0_RCV_DATA8(val) bfin_write16(TWI0_RCV_DATA8, val)
1290#define bfin_read_TWI0_RCV_DATA16() bfin_read16(TWI0_RCV_DATA16)
1291#define bfin_write_TWI0_RCV_DATA16(val) bfin_write16(TWI0_RCV_DATA16, val)
1292#define bfin_read_TWI1_CLKDIV() bfin_read16(TWI1_CLKDIV)
1293#define bfin_write_TWI1_CLKDIV(val) bfin_write16(TWI1_CLKDIV, val)
1294#define bfin_read_TWI1_CONTROL() bfin_read16(TWI1_CONTROL)
1295#define bfin_write_TWI1_CONTROL(val) bfin_write16(TWI1_CONTROL, val)
1296#define bfin_read_TWI1_SLAVE_CTRL() bfin_read16(TWI1_SLAVE_CTRL)
1297#define bfin_write_TWI1_SLAVE_CTRL(val) bfin_write16(TWI1_SLAVE_CTRL, val)
1298#define bfin_read_TWI1_SLAVE_STAT() bfin_read16(TWI1_SLAVE_STAT)
1299#define bfin_write_TWI1_SLAVE_STAT(val) bfin_write16(TWI1_SLAVE_STAT, val)
1300#define bfin_read_TWI1_SLAVE_ADDR() bfin_read16(TWI1_SLAVE_ADDR)
1301#define bfin_write_TWI1_SLAVE_ADDR(val) bfin_write16(TWI1_SLAVE_ADDR, val)
1302#define bfin_read_TWI1_MASTER_CTL() bfin_read16(TWI1_MASTER_CTL)
1303#define bfin_write_TWI1_MASTER_CTL(val) bfin_write16(TWI1_MASTER_CTL, val)
1304#define bfin_read_TWI1_MASTER_STAT() bfin_read16(TWI1_MASTER_STAT)
1305#define bfin_write_TWI1_MASTER_STAT(val) bfin_write16(TWI1_MASTER_STAT, val)
1306#define bfin_read_TWI1_MASTER_ADDR() bfin_read16(TWI1_MASTER_ADDR)
1307#define bfin_write_TWI1_MASTER_ADDR(val) bfin_write16(TWI1_MASTER_ADDR, val)
1308#define bfin_read_TWI1_INT_STAT() bfin_read16(TWI1_INT_STAT)
1309#define bfin_write_TWI1_INT_STAT(val) bfin_write16(TWI1_INT_STAT, val)
1310#define bfin_read_TWI1_INT_MASK() bfin_read16(TWI1_INT_MASK)
1311#define bfin_write_TWI1_INT_MASK(val) bfin_write16(TWI1_INT_MASK, val)
1312#define bfin_read_TWI1_FIFO_CTL() bfin_read16(TWI1_FIFO_CTL)
1313#define bfin_write_TWI1_FIFO_CTL(val) bfin_write16(TWI1_FIFO_CTL, val)
1314#define bfin_read_TWI1_FIFO_STAT() bfin_read16(TWI1_FIFO_STAT)
1315#define bfin_write_TWI1_FIFO_STAT(val) bfin_write16(TWI1_FIFO_STAT, val)
1316#define bfin_read_TWI1_XMT_DATA8() bfin_read16(TWI1_XMT_DATA8)
1317#define bfin_write_TWI1_XMT_DATA8(val) bfin_write16(TWI1_XMT_DATA8, val)
1318#define bfin_read_TWI1_XMT_DATA16() bfin_read16(TWI1_XMT_DATA16)
1319#define bfin_write_TWI1_XMT_DATA16(val) bfin_write16(TWI1_XMT_DATA16, val)
1320#define bfin_read_TWI1_RCV_DATA8() bfin_read16(TWI1_RCV_DATA8)
1321#define bfin_write_TWI1_RCV_DATA8(val) bfin_write16(TWI1_RCV_DATA8, val)
1322#define bfin_read_TWI1_RCV_DATA16() bfin_read16(TWI1_RCV_DATA16)
1323#define bfin_write_TWI1_RCV_DATA16(val) bfin_write16(TWI1_RCV_DATA16, val)
1324#define bfin_read_CAN_MC1() bfin_read16(CAN_MC1)
1325#define bfin_write_CAN_MC1(val) bfin_write16(CAN_MC1, val)
1326#define bfin_read_CAN_MD1() bfin_read16(CAN_MD1)
1327#define bfin_write_CAN_MD1(val) bfin_write16(CAN_MD1, val)
1328#define bfin_read_CAN_TRS1() bfin_read16(CAN_TRS1)
1329#define bfin_write_CAN_TRS1(val) bfin_write16(CAN_TRS1, val)
1330#define bfin_read_CAN_TRR1() bfin_read16(CAN_TRR1)
1331#define bfin_write_CAN_TRR1(val) bfin_write16(CAN_TRR1, val)
1332#define bfin_read_CAN_TA1() bfin_read16(CAN_TA1)
1333#define bfin_write_CAN_TA1(val) bfin_write16(CAN_TA1, val)
1334#define bfin_read_CAN_AA1() bfin_read16(CAN_AA1)
1335#define bfin_write_CAN_AA1(val) bfin_write16(CAN_AA1, val)
1336#define bfin_read_CAN_RMP1() bfin_read16(CAN_RMP1)
1337#define bfin_write_CAN_RMP1(val) bfin_write16(CAN_RMP1, val)
1338#define bfin_read_CAN_RML1() bfin_read16(CAN_RML1)
1339#define bfin_write_CAN_RML1(val) bfin_write16(CAN_RML1, val)
1340#define bfin_read_CAN_MBTIF1() bfin_read16(CAN_MBTIF1)
1341#define bfin_write_CAN_MBTIF1(val) bfin_write16(CAN_MBTIF1, val)
1342#define bfin_read_CAN_MBRIF1() bfin_read16(CAN_MBRIF1)
1343#define bfin_write_CAN_MBRIF1(val) bfin_write16(CAN_MBRIF1, val)
1344#define bfin_read_CAN_MBIM1() bfin_read16(CAN_MBIM1)
1345#define bfin_write_CAN_MBIM1(val) bfin_write16(CAN_MBIM1, val)
1346#define bfin_read_CAN_RFH1() bfin_read16(CAN_RFH1)
1347#define bfin_write_CAN_RFH1(val) bfin_write16(CAN_RFH1, val)
1348#define bfin_read_CAN_OPSS1() bfin_read16(CAN_OPSS1)
1349#define bfin_write_CAN_OPSS1(val) bfin_write16(CAN_OPSS1, val)
1350#define bfin_read_CAN_MC2() bfin_read16(CAN_MC2)
1351#define bfin_write_CAN_MC2(val) bfin_write16(CAN_MC2, val)
1352#define bfin_read_CAN_MD2() bfin_read16(CAN_MD2)
1353#define bfin_write_CAN_MD2(val) bfin_write16(CAN_MD2, val)
1354#define bfin_read_CAN_TRS2() bfin_read16(CAN_TRS2)
1355#define bfin_write_CAN_TRS2(val) bfin_write16(CAN_TRS2, val)
1356#define bfin_read_CAN_TRR2() bfin_read16(CAN_TRR2)
1357#define bfin_write_CAN_TRR2(val) bfin_write16(CAN_TRR2, val)
1358#define bfin_read_CAN_TA2() bfin_read16(CAN_TA2)
1359#define bfin_write_CAN_TA2(val) bfin_write16(CAN_TA2, val)
1360#define bfin_read_CAN_AA2() bfin_read16(CAN_AA2)
1361#define bfin_write_CAN_AA2(val) bfin_write16(CAN_AA2, val)
1362#define bfin_read_CAN_RMP2() bfin_read16(CAN_RMP2)
1363#define bfin_write_CAN_RMP2(val) bfin_write16(CAN_RMP2, val)
1364#define bfin_read_CAN_RML2() bfin_read16(CAN_RML2)
1365#define bfin_write_CAN_RML2(val) bfin_write16(CAN_RML2, val)
1366#define bfin_read_CAN_MBTIF2() bfin_read16(CAN_MBTIF2)
1367#define bfin_write_CAN_MBTIF2(val) bfin_write16(CAN_MBTIF2, val)
1368#define bfin_read_CAN_MBRIF2() bfin_read16(CAN_MBRIF2)
1369#define bfin_write_CAN_MBRIF2(val) bfin_write16(CAN_MBRIF2, val)
1370#define bfin_read_CAN_MBIM2() bfin_read16(CAN_MBIM2)
1371#define bfin_write_CAN_MBIM2(val) bfin_write16(CAN_MBIM2, val)
1372#define bfin_read_CAN_RFH2() bfin_read16(CAN_RFH2)
1373#define bfin_write_CAN_RFH2(val) bfin_write16(CAN_RFH2, val)
1374#define bfin_read_CAN_OPSS2() bfin_read16(CAN_OPSS2)
1375#define bfin_write_CAN_OPSS2(val) bfin_write16(CAN_OPSS2, val)
1376#define bfin_read_CAN_CLOCK() bfin_read16(CAN_CLOCK)
1377#define bfin_write_CAN_CLOCK(val) bfin_write16(CAN_CLOCK, val)
1378#define bfin_read_CAN_TIMING() bfin_read16(CAN_TIMING)
1379#define bfin_write_CAN_TIMING(val) bfin_write16(CAN_TIMING, val)
1380#define bfin_read_CAN_DEBUG() bfin_read16(CAN_DEBUG)
1381#define bfin_write_CAN_DEBUG(val) bfin_write16(CAN_DEBUG, val)
1382#define bfin_read_CAN_STATUS() bfin_read16(CAN_STATUS)
1383#define bfin_write_CAN_STATUS(val) bfin_write16(CAN_STATUS, val)
1384#define bfin_read_CAN_CEC() bfin_read16(CAN_CEC)
1385#define bfin_write_CAN_CEC(val) bfin_write16(CAN_CEC, val)
1386#define bfin_read_CAN_GIS() bfin_read16(CAN_GIS)
1387#define bfin_write_CAN_GIS(val) bfin_write16(CAN_GIS, val)
1388#define bfin_read_CAN_GIM() bfin_read16(CAN_GIM)
1389#define bfin_write_CAN_GIM(val) bfin_write16(CAN_GIM, val)
1390#define bfin_read_CAN_GIF() bfin_read16(CAN_GIF)
1391#define bfin_write_CAN_GIF(val) bfin_write16(CAN_GIF, val)
1392#define bfin_read_CAN_CONTROL() bfin_read16(CAN_CONTROL)
1393#define bfin_write_CAN_CONTROL(val) bfin_write16(CAN_CONTROL, val)
1394#define bfin_read_CAN_INTR() bfin_read16(CAN_INTR)
1395#define bfin_write_CAN_INTR(val) bfin_write16(CAN_INTR, val)
1396#define bfin_read_CAN_VERSION() bfin_read16(CAN_VERSION)
1397#define bfin_write_CAN_VERSION(val) bfin_write16(CAN_VERSION, val)
1398#define bfin_read_CAN_MBTD() bfin_read16(CAN_MBTD)
1399#define bfin_write_CAN_MBTD(val) bfin_write16(CAN_MBTD, val)
1400#define bfin_read_CAN_EWR() bfin_read16(CAN_EWR)
1401#define bfin_write_CAN_EWR(val) bfin_write16(CAN_EWR, val)
1402#define bfin_read_CAN_ESR() bfin_read16(CAN_ESR)
1403#define bfin_write_CAN_ESR(val) bfin_write16(CAN_ESR, val)
1404#define bfin_read_CAN_UCREG() bfin_read16(CAN_UCREG)
1405#define bfin_write_CAN_UCREG(val) bfin_write16(CAN_UCREG, val)
1406#define bfin_read_CAN_UCCNT() bfin_read16(CAN_UCCNT)
1407#define bfin_write_CAN_UCCNT(val) bfin_write16(CAN_UCCNT, val)
1408#define bfin_read_CAN_UCRC() bfin_read16(CAN_UCRC)
1409#define bfin_write_CAN_UCRC(val) bfin_write16(CAN_UCRC, val)
1410#define bfin_read_CAN_UCCNF() bfin_read16(CAN_UCCNF)
1411#define bfin_write_CAN_UCCNF(val) bfin_write16(CAN_UCCNF, val)
1412#define bfin_read_CAN_VERSION2() bfin_read16(CAN_VERSION2)
1413#define bfin_write_CAN_VERSION2(val) bfin_write16(CAN_VERSION2, val)
1414#define bfin_read_CAN_AM00L() bfin_read16(CAN_AM00L)
1415#define bfin_write_CAN_AM00L(val) bfin_write16(CAN_AM00L, val)
1416#define bfin_read_CAN_AM00H() bfin_read16(CAN_AM00H)
1417#define bfin_write_CAN_AM00H(val) bfin_write16(CAN_AM00H, val)
1418#define bfin_read_CAN_AM01L() bfin_read16(CAN_AM01L)
1419#define bfin_write_CAN_AM01L(val) bfin_write16(CAN_AM01L, val)
1420#define bfin_read_CAN_AM01H() bfin_read16(CAN_AM01H)
1421#define bfin_write_CAN_AM01H(val) bfin_write16(CAN_AM01H, val)
1422#define bfin_read_CAN_AM02L() bfin_read16(CAN_AM02L)
1423#define bfin_write_CAN_AM02L(val) bfin_write16(CAN_AM02L, val)
1424#define bfin_read_CAN_AM02H() bfin_read16(CAN_AM02H)
1425#define bfin_write_CAN_AM02H(val) bfin_write16(CAN_AM02H, val)
1426#define bfin_read_CAN_AM03L() bfin_read16(CAN_AM03L)
1427#define bfin_write_CAN_AM03L(val) bfin_write16(CAN_AM03L, val)
1428#define bfin_read_CAN_AM03H() bfin_read16(CAN_AM03H)
1429#define bfin_write_CAN_AM03H(val) bfin_write16(CAN_AM03H, val)
1430#define bfin_read_CAN_AM04L() bfin_read16(CAN_AM04L)
1431#define bfin_write_CAN_AM04L(val) bfin_write16(CAN_AM04L, val)
1432#define bfin_read_CAN_AM04H() bfin_read16(CAN_AM04H)
1433#define bfin_write_CAN_AM04H(val) bfin_write16(CAN_AM04H, val)
1434#define bfin_read_CAN_AM05L() bfin_read16(CAN_AM05L)
1435#define bfin_write_CAN_AM05L(val) bfin_write16(CAN_AM05L, val)
1436#define bfin_read_CAN_AM05H() bfin_read16(CAN_AM05H)
1437#define bfin_write_CAN_AM05H(val) bfin_write16(CAN_AM05H, val)
1438#define bfin_read_CAN_AM06L() bfin_read16(CAN_AM06L)
1439#define bfin_write_CAN_AM06L(val) bfin_write16(CAN_AM06L, val)
1440#define bfin_read_CAN_AM06H() bfin_read16(CAN_AM06H)
1441#define bfin_write_CAN_AM06H(val) bfin_write16(CAN_AM06H, val)
1442#define bfin_read_CAN_AM07L() bfin_read16(CAN_AM07L)
1443#define bfin_write_CAN_AM07L(val) bfin_write16(CAN_AM07L, val)
1444#define bfin_read_CAN_AM07H() bfin_read16(CAN_AM07H)
1445#define bfin_write_CAN_AM07H(val) bfin_write16(CAN_AM07H, val)
1446#define bfin_read_CAN_AM08L() bfin_read16(CAN_AM08L)
1447#define bfin_write_CAN_AM08L(val) bfin_write16(CAN_AM08L, val)
1448#define bfin_read_CAN_AM08H() bfin_read16(CAN_AM08H)
1449#define bfin_write_CAN_AM08H(val) bfin_write16(CAN_AM08H, val)
1450#define bfin_read_CAN_AM09L() bfin_read16(CAN_AM09L)
1451#define bfin_write_CAN_AM09L(val) bfin_write16(CAN_AM09L, val)
1452#define bfin_read_CAN_AM09H() bfin_read16(CAN_AM09H)
1453#define bfin_write_CAN_AM09H(val) bfin_write16(CAN_AM09H, val)
1454#define bfin_read_CAN_AM10L() bfin_read16(CAN_AM10L)
1455#define bfin_write_CAN_AM10L(val) bfin_write16(CAN_AM10L, val)
1456#define bfin_read_CAN_AM10H() bfin_read16(CAN_AM10H)
1457#define bfin_write_CAN_AM10H(val) bfin_write16(CAN_AM10H, val)
1458#define bfin_read_CAN_AM11L() bfin_read16(CAN_AM11L)
1459#define bfin_write_CAN_AM11L(val) bfin_write16(CAN_AM11L, val)
1460#define bfin_read_CAN_AM11H() bfin_read16(CAN_AM11H)
1461#define bfin_write_CAN_AM11H(val) bfin_write16(CAN_AM11H, val)
1462#define bfin_read_CAN_AM12L() bfin_read16(CAN_AM12L)
1463#define bfin_write_CAN_AM12L(val) bfin_write16(CAN_AM12L, val)
1464#define bfin_read_CAN_AM12H() bfin_read16(CAN_AM12H)
1465#define bfin_write_CAN_AM12H(val) bfin_write16(CAN_AM12H, val)
1466#define bfin_read_CAN_AM13L() bfin_read16(CAN_AM13L)
1467#define bfin_write_CAN_AM13L(val) bfin_write16(CAN_AM13L, val)
1468#define bfin_read_CAN_AM13H() bfin_read16(CAN_AM13H)
1469#define bfin_write_CAN_AM13H(val) bfin_write16(CAN_AM13H, val)
1470#define bfin_read_CAN_AM14L() bfin_read16(CAN_AM14L)
1471#define bfin_write_CAN_AM14L(val) bfin_write16(CAN_AM14L, val)
1472#define bfin_read_CAN_AM14H() bfin_read16(CAN_AM14H)
1473#define bfin_write_CAN_AM14H(val) bfin_write16(CAN_AM14H, val)
1474#define bfin_read_CAN_AM15L() bfin_read16(CAN_AM15L)
1475#define bfin_write_CAN_AM15L(val) bfin_write16(CAN_AM15L, val)
1476#define bfin_read_CAN_AM15H() bfin_read16(CAN_AM15H)
1477#define bfin_write_CAN_AM15H(val) bfin_write16(CAN_AM15H, val)
1478#define bfin_read_CAN_AM16L() bfin_read16(CAN_AM16L)
1479#define bfin_write_CAN_AM16L(val) bfin_write16(CAN_AM16L, val)
1480#define bfin_read_CAN_AM16H() bfin_read16(CAN_AM16H)
1481#define bfin_write_CAN_AM16H(val) bfin_write16(CAN_AM16H, val)
1482#define bfin_read_CAN_AM17L() bfin_read16(CAN_AM17L)
1483#define bfin_write_CAN_AM17L(val) bfin_write16(CAN_AM17L, val)
1484#define bfin_read_CAN_AM17H() bfin_read16(CAN_AM17H)
1485#define bfin_write_CAN_AM17H(val) bfin_write16(CAN_AM17H, val)
1486#define bfin_read_CAN_AM18L() bfin_read16(CAN_AM18L)
1487#define bfin_write_CAN_AM18L(val) bfin_write16(CAN_AM18L, val)
1488#define bfin_read_CAN_AM18H() bfin_read16(CAN_AM18H)
1489#define bfin_write_CAN_AM18H(val) bfin_write16(CAN_AM18H, val)
1490#define bfin_read_CAN_AM19L() bfin_read16(CAN_AM19L)
1491#define bfin_write_CAN_AM19L(val) bfin_write16(CAN_AM19L, val)
1492#define bfin_read_CAN_AM19H() bfin_read16(CAN_AM19H)
1493#define bfin_write_CAN_AM19H(val) bfin_write16(CAN_AM19H, val)
1494#define bfin_read_CAN_AM20L() bfin_read16(CAN_AM20L)
1495#define bfin_write_CAN_AM20L(val) bfin_write16(CAN_AM20L, val)
1496#define bfin_read_CAN_AM20H() bfin_read16(CAN_AM20H)
1497#define bfin_write_CAN_AM20H(val) bfin_write16(CAN_AM20H, val)
1498#define bfin_read_CAN_AM21L() bfin_read16(CAN_AM21L)
1499#define bfin_write_CAN_AM21L(val) bfin_write16(CAN_AM21L, val)
1500#define bfin_read_CAN_AM21H() bfin_read16(CAN_AM21H)
1501#define bfin_write_CAN_AM21H(val) bfin_write16(CAN_AM21H, val)
1502#define bfin_read_CAN_AM22L() bfin_read16(CAN_AM22L)
1503#define bfin_write_CAN_AM22L(val) bfin_write16(CAN_AM22L, val)
1504#define bfin_read_CAN_AM22H() bfin_read16(CAN_AM22H)
1505#define bfin_write_CAN_AM22H(val) bfin_write16(CAN_AM22H, val)
1506#define bfin_read_CAN_AM23L() bfin_read16(CAN_AM23L)
1507#define bfin_write_CAN_AM23L(val) bfin_write16(CAN_AM23L, val)
1508#define bfin_read_CAN_AM23H() bfin_read16(CAN_AM23H)
1509#define bfin_write_CAN_AM23H(val) bfin_write16(CAN_AM23H, val)
1510#define bfin_read_CAN_AM24L() bfin_read16(CAN_AM24L)
1511#define bfin_write_CAN_AM24L(val) bfin_write16(CAN_AM24L, val)
1512#define bfin_read_CAN_AM24H() bfin_read16(CAN_AM24H)
1513#define bfin_write_CAN_AM24H(val) bfin_write16(CAN_AM24H, val)
1514#define bfin_read_CAN_AM25L() bfin_read16(CAN_AM25L)
1515#define bfin_write_CAN_AM25L(val) bfin_write16(CAN_AM25L, val)
1516#define bfin_read_CAN_AM25H() bfin_read16(CAN_AM25H)
1517#define bfin_write_CAN_AM25H(val) bfin_write16(CAN_AM25H, val)
1518#define bfin_read_CAN_AM26L() bfin_read16(CAN_AM26L)
1519#define bfin_write_CAN_AM26L(val) bfin_write16(CAN_AM26L, val)
1520#define bfin_read_CAN_AM26H() bfin_read16(CAN_AM26H)
1521#define bfin_write_CAN_AM26H(val) bfin_write16(CAN_AM26H, val)
1522#define bfin_read_CAN_AM27L() bfin_read16(CAN_AM27L)
1523#define bfin_write_CAN_AM27L(val) bfin_write16(CAN_AM27L, val)
1524#define bfin_read_CAN_AM27H() bfin_read16(CAN_AM27H)
1525#define bfin_write_CAN_AM27H(val) bfin_write16(CAN_AM27H, val)
1526#define bfin_read_CAN_AM28L() bfin_read16(CAN_AM28L)
1527#define bfin_write_CAN_AM28L(val) bfin_write16(CAN_AM28L, val)
1528#define bfin_read_CAN_AM28H() bfin_read16(CAN_AM28H)
1529#define bfin_write_CAN_AM28H(val) bfin_write16(CAN_AM28H, val)
1530#define bfin_read_CAN_AM29L() bfin_read16(CAN_AM29L)
1531#define bfin_write_CAN_AM29L(val) bfin_write16(CAN_AM29L, val)
1532#define bfin_read_CAN_AM29H() bfin_read16(CAN_AM29H)
1533#define bfin_write_CAN_AM29H(val) bfin_write16(CAN_AM29H, val)
1534#define bfin_read_CAN_AM30L() bfin_read16(CAN_AM30L)
1535#define bfin_write_CAN_AM30L(val) bfin_write16(CAN_AM30L, val)
1536#define bfin_read_CAN_AM30H() bfin_read16(CAN_AM30H)
1537#define bfin_write_CAN_AM30H(val) bfin_write16(CAN_AM30H, val)
1538#define bfin_read_CAN_AM31L() bfin_read16(CAN_AM31L)
1539#define bfin_write_CAN_AM31L(val) bfin_write16(CAN_AM31L, val)
1540#define bfin_read_CAN_AM31H() bfin_read16(CAN_AM31H)
1541#define bfin_write_CAN_AM31H(val) bfin_write16(CAN_AM31H, val)
1542#define bfin_read_CAN_MB00_DATA0() bfin_read16(CAN_MB00_DATA0)
1543#define bfin_write_CAN_MB00_DATA0(val) bfin_write16(CAN_MB00_DATA0, val)
1544#define bfin_read_CAN_MB00_DATA1() bfin_read16(CAN_MB00_DATA1)
1545#define bfin_write_CAN_MB00_DATA1(val) bfin_write16(CAN_MB00_DATA1, val)
1546#define bfin_read_CAN_MB00_DATA2() bfin_read16(CAN_MB00_DATA2)
1547#define bfin_write_CAN_MB00_DATA2(val) bfin_write16(CAN_MB00_DATA2, val)
1548#define bfin_read_CAN_MB00_DATA3() bfin_read16(CAN_MB00_DATA3)
1549#define bfin_write_CAN_MB00_DATA3(val) bfin_write16(CAN_MB00_DATA3, val)
1550#define bfin_read_CAN_MB00_LENGTH() bfin_read16(CAN_MB00_LENGTH)
1551#define bfin_write_CAN_MB00_LENGTH(val) bfin_write16(CAN_MB00_LENGTH, val)
1552#define bfin_read_CAN_MB00_TIMESTAMP() bfin_read16(CAN_MB00_TIMESTAMP)
1553#define bfin_write_CAN_MB00_TIMESTAMP(val) bfin_write16(CAN_MB00_TIMESTAMP, val)
1554#define bfin_read_CAN_MB00_ID0() bfin_read16(CAN_MB00_ID0)
1555#define bfin_write_CAN_MB00_ID0(val) bfin_write16(CAN_MB00_ID0, val)
1556#define bfin_read_CAN_MB00_ID1() bfin_read16(CAN_MB00_ID1)
1557#define bfin_write_CAN_MB00_ID1(val) bfin_write16(CAN_MB00_ID1, val)
1558#define bfin_read_CAN_MB01_DATA0() bfin_read16(CAN_MB01_DATA0)
1559#define bfin_write_CAN_MB01_DATA0(val) bfin_write16(CAN_MB01_DATA0, val)
1560#define bfin_read_CAN_MB01_DATA1() bfin_read16(CAN_MB01_DATA1)
1561#define bfin_write_CAN_MB01_DATA1(val) bfin_write16(CAN_MB01_DATA1, val)
1562#define bfin_read_CAN_MB01_DATA2() bfin_read16(CAN_MB01_DATA2)
1563#define bfin_write_CAN_MB01_DATA2(val) bfin_write16(CAN_MB01_DATA2, val)
1564#define bfin_read_CAN_MB01_DATA3() bfin_read16(CAN_MB01_DATA3)
1565#define bfin_write_CAN_MB01_DATA3(val) bfin_write16(CAN_MB01_DATA3, val)
1566#define bfin_read_CAN_MB01_LENGTH() bfin_read16(CAN_MB01_LENGTH)
1567#define bfin_write_CAN_MB01_LENGTH(val) bfin_write16(CAN_MB01_LENGTH, val)
1568#define bfin_read_CAN_MB01_TIMESTAMP() bfin_read16(CAN_MB01_TIMESTAMP)
1569#define bfin_write_CAN_MB01_TIMESTAMP(val) bfin_write16(CAN_MB01_TIMESTAMP, val)
1570#define bfin_read_CAN_MB01_ID0() bfin_read16(CAN_MB01_ID0)
1571#define bfin_write_CAN_MB01_ID0(val) bfin_write16(CAN_MB01_ID0, val)
1572#define bfin_read_CAN_MB01_ID1() bfin_read16(CAN_MB01_ID1)
1573#define bfin_write_CAN_MB01_ID1(val) bfin_write16(CAN_MB01_ID1, val)
1574#define bfin_read_CAN_MB02_DATA0() bfin_read16(CAN_MB02_DATA0)
1575#define bfin_write_CAN_MB02_DATA0(val) bfin_write16(CAN_MB02_DATA0, val)
1576#define bfin_read_CAN_MB02_DATA1() bfin_read16(CAN_MB02_DATA1)
1577#define bfin_write_CAN_MB02_DATA1(val) bfin_write16(CAN_MB02_DATA1, val)
1578#define bfin_read_CAN_MB02_DATA2() bfin_read16(CAN_MB02_DATA2)
1579#define bfin_write_CAN_MB02_DATA2(val) bfin_write16(CAN_MB02_DATA2, val)
1580#define bfin_read_CAN_MB02_DATA3() bfin_read16(CAN_MB02_DATA3)
1581#define bfin_write_CAN_MB02_DATA3(val) bfin_write16(CAN_MB02_DATA3, val)
1582#define bfin_read_CAN_MB02_LENGTH() bfin_read16(CAN_MB02_LENGTH)
1583#define bfin_write_CAN_MB02_LENGTH(val) bfin_write16(CAN_MB02_LENGTH, val)
1584#define bfin_read_CAN_MB02_TIMESTAMP() bfin_read16(CAN_MB02_TIMESTAMP)
1585#define bfin_write_CAN_MB02_TIMESTAMP(val) bfin_write16(CAN_MB02_TIMESTAMP, val)
1586#define bfin_read_CAN_MB02_ID0() bfin_read16(CAN_MB02_ID0)
1587#define bfin_write_CAN_MB02_ID0(val) bfin_write16(CAN_MB02_ID0, val)
1588#define bfin_read_CAN_MB02_ID1() bfin_read16(CAN_MB02_ID1)
1589#define bfin_write_CAN_MB02_ID1(val) bfin_write16(CAN_MB02_ID1, val)
1590#define bfin_read_CAN_MB03_DATA0() bfin_read16(CAN_MB03_DATA0)
1591#define bfin_write_CAN_MB03_DATA0(val) bfin_write16(CAN_MB03_DATA0, val)
1592#define bfin_read_CAN_MB03_DATA1() bfin_read16(CAN_MB03_DATA1)
1593#define bfin_write_CAN_MB03_DATA1(val) bfin_write16(CAN_MB03_DATA1, val)
1594#define bfin_read_CAN_MB03_DATA2() bfin_read16(CAN_MB03_DATA2)
1595#define bfin_write_CAN_MB03_DATA2(val) bfin_write16(CAN_MB03_DATA2, val)
1596#define bfin_read_CAN_MB03_DATA3() bfin_read16(CAN_MB03_DATA3)
1597#define bfin_write_CAN_MB03_DATA3(val) bfin_write16(CAN_MB03_DATA3, val)
1598#define bfin_read_CAN_MB03_LENGTH() bfin_read16(CAN_MB03_LENGTH)
1599#define bfin_write_CAN_MB03_LENGTH(val) bfin_write16(CAN_MB03_LENGTH, val)
1600#define bfin_read_CAN_MB03_TIMESTAMP() bfin_read16(CAN_MB03_TIMESTAMP)
1601#define bfin_write_CAN_MB03_TIMESTAMP(val) bfin_write16(CAN_MB03_TIMESTAMP, val)
1602#define bfin_read_CAN_MB03_ID0() bfin_read16(CAN_MB03_ID0)
1603#define bfin_write_CAN_MB03_ID0(val) bfin_write16(CAN_MB03_ID0, val)
1604#define bfin_read_CAN_MB03_ID1() bfin_read16(CAN_MB03_ID1)
1605#define bfin_write_CAN_MB03_ID1(val) bfin_write16(CAN_MB03_ID1, val)
1606#define bfin_read_CAN_MB04_DATA0() bfin_read16(CAN_MB04_DATA0)
1607#define bfin_write_CAN_MB04_DATA0(val) bfin_write16(CAN_MB04_DATA0, val)
1608#define bfin_read_CAN_MB04_DATA1() bfin_read16(CAN_MB04_DATA1)
1609#define bfin_write_CAN_MB04_DATA1(val) bfin_write16(CAN_MB04_DATA1, val)
1610#define bfin_read_CAN_MB04_DATA2() bfin_read16(CAN_MB04_DATA2)
1611#define bfin_write_CAN_MB04_DATA2(val) bfin_write16(CAN_MB04_DATA2, val)
1612#define bfin_read_CAN_MB04_DATA3() bfin_read16(CAN_MB04_DATA3)
1613#define bfin_write_CAN_MB04_DATA3(val) bfin_write16(CAN_MB04_DATA3, val)
1614#define bfin_read_CAN_MB04_LENGTH() bfin_read16(CAN_MB04_LENGTH)
1615#define bfin_write_CAN_MB04_LENGTH(val) bfin_write16(CAN_MB04_LENGTH, val)
1616#define bfin_read_CAN_MB04_TIMESTAMP() bfin_read16(CAN_MB04_TIMESTAMP)
1617#define bfin_write_CAN_MB04_TIMESTAMP(val) bfin_write16(CAN_MB04_TIMESTAMP, val)
1618#define bfin_read_CAN_MB04_ID0() bfin_read16(CAN_MB04_ID0)
1619#define bfin_write_CAN_MB04_ID0(val) bfin_write16(CAN_MB04_ID0, val)
1620#define bfin_read_CAN_MB04_ID1() bfin_read16(CAN_MB04_ID1)
1621#define bfin_write_CAN_MB04_ID1(val) bfin_write16(CAN_MB04_ID1, val)
1622#define bfin_read_CAN_MB05_DATA0() bfin_read16(CAN_MB05_DATA0)
1623#define bfin_write_CAN_MB05_DATA0(val) bfin_write16(CAN_MB05_DATA0, val)
1624#define bfin_read_CAN_MB05_DATA1() bfin_read16(CAN_MB05_DATA1)
1625#define bfin_write_CAN_MB05_DATA1(val) bfin_write16(CAN_MB05_DATA1, val)
1626#define bfin_read_CAN_MB05_DATA2() bfin_read16(CAN_MB05_DATA2)
1627#define bfin_write_CAN_MB05_DATA2(val) bfin_write16(CAN_MB05_DATA2, val)
1628#define bfin_read_CAN_MB05_DATA3() bfin_read16(CAN_MB05_DATA3)
1629#define bfin_write_CAN_MB05_DATA3(val) bfin_write16(CAN_MB05_DATA3, val)
1630#define bfin_read_CAN_MB05_LENGTH() bfin_read16(CAN_MB05_LENGTH)
1631#define bfin_write_CAN_MB05_LENGTH(val) bfin_write16(CAN_MB05_LENGTH, val)
1632#define bfin_read_CAN_MB05_TIMESTAMP() bfin_read16(CAN_MB05_TIMESTAMP)
1633#define bfin_write_CAN_MB05_TIMESTAMP(val) bfin_write16(CAN_MB05_TIMESTAMP, val)
1634#define bfin_read_CAN_MB05_ID0() bfin_read16(CAN_MB05_ID0)
1635#define bfin_write_CAN_MB05_ID0(val) bfin_write16(CAN_MB05_ID0, val)
1636#define bfin_read_CAN_MB05_ID1() bfin_read16(CAN_MB05_ID1)
1637#define bfin_write_CAN_MB05_ID1(val) bfin_write16(CAN_MB05_ID1, val)
1638#define bfin_read_CAN_MB06_DATA0() bfin_read16(CAN_MB06_DATA0)
1639#define bfin_write_CAN_MB06_DATA0(val) bfin_write16(CAN_MB06_DATA0, val)
1640#define bfin_read_CAN_MB06_DATA1() bfin_read16(CAN_MB06_DATA1)
1641#define bfin_write_CAN_MB06_DATA1(val) bfin_write16(CAN_MB06_DATA1, val)
1642#define bfin_read_CAN_MB06_DATA2() bfin_read16(CAN_MB06_DATA2)
1643#define bfin_write_CAN_MB06_DATA2(val) bfin_write16(CAN_MB06_DATA2, val)
1644#define bfin_read_CAN_MB06_DATA3() bfin_read16(CAN_MB06_DATA3)
1645#define bfin_write_CAN_MB06_DATA3(val) bfin_write16(CAN_MB06_DATA3, val)
1646#define bfin_read_CAN_MB06_LENGTH() bfin_read16(CAN_MB06_LENGTH)
1647#define bfin_write_CAN_MB06_LENGTH(val) bfin_write16(CAN_MB06_LENGTH, val)
1648#define bfin_read_CAN_MB06_TIMESTAMP() bfin_read16(CAN_MB06_TIMESTAMP)
1649#define bfin_write_CAN_MB06_TIMESTAMP(val) bfin_write16(CAN_MB06_TIMESTAMP, val)
1650#define bfin_read_CAN_MB06_ID0() bfin_read16(CAN_MB06_ID0)
1651#define bfin_write_CAN_MB06_ID0(val) bfin_write16(CAN_MB06_ID0, val)
1652#define bfin_read_CAN_MB06_ID1() bfin_read16(CAN_MB06_ID1)
1653#define bfin_write_CAN_MB06_ID1(val) bfin_write16(CAN_MB06_ID1, val)
1654#define bfin_read_CAN_MB07_DATA0() bfin_read16(CAN_MB07_DATA0)
1655#define bfin_write_CAN_MB07_DATA0(val) bfin_write16(CAN_MB07_DATA0, val)
1656#define bfin_read_CAN_MB07_DATA1() bfin_read16(CAN_MB07_DATA1)
1657#define bfin_write_CAN_MB07_DATA1(val) bfin_write16(CAN_MB07_DATA1, val)
1658#define bfin_read_CAN_MB07_DATA2() bfin_read16(CAN_MB07_DATA2)
1659#define bfin_write_CAN_MB07_DATA2(val) bfin_write16(CAN_MB07_DATA2, val)
1660#define bfin_read_CAN_MB07_DATA3() bfin_read16(CAN_MB07_DATA3)
1661#define bfin_write_CAN_MB07_DATA3(val) bfin_write16(CAN_MB07_DATA3, val)
1662#define bfin_read_CAN_MB07_LENGTH() bfin_read16(CAN_MB07_LENGTH)
1663#define bfin_write_CAN_MB07_LENGTH(val) bfin_write16(CAN_MB07_LENGTH, val)
1664#define bfin_read_CAN_MB07_TIMESTAMP() bfin_read16(CAN_MB07_TIMESTAMP)
1665#define bfin_write_CAN_MB07_TIMESTAMP(val) bfin_write16(CAN_MB07_TIMESTAMP, val)
1666#define bfin_read_CAN_MB07_ID0() bfin_read16(CAN_MB07_ID0)
1667#define bfin_write_CAN_MB07_ID0(val) bfin_write16(CAN_MB07_ID0, val)
1668#define bfin_read_CAN_MB07_ID1() bfin_read16(CAN_MB07_ID1)
1669#define bfin_write_CAN_MB07_ID1(val) bfin_write16(CAN_MB07_ID1, val)
1670#define bfin_read_CAN_MB08_DATA0() bfin_read16(CAN_MB08_DATA0)
1671#define bfin_write_CAN_MB08_DATA0(val) bfin_write16(CAN_MB08_DATA0, val)
1672#define bfin_read_CAN_MB08_DATA1() bfin_read16(CAN_MB08_DATA1)
1673#define bfin_write_CAN_MB08_DATA1(val) bfin_write16(CAN_MB08_DATA1, val)
1674#define bfin_read_CAN_MB08_DATA2() bfin_read16(CAN_MB08_DATA2)
1675#define bfin_write_CAN_MB08_DATA2(val) bfin_write16(CAN_MB08_DATA2, val)
1676#define bfin_read_CAN_MB08_DATA3() bfin_read16(CAN_MB08_DATA3)
1677#define bfin_write_CAN_MB08_DATA3(val) bfin_write16(CAN_MB08_DATA3, val)
1678#define bfin_read_CAN_MB08_LENGTH() bfin_read16(CAN_MB08_LENGTH)
1679#define bfin_write_CAN_MB08_LENGTH(val) bfin_write16(CAN_MB08_LENGTH, val)
1680#define bfin_read_CAN_MB08_TIMESTAMP() bfin_read16(CAN_MB08_TIMESTAMP)
1681#define bfin_write_CAN_MB08_TIMESTAMP(val) bfin_write16(CAN_MB08_TIMESTAMP, val)
1682#define bfin_read_CAN_MB08_ID0() bfin_read16(CAN_MB08_ID0)
1683#define bfin_write_CAN_MB08_ID0(val) bfin_write16(CAN_MB08_ID0, val)
1684#define bfin_read_CAN_MB08_ID1() bfin_read16(CAN_MB08_ID1)
1685#define bfin_write_CAN_MB08_ID1(val) bfin_write16(CAN_MB08_ID1, val)
1686#define bfin_read_CAN_MB09_DATA0() bfin_read16(CAN_MB09_DATA0)
1687#define bfin_write_CAN_MB09_DATA0(val) bfin_write16(CAN_MB09_DATA0, val)
1688#define bfin_read_CAN_MB09_DATA1() bfin_read16(CAN_MB09_DATA1)
1689#define bfin_write_CAN_MB09_DATA1(val) bfin_write16(CAN_MB09_DATA1, val)
1690#define bfin_read_CAN_MB09_DATA2() bfin_read16(CAN_MB09_DATA2)
1691#define bfin_write_CAN_MB09_DATA2(val) bfin_write16(CAN_MB09_DATA2, val)
1692#define bfin_read_CAN_MB09_DATA3() bfin_read16(CAN_MB09_DATA3)
1693#define bfin_write_CAN_MB09_DATA3(val) bfin_write16(CAN_MB09_DATA3, val)
1694#define bfin_read_CAN_MB09_LENGTH() bfin_read16(CAN_MB09_LENGTH)
1695#define bfin_write_CAN_MB09_LENGTH(val) bfin_write16(CAN_MB09_LENGTH, val)
1696#define bfin_read_CAN_MB09_TIMESTAMP() bfin_read16(CAN_MB09_TIMESTAMP)
1697#define bfin_write_CAN_MB09_TIMESTAMP(val) bfin_write16(CAN_MB09_TIMESTAMP, val)
1698#define bfin_read_CAN_MB09_ID0() bfin_read16(CAN_MB09_ID0)
1699#define bfin_write_CAN_MB09_ID0(val) bfin_write16(CAN_MB09_ID0, val)
1700#define bfin_read_CAN_MB09_ID1() bfin_read16(CAN_MB09_ID1)
1701#define bfin_write_CAN_MB09_ID1(val) bfin_write16(CAN_MB09_ID1, val)
1702#define bfin_read_CAN_MB10_DATA0() bfin_read16(CAN_MB10_DATA0)
1703#define bfin_write_CAN_MB10_DATA0(val) bfin_write16(CAN_MB10_DATA0, val)
1704#define bfin_read_CAN_MB10_DATA1() bfin_read16(CAN_MB10_DATA1)
1705#define bfin_write_CAN_MB10_DATA1(val) bfin_write16(CAN_MB10_DATA1, val)
1706#define bfin_read_CAN_MB10_DATA2() bfin_read16(CAN_MB10_DATA2)
1707#define bfin_write_CAN_MB10_DATA2(val) bfin_write16(CAN_MB10_DATA2, val)
1708#define bfin_read_CAN_MB10_DATA3() bfin_read16(CAN_MB10_DATA3)
1709#define bfin_write_CAN_MB10_DATA3(val) bfin_write16(CAN_MB10_DATA3, val)
1710#define bfin_read_CAN_MB10_LENGTH() bfin_read16(CAN_MB10_LENGTH)
1711#define bfin_write_CAN_MB10_LENGTH(val) bfin_write16(CAN_MB10_LENGTH, val)
1712#define bfin_read_CAN_MB10_TIMESTAMP() bfin_read16(CAN_MB10_TIMESTAMP)
1713#define bfin_write_CAN_MB10_TIMESTAMP(val) bfin_write16(CAN_MB10_TIMESTAMP, val)
1714#define bfin_read_CAN_MB10_ID0() bfin_read16(CAN_MB10_ID0)
1715#define bfin_write_CAN_MB10_ID0(val) bfin_write16(CAN_MB10_ID0, val)
1716#define bfin_read_CAN_MB10_ID1() bfin_read16(CAN_MB10_ID1)
1717#define bfin_write_CAN_MB10_ID1(val) bfin_write16(CAN_MB10_ID1, val)
1718#define bfin_read_CAN_MB11_DATA0() bfin_read16(CAN_MB11_DATA0)
1719#define bfin_write_CAN_MB11_DATA0(val) bfin_write16(CAN_MB11_DATA0, val)
1720#define bfin_read_CAN_MB11_DATA1() bfin_read16(CAN_MB11_DATA1)
1721#define bfin_write_CAN_MB11_DATA1(val) bfin_write16(CAN_MB11_DATA1, val)
1722#define bfin_read_CAN_MB11_DATA2() bfin_read16(CAN_MB11_DATA2)
1723#define bfin_write_CAN_MB11_DATA2(val) bfin_write16(CAN_MB11_DATA2, val)
1724#define bfin_read_CAN_MB11_DATA3() bfin_read16(CAN_MB11_DATA3)
1725#define bfin_write_CAN_MB11_DATA3(val) bfin_write16(CAN_MB11_DATA3, val)
1726#define bfin_read_CAN_MB11_LENGTH() bfin_read16(CAN_MB11_LENGTH)
1727#define bfin_write_CAN_MB11_LENGTH(val) bfin_write16(CAN_MB11_LENGTH, val)
1728#define bfin_read_CAN_MB11_TIMESTAMP() bfin_read16(CAN_MB11_TIMESTAMP)
1729#define bfin_write_CAN_MB11_TIMESTAMP(val) bfin_write16(CAN_MB11_TIMESTAMP, val)
1730#define bfin_read_CAN_MB11_ID0() bfin_read16(CAN_MB11_ID0)
1731#define bfin_write_CAN_MB11_ID0(val) bfin_write16(CAN_MB11_ID0, val)
1732#define bfin_read_CAN_MB11_ID1() bfin_read16(CAN_MB11_ID1)
1733#define bfin_write_CAN_MB11_ID1(val) bfin_write16(CAN_MB11_ID1, val)
1734#define bfin_read_CAN_MB12_DATA0() bfin_read16(CAN_MB12_DATA0)
1735#define bfin_write_CAN_MB12_DATA0(val) bfin_write16(CAN_MB12_DATA0, val)
1736#define bfin_read_CAN_MB12_DATA1() bfin_read16(CAN_MB12_DATA1)
1737#define bfin_write_CAN_MB12_DATA1(val) bfin_write16(CAN_MB12_DATA1, val)
1738#define bfin_read_CAN_MB12_DATA2() bfin_read16(CAN_MB12_DATA2)
1739#define bfin_write_CAN_MB12_DATA2(val) bfin_write16(CAN_MB12_DATA2, val)
1740#define bfin_read_CAN_MB12_DATA3() bfin_read16(CAN_MB12_DATA3)
1741#define bfin_write_CAN_MB12_DATA3(val) bfin_write16(CAN_MB12_DATA3, val)
1742#define bfin_read_CAN_MB12_LENGTH() bfin_read16(CAN_MB12_LENGTH)
1743#define bfin_write_CAN_MB12_LENGTH(val) bfin_write16(CAN_MB12_LENGTH, val)
1744#define bfin_read_CAN_MB12_TIMESTAMP() bfin_read16(CAN_MB12_TIMESTAMP)
1745#define bfin_write_CAN_MB12_TIMESTAMP(val) bfin_write16(CAN_MB12_TIMESTAMP, val)
1746#define bfin_read_CAN_MB12_ID0() bfin_read16(CAN_MB12_ID0)
1747#define bfin_write_CAN_MB12_ID0(val) bfin_write16(CAN_MB12_ID0, val)
1748#define bfin_read_CAN_MB12_ID1() bfin_read16(CAN_MB12_ID1)
1749#define bfin_write_CAN_MB12_ID1(val) bfin_write16(CAN_MB12_ID1, val)
1750#define bfin_read_CAN_MB13_DATA0() bfin_read16(CAN_MB13_DATA0)
1751#define bfin_write_CAN_MB13_DATA0(val) bfin_write16(CAN_MB13_DATA0, val)
1752#define bfin_read_CAN_MB13_DATA1() bfin_read16(CAN_MB13_DATA1)
1753#define bfin_write_CAN_MB13_DATA1(val) bfin_write16(CAN_MB13_DATA1, val)
1754#define bfin_read_CAN_MB13_DATA2() bfin_read16(CAN_MB13_DATA2)
1755#define bfin_write_CAN_MB13_DATA2(val) bfin_write16(CAN_MB13_DATA2, val)
1756#define bfin_read_CAN_MB13_DATA3() bfin_read16(CAN_MB13_DATA3)
1757#define bfin_write_CAN_MB13_DATA3(val) bfin_write16(CAN_MB13_DATA3, val)
1758#define bfin_read_CAN_MB13_LENGTH() bfin_read16(CAN_MB13_LENGTH)
1759#define bfin_write_CAN_MB13_LENGTH(val) bfin_write16(CAN_MB13_LENGTH, val)
1760#define bfin_read_CAN_MB13_TIMESTAMP() bfin_read16(CAN_MB13_TIMESTAMP)
1761#define bfin_write_CAN_MB13_TIMESTAMP(val) bfin_write16(CAN_MB13_TIMESTAMP, val)
1762#define bfin_read_CAN_MB13_ID0() bfin_read16(CAN_MB13_ID0)
1763#define bfin_write_CAN_MB13_ID0(val) bfin_write16(CAN_MB13_ID0, val)
1764#define bfin_read_CAN_MB13_ID1() bfin_read16(CAN_MB13_ID1)
1765#define bfin_write_CAN_MB13_ID1(val) bfin_write16(CAN_MB13_ID1, val)
1766#define bfin_read_CAN_MB14_DATA0() bfin_read16(CAN_MB14_DATA0)
1767#define bfin_write_CAN_MB14_DATA0(val) bfin_write16(CAN_MB14_DATA0, val)
1768#define bfin_read_CAN_MB14_DATA1() bfin_read16(CAN_MB14_DATA1)
1769#define bfin_write_CAN_MB14_DATA1(val) bfin_write16(CAN_MB14_DATA1, val)
1770#define bfin_read_CAN_MB14_DATA2() bfin_read16(CAN_MB14_DATA2)
1771#define bfin_write_CAN_MB14_DATA2(val) bfin_write16(CAN_MB14_DATA2, val)
1772#define bfin_read_CAN_MB14_DATA3() bfin_read16(CAN_MB14_DATA3)
1773#define bfin_write_CAN_MB14_DATA3(val) bfin_write16(CAN_MB14_DATA3, val)
1774#define bfin_read_CAN_MB14_LENGTH() bfin_read16(CAN_MB14_LENGTH)
1775#define bfin_write_CAN_MB14_LENGTH(val) bfin_write16(CAN_MB14_LENGTH, val)
1776#define bfin_read_CAN_MB14_TIMESTAMP() bfin_read16(CAN_MB14_TIMESTAMP)
1777#define bfin_write_CAN_MB14_TIMESTAMP(val) bfin_write16(CAN_MB14_TIMESTAMP, val)
1778#define bfin_read_CAN_MB14_ID0() bfin_read16(CAN_MB14_ID0)
1779#define bfin_write_CAN_MB14_ID0(val) bfin_write16(CAN_MB14_ID0, val)
1780#define bfin_read_CAN_MB14_ID1() bfin_read16(CAN_MB14_ID1)
1781#define bfin_write_CAN_MB14_ID1(val) bfin_write16(CAN_MB14_ID1, val)
1782#define bfin_read_CAN_MB15_DATA0() bfin_read16(CAN_MB15_DATA0)
1783#define bfin_write_CAN_MB15_DATA0(val) bfin_write16(CAN_MB15_DATA0, val)
1784#define bfin_read_CAN_MB15_DATA1() bfin_read16(CAN_MB15_DATA1)
1785#define bfin_write_CAN_MB15_DATA1(val) bfin_write16(CAN_MB15_DATA1, val)
1786#define bfin_read_CAN_MB15_DATA2() bfin_read16(CAN_MB15_DATA2)
1787#define bfin_write_CAN_MB15_DATA2(val) bfin_write16(CAN_MB15_DATA2, val)
1788#define bfin_read_CAN_MB15_DATA3() bfin_read16(CAN_MB15_DATA3)
1789#define bfin_write_CAN_MB15_DATA3(val) bfin_write16(CAN_MB15_DATA3, val)
1790#define bfin_read_CAN_MB15_LENGTH() bfin_read16(CAN_MB15_LENGTH)
1791#define bfin_write_CAN_MB15_LENGTH(val) bfin_write16(CAN_MB15_LENGTH, val)
1792#define bfin_read_CAN_MB15_TIMESTAMP() bfin_read16(CAN_MB15_TIMESTAMP)
1793#define bfin_write_CAN_MB15_TIMESTAMP(val) bfin_write16(CAN_MB15_TIMESTAMP, val)
1794#define bfin_read_CAN_MB15_ID0() bfin_read16(CAN_MB15_ID0)
1795#define bfin_write_CAN_MB15_ID0(val) bfin_write16(CAN_MB15_ID0, val)
1796#define bfin_read_CAN_MB15_ID1() bfin_read16(CAN_MB15_ID1)
1797#define bfin_write_CAN_MB15_ID1(val) bfin_write16(CAN_MB15_ID1, val)
1798#define bfin_read_CAN_MB16_DATA0() bfin_read16(CAN_MB16_DATA0)
1799#define bfin_write_CAN_MB16_DATA0(val) bfin_write16(CAN_MB16_DATA0, val)
1800#define bfin_read_CAN_MB16_DATA1() bfin_read16(CAN_MB16_DATA1)
1801#define bfin_write_CAN_MB16_DATA1(val) bfin_write16(CAN_MB16_DATA1, val)
1802#define bfin_read_CAN_MB16_DATA2() bfin_read16(CAN_MB16_DATA2)
1803#define bfin_write_CAN_MB16_DATA2(val) bfin_write16(CAN_MB16_DATA2, val)
1804#define bfin_read_CAN_MB16_DATA3() bfin_read16(CAN_MB16_DATA3)
1805#define bfin_write_CAN_MB16_DATA3(val) bfin_write16(CAN_MB16_DATA3, val)
1806#define bfin_read_CAN_MB16_LENGTH() bfin_read16(CAN_MB16_LENGTH)
1807#define bfin_write_CAN_MB16_LENGTH(val) bfin_write16(CAN_MB16_LENGTH, val)
1808#define bfin_read_CAN_MB16_TIMESTAMP() bfin_read16(CAN_MB16_TIMESTAMP)
1809#define bfin_write_CAN_MB16_TIMESTAMP(val) bfin_write16(CAN_MB16_TIMESTAMP, val)
1810#define bfin_read_CAN_MB16_ID0() bfin_read16(CAN_MB16_ID0)
1811#define bfin_write_CAN_MB16_ID0(val) bfin_write16(CAN_MB16_ID0, val)
1812#define bfin_read_CAN_MB16_ID1() bfin_read16(CAN_MB16_ID1)
1813#define bfin_write_CAN_MB16_ID1(val) bfin_write16(CAN_MB16_ID1, val)
1814#define bfin_read_CAN_MB17_DATA0() bfin_read16(CAN_MB17_DATA0)
1815#define bfin_write_CAN_MB17_DATA0(val) bfin_write16(CAN_MB17_DATA0, val)
1816#define bfin_read_CAN_MB17_DATA1() bfin_read16(CAN_MB17_DATA1)
1817#define bfin_write_CAN_MB17_DATA1(val) bfin_write16(CAN_MB17_DATA1, val)
1818#define bfin_read_CAN_MB17_DATA2() bfin_read16(CAN_MB17_DATA2)
1819#define bfin_write_CAN_MB17_DATA2(val) bfin_write16(CAN_MB17_DATA2, val)
1820#define bfin_read_CAN_MB17_DATA3() bfin_read16(CAN_MB17_DATA3)
1821#define bfin_write_CAN_MB17_DATA3(val) bfin_write16(CAN_MB17_DATA3, val)
1822#define bfin_read_CAN_MB17_LENGTH() bfin_read16(CAN_MB17_LENGTH)
1823#define bfin_write_CAN_MB17_LENGTH(val) bfin_write16(CAN_MB17_LENGTH, val)
1824#define bfin_read_CAN_MB17_TIMESTAMP() bfin_read16(CAN_MB17_TIMESTAMP)
1825#define bfin_write_CAN_MB17_TIMESTAMP(val) bfin_write16(CAN_MB17_TIMESTAMP, val)
1826#define bfin_read_CAN_MB17_ID0() bfin_read16(CAN_MB17_ID0)
1827#define bfin_write_CAN_MB17_ID0(val) bfin_write16(CAN_MB17_ID0, val)
1828#define bfin_read_CAN_MB17_ID1() bfin_read16(CAN_MB17_ID1)
1829#define bfin_write_CAN_MB17_ID1(val) bfin_write16(CAN_MB17_ID1, val)
1830#define bfin_read_CAN_MB18_DATA0() bfin_read16(CAN_MB18_DATA0)
1831#define bfin_write_CAN_MB18_DATA0(val) bfin_write16(CAN_MB18_DATA0, val)
1832#define bfin_read_CAN_MB18_DATA1() bfin_read16(CAN_MB18_DATA1)
1833#define bfin_write_CAN_MB18_DATA1(val) bfin_write16(CAN_MB18_DATA1, val)
1834#define bfin_read_CAN_MB18_DATA2() bfin_read16(CAN_MB18_DATA2)
1835#define bfin_write_CAN_MB18_DATA2(val) bfin_write16(CAN_MB18_DATA2, val)
1836#define bfin_read_CAN_MB18_DATA3() bfin_read16(CAN_MB18_DATA3)
1837#define bfin_write_CAN_MB18_DATA3(val) bfin_write16(CAN_MB18_DATA3, val)
1838#define bfin_read_CAN_MB18_LENGTH() bfin_read16(CAN_MB18_LENGTH)
1839#define bfin_write_CAN_MB18_LENGTH(val) bfin_write16(CAN_MB18_LENGTH, val)
1840#define bfin_read_CAN_MB18_TIMESTAMP() bfin_read16(CAN_MB18_TIMESTAMP)
1841#define bfin_write_CAN_MB18_TIMESTAMP(val) bfin_write16(CAN_MB18_TIMESTAMP, val)
1842#define bfin_read_CAN_MB18_ID0() bfin_read16(CAN_MB18_ID0)
1843#define bfin_write_CAN_MB18_ID0(val) bfin_write16(CAN_MB18_ID0, val)
1844#define bfin_read_CAN_MB18_ID1() bfin_read16(CAN_MB18_ID1)
1845#define bfin_write_CAN_MB18_ID1(val) bfin_write16(CAN_MB18_ID1, val)
1846#define bfin_read_CAN_MB19_DATA0() bfin_read16(CAN_MB19_DATA0)
1847#define bfin_write_CAN_MB19_DATA0(val) bfin_write16(CAN_MB19_DATA0, val)
1848#define bfin_read_CAN_MB19_DATA1() bfin_read16(CAN_MB19_DATA1)
1849#define bfin_write_CAN_MB19_DATA1(val) bfin_write16(CAN_MB19_DATA1, val)
1850#define bfin_read_CAN_MB19_DATA2() bfin_read16(CAN_MB19_DATA2)
1851#define bfin_write_CAN_MB19_DATA2(val) bfin_write16(CAN_MB19_DATA2, val)
1852#define bfin_read_CAN_MB19_DATA3() bfin_read16(CAN_MB19_DATA3)
1853#define bfin_write_CAN_MB19_DATA3(val) bfin_write16(CAN_MB19_DATA3, val)
1854#define bfin_read_CAN_MB19_LENGTH() bfin_read16(CAN_MB19_LENGTH)
1855#define bfin_write_CAN_MB19_LENGTH(val) bfin_write16(CAN_MB19_LENGTH, val)
1856#define bfin_read_CAN_MB19_TIMESTAMP() bfin_read16(CAN_MB19_TIMESTAMP)
1857#define bfin_write_CAN_MB19_TIMESTAMP(val) bfin_write16(CAN_MB19_TIMESTAMP, val)
1858#define bfin_read_CAN_MB19_ID0() bfin_read16(CAN_MB19_ID0)
1859#define bfin_write_CAN_MB19_ID0(val) bfin_write16(CAN_MB19_ID0, val)
1860#define bfin_read_CAN_MB19_ID1() bfin_read16(CAN_MB19_ID1)
1861#define bfin_write_CAN_MB19_ID1(val) bfin_write16(CAN_MB19_ID1, val)
1862#define bfin_read_CAN_MB20_DATA0() bfin_read16(CAN_MB20_DATA0)
1863#define bfin_write_CAN_MB20_DATA0(val) bfin_write16(CAN_MB20_DATA0, val)
1864#define bfin_read_CAN_MB20_DATA1() bfin_read16(CAN_MB20_DATA1)
1865#define bfin_write_CAN_MB20_DATA1(val) bfin_write16(CAN_MB20_DATA1, val)
1866#define bfin_read_CAN_MB20_DATA2() bfin_read16(CAN_MB20_DATA2)
1867#define bfin_write_CAN_MB20_DATA2(val) bfin_write16(CAN_MB20_DATA2, val)
1868#define bfin_read_CAN_MB20_DATA3() bfin_read16(CAN_MB20_DATA3)
1869#define bfin_write_CAN_MB20_DATA3(val) bfin_write16(CAN_MB20_DATA3, val)
1870#define bfin_read_CAN_MB20_LENGTH() bfin_read16(CAN_MB20_LENGTH)
1871#define bfin_write_CAN_MB20_LENGTH(val) bfin_write16(CAN_MB20_LENGTH, val)
1872#define bfin_read_CAN_MB20_TIMESTAMP() bfin_read16(CAN_MB20_TIMESTAMP)
1873#define bfin_write_CAN_MB20_TIMESTAMP(val) bfin_write16(CAN_MB20_TIMESTAMP, val)
1874#define bfin_read_CAN_MB20_ID0() bfin_read16(CAN_MB20_ID0)
1875#define bfin_write_CAN_MB20_ID0(val) bfin_write16(CAN_MB20_ID0, val)
1876#define bfin_read_CAN_MB20_ID1() bfin_read16(CAN_MB20_ID1)
1877#define bfin_write_CAN_MB20_ID1(val) bfin_write16(CAN_MB20_ID1, val)
1878#define bfin_read_CAN_MB21_DATA0() bfin_read16(CAN_MB21_DATA0)
1879#define bfin_write_CAN_MB21_DATA0(val) bfin_write16(CAN_MB21_DATA0, val)
1880#define bfin_read_CAN_MB21_DATA1() bfin_read16(CAN_MB21_DATA1)
1881#define bfin_write_CAN_MB21_DATA1(val) bfin_write16(CAN_MB21_DATA1, val)
1882#define bfin_read_CAN_MB21_DATA2() bfin_read16(CAN_MB21_DATA2)
1883#define bfin_write_CAN_MB21_DATA2(val) bfin_write16(CAN_MB21_DATA2, val)
1884#define bfin_read_CAN_MB21_DATA3() bfin_read16(CAN_MB21_DATA3)
1885#define bfin_write_CAN_MB21_DATA3(val) bfin_write16(CAN_MB21_DATA3, val)
1886#define bfin_read_CAN_MB21_LENGTH() bfin_read16(CAN_MB21_LENGTH)
1887#define bfin_write_CAN_MB21_LENGTH(val) bfin_write16(CAN_MB21_LENGTH, val)
1888#define bfin_read_CAN_MB21_TIMESTAMP() bfin_read16(CAN_MB21_TIMESTAMP)
1889#define bfin_write_CAN_MB21_TIMESTAMP(val) bfin_write16(CAN_MB21_TIMESTAMP, val)
1890#define bfin_read_CAN_MB21_ID0() bfin_read16(CAN_MB21_ID0)
1891#define bfin_write_CAN_MB21_ID0(val) bfin_write16(CAN_MB21_ID0, val)
1892#define bfin_read_CAN_MB21_ID1() bfin_read16(CAN_MB21_ID1)
1893#define bfin_write_CAN_MB21_ID1(val) bfin_write16(CAN_MB21_ID1, val)
1894#define bfin_read_CAN_MB22_DATA0() bfin_read16(CAN_MB22_DATA0)
1895#define bfin_write_CAN_MB22_DATA0(val) bfin_write16(CAN_MB22_DATA0, val)
1896#define bfin_read_CAN_MB22_DATA1() bfin_read16(CAN_MB22_DATA1)
1897#define bfin_write_CAN_MB22_DATA1(val) bfin_write16(CAN_MB22_DATA1, val)
1898#define bfin_read_CAN_MB22_DATA2() bfin_read16(CAN_MB22_DATA2)
1899#define bfin_write_CAN_MB22_DATA2(val) bfin_write16(CAN_MB22_DATA2, val)
1900#define bfin_read_CAN_MB22_DATA3() bfin_read16(CAN_MB22_DATA3)
1901#define bfin_write_CAN_MB22_DATA3(val) bfin_write16(CAN_MB22_DATA3, val)
1902#define bfin_read_CAN_MB22_LENGTH() bfin_read16(CAN_MB22_LENGTH)
1903#define bfin_write_CAN_MB22_LENGTH(val) bfin_write16(CAN_MB22_LENGTH, val)
1904#define bfin_read_CAN_MB22_TIMESTAMP() bfin_read16(CAN_MB22_TIMESTAMP)
1905#define bfin_write_CAN_MB22_TIMESTAMP(val) bfin_write16(CAN_MB22_TIMESTAMP, val)
1906#define bfin_read_CAN_MB22_ID0() bfin_read16(CAN_MB22_ID0)
1907#define bfin_write_CAN_MB22_ID0(val) bfin_write16(CAN_MB22_ID0, val)
1908#define bfin_read_CAN_MB22_ID1() bfin_read16(CAN_MB22_ID1)
1909#define bfin_write_CAN_MB22_ID1(val) bfin_write16(CAN_MB22_ID1, val)
1910#define bfin_read_CAN_MB23_DATA0() bfin_read16(CAN_MB23_DATA0)
1911#define bfin_write_CAN_MB23_DATA0(val) bfin_write16(CAN_MB23_DATA0, val)
1912#define bfin_read_CAN_MB23_DATA1() bfin_read16(CAN_MB23_DATA1)
1913#define bfin_write_CAN_MB23_DATA1(val) bfin_write16(CAN_MB23_DATA1, val)
1914#define bfin_read_CAN_MB23_DATA2() bfin_read16(CAN_MB23_DATA2)
1915#define bfin_write_CAN_MB23_DATA2(val) bfin_write16(CAN_MB23_DATA2, val)
1916#define bfin_read_CAN_MB23_DATA3() bfin_read16(CAN_MB23_DATA3)
1917#define bfin_write_CAN_MB23_DATA3(val) bfin_write16(CAN_MB23_DATA3, val)
1918#define bfin_read_CAN_MB23_LENGTH() bfin_read16(CAN_MB23_LENGTH)
1919#define bfin_write_CAN_MB23_LENGTH(val) bfin_write16(CAN_MB23_LENGTH, val)
1920#define bfin_read_CAN_MB23_TIMESTAMP() bfin_read16(CAN_MB23_TIMESTAMP)
1921#define bfin_write_CAN_MB23_TIMESTAMP(val) bfin_write16(CAN_MB23_TIMESTAMP, val)
1922#define bfin_read_CAN_MB23_ID0() bfin_read16(CAN_MB23_ID0)
1923#define bfin_write_CAN_MB23_ID0(val) bfin_write16(CAN_MB23_ID0, val)
1924#define bfin_read_CAN_MB23_ID1() bfin_read16(CAN_MB23_ID1)
1925#define bfin_write_CAN_MB23_ID1(val) bfin_write16(CAN_MB23_ID1, val)
1926#define bfin_read_CAN_MB24_DATA0() bfin_read16(CAN_MB24_DATA0)
1927#define bfin_write_CAN_MB24_DATA0(val) bfin_write16(CAN_MB24_DATA0, val)
1928#define bfin_read_CAN_MB24_DATA1() bfin_read16(CAN_MB24_DATA1)
1929#define bfin_write_CAN_MB24_DATA1(val) bfin_write16(CAN_MB24_DATA1, val)
1930#define bfin_read_CAN_MB24_DATA2() bfin_read16(CAN_MB24_DATA2)
1931#define bfin_write_CAN_MB24_DATA2(val) bfin_write16(CAN_MB24_DATA2, val)
1932#define bfin_read_CAN_MB24_DATA3() bfin_read16(CAN_MB24_DATA3)
1933#define bfin_write_CAN_MB24_DATA3(val) bfin_write16(CAN_MB24_DATA3, val)
1934#define bfin_read_CAN_MB24_LENGTH() bfin_read16(CAN_MB24_LENGTH)
1935#define bfin_write_CAN_MB24_LENGTH(val) bfin_write16(CAN_MB24_LENGTH, val)
1936#define bfin_read_CAN_MB24_TIMESTAMP() bfin_read16(CAN_MB24_TIMESTAMP)
1937#define bfin_write_CAN_MB24_TIMESTAMP(val) bfin_write16(CAN_MB24_TIMESTAMP, val)
1938#define bfin_read_CAN_MB24_ID0() bfin_read16(CAN_MB24_ID0)
1939#define bfin_write_CAN_MB24_ID0(val) bfin_write16(CAN_MB24_ID0, val)
1940#define bfin_read_CAN_MB24_ID1() bfin_read16(CAN_MB24_ID1)
1941#define bfin_write_CAN_MB24_ID1(val) bfin_write16(CAN_MB24_ID1, val)
1942#define bfin_read_CAN_MB25_DATA0() bfin_read16(CAN_MB25_DATA0)
1943#define bfin_write_CAN_MB25_DATA0(val) bfin_write16(CAN_MB25_DATA0, val)
1944#define bfin_read_CAN_MB25_DATA1() bfin_read16(CAN_MB25_DATA1)
1945#define bfin_write_CAN_MB25_DATA1(val) bfin_write16(CAN_MB25_DATA1, val)
1946#define bfin_read_CAN_MB25_DATA2() bfin_read16(CAN_MB25_DATA2)
1947#define bfin_write_CAN_MB25_DATA2(val) bfin_write16(CAN_MB25_DATA2, val)
1948#define bfin_read_CAN_MB25_DATA3() bfin_read16(CAN_MB25_DATA3)
1949#define bfin_write_CAN_MB25_DATA3(val) bfin_write16(CAN_MB25_DATA3, val)
1950#define bfin_read_CAN_MB25_LENGTH() bfin_read16(CAN_MB25_LENGTH)
1951#define bfin_write_CAN_MB25_LENGTH(val) bfin_write16(CAN_MB25_LENGTH, val)
1952#define bfin_read_CAN_MB25_TIMESTAMP() bfin_read16(CAN_MB25_TIMESTAMP)
1953#define bfin_write_CAN_MB25_TIMESTAMP(val) bfin_write16(CAN_MB25_TIMESTAMP, val)
1954#define bfin_read_CAN_MB25_ID0() bfin_read16(CAN_MB25_ID0)
1955#define bfin_write_CAN_MB25_ID0(val) bfin_write16(CAN_MB25_ID0, val)
1956#define bfin_read_CAN_MB25_ID1() bfin_read16(CAN_MB25_ID1)
1957#define bfin_write_CAN_MB25_ID1(val) bfin_write16(CAN_MB25_ID1, val)
1958#define bfin_read_CAN_MB26_DATA0() bfin_read16(CAN_MB26_DATA0)
1959#define bfin_write_CAN_MB26_DATA0(val) bfin_write16(CAN_MB26_DATA0, val)
1960#define bfin_read_CAN_MB26_DATA1() bfin_read16(CAN_MB26_DATA1)
1961#define bfin_write_CAN_MB26_DATA1(val) bfin_write16(CAN_MB26_DATA1, val)
1962#define bfin_read_CAN_MB26_DATA2() bfin_read16(CAN_MB26_DATA2)
1963#define bfin_write_CAN_MB26_DATA2(val) bfin_write16(CAN_MB26_DATA2, val)
1964#define bfin_read_CAN_MB26_DATA3() bfin_read16(CAN_MB26_DATA3)
1965#define bfin_write_CAN_MB26_DATA3(val) bfin_write16(CAN_MB26_DATA3, val)
1966#define bfin_read_CAN_MB26_LENGTH() bfin_read16(CAN_MB26_LENGTH)
1967#define bfin_write_CAN_MB26_LENGTH(val) bfin_write16(CAN_MB26_LENGTH, val)
1968#define bfin_read_CAN_MB26_TIMESTAMP() bfin_read16(CAN_MB26_TIMESTAMP)
1969#define bfin_write_CAN_MB26_TIMESTAMP(val) bfin_write16(CAN_MB26_TIMESTAMP, val)
1970#define bfin_read_CAN_MB26_ID0() bfin_read16(CAN_MB26_ID0)
1971#define bfin_write_CAN_MB26_ID0(val) bfin_write16(CAN_MB26_ID0, val)
1972#define bfin_read_CAN_MB26_ID1() bfin_read16(CAN_MB26_ID1)
1973#define bfin_write_CAN_MB26_ID1(val) bfin_write16(CAN_MB26_ID1, val)
1974#define bfin_read_CAN_MB27_DATA0() bfin_read16(CAN_MB27_DATA0)
1975#define bfin_write_CAN_MB27_DATA0(val) bfin_write16(CAN_MB27_DATA0, val)
1976#define bfin_read_CAN_MB27_DATA1() bfin_read16(CAN_MB27_DATA1)
1977#define bfin_write_CAN_MB27_DATA1(val) bfin_write16(CAN_MB27_DATA1, val)
1978#define bfin_read_CAN_MB27_DATA2() bfin_read16(CAN_MB27_DATA2)
1979#define bfin_write_CAN_MB27_DATA2(val) bfin_write16(CAN_MB27_DATA2, val)
1980#define bfin_read_CAN_MB27_DATA3() bfin_read16(CAN_MB27_DATA3)
1981#define bfin_write_CAN_MB27_DATA3(val) bfin_write16(CAN_MB27_DATA3, val)
1982#define bfin_read_CAN_MB27_LENGTH() bfin_read16(CAN_MB27_LENGTH)
1983#define bfin_write_CAN_MB27_LENGTH(val) bfin_write16(CAN_MB27_LENGTH, val)
1984#define bfin_read_CAN_MB27_TIMESTAMP() bfin_read16(CAN_MB27_TIMESTAMP)
1985#define bfin_write_CAN_MB27_TIMESTAMP(val) bfin_write16(CAN_MB27_TIMESTAMP, val)
1986#define bfin_read_CAN_MB27_ID0() bfin_read16(CAN_MB27_ID0)
1987#define bfin_write_CAN_MB27_ID0(val) bfin_write16(CAN_MB27_ID0, val)
1988#define bfin_read_CAN_MB27_ID1() bfin_read16(CAN_MB27_ID1)
1989#define bfin_write_CAN_MB27_ID1(val) bfin_write16(CAN_MB27_ID1, val)
1990#define bfin_read_CAN_MB28_DATA0() bfin_read16(CAN_MB28_DATA0)
1991#define bfin_write_CAN_MB28_DATA0(val) bfin_write16(CAN_MB28_DATA0, val)
1992#define bfin_read_CAN_MB28_DATA1() bfin_read16(CAN_MB28_DATA1)
1993#define bfin_write_CAN_MB28_DATA1(val) bfin_write16(CAN_MB28_DATA1, val)
1994#define bfin_read_CAN_MB28_DATA2() bfin_read16(CAN_MB28_DATA2)
1995#define bfin_write_CAN_MB28_DATA2(val) bfin_write16(CAN_MB28_DATA2, val)
1996#define bfin_read_CAN_MB28_DATA3() bfin_read16(CAN_MB28_DATA3)
1997#define bfin_write_CAN_MB28_DATA3(val) bfin_write16(CAN_MB28_DATA3, val)
1998#define bfin_read_CAN_MB28_LENGTH() bfin_read16(CAN_MB28_LENGTH)
1999#define bfin_write_CAN_MB28_LENGTH(val) bfin_write16(CAN_MB28_LENGTH, val)
2000#define bfin_read_CAN_MB28_TIMESTAMP() bfin_read16(CAN_MB28_TIMESTAMP)
2001#define bfin_write_CAN_MB28_TIMESTAMP(val) bfin_write16(CAN_MB28_TIMESTAMP, val)
2002#define bfin_read_CAN_MB28_ID0() bfin_read16(CAN_MB28_ID0)
2003#define bfin_write_CAN_MB28_ID0(val) bfin_write16(CAN_MB28_ID0, val)
2004#define bfin_read_CAN_MB28_ID1() bfin_read16(CAN_MB28_ID1)
2005#define bfin_write_CAN_MB28_ID1(val) bfin_write16(CAN_MB28_ID1, val)
2006#define bfin_read_CAN_MB29_DATA0() bfin_read16(CAN_MB29_DATA0)
2007#define bfin_write_CAN_MB29_DATA0(val) bfin_write16(CAN_MB29_DATA0, val)
2008#define bfin_read_CAN_MB29_DATA1() bfin_read16(CAN_MB29_DATA1)
2009#define bfin_write_CAN_MB29_DATA1(val) bfin_write16(CAN_MB29_DATA1, val)
2010#define bfin_read_CAN_MB29_DATA2() bfin_read16(CAN_MB29_DATA2)
2011#define bfin_write_CAN_MB29_DATA2(val) bfin_write16(CAN_MB29_DATA2, val)
2012#define bfin_read_CAN_MB29_DATA3() bfin_read16(CAN_MB29_DATA3)
2013#define bfin_write_CAN_MB29_DATA3(val) bfin_write16(CAN_MB29_DATA3, val)
2014#define bfin_read_CAN_MB29_LENGTH() bfin_read16(CAN_MB29_LENGTH)
2015#define bfin_write_CAN_MB29_LENGTH(val) bfin_write16(CAN_MB29_LENGTH, val)
2016#define bfin_read_CAN_MB29_TIMESTAMP() bfin_read16(CAN_MB29_TIMESTAMP)
2017#define bfin_write_CAN_MB29_TIMESTAMP(val) bfin_write16(CAN_MB29_TIMESTAMP, val)
2018#define bfin_read_CAN_MB29_ID0() bfin_read16(CAN_MB29_ID0)
2019#define bfin_write_CAN_MB29_ID0(val) bfin_write16(CAN_MB29_ID0, val)
2020#define bfin_read_CAN_MB29_ID1() bfin_read16(CAN_MB29_ID1)
2021#define bfin_write_CAN_MB29_ID1(val) bfin_write16(CAN_MB29_ID1, val)
2022#define bfin_read_CAN_MB30_DATA0() bfin_read16(CAN_MB30_DATA0)
2023#define bfin_write_CAN_MB30_DATA0(val) bfin_write16(CAN_MB30_DATA0, val)
2024#define bfin_read_CAN_MB30_DATA1() bfin_read16(CAN_MB30_DATA1)
2025#define bfin_write_CAN_MB30_DATA1(val) bfin_write16(CAN_MB30_DATA1, val)
2026#define bfin_read_CAN_MB30_DATA2() bfin_read16(CAN_MB30_DATA2)
2027#define bfin_write_CAN_MB30_DATA2(val) bfin_write16(CAN_MB30_DATA2, val)
2028#define bfin_read_CAN_MB30_DATA3() bfin_read16(CAN_MB30_DATA3)
2029#define bfin_write_CAN_MB30_DATA3(val) bfin_write16(CAN_MB30_DATA3, val)
2030#define bfin_read_CAN_MB30_LENGTH() bfin_read16(CAN_MB30_LENGTH)
2031#define bfin_write_CAN_MB30_LENGTH(val) bfin_write16(CAN_MB30_LENGTH, val)
2032#define bfin_read_CAN_MB30_TIMESTAMP() bfin_read16(CAN_MB30_TIMESTAMP)
2033#define bfin_write_CAN_MB30_TIMESTAMP(val) bfin_write16(CAN_MB30_TIMESTAMP, val)
2034#define bfin_read_CAN_MB30_ID0() bfin_read16(CAN_MB30_ID0)
2035#define bfin_write_CAN_MB30_ID0(val) bfin_write16(CAN_MB30_ID0, val)
2036#define bfin_read_CAN_MB30_ID1() bfin_read16(CAN_MB30_ID1)
2037#define bfin_write_CAN_MB30_ID1(val) bfin_write16(CAN_MB30_ID1, val)
2038#define bfin_read_CAN_MB31_DATA0() bfin_read16(CAN_MB31_DATA0)
2039#define bfin_write_CAN_MB31_DATA0(val) bfin_write16(CAN_MB31_DATA0, val)
2040#define bfin_read_CAN_MB31_DATA1() bfin_read16(CAN_MB31_DATA1)
2041#define bfin_write_CAN_MB31_DATA1(val) bfin_write16(CAN_MB31_DATA1, val)
2042#define bfin_read_CAN_MB31_DATA2() bfin_read16(CAN_MB31_DATA2)
2043#define bfin_write_CAN_MB31_DATA2(val) bfin_write16(CAN_MB31_DATA2, val)
2044#define bfin_read_CAN_MB31_DATA3() bfin_read16(CAN_MB31_DATA3)
2045#define bfin_write_CAN_MB31_DATA3(val) bfin_write16(CAN_MB31_DATA3, val)
2046#define bfin_read_CAN_MB31_LENGTH() bfin_read16(CAN_MB31_LENGTH)
2047#define bfin_write_CAN_MB31_LENGTH(val) bfin_write16(CAN_MB31_LENGTH, val)
2048#define bfin_read_CAN_MB31_TIMESTAMP() bfin_read16(CAN_MB31_TIMESTAMP)
2049#define bfin_write_CAN_MB31_TIMESTAMP(val) bfin_write16(CAN_MB31_TIMESTAMP, val)
2050#define bfin_read_CAN_MB31_ID0() bfin_read16(CAN_MB31_ID0)
2051#define bfin_write_CAN_MB31_ID0(val) bfin_write16(CAN_MB31_ID0, val)
2052#define bfin_read_CAN_MB31_ID1() bfin_read16(CAN_MB31_ID1)
2053#define bfin_write_CAN_MB31_ID1(val) bfin_write16(CAN_MB31_ID1, val)
2054
2055/* These need to be last due to the cdef/linux inter-dependencies */
2056#include <asm/irq.h>
2057
2058/* Writing to PLL_CTL initiates a PLL relock sequence. */
2059static __inline__ void bfin_write_PLL_CTL(unsigned int val)
2060{
2061 unsigned long flags, iwr0, iwr1;
2062
2063 if (val == bfin_read_PLL_CTL())
2064 return;
2065
2066 local_irq_save_hw(flags);
2067 /* Enable the PLL Wakeup bit in SIC IWR */
2068 iwr0 = bfin_read32(SIC_IWR0);
2069 iwr1 = bfin_read32(SIC_IWR1);
2070 /* Only allow PPL Wakeup) */
2071 bfin_write32(SIC_IWR0, IWR_ENABLE(0));
2072 bfin_write32(SIC_IWR1, 0);
2073
2074 bfin_write16(PLL_CTL, val);
2075 SSYNC();
2076 asm("IDLE;");
2077
2078 bfin_write32(SIC_IWR0, iwr0);
2079 bfin_write32(SIC_IWR1, iwr1);
2080 local_irq_restore_hw(flags);
2081}
2082
2083/* Writing to VR_CTL initiates a PLL relock sequence. */
2084static __inline__ void bfin_write_VR_CTL(unsigned int val)
2085{
2086 unsigned long flags, iwr0, iwr1;
2087
2088 if (val == bfin_read_VR_CTL())
2089 return;
2090
2091 local_irq_save_hw(flags);
2092 /* Enable the PLL Wakeup bit in SIC IWR */
2093 iwr0 = bfin_read32(SIC_IWR0);
2094 iwr1 = bfin_read32(SIC_IWR1);
2095 /* Only allow PPL Wakeup) */
2096 bfin_write32(SIC_IWR0, IWR_ENABLE(0));
2097 bfin_write32(SIC_IWR1, 0);
2098
2099 bfin_write16(VR_CTL, val);
2100 SSYNC();
2101 asm("IDLE;");
2102
2103 bfin_write32(SIC_IWR0, iwr0);
2104 bfin_write32(SIC_IWR1, iwr1);
2105 local_irq_restore_hw(flags);
2106}
2107
2108#endif
diff --git a/arch/blackfin/mach-bf538/include/mach/cdefBF539.h b/arch/blackfin/mach-bf538/include/mach/cdefBF539.h
new file mode 100644
index 000000000000..198c4bbc8e5d
--- /dev/null
+++ b/arch/blackfin/mach-bf538/include/mach/cdefBF539.h
@@ -0,0 +1,240 @@
1/* DO NOT EDIT THIS FILE
2 * Automatically generated by generate-cdef-headers.xsl
3 * DO NOT EDIT THIS FILE
4 */
5
6#ifndef _CDEF_BF539_H
7#define _CDEF_BF539_H
8
9/* Include MMRs Common to BF538 */
10#include "cdefBF538.h"
11
12
13#define bfin_read_MXVR_CONFIG() bfin_read16(MXVR_CONFIG)
14#define bfin_write_MXVR_CONFIG(val) bfin_write16(MXVR_CONFIG, val)
15#define bfin_read_MXVR_PLL_CTL_0() bfin_read32(MXVR_PLL_CTL_0)
16#define bfin_write_MXVR_PLL_CTL_0(val) bfin_write32(MXVR_PLL_CTL_0, val)
17#define bfin_read_MXVR_STATE_0() bfin_read32(MXVR_STATE_0)
18#define bfin_write_MXVR_STATE_0(val) bfin_write32(MXVR_STATE_0, val)
19#define bfin_read_MXVR_STATE_1() bfin_read32(MXVR_STATE_1)
20#define bfin_write_MXVR_STATE_1(val) bfin_write32(MXVR_STATE_1, val)
21#define bfin_read_MXVR_INT_STAT_0() bfin_read32(MXVR_INT_STAT_0)
22#define bfin_write_MXVR_INT_STAT_0(val) bfin_write32(MXVR_INT_STAT_0, val)
23#define bfin_read_MXVR_INT_STAT_1() bfin_read32(MXVR_INT_STAT_1)
24#define bfin_write_MXVR_INT_STAT_1(val) bfin_write32(MXVR_INT_STAT_1, val)
25#define bfin_read_MXVR_INT_EN_0() bfin_read32(MXVR_INT_EN_0)
26#define bfin_write_MXVR_INT_EN_0(val) bfin_write32(MXVR_INT_EN_0, val)
27#define bfin_read_MXVR_INT_EN_1() bfin_read32(MXVR_INT_EN_1)
28#define bfin_write_MXVR_INT_EN_1(val) bfin_write32(MXVR_INT_EN_1, val)
29#define bfin_read_MXVR_POSITION() bfin_read16(MXVR_POSITION)
30#define bfin_write_MXVR_POSITION(val) bfin_write16(MXVR_POSITION, val)
31#define bfin_read_MXVR_MAX_POSITION() bfin_read16(MXVR_MAX_POSITION)
32#define bfin_write_MXVR_MAX_POSITION(val) bfin_write16(MXVR_MAX_POSITION, val)
33#define bfin_read_MXVR_DELAY() bfin_read16(MXVR_DELAY)
34#define bfin_write_MXVR_DELAY(val) bfin_write16(MXVR_DELAY, val)
35#define bfin_read_MXVR_MAX_DELAY() bfin_read16(MXVR_MAX_DELAY)
36#define bfin_write_MXVR_MAX_DELAY(val) bfin_write16(MXVR_MAX_DELAY, val)
37#define bfin_read_MXVR_LADDR() bfin_read32(MXVR_LADDR)
38#define bfin_write_MXVR_LADDR(val) bfin_write32(MXVR_LADDR, val)
39#define bfin_read_MXVR_GADDR() bfin_read16(MXVR_GADDR)
40#define bfin_write_MXVR_GADDR(val) bfin_write16(MXVR_GADDR, val)
41#define bfin_read_MXVR_AADDR() bfin_read32(MXVR_AADDR)
42#define bfin_write_MXVR_AADDR(val) bfin_write32(MXVR_AADDR, val)
43#define bfin_read_MXVR_ALLOC_0() bfin_read32(MXVR_ALLOC_0)
44#define bfin_write_MXVR_ALLOC_0(val) bfin_write32(MXVR_ALLOC_0, val)
45#define bfin_read_MXVR_ALLOC_1() bfin_read32(MXVR_ALLOC_1)
46#define bfin_write_MXVR_ALLOC_1(val) bfin_write32(MXVR_ALLOC_1, val)
47#define bfin_read_MXVR_ALLOC_2() bfin_read32(MXVR_ALLOC_2)
48#define bfin_write_MXVR_ALLOC_2(val) bfin_write32(MXVR_ALLOC_2, val)
49#define bfin_read_MXVR_ALLOC_3() bfin_read32(MXVR_ALLOC_3)
50#define bfin_write_MXVR_ALLOC_3(val) bfin_write32(MXVR_ALLOC_3, val)
51#define bfin_read_MXVR_ALLOC_4() bfin_read32(MXVR_ALLOC_4)
52#define bfin_write_MXVR_ALLOC_4(val) bfin_write32(MXVR_ALLOC_4, val)
53#define bfin_read_MXVR_ALLOC_5() bfin_read32(MXVR_ALLOC_5)
54#define bfin_write_MXVR_ALLOC_5(val) bfin_write32(MXVR_ALLOC_5, val)
55#define bfin_read_MXVR_ALLOC_6() bfin_read32(MXVR_ALLOC_6)
56#define bfin_write_MXVR_ALLOC_6(val) bfin_write32(MXVR_ALLOC_6, val)
57#define bfin_read_MXVR_ALLOC_7() bfin_read32(MXVR_ALLOC_7)
58#define bfin_write_MXVR_ALLOC_7(val) bfin_write32(MXVR_ALLOC_7, val)
59#define bfin_read_MXVR_ALLOC_8() bfin_read32(MXVR_ALLOC_8)
60#define bfin_write_MXVR_ALLOC_8(val) bfin_write32(MXVR_ALLOC_8, val)
61#define bfin_read_MXVR_ALLOC_9() bfin_read32(MXVR_ALLOC_9)
62#define bfin_write_MXVR_ALLOC_9(val) bfin_write32(MXVR_ALLOC_9, val)
63#define bfin_read_MXVR_ALLOC_10() bfin_read32(MXVR_ALLOC_10)
64#define bfin_write_MXVR_ALLOC_10(val) bfin_write32(MXVR_ALLOC_10, val)
65#define bfin_read_MXVR_ALLOC_11() bfin_read32(MXVR_ALLOC_11)
66#define bfin_write_MXVR_ALLOC_11(val) bfin_write32(MXVR_ALLOC_11, val)
67#define bfin_read_MXVR_ALLOC_12() bfin_read32(MXVR_ALLOC_12)
68#define bfin_write_MXVR_ALLOC_12(val) bfin_write32(MXVR_ALLOC_12, val)
69#define bfin_read_MXVR_ALLOC_13() bfin_read32(MXVR_ALLOC_13)
70#define bfin_write_MXVR_ALLOC_13(val) bfin_write32(MXVR_ALLOC_13, val)
71#define bfin_read_MXVR_ALLOC_14() bfin_read32(MXVR_ALLOC_14)
72#define bfin_write_MXVR_ALLOC_14(val) bfin_write32(MXVR_ALLOC_14, val)
73#define bfin_read_MXVR_SYNC_LCHAN_0() bfin_read32(MXVR_SYNC_LCHAN_0)
74#define bfin_write_MXVR_SYNC_LCHAN_0(val) bfin_write32(MXVR_SYNC_LCHAN_0, val)
75#define bfin_read_MXVR_SYNC_LCHAN_1() bfin_read32(MXVR_SYNC_LCHAN_1)
76#define bfin_write_MXVR_SYNC_LCHAN_1(val) bfin_write32(MXVR_SYNC_LCHAN_1, val)
77#define bfin_read_MXVR_SYNC_LCHAN_2() bfin_read32(MXVR_SYNC_LCHAN_2)
78#define bfin_write_MXVR_SYNC_LCHAN_2(val) bfin_write32(MXVR_SYNC_LCHAN_2, val)
79#define bfin_read_MXVR_SYNC_LCHAN_3() bfin_read32(MXVR_SYNC_LCHAN_3)
80#define bfin_write_MXVR_SYNC_LCHAN_3(val) bfin_write32(MXVR_SYNC_LCHAN_3, val)
81#define bfin_read_MXVR_SYNC_LCHAN_4() bfin_read32(MXVR_SYNC_LCHAN_4)
82#define bfin_write_MXVR_SYNC_LCHAN_4(val) bfin_write32(MXVR_SYNC_LCHAN_4, val)
83#define bfin_read_MXVR_SYNC_LCHAN_5() bfin_read32(MXVR_SYNC_LCHAN_5)
84#define bfin_write_MXVR_SYNC_LCHAN_5(val) bfin_write32(MXVR_SYNC_LCHAN_5, val)
85#define bfin_read_MXVR_SYNC_LCHAN_6() bfin_read32(MXVR_SYNC_LCHAN_6)
86#define bfin_write_MXVR_SYNC_LCHAN_6(val) bfin_write32(MXVR_SYNC_LCHAN_6, val)
87#define bfin_read_MXVR_SYNC_LCHAN_7() bfin_read32(MXVR_SYNC_LCHAN_7)
88#define bfin_write_MXVR_SYNC_LCHAN_7(val) bfin_write32(MXVR_SYNC_LCHAN_7, val)
89#define bfin_read_MXVR_DMA0_CONFIG() bfin_read32(MXVR_DMA0_CONFIG)
90#define bfin_write_MXVR_DMA0_CONFIG(val) bfin_write32(MXVR_DMA0_CONFIG, val)
91#define bfin_read_MXVR_DMA0_START_ADDR() bfin_readPTR(MXVR_DMA0_START_ADDR)
92#define bfin_write_MXVR_DMA0_START_ADDR(val) bfin_writePTR(MXVR_DMA0_START_ADDR, val)
93#define bfin_read_MXVR_DMA0_COUNT() bfin_read16(MXVR_DMA0_COUNT)
94#define bfin_write_MXVR_DMA0_COUNT(val) bfin_write16(MXVR_DMA0_COUNT, val)
95#define bfin_read_MXVR_DMA0_CURR_ADDR() bfin_readPTR(MXVR_DMA0_CURR_ADDR)
96#define bfin_write_MXVR_DMA0_CURR_ADDR(val) bfin_writePTR(MXVR_DMA0_CURR_ADDR, val)
97#define bfin_read_MXVR_DMA0_CURR_COUNT() bfin_read16(MXVR_DMA0_CURR_COUNT)
98#define bfin_write_MXVR_DMA0_CURR_COUNT(val) bfin_write16(MXVR_DMA0_CURR_COUNT, val)
99#define bfin_read_MXVR_DMA1_CONFIG() bfin_read32(MXVR_DMA1_CONFIG)
100#define bfin_write_MXVR_DMA1_CONFIG(val) bfin_write32(MXVR_DMA1_CONFIG, val)
101#define bfin_read_MXVR_DMA1_START_ADDR() bfin_readPTR(MXVR_DMA1_START_ADDR)
102#define bfin_write_MXVR_DMA1_START_ADDR(val) bfin_writePTR(MXVR_DMA1_START_ADDR, val)
103#define bfin_read_MXVR_DMA1_COUNT() bfin_read16(MXVR_DMA1_COUNT)
104#define bfin_write_MXVR_DMA1_COUNT(val) bfin_write16(MXVR_DMA1_COUNT, val)
105#define bfin_read_MXVR_DMA1_CURR_ADDR() bfin_readPTR(MXVR_DMA1_CURR_ADDR)
106#define bfin_write_MXVR_DMA1_CURR_ADDR(val) bfin_writePTR(MXVR_DMA1_CURR_ADDR, val)
107#define bfin_read_MXVR_DMA1_CURR_COUNT() bfin_read16(MXVR_DMA1_CURR_COUNT)
108#define bfin_write_MXVR_DMA1_CURR_COUNT(val) bfin_write16(MXVR_DMA1_CURR_COUNT, val)
109#define bfin_read_MXVR_DMA2_CONFIG() bfin_read32(MXVR_DMA2_CONFIG)
110#define bfin_write_MXVR_DMA2_CONFIG(val) bfin_write32(MXVR_DMA2_CONFIG, val)
111#define bfin_read_MXVR_DMA2_START_ADDR() bfin_readPTR(MXVR_DMA2_START_ADDR)
112#define bfin_write_MXVR_DMA2_START_ADDR(val) bfin_writePTR(MXVR_DMA2_START_ADDR, val)
113#define bfin_read_MXVR_DMA2_COUNT() bfin_read16(MXVR_DMA2_COUNT)
114#define bfin_write_MXVR_DMA2_COUNT(val) bfin_write16(MXVR_DMA2_COUNT, val)
115#define bfin_read_MXVR_DMA2_CURR_ADDR() bfin_readPTR(MXVR_DMA2_CURR_ADDR)
116#define bfin_write_MXVR_DMA2_CURR_ADDR(val) bfin_writePTR(MXVR_DMA2_CURR_ADDR, val)
117#define bfin_read_MXVR_DMA2_CURR_COUNT() bfin_read16(MXVR_DMA2_CURR_COUNT)
118#define bfin_write_MXVR_DMA2_CURR_COUNT(val) bfin_write16(MXVR_DMA2_CURR_COUNT, val)
119#define bfin_read_MXVR_DMA3_CONFIG() bfin_read32(MXVR_DMA3_CONFIG)
120#define bfin_write_MXVR_DMA3_CONFIG(val) bfin_write32(MXVR_DMA3_CONFIG, val)
121#define bfin_read_MXVR_DMA3_START_ADDR() bfin_readPTR(MXVR_DMA3_START_ADDR)
122#define bfin_write_MXVR_DMA3_START_ADDR(val) bfin_writePTR(MXVR_DMA3_START_ADDR, val)
123#define bfin_read_MXVR_DMA3_COUNT() bfin_read16(MXVR_DMA3_COUNT)
124#define bfin_write_MXVR_DMA3_COUNT(val) bfin_write16(MXVR_DMA3_COUNT, val)
125#define bfin_read_MXVR_DMA3_CURR_ADDR() bfin_readPTR(MXVR_DMA3_CURR_ADDR)
126#define bfin_write_MXVR_DMA3_CURR_ADDR(val) bfin_writePTR(MXVR_DMA3_CURR_ADDR, val)
127#define bfin_read_MXVR_DMA3_CURR_COUNT() bfin_read16(MXVR_DMA3_CURR_COUNT)
128#define bfin_write_MXVR_DMA3_CURR_COUNT(val) bfin_write16(MXVR_DMA3_CURR_COUNT, val)
129#define bfin_read_MXVR_DMA4_CONFIG() bfin_read32(MXVR_DMA4_CONFIG)
130#define bfin_write_MXVR_DMA4_CONFIG(val) bfin_write32(MXVR_DMA4_CONFIG, val)
131#define bfin_read_MXVR_DMA4_START_ADDR() bfin_readPTR(MXVR_DMA4_START_ADDR)
132#define bfin_write_MXVR_DMA4_START_ADDR(val) bfin_writePTR(MXVR_DMA4_START_ADDR, val)
133#define bfin_read_MXVR_DMA4_COUNT() bfin_read16(MXVR_DMA4_COUNT)
134#define bfin_write_MXVR_DMA4_COUNT(val) bfin_write16(MXVR_DMA4_COUNT, val)
135#define bfin_read_MXVR_DMA4_CURR_ADDR() bfin_readPTR(MXVR_DMA4_CURR_ADDR)
136#define bfin_write_MXVR_DMA4_CURR_ADDR(val) bfin_writePTR(MXVR_DMA4_CURR_ADDR, val)
137#define bfin_read_MXVR_DMA4_CURR_COUNT() bfin_read16(MXVR_DMA4_CURR_COUNT)
138#define bfin_write_MXVR_DMA4_CURR_COUNT(val) bfin_write16(MXVR_DMA4_CURR_COUNT, val)
139#define bfin_read_MXVR_DMA5_CONFIG() bfin_read32(MXVR_DMA5_CONFIG)
140#define bfin_write_MXVR_DMA5_CONFIG(val) bfin_write32(MXVR_DMA5_CONFIG, val)
141#define bfin_read_MXVR_DMA5_START_ADDR() bfin_readPTR(MXVR_DMA5_START_ADDR)
142#define bfin_write_MXVR_DMA5_START_ADDR(val) bfin_writePTR(MXVR_DMA5_START_ADDR, val)
143#define bfin_read_MXVR_DMA5_COUNT() bfin_read16(MXVR_DMA5_COUNT)
144#define bfin_write_MXVR_DMA5_COUNT(val) bfin_write16(MXVR_DMA5_COUNT, val)
145#define bfin_read_MXVR_DMA5_CURR_ADDR() bfin_readPTR(MXVR_DMA5_CURR_ADDR)
146#define bfin_write_MXVR_DMA5_CURR_ADDR(val) bfin_writePTR(MXVR_DMA5_CURR_ADDR, val)
147#define bfin_read_MXVR_DMA5_CURR_COUNT() bfin_read16(MXVR_DMA5_CURR_COUNT)
148#define bfin_write_MXVR_DMA5_CURR_COUNT(val) bfin_write16(MXVR_DMA5_CURR_COUNT, val)
149#define bfin_read_MXVR_DMA6_CONFIG() bfin_read32(MXVR_DMA6_CONFIG)
150#define bfin_write_MXVR_DMA6_CONFIG(val) bfin_write32(MXVR_DMA6_CONFIG, val)
151#define bfin_read_MXVR_DMA6_START_ADDR() bfin_readPTR(MXVR_DMA6_START_ADDR)
152#define bfin_write_MXVR_DMA6_START_ADDR(val) bfin_writePTR(MXVR_DMA6_START_ADDR, val)
153#define bfin_read_MXVR_DMA6_COUNT() bfin_read16(MXVR_DMA6_COUNT)
154#define bfin_write_MXVR_DMA6_COUNT(val) bfin_write16(MXVR_DMA6_COUNT, val)
155#define bfin_read_MXVR_DMA6_CURR_ADDR() bfin_readPTR(MXVR_DMA6_CURR_ADDR)
156#define bfin_write_MXVR_DMA6_CURR_ADDR(val) bfin_writePTR(MXVR_DMA6_CURR_ADDR, val)
157#define bfin_read_MXVR_DMA6_CURR_COUNT() bfin_read16(MXVR_DMA6_CURR_COUNT)
158#define bfin_write_MXVR_DMA6_CURR_COUNT(val) bfin_write16(MXVR_DMA6_CURR_COUNT, val)
159#define bfin_read_MXVR_DMA7_CONFIG() bfin_read32(MXVR_DMA7_CONFIG)
160#define bfin_write_MXVR_DMA7_CONFIG(val) bfin_write32(MXVR_DMA7_CONFIG, val)
161#define bfin_read_MXVR_DMA7_START_ADDR() bfin_readPTR(MXVR_DMA7_START_ADDR)
162#define bfin_write_MXVR_DMA7_START_ADDR(val) bfin_writePTR(MXVR_DMA7_START_ADDR, val)
163#define bfin_read_MXVR_DMA7_COUNT() bfin_read16(MXVR_DMA7_COUNT)
164#define bfin_write_MXVR_DMA7_COUNT(val) bfin_write16(MXVR_DMA7_COUNT, val)
165#define bfin_read_MXVR_DMA7_CURR_ADDR() bfin_readPTR(MXVR_DMA7_CURR_ADDR)
166#define bfin_write_MXVR_DMA7_CURR_ADDR(val) bfin_writePTR(MXVR_DMA7_CURR_ADDR, val)
167#define bfin_read_MXVR_DMA7_CURR_COUNT() bfin_read16(MXVR_DMA7_CURR_COUNT)
168#define bfin_write_MXVR_DMA7_CURR_COUNT(val) bfin_write16(MXVR_DMA7_CURR_COUNT, val)
169#define bfin_read_MXVR_AP_CTL() bfin_read16(MXVR_AP_CTL)
170#define bfin_write_MXVR_AP_CTL(val) bfin_write16(MXVR_AP_CTL, val)
171#define bfin_read_MXVR_APRB_START_ADDR() bfin_readPTR(MXVR_APRB_START_ADDR)
172#define bfin_write_MXVR_APRB_START_ADDR(val) bfin_writePTR(MXVR_APRB_START_ADDR, val)
173#define bfin_read_MXVR_APRB_CURR_ADDR() bfin_readPTR(MXVR_APRB_CURR_ADDR)
174#define bfin_write_MXVR_APRB_CURR_ADDR(val) bfin_writePTR(MXVR_APRB_CURR_ADDR, val)
175#define bfin_read_MXVR_APTB_START_ADDR() bfin_readPTR(MXVR_APTB_START_ADDR)
176#define bfin_write_MXVR_APTB_START_ADDR(val) bfin_writePTR(MXVR_APTB_START_ADDR, val)
177#define bfin_read_MXVR_APTB_CURR_ADDR() bfin_readPTR(MXVR_APTB_CURR_ADDR)
178#define bfin_write_MXVR_APTB_CURR_ADDR(val) bfin_writePTR(MXVR_APTB_CURR_ADDR, val)
179#define bfin_read_MXVR_CM_CTL() bfin_read32(MXVR_CM_CTL)
180#define bfin_write_MXVR_CM_CTL(val) bfin_write32(MXVR_CM_CTL, val)
181#define bfin_read_MXVR_CMRB_START_ADDR() bfin_readPTR(MXVR_CMRB_START_ADDR)
182#define bfin_write_MXVR_CMRB_START_ADDR(val) bfin_writePTR(MXVR_CMRB_START_ADDR, val)
183#define bfin_read_MXVR_CMRB_CURR_ADDR() bfin_readPTR(MXVR_CMRB_CURR_ADDR)
184#define bfin_write_MXVR_CMRB_CURR_ADDR(val) bfin_writePTR(MXVR_CMRB_CURR_ADDR, val)
185#define bfin_read_MXVR_CMTB_START_ADDR() bfin_readPTR(MXVR_CMTB_START_ADDR)
186#define bfin_write_MXVR_CMTB_START_ADDR(val) bfin_writePTR(MXVR_CMTB_START_ADDR, val)
187#define bfin_read_MXVR_CMTB_CURR_ADDR() bfin_readPTR(MXVR_CMTB_CURR_ADDR)
188#define bfin_write_MXVR_CMTB_CURR_ADDR(val) bfin_writePTR(MXVR_CMTB_CURR_ADDR, val)
189#define bfin_read_MXVR_RRDB_START_ADDR() bfin_readPTR(MXVR_RRDB_START_ADDR)
190#define bfin_write_MXVR_RRDB_START_ADDR(val) bfin_writePTR(MXVR_RRDB_START_ADDR, val)
191#define bfin_read_MXVR_RRDB_CURR_ADDR() bfin_readPTR(MXVR_RRDB_CURR_ADDR)
192#define bfin_write_MXVR_RRDB_CURR_ADDR(val) bfin_writePTR(MXVR_RRDB_CURR_ADDR, val)
193#define bfin_read_MXVR_PAT_DATA_0() bfin_read32(MXVR_PAT_DATA_0)
194#define bfin_write_MXVR_PAT_DATA_0(val) bfin_write32(MXVR_PAT_DATA_0, val)
195#define bfin_read_MXVR_PAT_EN_0() bfin_read32(MXVR_PAT_EN_0)
196#define bfin_write_MXVR_PAT_EN_0(val) bfin_write32(MXVR_PAT_EN_0, val)
197#define bfin_read_MXVR_PAT_DATA_1() bfin_read32(MXVR_PAT_DATA_1)
198#define bfin_write_MXVR_PAT_DATA_1(val) bfin_write32(MXVR_PAT_DATA_1, val)
199#define bfin_read_MXVR_PAT_EN_1() bfin_read32(MXVR_PAT_EN_1)
200#define bfin_write_MXVR_PAT_EN_1(val) bfin_write32(MXVR_PAT_EN_1, val)
201#define bfin_read_MXVR_FRAME_CNT_0() bfin_read16(MXVR_FRAME_CNT_0)
202#define bfin_write_MXVR_FRAME_CNT_0(val) bfin_write16(MXVR_FRAME_CNT_0, val)
203#define bfin_read_MXVR_FRAME_CNT_1() bfin_read16(MXVR_FRAME_CNT_1)
204#define bfin_write_MXVR_FRAME_CNT_1(val) bfin_write16(MXVR_FRAME_CNT_1, val)
205#define bfin_read_MXVR_ROUTING_0() bfin_read32(MXVR_ROUTING_0)
206#define bfin_write_MXVR_ROUTING_0(val) bfin_write32(MXVR_ROUTING_0, val)
207#define bfin_read_MXVR_ROUTING_1() bfin_read32(MXVR_ROUTING_1)
208#define bfin_write_MXVR_ROUTING_1(val) bfin_write32(MXVR_ROUTING_1, val)
209#define bfin_read_MXVR_ROUTING_2() bfin_read32(MXVR_ROUTING_2)
210#define bfin_write_MXVR_ROUTING_2(val) bfin_write32(MXVR_ROUTING_2, val)
211#define bfin_read_MXVR_ROUTING_3() bfin_read32(MXVR_ROUTING_3)
212#define bfin_write_MXVR_ROUTING_3(val) bfin_write32(MXVR_ROUTING_3, val)
213#define bfin_read_MXVR_ROUTING_4() bfin_read32(MXVR_ROUTING_4)
214#define bfin_write_MXVR_ROUTING_4(val) bfin_write32(MXVR_ROUTING_4, val)
215#define bfin_read_MXVR_ROUTING_5() bfin_read32(MXVR_ROUTING_5)
216#define bfin_write_MXVR_ROUTING_5(val) bfin_write32(MXVR_ROUTING_5, val)
217#define bfin_read_MXVR_ROUTING_6() bfin_read32(MXVR_ROUTING_6)
218#define bfin_write_MXVR_ROUTING_6(val) bfin_write32(MXVR_ROUTING_6, val)
219#define bfin_read_MXVR_ROUTING_7() bfin_read32(MXVR_ROUTING_7)
220#define bfin_write_MXVR_ROUTING_7(val) bfin_write32(MXVR_ROUTING_7, val)
221#define bfin_read_MXVR_ROUTING_8() bfin_read32(MXVR_ROUTING_8)
222#define bfin_write_MXVR_ROUTING_8(val) bfin_write32(MXVR_ROUTING_8, val)
223#define bfin_read_MXVR_ROUTING_9() bfin_read32(MXVR_ROUTING_9)
224#define bfin_write_MXVR_ROUTING_9(val) bfin_write32(MXVR_ROUTING_9, val)
225#define bfin_read_MXVR_ROUTING_10() bfin_read32(MXVR_ROUTING_10)
226#define bfin_write_MXVR_ROUTING_10(val) bfin_write32(MXVR_ROUTING_10, val)
227#define bfin_read_MXVR_ROUTING_11() bfin_read32(MXVR_ROUTING_11)
228#define bfin_write_MXVR_ROUTING_11(val) bfin_write32(MXVR_ROUTING_11, val)
229#define bfin_read_MXVR_ROUTING_12() bfin_read32(MXVR_ROUTING_12)
230#define bfin_write_MXVR_ROUTING_12(val) bfin_write32(MXVR_ROUTING_12, val)
231#define bfin_read_MXVR_ROUTING_13() bfin_read32(MXVR_ROUTING_13)
232#define bfin_write_MXVR_ROUTING_13(val) bfin_write32(MXVR_ROUTING_13, val)
233#define bfin_read_MXVR_ROUTING_14() bfin_read32(MXVR_ROUTING_14)
234#define bfin_write_MXVR_ROUTING_14(val) bfin_write32(MXVR_ROUTING_14, val)
235#define bfin_read_MXVR_PLL_CTL_1() bfin_read32(MXVR_PLL_CTL_1)
236#define bfin_write_MXVR_PLL_CTL_1(val) bfin_write32(MXVR_PLL_CTL_1, val)
237#define bfin_read_MXVR_BLOCK_CNT() bfin_read16(MXVR_BLOCK_CNT)
238#define bfin_write_MXVR_BLOCK_CNT(val) bfin_write16(MXVR_BLOCK_CNT, val)
239
240#endif /* _CDEF_BF539_H */
diff --git a/arch/blackfin/mach-bf538/include/mach/defBF539.h b/arch/blackfin/mach-bf538/include/mach/defBF539.h
new file mode 100644
index 000000000000..6adbfcc65a35
--- /dev/null
+++ b/arch/blackfin/mach-bf538/include/mach/defBF539.h
@@ -0,0 +1,4243 @@
1/************************************************************************
2 *
3 * This file is subject to the terms and conditions of the GNU Public
4 * License. See the file "COPYING" in the main directory of this archive
5 * for more details.
6 *
7 * Non-GPL License also available as part of VisualDSP++
8 * http://www.analog.com/processors/resources/crosscore/visualDspDevSoftware.html
9 *
10 * (c) Copyright 2001-2005 Analog Devices, Inc. All rights reserved
11 *
12 * This file under source code control, please send bugs or changes to:
13 * dsptools.support@analog.com
14 *
15 ************************************************************************/
16/*
17 * File: include/asm-blackfin/mach-bf538/defBF539.h
18 * Based on:
19 * Author:
20 *
21 * Created:
22 * Description:
23 *
24 * Rev:
25 *
26 * Modified:
27 *
28 * Bugs: Enter bugs at http://blackfin.uclinux.org/
29 *
30 * This program is free software; you can redistribute it and/or modify
31 * it under the terms of the GNU General Public License as published by
32 * the Free Software Foundation; either version 2, or (at your option)
33 * any later version.
34 *
35 * This program is distributed in the hope that it will be useful,
36 * but WITHOUT ANY WARRANTY; without even the implied warranty of
37 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
38 * GNU General Public License for more details.
39 *
40 * You should have received a copy of the GNU General Public License
41 * along with this program; see the file COPYING.
42 * If not, write to the Free Software Foundation,
43 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
44 */
45/* SYSTEM & MM REGISTER BIT & ADDRESS DEFINITIONS FOR ADSP-BF538/9 */
46
47#ifndef _DEF_BF539_H
48#define _DEF_BF539_H
49
50/* include all Core registers and bit definitions */
51#include <asm/def_LPBlackfin.h>
52
53
54/*********************************************************************************** */
55/* System MMR Register Map */
56/*********************************************************************************** */
57/* Clock/Regulator Control (0xFFC00000 - 0xFFC000FF) */
58#define PLL_CTL 0xFFC00000 /* PLL Control register (16-bit) */
59#define PLL_DIV 0xFFC00004 /* PLL Divide Register (16-bit) */
60#define VR_CTL 0xFFC00008 /* Voltage Regulator Control Register (16-bit) */
61#define PLL_STAT 0xFFC0000C /* PLL Status register (16-bit) */
62#define PLL_LOCKCNT 0xFFC00010 /* PLL Lock Count register (16-bit) */
63#define CHIPID 0xFFC00014 /* Chip ID Register */
64
65/* CHIPID Masks */
66#define CHIPID_VERSION 0xF0000000
67#define CHIPID_FAMILY 0x0FFFF000
68#define CHIPID_MANUFACTURE 0x00000FFE
69
70/* System Interrupt Controller (0xFFC00100 - 0xFFC001FF) */
71#define SWRST 0xFFC00100 /* Software Reset Register (16-bit) */
72#define SYSCR 0xFFC00104 /* System Configuration registe */
73#define SIC_IMASK0 0xFFC0010C /* Interrupt Mask Register */
74#define SIC_IAR0 0xFFC00110 /* Interrupt Assignment Register 0 */
75#define SIC_IAR1 0xFFC00114 /* Interrupt Assignment Register 1 */
76#define SIC_IAR2 0xFFC00118 /* Interrupt Assignment Register 2 */
77#define SIC_IAR3 0xFFC0011C /* Interrupt Assignment Register 3 */
78#define SIC_ISR0 0xFFC00120 /* Interrupt Status Register */
79#define SIC_IWR0 0xFFC00124 /* Interrupt Wakeup Register */
80#define SIC_IMASK1 0xFFC00128 /* Interrupt Mask Register 1 */
81#define SIC_ISR1 0xFFC0012C /* Interrupt Status Register 1 */
82#define SIC_IWR1 0xFFC00130 /* Interrupt Wakeup Register 1 */
83#define SIC_IAR4 0xFFC00134 /* Interrupt Assignment Register 4 */
84#define SIC_IAR5 0xFFC00138 /* Interrupt Assignment Register 5 */
85#define SIC_IAR6 0xFFC0013C /* Interrupt Assignment Register 6 */
86
87
88/* Watchdog Timer (0xFFC00200 - 0xFFC002FF) */
89#define WDOG_CTL 0xFFC00200 /* Watchdog Control Register */
90#define WDOG_CNT 0xFFC00204 /* Watchdog Count Register */
91#define WDOG_STAT 0xFFC00208 /* Watchdog Status Register */
92
93
94/* Real Time Clock (0xFFC00300 - 0xFFC003FF) */
95#define RTC_STAT 0xFFC00300 /* RTC Status Register */
96#define RTC_ICTL 0xFFC00304 /* RTC Interrupt Control Register */
97#define RTC_ISTAT 0xFFC00308 /* RTC Interrupt Status Register */
98#define RTC_SWCNT 0xFFC0030C /* RTC Stopwatch Count Register */
99#define RTC_ALARM 0xFFC00310 /* RTC Alarm Time Register */
100#define RTC_FAST 0xFFC00314 /* RTC Prescaler Enable Register */
101#define RTC_PREN 0xFFC00314 /* RTC Prescaler Enable Register (alternate macro) */
102
103
104/* UART0 Controller (0xFFC00400 - 0xFFC004FF) */
105#define UART0_THR 0xFFC00400 /* Transmit Holding register */
106#define UART0_RBR 0xFFC00400 /* Receive Buffer register */
107#define UART0_DLL 0xFFC00400 /* Divisor Latch (Low-Byte) */
108#define UART0_IER 0xFFC00404 /* Interrupt Enable Register */
109#define UART0_DLH 0xFFC00404 /* Divisor Latch (High-Byte) */
110#define UART0_IIR 0xFFC00408 /* Interrupt Identification Register */
111#define UART0_LCR 0xFFC0040C /* Line Control Register */
112#define UART0_MCR 0xFFC00410 /* Modem Control Register */
113#define UART0_LSR 0xFFC00414 /* Line Status Register */
114#define UART0_SCR 0xFFC0041C /* SCR Scratch Register */
115#define UART0_GCTL 0xFFC00424 /* Global Control Register */
116
117
118/* SPI0 Controller (0xFFC00500 - 0xFFC005FF) */
119
120#define SPI0_CTL 0xFFC00500 /* SPI0 Control Register */
121#define SPI0_FLG 0xFFC00504 /* SPI0 Flag register */
122#define SPI0_STAT 0xFFC00508 /* SPI0 Status register */
123#define SPI0_TDBR 0xFFC0050C /* SPI0 Transmit Data Buffer Register */
124#define SPI0_RDBR 0xFFC00510 /* SPI0 Receive Data Buffer Register */
125#define SPI0_BAUD 0xFFC00514 /* SPI0 Baud rate Register */
126#define SPI0_SHADOW 0xFFC00518 /* SPI0_RDBR Shadow Register */
127#define SPI0_REGBASE SPI0_CTL
128
129
130/* TIMER 0, 1, 2 Registers (0xFFC00600 - 0xFFC006FF) */
131#define TIMER0_CONFIG 0xFFC00600 /* Timer 0 Configuration Register */
132#define TIMER0_COUNTER 0xFFC00604 /* Timer 0 Counter Register */
133#define TIMER0_PERIOD 0xFFC00608 /* Timer 0 Period Register */
134#define TIMER0_WIDTH 0xFFC0060C /* Timer 0 Width Register */
135
136#define TIMER1_CONFIG 0xFFC00610 /* Timer 1 Configuration Register */
137#define TIMER1_COUNTER 0xFFC00614 /* Timer 1 Counter Register */
138#define TIMER1_PERIOD 0xFFC00618 /* Timer 1 Period Register */
139#define TIMER1_WIDTH 0xFFC0061C /* Timer 1 Width Register */
140
141#define TIMER2_CONFIG 0xFFC00620 /* Timer 2 Configuration Register */
142#define TIMER2_COUNTER 0xFFC00624 /* Timer 2 Counter Register */
143#define TIMER2_PERIOD 0xFFC00628 /* Timer 2 Period Register */
144#define TIMER2_WIDTH 0xFFC0062C /* Timer 2 Width Register */
145
146#define TIMER_ENABLE 0xFFC00640 /* Timer Enable Register */
147#define TIMER_DISABLE 0xFFC00644 /* Timer Disable Register */
148#define TIMER_STATUS 0xFFC00648 /* Timer Status Register */
149
150
151/* Programmable Flags (0xFFC00700 - 0xFFC007FF) */
152#define FIO_FLAG_D 0xFFC00700 /* Flag Mask to directly specify state of pins */
153#define FIO_FLAG_C 0xFFC00704 /* Peripheral Interrupt Flag Register (clear) */
154#define FIO_FLAG_S 0xFFC00708 /* Peripheral Interrupt Flag Register (set) */
155#define FIO_FLAG_T 0xFFC0070C /* Flag Mask to directly toggle state of pins */
156#define FIO_MASKA_D 0xFFC00710 /* Flag Mask Interrupt A Register (set directly) */
157#define FIO_MASKA_C 0xFFC00714 /* Flag Mask Interrupt A Register (clear) */
158#define FIO_MASKA_S 0xFFC00718 /* Flag Mask Interrupt A Register (set) */
159#define FIO_MASKA_T 0xFFC0071C /* Flag Mask Interrupt A Register (toggle) */
160#define FIO_MASKB_D 0xFFC00720 /* Flag Mask Interrupt B Register (set directly) */
161#define FIO_MASKB_C 0xFFC00724 /* Flag Mask Interrupt B Register (clear) */
162#define FIO_MASKB_S 0xFFC00728 /* Flag Mask Interrupt B Register (set) */
163#define FIO_MASKB_T 0xFFC0072C /* Flag Mask Interrupt B Register (toggle) */
164#define FIO_DIR 0xFFC00730 /* Peripheral Flag Direction Register */
165#define FIO_POLAR 0xFFC00734 /* Flag Source Polarity Register */
166#define FIO_EDGE 0xFFC00738 /* Flag Source Sensitivity Register */
167#define FIO_BOTH 0xFFC0073C /* Flag Set on BOTH Edges Register */
168#define FIO_INEN 0xFFC00740 /* Flag Input Enable Register */
169
170
171/* SPORT0 Controller (0xFFC00800 - 0xFFC008FF) */
172#define SPORT0_TCR1 0xFFC00800 /* SPORT0 Transmit Configuration 1 Register */
173#define SPORT0_TCR2 0xFFC00804 /* SPORT0 Transmit Configuration 2 Register */
174#define SPORT0_TCLKDIV 0xFFC00808 /* SPORT0 Transmit Clock Divider */
175#define SPORT0_TFSDIV 0xFFC0080C /* SPORT0 Transmit Frame Sync Divider */
176#define SPORT0_TX 0xFFC00810 /* SPORT0 TX Data Register */
177#define SPORT0_RX 0xFFC00818 /* SPORT0 RX Data Register */
178#define SPORT0_RCR1 0xFFC00820 /* SPORT0 Transmit Configuration 1 Register */
179#define SPORT0_RCR2 0xFFC00824 /* SPORT0 Transmit Configuration 2 Register */
180#define SPORT0_RCLKDIV 0xFFC00828 /* SPORT0 Receive Clock Divider */
181#define SPORT0_RFSDIV 0xFFC0082C /* SPORT0 Receive Frame Sync Divider */
182#define SPORT0_STAT 0xFFC00830 /* SPORT0 Status Register */
183#define SPORT0_CHNL 0xFFC00834 /* SPORT0 Current Channel Register */
184#define SPORT0_MCMC1 0xFFC00838 /* SPORT0 Multi-Channel Configuration Register 1 */
185#define SPORT0_MCMC2 0xFFC0083C /* SPORT0 Multi-Channel Configuration Register 2 */
186#define SPORT0_MTCS0 0xFFC00840 /* SPORT0 Multi-Channel Transmit Select Register 0 */
187#define SPORT0_MTCS1 0xFFC00844 /* SPORT0 Multi-Channel Transmit Select Register 1 */
188#define SPORT0_MTCS2 0xFFC00848 /* SPORT0 Multi-Channel Transmit Select Register 2 */
189#define SPORT0_MTCS3 0xFFC0084C /* SPORT0 Multi-Channel Transmit Select Register 3 */
190#define SPORT0_MRCS0 0xFFC00850 /* SPORT0 Multi-Channel Receive Select Register 0 */
191#define SPORT0_MRCS1 0xFFC00854 /* SPORT0 Multi-Channel Receive Select Register 1 */
192#define SPORT0_MRCS2 0xFFC00858 /* SPORT0 Multi-Channel Receive Select Register 2 */
193#define SPORT0_MRCS3 0xFFC0085C /* SPORT0 Multi-Channel Receive Select Register 3 */
194
195
196/* SPORT1 Controller (0xFFC00900 - 0xFFC009FF) */
197#define SPORT1_TCR1 0xFFC00900 /* SPORT1 Transmit Configuration 1 Register */
198#define SPORT1_TCR2 0xFFC00904 /* SPORT1 Transmit Configuration 2 Register */
199#define SPORT1_TCLKDIV 0xFFC00908 /* SPORT1 Transmit Clock Divider */
200#define SPORT1_TFSDIV 0xFFC0090C /* SPORT1 Transmit Frame Sync Divider */
201#define SPORT1_TX 0xFFC00910 /* SPORT1 TX Data Register */
202#define SPORT1_RX 0xFFC00918 /* SPORT1 RX Data Register */
203#define SPORT1_RCR1 0xFFC00920 /* SPORT1 Transmit Configuration 1 Register */
204#define SPORT1_RCR2 0xFFC00924 /* SPORT1 Transmit Configuration 2 Register */
205#define SPORT1_RCLKDIV 0xFFC00928 /* SPORT1 Receive Clock Divider */
206#define SPORT1_RFSDIV 0xFFC0092C /* SPORT1 Receive Frame Sync Divider */
207#define SPORT1_STAT 0xFFC00930 /* SPORT1 Status Register */
208#define SPORT1_CHNL 0xFFC00934 /* SPORT1 Current Channel Register */
209#define SPORT1_MCMC1 0xFFC00938 /* SPORT1 Multi-Channel Configuration Register 1 */
210#define SPORT1_MCMC2 0xFFC0093C /* SPORT1 Multi-Channel Configuration Register 2 */
211#define SPORT1_MTCS0 0xFFC00940 /* SPORT1 Multi-Channel Transmit Select Register 0 */
212#define SPORT1_MTCS1 0xFFC00944 /* SPORT1 Multi-Channel Transmit Select Register 1 */
213#define SPORT1_MTCS2 0xFFC00948 /* SPORT1 Multi-Channel Transmit Select Register 2 */
214#define SPORT1_MTCS3 0xFFC0094C /* SPORT1 Multi-Channel Transmit Select Register 3 */
215#define SPORT1_MRCS0 0xFFC00950 /* SPORT1 Multi-Channel Receive Select Register 0 */
216#define SPORT1_MRCS1 0xFFC00954 /* SPORT1 Multi-Channel Receive Select Register 1 */
217#define SPORT1_MRCS2 0xFFC00958 /* SPORT1 Multi-Channel Receive Select Register 2 */
218#define SPORT1_MRCS3 0xFFC0095C /* SPORT1 Multi-Channel Receive Select Register 3 */
219
220
221/* External Bus Interface Unit (0xFFC00A00 - 0xFFC00AFF) */
222/* Asynchronous Memory Controller */
223#define EBIU_AMGCTL 0xFFC00A00 /* Asynchronous Memory Global Control Register */
224#define EBIU_AMBCTL0 0xFFC00A04 /* Asynchronous Memory Bank Control Register 0 */
225#define EBIU_AMBCTL1 0xFFC00A08 /* Asynchronous Memory Bank Control Register 1 */
226
227/* SDRAM Controller */
228#define EBIU_SDGCTL 0xFFC00A10 /* SDRAM Global Control Register */
229#define EBIU_SDBCTL 0xFFC00A14 /* SDRAM Bank Control Register */
230#define EBIU_SDRRC 0xFFC00A18 /* SDRAM Refresh Rate Control Register */
231#define EBIU_SDSTAT 0xFFC00A1C /* SDRAM Status Register */
232
233
234
235/* DMA Controller 0 Traffic Control Registers (0xFFC00B00 - 0xFFC00BFF) */
236
237#define DMAC0_TC_PER 0xFFC00B0C /* DMA Controller 0 Traffic Control Periods Register */
238#define DMAC0_TC_CNT 0xFFC00B10 /* DMA Controller 0 Traffic Control Current Counts Register */
239
240/* Alternate deprecated register names (below) provided for backwards code compatibility */
241#define DMA0_TCPER DMAC0_TC_PER
242#define DMA0_TCCNT DMAC0_TC_CNT
243
244
245/* DMA Controller 0 (0xFFC00C00 - 0xFFC00FFF) */
246
247#define DMA0_NEXT_DESC_PTR 0xFFC00C00 /* DMA Channel 0 Next Descriptor Pointer Register */
248#define DMA0_START_ADDR 0xFFC00C04 /* DMA Channel 0 Start Address Register */
249#define DMA0_CONFIG 0xFFC00C08 /* DMA Channel 0 Configuration Register */
250#define DMA0_X_COUNT 0xFFC00C10 /* DMA Channel 0 X Count Register */
251#define DMA0_X_MODIFY 0xFFC00C14 /* DMA Channel 0 X Modify Register */
252#define DMA0_Y_COUNT 0xFFC00C18 /* DMA Channel 0 Y Count Register */
253#define DMA0_Y_MODIFY 0xFFC00C1C /* DMA Channel 0 Y Modify Register */
254#define DMA0_CURR_DESC_PTR 0xFFC00C20 /* DMA Channel 0 Current Descriptor Pointer Register */
255#define DMA0_CURR_ADDR 0xFFC00C24 /* DMA Channel 0 Current Address Register */
256#define DMA0_IRQ_STATUS 0xFFC00C28 /* DMA Channel 0 Interrupt/Status Register */
257#define DMA0_PERIPHERAL_MAP 0xFFC00C2C /* DMA Channel 0 Peripheral Map Register */
258#define DMA0_CURR_X_COUNT 0xFFC00C30 /* DMA Channel 0 Current X Count Register */
259#define DMA0_CURR_Y_COUNT 0xFFC00C38 /* DMA Channel 0 Current Y Count Register */
260
261#define DMA1_NEXT_DESC_PTR 0xFFC00C40 /* DMA Channel 1 Next Descriptor Pointer Register */
262#define DMA1_START_ADDR 0xFFC00C44 /* DMA Channel 1 Start Address Register */
263#define DMA1_CONFIG 0xFFC00C48 /* DMA Channel 1 Configuration Register */
264#define DMA1_X_COUNT 0xFFC00C50 /* DMA Channel 1 X Count Register */
265#define DMA1_X_MODIFY 0xFFC00C54 /* DMA Channel 1 X Modify Register */
266#define DMA1_Y_COUNT 0xFFC00C58 /* DMA Channel 1 Y Count Register */
267#define DMA1_Y_MODIFY 0xFFC00C5C /* DMA Channel 1 Y Modify Register */
268#define DMA1_CURR_DESC_PTR 0xFFC00C60 /* DMA Channel 1 Current Descriptor Pointer Register */
269#define DMA1_CURR_ADDR 0xFFC00C64 /* DMA Channel 1 Current Address Register */
270#define DMA1_IRQ_STATUS 0xFFC00C68 /* DMA Channel 1 Interrupt/Status Register */
271#define DMA1_PERIPHERAL_MAP 0xFFC00C6C /* DMA Channel 1 Peripheral Map Register */
272#define DMA1_CURR_X_COUNT 0xFFC00C70 /* DMA Channel 1 Current X Count Register */
273#define DMA1_CURR_Y_COUNT 0xFFC00C78 /* DMA Channel 1 Current Y Count Register */
274
275#define DMA2_NEXT_DESC_PTR 0xFFC00C80 /* DMA Channel 2 Next Descriptor Pointer Register */
276#define DMA2_START_ADDR 0xFFC00C84 /* DMA Channel 2 Start Address Register */
277#define DMA2_CONFIG 0xFFC00C88 /* DMA Channel 2 Configuration Register */
278#define DMA2_X_COUNT 0xFFC00C90 /* DMA Channel 2 X Count Register */
279#define DMA2_X_MODIFY 0xFFC00C94 /* DMA Channel 2 X Modify Register */
280#define DMA2_Y_COUNT 0xFFC00C98 /* DMA Channel 2 Y Count Register */
281#define DMA2_Y_MODIFY 0xFFC00C9C /* DMA Channel 2 Y Modify Register */
282#define DMA2_CURR_DESC_PTR 0xFFC00CA0 /* DMA Channel 2 Current Descriptor Pointer Register */
283#define DMA2_CURR_ADDR 0xFFC00CA4 /* DMA Channel 2 Current Address Register */
284#define DMA2_IRQ_STATUS 0xFFC00CA8 /* DMA Channel 2 Interrupt/Status Register */
285#define DMA2_PERIPHERAL_MAP 0xFFC00CAC /* DMA Channel 2 Peripheral Map Register */
286#define DMA2_CURR_X_COUNT 0xFFC00CB0 /* DMA Channel 2 Current X Count Register */
287#define DMA2_CURR_Y_COUNT 0xFFC00CB8 /* DMA Channel 2 Current Y Count Register */
288
289#define DMA3_NEXT_DESC_PTR 0xFFC00CC0 /* DMA Channel 3 Next Descriptor Pointer Register */
290#define DMA3_START_ADDR 0xFFC00CC4 /* DMA Channel 3 Start Address Register */
291#define DMA3_CONFIG 0xFFC00CC8 /* DMA Channel 3 Configuration Register */
292#define DMA3_X_COUNT 0xFFC00CD0 /* DMA Channel 3 X Count Register */
293#define DMA3_X_MODIFY 0xFFC00CD4 /* DMA Channel 3 X Modify Register */
294#define DMA3_Y_COUNT 0xFFC00CD8 /* DMA Channel 3 Y Count Register */
295#define DMA3_Y_MODIFY 0xFFC00CDC /* DMA Channel 3 Y Modify Register */
296#define DMA3_CURR_DESC_PTR 0xFFC00CE0 /* DMA Channel 3 Current Descriptor Pointer Register */
297#define DMA3_CURR_ADDR 0xFFC00CE4 /* DMA Channel 3 Current Address Register */
298#define DMA3_IRQ_STATUS 0xFFC00CE8 /* DMA Channel 3 Interrupt/Status Register */
299#define DMA3_PERIPHERAL_MAP 0xFFC00CEC /* DMA Channel 3 Peripheral Map Register */
300#define DMA3_CURR_X_COUNT 0xFFC00CF0 /* DMA Channel 3 Current X Count Register */
301#define DMA3_CURR_Y_COUNT 0xFFC00CF8 /* DMA Channel 3 Current Y Count Register */
302
303#define DMA4_NEXT_DESC_PTR 0xFFC00D00 /* DMA Channel 4 Next Descriptor Pointer Register */
304#define DMA4_START_ADDR 0xFFC00D04 /* DMA Channel 4 Start Address Register */
305#define DMA4_CONFIG 0xFFC00D08 /* DMA Channel 4 Configuration Register */
306#define DMA4_X_COUNT 0xFFC00D10 /* DMA Channel 4 X Count Register */
307#define DMA4_X_MODIFY 0xFFC00D14 /* DMA Channel 4 X Modify Register */
308#define DMA4_Y_COUNT 0xFFC00D18 /* DMA Channel 4 Y Count Register */
309#define DMA4_Y_MODIFY 0xFFC00D1C /* DMA Channel 4 Y Modify Register */
310#define DMA4_CURR_DESC_PTR 0xFFC00D20 /* DMA Channel 4 Current Descriptor Pointer Register */
311#define DMA4_CURR_ADDR 0xFFC00D24 /* DMA Channel 4 Current Address Register */
312#define DMA4_IRQ_STATUS 0xFFC00D28 /* DMA Channel 4 Interrupt/Status Register */
313#define DMA4_PERIPHERAL_MAP 0xFFC00D2C /* DMA Channel 4 Peripheral Map Register */
314#define DMA4_CURR_X_COUNT 0xFFC00D30 /* DMA Channel 4 Current X Count Register */
315#define DMA4_CURR_Y_COUNT 0xFFC00D38 /* DMA Channel 4 Current Y Count Register */
316
317#define DMA5_NEXT_DESC_PTR 0xFFC00D40 /* DMA Channel 5 Next Descriptor Pointer Register */
318#define DMA5_START_ADDR 0xFFC00D44 /* DMA Channel 5 Start Address Register */
319#define DMA5_CONFIG 0xFFC00D48 /* DMA Channel 5 Configuration Register */
320#define DMA5_X_COUNT 0xFFC00D50 /* DMA Channel 5 X Count Register */
321#define DMA5_X_MODIFY 0xFFC00D54 /* DMA Channel 5 X Modify Register */
322#define DMA5_Y_COUNT 0xFFC00D58 /* DMA Channel 5 Y Count Register */
323#define DMA5_Y_MODIFY 0xFFC00D5C /* DMA Channel 5 Y Modify Register */
324#define DMA5_CURR_DESC_PTR 0xFFC00D60 /* DMA Channel 5 Current Descriptor Pointer Register */
325#define DMA5_CURR_ADDR 0xFFC00D64 /* DMA Channel 5 Current Address Register */
326#define DMA5_IRQ_STATUS 0xFFC00D68 /* DMA Channel 5 Interrupt/Status Register */
327#define DMA5_PERIPHERAL_MAP 0xFFC00D6C /* DMA Channel 5 Peripheral Map Register */
328#define DMA5_CURR_X_COUNT 0xFFC00D70 /* DMA Channel 5 Current X Count Register */
329#define DMA5_CURR_Y_COUNT 0xFFC00D78 /* DMA Channel 5 Current Y Count Register */
330
331#define DMA6_NEXT_DESC_PTR 0xFFC00D80 /* DMA Channel 6 Next Descriptor Pointer Register */
332#define DMA6_START_ADDR 0xFFC00D84 /* DMA Channel 6 Start Address Register */
333#define DMA6_CONFIG 0xFFC00D88 /* DMA Channel 6 Configuration Register */
334#define DMA6_X_COUNT 0xFFC00D90 /* DMA Channel 6 X Count Register */
335#define DMA6_X_MODIFY 0xFFC00D94 /* DMA Channel 6 X Modify Register */
336#define DMA6_Y_COUNT 0xFFC00D98 /* DMA Channel 6 Y Count Register */
337#define DMA6_Y_MODIFY 0xFFC00D9C /* DMA Channel 6 Y Modify Register */
338#define DMA6_CURR_DESC_PTR 0xFFC00DA0 /* DMA Channel 6 Current Descriptor Pointer Register */
339#define DMA6_CURR_ADDR 0xFFC00DA4 /* DMA Channel 6 Current Address Register */
340#define DMA6_IRQ_STATUS 0xFFC00DA8 /* DMA Channel 6 Interrupt/Status Register */
341#define DMA6_PERIPHERAL_MAP 0xFFC00DAC /* DMA Channel 6 Peripheral Map Register */
342#define DMA6_CURR_X_COUNT 0xFFC00DB0 /* DMA Channel 6 Current X Count Register */
343#define DMA6_CURR_Y_COUNT 0xFFC00DB8 /* DMA Channel 6 Current Y Count Register */
344
345#define DMA7_NEXT_DESC_PTR 0xFFC00DC0 /* DMA Channel 7 Next Descriptor Pointer Register */
346#define DMA7_START_ADDR 0xFFC00DC4 /* DMA Channel 7 Start Address Register */
347#define DMA7_CONFIG 0xFFC00DC8 /* DMA Channel 7 Configuration Register */
348#define DMA7_X_COUNT 0xFFC00DD0 /* DMA Channel 7 X Count Register */
349#define DMA7_X_MODIFY 0xFFC00DD4 /* DMA Channel 7 X Modify Register */
350#define DMA7_Y_COUNT 0xFFC00DD8 /* DMA Channel 7 Y Count Register */
351#define DMA7_Y_MODIFY 0xFFC00DDC /* DMA Channel 7 Y Modify Register */
352#define DMA7_CURR_DESC_PTR 0xFFC00DE0 /* DMA Channel 7 Current Descriptor Pointer Register */
353#define DMA7_CURR_ADDR 0xFFC00DE4 /* DMA Channel 7 Current Address Register */
354#define DMA7_IRQ_STATUS 0xFFC00DE8 /* DMA Channel 7 Interrupt/Status Register */
355#define DMA7_PERIPHERAL_MAP 0xFFC00DEC /* DMA Channel 7 Peripheral Map Register */
356#define DMA7_CURR_X_COUNT 0xFFC00DF0 /* DMA Channel 7 Current X Count Register */
357#define DMA7_CURR_Y_COUNT 0xFFC00DF8 /* DMA Channel 7 Current Y Count Register */
358
359#define MDMA0_D0_NEXT_DESC_PTR 0xFFC00E00 /* MemDMA0 Stream 0 Destination Next Descriptor Pointer Register */
360#define MDMA0_D0_START_ADDR 0xFFC00E04 /* MemDMA0 Stream 0 Destination Start Address Register */
361#define MDMA0_D0_CONFIG 0xFFC00E08 /* MemDMA0 Stream 0 Destination Configuration Register */
362#define MDMA0_D0_X_COUNT 0xFFC00E10 /* MemDMA0 Stream 0 Destination X Count Register */
363#define MDMA0_D0_X_MODIFY 0xFFC00E14 /* MemDMA0 Stream 0 Destination X Modify Register */
364#define MDMA0_D0_Y_COUNT 0xFFC00E18 /* MemDMA0 Stream 0 Destination Y Count Register */
365#define MDMA0_D0_Y_MODIFY 0xFFC00E1C /* MemDMA0 Stream 0 Destination Y Modify Register */
366#define MDMA0_D0_CURR_DESC_PTR 0xFFC00E20 /* MemDMA0 Stream 0 Destination Current Descriptor Pointer Register */
367#define MDMA0_D0_CURR_ADDR 0xFFC00E24 /* MemDMA0 Stream 0 Destination Current Address Register */
368#define MDMA0_D0_IRQ_STATUS 0xFFC00E28 /* MemDMA0 Stream 0 Destination Interrupt/Status Register */
369#define MDMA0_D0_PERIPHERAL_MAP 0xFFC00E2C /* MemDMA0 Stream 0 Destination Peripheral Map Register */
370#define MDMA0_D0_CURR_X_COUNT 0xFFC00E30 /* MemDMA0 Stream 0 Destination Current X Count Register */
371#define MDMA0_D0_CURR_Y_COUNT 0xFFC00E38 /* MemDMA0 Stream 0 Destination Current Y Count Register */
372
373#define MDMA0_S0_NEXT_DESC_PTR 0xFFC00E40 /* MemDMA0 Stream 0 Source Next Descriptor Pointer Register */
374#define MDMA0_S0_START_ADDR 0xFFC00E44 /* MemDMA0 Stream 0 Source Start Address Register */
375#define MDMA0_S0_CONFIG 0xFFC00E48 /* MemDMA0 Stream 0 Source Configuration Register */
376#define MDMA0_S0_X_COUNT 0xFFC00E50 /* MemDMA0 Stream 0 Source X Count Register */
377#define MDMA0_S0_X_MODIFY 0xFFC00E54 /* MemDMA0 Stream 0 Source X Modify Register */
378#define MDMA0_S0_Y_COUNT 0xFFC00E58 /* MemDMA0 Stream 0 Source Y Count Register */
379#define MDMA0_S0_Y_MODIFY 0xFFC00E5C /* MemDMA0 Stream 0 Source Y Modify Register */
380#define MDMA0_S0_CURR_DESC_PTR 0xFFC00E60 /* MemDMA0 Stream 0 Source Current Descriptor Pointer Register */
381#define MDMA0_S0_CURR_ADDR 0xFFC00E64 /* MemDMA0 Stream 0 Source Current Address Register */
382#define MDMA0_S0_IRQ_STATUS 0xFFC00E68 /* MemDMA0 Stream 0 Source Interrupt/Status Register */
383#define MDMA0_S0_PERIPHERAL_MAP 0xFFC00E6C /* MemDMA0 Stream 0 Source Peripheral Map Register */
384#define MDMA0_S0_CURR_X_COUNT 0xFFC00E70 /* MemDMA0 Stream 0 Source Current X Count Register */
385#define MDMA0_S0_CURR_Y_COUNT 0xFFC00E78 /* MemDMA0 Stream 0 Source Current Y Count Register */
386
387#define MDMA0_D1_NEXT_DESC_PTR 0xFFC00E80 /* MemDMA0 Stream 1 Destination Next Descriptor Pointer Register */
388#define MDMA0_D1_START_ADDR 0xFFC00E84 /* MemDMA0 Stream 1 Destination Start Address Register */
389#define MDMA0_D1_CONFIG 0xFFC00E88 /* MemDMA0 Stream 1 Destination Configuration Register */
390#define MDMA0_D1_X_COUNT 0xFFC00E90 /* MemDMA0 Stream 1 Destination X Count Register */
391#define MDMA0_D1_X_MODIFY 0xFFC00E94 /* MemDMA0 Stream 1 Destination X Modify Register */
392#define MDMA0_D1_Y_COUNT 0xFFC00E98 /* MemDMA0 Stream 1 Destination Y Count Register */
393#define MDMA0_D1_Y_MODIFY 0xFFC00E9C /* MemDMA0 Stream 1 Destination Y Modify Register */
394#define MDMA0_D1_CURR_DESC_PTR 0xFFC00EA0 /* MemDMA0 Stream 1 Destination Current Descriptor Pointer Register */
395#define MDMA0_D1_CURR_ADDR 0xFFC00EA4 /* MemDMA0 Stream 1 Destination Current Address Register */
396#define MDMA0_D1_IRQ_STATUS 0xFFC00EA8 /* MemDMA0 Stream 1 Destination Interrupt/Status Register */
397#define MDMA0_D1_PERIPHERAL_MAP 0xFFC00EAC /* MemDMA0 Stream 1 Destination Peripheral Map Register */
398#define MDMA0_D1_CURR_X_COUNT 0xFFC00EB0 /* MemDMA0 Stream 1 Destination Current X Count Register */
399#define MDMA0_D1_CURR_Y_COUNT 0xFFC00EB8 /* MemDMA0 Stream 1 Destination Current Y Count Register */
400
401#define MDMA0_S1_NEXT_DESC_PTR 0xFFC00EC0 /* MemDMA0 Stream 1 Source Next Descriptor Pointer Register */
402#define MDMA0_S1_START_ADDR 0xFFC00EC4 /* MemDMA0 Stream 1 Source Start Address Register */
403#define MDMA0_S1_CONFIG 0xFFC00EC8 /* MemDMA0 Stream 1 Source Configuration Register */
404#define MDMA0_S1_X_COUNT 0xFFC00ED0 /* MemDMA0 Stream 1 Source X Count Register */
405#define MDMA0_S1_X_MODIFY 0xFFC00ED4 /* MemDMA0 Stream 1 Source X Modify Register */
406#define MDMA0_S1_Y_COUNT 0xFFC00ED8 /* MemDMA0 Stream 1 Source Y Count Register */
407#define MDMA0_S1_Y_MODIFY 0xFFC00EDC /* MemDMA0 Stream 1 Source Y Modify Register */
408#define MDMA0_S1_CURR_DESC_PTR 0xFFC00EE0 /* MemDMA0 Stream 1 Source Current Descriptor Pointer Register */
409#define MDMA0_S1_CURR_ADDR 0xFFC00EE4 /* MemDMA0 Stream 1 Source Current Address Register */
410#define MDMA0_S1_IRQ_STATUS 0xFFC00EE8 /* MemDMA0 Stream 1 Source Interrupt/Status Register */
411#define MDMA0_S1_PERIPHERAL_MAP 0xFFC00EEC /* MemDMA0 Stream 1 Source Peripheral Map Register */
412#define MDMA0_S1_CURR_X_COUNT 0xFFC00EF0 /* MemDMA0 Stream 1 Source Current X Count Register */
413#define MDMA0_S1_CURR_Y_COUNT 0xFFC00EF8 /* MemDMA0 Stream 1 Source Current Y Count Register */
414
415
416/* Parallel Peripheral Interface (PPI) (0xFFC01000 - 0xFFC010FF) */
417#define PPI_CONTROL 0xFFC01000 /* PPI Control Register */
418#define PPI_STATUS 0xFFC01004 /* PPI Status Register */
419#define PPI_COUNT 0xFFC01008 /* PPI Transfer Count Register */
420#define PPI_DELAY 0xFFC0100C /* PPI Delay Count Register */
421#define PPI_FRAME 0xFFC01010 /* PPI Frame Length Register */
422
423
424/* Two-Wire Interface 0 (0xFFC01400 - 0xFFC014FF) */
425#define TWI0_CLKDIV 0xFFC01400 /* Serial Clock Divider Register */
426#define TWI0_CONTROL 0xFFC01404 /* TWI0 Master Internal Time Reference Register */
427#define TWI0_SLAVE_CTRL 0xFFC01408 /* Slave Mode Control Register */
428#define TWI0_SLAVE_STAT 0xFFC0140C /* Slave Mode Status Register */
429#define TWI0_SLAVE_ADDR 0xFFC01410 /* Slave Mode Address Register */
430#define TWI0_MASTER_CTRL 0xFFC01414 /* Master Mode Control Register */
431#define TWI0_MASTER_STAT 0xFFC01418 /* Master Mode Status Register */
432#define TWI0_MASTER_ADDR 0xFFC0141C /* Master Mode Address Register */
433#define TWI0_INT_STAT 0xFFC01420 /* TWI0 Master Interrupt Register */
434#define TWI0_INT_MASK 0xFFC01424 /* TWI0 Master Interrupt Mask Register */
435#define TWI0_FIFO_CTRL 0xFFC01428 /* FIFO Control Register */
436#define TWI0_FIFO_STAT 0xFFC0142C /* FIFO Status Register */
437#define TWI0_XMT_DATA8 0xFFC01480 /* FIFO Transmit Data Single Byte Register */
438#define TWI0_XMT_DATA16 0xFFC01484 /* FIFO Transmit Data Double Byte Register */
439#define TWI0_RCV_DATA8 0xFFC01488 /* FIFO Receive Data Single Byte Register */
440#define TWI0_RCV_DATA16 0xFFC0148C /* FIFO Receive Data Double Byte Register */
441
442#define TWI0_REGBASE TWI0_CLKDIV
443
444/* the following are for backwards compatibility */
445#define TWI0_PRESCALE TWI0_CONTROL
446#define TWI0_INT_SRC TWI0_INT_STAT
447#define TWI0_INT_ENABLE TWI0_INT_MASK
448
449
450/* General-Purpose Ports (0xFFC01500 - 0xFFC015FF) */
451
452/* GPIO Port C Register Names */
453#define GPIO_C_CNFG 0xFFC01500 /* GPIO Pin Port C Configuration Register */
454#define GPIO_C_D 0xFFC01510 /* GPIO Pin Port C Data Register */
455#define GPIO_C_C 0xFFC01520 /* Clear GPIO Pin Port C Register */
456#define GPIO_C_S 0xFFC01530 /* Set GPIO Pin Port C Register */
457#define GPIO_C_T 0xFFC01540 /* Toggle GPIO Pin Port C Register */
458#define GPIO_C_DIR 0xFFC01550 /* GPIO Pin Port C Direction Register */
459#define GPIO_C_INEN 0xFFC01560 /* GPIO Pin Port C Input Enable Register */
460
461/* GPIO Port D Register Names */
462#define GPIO_D_CNFG 0xFFC01504 /* GPIO Pin Port D Configuration Register */
463#define GPIO_D_D 0xFFC01514 /* GPIO Pin Port D Data Register */
464#define GPIO_D_C 0xFFC01524 /* Clear GPIO Pin Port D Register */
465#define GPIO_D_S 0xFFC01534 /* Set GPIO Pin Port D Register */
466#define GPIO_D_T 0xFFC01544 /* Toggle GPIO Pin Port D Register */
467#define GPIO_D_DIR 0xFFC01554 /* GPIO Pin Port D Direction Register */
468#define GPIO_D_INEN 0xFFC01564 /* GPIO Pin Port D Input Enable Register */
469
470/* GPIO Port E Register Names */
471#define GPIO_E_CNFG 0xFFC01508 /* GPIO Pin Port E Configuration Register */
472#define GPIO_E_D 0xFFC01518 /* GPIO Pin Port E Data Register */
473#define GPIO_E_C 0xFFC01528 /* Clear GPIO Pin Port E Register */
474#define GPIO_E_S 0xFFC01538 /* Set GPIO Pin Port E Register */
475#define GPIO_E_T 0xFFC01548 /* Toggle GPIO Pin Port E Register */
476#define GPIO_E_DIR 0xFFC01558 /* GPIO Pin Port E Direction Register */
477#define GPIO_E_INEN 0xFFC01568 /* GPIO Pin Port E Input Enable Register */
478
479/* DMA Controller 1 Traffic Control Registers (0xFFC01B00 - 0xFFC01BFF) */
480
481#define DMAC1_TC_PER 0xFFC01B0C /* DMA Controller 1 Traffic Control Periods Register */
482#define DMAC1_TC_CNT 0xFFC01B10 /* DMA Controller 1 Traffic Control Current Counts Register */
483
484/* Alternate deprecated register names (below) provided for backwards code compatibility */
485#define DMA1_TCPER DMAC1_TC_PER
486#define DMA1_TCCNT DMAC1_TC_CNT
487
488
489/* DMA Controller 1 (0xFFC01C00 - 0xFFC01FFF) */
490#define DMA8_NEXT_DESC_PTR 0xFFC01C00 /* DMA Channel 8 Next Descriptor Pointer Register */
491#define DMA8_START_ADDR 0xFFC01C04 /* DMA Channel 8 Start Address Register */
492#define DMA8_CONFIG 0xFFC01C08 /* DMA Channel 8 Configuration Register */
493#define DMA8_X_COUNT 0xFFC01C10 /* DMA Channel 8 X Count Register */
494#define DMA8_X_MODIFY 0xFFC01C14 /* DMA Channel 8 X Modify Register */
495#define DMA8_Y_COUNT 0xFFC01C18 /* DMA Channel 8 Y Count Register */
496#define DMA8_Y_MODIFY 0xFFC01C1C /* DMA Channel 8 Y Modify Register */
497#define DMA8_CURR_DESC_PTR 0xFFC01C20 /* DMA Channel 8 Current Descriptor Pointer Register */
498#define DMA8_CURR_ADDR 0xFFC01C24 /* DMA Channel 8 Current Address Register */
499#define DMA8_IRQ_STATUS 0xFFC01C28 /* DMA Channel 8 Interrupt/Status Register */
500#define DMA8_PERIPHERAL_MAP 0xFFC01C2C /* DMA Channel 8 Peripheral Map Register */
501#define DMA8_CURR_X_COUNT 0xFFC01C30 /* DMA Channel 8 Current X Count Register */
502#define DMA8_CURR_Y_COUNT 0xFFC01C38 /* DMA Channel 8 Current Y Count Register */
503
504#define DMA9_NEXT_DESC_PTR 0xFFC01C40 /* DMA Channel 9 Next Descriptor Pointer Register */
505#define DMA9_START_ADDR 0xFFC01C44 /* DMA Channel 9 Start Address Register */
506#define DMA9_CONFIG 0xFFC01C48 /* DMA Channel 9 Configuration Register */
507#define DMA9_X_COUNT 0xFFC01C50 /* DMA Channel 9 X Count Register */
508#define DMA9_X_MODIFY 0xFFC01C54 /* DMA Channel 9 X Modify Register */
509#define DMA9_Y_COUNT 0xFFC01C58 /* DMA Channel 9 Y Count Register */
510#define DMA9_Y_MODIFY 0xFFC01C5C /* DMA Channel 9 Y Modify Register */
511#define DMA9_CURR_DESC_PTR 0xFFC01C60 /* DMA Channel 9 Current Descriptor Pointer Register */
512#define DMA9_CURR_ADDR 0xFFC01C64 /* DMA Channel 9 Current Address Register */
513#define DMA9_IRQ_STATUS 0xFFC01C68 /* DMA Channel 9 Interrupt/Status Register */
514#define DMA9_PERIPHERAL_MAP 0xFFC01C6C /* DMA Channel 9 Peripheral Map Register */
515#define DMA9_CURR_X_COUNT 0xFFC01C70 /* DMA Channel 9 Current X Count Register */
516#define DMA9_CURR_Y_COUNT 0xFFC01C78 /* DMA Channel 9 Current Y Count Register */
517
518#define DMA10_NEXT_DESC_PTR 0xFFC01C80 /* DMA Channel 10 Next Descriptor Pointer Register */
519#define DMA10_START_ADDR 0xFFC01C84 /* DMA Channel 10 Start Address Register */
520#define DMA10_CONFIG 0xFFC01C88 /* DMA Channel 10 Configuration Register */
521#define DMA10_X_COUNT 0xFFC01C90 /* DMA Channel 10 X Count Register */
522#define DMA10_X_MODIFY 0xFFC01C94 /* DMA Channel 10 X Modify Register */
523#define DMA10_Y_COUNT 0xFFC01C98 /* DMA Channel 10 Y Count Register */
524#define DMA10_Y_MODIFY 0xFFC01C9C /* DMA Channel 10 Y Modify Register */
525#define DMA10_CURR_DESC_PTR 0xFFC01CA0 /* DMA Channel 10 Current Descriptor Pointer Register */
526#define DMA10_CURR_ADDR 0xFFC01CA4 /* DMA Channel 10 Current Address Register */
527#define DMA10_IRQ_STATUS 0xFFC01CA8 /* DMA Channel 10 Interrupt/Status Register */
528#define DMA10_PERIPHERAL_MAP 0xFFC01CAC /* DMA Channel 10 Peripheral Map Register */
529#define DMA10_CURR_X_COUNT 0xFFC01CB0 /* DMA Channel 10 Current X Count Register */
530#define DMA10_CURR_Y_COUNT 0xFFC01CB8 /* DMA Channel 10 Current Y Count Register */
531
532#define DMA11_NEXT_DESC_PTR 0xFFC01CC0 /* DMA Channel 11 Next Descriptor Pointer Register */
533#define DMA11_START_ADDR 0xFFC01CC4 /* DMA Channel 11 Start Address Register */
534#define DMA11_CONFIG 0xFFC01CC8 /* DMA Channel 11 Configuration Register */
535#define DMA11_X_COUNT 0xFFC01CD0 /* DMA Channel 11 X Count Register */
536#define DMA11_X_MODIFY 0xFFC01CD4 /* DMA Channel 11 X Modify Register */
537#define DMA11_Y_COUNT 0xFFC01CD8 /* DMA Channel 11 Y Count Register */
538#define DMA11_Y_MODIFY 0xFFC01CDC /* DMA Channel 11 Y Modify Register */
539#define DMA11_CURR_DESC_PTR 0xFFC01CE0 /* DMA Channel 11 Current Descriptor Pointer Register */
540#define DMA11_CURR_ADDR 0xFFC01CE4 /* DMA Channel 11 Current Address Register */
541#define DMA11_IRQ_STATUS 0xFFC01CE8 /* DMA Channel 11 Interrupt/Status Register */
542#define DMA11_PERIPHERAL_MAP 0xFFC01CEC /* DMA Channel 11 Peripheral Map Register */
543#define DMA11_CURR_X_COUNT 0xFFC01CF0 /* DMA Channel 11 Current X Count Register */
544#define DMA11_CURR_Y_COUNT 0xFFC01CF8 /* DMA Channel 11 Current Y Count Register */
545
546#define DMA12_NEXT_DESC_PTR 0xFFC01D00 /* DMA Channel 12 Next Descriptor Pointer Register */
547#define DMA12_START_ADDR 0xFFC01D04 /* DMA Channel 12 Start Address Register */
548#define DMA12_CONFIG 0xFFC01D08 /* DMA Channel 12 Configuration Register */
549#define DMA12_X_COUNT 0xFFC01D10 /* DMA Channel 12 X Count Register */
550#define DMA12_X_MODIFY 0xFFC01D14 /* DMA Channel 12 X Modify Register */
551#define DMA12_Y_COUNT 0xFFC01D18 /* DMA Channel 12 Y Count Register */
552#define DMA12_Y_MODIFY 0xFFC01D1C /* DMA Channel 12 Y Modify Register */
553#define DMA12_CURR_DESC_PTR 0xFFC01D20 /* DMA Channel 12 Current Descriptor Pointer Register */
554#define DMA12_CURR_ADDR 0xFFC01D24 /* DMA Channel 12 Current Address Register */
555#define DMA12_IRQ_STATUS 0xFFC01D28 /* DMA Channel 12 Interrupt/Status Register */
556#define DMA12_PERIPHERAL_MAP 0xFFC01D2C /* DMA Channel 12 Peripheral Map Register */
557#define DMA12_CURR_X_COUNT 0xFFC01D30 /* DMA Channel 12 Current X Count Register */
558#define DMA12_CURR_Y_COUNT 0xFFC01D38 /* DMA Channel 12 Current Y Count Register */
559
560#define DMA13_NEXT_DESC_PTR 0xFFC01D40 /* DMA Channel 13 Next Descriptor Pointer Register */
561#define DMA13_START_ADDR 0xFFC01D44 /* DMA Channel 13 Start Address Register */
562#define DMA13_CONFIG 0xFFC01D48 /* DMA Channel 13 Configuration Register */
563#define DMA13_X_COUNT 0xFFC01D50 /* DMA Channel 13 X Count Register */
564#define DMA13_X_MODIFY 0xFFC01D54 /* DMA Channel 13 X Modify Register */
565#define DMA13_Y_COUNT 0xFFC01D58 /* DMA Channel 13 Y Count Register */
566#define DMA13_Y_MODIFY 0xFFC01D5C /* DMA Channel 13 Y Modify Register */
567#define DMA13_CURR_DESC_PTR 0xFFC01D60 /* DMA Channel 13 Current Descriptor Pointer Register */
568#define DMA13_CURR_ADDR 0xFFC01D64 /* DMA Channel 13 Current Address Register */
569#define DMA13_IRQ_STATUS 0xFFC01D68 /* DMA Channel 13 Interrupt/Status Register */
570#define DMA13_PERIPHERAL_MAP 0xFFC01D6C /* DMA Channel 13 Peripheral Map Register */
571#define DMA13_CURR_X_COUNT 0xFFC01D70 /* DMA Channel 13 Current X Count Register */
572#define DMA13_CURR_Y_COUNT 0xFFC01D78 /* DMA Channel 13 Current Y Count Register */
573
574#define DMA14_NEXT_DESC_PTR 0xFFC01D80 /* DMA Channel 14 Next Descriptor Pointer Register */
575#define DMA14_START_ADDR 0xFFC01D84 /* DMA Channel 14 Start Address Register */
576#define DMA14_CONFIG 0xFFC01D88 /* DMA Channel 14 Configuration Register */
577#define DMA14_X_COUNT 0xFFC01D90 /* DMA Channel 14 X Count Register */
578#define DMA14_X_MODIFY 0xFFC01D94 /* DMA Channel 14 X Modify Register */
579#define DMA14_Y_COUNT 0xFFC01D98 /* DMA Channel 14 Y Count Register */
580#define DMA14_Y_MODIFY 0xFFC01D9C /* DMA Channel 14 Y Modify Register */
581#define DMA14_CURR_DESC_PTR 0xFFC01DA0 /* DMA Channel 14 Current Descriptor Pointer Register */
582#define DMA14_CURR_ADDR 0xFFC01DA4 /* DMA Channel 14 Current Address Register */
583#define DMA14_IRQ_STATUS 0xFFC01DA8 /* DMA Channel 14 Interrupt/Status Register */
584#define DMA14_PERIPHERAL_MAP 0xFFC01DAC /* DMA Channel 14 Peripheral Map Register */
585#define DMA14_CURR_X_COUNT 0xFFC01DB0 /* DMA Channel 14 Current X Count Register */
586#define DMA14_CURR_Y_COUNT 0xFFC01DB8 /* DMA Channel 14 Current Y Count Register */
587
588#define DMA15_NEXT_DESC_PTR 0xFFC01DC0 /* DMA Channel 15 Next Descriptor Pointer Register */
589#define DMA15_START_ADDR 0xFFC01DC4 /* DMA Channel 15 Start Address Register */
590#define DMA15_CONFIG 0xFFC01DC8 /* DMA Channel 15 Configuration Register */
591#define DMA15_X_COUNT 0xFFC01DD0 /* DMA Channel 15 X Count Register */
592#define DMA15_X_MODIFY 0xFFC01DD4 /* DMA Channel 15 X Modify Register */
593#define DMA15_Y_COUNT 0xFFC01DD8 /* DMA Channel 15 Y Count Register */
594#define DMA15_Y_MODIFY 0xFFC01DDC /* DMA Channel 15 Y Modify Register */
595#define DMA15_CURR_DESC_PTR 0xFFC01DE0 /* DMA Channel 15 Current Descriptor Pointer Register */
596#define DMA15_CURR_ADDR 0xFFC01DE4 /* DMA Channel 15 Current Address Register */
597#define DMA15_IRQ_STATUS 0xFFC01DE8 /* DMA Channel 15 Interrupt/Status Register */
598#define DMA15_PERIPHERAL_MAP 0xFFC01DEC /* DMA Channel 15 Peripheral Map Register */
599#define DMA15_CURR_X_COUNT 0xFFC01DF0 /* DMA Channel 15 Current X Count Register */
600#define DMA15_CURR_Y_COUNT 0xFFC01DF8 /* DMA Channel 15 Current Y Count Register */
601
602#define DMA16_NEXT_DESC_PTR 0xFFC01E00 /* DMA Channel 16 Next Descriptor Pointer Register */
603#define DMA16_START_ADDR 0xFFC01E04 /* DMA Channel 16 Start Address Register */
604#define DMA16_CONFIG 0xFFC01E08 /* DMA Channel 16 Configuration Register */
605#define DMA16_X_COUNT 0xFFC01E10 /* DMA Channel 16 X Count Register */
606#define DMA16_X_MODIFY 0xFFC01E14 /* DMA Channel 16 X Modify Register */
607#define DMA16_Y_COUNT 0xFFC01E18 /* DMA Channel 16 Y Count Register */
608#define DMA16_Y_MODIFY 0xFFC01E1C /* DMA Channel 16 Y Modify Register */
609#define DMA16_CURR_DESC_PTR 0xFFC01E20 /* DMA Channel 16 Current Descriptor Pointer Register */
610#define DMA16_CURR_ADDR 0xFFC01E24 /* DMA Channel 16 Current Address Register */
611#define DMA16_IRQ_STATUS 0xFFC01E28 /* DMA Channel 16 Interrupt/Status Register */
612#define DMA16_PERIPHERAL_MAP 0xFFC01E2C /* DMA Channel 16 Peripheral Map Register */
613#define DMA16_CURR_X_COUNT 0xFFC01E30 /* DMA Channel 16 Current X Count Register */
614#define DMA16_CURR_Y_COUNT 0xFFC01E38 /* DMA Channel 16 Current Y Count Register */
615
616#define DMA17_NEXT_DESC_PTR 0xFFC01E40 /* DMA Channel 17 Next Descriptor Pointer Register */
617#define DMA17_START_ADDR 0xFFC01E44 /* DMA Channel 17 Start Address Register */
618#define DMA17_CONFIG 0xFFC01E48 /* DMA Channel 17 Configuration Register */
619#define DMA17_X_COUNT 0xFFC01E50 /* DMA Channel 17 X Count Register */
620#define DMA17_X_MODIFY 0xFFC01E54 /* DMA Channel 17 X Modify Register */
621#define DMA17_Y_COUNT 0xFFC01E58 /* DMA Channel 17 Y Count Register */
622#define DMA17_Y_MODIFY 0xFFC01E5C /* DMA Channel 17 Y Modify Register */
623#define DMA17_CURR_DESC_PTR 0xFFC01E60 /* DMA Channel 17 Current Descriptor Pointer Register */
624#define DMA17_CURR_ADDR 0xFFC01E64 /* DMA Channel 17 Current Address Register */
625#define DMA17_IRQ_STATUS 0xFFC01E68 /* DMA Channel 17 Interrupt/Status Register */
626#define DMA17_PERIPHERAL_MAP 0xFFC01E6C /* DMA Channel 17 Peripheral Map Register */
627#define DMA17_CURR_X_COUNT 0xFFC01E70 /* DMA Channel 17 Current X Count Register */
628#define DMA17_CURR_Y_COUNT 0xFFC01E78 /* DMA Channel 17 Current Y Count Register */
629
630#define DMA18_NEXT_DESC_PTR 0xFFC01E80 /* DMA Channel 18 Next Descriptor Pointer Register */
631#define DMA18_START_ADDR 0xFFC01E84 /* DMA Channel 18 Start Address Register */
632#define DMA18_CONFIG 0xFFC01E88 /* DMA Channel 18 Configuration Register */
633#define DMA18_X_COUNT 0xFFC01E90 /* DMA Channel 18 X Count Register */
634#define DMA18_X_MODIFY 0xFFC01E94 /* DMA Channel 18 X Modify Register */
635#define DMA18_Y_COUNT 0xFFC01E98 /* DMA Channel 18 Y Count Register */
636#define DMA18_Y_MODIFY 0xFFC01E9C /* DMA Channel 18 Y Modify Register */
637#define DMA18_CURR_DESC_PTR 0xFFC01EA0 /* DMA Channel 18 Current Descriptor Pointer Register */
638#define DMA18_CURR_ADDR 0xFFC01EA4 /* DMA Channel 18 Current Address Register */
639#define DMA18_IRQ_STATUS 0xFFC01EA8 /* DMA Channel 18 Interrupt/Status Register */
640#define DMA18_PERIPHERAL_MAP 0xFFC01EAC /* DMA Channel 18 Peripheral Map Register */
641#define DMA18_CURR_X_COUNT 0xFFC01EB0 /* DMA Channel 18 Current X Count Register */
642#define DMA18_CURR_Y_COUNT 0xFFC01EB8 /* DMA Channel 18 Current Y Count Register */
643
644#define DMA19_NEXT_DESC_PTR 0xFFC01EC0 /* DMA Channel 19 Next Descriptor Pointer Register */
645#define DMA19_START_ADDR 0xFFC01EC4 /* DMA Channel 19 Start Address Register */
646#define DMA19_CONFIG 0xFFC01EC8 /* DMA Channel 19 Configuration Register */
647#define DMA19_X_COUNT 0xFFC01ED0 /* DMA Channel 19 X Count Register */
648#define DMA19_X_MODIFY 0xFFC01ED4 /* DMA Channel 19 X Modify Register */
649#define DMA19_Y_COUNT 0xFFC01ED8 /* DMA Channel 19 Y Count Register */
650#define DMA19_Y_MODIFY 0xFFC01EDC /* DMA Channel 19 Y Modify Register */
651#define DMA19_CURR_DESC_PTR 0xFFC01EE0 /* DMA Channel 19 Current Descriptor Pointer Register */
652#define DMA19_CURR_ADDR 0xFFC01EE4 /* DMA Channel 19 Current Address Register */
653#define DMA19_IRQ_STATUS 0xFFC01EE8 /* DMA Channel 19 Interrupt/Status Register */
654#define DMA19_PERIPHERAL_MAP 0xFFC01EEC /* DMA Channel 19 Peripheral Map Register */
655#define DMA19_CURR_X_COUNT 0xFFC01EF0 /* DMA Channel 19 Current X Count Register */
656#define DMA19_CURR_Y_COUNT 0xFFC01EF8 /* DMA Channel 19 Current Y Count Register */
657
658#define MDMA1_D0_NEXT_DESC_PTR 0xFFC01F00 /* MemDMA1 Stream 0 Destination Next Descriptor Pointer Register */
659#define MDMA1_D0_START_ADDR 0xFFC01F04 /* MemDMA1 Stream 0 Destination Start Address Register */
660#define MDMA1_D0_CONFIG 0xFFC01F08 /* MemDMA1 Stream 0 Destination Configuration Register */
661#define MDMA1_D0_X_COUNT 0xFFC01F10 /* MemDMA1 Stream 0 Destination X Count Register */
662#define MDMA1_D0_X_MODIFY 0xFFC01F14 /* MemDMA1 Stream 0 Destination X Modify Register */
663#define MDMA1_D0_Y_COUNT 0xFFC01F18 /* MemDMA1 Stream 0 Destination Y Count Register */
664#define MDMA1_D0_Y_MODIFY 0xFFC01F1C /* MemDMA1 Stream 0 Destination Y Modify Register */
665#define MDMA1_D0_CURR_DESC_PTR 0xFFC01F20 /* MemDMA1 Stream 0 Destination Current Descriptor Pointer Register */
666#define MDMA1_D0_CURR_ADDR 0xFFC01F24 /* MemDMA1 Stream 0 Destination Current Address Register */
667#define MDMA1_D0_IRQ_STATUS 0xFFC01F28 /* MemDMA1 Stream 0 Destination Interrupt/Status Register */
668#define MDMA1_D0_PERIPHERAL_MAP 0xFFC01F2C /* MemDMA1 Stream 0 Destination Peripheral Map Register */
669#define MDMA1_D0_CURR_X_COUNT 0xFFC01F30 /* MemDMA1 Stream 0 Destination Current X Count Register */
670#define MDMA1_D0_CURR_Y_COUNT 0xFFC01F38 /* MemDMA1 Stream 0 Destination Current Y Count Register */
671
672#define MDMA1_S0_NEXT_DESC_PTR 0xFFC01F40 /* MemDMA1 Stream 0 Source Next Descriptor Pointer Register */
673#define MDMA1_S0_START_ADDR 0xFFC01F44 /* MemDMA1 Stream 0 Source Start Address Register */
674#define MDMA1_S0_CONFIG 0xFFC01F48 /* MemDMA1 Stream 0 Source Configuration Register */
675#define MDMA1_S0_X_COUNT 0xFFC01F50 /* MemDMA1 Stream 0 Source X Count Register */
676#define MDMA1_S0_X_MODIFY 0xFFC01F54 /* MemDMA1 Stream 0 Source X Modify Register */
677#define MDMA1_S0_Y_COUNT 0xFFC01F58 /* MemDMA1 Stream 0 Source Y Count Register */
678#define MDMA1_S0_Y_MODIFY 0xFFC01F5C /* MemDMA1 Stream 0 Source Y Modify Register */
679#define MDMA1_S0_CURR_DESC_PTR 0xFFC01F60 /* MemDMA1 Stream 0 Source Current Descriptor Pointer Register */
680#define MDMA1_S0_CURR_ADDR 0xFFC01F64 /* MemDMA1 Stream 0 Source Current Address Register */
681#define MDMA1_S0_IRQ_STATUS 0xFFC01F68 /* MemDMA1 Stream 0 Source Interrupt/Status Register */
682#define MDMA1_S0_PERIPHERAL_MAP 0xFFC01F6C /* MemDMA1 Stream 0 Source Peripheral Map Register */
683#define MDMA1_S0_CURR_X_COUNT 0xFFC01F70 /* MemDMA1 Stream 0 Source Current X Count Register */
684#define MDMA1_S0_CURR_Y_COUNT 0xFFC01F78 /* MemDMA1 Stream 0 Source Current Y Count Register */
685
686#define MDMA1_D1_NEXT_DESC_PTR 0xFFC01F80 /* MemDMA1 Stream 1 Destination Next Descriptor Pointer Register */
687#define MDMA1_D1_START_ADDR 0xFFC01F84 /* MemDMA1 Stream 1 Destination Start Address Register */
688#define MDMA1_D1_CONFIG 0xFFC01F88 /* MemDMA1 Stream 1 Destination Configuration Register */
689#define MDMA1_D1_X_COUNT 0xFFC01F90 /* MemDMA1 Stream 1 Destination X Count Register */
690#define MDMA1_D1_X_MODIFY 0xFFC01F94 /* MemDMA1 Stream 1 Destination X Modify Register */
691#define MDMA1_D1_Y_COUNT 0xFFC01F98 /* MemDMA1 Stream 1 Destination Y Count Register */
692#define MDMA1_D1_Y_MODIFY 0xFFC01F9C /* MemDMA1 Stream 1 Destination Y Modify Register */
693#define MDMA1_D1_CURR_DESC_PTR 0xFFC01FA0 /* MemDMA1 Stream 1 Destination Current Descriptor Pointer Register */
694#define MDMA1_D1_CURR_ADDR 0xFFC01FA4 /* MemDMA1 Stream 1 Destination Current Address Register */
695#define MDMA1_D1_IRQ_STATUS 0xFFC01FA8 /* MemDMA1 Stream 1 Destination Interrupt/Status Register */
696#define MDMA1_D1_PERIPHERAL_MAP 0xFFC01FAC /* MemDMA1 Stream 1 Destination Peripheral Map Register */
697#define MDMA1_D1_CURR_X_COUNT 0xFFC01FB0 /* MemDMA1 Stream 1 Destination Current X Count Register */
698#define MDMA1_D1_CURR_Y_COUNT 0xFFC01FB8 /* MemDMA1 Stream 1 Destination Current Y Count Register */
699
700#define MDMA1_S1_NEXT_DESC_PTR 0xFFC01FC0 /* MemDMA1 Stream 1 Source Next Descriptor Pointer Register */
701#define MDMA1_S1_START_ADDR 0xFFC01FC4 /* MemDMA1 Stream 1 Source Start Address Register */
702#define MDMA1_S1_CONFIG 0xFFC01FC8 /* MemDMA1 Stream 1 Source Configuration Register */
703#define MDMA1_S1_X_COUNT 0xFFC01FD0 /* MemDMA1 Stream 1 Source X Count Register */
704#define MDMA1_S1_X_MODIFY 0xFFC01FD4 /* MemDMA1 Stream 1 Source X Modify Register */
705#define MDMA1_S1_Y_COUNT 0xFFC01FD8 /* MemDMA1 Stream 1 Source Y Count Register */
706#define MDMA1_S1_Y_MODIFY 0xFFC01FDC /* MemDMA1 Stream 1 Source Y Modify Register */
707#define MDMA1_S1_CURR_DESC_PTR 0xFFC01FE0 /* MemDMA1 Stream 1 Source Current Descriptor Pointer Register */
708#define MDMA1_S1_CURR_ADDR 0xFFC01FE4 /* MemDMA1 Stream 1 Source Current Address Register */
709#define MDMA1_S1_IRQ_STATUS 0xFFC01FE8 /* MemDMA1 Stream 1 Source Interrupt/Status Register */
710#define MDMA1_S1_PERIPHERAL_MAP 0xFFC01FEC /* MemDMA1 Stream 1 Source Peripheral Map Register */
711#define MDMA1_S1_CURR_X_COUNT 0xFFC01FF0 /* MemDMA1 Stream 1 Source Current X Count Register */
712#define MDMA1_S1_CURR_Y_COUNT 0xFFC01FF8 /* MemDMA1 Stream 1 Source Current Y Count Register */
713
714
715/* UART1 Controller (0xFFC02000 - 0xFFC020FF) */
716#define UART1_THR 0xFFC02000 /* Transmit Holding register */
717#define UART1_RBR 0xFFC02000 /* Receive Buffer register */
718#define UART1_DLL 0xFFC02000 /* Divisor Latch (Low-Byte) */
719#define UART1_IER 0xFFC02004 /* Interrupt Enable Register */
720#define UART1_DLH 0xFFC02004 /* Divisor Latch (High-Byte) */
721#define UART1_IIR 0xFFC02008 /* Interrupt Identification Register */
722#define UART1_LCR 0xFFC0200C /* Line Control Register */
723#define UART1_MCR 0xFFC02010 /* Modem Control Register */
724#define UART1_LSR 0xFFC02014 /* Line Status Register */
725#define UART1_SCR 0xFFC0201C /* SCR Scratch Register */
726#define UART1_GCTL 0xFFC02024 /* Global Control Register */
727
728
729/* UART2 Controller (0xFFC02100 - 0xFFC021FF) */
730#define UART2_THR 0xFFC02100 /* Transmit Holding register */
731#define UART2_RBR 0xFFC02100 /* Receive Buffer register */
732#define UART2_DLL 0xFFC02100 /* Divisor Latch (Low-Byte) */
733#define UART2_IER 0xFFC02104 /* Interrupt Enable Register */
734#define UART2_DLH 0xFFC02104 /* Divisor Latch (High-Byte) */
735#define UART2_IIR 0xFFC02108 /* Interrupt Identification Register */
736#define UART2_LCR 0xFFC0210C /* Line Control Register */
737#define UART2_MCR 0xFFC02110 /* Modem Control Register */
738#define UART2_LSR 0xFFC02114 /* Line Status Register */
739#define UART2_SCR 0xFFC0211C /* SCR Scratch Register */
740#define UART2_GCTL 0xFFC02124 /* Global Control Register */
741
742
743/* Two-Wire Interface 1 (0xFFC02200 - 0xFFC022FF) */
744#define TWI1_CLKDIV 0xFFC02200 /* Serial Clock Divider Register */
745#define TWI1_CONTROL 0xFFC02204 /* TWI1 Master Internal Time Reference Register */
746#define TWI1_SLAVE_CTRL 0xFFC02208 /* Slave Mode Control Register */
747#define TWI1_SLAVE_STAT 0xFFC0220C /* Slave Mode Status Register */
748#define TWI1_SLAVE_ADDR 0xFFC02210 /* Slave Mode Address Register */
749#define TWI1_MASTER_CTRL 0xFFC02214 /* Master Mode Control Register */
750#define TWI1_MASTER_STAT 0xFFC02218 /* Master Mode Status Register */
751#define TWI1_MASTER_ADDR 0xFFC0221C /* Master Mode Address Register */
752#define TWI1_INT_STAT 0xFFC02220 /* TWI1 Master Interrupt Register */
753#define TWI1_INT_MASK 0xFFC02224 /* TWI1 Master Interrupt Mask Register */
754#define TWI1_FIFO_CTRL 0xFFC02228 /* FIFO Control Register */
755#define TWI1_FIFO_STAT 0xFFC0222C /* FIFO Status Register */
756#define TWI1_XMT_DATA8 0xFFC02280 /* FIFO Transmit Data Single Byte Register */
757#define TWI1_XMT_DATA16 0xFFC02284 /* FIFO Transmit Data Double Byte Register */
758#define TWI1_RCV_DATA8 0xFFC02288 /* FIFO Receive Data Single Byte Register */
759#define TWI1_RCV_DATA16 0xFFC0228C /* FIFO Receive Data Double Byte Register */
760#define TWI1_REGBASE TWI1_CLKDIV
761
762
763/* the following are for backwards compatibility */
764#define TWI1_PRESCALE TWI1_CONTROL
765#define TWI1_INT_SRC TWI1_INT_STAT
766#define TWI1_INT_ENABLE TWI1_INT_MASK
767
768
769/* SPI1 Controller (0xFFC02300 - 0xFFC023FF) */
770#define SPI1_CTL 0xFFC02300 /* SPI1 Control Register */
771#define SPI1_FLG 0xFFC02304 /* SPI1 Flag register */
772#define SPI1_STAT 0xFFC02308 /* SPI1 Status register */
773#define SPI1_TDBR 0xFFC0230C /* SPI1 Transmit Data Buffer Register */
774#define SPI1_RDBR 0xFFC02310 /* SPI1 Receive Data Buffer Register */
775#define SPI1_BAUD 0xFFC02314 /* SPI1 Baud rate Register */
776#define SPI1_SHADOW 0xFFC02318 /* SPI1_RDBR Shadow Register */
777#define SPI1_REGBASE SPI1_CTL
778
779/* SPI2 Controller (0xFFC02400 - 0xFFC024FF) */
780#define SPI2_CTL 0xFFC02400 /* SPI2 Control Register */
781#define SPI2_FLG 0xFFC02404 /* SPI2 Flag register */
782#define SPI2_STAT 0xFFC02408 /* SPI2 Status register */
783#define SPI2_TDBR 0xFFC0240C /* SPI2 Transmit Data Buffer Register */
784#define SPI2_RDBR 0xFFC02410 /* SPI2 Receive Data Buffer Register */
785#define SPI2_BAUD 0xFFC02414 /* SPI2 Baud rate Register */
786#define SPI2_SHADOW 0xFFC02418 /* SPI2_RDBR Shadow Register */
787#define SPI2_REGBASE SPI2_CTL
788
789/* SPORT2 Controller (0xFFC02500 - 0xFFC025FF) */
790#define SPORT2_TCR1 0xFFC02500 /* SPORT2 Transmit Configuration 1 Register */
791#define SPORT2_TCR2 0xFFC02504 /* SPORT2 Transmit Configuration 2 Register */
792#define SPORT2_TCLKDIV 0xFFC02508 /* SPORT2 Transmit Clock Divider */
793#define SPORT2_TFSDIV 0xFFC0250C /* SPORT2 Transmit Frame Sync Divider */
794#define SPORT2_TX 0xFFC02510 /* SPORT2 TX Data Register */
795#define SPORT2_RX 0xFFC02518 /* SPORT2 RX Data Register */
796#define SPORT2_RCR1 0xFFC02520 /* SPORT2 Transmit Configuration 1 Register */
797#define SPORT2_RCR2 0xFFC02524 /* SPORT2 Transmit Configuration 2 Register */
798#define SPORT2_RCLKDIV 0xFFC02528 /* SPORT2 Receive Clock Divider */
799#define SPORT2_RFSDIV 0xFFC0252C /* SPORT2 Receive Frame Sync Divider */
800#define SPORT2_STAT 0xFFC02530 /* SPORT2 Status Register */
801#define SPORT2_CHNL 0xFFC02534 /* SPORT2 Current Channel Register */
802#define SPORT2_MCMC1 0xFFC02538 /* SPORT2 Multi-Channel Configuration Register 1 */
803#define SPORT2_MCMC2 0xFFC0253C /* SPORT2 Multi-Channel Configuration Register 2 */
804#define SPORT2_MTCS0 0xFFC02540 /* SPORT2 Multi-Channel Transmit Select Register 0 */
805#define SPORT2_MTCS1 0xFFC02544 /* SPORT2 Multi-Channel Transmit Select Register 1 */
806#define SPORT2_MTCS2 0xFFC02548 /* SPORT2 Multi-Channel Transmit Select Register 2 */
807#define SPORT2_MTCS3 0xFFC0254C /* SPORT2 Multi-Channel Transmit Select Register 3 */
808#define SPORT2_MRCS0 0xFFC02550 /* SPORT2 Multi-Channel Receive Select Register 0 */
809#define SPORT2_MRCS1 0xFFC02554 /* SPORT2 Multi-Channel Receive Select Register 1 */
810#define SPORT2_MRCS2 0xFFC02558 /* SPORT2 Multi-Channel Receive Select Register 2 */
811#define SPORT2_MRCS3 0xFFC0255C /* SPORT2 Multi-Channel Receive Select Register 3 */
812
813
814/* SPORT3 Controller (0xFFC02600 - 0xFFC026FF) */
815#define SPORT3_TCR1 0xFFC02600 /* SPORT3 Transmit Configuration 1 Register */
816#define SPORT3_TCR2 0xFFC02604 /* SPORT3 Transmit Configuration 2 Register */
817#define SPORT3_TCLKDIV 0xFFC02608 /* SPORT3 Transmit Clock Divider */
818#define SPORT3_TFSDIV 0xFFC0260C /* SPORT3 Transmit Frame Sync Divider */
819#define SPORT3_TX 0xFFC02610 /* SPORT3 TX Data Register */
820#define SPORT3_RX 0xFFC02618 /* SPORT3 RX Data Register */
821#define SPORT3_RCR1 0xFFC02620 /* SPORT3 Transmit Configuration 1 Register */
822#define SPORT3_RCR2 0xFFC02624 /* SPORT3 Transmit Configuration 2 Register */
823#define SPORT3_RCLKDIV 0xFFC02628 /* SPORT3 Receive Clock Divider */
824#define SPORT3_RFSDIV 0xFFC0262C /* SPORT3 Receive Frame Sync Divider */
825#define SPORT3_STAT 0xFFC02630 /* SPORT3 Status Register */
826#define SPORT3_CHNL 0xFFC02634 /* SPORT3 Current Channel Register */
827#define SPORT3_MCMC1 0xFFC02638 /* SPORT3 Multi-Channel Configuration Register 1 */
828#define SPORT3_MCMC2 0xFFC0263C /* SPORT3 Multi-Channel Configuration Register 2 */
829#define SPORT3_MTCS0 0xFFC02640 /* SPORT3 Multi-Channel Transmit Select Register 0 */
830#define SPORT3_MTCS1 0xFFC02644 /* SPORT3 Multi-Channel Transmit Select Register 1 */
831#define SPORT3_MTCS2 0xFFC02648 /* SPORT3 Multi-Channel Transmit Select Register 2 */
832#define SPORT3_MTCS3 0xFFC0264C /* SPORT3 Multi-Channel Transmit Select Register 3 */
833#define SPORT3_MRCS0 0xFFC02650 /* SPORT3 Multi-Channel Receive Select Register 0 */
834#define SPORT3_MRCS1 0xFFC02654 /* SPORT3 Multi-Channel Receive Select Register 1 */
835#define SPORT3_MRCS2 0xFFC02658 /* SPORT3 Multi-Channel Receive Select Register 2 */
836#define SPORT3_MRCS3 0xFFC0265C /* SPORT3 Multi-Channel Receive Select Register 3 */
837
838
839/* Media Transceiver (MXVR) (0xFFC02700 - 0xFFC028FF) */
840
841#define MXVR_CONFIG 0xFFC02700 /* MXVR Configuration Register */
842#define MXVR_PLL_CTL_0 0xFFC02704 /* MXVR Phase Lock Loop Control Register 0 */
843
844#define MXVR_STATE_0 0xFFC02708 /* MXVR State Register 0 */
845#define MXVR_STATE_1 0xFFC0270C /* MXVR State Register 1 */
846
847#define MXVR_INT_STAT_0 0xFFC02710 /* MXVR Interrupt Status Register 0 */
848#define MXVR_INT_STAT_1 0xFFC02714 /* MXVR Interrupt Status Register 1 */
849
850#define MXVR_INT_EN_0 0xFFC02718 /* MXVR Interrupt Enable Register 0 */
851#define MXVR_INT_EN_1 0xFFC0271C /* MXVR Interrupt Enable Register 1 */
852
853#define MXVR_POSITION 0xFFC02720 /* MXVR Node Position Register */
854#define MXVR_MAX_POSITION 0xFFC02724 /* MXVR Maximum Node Position Register */
855
856#define MXVR_DELAY 0xFFC02728 /* MXVR Node Frame Delay Register */
857#define MXVR_MAX_DELAY 0xFFC0272C /* MXVR Maximum Node Frame Delay Register */
858
859#define MXVR_LADDR 0xFFC02730 /* MXVR Logical Address Register */
860#define MXVR_GADDR 0xFFC02734 /* MXVR Group Address Register */
861#define MXVR_AADDR 0xFFC02738 /* MXVR Alternate Address Register */
862
863#define MXVR_ALLOC_0 0xFFC0273C /* MXVR Allocation Table Register 0 */
864#define MXVR_ALLOC_1 0xFFC02740 /* MXVR Allocation Table Register 1 */
865#define MXVR_ALLOC_2 0xFFC02744 /* MXVR Allocation Table Register 2 */
866#define MXVR_ALLOC_3 0xFFC02748 /* MXVR Allocation Table Register 3 */
867#define MXVR_ALLOC_4 0xFFC0274C /* MXVR Allocation Table Register 4 */
868#define MXVR_ALLOC_5 0xFFC02750 /* MXVR Allocation Table Register 5 */
869#define MXVR_ALLOC_6 0xFFC02754 /* MXVR Allocation Table Register 6 */
870#define MXVR_ALLOC_7 0xFFC02758 /* MXVR Allocation Table Register 7 */
871#define MXVR_ALLOC_8 0xFFC0275C /* MXVR Allocation Table Register 8 */
872#define MXVR_ALLOC_9 0xFFC02760 /* MXVR Allocation Table Register 9 */
873#define MXVR_ALLOC_10 0xFFC02764 /* MXVR Allocation Table Register 10 */
874#define MXVR_ALLOC_11 0xFFC02768 /* MXVR Allocation Table Register 11 */
875#define MXVR_ALLOC_12 0xFFC0276C /* MXVR Allocation Table Register 12 */
876#define MXVR_ALLOC_13 0xFFC02770 /* MXVR Allocation Table Register 13 */
877#define MXVR_ALLOC_14 0xFFC02774 /* MXVR Allocation Table Register 14 */
878
879#define MXVR_SYNC_LCHAN_0 0xFFC02778 /* MXVR Sync Data Logical Channel Assign Register 0 */
880#define MXVR_SYNC_LCHAN_1 0xFFC0277C /* MXVR Sync Data Logical Channel Assign Register 1 */
881#define MXVR_SYNC_LCHAN_2 0xFFC02780 /* MXVR Sync Data Logical Channel Assign Register 2 */
882#define MXVR_SYNC_LCHAN_3 0xFFC02784 /* MXVR Sync Data Logical Channel Assign Register 3 */
883#define MXVR_SYNC_LCHAN_4 0xFFC02788 /* MXVR Sync Data Logical Channel Assign Register 4 */
884#define MXVR_SYNC_LCHAN_5 0xFFC0278C /* MXVR Sync Data Logical Channel Assign Register 5 */
885#define MXVR_SYNC_LCHAN_6 0xFFC02790 /* MXVR Sync Data Logical Channel Assign Register 6 */
886#define MXVR_SYNC_LCHAN_7 0xFFC02794 /* MXVR Sync Data Logical Channel Assign Register 7 */
887
888#define MXVR_DMA0_CONFIG 0xFFC02798 /* MXVR Sync Data DMA0 Config Register */
889#define MXVR_DMA0_START_ADDR 0xFFC0279C /* MXVR Sync Data DMA0 Start Address Register */
890#define MXVR_DMA0_COUNT 0xFFC027A0 /* MXVR Sync Data DMA0 Loop Count Register */
891#define MXVR_DMA0_CURR_ADDR 0xFFC027A4 /* MXVR Sync Data DMA0 Current Address Register */
892#define MXVR_DMA0_CURR_COUNT 0xFFC027A8 /* MXVR Sync Data DMA0 Current Loop Count Register */
893
894#define MXVR_DMA1_CONFIG 0xFFC027AC /* MXVR Sync Data DMA1 Config Register */
895#define MXVR_DMA1_START_ADDR 0xFFC027B0 /* MXVR Sync Data DMA1 Start Address Register */
896#define MXVR_DMA1_COUNT 0xFFC027B4 /* MXVR Sync Data DMA1 Loop Count Register */
897#define MXVR_DMA1_CURR_ADDR 0xFFC027B8 /* MXVR Sync Data DMA1 Current Address Register */
898#define MXVR_DMA1_CURR_COUNT 0xFFC027BC /* MXVR Sync Data DMA1 Current Loop Count Register */
899
900#define MXVR_DMA2_CONFIG 0xFFC027C0 /* MXVR Sync Data DMA2 Config Register */
901#define MXVR_DMA2_START_ADDR 0xFFC027C4 /* MXVR Sync Data DMA2 Start Address Register */
902#define MXVR_DMA2_COUNT 0xFFC027C8 /* MXVR Sync Data DMA2 Loop Count Register */
903#define MXVR_DMA2_CURR_ADDR 0xFFC027CC /* MXVR Sync Data DMA2 Current Address Register */
904#define MXVR_DMA2_CURR_COUNT 0xFFC027D0 /* MXVR Sync Data DMA2 Current Loop Count Register */
905
906#define MXVR_DMA3_CONFIG 0xFFC027D4 /* MXVR Sync Data DMA3 Config Register */
907#define MXVR_DMA3_START_ADDR 0xFFC027D8 /* MXVR Sync Data DMA3 Start Address Register */
908#define MXVR_DMA3_COUNT 0xFFC027DC /* MXVR Sync Data DMA3 Loop Count Register */
909#define MXVR_DMA3_CURR_ADDR 0xFFC027E0 /* MXVR Sync Data DMA3 Current Address Register */
910#define MXVR_DMA3_CURR_COUNT 0xFFC027E4 /* MXVR Sync Data DMA3 Current Loop Count Register */
911
912#define MXVR_DMA4_CONFIG 0xFFC027E8 /* MXVR Sync Data DMA4 Config Register */
913#define MXVR_DMA4_START_ADDR 0xFFC027EC /* MXVR Sync Data DMA4 Start Address Register */
914#define MXVR_DMA4_COUNT 0xFFC027F0 /* MXVR Sync Data DMA4 Loop Count Register */
915#define MXVR_DMA4_CURR_ADDR 0xFFC027F4 /* MXVR Sync Data DMA4 Current Address Register */
916#define MXVR_DMA4_CURR_COUNT 0xFFC027F8 /* MXVR Sync Data DMA4 Current Loop Count Register */
917
918#define MXVR_DMA5_CONFIG 0xFFC027FC /* MXVR Sync Data DMA5 Config Register */
919#define MXVR_DMA5_START_ADDR 0xFFC02800 /* MXVR Sync Data DMA5 Start Address Register */
920#define MXVR_DMA5_COUNT 0xFFC02804 /* MXVR Sync Data DMA5 Loop Count Register */
921#define MXVR_DMA5_CURR_ADDR 0xFFC02808 /* MXVR Sync Data DMA5 Current Address Register */
922#define MXVR_DMA5_CURR_COUNT 0xFFC0280C /* MXVR Sync Data DMA5 Current Loop Count Register */
923
924#define MXVR_DMA6_CONFIG 0xFFC02810 /* MXVR Sync Data DMA6 Config Register */
925#define MXVR_DMA6_START_ADDR 0xFFC02814 /* MXVR Sync Data DMA6 Start Address Register */
926#define MXVR_DMA6_COUNT 0xFFC02818 /* MXVR Sync Data DMA6 Loop Count Register */
927#define MXVR_DMA6_CURR_ADDR 0xFFC0281C /* MXVR Sync Data DMA6 Current Address Register */
928#define MXVR_DMA6_CURR_COUNT 0xFFC02820 /* MXVR Sync Data DMA6 Current Loop Count Register */
929
930#define MXVR_DMA7_CONFIG 0xFFC02824 /* MXVR Sync Data DMA7 Config Register */
931#define MXVR_DMA7_START_ADDR 0xFFC02828 /* MXVR Sync Data DMA7 Start Address Register */
932#define MXVR_DMA7_COUNT 0xFFC0282C /* MXVR Sync Data DMA7 Loop Count Register */
933#define MXVR_DMA7_CURR_ADDR 0xFFC02830 /* MXVR Sync Data DMA7 Current Address Register */
934#define MXVR_DMA7_CURR_COUNT 0xFFC02834 /* MXVR Sync Data DMA7 Current Loop Count Register */
935
936#define MXVR_AP_CTL 0xFFC02838 /* MXVR Async Packet Control Register */
937#define MXVR_APRB_START_ADDR 0xFFC0283C /* MXVR Async Packet RX Buffer Start Addr Register */
938#define MXVR_APRB_CURR_ADDR 0xFFC02840 /* MXVR Async Packet RX Buffer Current Addr Register */
939#define MXVR_APTB_START_ADDR 0xFFC02844 /* MXVR Async Packet TX Buffer Start Addr Register */
940#define MXVR_APTB_CURR_ADDR 0xFFC02848 /* MXVR Async Packet TX Buffer Current Addr Register */
941
942#define MXVR_CM_CTL 0xFFC0284C /* MXVR Control Message Control Register */
943#define MXVR_CMRB_START_ADDR 0xFFC02850 /* MXVR Control Message RX Buffer Start Addr Register */
944#define MXVR_CMRB_CURR_ADDR 0xFFC02854 /* MXVR Control Message RX Buffer Current Address */
945#define MXVR_CMTB_START_ADDR 0xFFC02858 /* MXVR Control Message TX Buffer Start Addr Register */
946#define MXVR_CMTB_CURR_ADDR 0xFFC0285C /* MXVR Control Message TX Buffer Current Address */
947
948#define MXVR_RRDB_START_ADDR 0xFFC02860 /* MXVR Remote Read Buffer Start Addr Register */
949#define MXVR_RRDB_CURR_ADDR 0xFFC02864 /* MXVR Remote Read Buffer Current Addr Register */
950
951#define MXVR_PAT_DATA_0 0xFFC02868 /* MXVR Pattern Data Register 0 */
952#define MXVR_PAT_EN_0 0xFFC0286C /* MXVR Pattern Enable Register 0 */
953#define MXVR_PAT_DATA_1 0xFFC02870 /* MXVR Pattern Data Register 1 */
954#define MXVR_PAT_EN_1 0xFFC02874 /* MXVR Pattern Enable Register 1 */
955
956#define MXVR_FRAME_CNT_0 0xFFC02878 /* MXVR Frame Counter 0 */
957#define MXVR_FRAME_CNT_1 0xFFC0287C /* MXVR Frame Counter 1 */
958
959#define MXVR_ROUTING_0 0xFFC02880 /* MXVR Routing Table Register 0 */
960#define MXVR_ROUTING_1 0xFFC02884 /* MXVR Routing Table Register 1 */
961#define MXVR_ROUTING_2 0xFFC02888 /* MXVR Routing Table Register 2 */
962#define MXVR_ROUTING_3 0xFFC0288C /* MXVR Routing Table Register 3 */
963#define MXVR_ROUTING_4 0xFFC02890 /* MXVR Routing Table Register 4 */
964#define MXVR_ROUTING_5 0xFFC02894 /* MXVR Routing Table Register 5 */
965#define MXVR_ROUTING_6 0xFFC02898 /* MXVR Routing Table Register 6 */
966#define MXVR_ROUTING_7 0xFFC0289C /* MXVR Routing Table Register 7 */
967#define MXVR_ROUTING_8 0xFFC028A0 /* MXVR Routing Table Register 8 */
968#define MXVR_ROUTING_9 0xFFC028A4 /* MXVR Routing Table Register 9 */
969#define MXVR_ROUTING_10 0xFFC028A8 /* MXVR Routing Table Register 10 */
970#define MXVR_ROUTING_11 0xFFC028AC /* MXVR Routing Table Register 11 */
971#define MXVR_ROUTING_12 0xFFC028B0 /* MXVR Routing Table Register 12 */
972#define MXVR_ROUTING_13 0xFFC028B4 /* MXVR Routing Table Register 13 */
973#define MXVR_ROUTING_14 0xFFC028B8 /* MXVR Routing Table Register 14 */
974
975#define MXVR_PLL_CTL_1 0xFFC028BC /* MXVR Phase Lock Loop Control Register 1 */
976#define MXVR_BLOCK_CNT 0xFFC028C0 /* MXVR Block Counter */
977#define MXVR_PLL_CTL_2 0xFFC028C4 /* MXVR Phase Lock Loop Control Register 2 */
978
979
980/* CAN Controller (0xFFC02A00 - 0xFFC02FFF) */
981/* For Mailboxes 0-15 */
982#define CAN_MC1 0xFFC02A00 /* Mailbox config reg 1 */
983#define CAN_MD1 0xFFC02A04 /* Mailbox direction reg 1 */
984#define CAN_TRS1 0xFFC02A08 /* Transmit Request Set reg 1 */
985#define CAN_TRR1 0xFFC02A0C /* Transmit Request Reset reg 1 */
986#define CAN_TA1 0xFFC02A10 /* Transmit Acknowledge reg 1 */
987#define CAN_AA1 0xFFC02A14 /* Transmit Abort Acknowledge reg 1 */
988#define CAN_RMP1 0xFFC02A18 /* Receive Message Pending reg 1 */
989#define CAN_RML1 0xFFC02A1C /* Receive Message Lost reg 1 */
990#define CAN_MBTIF1 0xFFC02A20 /* Mailbox Transmit Interrupt Flag reg 1 */
991#define CAN_MBRIF1 0xFFC02A24 /* Mailbox Receive Interrupt Flag reg 1 */
992#define CAN_MBIM1 0xFFC02A28 /* Mailbox Interrupt Mask reg 1 */
993#define CAN_RFH1 0xFFC02A2C /* Remote Frame Handling reg 1 */
994#define CAN_OPSS1 0xFFC02A30 /* Overwrite Protection Single Shot Xmission reg 1 */
995
996/* For Mailboxes 16-31 */
997#define CAN_MC2 0xFFC02A40 /* Mailbox config reg 2 */
998#define CAN_MD2 0xFFC02A44 /* Mailbox direction reg 2 */
999#define CAN_TRS2 0xFFC02A48 /* Transmit Request Set reg 2 */
1000#define CAN_TRR2 0xFFC02A4C /* Transmit Request Reset reg 2 */
1001#define CAN_TA2 0xFFC02A50 /* Transmit Acknowledge reg 2 */
1002#define CAN_AA2 0xFFC02A54 /* Transmit Abort Acknowledge reg 2 */
1003#define CAN_RMP2 0xFFC02A58 /* Receive Message Pending reg 2 */
1004#define CAN_RML2 0xFFC02A5C /* Receive Message Lost reg 2 */
1005#define CAN_MBTIF2 0xFFC02A60 /* Mailbox Transmit Interrupt Flag reg 2 */
1006#define CAN_MBRIF2 0xFFC02A64 /* Mailbox Receive Interrupt Flag reg 2 */
1007#define CAN_MBIM2 0xFFC02A68 /* Mailbox Interrupt Mask reg 2 */
1008#define CAN_RFH2 0xFFC02A6C /* Remote Frame Handling reg 2 */
1009#define CAN_OPSS2 0xFFC02A70 /* Overwrite Protection Single Shot Xmission reg 2 */
1010
1011#define CAN_CLOCK 0xFFC02A80 /* Bit Timing Configuration register 0 */
1012#define CAN_TIMING 0xFFC02A84 /* Bit Timing Configuration register 1 */
1013
1014#define CAN_DEBUG 0xFFC02A88 /* Debug Register */
1015/* the following is for backwards compatibility */
1016#define CAN_CNF CAN_DEBUG
1017
1018#define CAN_STATUS 0xFFC02A8C /* Global Status Register */
1019#define CAN_CEC 0xFFC02A90 /* Error Counter Register */
1020#define CAN_GIS 0xFFC02A94 /* Global Interrupt Status Register */
1021#define CAN_GIM 0xFFC02A98 /* Global Interrupt Mask Register */
1022#define CAN_GIF 0xFFC02A9C /* Global Interrupt Flag Register */
1023#define CAN_CONTROL 0xFFC02AA0 /* Master Control Register */
1024#define CAN_INTR 0xFFC02AA4 /* Interrupt Pending Register */
1025#define CAN_MBTD 0xFFC02AAC /* Mailbox Temporary Disable Feature */
1026#define CAN_EWR 0xFFC02AB0 /* Programmable Warning Level */
1027#define CAN_ESR 0xFFC02AB4 /* Error Status Register */
1028#define CAN_UCCNT 0xFFC02AC4 /* Universal Counter */
1029#define CAN_UCRC 0xFFC02AC8 /* Universal Counter Reload/Capture Register */
1030#define CAN_UCCNF 0xFFC02ACC /* Universal Counter Configuration Register */
1031
1032/* Mailbox Acceptance Masks */
1033#define CAN_AM00L 0xFFC02B00 /* Mailbox 0 Low Acceptance Mask */
1034#define CAN_AM00H 0xFFC02B04 /* Mailbox 0 High Acceptance Mask */
1035#define CAN_AM01L 0xFFC02B08 /* Mailbox 1 Low Acceptance Mask */
1036#define CAN_AM01H 0xFFC02B0C /* Mailbox 1 High Acceptance Mask */
1037#define CAN_AM02L 0xFFC02B10 /* Mailbox 2 Low Acceptance Mask */
1038#define CAN_AM02H 0xFFC02B14 /* Mailbox 2 High Acceptance Mask */
1039#define CAN_AM03L 0xFFC02B18 /* Mailbox 3 Low Acceptance Mask */
1040#define CAN_AM03H 0xFFC02B1C /* Mailbox 3 High Acceptance Mask */
1041#define CAN_AM04L 0xFFC02B20 /* Mailbox 4 Low Acceptance Mask */
1042#define CAN_AM04H 0xFFC02B24 /* Mailbox 4 High Acceptance Mask */
1043#define CAN_AM05L 0xFFC02B28 /* Mailbox 5 Low Acceptance Mask */
1044#define CAN_AM05H 0xFFC02B2C /* Mailbox 5 High Acceptance Mask */
1045#define CAN_AM06L 0xFFC02B30 /* Mailbox 6 Low Acceptance Mask */
1046#define CAN_AM06H 0xFFC02B34 /* Mailbox 6 High Acceptance Mask */
1047#define CAN_AM07L 0xFFC02B38 /* Mailbox 7 Low Acceptance Mask */
1048#define CAN_AM07H 0xFFC02B3C /* Mailbox 7 High Acceptance Mask */
1049#define CAN_AM08L 0xFFC02B40 /* Mailbox 8 Low Acceptance Mask */
1050#define CAN_AM08H 0xFFC02B44 /* Mailbox 8 High Acceptance Mask */
1051#define CAN_AM09L 0xFFC02B48 /* Mailbox 9 Low Acceptance Mask */
1052#define CAN_AM09H 0xFFC02B4C /* Mailbox 9 High Acceptance Mask */
1053#define CAN_AM10L 0xFFC02B50 /* Mailbox 10 Low Acceptance Mask */
1054#define CAN_AM10H 0xFFC02B54 /* Mailbox 10 High Acceptance Mask */
1055#define CAN_AM11L 0xFFC02B58 /* Mailbox 11 Low Acceptance Mask */
1056#define CAN_AM11H 0xFFC02B5C /* Mailbox 11 High Acceptance Mask */
1057#define CAN_AM12L 0xFFC02B60 /* Mailbox 12 Low Acceptance Mask */
1058#define CAN_AM12H 0xFFC02B64 /* Mailbox 12 High Acceptance Mask */
1059#define CAN_AM13L 0xFFC02B68 /* Mailbox 13 Low Acceptance Mask */
1060#define CAN_AM13H 0xFFC02B6C /* Mailbox 13 High Acceptance Mask */
1061#define CAN_AM14L 0xFFC02B70 /* Mailbox 14 Low Acceptance Mask */
1062#define CAN_AM14H 0xFFC02B74 /* Mailbox 14 High Acceptance Mask */
1063#define CAN_AM15L 0xFFC02B78 /* Mailbox 15 Low Acceptance Mask */
1064#define CAN_AM15H 0xFFC02B7C /* Mailbox 15 High Acceptance Mask */
1065
1066#define CAN_AM16L 0xFFC02B80 /* Mailbox 16 Low Acceptance Mask */
1067#define CAN_AM16H 0xFFC02B84 /* Mailbox 16 High Acceptance Mask */
1068#define CAN_AM17L 0xFFC02B88 /* Mailbox 17 Low Acceptance Mask */
1069#define CAN_AM17H 0xFFC02B8C /* Mailbox 17 High Acceptance Mask */
1070#define CAN_AM18L 0xFFC02B90 /* Mailbox 18 Low Acceptance Mask */
1071#define CAN_AM18H 0xFFC02B94 /* Mailbox 18 High Acceptance Mask */
1072#define CAN_AM19L 0xFFC02B98 /* Mailbox 19 Low Acceptance Mask */
1073#define CAN_AM19H 0xFFC02B9C /* Mailbox 19 High Acceptance Mask */
1074#define CAN_AM20L 0xFFC02BA0 /* Mailbox 20 Low Acceptance Mask */
1075#define CAN_AM20H 0xFFC02BA4 /* Mailbox 20 High Acceptance Mask */
1076#define CAN_AM21L 0xFFC02BA8 /* Mailbox 21 Low Acceptance Mask */
1077#define CAN_AM21H 0xFFC02BAC /* Mailbox 21 High Acceptance Mask */
1078#define CAN_AM22L 0xFFC02BB0 /* Mailbox 22 Low Acceptance Mask */
1079#define CAN_AM22H 0xFFC02BB4 /* Mailbox 22 High Acceptance Mask */
1080#define CAN_AM23L 0xFFC02BB8 /* Mailbox 23 Low Acceptance Mask */
1081#define CAN_AM23H 0xFFC02BBC /* Mailbox 23 High Acceptance Mask */
1082#define CAN_AM24L 0xFFC02BC0 /* Mailbox 24 Low Acceptance Mask */
1083#define CAN_AM24H 0xFFC02BC4 /* Mailbox 24 High Acceptance Mask */
1084#define CAN_AM25L 0xFFC02BC8 /* Mailbox 25 Low Acceptance Mask */
1085#define CAN_AM25H 0xFFC02BCC /* Mailbox 25 High Acceptance Mask */
1086#define CAN_AM26L 0xFFC02BD0 /* Mailbox 26 Low Acceptance Mask */
1087#define CAN_AM26H 0xFFC02BD4 /* Mailbox 26 High Acceptance Mask */
1088#define CAN_AM27L 0xFFC02BD8 /* Mailbox 27 Low Acceptance Mask */
1089#define CAN_AM27H 0xFFC02BDC /* Mailbox 27 High Acceptance Mask */
1090#define CAN_AM28L 0xFFC02BE0 /* Mailbox 28 Low Acceptance Mask */
1091#define CAN_AM28H 0xFFC02BE4 /* Mailbox 28 High Acceptance Mask */
1092#define CAN_AM29L 0xFFC02BE8 /* Mailbox 29 Low Acceptance Mask */
1093#define CAN_AM29H 0xFFC02BEC /* Mailbox 29 High Acceptance Mask */
1094#define CAN_AM30L 0xFFC02BF0 /* Mailbox 30 Low Acceptance Mask */
1095#define CAN_AM30H 0xFFC02BF4 /* Mailbox 30 High Acceptance Mask */
1096#define CAN_AM31L 0xFFC02BF8 /* Mailbox 31 Low Acceptance Mask */
1097#define CAN_AM31H 0xFFC02BFC /* Mailbox 31 High Acceptance Mask */
1098
1099/* CAN Acceptance Mask Macros */
1100#define CAN_AM_L(x) (CAN_AM00L+((x)*0x8))
1101#define CAN_AM_H(x) (CAN_AM00H+((x)*0x8))
1102
1103/* Mailbox Registers */
1104#define CAN_MB00_DATA0 0xFFC02C00 /* Mailbox 0 Data Word 0 [15:0] Register */
1105#define CAN_MB00_DATA1 0xFFC02C04 /* Mailbox 0 Data Word 1 [31:16] Register */
1106#define CAN_MB00_DATA2 0xFFC02C08 /* Mailbox 0 Data Word 2 [47:32] Register */
1107#define CAN_MB00_DATA3 0xFFC02C0C /* Mailbox 0 Data Word 3 [63:48] Register */
1108#define CAN_MB00_LENGTH 0xFFC02C10 /* Mailbox 0 Data Length Code Register */
1109#define CAN_MB00_TIMESTAMP 0xFFC02C14 /* Mailbox 0 Time Stamp Value Register */
1110#define CAN_MB00_ID0 0xFFC02C18 /* Mailbox 0 Identifier Low Register */
1111#define CAN_MB00_ID1 0xFFC02C1C /* Mailbox 0 Identifier High Register */
1112
1113#define CAN_MB01_DATA0 0xFFC02C20 /* Mailbox 1 Data Word 0 [15:0] Register */
1114#define CAN_MB01_DATA1 0xFFC02C24 /* Mailbox 1 Data Word 1 [31:16] Register */
1115#define CAN_MB01_DATA2 0xFFC02C28 /* Mailbox 1 Data Word 2 [47:32] Register */
1116#define CAN_MB01_DATA3 0xFFC02C2C /* Mailbox 1 Data Word 3 [63:48] Register */
1117#define CAN_MB01_LENGTH 0xFFC02C30 /* Mailbox 1 Data Length Code Register */
1118#define CAN_MB01_TIMESTAMP 0xFFC02C34 /* Mailbox 1 Time Stamp Value Register */
1119#define CAN_MB01_ID0 0xFFC02C38 /* Mailbox 1 Identifier Low Register */
1120#define CAN_MB01_ID1 0xFFC02C3C /* Mailbox 1 Identifier High Register */
1121
1122#define CAN_MB02_DATA0 0xFFC02C40 /* Mailbox 2 Data Word 0 [15:0] Register */
1123#define CAN_MB02_DATA1 0xFFC02C44 /* Mailbox 2 Data Word 1 [31:16] Register */
1124#define CAN_MB02_DATA2 0xFFC02C48 /* Mailbox 2 Data Word 2 [47:32] Register */
1125#define CAN_MB02_DATA3 0xFFC02C4C /* Mailbox 2 Data Word 3 [63:48] Register */
1126#define CAN_MB02_LENGTH 0xFFC02C50 /* Mailbox 2 Data Length Code Register */
1127#define CAN_MB02_TIMESTAMP 0xFFC02C54 /* Mailbox 2 Time Stamp Value Register */
1128#define CAN_MB02_ID0 0xFFC02C58 /* Mailbox 2 Identifier Low Register */
1129#define CAN_MB02_ID1 0xFFC02C5C /* Mailbox 2 Identifier High Register */
1130
1131#define CAN_MB03_DATA0 0xFFC02C60 /* Mailbox 3 Data Word 0 [15:0] Register */
1132#define CAN_MB03_DATA1 0xFFC02C64 /* Mailbox 3 Data Word 1 [31:16] Register */
1133#define CAN_MB03_DATA2 0xFFC02C68 /* Mailbox 3 Data Word 2 [47:32] Register */
1134#define CAN_MB03_DATA3 0xFFC02C6C /* Mailbox 3 Data Word 3 [63:48] Register */
1135#define CAN_MB03_LENGTH 0xFFC02C70 /* Mailbox 3 Data Length Code Register */
1136#define CAN_MB03_TIMESTAMP 0xFFC02C74 /* Mailbox 3 Time Stamp Value Register */
1137#define CAN_MB03_ID0 0xFFC02C78 /* Mailbox 3 Identifier Low Register */
1138#define CAN_MB03_ID1 0xFFC02C7C /* Mailbox 3 Identifier High Register */
1139
1140#define CAN_MB04_DATA0 0xFFC02C80 /* Mailbox 4 Data Word 0 [15:0] Register */
1141#define CAN_MB04_DATA1 0xFFC02C84 /* Mailbox 4 Data Word 1 [31:16] Register */
1142#define CAN_MB04_DATA2 0xFFC02C88 /* Mailbox 4 Data Word 2 [47:32] Register */
1143#define CAN_MB04_DATA3 0xFFC02C8C /* Mailbox 4 Data Word 3 [63:48] Register */
1144#define CAN_MB04_LENGTH 0xFFC02C90 /* Mailbox 4 Data Length Code Register */
1145#define CAN_MB04_TIMESTAMP 0xFFC02C94 /* Mailbox 4 Time Stamp Value Register */
1146#define CAN_MB04_ID0 0xFFC02C98 /* Mailbox 4 Identifier Low Register */
1147#define CAN_MB04_ID1 0xFFC02C9C /* Mailbox 4 Identifier High Register */
1148
1149#define CAN_MB05_DATA0 0xFFC02CA0 /* Mailbox 5 Data Word 0 [15:0] Register */
1150#define CAN_MB05_DATA1 0xFFC02CA4 /* Mailbox 5 Data Word 1 [31:16] Register */
1151#define CAN_MB05_DATA2 0xFFC02CA8 /* Mailbox 5 Data Word 2 [47:32] Register */
1152#define CAN_MB05_DATA3 0xFFC02CAC /* Mailbox 5 Data Word 3 [63:48] Register */
1153#define CAN_MB05_LENGTH 0xFFC02CB0 /* Mailbox 5 Data Length Code Register */
1154#define CAN_MB05_TIMESTAMP 0xFFC02CB4 /* Mailbox 5 Time Stamp Value Register */
1155#define CAN_MB05_ID0 0xFFC02CB8 /* Mailbox 5 Identifier Low Register */
1156#define CAN_MB05_ID1 0xFFC02CBC /* Mailbox 5 Identifier High Register */
1157
1158#define CAN_MB06_DATA0 0xFFC02CC0 /* Mailbox 6 Data Word 0 [15:0] Register */
1159#define CAN_MB06_DATA1 0xFFC02CC4 /* Mailbox 6 Data Word 1 [31:16] Register */
1160#define CAN_MB06_DATA2 0xFFC02CC8 /* Mailbox 6 Data Word 2 [47:32] Register */
1161#define CAN_MB06_DATA3 0xFFC02CCC /* Mailbox 6 Data Word 3 [63:48] Register */
1162#define CAN_MB06_LENGTH 0xFFC02CD0 /* Mailbox 6 Data Length Code Register */
1163#define CAN_MB06_TIMESTAMP 0xFFC02CD4 /* Mailbox 6 Time Stamp Value Register */
1164#define CAN_MB06_ID0 0xFFC02CD8 /* Mailbox 6 Identifier Low Register */
1165#define CAN_MB06_ID1 0xFFC02CDC /* Mailbox 6 Identifier High Register */
1166
1167#define CAN_MB07_DATA0 0xFFC02CE0 /* Mailbox 7 Data Word 0 [15:0] Register */
1168#define CAN_MB07_DATA1 0xFFC02CE4 /* Mailbox 7 Data Word 1 [31:16] Register */
1169#define CAN_MB07_DATA2 0xFFC02CE8 /* Mailbox 7 Data Word 2 [47:32] Register */
1170#define CAN_MB07_DATA3 0xFFC02CEC /* Mailbox 7 Data Word 3 [63:48] Register */
1171#define CAN_MB07_LENGTH 0xFFC02CF0 /* Mailbox 7 Data Length Code Register */
1172#define CAN_MB07_TIMESTAMP 0xFFC02CF4 /* Mailbox 7 Time Stamp Value Register */
1173#define CAN_MB07_ID0 0xFFC02CF8 /* Mailbox 7 Identifier Low Register */
1174#define CAN_MB07_ID1 0xFFC02CFC /* Mailbox 7 Identifier High Register */
1175
1176#define CAN_MB08_DATA0 0xFFC02D00 /* Mailbox 8 Data Word 0 [15:0] Register */
1177#define CAN_MB08_DATA1 0xFFC02D04 /* Mailbox 8 Data Word 1 [31:16] Register */
1178#define CAN_MB08_DATA2 0xFFC02D08 /* Mailbox 8 Data Word 2 [47:32] Register */
1179#define CAN_MB08_DATA3 0xFFC02D0C /* Mailbox 8 Data Word 3 [63:48] Register */
1180#define CAN_MB08_LENGTH 0xFFC02D10 /* Mailbox 8 Data Length Code Register */
1181#define CAN_MB08_TIMESTAMP 0xFFC02D14 /* Mailbox 8 Time Stamp Value Register */
1182#define CAN_MB08_ID0 0xFFC02D18 /* Mailbox 8 Identifier Low Register */
1183#define CAN_MB08_ID1 0xFFC02D1C /* Mailbox 8 Identifier High Register */
1184
1185#define CAN_MB09_DATA0 0xFFC02D20 /* Mailbox 9 Data Word 0 [15:0] Register */
1186#define CAN_MB09_DATA1 0xFFC02D24 /* Mailbox 9 Data Word 1 [31:16] Register */
1187#define CAN_MB09_DATA2 0xFFC02D28 /* Mailbox 9 Data Word 2 [47:32] Register */
1188#define CAN_MB09_DATA3 0xFFC02D2C /* Mailbox 9 Data Word 3 [63:48] Register */
1189#define CAN_MB09_LENGTH 0xFFC02D30 /* Mailbox 9 Data Length Code Register */
1190#define CAN_MB09_TIMESTAMP 0xFFC02D34 /* Mailbox 9 Time Stamp Value Register */
1191#define CAN_MB09_ID0 0xFFC02D38 /* Mailbox 9 Identifier Low Register */
1192#define CAN_MB09_ID1 0xFFC02D3C /* Mailbox 9 Identifier High Register */
1193
1194#define CAN_MB10_DATA0 0xFFC02D40 /* Mailbox 10 Data Word 0 [15:0] Register */
1195#define CAN_MB10_DATA1 0xFFC02D44 /* Mailbox 10 Data Word 1 [31:16] Register */
1196#define CAN_MB10_DATA2 0xFFC02D48 /* Mailbox 10 Data Word 2 [47:32] Register */
1197#define CAN_MB10_DATA3 0xFFC02D4C /* Mailbox 10 Data Word 3 [63:48] Register */
1198#define CAN_MB10_LENGTH 0xFFC02D50 /* Mailbox 10 Data Length Code Register */
1199#define CAN_MB10_TIMESTAMP 0xFFC02D54 /* Mailbox 10 Time Stamp Value Register */
1200#define CAN_MB10_ID0 0xFFC02D58 /* Mailbox 10 Identifier Low Register */
1201#define CAN_MB10_ID1 0xFFC02D5C /* Mailbox 10 Identifier High Register */
1202
1203#define CAN_MB11_DATA0 0xFFC02D60 /* Mailbox 11 Data Word 0 [15:0] Register */
1204#define CAN_MB11_DATA1 0xFFC02D64 /* Mailbox 11 Data Word 1 [31:16] Register */
1205#define CAN_MB11_DATA2 0xFFC02D68 /* Mailbox 11 Data Word 2 [47:32] Register */
1206#define CAN_MB11_DATA3 0xFFC02D6C /* Mailbox 11 Data Word 3 [63:48] Register */
1207#define CAN_MB11_LENGTH 0xFFC02D70 /* Mailbox 11 Data Length Code Register */
1208#define CAN_MB11_TIMESTAMP 0xFFC02D74 /* Mailbox 11 Time Stamp Value Register */
1209#define CAN_MB11_ID0 0xFFC02D78 /* Mailbox 11 Identifier Low Register */
1210#define CAN_MB11_ID1 0xFFC02D7C /* Mailbox 11 Identifier High Register */
1211
1212#define CAN_MB12_DATA0 0xFFC02D80 /* Mailbox 12 Data Word 0 [15:0] Register */
1213#define CAN_MB12_DATA1 0xFFC02D84 /* Mailbox 12 Data Word 1 [31:16] Register */
1214#define CAN_MB12_DATA2 0xFFC02D88 /* Mailbox 12 Data Word 2 [47:32] Register */
1215#define CAN_MB12_DATA3 0xFFC02D8C /* Mailbox 12 Data Word 3 [63:48] Register */
1216#define CAN_MB12_LENGTH 0xFFC02D90 /* Mailbox 12 Data Length Code Register */
1217#define CAN_MB12_TIMESTAMP 0xFFC02D94 /* Mailbox 12 Time Stamp Value Register */
1218#define CAN_MB12_ID0 0xFFC02D98 /* Mailbox 12 Identifier Low Register */
1219#define CAN_MB12_ID1 0xFFC02D9C /* Mailbox 12 Identifier High Register */
1220
1221#define CAN_MB13_DATA0 0xFFC02DA0 /* Mailbox 13 Data Word 0 [15:0] Register */
1222#define CAN_MB13_DATA1 0xFFC02DA4 /* Mailbox 13 Data Word 1 [31:16] Register */
1223#define CAN_MB13_DATA2 0xFFC02DA8 /* Mailbox 13 Data Word 2 [47:32] Register */
1224#define CAN_MB13_DATA3 0xFFC02DAC /* Mailbox 13 Data Word 3 [63:48] Register */
1225#define CAN_MB13_LENGTH 0xFFC02DB0 /* Mailbox 13 Data Length Code Register */
1226#define CAN_MB13_TIMESTAMP 0xFFC02DB4 /* Mailbox 13 Time Stamp Value Register */
1227#define CAN_MB13_ID0 0xFFC02DB8 /* Mailbox 13 Identifier Low Register */
1228#define CAN_MB13_ID1 0xFFC02DBC /* Mailbox 13 Identifier High Register */
1229
1230#define CAN_MB14_DATA0 0xFFC02DC0 /* Mailbox 14 Data Word 0 [15:0] Register */
1231#define CAN_MB14_DATA1 0xFFC02DC4 /* Mailbox 14 Data Word 1 [31:16] Register */
1232#define CAN_MB14_DATA2 0xFFC02DC8 /* Mailbox 14 Data Word 2 [47:32] Register */
1233#define CAN_MB14_DATA3 0xFFC02DCC /* Mailbox 14 Data Word 3 [63:48] Register */
1234#define CAN_MB14_LENGTH 0xFFC02DD0 /* Mailbox 14 Data Length Code Register */
1235#define CAN_MB14_TIMESTAMP 0xFFC02DD4 /* Mailbox 14 Time Stamp Value Register */
1236#define CAN_MB14_ID0 0xFFC02DD8 /* Mailbox 14 Identifier Low Register */
1237#define CAN_MB14_ID1 0xFFC02DDC /* Mailbox 14 Identifier High Register */
1238
1239#define CAN_MB15_DATA0 0xFFC02DE0 /* Mailbox 15 Data Word 0 [15:0] Register */
1240#define CAN_MB15_DATA1 0xFFC02DE4 /* Mailbox 15 Data Word 1 [31:16] Register */
1241#define CAN_MB15_DATA2 0xFFC02DE8 /* Mailbox 15 Data Word 2 [47:32] Register */
1242#define CAN_MB15_DATA3 0xFFC02DEC /* Mailbox 15 Data Word 3 [63:48] Register */
1243#define CAN_MB15_LENGTH 0xFFC02DF0 /* Mailbox 15 Data Length Code Register */
1244#define CAN_MB15_TIMESTAMP 0xFFC02DF4 /* Mailbox 15 Time Stamp Value Register */
1245#define CAN_MB15_ID0 0xFFC02DF8 /* Mailbox 15 Identifier Low Register */
1246#define CAN_MB15_ID1 0xFFC02DFC /* Mailbox 15 Identifier High Register */
1247
1248#define CAN_MB16_DATA0 0xFFC02E00 /* Mailbox 16 Data Word 0 [15:0] Register */
1249#define CAN_MB16_DATA1 0xFFC02E04 /* Mailbox 16 Data Word 1 [31:16] Register */
1250#define CAN_MB16_DATA2 0xFFC02E08 /* Mailbox 16 Data Word 2 [47:32] Register */
1251#define CAN_MB16_DATA3 0xFFC02E0C /* Mailbox 16 Data Word 3 [63:48] Register */
1252#define CAN_MB16_LENGTH 0xFFC02E10 /* Mailbox 16 Data Length Code Register */
1253#define CAN_MB16_TIMESTAMP 0xFFC02E14 /* Mailbox 16 Time Stamp Value Register */
1254#define CAN_MB16_ID0 0xFFC02E18 /* Mailbox 16 Identifier Low Register */
1255#define CAN_MB16_ID1 0xFFC02E1C /* Mailbox 16 Identifier High Register */
1256
1257#define CAN_MB17_DATA0 0xFFC02E20 /* Mailbox 17 Data Word 0 [15:0] Register */
1258#define CAN_MB17_DATA1 0xFFC02E24 /* Mailbox 17 Data Word 1 [31:16] Register */
1259#define CAN_MB17_DATA2 0xFFC02E28 /* Mailbox 17 Data Word 2 [47:32] Register */
1260#define CAN_MB17_DATA3 0xFFC02E2C /* Mailbox 17 Data Word 3 [63:48] Register */
1261#define CAN_MB17_LENGTH 0xFFC02E30 /* Mailbox 17 Data Length Code Register */
1262#define CAN_MB17_TIMESTAMP 0xFFC02E34 /* Mailbox 17 Time Stamp Value Register */
1263#define CAN_MB17_ID0 0xFFC02E38 /* Mailbox 17 Identifier Low Register */
1264#define CAN_MB17_ID1 0xFFC02E3C /* Mailbox 17 Identifier High Register */
1265
1266#define CAN_MB18_DATA0 0xFFC02E40 /* Mailbox 18 Data Word 0 [15:0] Register */
1267#define CAN_MB18_DATA1 0xFFC02E44 /* Mailbox 18 Data Word 1 [31:16] Register */
1268#define CAN_MB18_DATA2 0xFFC02E48 /* Mailbox 18 Data Word 2 [47:32] Register */
1269#define CAN_MB18_DATA3 0xFFC02E4C /* Mailbox 18 Data Word 3 [63:48] Register */
1270#define CAN_MB18_LENGTH 0xFFC02E50 /* Mailbox 18 Data Length Code Register */
1271#define CAN_MB18_TIMESTAMP 0xFFC02E54 /* Mailbox 18 Time Stamp Value Register */
1272#define CAN_MB18_ID0 0xFFC02E58 /* Mailbox 18 Identifier Low Register */
1273#define CAN_MB18_ID1 0xFFC02E5C /* Mailbox 18 Identifier High Register */
1274
1275#define CAN_MB19_DATA0 0xFFC02E60 /* Mailbox 19 Data Word 0 [15:0] Register */
1276#define CAN_MB19_DATA1 0xFFC02E64 /* Mailbox 19 Data Word 1 [31:16] Register */
1277#define CAN_MB19_DATA2 0xFFC02E68 /* Mailbox 19 Data Word 2 [47:32] Register */
1278#define CAN_MB19_DATA3 0xFFC02E6C /* Mailbox 19 Data Word 3 [63:48] Register */
1279#define CAN_MB19_LENGTH 0xFFC02E70 /* Mailbox 19 Data Length Code Register */
1280#define CAN_MB19_TIMESTAMP 0xFFC02E74 /* Mailbox 19 Time Stamp Value Register */
1281#define CAN_MB19_ID0 0xFFC02E78 /* Mailbox 19 Identifier Low Register */
1282#define CAN_MB19_ID1 0xFFC02E7C /* Mailbox 19 Identifier High Register */
1283
1284#define CAN_MB20_DATA0 0xFFC02E80 /* Mailbox 20 Data Word 0 [15:0] Register */
1285#define CAN_MB20_DATA1 0xFFC02E84 /* Mailbox 20 Data Word 1 [31:16] Register */
1286#define CAN_MB20_DATA2 0xFFC02E88 /* Mailbox 20 Data Word 2 [47:32] Register */
1287#define CAN_MB20_DATA3 0xFFC02E8C /* Mailbox 20 Data Word 3 [63:48] Register */
1288#define CAN_MB20_LENGTH 0xFFC02E90 /* Mailbox 20 Data Length Code Register */
1289#define CAN_MB20_TIMESTAMP 0xFFC02E94 /* Mailbox 20 Time Stamp Value Register */
1290#define CAN_MB20_ID0 0xFFC02E98 /* Mailbox 20 Identifier Low Register */
1291#define CAN_MB20_ID1 0xFFC02E9C /* Mailbox 20 Identifier High Register */
1292
1293#define CAN_MB21_DATA0 0xFFC02EA0 /* Mailbox 21 Data Word 0 [15:0] Register */
1294#define CAN_MB21_DATA1 0xFFC02EA4 /* Mailbox 21 Data Word 1 [31:16] Register */
1295#define CAN_MB21_DATA2 0xFFC02EA8 /* Mailbox 21 Data Word 2 [47:32] Register */
1296#define CAN_MB21_DATA3 0xFFC02EAC /* Mailbox 21 Data Word 3 [63:48] Register */
1297#define CAN_MB21_LENGTH 0xFFC02EB0 /* Mailbox 21 Data Length Code Register */
1298#define CAN_MB21_TIMESTAMP 0xFFC02EB4 /* Mailbox 21 Time Stamp Value Register */
1299#define CAN_MB21_ID0 0xFFC02EB8 /* Mailbox 21 Identifier Low Register */
1300#define CAN_MB21_ID1 0xFFC02EBC /* Mailbox 21 Identifier High Register */
1301
1302#define CAN_MB22_DATA0 0xFFC02EC0 /* Mailbox 22 Data Word 0 [15:0] Register */
1303#define CAN_MB22_DATA1 0xFFC02EC4 /* Mailbox 22 Data Word 1 [31:16] Register */
1304#define CAN_MB22_DATA2 0xFFC02EC8 /* Mailbox 22 Data Word 2 [47:32] Register */
1305#define CAN_MB22_DATA3 0xFFC02ECC /* Mailbox 22 Data Word 3 [63:48] Register */
1306#define CAN_MB22_LENGTH 0xFFC02ED0 /* Mailbox 22 Data Length Code Register */
1307#define CAN_MB22_TIMESTAMP 0xFFC02ED4 /* Mailbox 22 Time Stamp Value Register */
1308#define CAN_MB22_ID0 0xFFC02ED8 /* Mailbox 22 Identifier Low Register */
1309#define CAN_MB22_ID1 0xFFC02EDC /* Mailbox 22 Identifier High Register */
1310
1311#define CAN_MB23_DATA0 0xFFC02EE0 /* Mailbox 23 Data Word 0 [15:0] Register */
1312#define CAN_MB23_DATA1 0xFFC02EE4 /* Mailbox 23 Data Word 1 [31:16] Register */
1313#define CAN_MB23_DATA2 0xFFC02EE8 /* Mailbox 23 Data Word 2 [47:32] Register */
1314#define CAN_MB23_DATA3 0xFFC02EEC /* Mailbox 23 Data Word 3 [63:48] Register */
1315#define CAN_MB23_LENGTH 0xFFC02EF0 /* Mailbox 23 Data Length Code Register */
1316#define CAN_MB23_TIMESTAMP 0xFFC02EF4 /* Mailbox 23 Time Stamp Value Register */
1317#define CAN_MB23_ID0 0xFFC02EF8 /* Mailbox 23 Identifier Low Register */
1318#define CAN_MB23_ID1 0xFFC02EFC /* Mailbox 23 Identifier High Register */
1319
1320#define CAN_MB24_DATA0 0xFFC02F00 /* Mailbox 24 Data Word 0 [15:0] Register */
1321#define CAN_MB24_DATA1 0xFFC02F04 /* Mailbox 24 Data Word 1 [31:16] Register */
1322#define CAN_MB24_DATA2 0xFFC02F08 /* Mailbox 24 Data Word 2 [47:32] Register */
1323#define CAN_MB24_DATA3 0xFFC02F0C /* Mailbox 24 Data Word 3 [63:48] Register */
1324#define CAN_MB24_LENGTH 0xFFC02F10 /* Mailbox 24 Data Length Code Register */
1325#define CAN_MB24_TIMESTAMP 0xFFC02F14 /* Mailbox 24 Time Stamp Value Register */
1326#define CAN_MB24_ID0 0xFFC02F18 /* Mailbox 24 Identifier Low Register */
1327#define CAN_MB24_ID1 0xFFC02F1C /* Mailbox 24 Identifier High Register */
1328
1329#define CAN_MB25_DATA0 0xFFC02F20 /* Mailbox 25 Data Word 0 [15:0] Register */
1330#define CAN_MB25_DATA1 0xFFC02F24 /* Mailbox 25 Data Word 1 [31:16] Register */
1331#define CAN_MB25_DATA2 0xFFC02F28 /* Mailbox 25 Data Word 2 [47:32] Register */
1332#define CAN_MB25_DATA3 0xFFC02F2C /* Mailbox 25 Data Word 3 [63:48] Register */
1333#define CAN_MB25_LENGTH 0xFFC02F30 /* Mailbox 25 Data Length Code Register */
1334#define CAN_MB25_TIMESTAMP 0xFFC02F34 /* Mailbox 25 Time Stamp Value Register */
1335#define CAN_MB25_ID0 0xFFC02F38 /* Mailbox 25 Identifier Low Register */
1336#define CAN_MB25_ID1 0xFFC02F3C /* Mailbox 25 Identifier High Register */
1337
1338#define CAN_MB26_DATA0 0xFFC02F40 /* Mailbox 26 Data Word 0 [15:0] Register */
1339#define CAN_MB26_DATA1 0xFFC02F44 /* Mailbox 26 Data Word 1 [31:16] Register */
1340#define CAN_MB26_DATA2 0xFFC02F48 /* Mailbox 26 Data Word 2 [47:32] Register */
1341#define CAN_MB26_DATA3 0xFFC02F4C /* Mailbox 26 Data Word 3 [63:48] Register */
1342#define CAN_MB26_LENGTH 0xFFC02F50 /* Mailbox 26 Data Length Code Register */
1343#define CAN_MB26_TIMESTAMP 0xFFC02F54 /* Mailbox 26 Time Stamp Value Register */
1344#define CAN_MB26_ID0 0xFFC02F58 /* Mailbox 26 Identifier Low Register */
1345#define CAN_MB26_ID1 0xFFC02F5C /* Mailbox 26 Identifier High Register */
1346
1347#define CAN_MB27_DATA0 0xFFC02F60 /* Mailbox 27 Data Word 0 [15:0] Register */
1348#define CAN_MB27_DATA1 0xFFC02F64 /* Mailbox 27 Data Word 1 [31:16] Register */
1349#define CAN_MB27_DATA2 0xFFC02F68 /* Mailbox 27 Data Word 2 [47:32] Register */
1350#define CAN_MB27_DATA3 0xFFC02F6C /* Mailbox 27 Data Word 3 [63:48] Register */
1351#define CAN_MB27_LENGTH 0xFFC02F70 /* Mailbox 27 Data Length Code Register */
1352#define CAN_MB27_TIMESTAMP 0xFFC02F74 /* Mailbox 27 Time Stamp Value Register */
1353#define CAN_MB27_ID0 0xFFC02F78 /* Mailbox 27 Identifier Low Register */
1354#define CAN_MB27_ID1 0xFFC02F7C /* Mailbox 27 Identifier High Register */
1355
1356#define CAN_MB28_DATA0 0xFFC02F80 /* Mailbox 28 Data Word 0 [15:0] Register */
1357#define CAN_MB28_DATA1 0xFFC02F84 /* Mailbox 28 Data Word 1 [31:16] Register */
1358#define CAN_MB28_DATA2 0xFFC02F88 /* Mailbox 28 Data Word 2 [47:32] Register */
1359#define CAN_MB28_DATA3 0xFFC02F8C /* Mailbox 28 Data Word 3 [63:48] Register */
1360#define CAN_MB28_LENGTH 0xFFC02F90 /* Mailbox 28 Data Length Code Register */
1361#define CAN_MB28_TIMESTAMP 0xFFC02F94 /* Mailbox 28 Time Stamp Value Register */
1362#define CAN_MB28_ID0 0xFFC02F98 /* Mailbox 28 Identifier Low Register */
1363#define CAN_MB28_ID1 0xFFC02F9C /* Mailbox 28 Identifier High Register */
1364
1365#define CAN_MB29_DATA0 0xFFC02FA0 /* Mailbox 29 Data Word 0 [15:0] Register */
1366#define CAN_MB29_DATA1 0xFFC02FA4 /* Mailbox 29 Data Word 1 [31:16] Register */
1367#define CAN_MB29_DATA2 0xFFC02FA8 /* Mailbox 29 Data Word 2 [47:32] Register */
1368#define CAN_MB29_DATA3 0xFFC02FAC /* Mailbox 29 Data Word 3 [63:48] Register */
1369#define CAN_MB29_LENGTH 0xFFC02FB0 /* Mailbox 29 Data Length Code Register */
1370#define CAN_MB29_TIMESTAMP 0xFFC02FB4 /* Mailbox 29 Time Stamp Value Register */
1371#define CAN_MB29_ID0 0xFFC02FB8 /* Mailbox 29 Identifier Low Register */
1372#define CAN_MB29_ID1 0xFFC02FBC /* Mailbox 29 Identifier High Register */
1373
1374#define CAN_MB30_DATA0 0xFFC02FC0 /* Mailbox 30 Data Word 0 [15:0] Register */
1375#define CAN_MB30_DATA1 0xFFC02FC4 /* Mailbox 30 Data Word 1 [31:16] Register */
1376#define CAN_MB30_DATA2 0xFFC02FC8 /* Mailbox 30 Data Word 2 [47:32] Register */
1377#define CAN_MB30_DATA3 0xFFC02FCC /* Mailbox 30 Data Word 3 [63:48] Register */
1378#define CAN_MB30_LENGTH 0xFFC02FD0 /* Mailbox 30 Data Length Code Register */
1379#define CAN_MB30_TIMESTAMP 0xFFC02FD4 /* Mailbox 30 Time Stamp Value Register */
1380#define CAN_MB30_ID0 0xFFC02FD8 /* Mailbox 30 Identifier Low Register */
1381#define CAN_MB30_ID1 0xFFC02FDC /* Mailbox 30 Identifier High Register */
1382
1383#define CAN_MB31_DATA0 0xFFC02FE0 /* Mailbox 31 Data Word 0 [15:0] Register */
1384#define CAN_MB31_DATA1 0xFFC02FE4 /* Mailbox 31 Data Word 1 [31:16] Register */
1385#define CAN_MB31_DATA2 0xFFC02FE8 /* Mailbox 31 Data Word 2 [47:32] Register */
1386#define CAN_MB31_DATA3 0xFFC02FEC /* Mailbox 31 Data Word 3 [63:48] Register */
1387#define CAN_MB31_LENGTH 0xFFC02FF0 /* Mailbox 31 Data Length Code Register */
1388#define CAN_MB31_TIMESTAMP 0xFFC02FF4 /* Mailbox 31 Time Stamp Value Register */
1389#define CAN_MB31_ID0 0xFFC02FF8 /* Mailbox 31 Identifier Low Register */
1390#define CAN_MB31_ID1 0xFFC02FFC /* Mailbox 31 Identifier High Register */
1391
1392/* CAN Mailbox Area Macros */
1393#define CAN_MB_ID1(x) (CAN_MB00_ID1+((x)*0x20))
1394#define CAN_MB_ID0(x) (CAN_MB00_ID0+((x)*0x20))
1395#define CAN_MB_TIMESTAMP(x) (CAN_MB00_TIMESTAMP+((x)*0x20))
1396#define CAN_MB_LENGTH(x) (CAN_MB00_LENGTH+((x)*0x20))
1397#define CAN_MB_DATA3(x) (CAN_MB00_DATA3+((x)*0x20))
1398#define CAN_MB_DATA2(x) (CAN_MB00_DATA2+((x)*0x20))
1399#define CAN_MB_DATA1(x) (CAN_MB00_DATA1+((x)*0x20))
1400#define CAN_MB_DATA0(x) (CAN_MB00_DATA0+((x)*0x20))
1401
1402
1403/*********************************************************************************** */
1404/* System MMR Register Bits and Macros */
1405/******************************************************************************* */
1406
1407/* ********************* PLL AND RESET MASKS ************************ */
1408/* PLL_CTL Masks */
1409#define PLL_CLKIN 0x0000 /* Pass CLKIN to PLL */
1410#define PLL_CLKIN_DIV2 0x0001 /* Pass CLKIN/2 to PLL */
1411#define DF 0x0001 /* 0: PLL = CLKIN, 1: PLL = CLKIN/2 */
1412#define PLL_OFF 0x0002 /* Shut off PLL clocks */
1413
1414#define STOPCK 0x0008 /* Core Clock Off */
1415#define PDWN 0x0020 /* Put the PLL in a Deep Sleep state */
1416#define IN_DELAY 0x0014 /* EBIU Input Delay Select */
1417#define OUT_DELAY 0x00C0 /* EBIU Output Delay Select */
1418#define BYPASS 0x0100 /* Bypass the PLL */
1419#define MSEL 0x7E00 /* Multiplier Select For CCLK/VCO Factors */
1420
1421/* PLL_CTL Macros */
1422#ifdef _MISRA_RULES
1423#define SET_MSEL(x) (((x)&0x3Fu) << 0x9) /* Set MSEL = 0-63 --> VCO = CLKIN*MSEL */
1424#define SET_OUT_DELAY(x) (((x)&0x03u) << 0x6)
1425#define SET_IN_DELAY(x) ((((x)&0x02u) << 0x3) | (((x)&0x01u) << 0x2))
1426#else
1427#define SET_MSEL(x) (((x)&0x3F) << 0x9) /* Set MSEL = 0-63 --> VCO = CLKIN*MSEL */
1428#define SET_OUT_DELAY(x) (((x)&0x03) << 0x6)
1429#define SET_IN_DELAY(x) ((((x)&0x02) << 0x3) | (((x)&0x01) << 0x2))
1430#endif /* _MISRA_RULES */
1431
1432/* PLL_DIV Masks */
1433#define SSEL 0x000F /* System Select */
1434#define CSEL 0x0030 /* Core Select */
1435#define CSEL_DIV1 0x0000 /* CCLK = VCO / 1 */
1436#define CSEL_DIV2 0x0010 /* CCLK = VCO / 2 */
1437#define CSEL_DIV4 0x0020 /* CCLK = VCO / 4 */
1438#define CSEL_DIV8 0x0030 /* CCLK = VCO / 8 */
1439
1440#define SCLK_DIV(x) (x) /* SCLK = VCO / x */
1441
1442/* PLL_DIV Macros */
1443#ifdef _MISRA_RULES
1444#define SET_SSEL(x) ((x)&0xFu) /* Set SSEL = 0-15 --> SCLK = VCO/SSEL */
1445#else
1446#define SET_SSEL(x) ((x)&0xF) /* Set SSEL = 0-15 --> SCLK = VCO/SSEL */
1447#endif /* _MISRA_RULES */
1448
1449/* PLL_STAT Masks */
1450#define ACTIVE_PLLENABLED 0x0001 /* Processor In Active Mode With PLL Enabled */
1451#define FULL_ON 0x0002 /* Processor In Full On Mode */
1452#define ACTIVE_PLLDISABLED 0x0004 /* Processor In Active Mode With PLL Disabled */
1453#define PLL_LOCKED 0x0020 /* PLL_LOCKCNT Has Been Reached */
1454
1455/* VR_CTL Masks */
1456#define FREQ 0x0003 /* Switching Oscillator Frequency For Regulator */
1457#define HIBERNATE 0x0000 /* Powerdown/Bypass On-Board Regulation */
1458#define FREQ_333 0x0001 /* Switching Frequency Is 333 kHz */
1459#define FREQ_667 0x0002 /* Switching Frequency Is 667 kHz */
1460#define FREQ_1000 0x0003 /* Switching Frequency Is 1 MHz */
1461
1462#define GAIN 0x000C /* Voltage Level Gain */
1463#define GAIN_5 0x0000 /* GAIN = 5 */
1464#define GAIN_10 0x0004 /* GAIN = 10 */
1465#define GAIN_20 0x0008 /* GAIN = 20 */
1466#define GAIN_50 0x000C /* GAIN = 50 */
1467
1468#define VLEV 0x00F0 /* Internal Voltage Level - Only Program Values Within Specifications */
1469#define VLEV_100 0x0090 /* VLEV = 1.00 V (See Datasheet for Regulator Tolerance) */
1470#define VLEV_105 0x00A0 /* VLEV = 1.05 V (See Datasheet for Regulator Tolerance) */
1471#define VLEV_110 0x00B0 /* VLEV = 1.10 V (See Datasheet for Regulator Tolerance) */
1472#define VLEV_115 0x00C0 /* VLEV = 1.15 V (See Datasheet for Regulator Tolerance) */
1473#define VLEV_120 0x00D0 /* VLEV = 1.20 V (See Datasheet for Regulator Tolerance) */
1474#define VLEV_125 0x00E0 /* VLEV = 1.25 V (See Datasheet for Regulator Tolerance) */
1475#define VLEV_130 0x00F0 /* VLEV = 1.30 V (See Datasheet for Regulator Tolerance) */
1476
1477#define WAKE 0x0100 /* Enable RTC/Reset Wakeup From Hibernate */
1478#define CANWE 0x0200 /* Enable CAN Wakeup From Hibernate */
1479#define MXVRWE 0x0400 /* Enable MXVR Wakeup From Hibernate */
1480#define SCKELOW 0x8000 /* Do Not Drive SCKE High During Reset After Hibernate */
1481
1482/* SWRST Mask */
1483#define SYSTEM_RESET 0x0007 /* Initiates A System Software Reset */
1484#define DOUBLE_FAULT 0x0008 /* Core Double Fault Causes Reset */
1485#define RESET_DOUBLE 0x2000 /* SW Reset Generated By Core Double-Fault */
1486#define RESET_WDOG 0x4000 /* SW Reset Generated By Watchdog Timer */
1487#define RESET_SOFTWARE 0x8000 /* SW Reset Occurred Since Last Read Of SWRST */
1488
1489/* SYSCR Masks */
1490#define BMODE 0x0006 /* Boot Mode - Latched During HW Reset From Mode Pins */
1491#define NOBOOT 0x0010 /* Execute From L1 or ASYNC Bank 0 When BMODE = 0 */
1492
1493
1494/* ************* SYSTEM INTERRUPT CONTROLLER MASKS ***************** */
1495
1496/* Peripheral Masks For SIC0_ISR, SIC0_IWR, SIC0_IMASK */
1497#define PLL_WAKEUP_IRQ 0x00000001 /* PLL Wakeup Interrupt Request */
1498#define DMAC0_ERR_IRQ 0x00000002 /* DMA Controller 0 Error Interrupt Request */
1499#define PPI_ERR_IRQ 0x00000004 /* PPI Error Interrupt Request */
1500#define SPORT0_ERR_IRQ 0x00000008 /* SPORT0 Error Interrupt Request */
1501#define SPORT1_ERR_IRQ 0x00000010 /* SPORT1 Error Interrupt Request */
1502#define SPI0_ERR_IRQ 0x00000020 /* SPI0 Error Interrupt Request */
1503#define UART0_ERR_IRQ 0x00000040 /* UART0 Error Interrupt Request */
1504#define RTC_IRQ 0x00000080 /* Real-Time Clock Interrupt Request */
1505#define DMA0_IRQ 0x00000100 /* DMA Channel 0 (PPI) Interrupt Request */
1506#define DMA1_IRQ 0x00000200 /* DMA Channel 1 (SPORT0 RX) Interrupt Request */
1507#define DMA2_IRQ 0x00000400 /* DMA Channel 2 (SPORT0 TX) Interrupt Request */
1508#define DMA3_IRQ 0x00000800 /* DMA Channel 3 (SPORT1 RX) Interrupt Request */
1509#define DMA4_IRQ 0x00001000 /* DMA Channel 4 (SPORT1 TX) Interrupt Request */
1510#define DMA5_IRQ 0x00002000 /* DMA Channel 5 (SPI) Interrupt Request */
1511#define DMA6_IRQ 0x00004000 /* DMA Channel 6 (UART RX) Interrupt Request */
1512#define DMA7_IRQ 0x00008000 /* DMA Channel 7 (UART TX) Interrupt Request */
1513#define TIMER0_IRQ 0x00010000 /* Timer 0 Interrupt Request */
1514#define TIMER1_IRQ 0x00020000 /* Timer 1 Interrupt Request */
1515#define TIMER2_IRQ 0x00040000 /* Timer 2 Interrupt Request */
1516#define PFA_IRQ 0x00080000 /* Programmable Flag Interrupt Request A */
1517#define PFB_IRQ 0x00100000 /* Programmable Flag Interrupt Request B */
1518#define MDMA0_0_IRQ 0x00200000 /* MemDMA0 Stream 0 Interrupt Request */
1519#define MDMA0_1_IRQ 0x00400000 /* MemDMA0 Stream 1 Interrupt Request */
1520#define WDOG_IRQ 0x00800000 /* Software Watchdog Timer Interrupt Request */
1521#define DMAC1_ERR_IRQ 0x01000000 /* DMA Controller 1 Error Interrupt Request */
1522#define SPORT2_ERR_IRQ 0x02000000 /* SPORT2 Error Interrupt Request */
1523#define SPORT3_ERR_IRQ 0x04000000 /* SPORT3 Error Interrupt Request */
1524#define MXVR_SD_IRQ 0x08000000 /* MXVR Synchronous Data Interrupt Request */
1525#define SPI1_ERR_IRQ 0x10000000 /* SPI1 Error Interrupt Request */
1526#define SPI2_ERR_IRQ 0x20000000 /* SPI2 Error Interrupt Request */
1527#define UART1_ERR_IRQ 0x40000000 /* UART1 Error Interrupt Request */
1528#define UART2_ERR_IRQ 0x80000000 /* UART2 Error Interrupt Request */
1529
1530/* the following are for backwards compatibility */
1531#define DMA0_ERR_IRQ DMAC0_ERR_IRQ
1532#define DMA1_ERR_IRQ DMAC1_ERR_IRQ
1533
1534
1535/* Peripheral Masks For SIC_ISR1, SIC_IWR1, SIC_IMASK1 */
1536#define CAN_ERR_IRQ 0x00000001 /* CAN Error Interrupt Request */
1537#define DMA8_IRQ 0x00000002 /* DMA Channel 8 (SPORT2 RX) Interrupt Request */
1538#define DMA9_IRQ 0x00000004 /* DMA Channel 9 (SPORT2 TX) Interrupt Request */
1539#define DMA10_IRQ 0x00000008 /* DMA Channel 10 (SPORT3 RX) Interrupt Request */
1540#define DMA11_IRQ 0x00000010 /* DMA Channel 11 (SPORT3 TX) Interrupt Request */
1541#define DMA12_IRQ 0x00000020 /* DMA Channel 12 Interrupt Request */
1542#define DMA13_IRQ 0x00000040 /* DMA Channel 13 Interrupt Request */
1543#define DMA14_IRQ 0x00000080 /* DMA Channel 14 (SPI1) Interrupt Request */
1544#define DMA15_IRQ 0x00000100 /* DMA Channel 15 (SPI2) Interrupt Request */
1545#define DMA16_IRQ 0x00000200 /* DMA Channel 16 (UART1 RX) Interrupt Request */
1546#define DMA17_IRQ 0x00000400 /* DMA Channel 17 (UART1 TX) Interrupt Request */
1547#define DMA18_IRQ 0x00000800 /* DMA Channel 18 (UART2 RX) Interrupt Request */
1548#define DMA19_IRQ 0x00001000 /* DMA Channel 19 (UART2 TX) Interrupt Request */
1549#define TWI0_IRQ 0x00002000 /* TWI0 Interrupt Request */
1550#define TWI1_IRQ 0x00004000 /* TWI1 Interrupt Request */
1551#define CAN_RX_IRQ 0x00008000 /* CAN Receive Interrupt Request */
1552#define CAN_TX_IRQ 0x00010000 /* CAN Transmit Interrupt Request */
1553#define MDMA1_0_IRQ 0x00020000 /* MemDMA1 Stream 0 Interrupt Request */
1554#define MDMA1_1_IRQ 0x00040000 /* MemDMA1 Stream 1 Interrupt Request */
1555#define MXVR_STAT_IRQ 0x00080000 /* MXVR Status Interrupt Request */
1556#define MXVR_CM_IRQ 0x00100000 /* MXVR Control Message Interrupt Request */
1557#define MXVR_AP_IRQ 0x00200000 /* MXVR Asynchronous Packet Interrupt */
1558
1559/* the following are for backwards compatibility */
1560#define MDMA0_IRQ MDMA1_0_IRQ
1561#define MDMA1_IRQ MDMA1_1_IRQ
1562
1563#ifdef _MISRA_RULES
1564#define _MF15 0xFu
1565#define _MF7 7u
1566#else
1567#define _MF15 0xF
1568#define _MF7 7
1569#endif /* _MISRA_RULES */
1570
1571/* SIC_IMASKx Masks */
1572#define SIC_UNMASK_ALL 0x00000000 /* Unmask all peripheral interrupts */
1573#define SIC_MASK_ALL 0xFFFFFFFF /* Mask all peripheral interrupts */
1574#ifdef _MISRA_RULES
1575#define SIC_MASK(x) (1 << ((x)&0x1Fu)) /* Mask Peripheral #x interrupt */
1576#define SIC_UNMASK(x) (0xFFFFFFFFu ^ (1 << ((x)&0x1Fu))) /* Unmask Peripheral #x interrupt */
1577#else
1578#define SIC_MASK(x) (1 << ((x)&0x1F)) /* Mask Peripheral #x interrupt */
1579#define SIC_UNMASK(x) (0xFFFFFFFF ^ (1 << ((x)&0x1F))) /* Unmask Peripheral #x interrupt */
1580#endif /* _MISRA_RULES */
1581
1582/* SIC_IWRx Masks */
1583#define IWR_DISABLE_ALL 0x00000000 /* Wakeup Disable all peripherals */
1584#define IWR_ENABLE_ALL 0xFFFFFFFF /* Wakeup Enable all peripherals */
1585#ifdef _MISRA_RULES
1586#define IWR_ENABLE(x) (1 << ((x)&0x1Fu)) /* Wakeup Enable Peripheral #x */
1587#define IWR_DISABLE(x) (0xFFFFFFFFu ^ (1 << ((x)&0x1Fu))) /* Wakeup Disable Peripheral #x */
1588#else
1589#define IWR_ENABLE(x) (1 << ((x)&0x1F)) /* Wakeup Enable Peripheral #x */
1590#define IWR_DISABLE(x) (0xFFFFFFFF ^ (1 << ((x)&0x1F))) /* Wakeup Disable Peripheral #x */
1591#endif /* _MISRA_RULES */
1592
1593
1594/* ********* WATCHDOG TIMER MASKS ******************** */
1595/* Watchdog Timer WDOG_CTL Register Masks */
1596#ifdef _MISRA_RULES
1597#define WDEV(x) (((x)<<1) & 0x0006u) /* event generated on roll over */
1598#else
1599#define WDEV(x) (((x)<<1) & 0x0006) /* event generated on roll over */
1600#endif /* _MISRA_RULES */
1601#define WDEV_RESET 0x0000 /* generate reset event on roll over */
1602#define WDEV_NMI 0x0002 /* generate NMI event on roll over */
1603#define WDEV_GPI 0x0004 /* generate GP IRQ on roll over */
1604#define WDEV_NONE 0x0006 /* no event on roll over */
1605#define WDEN 0x0FF0 /* enable watchdog */
1606#define WDDIS 0x0AD0 /* disable watchdog */
1607#define WDRO 0x8000 /* watchdog rolled over latch */
1608
1609/* deprecated WDOG_CTL Register Masks for legacy code */
1610#define ICTL WDEV
1611#define ENABLE_RESET WDEV_RESET
1612#define WDOG_RESET WDEV_RESET
1613#define ENABLE_NMI WDEV_NMI
1614#define WDOG_NMI WDEV_NMI
1615#define ENABLE_GPI WDEV_GPI
1616#define WDOG_GPI WDEV_GPI
1617#define DISABLE_EVT WDEV_NONE
1618#define WDOG_NONE WDEV_NONE
1619
1620#define TMR_EN WDEN
1621#define WDOG_DISABLE WDDIS
1622#define TRO WDRO
1623
1624#define ICTL_P0 0x01
1625#define ICTL_P1 0x02
1626#define TRO_P 0x0F
1627
1628
1629/* *************** REAL TIME CLOCK MASKS **************************/
1630/* RTC_STAT and RTC_ALARM register */
1631#define RTSEC 0x0000003F /* Real-Time Clock Seconds */
1632#define RTMIN 0x00000FC0 /* Real-Time Clock Minutes */
1633#define RTHR 0x0001F000 /* Real-Time Clock Hours */
1634#define RTDAY 0xFFFE0000 /* Real-Time Clock Days */
1635
1636/* RTC_ICTL register */
1637#define SWIE 0x0001 /* Stopwatch Interrupt Enable */
1638#define AIE 0x0002 /* Alarm Interrupt Enable */
1639#define SIE 0x0004 /* Seconds (1 Hz) Interrupt Enable */
1640#define MIE 0x0008 /* Minutes Interrupt Enable */
1641#define HIE 0x0010 /* Hours Interrupt Enable */
1642#define DIE 0x0020 /* 24 Hours (Days) Interrupt Enable */
1643#define DAIE 0x0040 /* Day Alarm (Day, Hour, Minute, Second) Interrupt Enable */
1644#define WCIE 0x8000 /* Write Complete Interrupt Enable */
1645
1646/* RTC_ISTAT register */
1647#define SWEF 0x0001 /* Stopwatch Event Flag */
1648#define AEF 0x0002 /* Alarm Event Flag */
1649#define SEF 0x0004 /* Seconds (1 Hz) Event Flag */
1650#define MEF 0x0008 /* Minutes Event Flag */
1651#define HEF 0x0010 /* Hours Event Flag */
1652#define DEF 0x0020 /* 24 Hours (Days) Event Flag */
1653#define DAEF 0x0040 /* Day Alarm (Day, Hour, Minute, Second) Event Flag */
1654#define WPS 0x4000 /* Write Pending Status (RO) */
1655#define WCOM 0x8000 /* Write Complete */
1656
1657/* RTC_FAST Mask (RTC_PREN Mask) */
1658#define ENABLE_PRESCALE 0x00000001 /* Enable prescaler so RTC runs at 1 Hz */
1659#define PREN 0x00000001
1660 /* ** Must be set after power-up for proper operation of RTC */
1661
1662/* Deprecated RTC_STAT and RTC_ALARM Masks */
1663#define RTC_SEC RTSEC /* Real-Time Clock Seconds */
1664#define RTC_MIN RTMIN /* Real-Time Clock Minutes */
1665#define RTC_HR RTHR /* Real-Time Clock Hours */
1666#define RTC_DAY RTDAY /* Real-Time Clock Days */
1667
1668/* Deprecated RTC_ICTL/RTC_ISTAT Masks */
1669#define STOPWATCH SWIE /* Stopwatch Interrupt Enable */
1670#define ALARM AIE /* Alarm Interrupt Enable */
1671#define SECOND SIE /* Seconds (1 Hz) Interrupt Enable */
1672#define MINUTE MIE /* Minutes Interrupt Enable */
1673#define HOUR HIE /* Hours Interrupt Enable */
1674#define DAY DIE /* 24 Hours (Days) Interrupt Enable */
1675#define DAY_ALARM DAIE /* Day Alarm (Day, Hour, Minute, Second) Interrupt Enable */
1676#define WRITE_COMPLETE WCIE /* Write Complete Interrupt Enable */
1677
1678
1679/* ***************************** UART CONTROLLER MASKS ********************** */
1680/* UARTx_LCR Register */
1681#ifdef _MISRA_RULES
1682#define WLS(x) (((x)-5u) & 0x03u) /* Word Length Select */
1683#else
1684#define WLS(x) (((x)-5) & 0x03) /* Word Length Select */
1685#endif /* _MISRA_RULES */
1686#define STB 0x04 /* Stop Bits */
1687#define PEN 0x08 /* Parity Enable */
1688#define EPS 0x10 /* Even Parity Select */
1689#define STP 0x20 /* Stick Parity */
1690#define SB 0x40 /* Set Break */
1691#define DLAB 0x80 /* Divisor Latch Access */
1692
1693#define DLAB_P 0x07
1694#define SB_P 0x06
1695#define STP_P 0x05
1696#define EPS_P 0x04
1697#define PEN_P 0x03
1698#define STB_P 0x02
1699#define WLS_P1 0x01
1700#define WLS_P0 0x00
1701
1702/* UARTx_MCR Register */
1703#define LOOP_ENA 0x10 /* Loopback Mode Enable */
1704#define LOOP_ENA_P 0x04
1705/* Deprecated UARTx_MCR Mask */
1706
1707/* UARTx_LSR Register */
1708#define DR 0x01 /* Data Ready */
1709#define OE 0x02 /* Overrun Error */
1710#define PE 0x04 /* Parity Error */
1711#define FE 0x08 /* Framing Error */
1712#define BI 0x10 /* Break Interrupt */
1713#define THRE 0x20 /* THR Empty */
1714#define TEMT 0x40 /* TSR and UART_THR Empty */
1715
1716#define TEMP_P 0x06
1717#define THRE_P 0x05
1718#define BI_P 0x04
1719#define FE_P 0x03
1720#define PE_P 0x02
1721#define OE_P 0x01
1722#define DR_P 0x00
1723
1724/* UARTx_IER Register */
1725#define ERBFI 0x01 /* Enable Receive Buffer Full Interrupt */
1726#define ETBEI 0x02 /* Enable Transmit Buffer Empty Interrupt */
1727#define ELSI 0x04 /* Enable RX Status Interrupt */
1728
1729#define ELSI_P 0x02
1730#define ETBEI_P 0x01
1731#define ERBFI_P 0x00
1732
1733/* UARTx_IIR Register */
1734#define NINT 0x01
1735#define STATUS_P1 0x02
1736#define STATUS_P0 0x01
1737#define NINT_P 0x00
1738
1739/* UARTx_GCTL Register */
1740#define UCEN 0x01 /* Enable UARTx Clocks */
1741#define IREN 0x02 /* Enable IrDA Mode */
1742#define TPOLC 0x04 /* IrDA TX Polarity Change */
1743#define RPOLC 0x08 /* IrDA RX Polarity Change */
1744#define FPE 0x10 /* Force Parity Error On Transmit */
1745#define FFE 0x20 /* Force Framing Error On Transmit */
1746
1747#define FFE_P 0x05
1748#define FPE_P 0x04
1749#define RPOLC_P 0x03
1750#define TPOLC_P 0x02
1751#define IREN_P 0x01
1752#define UCEN_P 0x00
1753
1754
1755/* ********** SERIAL PORT MASKS ********************** */
1756/* SPORTx_TCR1 Masks */
1757#define TSPEN 0x0001 /* TX enable */
1758#define ITCLK 0x0002 /* Internal TX Clock Select */
1759#define TDTYPE 0x000C /* TX Data Formatting Select */
1760#define DTYPE_NORM 0x0000 /* Data Format Normal */
1761#define DTYPE_ULAW 0x0008 /* Compand Using u-Law */
1762#define DTYPE_ALAW 0x000C /* Compand Using A-Law */
1763#define TLSBIT 0x0010 /* TX Bit Order */
1764#define ITFS 0x0200 /* Internal TX Frame Sync Select */
1765#define TFSR 0x0400 /* TX Frame Sync Required Select */
1766#define DITFS 0x0800 /* Data Independent TX Frame Sync Select */
1767#define LTFS 0x1000 /* Low TX Frame Sync Select */
1768#define LATFS 0x2000 /* Late TX Frame Sync Select */
1769#define TCKFE 0x4000 /* TX Clock Falling Edge Select */
1770/* SPORTx_RCR1 Deprecated Masks */
1771#define TULAW DTYPE_ULAW /* Compand Using u-Law */
1772#define TALAW DTYPE_ALAW /* Compand Using A-Law */
1773
1774/* SPORTx_TCR2 Masks */
1775#ifdef _MISRA_RULES
1776#define SLEN(x) ((x)&0x1Fu) /* SPORT TX Word Length (2 - 31) */
1777#else
1778#define SLEN(x) ((x)&0x1F) /* SPORT TX Word Length (2 - 31) */
1779#endif /* _MISRA_RULES */
1780#define TXSE 0x0100 /*TX Secondary Enable */
1781#define TSFSE 0x0200 /*TX Stereo Frame Sync Enable */
1782#define TRFST 0x0400 /*TX Right-First Data Order */
1783
1784/* SPORTx_RCR1 Masks */
1785#define RSPEN 0x0001 /* RX enable */
1786#define IRCLK 0x0002 /* Internal RX Clock Select */
1787#define RDTYPE 0x000C /* RX Data Formatting Select */
1788#define DTYPE_NORM 0x0000 /* no companding */
1789#define DTYPE_ULAW 0x0008 /* Compand Using u-Law */
1790#define DTYPE_ALAW 0x000C /* Compand Using A-Law */
1791#define RLSBIT 0x0010 /* RX Bit Order */
1792#define IRFS 0x0200 /* Internal RX Frame Sync Select */
1793#define RFSR 0x0400 /* RX Frame Sync Required Select */
1794#define LRFS 0x1000 /* Low RX Frame Sync Select */
1795#define LARFS 0x2000 /* Late RX Frame Sync Select */
1796#define RCKFE 0x4000 /* RX Clock Falling Edge Select */
1797/* SPORTx_RCR1 Deprecated Masks */
1798#define RULAW DTYPE_ULAW /* Compand Using u-Law */
1799#define RALAW DTYPE_ALAW /* Compand Using A-Law */
1800
1801/* SPORTx_RCR2 Masks */
1802#ifdef _MISRA_RULES
1803#define SLEN(x) ((x)&0x1Fu) /* SPORT RX Word Length (2 - 31) */
1804#else
1805#define SLEN(x) ((x)&0x1F) /* SPORT RX Word Length (2 - 31) */
1806#endif /* _MISRA_RULES */
1807#define RXSE 0x0100 /*RX Secondary Enable */
1808#define RSFSE 0x0200 /*RX Stereo Frame Sync Enable */
1809#define RRFST 0x0400 /*Right-First Data Order */
1810
1811/*SPORTx_STAT Masks */
1812#define RXNE 0x0001 /*RX FIFO Not Empty Status */
1813#define RUVF 0x0002 /*RX Underflow Status */
1814#define ROVF 0x0004 /*RX Overflow Status */
1815#define TXF 0x0008 /*TX FIFO Full Status */
1816#define TUVF 0x0010 /*TX Underflow Status */
1817#define TOVF 0x0020 /*TX Overflow Status */
1818#define TXHRE 0x0040 /*TX Hold Register Empty */
1819
1820/*SPORTx_MCMC1 Masks */
1821#define WOFF 0x000003FF /*Multichannel Window Offset Field */
1822/* SPORTx_MCMC1 Macros */
1823#ifdef _MISRA_RULES
1824#define SET_WOFF(x) ((x) & 0x3FFu) /* Multichannel Window Offset Field */
1825/* Only use SET_WSIZE Macro With Logic OR While Setting Lower Order Bits */
1826#define SET_WSIZE(x) (((((x)>>0x3)-1u)&0xFu) << 0xC) /* Multichannel Window Size = (x/8)-1 */
1827#else
1828#define SET_WOFF(x) ((x) & 0x3FF) /* Multichannel Window Offset Field */
1829/* Only use SET_WSIZE Macro With Logic OR While Setting Lower Order Bits */
1830#define SET_WSIZE(x) (((((x)>>0x3)-1)&0xF) << 0xC) /* Multichannel Window Size = (x/8)-1 */
1831#endif /* _MISRA_RULES */
1832
1833
1834/*SPORTx_MCMC2 Masks */
1835#define MCCRM 0x0003 /*Multichannel Clock Recovery Mode */
1836#define REC_BYPASS 0x0000 /* Bypass Mode (No Clock Recovery) */
1837#define REC_2FROM4 0x0002 /* Recover 2 MHz Clock from 4 MHz Clock */
1838#define REC_8FROM16 0x0003 /* Recover 8 MHz Clock from 16 MHz Clock */
1839#define MCDTXPE 0x0004 /*Multichannel DMA Transmit Packing */
1840#define MCDRXPE 0x0008 /*Multichannel DMA Receive Packing */
1841#define MCMEN 0x0010 /*Multichannel Frame Mode Enable */
1842#define FSDR 0x0080 /*Multichannel Frame Sync to Data Relationship */
1843#define MFD 0xF000 /*Multichannel Frame Delay */
1844#define MFD_0 0x0000 /* Multichannel Frame Delay = 0 */
1845#define MFD_1 0x1000 /* Multichannel Frame Delay = 1 */
1846#define MFD_2 0x2000 /* Multichannel Frame Delay = 2 */
1847#define MFD_3 0x3000 /* Multichannel Frame Delay = 3 */
1848#define MFD_4 0x4000 /* Multichannel Frame Delay = 4 */
1849#define MFD_5 0x5000 /* Multichannel Frame Delay = 5 */
1850#define MFD_6 0x6000 /* Multichannel Frame Delay = 6 */
1851#define MFD_7 0x7000 /* Multichannel Frame Delay = 7 */
1852#define MFD_8 0x8000 /* Multichannel Frame Delay = 8 */
1853#define MFD_9 0x9000 /* Multichannel Frame Delay = 9 */
1854#define MFD_10 0xA000 /* Multichannel Frame Delay = 10 */
1855#define MFD_11 0xB000 /* Multichannel Frame Delay = 11 */
1856#define MFD_12 0xC000 /* Multichannel Frame Delay = 12 */
1857#define MFD_13 0xD000 /* Multichannel Frame Delay = 13 */
1858#define MFD_14 0xE000 /* Multichannel Frame Delay = 14 */
1859#define MFD_15 0xF000 /* Multichannel Frame Delay = 15 */
1860
1861
1862/* ********* PARALLEL PERIPHERAL INTERFACE (PPI) MASKS **************** */
1863/* PPI_CONTROL Masks */
1864#define PORT_EN 0x0001 /* PPI Port Enable */
1865#define PORT_DIR 0x0002 /* PPI Port Direction */
1866#define XFR_TYPE 0x000C /* PPI Transfer Type */
1867#define PORT_CFG 0x0030 /* PPI Port Configuration */
1868#define FLD_SEL 0x0040 /* PPI Active Field Select */
1869#define PACK_EN 0x0080 /* PPI Packing Mode */
1870/* previous versions of defBF539.h erroneously included DMA32 (PPI 32-bit DMA Enable) */
1871#define SKIP_EN 0x0200 /* PPI Skip Element Enable */
1872#define SKIP_EO 0x0400 /* PPI Skip Even/Odd Elements */
1873#define DLENGTH 0x3800 /* PPI Data Length */
1874#define DLEN_8 0x0 /* PPI Data Length mask for DLEN=8 */
1875#define DLEN_10 0x0800 /* Data Length = 10 Bits */
1876#define DLEN_11 0x1000 /* Data Length = 11 Bits */
1877#define DLEN_12 0x1800 /* Data Length = 12 Bits */
1878#define DLEN_13 0x2000 /* Data Length = 13 Bits */
1879#define DLEN_14 0x2800 /* Data Length = 14 Bits */
1880#define DLEN_15 0x3000 /* Data Length = 15 Bits */
1881#define DLEN_16 0x3800 /* Data Length = 16 Bits */
1882#ifdef _MISRA_RULES
1883#define DLEN(x) ((((x)-9u) & 0x07u) << 11) /* PPI Data Length (only works for x=10-->x=16) */
1884#else
1885#define DLEN(x) ((((x)-9) & 0x07) << 11) /* PPI Data Length (only works for x=10-->x=16) */
1886#endif /* _MISRA_RULES */
1887#define POL 0xC000 /* PPI Signal Polarities */
1888#define POLC 0x4000 /* PPI Clock Polarity */
1889#define POLS 0x8000 /* PPI Frame Sync Polarity */
1890
1891
1892/* PPI_STATUS Masks */
1893#define FLD 0x0400 /* Field Indicator */
1894#define FT_ERR 0x0800 /* Frame Track Error */
1895#define OVR 0x1000 /* FIFO Overflow Error */
1896#define UNDR 0x2000 /* FIFO Underrun Error */
1897#define ERR_DET 0x4000 /* Error Detected Indicator */
1898#define ERR_NCOR 0x8000 /* Error Not Corrected Indicator */
1899
1900
1901/* ********** DMA CONTROLLER MASKS ***********************/
1902/* DMAx_CONFIG, MDMA_yy_CONFIG Masks */
1903#define DMAEN 0x0001 /* Channel Enable */
1904#define WNR 0x0002 /* Channel Direction (W/R*) */
1905#define WDSIZE_8 0x0000 /* Word Size 8 bits */
1906#define WDSIZE_16 0x0004 /* Word Size 16 bits */
1907#define WDSIZE_32 0x0008 /* Word Size 32 bits */
1908#define DMA2D 0x0010 /* 2D/1D* Mode */
1909#define RESTART 0x0020 /* Restart */
1910#define DI_SEL 0x0040 /* Data Interrupt Select */
1911#define DI_EN 0x0080 /* Data Interrupt Enable */
1912#define NDSIZE 0x0900 /* Next Descriptor Size */
1913#define NDSIZE_0 0x0000 /* Next Descriptor Size = 0 (Stop/Autobuffer) */
1914#define NDSIZE_1 0x0100 /* Next Descriptor Size = 1 */
1915#define NDSIZE_2 0x0200 /* Next Descriptor Size = 2 */
1916#define NDSIZE_3 0x0300 /* Next Descriptor Size = 3 */
1917#define NDSIZE_4 0x0400 /* Next Descriptor Size = 4 */
1918#define NDSIZE_5 0x0500 /* Next Descriptor Size = 5 */
1919#define NDSIZE_6 0x0600 /* Next Descriptor Size = 6 */
1920#define NDSIZE_7 0x0700 /* Next Descriptor Size = 7 */
1921#define NDSIZE_8 0x0800 /* Next Descriptor Size = 8 */
1922#define NDSIZE_9 0x0900 /* Next Descriptor Size = 9 */
1923
1924#define DMAFLOW 0x7000 /* Flow Control */
1925#define DMAFLOW_STOP 0x0000 /* Stop Mode */
1926#define DMAFLOW_AUTO 0x1000 /* Autobuffer Mode */
1927#define DMAFLOW_ARRAY 0x4000 /* Descriptor Array Mode */
1928#define DMAFLOW_SMALL 0x6000 /* Small Model Descriptor List Mode */
1929#define DMAFLOW_LARGE 0x7000 /* Large Model Descriptor List Mode */
1930
1931#define DMAEN_P 0x0 /* Channel Enable */
1932#define WNR_P 0x1 /* Channel Direction (W/R*) */
1933#define DMA2D_P 0x4 /* 2D/1D* Mode */
1934#define RESTART_P 0x5 /* Restart */
1935#define DI_SEL_P 0x6 /* Data Interrupt Select */
1936#define DI_EN_P 0x7 /* Data Interrupt Enable */
1937
1938/* DMAx_IRQ_STATUS, MDMA_yy_IRQ_STATUS Masks */
1939#define DMA_DONE 0x0001 /* DMA Done Indicator */
1940#define DMA_ERR 0x0002 /* DMA Error Indicator */
1941#define DFETCH 0x0004 /* Descriptor Fetch Indicator */
1942#define DMA_RUN 0x0008 /* DMA Running Indicator */
1943
1944#define DMA_DONE_P 0x0 /* DMA Done Indicator */
1945#define DMA_ERR_P 0x1 /* DMA Error Indicator */
1946#define DFETCH_P 0x2 /* Descriptor Fetch Indicator */
1947#define DMA_RUN_P 0x3 /* DMA Running Indicator */
1948
1949/* DMAx_PERIPHERAL_MAP, MDMA_yy_PERIPHERAL_MAP Masks */
1950
1951#define CTYPE 0x0040 /* DMA Channel Type Indicator */
1952#define CTYPE_P 0x6 /* DMA Channel Type Indicator BIT POSITION */
1953#define PCAP8 0x0080 /* DMA 8-bit Operation Indicator */
1954#define PCAP16 0x0100 /* DMA 16-bit Operation Indicator */
1955#define PCAP32 0x0200 /* DMA 32-bit Operation Indicator */
1956#define PCAPWR 0x0400 /* DMA Write Operation Indicator */
1957#define PCAPRD 0x0800 /* DMA Read Operation Indicator */
1958#define PMAP 0xF000 /* DMA Peripheral Map Field */
1959
1960/* PMAP Encodings For DMA Controller 0 */
1961#define PMAP_PPI 0x0000 /* PMAP PPI Port DMA */
1962#define PMAP_SPORT0RX 0x1000 /* PMAP SPORT0 Receive DMA */
1963#define PMAP_SPORT0TX 0x2000 /* PMAP SPORT0 Transmit DMA */
1964#define PMAP_SPORT1RX 0x3000 /* PMAP SPORT1 Receive DMA */
1965#define PMAP_SPORT1TX 0x4000 /* PMAP SPORT1 Transmit DMA */
1966#define PMAP_SPI0 0x5000 /* PMAP SPI DMA */
1967#define PMAP_UART0RX 0x6000 /* PMAP UART Receive DMA */
1968#define PMAP_UART0TX 0x7000 /* PMAP UART Transmit DMA */
1969
1970/* PMAP Encodings For DMA Controller 1 */
1971#define PMAP_SPORT2RX 0x0000 /* PMAP SPORT2 Receive DMA */
1972#define PMAP_SPORT2TX 0x1000 /* PMAP SPORT2 Transmit DMA */
1973#define PMAP_SPORT3RX 0x2000 /* PMAP SPORT3 Receive DMA */
1974#define PMAP_SPORT3TX 0x3000 /* PMAP SPORT3 Transmit DMA */
1975#define PMAP_SPI1 0x6000 /* PMAP SPI1 DMA */
1976#define PMAP_SPI2 0x7000 /* PMAP SPI2 DMA */
1977#define PMAP_UART1RX 0x8000 /* PMAP UART1 Receive DMA */
1978#define PMAP_UART1TX 0x9000 /* PMAP UART1 Transmit DMA */
1979#define PMAP_UART2RX 0xA000 /* PMAP UART2 Receive DMA */
1980#define PMAP_UART2TX 0xB000 /* PMAP UART2 Transmit DMA */
1981
1982
1983/* ************* GENERAL PURPOSE TIMER MASKS ******************** */
1984/* PWM Timer bit definitions */
1985/* TIMER_ENABLE Register */
1986#define TIMEN0 0x0001 /* Enable Timer 0 */
1987#define TIMEN1 0x0002 /* Enable Timer 1 */
1988#define TIMEN2 0x0004 /* Enable Timer 2 */
1989
1990#define TIMEN0_P 0x00
1991#define TIMEN1_P 0x01
1992#define TIMEN2_P 0x02
1993
1994/* TIMER_DISABLE Register */
1995#define TIMDIS0 0x0001 /* Disable Timer 0 */
1996#define TIMDIS1 0x0002 /* Disable Timer 1 */
1997#define TIMDIS2 0x0004 /* Disable Timer 2 */
1998
1999#define TIMDIS0_P 0x00
2000#define TIMDIS1_P 0x01
2001#define TIMDIS2_P 0x02
2002
2003/* TIMER_STATUS Register */
2004#define TIMIL0 0x0001 /* Timer 0 Interrupt */
2005#define TIMIL1 0x0002 /* Timer 1 Interrupt */
2006#define TIMIL2 0x0004 /* Timer 2 Interrupt */
2007#define TOVF_ERR0 0x0010 /* Timer 0 Counter Overflow */
2008#define TOVF_ERR1 0x0020 /* Timer 1 Counter Overflow */
2009#define TOVF_ERR2 0x0040 /* Timer 2 Counter Overflow */
2010#define TRUN0 0x1000 /* Timer 0 Slave Enable Status */
2011#define TRUN1 0x2000 /* Timer 1 Slave Enable Status */
2012#define TRUN2 0x4000 /* Timer 2 Slave Enable Status */
2013
2014#define TIMIL0_P 0x00
2015#define TIMIL1_P 0x01
2016#define TIMIL2_P 0x02
2017#define TOVF_ERR0_P 0x04
2018#define TOVF_ERR1_P 0x05
2019#define TOVF_ERR2_P 0x06
2020#define TRUN0_P 0x0C
2021#define TRUN1_P 0x0D
2022#define TRUN2_P 0x0E
2023
2024/* Alternate Deprecated Macros Provided For Backwards Code Compatibility */
2025#define TOVL_ERR0 TOVF_ERR0
2026#define TOVL_ERR1 TOVF_ERR1
2027#define TOVL_ERR2 TOVF_ERR2
2028#define TOVL_ERR0_P TOVF_ERR0_P
2029#define TOVL_ERR1_P TOVF_ERR1_P
2030#define TOVL_ERR2_P TOVF_ERR2_P
2031
2032/* TIMERx_CONFIG Registers */
2033#define PWM_OUT 0x0001
2034#define WDTH_CAP 0x0002
2035#define EXT_CLK 0x0003
2036#define PULSE_HI 0x0004
2037#define PERIOD_CNT 0x0008
2038#define IRQ_ENA 0x0010
2039#define TIN_SEL 0x0020
2040#define OUT_DIS 0x0040
2041#define CLK_SEL 0x0080
2042#define TOGGLE_HI 0x0100
2043#define EMU_RUN 0x0200
2044#ifdef _MISRA_RULES
2045#define ERR_TYP(x) (((x) & 0x03u) << 14)
2046#else
2047#define ERR_TYP(x) (((x) & 0x03) << 14)
2048#endif /* _MISRA_RULES */
2049
2050#define TMODE_P0 0x00
2051#define TMODE_P1 0x01
2052#define PULSE_HI_P 0x02
2053#define PERIOD_CNT_P 0x03
2054#define IRQ_ENA_P 0x04
2055#define TIN_SEL_P 0x05
2056#define OUT_DIS_P 0x06
2057#define CLK_SEL_P 0x07
2058#define TOGGLE_HI_P 0x08
2059#define EMU_RUN_P 0x09
2060#define ERR_TYP_P0 0x0E
2061#define ERR_TYP_P1 0x0F
2062
2063
2064/*/ ****************** GENERAL-PURPOSE I/O ********************* */
2065/* Flag I/O (FIO_) Masks */
2066#define PF0 0x0001
2067#define PF1 0x0002
2068#define PF2 0x0004
2069#define PF3 0x0008
2070#define PF4 0x0010
2071#define PF5 0x0020
2072#define PF6 0x0040
2073#define PF7 0x0080
2074#define PF8 0x0100
2075#define PF9 0x0200
2076#define PF10 0x0400
2077#define PF11 0x0800
2078#define PF12 0x1000
2079#define PF13 0x2000
2080#define PF14 0x4000
2081#define PF15 0x8000
2082
2083/* PORT F BIT POSITIONS */
2084#define PF0_P 0x0
2085#define PF1_P 0x1
2086#define PF2_P 0x2
2087#define PF3_P 0x3
2088#define PF4_P 0x4
2089#define PF5_P 0x5
2090#define PF6_P 0x6
2091#define PF7_P 0x7
2092#define PF8_P 0x8
2093#define PF9_P 0x9
2094#define PF10_P 0xA
2095#define PF11_P 0xB
2096#define PF12_P 0xC
2097#define PF13_P 0xD
2098#define PF14_P 0xE
2099#define PF15_P 0xF
2100
2101
2102/******************* GPIO MASKS *********************/
2103/* Port C Masks */
2104#define PC0 0x0001
2105#define PC1 0x0002
2106#define PC4 0x0010
2107#define PC5 0x0020
2108#define PC6 0x0040
2109#define PC7 0x0080
2110#define PC8 0x0100
2111#define PC9 0x0200
2112/* Port C Bit Positions */
2113#define PC0_P 0x0
2114#define PC1_P 0x1
2115#define PC4_P 0x4
2116#define PC5_P 0x5
2117#define PC6_P 0x6
2118#define PC7_P 0x7
2119#define PC8_P 0x8
2120#define PC9_P 0x9
2121
2122/* Port D */
2123#define PD0 0x0001
2124#define PD1 0x0002
2125#define PD2 0x0004
2126#define PD3 0x0008
2127#define PD4 0x0010
2128#define PD5 0x0020
2129#define PD6 0x0040
2130#define PD7 0x0080
2131#define PD8 0x0100
2132#define PD9 0x0200
2133#define PD10 0x0400
2134#define PD11 0x0800
2135#define PD12 0x1000
2136#define PD13 0x2000
2137#define PD14 0x4000
2138#define PD15 0x8000
2139/* Port D Bit Positions */
2140#define PD0_P 0x0
2141#define PD1_P 0x1
2142#define PD2_P 0x2
2143#define PD3_P 0x3
2144#define PD4_P 0x4
2145#define PD5_P 0x5
2146#define PD6_P 0x6
2147#define PD7_P 0x7
2148#define PD8_P 0x8
2149#define PD9_P 0x9
2150#define PD10_P 0xA
2151#define PD11_P 0xB
2152#define PD12_P 0xC
2153#define PD13_P 0xD
2154#define PD14_P 0xE
2155#define PD15_P 0xF
2156
2157/* Port E */
2158#define PE0 0x0001
2159#define PE1 0x0002
2160#define PE2 0x0004
2161#define PE3 0x0008
2162#define PE4 0x0010
2163#define PE5 0x0020
2164#define PE6 0x0040
2165#define PE7 0x0080
2166#define PE8 0x0100
2167#define PE9 0x0200
2168#define PE10 0x0400
2169#define PE11 0x0800
2170#define PE12 0x1000
2171#define PE13 0x2000
2172#define PE14 0x4000
2173#define PE15 0x8000
2174/* Port E Bit Positions */
2175#define PE0_P 0x0
2176#define PE1_P 0x1
2177#define PE2_P 0x2
2178#define PE3_P 0x3
2179#define PE4_P 0x4
2180#define PE5_P 0x5
2181#define PE6_P 0x6
2182#define PE7_P 0x7
2183#define PE8_P 0x8
2184#define PE9_P 0x9
2185#define PE10_P 0xA
2186#define PE11_P 0xB
2187#define PE12_P 0xC
2188#define PE13_P 0xD
2189#define PE14_P 0xE
2190#define PE15_P 0xF
2191
2192
2193/* *********** SERIAL PERIPHERAL INTERFACE (SPI) MASKS **************** */
2194/* SPIx_CTL Masks */
2195#define TIMOD 0x0003 /* Transfer Initiate Mode */
2196#define RDBR_CORE 0x0000 /* RDBR Read Initiates, IRQ When RDBR Full */
2197#define TDBR_CORE 0x0001 /* TDBR Write Initiates, IRQ When TDBR Empty */
2198#define RDBR_DMA 0x0002 /* DMA Read, DMA Until FIFO Empty */
2199#define TDBR_DMA 0x0003 /* DMA Write, DMA Until FIFO Full */
2200#define SZ 0x0004 /* Send Zero (When TDBR Empty, Send Zero/Last*) */
2201#define GM 0x0008 /* Get More (When RDBR Full, Overwrite/Discard*) */
2202#define PSSE 0x0010 /* Slave-Select Input Enable */
2203#define EMISO 0x0020 /* Enable MISO As Output */
2204#define SIZE 0x0100 /* Size of Words (16/8* Bits) */
2205#define LSBF 0x0200 /* LSB First */
2206#define CPHA 0x0400 /* Clock Phase */
2207#define CPOL 0x0800 /* Clock Polarity */
2208#define MSTR 0x1000 /* Master/Slave* */
2209#define WOM 0x2000 /* Write Open Drain Master */
2210#define SPE 0x4000 /* SPI Enable */
2211
2212/* SPIx_FLG Masks */
2213#define FLS1 0x0002 /* Enables (=1) SPI_FLOUT1 as flag output for SPI Slave-select */
2214#define FLS2 0x0004 /* Enables (=1) SPI_FLOUT2 as flag output for SPI Slave-select */
2215#define FLS3 0x0008 /* Enables (=1) SPI_FLOUT3 as flag output for SPI Slave-select */
2216#define FLS4 0x0010 /* Enables (=1) SPI_FLOUT4 as flag output for SPI Slave-select */
2217#define FLS5 0x0020 /* Enables (=1) SPI_FLOUT5 as flag output for SPI Slave-select */
2218#define FLS6 0x0040 /* Enables (=1) SPI_FLOUT6 as flag output for SPI Slave-select */
2219#define FLS7 0x0080 /* Enables (=1) SPI_FLOUT7 as flag output for SPI Slave-select */
2220
2221#define FLG1 0x0200 /* Activates (=0) SPI_FLOUT1 as flag output for SPI Slave-select */
2222#define FLG2 0x0400 /* Activates (=0) SPI_FLOUT2 as flag output for SPI Slave-select */
2223#define FLG3 0x0800 /* Activates (=0) SPI_FLOUT3 as flag output for SPI Slave-select */
2224#define FLG4 0x1000 /* Activates (=0) SPI_FLOUT4 as flag output for SPI Slave-select */
2225#define FLG5 0x2000 /* Activates (=0) SPI_FLOUT5 as flag output for SPI Slave-select */
2226#define FLG6 0x4000 /* Activates (=0) SPI_FLOUT6 as flag output for SPI Slave-select */
2227#define FLG7 0x8000 /* Activates (=0) SPI_FLOUT7 as flag output for SPI Slave-select */
2228
2229/* SPIx_FLG Bit Positions */
2230#define FLS1_P 0x0001 /* Enables (=1) SPI_FLOUT1 as flag output for SPI Slave-select */
2231#define FLS2_P 0x0002 /* Enables (=1) SPI_FLOUT2 as flag output for SPI Slave-select */
2232#define FLS3_P 0x0003 /* Enables (=1) SPI_FLOUT3 as flag output for SPI Slave-select */
2233#define FLS4_P 0x0004 /* Enables (=1) SPI_FLOUT4 as flag output for SPI Slave-select */
2234#define FLS5_P 0x0005 /* Enables (=1) SPI_FLOUT5 as flag output for SPI Slave-select */
2235#define FLS6_P 0x0006 /* Enables (=1) SPI_FLOUT6 as flag output for SPI Slave-select */
2236#define FLS7_P 0x0007 /* Enables (=1) SPI_FLOUT7 as flag output for SPI Slave-select */
2237#define FLG1_P 0x0009 /* Activates (=0) SPI_FLOUT1 as flag output for SPI Slave-select */
2238#define FLG2_P 0x000A /* Activates (=0) SPI_FLOUT2 as flag output for SPI Slave-select */
2239#define FLG3_P 0x000B /* Activates (=0) SPI_FLOUT3 as flag output for SPI Slave-select */
2240#define FLG4_P 0x000C /* Activates (=0) SPI_FLOUT4 as flag output for SPI Slave-select */
2241#define FLG5_P 0x000D /* Activates (=0) SPI_FLOUT5 as flag output for SPI Slave-select */
2242#define FLG6_P 0x000E /* Activates (=0) SPI_FLOUT6 as flag output for SPI Slave-select */
2243#define FLG7_P 0x000F /* Activates (=0) SPI_FLOUT7 as flag output for SPI Slave-select */
2244
2245/* SPIx_STAT Masks */
2246#define SPIF 0x0001 /* Set (=1) when SPI single-word transfer complete */
2247#define MODF 0x0002 /* Set (=1) in a master device when some other device tries to become master */
2248#define TXE 0x0004 /* Set (=1) when transmission occurs with no new data in SPI_TDBR */
2249#define TXS 0x0008 /* SPI_TDBR Data Buffer Status (0=Empty, 1=Full) */
2250#define RBSY 0x0010 /* Set (=1) when data is received with RDBR full */
2251#define RXS 0x0020 /* SPI_RDBR Data Buffer Status (0=Empty, 1=Full) */
2252#define TXCOL 0x0040 /* When set (=1), corrupt data may have been transmitted */
2253
2254/* SPIx_FLG Masks */
2255#define FLG1E 0xFDFF /* Activates SPI_FLOUT1 */
2256#define FLG2E 0xFBFF /* Activates SPI_FLOUT2 */
2257#define FLG3E 0xF7FF /* Activates SPI_FLOUT3 */
2258#define FLG4E 0xEFFF /* Activates SPI_FLOUT4 */
2259#define FLG5E 0xDFFF /* Activates SPI_FLOUT5 */
2260#define FLG6E 0xBFFF /* Activates SPI_FLOUT6 */
2261#define FLG7E 0x7FFF /* Activates SPI_FLOUT7 */
2262
2263
2264/* ********************* ASYNCHRONOUS MEMORY CONTROLLER MASKS ************* */
2265/* EBIU_AMGCTL Masks */
2266#define AMCKEN 0x0001 /* Enable CLKOUT */
2267#define AMBEN_NONE 0x0000 /* All Banks Disabled */
2268#define AMBEN_B0 0x0002 /* Enable Asynchronous Memory Bank 0 only */
2269#define AMBEN_B0_B1 0x0004 /* Enable Asynchronous Memory Banks 0 & 1 only */
2270#define AMBEN_B0_B1_B2 0x0006 /* Enable Asynchronous Memory Banks 0, 1, and 2 */
2271#define AMBEN_ALL 0x0008 /* Enable Asynchronous Memory Banks (all) 0, 1, 2, and 3 */
2272#define CDPRIO 0x0100 /* DMA has priority over core for for external accesses */
2273
2274/* EBIU_AMGCTL Bit Positions */
2275#define AMCKEN_P 0x0000 /* Enable CLKOUT */
2276#define AMBEN_P0 0x0001 /* Asynchronous Memory Enable, 000 - banks 0-3 disabled, 001 - Bank 0 enabled */
2277#define AMBEN_P1 0x0002 /* Asynchronous Memory Enable, 010 - banks 0&1 enabled, 011 - banks 0-3 enabled */
2278#define AMBEN_P2 0x0003 /* Asynchronous Memory Enable, 1xx - All banks (bank 0, 1, 2, and 3) enabled */
2279
2280/* EBIU_AMBCTL0 Masks */
2281#define B0RDYEN 0x00000001 /* Bank 0 RDY Enable, 0=disable, 1=enable */
2282#define B0RDYPOL 0x00000002 /* Bank 0 RDY Active high, 0=active low, 1=active high */
2283#define B0TT_1 0x00000004 /* Bank 0 Transition Time from Read to Write = 1 cycle */
2284#define B0TT_2 0x00000008 /* Bank 0 Transition Time from Read to Write = 2 cycles */
2285#define B0TT_3 0x0000000C /* Bank 0 Transition Time from Read to Write = 3 cycles */
2286#define B0TT_4 0x00000000 /* Bank 0 Transition Time from Read to Write = 4 cycles */
2287#define B0ST_1 0x00000010 /* Bank 0 Setup Time from AOE asserted to Read/Write asserted=1 cycle */
2288#define B0ST_2 0x00000020 /* Bank 0 Setup Time from AOE asserted to Read/Write asserted=2 cycles */
2289#define B0ST_3 0x00000030 /* Bank 0 Setup Time from AOE asserted to Read/Write asserted=3 cycles */
2290#define B0ST_4 0x00000000 /* Bank 0 Setup Time from AOE asserted to Read/Write asserted=4 cycles */
2291#define B0HT_1 0x00000040 /* Bank 0 Hold Time from Read/Write deasserted to AOE deasserted = 1 cycle */
2292#define B0HT_2 0x00000080 /* Bank 0 Hold Time from Read/Write deasserted to AOE deasserted = 2 cycles */
2293#define B0HT_3 0x000000C0 /* Bank 0 Hold Time from Read/Write deasserted to AOE deasserted = 3 cycles */
2294#define B0HT_0 0x00000000 /* Bank 0 Hold Time from Read/Write deasserted to AOE deasserted = 0 cycles */
2295#define B0RAT_1 0x00000100 /* Bank 0 Read Access Time = 1 cycle */
2296#define B0RAT_2 0x00000200 /* Bank 0 Read Access Time = 2 cycles */
2297#define B0RAT_3 0x00000300 /* Bank 0 Read Access Time = 3 cycles */
2298#define B0RAT_4 0x00000400 /* Bank 0 Read Access Time = 4 cycles */
2299#define B0RAT_5 0x00000500 /* Bank 0 Read Access Time = 5 cycles */
2300#define B0RAT_6 0x00000600 /* Bank 0 Read Access Time = 6 cycles */
2301#define B0RAT_7 0x00000700 /* Bank 0 Read Access Time = 7 cycles */
2302#define B0RAT_8 0x00000800 /* Bank 0 Read Access Time = 8 cycles */
2303#define B0RAT_9 0x00000900 /* Bank 0 Read Access Time = 9 cycles */
2304#define B0RAT_10 0x00000A00 /* Bank 0 Read Access Time = 10 cycles */
2305#define B0RAT_11 0x00000B00 /* Bank 0 Read Access Time = 11 cycles */
2306#define B0RAT_12 0x00000C00 /* Bank 0 Read Access Time = 12 cycles */
2307#define B0RAT_13 0x00000D00 /* Bank 0 Read Access Time = 13 cycles */
2308#define B0RAT_14 0x00000E00 /* Bank 0 Read Access Time = 14 cycles */
2309#define B0RAT_15 0x00000F00 /* Bank 0 Read Access Time = 15 cycles */
2310#define B0WAT_1 0x00001000 /* Bank 0 Write Access Time = 1 cycle */
2311#define B0WAT_2 0x00002000 /* Bank 0 Write Access Time = 2 cycles */
2312#define B0WAT_3 0x00003000 /* Bank 0 Write Access Time = 3 cycles */
2313#define B0WAT_4 0x00004000 /* Bank 0 Write Access Time = 4 cycles */
2314#define B0WAT_5 0x00005000 /* Bank 0 Write Access Time = 5 cycles */
2315#define B0WAT_6 0x00006000 /* Bank 0 Write Access Time = 6 cycles */
2316#define B0WAT_7 0x00007000 /* Bank 0 Write Access Time = 7 cycles */
2317#define B0WAT_8 0x00008000 /* Bank 0 Write Access Time = 8 cycles */
2318#define B0WAT_9 0x00009000 /* Bank 0 Write Access Time = 9 cycles */
2319#define B0WAT_10 0x0000A000 /* Bank 0 Write Access Time = 10 cycles */
2320#define B0WAT_11 0x0000B000 /* Bank 0 Write Access Time = 11 cycles */
2321#define B0WAT_12 0x0000C000 /* Bank 0 Write Access Time = 12 cycles */
2322#define B0WAT_13 0x0000D000 /* Bank 0 Write Access Time = 13 cycles */
2323#define B0WAT_14 0x0000E000 /* Bank 0 Write Access Time = 14 cycles */
2324#define B0WAT_15 0x0000F000 /* Bank 0 Write Access Time = 15 cycles */
2325#define B1RDYEN 0x00010000 /* Bank 1 RDY enable, 0=disable, 1=enable */
2326#define B1RDYPOL 0x00020000 /* Bank 1 RDY Active high, 0=active low, 1=active high */
2327#define B1TT_1 0x00040000 /* Bank 1 Transition Time from Read to Write = 1 cycle */
2328#define B1TT_2 0x00080000 /* Bank 1 Transition Time from Read to Write = 2 cycles */
2329#define B1TT_3 0x000C0000 /* Bank 1 Transition Time from Read to Write = 3 cycles */
2330#define B1TT_4 0x00000000 /* Bank 1 Transition Time from Read to Write = 4 cycles */
2331#define B1ST_1 0x00100000 /* Bank 1 Setup Time from AOE asserted to Read or Write asserted = 1 cycle */
2332#define B1ST_2 0x00200000 /* Bank 1 Setup Time from AOE asserted to Read or Write asserted = 2 cycles */
2333#define B1ST_3 0x00300000 /* Bank 1 Setup Time from AOE asserted to Read or Write asserted = 3 cycles */
2334#define B1ST_4 0x00000000 /* Bank 1 Setup Time from AOE asserted to Read or Write asserted = 4 cycles */
2335#define B1HT_1 0x00400000 /* Bank 1 Hold Time from Read or Write deasserted to AOE deasserted = 1 cycle */
2336#define B1HT_2 0x00800000 /* Bank 1 Hold Time from Read or Write deasserted to AOE deasserted = 2 cycles */
2337#define B1HT_3 0x00C00000 /* Bank 1 Hold Time from Read or Write deasserted to AOE deasserted = 3 cycles */
2338#define B1HT_0 0x00000000 /* Bank 1 Hold Time from Read or Write deasserted to AOE deasserted = 0 cycles */
2339#define B1RAT_1 0x01000000 /* Bank 1 Read Access Time = 1 cycle */
2340#define B1RAT_2 0x02000000 /* Bank 1 Read Access Time = 2 cycles */
2341#define B1RAT_3 0x03000000 /* Bank 1 Read Access Time = 3 cycles */
2342#define B1RAT_4 0x04000000 /* Bank 1 Read Access Time = 4 cycles */
2343#define B1RAT_5 0x05000000 /* Bank 1 Read Access Time = 5 cycles */
2344#define B1RAT_6 0x06000000 /* Bank 1 Read Access Time = 6 cycles */
2345#define B1RAT_7 0x07000000 /* Bank 1 Read Access Time = 7 cycles */
2346#define B1RAT_8 0x08000000 /* Bank 1 Read Access Time = 8 cycles */
2347#define B1RAT_9 0x09000000 /* Bank 1 Read Access Time = 9 cycles */
2348#define B1RAT_10 0x0A000000 /* Bank 1 Read Access Time = 10 cycles */
2349#define B1RAT_11 0x0B000000 /* Bank 1 Read Access Time = 11 cycles */
2350#define B1RAT_12 0x0C000000 /* Bank 1 Read Access Time = 12 cycles */
2351#define B1RAT_13 0x0D000000 /* Bank 1 Read Access Time = 13 cycles */
2352#define B1RAT_14 0x0E000000 /* Bank 1 Read Access Time = 14 cycles */
2353#define B1RAT_15 0x0F000000 /* Bank 1 Read Access Time = 15 cycles */
2354#define B1WAT_1 0x10000000 /* Bank 1 Write Access Time = 1 cycle */
2355#define B1WAT_2 0x20000000 /* Bank 1 Write Access Time = 2 cycles */
2356#define B1WAT_3 0x30000000 /* Bank 1 Write Access Time = 3 cycles */
2357#define B1WAT_4 0x40000000 /* Bank 1 Write Access Time = 4 cycles */
2358#define B1WAT_5 0x50000000 /* Bank 1 Write Access Time = 5 cycles */
2359#define B1WAT_6 0x60000000 /* Bank 1 Write Access Time = 6 cycles */
2360#define B1WAT_7 0x70000000 /* Bank 1 Write Access Time = 7 cycles */
2361#define B1WAT_8 0x80000000 /* Bank 1 Write Access Time = 8 cycles */
2362#define B1WAT_9 0x90000000 /* Bank 1 Write Access Time = 9 cycles */
2363#define B1WAT_10 0xA0000000 /* Bank 1 Write Access Time = 10 cycles */
2364#define B1WAT_11 0xB0000000 /* Bank 1 Write Access Time = 11 cycles */
2365#define B1WAT_12 0xC0000000 /* Bank 1 Write Access Time = 12 cycles */
2366#define B1WAT_13 0xD0000000 /* Bank 1 Write Access Time = 13 cycles */
2367#define B1WAT_14 0xE0000000 /* Bank 1 Write Access Time = 14 cycles */
2368#define B1WAT_15 0xF0000000 /* Bank 1 Write Access Time = 15 cycles */
2369
2370/* EBIU_AMBCTL1 Masks */
2371#define B2RDYEN 0x00000001 /* Bank 2 RDY Enable, 0=disable, 1=enable */
2372#define B2RDYPOL 0x00000002 /* Bank 2 RDY Active high, 0=active low, 1=active high */
2373#define B2TT_1 0x00000004 /* Bank 2 Transition Time from Read to Write = 1 cycle */
2374#define B2TT_2 0x00000008 /* Bank 2 Transition Time from Read to Write = 2 cycles */
2375#define B2TT_3 0x0000000C /* Bank 2 Transition Time from Read to Write = 3 cycles */
2376#define B2TT_4 0x00000000 /* Bank 2 Transition Time from Read to Write = 4 cycles */
2377#define B2ST_1 0x00000010 /* Bank 2 Setup Time from AOE asserted to Read or Write asserted = 1 cycle */
2378#define B2ST_2 0x00000020 /* Bank 2 Setup Time from AOE asserted to Read or Write asserted = 2 cycles */
2379#define B2ST_3 0x00000030 /* Bank 2 Setup Time from AOE asserted to Read or Write asserted = 3 cycles */
2380#define B2ST_4 0x00000000 /* Bank 2 Setup Time from AOE asserted to Read or Write asserted = 4 cycles */
2381#define B2HT_1 0x00000040 /* Bank 2 Hold Time from Read or Write deasserted to AOE deasserted = 1 cycle */
2382#define B2HT_2 0x00000080 /* Bank 2 Hold Time from Read or Write deasserted to AOE deasserted = 2 cycles */
2383#define B2HT_3 0x000000C0 /* Bank 2 Hold Time from Read or Write deasserted to AOE deasserted = 3 cycles */
2384#define B2HT_0 0x00000000 /* Bank 2 Hold Time from Read or Write deasserted to AOE deasserted = 0 cycles */
2385#define B2RAT_1 0x00000100 /* Bank 2 Read Access Time = 1 cycle */
2386#define B2RAT_2 0x00000200 /* Bank 2 Read Access Time = 2 cycles */
2387#define B2RAT_3 0x00000300 /* Bank 2 Read Access Time = 3 cycles */
2388#define B2RAT_4 0x00000400 /* Bank 2 Read Access Time = 4 cycles */
2389#define B2RAT_5 0x00000500 /* Bank 2 Read Access Time = 5 cycles */
2390#define B2RAT_6 0x00000600 /* Bank 2 Read Access Time = 6 cycles */
2391#define B2RAT_7 0x00000700 /* Bank 2 Read Access Time = 7 cycles */
2392#define B2RAT_8 0x00000800 /* Bank 2 Read Access Time = 8 cycles */
2393#define B2RAT_9 0x00000900 /* Bank 2 Read Access Time = 9 cycles */
2394#define B2RAT_10 0x00000A00 /* Bank 2 Read Access Time = 10 cycles */
2395#define B2RAT_11 0x00000B00 /* Bank 2 Read Access Time = 11 cycles */
2396#define B2RAT_12 0x00000C00 /* Bank 2 Read Access Time = 12 cycles */
2397#define B2RAT_13 0x00000D00 /* Bank 2 Read Access Time = 13 cycles */
2398#define B2RAT_14 0x00000E00 /* Bank 2 Read Access Time = 14 cycles */
2399#define B2RAT_15 0x00000F00 /* Bank 2 Read Access Time = 15 cycles */
2400#define B2WAT_1 0x00001000 /* Bank 2 Write Access Time = 1 cycle */
2401#define B2WAT_2 0x00002000 /* Bank 2 Write Access Time = 2 cycles */
2402#define B2WAT_3 0x00003000 /* Bank 2 Write Access Time = 3 cycles */
2403#define B2WAT_4 0x00004000 /* Bank 2 Write Access Time = 4 cycles */
2404#define B2WAT_5 0x00005000 /* Bank 2 Write Access Time = 5 cycles */
2405#define B2WAT_6 0x00006000 /* Bank 2 Write Access Time = 6 cycles */
2406#define B2WAT_7 0x00007000 /* Bank 2 Write Access Time = 7 cycles */
2407#define B2WAT_8 0x00008000 /* Bank 2 Write Access Time = 8 cycles */
2408#define B2WAT_9 0x00009000 /* Bank 2 Write Access Time = 9 cycles */
2409#define B2WAT_10 0x0000A000 /* Bank 2 Write Access Time = 10 cycles */
2410#define B2WAT_11 0x0000B000 /* Bank 2 Write Access Time = 11 cycles */
2411#define B2WAT_12 0x0000C000 /* Bank 2 Write Access Time = 12 cycles */
2412#define B2WAT_13 0x0000D000 /* Bank 2 Write Access Time = 13 cycles */
2413#define B2WAT_14 0x0000E000 /* Bank 2 Write Access Time = 14 cycles */
2414#define B2WAT_15 0x0000F000 /* Bank 2 Write Access Time = 15 cycles */
2415#define B3RDYEN 0x00010000 /* Bank 3 RDY enable, 0=disable, 1=enable */
2416#define B3RDYPOL 0x00020000 /* Bank 3 RDY Active high, 0=active low, 1=active high */
2417#define B3TT_1 0x00040000 /* Bank 3 Transition Time from Read to Write = 1 cycle */
2418#define B3TT_2 0x00080000 /* Bank 3 Transition Time from Read to Write = 2 cycles */
2419#define B3TT_3 0x000C0000 /* Bank 3 Transition Time from Read to Write = 3 cycles */
2420#define B3TT_4 0x00000000 /* Bank 3 Transition Time from Read to Write = 4 cycles */
2421#define B3ST_1 0x00100000 /* Bank 3 Setup Time from AOE asserted to Read or Write asserted = 1 cycle */
2422#define B3ST_2 0x00200000 /* Bank 3 Setup Time from AOE asserted to Read or Write asserted = 2 cycles */
2423#define B3ST_3 0x00300000 /* Bank 3 Setup Time from AOE asserted to Read or Write asserted = 3 cycles */
2424#define B3ST_4 0x00000000 /* Bank 3 Setup Time from AOE asserted to Read or Write asserted = 4 cycles */
2425#define B3HT_1 0x00400000 /* Bank 3 Hold Time from Read or Write deasserted to AOE deasserted = 1 cycle */
2426#define B3HT_2 0x00800000 /* Bank 3 Hold Time from Read or Write deasserted to AOE deasserted = 2 cycles */
2427#define B3HT_3 0x00C00000 /* Bank 3 Hold Time from Read or Write deasserted to AOE deasserted = 3 cycles */
2428#define B3HT_0 0x00000000 /* Bank 3 Hold Time from Read or Write deasserted to AOE deasserted = 0 cycles */
2429#define B3RAT_1 0x01000000 /* Bank 3 Read Access Time = 1 cycle */
2430#define B3RAT_2 0x02000000 /* Bank 3 Read Access Time = 2 cycles */
2431#define B3RAT_3 0x03000000 /* Bank 3 Read Access Time = 3 cycles */
2432#define B3RAT_4 0x04000000 /* Bank 3 Read Access Time = 4 cycles */
2433#define B3RAT_5 0x05000000 /* Bank 3 Read Access Time = 5 cycles */
2434#define B3RAT_6 0x06000000 /* Bank 3 Read Access Time = 6 cycles */
2435#define B3RAT_7 0x07000000 /* Bank 3 Read Access Time = 7 cycles */
2436#define B3RAT_8 0x08000000 /* Bank 3 Read Access Time = 8 cycles */
2437#define B3RAT_9 0x09000000 /* Bank 3 Read Access Time = 9 cycles */
2438#define B3RAT_10 0x0A000000 /* Bank 3 Read Access Time = 10 cycles */
2439#define B3RAT_11 0x0B000000 /* Bank 3 Read Access Time = 11 cycles */
2440#define B3RAT_12 0x0C000000 /* Bank 3 Read Access Time = 12 cycles */
2441#define B3RAT_13 0x0D000000 /* Bank 3 Read Access Time = 13 cycles */
2442#define B3RAT_14 0x0E000000 /* Bank 3 Read Access Time = 14 cycles */
2443#define B3RAT_15 0x0F000000 /* Bank 3 Read Access Time = 15 cycles */
2444#define B3WAT_1 0x10000000 /* Bank 3 Write Access Time = 1 cycle */
2445#define B3WAT_2 0x20000000 /* Bank 3 Write Access Time = 2 cycles */
2446#define B3WAT_3 0x30000000 /* Bank 3 Write Access Time = 3 cycles */
2447#define B3WAT_4 0x40000000 /* Bank 3 Write Access Time = 4 cycles */
2448#define B3WAT_5 0x50000000 /* Bank 3 Write Access Time = 5 cycles */
2449#define B3WAT_6 0x60000000 /* Bank 3 Write Access Time = 6 cycles */
2450#define B3WAT_7 0x70000000 /* Bank 3 Write Access Time = 7 cycles */
2451#define B3WAT_8 0x80000000 /* Bank 3 Write Access Time = 8 cycles */
2452#define B3WAT_9 0x90000000 /* Bank 3 Write Access Time = 9 cycles */
2453#define B3WAT_10 0xA0000000 /* Bank 3 Write Access Time = 10 cycles */
2454#define B3WAT_11 0xB0000000 /* Bank 3 Write Access Time = 11 cycles */
2455#define B3WAT_12 0xC0000000 /* Bank 3 Write Access Time = 12 cycles */
2456#define B3WAT_13 0xD0000000 /* Bank 3 Write Access Time = 13 cycles */
2457#define B3WAT_14 0xE0000000 /* Bank 3 Write Access Time = 14 cycles */
2458#define B3WAT_15 0xF0000000 /* Bank 3 Write Access Time = 15 cycles */
2459
2460/* ********************** SDRAM CONTROLLER MASKS *************************** */
2461/* EBIU_SDGCTL Masks */
2462#define SCTLE 0x00000001 /* Enable SCLK[0], /SRAS, /SCAS, /SWE, SDQM[3:0] */
2463#define CL_2 0x00000008 /* SDRAM CAS latency = 2 cycles */
2464#define CL_3 0x0000000C /* SDRAM CAS latency = 3 cycles */
2465#define PFE 0x00000010 /* Enable SDRAM prefetch */
2466#define PFP 0x00000020 /* Prefetch has priority over AMC requests */
2467#define PASR_ALL 0x00000000 /* All 4 SDRAM Banks Refreshed In Self-Refresh */
2468#define PASR_B0_B1 0x00000010 /* SDRAM Banks 0 and 1 Are Refreshed In Self-Refresh */
2469#define PASR_B0 0x00000020 /* Only SDRAM Bank 0 Is Refreshed In Self-Refresh */
2470#define TRAS_1 0x00000040 /* SDRAM tRAS = 1 cycle */
2471#define TRAS_2 0x00000080 /* SDRAM tRAS = 2 cycles */
2472#define TRAS_3 0x000000C0 /* SDRAM tRAS = 3 cycles */
2473#define TRAS_4 0x00000100 /* SDRAM tRAS = 4 cycles */
2474#define TRAS_5 0x00000140 /* SDRAM tRAS = 5 cycles */
2475#define TRAS_6 0x00000180 /* SDRAM tRAS = 6 cycles */
2476#define TRAS_7 0x000001C0 /* SDRAM tRAS = 7 cycles */
2477#define TRAS_8 0x00000200 /* SDRAM tRAS = 8 cycles */
2478#define TRAS_9 0x00000240 /* SDRAM tRAS = 9 cycles */
2479#define TRAS_10 0x00000280 /* SDRAM tRAS = 10 cycles */
2480#define TRAS_11 0x000002C0 /* SDRAM tRAS = 11 cycles */
2481#define TRAS_12 0x00000300 /* SDRAM tRAS = 12 cycles */
2482#define TRAS_13 0x00000340 /* SDRAM tRAS = 13 cycles */
2483#define TRAS_14 0x00000380 /* SDRAM tRAS = 14 cycles */
2484#define TRAS_15 0x000003C0 /* SDRAM tRAS = 15 cycles */
2485#define TRP_1 0x00000800 /* SDRAM tRP = 1 cycle */
2486#define TRP_2 0x00001000 /* SDRAM tRP = 2 cycles */
2487#define TRP_3 0x00001800 /* SDRAM tRP = 3 cycles */
2488#define TRP_4 0x00002000 /* SDRAM tRP = 4 cycles */
2489#define TRP_5 0x00002800 /* SDRAM tRP = 5 cycles */
2490#define TRP_6 0x00003000 /* SDRAM tRP = 6 cycles */
2491#define TRP_7 0x00003800 /* SDRAM tRP = 7 cycles */
2492#define TRCD_1 0x00008000 /* SDRAM tRCD = 1 cycle */
2493#define TRCD_2 0x00010000 /* SDRAM tRCD = 2 cycles */
2494#define TRCD_3 0x00018000 /* SDRAM tRCD = 3 cycles */
2495#define TRCD_4 0x00020000 /* SDRAM tRCD = 4 cycles */
2496#define TRCD_5 0x00028000 /* SDRAM tRCD = 5 cycles */
2497#define TRCD_6 0x00030000 /* SDRAM tRCD = 6 cycles */
2498#define TRCD_7 0x00038000 /* SDRAM tRCD = 7 cycles */
2499#define TWR_1 0x00080000 /* SDRAM tWR = 1 cycle */
2500#define TWR_2 0x00100000 /* SDRAM tWR = 2 cycles */
2501#define TWR_3 0x00180000 /* SDRAM tWR = 3 cycles */
2502#define PUPSD 0x00200000 /*Power-up start delay */
2503#define PSM 0x00400000 /* SDRAM power-up sequence = Precharge, mode register set, 8 CBR refresh cycles */
2504#define PSS 0x00800000 /* enable SDRAM power-up sequence on next SDRAM access */
2505#define SRFS 0x01000000 /* Start SDRAM self-refresh mode */
2506#define EBUFE 0x02000000 /* Enable external buffering timing */
2507#define FBBRW 0x04000000 /* Fast back-to-back read write enable */
2508#define EMREN 0x10000000 /* Extended mode register enable */
2509#define TCSR 0x20000000 /* Temp compensated self refresh value 85 deg C */
2510#define CDDBG 0x40000000 /* Tristate SDRAM controls during bus grant */
2511
2512/* EBIU_SDBCTL Masks */
2513#define EBE 0x00000001 /* Enable SDRAM external bank */
2514#define EBSZ_16 0x00000000 /* SDRAM external bank size = 16MB */
2515#define EBSZ_32 0x00000002 /* SDRAM external bank size = 32MB */
2516#define EBSZ_64 0x00000004 /* SDRAM external bank size = 64MB */
2517#define EBSZ_128 0x00000006 /* SDRAM external bank size = 128MB */
2518#define EBSZ_256 0x00000008 /* SDRAM External Bank Size = 256MB */
2519#define EBSZ_512 0x0000000A /* SDRAM External Bank Size = 512MB */
2520#define EBCAW_8 0x00000000 /* SDRAM external bank column address width = 8 bits */
2521#define EBCAW_9 0x00000010 /* SDRAM external bank column address width = 9 bits */
2522#define EBCAW_10 0x00000020 /* SDRAM external bank column address width = 9 bits */
2523#define EBCAW_11 0x00000030 /* SDRAM external bank column address width = 9 bits */
2524
2525/* EBIU_SDSTAT Masks */
2526#define SDCI 0x00000001 /* SDRAM controller is idle */
2527#define SDSRA 0x00000002 /* SDRAM SDRAM self refresh is active */
2528#define SDPUA 0x00000004 /* SDRAM power up active */
2529#define SDRS 0x00000008 /* SDRAM is in reset state */
2530#define SDEASE 0x00000010 /* SDRAM EAB sticky error status - W1C */
2531#define BGSTAT 0x00000020 /* Bus granted */
2532
2533
2534/* ******************** TWO-WIRE INTERFACE (TWIx) MASKS ***********************/
2535/* TWIx_CLKDIV Macros (Use: *pTWIx_CLKDIV = CLKLOW(x)|CLKHI(y); ) */
2536#ifdef _MISRA_RULES
2537#define CLKLOW(x) ((x) & 0xFFu) /* Periods Clock Is Held Low */
2538#define CLKHI(y) (((y)&0xFFu)<<0x8) /* Periods Before New Clock Low */
2539#else
2540#define CLKLOW(x) ((x) & 0xFF) /* Periods Clock Is Held Low */
2541#define CLKHI(y) (((y)&0xFF)<<0x8) /* Periods Before New Clock Low */
2542#endif /* _MISRA_RULES */
2543
2544/* TWIx_PRESCALE Masks */
2545#define PRESCALE 0x007F /* SCLKs Per Internal Time Reference (10MHz) */
2546#define TWI_ENA 0x0080 /* TWI Enable */
2547#define SCCB 0x0200 /* SCCB Compatibility Enable */
2548
2549/* TWIx_SLAVE_CTRL Masks */
2550#define SEN 0x0001 /* Slave Enable */
2551#define SADD_LEN 0x0002 /* Slave Address Length */
2552#define STDVAL 0x0004 /* Slave Transmit Data Valid */
2553#define NAK 0x0008 /* NAK/ACK* Generated At Conclusion Of Transfer */
2554#define GEN 0x0010 /* General Call Adrress Matching Enabled */
2555
2556/* TWIx_SLAVE_STAT Masks */
2557#define SDIR 0x0001 /* Slave Transfer Direction (Transmit/Receive*) */
2558#define GCALL 0x0002 /* General Call Indicator */
2559
2560/* TWIx_MASTER_CTRL Masks */
2561#define MEN 0x0001 /* Master Mode Enable */
2562#define MADD_LEN 0x0002 /* Master Address Length */
2563#define MDIR 0x0004 /* Master Transmit Direction (RX/TX*) */
2564#define FAST 0x0008 /* Use Fast Mode Timing Specs */
2565#define STOP 0x0010 /* Issue Stop Condition */
2566#define RSTART 0x0020 /* Repeat Start or Stop* At End Of Transfer */
2567#define DCNT 0x3FC0 /* Data Bytes To Transfer */
2568#define SDAOVR 0x4000 /* Serial Data Override */
2569#define SCLOVR 0x8000 /* Serial Clock Override */
2570
2571/* TWIx_MASTER_STAT Masks */
2572#define MPROG 0x0001 /* Master Transfer In Progress */
2573#define LOSTARB 0x0002 /* Lost Arbitration Indicator (Xfer Aborted) */
2574#define ANAK 0x0004 /* Address Not Acknowledged */
2575#define DNAK 0x0008 /* Data Not Acknowledged */
2576#define BUFRDERR 0x0010 /* Buffer Read Error */
2577#define BUFWRERR 0x0020 /* Buffer Write Error */
2578#define SDASEN 0x0040 /* Serial Data Sense */
2579#define SCLSEN 0x0080 /* Serial Clock Sense */
2580#define BUSBUSY 0x0100 /* Bus Busy Indicator */
2581
2582/* TWIx_INT_SRC and TWIx_INT_ENABLE Masks */
2583#define SINIT 0x0001 /* Slave Transfer Initiated */
2584#define SCOMP 0x0002 /* Slave Transfer Complete */
2585#define SERR 0x0004 /* Slave Transfer Error */
2586#define SOVF 0x0008 /* Slave Overflow */
2587#define MCOMP 0x0010 /* Master Transfer Complete */
2588#define MERR 0x0020 /* Master Transfer Error */
2589#define XMTSERV 0x0040 /* Transmit FIFO Service */
2590#define RCVSERV 0x0080 /* Receive FIFO Service */
2591
2592/* TWIx_FIFO_CTRL Masks */
2593#define XMTFLUSH 0x0001 /* Transmit Buffer Flush */
2594#define RCVFLUSH 0x0002 /* Receive Buffer Flush */
2595#define XMTINTLEN 0x0004 /* Transmit Buffer Interrupt Length */
2596#define RCVINTLEN 0x0008 /* Receive Buffer Interrupt Length */
2597
2598/* TWIx_FIFO_STAT Masks */
2599#define XMTSTAT 0x0003 /* Transmit FIFO Status */
2600#define XMT_EMPTY 0x0000 /* Transmit FIFO Empty */
2601#define XMT_HALF 0x0001 /* Transmit FIFO Has 1 Byte To Write */
2602#define XMT_FULL 0x0003 /* Transmit FIFO Full (2 Bytes To Write) */
2603
2604#define RCVSTAT 0x000C /* Receive FIFO Status */
2605#define RCV_EMPTY 0x0000 /* Receive FIFO Empty */
2606#define RCV_HALF 0x0004 /* Receive FIFO Has 1 Byte To Read */
2607#define RCV_FULL 0x000C /* Receive FIFO Full (2 Bytes To Read) */
2608
2609
2610/********************************* MXVR MASKS ****************************************/
2611
2612/* MXVR_CONFIG Masks */
2613
2614#define MXVREN 0x00000001lu
2615#define MMSM 0x00000002lu
2616#define ACTIVE 0x00000004lu
2617#define SDELAY 0x00000008lu
2618#define NCMRXEN 0x00000010lu
2619#define RWRRXEN 0x00000020lu
2620#define MTXEN 0x00000040lu
2621#define MTXON 0x00000080lu /*legacy*/
2622#define MTXONB 0x00000080lu
2623#define EPARITY 0x00000100lu
2624#define MSB 0x00001E00lu
2625#define APRXEN 0x00002000lu
2626#define WAKEUP 0x00004000lu
2627#define LMECH 0x00008000lu
2628
2629#ifdef _MISRA_RULES
2630#define SET_MSB(x) (((x)&0xFu) << 0x9)
2631#else
2632#define SET_MSB(x) (((x)&0xF) << 0x9)
2633#endif /* _MISRA_RULES */
2634
2635
2636/* MXVR_PLL_CTL_0 Masks */
2637
2638#define MXTALCEN 0x00000001lu
2639#define MXTALFEN 0x00000002lu
2640#define MPLLMS 0x00000008lu
2641#define MXTALMUL 0x00000030lu
2642#define MPLLEN 0x00000040lu
2643#define MPLLEN0 0x00000040lu /* legacy */
2644#define MPLLEN1 0x00000080lu /* legacy */
2645#define MMCLKEN 0x00000100lu
2646#define MMCLKMUL 0x00001E00lu
2647#define MPLLRSTB 0x00002000lu
2648#define MPLLRSTB0 0x00002000lu /* legacy */
2649#define MPLLRSTB1 0x00004000lu /* legacy */
2650#define MBCLKEN 0x00010000lu
2651#define MBCLKDIV 0x001E0000lu
2652#define MPLLCDR 0x00200000lu
2653#define MPLLCDR0 0x00200000lu /* legacy */
2654#define MPLLCDR1 0x00400000lu /* legacy */
2655#define INVRX 0x00800000lu
2656#define MFSEN 0x01000000lu
2657#define MFSDIV 0x1E000000lu
2658#define MFSSEL 0x60000000lu
2659#define MFSSYNC 0x80000000lu
2660
2661#define MXTALMUL_256FS 0x00000000lu /* legacy */
2662#define MXTALMUL_384FS 0x00000010lu /* legacy */
2663#define MXTALMUL_512FS 0x00000020lu /* legacy */
2664#define MXTALMUL_1024FS 0x00000030lu
2665
2666#define MMCLKMUL_1024FS 0x00000000lu
2667#define MMCLKMUL_512FS 0x00000200lu
2668#define MMCLKMUL_256FS 0x00000400lu
2669#define MMCLKMUL_128FS 0x00000600lu
2670#define MMCLKMUL_64FS 0x00000800lu
2671#define MMCLKMUL_32FS 0x00000A00lu
2672#define MMCLKMUL_16FS 0x00000C00lu
2673#define MMCLKMUL_8FS 0x00000E00lu
2674#define MMCLKMUL_4FS 0x00001000lu
2675#define MMCLKMUL_2FS 0x00001200lu
2676#define MMCLKMUL_1FS 0x00001400lu
2677#define MMCLKMUL_1536FS 0x00001A00lu
2678#define MMCLKMUL_768FS 0x00001C00lu
2679#define MMCLKMUL_384FS 0x00001E00lu
2680
2681#define MBCLKDIV_DIV2 0x00020000lu
2682#define MBCLKDIV_DIV4 0x00040000lu
2683#define MBCLKDIV_DIV8 0x00060000lu
2684#define MBCLKDIV_DIV16 0x00080000lu
2685#define MBCLKDIV_DIV32 0x000A0000lu
2686#define MBCLKDIV_DIV64 0x000C0000lu
2687#define MBCLKDIV_DIV128 0x000E0000lu
2688#define MBCLKDIV_DIV256 0x00100000lu
2689#define MBCLKDIV_DIV512 0x00120000lu
2690#define MBCLKDIV_DIV1024 0x00140000lu
2691
2692#define MFSDIV_DIV2 0x02000000lu
2693#define MFSDIV_DIV4 0x04000000lu
2694#define MFSDIV_DIV8 0x06000000lu
2695#define MFSDIV_DIV16 0x08000000lu
2696#define MFSDIV_DIV32 0x0A000000lu
2697#define MFSDIV_DIV64 0x0C000000lu
2698#define MFSDIV_DIV128 0x0E000000lu
2699#define MFSDIV_DIV256 0x10000000lu
2700#define MFSDIV_DIV512 0x12000000lu
2701#define MFSDIV_DIV1024 0x14000000lu
2702
2703#define MFSSEL_CLOCK 0x00000000lu
2704#define MFSSEL_PULSE_HI 0x20000000lu
2705#define MFSSEL_PULSE_LO 0x40000000lu
2706
2707
2708/* MXVR_PLL_CTL_1 Masks */
2709
2710#define MSTO 0x00000001lu
2711#define MSTO0 0x00000001lu /* legacy */
2712#define MHOGGD 0x00000004lu
2713#define MHOGGD0 0x00000004lu /* legacy */
2714#define MHOGGD1 0x00000008lu /* legacy */
2715#define MSHAPEREN 0x00000010lu
2716#define MSHAPEREN0 0x00000010lu /* legacy */
2717#define MSHAPEREN1 0x00000020lu /* legacy */
2718#define MPLLCNTEN 0x00008000lu
2719#define MPLLCNT 0xFFFF0000lu
2720
2721#ifdef _MISRA_RULES
2722#define SET_MPLLCNT(x) (((x)&0xFFFFu) << 0x10)
2723#else
2724#define SET_MPLLCNT(x) (((x)&0xFFFF) << 0x10)
2725#endif /* _MISRA_RULES */
2726
2727
2728/* MXVR_PLL_CTL_2 Masks */
2729
2730#define MSHAPERSEL 0x00000007lu
2731#define MCPSEL 0x000000E0lu
2732
2733/* MXVR_INT_STAT_0 Masks */
2734
2735#define NI2A 0x00000001lu
2736#define NA2I 0x00000002lu
2737#define SBU2L 0x00000004lu
2738#define SBL2U 0x00000008lu
2739#define PRU 0x00000010lu
2740#define MPRU 0x00000020lu
2741#define DRU 0x00000040lu
2742#define MDRU 0x00000080lu
2743#define SBU 0x00000100lu
2744#define ATU 0x00000200lu
2745#define FCZ0 0x00000400lu
2746#define FCZ1 0x00000800lu
2747#define PERR 0x00001000lu
2748#define MH2L 0x00002000lu
2749#define ML2H 0x00004000lu
2750#define WUP 0x00008000lu
2751#define FU2L 0x00010000lu
2752#define FL2U 0x00020000lu
2753#define BU2L 0x00040000lu
2754#define BL2U 0x00080000lu
2755#define PCZ 0x00400000lu
2756#define FERR 0x00800000lu
2757#define CMR 0x01000000lu
2758#define CMROF 0x02000000lu
2759#define CMTS 0x04000000lu
2760#define CMTC 0x08000000lu
2761#define RWRC 0x10000000lu
2762#define BCZ 0x20000000lu
2763#define BMERR 0x40000000lu
2764#define DERR 0x80000000lu
2765
2766
2767/* MXVR_INT_EN_0 Masks */
2768
2769#define NI2AEN NI2A
2770#define NA2IEN NA2I
2771#define SBU2LEN SBU2L
2772#define SBL2UEN SBL2U
2773#define PRUEN PRU
2774#define MPRUEN MPRU
2775#define DRUEN DRU
2776#define MDRUEN MDRU
2777#define SBUEN SBU
2778#define ATUEN ATU
2779#define FCZ0EN FCZ0
2780#define FCZ1EN FCZ1
2781#define PERREN PERR
2782#define MH2LEN MH2L
2783#define ML2HEN ML2H
2784#define WUPEN WUP
2785#define FU2LEN FU2L
2786#define FL2UEN FL2U
2787#define BU2LEN BU2L
2788#define BL2UEN BL2U
2789#define PCZEN PCZ
2790#define FERREN FERR
2791#define CMREN CMR
2792#define CMROFEN CMROF
2793#define CMTSEN CMTS
2794#define CMTCEN CMTC
2795#define RWRCEN RWRC
2796#define BCZEN BCZ
2797#define BMERREN BMERR
2798#define DERREN DERR
2799
2800
2801/* MXVR_INT_STAT_1 Masks */
2802
2803#define APR 0x00000004lu
2804#define APROF 0x00000008lu
2805#define APTS 0x00000040lu
2806#define APTC 0x00000080lu
2807#define APRCE 0x00000400lu
2808#define APRPE 0x00000800lu
2809
2810#define HDONE0 0x00000001lu
2811#define DONE0 0x00000002lu
2812#define HDONE1 0x00000010lu
2813#define DONE1 0x00000020lu
2814#define HDONE2 0x00000100lu
2815#define DONE2 0x00000200lu
2816#define HDONE3 0x00001000lu
2817#define DONE3 0x00002000lu
2818#define HDONE4 0x00010000lu
2819#define DONE4 0x00020000lu
2820#define HDONE5 0x00100000lu
2821#define DONE5 0x00200000lu
2822#define HDONE6 0x01000000lu
2823#define DONE6 0x02000000lu
2824#define HDONE7 0x10000000lu
2825#define DONE7 0x20000000lu
2826
2827#define DONEX(x) (0x00000002 << (4 * (x)))
2828#define HDONEX(x) (0x00000001 << (4 * (x)))
2829
2830
2831/* MXVR_INT_EN_1 Masks */
2832
2833#define APREN APR
2834#define APROFEN APROF
2835#define APTSEN APTS
2836#define APTCEN APTC
2837#define APRCEEN APRCE
2838#define APRPEEN APRPE
2839
2840#define HDONEEN0 HDONE0
2841#define DONEEN0 DONE0
2842#define HDONEEN1 HDONE1
2843#define DONEEN1 DONE1
2844#define HDONEEN2 HDONE2
2845#define DONEEN2 DONE2
2846#define HDONEEN3 HDONE3
2847#define DONEEN3 DONE3
2848#define HDONEEN4 HDONE4
2849#define DONEEN4 DONE4
2850#define HDONEEN5 HDONE5
2851#define DONEEN5 DONE5
2852#define HDONEEN6 HDONE6
2853#define DONEEN6 DONE6
2854#define HDONEEN7 HDONE7
2855#define DONEEN7 DONE7
2856
2857#define DONEENX(x) (0x00000002 << (4 * (x)))
2858#define HDONEENX(x) (0x00000001 << (4 * (x)))
2859
2860
2861/* MXVR_STATE_0 Masks */
2862
2863#define NACT 0x00000001lu
2864#define SBLOCK 0x00000002lu
2865#define PFDLOCK 0x00000004lu
2866#define PFDLOCK0 0x00000004lu /* legacy */
2867#define PDD 0x00000008lu
2868#define PDD0 0x00000008lu /* legacy */
2869#define PVCO 0x00000010lu
2870#define PVCO0 0x00000010lu /* legacy */
2871#define PFDLOCK1 0x00000020lu /* legacy */
2872#define PDD1 0x00000040lu /* legacy */
2873#define PVCO1 0x00000080lu /* legacy */
2874#define APBSY 0x00000100lu
2875#define APARB 0x00000200lu
2876#define APTX 0x00000400lu
2877#define APRX 0x00000800lu
2878#define CMBSY 0x00001000lu
2879#define CMARB 0x00002000lu
2880#define CMTX 0x00004000lu
2881#define CMRX 0x00008000lu
2882#define MRXONB 0x00010000lu
2883#define RGSIP 0x00020000lu
2884#define DALIP 0x00040000lu
2885#define ALIP 0x00080000lu
2886#define RRDIP 0x00100000lu
2887#define RWRIP 0x00200000lu
2888#define FLOCK 0x00400000lu
2889#define BLOCK 0x00800000lu
2890#define RSB 0x0F000000lu
2891#define DERRNUM 0xF0000000lu
2892
2893
2894/* MXVR_STATE_1 Masks */
2895
2896#define STXNUMB 0x0000000Flu
2897#define SRXNUMB 0x000000F0lu
2898#define APCONT 0x00000100lu
2899#define DMAACTIVEX 0x00FF0000lu
2900#define DMAACTIVE0 0x00010000lu
2901#define DMAACTIVE1 0x00020000lu
2902#define DMAACTIVE2 0x00040000lu
2903#define DMAACTIVE3 0x00080000lu
2904#define DMAACTIVE4 0x00100000lu
2905#define DMAACTIVE5 0x00200000lu
2906#define DMAACTIVE6 0x00400000lu
2907#define DMAACTIVE7 0x00800000lu
2908#define DMAPMENX 0xFF000000lu
2909#define DMAPMEN0 0x01000000lu
2910#define DMAPMEN1 0x02000000lu
2911#define DMAPMEN2 0x04000000lu
2912#define DMAPMEN3 0x08000000lu
2913#define DMAPMEN4 0x10000000lu
2914#define DMAPMEN5 0x20000000lu
2915#define DMAPMEN6 0x40000000lu
2916#define DMAPMEN7 0x80000000lu
2917
2918
2919/* MXVR_POSITION Masks */
2920
2921#define PVALID 0x8000
2922#define POSITION 0x003F
2923
2924
2925/* MXVR_MAX_POSITION Masks */
2926
2927#define MPVALID 0x8000
2928#define MPOSITION 0x003F
2929
2930
2931/* MXVR_DELAY Masks */
2932
2933#define DVALID 0x8000
2934#define DELAY 0x003F
2935
2936
2937/* MXVR_MAX_DELAY Masks */
2938
2939#define MDVALID 0x8000
2940#define MDELAY 0x003F
2941
2942
2943/* MXVR_LADDR Masks */
2944
2945#define LVALID 0x80000000lu
2946#define LADDR 0x0000FFFFlu
2947
2948
2949/* MXVR_GADDR Masks */
2950
2951#define GVALID 0x8000
2952#define GADDRL 0x00FF
2953
2954
2955/* MXVR_AADDR Masks */
2956
2957#define AVALID 0x80000000lu
2958#define AADDR 0x0000FFFFlu
2959
2960
2961/* MXVR_ALLOC_0 Masks */
2962
2963#define CIU0 0x00000080lu
2964#define CIU1 0x00008000lu
2965#define CIU2 0x00800000lu
2966#define CIU3 0x80000000lu
2967
2968#define CL0 0x0000007Flu
2969#define CL1 0x00007F00lu
2970#define CL2 0x007F0000lu
2971#define CL3 0x7F000000lu
2972
2973
2974/* MXVR_ALLOC_1 Masks */
2975
2976#define CIU4 0x00000080lu
2977#define CIU5 0x00008000lu
2978#define CIU6 0x00800000lu
2979#define CIU7 0x80000000lu
2980
2981#define CL4 0x0000007Flu
2982#define CL5 0x00007F00lu
2983#define CL6 0x007F0000lu
2984#define CL7 0x7F000000lu
2985
2986
2987/* MXVR_ALLOC_2 Masks */
2988
2989#define CIU8 0x00000080lu
2990#define CIU9 0x00008000lu
2991#define CIU10 0x00800000lu
2992#define CIU11 0x80000000lu
2993
2994#define CL8 0x0000007Flu
2995#define CL9 0x00007F00lu
2996#define CL10 0x007F0000lu
2997#define CL11 0x7F000000lu
2998
2999
3000/* MXVR_ALLOC_3 Masks */
3001
3002#define CIU12 0x00000080lu
3003#define CIU13 0x00008000lu
3004#define CIU14 0x00800000lu
3005#define CIU15 0x80000000lu
3006
3007#define CL12 0x0000007Flu
3008#define CL13 0x00007F00lu
3009#define CL14 0x007F0000lu
3010#define CL15 0x7F000000lu
3011
3012
3013/* MXVR_ALLOC_4 Masks */
3014
3015#define CIU16 0x00000080lu
3016#define CIU17 0x00008000lu
3017#define CIU18 0x00800000lu
3018#define CIU19 0x80000000lu
3019
3020#define CL16 0x0000007Flu
3021#define CL17 0x00007F00lu
3022#define CL18 0x007F0000lu
3023#define CL19 0x7F000000lu
3024
3025
3026/* MXVR_ALLOC_5 Masks */
3027
3028#define CIU20 0x00000080lu
3029#define CIU21 0x00008000lu
3030#define CIU22 0x00800000lu
3031#define CIU23 0x80000000lu
3032
3033#define CL20 0x0000007Flu
3034#define CL21 0x00007F00lu
3035#define CL22 0x007F0000lu
3036#define CL23 0x7F000000lu
3037
3038
3039/* MXVR_ALLOC_6 Masks */
3040
3041#define CIU24 0x00000080lu
3042#define CIU25 0x00008000lu
3043#define CIU26 0x00800000lu
3044#define CIU27 0x80000000lu
3045
3046#define CL24 0x0000007Flu
3047#define CL25 0x00007F00lu
3048#define CL26 0x007F0000lu
3049#define CL27 0x7F000000lu
3050
3051
3052/* MXVR_ALLOC_7 Masks */
3053
3054#define CIU28 0x00000080lu
3055#define CIU29 0x00008000lu
3056#define CIU30 0x00800000lu
3057#define CIU31 0x80000000lu
3058
3059#define CL28 0x0000007Flu
3060#define CL29 0x00007F00lu
3061#define CL30 0x007F0000lu
3062#define CL31 0x7F000000lu
3063
3064
3065/* MXVR_ALLOC_8 Masks */
3066
3067#define CIU32 0x00000080lu
3068#define CIU33 0x00008000lu
3069#define CIU34 0x00800000lu
3070#define CIU35 0x80000000lu
3071
3072#define CL32 0x0000007Flu
3073#define CL33 0x00007F00lu
3074#define CL34 0x007F0000lu
3075#define CL35 0x7F000000lu
3076
3077
3078/* MXVR_ALLOC_9 Masks */
3079
3080#define CIU36 0x00000080lu
3081#define CIU37 0x00008000lu
3082#define CIU38 0x00800000lu
3083#define CIU39 0x80000000lu
3084
3085#define CL36 0x0000007Flu
3086#define CL37 0x00007F00lu
3087#define CL38 0x007F0000lu
3088#define CL39 0x7F000000lu
3089
3090
3091/* MXVR_ALLOC_10 Masks */
3092
3093#define CIU40 0x00000080lu
3094#define CIU41 0x00008000lu
3095#define CIU42 0x00800000lu
3096#define CIU43 0x80000000lu
3097
3098#define CL40 0x0000007Flu
3099#define CL41 0x00007F00lu
3100#define CL42 0x007F0000lu
3101#define CL43 0x7F000000lu
3102
3103
3104/* MXVR_ALLOC_11 Masks */
3105
3106#define CIU44 0x00000080lu
3107#define CIU45 0x00008000lu
3108#define CIU46 0x00800000lu
3109#define CIU47 0x80000000lu
3110
3111#define CL44 0x0000007Flu
3112#define CL45 0x00007F00lu
3113#define CL46 0x007F0000lu
3114#define CL47 0x7F000000lu
3115
3116
3117/* MXVR_ALLOC_12 Masks */
3118
3119#define CIU48 0x00000080lu
3120#define CIU49 0x00008000lu
3121#define CIU50 0x00800000lu
3122#define CIU51 0x80000000lu
3123
3124#define CL48 0x0000007Flu
3125#define CL49 0x00007F00lu
3126#define CL50 0x007F0000lu
3127#define CL51 0x7F000000lu
3128
3129
3130/* MXVR_ALLOC_13 Masks */
3131
3132#define CIU52 0x00000080lu
3133#define CIU53 0x00008000lu
3134#define CIU54 0x00800000lu
3135#define CIU55 0x80000000lu
3136
3137#define CL52 0x0000007Flu
3138#define CL53 0x00007F00lu
3139#define CL54 0x007F0000lu
3140#define CL55 0x7F000000lu
3141
3142
3143/* MXVR_ALLOC_14 Masks */
3144
3145#define CIU56 0x00000080lu
3146#define CIU57 0x00008000lu
3147#define CIU58 0x00800000lu
3148#define CIU59 0x80000000lu
3149
3150#define CL56 0x0000007Flu
3151#define CL57 0x00007F00lu
3152#define CL58 0x007F0000lu
3153#define CL59 0x7F000000lu
3154
3155
3156/* MXVR_SYNC_LCHAN_0 Masks */
3157
3158#define LCHANPC0 0x0000000Flu
3159#define LCHANPC1 0x000000F0lu
3160#define LCHANPC2 0x00000F00lu
3161#define LCHANPC3 0x0000F000lu
3162#define LCHANPC4 0x000F0000lu
3163#define LCHANPC5 0x00F00000lu
3164#define LCHANPC6 0x0F000000lu
3165#define LCHANPC7 0xF0000000lu
3166
3167
3168/* MXVR_SYNC_LCHAN_1 Masks */
3169
3170#define LCHANPC8 0x0000000Flu
3171#define LCHANPC9 0x000000F0lu
3172#define LCHANPC10 0x00000F00lu
3173#define LCHANPC11 0x0000F000lu
3174#define LCHANPC12 0x000F0000lu
3175#define LCHANPC13 0x00F00000lu
3176#define LCHANPC14 0x0F000000lu
3177#define LCHANPC15 0xF0000000lu
3178
3179
3180/* MXVR_SYNC_LCHAN_2 Masks */
3181
3182#define LCHANPC16 0x0000000Flu
3183#define LCHANPC17 0x000000F0lu
3184#define LCHANPC18 0x00000F00lu
3185#define LCHANPC19 0x0000F000lu
3186#define LCHANPC20 0x000F0000lu
3187#define LCHANPC21 0x00F00000lu
3188#define LCHANPC22 0x0F000000lu
3189#define LCHANPC23 0xF0000000lu
3190
3191
3192/* MXVR_SYNC_LCHAN_3 Masks */
3193
3194#define LCHANPC24 0x0000000Flu
3195#define LCHANPC25 0x000000F0lu
3196#define LCHANPC26 0x00000F00lu
3197#define LCHANPC27 0x0000F000lu
3198#define LCHANPC28 0x000F0000lu
3199#define LCHANPC29 0x00F00000lu
3200#define LCHANPC30 0x0F000000lu
3201#define LCHANPC31 0xF0000000lu
3202
3203
3204/* MXVR_SYNC_LCHAN_4 Masks */
3205
3206#define LCHANPC32 0x0000000Flu
3207#define LCHANPC33 0x000000F0lu
3208#define LCHANPC34 0x00000F00lu
3209#define LCHANPC35 0x0000F000lu
3210#define LCHANPC36 0x000F0000lu
3211#define LCHANPC37 0x00F00000lu
3212#define LCHANPC38 0x0F000000lu
3213#define LCHANPC39 0xF0000000lu
3214
3215
3216/* MXVR_SYNC_LCHAN_5 Masks */
3217
3218#define LCHANPC40 0x0000000Flu
3219#define LCHANPC41 0x000000F0lu
3220#define LCHANPC42 0x00000F00lu
3221#define LCHANPC43 0x0000F000lu
3222#define LCHANPC44 0x000F0000lu
3223#define LCHANPC45 0x00F00000lu
3224#define LCHANPC46 0x0F000000lu
3225#define LCHANPC47 0xF0000000lu
3226
3227
3228/* MXVR_SYNC_LCHAN_6 Masks */
3229
3230#define LCHANPC48 0x0000000Flu
3231#define LCHANPC49 0x000000F0lu
3232#define LCHANPC50 0x00000F00lu
3233#define LCHANPC51 0x0000F000lu
3234#define LCHANPC52 0x000F0000lu
3235#define LCHANPC53 0x00F00000lu
3236#define LCHANPC54 0x0F000000lu
3237#define LCHANPC55 0xF0000000lu
3238
3239
3240/* MXVR_SYNC_LCHAN_7 Masks */
3241
3242#define LCHANPC56 0x0000000Flu
3243#define LCHANPC57 0x000000F0lu
3244#define LCHANPC58 0x00000F00lu
3245#define LCHANPC59 0x0000F000lu
3246
3247
3248/* MXVR_DMAx_CONFIG Masks */
3249
3250#define MDMAEN 0x00000001lu
3251#define DD 0x00000002lu
3252#define LCHAN 0x000003C0lu
3253#define BITSWAPEN 0x00000400lu
3254#define BYSWAPEN 0x00000800lu
3255#define MFLOW 0x00007000lu
3256#define FIXEDPM 0x00080000lu
3257#define STARTPAT 0x00300000lu
3258#define STOPPAT 0x00C00000lu
3259#define COUNTPOS 0x1C000000lu
3260
3261#define DD_TX 0x00000000lu
3262#define DD_RX 0x00000002lu
3263
3264#define LCHAN_0 0x00000000lu
3265#define LCHAN_1 0x00000040lu
3266#define LCHAN_2 0x00000080lu
3267#define LCHAN_3 0x000000C0lu
3268#define LCHAN_4 0x00000100lu
3269#define LCHAN_5 0x00000140lu
3270#define LCHAN_6 0x00000180lu
3271#define LCHAN_7 0x000001C0lu
3272
3273#define MFLOW_STOP 0x00000000lu
3274#define MFLOW_AUTO 0x00001000lu
3275#define MFLOW_PVC 0x00002000lu
3276#define MFLOW_PSS 0x00003000lu
3277#define MFLOW_PFC 0x00004000lu
3278
3279#define STARTPAT_0 0x00000000lu
3280#define STARTPAT_1 0x00100000lu
3281
3282#define STOPPAT_0 0x00000000lu
3283#define STOPPAT_1 0x00400000lu
3284
3285#define COUNTPOS_0 0x00000000lu
3286#define COUNTPOS_1 0x04000000lu
3287#define COUNTPOS_2 0x08000000lu
3288#define COUNTPOS_3 0x0C000000lu
3289#define COUNTPOS_4 0x10000000lu
3290#define COUNTPOS_5 0x14000000lu
3291#define COUNTPOS_6 0x18000000lu
3292#define COUNTPOS_7 0x1C000000lu
3293
3294
3295/* MXVR_AP_CTL Masks */
3296
3297#define STARTAP 0x00000001lu
3298#define CANCELAP 0x00000002lu
3299#define RESETAP 0x00000004lu
3300#define APRBE0 0x00004000lu
3301#define APRBE1 0x00008000lu
3302#define APRBEX 0x0000C000lu
3303
3304
3305/* MXVR_CM_CTL Masks */
3306
3307#define STARTCM 0x00000001lu
3308#define CANCELCM 0x00000002lu
3309#define CMRBEX 0xFFFF0000lu
3310#define CMRBE0 0x00010000lu
3311#define CMRBE1 0x00020000lu
3312#define CMRBE2 0x00040000lu
3313#define CMRBE3 0x00080000lu
3314#define CMRBE4 0x00100000lu
3315#define CMRBE5 0x00200000lu
3316#define CMRBE6 0x00400000lu
3317#define CMRBE7 0x00800000lu
3318#define CMRBE8 0x01000000lu
3319#define CMRBE9 0x02000000lu
3320#define CMRBE10 0x04000000lu
3321#define CMRBE11 0x08000000lu
3322#define CMRBE12 0x10000000lu
3323#define CMRBE13 0x20000000lu
3324#define CMRBE14 0x40000000lu
3325#define CMRBE15 0x80000000lu
3326
3327
3328/* MXVR_PAT_DATA_x Masks */
3329
3330#define MATCH_DATA_0 0x000000FFlu
3331#define MATCH_DATA_1 0x0000FF00lu
3332#define MATCH_DATA_2 0x00FF0000lu
3333#define MATCH_DATA_3 0xFF000000lu
3334
3335
3336
3337/* MXVR_PAT_EN_x Masks */
3338
3339#define MATCH_EN_0_0 0x00000001lu
3340#define MATCH_EN_0_1 0x00000002lu
3341#define MATCH_EN_0_2 0x00000004lu
3342#define MATCH_EN_0_3 0x00000008lu
3343#define MATCH_EN_0_4 0x00000010lu
3344#define MATCH_EN_0_5 0x00000020lu
3345#define MATCH_EN_0_6 0x00000040lu
3346#define MATCH_EN_0_7 0x00000080lu
3347
3348#define MATCH_EN_1_0 0x00000100lu
3349#define MATCH_EN_1_1 0x00000200lu
3350#define MATCH_EN_1_2 0x00000400lu
3351#define MATCH_EN_1_3 0x00000800lu
3352#define MATCH_EN_1_4 0x00001000lu
3353#define MATCH_EN_1_5 0x00002000lu
3354#define MATCH_EN_1_6 0x00004000lu
3355#define MATCH_EN_1_7 0x00008000lu
3356
3357#define MATCH_EN_2_0 0x00010000lu
3358#define MATCH_EN_2_1 0x00020000lu
3359#define MATCH_EN_2_2 0x00040000lu
3360#define MATCH_EN_2_3 0x00080000lu
3361#define MATCH_EN_2_4 0x00100000lu
3362#define MATCH_EN_2_5 0x00200000lu
3363#define MATCH_EN_2_6 0x00400000lu
3364#define MATCH_EN_2_7 0x00800000lu
3365
3366#define MATCH_EN_3_0 0x01000000lu
3367#define MATCH_EN_3_1 0x02000000lu
3368#define MATCH_EN_3_2 0x04000000lu
3369#define MATCH_EN_3_3 0x08000000lu
3370#define MATCH_EN_3_4 0x10000000lu
3371#define MATCH_EN_3_5 0x20000000lu
3372#define MATCH_EN_3_6 0x40000000lu
3373#define MATCH_EN_3_7 0x80000000lu
3374
3375
3376/* MXVR_ROUTING_0 Masks */
3377
3378#define MUTE_CH0 0x00000080lu
3379#define MUTE_CH1 0x00008000lu
3380#define MUTE_CH2 0x00800000lu
3381#define MUTE_CH3 0x80000000lu
3382
3383#define TX_CH0 0x0000007Flu
3384#define TX_CH1 0x00007F00lu
3385#define TX_CH2 0x007F0000lu
3386#define TX_CH3 0x7F000000lu
3387
3388
3389/* MXVR_ROUTING_1 Masks */
3390
3391#define MUTE_CH4 0x00000080lu
3392#define MUTE_CH5 0x00008000lu
3393#define MUTE_CH6 0x00800000lu
3394#define MUTE_CH7 0x80000000lu
3395
3396#define TX_CH4 0x0000007Flu
3397#define TX_CH5 0x00007F00lu
3398#define TX_CH6 0x007F0000lu
3399#define TX_CH7 0x7F000000lu
3400
3401
3402/* MXVR_ROUTING_2 Masks */
3403
3404#define MUTE_CH8 0x00000080lu
3405#define MUTE_CH9 0x00008000lu
3406#define MUTE_CH10 0x00800000lu
3407#define MUTE_CH11 0x80000000lu
3408
3409#define TX_CH8 0x0000007Flu
3410#define TX_CH9 0x00007F00lu
3411#define TX_CH10 0x007F0000lu
3412#define TX_CH11 0x7F000000lu
3413
3414/* MXVR_ROUTING_3 Masks */
3415
3416#define MUTE_CH12 0x00000080lu
3417#define MUTE_CH13 0x00008000lu
3418#define MUTE_CH14 0x00800000lu
3419#define MUTE_CH15 0x80000000lu
3420
3421#define TX_CH12 0x0000007Flu
3422#define TX_CH13 0x00007F00lu
3423#define TX_CH14 0x007F0000lu
3424#define TX_CH15 0x7F000000lu
3425
3426
3427/* MXVR_ROUTING_4 Masks */
3428
3429#define MUTE_CH16 0x00000080lu
3430#define MUTE_CH17 0x00008000lu
3431#define MUTE_CH18 0x00800000lu
3432#define MUTE_CH19 0x80000000lu
3433
3434#define TX_CH16 0x0000007Flu
3435#define TX_CH17 0x00007F00lu
3436#define TX_CH18 0x007F0000lu
3437#define TX_CH19 0x7F000000lu
3438
3439
3440/* MXVR_ROUTING_5 Masks */
3441
3442#define MUTE_CH20 0x00000080lu
3443#define MUTE_CH21 0x00008000lu
3444#define MUTE_CH22 0x00800000lu
3445#define MUTE_CH23 0x80000000lu
3446
3447#define TX_CH20 0x0000007Flu
3448#define TX_CH21 0x00007F00lu
3449#define TX_CH22 0x007F0000lu
3450#define TX_CH23 0x7F000000lu
3451
3452
3453/* MXVR_ROUTING_6 Masks */
3454
3455#define MUTE_CH24 0x00000080lu
3456#define MUTE_CH25 0x00008000lu
3457#define MUTE_CH26 0x00800000lu
3458#define MUTE_CH27 0x80000000lu
3459
3460#define TX_CH24 0x0000007Flu
3461#define TX_CH25 0x00007F00lu
3462#define TX_CH26 0x007F0000lu
3463#define TX_CH27 0x7F000000lu
3464
3465
3466/* MXVR_ROUTING_7 Masks */
3467
3468#define MUTE_CH28 0x00000080lu
3469#define MUTE_CH29 0x00008000lu
3470#define MUTE_CH30 0x00800000lu
3471#define MUTE_CH31 0x80000000lu
3472
3473#define TX_CH28 0x0000007Flu
3474#define TX_CH29 0x00007F00lu
3475#define TX_CH30 0x007F0000lu
3476#define TX_CH31 0x7F000000lu
3477
3478
3479/* MXVR_ROUTING_8 Masks */
3480
3481#define MUTE_CH32 0x00000080lu
3482#define MUTE_CH33 0x00008000lu
3483#define MUTE_CH34 0x00800000lu
3484#define MUTE_CH35 0x80000000lu
3485
3486#define TX_CH32 0x0000007Flu
3487#define TX_CH33 0x00007F00lu
3488#define TX_CH34 0x007F0000lu
3489#define TX_CH35 0x7F000000lu
3490
3491
3492/* MXVR_ROUTING_9 Masks */
3493
3494#define MUTE_CH36 0x00000080lu
3495#define MUTE_CH37 0x00008000lu
3496#define MUTE_CH38 0x00800000lu
3497#define MUTE_CH39 0x80000000lu
3498
3499#define TX_CH36 0x0000007Flu
3500#define TX_CH37 0x00007F00lu
3501#define TX_CH38 0x007F0000lu
3502#define TX_CH39 0x7F000000lu
3503
3504
3505/* MXVR_ROUTING_10 Masks */
3506
3507#define MUTE_CH40 0x00000080lu
3508#define MUTE_CH41 0x00008000lu
3509#define MUTE_CH42 0x00800000lu
3510#define MUTE_CH43 0x80000000lu
3511
3512#define TX_CH40 0x0000007Flu
3513#define TX_CH41 0x00007F00lu
3514#define TX_CH42 0x007F0000lu
3515#define TX_CH43 0x7F000000lu
3516
3517
3518/* MXVR_ROUTING_11 Masks */
3519
3520#define MUTE_CH44 0x00000080lu
3521#define MUTE_CH45 0x00008000lu
3522#define MUTE_CH46 0x00800000lu
3523#define MUTE_CH47 0x80000000lu
3524
3525#define TX_CH44 0x0000007Flu
3526#define TX_CH45 0x00007F00lu
3527#define TX_CH46 0x007F0000lu
3528#define TX_CH47 0x7F000000lu
3529
3530
3531/* MXVR_ROUTING_12 Masks */
3532
3533#define MUTE_CH48 0x00000080lu
3534#define MUTE_CH49 0x00008000lu
3535#define MUTE_CH50 0x00800000lu
3536#define MUTE_CH51 0x80000000lu
3537
3538#define TX_CH48 0x0000007Flu
3539#define TX_CH49 0x00007F00lu
3540#define TX_CH50 0x007F0000lu
3541#define TX_CH51 0x7F000000lu
3542
3543
3544/* MXVR_ROUTING_13 Masks */
3545
3546#define MUTE_CH52 0x00000080lu
3547#define MUTE_CH53 0x00008000lu
3548#define MUTE_CH54 0x00800000lu
3549#define MUTE_CH55 0x80000000lu
3550
3551#define TX_CH52 0x0000007Flu
3552#define TX_CH53 0x00007F00lu
3553#define TX_CH54 0x007F0000lu
3554#define TX_CH55 0x7F000000lu
3555
3556
3557/* MXVR_ROUTING_14 Masks */
3558
3559#define MUTE_CH56 0x00000080lu
3560#define MUTE_CH57 0x00008000lu
3561#define MUTE_CH58 0x00800000lu
3562#define MUTE_CH59 0x80000000lu
3563
3564#define TX_CH56 0x0000007Flu
3565#define TX_CH57 0x00007F00lu
3566#define TX_CH58 0x007F0000lu
3567#define TX_CH59 0x7F000000lu
3568
3569
3570/* Control Message Receive Buffer (CMRB) Address Offsets */
3571
3572#define CMRB_STRIDE 0x00000016lu
3573
3574#define CMRB_DST_OFFSET 0x00000000lu
3575#define CMRB_SRC_OFFSET 0x00000002lu
3576#define CMRB_DATA_OFFSET 0x00000005lu
3577
3578
3579/* Control Message Transmit Buffer (CMTB) Address Offsets */
3580
3581#define CMTB_PRIO_OFFSET 0x00000000lu
3582#define CMTB_DST_OFFSET 0x00000002lu
3583#define CMTB_SRC_OFFSET 0x00000004lu
3584#define CMTB_TYPE_OFFSET 0x00000006lu
3585#define CMTB_DATA_OFFSET 0x00000007lu
3586
3587#define CMTB_ANSWER_OFFSET 0x0000000Alu
3588
3589#define CMTB_STAT_N_OFFSET 0x00000018lu
3590#define CMTB_STAT_A_OFFSET 0x00000016lu
3591#define CMTB_STAT_D_OFFSET 0x0000000Elu
3592#define CMTB_STAT_R_OFFSET 0x00000014lu
3593#define CMTB_STAT_W_OFFSET 0x00000014lu
3594#define CMTB_STAT_G_OFFSET 0x00000014lu
3595
3596
3597/* Asynchronous Packet Receive Buffer (APRB) Address Offsets */
3598
3599#define APRB_STRIDE 0x00000400lu
3600
3601#define APRB_DST_OFFSET 0x00000000lu
3602#define APRB_LEN_OFFSET 0x00000002lu
3603#define APRB_SRC_OFFSET 0x00000004lu
3604#define APRB_DATA_OFFSET 0x00000006lu
3605
3606
3607/* Asynchronous Packet Transmit Buffer (APTB) Address Offsets */
3608
3609#define APTB_PRIO_OFFSET 0x00000000lu
3610#define APTB_DST_OFFSET 0x00000002lu
3611#define APTB_LEN_OFFSET 0x00000004lu
3612#define APTB_SRC_OFFSET 0x00000006lu
3613#define APTB_DATA_OFFSET 0x00000008lu
3614
3615
3616/* Remote Read Buffer (RRDB) Address Offsets */
3617
3618#define RRDB_WADDR_OFFSET 0x00000100lu
3619#define RRDB_WLEN_OFFSET 0x00000101lu
3620
3621
3622
3623/* ************ CONTROLLER AREA NETWORK (CAN) MASKS ***************/
3624/* CAN_CONTROL Masks */
3625#define SRS 0x0001 /* Software Reset */
3626#define DNM 0x0002 /* Device Net Mode */
3627#define ABO 0x0004 /* Auto-Bus On Enable */
3628#define WBA 0x0010 /* Wake-Up On CAN Bus Activity Enable */
3629#define SMR 0x0020 /* Sleep Mode Request */
3630#define CSR 0x0040 /* CAN Suspend Mode Request */
3631#define CCR 0x0080 /* CAN Configuration Mode Request */
3632
3633/* CAN_STATUS Masks */
3634#define WT 0x0001 /* TX Warning Flag */
3635#define WR 0x0002 /* RX Warning Flag */
3636#define EP 0x0004 /* Error Passive Mode */
3637#define EBO 0x0008 /* Error Bus Off Mode */
3638#define CSA 0x0040 /* Suspend Mode Acknowledge */
3639#define CCA 0x0080 /* Configuration Mode Acknowledge */
3640#define MBPTR 0x1F00 /* Mailbox Pointer */
3641#define TRM 0x4000 /* Transmit Mode */
3642#define REC 0x8000 /* Receive Mode */
3643
3644/* CAN_CLOCK Masks */
3645#define BRP 0x03FF /* Bit-Rate Pre-Scaler */
3646
3647/* CAN_TIMING Masks */
3648#define TSEG1 0x000F /* Time Segment 1 */
3649#define TSEG2 0x0070 /* Time Segment 2 */
3650#define SAM 0x0080 /* Sampling */
3651#define SJW 0x0300 /* Synchronization Jump Width */
3652
3653/* CAN_DEBUG Masks */
3654#define DEC 0x0001 /* Disable CAN Error Counters */
3655#define DRI 0x0002 /* Disable CAN RX Input */
3656#define DTO 0x0004 /* Disable CAN TX Output */
3657#define DIL 0x0008 /* Disable CAN Internal Loop */
3658#define MAA 0x0010 /* Mode Auto-Acknowledge Enable */
3659#define MRB 0x0020 /* Mode Read Back Enable */
3660#define CDE 0x8000 /* CAN Debug Enable */
3661
3662/* CAN_CEC Masks */
3663#define RXECNT 0x00FF /* Receive Error Counter */
3664#define TXECNT 0xFF00 /* Transmit Error Counter */
3665
3666/* CAN_INTR Masks */
3667#define MBRIRQ 0x0001 /* Mailbox Receive Interrupt */
3668#define MBRIF MBRIRQ /* legacy */
3669#define MBTIRQ 0x0002 /* Mailbox Transmit Interrupt */
3670#define MBTIF MBTIRQ /* legacy */
3671#define GIRQ 0x0004 /* Global Interrupt */
3672#define SMACK 0x0008 /* Sleep Mode Acknowledge */
3673#define CANTX 0x0040 /* CAN TX Bus Value */
3674#define CANRX 0x0080 /* CAN RX Bus Value */
3675
3676/* CAN_MBxx_ID1 and CAN_MBxx_ID0 Masks */
3677#define DFC 0xFFFF /* Data Filtering Code (If Enabled) (ID0) */
3678#define EXTID_LO 0xFFFF /* Lower 16 Bits of Extended Identifier (ID0) */
3679#define EXTID_HI 0x0003 /* Upper 2 Bits of Extended Identifier (ID1) */
3680#define BASEID 0x1FFC /* Base Identifier */
3681#define IDE 0x2000 /* Identifier Extension */
3682#define RTR 0x4000 /* Remote Frame Transmission Request */
3683#define AME 0x8000 /* Acceptance Mask Enable */
3684
3685/* CAN_MBxx_TIMESTAMP Masks */
3686#define TSV 0xFFFF /* Timestamp */
3687
3688/* CAN_MBxx_LENGTH Masks */
3689#define DLC 0x000F /* Data Length Code */
3690
3691/* CAN_AMxxH and CAN_AMxxL Masks */
3692#define DFM 0xFFFF /* Data Field Mask (If Enabled) (CAN_AMxxL) */
3693#define EXTID_LO 0xFFFF /* Lower 16 Bits of Extended Identifier (CAN_AMxxL) */
3694#define EXTID_HI 0x0003 /* Upper 2 Bits of Extended Identifier (CAN_AMxxH) */
3695#define BASEID 0x1FFC /* Base Identifier */
3696#define AMIDE 0x2000 /* Acceptance Mask ID Extension Enable */
3697#define FMD 0x4000 /* Full Mask Data Field Enable */
3698#define FDF 0x8000 /* Filter On Data Field Enable */
3699
3700/* CAN_MC1 Masks */
3701#define MC0 0x0001 /* Enable Mailbox 0 */
3702#define MC1 0x0002 /* Enable Mailbox 1 */
3703#define MC2 0x0004 /* Enable Mailbox 2 */
3704#define MC3 0x0008 /* Enable Mailbox 3 */
3705#define MC4 0x0010 /* Enable Mailbox 4 */
3706#define MC5 0x0020 /* Enable Mailbox 5 */
3707#define MC6 0x0040 /* Enable Mailbox 6 */
3708#define MC7 0x0080 /* Enable Mailbox 7 */
3709#define MC8 0x0100 /* Enable Mailbox 8 */
3710#define MC9 0x0200 /* Enable Mailbox 9 */
3711#define MC10 0x0400 /* Enable Mailbox 10 */
3712#define MC11 0x0800 /* Enable Mailbox 11 */
3713#define MC12 0x1000 /* Enable Mailbox 12 */
3714#define MC13 0x2000 /* Enable Mailbox 13 */
3715#define MC14 0x4000 /* Enable Mailbox 14 */
3716#define MC15 0x8000 /* Enable Mailbox 15 */
3717
3718/* CAN_MC2 Masks */
3719#define MC16 0x0001 /* Enable Mailbox 16 */
3720#define MC17 0x0002 /* Enable Mailbox 17 */
3721#define MC18 0x0004 /* Enable Mailbox 18 */
3722#define MC19 0x0008 /* Enable Mailbox 19 */
3723#define MC20 0x0010 /* Enable Mailbox 20 */
3724#define MC21 0x0020 /* Enable Mailbox 21 */
3725#define MC22 0x0040 /* Enable Mailbox 22 */
3726#define MC23 0x0080 /* Enable Mailbox 23 */
3727#define MC24 0x0100 /* Enable Mailbox 24 */
3728#define MC25 0x0200 /* Enable Mailbox 25 */
3729#define MC26 0x0400 /* Enable Mailbox 26 */
3730#define MC27 0x0800 /* Enable Mailbox 27 */
3731#define MC28 0x1000 /* Enable Mailbox 28 */
3732#define MC29 0x2000 /* Enable Mailbox 29 */
3733#define MC30 0x4000 /* Enable Mailbox 30 */
3734#define MC31 0x8000 /* Enable Mailbox 31 */
3735
3736/* CAN_MD1 Masks */
3737#define MD0 0x0001 /* Enable Mailbox 0 For Receive */
3738#define MD1 0x0002 /* Enable Mailbox 1 For Receive */
3739#define MD2 0x0004 /* Enable Mailbox 2 For Receive */
3740#define MD3 0x0008 /* Enable Mailbox 3 For Receive */
3741#define MD4 0x0010 /* Enable Mailbox 4 For Receive */
3742#define MD5 0x0020 /* Enable Mailbox 5 For Receive */
3743#define MD6 0x0040 /* Enable Mailbox 6 For Receive */
3744#define MD7 0x0080 /* Enable Mailbox 7 For Receive */
3745#define MD8 0x0100 /* Enable Mailbox 8 For Receive */
3746#define MD9 0x0200 /* Enable Mailbox 9 For Receive */
3747#define MD10 0x0400 /* Enable Mailbox 10 For Receive */
3748#define MD11 0x0800 /* Enable Mailbox 11 For Receive */
3749#define MD12 0x1000 /* Enable Mailbox 12 For Receive */
3750#define MD13 0x2000 /* Enable Mailbox 13 For Receive */
3751#define MD14 0x4000 /* Enable Mailbox 14 For Receive */
3752#define MD15 0x8000 /* Enable Mailbox 15 For Receive */
3753
3754/* CAN_MD2 Masks */
3755#define MD16 0x0001 /* Enable Mailbox 16 For Receive */
3756#define MD17 0x0002 /* Enable Mailbox 17 For Receive */
3757#define MD18 0x0004 /* Enable Mailbox 18 For Receive */
3758#define MD19 0x0008 /* Enable Mailbox 19 For Receive */
3759#define MD20 0x0010 /* Enable Mailbox 20 For Receive */
3760#define MD21 0x0020 /* Enable Mailbox 21 For Receive */
3761#define MD22 0x0040 /* Enable Mailbox 22 For Receive */
3762#define MD23 0x0080 /* Enable Mailbox 23 For Receive */
3763#define MD24 0x0100 /* Enable Mailbox 24 For Receive */
3764#define MD25 0x0200 /* Enable Mailbox 25 For Receive */
3765#define MD26 0x0400 /* Enable Mailbox 26 For Receive */
3766#define MD27 0x0800 /* Enable Mailbox 27 For Receive */
3767#define MD28 0x1000 /* Enable Mailbox 28 For Receive */
3768#define MD29 0x2000 /* Enable Mailbox 29 For Receive */
3769#define MD30 0x4000 /* Enable Mailbox 30 For Receive */
3770#define MD31 0x8000 /* Enable Mailbox 31 For Receive */
3771
3772/* CAN_RMP1 Masks */
3773#define RMP0 0x0001 /* RX Message Pending In Mailbox 0 */
3774#define RMP1 0x0002 /* RX Message Pending In Mailbox 1 */
3775#define RMP2 0x0004 /* RX Message Pending In Mailbox 2 */
3776#define RMP3 0x0008 /* RX Message Pending In Mailbox 3 */
3777#define RMP4 0x0010 /* RX Message Pending In Mailbox 4 */
3778#define RMP5 0x0020 /* RX Message Pending In Mailbox 5 */
3779#define RMP6 0x0040 /* RX Message Pending In Mailbox 6 */
3780#define RMP7 0x0080 /* RX Message Pending In Mailbox 7 */
3781#define RMP8 0x0100 /* RX Message Pending In Mailbox 8 */
3782#define RMP9 0x0200 /* RX Message Pending In Mailbox 9 */
3783#define RMP10 0x0400 /* RX Message Pending In Mailbox 10 */
3784#define RMP11 0x0800 /* RX Message Pending In Mailbox 11 */
3785#define RMP12 0x1000 /* RX Message Pending In Mailbox 12 */
3786#define RMP13 0x2000 /* RX Message Pending In Mailbox 13 */
3787#define RMP14 0x4000 /* RX Message Pending In Mailbox 14 */
3788#define RMP15 0x8000 /* RX Message Pending In Mailbox 15 */
3789
3790/* CAN_RMP2 Masks */
3791#define RMP16 0x0001 /* RX Message Pending In Mailbox 16 */
3792#define RMP17 0x0002 /* RX Message Pending In Mailbox 17 */
3793#define RMP18 0x0004 /* RX Message Pending In Mailbox 18 */
3794#define RMP19 0x0008 /* RX Message Pending In Mailbox 19 */
3795#define RMP20 0x0010 /* RX Message Pending In Mailbox 20 */
3796#define RMP21 0x0020 /* RX Message Pending In Mailbox 21 */
3797#define RMP22 0x0040 /* RX Message Pending In Mailbox 22 */
3798#define RMP23 0x0080 /* RX Message Pending In Mailbox 23 */
3799#define RMP24 0x0100 /* RX Message Pending In Mailbox 24 */
3800#define RMP25 0x0200 /* RX Message Pending In Mailbox 25 */
3801#define RMP26 0x0400 /* RX Message Pending In Mailbox 26 */
3802#define RMP27 0x0800 /* RX Message Pending In Mailbox 27 */
3803#define RMP28 0x1000 /* RX Message Pending In Mailbox 28 */
3804#define RMP29 0x2000 /* RX Message Pending In Mailbox 29 */
3805#define RMP30 0x4000 /* RX Message Pending In Mailbox 30 */
3806#define RMP31 0x8000 /* RX Message Pending In Mailbox 31 */
3807
3808/* CAN_RML1 Masks */
3809#define RML0 0x0001 /* RX Message Lost In Mailbox 0 */
3810#define RML1 0x0002 /* RX Message Lost In Mailbox 1 */
3811#define RML2 0x0004 /* RX Message Lost In Mailbox 2 */
3812#define RML3 0x0008 /* RX Message Lost In Mailbox 3 */
3813#define RML4 0x0010 /* RX Message Lost In Mailbox 4 */
3814#define RML5 0x0020 /* RX Message Lost In Mailbox 5 */
3815#define RML6 0x0040 /* RX Message Lost In Mailbox 6 */
3816#define RML7 0x0080 /* RX Message Lost In Mailbox 7 */
3817#define RML8 0x0100 /* RX Message Lost In Mailbox 8 */
3818#define RML9 0x0200 /* RX Message Lost In Mailbox 9 */
3819#define RML10 0x0400 /* RX Message Lost In Mailbox 10 */
3820#define RML11 0x0800 /* RX Message Lost In Mailbox 11 */
3821#define RML12 0x1000 /* RX Message Lost In Mailbox 12 */
3822#define RML13 0x2000 /* RX Message Lost In Mailbox 13 */
3823#define RML14 0x4000 /* RX Message Lost In Mailbox 14 */
3824#define RML15 0x8000 /* RX Message Lost In Mailbox 15 */
3825
3826/* CAN_RML2 Masks */
3827#define RML16 0x0001 /* RX Message Lost In Mailbox 16 */
3828#define RML17 0x0002 /* RX Message Lost In Mailbox 17 */
3829#define RML18 0x0004 /* RX Message Lost In Mailbox 18 */
3830#define RML19 0x0008 /* RX Message Lost In Mailbox 19 */
3831#define RML20 0x0010 /* RX Message Lost In Mailbox 20 */
3832#define RML21 0x0020 /* RX Message Lost In Mailbox 21 */
3833#define RML22 0x0040 /* RX Message Lost In Mailbox 22 */
3834#define RML23 0x0080 /* RX Message Lost In Mailbox 23 */
3835#define RML24 0x0100 /* RX Message Lost In Mailbox 24 */
3836#define RML25 0x0200 /* RX Message Lost In Mailbox 25 */
3837#define RML26 0x0400 /* RX Message Lost In Mailbox 26 */
3838#define RML27 0x0800 /* RX Message Lost In Mailbox 27 */
3839#define RML28 0x1000 /* RX Message Lost In Mailbox 28 */
3840#define RML29 0x2000 /* RX Message Lost In Mailbox 29 */
3841#define RML30 0x4000 /* RX Message Lost In Mailbox 30 */
3842#define RML31 0x8000 /* RX Message Lost In Mailbox 31 */
3843
3844/* CAN_OPSS1 Masks */
3845#define OPSS0 0x0001 /* Enable RX Overwrite Protection or TX Single-Shot For Mailbox 0 */
3846#define OPSS1 0x0002 /* Enable RX Overwrite Protection or TX Single-Shot For Mailbox 1 */
3847#define OPSS2 0x0004 /* Enable RX Overwrite Protection or TX Single-Shot For Mailbox 2 */
3848#define OPSS3 0x0008 /* Enable RX Overwrite Protection or TX Single-Shot For Mailbox 3 */
3849#define OPSS4 0x0010 /* Enable RX Overwrite Protection or TX Single-Shot For Mailbox 4 */
3850#define OPSS5 0x0020 /* Enable RX Overwrite Protection or TX Single-Shot For Mailbox 5 */
3851#define OPSS6 0x0040 /* Enable RX Overwrite Protection or TX Single-Shot For Mailbox 6 */
3852#define OPSS7 0x0080 /* Enable RX Overwrite Protection or TX Single-Shot For Mailbox 7 */
3853#define OPSS8 0x0100 /* Enable RX Overwrite Protection or TX Single-Shot For Mailbox 8 */
3854#define OPSS9 0x0200 /* Enable RX Overwrite Protection or TX Single-Shot For Mailbox 9 */
3855#define OPSS10 0x0400 /* Enable RX Overwrite Protection or TX Single-Shot For Mailbox 10 */
3856#define OPSS11 0x0800 /* Enable RX Overwrite Protection or TX Single-Shot For Mailbox 11 */
3857#define OPSS12 0x1000 /* Enable RX Overwrite Protection or TX Single-Shot For Mailbox 12 */
3858#define OPSS13 0x2000 /* Enable RX Overwrite Protection or TX Single-Shot For Mailbox 13 */
3859#define OPSS14 0x4000 /* Enable RX Overwrite Protection or TX Single-Shot For Mailbox 14 */
3860#define OPSS15 0x8000 /* Enable RX Overwrite Protection or TX Single-Shot For Mailbox 15 */
3861
3862/* CAN_OPSS2 Masks */
3863#define OPSS16 0x0001 /* Enable RX Overwrite Protection or TX Single-Shot For Mailbox 16 */
3864#define OPSS17 0x0002 /* Enable RX Overwrite Protection or TX Single-Shot For Mailbox 17 */
3865#define OPSS18 0x0004 /* Enable RX Overwrite Protection or TX Single-Shot For Mailbox 18 */
3866#define OPSS19 0x0008 /* Enable RX Overwrite Protection or TX Single-Shot For Mailbox 19 */
3867#define OPSS20 0x0010 /* Enable RX Overwrite Protection or TX Single-Shot For Mailbox 20 */
3868#define OPSS21 0x0020 /* Enable RX Overwrite Protection or TX Single-Shot For Mailbox 21 */
3869#define OPSS22 0x0040 /* Enable RX Overwrite Protection or TX Single-Shot For Mailbox 22 */
3870#define OPSS23 0x0080 /* Enable RX Overwrite Protection or TX Single-Shot For Mailbox 23 */
3871#define OPSS24 0x0100 /* Enable RX Overwrite Protection or TX Single-Shot For Mailbox 24 */
3872#define OPSS25 0x0200 /* Enable RX Overwrite Protection or TX Single-Shot For Mailbox 25 */
3873#define OPSS26 0x0400 /* Enable RX Overwrite Protection or TX Single-Shot For Mailbox 26 */
3874#define OPSS27 0x0800 /* Enable RX Overwrite Protection or TX Single-Shot For Mailbox 27 */
3875#define OPSS28 0x1000 /* Enable RX Overwrite Protection or TX Single-Shot For Mailbox 28 */
3876#define OPSS29 0x2000 /* Enable RX Overwrite Protection or TX Single-Shot For Mailbox 29 */
3877#define OPSS30 0x4000 /* Enable RX Overwrite Protection or TX Single-Shot For Mailbox 30 */
3878#define OPSS31 0x8000 /* Enable RX Overwrite Protection or TX Single-Shot For Mailbox 31 */
3879
3880/* CAN_TRR1 Masks */
3881#define TRR0 0x0001 /* Deny But Don't Lock Access To Mailbox 0 */
3882#define TRR1 0x0002 /* Deny But Don't Lock Access To Mailbox 1 */
3883#define TRR2 0x0004 /* Deny But Don't Lock Access To Mailbox 2 */
3884#define TRR3 0x0008 /* Deny But Don't Lock Access To Mailbox 3 */
3885#define TRR4 0x0010 /* Deny But Don't Lock Access To Mailbox 4 */
3886#define TRR5 0x0020 /* Deny But Don't Lock Access To Mailbox 5 */
3887#define TRR6 0x0040 /* Deny But Don't Lock Access To Mailbox 6 */
3888#define TRR7 0x0080 /* Deny But Don't Lock Access To Mailbox 7 */
3889#define TRR8 0x0100 /* Deny But Don't Lock Access To Mailbox 8 */
3890#define TRR9 0x0200 /* Deny But Don't Lock Access To Mailbox 9 */
3891#define TRR10 0x0400 /* Deny But Don't Lock Access To Mailbox 10 */
3892#define TRR11 0x0800 /* Deny But Don't Lock Access To Mailbox 11 */
3893#define TRR12 0x1000 /* Deny But Don't Lock Access To Mailbox 12 */
3894#define TRR13 0x2000 /* Deny But Don't Lock Access To Mailbox 13 */
3895#define TRR14 0x4000 /* Deny But Don't Lock Access To Mailbox 14 */
3896#define TRR15 0x8000 /* Deny But Don't Lock Access To Mailbox 15 */
3897
3898/* CAN_TRR2 Masks */
3899#define TRR16 0x0001 /* Deny But Don't Lock Access To Mailbox 16 */
3900#define TRR17 0x0002 /* Deny But Don't Lock Access To Mailbox 17 */
3901#define TRR18 0x0004 /* Deny But Don't Lock Access To Mailbox 18 */
3902#define TRR19 0x0008 /* Deny But Don't Lock Access To Mailbox 19 */
3903#define TRR20 0x0010 /* Deny But Don't Lock Access To Mailbox 20 */
3904#define TRR21 0x0020 /* Deny But Don't Lock Access To Mailbox 21 */
3905#define TRR22 0x0040 /* Deny But Don't Lock Access To Mailbox 22 */
3906#define TRR23 0x0080 /* Deny But Don't Lock Access To Mailbox 23 */
3907#define TRR24 0x0100 /* Deny But Don't Lock Access To Mailbox 24 */
3908#define TRR25 0x0200 /* Deny But Don't Lock Access To Mailbox 25 */
3909#define TRR26 0x0400 /* Deny But Don't Lock Access To Mailbox 26 */
3910#define TRR27 0x0800 /* Deny But Don't Lock Access To Mailbox 27 */
3911#define TRR28 0x1000 /* Deny But Don't Lock Access To Mailbox 28 */
3912#define TRR29 0x2000 /* Deny But Don't Lock Access To Mailbox 29 */
3913#define TRR30 0x4000 /* Deny But Don't Lock Access To Mailbox 30 */
3914#define TRR31 0x8000 /* Deny But Don't Lock Access To Mailbox 31 */
3915
3916/* CAN_TRS1 Masks */
3917#define TRS0 0x0001 /* Remote Frame Request For Mailbox 0 */
3918#define TRS1 0x0002 /* Remote Frame Request For Mailbox 1 */
3919#define TRS2 0x0004 /* Remote Frame Request For Mailbox 2 */
3920#define TRS3 0x0008 /* Remote Frame Request For Mailbox 3 */
3921#define TRS4 0x0010 /* Remote Frame Request For Mailbox 4 */
3922#define TRS5 0x0020 /* Remote Frame Request For Mailbox 5 */
3923#define TRS6 0x0040 /* Remote Frame Request For Mailbox 6 */
3924#define TRS7 0x0080 /* Remote Frame Request For Mailbox 7 */
3925#define TRS8 0x0100 /* Remote Frame Request For Mailbox 8 */
3926#define TRS9 0x0200 /* Remote Frame Request For Mailbox 9 */
3927#define TRS10 0x0400 /* Remote Frame Request For Mailbox 10 */
3928#define TRS11 0x0800 /* Remote Frame Request For Mailbox 11 */
3929#define TRS12 0x1000 /* Remote Frame Request For Mailbox 12 */
3930#define TRS13 0x2000 /* Remote Frame Request For Mailbox 13 */
3931#define TRS14 0x4000 /* Remote Frame Request For Mailbox 14 */
3932#define TRS15 0x8000 /* Remote Frame Request For Mailbox 15 */
3933
3934/* CAN_TRS2 Masks */
3935#define TRS16 0x0001 /* Remote Frame Request For Mailbox 16 */
3936#define TRS17 0x0002 /* Remote Frame Request For Mailbox 17 */
3937#define TRS18 0x0004 /* Remote Frame Request For Mailbox 18 */
3938#define TRS19 0x0008 /* Remote Frame Request For Mailbox 19 */
3939#define TRS20 0x0010 /* Remote Frame Request For Mailbox 20 */
3940#define TRS21 0x0020 /* Remote Frame Request For Mailbox 21 */
3941#define TRS22 0x0040 /* Remote Frame Request For Mailbox 22 */
3942#define TRS23 0x0080 /* Remote Frame Request For Mailbox 23 */
3943#define TRS24 0x0100 /* Remote Frame Request For Mailbox 24 */
3944#define TRS25 0x0200 /* Remote Frame Request For Mailbox 25 */
3945#define TRS26 0x0400 /* Remote Frame Request For Mailbox 26 */
3946#define TRS27 0x0800 /* Remote Frame Request For Mailbox 27 */
3947#define TRS28 0x1000 /* Remote Frame Request For Mailbox 28 */
3948#define TRS29 0x2000 /* Remote Frame Request For Mailbox 29 */
3949#define TRS30 0x4000 /* Remote Frame Request For Mailbox 30 */
3950#define TRS31 0x8000 /* Remote Frame Request For Mailbox 31 */
3951
3952/* CAN_AA1 Masks */
3953#define AA0 0x0001 /* Aborted Message In Mailbox 0 */
3954#define AA1 0x0002 /* Aborted Message In Mailbox 1 */
3955#define AA2 0x0004 /* Aborted Message In Mailbox 2 */
3956#define AA3 0x0008 /* Aborted Message In Mailbox 3 */
3957#define AA4 0x0010 /* Aborted Message In Mailbox 4 */
3958#define AA5 0x0020 /* Aborted Message In Mailbox 5 */
3959#define AA6 0x0040 /* Aborted Message In Mailbox 6 */
3960#define AA7 0x0080 /* Aborted Message In Mailbox 7 */
3961#define AA8 0x0100 /* Aborted Message In Mailbox 8 */
3962#define AA9 0x0200 /* Aborted Message In Mailbox 9 */
3963#define AA10 0x0400 /* Aborted Message In Mailbox 10 */
3964#define AA11 0x0800 /* Aborted Message In Mailbox 11 */
3965#define AA12 0x1000 /* Aborted Message In Mailbox 12 */
3966#define AA13 0x2000 /* Aborted Message In Mailbox 13 */
3967#define AA14 0x4000 /* Aborted Message In Mailbox 14 */
3968#define AA15 0x8000 /* Aborted Message In Mailbox 15 */
3969
3970/* CAN_AA2 Masks */
3971#define AA16 0x0001 /* Aborted Message In Mailbox 16 */
3972#define AA17 0x0002 /* Aborted Message In Mailbox 17 */
3973#define AA18 0x0004 /* Aborted Message In Mailbox 18 */
3974#define AA19 0x0008 /* Aborted Message In Mailbox 19 */
3975#define AA20 0x0010 /* Aborted Message In Mailbox 20 */
3976#define AA21 0x0020 /* Aborted Message In Mailbox 21 */
3977#define AA22 0x0040 /* Aborted Message In Mailbox 22 */
3978#define AA23 0x0080 /* Aborted Message In Mailbox 23 */
3979#define AA24 0x0100 /* Aborted Message In Mailbox 24 */
3980#define AA25 0x0200 /* Aborted Message In Mailbox 25 */
3981#define AA26 0x0400 /* Aborted Message In Mailbox 26 */
3982#define AA27 0x0800 /* Aborted Message In Mailbox 27 */
3983#define AA28 0x1000 /* Aborted Message In Mailbox 28 */
3984#define AA29 0x2000 /* Aborted Message In Mailbox 29 */
3985#define AA30 0x4000 /* Aborted Message In Mailbox 30 */
3986#define AA31 0x8000 /* Aborted Message In Mailbox 31 */
3987
3988/* CAN_TA1 Masks */
3989#define TA0 0x0001 /* Transmit Successful From Mailbox 0 */
3990#define TA1 0x0002 /* Transmit Successful From Mailbox 1 */
3991#define TA2 0x0004 /* Transmit Successful From Mailbox 2 */
3992#define TA3 0x0008 /* Transmit Successful From Mailbox 3 */
3993#define TA4 0x0010 /* Transmit Successful From Mailbox 4 */
3994#define TA5 0x0020 /* Transmit Successful From Mailbox 5 */
3995#define TA6 0x0040 /* Transmit Successful From Mailbox 6 */
3996#define TA7 0x0080 /* Transmit Successful From Mailbox 7 */
3997#define TA8 0x0100 /* Transmit Successful From Mailbox 8 */
3998#define TA9 0x0200 /* Transmit Successful From Mailbox 9 */
3999#define TA10 0x0400 /* Transmit Successful From Mailbox 10 */
4000#define TA11 0x0800 /* Transmit Successful From Mailbox 11 */
4001#define TA12 0x1000 /* Transmit Successful From Mailbox 12 */
4002#define TA13 0x2000 /* Transmit Successful From Mailbox 13 */
4003#define TA14 0x4000 /* Transmit Successful From Mailbox 14 */
4004#define TA15 0x8000 /* Transmit Successful From Mailbox 15 */
4005
4006/* CAN_TA2 Masks */
4007#define TA16 0x0001 /* Transmit Successful From Mailbox 16 */
4008#define TA17 0x0002 /* Transmit Successful From Mailbox 17 */
4009#define TA18 0x0004 /* Transmit Successful From Mailbox 18 */
4010#define TA19 0x0008 /* Transmit Successful From Mailbox 19 */
4011#define TA20 0x0010 /* Transmit Successful From Mailbox 20 */
4012#define TA21 0x0020 /* Transmit Successful From Mailbox 21 */
4013#define TA22 0x0040 /* Transmit Successful From Mailbox 22 */
4014#define TA23 0x0080 /* Transmit Successful From Mailbox 23 */
4015#define TA24 0x0100 /* Transmit Successful From Mailbox 24 */
4016#define TA25 0x0200 /* Transmit Successful From Mailbox 25 */
4017#define TA26 0x0400 /* Transmit Successful From Mailbox 26 */
4018#define TA27 0x0800 /* Transmit Successful From Mailbox 27 */
4019#define TA28 0x1000 /* Transmit Successful From Mailbox 28 */
4020#define TA29 0x2000 /* Transmit Successful From Mailbox 29 */
4021#define TA30 0x4000 /* Transmit Successful From Mailbox 30 */
4022#define TA31 0x8000 /* Transmit Successful From Mailbox 31 */
4023
4024/* CAN_MBTD Masks */
4025#define TDPTR 0x001F /* Mailbox To Temporarily Disable */
4026#define TDA 0x0040 /* Temporary Disable Acknowledge */
4027#define TDR 0x0080 /* Temporary Disable Request */
4028
4029/* CAN_RFH1 Masks */
4030#define RFH0 0x0001 /* Enable Automatic Remote Frame Handling For Mailbox 0 */
4031#define RFH1 0x0002 /* Enable Automatic Remote Frame Handling For Mailbox 1 */
4032#define RFH2 0x0004 /* Enable Automatic Remote Frame Handling For Mailbox 2 */
4033#define RFH3 0x0008 /* Enable Automatic Remote Frame Handling For Mailbox 3 */
4034#define RFH4 0x0010 /* Enable Automatic Remote Frame Handling For Mailbox 4 */
4035#define RFH5 0x0020 /* Enable Automatic Remote Frame Handling For Mailbox 5 */
4036#define RFH6 0x0040 /* Enable Automatic Remote Frame Handling For Mailbox 6 */
4037#define RFH7 0x0080 /* Enable Automatic Remote Frame Handling For Mailbox 7 */
4038#define RFH8 0x0100 /* Enable Automatic Remote Frame Handling For Mailbox 8 */
4039#define RFH9 0x0200 /* Enable Automatic Remote Frame Handling For Mailbox 9 */
4040#define RFH10 0x0400 /* Enable Automatic Remote Frame Handling For Mailbox 10 */
4041#define RFH11 0x0800 /* Enable Automatic Remote Frame Handling For Mailbox 11 */
4042#define RFH12 0x1000 /* Enable Automatic Remote Frame Handling For Mailbox 12 */
4043#define RFH13 0x2000 /* Enable Automatic Remote Frame Handling For Mailbox 13 */
4044#define RFH14 0x4000 /* Enable Automatic Remote Frame Handling For Mailbox 14 */
4045#define RFH15 0x8000 /* Enable Automatic Remote Frame Handling For Mailbox 15 */
4046
4047/* CAN_RFH2 Masks */
4048#define RFH16 0x0001 /* Enable Automatic Remote Frame Handling For Mailbox 16 */
4049#define RFH17 0x0002 /* Enable Automatic Remote Frame Handling For Mailbox 17 */
4050#define RFH18 0x0004 /* Enable Automatic Remote Frame Handling For Mailbox 18 */
4051#define RFH19 0x0008 /* Enable Automatic Remote Frame Handling For Mailbox 19 */
4052#define RFH20 0x0010 /* Enable Automatic Remote Frame Handling For Mailbox 20 */
4053#define RFH21 0x0020 /* Enable Automatic Remote Frame Handling For Mailbox 21 */
4054#define RFH22 0x0040 /* Enable Automatic Remote Frame Handling For Mailbox 22 */
4055#define RFH23 0x0080 /* Enable Automatic Remote Frame Handling For Mailbox 23 */
4056#define RFH24 0x0100 /* Enable Automatic Remote Frame Handling For Mailbox 24 */
4057#define RFH25 0x0200 /* Enable Automatic Remote Frame Handling For Mailbox 25 */
4058#define RFH26 0x0400 /* Enable Automatic Remote Frame Handling For Mailbox 26 */
4059#define RFH27 0x0800 /* Enable Automatic Remote Frame Handling For Mailbox 27 */
4060#define RFH28 0x1000 /* Enable Automatic Remote Frame Handling For Mailbox 28 */
4061#define RFH29 0x2000 /* Enable Automatic Remote Frame Handling For Mailbox 29 */
4062#define RFH30 0x4000 /* Enable Automatic Remote Frame Handling For Mailbox 30 */
4063#define RFH31 0x8000 /* Enable Automatic Remote Frame Handling For Mailbox 31 */
4064
4065/* CAN_MBTIF1 Masks */
4066#define MBTIF0 0x0001 /* TX Interrupt Active In Mailbox 0 */
4067#define MBTIF1 0x0002 /* TX Interrupt Active In Mailbox 1 */
4068#define MBTIF2 0x0004 /* TX Interrupt Active In Mailbox 2 */
4069#define MBTIF3 0x0008 /* TX Interrupt Active In Mailbox 3 */
4070#define MBTIF4 0x0010 /* TX Interrupt Active In Mailbox 4 */
4071#define MBTIF5 0x0020 /* TX Interrupt Active In Mailbox 5 */
4072#define MBTIF6 0x0040 /* TX Interrupt Active In Mailbox 6 */
4073#define MBTIF7 0x0080 /* TX Interrupt Active In Mailbox 7 */
4074#define MBTIF8 0x0100 /* TX Interrupt Active In Mailbox 8 */
4075#define MBTIF9 0x0200 /* TX Interrupt Active In Mailbox 9 */
4076#define MBTIF10 0x0400 /* TX Interrupt Active In Mailbox 10 */
4077#define MBTIF11 0x0800 /* TX Interrupt Active In Mailbox 11 */
4078#define MBTIF12 0x1000 /* TX Interrupt Active In Mailbox 12 */
4079#define MBTIF13 0x2000 /* TX Interrupt Active In Mailbox 13 */
4080#define MBTIF14 0x4000 /* TX Interrupt Active In Mailbox 14 */
4081#define MBTIF15 0x8000 /* TX Interrupt Active In Mailbox 15 */
4082
4083/* CAN_MBTIF2 Masks */
4084#define MBTIF16 0x0001 /* TX Interrupt Active In Mailbox 16 */
4085#define MBTIF17 0x0002 /* TX Interrupt Active In Mailbox 17 */
4086#define MBTIF18 0x0004 /* TX Interrupt Active In Mailbox 18 */
4087#define MBTIF19 0x0008 /* TX Interrupt Active In Mailbox 19 */
4088#define MBTIF20 0x0010 /* TX Interrupt Active In Mailbox 20 */
4089#define MBTIF21 0x0020 /* TX Interrupt Active In Mailbox 21 */
4090#define MBTIF22 0x0040 /* TX Interrupt Active In Mailbox 22 */
4091#define MBTIF23 0x0080 /* TX Interrupt Active In Mailbox 23 */
4092#define MBTIF24 0x0100 /* TX Interrupt Active In Mailbox 24 */
4093#define MBTIF25 0x0200 /* TX Interrupt Active In Mailbox 25 */
4094#define MBTIF26 0x0400 /* TX Interrupt Active In Mailbox 26 */
4095#define MBTIF27 0x0800 /* TX Interrupt Active In Mailbox 27 */
4096#define MBTIF28 0x1000 /* TX Interrupt Active In Mailbox 28 */
4097#define MBTIF29 0x2000 /* TX Interrupt Active In Mailbox 29 */
4098#define MBTIF30 0x4000 /* TX Interrupt Active In Mailbox 30 */
4099#define MBTIF31 0x8000 /* TX Interrupt Active In Mailbox 31 */
4100
4101/* CAN_MBRIF1 Masks */
4102#define MBRIF0 0x0001 /* RX Interrupt Active In Mailbox 0 */
4103#define MBRIF1 0x0002 /* RX Interrupt Active In Mailbox 1 */
4104#define MBRIF2 0x0004 /* RX Interrupt Active In Mailbox 2 */
4105#define MBRIF3 0x0008 /* RX Interrupt Active In Mailbox 3 */
4106#define MBRIF4 0x0010 /* RX Interrupt Active In Mailbox 4 */
4107#define MBRIF5 0x0020 /* RX Interrupt Active In Mailbox 5 */
4108#define MBRIF6 0x0040 /* RX Interrupt Active In Mailbox 6 */
4109#define MBRIF7 0x0080 /* RX Interrupt Active In Mailbox 7 */
4110#define MBRIF8 0x0100 /* RX Interrupt Active In Mailbox 8 */
4111#define MBRIF9 0x0200 /* RX Interrupt Active In Mailbox 9 */
4112#define MBRIF10 0x0400 /* RX Interrupt Active In Mailbox 10 */
4113#define MBRIF11 0x0800 /* RX Interrupt Active In Mailbox 11 */
4114#define MBRIF12 0x1000 /* RX Interrupt Active In Mailbox 12 */
4115#define MBRIF13 0x2000 /* RX Interrupt Active In Mailbox 13 */
4116#define MBRIF14 0x4000 /* RX Interrupt Active In Mailbox 14 */
4117#define MBRIF15 0x8000 /* RX Interrupt Active In Mailbox 15 */
4118
4119/* CAN_MBRIF2 Masks */
4120#define MBRIF16 0x0001 /* RX Interrupt Active In Mailbox 16 */
4121#define MBRIF17 0x0002 /* RX Interrupt Active In Mailbox 17 */
4122#define MBRIF18 0x0004 /* RX Interrupt Active In Mailbox 18 */
4123#define MBRIF19 0x0008 /* RX Interrupt Active In Mailbox 19 */
4124#define MBRIF20 0x0010 /* RX Interrupt Active In Mailbox 20 */
4125#define MBRIF21 0x0020 /* RX Interrupt Active In Mailbox 21 */
4126#define MBRIF22 0x0040 /* RX Interrupt Active In Mailbox 22 */
4127#define MBRIF23 0x0080 /* RX Interrupt Active In Mailbox 23 */
4128#define MBRIF24 0x0100 /* RX Interrupt Active In Mailbox 24 */
4129#define MBRIF25 0x0200 /* RX Interrupt Active In Mailbox 25 */
4130#define MBRIF26 0x0400 /* RX Interrupt Active In Mailbox 26 */
4131#define MBRIF27 0x0800 /* RX Interrupt Active In Mailbox 27 */
4132#define MBRIF28 0x1000 /* RX Interrupt Active In Mailbox 28 */
4133#define MBRIF29 0x2000 /* RX Interrupt Active In Mailbox 29 */
4134#define MBRIF30 0x4000 /* RX Interrupt Active In Mailbox 30 */
4135#define MBRIF31 0x8000 /* RX Interrupt Active In Mailbox 31 */
4136
4137/* CAN_MBIM1 Masks */
4138#define MBIM0 0x0001 /* Enable Interrupt For Mailbox 0 */
4139#define MBIM1 0x0002 /* Enable Interrupt For Mailbox 1 */
4140#define MBIM2 0x0004 /* Enable Interrupt For Mailbox 2 */
4141#define MBIM3 0x0008 /* Enable Interrupt For Mailbox 3 */
4142#define MBIM4 0x0010 /* Enable Interrupt For Mailbox 4 */
4143#define MBIM5 0x0020 /* Enable Interrupt For Mailbox 5 */
4144#define MBIM6 0x0040 /* Enable Interrupt For Mailbox 6 */
4145#define MBIM7 0x0080 /* Enable Interrupt For Mailbox 7 */
4146#define MBIM8 0x0100 /* Enable Interrupt For Mailbox 8 */
4147#define MBIM9 0x0200 /* Enable Interrupt For Mailbox 9 */
4148#define MBIM10 0x0400 /* Enable Interrupt For Mailbox 10 */
4149#define MBIM11 0x0800 /* Enable Interrupt For Mailbox 11 */
4150#define MBIM12 0x1000 /* Enable Interrupt For Mailbox 12 */
4151#define MBIM13 0x2000 /* Enable Interrupt For Mailbox 13 */
4152#define MBIM14 0x4000 /* Enable Interrupt For Mailbox 14 */
4153#define MBIM15 0x8000 /* Enable Interrupt For Mailbox 15 */
4154
4155/* CAN_MBIM2 Masks */
4156#define MBIM16 0x0001 /* Enable Interrupt For Mailbox 16 */
4157#define MBIM17 0x0002 /* Enable Interrupt For Mailbox 17 */
4158#define MBIM18 0x0004 /* Enable Interrupt For Mailbox 18 */
4159#define MBIM19 0x0008 /* Enable Interrupt For Mailbox 19 */
4160#define MBIM20 0x0010 /* Enable Interrupt For Mailbox 20 */
4161#define MBIM21 0x0020 /* Enable Interrupt For Mailbox 21 */
4162#define MBIM22 0x0040 /* Enable Interrupt For Mailbox 22 */
4163#define MBIM23 0x0080 /* Enable Interrupt For Mailbox 23 */
4164#define MBIM24 0x0100 /* Enable Interrupt For Mailbox 24 */
4165#define MBIM25 0x0200 /* Enable Interrupt For Mailbox 25 */
4166#define MBIM26 0x0400 /* Enable Interrupt For Mailbox 26 */
4167#define MBIM27 0x0800 /* Enable Interrupt For Mailbox 27 */
4168#define MBIM28 0x1000 /* Enable Interrupt For Mailbox 28 */
4169#define MBIM29 0x2000 /* Enable Interrupt For Mailbox 29 */
4170#define MBIM30 0x4000 /* Enable Interrupt For Mailbox 30 */
4171#define MBIM31 0x8000 /* Enable Interrupt For Mailbox 31 */
4172
4173/* CAN_GIM Masks */
4174#define EWTIM 0x0001 /* Enable TX Error Count Interrupt */
4175#define EWRIM 0x0002 /* Enable RX Error Count Interrupt */
4176#define EPIM 0x0004 /* Enable Error-Passive Mode Interrupt */
4177#define BOIM 0x0008 /* Enable Bus Off Interrupt */
4178#define WUIM 0x0010 /* Enable Wake-Up Interrupt */
4179#define UIAIM 0x0020 /* Enable Access To Unimplemented Address Interrupt */
4180#define AAIM 0x0040 /* Enable Abort Acknowledge Interrupt */
4181#define RMLIM 0x0080 /* Enable RX Message Lost Interrupt */
4182#define UCEIM 0x0100 /* Enable Universal Counter Overflow Interrupt */
4183#define EXTIM 0x0200 /* Enable External Trigger Output Interrupt */
4184#define ADIM 0x0400 /* Enable Access Denied Interrupt */
4185
4186/* CAN_GIS Masks */
4187#define EWTIS 0x0001 /* TX Error Count IRQ Status */
4188#define EWRIS 0x0002 /* RX Error Count IRQ Status */
4189#define EPIS 0x0004 /* Error-Passive Mode IRQ Status */
4190#define BOIS 0x0008 /* Bus Off IRQ Status */
4191#define WUIS 0x0010 /* Wake-Up IRQ Status */
4192#define UIAIS 0x0020 /* Access To Unimplemented Address IRQ Status */
4193#define AAIS 0x0040 /* Abort Acknowledge IRQ Status */
4194#define RMLIS 0x0080 /* RX Message Lost IRQ Status */
4195#define UCEIS 0x0100 /* Universal Counter Overflow IRQ Status */
4196#define EXTIS 0x0200 /* External Trigger Output IRQ Status */
4197#define ADIS 0x0400 /* Access Denied IRQ Status */
4198
4199/* CAN_GIF Masks */
4200#define EWTIF 0x0001 /* TX Error Count IRQ Flag */
4201#define EWRIF 0x0002 /* RX Error Count IRQ Flag */
4202#define EPIF 0x0004 /* Error-Passive Mode IRQ Flag */
4203#define BOIF 0x0008 /* Bus Off IRQ Flag */
4204#define WUIF 0x0010 /* Wake-Up IRQ Flag */
4205#define UIAIF 0x0020 /* Access To Unimplemented Address IRQ Flag */
4206#define AAIF 0x0040 /* Abort Acknowledge IRQ Flag */
4207#define RMLIF 0x0080 /* RX Message Lost IRQ Flag */
4208#define UCEIF 0x0100 /* Universal Counter Overflow IRQ Flag */
4209#define EXTIF 0x0200 /* External Trigger Output IRQ Flag */
4210#define ADIF 0x0400 /* Access Denied IRQ Flag */
4211
4212/* CAN_UCCNF Masks */
4213#define UCCNF 0x000F /* Universal Counter Mode */
4214#define UC_STAMP 0x0001 /* Timestamp Mode */
4215#define UC_WDOG 0x0002 /* Watchdog Mode */
4216#define UC_AUTOTX 0x0003 /* Auto-Transmit Mode */
4217#define UC_ERROR 0x0006 /* CAN Error Frame Count */
4218#define UC_OVER 0x0007 /* CAN Overload Frame Count */
4219#define UC_LOST 0x0008 /* Arbitration Lost During TX Count */
4220#define UC_AA 0x0009 /* TX Abort Count */
4221#define UC_TA 0x000A /* TX Successful Count */
4222#define UC_REJECT 0x000B /* RX Message Rejected Count */
4223#define UC_RML 0x000C /* RX Message Lost Count */
4224#define UC_RX 0x000D /* Total Successful RX Messages Count */
4225#define UC_RMP 0x000E /* Successful RX W/Matching ID Count */
4226#define UC_ALL 0x000F /* Correct Message On CAN Bus Line Count */
4227#define UCRC 0x0020 /* Universal Counter Reload/Clear */
4228#define UCCT 0x0040 /* Universal Counter CAN Trigger */
4229#define UCE 0x0080 /* Universal Counter Enable */
4230
4231/* CAN_ESR Masks */
4232#define ACKE 0x0004 /* Acknowledge Error */
4233#define SER 0x0008 /* Stuff Error */
4234#define CRCE 0x0010 /* CRC Error */
4235#define SA0 0x0020 /* Stuck At Dominant Error */
4236#define BEF 0x0040 /* Bit Error Flag */
4237#define FER 0x0080 /* Form Error Flag */
4238
4239/* CAN_EWR Masks */
4240#define EWLREC 0x00FF /* RX Error Count Limit (For EWRIS) */
4241#define EWLTEC 0xFF00 /* TX Error Count Limit (For EWTIS) */
4242
4243#endif /* _DEF_BF539_H */
diff --git a/arch/blackfin/mach-bf538/include/mach/dma.h b/arch/blackfin/mach-bf538/include/mach/dma.h
new file mode 100644
index 000000000000..eb05cacbf4d3
--- /dev/null
+++ b/arch/blackfin/mach-bf538/include/mach/dma.h
@@ -0,0 +1,41 @@
1/* mach/dma.h - arch-specific DMA defines
2 *
3 * Copyright 2004-2008 Analog Devices Inc.
4 *
5 * Licensed under the GPL-2 or later.
6 */
7
8#ifndef _MACH_DMA_H_
9#define _MACH_DMA_H_
10
11#define CH_PPI 0
12#define CH_SPORT0_RX 1
13#define CH_SPORT0_TX 2
14#define CH_SPORT1_RX 3
15#define CH_SPORT1_TX 4
16#define CH_SPI0 5
17#define CH_UART0_RX 6
18#define CH_UART0_TX 7
19#define CH_SPORT2_RX 8
20#define CH_SPORT2_TX 9
21#define CH_SPORT3_RX 10
22#define CH_SPORT3_TX 11
23#define CH_SPI1 14
24#define CH_SPI2 15
25#define CH_UART1_RX 16
26#define CH_UART1_TX 17
27#define CH_UART2_RX 18
28#define CH_UART2_TX 19
29
30#define CH_MEM_STREAM0_DEST 20
31#define CH_MEM_STREAM0_SRC 21
32#define CH_MEM_STREAM1_DEST 22
33#define CH_MEM_STREAM1_SRC 23
34#define CH_MEM_STREAM2_DEST 24
35#define CH_MEM_STREAM2_SRC 25
36#define CH_MEM_STREAM3_DEST 26
37#define CH_MEM_STREAM3_SRC 27
38
39#define MAX_DMA_CHANNELS 28
40
41#endif
diff --git a/arch/blackfin/mach-bf538/include/mach/gpio.h b/arch/blackfin/mach-bf538/include/mach/gpio.h
new file mode 100644
index 000000000000..30f4f723f7cc
--- /dev/null
+++ b/arch/blackfin/mach-bf538/include/mach/gpio.h
@@ -0,0 +1,79 @@
1/*
2 * File: arch/blackfin/mach-bf538/include/mach/gpio.h
3 * Bugs: Enter bugs at http://blackfin.uclinux.org/
4 *
5 * Copyright (C) 2008 Analog Devices Inc.
6 * Licensed under the GPL-2 or later.
7 */
8
9
10#ifndef _MACH_GPIO_H_
11#define _MACH_GPIO_H_
12
13 /* FIXME:
14 * For now only support PORTF GPIOs.
15 * PORT C,D and E are for peripheral usage only
16 */
17#define MAX_BLACKFIN_GPIOS 16
18
19#define GPIO_PF0 0 /* PF */
20#define GPIO_PF1 1
21#define GPIO_PF2 2
22#define GPIO_PF3 3
23#define GPIO_PF4 4
24#define GPIO_PF5 5
25#define GPIO_PF6 6
26#define GPIO_PF7 7
27#define GPIO_PF8 8
28#define GPIO_PF9 9
29#define GPIO_PF10 10
30#define GPIO_PF11 11
31#define GPIO_PF12 12
32#define GPIO_PF13 13
33#define GPIO_PF14 14
34#define GPIO_PF15 15
35#define GPIO_PC0 16 /* PC */
36#define GPIO_PC1 17
37#define GPIO_PC4 20
38#define GPIO_PC5 21
39#define GPIO_PC6 22
40#define GPIO_PC7 23
41#define GPIO_PC8 24
42#define GPIO_PC9 25
43#define GPIO_PD0 32 /* PD */
44#define GPIO_PD1 33
45#define GPIO_PD2 34
46#define GPIO_PD3 35
47#define GPIO_PD4 36
48#define GPIO_PD5 37
49#define GPIO_PD6 38
50#define GPIO_PD7 39
51#define GPIO_PD8 40
52#define GPIO_PD9 41
53#define GPIO_PD10 42
54#define GPIO_PD11 43
55#define GPIO_PD12 44
56#define GPIO_PD13 45
57#define GPIO_PE0 48 /* PE */
58#define GPIO_PE1 49
59#define GPIO_PE2 50
60#define GPIO_PE3 51
61#define GPIO_PE4 52
62#define GPIO_PE5 53
63#define GPIO_PE6 54
64#define GPIO_PE7 55
65#define GPIO_PE8 56
66#define GPIO_PE9 57
67#define GPIO_PE10 58
68#define GPIO_PE11 59
69#define GPIO_PE12 60
70#define GPIO_PE13 61
71#define GPIO_PE14 62
72#define GPIO_PE15 63
73
74#define PORT_F GPIO_PF0
75#define PORT_C GPIO_PC0
76#define PORT_D GPIO_PD0
77#define PORT_E GPIO_PE0
78
79#endif /* _MACH_GPIO_H_ */
diff --git a/arch/blackfin/mach-bf538/include/mach/irq.h b/arch/blackfin/mach-bf538/include/mach/irq.h
new file mode 100644
index 000000000000..fdc87fe2c174
--- /dev/null
+++ b/arch/blackfin/mach-bf538/include/mach/irq.h
@@ -0,0 +1,211 @@
1/*
2 * file: include/asm-blackfin/mach-bf538/irq.h
3 * based on: include/asm-blackfin/mach-bf537/irq.h
4 * author: Michael Hennerich (michael.hennerich@analog.com)
5 *
6 * created:
7 * description:
8 * system mmr register map
9 * rev:
10 *
11 * modified:
12 *
13 *
14 * bugs: enter bugs at http://blackfin.uclinux.org/
15 *
16 * this program is free software; you can redistribute it and/or modify
17 * it under the terms of the gnu general public license as published by
18 * the free software foundation; either version 2, or (at your option)
19 * any later version.
20 *
21 * this program is distributed in the hope that it will be useful,
22 * but without any warranty; without even the implied warranty of
23 * merchantability or fitness for a particular purpose. see the
24 * gnu general public license for more details.
25 *
26 * you should have received a copy of the gnu general public license
27 * along with this program; see the file copying.
28 * if not, write to the free software foundation,
29 * 59 temple place - suite 330, boston, ma 02111-1307, usa.
30 */
31
32#ifndef _BF538_IRQ_H_
33#define _BF538_IRQ_H_
34
35/*
36 * Interrupt source definitions
37 Event Source Core Event Name
38 Core Emulation **
39 Events (highest priority) EMU 0
40 Reset RST 1
41 NMI NMI 2
42 Exception EVX 3
43 Reserved -- 4
44 Hardware Error IVHW 5
45 Core Timer IVTMR 6 *
46
47 .....
48
49 Software Interrupt 1 IVG14 31
50 Software Interrupt 2 --
51 (lowest priority) IVG15 32 *
52*/
53
54#define NR_PERI_INTS (2 * 32)
55
56/* The ABSTRACT IRQ definitions */
57/** the first seven of the following are fixed, the rest you change if you need to **/
58#define IRQ_EMU 0 /* Emulation */
59#define IRQ_RST 1 /* reset */
60#define IRQ_NMI 2 /* Non Maskable */
61#define IRQ_EVX 3 /* Exception */
62#define IRQ_UNUSED 4 /* - unused interrupt */
63#define IRQ_HWERR 5 /* Hardware Error */
64#define IRQ_CORETMR 6 /* Core timer */
65
66#define BFIN_IRQ(x) ((x) + 7)
67
68#define IRQ_PLL_WAKEUP BFIN_IRQ(0) /* PLL Wakeup Interrupt */
69#define IRQ_DMA0_ERROR BFIN_IRQ(1) /* DMA Error 0 (generic) */
70#define IRQ_PPI_ERROR BFIN_IRQ(2) /* PPI Error */
71#define IRQ_SPORT0_ERROR BFIN_IRQ(3) /* SPORT0 Status */
72#define IRQ_SPORT1_ERROR BFIN_IRQ(4) /* SPORT1 Status */
73#define IRQ_SPI0_ERROR BFIN_IRQ(5) /* SPI0 Status */
74#define IRQ_UART0_ERROR BFIN_IRQ(6) /* UART0 Status */
75#define IRQ_RTC BFIN_IRQ(7) /* RTC */
76#define IRQ_PPI BFIN_IRQ(8) /* DMA Channel 0 (PPI) */
77#define IRQ_SPORT0_RX BFIN_IRQ(9) /* DMA 1 Channel (SPORT0 RX) */
78#define IRQ_SPORT0_TX BFIN_IRQ(10) /* DMA 2 Channel (SPORT0 TX) */
79#define IRQ_SPORT1_RX BFIN_IRQ(11) /* DMA 3 Channel (SPORT1 RX) */
80#define IRQ_SPORT1_TX BFIN_IRQ(12) /* DMA 4 Channel (SPORT1 TX) */
81#define IRQ_SPI0 BFIN_IRQ(13) /* DMA 5 Channel (SPI0) */
82#define IRQ_UART0_RX BFIN_IRQ(14) /* DMA 6 Channel (UART0 RX) */
83#define IRQ_UART0_TX BFIN_IRQ(15) /* DMA 7 Channel (UART0 TX) */
84#define IRQ_TIMER0 BFIN_IRQ(16) /* Timer 0 */
85#define IRQ_TIMER1 BFIN_IRQ(17) /* Timer 1 */
86#define IRQ_TIMER2 BFIN_IRQ(18) /* Timer 2 */
87#define IRQ_PORTF_INTA BFIN_IRQ(19) /* Port F Interrupt A */
88#define IRQ_PORTF_INTB BFIN_IRQ(20) /* Port F Interrupt B */
89#define IRQ_MEM0_DMA0 BFIN_IRQ(21) /* MDMA0 Stream 0 */
90#define IRQ_MEM0_DMA1 BFIN_IRQ(22) /* MDMA0 Stream 1 */
91#define IRQ_WATCH BFIN_IRQ(23) /* Software Watchdog Timer */
92#define IRQ_DMA1_ERROR BFIN_IRQ(24) /* DMA Error 1 (generic) */
93#define IRQ_SPORT2_ERROR BFIN_IRQ(25) /* SPORT2 Status */
94#define IRQ_SPORT3_ERROR BFIN_IRQ(26) /* SPORT3 Status */
95#define IRQ_SPI1_ERROR BFIN_IRQ(28) /* SPI1 Status */
96#define IRQ_SPI2_ERROR BFIN_IRQ(29) /* SPI2 Status */
97#define IRQ_UART1_ERROR BFIN_IRQ(30) /* UART1 Status */
98#define IRQ_UART2_ERROR BFIN_IRQ(31) /* UART2 Status */
99#define IRQ_CAN_ERROR BFIN_IRQ(32) /* CAN Status (Error) Interrupt */
100#define IRQ_SPORT2_RX BFIN_IRQ(33) /* DMA 8 Channel (SPORT2 RX) */
101#define IRQ_SPORT2_TX BFIN_IRQ(34) /* DMA 9 Channel (SPORT2 TX) */
102#define IRQ_SPORT3_RX BFIN_IRQ(35) /* DMA 10 Channel (SPORT3 RX) */
103#define IRQ_SPORT3_TX BFIN_IRQ(36) /* DMA 11 Channel (SPORT3 TX) */
104#define IRQ_SPI1 BFIN_IRQ(39) /* DMA 14 Channel (SPI1) */
105#define IRQ_SPI2 BFIN_IRQ(40) /* DMA 15 Channel (SPI2) */
106#define IRQ_UART1_RX BFIN_IRQ(41) /* DMA 16 Channel (UART1 RX) */
107#define IRQ_UART1_TX BFIN_IRQ(42) /* DMA 17 Channel (UART1 TX) */
108#define IRQ_UART2_RX BFIN_IRQ(43) /* DMA 18 Channel (UART2 RX) */
109#define IRQ_UART2_TX BFIN_IRQ(44) /* DMA 19 Channel (UART2 TX) */
110#define IRQ_TWI0 BFIN_IRQ(45) /* TWI0 */
111#define IRQ_TWI1 BFIN_IRQ(46) /* TWI1 */
112#define IRQ_CAN_RX BFIN_IRQ(47) /* CAN Receive Interrupt */
113#define IRQ_CAN_TX BFIN_IRQ(48) /* CAN Transmit Interrupt */
114#define IRQ_MEM1_DMA0 BFIN_IRQ(49) /* MDMA1 Stream 0 */
115#define IRQ_MEM1_DMA1 BFIN_IRQ(50) /* MDMA1 Stream 1 */
116
117#define SYS_IRQS BFIN_IRQ(63) /* 70 */
118
119#define IRQ_PF0 71
120#define IRQ_PF1 72
121#define IRQ_PF2 73
122#define IRQ_PF3 74
123#define IRQ_PF4 75
124#define IRQ_PF5 76
125#define IRQ_PF6 77
126#define IRQ_PF7 78
127#define IRQ_PF8 79
128#define IRQ_PF9 80
129#define IRQ_PF10 81
130#define IRQ_PF11 82
131#define IRQ_PF12 83
132#define IRQ_PF13 84
133#define IRQ_PF14 85
134#define IRQ_PF15 86
135
136#define GPIO_IRQ_BASE IRQ_PF0
137
138#define NR_IRQS (IRQ_PF15+1)
139
140#define IVG7 7
141#define IVG8 8
142#define IVG9 9
143#define IVG10 10
144#define IVG11 11
145#define IVG12 12
146#define IVG13 13
147#define IVG14 14
148#define IVG15 15
149
150/* IAR0 BIT FIELDS */
151#define IRQ_PLL_WAKEUP_POS 0
152#define IRQ_DMA0_ERROR_POS 4
153#define IRQ_PPI_ERROR_POS 8
154#define IRQ_SPORT0_ERROR_POS 12
155#define IRQ_SPORT1_ERROR_POS 16
156#define IRQ_SPI0_ERROR_POS 20
157#define IRQ_UART0_ERROR_POS 24
158#define IRQ_RTC_POS 28
159
160/* IAR1 BIT FIELDS */
161#define IRQ_PPI_POS 0
162#define IRQ_SPORT0_RX_POS 4
163#define IRQ_SPORT0_TX_POS 8
164#define IRQ_SPORT1_RX_POS 12
165#define IRQ_SPORT1_TX_POS 16
166#define IRQ_SPI0_POS 20
167#define IRQ_UART0_RX_POS 24
168#define IRQ_UART0_TX_POS 28
169
170/* IAR2 BIT FIELDS */
171#define IRQ_TIMER0_POS 0
172#define IRQ_TIMER1_POS 4
173#define IRQ_TIMER2_POS 8
174#define IRQ_PORTF_INTA_POS 12
175#define IRQ_PORTF_INTB_POS 16
176#define IRQ_MEM0_DMA0_POS 20
177#define IRQ_MEM0_DMA1_POS 24
178#define IRQ_WATCH_POS 28
179
180/* IAR3 BIT FIELDS */
181#define IRQ_DMA1_ERROR_POS 0
182#define IRQ_SPORT2_ERROR_POS 4
183#define IRQ_SPORT3_ERROR_POS 8
184#define IRQ_SPI1_ERROR_POS 16
185#define IRQ_SPI2_ERROR_POS 20
186#define IRQ_UART1_ERROR_POS 24
187#define IRQ_UART2_ERROR_POS 28
188
189/* IAR4 BIT FIELDS */
190#define IRQ_CAN_ERROR_POS 0
191#define IRQ_SPORT2_RX_POS 4
192#define IRQ_SPORT2_TX_POS 8
193#define IRQ_SPORT3_RX_POS 12
194#define IRQ_SPORT3_TX_POS 16
195#define IRQ_SPI1_POS 28
196
197/* IAR5 BIT FIELDS */
198#define IRQ_SPI2_POS 0
199#define IRQ_UART1_RX_POS 4
200#define IRQ_UART1_TX_POS 8
201#define IRQ_UART2_RX_POS 12
202#define IRQ_UART2_TX_POS 16
203#define IRQ_TWI0_POS 20
204#define IRQ_TWI1_POS 24
205#define IRQ_CAN_RX_POS 28
206
207/* IAR6 BIT FIELDS */
208#define IRQ_CAN_TX_POS 0
209#define IRQ_MEM1_DMA0_POS 4
210#define IRQ_MEM1_DMA1_POS 8
211#endif /* _BF538_IRQ_H_ */
diff --git a/arch/blackfin/mach-bf538/include/mach/mem_map.h b/arch/blackfin/mach-bf538/include/mach/mem_map.h
new file mode 100644
index 000000000000..76811966690e
--- /dev/null
+++ b/arch/blackfin/mach-bf538/include/mach/mem_map.h
@@ -0,0 +1,113 @@
1/*
2 * File: include/asm-blackfin/mach-bf538/mem_map.h
3 * Based on:
4 * Author:
5 *
6 * Created:
7 * Description:
8 *
9 * Rev:
10 *
11 * Modified:
12 *
13 * Bugs: Enter bugs at http://blackfin.uclinux.org/
14 *
15 * This program is free software; you can redistribute it and/or modify
16 * it under the terms of the GNU General Public License as published by
17 * the Free Software Foundation; either version 2, or (at your option)
18 * any later version.
19 *
20 * This program is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
24 *
25 * You should have received a copy of the GNU General Public License
26 * along with this program; see the file COPYING.
27 * If not, write to the Free Software Foundation,
28 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
29 */
30
31#ifndef _MEM_MAP_538_H_
32#define _MEM_MAP_538_H_
33
34#define COREMMR_BASE 0xFFE00000 /* Core MMRs */
35#define SYSMMR_BASE 0xFFC00000 /* System MMRs */
36
37/* Async Memory Banks */
38#define ASYNC_BANK3_BASE 0x20300000 /* Async Bank 3 */
39#define ASYNC_BANK3_SIZE 0x00100000 /* 1M */
40#define ASYNC_BANK2_BASE 0x20200000 /* Async Bank 2 */
41#define ASYNC_BANK2_SIZE 0x00100000 /* 1M */
42#define ASYNC_BANK1_BASE 0x20100000 /* Async Bank 1 */
43#define ASYNC_BANK1_SIZE 0x00100000 /* 1M */
44#define ASYNC_BANK0_BASE 0x20000000 /* Async Bank 0 */
45#define ASYNC_BANK0_SIZE 0x00100000 /* 1M */
46
47/* Boot ROM Memory */
48
49#define BOOT_ROM_START 0xEF000000
50#define BOOT_ROM_LENGTH 0x400
51
52/* Level 1 Memory */
53
54#ifdef CONFIG_BFIN_ICACHE
55#define BFIN_ICACHESIZE (16*1024)
56#else
57#define BFIN_ICACHESIZE (0*1024)
58#endif
59
60/* Memory Map for ADSP-BF538/9 processors */
61
62#define L1_CODE_START 0xFFA00000
63#define L1_DATA_A_START 0xFF800000
64#define L1_DATA_B_START 0xFF900000
65
66#ifdef CONFIG_BFIN_ICACHE
67#define L1_CODE_LENGTH (0x14000 - 0x4000)
68#else
69#define L1_CODE_LENGTH 0x14000
70#endif
71
72#ifdef CONFIG_BFIN_DCACHE
73
74#ifdef CONFIG_BFIN_DCACHE_BANKA
75#define DMEM_CNTR (ACACHE_BSRAM | ENDCPLB | PORT_PREF0)
76#define L1_DATA_A_LENGTH (0x8000 - 0x4000)
77#define L1_DATA_B_LENGTH 0x8000
78#define BFIN_DCACHESIZE (16*1024)
79#define BFIN_DSUPBANKS 1
80#else
81#define DMEM_CNTR (ACACHE_BCACHE | ENDCPLB | PORT_PREF0)
82#define L1_DATA_A_LENGTH (0x8000 - 0x4000)
83#define L1_DATA_B_LENGTH (0x8000 - 0x4000)
84#define BFIN_DCACHESIZE (32*1024)
85#define BFIN_DSUPBANKS 2
86#endif
87
88#else
89#define DMEM_CNTR (ASRAM_BSRAM | ENDCPLB | PORT_PREF0)
90#define L1_DATA_A_LENGTH 0x8000
91#define L1_DATA_B_LENGTH 0x8000
92#define BFIN_DCACHESIZE (0*1024)
93#define BFIN_DSUPBANKS 0
94#endif /*CONFIG_BFIN_DCACHE*/
95
96
97/* Level 2 Memory - none */
98
99#define L2_START 0
100#define L2_LENGTH 0
101
102/* Scratch Pad Memory */
103
104#define L1_SCRATCH_START 0xFFB00000
105#define L1_SCRATCH_LENGTH 0x1000
106
107#define GET_PDA_SAFE(preg) \
108 preg.l = _cpu_pda; \
109 preg.h = _cpu_pda;
110
111#define GET_PDA(preg, dreg) GET_PDA_SAFE(preg)
112
113#endif /* _MEM_MAP_538_H_ */
diff --git a/arch/blackfin/mach-bf538/include/mach/portmux.h b/arch/blackfin/mach-bf538/include/mach/portmux.h
new file mode 100644
index 000000000000..1e031b588b47
--- /dev/null
+++ b/arch/blackfin/mach-bf538/include/mach/portmux.h
@@ -0,0 +1,106 @@
1#ifndef _MACH_PORTMUX_H_
2#define _MACH_PORTMUX_H_
3
4#define MAX_RESOURCES MAX_BLACKFIN_GPIOS
5
6#define P_TMR2 (P_DONTCARE)
7#define P_TMR1 (P_DONTCARE)
8#define P_TMR0 (P_DONTCARE)
9#define P_TMRCLK (P_DONTCARE)
10#define P_PPI0_CLK (P_DONTCARE)
11#define P_PPI0_FS1 (P_DONTCARE)
12#define P_PPI0_FS2 (P_DONTCARE)
13
14#define P_TWI0_SCL (P_DONTCARE)
15#define P_TWI0_SDA (P_DONTCARE)
16#define P_TWI1_SCL (P_DONTCARE)
17#define P_TWI1_SDA (P_DONTCARE)
18
19#define P_SPORT1_TSCLK (P_DONTCARE)
20#define P_SPORT1_RSCLK (P_DONTCARE)
21#define P_SPORT0_TSCLK (P_DONTCARE)
22#define P_SPORT0_RSCLK (P_DONTCARE)
23#define P_SPORT1_DRSEC (P_DONTCARE)
24#define P_SPORT1_RFS (P_DONTCARE)
25#define P_SPORT1_DTPRI (P_DONTCARE)
26#define P_SPORT1_DTSEC (P_DONTCARE)
27#define P_SPORT1_TFS (P_DONTCARE)
28#define P_SPORT1_DRPRI (P_DONTCARE)
29#define P_SPORT0_DRSEC (P_DONTCARE)
30#define P_SPORT0_RFS (P_DONTCARE)
31#define P_SPORT0_DTPRI (P_DONTCARE)
32#define P_SPORT0_DTSEC (P_DONTCARE)
33#define P_SPORT0_TFS (P_DONTCARE)
34#define P_SPORT0_DRPRI (P_DONTCARE)
35
36#define P_UART0_RX (P_DONTCARE)
37#define P_UART0_TX (P_DONTCARE)
38
39#define P_SPI0_MOSI (P_DONTCARE)
40#define P_SPI0_MISO (P_DONTCARE)
41#define P_SPI0_SCK (P_DONTCARE)
42
43#define P_PPI0_D0 (P_DONTCARE)
44#define P_PPI0_D1 (P_DONTCARE)
45#define P_PPI0_D2 (P_DONTCARE)
46#define P_PPI0_D3 (P_DONTCARE)
47
48#define P_CAN0_TX (P_DEFINED | P_IDENT(GPIO_PC0))
49#define P_CAN0_RX (P_DEFINED | P_IDENT(GPIO_PC1))
50
51#define P_SPI1_MOSI (P_DEFINED | P_IDENT(GPIO_PD0))
52#define P_SPI1_MISO (P_DEFINED | P_IDENT(GPIO_PD1))
53#define P_SPI1_SCK (P_DEFINED | P_IDENT(GPIO_PD2))
54#define P_SPI1_SS (P_DEFINED | P_IDENT(GPIO_PD3))
55#define P_SPI1_SSEL1 (P_DEFINED | P_IDENT(GPIO_PD4))
56#define P_SPI2_MOSI (P_DEFINED | P_IDENT(GPIO_PD5))
57#define P_SPI2_MISO (P_DEFINED | P_IDENT(GPIO_PD6))
58#define P_SPI2_SCK (P_DEFINED | P_IDENT(GPIO_PD7))
59#define P_SPI2_SS (P_DEFINED | P_IDENT(GPIO_PD8))
60#define P_SPI2_SSEL1 (P_DEFINED | P_IDENT(GPIO_PD9))
61#define P_UART1_RX (P_DEFINED | P_IDENT(GPIO_PD10))
62#define P_UART1_TX (P_DEFINED | P_IDENT(GPIO_PD11))
63#define P_UART2_RX (P_DEFINED | P_IDENT(GPIO_PD12))
64#define P_UART2_TX (P_DEFINED | P_IDENT(GPIO_PD13))
65
66#define P_SPORT2_RSCLK (P_DEFINED | P_IDENT(GPIO_PE0))
67#define P_SPORT2_RFS (P_DEFINED | P_IDENT(GPIO_PE1))
68#define P_SPORT2_DRPRI (P_DEFINED | P_IDENT(GPIO_PE2))
69#define P_SPORT2_DRSEC (P_DEFINED | P_IDENT(GPIO_PE3))
70#define P_SPORT2_TSCLK (P_DEFINED | P_IDENT(GPIO_PE4))
71#define P_SPORT2_TFS (P_DEFINED | P_IDENT(GPIO_PE5))
72#define P_SPORT2_DTPRI (P_DEFINED | P_IDENT(GPIO_PE6))
73#define P_SPORT2_DTSEC (P_DEFINED | P_IDENT(GPIO_PE7))
74#define P_SPORT3_RSCLK (P_DEFINED | P_IDENT(GPIO_PE8))
75#define P_SPORT3_RFS (P_DEFINED | P_IDENT(GPIO_PE9))
76#define P_SPORT3_DRPRI (P_DEFINED | P_IDENT(GPIO_PE10))
77#define P_SPORT3_DRSEC (P_DEFINED | P_IDENT(GPIO_PE11))
78#define P_SPORT3_TSCLK (P_DEFINED | P_IDENT(GPIO_PE12))
79#define P_SPORT3_TFS (P_DEFINED | P_IDENT(GPIO_PE13))
80#define P_SPORT3_DTPRI (P_DEFINED | P_IDENT(GPIO_PE14))
81#define P_SPORT3_DTSEC (P_DEFINED | P_IDENT(GPIO_PE15))
82
83#define P_PPI0_FS3 (P_DEFINED | P_IDENT(GPIO_PF3))
84#define P_PPI0_D15 (P_DEFINED | P_IDENT(GPIO_PF4))
85#define P_PPI0_D14 (P_DEFINED | P_IDENT(GPIO_PF5))
86#define P_PPI0_D13 (P_DEFINED | P_IDENT(GPIO_PF6))
87#define P_PPI0_D12 (P_DEFINED | P_IDENT(GPIO_PF7))
88#define P_PPI0_D11 (P_DEFINED | P_IDENT(GPIO_PF8))
89#define P_PPI0_D10 (P_DEFINED | P_IDENT(GPIO_PF9))
90#define P_PPI0_D9 (P_DEFINED | P_IDENT(GPIO_PF10))
91#define P_PPI0_D8 (P_DEFINED | P_IDENT(GPIO_PF11))
92
93#define P_PPI0_D4 (P_DEFINED | P_IDENT(GPIO_PF15))
94#define P_PPI0_D5 (P_DEFINED | P_IDENT(GPIO_PF14))
95#define P_PPI0_D6 (P_DEFINED | P_IDENT(GPIO_PF13))
96#define P_PPI0_D7 (P_DEFINED | P_IDENT(GPIO_PF12))
97#define P_SPI0_SSEL7 (P_DEFINED | P_IDENT(GPIO_PF7))
98#define P_SPI0_SSEL6 (P_DEFINED | P_IDENT(GPIO_PF6))
99#define P_SPI0_SSEL5 (P_DEFINED | P_IDENT(GPIO_PF5))
100#define P_SPI0_SSEL4 (P_DEFINED | P_IDENT(GPIO_PF4))
101#define P_SPI0_SSEL3 (P_DEFINED | P_IDENT(GPIO_PF3))
102#define P_SPI0_SSEL2 (P_DEFINED | P_IDENT(GPIO_PF2))
103#define P_SPI0_SSEL1 (P_DEFINED | P_IDENT(GPIO_PF1))
104#define P_SPI0_SS (P_DEFINED | P_IDENT(GPIO_PF0))
105
106#endif /* _MACH_PORTMUX_H_ */
diff --git a/arch/blackfin/mach-bf538/ints-priority.c b/arch/blackfin/mach-bf538/ints-priority.c
new file mode 100644
index 000000000000..70d17e550e05
--- /dev/null
+++ b/arch/blackfin/mach-bf538/ints-priority.c
@@ -0,0 +1,94 @@
1/*
2 * File: arch/blackfin/mach-bf538/ints-priority.c
3 * Based on: arch/blackfin/mach-bf533/ints-priority.c
4 * Author: Michael Hennerich
5 *
6 * Created:
7 * Description: Set up the interrupt priorities
8 *
9 * Modified:
10 * Copyright 2008 Analog Devices Inc.
11 *
12 * Bugs: Enter bugs at http://blackfin.uclinux.org/
13 *
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 2 of the License, or
17 * (at your option) any later version.
18 *
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
23 *
24 * You should have received a copy of the GNU General Public License
25 * along with this program; if not, see the file COPYING, or write
26 * to the Free Software Foundation, Inc.,
27 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
28 */
29
30#include <linux/module.h>
31#include <linux/irq.h>
32#include <asm/blackfin.h>
33
34void __init program_IAR(void)
35{
36
37 /* Program the IAR0 Register with the configured priority */
38 bfin_write_SIC_IAR0(((CONFIG_IRQ_PLL_WAKEUP - 7) << IRQ_PLL_WAKEUP_POS) |
39 ((CONFIG_IRQ_DMA0_ERROR - 7) << IRQ_DMA0_ERROR_POS) |
40 ((CONFIG_IRQ_PPI_ERROR - 7) << IRQ_PPI_ERROR_POS) |
41 ((CONFIG_IRQ_SPORT0_ERROR - 7) << IRQ_SPORT0_ERROR_POS) |
42 ((CONFIG_IRQ_SPORT1_ERROR - 7) << IRQ_SPORT1_ERROR_POS) |
43 ((CONFIG_IRQ_SPI0_ERROR - 7) << IRQ_SPI0_ERROR_POS) |
44 ((CONFIG_IRQ_UART0_ERROR - 7) << IRQ_UART0_ERROR_POS) |
45 ((CONFIG_IRQ_RTC - 7) << IRQ_RTC_POS));
46
47 bfin_write_SIC_IAR1(((CONFIG_IRQ_PPI - 7) << IRQ_PPI_POS) |
48 ((CONFIG_IRQ_SPORT0_RX - 7) << IRQ_SPORT0_RX_POS) |
49 ((CONFIG_IRQ_SPORT0_TX - 7) << IRQ_SPORT0_TX_POS) |
50 ((CONFIG_IRQ_SPORT1_RX - 7) << IRQ_SPORT1_RX_POS) |
51 ((CONFIG_IRQ_SPORT1_TX - 7) << IRQ_SPORT1_TX_POS) |
52 ((CONFIG_IRQ_SPI0 - 7) << IRQ_SPI0_POS) |
53 ((CONFIG_IRQ_UART0_RX - 7) << IRQ_UART0_RX_POS) |
54 ((CONFIG_IRQ_UART0_TX - 7) << IRQ_UART0_TX_POS));
55
56 bfin_write_SIC_IAR2(((CONFIG_IRQ_TIMER0 - 7) << IRQ_TIMER0_POS) |
57 ((CONFIG_IRQ_TIMER1 - 7) << IRQ_TIMER1_POS) |
58 ((CONFIG_IRQ_TIMER2 - 7) << IRQ_TIMER2_POS) |
59 ((CONFIG_IRQ_PORTF_INTA - 7) << IRQ_PORTF_INTA_POS) |
60 ((CONFIG_IRQ_PORTF_INTB - 7) << IRQ_PORTF_INTB_POS) |
61 ((CONFIG_IRQ_MEM0_DMA0 - 7) << IRQ_MEM0_DMA0_POS) |
62 ((CONFIG_IRQ_MEM0_DMA1 - 7) << IRQ_MEM0_DMA1_POS) |
63 ((CONFIG_IRQ_WATCH - 7) << IRQ_WATCH_POS));
64
65 bfin_write_SIC_IAR3(((CONFIG_IRQ_DMA1_ERROR - 7) << IRQ_DMA1_ERROR_POS) |
66 ((CONFIG_IRQ_SPORT2_ERROR - 7) << IRQ_SPORT2_ERROR_POS) |
67 ((CONFIG_IRQ_SPORT3_ERROR - 7) << IRQ_SPORT3_ERROR_POS) |
68 ((CONFIG_IRQ_SPI1_ERROR - 7) << IRQ_SPI1_ERROR_POS) |
69 ((CONFIG_IRQ_SPI2_ERROR - 7) << IRQ_SPI2_ERROR_POS) |
70 ((CONFIG_IRQ_UART1_ERROR - 7) << IRQ_UART1_ERROR_POS) |
71 ((CONFIG_IRQ_UART2_ERROR - 7) << IRQ_UART2_ERROR_POS));
72
73 bfin_write_SIC_IAR4(((CONFIG_IRQ_CAN_ERROR - 7) << IRQ_CAN_ERROR_POS) |
74 ((CONFIG_IRQ_SPORT2_RX - 7) << IRQ_SPORT2_RX_POS) |
75 ((CONFIG_IRQ_SPORT2_TX - 7) << IRQ_SPORT2_TX_POS) |
76 ((CONFIG_IRQ_SPORT3_RX - 7) << IRQ_SPORT3_RX_POS) |
77 ((CONFIG_IRQ_SPORT3_TX - 7) << IRQ_SPORT3_TX_POS) |
78 ((CONFIG_IRQ_SPI1 - 7) << IRQ_SPI1_POS));
79
80 bfin_write_SIC_IAR5(((CONFIG_IRQ_SPI2 - 7) << IRQ_SPI2_POS) |
81 ((CONFIG_IRQ_UART1_RX - 7) << IRQ_UART1_RX_POS) |
82 ((CONFIG_IRQ_UART1_TX - 7) << IRQ_UART1_TX_POS) |
83 ((CONFIG_IRQ_UART2_RX - 7) << IRQ_UART2_RX_POS) |
84 ((CONFIG_IRQ_UART2_TX - 7) << IRQ_UART2_TX_POS) |
85 ((CONFIG_IRQ_TWI0 - 7) << IRQ_TWI0_POS) |
86 ((CONFIG_IRQ_TWI1 - 7) << IRQ_TWI1_POS) |
87 ((CONFIG_IRQ_CAN_RX - 7) << IRQ_CAN_RX_POS));
88
89 bfin_write_SIC_IAR6(((CONFIG_IRQ_CAN_TX - 7) << IRQ_CAN_TX_POS) |
90 ((CONFIG_IRQ_MEM1_DMA0 - 7) << IRQ_MEM1_DMA0_POS) |
91 ((CONFIG_IRQ_MEM1_DMA1 - 7) << IRQ_MEM1_DMA1_POS));
92
93 SSYNC();
94}
diff --git a/arch/blackfin/mach-bf548/Kconfig b/arch/blackfin/mach-bf548/Kconfig
index 1bfcd8f646ab..dcf657159051 100644
--- a/arch/blackfin/mach-bf548/Kconfig
+++ b/arch/blackfin/mach-bf548/Kconfig
@@ -250,7 +250,7 @@ config IRQ_OTPSEC
250 default 11 250 default 11
251config IRQ_TIMER0 251config IRQ_TIMER0
252 int "IRQ_TIMER0" 252 int "IRQ_TIMER0"
253 default 11 253 default 8
254config IRQ_TIMER1 254config IRQ_TIMER1
255 int "IRQ_TIMER1" 255 int "IRQ_TIMER1"
256 default 11 256 default 11
diff --git a/arch/blackfin/mach-bf548/Makefile b/arch/blackfin/mach-bf548/Makefile
index 68e5478e95a9..56994b675f9c 100644
--- a/arch/blackfin/mach-bf548/Makefile
+++ b/arch/blackfin/mach-bf548/Makefile
@@ -2,6 +2,4 @@
2# arch/blackfin/mach-bf537/Makefile 2# arch/blackfin/mach-bf537/Makefile
3# 3#
4 4
5extra-y := head.o
6
7obj-y := ints-priority.o dma.o 5obj-y := ints-priority.o dma.o
diff --git a/arch/blackfin/mach-bf548/boards/cm_bf548.c b/arch/blackfin/mach-bf548/boards/cm_bf548.c
index 24192aaa9275..f53ad682530b 100644
--- a/arch/blackfin/mach-bf548/boards/cm_bf548.c
+++ b/arch/blackfin/mach-bf548/boards/cm_bf548.c
@@ -32,6 +32,7 @@
32#include <linux/platform_device.h> 32#include <linux/platform_device.h>
33#include <linux/mtd/mtd.h> 33#include <linux/mtd/mtd.h>
34#include <linux/mtd/partitions.h> 34#include <linux/mtd/partitions.h>
35#include <linux/mtd/physmap.h>
35#include <linux/spi/spi.h> 36#include <linux/spi/spi.h>
36#include <linux/spi/flash.h> 37#include <linux/spi/flash.h>
37#include <linux/irq.h> 38#include <linux/irq.h>
@@ -42,6 +43,7 @@
42#include <asm/gpio.h> 43#include <asm/gpio.h>
43#include <asm/nand.h> 44#include <asm/nand.h>
44#include <asm/portmux.h> 45#include <asm/portmux.h>
46#include <asm/bfin_sdh.h>
45#include <mach/bf54x_keys.h> 47#include <mach/bf54x_keys.h>
46#include <asm/dpmc.h> 48#include <asm/dpmc.h>
47#include <linux/input.h> 49#include <linux/input.h>
@@ -186,44 +188,107 @@ static struct platform_device bfin_uart_device = {
186#endif 188#endif
187 189
188#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE) 190#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
189static struct resource bfin_sir_resources[] = {
190#ifdef CONFIG_BFIN_SIR0 191#ifdef CONFIG_BFIN_SIR0
192static struct resource bfin_sir0_resources[] = {
191 { 193 {
192 .start = 0xFFC00400, 194 .start = 0xFFC00400,
193 .end = 0xFFC004FF, 195 .end = 0xFFC004FF,
194 .flags = IORESOURCE_MEM, 196 .flags = IORESOURCE_MEM,
195 }, 197 },
198 {
199 .start = IRQ_UART0_RX,
200 .end = IRQ_UART0_RX+1,
201 .flags = IORESOURCE_IRQ,
202 },
203 {
204 .start = CH_UART0_RX,
205 .end = CH_UART0_RX+1,
206 .flags = IORESOURCE_DMA,
207 },
208};
209static struct platform_device bfin_sir0_device = {
210 .name = "bfin_sir",
211 .id = 0,
212 .num_resources = ARRAY_SIZE(bfin_sir0_resources),
213 .resource = bfin_sir0_resources,
214};
196#endif 215#endif
197#ifdef CONFIG_BFIN_SIR1 216#ifdef CONFIG_BFIN_SIR1
217static struct resource bfin_sir1_resources[] = {
198 { 218 {
199 .start = 0xFFC02000, 219 .start = 0xFFC02000,
200 .end = 0xFFC020FF, 220 .end = 0xFFC020FF,
201 .flags = IORESOURCE_MEM, 221 .flags = IORESOURCE_MEM,
202 }, 222 },
223 {
224 .start = IRQ_UART1_RX,
225 .end = IRQ_UART1_RX+1,
226 .flags = IORESOURCE_IRQ,
227 },
228 {
229 .start = CH_UART1_RX,
230 .end = CH_UART1_RX+1,
231 .flags = IORESOURCE_DMA,
232 },
233};
234static struct platform_device bfin_sir1_device = {
235 .name = "bfin_sir",
236 .id = 1,
237 .num_resources = ARRAY_SIZE(bfin_sir1_resources),
238 .resource = bfin_sir1_resources,
239};
203#endif 240#endif
204#ifdef CONFIG_BFIN_SIR2 241#ifdef CONFIG_BFIN_SIR2
242static struct resource bfin_sir2_resources[] = {
205 { 243 {
206 .start = 0xFFC02100, 244 .start = 0xFFC02100,
207 .end = 0xFFC021FF, 245 .end = 0xFFC021FF,
208 .flags = IORESOURCE_MEM, 246 .flags = IORESOURCE_MEM,
209 }, 247 },
248 {
249 .start = IRQ_UART2_RX,
250 .end = IRQ_UART2_RX+1,
251 .flags = IORESOURCE_IRQ,
252 },
253 {
254 .start = CH_UART2_RX,
255 .end = CH_UART2_RX+1,
256 .flags = IORESOURCE_DMA,
257 },
258};
259static struct platform_device bfin_sir2_device = {
260 .name = "bfin_sir",
261 .id = 2,
262 .num_resources = ARRAY_SIZE(bfin_sir2_resources),
263 .resource = bfin_sir2_resources,
264};
210#endif 265#endif
211#ifdef CONFIG_BFIN_SIR3 266#ifdef CONFIG_BFIN_SIR3
267static struct resource bfin_sir3_resources[] = {
212 { 268 {
213 .start = 0xFFC03100, 269 .start = 0xFFC03100,
214 .end = 0xFFC031FF, 270 .end = 0xFFC031FF,
215 .flags = IORESOURCE_MEM, 271 .flags = IORESOURCE_MEM,
216 }, 272 },
217#endif 273 {
274 .start = IRQ_UART3_RX,
275 .end = IRQ_UART3_RX+1,
276 .flags = IORESOURCE_IRQ,
277 },
278 {
279 .start = CH_UART3_RX,
280 .end = CH_UART3_RX+1,
281 .flags = IORESOURCE_DMA,
282 },
218}; 283};
219 284static struct platform_device bfin_sir3_device = {
220static struct platform_device bfin_sir_device = {
221 .name = "bfin_sir", 285 .name = "bfin_sir",
222 .id = 0, 286 .id = 3,
223 .num_resources = ARRAY_SIZE(bfin_sir_resources), 287 .num_resources = ARRAY_SIZE(bfin_sir3_resources),
224 .resource = bfin_sir_resources, 288 .resource = bfin_sir3_resources,
225}; 289};
226#endif 290#endif
291#endif
227 292
228#if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE) 293#if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
229static struct resource smsc911x_resources[] = { 294static struct resource smsc911x_resources[] = {
@@ -271,8 +336,8 @@ static struct musb_hdrc_config musb_config = {
271 .dyn_fifo = 0, 336 .dyn_fifo = 0,
272 .soft_con = 1, 337 .soft_con = 1,
273 .dma = 1, 338 .dma = 1,
274 .num_eps = 7, 339 .num_eps = 8,
275 .dma_channels = 7, 340 .dma_channels = 8,
276 .gpio_vrsel = GPIO_PH6, 341 .gpio_vrsel = GPIO_PH6,
277}; 342};
278 343
@@ -302,6 +367,19 @@ static struct platform_device musb_device = {
302}; 367};
303#endif 368#endif
304 369
370static struct resource bfin_gpios_resources = {
371 .start = 0,
372 .end = MAX_BLACKFIN_GPIOS - 1,
373 .flags = IORESOURCE_IRQ,
374};
375
376static struct platform_device bfin_gpios_device = {
377 .name = "simple-gpio",
378 .id = -1,
379 .num_resources = 1,
380 .resource = &bfin_gpios_resources,
381};
382
305#if defined(CONFIG_PATA_BF54X) || defined(CONFIG_PATA_BF54X_MODULE) 383#if defined(CONFIG_PATA_BF54X) || defined(CONFIG_PATA_BF54X_MODULE)
306static struct resource bfin_atapi_resources[] = { 384static struct resource bfin_atapi_resources[] = {
307 { 385 {
@@ -372,9 +450,58 @@ static struct platform_device bf5xx_nand_device = {
372#endif 450#endif
373 451
374#if defined(CONFIG_SDH_BFIN) || defined(CONFIG_SDH_BFIN_MODULE) 452#if defined(CONFIG_SDH_BFIN) || defined(CONFIG_SDH_BFIN_MODULE)
453static struct bfin_sd_host bfin_sdh_data = {
454 .dma_chan = CH_SDH,
455 .irq_int0 = IRQ_SDH_MASK0,
456 .pin_req = {P_SD_D0, P_SD_D1, P_SD_D2, P_SD_D3, P_SD_CLK, P_SD_CMD, 0},
457};
458
375static struct platform_device bf54x_sdh_device = { 459static struct platform_device bf54x_sdh_device = {
376 .name = "bfin-sdh", 460 .name = "bfin-sdh",
377 .id = 0, 461 .id = 0,
462 .dev = {
463 .platform_data = &bfin_sdh_data,
464 },
465};
466#endif
467
468#if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
469static struct mtd_partition para_partitions[] = {
470 {
471 .name = "bootloader(nor)",
472 .size = 0x40000,
473 .offset = 0,
474 }, {
475 .name = "linux kernel(nor)",
476 .size = 0x400000,
477 .offset = MTDPART_OFS_APPEND,
478 }, {
479 .name = "file system(nor)",
480 .size = MTDPART_SIZ_FULL,
481 .offset = MTDPART_OFS_APPEND,
482 }
483};
484
485static struct physmap_flash_data para_flash_data = {
486 .width = 2,
487 .parts = para_partitions,
488 .nr_parts = ARRAY_SIZE(para_partitions),
489};
490
491static struct resource para_flash_resource = {
492 .start = 0x20000000,
493 .end = 0x207fffff,
494 .flags = IORESOURCE_MEM,
495};
496
497static struct platform_device para_flash_device = {
498 .name = "physmap-flash",
499 .id = 0,
500 .dev = {
501 .platform_data = &para_flash_data,
502 },
503 .num_resources = 1,
504 .resource = &para_flash_resource,
378}; 505};
379#endif 506#endif
380 507
@@ -642,7 +769,18 @@ static struct platform_device *cm_bf548_devices[] __initdata = {
642#endif 769#endif
643 770
644#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE) 771#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
645 &bfin_sir_device, 772#ifdef CONFIG_BFIN_SIR0
773 &bfin_sir0_device,
774#endif
775#ifdef CONFIG_BFIN_SIR1
776 &bfin_sir1_device,
777#endif
778#ifdef CONFIG_BFIN_SIR2
779 &bfin_sir2_device,
780#endif
781#ifdef CONFIG_BFIN_SIR3
782 &bfin_sir3_device,
783#endif
646#endif 784#endif
647 785
648#if defined(CONFIG_FB_BF54X_LQ043) || defined(CONFIG_FB_BF54X_LQ043_MODULE) 786#if defined(CONFIG_FB_BF54X_LQ043) || defined(CONFIG_FB_BF54X_LQ043_MODULE)
@@ -679,7 +817,7 @@ static struct platform_device *cm_bf548_devices[] __initdata = {
679#endif 817#endif
680 818
681#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE) 819#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
682/* &i2c_bfin_twi0_device, */ 820 &i2c_bfin_twi0_device,
683#if !defined(CONFIG_BF542) 821#if !defined(CONFIG_BF542)
684 &i2c_bfin_twi1_device, 822 &i2c_bfin_twi1_device,
685#endif 823#endif
@@ -688,6 +826,12 @@ static struct platform_device *cm_bf548_devices[] __initdata = {
688#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE) 826#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
689 &bfin_device_gpiokeys, 827 &bfin_device_gpiokeys,
690#endif 828#endif
829
830#if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
831 &para_flash_device,
832#endif
833
834 &bfin_gpios_device,
691}; 835};
692 836
693static int __init cm_bf548_init(void) 837static int __init cm_bf548_init(void)
diff --git a/arch/blackfin/mach-bf548/boards/ezkit.c b/arch/blackfin/mach-bf548/boards/ezkit.c
index 5288187a3ace..309c16014cae 100644
--- a/arch/blackfin/mach-bf548/boards/ezkit.c
+++ b/arch/blackfin/mach-bf548/boards/ezkit.c
@@ -45,6 +45,7 @@
45#include <asm/nand.h> 45#include <asm/nand.h>
46#include <asm/dpmc.h> 46#include <asm/dpmc.h>
47#include <asm/portmux.h> 47#include <asm/portmux.h>
48#include <asm/bfin_sdh.h>
48#include <mach/bf54x_keys.h> 49#include <mach/bf54x_keys.h>
49#include <linux/input.h> 50#include <linux/input.h>
50#include <linux/spi/ad7877.h> 51#include <linux/spi/ad7877.h>
@@ -52,16 +53,16 @@
52/* 53/*
53 * Name the Board for the /proc/cpuinfo 54 * Name the Board for the /proc/cpuinfo
54 */ 55 */
55const char bfin_board_name[] = "ADSP-BF548-EZKIT"; 56const char bfin_board_name[] = "ADI BF548-EZKIT";
56 57
57/* 58/*
58 * Driver needs to know address, irq and flag pin. 59 * Driver needs to know address, irq and flag pin.
59 */ 60 */
60 61
61#if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE) 62#if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
62static struct resource bfin_isp1761_resources[] = { 63#include <linux/usb/isp1760.h>
64static struct resource bfin_isp1760_resources[] = {
63 [0] = { 65 [0] = {
64 .name = "isp1761-regs",
65 .start = 0x2C0C0000, 66 .start = 0x2C0C0000,
66 .end = 0x2C0C0000 + 0xfffff, 67 .end = 0x2C0C0000 + 0xfffff,
67 .flags = IORESOURCE_MEM, 68 .flags = IORESOURCE_MEM,
@@ -73,32 +74,25 @@ static struct resource bfin_isp1761_resources[] = {
73 }, 74 },
74}; 75};
75 76
76static struct platform_device bfin_isp1761_device = { 77static struct isp1760_platform_data isp1760_priv = {
77 .name = "isp1761", 78 .is_isp1761 = 0,
78 .id = 0, 79 .port1_disable = 0,
79 .num_resources = ARRAY_SIZE(bfin_isp1761_resources), 80 .bus_width_16 = 1,
80 .resource = bfin_isp1761_resources, 81 .port1_otg = 0,
82 .analog_oc = 0,
83 .dack_polarity_high = 0,
84 .dreq_polarity_high = 0,
81}; 85};
82 86
83static struct platform_device *bfin_isp1761_devices[] = { 87static struct platform_device bfin_isp1760_device = {
84 &bfin_isp1761_device, 88 .name = "isp1760-hcd",
89 .id = 0,
90 .dev = {
91 .platform_data = &isp1760_priv,
92 },
93 .num_resources = ARRAY_SIZE(bfin_isp1760_resources),
94 .resource = bfin_isp1760_resources,
85}; 95};
86
87int __init bfin_isp1761_init(void)
88{
89 unsigned int num_devices = ARRAY_SIZE(bfin_isp1761_devices);
90
91 printk(KERN_INFO "%s(): registering device resources\n", __func__);
92 set_irq_type(bfin_isp1761_resources[1].start, IRQF_TRIGGER_FALLING);
93
94 return platform_add_devices(bfin_isp1761_devices, num_devices);
95}
96
97void __exit bfin_isp1761_exit(void)
98{
99 platform_device_unregister(&bfin_isp1761_device);
100}
101arch_initcall(bfin_isp1761_init);
102#endif 96#endif
103 97
104#if defined(CONFIG_FB_BF54X_LQ043) || defined(CONFIG_FB_BF54X_LQ043_MODULE) 98#if defined(CONFIG_FB_BF54X_LQ043) || defined(CONFIG_FB_BF54X_LQ043_MODULE)
@@ -262,44 +256,107 @@ static struct platform_device bfin_uart_device = {
262#endif 256#endif
263 257
264#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE) 258#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
265static struct resource bfin_sir_resources[] = {
266#ifdef CONFIG_BFIN_SIR0 259#ifdef CONFIG_BFIN_SIR0
260static struct resource bfin_sir0_resources[] = {
267 { 261 {
268 .start = 0xFFC00400, 262 .start = 0xFFC00400,
269 .end = 0xFFC004FF, 263 .end = 0xFFC004FF,
270 .flags = IORESOURCE_MEM, 264 .flags = IORESOURCE_MEM,
271 }, 265 },
266 {
267 .start = IRQ_UART0_RX,
268 .end = IRQ_UART0_RX+1,
269 .flags = IORESOURCE_IRQ,
270 },
271 {
272 .start = CH_UART0_RX,
273 .end = CH_UART0_RX+1,
274 .flags = IORESOURCE_DMA,
275 },
276};
277static struct platform_device bfin_sir0_device = {
278 .name = "bfin_sir",
279 .id = 0,
280 .num_resources = ARRAY_SIZE(bfin_sir0_resources),
281 .resource = bfin_sir0_resources,
282};
272#endif 283#endif
273#ifdef CONFIG_BFIN_SIR1 284#ifdef CONFIG_BFIN_SIR1
285static struct resource bfin_sir1_resources[] = {
274 { 286 {
275 .start = 0xFFC02000, 287 .start = 0xFFC02000,
276 .end = 0xFFC020FF, 288 .end = 0xFFC020FF,
277 .flags = IORESOURCE_MEM, 289 .flags = IORESOURCE_MEM,
278 }, 290 },
291 {
292 .start = IRQ_UART1_RX,
293 .end = IRQ_UART1_RX+1,
294 .flags = IORESOURCE_IRQ,
295 },
296 {
297 .start = CH_UART1_RX,
298 .end = CH_UART1_RX+1,
299 .flags = IORESOURCE_DMA,
300 },
301};
302static struct platform_device bfin_sir1_device = {
303 .name = "bfin_sir",
304 .id = 1,
305 .num_resources = ARRAY_SIZE(bfin_sir1_resources),
306 .resource = bfin_sir1_resources,
307};
279#endif 308#endif
280#ifdef CONFIG_BFIN_SIR2 309#ifdef CONFIG_BFIN_SIR2
310static struct resource bfin_sir2_resources[] = {
281 { 311 {
282 .start = 0xFFC02100, 312 .start = 0xFFC02100,
283 .end = 0xFFC021FF, 313 .end = 0xFFC021FF,
284 .flags = IORESOURCE_MEM, 314 .flags = IORESOURCE_MEM,
285 }, 315 },
316 {
317 .start = IRQ_UART2_RX,
318 .end = IRQ_UART2_RX+1,
319 .flags = IORESOURCE_IRQ,
320 },
321 {
322 .start = CH_UART2_RX,
323 .end = CH_UART2_RX+1,
324 .flags = IORESOURCE_DMA,
325 },
326};
327static struct platform_device bfin_sir2_device = {
328 .name = "bfin_sir",
329 .id = 2,
330 .num_resources = ARRAY_SIZE(bfin_sir2_resources),
331 .resource = bfin_sir2_resources,
332};
286#endif 333#endif
287#ifdef CONFIG_BFIN_SIR3 334#ifdef CONFIG_BFIN_SIR3
335static struct resource bfin_sir3_resources[] = {
288 { 336 {
289 .start = 0xFFC03100, 337 .start = 0xFFC03100,
290 .end = 0xFFC031FF, 338 .end = 0xFFC031FF,
291 .flags = IORESOURCE_MEM, 339 .flags = IORESOURCE_MEM,
292 }, 340 },
293#endif 341 {
342 .start = IRQ_UART3_RX,
343 .end = IRQ_UART3_RX+1,
344 .flags = IORESOURCE_IRQ,
345 },
346 {
347 .start = CH_UART3_RX,
348 .end = CH_UART3_RX+1,
349 .flags = IORESOURCE_DMA,
350 },
294}; 351};
295 352static struct platform_device bfin_sir3_device = {
296static struct platform_device bfin_sir_device = {
297 .name = "bfin_sir", 353 .name = "bfin_sir",
298 .id = 0, 354 .id = 3,
299 .num_resources = ARRAY_SIZE(bfin_sir_resources), 355 .num_resources = ARRAY_SIZE(bfin_sir3_resources),
300 .resource = bfin_sir_resources, 356 .resource = bfin_sir3_resources,
301}; 357};
302#endif 358#endif
359#endif
303 360
304#if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE) 361#if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
305static struct resource smsc911x_resources[] = { 362static struct resource smsc911x_resources[] = {
@@ -347,8 +404,8 @@ static struct musb_hdrc_config musb_config = {
347 .dyn_fifo = 0, 404 .dyn_fifo = 0,
348 .soft_con = 1, 405 .soft_con = 1,
349 .dma = 1, 406 .dma = 1,
350 .num_eps = 7, 407 .num_eps = 8,
351 .dma_channels = 7, 408 .dma_channels = 8,
352 .gpio_vrsel = GPIO_PE7, 409 .gpio_vrsel = GPIO_PE7,
353}; 410};
354 411
@@ -448,9 +505,19 @@ static struct platform_device bf5xx_nand_device = {
448#endif 505#endif
449 506
450#if defined(CONFIG_SDH_BFIN) || defined(CONFIG_SDH_BFIN_MODULE) 507#if defined(CONFIG_SDH_BFIN) || defined(CONFIG_SDH_BFIN_MODULE)
508
509static struct bfin_sd_host bfin_sdh_data = {
510 .dma_chan = CH_SDH,
511 .irq_int0 = IRQ_SDH_MASK0,
512 .pin_req = {P_SD_D0, P_SD_D1, P_SD_D2, P_SD_D3, P_SD_CLK, P_SD_CMD, 0},
513};
514
451static struct platform_device bf54x_sdh_device = { 515static struct platform_device bf54x_sdh_device = {
452 .name = "bfin-sdh", 516 .name = "bfin-sdh",
453 .id = 0, 517 .id = 0,
518 .dev = {
519 .platform_data = &bfin_sdh_data,
520 },
454}; 521};
455#endif 522#endif
456 523
@@ -589,7 +656,7 @@ static struct spi_board_info bfin_spi_board_info[] __initdata = {
589{ 656{
590 .modalias = "ad7877", 657 .modalias = "ad7877",
591 .platform_data = &bfin_ad7877_ts_info, 658 .platform_data = &bfin_ad7877_ts_info,
592 .irq = IRQ_PJ11, /* newer boards (Rev 1.4+) use IRQ_PB4 */ 659 .irq = IRQ_PB4, /* old boards (<=Rev 1.3) use IRQ_PJ11 */
593 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */ 660 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
594 .bus_num = 0, 661 .bus_num = 0,
595 .chip_select = 2, 662 .chip_select = 2,
@@ -812,7 +879,18 @@ static struct platform_device *ezkit_devices[] __initdata = {
812#endif 879#endif
813 880
814#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE) 881#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
815 &bfin_sir_device, 882#ifdef CONFIG_BFIN_SIR0
883 &bfin_sir0_device,
884#endif
885#ifdef CONFIG_BFIN_SIR1
886 &bfin_sir1_device,
887#endif
888#ifdef CONFIG_BFIN_SIR2
889 &bfin_sir2_device,
890#endif
891#ifdef CONFIG_BFIN_SIR3
892 &bfin_sir3_device,
893#endif
816#endif 894#endif
817 895
818#if defined(CONFIG_FB_BF54X_LQ043) || defined(CONFIG_FB_BF54X_LQ043_MODULE) 896#if defined(CONFIG_FB_BF54X_LQ043) || defined(CONFIG_FB_BF54X_LQ043_MODULE)
@@ -827,6 +905,10 @@ static struct platform_device *ezkit_devices[] __initdata = {
827 &musb_device, 905 &musb_device,
828#endif 906#endif
829 907
908#if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
909 &bfin_isp1760_device,
910#endif
911
830#if defined(CONFIG_PATA_BF54X) || defined(CONFIG_PATA_BF54X_MODULE) 912#if defined(CONFIG_PATA_BF54X) || defined(CONFIG_PATA_BF54X_MODULE)
831 &bfin_atapi_device, 913 &bfin_atapi_device,
832#endif 914#endif
diff --git a/arch/blackfin/mach-bf548/dma.c b/arch/blackfin/mach-bf548/dma.c
index 74730eb8ae1b..535980652bf6 100644
--- a/arch/blackfin/mach-bf548/dma.c
+++ b/arch/blackfin/mach-bf548/dma.c
@@ -32,7 +32,7 @@
32#include <asm/blackfin.h> 32#include <asm/blackfin.h>
33#include <asm/dma.h> 33#include <asm/dma.h>
34 34
35struct dma_register *dma_io_base_addr[MAX_BLACKFIN_DMA_CHANNEL] = { 35struct dma_register *dma_io_base_addr[MAX_DMA_CHANNELS] = {
36 (struct dma_register *) DMA0_NEXT_DESC_PTR, 36 (struct dma_register *) DMA0_NEXT_DESC_PTR,
37 (struct dma_register *) DMA1_NEXT_DESC_PTR, 37 (struct dma_register *) DMA1_NEXT_DESC_PTR,
38 (struct dma_register *) DMA2_NEXT_DESC_PTR, 38 (struct dma_register *) DMA2_NEXT_DESC_PTR,
diff --git a/arch/blackfin/mach-bf548/head.S b/arch/blackfin/mach-bf548/head.S
deleted file mode 100644
index 93b361dff27b..000000000000
--- a/arch/blackfin/mach-bf548/head.S
+++ /dev/null
@@ -1,158 +0,0 @@
1/*
2 * File: arch/blackfin/mach-bf548/head.S
3 * Based on: arch/blackfin/mach-bf537/head.S
4 * Author: Jeff Dionne <jeff@uclinux.org> COPYRIGHT 1998 D. Jeff Dionne
5 *
6 * Created: 1998
7 * Description: Startup code for Blackfin BF548
8 *
9 * Modified:
10 * Copyright 2004-2007 Analog Devices Inc.
11 *
12 * Bugs: Enter bugs at http://blackfin.uclinux.org/
13 *
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 2 of the License, or
17 * (at your option) any later version.
18 *
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
23 *
24 * You should have received a copy of the GNU General Public License
25 * along with this program; if not, see the file COPYING, or write
26 * to the Free Software Foundation, Inc.,
27 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
28 */
29
30#include <linux/linkage.h>
31#include <linux/init.h>
32#include <asm/blackfin.h>
33#ifdef CONFIG_BFIN_KERNEL_CLOCK
34#include <asm/clocks.h>
35#include <mach/mem_init.h>
36#endif
37
38.section .l1.text
39#ifdef CONFIG_BFIN_KERNEL_CLOCK
40ENTRY(_start_dma_code)
41
42 /* Enable PHY CLK buffer output */
43 p0.h = hi(VR_CTL);
44 p0.l = lo(VR_CTL);
45 r0.l = w[p0];
46 bitset(r0, 14);
47 w[p0] = r0.l;
48 ssync;
49
50 p0.h = hi(SIC_IWR0);
51 p0.l = lo(SIC_IWR0);
52 r0.l = 0x1;
53 r0.h = 0x0;
54 [p0] = r0;
55 SSYNC;
56
57 /*
58 * Set PLL_CTL
59 * - [14:09] = MSEL[5:0] : CLKIN / VCO multiplication factors
60 * - [8] = BYPASS : BYPASS the PLL, run CLKIN into CCLK/SCLK
61 * - [7] = output delay (add 200ps of delay to mem signals)
62 * - [6] = input delay (add 200ps of input delay to mem signals)
63 * - [5] = PDWN : 1=All Clocks off
64 * - [3] = STOPCK : 1=Core Clock off
65 * - [1] = PLL_OFF : 1=Disable Power to PLL
66 * - [0] = DF : 1=Pass CLKIN/2 to PLL / 0=Pass CLKIN to PLL
67 * all other bits set to zero
68 */
69
70 p0.h = hi(PLL_LOCKCNT);
71 p0.l = lo(PLL_LOCKCNT);
72 r0 = 0x300(Z);
73 w[p0] = r0.l;
74 ssync;
75
76 /* enable self refresh via SRREQ */
77 P2.H = hi(EBIU_RSTCTL);
78 P2.L = lo(EBIU_RSTCTL);
79 R0 = [P2];
80 BITSET (R0, 3);
81 [P2] = R0;
82 SSYNC;
83
84 /* wait for SRACK bit to be set */
85.LSRR_MODE:
86 R0 = [P2];
87 CC = BITTST(R0, 4);
88 if !CC JUMP .LSRR_MODE;
89
90 r0 = CONFIG_VCO_MULT & 63; /* Load the VCO multiplier */
91 r0 = r0 << 9; /* Shift it over, */
92 r1 = CLKIN_HALF; /* Do we need to divide CLKIN by 2?*/
93 r0 = r1 | r0;
94 r1 = PLL_BYPASS; /* Bypass the PLL? */
95 r1 = r1 << 8; /* Shift it over */
96 r0 = r1 | r0; /* add them all together */
97#ifdef ANOMALY_05000265
98 BITSET(r0, 15); /* Add 250 mV of hysteresis to SPORT input pins */
99#endif
100
101 p0.h = hi(PLL_CTL);
102 p0.l = lo(PLL_CTL); /* Load the address */
103 cli r2; /* Disable interrupts */
104 ssync;
105 w[p0] = r0.l; /* Set the value */
106 idle; /* Wait for the PLL to stablize */
107 sti r2; /* Enable interrupts */
108
109.Lcheck_again:
110 p0.h = hi(PLL_STAT);
111 p0.l = lo(PLL_STAT);
112 R0 = W[P0](Z);
113 CC = BITTST(R0,5);
114 if ! CC jump .Lcheck_again;
115
116 /* Configure SCLK & CCLK Dividers */
117 r0 = (CONFIG_CCLK_ACT_DIV | CONFIG_SCLK_DIV);
118 p0.h = hi(PLL_DIV);
119 p0.l = lo(PLL_DIV);
120 w[p0] = r0.l;
121 ssync;
122
123 /* disable self refresh by clearing SRREQ */
124 P2.H = hi(EBIU_RSTCTL);
125 P2.L = lo(EBIU_RSTCTL);
126 R0 = [P2];
127 CC = BITTST(R0, 0);
128 if CC jump .Lskipddrrst;
129 BITSET (R0, 0);
130.Lskipddrrst:
131 BITCLR (R0, 3);
132 [P2] = R0;
133 SSYNC;
134
135 p0.l = lo(EBIU_DDRCTL0);
136 p0.h = hi(EBIU_DDRCTL0);
137 r0.l = lo(mem_DDRCTL0);
138 r0.h = hi(mem_DDRCTL0);
139 [p0] = r0;
140 ssync;
141
142 p0.l = lo(EBIU_DDRCTL1);
143 p0.h = hi(EBIU_DDRCTL1);
144 r0.l = lo(mem_DDRCTL1);
145 r0.h = hi(mem_DDRCTL1);
146 [p0] = r0;
147 ssync;
148
149 p0.l = lo(EBIU_DDRCTL2);
150 p0.h = hi(EBIU_DDRCTL2);
151 r0.l = lo(mem_DDRCTL2);
152 r0.h = hi(mem_DDRCTL2);
153 [p0] = r0;
154 ssync;
155
156 RTS;
157ENDPROC(_start_dma_code)
158#endif /* CONFIG_BFIN_KERNEL_CLOCK */
diff --git a/arch/blackfin/mach-bf548/include/mach/anomaly.h b/arch/blackfin/mach-bf548/include/mach/anomaly.h
index 816b09278f62..3b5430999f4f 100644
--- a/arch/blackfin/mach-bf548/include/mach/anomaly.h
+++ b/arch/blackfin/mach-bf548/include/mach/anomaly.h
@@ -157,6 +157,8 @@
157#define ANOMALY_05000429 (__SILICON_REVISION__ < 2) 157#define ANOMALY_05000429 (__SILICON_REVISION__ < 2)
158/* Software System Reset Corrupts PLL_LOCKCNT Register */ 158/* Software System Reset Corrupts PLL_LOCKCNT Register */
159#define ANOMALY_05000430 (__SILICON_REVISION__ >= 2) 159#define ANOMALY_05000430 (__SILICON_REVISION__ >= 2)
160/* IFLUSH Instruction at End of Hardware Loop Causes Infinite Stall */
161#define ANOMALY_05000443 (1)
160 162
161/* Anomalies that don't exist on this proc */ 163/* Anomalies that don't exist on this proc */
162#define ANOMALY_05000125 (0) 164#define ANOMALY_05000125 (0)
@@ -173,5 +175,8 @@
173#define ANOMALY_05000311 (0) 175#define ANOMALY_05000311 (0)
174#define ANOMALY_05000323 (0) 176#define ANOMALY_05000323 (0)
175#define ANOMALY_05000363 (0) 177#define ANOMALY_05000363 (0)
178#define ANOMALY_05000412 (0)
179#define ANOMALY_05000432 (0)
180#define ANOMALY_05000435 (0)
176 181
177#endif 182#endif
diff --git a/arch/blackfin/mach-bf548/include/mach/bf548.h b/arch/blackfin/mach-bf548/include/mach/bf548.h
index 49f9b403d458..f0e569984810 100644
--- a/arch/blackfin/mach-bf548/include/mach/bf548.h
+++ b/arch/blackfin/mach-bf548/include/mach/bf548.h
@@ -122,7 +122,7 @@
122#endif 122#endif
123 123
124#ifndef CPU 124#ifndef CPU
125#error Unknown CPU type - This kernel doesn't seem to be configured properly 125#error "Unknown CPU type - This kernel doesn't seem to be configured properly"
126#endif 126#endif
127 127
128#endif /* __MACH_BF48_H__ */ 128#endif /* __MACH_BF48_H__ */
diff --git a/arch/blackfin/mach-bf548/include/mach/bfin_sir.h b/arch/blackfin/mach-bf548/include/mach/bfin_sir.h
deleted file mode 100644
index c41f9cf00268..000000000000
--- a/arch/blackfin/mach-bf548/include/mach/bfin_sir.h
+++ /dev/null
@@ -1,166 +0,0 @@
1/*
2 * Blackfin Infra-red Driver
3 *
4 * Copyright 2006-2008 Analog Devices Inc.
5 *
6 * Enter bugs at http://blackfin.uclinux.org/
7 *
8 * Licensed under the GPL-2 or later.
9 *
10 */
11
12#include <linux/serial.h>
13#include <asm/dma.h>
14#include <asm/portmux.h>
15
16#define SIR_UART_GET_CHAR(port) bfin_read16((port)->membase + OFFSET_RBR)
17#define SIR_UART_GET_DLL(port) bfin_read16((port)->membase + OFFSET_DLL)
18#define SIR_UART_GET_IER(port) bfin_read16((port)->membase + OFFSET_IER_SET)
19#define SIR_UART_GET_DLH(port) bfin_read16((port)->membase + OFFSET_DLH)
20#define SIR_UART_GET_LCR(port) bfin_read16((port)->membase + OFFSET_LCR)
21#define SIR_UART_GET_LSR(port) bfin_read16((port)->membase + OFFSET_LSR)
22#define SIR_UART_GET_GCTL(port) bfin_read16((port)->membase + OFFSET_GCTL)
23
24#define SIR_UART_PUT_CHAR(port, v) bfin_write16(((port)->membase + OFFSET_THR), v)
25#define SIR_UART_PUT_DLL(port, v) bfin_write16(((port)->membase + OFFSET_DLL), v)
26#define SIR_UART_SET_IER(port, v) bfin_write16(((port)->membase + OFFSET_IER_SET), v)
27#define SIR_UART_CLEAR_IER(port, v) bfin_write16(((port)->membase + OFFSET_IER_CLEAR), v)
28#define SIR_UART_PUT_DLH(port, v) bfin_write16(((port)->membase + OFFSET_DLH), v)
29#define SIR_UART_PUT_LSR(port, v) bfin_write16(((port)->membase + OFFSET_LSR), v)
30#define SIR_UART_PUT_LCR(port, v) bfin_write16(((port)->membase + OFFSET_LCR), v)
31#define SIR_UART_CLEAR_LSR(port) bfin_write16(((port)->membase + OFFSET_LSR), -1)
32#define SIR_UART_PUT_GCTL(port, v) bfin_write16(((port)->membase + OFFSET_GCTL), v)
33
34#ifdef CONFIG_SIR_BFIN_DMA
35struct dma_rx_buf {
36 char *buf;
37 int head;
38 int tail;
39 };
40#endif /* CONFIG_SIR_BFIN_DMA */
41
42struct bfin_sir_port {
43 unsigned char __iomem *membase;
44 unsigned int irq;
45 unsigned int lsr;
46 unsigned long clk;
47 struct net_device *dev;
48#ifdef CONFIG_SIR_BFIN_DMA
49 int tx_done;
50 struct dma_rx_buf rx_dma_buf;
51 struct timer_list rx_dma_timer;
52 int rx_dma_nrows;
53#endif /* CONFIG_SIR_BFIN_DMA */
54 unsigned int tx_dma_channel;
55 unsigned int rx_dma_channel;
56};
57
58struct bfin_sir_port sir_ports[BFIN_UART_NR_PORTS];
59
60struct bfin_sir_port_res {
61 unsigned long base_addr;
62 int irq;
63 unsigned int rx_dma_channel;
64 unsigned int tx_dma_channel;
65};
66
67struct bfin_sir_port_res bfin_sir_port_resource[] = {
68#ifdef CONFIG_BFIN_SIR0
69 {
70 0xFFC00400,
71 IRQ_UART0_RX,
72 CH_UART0_RX,
73 CH_UART0_TX,
74 },
75#endif
76#ifdef CONFIG_BFIN_SIR1
77 {
78 0xFFC02000,
79 IRQ_UART1_RX,
80 CH_UART1_RX,
81 CH_UART1_TX,
82 },
83#endif
84#ifdef CONFIG_BFIN_SIR2
85 {
86 0xFFC02100,
87 IRQ_UART2_RX,
88 CH_UART2_RX,
89 CH_UART2_TX,
90 },
91#endif
92#ifdef CONFIG_BFIN_SIR3
93 {
94 0xFFC03100,
95 IRQ_UART3_RX,
96 CH_UART3_RX,
97 CH_UART3_TX,
98 },
99#endif
100};
101
102int nr_sirs = ARRAY_SIZE(bfin_sir_port_resource);
103
104struct bfin_sir_self {
105 struct bfin_sir_port *sir_port;
106 spinlock_t lock;
107 unsigned int open;
108 int speed;
109 int newspeed;
110
111 struct sk_buff *txskb;
112 struct sk_buff *rxskb;
113 struct net_device_stats stats;
114 struct device *dev;
115 struct irlap_cb *irlap;
116 struct qos_info qos;
117
118 iobuff_t tx_buff;
119 iobuff_t rx_buff;
120
121 struct work_struct work;
122 int mtt;
123};
124
125#define DRIVER_NAME "bfin_sir"
126
127static int bfin_sir_hw_init(void)
128{
129 int ret = -ENODEV;
130#ifdef CONFIG_BFIN_SIR0
131 ret = peripheral_request(P_UART0_TX, DRIVER_NAME);
132 if (ret)
133 return ret;
134 ret = peripheral_request(P_UART0_RX, DRIVER_NAME);
135 if (ret)
136 return ret;
137#endif
138
139#ifdef CONFIG_BFIN_SIR1
140 ret = peripheral_request(P_UART1_TX, DRIVER_NAME);
141 if (ret)
142 return ret;
143 ret = peripheral_request(P_UART1_RX, DRIVER_NAME);
144 if (ret)
145 return ret;
146#endif
147
148#ifdef CONFIG_BFIN_SIR2
149 ret = peripheral_request(P_UART2_TX, DRIVER_NAME);
150 if (ret)
151 return ret;
152 ret = peripheral_request(P_UART2_RX, DRIVER_NAME);
153 if (ret)
154 return ret;
155#endif
156
157#ifdef CONFIG_BFIN_SIR3
158 ret = peripheral_request(P_UART3_TX, DRIVER_NAME);
159 if (ret)
160 return ret;
161 ret = peripheral_request(P_UART3_RX, DRIVER_NAME);
162 if (ret)
163 return ret;
164#endif
165 return ret;
166}
diff --git a/arch/blackfin/mach-bf548/include/mach/blackfin.h b/arch/blackfin/mach-bf548/include/mach/blackfin.h
index d6ee74ac0460..0c0e3e2c3c21 100644
--- a/arch/blackfin/mach-bf548/include/mach/blackfin.h
+++ b/arch/blackfin/mach-bf548/include/mach/blackfin.h
@@ -111,7 +111,7 @@
111 111
112/* UART 0*/ 112/* UART 0*/
113 113
114/* DMA Channnel */ 114/* DMA Channel */
115#define bfin_read_CH_UART_RX() bfin_read_CH_UART1_RX() 115#define bfin_read_CH_UART_RX() bfin_read_CH_UART1_RX()
116#define bfin_write_CH_UART_RX(val) bfin_write_CH_UART1_RX(val) 116#define bfin_write_CH_UART_RX(val) bfin_write_CH_UART1_RX(val)
117#define bfin_read_CH_UART_TX() bfin_read_CH_UART1_TX() 117#define bfin_read_CH_UART_TX() bfin_read_CH_UART1_TX()
diff --git a/arch/blackfin/mach-bf548/include/mach/cdefBF54x_base.h b/arch/blackfin/mach-bf548/include/mach/cdefBF54x_base.h
index 57ac8cb9b1f6..6e636c418cb0 100644
--- a/arch/blackfin/mach-bf548/include/mach/cdefBF54x_base.h
+++ b/arch/blackfin/mach-bf548/include/mach/cdefBF54x_base.h
@@ -34,7 +34,6 @@
34#include <asm/blackfin.h> 34#include <asm/blackfin.h>
35 35
36#include "defBF54x_base.h" 36#include "defBF54x_base.h"
37#include <asm/system.h>
38 37
39/* ************************************************************** */ 38/* ************************************************************** */
40/* SYSTEM & MMR ADDRESS DEFINITIONS COMMON TO ALL ADSP-BF54x */ 39/* SYSTEM & MMR ADDRESS DEFINITIONS COMMON TO ALL ADSP-BF54x */
@@ -43,63 +42,9 @@
43/* PLL Registers */ 42/* PLL Registers */
44 43
45#define bfin_read_PLL_CTL() bfin_read16(PLL_CTL) 44#define bfin_read_PLL_CTL() bfin_read16(PLL_CTL)
46/* Writing to PLL_CTL initiates a PLL relock sequence. */
47static __inline__ void bfin_write_PLL_CTL(unsigned int val)
48{
49 unsigned long flags, iwr0, iwr1, iwr2;
50
51 if (val == bfin_read_PLL_CTL())
52 return;
53
54 local_irq_save(flags);
55 /* Enable the PLL Wakeup bit in SIC IWR */
56 iwr0 = bfin_read32(SIC_IWR0);
57 iwr1 = bfin_read32(SIC_IWR1);
58 iwr2 = bfin_read32(SIC_IWR2);
59 /* Only allow PPL Wakeup) */
60 bfin_write32(SIC_IWR0, IWR_ENABLE(0));
61 bfin_write32(SIC_IWR1, 0);
62 bfin_write32(SIC_IWR2, 0);
63
64 bfin_write16(PLL_CTL, val);
65 SSYNC();
66 asm("IDLE;");
67
68 bfin_write32(SIC_IWR0, iwr0);
69 bfin_write32(SIC_IWR1, iwr1);
70 bfin_write32(SIC_IWR2, iwr2);
71 local_irq_restore(flags);
72}
73#define bfin_read_PLL_DIV() bfin_read16(PLL_DIV) 45#define bfin_read_PLL_DIV() bfin_read16(PLL_DIV)
74#define bfin_write_PLL_DIV(val) bfin_write16(PLL_DIV, val) 46#define bfin_write_PLL_DIV(val) bfin_write16(PLL_DIV, val)
75#define bfin_read_VR_CTL() bfin_read16(VR_CTL) 47#define bfin_read_VR_CTL() bfin_read16(VR_CTL)
76/* Writing to VR_CTL initiates a PLL relock sequence. */
77static __inline__ void bfin_write_VR_CTL(unsigned int val)
78{
79 unsigned long flags, iwr0, iwr1, iwr2;
80
81 if (val == bfin_read_VR_CTL())
82 return;
83
84 local_irq_save(flags);
85 /* Enable the PLL Wakeup bit in SIC IWR */
86 iwr0 = bfin_read32(SIC_IWR0);
87 iwr1 = bfin_read32(SIC_IWR1);
88 iwr2 = bfin_read32(SIC_IWR2);
89 /* Only allow PPL Wakeup) */
90 bfin_write32(SIC_IWR0, IWR_ENABLE(0));
91 bfin_write32(SIC_IWR1, 0);
92 bfin_write32(SIC_IWR2, 0);
93
94 bfin_write16(VR_CTL, val);
95 SSYNC();
96 asm("IDLE;");
97
98 bfin_write32(SIC_IWR0, iwr0);
99 bfin_write32(SIC_IWR1, iwr1);
100 bfin_write32(SIC_IWR2, iwr2);
101 local_irq_restore(flags);
102}
103#define bfin_read_PLL_STAT() bfin_read16(PLL_STAT) 48#define bfin_read_PLL_STAT() bfin_read16(PLL_STAT)
104#define bfin_write_PLL_STAT(val) bfin_write16(PLL_STAT, val) 49#define bfin_write_PLL_STAT(val) bfin_write16(PLL_STAT, val)
105#define bfin_read_PLL_LOCKCNT() bfin_read16(PLL_LOCKCNT) 50#define bfin_read_PLL_LOCKCNT() bfin_read16(PLL_LOCKCNT)
@@ -2746,5 +2691,64 @@ static __inline__ void bfin_write_VR_CTL(unsigned int val)
2746#define bfin_read_PINT3_IRQ bfin_read_PINT3_REQUEST 2691#define bfin_read_PINT3_IRQ bfin_read_PINT3_REQUEST
2747#define bfin_write_PINT3_IRQ bfin_write_PINT3_REQUEST 2692#define bfin_write_PINT3_IRQ bfin_write_PINT3_REQUEST
2748 2693
2694/* These need to be last due to the cdef/linux inter-dependencies */
2695#include <asm/irq.h>
2696
2697/* Writing to PLL_CTL initiates a PLL relock sequence. */
2698static __inline__ void bfin_write_PLL_CTL(unsigned int val)
2699{
2700 unsigned long flags, iwr0, iwr1, iwr2;
2701
2702 if (val == bfin_read_PLL_CTL())
2703 return;
2704
2705 local_irq_save_hw(flags);
2706 /* Enable the PLL Wakeup bit in SIC IWR */
2707 iwr0 = bfin_read32(SIC_IWR0);
2708 iwr1 = bfin_read32(SIC_IWR1);
2709 iwr2 = bfin_read32(SIC_IWR2);
2710 /* Only allow PPL Wakeup) */
2711 bfin_write32(SIC_IWR0, IWR_ENABLE(0));
2712 bfin_write32(SIC_IWR1, 0);
2713 bfin_write32(SIC_IWR2, 0);
2714
2715 bfin_write16(PLL_CTL, val);
2716 SSYNC();
2717 asm("IDLE;");
2718
2719 bfin_write32(SIC_IWR0, iwr0);
2720 bfin_write32(SIC_IWR1, iwr1);
2721 bfin_write32(SIC_IWR2, iwr2);
2722 local_irq_restore_hw(flags);
2723}
2724
2725/* Writing to VR_CTL initiates a PLL relock sequence. */
2726static __inline__ void bfin_write_VR_CTL(unsigned int val)
2727{
2728 unsigned long flags, iwr0, iwr1, iwr2;
2729
2730 if (val == bfin_read_VR_CTL())
2731 return;
2732
2733 local_irq_save_hw(flags);
2734 /* Enable the PLL Wakeup bit in SIC IWR */
2735 iwr0 = bfin_read32(SIC_IWR0);
2736 iwr1 = bfin_read32(SIC_IWR1);
2737 iwr2 = bfin_read32(SIC_IWR2);
2738 /* Only allow PPL Wakeup) */
2739 bfin_write32(SIC_IWR0, IWR_ENABLE(0));
2740 bfin_write32(SIC_IWR1, 0);
2741 bfin_write32(SIC_IWR2, 0);
2742
2743 bfin_write16(VR_CTL, val);
2744 SSYNC();
2745 asm("IDLE;");
2746
2747 bfin_write32(SIC_IWR0, iwr0);
2748 bfin_write32(SIC_IWR1, iwr1);
2749 bfin_write32(SIC_IWR2, iwr2);
2750 local_irq_restore_hw(flags);
2751}
2752
2749#endif /* _CDEF_BF54X_H */ 2753#endif /* _CDEF_BF54X_H */
2750 2754
diff --git a/arch/blackfin/mach-bf548/include/mach/dma.h b/arch/blackfin/mach-bf548/include/mach/dma.h
index 36a2ef7e7849..a30d242c7398 100644
--- a/arch/blackfin/mach-bf548/include/mach/dma.h
+++ b/arch/blackfin/mach-bf548/include/mach/dma.h
@@ -1,32 +1,8 @@
1/* 1/* mach/dma.h - arch-specific DMA defines
2 * file: include/asm-blackfin/mach-bf548/dma.h
3 * based on:
4 * author:
5 * 2 *
6 * created: 3 * Copyright 2004-2008 Analog Devices Inc.
7 * description:
8 * system mmr register map
9 * rev:
10 * 4 *
11 * modified: 5 * Licensed under the GPL-2 or later.
12 *
13 *
14 * bugs: enter bugs at http://blackfin.uclinux.org/
15 *
16 * this program is free software; you can redistribute it and/or modify
17 * it under the terms of the gnu general public license as published by
18 * the free software foundation; either version 2, or (at your option)
19 * any later version.
20 *
21 * this program is distributed in the hope that it will be useful,
22 * but without any warranty; without even the implied warranty of
23 * merchantability or fitness for a particular purpose. see the
24 * gnu general public license for more details.
25 *
26 * you should have received a copy of the gnu general public license
27 * along with this program; see the file copying.
28 * if not, write to the free software foundation,
29 * 59 temple place - suite 330, boston, ma 02111-1307, usa.
30 */ 6 */
31 7
32#ifndef _MACH_DMA_H_ 8#ifndef _MACH_DMA_H_
@@ -71,6 +47,6 @@
71#define CH_MEM_STREAM3_DEST 30 47#define CH_MEM_STREAM3_DEST 30
72#define CH_MEM_STREAM3_SRC 31 48#define CH_MEM_STREAM3_SRC 31
73 49
74#define MAX_BLACKFIN_DMA_CHANNEL 32 50#define MAX_DMA_CHANNELS 32
75 51
76#endif 52#endif
diff --git a/arch/blackfin/mach-bf548/include/mach/irq.h b/arch/blackfin/mach-bf548/include/mach/irq.h
index ad380d1f5872..60299a71e090 100644
--- a/arch/blackfin/mach-bf548/include/mach/irq.h
+++ b/arch/blackfin/mach-bf548/include/mach/irq.h
@@ -158,7 +158,7 @@ Events (highest priority) EMU 0
158#define IRQ_PINT2 BFIN_IRQ(94) /* PINT2 Interrupt */ 158#define IRQ_PINT2 BFIN_IRQ(94) /* PINT2 Interrupt */
159#define IRQ_PINT3 BFIN_IRQ(95) /* PINT3 Interrupt */ 159#define IRQ_PINT3 BFIN_IRQ(95) /* PINT3 Interrupt */
160 160
161#define SYS_IRQS IRQ_PINT3 161#define SYS_IRQS IRQ_PINT3
162 162
163#define BFIN_PA_IRQ(x) ((x) + SYS_IRQS + 1) 163#define BFIN_PA_IRQ(x) ((x) + SYS_IRQS + 1)
164#define IRQ_PA0 BFIN_PA_IRQ(0) 164#define IRQ_PA0 BFIN_PA_IRQ(0)
diff --git a/arch/blackfin/mach-bf548/include/mach/mem_init.h b/arch/blackfin/mach-bf548/include/mach/mem_init.h
deleted file mode 100644
index ab0b863eee66..000000000000
--- a/arch/blackfin/mach-bf548/include/mach/mem_init.h
+++ /dev/null
@@ -1,255 +0,0 @@
1/*
2 * File: include/asm-blackfin/mach-bf548/mem_init.h
3 * Based on:
4 * Author:
5 *
6 * Created:
7 * Description:
8 *
9 * Rev:
10 *
11 * Modified:
12 * Copyright 2004-2006 Analog Devices Inc.
13 *
14 * Bugs: Enter bugs at http://blackfin.uclinux.org/
15 *
16 * This program is free software; you can redistribute it and/or modify
17 * it under the terms of the GNU General Public License as published by
18 * the Free Software Foundation; either version 2, or (at your option)
19 * any later version.
20 *
21 * This program is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 * GNU General Public License for more details.
25 *
26 * You should have received a copy of the GNU General Public License
27 * along with this program; see the file COPYING.
28 * If not, write to the Free Software Foundation,
29 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
30 */
31#define MIN_DDR_SCLK(x) (x*(CONFIG_SCLK_HZ/1000/1000)/1000 + 1)
32#define MAX_DDR_SCLK(x) (x*(CONFIG_SCLK_HZ/1000/1000)/1000)
33#define DDR_CLK_HZ(x) (1000*1000*1000/x)
34
35#if (CONFIG_MEM_MT46V32M16_6T)
36#define DDR_SIZE DEVSZ_512
37#define DDR_WIDTH DEVWD_16
38#define DDR_MAX_tCK 13
39
40#define DDR_tRC DDR_TRC(MIN_DDR_SCLK(60))
41#define DDR_tRAS DDR_TRAS(MIN_DDR_SCLK(42))
42#define DDR_tRP DDR_TRP(MIN_DDR_SCLK(15))
43#define DDR_tRFC DDR_TRFC(MIN_DDR_SCLK(72))
44#define DDR_tREFI DDR_TREFI(MAX_DDR_SCLK(7800))
45
46#define DDR_tRCD DDR_TRCD(MIN_DDR_SCLK(15))
47#define DDR_tWTR DDR_TWTR(1)
48#define DDR_tMRD DDR_TMRD(MIN_DDR_SCLK(12))
49#define DDR_tWR DDR_TWR(MIN_DDR_SCLK(15))
50#endif
51
52#if (CONFIG_MEM_MT46V32M16_5B)
53#define DDR_SIZE DEVSZ_512
54#define DDR_WIDTH DEVWD_16
55#define DDR_MAX_tCK 13
56
57#define DDR_tRC DDR_TRC(MIN_DDR_SCLK(55))
58#define DDR_tRAS DDR_TRAS(MIN_DDR_SCLK(40))
59#define DDR_tRP DDR_TRP(MIN_DDR_SCLK(15))
60#define DDR_tRFC DDR_TRFC(MIN_DDR_SCLK(70))
61#define DDR_tREFI DDR_TREFI(MAX_DDR_SCLK(7800))
62
63#define DDR_tRCD DDR_TRCD(MIN_DDR_SCLK(15))
64#define DDR_tWTR DDR_TWTR(2)
65#define DDR_tMRD DDR_TMRD(MIN_DDR_SCLK(10))
66#define DDR_tWR DDR_TWR(MIN_DDR_SCLK(15))
67#endif
68
69#if (CONFIG_MEM_GENERIC_BOARD)
70#define DDR_SIZE DEVSZ_512
71#define DDR_WIDTH DEVWD_16
72#define DDR_MAX_tCK 13
73
74#define DDR_tRCD DDR_TRCD(3)
75#define DDR_tWTR DDR_TWTR(2)
76#define DDR_tWR DDR_TWR(2)
77#define DDR_tMRD DDR_TMRD(2)
78#define DDR_tRP DDR_TRP(3)
79#define DDR_tRAS DDR_TRAS(7)
80#define DDR_tRC DDR_TRC(10)
81#define DDR_tRFC DDR_TRFC(12)
82#define DDR_tREFI DDR_TREFI(1288)
83#endif
84
85#if (CONFIG_SCLK_HZ < DDR_CLK_HZ(DDR_MAX_tCK))
86# error "CONFIG_SCLK_HZ is too small (<DDR_CLK_HZ(DDR_MAX_tCK) Hz)."
87#elif(CONFIG_SCLK_HZ <= 133333333)
88# define DDR_CL CL_2
89#else
90# error "CONFIG_SCLK_HZ is too large (>133333333 Hz)."
91#endif
92
93
94#define mem_DDRCTL0 (DDR_tRP | DDR_tRAS | DDR_tRC | DDR_tRFC | DDR_tREFI)
95#define mem_DDRCTL1 (DDR_DATWIDTH | EXTBANK_1 | DDR_SIZE | DDR_WIDTH | DDR_tWTR \
96 | DDR_tMRD | DDR_tWR | DDR_tRCD)
97#define mem_DDRCTL2 DDR_CL
98
99
100#if defined CONFIG_CLKIN_HALF
101#define CLKIN_HALF 1
102#else
103#define CLKIN_HALF 0
104#endif
105
106#if defined CONFIG_PLL_BYPASS
107#define PLL_BYPASS 1
108#else
109#define PLL_BYPASS 0
110#endif
111
112/***************************************Currently Not Being Used *********************************/
113#define flash_EBIU_AMBCTL_WAT ((CONFIG_FLASH_SPEED_BWAT * 4) / (4000000000 / CONFIG_SCLK_HZ)) + 1
114#define flash_EBIU_AMBCTL_RAT ((CONFIG_FLASH_SPEED_BRAT * 4) / (4000000000 / CONFIG_SCLK_HZ)) + 1
115#define flash_EBIU_AMBCTL_HT ((CONFIG_FLASH_SPEED_BHT * 4) / (4000000000 / CONFIG_SCLK_HZ))
116#define flash_EBIU_AMBCTL_ST ((CONFIG_FLASH_SPEED_BST * 4) / (4000000000 / CONFIG_SCLK_HZ)) + 1
117#define flash_EBIU_AMBCTL_TT ((CONFIG_FLASH_SPEED_BTT * 4) / (4000000000 / CONFIG_SCLK_HZ)) + 1
118
119#if (flash_EBIU_AMBCTL_TT > 3)
120#define flash_EBIU_AMBCTL0_TT B0TT_4
121#endif
122#if (flash_EBIU_AMBCTL_TT == 3)
123#define flash_EBIU_AMBCTL0_TT B0TT_3
124#endif
125#if (flash_EBIU_AMBCTL_TT == 2)
126#define flash_EBIU_AMBCTL0_TT B0TT_2
127#endif
128#if (flash_EBIU_AMBCTL_TT < 2)
129#define flash_EBIU_AMBCTL0_TT B0TT_1
130#endif
131
132#if (flash_EBIU_AMBCTL_ST > 3)
133#define flash_EBIU_AMBCTL0_ST B0ST_4
134#endif
135#if (flash_EBIU_AMBCTL_ST == 3)
136#define flash_EBIU_AMBCTL0_ST B0ST_3
137#endif
138#if (flash_EBIU_AMBCTL_ST == 2)
139#define flash_EBIU_AMBCTL0_ST B0ST_2
140#endif
141#if (flash_EBIU_AMBCTL_ST < 2)
142#define flash_EBIU_AMBCTL0_ST B0ST_1
143#endif
144
145#if (flash_EBIU_AMBCTL_HT > 2)
146#define flash_EBIU_AMBCTL0_HT B0HT_3
147#endif
148#if (flash_EBIU_AMBCTL_HT == 2)
149#define flash_EBIU_AMBCTL0_HT B0HT_2
150#endif
151#if (flash_EBIU_AMBCTL_HT == 1)
152#define flash_EBIU_AMBCTL0_HT B0HT_1
153#endif
154#if (flash_EBIU_AMBCTL_HT == 0 && CONFIG_FLASH_SPEED_BHT == 0)
155#define flash_EBIU_AMBCTL0_HT B0HT_0
156#endif
157#if (flash_EBIU_AMBCTL_HT == 0 && CONFIG_FLASH_SPEED_BHT != 0)
158#define flash_EBIU_AMBCTL0_HT B0HT_1
159#endif
160
161#if (flash_EBIU_AMBCTL_WAT > 14)
162#define flash_EBIU_AMBCTL0_WAT B0WAT_15
163#endif
164#if (flash_EBIU_AMBCTL_WAT == 14)
165#define flash_EBIU_AMBCTL0_WAT B0WAT_14
166#endif
167#if (flash_EBIU_AMBCTL_WAT == 13)
168#define flash_EBIU_AMBCTL0_WAT B0WAT_13
169#endif
170#if (flash_EBIU_AMBCTL_WAT == 12)
171#define flash_EBIU_AMBCTL0_WAT B0WAT_12
172#endif
173#if (flash_EBIU_AMBCTL_WAT == 11)
174#define flash_EBIU_AMBCTL0_WAT B0WAT_11
175#endif
176#if (flash_EBIU_AMBCTL_WAT == 10)
177#define flash_EBIU_AMBCTL0_WAT B0WAT_10
178#endif
179#if (flash_EBIU_AMBCTL_WAT == 9)
180#define flash_EBIU_AMBCTL0_WAT B0WAT_9
181#endif
182#if (flash_EBIU_AMBCTL_WAT == 8)
183#define flash_EBIU_AMBCTL0_WAT B0WAT_8
184#endif
185#if (flash_EBIU_AMBCTL_WAT == 7)
186#define flash_EBIU_AMBCTL0_WAT B0WAT_7
187#endif
188#if (flash_EBIU_AMBCTL_WAT == 6)
189#define flash_EBIU_AMBCTL0_WAT B0WAT_6
190#endif
191#if (flash_EBIU_AMBCTL_WAT == 5)
192#define flash_EBIU_AMBCTL0_WAT B0WAT_5
193#endif
194#if (flash_EBIU_AMBCTL_WAT == 4)
195#define flash_EBIU_AMBCTL0_WAT B0WAT_4
196#endif
197#if (flash_EBIU_AMBCTL_WAT == 3)
198#define flash_EBIU_AMBCTL0_WAT B0WAT_3
199#endif
200#if (flash_EBIU_AMBCTL_WAT == 2)
201#define flash_EBIU_AMBCTL0_WAT B0WAT_2
202#endif
203#if (flash_EBIU_AMBCTL_WAT == 1)
204#define flash_EBIU_AMBCTL0_WAT B0WAT_1
205#endif
206
207#if (flash_EBIU_AMBCTL_RAT > 14)
208#define flash_EBIU_AMBCTL0_RAT B0RAT_15
209#endif
210#if (flash_EBIU_AMBCTL_RAT == 14)
211#define flash_EBIU_AMBCTL0_RAT B0RAT_14
212#endif
213#if (flash_EBIU_AMBCTL_RAT == 13)
214#define flash_EBIU_AMBCTL0_RAT B0RAT_13
215#endif
216#if (flash_EBIU_AMBCTL_RAT == 12)
217#define flash_EBIU_AMBCTL0_RAT B0RAT_12
218#endif
219#if (flash_EBIU_AMBCTL_RAT == 11)
220#define flash_EBIU_AMBCTL0_RAT B0RAT_11
221#endif
222#if (flash_EBIU_AMBCTL_RAT == 10)
223#define flash_EBIU_AMBCTL0_RAT B0RAT_10
224#endif
225#if (flash_EBIU_AMBCTL_RAT == 9)
226#define flash_EBIU_AMBCTL0_RAT B0RAT_9
227#endif
228#if (flash_EBIU_AMBCTL_RAT == 8)
229#define flash_EBIU_AMBCTL0_RAT B0RAT_8
230#endif
231#if (flash_EBIU_AMBCTL_RAT == 7)
232#define flash_EBIU_AMBCTL0_RAT B0RAT_7
233#endif
234#if (flash_EBIU_AMBCTL_RAT == 6)
235#define flash_EBIU_AMBCTL0_RAT B0RAT_6
236#endif
237#if (flash_EBIU_AMBCTL_RAT == 5)
238#define flash_EBIU_AMBCTL0_RAT B0RAT_5
239#endif
240#if (flash_EBIU_AMBCTL_RAT == 4)
241#define flash_EBIU_AMBCTL0_RAT B0RAT_4
242#endif
243#if (flash_EBIU_AMBCTL_RAT == 3)
244#define flash_EBIU_AMBCTL0_RAT B0RAT_3
245#endif
246#if (flash_EBIU_AMBCTL_RAT == 2)
247#define flash_EBIU_AMBCTL0_RAT B0RAT_2
248#endif
249#if (flash_EBIU_AMBCTL_RAT == 1)
250#define flash_EBIU_AMBCTL0_RAT B0RAT_1
251#endif
252
253#define flash_EBIU_AMBCTL0 \
254 (flash_EBIU_AMBCTL0_WAT | flash_EBIU_AMBCTL0_RAT | flash_EBIU_AMBCTL0_HT | \
255 flash_EBIU_AMBCTL0_ST | flash_EBIU_AMBCTL0_TT | CONFIG_FLASH_SPEED_RDYEN)
diff --git a/arch/blackfin/mach-bf548/include/mach/mem_map.h b/arch/blackfin/mach-bf548/include/mach/mem_map.h
index a2228428dc06..70b9c1194024 100644
--- a/arch/blackfin/mach-bf548/include/mach/mem_map.h
+++ b/arch/blackfin/mach-bf548/include/mach/mem_map.h
@@ -108,4 +108,10 @@
108#define L1_SCRATCH_START 0xFFB00000 108#define L1_SCRATCH_START 0xFFB00000
109#define L1_SCRATCH_LENGTH 0x1000 109#define L1_SCRATCH_LENGTH 0x1000
110 110
111#define GET_PDA_SAFE(preg) \
112 preg.l = _cpu_pda; \
113 preg.h = _cpu_pda;
114
115#define GET_PDA(preg, dreg) GET_PDA_SAFE(preg)
116
111#endif/* _MEM_MAP_548_H_ */ 117#endif/* _MEM_MAP_548_H_ */
diff --git a/arch/blackfin/mach-bf561/Kconfig b/arch/blackfin/mach-bf561/Kconfig
index 3f4895450bea..638ec38ca470 100644
--- a/arch/blackfin/mach-bf561/Kconfig
+++ b/arch/blackfin/mach-bf561/Kconfig
@@ -4,9 +4,9 @@ source "arch/blackfin/mach-bf561/boards/Kconfig"
4 4
5menu "BF561 Specific Configuration" 5menu "BF561 Specific Configuration"
6 6
7comment "Core B Support" 7if (!SMP)
8 8
9menu "Core B Support" 9comment "Core B Support"
10 10
11config BF561_COREB 11config BF561_COREB
12 bool "Enable Core B support" 12 bool "Enable Core B support"
@@ -25,7 +25,7 @@ config BF561_COREB_RESET
25 0 is set, and will reset PC to 0xff600000 when 25 0 is set, and will reset PC to 0xff600000 when
26 COREB_SRAM_INIT is cleared. 26 COREB_SRAM_INIT is cleared.
27 27
28endmenu 28endif
29 29
30comment "Interrupt Priority Assignment" 30comment "Interrupt Priority Assignment"
31 31
@@ -138,7 +138,7 @@ config IRQ_DMA2_11
138 default 9 138 default 9
139config IRQ_TIMER0 139config IRQ_TIMER0
140 int "TIMER 0 Interrupt" 140 int "TIMER 0 Interrupt"
141 default 10 141 default 8
142config IRQ_TIMER1 142config IRQ_TIMER1
143 int "TIMER 1 Interrupt" 143 int "TIMER 1 Interrupt"
144 default 10 144 default 10
diff --git a/arch/blackfin/mach-bf561/Makefile b/arch/blackfin/mach-bf561/Makefile
index f39235a55783..59e18afe28c6 100644
--- a/arch/blackfin/mach-bf561/Makefile
+++ b/arch/blackfin/mach-bf561/Makefile
@@ -2,8 +2,7 @@
2# arch/blackfin/mach-bf561/Makefile 2# arch/blackfin/mach-bf561/Makefile
3# 3#
4 4
5extra-y := head.o
6
7obj-y := ints-priority.o dma.o 5obj-y := ints-priority.o dma.o
8 6
9obj-$(CONFIG_BF561_COREB) += coreb.o 7obj-$(CONFIG_BF561_COREB) += coreb.o
8obj-$(CONFIG_SMP) += smp.o secondary.o atomic.o
diff --git a/arch/blackfin/mach-bf561/atomic.S b/arch/blackfin/mach-bf561/atomic.S
new file mode 100644
index 000000000000..9439bc6bd01f
--- /dev/null
+++ b/arch/blackfin/mach-bf561/atomic.S
@@ -0,0 +1,919 @@
1/*
2 * File: arch/blackfin/mach-bf561/atomic.S
3 * Author: Philippe Gerum <rpm@xenomai.org>
4 *
5 * Copyright 2007 Analog Devices Inc.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, see the file COPYING, or write
19 * to the Free Software Foundation, Inc.,
20 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21 */
22
23#include <linux/linkage.h>
24#include <asm/blackfin.h>
25#include <asm/cache.h>
26#include <asm/asm-offsets.h>
27#include <asm/rwlock.h>
28#include <asm/cplb.h>
29
30.text
31
32.macro coreslot_loadaddr reg:req
33 \reg\().l = _corelock;
34 \reg\().h = _corelock;
35.endm
36
37/*
38 * r0 = address of atomic data to flush and invalidate (32bit).
39 *
40 * Clear interrupts and return the old mask.
41 * We assume that no atomic data can span cachelines.
42 *
43 * Clobbers: r2:0, p0
44 */
45ENTRY(_get_core_lock)
46 r1 = -L1_CACHE_BYTES;
47 r1 = r0 & r1;
48 cli r0;
49 coreslot_loadaddr p0;
50.Lretry_corelock:
51 testset (p0);
52 if cc jump .Ldone_corelock;
53 SSYNC(r2);
54 jump .Lretry_corelock
55.Ldone_corelock:
56 p0 = r1;
57 CSYNC(r2);
58 flushinv[p0];
59 SSYNC(r2);
60 rts;
61ENDPROC(_get_core_lock)
62
63/*
64 * r0 = address of atomic data in uncacheable memory region (32bit).
65 *
66 * Clear interrupts and return the old mask.
67 *
68 * Clobbers: r0, p0
69 */
70ENTRY(_get_core_lock_noflush)
71 cli r0;
72 coreslot_loadaddr p0;
73.Lretry_corelock_noflush:
74 testset (p0);
75 if cc jump .Ldone_corelock_noflush;
76 SSYNC(r2);
77 jump .Lretry_corelock_noflush
78.Ldone_corelock_noflush:
79 rts;
80ENDPROC(_get_core_lock_noflush)
81
82/*
83 * r0 = interrupt mask to restore.
84 * r1 = address of atomic data to flush and invalidate (32bit).
85 *
86 * Interrupts are masked on entry (see _get_core_lock).
87 * Clobbers: r2:0, p0
88 */
89ENTRY(_put_core_lock)
90 /* Write-through cache assumed, so no flush needed here. */
91 coreslot_loadaddr p0;
92 r1 = 0;
93 [p0] = r1;
94 SSYNC(r2);
95 sti r0;
96 rts;
97ENDPROC(_put_core_lock)
98
99#ifdef __ARCH_SYNC_CORE_DCACHE
100
101ENTRY(___raw_smp_mark_barrier_asm)
102 [--sp] = rets;
103 [--sp] = ( r7:5 );
104 [--sp] = r0;
105 [--sp] = p1;
106 [--sp] = p0;
107 call _get_core_lock_noflush;
108
109 /*
110 * Calculate current core mask
111 */
112 GET_CPUID(p1, r7);
113 r6 = 1;
114 r6 <<= r7;
115
116 /*
117 * Set bit of other cores in barrier mask. Don't change current core bit.
118 */
119 p1.l = _barrier_mask;
120 p1.h = _barrier_mask;
121 r7 = [p1];
122 r5 = r7 & r6;
123 r7 = ~r6;
124 cc = r5 == 0;
125 if cc jump 1f;
126 r7 = r7 | r6;
1271:
128 [p1] = r7;
129 SSYNC(r2);
130
131 call _put_core_lock;
132 p0 = [sp++];
133 p1 = [sp++];
134 r0 = [sp++];
135 ( r7:5 ) = [sp++];
136 rets = [sp++];
137 rts;
138ENDPROC(___raw_smp_mark_barrier_asm)
139
140ENTRY(___raw_smp_check_barrier_asm)
141 [--sp] = rets;
142 [--sp] = ( r7:5 );
143 [--sp] = r0;
144 [--sp] = p1;
145 [--sp] = p0;
146 call _get_core_lock_noflush;
147
148 /*
149 * Calculate current core mask
150 */
151 GET_CPUID(p1, r7);
152 r6 = 1;
153 r6 <<= r7;
154
155 /*
156 * Clear current core bit in barrier mask if it is set.
157 */
158 p1.l = _barrier_mask;
159 p1.h = _barrier_mask;
160 r7 = [p1];
161 r5 = r7 & r6;
162 cc = r5 == 0;
163 if cc jump 1f;
164 r6 = ~r6;
165 r7 = r7 & r6;
166 [p1] = r7;
167 SSYNC(r2);
168
169 call _put_core_lock;
170
171 /*
172 * Invalidate the entire D-cache of current core.
173 */
174 sp += -12;
175 call _resync_core_dcache
176 sp += 12;
177 jump 2f;
1781:
179 call _put_core_lock;
1802:
181 p0 = [sp++];
182 p1 = [sp++];
183 r0 = [sp++];
184 ( r7:5 ) = [sp++];
185 rets = [sp++];
186 rts;
187ENDPROC(___raw_smp_check_barrier_asm)
188
189/*
190 * r0 = irqflags
191 * r1 = address of atomic data
192 *
193 * Clobbers: r2:0, p1:0
194 */
195_start_lock_coherent:
196
197 [--sp] = rets;
198 [--sp] = ( r7:6 );
199 r7 = r0;
200 p1 = r1;
201
202 /*
203 * Determine whether the atomic data was previously
204 * owned by another CPU (=r6).
205 */
206 GET_CPUID(p0, r2);
207 r1 = 1;
208 r1 <<= r2;
209 r2 = ~r1;
210
211 r1 = [p1];
212 r1 >>= 28; /* CPU fingerprints are stored in the high nibble. */
213 r6 = r1 & r2;
214 r1 = [p1];
215 r1 <<= 4;
216 r1 >>= 4;
217 [p1] = r1;
218
219 /*
220 * Release the core lock now, but keep IRQs disabled while we are
221 * performing the remaining housekeeping chores for the current CPU.
222 */
223 coreslot_loadaddr p0;
224 r1 = 0;
225 [p0] = r1;
226
227 /*
228 * If another CPU has owned the same atomic section before us,
229 * then our D-cached copy of the shared data protected by the
230 * current spin/write_lock may be obsolete.
231 */
232 cc = r6 == 0;
233 if cc jump .Lcache_synced
234
235 /*
236 * Invalidate the entire D-cache of the current core.
237 */
238 sp += -12;
239 call _resync_core_dcache
240 sp += 12;
241
242.Lcache_synced:
243 SSYNC(r2);
244 sti r7;
245 ( r7:6 ) = [sp++];
246 rets = [sp++];
247 rts
248
249/*
250 * r0 = irqflags
251 * r1 = address of atomic data
252 *
253 * Clobbers: r2:0, p1:0
254 */
255_end_lock_coherent:
256
257 p1 = r1;
258 GET_CPUID(p0, r2);
259 r2 += 28;
260 r1 = 1;
261 r1 <<= r2;
262 r2 = [p1];
263 r2 = r1 | r2;
264 [p1] = r2;
265 r1 = p1;
266 jump _put_core_lock;
267
268#endif /* __ARCH_SYNC_CORE_DCACHE */
269
270/*
271 * r0 = &spinlock->lock
272 *
273 * Clobbers: r3:0, p1:0
274 */
275ENTRY(___raw_spin_is_locked_asm)
276 p1 = r0;
277 [--sp] = rets;
278 call _get_core_lock;
279 r3 = [p1];
280 cc = bittst( r3, 0 );
281 r3 = cc;
282 r1 = p1;
283 call _put_core_lock;
284 rets = [sp++];
285 r0 = r3;
286 rts;
287ENDPROC(___raw_spin_is_locked_asm)
288
289/*
290 * r0 = &spinlock->lock
291 *
292 * Clobbers: r3:0, p1:0
293 */
294ENTRY(___raw_spin_lock_asm)
295 p1 = r0;
296 [--sp] = rets;
297.Lretry_spinlock:
298 call _get_core_lock;
299 r1 = p1;
300 r2 = [p1];
301 cc = bittst( r2, 0 );
302 if cc jump .Lbusy_spinlock
303#ifdef __ARCH_SYNC_CORE_DCACHE
304 r3 = p1;
305 bitset ( r2, 0 ); /* Raise the lock bit. */
306 [p1] = r2;
307 call _start_lock_coherent
308#else
309 r2 = 1;
310 [p1] = r2;
311 call _put_core_lock;
312#endif
313 rets = [sp++];
314 rts;
315
316.Lbusy_spinlock:
317 /* We don't touch the atomic area if busy, so that flush
318 will behave like nop in _put_core_lock. */
319 call _put_core_lock;
320 SSYNC(r2);
321 r0 = p1;
322 jump .Lretry_spinlock
323ENDPROC(___raw_spin_lock_asm)
324
325/*
326 * r0 = &spinlock->lock
327 *
328 * Clobbers: r3:0, p1:0
329 */
330ENTRY(___raw_spin_trylock_asm)
331 p1 = r0;
332 [--sp] = rets;
333 call _get_core_lock;
334 r1 = p1;
335 r3 = [p1];
336 cc = bittst( r3, 0 );
337 if cc jump .Lfailed_trylock
338#ifdef __ARCH_SYNC_CORE_DCACHE
339 bitset ( r3, 0 ); /* Raise the lock bit. */
340 [p1] = r3;
341 call _start_lock_coherent
342#else
343 r2 = 1;
344 [p1] = r2;
345 call _put_core_lock;
346#endif
347 r0 = 1;
348 rets = [sp++];
349 rts;
350.Lfailed_trylock:
351 call _put_core_lock;
352 r0 = 0;
353 rets = [sp++];
354 rts;
355ENDPROC(___raw_spin_trylock_asm)
356
357/*
358 * r0 = &spinlock->lock
359 *
360 * Clobbers: r2:0, p1:0
361 */
362ENTRY(___raw_spin_unlock_asm)
363 p1 = r0;
364 [--sp] = rets;
365 call _get_core_lock;
366 r2 = [p1];
367 bitclr ( r2, 0 );
368 [p1] = r2;
369 r1 = p1;
370#ifdef __ARCH_SYNC_CORE_DCACHE
371 call _end_lock_coherent
372#else
373 call _put_core_lock;
374#endif
375 rets = [sp++];
376 rts;
377ENDPROC(___raw_spin_unlock_asm)
378
379/*
380 * r0 = &rwlock->lock
381 *
382 * Clobbers: r2:0, p1:0
383 */
384ENTRY(___raw_read_lock_asm)
385 p1 = r0;
386 [--sp] = rets;
387 call _get_core_lock;
388.Lrdlock_try:
389 r1 = [p1];
390 r1 += -1;
391 [p1] = r1;
392 cc = r1 < 0;
393 if cc jump .Lrdlock_failed
394 r1 = p1;
395#ifdef __ARCH_SYNC_CORE_DCACHE
396 call _start_lock_coherent
397#else
398 call _put_core_lock;
399#endif
400 rets = [sp++];
401 rts;
402
403.Lrdlock_failed:
404 r1 += 1;
405 [p1] = r1;
406.Lrdlock_wait:
407 r1 = p1;
408 call _put_core_lock;
409 SSYNC(r2);
410 r0 = p1;
411 call _get_core_lock;
412 r1 = [p1];
413 cc = r1 < 2;
414 if cc jump .Lrdlock_wait;
415 jump .Lrdlock_try
416ENDPROC(___raw_read_lock_asm)
417
418/*
419 * r0 = &rwlock->lock
420 *
421 * Clobbers: r3:0, p1:0
422 */
423ENTRY(___raw_read_trylock_asm)
424 p1 = r0;
425 [--sp] = rets;
426 call _get_core_lock;
427 r1 = [p1];
428 cc = r1 <= 0;
429 if cc jump .Lfailed_tryrdlock;
430 r1 += -1;
431 [p1] = r1;
432 r1 = p1;
433#ifdef __ARCH_SYNC_CORE_DCACHE
434 call _start_lock_coherent
435#else
436 call _put_core_lock;
437#endif
438 rets = [sp++];
439 r0 = 1;
440 rts;
441.Lfailed_tryrdlock:
442 r1 = p1;
443 call _put_core_lock;
444 rets = [sp++];
445 r0 = 0;
446 rts;
447ENDPROC(___raw_read_trylock_asm)
448
449/*
450 * r0 = &rwlock->lock
451 *
452 * Note: Processing controlled by a reader lock should not have
453 * any side-effect on cache issues with the other core, so we
454 * just release the core lock and exit (no _end_lock_coherent).
455 *
456 * Clobbers: r3:0, p1:0
457 */
458ENTRY(___raw_read_unlock_asm)
459 p1 = r0;
460 [--sp] = rets;
461 call _get_core_lock;
462 r1 = [p1];
463 r1 += 1;
464 [p1] = r1;
465 r1 = p1;
466 call _put_core_lock;
467 rets = [sp++];
468 rts;
469ENDPROC(___raw_read_unlock_asm)
470
471/*
472 * r0 = &rwlock->lock
473 *
474 * Clobbers: r3:0, p1:0
475 */
476ENTRY(___raw_write_lock_asm)
477 p1 = r0;
478 r3.l = lo(RW_LOCK_BIAS);
479 r3.h = hi(RW_LOCK_BIAS);
480 [--sp] = rets;
481 call _get_core_lock;
482.Lwrlock_try:
483 r1 = [p1];
484 r1 = r1 - r3;
485#ifdef __ARCH_SYNC_CORE_DCACHE
486 r2 = r1;
487 r2 <<= 4;
488 r2 >>= 4;
489 cc = r2 == 0;
490#else
491 cc = r1 == 0;
492#endif
493 if !cc jump .Lwrlock_wait
494 [p1] = r1;
495 r1 = p1;
496#ifdef __ARCH_SYNC_CORE_DCACHE
497 call _start_lock_coherent
498#else
499 call _put_core_lock;
500#endif
501 rets = [sp++];
502 rts;
503
504.Lwrlock_wait:
505 r1 = p1;
506 call _put_core_lock;
507 SSYNC(r2);
508 r0 = p1;
509 call _get_core_lock;
510 r1 = [p1];
511#ifdef __ARCH_SYNC_CORE_DCACHE
512 r1 <<= 4;
513 r1 >>= 4;
514#endif
515 cc = r1 == r3;
516 if !cc jump .Lwrlock_wait;
517 jump .Lwrlock_try
518ENDPROC(___raw_write_lock_asm)
519
520/*
521 * r0 = &rwlock->lock
522 *
523 * Clobbers: r3:0, p1:0
524 */
525ENTRY(___raw_write_trylock_asm)
526 p1 = r0;
527 [--sp] = rets;
528 call _get_core_lock;
529 r1 = [p1];
530 r2.l = lo(RW_LOCK_BIAS);
531 r2.h = hi(RW_LOCK_BIAS);
532 cc = r1 == r2;
533 if !cc jump .Lfailed_trywrlock;
534#ifdef __ARCH_SYNC_CORE_DCACHE
535 r1 >>= 28;
536 r1 <<= 28;
537#else
538 r1 = 0;
539#endif
540 [p1] = r1;
541 r1 = p1;
542#ifdef __ARCH_SYNC_CORE_DCACHE
543 call _start_lock_coherent
544#else
545 call _put_core_lock;
546#endif
547 rets = [sp++];
548 r0 = 1;
549 rts;
550
551.Lfailed_trywrlock:
552 r1 = p1;
553 call _put_core_lock;
554 rets = [sp++];
555 r0 = 0;
556 rts;
557ENDPROC(___raw_write_trylock_asm)
558
559/*
560 * r0 = &rwlock->lock
561 *
562 * Clobbers: r3:0, p1:0
563 */
564ENTRY(___raw_write_unlock_asm)
565 p1 = r0;
566 r3.l = lo(RW_LOCK_BIAS);
567 r3.h = hi(RW_LOCK_BIAS);
568 [--sp] = rets;
569 call _get_core_lock;
570 r1 = [p1];
571 r1 = r1 + r3;
572 [p1] = r1;
573 r1 = p1;
574#ifdef __ARCH_SYNC_CORE_DCACHE
575 call _end_lock_coherent
576#else
577 call _put_core_lock;
578#endif
579 rets = [sp++];
580 rts;
581ENDPROC(___raw_write_unlock_asm)
582
583/*
584 * r0 = ptr
585 * r1 = value
586 *
587 * Add a signed value to a 32bit word and return the new value atomically.
588 * Clobbers: r3:0, p1:0
589 */
590ENTRY(___raw_atomic_update_asm)
591 p1 = r0;
592 r3 = r1;
593 [--sp] = rets;
594 call _get_core_lock;
595 r2 = [p1];
596 r3 = r3 + r2;
597 [p1] = r3;
598 r1 = p1;
599 call _put_core_lock;
600 r0 = r3;
601 rets = [sp++];
602 rts;
603ENDPROC(___raw_atomic_update_asm)
604
605/*
606 * r0 = ptr
607 * r1 = mask
608 *
609 * Clear the mask bits from a 32bit word and return the old 32bit value
610 * atomically.
611 * Clobbers: r3:0, p1:0
612 */
613ENTRY(___raw_atomic_clear_asm)
614 p1 = r0;
615 r3 = ~r1;
616 [--sp] = rets;
617 call _get_core_lock;
618 r2 = [p1];
619 r3 = r2 & r3;
620 [p1] = r3;
621 r3 = r2;
622 r1 = p1;
623 call _put_core_lock;
624 r0 = r3;
625 rets = [sp++];
626 rts;
627ENDPROC(___raw_atomic_clear_asm)
628
629/*
630 * r0 = ptr
631 * r1 = mask
632 *
633 * Set the mask bits into a 32bit word and return the old 32bit value
634 * atomically.
635 * Clobbers: r3:0, p1:0
636 */
637ENTRY(___raw_atomic_set_asm)
638 p1 = r0;
639 r3 = r1;
640 [--sp] = rets;
641 call _get_core_lock;
642 r2 = [p1];
643 r3 = r2 | r3;
644 [p1] = r3;
645 r3 = r2;
646 r1 = p1;
647 call _put_core_lock;
648 r0 = r3;
649 rets = [sp++];
650 rts;
651ENDPROC(___raw_atomic_set_asm)
652
653/*
654 * r0 = ptr
655 * r1 = mask
656 *
657 * XOR the mask bits with a 32bit word and return the old 32bit value
658 * atomically.
659 * Clobbers: r3:0, p1:0
660 */
661ENTRY(___raw_atomic_xor_asm)
662 p1 = r0;
663 r3 = r1;
664 [--sp] = rets;
665 call _get_core_lock;
666 r2 = [p1];
667 r3 = r2 ^ r3;
668 [p1] = r3;
669 r3 = r2;
670 r1 = p1;
671 call _put_core_lock;
672 r0 = r3;
673 rets = [sp++];
674 rts;
675ENDPROC(___raw_atomic_xor_asm)
676
677/*
678 * r0 = ptr
679 * r1 = mask
680 *
681 * Perform a logical AND between the mask bits and a 32bit word, and
682 * return the masked value. We need this on this architecture in
683 * order to invalidate the local cache before testing.
684 *
685 * Clobbers: r3:0, p1:0
686 */
687ENTRY(___raw_atomic_test_asm)
688 p1 = r0;
689 r3 = r1;
690 r1 = -L1_CACHE_BYTES;
691 r1 = r0 & r1;
692 p0 = r1;
693 flushinv[p0];
694 SSYNC(r2);
695 r0 = [p1];
696 r0 = r0 & r3;
697 rts;
698ENDPROC(___raw_atomic_test_asm)
699
700/*
701 * r0 = ptr
702 * r1 = value
703 *
704 * Swap *ptr with value and return the old 32bit value atomically.
705 * Clobbers: r3:0, p1:0
706 */
707#define __do_xchg(src, dst) \
708 p1 = r0; \
709 r3 = r1; \
710 [--sp] = rets; \
711 call _get_core_lock; \
712 r2 = src; \
713 dst = r3; \
714 r3 = r2; \
715 r1 = p1; \
716 call _put_core_lock; \
717 r0 = r3; \
718 rets = [sp++]; \
719 rts;
720
721ENTRY(___raw_xchg_1_asm)
722 __do_xchg(b[p1] (z), b[p1])
723ENDPROC(___raw_xchg_1_asm)
724
725ENTRY(___raw_xchg_2_asm)
726 __do_xchg(w[p1] (z), w[p1])
727ENDPROC(___raw_xchg_2_asm)
728
729ENTRY(___raw_xchg_4_asm)
730 __do_xchg([p1], [p1])
731ENDPROC(___raw_xchg_4_asm)
732
733/*
734 * r0 = ptr
735 * r1 = new
736 * r2 = old
737 *
738 * Swap *ptr with new if *ptr == old and return the previous *ptr
739 * value atomically.
740 *
741 * Clobbers: r3:0, p1:0
742 */
743#define __do_cmpxchg(src, dst) \
744 [--sp] = rets; \
745 [--sp] = r4; \
746 p1 = r0; \
747 r3 = r1; \
748 r4 = r2; \
749 call _get_core_lock; \
750 r2 = src; \
751 cc = r2 == r4; \
752 if !cc jump 1f; \
753 dst = r3; \
754 1: r3 = r2; \
755 r1 = p1; \
756 call _put_core_lock; \
757 r0 = r3; \
758 r4 = [sp++]; \
759 rets = [sp++]; \
760 rts;
761
762ENTRY(___raw_cmpxchg_1_asm)
763 __do_cmpxchg(b[p1] (z), b[p1])
764ENDPROC(___raw_cmpxchg_1_asm)
765
766ENTRY(___raw_cmpxchg_2_asm)
767 __do_cmpxchg(w[p1] (z), w[p1])
768ENDPROC(___raw_cmpxchg_2_asm)
769
770ENTRY(___raw_cmpxchg_4_asm)
771 __do_cmpxchg([p1], [p1])
772ENDPROC(___raw_cmpxchg_4_asm)
773
774/*
775 * r0 = ptr
776 * r1 = bitnr
777 *
778 * Set a bit in a 32bit word and return the old 32bit value atomically.
779 * Clobbers: r3:0, p1:0
780 */
781ENTRY(___raw_bit_set_asm)
782 r2 = r1;
783 r1 = 1;
784 r1 <<= r2;
785 jump ___raw_atomic_set_asm
786ENDPROC(___raw_bit_set_asm)
787
788/*
789 * r0 = ptr
790 * r1 = bitnr
791 *
792 * Clear a bit in a 32bit word and return the old 32bit value atomically.
793 * Clobbers: r3:0, p1:0
794 */
795ENTRY(___raw_bit_clear_asm)
796 r2 = r1;
797 r1 = 1;
798 r1 <<= r2;
799 jump ___raw_atomic_clear_asm
800ENDPROC(___raw_bit_clear_asm)
801
802/*
803 * r0 = ptr
804 * r1 = bitnr
805 *
806 * Toggle a bit in a 32bit word and return the old 32bit value atomically.
807 * Clobbers: r3:0, p1:0
808 */
809ENTRY(___raw_bit_toggle_asm)
810 r2 = r1;
811 r1 = 1;
812 r1 <<= r2;
813 jump ___raw_atomic_xor_asm
814ENDPROC(___raw_bit_toggle_asm)
815
816/*
817 * r0 = ptr
818 * r1 = bitnr
819 *
820 * Test-and-set a bit in a 32bit word and return the old bit value atomically.
821 * Clobbers: r3:0, p1:0
822 */
823ENTRY(___raw_bit_test_set_asm)
824 [--sp] = rets;
825 [--sp] = r1;
826 call ___raw_bit_set_asm
827 r1 = [sp++];
828 r2 = 1;
829 r2 <<= r1;
830 r0 = r0 & r2;
831 cc = r0 == 0;
832 if cc jump 1f
833 r0 = 1;
8341:
835 rets = [sp++];
836 rts;
837ENDPROC(___raw_bit_test_set_asm)
838
839/*
840 * r0 = ptr
841 * r1 = bitnr
842 *
843 * Test-and-clear a bit in a 32bit word and return the old bit value atomically.
844 * Clobbers: r3:0, p1:0
845 */
846ENTRY(___raw_bit_test_clear_asm)
847 [--sp] = rets;
848 [--sp] = r1;
849 call ___raw_bit_clear_asm
850 r1 = [sp++];
851 r2 = 1;
852 r2 <<= r1;
853 r0 = r0 & r2;
854 cc = r0 == 0;
855 if cc jump 1f
856 r0 = 1;
8571:
858 rets = [sp++];
859 rts;
860ENDPROC(___raw_bit_test_clear_asm)
861
862/*
863 * r0 = ptr
864 * r1 = bitnr
865 *
866 * Test-and-toggle a bit in a 32bit word,
867 * and return the old bit value atomically.
868 * Clobbers: r3:0, p1:0
869 */
870ENTRY(___raw_bit_test_toggle_asm)
871 [--sp] = rets;
872 [--sp] = r1;
873 call ___raw_bit_toggle_asm
874 r1 = [sp++];
875 r2 = 1;
876 r2 <<= r1;
877 r0 = r0 & r2;
878 cc = r0 == 0;
879 if cc jump 1f
880 r0 = 1;
8811:
882 rets = [sp++];
883 rts;
884ENDPROC(___raw_bit_test_toggle_asm)
885
886/*
887 * r0 = ptr
888 * r1 = bitnr
889 *
890 * Test a bit in a 32bit word and return its value.
891 * We need this on this architecture in order to invalidate
892 * the local cache before testing.
893 *
894 * Clobbers: r3:0, p1:0
895 */
896ENTRY(___raw_bit_test_asm)
897 r2 = r1;
898 r1 = 1;
899 r1 <<= r2;
900 jump ___raw_atomic_test_asm
901ENDPROC(___raw_bit_test_asm)
902
903/*
904 * r0 = ptr
905 *
906 * Fetch and return an uncached 32bit value.
907 *
908 * Clobbers: r2:0, p1:0
909 */
910ENTRY(___raw_uncached_fetch_asm)
911 p1 = r0;
912 r1 = -L1_CACHE_BYTES;
913 r1 = r0 & r1;
914 p0 = r1;
915 flushinv[p0];
916 SSYNC(r2);
917 r0 = [p1];
918 rts;
919ENDPROC(___raw_uncached_fetch_asm)
diff --git a/arch/blackfin/mach-bf561/boards/cm_bf561.c b/arch/blackfin/mach-bf561/boards/cm_bf561.c
index 8f40990eea2f..6880d1ebfe60 100644
--- a/arch/blackfin/mach-bf561/boards/cm_bf561.c
+++ b/arch/blackfin/mach-bf561/boards/cm_bf561.c
@@ -230,6 +230,19 @@ static struct platform_device smc91x_device = {
230}; 230};
231#endif 231#endif
232 232
233static struct resource bfin_gpios_resources = {
234 .start = 0,
235 .end = MAX_BLACKFIN_GPIOS - 1,
236 .flags = IORESOURCE_IRQ,
237};
238
239static struct platform_device bfin_gpios_device = {
240 .name = "simple-gpio",
241 .id = -1,
242 .num_resources = 1,
243 .resource = &bfin_gpios_resources,
244};
245
233#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE) 246#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
234static struct resource isp1362_hcd_resources[] = { 247static struct resource isp1362_hcd_resources[] = {
235 { 248 {
@@ -287,23 +300,33 @@ static struct platform_device bfin_uart_device = {
287#endif 300#endif
288 301
289#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE) 302#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
290static struct resource bfin_sir_resources[] = {
291#ifdef CONFIG_BFIN_SIR0 303#ifdef CONFIG_BFIN_SIR0
304static struct resource bfin_sir0_resources[] = {
292 { 305 {
293 .start = 0xFFC00400, 306 .start = 0xFFC00400,
294 .end = 0xFFC004FF, 307 .end = 0xFFC004FF,
295 .flags = IORESOURCE_MEM, 308 .flags = IORESOURCE_MEM,
296 }, 309 },
297#endif 310 {
311 .start = IRQ_UART0_RX,
312 .end = IRQ_UART0_RX+1,
313 .flags = IORESOURCE_IRQ,
314 },
315 {
316 .start = CH_UART0_RX,
317 .end = CH_UART0_RX+1,
318 .flags = IORESOURCE_DMA,
319 },
298}; 320};
299 321
300static struct platform_device bfin_sir_device = { 322static struct platform_device bfin_sir0_device = {
301 .name = "bfin_sir", 323 .name = "bfin_sir",
302 .id = 0, 324 .id = 0,
303 .num_resources = ARRAY_SIZE(bfin_sir_resources), 325 .num_resources = ARRAY_SIZE(bfin_sir0_resources),
304 .resource = bfin_sir_resources, 326 .resource = bfin_sir0_resources,
305}; 327};
306#endif 328#endif
329#endif
307 330
308#if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE) 331#if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
309#define PATA_INT IRQ_PF46 332#define PATA_INT IRQ_PF46
@@ -382,7 +405,9 @@ static struct platform_device *cm_bf561_devices[] __initdata = {
382#endif 405#endif
383 406
384#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE) 407#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
385 &bfin_sir_device, 408#ifdef CONFIG_BFIN_SIR0
409 &bfin_sir0_device,
410#endif
386#endif 411#endif
387 412
388#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE) 413#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
@@ -400,6 +425,8 @@ static struct platform_device *cm_bf561_devices[] __initdata = {
400#if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE) 425#if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
401 &bfin_pata_device, 426 &bfin_pata_device,
402#endif 427#endif
428
429 &bfin_gpios_device,
403}; 430};
404 431
405static int __init cm_bf561_init(void) 432static int __init cm_bf561_init(void)
diff --git a/arch/blackfin/mach-bf561/boards/ezkit.c b/arch/blackfin/mach-bf561/boards/ezkit.c
index 50b4cdceccfe..0e2178a1aec5 100644
--- a/arch/blackfin/mach-bf561/boards/ezkit.c
+++ b/arch/blackfin/mach-bf561/boards/ezkit.c
@@ -43,53 +43,42 @@
43/* 43/*
44 * Name the Board for the /proc/cpuinfo 44 * Name the Board for the /proc/cpuinfo
45 */ 45 */
46const char bfin_board_name[] = "ADDS-BF561-EZKIT"; 46const char bfin_board_name[] = "ADI BF561-EZKIT";
47
48#define ISP1761_BASE 0x2C0F0000
49#define ISP1761_IRQ IRQ_PF10
50 47
51#if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE) 48#if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
52static struct resource bfin_isp1761_resources[] = { 49#include <linux/usb/isp1760.h>
53 { 50static struct resource bfin_isp1760_resources[] = {
54 .name = "isp1761-regs", 51 [0] = {
55 .start = ISP1761_BASE + 0x00000000, 52 .start = 0x2C0F0000,
56 .end = ISP1761_BASE + 0x000fffff, 53 .end = 0x203C0000 + 0xfffff,
57 .flags = IORESOURCE_MEM, 54 .flags = IORESOURCE_MEM,
58 }, 55 },
59 { 56 [1] = {
60 .start = ISP1761_IRQ, 57 .start = IRQ_PF10,
61 .end = ISP1761_IRQ, 58 .end = IRQ_PF10,
62 .flags = IORESOURCE_IRQ, 59 .flags = IORESOURCE_IRQ,
63 }, 60 },
64}; 61};
65 62
66static struct platform_device bfin_isp1761_device = { 63static struct isp1760_platform_data isp1760_priv = {
67 .name = "isp1761", 64 .is_isp1761 = 0,
68 .id = 0, 65 .port1_disable = 0,
69 .num_resources = ARRAY_SIZE(bfin_isp1761_resources), 66 .bus_width_16 = 1,
70 .resource = bfin_isp1761_resources, 67 .port1_otg = 0,
68 .analog_oc = 0,
69 .dack_polarity_high = 0,
70 .dreq_polarity_high = 0,
71}; 71};
72 72
73static struct platform_device *bfin_isp1761_devices[] = { 73static struct platform_device bfin_isp1760_device = {
74 &bfin_isp1761_device, 74 .name = "isp1760-hcd",
75 .id = 0,
76 .dev = {
77 .platform_data = &isp1760_priv,
78 },
79 .num_resources = ARRAY_SIZE(bfin_isp1760_resources),
80 .resource = bfin_isp1760_resources,
75}; 81};
76
77int __init bfin_isp1761_init(void)
78{
79 unsigned int num_devices = ARRAY_SIZE(bfin_isp1761_devices);
80
81 printk(KERN_INFO "%s(): registering device resources\n", __func__);
82 set_irq_type(ISP1761_IRQ, IRQF_TRIGGER_FALLING);
83
84 return platform_add_devices(bfin_isp1761_devices, num_devices);
85}
86
87void __exit bfin_isp1761_exit(void)
88{
89 platform_device_unregister(&bfin_isp1761_device);
90}
91
92arch_initcall(bfin_isp1761_init);
93#endif 82#endif
94 83
95#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE) 84#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
@@ -221,23 +210,33 @@ static struct platform_device bfin_uart_device = {
221#endif 210#endif
222 211
223#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE) 212#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
224static struct resource bfin_sir_resources[] = {
225#ifdef CONFIG_BFIN_SIR0 213#ifdef CONFIG_BFIN_SIR0
214static struct resource bfin_sir0_resources[] = {
226 { 215 {
227 .start = 0xFFC00400, 216 .start = 0xFFC00400,
228 .end = 0xFFC004FF, 217 .end = 0xFFC004FF,
229 .flags = IORESOURCE_MEM, 218 .flags = IORESOURCE_MEM,
230 }, 219 },
231#endif 220 {
221 .start = IRQ_UART0_RX,
222 .end = IRQ_UART0_RX+1,
223 .flags = IORESOURCE_IRQ,
224 },
225 {
226 .start = CH_UART0_RX,
227 .end = CH_UART0_RX+1,
228 .flags = IORESOURCE_DMA,
229 },
232}; 230};
233 231
234static struct platform_device bfin_sir_device = { 232static struct platform_device bfin_sir0_device = {
235 .name = "bfin_sir", 233 .name = "bfin_sir",
236 .id = 0, 234 .id = 0,
237 .num_resources = ARRAY_SIZE(bfin_sir_resources), 235 .num_resources = ARRAY_SIZE(bfin_sir0_resources),
238 .resource = bfin_sir_resources, 236 .resource = bfin_sir0_resources,
239}; 237};
240#endif 238#endif
239#endif
241 240
242#if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE) 241#if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
243static struct mtd_partition ezkit_partitions[] = { 242static struct mtd_partition ezkit_partitions[] = {
@@ -449,6 +448,10 @@ static struct platform_device *ezkit_devices[] __initdata = {
449 &net2272_bfin_device, 448 &net2272_bfin_device,
450#endif 449#endif
451 450
451#if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
452 &bfin_isp1760_device,
453#endif
454
452#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE) 455#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
453 &bfin_spi0_device, 456 &bfin_spi0_device,
454#endif 457#endif
@@ -458,7 +461,9 @@ static struct platform_device *ezkit_devices[] __initdata = {
458#endif 461#endif
459 462
460#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE) 463#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
461 &bfin_sir_device, 464#ifdef CONFIG_BFIN_SIR0
465 &bfin_sir0_device,
466#endif
462#endif 467#endif
463 468
464#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE) 469#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
diff --git a/arch/blackfin/mach-bf561/boards/generic_board.c b/arch/blackfin/mach-bf561/boards/generic_board.c
index 2faa0072d614..0ba366a0e696 100644
--- a/arch/blackfin/mach-bf561/boards/generic_board.c
+++ b/arch/blackfin/mach-bf561/boards/generic_board.c
@@ -62,10 +62,45 @@ static struct platform_device smc91x_device = {
62}; 62};
63#endif 63#endif
64 64
65#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
66#ifdef CONFIG_BFIN_SIR0
67static struct resource bfin_sir0_resources[] = {
68 {
69 .start = 0xFFC00400,
70 .end = 0xFFC004FF,
71 .flags = IORESOURCE_MEM,
72 },
73 {
74 .start = IRQ_UART0_RX,
75 .end = IRQ_UART0_RX+1,
76 .flags = IORESOURCE_IRQ,
77 },
78 {
79 .start = CH_UART0_RX,
80 .end = CH_UART0_RX+1,
81 .flags = IORESOURCE_DMA,
82 },
83};
84
85static struct platform_device bfin_sir0_device = {
86 .name = "bfin_sir",
87 .id = 0,
88 .num_resources = ARRAY_SIZE(bfin_sir0_resources),
89 .resource = bfin_sir0_resources,
90};
91#endif
92#endif
93
65static struct platform_device *generic_board_devices[] __initdata = { 94static struct platform_device *generic_board_devices[] __initdata = {
66#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE) 95#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
67 &smc91x_device, 96 &smc91x_device,
68#endif 97#endif
98
99#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
100#ifdef CONFIG_BFIN_SIR0
101 &bfin_sir0_device,
102#endif
103#endif
69}; 104};
70 105
71static int __init generic_board_init(void) 106static int __init generic_board_init(void)
diff --git a/arch/blackfin/mach-bf561/boards/tepla.c b/arch/blackfin/mach-bf561/boards/tepla.c
index c9174b39f98d..6f77dbe952f5 100644
--- a/arch/blackfin/mach-bf561/boards/tepla.c
+++ b/arch/blackfin/mach-bf561/boards/tepla.c
@@ -44,8 +44,42 @@ static struct platform_device smc91x_device = {
44 .resource = smc91x_resources, 44 .resource = smc91x_resources,
45}; 45};
46 46
47#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
48#ifdef CONFIG_BFIN_SIR0
49static struct resource bfin_sir0_resources[] = {
50 {
51 .start = 0xFFC00400,
52 .end = 0xFFC004FF,
53 .flags = IORESOURCE_MEM,
54 },
55 {
56 .start = IRQ_UART0_RX,
57 .end = IRQ_UART0_RX+1,
58 .flags = IORESOURCE_IRQ,
59 },
60 {
61 .start = CH_UART0_RX,
62 .end = CH_UART0_RX+1,
63 .flags = IORESOURCE_DMA,
64 },
65};
66
67static struct platform_device bfin_sir0_device = {
68 .name = "bfin_sir",
69 .id = 0,
70 .num_resources = ARRAY_SIZE(bfin_sir0_resources),
71 .resource = bfin_sir0_resources,
72};
73#endif
74#endif
75
47static struct platform_device *tepla_devices[] __initdata = { 76static struct platform_device *tepla_devices[] __initdata = {
48 &smc91x_device, 77 &smc91x_device,
78#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
79#ifdef CONFIG_BFIN_SIR0
80 &bfin_sir0_device,
81#endif
82#endif
49}; 83};
50 84
51static int __init tepla_init(void) 85static int __init tepla_init(void)
diff --git a/arch/blackfin/mach-bf561/dma.c b/arch/blackfin/mach-bf561/dma.c
index 24415eb82698..42b0037afe61 100644
--- a/arch/blackfin/mach-bf561/dma.c
+++ b/arch/blackfin/mach-bf561/dma.c
@@ -31,7 +31,7 @@
31#include <asm/blackfin.h> 31#include <asm/blackfin.h>
32#include <asm/dma.h> 32#include <asm/dma.h>
33 33
34struct dma_register *dma_io_base_addr[MAX_BLACKFIN_DMA_CHANNEL] = { 34struct dma_register *dma_io_base_addr[MAX_DMA_CHANNELS] = {
35 (struct dma_register *) DMA1_0_NEXT_DESC_PTR, 35 (struct dma_register *) DMA1_0_NEXT_DESC_PTR,
36 (struct dma_register *) DMA1_1_NEXT_DESC_PTR, 36 (struct dma_register *) DMA1_1_NEXT_DESC_PTR,
37 (struct dma_register *) DMA1_2_NEXT_DESC_PTR, 37 (struct dma_register *) DMA1_2_NEXT_DESC_PTR,
diff --git a/arch/blackfin/mach-bf561/head.S b/arch/blackfin/mach-bf561/head.S
deleted file mode 100644
index 31a777a9e699..000000000000
--- a/arch/blackfin/mach-bf561/head.S
+++ /dev/null
@@ -1,136 +0,0 @@
1/*
2 * File: arch/blackfin/mach-bf561/head.S
3 * Based on: arch/blackfin/mach-bf533/head.S
4 * Author:
5 *
6 * Created:
7 * Description: BF561 startup file
8 *
9 * Modified:
10 * Copyright 2004-2006 Analog Devices Inc.
11 *
12 * Bugs: Enter bugs at http://blackfin.uclinux.org/
13 *
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 2 of the License, or
17 * (at your option) any later version.
18 *
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
23 *
24 * You should have received a copy of the GNU General Public License
25 * along with this program; if not, see the file COPYING, or write
26 * to the Free Software Foundation, Inc.,
27 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
28 */
29
30#include <linux/linkage.h>
31#include <linux/init.h>
32#include <asm/blackfin.h>
33#ifdef CONFIG_BFIN_KERNEL_CLOCK
34#include <asm/clocks.h>
35#include <mach/mem_init.h>
36#endif
37
38.section .l1.text
39#ifdef CONFIG_BFIN_KERNEL_CLOCK
40ENTRY(_start_dma_code)
41 p0.h = hi(SICA_IWR0);
42 p0.l = lo(SICA_IWR0);
43 r0.l = 0x1;
44 [p0] = r0;
45 SSYNC;
46
47 /*
48 * Set PLL_CTL
49 * - [14:09] = MSEL[5:0] : CLKIN / VCO multiplication factors
50 * - [8] = BYPASS : BYPASS the PLL, run CLKIN into CCLK/SCLK
51 * - [7] = output delay (add 200ps of delay to mem signals)
52 * - [6] = input delay (add 200ps of input delay to mem signals)
53 * - [5] = PDWN : 1=All Clocks off
54 * - [3] = STOPCK : 1=Core Clock off
55 * - [1] = PLL_OFF : 1=Disable Power to PLL
56 * - [0] = DF : 1=Pass CLKIN/2 to PLL / 0=Pass CLKIN to PLL
57 * all other bits set to zero
58 */
59
60 p0.h = hi(PLL_LOCKCNT);
61 p0.l = lo(PLL_LOCKCNT);
62 r0 = 0x300(Z);
63 w[p0] = r0.l;
64 ssync;
65
66 P2.H = hi(EBIU_SDGCTL);
67 P2.L = lo(EBIU_SDGCTL);
68 R0 = [P2];
69 BITSET (R0, 24);
70 [P2] = R0;
71 SSYNC;
72
73 r0 = CONFIG_VCO_MULT & 63; /* Load the VCO multiplier */
74 r0 = r0 << 9; /* Shift it over, */
75 r1 = CLKIN_HALF; /* Do we need to divide CLKIN by 2?*/
76 r0 = r1 | r0;
77 r1 = PLL_BYPASS; /* Bypass the PLL? */
78 r1 = r1 << 8; /* Shift it over */
79 r0 = r1 | r0; /* add them all together */
80#ifdef ANOMALY_05000265
81 BITSET(r0, 15); /* Add 250 mV of hysteresis to SPORT input pins */
82#endif
83
84 p0.h = hi(PLL_CTL);
85 p0.l = lo(PLL_CTL); /* Load the address */
86 cli r2; /* Disable interrupts */
87 ssync;
88 w[p0] = r0.l; /* Set the value */
89 idle; /* Wait for the PLL to stablize */
90 sti r2; /* Enable interrupts */
91
92.Lcheck_again:
93 p0.h = hi(PLL_STAT);
94 p0.l = lo(PLL_STAT);
95 R0 = W[P0](Z);
96 CC = BITTST(R0,5);
97 if ! CC jump .Lcheck_again;
98
99 /* Configure SCLK & CCLK Dividers */
100 r0 = (CONFIG_CCLK_ACT_DIV | CONFIG_SCLK_DIV);
101 p0.h = hi(PLL_DIV);
102 p0.l = lo(PLL_DIV);
103 w[p0] = r0.l;
104 ssync;
105
106 p0.l = lo(EBIU_SDRRC);
107 p0.h = hi(EBIU_SDRRC);
108 r0 = mem_SDRRC;
109 w[p0] = r0.l;
110 ssync;
111
112 P2.H = hi(EBIU_SDGCTL);
113 P2.L = lo(EBIU_SDGCTL);
114 R0 = [P2];
115 BITCLR (R0, 24);
116 p0.h = hi(EBIU_SDSTAT);
117 p0.l = lo(EBIU_SDSTAT);
118 r2.l = w[p0];
119 cc = bittst(r2,3);
120 if !cc jump .Lskip;
121 NOP;
122 BITSET (R0, 23);
123.Lskip:
124 [P2] = R0;
125 SSYNC;
126
127 R0.L = lo(mem_SDGCTL);
128 R0.H = hi(mem_SDGCTL);
129 R1 = [p2];
130 R1 = R1 | R0;
131 [P2] = R1;
132 SSYNC;
133
134 RTS;
135ENDPROC(_start_dma_code)
136#endif /* CONFIG_BFIN_KERNEL_CLOCK */
diff --git a/arch/blackfin/mach-bf561/include/mach/anomaly.h b/arch/blackfin/mach-bf561/include/mach/anomaly.h
index 22990df04ae1..1a9e17562821 100644
--- a/arch/blackfin/mach-bf561/include/mach/anomaly.h
+++ b/arch/blackfin/mach-bf561/include/mach/anomaly.h
@@ -7,7 +7,7 @@
7 */ 7 */
8 8
9/* This file shoule be up to date with: 9/* This file shoule be up to date with:
10 * - Revision P, 02/08/2008; ADSP-BF561 Blackfin Processor Anomaly List 10 * - Revision Q, 11/07/2008; ADSP-BF561 Blackfin Processor Anomaly List
11 */ 11 */
12 12
13#ifndef _MACH_ANOMALY_H_ 13#ifndef _MACH_ANOMALY_H_
@@ -264,6 +264,18 @@
264#define ANOMALY_05000371 (1) 264#define ANOMALY_05000371 (1)
265/* Level-Sensitive External GPIO Wakeups May Cause Indefinite Stall */ 265/* Level-Sensitive External GPIO Wakeups May Cause Indefinite Stall */
266#define ANOMALY_05000403 (1) 266#define ANOMALY_05000403 (1)
267/* TESTSET Instruction Causes Data Corruption with Writeback Data Cache Enabled */
268#define ANOMALY_05000412 (1)
269/* Speculative Fetches Can Cause Undesired External FIFO Operations */
270#define ANOMALY_05000416 (1)
271/* Multichannel SPORT Channel Misalignment Under Specific Configuration */
272#define ANOMALY_05000425 (1)
273/* Speculative Fetches of Indirect-Pointer Instructions Can Cause False Hardware Errors */
274#define ANOMALY_05000426 (1)
275/* Lost/Corrupted L2/L3 Memory Write after Speculative L2 Memory Read by Core B */
276#define ANOMALY_05000428 (__SILICON_REVISION__ > 3)
277/* IFLUSH Instruction at End of Hardware Loop Causes Infinite Stall */
278#define ANOMALY_05000443 (1)
267 279
268/* Anomalies that don't exist on this proc */ 280/* Anomalies that don't exist on this proc */
269#define ANOMALY_05000158 (0) 281#define ANOMALY_05000158 (0)
@@ -272,5 +284,7 @@
272#define ANOMALY_05000311 (0) 284#define ANOMALY_05000311 (0)
273#define ANOMALY_05000353 (1) 285#define ANOMALY_05000353 (1)
274#define ANOMALY_05000386 (1) 286#define ANOMALY_05000386 (1)
287#define ANOMALY_05000432 (0)
288#define ANOMALY_05000435 (0)
275 289
276#endif 290#endif
diff --git a/arch/blackfin/mach-bf561/include/mach/bf561.h b/arch/blackfin/mach-bf561/include/mach/bf561.h
index 18b1b3a223ab..9968362a2ee4 100644
--- a/arch/blackfin/mach-bf561/include/mach/bf561.h
+++ b/arch/blackfin/mach-bf561/include/mach/bf561.h
@@ -215,7 +215,7 @@
215#endif 215#endif
216 216
217#ifndef CPU 217#ifndef CPU
218#error Unknown CPU type - This kernel doesn't seem to be configured properly 218#error "Unknown CPU type - This kernel doesn't seem to be configured properly"
219#endif 219#endif
220 220
221#endif /* __MACH_BF561_H__ */ 221#endif /* __MACH_BF561_H__ */
diff --git a/arch/blackfin/mach-bf561/include/mach/bfin_sir.h b/arch/blackfin/mach-bf561/include/mach/bfin_sir.h
deleted file mode 100644
index 9bb87e9e2e9b..000000000000
--- a/arch/blackfin/mach-bf561/include/mach/bfin_sir.h
+++ /dev/null
@@ -1,125 +0,0 @@
1/*
2 * Blackfin Infra-red Driver
3 *
4 * Copyright 2006-2008 Analog Devices Inc.
5 *
6 * Enter bugs at http://blackfin.uclinux.org/
7 *
8 * Licensed under the GPL-2 or later.
9 *
10 */
11
12#include <linux/serial.h>
13#include <asm/dma.h>
14#include <asm/portmux.h>
15
16#define SIR_UART_GET_CHAR(port) bfin_read16((port)->membase + OFFSET_RBR)
17#define SIR_UART_GET_DLL(port) bfin_read16((port)->membase + OFFSET_DLL)
18#define SIR_UART_GET_IER(port) bfin_read16((port)->membase + OFFSET_IER)
19#define SIR_UART_GET_DLH(port) bfin_read16((port)->membase + OFFSET_DLH)
20#define SIR_UART_GET_IIR(port) bfin_read16((port)->membase + OFFSET_IIR)
21#define SIR_UART_GET_LCR(port) bfin_read16((port)->membase + OFFSET_LCR)
22#define SIR_UART_GET_GCTL(port) bfin_read16((port)->membase + OFFSET_GCTL)
23
24#define SIR_UART_PUT_CHAR(port, v) bfin_write16(((port)->membase + OFFSET_THR), v)
25#define SIR_UART_PUT_DLL(port, v) bfin_write16(((port)->membase + OFFSET_DLL), v)
26#define SIR_UART_PUT_IER(port, v) bfin_write16(((port)->membase + OFFSET_IER), v)
27#define SIR_UART_PUT_DLH(port, v) bfin_write16(((port)->membase + OFFSET_DLH), v)
28#define SIR_UART_PUT_LCR(port, v) bfin_write16(((port)->membase + OFFSET_LCR), v)
29#define SIR_UART_PUT_GCTL(port, v) bfin_write16(((port)->membase + OFFSET_GCTL), v)
30
31#ifdef CONFIG_SIR_BFIN_DMA
32struct dma_rx_buf {
33 char *buf;
34 int head;
35 int tail;
36 };
37#endif /* CONFIG_SIR_BFIN_DMA */
38
39struct bfin_sir_port {
40 unsigned char __iomem *membase;
41 unsigned int irq;
42 unsigned int lsr;
43 unsigned long clk;
44 struct net_device *dev;
45#ifdef CONFIG_SIR_BFIN_DMA
46 int tx_done;
47 struct dma_rx_buf rx_dma_buf;
48 struct timer_list rx_dma_timer;
49 int rx_dma_nrows;
50#endif /* CONFIG_SIR_BFIN_DMA */
51 unsigned int tx_dma_channel;
52 unsigned int rx_dma_channel;
53};
54
55struct bfin_sir_port sir_ports[BFIN_UART_NR_PORTS];
56
57struct bfin_sir_port_res {
58 unsigned long base_addr;
59 int irq;
60 unsigned int rx_dma_channel;
61 unsigned int tx_dma_channel;
62};
63
64struct bfin_sir_port_res bfin_sir_port_resource[] = {
65#ifdef CONFIG_BFIN_SIR0
66 {
67 0xFFC00400,
68 IRQ_UART_RX,
69 CH_UART_RX,
70 CH_UART_TX,
71 },
72#endif
73};
74
75int nr_sirs = ARRAY_SIZE(bfin_sir_port_resource);
76
77struct bfin_sir_self {
78 struct bfin_sir_port *sir_port;
79 spinlock_t lock;
80 unsigned int open;
81 int speed;
82 int newspeed;
83
84 struct sk_buff *txskb;
85 struct sk_buff *rxskb;
86 struct net_device_stats stats;
87 struct device *dev;
88 struct irlap_cb *irlap;
89 struct qos_info qos;
90
91 iobuff_t tx_buff;
92 iobuff_t rx_buff;
93
94 struct work_struct work;
95 int mtt;
96};
97
98static inline unsigned int SIR_UART_GET_LSR(struct bfin_sir_port *port)
99{
100 unsigned int lsr = bfin_read16(port->membase + OFFSET_LSR);
101 port->lsr |= (lsr & (BI|FE|PE|OE));
102 return lsr | port->lsr;
103}
104
105static inline void SIR_UART_CLEAR_LSR(struct bfin_sir_port *port)
106{
107 port->lsr = 0;
108 bfin_read16(port->membase + OFFSET_LSR);
109}
110
111#define DRIVER_NAME "bfin_sir"
112
113static int bfin_sir_hw_init(void)
114{
115 int ret = -ENODEV;
116#ifdef CONFIG_BFIN_SIR0
117 ret = peripheral_request(P_UART0_TX, DRIVER_NAME);
118 if (ret)
119 return ret;
120 ret = peripheral_request(P_UART0_RX, DRIVER_NAME);
121 if (ret)
122 return ret;
123#endif
124 return ret;
125}
diff --git a/arch/blackfin/mach-bf561/include/mach/blackfin.h b/arch/blackfin/mach-bf561/include/mach/blackfin.h
index 0ea8666e6764..f79f6626b7ec 100644
--- a/arch/blackfin/mach-bf561/include/mach/blackfin.h
+++ b/arch/blackfin/mach-bf561/include/mach/blackfin.h
@@ -66,8 +66,12 @@
66 66
67#define bfin_read_SIC_IMASK(x) bfin_read32(SICA_IMASK0 + (x << 2)) 67#define bfin_read_SIC_IMASK(x) bfin_read32(SICA_IMASK0 + (x << 2))
68#define bfin_write_SIC_IMASK(x, val) bfin_write32((SICA_IMASK0 + (x << 2)), val) 68#define bfin_write_SIC_IMASK(x, val) bfin_write32((SICA_IMASK0 + (x << 2)), val)
69#define bfin_read_SICB_IMASK(x) bfin_read32(SICB_IMASK0 + (x << 2))
70#define bfin_write_SICB_IMASK(x, val) bfin_write32((SICB_IMASK0 + (x << 2)), val)
69#define bfin_read_SIC_ISR(x) bfin_read32(SICA_ISR0 + (x << 2)) 71#define bfin_read_SIC_ISR(x) bfin_read32(SICA_ISR0 + (x << 2))
70#define bfin_write_SIC_ISR(x, val) bfin_write32((SICA_ISR0 + (x << 2)), val) 72#define bfin_write_SIC_ISR(x, val) bfin_write32((SICA_ISR0 + (x << 2)), val)
73#define bfin_read_SICB_ISR(x) bfin_read32(SICB_ISR0 + (x << 2))
74#define bfin_write_SICB_ISR(x, val) bfin_write32((SICB_ISR0 + (x << 2)), val)
71 75
72#define BFIN_UART_NR_PORTS 1 76#define BFIN_UART_NR_PORTS 1
73 77
diff --git a/arch/blackfin/mach-bf561/include/mach/cdefBF561.h b/arch/blackfin/mach-bf561/include/mach/cdefBF561.h
index c14d63402e70..95d609f11c97 100644
--- a/arch/blackfin/mach-bf561/include/mach/cdefBF561.h
+++ b/arch/blackfin/mach-bf561/include/mach/cdefBF561.h
@@ -39,65 +39,15 @@
39/*include core specific register pointer definitions*/ 39/*include core specific register pointer definitions*/
40#include <asm/cdef_LPBlackfin.h> 40#include <asm/cdef_LPBlackfin.h>
41 41
42#include <asm/system.h>
43
44/*********************************************************************************** */ 42/*********************************************************************************** */
45/* System MMR Register Map */ 43/* System MMR Register Map */
46/*********************************************************************************** */ 44/*********************************************************************************** */
47 45
48/* Clock and System Control (0xFFC00000 - 0xFFC000FF) */ 46/* Clock and System Control (0xFFC00000 - 0xFFC000FF) */
49#define bfin_read_PLL_CTL() bfin_read16(PLL_CTL) 47#define bfin_read_PLL_CTL() bfin_read16(PLL_CTL)
50/* Writing to PLL_CTL initiates a PLL relock sequence. */
51static __inline__ void bfin_write_PLL_CTL(unsigned int val)
52{
53 unsigned long flags, iwr0, iwr1;
54
55 if (val == bfin_read_PLL_CTL())
56 return;
57
58 local_irq_save(flags);
59 /* Enable the PLL Wakeup bit in SIC IWR */
60 iwr0 = bfin_read32(SICA_IWR0);
61 iwr1 = bfin_read32(SICA_IWR1);
62 /* Only allow PPL Wakeup) */
63 bfin_write32(SICA_IWR0, IWR_ENABLE(0));
64 bfin_write32(SICA_IWR1, 0);
65
66 bfin_write16(PLL_CTL, val);
67 SSYNC();
68 asm("IDLE;");
69
70 bfin_write32(SICA_IWR0, iwr0);
71 bfin_write32(SICA_IWR1, iwr1);
72 local_irq_restore(flags);
73}
74#define bfin_read_PLL_DIV() bfin_read16(PLL_DIV) 48#define bfin_read_PLL_DIV() bfin_read16(PLL_DIV)
75#define bfin_write_PLL_DIV(val) bfin_write16(PLL_DIV,val) 49#define bfin_write_PLL_DIV(val) bfin_write16(PLL_DIV,val)
76#define bfin_read_VR_CTL() bfin_read16(VR_CTL) 50#define bfin_read_VR_CTL() bfin_read16(VR_CTL)
77/* Writing to VR_CTL initiates a PLL relock sequence. */
78static __inline__ void bfin_write_VR_CTL(unsigned int val)
79{
80 unsigned long flags, iwr0, iwr1;
81
82 if (val == bfin_read_VR_CTL())
83 return;
84
85 local_irq_save(flags);
86 /* Enable the PLL Wakeup bit in SIC IWR */
87 iwr0 = bfin_read32(SICA_IWR0);
88 iwr1 = bfin_read32(SICA_IWR1);
89 /* Only allow PPL Wakeup) */
90 bfin_write32(SICA_IWR0, IWR_ENABLE(0));
91 bfin_write32(SICA_IWR1, 0);
92
93 bfin_write16(VR_CTL, val);
94 SSYNC();
95 asm("IDLE;");
96
97 bfin_write32(SICA_IWR0, iwr0);
98 bfin_write32(SICA_IWR1, iwr1);
99 local_irq_restore(flags);
100}
101#define bfin_read_PLL_STAT() bfin_read16(PLL_STAT) 51#define bfin_read_PLL_STAT() bfin_read16(PLL_STAT)
102#define bfin_write_PLL_STAT(val) bfin_write16(PLL_STAT,val) 52#define bfin_write_PLL_STAT(val) bfin_write16(PLL_STAT,val)
103#define bfin_read_PLL_LOCKCNT() bfin_read16(PLL_LOCKCNT) 53#define bfin_read_PLL_LOCKCNT() bfin_read16(PLL_LOCKCNT)
@@ -1576,4 +1526,57 @@ static __inline__ void bfin_write_VR_CTL(unsigned int val)
1576#define bfin_read_MDMA_D0_START_ADDR() bfin_read_MDMA1_D0_START_ADDR() 1526#define bfin_read_MDMA_D0_START_ADDR() bfin_read_MDMA1_D0_START_ADDR()
1577#define bfin_write_MDMA_D0_START_ADDR(val) bfin_write_MDMA1_D0_START_ADDR(val) 1527#define bfin_write_MDMA_D0_START_ADDR(val) bfin_write_MDMA1_D0_START_ADDR(val)
1578 1528
1529/* These need to be last due to the cdef/linux inter-dependencies */
1530#include <asm/irq.h>
1531
1532/* Writing to PLL_CTL initiates a PLL relock sequence. */
1533static __inline__ void bfin_write_PLL_CTL(unsigned int val)
1534{
1535 unsigned long flags, iwr0, iwr1;
1536
1537 if (val == bfin_read_PLL_CTL())
1538 return;
1539
1540 local_irq_save_hw(flags);
1541 /* Enable the PLL Wakeup bit in SIC IWR */
1542 iwr0 = bfin_read32(SICA_IWR0);
1543 iwr1 = bfin_read32(SICA_IWR1);
1544 /* Only allow PPL Wakeup) */
1545 bfin_write32(SICA_IWR0, IWR_ENABLE(0));
1546 bfin_write32(SICA_IWR1, 0);
1547
1548 bfin_write16(PLL_CTL, val);
1549 SSYNC();
1550 asm("IDLE;");
1551
1552 bfin_write32(SICA_IWR0, iwr0);
1553 bfin_write32(SICA_IWR1, iwr1);
1554 local_irq_restore_hw(flags);
1555}
1556
1557/* Writing to VR_CTL initiates a PLL relock sequence. */
1558static __inline__ void bfin_write_VR_CTL(unsigned int val)
1559{
1560 unsigned long flags, iwr0, iwr1;
1561
1562 if (val == bfin_read_VR_CTL())
1563 return;
1564
1565 local_irq_save_hw(flags);
1566 /* Enable the PLL Wakeup bit in SIC IWR */
1567 iwr0 = bfin_read32(SICA_IWR0);
1568 iwr1 = bfin_read32(SICA_IWR1);
1569 /* Only allow PPL Wakeup) */
1570 bfin_write32(SICA_IWR0, IWR_ENABLE(0));
1571 bfin_write32(SICA_IWR1, 0);
1572
1573 bfin_write16(VR_CTL, val);
1574 SSYNC();
1575 asm("IDLE;");
1576
1577 bfin_write32(SICA_IWR0, iwr0);
1578 bfin_write32(SICA_IWR1, iwr1);
1579 local_irq_restore_hw(flags);
1580}
1581
1579#endif /* _CDEF_BF561_H */ 1582#endif /* _CDEF_BF561_H */
diff --git a/arch/blackfin/mach-bf561/include/mach/defBF561.h b/arch/blackfin/mach-bf561/include/mach/defBF561.h
index 4eca2026bb92..d7c509759659 100644
--- a/arch/blackfin/mach-bf561/include/mach/defBF561.h
+++ b/arch/blackfin/mach-bf561/include/mach/defBF561.h
@@ -912,6 +912,9 @@
912#define ACTIVE_PLLDISABLED 0x0004 /* Processor In Active Mode With PLL Disabled */ 912#define ACTIVE_PLLDISABLED 0x0004 /* Processor In Active Mode With PLL Disabled */
913#define PLL_LOCKED 0x0020 /* PLL_LOCKCNT Has Been Reached */ 913#define PLL_LOCKED 0x0020 /* PLL_LOCKCNT Has Been Reached */
914 914
915/* SICA_SYSCR Masks */
916#define COREB_SRAM_INIT 0x0020
917
915/* SWRST Mask */ 918/* SWRST Mask */
916#define SYSTEM_RESET 0x0007 /* Initiates a system software reset */ 919#define SYSTEM_RESET 0x0007 /* Initiates a system software reset */
917#define DOUBLE_FAULT_A 0x0008 /* Core A Double Fault Causes Reset */ 920#define DOUBLE_FAULT_A 0x0008 /* Core A Double Fault Causes Reset */
diff --git a/arch/blackfin/mach-bf561/include/mach/dma.h b/arch/blackfin/mach-bf561/include/mach/dma.h
index 8bc46cd89a02..13647c71f1c7 100644
--- a/arch/blackfin/mach-bf561/include/mach/dma.h
+++ b/arch/blackfin/mach-bf561/include/mach/dma.h
@@ -1,13 +1,17 @@
1/***************************************************************************** 1/* mach/dma.h - arch-specific DMA defines
2* 2 *
3* BF-533/2/1 Specific Declarations 3 * Copyright 2004-2008 Analog Devices Inc.
4* 4 *
5****************************************************************************/ 5 * Licensed under the GPL-2 or later.
6 */
6 7
7#ifndef _MACH_DMA_H_ 8#ifndef _MACH_DMA_H_
8#define _MACH_DMA_H_ 9#define _MACH_DMA_H_
9 10
10#define MAX_BLACKFIN_DMA_CHANNEL 36 11#define MAX_DMA_CHANNELS 36
12
13/* [#4267] IMDMA channels have no PERIPHERAL_MAP MMR */
14#define MAX_DMA_SUSPEND_CHANNELS 32
11 15
12#define CH_PPI0 0 16#define CH_PPI0 0
13#define CH_PPI (CH_PPI0) 17#define CH_PPI (CH_PPI0)
diff --git a/arch/blackfin/mach-bf561/include/mach/gpio.h b/arch/blackfin/mach-bf561/include/mach/gpio.h
new file mode 100644
index 000000000000..7882f79e1ade
--- /dev/null
+++ b/arch/blackfin/mach-bf561/include/mach/gpio.h
@@ -0,0 +1,68 @@
1/*
2 * File: arch/blackfin/mach-bf561/include/mach/gpio.h
3 * Bugs: Enter bugs at http://blackfin.uclinux.org/
4 *
5 * Copyright (C) 2008 Analog Devices Inc.
6 * Licensed under the GPL-2 or later.
7 */
8
9
10#ifndef _MACH_GPIO_H_
11#define _MACH_GPIO_H_
12
13#define MAX_BLACKFIN_GPIOS 48
14
15#define GPIO_PF0 0
16#define GPIO_PF1 1
17#define GPIO_PF2 2
18#define GPIO_PF3 3
19#define GPIO_PF4 4
20#define GPIO_PF5 5
21#define GPIO_PF6 6
22#define GPIO_PF7 7
23#define GPIO_PF8 8
24#define GPIO_PF9 9
25#define GPIO_PF10 10
26#define GPIO_PF11 11
27#define GPIO_PF12 12
28#define GPIO_PF13 13
29#define GPIO_PF14 14
30#define GPIO_PF15 15
31#define GPIO_PF16 16
32#define GPIO_PF17 17
33#define GPIO_PF18 18
34#define GPIO_PF19 19
35#define GPIO_PF20 20
36#define GPIO_PF21 21
37#define GPIO_PF22 22
38#define GPIO_PF23 23
39#define GPIO_PF24 24
40#define GPIO_PF25 25
41#define GPIO_PF26 26
42#define GPIO_PF27 27
43#define GPIO_PF28 28
44#define GPIO_PF29 29
45#define GPIO_PF30 30
46#define GPIO_PF31 31
47#define GPIO_PF32 32
48#define GPIO_PF33 33
49#define GPIO_PF34 34
50#define GPIO_PF35 35
51#define GPIO_PF36 36
52#define GPIO_PF37 37
53#define GPIO_PF38 38
54#define GPIO_PF39 39
55#define GPIO_PF40 40
56#define GPIO_PF41 41
57#define GPIO_PF42 42
58#define GPIO_PF43 43
59#define GPIO_PF44 44
60#define GPIO_PF45 45
61#define GPIO_PF46 46
62#define GPIO_PF47 47
63
64#define PORT_FIO0 GPIO_0
65#define PORT_FIO1 GPIO_16
66#define PORT_FIO2 GPIO_32
67
68#endif /* _MACH_GPIO_H_ */
diff --git a/arch/blackfin/mach-bf561/include/mach/mem_init.h b/arch/blackfin/mach-bf561/include/mach/mem_init.h
deleted file mode 100644
index e163260bca18..000000000000
--- a/arch/blackfin/mach-bf561/include/mach/mem_init.h
+++ /dev/null
@@ -1,295 +0,0 @@
1/*
2 * File: include/asm-blackfin/mach-bf561/mem_init.h
3 * Based on:
4 * Author:
5 *
6 * Created:
7 * Description:
8 *
9 * Rev:
10 *
11 * Modified:
12 *
13 * Bugs: Enter bugs at http://blackfin.uclinux.org/
14 *
15 * This program is free software; you can redistribute it and/or modify
16 * it under the terms of the GNU General Public License as published by
17 * the Free Software Foundation; either version 2, or (at your option)
18 * any later version.
19 *
20 * This program is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
24 *
25 * You should have received a copy of the GNU General Public License
26 * along with this program; see the file COPYING.
27 * If not, write to the Free Software Foundation,
28 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
29 */
30
31#if (CONFIG_MEM_MT48LC16M16A2TG_75 || CONFIG_MEM_MT48LC64M4A2FB_7E || CONFIG_MEM_GENERIC_BOARD || CONFIG_MEM_MT48LC8M32B2B5_7)
32#if (CONFIG_SCLK_HZ > 119402985)
33#define SDRAM_tRP TRP_2
34#define SDRAM_tRP_num 2
35#define SDRAM_tRAS TRAS_7
36#define SDRAM_tRAS_num 7
37#define SDRAM_tRCD TRCD_2
38#define SDRAM_tWR TWR_2
39#endif
40#if (CONFIG_SCLK_HZ > 104477612) && (CONFIG_SCLK_HZ <= 119402985)
41#define SDRAM_tRP TRP_2
42#define SDRAM_tRP_num 2
43#define SDRAM_tRAS TRAS_6
44#define SDRAM_tRAS_num 6
45#define SDRAM_tRCD TRCD_2
46#define SDRAM_tWR TWR_2
47#endif
48#if (CONFIG_SCLK_HZ > 89552239) && (CONFIG_SCLK_HZ <= 104477612)
49#define SDRAM_tRP TRP_2
50#define SDRAM_tRP_num 2
51#define SDRAM_tRAS TRAS_5
52#define SDRAM_tRAS_num 5
53#define SDRAM_tRCD TRCD_2
54#define SDRAM_tWR TWR_2
55#endif
56#if (CONFIG_SCLK_HZ > 74626866) && (CONFIG_SCLK_HZ <= 89552239)
57#define SDRAM_tRP TRP_2
58#define SDRAM_tRP_num 2
59#define SDRAM_tRAS TRAS_4
60#define SDRAM_tRAS_num 4
61#define SDRAM_tRCD TRCD_2
62#define SDRAM_tWR TWR_2
63#endif
64#if (CONFIG_SCLK_HZ > 66666667) && (CONFIG_SCLK_HZ <= 74626866)
65#define SDRAM_tRP TRP_2
66#define SDRAM_tRP_num 2
67#define SDRAM_tRAS TRAS_3
68#define SDRAM_tRAS_num 3
69#define SDRAM_tRCD TRCD_2
70#define SDRAM_tWR TWR_2
71#endif
72#if (CONFIG_SCLK_HZ > 59701493) && (CONFIG_SCLK_HZ <= 66666667)
73#define SDRAM_tRP TRP_1
74#define SDRAM_tRP_num 1
75#define SDRAM_tRAS TRAS_4
76#define SDRAM_tRAS_num 3
77#define SDRAM_tRCD TRCD_1
78#define SDRAM_tWR TWR_2
79#endif
80#if (CONFIG_SCLK_HZ > 44776119) && (CONFIG_SCLK_HZ <= 59701493)
81#define SDRAM_tRP TRP_1
82#define SDRAM_tRP_num 1
83#define SDRAM_tRAS TRAS_3
84#define SDRAM_tRAS_num 3
85#define SDRAM_tRCD TRCD_1
86#define SDRAM_tWR TWR_2
87#endif
88#if (CONFIG_SCLK_HZ > 29850746) && (CONFIG_SCLK_HZ <= 44776119)
89#define SDRAM_tRP TRP_1
90#define SDRAM_tRP_num 1
91#define SDRAM_tRAS TRAS_2
92#define SDRAM_tRAS_num 2
93#define SDRAM_tRCD TRCD_1
94#define SDRAM_tWR TWR_2
95#endif
96#if (CONFIG_SCLK_HZ <= 29850746)
97#define SDRAM_tRP TRP_1
98#define SDRAM_tRP_num 1
99#define SDRAM_tRAS TRAS_1
100#define SDRAM_tRAS_num 1
101#define SDRAM_tRCD TRCD_1
102#define SDRAM_tWR TWR_2
103#endif
104#endif
105
106#if (CONFIG_MEM_MT48LC16M16A2TG_75)
107 /*SDRAM INFORMATION: */
108#define SDRAM_Tref 64 /* Refresh period in milliseconds */
109#define SDRAM_NRA 8192 /* Number of row addresses in SDRAM */
110#define SDRAM_CL CL_3
111#endif
112
113#if (CONFIG_MEM_MT48LC64M4A2FB_7E)
114 /*SDRAM INFORMATION: */
115#define SDRAM_Tref 64 /* Refresh period in milliseconds */
116#define SDRAM_NRA 8192 /* Number of row addresses in SDRAM */
117#define SDRAM_CL CL_3
118#endif
119
120#if (CONFIG_MEM_MT48LC8M32B2B5_7)
121 /*SDRAM INFORMATION: */
122#define SDRAM_Tref 64 /* Refresh period in milliseconds */
123#define SDRAM_NRA 4096 /* Number of row addresses in SDRAM */
124#define SDRAM_CL CL_3
125#endif
126
127#if (CONFIG_MEM_GENERIC_BOARD)
128 /*SDRAM INFORMATION: Modify this for your board */
129#define SDRAM_Tref 64 /* Refresh period in milliseconds */
130#define SDRAM_NRA 8192 /* Number of row addresses in SDRAM */
131#define SDRAM_CL CL_3
132#endif
133
134/* Equation from section 17 (p17-46) of BF533 HRM */
135#define mem_SDRRC (((CONFIG_SCLK_HZ / 1000) * SDRAM_Tref) / SDRAM_NRA) - (SDRAM_tRAS_num + SDRAM_tRP_num)
136
137/* Enable SCLK Out */
138#define mem_SDGCTL (SCTLE | SDRAM_CL | SDRAM_tRAS | SDRAM_tRP | SDRAM_tRCD | SDRAM_tWR | PSS)
139
140#if defined CONFIG_CLKIN_HALF
141#define CLKIN_HALF 1
142#else
143#define CLKIN_HALF 0
144#endif
145
146#if defined CONFIG_PLL_BYPASS
147#define PLL_BYPASS 1
148#else
149#define PLL_BYPASS 0
150#endif
151
152/***************************************Currently Not Being Used *********************************/
153#define flash_EBIU_AMBCTL_WAT ((CONFIG_FLASH_SPEED_BWAT * 4) / (4000000000 / CONFIG_SCLK_HZ)) + 1
154#define flash_EBIU_AMBCTL_RAT ((CONFIG_FLASH_SPEED_BRAT * 4) / (4000000000 / CONFIG_SCLK_HZ)) + 1
155#define flash_EBIU_AMBCTL_HT ((CONFIG_FLASH_SPEED_BHT * 4) / (4000000000 / CONFIG_SCLK_HZ))
156#define flash_EBIU_AMBCTL_ST ((CONFIG_FLASH_SPEED_BST * 4) / (4000000000 / CONFIG_SCLK_HZ)) + 1
157#define flash_EBIU_AMBCTL_TT ((CONFIG_FLASH_SPEED_BTT * 4) / (4000000000 / CONFIG_SCLK_HZ)) + 1
158
159#if (flash_EBIU_AMBCTL_TT > 3)
160#define flash_EBIU_AMBCTL0_TT B0TT_4
161#endif
162#if (flash_EBIU_AMBCTL_TT == 3)
163#define flash_EBIU_AMBCTL0_TT B0TT_3
164#endif
165#if (flash_EBIU_AMBCTL_TT == 2)
166#define flash_EBIU_AMBCTL0_TT B0TT_2
167#endif
168#if (flash_EBIU_AMBCTL_TT < 2)
169#define flash_EBIU_AMBCTL0_TT B0TT_1
170#endif
171
172#if (flash_EBIU_AMBCTL_ST > 3)
173#define flash_EBIU_AMBCTL0_ST B0ST_4
174#endif
175#if (flash_EBIU_AMBCTL_ST == 3)
176#define flash_EBIU_AMBCTL0_ST B0ST_3
177#endif
178#if (flash_EBIU_AMBCTL_ST == 2)
179#define flash_EBIU_AMBCTL0_ST B0ST_2
180#endif
181#if (flash_EBIU_AMBCTL_ST < 2)
182#define flash_EBIU_AMBCTL0_ST B0ST_1
183#endif
184
185#if (flash_EBIU_AMBCTL_HT > 2)
186#define flash_EBIU_AMBCTL0_HT B0HT_3
187#endif
188#if (flash_EBIU_AMBCTL_HT == 2)
189#define flash_EBIU_AMBCTL0_HT B0HT_2
190#endif
191#if (flash_EBIU_AMBCTL_HT == 1)
192#define flash_EBIU_AMBCTL0_HT B0HT_1
193#endif
194#if (flash_EBIU_AMBCTL_HT == 0 && CONFIG_FLASH_SPEED_BHT == 0)
195#define flash_EBIU_AMBCTL0_HT B0HT_0
196#endif
197#if (flash_EBIU_AMBCTL_HT == 0 && CONFIG_FLASH_SPEED_BHT != 0)
198#define flash_EBIU_AMBCTL0_HT B0HT_1
199#endif
200
201#if (flash_EBIU_AMBCTL_WAT > 14)
202#define flash_EBIU_AMBCTL0_WAT B0WAT_15
203#endif
204#if (flash_EBIU_AMBCTL_WAT == 14)
205#define flash_EBIU_AMBCTL0_WAT B0WAT_14
206#endif
207#if (flash_EBIU_AMBCTL_WAT == 13)
208#define flash_EBIU_AMBCTL0_WAT B0WAT_13
209#endif
210#if (flash_EBIU_AMBCTL_WAT == 12)
211#define flash_EBIU_AMBCTL0_WAT B0WAT_12
212#endif
213#if (flash_EBIU_AMBCTL_WAT == 11)
214#define flash_EBIU_AMBCTL0_WAT B0WAT_11
215#endif
216#if (flash_EBIU_AMBCTL_WAT == 10)
217#define flash_EBIU_AMBCTL0_WAT B0WAT_10
218#endif
219#if (flash_EBIU_AMBCTL_WAT == 9)
220#define flash_EBIU_AMBCTL0_WAT B0WAT_9
221#endif
222#if (flash_EBIU_AMBCTL_WAT == 8)
223#define flash_EBIU_AMBCTL0_WAT B0WAT_8
224#endif
225#if (flash_EBIU_AMBCTL_WAT == 7)
226#define flash_EBIU_AMBCTL0_WAT B0WAT_7
227#endif
228#if (flash_EBIU_AMBCTL_WAT == 6)
229#define flash_EBIU_AMBCTL0_WAT B0WAT_6
230#endif
231#if (flash_EBIU_AMBCTL_WAT == 5)
232#define flash_EBIU_AMBCTL0_WAT B0WAT_5
233#endif
234#if (flash_EBIU_AMBCTL_WAT == 4)
235#define flash_EBIU_AMBCTL0_WAT B0WAT_4
236#endif
237#if (flash_EBIU_AMBCTL_WAT == 3)
238#define flash_EBIU_AMBCTL0_WAT B0WAT_3
239#endif
240#if (flash_EBIU_AMBCTL_WAT == 2)
241#define flash_EBIU_AMBCTL0_WAT B0WAT_2
242#endif
243#if (flash_EBIU_AMBCTL_WAT == 1)
244#define flash_EBIU_AMBCTL0_WAT B0WAT_1
245#endif
246
247#if (flash_EBIU_AMBCTL_RAT > 14)
248#define flash_EBIU_AMBCTL0_RAT B0RAT_15
249#endif
250#if (flash_EBIU_AMBCTL_RAT == 14)
251#define flash_EBIU_AMBCTL0_RAT B0RAT_14
252#endif
253#if (flash_EBIU_AMBCTL_RAT == 13)
254#define flash_EBIU_AMBCTL0_RAT B0RAT_13
255#endif
256#if (flash_EBIU_AMBCTL_RAT == 12)
257#define flash_EBIU_AMBCTL0_RAT B0RAT_12
258#endif
259#if (flash_EBIU_AMBCTL_RAT == 11)
260#define flash_EBIU_AMBCTL0_RAT B0RAT_11
261#endif
262#if (flash_EBIU_AMBCTL_RAT == 10)
263#define flash_EBIU_AMBCTL0_RAT B0RAT_10
264#endif
265#if (flash_EBIU_AMBCTL_RAT == 9)
266#define flash_EBIU_AMBCTL0_RAT B0RAT_9
267#endif
268#if (flash_EBIU_AMBCTL_RAT == 8)
269#define flash_EBIU_AMBCTL0_RAT B0RAT_8
270#endif
271#if (flash_EBIU_AMBCTL_RAT == 7)
272#define flash_EBIU_AMBCTL0_RAT B0RAT_7
273#endif
274#if (flash_EBIU_AMBCTL_RAT == 6)
275#define flash_EBIU_AMBCTL0_RAT B0RAT_6
276#endif
277#if (flash_EBIU_AMBCTL_RAT == 5)
278#define flash_EBIU_AMBCTL0_RAT B0RAT_5
279#endif
280#if (flash_EBIU_AMBCTL_RAT == 4)
281#define flash_EBIU_AMBCTL0_RAT B0RAT_4
282#endif
283#if (flash_EBIU_AMBCTL_RAT == 3)
284#define flash_EBIU_AMBCTL0_RAT B0RAT_3
285#endif
286#if (flash_EBIU_AMBCTL_RAT == 2)
287#define flash_EBIU_AMBCTL0_RAT B0RAT_2
288#endif
289#if (flash_EBIU_AMBCTL_RAT == 1)
290#define flash_EBIU_AMBCTL0_RAT B0RAT_1
291#endif
292
293#define flash_EBIU_AMBCTL0 \
294 (flash_EBIU_AMBCTL0_WAT | flash_EBIU_AMBCTL0_RAT | flash_EBIU_AMBCTL0_HT | \
295 flash_EBIU_AMBCTL0_ST | flash_EBIU_AMBCTL0_TT | CONFIG_FLASH_SPEED_RDYEN)
diff --git a/arch/blackfin/mach-bf561/include/mach/mem_map.h b/arch/blackfin/mach-bf561/include/mach/mem_map.h
index f1d4c0637bd2..419dffdc96eb 100644
--- a/arch/blackfin/mach-bf561/include/mach/mem_map.h
+++ b/arch/blackfin/mach-bf561/include/mach/mem_map.h
@@ -85,4 +85,84 @@
85#define L1_SCRATCH_START COREA_L1_SCRATCH_START 85#define L1_SCRATCH_START COREA_L1_SCRATCH_START
86#define L1_SCRATCH_LENGTH 0x1000 86#define L1_SCRATCH_LENGTH 0x1000
87 87
88#ifdef __ASSEMBLY__
89
90/*
91 * The following macros both return the address of the PDA for the
92 * current core.
93 *
94 * In its first safe (and hairy) form, the macro neither clobbers any
95 * register aside of the output Preg, nor uses the stack, since it
96 * could be called with an invalid stack pointer, or the current stack
97 * space being uncovered by any CPLB (e.g. early exception handling).
98 *
99 * The constraints on the second form are a bit relaxed, and the code
100 * is allowed to use the specified Dreg for determining the PDA
101 * address to be returned into Preg.
102 */
103#ifdef CONFIG_SMP
104#define GET_PDA_SAFE(preg) \
105 preg.l = lo(DSPID); \
106 preg.h = hi(DSPID); \
107 preg = [preg]; \
108 preg = preg << 2; \
109 preg = preg << 2; \
110 preg = preg << 2; \
111 preg = preg << 2; \
112 preg = preg << 2; \
113 preg = preg << 2; \
114 preg = preg << 2; \
115 preg = preg << 2; \
116 preg = preg << 2; \
117 preg = preg << 2; \
118 preg = preg << 2; \
119 preg = preg << 2; \
120 if cc jump 2f; \
121 cc = preg == 0x0; \
122 preg.l = _cpu_pda; \
123 preg.h = _cpu_pda; \
124 if !cc jump 3f; \
1251: \
126 /* preg = 0x0; */ \
127 cc = !cc; /* restore cc to 0 */ \
128 jump 4f; \
1292: \
130 cc = preg == 0x0; \
131 preg.l = _cpu_pda; \
132 preg.h = _cpu_pda; \
133 if cc jump 4f; \
134 /* preg = 0x1000000; */ \
135 cc = !cc; /* restore cc to 1 */ \
1363: \
137 preg = [preg]; \
1384:
139
140#define GET_PDA(preg, dreg) \
141 preg.l = lo(DSPID); \
142 preg.h = hi(DSPID); \
143 dreg = [preg]; \
144 preg.l = _cpu_pda; \
145 preg.h = _cpu_pda; \
146 cc = bittst(dreg, 0); \
147 if !cc jump 1f; \
148 preg = [preg]; \
1491: \
150
151#define GET_CPUID(preg, dreg) \
152 preg.l = lo(DSPID); \
153 preg.h = hi(DSPID); \
154 dreg = [preg]; \
155 dreg = ROT dreg BY -1; \
156 dreg = CC;
157
158#else
159#define GET_PDA_SAFE(preg) \
160 preg.l = _cpu_pda; \
161 preg.h = _cpu_pda;
162
163#define GET_PDA(preg, dreg) GET_PDA_SAFE(preg)
164#endif /* CONFIG_SMP */
165
166#endif /* __ASSEMBLY__ */
167
88#endif /* _MEM_MAP_533_H_ */ 168#endif /* _MEM_MAP_533_H_ */
diff --git a/arch/blackfin/mach-bf561/include/mach/smp.h b/arch/blackfin/mach-bf561/include/mach/smp.h
new file mode 100644
index 000000000000..f9e65ebe81b2
--- /dev/null
+++ b/arch/blackfin/mach-bf561/include/mach/smp.h
@@ -0,0 +1,22 @@
1#ifndef _MACH_BF561_SMP
2#define _MACH_BF561_SMP
3
4struct task_struct;
5
6void platform_init_cpus(void);
7
8void platform_prepare_cpus(unsigned int max_cpus);
9
10int platform_boot_secondary(unsigned int cpu, struct task_struct *idle);
11
12void platform_secondary_init(unsigned int cpu);
13
14void platform_request_ipi(int (*handler)(int, void *));
15
16void platform_send_ipi(cpumask_t callmap);
17
18void platform_send_ipi_cpu(unsigned int cpu);
19
20void platform_clear_ipi(unsigned int cpu);
21
22#endif /* !_MACH_BF561_SMP */
diff --git a/arch/blackfin/mach-bf561/secondary.S b/arch/blackfin/mach-bf561/secondary.S
new file mode 100644
index 000000000000..35280f06b7b6
--- /dev/null
+++ b/arch/blackfin/mach-bf561/secondary.S
@@ -0,0 +1,215 @@
1/*
2 * File: arch/blackfin/mach-bf561/secondary.S
3 * Based on: arch/blackfin/mach-bf561/head.S
4 * Author: Philippe Gerum <rpm@xenomai.org>
5 *
6 * Copyright 2007 Analog Devices Inc.
7 *
8 * Description: BF561 coreB bootstrap file
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, see the file COPYING, or write
22 * to the Free Software Foundation, Inc.,
23 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
24 */
25
26#include <linux/linkage.h>
27#include <linux/init.h>
28#include <asm/blackfin.h>
29#include <asm/asm-offsets.h>
30
31__INIT
32
33/* Lay the initial stack into the L1 scratch area of Core B */
34#define INITIAL_STACK (COREB_L1_SCRATCH_START + L1_SCRATCH_LENGTH - 12)
35
36ENTRY(_coreb_trampoline_start)
37 /* Set the SYSCFG register */
38 R0 = 0x36;
39 SYSCFG = R0; /*Enable Cycle Counter and Nesting Of Interrupts(3rd Bit)*/
40 R0 = 0;
41
42 /*Clear Out All the data and pointer Registers*/
43 R1 = R0;
44 R2 = R0;
45 R3 = R0;
46 R4 = R0;
47 R5 = R0;
48 R6 = R0;
49 R7 = R0;
50
51 P0 = R0;
52 P1 = R0;
53 P2 = R0;
54 P3 = R0;
55 P4 = R0;
56 P5 = R0;
57
58 LC0 = r0;
59 LC1 = r0;
60 L0 = r0;
61 L1 = r0;
62 L2 = r0;
63 L3 = r0;
64
65 /* Clear Out All the DAG Registers*/
66 B0 = r0;
67 B1 = r0;
68 B2 = r0;
69 B3 = r0;
70
71 I0 = r0;
72 I1 = r0;
73 I2 = r0;
74 I3 = r0;
75
76 M0 = r0;
77 M1 = r0;
78 M2 = r0;
79 M3 = r0;
80
81 /* Turn off the icache */
82 p0.l = LO(IMEM_CONTROL);
83 p0.h = HI(IMEM_CONTROL);
84 R1 = [p0];
85 R0 = ~ENICPLB;
86 R0 = R0 & R1;
87
88 /* Anomaly 05000125 */
89#ifdef ANOMALY_05000125
90 CLI R2;
91 SSYNC;
92#endif
93 [p0] = R0;
94 SSYNC;
95#ifdef ANOMALY_05000125
96 STI R2;
97#endif
98
99 /* Turn off the dcache */
100 p0.l = LO(DMEM_CONTROL);
101 p0.h = HI(DMEM_CONTROL);
102 R1 = [p0];
103 R0 = ~ENDCPLB;
104 R0 = R0 & R1;
105
106 /* Anomaly 05000125 */
107#ifdef ANOMALY_05000125
108 CLI R2;
109 SSYNC;
110#endif
111 [p0] = R0;
112 SSYNC;
113#ifdef ANOMALY_05000125
114 STI R2;
115#endif
116
117 /* in case of double faults, save a few things */
118 p0.l = _init_retx_coreb;
119 p0.h = _init_retx_coreb;
120 R0 = RETX;
121 [P0] = R0;
122
123#ifdef CONFIG_DEBUG_DOUBLEFAULT
124 /* Only save these if we are storing them,
125 * This happens here, since L1 gets clobbered
126 * below
127 */
128 GET_PDA(p0, r0);
129 r7 = [p0 + PDA_RETX];
130 p1.l = _init_saved_retx_coreb;
131 p1.h = _init_saved_retx_coreb;
132 [p1] = r7;
133
134 r7 = [p0 + PDA_DCPLB];
135 p1.l = _init_saved_dcplb_fault_addr_coreb;
136 p1.h = _init_saved_dcplb_fault_addr_coreb;
137 [p1] = r7;
138
139 r7 = [p0 + PDA_ICPLB];
140 p1.l = _init_saved_icplb_fault_addr_coreb;
141 p1.h = _init_saved_icplb_fault_addr_coreb;
142 [p1] = r7;
143
144 r7 = [p0 + PDA_SEQSTAT];
145 p1.l = _init_saved_seqstat_coreb;
146 p1.h = _init_saved_seqstat_coreb;
147 [p1] = r7;
148#endif
149
150 /* Initialize stack pointer */
151 sp.l = lo(INITIAL_STACK);
152 sp.h = hi(INITIAL_STACK);
153 fp = sp;
154 usp = sp;
155
156 /* This section keeps the processor in supervisor mode
157 * during core B startup. Branches to the idle task.
158 */
159
160 /* EVT15 = _real_start */
161
162 p0.l = lo(EVT15);
163 p0.h = hi(EVT15);
164 p1.l = _coreb_start;
165 p1.h = _coreb_start;
166 [p0] = p1;
167 csync;
168
169 p0.l = lo(IMASK);
170 p0.h = hi(IMASK);
171 p1.l = IMASK_IVG15;
172 p1.h = 0x0;
173 [p0] = p1;
174 csync;
175
176 raise 15;
177 p0.l = .LWAIT_HERE;
178 p0.h = .LWAIT_HERE;
179 reti = p0;
180#if defined(ANOMALY_05000281)
181 nop; nop; nop;
182#endif
183 rti;
184
185.LWAIT_HERE:
186 jump .LWAIT_HERE;
187ENDPROC(_coreb_trampoline_start)
188ENTRY(_coreb_trampoline_end)
189
190ENTRY(_coreb_start)
191 [--sp] = reti;
192
193 p0.l = lo(WDOGB_CTL);
194 p0.h = hi(WDOGB_CTL);
195 r0 = 0xAD6(z);
196 w[p0] = r0; /* Clear the watchdog. */
197 ssync;
198
199 /*
200 * switch to IDLE stack.
201 */
202 p0.l = _secondary_stack;
203 p0.h = _secondary_stack;
204 sp = [p0];
205 usp = sp;
206 fp = sp;
207 sp += -12;
208 call _init_pda
209 sp += 12;
210 call _secondary_start_kernel;
211.L_exit:
212 jump.s .L_exit;
213ENDPROC(_coreb_start)
214
215__FINIT
diff --git a/arch/blackfin/mach-bf561/smp.c b/arch/blackfin/mach-bf561/smp.c
new file mode 100644
index 000000000000..9b27e698c0b2
--- /dev/null
+++ b/arch/blackfin/mach-bf561/smp.c
@@ -0,0 +1,167 @@
1/*
2 * File: arch/blackfin/mach-bf561/smp.c
3 * Author: Philippe Gerum <rpm@xenomai.org>
4 *
5 * Copyright 2007 Analog Devices Inc.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, see the file COPYING, or write
19 * to the Free Software Foundation, Inc.,
20 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21 */
22
23#include <linux/init.h>
24#include <linux/kernel.h>
25#include <linux/sched.h>
26#include <linux/delay.h>
27#include <asm/smp.h>
28#include <asm/dma.h>
29
30static DEFINE_SPINLOCK(boot_lock);
31
32static cpumask_t cpu_callin_map;
33
34/*
35 * platform_init_cpus() - Tell the world about how many cores we
36 * have. This is called while setting up the architecture support
37 * (setup_arch()), so don't be too demanding here with respect to
38 * available kernel services.
39 */
40
41void __init platform_init_cpus(void)
42{
43 cpu_set(0, cpu_possible_map); /* CoreA */
44 cpu_set(1, cpu_possible_map); /* CoreB */
45}
46
47void __init platform_prepare_cpus(unsigned int max_cpus)
48{
49 int len;
50
51 len = &coreb_trampoline_end - &coreb_trampoline_start + 1;
52 BUG_ON(len > L1_CODE_LENGTH);
53
54 dma_memcpy((void *)COREB_L1_CODE_START, &coreb_trampoline_start, len);
55
56 /* Both cores ought to be present on a bf561! */
57 cpu_set(0, cpu_present_map); /* CoreA */
58 cpu_set(1, cpu_present_map); /* CoreB */
59
60 printk(KERN_INFO "CoreB bootstrap code to SRAM %p via DMA.\n", (void *)COREB_L1_CODE_START);
61}
62
63int __init setup_profiling_timer(unsigned int multiplier) /* not supported */
64{
65 return -EINVAL;
66}
67
68void __cpuinit platform_secondary_init(unsigned int cpu)
69{
70 local_irq_disable();
71
72 /* Clone setup for peripheral interrupt sources from CoreA. */
73 bfin_write_SICB_IMASK0(bfin_read_SICA_IMASK0());
74 bfin_write_SICB_IMASK1(bfin_read_SICA_IMASK1());
75 SSYNC();
76
77 /* Clone setup for IARs from CoreA. */
78 bfin_write_SICB_IAR0(bfin_read_SICA_IAR0());
79 bfin_write_SICB_IAR1(bfin_read_SICA_IAR1());
80 bfin_write_SICB_IAR2(bfin_read_SICA_IAR2());
81 bfin_write_SICB_IAR3(bfin_read_SICA_IAR3());
82 bfin_write_SICB_IAR4(bfin_read_SICA_IAR4());
83 bfin_write_SICB_IAR5(bfin_read_SICA_IAR5());
84 bfin_write_SICB_IAR6(bfin_read_SICA_IAR6());
85 bfin_write_SICB_IAR7(bfin_read_SICA_IAR7());
86 SSYNC();
87
88 local_irq_enable();
89
90 /* Calibrate loops per jiffy value. */
91 calibrate_delay();
92
93 /* Store CPU-private information to the cpu_data array. */
94 bfin_setup_cpudata(cpu);
95
96 /* We are done with local CPU inits, unblock the boot CPU. */
97 cpu_set(cpu, cpu_callin_map);
98 spin_lock(&boot_lock);
99 spin_unlock(&boot_lock);
100}
101
102int __cpuinit platform_boot_secondary(unsigned int cpu, struct task_struct *idle)
103{
104 unsigned long timeout;
105
106 /* CoreB already running?! */
107 BUG_ON((bfin_read_SICA_SYSCR() & COREB_SRAM_INIT) == 0);
108
109 printk(KERN_INFO "Booting Core B.\n");
110
111 spin_lock(&boot_lock);
112
113 /* Kick CoreB, which should start execution from CORE_SRAM_BASE. */
114 SSYNC();
115 bfin_write_SICA_SYSCR(bfin_read_SICA_SYSCR() & ~COREB_SRAM_INIT);
116 SSYNC();
117
118 timeout = jiffies + 1 * HZ;
119 while (time_before(jiffies, timeout)) {
120 if (cpu_isset(cpu, cpu_callin_map))
121 break;
122 udelay(100);
123 barrier();
124 }
125
126 spin_unlock(&boot_lock);
127
128 return cpu_isset(cpu, cpu_callin_map) ? 0 : -ENOSYS;
129}
130
131void __init platform_request_ipi(irq_handler_t handler)
132{
133 int ret;
134
135 ret = request_irq(IRQ_SUPPLE_0, handler, IRQF_DISABLED,
136 "SMP interrupt", handler);
137 if (ret)
138 panic("Cannot request supplemental interrupt 0 for IPI service\n");
139}
140
141void platform_send_ipi(cpumask_t callmap)
142{
143 unsigned int cpu;
144
145 for_each_cpu_mask(cpu, callmap) {
146 BUG_ON(cpu >= 2);
147 SSYNC();
148 bfin_write_SICB_SYSCR(bfin_read_SICB_SYSCR() | (1 << (6 + cpu)));
149 SSYNC();
150 }
151}
152
153void platform_send_ipi_cpu(unsigned int cpu)
154{
155 BUG_ON(cpu >= 2);
156 SSYNC();
157 bfin_write_SICB_SYSCR(bfin_read_SICB_SYSCR() | (1 << (6 + cpu)));
158 SSYNC();
159}
160
161void platform_clear_ipi(unsigned int cpu)
162{
163 BUG_ON(cpu >= 2);
164 SSYNC();
165 bfin_write_SICB_SYSCR(bfin_read_SICB_SYSCR() | (1 << (10 + cpu)));
166 SSYNC();
167}
diff --git a/arch/blackfin/mach-common/Makefile b/arch/blackfin/mach-common/Makefile
index e6ed57c56d4b..1f3228ed713f 100644
--- a/arch/blackfin/mach-common/Makefile
+++ b/arch/blackfin/mach-common/Makefile
@@ -3,10 +3,12 @@
3# 3#
4 4
5obj-y := \ 5obj-y := \
6 cache.o entry.o head.o \ 6 cache.o cache-c.o entry.o head.o \
7 interrupt.o irqpanic.o arch_checks.o ints-priority.o 7 interrupt.o irqpanic.o arch_checks.o ints-priority.o
8 8
9obj-$(CONFIG_BFIN_ICACHE_LOCK) += lock.o 9obj-$(CONFIG_BFIN_ICACHE_LOCK) += lock.o
10obj-$(CONFIG_PM) += pm.o dpmc_modes.o 10obj-$(CONFIG_PM) += pm.o dpmc_modes.o
11obj-$(CONFIG_CPU_FREQ) += cpufreq.o 11obj-$(CONFIG_CPU_FREQ) += cpufreq.o
12obj-$(CONFIG_CPU_VOLTAGE) += dpmc.o 12obj-$(CONFIG_CPU_VOLTAGE) += dpmc.o
13obj-$(CONFIG_SMP) += smp.o
14obj-$(CONFIG_BFIN_KERNEL_CLOCK) += clocks-init.o
diff --git a/arch/blackfin/mach-common/cache-c.c b/arch/blackfin/mach-common/cache-c.c
new file mode 100644
index 000000000000..e6ab1f815123
--- /dev/null
+++ b/arch/blackfin/mach-common/cache-c.c
@@ -0,0 +1,24 @@
1/*
2 * Blackfin cache control code (simpler control-style functions)
3 *
4 * Copyright 2004-2008 Analog Devices Inc.
5 *
6 * Enter bugs at http://blackfin.uclinux.org/
7 *
8 * Licensed under the GPL-2 or later.
9 */
10
11#include <asm/blackfin.h>
12
13/* Invalidate the Entire Data cache by
14 * clearing DMC[1:0] bits
15 */
16void blackfin_invalidate_entire_dcache(void)
17{
18 u32 dmem = bfin_read_DMEM_CONTROL();
19 SSYNC();
20 bfin_write_DMEM_CONTROL(dmem & ~0xc);
21 SSYNC();
22 bfin_write_DMEM_CONTROL(dmem);
23 SSYNC();
24}
diff --git a/arch/blackfin/mach-common/cache.S b/arch/blackfin/mach-common/cache.S
index a028e9450419..3c98dacbf289 100644
--- a/arch/blackfin/mach-common/cache.S
+++ b/arch/blackfin/mach-common/cache.S
@@ -49,13 +49,17 @@
49.ifnb \optflushins 49.ifnb \optflushins
50 \optflushins [P0]; 50 \optflushins [P0];
51.endif 51.endif
52#if ANOMALY_05000443
52.ifb \optnopins 53.ifb \optnopins
532: 542:
54.endif 55.endif
55 \flushins [P0++]; 56 \flushins [P0++];
56.ifnb \optnopins 57.ifnb \optnopins
572: \optnopins; 582: \optnopins;
58.endif 59.endif
60#else
612: \flushins [P0++];
62#endif
59 63
60 RTS; 64 RTS;
61.endm 65.endm
diff --git a/arch/blackfin/mach-common/clocks-init.c b/arch/blackfin/mach-common/clocks-init.c
new file mode 100644
index 000000000000..5d182abefc7b
--- /dev/null
+++ b/arch/blackfin/mach-common/clocks-init.c
@@ -0,0 +1,93 @@
1/*
2 * arch/blackfin/mach-common/clocks-init.c - reprogram clocks / memory
3 *
4 * Copyright 2004-2008 Analog Devices Inc.
5 *
6 * Licensed under the GPL-2 or later.
7 */
8
9#include <linux/linkage.h>
10#include <linux/init.h>
11#include <asm/blackfin.h>
12
13#include <asm/dma.h>
14#include <asm/clocks.h>
15#include <asm/mem_init.h>
16
17#define PLL_CTL_VAL \
18 (((CONFIG_VCO_MULT & 63) << 9) | CLKIN_HALF | \
19 (PLL_BYPASS << 8) | (ANOMALY_05000265 ? 0x8000 : 0))
20
21__attribute__((l1_text))
22static void do_sync(void)
23{
24 __builtin_bfin_ssync();
25}
26
27__attribute__((l1_text))
28void init_clocks(void)
29{
30 /* Kill any active DMAs as they may trigger external memory accesses
31 * in the middle of reprogramming things, and that'll screw us up.
32 * For example, any automatic DMAs left by U-Boot for splash screens.
33 */
34 size_t i;
35 for (i = 0; i < MAX_DMA_CHANNELS; ++i) {
36 struct dma_register *dma = dma_io_base_addr[i];
37 dma->cfg = 0;
38 }
39
40 do_sync();
41
42#ifdef SIC_IWR0
43 bfin_write_SIC_IWR0(IWR_ENABLE(0));
44# ifdef SIC_IWR1
45 /* BF52x system reset does not properly reset SIC_IWR1 which
46 * will screw up the bootrom as it relies on MDMA0/1 waking it
47 * up from IDLE instructions. See this report for more info:
48 * http://blackfin.uclinux.org/gf/tracker/4323
49 */
50 if (ANOMALY_05000435)
51 bfin_write_SIC_IWR1(IWR_ENABLE(10) | IWR_ENABLE(11));
52 else
53 bfin_write_SIC_IWR1(IWR_DISABLE_ALL);
54# endif
55# ifdef SIC_IWR2
56 bfin_write_SIC_IWR2(IWR_DISABLE_ALL);
57# endif
58#else
59 bfin_write_SIC_IWR(IWR_ENABLE(0));
60#endif
61 do_sync();
62#ifdef EBIU_SDGCTL
63 bfin_write_EBIU_SDGCTL(bfin_read_EBIU_SDGCTL() | SRFS);
64 do_sync();
65#endif
66
67#ifdef CLKBUFOE
68 bfin_write16(VR_CTL, bfin_read_VR_CTL() | CLKBUFOE);
69 do_sync();
70 __asm__ __volatile__("IDLE;");
71#endif
72 bfin_write_PLL_LOCKCNT(0x300);
73 do_sync();
74 bfin_write16(PLL_CTL, PLL_CTL_VAL);
75 __asm__ __volatile__("IDLE;");
76 bfin_write_PLL_DIV(CONFIG_CCLK_ACT_DIV | CONFIG_SCLK_DIV);
77#ifdef EBIU_SDGCTL
78 bfin_write_EBIU_SDRRC(mem_SDRRC);
79 bfin_write_EBIU_SDGCTL(mem_SDGCTL);
80#else
81 bfin_write_EBIU_RSTCTL(bfin_read_EBIU_RSTCTL() & ~(SRREQ));
82 do_sync();
83 bfin_write_EBIU_RSTCTL(bfin_read_EBIU_RSTCTL() | 0x1);
84 bfin_write_EBIU_DDRCTL0(mem_DDRCTL0);
85 bfin_write_EBIU_DDRCTL1(mem_DDRCTL1);
86 bfin_write_EBIU_DDRCTL2(mem_DDRCTL2);
87#ifdef CONFIG_MEM_EBIU_DDRQUE
88 bfin_write_EBIU_DDRQUE(CONFIG_MEM_EBIU_DDRQUE);
89#endif
90#endif
91 do_sync();
92 bfin_read16(0);
93}
diff --git a/arch/blackfin/mach-common/cpufreq.c b/arch/blackfin/mach-common/cpufreq.c
index dda5443b37ed..72e16605ca09 100644
--- a/arch/blackfin/mach-common/cpufreq.c
+++ b/arch/blackfin/mach-common/cpufreq.c
@@ -104,7 +104,7 @@ static int bfin_target(struct cpufreq_policy *policy,
104 cclk_hz, target_freq, freqs.old); 104 cclk_hz, target_freq, freqs.old);
105 105
106 cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); 106 cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE);
107 local_irq_save(flags); 107 local_irq_save_hw(flags);
108 plldiv = (bfin_read_PLL_DIV() & SSEL) | dpm_state_table[index].csel; 108 plldiv = (bfin_read_PLL_DIV() & SSEL) | dpm_state_table[index].csel;
109 tscale = dpm_state_table[index].tscale; 109 tscale = dpm_state_table[index].tscale;
110 bfin_write_PLL_DIV(plldiv); 110 bfin_write_PLL_DIV(plldiv);
@@ -112,10 +112,10 @@ static int bfin_target(struct cpufreq_policy *policy,
112 bfin_write_TSCALE(tscale); 112 bfin_write_TSCALE(tscale);
113 cycles = get_cycles(); 113 cycles = get_cycles();
114 SSYNC(); 114 SSYNC();
115 cycles += 10; /* ~10 cycles we loose after get_cycles() */ 115 cycles += 10; /* ~10 cycles we lose after get_cycles() */
116 __bfin_cycles_off += (cycles << __bfin_cycles_mod) - (cycles << index); 116 __bfin_cycles_off += (cycles << __bfin_cycles_mod) - (cycles << index);
117 __bfin_cycles_mod = index; 117 __bfin_cycles_mod = index;
118 local_irq_restore(flags); 118 local_irq_restore_hw(flags);
119 /* TODO: just test case for cycles clock source, remove later */ 119 /* TODO: just test case for cycles clock source, remove later */
120 pr_debug("cpufreq: done\n"); 120 pr_debug("cpufreq: done\n");
121 cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); 121 cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE);
diff --git a/arch/blackfin/mach-common/dpmc_modes.S b/arch/blackfin/mach-common/dpmc_modes.S
index ad5431e2cd05..4da50bcd9300 100644
--- a/arch/blackfin/mach-common/dpmc_modes.S
+++ b/arch/blackfin/mach-common/dpmc_modes.S
@@ -247,7 +247,8 @@ ENTRY(_unset_dram_srfs)
247ENDPROC(_unset_dram_srfs) 247ENDPROC(_unset_dram_srfs)
248 248
249ENTRY(_set_sic_iwr) 249ENTRY(_set_sic_iwr)
250#if defined(CONFIG_BF54x) || defined(CONFIG_BF52x) || defined(CONFIG_BF561) 250#if defined(CONFIG_BF54x) || defined(CONFIG_BF52x) || defined(CONFIG_BF561) || \
251 defined(CONFIG_BF538) || defined(CONFIG_BF539) || defined(CONFIG_BF51x)
251 P0.H = hi(SIC_IWR0); 252 P0.H = hi(SIC_IWR0);
252 P0.L = lo(SIC_IWR0); 253 P0.L = lo(SIC_IWR0);
253 P1.H = hi(SIC_IWR1); 254 P1.H = hi(SIC_IWR1);
diff --git a/arch/blackfin/mach-common/entry.S b/arch/blackfin/mach-common/entry.S
index bde6dc4e2614..fae774651374 100644
--- a/arch/blackfin/mach-common/entry.S
+++ b/arch/blackfin/mach-common/entry.S
@@ -36,6 +36,7 @@
36#include <linux/init.h> 36#include <linux/init.h>
37#include <linux/linkage.h> 37#include <linux/linkage.h>
38#include <linux/unistd.h> 38#include <linux/unistd.h>
39#include <linux/threads.h>
39#include <asm/blackfin.h> 40#include <asm/blackfin.h>
40#include <asm/errno.h> 41#include <asm/errno.h>
41#include <asm/fixed_code.h> 42#include <asm/fixed_code.h>
@@ -75,11 +76,11 @@ ENTRY(_ex_workaround_261)
75 * handle it. 76 * handle it.
76 */ 77 */
77 P4 = R7; /* Store EXCAUSE */ 78 P4 = R7; /* Store EXCAUSE */
78 p5.l = _last_cplb_fault_retx; 79
79 p5.h = _last_cplb_fault_retx; 80 GET_PDA(p5, r7);
80 r7 = [p5]; 81 r7 = [p5 + PDA_LFRETX];
81 r6 = retx; 82 r6 = retx;
82 [p5] = r6; 83 [p5 + PDA_LFRETX] = r6;
83 cc = r6 == r7; 84 cc = r6 == r7;
84 if !cc jump _bfin_return_from_exception; 85 if !cc jump _bfin_return_from_exception;
85 /* fall through */ 86 /* fall through */
@@ -111,24 +112,21 @@ ENTRY(_ex_dcplb_viol)
111ENTRY(_ex_dcplb_miss) 112ENTRY(_ex_dcplb_miss)
112ENTRY(_ex_icplb_miss) 113ENTRY(_ex_icplb_miss)
113 (R7:6,P5:4) = [sp++]; 114 (R7:6,P5:4) = [sp++];
114 ASTAT = [sp++]; 115 /* We leave the previously pushed ASTAT on the stack. */
115 SAVE_ALL_SYS 116 SAVE_CONTEXT_CPLB
116#ifdef CONFIG_MPU 117
117 /* We must load R1 here, _before_ DEBUG_HWTRACE_SAVE, since that 118 /* We must load R1 here, _before_ DEBUG_HWTRACE_SAVE, since that
118 * will change the stack pointer. */ 119 * will change the stack pointer. */
119 R0 = SEQSTAT; 120 R0 = SEQSTAT;
120 R1 = SP; 121 R1 = SP;
121#endif 122
122 DEBUG_HWTRACE_SAVE(p5, r7) 123 DEBUG_HWTRACE_SAVE(p5, r7)
123#ifdef CONFIG_MPU 124
124 sp += -12; 125 sp += -12;
125 call _cplb_hdr; 126 call _cplb_hdr;
126 sp += 12; 127 sp += 12;
127 CC = R0 == 0; 128 CC = R0 == 0;
128 IF !CC JUMP _handle_bad_cplb; 129 IF !CC JUMP _handle_bad_cplb;
129#else
130 call __cplb_hdr;
131#endif
132 130
133#ifdef CONFIG_DEBUG_DOUBLEFAULT 131#ifdef CONFIG_DEBUG_DOUBLEFAULT
134 /* While we were processing this, did we double fault? */ 132 /* While we were processing this, did we double fault? */
@@ -142,7 +140,8 @@ ENTRY(_ex_icplb_miss)
142#endif 140#endif
143 141
144 DEBUG_HWTRACE_RESTORE(p5, r7) 142 DEBUG_HWTRACE_RESTORE(p5, r7)
145 RESTORE_ALL_SYS 143 RESTORE_CONTEXT_CPLB
144 ASTAT = [SP++];
146 SP = EX_SCRATCH_REG; 145 SP = EX_SCRATCH_REG;
147 rtx; 146 rtx;
148ENDPROC(_ex_icplb_miss) 147ENDPROC(_ex_icplb_miss)
@@ -297,9 +296,8 @@ ENTRY(_handle_bad_cplb)
297 * the stack to get ready so, we can fall through - we 296 * the stack to get ready so, we can fall through - we
298 * need to make a CPLB exception look like a normal exception 297 * need to make a CPLB exception look like a normal exception
299 */ 298 */
300 299 RESTORE_CONTEXT_CPLB
301 RESTORE_ALL_SYS 300 /* ASTAT is still on the stack, where it is needed. */
302 [--sp] = ASTAT;
303 [--sp] = (R7:6,P5:4); 301 [--sp] = (R7:6,P5:4);
304 302
305ENTRY(_ex_replaceable) 303ENTRY(_ex_replaceable)
@@ -324,7 +322,9 @@ ENTRY(_ex_trap_c)
324 [p4] = p5; 322 [p4] = p5;
325 csync; 323 csync;
326 324
325 GET_PDA(p5, r6);
327#ifndef CONFIG_DEBUG_DOUBLEFAULT 326#ifndef CONFIG_DEBUG_DOUBLEFAULT
327
328 /* 328 /*
329 * Save these registers, as they are only valid in exception context 329 * Save these registers, as they are only valid in exception context
330 * (where we are now - as soon as we defer to IRQ5, they can change) 330 * (where we are now - as soon as we defer to IRQ5, they can change)
@@ -335,29 +335,25 @@ ENTRY(_ex_trap_c)
335 p4.l = lo(DCPLB_FAULT_ADDR); 335 p4.l = lo(DCPLB_FAULT_ADDR);
336 p4.h = hi(DCPLB_FAULT_ADDR); 336 p4.h = hi(DCPLB_FAULT_ADDR);
337 r7 = [p4]; 337 r7 = [p4];
338 p5.h = _saved_dcplb_fault_addr; 338 [p5 + PDA_DCPLB] = r7;
339 p5.l = _saved_dcplb_fault_addr;
340 [p5] = r7;
341 339
342 r7 = [p4 + (ICPLB_FAULT_ADDR - DCPLB_FAULT_ADDR)]; 340 p4.l = lo(ICPLB_FAULT_ADDR);
343 p5.h = _saved_icplb_fault_addr; 341 p4.h = hi(ICPLB_FAULT_ADDR);
344 p5.l = _saved_icplb_fault_addr; 342 r6 = [p4];
345 [p5] = r7; 343 [p5 + PDA_ICPLB] = r6;
346 344
347 r6 = retx; 345 r6 = retx;
348 p4.l = _saved_retx; 346 [p5 + PDA_RETX] = r6;
349 p4.h = _saved_retx;
350 [p4] = r6;
351#endif 347#endif
352 r6 = SYSCFG; 348 r6 = SYSCFG;
353 [p4 + 4] = r6; 349 [p5 + PDA_SYSCFG] = r6;
354 BITCLR(r6, 0); 350 BITCLR(r6, 0);
355 SYSCFG = r6; 351 SYSCFG = r6;
356 352
357 /* Disable all interrupts, but make sure level 5 is enabled so 353 /* Disable all interrupts, but make sure level 5 is enabled so
358 * we can switch to that level. Save the old mask. */ 354 * we can switch to that level. Save the old mask. */
359 cli r6; 355 cli r6;
360 [p4 + 8] = r6; 356 [p5 + PDA_EXIMASK] = r6;
361 357
362 p4.l = lo(SAFE_USER_INSTRUCTION); 358 p4.l = lo(SAFE_USER_INSTRUCTION);
363 p4.h = hi(SAFE_USER_INSTRUCTION); 359 p4.h = hi(SAFE_USER_INSTRUCTION);
@@ -371,9 +367,10 @@ ENTRY(_ex_trap_c)
371ENDPROC(_ex_trap_c) 367ENDPROC(_ex_trap_c)
372 368
373/* We just realized we got an exception, while we were processing a different 369/* We just realized we got an exception, while we were processing a different
374 * exception. This is a unrecoverable event, so crash 370 * exception. This is a unrecoverable event, so crash.
371 * Note: this cannot be ENTRY() as we jump here with "if cc jump" ...
375 */ 372 */
376ENTRY(_double_fault) 373_double_fault:
377 /* Turn caches & protection off, to ensure we don't get any more 374 /* Turn caches & protection off, to ensure we don't get any more
378 * double exceptions 375 * double exceptions
379 */ 376 */
@@ -424,17 +421,16 @@ ENDPROC(_double_fault)
424ENTRY(_exception_to_level5) 421ENTRY(_exception_to_level5)
425 SAVE_ALL_SYS 422 SAVE_ALL_SYS
426 423
427 p4.l = _saved_retx; 424 GET_PDA(p4, r7); /* Fetch current PDA */
428 p4.h = _saved_retx; 425 r6 = [p4 + PDA_RETX];
429 r6 = [p4];
430 [sp + PT_PC] = r6; 426 [sp + PT_PC] = r6;
431 427
432 r6 = [p4 + 4]; 428 r6 = [p4 + PDA_SYSCFG];
433 [sp + PT_SYSCFG] = r6; 429 [sp + PT_SYSCFG] = r6;
434 430
435 /* Restore interrupt mask. We haven't pushed RETI, so this 431 /* Restore interrupt mask. We haven't pushed RETI, so this
436 * doesn't enable interrupts until we return from this handler. */ 432 * doesn't enable interrupts until we return from this handler. */
437 r6 = [p4 + 8]; 433 r6 = [p4 + PDA_EXIMASK];
438 sti r6; 434 sti r6;
439 435
440 /* Restore the hardware error vector. */ 436 /* Restore the hardware error vector. */
@@ -478,8 +474,8 @@ ENTRY(_trap) /* Exception: 4th entry into system event table(supervisor mode)*/
478 * scratch register (for want of a better option). 474 * scratch register (for want of a better option).
479 */ 475 */
480 EX_SCRATCH_REG = sp; 476 EX_SCRATCH_REG = sp;
481 sp.l = _exception_stack_top; 477 GET_PDA_SAFE(sp);
482 sp.h = _exception_stack_top; 478 sp = [sp + PDA_EXSTACK]
483 /* Try to deal with syscalls quickly. */ 479 /* Try to deal with syscalls quickly. */
484 [--sp] = ASTAT; 480 [--sp] = ASTAT;
485 [--sp] = (R7:6,P5:4); 481 [--sp] = (R7:6,P5:4);
@@ -501,27 +497,22 @@ ENTRY(_trap) /* Exception: 4th entry into system event table(supervisor mode)*/
501 * but they are not very interesting, so don't save them 497 * but they are not very interesting, so don't save them
502 */ 498 */
503 499
500 GET_PDA(p5, r7);
504 p4.l = lo(DCPLB_FAULT_ADDR); 501 p4.l = lo(DCPLB_FAULT_ADDR);
505 p4.h = hi(DCPLB_FAULT_ADDR); 502 p4.h = hi(DCPLB_FAULT_ADDR);
506 r7 = [p4]; 503 r7 = [p4];
507 p5.h = _saved_dcplb_fault_addr; 504 [p5 + PDA_DCPLB] = r7;
508 p5.l = _saved_dcplb_fault_addr;
509 [p5] = r7;
510 505
511 r7 = [p4 + (ICPLB_FAULT_ADDR - DCPLB_FAULT_ADDR)]; 506 p4.l = lo(ICPLB_FAULT_ADDR);
512 p5.h = _saved_icplb_fault_addr; 507 p4.h = hi(ICPLB_FAULT_ADDR);
513 p5.l = _saved_icplb_fault_addr; 508 r7 = [p4];
514 [p5] = r7; 509 [p5 + PDA_ICPLB] = r7;
515 510
516 p4.l = _saved_retx;
517 p4.h = _saved_retx;
518 r6 = retx; 511 r6 = retx;
519 [p4] = r6; 512 [p5 + PDA_RETX] = r6;
520 513
521 r7 = SEQSTAT; /* reason code is in bit 5:0 */ 514 r7 = SEQSTAT; /* reason code is in bit 5:0 */
522 p4.l = _saved_seqstat; 515 [p5 + PDA_SEQSTAT] = r7;
523 p4.h = _saved_seqstat;
524 [p4] = r7;
525#else 516#else
526 r7 = SEQSTAT; /* reason code is in bit 5:0 */ 517 r7 = SEQSTAT; /* reason code is in bit 5:0 */
527#endif 518#endif
@@ -546,11 +537,11 @@ ENTRY(_kernel_execve)
546 p0 = sp; 537 p0 = sp;
547 r3 = SIZEOF_PTREGS / 4; 538 r3 = SIZEOF_PTREGS / 4;
548 r4 = 0(x); 539 r4 = 0(x);
5490: 540.Lclear_regs:
550 [p0++] = r4; 541 [p0++] = r4;
551 r3 += -1; 542 r3 += -1;
552 cc = r3 == 0; 543 cc = r3 == 0;
553 if !cc jump 0b (bp); 544 if !cc jump .Lclear_regs (bp);
554 545
555 p0 = sp; 546 p0 = sp;
556 sp += -16; 547 sp += -16;
@@ -558,7 +549,7 @@ ENTRY(_kernel_execve)
558 call _do_execve; 549 call _do_execve;
559 SP += 16; 550 SP += 16;
560 cc = r0 == 0; 551 cc = r0 == 0;
561 if ! cc jump 1f; 552 if ! cc jump .Lexecve_failed;
562 /* Success. Copy our temporary pt_regs to the top of the kernel 553 /* Success. Copy our temporary pt_regs to the top of the kernel
563 * stack and do a normal exception return. 554 * stack and do a normal exception return.
564 */ 555 */
@@ -574,12 +565,12 @@ ENTRY(_kernel_execve)
574 p0 = fp; 565 p0 = fp;
575 r4 = [p0--]; 566 r4 = [p0--];
576 r3 = SIZEOF_PTREGS / 4; 567 r3 = SIZEOF_PTREGS / 4;
5770: 568.Lcopy_regs:
578 r4 = [p0--]; 569 r4 = [p0--];
579 [p1--] = r4; 570 [p1--] = r4;
580 r3 += -1; 571 r3 += -1;
581 cc = r3 == 0; 572 cc = r3 == 0;
582 if ! cc jump 0b (bp); 573 if ! cc jump .Lcopy_regs (bp);
583 574
584 r0 = (KERNEL_STACK_SIZE - SIZEOF_PTREGS) (z); 575 r0 = (KERNEL_STACK_SIZE - SIZEOF_PTREGS) (z);
585 p1 = r0; 576 p1 = r0;
@@ -591,7 +582,7 @@ ENTRY(_kernel_execve)
591 582
592 RESTORE_CONTEXT; 583 RESTORE_CONTEXT;
593 rti; 584 rti;
5941: 585.Lexecve_failed:
595 unlink; 586 unlink;
596 rts; 587 rts;
597ENDPROC(_kernel_execve) 588ENDPROC(_kernel_execve)
@@ -925,9 +916,14 @@ _schedule_and_signal_from_int:
925 p1 = rets; 916 p1 = rets;
926 [sp + PT_RESERVED] = p1; 917 [sp + PT_RESERVED] = p1;
927 918
928 p0.l = _irq_flags; 919#ifdef CONFIG_SMP
929 p0.h = _irq_flags; 920 GET_PDA(p0, r0); /* Fetch current PDA (can't migrate to other CPU here) */
921 r0 = [p0 + PDA_IRQFLAGS];
922#else
923 p0.l = _bfin_irq_flags;
924 p0.h = _bfin_irq_flags;
930 r0 = [p0]; 925 r0 = [p0];
926#endif
931 sti r0; 927 sti r0;
932 928
933 r0 = sp; 929 r0 = sp;
@@ -1539,14 +1535,18 @@ ENTRY(_sys_call_table)
1539 .endr 1535 .endr
1540END(_sys_call_table) 1536END(_sys_call_table)
1541 1537
1542_exception_stack: 1538#ifdef CONFIG_EXCEPTION_L1_SCRATCH
1543 .rept 1024 1539/* .section .l1.bss.scratch */
1544 .long 0; 1540.set _exception_stack_top, L1_SCRATCH_START + L1_SCRATCH_LENGTH
1541#else
1542#ifdef CONFIG_SYSCALL_TAB_L1
1543.section .l1.bss
1544#else
1545.bss
1546#endif
1547ENTRY(_exception_stack)
1548 .rept 1024 * NR_CPUS
1549 .long 0
1545 .endr 1550 .endr
1546_exception_stack_top: 1551_exception_stack_top:
1547
1548#if ANOMALY_05000261
1549/* Used by the assembly entry point to work around an anomaly. */
1550_last_cplb_fault_retx:
1551 .long 0;
1552#endif 1552#endif
diff --git a/arch/blackfin/mach-common/head.S b/arch/blackfin/mach-common/head.S
index f123a62e2451..e1e42c029e15 100644
--- a/arch/blackfin/mach-common/head.S
+++ b/arch/blackfin/mach-common/head.S
@@ -13,6 +13,7 @@
13#include <asm/blackfin.h> 13#include <asm/blackfin.h>
14#include <asm/thread_info.h> 14#include <asm/thread_info.h>
15#include <asm/trace.h> 15#include <asm/trace.h>
16#include <asm/asm-offsets.h>
16 17
17__INIT 18__INIT
18 19
@@ -111,33 +112,26 @@ ENTRY(__start)
111 * This happens here, since L1 gets clobbered 112 * This happens here, since L1 gets clobbered
112 * below 113 * below
113 */ 114 */
114 p0.l = _saved_retx; 115 GET_PDA(p0, r0);
115 p0.h = _saved_retx; 116 r7 = [p0 + PDA_RETX];
116 p1.l = _init_saved_retx; 117 p1.l = _init_saved_retx;
117 p1.h = _init_saved_retx; 118 p1.h = _init_saved_retx;
118 r0 = [p0]; 119 [p1] = r7;
119 [p1] = r0;
120 120
121 p0.l = _saved_dcplb_fault_addr; 121 r7 = [p0 + PDA_DCPLB];
122 p0.h = _saved_dcplb_fault_addr;
123 p1.l = _init_saved_dcplb_fault_addr; 122 p1.l = _init_saved_dcplb_fault_addr;
124 p1.h = _init_saved_dcplb_fault_addr; 123 p1.h = _init_saved_dcplb_fault_addr;
125 r0 = [p0]; 124 [p1] = r7;
126 [p1] = r0;
127 125
128 p0.l = _saved_icplb_fault_addr; 126 r7 = [p0 + PDA_ICPLB];
129 p0.h = _saved_icplb_fault_addr;
130 p1.l = _init_saved_icplb_fault_addr; 127 p1.l = _init_saved_icplb_fault_addr;
131 p1.h = _init_saved_icplb_fault_addr; 128 p1.h = _init_saved_icplb_fault_addr;
132 r0 = [p0]; 129 [p1] = r7;
133 [p1] = r0;
134 130
135 p0.l = _saved_seqstat; 131 r7 = [p0 + PDA_SEQSTAT];
136 p0.h = _saved_seqstat;
137 p1.l = _init_saved_seqstat; 132 p1.l = _init_saved_seqstat;
138 p1.h = _init_saved_seqstat; 133 p1.h = _init_saved_seqstat;
139 r0 = [p0]; 134 [p1] = r7;
140 [p1] = r0;
141#endif 135#endif
142 136
143 /* Initialize stack pointer */ 137 /* Initialize stack pointer */
@@ -153,7 +147,7 @@ ENTRY(__start)
153 /* Put The Code for PLL Programming and SDRAM Programming in L1 ISRAM */ 147 /* Put The Code for PLL Programming and SDRAM Programming in L1 ISRAM */
154 call _bfin_relocate_l1_mem; 148 call _bfin_relocate_l1_mem;
155#ifdef CONFIG_BFIN_KERNEL_CLOCK 149#ifdef CONFIG_BFIN_KERNEL_CLOCK
156 call _start_dma_code; 150 call _init_clocks;
157#endif 151#endif
158 152
159 /* This section keeps the processor in supervisor mode 153 /* This section keeps the processor in supervisor mode
@@ -170,12 +164,8 @@ ENTRY(__start)
170 [p0] = p1; 164 [p0] = p1;
171 csync; 165 csync;
172 166
173 p0.l = lo(IMASK); 167 r0 = EVT_IVG15 (z);
174 p0.h = hi(IMASK); 168 sti r0;
175 p1.l = IMASK_IVG15;
176 p1.h = 0x0;
177 [p0] = p1;
178 csync;
179 169
180 raise 15; 170 raise 15;
181 p0.l = .LWAIT_HERE; 171 p0.l = .LWAIT_HERE;
@@ -195,6 +185,19 @@ ENDPROC(__start)
195# define WDOG_CTL WDOGA_CTL 185# define WDOG_CTL WDOGA_CTL
196#endif 186#endif
197 187
188ENTRY(__init_clear_bss)
189 r2 = r2 - r1;
190 cc = r2 == 0;
191 if cc jump .L_bss_done;
192 r2 >>= 2;
193 p1 = r1;
194 p2 = r2;
195 lsetup (1f, 1f) lc0 = p2;
1961: [p1++] = r0;
197.L_bss_done:
198 rts;
199ENDPROC(__init_clear_bss)
200
198ENTRY(_real_start) 201ENTRY(_real_start)
199 /* Enable nested interrupts */ 202 /* Enable nested interrupts */
200 [--sp] = reti; 203 [--sp] = reti;
@@ -206,87 +209,34 @@ ENTRY(_real_start)
206 w[p0] = r0; 209 w[p0] = r0;
207 ssync; 210 ssync;
208 211
212 r0 = 0 (x);
213 /* Zero out all of the fun bss regions */
209#if L1_DATA_A_LENGTH > 0 214#if L1_DATA_A_LENGTH > 0
210 r1.l = __sbss_l1; 215 r1.l = __sbss_l1;
211 r1.h = __sbss_l1; 216 r1.h = __sbss_l1;
212 r2.l = __ebss_l1; 217 r2.l = __ebss_l1;
213 r2.h = __ebss_l1; 218 r2.h = __ebss_l1;
214 r0 = 0 (z); 219 call __init_clear_bss
215 r2 = r2 - r1;
216 cc = r2 == 0;
217 if cc jump .L_a_l1_done;
218 r2 >>= 2;
219 p1 = r1;
220 p2 = r2;
221 lsetup (.L_clear_a_l1, .L_clear_a_l1 ) lc0 = p2;
222.L_clear_a_l1:
223 [p1++] = r0;
224.L_a_l1_done:
225#endif 220#endif
226
227#if L1_DATA_B_LENGTH > 0 221#if L1_DATA_B_LENGTH > 0
228 r1.l = __sbss_b_l1; 222 r1.l = __sbss_b_l1;
229 r1.h = __sbss_b_l1; 223 r1.h = __sbss_b_l1;
230 r2.l = __ebss_b_l1; 224 r2.l = __ebss_b_l1;
231 r2.h = __ebss_b_l1; 225 r2.h = __ebss_b_l1;
232 r0 = 0 (z); 226 call __init_clear_bss
233 r2 = r2 - r1;
234 cc = r2 == 0;
235 if cc jump .L_b_l1_done;
236 r2 >>= 2;
237 p1 = r1;
238 p2 = r2;
239 lsetup (.L_clear_b_l1, .L_clear_b_l1 ) lc0 = p2;
240.L_clear_b_l1:
241 [p1++] = r0;
242.L_b_l1_done:
243#endif 227#endif
244
245#if L2_LENGTH > 0 228#if L2_LENGTH > 0
246 r1.l = __sbss_l2; 229 r1.l = __sbss_l2;
247 r1.h = __sbss_l2; 230 r1.h = __sbss_l2;
248 r2.l = __ebss_l2; 231 r2.l = __ebss_l2;
249 r2.h = __ebss_l2; 232 r2.h = __ebss_l2;
250 r0 = 0 (z); 233 call __init_clear_bss
251 r2 = r2 - r1;
252 cc = r2 == 0;
253 if cc jump .L_l2_done;
254 r2 >>= 2;
255 p1 = r1;
256 p2 = r2;
257 lsetup (.L_clear_l2, .L_clear_l2 ) lc0 = p2;
258.L_clear_l2:
259 [p1++] = r0;
260.L_l2_done:
261#endif 234#endif
262
263 /* Zero out the bss region
264 * Note: this will fail if bss is 0 bytes ...
265 */
266 r0 = 0 (z);
267 r1.l = ___bss_start; 235 r1.l = ___bss_start;
268 r1.h = ___bss_start; 236 r1.h = ___bss_start;
269 r2.l = ___bss_stop; 237 r2.l = ___bss_stop;
270 r2.h = ___bss_stop; 238 r2.h = ___bss_stop;
271 r2 = r2 - r1; 239 call __init_clear_bss
272 r2 >>= 2;
273 p1 = r1;
274 p2 = r2;
275 lsetup (.L_clear_bss, .L_clear_bss) lc0 = p2;
276.L_clear_bss:
277 [p1++] = r0;
278
279 /* In case there is a NULL pointer reference,
280 * zero out region before stext
281 */
282 p1 = r0;
283 r2.l = __stext;
284 r2.h = __stext;
285 r2 >>= 2;
286 p2 = r2;
287 lsetup (.L_clear_zero, .L_clear_zero) lc0 = p2;
288.L_clear_zero:
289 [p1++] = r0;
290 240
291 /* Pass the u-boot arguments to the global value command line */ 241 /* Pass the u-boot arguments to the global value command line */
292 R0 = R7; 242 R0 = R7;
@@ -299,6 +249,9 @@ ENTRY(_real_start)
299 sp = sp + p1; 249 sp = sp + p1;
300 usp = sp; 250 usp = sp;
301 fp = sp; 251 fp = sp;
252 sp += -12;
253 call _init_pda
254 sp += 12;
302 jump.l _start_kernel; 255 jump.l _start_kernel;
303ENDPROC(_real_start) 256ENDPROC(_real_start)
304 257
diff --git a/arch/blackfin/mach-common/interrupt.S b/arch/blackfin/mach-common/interrupt.S
index 4a2ec7a9675a..473df0f7fa78 100644
--- a/arch/blackfin/mach-common/interrupt.S
+++ b/arch/blackfin/mach-common/interrupt.S
@@ -129,8 +129,15 @@ __common_int_entry:
129#endif 129#endif
130 r1 = sp; 130 r1 = sp;
131 SP += -12; 131 SP += -12;
132#ifdef CONFIG_IPIPE
133 call ___ipipe_grab_irq
134 SP += 12;
135 cc = r0 == 0;
136 if cc jump .Lcommon_restore_context;
137#else /* CONFIG_IPIPE */
132 call _do_irq; 138 call _do_irq;
133 SP += 12; 139 SP += 12;
140#endif /* CONFIG_IPIPE */
134 call _return_from_int; 141 call _return_from_int;
135.Lcommon_restore_context: 142.Lcommon_restore_context:
136 RESTORE_CONTEXT 143 RESTORE_CONTEXT
@@ -152,15 +159,6 @@ ENTRY(_evt_ivhw)
1521: 1591:
153#endif 160#endif
154 161
155#ifdef CONFIG_HARDWARE_PM
156 r7 = [sp + PT_SEQSTAT];
157 r7 = r7 >>> 0xe;
158 r6 = 0x1F;
159 r7 = r7 & r6;
160 r5 = 0x12;
161 cc = r7 == r5;
162 if cc jump .Lcall_do_ovf; /* deal with performance counter overflow */
163#endif
164 # We are going to dump something out, so make sure we print IPEND properly 162 # We are going to dump something out, so make sure we print IPEND properly
165 p2.l = lo(IPEND); 163 p2.l = lo(IPEND);
166 p2.h = hi(IPEND); 164 p2.h = hi(IPEND);
@@ -192,17 +190,6 @@ ENTRY(_evt_ivhw)
192.Lcommon_restore_all_sys: 190.Lcommon_restore_all_sys:
193 RESTORE_ALL_SYS 191 RESTORE_ALL_SYS
194 rti; 192 rti;
195
196#ifdef CONFIG_HARDWARE_PM
197.Lcall_do_ovf:
198
199 SP += -12;
200 call _pm_overflow;
201 SP += 12;
202
203 jump .Lcommon_restore_all_sys;
204#endif
205
206ENDPROC(_evt_ivhw) 193ENDPROC(_evt_ivhw)
207 194
208/* Interrupt routine for evt2 (NMI). 195/* Interrupt routine for evt2 (NMI).
@@ -245,3 +232,56 @@ ENTRY(_evt_system_call)
245 call _system_call; 232 call _system_call;
246 jump .Lcommon_restore_context; 233 jump .Lcommon_restore_context;
247ENDPROC(_evt_system_call) 234ENDPROC(_evt_system_call)
235
236#ifdef CONFIG_IPIPE
237ENTRY(___ipipe_call_irqtail)
238 r0.l = 1f;
239 r0.h = 1f;
240 reti = r0;
241 rti;
2421:
243 [--sp] = rets;
244 [--sp] = ( r7:4, p5:3 );
245 p0.l = ___ipipe_irq_tail_hook;
246 p0.h = ___ipipe_irq_tail_hook;
247 p0 = [p0];
248 sp += -12;
249 call (p0);
250 sp += 12;
251 ( r7:4, p5:3 ) = [sp++];
252 rets = [sp++];
253
254 [--sp] = reti;
255 reti = [sp++]; /* IRQs are off. */
256 r0.h = 3f;
257 r0.l = 3f;
258 p0.l = lo(EVT14);
259 p0.h = hi(EVT14);
260 [p0] = r0;
261 csync;
262 r0 = 0x401f;
263 sti r0;
264 raise 14;
265 [--sp] = reti; /* IRQs on. */
2662:
267 jump 2b; /* Likely paranoid. */
2683:
269 sp += 4; /* Discard saved RETI */
270 r0.h = _evt14_softirq;
271 r0.l = _evt14_softirq;
272 p0.l = lo(EVT14);
273 p0.h = hi(EVT14);
274 [p0] = r0;
275 csync;
276 p0.l = _bfin_irq_flags;
277 p0.h = _bfin_irq_flags;
278 r0 = [p0];
279 sti r0;
280#if 0 /* FIXME: this actually raises scheduling latencies */
281 /* Reenable interrupts */
282 [--sp] = reti;
283 r0 = [sp++];
284#endif
285 rts;
286ENDPROC(___ipipe_call_irqtail)
287#endif /* CONFIG_IPIPE */
diff --git a/arch/blackfin/mach-common/ints-priority.c b/arch/blackfin/mach-common/ints-priority.c
index 34e8a726ffda..1bba6030dce9 100644
--- a/arch/blackfin/mach-common/ints-priority.c
+++ b/arch/blackfin/mach-common/ints-priority.c
@@ -1,9 +1,6 @@
1/* 1/*
2 * File: arch/blackfin/mach-common/ints-priority.c 2 * File: arch/blackfin/mach-common/ints-priority.c
3 * Based on:
4 * Author:
5 * 3 *
6 * Created: ?
7 * Description: Set up the interrupt priorities 4 * Description: Set up the interrupt priorities
8 * 5 *
9 * Modified: 6 * Modified:
@@ -37,6 +34,9 @@
37#include <linux/kernel_stat.h> 34#include <linux/kernel_stat.h>
38#include <linux/seq_file.h> 35#include <linux/seq_file.h>
39#include <linux/irq.h> 36#include <linux/irq.h>
37#ifdef CONFIG_IPIPE
38#include <linux/ipipe.h>
39#endif
40#ifdef CONFIG_KGDB 40#ifdef CONFIG_KGDB
41#include <linux/kgdb.h> 41#include <linux/kgdb.h>
42#endif 42#endif
@@ -45,6 +45,8 @@
45#include <asm/gpio.h> 45#include <asm/gpio.h>
46#include <asm/irq_handler.h> 46#include <asm/irq_handler.h>
47 47
48#define SIC_SYSIRQ(irq) (irq - (IRQ_CORETMR + 1))
49
48#ifdef BF537_FAMILY 50#ifdef BF537_FAMILY
49# define BF537_GENERIC_ERROR_INT_DEMUX 51# define BF537_GENERIC_ERROR_INT_DEMUX
50#else 52#else
@@ -58,13 +60,16 @@
58 * - 60 * -
59 */ 61 */
60 62
63#ifndef CONFIG_SMP
61/* Initialize this to an actual value to force it into the .data 64/* Initialize this to an actual value to force it into the .data
62 * section so that we know it is properly initialized at entry into 65 * section so that we know it is properly initialized at entry into
63 * the kernel but before bss is initialized to zero (which is where 66 * the kernel but before bss is initialized to zero (which is where
64 * it would live otherwise). The 0x1f magic represents the IRQs we 67 * it would live otherwise). The 0x1f magic represents the IRQs we
65 * cannot actually mask out in hardware. 68 * cannot actually mask out in hardware.
66 */ 69 */
67unsigned long irq_flags = 0x1f; 70unsigned long bfin_irq_flags = 0x1f;
71EXPORT_SYMBOL(bfin_irq_flags);
72#endif
68 73
69/* The number of spurious interrupts */ 74/* The number of spurious interrupts */
70atomic_t num_spurious; 75atomic_t num_spurious;
@@ -103,12 +108,14 @@ static void __init search_IAR(void)
103 for (irqn = 0; irqn < NR_PERI_INTS; irqn++) { 108 for (irqn = 0; irqn < NR_PERI_INTS; irqn++) {
104 int iar_shift = (irqn & 7) * 4; 109 int iar_shift = (irqn & 7) * 4;
105 if (ivg == (0xf & 110 if (ivg == (0xf &
106#ifndef CONFIG_BF52x 111#if defined(CONFIG_BF52x) || defined(CONFIG_BF538) \
112 || defined(CONFIG_BF539) || defined(CONFIG_BF51x)
107 bfin_read32((unsigned long *)SIC_IAR0 + 113 bfin_read32((unsigned long *)SIC_IAR0 +
108 (irqn >> 3)) >> iar_shift)) { 114 ((irqn % 32) >> 3) + ((irqn / 32) *
115 ((SIC_IAR4 - SIC_IAR0) / 4))) >> iar_shift)) {
109#else 116#else
110 bfin_read32((unsigned long *)SIC_IAR0 + 117 bfin_read32((unsigned long *)SIC_IAR0 +
111 ((irqn%32) >> 3) + ((irqn / 32) * 16)) >> iar_shift)) { 118 (irqn >> 3)) >> iar_shift)) {
112#endif 119#endif
113 ivg_table[irq_pos].irqno = IVG7 + irqn; 120 ivg_table[irq_pos].irqno = IVG7 + irqn;
114 ivg_table[irq_pos].isrflag = 1 << (irqn % 32); 121 ivg_table[irq_pos].isrflag = 1 << (irqn % 32);
@@ -130,25 +137,25 @@ static void bfin_ack_noop(unsigned int irq)
130 137
131static void bfin_core_mask_irq(unsigned int irq) 138static void bfin_core_mask_irq(unsigned int irq)
132{ 139{
133 irq_flags &= ~(1 << irq); 140 bfin_irq_flags &= ~(1 << irq);
134 if (!irqs_disabled()) 141 if (!irqs_disabled_hw())
135 local_irq_enable(); 142 local_irq_enable_hw();
136} 143}
137 144
138static void bfin_core_unmask_irq(unsigned int irq) 145static void bfin_core_unmask_irq(unsigned int irq)
139{ 146{
140 irq_flags |= 1 << irq; 147 bfin_irq_flags |= 1 << irq;
141 /* 148 /*
142 * If interrupts are enabled, IMASK must contain the same value 149 * If interrupts are enabled, IMASK must contain the same value
143 * as irq_flags. Make sure that invariant holds. If interrupts 150 * as bfin_irq_flags. Make sure that invariant holds. If interrupts
144 * are currently disabled we need not do anything; one of the 151 * are currently disabled we need not do anything; one of the
145 * callers will take care of setting IMASK to the proper value 152 * callers will take care of setting IMASK to the proper value
146 * when reenabling interrupts. 153 * when reenabling interrupts.
147 * local_irq_enable just does "STI irq_flags", so it's exactly 154 * local_irq_enable just does "STI bfin_irq_flags", so it's exactly
148 * what we need. 155 * what we need.
149 */ 156 */
150 if (!irqs_disabled()) 157 if (!irqs_disabled_hw())
151 local_irq_enable(); 158 local_irq_enable_hw();
152 return; 159 return;
153} 160}
154 161
@@ -163,8 +170,11 @@ static void bfin_internal_mask_irq(unsigned int irq)
163 mask_bit = SIC_SYSIRQ(irq) % 32; 170 mask_bit = SIC_SYSIRQ(irq) % 32;
164 bfin_write_SIC_IMASK(mask_bank, bfin_read_SIC_IMASK(mask_bank) & 171 bfin_write_SIC_IMASK(mask_bank, bfin_read_SIC_IMASK(mask_bank) &
165 ~(1 << mask_bit)); 172 ~(1 << mask_bit));
173#ifdef CONFIG_SMP
174 bfin_write_SICB_IMASK(mask_bank, bfin_read_SICB_IMASK(mask_bank) &
175 ~(1 << mask_bit));
176#endif
166#endif 177#endif
167 SSYNC();
168} 178}
169 179
170static void bfin_internal_unmask_irq(unsigned int irq) 180static void bfin_internal_unmask_irq(unsigned int irq)
@@ -178,14 +188,17 @@ static void bfin_internal_unmask_irq(unsigned int irq)
178 mask_bit = SIC_SYSIRQ(irq) % 32; 188 mask_bit = SIC_SYSIRQ(irq) % 32;
179 bfin_write_SIC_IMASK(mask_bank, bfin_read_SIC_IMASK(mask_bank) | 189 bfin_write_SIC_IMASK(mask_bank, bfin_read_SIC_IMASK(mask_bank) |
180 (1 << mask_bit)); 190 (1 << mask_bit));
191#ifdef CONFIG_SMP
192 bfin_write_SICB_IMASK(mask_bank, bfin_read_SICB_IMASK(mask_bank) |
193 (1 << mask_bit));
194#endif
181#endif 195#endif
182 SSYNC();
183} 196}
184 197
185#ifdef CONFIG_PM 198#ifdef CONFIG_PM
186int bfin_internal_set_wake(unsigned int irq, unsigned int state) 199int bfin_internal_set_wake(unsigned int irq, unsigned int state)
187{ 200{
188 unsigned bank, bit, wakeup = 0; 201 u32 bank, bit, wakeup = 0;
189 unsigned long flags; 202 unsigned long flags;
190 bank = SIC_SYSIRQ(irq) / 32; 203 bank = SIC_SYSIRQ(irq) / 32;
191 bit = SIC_SYSIRQ(irq) % 32; 204 bit = SIC_SYSIRQ(irq) % 32;
@@ -225,7 +238,7 @@ int bfin_internal_set_wake(unsigned int irq, unsigned int state)
225 break; 238 break;
226 } 239 }
227 240
228 local_irq_save(flags); 241 local_irq_save_hw(flags);
229 242
230 if (state) { 243 if (state) {
231 bfin_sic_iwr[bank] |= (1 << bit); 244 bfin_sic_iwr[bank] |= (1 << bit);
@@ -236,7 +249,7 @@ int bfin_internal_set_wake(unsigned int irq, unsigned int state)
236 vr_wakeup &= ~wakeup; 249 vr_wakeup &= ~wakeup;
237 } 250 }
238 251
239 local_irq_restore(flags); 252 local_irq_restore_hw(flags);
240 253
241 return 0; 254 return 0;
242} 255}
@@ -262,6 +275,19 @@ static struct irq_chip bfin_internal_irqchip = {
262#endif 275#endif
263}; 276};
264 277
278static void bfin_handle_irq(unsigned irq)
279{
280#ifdef CONFIG_IPIPE
281 struct pt_regs regs; /* Contents not used. */
282 ipipe_trace_irq_entry(irq);
283 __ipipe_handle_irq(irq, &regs);
284 ipipe_trace_irq_exit(irq);
285#else /* !CONFIG_IPIPE */
286 struct irq_desc *desc = irq_desc + irq;
287 desc->handle_irq(irq, desc);
288#endif /* !CONFIG_IPIPE */
289}
290
265#ifdef BF537_GENERIC_ERROR_INT_DEMUX 291#ifdef BF537_GENERIC_ERROR_INT_DEMUX
266static int error_int_mask; 292static int error_int_mask;
267 293
@@ -292,8 +318,6 @@ static void bfin_demux_error_irq(unsigned int int_err_irq,
292{ 318{
293 int irq = 0; 319 int irq = 0;
294 320
295 SSYNC();
296
297#if (defined(CONFIG_BF537) || defined(CONFIG_BF536)) 321#if (defined(CONFIG_BF537) || defined(CONFIG_BF536))
298 if (bfin_read_EMAC_SYSTAT() & EMAC_ERR_MASK) 322 if (bfin_read_EMAC_SYSTAT() & EMAC_ERR_MASK)
299 irq = IRQ_MAC_ERROR; 323 irq = IRQ_MAC_ERROR;
@@ -317,10 +341,9 @@ static void bfin_demux_error_irq(unsigned int int_err_irq,
317 irq = IRQ_UART1_ERROR; 341 irq = IRQ_UART1_ERROR;
318 342
319 if (irq) { 343 if (irq) {
320 if (error_int_mask & (1L << (irq - IRQ_PPI_ERROR))) { 344 if (error_int_mask & (1L << (irq - IRQ_PPI_ERROR)))
321 struct irq_desc *desc = irq_desc + irq; 345 bfin_handle_irq(irq);
322 desc->handle_irq(irq, desc); 346 else {
323 } else {
324 347
325 switch (irq) { 348 switch (irq) {
326 case IRQ_PPI_ERROR: 349 case IRQ_PPI_ERROR:
@@ -366,62 +389,57 @@ static void bfin_demux_error_irq(unsigned int int_err_irq,
366 389
367static inline void bfin_set_irq_handler(unsigned irq, irq_flow_handler_t handle) 390static inline void bfin_set_irq_handler(unsigned irq, irq_flow_handler_t handle)
368{ 391{
392#ifdef CONFIG_IPIPE
393 _set_irq_handler(irq, handle_edge_irq);
394#else
369 struct irq_desc *desc = irq_desc + irq; 395 struct irq_desc *desc = irq_desc + irq;
370 /* May not call generic set_irq_handler() due to spinlock 396 /* May not call generic set_irq_handler() due to spinlock
371 recursion. */ 397 recursion. */
372 desc->handle_irq = handle; 398 desc->handle_irq = handle;
399#endif
373} 400}
374 401
375#if !defined(CONFIG_BF54x) 402static DECLARE_BITMAP(gpio_enabled, MAX_BLACKFIN_GPIOS);
376
377static unsigned short gpio_enabled[gpio_bank(MAX_BLACKFIN_GPIOS)];
378static unsigned short gpio_edge_triggered[gpio_bank(MAX_BLACKFIN_GPIOS)];
379
380extern void bfin_gpio_irq_prepare(unsigned gpio); 403extern void bfin_gpio_irq_prepare(unsigned gpio);
381 404
405#if !defined(CONFIG_BF54x)
406
382static void bfin_gpio_ack_irq(unsigned int irq) 407static void bfin_gpio_ack_irq(unsigned int irq)
383{ 408{
384 u16 gpionr = irq - IRQ_PF0; 409 /* AFAIK ack_irq in case mask_ack is provided
385 410 * get's only called for edge sense irqs
386 if (gpio_edge_triggered[gpio_bank(gpionr)] & gpio_bit(gpionr)) { 411 */
387 set_gpio_data(gpionr, 0); 412 set_gpio_data(irq_to_gpio(irq), 0);
388 SSYNC();
389 }
390} 413}
391 414
392static void bfin_gpio_mask_ack_irq(unsigned int irq) 415static void bfin_gpio_mask_ack_irq(unsigned int irq)
393{ 416{
394 u16 gpionr = irq - IRQ_PF0; 417 struct irq_desc *desc = irq_desc + irq;
418 u32 gpionr = irq_to_gpio(irq);
395 419
396 if (gpio_edge_triggered[gpio_bank(gpionr)] & gpio_bit(gpionr)) { 420 if (desc->handle_irq == handle_edge_irq)
397 set_gpio_data(gpionr, 0); 421 set_gpio_data(gpionr, 0);
398 SSYNC();
399 }
400 422
401 set_gpio_maska(gpionr, 0); 423 set_gpio_maska(gpionr, 0);
402 SSYNC();
403} 424}
404 425
405static void bfin_gpio_mask_irq(unsigned int irq) 426static void bfin_gpio_mask_irq(unsigned int irq)
406{ 427{
407 set_gpio_maska(irq - IRQ_PF0, 0); 428 set_gpio_maska(irq_to_gpio(irq), 0);
408 SSYNC();
409} 429}
410 430
411static void bfin_gpio_unmask_irq(unsigned int irq) 431static void bfin_gpio_unmask_irq(unsigned int irq)
412{ 432{
413 set_gpio_maska(irq - IRQ_PF0, 1); 433 set_gpio_maska(irq_to_gpio(irq), 1);
414 SSYNC();
415} 434}
416 435
417static unsigned int bfin_gpio_irq_startup(unsigned int irq) 436static unsigned int bfin_gpio_irq_startup(unsigned int irq)
418{ 437{
419 u16 gpionr = irq - IRQ_PF0; 438 u32 gpionr = irq_to_gpio(irq);
420 439
421 if (!(gpio_enabled[gpio_bank(gpionr)] & gpio_bit(gpionr))) 440 if (__test_and_set_bit(gpionr, gpio_enabled))
422 bfin_gpio_irq_prepare(gpionr); 441 bfin_gpio_irq_prepare(gpionr);
423 442
424 gpio_enabled[gpio_bank(gpionr)] |= gpio_bit(gpionr);
425 bfin_gpio_unmask_irq(irq); 443 bfin_gpio_unmask_irq(irq);
426 444
427 return 0; 445 return 0;
@@ -429,29 +447,39 @@ static unsigned int bfin_gpio_irq_startup(unsigned int irq)
429 447
430static void bfin_gpio_irq_shutdown(unsigned int irq) 448static void bfin_gpio_irq_shutdown(unsigned int irq)
431{ 449{
450 u32 gpionr = irq_to_gpio(irq);
451
432 bfin_gpio_mask_irq(irq); 452 bfin_gpio_mask_irq(irq);
433 gpio_enabled[gpio_bank(irq - IRQ_PF0)] &= ~gpio_bit(irq - IRQ_PF0); 453 __clear_bit(gpionr, gpio_enabled);
454 bfin_gpio_irq_free(gpionr);
434} 455}
435 456
436static int bfin_gpio_irq_type(unsigned int irq, unsigned int type) 457static int bfin_gpio_irq_type(unsigned int irq, unsigned int type)
437{ 458{
438 u16 gpionr = irq - IRQ_PF0; 459 int ret;
460 char buf[16];
461 u32 gpionr = irq_to_gpio(irq);
439 462
440 if (type == IRQ_TYPE_PROBE) { 463 if (type == IRQ_TYPE_PROBE) {
441 /* only probe unenabled GPIO interrupt lines */ 464 /* only probe unenabled GPIO interrupt lines */
442 if (gpio_enabled[gpio_bank(gpionr)] & gpio_bit(gpionr)) 465 if (__test_bit(gpionr, gpio_enabled))
443 return 0; 466 return 0;
444 type = IRQ_TYPE_EDGE_RISING | IRQ_TYPE_EDGE_FALLING; 467 type = IRQ_TYPE_EDGE_RISING | IRQ_TYPE_EDGE_FALLING;
445 } 468 }
446 469
447 if (type & (IRQ_TYPE_EDGE_RISING | IRQ_TYPE_EDGE_FALLING | 470 if (type & (IRQ_TYPE_EDGE_RISING | IRQ_TYPE_EDGE_FALLING |
448 IRQ_TYPE_LEVEL_HIGH | IRQ_TYPE_LEVEL_LOW)) { 471 IRQ_TYPE_LEVEL_HIGH | IRQ_TYPE_LEVEL_LOW)) {
449 if (!(gpio_enabled[gpio_bank(gpionr)] & gpio_bit(gpionr))) 472
473 snprintf(buf, 16, "gpio-irq%d", irq);
474 ret = bfin_gpio_irq_request(gpionr, buf);
475 if (ret)
476 return ret;
477
478 if (__test_and_set_bit(gpionr, gpio_enabled))
450 bfin_gpio_irq_prepare(gpionr); 479 bfin_gpio_irq_prepare(gpionr);
451 480
452 gpio_enabled[gpio_bank(gpionr)] |= gpio_bit(gpionr);
453 } else { 481 } else {
454 gpio_enabled[gpio_bank(gpionr)] &= ~gpio_bit(gpionr); 482 __clear_bit(gpionr, gpio_enabled);
455 return 0; 483 return 0;
456 } 484 }
457 485
@@ -472,17 +500,13 @@ static int bfin_gpio_irq_type(unsigned int irq, unsigned int type)
472 if (type & (IRQ_TYPE_EDGE_RISING | IRQ_TYPE_EDGE_FALLING)) { 500 if (type & (IRQ_TYPE_EDGE_RISING | IRQ_TYPE_EDGE_FALLING)) {
473 set_gpio_edge(gpionr, 1); 501 set_gpio_edge(gpionr, 1);
474 set_gpio_inen(gpionr, 1); 502 set_gpio_inen(gpionr, 1);
475 gpio_edge_triggered[gpio_bank(gpionr)] |= gpio_bit(gpionr);
476 set_gpio_data(gpionr, 0); 503 set_gpio_data(gpionr, 0);
477 504
478 } else { 505 } else {
479 set_gpio_edge(gpionr, 0); 506 set_gpio_edge(gpionr, 0);
480 gpio_edge_triggered[gpio_bank(gpionr)] &= ~gpio_bit(gpionr);
481 set_gpio_inen(gpionr, 1); 507 set_gpio_inen(gpionr, 1);
482 } 508 }
483 509
484 SSYNC();
485
486 if (type & (IRQ_TYPE_EDGE_RISING | IRQ_TYPE_EDGE_FALLING)) 510 if (type & (IRQ_TYPE_EDGE_RISING | IRQ_TYPE_EDGE_FALLING))
487 bfin_set_irq_handler(irq, handle_edge_irq); 511 bfin_set_irq_handler(irq, handle_edge_irq);
488 else 512 else
@@ -505,22 +529,6 @@ int bfin_gpio_set_wake(unsigned int irq, unsigned int state)
505} 529}
506#endif 530#endif
507 531
508static struct irq_chip bfin_gpio_irqchip = {
509 .name = "GPIO",
510 .ack = bfin_gpio_ack_irq,
511 .mask = bfin_gpio_mask_irq,
512 .mask_ack = bfin_gpio_mask_ack_irq,
513 .unmask = bfin_gpio_unmask_irq,
514 .disable = bfin_gpio_mask_irq,
515 .enable = bfin_gpio_unmask_irq,
516 .set_type = bfin_gpio_irq_type,
517 .startup = bfin_gpio_irq_startup,
518 .shutdown = bfin_gpio_irq_shutdown,
519#ifdef CONFIG_PM
520 .set_wake = bfin_gpio_set_wake,
521#endif
522};
523
524static void bfin_demux_gpio_irq(unsigned int inta_irq, 532static void bfin_demux_gpio_irq(unsigned int inta_irq,
525 struct irq_desc *desc) 533 struct irq_desc *desc)
526{ 534{
@@ -537,7 +545,11 @@ static void bfin_demux_gpio_irq(unsigned int inta_irq,
537 irq = IRQ_PH0; 545 irq = IRQ_PH0;
538 break; 546 break;
539# endif 547# endif
540#elif defined(CONFIG_BF52x) 548#elif defined(CONFIG_BF538) || defined(CONFIG_BF539)
549 case IRQ_PORTF_INTA:
550 irq = IRQ_PF0;
551 break;
552#elif defined(CONFIG_BF52x) || defined(CONFIG_BF51x)
541 case IRQ_PORTF_INTA: 553 case IRQ_PORTF_INTA:
542 irq = IRQ_PF0; 554 irq = IRQ_PF0;
543 break; 555 break;
@@ -567,30 +579,22 @@ static void bfin_demux_gpio_irq(unsigned int inta_irq,
567 for (i = 0; i < MAX_BLACKFIN_GPIOS; i += GPIO_BANKSIZE) { 579 for (i = 0; i < MAX_BLACKFIN_GPIOS; i += GPIO_BANKSIZE) {
568 irq += i; 580 irq += i;
569 581
570 mask = get_gpiop_data(i) & 582 mask = get_gpiop_data(i) & get_gpiop_maska(i);
571 (gpio_enabled[gpio_bank(i)] &
572 get_gpiop_maska(i));
573 583
574 while (mask) { 584 while (mask) {
575 if (mask & 1) { 585 if (mask & 1)
576 desc = irq_desc + irq; 586 bfin_handle_irq(irq);
577 desc->handle_irq(irq, desc);
578 }
579 irq++; 587 irq++;
580 mask >>= 1; 588 mask >>= 1;
581 } 589 }
582 } 590 }
583 } else { 591 } else {
584 gpio = irq_to_gpio(irq); 592 gpio = irq_to_gpio(irq);
585 mask = get_gpiop_data(gpio) & 593 mask = get_gpiop_data(gpio) & get_gpiop_maska(gpio);
586 (gpio_enabled[gpio_bank(gpio)] &
587 get_gpiop_maska(gpio));
588 594
589 do { 595 do {
590 if (mask & 1) { 596 if (mask & 1)
591 desc = irq_desc + irq; 597 bfin_handle_irq(irq);
592 desc->handle_irq(irq, desc);
593 }
594 irq++; 598 irq++;
595 mask >>= 1; 599 mask >>= 1;
596 } while (mask); 600 } while (mask);
@@ -612,10 +616,6 @@ static void bfin_demux_gpio_irq(unsigned int inta_irq,
612static unsigned char irq2pint_lut[NR_PINTS]; 616static unsigned char irq2pint_lut[NR_PINTS];
613static unsigned char pint2irq_lut[NR_PINT_SYS_IRQS * NR_PINT_BITS]; 617static unsigned char pint2irq_lut[NR_PINT_SYS_IRQS * NR_PINT_BITS];
614 618
615static unsigned int gpio_both_edge_triggered[NR_PINT_SYS_IRQS];
616static unsigned short gpio_enabled[gpio_bank(MAX_BLACKFIN_GPIOS)];
617
618
619struct pin_int_t { 619struct pin_int_t {
620 unsigned int mask_set; 620 unsigned int mask_set;
621 unsigned int mask_clear; 621 unsigned int mask_clear;
@@ -636,12 +636,9 @@ static struct pin_int_t *pint[NR_PINT_SYS_IRQS] = {
636 (struct pin_int_t *)PINT3_MASK_SET, 636 (struct pin_int_t *)PINT3_MASK_SET,
637}; 637};
638 638
639extern void bfin_gpio_irq_prepare(unsigned gpio); 639inline unsigned int get_irq_base(u32 bank, u8 bmap)
640
641inline unsigned short get_irq_base(u8 bank, u8 bmap)
642{ 640{
643 641 unsigned int irq_base;
644 u16 irq_base;
645 642
646 if (bank < 2) { /*PA-PB */ 643 if (bank < 2) { /*PA-PB */
647 irq_base = IRQ_PA0 + bmap * 16; 644 irq_base = IRQ_PA0 + bmap * 16;
@@ -650,7 +647,6 @@ inline unsigned short get_irq_base(u8 bank, u8 bmap)
650 } 647 }
651 648
652 return irq_base; 649 return irq_base;
653
654} 650}
655 651
656 /* Whenever PINTx_ASSIGN is altered init_pint_lut() must be executed! */ 652 /* Whenever PINTx_ASSIGN is altered init_pint_lut() must be executed! */
@@ -677,20 +673,18 @@ void init_pint_lut(void)
677 673
678 pint2irq_lut[bit_pos] = irq_base - SYS_IRQS; 674 pint2irq_lut[bit_pos] = irq_base - SYS_IRQS;
679 irq2pint_lut[irq_base - SYS_IRQS] = bit_pos; 675 irq2pint_lut[irq_base - SYS_IRQS] = bit_pos;
680
681 } 676 }
682
683 } 677 }
684
685} 678}
686 679
687static void bfin_gpio_ack_irq(unsigned int irq) 680static void bfin_gpio_ack_irq(unsigned int irq)
688{ 681{
689 u8 pint_val = irq2pint_lut[irq - SYS_IRQS]; 682 struct irq_desc *desc = irq_desc + irq;
683 u32 pint_val = irq2pint_lut[irq - SYS_IRQS];
690 u32 pintbit = PINT_BIT(pint_val); 684 u32 pintbit = PINT_BIT(pint_val);
691 u8 bank = PINT_2_BANK(pint_val); 685 u32 bank = PINT_2_BANK(pint_val);
692 686
693 if (unlikely(gpio_both_edge_triggered[bank] & pintbit)) { 687 if ((desc->status & IRQ_TYPE_SENSE_MASK) == IRQ_TYPE_EDGE_BOTH) {
694 if (pint[bank]->invert_set & pintbit) 688 if (pint[bank]->invert_set & pintbit)
695 pint[bank]->invert_clear = pintbit; 689 pint[bank]->invert_clear = pintbit;
696 else 690 else
@@ -698,16 +692,16 @@ static void bfin_gpio_ack_irq(unsigned int irq)
698 } 692 }
699 pint[bank]->request = pintbit; 693 pint[bank]->request = pintbit;
700 694
701 SSYNC();
702} 695}
703 696
704static void bfin_gpio_mask_ack_irq(unsigned int irq) 697static void bfin_gpio_mask_ack_irq(unsigned int irq)
705{ 698{
706 u8 pint_val = irq2pint_lut[irq - SYS_IRQS]; 699 struct irq_desc *desc = irq_desc + irq;
700 u32 pint_val = irq2pint_lut[irq - SYS_IRQS];
707 u32 pintbit = PINT_BIT(pint_val); 701 u32 pintbit = PINT_BIT(pint_val);
708 u8 bank = PINT_2_BANK(pint_val); 702 u32 bank = PINT_2_BANK(pint_val);
709 703
710 if (unlikely(gpio_both_edge_triggered[bank] & pintbit)) { 704 if ((desc->status & IRQ_TYPE_SENSE_MASK) == IRQ_TYPE_EDGE_BOTH) {
711 if (pint[bank]->invert_set & pintbit) 705 if (pint[bank]->invert_set & pintbit)
712 pint[bank]->invert_clear = pintbit; 706 pint[bank]->invert_clear = pintbit;
713 else 707 else
@@ -716,32 +710,29 @@ static void bfin_gpio_mask_ack_irq(unsigned int irq)
716 710
717 pint[bank]->request = pintbit; 711 pint[bank]->request = pintbit;
718 pint[bank]->mask_clear = pintbit; 712 pint[bank]->mask_clear = pintbit;
719 SSYNC();
720} 713}
721 714
722static void bfin_gpio_mask_irq(unsigned int irq) 715static void bfin_gpio_mask_irq(unsigned int irq)
723{ 716{
724 u8 pint_val = irq2pint_lut[irq - SYS_IRQS]; 717 u32 pint_val = irq2pint_lut[irq - SYS_IRQS];
725 718
726 pint[PINT_2_BANK(pint_val)]->mask_clear = PINT_BIT(pint_val); 719 pint[PINT_2_BANK(pint_val)]->mask_clear = PINT_BIT(pint_val);
727 SSYNC();
728} 720}
729 721
730static void bfin_gpio_unmask_irq(unsigned int irq) 722static void bfin_gpio_unmask_irq(unsigned int irq)
731{ 723{
732 u8 pint_val = irq2pint_lut[irq - SYS_IRQS]; 724 u32 pint_val = irq2pint_lut[irq - SYS_IRQS];
733 u32 pintbit = PINT_BIT(pint_val); 725 u32 pintbit = PINT_BIT(pint_val);
734 u8 bank = PINT_2_BANK(pint_val); 726 u32 bank = PINT_2_BANK(pint_val);
735 727
736 pint[bank]->request = pintbit; 728 pint[bank]->request = pintbit;
737 pint[bank]->mask_set = pintbit; 729 pint[bank]->mask_set = pintbit;
738 SSYNC();
739} 730}
740 731
741static unsigned int bfin_gpio_irq_startup(unsigned int irq) 732static unsigned int bfin_gpio_irq_startup(unsigned int irq)
742{ 733{
743 u16 gpionr = irq_to_gpio(irq); 734 u32 gpionr = irq_to_gpio(irq);
744 u8 pint_val = irq2pint_lut[irq - SYS_IRQS]; 735 u32 pint_val = irq2pint_lut[irq - SYS_IRQS];
745 736
746 if (pint_val == IRQ_NOT_AVAIL) { 737 if (pint_val == IRQ_NOT_AVAIL) {
747 printk(KERN_ERR 738 printk(KERN_ERR
@@ -750,10 +741,9 @@ static unsigned int bfin_gpio_irq_startup(unsigned int irq)
750 return -ENODEV; 741 return -ENODEV;
751 } 742 }
752 743
753 if (!(gpio_enabled[gpio_bank(gpionr)] & gpio_bit(gpionr))) 744 if (__test_and_set_bit(gpionr, gpio_enabled))
754 bfin_gpio_irq_prepare(gpionr); 745 bfin_gpio_irq_prepare(gpionr);
755 746
756 gpio_enabled[gpio_bank(gpionr)] |= gpio_bit(gpionr);
757 bfin_gpio_unmask_irq(irq); 747 bfin_gpio_unmask_irq(irq);
758 748
759 return 0; 749 return 0;
@@ -761,38 +751,45 @@ static unsigned int bfin_gpio_irq_startup(unsigned int irq)
761 751
762static void bfin_gpio_irq_shutdown(unsigned int irq) 752static void bfin_gpio_irq_shutdown(unsigned int irq)
763{ 753{
764 u16 gpionr = irq_to_gpio(irq); 754 u32 gpionr = irq_to_gpio(irq);
765 755
766 bfin_gpio_mask_irq(irq); 756 bfin_gpio_mask_irq(irq);
767 gpio_enabled[gpio_bank(gpionr)] &= ~gpio_bit(gpionr); 757 __clear_bit(gpionr, gpio_enabled);
758 bfin_gpio_irq_free(gpionr);
768} 759}
769 760
770static int bfin_gpio_irq_type(unsigned int irq, unsigned int type) 761static int bfin_gpio_irq_type(unsigned int irq, unsigned int type)
771{ 762{
772 763 int ret;
773 u16 gpionr = irq_to_gpio(irq); 764 char buf[16];
774 u8 pint_val = irq2pint_lut[irq - SYS_IRQS]; 765 u32 gpionr = irq_to_gpio(irq);
766 u32 pint_val = irq2pint_lut[irq - SYS_IRQS];
775 u32 pintbit = PINT_BIT(pint_val); 767 u32 pintbit = PINT_BIT(pint_val);
776 u8 bank = PINT_2_BANK(pint_val); 768 u32 bank = PINT_2_BANK(pint_val);
777 769
778 if (pint_val == IRQ_NOT_AVAIL) 770 if (pint_val == IRQ_NOT_AVAIL)
779 return -ENODEV; 771 return -ENODEV;
780 772
781 if (type == IRQ_TYPE_PROBE) { 773 if (type == IRQ_TYPE_PROBE) {
782 /* only probe unenabled GPIO interrupt lines */ 774 /* only probe unenabled GPIO interrupt lines */
783 if (gpio_enabled[gpio_bank(gpionr)] & gpio_bit(gpionr)) 775 if (__test_bit(gpionr, gpio_enabled))
784 return 0; 776 return 0;
785 type = IRQ_TYPE_EDGE_RISING | IRQ_TYPE_EDGE_FALLING; 777 type = IRQ_TYPE_EDGE_RISING | IRQ_TYPE_EDGE_FALLING;
786 } 778 }
787 779
788 if (type & (IRQ_TYPE_EDGE_RISING | IRQ_TYPE_EDGE_FALLING | 780 if (type & (IRQ_TYPE_EDGE_RISING | IRQ_TYPE_EDGE_FALLING |
789 IRQ_TYPE_LEVEL_HIGH | IRQ_TYPE_LEVEL_LOW)) { 781 IRQ_TYPE_LEVEL_HIGH | IRQ_TYPE_LEVEL_LOW)) {
790 if (!(gpio_enabled[gpio_bank(gpionr)] & gpio_bit(gpionr))) 782
783 snprintf(buf, 16, "gpio-irq%d", irq);
784 ret = bfin_gpio_irq_request(gpionr, buf);
785 if (ret)
786 return ret;
787
788 if (__test_and_set_bit(gpionr, gpio_enabled))
791 bfin_gpio_irq_prepare(gpionr); 789 bfin_gpio_irq_prepare(gpionr);
792 790
793 gpio_enabled[gpio_bank(gpionr)] |= gpio_bit(gpionr);
794 } else { 791 } else {
795 gpio_enabled[gpio_bank(gpionr)] &= ~gpio_bit(gpionr); 792 __clear_bit(gpionr, gpio_enabled);
796 return 0; 793 return 0;
797 } 794 }
798 795
@@ -803,15 +800,10 @@ static int bfin_gpio_irq_type(unsigned int irq, unsigned int type)
803 800
804 if ((type & (IRQ_TYPE_EDGE_RISING | IRQ_TYPE_EDGE_FALLING)) 801 if ((type & (IRQ_TYPE_EDGE_RISING | IRQ_TYPE_EDGE_FALLING))
805 == (IRQ_TYPE_EDGE_RISING | IRQ_TYPE_EDGE_FALLING)) { 802 == (IRQ_TYPE_EDGE_RISING | IRQ_TYPE_EDGE_FALLING)) {
806
807 gpio_both_edge_triggered[bank] |= pintbit;
808
809 if (gpio_get_value(gpionr)) 803 if (gpio_get_value(gpionr))
810 pint[bank]->invert_set = pintbit; 804 pint[bank]->invert_set = pintbit;
811 else 805 else
812 pint[bank]->invert_clear = pintbit; 806 pint[bank]->invert_clear = pintbit;
813 } else {
814 gpio_both_edge_triggered[bank] &= ~pintbit;
815 } 807 }
816 808
817 if (type & (IRQ_TYPE_EDGE_RISING | IRQ_TYPE_EDGE_FALLING)) { 809 if (type & (IRQ_TYPE_EDGE_RISING | IRQ_TYPE_EDGE_FALLING)) {
@@ -822,8 +814,6 @@ static int bfin_gpio_irq_type(unsigned int irq, unsigned int type)
822 bfin_set_irq_handler(irq, handle_level_irq); 814 bfin_set_irq_handler(irq, handle_level_irq);
823 } 815 }
824 816
825 SSYNC();
826
827 return 0; 817 return 0;
828} 818}
829 819
@@ -834,7 +824,7 @@ u32 pint_wakeup_masks[NR_PINT_SYS_IRQS];
834int bfin_gpio_set_wake(unsigned int irq, unsigned int state) 824int bfin_gpio_set_wake(unsigned int irq, unsigned int state)
835{ 825{
836 u32 pint_irq; 826 u32 pint_irq;
837 u8 pint_val = irq2pint_lut[irq - SYS_IRQS]; 827 u32 pint_val = irq2pint_lut[irq - SYS_IRQS];
838 u32 bank = PINT_2_BANK(pint_val); 828 u32 bank = PINT_2_BANK(pint_val);
839 u32 pintbit = PINT_BIT(pint_val); 829 u32 pintbit = PINT_BIT(pint_val);
840 830
@@ -895,26 +885,10 @@ void bfin_pm_restore(void)
895} 885}
896#endif 886#endif
897 887
898static struct irq_chip bfin_gpio_irqchip = {
899 .name = "GPIO",
900 .ack = bfin_gpio_ack_irq,
901 .mask = bfin_gpio_mask_irq,
902 .mask_ack = bfin_gpio_mask_ack_irq,
903 .unmask = bfin_gpio_unmask_irq,
904 .disable = bfin_gpio_mask_irq,
905 .enable = bfin_gpio_unmask_irq,
906 .set_type = bfin_gpio_irq_type,
907 .startup = bfin_gpio_irq_startup,
908 .shutdown = bfin_gpio_irq_shutdown,
909#ifdef CONFIG_PM
910 .set_wake = bfin_gpio_set_wake,
911#endif
912};
913
914static void bfin_demux_gpio_irq(unsigned int inta_irq, 888static void bfin_demux_gpio_irq(unsigned int inta_irq,
915 struct irq_desc *desc) 889 struct irq_desc *desc)
916{ 890{
917 u8 bank, pint_val; 891 u32 bank, pint_val;
918 u32 request, irq; 892 u32 request, irq;
919 893
920 switch (inta_irq) { 894 switch (inta_irq) {
@@ -941,8 +915,7 @@ static void bfin_demux_gpio_irq(unsigned int inta_irq,
941 while (request) { 915 while (request) {
942 if (request & 1) { 916 if (request & 1) {
943 irq = pint2irq_lut[pint_val] + SYS_IRQS; 917 irq = pint2irq_lut[pint_val] + SYS_IRQS;
944 desc = irq_desc + irq; 918 bfin_handle_irq(irq);
945 desc->handle_irq(irq, desc);
946 } 919 }
947 pint_val++; 920 pint_val++;
948 request >>= 1; 921 request >>= 1;
@@ -951,10 +924,24 @@ static void bfin_demux_gpio_irq(unsigned int inta_irq,
951} 924}
952#endif 925#endif
953 926
954void __init init_exception_vectors(void) 927static struct irq_chip bfin_gpio_irqchip = {
955{ 928 .name = "GPIO",
956 SSYNC(); 929 .ack = bfin_gpio_ack_irq,
930 .mask = bfin_gpio_mask_irq,
931 .mask_ack = bfin_gpio_mask_ack_irq,
932 .unmask = bfin_gpio_unmask_irq,
933 .disable = bfin_gpio_mask_irq,
934 .enable = bfin_gpio_unmask_irq,
935 .set_type = bfin_gpio_irq_type,
936 .startup = bfin_gpio_irq_startup,
937 .shutdown = bfin_gpio_irq_shutdown,
938#ifdef CONFIG_PM
939 .set_wake = bfin_gpio_set_wake,
940#endif
941};
957 942
943void __cpuinit init_exception_vectors(void)
944{
958 /* cannot program in software: 945 /* cannot program in software:
959 * evt0 - emulation (jtag) 946 * evt0 - emulation (jtag)
960 * evt1 - reset 947 * evt1 - reset
@@ -979,17 +966,23 @@ void __init init_exception_vectors(void)
979 * This function should be called during kernel startup to initialize 966 * This function should be called during kernel startup to initialize
980 * the BFin IRQ handling routines. 967 * the BFin IRQ handling routines.
981 */ 968 */
969
982int __init init_arch_irq(void) 970int __init init_arch_irq(void)
983{ 971{
984 int irq; 972 int irq;
985 unsigned long ilat = 0; 973 unsigned long ilat = 0;
986 /* Disable all the peripheral intrs - page 4-29 HW Ref manual */ 974 /* Disable all the peripheral intrs - page 4-29 HW Ref manual */
987#if defined(CONFIG_BF54x) || defined(CONFIG_BF52x) || defined(CONFIG_BF561) 975#if defined(CONFIG_BF54x) || defined(CONFIG_BF52x) || defined(CONFIG_BF561) \
976 || defined(BF538_FAMILY) || defined(CONFIG_BF51x)
988 bfin_write_SIC_IMASK0(SIC_UNMASK_ALL); 977 bfin_write_SIC_IMASK0(SIC_UNMASK_ALL);
989 bfin_write_SIC_IMASK1(SIC_UNMASK_ALL); 978 bfin_write_SIC_IMASK1(SIC_UNMASK_ALL);
990# ifdef CONFIG_BF54x 979# ifdef CONFIG_BF54x
991 bfin_write_SIC_IMASK2(SIC_UNMASK_ALL); 980 bfin_write_SIC_IMASK2(SIC_UNMASK_ALL);
992# endif 981# endif
982# ifdef CONFIG_SMP
983 bfin_write_SICB_IMASK0(SIC_UNMASK_ALL);
984 bfin_write_SICB_IMASK1(SIC_UNMASK_ALL);
985# endif
993#else 986#else
994 bfin_write_SIC_IMASK(SIC_UNMASK_ALL); 987 bfin_write_SIC_IMASK(SIC_UNMASK_ALL);
995#endif 988#endif
@@ -1029,7 +1022,7 @@ int __init init_arch_irq(void)
1029 case IRQ_PINT1: 1022 case IRQ_PINT1:
1030 case IRQ_PINT2: 1023 case IRQ_PINT2:
1031 case IRQ_PINT3: 1024 case IRQ_PINT3:
1032#elif defined(CONFIG_BF52x) 1025#elif defined(CONFIG_BF52x) || defined(CONFIG_BF51x)
1033 case IRQ_PORTF_INTA: 1026 case IRQ_PORTF_INTA:
1034 case IRQ_PORTG_INTA: 1027 case IRQ_PORTG_INTA:
1035 case IRQ_PORTH_INTA: 1028 case IRQ_PORTH_INTA:
@@ -1037,18 +1030,41 @@ int __init init_arch_irq(void)
1037 case IRQ_PROG0_INTA: 1030 case IRQ_PROG0_INTA:
1038 case IRQ_PROG1_INTA: 1031 case IRQ_PROG1_INTA:
1039 case IRQ_PROG2_INTA: 1032 case IRQ_PROG2_INTA:
1033#elif defined(CONFIG_BF538) || defined(CONFIG_BF539)
1034 case IRQ_PORTF_INTA:
1040#endif 1035#endif
1036
1041 set_irq_chained_handler(irq, 1037 set_irq_chained_handler(irq,
1042 bfin_demux_gpio_irq); 1038 bfin_demux_gpio_irq);
1043 break; 1039 break;
1044#ifdef BF537_GENERIC_ERROR_INT_DEMUX 1040#ifdef BF537_GENERIC_ERROR_INT_DEMUX
1045 case IRQ_GENERIC_ERROR: 1041 case IRQ_GENERIC_ERROR:
1046 set_irq_handler(irq, bfin_demux_error_irq); 1042 set_irq_chained_handler(irq, bfin_demux_error_irq);
1047 1043 break;
1044#endif
1045#if defined(CONFIG_TICK_SOURCE_SYSTMR0) || defined(CONFIG_IPIPE)
1046 case IRQ_TIMER0:
1047 set_irq_handler(irq, handle_percpu_irq);
1048 break;
1049#endif
1050#ifdef CONFIG_SMP
1051 case IRQ_SUPPLE_0:
1052 case IRQ_SUPPLE_1:
1053 set_irq_handler(irq, handle_percpu_irq);
1048 break; 1054 break;
1049#endif 1055#endif
1050 default: 1056 default:
1057#ifdef CONFIG_IPIPE
1058 /*
1059 * We want internal interrupt sources to be masked, because
1060 * ISRs may trigger interrupts recursively (e.g. DMA), but
1061 * interrupts are _not_ masked at CPU level. So let's handle
1062 * them as level interrupts.
1063 */
1064 set_irq_handler(irq, handle_level_irq);
1065#else /* !CONFIG_IPIPE */
1051 set_irq_handler(irq, handle_simple_irq); 1066 set_irq_handler(irq, handle_simple_irq);
1067#endif /* !CONFIG_IPIPE */
1052 break; 1068 break;
1053 } 1069 }
1054 } 1070 }
@@ -1073,7 +1089,7 @@ int __init init_arch_irq(void)
1073 CSYNC(); 1089 CSYNC();
1074 1090
1075 printk(KERN_INFO "Configuring Blackfin Priority Driven Interrupts\n"); 1091 printk(KERN_INFO "Configuring Blackfin Priority Driven Interrupts\n");
1076 /* IMASK=xxx is equivalent to STI xx or irq_flags=xx, 1092 /* IMASK=xxx is equivalent to STI xx or bfin_irq_flags=xx,
1077 * local_irq_enable() 1093 * local_irq_enable()
1078 */ 1094 */
1079 program_IAR(); 1095 program_IAR();
@@ -1081,19 +1097,23 @@ int __init init_arch_irq(void)
1081 search_IAR(); 1097 search_IAR();
1082 1098
1083 /* Enable interrupts IVG7-15 */ 1099 /* Enable interrupts IVG7-15 */
1084 irq_flags = irq_flags | IMASK_IVG15 | 1100 bfin_irq_flags |= IMASK_IVG15 |
1085 IMASK_IVG14 | IMASK_IVG13 | IMASK_IVG12 | IMASK_IVG11 | 1101 IMASK_IVG14 | IMASK_IVG13 | IMASK_IVG12 | IMASK_IVG11 |
1086 IMASK_IVG10 | IMASK_IVG9 | IMASK_IVG8 | IMASK_IVG7 | IMASK_IVGHW; 1102 IMASK_IVG10 | IMASK_IVG9 | IMASK_IVG8 | IMASK_IVG7 | IMASK_IVGHW;
1087 1103
1088#if defined(CONFIG_BF54x) || defined(CONFIG_BF52x) || defined(CONFIG_BF561) 1104#if defined(CONFIG_BF54x) || defined(CONFIG_BF52x) || defined(CONFIG_BF561) \
1105 || defined(BF538_FAMILY) || defined(CONFIG_BF51x)
1089 bfin_write_SIC_IWR0(IWR_DISABLE_ALL); 1106 bfin_write_SIC_IWR0(IWR_DISABLE_ALL);
1090#if defined(CONFIG_BF52x) 1107#if defined(CONFIG_BF52x) || defined(CONFIG_BF51x)
1091 /* BF52x system reset does not properly reset SIC_IWR1 which 1108 /* BF52x/BF51x system reset does not properly reset SIC_IWR1 which
1092 * will screw up the bootrom as it relies on MDMA0/1 waking it 1109 * will screw up the bootrom as it relies on MDMA0/1 waking it
1093 * up from IDLE instructions. See this report for more info: 1110 * up from IDLE instructions. See this report for more info:
1094 * http://blackfin.uclinux.org/gf/tracker/4323 1111 * http://blackfin.uclinux.org/gf/tracker/4323
1095 */ 1112 */
1096 bfin_write_SIC_IWR1(IWR_ENABLE(10) | IWR_ENABLE(11)); 1113 if (ANOMALY_05000435)
1114 bfin_write_SIC_IWR1(IWR_ENABLE(10) | IWR_ENABLE(11));
1115 else
1116 bfin_write_SIC_IWR1(IWR_DISABLE_ALL);
1097#else 1117#else
1098 bfin_write_SIC_IWR1(IWR_DISABLE_ALL); 1118 bfin_write_SIC_IWR1(IWR_DISABLE_ALL);
1099#endif 1119#endif
@@ -1104,6 +1124,14 @@ int __init init_arch_irq(void)
1104 bfin_write_SIC_IWR(IWR_DISABLE_ALL); 1124 bfin_write_SIC_IWR(IWR_DISABLE_ALL);
1105#endif 1125#endif
1106 1126
1127#ifdef CONFIG_IPIPE
1128 for (irq = 0; irq < NR_IRQS; irq++) {
1129 struct irq_desc *desc = irq_desc + irq;
1130 desc->ic_prio = __ipipe_get_irq_priority(irq);
1131 desc->thr_prio = __ipipe_get_irqthread_priority(irq);
1132 }
1133#endif /* CONFIG_IPIPE */
1134
1107 return 0; 1135 return 0;
1108} 1136}
1109 1137
@@ -1117,11 +1145,20 @@ void do_irq(int vec, struct pt_regs *fp)
1117 } else { 1145 } else {
1118 struct ivgx *ivg = ivg7_13[vec - IVG7].ifirst; 1146 struct ivgx *ivg = ivg7_13[vec - IVG7].ifirst;
1119 struct ivgx *ivg_stop = ivg7_13[vec - IVG7].istop; 1147 struct ivgx *ivg_stop = ivg7_13[vec - IVG7].istop;
1120#if defined(CONFIG_BF54x) || defined(CONFIG_BF52x) || defined(CONFIG_BF561) 1148#if defined(CONFIG_BF54x) || defined(CONFIG_BF52x) || defined(CONFIG_BF561) \
1149 || defined(BF538_FAMILY) || defined(CONFIG_BF51x)
1121 unsigned long sic_status[3]; 1150 unsigned long sic_status[3];
1122 1151
1123 sic_status[0] = bfin_read_SIC_ISR0() & bfin_read_SIC_IMASK0(); 1152 if (smp_processor_id()) {
1124 sic_status[1] = bfin_read_SIC_ISR1() & bfin_read_SIC_IMASK1(); 1153#ifdef CONFIG_SMP
1154 /* This will be optimized out in UP mode. */
1155 sic_status[0] = bfin_read_SICB_ISR0() & bfin_read_SICB_IMASK0();
1156 sic_status[1] = bfin_read_SICB_ISR1() & bfin_read_SICB_IMASK1();
1157#endif
1158 } else {
1159 sic_status[0] = bfin_read_SIC_ISR0() & bfin_read_SIC_IMASK0();
1160 sic_status[1] = bfin_read_SIC_ISR1() & bfin_read_SIC_IMASK1();
1161 }
1125#ifdef CONFIG_BF54x 1162#ifdef CONFIG_BF54x
1126 sic_status[2] = bfin_read_SIC_ISR2() & bfin_read_SIC_IMASK2(); 1163 sic_status[2] = bfin_read_SIC_ISR2() & bfin_read_SIC_IMASK2();
1127#endif 1164#endif
@@ -1150,3 +1187,161 @@ void do_irq(int vec, struct pt_regs *fp)
1150 } 1187 }
1151 asm_do_IRQ(vec, fp); 1188 asm_do_IRQ(vec, fp);
1152} 1189}
1190
1191#ifdef CONFIG_IPIPE
1192
1193int __ipipe_get_irq_priority(unsigned irq)
1194{
1195 int ient, prio;
1196
1197 if (irq <= IRQ_CORETMR)
1198 return irq;
1199
1200 for (ient = 0; ient < NR_PERI_INTS; ient++) {
1201 struct ivgx *ivg = ivg_table + ient;
1202 if (ivg->irqno == irq) {
1203 for (prio = 0; prio <= IVG13-IVG7; prio++) {
1204 if (ivg7_13[prio].ifirst <= ivg &&
1205 ivg7_13[prio].istop > ivg)
1206 return IVG7 + prio;
1207 }
1208 }
1209 }
1210
1211 return IVG15;
1212}
1213
1214int __ipipe_get_irqthread_priority(unsigned irq)
1215{
1216 int ient, prio;
1217 int demux_irq;
1218
1219 /* The returned priority value is rescaled to [0..IVG13+1]
1220 * with 0 being the lowest effective priority level. */
1221
1222 if (irq <= IRQ_CORETMR)
1223 return IVG13 - irq + 1;
1224
1225 /* GPIO IRQs are given the priority of the demux
1226 * interrupt. */
1227 if (IS_GPIOIRQ(irq)) {
1228#if defined(CONFIG_BF54x)
1229 u32 bank = PINT_2_BANK(irq2pint_lut[irq - SYS_IRQS]);
1230 demux_irq = (bank == 0 ? IRQ_PINT0 :
1231 bank == 1 ? IRQ_PINT1 :
1232 bank == 2 ? IRQ_PINT2 :
1233 IRQ_PINT3);
1234#elif defined(CONFIG_BF561)
1235 demux_irq = (irq >= IRQ_PF32 ? IRQ_PROG2_INTA :
1236 irq >= IRQ_PF16 ? IRQ_PROG1_INTA :
1237 IRQ_PROG0_INTA);
1238#elif defined(CONFIG_BF52x)
1239 demux_irq = (irq >= IRQ_PH0 ? IRQ_PORTH_INTA :
1240 irq >= IRQ_PG0 ? IRQ_PORTG_INTA :
1241 IRQ_PORTF_INTA);
1242#else
1243 demux_irq = irq;
1244#endif
1245 return IVG13 - PRIO_GPIODEMUX(demux_irq) + 1;
1246 }
1247
1248 /* The GPIO demux interrupt is given a lower priority
1249 * than the GPIO IRQs, so that its threaded handler
1250 * unmasks the interrupt line after the decoded IRQs
1251 * have been processed. */
1252 prio = PRIO_GPIODEMUX(irq);
1253 /* demux irq? */
1254 if (prio != -1)
1255 return IVG13 - prio;
1256
1257 for (ient = 0; ient < NR_PERI_INTS; ient++) {
1258 struct ivgx *ivg = ivg_table + ient;
1259 if (ivg->irqno == irq) {
1260 for (prio = 0; prio <= IVG13-IVG7; prio++) {
1261 if (ivg7_13[prio].ifirst <= ivg &&
1262 ivg7_13[prio].istop > ivg)
1263 return IVG7 - prio;
1264 }
1265 }
1266 }
1267
1268 return 0;
1269}
1270
1271/* Hw interrupts are disabled on entry (check SAVE_CONTEXT). */
1272#ifdef CONFIG_DO_IRQ_L1
1273__attribute__((l1_text))
1274#endif
1275asmlinkage int __ipipe_grab_irq(int vec, struct pt_regs *regs)
1276{
1277 struct ivgx *ivg_stop = ivg7_13[vec-IVG7].istop;
1278 struct ivgx *ivg = ivg7_13[vec-IVG7].ifirst;
1279 int irq;
1280
1281 if (likely(vec == EVT_IVTMR_P)) {
1282 irq = IRQ_CORETMR;
1283 goto handle_irq;
1284 }
1285
1286 SSYNC();
1287
1288#if defined(CONFIG_BF54x) || defined(CONFIG_BF52x) || defined(CONFIG_BF561)
1289 {
1290 unsigned long sic_status[3];
1291
1292 sic_status[0] = bfin_read_SIC_ISR0() & bfin_read_SIC_IMASK0();
1293 sic_status[1] = bfin_read_SIC_ISR1() & bfin_read_SIC_IMASK1();
1294#ifdef CONFIG_BF54x
1295 sic_status[2] = bfin_read_SIC_ISR2() & bfin_read_SIC_IMASK2();
1296#endif
1297 for (;; ivg++) {
1298 if (ivg >= ivg_stop) {
1299 atomic_inc(&num_spurious);
1300 return 0;
1301 }
1302 if (sic_status[(ivg->irqno - IVG7) / 32] & ivg->isrflag)
1303 break;
1304 }
1305 }
1306#else
1307 {
1308 unsigned long sic_status;
1309
1310 sic_status = bfin_read_SIC_IMASK() & bfin_read_SIC_ISR();
1311
1312 for (;; ivg++) {
1313 if (ivg >= ivg_stop) {
1314 atomic_inc(&num_spurious);
1315 return 0;
1316 } else if (sic_status & ivg->isrflag)
1317 break;
1318 }
1319 }
1320#endif
1321
1322 irq = ivg->irqno;
1323
1324 if (irq == IRQ_SYSTMR) {
1325 bfin_write_TIMER_STATUS(1); /* Latch TIMIL0 */
1326 /* This is basically what we need from the register frame. */
1327 __raw_get_cpu_var(__ipipe_tick_regs).ipend = regs->ipend;
1328 __raw_get_cpu_var(__ipipe_tick_regs).pc = regs->pc;
1329 if (!ipipe_root_domain_p)
1330 __raw_get_cpu_var(__ipipe_tick_regs).ipend |= 0x10;
1331 else
1332 __raw_get_cpu_var(__ipipe_tick_regs).ipend &= ~0x10;
1333 }
1334
1335handle_irq:
1336
1337 ipipe_trace_irq_entry(irq);
1338 __ipipe_handle_irq(irq, regs);
1339 ipipe_trace_irq_exit(irq);
1340
1341 if (ipipe_root_domain_p)
1342 return !test_bit(IPIPE_STALL_FLAG, &ipipe_root_cpudom_var(status));
1343
1344 return 0;
1345}
1346
1347#endif /* CONFIG_IPIPE */
diff --git a/arch/blackfin/mach-common/irqpanic.c b/arch/blackfin/mach-common/irqpanic.c
index 606ded9ff4e1..05004df0f78b 100644
--- a/arch/blackfin/mach-common/irqpanic.c
+++ b/arch/blackfin/mach-common/irqpanic.c
@@ -33,8 +33,6 @@
33#include <asm/traps.h> 33#include <asm/traps.h>
34#include <asm/blackfin.h> 34#include <asm/blackfin.h>
35 35
36#include "../oprofile/op_blackfin.h"
37
38#ifdef CONFIG_DEBUG_ICACHE_CHECK 36#ifdef CONFIG_DEBUG_ICACHE_CHECK
39#define L1_ICACHE_START 0xffa10000 37#define L1_ICACHE_START 0xffa10000
40#define L1_ICACHE_END 0xffa13fff 38#define L1_ICACHE_END 0xffa13fff
@@ -134,13 +132,3 @@ asmlinkage void irq_panic(int reason, struct pt_regs *regs)
134#endif 132#endif
135 133
136} 134}
137
138#ifdef CONFIG_HARDWARE_PM
139/*
140 * call the handler of Performance overflow
141 */
142asmlinkage void pm_overflow(int irq, struct pt_regs *regs)
143{
144 pm_overflow_handler(irq, regs);
145}
146#endif
diff --git a/arch/blackfin/mach-common/lock.S b/arch/blackfin/mach-common/lock.S
index 9daf01201e9f..6c5f5f0ea7fe 100644
--- a/arch/blackfin/mach-common/lock.S
+++ b/arch/blackfin/mach-common/lock.S
@@ -160,7 +160,7 @@ ENDPROC(_cache_grab_lock)
160 * R0 - Which way to be locked 160 * R0 - Which way to be locked
161 */ 161 */
162 162
163ENTRY(_cache_lock) 163ENTRY(_bfin_cache_lock)
164 164
165 [--SP]=( R7:0,P5:0 ); 165 [--SP]=( R7:0,P5:0 );
166 166
@@ -184,7 +184,7 @@ ENTRY(_cache_lock)
184 184
185 ( R7:0,P5:0 ) = [SP++]; 185 ( R7:0,P5:0 ) = [SP++];
186 RTS; 186 RTS;
187ENDPROC(_cache_lock) 187ENDPROC(_bfin_cache_lock)
188 188
189/* Invalidate the Entire Instruction cache by 189/* Invalidate the Entire Instruction cache by
190 * disabling IMC bit 190 * disabling IMC bit
diff --git a/arch/blackfin/mach-common/pm.c b/arch/blackfin/mach-common/pm.c
index e28c6af1f415..d3d70fd67c16 100644
--- a/arch/blackfin/mach-common/pm.c
+++ b/arch/blackfin/mach-common/pm.c
@@ -71,7 +71,7 @@ void bfin_pm_suspend_standby_enter(void)
71 gpio_pm_wakeup_request(CONFIG_PM_WAKEUP_GPIO_NUMBER, WAKEUP_TYPE); 71 gpio_pm_wakeup_request(CONFIG_PM_WAKEUP_GPIO_NUMBER, WAKEUP_TYPE);
72#endif 72#endif
73 73
74 local_irq_save(flags); 74 local_irq_save_hw(flags);
75 bfin_pm_standby_setup(); 75 bfin_pm_standby_setup();
76 76
77#ifdef CONFIG_PM_BFIN_SLEEP_DEEPER 77#ifdef CONFIG_PM_BFIN_SLEEP_DEEPER
@@ -82,15 +82,19 @@ void bfin_pm_suspend_standby_enter(void)
82 82
83 bfin_pm_standby_restore(); 83 bfin_pm_standby_restore();
84 84
85#if defined(CONFIG_BF54x) || defined(CONFIG_BF52x) || defined(CONFIG_BF561) 85#if defined(CONFIG_BF54x) || defined(CONFIG_BF52x) || defined(CONFIG_BF561) || \
86 defined(CONFIG_BF538) || defined(CONFIG_BF539) || defined(CONFIG_BF51x)
86 bfin_write_SIC_IWR0(IWR_DISABLE_ALL); 87 bfin_write_SIC_IWR0(IWR_DISABLE_ALL);
87#if defined(CONFIG_BF52x) 88#if defined(CONFIG_BF52x) || defined(CONFIG_BF51x)
88 /* BF52x system reset does not properly reset SIC_IWR1 which 89 /* BF52x system reset does not properly reset SIC_IWR1 which
89 * will screw up the bootrom as it relies on MDMA0/1 waking it 90 * will screw up the bootrom as it relies on MDMA0/1 waking it
90 * up from IDLE instructions. See this report for more info: 91 * up from IDLE instructions. See this report for more info:
91 * http://blackfin.uclinux.org/gf/tracker/4323 92 * http://blackfin.uclinux.org/gf/tracker/4323
92 */ 93 */
93 bfin_write_SIC_IWR1(IWR_ENABLE(10) | IWR_ENABLE(11)); 94 if (ANOMALY_05000435)
95 bfin_write_SIC_IWR1(IWR_ENABLE(10) | IWR_ENABLE(11));
96 else
97 bfin_write_SIC_IWR1(IWR_DISABLE_ALL);
94#else 98#else
95 bfin_write_SIC_IWR1(IWR_DISABLE_ALL); 99 bfin_write_SIC_IWR1(IWR_DISABLE_ALL);
96#endif 100#endif
@@ -101,7 +105,7 @@ void bfin_pm_suspend_standby_enter(void)
101 bfin_write_SIC_IWR(IWR_DISABLE_ALL); 105 bfin_write_SIC_IWR(IWR_DISABLE_ALL);
102#endif 106#endif
103 107
104 local_irq_restore(flags); 108 local_irq_restore_hw(flags);
105} 109}
106 110
107int bf53x_suspend_l1_mem(unsigned char *memptr) 111int bf53x_suspend_l1_mem(unsigned char *memptr)
@@ -245,12 +249,12 @@ int bfin_pm_suspend_mem_enter(void)
245 wakeup |= GPWE; 249 wakeup |= GPWE;
246#endif 250#endif
247 251
248 local_irq_save(flags); 252 local_irq_save_hw(flags);
249 253
250 ret = blackfin_dma_suspend(); 254 ret = blackfin_dma_suspend();
251 255
252 if (ret) { 256 if (ret) {
253 local_irq_restore(flags); 257 local_irq_restore_hw(flags);
254 kfree(memptr); 258 kfree(memptr);
255 return ret; 259 return ret;
256 } 260 }
@@ -271,7 +275,7 @@ int bfin_pm_suspend_mem_enter(void)
271 bfin_gpio_pm_hibernate_restore(); 275 bfin_gpio_pm_hibernate_restore();
272 blackfin_dma_resume(); 276 blackfin_dma_resume();
273 277
274 local_irq_restore(flags); 278 local_irq_restore_hw(flags);
275 kfree(memptr); 279 kfree(memptr);
276 280
277 return 0; 281 return 0;
diff --git a/arch/blackfin/mach-common/smp.c b/arch/blackfin/mach-common/smp.c
new file mode 100644
index 000000000000..77c992847094
--- /dev/null
+++ b/arch/blackfin/mach-common/smp.c
@@ -0,0 +1,476 @@
1/*
2 * File: arch/blackfin/kernel/smp.c
3 * Author: Philippe Gerum <rpm@xenomai.org>
4 * IPI management based on arch/arm/kernel/smp.c.
5 *
6 * Copyright 2007 Analog Devices Inc.
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, see the file COPYING, or write
20 * to the Free Software Foundation, Inc.,
21 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 */
23
24#include <linux/module.h>
25#include <linux/delay.h>
26#include <linux/init.h>
27#include <linux/spinlock.h>
28#include <linux/sched.h>
29#include <linux/interrupt.h>
30#include <linux/cache.h>
31#include <linux/profile.h>
32#include <linux/errno.h>
33#include <linux/mm.h>
34#include <linux/cpu.h>
35#include <linux/smp.h>
36#include <linux/seq_file.h>
37#include <linux/irq.h>
38#include <asm/atomic.h>
39#include <asm/cacheflush.h>
40#include <asm/mmu_context.h>
41#include <asm/pgtable.h>
42#include <asm/pgalloc.h>
43#include <asm/processor.h>
44#include <asm/ptrace.h>
45#include <asm/cpu.h>
46#include <linux/err.h>
47
48struct corelock_slot corelock __attribute__ ((__section__(".l2.bss")));
49
50void __cpuinitdata *init_retx_coreb, *init_saved_retx_coreb,
51 *init_saved_seqstat_coreb, *init_saved_icplb_fault_addr_coreb,
52 *init_saved_dcplb_fault_addr_coreb;
53
54cpumask_t cpu_possible_map;
55EXPORT_SYMBOL(cpu_possible_map);
56
57cpumask_t cpu_online_map;
58EXPORT_SYMBOL(cpu_online_map);
59
60#define BFIN_IPI_RESCHEDULE 0
61#define BFIN_IPI_CALL_FUNC 1
62#define BFIN_IPI_CPU_STOP 2
63
64struct blackfin_flush_data {
65 unsigned long start;
66 unsigned long end;
67};
68
69void *secondary_stack;
70
71
72struct smp_call_struct {
73 void (*func)(void *info);
74 void *info;
75 int wait;
76 cpumask_t pending;
77 cpumask_t waitmask;
78};
79
80static struct blackfin_flush_data smp_flush_data;
81
82static DEFINE_SPINLOCK(stop_lock);
83
84struct ipi_message {
85 struct list_head list;
86 unsigned long type;
87 struct smp_call_struct call_struct;
88};
89
90struct ipi_message_queue {
91 struct list_head head;
92 spinlock_t lock;
93 unsigned long count;
94};
95
96static DEFINE_PER_CPU(struct ipi_message_queue, ipi_msg_queue);
97
98static void ipi_cpu_stop(unsigned int cpu)
99{
100 spin_lock(&stop_lock);
101 printk(KERN_CRIT "CPU%u: stopping\n", cpu);
102 dump_stack();
103 spin_unlock(&stop_lock);
104
105 cpu_clear(cpu, cpu_online_map);
106
107 local_irq_disable();
108
109 while (1)
110 SSYNC();
111}
112
113static void ipi_flush_icache(void *info)
114{
115 struct blackfin_flush_data *fdata = info;
116
117 /* Invalidate the memory holding the bounds of the flushed region. */
118 blackfin_dcache_invalidate_range((unsigned long)fdata,
119 (unsigned long)fdata + sizeof(*fdata));
120
121 blackfin_icache_flush_range(fdata->start, fdata->end);
122}
123
124static void ipi_call_function(unsigned int cpu, struct ipi_message *msg)
125{
126 int wait;
127 void (*func)(void *info);
128 void *info;
129 func = msg->call_struct.func;
130 info = msg->call_struct.info;
131 wait = msg->call_struct.wait;
132 cpu_clear(cpu, msg->call_struct.pending);
133 func(info);
134 if (wait)
135 cpu_clear(cpu, msg->call_struct.waitmask);
136 else
137 kfree(msg);
138}
139
140static irqreturn_t ipi_handler(int irq, void *dev_instance)
141{
142 struct ipi_message *msg, *mg;
143 struct ipi_message_queue *msg_queue;
144 unsigned int cpu = smp_processor_id();
145
146 platform_clear_ipi(cpu);
147
148 msg_queue = &__get_cpu_var(ipi_msg_queue);
149 msg_queue->count++;
150
151 spin_lock(&msg_queue->lock);
152 list_for_each_entry_safe(msg, mg, &msg_queue->head, list) {
153 list_del(&msg->list);
154 switch (msg->type) {
155 case BFIN_IPI_RESCHEDULE:
156 /* That's the easiest one; leave it to
157 * return_from_int. */
158 kfree(msg);
159 break;
160 case BFIN_IPI_CALL_FUNC:
161 ipi_call_function(cpu, msg);
162 break;
163 case BFIN_IPI_CPU_STOP:
164 ipi_cpu_stop(cpu);
165 kfree(msg);
166 break;
167 default:
168 printk(KERN_CRIT "CPU%u: Unknown IPI message \
169 0x%lx\n", cpu, msg->type);
170 kfree(msg);
171 break;
172 }
173 }
174 spin_unlock(&msg_queue->lock);
175 return IRQ_HANDLED;
176}
177
178static void ipi_queue_init(void)
179{
180 unsigned int cpu;
181 struct ipi_message_queue *msg_queue;
182 for_each_possible_cpu(cpu) {
183 msg_queue = &per_cpu(ipi_msg_queue, cpu);
184 INIT_LIST_HEAD(&msg_queue->head);
185 spin_lock_init(&msg_queue->lock);
186 msg_queue->count = 0;
187 }
188}
189
190int smp_call_function(void (*func)(void *info), void *info, int wait)
191{
192 unsigned int cpu;
193 cpumask_t callmap;
194 unsigned long flags;
195 struct ipi_message_queue *msg_queue;
196 struct ipi_message *msg;
197
198 callmap = cpu_online_map;
199 cpu_clear(smp_processor_id(), callmap);
200 if (cpus_empty(callmap))
201 return 0;
202
203 msg = kmalloc(sizeof(*msg), GFP_ATOMIC);
204 INIT_LIST_HEAD(&msg->list);
205 msg->call_struct.func = func;
206 msg->call_struct.info = info;
207 msg->call_struct.wait = wait;
208 msg->call_struct.pending = callmap;
209 msg->call_struct.waitmask = callmap;
210 msg->type = BFIN_IPI_CALL_FUNC;
211
212 for_each_cpu_mask(cpu, callmap) {
213 msg_queue = &per_cpu(ipi_msg_queue, cpu);
214 spin_lock_irqsave(&msg_queue->lock, flags);
215 list_add(&msg->list, &msg_queue->head);
216 spin_unlock_irqrestore(&msg_queue->lock, flags);
217 platform_send_ipi_cpu(cpu);
218 }
219 if (wait) {
220 while (!cpus_empty(msg->call_struct.waitmask))
221 blackfin_dcache_invalidate_range(
222 (unsigned long)(&msg->call_struct.waitmask),
223 (unsigned long)(&msg->call_struct.waitmask));
224 kfree(msg);
225 }
226 return 0;
227}
228EXPORT_SYMBOL_GPL(smp_call_function);
229
230int smp_call_function_single(int cpuid, void (*func) (void *info), void *info,
231 int wait)
232{
233 unsigned int cpu = cpuid;
234 cpumask_t callmap;
235 unsigned long flags;
236 struct ipi_message_queue *msg_queue;
237 struct ipi_message *msg;
238
239 if (cpu_is_offline(cpu))
240 return 0;
241 cpus_clear(callmap);
242 cpu_set(cpu, callmap);
243
244 msg = kmalloc(sizeof(*msg), GFP_ATOMIC);
245 INIT_LIST_HEAD(&msg->list);
246 msg->call_struct.func = func;
247 msg->call_struct.info = info;
248 msg->call_struct.wait = wait;
249 msg->call_struct.pending = callmap;
250 msg->call_struct.waitmask = callmap;
251 msg->type = BFIN_IPI_CALL_FUNC;
252
253 msg_queue = &per_cpu(ipi_msg_queue, cpu);
254 spin_lock_irqsave(&msg_queue->lock, flags);
255 list_add(&msg->list, &msg_queue->head);
256 spin_unlock_irqrestore(&msg_queue->lock, flags);
257 platform_send_ipi_cpu(cpu);
258
259 if (wait) {
260 while (!cpus_empty(msg->call_struct.waitmask))
261 blackfin_dcache_invalidate_range(
262 (unsigned long)(&msg->call_struct.waitmask),
263 (unsigned long)(&msg->call_struct.waitmask));
264 kfree(msg);
265 }
266 return 0;
267}
268EXPORT_SYMBOL_GPL(smp_call_function_single);
269
270void smp_send_reschedule(int cpu)
271{
272 unsigned long flags;
273 struct ipi_message_queue *msg_queue;
274 struct ipi_message *msg;
275
276 if (cpu_is_offline(cpu))
277 return;
278
279 msg = kmalloc(sizeof(*msg), GFP_ATOMIC);
280 memset(msg, 0, sizeof(msg));
281 INIT_LIST_HEAD(&msg->list);
282 msg->type = BFIN_IPI_RESCHEDULE;
283
284 msg_queue = &per_cpu(ipi_msg_queue, cpu);
285 spin_lock_irqsave(&msg_queue->lock, flags);
286 list_add(&msg->list, &msg_queue->head);
287 spin_unlock_irqrestore(&msg_queue->lock, flags);
288 platform_send_ipi_cpu(cpu);
289
290 return;
291}
292
293void smp_send_stop(void)
294{
295 unsigned int cpu;
296 cpumask_t callmap;
297 unsigned long flags;
298 struct ipi_message_queue *msg_queue;
299 struct ipi_message *msg;
300
301 callmap = cpu_online_map;
302 cpu_clear(smp_processor_id(), callmap);
303 if (cpus_empty(callmap))
304 return;
305
306 msg = kmalloc(sizeof(*msg), GFP_ATOMIC);
307 memset(msg, 0, sizeof(msg));
308 INIT_LIST_HEAD(&msg->list);
309 msg->type = BFIN_IPI_CPU_STOP;
310
311 for_each_cpu_mask(cpu, callmap) {
312 msg_queue = &per_cpu(ipi_msg_queue, cpu);
313 spin_lock_irqsave(&msg_queue->lock, flags);
314 list_add(&msg->list, &msg_queue->head);
315 spin_unlock_irqrestore(&msg_queue->lock, flags);
316 platform_send_ipi_cpu(cpu);
317 }
318 return;
319}
320
321int __cpuinit __cpu_up(unsigned int cpu)
322{
323 struct task_struct *idle;
324 int ret;
325
326 idle = fork_idle(cpu);
327 if (IS_ERR(idle)) {
328 printk(KERN_ERR "CPU%u: fork() failed\n", cpu);
329 return PTR_ERR(idle);
330 }
331
332 secondary_stack = task_stack_page(idle) + THREAD_SIZE;
333 smp_wmb();
334
335 ret = platform_boot_secondary(cpu, idle);
336
337 if (ret) {
338 cpu_clear(cpu, cpu_present_map);
339 printk(KERN_CRIT "CPU%u: processor failed to boot (%d)\n", cpu, ret);
340 free_task(idle);
341 } else
342 cpu_set(cpu, cpu_online_map);
343
344 secondary_stack = NULL;
345
346 return ret;
347}
348
349static void __cpuinit setup_secondary(unsigned int cpu)
350{
351#if !(defined(CONFIG_TICK_SOURCE_SYSTMR0) || defined(CONFIG_IPIPE))
352 struct irq_desc *timer_desc;
353#endif
354 unsigned long ilat;
355
356 bfin_write_IMASK(0);
357 CSYNC();
358 ilat = bfin_read_ILAT();
359 CSYNC();
360 bfin_write_ILAT(ilat);
361 CSYNC();
362
363 /* Reserve the PDA space for the secondary CPU. */
364 reserve_pda();
365
366 /* Enable interrupt levels IVG7-15. IARs have been already
367 * programmed by the boot CPU. */
368 bfin_irq_flags |= IMASK_IVG15 |
369 IMASK_IVG14 | IMASK_IVG13 | IMASK_IVG12 | IMASK_IVG11 |
370 IMASK_IVG10 | IMASK_IVG9 | IMASK_IVG8 | IMASK_IVG7 | IMASK_IVGHW;
371
372#if defined(CONFIG_TICK_SOURCE_SYSTMR0) || defined(CONFIG_IPIPE)
373 /* Power down the core timer, just to play safe. */
374 bfin_write_TCNTL(0);
375
376 /* system timer0 has been setup by CoreA. */
377#else
378 timer_desc = irq_desc + IRQ_CORETMR;
379 setup_core_timer();
380 timer_desc->chip->enable(IRQ_CORETMR);
381#endif
382}
383
384void __cpuinit secondary_start_kernel(void)
385{
386 unsigned int cpu = smp_processor_id();
387 struct mm_struct *mm = &init_mm;
388
389 if (_bfin_swrst & SWRST_DBL_FAULT_B) {
390 printk(KERN_EMERG "CoreB Recovering from DOUBLE FAULT event\n");
391#ifdef CONFIG_DEBUG_DOUBLEFAULT
392 printk(KERN_EMERG " While handling exception (EXCAUSE = 0x%x) at %pF\n",
393 (int)init_saved_seqstat_coreb & SEQSTAT_EXCAUSE, init_saved_retx_coreb);
394 printk(KERN_NOTICE " DCPLB_FAULT_ADDR: %pF\n", init_saved_dcplb_fault_addr_coreb);
395 printk(KERN_NOTICE " ICPLB_FAULT_ADDR: %pF\n", init_saved_icplb_fault_addr_coreb);
396#endif
397 printk(KERN_NOTICE " The instruction at %pF caused a double exception\n",
398 init_retx_coreb);
399 }
400
401 /*
402 * We want the D-cache to be enabled early, in case the atomic
403 * support code emulates cache coherence (see
404 * __ARCH_SYNC_CORE_DCACHE).
405 */
406 init_exception_vectors();
407
408 bfin_setup_caches(cpu);
409
410 local_irq_disable();
411
412 /* Attach the new idle task to the global mm. */
413 atomic_inc(&mm->mm_users);
414 atomic_inc(&mm->mm_count);
415 current->active_mm = mm;
416 BUG_ON(current->mm); /* Can't be, but better be safe than sorry. */
417
418 preempt_disable();
419
420 setup_secondary(cpu);
421
422 local_irq_enable();
423
424 platform_secondary_init(cpu);
425
426 cpu_idle();
427}
428
429void __init smp_prepare_boot_cpu(void)
430{
431}
432
433void __init smp_prepare_cpus(unsigned int max_cpus)
434{
435 platform_prepare_cpus(max_cpus);
436 ipi_queue_init();
437 platform_request_ipi(&ipi_handler);
438}
439
440void __init smp_cpus_done(unsigned int max_cpus)
441{
442 unsigned long bogosum = 0;
443 unsigned int cpu;
444
445 for_each_online_cpu(cpu)
446 bogosum += per_cpu(cpu_data, cpu).loops_per_jiffy;
447
448 printk(KERN_INFO "SMP: Total of %d processors activated "
449 "(%lu.%02lu BogoMIPS).\n",
450 num_online_cpus(),
451 bogosum / (500000/HZ),
452 (bogosum / (5000/HZ)) % 100);
453}
454
455void smp_icache_flush_range_others(unsigned long start, unsigned long end)
456{
457 smp_flush_data.start = start;
458 smp_flush_data.end = end;
459
460 if (smp_call_function(&ipi_flush_icache, &smp_flush_data, 1))
461 printk(KERN_WARNING "SMP: failed to run I-cache flush request on other CPUs\n");
462}
463EXPORT_SYMBOL_GPL(smp_icache_flush_range_others);
464
465#ifdef __ARCH_SYNC_CORE_DCACHE
466unsigned long barrier_mask __attribute__ ((__section__(".l2.bss")));
467
468void resync_core_dcache(void)
469{
470 unsigned int cpu = get_cpu();
471 blackfin_invalidate_entire_dcache();
472 ++per_cpu(cpu_data, cpu).dcache_invld_count;
473 put_cpu();
474}
475EXPORT_SYMBOL(resync_core_dcache);
476#endif
diff --git a/arch/blackfin/mm/init.c b/arch/blackfin/mm/init.c
index bc240abb8745..d0532b72bba5 100644
--- a/arch/blackfin/mm/init.c
+++ b/arch/blackfin/mm/init.c
@@ -31,7 +31,8 @@
31#include <linux/bootmem.h> 31#include <linux/bootmem.h>
32#include <linux/uaccess.h> 32#include <linux/uaccess.h>
33#include <asm/bfin-global.h> 33#include <asm/bfin-global.h>
34#include <asm/l1layout.h> 34#include <asm/pda.h>
35#include <asm/cplbinit.h>
35#include "blackfin_sram.h" 36#include "blackfin_sram.h"
36 37
37/* 38/*
@@ -53,6 +54,11 @@ static unsigned long empty_bad_page;
53 54
54unsigned long empty_zero_page; 55unsigned long empty_zero_page;
55 56
57extern unsigned long exception_stack[NR_CPUS][1024];
58
59struct blackfin_pda cpu_pda[NR_CPUS];
60EXPORT_SYMBOL(cpu_pda);
61
56/* 62/*
57 * paging_init() continues the virtual memory environment setup which 63 * paging_init() continues the virtual memory environment setup which
58 * was begun by the code in arch/head.S. 64 * was begun by the code in arch/head.S.
@@ -98,6 +104,32 @@ void __init paging_init(void)
98 } 104 }
99} 105}
100 106
107asmlinkage void init_pda(void)
108{
109 unsigned int cpu = raw_smp_processor_id();
110
111 /* Initialize the PDA fields holding references to other parts
112 of the memory. The content of such memory is still
113 undefined at the time of the call, we are only setting up
114 valid pointers to it. */
115 memset(&cpu_pda[cpu], 0, sizeof(cpu_pda[cpu]));
116
117 cpu_pda[0].next = &cpu_pda[1];
118 cpu_pda[1].next = &cpu_pda[0];
119
120 cpu_pda[cpu].ex_stack = exception_stack[cpu + 1];
121
122#ifdef CONFIG_SMP
123 cpu_pda[cpu].imask = 0x1f;
124#endif
125}
126
127void __cpuinit reserve_pda(void)
128{
129 printk(KERN_INFO "PDA for CPU%u reserved at %p\n", smp_processor_id(),
130 &cpu_pda[smp_processor_id()]);
131}
132
101void __init mem_init(void) 133void __init mem_init(void)
102{ 134{
103 unsigned int codek = 0, datak = 0, initk = 0; 135 unsigned int codek = 0, datak = 0, initk = 0;
@@ -141,21 +173,13 @@ void __init mem_init(void)
141 173
142static int __init sram_init(void) 174static int __init sram_init(void)
143{ 175{
144 unsigned long tmp;
145
146 /* Initialize the blackfin L1 Memory. */ 176 /* Initialize the blackfin L1 Memory. */
147 bfin_sram_init(); 177 bfin_sram_init();
148 178
149 /* Allocate this once; never free it. We assume this gives us a 179 /* Reserve the PDA space for the boot CPU right after we
150 pointer to the start of L1 scratchpad memory; panic if it 180 * initialized the scratch memory allocator.
151 doesn't. */ 181 */
152 tmp = (unsigned long)l1sram_alloc(sizeof(struct l1_scratch_task_info)); 182 reserve_pda();
153 if (tmp != (unsigned long)L1_SCRATCH_TASK_INFO) {
154 printk(KERN_EMERG "mem_init(): Did not get the right address from l1sram_alloc: %08lx != %08lx\n",
155 tmp, (unsigned long)L1_SCRATCH_TASK_INFO);
156 panic("No L1, time to give up\n");
157 }
158
159 return 0; 183 return 0;
160} 184}
161pure_initcall(sram_init); 185pure_initcall(sram_init);
diff --git a/arch/blackfin/mm/sram-alloc.c b/arch/blackfin/mm/sram-alloc.c
index cc6f336e7313..834cab7438a8 100644
--- a/arch/blackfin/mm/sram-alloc.c
+++ b/arch/blackfin/mm/sram-alloc.c
@@ -39,10 +39,13 @@
39#include <linux/spinlock.h> 39#include <linux/spinlock.h>
40#include <linux/rtc.h> 40#include <linux/rtc.h>
41#include <asm/blackfin.h> 41#include <asm/blackfin.h>
42#include <asm/mem_map.h>
42#include "blackfin_sram.h" 43#include "blackfin_sram.h"
43 44
44static spinlock_t l1sram_lock, l1_data_sram_lock, l1_inst_sram_lock; 45static DEFINE_PER_CPU(spinlock_t, l1sram_lock) ____cacheline_aligned_in_smp;
45static spinlock_t l2_sram_lock; 46static DEFINE_PER_CPU(spinlock_t, l1_data_sram_lock) ____cacheline_aligned_in_smp;
47static DEFINE_PER_CPU(spinlock_t, l1_inst_sram_lock) ____cacheline_aligned_in_smp;
48static spinlock_t l2_sram_lock ____cacheline_aligned_in_smp;
46 49
47/* the data structure for L1 scratchpad and DATA SRAM */ 50/* the data structure for L1 scratchpad and DATA SRAM */
48struct sram_piece { 51struct sram_piece {
@@ -52,18 +55,22 @@ struct sram_piece {
52 struct sram_piece *next; 55 struct sram_piece *next;
53}; 56};
54 57
55static struct sram_piece free_l1_ssram_head, used_l1_ssram_head; 58static DEFINE_PER_CPU(struct sram_piece, free_l1_ssram_head);
59static DEFINE_PER_CPU(struct sram_piece, used_l1_ssram_head);
56 60
57#if L1_DATA_A_LENGTH != 0 61#if L1_DATA_A_LENGTH != 0
58static struct sram_piece free_l1_data_A_sram_head, used_l1_data_A_sram_head; 62static DEFINE_PER_CPU(struct sram_piece, free_l1_data_A_sram_head);
63static DEFINE_PER_CPU(struct sram_piece, used_l1_data_A_sram_head);
59#endif 64#endif
60 65
61#if L1_DATA_B_LENGTH != 0 66#if L1_DATA_B_LENGTH != 0
62static struct sram_piece free_l1_data_B_sram_head, used_l1_data_B_sram_head; 67static DEFINE_PER_CPU(struct sram_piece, free_l1_data_B_sram_head);
68static DEFINE_PER_CPU(struct sram_piece, used_l1_data_B_sram_head);
63#endif 69#endif
64 70
65#if L1_CODE_LENGTH != 0 71#if L1_CODE_LENGTH != 0
66static struct sram_piece free_l1_inst_sram_head, used_l1_inst_sram_head; 72static DEFINE_PER_CPU(struct sram_piece, free_l1_inst_sram_head);
73static DEFINE_PER_CPU(struct sram_piece, used_l1_inst_sram_head);
67#endif 74#endif
68 75
69#if L2_LENGTH != 0 76#if L2_LENGTH != 0
@@ -75,102 +82,117 @@ static struct kmem_cache *sram_piece_cache;
75/* L1 Scratchpad SRAM initialization function */ 82/* L1 Scratchpad SRAM initialization function */
76static void __init l1sram_init(void) 83static void __init l1sram_init(void)
77{ 84{
78 free_l1_ssram_head.next = 85 unsigned int cpu;
79 kmem_cache_alloc(sram_piece_cache, GFP_KERNEL); 86 for (cpu = 0; cpu < num_possible_cpus(); ++cpu) {
80 if (!free_l1_ssram_head.next) { 87 per_cpu(free_l1_ssram_head, cpu).next =
81 printk(KERN_INFO "Failed to initialize Scratchpad data SRAM\n"); 88 kmem_cache_alloc(sram_piece_cache, GFP_KERNEL);
82 return; 89 if (!per_cpu(free_l1_ssram_head, cpu).next) {
90 printk(KERN_INFO "Fail to initialize Scratchpad data SRAM.\n");
91 return;
92 }
93
94 per_cpu(free_l1_ssram_head, cpu).next->paddr = (void *)get_l1_scratch_start_cpu(cpu);
95 per_cpu(free_l1_ssram_head, cpu).next->size = L1_SCRATCH_LENGTH;
96 per_cpu(free_l1_ssram_head, cpu).next->pid = 0;
97 per_cpu(free_l1_ssram_head, cpu).next->next = NULL;
98
99 per_cpu(used_l1_ssram_head, cpu).next = NULL;
100
101 /* mutex initialize */
102 spin_lock_init(&per_cpu(l1sram_lock, cpu));
103 printk(KERN_INFO "Blackfin Scratchpad data SRAM: %d KB\n",
104 L1_SCRATCH_LENGTH >> 10);
83 } 105 }
84
85 free_l1_ssram_head.next->paddr = (void *)L1_SCRATCH_START;
86 free_l1_ssram_head.next->size = L1_SCRATCH_LENGTH;
87 free_l1_ssram_head.next->pid = 0;
88 free_l1_ssram_head.next->next = NULL;
89
90 used_l1_ssram_head.next = NULL;
91
92 /* mutex initialize */
93 spin_lock_init(&l1sram_lock);
94
95 printk(KERN_INFO "Blackfin Scratchpad data SRAM: %d KB\n",
96 L1_SCRATCH_LENGTH >> 10);
97} 106}
98 107
99static void __init l1_data_sram_init(void) 108static void __init l1_data_sram_init(void)
100{ 109{
110#if L1_DATA_A_LENGTH != 0 || L1_DATA_B_LENGTH != 0
111 unsigned int cpu;
112#endif
101#if L1_DATA_A_LENGTH != 0 113#if L1_DATA_A_LENGTH != 0
102 free_l1_data_A_sram_head.next = 114 for (cpu = 0; cpu < num_possible_cpus(); ++cpu) {
103 kmem_cache_alloc(sram_piece_cache, GFP_KERNEL); 115 per_cpu(free_l1_data_A_sram_head, cpu).next =
104 if (!free_l1_data_A_sram_head.next) { 116 kmem_cache_alloc(sram_piece_cache, GFP_KERNEL);
105 printk(KERN_INFO "Failed to initialize L1 Data A SRAM\n"); 117 if (!per_cpu(free_l1_data_A_sram_head, cpu).next) {
106 return; 118 printk(KERN_INFO "Fail to initialize L1 Data A SRAM.\n");
119 return;
120 }
121
122 per_cpu(free_l1_data_A_sram_head, cpu).next->paddr =
123 (void *)get_l1_data_a_start_cpu(cpu) + (_ebss_l1 - _sdata_l1);
124 per_cpu(free_l1_data_A_sram_head, cpu).next->size =
125 L1_DATA_A_LENGTH - (_ebss_l1 - _sdata_l1);
126 per_cpu(free_l1_data_A_sram_head, cpu).next->pid = 0;
127 per_cpu(free_l1_data_A_sram_head, cpu).next->next = NULL;
128
129 per_cpu(used_l1_data_A_sram_head, cpu).next = NULL;
130
131 printk(KERN_INFO "Blackfin L1 Data A SRAM: %d KB (%d KB free)\n",
132 L1_DATA_A_LENGTH >> 10,
133 per_cpu(free_l1_data_A_sram_head, cpu).next->size >> 10);
107 } 134 }
108
109 free_l1_data_A_sram_head.next->paddr =
110 (void *)L1_DATA_A_START + (_ebss_l1 - _sdata_l1);
111 free_l1_data_A_sram_head.next->size =
112 L1_DATA_A_LENGTH - (_ebss_l1 - _sdata_l1);
113 free_l1_data_A_sram_head.next->pid = 0;
114 free_l1_data_A_sram_head.next->next = NULL;
115
116 used_l1_data_A_sram_head.next = NULL;
117
118 printk(KERN_INFO "Blackfin L1 Data A SRAM: %d KB (%d KB free)\n",
119 L1_DATA_A_LENGTH >> 10,
120 free_l1_data_A_sram_head.next->size >> 10);
121#endif 135#endif
122#if L1_DATA_B_LENGTH != 0 136#if L1_DATA_B_LENGTH != 0
123 free_l1_data_B_sram_head.next = 137 for (cpu = 0; cpu < num_possible_cpus(); ++cpu) {
124 kmem_cache_alloc(sram_piece_cache, GFP_KERNEL); 138 per_cpu(free_l1_data_B_sram_head, cpu).next =
125 if (!free_l1_data_B_sram_head.next) { 139 kmem_cache_alloc(sram_piece_cache, GFP_KERNEL);
126 printk(KERN_INFO "Failed to initialize L1 Data B SRAM\n"); 140 if (!per_cpu(free_l1_data_B_sram_head, cpu).next) {
127 return; 141 printk(KERN_INFO "Fail to initialize L1 Data B SRAM.\n");
142 return;
143 }
144
145 per_cpu(free_l1_data_B_sram_head, cpu).next->paddr =
146 (void *)get_l1_data_b_start_cpu(cpu) + (_ebss_b_l1 - _sdata_b_l1);
147 per_cpu(free_l1_data_B_sram_head, cpu).next->size =
148 L1_DATA_B_LENGTH - (_ebss_b_l1 - _sdata_b_l1);
149 per_cpu(free_l1_data_B_sram_head, cpu).next->pid = 0;
150 per_cpu(free_l1_data_B_sram_head, cpu).next->next = NULL;
151
152 per_cpu(used_l1_data_B_sram_head, cpu).next = NULL;
153
154 printk(KERN_INFO "Blackfin L1 Data B SRAM: %d KB (%d KB free)\n",
155 L1_DATA_B_LENGTH >> 10,
156 per_cpu(free_l1_data_B_sram_head, cpu).next->size >> 10);
157 /* mutex initialize */
128 } 158 }
129
130 free_l1_data_B_sram_head.next->paddr =
131 (void *)L1_DATA_B_START + (_ebss_b_l1 - _sdata_b_l1);
132 free_l1_data_B_sram_head.next->size =
133 L1_DATA_B_LENGTH - (_ebss_b_l1 - _sdata_b_l1);
134 free_l1_data_B_sram_head.next->pid = 0;
135 free_l1_data_B_sram_head.next->next = NULL;
136
137 used_l1_data_B_sram_head.next = NULL;
138
139 printk(KERN_INFO "Blackfin L1 Data B SRAM: %d KB (%d KB free)\n",
140 L1_DATA_B_LENGTH >> 10,
141 free_l1_data_B_sram_head.next->size >> 10);
142#endif 159#endif
143 160
144 /* mutex initialize */ 161#if L1_DATA_A_LENGTH != 0 || L1_DATA_B_LENGTH != 0
145 spin_lock_init(&l1_data_sram_lock); 162 for (cpu = 0; cpu < num_possible_cpus(); ++cpu)
163 spin_lock_init(&per_cpu(l1_data_sram_lock, cpu));
164#endif
146} 165}
147 166
148static void __init l1_inst_sram_init(void) 167static void __init l1_inst_sram_init(void)
149{ 168{
150#if L1_CODE_LENGTH != 0 169#if L1_CODE_LENGTH != 0
151 free_l1_inst_sram_head.next = 170 unsigned int cpu;
152 kmem_cache_alloc(sram_piece_cache, GFP_KERNEL); 171 for (cpu = 0; cpu < num_possible_cpus(); ++cpu) {
153 if (!free_l1_inst_sram_head.next) { 172 per_cpu(free_l1_inst_sram_head, cpu).next =
154 printk(KERN_INFO "Failed to initialize L1 Instruction SRAM\n"); 173 kmem_cache_alloc(sram_piece_cache, GFP_KERNEL);
155 return; 174 if (!per_cpu(free_l1_inst_sram_head, cpu).next) {
175 printk(KERN_INFO "Failed to initialize L1 Instruction SRAM\n");
176 return;
177 }
178
179 per_cpu(free_l1_inst_sram_head, cpu).next->paddr =
180 (void *)get_l1_code_start_cpu(cpu) + (_etext_l1 - _stext_l1);
181 per_cpu(free_l1_inst_sram_head, cpu).next->size =
182 L1_CODE_LENGTH - (_etext_l1 - _stext_l1);
183 per_cpu(free_l1_inst_sram_head, cpu).next->pid = 0;
184 per_cpu(free_l1_inst_sram_head, cpu).next->next = NULL;
185
186 per_cpu(used_l1_inst_sram_head, cpu).next = NULL;
187
188 printk(KERN_INFO "Blackfin L1 Instruction SRAM: %d KB (%d KB free)\n",
189 L1_CODE_LENGTH >> 10,
190 per_cpu(free_l1_inst_sram_head, cpu).next->size >> 10);
191
192 /* mutex initialize */
193 spin_lock_init(&per_cpu(l1_inst_sram_lock, cpu));
156 } 194 }
157
158 free_l1_inst_sram_head.next->paddr =
159 (void *)L1_CODE_START + (_etext_l1 - _stext_l1);
160 free_l1_inst_sram_head.next->size =
161 L1_CODE_LENGTH - (_etext_l1 - _stext_l1);
162 free_l1_inst_sram_head.next->pid = 0;
163 free_l1_inst_sram_head.next->next = NULL;
164
165 used_l1_inst_sram_head.next = NULL;
166
167 printk(KERN_INFO "Blackfin L1 Instruction SRAM: %d KB (%d KB free)\n",
168 L1_CODE_LENGTH >> 10,
169 free_l1_inst_sram_head.next->size >> 10);
170#endif 195#endif
171
172 /* mutex initialize */
173 spin_lock_init(&l1_inst_sram_lock);
174} 196}
175 197
176static void __init l2_sram_init(void) 198static void __init l2_sram_init(void)
@@ -179,7 +201,7 @@ static void __init l2_sram_init(void)
179 free_l2_sram_head.next = 201 free_l2_sram_head.next =
180 kmem_cache_alloc(sram_piece_cache, GFP_KERNEL); 202 kmem_cache_alloc(sram_piece_cache, GFP_KERNEL);
181 if (!free_l2_sram_head.next) { 203 if (!free_l2_sram_head.next) {
182 printk(KERN_INFO "Failed to initialize L2 SRAM\n"); 204 printk(KERN_INFO "Fail to initialize L2 SRAM.\n");
183 return; 205 return;
184 } 206 }
185 207
@@ -200,6 +222,7 @@ static void __init l2_sram_init(void)
200 /* mutex initialize */ 222 /* mutex initialize */
201 spin_lock_init(&l2_sram_lock); 223 spin_lock_init(&l2_sram_lock);
202} 224}
225
203void __init bfin_sram_init(void) 226void __init bfin_sram_init(void)
204{ 227{
205 sram_piece_cache = kmem_cache_create("sram_piece_cache", 228 sram_piece_cache = kmem_cache_create("sram_piece_cache",
@@ -353,20 +376,20 @@ int sram_free(const void *addr)
353{ 376{
354 377
355#if L1_CODE_LENGTH != 0 378#if L1_CODE_LENGTH != 0
356 if (addr >= (void *)L1_CODE_START 379 if (addr >= (void *)get_l1_code_start()
357 && addr < (void *)(L1_CODE_START + L1_CODE_LENGTH)) 380 && addr < (void *)(get_l1_code_start() + L1_CODE_LENGTH))
358 return l1_inst_sram_free(addr); 381 return l1_inst_sram_free(addr);
359 else 382 else
360#endif 383#endif
361#if L1_DATA_A_LENGTH != 0 384#if L1_DATA_A_LENGTH != 0
362 if (addr >= (void *)L1_DATA_A_START 385 if (addr >= (void *)get_l1_data_a_start()
363 && addr < (void *)(L1_DATA_A_START + L1_DATA_A_LENGTH)) 386 && addr < (void *)(get_l1_data_a_start() + L1_DATA_A_LENGTH))
364 return l1_data_A_sram_free(addr); 387 return l1_data_A_sram_free(addr);
365 else 388 else
366#endif 389#endif
367#if L1_DATA_B_LENGTH != 0 390#if L1_DATA_B_LENGTH != 0
368 if (addr >= (void *)L1_DATA_B_START 391 if (addr >= (void *)get_l1_data_b_start()
369 && addr < (void *)(L1_DATA_B_START + L1_DATA_B_LENGTH)) 392 && addr < (void *)(get_l1_data_b_start() + L1_DATA_B_LENGTH))
370 return l1_data_B_sram_free(addr); 393 return l1_data_B_sram_free(addr);
371 else 394 else
372#endif 395#endif
@@ -384,17 +407,20 @@ void *l1_data_A_sram_alloc(size_t size)
384{ 407{
385 unsigned long flags; 408 unsigned long flags;
386 void *addr = NULL; 409 void *addr = NULL;
410 unsigned int cpu;
387 411
412 cpu = get_cpu();
388 /* add mutex operation */ 413 /* add mutex operation */
389 spin_lock_irqsave(&l1_data_sram_lock, flags); 414 spin_lock_irqsave(&per_cpu(l1_data_sram_lock, cpu), flags);
390 415
391#if L1_DATA_A_LENGTH != 0 416#if L1_DATA_A_LENGTH != 0
392 addr = _sram_alloc(size, &free_l1_data_A_sram_head, 417 addr = _sram_alloc(size, &per_cpu(free_l1_data_A_sram_head, cpu),
393 &used_l1_data_A_sram_head); 418 &per_cpu(used_l1_data_A_sram_head, cpu));
394#endif 419#endif
395 420
396 /* add mutex operation */ 421 /* add mutex operation */
397 spin_unlock_irqrestore(&l1_data_sram_lock, flags); 422 spin_unlock_irqrestore(&per_cpu(l1_data_sram_lock, cpu), flags);
423 put_cpu();
398 424
399 pr_debug("Allocated address in l1_data_A_sram_alloc is 0x%lx+0x%lx\n", 425 pr_debug("Allocated address in l1_data_A_sram_alloc is 0x%lx+0x%lx\n",
400 (long unsigned int)addr, size); 426 (long unsigned int)addr, size);
@@ -407,19 +433,22 @@ int l1_data_A_sram_free(const void *addr)
407{ 433{
408 unsigned long flags; 434 unsigned long flags;
409 int ret; 435 int ret;
436 unsigned int cpu;
410 437
438 cpu = get_cpu();
411 /* add mutex operation */ 439 /* add mutex operation */
412 spin_lock_irqsave(&l1_data_sram_lock, flags); 440 spin_lock_irqsave(&per_cpu(l1_data_sram_lock, cpu), flags);
413 441
414#if L1_DATA_A_LENGTH != 0 442#if L1_DATA_A_LENGTH != 0
415 ret = _sram_free(addr, &free_l1_data_A_sram_head, 443 ret = _sram_free(addr, &per_cpu(free_l1_data_A_sram_head, cpu),
416 &used_l1_data_A_sram_head); 444 &per_cpu(used_l1_data_A_sram_head, cpu));
417#else 445#else
418 ret = -1; 446 ret = -1;
419#endif 447#endif
420 448
421 /* add mutex operation */ 449 /* add mutex operation */
422 spin_unlock_irqrestore(&l1_data_sram_lock, flags); 450 spin_unlock_irqrestore(&per_cpu(l1_data_sram_lock, cpu), flags);
451 put_cpu();
423 452
424 return ret; 453 return ret;
425} 454}
@@ -430,15 +459,18 @@ void *l1_data_B_sram_alloc(size_t size)
430#if L1_DATA_B_LENGTH != 0 459#if L1_DATA_B_LENGTH != 0
431 unsigned long flags; 460 unsigned long flags;
432 void *addr; 461 void *addr;
462 unsigned int cpu;
433 463
464 cpu = get_cpu();
434 /* add mutex operation */ 465 /* add mutex operation */
435 spin_lock_irqsave(&l1_data_sram_lock, flags); 466 spin_lock_irqsave(&per_cpu(l1_data_sram_lock, cpu), flags);
436 467
437 addr = _sram_alloc(size, &free_l1_data_B_sram_head, 468 addr = _sram_alloc(size, &per_cpu(free_l1_data_B_sram_head, cpu),
438 &used_l1_data_B_sram_head); 469 &per_cpu(used_l1_data_B_sram_head, cpu));
439 470
440 /* add mutex operation */ 471 /* add mutex operation */
441 spin_unlock_irqrestore(&l1_data_sram_lock, flags); 472 spin_unlock_irqrestore(&per_cpu(l1_data_sram_lock, cpu), flags);
473 put_cpu();
442 474
443 pr_debug("Allocated address in l1_data_B_sram_alloc is 0x%lx+0x%lx\n", 475 pr_debug("Allocated address in l1_data_B_sram_alloc is 0x%lx+0x%lx\n",
444 (long unsigned int)addr, size); 476 (long unsigned int)addr, size);
@@ -455,15 +487,18 @@ int l1_data_B_sram_free(const void *addr)
455#if L1_DATA_B_LENGTH != 0 487#if L1_DATA_B_LENGTH != 0
456 unsigned long flags; 488 unsigned long flags;
457 int ret; 489 int ret;
490 unsigned int cpu;
458 491
492 cpu = get_cpu();
459 /* add mutex operation */ 493 /* add mutex operation */
460 spin_lock_irqsave(&l1_data_sram_lock, flags); 494 spin_lock_irqsave(&per_cpu(l1_data_sram_lock, cpu), flags);
461 495
462 ret = _sram_free(addr, &free_l1_data_B_sram_head, 496 ret = _sram_free(addr, &per_cpu(free_l1_data_B_sram_head, cpu),
463 &used_l1_data_B_sram_head); 497 &per_cpu(used_l1_data_B_sram_head, cpu));
464 498
465 /* add mutex operation */ 499 /* add mutex operation */
466 spin_unlock_irqrestore(&l1_data_sram_lock, flags); 500 spin_unlock_irqrestore(&per_cpu(l1_data_sram_lock, cpu), flags);
501 put_cpu();
467 502
468 return ret; 503 return ret;
469#else 504#else
@@ -509,15 +544,18 @@ void *l1_inst_sram_alloc(size_t size)
509#if L1_CODE_LENGTH != 0 544#if L1_CODE_LENGTH != 0
510 unsigned long flags; 545 unsigned long flags;
511 void *addr; 546 void *addr;
547 unsigned int cpu;
512 548
549 cpu = get_cpu();
513 /* add mutex operation */ 550 /* add mutex operation */
514 spin_lock_irqsave(&l1_inst_sram_lock, flags); 551 spin_lock_irqsave(&per_cpu(l1_inst_sram_lock, cpu), flags);
515 552
516 addr = _sram_alloc(size, &free_l1_inst_sram_head, 553 addr = _sram_alloc(size, &per_cpu(free_l1_inst_sram_head, cpu),
517 &used_l1_inst_sram_head); 554 &per_cpu(used_l1_inst_sram_head, cpu));
518 555
519 /* add mutex operation */ 556 /* add mutex operation */
520 spin_unlock_irqrestore(&l1_inst_sram_lock, flags); 557 spin_unlock_irqrestore(&per_cpu(l1_inst_sram_lock, cpu), flags);
558 put_cpu();
521 559
522 pr_debug("Allocated address in l1_inst_sram_alloc is 0x%lx+0x%lx\n", 560 pr_debug("Allocated address in l1_inst_sram_alloc is 0x%lx+0x%lx\n",
523 (long unsigned int)addr, size); 561 (long unsigned int)addr, size);
@@ -534,15 +572,18 @@ int l1_inst_sram_free(const void *addr)
534#if L1_CODE_LENGTH != 0 572#if L1_CODE_LENGTH != 0
535 unsigned long flags; 573 unsigned long flags;
536 int ret; 574 int ret;
575 unsigned int cpu;
537 576
577 cpu = get_cpu();
538 /* add mutex operation */ 578 /* add mutex operation */
539 spin_lock_irqsave(&l1_inst_sram_lock, flags); 579 spin_lock_irqsave(&per_cpu(l1_inst_sram_lock, cpu), flags);
540 580
541 ret = _sram_free(addr, &free_l1_inst_sram_head, 581 ret = _sram_free(addr, &per_cpu(free_l1_inst_sram_head, cpu),
542 &used_l1_inst_sram_head); 582 &per_cpu(used_l1_inst_sram_head, cpu));
543 583
544 /* add mutex operation */ 584 /* add mutex operation */
545 spin_unlock_irqrestore(&l1_inst_sram_lock, flags); 585 spin_unlock_irqrestore(&per_cpu(l1_inst_sram_lock, cpu), flags);
586 put_cpu();
546 587
547 return ret; 588 return ret;
548#else 589#else
@@ -556,15 +597,18 @@ void *l1sram_alloc(size_t size)
556{ 597{
557 unsigned long flags; 598 unsigned long flags;
558 void *addr; 599 void *addr;
600 unsigned int cpu;
559 601
602 cpu = get_cpu();
560 /* add mutex operation */ 603 /* add mutex operation */
561 spin_lock_irqsave(&l1sram_lock, flags); 604 spin_lock_irqsave(&per_cpu(l1sram_lock, cpu), flags);
562 605
563 addr = _sram_alloc(size, &free_l1_ssram_head, 606 addr = _sram_alloc(size, &per_cpu(free_l1_ssram_head, cpu),
564 &used_l1_ssram_head); 607 &per_cpu(used_l1_ssram_head, cpu));
565 608
566 /* add mutex operation */ 609 /* add mutex operation */
567 spin_unlock_irqrestore(&l1sram_lock, flags); 610 spin_unlock_irqrestore(&per_cpu(l1sram_lock, cpu), flags);
611 put_cpu();
568 612
569 return addr; 613 return addr;
570} 614}
@@ -574,15 +618,18 @@ void *l1sram_alloc_max(size_t *psize)
574{ 618{
575 unsigned long flags; 619 unsigned long flags;
576 void *addr; 620 void *addr;
621 unsigned int cpu;
577 622
623 cpu = get_cpu();
578 /* add mutex operation */ 624 /* add mutex operation */
579 spin_lock_irqsave(&l1sram_lock, flags); 625 spin_lock_irqsave(&per_cpu(l1sram_lock, cpu), flags);
580 626
581 addr = _sram_alloc_max(&free_l1_ssram_head, 627 addr = _sram_alloc_max(&per_cpu(free_l1_ssram_head, cpu),
582 &used_l1_ssram_head, psize); 628 &per_cpu(used_l1_ssram_head, cpu), psize);
583 629
584 /* add mutex operation */ 630 /* add mutex operation */
585 spin_unlock_irqrestore(&l1sram_lock, flags); 631 spin_unlock_irqrestore(&per_cpu(l1sram_lock, cpu), flags);
632 put_cpu();
586 633
587 return addr; 634 return addr;
588} 635}
@@ -592,15 +639,18 @@ int l1sram_free(const void *addr)
592{ 639{
593 unsigned long flags; 640 unsigned long flags;
594 int ret; 641 int ret;
642 unsigned int cpu;
595 643
644 cpu = get_cpu();
596 /* add mutex operation */ 645 /* add mutex operation */
597 spin_lock_irqsave(&l1sram_lock, flags); 646 spin_lock_irqsave(&per_cpu(l1sram_lock, cpu), flags);
598 647
599 ret = _sram_free(addr, &free_l1_ssram_head, 648 ret = _sram_free(addr, &per_cpu(free_l1_ssram_head, cpu),
600 &used_l1_ssram_head); 649 &per_cpu(used_l1_ssram_head, cpu));
601 650
602 /* add mutex operation */ 651 /* add mutex operation */
603 spin_unlock_irqrestore(&l1sram_lock, flags); 652 spin_unlock_irqrestore(&per_cpu(l1sram_lock, cpu), flags);
653 put_cpu();
604 654
605 return ret; 655 return ret;
606} 656}
@@ -761,33 +811,36 @@ static int sram_proc_read(char *buf, char **start, off_t offset, int count,
761 int *eof, void *data) 811 int *eof, void *data)
762{ 812{
763 int len = 0; 813 int len = 0;
814 unsigned int cpu;
764 815
765 if (_sram_proc_read(buf, &len, count, "Scratchpad", 816 for (cpu = 0; cpu < num_possible_cpus(); ++cpu) {
766 &free_l1_ssram_head, &used_l1_ssram_head)) 817 if (_sram_proc_read(buf, &len, count, "Scratchpad",
767 goto not_done; 818 &per_cpu(free_l1_ssram_head, cpu), &per_cpu(used_l1_ssram_head, cpu)))
819 goto not_done;
768#if L1_DATA_A_LENGTH != 0 820#if L1_DATA_A_LENGTH != 0
769 if (_sram_proc_read(buf, &len, count, "L1 Data A", 821 if (_sram_proc_read(buf, &len, count, "L1 Data A",
770 &free_l1_data_A_sram_head, 822 &per_cpu(free_l1_data_A_sram_head, cpu),
771 &used_l1_data_A_sram_head)) 823 &per_cpu(used_l1_data_A_sram_head, cpu)))
772 goto not_done; 824 goto not_done;
773#endif 825#endif
774#if L1_DATA_B_LENGTH != 0 826#if L1_DATA_B_LENGTH != 0
775 if (_sram_proc_read(buf, &len, count, "L1 Data B", 827 if (_sram_proc_read(buf, &len, count, "L1 Data B",
776 &free_l1_data_B_sram_head, 828 &per_cpu(free_l1_data_B_sram_head, cpu),
777 &used_l1_data_B_sram_head)) 829 &per_cpu(used_l1_data_B_sram_head, cpu)))
778 goto not_done; 830 goto not_done;
779#endif 831#endif
780#if L1_CODE_LENGTH != 0 832#if L1_CODE_LENGTH != 0
781 if (_sram_proc_read(buf, &len, count, "L1 Instruction", 833 if (_sram_proc_read(buf, &len, count, "L1 Instruction",
782 &free_l1_inst_sram_head, &used_l1_inst_sram_head)) 834 &per_cpu(free_l1_inst_sram_head, cpu),
783 goto not_done; 835 &per_cpu(used_l1_inst_sram_head, cpu)))
836 goto not_done;
784#endif 837#endif
838 }
785#if L2_LENGTH != 0 839#if L2_LENGTH != 0
786 if (_sram_proc_read(buf, &len, count, "L2", 840 if (_sram_proc_read(buf, &len, count, "L2", &free_l2_sram_head,
787 &free_l2_sram_head, &used_l2_sram_head)) 841 &used_l2_sram_head))
788 goto not_done; 842 goto not_done;
789#endif 843#endif
790
791 *eof = 1; 844 *eof = 1;
792 not_done: 845 not_done:
793 return len; 846 return len;
diff --git a/arch/blackfin/oprofile/Makefile b/arch/blackfin/oprofile/Makefile
index 634e300d67e2..c70af3a01297 100644
--- a/arch/blackfin/oprofile/Makefile
+++ b/arch/blackfin/oprofile/Makefile
@@ -10,5 +10,4 @@ DRIVER_OBJS := $(addprefix ../../../drivers/oprofile/, \
10 oprofilefs.o oprofile_stats.o \ 10 oprofilefs.o oprofile_stats.o \
11 timer_int.o ) 11 timer_int.o )
12 12
13oprofile-y := $(DRIVER_OBJS) common.o 13oprofile-y := $(DRIVER_OBJS) bfin_oprofile.o
14oprofile-$(CONFIG_HARDWARE_PM) += op_model_bf533.o
diff --git a/arch/blackfin/oprofile/bfin_oprofile.c b/arch/blackfin/oprofile/bfin_oprofile.c
new file mode 100644
index 000000000000..c3b9713b23f8
--- /dev/null
+++ b/arch/blackfin/oprofile/bfin_oprofile.c
@@ -0,0 +1,18 @@
1/*
2 * bfin_oprofile.c - Blackfin oprofile code
3 *
4 * Copyright 2004-2008 Analog Devices Inc.
5 * Licensed under the GPL-2 or later.
6 */
7
8#include <linux/oprofile.h>
9#include <linux/init.h>
10
11int __init oprofile_arch_init(struct oprofile_operations *ops)
12{
13 return -1;
14}
15
16void oprofile_arch_exit(void)
17{
18}
diff --git a/arch/blackfin/oprofile/common.c b/arch/blackfin/oprofile/common.c
deleted file mode 100644
index 0f6d303a8891..000000000000
--- a/arch/blackfin/oprofile/common.c
+++ /dev/null
@@ -1,168 +0,0 @@
1/*
2 * File: arch/blackfin/oprofile/common.c
3 * Based on: arch/alpha/oprofile/common.c
4 * Author: Anton Blanchard <anton@au.ibm.com>
5 *
6 * Created:
7 * Description:
8 *
9 * Modified:
10 * Copyright (C) 2004 Anton Blanchard <anton@au.ibm.com>, IBM
11 * Copyright 2004-2006 Analog Devices Inc.
12 *
13 * Bugs: Enter bugs at http://blackfin.uclinux.org/
14 *
15 * This program is free software; you can redistribute it and/or modify
16 * it under the terms of the GNU General Public License as published by
17 * the Free Software Foundation; either version 2 of the License, or
18 * (at your option) any later version.
19 *
20 * This program is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
24 *
25 * You should have received a copy of the GNU General Public License
26 * along with this program; if not, see the file COPYING, or write
27 * to the Free Software Foundation, Inc.,
28 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
29 */
30
31#include <linux/oprofile.h>
32#include <linux/init.h>
33#include <linux/smp.h>
34#include <linux/errno.h>
35#include <linux/mutex.h>
36#include <linux/ptrace.h>
37#include <linux/irq.h>
38#include <linux/io.h>
39
40#include <asm/system.h>
41#include <asm/blackfin.h>
42
43#include "op_blackfin.h"
44
45#define BFIN_533_ID 0xE5040003
46#define BFIN_537_ID 0xE5040002
47
48static int pfmon_enabled;
49static struct mutex pfmon_lock;
50
51struct op_bfin533_model *model;
52
53struct op_counter_config ctr[OP_MAX_COUNTER];
54
55static int op_bfin_setup(void)
56{
57 int ret;
58
59 /* Pre-compute the values to stuff in the hardware registers. */
60 spin_lock(&oprofilefs_lock);
61 ret = model->reg_setup(ctr);
62 spin_unlock(&oprofilefs_lock);
63
64 return ret;
65}
66
67static void op_bfin_shutdown(void)
68{
69#if 0
70 /* what is the difference between shutdown and stop? */
71#endif
72}
73
74static int op_bfin_start(void)
75{
76 int ret = -EBUSY;
77
78 printk(KERN_INFO "KSDBG:in %s\n", __func__);
79 mutex_lock(&pfmon_lock);
80 if (!pfmon_enabled) {
81 ret = model->start(ctr);
82 pfmon_enabled = !ret;
83 }
84 mutex_unlock(&pfmon_lock);
85
86 return ret;
87}
88
89static void op_bfin_stop(void)
90{
91 mutex_lock(&pfmon_lock);
92 if (pfmon_enabled) {
93 model->stop();
94 pfmon_enabled = 0;
95 }
96 mutex_unlock(&pfmon_lock);
97}
98
99static int op_bfin_create_files(struct super_block *sb, struct dentry *root)
100{
101 int i;
102
103 for (i = 0; i < model->num_counters; ++i) {
104 struct dentry *dir;
105 char buf[3];
106 printk(KERN_INFO "Oprofile: creating files... \n");
107
108 snprintf(buf, sizeof buf, "%d", i);
109 dir = oprofilefs_mkdir(sb, root, buf);
110
111 oprofilefs_create_ulong(sb, dir, "enabled", &ctr[i].enabled);
112 oprofilefs_create_ulong(sb, dir, "event", &ctr[i].event);
113 oprofilefs_create_ulong(sb, dir, "count", &ctr[i].count);
114 /*
115 * We dont support per counter user/kernel selection, but
116 * we leave the entries because userspace expects them
117 */
118 oprofilefs_create_ulong(sb, dir, "kernel", &ctr[i].kernel);
119 oprofilefs_create_ulong(sb, dir, "user", &ctr[i].user);
120 oprofilefs_create_ulong(sb, dir, "unit_mask",
121 &ctr[i].unit_mask);
122 }
123
124 return 0;
125}
126int __init oprofile_arch_init(struct oprofile_operations *ops)
127{
128#ifdef CONFIG_HARDWARE_PM
129 unsigned int dspid;
130
131 mutex_init(&pfmon_lock);
132
133 dspid = bfin_read_DSPID();
134
135 printk(KERN_INFO "Oprofile got the cpu id is 0x%x. \n", dspid);
136
137 switch (dspid) {
138 case BFIN_533_ID:
139 model = &op_model_bfin533;
140 model->num_counters = 2;
141 break;
142 case BFIN_537_ID:
143 model = &op_model_bfin533;
144 model->num_counters = 2;
145 break;
146 default:
147 return -ENODEV;
148 }
149
150 ops->cpu_type = model->name;
151 ops->create_files = op_bfin_create_files;
152 ops->setup = op_bfin_setup;
153 ops->shutdown = op_bfin_shutdown;
154 ops->start = op_bfin_start;
155 ops->stop = op_bfin_stop;
156
157 printk(KERN_INFO "oprofile: using %s performance monitoring.\n",
158 ops->cpu_type);
159
160 return 0;
161#else
162 return -1;
163#endif
164}
165
166void oprofile_arch_exit(void)
167{
168}
diff --git a/arch/blackfin/oprofile/op_blackfin.h b/arch/blackfin/oprofile/op_blackfin.h
deleted file mode 100644
index 05dd08c9d154..000000000000
--- a/arch/blackfin/oprofile/op_blackfin.h
+++ /dev/null
@@ -1,98 +0,0 @@
1/*
2 * File: arch/blackfin/oprofile/op_blackfin.h
3 * Based on:
4 * Author: Anton Blanchard <anton@au.ibm.com>
5 *
6 * Created:
7 * Description:
8 *
9 * Modified:
10 * Copyright (C) 2004 Anton Blanchard <anton@au.ibm.com>, IBM
11 * Copyright 2004-2006 Analog Devices Inc.
12 *
13 * Bugs: Enter bugs at http://blackfin.uclinux.org/
14 *
15 * This program is free software; you can redistribute it and/or modify
16 * it under the terms of the GNU General Public License as published by
17 * the Free Software Foundation; either version 2 of the License, or
18 * (at your option) any later version.
19 *
20 * This program is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
24 *
25 * You should have received a copy of the GNU General Public License
26 * along with this program; if not, see the file COPYING, or write
27 * to the Free Software Foundation, Inc.,
28 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
29 */
30
31#ifndef OP_BLACKFIN_H
32#define OP_BLACKFIN_H 1
33
34#define OP_MAX_COUNTER 2
35
36#include <asm/blackfin.h>
37
38/* Per-counter configuration as set via oprofilefs. */
39struct op_counter_config {
40 unsigned long valid;
41 unsigned long enabled;
42 unsigned long event;
43 unsigned long count;
44 unsigned long kernel;
45 unsigned long user;
46 unsigned long unit_mask;
47};
48
49/* System-wide configuration as set via oprofilefs. */
50struct op_system_config {
51 unsigned long enable_kernel;
52 unsigned long enable_user;
53};
54
55/* Per-arch configuration */
56struct op_bfin533_model {
57 int (*reg_setup) (struct op_counter_config *);
58 int (*start) (struct op_counter_config *);
59 void (*stop) (void);
60 int num_counters;
61 char *name;
62};
63
64extern struct op_bfin533_model op_model_bfin533;
65
66static inline unsigned int ctr_read(void)
67{
68 unsigned int tmp;
69
70 tmp = bfin_read_PFCTL();
71 CSYNC();
72
73 return tmp;
74}
75
76static inline void ctr_write(unsigned int val)
77{
78 bfin_write_PFCTL(val);
79 CSYNC();
80}
81
82static inline void count_read(unsigned int *count)
83{
84 count[0] = bfin_read_PFCNTR0();
85 count[1] = bfin_read_PFCNTR1();
86 CSYNC();
87}
88
89static inline void count_write(unsigned int *count)
90{
91 bfin_write_PFCNTR0(count[0]);
92 bfin_write_PFCNTR1(count[1]);
93 CSYNC();
94}
95
96extern int pm_overflow_handler(int irq, struct pt_regs *regs);
97
98#endif
diff --git a/arch/blackfin/oprofile/op_model_bf533.c b/arch/blackfin/oprofile/op_model_bf533.c
deleted file mode 100644
index d1c698bb9ee5..000000000000
--- a/arch/blackfin/oprofile/op_model_bf533.c
+++ /dev/null
@@ -1,161 +0,0 @@
1/*
2 * File: arch/blackfin/oprofile/op_model_bf533.c
3 * Based on:
4 * Author: Anton Blanchard <anton@au.ibm.com>
5 *
6 * Created:
7 * Description:
8 *
9 * Modified:
10 * Copyright (C) 2004 Anton Blanchard <anton@au.ibm.com>, IBM
11 * Copyright 2004-2006 Analog Devices Inc.
12 *
13 * Bugs: Enter bugs at http://blackfin.uclinux.org/
14 *
15 * This program is free software; you can redistribute it and/or modify
16 * it under the terms of the GNU General Public License as published by
17 * the Free Software Foundation; either version 2 of the License, or
18 * (at your option) any later version.
19 *
20 * This program is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
24 *
25 * You should have received a copy of the GNU General Public License
26 * along with this program; if not, see the file COPYING, or write
27 * to the Free Software Foundation, Inc.,
28 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
29 */
30
31#include <linux/oprofile.h>
32#include <linux/init.h>
33#include <linux/smp.h>
34#include <linux/interrupt.h>
35#include <linux/ptrace.h>
36#include <linux/irq.h>
37#include <linux/io.h>
38#include <asm/system.h>
39#include <asm/processor.h>
40#include <asm/blackfin.h>
41
42#include "op_blackfin.h"
43
44#define PM_ENABLE 0x01;
45#define PM_CTL1_ENABLE 0x18
46#define PM_CTL0_ENABLE 0xC000
47#define COUNT_EDGE_ONLY 0x3000000
48
49static int oprofile_running;
50
51static unsigned curr_pfctl, curr_count[2];
52
53static int bfin533_reg_setup(struct op_counter_config *ctr)
54{
55 unsigned int pfctl = ctr_read();
56 unsigned int count[2];
57
58 /* set Blackfin perf monitor regs with ctr */
59 if (ctr[0].enabled) {
60 pfctl |= (PM_CTL0_ENABLE | ((char)ctr[0].event << 5));
61 count[0] = 0xFFFFFFFF - ctr[0].count;
62 curr_count[0] = count[0];
63 }
64 if (ctr[1].enabled) {
65 pfctl |= (PM_CTL1_ENABLE | ((char)ctr[1].event << 16));
66 count[1] = 0xFFFFFFFF - ctr[1].count;
67 curr_count[1] = count[1];
68 }
69
70 pr_debug("ctr[0].enabled=%d,ctr[1].enabled=%d,ctr[0].event<<5=0x%x,ctr[1].event<<16=0x%x\n", ctr[0].enabled, ctr[1].enabled, ctr[0].event << 5, ctr[1].event << 16);
71 pfctl |= COUNT_EDGE_ONLY;
72 curr_pfctl = pfctl;
73
74 pr_debug("write 0x%x to pfctl\n", pfctl);
75 ctr_write(pfctl);
76 count_write(count);
77
78 return 0;
79}
80
81static int bfin533_start(struct op_counter_config *ctr)
82{
83 unsigned int pfctl = ctr_read();
84
85 pfctl |= PM_ENABLE;
86 curr_pfctl = pfctl;
87
88 ctr_write(pfctl);
89
90 oprofile_running = 1;
91 pr_debug("start oprofile counter \n");
92
93 return 0;
94}
95
96static void bfin533_stop(void)
97{
98 int pfctl;
99
100 pfctl = ctr_read();
101 pfctl &= ~PM_ENABLE;
102 /* freeze counters */
103 ctr_write(pfctl);
104
105 oprofile_running = 0;
106 pr_debug("stop oprofile counter \n");
107}
108
109static int get_kernel(void)
110{
111 int ipend, is_kernel;
112
113 ipend = bfin_read_IPEND();
114
115 /* test bit 15 */
116 is_kernel = ((ipend & 0x8000) != 0);
117
118 return is_kernel;
119}
120
121int pm_overflow_handler(int irq, struct pt_regs *regs)
122{
123 int is_kernel;
124 int i, cpu;
125 unsigned int pc, pfctl;
126 unsigned int count[2];
127
128 pr_debug("get interrupt in %s\n", __func__);
129 if (oprofile_running == 0) {
130 pr_debug("error: entering interrupt when oprofile is stopped.\n\r");
131 return -1;
132 }
133
134 is_kernel = get_kernel();
135 cpu = smp_processor_id();
136 pc = regs->pc;
137 pfctl = ctr_read();
138
139 /* read the two event counter regs */
140 count_read(count);
141
142 /* if the counter overflows, add sample to oprofile buffer */
143 for (i = 0; i < 2; ++i) {
144 if (oprofile_running) {
145 oprofile_add_sample(regs, i);
146 }
147 }
148
149 /* reset the perfmon counter */
150 ctr_write(curr_pfctl);
151 count_write(curr_count);
152 return 0;
153}
154
155struct op_bfin533_model op_model_bfin533 = {
156 .reg_setup = bfin533_reg_setup,
157 .start = bfin533_start,
158 .stop = bfin533_stop,
159 .num_counters = 2,
160 .name = "blackfin/bf533"
161};
diff --git a/arch/blackfin/oprofile/timer_int.c b/arch/blackfin/oprofile/timer_int.c
deleted file mode 100644
index 6c6f8606af4c..000000000000
--- a/arch/blackfin/oprofile/timer_int.c
+++ /dev/null
@@ -1,73 +0,0 @@
1/*
2 * File: arch/blackfin/oprofile/timer_int.c
3 * Based on:
4 * Author: Michael Kang
5 *
6 * Created:
7 * Description:
8 *
9 * Modified:
10 * Copyright 2004-2006 Analog Devices Inc.
11 *
12 * Bugs: Enter bugs at http://blackfin.uclinux.org/
13 *
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 2 of the License, or
17 * (at your option) any later version.
18 *
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
23 *
24 * You should have received a copy of the GNU General Public License
25 * along with this program; if not, see the file COPYING, or write
26 * to the Free Software Foundation, Inc.,
27 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
28 */
29
30#include <linux/init.h>
31#include <linux/smp.h>
32#include <linux/irq.h>
33#include <linux/oprofile.h>
34#include <linux/ptrace.h>
35
36static void enable_sys_timer0()
37{
38}
39static void disable_sys_timer0()
40{
41}
42
43static irqreturn_t sys_timer0_int_handler(int irq, void *dev_id,
44 struct pt_regs *regs)
45{
46 oprofile_add_sample(regs, 0);
47 return IRQ_HANDLED;
48}
49
50static int sys_timer0_start(void)
51{
52 enable_sys_timer0();
53 return request_irq(IVG11, sys_timer0_int_handler, 0, "sys_timer0", NULL);
54}
55
56static void sys_timer0_stop(void)
57{
58 disable_sys_timer();
59}
60
61int __init sys_timer0_init(struct oprofile_operations *ops)
62{
63 extern int nmi_active;
64
65 if (nmi_active <= 0)
66 return -ENODEV;
67
68 ops->start = timer_start;
69 ops->stop = timer_stop;
70 ops->cpu_type = "timer";
71 printk(KERN_INFO "oprofile: using NMI timer interrupt.\n");
72 return 0;
73}
diff --git a/arch/cris/arch-v32/kernel/signal.c b/arch/cris/arch-v32/kernel/signal.c
index da7d2be000ba..372d0ca6efbc 100644
--- a/arch/cris/arch-v32/kernel/signal.c
+++ b/arch/cris/arch-v32/kernel/signal.c
@@ -456,7 +456,7 @@ give_sigsegv:
456 return -EFAULT; 456 return -EFAULT;
457} 457}
458 458
459/* Invoke a singal handler to, well, handle the signal. */ 459/* Invoke a signal handler to, well, handle the signal. */
460static inline int 460static inline int
461handle_signal(int canrestart, unsigned long sig, 461handle_signal(int canrestart, unsigned long sig,
462 siginfo_t *info, struct k_sigaction *ka, 462 siginfo_t *info, struct k_sigaction *ka,
diff --git a/arch/ia64/kernel/kprobes.c b/arch/ia64/kernel/kprobes.c
index 097b84d54e73..f90be51b1123 100644
--- a/arch/ia64/kernel/kprobes.c
+++ b/arch/ia64/kernel/kprobes.c
@@ -434,7 +434,7 @@ int __kprobes trampoline_probe_handler(struct kprobe *p, struct pt_regs *regs)
434 /* 434 /*
435 * It is possible to have multiple instances associated with a given 435 * It is possible to have multiple instances associated with a given
436 * task either because an multiple functions in the call path 436 * task either because an multiple functions in the call path
437 * have a return probe installed on them, and/or more then one return 437 * have a return probe installed on them, and/or more than one return
438 * return probe was registered for a target function. 438 * return probe was registered for a target function.
439 * 439 *
440 * We can handle this because: 440 * We can handle this because:
diff --git a/arch/m68k/Kconfig b/arch/m68k/Kconfig
index c825bde17cb3..fb87c08c6b57 100644
--- a/arch/m68k/Kconfig
+++ b/arch/m68k/Kconfig
@@ -303,7 +303,7 @@ config M68KFPU_EMU_EXTRAPREC
303 correct rounding, the emulator can (often) do the same but this 303 correct rounding, the emulator can (often) do the same but this
304 extra calculation can cost quite some time, so you can disable 304 extra calculation can cost quite some time, so you can disable
305 it here. The emulator will then "only" calculate with a 64 bit 305 it here. The emulator will then "only" calculate with a 64 bit
306 mantissa and round slightly incorrect, what is more then enough 306 mantissa and round slightly incorrect, what is more than enough
307 for normal usage. 307 for normal usage.
308 308
309config M68KFPU_EMU_ONLY 309config M68KFPU_EMU_ONLY
diff --git a/arch/m68k/kernel/traps.c b/arch/m68k/kernel/traps.c
index 6d813de2baf1..184acc90808d 100644
--- a/arch/m68k/kernel/traps.c
+++ b/arch/m68k/kernel/traps.c
@@ -401,7 +401,7 @@ static inline void do_040writebacks(struct frame *fp)
401 * called from sigreturn(), must ensure userspace code didn't 401 * called from sigreturn(), must ensure userspace code didn't
402 * manipulate exception frame to circumvent protection, then complete 402 * manipulate exception frame to circumvent protection, then complete
403 * pending writebacks 403 * pending writebacks
404 * we just clear TM2 to turn it into an userspace access 404 * we just clear TM2 to turn it into a userspace access
405 */ 405 */
406asmlinkage void berr_040cleanup(struct frame *fp) 406asmlinkage void berr_040cleanup(struct frame *fp)
407{ 407{
diff --git a/arch/mips/kernel/stacktrace.c b/arch/mips/kernel/stacktrace.c
index 0632e2a849c0..58f5cd76c8c3 100644
--- a/arch/mips/kernel/stacktrace.c
+++ b/arch/mips/kernel/stacktrace.c
@@ -32,7 +32,8 @@ static void save_raw_context_stack(struct stack_trace *trace,
32 } 32 }
33} 33}
34 34
35static void save_context_stack(struct stack_trace *trace, struct pt_regs *regs) 35static void save_context_stack(struct stack_trace *trace,
36 struct task_struct *tsk, struct pt_regs *regs)
36{ 37{
37 unsigned long sp = regs->regs[29]; 38 unsigned long sp = regs->regs[29];
38#ifdef CONFIG_KALLSYMS 39#ifdef CONFIG_KALLSYMS
@@ -41,7 +42,7 @@ static void save_context_stack(struct stack_trace *trace, struct pt_regs *regs)
41 42
42 if (raw_show_trace || !__kernel_text_address(pc)) { 43 if (raw_show_trace || !__kernel_text_address(pc)) {
43 unsigned long stack_page = 44 unsigned long stack_page =
44 (unsigned long)task_stack_page(current); 45 (unsigned long)task_stack_page(tsk);
45 if (stack_page && sp >= stack_page && 46 if (stack_page && sp >= stack_page &&
46 sp <= stack_page + THREAD_SIZE - 32) 47 sp <= stack_page + THREAD_SIZE - 32)
47 save_raw_context_stack(trace, sp); 48 save_raw_context_stack(trace, sp);
@@ -54,7 +55,7 @@ static void save_context_stack(struct stack_trace *trace, struct pt_regs *regs)
54 trace->entries[trace->nr_entries++] = pc; 55 trace->entries[trace->nr_entries++] = pc;
55 if (trace->nr_entries >= trace->max_entries) 56 if (trace->nr_entries >= trace->max_entries)
56 break; 57 break;
57 pc = unwind_stack(current, &sp, pc, &ra); 58 pc = unwind_stack(tsk, &sp, pc, &ra);
58 } while (pc); 59 } while (pc);
59#else 60#else
60 save_raw_context_stack(trace, sp); 61 save_raw_context_stack(trace, sp);
@@ -66,12 +67,23 @@ static void save_context_stack(struct stack_trace *trace, struct pt_regs *regs)
66 */ 67 */
67void save_stack_trace(struct stack_trace *trace) 68void save_stack_trace(struct stack_trace *trace)
68{ 69{
70 save_stack_trace_tsk(current, trace);
71}
72EXPORT_SYMBOL_GPL(save_stack_trace);
73
74void save_stack_trace_tsk(struct task_struct *tsk, struct stack_trace *trace)
75{
69 struct pt_regs dummyregs; 76 struct pt_regs dummyregs;
70 struct pt_regs *regs = &dummyregs; 77 struct pt_regs *regs = &dummyregs;
71 78
72 WARN_ON(trace->nr_entries || !trace->max_entries); 79 WARN_ON(trace->nr_entries || !trace->max_entries);
73 80
74 prepare_frametrace(regs); 81 if (tsk != current) {
75 save_context_stack(trace, regs); 82 regs->regs[29] = tsk->thread.reg29;
83 regs->regs[31] = 0;
84 regs->cp0_epc = tsk->thread.reg31;
85 } else
86 prepare_frametrace(regs);
87 save_context_stack(trace, tsk, regs);
76} 88}
77EXPORT_SYMBOL_GPL(save_stack_trace); 89EXPORT_SYMBOL_GPL(save_stack_trace_tsk);
diff --git a/arch/mips/pmc-sierra/yosemite/atmel_read_eeprom.c b/arch/mips/pmc-sierra/yosemite/atmel_read_eeprom.c
index 97862f45496d..caf5e9a0acc7 100644
--- a/arch/mips/pmc-sierra/yosemite/atmel_read_eeprom.c
+++ b/arch/mips/pmc-sierra/yosemite/atmel_read_eeprom.c
@@ -148,7 +148,7 @@ int read_eeprom(char *buffer, int eeprom_size, int size)
148 send_byte(W_HEADER); 148 send_byte(W_HEADER);
149 recv_ack(); 149 recv_ack();
150 150
151 /* EEPROM with size of more then 2K need two byte addressing */ 151 /* EEPROM with size of more than 2K need two byte addressing */
152 if (eeprom_size > 2048) { 152 if (eeprom_size > 2048) {
153 send_byte(0x00); 153 send_byte(0x00);
154 recv_ack(); 154 recv_ack();
diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile
index f32829937aad..ab6dda372438 100644
--- a/arch/powerpc/boot/Makefile
+++ b/arch/powerpc/boot/Makefile
@@ -208,7 +208,7 @@ image-$(CONFIG_DEFAULT_UIMAGE) += uImage
208# 208#
209# Theses are default targets to build images which embed device tree blobs. 209# Theses are default targets to build images which embed device tree blobs.
210# They are only required on boards which do not have FDT support in firmware. 210# They are only required on boards which do not have FDT support in firmware.
211# Boards with newish u-boot firmare can use the uImage target above 211# Boards with newish u-boot firmware can use the uImage target above
212# 212#
213 213
214# Board ports in arch/powerpc/platform/40x/Kconfig 214# Board ports in arch/powerpc/platform/40x/Kconfig
diff --git a/arch/powerpc/boot/dts/sequoia.dts b/arch/powerpc/boot/dts/sequoia.dts
index 3b295e8df53f..43cc68bd3192 100644
--- a/arch/powerpc/boot/dts/sequoia.dts
+++ b/arch/powerpc/boot/dts/sequoia.dts
@@ -134,7 +134,7 @@
134 }; 134 };
135 135
136 USB1: usb@e0000400 { 136 USB1: usb@e0000400 {
137 compatible = "ohci-be"; 137 compatible = "ibm,usb-ohci-440epx", "ohci-be";
138 reg = <0x00000000 0xe0000400 0x00000060>; 138 reg = <0x00000000 0xe0000400 0x00000060>;
139 interrupt-parent = <&UIC0>; 139 interrupt-parent = <&UIC0>;
140 interrupts = <0x15 0x8>; 140 interrupts = <0x15 0x8>;
diff --git a/arch/powerpc/kernel/kprobes.c b/arch/powerpc/kernel/kprobes.c
index 989edcdf0297..c9329786073b 100644
--- a/arch/powerpc/kernel/kprobes.c
+++ b/arch/powerpc/kernel/kprobes.c
@@ -317,7 +317,7 @@ static int __kprobes trampoline_probe_handler(struct kprobe *p,
317 /* 317 /*
318 * It is possible to have multiple instances associated with a given 318 * It is possible to have multiple instances associated with a given
319 * task either because an multiple functions in the call path 319 * task either because an multiple functions in the call path
320 * have a return probe installed on them, and/or more then one return 320 * have a return probe installed on them, and/or more than one return
321 * return probe was registered for a target function. 321 * return probe was registered for a target function.
322 * 322 *
323 * We can handle this because: 323 * We can handle this because:
diff --git a/arch/powerpc/oprofile/cell/spu_profiler.c b/arch/powerpc/oprofile/cell/spu_profiler.c
index dd499c3e9da7..83faa958b9d4 100644
--- a/arch/powerpc/oprofile/cell/spu_profiler.c
+++ b/arch/powerpc/oprofile/cell/spu_profiler.c
@@ -49,7 +49,7 @@ void set_spu_profiling_frequency(unsigned int freq_khz, unsigned int cycles_rese
49 * of precision. This is close enough for the purpose at hand. 49 * of precision. This is close enough for the purpose at hand.
50 * 50 *
51 * The value of the timeout should be small enough that the hw 51 * The value of the timeout should be small enough that the hw
52 * trace buffer will not get more then about 1/3 full for the 52 * trace buffer will not get more than about 1/3 full for the
53 * maximum user specified (the LFSR value) hw sampling frequency. 53 * maximum user specified (the LFSR value) hw sampling frequency.
54 * This is to ensure the trace buffer will never fill even if the 54 * This is to ensure the trace buffer will never fill even if the
55 * kernel thread scheduling varies under a heavy system load. 55 * kernel thread scheduling varies under a heavy system load.
diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig
index 19577aeffd7b..a94a3c3ae932 100644
--- a/arch/s390/Kconfig
+++ b/arch/s390/Kconfig
@@ -299,7 +299,7 @@ config WARN_STACK
299 This option enables the compiler options -mwarn-framesize and 299 This option enables the compiler options -mwarn-framesize and
300 -mwarn-dynamicstack. If the compiler supports these options it 300 -mwarn-dynamicstack. If the compiler supports these options it
301 will generate warnings for function which either use alloca or 301 will generate warnings for function which either use alloca or
302 create a stack frame bigger then CONFIG_WARN_STACK_SIZE. 302 create a stack frame bigger than CONFIG_WARN_STACK_SIZE.
303 303
304 Say N if you are unsure. 304 Say N if you are unsure.
305 305
diff --git a/arch/s390/kernel/kprobes.c b/arch/s390/kernel/kprobes.c
index 9b92856632cf..a01cf0284db2 100644
--- a/arch/s390/kernel/kprobes.c
+++ b/arch/s390/kernel/kprobes.c
@@ -382,7 +382,7 @@ static int __kprobes trampoline_probe_handler(struct kprobe *p,
382 /* 382 /*
383 * It is possible to have multiple instances associated with a given 383 * It is possible to have multiple instances associated with a given
384 * task either because an multiple functions in the call path 384 * task either because an multiple functions in the call path
385 * have a return probe installed on them, and/or more then one return 385 * have a return probe installed on them, and/or more than one return
386 * return probe was registered for a target function. 386 * return probe was registered for a target function.
387 * 387 *
388 * We can handle this because: 388 * We can handle this because:
diff --git a/arch/sparc/kernel/kprobes.c b/arch/sparc/kernel/kprobes.c
index 201a6e547e4a..3bc6527c95af 100644
--- a/arch/sparc/kernel/kprobes.c
+++ b/arch/sparc/kernel/kprobes.c
@@ -517,7 +517,7 @@ int __kprobes trampoline_probe_handler(struct kprobe *p, struct pt_regs *regs)
517 /* 517 /*
518 * It is possible to have multiple instances associated with a given 518 * It is possible to have multiple instances associated with a given
519 * task either because an multiple functions in the call path 519 * task either because an multiple functions in the call path
520 * have a return probe installed on them, and/or more then one return 520 * have a return probe installed on them, and/or more than one return
521 * return probe was registered for a target function. 521 * return probe was registered for a target function.
522 * 522 *
523 * We can handle this because: 523 * We can handle this because:
diff --git a/arch/x86/kernel/kprobes.c b/arch/x86/kernel/kprobes.c
index eead6f8f9218..884d985b8b82 100644
--- a/arch/x86/kernel/kprobes.c
+++ b/arch/x86/kernel/kprobes.c
@@ -695,7 +695,7 @@ static __used __kprobes void *trampoline_handler(struct pt_regs *regs)
695 /* 695 /*
696 * It is possible to have multiple instances associated with a given 696 * It is possible to have multiple instances associated with a given
697 * task either because multiple functions in the call path have 697 * task either because multiple functions in the call path have
698 * return probes installed on them, and/or more then one 698 * return probes installed on them, and/or more than one
699 * return probe was registered for a target function. 699 * return probe was registered for a target function.
700 * 700 *
701 * We can handle this because: 701 * We can handle this because:
diff --git a/arch/x86/kernel/mfgpt_32.c b/arch/x86/kernel/mfgpt_32.c
index c12314c9e86f..8815f3c7fec7 100644
--- a/arch/x86/kernel/mfgpt_32.c
+++ b/arch/x86/kernel/mfgpt_32.c
@@ -252,7 +252,7 @@ EXPORT_SYMBOL_GPL(geode_mfgpt_alloc_timer);
252/* 252/*
253 * The MFPGT timers on the CS5536 provide us with suitable timers to use 253 * The MFPGT timers on the CS5536 provide us with suitable timers to use
254 * as clock event sources - not as good as a HPET or APIC, but certainly 254 * as clock event sources - not as good as a HPET or APIC, but certainly
255 * better then the PIT. This isn't a general purpose MFGPT driver, but 255 * better than the PIT. This isn't a general purpose MFGPT driver, but
256 * a simplified one designed specifically to act as a clock event source. 256 * a simplified one designed specifically to act as a clock event source.
257 * For full details about the MFGPT, please consult the CS5536 data sheet. 257 * For full details about the MFGPT, please consult the CS5536 data sheet.
258 */ 258 */
diff --git a/arch/xtensa/Makefile b/arch/xtensa/Makefile
index 015b6b2a26b9..1da55fe4beff 100644
--- a/arch/xtensa/Makefile
+++ b/arch/xtensa/Makefile
@@ -33,6 +33,15 @@ KBUILD_CFLAGS += -ffreestanding
33 33
34KBUILD_CFLAGS += -pipe -mlongcalls 34KBUILD_CFLAGS += -pipe -mlongcalls
35 35
36vardirs := $(patsubst %,arch/xtensa/variants/%/,$(variant-y))
37plfdirs := $(patsubst %,arch/xtensa/platforms/%/,$(platform-y))
38
39ifeq ($(KBUILD_SRC),)
40KBUILD_CPPFLAGS += $(patsubst %,-I%include,$(vardirs) $(plfdirs))
41else
42KBUILD_CPPFLAGS += $(patsubst %,-I$(srctree)/%include,$(vardirs) $(plfdirs))
43endif
44
36KBUILD_DEFCONFIG := iss_defconfig 45KBUILD_DEFCONFIG := iss_defconfig
37 46
38# ramdisk/initrd support 47# ramdisk/initrd support
@@ -66,21 +75,6 @@ libs-y += arch/xtensa/lib/ $(LIBGCC)
66 75
67boot := arch/xtensa/boot 76boot := arch/xtensa/boot
68 77
69archinc := include/asm-xtensa
70
71archprepare: $(archinc)/.platform
72
73# Update processor variant and platform symlinks if something which affects
74# them changed.
75
76$(archinc)/.platform: $(wildcard include/config/arch/*.h) include/config/auto.conf
77 @echo ' SYMLINK $(archinc)/variant -> $(archinc)/variant-$(VARIANT)'
78 $(Q)mkdir -p $(archinc)
79 $(Q)ln -fsn $(srctree)/$(archinc)/variant-$(VARIANT) $(archinc)/variant
80 @echo ' SYMLINK $(archinc)/platform -> $(archinc)/platform-$(PLATFORM)'
81 $(Q)ln -fsn $(srctree)/$(archinc)/platform-$(PLATFORM) $(archinc)/platform
82 @touch $@
83
84 78
85all: zImage 79all: zImage
86 80
@@ -89,10 +83,6 @@ bzImage : zImage
89zImage zImage.initrd: vmlinux 83zImage zImage.initrd: vmlinux
90 $(Q)$(MAKE) $(build)=$(boot) $@ 84 $(Q)$(MAKE) $(build)=$(boot) $@
91 85
92CLEAN_FILES += arch/xtensa/vmlinux.lds \
93 $(archinc)/platform $(archinc)/variant \
94 $(archinc)/.platform
95
96define archhelp 86define archhelp
97 @echo '* zImage - Compressed kernel image (arch/xtensa/boot/images/zImage.*)' 87 @echo '* zImage - Compressed kernel image (arch/xtensa/boot/images/zImage.*)'
98endef 88endef
diff --git a/arch/xtensa/boot/boot-elf/boot.lds.S b/arch/xtensa/boot/boot-elf/boot.lds.S
index 849dfcafd518..4e53b74dc44b 100644
--- a/arch/xtensa/boot/boot-elf/boot.lds.S
+++ b/arch/xtensa/boot/boot-elf/boot.lds.S
@@ -1,4 +1,4 @@
1#include <asm/variant/core.h> 1#include <variant/core.h>
2OUTPUT_ARCH(xtensa) 2OUTPUT_ARCH(xtensa)
3ENTRY(_ResetVector) 3ENTRY(_ResetVector)
4 4
diff --git a/arch/xtensa/boot/boot-redboot/bootstrap.S b/arch/xtensa/boot/boot-redboot/bootstrap.S
index 84848123e2a8..5582e8cfac8f 100644
--- a/arch/xtensa/boot/boot-redboot/bootstrap.S
+++ b/arch/xtensa/boot/boot-redboot/bootstrap.S
@@ -1,4 +1,4 @@
1#include <asm/variant/core.h> 1#include <variant/core.h>
2#include <asm/regs.h> 2#include <asm/regs.h>
3#include <asm/asmmacro.h> 3#include <asm/asmmacro.h>
4#include <asm/cacheasm.h> 4#include <asm/cacheasm.h>
diff --git a/include/asm-xtensa/Kbuild b/arch/xtensa/include/asm/Kbuild
index c68e1680da01..58c02a454130 100644
--- a/include/asm-xtensa/Kbuild
+++ b/arch/xtensa/include/asm/Kbuild
@@ -1 +1,3 @@
1include include/asm-generic/Kbuild.asm 1include include/asm-generic/Kbuild.asm
2
3unifdef-y += swab.h
diff --git a/include/asm-xtensa/asmmacro.h b/arch/xtensa/include/asm/asmmacro.h
index 76915cabad17..755320f6e0bc 100644
--- a/include/asm-xtensa/asmmacro.h
+++ b/arch/xtensa/include/asm/asmmacro.h
@@ -11,7 +11,7 @@
11#ifndef _XTENSA_ASMMACRO_H 11#ifndef _XTENSA_ASMMACRO_H
12#define _XTENSA_ASMMACRO_H 12#define _XTENSA_ASMMACRO_H
13 13
14#include <asm/variant/core.h> 14#include <variant/core.h>
15 15
16/* 16/*
17 * Some little helpers for loops. Use zero-overhead-loops 17 * Some little helpers for loops. Use zero-overhead-loops
diff --git a/include/asm-xtensa/atomic.h b/arch/xtensa/include/asm/atomic.h
index 67ad67bed8c1..67ad67bed8c1 100644
--- a/include/asm-xtensa/atomic.h
+++ b/arch/xtensa/include/asm/atomic.h
diff --git a/include/asm-xtensa/auxvec.h b/arch/xtensa/include/asm/auxvec.h
index 257dec75c5af..257dec75c5af 100644
--- a/include/asm-xtensa/auxvec.h
+++ b/arch/xtensa/include/asm/auxvec.h
diff --git a/include/asm-xtensa/bitops.h b/arch/xtensa/include/asm/bitops.h
index 6c3930397bd3..6c3930397bd3 100644
--- a/include/asm-xtensa/bitops.h
+++ b/arch/xtensa/include/asm/bitops.h
diff --git a/include/asm-xtensa/bootparam.h b/arch/xtensa/include/asm/bootparam.h
index 9983f2c1b7ee..9983f2c1b7ee 100644
--- a/include/asm-xtensa/bootparam.h
+++ b/arch/xtensa/include/asm/bootparam.h
diff --git a/include/asm-xtensa/bug.h b/arch/xtensa/include/asm/bug.h
index 3e52d72712f1..3e52d72712f1 100644
--- a/include/asm-xtensa/bug.h
+++ b/arch/xtensa/include/asm/bug.h
diff --git a/include/asm-xtensa/bugs.h b/arch/xtensa/include/asm/bugs.h
index 69b29d198249..69b29d198249 100644
--- a/include/asm-xtensa/bugs.h
+++ b/arch/xtensa/include/asm/bugs.h
diff --git a/arch/xtensa/include/asm/byteorder.h b/arch/xtensa/include/asm/byteorder.h
new file mode 100644
index 000000000000..329b94591ca4
--- /dev/null
+++ b/arch/xtensa/include/asm/byteorder.h
@@ -0,0 +1,14 @@
1#ifndef _XTENSA_BYTEORDER_H
2#define _XTENSA_BYTEORDER_H
3
4#include <asm/swab.h>
5
6#ifdef __XTENSA_EL__
7#include <linux/byteorder/little_endian.h>
8#elif defined(__XTENSA_EB__)
9#include <linux/byteorder/big_endian.h>
10#else
11# error processor byte order undefined!
12#endif
13
14#endif /* _XTENSA_BYTEORDER_H */
diff --git a/include/asm-xtensa/cache.h b/arch/xtensa/include/asm/cache.h
index 3bba2a540cf0..f04c9891142f 100644
--- a/include/asm-xtensa/cache.h
+++ b/arch/xtensa/include/asm/cache.h
@@ -11,7 +11,7 @@
11#ifndef _XTENSA_CACHE_H 11#ifndef _XTENSA_CACHE_H
12#define _XTENSA_CACHE_H 12#define _XTENSA_CACHE_H
13 13
14#include <asm/variant/core.h> 14#include <variant/core.h>
15 15
16#define L1_CACHE_SHIFT XCHAL_DCACHE_LINEWIDTH 16#define L1_CACHE_SHIFT XCHAL_DCACHE_LINEWIDTH
17#define L1_CACHE_BYTES XCHAL_DCACHE_LINESIZE 17#define L1_CACHE_BYTES XCHAL_DCACHE_LINESIZE
diff --git a/include/asm-xtensa/cacheasm.h b/arch/xtensa/include/asm/cacheasm.h
index 2c20a58f94cd..2c20a58f94cd 100644
--- a/include/asm-xtensa/cacheasm.h
+++ b/arch/xtensa/include/asm/cacheasm.h
diff --git a/include/asm-xtensa/cacheflush.h b/arch/xtensa/include/asm/cacheflush.h
index 94c4c53a099e..94c4c53a099e 100644
--- a/include/asm-xtensa/cacheflush.h
+++ b/arch/xtensa/include/asm/cacheflush.h
diff --git a/include/asm-xtensa/checksum.h b/arch/xtensa/include/asm/checksum.h
index 23534c60b3a4..f84d3f00774a 100644
--- a/include/asm-xtensa/checksum.h
+++ b/arch/xtensa/include/asm/checksum.h
@@ -12,7 +12,7 @@
12#define _XTENSA_CHECKSUM_H 12#define _XTENSA_CHECKSUM_H
13 13
14#include <linux/in6.h> 14#include <linux/in6.h>
15#include <asm/variant/core.h> 15#include <variant/core.h>
16 16
17/* 17/*
18 * computes the checksum of a memory block at buff, length len, 18 * computes the checksum of a memory block at buff, length len,
diff --git a/include/asm-xtensa/coprocessor.h b/arch/xtensa/include/asm/coprocessor.h
index 1cbcf9001a41..65a285d8d3fb 100644
--- a/include/asm-xtensa/coprocessor.h
+++ b/arch/xtensa/include/asm/coprocessor.h
@@ -13,11 +13,11 @@
13#define _XTENSA_COPROCESSOR_H 13#define _XTENSA_COPROCESSOR_H
14 14
15#include <linux/stringify.h> 15#include <linux/stringify.h>
16#include <asm/variant/tie.h> 16#include <variant/tie.h>
17#include <asm/types.h> 17#include <asm/types.h>
18 18
19#ifdef __ASSEMBLY__ 19#ifdef __ASSEMBLY__
20# include <asm/variant/tie-asm.h> 20# include <variant/tie-asm.h>
21 21
22.macro xchal_sa_start a b 22.macro xchal_sa_start a b
23 .set .Lxchal_pofs_, 0 23 .set .Lxchal_pofs_, 0
diff --git a/include/asm-xtensa/cpumask.h b/arch/xtensa/include/asm/cpumask.h
index ebeede397db3..ebeede397db3 100644
--- a/include/asm-xtensa/cpumask.h
+++ b/arch/xtensa/include/asm/cpumask.h
diff --git a/include/asm-xtensa/cputime.h b/arch/xtensa/include/asm/cputime.h
index a7fb864a50ae..a7fb864a50ae 100644
--- a/include/asm-xtensa/cputime.h
+++ b/arch/xtensa/include/asm/cputime.h
diff --git a/include/asm-xtensa/current.h b/arch/xtensa/include/asm/current.h
index 8d1eb5d78649..8d1eb5d78649 100644
--- a/include/asm-xtensa/current.h
+++ b/arch/xtensa/include/asm/current.h
diff --git a/include/asm-xtensa/delay.h b/arch/xtensa/include/asm/delay.h
index e1d8c9e010c1..e1d8c9e010c1 100644
--- a/include/asm-xtensa/delay.h
+++ b/arch/xtensa/include/asm/delay.h
diff --git a/include/asm-xtensa/device.h b/arch/xtensa/include/asm/device.h
index d8f9872b0e2d..d8f9872b0e2d 100644
--- a/include/asm-xtensa/device.h
+++ b/arch/xtensa/include/asm/device.h
diff --git a/include/asm-xtensa/div64.h b/arch/xtensa/include/asm/div64.h
index f35678cb0a9b..f35678cb0a9b 100644
--- a/include/asm-xtensa/div64.h
+++ b/arch/xtensa/include/asm/div64.h
diff --git a/include/asm-xtensa/dma-mapping.h b/arch/xtensa/include/asm/dma-mapping.h
index 51882ae3db4d..51882ae3db4d 100644
--- a/include/asm-xtensa/dma-mapping.h
+++ b/arch/xtensa/include/asm/dma-mapping.h
diff --git a/include/asm-xtensa/dma.h b/arch/xtensa/include/asm/dma.h
index e30f3abf48f0..e30f3abf48f0 100644
--- a/include/asm-xtensa/dma.h
+++ b/arch/xtensa/include/asm/dma.h
diff --git a/include/asm-xtensa/elf.h b/arch/xtensa/include/asm/elf.h
index c3f53e755ca5..c3f53e755ca5 100644
--- a/include/asm-xtensa/elf.h
+++ b/arch/xtensa/include/asm/elf.h
diff --git a/include/asm-xtensa/emergency-restart.h b/arch/xtensa/include/asm/emergency-restart.h
index 108d8c48e42e..108d8c48e42e 100644
--- a/include/asm-xtensa/emergency-restart.h
+++ b/arch/xtensa/include/asm/emergency-restart.h
diff --git a/include/asm-xtensa/errno.h b/arch/xtensa/include/asm/errno.h
index a0f3b96b79b4..a0f3b96b79b4 100644
--- a/include/asm-xtensa/errno.h
+++ b/arch/xtensa/include/asm/errno.h
diff --git a/include/asm-xtensa/fb.h b/arch/xtensa/include/asm/fb.h
index c7df38030992..c7df38030992 100644
--- a/include/asm-xtensa/fb.h
+++ b/arch/xtensa/include/asm/fb.h
diff --git a/include/asm-xtensa/fcntl.h b/arch/xtensa/include/asm/fcntl.h
index 46ab12db5739..46ab12db5739 100644
--- a/include/asm-xtensa/fcntl.h
+++ b/arch/xtensa/include/asm/fcntl.h
diff --git a/include/asm-xtensa/futex.h b/arch/xtensa/include/asm/futex.h
index 0b745828f42b..0b745828f42b 100644
--- a/include/asm-xtensa/futex.h
+++ b/arch/xtensa/include/asm/futex.h
diff --git a/include/asm-xtensa/hardirq.h b/arch/xtensa/include/asm/hardirq.h
index 87cb19d1b10c..87cb19d1b10c 100644
--- a/include/asm-xtensa/hardirq.h
+++ b/arch/xtensa/include/asm/hardirq.h
diff --git a/include/asm-xtensa/highmem.h b/arch/xtensa/include/asm/highmem.h
index 0a046ca5a687..0a046ca5a687 100644
--- a/include/asm-xtensa/highmem.h
+++ b/arch/xtensa/include/asm/highmem.h
diff --git a/include/asm-xtensa/hw_irq.h b/arch/xtensa/include/asm/hw_irq.h
index 3ddbea759b2b..3ddbea759b2b 100644
--- a/include/asm-xtensa/hw_irq.h
+++ b/arch/xtensa/include/asm/hw_irq.h
diff --git a/include/asm-xtensa/io.h b/arch/xtensa/include/asm/io.h
index 07b7299dab20..07b7299dab20 100644
--- a/include/asm-xtensa/io.h
+++ b/arch/xtensa/include/asm/io.h
diff --git a/include/asm-xtensa/ioctl.h b/arch/xtensa/include/asm/ioctl.h
index b279fe06dfe5..b279fe06dfe5 100644
--- a/include/asm-xtensa/ioctl.h
+++ b/arch/xtensa/include/asm/ioctl.h
diff --git a/include/asm-xtensa/ioctls.h b/arch/xtensa/include/asm/ioctls.h
index 0ffa942954b9..0ffa942954b9 100644
--- a/include/asm-xtensa/ioctls.h
+++ b/arch/xtensa/include/asm/ioctls.h
diff --git a/include/asm-xtensa/ipcbuf.h b/arch/xtensa/include/asm/ipcbuf.h
index c33aa6a42145..c33aa6a42145 100644
--- a/include/asm-xtensa/ipcbuf.h
+++ b/arch/xtensa/include/asm/ipcbuf.h
diff --git a/include/asm-xtensa/irq.h b/arch/xtensa/include/asm/irq.h
index fc73b7f11aff..1620d1e0e695 100644
--- a/include/asm-xtensa/irq.h
+++ b/arch/xtensa/include/asm/irq.h
@@ -11,8 +11,8 @@
11#ifndef _XTENSA_IRQ_H 11#ifndef _XTENSA_IRQ_H
12#define _XTENSA_IRQ_H 12#define _XTENSA_IRQ_H
13 13
14#include <asm/platform/hardware.h> 14#include <platform/hardware.h>
15#include <asm/variant/core.h> 15#include <variant/core.h>
16 16
17#ifndef PLATFORM_NR_IRQS 17#ifndef PLATFORM_NR_IRQS
18# define PLATFORM_NR_IRQS 0 18# define PLATFORM_NR_IRQS 0
diff --git a/include/asm-xtensa/irq_regs.h b/arch/xtensa/include/asm/irq_regs.h
index 3dd9c0b70270..3dd9c0b70270 100644
--- a/include/asm-xtensa/irq_regs.h
+++ b/arch/xtensa/include/asm/irq_regs.h
diff --git a/include/asm-xtensa/kdebug.h b/arch/xtensa/include/asm/kdebug.h
index 6ece1b037665..6ece1b037665 100644
--- a/include/asm-xtensa/kdebug.h
+++ b/arch/xtensa/include/asm/kdebug.h
diff --git a/include/asm-xtensa/kmap_types.h b/arch/xtensa/include/asm/kmap_types.h
index 9e822d2e3bce..9e822d2e3bce 100644
--- a/include/asm-xtensa/kmap_types.h
+++ b/arch/xtensa/include/asm/kmap_types.h
diff --git a/include/asm-xtensa/linkage.h b/arch/xtensa/include/asm/linkage.h
index bf2128a99d79..bf2128a99d79 100644
--- a/include/asm-xtensa/linkage.h
+++ b/arch/xtensa/include/asm/linkage.h
diff --git a/include/asm-xtensa/local.h b/arch/xtensa/include/asm/local.h
index 48723e550d14..48723e550d14 100644
--- a/include/asm-xtensa/local.h
+++ b/arch/xtensa/include/asm/local.h
diff --git a/include/asm-xtensa/mman.h b/arch/xtensa/include/asm/mman.h
index 9b92620c8a1e..9b92620c8a1e 100644
--- a/include/asm-xtensa/mman.h
+++ b/arch/xtensa/include/asm/mman.h
diff --git a/include/asm-xtensa/mmu.h b/arch/xtensa/include/asm/mmu.h
index 44c5bb04c55c..44c5bb04c55c 100644
--- a/include/asm-xtensa/mmu.h
+++ b/arch/xtensa/include/asm/mmu.h
diff --git a/include/asm-xtensa/mmu_context.h b/arch/xtensa/include/asm/mmu_context.h
index c0fd8e5b4513..c0fd8e5b4513 100644
--- a/include/asm-xtensa/mmu_context.h
+++ b/arch/xtensa/include/asm/mmu_context.h
diff --git a/include/asm-xtensa/module.h b/arch/xtensa/include/asm/module.h
index d9b34bee4d42..d9b34bee4d42 100644
--- a/include/asm-xtensa/module.h
+++ b/arch/xtensa/include/asm/module.h
diff --git a/include/asm-xtensa/msgbuf.h b/arch/xtensa/include/asm/msgbuf.h
index 693c96755280..693c96755280 100644
--- a/include/asm-xtensa/msgbuf.h
+++ b/arch/xtensa/include/asm/msgbuf.h
diff --git a/include/asm-xtensa/mutex.h b/arch/xtensa/include/asm/mutex.h
index 458c1f7fbc18..458c1f7fbc18 100644
--- a/include/asm-xtensa/mutex.h
+++ b/arch/xtensa/include/asm/mutex.h
diff --git a/include/asm-xtensa/page.h b/arch/xtensa/include/asm/page.h
index 11f7dc2dbec7..11f7dc2dbec7 100644
--- a/include/asm-xtensa/page.h
+++ b/arch/xtensa/include/asm/page.h
diff --git a/include/asm-xtensa/param.h b/arch/xtensa/include/asm/param.h
index ba03d5aeab6b..ba03d5aeab6b 100644
--- a/include/asm-xtensa/param.h
+++ b/arch/xtensa/include/asm/param.h
diff --git a/include/asm-xtensa/pci-bridge.h b/arch/xtensa/include/asm/pci-bridge.h
index 00fcbd7c534a..00fcbd7c534a 100644
--- a/include/asm-xtensa/pci-bridge.h
+++ b/arch/xtensa/include/asm/pci-bridge.h
diff --git a/include/asm-xtensa/pci.h b/arch/xtensa/include/asm/pci.h
index 66410acf18b4..66410acf18b4 100644
--- a/include/asm-xtensa/pci.h
+++ b/arch/xtensa/include/asm/pci.h
diff --git a/include/asm-xtensa/percpu.h b/arch/xtensa/include/asm/percpu.h
index 6d2bc2ada9d1..6d2bc2ada9d1 100644
--- a/include/asm-xtensa/percpu.h
+++ b/arch/xtensa/include/asm/percpu.h
diff --git a/include/asm-xtensa/pgalloc.h b/arch/xtensa/include/asm/pgalloc.h
index 4f4a7987eded..4f4a7987eded 100644
--- a/include/asm-xtensa/pgalloc.h
+++ b/arch/xtensa/include/asm/pgalloc.h
diff --git a/include/asm-xtensa/pgtable.h b/arch/xtensa/include/asm/pgtable.h
index 8014d96b21f1..8014d96b21f1 100644
--- a/include/asm-xtensa/pgtable.h
+++ b/arch/xtensa/include/asm/pgtable.h
diff --git a/include/asm-xtensa/platform.h b/arch/xtensa/include/asm/platform.h
index 48135a9718b0..e3d5a48ad495 100644
--- a/include/asm-xtensa/platform.h
+++ b/arch/xtensa/include/asm/platform.h
@@ -1,6 +1,4 @@
1/* 1/*
2 * include/asm-xtensa/platform.h
3 *
4 * Platform specific functions 2 * Platform specific functions
5 * 3 *
6 * This file is subject to the terms and conditions of the GNU General 4 * This file is subject to the terms and conditions of the GNU General
diff --git a/include/asm-xtensa/poll.h b/arch/xtensa/include/asm/poll.h
index 9d2d5993f068..9d2d5993f068 100644
--- a/include/asm-xtensa/poll.h
+++ b/arch/xtensa/include/asm/poll.h
diff --git a/include/asm-xtensa/posix_types.h b/arch/xtensa/include/asm/posix_types.h
index 43f9dd1126a4..43f9dd1126a4 100644
--- a/include/asm-xtensa/posix_types.h
+++ b/arch/xtensa/include/asm/posix_types.h
diff --git a/include/asm-xtensa/processor.h b/arch/xtensa/include/asm/processor.h
index 4918a4e96d42..07387d3b99f4 100644
--- a/include/asm-xtensa/processor.h
+++ b/arch/xtensa/include/asm/processor.h
@@ -11,7 +11,7 @@
11#ifndef _XTENSA_PROCESSOR_H 11#ifndef _XTENSA_PROCESSOR_H
12#define _XTENSA_PROCESSOR_H 12#define _XTENSA_PROCESSOR_H
13 13
14#include <asm/variant/core.h> 14#include <variant/core.h>
15#include <asm/coprocessor.h> 15#include <asm/coprocessor.h>
16 16
17#include <linux/compiler.h> 17#include <linux/compiler.h>
diff --git a/include/asm-xtensa/ptrace.h b/arch/xtensa/include/asm/ptrace.h
index 089b0db44816..905e1e619654 100644
--- a/include/asm-xtensa/ptrace.h
+++ b/arch/xtensa/include/asm/ptrace.h
@@ -111,7 +111,7 @@ struct pt_regs {
111 unsigned long areg[16]; /* 128 (64) */ 111 unsigned long areg[16]; /* 128 (64) */
112}; 112};
113 113
114#include <asm/variant/core.h> 114#include <variant/core.h>
115 115
116# define task_pt_regs(tsk) ((struct pt_regs*) \ 116# define task_pt_regs(tsk) ((struct pt_regs*) \
117 (task_stack_page(tsk) + KERNEL_STACK_SIZE - (XCHAL_NUM_AREGS-16)*4) - 1) 117 (task_stack_page(tsk) + KERNEL_STACK_SIZE - (XCHAL_NUM_AREGS-16)*4) - 1)
diff --git a/include/asm-xtensa/regs.h b/arch/xtensa/include/asm/regs.h
index d4baed246928..d4baed246928 100644
--- a/include/asm-xtensa/regs.h
+++ b/arch/xtensa/include/asm/regs.h
diff --git a/include/asm-xtensa/resource.h b/arch/xtensa/include/asm/resource.h
index 17b5ab311771..17b5ab311771 100644
--- a/include/asm-xtensa/resource.h
+++ b/arch/xtensa/include/asm/resource.h
diff --git a/include/asm-xtensa/rmap.h b/arch/xtensa/include/asm/rmap.h
index 649588b7e9ad..649588b7e9ad 100644
--- a/include/asm-xtensa/rmap.h
+++ b/arch/xtensa/include/asm/rmap.h
diff --git a/include/asm-xtensa/rwsem.h b/arch/xtensa/include/asm/rwsem.h
index e39edf5c86f2..e39edf5c86f2 100644
--- a/include/asm-xtensa/rwsem.h
+++ b/arch/xtensa/include/asm/rwsem.h
diff --git a/include/asm-xtensa/scatterlist.h b/arch/xtensa/include/asm/scatterlist.h
index 810080bb0a2b..810080bb0a2b 100644
--- a/include/asm-xtensa/scatterlist.h
+++ b/arch/xtensa/include/asm/scatterlist.h
diff --git a/include/asm-xtensa/sections.h b/arch/xtensa/include/asm/sections.h
index 40b5191b55a2..40b5191b55a2 100644
--- a/include/asm-xtensa/sections.h
+++ b/arch/xtensa/include/asm/sections.h
diff --git a/include/asm-xtensa/segment.h b/arch/xtensa/include/asm/segment.h
index a2eb547a1a75..a2eb547a1a75 100644
--- a/include/asm-xtensa/segment.h
+++ b/arch/xtensa/include/asm/segment.h
diff --git a/include/asm-xtensa/sembuf.h b/arch/xtensa/include/asm/sembuf.h
index c15870493b33..c15870493b33 100644
--- a/include/asm-xtensa/sembuf.h
+++ b/arch/xtensa/include/asm/sembuf.h
diff --git a/include/asm-xtensa/serial.h b/arch/xtensa/include/asm/serial.h
index ec04114fcf0b..a8a2493260f6 100644
--- a/include/asm-xtensa/serial.h
+++ b/arch/xtensa/include/asm/serial.h
@@ -13,6 +13,6 @@
13#ifndef _XTENSA_SERIAL_H 13#ifndef _XTENSA_SERIAL_H
14#define _XTENSA_SERIAL_H 14#define _XTENSA_SERIAL_H
15 15
16#include <asm/platform/serial.h> 16#include <platform/serial.h>
17 17
18#endif /* _XTENSA_SERIAL_H */ 18#endif /* _XTENSA_SERIAL_H */
diff --git a/include/asm-xtensa/setup.h b/arch/xtensa/include/asm/setup.h
index e3636520d8cc..e3636520d8cc 100644
--- a/include/asm-xtensa/setup.h
+++ b/arch/xtensa/include/asm/setup.h
diff --git a/include/asm-xtensa/shmbuf.h b/arch/xtensa/include/asm/shmbuf.h
index ad4b0121782c..ad4b0121782c 100644
--- a/include/asm-xtensa/shmbuf.h
+++ b/arch/xtensa/include/asm/shmbuf.h
diff --git a/include/asm-xtensa/shmparam.h b/arch/xtensa/include/asm/shmparam.h
index c8cc16c3da9e..c8cc16c3da9e 100644
--- a/include/asm-xtensa/shmparam.h
+++ b/arch/xtensa/include/asm/shmparam.h
diff --git a/include/asm-xtensa/sigcontext.h b/arch/xtensa/include/asm/sigcontext.h
index 03383af8c3b7..03383af8c3b7 100644
--- a/include/asm-xtensa/sigcontext.h
+++ b/arch/xtensa/include/asm/sigcontext.h
diff --git a/include/asm-xtensa/siginfo.h b/arch/xtensa/include/asm/siginfo.h
index 6916248295df..6916248295df 100644
--- a/include/asm-xtensa/siginfo.h
+++ b/arch/xtensa/include/asm/siginfo.h
diff --git a/include/asm-xtensa/signal.h b/arch/xtensa/include/asm/signal.h
index 633ba73bc4d2..633ba73bc4d2 100644
--- a/include/asm-xtensa/signal.h
+++ b/arch/xtensa/include/asm/signal.h
diff --git a/include/asm-xtensa/smp.h b/arch/xtensa/include/asm/smp.h
index 83c569e3bdbd..83c569e3bdbd 100644
--- a/include/asm-xtensa/smp.h
+++ b/arch/xtensa/include/asm/smp.h
diff --git a/include/asm-xtensa/socket.h b/arch/xtensa/include/asm/socket.h
index 6100682b1da2..6100682b1da2 100644
--- a/include/asm-xtensa/socket.h
+++ b/arch/xtensa/include/asm/socket.h
diff --git a/include/asm-xtensa/sockios.h b/arch/xtensa/include/asm/sockios.h
index efe0af379f01..efe0af379f01 100644
--- a/include/asm-xtensa/sockios.h
+++ b/arch/xtensa/include/asm/sockios.h
diff --git a/include/asm-xtensa/spinlock.h b/arch/xtensa/include/asm/spinlock.h
index 8ff23649581b..8ff23649581b 100644
--- a/include/asm-xtensa/spinlock.h
+++ b/arch/xtensa/include/asm/spinlock.h
diff --git a/include/asm-xtensa/stat.h b/arch/xtensa/include/asm/stat.h
index c4992038cee0..c4992038cee0 100644
--- a/include/asm-xtensa/stat.h
+++ b/arch/xtensa/include/asm/stat.h
diff --git a/include/asm-xtensa/statfs.h b/arch/xtensa/include/asm/statfs.h
index 9c3d1a213136..9c3d1a213136 100644
--- a/include/asm-xtensa/statfs.h
+++ b/arch/xtensa/include/asm/statfs.h
diff --git a/include/asm-xtensa/string.h b/arch/xtensa/include/asm/string.h
index 5fb8c27cbef5..5fb8c27cbef5 100644
--- a/include/asm-xtensa/string.h
+++ b/arch/xtensa/include/asm/string.h
diff --git a/include/asm-xtensa/byteorder.h b/arch/xtensa/include/asm/swab.h
index 765edf17a9a4..f50b697eb601 100644
--- a/include/asm-xtensa/byteorder.h
+++ b/arch/xtensa/include/asm/swab.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * include/asm-xtensa/byteorder.h 2 * include/asm-xtensa/swab.h
3 * 3 *
4 * This file is subject to the terms and conditions of the GNU General Public 4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive 5 * License. See the file "COPYING" in the main directory of this archive
@@ -8,13 +8,15 @@
8 * Copyright (C) 2001 - 2005 Tensilica Inc. 8 * Copyright (C) 2001 - 2005 Tensilica Inc.
9 */ 9 */
10 10
11#ifndef _XTENSA_BYTEORDER_H 11#ifndef _XTENSA_SWAB_H
12#define _XTENSA_BYTEORDER_H 12#define _XTENSA_SWAB_H
13 13
14#include <asm/types.h> 14#include <asm/types.h>
15#include <linux/compiler.h> 15#include <linux/compiler.h>
16 16
17static __inline__ __attribute_const__ __u32 ___arch__swab32(__u32 x) 17#define __SWAB_64_THRU_32__
18
19static inline __attribute_const__ __u32 __arch_swab32(__u32 x)
18{ 20{
19 __u32 res; 21 __u32 res;
20 /* instruction sequence from Xtensa ISA release 2/2000 */ 22 /* instruction sequence from Xtensa ISA release 2/2000 */
@@ -28,8 +30,9 @@ static __inline__ __attribute_const__ __u32 ___arch__swab32(__u32 x)
28 ); 30 );
29 return res; 31 return res;
30} 32}
33#define __arch_swab32 __arch_swab32
31 34
32static __inline__ __attribute_const__ __u16 ___arch__swab16(__u16 x) 35static inline __attribute_const__ __u16 __arch_swab16(__u16 x)
33{ 36{
34 /* Given that 'short' values are signed (i.e., can be negative), 37 /* Given that 'short' values are signed (i.e., can be negative),
35 * we cannot assume that the upper 16-bits of the register are 38 * we cannot assume that the upper 16-bits of the register are
@@ -62,21 +65,6 @@ static __inline__ __attribute_const__ __u16 ___arch__swab16(__u16 x)
62 65
63 return res; 66 return res;
64} 67}
68#define __arch_swab16 __arch_swab16
65 69
66#define __arch__swab32(x) ___arch__swab32(x) 70#endif /* _XTENSA_SWAB_H */
67#define __arch__swab16(x) ___arch__swab16(x)
68
69#if !defined(__STRICT_ANSI__) || defined(__KERNEL__)
70# define __BYTEORDER_HAS_U64__
71# define __SWAB_64_THRU_32__
72#endif
73
74#ifdef __XTENSA_EL__
75# include <linux/byteorder/little_endian.h>
76#elif defined(__XTENSA_EB__)
77# include <linux/byteorder/big_endian.h>
78#else
79# error processor byte order undefined!
80#endif
81
82#endif /* _XTENSA_BYTEORDER_H */
diff --git a/include/asm-xtensa/syscall.h b/arch/xtensa/include/asm/syscall.h
index 05cebf8f62b1..05cebf8f62b1 100644
--- a/include/asm-xtensa/syscall.h
+++ b/arch/xtensa/include/asm/syscall.h
diff --git a/include/asm-xtensa/system.h b/arch/xtensa/include/asm/system.h
index 62b1e8f3c13c..62b1e8f3c13c 100644
--- a/include/asm-xtensa/system.h
+++ b/arch/xtensa/include/asm/system.h
diff --git a/include/asm-xtensa/termbits.h b/arch/xtensa/include/asm/termbits.h
index 85aa6a3c0b6e..85aa6a3c0b6e 100644
--- a/include/asm-xtensa/termbits.h
+++ b/arch/xtensa/include/asm/termbits.h
diff --git a/include/asm-xtensa/termios.h b/arch/xtensa/include/asm/termios.h
index 4673f42f88a7..4673f42f88a7 100644
--- a/include/asm-xtensa/termios.h
+++ b/arch/xtensa/include/asm/termios.h
diff --git a/include/asm-xtensa/thread_info.h b/arch/xtensa/include/asm/thread_info.h
index 0f4fe1faf9ba..0f4fe1faf9ba 100644
--- a/include/asm-xtensa/thread_info.h
+++ b/arch/xtensa/include/asm/thread_info.h
diff --git a/include/asm-xtensa/timex.h b/arch/xtensa/include/asm/timex.h
index b83a8181d448..b83a8181d448 100644
--- a/include/asm-xtensa/timex.h
+++ b/arch/xtensa/include/asm/timex.h
diff --git a/include/asm-xtensa/tlb.h b/arch/xtensa/include/asm/tlb.h
index 31c220faca02..31c220faca02 100644
--- a/include/asm-xtensa/tlb.h
+++ b/arch/xtensa/include/asm/tlb.h
diff --git a/include/asm-xtensa/tlbflush.h b/arch/xtensa/include/asm/tlbflush.h
index 46d240074f74..46d240074f74 100644
--- a/include/asm-xtensa/tlbflush.h
+++ b/arch/xtensa/include/asm/tlbflush.h
diff --git a/include/asm-xtensa/topology.h b/arch/xtensa/include/asm/topology.h
index 7309e38a0ccb..7309e38a0ccb 100644
--- a/include/asm-xtensa/topology.h
+++ b/arch/xtensa/include/asm/topology.h
diff --git a/include/asm-xtensa/types.h b/arch/xtensa/include/asm/types.h
index c89569a8da0c..c89569a8da0c 100644
--- a/include/asm-xtensa/types.h
+++ b/arch/xtensa/include/asm/types.h
diff --git a/include/asm-xtensa/uaccess.h b/arch/xtensa/include/asm/uaccess.h
index b8528426ab1f..b8528426ab1f 100644
--- a/include/asm-xtensa/uaccess.h
+++ b/arch/xtensa/include/asm/uaccess.h
diff --git a/include/asm-xtensa/ucontext.h b/arch/xtensa/include/asm/ucontext.h
index 94c94ed3e00a..94c94ed3e00a 100644
--- a/include/asm-xtensa/ucontext.h
+++ b/arch/xtensa/include/asm/ucontext.h
diff --git a/include/asm-xtensa/unaligned.h b/arch/xtensa/include/asm/unaligned.h
index 8f3424fc5d18..8e7ed046bfed 100644
--- a/include/asm-xtensa/unaligned.h
+++ b/arch/xtensa/include/asm/unaligned.h
@@ -10,20 +10,20 @@
10#ifndef _ASM_XTENSA_UNALIGNED_H 10#ifndef _ASM_XTENSA_UNALIGNED_H
11#define _ASM_XTENSA_UNALIGNED_H 11#define _ASM_XTENSA_UNALIGNED_H
12 12
13#ifdef __XTENSA_EL__ 13#include <asm/byteorder.h>
14# include <linux/unaligned/le_memmove.h> 14
15#ifdef __LITTLE_ENDIAN
16# include <linux/unaligned/le_struct.h>
15# include <linux/unaligned/be_byteshift.h> 17# include <linux/unaligned/be_byteshift.h>
16# include <linux/unaligned/generic.h> 18# include <linux/unaligned/generic.h>
17# define get_unaligned __get_unaligned_le 19# define get_unaligned __get_unaligned_le
18# define put_unaligned __put_unaligned_le 20# define put_unaligned __put_unaligned_le
19#elif defined(__XTENSA_EB__) 21#else
20# include <linux/unaligned/be_memmove.h> 22# include <linux/unaligned/be_struct.h>
21# include <linux/unaligned/le_byteshift.h> 23# include <linux/unaligned/le_byteshift.h>
22# include <linux/unaligned/generic.h> 24# include <linux/unaligned/generic.h>
23# define get_unaligned __get_unaligned_be 25# define get_unaligned __get_unaligned_be
24# define put_unaligned __put_unaligned_be 26# define put_unaligned __put_unaligned_be
25#else
26# error processor byte order undefined!
27#endif 27#endif
28 28
29#endif /* _ASM_XTENSA_UNALIGNED_H */ 29#endif /* _ASM_XTENSA_UNALIGNED_H */
diff --git a/include/asm-xtensa/unistd.h b/arch/xtensa/include/asm/unistd.h
index c092c8fbb2cf..c092c8fbb2cf 100644
--- a/include/asm-xtensa/unistd.h
+++ b/arch/xtensa/include/asm/unistd.h
diff --git a/include/asm-xtensa/user.h b/arch/xtensa/include/asm/user.h
index 2c3ed23354a8..2c3ed23354a8 100644
--- a/include/asm-xtensa/user.h
+++ b/arch/xtensa/include/asm/user.h
diff --git a/include/asm-xtensa/vga.h b/arch/xtensa/include/asm/vga.h
index 1fd8cab3a297..1fd8cab3a297 100644
--- a/include/asm-xtensa/vga.h
+++ b/arch/xtensa/include/asm/vga.h
diff --git a/include/asm-xtensa/xor.h b/arch/xtensa/include/asm/xor.h
index e7b1f083991d..e7b1f083991d 100644
--- a/include/asm-xtensa/xor.h
+++ b/arch/xtensa/include/asm/xor.h
diff --git a/arch/xtensa/kernel/entry.S b/arch/xtensa/kernel/entry.S
index dfd35dcc1cb5..a51d36a27389 100644
--- a/arch/xtensa/kernel/entry.S
+++ b/arch/xtensa/kernel/entry.S
@@ -25,7 +25,7 @@
25#include <asm/page.h> 25#include <asm/page.h>
26#include <asm/signal.h> 26#include <asm/signal.h>
27#include <asm/tlbflush.h> 27#include <asm/tlbflush.h>
28#include <asm/variant/tie-asm.h> 28#include <variant/tie-asm.h>
29 29
30/* Unimplemented features. */ 30/* Unimplemented features. */
31 31
diff --git a/arch/xtensa/kernel/vmlinux.lds.S b/arch/xtensa/kernel/vmlinux.lds.S
index 51f4fb6f16f9..d506774f4b05 100644
--- a/arch/xtensa/kernel/vmlinux.lds.S
+++ b/arch/xtensa/kernel/vmlinux.lds.S
@@ -16,7 +16,7 @@
16 16
17#include <asm-generic/vmlinux.lds.h> 17#include <asm-generic/vmlinux.lds.h>
18 18
19#include <asm/variant/core.h> 19#include <variant/core.h>
20OUTPUT_ARCH(xtensa) 20OUTPUT_ARCH(xtensa)
21ENTRY(_start) 21ENTRY(_start)
22 22
diff --git a/arch/xtensa/lib/checksum.S b/arch/xtensa/lib/checksum.S
index 9d9cd990afa6..df397f932d0e 100644
--- a/arch/xtensa/lib/checksum.S
+++ b/arch/xtensa/lib/checksum.S
@@ -16,7 +16,7 @@
16 16
17#include <asm/errno.h> 17#include <asm/errno.h>
18#include <linux/linkage.h> 18#include <linux/linkage.h>
19#include <asm/variant/core.h> 19#include <variant/core.h>
20 20
21/* 21/*
22 * computes a partial checksum, e.g. for TCP/UDP fragments 22 * computes a partial checksum, e.g. for TCP/UDP fragments
diff --git a/arch/xtensa/lib/memcopy.S b/arch/xtensa/lib/memcopy.S
index ddda8f4bc862..ea59dcd03866 100644
--- a/arch/xtensa/lib/memcopy.S
+++ b/arch/xtensa/lib/memcopy.S
@@ -9,7 +9,7 @@
9 * Copyright (C) 2002 - 2005 Tensilica Inc. 9 * Copyright (C) 2002 - 2005 Tensilica Inc.
10 */ 10 */
11 11
12#include <asm/variant/core.h> 12#include <variant/core.h>
13 13
14 .macro src_b r, w0, w1 14 .macro src_b r, w0, w1
15#ifdef __XTENSA_EB__ 15#ifdef __XTENSA_EB__
diff --git a/arch/xtensa/lib/memset.S b/arch/xtensa/lib/memset.S
index 56a17495b2db..10b8c400f175 100644
--- a/arch/xtensa/lib/memset.S
+++ b/arch/xtensa/lib/memset.S
@@ -11,7 +11,7 @@
11 * Copyright (C) 2002 Tensilica Inc. 11 * Copyright (C) 2002 Tensilica Inc.
12 */ 12 */
13 13
14#include <asm/variant/core.h> 14#include <variant/core.h>
15 15
16/* 16/*
17 * void *memset(void *dst, int c, size_t length) 17 * void *memset(void *dst, int c, size_t length)
diff --git a/arch/xtensa/lib/strncpy_user.S b/arch/xtensa/lib/strncpy_user.S
index b2655d94558d..9f603cdaaa68 100644
--- a/arch/xtensa/lib/strncpy_user.S
+++ b/arch/xtensa/lib/strncpy_user.S
@@ -11,7 +11,7 @@
11 * Copyright (C) 2002 Tensilica Inc. 11 * Copyright (C) 2002 Tensilica Inc.
12 */ 12 */
13 13
14#include <asm/variant/core.h> 14#include <variant/core.h>
15#include <linux/errno.h> 15#include <linux/errno.h>
16 16
17/* Load or store instructions that may cause exceptions use the EX macro. */ 17/* Load or store instructions that may cause exceptions use the EX macro. */
diff --git a/arch/xtensa/lib/strnlen_user.S b/arch/xtensa/lib/strnlen_user.S
index ad3f616322ca..23f2a89816a1 100644
--- a/arch/xtensa/lib/strnlen_user.S
+++ b/arch/xtensa/lib/strnlen_user.S
@@ -11,7 +11,7 @@
11 * Copyright (C) 2002 Tensilica Inc. 11 * Copyright (C) 2002 Tensilica Inc.
12 */ 12 */
13 13
14#include <asm/variant/core.h> 14#include <variant/core.h>
15 15
16/* Load or store instructions that may cause exceptions use the EX macro. */ 16/* Load or store instructions that may cause exceptions use the EX macro. */
17 17
diff --git a/arch/xtensa/lib/usercopy.S b/arch/xtensa/lib/usercopy.S
index a8ab1d4fe0ae..46d60314bb16 100644
--- a/arch/xtensa/lib/usercopy.S
+++ b/arch/xtensa/lib/usercopy.S
@@ -53,7 +53,7 @@
53 * a11/ original length 53 * a11/ original length
54 */ 54 */
55 55
56#include <asm/variant/core.h> 56#include <variant/core.h>
57 57
58#ifdef __XTENSA_EB__ 58#ifdef __XTENSA_EB__
59#define ALIGN(R, W0, W1) src R, W0, W1 59#define ALIGN(R, W0, W1) src R, W0, W1
diff --git a/arch/xtensa/platforms/iss/console.c b/arch/xtensa/platforms/iss/console.c
index 9141e3690731..efed8897bef3 100644
--- a/arch/xtensa/platforms/iss/console.c
+++ b/arch/xtensa/platforms/iss/console.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * arch/xtensa/platform-iss/console.c 2 * arch/xtensa/platforms/iss/console.c
3 * 3 *
4 * This file is subject to the terms and conditions of the GNU General Public 4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive 5 * License. See the file "COPYING" in the main directory of this archive
@@ -24,7 +24,7 @@
24#include <asm/uaccess.h> 24#include <asm/uaccess.h>
25#include <asm/irq.h> 25#include <asm/irq.h>
26 26
27#include <asm/platform/simcall.h> 27#include <platform/simcall.h>
28 28
29#include <linux/tty.h> 29#include <linux/tty.h>
30#include <linux/tty_flip.h> 30#include <linux/tty_flip.h>
diff --git a/include/asm-xtensa/platform-iss/hardware.h b/arch/xtensa/platforms/iss/include/platform/hardware.h
index 6930c12adc16..6930c12adc16 100644
--- a/include/asm-xtensa/platform-iss/hardware.h
+++ b/arch/xtensa/platforms/iss/include/platform/hardware.h
diff --git a/include/asm-xtensa/platform-iss/simcall.h b/arch/xtensa/platforms/iss/include/platform/simcall.h
index b7952c06a2b7..b7952c06a2b7 100644
--- a/include/asm-xtensa/platform-iss/simcall.h
+++ b/arch/xtensa/platforms/iss/include/platform/simcall.h
diff --git a/arch/xtensa/platforms/iss/io.c b/arch/xtensa/platforms/iss/io.c
index 5b161a5cb65f..571d0b24f895 100644
--- a/arch/xtensa/platforms/iss/io.c
+++ b/arch/xtensa/platforms/iss/io.c
@@ -3,7 +3,7 @@
3#if 0 3#if 0
4 4
5#include <asm/io.h> 5#include <asm/io.h>
6#include <xtensa/simcall.h> 6#include <platform/platform-iss/simcall.h>
7 7
8extern int __simc (); 8extern int __simc ();
9 9
diff --git a/arch/xtensa/platforms/iss/network.c b/arch/xtensa/platforms/iss/network.c
index 64f057d89e73..edad4156d89a 100644
--- a/arch/xtensa/platforms/iss/network.c
+++ b/arch/xtensa/platforms/iss/network.c
@@ -1,6 +1,6 @@
1/* 1/*
2 * 2 *
3 * arch/xtensa/platform-iss/network.c 3 * arch/xtensa/platforms/iss/network.c
4 * 4 *
5 * Platform specific initialization. 5 * Platform specific initialization.
6 * 6 *
@@ -33,7 +33,7 @@
33#include <linux/rtnetlink.h> 33#include <linux/rtnetlink.h>
34#include <linux/platform_device.h> 34#include <linux/platform_device.h>
35 35
36#include <asm/platform/simcall.h> 36#include <platform/simcall.h>
37 37
38#define DRIVER_NAME "iss-netdev" 38#define DRIVER_NAME "iss-netdev"
39#define ETH_MAX_PACKET 1500 39#define ETH_MAX_PACKET 1500
diff --git a/arch/xtensa/platforms/xt2000/Makefile b/arch/xtensa/platforms/xt2000/Makefile
new file mode 100644
index 000000000000..54d018e45bfc
--- /dev/null
+++ b/arch/xtensa/platforms/xt2000/Makefile
@@ -0,0 +1,5 @@
1#
2# Makefile for the Tensilica XT2000 Emulation Board
3#
4
5obj-y = setup.o
diff --git a/arch/xtensa/platforms/xt2000/include/platform/hardware.h b/arch/xtensa/platforms/xt2000/include/platform/hardware.h
new file mode 100644
index 000000000000..41459ad07766
--- /dev/null
+++ b/arch/xtensa/platforms/xt2000/include/platform/hardware.h
@@ -0,0 +1,55 @@
1/*
2 * platform/hardware.h
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (C) 2001 Tensilica Inc.
9 */
10
11/*
12 * This file contains the hardware configuration of the XT2000 board.
13 */
14
15#ifndef _XTENSA_XT2000_HARDWARE_H
16#define _XTENSA_XT2000_HARDWARE_H
17
18#include <variant/core.h>
19#include <asm/io.h>
20
21/*
22 * Memory configuration.
23 */
24
25#define PLATFORM_DEFAULT_MEM_START 0x00000000
26#define PLATFORM_DEFAULT_MEM_SIZE 0x08000000
27
28/*
29 * Number of platform IRQs
30 */
31#define PLATFORM_NR_IRQS 3
32/*
33 * On-board components.
34 */
35
36#define SONIC83934_INTNUM XCHAL_EXTINT3_NUM
37#define SONIC83934_ADDR IOADDR(0x0d030000)
38
39/*
40 * V3-PCI
41 */
42
43/* The XT2000 uses the V3 as a cascaded interrupt controller for the PCI bus */
44
45#define IRQ_PCI_A (XCHAL_NUM_INTERRUPTS + 0)
46#define IRQ_PCI_B (XCHAL_NUM_INTERRUPTS + 1)
47#define IRQ_PCI_C (XCHAL_NUM_INTERRUPTS + 2)
48
49/*
50 * Various other components.
51 */
52
53#define XT2000_LED_ADDR IOADDR(0x0d040000)
54
55#endif /* _XTENSA_XT2000_HARDWARE_H */
diff --git a/arch/xtensa/platforms/xt2000/include/platform/serial.h b/arch/xtensa/platforms/xt2000/include/platform/serial.h
new file mode 100644
index 000000000000..7226cf732b47
--- /dev/null
+++ b/arch/xtensa/platforms/xt2000/include/platform/serial.h
@@ -0,0 +1,28 @@
1/*
2 * platform/serial.h
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (C) 2001 Tensilica Inc.
9 */
10
11#ifndef _XTENSA_XT2000_SERIAL_H
12#define _XTENSA_XT2000_SERIAL_H
13
14#include <variant/core.h>
15#include <asm/io.h>
16
17/* National-Semi PC16552D DUART: */
18
19#define DUART16552_1_INTNUM XCHAL_EXTINT4_NUM
20#define DUART16552_2_INTNUM XCHAL_EXTINT5_NUM
21
22#define DUART16552_1_ADDR IOADDR(0x0d050020) /* channel 1 */
23#define DUART16552_2_ADDR IOADDR(0x0d050000) /* channel 2 */
24
25#define DUART16552_XTAL_FREQ 18432000 /* crystal frequency in Hz */
26#define BASE_BAUD ( DUART16552_XTAL_FREQ / 16 )
27
28#endif /* _XTENSA_XT2000_SERIAL_H */
diff --git a/arch/xtensa/platforms/xt2000/setup.c b/arch/xtensa/platforms/xt2000/setup.c
new file mode 100644
index 000000000000..9e83940ac265
--- /dev/null
+++ b/arch/xtensa/platforms/xt2000/setup.c
@@ -0,0 +1,181 @@
1/*
2 * arch/xtensa/platforms/xt2000/setup.c
3 *
4 * Platform specific functions for the XT2000 board.
5 *
6 * Authors: Chris Zankel <chris@zankel.net>
7 * Joe Taylor <joe@tensilica.com>
8 *
9 * Copyright 2001 - 2004 Tensilica Inc.
10 *
11 * This program is free software; you can redistribute it and/or modify it
12 * under the terms of the GNU General Public License as published by the
13 * Free Software Foundation; either version 2 of the License, or (at your
14 * option) any later version.
15 *
16 */
17#include <linux/stddef.h>
18#include <linux/kernel.h>
19#include <linux/init.h>
20#include <linux/errno.h>
21#include <linux/reboot.h>
22#include <linux/kdev_t.h>
23#include <linux/types.h>
24#include <linux/major.h>
25#include <linux/console.h>
26#include <linux/delay.h>
27#include <linux/stringify.h>
28#include <linux/platform_device.h>
29#include <linux/serial.h>
30#include <linux/serial_8250.h>
31
32#include <asm/processor.h>
33#include <asm/platform.h>
34#include <asm/bootparam.h>
35#include <platform/hardware.h>
36#include <platform/serial.h>
37
38/* Assumes s points to an 8-chr string. No checking for NULL. */
39
40static void led_print (int f, char *s)
41{
42 unsigned long* led_addr = (unsigned long*) (XT2000_LED_ADDR + 0xE0) + f;
43 int i;
44 for (i = f; i < 8; i++)
45 if ((*led_addr++ = *s++) == 0)
46 break;
47}
48
49void platform_halt(void)
50{
51 led_print (0, " HALT ");
52 local_irq_disable();
53 while (1);
54}
55
56void platform_power_off(void)
57{
58 led_print (0, "POWEROFF");
59 local_irq_disable();
60 while (1);
61}
62
63void platform_restart(void)
64{
65 /* Flush and reset the mmu, simulate a processor reset, and
66 * jump to the reset vector. */
67
68 __asm__ __volatile__ ("movi a2, 15\n\t"
69 "wsr a2, " __stringify(ICOUNTLEVEL) "\n\t"
70 "movi a2, 0\n\t"
71 "wsr a2, " __stringify(ICOUNT) "\n\t"
72 "wsr a2, " __stringify(IBREAKENABLE) "\n\t"
73 "wsr a2, " __stringify(LCOUNT) "\n\t"
74 "movi a2, 0x1f\n\t"
75 "wsr a2, " __stringify(PS) "\n\t"
76 "isync\n\t"
77 "jx %0\n\t"
78 :
79 : "a" (XCHAL_RESET_VECTOR_VADDR)
80 : "a2"
81 );
82
83 /* control never gets here */
84}
85
86void __init platform_setup(char** cmdline)
87{
88 led_print (0, "LINUX ");
89}
90
91/* early initialization */
92
93extern sysmem_info_t __initdata sysmem;
94
95void platform_init(bp_tag_t* first)
96{
97 /* Set default memory block if not provided by the bootloader. */
98
99 if (sysmem.nr_banks == 0) {
100 sysmem.nr_banks = 1;
101 sysmem.bank[0].start = PLATFORM_DEFAULT_MEM_START;
102 sysmem.bank[0].end = PLATFORM_DEFAULT_MEM_START
103 + PLATFORM_DEFAULT_MEM_SIZE;
104 }
105}
106
107/* Heartbeat. Let the LED blink. */
108
109void platform_heartbeat(void)
110{
111 static int i=0, t = 0;
112
113 if (--t < 0)
114 {
115 t = 59;
116 led_print(7, i ? ".": " ");
117 i ^= 1;
118 }
119}
120
121//#define RS_TABLE_SIZE 2
122//#define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF|ASYNC_SKIP_TEST)
123
124#define _SERIAL_PORT(_base,_irq) \
125{ \
126 .mapbase = (_base), \
127 .membase = (void*)(_base), \
128 .irq = (_irq), \
129 .uartclk = DUART16552_XTAL_FREQ, \
130 .iotype = UPIO_MEM, \
131 .flags = UPF_BOOT_AUTOCONF, \
132 .regshift = 2, \
133}
134
135static struct plat_serial8250_port xt2000_serial_data[] = {
136#if XCHAL_HAVE_BE
137 _SERIAL_PORT(DUART16552_1_ADDR + 3, DUART16552_1_INTNUM),
138 _SERIAL_PORT(DUART16552_2_ADDR + 3, DUART16552_2_INTNUM),
139#else
140 _SERIAL_PORT(DUART16552_1_ADDR, DUART16552_1_INTNUM),
141 _SERIAL_PORT(DUART16552_2_ADDR, DUART16552_2_INTNUM),
142#endif
143 { }
144};
145
146static struct platform_device xt2000_serial8250_device = {
147 .name = "serial8250",
148 .id = PLAT8250_DEV_PLATFORM,
149 .dev = {
150 .platform_data = xt2000_serial_data,
151 },
152};
153
154static struct resource xt2000_sonic_res[] = {
155 {
156 .start = SONIC83934_ADDR,
157 .end = SONIC83934_ADDR + 0xff,
158 .flags = IORESOURCE_MEM,
159 },
160 {
161 .start = SONIC83934_INTNUM,
162 .end = SONIC83934_INTNUM,
163 .flags = IORESOURCE_IRQ,
164 },
165};
166
167static struct platform_device xt2000_sonic_device = {
168 .name = "xtsonic",
169 .num_resources = ARRAY_SIZE(xt2000_sonic_res),
170 .resource = xt2000_sonic_res,
171};
172
173static int __init xt2000_setup_devinit(void)
174{
175 platform_device_register(&xt2000_serial8250_device);
176 platform_device_register(&xt2000_sonic_device);
177
178 return 0;
179}
180
181device_initcall(xt2000_setup_devinit);
diff --git a/include/asm-xtensa/variant-dc232b/core.h b/arch/xtensa/variants/dc232b/include/variant/core.h
index 525bd3d90154..525bd3d90154 100644
--- a/include/asm-xtensa/variant-dc232b/core.h
+++ b/arch/xtensa/variants/dc232b/include/variant/core.h
diff --git a/include/asm-xtensa/variant-dc232b/tie-asm.h b/arch/xtensa/variants/dc232b/include/variant/tie-asm.h
index ed4f53f529db..ed4f53f529db 100644
--- a/include/asm-xtensa/variant-dc232b/tie-asm.h
+++ b/arch/xtensa/variants/dc232b/include/variant/tie-asm.h
diff --git a/include/asm-xtensa/variant-dc232b/tie.h b/arch/xtensa/variants/dc232b/include/variant/tie.h
index 018e81af4393..018e81af4393 100644
--- a/include/asm-xtensa/variant-dc232b/tie.h
+++ b/arch/xtensa/variants/dc232b/include/variant/tie.h
diff --git a/include/asm-xtensa/variant-fsf/core.h b/arch/xtensa/variants/fsf/include/variant/core.h
index 2f337605c744..2f337605c744 100644
--- a/include/asm-xtensa/variant-fsf/core.h
+++ b/arch/xtensa/variants/fsf/include/variant/core.h
diff --git a/include/asm-xtensa/variant-fsf/tie-asm.h b/arch/xtensa/variants/fsf/include/variant/tie-asm.h
index 68a73bf4ffc5..68a73bf4ffc5 100644
--- a/include/asm-xtensa/variant-fsf/tie-asm.h
+++ b/arch/xtensa/variants/fsf/include/variant/tie-asm.h
diff --git a/include/asm-xtensa/variant-fsf/tie.h b/arch/xtensa/variants/fsf/include/variant/tie.h
index bf4020116df5..bf4020116df5 100644
--- a/include/asm-xtensa/variant-fsf/tie.h
+++ b/arch/xtensa/variants/fsf/include/variant/tie.h
diff --git a/drivers/Makefile b/drivers/Makefile
index fceb71a741c3..e121b66ef082 100644
--- a/drivers/Makefile
+++ b/drivers/Makefile
@@ -57,6 +57,7 @@ obj-$(CONFIG_ATA_OVER_ETH) += block/aoe/
57obj-$(CONFIG_PARIDE) += block/paride/ 57obj-$(CONFIG_PARIDE) += block/paride/
58obj-$(CONFIG_TC) += tc/ 58obj-$(CONFIG_TC) += tc/
59obj-$(CONFIG_UWB) += uwb/ 59obj-$(CONFIG_UWB) += uwb/
60obj-$(CONFIG_USB_OTG_UTILS) += usb/otg/
60obj-$(CONFIG_USB) += usb/ 61obj-$(CONFIG_USB) += usb/
61obj-$(CONFIG_USB_MUSB_HDRC) += usb/musb/ 62obj-$(CONFIG_USB_MUSB_HDRC) += usb/musb/
62obj-$(CONFIG_PCI) += usb/ 63obj-$(CONFIG_PCI) += usb/
diff --git a/drivers/acpi/acpi_memhotplug.c b/drivers/acpi/acpi_memhotplug.c
index 63a17b55b39b..7a0f4aa4fa1e 100644
--- a/drivers/acpi/acpi_memhotplug.c
+++ b/drivers/acpi/acpi_memhotplug.c
@@ -20,7 +20,7 @@
20 * 20 *
21 * 21 *
22 * ACPI based HotPlug driver that supports Memory Hotplug 22 * ACPI based HotPlug driver that supports Memory Hotplug
23 * This driver fields notifications from firmare for memory add 23 * This driver fields notifications from firmware for memory add
24 * and remove operations and alerts the VM of the affected memory 24 * and remove operations and alerts the VM of the affected memory
25 * ranges. 25 * ranges.
26 */ 26 */
diff --git a/drivers/acpi/executer/exprep.c b/drivers/acpi/executer/exprep.c
index 5d438c32989d..a7dc87ecee37 100644
--- a/drivers/acpi/executer/exprep.c
+++ b/drivers/acpi/executer/exprep.c
@@ -404,7 +404,7 @@ acpi_ex_prep_common_field_object(union acpi_operand_object *obj_desc,
404 * 404 *
405 * RETURN: Status 405 * RETURN: Status
406 * 406 *
407 * DESCRIPTION: Construct an union acpi_operand_object of type def_field and 407 * DESCRIPTION: Construct a union acpi_operand_object of type def_field and
408 * connect it to the parent Node. 408 * connect it to the parent Node.
409 * 409 *
410 ******************************************************************************/ 410 ******************************************************************************/
diff --git a/drivers/acpi/executer/exresolv.c b/drivers/acpi/executer/exresolv.c
index 89571b92a522..60e8c47128e9 100644
--- a/drivers/acpi/executer/exresolv.c
+++ b/drivers/acpi/executer/exresolv.c
@@ -146,7 +146,7 @@ acpi_ex_resolve_object_to_value(union acpi_operand_object **stack_ptr,
146 146
147 stack_desc = *stack_ptr; 147 stack_desc = *stack_ptr;
148 148
149 /* This is an union acpi_operand_object */ 149 /* This is a union acpi_operand_object */
150 150
151 switch (ACPI_GET_OBJECT_TYPE(stack_desc)) { 151 switch (ACPI_GET_OBJECT_TYPE(stack_desc)) {
152 case ACPI_TYPE_LOCAL_REFERENCE: 152 case ACPI_TYPE_LOCAL_REFERENCE:
diff --git a/drivers/acpi/executer/exstore.c b/drivers/acpi/executer/exstore.c
index 3318df4cbd98..1c118ba78adb 100644
--- a/drivers/acpi/executer/exstore.c
+++ b/drivers/acpi/executer/exstore.c
@@ -274,7 +274,7 @@ acpi_ex_do_debug_object(union acpi_operand_object *source_desc,
274 * 274 *
275 * PARAMETERS: *source_desc - Value to be stored 275 * PARAMETERS: *source_desc - Value to be stored
276 * *dest_desc - Where to store it. Must be an NS node 276 * *dest_desc - Where to store it. Must be an NS node
277 * or an union acpi_operand_object of type 277 * or a union acpi_operand_object of type
278 * Reference; 278 * Reference;
279 * walk_state - Current walk state 279 * walk_state - Current walk state
280 * 280 *
diff --git a/drivers/acpi/resources/rscreate.c b/drivers/acpi/resources/rscreate.c
index c0bbfa2c4193..08b8d73e6ee5 100644
--- a/drivers/acpi/resources/rscreate.c
+++ b/drivers/acpi/resources/rscreate.c
@@ -124,7 +124,7 @@ acpi_rs_create_resource_list(union acpi_operand_object *aml_buffer,
124 * 124 *
125 * FUNCTION: acpi_rs_create_pci_routing_table 125 * FUNCTION: acpi_rs_create_pci_routing_table
126 * 126 *
127 * PARAMETERS: package_object - Pointer to an union acpi_operand_object 127 * PARAMETERS: package_object - Pointer to a union acpi_operand_object
128 * package 128 * package
129 * output_buffer - Pointer to the user's buffer 129 * output_buffer - Pointer to the user's buffer
130 * 130 *
diff --git a/drivers/acpi/utilities/utobject.c b/drivers/acpi/utilities/utobject.c
index c354e7a42bcd..4bef3cfbaccb 100644
--- a/drivers/acpi/utilities/utobject.c
+++ b/drivers/acpi/utilities/utobject.c
@@ -297,7 +297,7 @@ union acpi_operand_object *acpi_ut_create_string_object(acpi_size string_size)
297 * 297 *
298 * RETURN: TRUE if object is valid, FALSE otherwise 298 * RETURN: TRUE if object is valid, FALSE otherwise
299 * 299 *
300 * DESCRIPTION: Validate a pointer to be an union acpi_operand_object 300 * DESCRIPTION: Validate a pointer to be a union acpi_operand_object
301 * 301 *
302 ******************************************************************************/ 302 ******************************************************************************/
303 303
@@ -389,7 +389,7 @@ void acpi_ut_delete_object_desc(union acpi_operand_object *object)
389{ 389{
390 ACPI_FUNCTION_TRACE_PTR(ut_delete_object_desc, object); 390 ACPI_FUNCTION_TRACE_PTR(ut_delete_object_desc, object);
391 391
392 /* Object must be an union acpi_operand_object */ 392 /* Object must be a union acpi_operand_object */
393 393
394 if (ACPI_GET_DESCRIPTOR_TYPE(object) != ACPI_DESC_TYPE_OPERAND) { 394 if (ACPI_GET_DESCRIPTOR_TYPE(object) != ACPI_DESC_TYPE_OPERAND) {
395 ACPI_ERROR((AE_INFO, 395 ACPI_ERROR((AE_INFO,
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index fecca4223f8e..f178a450ec08 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -56,6 +56,7 @@
56#include <linux/workqueue.h> 56#include <linux/workqueue.h>
57#include <linux/scatterlist.h> 57#include <linux/scatterlist.h>
58#include <linux/io.h> 58#include <linux/io.h>
59#include <linux/async.h>
59#include <scsi/scsi.h> 60#include <scsi/scsi.h>
60#include <scsi/scsi_cmnd.h> 61#include <scsi/scsi_cmnd.h>
61#include <scsi/scsi_host.h> 62#include <scsi/scsi_host.h>
@@ -5909,6 +5910,54 @@ void ata_host_init(struct ata_host *host, struct device *dev,
5909 host->ops = ops; 5910 host->ops = ops;
5910} 5911}
5911 5912
5913
5914static void async_port_probe(void *data, async_cookie_t cookie)
5915{
5916 int rc;
5917 struct ata_port *ap = data;
5918 /* probe */
5919 if (ap->ops->error_handler) {
5920 struct ata_eh_info *ehi = &ap->link.eh_info;
5921 unsigned long flags;
5922
5923 ata_port_probe(ap);
5924
5925 /* kick EH for boot probing */
5926 spin_lock_irqsave(ap->lock, flags);
5927
5928 ehi->probe_mask |= ATA_ALL_DEVICES;
5929 ehi->action |= ATA_EH_RESET | ATA_EH_LPM;
5930 ehi->flags |= ATA_EHI_NO_AUTOPSY | ATA_EHI_QUIET;
5931
5932 ap->pflags &= ~ATA_PFLAG_INITIALIZING;
5933 ap->pflags |= ATA_PFLAG_LOADING;
5934 ata_port_schedule_eh(ap);
5935
5936 spin_unlock_irqrestore(ap->lock, flags);
5937
5938 /* wait for EH to finish */
5939 ata_port_wait_eh(ap);
5940 } else {
5941 DPRINTK("ata%u: bus probe begin\n", ap->print_id);
5942 rc = ata_bus_probe(ap);
5943 DPRINTK("ata%u: bus probe end\n", ap->print_id);
5944
5945 if (rc) {
5946 /* FIXME: do something useful here?
5947 * Current libata behavior will
5948 * tear down everything when
5949 * the module is removed
5950 * or the h/w is unplugged.
5951 */
5952 }
5953 }
5954
5955 /* in order to keep device order, we need to synchronize at this point */
5956 async_synchronize_cookie(cookie);
5957
5958 ata_scsi_scan_host(ap, 1);
5959
5960}
5912/** 5961/**
5913 * ata_host_register - register initialized ATA host 5962 * ata_host_register - register initialized ATA host
5914 * @host: ATA host to register 5963 * @host: ATA host to register
@@ -5988,52 +6037,9 @@ int ata_host_register(struct ata_host *host, struct scsi_host_template *sht)
5988 DPRINTK("probe begin\n"); 6037 DPRINTK("probe begin\n");
5989 for (i = 0; i < host->n_ports; i++) { 6038 for (i = 0; i < host->n_ports; i++) {
5990 struct ata_port *ap = host->ports[i]; 6039 struct ata_port *ap = host->ports[i];
5991 6040 async_schedule(async_port_probe, ap);
5992 /* probe */
5993 if (ap->ops->error_handler) {
5994 struct ata_eh_info *ehi = &ap->link.eh_info;
5995 unsigned long flags;
5996
5997 ata_port_probe(ap);
5998
5999 /* kick EH for boot probing */
6000 spin_lock_irqsave(ap->lock, flags);
6001
6002 ehi->probe_mask |= ATA_ALL_DEVICES;
6003 ehi->action |= ATA_EH_RESET | ATA_EH_LPM;
6004 ehi->flags |= ATA_EHI_NO_AUTOPSY | ATA_EHI_QUIET;
6005
6006 ap->pflags &= ~ATA_PFLAG_INITIALIZING;
6007 ap->pflags |= ATA_PFLAG_LOADING;
6008 ata_port_schedule_eh(ap);
6009
6010 spin_unlock_irqrestore(ap->lock, flags);
6011
6012 /* wait for EH to finish */
6013 ata_port_wait_eh(ap);
6014 } else {
6015 DPRINTK("ata%u: bus probe begin\n", ap->print_id);
6016 rc = ata_bus_probe(ap);
6017 DPRINTK("ata%u: bus probe end\n", ap->print_id);
6018
6019 if (rc) {
6020 /* FIXME: do something useful here?
6021 * Current libata behavior will
6022 * tear down everything when
6023 * the module is removed
6024 * or the h/w is unplugged.
6025 */
6026 }
6027 }
6028 }
6029
6030 /* probes are done, now scan each port's disk(s) */
6031 DPRINTK("host probe begin\n");
6032 for (i = 0; i < host->n_ports; i++) {
6033 struct ata_port *ap = host->ports[i];
6034
6035 ata_scsi_scan_host(ap, 1);
6036 } 6041 }
6042 DPRINTK("probe end\n");
6037 6043
6038 return 0; 6044 return 0;
6039} 6045}
diff --git a/drivers/base/Kconfig b/drivers/base/Kconfig
index d8e8c49c0cbd..8f006f96ff53 100644
--- a/drivers/base/Kconfig
+++ b/drivers/base/Kconfig
@@ -54,7 +54,7 @@ config FIRMWARE_IN_KERNEL
54 such firmware, and do not wish to use an initrd. 54 such firmware, and do not wish to use an initrd.
55 55
56 This single option controls the inclusion of firmware for 56 This single option controls the inclusion of firmware for
57 every driver which uses request_firmare() and ships its 57 every driver which uses request_firmware() and ships its
58 firmware in the kernel source tree, to avoid a proliferation 58 firmware in the kernel source tree, to avoid a proliferation
59 of 'Include firmware for xxx device' options. 59 of 'Include firmware for xxx device' options.
60 60
diff --git a/drivers/base/topology.c b/drivers/base/topology.c
index a8bc1cbcfa7c..a778fb52b11f 100644
--- a/drivers/base/topology.c
+++ b/drivers/base/topology.c
@@ -28,6 +28,7 @@
28#include <linux/mm.h> 28#include <linux/mm.h>
29#include <linux/cpu.h> 29#include <linux/cpu.h>
30#include <linux/module.h> 30#include <linux/module.h>
31#include <linux/hardirq.h>
31#include <linux/topology.h> 32#include <linux/topology.h>
32 33
33#define define_one_ro(_name) \ 34#define define_one_ro(_name) \
diff --git a/drivers/block/ub.c b/drivers/block/ub.c
index 048d71d244d7..12fb816db7b0 100644
--- a/drivers/block/ub.c
+++ b/drivers/block/ub.c
@@ -1579,7 +1579,7 @@ static void ub_reset_task(struct work_struct *work)
1579 struct ub_dev *sc = container_of(work, struct ub_dev, reset_work); 1579 struct ub_dev *sc = container_of(work, struct ub_dev, reset_work);
1580 unsigned long flags; 1580 unsigned long flags;
1581 struct ub_lun *lun; 1581 struct ub_lun *lun;
1582 int lkr, rc; 1582 int rc;
1583 1583
1584 if (!sc->reset) { 1584 if (!sc->reset) {
1585 printk(KERN_WARNING "%s: Running reset unrequested\n", 1585 printk(KERN_WARNING "%s: Running reset unrequested\n",
@@ -1597,10 +1597,11 @@ static void ub_reset_task(struct work_struct *work)
1597 } else if (sc->dev->actconfig->desc.bNumInterfaces != 1) { 1597 } else if (sc->dev->actconfig->desc.bNumInterfaces != 1) {
1598 ; 1598 ;
1599 } else { 1599 } else {
1600 if ((lkr = usb_lock_device_for_reset(sc->dev, sc->intf)) < 0) { 1600 rc = usb_lock_device_for_reset(sc->dev, sc->intf);
1601 if (rc < 0) {
1601 printk(KERN_NOTICE 1602 printk(KERN_NOTICE
1602 "%s: usb_lock_device_for_reset failed (%d)\n", 1603 "%s: usb_lock_device_for_reset failed (%d)\n",
1603 sc->name, lkr); 1604 sc->name, rc);
1604 } else { 1605 } else {
1605 rc = usb_reset_device(sc->dev); 1606 rc = usb_reset_device(sc->dev);
1606 if (rc < 0) { 1607 if (rc < 0) {
@@ -1608,9 +1609,7 @@ static void ub_reset_task(struct work_struct *work)
1608 "usb_lock_device_for_reset failed (%d)\n", 1609 "usb_lock_device_for_reset failed (%d)\n",
1609 sc->name, rc); 1610 sc->name, rc);
1610 } 1611 }
1611 1612 usb_unlock_device(sc->dev);
1612 if (lkr)
1613 usb_unlock_device(sc->dev);
1614 } 1613 }
1615 } 1614 }
1616 1615
diff --git a/drivers/char/epca.c b/drivers/char/epca.c
index 39ad820b2350..af7c13ca9493 100644
--- a/drivers/char/epca.c
+++ b/drivers/char/epca.c
@@ -769,7 +769,7 @@ static int pc_open(struct tty_struct *tty, struct file *filp)
769 /* Check status of board configured in system. */ 769 /* Check status of board configured in system. */
770 770
771 /* 771 /*
772 * I check to see if the epca_setup routine detected an user error. It 772 * I check to see if the epca_setup routine detected a user error. It
773 * might be better to put this in pc_init, but for the moment it goes 773 * might be better to put this in pc_init, but for the moment it goes
774 * here. 774 * here.
775 */ 775 */
diff --git a/drivers/cpufreq/Kconfig b/drivers/cpufreq/Kconfig
index 5f076aef74fa..a8c8d9c19d74 100644
--- a/drivers/cpufreq/Kconfig
+++ b/drivers/cpufreq/Kconfig
@@ -83,7 +83,7 @@ config CPU_FREQ_DEFAULT_GOV_USERSPACE
83 select CPU_FREQ_GOV_USERSPACE 83 select CPU_FREQ_GOV_USERSPACE
84 help 84 help
85 Use the CPUFreq governor 'userspace' as default. This allows 85 Use the CPUFreq governor 'userspace' as default. This allows
86 you to set the CPU frequency manually or when an userspace 86 you to set the CPU frequency manually or when a userspace
87 program shall be able to set the CPU dynamically without having 87 program shall be able to set the CPU dynamically without having
88 to enable the userspace governor manually. 88 to enable the userspace governor manually.
89 89
@@ -138,7 +138,7 @@ config CPU_FREQ_GOV_USERSPACE
138 tristate "'userspace' governor for userspace frequency scaling" 138 tristate "'userspace' governor for userspace frequency scaling"
139 help 139 help
140 Enable this cpufreq governor when you either want to set the 140 Enable this cpufreq governor when you either want to set the
141 CPU frequency manually or when an userspace program shall 141 CPU frequency manually or when a userspace program shall
142 be able to set the CPU dynamically, like on LART 142 be able to set the CPU dynamically, like on LART
143 <http://www.lartmaker.nl/>. 143 <http://www.lartmaker.nl/>.
144 144
diff --git a/drivers/firewire/fw-card.c b/drivers/firewire/fw-card.c
index 418c18f07e9d..799f94424c8a 100644
--- a/drivers/firewire/fw-card.c
+++ b/drivers/firewire/fw-card.c
@@ -75,7 +75,7 @@ generate_config_rom(struct fw_card *card, size_t *config_rom_length)
75 * controller, block reads to the config rom accesses the host 75 * controller, block reads to the config rom accesses the host
76 * memory, but quadlet read access the hardware bus info block 76 * memory, but quadlet read access the hardware bus info block
77 * registers. That's just crack, but it means we should make 77 * registers. That's just crack, but it means we should make
78 * sure the contents of bus info block in host memory mathces 78 * sure the contents of bus info block in host memory matches
79 * the version stored in the OHCI registers. 79 * the version stored in the OHCI registers.
80 */ 80 */
81 81
@@ -189,6 +189,17 @@ static const char gap_count_table[] = {
189 63, 5, 7, 8, 10, 13, 16, 18, 21, 24, 26, 29, 32, 35, 37, 40 189 63, 5, 7, 8, 10, 13, 16, 18, 21, 24, 26, 29, 32, 35, 37, 40
190}; 190};
191 191
192void
193fw_schedule_bm_work(struct fw_card *card, unsigned long delay)
194{
195 int scheduled;
196
197 fw_card_get(card);
198 scheduled = schedule_delayed_work(&card->work, delay);
199 if (!scheduled)
200 fw_card_put(card);
201}
202
192static void 203static void
193fw_card_bm_work(struct work_struct *work) 204fw_card_bm_work(struct work_struct *work)
194{ 205{
@@ -206,7 +217,7 @@ fw_card_bm_work(struct work_struct *work)
206 217
207 if (local_node == NULL) { 218 if (local_node == NULL) {
208 spin_unlock_irqrestore(&card->lock, flags); 219 spin_unlock_irqrestore(&card->lock, flags);
209 return; 220 goto out_put_card;
210 } 221 }
211 fw_node_get(local_node); 222 fw_node_get(local_node);
212 fw_node_get(root_node); 223 fw_node_get(root_node);
@@ -280,7 +291,7 @@ fw_card_bm_work(struct work_struct *work)
280 * this task 100ms from now. 291 * this task 100ms from now.
281 */ 292 */
282 spin_unlock_irqrestore(&card->lock, flags); 293 spin_unlock_irqrestore(&card->lock, flags);
283 schedule_delayed_work(&card->work, DIV_ROUND_UP(HZ, 10)); 294 fw_schedule_bm_work(card, DIV_ROUND_UP(HZ, 10));
284 goto out; 295 goto out;
285 } 296 }
286 297
@@ -355,6 +366,8 @@ fw_card_bm_work(struct work_struct *work)
355 fw_device_put(root_device); 366 fw_device_put(root_device);
356 fw_node_put(root_node); 367 fw_node_put(root_node);
357 fw_node_put(local_node); 368 fw_node_put(local_node);
369 out_put_card:
370 fw_card_put(card);
358} 371}
359 372
360static void 373static void
@@ -510,7 +523,6 @@ fw_core_remove_card(struct fw_card *card)
510 fw_card_put(card); 523 fw_card_put(card);
511 wait_for_completion(&card->done); 524 wait_for_completion(&card->done);
512 525
513 cancel_delayed_work_sync(&card->work);
514 WARN_ON(!list_empty(&card->transaction_list)); 526 WARN_ON(!list_empty(&card->transaction_list));
515 del_timer_sync(&card->flush_timer); 527 del_timer_sync(&card->flush_timer);
516} 528}
diff --git a/drivers/firewire/fw-device.c b/drivers/firewire/fw-device.c
index 6b9be42c7b98..c173be383725 100644
--- a/drivers/firewire/fw-device.c
+++ b/drivers/firewire/fw-device.c
@@ -617,7 +617,7 @@ static int shutdown_unit(struct device *device, void *data)
617 */ 617 */
618DECLARE_RWSEM(fw_device_rwsem); 618DECLARE_RWSEM(fw_device_rwsem);
619 619
620static DEFINE_IDR(fw_device_idr); 620DEFINE_IDR(fw_device_idr);
621int fw_cdev_major; 621int fw_cdev_major;
622 622
623struct fw_device *fw_device_get_by_devt(dev_t devt) 623struct fw_device *fw_device_get_by_devt(dev_t devt)
@@ -689,7 +689,7 @@ static void fw_device_init(struct work_struct *work)
689 fw_notify("giving up on config rom for node id %x\n", 689 fw_notify("giving up on config rom for node id %x\n",
690 device->node_id); 690 device->node_id);
691 if (device->node == device->card->root_node) 691 if (device->node == device->card->root_node)
692 schedule_delayed_work(&device->card->work, 0); 692 fw_schedule_bm_work(device->card, 0);
693 fw_device_release(&device->device); 693 fw_device_release(&device->device);
694 } 694 }
695 return; 695 return;
@@ -758,7 +758,7 @@ static void fw_device_init(struct work_struct *work)
758 * pretty harmless. 758 * pretty harmless.
759 */ 759 */
760 if (device->node == device->card->root_node) 760 if (device->node == device->card->root_node)
761 schedule_delayed_work(&device->card->work, 0); 761 fw_schedule_bm_work(device->card, 0);
762 762
763 return; 763 return;
764 764
@@ -892,7 +892,7 @@ static void fw_device_refresh(struct work_struct *work)
892 fw_device_shutdown(work); 892 fw_device_shutdown(work);
893 out: 893 out:
894 if (node_id == card->root_node->node_id) 894 if (node_id == card->root_node->node_id)
895 schedule_delayed_work(&card->work, 0); 895 fw_schedule_bm_work(card, 0);
896} 896}
897 897
898void fw_node_event(struct fw_card *card, struct fw_node *node, int event) 898void fw_node_event(struct fw_card *card, struct fw_node *node, int event)
diff --git a/drivers/firewire/fw-device.h b/drivers/firewire/fw-device.h
index 42305bbac72f..df51732608d9 100644
--- a/drivers/firewire/fw-device.h
+++ b/drivers/firewire/fw-device.h
@@ -21,6 +21,7 @@
21 21
22#include <linux/fs.h> 22#include <linux/fs.h>
23#include <linux/cdev.h> 23#include <linux/cdev.h>
24#include <linux/idr.h>
24#include <linux/rwsem.h> 25#include <linux/rwsem.h>
25#include <asm/atomic.h> 26#include <asm/atomic.h>
26 27
@@ -99,6 +100,7 @@ void fw_device_cdev_update(struct fw_device *device);
99void fw_device_cdev_remove(struct fw_device *device); 100void fw_device_cdev_remove(struct fw_device *device);
100 101
101extern struct rw_semaphore fw_device_rwsem; 102extern struct rw_semaphore fw_device_rwsem;
103extern struct idr fw_device_idr;
102extern int fw_cdev_major; 104extern int fw_cdev_major;
103 105
104/* 106/*
diff --git a/drivers/firewire/fw-sbp2.c b/drivers/firewire/fw-sbp2.c
index e54403ee59e7..e88d5067448c 100644
--- a/drivers/firewire/fw-sbp2.c
+++ b/drivers/firewire/fw-sbp2.c
@@ -670,17 +670,6 @@ static void sbp2_agent_reset_no_wait(struct sbp2_logical_unit *lu)
670 &d, sizeof(d), complete_agent_reset_write_no_wait, t); 670 &d, sizeof(d), complete_agent_reset_write_no_wait, t);
671} 671}
672 672
673static void sbp2_set_generation(struct sbp2_logical_unit *lu, int generation)
674{
675 struct fw_card *card = fw_device(lu->tgt->unit->device.parent)->card;
676 unsigned long flags;
677
678 /* serialize with comparisons of lu->generation and card->generation */
679 spin_lock_irqsave(&card->lock, flags);
680 lu->generation = generation;
681 spin_unlock_irqrestore(&card->lock, flags);
682}
683
684static inline void sbp2_allow_block(struct sbp2_logical_unit *lu) 673static inline void sbp2_allow_block(struct sbp2_logical_unit *lu)
685{ 674{
686 /* 675 /*
@@ -884,7 +873,7 @@ static void sbp2_login(struct work_struct *work)
884 goto out; 873 goto out;
885 874
886 generation = device->generation; 875 generation = device->generation;
887 smp_rmb(); /* node_id must not be older than generation */ 876 smp_rmb(); /* node IDs must not be older than generation */
888 node_id = device->node_id; 877 node_id = device->node_id;
889 local_node_id = device->card->node_id; 878 local_node_id = device->card->node_id;
890 879
@@ -908,7 +897,8 @@ static void sbp2_login(struct work_struct *work)
908 897
909 tgt->node_id = node_id; 898 tgt->node_id = node_id;
910 tgt->address_high = local_node_id << 16; 899 tgt->address_high = local_node_id << 16;
911 sbp2_set_generation(lu, generation); 900 smp_wmb(); /* node IDs must not be older than generation */
901 lu->generation = generation;
912 902
913 lu->command_block_agent_address = 903 lu->command_block_agent_address =
914 ((u64)(be32_to_cpu(response.command_block_agent.high) & 0xffff) 904 ((u64)(be32_to_cpu(response.command_block_agent.high) & 0xffff)
@@ -1201,7 +1191,7 @@ static void sbp2_reconnect(struct work_struct *work)
1201 goto out; 1191 goto out;
1202 1192
1203 generation = device->generation; 1193 generation = device->generation;
1204 smp_rmb(); /* node_id must not be older than generation */ 1194 smp_rmb(); /* node IDs must not be older than generation */
1205 node_id = device->node_id; 1195 node_id = device->node_id;
1206 local_node_id = device->card->node_id; 1196 local_node_id = device->card->node_id;
1207 1197
@@ -1228,7 +1218,8 @@ static void sbp2_reconnect(struct work_struct *work)
1228 1218
1229 tgt->node_id = node_id; 1219 tgt->node_id = node_id;
1230 tgt->address_high = local_node_id << 16; 1220 tgt->address_high = local_node_id << 16;
1231 sbp2_set_generation(lu, generation); 1221 smp_wmb(); /* node IDs must not be older than generation */
1222 lu->generation = generation;
1232 1223
1233 fw_notify("%s: reconnected to LUN %04x (%d retries)\n", 1224 fw_notify("%s: reconnected to LUN %04x (%d retries)\n",
1234 tgt->bus_id, lu->lun, lu->retries); 1225 tgt->bus_id, lu->lun, lu->retries);
diff --git a/drivers/firewire/fw-topology.c b/drivers/firewire/fw-topology.c
index 5e204713002d..c9be6e6948c4 100644
--- a/drivers/firewire/fw-topology.c
+++ b/drivers/firewire/fw-topology.c
@@ -355,6 +355,9 @@ report_lost_node(struct fw_card *card,
355{ 355{
356 fw_node_event(card, node, FW_NODE_DESTROYED); 356 fw_node_event(card, node, FW_NODE_DESTROYED);
357 fw_node_put(node); 357 fw_node_put(node);
358
359 /* Topology has changed - reset bus manager retry counter */
360 card->bm_retries = 0;
358} 361}
359 362
360static void 363static void
@@ -374,6 +377,9 @@ report_found_node(struct fw_card *card,
374 } 377 }
375 378
376 fw_node_event(card, node, FW_NODE_CREATED); 379 fw_node_event(card, node, FW_NODE_CREATED);
380
381 /* Topology has changed - reset bus manager retry counter */
382 card->bm_retries = 0;
377} 383}
378 384
379void fw_destroy_nodes(struct fw_card *card) 385void fw_destroy_nodes(struct fw_card *card)
@@ -514,14 +520,6 @@ fw_core_handle_bus_reset(struct fw_card *card,
514 520
515 spin_lock_irqsave(&card->lock, flags); 521 spin_lock_irqsave(&card->lock, flags);
516 522
517 /*
518 * If the new topology has a different self_id_count the topology
519 * changed, either nodes were added or removed. In that case we
520 * reset the IRM reset counter.
521 */
522 if (card->self_id_count != self_id_count)
523 card->bm_retries = 0;
524
525 card->node_id = node_id; 523 card->node_id = node_id;
526 /* 524 /*
527 * Update node_id before generation to prevent anybody from using 525 * Update node_id before generation to prevent anybody from using
@@ -530,7 +528,7 @@ fw_core_handle_bus_reset(struct fw_card *card,
530 smp_wmb(); 528 smp_wmb();
531 card->generation = generation; 529 card->generation = generation;
532 card->reset_jiffies = jiffies; 530 card->reset_jiffies = jiffies;
533 schedule_delayed_work(&card->work, 0); 531 fw_schedule_bm_work(card, 0);
534 532
535 local_node = build_tree(card, self_ids, self_id_count); 533 local_node = build_tree(card, self_ids, self_id_count);
536 534
diff --git a/drivers/firewire/fw-transaction.c b/drivers/firewire/fw-transaction.c
index 2884f876397b..699ac041f39a 100644
--- a/drivers/firewire/fw-transaction.c
+++ b/drivers/firewire/fw-transaction.c
@@ -19,6 +19,7 @@
19 */ 19 */
20 20
21#include <linux/completion.h> 21#include <linux/completion.h>
22#include <linux/idr.h>
22#include <linux/kernel.h> 23#include <linux/kernel.h>
23#include <linux/kref.h> 24#include <linux/kref.h>
24#include <linux/module.h> 25#include <linux/module.h>
@@ -971,6 +972,7 @@ static void __exit fw_core_cleanup(void)
971{ 972{
972 unregister_chrdev(fw_cdev_major, "firewire"); 973 unregister_chrdev(fw_cdev_major, "firewire");
973 bus_unregister(&fw_bus_type); 974 bus_unregister(&fw_bus_type);
975 idr_destroy(&fw_device_idr);
974} 976}
975 977
976module_init(fw_core_init); 978module_init(fw_core_init);
diff --git a/drivers/firewire/fw-transaction.h b/drivers/firewire/fw-transaction.h
index 839466f0a795..c9ab12a15f6e 100644
--- a/drivers/firewire/fw-transaction.h
+++ b/drivers/firewire/fw-transaction.h
@@ -237,14 +237,6 @@ struct fw_card {
237 int link_speed; 237 int link_speed;
238 int config_rom_generation; 238 int config_rom_generation;
239 239
240 /*
241 * We need to store up to 4 self ID for a maximum of 63
242 * devices plus 3 words for the topology map header.
243 */
244 int self_id_count;
245 u32 topology_map[252 + 3];
246 u32 broadcast_channel;
247
248 spinlock_t lock; /* Take this lock when handling the lists in 240 spinlock_t lock; /* Take this lock when handling the lists in
249 * this struct. */ 241 * this struct. */
250 struct fw_node *local_node; 242 struct fw_node *local_node;
@@ -262,6 +254,9 @@ struct fw_card {
262 struct delayed_work work; 254 struct delayed_work work;
263 int bm_retries; 255 int bm_retries;
264 int bm_generation; 256 int bm_generation;
257
258 u32 broadcast_channel;
259 u32 topology_map[(CSR_TOPOLOGY_MAP_END - CSR_TOPOLOGY_MAP) / 4];
265}; 260};
266 261
267static inline struct fw_card *fw_card_get(struct fw_card *card) 262static inline struct fw_card *fw_card_get(struct fw_card *card)
@@ -278,6 +273,8 @@ static inline void fw_card_put(struct fw_card *card)
278 kref_put(&card->kref, fw_card_release); 273 kref_put(&card->kref, fw_card_release);
279} 274}
280 275
276extern void fw_schedule_bm_work(struct fw_card *card, unsigned long delay);
277
281/* 278/*
282 * The iso packet format allows for an immediate header/payload part 279 * The iso packet format allows for an immediate header/payload part
283 * stored in 'header' immediately after the packet info plus an 280 * stored in 'header' immediately after the packet info plus an
diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c
index 03cb494af1c5..f0a0f72238ab 100644
--- a/drivers/hid/usbhid/hid-core.c
+++ b/drivers/hid/usbhid/hid-core.c
@@ -102,7 +102,7 @@ static void hid_reset(struct work_struct *work)
102 struct usbhid_device *usbhid = 102 struct usbhid_device *usbhid =
103 container_of(work, struct usbhid_device, reset_work); 103 container_of(work, struct usbhid_device, reset_work);
104 struct hid_device *hid = usbhid->hid; 104 struct hid_device *hid = usbhid->hid;
105 int rc_lock, rc = 0; 105 int rc = 0;
106 106
107 if (test_bit(HID_CLEAR_HALT, &usbhid->iofl)) { 107 if (test_bit(HID_CLEAR_HALT, &usbhid->iofl)) {
108 dev_dbg(&usbhid->intf->dev, "clear halt\n"); 108 dev_dbg(&usbhid->intf->dev, "clear halt\n");
@@ -113,11 +113,10 @@ static void hid_reset(struct work_struct *work)
113 113
114 else if (test_bit(HID_RESET_PENDING, &usbhid->iofl)) { 114 else if (test_bit(HID_RESET_PENDING, &usbhid->iofl)) {
115 dev_dbg(&usbhid->intf->dev, "resetting device\n"); 115 dev_dbg(&usbhid->intf->dev, "resetting device\n");
116 rc = rc_lock = usb_lock_device_for_reset(hid_to_usb_dev(hid), usbhid->intf); 116 rc = usb_lock_device_for_reset(hid_to_usb_dev(hid), usbhid->intf);
117 if (rc_lock >= 0) { 117 if (rc == 0) {
118 rc = usb_reset_device(hid_to_usb_dev(hid)); 118 rc = usb_reset_device(hid_to_usb_dev(hid));
119 if (rc_lock) 119 usb_unlock_device(hid_to_usb_dev(hid));
120 usb_unlock_device(hid_to_usb_dev(hid));
121 } 120 }
122 clear_bit(HID_RESET_PENDING, &usbhid->iofl); 121 clear_bit(HID_RESET_PENDING, &usbhid->iofl);
123 } 122 }
diff --git a/drivers/hid/usbhid/hiddev.c b/drivers/hid/usbhid/hiddev.c
index 6a98f9f572b0..d73eea382ab3 100644
--- a/drivers/hid/usbhid/hiddev.c
+++ b/drivers/hid/usbhid/hiddev.c
@@ -874,12 +874,14 @@ int hiddev_connect(struct hid_device *hid, unsigned int force)
874 INIT_LIST_HEAD(&hiddev->list); 874 INIT_LIST_HEAD(&hiddev->list);
875 spin_lock_init(&hiddev->list_lock); 875 spin_lock_init(&hiddev->list_lock);
876 mutex_init(&hiddev->existancelock); 876 mutex_init(&hiddev->existancelock);
877 hid->hiddev = hiddev;
877 hiddev->hid = hid; 878 hiddev->hid = hid;
878 hiddev->exist = 1; 879 hiddev->exist = 1;
879 880
880 retval = usb_register_dev(usbhid->intf, &hiddev_class); 881 retval = usb_register_dev(usbhid->intf, &hiddev_class);
881 if (retval) { 882 if (retval) {
882 err_hid("Not able to get a minor for this device."); 883 err_hid("Not able to get a minor for this device.");
884 hid->hiddev = NULL;
883 kfree(hiddev); 885 kfree(hiddev);
884 return -1; 886 return -1;
885 } else { 887 } else {
diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig
index c709e821f04b..4b33bc82cc24 100644
--- a/drivers/hwmon/Kconfig
+++ b/drivers/hwmon/Kconfig
@@ -284,11 +284,12 @@ config SENSORS_F71805F
284 will be called f71805f. 284 will be called f71805f.
285 285
286config SENSORS_F71882FG 286config SENSORS_F71882FG
287 tristate "Fintek F71882FG and F71883FG" 287 tristate "Fintek F71862FG, F71882FG and F8000"
288 depends on EXPERIMENTAL 288 depends on EXPERIMENTAL
289 help 289 help
290 If you say yes here you get support for hardware monitoring 290 If you say yes here you get support for hardware monitoring
291 features of the Fintek F71882FG and F71883FG Super-I/O chips. 291 features of the Fintek F71882FG/F71883FG, F71862FG/71863FG
292 and F8000 Super-I/O chips.
292 293
293 This driver can also be built as a module. If so, the module 294 This driver can also be built as a module. If so, the module
294 will be called f71882fg. 295 will be called f71882fg.
@@ -304,9 +305,13 @@ config SENSORS_F75375S
304 will be called f75375s. 305 will be called f75375s.
305 306
306config SENSORS_FSCHER 307config SENSORS_FSCHER
307 tristate "FSC Hermes" 308 tristate "FSC Hermes (DEPRECATED)"
308 depends on X86 && I2C 309 depends on X86 && I2C
309 help 310 help
311 This driver is DEPRECATED please use the new merged fschmd
312 ("FSC Poseidon, Scylla, Hermes, Heimdall and Heracles") driver
313 instead.
314
310 If you say yes here you get support for Fujitsu Siemens 315 If you say yes here you get support for Fujitsu Siemens
311 Computers Hermes sensor chips. 316 Computers Hermes sensor chips.
312 317
@@ -314,9 +319,13 @@ config SENSORS_FSCHER
314 will be called fscher. 319 will be called fscher.
315 320
316config SENSORS_FSCPOS 321config SENSORS_FSCPOS
317 tristate "FSC Poseidon" 322 tristate "FSC Poseidon (DEPRECATED)"
318 depends on X86 && I2C 323 depends on X86 && I2C
319 help 324 help
325 This driver is DEPRECATED please use the new merged fschmd
326 ("FSC Poseidon, Scylla, Hermes, Heimdall and Heracles") driver
327 instead.
328
320 If you say yes here you get support for Fujitsu Siemens 329 If you say yes here you get support for Fujitsu Siemens
321 Computers Poseidon sensor chips. 330 Computers Poseidon sensor chips.
322 331
@@ -325,14 +334,15 @@ config SENSORS_FSCPOS
325 334
326config SENSORS_FSCHMD 335config SENSORS_FSCHMD
327 tristate "FSC Poseidon, Scylla, Hermes, Heimdall and Heracles" 336 tristate "FSC Poseidon, Scylla, Hermes, Heimdall and Heracles"
328 depends on X86 && I2C && EXPERIMENTAL 337 depends on X86 && I2C
329 help 338 help
330 If you say yes here you get support for various Fujitsu Siemens 339 If you say yes here you get support for various Fujitsu Siemens
331 Computers sensor chips. 340 Computers sensor chips, including support for the integrated
341 watchdog.
332 342
333 This is a new merged driver for FSC sensor chips which is intended 343 This is a merged driver for FSC sensor chips replacing the fscpos,
334 as a replacment for the fscpos, fscscy and fscher drivers and adds 344 fscscy and fscher drivers and adding support for several other FSC
335 support for several other FCS sensor chips. 345 sensor chips.
336 346
337 This driver can also be built as a module. If so, the module 347 This driver can also be built as a module. If so, the module
338 will be called fschmd. 348 will be called fschmd.
@@ -399,7 +409,8 @@ config SENSORS_IT87
399 select HWMON_VID 409 select HWMON_VID
400 help 410 help
401 If you say yes here you get support for ITE IT8705F, IT8712F, 411 If you say yes here you get support for ITE IT8705F, IT8712F,
402 IT8716F, IT8718F and IT8726F sensor chips, and the SiS960 clone. 412 IT8716F, IT8718F, IT8720F and IT8726F sensor chips, and the
413 SiS960 clone.
403 414
404 This driver can also be built as a module. If so, the module 415 This driver can also be built as a module. If so, the module
405 will be called it87. 416 will be called it87.
@@ -417,11 +428,12 @@ config SENSORS_LM63
417 will be called lm63. 428 will be called lm63.
418 429
419config SENSORS_LM70 430config SENSORS_LM70
420 tristate "National Semiconductor LM70" 431 tristate "National Semiconductor LM70 / Texas Instruments TMP121"
421 depends on SPI_MASTER && EXPERIMENTAL 432 depends on SPI_MASTER && EXPERIMENTAL
422 help 433 help
423 If you say yes here you get support for the National Semiconductor 434 If you say yes here you get support for the National Semiconductor
424 LM70 digital temperature sensor chip. 435 LM70 and Texas Instruments TMP121/TMP123 digital temperature
436 sensor chips.
425 437
426 This driver can also be built as a module. If so, the module 438 This driver can also be built as a module. If so, the module
427 will be called lm70. 439 will be called lm70.
@@ -548,6 +560,17 @@ config SENSORS_LM93
548 This driver can also be built as a module. If so, the module 560 This driver can also be built as a module. If so, the module
549 will be called lm93. 561 will be called lm93.
550 562
563config SENSORS_LTC4245
564 tristate "Linear Technology LTC4245"
565 depends on I2C && EXPERIMENTAL
566 default n
567 help
568 If you say yes here you get support for Linear Technology LTC4245
569 Multiple Supply Hot Swap Controller I2C interface.
570
571 This driver can also be built as a module. If so, the module will
572 be called ltc4245.
573
551config SENSORS_MAX1111 574config SENSORS_MAX1111
552 tristate "Maxim MAX1111 Multichannel, Serial 8-bit ADC chip" 575 tristate "Maxim MAX1111 Multichannel, Serial 8-bit ADC chip"
553 depends on SPI_MASTER 576 depends on SPI_MASTER
diff --git a/drivers/hwmon/Makefile b/drivers/hwmon/Makefile
index 58fc5be5355d..8fd124eff646 100644
--- a/drivers/hwmon/Makefile
+++ b/drivers/hwmon/Makefile
@@ -62,6 +62,7 @@ obj-$(CONFIG_SENSORS_LM87) += lm87.o
62obj-$(CONFIG_SENSORS_LM90) += lm90.o 62obj-$(CONFIG_SENSORS_LM90) += lm90.o
63obj-$(CONFIG_SENSORS_LM92) += lm92.o 63obj-$(CONFIG_SENSORS_LM92) += lm92.o
64obj-$(CONFIG_SENSORS_LM93) += lm93.o 64obj-$(CONFIG_SENSORS_LM93) += lm93.o
65obj-$(CONFIG_SENSORS_LTC4245) += ltc4245.o
65obj-$(CONFIG_SENSORS_MAX1111) += max1111.o 66obj-$(CONFIG_SENSORS_MAX1111) += max1111.o
66obj-$(CONFIG_SENSORS_MAX1619) += max1619.o 67obj-$(CONFIG_SENSORS_MAX1619) += max1619.o
67obj-$(CONFIG_SENSORS_MAX6650) += max6650.o 68obj-$(CONFIG_SENSORS_MAX6650) += max6650.o
diff --git a/drivers/hwmon/asb100.c b/drivers/hwmon/asb100.c
index 8a45a2e6ba8a..8acf82977e7b 100644
--- a/drivers/hwmon/asb100.c
+++ b/drivers/hwmon/asb100.c
@@ -53,7 +53,10 @@ static const unsigned short normal_i2c[] = { 0x2d, I2C_CLIENT_END };
53 53
54/* Insmod parameters */ 54/* Insmod parameters */
55I2C_CLIENT_INSMOD_1(asb100); 55I2C_CLIENT_INSMOD_1(asb100);
56I2C_CLIENT_MODULE_PARM(force_subclients, "List of subclient addresses: " 56
57static unsigned short force_subclients[4];
58module_param_array(force_subclients, short, NULL, 0);
59MODULE_PARM_DESC(force_subclients, "List of subclient addresses: "
57 "{bus, clientaddr, subclientaddr1, subclientaddr2}"); 60 "{bus, clientaddr, subclientaddr1, subclientaddr2}");
58 61
59/* Voltage IN registers 0-6 */ 62/* Voltage IN registers 0-6 */
diff --git a/drivers/hwmon/dme1737.c b/drivers/hwmon/dme1737.c
index 27a5d397f9a1..3df202a9ad72 100644
--- a/drivers/hwmon/dme1737.c
+++ b/drivers/hwmon/dme1737.c
@@ -34,6 +34,7 @@
34#include <linux/hwmon-vid.h> 34#include <linux/hwmon-vid.h>
35#include <linux/err.h> 35#include <linux/err.h>
36#include <linux/mutex.h> 36#include <linux/mutex.h>
37#include <linux/acpi.h>
37#include <asm/io.h> 38#include <asm/io.h>
38 39
39/* ISA device, if found */ 40/* ISA device, if found */
@@ -2361,6 +2362,10 @@ static int __init dme1737_isa_device_add(unsigned short addr)
2361 }; 2362 };
2362 int err; 2363 int err;
2363 2364
2365 err = acpi_check_resource_conflict(&res);
2366 if (err)
2367 goto exit;
2368
2364 if (!(pdev = platform_device_alloc("dme1737", addr))) { 2369 if (!(pdev = platform_device_alloc("dme1737", addr))) {
2365 printk(KERN_ERR "dme1737: Failed to allocate device.\n"); 2370 printk(KERN_ERR "dme1737: Failed to allocate device.\n");
2366 err = -ENOMEM; 2371 err = -ENOMEM;
diff --git a/drivers/hwmon/f71805f.c b/drivers/hwmon/f71805f.c
index 7a14a2dbb752..899876579253 100644
--- a/drivers/hwmon/f71805f.c
+++ b/drivers/hwmon/f71805f.c
@@ -39,6 +39,7 @@
39#include <linux/mutex.h> 39#include <linux/mutex.h>
40#include <linux/sysfs.h> 40#include <linux/sysfs.h>
41#include <linux/ioport.h> 41#include <linux/ioport.h>
42#include <linux/acpi.h>
42#include <asm/io.h> 43#include <asm/io.h>
43 44
44static unsigned short force_id; 45static unsigned short force_id;
@@ -1455,6 +1456,10 @@ static int __init f71805f_device_add(unsigned short address,
1455 } 1456 }
1456 1457
1457 res.name = pdev->name; 1458 res.name = pdev->name;
1459 err = acpi_check_resource_conflict(&res);
1460 if (err)
1461 goto exit_device_put;
1462
1458 err = platform_device_add_resources(pdev, &res, 1); 1463 err = platform_device_add_resources(pdev, &res, 1);
1459 if (err) { 1464 if (err) {
1460 printk(KERN_ERR DRVNAME ": Device resource addition failed " 1465 printk(KERN_ERR DRVNAME ": Device resource addition failed "
diff --git a/drivers/hwmon/f71882fg.c b/drivers/hwmon/f71882fg.c
index 67067e9a323e..609cafff86bc 100644
--- a/drivers/hwmon/f71882fg.c
+++ b/drivers/hwmon/f71882fg.c
@@ -1,6 +1,6 @@
1/*************************************************************************** 1/***************************************************************************
2 * Copyright (C) 2006 by Hans Edgington <hans@edgington.nl> * 2 * Copyright (C) 2006 by Hans Edgington <hans@edgington.nl> *
3 * Copyright (C) 2007 by Hans de Goede <j.w.r.degoede@hhs.nl> * 3 * Copyright (C) 2007,2008 by Hans de Goede <hdegoede@redhat.com> *
4 * * 4 * *
5 * This program is free software; you can redistribute it and/or modify * 5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by * 6 * it under the terms of the GNU General Public License as published by *
@@ -27,11 +27,12 @@
27#include <linux/hwmon-sysfs.h> 27#include <linux/hwmon-sysfs.h>
28#include <linux/err.h> 28#include <linux/err.h>
29#include <linux/mutex.h> 29#include <linux/mutex.h>
30#include <asm/io.h> 30#include <linux/io.h>
31#include <linux/acpi.h>
31 32
32#define DRVNAME "f71882fg" 33#define DRVNAME "f71882fg"
33 34
34#define SIO_F71882FG_LD_HWM 0x04 /* Hardware monitor logical device*/ 35#define SIO_F71882FG_LD_HWM 0x04 /* Hardware monitor logical device */
35#define SIO_UNLOCK_KEY 0x87 /* Key to enable Super-I/O */ 36#define SIO_UNLOCK_KEY 0x87 /* Key to enable Super-I/O */
36#define SIO_LOCK_KEY 0xAA /* Key to diasble Super-I/O */ 37#define SIO_LOCK_KEY 0xAA /* Key to diasble Super-I/O */
37 38
@@ -43,7 +44,9 @@
43#define SIO_REG_ADDR 0x60 /* Logical device address (2 bytes) */ 44#define SIO_REG_ADDR 0x60 /* Logical device address (2 bytes) */
44 45
45#define SIO_FINTEK_ID 0x1934 /* Manufacturers ID */ 46#define SIO_FINTEK_ID 0x1934 /* Manufacturers ID */
47#define SIO_F71862_ID 0x0601 /* Chipset ID */
46#define SIO_F71882_ID 0x0541 /* Chipset ID */ 48#define SIO_F71882_ID 0x0541 /* Chipset ID */
49#define SIO_F8000_ID 0x0581 /* Chipset ID */
47 50
48#define REGION_LENGTH 8 51#define REGION_LENGTH 8
49#define ADDR_REG_OFFSET 5 52#define ADDR_REG_OFFSET 5
@@ -51,25 +54,36 @@
51 54
52#define F71882FG_REG_PECI 0x0A 55#define F71882FG_REG_PECI 0x0A
53 56
54#define F71882FG_REG_IN_STATUS 0x12 57#define F71882FG_REG_IN_STATUS 0x12 /* f71882fg only */
55#define F71882FG_REG_IN_BEEP 0x13 58#define F71882FG_REG_IN_BEEP 0x13 /* f71882fg only */
56#define F71882FG_REG_IN(nr) (0x20 + (nr)) 59#define F71882FG_REG_IN(nr) (0x20 + (nr))
57#define F71882FG_REG_IN1_HIGH 0x32 60#define F71882FG_REG_IN1_HIGH 0x32 /* f71882fg only */
58 61
59#define F71882FG_REG_FAN(nr) (0xA0 + (16 * (nr))) 62#define F71882FG_REG_FAN(nr) (0xA0 + (16 * (nr)))
63#define F71882FG_REG_FAN_TARGET(nr) (0xA2 + (16 * (nr)))
64#define F71882FG_REG_FAN_FULL_SPEED(nr) (0xA4 + (16 * (nr)))
60#define F71882FG_REG_FAN_STATUS 0x92 65#define F71882FG_REG_FAN_STATUS 0x92
61#define F71882FG_REG_FAN_BEEP 0x93 66#define F71882FG_REG_FAN_BEEP 0x93
62 67
63#define F71882FG_REG_TEMP(nr) (0x72 + 2 * (nr)) 68#define F71882FG_REG_TEMP(nr) (0x70 + 2 * (nr))
64#define F71882FG_REG_TEMP_OVT(nr) (0x82 + 2 * (nr)) 69#define F71882FG_REG_TEMP_OVT(nr) (0x80 + 2 * (nr))
65#define F71882FG_REG_TEMP_HIGH(nr) (0x83 + 2 * (nr)) 70#define F71882FG_REG_TEMP_HIGH(nr) (0x81 + 2 * (nr))
66#define F71882FG_REG_TEMP_STATUS 0x62 71#define F71882FG_REG_TEMP_STATUS 0x62
67#define F71882FG_REG_TEMP_BEEP 0x63 72#define F71882FG_REG_TEMP_BEEP 0x63
68#define F71882FG_REG_TEMP_HYST1 0x6C 73#define F71882FG_REG_TEMP_HYST(nr) (0x6C + (nr))
69#define F71882FG_REG_TEMP_HYST23 0x6D
70#define F71882FG_REG_TEMP_TYPE 0x6B 74#define F71882FG_REG_TEMP_TYPE 0x6B
71#define F71882FG_REG_TEMP_DIODE_OPEN 0x6F 75#define F71882FG_REG_TEMP_DIODE_OPEN 0x6F
72 76
77#define F71882FG_REG_PWM(nr) (0xA3 + (16 * (nr)))
78#define F71882FG_REG_PWM_TYPE 0x94
79#define F71882FG_REG_PWM_ENABLE 0x96
80
81#define F71882FG_REG_FAN_HYST(nr) (0x98 + (nr))
82
83#define F71882FG_REG_POINT_PWM(pwm, point) (0xAA + (point) + (16 * (pwm)))
84#define F71882FG_REG_POINT_TEMP(pwm, point) (0xA6 + (point) + (16 * (pwm)))
85#define F71882FG_REG_POINT_MAPPING(nr) (0xAF + 16 * (nr))
86
73#define F71882FG_REG_START 0x01 87#define F71882FG_REG_START 0x01
74 88
75#define FAN_MIN_DETECT 366 /* Lowest detectable fanspeed */ 89#define FAN_MIN_DETECT 366 /* Lowest detectable fanspeed */
@@ -78,7 +92,15 @@ static unsigned short force_id;
78module_param(force_id, ushort, 0); 92module_param(force_id, ushort, 0);
79MODULE_PARM_DESC(force_id, "Override the detected device ID"); 93MODULE_PARM_DESC(force_id, "Override the detected device ID");
80 94
81static struct platform_device *f71882fg_pdev = NULL; 95enum chips { f71862fg, f71882fg, f8000 };
96
97static const char *f71882fg_names[] = {
98 "f71862fg",
99 "f71882fg",
100 "f8000",
101};
102
103static struct platform_device *f71882fg_pdev;
82 104
83/* Super-I/O Function prototypes */ 105/* Super-I/O Function prototypes */
84static inline int superio_inb(int base, int reg); 106static inline int superio_inb(int base, int reg);
@@ -87,8 +109,13 @@ static inline void superio_enter(int base);
87static inline void superio_select(int base, int ld); 109static inline void superio_select(int base, int ld);
88static inline void superio_exit(int base); 110static inline void superio_exit(int base);
89 111
112struct f71882fg_sio_data {
113 enum chips type;
114};
115
90struct f71882fg_data { 116struct f71882fg_data {
91 unsigned short addr; 117 unsigned short addr;
118 enum chips type;
92 struct device *hwmon_dev; 119 struct device *hwmon_dev;
93 120
94 struct mutex update_lock; 121 struct mutex update_lock;
@@ -102,19 +129,30 @@ struct f71882fg_data {
102 u8 in_status; 129 u8 in_status;
103 u8 in_beep; 130 u8 in_beep;
104 u16 fan[4]; 131 u16 fan[4];
132 u16 fan_target[4];
133 u16 fan_full_speed[4];
105 u8 fan_status; 134 u8 fan_status;
106 u8 fan_beep; 135 u8 fan_beep;
107 u8 temp[3]; 136 /* Note: all models have only 3 temperature channels, but on some
108 u8 temp_ovt[3]; 137 they are addressed as 0-2 and on others as 1-3, so for coding
109 u8 temp_high[3]; 138 convenience we reserve space for 4 channels */
110 u8 temp_hyst[3]; 139 u8 temp[4];
111 u8 temp_type[3]; 140 u8 temp_ovt[4];
141 u8 temp_high[4];
142 u8 temp_hyst[2]; /* 2 hysts stored per reg */
143 u8 temp_type[4];
112 u8 temp_status; 144 u8 temp_status;
113 u8 temp_beep; 145 u8 temp_beep;
114 u8 temp_diode_open; 146 u8 temp_diode_open;
147 u8 pwm[4];
148 u8 pwm_enable;
149 u8 pwm_auto_point_hyst[2];
150 u8 pwm_auto_point_mapping[4];
151 u8 pwm_auto_point_pwm[4][5];
152 u8 pwm_auto_point_temp[4][4];
115}; 153};
116 154
117/* Sysfs in*/ 155/* Sysfs in */
118static ssize_t show_in(struct device *dev, struct device_attribute *devattr, 156static ssize_t show_in(struct device *dev, struct device_attribute *devattr,
119 char *buf); 157 char *buf);
120static ssize_t show_in_max(struct device *dev, struct device_attribute 158static ssize_t show_in_max(struct device *dev, struct device_attribute
@@ -130,6 +168,10 @@ static ssize_t show_in_alarm(struct device *dev, struct device_attribute
130/* Sysfs Fan */ 168/* Sysfs Fan */
131static ssize_t show_fan(struct device *dev, struct device_attribute *devattr, 169static ssize_t show_fan(struct device *dev, struct device_attribute *devattr,
132 char *buf); 170 char *buf);
171static ssize_t show_fan_full_speed(struct device *dev,
172 struct device_attribute *devattr, char *buf);
173static ssize_t store_fan_full_speed(struct device *dev,
174 struct device_attribute *devattr, const char *buf, size_t count);
133static ssize_t show_fan_beep(struct device *dev, struct device_attribute 175static ssize_t show_fan_beep(struct device *dev, struct device_attribute
134 *devattr, char *buf); 176 *devattr, char *buf);
135static ssize_t store_fan_beep(struct device *dev, struct device_attribute 177static ssize_t store_fan_beep(struct device *dev, struct device_attribute
@@ -163,16 +205,41 @@ static ssize_t show_temp_alarm(struct device *dev, struct device_attribute
163 *devattr, char *buf); 205 *devattr, char *buf);
164static ssize_t show_temp_fault(struct device *dev, struct device_attribute 206static ssize_t show_temp_fault(struct device *dev, struct device_attribute
165 *devattr, char *buf); 207 *devattr, char *buf);
208/* PWM and Auto point control */
209static ssize_t show_pwm(struct device *dev, struct device_attribute *devattr,
210 char *buf);
211static ssize_t store_pwm(struct device *dev, struct device_attribute *devattr,
212 const char *buf, size_t count);
213static ssize_t show_pwm_enable(struct device *dev,
214 struct device_attribute *devattr, char *buf);
215static ssize_t store_pwm_enable(struct device *dev,
216 struct device_attribute *devattr, const char *buf, size_t count);
217static ssize_t show_pwm_interpolate(struct device *dev,
218 struct device_attribute *devattr, char *buf);
219static ssize_t store_pwm_interpolate(struct device *dev,
220 struct device_attribute *devattr, const char *buf, size_t count);
221static ssize_t show_pwm_auto_point_channel(struct device *dev,
222 struct device_attribute *devattr, char *buf);
223static ssize_t store_pwm_auto_point_channel(struct device *dev,
224 struct device_attribute *devattr, const char *buf, size_t count);
225static ssize_t show_pwm_auto_point_temp_hyst(struct device *dev,
226 struct device_attribute *devattr, char *buf);
227static ssize_t store_pwm_auto_point_temp_hyst(struct device *dev,
228 struct device_attribute *devattr, const char *buf, size_t count);
229static ssize_t show_pwm_auto_point_pwm(struct device *dev,
230 struct device_attribute *devattr, char *buf);
231static ssize_t store_pwm_auto_point_pwm(struct device *dev,
232 struct device_attribute *devattr, const char *buf, size_t count);
233static ssize_t show_pwm_auto_point_temp(struct device *dev,
234 struct device_attribute *devattr, char *buf);
235static ssize_t store_pwm_auto_point_temp(struct device *dev,
236 struct device_attribute *devattr, const char *buf, size_t count);
166/* Sysfs misc */ 237/* Sysfs misc */
167static ssize_t show_name(struct device *dev, struct device_attribute *devattr, 238static ssize_t show_name(struct device *dev, struct device_attribute *devattr,
168 char *buf); 239 char *buf);
169 240
170static int __devinit f71882fg_probe(struct platform_device * pdev); 241static int __devinit f71882fg_probe(struct platform_device * pdev);
171static int __devexit f71882fg_remove(struct platform_device *pdev); 242static int f71882fg_remove(struct platform_device *pdev);
172static int __init f71882fg_init(void);
173static int __init f71882fg_find(int sioaddr, unsigned short *address);
174static int __init f71882fg_device_add(unsigned short address);
175static void __exit f71882fg_exit(void);
176 243
177static struct platform_driver f71882fg_driver = { 244static struct platform_driver f71882fg_driver = {
178 .driver = { 245 .driver = {
@@ -183,86 +250,531 @@ static struct platform_driver f71882fg_driver = {
183 .remove = __devexit_p(f71882fg_remove), 250 .remove = __devexit_p(f71882fg_remove),
184}; 251};
185 252
186static struct device_attribute f71882fg_dev_attr[] = 253static DEVICE_ATTR(name, S_IRUGO, show_name, NULL);
187{ 254
188 __ATTR( name, S_IRUGO, show_name, NULL ), 255/* Temp and in attr common to both the f71862fg and f71882fg */
256static struct sensor_device_attribute_2 f718x2fg_in_temp_attr[] = {
257 SENSOR_ATTR_2(in0_input, S_IRUGO, show_in, NULL, 0, 0),
258 SENSOR_ATTR_2(in1_input, S_IRUGO, show_in, NULL, 0, 1),
259 SENSOR_ATTR_2(in2_input, S_IRUGO, show_in, NULL, 0, 2),
260 SENSOR_ATTR_2(in3_input, S_IRUGO, show_in, NULL, 0, 3),
261 SENSOR_ATTR_2(in4_input, S_IRUGO, show_in, NULL, 0, 4),
262 SENSOR_ATTR_2(in5_input, S_IRUGO, show_in, NULL, 0, 5),
263 SENSOR_ATTR_2(in6_input, S_IRUGO, show_in, NULL, 0, 6),
264 SENSOR_ATTR_2(in7_input, S_IRUGO, show_in, NULL, 0, 7),
265 SENSOR_ATTR_2(in8_input, S_IRUGO, show_in, NULL, 0, 8),
266 SENSOR_ATTR_2(temp1_input, S_IRUGO, show_temp, NULL, 0, 1),
267 SENSOR_ATTR_2(temp1_max, S_IRUGO|S_IWUSR, show_temp_max,
268 store_temp_max, 0, 1),
269 SENSOR_ATTR_2(temp1_max_hyst, S_IRUGO|S_IWUSR, show_temp_max_hyst,
270 store_temp_max_hyst, 0, 1),
271 /* Should really be temp1_max_alarm, but older versions did not handle
272 the max and crit alarms separately and lm_sensors v2 depends on the
273 presence of temp#_alarm files. The same goes for temp2/3 _alarm. */
274 SENSOR_ATTR_2(temp1_alarm, S_IRUGO, show_temp_alarm, NULL, 0, 1),
275 SENSOR_ATTR_2(temp1_max_beep, S_IRUGO|S_IWUSR, show_temp_beep,
276 store_temp_beep, 0, 1),
277 SENSOR_ATTR_2(temp1_crit, S_IRUGO|S_IWUSR, show_temp_crit,
278 store_temp_crit, 0, 1),
279 SENSOR_ATTR_2(temp1_crit_hyst, S_IRUGO, show_temp_crit_hyst, NULL,
280 0, 1),
281 SENSOR_ATTR_2(temp1_crit_alarm, S_IRUGO, show_temp_alarm, NULL, 0, 5),
282 SENSOR_ATTR_2(temp1_crit_beep, S_IRUGO|S_IWUSR, show_temp_beep,
283 store_temp_beep, 0, 5),
284 SENSOR_ATTR_2(temp1_type, S_IRUGO, show_temp_type, NULL, 0, 1),
285 SENSOR_ATTR_2(temp1_fault, S_IRUGO, show_temp_fault, NULL, 0, 1),
286 SENSOR_ATTR_2(temp2_input, S_IRUGO, show_temp, NULL, 0, 2),
287 SENSOR_ATTR_2(temp2_max, S_IRUGO|S_IWUSR, show_temp_max,
288 store_temp_max, 0, 2),
289 SENSOR_ATTR_2(temp2_max_hyst, S_IRUGO|S_IWUSR, show_temp_max_hyst,
290 store_temp_max_hyst, 0, 2),
291 /* Should be temp2_max_alarm, see temp1_alarm note */
292 SENSOR_ATTR_2(temp2_alarm, S_IRUGO, show_temp_alarm, NULL, 0, 2),
293 SENSOR_ATTR_2(temp2_max_beep, S_IRUGO|S_IWUSR, show_temp_beep,
294 store_temp_beep, 0, 2),
295 SENSOR_ATTR_2(temp2_crit, S_IRUGO|S_IWUSR, show_temp_crit,
296 store_temp_crit, 0, 2),
297 SENSOR_ATTR_2(temp2_crit_hyst, S_IRUGO, show_temp_crit_hyst, NULL,
298 0, 2),
299 SENSOR_ATTR_2(temp2_crit_alarm, S_IRUGO, show_temp_alarm, NULL, 0, 6),
300 SENSOR_ATTR_2(temp2_crit_beep, S_IRUGO|S_IWUSR, show_temp_beep,
301 store_temp_beep, 0, 6),
302 SENSOR_ATTR_2(temp2_type, S_IRUGO, show_temp_type, NULL, 0, 2),
303 SENSOR_ATTR_2(temp2_fault, S_IRUGO, show_temp_fault, NULL, 0, 2),
304 SENSOR_ATTR_2(temp3_input, S_IRUGO, show_temp, NULL, 0, 3),
305 SENSOR_ATTR_2(temp3_max, S_IRUGO|S_IWUSR, show_temp_max,
306 store_temp_max, 0, 3),
307 SENSOR_ATTR_2(temp3_max_hyst, S_IRUGO|S_IWUSR, show_temp_max_hyst,
308 store_temp_max_hyst, 0, 3),
309 /* Should be temp3_max_alarm, see temp1_alarm note */
310 SENSOR_ATTR_2(temp3_alarm, S_IRUGO, show_temp_alarm, NULL, 0, 3),
311 SENSOR_ATTR_2(temp3_max_beep, S_IRUGO|S_IWUSR, show_temp_beep,
312 store_temp_beep, 0, 3),
313 SENSOR_ATTR_2(temp3_crit, S_IRUGO|S_IWUSR, show_temp_crit,
314 store_temp_crit, 0, 3),
315 SENSOR_ATTR_2(temp3_crit_hyst, S_IRUGO, show_temp_crit_hyst, NULL,
316 0, 3),
317 SENSOR_ATTR_2(temp3_crit_alarm, S_IRUGO, show_temp_alarm, NULL, 0, 7),
318 SENSOR_ATTR_2(temp3_crit_beep, S_IRUGO|S_IWUSR, show_temp_beep,
319 store_temp_beep, 0, 7),
320 SENSOR_ATTR_2(temp3_type, S_IRUGO, show_temp_type, NULL, 0, 3),
321 SENSOR_ATTR_2(temp3_fault, S_IRUGO, show_temp_fault, NULL, 0, 3),
322};
323
324/* Temp and in attr found only on the f71882fg */
325static struct sensor_device_attribute_2 f71882fg_in_temp_attr[] = {
326 SENSOR_ATTR_2(in1_max, S_IRUGO|S_IWUSR, show_in_max, store_in_max,
327 0, 1),
328 SENSOR_ATTR_2(in1_beep, S_IRUGO|S_IWUSR, show_in_beep, store_in_beep,
329 0, 1),
330 SENSOR_ATTR_2(in1_alarm, S_IRUGO, show_in_alarm, NULL, 0, 1),
331};
332
333/* Temp and in attr for the f8000
334 Note on the f8000 temp_ovt (crit) is used as max, and temp_high (max)
335 is used as hysteresis value to clear alarms
336 */
337static struct sensor_device_attribute_2 f8000_in_temp_attr[] = {
338 SENSOR_ATTR_2(in0_input, S_IRUGO, show_in, NULL, 0, 0),
339 SENSOR_ATTR_2(in1_input, S_IRUGO, show_in, NULL, 0, 1),
340 SENSOR_ATTR_2(in2_input, S_IRUGO, show_in, NULL, 0, 2),
341 SENSOR_ATTR_2(temp1_input, S_IRUGO, show_temp, NULL, 0, 0),
342 SENSOR_ATTR_2(temp1_max, S_IRUGO|S_IWUSR, show_temp_crit,
343 store_temp_crit, 0, 0),
344 SENSOR_ATTR_2(temp1_max_hyst, S_IRUGO|S_IWUSR, show_temp_max,
345 store_temp_max, 0, 0),
346 SENSOR_ATTR_2(temp1_alarm, S_IRUGO, show_temp_alarm, NULL, 0, 4),
347 SENSOR_ATTR_2(temp2_input, S_IRUGO, show_temp, NULL, 0, 1),
348 SENSOR_ATTR_2(temp2_max, S_IRUGO|S_IWUSR, show_temp_crit,
349 store_temp_crit, 0, 1),
350 SENSOR_ATTR_2(temp2_max_hyst, S_IRUGO|S_IWUSR, show_temp_max,
351 store_temp_max, 0, 1),
352 SENSOR_ATTR_2(temp2_alarm, S_IRUGO, show_temp_alarm, NULL, 0, 5),
353 SENSOR_ATTR_2(temp2_type, S_IRUGO, show_temp_type, NULL, 0, 1),
354 SENSOR_ATTR_2(temp3_input, S_IRUGO, show_temp, NULL, 0, 2),
355 SENSOR_ATTR_2(temp3_max, S_IRUGO|S_IWUSR, show_temp_crit,
356 store_temp_crit, 0, 2),
357 SENSOR_ATTR_2(temp3_max_hyst, S_IRUGO|S_IWUSR, show_temp_max,
358 store_temp_max, 0, 2),
359 SENSOR_ATTR_2(temp3_alarm, S_IRUGO, show_temp_alarm, NULL, 0, 6),
360};
361
362/* Fan / PWM attr common to all models */
363static struct sensor_device_attribute_2 fxxxx_fan_attr[] = {
364 SENSOR_ATTR_2(fan1_input, S_IRUGO, show_fan, NULL, 0, 0),
365 SENSOR_ATTR_2(fan1_full_speed, S_IRUGO|S_IWUSR,
366 show_fan_full_speed,
367 store_fan_full_speed, 0, 0),
368 SENSOR_ATTR_2(fan1_alarm, S_IRUGO, show_fan_alarm, NULL, 0, 0),
369 SENSOR_ATTR_2(fan2_input, S_IRUGO, show_fan, NULL, 0, 1),
370 SENSOR_ATTR_2(fan2_full_speed, S_IRUGO|S_IWUSR,
371 show_fan_full_speed,
372 store_fan_full_speed, 0, 1),
373 SENSOR_ATTR_2(fan2_alarm, S_IRUGO, show_fan_alarm, NULL, 0, 1),
374 SENSOR_ATTR_2(fan3_input, S_IRUGO, show_fan, NULL, 0, 2),
375 SENSOR_ATTR_2(fan3_full_speed, S_IRUGO|S_IWUSR,
376 show_fan_full_speed,
377 store_fan_full_speed, 0, 2),
378 SENSOR_ATTR_2(fan3_alarm, S_IRUGO, show_fan_alarm, NULL, 0, 2),
379
380 SENSOR_ATTR_2(pwm1, S_IRUGO|S_IWUSR, show_pwm, store_pwm, 0, 0),
381 SENSOR_ATTR_2(pwm1_enable, S_IRUGO|S_IWUSR, show_pwm_enable,
382 store_pwm_enable, 0, 0),
383 SENSOR_ATTR_2(pwm1_interpolate, S_IRUGO|S_IWUSR,
384 show_pwm_interpolate, store_pwm_interpolate, 0, 0),
385 SENSOR_ATTR_2(pwm1_auto_channels_temp, S_IRUGO|S_IWUSR,
386 show_pwm_auto_point_channel,
387 store_pwm_auto_point_channel, 0, 0),
388
389 SENSOR_ATTR_2(pwm2, S_IRUGO|S_IWUSR, show_pwm, store_pwm, 0, 1),
390 SENSOR_ATTR_2(pwm2_enable, S_IRUGO|S_IWUSR, show_pwm_enable,
391 store_pwm_enable, 0, 1),
392 SENSOR_ATTR_2(pwm2_interpolate, S_IRUGO|S_IWUSR,
393 show_pwm_interpolate, store_pwm_interpolate, 0, 1),
394 SENSOR_ATTR_2(pwm2_auto_channels_temp, S_IRUGO|S_IWUSR,
395 show_pwm_auto_point_channel,
396 store_pwm_auto_point_channel, 0, 1),
397
398 SENSOR_ATTR_2(pwm3_interpolate, S_IRUGO|S_IWUSR,
399 show_pwm_interpolate, store_pwm_interpolate, 0, 2),
400 SENSOR_ATTR_2(pwm3_auto_channels_temp, S_IRUGO|S_IWUSR,
401 show_pwm_auto_point_channel,
402 store_pwm_auto_point_channel, 0, 2),
189}; 403};
190 404
191static struct sensor_device_attribute f71882fg_in_temp_attr[] = 405/* Fan / PWM attr for the f71862fg, less pwms and less zones per pwm than the
192{ 406 f71882fg */
193 SENSOR_ATTR(in0_input, S_IRUGO, show_in, NULL, 0), 407static struct sensor_device_attribute_2 f71862fg_fan_attr[] = {
194 SENSOR_ATTR(in1_input, S_IRUGO, show_in, NULL, 1), 408 SENSOR_ATTR_2(fan1_beep, S_IRUGO|S_IWUSR, show_fan_beep,
195 SENSOR_ATTR(in1_max, S_IRUGO|S_IWUSR, show_in_max, store_in_max, 1), 409 store_fan_beep, 0, 0),
196 SENSOR_ATTR(in1_beep, S_IRUGO|S_IWUSR, show_in_beep, store_in_beep, 1), 410 SENSOR_ATTR_2(fan2_beep, S_IRUGO|S_IWUSR, show_fan_beep,
197 SENSOR_ATTR(in1_alarm, S_IRUGO, show_in_alarm, NULL, 1), 411 store_fan_beep, 0, 1),
198 SENSOR_ATTR(in2_input, S_IRUGO, show_in, NULL, 2), 412 SENSOR_ATTR_2(fan3_beep, S_IRUGO|S_IWUSR, show_fan_beep,
199 SENSOR_ATTR(in3_input, S_IRUGO, show_in, NULL, 3), 413 store_fan_beep, 0, 2),
200 SENSOR_ATTR(in4_input, S_IRUGO, show_in, NULL, 4), 414
201 SENSOR_ATTR(in5_input, S_IRUGO, show_in, NULL, 5), 415 SENSOR_ATTR_2(pwm1_auto_point1_pwm, S_IRUGO|S_IWUSR,
202 SENSOR_ATTR(in6_input, S_IRUGO, show_in, NULL, 6), 416 show_pwm_auto_point_pwm, store_pwm_auto_point_pwm,
203 SENSOR_ATTR(in7_input, S_IRUGO, show_in, NULL, 7), 417 1, 0),
204 SENSOR_ATTR(in8_input, S_IRUGO, show_in, NULL, 8), 418 SENSOR_ATTR_2(pwm1_auto_point2_pwm, S_IRUGO|S_IWUSR,
205 SENSOR_ATTR(temp1_input, S_IRUGO, show_temp, NULL, 0), 419 show_pwm_auto_point_pwm, store_pwm_auto_point_pwm,
206 SENSOR_ATTR(temp1_max, S_IRUGO|S_IWUSR, show_temp_max, 420 4, 0),
207 store_temp_max, 0), 421 SENSOR_ATTR_2(pwm1_auto_point1_temp, S_IRUGO|S_IWUSR,
208 SENSOR_ATTR(temp1_max_hyst, S_IRUGO|S_IWUSR, show_temp_max_hyst, 422 show_pwm_auto_point_temp, store_pwm_auto_point_temp,
209 store_temp_max_hyst, 0), 423 0, 0),
210 SENSOR_ATTR(temp1_crit, S_IRUGO|S_IWUSR, show_temp_crit, 424 SENSOR_ATTR_2(pwm1_auto_point2_temp, S_IRUGO|S_IWUSR,
211 store_temp_crit, 0), 425 show_pwm_auto_point_temp, store_pwm_auto_point_temp,
212 SENSOR_ATTR(temp1_crit_hyst, S_IRUGO, show_temp_crit_hyst, NULL, 0), 426 3, 0),
213 SENSOR_ATTR(temp1_type, S_IRUGO, show_temp_type, NULL, 0), 427 SENSOR_ATTR_2(pwm1_auto_point1_temp_hyst, S_IRUGO|S_IWUSR,
214 SENSOR_ATTR(temp1_beep, S_IRUGO|S_IWUSR, show_temp_beep, 428 show_pwm_auto_point_temp_hyst,
215 store_temp_beep, 0), 429 store_pwm_auto_point_temp_hyst,
216 SENSOR_ATTR(temp1_alarm, S_IRUGO, show_temp_alarm, NULL, 0), 430 0, 0),
217 SENSOR_ATTR(temp1_fault, S_IRUGO, show_temp_fault, NULL, 0), 431 SENSOR_ATTR_2(pwm1_auto_point2_temp_hyst, S_IRUGO,
218 SENSOR_ATTR(temp2_input, S_IRUGO, show_temp, NULL, 1), 432 show_pwm_auto_point_temp_hyst, NULL, 3, 0),
219 SENSOR_ATTR(temp2_max, S_IRUGO|S_IWUSR, show_temp_max, 433
220 store_temp_max, 1), 434 SENSOR_ATTR_2(pwm2_auto_point1_pwm, S_IRUGO|S_IWUSR,
221 SENSOR_ATTR(temp2_max_hyst, S_IRUGO|S_IWUSR, show_temp_max_hyst, 435 show_pwm_auto_point_pwm, store_pwm_auto_point_pwm,
222 store_temp_max_hyst, 1), 436 1, 1),
223 SENSOR_ATTR(temp2_crit, S_IRUGO|S_IWUSR, show_temp_crit, 437 SENSOR_ATTR_2(pwm2_auto_point2_pwm, S_IRUGO|S_IWUSR,
224 store_temp_crit, 1), 438 show_pwm_auto_point_pwm, store_pwm_auto_point_pwm,
225 SENSOR_ATTR(temp2_crit_hyst, S_IRUGO, show_temp_crit_hyst, NULL, 1), 439 4, 1),
226 SENSOR_ATTR(temp2_type, S_IRUGO, show_temp_type, NULL, 1), 440 SENSOR_ATTR_2(pwm2_auto_point1_temp, S_IRUGO|S_IWUSR,
227 SENSOR_ATTR(temp2_beep, S_IRUGO|S_IWUSR, show_temp_beep, 441 show_pwm_auto_point_temp, store_pwm_auto_point_temp,
228 store_temp_beep, 1), 442 0, 1),
229 SENSOR_ATTR(temp2_alarm, S_IRUGO, show_temp_alarm, NULL, 1), 443 SENSOR_ATTR_2(pwm2_auto_point2_temp, S_IRUGO|S_IWUSR,
230 SENSOR_ATTR(temp2_fault, S_IRUGO, show_temp_fault, NULL, 1), 444 show_pwm_auto_point_temp, store_pwm_auto_point_temp,
231 SENSOR_ATTR(temp3_input, S_IRUGO, show_temp, NULL, 2), 445 3, 1),
232 SENSOR_ATTR(temp3_max, S_IRUGO|S_IWUSR, show_temp_max, 446 SENSOR_ATTR_2(pwm2_auto_point1_temp_hyst, S_IRUGO|S_IWUSR,
233 store_temp_max, 2), 447 show_pwm_auto_point_temp_hyst,
234 SENSOR_ATTR(temp3_max_hyst, S_IRUGO|S_IWUSR, show_temp_max_hyst, 448 store_pwm_auto_point_temp_hyst,
235 store_temp_max_hyst, 2), 449 0, 1),
236 SENSOR_ATTR(temp3_crit, S_IRUGO|S_IWUSR, show_temp_crit, 450 SENSOR_ATTR_2(pwm2_auto_point2_temp_hyst, S_IRUGO,
237 store_temp_crit, 2), 451 show_pwm_auto_point_temp_hyst, NULL, 3, 1),
238 SENSOR_ATTR(temp3_crit_hyst, S_IRUGO, show_temp_crit_hyst, NULL, 2), 452
239 SENSOR_ATTR(temp3_type, S_IRUGO, show_temp_type, NULL, 2), 453 SENSOR_ATTR_2(pwm3, S_IRUGO|S_IWUSR, show_pwm, store_pwm, 0, 2),
240 SENSOR_ATTR(temp3_beep, S_IRUGO|S_IWUSR, show_temp_beep, 454 SENSOR_ATTR_2(pwm3_enable, S_IRUGO|S_IWUSR, show_pwm_enable,
241 store_temp_beep, 2), 455 store_pwm_enable, 0, 2),
242 SENSOR_ATTR(temp3_alarm, S_IRUGO, show_temp_alarm, NULL, 2), 456 SENSOR_ATTR_2(pwm3_auto_point1_pwm, S_IRUGO|S_IWUSR,
243 SENSOR_ATTR(temp3_fault, S_IRUGO, show_temp_fault, NULL, 2) 457 show_pwm_auto_point_pwm, store_pwm_auto_point_pwm,
458 1, 2),
459 SENSOR_ATTR_2(pwm3_auto_point2_pwm, S_IRUGO|S_IWUSR,
460 show_pwm_auto_point_pwm, store_pwm_auto_point_pwm,
461 4, 2),
462 SENSOR_ATTR_2(pwm3_auto_point1_temp, S_IRUGO|S_IWUSR,
463 show_pwm_auto_point_temp, store_pwm_auto_point_temp,
464 0, 2),
465 SENSOR_ATTR_2(pwm3_auto_point2_temp, S_IRUGO|S_IWUSR,
466 show_pwm_auto_point_temp, store_pwm_auto_point_temp,
467 3, 2),
468 SENSOR_ATTR_2(pwm3_auto_point1_temp_hyst, S_IRUGO|S_IWUSR,
469 show_pwm_auto_point_temp_hyst,
470 store_pwm_auto_point_temp_hyst,
471 0, 2),
472 SENSOR_ATTR_2(pwm3_auto_point2_temp_hyst, S_IRUGO,
473 show_pwm_auto_point_temp_hyst, NULL, 3, 2),
244}; 474};
245 475
246static struct sensor_device_attribute f71882fg_fan_attr[] = 476/* Fan / PWM attr for the f71882fg */
247{ 477static struct sensor_device_attribute_2 f71882fg_fan_attr[] = {
248 SENSOR_ATTR(fan1_input, S_IRUGO, show_fan, NULL, 0), 478 SENSOR_ATTR_2(fan1_beep, S_IRUGO|S_IWUSR, show_fan_beep,
249 SENSOR_ATTR(fan1_beep, S_IRUGO|S_IWUSR, show_fan_beep, 479 store_fan_beep, 0, 0),
250 store_fan_beep, 0), 480 SENSOR_ATTR_2(fan2_beep, S_IRUGO|S_IWUSR, show_fan_beep,
251 SENSOR_ATTR(fan1_alarm, S_IRUGO, show_fan_alarm, NULL, 0), 481 store_fan_beep, 0, 1),
252 SENSOR_ATTR(fan2_input, S_IRUGO, show_fan, NULL, 1), 482 SENSOR_ATTR_2(fan3_beep, S_IRUGO|S_IWUSR, show_fan_beep,
253 SENSOR_ATTR(fan2_beep, S_IRUGO|S_IWUSR, show_fan_beep, 483 store_fan_beep, 0, 2),
254 store_fan_beep, 1), 484 SENSOR_ATTR_2(fan4_input, S_IRUGO, show_fan, NULL, 0, 3),
255 SENSOR_ATTR(fan2_alarm, S_IRUGO, show_fan_alarm, NULL, 1), 485 SENSOR_ATTR_2(fan4_full_speed, S_IRUGO|S_IWUSR,
256 SENSOR_ATTR(fan3_input, S_IRUGO, show_fan, NULL, 2), 486 show_fan_full_speed,
257 SENSOR_ATTR(fan3_beep, S_IRUGO|S_IWUSR, show_fan_beep, 487 store_fan_full_speed, 0, 3),
258 store_fan_beep, 2), 488 SENSOR_ATTR_2(fan4_beep, S_IRUGO|S_IWUSR, show_fan_beep,
259 SENSOR_ATTR(fan3_alarm, S_IRUGO, show_fan_alarm, NULL, 2), 489 store_fan_beep, 0, 3),
260 SENSOR_ATTR(fan4_input, S_IRUGO, show_fan, NULL, 3), 490 SENSOR_ATTR_2(fan4_alarm, S_IRUGO, show_fan_alarm, NULL, 0, 3),
261 SENSOR_ATTR(fan4_beep, S_IRUGO|S_IWUSR, show_fan_beep, 491
262 store_fan_beep, 3), 492 SENSOR_ATTR_2(pwm1_auto_point1_pwm, S_IRUGO|S_IWUSR,
263 SENSOR_ATTR(fan4_alarm, S_IRUGO, show_fan_alarm, NULL, 3) 493 show_pwm_auto_point_pwm, store_pwm_auto_point_pwm,
494 0, 0),
495 SENSOR_ATTR_2(pwm1_auto_point2_pwm, S_IRUGO|S_IWUSR,
496 show_pwm_auto_point_pwm, store_pwm_auto_point_pwm,
497 1, 0),
498 SENSOR_ATTR_2(pwm1_auto_point3_pwm, S_IRUGO|S_IWUSR,
499 show_pwm_auto_point_pwm, store_pwm_auto_point_pwm,
500 2, 0),
501 SENSOR_ATTR_2(pwm1_auto_point4_pwm, S_IRUGO|S_IWUSR,
502 show_pwm_auto_point_pwm, store_pwm_auto_point_pwm,
503 3, 0),
504 SENSOR_ATTR_2(pwm1_auto_point5_pwm, S_IRUGO|S_IWUSR,
505 show_pwm_auto_point_pwm, store_pwm_auto_point_pwm,
506 4, 0),
507 SENSOR_ATTR_2(pwm1_auto_point1_temp, S_IRUGO|S_IWUSR,
508 show_pwm_auto_point_temp, store_pwm_auto_point_temp,
509 0, 0),
510 SENSOR_ATTR_2(pwm1_auto_point2_temp, S_IRUGO|S_IWUSR,
511 show_pwm_auto_point_temp, store_pwm_auto_point_temp,
512 1, 0),
513 SENSOR_ATTR_2(pwm1_auto_point3_temp, S_IRUGO|S_IWUSR,
514 show_pwm_auto_point_temp, store_pwm_auto_point_temp,
515 2, 0),
516 SENSOR_ATTR_2(pwm1_auto_point4_temp, S_IRUGO|S_IWUSR,
517 show_pwm_auto_point_temp, store_pwm_auto_point_temp,
518 3, 0),
519 SENSOR_ATTR_2(pwm1_auto_point1_temp_hyst, S_IRUGO|S_IWUSR,
520 show_pwm_auto_point_temp_hyst,
521 store_pwm_auto_point_temp_hyst,
522 0, 0),
523 SENSOR_ATTR_2(pwm1_auto_point2_temp_hyst, S_IRUGO,
524 show_pwm_auto_point_temp_hyst, NULL, 1, 0),
525 SENSOR_ATTR_2(pwm1_auto_point3_temp_hyst, S_IRUGO,
526 show_pwm_auto_point_temp_hyst, NULL, 2, 0),
527 SENSOR_ATTR_2(pwm1_auto_point4_temp_hyst, S_IRUGO,
528 show_pwm_auto_point_temp_hyst, NULL, 3, 0),
529
530 SENSOR_ATTR_2(pwm2_auto_point1_pwm, S_IRUGO|S_IWUSR,
531 show_pwm_auto_point_pwm, store_pwm_auto_point_pwm,
532 0, 1),
533 SENSOR_ATTR_2(pwm2_auto_point2_pwm, S_IRUGO|S_IWUSR,
534 show_pwm_auto_point_pwm, store_pwm_auto_point_pwm,
535 1, 1),
536 SENSOR_ATTR_2(pwm2_auto_point3_pwm, S_IRUGO|S_IWUSR,
537 show_pwm_auto_point_pwm, store_pwm_auto_point_pwm,
538 2, 1),
539 SENSOR_ATTR_2(pwm2_auto_point4_pwm, S_IRUGO|S_IWUSR,
540 show_pwm_auto_point_pwm, store_pwm_auto_point_pwm,
541 3, 1),
542 SENSOR_ATTR_2(pwm2_auto_point5_pwm, S_IRUGO|S_IWUSR,
543 show_pwm_auto_point_pwm, store_pwm_auto_point_pwm,
544 4, 1),
545 SENSOR_ATTR_2(pwm2_auto_point1_temp, S_IRUGO|S_IWUSR,
546 show_pwm_auto_point_temp, store_pwm_auto_point_temp,
547 0, 1),
548 SENSOR_ATTR_2(pwm2_auto_point2_temp, S_IRUGO|S_IWUSR,
549 show_pwm_auto_point_temp, store_pwm_auto_point_temp,
550 1, 1),
551 SENSOR_ATTR_2(pwm2_auto_point3_temp, S_IRUGO|S_IWUSR,
552 show_pwm_auto_point_temp, store_pwm_auto_point_temp,
553 2, 1),
554 SENSOR_ATTR_2(pwm2_auto_point4_temp, S_IRUGO|S_IWUSR,
555 show_pwm_auto_point_temp, store_pwm_auto_point_temp,
556 3, 1),
557 SENSOR_ATTR_2(pwm2_auto_point1_temp_hyst, S_IRUGO|S_IWUSR,
558 show_pwm_auto_point_temp_hyst,
559 store_pwm_auto_point_temp_hyst,
560 0, 1),
561 SENSOR_ATTR_2(pwm2_auto_point2_temp_hyst, S_IRUGO,
562 show_pwm_auto_point_temp_hyst, NULL, 1, 1),
563 SENSOR_ATTR_2(pwm2_auto_point3_temp_hyst, S_IRUGO,
564 show_pwm_auto_point_temp_hyst, NULL, 2, 1),
565 SENSOR_ATTR_2(pwm2_auto_point4_temp_hyst, S_IRUGO,
566 show_pwm_auto_point_temp_hyst, NULL, 3, 1),
567
568 SENSOR_ATTR_2(pwm3, S_IRUGO|S_IWUSR, show_pwm, store_pwm, 0, 2),
569 SENSOR_ATTR_2(pwm3_enable, S_IRUGO|S_IWUSR, show_pwm_enable,
570 store_pwm_enable, 0, 2),
571 SENSOR_ATTR_2(pwm3_auto_point1_pwm, S_IRUGO|S_IWUSR,
572 show_pwm_auto_point_pwm, store_pwm_auto_point_pwm,
573 0, 2),
574 SENSOR_ATTR_2(pwm3_auto_point2_pwm, S_IRUGO|S_IWUSR,
575 show_pwm_auto_point_pwm, store_pwm_auto_point_pwm,
576 1, 2),
577 SENSOR_ATTR_2(pwm3_auto_point3_pwm, S_IRUGO|S_IWUSR,
578 show_pwm_auto_point_pwm, store_pwm_auto_point_pwm,
579 2, 2),
580 SENSOR_ATTR_2(pwm3_auto_point4_pwm, S_IRUGO|S_IWUSR,
581 show_pwm_auto_point_pwm, store_pwm_auto_point_pwm,
582 3, 2),
583 SENSOR_ATTR_2(pwm3_auto_point5_pwm, S_IRUGO|S_IWUSR,
584 show_pwm_auto_point_pwm, store_pwm_auto_point_pwm,
585 4, 2),
586 SENSOR_ATTR_2(pwm3_auto_point1_temp, S_IRUGO|S_IWUSR,
587 show_pwm_auto_point_temp, store_pwm_auto_point_temp,
588 0, 2),
589 SENSOR_ATTR_2(pwm3_auto_point2_temp, S_IRUGO|S_IWUSR,
590 show_pwm_auto_point_temp, store_pwm_auto_point_temp,
591 1, 2),
592 SENSOR_ATTR_2(pwm3_auto_point3_temp, S_IRUGO|S_IWUSR,
593 show_pwm_auto_point_temp, store_pwm_auto_point_temp,
594 2, 2),
595 SENSOR_ATTR_2(pwm3_auto_point4_temp, S_IRUGO|S_IWUSR,
596 show_pwm_auto_point_temp, store_pwm_auto_point_temp,
597 3, 2),
598 SENSOR_ATTR_2(pwm3_auto_point1_temp_hyst, S_IRUGO|S_IWUSR,
599 show_pwm_auto_point_temp_hyst,
600 store_pwm_auto_point_temp_hyst,
601 0, 2),
602 SENSOR_ATTR_2(pwm3_auto_point2_temp_hyst, S_IRUGO,
603 show_pwm_auto_point_temp_hyst, NULL, 1, 2),
604 SENSOR_ATTR_2(pwm3_auto_point3_temp_hyst, S_IRUGO,
605 show_pwm_auto_point_temp_hyst, NULL, 2, 2),
606 SENSOR_ATTR_2(pwm3_auto_point4_temp_hyst, S_IRUGO,
607 show_pwm_auto_point_temp_hyst, NULL, 3, 2),
608
609 SENSOR_ATTR_2(pwm4, S_IRUGO|S_IWUSR, show_pwm, store_pwm, 0, 3),
610 SENSOR_ATTR_2(pwm4_enable, S_IRUGO|S_IWUSR, show_pwm_enable,
611 store_pwm_enable, 0, 3),
612 SENSOR_ATTR_2(pwm4_interpolate, S_IRUGO|S_IWUSR,
613 show_pwm_interpolate, store_pwm_interpolate, 0, 3),
614 SENSOR_ATTR_2(pwm4_auto_channels_temp, S_IRUGO|S_IWUSR,
615 show_pwm_auto_point_channel,
616 store_pwm_auto_point_channel, 0, 3),
617 SENSOR_ATTR_2(pwm4_auto_point1_pwm, S_IRUGO|S_IWUSR,
618 show_pwm_auto_point_pwm, store_pwm_auto_point_pwm,
619 0, 3),
620 SENSOR_ATTR_2(pwm4_auto_point2_pwm, S_IRUGO|S_IWUSR,
621 show_pwm_auto_point_pwm, store_pwm_auto_point_pwm,
622 1, 3),
623 SENSOR_ATTR_2(pwm4_auto_point3_pwm, S_IRUGO|S_IWUSR,
624 show_pwm_auto_point_pwm, store_pwm_auto_point_pwm,
625 2, 3),
626 SENSOR_ATTR_2(pwm4_auto_point4_pwm, S_IRUGO|S_IWUSR,
627 show_pwm_auto_point_pwm, store_pwm_auto_point_pwm,
628 3, 3),
629 SENSOR_ATTR_2(pwm4_auto_point5_pwm, S_IRUGO|S_IWUSR,
630 show_pwm_auto_point_pwm, store_pwm_auto_point_pwm,
631 4, 3),
632 SENSOR_ATTR_2(pwm4_auto_point1_temp, S_IRUGO|S_IWUSR,
633 show_pwm_auto_point_temp, store_pwm_auto_point_temp,
634 0, 3),
635 SENSOR_ATTR_2(pwm4_auto_point2_temp, S_IRUGO|S_IWUSR,
636 show_pwm_auto_point_temp, store_pwm_auto_point_temp,
637 1, 3),
638 SENSOR_ATTR_2(pwm4_auto_point3_temp, S_IRUGO|S_IWUSR,
639 show_pwm_auto_point_temp, store_pwm_auto_point_temp,
640 2, 3),
641 SENSOR_ATTR_2(pwm4_auto_point4_temp, S_IRUGO|S_IWUSR,
642 show_pwm_auto_point_temp, store_pwm_auto_point_temp,
643 3, 3),
644 SENSOR_ATTR_2(pwm4_auto_point1_temp_hyst, S_IRUGO|S_IWUSR,
645 show_pwm_auto_point_temp_hyst,
646 store_pwm_auto_point_temp_hyst,
647 0, 3),
648 SENSOR_ATTR_2(pwm4_auto_point2_temp_hyst, S_IRUGO,
649 show_pwm_auto_point_temp_hyst, NULL, 1, 3),
650 SENSOR_ATTR_2(pwm4_auto_point3_temp_hyst, S_IRUGO,
651 show_pwm_auto_point_temp_hyst, NULL, 2, 3),
652 SENSOR_ATTR_2(pwm4_auto_point4_temp_hyst, S_IRUGO,
653 show_pwm_auto_point_temp_hyst, NULL, 3, 3),
264}; 654};
265 655
656/* Fan / PWM attr for the f8000, zones mapped to temp instead of to pwm!
657 Also the register block at offset A0 maps to TEMP1 (so our temp2, as the
658 F8000 starts counting temps at 0), B0 maps the TEMP2 and C0 maps to TEMP0 */
659static struct sensor_device_attribute_2 f8000_fan_attr[] = {
660 SENSOR_ATTR_2(fan4_input, S_IRUGO, show_fan, NULL, 0, 3),
661
662 SENSOR_ATTR_2(pwm3, S_IRUGO, show_pwm, NULL, 0, 2),
663
664 SENSOR_ATTR_2(temp1_auto_point1_pwm, S_IRUGO|S_IWUSR,
665 show_pwm_auto_point_pwm, store_pwm_auto_point_pwm,
666 0, 2),
667 SENSOR_ATTR_2(temp1_auto_point2_pwm, S_IRUGO|S_IWUSR,
668 show_pwm_auto_point_pwm, store_pwm_auto_point_pwm,
669 1, 2),
670 SENSOR_ATTR_2(temp1_auto_point3_pwm, S_IRUGO|S_IWUSR,
671 show_pwm_auto_point_pwm, store_pwm_auto_point_pwm,
672 2, 2),
673 SENSOR_ATTR_2(temp1_auto_point4_pwm, S_IRUGO|S_IWUSR,
674 show_pwm_auto_point_pwm, store_pwm_auto_point_pwm,
675 3, 2),
676 SENSOR_ATTR_2(temp1_auto_point5_pwm, S_IRUGO|S_IWUSR,
677 show_pwm_auto_point_pwm, store_pwm_auto_point_pwm,
678 4, 2),
679 SENSOR_ATTR_2(temp1_auto_point1_temp, S_IRUGO|S_IWUSR,
680 show_pwm_auto_point_temp, store_pwm_auto_point_temp,
681 0, 2),
682 SENSOR_ATTR_2(temp1_auto_point2_temp, S_IRUGO|S_IWUSR,
683 show_pwm_auto_point_temp, store_pwm_auto_point_temp,
684 1, 2),
685 SENSOR_ATTR_2(temp1_auto_point3_temp, S_IRUGO|S_IWUSR,
686 show_pwm_auto_point_temp, store_pwm_auto_point_temp,
687 2, 2),
688 SENSOR_ATTR_2(temp1_auto_point4_temp, S_IRUGO|S_IWUSR,
689 show_pwm_auto_point_temp, store_pwm_auto_point_temp,
690 3, 2),
691 SENSOR_ATTR_2(temp1_auto_point1_temp_hyst, S_IRUGO|S_IWUSR,
692 show_pwm_auto_point_temp_hyst,
693 store_pwm_auto_point_temp_hyst,
694 0, 2),
695 SENSOR_ATTR_2(temp1_auto_point2_temp_hyst, S_IRUGO,
696 show_pwm_auto_point_temp_hyst, NULL, 1, 2),
697 SENSOR_ATTR_2(temp1_auto_point3_temp_hyst, S_IRUGO,
698 show_pwm_auto_point_temp_hyst, NULL, 2, 2),
699 SENSOR_ATTR_2(temp1_auto_point4_temp_hyst, S_IRUGO,
700 show_pwm_auto_point_temp_hyst, NULL, 3, 2),
701
702 SENSOR_ATTR_2(temp2_auto_point1_pwm, S_IRUGO|S_IWUSR,
703 show_pwm_auto_point_pwm, store_pwm_auto_point_pwm,
704 0, 0),
705 SENSOR_ATTR_2(temp2_auto_point2_pwm, S_IRUGO|S_IWUSR,
706 show_pwm_auto_point_pwm, store_pwm_auto_point_pwm,
707 1, 0),
708 SENSOR_ATTR_2(temp2_auto_point3_pwm, S_IRUGO|S_IWUSR,
709 show_pwm_auto_point_pwm, store_pwm_auto_point_pwm,
710 2, 0),
711 SENSOR_ATTR_2(temp2_auto_point4_pwm, S_IRUGO|S_IWUSR,
712 show_pwm_auto_point_pwm, store_pwm_auto_point_pwm,
713 3, 0),
714 SENSOR_ATTR_2(temp2_auto_point5_pwm, S_IRUGO|S_IWUSR,
715 show_pwm_auto_point_pwm, store_pwm_auto_point_pwm,
716 4, 0),
717 SENSOR_ATTR_2(temp2_auto_point1_temp, S_IRUGO|S_IWUSR,
718 show_pwm_auto_point_temp, store_pwm_auto_point_temp,
719 0, 0),
720 SENSOR_ATTR_2(temp2_auto_point2_temp, S_IRUGO|S_IWUSR,
721 show_pwm_auto_point_temp, store_pwm_auto_point_temp,
722 1, 0),
723 SENSOR_ATTR_2(temp2_auto_point3_temp, S_IRUGO|S_IWUSR,
724 show_pwm_auto_point_temp, store_pwm_auto_point_temp,
725 2, 0),
726 SENSOR_ATTR_2(temp2_auto_point4_temp, S_IRUGO|S_IWUSR,
727 show_pwm_auto_point_temp, store_pwm_auto_point_temp,
728 3, 0),
729 SENSOR_ATTR_2(temp2_auto_point1_temp_hyst, S_IRUGO|S_IWUSR,
730 show_pwm_auto_point_temp_hyst,
731 store_pwm_auto_point_temp_hyst,
732 0, 0),
733 SENSOR_ATTR_2(temp2_auto_point2_temp_hyst, S_IRUGO,
734 show_pwm_auto_point_temp_hyst, NULL, 1, 0),
735 SENSOR_ATTR_2(temp2_auto_point3_temp_hyst, S_IRUGO,
736 show_pwm_auto_point_temp_hyst, NULL, 2, 0),
737 SENSOR_ATTR_2(temp2_auto_point4_temp_hyst, S_IRUGO,
738 show_pwm_auto_point_temp_hyst, NULL, 3, 0),
739
740 SENSOR_ATTR_2(temp3_auto_point1_pwm, S_IRUGO|S_IWUSR,
741 show_pwm_auto_point_pwm, store_pwm_auto_point_pwm,
742 0, 1),
743 SENSOR_ATTR_2(temp3_auto_point2_pwm, S_IRUGO|S_IWUSR,
744 show_pwm_auto_point_pwm, store_pwm_auto_point_pwm,
745 1, 1),
746 SENSOR_ATTR_2(temp3_auto_point3_pwm, S_IRUGO|S_IWUSR,
747 show_pwm_auto_point_pwm, store_pwm_auto_point_pwm,
748 2, 1),
749 SENSOR_ATTR_2(temp3_auto_point4_pwm, S_IRUGO|S_IWUSR,
750 show_pwm_auto_point_pwm, store_pwm_auto_point_pwm,
751 3, 1),
752 SENSOR_ATTR_2(temp3_auto_point5_pwm, S_IRUGO|S_IWUSR,
753 show_pwm_auto_point_pwm, store_pwm_auto_point_pwm,
754 4, 1),
755 SENSOR_ATTR_2(temp3_auto_point1_temp, S_IRUGO|S_IWUSR,
756 show_pwm_auto_point_temp, store_pwm_auto_point_temp,
757 0, 1),
758 SENSOR_ATTR_2(temp3_auto_point2_temp, S_IRUGO|S_IWUSR,
759 show_pwm_auto_point_temp, store_pwm_auto_point_temp,
760 1, 1),
761 SENSOR_ATTR_2(temp3_auto_point3_temp, S_IRUGO|S_IWUSR,
762 show_pwm_auto_point_temp, store_pwm_auto_point_temp,
763 2, 1),
764 SENSOR_ATTR_2(temp3_auto_point4_temp, S_IRUGO|S_IWUSR,
765 show_pwm_auto_point_temp, store_pwm_auto_point_temp,
766 3, 1),
767 SENSOR_ATTR_2(temp3_auto_point1_temp_hyst, S_IRUGO|S_IWUSR,
768 show_pwm_auto_point_temp_hyst,
769 store_pwm_auto_point_temp_hyst,
770 0, 1),
771 SENSOR_ATTR_2(temp3_auto_point2_temp_hyst, S_IRUGO,
772 show_pwm_auto_point_temp_hyst, NULL, 1, 1),
773 SENSOR_ATTR_2(temp3_auto_point3_temp_hyst, S_IRUGO,
774 show_pwm_auto_point_temp_hyst, NULL, 2, 1),
775 SENSOR_ATTR_2(temp3_auto_point4_temp_hyst, S_IRUGO,
776 show_pwm_auto_point_temp_hyst, NULL, 3, 1),
777};
266 778
267/* Super I/O functions */ 779/* Super I/O functions */
268static inline int superio_inb(int base, int reg) 780static inline int superio_inb(int base, int reg)
@@ -299,11 +811,16 @@ static inline void superio_exit(int base)
299 outb(SIO_LOCK_KEY, base); 811 outb(SIO_LOCK_KEY, base);
300} 812}
301 813
302static inline u16 fan_from_reg(u16 reg) 814static inline int fan_from_reg(u16 reg)
303{ 815{
304 return reg ? (1500000 / reg) : 0; 816 return reg ? (1500000 / reg) : 0;
305} 817}
306 818
819static inline u16 fan_to_reg(int fan)
820{
821 return fan ? (1500000 / fan) : 0;
822}
823
307static u8 f71882fg_read8(struct f71882fg_data *data, u8 reg) 824static u8 f71882fg_read8(struct f71882fg_data *data, u8 reg)
308{ 825{
309 u8 val; 826 u8 val;
@@ -332,52 +849,111 @@ static void f71882fg_write8(struct f71882fg_data *data, u8 reg, u8 val)
332 outb(val, data->addr + DATA_REG_OFFSET); 849 outb(val, data->addr + DATA_REG_OFFSET);
333} 850}
334 851
335static struct f71882fg_data *f71882fg_update_device(struct device * dev) 852static void f71882fg_write16(struct f71882fg_data *data, u8 reg, u16 val)
853{
854 outb(reg++, data->addr + ADDR_REG_OFFSET);
855 outb(val >> 8, data->addr + DATA_REG_OFFSET);
856 outb(reg, data->addr + ADDR_REG_OFFSET);
857 outb(val & 255, data->addr + DATA_REG_OFFSET);
858}
859
860static struct f71882fg_data *f71882fg_update_device(struct device *dev)
336{ 861{
337 struct f71882fg_data *data = dev_get_drvdata(dev); 862 struct f71882fg_data *data = dev_get_drvdata(dev);
338 int nr, reg, reg2; 863 int nr, reg = 0, reg2;
864 int nr_fans = (data->type == f71882fg) ? 4 : 3;
865 int nr_ins = (data->type == f8000) ? 3 : 9;
866 int temp_start = (data->type == f8000) ? 0 : 1;
339 867
340 mutex_lock(&data->update_lock); 868 mutex_lock(&data->update_lock);
341 869
342 /* Update once every 60 seconds */ 870 /* Update once every 60 seconds */
343 if ( time_after(jiffies, data->last_limits + 60 * HZ ) || 871 if ( time_after(jiffies, data->last_limits + 60 * HZ ) ||
344 !data->valid) { 872 !data->valid) {
345 data->in1_max = f71882fg_read8(data, F71882FG_REG_IN1_HIGH); 873 if (data->type == f71882fg) {
346 data->in_beep = f71882fg_read8(data, F71882FG_REG_IN_BEEP); 874 data->in1_max =
875 f71882fg_read8(data, F71882FG_REG_IN1_HIGH);
876 data->in_beep =
877 f71882fg_read8(data, F71882FG_REG_IN_BEEP);
878 }
347 879
348 /* Get High & boundary temps*/ 880 /* Get High & boundary temps*/
349 for (nr = 0; nr < 3; nr++) { 881 for (nr = temp_start; nr < 3 + temp_start; nr++) {
350 data->temp_ovt[nr] = f71882fg_read8(data, 882 data->temp_ovt[nr] = f71882fg_read8(data,
351 F71882FG_REG_TEMP_OVT(nr)); 883 F71882FG_REG_TEMP_OVT(nr));
352 data->temp_high[nr] = f71882fg_read8(data, 884 data->temp_high[nr] = f71882fg_read8(data,
353 F71882FG_REG_TEMP_HIGH(nr)); 885 F71882FG_REG_TEMP_HIGH(nr));
354 } 886 }
355 887
356 /* Have to hardcode hyst*/ 888 if (data->type != f8000) {
357 data->temp_hyst[0] = f71882fg_read8(data, 889 data->fan_beep = f71882fg_read8(data,
358 F71882FG_REG_TEMP_HYST1) >> 4; 890 F71882FG_REG_FAN_BEEP);
359 /* Hyst temps 2 & 3 stored in same register */ 891 data->temp_beep = f71882fg_read8(data,
360 reg = f71882fg_read8(data, F71882FG_REG_TEMP_HYST23); 892 F71882FG_REG_TEMP_BEEP);
361 data->temp_hyst[1] = reg & 0x0F; 893 data->temp_hyst[0] = f71882fg_read8(data,
362 data->temp_hyst[2] = reg >> 4; 894 F71882FG_REG_TEMP_HYST(0));
363 895 data->temp_hyst[1] = f71882fg_read8(data,
364 /* Have to hardcode type, because temp1 is special */ 896 F71882FG_REG_TEMP_HYST(1));
365 reg = f71882fg_read8(data, F71882FG_REG_TEMP_TYPE); 897 /* Have to hardcode type, because temp1 is special */
898 reg = f71882fg_read8(data, F71882FG_REG_TEMP_TYPE);
899 data->temp_type[2] = (reg & 0x04) ? 2 : 4;
900 data->temp_type[3] = (reg & 0x08) ? 2 : 4;
901 }
366 reg2 = f71882fg_read8(data, F71882FG_REG_PECI); 902 reg2 = f71882fg_read8(data, F71882FG_REG_PECI);
367 if ((reg2 & 0x03) == 0x01) 903 if ((reg2 & 0x03) == 0x01)
368 data->temp_type[0] = 6 /* PECI */; 904 data->temp_type[1] = 6 /* PECI */;
369 else if ((reg2 & 0x03) == 0x02) 905 else if ((reg2 & 0x03) == 0x02)
370 data->temp_type[0] = 5 /* AMDSI */; 906 data->temp_type[1] = 5 /* AMDSI */;
907 else if (data->type != f8000)
908 data->temp_type[1] = (reg & 0x02) ? 2 : 4;
371 else 909 else
372 data->temp_type[0] = (reg & 0x02) ? 2 : 4; 910 data->temp_type[1] = 2; /* F8000 only supports BJT */
373 911
374 data->temp_type[1] = (reg & 0x04) ? 2 : 4; 912 data->pwm_enable = f71882fg_read8(data,
375 data->temp_type[2] = (reg & 0x08) ? 2 : 4; 913 F71882FG_REG_PWM_ENABLE);
376 914 data->pwm_auto_point_hyst[0] =
377 data->temp_beep = f71882fg_read8(data, F71882FG_REG_TEMP_BEEP); 915 f71882fg_read8(data, F71882FG_REG_FAN_HYST(0));
378 916 data->pwm_auto_point_hyst[1] =
379 data->fan_beep = f71882fg_read8(data, F71882FG_REG_FAN_BEEP); 917 f71882fg_read8(data, F71882FG_REG_FAN_HYST(1));
380 918
919 for (nr = 0; nr < nr_fans; nr++) {
920 data->pwm_auto_point_mapping[nr] =
921 f71882fg_read8(data,
922 F71882FG_REG_POINT_MAPPING(nr));
923
924 if (data->type != f71862fg) {
925 int point;
926 for (point = 0; point < 5; point++) {
927 data->pwm_auto_point_pwm[nr][point] =
928 f71882fg_read8(data,
929 F71882FG_REG_POINT_PWM
930 (nr, point));
931 }
932 for (point = 0; point < 4; point++) {
933 data->pwm_auto_point_temp[nr][point] =
934 f71882fg_read8(data,
935 F71882FG_REG_POINT_TEMP
936 (nr, point));
937 }
938 } else {
939 data->pwm_auto_point_pwm[nr][1] =
940 f71882fg_read8(data,
941 F71882FG_REG_POINT_PWM
942 (nr, 1));
943 data->pwm_auto_point_pwm[nr][4] =
944 f71882fg_read8(data,
945 F71882FG_REG_POINT_PWM
946 (nr, 4));
947 data->pwm_auto_point_temp[nr][0] =
948 f71882fg_read8(data,
949 F71882FG_REG_POINT_TEMP
950 (nr, 0));
951 data->pwm_auto_point_temp[nr][3] =
952 f71882fg_read8(data,
953 F71882FG_REG_POINT_TEMP
954 (nr, 3));
955 }
956 }
381 data->last_limits = jiffies; 957 data->last_limits = jiffies;
382 } 958 }
383 959
@@ -387,19 +963,32 @@ static struct f71882fg_data *f71882fg_update_device(struct device * dev)
387 F71882FG_REG_TEMP_STATUS); 963 F71882FG_REG_TEMP_STATUS);
388 data->temp_diode_open = f71882fg_read8(data, 964 data->temp_diode_open = f71882fg_read8(data,
389 F71882FG_REG_TEMP_DIODE_OPEN); 965 F71882FG_REG_TEMP_DIODE_OPEN);
390 for (nr = 0; nr < 3; nr++) 966 for (nr = temp_start; nr < 3 + temp_start; nr++)
391 data->temp[nr] = f71882fg_read8(data, 967 data->temp[nr] = f71882fg_read8(data,
392 F71882FG_REG_TEMP(nr)); 968 F71882FG_REG_TEMP(nr));
393 969
394 data->fan_status = f71882fg_read8(data, 970 data->fan_status = f71882fg_read8(data,
395 F71882FG_REG_FAN_STATUS); 971 F71882FG_REG_FAN_STATUS);
396 for (nr = 0; nr < 4; nr++) 972 for (nr = 0; nr < nr_fans; nr++) {
397 data->fan[nr] = f71882fg_read16(data, 973 data->fan[nr] = f71882fg_read16(data,
398 F71882FG_REG_FAN(nr)); 974 F71882FG_REG_FAN(nr));
975 data->fan_target[nr] =
976 f71882fg_read16(data, F71882FG_REG_FAN_TARGET(nr));
977 data->fan_full_speed[nr] =
978 f71882fg_read16(data,
979 F71882FG_REG_FAN_FULL_SPEED(nr));
980 data->pwm[nr] =
981 f71882fg_read8(data, F71882FG_REG_PWM(nr));
982 }
399 983
400 data->in_status = f71882fg_read8(data, 984 /* The f8000 can monitor 1 more fan, but has no pwm for it */
985 if (data->type == f8000)
986 data->fan[3] = f71882fg_read16(data,
987 F71882FG_REG_FAN(3));
988 if (data->type == f71882fg)
989 data->in_status = f71882fg_read8(data,
401 F71882FG_REG_IN_STATUS); 990 F71882FG_REG_IN_STATUS);
402 for (nr = 0; nr < 9; nr++) 991 for (nr = 0; nr < nr_ins; nr++)
403 data->in[nr] = f71882fg_read8(data, 992 data->in[nr] = f71882fg_read8(data,
404 F71882FG_REG_IN(nr)); 993 F71882FG_REG_IN(nr));
405 994
@@ -417,7 +1006,7 @@ static ssize_t show_fan(struct device *dev, struct device_attribute *devattr,
417 char *buf) 1006 char *buf)
418{ 1007{
419 struct f71882fg_data *data = f71882fg_update_device(dev); 1008 struct f71882fg_data *data = f71882fg_update_device(dev);
420 int nr = to_sensor_dev_attr(devattr)->index; 1009 int nr = to_sensor_dev_attr_2(devattr)->index;
421 int speed = fan_from_reg(data->fan[nr]); 1010 int speed = fan_from_reg(data->fan[nr]);
422 1011
423 if (speed == FAN_MIN_DETECT) 1012 if (speed == FAN_MIN_DETECT)
@@ -426,11 +1015,39 @@ static ssize_t show_fan(struct device *dev, struct device_attribute *devattr,
426 return sprintf(buf, "%d\n", speed); 1015 return sprintf(buf, "%d\n", speed);
427} 1016}
428 1017
1018static ssize_t show_fan_full_speed(struct device *dev,
1019 struct device_attribute *devattr, char *buf)
1020{
1021 struct f71882fg_data *data = f71882fg_update_device(dev);
1022 int nr = to_sensor_dev_attr_2(devattr)->index;
1023 int speed = fan_from_reg(data->fan_full_speed[nr]);
1024 return sprintf(buf, "%d\n", speed);
1025}
1026
1027static ssize_t store_fan_full_speed(struct device *dev,
1028 struct device_attribute *devattr,
1029 const char *buf, size_t count)
1030{
1031 struct f71882fg_data *data = dev_get_drvdata(dev);
1032 int nr = to_sensor_dev_attr_2(devattr)->index;
1033 long val = simple_strtol(buf, NULL, 10);
1034
1035 val = SENSORS_LIMIT(val, 23, 1500000);
1036 val = fan_to_reg(val);
1037
1038 mutex_lock(&data->update_lock);
1039 f71882fg_write16(data, F71882FG_REG_FAN_FULL_SPEED(nr), val);
1040 data->fan_full_speed[nr] = val;
1041 mutex_unlock(&data->update_lock);
1042
1043 return count;
1044}
1045
429static ssize_t show_fan_beep(struct device *dev, struct device_attribute 1046static ssize_t show_fan_beep(struct device *dev, struct device_attribute
430 *devattr, char *buf) 1047 *devattr, char *buf)
431{ 1048{
432 struct f71882fg_data *data = f71882fg_update_device(dev); 1049 struct f71882fg_data *data = f71882fg_update_device(dev);
433 int nr = to_sensor_dev_attr(devattr)->index; 1050 int nr = to_sensor_dev_attr_2(devattr)->index;
434 1051
435 if (data->fan_beep & (1 << nr)) 1052 if (data->fan_beep & (1 << nr))
436 return sprintf(buf, "1\n"); 1053 return sprintf(buf, "1\n");
@@ -442,10 +1059,11 @@ static ssize_t store_fan_beep(struct device *dev, struct device_attribute
442 *devattr, const char *buf, size_t count) 1059 *devattr, const char *buf, size_t count)
443{ 1060{
444 struct f71882fg_data *data = dev_get_drvdata(dev); 1061 struct f71882fg_data *data = dev_get_drvdata(dev);
445 int nr = to_sensor_dev_attr(devattr)->index; 1062 int nr = to_sensor_dev_attr_2(devattr)->index;
446 int val = simple_strtoul(buf, NULL, 10); 1063 unsigned long val = simple_strtoul(buf, NULL, 10);
447 1064
448 mutex_lock(&data->update_lock); 1065 mutex_lock(&data->update_lock);
1066 data->fan_beep = f71882fg_read8(data, F71882FG_REG_FAN_BEEP);
449 if (val) 1067 if (val)
450 data->fan_beep |= 1 << nr; 1068 data->fan_beep |= 1 << nr;
451 else 1069 else
@@ -461,7 +1079,7 @@ static ssize_t show_fan_alarm(struct device *dev, struct device_attribute
461 *devattr, char *buf) 1079 *devattr, char *buf)
462{ 1080{
463 struct f71882fg_data *data = f71882fg_update_device(dev); 1081 struct f71882fg_data *data = f71882fg_update_device(dev);
464 int nr = to_sensor_dev_attr(devattr)->index; 1082 int nr = to_sensor_dev_attr_2(devattr)->index;
465 1083
466 if (data->fan_status & (1 << nr)) 1084 if (data->fan_status & (1 << nr))
467 return sprintf(buf, "1\n"); 1085 return sprintf(buf, "1\n");
@@ -473,7 +1091,7 @@ static ssize_t show_in(struct device *dev, struct device_attribute *devattr,
473 char *buf) 1091 char *buf)
474{ 1092{
475 struct f71882fg_data *data = f71882fg_update_device(dev); 1093 struct f71882fg_data *data = f71882fg_update_device(dev);
476 int nr = to_sensor_dev_attr(devattr)->index; 1094 int nr = to_sensor_dev_attr_2(devattr)->index;
477 1095
478 return sprintf(buf, "%d\n", data->in[nr] * 8); 1096 return sprintf(buf, "%d\n", data->in[nr] * 8);
479} 1097}
@@ -490,10 +1108,8 @@ static ssize_t store_in_max(struct device *dev, struct device_attribute
490 *devattr, const char *buf, size_t count) 1108 *devattr, const char *buf, size_t count)
491{ 1109{
492 struct f71882fg_data *data = dev_get_drvdata(dev); 1110 struct f71882fg_data *data = dev_get_drvdata(dev);
493 int val = simple_strtoul(buf, NULL, 10) / 8; 1111 long val = simple_strtol(buf, NULL, 10) / 8;
494 1112 val = SENSORS_LIMIT(val, 0, 255);
495 if (val > 255)
496 val = 255;
497 1113
498 mutex_lock(&data->update_lock); 1114 mutex_lock(&data->update_lock);
499 f71882fg_write8(data, F71882FG_REG_IN1_HIGH, val); 1115 f71882fg_write8(data, F71882FG_REG_IN1_HIGH, val);
@@ -507,7 +1123,7 @@ static ssize_t show_in_beep(struct device *dev, struct device_attribute
507 *devattr, char *buf) 1123 *devattr, char *buf)
508{ 1124{
509 struct f71882fg_data *data = f71882fg_update_device(dev); 1125 struct f71882fg_data *data = f71882fg_update_device(dev);
510 int nr = to_sensor_dev_attr(devattr)->index; 1126 int nr = to_sensor_dev_attr_2(devattr)->index;
511 1127
512 if (data->in_beep & (1 << nr)) 1128 if (data->in_beep & (1 << nr))
513 return sprintf(buf, "1\n"); 1129 return sprintf(buf, "1\n");
@@ -519,10 +1135,11 @@ static ssize_t store_in_beep(struct device *dev, struct device_attribute
519 *devattr, const char *buf, size_t count) 1135 *devattr, const char *buf, size_t count)
520{ 1136{
521 struct f71882fg_data *data = dev_get_drvdata(dev); 1137 struct f71882fg_data *data = dev_get_drvdata(dev);
522 int nr = to_sensor_dev_attr(devattr)->index; 1138 int nr = to_sensor_dev_attr_2(devattr)->index;
523 int val = simple_strtoul(buf, NULL, 10); 1139 unsigned long val = simple_strtoul(buf, NULL, 10);
524 1140
525 mutex_lock(&data->update_lock); 1141 mutex_lock(&data->update_lock);
1142 data->in_beep = f71882fg_read8(data, F71882FG_REG_IN_BEEP);
526 if (val) 1143 if (val)
527 data->in_beep |= 1 << nr; 1144 data->in_beep |= 1 << nr;
528 else 1145 else
@@ -538,7 +1155,7 @@ static ssize_t show_in_alarm(struct device *dev, struct device_attribute
538 *devattr, char *buf) 1155 *devattr, char *buf)
539{ 1156{
540 struct f71882fg_data *data = f71882fg_update_device(dev); 1157 struct f71882fg_data *data = f71882fg_update_device(dev);
541 int nr = to_sensor_dev_attr(devattr)->index; 1158 int nr = to_sensor_dev_attr_2(devattr)->index;
542 1159
543 if (data->in_status & (1 << nr)) 1160 if (data->in_status & (1 << nr))
544 return sprintf(buf, "1\n"); 1161 return sprintf(buf, "1\n");
@@ -550,7 +1167,7 @@ static ssize_t show_temp(struct device *dev, struct device_attribute *devattr,
550 char *buf) 1167 char *buf)
551{ 1168{
552 struct f71882fg_data *data = f71882fg_update_device(dev); 1169 struct f71882fg_data *data = f71882fg_update_device(dev);
553 int nr = to_sensor_dev_attr(devattr)->index; 1170 int nr = to_sensor_dev_attr_2(devattr)->index;
554 1171
555 return sprintf(buf, "%d\n", data->temp[nr] * 1000); 1172 return sprintf(buf, "%d\n", data->temp[nr] * 1000);
556} 1173}
@@ -559,7 +1176,7 @@ static ssize_t show_temp_max(struct device *dev, struct device_attribute
559 *devattr, char *buf) 1176 *devattr, char *buf)
560{ 1177{
561 struct f71882fg_data *data = f71882fg_update_device(dev); 1178 struct f71882fg_data *data = f71882fg_update_device(dev);
562 int nr = to_sensor_dev_attr(devattr)->index; 1179 int nr = to_sensor_dev_attr_2(devattr)->index;
563 1180
564 return sprintf(buf, "%d\n", data->temp_high[nr] * 1000); 1181 return sprintf(buf, "%d\n", data->temp_high[nr] * 1000);
565} 1182}
@@ -568,11 +1185,9 @@ static ssize_t store_temp_max(struct device *dev, struct device_attribute
568 *devattr, const char *buf, size_t count) 1185 *devattr, const char *buf, size_t count)
569{ 1186{
570 struct f71882fg_data *data = dev_get_drvdata(dev); 1187 struct f71882fg_data *data = dev_get_drvdata(dev);
571 int nr = to_sensor_dev_attr(devattr)->index; 1188 int nr = to_sensor_dev_attr_2(devattr)->index;
572 int val = simple_strtoul(buf, NULL, 10) / 1000; 1189 long val = simple_strtol(buf, NULL, 10) / 1000;
573 1190 val = SENSORS_LIMIT(val, 0, 255);
574 if (val > 255)
575 val = 255;
576 1191
577 mutex_lock(&data->update_lock); 1192 mutex_lock(&data->update_lock);
578 f71882fg_write8(data, F71882FG_REG_TEMP_HIGH(nr), val); 1193 f71882fg_write8(data, F71882FG_REG_TEMP_HIGH(nr), val);
@@ -586,48 +1201,46 @@ static ssize_t show_temp_max_hyst(struct device *dev, struct device_attribute
586 *devattr, char *buf) 1201 *devattr, char *buf)
587{ 1202{
588 struct f71882fg_data *data = f71882fg_update_device(dev); 1203 struct f71882fg_data *data = f71882fg_update_device(dev);
589 int nr = to_sensor_dev_attr(devattr)->index; 1204 int nr = to_sensor_dev_attr_2(devattr)->index;
1205 int temp_max_hyst;
1206
1207 mutex_lock(&data->update_lock);
1208 if (nr & 1)
1209 temp_max_hyst = data->temp_hyst[nr / 2] >> 4;
1210 else
1211 temp_max_hyst = data->temp_hyst[nr / 2] & 0x0f;
1212 temp_max_hyst = (data->temp_high[nr] - temp_max_hyst) * 1000;
1213 mutex_unlock(&data->update_lock);
590 1214
591 return sprintf(buf, "%d\n", 1215 return sprintf(buf, "%d\n", temp_max_hyst);
592 (data->temp_high[nr] - data->temp_hyst[nr]) * 1000);
593} 1216}
594 1217
595static ssize_t store_temp_max_hyst(struct device *dev, struct device_attribute 1218static ssize_t store_temp_max_hyst(struct device *dev, struct device_attribute
596 *devattr, const char *buf, size_t count) 1219 *devattr, const char *buf, size_t count)
597{ 1220{
598 struct f71882fg_data *data = dev_get_drvdata(dev); 1221 struct f71882fg_data *data = dev_get_drvdata(dev);
599 int nr = to_sensor_dev_attr(devattr)->index; 1222 int nr = to_sensor_dev_attr_2(devattr)->index;
600 int val = simple_strtoul(buf, NULL, 10) / 1000; 1223 long val = simple_strtol(buf, NULL, 10) / 1000;
601 ssize_t ret = count; 1224 ssize_t ret = count;
1225 u8 reg;
602 1226
603 mutex_lock(&data->update_lock); 1227 mutex_lock(&data->update_lock);
604 1228
605 /* convert abs to relative and check */ 1229 /* convert abs to relative and check */
1230 data->temp_high[nr] = f71882fg_read8(data, F71882FG_REG_TEMP_HIGH(nr));
1231 val = SENSORS_LIMIT(val, data->temp_high[nr] - 15,
1232 data->temp_high[nr]);
606 val = data->temp_high[nr] - val; 1233 val = data->temp_high[nr] - val;
607 if (val < 0 || val > 15) {
608 ret = -EINVAL;
609 goto store_temp_max_hyst_exit;
610 }
611
612 data->temp_hyst[nr] = val;
613 1234
614 /* convert value to register contents */ 1235 /* convert value to register contents */
615 switch (nr) { 1236 reg = f71882fg_read8(data, F71882FG_REG_TEMP_HYST(nr / 2));
616 case 0: 1237 if (nr & 1)
617 val = val << 4; 1238 reg = (reg & 0x0f) | (val << 4);
618 break; 1239 else
619 case 1: 1240 reg = (reg & 0xf0) | val;
620 val = val | (data->temp_hyst[2] << 4); 1241 f71882fg_write8(data, F71882FG_REG_TEMP_HYST(nr / 2), reg);
621 break; 1242 data->temp_hyst[nr / 2] = reg;
622 case 2:
623 val = data->temp_hyst[1] | (val << 4);
624 break;
625 }
626
627 f71882fg_write8(data, nr ? F71882FG_REG_TEMP_HYST23 :
628 F71882FG_REG_TEMP_HYST1, val);
629 1243
630store_temp_max_hyst_exit:
631 mutex_unlock(&data->update_lock); 1244 mutex_unlock(&data->update_lock);
632 return ret; 1245 return ret;
633} 1246}
@@ -636,7 +1249,7 @@ static ssize_t show_temp_crit(struct device *dev, struct device_attribute
636 *devattr, char *buf) 1249 *devattr, char *buf)
637{ 1250{
638 struct f71882fg_data *data = f71882fg_update_device(dev); 1251 struct f71882fg_data *data = f71882fg_update_device(dev);
639 int nr = to_sensor_dev_attr(devattr)->index; 1252 int nr = to_sensor_dev_attr_2(devattr)->index;
640 1253
641 return sprintf(buf, "%d\n", data->temp_ovt[nr] * 1000); 1254 return sprintf(buf, "%d\n", data->temp_ovt[nr] * 1000);
642} 1255}
@@ -645,11 +1258,9 @@ static ssize_t store_temp_crit(struct device *dev, struct device_attribute
645 *devattr, const char *buf, size_t count) 1258 *devattr, const char *buf, size_t count)
646{ 1259{
647 struct f71882fg_data *data = dev_get_drvdata(dev); 1260 struct f71882fg_data *data = dev_get_drvdata(dev);
648 int nr = to_sensor_dev_attr(devattr)->index; 1261 int nr = to_sensor_dev_attr_2(devattr)->index;
649 int val = simple_strtoul(buf, NULL, 10) / 1000; 1262 long val = simple_strtol(buf, NULL, 10) / 1000;
650 1263 val = SENSORS_LIMIT(val, 0, 255);
651 if (val > 255)
652 val = 255;
653 1264
654 mutex_lock(&data->update_lock); 1265 mutex_lock(&data->update_lock);
655 f71882fg_write8(data, F71882FG_REG_TEMP_OVT(nr), val); 1266 f71882fg_write8(data, F71882FG_REG_TEMP_OVT(nr), val);
@@ -663,17 +1274,25 @@ static ssize_t show_temp_crit_hyst(struct device *dev, struct device_attribute
663 *devattr, char *buf) 1274 *devattr, char *buf)
664{ 1275{
665 struct f71882fg_data *data = f71882fg_update_device(dev); 1276 struct f71882fg_data *data = f71882fg_update_device(dev);
666 int nr = to_sensor_dev_attr(devattr)->index; 1277 int nr = to_sensor_dev_attr_2(devattr)->index;
1278 int temp_crit_hyst;
1279
1280 mutex_lock(&data->update_lock);
1281 if (nr & 1)
1282 temp_crit_hyst = data->temp_hyst[nr / 2] >> 4;
1283 else
1284 temp_crit_hyst = data->temp_hyst[nr / 2] & 0x0f;
1285 temp_crit_hyst = (data->temp_ovt[nr] - temp_crit_hyst) * 1000;
1286 mutex_unlock(&data->update_lock);
667 1287
668 return sprintf(buf, "%d\n", 1288 return sprintf(buf, "%d\n", temp_crit_hyst);
669 (data->temp_ovt[nr] - data->temp_hyst[nr]) * 1000);
670} 1289}
671 1290
672static ssize_t show_temp_type(struct device *dev, struct device_attribute 1291static ssize_t show_temp_type(struct device *dev, struct device_attribute
673 *devattr, char *buf) 1292 *devattr, char *buf)
674{ 1293{
675 struct f71882fg_data *data = f71882fg_update_device(dev); 1294 struct f71882fg_data *data = f71882fg_update_device(dev);
676 int nr = to_sensor_dev_attr(devattr)->index; 1295 int nr = to_sensor_dev_attr_2(devattr)->index;
677 1296
678 return sprintf(buf, "%d\n", data->temp_type[nr]); 1297 return sprintf(buf, "%d\n", data->temp_type[nr]);
679} 1298}
@@ -682,9 +1301,9 @@ static ssize_t show_temp_beep(struct device *dev, struct device_attribute
682 *devattr, char *buf) 1301 *devattr, char *buf)
683{ 1302{
684 struct f71882fg_data *data = f71882fg_update_device(dev); 1303 struct f71882fg_data *data = f71882fg_update_device(dev);
685 int nr = to_sensor_dev_attr(devattr)->index; 1304 int nr = to_sensor_dev_attr_2(devattr)->index;
686 1305
687 if (data->temp_beep & (1 << (nr + 1))) 1306 if (data->temp_beep & (1 << nr))
688 return sprintf(buf, "1\n"); 1307 return sprintf(buf, "1\n");
689 else 1308 else
690 return sprintf(buf, "0\n"); 1309 return sprintf(buf, "0\n");
@@ -694,14 +1313,15 @@ static ssize_t store_temp_beep(struct device *dev, struct device_attribute
694 *devattr, const char *buf, size_t count) 1313 *devattr, const char *buf, size_t count)
695{ 1314{
696 struct f71882fg_data *data = dev_get_drvdata(dev); 1315 struct f71882fg_data *data = dev_get_drvdata(dev);
697 int nr = to_sensor_dev_attr(devattr)->index; 1316 int nr = to_sensor_dev_attr_2(devattr)->index;
698 int val = simple_strtoul(buf, NULL, 10); 1317 unsigned long val = simple_strtoul(buf, NULL, 10);
699 1318
700 mutex_lock(&data->update_lock); 1319 mutex_lock(&data->update_lock);
1320 data->temp_beep = f71882fg_read8(data, F71882FG_REG_TEMP_BEEP);
701 if (val) 1321 if (val)
702 data->temp_beep |= 1 << (nr + 1); 1322 data->temp_beep |= 1 << nr;
703 else 1323 else
704 data->temp_beep &= ~(1 << (nr + 1)); 1324 data->temp_beep &= ~(1 << nr);
705 1325
706 f71882fg_write8(data, F71882FG_REG_TEMP_BEEP, data->temp_beep); 1326 f71882fg_write8(data, F71882FG_REG_TEMP_BEEP, data->temp_beep);
707 mutex_unlock(&data->update_lock); 1327 mutex_unlock(&data->update_lock);
@@ -713,9 +1333,9 @@ static ssize_t show_temp_alarm(struct device *dev, struct device_attribute
713 *devattr, char *buf) 1333 *devattr, char *buf)
714{ 1334{
715 struct f71882fg_data *data = f71882fg_update_device(dev); 1335 struct f71882fg_data *data = f71882fg_update_device(dev);
716 int nr = to_sensor_dev_attr(devattr)->index; 1336 int nr = to_sensor_dev_attr_2(devattr)->index;
717 1337
718 if (data->temp_status & (1 << (nr + 1))) 1338 if (data->temp_status & (1 << nr))
719 return sprintf(buf, "1\n"); 1339 return sprintf(buf, "1\n");
720 else 1340 else
721 return sprintf(buf, "0\n"); 1341 return sprintf(buf, "0\n");
@@ -725,113 +1345,528 @@ static ssize_t show_temp_fault(struct device *dev, struct device_attribute
725 *devattr, char *buf) 1345 *devattr, char *buf)
726{ 1346{
727 struct f71882fg_data *data = f71882fg_update_device(dev); 1347 struct f71882fg_data *data = f71882fg_update_device(dev);
728 int nr = to_sensor_dev_attr(devattr)->index; 1348 int nr = to_sensor_dev_attr_2(devattr)->index;
729 1349
730 if (data->temp_diode_open & (1 << (nr + 1))) 1350 if (data->temp_diode_open & (1 << nr))
731 return sprintf(buf, "1\n"); 1351 return sprintf(buf, "1\n");
732 else 1352 else
733 return sprintf(buf, "0\n"); 1353 return sprintf(buf, "0\n");
734} 1354}
735 1355
1356static ssize_t show_pwm(struct device *dev,
1357 struct device_attribute *devattr, char *buf)
1358{
1359 struct f71882fg_data *data = f71882fg_update_device(dev);
1360 int val, nr = to_sensor_dev_attr_2(devattr)->index;
1361 mutex_lock(&data->update_lock);
1362 if (data->pwm_enable & (1 << (2 * nr)))
1363 /* PWM mode */
1364 val = data->pwm[nr];
1365 else {
1366 /* RPM mode */
1367 val = 255 * fan_from_reg(data->fan_target[nr])
1368 / fan_from_reg(data->fan_full_speed[nr]);
1369 }
1370 mutex_unlock(&data->update_lock);
1371 return sprintf(buf, "%d\n", val);
1372}
1373
1374static ssize_t store_pwm(struct device *dev,
1375 struct device_attribute *devattr, const char *buf,
1376 size_t count)
1377{
1378 struct f71882fg_data *data = dev_get_drvdata(dev);
1379 int nr = to_sensor_dev_attr_2(devattr)->index;
1380 long val = simple_strtol(buf, NULL, 10);
1381 val = SENSORS_LIMIT(val, 0, 255);
1382
1383 mutex_lock(&data->update_lock);
1384 data->pwm_enable = f71882fg_read8(data, F71882FG_REG_PWM_ENABLE);
1385 if ((data->type == f8000 && ((data->pwm_enable >> 2 * nr) & 3) != 2) ||
1386 (data->type != f8000 && !((data->pwm_enable >> 2 * nr) & 2))) {
1387 count = -EROFS;
1388 goto leave;
1389 }
1390 if (data->pwm_enable & (1 << (2 * nr))) {
1391 /* PWM mode */
1392 f71882fg_write8(data, F71882FG_REG_PWM(nr), val);
1393 data->pwm[nr] = val;
1394 } else {
1395 /* RPM mode */
1396 int target, full_speed;
1397 full_speed = f71882fg_read16(data,
1398 F71882FG_REG_FAN_FULL_SPEED(nr));
1399 target = fan_to_reg(val * fan_from_reg(full_speed) / 255);
1400 f71882fg_write16(data, F71882FG_REG_FAN_TARGET(nr), target);
1401 data->fan_target[nr] = target;
1402 data->fan_full_speed[nr] = full_speed;
1403 }
1404leave:
1405 mutex_unlock(&data->update_lock);
1406
1407 return count;
1408}
1409
1410static ssize_t show_pwm_enable(struct device *dev,
1411 struct device_attribute *devattr, char *buf)
1412{
1413 int result = 0;
1414 struct f71882fg_data *data = f71882fg_update_device(dev);
1415 int nr = to_sensor_dev_attr_2(devattr)->index;
1416
1417 switch ((data->pwm_enable >> 2 * nr) & 3) {
1418 case 0:
1419 case 1:
1420 result = 2; /* Normal auto mode */
1421 break;
1422 case 2:
1423 result = 1; /* Manual mode */
1424 break;
1425 case 3:
1426 if (data->type == f8000)
1427 result = 3; /* Thermostat mode */
1428 else
1429 result = 1; /* Manual mode */
1430 break;
1431 }
1432
1433 return sprintf(buf, "%d\n", result);
1434}
1435
1436static ssize_t store_pwm_enable(struct device *dev, struct device_attribute
1437 *devattr, const char *buf, size_t count)
1438{
1439 struct f71882fg_data *data = dev_get_drvdata(dev);
1440 int nr = to_sensor_dev_attr_2(devattr)->index;
1441 long val = simple_strtol(buf, NULL, 10);
1442
1443 mutex_lock(&data->update_lock);
1444 data->pwm_enable = f71882fg_read8(data, F71882FG_REG_PWM_ENABLE);
1445 /* Special case for F8000 auto PWM mode / Thermostat mode */
1446 if (data->type == f8000 && ((data->pwm_enable >> 2 * nr) & 1)) {
1447 switch (val) {
1448 case 2:
1449 data->pwm_enable &= ~(2 << (2 * nr));
1450 break; /* Normal auto mode */
1451 case 3:
1452 data->pwm_enable |= 2 << (2 * nr);
1453 break; /* Thermostat mode */
1454 default:
1455 count = -EINVAL;
1456 goto leave;
1457 }
1458 } else {
1459 switch (val) {
1460 case 1:
1461 data->pwm_enable |= 2 << (2 * nr);
1462 break; /* Manual */
1463 case 2:
1464 data->pwm_enable &= ~(2 << (2 * nr));
1465 break; /* Normal auto mode */
1466 default:
1467 count = -EINVAL;
1468 goto leave;
1469 }
1470 }
1471 f71882fg_write8(data, F71882FG_REG_PWM_ENABLE, data->pwm_enable);
1472leave:
1473 mutex_unlock(&data->update_lock);
1474
1475 return count;
1476}
1477
1478static ssize_t show_pwm_auto_point_pwm(struct device *dev,
1479 struct device_attribute *devattr,
1480 char *buf)
1481{
1482 int result;
1483 struct f71882fg_data *data = f71882fg_update_device(dev);
1484 int pwm = to_sensor_dev_attr_2(devattr)->index;
1485 int point = to_sensor_dev_attr_2(devattr)->nr;
1486
1487 mutex_lock(&data->update_lock);
1488 if (data->pwm_enable & (1 << (2 * pwm))) {
1489 /* PWM mode */
1490 result = data->pwm_auto_point_pwm[pwm][point];
1491 } else {
1492 /* RPM mode */
1493 result = 32 * 255 / (32 + data->pwm_auto_point_pwm[pwm][point]);
1494 }
1495 mutex_unlock(&data->update_lock);
1496
1497 return sprintf(buf, "%d\n", result);
1498}
1499
1500static ssize_t store_pwm_auto_point_pwm(struct device *dev,
1501 struct device_attribute *devattr,
1502 const char *buf, size_t count)
1503{
1504 struct f71882fg_data *data = dev_get_drvdata(dev);
1505 int pwm = to_sensor_dev_attr_2(devattr)->index;
1506 int point = to_sensor_dev_attr_2(devattr)->nr;
1507 long val = simple_strtol(buf, NULL, 10);
1508 val = SENSORS_LIMIT(val, 0, 255);
1509
1510 mutex_lock(&data->update_lock);
1511 data->pwm_enable = f71882fg_read8(data, F71882FG_REG_PWM_ENABLE);
1512 if (data->pwm_enable & (1 << (2 * pwm))) {
1513 /* PWM mode */
1514 } else {
1515 /* RPM mode */
1516 if (val < 29) /* Prevent negative numbers */
1517 val = 255;
1518 else
1519 val = (255 - val) * 32 / val;
1520 }
1521 f71882fg_write8(data, F71882FG_REG_POINT_PWM(pwm, point), val);
1522 data->pwm_auto_point_pwm[pwm][point] = val;
1523 mutex_unlock(&data->update_lock);
1524
1525 return count;
1526}
1527
1528static ssize_t show_pwm_auto_point_temp_hyst(struct device *dev,
1529 struct device_attribute *devattr,
1530 char *buf)
1531{
1532 int result = 0;
1533 struct f71882fg_data *data = f71882fg_update_device(dev);
1534 int nr = to_sensor_dev_attr_2(devattr)->index;
1535 int point = to_sensor_dev_attr_2(devattr)->nr;
1536
1537 mutex_lock(&data->update_lock);
1538 if (nr & 1)
1539 result = data->pwm_auto_point_hyst[nr / 2] >> 4;
1540 else
1541 result = data->pwm_auto_point_hyst[nr / 2] & 0x0f;
1542 result = 1000 * (data->pwm_auto_point_temp[nr][point] - result);
1543 mutex_unlock(&data->update_lock);
1544
1545 return sprintf(buf, "%d\n", result);
1546}
1547
1548static ssize_t store_pwm_auto_point_temp_hyst(struct device *dev,
1549 struct device_attribute *devattr,
1550 const char *buf, size_t count)
1551{
1552 struct f71882fg_data *data = dev_get_drvdata(dev);
1553 int nr = to_sensor_dev_attr_2(devattr)->index;
1554 int point = to_sensor_dev_attr_2(devattr)->nr;
1555 long val = simple_strtol(buf, NULL, 10) / 1000;
1556 u8 reg;
1557
1558 mutex_lock(&data->update_lock);
1559 data->pwm_auto_point_temp[nr][point] =
1560 f71882fg_read8(data, F71882FG_REG_POINT_TEMP(nr, point));
1561 val = SENSORS_LIMIT(val, data->pwm_auto_point_temp[nr][point] - 15,
1562 data->pwm_auto_point_temp[nr][point]);
1563 val = data->pwm_auto_point_temp[nr][point] - val;
1564
1565 reg = f71882fg_read8(data, F71882FG_REG_FAN_HYST(nr / 2));
1566 if (nr & 1)
1567 reg = (reg & 0x0f) | (val << 4);
1568 else
1569 reg = (reg & 0xf0) | val;
1570
1571 f71882fg_write8(data, F71882FG_REG_FAN_HYST(nr / 2), reg);
1572 data->pwm_auto_point_hyst[nr / 2] = reg;
1573 mutex_unlock(&data->update_lock);
1574
1575 return count;
1576}
1577
1578static ssize_t show_pwm_interpolate(struct device *dev,
1579 struct device_attribute *devattr, char *buf)
1580{
1581 int result;
1582 struct f71882fg_data *data = f71882fg_update_device(dev);
1583 int nr = to_sensor_dev_attr_2(devattr)->index;
1584
1585 result = (data->pwm_auto_point_mapping[nr] >> 4) & 1;
1586
1587 return sprintf(buf, "%d\n", result);
1588}
1589
1590static ssize_t store_pwm_interpolate(struct device *dev,
1591 struct device_attribute *devattr,
1592 const char *buf, size_t count)
1593{
1594 struct f71882fg_data *data = dev_get_drvdata(dev);
1595 int nr = to_sensor_dev_attr_2(devattr)->index;
1596 unsigned long val = simple_strtoul(buf, NULL, 10);
1597
1598 mutex_lock(&data->update_lock);
1599 data->pwm_auto_point_mapping[nr] =
1600 f71882fg_read8(data, F71882FG_REG_POINT_MAPPING(nr));
1601 if (val)
1602 val = data->pwm_auto_point_mapping[nr] | (1 << 4);
1603 else
1604 val = data->pwm_auto_point_mapping[nr] & (~(1 << 4));
1605 f71882fg_write8(data, F71882FG_REG_POINT_MAPPING(nr), val);
1606 data->pwm_auto_point_mapping[nr] = val;
1607 mutex_unlock(&data->update_lock);
1608
1609 return count;
1610}
1611
1612static ssize_t show_pwm_auto_point_channel(struct device *dev,
1613 struct device_attribute *devattr,
1614 char *buf)
1615{
1616 int result;
1617 struct f71882fg_data *data = f71882fg_update_device(dev);
1618 int nr = to_sensor_dev_attr_2(devattr)->index;
1619 int temp_start = (data->type == f8000) ? 0 : 1;
1620
1621 result = 1 << ((data->pwm_auto_point_mapping[nr] & 3) - temp_start);
1622
1623 return sprintf(buf, "%d\n", result);
1624}
1625
1626static ssize_t store_pwm_auto_point_channel(struct device *dev,
1627 struct device_attribute *devattr,
1628 const char *buf, size_t count)
1629{
1630 struct f71882fg_data *data = dev_get_drvdata(dev);
1631 int nr = to_sensor_dev_attr_2(devattr)->index;
1632 int temp_start = (data->type == f8000) ? 0 : 1;
1633 long val = simple_strtol(buf, NULL, 10);
1634
1635 switch (val) {
1636 case 1:
1637 val = 0;
1638 break;
1639 case 2:
1640 val = 1;
1641 break;
1642 case 4:
1643 val = 2;
1644 break;
1645 default:
1646 return -EINVAL;
1647 }
1648 val += temp_start;
1649 mutex_lock(&data->update_lock);
1650 data->pwm_auto_point_mapping[nr] =
1651 f71882fg_read8(data, F71882FG_REG_POINT_MAPPING(nr));
1652 val = (data->pwm_auto_point_mapping[nr] & 0xfc) | val;
1653 f71882fg_write8(data, F71882FG_REG_POINT_MAPPING(nr), val);
1654 data->pwm_auto_point_mapping[nr] = val;
1655 mutex_unlock(&data->update_lock);
1656
1657 return count;
1658}
1659
1660static ssize_t show_pwm_auto_point_temp(struct device *dev,
1661 struct device_attribute *devattr,
1662 char *buf)
1663{
1664 int result;
1665 struct f71882fg_data *data = f71882fg_update_device(dev);
1666 int pwm = to_sensor_dev_attr_2(devattr)->index;
1667 int point = to_sensor_dev_attr_2(devattr)->nr;
1668
1669 result = data->pwm_auto_point_temp[pwm][point];
1670 return sprintf(buf, "%d\n", 1000 * result);
1671}
1672
1673static ssize_t store_pwm_auto_point_temp(struct device *dev,
1674 struct device_attribute *devattr,
1675 const char *buf, size_t count)
1676{
1677 struct f71882fg_data *data = dev_get_drvdata(dev);
1678 int pwm = to_sensor_dev_attr_2(devattr)->index;
1679 int point = to_sensor_dev_attr_2(devattr)->nr;
1680 long val = simple_strtol(buf, NULL, 10) / 1000;
1681 val = SENSORS_LIMIT(val, 0, 255);
1682
1683 mutex_lock(&data->update_lock);
1684 f71882fg_write8(data, F71882FG_REG_POINT_TEMP(pwm, point), val);
1685 data->pwm_auto_point_temp[pwm][point] = val;
1686 mutex_unlock(&data->update_lock);
1687
1688 return count;
1689}
1690
736static ssize_t show_name(struct device *dev, struct device_attribute *devattr, 1691static ssize_t show_name(struct device *dev, struct device_attribute *devattr,
737 char *buf) 1692 char *buf)
738{ 1693{
739 return sprintf(buf, DRVNAME "\n"); 1694 struct f71882fg_data *data = dev_get_drvdata(dev);
1695 return sprintf(buf, "%s\n", f71882fg_names[data->type]);
740} 1696}
741 1697
1698static int __devinit f71882fg_create_sysfs_files(struct platform_device *pdev,
1699 struct sensor_device_attribute_2 *attr, int count)
1700{
1701 int err, i;
1702
1703 for (i = 0; i < count; i++) {
1704 err = device_create_file(&pdev->dev, &attr[i].dev_attr);
1705 if (err)
1706 return err;
1707 }
1708 return 0;
1709}
742 1710
743static int __devinit f71882fg_probe(struct platform_device * pdev) 1711static int __devinit f71882fg_probe(struct platform_device *pdev)
744{ 1712{
745 struct f71882fg_data *data; 1713 struct f71882fg_data *data;
746 int err, i; 1714 struct f71882fg_sio_data *sio_data = pdev->dev.platform_data;
1715 int err, i, nr_fans = (sio_data->type == f71882fg) ? 4 : 3;
747 u8 start_reg; 1716 u8 start_reg;
748 1717
749 if (!(data = kzalloc(sizeof(struct f71882fg_data), GFP_KERNEL))) 1718 data = kzalloc(sizeof(struct f71882fg_data), GFP_KERNEL);
1719 if (!data)
750 return -ENOMEM; 1720 return -ENOMEM;
751 1721
752 data->addr = platform_get_resource(pdev, IORESOURCE_IO, 0)->start; 1722 data->addr = platform_get_resource(pdev, IORESOURCE_IO, 0)->start;
1723 data->type = sio_data->type;
753 mutex_init(&data->update_lock); 1724 mutex_init(&data->update_lock);
754 platform_set_drvdata(pdev, data); 1725 platform_set_drvdata(pdev, data);
755 1726
756 /* Register sysfs interface files */ 1727 start_reg = f71882fg_read8(data, F71882FG_REG_START);
757 for (i = 0; i < ARRAY_SIZE(f71882fg_dev_attr); i++) { 1728 if (start_reg & 0x04) {
758 err = device_create_file(&pdev->dev, &f71882fg_dev_attr[i]); 1729 dev_warn(&pdev->dev, "Hardware monitor is powered down\n");
759 if (err) 1730 err = -ENODEV;
760 goto exit_unregister_sysfs; 1731 goto exit_free;
1732 }
1733 if (!(start_reg & 0x03)) {
1734 dev_warn(&pdev->dev, "Hardware monitoring not activated\n");
1735 err = -ENODEV;
1736 goto exit_free;
761 } 1737 }
762 1738
763 start_reg = f71882fg_read8(data, F71882FG_REG_START); 1739 data->pwm_enable = f71882fg_read8(data, F71882FG_REG_PWM_ENABLE);
1740 /* If it is a 71862 and the fan / pwm part is enabled sanity check
1741 the pwm settings */
1742 if (data->type == f71862fg && (start_reg & 0x02)) {
1743 if ((data->pwm_enable & 0x15) != 0x15) {
1744 dev_err(&pdev->dev,
1745 "Invalid (reserved) pwm settings: 0x%02x\n",
1746 (unsigned int)data->pwm_enable);
1747 err = -ENODEV;
1748 goto exit_free;
1749 }
1750 }
1751
1752 /* Register sysfs interface files */
1753 err = device_create_file(&pdev->dev, &dev_attr_name);
1754 if (err)
1755 goto exit_unregister_sysfs;
1756
764 if (start_reg & 0x01) { 1757 if (start_reg & 0x01) {
765 for (i = 0; i < ARRAY_SIZE(f71882fg_in_temp_attr); i++) { 1758 switch (data->type) {
766 err = device_create_file(&pdev->dev, 1759 case f71882fg:
767 &f71882fg_in_temp_attr[i].dev_attr); 1760 err = f71882fg_create_sysfs_files(pdev,
1761 f71882fg_in_temp_attr,
1762 ARRAY_SIZE(f71882fg_in_temp_attr));
768 if (err) 1763 if (err)
769 goto exit_unregister_sysfs; 1764 goto exit_unregister_sysfs;
1765 /* fall through! */
1766 case f71862fg:
1767 err = f71882fg_create_sysfs_files(pdev,
1768 f718x2fg_in_temp_attr,
1769 ARRAY_SIZE(f718x2fg_in_temp_attr));
1770 break;
1771 case f8000:
1772 err = f71882fg_create_sysfs_files(pdev,
1773 f8000_in_temp_attr,
1774 ARRAY_SIZE(f8000_in_temp_attr));
1775 break;
770 } 1776 }
1777 if (err)
1778 goto exit_unregister_sysfs;
771 } 1779 }
772 1780
773 if (start_reg & 0x02) { 1781 if (start_reg & 0x02) {
774 for (i = 0; i < ARRAY_SIZE(f71882fg_fan_attr); i++) { 1782 err = f71882fg_create_sysfs_files(pdev, fxxxx_fan_attr,
775 err = device_create_file(&pdev->dev, 1783 ARRAY_SIZE(fxxxx_fan_attr));
776 &f71882fg_fan_attr[i].dev_attr); 1784 if (err)
777 if (err) 1785 goto exit_unregister_sysfs;
778 goto exit_unregister_sysfs; 1786
1787 switch (data->type) {
1788 case f71862fg:
1789 err = f71882fg_create_sysfs_files(pdev,
1790 f71862fg_fan_attr,
1791 ARRAY_SIZE(f71862fg_fan_attr));
1792 break;
1793 case f71882fg:
1794 err = f71882fg_create_sysfs_files(pdev,
1795 f71882fg_fan_attr,
1796 ARRAY_SIZE(f71882fg_fan_attr));
1797 break;
1798 case f8000:
1799 err = f71882fg_create_sysfs_files(pdev,
1800 f8000_fan_attr,
1801 ARRAY_SIZE(f8000_fan_attr));
1802 break;
779 } 1803 }
1804 if (err)
1805 goto exit_unregister_sysfs;
1806
1807 for (i = 0; i < nr_fans; i++)
1808 dev_info(&pdev->dev, "Fan: %d is in %s mode\n", i + 1,
1809 (data->pwm_enable & (1 << 2 * i)) ?
1810 "duty-cycle" : "RPM");
780 } 1811 }
781 1812
782 data->hwmon_dev = hwmon_device_register(&pdev->dev); 1813 data->hwmon_dev = hwmon_device_register(&pdev->dev);
783 if (IS_ERR(data->hwmon_dev)) { 1814 if (IS_ERR(data->hwmon_dev)) {
784 err = PTR_ERR(data->hwmon_dev); 1815 err = PTR_ERR(data->hwmon_dev);
1816 data->hwmon_dev = NULL;
785 goto exit_unregister_sysfs; 1817 goto exit_unregister_sysfs;
786 } 1818 }
787 1819
788 return 0; 1820 return 0;
789 1821
790exit_unregister_sysfs: 1822exit_unregister_sysfs:
791 for (i = 0; i < ARRAY_SIZE(f71882fg_dev_attr); i++) 1823 f71882fg_remove(pdev); /* Will unregister the sysfs files for us */
792 device_remove_file(&pdev->dev, &f71882fg_dev_attr[i]); 1824 return err; /* f71882fg_remove() also frees our data */
793 1825exit_free:
794 for (i = 0; i < ARRAY_SIZE(f71882fg_in_temp_attr); i++)
795 device_remove_file(&pdev->dev,
796 &f71882fg_in_temp_attr[i].dev_attr);
797
798 for (i = 0; i < ARRAY_SIZE(f71882fg_fan_attr); i++)
799 device_remove_file(&pdev->dev, &f71882fg_fan_attr[i].dev_attr);
800
801 kfree(data); 1826 kfree(data);
802
803 return err; 1827 return err;
804} 1828}
805 1829
806static int __devexit f71882fg_remove(struct platform_device *pdev) 1830static int f71882fg_remove(struct platform_device *pdev)
807{ 1831{
808 int i; 1832 int i;
809 struct f71882fg_data *data = platform_get_drvdata(pdev); 1833 struct f71882fg_data *data = platform_get_drvdata(pdev);
810 1834
811 platform_set_drvdata(pdev, NULL); 1835 platform_set_drvdata(pdev, NULL);
812 hwmon_device_unregister(data->hwmon_dev); 1836 if (data->hwmon_dev)
1837 hwmon_device_unregister(data->hwmon_dev);
1838
1839 /* Note we are not looping over all attr arrays we have as the ones
1840 below are supersets of the ones skipped. */
1841 device_remove_file(&pdev->dev, &dev_attr_name);
813 1842
814 for (i = 0; i < ARRAY_SIZE(f71882fg_dev_attr); i++) 1843 for (i = 0; i < ARRAY_SIZE(f718x2fg_in_temp_attr); i++)
815 device_remove_file(&pdev->dev, &f71882fg_dev_attr[i]); 1844 device_remove_file(&pdev->dev,
1845 &f718x2fg_in_temp_attr[i].dev_attr);
816 1846
817 for (i = 0; i < ARRAY_SIZE(f71882fg_in_temp_attr); i++) 1847 for (i = 0; i < ARRAY_SIZE(f71882fg_in_temp_attr); i++)
818 device_remove_file(&pdev->dev, 1848 device_remove_file(&pdev->dev,
819 &f71882fg_in_temp_attr[i].dev_attr); 1849 &f71882fg_in_temp_attr[i].dev_attr);
820 1850
1851 for (i = 0; i < ARRAY_SIZE(fxxxx_fan_attr); i++)
1852 device_remove_file(&pdev->dev, &fxxxx_fan_attr[i].dev_attr);
1853
821 for (i = 0; i < ARRAY_SIZE(f71882fg_fan_attr); i++) 1854 for (i = 0; i < ARRAY_SIZE(f71882fg_fan_attr); i++)
822 device_remove_file(&pdev->dev, &f71882fg_fan_attr[i].dev_attr); 1855 device_remove_file(&pdev->dev, &f71882fg_fan_attr[i].dev_attr);
823 1856
1857 for (i = 0; i < ARRAY_SIZE(f8000_fan_attr); i++)
1858 device_remove_file(&pdev->dev, &f8000_fan_attr[i].dev_attr);
1859
824 kfree(data); 1860 kfree(data);
825 1861
826 return 0; 1862 return 0;
827} 1863}
828 1864
829static int __init f71882fg_find(int sioaddr, unsigned short *address) 1865static int __init f71882fg_find(int sioaddr, unsigned short *address,
1866 struct f71882fg_sio_data *sio_data)
830{ 1867{
831 int err = -ENODEV; 1868 int err = -ENODEV;
832 u16 devid; 1869 u16 devid;
833 u8 start_reg;
834 struct f71882fg_data data;
835 1870
836 superio_enter(sioaddr); 1871 superio_enter(sioaddr);
837 1872
@@ -842,7 +1877,17 @@ static int __init f71882fg_find(int sioaddr, unsigned short *address)
842 } 1877 }
843 1878
844 devid = force_id ? force_id : superio_inw(sioaddr, SIO_REG_DEVID); 1879 devid = force_id ? force_id : superio_inw(sioaddr, SIO_REG_DEVID);
845 if (devid != SIO_F71882_ID) { 1880 switch (devid) {
1881 case SIO_F71862_ID:
1882 sio_data->type = f71862fg;
1883 break;
1884 case SIO_F71882_ID:
1885 sio_data->type = f71882fg;
1886 break;
1887 case SIO_F8000_ID:
1888 sio_data->type = f8000;
1889 break;
1890 default:
846 printk(KERN_INFO DRVNAME ": Unsupported Fintek device\n"); 1891 printk(KERN_INFO DRVNAME ": Unsupported Fintek device\n");
847 goto exit; 1892 goto exit;
848 } 1893 }
@@ -861,24 +1906,17 @@ static int __init f71882fg_find(int sioaddr, unsigned short *address)
861 } 1906 }
862 *address &= ~(REGION_LENGTH - 1); /* Ignore 3 LSB */ 1907 *address &= ~(REGION_LENGTH - 1); /* Ignore 3 LSB */
863 1908
864 data.addr = *address;
865 start_reg = f71882fg_read8(&data, F71882FG_REG_START);
866 if (!(start_reg & 0x03)) {
867 printk(KERN_WARNING DRVNAME
868 ": Hardware monitoring not activated\n");
869 goto exit;
870 }
871
872 err = 0; 1909 err = 0;
873 printk(KERN_INFO DRVNAME ": Found F71882FG chip at %#x, revision %d\n", 1910 printk(KERN_INFO DRVNAME ": Found %s chip at %#x, revision %d\n",
874 (unsigned int)*address, 1911 f71882fg_names[sio_data->type], (unsigned int)*address,
875 (int)superio_inb(sioaddr, SIO_REG_DEVREV)); 1912 (int)superio_inb(sioaddr, SIO_REG_DEVREV));
876exit: 1913exit:
877 superio_exit(sioaddr); 1914 superio_exit(sioaddr);
878 return err; 1915 return err;
879} 1916}
880 1917
881static int __init f71882fg_device_add(unsigned short address) 1918static int __init f71882fg_device_add(unsigned short address,
1919 const struct f71882fg_sio_data *sio_data)
882{ 1920{
883 struct resource res = { 1921 struct resource res = {
884 .start = address, 1922 .start = address,
@@ -892,12 +1930,23 @@ static int __init f71882fg_device_add(unsigned short address)
892 return -ENOMEM; 1930 return -ENOMEM;
893 1931
894 res.name = f71882fg_pdev->name; 1932 res.name = f71882fg_pdev->name;
1933 err = acpi_check_resource_conflict(&res);
1934 if (err)
1935 return err;
1936
895 err = platform_device_add_resources(f71882fg_pdev, &res, 1); 1937 err = platform_device_add_resources(f71882fg_pdev, &res, 1);
896 if (err) { 1938 if (err) {
897 printk(KERN_ERR DRVNAME ": Device resource addition failed\n"); 1939 printk(KERN_ERR DRVNAME ": Device resource addition failed\n");
898 goto exit_device_put; 1940 goto exit_device_put;
899 } 1941 }
900 1942
1943 err = platform_device_add_data(f71882fg_pdev, sio_data,
1944 sizeof(struct f71882fg_sio_data));
1945 if (err) {
1946 printk(KERN_ERR DRVNAME ": Platform data allocation failed\n");
1947 goto exit_device_put;
1948 }
1949
901 err = platform_device_add(f71882fg_pdev); 1950 err = platform_device_add(f71882fg_pdev);
902 if (err) { 1951 if (err) {
903 printk(KERN_ERR DRVNAME ": Device addition failed\n"); 1952 printk(KERN_ERR DRVNAME ": Device addition failed\n");
@@ -916,14 +1965,20 @@ static int __init f71882fg_init(void)
916{ 1965{
917 int err = -ENODEV; 1966 int err = -ENODEV;
918 unsigned short address; 1967 unsigned short address;
1968 struct f71882fg_sio_data sio_data;
1969
1970 memset(&sio_data, 0, sizeof(sio_data));
919 1971
920 if (f71882fg_find(0x2e, &address) && f71882fg_find(0x4e, &address)) 1972 if (f71882fg_find(0x2e, &address, &sio_data) &&
1973 f71882fg_find(0x4e, &address, &sio_data))
921 goto exit; 1974 goto exit;
922 1975
923 if ((err = platform_driver_register(&f71882fg_driver))) 1976 err = platform_driver_register(&f71882fg_driver);
1977 if (err)
924 goto exit; 1978 goto exit;
925 1979
926 if ((err = f71882fg_device_add(address))) 1980 err = f71882fg_device_add(address, &sio_data);
1981 if (err)
927 goto exit_driver; 1982 goto exit_driver;
928 1983
929 return 0; 1984 return 0;
@@ -941,7 +1996,7 @@ static void __exit f71882fg_exit(void)
941} 1996}
942 1997
943MODULE_DESCRIPTION("F71882FG Hardware Monitoring Driver"); 1998MODULE_DESCRIPTION("F71882FG Hardware Monitoring Driver");
944MODULE_AUTHOR("Hans Edgington (hans@edgington.nl)"); 1999MODULE_AUTHOR("Hans Edgington, Hans de Goede (hdegoede@redhat.com)");
945MODULE_LICENSE("GPL"); 2000MODULE_LICENSE("GPL");
946 2001
947module_init(f71882fg_init); 2002module_init(f71882fg_init);
diff --git a/drivers/hwmon/fschmd.c b/drivers/hwmon/fschmd.c
index 967170368933..d07f4ef75092 100644
--- a/drivers/hwmon/fschmd.c
+++ b/drivers/hwmon/fschmd.c
@@ -1,6 +1,6 @@
1/* fschmd.c 1/* fschmd.c
2 * 2 *
3 * Copyright (C) 2007 Hans de Goede <j.w.r.degoede@hhs.nl> 3 * Copyright (C) 2007,2008 Hans de Goede <hdegoede@redhat.com>
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify 5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by 6 * it under the terms of the GNU General Public License as published by
@@ -42,11 +42,20 @@
42#include <linux/mutex.h> 42#include <linux/mutex.h>
43#include <linux/sysfs.h> 43#include <linux/sysfs.h>
44#include <linux/dmi.h> 44#include <linux/dmi.h>
45#include <linux/fs.h>
46#include <linux/watchdog.h>
47#include <linux/miscdevice.h>
48#include <linux/uaccess.h>
49#include <linux/kref.h>
45 50
46/* Addresses to scan */ 51/* Addresses to scan */
47static const unsigned short normal_i2c[] = { 0x73, I2C_CLIENT_END }; 52static const unsigned short normal_i2c[] = { 0x73, I2C_CLIENT_END };
48 53
49/* Insmod parameters */ 54/* Insmod parameters */
55static int nowayout = WATCHDOG_NOWAYOUT;
56module_param(nowayout, int, 0);
57MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default="
58 __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
50I2C_CLIENT_INSMOD_5(fscpos, fscher, fscscy, fschrc, fschmd); 59I2C_CLIENT_INSMOD_5(fscpos, fscher, fscscy, fschrc, fschmd);
51 60
52/* 61/*
@@ -63,19 +72,26 @@ I2C_CLIENT_INSMOD_5(fscpos, fscher, fscscy, fschrc, fschmd);
63#define FSCHMD_REG_EVENT_STATE 0x04 72#define FSCHMD_REG_EVENT_STATE 0x04
64#define FSCHMD_REG_CONTROL 0x05 73#define FSCHMD_REG_CONTROL 0x05
65 74
66#define FSCHMD_CONTROL_ALERT_LED_MASK 0x01 75#define FSCHMD_CONTROL_ALERT_LED 0x01
67 76
68/* watchdog (support to be implemented) */ 77/* watchdog */
69#define FSCHMD_REG_WDOG_PRESET 0x28 78#define FSCHMD_REG_WDOG_PRESET 0x28
70#define FSCHMD_REG_WDOG_STATE 0x23 79#define FSCHMD_REG_WDOG_STATE 0x23
71#define FSCHMD_REG_WDOG_CONTROL 0x21 80#define FSCHMD_REG_WDOG_CONTROL 0x21
72 81
82#define FSCHMD_WDOG_CONTROL_TRIGGER 0x10
83#define FSCHMD_WDOG_CONTROL_STARTED 0x10 /* the same as trigger */
84#define FSCHMD_WDOG_CONTROL_STOP 0x20
85#define FSCHMD_WDOG_CONTROL_RESOLUTION 0x40
86
87#define FSCHMD_WDOG_STATE_CARDRESET 0x02
88
73/* voltages, weird order is to keep the same order as the old drivers */ 89/* voltages, weird order is to keep the same order as the old drivers */
74static const u8 FSCHMD_REG_VOLT[3] = { 0x45, 0x42, 0x48 }; 90static const u8 FSCHMD_REG_VOLT[3] = { 0x45, 0x42, 0x48 };
75 91
76/* minimum pwm at which the fan is driven (pwm can by increased depending on 92/* minimum pwm at which the fan is driven (pwm can by increased depending on
77 the temp. Notice that for the scy some fans share there minimum speed. 93 the temp. Notice that for the scy some fans share there minimum speed.
78 Also notice that with the scy the sensor order is different then with the 94 Also notice that with the scy the sensor order is different than with the
79 other chips, this order was in the 2.4 driver and kept for consistency. */ 95 other chips, this order was in the 2.4 driver and kept for consistency. */
80static const u8 FSCHMD_REG_FAN_MIN[5][6] = { 96static const u8 FSCHMD_REG_FAN_MIN[5][6] = {
81 { 0x55, 0x65 }, /* pos */ 97 { 0x55, 0x65 }, /* pos */
@@ -115,8 +131,8 @@ static const u8 FSCHMD_REG_FAN_RIPPLE[5][6] = {
115static const int FSCHMD_NO_FAN_SENSORS[5] = { 3, 3, 6, 4, 5 }; 131static const int FSCHMD_NO_FAN_SENSORS[5] = { 3, 3, 6, 4, 5 };
116 132
117/* Fan status register bitmasks */ 133/* Fan status register bitmasks */
118#define FSCHMD_FAN_ALARM_MASK 0x04 /* called fault by FSC! */ 134#define FSCHMD_FAN_ALARM 0x04 /* called fault by FSC! */
119#define FSCHMD_FAN_NOT_PRESENT_MASK 0x08 /* not documented */ 135#define FSCHMD_FAN_NOT_PRESENT 0x08 /* not documented */
120 136
121 137
122/* actual temperature registers */ 138/* actual temperature registers */
@@ -158,14 +174,11 @@ static const u8 FSCHER_REG_TEMP_AUTOP2[] = { 0x75, 0x85, 0x95 }; */
158static const int FSCHMD_NO_TEMP_SENSORS[5] = { 3, 3, 4, 3, 5 }; 174static const int FSCHMD_NO_TEMP_SENSORS[5] = { 3, 3, 4, 3, 5 };
159 175
160/* temp status register bitmasks */ 176/* temp status register bitmasks */
161#define FSCHMD_TEMP_WORKING_MASK 0x01 177#define FSCHMD_TEMP_WORKING 0x01
162#define FSCHMD_TEMP_ALERT_MASK 0x02 178#define FSCHMD_TEMP_ALERT 0x02
163/* there only really is an alarm if the sensor is working and alert == 1 */ 179/* there only really is an alarm if the sensor is working and alert == 1 */
164#define FSCHMD_TEMP_ALARM_MASK \ 180#define FSCHMD_TEMP_ALARM_MASK \
165 (FSCHMD_TEMP_WORKING_MASK | FSCHMD_TEMP_ALERT_MASK) 181 (FSCHMD_TEMP_WORKING | FSCHMD_TEMP_ALERT)
166
167/* our driver name */
168#define FSCHMD_NAME "fschmd"
169 182
170/* 183/*
171 * Functions declarations 184 * Functions declarations
@@ -195,7 +208,7 @@ MODULE_DEVICE_TABLE(i2c, fschmd_id);
195static struct i2c_driver fschmd_driver = { 208static struct i2c_driver fschmd_driver = {
196 .class = I2C_CLASS_HWMON, 209 .class = I2C_CLASS_HWMON,
197 .driver = { 210 .driver = {
198 .name = FSCHMD_NAME, 211 .name = "fschmd",
199 }, 212 },
200 .probe = fschmd_probe, 213 .probe = fschmd_probe,
201 .remove = fschmd_remove, 214 .remove = fschmd_remove,
@@ -209,14 +222,26 @@ static struct i2c_driver fschmd_driver = {
209 */ 222 */
210 223
211struct fschmd_data { 224struct fschmd_data {
225 struct i2c_client *client;
212 struct device *hwmon_dev; 226 struct device *hwmon_dev;
213 struct mutex update_lock; 227 struct mutex update_lock;
228 struct mutex watchdog_lock;
229 struct list_head list; /* member of the watchdog_data_list */
230 struct kref kref;
231 struct miscdevice watchdog_miscdev;
214 int kind; 232 int kind;
233 unsigned long watchdog_is_open;
234 char watchdog_expect_close;
235 char watchdog_name[10]; /* must be unique to avoid sysfs conflict */
215 char valid; /* zero until following fields are valid */ 236 char valid; /* zero until following fields are valid */
216 unsigned long last_updated; /* in jiffies */ 237 unsigned long last_updated; /* in jiffies */
217 238
218 /* register values */ 239 /* register values */
240 u8 revision; /* chip revision */
219 u8 global_control; /* global control register */ 241 u8 global_control; /* global control register */
242 u8 watchdog_control; /* watchdog control register */
243 u8 watchdog_state; /* watchdog status register */
244 u8 watchdog_preset; /* watchdog counter preset on trigger val */
220 u8 volt[3]; /* 12, 5, battery voltage */ 245 u8 volt[3]; /* 12, 5, battery voltage */
221 u8 temp_act[5]; /* temperature */ 246 u8 temp_act[5]; /* temperature */
222 u8 temp_status[5]; /* status of sensor */ 247 u8 temp_status[5]; /* status of sensor */
@@ -228,11 +253,28 @@ struct fschmd_data {
228}; 253};
229 254
230/* Global variables to hold information read from special DMI tables, which are 255/* Global variables to hold information read from special DMI tables, which are
231 available on FSC machines with an fscher or later chip. */ 256 available on FSC machines with an fscher or later chip. There is no need to
257 protect these with a lock as they are only modified from our attach function
258 which always gets called with the i2c-core lock held and never accessed
259 before the attach function is done with them. */
232static int dmi_mult[3] = { 490, 200, 100 }; 260static int dmi_mult[3] = { 490, 200, 100 };
233static int dmi_offset[3] = { 0, 0, 0 }; 261static int dmi_offset[3] = { 0, 0, 0 };
234static int dmi_vref = -1; 262static int dmi_vref = -1;
235 263
264/* Somewhat ugly :( global data pointer list with all fschmd devices, so that
265 we can find our device data as when using misc_register there is no other
266 method to get to ones device data from the open fop. */
267static LIST_HEAD(watchdog_data_list);
268/* Note this lock not only protect list access, but also data.kref access */
269static DEFINE_MUTEX(watchdog_data_mutex);
270
271/* Release our data struct when we're detached from the i2c client *and* all
272 references to our watchdog device are released */
273static void fschmd_release_resources(struct kref *ref)
274{
275 struct fschmd_data *data = container_of(ref, struct fschmd_data, kref);
276 kfree(data);
277}
236 278
237/* 279/*
238 * Sysfs attr show / store functions 280 * Sysfs attr show / store functions
@@ -300,7 +342,7 @@ static ssize_t show_temp_fault(struct device *dev,
300 struct fschmd_data *data = fschmd_update_device(dev); 342 struct fschmd_data *data = fschmd_update_device(dev);
301 343
302 /* bit 0 set means sensor working ok, so no fault! */ 344 /* bit 0 set means sensor working ok, so no fault! */
303 if (data->temp_status[index] & FSCHMD_TEMP_WORKING_MASK) 345 if (data->temp_status[index] & FSCHMD_TEMP_WORKING)
304 return sprintf(buf, "0\n"); 346 return sprintf(buf, "0\n");
305 else 347 else
306 return sprintf(buf, "1\n"); 348 return sprintf(buf, "1\n");
@@ -385,7 +427,7 @@ static ssize_t show_fan_alarm(struct device *dev,
385 int index = to_sensor_dev_attr(devattr)->index; 427 int index = to_sensor_dev_attr(devattr)->index;
386 struct fschmd_data *data = fschmd_update_device(dev); 428 struct fschmd_data *data = fschmd_update_device(dev);
387 429
388 if (data->fan_status[index] & FSCHMD_FAN_ALARM_MASK) 430 if (data->fan_status[index] & FSCHMD_FAN_ALARM)
389 return sprintf(buf, "1\n"); 431 return sprintf(buf, "1\n");
390 else 432 else
391 return sprintf(buf, "0\n"); 433 return sprintf(buf, "0\n");
@@ -397,7 +439,7 @@ static ssize_t show_fan_fault(struct device *dev,
397 int index = to_sensor_dev_attr(devattr)->index; 439 int index = to_sensor_dev_attr(devattr)->index;
398 struct fschmd_data *data = fschmd_update_device(dev); 440 struct fschmd_data *data = fschmd_update_device(dev);
399 441
400 if (data->fan_status[index] & FSCHMD_FAN_NOT_PRESENT_MASK) 442 if (data->fan_status[index] & FSCHMD_FAN_NOT_PRESENT)
401 return sprintf(buf, "1\n"); 443 return sprintf(buf, "1\n");
402 else 444 else
403 return sprintf(buf, "0\n"); 445 return sprintf(buf, "0\n");
@@ -449,7 +491,7 @@ static ssize_t show_alert_led(struct device *dev,
449{ 491{
450 struct fschmd_data *data = fschmd_update_device(dev); 492 struct fschmd_data *data = fschmd_update_device(dev);
451 493
452 if (data->global_control & FSCHMD_CONTROL_ALERT_LED_MASK) 494 if (data->global_control & FSCHMD_CONTROL_ALERT_LED)
453 return sprintf(buf, "1\n"); 495 return sprintf(buf, "1\n");
454 else 496 else
455 return sprintf(buf, "0\n"); 497 return sprintf(buf, "0\n");
@@ -467,9 +509,9 @@ static ssize_t store_alert_led(struct device *dev,
467 reg = i2c_smbus_read_byte_data(to_i2c_client(dev), FSCHMD_REG_CONTROL); 509 reg = i2c_smbus_read_byte_data(to_i2c_client(dev), FSCHMD_REG_CONTROL);
468 510
469 if (v) 511 if (v)
470 reg |= FSCHMD_CONTROL_ALERT_LED_MASK; 512 reg |= FSCHMD_CONTROL_ALERT_LED;
471 else 513 else
472 reg &= ~FSCHMD_CONTROL_ALERT_LED_MASK; 514 reg &= ~FSCHMD_CONTROL_ALERT_LED;
473 515
474 i2c_smbus_write_byte_data(to_i2c_client(dev), FSCHMD_REG_CONTROL, reg); 516 i2c_smbus_write_byte_data(to_i2c_client(dev), FSCHMD_REG_CONTROL, reg);
475 517
@@ -551,7 +593,265 @@ static struct sensor_device_attribute fschmd_fan_attr[] = {
551 593
552 594
553/* 595/*
554 * Real code 596 * Watchdog routines
597 */
598
599static int watchdog_set_timeout(struct fschmd_data *data, int timeout)
600{
601 int ret, resolution;
602 int kind = data->kind + 1; /* 0-x array index -> 1-x module param */
603
604 /* 2 second or 60 second resolution? */
605 if (timeout <= 510 || kind == fscpos || kind == fscscy)
606 resolution = 2;
607 else
608 resolution = 60;
609
610 if (timeout < resolution || timeout > (resolution * 255))
611 return -EINVAL;
612
613 mutex_lock(&data->watchdog_lock);
614 if (!data->client) {
615 ret = -ENODEV;
616 goto leave;
617 }
618
619 if (resolution == 2)
620 data->watchdog_control &= ~FSCHMD_WDOG_CONTROL_RESOLUTION;
621 else
622 data->watchdog_control |= FSCHMD_WDOG_CONTROL_RESOLUTION;
623
624 data->watchdog_preset = DIV_ROUND_UP(timeout, resolution);
625
626 /* Write new timeout value */
627 i2c_smbus_write_byte_data(data->client, FSCHMD_REG_WDOG_PRESET,
628 data->watchdog_preset);
629 /* Write new control register, do not trigger! */
630 i2c_smbus_write_byte_data(data->client, FSCHMD_REG_WDOG_CONTROL,
631 data->watchdog_control & ~FSCHMD_WDOG_CONTROL_TRIGGER);
632
633 ret = data->watchdog_preset * resolution;
634
635leave:
636 mutex_unlock(&data->watchdog_lock);
637 return ret;
638}
639
640static int watchdog_get_timeout(struct fschmd_data *data)
641{
642 int timeout;
643
644 mutex_lock(&data->watchdog_lock);
645 if (data->watchdog_control & FSCHMD_WDOG_CONTROL_RESOLUTION)
646 timeout = data->watchdog_preset * 60;
647 else
648 timeout = data->watchdog_preset * 2;
649 mutex_unlock(&data->watchdog_lock);
650
651 return timeout;
652}
653
654static int watchdog_trigger(struct fschmd_data *data)
655{
656 int ret = 0;
657
658 mutex_lock(&data->watchdog_lock);
659 if (!data->client) {
660 ret = -ENODEV;
661 goto leave;
662 }
663
664 data->watchdog_control |= FSCHMD_WDOG_CONTROL_TRIGGER;
665 i2c_smbus_write_byte_data(data->client, FSCHMD_REG_WDOG_CONTROL,
666 data->watchdog_control);
667leave:
668 mutex_unlock(&data->watchdog_lock);
669 return ret;
670}
671
672static int watchdog_stop(struct fschmd_data *data)
673{
674 int ret = 0;
675
676 mutex_lock(&data->watchdog_lock);
677 if (!data->client) {
678 ret = -ENODEV;
679 goto leave;
680 }
681
682 data->watchdog_control &= ~FSCHMD_WDOG_CONTROL_STARTED;
683 /* Don't store the stop flag in our watchdog control register copy, as
684 its a write only bit (read always returns 0) */
685 i2c_smbus_write_byte_data(data->client, FSCHMD_REG_WDOG_CONTROL,
686 data->watchdog_control | FSCHMD_WDOG_CONTROL_STOP);
687leave:
688 mutex_unlock(&data->watchdog_lock);
689 return ret;
690}
691
692static int watchdog_open(struct inode *inode, struct file *filp)
693{
694 struct fschmd_data *pos, *data = NULL;
695
696 /* We get called from drivers/char/misc.c with misc_mtx hold, and we
697 call misc_register() from fschmd_probe() with watchdog_data_mutex
698 hold, as misc_register() takes the misc_mtx lock, this is a possible
699 deadlock, so we use mutex_trylock here. */
700 if (!mutex_trylock(&watchdog_data_mutex))
701 return -ERESTARTSYS;
702 list_for_each_entry(pos, &watchdog_data_list, list) {
703 if (pos->watchdog_miscdev.minor == iminor(inode)) {
704 data = pos;
705 break;
706 }
707 }
708 /* Note we can never not have found data, so we don't check for this */
709 kref_get(&data->kref);
710 mutex_unlock(&watchdog_data_mutex);
711
712 if (test_and_set_bit(0, &data->watchdog_is_open))
713 return -EBUSY;
714
715 /* Start the watchdog */
716 watchdog_trigger(data);
717 filp->private_data = data;
718
719 return nonseekable_open(inode, filp);
720}
721
722static int watchdog_release(struct inode *inode, struct file *filp)
723{
724 struct fschmd_data *data = filp->private_data;
725
726 if (data->watchdog_expect_close) {
727 watchdog_stop(data);
728 data->watchdog_expect_close = 0;
729 } else {
730 watchdog_trigger(data);
731 dev_crit(&data->client->dev,
732 "unexpected close, not stopping watchdog!\n");
733 }
734
735 clear_bit(0, &data->watchdog_is_open);
736
737 mutex_lock(&watchdog_data_mutex);
738 kref_put(&data->kref, fschmd_release_resources);
739 mutex_unlock(&watchdog_data_mutex);
740
741 return 0;
742}
743
744static ssize_t watchdog_write(struct file *filp, const char __user *buf,
745 size_t count, loff_t *offset)
746{
747 size_t ret;
748 struct fschmd_data *data = filp->private_data;
749
750 if (count) {
751 if (!nowayout) {
752 size_t i;
753
754 /* Clear it in case it was set with a previous write */
755 data->watchdog_expect_close = 0;
756
757 for (i = 0; i != count; i++) {
758 char c;
759 if (get_user(c, buf + i))
760 return -EFAULT;
761 if (c == 'V')
762 data->watchdog_expect_close = 1;
763 }
764 }
765 ret = watchdog_trigger(data);
766 if (ret < 0)
767 return ret;
768 }
769 return count;
770}
771
772static int watchdog_ioctl(struct inode *inode, struct file *filp,
773 unsigned int cmd, unsigned long arg)
774{
775 static struct watchdog_info ident = {
776 .options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT |
777 WDIOF_CARDRESET,
778 .identity = "FSC watchdog"
779 };
780 int i, ret = 0;
781 struct fschmd_data *data = filp->private_data;
782
783 switch (cmd) {
784 case WDIOC_GETSUPPORT:
785 ident.firmware_version = data->revision;
786 if (!nowayout)
787 ident.options |= WDIOF_MAGICCLOSE;
788 if (copy_to_user((void __user *)arg, &ident, sizeof(ident)))
789 ret = -EFAULT;
790 break;
791
792 case WDIOC_GETSTATUS:
793 ret = put_user(0, (int __user *)arg);
794 break;
795
796 case WDIOC_GETBOOTSTATUS:
797 if (data->watchdog_state & FSCHMD_WDOG_STATE_CARDRESET)
798 ret = put_user(WDIOF_CARDRESET, (int __user *)arg);
799 else
800 ret = put_user(0, (int __user *)arg);
801 break;
802
803 case WDIOC_KEEPALIVE:
804 ret = watchdog_trigger(data);
805 break;
806
807 case WDIOC_GETTIMEOUT:
808 i = watchdog_get_timeout(data);
809 ret = put_user(i, (int __user *)arg);
810 break;
811
812 case WDIOC_SETTIMEOUT:
813 if (get_user(i, (int __user *)arg)) {
814 ret = -EFAULT;
815 break;
816 }
817 ret = watchdog_set_timeout(data, i);
818 if (ret > 0)
819 ret = put_user(ret, (int __user *)arg);
820 break;
821
822 case WDIOC_SETOPTIONS:
823 if (get_user(i, (int __user *)arg)) {
824 ret = -EFAULT;
825 break;
826 }
827
828 if (i & WDIOS_DISABLECARD)
829 ret = watchdog_stop(data);
830 else if (i & WDIOS_ENABLECARD)
831 ret = watchdog_trigger(data);
832 else
833 ret = -EINVAL;
834
835 break;
836 default:
837 ret = -ENOTTY;
838 }
839
840 return ret;
841}
842
843static struct file_operations watchdog_fops = {
844 .owner = THIS_MODULE,
845 .llseek = no_llseek,
846 .open = watchdog_open,
847 .release = watchdog_release,
848 .write = watchdog_write,
849 .ioctl = watchdog_ioctl,
850};
851
852
853/*
854 * Detect, register, unregister and update device functions
555 */ 855 */
556 856
557/* DMI decode routine to read voltage scaling factors from special DMI tables, 857/* DMI decode routine to read voltage scaling factors from special DMI tables,
@@ -661,9 +961,9 @@ static int fschmd_probe(struct i2c_client *client,
661 const struct i2c_device_id *id) 961 const struct i2c_device_id *id)
662{ 962{
663 struct fschmd_data *data; 963 struct fschmd_data *data;
664 u8 revision;
665 const char * const names[5] = { "Poseidon", "Hermes", "Scylla", 964 const char * const names[5] = { "Poseidon", "Hermes", "Scylla",
666 "Heracles", "Heimdall" }; 965 "Heracles", "Heimdall" };
966 const int watchdog_minors[] = { WATCHDOG_MINOR, 212, 213, 214, 215 };
667 int i, err; 967 int i, err;
668 enum chips kind = id->driver_data; 968 enum chips kind = id->driver_data;
669 969
@@ -673,6 +973,13 @@ static int fschmd_probe(struct i2c_client *client,
673 973
674 i2c_set_clientdata(client, data); 974 i2c_set_clientdata(client, data);
675 mutex_init(&data->update_lock); 975 mutex_init(&data->update_lock);
976 mutex_init(&data->watchdog_lock);
977 INIT_LIST_HEAD(&data->list);
978 kref_init(&data->kref);
979 /* Store client pointer in our data struct for watchdog usage
980 (where the client is found through a data ptr instead of the
981 otherway around) */
982 data->client = client;
676 983
677 if (kind == fscpos) { 984 if (kind == fscpos) {
678 /* The Poseidon has hardwired temp limits, fill these 985 /* The Poseidon has hardwired temp limits, fill these
@@ -683,16 +990,27 @@ static int fschmd_probe(struct i2c_client *client,
683 } 990 }
684 991
685 /* Read the special DMI table for fscher and newer chips */ 992 /* Read the special DMI table for fscher and newer chips */
686 if (kind == fscher || kind >= fschrc) { 993 if ((kind == fscher || kind >= fschrc) && dmi_vref == -1) {
687 dmi_walk(fschmd_dmi_decode); 994 dmi_walk(fschmd_dmi_decode);
688 if (dmi_vref == -1) { 995 if (dmi_vref == -1) {
689 printk(KERN_WARNING FSCHMD_NAME 996 dev_warn(&client->dev,
690 ": Couldn't get voltage scaling factors from " 997 "Couldn't get voltage scaling factors from "
691 "BIOS DMI table, using builtin defaults\n"); 998 "BIOS DMI table, using builtin defaults\n");
692 dmi_vref = 33; 999 dmi_vref = 33;
693 } 1000 }
694 } 1001 }
695 1002
1003 /* Read in some never changing registers */
1004 data->revision = i2c_smbus_read_byte_data(client, FSCHMD_REG_REVISION);
1005 data->global_control = i2c_smbus_read_byte_data(client,
1006 FSCHMD_REG_CONTROL);
1007 data->watchdog_control = i2c_smbus_read_byte_data(client,
1008 FSCHMD_REG_WDOG_CONTROL);
1009 data->watchdog_state = i2c_smbus_read_byte_data(client,
1010 FSCHMD_REG_WDOG_STATE);
1011 data->watchdog_preset = i2c_smbus_read_byte_data(client,
1012 FSCHMD_REG_WDOG_PRESET);
1013
696 /* i2c kind goes from 1-5, we want from 0-4 to address arrays */ 1014 /* i2c kind goes from 1-5, we want from 0-4 to address arrays */
697 data->kind = kind - 1; 1015 data->kind = kind - 1;
698 1016
@@ -735,9 +1053,43 @@ static int fschmd_probe(struct i2c_client *client,
735 goto exit_detach; 1053 goto exit_detach;
736 } 1054 }
737 1055
738 revision = i2c_smbus_read_byte_data(client, FSCHMD_REG_REVISION); 1056 /* We take the data_mutex lock early so that watchdog_open() cannot
739 printk(KERN_INFO FSCHMD_NAME ": Detected FSC %s chip, revision: %d\n", 1057 run when misc_register() has completed, but we've not yet added
740 names[data->kind], (int) revision); 1058 our data to the watchdog_data_list (and set the default timeout) */
1059 mutex_lock(&watchdog_data_mutex);
1060 for (i = 0; i < ARRAY_SIZE(watchdog_minors); i++) {
1061 /* Register our watchdog part */
1062 snprintf(data->watchdog_name, sizeof(data->watchdog_name),
1063 "watchdog%c", (i == 0) ? '\0' : ('0' + i));
1064 data->watchdog_miscdev.name = data->watchdog_name;
1065 data->watchdog_miscdev.fops = &watchdog_fops;
1066 data->watchdog_miscdev.minor = watchdog_minors[i];
1067 err = misc_register(&data->watchdog_miscdev);
1068 if (err == -EBUSY)
1069 continue;
1070 if (err) {
1071 data->watchdog_miscdev.minor = 0;
1072 dev_err(&client->dev,
1073 "Registering watchdog chardev: %d\n", err);
1074 break;
1075 }
1076
1077 list_add(&data->list, &watchdog_data_list);
1078 watchdog_set_timeout(data, 60);
1079 dev_info(&client->dev,
1080 "Registered watchdog chardev major 10, minor: %d\n",
1081 watchdog_minors[i]);
1082 break;
1083 }
1084 if (i == ARRAY_SIZE(watchdog_minors)) {
1085 data->watchdog_miscdev.minor = 0;
1086 dev_warn(&client->dev, "Couldn't register watchdog chardev "
1087 "(due to no free minor)\n");
1088 }
1089 mutex_unlock(&watchdog_data_mutex);
1090
1091 dev_info(&client->dev, "Detected FSC %s chip, revision: %d\n",
1092 names[data->kind], (int) data->revision);
741 1093
742 return 0; 1094 return 0;
743 1095
@@ -751,6 +1103,24 @@ static int fschmd_remove(struct i2c_client *client)
751 struct fschmd_data *data = i2c_get_clientdata(client); 1103 struct fschmd_data *data = i2c_get_clientdata(client);
752 int i; 1104 int i;
753 1105
1106 /* Unregister the watchdog (if registered) */
1107 if (data->watchdog_miscdev.minor) {
1108 misc_deregister(&data->watchdog_miscdev);
1109 if (data->watchdog_is_open) {
1110 dev_warn(&client->dev,
1111 "i2c client detached with watchdog open! "
1112 "Stopping watchdog.\n");
1113 watchdog_stop(data);
1114 }
1115 mutex_lock(&watchdog_data_mutex);
1116 list_del(&data->list);
1117 mutex_unlock(&watchdog_data_mutex);
1118 /* Tell the watchdog code the client is gone */
1119 mutex_lock(&data->watchdog_lock);
1120 data->client = NULL;
1121 mutex_unlock(&data->watchdog_lock);
1122 }
1123
754 /* Check if registered in case we're called from fschmd_detect 1124 /* Check if registered in case we're called from fschmd_detect
755 to cleanup after an error */ 1125 to cleanup after an error */
756 if (data->hwmon_dev) 1126 if (data->hwmon_dev)
@@ -765,7 +1135,10 @@ static int fschmd_remove(struct i2c_client *client)
765 device_remove_file(&client->dev, 1135 device_remove_file(&client->dev,
766 &fschmd_fan_attr[i].dev_attr); 1136 &fschmd_fan_attr[i].dev_attr);
767 1137
768 kfree(data); 1138 mutex_lock(&watchdog_data_mutex);
1139 kref_put(&data->kref, fschmd_release_resources);
1140 mutex_unlock(&watchdog_data_mutex);
1141
769 return 0; 1142 return 0;
770} 1143}
771 1144
@@ -798,7 +1171,7 @@ static struct fschmd_data *fschmd_update_device(struct device *dev)
798 data->temp_act[i] < data->temp_max[i]) 1171 data->temp_act[i] < data->temp_max[i])
799 i2c_smbus_write_byte_data(client, 1172 i2c_smbus_write_byte_data(client,
800 FSCHMD_REG_TEMP_STATE[data->kind][i], 1173 FSCHMD_REG_TEMP_STATE[data->kind][i],
801 FSCHMD_TEMP_ALERT_MASK); 1174 FSCHMD_TEMP_ALERT);
802 } 1175 }
803 1176
804 for (i = 0; i < FSCHMD_NO_FAN_SENSORS[data->kind]; i++) { 1177 for (i = 0; i < FSCHMD_NO_FAN_SENSORS[data->kind]; i++) {
@@ -816,28 +1189,17 @@ static struct fschmd_data *fschmd_update_device(struct device *dev)
816 FSCHMD_REG_FAN_MIN[data->kind][i]); 1189 FSCHMD_REG_FAN_MIN[data->kind][i]);
817 1190
818 /* reset fan status if speed is back to > 0 */ 1191 /* reset fan status if speed is back to > 0 */
819 if ((data->fan_status[i] & FSCHMD_FAN_ALARM_MASK) && 1192 if ((data->fan_status[i] & FSCHMD_FAN_ALARM) &&
820 data->fan_act[i]) 1193 data->fan_act[i])
821 i2c_smbus_write_byte_data(client, 1194 i2c_smbus_write_byte_data(client,
822 FSCHMD_REG_FAN_STATE[data->kind][i], 1195 FSCHMD_REG_FAN_STATE[data->kind][i],
823 FSCHMD_FAN_ALARM_MASK); 1196 FSCHMD_FAN_ALARM);
824 } 1197 }
825 1198
826 for (i = 0; i < 3; i++) 1199 for (i = 0; i < 3; i++)
827 data->volt[i] = i2c_smbus_read_byte_data(client, 1200 data->volt[i] = i2c_smbus_read_byte_data(client,
828 FSCHMD_REG_VOLT[i]); 1201 FSCHMD_REG_VOLT[i]);
829 1202
830 data->global_control = i2c_smbus_read_byte_data(client,
831 FSCHMD_REG_CONTROL);
832
833 /* To be implemented in the future
834 data->watchdog[0] = i2c_smbus_read_byte_data(client,
835 FSCHMD_REG_WDOG_PRESET);
836 data->watchdog[1] = i2c_smbus_read_byte_data(client,
837 FSCHMD_REG_WDOG_STATE);
838 data->watchdog[2] = i2c_smbus_read_byte_data(client,
839 FSCHMD_REG_WDOG_CONTROL); */
840
841 data->last_updated = jiffies; 1203 data->last_updated = jiffies;
842 data->valid = 1; 1204 data->valid = 1;
843 } 1205 }
@@ -857,7 +1219,7 @@ static void __exit fschmd_exit(void)
857 i2c_del_driver(&fschmd_driver); 1219 i2c_del_driver(&fschmd_driver);
858} 1220}
859 1221
860MODULE_AUTHOR("Hans de Goede <j.w.r.degoede@hhs.nl>"); 1222MODULE_AUTHOR("Hans de Goede <hdegoede@redhat.com>");
861MODULE_DESCRIPTION("FSC Poseidon, Hermes, Scylla, Heracles and " 1223MODULE_DESCRIPTION("FSC Poseidon, Hermes, Scylla, Heracles and "
862 "Heimdall driver"); 1224 "Heimdall driver");
863MODULE_LICENSE("GPL"); 1225MODULE_LICENSE("GPL");
diff --git a/drivers/hwmon/i5k_amb.c b/drivers/hwmon/i5k_amb.c
index 2ede9388096b..27d7f72a5f11 100644
--- a/drivers/hwmon/i5k_amb.c
+++ b/drivers/hwmon/i5k_amb.c
@@ -490,6 +490,13 @@ static unsigned long chipset_ids[] = {
490 0 490 0
491}; 491};
492 492
493static struct pci_device_id i5k_amb_ids[] __devinitdata = {
494 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_5000_ERR) },
495 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_5400_ERR) },
496 { 0, }
497};
498MODULE_DEVICE_TABLE(pci, i5k_amb_ids);
499
493static int __devinit i5k_amb_probe(struct platform_device *pdev) 500static int __devinit i5k_amb_probe(struct platform_device *pdev)
494{ 501{
495 struct i5k_amb_data *data; 502 struct i5k_amb_data *data;
diff --git a/drivers/hwmon/it87.c b/drivers/hwmon/it87.c
index b74c95735f95..95a99c590da2 100644
--- a/drivers/hwmon/it87.c
+++ b/drivers/hwmon/it87.c
@@ -14,6 +14,7 @@
14 IT8712F Super I/O chip w/LPC interface 14 IT8712F Super I/O chip w/LPC interface
15 IT8716F Super I/O chip w/LPC interface 15 IT8716F Super I/O chip w/LPC interface
16 IT8718F Super I/O chip w/LPC interface 16 IT8718F Super I/O chip w/LPC interface
17 IT8720F Super I/O chip w/LPC interface
17 IT8726F Super I/O chip w/LPC interface 18 IT8726F Super I/O chip w/LPC interface
18 Sis950 A clone of the IT8705F 19 Sis950 A clone of the IT8705F
19 20
@@ -48,11 +49,12 @@
48#include <linux/sysfs.h> 49#include <linux/sysfs.h>
49#include <linux/string.h> 50#include <linux/string.h>
50#include <linux/dmi.h> 51#include <linux/dmi.h>
52#include <linux/acpi.h>
51#include <asm/io.h> 53#include <asm/io.h>
52 54
53#define DRVNAME "it87" 55#define DRVNAME "it87"
54 56
55enum chips { it87, it8712, it8716, it8718 }; 57enum chips { it87, it8712, it8716, it8718, it8720 };
56 58
57static unsigned short force_id; 59static unsigned short force_id;
58module_param(force_id, ushort, 0); 60module_param(force_id, ushort, 0);
@@ -64,7 +66,10 @@ static struct platform_device *pdev;
64#define DEV 0x07 /* Register: Logical device select */ 66#define DEV 0x07 /* Register: Logical device select */
65#define VAL 0x2f /* The value to read/write */ 67#define VAL 0x2f /* The value to read/write */
66#define PME 0x04 /* The device with the fan registers in it */ 68#define PME 0x04 /* The device with the fan registers in it */
67#define GPIO 0x07 /* The device with the IT8718F VID value in it */ 69
70/* The device with the IT8718F/IT8720F VID value in it */
71#define GPIO 0x07
72
68#define DEVID 0x20 /* Register: Device ID */ 73#define DEVID 0x20 /* Register: Device ID */
69#define DEVREV 0x22 /* Register: Device Revision */ 74#define DEVREV 0x22 /* Register: Device Revision */
70 75
@@ -113,6 +118,7 @@ superio_exit(void)
113#define IT8705F_DEVID 0x8705 118#define IT8705F_DEVID 0x8705
114#define IT8716F_DEVID 0x8716 119#define IT8716F_DEVID 0x8716
115#define IT8718F_DEVID 0x8718 120#define IT8718F_DEVID 0x8718
121#define IT8720F_DEVID 0x8720
116#define IT8726F_DEVID 0x8726 122#define IT8726F_DEVID 0x8726
117#define IT87_ACT_REG 0x30 123#define IT87_ACT_REG 0x30
118#define IT87_BASE_REG 0x60 124#define IT87_BASE_REG 0x60
@@ -150,8 +156,8 @@ static int fix_pwm_polarity;
150#define IT87_REG_ALARM2 0x02 156#define IT87_REG_ALARM2 0x02
151#define IT87_REG_ALARM3 0x03 157#define IT87_REG_ALARM3 0x03
152 158
153/* The IT8718F has the VID value in a different register, in Super-I/O 159/* The IT8718F and IT8720F have the VID value in a different register, in
154 configuration space. */ 160 Super-I/O configuration space. */
155#define IT87_REG_VID 0x0a 161#define IT87_REG_VID 0x0a
156/* The IT8705F and IT8712F earlier than revision 0x08 use register 0x0b 162/* The IT8705F and IT8712F earlier than revision 0x08 use register 0x0b
157 for fan divisors. Later IT8712F revisions must use 16-bit tachometer 163 for fan divisors. Later IT8712F revisions must use 16-bit tachometer
@@ -282,7 +288,8 @@ static inline int has_16bit_fans(const struct it87_data *data)
282 return (data->type == it87 && data->revision >= 0x03) 288 return (data->type == it87 && data->revision >= 0x03)
283 || (data->type == it8712 && data->revision >= 0x08) 289 || (data->type == it8712 && data->revision >= 0x08)
284 || data->type == it8716 290 || data->type == it8716
285 || data->type == it8718; 291 || data->type == it8718
292 || data->type == it8720;
286} 293}
287 294
288static int it87_probe(struct platform_device *pdev); 295static int it87_probe(struct platform_device *pdev);
@@ -992,6 +999,9 @@ static int __init it87_find(unsigned short *address,
992 case IT8718F_DEVID: 999 case IT8718F_DEVID:
993 sio_data->type = it8718; 1000 sio_data->type = it8718;
994 break; 1001 break;
1002 case IT8720F_DEVID:
1003 sio_data->type = it8720;
1004 break;
995 case 0xffff: /* No device at all */ 1005 case 0xffff: /* No device at all */
996 goto exit; 1006 goto exit;
997 default: 1007 default:
@@ -1022,7 +1032,8 @@ static int __init it87_find(unsigned short *address,
1022 int reg; 1032 int reg;
1023 1033
1024 superio_select(GPIO); 1034 superio_select(GPIO);
1025 if (chip_type == it8718) 1035 if ((chip_type == it8718) ||
1036 (chip_type == it8720))
1026 sio_data->vid_value = superio_inb(IT87_SIO_VID_REG); 1037 sio_data->vid_value = superio_inb(IT87_SIO_VID_REG);
1027 1038
1028 reg = superio_inb(IT87_SIO_PINX2_REG); 1039 reg = superio_inb(IT87_SIO_PINX2_REG);
@@ -1068,6 +1079,7 @@ static int __devinit it87_probe(struct platform_device *pdev)
1068 "it8712", 1079 "it8712",
1069 "it8716", 1080 "it8716",
1070 "it8718", 1081 "it8718",
1082 "it8720",
1071 }; 1083 };
1072 1084
1073 res = platform_get_resource(pdev, IORESOURCE_IO, 0); 1085 res = platform_get_resource(pdev, IORESOURCE_IO, 0);
@@ -1226,7 +1238,7 @@ static int __devinit it87_probe(struct platform_device *pdev)
1226 } 1238 }
1227 1239
1228 if (data->type == it8712 || data->type == it8716 1240 if (data->type == it8712 || data->type == it8716
1229 || data->type == it8718) { 1241 || data->type == it8718 || data->type == it8720) {
1230 data->vrm = vid_which_vrm(); 1242 data->vrm = vid_which_vrm();
1231 /* VID reading from Super-I/O config space if available */ 1243 /* VID reading from Super-I/O config space if available */
1232 data->vid = sio_data->vid_value; 1244 data->vid = sio_data->vid_value;
@@ -1374,7 +1386,7 @@ static void __devinit it87_init_device(struct platform_device *pdev)
1374 it87_write_value(data, IT87_REG_TEMP_HIGH(i), 127); 1386 it87_write_value(data, IT87_REG_TEMP_HIGH(i), 127);
1375 } 1387 }
1376 1388
1377 /* Check if temperature channnels are reset manually or by some reason */ 1389 /* Check if temperature channels are reset manually or by some reason */
1378 tmp = it87_read_value(data, IT87_REG_TEMP_ENABLE); 1390 tmp = it87_read_value(data, IT87_REG_TEMP_ENABLE);
1379 if ((tmp & 0x3f) == 0) { 1391 if ((tmp & 0x3f) == 0) {
1380 /* Temp1,Temp3=thermistor; Temp2=thermal diode */ 1392 /* Temp1,Temp3=thermistor; Temp2=thermal diode */
@@ -1513,7 +1525,8 @@ static struct it87_data *it87_update_device(struct device *dev)
1513 1525
1514 data->sensor = it87_read_value(data, IT87_REG_TEMP_ENABLE); 1526 data->sensor = it87_read_value(data, IT87_REG_TEMP_ENABLE);
1515 /* The 8705 does not have VID capability. 1527 /* The 8705 does not have VID capability.
1516 The 8718 does not use IT87_REG_VID for the same purpose. */ 1528 The 8718 and the 8720 don't use IT87_REG_VID for the
1529 same purpose. */
1517 if (data->type == it8712 || data->type == it8716) { 1530 if (data->type == it8712 || data->type == it8716) {
1518 data->vid = it87_read_value(data, IT87_REG_VID); 1531 data->vid = it87_read_value(data, IT87_REG_VID);
1519 /* The older IT8712F revisions had only 5 VID pins, 1532 /* The older IT8712F revisions had only 5 VID pins,
@@ -1540,6 +1553,10 @@ static int __init it87_device_add(unsigned short address,
1540 }; 1553 };
1541 int err; 1554 int err;
1542 1555
1556 err = acpi_check_resource_conflict(&res);
1557 if (err)
1558 goto exit;
1559
1543 pdev = platform_device_alloc(DRVNAME, address); 1560 pdev = platform_device_alloc(DRVNAME, address);
1544 if (!pdev) { 1561 if (!pdev) {
1545 err = -ENOMEM; 1562 err = -ENOMEM;
@@ -1608,7 +1625,7 @@ static void __exit sm_it87_exit(void)
1608 1625
1609MODULE_AUTHOR("Chris Gauthron, " 1626MODULE_AUTHOR("Chris Gauthron, "
1610 "Jean Delvare <khali@linux-fr.org>"); 1627 "Jean Delvare <khali@linux-fr.org>");
1611MODULE_DESCRIPTION("IT8705F/8712F/8716F/8718F/8726F, SiS950 driver"); 1628MODULE_DESCRIPTION("IT8705F/8712F/8716F/8718F/8720F/8726F, SiS950 driver");
1612module_param(update_vbat, bool, 0); 1629module_param(update_vbat, bool, 0);
1613MODULE_PARM_DESC(update_vbat, "Update vbat if set else return powerup value"); 1630MODULE_PARM_DESC(update_vbat, "Update vbat if set else return powerup value");
1614module_param(fix_pwm_polarity, bool, 0); 1631module_param(fix_pwm_polarity, bool, 0);
diff --git a/drivers/hwmon/lm70.c b/drivers/hwmon/lm70.c
index d435f003292d..ae6204f33214 100644
--- a/drivers/hwmon/lm70.c
+++ b/drivers/hwmon/lm70.c
@@ -37,9 +37,13 @@
37 37
38#define DRVNAME "lm70" 38#define DRVNAME "lm70"
39 39
40#define LM70_CHIP_LM70 0 /* original NS LM70 */
41#define LM70_CHIP_TMP121 1 /* TI TMP121/TMP123 */
42
40struct lm70 { 43struct lm70 {
41 struct device *hwmon_dev; 44 struct device *hwmon_dev;
42 struct mutex lock; 45 struct mutex lock;
46 unsigned int chip;
43}; 47};
44 48
45/* sysfs hook function */ 49/* sysfs hook function */
@@ -47,7 +51,7 @@ static ssize_t lm70_sense_temp(struct device *dev,
47 struct device_attribute *attr, char *buf) 51 struct device_attribute *attr, char *buf)
48{ 52{
49 struct spi_device *spi = to_spi_device(dev); 53 struct spi_device *spi = to_spi_device(dev);
50 int status, val; 54 int status, val = 0;
51 u8 rxbuf[2]; 55 u8 rxbuf[2];
52 s16 raw=0; 56 s16 raw=0;
53 struct lm70 *p_lm70 = dev_get_drvdata(&spi->dev); 57 struct lm70 *p_lm70 = dev_get_drvdata(&spi->dev);
@@ -65,12 +69,12 @@ static ssize_t lm70_sense_temp(struct device *dev,
65 "spi_write_then_read failed with status %d\n", status); 69 "spi_write_then_read failed with status %d\n", status);
66 goto out; 70 goto out;
67 } 71 }
68 dev_dbg(dev, "rxbuf[1] : 0x%x rxbuf[0] : 0x%x\n", rxbuf[1], rxbuf[0]); 72 raw = (rxbuf[0] << 8) + rxbuf[1];
69 73 dev_dbg(dev, "rxbuf[0] : 0x%02x rxbuf[1] : 0x%02x raw=0x%04x\n",
70 raw = (rxbuf[1] << 8) + rxbuf[0]; 74 rxbuf[0], rxbuf[1], raw);
71 dev_dbg(dev, "raw=0x%x\n", raw);
72 75
73 /* 76 /*
77 * LM70:
74 * The "raw" temperature read into rxbuf[] is a 16-bit signed 2's 78 * The "raw" temperature read into rxbuf[] is a 16-bit signed 2's
75 * complement value. Only the MSB 11 bits (1 sign + 10 temperature 79 * complement value. Only the MSB 11 bits (1 sign + 10 temperature
76 * bits) are meaningful; the LSB 5 bits are to be discarded. 80 * bits) are meaningful; the LSB 5 bits are to be discarded.
@@ -80,8 +84,21 @@ static ssize_t lm70_sense_temp(struct device *dev,
80 * by 0.25. Also multiply by 1000 to represent in millidegrees 84 * by 0.25. Also multiply by 1000 to represent in millidegrees
81 * Celsius. 85 * Celsius.
82 * So it's equivalent to multiplying by 0.25 * 1000 = 250. 86 * So it's equivalent to multiplying by 0.25 * 1000 = 250.
87 *
88 * TMP121/TMP123:
89 * 13 bits of 2's complement data, discard LSB 3 bits,
90 * resolution 0.0625 degrees celsius.
83 */ 91 */
84 val = ((int)raw/32) * 250; 92 switch (p_lm70->chip) {
93 case LM70_CHIP_LM70:
94 val = ((int)raw / 32) * 250;
95 break;
96
97 case LM70_CHIP_TMP121:
98 val = ((int)raw / 8) * 625 / 10;
99 break;
100 }
101
85 status = sprintf(buf, "%d\n", val); /* millidegrees Celsius */ 102 status = sprintf(buf, "%d\n", val); /* millidegrees Celsius */
86out: 103out:
87 mutex_unlock(&p_lm70->lock); 104 mutex_unlock(&p_lm70->lock);
@@ -93,27 +110,39 @@ static DEVICE_ATTR(temp1_input, S_IRUGO, lm70_sense_temp, NULL);
93static ssize_t lm70_show_name(struct device *dev, struct device_attribute 110static ssize_t lm70_show_name(struct device *dev, struct device_attribute
94 *devattr, char *buf) 111 *devattr, char *buf)
95{ 112{
96 return sprintf(buf, "lm70\n"); 113 struct lm70 *p_lm70 = dev_get_drvdata(dev);
114 int ret;
115
116 switch (p_lm70->chip) {
117 case LM70_CHIP_LM70:
118 ret = sprintf(buf, "lm70\n");
119 break;
120 case LM70_CHIP_TMP121:
121 ret = sprintf(buf, "tmp121\n");
122 break;
123 default:
124 ret = -EINVAL;
125 }
126 return ret;
97} 127}
98 128
99static DEVICE_ATTR(name, S_IRUGO, lm70_show_name, NULL); 129static DEVICE_ATTR(name, S_IRUGO, lm70_show_name, NULL);
100 130
101/*----------------------------------------------------------------------*/ 131/*----------------------------------------------------------------------*/
102 132
103static int __devinit lm70_probe(struct spi_device *spi) 133static int __devinit common_probe(struct spi_device *spi, int chip)
104{ 134{
105 struct lm70 *p_lm70; 135 struct lm70 *p_lm70;
106 int status; 136 int status;
107 137
108 /* signaling is SPI_MODE_0 on a 3-wire link (shared SI/SO) */ 138 /* NOTE: we assume 8-bit words, and convert to 16 bits manually */
109 if ((spi->mode & (SPI_CPOL|SPI_CPHA)) || !(spi->mode & SPI_3WIRE))
110 return -EINVAL;
111 139
112 p_lm70 = kzalloc(sizeof *p_lm70, GFP_KERNEL); 140 p_lm70 = kzalloc(sizeof *p_lm70, GFP_KERNEL);
113 if (!p_lm70) 141 if (!p_lm70)
114 return -ENOMEM; 142 return -ENOMEM;
115 143
116 mutex_init(&p_lm70->lock); 144 mutex_init(&p_lm70->lock);
145 p_lm70->chip = chip;
117 146
118 /* sysfs hook */ 147 /* sysfs hook */
119 p_lm70->hwmon_dev = hwmon_device_register(&spi->dev); 148 p_lm70->hwmon_dev = hwmon_device_register(&spi->dev);
@@ -141,6 +170,24 @@ out_dev_reg_failed:
141 return status; 170 return status;
142} 171}
143 172
173static int __devinit lm70_probe(struct spi_device *spi)
174{
175 /* signaling is SPI_MODE_0 on a 3-wire link (shared SI/SO) */
176 if ((spi->mode & (SPI_CPOL | SPI_CPHA)) || !(spi->mode & SPI_3WIRE))
177 return -EINVAL;
178
179 return common_probe(spi, LM70_CHIP_LM70);
180}
181
182static int __devinit tmp121_probe(struct spi_device *spi)
183{
184 /* signaling is SPI_MODE_0 with only MISO connected */
185 if (spi->mode & (SPI_CPOL | SPI_CPHA))
186 return -EINVAL;
187
188 return common_probe(spi, LM70_CHIP_TMP121);
189}
190
144static int __devexit lm70_remove(struct spi_device *spi) 191static int __devexit lm70_remove(struct spi_device *spi)
145{ 192{
146 struct lm70 *p_lm70 = dev_get_drvdata(&spi->dev); 193 struct lm70 *p_lm70 = dev_get_drvdata(&spi->dev);
@@ -154,6 +201,15 @@ static int __devexit lm70_remove(struct spi_device *spi)
154 return 0; 201 return 0;
155} 202}
156 203
204static struct spi_driver tmp121_driver = {
205 .driver = {
206 .name = "tmp121",
207 .owner = THIS_MODULE,
208 },
209 .probe = tmp121_probe,
210 .remove = __devexit_p(lm70_remove),
211};
212
157static struct spi_driver lm70_driver = { 213static struct spi_driver lm70_driver = {
158 .driver = { 214 .driver = {
159 .name = "lm70", 215 .name = "lm70",
@@ -165,17 +221,26 @@ static struct spi_driver lm70_driver = {
165 221
166static int __init init_lm70(void) 222static int __init init_lm70(void)
167{ 223{
168 return spi_register_driver(&lm70_driver); 224 int ret = spi_register_driver(&lm70_driver);
225 if (ret)
226 return ret;
227
228 ret = spi_register_driver(&tmp121_driver);
229 if (ret)
230 spi_unregister_driver(&lm70_driver);
231
232 return ret;
169} 233}
170 234
171static void __exit cleanup_lm70(void) 235static void __exit cleanup_lm70(void)
172{ 236{
173 spi_unregister_driver(&lm70_driver); 237 spi_unregister_driver(&lm70_driver);
238 spi_unregister_driver(&tmp121_driver);
174} 239}
175 240
176module_init(init_lm70); 241module_init(init_lm70);
177module_exit(cleanup_lm70); 242module_exit(cleanup_lm70);
178 243
179MODULE_AUTHOR("Kaiwan N Billimoria"); 244MODULE_AUTHOR("Kaiwan N Billimoria");
180MODULE_DESCRIPTION("National Semiconductor LM70 Linux driver"); 245MODULE_DESCRIPTION("NS LM70 / TI TMP121/TMP123 Linux driver");
181MODULE_LICENSE("GPL"); 246MODULE_LICENSE("GPL");
diff --git a/drivers/hwmon/ltc4245.c b/drivers/hwmon/ltc4245.c
new file mode 100644
index 000000000000..034b2c515848
--- /dev/null
+++ b/drivers/hwmon/ltc4245.c
@@ -0,0 +1,567 @@
1/*
2 * Driver for Linear Technology LTC4245 I2C Multiple Supply Hot Swap Controller
3 *
4 * Copyright (C) 2008 Ira W. Snyder <iws@ovro.caltech.edu>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
9 *
10 * This driver is based on the ds1621 and ina209 drivers.
11 *
12 * Datasheet:
13 * http://www.linear.com/pc/downloadDocument.do?navId=H0,C1,C1003,C1006,C1140,P19392,D13517
14 */
15
16#include <linux/kernel.h>
17#include <linux/module.h>
18#include <linux/init.h>
19#include <linux/err.h>
20#include <linux/slab.h>
21#include <linux/i2c.h>
22#include <linux/hwmon.h>
23#include <linux/hwmon-sysfs.h>
24
25/* Valid addresses are 0x20 - 0x3f
26 *
27 * For now, we do not probe, since some of these addresses
28 * are known to be unfriendly to probing */
29static const unsigned short normal_i2c[] = { I2C_CLIENT_END };
30
31/* Insmod parameters */
32I2C_CLIENT_INSMOD_1(ltc4245);
33
34/* Here are names of the chip's registers (a.k.a. commands) */
35enum ltc4245_cmd {
36 LTC4245_STATUS = 0x00, /* readonly */
37 LTC4245_ALERT = 0x01,
38 LTC4245_CONTROL = 0x02,
39 LTC4245_ON = 0x03,
40 LTC4245_FAULT1 = 0x04,
41 LTC4245_FAULT2 = 0x05,
42 LTC4245_GPIO = 0x06,
43 LTC4245_ADCADR = 0x07,
44
45 LTC4245_12VIN = 0x10,
46 LTC4245_12VSENSE = 0x11,
47 LTC4245_12VOUT = 0x12,
48 LTC4245_5VIN = 0x13,
49 LTC4245_5VSENSE = 0x14,
50 LTC4245_5VOUT = 0x15,
51 LTC4245_3VIN = 0x16,
52 LTC4245_3VSENSE = 0x17,
53 LTC4245_3VOUT = 0x18,
54 LTC4245_VEEIN = 0x19,
55 LTC4245_VEESENSE = 0x1a,
56 LTC4245_VEEOUT = 0x1b,
57 LTC4245_GPIOADC1 = 0x1c,
58 LTC4245_GPIOADC2 = 0x1d,
59 LTC4245_GPIOADC3 = 0x1e,
60};
61
62struct ltc4245_data {
63 struct device *hwmon_dev;
64
65 struct mutex update_lock;
66 bool valid;
67 unsigned long last_updated; /* in jiffies */
68
69 /* Control registers */
70 u8 cregs[0x08];
71
72 /* Voltage registers */
73 u8 vregs[0x0f];
74};
75
76static struct ltc4245_data *ltc4245_update_device(struct device *dev)
77{
78 struct i2c_client *client = to_i2c_client(dev);
79 struct ltc4245_data *data = i2c_get_clientdata(client);
80 s32 val;
81 int i;
82
83 mutex_lock(&data->update_lock);
84
85 if (time_after(jiffies, data->last_updated + HZ) || !data->valid) {
86
87 dev_dbg(&client->dev, "Starting ltc4245 update\n");
88
89 /* Read control registers -- 0x00 to 0x07 */
90 for (i = 0; i < ARRAY_SIZE(data->cregs); i++) {
91 val = i2c_smbus_read_byte_data(client, i);
92 if (unlikely(val < 0))
93 data->cregs[i] = 0;
94 else
95 data->cregs[i] = val;
96 }
97
98 /* Read voltage registers -- 0x10 to 0x1f */
99 for (i = 0; i < ARRAY_SIZE(data->vregs); i++) {
100 val = i2c_smbus_read_byte_data(client, i+0x10);
101 if (unlikely(val < 0))
102 data->vregs[i] = 0;
103 else
104 data->vregs[i] = val;
105 }
106
107 data->last_updated = jiffies;
108 data->valid = 1;
109 }
110
111 mutex_unlock(&data->update_lock);
112
113 return data;
114}
115
116/* Return the voltage from the given register in millivolts */
117static int ltc4245_get_voltage(struct device *dev, u8 reg)
118{
119 struct ltc4245_data *data = ltc4245_update_device(dev);
120 const u8 regval = data->vregs[reg - 0x10];
121 u32 voltage = 0;
122
123 switch (reg) {
124 case LTC4245_12VIN:
125 case LTC4245_12VOUT:
126 voltage = regval * 55;
127 break;
128 case LTC4245_5VIN:
129 case LTC4245_5VOUT:
130 voltage = regval * 22;
131 break;
132 case LTC4245_3VIN:
133 case LTC4245_3VOUT:
134 voltage = regval * 15;
135 break;
136 case LTC4245_VEEIN:
137 case LTC4245_VEEOUT:
138 voltage = regval * -55;
139 break;
140 case LTC4245_GPIOADC1:
141 case LTC4245_GPIOADC2:
142 case LTC4245_GPIOADC3:
143 voltage = regval * 10;
144 break;
145 default:
146 /* If we get here, the developer messed up */
147 WARN_ON_ONCE(1);
148 break;
149 }
150
151 return voltage;
152}
153
154/* Return the current in the given sense register in milliAmperes */
155static unsigned int ltc4245_get_current(struct device *dev, u8 reg)
156{
157 struct ltc4245_data *data = ltc4245_update_device(dev);
158 const u8 regval = data->vregs[reg - 0x10];
159 unsigned int voltage;
160 unsigned int curr;
161
162 /* The strange looking conversions that follow are fixed-point
163 * math, since we cannot do floating point in the kernel.
164 *
165 * Step 1: convert sense register to microVolts
166 * Step 2: convert voltage to milliAmperes
167 *
168 * If you play around with the V=IR equation, you come up with
169 * the following: X uV / Y mOhm == Z mA
170 *
171 * With the resistors that are fractions of a milliOhm, we multiply
172 * the voltage and resistance by 10, to shift the decimal point.
173 * Now we can use the normal division operator again.
174 */
175
176 switch (reg) {
177 case LTC4245_12VSENSE:
178 voltage = regval * 250; /* voltage in uV */
179 curr = voltage / 50; /* sense resistor 50 mOhm */
180 break;
181 case LTC4245_5VSENSE:
182 voltage = regval * 125; /* voltage in uV */
183 curr = (voltage * 10) / 35; /* sense resistor 3.5 mOhm */
184 break;
185 case LTC4245_3VSENSE:
186 voltage = regval * 125; /* voltage in uV */
187 curr = (voltage * 10) / 25; /* sense resistor 2.5 mOhm */
188 break;
189 case LTC4245_VEESENSE:
190 voltage = regval * 250; /* voltage in uV */
191 curr = voltage / 100; /* sense resistor 100 mOhm */
192 break;
193 default:
194 /* If we get here, the developer messed up */
195 WARN_ON_ONCE(1);
196 curr = 0;
197 break;
198 }
199
200 return curr;
201}
202
203static ssize_t ltc4245_show_voltage(struct device *dev,
204 struct device_attribute *da,
205 char *buf)
206{
207 struct sensor_device_attribute *attr = to_sensor_dev_attr(da);
208 const int voltage = ltc4245_get_voltage(dev, attr->index);
209
210 return snprintf(buf, PAGE_SIZE, "%d\n", voltage);
211}
212
213static ssize_t ltc4245_show_current(struct device *dev,
214 struct device_attribute *da,
215 char *buf)
216{
217 struct sensor_device_attribute *attr = to_sensor_dev_attr(da);
218 const unsigned int curr = ltc4245_get_current(dev, attr->index);
219
220 return snprintf(buf, PAGE_SIZE, "%u\n", curr);
221}
222
223static ssize_t ltc4245_show_power(struct device *dev,
224 struct device_attribute *da,
225 char *buf)
226{
227 struct sensor_device_attribute *attr = to_sensor_dev_attr(da);
228 const unsigned int curr = ltc4245_get_current(dev, attr->index);
229 const int output_voltage = ltc4245_get_voltage(dev, attr->index+1);
230
231 /* current in mA * voltage in mV == power in uW */
232 const unsigned int power = abs(output_voltage * curr);
233
234 return snprintf(buf, PAGE_SIZE, "%u\n", power);
235}
236
237static ssize_t ltc4245_show_alarm(struct device *dev,
238 struct device_attribute *da,
239 char *buf)
240{
241 struct sensor_device_attribute_2 *attr = to_sensor_dev_attr_2(da);
242 struct ltc4245_data *data = ltc4245_update_device(dev);
243 const u8 reg = data->cregs[attr->index];
244 const u32 mask = attr->nr;
245
246 return snprintf(buf, PAGE_SIZE, "%u\n", (reg & mask) ? 1 : 0);
247}
248
249/* These macros are used below in constructing device attribute objects
250 * for use with sysfs_create_group() to make a sysfs device file
251 * for each register.
252 */
253
254#define LTC4245_VOLTAGE(name, ltc4245_cmd_idx) \
255 static SENSOR_DEVICE_ATTR(name, S_IRUGO, \
256 ltc4245_show_voltage, NULL, ltc4245_cmd_idx)
257
258#define LTC4245_CURRENT(name, ltc4245_cmd_idx) \
259 static SENSOR_DEVICE_ATTR(name, S_IRUGO, \
260 ltc4245_show_current, NULL, ltc4245_cmd_idx)
261
262#define LTC4245_POWER(name, ltc4245_cmd_idx) \
263 static SENSOR_DEVICE_ATTR(name, S_IRUGO, \
264 ltc4245_show_power, NULL, ltc4245_cmd_idx)
265
266#define LTC4245_ALARM(name, mask, reg) \
267 static SENSOR_DEVICE_ATTR_2(name, S_IRUGO, \
268 ltc4245_show_alarm, NULL, (mask), reg)
269
270/* Construct a sensor_device_attribute structure for each register */
271
272/* Input voltages */
273LTC4245_VOLTAGE(in1_input, LTC4245_12VIN);
274LTC4245_VOLTAGE(in2_input, LTC4245_5VIN);
275LTC4245_VOLTAGE(in3_input, LTC4245_3VIN);
276LTC4245_VOLTAGE(in4_input, LTC4245_VEEIN);
277
278/* Input undervoltage alarms */
279LTC4245_ALARM(in1_min_alarm, (1 << 0), LTC4245_FAULT1);
280LTC4245_ALARM(in2_min_alarm, (1 << 1), LTC4245_FAULT1);
281LTC4245_ALARM(in3_min_alarm, (1 << 2), LTC4245_FAULT1);
282LTC4245_ALARM(in4_min_alarm, (1 << 3), LTC4245_FAULT1);
283
284/* Currents (via sense resistor) */
285LTC4245_CURRENT(curr1_input, LTC4245_12VSENSE);
286LTC4245_CURRENT(curr2_input, LTC4245_5VSENSE);
287LTC4245_CURRENT(curr3_input, LTC4245_3VSENSE);
288LTC4245_CURRENT(curr4_input, LTC4245_VEESENSE);
289
290/* Overcurrent alarms */
291LTC4245_ALARM(curr1_max_alarm, (1 << 4), LTC4245_FAULT1);
292LTC4245_ALARM(curr2_max_alarm, (1 << 5), LTC4245_FAULT1);
293LTC4245_ALARM(curr3_max_alarm, (1 << 6), LTC4245_FAULT1);
294LTC4245_ALARM(curr4_max_alarm, (1 << 7), LTC4245_FAULT1);
295
296/* Output voltages */
297LTC4245_VOLTAGE(in5_input, LTC4245_12VOUT);
298LTC4245_VOLTAGE(in6_input, LTC4245_5VOUT);
299LTC4245_VOLTAGE(in7_input, LTC4245_3VOUT);
300LTC4245_VOLTAGE(in8_input, LTC4245_VEEOUT);
301
302/* Power Bad alarms */
303LTC4245_ALARM(in5_min_alarm, (1 << 0), LTC4245_FAULT2);
304LTC4245_ALARM(in6_min_alarm, (1 << 1), LTC4245_FAULT2);
305LTC4245_ALARM(in7_min_alarm, (1 << 2), LTC4245_FAULT2);
306LTC4245_ALARM(in8_min_alarm, (1 << 3), LTC4245_FAULT2);
307
308/* GPIO voltages */
309LTC4245_VOLTAGE(in9_input, LTC4245_GPIOADC1);
310LTC4245_VOLTAGE(in10_input, LTC4245_GPIOADC2);
311LTC4245_VOLTAGE(in11_input, LTC4245_GPIOADC3);
312
313/* Power Consumption (virtual) */
314LTC4245_POWER(power1_input, LTC4245_12VSENSE);
315LTC4245_POWER(power2_input, LTC4245_5VSENSE);
316LTC4245_POWER(power3_input, LTC4245_3VSENSE);
317LTC4245_POWER(power4_input, LTC4245_VEESENSE);
318
319/* Finally, construct an array of pointers to members of the above objects,
320 * as required for sysfs_create_group()
321 */
322static struct attribute *ltc4245_attributes[] = {
323 &sensor_dev_attr_in1_input.dev_attr.attr,
324 &sensor_dev_attr_in2_input.dev_attr.attr,
325 &sensor_dev_attr_in3_input.dev_attr.attr,
326 &sensor_dev_attr_in4_input.dev_attr.attr,
327
328 &sensor_dev_attr_in1_min_alarm.dev_attr.attr,
329 &sensor_dev_attr_in2_min_alarm.dev_attr.attr,
330 &sensor_dev_attr_in3_min_alarm.dev_attr.attr,
331 &sensor_dev_attr_in4_min_alarm.dev_attr.attr,
332
333 &sensor_dev_attr_curr1_input.dev_attr.attr,
334 &sensor_dev_attr_curr2_input.dev_attr.attr,
335 &sensor_dev_attr_curr3_input.dev_attr.attr,
336 &sensor_dev_attr_curr4_input.dev_attr.attr,
337
338 &sensor_dev_attr_curr1_max_alarm.dev_attr.attr,
339 &sensor_dev_attr_curr2_max_alarm.dev_attr.attr,
340 &sensor_dev_attr_curr3_max_alarm.dev_attr.attr,
341 &sensor_dev_attr_curr4_max_alarm.dev_attr.attr,
342
343 &sensor_dev_attr_in5_input.dev_attr.attr,
344 &sensor_dev_attr_in6_input.dev_attr.attr,
345 &sensor_dev_attr_in7_input.dev_attr.attr,
346 &sensor_dev_attr_in8_input.dev_attr.attr,
347
348 &sensor_dev_attr_in5_min_alarm.dev_attr.attr,
349 &sensor_dev_attr_in6_min_alarm.dev_attr.attr,
350 &sensor_dev_attr_in7_min_alarm.dev_attr.attr,
351 &sensor_dev_attr_in8_min_alarm.dev_attr.attr,
352
353 &sensor_dev_attr_in9_input.dev_attr.attr,
354 &sensor_dev_attr_in10_input.dev_attr.attr,
355 &sensor_dev_attr_in11_input.dev_attr.attr,
356
357 &sensor_dev_attr_power1_input.dev_attr.attr,
358 &sensor_dev_attr_power2_input.dev_attr.attr,
359 &sensor_dev_attr_power3_input.dev_attr.attr,
360 &sensor_dev_attr_power4_input.dev_attr.attr,
361
362 NULL,
363};
364
365static const struct attribute_group ltc4245_group = {
366 .attrs = ltc4245_attributes,
367};
368
369static int ltc4245_probe(struct i2c_client *client,
370 const struct i2c_device_id *id)
371{
372 struct ltc4245_data *data;
373 int ret;
374
375 data = kzalloc(sizeof(*data), GFP_KERNEL);
376 if (!data) {
377 ret = -ENOMEM;
378 goto out_kzalloc;
379 }
380
381 i2c_set_clientdata(client, data);
382 mutex_init(&data->update_lock);
383
384 /* Initialize the LTC4245 chip */
385 /* TODO */
386
387 /* Register sysfs hooks */
388 ret = sysfs_create_group(&client->dev.kobj, &ltc4245_group);
389 if (ret)
390 goto out_sysfs_create_group;
391
392 data->hwmon_dev = hwmon_device_register(&client->dev);
393 if (IS_ERR(data->hwmon_dev)) {
394 ret = PTR_ERR(data->hwmon_dev);
395 goto out_hwmon_device_register;
396 }
397
398 return 0;
399
400out_hwmon_device_register:
401 sysfs_remove_group(&client->dev.kobj, &ltc4245_group);
402out_sysfs_create_group:
403 kfree(data);
404out_kzalloc:
405 return ret;
406}
407
408static int ltc4245_remove(struct i2c_client *client)
409{
410 struct ltc4245_data *data = i2c_get_clientdata(client);
411
412 hwmon_device_unregister(data->hwmon_dev);
413 sysfs_remove_group(&client->dev.kobj, &ltc4245_group);
414
415 kfree(data);
416
417 return 0;
418}
419
420/* Check that some bits in a control register appear at all possible
421 * locations without changing value
422 *
423 * @client: the i2c client to use
424 * @reg: the register to read
425 * @bits: the bits to check (0xff checks all bits,
426 * 0x03 checks only the last two bits)
427 *
428 * return -ERRNO if the register read failed
429 * return -ENODEV if the register value doesn't stay constant at all
430 * possible addresses
431 *
432 * return 0 for success
433 */
434static int ltc4245_check_control_reg(struct i2c_client *client, u8 reg, u8 bits)
435{
436 int i;
437 s32 v, voff1, voff2;
438
439 /* Read register and check for error */
440 v = i2c_smbus_read_byte_data(client, reg);
441 if (v < 0)
442 return v;
443
444 v &= bits;
445
446 for (i = 0x00; i < 0xff; i += 0x20) {
447
448 voff1 = i2c_smbus_read_byte_data(client, reg + i);
449 if (voff1 < 0)
450 return voff1;
451
452 voff2 = i2c_smbus_read_byte_data(client, reg + i + 0x08);
453 if (voff2 < 0)
454 return voff2;
455
456 voff1 &= bits;
457 voff2 &= bits;
458
459 if (v != voff1 || v != voff2)
460 return -ENODEV;
461 }
462
463 return 0;
464}
465
466static int ltc4245_detect(struct i2c_client *client,
467 int kind,
468 struct i2c_board_info *info)
469{
470 struct i2c_adapter *adapter = client->adapter;
471
472 if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA))
473 return -ENODEV;
474
475 if (kind < 0) { /* probed detection - check the chip type */
476 s32 v; /* 8 bits from the chip, or -ERRNO */
477
478 /* Chip registers 0x00-0x07 are control registers
479 * Chip registers 0x10-0x1f are data registers
480 *
481 * Address bits b7-b5 are ignored. This makes the chip "repeat"
482 * in steps of 0x20. Any control registers should appear with
483 * the same values across all duplicated addresses.
484 *
485 * Register 0x02 bit b2 is reserved, expect 0
486 * Register 0x07 bits b7 to b4 are reserved, expect 0
487 *
488 * Registers 0x01, 0x02 are control registers and should not
489 * change on their own.
490 *
491 * Register 0x06 bits b6 and b7 are control bits, and should
492 * not change on their own.
493 *
494 * Register 0x07 bits b3 to b0 are control bits, and should
495 * not change on their own.
496 */
497
498 /* read register 0x02 reserved bit, expect 0 */
499 v = i2c_smbus_read_byte_data(client, LTC4245_CONTROL);
500 if (v < 0 || (v & 0x04) != 0)
501 return -ENODEV;
502
503 /* read register 0x07 reserved bits, expect 0 */
504 v = i2c_smbus_read_byte_data(client, LTC4245_ADCADR);
505 if (v < 0 || (v & 0xf0) != 0)
506 return -ENODEV;
507
508 /* check that the alert register appears at all locations */
509 if (ltc4245_check_control_reg(client, LTC4245_ALERT, 0xff))
510 return -ENODEV;
511
512 /* check that the control register appears at all locations */
513 if (ltc4245_check_control_reg(client, LTC4245_CONTROL, 0xff))
514 return -ENODEV;
515
516 /* check that register 0x06 bits b6 and b7 stay constant */
517 if (ltc4245_check_control_reg(client, LTC4245_GPIO, 0xc0))
518 return -ENODEV;
519
520 /* check that register 0x07 bits b3-b0 stay constant */
521 if (ltc4245_check_control_reg(client, LTC4245_ADCADR, 0x0f))
522 return -ENODEV;
523 }
524
525 strlcpy(info->type, "ltc4245", I2C_NAME_SIZE);
526 dev_info(&adapter->dev, "ltc4245 %s at address 0x%02x\n",
527 kind < 0 ? "probed" : "forced",
528 client->addr);
529
530 return 0;
531}
532
533static const struct i2c_device_id ltc4245_id[] = {
534 { "ltc4245", ltc4245 },
535 { }
536};
537MODULE_DEVICE_TABLE(i2c, ltc4245_id);
538
539/* This is the driver that will be inserted */
540static struct i2c_driver ltc4245_driver = {
541 .class = I2C_CLASS_HWMON,
542 .driver = {
543 .name = "ltc4245",
544 },
545 .probe = ltc4245_probe,
546 .remove = ltc4245_remove,
547 .id_table = ltc4245_id,
548 .detect = ltc4245_detect,
549 .address_data = &addr_data,
550};
551
552static int __init ltc4245_init(void)
553{
554 return i2c_add_driver(&ltc4245_driver);
555}
556
557static void __exit ltc4245_exit(void)
558{
559 i2c_del_driver(&ltc4245_driver);
560}
561
562MODULE_AUTHOR("Ira W. Snyder <iws@ovro.caltech.edu>");
563MODULE_DESCRIPTION("LTC4245 driver");
564MODULE_LICENSE("GPL");
565
566module_init(ltc4245_init);
567module_exit(ltc4245_exit);
diff --git a/drivers/hwmon/pc87360.c b/drivers/hwmon/pc87360.c
index 5fbfa34c110e..fb052fea3744 100644
--- a/drivers/hwmon/pc87360.c
+++ b/drivers/hwmon/pc87360.c
@@ -43,6 +43,7 @@
43#include <linux/hwmon-vid.h> 43#include <linux/hwmon-vid.h>
44#include <linux/err.h> 44#include <linux/err.h>
45#include <linux/mutex.h> 45#include <linux/mutex.h>
46#include <linux/acpi.h>
46#include <asm/io.h> 47#include <asm/io.h>
47 48
48static u8 devid; 49static u8 devid;
@@ -1627,6 +1628,11 @@ static int __init pc87360_device_add(unsigned short address)
1627 continue; 1628 continue;
1628 res.start = extra_isa[i]; 1629 res.start = extra_isa[i];
1629 res.end = extra_isa[i] + PC87360_EXTENT - 1; 1630 res.end = extra_isa[i] + PC87360_EXTENT - 1;
1631
1632 err = acpi_check_resource_conflict(&res);
1633 if (err)
1634 goto exit_device_put;
1635
1630 err = platform_device_add_resources(pdev, &res, 1); 1636 err = platform_device_add_resources(pdev, &res, 1);
1631 if (err) { 1637 if (err) {
1632 printk(KERN_ERR "pc87360: Device resource[%d] " 1638 printk(KERN_ERR "pc87360: Device resource[%d] "
diff --git a/drivers/hwmon/pc87427.c b/drivers/hwmon/pc87427.c
index 7265f22ae5cd..3a8a0f7a7736 100644
--- a/drivers/hwmon/pc87427.c
+++ b/drivers/hwmon/pc87427.c
@@ -32,6 +32,7 @@
32#include <linux/mutex.h> 32#include <linux/mutex.h>
33#include <linux/sysfs.h> 33#include <linux/sysfs.h>
34#include <linux/ioport.h> 34#include <linux/ioport.h>
35#include <linux/acpi.h>
35#include <asm/io.h> 36#include <asm/io.h>
36 37
37static unsigned short force_id; 38static unsigned short force_id;
@@ -524,6 +525,10 @@ static int __init pc87427_device_add(unsigned short address)
524 }; 525 };
525 int err; 526 int err;
526 527
528 err = acpi_check_resource_conflict(&res);
529 if (err)
530 goto exit;
531
527 pdev = platform_device_alloc(DRVNAME, address); 532 pdev = platform_device_alloc(DRVNAME, address);
528 if (!pdev) { 533 if (!pdev) {
529 err = -ENOMEM; 534 err = -ENOMEM;
diff --git a/drivers/hwmon/sis5595.c b/drivers/hwmon/sis5595.c
index a276806f3d53..aa2e8318f167 100644
--- a/drivers/hwmon/sis5595.c
+++ b/drivers/hwmon/sis5595.c
@@ -62,6 +62,7 @@
62#include <linux/jiffies.h> 62#include <linux/jiffies.h>
63#include <linux/mutex.h> 63#include <linux/mutex.h>
64#include <linux/sysfs.h> 64#include <linux/sysfs.h>
65#include <linux/acpi.h>
65#include <asm/io.h> 66#include <asm/io.h>
66 67
67 68
@@ -727,6 +728,10 @@ static int __devinit sis5595_device_add(unsigned short address)
727 }; 728 };
728 int err; 729 int err;
729 730
731 err = acpi_check_resource_conflict(&res);
732 if (err)
733 goto exit;
734
730 pdev = platform_device_alloc("sis5595", address); 735 pdev = platform_device_alloc("sis5595", address);
731 if (!pdev) { 736 if (!pdev) {
732 err = -ENOMEM; 737 err = -ENOMEM;
diff --git a/drivers/hwmon/smsc47b397.c b/drivers/hwmon/smsc47b397.c
index eb03544c731c..6f6d52b4fb64 100644
--- a/drivers/hwmon/smsc47b397.c
+++ b/drivers/hwmon/smsc47b397.c
@@ -36,6 +36,7 @@
36#include <linux/err.h> 36#include <linux/err.h>
37#include <linux/init.h> 37#include <linux/init.h>
38#include <linux/mutex.h> 38#include <linux/mutex.h>
39#include <linux/acpi.h>
39#include <asm/io.h> 40#include <asm/io.h>
40 41
41static unsigned short force_id; 42static unsigned short force_id;
@@ -303,6 +304,10 @@ static int __init smsc47b397_device_add(unsigned short address)
303 }; 304 };
304 int err; 305 int err;
305 306
307 err = acpi_check_resource_conflict(&res);
308 if (err)
309 goto exit;
310
306 pdev = platform_device_alloc(DRVNAME, address); 311 pdev = platform_device_alloc(DRVNAME, address);
307 if (!pdev) { 312 if (!pdev) {
308 err = -ENOMEM; 313 err = -ENOMEM;
diff --git a/drivers/hwmon/smsc47m1.c b/drivers/hwmon/smsc47m1.c
index d1b498548736..a92dbb97ee99 100644
--- a/drivers/hwmon/smsc47m1.c
+++ b/drivers/hwmon/smsc47m1.c
@@ -37,6 +37,7 @@
37#include <linux/init.h> 37#include <linux/init.h>
38#include <linux/mutex.h> 38#include <linux/mutex.h>
39#include <linux/sysfs.h> 39#include <linux/sysfs.h>
40#include <linux/acpi.h>
40#include <asm/io.h> 41#include <asm/io.h>
41 42
42static unsigned short force_id; 43static unsigned short force_id;
@@ -705,6 +706,10 @@ static int __init smsc47m1_device_add(unsigned short address,
705 }; 706 };
706 int err; 707 int err;
707 708
709 err = acpi_check_resource_conflict(&res);
710 if (err)
711 goto exit;
712
708 pdev = platform_device_alloc(DRVNAME, address); 713 pdev = platform_device_alloc(DRVNAME, address);
709 if (!pdev) { 714 if (!pdev) {
710 err = -ENOMEM; 715 err = -ENOMEM;
diff --git a/drivers/hwmon/via686a.c b/drivers/hwmon/via686a.c
index f1ee5e731968..a022aedcaacb 100644
--- a/drivers/hwmon/via686a.c
+++ b/drivers/hwmon/via686a.c
@@ -41,6 +41,7 @@
41#include <linux/init.h> 41#include <linux/init.h>
42#include <linux/mutex.h> 42#include <linux/mutex.h>
43#include <linux/sysfs.h> 43#include <linux/sysfs.h>
44#include <linux/acpi.h>
44#include <asm/io.h> 45#include <asm/io.h>
45 46
46 47
@@ -783,6 +784,10 @@ static int __devinit via686a_device_add(unsigned short address)
783 }; 784 };
784 int err; 785 int err;
785 786
787 err = acpi_check_resource_conflict(&res);
788 if (err)
789 goto exit;
790
786 pdev = platform_device_alloc("via686a", address); 791 pdev = platform_device_alloc("via686a", address);
787 if (!pdev) { 792 if (!pdev) {
788 err = -ENOMEM; 793 err = -ENOMEM;
diff --git a/drivers/hwmon/vt1211.c b/drivers/hwmon/vt1211.c
index 12b43590fa53..b0ce37852281 100644
--- a/drivers/hwmon/vt1211.c
+++ b/drivers/hwmon/vt1211.c
@@ -32,6 +32,7 @@
32#include <linux/err.h> 32#include <linux/err.h>
33#include <linux/mutex.h> 33#include <linux/mutex.h>
34#include <linux/ioport.h> 34#include <linux/ioport.h>
35#include <linux/acpi.h>
35#include <asm/io.h> 36#include <asm/io.h>
36 37
37static int uch_config = -1; 38static int uch_config = -1;
@@ -1259,6 +1260,10 @@ static int __init vt1211_device_add(unsigned short address)
1259 } 1260 }
1260 1261
1261 res.name = pdev->name; 1262 res.name = pdev->name;
1263 err = acpi_check_resource_conflict(&res);
1264 if (err)
1265 goto EXIT;
1266
1262 err = platform_device_add_resources(pdev, &res, 1); 1267 err = platform_device_add_resources(pdev, &res, 1);
1263 if (err) { 1268 if (err) {
1264 printk(KERN_ERR DRVNAME ": Device resource addition failed " 1269 printk(KERN_ERR DRVNAME ": Device resource addition failed "
diff --git a/drivers/hwmon/vt8231.c b/drivers/hwmon/vt8231.c
index 5bc57275cae8..9982b45fbb14 100644
--- a/drivers/hwmon/vt8231.c
+++ b/drivers/hwmon/vt8231.c
@@ -35,6 +35,7 @@
35#include <linux/hwmon-vid.h> 35#include <linux/hwmon-vid.h>
36#include <linux/err.h> 36#include <linux/err.h>
37#include <linux/mutex.h> 37#include <linux/mutex.h>
38#include <linux/acpi.h>
38#include <asm/io.h> 39#include <asm/io.h>
39 40
40static int force_addr; 41static int force_addr;
@@ -894,6 +895,10 @@ static int __devinit vt8231_device_add(unsigned short address)
894 }; 895 };
895 int err; 896 int err;
896 897
898 err = acpi_check_resource_conflict(&res);
899 if (err)
900 goto exit;
901
897 pdev = platform_device_alloc("vt8231", address); 902 pdev = platform_device_alloc("vt8231", address);
898 if (!pdev) { 903 if (!pdev) {
899 err = -ENOMEM; 904 err = -ENOMEM;
diff --git a/drivers/hwmon/w83627ehf.c b/drivers/hwmon/w83627ehf.c
index 075164dd65a7..cb808d015361 100644
--- a/drivers/hwmon/w83627ehf.c
+++ b/drivers/hwmon/w83627ehf.c
@@ -48,6 +48,7 @@
48#include <linux/hwmon-vid.h> 48#include <linux/hwmon-vid.h>
49#include <linux/err.h> 49#include <linux/err.h>
50#include <linux/mutex.h> 50#include <linux/mutex.h>
51#include <linux/acpi.h>
51#include <asm/io.h> 52#include <asm/io.h>
52#include "lm75.h" 53#include "lm75.h"
53 54
@@ -502,7 +503,7 @@ static struct w83627ehf_data *w83627ehf_update_device(struct device *dev)
502 } 503 }
503 504
504 for (i = 0; i < 4; i++) { 505 for (i = 0; i < 4; i++) {
505 /* pwmcfg, tolarance mapped for i=0, i=1 to same reg */ 506 /* pwmcfg, tolerance mapped for i=0, i=1 to same reg */
506 if (i != 1) { 507 if (i != 1) {
507 pwmcfg = w83627ehf_read_value(data, 508 pwmcfg = w83627ehf_read_value(data,
508 W83627EHF_REG_PWM_ENABLE[i]); 509 W83627EHF_REG_PWM_ENABLE[i]);
@@ -1544,6 +1545,11 @@ static int __init sensors_w83627ehf_init(void)
1544 res.start = address + IOREGION_OFFSET; 1545 res.start = address + IOREGION_OFFSET;
1545 res.end = address + IOREGION_OFFSET + IOREGION_LENGTH - 1; 1546 res.end = address + IOREGION_OFFSET + IOREGION_LENGTH - 1;
1546 res.flags = IORESOURCE_IO; 1547 res.flags = IORESOURCE_IO;
1548
1549 err = acpi_check_resource_conflict(&res);
1550 if (err)
1551 goto exit;
1552
1547 err = platform_device_add_resources(pdev, &res, 1); 1553 err = platform_device_add_resources(pdev, &res, 1);
1548 if (err) { 1554 if (err) {
1549 printk(KERN_ERR DRVNAME ": Device resource addition failed " 1555 printk(KERN_ERR DRVNAME ": Device resource addition failed "
diff --git a/drivers/hwmon/w83627hf.c b/drivers/hwmon/w83627hf.c
index b30e5796cb26..389150ba30d3 100644
--- a/drivers/hwmon/w83627hf.c
+++ b/drivers/hwmon/w83627hf.c
@@ -50,6 +50,7 @@
50#include <linux/err.h> 50#include <linux/err.h>
51#include <linux/mutex.h> 51#include <linux/mutex.h>
52#include <linux/ioport.h> 52#include <linux/ioport.h>
53#include <linux/acpi.h>
53#include <asm/io.h> 54#include <asm/io.h>
54#include "lm75.h" 55#include "lm75.h"
55 56
@@ -1793,6 +1794,10 @@ static int __init w83627hf_device_add(unsigned short address,
1793 }; 1794 };
1794 int err; 1795 int err;
1795 1796
1797 err = acpi_check_resource_conflict(&res);
1798 if (err)
1799 goto exit;
1800
1796 pdev = platform_device_alloc(DRVNAME, address); 1801 pdev = platform_device_alloc(DRVNAME, address);
1797 if (!pdev) { 1802 if (!pdev) {
1798 err = -ENOMEM; 1803 err = -ENOMEM;
diff --git a/drivers/hwmon/w83781d.c b/drivers/hwmon/w83781d.c
index fc12bd412e3a..dbfb30c588d8 100644
--- a/drivers/hwmon/w83781d.c
+++ b/drivers/hwmon/w83781d.c
@@ -58,7 +58,10 @@ static const unsigned short normal_i2c[] = { 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d,
58 0x2e, 0x2f, I2C_CLIENT_END }; 58 0x2e, 0x2f, I2C_CLIENT_END };
59/* Insmod parameters */ 59/* Insmod parameters */
60I2C_CLIENT_INSMOD_4(w83781d, w83782d, w83783s, as99127f); 60I2C_CLIENT_INSMOD_4(w83781d, w83782d, w83783s, as99127f);
61I2C_CLIENT_MODULE_PARM(force_subclients, "List of subclient addresses: " 61
62static unsigned short force_subclients[4];
63module_param_array(force_subclients, short, NULL, 0);
64MODULE_PARM_DESC(force_subclients, "List of subclient addresses: "
62 "{bus, clientaddr, subclientaddr1, subclientaddr2}"); 65 "{bus, clientaddr, subclientaddr1, subclientaddr2}");
63 66
64static int reset; 67static int reset;
diff --git a/drivers/hwmon/w83791d.c b/drivers/hwmon/w83791d.c
index 5768def8a4f2..97851c5ba3a3 100644
--- a/drivers/hwmon/w83791d.c
+++ b/drivers/hwmon/w83791d.c
@@ -53,7 +53,10 @@ static const unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e, 0x2f,
53 53
54/* Insmod parameters */ 54/* Insmod parameters */
55I2C_CLIENT_INSMOD_1(w83791d); 55I2C_CLIENT_INSMOD_1(w83791d);
56I2C_CLIENT_MODULE_PARM(force_subclients, "List of subclient addresses: " 56
57static unsigned short force_subclients[4];
58module_param_array(force_subclients, short, NULL, 0);
59MODULE_PARM_DESC(force_subclients, "List of subclient addresses: "
57 "{bus, clientaddr, subclientaddr1, subclientaddr2}"); 60 "{bus, clientaddr, subclientaddr1, subclientaddr2}");
58 61
59static int reset; 62static int reset;
diff --git a/drivers/hwmon/w83792d.c b/drivers/hwmon/w83792d.c
index cf94c5b0c879..2be16194ddf3 100644
--- a/drivers/hwmon/w83792d.c
+++ b/drivers/hwmon/w83792d.c
@@ -51,7 +51,10 @@ static const unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e, 0x2f,
51 51
52/* Insmod parameters */ 52/* Insmod parameters */
53I2C_CLIENT_INSMOD_1(w83792d); 53I2C_CLIENT_INSMOD_1(w83792d);
54I2C_CLIENT_MODULE_PARM(force_subclients, "List of subclient addresses: " 54
55static unsigned short force_subclients[4];
56module_param_array(force_subclients, short, NULL, 0);
57MODULE_PARM_DESC(force_subclients, "List of subclient addresses: "
55 "{bus, clientaddr, subclientaddr1, subclientaddr2}"); 58 "{bus, clientaddr, subclientaddr1, subclientaddr2}");
56 59
57static int init; 60static int init;
diff --git a/drivers/hwmon/w83793.c b/drivers/hwmon/w83793.c
index 0a739f1c69be..47dd398f7258 100644
--- a/drivers/hwmon/w83793.c
+++ b/drivers/hwmon/w83793.c
@@ -42,7 +42,10 @@ static const unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e, 0x2f,
42 42
43/* Insmod parameters */ 43/* Insmod parameters */
44I2C_CLIENT_INSMOD_1(w83793); 44I2C_CLIENT_INSMOD_1(w83793);
45I2C_CLIENT_MODULE_PARM(force_subclients, "List of subclient addresses: " 45
46static unsigned short force_subclients[4];
47module_param_array(force_subclients, short, NULL, 0);
48MODULE_PARM_DESC(force_subclients, "List of subclient addresses: "
46 "{bus, clientaddr, subclientaddr1, subclientaddr2}"); 49 "{bus, clientaddr, subclientaddr1, subclientaddr2}");
47 50
48static int reset; 51static int reset;
diff --git a/drivers/i2c/busses/i2c-ali1563.c b/drivers/i2c/busses/i2c-ali1563.c
index fc3e5b026423..dd9e796fad69 100644
--- a/drivers/i2c/busses/i2c-ali1563.c
+++ b/drivers/i2c/busses/i2c-ali1563.c
@@ -399,8 +399,8 @@ static int __devinit ali1563_probe(struct pci_dev * dev,
399 if ((error = ali1563_setup(dev))) 399 if ((error = ali1563_setup(dev)))
400 goto exit; 400 goto exit;
401 ali1563_adapter.dev.parent = &dev->dev; 401 ali1563_adapter.dev.parent = &dev->dev;
402 sprintf(ali1563_adapter.name,"SMBus ALi 1563 Adapter @ %04x", 402 snprintf(ali1563_adapter.name, sizeof(ali1563_adapter.name),
403 ali1563_smba); 403 "SMBus ALi 1563 Adapter @ %04x", ali1563_smba);
404 if ((error = i2c_add_adapter(&ali1563_adapter))) 404 if ((error = i2c_add_adapter(&ali1563_adapter)))
405 goto exit_shutdown; 405 goto exit_shutdown;
406 return 0; 406 return 0;
diff --git a/drivers/i2c/busses/i2c-amd756-s4882.c b/drivers/i2c/busses/i2c-amd756-s4882.c
index 8ba2bcf727d3..378fcb5d5783 100644
--- a/drivers/i2c/busses/i2c-amd756-s4882.c
+++ b/drivers/i2c/busses/i2c-amd756-s4882.c
@@ -197,8 +197,8 @@ static int __init amd756_s4882_init(void)
197 for (i = 1; i < 5; i++) { 197 for (i = 1; i < 5; i++) {
198 s4882_algo[i] = *(amd756_smbus.algo); 198 s4882_algo[i] = *(amd756_smbus.algo);
199 s4882_adapter[i] = amd756_smbus; 199 s4882_adapter[i] = amd756_smbus;
200 sprintf(s4882_adapter[i].name, 200 snprintf(s4882_adapter[i].name, sizeof(s4882_adapter[i].name),
201 "SMBus 8111 adapter (CPU%d)", i-1); 201 "SMBus 8111 adapter (CPU%d)", i-1);
202 s4882_adapter[i].algo = s4882_algo+i; 202 s4882_adapter[i].algo = s4882_algo+i;
203 s4882_adapter[i].dev.parent = amd756_smbus.dev.parent; 203 s4882_adapter[i].dev.parent = amd756_smbus.dev.parent;
204 } 204 }
diff --git a/drivers/i2c/busses/i2c-amd756.c b/drivers/i2c/busses/i2c-amd756.c
index 424dad6f18d8..36bee5b9c952 100644
--- a/drivers/i2c/busses/i2c-amd756.c
+++ b/drivers/i2c/busses/i2c-amd756.c
@@ -380,8 +380,9 @@ static int __devinit amd756_probe(struct pci_dev *pdev,
380 /* set up the sysfs linkage to our parent device */ 380 /* set up the sysfs linkage to our parent device */
381 amd756_smbus.dev.parent = &pdev->dev; 381 amd756_smbus.dev.parent = &pdev->dev;
382 382
383 sprintf(amd756_smbus.name, "SMBus %s adapter at %04x", 383 snprintf(amd756_smbus.name, sizeof(amd756_smbus.name),
384 chipname[id->driver_data], amd756_ioport); 384 "SMBus %s adapter at %04x", chipname[id->driver_data],
385 amd756_ioport);
385 386
386 error = i2c_add_adapter(&amd756_smbus); 387 error = i2c_add_adapter(&amd756_smbus);
387 if (error) { 388 if (error) {
diff --git a/drivers/i2c/busses/i2c-at91.c b/drivers/i2c/busses/i2c-at91.c
index 9efb02137254..67d9dc5b351b 100644
--- a/drivers/i2c/busses/i2c-at91.c
+++ b/drivers/i2c/busses/i2c-at91.c
@@ -222,7 +222,7 @@ static int __devinit at91_i2c_probe(struct platform_device *pdev)
222 rc = -ENOMEM; 222 rc = -ENOMEM;
223 goto fail2; 223 goto fail2;
224 } 224 }
225 sprintf(adapter->name, "AT91"); 225 snprintf(adapter->name, sizeof(adapter->name), "AT91");
226 adapter->algo = &at91_algorithm; 226 adapter->algo = &at91_algorithm;
227 adapter->class = I2C_CLASS_HWMON; 227 adapter->class = I2C_CLASS_HWMON;
228 adapter->dev.parent = &pdev->dev; 228 adapter->dev.parent = &pdev->dev;
diff --git a/drivers/i2c/busses/i2c-bfin-twi.c b/drivers/i2c/busses/i2c-bfin-twi.c
index 3c855ff2992f..3fd2c417c1e0 100644
--- a/drivers/i2c/busses/i2c-bfin-twi.c
+++ b/drivers/i2c/busses/i2c-bfin-twi.c
@@ -656,7 +656,7 @@ static int i2c_bfin_twi_probe(struct platform_device *pdev)
656 strlcpy(p_adap->name, pdev->name, sizeof(p_adap->name)); 656 strlcpy(p_adap->name, pdev->name, sizeof(p_adap->name));
657 p_adap->algo = &bfin_twi_algorithm; 657 p_adap->algo = &bfin_twi_algorithm;
658 p_adap->algo_data = iface; 658 p_adap->algo_data = iface;
659 p_adap->class = I2C_CLASS_ALL; 659 p_adap->class = I2C_CLASS_HWMON | I2C_CLASS_SPD;
660 p_adap->dev.parent = &pdev->dev; 660 p_adap->dev.parent = &pdev->dev;
661 661
662 rc = peripheral_request_list(pin_req[pdev->id], "i2c-bfin-twi"); 662 rc = peripheral_request_list(pin_req[pdev->id], "i2c-bfin-twi");
diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c
index 5123eb69a971..526625eaa84b 100644
--- a/drivers/i2c/busses/i2c-i801.c
+++ b/drivers/i2c/busses/i2c-i801.c
@@ -64,7 +64,7 @@
64#include <linux/init.h> 64#include <linux/init.h>
65#include <linux/i2c.h> 65#include <linux/i2c.h>
66#include <linux/acpi.h> 66#include <linux/acpi.h>
67#include <asm/io.h> 67#include <linux/io.h>
68 68
69/* I801 SMBus address offsets */ 69/* I801 SMBus address offsets */
70#define SMBHSTSTS (0 + i801_smba) 70#define SMBHSTSTS (0 + i801_smba)
@@ -583,6 +583,40 @@ static struct pci_device_id i801_ids[] = {
583 583
584MODULE_DEVICE_TABLE (pci, i801_ids); 584MODULE_DEVICE_TABLE (pci, i801_ids);
585 585
586#if defined CONFIG_INPUT_APANEL || defined CONFIG_INPUT_APANEL_MODULE
587static unsigned char apanel_addr;
588
589/* Scan the system ROM for the signature "FJKEYINF" */
590static __init const void __iomem *bios_signature(const void __iomem *bios)
591{
592 ssize_t offset;
593 const unsigned char signature[] = "FJKEYINF";
594
595 for (offset = 0; offset < 0x10000; offset += 0x10) {
596 if (check_signature(bios + offset, signature,
597 sizeof(signature)-1))
598 return bios + offset;
599 }
600 return NULL;
601}
602
603static void __init input_apanel_init(void)
604{
605 void __iomem *bios;
606 const void __iomem *p;
607
608 bios = ioremap(0xF0000, 0x10000); /* Can't fail */
609 p = bios_signature(bios);
610 if (p) {
611 /* just use the first address */
612 apanel_addr = readb(p + 8 + 3) >> 1;
613 }
614 iounmap(bios);
615}
616#else
617static void __init input_apanel_init(void) {}
618#endif
619
586static int __devinit i801_probe(struct pci_dev *dev, const struct pci_device_id *id) 620static int __devinit i801_probe(struct pci_dev *dev, const struct pci_device_id *id)
587{ 621{
588 unsigned char temp; 622 unsigned char temp;
@@ -667,6 +701,19 @@ static int __devinit i801_probe(struct pci_dev *dev, const struct pci_device_id
667 dev_err(&dev->dev, "Failed to add SMBus adapter\n"); 701 dev_err(&dev->dev, "Failed to add SMBus adapter\n");
668 goto exit_release; 702 goto exit_release;
669 } 703 }
704
705 /* Register optional slaves */
706#if defined CONFIG_INPUT_APANEL || defined CONFIG_INPUT_APANEL_MODULE
707 if (apanel_addr) {
708 struct i2c_board_info info;
709
710 memset(&info, 0, sizeof(struct i2c_board_info));
711 info.addr = apanel_addr;
712 strlcpy(info.type, "fujitsu_apanel", I2C_NAME_SIZE);
713 i2c_new_device(&i801_adapter, &info);
714 }
715#endif
716
670 return 0; 717 return 0;
671 718
672exit_release: 719exit_release:
@@ -717,6 +764,7 @@ static struct pci_driver i801_driver = {
717 764
718static int __init i2c_i801_init(void) 765static int __init i2c_i801_init(void)
719{ 766{
767 input_apanel_init();
720 return pci_register_driver(&i801_driver); 768 return pci_register_driver(&i801_driver);
721} 769}
722 770
diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c
index 587f5b2380d4..6af68146c342 100644
--- a/drivers/i2c/busses/i2c-pxa.c
+++ b/drivers/i2c/busses/i2c-pxa.c
@@ -1076,10 +1076,10 @@ static int i2c_pxa_probe(struct platform_device *dev)
1076 1076
1077#ifdef CONFIG_I2C_PXA_SLAVE 1077#ifdef CONFIG_I2C_PXA_SLAVE
1078 printk(KERN_INFO "I2C: %s: PXA I2C adapter, slave address %d\n", 1078 printk(KERN_INFO "I2C: %s: PXA I2C adapter, slave address %d\n",
1079 i2c->adap.dev.bus_id, i2c->slave_addr); 1079 dev_name(&i2c->adap.dev), i2c->slave_addr);
1080#else 1080#else
1081 printk(KERN_INFO "I2C: %s: PXA I2C adapter\n", 1081 printk(KERN_INFO "I2C: %s: PXA I2C adapter\n",
1082 i2c->adap.dev.bus_id); 1082 dev_name(&i2c->adap.dev));
1083#endif 1083#endif
1084 return 0; 1084 return 0;
1085 1085
diff --git a/drivers/i2c/busses/i2c-s3c2410.c b/drivers/i2c/busses/i2c-s3c2410.c
index f69f91ffb469..5b7f95641ba4 100644
--- a/drivers/i2c/busses/i2c-s3c2410.c
+++ b/drivers/i2c/busses/i2c-s3c2410.c
@@ -906,7 +906,7 @@ static int s3c24xx_i2c_probe(struct platform_device *pdev)
906 906
907 platform_set_drvdata(pdev, i2c); 907 platform_set_drvdata(pdev, i2c);
908 908
909 dev_info(&pdev->dev, "%s: S3C I2C adapter\n", i2c->adap.dev.bus_id); 909 dev_info(&pdev->dev, "%s: S3C I2C adapter\n", dev_name(&i2c->adap.dev));
910 return 0; 910 return 0;
911 911
912 err_cpufreq: 912 err_cpufreq:
diff --git a/drivers/i2c/busses/i2c-sh7760.c b/drivers/i2c/busses/i2c-sh7760.c
index 5e0e254976de..baa28b73ae42 100644
--- a/drivers/i2c/busses/i2c-sh7760.c
+++ b/drivers/i2c/busses/i2c-sh7760.c
@@ -475,7 +475,7 @@ static int __devinit sh7760_i2c_probe(struct platform_device *pdev)
475 475
476 id->adap.nr = pdev->id; 476 id->adap.nr = pdev->id;
477 id->adap.algo = &sh7760_i2c_algo; 477 id->adap.algo = &sh7760_i2c_algo;
478 id->adap.class = I2C_CLASS_ALL; 478 id->adap.class = I2C_CLASS_HWMON | I2C_CLASS_SPD;
479 id->adap.retries = 3; 479 id->adap.retries = 3;
480 id->adap.algo_data = id; 480 id->adap.algo_data = id;
481 id->adap.dev.parent = &pdev->dev; 481 id->adap.dev.parent = &pdev->dev;
diff --git a/drivers/i2c/busses/i2c-sh_mobile.c b/drivers/i2c/busses/i2c-sh_mobile.c
index 6c3d60b939bf..1c01083b01b5 100644
--- a/drivers/i2c/busses/i2c-sh_mobile.c
+++ b/drivers/i2c/busses/i2c-sh_mobile.c
@@ -500,7 +500,7 @@ static int sh_mobile_i2c_hook_irqs(struct platform_device *dev, int hook)
500 while ((res = platform_get_resource(dev, IORESOURCE_IRQ, k))) { 500 while ((res = platform_get_resource(dev, IORESOURCE_IRQ, k))) {
501 for (n = res->start; hook && n <= res->end; n++) { 501 for (n = res->start; hook && n <= res->end; n++) {
502 if (request_irq(n, sh_mobile_i2c_isr, IRQF_DISABLED, 502 if (request_irq(n, sh_mobile_i2c_isr, IRQF_DISABLED,
503 dev->dev.bus_id, dev)) 503 dev_name(&dev->dev), dev))
504 goto rollback; 504 goto rollback;
505 } 505 }
506 k++; 506 k++;
diff --git a/drivers/i2c/busses/i2c-sis5595.c b/drivers/i2c/busses/i2c-sis5595.c
index dfc2d5eb6a68..8ce2daff985c 100644
--- a/drivers/i2c/busses/i2c-sis5595.c
+++ b/drivers/i2c/busses/i2c-sis5595.c
@@ -389,8 +389,8 @@ static int __devinit sis5595_probe(struct pci_dev *dev, const struct pci_device_
389 /* set up the sysfs linkage to our parent device */ 389 /* set up the sysfs linkage to our parent device */
390 sis5595_adapter.dev.parent = &dev->dev; 390 sis5595_adapter.dev.parent = &dev->dev;
391 391
392 sprintf(sis5595_adapter.name, "SMBus SIS5595 adapter at %04x", 392 snprintf(sis5595_adapter.name, sizeof(sis5595_adapter.name),
393 sis5595_base + SMB_INDEX); 393 "SMBus SIS5595 adapter at %04x", sis5595_base + SMB_INDEX);
394 err = i2c_add_adapter(&sis5595_adapter); 394 err = i2c_add_adapter(&sis5595_adapter);
395 if (err) { 395 if (err) {
396 release_region(sis5595_base + SMB_INDEX, 2); 396 release_region(sis5595_base + SMB_INDEX, 2);
diff --git a/drivers/i2c/busses/i2c-sis630.c b/drivers/i2c/busses/i2c-sis630.c
index e7c4b790da54..9c9c016ff2b5 100644
--- a/drivers/i2c/busses/i2c-sis630.c
+++ b/drivers/i2c/busses/i2c-sis630.c
@@ -487,8 +487,8 @@ static int __devinit sis630_probe(struct pci_dev *dev, const struct pci_device_i
487 /* set up the sysfs linkage to our parent device */ 487 /* set up the sysfs linkage to our parent device */
488 sis630_adapter.dev.parent = &dev->dev; 488 sis630_adapter.dev.parent = &dev->dev;
489 489
490 sprintf(sis630_adapter.name, "SMBus SIS630 adapter at %04x", 490 snprintf(sis630_adapter.name, sizeof(sis630_adapter.name),
491 acpi_base + SMB_STS); 491 "SMBus SIS630 adapter at %04x", acpi_base + SMB_STS);
492 492
493 return i2c_add_adapter(&sis630_adapter); 493 return i2c_add_adapter(&sis630_adapter);
494} 494}
diff --git a/drivers/i2c/chips/Kconfig b/drivers/i2c/chips/Kconfig
index 864ac561fdbb..59c3d23f5bdc 100644
--- a/drivers/i2c/chips/Kconfig
+++ b/drivers/i2c/chips/Kconfig
@@ -114,18 +114,6 @@ config SENSORS_PCF8591
114 These devices are hard to detect and rarely found on mainstream 114 These devices are hard to detect and rarely found on mainstream
115 hardware. If unsure, say N. 115 hardware. If unsure, say N.
116 116
117config ISP1301_OMAP
118 tristate "Philips ISP1301 with OMAP OTG"
119 depends on ARCH_OMAP_OTG
120 help
121 If you say yes here you get support for the Philips ISP1301
122 USB-On-The-Go transceiver working with the OMAP OTG controller.
123 The ISP1301 is used in products including H2 and H3 development
124 boards for Texas Instruments OMAP processors.
125
126 This driver can also be built as a module. If so, the module
127 will be called isp1301_omap.
128
129config SENSORS_MAX6875 117config SENSORS_MAX6875
130 tristate "Maxim MAX6875 Power supply supervisor" 118 tristate "Maxim MAX6875 Power supply supervisor"
131 depends on EXPERIMENTAL 119 depends on EXPERIMENTAL
diff --git a/drivers/i2c/chips/Makefile b/drivers/i2c/chips/Makefile
index 8b95f41a5001..83accaaf8164 100644
--- a/drivers/i2c/chips/Makefile
+++ b/drivers/i2c/chips/Makefile
@@ -18,7 +18,6 @@ obj-$(CONFIG_SENSORS_PCA9539) += pca9539.o
18obj-$(CONFIG_SENSORS_PCF8574) += pcf8574.o 18obj-$(CONFIG_SENSORS_PCF8574) += pcf8574.o
19obj-$(CONFIG_PCF8575) += pcf8575.o 19obj-$(CONFIG_PCF8575) += pcf8575.o
20obj-$(CONFIG_SENSORS_PCF8591) += pcf8591.o 20obj-$(CONFIG_SENSORS_PCF8591) += pcf8591.o
21obj-$(CONFIG_ISP1301_OMAP) += isp1301_omap.o
22obj-$(CONFIG_SENSORS_TSL2550) += tsl2550.o 21obj-$(CONFIG_SENSORS_TSL2550) += tsl2550.o
23obj-$(CONFIG_MCU_MPC8349EMITX) += mcu_mpc8349emitx.o 22obj-$(CONFIG_MCU_MPC8349EMITX) += mcu_mpc8349emitx.o
24 23
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
index c6a63f46bc15..b1c9abe24c7b 100644
--- a/drivers/i2c/i2c-core.c
+++ b/drivers/i2c/i2c-core.c
@@ -459,7 +459,7 @@ static int i2c_register_adapter(struct i2c_adapter *adap)
459 pr_debug("I2C adapter driver [%s] forgot to specify " 459 pr_debug("I2C adapter driver [%s] forgot to specify "
460 "physical device\n", adap->name); 460 "physical device\n", adap->name);
461 } 461 }
462 sprintf(adap->dev.bus_id, "i2c-%d", adap->nr); 462 dev_set_name(&adap->dev, "i2c-%d", adap->nr);
463 adap->dev.release = &i2c_adapter_dev_release; 463 adap->dev.release = &i2c_adapter_dev_release;
464 adap->dev.class = &i2c_adapter_class; 464 adap->dev.class = &i2c_adapter_class;
465 res = device_register(&adap->dev); 465 res = device_register(&adap->dev);
@@ -845,8 +845,8 @@ int i2c_attach_client(struct i2c_client *client)
845 } else 845 } else
846 client->dev.release = i2c_client_dev_release; 846 client->dev.release = i2c_client_dev_release;
847 847
848 snprintf(&client->dev.bus_id[0], sizeof(client->dev.bus_id), 848 dev_set_name(&client->dev, "%d-%04x", i2c_adapter_id(adapter),
849 "%d-%04x", i2c_adapter_id(adapter), client->addr); 849 client->addr);
850 res = device_register(&client->dev); 850 res = device_register(&client->dev);
851 if (res) 851 if (res)
852 goto out_err; 852 goto out_err;
@@ -856,7 +856,7 @@ int i2c_attach_client(struct i2c_client *client)
856 mutex_unlock(&adapter->clist_lock); 856 mutex_unlock(&adapter->clist_lock);
857 857
858 dev_dbg(&adapter->dev, "client [%s] registered with bus id %s\n", 858 dev_dbg(&adapter->dev, "client [%s] registered with bus id %s\n",
859 client->name, client->dev.bus_id); 859 client->name, dev_name(&client->dev));
860 860
861 if (adapter->client_register) { 861 if (adapter->client_register) {
862 if (adapter->client_register(client)) { 862 if (adapter->client_register(client)) {
diff --git a/drivers/ieee1394/csr.c b/drivers/ieee1394/csr.c
index c90be4070e40..31400c8ae051 100644
--- a/drivers/ieee1394/csr.c
+++ b/drivers/ieee1394/csr.c
@@ -68,22 +68,22 @@ static struct hpsb_highlevel csr_highlevel = {
68 .host_reset = host_reset, 68 .host_reset = host_reset,
69}; 69};
70 70
71static struct hpsb_address_ops map_ops = { 71const static struct hpsb_address_ops map_ops = {
72 .read = read_maps, 72 .read = read_maps,
73}; 73};
74 74
75static struct hpsb_address_ops fcp_ops = { 75const static struct hpsb_address_ops fcp_ops = {
76 .write = write_fcp, 76 .write = write_fcp,
77}; 77};
78 78
79static struct hpsb_address_ops reg_ops = { 79const static struct hpsb_address_ops reg_ops = {
80 .read = read_regs, 80 .read = read_regs,
81 .write = write_regs, 81 .write = write_regs,
82 .lock = lock_regs, 82 .lock = lock_regs,
83 .lock64 = lock64_regs, 83 .lock64 = lock64_regs,
84}; 84};
85 85
86static struct hpsb_address_ops config_rom_ops = { 86const static struct hpsb_address_ops config_rom_ops = {
87 .read = read_config_rom, 87 .read = read_config_rom,
88}; 88};
89 89
@@ -217,7 +217,7 @@ static void add_host(struct hpsb_host *host)
217 217
218 host->csr.generation = 2; 218 host->csr.generation = 2;
219 219
220 bus_info[1] = __constant_cpu_to_be32(0x31333934); 220 bus_info[1] = IEEE1394_BUSID_MAGIC;
221 bus_info[2] = cpu_to_be32((hpsb_disable_irm ? 0 : 1 << CSR_IRMC_SHIFT) | 221 bus_info[2] = cpu_to_be32((hpsb_disable_irm ? 0 : 1 << CSR_IRMC_SHIFT) |
222 (1 << CSR_CMC_SHIFT) | 222 (1 << CSR_CMC_SHIFT) |
223 (1 << CSR_ISC_SHIFT) | 223 (1 << CSR_ISC_SHIFT) |
@@ -250,7 +250,7 @@ static void remove_host(struct hpsb_host *host)
250{ 250{
251 quadlet_t bus_info[CSR_BUS_INFO_SIZE]; 251 quadlet_t bus_info[CSR_BUS_INFO_SIZE];
252 252
253 bus_info[1] = __constant_cpu_to_be32(0x31333934); 253 bus_info[1] = IEEE1394_BUSID_MAGIC;
254 bus_info[2] = cpu_to_be32((0 << CSR_IRMC_SHIFT) | 254 bus_info[2] = cpu_to_be32((0 << CSR_IRMC_SHIFT) |
255 (0 << CSR_CMC_SHIFT) | 255 (0 << CSR_CMC_SHIFT) |
256 (0 << CSR_ISC_SHIFT) | 256 (0 << CSR_ISC_SHIFT) |
diff --git a/drivers/ieee1394/csr.h b/drivers/ieee1394/csr.h
index f11546550d84..90fb3f2192c3 100644
--- a/drivers/ieee1394/csr.h
+++ b/drivers/ieee1394/csr.h
@@ -50,11 +50,11 @@
50#define CSR_MAX_ROM_SHIFT 8 50#define CSR_MAX_ROM_SHIFT 8
51#define CSR_GENERATION_SHIFT 4 51#define CSR_GENERATION_SHIFT 4
52 52
53#define CSR_SET_BUS_INFO_GENERATION(csr, gen) \ 53static inline void csr_set_bus_info_generation(struct csr1212_csr *csr, u8 gen)
54 ((csr)->bus_info_data[2] = \ 54{
55 cpu_to_be32((be32_to_cpu((csr)->bus_info_data[2]) & \ 55 csr->bus_info_data[2] &= ~cpu_to_be32(0xf << CSR_GENERATION_SHIFT);
56 ~(0xf << CSR_GENERATION_SHIFT)) | \ 56 csr->bus_info_data[2] |= cpu_to_be32((u32)gen << CSR_GENERATION_SHIFT);
57 (gen) << CSR_GENERATION_SHIFT)) 57}
58 58
59struct csr_control { 59struct csr_control {
60 spinlock_t lock; 60 spinlock_t lock;
diff --git a/drivers/ieee1394/csr1212.c b/drivers/ieee1394/csr1212.c
index 5e38a68b8af2..a6dfeb0b3372 100644
--- a/drivers/ieee1394/csr1212.c
+++ b/drivers/ieee1394/csr1212.c
@@ -1077,15 +1077,10 @@ static int csr1212_parse_bus_info_block(struct csr1212_csr *csr)
1077 int i; 1077 int i;
1078 int ret; 1078 int ret;
1079 1079
1080 /* IEEE 1212 says that the entire bus info block should be readable in
1081 * a single transaction regardless of the max_rom value.
1082 * Unfortunately, many IEEE 1394 devices do not abide by that, so the
1083 * bus info block will be read 1 quadlet at a time. The rest of the
1084 * ConfigROM will be read according to the max_rom field. */
1085 for (i = 0; i < csr->bus_info_len; i += sizeof(u32)) { 1080 for (i = 0; i < csr->bus_info_len; i += sizeof(u32)) {
1086 ret = csr->ops->bus_read(csr, CSR1212_CONFIG_ROM_SPACE_BASE + i, 1081 ret = csr->ops->bus_read(csr, CSR1212_CONFIG_ROM_SPACE_BASE + i,
1087 sizeof(u32), &csr->cache_head->data[bytes_to_quads(i)], 1082 &csr->cache_head->data[bytes_to_quads(i)],
1088 csr->private); 1083 csr->private);
1089 if (ret != CSR1212_SUCCESS) 1084 if (ret != CSR1212_SUCCESS)
1090 return ret; 1085 return ret;
1091 1086
@@ -1104,8 +1099,8 @@ static int csr1212_parse_bus_info_block(struct csr1212_csr *csr)
1104 * a time. */ 1099 * a time. */
1105 for (i = csr->bus_info_len; i <= csr->crc_len; i += sizeof(u32)) { 1100 for (i = csr->bus_info_len; i <= csr->crc_len; i += sizeof(u32)) {
1106 ret = csr->ops->bus_read(csr, CSR1212_CONFIG_ROM_SPACE_BASE + i, 1101 ret = csr->ops->bus_read(csr, CSR1212_CONFIG_ROM_SPACE_BASE + i,
1107 sizeof(u32), &csr->cache_head->data[bytes_to_quads(i)], 1102 &csr->cache_head->data[bytes_to_quads(i)],
1108 csr->private); 1103 csr->private);
1109 if (ret != CSR1212_SUCCESS) 1104 if (ret != CSR1212_SUCCESS)
1110 return ret; 1105 return ret;
1111 } 1106 }
@@ -1289,7 +1284,7 @@ csr1212_read_keyval(struct csr1212_csr *csr, struct csr1212_keyval *kv)
1289 1284
1290 if (csr->ops->bus_read(csr, 1285 if (csr->ops->bus_read(csr,
1291 CSR1212_REGISTER_SPACE_BASE + kv->offset, 1286 CSR1212_REGISTER_SPACE_BASE + kv->offset,
1292 sizeof(u32), &q, csr->private)) 1287 &q, csr->private))
1293 return -EIO; 1288 return -EIO;
1294 1289
1295 kv->value.leaf.len = be32_to_cpu(q) >> 16; 1290 kv->value.leaf.len = be32_to_cpu(q) >> 16;
@@ -1372,17 +1367,8 @@ csr1212_read_keyval(struct csr1212_csr *csr, struct csr1212_keyval *kv)
1372 addr = (CSR1212_CSR_ARCH_REG_SPACE_BASE + cache->offset + 1367 addr = (CSR1212_CSR_ARCH_REG_SPACE_BASE + cache->offset +
1373 cr->offset_end) & ~(csr->max_rom - 1); 1368 cr->offset_end) & ~(csr->max_rom - 1);
1374 1369
1375 if (csr->ops->bus_read(csr, addr, csr->max_rom, cache_ptr, 1370 if (csr->ops->bus_read(csr, addr, cache_ptr, csr->private))
1376 csr->private)) { 1371 return -EIO;
1377 if (csr->max_rom == 4)
1378 /* We've got problems! */
1379 return -EIO;
1380
1381 /* Apperently the max_rom value was a lie, set it to
1382 * do quadlet reads and try again. */
1383 csr->max_rom = 4;
1384 continue;
1385 }
1386 1372
1387 cr->offset_end += csr->max_rom - (cr->offset_end & 1373 cr->offset_end += csr->max_rom - (cr->offset_end &
1388 (csr->max_rom - 1)); 1374 (csr->max_rom - 1));
@@ -1433,7 +1419,6 @@ csr1212_get_keyval(struct csr1212_csr *csr, struct csr1212_keyval *kv)
1433 1419
1434int csr1212_parse_csr(struct csr1212_csr *csr) 1420int csr1212_parse_csr(struct csr1212_csr *csr)
1435{ 1421{
1436 static const int mr_map[] = { 4, 64, 1024, 0 };
1437 struct csr1212_dentry *dentry; 1422 struct csr1212_dentry *dentry;
1438 int ret; 1423 int ret;
1439 1424
@@ -1443,15 +1428,13 @@ int csr1212_parse_csr(struct csr1212_csr *csr)
1443 if (ret != CSR1212_SUCCESS) 1428 if (ret != CSR1212_SUCCESS)
1444 return ret; 1429 return ret;
1445 1430
1446 if (!csr->ops->get_max_rom) { 1431 /*
1447 csr->max_rom = mr_map[0]; /* default value */ 1432 * There has been a buggy firmware with bus_info_block.max_rom > 0
1448 } else { 1433 * spotted which actually only supported quadlet read requests to the
1449 int i = csr->ops->get_max_rom(csr->bus_info_data, 1434 * config ROM. Therefore read everything quadlet by quadlet regardless
1450 csr->private); 1435 * of what the bus info block says.
1451 if (i & ~0x3) 1436 */
1452 return -EINVAL; 1437 csr->max_rom = 4;
1453 csr->max_rom = mr_map[i];
1454 }
1455 1438
1456 csr->cache_head->layout_head = csr->root_kv; 1439 csr->cache_head->layout_head = csr->root_kv;
1457 csr->cache_head->layout_tail = csr->root_kv; 1440 csr->cache_head->layout_tail = csr->root_kv;
diff --git a/drivers/ieee1394/csr1212.h b/drivers/ieee1394/csr1212.h
index 043039fc63ec..a892d922dbc9 100644
--- a/drivers/ieee1394/csr1212.h
+++ b/drivers/ieee1394/csr1212.h
@@ -181,7 +181,7 @@ struct csr1212_csr_rom_cache {
181struct csr1212_csr { 181struct csr1212_csr {
182 size_t bus_info_len; /* bus info block length in bytes */ 182 size_t bus_info_len; /* bus info block length in bytes */
183 size_t crc_len; /* crc length in bytes */ 183 size_t crc_len; /* crc length in bytes */
184 u32 *bus_info_data; /* bus info data incl bus name and EUI */ 184 __be32 *bus_info_data; /* bus info data incl bus name and EUI */
185 185
186 void *private; /* private, bus specific data */ 186 void *private; /* private, bus specific data */
187 struct csr1212_bus_ops *ops; 187 struct csr1212_bus_ops *ops;
@@ -200,7 +200,7 @@ struct csr1212_bus_ops {
200 * entries located in the Units Space. Must return 0 on success 200 * entries located in the Units Space. Must return 0 on success
201 * anything else indicates an error. */ 201 * anything else indicates an error. */
202 int (*bus_read) (struct csr1212_csr *csr, u64 addr, 202 int (*bus_read) (struct csr1212_csr *csr, u64 addr,
203 u16 length, void *buffer, void *private); 203 void *buffer, void *private);
204 204
205 /* This function is used by csr1212 to allocate a region in units space 205 /* This function is used by csr1212 to allocate a region in units space
206 * in the event that Config ROM entries don't all fit in the predefined 206 * in the event that Config ROM entries don't all fit in the predefined
@@ -211,11 +211,6 @@ struct csr1212_bus_ops {
211 /* This function is used by csr1212 to release a region in units space 211 /* This function is used by csr1212 to release a region in units space
212 * that is no longer needed. */ 212 * that is no longer needed. */
213 void (*release_addr) (u64 addr, void *private); 213 void (*release_addr) (u64 addr, void *private);
214
215 /* This function is used by csr1212 to determine the max read request
216 * supported by a remote node when reading the ConfigROM space. Must
217 * return 0, 1, or 2 per IEEE 1212. */
218 int (*get_max_rom) (u32 *bus_info, void *private);
219}; 214};
220 215
221 216
diff --git a/drivers/ieee1394/dv1394-private.h b/drivers/ieee1394/dv1394-private.h
index 7d1d2845b420..18b92cbf4a9f 100644
--- a/drivers/ieee1394/dv1394-private.h
+++ b/drivers/ieee1394/dv1394-private.h
@@ -77,11 +77,11 @@ static inline void fill_cip_header(struct CIP_header *cip,
77 See the Texas Instruments OHCI 1394 chipset documentation. 77 See the Texas Instruments OHCI 1394 chipset documentation.
78*/ 78*/
79 79
80struct output_more_immediate { u32 q[8]; }; 80struct output_more_immediate { __le32 q[8]; };
81struct output_more { u32 q[4]; }; 81struct output_more { __le32 q[4]; };
82struct output_last { u32 q[4]; }; 82struct output_last { __le32 q[4]; };
83struct input_more { u32 q[4]; }; 83struct input_more { __le32 q[4]; };
84struct input_last { u32 q[4]; }; 84struct input_last { __le32 q[4]; };
85 85
86/* outputs */ 86/* outputs */
87 87
@@ -92,9 +92,9 @@ static inline void fill_output_more_immediate(struct output_more_immediate *omi,
92 unsigned int payload_size) 92 unsigned int payload_size)
93{ 93{
94 omi->q[0] = cpu_to_le32(0x02000000 | 8); /* OUTPUT_MORE_IMMEDIATE; 8 is the size of the IT header */ 94 omi->q[0] = cpu_to_le32(0x02000000 | 8); /* OUTPUT_MORE_IMMEDIATE; 8 is the size of the IT header */
95 omi->q[1] = 0; 95 omi->q[1] = cpu_to_le32(0);
96 omi->q[2] = 0; 96 omi->q[2] = cpu_to_le32(0);
97 omi->q[3] = 0; 97 omi->q[3] = cpu_to_le32(0);
98 98
99 /* IT packet header */ 99 /* IT packet header */
100 omi->q[4] = cpu_to_le32( (0x0 << 16) /* IEEE1394_SPEED_100 */ 100 omi->q[4] = cpu_to_le32( (0x0 << 16) /* IEEE1394_SPEED_100 */
@@ -106,8 +106,8 @@ static inline void fill_output_more_immediate(struct output_more_immediate *omi,
106 /* reserved field; mimic behavior of my Sony DSR-40 */ 106 /* reserved field; mimic behavior of my Sony DSR-40 */
107 omi->q[5] = cpu_to_le32((payload_size << 16) | (0x7F << 8) | 0xA0); 107 omi->q[5] = cpu_to_le32((payload_size << 16) | (0x7F << 8) | 0xA0);
108 108
109 omi->q[6] = 0; 109 omi->q[6] = cpu_to_le32(0);
110 omi->q[7] = 0; 110 omi->q[7] = cpu_to_le32(0);
111} 111}
112 112
113static inline void fill_output_more(struct output_more *om, 113static inline void fill_output_more(struct output_more *om,
@@ -116,8 +116,8 @@ static inline void fill_output_more(struct output_more *om,
116{ 116{
117 om->q[0] = cpu_to_le32(data_size); 117 om->q[0] = cpu_to_le32(data_size);
118 om->q[1] = cpu_to_le32(data_phys_addr); 118 om->q[1] = cpu_to_le32(data_phys_addr);
119 om->q[2] = 0; 119 om->q[2] = cpu_to_le32(0);
120 om->q[3] = 0; 120 om->q[3] = cpu_to_le32(0);
121} 121}
122 122
123static inline void fill_output_last(struct output_last *ol, 123static inline void fill_output_last(struct output_last *ol,
@@ -140,8 +140,8 @@ static inline void fill_output_last(struct output_last *ol,
140 140
141 ol->q[0] = cpu_to_le32(temp); 141 ol->q[0] = cpu_to_le32(temp);
142 ol->q[1] = cpu_to_le32(data_phys_addr); 142 ol->q[1] = cpu_to_le32(data_phys_addr);
143 ol->q[2] = 0; 143 ol->q[2] = cpu_to_le32(0);
144 ol->q[3] = 0; 144 ol->q[3] = cpu_to_le32(0);
145} 145}
146 146
147/* inputs */ 147/* inputs */
@@ -161,8 +161,8 @@ static inline void fill_input_more(struct input_more *im,
161 161
162 im->q[0] = cpu_to_le32(temp); 162 im->q[0] = cpu_to_le32(temp);
163 im->q[1] = cpu_to_le32(data_phys_addr); 163 im->q[1] = cpu_to_le32(data_phys_addr);
164 im->q[2] = 0; /* branchAddress and Z not use in packet-per-buffer mode */ 164 im->q[2] = cpu_to_le32(0); /* branchAddress and Z not use in packet-per-buffer mode */
165 im->q[3] = 0; /* xferStatus & resCount, resCount must be initialize to data_size */ 165 im->q[3] = cpu_to_le32(0); /* xferStatus & resCount, resCount must be initialize to data_size */
166} 166}
167 167
168static inline void fill_input_last(struct input_last *il, 168static inline void fill_input_last(struct input_last *il,
@@ -331,7 +331,7 @@ struct frame {
331 331
332 /* points to status/timestamp field of first DMA packet */ 332 /* points to status/timestamp field of first DMA packet */
333 /* (we'll check it later to monitor timestamp accuracy) */ 333 /* (we'll check it later to monitor timestamp accuracy) */
334 u32 *frame_begin_timestamp; 334 __le32 *frame_begin_timestamp;
335 335
336 /* the timestamp we assigned to the first packet in the frame */ 336 /* the timestamp we assigned to the first packet in the frame */
337 u32 assigned_timestamp; 337 u32 assigned_timestamp;
@@ -348,15 +348,15 @@ struct frame {
348 that can cause interrupts. We'll check these from the 348 that can cause interrupts. We'll check these from the
349 interrupt handler. 349 interrupt handler.
350 */ 350 */
351 u32 *mid_frame_timestamp; 351 __le32 *mid_frame_timestamp;
352 u32 *frame_end_timestamp; 352 __le32 *frame_end_timestamp;
353 353
354 /* branch address field of final packet. This is effectively 354 /* branch address field of final packet. This is effectively
355 the "tail" in the chain of DMA descriptor blocks. 355 the "tail" in the chain of DMA descriptor blocks.
356 We will fill it with the address of the first DMA descriptor 356 We will fill it with the address of the first DMA descriptor
357 block in the subsequent frame, once it is ready. 357 block in the subsequent frame, once it is ready.
358 */ 358 */
359 u32 *frame_end_branch; 359 __le32 *frame_end_branch;
360 360
361 /* the number of descriptors in the first descriptor block 361 /* the number of descriptors in the first descriptor block
362 of the frame. Needed to start DMA */ 362 of the frame. Needed to start DMA */
@@ -365,10 +365,10 @@ struct frame {
365 365
366 366
367struct packet { 367struct packet {
368 u16 timestamp; 368 __le16 timestamp;
369 u16 invalid; 369 u16 invalid;
370 u16 iso_header; 370 u16 iso_header;
371 u16 data_length; 371 __le16 data_length;
372 u32 cip_h1; 372 u32 cip_h1;
373 u32 cip_h2; 373 u32 cip_h2;
374 unsigned char data[480]; 374 unsigned char data[480];
diff --git a/drivers/ieee1394/dv1394.c b/drivers/ieee1394/dv1394.c
index c19f23267157..a329e6bd5d2d 100644
--- a/drivers/ieee1394/dv1394.c
+++ b/drivers/ieee1394/dv1394.c
@@ -265,7 +265,7 @@ static void frame_prepare(struct video_card *video, unsigned int this_frame)
265 /* these flags denote packets that need special attention */ 265 /* these flags denote packets that need special attention */
266 int empty_packet, first_packet, last_packet, mid_packet; 266 int empty_packet, first_packet, last_packet, mid_packet;
267 267
268 u32 *branch_address, *last_branch_address = NULL; 268 __le32 *branch_address, *last_branch_address = NULL;
269 unsigned long data_p; 269 unsigned long data_p;
270 int first_packet_empty = 0; 270 int first_packet_empty = 0;
271 u32 cycleTimer, ct_sec, ct_cyc, ct_off; 271 u32 cycleTimer, ct_sec, ct_cyc, ct_off;
@@ -848,7 +848,7 @@ static void receive_packets(struct video_card *video)
848 dma_addr_t block_dma = 0; 848 dma_addr_t block_dma = 0;
849 struct packet *data = NULL; 849 struct packet *data = NULL;
850 dma_addr_t data_dma = 0; 850 dma_addr_t data_dma = 0;
851 u32 *last_branch_address = NULL; 851 __le32 *last_branch_address = NULL;
852 unsigned long irq_flags; 852 unsigned long irq_flags;
853 int want_interrupt = 0; 853 int want_interrupt = 0;
854 struct frame *f = NULL; 854 struct frame *f = NULL;
@@ -2110,17 +2110,17 @@ static void ir_tasklet_func(unsigned long data)
2110 f = video->frames[next_i / MAX_PACKETS]; 2110 f = video->frames[next_i / MAX_PACKETS];
2111 next = &(f->descriptor_pool[next_i % MAX_PACKETS]); 2111 next = &(f->descriptor_pool[next_i % MAX_PACKETS]);
2112 next_dma = ((unsigned long) block - (unsigned long) f->descriptor_pool) + f->descriptor_pool_dma; 2112 next_dma = ((unsigned long) block - (unsigned long) f->descriptor_pool) + f->descriptor_pool_dma;
2113 next->u.in.il.q[0] |= 3 << 20; /* enable interrupt */ 2113 next->u.in.il.q[0] |= cpu_to_le32(3 << 20); /* enable interrupt */
2114 next->u.in.il.q[2] = 0; /* disable branch */ 2114 next->u.in.il.q[2] = cpu_to_le32(0); /* disable branch */
2115 2115
2116 /* link previous to next */ 2116 /* link previous to next */
2117 prev_i = (next_i == 0) ? (MAX_PACKETS * video->n_frames - 1) : (next_i - 1); 2117 prev_i = (next_i == 0) ? (MAX_PACKETS * video->n_frames - 1) : (next_i - 1);
2118 f = video->frames[prev_i / MAX_PACKETS]; 2118 f = video->frames[prev_i / MAX_PACKETS];
2119 prev = &(f->descriptor_pool[prev_i % MAX_PACKETS]); 2119 prev = &(f->descriptor_pool[prev_i % MAX_PACKETS]);
2120 if (prev_i % (MAX_PACKETS/2)) { 2120 if (prev_i % (MAX_PACKETS/2)) {
2121 prev->u.in.il.q[0] &= ~(3 << 20); /* no interrupt */ 2121 prev->u.in.il.q[0] &= ~cpu_to_le32(3 << 20); /* no interrupt */
2122 } else { 2122 } else {
2123 prev->u.in.il.q[0] |= 3 << 20; /* enable interrupt */ 2123 prev->u.in.il.q[0] |= cpu_to_le32(3 << 20); /* enable interrupt */
2124 } 2124 }
2125 prev->u.in.il.q[2] = cpu_to_le32(next_dma | 1); /* set Z=1 */ 2125 prev->u.in.il.q[2] = cpu_to_le32(next_dma | 1); /* set Z=1 */
2126 wmb(); 2126 wmb();
diff --git a/drivers/ieee1394/eth1394.c b/drivers/ieee1394/eth1394.c
index 20128692b339..a074bfd5f825 100644
--- a/drivers/ieee1394/eth1394.c
+++ b/drivers/ieee1394/eth1394.c
@@ -92,7 +92,7 @@ struct partial_datagram {
92 struct list_head list; 92 struct list_head list;
93 u16 dgl; 93 u16 dgl;
94 u16 dg_size; 94 u16 dg_size;
95 u16 ether_type; 95 __be16 ether_type;
96 struct sk_buff *skb; 96 struct sk_buff *skb;
97 char *pbuf; 97 char *pbuf;
98 struct list_head frag_info; 98 struct list_head frag_info;
@@ -181,7 +181,7 @@ static void ether1394_remove_host(struct hpsb_host *host);
181static void ether1394_host_reset(struct hpsb_host *host); 181static void ether1394_host_reset(struct hpsb_host *host);
182 182
183/* Function for incoming 1394 packets */ 183/* Function for incoming 1394 packets */
184static struct hpsb_address_ops addr_ops = { 184const static struct hpsb_address_ops addr_ops = {
185 .write = ether1394_write, 185 .write = ether1394_write,
186}; 186};
187 187
@@ -767,7 +767,7 @@ static int ether1394_header_parse(const struct sk_buff *skb,
767static int ether1394_header_cache(const struct neighbour *neigh, 767static int ether1394_header_cache(const struct neighbour *neigh,
768 struct hh_cache *hh) 768 struct hh_cache *hh)
769{ 769{
770 unsigned short type = hh->hh_type; 770 __be16 type = hh->hh_type;
771 struct net_device *dev = neigh->dev; 771 struct net_device *dev = neigh->dev;
772 struct eth1394hdr *eth = 772 struct eth1394hdr *eth =
773 (struct eth1394hdr *)((u8 *)hh->hh_data + 16 - ETH1394_HLEN); 773 (struct eth1394hdr *)((u8 *)hh->hh_data + 16 - ETH1394_HLEN);
@@ -795,7 +795,7 @@ static void ether1394_header_cache_update(struct hh_cache *hh,
795 ******************************************/ 795 ******************************************/
796 796
797/* Copied from net/ethernet/eth.c */ 797/* Copied from net/ethernet/eth.c */
798static u16 ether1394_type_trans(struct sk_buff *skb, struct net_device *dev) 798static __be16 ether1394_type_trans(struct sk_buff *skb, struct net_device *dev)
799{ 799{
800 struct eth1394hdr *eth; 800 struct eth1394hdr *eth;
801 unsigned char *rawp; 801 unsigned char *rawp;
@@ -829,17 +829,17 @@ static u16 ether1394_type_trans(struct sk_buff *skb, struct net_device *dev)
829 829
830/* Parse an encapsulated IP1394 header into an ethernet frame packet. 830/* Parse an encapsulated IP1394 header into an ethernet frame packet.
831 * We also perform ARP translation here, if need be. */ 831 * We also perform ARP translation here, if need be. */
832static u16 ether1394_parse_encap(struct sk_buff *skb, struct net_device *dev, 832static __be16 ether1394_parse_encap(struct sk_buff *skb, struct net_device *dev,
833 nodeid_t srcid, nodeid_t destid, 833 nodeid_t srcid, nodeid_t destid,
834 u16 ether_type) 834 __be16 ether_type)
835{ 835{
836 struct eth1394_priv *priv = netdev_priv(dev); 836 struct eth1394_priv *priv = netdev_priv(dev);
837 u64 dest_hw; 837 __be64 dest_hw;
838 unsigned short ret = 0; 838 __be16 ret = 0;
839 839
840 /* Setup our hw addresses. We use these to build the ethernet header. */ 840 /* Setup our hw addresses. We use these to build the ethernet header. */
841 if (destid == (LOCAL_BUS | ALL_NODES)) 841 if (destid == (LOCAL_BUS | ALL_NODES))
842 dest_hw = ~0ULL; /* broadcast */ 842 dest_hw = ~cpu_to_be64(0); /* broadcast */
843 else 843 else
844 dest_hw = cpu_to_be64((u64)priv->host->csr.guid_hi << 32 | 844 dest_hw = cpu_to_be64((u64)priv->host->csr.guid_hi << 32 |
845 priv->host->csr.guid_lo); 845 priv->host->csr.guid_lo);
@@ -873,7 +873,7 @@ static u16 ether1394_parse_encap(struct sk_buff *skb, struct net_device *dev,
873 node = eth1394_find_node_guid(&priv->ip_node_list, 873 node = eth1394_find_node_guid(&priv->ip_node_list,
874 be64_to_cpu(guid)); 874 be64_to_cpu(guid));
875 if (!node) 875 if (!node)
876 return 0; 876 return cpu_to_be16(0);
877 877
878 node_info = 878 node_info =
879 (struct eth1394_node_info *)node->ud->device.driver_data; 879 (struct eth1394_node_info *)node->ud->device.driver_data;
@@ -1063,7 +1063,7 @@ static int ether1394_data_handler(struct net_device *dev, int srcid, int destid,
1063 unsigned long flags; 1063 unsigned long flags;
1064 struct eth1394_priv *priv = netdev_priv(dev); 1064 struct eth1394_priv *priv = netdev_priv(dev);
1065 union eth1394_hdr *hdr = (union eth1394_hdr *)buf; 1065 union eth1394_hdr *hdr = (union eth1394_hdr *)buf;
1066 u16 ether_type = 0; /* initialized to clear warning */ 1066 __be16 ether_type = cpu_to_be16(0); /* initialized to clear warning */
1067 int hdr_len; 1067 int hdr_len;
1068 struct unit_directory *ud = priv->ud_list[NODEID_TO_NODE(srcid)]; 1068 struct unit_directory *ud = priv->ud_list[NODEID_TO_NODE(srcid)];
1069 struct eth1394_node_info *node_info; 1069 struct eth1394_node_info *node_info;
@@ -1259,7 +1259,7 @@ static int ether1394_write(struct hpsb_host *host, int srcid, int destid,
1259 1259
1260static void ether1394_iso(struct hpsb_iso *iso) 1260static void ether1394_iso(struct hpsb_iso *iso)
1261{ 1261{
1262 quadlet_t *data; 1262 __be32 *data;
1263 char *buf; 1263 char *buf;
1264 struct eth1394_host_info *hi; 1264 struct eth1394_host_info *hi;
1265 struct net_device *dev; 1265 struct net_device *dev;
@@ -1283,7 +1283,7 @@ static void ether1394_iso(struct hpsb_iso *iso)
1283 for (i = 0; i < nready; i++) { 1283 for (i = 0; i < nready; i++) {
1284 struct hpsb_iso_packet_info *info = 1284 struct hpsb_iso_packet_info *info =
1285 &iso->infos[(iso->first_packet + i) % iso->buf_packets]; 1285 &iso->infos[(iso->first_packet + i) % iso->buf_packets];
1286 data = (quadlet_t *)(iso->data_buf.kvirt + info->offset); 1286 data = (__be32 *)(iso->data_buf.kvirt + info->offset);
1287 1287
1288 /* skip over GASP header */ 1288 /* skip over GASP header */
1289 buf = (char *)data + 8; 1289 buf = (char *)data + 8;
@@ -1614,7 +1614,7 @@ static int ether1394_tx(struct sk_buff *skb, struct net_device *dev)
1614 if (max_payload < dg_size + hdr_type_len[ETH1394_HDR_LF_UF]) 1614 if (max_payload < dg_size + hdr_type_len[ETH1394_HDR_LF_UF])
1615 priv->bc_dgl++; 1615 priv->bc_dgl++;
1616 } else { 1616 } else {
1617 __be64 guid = get_unaligned((u64 *)hdr_buf.h_dest); 1617 __be64 guid = get_unaligned((__be64 *)hdr_buf.h_dest);
1618 1618
1619 node = eth1394_find_node_guid(&priv->ip_node_list, 1619 node = eth1394_find_node_guid(&priv->ip_node_list,
1620 be64_to_cpu(guid)); 1620 be64_to_cpu(guid));
diff --git a/drivers/ieee1394/eth1394.h b/drivers/ieee1394/eth1394.h
index 4f3e2dd46f00..e1b5ea80f623 100644
--- a/drivers/ieee1394/eth1394.h
+++ b/drivers/ieee1394/eth1394.h
@@ -82,7 +82,7 @@ struct eth1394_priv {
82 82
83struct eth1394hdr { 83struct eth1394hdr {
84 unsigned char h_dest[ETH1394_ALEN]; /* destination eth1394 addr */ 84 unsigned char h_dest[ETH1394_ALEN]; /* destination eth1394 addr */
85 unsigned short h_proto; /* packet type ID field */ 85 __be16 h_proto; /* packet type ID field */
86} __attribute__((packed)); 86} __attribute__((packed));
87 87
88static inline struct eth1394hdr *eth1394_hdr(const struct sk_buff *skb) 88static inline struct eth1394hdr *eth1394_hdr(const struct sk_buff *skb)
@@ -99,13 +99,13 @@ typedef enum {ETH1394_GASP, ETH1394_WRREQ} eth1394_tx_type;
99struct eth1394_uf_hdr { 99struct eth1394_uf_hdr {
100 u16 lf:2; 100 u16 lf:2;
101 u16 res:14; 101 u16 res:14;
102 u16 ether_type; /* Ethernet packet type */ 102 __be16 ether_type; /* Ethernet packet type */
103} __attribute__((packed)); 103} __attribute__((packed));
104#elif defined __LITTLE_ENDIAN_BITFIELD 104#elif defined __LITTLE_ENDIAN_BITFIELD
105struct eth1394_uf_hdr { 105struct eth1394_uf_hdr {
106 u16 res:14; 106 u16 res:14;
107 u16 lf:2; 107 u16 lf:2;
108 u16 ether_type; 108 __be16 ether_type;
109} __attribute__((packed)); 109} __attribute__((packed));
110#else 110#else
111#error Unknown bit field type 111#error Unknown bit field type
@@ -117,7 +117,7 @@ struct eth1394_ff_hdr {
117 u16 lf:2; 117 u16 lf:2;
118 u16 res1:2; 118 u16 res1:2;
119 u16 dg_size:12; /* Datagram size */ 119 u16 dg_size:12; /* Datagram size */
120 u16 ether_type; /* Ethernet packet type */ 120 __be16 ether_type; /* Ethernet packet type */
121 u16 dgl; /* Datagram label */ 121 u16 dgl; /* Datagram label */
122 u16 res2; 122 u16 res2;
123} __attribute__((packed)); 123} __attribute__((packed));
@@ -126,7 +126,7 @@ struct eth1394_ff_hdr {
126 u16 dg_size:12; 126 u16 dg_size:12;
127 u16 res1:2; 127 u16 res1:2;
128 u16 lf:2; 128 u16 lf:2;
129 u16 ether_type; 129 __be16 ether_type;
130 u16 dgl; 130 u16 dgl;
131 u16 res2; 131 u16 res2;
132} __attribute__((packed)); 132} __attribute__((packed));
@@ -207,11 +207,11 @@ struct eth1394_arp {
207 u16 opcode; /* ARP Opcode */ 207 u16 opcode; /* ARP Opcode */
208 /* Above is exactly the same format as struct arphdr */ 208 /* Above is exactly the same format as struct arphdr */
209 209
210 u64 s_uniq_id; /* Sender's 64bit EUI */ 210 __be64 s_uniq_id; /* Sender's 64bit EUI */
211 u8 max_rec; /* Sender's max packet size */ 211 u8 max_rec; /* Sender's max packet size */
212 u8 sspd; /* Sender's max speed */ 212 u8 sspd; /* Sender's max speed */
213 u16 fifo_hi; /* hi 16bits of sender's FIFO addr */ 213 __be16 fifo_hi; /* hi 16bits of sender's FIFO addr */
214 u32 fifo_lo; /* lo 32bits of sender's FIFO addr */ 214 __be32 fifo_lo; /* lo 32bits of sender's FIFO addr */
215 u32 sip; /* Sender's IP Address */ 215 u32 sip; /* Sender's IP Address */
216 u32 tip; /* IP Address of requested hw addr */ 216 u32 tip; /* IP Address of requested hw addr */
217}; 217};
diff --git a/drivers/ieee1394/highlevel.c b/drivers/ieee1394/highlevel.c
index 272543a42a43..600e391c8fe7 100644
--- a/drivers/ieee1394/highlevel.c
+++ b/drivers/ieee1394/highlevel.c
@@ -320,7 +320,7 @@ void hpsb_unregister_highlevel(struct hpsb_highlevel *hl)
320 */ 320 */
321u64 hpsb_allocate_and_register_addrspace(struct hpsb_highlevel *hl, 321u64 hpsb_allocate_and_register_addrspace(struct hpsb_highlevel *hl,
322 struct hpsb_host *host, 322 struct hpsb_host *host,
323 struct hpsb_address_ops *ops, 323 const struct hpsb_address_ops *ops,
324 u64 size, u64 alignment, 324 u64 size, u64 alignment,
325 u64 start, u64 end) 325 u64 start, u64 end)
326{ 326{
@@ -407,7 +407,8 @@ u64 hpsb_allocate_and_register_addrspace(struct hpsb_highlevel *hl,
407 * are automatically deallocated together with the hpsb_highlevel @hl. 407 * are automatically deallocated together with the hpsb_highlevel @hl.
408 */ 408 */
409int hpsb_register_addrspace(struct hpsb_highlevel *hl, struct hpsb_host *host, 409int hpsb_register_addrspace(struct hpsb_highlevel *hl, struct hpsb_host *host,
410 struct hpsb_address_ops *ops, u64 start, u64 end) 410 const struct hpsb_address_ops *ops,
411 u64 start, u64 end)
411{ 412{
412 struct hpsb_address_serve *as; 413 struct hpsb_address_serve *as;
413 struct list_head *lh; 414 struct list_head *lh;
@@ -420,7 +421,7 @@ int hpsb_register_addrspace(struct hpsb_highlevel *hl, struct hpsb_host *host,
420 return 0; 421 return 0;
421 } 422 }
422 423
423 as = kmalloc(sizeof(*as), GFP_ATOMIC); 424 as = kmalloc(sizeof(*as), GFP_KERNEL);
424 if (!as) 425 if (!as)
425 return 0; 426 return 0;
426 427
@@ -477,7 +478,7 @@ int hpsb_unregister_addrspace(struct hpsb_highlevel *hl, struct hpsb_host *host,
477 return retval; 478 return retval;
478} 479}
479 480
480static struct hpsb_address_ops dummy_ops; 481const static struct hpsb_address_ops dummy_ops;
481 482
482/* dummy address spaces as lower and upper bounds of the host's a.s. list */ 483/* dummy address spaces as lower and upper bounds of the host's a.s. list */
483static void init_hpsb_highlevel(struct hpsb_host *host) 484static void init_hpsb_highlevel(struct hpsb_host *host)
diff --git a/drivers/ieee1394/highlevel.h b/drivers/ieee1394/highlevel.h
index bc5d0854c17e..9dba89fc60ad 100644
--- a/drivers/ieee1394/highlevel.h
+++ b/drivers/ieee1394/highlevel.h
@@ -15,7 +15,7 @@ struct hpsb_host;
15struct hpsb_address_serve { 15struct hpsb_address_serve {
16 struct list_head host_list; /* per host list */ 16 struct list_head host_list; /* per host list */
17 struct list_head hl_list; /* hpsb_highlevel list */ 17 struct list_head hl_list; /* hpsb_highlevel list */
18 struct hpsb_address_ops *op; 18 const struct hpsb_address_ops *op;
19 struct hpsb_host *host; 19 struct hpsb_host *host;
20 u64 start; /* first address handled, quadlet aligned */ 20 u64 start; /* first address handled, quadlet aligned */
21 u64 end; /* first address behind, quadlet aligned */ 21 u64 end; /* first address behind, quadlet aligned */
@@ -119,11 +119,12 @@ void hpsb_unregister_highlevel(struct hpsb_highlevel *hl);
119 119
120u64 hpsb_allocate_and_register_addrspace(struct hpsb_highlevel *hl, 120u64 hpsb_allocate_and_register_addrspace(struct hpsb_highlevel *hl,
121 struct hpsb_host *host, 121 struct hpsb_host *host,
122 struct hpsb_address_ops *ops, 122 const struct hpsb_address_ops *ops,
123 u64 size, u64 alignment, 123 u64 size, u64 alignment,
124 u64 start, u64 end); 124 u64 start, u64 end);
125int hpsb_register_addrspace(struct hpsb_highlevel *hl, struct hpsb_host *host, 125int hpsb_register_addrspace(struct hpsb_highlevel *hl, struct hpsb_host *host,
126 struct hpsb_address_ops *ops, u64 start, u64 end); 126 const struct hpsb_address_ops *ops,
127 u64 start, u64 end);
127int hpsb_unregister_addrspace(struct hpsb_highlevel *hl, struct hpsb_host *host, 128int hpsb_unregister_addrspace(struct hpsb_highlevel *hl, struct hpsb_host *host,
128 u64 start); 129 u64 start);
129 130
diff --git a/drivers/ieee1394/hosts.c b/drivers/ieee1394/hosts.c
index 237d0c9d69c6..e947d8ffac85 100644
--- a/drivers/ieee1394/hosts.c
+++ b/drivers/ieee1394/hosts.c
@@ -34,18 +34,18 @@ static void delayed_reset_bus(struct work_struct *work)
34{ 34{
35 struct hpsb_host *host = 35 struct hpsb_host *host =
36 container_of(work, struct hpsb_host, delayed_reset.work); 36 container_of(work, struct hpsb_host, delayed_reset.work);
37 int generation = host->csr.generation + 1; 37 u8 generation = host->csr.generation + 1;
38 38
39 /* The generation field rolls over to 2 rather than 0 per IEEE 39 /* The generation field rolls over to 2 rather than 0 per IEEE
40 * 1394a-2000. */ 40 * 1394a-2000. */
41 if (generation > 0xf || generation < 2) 41 if (generation > 0xf || generation < 2)
42 generation = 2; 42 generation = 2;
43 43
44 CSR_SET_BUS_INFO_GENERATION(host->csr.rom, generation); 44 csr_set_bus_info_generation(host->csr.rom, generation);
45 if (csr1212_generate_csr_image(host->csr.rom) != CSR1212_SUCCESS) { 45 if (csr1212_generate_csr_image(host->csr.rom) != CSR1212_SUCCESS) {
46 /* CSR image creation failed. 46 /* CSR image creation failed.
47 * Reset generation field and do not issue a bus reset. */ 47 * Reset generation field and do not issue a bus reset. */
48 CSR_SET_BUS_INFO_GENERATION(host->csr.rom, 48 csr_set_bus_info_generation(host->csr.rom,
49 host->csr.generation); 49 host->csr.generation);
50 return; 50 return;
51 } 51 }
diff --git a/drivers/ieee1394/hosts.h b/drivers/ieee1394/hosts.h
index dd229950acca..49c359022c54 100644
--- a/drivers/ieee1394/hosts.h
+++ b/drivers/ieee1394/hosts.h
@@ -154,7 +154,7 @@ struct hpsb_host_driver {
154 * to set the hardware ConfigROM if the hardware supports handling 154 * to set the hardware ConfigROM if the hardware supports handling
155 * reads to the ConfigROM on its own. */ 155 * reads to the ConfigROM on its own. */
156 void (*set_hw_config_rom)(struct hpsb_host *host, 156 void (*set_hw_config_rom)(struct hpsb_host *host,
157 quadlet_t *config_rom); 157 __be32 *config_rom);
158 158
159 /* This function shall implement packet transmission based on 159 /* This function shall implement packet transmission based on
160 * packet->type. It shall CRC both parts of the packet (unless 160 * packet->type. It shall CRC both parts of the packet (unless
diff --git a/drivers/ieee1394/ieee1394.h b/drivers/ieee1394/ieee1394.h
index 40492074c013..e0ae0d3d747f 100644
--- a/drivers/ieee1394/ieee1394.h
+++ b/drivers/ieee1394/ieee1394.h
@@ -121,6 +121,9 @@ extern const char *hpsb_speedto_str[];
121 121
122#include <asm/byteorder.h> 122#include <asm/byteorder.h>
123 123
124/* '1' '3' '9' '4' in ASCII */
125#define IEEE1394_BUSID_MAGIC cpu_to_be32(0x31333934)
126
124#ifdef __BIG_ENDIAN_BITFIELD 127#ifdef __BIG_ENDIAN_BITFIELD
125 128
126struct selfid { 129struct selfid {
diff --git a/drivers/ieee1394/nodemgr.c b/drivers/ieee1394/nodemgr.c
index 79ef5fd928ae..906c5a98d814 100644
--- a/drivers/ieee1394/nodemgr.c
+++ b/drivers/ieee1394/nodemgr.c
@@ -67,7 +67,7 @@ static int nodemgr_check_speed(struct nodemgr_csr_info *ci, u64 addr,
67 for (i = IEEE1394_SPEED_100; i <= old_speed; i++) { 67 for (i = IEEE1394_SPEED_100; i <= old_speed; i++) {
68 *speed = i; 68 *speed = i;
69 error = hpsb_read(ci->host, ci->nodeid, ci->generation, addr, 69 error = hpsb_read(ci->host, ci->nodeid, ci->generation, addr,
70 &q, sizeof(quadlet_t)); 70 &q, 4);
71 if (error) 71 if (error)
72 break; 72 break;
73 *buffer = q; 73 *buffer = q;
@@ -85,7 +85,7 @@ static int nodemgr_check_speed(struct nodemgr_csr_info *ci, u64 addr,
85 return error; 85 return error;
86} 86}
87 87
88static int nodemgr_bus_read(struct csr1212_csr *csr, u64 addr, u16 length, 88static int nodemgr_bus_read(struct csr1212_csr *csr, u64 addr,
89 void *buffer, void *__ci) 89 void *buffer, void *__ci)
90{ 90{
91 struct nodemgr_csr_info *ci = (struct nodemgr_csr_info*)__ci; 91 struct nodemgr_csr_info *ci = (struct nodemgr_csr_info*)__ci;
@@ -93,7 +93,7 @@ static int nodemgr_bus_read(struct csr1212_csr *csr, u64 addr, u16 length,
93 93
94 for (i = 1; ; i++) { 94 for (i = 1; ; i++) {
95 error = hpsb_read(ci->host, ci->nodeid, ci->generation, addr, 95 error = hpsb_read(ci->host, ci->nodeid, ci->generation, addr,
96 buffer, length); 96 buffer, 4);
97 if (!error) { 97 if (!error) {
98 ci->speed_unverified = 0; 98 ci->speed_unverified = 0;
99 break; 99 break;
@@ -104,7 +104,7 @@ static int nodemgr_bus_read(struct csr1212_csr *csr, u64 addr, u16 length,
104 104
105 /* The ieee1394_core guessed the node's speed capability from 105 /* The ieee1394_core guessed the node's speed capability from
106 * the self ID. Check whether a lower speed works. */ 106 * the self ID. Check whether a lower speed works. */
107 if (ci->speed_unverified && length == sizeof(quadlet_t)) { 107 if (ci->speed_unverified) {
108 error = nodemgr_check_speed(ci, addr, buffer); 108 error = nodemgr_check_speed(ci, addr, buffer);
109 if (!error) 109 if (!error)
110 break; 110 break;
@@ -115,20 +115,8 @@ static int nodemgr_bus_read(struct csr1212_csr *csr, u64 addr, u16 length,
115 return error; 115 return error;
116} 116}
117 117
118#define OUI_FREECOM_TECHNOLOGIES_GMBH 0x0001db
119
120static int nodemgr_get_max_rom(quadlet_t *bus_info_data, void *__ci)
121{
122 /* Freecom FireWire Hard Drive firmware bug */
123 if (be32_to_cpu(bus_info_data[3]) >> 8 == OUI_FREECOM_TECHNOLOGIES_GMBH)
124 return 0;
125
126 return (be32_to_cpu(bus_info_data[2]) >> 8) & 0x3;
127}
128
129static struct csr1212_bus_ops nodemgr_csr_ops = { 118static struct csr1212_bus_ops nodemgr_csr_ops = {
130 .bus_read = nodemgr_bus_read, 119 .bus_read = nodemgr_bus_read,
131 .get_max_rom = nodemgr_get_max_rom
132}; 120};
133 121
134 122
diff --git a/drivers/ieee1394/nodemgr.h b/drivers/ieee1394/nodemgr.h
index 4f287a3561ba..15ea09733e84 100644
--- a/drivers/ieee1394/nodemgr.h
+++ b/drivers/ieee1394/nodemgr.h
@@ -31,9 +31,6 @@ struct csr1212_keyval;
31struct hpsb_host; 31struct hpsb_host;
32struct ieee1394_device_id; 32struct ieee1394_device_id;
33 33
34/* '1' '3' '9' '4' in ASCII */
35#define IEEE1394_BUSID_MAGIC __constant_cpu_to_be32(0x31333934)
36
37/* This is the start of a Node entry structure. It should be a stable API 34/* This is the start of a Node entry structure. It should be a stable API
38 * for which to gather info from the Node Manager about devices attached 35 * for which to gather info from the Node Manager about devices attached
39 * to the bus. */ 36 * to the bus. */
diff --git a/drivers/ieee1394/ohci1394.c b/drivers/ieee1394/ohci1394.c
index e509e13cb7a7..65c1429e4129 100644
--- a/drivers/ieee1394/ohci1394.c
+++ b/drivers/ieee1394/ohci1394.c
@@ -2973,7 +2973,7 @@ alloc_dma_trm_ctx(struct ti_ohci *ohci, struct dma_trm_ctx *d,
2973 return 0; 2973 return 0;
2974} 2974}
2975 2975
2976static void ohci_set_hw_config_rom(struct hpsb_host *host, quadlet_t *config_rom) 2976static void ohci_set_hw_config_rom(struct hpsb_host *host, __be32 *config_rom)
2977{ 2977{
2978 struct ti_ohci *ohci = host->hostdata; 2978 struct ti_ohci *ohci = host->hostdata;
2979 2979
@@ -3199,15 +3199,16 @@ static int __devinit ohci1394_pci_probe(struct pci_dev *dev,
3199 /* Now enable LPS, which we need in order to start accessing 3199 /* Now enable LPS, which we need in order to start accessing
3200 * most of the registers. In fact, on some cards (ALI M5251), 3200 * most of the registers. In fact, on some cards (ALI M5251),
3201 * accessing registers in the SClk domain without LPS enabled 3201 * accessing registers in the SClk domain without LPS enabled
3202 * will lock up the machine. Wait 50msec to make sure we have 3202 * will lock up the machine. */
3203 * full link enabled. */
3204 reg_write(ohci, OHCI1394_HCControlSet, OHCI1394_HCControl_LPS); 3203 reg_write(ohci, OHCI1394_HCControlSet, OHCI1394_HCControl_LPS);
3205 3204
3206 /* Disable and clear interrupts */ 3205 /* Disable and clear interrupts */
3207 reg_write(ohci, OHCI1394_IntEventClear, 0xffffffff); 3206 reg_write(ohci, OHCI1394_IntEventClear, 0xffffffff);
3208 reg_write(ohci, OHCI1394_IntMaskClear, 0xffffffff); 3207 reg_write(ohci, OHCI1394_IntMaskClear, 0xffffffff);
3209 3208
3210 mdelay(50); 3209 /* Flush MMIO writes and wait to make sure we have full link enabled. */
3210 reg_read(ohci, OHCI1394_Version);
3211 msleep(50);
3211 3212
3212 /* Determine the number of available IR and IT contexts. */ 3213 /* Determine the number of available IR and IT contexts. */
3213 ohci->nb_iso_rcv_ctx = 3214 ohci->nb_iso_rcv_ctx =
@@ -3233,8 +3234,9 @@ static int __devinit ohci1394_pci_probe(struct pci_dev *dev,
3233 * we need to get to that "no event", so enough should be initialized 3234 * we need to get to that "no event", so enough should be initialized
3234 * by that point. 3235 * by that point.
3235 */ 3236 */
3236 if (request_irq(dev->irq, ohci_irq_handler, IRQF_SHARED, 3237 err = request_irq(dev->irq, ohci_irq_handler, IRQF_SHARED,
3237 OHCI1394_DRIVER_NAME, ohci)) { 3238 OHCI1394_DRIVER_NAME, ohci);
3239 if (err) {
3238 PRINT_G(KERN_ERR, "Failed to allocate interrupt %d", dev->irq); 3240 PRINT_G(KERN_ERR, "Failed to allocate interrupt %d", dev->irq);
3239 goto err; 3241 goto err;
3240 } 3242 }
@@ -3381,6 +3383,7 @@ static int ohci1394_pci_suspend(struct pci_dev *dev, pm_message_t state)
3381 ohci_devctl(ohci->host, RESET_BUS, LONG_RESET_NO_FORCE_ROOT); 3383 ohci_devctl(ohci->host, RESET_BUS, LONG_RESET_NO_FORCE_ROOT);
3382 ohci_soft_reset(ohci); 3384 ohci_soft_reset(ohci);
3383 3385
3386 free_irq(dev->irq, ohci);
3384 err = pci_save_state(dev); 3387 err = pci_save_state(dev);
3385 if (err) { 3388 if (err) {
3386 PRINT(KERN_ERR, "pci_save_state failed with %d", err); 3389 PRINT(KERN_ERR, "pci_save_state failed with %d", err);
@@ -3420,7 +3423,16 @@ static int ohci1394_pci_resume(struct pci_dev *dev)
3420 reg_write(ohci, OHCI1394_HCControlSet, OHCI1394_HCControl_LPS); 3423 reg_write(ohci, OHCI1394_HCControlSet, OHCI1394_HCControl_LPS);
3421 reg_write(ohci, OHCI1394_IntEventClear, 0xffffffff); 3424 reg_write(ohci, OHCI1394_IntEventClear, 0xffffffff);
3422 reg_write(ohci, OHCI1394_IntMaskClear, 0xffffffff); 3425 reg_write(ohci, OHCI1394_IntMaskClear, 0xffffffff);
3423 mdelay(50); 3426 reg_read(ohci, OHCI1394_Version);
3427 msleep(50);
3428
3429 err = request_irq(dev->irq, ohci_irq_handler, IRQF_SHARED,
3430 OHCI1394_DRIVER_NAME, ohci);
3431 if (err) {
3432 PRINT_G(KERN_ERR, "Failed to allocate interrupt %d", dev->irq);
3433 return err;
3434 }
3435
3424 ohci_initialize(ohci); 3436 ohci_initialize(ohci);
3425 3437
3426 hpsb_resume_host(ohci->host); 3438 hpsb_resume_host(ohci->host);
diff --git a/drivers/ieee1394/pcilynx.c b/drivers/ieee1394/pcilynx.c
index 7aee1ac97c80..dc15cadb06ef 100644
--- a/drivers/ieee1394/pcilynx.c
+++ b/drivers/ieee1394/pcilynx.c
@@ -1463,7 +1463,7 @@ static int __devinit add_card(struct pci_dev *dev,
1463 1463
1464 /* info_length, crc_length and 1394 magic number to check, if it is really a bus info block */ 1464 /* info_length, crc_length and 1394 magic number to check, if it is really a bus info block */
1465 if (((be32_to_cpu(lynx->bus_info_block[0]) & 0xffff0000) == 0x04040000) && 1465 if (((be32_to_cpu(lynx->bus_info_block[0]) & 0xffff0000) == 0x04040000) &&
1466 (lynx->bus_info_block[1] == __constant_cpu_to_be32(0x31333934))) 1466 (lynx->bus_info_block[1] == IEEE1394_BUSID_MAGIC))
1467 { 1467 {
1468 PRINT(KERN_DEBUG, lynx->id, "read a valid bus info block from"); 1468 PRINT(KERN_DEBUG, lynx->id, "read a valid bus info block from");
1469 } else { 1469 } else {
diff --git a/drivers/ieee1394/pcilynx.h b/drivers/ieee1394/pcilynx.h
index ec27321f6724..693a169acea3 100644
--- a/drivers/ieee1394/pcilynx.h
+++ b/drivers/ieee1394/pcilynx.h
@@ -52,7 +52,7 @@ struct ti_lynx {
52 void __iomem *local_rom; 52 void __iomem *local_rom;
53 void __iomem *local_ram; 53 void __iomem *local_ram;
54 void __iomem *aux_port; 54 void __iomem *aux_port;
55 quadlet_t bus_info_block[5]; 55 __be32 bus_info_block[5];
56 56
57 /* 57 /*
58 * use local RAM of LOCALRAM_SIZE bytes for PCLs, which allows for 58 * use local RAM of LOCALRAM_SIZE bytes for PCLs, which allows for
diff --git a/drivers/ieee1394/raw1394.c b/drivers/ieee1394/raw1394.c
index bf7e761c12b1..bad66c65b0d6 100644
--- a/drivers/ieee1394/raw1394.c
+++ b/drivers/ieee1394/raw1394.c
@@ -90,7 +90,7 @@ static int arm_lock(struct hpsb_host *host, int nodeid, quadlet_t * store,
90static int arm_lock64(struct hpsb_host *host, int nodeid, octlet_t * store, 90static int arm_lock64(struct hpsb_host *host, int nodeid, octlet_t * store,
91 u64 addr, octlet_t data, octlet_t arg, int ext_tcode, 91 u64 addr, octlet_t data, octlet_t arg, int ext_tcode,
92 u16 flags); 92 u16 flags);
93static struct hpsb_address_ops arm_ops = { 93const static struct hpsb_address_ops arm_ops = {
94 .read = arm_read, 94 .read = arm_read,
95 .write = arm_write, 95 .write = arm_write,
96 .lock = arm_lock, 96 .lock = arm_lock,
diff --git a/drivers/ieee1394/sbp2.c b/drivers/ieee1394/sbp2.c
index a373c18cf7b8..ab1034ccb7fb 100644
--- a/drivers/ieee1394/sbp2.c
+++ b/drivers/ieee1394/sbp2.c
@@ -265,7 +265,7 @@ static struct hpsb_highlevel sbp2_highlevel = {
265 .host_reset = sbp2_host_reset, 265 .host_reset = sbp2_host_reset,
266}; 266};
267 267
268static struct hpsb_address_ops sbp2_ops = { 268const static struct hpsb_address_ops sbp2_ops = {
269 .write = sbp2_handle_status_write 269 .write = sbp2_handle_status_write
270}; 270};
271 271
@@ -275,7 +275,7 @@ static int sbp2_handle_physdma_write(struct hpsb_host *, int, int, quadlet_t *,
275static int sbp2_handle_physdma_read(struct hpsb_host *, int, quadlet_t *, u64, 275static int sbp2_handle_physdma_read(struct hpsb_host *, int, quadlet_t *, u64,
276 size_t, u16); 276 size_t, u16);
277 277
278static struct hpsb_address_ops sbp2_physdma_ops = { 278const static struct hpsb_address_ops sbp2_physdma_ops = {
279 .read = sbp2_handle_physdma_read, 279 .read = sbp2_handle_physdma_read,
280 .write = sbp2_handle_physdma_write, 280 .write = sbp2_handle_physdma_write,
281}; 281};
diff --git a/drivers/infiniband/hw/mlx4/cq.c b/drivers/infiniband/hw/mlx4/cq.c
index a3c5af1d7ec0..de5263beab4a 100644
--- a/drivers/infiniband/hw/mlx4/cq.c
+++ b/drivers/infiniband/hw/mlx4/cq.c
@@ -367,7 +367,7 @@ int mlx4_ib_resize_cq(struct ib_cq *ibcq, int entries, struct ib_udata *udata)
367 if (err) 367 if (err)
368 goto out; 368 goto out;
369 } else { 369 } else {
370 /* Can't be smaller then the number of outstanding CQEs */ 370 /* Can't be smaller than the number of outstanding CQEs */
371 outst_cqe = mlx4_ib_get_outstanding_cqes(cq); 371 outst_cqe = mlx4_ib_get_outstanding_cqes(cq);
372 if (entries < outst_cqe + 1) { 372 if (entries < outst_cqe + 1) {
373 err = 0; 373 err = 0;
diff --git a/drivers/input/keyboard/atkbd.c b/drivers/input/keyboard/atkbd.c
index f6e9f39a527b..c3c8b9bc40ae 100644
--- a/drivers/input/keyboard/atkbd.c
+++ b/drivers/input/keyboard/atkbd.c
@@ -65,7 +65,7 @@ MODULE_PARM_DESC(extra, "Enable extra LEDs and keys on IBM RapidAcces, EzKey and
65 65
66/* 66/*
67 * Scancode to keycode tables. These are just the default setting, and 67 * Scancode to keycode tables. These are just the default setting, and
68 * are loadable via an userland utility. 68 * are loadable via a userland utility.
69 */ 69 */
70 70
71static const unsigned short atkbd_set2_keycode[512] = { 71static const unsigned short atkbd_set2_keycode[512] = {
diff --git a/drivers/input/misc/apanel.c b/drivers/input/misc/apanel.c
index d82f7f727f7a..71b82434264d 100644
--- a/drivers/input/misc/apanel.c
+++ b/drivers/input/misc/apanel.c
@@ -57,7 +57,7 @@ static enum apanel_chip device_chip[APANEL_DEV_MAX];
57 57
58struct apanel { 58struct apanel {
59 struct input_polled_dev *ipdev; 59 struct input_polled_dev *ipdev;
60 struct i2c_client client; 60 struct i2c_client *client;
61 unsigned short keymap[MAX_PANEL_KEYS]; 61 unsigned short keymap[MAX_PANEL_KEYS];
62 u16 nkeys; 62 u16 nkeys;
63 u16 led_bits; 63 u16 led_bits;
@@ -66,16 +66,7 @@ struct apanel {
66}; 66};
67 67
68 68
69static int apanel_probe(struct i2c_adapter *, int, int); 69static int apanel_probe(struct i2c_client *, const struct i2c_device_id *);
70
71/* for now, we only support one address */
72static unsigned short normal_i2c[] = {0, I2C_CLIENT_END};
73static unsigned short ignore = I2C_CLIENT_END;
74static struct i2c_client_address_data addr_data = {
75 .normal_i2c = normal_i2c,
76 .probe = &ignore,
77 .ignore = &ignore,
78};
79 70
80static void report_key(struct input_dev *input, unsigned keycode) 71static void report_key(struct input_dev *input, unsigned keycode)
81{ 72{
@@ -103,12 +94,12 @@ static void apanel_poll(struct input_polled_dev *ipdev)
103 s32 data; 94 s32 data;
104 int i; 95 int i;
105 96
106 data = i2c_smbus_read_word_data(&ap->client, cmd); 97 data = i2c_smbus_read_word_data(ap->client, cmd);
107 if (data < 0) 98 if (data < 0)
108 return; /* ignore errors (due to ACPI??) */ 99 return; /* ignore errors (due to ACPI??) */
109 100
110 /* write back to clear latch */ 101 /* write back to clear latch */
111 i2c_smbus_write_word_data(&ap->client, cmd, 0); 102 i2c_smbus_write_word_data(ap->client, cmd, 0);
112 103
113 if (!data) 104 if (!data)
114 return; 105 return;
@@ -124,7 +115,7 @@ static void led_update(struct work_struct *work)
124{ 115{
125 struct apanel *ap = container_of(work, struct apanel, led_work); 116 struct apanel *ap = container_of(work, struct apanel, led_work);
126 117
127 i2c_smbus_write_word_data(&ap->client, 0x10, ap->led_bits); 118 i2c_smbus_write_word_data(ap->client, 0x10, ap->led_bits);
128} 119}
129 120
130static void mail_led_set(struct led_classdev *led, 121static void mail_led_set(struct led_classdev *led,
@@ -140,7 +131,7 @@ static void mail_led_set(struct led_classdev *led,
140 schedule_work(&ap->led_work); 131 schedule_work(&ap->led_work);
141} 132}
142 133
143static int apanel_detach_client(struct i2c_client *client) 134static int apanel_remove(struct i2c_client *client)
144{ 135{
145 struct apanel *ap = i2c_get_clientdata(client); 136 struct apanel *ap = i2c_get_clientdata(client);
146 137
@@ -148,43 +139,33 @@ static int apanel_detach_client(struct i2c_client *client)
148 led_classdev_unregister(&ap->mail_led); 139 led_classdev_unregister(&ap->mail_led);
149 140
150 input_unregister_polled_device(ap->ipdev); 141 input_unregister_polled_device(ap->ipdev);
151 i2c_detach_client(&ap->client);
152 input_free_polled_device(ap->ipdev); 142 input_free_polled_device(ap->ipdev);
153 143
154 return 0; 144 return 0;
155} 145}
156 146
157/* Function is invoked for every i2c adapter. */
158static int apanel_attach_adapter(struct i2c_adapter *adap)
159{
160 dev_dbg(&adap->dev, APANEL ": attach adapter id=%d\n", adap->id);
161
162 /* Our device is connected only to i801 on laptop */
163 if (adap->id != I2C_HW_SMBUS_I801)
164 return -ENODEV;
165
166 return i2c_probe(adap, &addr_data, apanel_probe);
167}
168
169static void apanel_shutdown(struct i2c_client *client) 147static void apanel_shutdown(struct i2c_client *client)
170{ 148{
171 apanel_detach_client(client); 149 apanel_remove(client);
172} 150}
173 151
152static struct i2c_device_id apanel_id[] = {
153 { "fujitsu_apanel", 0 },
154 { }
155};
156MODULE_DEVICE_TABLE(i2c, apanel_id);
157
174static struct i2c_driver apanel_driver = { 158static struct i2c_driver apanel_driver = {
175 .driver = { 159 .driver = {
176 .name = APANEL, 160 .name = APANEL,
177 }, 161 },
178 .attach_adapter = &apanel_attach_adapter, 162 .probe = &apanel_probe,
179 .detach_client = &apanel_detach_client, 163 .remove = &apanel_remove,
180 .shutdown = &apanel_shutdown, 164 .shutdown = &apanel_shutdown,
165 .id_table = apanel_id,
181}; 166};
182 167
183static struct apanel apanel = { 168static struct apanel apanel = {
184 .client = {
185 .driver = &apanel_driver,
186 .name = APANEL,
187 },
188 .keymap = { 169 .keymap = {
189 [0] = KEY_MAIL, 170 [0] = KEY_MAIL,
190 [1] = KEY_WWW, 171 [1] = KEY_WWW,
@@ -204,7 +185,8 @@ static struct apanel apanel = {
204}; 185};
205 186
206/* NB: Only one panel on the i2c. */ 187/* NB: Only one panel on the i2c. */
207static int apanel_probe(struct i2c_adapter *bus, int address, int kind) 188static int apanel_probe(struct i2c_client *client,
189 const struct i2c_device_id *id)
208{ 190{
209 struct apanel *ap; 191 struct apanel *ap;
210 struct input_polled_dev *ipdev; 192 struct input_polled_dev *ipdev;
@@ -212,9 +194,6 @@ static int apanel_probe(struct i2c_adapter *bus, int address, int kind)
212 u8 cmd = device_chip[APANEL_DEV_APPBTN] == CHIP_OZ992C ? 0 : 8; 194 u8 cmd = device_chip[APANEL_DEV_APPBTN] == CHIP_OZ992C ? 0 : 8;
213 int i, err = -ENOMEM; 195 int i, err = -ENOMEM;
214 196
215 dev_dbg(&bus->dev, APANEL ": probe adapter %p addr %d kind %d\n",
216 bus, address, kind);
217
218 ap = &apanel; 197 ap = &apanel;
219 198
220 ipdev = input_allocate_polled_device(); 199 ipdev = input_allocate_polled_device();
@@ -222,18 +201,13 @@ static int apanel_probe(struct i2c_adapter *bus, int address, int kind)
222 goto out1; 201 goto out1;
223 202
224 ap->ipdev = ipdev; 203 ap->ipdev = ipdev;
225 ap->client.adapter = bus; 204 ap->client = client;
226 ap->client.addr = address;
227
228 i2c_set_clientdata(&ap->client, ap);
229 205
230 err = i2c_attach_client(&ap->client); 206 i2c_set_clientdata(client, ap);
231 if (err)
232 goto out2;
233 207
234 err = i2c_smbus_write_word_data(&ap->client, cmd, 0); 208 err = i2c_smbus_write_word_data(client, cmd, 0);
235 if (err) { 209 if (err) {
236 dev_warn(&ap->client.dev, APANEL ": smbus write error %d\n", 210 dev_warn(&client->dev, APANEL ": smbus write error %d\n",
237 err); 211 err);
238 goto out3; 212 goto out3;
239 } 213 }
@@ -246,7 +220,7 @@ static int apanel_probe(struct i2c_adapter *bus, int address, int kind)
246 idev->name = APANEL_NAME " buttons"; 220 idev->name = APANEL_NAME " buttons";
247 idev->phys = "apanel/input0"; 221 idev->phys = "apanel/input0";
248 idev->id.bustype = BUS_HOST; 222 idev->id.bustype = BUS_HOST;
249 idev->dev.parent = &ap->client.dev; 223 idev->dev.parent = &client->dev;
250 224
251 set_bit(EV_KEY, idev->evbit); 225 set_bit(EV_KEY, idev->evbit);
252 226
@@ -264,7 +238,7 @@ static int apanel_probe(struct i2c_adapter *bus, int address, int kind)
264 238
265 INIT_WORK(&ap->led_work, led_update); 239 INIT_WORK(&ap->led_work, led_update);
266 if (device_chip[APANEL_DEV_LED] != CHIP_NONE) { 240 if (device_chip[APANEL_DEV_LED] != CHIP_NONE) {
267 err = led_classdev_register(&ap->client.dev, &ap->mail_led); 241 err = led_classdev_register(&client->dev, &ap->mail_led);
268 if (err) 242 if (err)
269 goto out4; 243 goto out4;
270 } 244 }
@@ -273,8 +247,6 @@ static int apanel_probe(struct i2c_adapter *bus, int address, int kind)
273out4: 247out4:
274 input_unregister_polled_device(ipdev); 248 input_unregister_polled_device(ipdev);
275out3: 249out3:
276 i2c_detach_client(&ap->client);
277out2:
278 input_free_polled_device(ipdev); 250 input_free_polled_device(ipdev);
279out1: 251out1:
280 return err; 252 return err;
@@ -301,6 +273,7 @@ static int __init apanel_init(void)
301 void __iomem *bios; 273 void __iomem *bios;
302 const void __iomem *p; 274 const void __iomem *p;
303 u8 devno; 275 u8 devno;
276 unsigned char i2c_addr;
304 int found = 0; 277 int found = 0;
305 278
306 bios = ioremap(0xF0000, 0x10000); /* Can't fail */ 279 bios = ioremap(0xF0000, 0x10000); /* Can't fail */
@@ -313,7 +286,7 @@ static int __init apanel_init(void)
313 286
314 /* just use the first address */ 287 /* just use the first address */
315 p += 8; 288 p += 8;
316 normal_i2c[0] = readb(p+3) >> 1; 289 i2c_addr = readb(p + 3) >> 1;
317 290
318 for ( ; (devno = readb(p)) & 0x7f; p += 4) { 291 for ( ; (devno = readb(p)) & 0x7f; p += 4) {
319 unsigned char method, slave, chip; 292 unsigned char method, slave, chip;
@@ -322,7 +295,7 @@ static int __init apanel_init(void)
322 chip = readb(p + 2); 295 chip = readb(p + 2);
323 slave = readb(p + 3) >> 1; 296 slave = readb(p + 3) >> 1;
324 297
325 if (slave != normal_i2c[0]) { 298 if (slave != i2c_addr) {
326 pr_notice(APANEL ": only one SMBus slave " 299 pr_notice(APANEL ": only one SMBus slave "
327 "address supported, skiping device...\n"); 300 "address supported, skiping device...\n");
328 continue; 301 continue;
diff --git a/drivers/input/touchscreen/da9034-ts.c b/drivers/input/touchscreen/da9034-ts.c
index 4342e77814b5..fa67d782c3c3 100644
--- a/drivers/input/touchscreen/da9034-ts.c
+++ b/drivers/input/touchscreen/da9034-ts.c
@@ -16,6 +16,7 @@
16#include <linux/delay.h> 16#include <linux/delay.h>
17#include <linux/platform_device.h> 17#include <linux/platform_device.h>
18#include <linux/input.h> 18#include <linux/input.h>
19#include <linux/workqueue.h>
19#include <linux/mfd/da903x.h> 20#include <linux/mfd/da903x.h>
20 21
21#define DA9034_MANUAL_CTRL 0x50 22#define DA9034_MANUAL_CTRL 0x50
diff --git a/drivers/macintosh/Kconfig b/drivers/macintosh/Kconfig
index b52659620d50..173cf55c64d0 100644
--- a/drivers/macintosh/Kconfig
+++ b/drivers/macintosh/Kconfig
@@ -138,7 +138,7 @@ config PMAC_BACKLIGHT
138 Say Y here to enable Macintosh specific extensions of the generic 138 Say Y here to enable Macintosh specific extensions of the generic
139 backlight code. With this enabled, the brightness keys on older 139 backlight code. With this enabled, the brightness keys on older
140 PowerBooks will be enabled so you can change the screen brightness. 140 PowerBooks will be enabled so you can change the screen brightness.
141 Newer models should use an userspace daemon like pbbuttonsd. 141 Newer models should use a userspace daemon like pbbuttonsd.
142 142
143config PMAC_BACKLIGHT_LEGACY 143config PMAC_BACKLIGHT_LEGACY
144 bool "Provide legacy ioctl's on /dev/pmu for the backlight" 144 bool "Provide legacy ioctl's on /dev/pmu for the backlight"
diff --git a/drivers/media/video/cafe_ccic.c b/drivers/media/video/cafe_ccic.c
index 34a39d2e4703..46fd573a4f15 100644
--- a/drivers/media/video/cafe_ccic.c
+++ b/drivers/media/video/cafe_ccic.c
@@ -569,7 +569,6 @@ static int cafe_smbus_setup(struct cafe_camera *cam)
569 569
570 cafe_smbus_enable_irq(cam); 570 cafe_smbus_enable_irq(cam);
571 adap->id = I2C_HW_SMBUS_CAFE; 571 adap->id = I2C_HW_SMBUS_CAFE;
572 adap->class = I2C_CLASS_CAM_DIGITAL;
573 adap->owner = THIS_MODULE; 572 adap->owner = THIS_MODULE;
574 adap->client_register = cafe_smbus_attach; 573 adap->client_register = cafe_smbus_attach;
575 adap->client_unregister = cafe_smbus_detach; 574 adap->client_unregister = cafe_smbus_detach;
diff --git a/drivers/media/video/ov7670.c b/drivers/media/video/ov7670.c
index ca26b0c50cf2..05c14a29375a 100644
--- a/drivers/media/video/ov7670.c
+++ b/drivers/media/video/ov7670.c
@@ -1347,7 +1347,6 @@ static struct i2c_driver ov7670_driver = {
1347 .name = "ov7670", 1347 .name = "ov7670",
1348 }, 1348 },
1349 .id = I2C_DRIVERID_OV7670, 1349 .id = I2C_DRIVERID_OV7670,
1350 .class = I2C_CLASS_CAM_DIGITAL,
1351 .attach_adapter = ov7670_attach, 1350 .attach_adapter = ov7670_attach,
1352 .detach_client = ov7670_detach, 1351 .detach_client = ov7670_detach,
1353 .command = ov7670_command, 1352 .command = ov7670_command,
diff --git a/drivers/media/video/ovcamchip/ovcamchip_core.c b/drivers/media/video/ovcamchip/ovcamchip_core.c
index 2c4acbf5a4fe..c841f4e4fbe4 100644
--- a/drivers/media/video/ovcamchip/ovcamchip_core.c
+++ b/drivers/media/video/ovcamchip/ovcamchip_core.c
@@ -405,7 +405,6 @@ static struct i2c_driver driver = {
405 .name = "ovcamchip", 405 .name = "ovcamchip",
406 }, 406 },
407 .id = I2C_DRIVERID_OVCAMCHIP, 407 .id = I2C_DRIVERID_OVCAMCHIP,
408 .class = I2C_CLASS_CAM_DIGITAL,
409 .attach_adapter = ovcamchip_attach, 408 .attach_adapter = ovcamchip_attach,
410 .detach_client = ovcamchip_detach, 409 .detach_client = ovcamchip_detach,
411 .command = ovcamchip_command, 410 .command = ovcamchip_command,
diff --git a/drivers/media/video/pvrusb2/pvrusb2-hdw.c b/drivers/media/video/pvrusb2/pvrusb2-hdw.c
index 8fb92ac78c7b..fa304e5f252a 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-hdw.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-hdw.c
@@ -3655,7 +3655,7 @@ void pvr2_hdw_device_reset(struct pvr2_hdw *hdw)
3655 int ret; 3655 int ret;
3656 pvr2_trace(PVR2_TRACE_INIT,"Performing a device reset..."); 3656 pvr2_trace(PVR2_TRACE_INIT,"Performing a device reset...");
3657 ret = usb_lock_device_for_reset(hdw->usb_dev,NULL); 3657 ret = usb_lock_device_for_reset(hdw->usb_dev,NULL);
3658 if (ret == 1) { 3658 if (ret == 0) {
3659 ret = usb_reset_device(hdw->usb_dev); 3659 ret = usb_reset_device(hdw->usb_dev);
3660 usb_unlock_device(hdw->usb_dev); 3660 usb_unlock_device(hdw->usb_dev);
3661 } else { 3661 } else {
diff --git a/drivers/media/video/w9968cf.c b/drivers/media/video/w9968cf.c
index a3997b7d4366..105a832531f2 100644
--- a/drivers/media/video/w9968cf.c
+++ b/drivers/media/video/w9968cf.c
@@ -1553,7 +1553,6 @@ static int w9968cf_i2c_init(struct w9968cf_device* cam)
1553 1553
1554 static struct i2c_adapter adap = { 1554 static struct i2c_adapter adap = {
1555 .id = I2C_HW_SMBUS_W9968CF, 1555 .id = I2C_HW_SMBUS_W9968CF,
1556 .class = I2C_CLASS_CAM_DIGITAL,
1557 .owner = THIS_MODULE, 1556 .owner = THIS_MODULE,
1558 .client_register = w9968cf_i2c_attach_inform, 1557 .client_register = w9968cf_i2c_attach_inform,
1559 .client_unregister = w9968cf_i2c_detach_inform, 1558 .client_unregister = w9968cf_i2c_detach_inform,
diff --git a/drivers/message/i2o/i2o_scsi.c b/drivers/message/i2o/i2o_scsi.c
index 1bcdbbb9e7d3..3d45817e6dcd 100644
--- a/drivers/message/i2o/i2o_scsi.c
+++ b/drivers/message/i2o/i2o_scsi.c
@@ -390,7 +390,7 @@ static int i2o_scsi_reply(struct i2o_controller *c, u32 m,
390 * @i2o_dev: the I2O device which was added 390 * @i2o_dev: the I2O device which was added
391 * 391 *
392 * If a I2O device is added we catch the notification, because I2O classes 392 * If a I2O device is added we catch the notification, because I2O classes
393 * other then SCSI peripheral will not be received through 393 * other than SCSI peripheral will not be received through
394 * i2o_scsi_probe(). 394 * i2o_scsi_probe().
395 */ 395 */
396static void i2o_scsi_notify_device_add(struct i2o_device *i2o_dev) 396static void i2o_scsi_notify_device_add(struct i2o_device *i2o_dev)
diff --git a/drivers/misc/ibmasm/event.c b/drivers/misc/ibmasm/event.c
index fda6a4d3bf23..68a0a5b94795 100644
--- a/drivers/misc/ibmasm/event.c
+++ b/drivers/misc/ibmasm/event.c
@@ -50,7 +50,7 @@ static void wake_up_event_readers(struct service_processor *sp)
50 * Store the event in the circular event buffer, wake up any sleeping 50 * Store the event in the circular event buffer, wake up any sleeping
51 * event readers. 51 * event readers.
52 * There is no reader marker in the buffer, therefore readers are 52 * There is no reader marker in the buffer, therefore readers are
53 * responsible for keeping up with the writer, or they will loose events. 53 * responsible for keeping up with the writer, or they will lose events.
54 */ 54 */
55void ibmasm_receive_event(struct service_processor *sp, void *data, unsigned int data_size) 55void ibmasm_receive_event(struct service_processor *sp, void *data, unsigned int data_size)
56{ 56{
diff --git a/drivers/misc/phantom.c b/drivers/misc/phantom.c
index abdebe347383..fa57b67593ae 100644
--- a/drivers/misc/phantom.c
+++ b/drivers/misc/phantom.c
@@ -6,7 +6,7 @@
6 * the Free Software Foundation; either version 2 of the License, or 6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version. 7 * (at your option) any later version.
8 * 8 *
9 * You need an userspace library to cooperate with this driver. It (and other 9 * You need a userspace library to cooperate with this driver. It (and other
10 * info) may be obtained here: 10 * info) may be obtained here:
11 * http://www.fi.muni.cz/~xslaby/phantom.html 11 * http://www.fi.muni.cz/~xslaby/phantom.html
12 * or alternatively, you might use OpenHaptics provided by Sensable. 12 * or alternatively, you might use OpenHaptics provided by Sensable.
diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c
index 7a3f2436b011..1e97916914ad 100644
--- a/drivers/mmc/host/atmel-mci.c
+++ b/drivers/mmc/host/atmel-mci.c
@@ -25,8 +25,8 @@
25#include <linux/stat.h> 25#include <linux/stat.h>
26 26
27#include <linux/mmc/host.h> 27#include <linux/mmc/host.h>
28#include <linux/atmel-mci.h>
28 29
29#include <asm/atmel-mci.h>
30#include <asm/io.h> 30#include <asm/io.h>
31#include <asm/unaligned.h> 31#include <asm/unaligned.h>
32 32
diff --git a/drivers/mtd/devices/pmc551.c b/drivers/mtd/devices/pmc551.c
index d38bca64bb15..d2fd550f7e09 100644
--- a/drivers/mtd/devices/pmc551.c
+++ b/drivers/mtd/devices/pmc551.c
@@ -34,7 +34,7 @@
34 * aperture size, not the dram size, and the V370PDC supplies no 34 * aperture size, not the dram size, and the V370PDC supplies no
35 * other method for memory size discovery. This problem is 35 * other method for memory size discovery. This problem is
36 * mostly only relevant when compiled as a module, as the 36 * mostly only relevant when compiled as a module, as the
37 * unloading of the module with an aperture size smaller then 37 * unloading of the module with an aperture size smaller than
38 * the ram will cause the driver to detect the onboard memory 38 * the ram will cause the driver to detect the onboard memory
39 * size to be equal to the aperture size when the module is 39 * size to be equal to the aperture size when the module is
40 * reloaded. Soooo, to help, the module supports an msize 40 * reloaded. Soooo, to help, the module supports an msize
diff --git a/drivers/mtd/ubi/eba.c b/drivers/mtd/ubi/eba.c
index 048a606cebde..25def348e5ba 100644
--- a/drivers/mtd/ubi/eba.c
+++ b/drivers/mtd/ubi/eba.c
@@ -717,7 +717,7 @@ write_error:
717 * to the real data size, although the @buf buffer has to contain the 717 * to the real data size, although the @buf buffer has to contain the
718 * alignment. In all other cases, @len has to be aligned. 718 * alignment. In all other cases, @len has to be aligned.
719 * 719 *
720 * It is prohibited to write more then once to logical eraseblocks of static 720 * It is prohibited to write more than once to logical eraseblocks of static
721 * volumes. This function returns zero in case of success and a negative error 721 * volumes. This function returns zero in case of success and a negative error
722 * code in case of failure. 722 * code in case of failure.
723 */ 723 */
diff --git a/drivers/mtd/ubi/io.c b/drivers/mtd/ubi/io.c
index a74118c05745..fe81039f2a7c 100644
--- a/drivers/mtd/ubi/io.c
+++ b/drivers/mtd/ubi/io.c
@@ -465,7 +465,7 @@ out:
465 * This function synchronously erases physical eraseblock @pnum. If @torture 465 * This function synchronously erases physical eraseblock @pnum. If @torture
466 * flag is not zero, the physical eraseblock is checked by means of writing 466 * flag is not zero, the physical eraseblock is checked by means of writing
467 * different patterns to it and reading them back. If the torturing is enabled, 467 * different patterns to it and reading them back. If the torturing is enabled,
468 * the physical eraseblock is erased more then once. 468 * the physical eraseblock is erased more than once.
469 * 469 *
470 * This function returns the number of erasures made in case of success, %-EIO 470 * This function returns the number of erasures made in case of success, %-EIO
471 * if the erasure failed or the torturing test failed, and other negative error 471 * if the erasure failed or the torturing test failed, and other negative error
diff --git a/drivers/mtd/ubi/scan.c b/drivers/mtd/ubi/scan.c
index 41d47e1cf15c..ecde202a5a12 100644
--- a/drivers/mtd/ubi/scan.c
+++ b/drivers/mtd/ubi/scan.c
@@ -478,7 +478,7 @@ int ubi_scan_add_used(struct ubi_device *ubi, struct ubi_scan_info *si,
478 return 0; 478 return 0;
479 } else { 479 } else {
480 /* 480 /*
481 * This logical eraseblock is older then the one found 481 * This logical eraseblock is older than the one found
482 * previously. 482 * previously.
483 */ 483 */
484 if (cmp_res & 4) 484 if (cmp_res & 4)
diff --git a/drivers/mtd/ubi/ubi-media.h b/drivers/mtd/ubi/ubi-media.h
index 2ad940409053..8419fdccc79c 100644
--- a/drivers/mtd/ubi/ubi-media.h
+++ b/drivers/mtd/ubi/ubi-media.h
@@ -135,7 +135,7 @@ enum {
135 * The erase counter header takes 64 bytes and has a plenty of unused space for 135 * The erase counter header takes 64 bytes and has a plenty of unused space for
136 * future usage. The unused fields are zeroed. The @version field is used to 136 * future usage. The unused fields are zeroed. The @version field is used to
137 * indicate the version of UBI implementation which is supposed to be able to 137 * indicate the version of UBI implementation which is supposed to be able to
138 * work with this UBI image. If @version is greater then the current UBI 138 * work with this UBI image. If @version is greater than the current UBI
139 * version, the image is rejected. This may be useful in future if something 139 * version, the image is rejected. This may be useful in future if something
140 * is changed radically. This field is duplicated in the volume identifier 140 * is changed radically. This field is duplicated in the volume identifier
141 * header. 141 * header.
@@ -187,7 +187,7 @@ struct ubi_ec_hdr {
187 * (sequence number) is used to distinguish between older and newer versions of 187 * (sequence number) is used to distinguish between older and newer versions of
188 * logical eraseblocks. 188 * logical eraseblocks.
189 * 189 *
190 * There are 2 situations when there may be more then one physical eraseblock 190 * There are 2 situations when there may be more than one physical eraseblock
191 * corresponding to the same logical eraseblock, i.e., having the same @vol_id 191 * corresponding to the same logical eraseblock, i.e., having the same @vol_id
192 * and @lnum values in the volume identifier header. Suppose we have a logical 192 * and @lnum values in the volume identifier header. Suppose we have a logical
193 * eraseblock L and it is mapped to the physical eraseblock P. 193 * eraseblock L and it is mapped to the physical eraseblock P.
diff --git a/drivers/mtd/ubi/vtbl.c b/drivers/mtd/ubi/vtbl.c
index 333c8941552f..1afc61e7455d 100644
--- a/drivers/mtd/ubi/vtbl.c
+++ b/drivers/mtd/ubi/vtbl.c
@@ -577,7 +577,7 @@ static int init_volumes(struct ubi_device *ubi, const struct ubi_scan_info *si,
577 if (vtbl[i].flags & UBI_VTBL_AUTORESIZE_FLG) { 577 if (vtbl[i].flags & UBI_VTBL_AUTORESIZE_FLG) {
578 /* Auto re-size flag may be set only for one volume */ 578 /* Auto re-size flag may be set only for one volume */
579 if (ubi->autoresize_vol_id != -1) { 579 if (ubi->autoresize_vol_id != -1) {
580 ubi_err("more then one auto-resize volume (%d " 580 ubi_err("more than one auto-resize volume (%d "
581 "and %d)", ubi->autoresize_vol_id, i); 581 "and %d)", ubi->autoresize_vol_id, i);
582 kfree(vol); 582 kfree(vol);
583 return -EINVAL; 583 return -EINVAL;
diff --git a/drivers/mtd/ubi/wl.c b/drivers/mtd/ubi/wl.c
index 14901cb82c18..891534f8210d 100644
--- a/drivers/mtd/ubi/wl.c
+++ b/drivers/mtd/ubi/wl.c
@@ -128,7 +128,7 @@
128 * situation when the picked physical eraseblock is constantly erased after the 128 * situation when the picked physical eraseblock is constantly erased after the
129 * data is written to it. So, we have a constant which limits the highest erase 129 * data is written to it. So, we have a constant which limits the highest erase
130 * counter of the free physical eraseblock to pick. Namely, the WL sub-system 130 * counter of the free physical eraseblock to pick. Namely, the WL sub-system
131 * does not pick eraseblocks with erase counter greater then the lowest erase 131 * does not pick eraseblocks with erase counter greater than the lowest erase
132 * counter plus %WL_FREE_MAX_DIFF. 132 * counter plus %WL_FREE_MAX_DIFF.
133 */ 133 */
134#define WL_FREE_MAX_DIFF (2*UBI_WL_THRESHOLD) 134#define WL_FREE_MAX_DIFF (2*UBI_WL_THRESHOLD)
@@ -917,7 +917,7 @@ static int ensure_wear_leveling(struct ubi_device *ubi)
917 /* 917 /*
918 * We schedule wear-leveling only if the difference between the 918 * We schedule wear-leveling only if the difference between the
919 * lowest erase counter of used physical eraseblocks and a high 919 * lowest erase counter of used physical eraseblocks and a high
920 * erase counter of free physical eraseblocks is greater then 920 * erase counter of free physical eraseblocks is greater than
921 * %UBI_WL_THRESHOLD. 921 * %UBI_WL_THRESHOLD.
922 */ 922 */
923 e1 = rb_entry(rb_first(&ubi->used), struct ubi_wl_entry, u.rb); 923 e1 = rb_entry(rb_first(&ubi->used), struct ubi_wl_entry, u.rb);
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index 9a18270c1081..97ea7c60e002 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -2614,6 +2614,8 @@ source "drivers/net/tokenring/Kconfig"
2614 2614
2615source "drivers/net/wireless/Kconfig" 2615source "drivers/net/wireless/Kconfig"
2616 2616
2617source "drivers/net/wimax/Kconfig"
2618
2617source "drivers/net/usb/Kconfig" 2619source "drivers/net/usb/Kconfig"
2618 2620
2619source "drivers/net/pcmcia/Kconfig" 2621source "drivers/net/pcmcia/Kconfig"
diff --git a/drivers/net/Makefile b/drivers/net/Makefile
index e5c34b464211..a3c5c002f224 100644
--- a/drivers/net/Makefile
+++ b/drivers/net/Makefile
@@ -263,3 +263,4 @@ obj-$(CONFIG_NIU) += niu.o
263obj-$(CONFIG_VIRTIO_NET) += virtio_net.o 263obj-$(CONFIG_VIRTIO_NET) += virtio_net.o
264obj-$(CONFIG_SFC) += sfc/ 264obj-$(CONFIG_SFC) += sfc/
265 265
266obj-$(CONFIG_WIMAX) += wimax/
diff --git a/drivers/net/bnx2x_link.c b/drivers/net/bnx2x_link.c
index 67de94f1f30e..fefa6ab13064 100644
--- a/drivers/net/bnx2x_link.c
+++ b/drivers/net/bnx2x_link.c
@@ -3359,7 +3359,7 @@ static u8 bnx2x_format_ver(u32 num, u8 *str, u16 len)
3359 u8 shift = 8*4; 3359 u8 shift = 8*4;
3360 u8 digit; 3360 u8 digit;
3361 if (len < 10) { 3361 if (len < 10) {
3362 /* Need more then 10chars for this format */ 3362 /* Need more than 10chars for this format */
3363 *str_ptr = '\0'; 3363 *str_ptr = '\0';
3364 return -EINVAL; 3364 return -EINVAL;
3365 } 3365 }
diff --git a/drivers/net/e1000/e1000_hw.c b/drivers/net/e1000/e1000_hw.c
index d04eef53571e..e1a3fc1303ee 100644
--- a/drivers/net/e1000/e1000_hw.c
+++ b/drivers/net/e1000/e1000_hw.c
@@ -6758,7 +6758,7 @@ static s32 e1000_get_cable_length(struct e1000_hw *hw, u16 *min_length,
6758 * returns: - E1000_ERR_XXX 6758 * returns: - E1000_ERR_XXX
6759 * E1000_SUCCESS 6759 * E1000_SUCCESS
6760 * 6760 *
6761 * For phy's older then IGP, this function simply reads the polarity bit in the 6761 * For phy's older than IGP, this function simply reads the polarity bit in the
6762 * Phy Status register. For IGP phy's, this bit is valid only if link speed is 6762 * Phy Status register. For IGP phy's, this bit is valid only if link speed is
6763 * 10 Mbps. If the link speed is 100 Mbps there is no polarity so this bit will 6763 * 10 Mbps. If the link speed is 100 Mbps there is no polarity so this bit will
6764 * return 0. If the link speed is 1000 Mbps the polarity status is in the 6764 * return 0. If the link speed is 1000 Mbps the polarity status is in the
@@ -6834,7 +6834,7 @@ static s32 e1000_check_polarity(struct e1000_hw *hw,
6834 * returns: - E1000_ERR_XXX 6834 * returns: - E1000_ERR_XXX
6835 * E1000_SUCCESS 6835 * E1000_SUCCESS
6836 * 6836 *
6837 * For phy's older then IGP, this function reads the Downshift bit in the Phy 6837 * For phy's older than IGP, this function reads the Downshift bit in the Phy
6838 * Specific Status register. For IGP phy's, it reads the Downgrade bit in the 6838 * Specific Status register. For IGP phy's, it reads the Downgrade bit in the
6839 * Link Health register. In IGP this bit is latched high, so the driver must 6839 * Link Health register. In IGP this bit is latched high, so the driver must
6840 * read it immediately after link is established. 6840 * read it immediately after link is established.
diff --git a/drivers/net/slip.h b/drivers/net/slip.h
index 853e0f6ec710..9ea5c11287d2 100644
--- a/drivers/net/slip.h
+++ b/drivers/net/slip.h
@@ -75,7 +75,7 @@ struct slip {
75 unsigned long tx_errors; /* Planned stuff */ 75 unsigned long tx_errors; /* Planned stuff */
76 unsigned long rx_dropped; /* No memory for skb */ 76 unsigned long rx_dropped; /* No memory for skb */
77 unsigned long tx_dropped; /* When MTU change */ 77 unsigned long tx_dropped; /* When MTU change */
78 unsigned long rx_over_errors; /* Frame bigger then SLIP buf. */ 78 unsigned long rx_over_errors; /* Frame bigger than SLIP buf. */
79#ifdef SL_INCLUDE_CSLIP 79#ifdef SL_INCLUDE_CSLIP
80 unsigned long tx_compressed; 80 unsigned long tx_compressed;
81 unsigned long rx_compressed; 81 unsigned long rx_compressed;
diff --git a/drivers/net/tehuti.c b/drivers/net/tehuti.c
index a10a83a11d9f..a7a4dc4d6313 100644
--- a/drivers/net/tehuti.c
+++ b/drivers/net/tehuti.c
@@ -1004,7 +1004,7 @@ static inline void bdx_rxdb_free_elem(struct rxdb *db, int n)
1004 * skb for rx. It assumes that Rx is desabled in HW 1004 * skb for rx. It assumes that Rx is desabled in HW
1005 * funcs are grouped for better cache usage 1005 * funcs are grouped for better cache usage
1006 * 1006 *
1007 * RxD fifo is smaller then RxF fifo by design. Upon high load, RxD will be 1007 * RxD fifo is smaller than RxF fifo by design. Upon high load, RxD will be
1008 * filled and packets will be dropped by nic without getting into host or 1008 * filled and packets will be dropped by nic without getting into host or
1009 * cousing interrupt. Anyway, in that condition, host has no chance to proccess 1009 * cousing interrupt. Anyway, in that condition, host has no chance to proccess
1010 * all packets, but dropping in nic is cheaper, since it takes 0 cpu cycles 1010 * all packets, but dropping in nic is cheaper, since it takes 0 cpu cycles
@@ -1826,7 +1826,7 @@ static void bdx_tx_free(struct bdx_priv *priv)
1826 * 1826 *
1827 * Pushes desc to TxD fifo and overlaps it if needed. 1827 * Pushes desc to TxD fifo and overlaps it if needed.
1828 * NOTE: this func does not check for available space. this is responsibility 1828 * NOTE: this func does not check for available space. this is responsibility
1829 * of the caller. Neither does it check that data size is smaller then 1829 * of the caller. Neither does it check that data size is smaller than
1830 * fifo size. 1830 * fifo size.
1831 */ 1831 */
1832static void bdx_tx_push_desc(struct bdx_priv *priv, void *data, int size) 1832static void bdx_tx_push_desc(struct bdx_priv *priv, void *data, int size)
diff --git a/drivers/net/tokenring/smctr.c b/drivers/net/tokenring/smctr.c
index a011666342ff..50eb29ce3c87 100644
--- a/drivers/net/tokenring/smctr.c
+++ b/drivers/net/tokenring/smctr.c
@@ -3064,7 +3064,7 @@ static int smctr_load_node_addr(struct net_device *dev)
3064 * will consequently cause a timeout. 3064 * will consequently cause a timeout.
3065 * 3065 *
3066 * NOTE 1: If the monitor_state is MS_BEACON_TEST_STATE, all transmit 3066 * NOTE 1: If the monitor_state is MS_BEACON_TEST_STATE, all transmit
3067 * queues other then the one used for the lobe_media_test should be 3067 * queues other than the one used for the lobe_media_test should be
3068 * disabled.!? 3068 * disabled.!?
3069 * 3069 *
3070 * NOTE 2: If the monitor_state is MS_BEACON_TEST_STATE and the receive_mask 3070 * NOTE 2: If the monitor_state is MS_BEACON_TEST_STATE and the receive_mask
diff --git a/drivers/net/usb/kaweth.c b/drivers/net/usb/kaweth.c
index 2ee034f70d1c..3073ca25a0b0 100644
--- a/drivers/net/usb/kaweth.c
+++ b/drivers/net/usb/kaweth.c
@@ -283,9 +283,9 @@ static int kaweth_control(struct kaweth_device *kaweth,
283 283
284 dr->bRequestType= requesttype; 284 dr->bRequestType= requesttype;
285 dr->bRequest = request; 285 dr->bRequest = request;
286 dr->wValue = cpu_to_le16p(&value); 286 dr->wValue = cpu_to_le16(value);
287 dr->wIndex = cpu_to_le16p(&index); 287 dr->wIndex = cpu_to_le16(index);
288 dr->wLength = cpu_to_le16p(&size); 288 dr->wLength = cpu_to_le16(size);
289 289
290 return kaweth_internal_control_msg(kaweth->dev, 290 return kaweth_internal_control_msg(kaweth->dev,
291 pipe, 291 pipe,
diff --git a/drivers/net/usb/pegasus.c b/drivers/net/usb/pegasus.c
index 166880c113d6..d9241f1c0803 100644
--- a/drivers/net/usb/pegasus.c
+++ b/drivers/net/usb/pegasus.c
@@ -150,8 +150,8 @@ static int get_registers(pegasus_t * pegasus, __u16 indx, __u16 size,
150 pegasus->dr.bRequestType = PEGASUS_REQT_READ; 150 pegasus->dr.bRequestType = PEGASUS_REQT_READ;
151 pegasus->dr.bRequest = PEGASUS_REQ_GET_REGS; 151 pegasus->dr.bRequest = PEGASUS_REQ_GET_REGS;
152 pegasus->dr.wValue = cpu_to_le16(0); 152 pegasus->dr.wValue = cpu_to_le16(0);
153 pegasus->dr.wIndex = cpu_to_le16p(&indx); 153 pegasus->dr.wIndex = cpu_to_le16(indx);
154 pegasus->dr.wLength = cpu_to_le16p(&size); 154 pegasus->dr.wLength = cpu_to_le16(size);
155 pegasus->ctrl_urb->transfer_buffer_length = size; 155 pegasus->ctrl_urb->transfer_buffer_length = size;
156 156
157 usb_fill_control_urb(pegasus->ctrl_urb, pegasus->usb, 157 usb_fill_control_urb(pegasus->ctrl_urb, pegasus->usb,
@@ -208,8 +208,8 @@ static int set_registers(pegasus_t * pegasus, __u16 indx, __u16 size,
208 pegasus->dr.bRequestType = PEGASUS_REQT_WRITE; 208 pegasus->dr.bRequestType = PEGASUS_REQT_WRITE;
209 pegasus->dr.bRequest = PEGASUS_REQ_SET_REGS; 209 pegasus->dr.bRequest = PEGASUS_REQ_SET_REGS;
210 pegasus->dr.wValue = cpu_to_le16(0); 210 pegasus->dr.wValue = cpu_to_le16(0);
211 pegasus->dr.wIndex = cpu_to_le16p(&indx); 211 pegasus->dr.wIndex = cpu_to_le16(indx);
212 pegasus->dr.wLength = cpu_to_le16p(&size); 212 pegasus->dr.wLength = cpu_to_le16(size);
213 pegasus->ctrl_urb->transfer_buffer_length = size; 213 pegasus->ctrl_urb->transfer_buffer_length = size;
214 214
215 usb_fill_control_urb(pegasus->ctrl_urb, pegasus->usb, 215 usb_fill_control_urb(pegasus->ctrl_urb, pegasus->usb,
@@ -261,7 +261,7 @@ static int set_register(pegasus_t * pegasus, __u16 indx, __u8 data)
261 pegasus->dr.bRequestType = PEGASUS_REQT_WRITE; 261 pegasus->dr.bRequestType = PEGASUS_REQT_WRITE;
262 pegasus->dr.bRequest = PEGASUS_REQ_SET_REG; 262 pegasus->dr.bRequest = PEGASUS_REQ_SET_REG;
263 pegasus->dr.wValue = cpu_to_le16(data); 263 pegasus->dr.wValue = cpu_to_le16(data);
264 pegasus->dr.wIndex = cpu_to_le16p(&indx); 264 pegasus->dr.wIndex = cpu_to_le16(indx);
265 pegasus->dr.wLength = cpu_to_le16(1); 265 pegasus->dr.wLength = cpu_to_le16(1);
266 pegasus->ctrl_urb->transfer_buffer_length = 1; 266 pegasus->ctrl_urb->transfer_buffer_length = 1;
267 267
@@ -476,7 +476,7 @@ static inline void get_node_id(pegasus_t * pegasus, __u8 * id)
476 476
477 for (i = 0; i < 3; i++) { 477 for (i = 0; i < 3; i++) {
478 read_eprom_word(pegasus, i, &w16); 478 read_eprom_word(pegasus, i, &w16);
479 ((__le16 *) id)[i] = cpu_to_le16p(&w16); 479 ((__le16 *) id)[i] = cpu_to_le16(w16);
480 } 480 }
481} 481}
482 482
diff --git a/drivers/net/wimax/Kconfig b/drivers/net/wimax/Kconfig
new file mode 100644
index 000000000000..565018ec1e3b
--- /dev/null
+++ b/drivers/net/wimax/Kconfig
@@ -0,0 +1,17 @@
1#
2# WiMAX LAN device drivers configuration
3#
4
5
6comment "Enable WiMAX (Networking options) to see the WiMAX drivers"
7 depends on WIMAX = n
8
9if WIMAX
10
11menu "WiMAX Wireless Broadband devices"
12
13source "drivers/net/wimax/i2400m/Kconfig"
14
15endmenu
16
17endif
diff --git a/drivers/net/wimax/Makefile b/drivers/net/wimax/Makefile
new file mode 100644
index 000000000000..992bc02bc016
--- /dev/null
+++ b/drivers/net/wimax/Makefile
@@ -0,0 +1,5 @@
1
2obj-$(CONFIG_WIMAX_I2400M) += i2400m/
3
4# (from Sam Ravnborg) force kbuild to create built-in.o
5obj- := dummy.o
diff --git a/drivers/net/wimax/i2400m/Kconfig b/drivers/net/wimax/i2400m/Kconfig
new file mode 100644
index 000000000000..d623b3d99a4b
--- /dev/null
+++ b/drivers/net/wimax/i2400m/Kconfig
@@ -0,0 +1,49 @@
1
2config WIMAX_I2400M
3 tristate
4 depends on WIMAX
5 select FW_LOADER
6
7comment "Enable USB support to see WiMAX USB drivers"
8 depends on USB = n
9
10comment "Enable MMC support to see WiMAX SDIO drivers"
11 depends on MMC = n
12
13config WIMAX_I2400M_USB
14 tristate "Intel Wireless WiMAX Connection 2400 over USB (including 5x50)"
15 depends on WIMAX && USB
16 select WIMAX_I2400M
17 help
18 Select if you have a device based on the Intel WiMAX
19 Connection 2400 over USB (like any of the Intel Wireless
20 WiMAX/WiFi Link 5x50 series).
21
22 If unsure, it is safe to select M (module).
23
24config WIMAX_I2400M_SDIO
25 tristate "Intel Wireless WiMAX Connection 2400 over SDIO"
26 depends on WIMAX && MMC
27 select WIMAX_I2400M
28 help
29 Select if you have a device based on the Intel WiMAX
30 Connection 2400 over SDIO.
31
32 If unsure, it is safe to select M (module).
33
34config WIMAX_I2400M_DEBUG_LEVEL
35 int "WiMAX i2400m debug level"
36 depends on WIMAX_I2400M
37 default 8
38 help
39
40 Select the maximum debug verbosity level to be compiled into
41 the WiMAX i2400m driver code.
42
43 By default, this is disabled at runtime and can be
44 selectively enabled at runtime for different parts of the
45 code using the sysfs debug-levels file.
46
47 If set at zero, this will compile out all the debug code.
48
49 It is recommended that it is left at 8.
diff --git a/drivers/net/wimax/i2400m/Makefile b/drivers/net/wimax/i2400m/Makefile
new file mode 100644
index 000000000000..1696e936cf5a
--- /dev/null
+++ b/drivers/net/wimax/i2400m/Makefile
@@ -0,0 +1,29 @@
1
2obj-$(CONFIG_WIMAX_I2400M) += i2400m.o
3obj-$(CONFIG_WIMAX_I2400M_USB) += i2400m-usb.o
4obj-$(CONFIG_WIMAX_I2400M_SDIO) += i2400m-sdio.o
5
6i2400m-y := \
7 control.o \
8 driver.o \
9 fw.o \
10 op-rfkill.o \
11 netdev.o \
12 tx.o \
13 rx.o
14
15i2400m-$(CONFIG_DEBUG_FS) += debugfs.o
16
17i2400m-usb-y := \
18 usb-fw.o \
19 usb-notif.o \
20 usb-tx.o \
21 usb-rx.o \
22 usb.o
23
24
25i2400m-sdio-y := \
26 sdio.o \
27 sdio-tx.o \
28 sdio-fw.o \
29 sdio-rx.o
diff --git a/drivers/net/wimax/i2400m/control.c b/drivers/net/wimax/i2400m/control.c
new file mode 100644
index 000000000000..d3d37fed6893
--- /dev/null
+++ b/drivers/net/wimax/i2400m/control.c
@@ -0,0 +1,1291 @@
1/*
2 * Intel Wireless WiMAX Connection 2400m
3 * Miscellaneous control functions for managing the device
4 *
5 *
6 * Copyright (C) 2007-2008 Intel Corporation. All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 *
12 * * Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * * Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in
16 * the documentation and/or other materials provided with the
17 * distribution.
18 * * Neither the name of Intel Corporation nor the names of its
19 * contributors may be used to endorse or promote products derived
20 * from this software without specific prior written permission.
21 *
22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 *
34 *
35 * Intel Corporation <linux-wimax@intel.com>
36 * Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
37 * - Initial implementation
38 *
39 * This is a collection of functions used to control the device (plus
40 * a few helpers).
41 *
42 * There are utilities for handling TLV buffers, hooks on the device's
43 * reports to act on device changes of state [i2400m_report_hook()],
44 * on acks to commands [i2400m_msg_ack_hook()], a helper for sending
45 * commands to the device and blocking until a reply arrives
46 * [i2400m_msg_to_dev()], a few high level commands for manipulating
47 * the device state, powersving mode and configuration plus the
48 * routines to setup the device once communication is stablished with
49 * it [i2400m_dev_initialize()].
50 *
51 * ROADMAP
52 *
53 * i2400m_dev_initalize() Called by i2400m_dev_start()
54 * i2400m_set_init_config()
55 * i2400m_firmware_check()
56 * i2400m_cmd_get_state()
57 * i2400m_dev_shutdown() Called by i2400m_dev_stop()
58 * i2400m->bus_reset()
59 *
60 * i2400m_{cmd,get,set}_*()
61 * i2400m_msg_to_dev()
62 * i2400m_msg_check_status()
63 *
64 * i2400m_report_hook() Called on reception of an event
65 * i2400m_report_state_hook()
66 * i2400m_tlv_buffer_walk()
67 * i2400m_tlv_match()
68 * i2400m_report_tlv_system_state()
69 * i2400m_report_tlv_rf_switches_status()
70 * i2400m_report_tlv_media_status()
71 * i2400m_cmd_enter_powersave()
72 *
73 * i2400m_msg_ack_hook() Called on reception of a reply to a
74 * command, get or set
75 */
76
77#include <stdarg.h>
78#include "i2400m.h"
79#include <linux/kernel.h>
80#include <linux/wimax/i2400m.h>
81
82
83#define D_SUBMODULE control
84#include "debug-levels.h"
85
86
87/*
88 * Return if a TLV is of a give type and size
89 *
90 * @tlv_hdr: pointer to the TLV
91 * @tlv_type: type of the TLV we are looking for
92 * @tlv_size: expected size of the TLV we are looking for (if -1,
93 * don't check the size). This includes the header
94 * Returns: 0 if the TLV matches
95 * < 0 if it doesn't match at all
96 * > 0 total TLV + payload size, if the type matches, but not
97 * the size
98 */
99static
100ssize_t i2400m_tlv_match(const struct i2400m_tlv_hdr *tlv,
101 enum i2400m_tlv tlv_type, ssize_t tlv_size)
102{
103 if (le16_to_cpu(tlv->type) != tlv_type) /* Not our type? skip */
104 return -1;
105 if (tlv_size != -1
106 && le16_to_cpu(tlv->length) + sizeof(*tlv) != tlv_size) {
107 size_t size = le16_to_cpu(tlv->length) + sizeof(*tlv);
108 printk(KERN_WARNING "W: tlv type 0x%x mismatched because of "
109 "size (got %zu vs %zu expected)\n",
110 tlv_type, size, tlv_size);
111 return size;
112 }
113 return 0;
114}
115
116
117/*
118 * Given a buffer of TLVs, iterate over them
119 *
120 * @i2400m: device instance
121 * @tlv_buf: pointer to the beginning of the TLV buffer
122 * @buf_size: buffer size in bytes
123 * @tlv_pos: seek position; this is assumed to be a pointer returned
124 * by i2400m_tlv_buffer_walk() [and thus, validated]. The
125 * TLV returned will be the one following this one.
126 *
127 * Usage:
128 *
129 * tlv_itr = NULL;
130 * while (tlv_itr = i2400m_tlv_buffer_walk(i2400m, buf, size, tlv_itr)) {
131 * ...
132 * // Do stuff with tlv_itr, DON'T MODIFY IT
133 * ...
134 * }
135 */
136static
137const struct i2400m_tlv_hdr *i2400m_tlv_buffer_walk(
138 struct i2400m *i2400m,
139 const void *tlv_buf, size_t buf_size,
140 const struct i2400m_tlv_hdr *tlv_pos)
141{
142 struct device *dev = i2400m_dev(i2400m);
143 const struct i2400m_tlv_hdr *tlv_top = tlv_buf + buf_size;
144 size_t offset, length, avail_size;
145 unsigned type;
146
147 if (tlv_pos == NULL) /* Take the first one? */
148 tlv_pos = tlv_buf;
149 else /* Nope, the next one */
150 tlv_pos = (void *) tlv_pos
151 + le16_to_cpu(tlv_pos->length) + sizeof(*tlv_pos);
152 if (tlv_pos == tlv_top) { /* buffer done */
153 tlv_pos = NULL;
154 goto error_beyond_end;
155 }
156 if (tlv_pos > tlv_top) {
157 tlv_pos = NULL;
158 WARN_ON(1);
159 goto error_beyond_end;
160 }
161 offset = (void *) tlv_pos - (void *) tlv_buf;
162 avail_size = buf_size - offset;
163 if (avail_size < sizeof(*tlv_pos)) {
164 dev_err(dev, "HW BUG? tlv_buf %p [%zu bytes], tlv @%zu: "
165 "short header\n", tlv_buf, buf_size, offset);
166 goto error_short_header;
167 }
168 type = le16_to_cpu(tlv_pos->type);
169 length = le16_to_cpu(tlv_pos->length);
170 if (avail_size < sizeof(*tlv_pos) + length) {
171 dev_err(dev, "HW BUG? tlv_buf %p [%zu bytes], "
172 "tlv type 0x%04x @%zu: "
173 "short data (%zu bytes vs %zu needed)\n",
174 tlv_buf, buf_size, type, offset, avail_size,
175 sizeof(*tlv_pos) + length);
176 goto error_short_header;
177 }
178error_short_header:
179error_beyond_end:
180 return tlv_pos;
181}
182
183
184/*
185 * Find a TLV in a buffer of sequential TLVs
186 *
187 * @i2400m: device descriptor
188 * @tlv_hdr: pointer to the first TLV in the sequence
189 * @size: size of the buffer in bytes; all TLVs are assumed to fit
190 * fully in the buffer (otherwise we'll complain).
191 * @tlv_type: type of the TLV we are looking for
192 * @tlv_size: expected size of the TLV we are looking for (if -1,
193 * don't check the size). This includes the header
194 *
195 * Returns: NULL if the TLV is not found, otherwise a pointer to
196 * it. If the sizes don't match, an error is printed and NULL
197 * returned.
198 */
199static
200const struct i2400m_tlv_hdr *i2400m_tlv_find(
201 struct i2400m *i2400m,
202 const struct i2400m_tlv_hdr *tlv_hdr, size_t size,
203 enum i2400m_tlv tlv_type, ssize_t tlv_size)
204{
205 ssize_t match;
206 struct device *dev = i2400m_dev(i2400m);
207 const struct i2400m_tlv_hdr *tlv = NULL;
208 while ((tlv = i2400m_tlv_buffer_walk(i2400m, tlv_hdr, size, tlv))) {
209 match = i2400m_tlv_match(tlv, tlv_type, tlv_size);
210 if (match == 0) /* found it :) */
211 break;
212 if (match > 0)
213 dev_warn(dev, "TLV type 0x%04x found with size "
214 "mismatch (%zu vs %zu needed)\n",
215 tlv_type, match, tlv_size);
216 }
217 return tlv;
218}
219
220
221static const struct
222{
223 char *msg;
224 int errno;
225} ms_to_errno[I2400M_MS_MAX] = {
226 [I2400M_MS_DONE_OK] = { "", 0 },
227 [I2400M_MS_DONE_IN_PROGRESS] = { "", 0 },
228 [I2400M_MS_INVALID_OP] = { "invalid opcode", -ENOSYS },
229 [I2400M_MS_BAD_STATE] = { "invalid state", -EILSEQ },
230 [I2400M_MS_ILLEGAL_VALUE] = { "illegal value", -EINVAL },
231 [I2400M_MS_MISSING_PARAMS] = { "missing parameters", -ENOMSG },
232 [I2400M_MS_VERSION_ERROR] = { "bad version", -EIO },
233 [I2400M_MS_ACCESSIBILITY_ERROR] = { "accesibility error", -EIO },
234 [I2400M_MS_BUSY] = { "busy", -EBUSY },
235 [I2400M_MS_CORRUPTED_TLV] = { "corrupted TLV", -EILSEQ },
236 [I2400M_MS_UNINITIALIZED] = { "not unitialized", -EILSEQ },
237 [I2400M_MS_UNKNOWN_ERROR] = { "unknown error", -EIO },
238 [I2400M_MS_PRODUCTION_ERROR] = { "production error", -EIO },
239 [I2400M_MS_NO_RF] = { "no RF", -EIO },
240 [I2400M_MS_NOT_READY_FOR_POWERSAVE] =
241 { "not ready for powersave", -EACCES },
242 [I2400M_MS_THERMAL_CRITICAL] = { "thermal critical", -EL3HLT },
243};
244
245
246/*
247 * i2400m_msg_check_status - translate a message's status code
248 *
249 * @i2400m: device descriptor
250 * @l3l4_hdr: message header
251 * @strbuf: buffer to place a formatted error message (unless NULL).
252 * @strbuf_size: max amount of available space; larger messages will
253 * be truncated.
254 *
255 * Returns: errno code corresponding to the status code in @l3l4_hdr
256 * and a message in @strbuf describing the error.
257 */
258int i2400m_msg_check_status(const struct i2400m_l3l4_hdr *l3l4_hdr,
259 char *strbuf, size_t strbuf_size)
260{
261 int result;
262 enum i2400m_ms status = le16_to_cpu(l3l4_hdr->status);
263 const char *str;
264
265 if (status == 0)
266 return 0;
267 if (status > ARRAY_SIZE(ms_to_errno)) {
268 str = "unknown status code";
269 result = -EBADR;
270 } else {
271 str = ms_to_errno[status].msg;
272 result = ms_to_errno[status].errno;
273 }
274 if (strbuf)
275 snprintf(strbuf, strbuf_size, "%s (%d)", str, status);
276 return result;
277}
278
279
280/*
281 * Act on a TLV System State reported by the device
282 *
283 * @i2400m: device descriptor
284 * @ss: validated System State TLV
285 */
286static
287void i2400m_report_tlv_system_state(struct i2400m *i2400m,
288 const struct i2400m_tlv_system_state *ss)
289{
290 struct device *dev = i2400m_dev(i2400m);
291 struct wimax_dev *wimax_dev = &i2400m->wimax_dev;
292 enum i2400m_system_state i2400m_state = le32_to_cpu(ss->state);
293
294 d_fnstart(3, dev, "(i2400m %p ss %p [%u])\n", i2400m, ss, i2400m_state);
295
296 if (unlikely(i2400m->ready == 0)) /* act if up */
297 goto out;
298 if (i2400m->state != i2400m_state) {
299 i2400m->state = i2400m_state;
300 wake_up_all(&i2400m->state_wq);
301 }
302 switch (i2400m_state) {
303 case I2400M_SS_UNINITIALIZED:
304 case I2400M_SS_INIT:
305 case I2400M_SS_CONFIG:
306 case I2400M_SS_PRODUCTION:
307 wimax_state_change(wimax_dev, WIMAX_ST_UNINITIALIZED);
308 break;
309
310 case I2400M_SS_RF_OFF:
311 case I2400M_SS_RF_SHUTDOWN:
312 wimax_state_change(wimax_dev, WIMAX_ST_RADIO_OFF);
313 break;
314
315 case I2400M_SS_READY:
316 case I2400M_SS_STANDBY:
317 case I2400M_SS_SLEEPACTIVE:
318 wimax_state_change(wimax_dev, WIMAX_ST_READY);
319 break;
320
321 case I2400M_SS_CONNECTING:
322 case I2400M_SS_WIMAX_CONNECTED:
323 wimax_state_change(wimax_dev, WIMAX_ST_READY);
324 break;
325
326 case I2400M_SS_SCAN:
327 case I2400M_SS_OUT_OF_ZONE:
328 wimax_state_change(wimax_dev, WIMAX_ST_SCANNING);
329 break;
330
331 case I2400M_SS_IDLE:
332 d_printf(1, dev, "entering BS-negotiated idle mode\n");
333 case I2400M_SS_DISCONNECTING:
334 case I2400M_SS_DATA_PATH_CONNECTED:
335 wimax_state_change(wimax_dev, WIMAX_ST_CONNECTED);
336 break;
337
338 default:
339 /* Huh? just in case, shut it down */
340 dev_err(dev, "HW BUG? unknown state %u: shutting down\n",
341 i2400m_state);
342 i2400m->bus_reset(i2400m, I2400M_RT_WARM);
343 break;
344 };
345out:
346 d_fnend(3, dev, "(i2400m %p ss %p [%u]) = void\n",
347 i2400m, ss, i2400m_state);
348}
349
350
351/*
352 * Parse and act on a TLV Media Status sent by the device
353 *
354 * @i2400m: device descriptor
355 * @ms: validated Media Status TLV
356 *
357 * This will set the carrier up on down based on the device's link
358 * report. This is done asides of what the WiMAX stack does based on
359 * the device's state as sometimes we need to do a link-renew (the BS
360 * wants us to renew a DHCP lease, for example).
361 *
362 * In fact, doc says that everytime we get a link-up, we should do a
363 * DHCP negotiation...
364 */
365static
366void i2400m_report_tlv_media_status(struct i2400m *i2400m,
367 const struct i2400m_tlv_media_status *ms)
368{
369 struct device *dev = i2400m_dev(i2400m);
370 struct wimax_dev *wimax_dev = &i2400m->wimax_dev;
371 struct net_device *net_dev = wimax_dev->net_dev;
372 enum i2400m_media_status status = le32_to_cpu(ms->media_status);
373
374 d_fnstart(3, dev, "(i2400m %p ms %p [%u])\n", i2400m, ms, status);
375
376 if (unlikely(i2400m->ready == 0)) /* act if up */
377 goto out;
378 switch (status) {
379 case I2400M_MEDIA_STATUS_LINK_UP:
380 netif_carrier_on(net_dev);
381 break;
382 case I2400M_MEDIA_STATUS_LINK_DOWN:
383 netif_carrier_off(net_dev);
384 break;
385 /*
386 * This is the network telling us we need to retrain the DHCP
387 * lease -- so far, we are trusting the WiMAX Network Service
388 * in user space to pick this up and poke the DHCP client.
389 */
390 case I2400M_MEDIA_STATUS_LINK_RENEW:
391 netif_carrier_on(net_dev);
392 break;
393 default:
394 dev_err(dev, "HW BUG? unknown media status %u\n",
395 status);
396 };
397out:
398 d_fnend(3, dev, "(i2400m %p ms %p [%u]) = void\n",
399 i2400m, ms, status);
400}
401
402
403/*
404 * Parse a 'state report' and extract carrier on/off information
405 *
406 * @i2400m: device descriptor
407 * @l3l4_hdr: pointer to message; it has been already validated for
408 * consistent size.
409 * @size: size of the message (header + payload). The header length
410 * declaration is assumed to be congruent with @size (as in
411 * sizeof(*l3l4_hdr) + l3l4_hdr->length == size)
412 *
413 * Extract from the report state the system state TLV and infer from
414 * there if we have a carrier or not. Update our local state and tell
415 * netdev.
416 *
417 * When setting the carrier, it's fine to set OFF twice (for example),
418 * as netif_carrier_off() will not generate two OFF events (just on
419 * the transitions).
420 */
421static
422void i2400m_report_state_hook(struct i2400m *i2400m,
423 const struct i2400m_l3l4_hdr *l3l4_hdr,
424 size_t size, const char *tag)
425{
426 struct device *dev = i2400m_dev(i2400m);
427 const struct i2400m_tlv_hdr *tlv;
428 const struct i2400m_tlv_system_state *ss;
429 const struct i2400m_tlv_rf_switches_status *rfss;
430 const struct i2400m_tlv_media_status *ms;
431 size_t tlv_size = le16_to_cpu(l3l4_hdr->length);
432
433 d_fnstart(4, dev, "(i2400m %p, l3l4_hdr %p, size %zu, %s)\n",
434 i2400m, l3l4_hdr, size, tag);
435 tlv = NULL;
436
437 while ((tlv = i2400m_tlv_buffer_walk(i2400m, &l3l4_hdr->pl,
438 tlv_size, tlv))) {
439 if (0 == i2400m_tlv_match(tlv, I2400M_TLV_SYSTEM_STATE,
440 sizeof(*ss))) {
441 ss = container_of(tlv, typeof(*ss), hdr);
442 d_printf(2, dev, "%s: system state TLV "
443 "found (0x%04x), state 0x%08x\n",
444 tag, I2400M_TLV_SYSTEM_STATE,
445 le32_to_cpu(ss->state));
446 i2400m_report_tlv_system_state(i2400m, ss);
447 }
448 if (0 == i2400m_tlv_match(tlv, I2400M_TLV_RF_STATUS,
449 sizeof(*rfss))) {
450 rfss = container_of(tlv, typeof(*rfss), hdr);
451 d_printf(2, dev, "%s: RF status TLV "
452 "found (0x%04x), sw 0x%02x hw 0x%02x\n",
453 tag, I2400M_TLV_RF_STATUS,
454 le32_to_cpu(rfss->sw_rf_switch),
455 le32_to_cpu(rfss->hw_rf_switch));
456 i2400m_report_tlv_rf_switches_status(i2400m, rfss);
457 }
458 if (0 == i2400m_tlv_match(tlv, I2400M_TLV_MEDIA_STATUS,
459 sizeof(*ms))) {
460 ms = container_of(tlv, typeof(*ms), hdr);
461 d_printf(2, dev, "%s: Media Status TLV: %u\n",
462 tag, le32_to_cpu(ms->media_status));
463 i2400m_report_tlv_media_status(i2400m, ms);
464 }
465 }
466 d_fnend(4, dev, "(i2400m %p, l3l4_hdr %p, size %zu, %s) = void\n",
467 i2400m, l3l4_hdr, size, tag);
468}
469
470
471/*
472 * i2400m_report_hook - (maybe) act on a report
473 *
474 * @i2400m: device descriptor
475 * @l3l4_hdr: pointer to message; it has been already validated for
476 * consistent size.
477 * @size: size of the message (header + payload). The header length
478 * declaration is assumed to be congruent with @size (as in
479 * sizeof(*l3l4_hdr) + l3l4_hdr->length == size)
480 *
481 * Extract information we might need (like carrien on/off) from a
482 * device report.
483 */
484void i2400m_report_hook(struct i2400m *i2400m,
485 const struct i2400m_l3l4_hdr *l3l4_hdr, size_t size)
486{
487 struct device *dev = i2400m_dev(i2400m);
488 unsigned msg_type;
489
490 d_fnstart(3, dev, "(i2400m %p l3l4_hdr %p size %zu)\n",
491 i2400m, l3l4_hdr, size);
492 /* Chew on the message, we might need some information from
493 * here */
494 msg_type = le16_to_cpu(l3l4_hdr->type);
495 switch (msg_type) {
496 case I2400M_MT_REPORT_STATE: /* carrier detection... */
497 i2400m_report_state_hook(i2400m,
498 l3l4_hdr, size, "REPORT STATE");
499 break;
500 /* If the device is ready for power save, then ask it to do
501 * it. */
502 case I2400M_MT_REPORT_POWERSAVE_READY: /* zzzzz */
503 if (l3l4_hdr->status == cpu_to_le16(I2400M_MS_DONE_OK)) {
504 d_printf(1, dev, "ready for powersave, requesting\n");
505 i2400m_cmd_enter_powersave(i2400m);
506 }
507 break;
508 };
509 d_fnend(3, dev, "(i2400m %p l3l4_hdr %p size %zu) = void\n",
510 i2400m, l3l4_hdr, size);
511}
512
513
514/*
515 * i2400m_msg_ack_hook - process cmd/set/get ack for internal status
516 *
517 * @i2400m: device descriptor
518 * @l3l4_hdr: pointer to message; it has been already validated for
519 * consistent size.
520 * @size: size of the message
521 *
522 * Extract information we might need from acks to commands and act on
523 * it. This is akin to i2400m_report_hook(). Note most of this
524 * processing should be done in the function that calls the
525 * command. This is here for some cases where it can't happen...
526 */
527void i2400m_msg_ack_hook(struct i2400m *i2400m,
528 const struct i2400m_l3l4_hdr *l3l4_hdr, size_t size)
529{
530 int result;
531 struct device *dev = i2400m_dev(i2400m);
532 unsigned ack_type, ack_status;
533 char strerr[32];
534
535 /* Chew on the message, we might need some information from
536 * here */
537 ack_type = le16_to_cpu(l3l4_hdr->type);
538 ack_status = le16_to_cpu(l3l4_hdr->status);
539 switch (ack_type) {
540 case I2400M_MT_CMD_ENTER_POWERSAVE:
541 /* This is just left here for the sake of example, as
542 * the processing is done somewhere else. */
543 if (0) {
544 result = i2400m_msg_check_status(
545 l3l4_hdr, strerr, sizeof(strerr));
546 if (result >= 0)
547 d_printf(1, dev, "ready for power save: %zd\n",
548 size);
549 }
550 break;
551 };
552 return;
553}
554
555
556/*
557 * i2400m_msg_size_check() - verify message size and header are congruent
558 *
559 * It is ok if the total message size is larger than the expected
560 * size, as there can be padding.
561 */
562int i2400m_msg_size_check(struct i2400m *i2400m,
563 const struct i2400m_l3l4_hdr *l3l4_hdr,
564 size_t msg_size)
565{
566 int result;
567 struct device *dev = i2400m_dev(i2400m);
568 size_t expected_size;
569 d_fnstart(4, dev, "(i2400m %p l3l4_hdr %p msg_size %zu)\n",
570 i2400m, l3l4_hdr, msg_size);
571 if (msg_size < sizeof(*l3l4_hdr)) {
572 dev_err(dev, "bad size for message header "
573 "(expected at least %zu, got %zu)\n",
574 (size_t) sizeof(*l3l4_hdr), msg_size);
575 result = -EIO;
576 goto error_hdr_size;
577 }
578 expected_size = le16_to_cpu(l3l4_hdr->length) + sizeof(*l3l4_hdr);
579 if (msg_size < expected_size) {
580 dev_err(dev, "bad size for message code 0x%04x (expected %zu, "
581 "got %zu)\n", le16_to_cpu(l3l4_hdr->type),
582 expected_size, msg_size);
583 result = -EIO;
584 } else
585 result = 0;
586error_hdr_size:
587 d_fnend(4, dev,
588 "(i2400m %p l3l4_hdr %p msg_size %zu) = %d\n",
589 i2400m, l3l4_hdr, msg_size, result);
590 return result;
591}
592
593
594
595/*
596 * Cancel a wait for a command ACK
597 *
598 * @i2400m: device descriptor
599 * @code: [negative] errno code to cancel with (don't use
600 * -EINPROGRESS)
601 *
602 * If there is an ack already filled out, free it.
603 */
604void i2400m_msg_to_dev_cancel_wait(struct i2400m *i2400m, int code)
605{
606 struct sk_buff *ack_skb;
607 unsigned long flags;
608
609 spin_lock_irqsave(&i2400m->rx_lock, flags);
610 ack_skb = i2400m->ack_skb;
611 if (ack_skb && !IS_ERR(ack_skb))
612 kfree(ack_skb);
613 i2400m->ack_skb = ERR_PTR(code);
614 spin_unlock_irqrestore(&i2400m->rx_lock, flags);
615}
616
617
618/**
619 * i2400m_msg_to_dev - Send a control message to the device and get a response
620 *
621 * @i2400m: device descriptor
622 *
623 * @msg_skb: an skb *
624 *
625 * @buf: pointer to the buffer containing the message to be sent; it
626 * has to start with a &struct i2400M_l3l4_hdr and then
627 * followed by the payload. Once this function returns, the
628 * buffer can be reused.
629 *
630 * @buf_len: buffer size
631 *
632 * Returns:
633 *
634 * Pointer to skb containing the ack message. You need to check the
635 * pointer with IS_ERR(), as it might be an error code. Error codes
636 * could happen because:
637 *
638 * - the message wasn't formatted correctly
639 * - couldn't send the message
640 * - failed waiting for a response
641 * - the ack message wasn't formatted correctly
642 *
643 * The returned skb has been allocated with wimax_msg_to_user_alloc(),
644 * it contains the reponse in a netlink attribute and is ready to be
645 * passed up to user space with wimax_msg_to_user_send(). To access
646 * the payload and its length, use wimax_msg_{data,len}() on the skb.
647 *
648 * The skb has to be freed with kfree_skb() once done.
649 *
650 * Description:
651 *
652 * This function delivers a message/command to the device and waits
653 * for an ack to be received. The format is described in
654 * linux/wimax/i2400m.h. In summary, a command/get/set is followed by an
655 * ack.
656 *
657 * This function will not check the ack status, that's left up to the
658 * caller. Once done with the ack skb, it has to be kfree_skb()ed.
659 *
660 * The i2400m handles only one message at the same time, thus we need
661 * the mutex to exclude other players.
662 *
663 * We write the message and then wait for an answer to come back. The
664 * RX path intercepts control messages and handles them in
665 * i2400m_rx_ctl(). Reports (notifications) are (maybe) processed
666 * locally and then forwarded (as needed) to user space on the WiMAX
667 * stack message pipe. Acks are saved and passed back to us through an
668 * skb in i2400m->ack_skb which is ready to be given to generic
669 * netlink if need be.
670 */
671struct sk_buff *i2400m_msg_to_dev(struct i2400m *i2400m,
672 const void *buf, size_t buf_len)
673{
674 int result;
675 struct device *dev = i2400m_dev(i2400m);
676 const struct i2400m_l3l4_hdr *msg_l3l4_hdr;
677 struct sk_buff *ack_skb;
678 const struct i2400m_l3l4_hdr *ack_l3l4_hdr;
679 size_t ack_len;
680 int ack_timeout;
681 unsigned msg_type;
682 unsigned long flags;
683
684 d_fnstart(3, dev, "(i2400m %p buf %p len %zu)\n",
685 i2400m, buf, buf_len);
686
687 if (i2400m->boot_mode)
688 return ERR_PTR(-ENODEV);
689
690 msg_l3l4_hdr = buf;
691 /* Check msg & payload consistency */
692 result = i2400m_msg_size_check(i2400m, msg_l3l4_hdr, buf_len);
693 if (result < 0)
694 goto error_bad_msg;
695 msg_type = le16_to_cpu(msg_l3l4_hdr->type);
696 d_printf(1, dev, "CMD/GET/SET 0x%04x %zu bytes\n",
697 msg_type, buf_len);
698 d_dump(2, dev, buf, buf_len);
699
700 /* Setup the completion, ack_skb ("we are waiting") and send
701 * the message to the device */
702 mutex_lock(&i2400m->msg_mutex);
703 spin_lock_irqsave(&i2400m->rx_lock, flags);
704 i2400m->ack_skb = ERR_PTR(-EINPROGRESS);
705 spin_unlock_irqrestore(&i2400m->rx_lock, flags);
706 init_completion(&i2400m->msg_completion);
707 result = i2400m_tx(i2400m, buf, buf_len, I2400M_PT_CTRL);
708 if (result < 0) {
709 dev_err(dev, "can't send message 0x%04x: %d\n",
710 le16_to_cpu(msg_l3l4_hdr->type), result);
711 goto error_tx;
712 }
713
714 /* Some commands take longer to execute because of crypto ops,
715 * so we give them some more leeway on timeout */
716 switch (msg_type) {
717 case I2400M_MT_GET_TLS_OPERATION_RESULT:
718 case I2400M_MT_CMD_SEND_EAP_RESPONSE:
719 ack_timeout = 5 * HZ;
720 break;
721 default:
722 ack_timeout = HZ;
723 };
724
725 /* The RX path in rx.c will put any response for this message
726 * in i2400m->ack_skb and wake us up. If we cancel the wait,
727 * we need to change the value of i2400m->ack_skb to something
728 * not -EINPROGRESS so RX knows there is no one waiting. */
729 result = wait_for_completion_interruptible_timeout(
730 &i2400m->msg_completion, ack_timeout);
731 if (result == 0) {
732 dev_err(dev, "timeout waiting for reply to message 0x%04x\n",
733 msg_type);
734 result = -ETIMEDOUT;
735 i2400m_msg_to_dev_cancel_wait(i2400m, result);
736 goto error_wait_for_completion;
737 } else if (result < 0) {
738 dev_err(dev, "error waiting for reply to message 0x%04x: %d\n",
739 msg_type, result);
740 i2400m_msg_to_dev_cancel_wait(i2400m, result);
741 goto error_wait_for_completion;
742 }
743
744 /* Pull out the ack data from i2400m->ack_skb -- see if it is
745 * an error and act accordingly */
746 spin_lock_irqsave(&i2400m->rx_lock, flags);
747 ack_skb = i2400m->ack_skb;
748 if (IS_ERR(ack_skb))
749 result = PTR_ERR(ack_skb);
750 else
751 result = 0;
752 i2400m->ack_skb = NULL;
753 spin_unlock_irqrestore(&i2400m->rx_lock, flags);
754 if (result < 0)
755 goto error_ack_status;
756 ack_l3l4_hdr = wimax_msg_data_len(ack_skb, &ack_len);
757
758 /* Check the ack and deliver it if it is ok */
759 result = i2400m_msg_size_check(i2400m, ack_l3l4_hdr, ack_len);
760 if (result < 0) {
761 dev_err(dev, "HW BUG? reply to message 0x%04x: %d\n",
762 msg_type, result);
763 goto error_bad_ack_len;
764 }
765 if (msg_type != le16_to_cpu(ack_l3l4_hdr->type)) {
766 dev_err(dev, "HW BUG? bad reply 0x%04x to message 0x%04x\n",
767 le16_to_cpu(ack_l3l4_hdr->type), msg_type);
768 result = -EIO;
769 goto error_bad_ack_type;
770 }
771 i2400m_msg_ack_hook(i2400m, ack_l3l4_hdr, ack_len);
772 mutex_unlock(&i2400m->msg_mutex);
773 d_fnend(3, dev, "(i2400m %p buf %p len %zu) = %p\n",
774 i2400m, buf, buf_len, ack_skb);
775 return ack_skb;
776
777error_bad_ack_type:
778error_bad_ack_len:
779 kfree_skb(ack_skb);
780error_ack_status:
781error_wait_for_completion:
782error_tx:
783 mutex_unlock(&i2400m->msg_mutex);
784error_bad_msg:
785 d_fnend(3, dev, "(i2400m %p buf %p len %zu) = %d\n",
786 i2400m, buf, buf_len, result);
787 return ERR_PTR(result);
788}
789
790
791/*
792 * Definitions for the Enter Power Save command
793 *
794 * The Enter Power Save command requests the device to go into power
795 * saving mode. The device will ack or nak the command depending on it
796 * being ready for it. If it acks, we tell the USB subsystem to
797 *
798 * As well, the device might request to go into power saving mode by
799 * sending a report (REPORT_POWERSAVE_READY), in which case, we issue
800 * this command. The hookups in the RX coder allow
801 */
802enum {
803 I2400M_WAKEUP_ENABLED = 0x01,
804 I2400M_WAKEUP_DISABLED = 0x02,
805 I2400M_TLV_TYPE_WAKEUP_MODE = 144,
806};
807
808struct i2400m_cmd_enter_power_save {
809 struct i2400m_l3l4_hdr hdr;
810 struct i2400m_tlv_hdr tlv;
811 __le32 val;
812} __attribute__((packed));
813
814
815/*
816 * Request entering power save
817 *
818 * This command is (mainly) executed when the device indicates that it
819 * is ready to go into powersave mode via a REPORT_POWERSAVE_READY.
820 */
821int i2400m_cmd_enter_powersave(struct i2400m *i2400m)
822{
823 int result;
824 struct device *dev = i2400m_dev(i2400m);
825 struct sk_buff *ack_skb;
826 struct i2400m_cmd_enter_power_save *cmd;
827 char strerr[32];
828
829 result = -ENOMEM;
830 cmd = kzalloc(sizeof(*cmd), GFP_KERNEL);
831 if (cmd == NULL)
832 goto error_alloc;
833 cmd->hdr.type = cpu_to_le16(I2400M_MT_CMD_ENTER_POWERSAVE);
834 cmd->hdr.length = cpu_to_le16(sizeof(*cmd) - sizeof(cmd->hdr));
835 cmd->hdr.version = cpu_to_le16(I2400M_L3L4_VERSION);
836 cmd->tlv.type = cpu_to_le16(I2400M_TLV_TYPE_WAKEUP_MODE);
837 cmd->tlv.length = cpu_to_le16(sizeof(cmd->val));
838 cmd->val = cpu_to_le32(I2400M_WAKEUP_ENABLED);
839
840 ack_skb = i2400m_msg_to_dev(i2400m, cmd, sizeof(*cmd));
841 result = PTR_ERR(ack_skb);
842 if (IS_ERR(ack_skb)) {
843 dev_err(dev, "Failed to issue 'Enter power save' command: %d\n",
844 result);
845 goto error_msg_to_dev;
846 }
847 result = i2400m_msg_check_status(wimax_msg_data(ack_skb),
848 strerr, sizeof(strerr));
849 if (result == -EACCES)
850 d_printf(1, dev, "Cannot enter power save mode\n");
851 else if (result < 0)
852 dev_err(dev, "'Enter power save' (0x%04x) command failed: "
853 "%d - %s\n", I2400M_MT_CMD_ENTER_POWERSAVE,
854 result, strerr);
855 else
856 d_printf(1, dev, "device ready to power save\n");
857 kfree_skb(ack_skb);
858error_msg_to_dev:
859 kfree(cmd);
860error_alloc:
861 return result;
862}
863EXPORT_SYMBOL_GPL(i2400m_cmd_enter_powersave);
864
865
866/*
867 * Definitions for getting device information
868 */
869enum {
870 I2400M_TLV_DETAILED_DEVICE_INFO = 140
871};
872
873/**
874 * i2400m_get_device_info - Query the device for detailed device information
875 *
876 * @i2400m: device descriptor
877 *
878 * Returns: an skb whose skb->data points to a 'struct
879 * i2400m_tlv_detailed_device_info'. When done, kfree_skb() it. The
880 * skb is *guaranteed* to contain the whole TLV data structure.
881 *
882 * On error, IS_ERR(skb) is true and ERR_PTR(skb) is the error
883 * code.
884 */
885struct sk_buff *i2400m_get_device_info(struct i2400m *i2400m)
886{
887 int result;
888 struct device *dev = i2400m_dev(i2400m);
889 struct sk_buff *ack_skb;
890 struct i2400m_l3l4_hdr *cmd;
891 const struct i2400m_l3l4_hdr *ack;
892 size_t ack_len;
893 const struct i2400m_tlv_hdr *tlv;
894 const struct i2400m_tlv_detailed_device_info *ddi;
895 char strerr[32];
896
897 ack_skb = ERR_PTR(-ENOMEM);
898 cmd = kzalloc(sizeof(*cmd), GFP_KERNEL);
899 if (cmd == NULL)
900 goto error_alloc;
901 cmd->type = cpu_to_le16(I2400M_MT_GET_DEVICE_INFO);
902 cmd->length = 0;
903 cmd->version = cpu_to_le16(I2400M_L3L4_VERSION);
904
905 ack_skb = i2400m_msg_to_dev(i2400m, cmd, sizeof(*cmd));
906 if (IS_ERR(ack_skb)) {
907 dev_err(dev, "Failed to issue 'get device info' command: %ld\n",
908 PTR_ERR(ack_skb));
909 goto error_msg_to_dev;
910 }
911 ack = wimax_msg_data_len(ack_skb, &ack_len);
912 result = i2400m_msg_check_status(ack, strerr, sizeof(strerr));
913 if (result < 0) {
914 dev_err(dev, "'get device info' (0x%04x) command failed: "
915 "%d - %s\n", I2400M_MT_GET_DEVICE_INFO, result,
916 strerr);
917 goto error_cmd_failed;
918 }
919 tlv = i2400m_tlv_find(i2400m, ack->pl, ack_len - sizeof(*ack),
920 I2400M_TLV_DETAILED_DEVICE_INFO, sizeof(*ddi));
921 if (tlv == NULL) {
922 dev_err(dev, "GET DEVICE INFO: "
923 "detailed device info TLV not found (0x%04x)\n",
924 I2400M_TLV_DETAILED_DEVICE_INFO);
925 result = -EIO;
926 goto error_no_tlv;
927 }
928 skb_pull(ack_skb, (void *) tlv - (void *) ack_skb->data);
929error_msg_to_dev:
930 kfree(cmd);
931error_alloc:
932 return ack_skb;
933
934error_no_tlv:
935error_cmd_failed:
936 kfree_skb(ack_skb);
937 kfree(cmd);
938 return ERR_PTR(result);
939}
940
941
942/* Firmware interface versions we support */
943enum {
944 I2400M_HDIv_MAJOR = 9,
945 I2400M_HDIv_MAJOR_2 = 8,
946 I2400M_HDIv_MINOR = 1,
947};
948
949
950/**
951 * i2400m_firmware_check - check firmware versions are compatible with
952 * the driver
953 *
954 * @i2400m: device descriptor
955 *
956 * Returns: 0 if ok, < 0 errno code an error and a message in the
957 * kernel log.
958 *
959 * Long function, but quite simple; first chunk launches the command
960 * and double checks the reply for the right TLV. Then we process the
961 * TLV (where the meat is).
962 */
963int i2400m_firmware_check(struct i2400m *i2400m)
964{
965 int result;
966 struct device *dev = i2400m_dev(i2400m);
967 struct sk_buff *ack_skb;
968 struct i2400m_l3l4_hdr *cmd;
969 const struct i2400m_l3l4_hdr *ack;
970 size_t ack_len;
971 const struct i2400m_tlv_hdr *tlv;
972 const struct i2400m_tlv_l4_message_versions *l4mv;
973 char strerr[32];
974 unsigned major, minor, branch;
975
976 result = -ENOMEM;
977 cmd = kzalloc(sizeof(*cmd), GFP_KERNEL);
978 if (cmd == NULL)
979 goto error_alloc;
980 cmd->type = cpu_to_le16(I2400M_MT_GET_LM_VERSION);
981 cmd->length = 0;
982 cmd->version = cpu_to_le16(I2400M_L3L4_VERSION);
983
984 ack_skb = i2400m_msg_to_dev(i2400m, cmd, sizeof(*cmd));
985 if (IS_ERR(ack_skb)) {
986 result = PTR_ERR(ack_skb);
987 dev_err(dev, "Failed to issue 'get lm version' command: %-d\n",
988 result);
989 goto error_msg_to_dev;
990 }
991 ack = wimax_msg_data_len(ack_skb, &ack_len);
992 result = i2400m_msg_check_status(ack, strerr, sizeof(strerr));
993 if (result < 0) {
994 dev_err(dev, "'get lm version' (0x%04x) command failed: "
995 "%d - %s\n", I2400M_MT_GET_LM_VERSION, result,
996 strerr);
997 goto error_cmd_failed;
998 }
999 tlv = i2400m_tlv_find(i2400m, ack->pl, ack_len - sizeof(*ack),
1000 I2400M_TLV_L4_MESSAGE_VERSIONS, sizeof(*l4mv));
1001 if (tlv == NULL) {
1002 dev_err(dev, "get lm version: TLV not found (0x%04x)\n",
1003 I2400M_TLV_L4_MESSAGE_VERSIONS);
1004 result = -EIO;
1005 goto error_no_tlv;
1006 }
1007 l4mv = container_of(tlv, typeof(*l4mv), hdr);
1008 major = le16_to_cpu(l4mv->major);
1009 minor = le16_to_cpu(l4mv->minor);
1010 branch = le16_to_cpu(l4mv->branch);
1011 result = -EINVAL;
1012 if (major != I2400M_HDIv_MAJOR
1013 && major != I2400M_HDIv_MAJOR_2) {
1014 dev_err(dev, "unsupported major fw interface version "
1015 "%u.%u.%u\n", major, minor, branch);
1016 goto error_bad_major;
1017 }
1018 if (major == I2400M_HDIv_MAJOR_2)
1019 dev_err(dev, "deprecated major fw interface version "
1020 "%u.%u.%u\n", major, minor, branch);
1021 result = 0;
1022 if (minor != I2400M_HDIv_MINOR)
1023 dev_warn(dev, "untested minor fw firmware version %u.%u.%u\n",
1024 major, minor, branch);
1025error_bad_major:
1026 dev_info(dev, "firmware interface version %u.%u.%u\n",
1027 major, minor, branch);
1028error_no_tlv:
1029error_cmd_failed:
1030 kfree_skb(ack_skb);
1031error_msg_to_dev:
1032 kfree(cmd);
1033error_alloc:
1034 return result;
1035}
1036
1037
1038/*
1039 * Send an DoExitIdle command to the device to ask it to go out of
1040 * basestation-idle mode.
1041 *
1042 * @i2400m: device descriptor
1043 *
1044 * This starts a renegotiation with the basestation that might involve
1045 * another crypto handshake with user space.
1046 *
1047 * Returns: 0 if ok, < 0 errno code on error.
1048 */
1049int i2400m_cmd_exit_idle(struct i2400m *i2400m)
1050{
1051 int result;
1052 struct device *dev = i2400m_dev(i2400m);
1053 struct sk_buff *ack_skb;
1054 struct i2400m_l3l4_hdr *cmd;
1055 char strerr[32];
1056
1057 result = -ENOMEM;
1058 cmd = kzalloc(sizeof(*cmd), GFP_KERNEL);
1059 if (cmd == NULL)
1060 goto error_alloc;
1061 cmd->type = cpu_to_le16(I2400M_MT_CMD_EXIT_IDLE);
1062 cmd->length = 0;
1063 cmd->version = cpu_to_le16(I2400M_L3L4_VERSION);
1064
1065 ack_skb = i2400m_msg_to_dev(i2400m, cmd, sizeof(*cmd));
1066 result = PTR_ERR(ack_skb);
1067 if (IS_ERR(ack_skb)) {
1068 dev_err(dev, "Failed to issue 'exit idle' command: %d\n",
1069 result);
1070 goto error_msg_to_dev;
1071 }
1072 result = i2400m_msg_check_status(wimax_msg_data(ack_skb),
1073 strerr, sizeof(strerr));
1074 kfree_skb(ack_skb);
1075error_msg_to_dev:
1076 kfree(cmd);
1077error_alloc:
1078 return result;
1079
1080}
1081
1082
1083/*
1084 * Query the device for its state, update the WiMAX stack's idea of it
1085 *
1086 * @i2400m: device descriptor
1087 *
1088 * Returns: 0 if ok, < 0 errno code on error.
1089 *
1090 * Executes a 'Get State' command and parses the returned
1091 * TLVs.
1092 *
1093 * Because this is almost identical to a 'Report State', we use
1094 * i2400m_report_state_hook() to parse the answer. This will set the
1095 * carrier state, as well as the RF Kill switches state.
1096 */
1097int i2400m_cmd_get_state(struct i2400m *i2400m)
1098{
1099 int result;
1100 struct device *dev = i2400m_dev(i2400m);
1101 struct sk_buff *ack_skb;
1102 struct i2400m_l3l4_hdr *cmd;
1103 const struct i2400m_l3l4_hdr *ack;
1104 size_t ack_len;
1105 char strerr[32];
1106
1107 result = -ENOMEM;
1108 cmd = kzalloc(sizeof(*cmd), GFP_KERNEL);
1109 if (cmd == NULL)
1110 goto error_alloc;
1111 cmd->type = cpu_to_le16(I2400M_MT_GET_STATE);
1112 cmd->length = 0;
1113 cmd->version = cpu_to_le16(I2400M_L3L4_VERSION);
1114
1115 ack_skb = i2400m_msg_to_dev(i2400m, cmd, sizeof(*cmd));
1116 if (IS_ERR(ack_skb)) {
1117 dev_err(dev, "Failed to issue 'get state' command: %ld\n",
1118 PTR_ERR(ack_skb));
1119 result = PTR_ERR(ack_skb);
1120 goto error_msg_to_dev;
1121 }
1122 ack = wimax_msg_data_len(ack_skb, &ack_len);
1123 result = i2400m_msg_check_status(ack, strerr, sizeof(strerr));
1124 if (result < 0) {
1125 dev_err(dev, "'get state' (0x%04x) command failed: "
1126 "%d - %s\n", I2400M_MT_GET_STATE, result, strerr);
1127 goto error_cmd_failed;
1128 }
1129 i2400m_report_state_hook(i2400m, ack, ack_len - sizeof(*ack),
1130 "GET STATE");
1131 result = 0;
1132 kfree_skb(ack_skb);
1133error_cmd_failed:
1134error_msg_to_dev:
1135 kfree(cmd);
1136error_alloc:
1137 return result;
1138}
1139EXPORT_SYMBOL_GPL(i2400m_cmd_get_state);
1140
1141
1142/**
1143 * Set basic configuration settings
1144 *
1145 * @i2400m: device descriptor
1146 * @args: array of pointers to the TLV headers to send for
1147 * configuration (each followed by its payload).
1148 * TLV headers and payloads must be properly initialized, with the
1149 * right endianess (LE).
1150 * @arg_size: number of pointers in the @args array
1151 */
1152int i2400m_set_init_config(struct i2400m *i2400m,
1153 const struct i2400m_tlv_hdr **arg, size_t args)
1154{
1155 int result;
1156 struct device *dev = i2400m_dev(i2400m);
1157 struct sk_buff *ack_skb;
1158 struct i2400m_l3l4_hdr *cmd;
1159 char strerr[32];
1160 unsigned argc, argsize, tlv_size;
1161 const struct i2400m_tlv_hdr *tlv_hdr;
1162 void *buf, *itr;
1163
1164 d_fnstart(3, dev, "(i2400m %p arg %p args %zu)\n", i2400m, arg, args);
1165 result = 0;
1166 if (args == 0)
1167 goto none;
1168 /* Compute the size of all the TLVs, so we can alloc a
1169 * contiguous command block to copy them. */
1170 argsize = 0;
1171 for (argc = 0; argc < args; argc++) {
1172 tlv_hdr = arg[argc];
1173 argsize += sizeof(*tlv_hdr) + le16_to_cpu(tlv_hdr->length);
1174 }
1175 WARN_ON(argc >= 9); /* As per hw spec */
1176
1177 /* Alloc the space for the command and TLVs*/
1178 result = -ENOMEM;
1179 buf = kzalloc(sizeof(*cmd) + argsize, GFP_KERNEL);
1180 if (buf == NULL)
1181 goto error_alloc;
1182 cmd = buf;
1183 cmd->type = cpu_to_le16(I2400M_MT_SET_INIT_CONFIG);
1184 cmd->length = cpu_to_le16(argsize);
1185 cmd->version = cpu_to_le16(I2400M_L3L4_VERSION);
1186
1187 /* Copy the TLVs */
1188 itr = buf + sizeof(*cmd);
1189 for (argc = 0; argc < args; argc++) {
1190 tlv_hdr = arg[argc];
1191 tlv_size = sizeof(*tlv_hdr) + le16_to_cpu(tlv_hdr->length);
1192 memcpy(itr, tlv_hdr, tlv_size);
1193 itr += tlv_size;
1194 }
1195
1196 /* Send the message! */
1197 ack_skb = i2400m_msg_to_dev(i2400m, buf, sizeof(*cmd) + argsize);
1198 result = PTR_ERR(ack_skb);
1199 if (IS_ERR(ack_skb)) {
1200 dev_err(dev, "Failed to issue 'init config' command: %d\n",
1201 result);
1202
1203 goto error_msg_to_dev;
1204 }
1205 result = i2400m_msg_check_status(wimax_msg_data(ack_skb),
1206 strerr, sizeof(strerr));
1207 if (result < 0)
1208 dev_err(dev, "'init config' (0x%04x) command failed: %d - %s\n",
1209 I2400M_MT_SET_INIT_CONFIG, result, strerr);
1210 kfree_skb(ack_skb);
1211error_msg_to_dev:
1212 kfree(buf);
1213error_alloc:
1214none:
1215 d_fnend(3, dev, "(i2400m %p arg %p args %zu) = %d\n",
1216 i2400m, arg, args, result);
1217 return result;
1218
1219}
1220EXPORT_SYMBOL_GPL(i2400m_set_init_config);
1221
1222
1223/**
1224 * i2400m_dev_initialize - Initialize the device once communications are ready
1225 *
1226 * @i2400m: device descriptor
1227 *
1228 * Returns: 0 if ok, < 0 errno code on error.
1229 *
1230 * Configures the device to work the way we like it.
1231 *
1232 * At the point of this call, the device is registered with the WiMAX
1233 * and netdev stacks, firmware is uploaded and we can talk to the
1234 * device normally.
1235 */
1236int i2400m_dev_initialize(struct i2400m *i2400m)
1237{
1238 int result;
1239 struct device *dev = i2400m_dev(i2400m);
1240 struct i2400m_tlv_config_idle_parameters idle_params;
1241 const struct i2400m_tlv_hdr *args[9];
1242 unsigned argc = 0;
1243
1244 d_fnstart(3, dev, "(i2400m %p)\n", i2400m);
1245 /* Useless for now...might change */
1246 if (i2400m_idle_mode_disabled) {
1247 idle_params.hdr.type =
1248 cpu_to_le16(I2400M_TLV_CONFIG_IDLE_PARAMETERS);
1249 idle_params.hdr.length = cpu_to_le16(
1250 sizeof(idle_params) - sizeof(idle_params.hdr));
1251 idle_params.idle_timeout = 0;
1252 idle_params.idle_paging_interval = 0;
1253 args[argc++] = &idle_params.hdr;
1254 }
1255 result = i2400m_set_init_config(i2400m, args, argc);
1256 if (result < 0)
1257 goto error;
1258 result = i2400m_firmware_check(i2400m); /* fw versions ok? */
1259 if (result < 0)
1260 goto error;
1261 /*
1262 * Update state: Here it just calls a get state; parsing the
1263 * result (System State TLV and RF Status TLV [done in the rx
1264 * path hooks]) will set the hardware and software RF-Kill
1265 * status.
1266 */
1267 result = i2400m_cmd_get_state(i2400m);
1268error:
1269 d_fnend(3, dev, "(i2400m %p) = %d\n", i2400m, result);
1270 return result;
1271}
1272
1273
1274/**
1275 * i2400m_dev_shutdown - Shutdown a running device
1276 *
1277 * @i2400m: device descriptor
1278 *
1279 * Gracefully stops the device, moving it to the lowest power
1280 * consumption state possible.
1281 */
1282void i2400m_dev_shutdown(struct i2400m *i2400m)
1283{
1284 int result = -ENODEV;
1285 struct device *dev = i2400m_dev(i2400m);
1286
1287 d_fnstart(3, dev, "(i2400m %p)\n", i2400m);
1288 result = i2400m->bus_reset(i2400m, I2400M_RT_WARM);
1289 d_fnend(3, dev, "(i2400m %p) = void [%d]\n", i2400m, result);
1290 return;
1291}
diff --git a/drivers/net/wimax/i2400m/debug-levels.h b/drivers/net/wimax/i2400m/debug-levels.h
new file mode 100644
index 000000000000..3183baa16a52
--- /dev/null
+++ b/drivers/net/wimax/i2400m/debug-levels.h
@@ -0,0 +1,45 @@
1/*
2 * Intel Wireless WiMAX Connection 2400m
3 * Debug levels control file for the i2400m module
4 *
5 *
6 * Copyright (C) 2007-2008 Intel Corporation <linux-wimax@intel.com>
7 * Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License version
11 * 2 as published by the Free Software Foundation.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21 * 02110-1301, USA.
22 */
23#ifndef __debug_levels__h__
24#define __debug_levels__h__
25
26/* Maximum compile and run time debug level for all submodules */
27#define D_MODULENAME i2400m
28#define D_MASTER CONFIG_WIMAX_I2400M_DEBUG_LEVEL
29
30#include <linux/wimax/debug.h>
31
32/* List of all the enabled modules */
33enum d_module {
34 D_SUBMODULE_DECLARE(control),
35 D_SUBMODULE_DECLARE(driver),
36 D_SUBMODULE_DECLARE(debugfs),
37 D_SUBMODULE_DECLARE(fw),
38 D_SUBMODULE_DECLARE(netdev),
39 D_SUBMODULE_DECLARE(rfkill),
40 D_SUBMODULE_DECLARE(rx),
41 D_SUBMODULE_DECLARE(tx),
42};
43
44
45#endif /* #ifndef __debug_levels__h__ */
diff --git a/drivers/net/wimax/i2400m/debugfs.c b/drivers/net/wimax/i2400m/debugfs.c
new file mode 100644
index 000000000000..626632985977
--- /dev/null
+++ b/drivers/net/wimax/i2400m/debugfs.c
@@ -0,0 +1,392 @@
1/*
2 * Intel Wireless WiMAX Connection 2400m
3 * Debugfs interfaces to manipulate driver and device information
4 *
5 *
6 * Copyright (C) 2007 Intel Corporation <linux-wimax@intel.com>
7 * Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License version
11 * 2 as published by the Free Software Foundation.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21 * 02110-1301, USA.
22 */
23
24#include <linux/debugfs.h>
25#include <linux/netdevice.h>
26#include <linux/etherdevice.h>
27#include <linux/spinlock.h>
28#include <linux/device.h>
29#include "i2400m.h"
30
31
32#define D_SUBMODULE debugfs
33#include "debug-levels.h"
34
35static
36int debugfs_netdev_queue_stopped_get(void *data, u64 *val)
37{
38 struct i2400m *i2400m = data;
39 *val = netif_queue_stopped(i2400m->wimax_dev.net_dev);
40 return 0;
41}
42DEFINE_SIMPLE_ATTRIBUTE(fops_netdev_queue_stopped,
43 debugfs_netdev_queue_stopped_get,
44 NULL, "%llu\n");
45
46
47static
48struct dentry *debugfs_create_netdev_queue_stopped(
49 const char *name, struct dentry *parent, struct i2400m *i2400m)
50{
51 return debugfs_create_file(name, 0400, parent, i2400m,
52 &fops_netdev_queue_stopped);
53}
54
55
56/*
57 * inode->i_private has the @data argument to debugfs_create_file()
58 */
59static
60int i2400m_stats_open(struct inode *inode, struct file *filp)
61{
62 filp->private_data = inode->i_private;
63 return 0;
64}
65
66/*
67 * We don't allow partial reads of this file, as then the reader would
68 * get weirdly confused data as it is updated.
69 *
70 * So or you read it all or nothing; if you try to read with an offset
71 * != 0, we consider you are done reading.
72 */
73static
74ssize_t i2400m_rx_stats_read(struct file *filp, char __user *buffer,
75 size_t count, loff_t *ppos)
76{
77 struct i2400m *i2400m = filp->private_data;
78 char buf[128];
79 unsigned long flags;
80
81 if (*ppos != 0)
82 return 0;
83 if (count < sizeof(buf))
84 return -ENOSPC;
85 spin_lock_irqsave(&i2400m->rx_lock, flags);
86 snprintf(buf, sizeof(buf), "%u %u %u %u %u %u %u\n",
87 i2400m->rx_pl_num, i2400m->rx_pl_min,
88 i2400m->rx_pl_max, i2400m->rx_num,
89 i2400m->rx_size_acc,
90 i2400m->rx_size_min, i2400m->rx_size_max);
91 spin_unlock_irqrestore(&i2400m->rx_lock, flags);
92 return simple_read_from_buffer(buffer, count, ppos, buf, strlen(buf));
93}
94
95
96/* Any write clears the stats */
97static
98ssize_t i2400m_rx_stats_write(struct file *filp, const char __user *buffer,
99 size_t count, loff_t *ppos)
100{
101 struct i2400m *i2400m = filp->private_data;
102 unsigned long flags;
103
104 spin_lock_irqsave(&i2400m->rx_lock, flags);
105 i2400m->rx_pl_num = 0;
106 i2400m->rx_pl_max = 0;
107 i2400m->rx_pl_min = UINT_MAX;
108 i2400m->rx_num = 0;
109 i2400m->rx_size_acc = 0;
110 i2400m->rx_size_min = UINT_MAX;
111 i2400m->rx_size_max = 0;
112 spin_unlock_irqrestore(&i2400m->rx_lock, flags);
113 return count;
114}
115
116static
117const struct file_operations i2400m_rx_stats_fops = {
118 .owner = THIS_MODULE,
119 .open = i2400m_stats_open,
120 .read = i2400m_rx_stats_read,
121 .write = i2400m_rx_stats_write,
122};
123
124
125/* See i2400m_rx_stats_read() */
126static
127ssize_t i2400m_tx_stats_read(struct file *filp, char __user *buffer,
128 size_t count, loff_t *ppos)
129{
130 struct i2400m *i2400m = filp->private_data;
131 char buf[128];
132 unsigned long flags;
133
134 if (*ppos != 0)
135 return 0;
136 if (count < sizeof(buf))
137 return -ENOSPC;
138 spin_lock_irqsave(&i2400m->tx_lock, flags);
139 snprintf(buf, sizeof(buf), "%u %u %u %u %u %u %u\n",
140 i2400m->tx_pl_num, i2400m->tx_pl_min,
141 i2400m->tx_pl_max, i2400m->tx_num,
142 i2400m->tx_size_acc,
143 i2400m->tx_size_min, i2400m->tx_size_max);
144 spin_unlock_irqrestore(&i2400m->tx_lock, flags);
145 return simple_read_from_buffer(buffer, count, ppos, buf, strlen(buf));
146}
147
148/* Any write clears the stats */
149static
150ssize_t i2400m_tx_stats_write(struct file *filp, const char __user *buffer,
151 size_t count, loff_t *ppos)
152{
153 struct i2400m *i2400m = filp->private_data;
154 unsigned long flags;
155
156 spin_lock_irqsave(&i2400m->tx_lock, flags);
157 i2400m->tx_pl_num = 0;
158 i2400m->tx_pl_max = 0;
159 i2400m->tx_pl_min = UINT_MAX;
160 i2400m->tx_num = 0;
161 i2400m->tx_size_acc = 0;
162 i2400m->tx_size_min = UINT_MAX;
163 i2400m->tx_size_max = 0;
164 spin_unlock_irqrestore(&i2400m->tx_lock, flags);
165 return count;
166}
167
168static
169const struct file_operations i2400m_tx_stats_fops = {
170 .owner = THIS_MODULE,
171 .open = i2400m_stats_open,
172 .read = i2400m_tx_stats_read,
173 .write = i2400m_tx_stats_write,
174};
175
176
177/* Write 1 to ask the device to go into suspend */
178static
179int debugfs_i2400m_suspend_set(void *data, u64 val)
180{
181 int result;
182 struct i2400m *i2400m = data;
183 result = i2400m_cmd_enter_powersave(i2400m);
184 if (result >= 0)
185 result = 0;
186 return result;
187}
188DEFINE_SIMPLE_ATTRIBUTE(fops_i2400m_suspend,
189 NULL, debugfs_i2400m_suspend_set,
190 "%llu\n");
191
192static
193struct dentry *debugfs_create_i2400m_suspend(
194 const char *name, struct dentry *parent, struct i2400m *i2400m)
195{
196 return debugfs_create_file(name, 0200, parent, i2400m,
197 &fops_i2400m_suspend);
198}
199
200
201/*
202 * Reset the device
203 *
204 * Write 0 to ask the device to soft reset, 1 to cold reset, 2 to bus
205 * reset (as defined by enum i2400m_reset_type).
206 */
207static
208int debugfs_i2400m_reset_set(void *data, u64 val)
209{
210 int result;
211 struct i2400m *i2400m = data;
212 enum i2400m_reset_type rt = val;
213 switch(rt) {
214 case I2400M_RT_WARM:
215 case I2400M_RT_COLD:
216 case I2400M_RT_BUS:
217 result = i2400m->bus_reset(i2400m, rt);
218 if (result >= 0)
219 result = 0;
220 default:
221 result = -EINVAL;
222 }
223 return result;
224}
225DEFINE_SIMPLE_ATTRIBUTE(fops_i2400m_reset,
226 NULL, debugfs_i2400m_reset_set,
227 "%llu\n");
228
229static
230struct dentry *debugfs_create_i2400m_reset(
231 const char *name, struct dentry *parent, struct i2400m *i2400m)
232{
233 return debugfs_create_file(name, 0200, parent, i2400m,
234 &fops_i2400m_reset);
235}
236
237/*
238 * Debug levels control; see debug.h
239 */
240struct d_level D_LEVEL[] = {
241 D_SUBMODULE_DEFINE(control),
242 D_SUBMODULE_DEFINE(driver),
243 D_SUBMODULE_DEFINE(debugfs),
244 D_SUBMODULE_DEFINE(fw),
245 D_SUBMODULE_DEFINE(netdev),
246 D_SUBMODULE_DEFINE(rfkill),
247 D_SUBMODULE_DEFINE(rx),
248 D_SUBMODULE_DEFINE(tx),
249};
250size_t D_LEVEL_SIZE = ARRAY_SIZE(D_LEVEL);
251
252#define __debugfs_register(prefix, name, parent) \
253do { \
254 result = d_level_register_debugfs(prefix, name, parent); \
255 if (result < 0) \
256 goto error; \
257} while (0)
258
259
260int i2400m_debugfs_add(struct i2400m *i2400m)
261{
262 int result;
263 struct device *dev = i2400m_dev(i2400m);
264 struct dentry *dentry = i2400m->wimax_dev.debugfs_dentry;
265 struct dentry *fd;
266
267 dentry = debugfs_create_dir("i2400m", dentry);
268 result = PTR_ERR(dentry);
269 if (IS_ERR(dentry)) {
270 if (result == -ENODEV)
271 result = 0; /* No debugfs support */
272 goto error;
273 }
274 i2400m->debugfs_dentry = dentry;
275 __debugfs_register("dl_", control, dentry);
276 __debugfs_register("dl_", driver, dentry);
277 __debugfs_register("dl_", debugfs, dentry);
278 __debugfs_register("dl_", fw, dentry);
279 __debugfs_register("dl_", netdev, dentry);
280 __debugfs_register("dl_", rfkill, dentry);
281 __debugfs_register("dl_", rx, dentry);
282 __debugfs_register("dl_", tx, dentry);
283
284 fd = debugfs_create_size_t("tx_in", 0400, dentry,
285 &i2400m->tx_in);
286 result = PTR_ERR(fd);
287 if (IS_ERR(fd) && result != -ENODEV) {
288 dev_err(dev, "Can't create debugfs entry "
289 "tx_in: %d\n", result);
290 goto error;
291 }
292
293 fd = debugfs_create_size_t("tx_out", 0400, dentry,
294 &i2400m->tx_out);
295 result = PTR_ERR(fd);
296 if (IS_ERR(fd) && result != -ENODEV) {
297 dev_err(dev, "Can't create debugfs entry "
298 "tx_out: %d\n", result);
299 goto error;
300 }
301
302 fd = debugfs_create_u32("state", 0600, dentry,
303 &i2400m->state);
304 result = PTR_ERR(fd);
305 if (IS_ERR(fd) && result != -ENODEV) {
306 dev_err(dev, "Can't create debugfs entry "
307 "state: %d\n", result);
308 goto error;
309 }
310
311 /*
312 * Trace received messages from user space
313 *
314 * In order to tap the bidirectional message stream in the
315 * 'msg' pipe, user space can read from the 'msg' pipe;
316 * however, due to limitations in libnl, we can't know what
317 * the different applications are sending down to the kernel.
318 *
319 * So we have this hack where the driver will echo any message
320 * received on the msg pipe from user space [through a call to
321 * wimax_dev->op_msg_from_user() into
322 * i2400m_op_msg_from_user()] into the 'trace' pipe that this
323 * driver creates.
324 *
325 * So then, reading from both the 'trace' and 'msg' pipes in
326 * user space will provide a full dump of the traffic.
327 *
328 * Write 1 to activate, 0 to clear.
329 *
330 * It is not really very atomic, but it is also not too
331 * critical.
332 */
333 fd = debugfs_create_u8("trace_msg_from_user", 0600, dentry,
334 &i2400m->trace_msg_from_user);
335 result = PTR_ERR(fd);
336 if (IS_ERR(fd) && result != -ENODEV) {
337 dev_err(dev, "Can't create debugfs entry "
338 "trace_msg_from_user: %d\n", result);
339 goto error;
340 }
341
342 fd = debugfs_create_netdev_queue_stopped("netdev_queue_stopped",
343 dentry, i2400m);
344 result = PTR_ERR(fd);
345 if (IS_ERR(fd) && result != -ENODEV) {
346 dev_err(dev, "Can't create debugfs entry "
347 "netdev_queue_stopped: %d\n", result);
348 goto error;
349 }
350
351 fd = debugfs_create_file("rx_stats", 0600, dentry, i2400m,
352 &i2400m_rx_stats_fops);
353 result = PTR_ERR(fd);
354 if (IS_ERR(fd) && result != -ENODEV) {
355 dev_err(dev, "Can't create debugfs entry "
356 "rx_stats: %d\n", result);
357 goto error;
358 }
359
360 fd = debugfs_create_file("tx_stats", 0600, dentry, i2400m,
361 &i2400m_tx_stats_fops);
362 result = PTR_ERR(fd);
363 if (IS_ERR(fd) && result != -ENODEV) {
364 dev_err(dev, "Can't create debugfs entry "
365 "tx_stats: %d\n", result);
366 goto error;
367 }
368
369 fd = debugfs_create_i2400m_suspend("suspend", dentry, i2400m);
370 result = PTR_ERR(fd);
371 if (IS_ERR(fd) && result != -ENODEV) {
372 dev_err(dev, "Can't create debugfs entry suspend: %d\n",
373 result);
374 goto error;
375 }
376
377 fd = debugfs_create_i2400m_reset("reset", dentry, i2400m);
378 result = PTR_ERR(fd);
379 if (IS_ERR(fd) && result != -ENODEV) {
380 dev_err(dev, "Can't create debugfs entry reset: %d\n", result);
381 goto error;
382 }
383
384 result = 0;
385error:
386 return result;
387}
388
389void i2400m_debugfs_rm(struct i2400m *i2400m)
390{
391 debugfs_remove_recursive(i2400m->debugfs_dentry);
392}
diff --git a/drivers/net/wimax/i2400m/driver.c b/drivers/net/wimax/i2400m/driver.c
new file mode 100644
index 000000000000..5f98047e18cf
--- /dev/null
+++ b/drivers/net/wimax/i2400m/driver.c
@@ -0,0 +1,728 @@
1/*
2 * Intel Wireless WiMAX Connection 2400m
3 * Generic probe/disconnect, reset and message passing
4 *
5 *
6 * Copyright (C) 2007-2008 Intel Corporation <linux-wimax@intel.com>
7 * Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License version
11 * 2 as published by the Free Software Foundation.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21 * 02110-1301, USA.
22 *
23 *
24 * See i2400m.h for driver documentation. This contains helpers for
25 * the driver model glue [_setup()/_release()], handling device resets
26 * [_dev_reset_handle()], and the backends for the WiMAX stack ops
27 * reset [_op_reset()] and message from user [_op_msg_from_user()].
28 *
29 * ROADMAP:
30 *
31 * i2400m_op_msg_from_user()
32 * i2400m_msg_to_dev()
33 * wimax_msg_to_user_send()
34 *
35 * i2400m_op_reset()
36 * i240m->bus_reset()
37 *
38 * i2400m_dev_reset_handle()
39 * __i2400m_dev_reset_handle()
40 * __i2400m_dev_stop()
41 * __i2400m_dev_start()
42 *
43 * i2400m_setup()
44 * i2400m_bootrom_init()
45 * register_netdev()
46 * i2400m_dev_start()
47 * __i2400m_dev_start()
48 * i2400m_dev_bootstrap()
49 * i2400m_tx_setup()
50 * i2400m->bus_dev_start()
51 * i2400m_check_mac_addr()
52 * wimax_dev_add()
53 *
54 * i2400m_release()
55 * wimax_dev_rm()
56 * i2400m_dev_stop()
57 * __i2400m_dev_stop()
58 * i2400m_dev_shutdown()
59 * i2400m->bus_dev_stop()
60 * i2400m_tx_release()
61 * unregister_netdev()
62 */
63#include "i2400m.h"
64#include <linux/wimax/i2400m.h>
65#include <linux/module.h>
66#include <linux/moduleparam.h>
67
68#define D_SUBMODULE driver
69#include "debug-levels.h"
70
71
72int i2400m_idle_mode_disabled; /* 0 (idle mode enabled) by default */
73module_param_named(idle_mode_disabled, i2400m_idle_mode_disabled, int, 0644);
74MODULE_PARM_DESC(idle_mode_disabled,
75 "If true, the device will not enable idle mode negotiation "
76 "with the base station (when connected) to save power.");
77
78/**
79 * i2400m_queue_work - schedule work on a i2400m's queue
80 *
81 * @i2400m: device descriptor
82 *
83 * @fn: function to run to execute work. It gets passed a 'struct
84 * work_struct' that is wrapped in a 'struct i2400m_work'. Once
85 * done, you have to (1) i2400m_put(i2400m_work->i2400m) and then
86 * (2) kfree(i2400m_work).
87 *
88 * @gfp_flags: GFP flags for memory allocation.
89 *
90 * @pl: pointer to a payload buffer that you want to pass to the _work
91 * function. Use this to pack (for example) a struct with extra
92 * arguments.
93 *
94 * @pl_size: size of the payload buffer.
95 *
96 * We do this quite often, so this just saves typing; allocate a
97 * wrapper for a i2400m, get a ref to it, pack arguments and launch
98 * the work.
99 *
100 * A usual workflow is:
101 *
102 * struct my_work_args {
103 * void *something;
104 * int whatever;
105 * };
106 * ...
107 *
108 * struct my_work_args my_args = {
109 * .something = FOO,
110 * .whaetever = BLAH
111 * };
112 * i2400m_queue_work(i2400m, 1, my_work_function, GFP_KERNEL,
113 * &args, sizeof(args))
114 *
115 * And now the work function can unpack the arguments and call the
116 * real function (or do the job itself):
117 *
118 * static
119 * void my_work_fn((struct work_struct *ws)
120 * {
121 * struct i2400m_work *iw =
122 * container_of(ws, struct i2400m_work, ws);
123 * struct my_work_args *my_args = (void *) iw->pl;
124 *
125 * my_work(iw->i2400m, my_args->something, my_args->whatevert);
126 * }
127 */
128int i2400m_queue_work(struct i2400m *i2400m,
129 void (*fn)(struct work_struct *), gfp_t gfp_flags,
130 const void *pl, size_t pl_size)
131{
132 int result;
133 struct i2400m_work *iw;
134
135 BUG_ON(i2400m->work_queue == NULL);
136 result = -ENOMEM;
137 iw = kzalloc(sizeof(*iw) + pl_size, gfp_flags);
138 if (iw == NULL)
139 goto error_kzalloc;
140 iw->i2400m = i2400m_get(i2400m);
141 memcpy(iw->pl, pl, pl_size);
142 INIT_WORK(&iw->ws, fn);
143 result = queue_work(i2400m->work_queue, &iw->ws);
144error_kzalloc:
145 return result;
146}
147EXPORT_SYMBOL_GPL(i2400m_queue_work);
148
149
150/*
151 * Schedule i2400m's specific work on the system's queue.
152 *
153 * Used for a few cases where we really need it; otherwise, identical
154 * to i2400m_queue_work().
155 *
156 * Returns < 0 errno code on error, 1 if ok.
157 *
158 * If it returns zero, something really bad happened, as it means the
159 * works struct was already queued, but we have just allocated it, so
160 * it should not happen.
161 */
162int i2400m_schedule_work(struct i2400m *i2400m,
163 void (*fn)(struct work_struct *), gfp_t gfp_flags)
164{
165 int result;
166 struct i2400m_work *iw;
167
168 BUG_ON(i2400m->work_queue == NULL);
169 result = -ENOMEM;
170 iw = kzalloc(sizeof(*iw), gfp_flags);
171 if (iw == NULL)
172 goto error_kzalloc;
173 iw->i2400m = i2400m_get(i2400m);
174 INIT_WORK(&iw->ws, fn);
175 result = schedule_work(&iw->ws);
176 if (result == 0)
177 result = -ENXIO;
178error_kzalloc:
179 return result;
180}
181
182
183/*
184 * WiMAX stack operation: relay a message from user space
185 *
186 * @wimax_dev: device descriptor
187 * @pipe_name: named pipe the message is for
188 * @msg_buf: pointer to the message bytes
189 * @msg_len: length of the buffer
190 * @genl_info: passed by the generic netlink layer
191 *
192 * The WiMAX stack will call this function when a message was received
193 * from user space.
194 *
195 * For the i2400m, this is an L3L4 message, as specified in
196 * include/linux/wimax/i2400m.h, and thus prefixed with a 'struct
197 * i2400m_l3l4_hdr'. Driver (and device) expect the messages to be
198 * coded in Little Endian.
199 *
200 * This function just verifies that the header declaration and the
201 * payload are consistent and then deals with it, either forwarding it
202 * to the device or procesing it locally.
203 *
204 * In the i2400m, messages are basically commands that will carry an
205 * ack, so we use i2400m_msg_to_dev() and then deliver the ack back to
206 * user space. The rx.c code might intercept the response and use it
207 * to update the driver's state, but then it will pass it on so it can
208 * be relayed back to user space.
209 *
210 * Note that asynchronous events from the device are processed and
211 * sent to user space in rx.c.
212 */
213static
214int i2400m_op_msg_from_user(struct wimax_dev *wimax_dev,
215 const char *pipe_name,
216 const void *msg_buf, size_t msg_len,
217 const struct genl_info *genl_info)
218{
219 int result;
220 struct i2400m *i2400m = wimax_dev_to_i2400m(wimax_dev);
221 struct device *dev = i2400m_dev(i2400m);
222 struct sk_buff *ack_skb;
223
224 d_fnstart(4, dev, "(wimax_dev %p [i2400m %p] msg_buf %p "
225 "msg_len %zu genl_info %p)\n", wimax_dev, i2400m,
226 msg_buf, msg_len, genl_info);
227 ack_skb = i2400m_msg_to_dev(i2400m, msg_buf, msg_len);
228 result = PTR_ERR(ack_skb);
229 if (IS_ERR(ack_skb))
230 goto error_msg_to_dev;
231 if (unlikely(i2400m->trace_msg_from_user))
232 wimax_msg(&i2400m->wimax_dev, "trace",
233 msg_buf, msg_len, GFP_KERNEL);
234 result = wimax_msg_send(&i2400m->wimax_dev, ack_skb);
235error_msg_to_dev:
236 d_fnend(4, dev, "(wimax_dev %p [i2400m %p] msg_buf %p msg_len %zu "
237 "genl_info %p) = %d\n", wimax_dev, i2400m, msg_buf, msg_len,
238 genl_info, result);
239 return result;
240}
241
242
243/*
244 * Context to wait for a reset to finalize
245 */
246struct i2400m_reset_ctx {
247 struct completion completion;
248 int result;
249};
250
251
252/*
253 * WiMAX stack operation: reset a device
254 *
255 * @wimax_dev: device descriptor
256 *
257 * See the documentation for wimax_reset() and wimax_dev->op_reset for
258 * the requirements of this function. The WiMAX stack guarantees
259 * serialization on calls to this function.
260 *
261 * Do a warm reset on the device; if it fails, resort to a cold reset
262 * and return -ENODEV. On successful warm reset, we need to block
263 * until it is complete.
264 *
265 * The bus-driver implementation of reset takes care of falling back
266 * to cold reset if warm fails.
267 */
268static
269int i2400m_op_reset(struct wimax_dev *wimax_dev)
270{
271 int result;
272 struct i2400m *i2400m = wimax_dev_to_i2400m(wimax_dev);
273 struct device *dev = i2400m_dev(i2400m);
274 struct i2400m_reset_ctx ctx = {
275 .completion = COMPLETION_INITIALIZER_ONSTACK(ctx.completion),
276 .result = 0,
277 };
278
279 d_fnstart(4, dev, "(wimax_dev %p)\n", wimax_dev);
280 mutex_lock(&i2400m->init_mutex);
281 i2400m->reset_ctx = &ctx;
282 mutex_unlock(&i2400m->init_mutex);
283 result = i2400m->bus_reset(i2400m, I2400M_RT_WARM);
284 if (result < 0)
285 goto out;
286 result = wait_for_completion_timeout(&ctx.completion, 4*HZ);
287 if (result == 0)
288 result = -ETIMEDOUT;
289 else if (result > 0)
290 result = ctx.result;
291 /* if result < 0, pass it on */
292 mutex_lock(&i2400m->init_mutex);
293 i2400m->reset_ctx = NULL;
294 mutex_unlock(&i2400m->init_mutex);
295out:
296 d_fnend(4, dev, "(wimax_dev %p) = %d\n", wimax_dev, result);
297 return result;
298}
299
300
301/*
302 * Check the MAC address we got from boot mode is ok
303 *
304 * @i2400m: device descriptor
305 *
306 * Returns: 0 if ok, < 0 errno code on error.
307 */
308static
309int i2400m_check_mac_addr(struct i2400m *i2400m)
310{
311 int result;
312 struct device *dev = i2400m_dev(i2400m);
313 struct sk_buff *skb;
314 const struct i2400m_tlv_detailed_device_info *ddi;
315 struct net_device *net_dev = i2400m->wimax_dev.net_dev;
316 const unsigned char zeromac[ETH_ALEN] = { 0 };
317
318 d_fnstart(3, dev, "(i2400m %p)\n", i2400m);
319 skb = i2400m_get_device_info(i2400m);
320 if (IS_ERR(skb)) {
321 result = PTR_ERR(skb);
322 dev_err(dev, "Cannot verify MAC address, error reading: %d\n",
323 result);
324 goto error;
325 }
326 /* Extract MAC addresss */
327 ddi = (void *) skb->data;
328 BUILD_BUG_ON(ETH_ALEN != sizeof(ddi->mac_address));
329 d_printf(2, dev, "GET DEVICE INFO: mac addr "
330 "%02x:%02x:%02x:%02x:%02x:%02x\n",
331 ddi->mac_address[0], ddi->mac_address[1],
332 ddi->mac_address[2], ddi->mac_address[3],
333 ddi->mac_address[4], ddi->mac_address[5]);
334 if (!memcmp(net_dev->perm_addr, ddi->mac_address,
335 sizeof(ddi->mac_address)))
336 goto ok;
337 dev_warn(dev, "warning: device reports a different MAC address "
338 "to that of boot mode's\n");
339 dev_warn(dev, "device reports %02x:%02x:%02x:%02x:%02x:%02x\n",
340 ddi->mac_address[0], ddi->mac_address[1],
341 ddi->mac_address[2], ddi->mac_address[3],
342 ddi->mac_address[4], ddi->mac_address[5]);
343 dev_warn(dev, "boot mode reported %02x:%02x:%02x:%02x:%02x:%02x\n",
344 net_dev->perm_addr[0], net_dev->perm_addr[1],
345 net_dev->perm_addr[2], net_dev->perm_addr[3],
346 net_dev->perm_addr[4], net_dev->perm_addr[5]);
347 if (!memcmp(zeromac, ddi->mac_address, sizeof(zeromac)))
348 dev_err(dev, "device reports an invalid MAC address, "
349 "not updating\n");
350 else {
351 dev_warn(dev, "updating MAC address\n");
352 net_dev->addr_len = ETH_ALEN;
353 memcpy(net_dev->perm_addr, ddi->mac_address, ETH_ALEN);
354 memcpy(net_dev->dev_addr, ddi->mac_address, ETH_ALEN);
355 }
356ok:
357 result = 0;
358 kfree_skb(skb);
359error:
360 d_fnend(3, dev, "(i2400m %p) = %d\n", i2400m, result);
361 return result;
362}
363
364
365/**
366 * __i2400m_dev_start - Bring up driver communication with the device
367 *
368 * @i2400m: device descriptor
369 * @flags: boot mode flags
370 *
371 * Returns: 0 if ok, < 0 errno code on error.
372 *
373 * Uploads firmware and brings up all the resources needed to be able
374 * to communicate with the device.
375 *
376 * TX needs to be setup before the bus-specific code (otherwise on
377 * shutdown, the bus-tx code could try to access it).
378 */
379static
380int __i2400m_dev_start(struct i2400m *i2400m, enum i2400m_bri flags)
381{
382 int result;
383 struct wimax_dev *wimax_dev = &i2400m->wimax_dev;
384 struct net_device *net_dev = wimax_dev->net_dev;
385 struct device *dev = i2400m_dev(i2400m);
386 int times = 3;
387
388 d_fnstart(3, dev, "(i2400m %p)\n", i2400m);
389retry:
390 result = i2400m_dev_bootstrap(i2400m, flags);
391 if (result < 0) {
392 dev_err(dev, "cannot bootstrap device: %d\n", result);
393 goto error_bootstrap;
394 }
395 result = i2400m_tx_setup(i2400m);
396 if (result < 0)
397 goto error_tx_setup;
398 result = i2400m->bus_dev_start(i2400m);
399 if (result < 0)
400 goto error_bus_dev_start;
401 i2400m->work_queue = create_singlethread_workqueue(wimax_dev->name);
402 if (i2400m->work_queue == NULL) {
403 result = -ENOMEM;
404 dev_err(dev, "cannot create workqueue\n");
405 goto error_create_workqueue;
406 }
407 /* At this point is ok to send commands to the device */
408 result = i2400m_check_mac_addr(i2400m);
409 if (result < 0)
410 goto error_check_mac_addr;
411 i2400m->ready = 1;
412 wimax_state_change(wimax_dev, WIMAX_ST_UNINITIALIZED);
413 result = i2400m_dev_initialize(i2400m);
414 if (result < 0)
415 goto error_dev_initialize;
416 /* At this point, reports will come for the device and set it
417 * to the right state if it is different than UNINITIALIZED */
418 d_fnend(3, dev, "(net_dev %p [i2400m %p]) = %d\n",
419 net_dev, i2400m, result);
420 return result;
421
422error_dev_initialize:
423error_check_mac_addr:
424 destroy_workqueue(i2400m->work_queue);
425error_create_workqueue:
426 i2400m->bus_dev_stop(i2400m);
427error_bus_dev_start:
428 i2400m_tx_release(i2400m);
429error_tx_setup:
430error_bootstrap:
431 if (result == -ERESTARTSYS && times-- > 0) {
432 flags = I2400M_BRI_SOFT;
433 goto retry;
434 }
435 d_fnend(3, dev, "(net_dev %p [i2400m %p]) = %d\n",
436 net_dev, i2400m, result);
437 return result;
438}
439
440
441static
442int i2400m_dev_start(struct i2400m *i2400m, enum i2400m_bri bm_flags)
443{
444 int result;
445 mutex_lock(&i2400m->init_mutex); /* Well, start the device */
446 result = __i2400m_dev_start(i2400m, bm_flags);
447 if (result >= 0)
448 i2400m->updown = 1;
449 mutex_unlock(&i2400m->init_mutex);
450 return result;
451}
452
453
454/**
455 * i2400m_dev_stop - Tear down driver communication with the device
456 *
457 * @i2400m: device descriptor
458 *
459 * Returns: 0 if ok, < 0 errno code on error.
460 *
461 * Releases all the resources allocated to communicate with the device.
462 */
463static
464void __i2400m_dev_stop(struct i2400m *i2400m)
465{
466 struct wimax_dev *wimax_dev = &i2400m->wimax_dev;
467 struct device *dev = i2400m_dev(i2400m);
468
469 d_fnstart(3, dev, "(i2400m %p)\n", i2400m);
470 wimax_state_change(wimax_dev, __WIMAX_ST_QUIESCING);
471 i2400m_dev_shutdown(i2400m);
472 i2400m->ready = 0;
473 destroy_workqueue(i2400m->work_queue);
474 i2400m->bus_dev_stop(i2400m);
475 i2400m_tx_release(i2400m);
476 wimax_state_change(wimax_dev, WIMAX_ST_DOWN);
477 d_fnend(3, dev, "(i2400m %p) = 0\n", i2400m);
478}
479
480
481/*
482 * Watch out -- we only need to stop if there is a need for it. The
483 * device could have reset itself and failed to come up again (see
484 * _i2400m_dev_reset_handle()).
485 */
486static
487void i2400m_dev_stop(struct i2400m *i2400m)
488{
489 mutex_lock(&i2400m->init_mutex);
490 if (i2400m->updown) {
491 __i2400m_dev_stop(i2400m);
492 i2400m->updown = 0;
493 }
494 mutex_unlock(&i2400m->init_mutex);
495}
496
497
498/*
499 * The device has rebooted; fix up the device and the driver
500 *
501 * Tear down the driver communication with the device, reload the
502 * firmware and reinitialize the communication with the device.
503 *
504 * If someone calls a reset when the device's firmware is down, in
505 * theory we won't see it because we are not listening. However, just
506 * in case, leave the code to handle it.
507 *
508 * If there is a reset context, use it; this means someone is waiting
509 * for us to tell him when the reset operation is complete and the
510 * device is ready to rock again.
511 *
512 * NOTE: if we are in the process of bringing up or down the
513 * communication with the device [running i2400m_dev_start() or
514 * _stop()], don't do anything, let it fail and handle it.
515 *
516 * This function is ran always in a thread context
517 */
518static
519void __i2400m_dev_reset_handle(struct work_struct *ws)
520{
521 int result;
522 struct i2400m_work *iw = container_of(ws, struct i2400m_work, ws);
523 struct i2400m *i2400m = iw->i2400m;
524 struct device *dev = i2400m_dev(i2400m);
525 enum wimax_st wimax_state;
526 struct i2400m_reset_ctx *ctx = i2400m->reset_ctx;
527
528 d_fnstart(3, dev, "(ws %p i2400m %p)\n", ws, i2400m);
529 result = 0;
530 if (mutex_trylock(&i2400m->init_mutex) == 0) {
531 /* We are still in i2400m_dev_start() [let it fail] or
532 * i2400m_dev_stop() [we are shutting down anyway, so
533 * ignore it] or we are resetting somewhere else. */
534 dev_err(dev, "device rebooted\n");
535 i2400m_msg_to_dev_cancel_wait(i2400m, -ERESTARTSYS);
536 complete(&i2400m->msg_completion);
537 goto out;
538 }
539 wimax_state = wimax_state_get(&i2400m->wimax_dev);
540 if (wimax_state < WIMAX_ST_UNINITIALIZED) {
541 dev_info(dev, "device rebooted: it is down, ignoring\n");
542 goto out_unlock; /* ifconfig up/down wasn't called */
543 }
544 dev_err(dev, "device rebooted: reinitializing driver\n");
545 __i2400m_dev_stop(i2400m);
546 i2400m->updown = 0;
547 result = __i2400m_dev_start(i2400m,
548 I2400M_BRI_SOFT | I2400M_BRI_MAC_REINIT);
549 if (result < 0) {
550 dev_err(dev, "device reboot: cannot start the device: %d\n",
551 result);
552 result = i2400m->bus_reset(i2400m, I2400M_RT_BUS);
553 if (result >= 0)
554 result = -ENODEV;
555 } else
556 i2400m->updown = 1;
557out_unlock:
558 if (i2400m->reset_ctx) {
559 ctx->result = result;
560 complete(&ctx->completion);
561 }
562 mutex_unlock(&i2400m->init_mutex);
563out:
564 i2400m_put(i2400m);
565 kfree(iw);
566 d_fnend(3, dev, "(ws %p i2400m %p) = void\n", ws, i2400m);
567 return;
568}
569
570
571/**
572 * i2400m_dev_reset_handle - Handle a device's reset in a thread context
573 *
574 * Schedule a device reset handling out on a thread context, so it
575 * is safe to call from atomic context. We can't use the i2400m's
576 * queue as we are going to destroy it and reinitialize it as part of
577 * the driver bringup/bringup process.
578 *
579 * See __i2400m_dev_reset_handle() for details; that takes care of
580 * reinitializing the driver to handle the reset, calling into the
581 * bus-specific functions ops as needed.
582 */
583int i2400m_dev_reset_handle(struct i2400m *i2400m)
584{
585 return i2400m_schedule_work(i2400m, __i2400m_dev_reset_handle,
586 GFP_ATOMIC);
587}
588EXPORT_SYMBOL_GPL(i2400m_dev_reset_handle);
589
590
591/**
592 * i2400m_setup - bus-generic setup function for the i2400m device
593 *
594 * @i2400m: device descriptor (bus-specific parts have been initialized)
595 *
596 * Returns: 0 if ok, < 0 errno code on error.
597 *
598 * Initializes the bus-generic parts of the i2400m driver; the
599 * bus-specific parts have been initialized, function pointers filled
600 * out by the bus-specific probe function.
601 *
602 * As well, this registers the WiMAX and net device nodes. Once this
603 * function returns, the device is operative and has to be ready to
604 * receive and send network traffic and WiMAX control operations.
605 */
606int i2400m_setup(struct i2400m *i2400m, enum i2400m_bri bm_flags)
607{
608 int result = -ENODEV;
609 struct device *dev = i2400m_dev(i2400m);
610 struct wimax_dev *wimax_dev = &i2400m->wimax_dev;
611 struct net_device *net_dev = i2400m->wimax_dev.net_dev;
612
613 d_fnstart(3, dev, "(i2400m %p)\n", i2400m);
614
615 snprintf(wimax_dev->name, sizeof(wimax_dev->name),
616 "i2400m-%s:%s", dev->bus->name, dev->bus_id);
617
618 i2400m->bm_cmd_buf = kzalloc(I2400M_BM_CMD_BUF_SIZE, GFP_KERNEL);
619 if (i2400m->bm_cmd_buf == NULL) {
620 dev_err(dev, "cannot allocate USB command buffer\n");
621 goto error_bm_cmd_kzalloc;
622 }
623 i2400m->bm_ack_buf = kzalloc(I2400M_BM_ACK_BUF_SIZE, GFP_KERNEL);
624 if (i2400m->bm_ack_buf == NULL) {
625 dev_err(dev, "cannot allocate USB ack buffer\n");
626 goto error_bm_ack_buf_kzalloc;
627 }
628 result = i2400m_bootrom_init(i2400m, bm_flags);
629 if (result < 0) {
630 dev_err(dev, "read mac addr: bootrom init "
631 "failed: %d\n", result);
632 goto error_bootrom_init;
633 }
634 result = i2400m_read_mac_addr(i2400m);
635 if (result < 0)
636 goto error_read_mac_addr;
637
638 result = register_netdev(net_dev); /* Okey dokey, bring it up */
639 if (result < 0) {
640 dev_err(dev, "cannot register i2400m network device: %d\n",
641 result);
642 goto error_register_netdev;
643 }
644 netif_carrier_off(net_dev);
645
646 result = i2400m_dev_start(i2400m, bm_flags);
647 if (result < 0)
648 goto error_dev_start;
649
650 i2400m->wimax_dev.op_msg_from_user = i2400m_op_msg_from_user;
651 i2400m->wimax_dev.op_rfkill_sw_toggle = i2400m_op_rfkill_sw_toggle;
652 i2400m->wimax_dev.op_reset = i2400m_op_reset;
653 result = wimax_dev_add(&i2400m->wimax_dev, net_dev);
654 if (result < 0)
655 goto error_wimax_dev_add;
656 /* User space needs to do some init stuff */
657 wimax_state_change(wimax_dev, WIMAX_ST_UNINITIALIZED);
658
659 /* Now setup all that requires a registered net and wimax device. */
660 result = i2400m_debugfs_add(i2400m);
661 if (result < 0) {
662 dev_err(dev, "cannot setup i2400m's debugfs: %d\n", result);
663 goto error_debugfs_setup;
664 }
665 d_fnend(3, dev, "(i2400m %p) = %d\n", i2400m, result);
666 return result;
667
668error_debugfs_setup:
669 wimax_dev_rm(&i2400m->wimax_dev);
670error_wimax_dev_add:
671 i2400m_dev_stop(i2400m);
672error_dev_start:
673 unregister_netdev(net_dev);
674error_register_netdev:
675error_read_mac_addr:
676error_bootrom_init:
677 kfree(i2400m->bm_ack_buf);
678error_bm_ack_buf_kzalloc:
679 kfree(i2400m->bm_cmd_buf);
680error_bm_cmd_kzalloc:
681 d_fnend(3, dev, "(i2400m %p) = %d\n", i2400m, result);
682 return result;
683}
684EXPORT_SYMBOL_GPL(i2400m_setup);
685
686
687/**
688 * i2400m_release - release the bus-generic driver resources
689 *
690 * Sends a disconnect message and undoes any setup done by i2400m_setup()
691 */
692void i2400m_release(struct i2400m *i2400m)
693{
694 struct device *dev = i2400m_dev(i2400m);
695
696 d_fnstart(3, dev, "(i2400m %p)\n", i2400m);
697 netif_stop_queue(i2400m->wimax_dev.net_dev);
698
699 i2400m_debugfs_rm(i2400m);
700 wimax_dev_rm(&i2400m->wimax_dev);
701 i2400m_dev_stop(i2400m);
702 unregister_netdev(i2400m->wimax_dev.net_dev);
703 kfree(i2400m->bm_ack_buf);
704 kfree(i2400m->bm_cmd_buf);
705 d_fnend(3, dev, "(i2400m %p) = void\n", i2400m);
706}
707EXPORT_SYMBOL_GPL(i2400m_release);
708
709
710static
711int __init i2400m_driver_init(void)
712{
713 return 0;
714}
715module_init(i2400m_driver_init);
716
717static
718void __exit i2400m_driver_exit(void)
719{
720 /* for scheds i2400m_dev_reset_handle() */
721 flush_scheduled_work();
722 return;
723}
724module_exit(i2400m_driver_exit);
725
726MODULE_AUTHOR("Intel Corporation <linux-wimax@intel.com>");
727MODULE_DESCRIPTION("Intel 2400M WiMAX networking bus-generic driver");
728MODULE_LICENSE("GPL");
diff --git a/drivers/net/wimax/i2400m/fw.c b/drivers/net/wimax/i2400m/fw.c
new file mode 100644
index 000000000000..1d8271f34c38
--- /dev/null
+++ b/drivers/net/wimax/i2400m/fw.c
@@ -0,0 +1,1095 @@
1/*
2 * Intel Wireless WiMAX Connection 2400m
3 * Firmware uploader
4 *
5 *
6 * Copyright (C) 2007-2008 Intel Corporation. All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 *
12 * * Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * * Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in
16 * the documentation and/or other materials provided with the
17 * distribution.
18 * * Neither the name of Intel Corporation nor the names of its
19 * contributors may be used to endorse or promote products derived
20 * from this software without specific prior written permission.
21 *
22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 *
34 *
35 * Intel Corporation <linux-wimax@intel.com>
36 * Yanir Lubetkin <yanirx.lubetkin@intel.com>
37 * Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
38 * - Initial implementation
39 *
40 *
41 * THE PROCEDURE
42 *
43 * (this is decribed for USB, but for SDIO is similar)
44 *
45 * The 2400m works in two modes: boot-mode or normal mode. In boot
46 * mode we can execute only a handful of commands targeted at
47 * uploading the firmware and launching it.
48 *
49 * The 2400m enters boot mode when it is first connected to the
50 * system, when it crashes and when you ask it to reboot. There are
51 * two submodes of the boot mode: signed and non-signed. Signed takes
52 * firmwares signed with a certain private key, non-signed takes any
53 * firmware. Normal hardware takes only signed firmware.
54 *
55 * Upon entrance to boot mode, the device sends a few zero length
56 * packets (ZLPs) on the notification endpoint, then a reboot barker
57 * (4 le32 words with value I2400M_{S,N}BOOT_BARKER). We ack it by
58 * sending the same barker on the bulk out endpoint. The device acks
59 * with a reboot ack barker (4 le32 words with value 0xfeedbabe) and
60 * then the device is fully rebooted. At this point we can upload the
61 * firmware.
62 *
63 * This process is accomplished by the i2400m_bootrom_init()
64 * function. All the device interaction happens through the
65 * i2400m_bm_cmd() [boot mode command]. Special return values will
66 * indicate if the device resets.
67 *
68 * After this, we read the MAC address and then (if needed)
69 * reinitialize the device. We need to read it ahead of time because
70 * in the future, we might not upload the firmware until userspace
71 * 'ifconfig up's the device.
72 *
73 * We can then upload the firmware file. The file is composed of a BCF
74 * header (basic data, keys and signatures) and a list of write
75 * commands and payloads. We first upload the header
76 * [i2400m_dnload_init()] and then pass the commands and payloads
77 * verbatim to the i2400m_bm_cmd() function
78 * [i2400m_dnload_bcf()]. Then we tell the device to jump to the new
79 * firmware [i2400m_dnload_finalize()].
80 *
81 * Once firmware is uploaded, we are good to go :)
82 *
83 * When we don't know in which mode we are, we first try by sending a
84 * warm reset request that will take us to boot-mode. If we time out
85 * waiting for a reboot barker, that means maybe we are already in
86 * boot mode, so we send a reboot barker.
87 *
88 * COMMAND EXECUTION
89 *
90 * This code (and process) is single threaded; for executing commands,
91 * we post a URB to the notification endpoint, post the command, wait
92 * for data on the notification buffer. We don't need to worry about
93 * others as we know we are the only ones in there.
94 *
95 * BACKEND IMPLEMENTATION
96 *
97 * This code is bus-generic; the bus-specific driver provides back end
98 * implementations to send a boot mode command to the device and to
99 * read an acknolwedgement from it (or an asynchronous notification)
100 * from it.
101 *
102 * ROADMAP
103 *
104 * i2400m_dev_bootstrap Called by __i2400m_dev_start()
105 * request_firmware
106 * i2400m_fw_check
107 * i2400m_fw_dnload
108 * release_firmware
109 *
110 * i2400m_fw_dnload
111 * i2400m_bootrom_init
112 * i2400m_bm_cmd
113 * i2400m->bus_reset
114 * i2400m_dnload_init
115 * i2400m_dnload_init_signed
116 * i2400m_dnload_init_nonsigned
117 * i2400m_download_chunk
118 * i2400m_bm_cmd
119 * i2400m_dnload_bcf
120 * i2400m_bm_cmd
121 * i2400m_dnload_finalize
122 * i2400m_bm_cmd
123 *
124 * i2400m_bm_cmd
125 * i2400m->bus_bm_cmd_send()
126 * i2400m->bus_bm_wait_for_ack
127 * __i2400m_bm_ack_verify
128 *
129 * i2400m_bm_cmd_prepare Used by bus-drivers to prep
130 * commands before sending
131 */
132#include <linux/firmware.h>
133#include <linux/sched.h>
134#include <linux/usb.h>
135#include "i2400m.h"
136
137
138#define D_SUBMODULE fw
139#include "debug-levels.h"
140
141
142static const __le32 i2400m_ACK_BARKER[4] = {
143 __constant_cpu_to_le32(I2400M_ACK_BARKER),
144 __constant_cpu_to_le32(I2400M_ACK_BARKER),
145 __constant_cpu_to_le32(I2400M_ACK_BARKER),
146 __constant_cpu_to_le32(I2400M_ACK_BARKER)
147};
148
149
150/**
151 * Prepare a boot-mode command for delivery
152 *
153 * @cmd: pointer to bootrom header to prepare
154 *
155 * Computes checksum if so needed. After calling this function, DO NOT
156 * modify the command or header as the checksum won't work anymore.
157 *
158 * We do it from here because some times we cannot do it in the
159 * original context the command was sent (it is a const), so when we
160 * copy it to our staging buffer, we add the checksum there.
161 */
162void i2400m_bm_cmd_prepare(struct i2400m_bootrom_header *cmd)
163{
164 if (i2400m_brh_get_use_checksum(cmd)) {
165 int i;
166 u32 checksum = 0;
167 const u32 *checksum_ptr = (void *) cmd->payload;
168 for (i = 0; i < cmd->data_size / 4; i++)
169 checksum += cpu_to_le32(*checksum_ptr++);
170 checksum += cmd->command + cmd->target_addr + cmd->data_size;
171 cmd->block_checksum = cpu_to_le32(checksum);
172 }
173}
174EXPORT_SYMBOL_GPL(i2400m_bm_cmd_prepare);
175
176
177/*
178 * Verify the ack data received
179 *
180 * Given a reply to a boot mode command, chew it and verify everything
181 * is ok.
182 *
183 * @opcode: opcode which generated this ack. For error messages.
184 * @ack: pointer to ack data we received
185 * @ack_size: size of that data buffer
186 * @flags: I2400M_BM_CMD_* flags we called the command with.
187 *
188 * Way too long function -- maybe it should be further split
189 */
190static
191ssize_t __i2400m_bm_ack_verify(struct i2400m *i2400m, int opcode,
192 struct i2400m_bootrom_header *ack,
193 size_t ack_size, int flags)
194{
195 ssize_t result = -ENOMEM;
196 struct device *dev = i2400m_dev(i2400m);
197
198 d_fnstart(8, dev, "(i2400m %p opcode %d ack %p size %zu)\n",
199 i2400m, opcode, ack, ack_size);
200 if (ack_size < sizeof(*ack)) {
201 result = -EIO;
202 dev_err(dev, "boot-mode cmd %d: HW BUG? notification didn't "
203 "return enough data (%zu bytes vs %zu expected)\n",
204 opcode, ack_size, sizeof(*ack));
205 goto error_ack_short;
206 }
207 if (ack_size == sizeof(i2400m_NBOOT_BARKER)
208 && memcmp(ack, i2400m_NBOOT_BARKER, sizeof(*ack)) == 0) {
209 result = -ERESTARTSYS;
210 i2400m->sboot = 0;
211 d_printf(6, dev, "boot-mode cmd %d: "
212 "HW non-signed boot barker\n", opcode);
213 goto error_reboot;
214 }
215 if (ack_size == sizeof(i2400m_SBOOT_BARKER)
216 && memcmp(ack, i2400m_SBOOT_BARKER, sizeof(*ack)) == 0) {
217 result = -ERESTARTSYS;
218 i2400m->sboot = 1;
219 d_printf(6, dev, "boot-mode cmd %d: HW signed reboot barker\n",
220 opcode);
221 goto error_reboot;
222 }
223 if (ack_size == sizeof(i2400m_ACK_BARKER)
224 && memcmp(ack, i2400m_ACK_BARKER, sizeof(*ack)) == 0) {
225 result = -EISCONN;
226 d_printf(3, dev, "boot-mode cmd %d: HW reboot ack barker\n",
227 opcode);
228 goto error_reboot_ack;
229 }
230 result = 0;
231 if (flags & I2400M_BM_CMD_RAW)
232 goto out_raw;
233 ack->data_size = le32_to_cpu(ack->data_size);
234 ack->target_addr = le32_to_cpu(ack->target_addr);
235 ack->block_checksum = le32_to_cpu(ack->block_checksum);
236 d_printf(5, dev, "boot-mode cmd %d: notification for opcode %u "
237 "response %u csum %u rr %u da %u\n",
238 opcode, i2400m_brh_get_opcode(ack),
239 i2400m_brh_get_response(ack),
240 i2400m_brh_get_use_checksum(ack),
241 i2400m_brh_get_response_required(ack),
242 i2400m_brh_get_direct_access(ack));
243 result = -EIO;
244 if (i2400m_brh_get_signature(ack) != 0xcbbc) {
245 dev_err(dev, "boot-mode cmd %d: HW BUG? wrong signature "
246 "0x%04x\n", opcode, i2400m_brh_get_signature(ack));
247 goto error_ack_signature;
248 }
249 if (opcode != -1 && opcode != i2400m_brh_get_opcode(ack)) {
250 dev_err(dev, "boot-mode cmd %d: HW BUG? "
251 "received response for opcode %u, expected %u\n",
252 opcode, i2400m_brh_get_opcode(ack), opcode);
253 goto error_ack_opcode;
254 }
255 if (i2400m_brh_get_response(ack) != 0) { /* failed? */
256 dev_err(dev, "boot-mode cmd %d: error; hw response %u\n",
257 opcode, i2400m_brh_get_response(ack));
258 goto error_ack_failed;
259 }
260 if (ack_size < ack->data_size + sizeof(*ack)) {
261 dev_err(dev, "boot-mode cmd %d: SW BUG "
262 "driver provided only %zu bytes for %zu bytes "
263 "of data\n", opcode, ack_size,
264 (size_t) le32_to_cpu(ack->data_size) + sizeof(*ack));
265 goto error_ack_short_buffer;
266 }
267 result = ack_size;
268 /* Don't you love this stack of empty targets? Well, I don't
269 * either, but it helps track exactly who comes in here and
270 * why :) */
271error_ack_short_buffer:
272error_ack_failed:
273error_ack_opcode:
274error_ack_signature:
275out_raw:
276error_reboot_ack:
277error_reboot:
278error_ack_short:
279 d_fnend(8, dev, "(i2400m %p opcode %d ack %p size %zu) = %d\n",
280 i2400m, opcode, ack, ack_size, (int) result);
281 return result;
282}
283
284
285/**
286 * i2400m_bm_cmd - Execute a boot mode command
287 *
288 * @cmd: buffer containing the command data (pointing at the header).
289 * This data can be ANYWHERE (for USB, we will copy it to an
290 * specific buffer). Make sure everything is in proper little
291 * endian.
292 *
293 * A raw buffer can be also sent, just cast it and set flags to
294 * I2400M_BM_CMD_RAW.
295 *
296 * This function will generate a checksum for you if the
297 * checksum bit in the command is set (unless I2400M_BM_CMD_RAW
298 * is set).
299 *
300 * You can use the i2400m->bm_cmd_buf to stage your commands and
301 * send them.
302 *
303 * If NULL, no command is sent (we just wait for an ack).
304 *
305 * @cmd_size: size of the command. Will be auto padded to the
306 * bus-specific drivers padding requirements.
307 *
308 * @ack: buffer where to place the acknowledgement. If it is a regular
309 * command response, all fields will be returned with the right,
310 * native endianess.
311 *
312 * You *cannot* use i2400m->bm_ack_buf for this buffer.
313 *
314 * @ack_size: size of @ack, 16 aligned; you need to provide at least
315 * sizeof(*ack) bytes and then enough to contain the return data
316 * from the command
317 *
318 * @flags: see I2400M_BM_CMD_* above.
319 *
320 * @returns: bytes received by the notification; if < 0, an errno code
321 * denoting an error or:
322 *
323 * -ERESTARTSYS The device has rebooted
324 *
325 * Executes a boot-mode command and waits for a response, doing basic
326 * validation on it; if a zero length response is received, it retries
327 * waiting for a response until a non-zero one is received (timing out
328 * after %I2400M_BOOT_RETRIES retries).
329 */
330static
331ssize_t i2400m_bm_cmd(struct i2400m *i2400m,
332 const struct i2400m_bootrom_header *cmd, size_t cmd_size,
333 struct i2400m_bootrom_header *ack, size_t ack_size,
334 int flags)
335{
336 ssize_t result = -ENOMEM, rx_bytes;
337 struct device *dev = i2400m_dev(i2400m);
338 int opcode = cmd == NULL ? -1 : i2400m_brh_get_opcode(cmd);
339
340 d_fnstart(6, dev, "(i2400m %p cmd %p size %zu ack %p size %zu)\n",
341 i2400m, cmd, cmd_size, ack, ack_size);
342 BUG_ON(ack_size < sizeof(*ack));
343 BUG_ON(i2400m->boot_mode == 0);
344
345 if (cmd != NULL) { /* send the command */
346 memcpy(i2400m->bm_cmd_buf, cmd, cmd_size);
347 result = i2400m->bus_bm_cmd_send(i2400m, cmd, cmd_size, flags);
348 if (result < 0)
349 goto error_cmd_send;
350 if ((flags & I2400M_BM_CMD_RAW) == 0)
351 d_printf(5, dev,
352 "boot-mode cmd %d csum %u rr %u da %u: "
353 "addr 0x%04x size %u block csum 0x%04x\n",
354 opcode, i2400m_brh_get_use_checksum(cmd),
355 i2400m_brh_get_response_required(cmd),
356 i2400m_brh_get_direct_access(cmd),
357 cmd->target_addr, cmd->data_size,
358 cmd->block_checksum);
359 }
360 result = i2400m->bus_bm_wait_for_ack(i2400m, ack, ack_size);
361 if (result < 0) {
362 dev_err(dev, "boot-mode cmd %d: error waiting for an ack: %d\n",
363 opcode, (int) result); /* bah, %zd doesn't work */
364 goto error_wait_for_ack;
365 }
366 rx_bytes = result;
367 /* verify the ack and read more if neccessary [result is the
368 * final amount of bytes we get in the ack] */
369 result = __i2400m_bm_ack_verify(i2400m, opcode, ack, ack_size, flags);
370 if (result < 0)
371 goto error_bad_ack;
372 /* Don't you love this stack of empty targets? Well, I don't
373 * either, but it helps track exactly who comes in here and
374 * why :) */
375 result = rx_bytes;
376error_bad_ack:
377error_wait_for_ack:
378error_cmd_send:
379 d_fnend(6, dev, "(i2400m %p cmd %p size %zu ack %p size %zu) = %d\n",
380 i2400m, cmd, cmd_size, ack, ack_size, (int) result);
381 return result;
382}
383
384
385/**
386 * i2400m_download_chunk - write a single chunk of data to the device's memory
387 *
388 * @i2400m: device descriptor
389 * @buf: the buffer to write
390 * @buf_len: length of the buffer to write
391 * @addr: address in the device memory space
392 * @direct: bootrom write mode
393 * @do_csum: should a checksum validation be performed
394 */
395static int i2400m_download_chunk(struct i2400m *i2400m, const void *chunk,
396 size_t __chunk_len, unsigned long addr,
397 unsigned int direct, unsigned int do_csum)
398{
399 int ret;
400 size_t chunk_len = ALIGN(__chunk_len, I2400M_PL_PAD);
401 struct device *dev = i2400m_dev(i2400m);
402 struct {
403 struct i2400m_bootrom_header cmd;
404 u8 cmd_payload[chunk_len];
405 } __attribute__((packed)) *buf;
406 struct i2400m_bootrom_header ack;
407
408 d_fnstart(5, dev, "(i2400m %p chunk %p __chunk_len %zu addr 0x%08lx "
409 "direct %u do_csum %u)\n", i2400m, chunk, __chunk_len,
410 addr, direct, do_csum);
411 buf = i2400m->bm_cmd_buf;
412 memcpy(buf->cmd_payload, chunk, __chunk_len);
413 memset(buf->cmd_payload + __chunk_len, 0xad, chunk_len - __chunk_len);
414
415 buf->cmd.command = i2400m_brh_command(I2400M_BRH_WRITE,
416 __chunk_len & 0x3 ? 0 : do_csum,
417 __chunk_len & 0xf ? 0 : direct);
418 buf->cmd.target_addr = cpu_to_le32(addr);
419 buf->cmd.data_size = cpu_to_le32(__chunk_len);
420 ret = i2400m_bm_cmd(i2400m, &buf->cmd, sizeof(buf->cmd) + chunk_len,
421 &ack, sizeof(ack), 0);
422 if (ret >= 0)
423 ret = 0;
424 d_fnend(5, dev, "(i2400m %p chunk %p __chunk_len %zu addr 0x%08lx "
425 "direct %u do_csum %u) = %d\n", i2400m, chunk, __chunk_len,
426 addr, direct, do_csum, ret);
427 return ret;
428}
429
430
431/*
432 * Download a BCF file's sections to the device
433 *
434 * @i2400m: device descriptor
435 * @bcf: pointer to firmware data (followed by the payloads). Assumed
436 * verified and consistent.
437 * @bcf_len: length (in bytes) of the @bcf buffer.
438 *
439 * Returns: < 0 errno code on error or the offset to the jump instruction.
440 *
441 * Given a BCF file, downloads each section (a command and a payload)
442 * to the device's address space. Actually, it just executes each
443 * command i the BCF file.
444 *
445 * The section size has to be aligned to 4 bytes AND the padding has
446 * to be taken from the firmware file, as the signature takes it into
447 * account.
448 */
449static
450ssize_t i2400m_dnload_bcf(struct i2400m *i2400m,
451 const struct i2400m_bcf_hdr *bcf, size_t bcf_len)
452{
453 ssize_t ret;
454 struct device *dev = i2400m_dev(i2400m);
455 size_t offset, /* iterator offset */
456 data_size, /* Size of the data payload */
457 section_size, /* Size of the whole section (cmd + payload) */
458 section = 1;
459 const struct i2400m_bootrom_header *bh;
460 struct i2400m_bootrom_header ack;
461
462 d_fnstart(3, dev, "(i2400m %p bcf %p bcf_len %zu)\n",
463 i2400m, bcf, bcf_len);
464 /* Iterate over the command blocks in the BCF file that start
465 * after the header */
466 offset = le32_to_cpu(bcf->header_len) * sizeof(u32);
467 while (1) { /* start sending the file */
468 bh = (void *) bcf + offset;
469 data_size = le32_to_cpu(bh->data_size);
470 section_size = ALIGN(sizeof(*bh) + data_size, 4);
471 d_printf(7, dev,
472 "downloading section #%zu (@%zu %zu B) to 0x%08x\n",
473 section, offset, sizeof(*bh) + data_size,
474 le32_to_cpu(bh->target_addr));
475 if (i2400m_brh_get_opcode(bh) == I2400M_BRH_SIGNED_JUMP) {
476 /* Secure boot needs to stop here */
477 d_printf(5, dev, "signed jump found @%zu\n", offset);
478 break;
479 }
480 if (offset + section_size == bcf_len)
481 /* Non-secure boot stops here */
482 break;
483 if (offset + section_size > bcf_len) {
484 dev_err(dev, "fw %s: bad section #%zu, "
485 "end (@%zu) beyond EOF (@%zu)\n",
486 i2400m->bus_fw_name, section,
487 offset + section_size, bcf_len);
488 ret = -EINVAL;
489 goto error_section_beyond_eof;
490 }
491 __i2400m_msleep(20);
492 ret = i2400m_bm_cmd(i2400m, bh, section_size,
493 &ack, sizeof(ack), I2400M_BM_CMD_RAW);
494 if (ret < 0) {
495 dev_err(dev, "fw %s: section #%zu (@%zu %zu B) "
496 "failed %d\n", i2400m->bus_fw_name, section,
497 offset, sizeof(*bh) + data_size, (int) ret);
498 goto error_send;
499 }
500 offset += section_size;
501 section++;
502 }
503 ret = offset;
504error_section_beyond_eof:
505error_send:
506 d_fnend(3, dev, "(i2400m %p bcf %p bcf_len %zu) = %d\n",
507 i2400m, bcf, bcf_len, (int) ret);
508 return ret;
509}
510
511
512/*
513 * Do the final steps of uploading firmware
514 *
515 * Depending on the boot mode (signed vs non-signed), different
516 * actions need to be taken.
517 */
518static
519int i2400m_dnload_finalize(struct i2400m *i2400m,
520 const struct i2400m_bcf_hdr *bcf, size_t offset)
521{
522 int ret = 0;
523 struct device *dev = i2400m_dev(i2400m);
524 struct i2400m_bootrom_header *cmd, ack;
525 struct {
526 struct i2400m_bootrom_header cmd;
527 u8 cmd_pl[0];
528 } __attribute__((packed)) *cmd_buf;
529 size_t signature_block_offset, signature_block_size;
530
531 d_fnstart(3, dev, "offset %zu\n", offset);
532 cmd = (void *) bcf + offset;
533 if (i2400m->sboot == 0) {
534 struct i2400m_bootrom_header jump_ack;
535 d_printf(3, dev, "unsecure boot, jumping to 0x%08x\n",
536 le32_to_cpu(cmd->target_addr));
537 i2400m_brh_set_opcode(cmd, I2400M_BRH_JUMP);
538 cmd->data_size = 0;
539 ret = i2400m_bm_cmd(i2400m, cmd, sizeof(*cmd),
540 &jump_ack, sizeof(jump_ack), 0);
541 } else {
542 d_printf(3, dev, "secure boot, jumping to 0x%08x\n",
543 le32_to_cpu(cmd->target_addr));
544 cmd_buf = i2400m->bm_cmd_buf;
545 memcpy(&cmd_buf->cmd, cmd, sizeof(*cmd));
546 signature_block_offset =
547 sizeof(*bcf)
548 + le32_to_cpu(bcf->key_size) * sizeof(u32)
549 + le32_to_cpu(bcf->exponent_size) * sizeof(u32);
550 signature_block_size =
551 le32_to_cpu(bcf->modulus_size) * sizeof(u32);
552 memcpy(cmd_buf->cmd_pl, (void *) bcf + signature_block_offset,
553 signature_block_size);
554 ret = i2400m_bm_cmd(i2400m, &cmd_buf->cmd,
555 sizeof(cmd_buf->cmd) + signature_block_size,
556 &ack, sizeof(ack), I2400M_BM_CMD_RAW);
557 }
558 d_fnend(3, dev, "returning %d\n", ret);
559 return ret;
560}
561
562
563/**
564 * i2400m_bootrom_init - Reboots a powered device into boot mode
565 *
566 * @i2400m: device descriptor
567 * @flags:
568 * I2400M_BRI_SOFT: a reboot notification has been seen
569 * already, so don't wait for it.
570 *
571 * I2400M_BRI_NO_REBOOT: Don't send a reboot command, but wait
572 * for a reboot barker notification. This is a one shot; if
573 * the state machine needs to send a reboot command it will.
574 *
575 * Returns:
576 *
577 * < 0 errno code on error, 0 if ok.
578 *
579 * i2400m->sboot set to 0 for unsecure boot process, 1 for secure
580 * boot process.
581 *
582 * Description:
583 *
584 * Tries hard enough to put the device in boot-mode. There are two
585 * main phases to this:
586 *
587 * a. (1) send a reboot command and (2) get a reboot barker
588 * b. (1) ack the reboot sending a reboot barker and (2) getting an
589 * ack barker in return
590 *
591 * We want to skip (a) in some cases [soft]. The state machine is
592 * horrible, but it is basically: on each phase, send what has to be
593 * sent (if any), wait for the answer and act on the answer. We might
594 * have to backtrack and retry, so we keep a max tries counter for
595 * that.
596 *
597 * If we get a timeout after sending a warm reset, we do it again.
598 */
599int i2400m_bootrom_init(struct i2400m *i2400m, enum i2400m_bri flags)
600{
601 int result;
602 struct device *dev = i2400m_dev(i2400m);
603 struct i2400m_bootrom_header *cmd;
604 struct i2400m_bootrom_header ack;
605 int count = I2400M_BOOT_RETRIES;
606 int ack_timeout_cnt = 1;
607
608 BUILD_BUG_ON(sizeof(*cmd) != sizeof(i2400m_NBOOT_BARKER));
609 BUILD_BUG_ON(sizeof(ack) != sizeof(i2400m_ACK_BARKER));
610
611 d_fnstart(4, dev, "(i2400m %p flags 0x%08x)\n", i2400m, flags);
612 result = -ENOMEM;
613 cmd = i2400m->bm_cmd_buf;
614 if (flags & I2400M_BRI_SOFT)
615 goto do_reboot_ack;
616do_reboot:
617 if (--count < 0)
618 goto error_timeout;
619 d_printf(4, dev, "device reboot: reboot command [%d # left]\n",
620 count);
621 if ((flags & I2400M_BRI_NO_REBOOT) == 0)
622 i2400m->bus_reset(i2400m, I2400M_RT_WARM);
623 result = i2400m_bm_cmd(i2400m, NULL, 0, &ack, sizeof(ack),
624 I2400M_BM_CMD_RAW);
625 flags &= ~I2400M_BRI_NO_REBOOT;
626 switch (result) {
627 case -ERESTARTSYS:
628 d_printf(4, dev, "device reboot: got reboot barker\n");
629 break;
630 case -EISCONN: /* we don't know how it got here...but we follow it */
631 d_printf(4, dev, "device reboot: got ack barker - whatever\n");
632 goto do_reboot;
633 case -ETIMEDOUT: /* device has timed out, we might be in boot
634 * mode already and expecting an ack, let's try
635 * that */
636 dev_info(dev, "warm reset timed out, trying an ack\n");
637 goto do_reboot_ack;
638 case -EPROTO:
639 case -ESHUTDOWN: /* dev is gone */
640 case -EINTR: /* user cancelled */
641 goto error_dev_gone;
642 default:
643 dev_err(dev, "device reboot: error %d while waiting "
644 "for reboot barker - rebooting\n", result);
645 goto do_reboot;
646 }
647 /* At this point we ack back with 4 REBOOT barkers and expect
648 * 4 ACK barkers. This is ugly, as we send a raw command --
649 * hence the cast. _bm_cmd() will catch the reboot ack
650 * notification and report it as -EISCONN. */
651do_reboot_ack:
652 d_printf(4, dev, "device reboot ack: sending ack [%d # left]\n", count);
653 if (i2400m->sboot == 0)
654 memcpy(cmd, i2400m_NBOOT_BARKER,
655 sizeof(i2400m_NBOOT_BARKER));
656 else
657 memcpy(cmd, i2400m_SBOOT_BARKER,
658 sizeof(i2400m_SBOOT_BARKER));
659 result = i2400m_bm_cmd(i2400m, cmd, sizeof(*cmd),
660 &ack, sizeof(ack), I2400M_BM_CMD_RAW);
661 switch (result) {
662 case -ERESTARTSYS:
663 d_printf(4, dev, "reboot ack: got reboot barker - retrying\n");
664 if (--count < 0)
665 goto error_timeout;
666 goto do_reboot_ack;
667 case -EISCONN:
668 d_printf(4, dev, "reboot ack: got ack barker - good\n");
669 break;
670 case -ETIMEDOUT: /* no response, maybe it is the other type? */
671 if (ack_timeout_cnt-- >= 0) {
672 d_printf(4, dev, "reboot ack timedout: "
673 "trying the other type?\n");
674 i2400m->sboot = !i2400m->sboot;
675 goto do_reboot_ack;
676 } else {
677 dev_err(dev, "reboot ack timedout too long: "
678 "trying reboot\n");
679 goto do_reboot;
680 }
681 break;
682 case -EPROTO:
683 case -ESHUTDOWN: /* dev is gone */
684 goto error_dev_gone;
685 default:
686 dev_err(dev, "device reboot ack: error %d while waiting for "
687 "reboot ack barker - rebooting\n", result);
688 goto do_reboot;
689 }
690 d_printf(2, dev, "device reboot ack: got ack barker - boot done\n");
691 result = 0;
692exit_timeout:
693error_dev_gone:
694 d_fnend(4, dev, "(i2400m %p flags 0x%08x) = %d\n",
695 i2400m, flags, result);
696 return result;
697
698error_timeout:
699 dev_err(dev, "Timed out waiting for reboot ack, resetting\n");
700 i2400m->bus_reset(i2400m, I2400M_RT_BUS);
701 result = -ETIMEDOUT;
702 goto exit_timeout;
703}
704
705
706/*
707 * Read the MAC addr
708 *
709 * The position this function reads is fixed in device memory and
710 * always available, even without firmware.
711 *
712 * Note we specify we want to read only six bytes, but provide space
713 * for 16, as we always get it rounded up.
714 */
715int i2400m_read_mac_addr(struct i2400m *i2400m)
716{
717 int result;
718 struct device *dev = i2400m_dev(i2400m);
719 struct net_device *net_dev = i2400m->wimax_dev.net_dev;
720 struct i2400m_bootrom_header *cmd;
721 struct {
722 struct i2400m_bootrom_header ack;
723 u8 ack_pl[16];
724 } __attribute__((packed)) ack_buf;
725
726 d_fnstart(5, dev, "(i2400m %p)\n", i2400m);
727 cmd = i2400m->bm_cmd_buf;
728 cmd->command = i2400m_brh_command(I2400M_BRH_READ, 0, 1);
729 cmd->target_addr = cpu_to_le32(0x00203fe8);
730 cmd->data_size = cpu_to_le32(6);
731 result = i2400m_bm_cmd(i2400m, cmd, sizeof(*cmd),
732 &ack_buf.ack, sizeof(ack_buf), 0);
733 if (result < 0) {
734 dev_err(dev, "BM: read mac addr failed: %d\n", result);
735 goto error_read_mac;
736 }
737 d_printf(2, dev,
738 "mac addr is %02x:%02x:%02x:%02x:%02x:%02x\n",
739 ack_buf.ack_pl[0], ack_buf.ack_pl[1],
740 ack_buf.ack_pl[2], ack_buf.ack_pl[3],
741 ack_buf.ack_pl[4], ack_buf.ack_pl[5]);
742 if (i2400m->bus_bm_mac_addr_impaired == 1) {
743 ack_buf.ack_pl[0] = 0x00;
744 ack_buf.ack_pl[1] = 0x16;
745 ack_buf.ack_pl[2] = 0xd3;
746 get_random_bytes(&ack_buf.ack_pl[3], 3);
747 dev_err(dev, "BM is MAC addr impaired, faking MAC addr to "
748 "mac addr is %02x:%02x:%02x:%02x:%02x:%02x\n",
749 ack_buf.ack_pl[0], ack_buf.ack_pl[1],
750 ack_buf.ack_pl[2], ack_buf.ack_pl[3],
751 ack_buf.ack_pl[4], ack_buf.ack_pl[5]);
752 result = 0;
753 }
754 net_dev->addr_len = ETH_ALEN;
755 memcpy(net_dev->perm_addr, ack_buf.ack_pl, ETH_ALEN);
756 memcpy(net_dev->dev_addr, ack_buf.ack_pl, ETH_ALEN);
757error_read_mac:
758 d_fnend(5, dev, "(i2400m %p) = %d\n", i2400m, result);
759 return result;
760}
761
762
763/*
764 * Initialize a non signed boot
765 *
766 * This implies sending some magic values to the device's memory. Note
767 * we convert the values to little endian in the same array
768 * declaration.
769 */
770static
771int i2400m_dnload_init_nonsigned(struct i2400m *i2400m)
772{
773#define POKE(a, d) { \
774 .address = __constant_cpu_to_le32(a), \
775 .data = __constant_cpu_to_le32(d) \
776}
777 static const struct {
778 __le32 address;
779 __le32 data;
780 } i2400m_pokes[] = {
781 POKE(0x081A58, 0xA7810230),
782 POKE(0x080040, 0x00000000),
783 POKE(0x080048, 0x00000082),
784 POKE(0x08004C, 0x0000081F),
785 POKE(0x080054, 0x00000085),
786 POKE(0x080058, 0x00000180),
787 POKE(0x08005C, 0x00000018),
788 POKE(0x080060, 0x00000010),
789 POKE(0x080574, 0x00000001),
790 POKE(0x080550, 0x00000005),
791 POKE(0xAE0000, 0x00000000),
792 };
793#undef POKE
794 unsigned i;
795 int ret;
796 struct device *dev = i2400m_dev(i2400m);
797
798 dev_warn(dev, "WARNING!!! non-signed boot UNTESTED PATH!\n");
799
800 d_fnstart(5, dev, "(i2400m %p)\n", i2400m);
801 for (i = 0; i < ARRAY_SIZE(i2400m_pokes); i++) {
802 ret = i2400m_download_chunk(i2400m, &i2400m_pokes[i].data,
803 sizeof(i2400m_pokes[i].data),
804 i2400m_pokes[i].address, 1, 1);
805 if (ret < 0)
806 break;
807 }
808 d_fnend(5, dev, "(i2400m %p) = %d\n", i2400m, ret);
809 return ret;
810}
811
812
813/*
814 * Initialize the signed boot process
815 *
816 * @i2400m: device descriptor
817 *
818 * @bcf_hdr: pointer to the firmware header; assumes it is fully in
819 * memory (it has gone through basic validation).
820 *
821 * Returns: 0 if ok, < 0 errno code on error, -ERESTARTSYS if the hw
822 * rebooted.
823 *
824 * This writes the firmware BCF header to the device using the
825 * HASH_PAYLOAD_ONLY command.
826 */
827static
828int i2400m_dnload_init_signed(struct i2400m *i2400m,
829 const struct i2400m_bcf_hdr *bcf_hdr)
830{
831 int ret;
832 struct device *dev = i2400m_dev(i2400m);
833 struct {
834 struct i2400m_bootrom_header cmd;
835 struct i2400m_bcf_hdr cmd_pl;
836 } __attribute__((packed)) *cmd_buf;
837 struct i2400m_bootrom_header ack;
838
839 d_fnstart(5, dev, "(i2400m %p bcf_hdr %p)\n", i2400m, bcf_hdr);
840 cmd_buf = i2400m->bm_cmd_buf;
841 cmd_buf->cmd.command =
842 i2400m_brh_command(I2400M_BRH_HASH_PAYLOAD_ONLY, 0, 0);
843 cmd_buf->cmd.target_addr = 0;
844 cmd_buf->cmd.data_size = cpu_to_le32(sizeof(cmd_buf->cmd_pl));
845 memcpy(&cmd_buf->cmd_pl, bcf_hdr, sizeof(*bcf_hdr));
846 ret = i2400m_bm_cmd(i2400m, &cmd_buf->cmd, sizeof(*cmd_buf),
847 &ack, sizeof(ack), 0);
848 if (ret >= 0)
849 ret = 0;
850 d_fnend(5, dev, "(i2400m %p bcf_hdr %p) = %d\n", i2400m, bcf_hdr, ret);
851 return ret;
852}
853
854
855/*
856 * Initialize the firmware download at the device size
857 *
858 * Multiplex to the one that matters based on the device's mode
859 * (signed or non-signed).
860 */
861static
862int i2400m_dnload_init(struct i2400m *i2400m, const struct i2400m_bcf_hdr *bcf)
863{
864 int result;
865 struct device *dev = i2400m_dev(i2400m);
866 u32 module_id = le32_to_cpu(bcf->module_id);
867
868 if (i2400m->sboot == 0
869 && (module_id & I2400M_BCF_MOD_ID_POKES) == 0) {
870 /* non-signed boot process without pokes */
871 result = i2400m_dnload_init_nonsigned(i2400m);
872 if (result == -ERESTARTSYS)
873 return result;
874 if (result < 0)
875 dev_err(dev, "fw %s: non-signed download "
876 "initialization failed: %d\n",
877 i2400m->bus_fw_name, result);
878 } else if (i2400m->sboot == 0
879 && (module_id & I2400M_BCF_MOD_ID_POKES)) {
880 /* non-signed boot process with pokes, nothing to do */
881 result = 0;
882 } else { /* signed boot process */
883 result = i2400m_dnload_init_signed(i2400m, bcf);
884 if (result == -ERESTARTSYS)
885 return result;
886 if (result < 0)
887 dev_err(dev, "fw %s: signed boot download "
888 "initialization failed: %d\n",
889 i2400m->bus_fw_name, result);
890 }
891 return result;
892}
893
894
895/*
896 * Run quick consistency tests on the firmware file
897 *
898 * Check for the firmware being made for the i2400m device,
899 * etc...These checks are mostly informative, as the device will make
900 * them too; but the driver's response is more informative on what
901 * went wrong.
902 */
903static
904int i2400m_fw_check(struct i2400m *i2400m,
905 const struct i2400m_bcf_hdr *bcf,
906 size_t bcf_size)
907{
908 int result;
909 struct device *dev = i2400m_dev(i2400m);
910 unsigned module_type, header_len, major_version, minor_version,
911 module_id, module_vendor, date, size;
912
913 /* Check hard errors */
914 result = -EINVAL;
915 if (bcf_size < sizeof(*bcf)) { /* big enough header? */
916 dev_err(dev, "firmware %s too short: "
917 "%zu B vs %zu (at least) expected\n",
918 i2400m->bus_fw_name, bcf_size, sizeof(*bcf));
919 goto error;
920 }
921
922 module_type = bcf->module_type;
923 header_len = sizeof(u32) * le32_to_cpu(bcf->header_len);
924 major_version = le32_to_cpu(bcf->header_version) & 0xffff0000 >> 16;
925 minor_version = le32_to_cpu(bcf->header_version) & 0x0000ffff;
926 module_id = le32_to_cpu(bcf->module_id);
927 module_vendor = le32_to_cpu(bcf->module_vendor);
928 date = le32_to_cpu(bcf->date);
929 size = sizeof(u32) * le32_to_cpu(bcf->size);
930
931 if (bcf_size != size) { /* annoyingly paranoid */
932 dev_err(dev, "firmware %s: bad size, got "
933 "%zu B vs %u expected\n",
934 i2400m->bus_fw_name, bcf_size, size);
935 goto error;
936 }
937
938 d_printf(2, dev, "type 0x%x id 0x%x vendor 0x%x; header v%u.%u (%zu B) "
939 "date %08x (%zu B)\n",
940 module_type, module_id, module_vendor,
941 major_version, minor_version, (size_t) header_len,
942 date, (size_t) size);
943
944 if (module_type != 6) { /* built for the right hardware? */
945 dev_err(dev, "bad fw %s: unexpected module type 0x%x; "
946 "aborting\n", i2400m->bus_fw_name, module_type);
947 goto error;
948 }
949
950 /* Check soft-er errors */
951 result = 0;
952 if (module_vendor != 0x8086)
953 dev_err(dev, "bad fw %s? unexpected vendor 0x%04x\n",
954 i2400m->bus_fw_name, module_vendor);
955 if (date < 0x20080300)
956 dev_err(dev, "bad fw %s? build date too old %08x\n",
957 i2400m->bus_fw_name, date);
958error:
959 return result;
960}
961
962
963/*
964 * Download the firmware to the device
965 *
966 * @i2400m: device descriptor
967 * @bcf: pointer to loaded (and minimally verified for consistency)
968 * firmware
969 * @bcf_size: size of the @bcf buffer (header plus payloads)
970 *
971 * The process for doing this is described in this file's header.
972 *
973 * Note we only reinitialize boot-mode if the flags say so. Some hw
974 * iterations need it, some don't. In any case, if we loop, we always
975 * need to reinitialize the boot room, hence the flags modification.
976 */
977static
978int i2400m_fw_dnload(struct i2400m *i2400m, const struct i2400m_bcf_hdr *bcf,
979 size_t bcf_size, enum i2400m_bri flags)
980{
981 int ret = 0;
982 struct device *dev = i2400m_dev(i2400m);
983 int count = I2400M_BOOT_RETRIES;
984
985 d_fnstart(5, dev, "(i2400m %p bcf %p size %zu)\n",
986 i2400m, bcf, bcf_size);
987 i2400m->boot_mode = 1;
988hw_reboot:
989 if (count-- == 0) {
990 ret = -ERESTARTSYS;
991 dev_err(dev, "device rebooted too many times, aborting\n");
992 goto error_too_many_reboots;
993 }
994 if (flags & I2400M_BRI_MAC_REINIT) {
995 ret = i2400m_bootrom_init(i2400m, flags);
996 if (ret < 0) {
997 dev_err(dev, "bootrom init failed: %d\n", ret);
998 goto error_bootrom_init;
999 }
1000 }
1001 flags |= I2400M_BRI_MAC_REINIT;
1002
1003 /*
1004 * Initialize the download, push the bytes to the device and
1005 * then jump to the new firmware. Note @ret is passed with the
1006 * offset of the jump instruction to _dnload_finalize()
1007 */
1008 ret = i2400m_dnload_init(i2400m, bcf); /* Init device's dnload */
1009 if (ret == -ERESTARTSYS)
1010 goto error_dev_rebooted;
1011 if (ret < 0)
1012 goto error_dnload_init;
1013
1014 ret = i2400m_dnload_bcf(i2400m, bcf, bcf_size);
1015 if (ret == -ERESTARTSYS)
1016 goto error_dev_rebooted;
1017 if (ret < 0) {
1018 dev_err(dev, "fw %s: download failed: %d\n",
1019 i2400m->bus_fw_name, ret);
1020 goto error_dnload_bcf;
1021 }
1022
1023 ret = i2400m_dnload_finalize(i2400m, bcf, ret);
1024 if (ret == -ERESTARTSYS)
1025 goto error_dev_rebooted;
1026 if (ret < 0) {
1027 dev_err(dev, "fw %s: "
1028 "download finalization failed: %d\n",
1029 i2400m->bus_fw_name, ret);
1030 goto error_dnload_finalize;
1031 }
1032
1033 d_printf(2, dev, "fw %s successfully uploaded\n",
1034 i2400m->bus_fw_name);
1035 i2400m->boot_mode = 0;
1036error_dnload_finalize:
1037error_dnload_bcf:
1038error_dnload_init:
1039error_bootrom_init:
1040error_too_many_reboots:
1041 d_fnend(5, dev, "(i2400m %p bcf %p size %zu) = %d\n",
1042 i2400m, bcf, bcf_size, ret);
1043 return ret;
1044
1045error_dev_rebooted:
1046 dev_err(dev, "device rebooted, %d tries left\n", count);
1047 /* we got the notification already, no need to wait for it again */
1048 flags |= I2400M_BRI_SOFT;
1049 goto hw_reboot;
1050}
1051
1052
1053/**
1054 * i2400m_dev_bootstrap - Bring the device to a known state and upload firmware
1055 *
1056 * @i2400m: device descriptor
1057 *
1058 * Returns: >= 0 if ok, < 0 errno code on error.
1059 *
1060 * This sets up the firmware upload environment, loads the firmware
1061 * file from disk, verifies and then calls the firmware upload process
1062 * per se.
1063 *
1064 * Can be called either from probe, or after a warm reset. Can not be
1065 * called from within an interrupt. All the flow in this code is
1066 * single-threade; all I/Os are synchronous.
1067 */
1068int i2400m_dev_bootstrap(struct i2400m *i2400m, enum i2400m_bri flags)
1069{
1070 int ret = 0;
1071 struct device *dev = i2400m_dev(i2400m);
1072 const struct firmware *fw;
1073 const struct i2400m_bcf_hdr *bcf; /* Firmware data */
1074
1075 d_fnstart(5, dev, "(i2400m %p)\n", i2400m);
1076 /* Load firmware files to memory. */
1077 ret = request_firmware(&fw, i2400m->bus_fw_name, dev);
1078 if (ret) {
1079 dev_err(dev, "fw %s: request failed: %d\n",
1080 i2400m->bus_fw_name, ret);
1081 goto error_fw_req;
1082 }
1083 bcf = (void *) fw->data;
1084
1085 ret = i2400m_fw_check(i2400m, bcf, fw->size);
1086 if (ret < 0)
1087 goto error_fw_bad;
1088 ret = i2400m_fw_dnload(i2400m, bcf, fw->size, flags);
1089error_fw_bad:
1090 release_firmware(fw);
1091error_fw_req:
1092 d_fnend(5, dev, "(i2400m %p) = %d\n", i2400m, ret);
1093 return ret;
1094}
1095EXPORT_SYMBOL_GPL(i2400m_dev_bootstrap);
diff --git a/drivers/net/wimax/i2400m/i2400m-sdio.h b/drivers/net/wimax/i2400m/i2400m-sdio.h
new file mode 100644
index 000000000000..08c2fb739234
--- /dev/null
+++ b/drivers/net/wimax/i2400m/i2400m-sdio.h
@@ -0,0 +1,132 @@
1/*
2 * Intel Wireless WiMAX Connection 2400m
3 * SDIO-specific i2400m driver definitions
4 *
5 *
6 * Copyright (C) 2007-2008 Intel Corporation. All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 *
12 * * Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * * Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in
16 * the documentation and/or other materials provided with the
17 * distribution.
18 * * Neither the name of Intel Corporation nor the names of its
19 * contributors may be used to endorse or promote products derived
20 * from this software without specific prior written permission.
21 *
22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 *
34 *
35 * Intel Corporation <linux-wimax@intel.com>
36 * Brian Bian <brian.bian@intel.com>
37 * Dirk Brandewie <dirk.j.brandewie@intel.com>
38 * Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
39 * Yanir Lubetkin <yanirx.lubetkin@intel.com>
40 * - Initial implementation
41 *
42 *
43 * This driver implements the bus-specific part of the i2400m for
44 * SDIO. Check i2400m.h for a generic driver description.
45 *
46 * ARCHITECTURE
47 *
48 * This driver sits under the bus-generic i2400m driver, providing the
49 * connection to the device.
50 *
51 * When probed, all the function pointers are setup and then the
52 * bus-generic code called. The generic driver will then use the
53 * provided pointers for uploading firmware (i2400ms_bus_bm*() in
54 * sdio-fw.c) and then setting up the device (i2400ms_dev_*() in
55 * sdio.c).
56 *
57 * Once firmware is uploaded, TX functions (sdio-tx.c) are called when
58 * data is ready for transmission in the TX fifo; then the SDIO IRQ is
59 * fired and data is available (sdio-rx.c), it is sent to the generic
60 * driver for processing with i2400m_rx.
61 */
62
63#ifndef __I2400M_SDIO_H__
64#define __I2400M_SDIO_H__
65
66#include "i2400m.h"
67
68/* Host-Device interface for SDIO */
69enum {
70 I2400MS_BLK_SIZE = 256,
71 I2400MS_PL_SIZE_MAX = 0x3E00,
72
73 I2400MS_DATA_ADDR = 0x0,
74 I2400MS_INTR_STATUS_ADDR = 0x13,
75 I2400MS_INTR_CLEAR_ADDR = 0x13,
76 I2400MS_INTR_ENABLE_ADDR = 0x14,
77 I2400MS_INTR_GET_SIZE_ADDR = 0x2C,
78 /* The number of ticks to wait for the device to signal that
79 * it is ready */
80 I2400MS_INIT_SLEEP_INTERVAL = 10,
81};
82
83
84/**
85 * struct i2400ms - descriptor for a SDIO connected i2400m
86 *
87 * @i2400m: bus-generic i2400m implementation; has to be first (see
88 * it's documentation in i2400m.h).
89 *
90 * @func: pointer to our SDIO function
91 *
92 * @tx_worker: workqueue struct used to TX data when the bus-generic
93 * code signals packets are pending for transmission to the device.
94 *
95 * @tx_workqueue: workqeueue used for data TX; we don't use the
96 * system's workqueue as that might cause deadlocks with code in
97 * the bus-generic driver.
98 */
99struct i2400ms {
100 struct i2400m i2400m; /* FIRST! See doc */
101 struct sdio_func *func;
102
103 struct work_struct tx_worker;
104 struct workqueue_struct *tx_workqueue;
105 char tx_wq_name[32];
106
107 struct dentry *debugfs_dentry;
108};
109
110
111static inline
112void i2400ms_init(struct i2400ms *i2400ms)
113{
114 i2400m_init(&i2400ms->i2400m);
115}
116
117
118extern int i2400ms_rx_setup(struct i2400ms *);
119extern void i2400ms_rx_release(struct i2400ms *);
120extern ssize_t __i2400ms_rx_get_size(struct i2400ms *);
121
122extern int i2400ms_tx_setup(struct i2400ms *);
123extern void i2400ms_tx_release(struct i2400ms *);
124extern void i2400ms_bus_tx_kick(struct i2400m *);
125
126extern ssize_t i2400ms_bus_bm_cmd_send(struct i2400m *,
127 const struct i2400m_bootrom_header *,
128 size_t, int);
129extern ssize_t i2400ms_bus_bm_wait_for_ack(struct i2400m *,
130 struct i2400m_bootrom_header *,
131 size_t);
132#endif /* #ifndef __I2400M_SDIO_H__ */
diff --git a/drivers/net/wimax/i2400m/i2400m-usb.h b/drivers/net/wimax/i2400m/i2400m-usb.h
new file mode 100644
index 000000000000..6f76558b170f
--- /dev/null
+++ b/drivers/net/wimax/i2400m/i2400m-usb.h
@@ -0,0 +1,264 @@
1/*
2 * Intel Wireless WiMAX Connection 2400m
3 * USB-specific i2400m driver definitions
4 *
5 *
6 * Copyright (C) 2007-2008 Intel Corporation. All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 *
12 * * Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * * Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in
16 * the documentation and/or other materials provided with the
17 * distribution.
18 * * Neither the name of Intel Corporation nor the names of its
19 * contributors may be used to endorse or promote products derived
20 * from this software without specific prior written permission.
21 *
22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 *
34 *
35 * Intel Corporation <linux-wimax@intel.com>
36 * Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
37 * Yanir Lubetkin <yanirx.lubetkin@intel.com>
38 * - Initial implementation
39 *
40 *
41 * This driver implements the bus-specific part of the i2400m for
42 * USB. Check i2400m.h for a generic driver description.
43 *
44 * ARCHITECTURE
45 *
46 * This driver listens to notifications sent from the notification
47 * endpoint (in usb-notif.c); when data is ready to read, the code in
48 * there schedules a read from the device (usb-rx.c) and then passes
49 * the data to the generic RX code (rx.c).
50 *
51 * When the generic driver needs to send data (network or control), it
52 * queues up in the TX FIFO (tx.c) and that will notify the driver
53 * through the i2400m->bus_tx_kick() callback
54 * (usb-tx.c:i2400mu_bus_tx_kick) which will send the items in the
55 * FIFO queue.
56 *
57 * This driver, as well, implements the USB-specific ops for the generic
58 * driver to be able to setup/teardown communication with the device
59 * [i2400m_bus_dev_start() and i2400m_bus_dev_stop()], reseting the
60 * device [i2400m_bus_reset()] and performing firmware upload
61 * [i2400m_bus_bm_cmd() and i2400_bus_bm_wait_for_ack()].
62 */
63
64#ifndef __I2400M_USB_H__
65#define __I2400M_USB_H__
66
67#include "i2400m.h"
68#include <linux/kthread.h>
69
70
71/*
72 * Error Density Count: cheapo error density (over time) counter
73 *
74 * Originally by Reinette Chatre <reinette.chatre@intel.com>
75 *
76 * Embed an 'struct edc' somewhere. Each time there is a soft or
77 * retryable error, call edc_inc() and check if the error top
78 * watermark has been reached.
79 */
80enum {
81 EDC_MAX_ERRORS = 10,
82 EDC_ERROR_TIMEFRAME = HZ,
83};
84
85/* error density counter */
86struct edc {
87 unsigned long timestart;
88 u16 errorcount;
89};
90
91static inline void edc_init(struct edc *edc)
92{
93 edc->timestart = jiffies;
94}
95
96/**
97 * edc_inc - report a soft error and check if we are over the watermark
98 *
99 * @edc: pointer to error density counter.
100 * @max_err: maximum number of errors we can accept over the timeframe
101 * @timeframe: lenght of the timeframe (in jiffies).
102 *
103 * Returns: !0 1 if maximum acceptable errors per timeframe has been
104 * exceeded. 0 otherwise.
105 *
106 * This is way to determine if the number of acceptable errors per time
107 * period has been exceeded. It is not accurate as there are cases in which
108 * this scheme will not work, for example if there are periodic occurences
109 * of errors that straddle updates to the start time. This scheme is
110 * sufficient for our usage.
111 *
112 * To use, embed a 'struct edc' somewhere, initialize it with
113 * edc_init() and when an error hits:
114 *
115 * if (do_something_fails_with_a_soft_error) {
116 * if (edc_inc(&my->edc, MAX_ERRORS, MAX_TIMEFRAME))
117 * Ops, hard error, do something about it
118 * else
119 * Retry or ignore, depending on whatever
120 * }
121 */
122static inline int edc_inc(struct edc *edc, u16 max_err, u16 timeframe)
123{
124 unsigned long now;
125
126 now = jiffies;
127 if (now - edc->timestart > timeframe) {
128 edc->errorcount = 1;
129 edc->timestart = now;
130 } else if (++edc->errorcount > max_err) {
131 edc->errorcount = 0;
132 edc->timestart = now;
133 return 1;
134 }
135 return 0;
136}
137
138/* Host-Device interface for USB */
139enum {
140 I2400MU_MAX_NOTIFICATION_LEN = 256,
141 I2400MU_BLK_SIZE = 16,
142 I2400MU_PL_SIZE_MAX = 0x3EFF,
143
144 /* Endpoints */
145 I2400MU_EP_BULK_OUT = 0,
146 I2400MU_EP_NOTIFICATION,
147 I2400MU_EP_RESET_COLD,
148 I2400MU_EP_BULK_IN,
149};
150
151
152/**
153 * struct i2400mu - descriptor for a USB connected i2400m
154 *
155 * @i2400m: bus-generic i2400m implementation; has to be first (see
156 * it's documentation in i2400m.h).
157 *
158 * @usb_dev: pointer to our USB device
159 *
160 * @usb_iface: pointer to our USB interface
161 *
162 * @urb_edc: error density counter; used to keep a density-on-time tab
163 * on how many soft (retryable or ignorable) errors we get. If we
164 * go over the threshold, we consider the bus transport is failing
165 * too much and reset.
166 *
167 * @notif_urb: URB for receiving notifications from the device.
168 *
169 * @tx_kthread: thread we use for data TX. We use a thread because in
170 * order to do deep power saving and put the device to sleep, we
171 * need to call usb_autopm_*() [blocking functions].
172 *
173 * @tx_wq: waitqueue for the TX kthread to sleep when there is no data
174 * to be sent; when more data is available, it is woken up by
175 * i2400mu_bus_tx_kick().
176 *
177 * @rx_kthread: thread we use for data RX. We use a thread because in
178 * order to do deep power saving and put the device to sleep, we
179 * need to call usb_autopm_*() [blocking functions].
180 *
181 * @rx_wq: waitqueue for the RX kthread to sleep when there is no data
182 * to receive. When data is available, it is woken up by
183 * usb-notif.c:i2400mu_notification_grok().
184 *
185 * @rx_pending_count: number of rx-data-ready notifications that were
186 * still not handled by the RX kthread.
187 *
188 * @rx_size: current RX buffer size that is being used.
189 *
190 * @rx_size_acc: accumulator of the sizes of the previous read
191 * transactions.
192 *
193 * @rx_size_cnt: number of read transactions accumulated in
194 * @rx_size_acc.
195 *
196 * @do_autopm: disable(0)/enable(>0) calling the
197 * usb_autopm_get/put_interface() barriers when executing
198 * commands. See doc in i2400mu_suspend() for more information.
199 *
200 * @rx_size_auto_shrink: if true, the rx_size is shrinked
201 * automatically based on the average size of the received
202 * transactions. This allows the receive code to allocate smaller
203 * chunks of memory and thus reduce pressure on the memory
204 * allocator by not wasting so much space. By default it is
205 * enabled.
206 *
207 * @debugfs_dentry: hookup for debugfs files.
208 * These have to be in a separate directory, a child of
209 * (wimax_dev->debugfs_dentry) so they can be removed when the
210 * module unloads, as we don't keep each dentry.
211 */
212struct i2400mu {
213 struct i2400m i2400m; /* FIRST! See doc */
214
215 struct usb_device *usb_dev;
216 struct usb_interface *usb_iface;
217 struct edc urb_edc; /* Error density counter */
218
219 struct urb *notif_urb;
220 struct task_struct *tx_kthread;
221 wait_queue_head_t tx_wq;
222
223 struct task_struct *rx_kthread;
224 wait_queue_head_t rx_wq;
225 atomic_t rx_pending_count;
226 size_t rx_size, rx_size_acc, rx_size_cnt;
227 atomic_t do_autopm;
228 u8 rx_size_auto_shrink;
229
230 struct dentry *debugfs_dentry;
231};
232
233
234static inline
235void i2400mu_init(struct i2400mu *i2400mu)
236{
237 i2400m_init(&i2400mu->i2400m);
238 edc_init(&i2400mu->urb_edc);
239 init_waitqueue_head(&i2400mu->tx_wq);
240 atomic_set(&i2400mu->rx_pending_count, 0);
241 init_waitqueue_head(&i2400mu->rx_wq);
242 i2400mu->rx_size = PAGE_SIZE - sizeof(struct skb_shared_info);
243 atomic_set(&i2400mu->do_autopm, 1);
244 i2400mu->rx_size_auto_shrink = 1;
245}
246
247extern int i2400mu_notification_setup(struct i2400mu *);
248extern void i2400mu_notification_release(struct i2400mu *);
249
250extern int i2400mu_rx_setup(struct i2400mu *);
251extern void i2400mu_rx_release(struct i2400mu *);
252extern void i2400mu_rx_kick(struct i2400mu *);
253
254extern int i2400mu_tx_setup(struct i2400mu *);
255extern void i2400mu_tx_release(struct i2400mu *);
256extern void i2400mu_bus_tx_kick(struct i2400m *);
257
258extern ssize_t i2400mu_bus_bm_cmd_send(struct i2400m *,
259 const struct i2400m_bootrom_header *,
260 size_t, int);
261extern ssize_t i2400mu_bus_bm_wait_for_ack(struct i2400m *,
262 struct i2400m_bootrom_header *,
263 size_t);
264#endif /* #ifndef __I2400M_USB_H__ */
diff --git a/drivers/net/wimax/i2400m/i2400m.h b/drivers/net/wimax/i2400m/i2400m.h
new file mode 100644
index 000000000000..067c871cc226
--- /dev/null
+++ b/drivers/net/wimax/i2400m/i2400m.h
@@ -0,0 +1,755 @@
1/*
2 * Intel Wireless WiMAX Connection 2400m
3 * Declarations for bus-generic internal APIs
4 *
5 *
6 * Copyright (C) 2007-2008 Intel Corporation. All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 *
12 * * Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * * Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in
16 * the documentation and/or other materials provided with the
17 * distribution.
18 * * Neither the name of Intel Corporation nor the names of its
19 * contributors may be used to endorse or promote products derived
20 * from this software without specific prior written permission.
21 *
22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 *
34 *
35 * Intel Corporation <linux-wimax@intel.com>
36 * Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
37 * Yanir Lubetkin <yanirx.lubetkin@intel.com>
38 * - Initial implementation
39 *
40 *
41 * GENERAL DRIVER ARCHITECTURE
42 *
43 * The i2400m driver is split in the following two major parts:
44 *
45 * - bus specific driver
46 * - bus generic driver (this part)
47 *
48 * The bus specific driver sets up stuff specific to the bus the
49 * device is connected to (USB, SDIO, PCI, tam-tam...non-authoritative
50 * nor binding list) which is basically the device-model management
51 * (probe/disconnect, etc), moving data from device to kernel and
52 * back, doing the power saving details and reseting the device.
53 *
54 * For details on each bus-specific driver, see it's include file,
55 * i2400m-BUSNAME.h
56 *
57 * The bus-generic functionality break up is:
58 *
59 * - Firmware upload: fw.c - takes care of uploading firmware to the
60 * device. bus-specific driver just needs to provides a way to
61 * execute boot-mode commands and to reset the device.
62 *
63 * - RX handling: rx.c - receives data from the bus-specific code and
64 * feeds it to the network or WiMAX stack or uses it to modify
65 * the driver state. bus-specific driver only has to receive
66 * frames and pass them to this module.
67 *
68 * - TX handling: tx.c - manages the TX FIFO queue and provides means
69 * for the bus-specific TX code to pull data from the FIFO
70 * queue. bus-specific code just pulls frames from this module
71 * to sends them to the device.
72 *
73 * - netdev glue: netdev.c - interface with Linux networking
74 * stack. Pass around data frames, and configure when the
75 * device is up and running or shutdown (through ifconfig up /
76 * down). Bus-generic only.
77 *
78 * - control ops: control.c - implements various commmands for
79 * controlling the device. bus-generic only.
80 *
81 * - device model glue: driver.c - implements helpers for the
82 * device-model glue done by the bus-specific layer
83 * (setup/release the driver resources), turning the device on
84 * and off, handling the device reboots/resets and a few simple
85 * WiMAX stack ops.
86 *
87 * Code is also broken up in linux-glue / device-glue.
88 *
89 * Linux glue contains functions that deal mostly with gluing with the
90 * rest of the Linux kernel.
91 *
92 * Device-glue are functions that deal mostly with the way the device
93 * does things and talk the device's language.
94 *
95 * device-glue code is licensed BSD so other open source OSes can take
96 * it to implement their drivers.
97 *
98 *
99 * APIs AND HEADER FILES
100 *
101 * This bus generic code exports three APIs:
102 *
103 * - HDI (host-device interface) definitions common to all busses
104 * (include/linux/wimax/i2400m.h); these can be also used by user
105 * space code.
106 * - internal API for the bus-generic code
107 * - external API for the bus-specific drivers
108 *
109 *
110 * LIFE CYCLE:
111 *
112 * When the bus-specific driver probes, it allocates a network device
113 * with enough space for it's data structue, that must contain a
114 * &struct i2400m at the top.
115 *
116 * On probe, it needs to fill the i2400m members marked as [fill], as
117 * well as i2400m->wimax_dev.net_dev and call i2400m_setup(). The
118 * i2400m driver will only register with the WiMAX and network stacks;
119 * the only access done to the device is to read the MAC address so we
120 * can register a network device. This calls i2400m_dev_start() to
121 * load firmware, setup communication with the device and configure it
122 * for operation.
123 *
124 * At this point, control and data communications are possible.
125 *
126 * On disconnect/driver unload, the bus-specific disconnect function
127 * calls i2400m_release() to undo i2400m_setup(). i2400m_dev_stop()
128 * shuts the firmware down and releases resources uses to communicate
129 * with the device.
130 *
131 * While the device is up, it might reset. The bus-specific driver has
132 * to catch that situation and call i2400m_dev_reset_handle() to deal
133 * with it (reset the internal driver structures and go back to square
134 * one).
135 */
136
137#ifndef __I2400M_H__
138#define __I2400M_H__
139
140#include <linux/usb.h>
141#include <linux/netdevice.h>
142#include <linux/completion.h>
143#include <linux/rwsem.h>
144#include <asm/atomic.h>
145#include <net/wimax.h>
146#include <linux/wimax/i2400m.h>
147#include <asm/byteorder.h>
148
149/* Misc constants */
150enum {
151 /* Firmware uploading */
152 I2400M_BOOT_RETRIES = 3,
153 /* Size of the Boot Mode Command buffer */
154 I2400M_BM_CMD_BUF_SIZE = 16 * 1024,
155 I2400M_BM_ACK_BUF_SIZE = 256,
156};
157
158
159/* Firmware version we request when pulling the fw image file */
160#define I2400M_FW_VERSION "1.3"
161
162
163/**
164 * i2400m_reset_type - methods to reset a device
165 *
166 * @I2400M_RT_WARM: Reset without device disconnection, device handles
167 * are kept valid but state is back to power on, with firmware
168 * re-uploaded.
169 * @I2400M_RT_COLD: Tell the device to disconnect itself from the bus
170 * and reconnect. Renders all device handles invalid.
171 * @I2400M_RT_BUS: Tells the bus to reset the device; last measure
172 * used when both types above don't work.
173 */
174enum i2400m_reset_type {
175 I2400M_RT_WARM, /* first measure */
176 I2400M_RT_COLD, /* second measure */
177 I2400M_RT_BUS, /* call in artillery */
178};
179
180struct i2400m_reset_ctx;
181
182/**
183 * struct i2400m - descriptor for an Intel 2400m
184 *
185 * Members marked with [fill] must be filled out/initialized before
186 * calling i2400m_setup().
187 *
188 * @bus_tx_block_size: [fill] SDIO imposes a 256 block size, USB 16,
189 * so we have a tx_blk_size variable that the bus layer sets to
190 * tell the engine how much of that we need.
191 *
192 * @bus_pl_size_max: [fill] Maximum payload size.
193 *
194 * @bus_dev_start: [fill] Function called by the bus-generic code
195 * [i2400m_dev_start()] to setup the bus-specific communications
196 * to the the device. See LIFE CYCLE above.
197 *
198 * NOTE: Doesn't need to upload the firmware, as that is taken
199 * care of by the bus-generic code.
200 *
201 * @bus_dev_stop: [fill] Function called by the bus-generic code
202 * [i2400m_dev_stop()] to shutdown the bus-specific communications
203 * to the the device. See LIFE CYCLE above.
204 *
205 * This function does not need to reset the device, just tear down
206 * all the host resources created to handle communication with
207 * the device.
208 *
209 * @bus_tx_kick: [fill] Function called by the bus-generic code to let
210 * the bus-specific code know that there is data available in the
211 * TX FIFO for transmission to the device.
212 *
213 * This function cannot sleep.
214 *
215 * @bus_reset: [fill] Function called by the bus-generic code to reset
216 * the device in in various ways. Doesn't need to wait for the
217 * reset to finish.
218 *
219 * If warm or cold reset fail, this function is expected to do a
220 * bus-specific reset (eg: USB reset) to get the device to a
221 * working state (even if it implies device disconecction).
222 *
223 * Note the warm reset is used by the firmware uploader to
224 * reinitialize the device.
225 *
226 * IMPORTANT: this is called very early in the device setup
227 * process, so it cannot rely on common infrastructure being laid
228 * out.
229 *
230 * @bus_bm_cmd_send: [fill] Function called to send a boot-mode
231 * command. Flags are defined in 'enum i2400m_bm_cmd_flags'. This
232 * is synchronous and has to return 0 if ok or < 0 errno code in
233 * any error condition.
234 *
235 * @bus_bm_wait_for_ack: [fill] Function called to wait for a
236 * boot-mode notification (that can be a response to a previously
237 * issued command or an asynchronous one). Will read until all the
238 * indicated size is read or timeout. Reading more or less data
239 * than asked for is an error condition. Return 0 if ok, < 0 errno
240 * code on error.
241 *
242 * The caller to this function will check if the response is a
243 * barker that indicates the device going into reset mode.
244 *
245 * @bus_fw_name: [fill] name of the firmware image (in most cases,
246 * they are all the same for a single release, except that they
247 * have the type of the bus embedded in the name (eg:
248 * i2400m-fw-X-VERSION.sbcf, where X is the bus name).
249 *
250 * @bus_bm_mac_addr_impaired: [fill] Set to true if the device's MAC
251 * address provided in boot mode is kind of broken and needs to
252 * be re-read later on.
253 *
254 *
255 * @wimax_dev: WiMAX generic device for linkage into the kernel WiMAX
256 * stack. Due to the way a net_device is allocated, we need to
257 * force this to be the first field so that we can get from
258 * netdev_priv() the right pointer.
259 *
260 * @state: device's state (as reported by it)
261 *
262 * @state_wq: waitqueue that is woken up whenever the state changes
263 *
264 * @tx_lock: spinlock to protect TX members
265 *
266 * @tx_buf: FIFO buffer for TX; we queue data here
267 *
268 * @tx_in: FIFO index for incoming data. Note this doesn't wrap around
269 * and it is always greater than @tx_out.
270 *
271 * @tx_out: FIFO index for outgoing data
272 *
273 * @tx_msg: current TX message that is active in the FIFO for
274 * appending payloads.
275 *
276 * @tx_sequence: current sequence number for TX messages from the
277 * device to the host.
278 *
279 * @tx_msg_size: size of the current message being transmitted by the
280 * bus-specific code.
281 *
282 * @tx_pl_num: total number of payloads sent
283 *
284 * @tx_pl_max: maximum number of payloads sent in a TX message
285 *
286 * @tx_pl_min: minimum number of payloads sent in a TX message
287 *
288 * @tx_num: number of TX messages sent
289 *
290 * @tx_size_acc: number of bytes in all TX messages sent
291 * (this is different to net_dev's statistics as it also counts
292 * control messages).
293 *
294 * @tx_size_min: smallest TX message sent.
295 *
296 * @tx_size_max: biggest TX message sent.
297 *
298 * @rx_lock: spinlock to protect RX members
299 *
300 * @rx_pl_num: total number of payloads received
301 *
302 * @rx_pl_max: maximum number of payloads received in a RX message
303 *
304 * @rx_pl_min: minimum number of payloads received in a RX message
305 *
306 * @rx_num: number of RX messages received
307 *
308 * @rx_size_acc: number of bytes in all RX messages received
309 * (this is different to net_dev's statistics as it also counts
310 * control messages).
311 *
312 * @rx_size_min: smallest RX message received.
313 *
314 * @rx_size_max: buggest RX message received.
315 *
316 * @init_mutex: Mutex used for serializing the device bringup
317 * sequence; this way if the device reboots in the middle, we
318 * don't try to do a bringup again while we are tearing down the
319 * one that failed.
320 *
321 * Can't reuse @msg_mutex because from within the bringup sequence
322 * we need to send messages to the device and thus use @msg_mutex.
323 *
324 * @msg_mutex: mutex used to send control commands to the device (we
325 * only allow one at a time, per host-device interface design).
326 *
327 * @msg_completion: used to wait for an ack to a control command sent
328 * to the device.
329 *
330 * @ack_skb: used to store the actual ack to a control command if the
331 * reception of the command was successful. Otherwise, a ERR_PTR()
332 * errno code that indicates what failed with the ack reception.
333 *
334 * Only valid after @msg_completion is woken up. Only updateable
335 * if @msg_completion is armed. Only touched by
336 * i2400m_msg_to_dev().
337 *
338 * Protected by @rx_lock. In theory the command execution flow is
339 * sequential, but in case the device sends an out-of-phase or
340 * very delayed response, we need to avoid it trampling current
341 * execution.
342 *
343 * @bm_cmd_buf: boot mode command buffer for composing firmware upload
344 * commands.
345 *
346 * USB can't r/w to stack, vmalloc, etc...as well, we end up
347 * having to alloc/free a lot to compose commands, so we use these
348 * for stagging and not having to realloc all the time.
349 *
350 * This assumes the code always runs serialized. Only one thread
351 * can call i2400m_bm_cmd() at the same time.
352 *
353 * @bm_ack_buf: boot mode acknoledge buffer for staging reception of
354 * responses to commands.
355 *
356 * See @bm_cmd_buf.
357 *
358 * @work_queue: work queue for processing device reports. This
359 * workqueue cannot be used for processing TX or RX to the device,
360 * as from it we'll process device reports, which might require
361 * further communication with the device.
362 *
363 * @debugfs_dentry: hookup for debugfs files.
364 * These have to be in a separate directory, a child of
365 * (wimax_dev->debugfs_dentry) so they can be removed when the
366 * module unloads, as we don't keep each dentry.
367 */
368struct i2400m {
369 struct wimax_dev wimax_dev; /* FIRST! See doc */
370
371 unsigned updown:1; /* Network device is up or down */
372 unsigned boot_mode:1; /* is the device in boot mode? */
373 unsigned sboot:1; /* signed or unsigned fw boot */
374 unsigned ready:1; /* all probing steps done */
375 u8 trace_msg_from_user; /* echo rx msgs to 'trace' pipe */
376 /* typed u8 so debugfs/u8 can tweak */
377 enum i2400m_system_state state;
378 wait_queue_head_t state_wq; /* Woken up when on state updates */
379
380 size_t bus_tx_block_size;
381 size_t bus_pl_size_max;
382 int (*bus_dev_start)(struct i2400m *);
383 void (*bus_dev_stop)(struct i2400m *);
384 void (*bus_tx_kick)(struct i2400m *);
385 int (*bus_reset)(struct i2400m *, enum i2400m_reset_type);
386 ssize_t (*bus_bm_cmd_send)(struct i2400m *,
387 const struct i2400m_bootrom_header *,
388 size_t, int flags);
389 ssize_t (*bus_bm_wait_for_ack)(struct i2400m *,
390 struct i2400m_bootrom_header *, size_t);
391 const char *bus_fw_name;
392 unsigned bus_bm_mac_addr_impaired:1;
393
394 spinlock_t tx_lock; /* protect TX state */
395 void *tx_buf;
396 size_t tx_in, tx_out;
397 struct i2400m_msg_hdr *tx_msg;
398 size_t tx_sequence, tx_msg_size;
399 /* TX stats */
400 unsigned tx_pl_num, tx_pl_max, tx_pl_min,
401 tx_num, tx_size_acc, tx_size_min, tx_size_max;
402
403 /* RX stats */
404 spinlock_t rx_lock; /* protect RX state */
405 unsigned rx_pl_num, rx_pl_max, rx_pl_min,
406 rx_num, rx_size_acc, rx_size_min, rx_size_max;
407
408 struct mutex msg_mutex; /* serialize command execution */
409 struct completion msg_completion;
410 struct sk_buff *ack_skb; /* protected by rx_lock */
411
412 void *bm_ack_buf; /* for receiving acks over USB */
413 void *bm_cmd_buf; /* for issuing commands over USB */
414
415 struct workqueue_struct *work_queue;
416
417 struct mutex init_mutex; /* protect bringup seq */
418 struct i2400m_reset_ctx *reset_ctx; /* protected by init_mutex */
419
420 struct work_struct wake_tx_ws;
421 struct sk_buff *wake_tx_skb;
422
423 struct dentry *debugfs_dentry;
424};
425
426
427/*
428 * Initialize a 'struct i2400m' from all zeroes
429 *
430 * This is a bus-generic API call.
431 */
432static inline
433void i2400m_init(struct i2400m *i2400m)
434{
435 wimax_dev_init(&i2400m->wimax_dev);
436
437 i2400m->boot_mode = 1;
438 init_waitqueue_head(&i2400m->state_wq);
439
440 spin_lock_init(&i2400m->tx_lock);
441 i2400m->tx_pl_min = UINT_MAX;
442 i2400m->tx_size_min = UINT_MAX;
443
444 spin_lock_init(&i2400m->rx_lock);
445 i2400m->rx_pl_min = UINT_MAX;
446 i2400m->rx_size_min = UINT_MAX;
447
448 mutex_init(&i2400m->msg_mutex);
449 init_completion(&i2400m->msg_completion);
450
451 mutex_init(&i2400m->init_mutex);
452 /* wake_tx_ws is initialized in i2400m_tx_setup() */
453}
454
455
456/*
457 * Bus-generic internal APIs
458 * -------------------------
459 */
460
461static inline
462struct i2400m *wimax_dev_to_i2400m(struct wimax_dev *wimax_dev)
463{
464 return container_of(wimax_dev, struct i2400m, wimax_dev);
465}
466
467static inline
468struct i2400m *net_dev_to_i2400m(struct net_device *net_dev)
469{
470 return wimax_dev_to_i2400m(netdev_priv(net_dev));
471}
472
473/*
474 * Boot mode support
475 */
476
477/**
478 * i2400m_bm_cmd_flags - flags to i2400m_bm_cmd()
479 *
480 * @I2400M_BM_CMD_RAW: send the command block as-is, without doing any
481 * extra processing for adding CRC.
482 */
483enum i2400m_bm_cmd_flags {
484 I2400M_BM_CMD_RAW = 1 << 2,
485};
486
487/**
488 * i2400m_bri - Boot-ROM indicators
489 *
490 * Flags for i2400m_bootrom_init() and i2400m_dev_bootstrap() [which
491 * are passed from things like i2400m_setup()]. Can be combined with
492 * |.
493 *
494 * @I2400M_BRI_SOFT: The device rebooted already and a reboot
495 * barker received, proceed directly to ack the boot sequence.
496 * @I2400M_BRI_NO_REBOOT: Do not reboot the device and proceed
497 * directly to wait for a reboot barker from the device.
498 * @I2400M_BRI_MAC_REINIT: We need to reinitialize the boot
499 * rom after reading the MAC adress. This is quite a dirty hack,
500 * if you ask me -- the device requires the bootrom to be
501 * intialized after reading the MAC address.
502 */
503enum i2400m_bri {
504 I2400M_BRI_SOFT = 1 << 1,
505 I2400M_BRI_NO_REBOOT = 1 << 2,
506 I2400M_BRI_MAC_REINIT = 1 << 3,
507};
508
509extern void i2400m_bm_cmd_prepare(struct i2400m_bootrom_header *);
510extern int i2400m_dev_bootstrap(struct i2400m *, enum i2400m_bri);
511extern int i2400m_read_mac_addr(struct i2400m *);
512extern int i2400m_bootrom_init(struct i2400m *, enum i2400m_bri);
513
514/* Make/grok boot-rom header commands */
515
516static inline
517__le32 i2400m_brh_command(enum i2400m_brh_opcode opcode, unsigned use_checksum,
518 unsigned direct_access)
519{
520 return cpu_to_le32(
521 I2400M_BRH_SIGNATURE
522 | (direct_access ? I2400M_BRH_DIRECT_ACCESS : 0)
523 | I2400M_BRH_RESPONSE_REQUIRED /* response always required */
524 | (use_checksum ? I2400M_BRH_USE_CHECKSUM : 0)
525 | (opcode & I2400M_BRH_OPCODE_MASK));
526}
527
528static inline
529void i2400m_brh_set_opcode(struct i2400m_bootrom_header *hdr,
530 enum i2400m_brh_opcode opcode)
531{
532 hdr->command = cpu_to_le32(
533 (le32_to_cpu(hdr->command) & ~I2400M_BRH_OPCODE_MASK)
534 | (opcode & I2400M_BRH_OPCODE_MASK));
535}
536
537static inline
538unsigned i2400m_brh_get_opcode(const struct i2400m_bootrom_header *hdr)
539{
540 return le32_to_cpu(hdr->command) & I2400M_BRH_OPCODE_MASK;
541}
542
543static inline
544unsigned i2400m_brh_get_response(const struct i2400m_bootrom_header *hdr)
545{
546 return (le32_to_cpu(hdr->command) & I2400M_BRH_RESPONSE_MASK)
547 >> I2400M_BRH_RESPONSE_SHIFT;
548}
549
550static inline
551unsigned i2400m_brh_get_use_checksum(const struct i2400m_bootrom_header *hdr)
552{
553 return le32_to_cpu(hdr->command) & I2400M_BRH_USE_CHECKSUM;
554}
555
556static inline
557unsigned i2400m_brh_get_response_required(
558 const struct i2400m_bootrom_header *hdr)
559{
560 return le32_to_cpu(hdr->command) & I2400M_BRH_RESPONSE_REQUIRED;
561}
562
563static inline
564unsigned i2400m_brh_get_direct_access(const struct i2400m_bootrom_header *hdr)
565{
566 return le32_to_cpu(hdr->command) & I2400M_BRH_DIRECT_ACCESS;
567}
568
569static inline
570unsigned i2400m_brh_get_signature(const struct i2400m_bootrom_header *hdr)
571{
572 return (le32_to_cpu(hdr->command) & I2400M_BRH_SIGNATURE_MASK)
573 >> I2400M_BRH_SIGNATURE_SHIFT;
574}
575
576
577/*
578 * Driver / device setup and internal functions
579 */
580extern void i2400m_netdev_setup(struct net_device *net_dev);
581extern int i2400m_tx_setup(struct i2400m *);
582extern void i2400m_wake_tx_work(struct work_struct *);
583extern void i2400m_tx_release(struct i2400m *);
584
585extern void i2400m_net_rx(struct i2400m *, struct sk_buff *, unsigned,
586 const void *, int);
587enum i2400m_pt;
588extern int i2400m_tx(struct i2400m *, const void *, size_t, enum i2400m_pt);
589
590#ifdef CONFIG_DEBUG_FS
591extern int i2400m_debugfs_add(struct i2400m *);
592extern void i2400m_debugfs_rm(struct i2400m *);
593#else
594static inline int i2400m_debugfs_add(struct i2400m *i2400m)
595{
596 return 0;
597}
598static inline void i2400m_debugfs_rm(struct i2400m *i2400m) {}
599#endif
600
601/* Called by _dev_start()/_dev_stop() to initialize the device itself */
602extern int i2400m_dev_initialize(struct i2400m *);
603extern void i2400m_dev_shutdown(struct i2400m *);
604
605extern struct attribute_group i2400m_dev_attr_group;
606
607extern int i2400m_schedule_work(struct i2400m *,
608 void (*)(struct work_struct *), gfp_t);
609
610/* HDI message's payload description handling */
611
612static inline
613size_t i2400m_pld_size(const struct i2400m_pld *pld)
614{
615 return I2400M_PLD_SIZE_MASK & le32_to_cpu(pld->val);
616}
617
618static inline
619enum i2400m_pt i2400m_pld_type(const struct i2400m_pld *pld)
620{
621 return (I2400M_PLD_TYPE_MASK & le32_to_cpu(pld->val))
622 >> I2400M_PLD_TYPE_SHIFT;
623}
624
625static inline
626void i2400m_pld_set(struct i2400m_pld *pld, size_t size,
627 enum i2400m_pt type)
628{
629 pld->val = cpu_to_le32(
630 ((type << I2400M_PLD_TYPE_SHIFT) & I2400M_PLD_TYPE_MASK)
631 | (size & I2400M_PLD_SIZE_MASK));
632}
633
634
635/*
636 * API for the bus-specific drivers
637 * --------------------------------
638 */
639
640static inline
641struct i2400m *i2400m_get(struct i2400m *i2400m)
642{
643 dev_hold(i2400m->wimax_dev.net_dev);
644 return i2400m;
645}
646
647static inline
648void i2400m_put(struct i2400m *i2400m)
649{
650 dev_put(i2400m->wimax_dev.net_dev);
651}
652
653extern int i2400m_dev_reset_handle(struct i2400m *);
654
655/*
656 * _setup()/_release() are called by the probe/disconnect functions of
657 * the bus-specific drivers.
658 */
659extern int i2400m_setup(struct i2400m *, enum i2400m_bri bm_flags);
660extern void i2400m_release(struct i2400m *);
661
662extern int i2400m_rx(struct i2400m *, struct sk_buff *);
663extern struct i2400m_msg_hdr *i2400m_tx_msg_get(struct i2400m *, size_t *);
664extern void i2400m_tx_msg_sent(struct i2400m *);
665
666static const __le32 i2400m_NBOOT_BARKER[4] = {
667 __constant_cpu_to_le32(I2400M_NBOOT_BARKER),
668 __constant_cpu_to_le32(I2400M_NBOOT_BARKER),
669 __constant_cpu_to_le32(I2400M_NBOOT_BARKER),
670 __constant_cpu_to_le32(I2400M_NBOOT_BARKER)
671};
672
673static const __le32 i2400m_SBOOT_BARKER[4] = {
674 __constant_cpu_to_le32(I2400M_SBOOT_BARKER),
675 __constant_cpu_to_le32(I2400M_SBOOT_BARKER),
676 __constant_cpu_to_le32(I2400M_SBOOT_BARKER),
677 __constant_cpu_to_le32(I2400M_SBOOT_BARKER)
678};
679
680
681/*
682 * Utility functions
683 */
684
685static inline
686struct device *i2400m_dev(struct i2400m *i2400m)
687{
688 return i2400m->wimax_dev.net_dev->dev.parent;
689}
690
691/*
692 * Helper for scheduling simple work functions
693 *
694 * This struct can get any kind of payload attached (normally in the
695 * form of a struct where you pack the stuff you want to pass to the
696 * _work function).
697 */
698struct i2400m_work {
699 struct work_struct ws;
700 struct i2400m *i2400m;
701 u8 pl[0];
702};
703extern int i2400m_queue_work(struct i2400m *,
704 void (*)(struct work_struct *), gfp_t,
705 const void *, size_t);
706
707extern int i2400m_msg_check_status(const struct i2400m_l3l4_hdr *,
708 char *, size_t);
709extern int i2400m_msg_size_check(struct i2400m *,
710 const struct i2400m_l3l4_hdr *, size_t);
711extern struct sk_buff *i2400m_msg_to_dev(struct i2400m *, const void *, size_t);
712extern void i2400m_msg_to_dev_cancel_wait(struct i2400m *, int);
713extern void i2400m_msg_ack_hook(struct i2400m *,
714 const struct i2400m_l3l4_hdr *, size_t);
715extern void i2400m_report_hook(struct i2400m *,
716 const struct i2400m_l3l4_hdr *, size_t);
717extern int i2400m_cmd_enter_powersave(struct i2400m *);
718extern int i2400m_cmd_get_state(struct i2400m *);
719extern int i2400m_cmd_exit_idle(struct i2400m *);
720extern struct sk_buff *i2400m_get_device_info(struct i2400m *);
721extern int i2400m_firmware_check(struct i2400m *);
722extern int i2400m_set_init_config(struct i2400m *,
723 const struct i2400m_tlv_hdr **, size_t);
724
725static inline
726struct usb_endpoint_descriptor *usb_get_epd(struct usb_interface *iface, int ep)
727{
728 return &iface->cur_altsetting->endpoint[ep].desc;
729}
730
731extern int i2400m_op_rfkill_sw_toggle(struct wimax_dev *,
732 enum wimax_rf_state);
733extern void i2400m_report_tlv_rf_switches_status(
734 struct i2400m *, const struct i2400m_tlv_rf_switches_status *);
735
736
737/*
738 * Do a millisecond-sleep for allowing wireshark to dump all the data
739 * packets. Used only for debugging.
740 */
741static inline
742void __i2400m_msleep(unsigned ms)
743{
744#if 1
745#else
746 msleep(ms);
747#endif
748}
749
750/* Module parameters */
751
752extern int i2400m_idle_mode_disabled;
753
754
755#endif /* #ifndef __I2400M_H__ */
diff --git a/drivers/net/wimax/i2400m/netdev.c b/drivers/net/wimax/i2400m/netdev.c
new file mode 100644
index 000000000000..63fe708e8a31
--- /dev/null
+++ b/drivers/net/wimax/i2400m/netdev.c
@@ -0,0 +1,524 @@
1/*
2 * Intel Wireless WiMAX Connection 2400m
3 * Glue with the networking stack
4 *
5 *
6 * Copyright (C) 2007 Intel Corporation <linux-wimax@intel.com>
7 * Yanir Lubetkin <yanirx.lubetkin@intel.com>
8 * Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
9 *
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License version
12 * 2 as published by the Free Software Foundation.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
22 * 02110-1301, USA.
23 *
24 *
25 * This implements an ethernet device for the i2400m.
26 *
27 * We fake being an ethernet device to simplify the support from user
28 * space and from the other side. The world is (sadly) configured to
29 * take in only Ethernet devices...
30 *
31 * Because of this, currently there is an copy-each-rxed-packet
32 * overhead on the RX path. Each IP packet has to be reallocated to
33 * add an ethernet header (as there is no space in what we get from
34 * the device). This is a known drawback and coming versions of the
35 * device's firmware are being changed to add header space that can be
36 * used to insert the ethernet header without having to reallocate and
37 * copy.
38 *
39 * TX error handling is tricky; because we have to FIFO/queue the
40 * buffers for transmission (as the hardware likes it aggregated), we
41 * just give the skb to the TX subsystem and by the time it is
42 * transmitted, we have long forgotten about it. So we just don't care
43 * too much about it.
44 *
45 * Note that when the device is in idle mode with the basestation, we
46 * need to negotiate coming back up online. That involves negotiation
47 * and possible user space interaction. Thus, we defer to a workqueue
48 * to do all that. By default, we only queue a single packet and drop
49 * the rest, as potentially the time to go back from idle to normal is
50 * long.
51 *
52 * ROADMAP
53 *
54 * i2400m_open Called on ifconfig up
55 * i2400m_stop Called on ifconfig down
56 *
57 * i2400m_hard_start_xmit Called by the network stack to send a packet
58 * i2400m_net_wake_tx Wake up device from basestation-IDLE & TX
59 * i2400m_wake_tx_work
60 * i2400m_cmd_exit_idle
61 * i2400m_tx
62 * i2400m_net_tx TX a data frame
63 * i2400m_tx
64 *
65 * i2400m_change_mtu Called on ifconfig mtu XXX
66 *
67 * i2400m_tx_timeout Called when the device times out
68 *
69 * i2400m_net_rx Called by the RX code when a data frame is
70 * available.
71 * i2400m_netdev_setup Called to setup all the netdev stuff from
72 * alloc_netdev.
73 */
74#include <linux/if_arp.h>
75#include <linux/netdevice.h>
76#include "i2400m.h"
77
78
79#define D_SUBMODULE netdev
80#include "debug-levels.h"
81
82enum {
83/* netdev interface */
84 /*
85 * Out of NWG spec (R1_v1.2.2), 3.3.3 ASN Bearer Plane MTU Size
86 *
87 * The MTU is 1400 or less
88 */
89 I2400M_MAX_MTU = 1400,
90 I2400M_TX_TIMEOUT = HZ,
91 I2400M_TX_QLEN = 5,
92};
93
94
95static
96int i2400m_open(struct net_device *net_dev)
97{
98 int result;
99 struct i2400m *i2400m = net_dev_to_i2400m(net_dev);
100 struct device *dev = i2400m_dev(i2400m);
101
102 d_fnstart(3, dev, "(net_dev %p [i2400m %p])\n", net_dev, i2400m);
103 if (i2400m->ready == 0) {
104 dev_err(dev, "Device is still initializing\n");
105 result = -EBUSY;
106 } else
107 result = 0;
108 d_fnend(3, dev, "(net_dev %p [i2400m %p]) = %d\n",
109 net_dev, i2400m, result);
110 return result;
111}
112
113
114/*
115 *
116 * On kernel versions where cancel_work_sync() didn't return anything,
117 * we rely on wake_tx_skb() being non-NULL.
118 */
119static
120int i2400m_stop(struct net_device *net_dev)
121{
122 struct i2400m *i2400m = net_dev_to_i2400m(net_dev);
123 struct device *dev = i2400m_dev(i2400m);
124
125 d_fnstart(3, dev, "(net_dev %p [i2400m %p])\n", net_dev, i2400m);
126 /* See i2400m_hard_start_xmit(), references are taken there
127 * and here we release them if the work was still
128 * pending. Note we can't differentiate work not pending vs
129 * never scheduled, so the NULL check does that. */
130 if (cancel_work_sync(&i2400m->wake_tx_ws) == 0
131 && i2400m->wake_tx_skb != NULL) {
132 unsigned long flags;
133 struct sk_buff *wake_tx_skb;
134 spin_lock_irqsave(&i2400m->tx_lock, flags);
135 wake_tx_skb = i2400m->wake_tx_skb; /* compat help */
136 i2400m->wake_tx_skb = NULL; /* compat help */
137 spin_unlock_irqrestore(&i2400m->tx_lock, flags);
138 i2400m_put(i2400m);
139 kfree_skb(wake_tx_skb);
140 }
141 d_fnend(3, dev, "(net_dev %p [i2400m %p]) = 0\n", net_dev, i2400m);
142 return 0;
143}
144
145
146/*
147 * Wake up the device and transmit a held SKB, then restart the net queue
148 *
149 * When the device goes into basestation-idle mode, we need to tell it
150 * to exit that mode; it will negotiate with the base station, user
151 * space may have to intervene to rehandshake crypto and then tell us
152 * when it is ready to transmit the packet we have "queued". Still we
153 * need to give it sometime after it reports being ok.
154 *
155 * On error, there is not much we can do. If the error was on TX, we
156 * still wake the queue up to see if the next packet will be luckier.
157 *
158 * If _cmd_exit_idle() fails...well, it could be many things; most
159 * commonly it is that something else took the device out of IDLE mode
160 * (for example, the base station). In that case we get an -EILSEQ and
161 * we are just going to ignore that one. If the device is back to
162 * connected, then fine -- if it is someother state, the packet will
163 * be dropped anyway.
164 */
165void i2400m_wake_tx_work(struct work_struct *ws)
166{
167 int result;
168 struct i2400m *i2400m = container_of(ws, struct i2400m, wake_tx_ws);
169 struct device *dev = i2400m_dev(i2400m);
170 struct sk_buff *skb = i2400m->wake_tx_skb;
171 unsigned long flags;
172
173 spin_lock_irqsave(&i2400m->tx_lock, flags);
174 skb = i2400m->wake_tx_skb;
175 i2400m->wake_tx_skb = NULL;
176 spin_unlock_irqrestore(&i2400m->tx_lock, flags);
177
178 d_fnstart(3, dev, "(ws %p i2400m %p skb %p)\n", ws, i2400m, skb);
179 result = -EINVAL;
180 if (skb == NULL) {
181 dev_err(dev, "WAKE&TX: skb dissapeared!\n");
182 goto out_put;
183 }
184 result = i2400m_cmd_exit_idle(i2400m);
185 if (result == -EILSEQ)
186 result = 0;
187 if (result < 0) {
188 dev_err(dev, "WAKE&TX: device didn't get out of idle: "
189 "%d\n", result);
190 goto error;
191 }
192 result = wait_event_timeout(i2400m->state_wq,
193 i2400m->state != I2400M_SS_IDLE, 5 * HZ);
194 if (result == 0)
195 result = -ETIMEDOUT;
196 if (result < 0) {
197 dev_err(dev, "WAKE&TX: error waiting for device to exit IDLE: "
198 "%d\n", result);
199 goto error;
200 }
201 msleep(20); /* device still needs some time or it drops it */
202 result = i2400m_tx(i2400m, skb->data, skb->len, I2400M_PT_DATA);
203 netif_wake_queue(i2400m->wimax_dev.net_dev);
204error:
205 kfree_skb(skb); /* refcount transferred by _hard_start_xmit() */
206out_put:
207 i2400m_put(i2400m);
208 d_fnend(3, dev, "(ws %p i2400m %p skb %p) = void [%d]\n",
209 ws, i2400m, skb, result);
210}
211
212
213/*
214 * Prepare the data payload TX header
215 *
216 * The i2400m expects a 4 byte header in front of a data packet.
217 *
218 * Because we pretend to be an ethernet device, this packet comes with
219 * an ethernet header. Pull it and push our header.
220 */
221static
222void i2400m_tx_prep_header(struct sk_buff *skb)
223{
224 struct i2400m_pl_data_hdr *pl_hdr;
225 skb_pull(skb, ETH_HLEN);
226 pl_hdr = (struct i2400m_pl_data_hdr *) skb_push(skb, sizeof(*pl_hdr));
227 pl_hdr->reserved = 0;
228}
229
230
231/*
232 * TX an skb to an idle device
233 *
234 * When the device is in basestation-idle mode, we need to wake it up
235 * and then TX. So we queue a work_struct for doing so.
236 *
237 * We need to get an extra ref for the skb (so it is not dropped), as
238 * well as be careful not to queue more than one request (won't help
239 * at all). If more than one request comes or there are errors, we
240 * just drop the packets (see i2400m_hard_start_xmit()).
241 */
242static
243int i2400m_net_wake_tx(struct i2400m *i2400m, struct net_device *net_dev,
244 struct sk_buff *skb)
245{
246 int result;
247 struct device *dev = i2400m_dev(i2400m);
248 unsigned long flags;
249
250 d_fnstart(3, dev, "(skb %p net_dev %p)\n", skb, net_dev);
251 if (net_ratelimit()) {
252 d_printf(3, dev, "WAKE&NETTX: "
253 "skb %p sending %d bytes to radio\n",
254 skb, skb->len);
255 d_dump(4, dev, skb->data, skb->len);
256 }
257 /* We hold a ref count for i2400m and skb, so when
258 * stopping() the device, we need to cancel that work
259 * and if pending, release those resources. */
260 result = 0;
261 spin_lock_irqsave(&i2400m->tx_lock, flags);
262 if (!work_pending(&i2400m->wake_tx_ws)) {
263 netif_stop_queue(net_dev);
264 i2400m_get(i2400m);
265 i2400m->wake_tx_skb = skb_get(skb); /* transfer ref count */
266 i2400m_tx_prep_header(skb);
267 result = schedule_work(&i2400m->wake_tx_ws);
268 WARN_ON(result == 0);
269 }
270 spin_unlock_irqrestore(&i2400m->tx_lock, flags);
271 if (result == 0) {
272 /* Yes, this happens even if we stopped the
273 * queue -- blame the queue disciplines that
274 * queue without looking -- I guess there is a reason
275 * for that. */
276 if (net_ratelimit())
277 d_printf(1, dev, "NETTX: device exiting idle, "
278 "dropping skb %p, queue running %d\n",
279 skb, netif_queue_stopped(net_dev));
280 result = -EBUSY;
281 }
282 d_fnend(3, dev, "(skb %p net_dev %p) = %d\n", skb, net_dev, result);
283 return result;
284}
285
286
287/*
288 * Transmit a packet to the base station on behalf of the network stack.
289 *
290 * Returns: 0 if ok, < 0 errno code on error.
291 *
292 * We need to pull the ethernet header and add the hardware header,
293 * which is currently set to all zeroes and reserved.
294 */
295static
296int i2400m_net_tx(struct i2400m *i2400m, struct net_device *net_dev,
297 struct sk_buff *skb)
298{
299 int result;
300 struct device *dev = i2400m_dev(i2400m);
301
302 d_fnstart(3, dev, "(i2400m %p net_dev %p skb %p)\n",
303 i2400m, net_dev, skb);
304 /* FIXME: check eth hdr, only IPv4 is routed by the device as of now */
305 net_dev->trans_start = jiffies;
306 i2400m_tx_prep_header(skb);
307 d_printf(3, dev, "NETTX: skb %p sending %d bytes to radio\n",
308 skb, skb->len);
309 d_dump(4, dev, skb->data, skb->len);
310 result = i2400m_tx(i2400m, skb->data, skb->len, I2400M_PT_DATA);
311 d_fnend(3, dev, "(i2400m %p net_dev %p skb %p) = %d\n",
312 i2400m, net_dev, skb, result);
313 return result;
314}
315
316
317/*
318 * Transmit a packet to the base station on behalf of the network stack
319 *
320 *
321 * Returns: NETDEV_TX_OK (always, even in case of error)
322 *
323 * In case of error, we just drop it. Reasons:
324 *
325 * - we add a hw header to each skb, and if the network stack
326 * retries, we have no way to know if that skb has it or not.
327 *
328 * - network protocols have their own drop-recovery mechanisms
329 *
330 * - there is not much else we can do
331 *
332 * If the device is idle, we need to wake it up; that is an operation
333 * that will sleep. See i2400m_net_wake_tx() for details.
334 */
335static
336int i2400m_hard_start_xmit(struct sk_buff *skb,
337 struct net_device *net_dev)
338{
339 int result;
340 struct i2400m *i2400m = net_dev_to_i2400m(net_dev);
341 struct device *dev = i2400m_dev(i2400m);
342
343 d_fnstart(3, dev, "(skb %p net_dev %p)\n", skb, net_dev);
344 if (i2400m->state == I2400M_SS_IDLE)
345 result = i2400m_net_wake_tx(i2400m, net_dev, skb);
346 else
347 result = i2400m_net_tx(i2400m, net_dev, skb);
348 if (result < 0)
349 net_dev->stats.tx_dropped++;
350 else {
351 net_dev->stats.tx_packets++;
352 net_dev->stats.tx_bytes += skb->len;
353 }
354 kfree_skb(skb);
355 result = NETDEV_TX_OK;
356 d_fnend(3, dev, "(skb %p net_dev %p) = %d\n", skb, net_dev, result);
357 return result;
358}
359
360
361static
362int i2400m_change_mtu(struct net_device *net_dev, int new_mtu)
363{
364 int result;
365 struct i2400m *i2400m = net_dev_to_i2400m(net_dev);
366 struct device *dev = i2400m_dev(i2400m);
367
368 if (new_mtu >= I2400M_MAX_MTU) {
369 dev_err(dev, "Cannot change MTU to %d (max is %d)\n",
370 new_mtu, I2400M_MAX_MTU);
371 result = -EINVAL;
372 } else {
373 net_dev->mtu = new_mtu;
374 result = 0;
375 }
376 return result;
377}
378
379
380static
381void i2400m_tx_timeout(struct net_device *net_dev)
382{
383 /*
384 * We might want to kick the device
385 *
386 * There is not much we can do though, as the device requires
387 * that we send the data aggregated. By the time we receive
388 * this, there might be data pending to be sent or not...
389 */
390 net_dev->stats.tx_errors++;
391 return;
392}
393
394
395/*
396 * Create a fake ethernet header
397 *
398 * For emulating an ethernet device, every received IP header has to
399 * be prefixed with an ethernet header.
400 *
401 * What we receive has (potentially) many IP packets concatenated with
402 * no ETH_HLEN bytes prefixed. Thus there is no space for an eth
403 * header.
404 *
405 * We would have to reallocate or do ugly fragment tricks in order to
406 * add it.
407 *
408 * But what we do is use the header space of the RX transaction
409 * (*msg_hdr) as we don't need it anymore; then we'll point all the
410 * data skbs there, as they share the same backing store.
411 *
412 * We only support IPv4 for v3 firmware.
413 */
414static
415void i2400m_rx_fake_eth_header(struct net_device *net_dev,
416 void *_eth_hdr)
417{
418 struct ethhdr *eth_hdr = _eth_hdr;
419
420 memcpy(eth_hdr->h_dest, net_dev->dev_addr, sizeof(eth_hdr->h_dest));
421 memset(eth_hdr->h_source, 0, sizeof(eth_hdr->h_dest));
422 eth_hdr->h_proto = __constant_cpu_to_be16(ETH_P_IP);
423}
424
425
426/*
427 * i2400m_net_rx - pass a network packet to the stack
428 *
429 * @i2400m: device instance
430 * @skb_rx: the skb where the buffer pointed to by @buf is
431 * @i: 1 if payload is the only one
432 * @buf: pointer to the buffer containing the data
433 * @len: buffer's length
434 *
435 * We just clone the skb and set it up so that it's skb->data pointer
436 * points to "buf" and it's length.
437 *
438 * Note that if the payload is the last (or the only one) in a
439 * multi-payload message, we don't clone the SKB but just reuse it.
440 *
441 * This function is normally run from a thread context. However, we
442 * still use netif_rx() instead of netif_receive_skb() as was
443 * recommended in the mailing list. Reason is in some stress tests
444 * when sending/receiving a lot of data we seem to hit a softlock in
445 * the kernel's TCP implementation [aroudn tcp_delay_timer()]. Using
446 * netif_rx() took care of the issue.
447 *
448 * This is, of course, still open to do more research on why running
449 * with netif_receive_skb() hits this softlock. FIXME.
450 *
451 * FIXME: currently we don't do any efforts at distinguishing if what
452 * we got was an IPv4 or IPv6 header, to setup the protocol field
453 * correctly.
454 */
455void i2400m_net_rx(struct i2400m *i2400m, struct sk_buff *skb_rx,
456 unsigned i, const void *buf, int buf_len)
457{
458 struct net_device *net_dev = i2400m->wimax_dev.net_dev;
459 struct device *dev = i2400m_dev(i2400m);
460 struct sk_buff *skb;
461
462 d_fnstart(2, dev, "(i2400m %p buf %p buf_len %d)\n",
463 i2400m, buf, buf_len);
464 if (i) {
465 skb = skb_get(skb_rx);
466 d_printf(2, dev, "RX: reusing first payload skb %p\n", skb);
467 skb_pull(skb, buf - (void *) skb->data);
468 skb_trim(skb, (void *) skb_end_pointer(skb) - buf);
469 } else {
470 /* Yes, this is bad -- a lot of overhead -- see
471 * comments at the top of the file */
472 skb = __netdev_alloc_skb(net_dev, buf_len, GFP_KERNEL);
473 if (skb == NULL) {
474 dev_err(dev, "NETRX: no memory to realloc skb\n");
475 net_dev->stats.rx_dropped++;
476 goto error_skb_realloc;
477 }
478 memcpy(skb_put(skb, buf_len), buf, buf_len);
479 }
480 i2400m_rx_fake_eth_header(i2400m->wimax_dev.net_dev,
481 skb->data - ETH_HLEN);
482 skb_set_mac_header(skb, -ETH_HLEN);
483 skb->dev = i2400m->wimax_dev.net_dev;
484 skb->protocol = htons(ETH_P_IP);
485 net_dev->stats.rx_packets++;
486 net_dev->stats.rx_bytes += buf_len;
487 d_printf(3, dev, "NETRX: receiving %d bytes to network stack\n",
488 buf_len);
489 d_dump(4, dev, buf, buf_len);
490 netif_rx_ni(skb); /* see notes in function header */
491error_skb_realloc:
492 d_fnend(2, dev, "(i2400m %p buf %p buf_len %d) = void\n",
493 i2400m, buf, buf_len);
494}
495
496
497/**
498 * i2400m_netdev_setup - Setup setup @net_dev's i2400m private data
499 *
500 * Called by alloc_netdev()
501 */
502void i2400m_netdev_setup(struct net_device *net_dev)
503{
504 d_fnstart(3, NULL, "(net_dev %p)\n", net_dev);
505 ether_setup(net_dev);
506 net_dev->mtu = I2400M_MAX_MTU;
507 net_dev->tx_queue_len = I2400M_TX_QLEN;
508 net_dev->features =
509 NETIF_F_VLAN_CHALLENGED
510 | NETIF_F_HIGHDMA;
511 net_dev->flags =
512 IFF_NOARP /* i2400m is apure IP device */
513 & (~IFF_BROADCAST /* i2400m is P2P */
514 & ~IFF_MULTICAST);
515 net_dev->watchdog_timeo = I2400M_TX_TIMEOUT;
516 net_dev->open = i2400m_open;
517 net_dev->stop = i2400m_stop;
518 net_dev->hard_start_xmit = i2400m_hard_start_xmit;
519 net_dev->change_mtu = i2400m_change_mtu;
520 net_dev->tx_timeout = i2400m_tx_timeout;
521 d_fnend(3, NULL, "(net_dev %p) = void\n", net_dev);
522}
523EXPORT_SYMBOL_GPL(i2400m_netdev_setup);
524
diff --git a/drivers/net/wimax/i2400m/op-rfkill.c b/drivers/net/wimax/i2400m/op-rfkill.c
new file mode 100644
index 000000000000..487ec58cea46
--- /dev/null
+++ b/drivers/net/wimax/i2400m/op-rfkill.c
@@ -0,0 +1,207 @@
1/*
2 * Intel Wireless WiMAX Connection 2400m
3 * Implement backend for the WiMAX stack rfkill support
4 *
5 *
6 * Copyright (C) 2007-2008 Intel Corporation <linux-wimax@intel.com>
7 * Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License version
11 * 2 as published by the Free Software Foundation.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21 * 02110-1301, USA.
22 *
23 *
24 * The WiMAX kernel stack integrates into RF-Kill and keeps the
25 * switches's status. We just need to:
26 *
27 * - report changes in the HW RF Kill switch [with
28 * wimax_rfkill_{sw,hw}_report(), which happens when we detect those
29 * indications coming through hardware reports]. We also do it on
30 * initialization to let the stack know the intial HW state.
31 *
32 * - implement indications from the stack to change the SW RF Kill
33 * switch (coming from sysfs, the wimax stack or user space).
34 */
35#include "i2400m.h"
36#include <linux/wimax/i2400m.h>
37
38
39
40#define D_SUBMODULE rfkill
41#include "debug-levels.h"
42
43/*
44 * Return true if the i2400m radio is in the requested wimax_rf_state state
45 *
46 */
47static
48int i2400m_radio_is(struct i2400m *i2400m, enum wimax_rf_state state)
49{
50 if (state == WIMAX_RF_OFF)
51 return i2400m->state == I2400M_SS_RF_OFF
52 || i2400m->state == I2400M_SS_RF_SHUTDOWN;
53 else if (state == WIMAX_RF_ON)
54 /* state == WIMAX_RF_ON */
55 return i2400m->state != I2400M_SS_RF_OFF
56 && i2400m->state != I2400M_SS_RF_SHUTDOWN;
57 else
58 BUG();
59}
60
61
62/*
63 * WiMAX stack operation: implement SW RFKill toggling
64 *
65 * @wimax_dev: device descriptor
66 * @skb: skb where the message has been received; skb->data is
67 * expected to point to the message payload.
68 * @genl_info: passed by the generic netlink layer
69 *
70 * Generic Netlink will call this function when a message is sent from
71 * userspace to change the software RF-Kill switch status.
72 *
73 * This function will set the device's sofware RF-Kill switch state to
74 * match what is requested.
75 *
76 * NOTE: the i2400m has a strict state machine; we can only set the
77 * RF-Kill switch when it is on, the HW RF-Kill is on and the
78 * device is initialized. So we ignore errors steaming from not
79 * being in the right state (-EILSEQ).
80 */
81int i2400m_op_rfkill_sw_toggle(struct wimax_dev *wimax_dev,
82 enum wimax_rf_state state)
83{
84 int result;
85 struct i2400m *i2400m = wimax_dev_to_i2400m(wimax_dev);
86 struct device *dev = i2400m_dev(i2400m);
87 struct sk_buff *ack_skb;
88 struct {
89 struct i2400m_l3l4_hdr hdr;
90 struct i2400m_tlv_rf_operation sw_rf;
91 } __attribute__((packed)) *cmd;
92 char strerr[32];
93
94 d_fnstart(4, dev, "(wimax_dev %p state %d)\n", wimax_dev, state);
95
96 result = -ENOMEM;
97 cmd = kzalloc(sizeof(*cmd), GFP_KERNEL);
98 if (cmd == NULL)
99 goto error_alloc;
100 cmd->hdr.type = cpu_to_le16(I2400M_MT_CMD_RF_CONTROL);
101 cmd->hdr.length = sizeof(cmd->sw_rf);
102 cmd->hdr.version = cpu_to_le16(I2400M_L3L4_VERSION);
103 cmd->sw_rf.hdr.type = cpu_to_le16(I2400M_TLV_RF_OPERATION);
104 cmd->sw_rf.hdr.length = cpu_to_le16(sizeof(cmd->sw_rf.status));
105 switch (state) {
106 case WIMAX_RF_OFF: /* RFKILL ON, radio OFF */
107 cmd->sw_rf.status = cpu_to_le32(2);
108 break;
109 case WIMAX_RF_ON: /* RFKILL OFF, radio ON */
110 cmd->sw_rf.status = cpu_to_le32(1);
111 break;
112 default:
113 BUG();
114 }
115
116 ack_skb = i2400m_msg_to_dev(i2400m, cmd, sizeof(*cmd));
117 result = PTR_ERR(ack_skb);
118 if (IS_ERR(ack_skb)) {
119 dev_err(dev, "Failed to issue 'RF Control' command: %d\n",
120 result);
121 goto error_msg_to_dev;
122 }
123 result = i2400m_msg_check_status(wimax_msg_data(ack_skb),
124 strerr, sizeof(strerr));
125 if (result < 0) {
126 dev_err(dev, "'RF Control' (0x%04x) command failed: %d - %s\n",
127 I2400M_MT_CMD_RF_CONTROL, result, strerr);
128 goto error_cmd;
129 }
130
131 /* Now we wait for the state to change to RADIO_OFF or RADIO_ON */
132 result = wait_event_timeout(
133 i2400m->state_wq, i2400m_radio_is(i2400m, state),
134 5 * HZ);
135 if (result == 0)
136 result = -ETIMEDOUT;
137 if (result < 0)
138 dev_err(dev, "Error waiting for device to toggle RF state: "
139 "%d\n", result);
140 result = 0;
141error_cmd:
142 kfree_skb(ack_skb);
143error_msg_to_dev:
144error_alloc:
145 d_fnend(4, dev, "(wimax_dev %p state %d) = %d\n",
146 wimax_dev, state, result);
147 return result;
148}
149
150
151/*
152 * Inform the WiMAX stack of changes in the RF Kill switches reported
153 * by the device
154 *
155 * @i2400m: device descriptor
156 * @rfss: TLV for RF Switches status; already validated
157 *
158 * NOTE: the reports on RF switch status cannot be trusted
159 * or used until the device is in a state of RADIO_OFF
160 * or greater.
161 */
162void i2400m_report_tlv_rf_switches_status(
163 struct i2400m *i2400m,
164 const struct i2400m_tlv_rf_switches_status *rfss)
165{
166 struct device *dev = i2400m_dev(i2400m);
167 enum i2400m_rf_switch_status hw, sw;
168 enum wimax_st wimax_state;
169
170 sw = le32_to_cpu(rfss->sw_rf_switch);
171 hw = le32_to_cpu(rfss->hw_rf_switch);
172
173 d_fnstart(3, dev, "(i2400m %p rfss %p [hw %u sw %u])\n",
174 i2400m, rfss, hw, sw);
175 /* We only process rw switch evens when the device has been
176 * fully initialized */
177 wimax_state = wimax_state_get(&i2400m->wimax_dev);
178 if (wimax_state < WIMAX_ST_RADIO_OFF) {
179 d_printf(3, dev, "ignoring RF switches report, state %u\n",
180 wimax_state);
181 goto out;
182 }
183 switch (sw) {
184 case I2400M_RF_SWITCH_ON: /* RF Kill disabled (radio on) */
185 wimax_report_rfkill_sw(&i2400m->wimax_dev, WIMAX_RF_ON);
186 break;
187 case I2400M_RF_SWITCH_OFF: /* RF Kill enabled (radio off) */
188 wimax_report_rfkill_sw(&i2400m->wimax_dev, WIMAX_RF_OFF);
189 break;
190 default:
191 dev_err(dev, "HW BUG? Unknown RF SW state 0x%x\n", sw);
192 }
193
194 switch (hw) {
195 case I2400M_RF_SWITCH_ON: /* RF Kill disabled (radio on) */
196 wimax_report_rfkill_hw(&i2400m->wimax_dev, WIMAX_RF_ON);
197 break;
198 case I2400M_RF_SWITCH_OFF: /* RF Kill enabled (radio off) */
199 wimax_report_rfkill_hw(&i2400m->wimax_dev, WIMAX_RF_OFF);
200 break;
201 default:
202 dev_err(dev, "HW BUG? Unknown RF HW state 0x%x\n", hw);
203 }
204out:
205 d_fnend(3, dev, "(i2400m %p rfss %p [hw %u sw %u]) = void\n",
206 i2400m, rfss, hw, sw);
207}
diff --git a/drivers/net/wimax/i2400m/rx.c b/drivers/net/wimax/i2400m/rx.c
new file mode 100644
index 000000000000..6922022710ac
--- /dev/null
+++ b/drivers/net/wimax/i2400m/rx.c
@@ -0,0 +1,534 @@
1/*
2 * Intel Wireless WiMAX Connection 2400m
3 * Handle incoming traffic and deliver it to the control or data planes
4 *
5 *
6 * Copyright (C) 2007-2008 Intel Corporation. All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 *
12 * * Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * * Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in
16 * the documentation and/or other materials provided with the
17 * distribution.
18 * * Neither the name of Intel Corporation nor the names of its
19 * contributors may be used to endorse or promote products derived
20 * from this software without specific prior written permission.
21 *
22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 *
34 *
35 * Intel Corporation <linux-wimax@intel.com>
36 * Yanir Lubetkin <yanirx.lubetkin@intel.com>
37 * - Initial implementation
38 * Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
39 * - Use skb_clone(), break up processing in chunks
40 * - Split transport/device specific
41 * - Make buffer size dynamic to exert less memory pressure
42 *
43 *
44 * This handles the RX path.
45 *
46 * We receive an RX message from the bus-specific driver, which
47 * contains one or more payloads that have potentially different
48 * destinataries (data or control paths).
49 *
50 * So we just take that payload from the transport specific code in
51 * the form of an skb, break it up in chunks (a cloned skb each in the
52 * case of network packets) and pass it to netdev or to the
53 * command/ack handler (and from there to the WiMAX stack).
54 *
55 * PROTOCOL FORMAT
56 *
57 * The format of the buffer is:
58 *
59 * HEADER (struct i2400m_msg_hdr)
60 * PAYLOAD DESCRIPTOR 0 (struct i2400m_pld)
61 * PAYLOAD DESCRIPTOR 1
62 * ...
63 * PAYLOAD DESCRIPTOR N
64 * PAYLOAD 0 (raw bytes)
65 * PAYLOAD 1
66 * ...
67 * PAYLOAD N
68 *
69 * See tx.c for a deeper description on alignment requirements and
70 * other fun facts of it.
71 *
72 * ROADMAP
73 *
74 * i2400m_rx
75 * i2400m_rx_msg_hdr_check
76 * i2400m_rx_pl_descr_check
77 * i2400m_rx_payload
78 * i2400m_net_rx
79 * i2400m_rx_ctl
80 * i2400m_msg_size_check
81 * i2400m_report_hook_work [in a workqueue]
82 * i2400m_report_hook
83 * wimax_msg_to_user
84 * i2400m_rx_ctl_ack
85 * wimax_msg_to_user_alloc
86 * i2400m_rx_trace
87 * i2400m_msg_size_check
88 * wimax_msg
89 */
90#include <linux/kernel.h>
91#include <linux/if_arp.h>
92#include <linux/netdevice.h>
93#include <linux/workqueue.h>
94#include "i2400m.h"
95
96
97#define D_SUBMODULE rx
98#include "debug-levels.h"
99
100struct i2400m_report_hook_args {
101 struct sk_buff *skb_rx;
102 const struct i2400m_l3l4_hdr *l3l4_hdr;
103 size_t size;
104};
105
106
107/*
108 * Execute i2400m_report_hook in a workqueue
109 *
110 * Unpacks arguments from the deferred call, executes it and then
111 * drops the references.
112 *
113 * Obvious NOTE: References are needed because we are a separate
114 * thread; otherwise the buffer changes under us because it is
115 * released by the original caller.
116 */
117static
118void i2400m_report_hook_work(struct work_struct *ws)
119{
120 struct i2400m_work *iw =
121 container_of(ws, struct i2400m_work, ws);
122 struct i2400m_report_hook_args *args = (void *) iw->pl;
123 i2400m_report_hook(iw->i2400m, args->l3l4_hdr, args->size);
124 kfree_skb(args->skb_rx);
125 i2400m_put(iw->i2400m);
126 kfree(iw);
127}
128
129
130/*
131 * Process an ack to a command
132 *
133 * @i2400m: device descriptor
134 * @payload: pointer to message
135 * @size: size of the message
136 *
137 * Pass the acknodledgment (in an skb) to the thread that is waiting
138 * for it in i2400m->msg_completion.
139 *
140 * We need to coordinate properly with the thread waiting for the
141 * ack. Check if it is waiting or if it is gone. We loose the spinlock
142 * to avoid allocating on atomic contexts (yeah, could use GFP_ATOMIC,
143 * but this is not so speed critical).
144 */
145static
146void i2400m_rx_ctl_ack(struct i2400m *i2400m,
147 const void *payload, size_t size)
148{
149 struct device *dev = i2400m_dev(i2400m);
150 struct wimax_dev *wimax_dev = &i2400m->wimax_dev;
151 unsigned long flags;
152 struct sk_buff *ack_skb;
153
154 /* Anyone waiting for an answer? */
155 spin_lock_irqsave(&i2400m->rx_lock, flags);
156 if (i2400m->ack_skb != ERR_PTR(-EINPROGRESS)) {
157 dev_err(dev, "Huh? reply to command with no waiters\n");
158 goto error_no_waiter;
159 }
160 spin_unlock_irqrestore(&i2400m->rx_lock, flags);
161
162 ack_skb = wimax_msg_alloc(wimax_dev, NULL, payload, size, GFP_KERNEL);
163
164 /* Check waiter didn't time out waiting for the answer... */
165 spin_lock_irqsave(&i2400m->rx_lock, flags);
166 if (i2400m->ack_skb != ERR_PTR(-EINPROGRESS)) {
167 d_printf(1, dev, "Huh? waiter for command reply cancelled\n");
168 goto error_waiter_cancelled;
169 }
170 if (ack_skb == NULL) {
171 dev_err(dev, "CMD/GET/SET ack: cannot allocate SKB\n");
172 i2400m->ack_skb = ERR_PTR(-ENOMEM);
173 } else
174 i2400m->ack_skb = ack_skb;
175 spin_unlock_irqrestore(&i2400m->rx_lock, flags);
176 complete(&i2400m->msg_completion);
177 return;
178
179error_waiter_cancelled:
180 if (ack_skb)
181 kfree_skb(ack_skb);
182error_no_waiter:
183 spin_unlock_irqrestore(&i2400m->rx_lock, flags);
184 return;
185}
186
187
188/*
189 * Receive and process a control payload
190 *
191 * @i2400m: device descriptor
192 * @skb_rx: skb that contains the payload (for reference counting)
193 * @payload: pointer to message
194 * @size: size of the message
195 *
196 * There are two types of control RX messages: reports (asynchronous,
197 * like your every day interrupts) and 'acks' (reponses to a command,
198 * get or set request).
199 *
200 * If it is a report, we run hooks on it (to extract information for
201 * things we need to do in the driver) and then pass it over to the
202 * WiMAX stack to send it to user space.
203 *
204 * NOTE: report processing is done in a workqueue specific to the
205 * generic driver, to avoid deadlocks in the system.
206 *
207 * If it is not a report, it is an ack to a previously executed
208 * command, set or get, so wake up whoever is waiting for it from
209 * i2400m_msg_to_dev(). i2400m_rx_ctl_ack() takes care of that.
210 *
211 * Note that the sizes we pass to other functions from here are the
212 * sizes of the _l3l4_hdr + payload, not full buffer sizes, as we have
213 * verified in _msg_size_check() that they are congruent.
214 *
215 * For reports: We can't clone the original skb where the data is
216 * because we need to send this up via netlink; netlink has to add
217 * headers and we can't overwrite what's preceeding the payload...as
218 * it is another message. So we just dup them.
219 */
220static
221void i2400m_rx_ctl(struct i2400m *i2400m, struct sk_buff *skb_rx,
222 const void *payload, size_t size)
223{
224 int result;
225 struct device *dev = i2400m_dev(i2400m);
226 const struct i2400m_l3l4_hdr *l3l4_hdr = payload;
227 unsigned msg_type;
228
229 result = i2400m_msg_size_check(i2400m, l3l4_hdr, size);
230 if (result < 0) {
231 dev_err(dev, "HW BUG? device sent a bad message: %d\n",
232 result);
233 goto error_check;
234 }
235 msg_type = le16_to_cpu(l3l4_hdr->type);
236 d_printf(1, dev, "%s 0x%04x: %zu bytes\n",
237 msg_type & I2400M_MT_REPORT_MASK ? "REPORT" : "CMD/SET/GET",
238 msg_type, size);
239 d_dump(2, dev, l3l4_hdr, size);
240 if (msg_type & I2400M_MT_REPORT_MASK) {
241 /* These hooks have to be ran serialized; as well, the
242 * handling might force the execution of commands, and
243 * that might cause reentrancy issues with
244 * bus-specific subdrivers and workqueues. So we run
245 * it in a separate workqueue. */
246 struct i2400m_report_hook_args args = {
247 .skb_rx = skb_rx,
248 .l3l4_hdr = l3l4_hdr,
249 .size = size
250 };
251 if (unlikely(i2400m->ready == 0)) /* only send if up */
252 return;
253 skb_get(skb_rx);
254 i2400m_queue_work(i2400m, i2400m_report_hook_work,
255 GFP_KERNEL, &args, sizeof(args));
256 result = wimax_msg(&i2400m->wimax_dev, NULL, l3l4_hdr, size,
257 GFP_KERNEL);
258 if (result < 0)
259 dev_err(dev, "error sending report to userspace: %d\n",
260 result);
261 } else /* an ack to a CMD, GET or SET */
262 i2400m_rx_ctl_ack(i2400m, payload, size);
263error_check:
264 return;
265}
266
267
268
269
270/*
271 * Receive and send up a trace
272 *
273 * @i2400m: device descriptor
274 * @skb_rx: skb that contains the trace (for reference counting)
275 * @payload: pointer to trace message inside the skb
276 * @size: size of the message
277 *
278 * THe i2400m might produce trace information (diagnostics) and we
279 * send them through a different kernel-to-user pipe (to avoid
280 * clogging it).
281 *
282 * As in i2400m_rx_ctl(), we can't clone the original skb where the
283 * data is because we need to send this up via netlink; netlink has to
284 * add headers and we can't overwrite what's preceeding the
285 * payload...as it is another message. So we just dup them.
286 */
287static
288void i2400m_rx_trace(struct i2400m *i2400m,
289 const void *payload, size_t size)
290{
291 int result;
292 struct device *dev = i2400m_dev(i2400m);
293 struct wimax_dev *wimax_dev = &i2400m->wimax_dev;
294 const struct i2400m_l3l4_hdr *l3l4_hdr = payload;
295 unsigned msg_type;
296
297 result = i2400m_msg_size_check(i2400m, l3l4_hdr, size);
298 if (result < 0) {
299 dev_err(dev, "HW BUG? device sent a bad trace message: %d\n",
300 result);
301 goto error_check;
302 }
303 msg_type = le16_to_cpu(l3l4_hdr->type);
304 d_printf(1, dev, "Trace %s 0x%04x: %zu bytes\n",
305 msg_type & I2400M_MT_REPORT_MASK ? "REPORT" : "CMD/SET/GET",
306 msg_type, size);
307 d_dump(2, dev, l3l4_hdr, size);
308 if (unlikely(i2400m->ready == 0)) /* only send if up */
309 return;
310 result = wimax_msg(wimax_dev, "trace", l3l4_hdr, size, GFP_KERNEL);
311 if (result < 0)
312 dev_err(dev, "error sending trace to userspace: %d\n",
313 result);
314error_check:
315 return;
316}
317
318
319/*
320 * Act on a received payload
321 *
322 * @i2400m: device instance
323 * @skb_rx: skb where the transaction was received
324 * @single: 1 if there is only one payload, 0 otherwise
325 * @pld: payload descriptor
326 * @payload: payload data
327 *
328 * Upon reception of a payload, look at its guts in the payload
329 * descriptor and decide what to do with it.
330 */
331static
332void i2400m_rx_payload(struct i2400m *i2400m, struct sk_buff *skb_rx,
333 unsigned single, const struct i2400m_pld *pld,
334 const void *payload)
335{
336 struct device *dev = i2400m_dev(i2400m);
337 size_t pl_size = i2400m_pld_size(pld);
338 enum i2400m_pt pl_type = i2400m_pld_type(pld);
339
340 switch (pl_type) {
341 case I2400M_PT_DATA:
342 d_printf(3, dev, "RX: data payload %zu bytes\n", pl_size);
343 i2400m_net_rx(i2400m, skb_rx, single, payload, pl_size);
344 break;
345 case I2400M_PT_CTRL:
346 i2400m_rx_ctl(i2400m, skb_rx, payload, pl_size);
347 break;
348 case I2400M_PT_TRACE:
349 i2400m_rx_trace(i2400m, payload, pl_size);
350 break;
351 default: /* Anything else shouldn't come to the host */
352 if (printk_ratelimit())
353 dev_err(dev, "RX: HW BUG? unexpected payload type %u\n",
354 pl_type);
355 }
356}
357
358
359/*
360 * Check a received transaction's message header
361 *
362 * @i2400m: device descriptor
363 * @msg_hdr: message header
364 * @buf_size: size of the received buffer
365 *
366 * Check that the declarations done by a RX buffer message header are
367 * sane and consistent with the amount of data that was received.
368 */
369static
370int i2400m_rx_msg_hdr_check(struct i2400m *i2400m,
371 const struct i2400m_msg_hdr *msg_hdr,
372 size_t buf_size)
373{
374 int result = -EIO;
375 struct device *dev = i2400m_dev(i2400m);
376 if (buf_size < sizeof(*msg_hdr)) {
377 dev_err(dev, "RX: HW BUG? message with short header (%zu "
378 "vs %zu bytes expected)\n", buf_size, sizeof(*msg_hdr));
379 goto error;
380 }
381 if (msg_hdr->barker != cpu_to_le32(I2400M_D2H_MSG_BARKER)) {
382 dev_err(dev, "RX: HW BUG? message received with unknown "
383 "barker 0x%08x (buf_size %zu bytes)\n",
384 le32_to_cpu(msg_hdr->barker), buf_size);
385 goto error;
386 }
387 if (msg_hdr->num_pls == 0) {
388 dev_err(dev, "RX: HW BUG? zero payload packets in message\n");
389 goto error;
390 }
391 if (le16_to_cpu(msg_hdr->num_pls) > I2400M_MAX_PLS_IN_MSG) {
392 dev_err(dev, "RX: HW BUG? message contains more payload "
393 "than maximum; ignoring.\n");
394 goto error;
395 }
396 result = 0;
397error:
398 return result;
399}
400
401
402/*
403 * Check a payload descriptor against the received data
404 *
405 * @i2400m: device descriptor
406 * @pld: payload descriptor
407 * @pl_itr: offset (in bytes) in the received buffer the payload is
408 * located
409 * @buf_size: size of the received buffer
410 *
411 * Given a payload descriptor (part of a RX buffer), check it is sane
412 * and that the data it declares fits in the buffer.
413 */
414static
415int i2400m_rx_pl_descr_check(struct i2400m *i2400m,
416 const struct i2400m_pld *pld,
417 size_t pl_itr, size_t buf_size)
418{
419 int result = -EIO;
420 struct device *dev = i2400m_dev(i2400m);
421 size_t pl_size = i2400m_pld_size(pld);
422 enum i2400m_pt pl_type = i2400m_pld_type(pld);
423
424 if (pl_size > i2400m->bus_pl_size_max) {
425 dev_err(dev, "RX: HW BUG? payload @%zu: size %zu is "
426 "bigger than maximum %zu; ignoring message\n",
427 pl_itr, pl_size, i2400m->bus_pl_size_max);
428 goto error;
429 }
430 if (pl_itr + pl_size > buf_size) { /* enough? */
431 dev_err(dev, "RX: HW BUG? payload @%zu: size %zu "
432 "goes beyond the received buffer "
433 "size (%zu bytes); ignoring message\n",
434 pl_itr, pl_size, buf_size);
435 goto error;
436 }
437 if (pl_type >= I2400M_PT_ILLEGAL) {
438 dev_err(dev, "RX: HW BUG? illegal payload type %u; "
439 "ignoring message\n", pl_type);
440 goto error;
441 }
442 result = 0;
443error:
444 return result;
445}
446
447
448/**
449 * i2400m_rx - Receive a buffer of data from the device
450 *
451 * @i2400m: device descriptor
452 * @skb: skbuff where the data has been received
453 *
454 * Parse in a buffer of data that contains an RX message sent from the
455 * device. See the file header for the format. Run all checks on the
456 * buffer header, then run over each payload's descriptors, verify
457 * their consistency and act on each payload's contents. If
458 * everything is succesful, update the device's statistics.
459 *
460 * Note: You need to set the skb to contain only the length of the
461 * received buffer; for that, use skb_trim(skb, RECEIVED_SIZE).
462 *
463 * Returns:
464 *
465 * 0 if ok, < 0 errno on error
466 *
467 * If ok, this function owns now the skb and the caller DOESN'T have
468 * to run kfree_skb() on it. However, on error, the caller still owns
469 * the skb and it is responsible for releasing it.
470 */
471int i2400m_rx(struct i2400m *i2400m, struct sk_buff *skb)
472{
473 int i, result;
474 struct device *dev = i2400m_dev(i2400m);
475 const struct i2400m_msg_hdr *msg_hdr;
476 size_t pl_itr, pl_size, skb_len;
477 unsigned long flags;
478 unsigned num_pls;
479
480 skb_len = skb->len;
481 d_fnstart(4, dev, "(i2400m %p skb %p [size %zu])\n",
482 i2400m, skb, skb_len);
483 result = -EIO;
484 msg_hdr = (void *) skb->data;
485 result = i2400m_rx_msg_hdr_check(i2400m, msg_hdr, skb->len);
486 if (result < 0)
487 goto error_msg_hdr_check;
488 result = -EIO;
489 num_pls = le16_to_cpu(msg_hdr->num_pls);
490 pl_itr = sizeof(*msg_hdr) + /* Check payload descriptor(s) */
491 num_pls * sizeof(msg_hdr->pld[0]);
492 pl_itr = ALIGN(pl_itr, I2400M_PL_PAD);
493 if (pl_itr > skb->len) { /* got all the payload descriptors? */
494 dev_err(dev, "RX: HW BUG? message too short (%u bytes) for "
495 "%u payload descriptors (%zu each, total %zu)\n",
496 skb->len, num_pls, sizeof(msg_hdr->pld[0]), pl_itr);
497 goto error_pl_descr_short;
498 }
499 /* Walk each payload payload--check we really got it */
500 for (i = 0; i < num_pls; i++) {
501 /* work around old gcc warnings */
502 pl_size = i2400m_pld_size(&msg_hdr->pld[i]);
503 result = i2400m_rx_pl_descr_check(i2400m, &msg_hdr->pld[i],
504 pl_itr, skb->len);
505 if (result < 0)
506 goto error_pl_descr_check;
507 i2400m_rx_payload(i2400m, skb, num_pls == 1, &msg_hdr->pld[i],
508 skb->data + pl_itr);
509 pl_itr += ALIGN(pl_size, I2400M_PL_PAD);
510 cond_resched(); /* Don't monopolize */
511 }
512 kfree_skb(skb);
513 /* Update device statistics */
514 spin_lock_irqsave(&i2400m->rx_lock, flags);
515 i2400m->rx_pl_num += i;
516 if (i > i2400m->rx_pl_max)
517 i2400m->rx_pl_max = i;
518 if (i < i2400m->rx_pl_min)
519 i2400m->rx_pl_min = i;
520 i2400m->rx_num++;
521 i2400m->rx_size_acc += skb->len;
522 if (skb->len < i2400m->rx_size_min)
523 i2400m->rx_size_min = skb->len;
524 if (skb->len > i2400m->rx_size_max)
525 i2400m->rx_size_max = skb->len;
526 spin_unlock_irqrestore(&i2400m->rx_lock, flags);
527error_pl_descr_check:
528error_pl_descr_short:
529error_msg_hdr_check:
530 d_fnend(4, dev, "(i2400m %p skb %p [size %zu]) = %d\n",
531 i2400m, skb, skb_len, result);
532 return result;
533}
534EXPORT_SYMBOL_GPL(i2400m_rx);
diff --git a/drivers/net/wimax/i2400m/sdio-debug-levels.h b/drivers/net/wimax/i2400m/sdio-debug-levels.h
new file mode 100644
index 000000000000..c51998741301
--- /dev/null
+++ b/drivers/net/wimax/i2400m/sdio-debug-levels.h
@@ -0,0 +1,22 @@
1/*
2 * debug levels control file for the i2400m module's
3 */
4#ifndef __debug_levels__h__
5#define __debug_levels__h__
6
7/* Maximum compile and run time debug level for all submodules */
8#define D_MODULENAME i2400m_sdio
9#define D_MASTER CONFIG_WIMAX_I2400M_DEBUG_LEVEL
10
11#include <linux/wimax/debug.h>
12
13/* List of all the enabled modules */
14enum d_module {
15 D_SUBMODULE_DECLARE(main),
16 D_SUBMODULE_DECLARE(tx),
17 D_SUBMODULE_DECLARE(rx),
18 D_SUBMODULE_DECLARE(fw)
19};
20
21
22#endif /* #ifndef __debug_levels__h__ */
diff --git a/drivers/net/wimax/i2400m/sdio-fw.c b/drivers/net/wimax/i2400m/sdio-fw.c
new file mode 100644
index 000000000000..3487205d8f50
--- /dev/null
+++ b/drivers/net/wimax/i2400m/sdio-fw.c
@@ -0,0 +1,224 @@
1/*
2 * Intel Wireless WiMAX Connection 2400m
3 * Firmware uploader's SDIO specifics
4 *
5 *
6 * Copyright (C) 2007-2008 Intel Corporation. All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 *
12 * * Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * * Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in
16 * the documentation and/or other materials provided with the
17 * distribution.
18 * * Neither the name of Intel Corporation nor the names of its
19 * contributors may be used to endorse or promote products derived
20 * from this software without specific prior written permission.
21 *
22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 *
34 *
35 * Intel Corporation <linux-wimax@intel.com>
36 * Yanir Lubetkin <yanirx.lubetkin@intel.com>
37 * Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
38 * - Initial implementation
39 *
40 * Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
41 * - Bus generic/specific split for USB
42 *
43 * Dirk Brandewie <dirk.j.brandewie@intel.com>
44 * - Initial implementation for SDIO
45 *
46 * Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
47 * - SDIO rehash for changes in the bus-driver model
48 *
49 * THE PROCEDURE
50 *
51 * See fw.c for the generic description of this procedure.
52 *
53 * This file implements only the SDIO specifics. It boils down to how
54 * to send a command and waiting for an acknowledgement from the
55 * device. We do polled reads.
56 *
57 * COMMAND EXECUTION
58 *
59 * THe generic firmware upload code will call i2400m_bus_bm_cmd_send()
60 * to send commands.
61 *
62 * The SDIO devices expects things in 256 byte blocks, so it will pad
63 * it, compute the checksum (if needed) and pass it to SDIO.
64 *
65 * ACK RECEPTION
66 *
67 * This works in polling mode -- the fw loader says when to wait for
68 * data and for that it calls i2400ms_bus_bm_wait_for_ack().
69 *
70 * This will poll the device for data until it is received. We need to
71 * receive at least as much bytes as where asked for (although it'll
72 * always be a multiple of 256 bytes).
73 */
74#include <linux/mmc/sdio_func.h>
75#include "i2400m-sdio.h"
76
77
78#define D_SUBMODULE fw
79#include "sdio-debug-levels.h"
80
81/*
82 * Send a boot-mode command to the SDIO function
83 *
84 * We use a bounce buffer (i2400m->bm_cmd_buf) because we need to
85 * touch the header if the RAW flag is not set.
86 *
87 * @flags: pass thru from i2400m_bm_cmd()
88 * @return: cmd_size if ok, < 0 errno code on error.
89 *
90 * Note the command is padded to the SDIO block size for the device.
91 */
92ssize_t i2400ms_bus_bm_cmd_send(struct i2400m *i2400m,
93 const struct i2400m_bootrom_header *_cmd,
94 size_t cmd_size, int flags)
95{
96 ssize_t result;
97 struct device *dev = i2400m_dev(i2400m);
98 struct i2400ms *i2400ms = container_of(i2400m, struct i2400ms, i2400m);
99 int opcode = _cmd == NULL ? -1 : i2400m_brh_get_opcode(_cmd);
100 struct i2400m_bootrom_header *cmd;
101 /* SDIO restriction */
102 size_t cmd_size_a = ALIGN(cmd_size, I2400MS_BLK_SIZE);
103
104 d_fnstart(5, dev, "(i2400m %p cmd %p size %zu)\n",
105 i2400m, _cmd, cmd_size);
106 result = -E2BIG;
107 if (cmd_size > I2400M_BM_CMD_BUF_SIZE)
108 goto error_too_big;
109
110 memcpy(i2400m->bm_cmd_buf, _cmd, cmd_size); /* Prep command */
111 cmd = i2400m->bm_cmd_buf;
112 if (cmd_size_a > cmd_size) /* Zero pad space */
113 memset(i2400m->bm_cmd_buf + cmd_size, 0, cmd_size_a - cmd_size);
114 if ((flags & I2400M_BM_CMD_RAW) == 0) {
115 if (WARN_ON(i2400m_brh_get_response_required(cmd) == 0))
116 dev_warn(dev, "SW BUG: response_required == 0\n");
117 i2400m_bm_cmd_prepare(cmd);
118 }
119 d_printf(4, dev, "BM cmd %d: %zu bytes (%zu padded)\n",
120 opcode, cmd_size, cmd_size_a);
121 d_dump(5, dev, cmd, cmd_size);
122
123 sdio_claim_host(i2400ms->func); /* Send & check */
124 result = sdio_memcpy_toio(i2400ms->func, I2400MS_DATA_ADDR,
125 i2400m->bm_cmd_buf, cmd_size_a);
126 sdio_release_host(i2400ms->func);
127 if (result < 0) {
128 dev_err(dev, "BM cmd %d: cannot send: %ld\n",
129 opcode, (long) result);
130 goto error_cmd_send;
131 }
132 result = cmd_size;
133error_cmd_send:
134error_too_big:
135 d_fnend(5, dev, "(i2400m %p cmd %p size %zu) = %d\n",
136 i2400m, _cmd, cmd_size, (int) result);
137 return result;
138}
139
140
141/*
142 * Read an ack from the device's boot-mode (polling)
143 *
144 * @i2400m:
145 * @_ack: pointer to where to store the read data
146 * @ack_size: how many bytes we should read
147 *
148 * Returns: < 0 errno code on error; otherwise, amount of received bytes.
149 *
150 * The ACK for a BM command is always at least sizeof(*ack) bytes, so
151 * check for that. We don't need to check for device reboots
152 *
153 * NOTE: We do an artificial timeout of 1 sec over the SDIO timeout;
154 * this way we have control over it...there is no way that I know
155 * of setting an SDIO transaction timeout.
156 */
157ssize_t i2400ms_bus_bm_wait_for_ack(struct i2400m *i2400m,
158 struct i2400m_bootrom_header *ack,
159 size_t ack_size)
160{
161 int result;
162 ssize_t rx_size;
163 u64 timeout;
164 struct i2400ms *i2400ms = container_of(i2400m, struct i2400ms, i2400m);
165 struct sdio_func *func = i2400ms->func;
166 struct device *dev = &func->dev;
167
168 BUG_ON(sizeof(*ack) > ack_size);
169
170 d_fnstart(5, dev, "(i2400m %p ack %p size %zu)\n",
171 i2400m, ack, ack_size);
172
173 timeout = get_jiffies_64() + 2 * HZ;
174 sdio_claim_host(func);
175 while (1) {
176 if (time_after64(get_jiffies_64(), timeout)) {
177 rx_size = -ETIMEDOUT;
178 dev_err(dev, "timeout waiting for ack data\n");
179 goto error_timedout;
180 }
181
182 /* Find the RX size, check if it fits or not -- it if
183 * doesn't fit, fail, as we have no way to dispose of
184 * the extra data. */
185 rx_size = __i2400ms_rx_get_size(i2400ms);
186 if (rx_size < 0)
187 goto error_rx_get_size;
188 result = -ENOSPC; /* Check it fits */
189 if (rx_size < sizeof(*ack)) {
190 rx_size = -EIO;
191 dev_err(dev, "HW BUG? received is too small (%zu vs "
192 "%zu needed)\n", sizeof(*ack), rx_size);
193 goto error_too_small;
194 }
195 if (rx_size > I2400M_BM_ACK_BUF_SIZE) {
196 dev_err(dev, "SW BUG? BM_ACK_BUF is too small (%u vs "
197 "%zu needed)\n", I2400M_BM_ACK_BUF_SIZE,
198 rx_size);
199 goto error_too_small;
200 }
201
202 /* Read it */
203 result = sdio_memcpy_fromio(func, i2400m->bm_ack_buf,
204 I2400MS_DATA_ADDR, rx_size);
205 if (result == -ETIMEDOUT || result == -ETIME)
206 continue;
207 if (result < 0) {
208 dev_err(dev, "BM SDIO receive (%zu B) failed: %d\n",
209 rx_size, result);
210 goto error_read;
211 } else
212 break;
213 }
214 rx_size = min((ssize_t)ack_size, rx_size);
215 memcpy(ack, i2400m->bm_ack_buf, rx_size);
216error_read:
217error_too_small:
218error_rx_get_size:
219error_timedout:
220 sdio_release_host(func);
221 d_fnend(5, dev, "(i2400m %p ack %p size %zu) = %ld\n",
222 i2400m, ack, ack_size, (long) rx_size);
223 return rx_size;
224}
diff --git a/drivers/net/wimax/i2400m/sdio-rx.c b/drivers/net/wimax/i2400m/sdio-rx.c
new file mode 100644
index 000000000000..a3008b904f7d
--- /dev/null
+++ b/drivers/net/wimax/i2400m/sdio-rx.c
@@ -0,0 +1,255 @@
1/*
2 * Intel Wireless WiMAX Connection 2400m
3 * SDIO RX handling
4 *
5 *
6 * Copyright (C) 2007-2008 Intel Corporation. All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 *
12 * * Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * * Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in
16 * the documentation and/or other materials provided with the
17 * distribution.
18 * * Neither the name of Intel Corporation nor the names of its
19 * contributors may be used to endorse or promote products derived
20 * from this software without specific prior written permission.
21 *
22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 *
34 *
35 * Intel Corporation <linux-wimax@intel.com>
36 * Dirk Brandewie <dirk.j.brandewie@intel.com>
37 * - Initial implementation
38 *
39 *
40 * This handles the RX path on SDIO.
41 *
42 * The SDIO bus driver calls the "irq" routine when data is available.
43 * This is not a traditional interrupt routine since the SDIO bus
44 * driver calls us from its irq thread context. Because of this
45 * sleeping in the SDIO RX IRQ routine is okay.
46 *
47 * From there on, we obtain the size of the data that is available,
48 * allocate an skb, copy it and then pass it to the generic driver's
49 * RX routine [i2400m_rx()].
50 *
51 * ROADMAP
52 *
53 * i2400ms_irq()
54 * i2400ms_rx()
55 * __i2400ms_rx_get_size()
56 * i2400m_rx()
57 *
58 * i2400ms_rx_setup()
59 *
60 * i2400ms_rx_release()
61 */
62#include <linux/workqueue.h>
63#include <linux/wait.h>
64#include <linux/skbuff.h>
65#include <linux/mmc/sdio.h>
66#include <linux/mmc/sdio_func.h>
67#include "i2400m-sdio.h"
68
69#define D_SUBMODULE rx
70#include "sdio-debug-levels.h"
71
72
73/*
74 * Read and return the amount of bytes available for RX
75 *
76 * The RX size has to be read like this: byte reads of three
77 * sequential locations; then glue'em together.
78 *
79 * sdio_readl() doesn't work.
80 */
81ssize_t __i2400ms_rx_get_size(struct i2400ms *i2400ms)
82{
83 int ret, cnt, val;
84 ssize_t rx_size;
85 unsigned xfer_size_addr;
86 struct sdio_func *func = i2400ms->func;
87 struct device *dev = &i2400ms->func->dev;
88
89 d_fnstart(7, dev, "(i2400ms %p)\n", i2400ms);
90 xfer_size_addr = I2400MS_INTR_GET_SIZE_ADDR;
91 rx_size = 0;
92 for (cnt = 0; cnt < 3; cnt++) {
93 val = sdio_readb(func, xfer_size_addr + cnt, &ret);
94 if (ret < 0) {
95 dev_err(dev, "RX: Can't read byte %d of RX size from "
96 "0x%08x: %d\n", cnt, xfer_size_addr + cnt, ret);
97 rx_size = ret;
98 goto error_read;
99 }
100 rx_size = rx_size << 8 | (val & 0xff);
101 }
102 d_printf(6, dev, "RX: rx_size is %ld\n", (long) rx_size);
103error_read:
104 d_fnend(7, dev, "(i2400ms %p) = %ld\n", i2400ms, (long) rx_size);
105 return rx_size;
106}
107
108
109/*
110 * Read data from the device (when in normal)
111 *
112 * Allocate an SKB of the right size, read the data in and then
113 * deliver it to the generic layer.
114 *
115 * We also check for a reboot barker. That means the device died and
116 * we have to reboot it.
117 */
118static
119void i2400ms_rx(struct i2400ms *i2400ms)
120{
121 int ret;
122 struct sdio_func *func = i2400ms->func;
123 struct device *dev = &func->dev;
124 struct i2400m *i2400m = &i2400ms->i2400m;
125 struct sk_buff *skb;
126 ssize_t rx_size;
127
128 d_fnstart(7, dev, "(i2400ms %p)\n", i2400ms);
129 rx_size = __i2400ms_rx_get_size(i2400ms);
130 if (rx_size < 0) {
131 ret = rx_size;
132 goto error_get_size;
133 }
134 ret = -ENOMEM;
135 skb = alloc_skb(rx_size, GFP_ATOMIC);
136 if (NULL == skb) {
137 dev_err(dev, "RX: unable to alloc skb\n");
138 goto error_alloc_skb;
139 }
140
141 ret = sdio_memcpy_fromio(func, skb->data,
142 I2400MS_DATA_ADDR, rx_size);
143 if (ret < 0) {
144 dev_err(dev, "RX: SDIO data read failed: %d\n", ret);
145 goto error_memcpy_fromio;
146 }
147 /* Check if device has reset */
148 if (!memcmp(skb->data, i2400m_NBOOT_BARKER,
149 sizeof(i2400m_NBOOT_BARKER))
150 || !memcmp(skb->data, i2400m_SBOOT_BARKER,
151 sizeof(i2400m_SBOOT_BARKER))) {
152 ret = i2400m_dev_reset_handle(i2400m);
153 kfree_skb(skb);
154 } else {
155 skb_put(skb, rx_size);
156 i2400m_rx(i2400m, skb);
157 }
158 d_fnend(7, dev, "(i2400ms %p) = void\n", i2400ms);
159 return;
160
161error_memcpy_fromio:
162 kfree_skb(skb);
163error_alloc_skb:
164error_get_size:
165 d_fnend(7, dev, "(i2400ms %p) = %d\n", i2400ms, ret);
166 return;
167}
168
169
170/*
171 * Process an interrupt from the SDIO card
172 *
173 * FIXME: need to process other events that are not just ready-to-read
174 *
175 * Checks there is data ready and then proceeds to read it.
176 */
177static
178void i2400ms_irq(struct sdio_func *func)
179{
180 int ret;
181 struct i2400ms *i2400ms = sdio_get_drvdata(func);
182 struct i2400m *i2400m = &i2400ms->i2400m;
183 struct device *dev = &func->dev;
184 int val;
185
186 d_fnstart(6, dev, "(i2400ms %p)\n", i2400ms);
187 val = sdio_readb(func, I2400MS_INTR_STATUS_ADDR, &ret);
188 if (ret < 0) {
189 dev_err(dev, "RX: Can't read interrupt status: %d\n", ret);
190 goto error_no_irq;
191 }
192 if (!val) {
193 dev_err(dev, "RX: BUG? got IRQ but no interrupt ready?\n");
194 goto error_no_irq;
195 }
196 sdio_writeb(func, 1, I2400MS_INTR_CLEAR_ADDR, &ret);
197 if (WARN_ON(i2400m->boot_mode != 0))
198 dev_err(dev, "RX: SW BUG? boot mode and IRQ is up?\n");
199 else
200 i2400ms_rx(i2400ms);
201error_no_irq:
202 d_fnend(6, dev, "(i2400ms %p) = void\n", i2400ms);
203 return;
204}
205
206
207/*
208 * Setup SDIO RX
209 *
210 * Hooks up the IRQ handler and then enables IRQs.
211 */
212int i2400ms_rx_setup(struct i2400ms *i2400ms)
213{
214 int result;
215 struct sdio_func *func = i2400ms->func;
216 struct device *dev = &func->dev;
217
218 d_fnstart(5, dev, "(i2400ms %p)\n", i2400ms);
219 sdio_claim_host(func);
220 result = sdio_claim_irq(func, i2400ms_irq);
221 if (result < 0) {
222 dev_err(dev, "Cannot claim IRQ: %d\n", result);
223 goto error_irq_claim;
224 }
225 result = 0;
226 sdio_writeb(func, 1, I2400MS_INTR_ENABLE_ADDR, &result);
227 if (result < 0) {
228 sdio_release_irq(func);
229 dev_err(dev, "Failed to enable interrupts %d\n", result);
230 }
231error_irq_claim:
232 sdio_release_host(func);
233 d_fnend(5, dev, "(i2400ms %p) = %d\n", i2400ms, result);
234 return result;
235}
236
237
238/*
239 * Tear down SDIO RX
240 *
241 * Disables IRQs in the device and removes the IRQ handler.
242 */
243void i2400ms_rx_release(struct i2400ms *i2400ms)
244{
245 int result;
246 struct sdio_func *func = i2400ms->func;
247 struct device *dev = &func->dev;
248
249 d_fnstart(5, dev, "(i2400ms %p)\n", i2400ms);
250 sdio_claim_host(func);
251 sdio_writeb(func, 0, I2400MS_INTR_ENABLE_ADDR, &result);
252 sdio_release_irq(func);
253 sdio_release_host(func);
254 d_fnend(5, dev, "(i2400ms %p) = %d\n", i2400ms, result);
255}
diff --git a/drivers/net/wimax/i2400m/sdio-tx.c b/drivers/net/wimax/i2400m/sdio-tx.c
new file mode 100644
index 000000000000..5105a5ebc44f
--- /dev/null
+++ b/drivers/net/wimax/i2400m/sdio-tx.c
@@ -0,0 +1,153 @@
1/*
2 * Intel Wireless WiMAX Connection 2400m
3 * SDIO TX transaction backends
4 *
5 *
6 * Copyright (C) 2007-2008 Intel Corporation. All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 *
12 * * Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * * Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in
16 * the documentation and/or other materials provided with the
17 * distribution.
18 * * Neither the name of Intel Corporation nor the names of its
19 * contributors may be used to endorse or promote products derived
20 * from this software without specific prior written permission.
21 *
22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 *
34 *
35 * Intel Corporation <linux-wimax@intel.com>
36 * Dirk Brandewie <dirk.j.brandewie@intel.com>
37 * - Initial implementation
38 *
39 *
40 * Takes the TX messages in the i2400m's driver TX FIFO and sends them
41 * to the device until there are no more.
42 *
43 * If we fail sending the message, we just drop it. There isn't much
44 * we can do at this point. Most of the traffic is network, which has
45 * recovery methods for dropped packets.
46 *
47 * The SDIO functions are not atomic, so we can't run from the context
48 * where i2400m->bus_tx_kick() [i2400ms_bus_tx_kick()] is being called
49 * (some times atomic). Thus, the actual TX work is deferred to a
50 * workqueue.
51 *
52 * ROADMAP
53 *
54 * i2400ms_bus_tx_kick()
55 * i2400ms_tx_submit() [through workqueue]
56 *
57 * i2400m_tx_setup()
58 *
59 * i2400m_tx_release()
60 */
61#include <linux/mmc/sdio_func.h>
62#include "i2400m-sdio.h"
63
64#define D_SUBMODULE tx
65#include "sdio-debug-levels.h"
66
67
68/*
69 * Pull TX transations from the TX FIFO and send them to the device
70 * until there are no more.
71 */
72static
73void i2400ms_tx_submit(struct work_struct *ws)
74{
75 int result;
76 struct i2400ms *i2400ms = container_of(ws, struct i2400ms, tx_worker);
77 struct i2400m *i2400m = &i2400ms->i2400m;
78 struct sdio_func *func = i2400ms->func;
79 struct device *dev = &func->dev;
80 struct i2400m_msg_hdr *tx_msg;
81 size_t tx_msg_size;
82
83 d_fnstart(4, dev, "(i2400ms %p, i2400m %p)\n", i2400ms, i2400ms);
84
85 while (NULL != (tx_msg = i2400m_tx_msg_get(i2400m, &tx_msg_size))) {
86 d_printf(2, dev, "TX: submitting %zu bytes\n", tx_msg_size);
87 d_dump(5, dev, tx_msg, tx_msg_size);
88
89 sdio_claim_host(func);
90 result = sdio_memcpy_toio(func, 0, tx_msg, tx_msg_size);
91 sdio_release_host(func);
92
93 i2400m_tx_msg_sent(i2400m);
94
95 if (result < 0) {
96 dev_err(dev, "TX: cannot submit TX; tx_msg @%zu %zu B:"
97 " %d\n", (void *) tx_msg - i2400m->tx_buf,
98 tx_msg_size, result);
99 }
100
101 d_printf(2, dev, "TX: %zub submitted\n", tx_msg_size);
102 }
103
104 d_fnend(4, dev, "(i2400ms %p) = void\n", i2400ms);
105}
106
107
108/*
109 * The generic driver notifies us that there is data ready for TX
110 *
111 * Schedule a run of i2400ms_tx_submit() to handle it.
112 */
113void i2400ms_bus_tx_kick(struct i2400m *i2400m)
114{
115 struct i2400ms *i2400ms = container_of(i2400m, struct i2400ms, i2400m);
116 struct device *dev = &i2400ms->func->dev;
117
118 d_fnstart(3, dev, "(i2400m %p) = void\n", i2400m);
119
120 /* schedule tx work, this is because tx may block, therefore
121 * it has to run in a thread context.
122 */
123 queue_work(i2400ms->tx_workqueue, &i2400ms->tx_worker);
124
125 d_fnend(3, dev, "(i2400m %p) = void\n", i2400m);
126}
127
128int i2400ms_tx_setup(struct i2400ms *i2400ms)
129{
130 int result;
131 struct device *dev = &i2400ms->func->dev;
132 struct i2400m *i2400m = &i2400ms->i2400m;
133
134 d_fnstart(5, dev, "(i2400ms %p)\n", i2400ms);
135
136 INIT_WORK(&i2400ms->tx_worker, i2400ms_tx_submit);
137 snprintf(i2400ms->tx_wq_name, sizeof(i2400ms->tx_wq_name),
138 "%s-tx", i2400m->wimax_dev.name);
139 i2400ms->tx_workqueue =
140 create_singlethread_workqueue(i2400ms->tx_wq_name);
141 if (NULL == i2400ms->tx_workqueue) {
142 dev_err(dev, "TX: failed to create workqueue\n");
143 result = -ENOMEM;
144 } else
145 result = 0;
146 d_fnend(5, dev, "(i2400ms %p) = %d\n", i2400ms, result);
147 return result;
148}
149
150void i2400ms_tx_release(struct i2400ms *i2400ms)
151{
152 destroy_workqueue(i2400ms->tx_workqueue);
153}
diff --git a/drivers/net/wimax/i2400m/sdio.c b/drivers/net/wimax/i2400m/sdio.c
new file mode 100644
index 000000000000..1bfa283bbd8a
--- /dev/null
+++ b/drivers/net/wimax/i2400m/sdio.c
@@ -0,0 +1,511 @@
1/*
2 * Intel Wireless WiMAX Connection 2400m
3 * Linux driver model glue for the SDIO device, reset & fw upload
4 *
5 *
6 * Copyright (C) 2007-2008 Intel Corporation <linux-wimax@intel.com>
7 * Dirk Brandewie <dirk.j.brandewie@intel.com>
8 * Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
9 * Yanir Lubetkin <yanirx.lubetkin@intel.com>
10 *
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License version
13 * 2 as published by the Free Software Foundation.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
23 * 02110-1301, USA.
24 *
25 *
26 * See i2400m-sdio.h for a general description of this driver.
27 *
28 * This file implements driver model glue, and hook ups for the
29 * generic driver to implement the bus-specific functions (device
30 * communication setup/tear down, firmware upload and resetting).
31 *
32 * ROADMAP
33 *
34 * i2400m_probe()
35 * alloc_netdev()
36 * i2400ms_netdev_setup()
37 * i2400ms_init()
38 * i2400m_netdev_setup()
39 * i2400ms_enable_function()
40 * i2400m_setup()
41 *
42 * i2400m_remove()
43 * i2400m_release()
44 * free_netdev(net_dev)
45 *
46 * i2400ms_bus_reset() Called by i2400m->bus_reset
47 * __i2400ms_reset()
48 * __i2400ms_send_barker()
49 *
50 * i2400ms_bus_dev_start() Called by i2400m_dev_start() [who is
51 * i2400ms_tx_setup() called by i2400m_setup()]
52 * i2400ms_rx_setup()
53 *
54 * i2400ms_bus_dev_stop() Called by i2400m_dev_stop() [who is
55 * i2400ms_rx_release() is called by i2400m_release()]
56 * i2400ms_tx_release()
57 *
58 */
59
60#include <linux/debugfs.h>
61#include <linux/mmc/sdio.h>
62#include <linux/mmc/sdio_func.h>
63#include "i2400m-sdio.h"
64#include <linux/wimax/i2400m.h>
65
66#define D_SUBMODULE main
67#include "sdio-debug-levels.h"
68
69/* IOE WiMAX function timeout in seconds */
70static int ioe_timeout = 2;
71module_param(ioe_timeout, int, 0);
72
73/* Our firmware file name */
74#define I2400MS_FW_FILE_NAME "i2400m-fw-sdio-" I2400M_FW_VERSION ".sbcf"
75
76/*
77 * Enable the SDIO function
78 *
79 * Tries to enable the SDIO function; might fail if it is still not
80 * ready (in some hardware, the SDIO WiMAX function is only enabled
81 * when we ask it to explicitly doing). Tries until a timeout is
82 * reached.
83 *
84 * The reverse of this is...sdio_disable_function()
85 *
86 * Returns: 0 if the SDIO function was enabled, < 0 errno code on
87 * error (-ENODEV when it was unable to enable the function).
88 */
89static
90int i2400ms_enable_function(struct sdio_func *func)
91{
92 u64 timeout;
93 int err;
94 struct device *dev = &func->dev;
95
96 d_fnstart(3, dev, "(func %p)\n", func);
97 /* Setup timeout (FIXME: This needs to read the CIS table to
98 * get a real timeout) and then wait for the device to signal
99 * it is ready */
100 timeout = get_jiffies_64() + ioe_timeout * HZ;
101 err = -ENODEV;
102 while (err != 0 && time_before64(get_jiffies_64(), timeout)) {
103 sdio_claim_host(func);
104 err = sdio_enable_func(func);
105 if (0 == err) {
106 sdio_release_host(func);
107 d_printf(2, dev, "SDIO function enabled\n");
108 goto function_enabled;
109 }
110 d_printf(2, dev, "SDIO function failed to enable: %d\n", err);
111 sdio_disable_func(func);
112 sdio_release_host(func);
113 msleep(I2400MS_INIT_SLEEP_INTERVAL);
114 }
115 /* If timed out, device is not there yet -- get -ENODEV so
116 * the device driver core will retry later on. */
117 if (err == -ETIME) {
118 dev_err(dev, "Can't enable WiMAX function; "
119 " has the function been enabled?\n");
120 err = -ENODEV;
121 }
122function_enabled:
123 d_fnend(3, dev, "(func %p) = %d\n", func, err);
124 return err;
125}
126
127
128/*
129 * Setup driver resources needed to communicate with the device
130 *
131 * The fw needs some time to settle, and it was just uploaded,
132 * so give it a break first. I'd prefer to just wait for the device to
133 * send something, but seems the poking we do to enable SDIO stuff
134 * interferes with it, so just give it a break before starting...
135 */
136static
137int i2400ms_bus_dev_start(struct i2400m *i2400m)
138{
139 int result;
140 struct i2400ms *i2400ms = container_of(i2400m, struct i2400ms, i2400m);
141 struct sdio_func *func = i2400ms->func;
142 struct device *dev = &func->dev;
143
144 d_fnstart(3, dev, "(i2400m %p)\n", i2400m);
145 msleep(200);
146 result = i2400ms_rx_setup(i2400ms);
147 if (result < 0)
148 goto error_rx_setup;
149 result = i2400ms_tx_setup(i2400ms);
150 if (result < 0)
151 goto error_tx_setup;
152 d_fnend(3, dev, "(i2400m %p) = %d\n", i2400m, result);
153 return result;
154
155 i2400ms_tx_release(i2400ms);
156error_tx_setup:
157 i2400ms_rx_release(i2400ms);
158error_rx_setup:
159 d_fnend(3, dev, "(i2400m %p) = void\n", i2400m);
160 return result;
161}
162
163
164static
165void i2400ms_bus_dev_stop(struct i2400m *i2400m)
166{
167 struct i2400ms *i2400ms = container_of(i2400m, struct i2400ms, i2400m);
168 struct sdio_func *func = i2400ms->func;
169 struct device *dev = &func->dev;
170
171 d_fnstart(3, dev, "(i2400m %p)\n", i2400m);
172 i2400ms_rx_release(i2400ms);
173 i2400ms_tx_release(i2400ms);
174 d_fnend(3, dev, "(i2400m %p) = void\n", i2400m);
175}
176
177
178/*
179 * Sends a barker buffer to the device
180 *
181 * This helper will allocate a kmalloced buffer and use it to transmit
182 * (then free it). Reason for this is that the SDIO host controller
183 * expects alignment (unknown exactly which) which the stack won't
184 * really provide and certain arches/host-controller combinations
185 * cannot use stack/vmalloc/text areas for DMA transfers.
186 */
187static
188int __i2400ms_send_barker(struct i2400ms *i2400ms,
189 const __le32 *barker, size_t barker_size)
190{
191 int ret;
192 struct sdio_func *func = i2400ms->func;
193 struct device *dev = &func->dev;
194 void *buffer;
195
196 ret = -ENOMEM;
197 buffer = kmalloc(I2400MS_BLK_SIZE, GFP_KERNEL);
198 if (buffer == NULL)
199 goto error_kzalloc;
200
201 memcpy(buffer, barker, barker_size);
202 sdio_claim_host(func);
203 ret = sdio_memcpy_toio(func, 0, buffer, I2400MS_BLK_SIZE);
204 sdio_release_host(func);
205
206 if (ret < 0)
207 d_printf(0, dev, "E: barker error: %d\n", ret);
208
209 kfree(buffer);
210error_kzalloc:
211 return ret;
212}
213
214
215/*
216 * Reset a device at different levels (warm, cold or bus)
217 *
218 * @i2400ms: device descriptor
219 * @reset_type: soft, warm or bus reset (I2400M_RT_WARM/SOFT/BUS)
220 *
221 * FIXME: not tested -- need to confirm expected effects
222 *
223 * Warm and cold resets get an SDIO reset if they fail (unimplemented)
224 *
225 * Warm reset:
226 *
227 * The device will be fully reset internally, but won't be
228 * disconnected from the USB bus (so no reenumeration will
229 * happen). Firmware upload will be neccessary.
230 *
231 * The device will send a reboot barker in the notification endpoint
232 * that will trigger the driver to reinitialize the state
233 * automatically from notif.c:i2400m_notification_grok() into
234 * i2400m_dev_bootstrap_delayed().
235 *
236 * Cold and bus (USB) reset:
237 *
238 * The device will be fully reset internally, disconnected from the
239 * USB bus an a reenumeration will happen. Firmware upload will be
240 * neccessary. Thus, we don't do any locking or struct
241 * reinitialization, as we are going to be fully disconnected and
242 * reenumerated.
243 *
244 * Note we need to return -ENODEV if a warm reset was requested and we
245 * had to resort to a bus reset. See i2400m_op_reset(), wimax_reset()
246 * and wimax_dev->op_reset.
247 *
248 * WARNING: no driver state saved/fixed
249 */
250static
251int i2400ms_bus_reset(struct i2400m *i2400m, enum i2400m_reset_type rt)
252{
253 int result;
254 struct i2400ms *i2400ms =
255 container_of(i2400m, struct i2400ms, i2400m);
256 struct device *dev = i2400m_dev(i2400m);
257 static const __le32 i2400m_WARM_BOOT_BARKER[4] = {
258 __constant_cpu_to_le32(I2400M_WARM_RESET_BARKER),
259 __constant_cpu_to_le32(I2400M_WARM_RESET_BARKER),
260 __constant_cpu_to_le32(I2400M_WARM_RESET_BARKER),
261 __constant_cpu_to_le32(I2400M_WARM_RESET_BARKER),
262 };
263 static const __le32 i2400m_COLD_BOOT_BARKER[4] = {
264 __constant_cpu_to_le32(I2400M_COLD_RESET_BARKER),
265 __constant_cpu_to_le32(I2400M_COLD_RESET_BARKER),
266 __constant_cpu_to_le32(I2400M_COLD_RESET_BARKER),
267 __constant_cpu_to_le32(I2400M_COLD_RESET_BARKER),
268 };
269
270 if (rt == I2400M_RT_WARM)
271 result = __i2400ms_send_barker(i2400ms, i2400m_WARM_BOOT_BARKER,
272 sizeof(i2400m_WARM_BOOT_BARKER));
273 else if (rt == I2400M_RT_COLD)
274 result = __i2400ms_send_barker(i2400ms, i2400m_COLD_BOOT_BARKER,
275 sizeof(i2400m_COLD_BOOT_BARKER));
276 else if (rt == I2400M_RT_BUS) {
277do_bus_reset:
278 dev_err(dev, "FIXME: SDIO bus reset not implemented\n");
279 result = rt == I2400M_RT_WARM ? -ENODEV : -ENOSYS;
280 } else
281 BUG();
282 if (result < 0 && rt != I2400M_RT_BUS) {
283 dev_err(dev, "%s reset failed (%d); trying SDIO reset\n",
284 rt == I2400M_RT_WARM ? "warm" : "cold", result);
285 rt = I2400M_RT_BUS;
286 goto do_bus_reset;
287 }
288 return result;
289}
290
291
292static
293void i2400ms_netdev_setup(struct net_device *net_dev)
294{
295 struct i2400m *i2400m = net_dev_to_i2400m(net_dev);
296 struct i2400ms *i2400ms = container_of(i2400m, struct i2400ms, i2400m);
297 i2400ms_init(i2400ms);
298 i2400m_netdev_setup(net_dev);
299}
300
301
302/*
303 * Debug levels control; see debug.h
304 */
305struct d_level D_LEVEL[] = {
306 D_SUBMODULE_DEFINE(main),
307 D_SUBMODULE_DEFINE(tx),
308 D_SUBMODULE_DEFINE(rx),
309 D_SUBMODULE_DEFINE(fw),
310};
311size_t D_LEVEL_SIZE = ARRAY_SIZE(D_LEVEL);
312
313
314#define __debugfs_register(prefix, name, parent) \
315do { \
316 result = d_level_register_debugfs(prefix, name, parent); \
317 if (result < 0) \
318 goto error; \
319} while (0)
320
321
322static
323int i2400ms_debugfs_add(struct i2400ms *i2400ms)
324{
325 int result;
326 struct dentry *dentry = i2400ms->i2400m.wimax_dev.debugfs_dentry;
327
328 dentry = debugfs_create_dir("i2400m-usb", dentry);
329 result = PTR_ERR(dentry);
330 if (IS_ERR(dentry)) {
331 if (result == -ENODEV)
332 result = 0; /* No debugfs support */
333 goto error;
334 }
335 i2400ms->debugfs_dentry = dentry;
336 __debugfs_register("dl_", main, dentry);
337 __debugfs_register("dl_", tx, dentry);
338 __debugfs_register("dl_", rx, dentry);
339 __debugfs_register("dl_", fw, dentry);
340
341 return 0;
342
343error:
344 debugfs_remove_recursive(i2400ms->debugfs_dentry);
345 return result;
346}
347
348
349/*
350 * Probe a i2400m interface and register it
351 *
352 * @func: SDIO function
353 * @id: SDIO device ID
354 * @returns: 0 if ok, < 0 errno code on error.
355 *
356 * Alloc a net device, initialize the bus-specific details and then
357 * calls the bus-generic initialization routine. That will register
358 * the wimax and netdev devices, upload the firmware [using
359 * _bus_bm_*()], call _bus_dev_start() to finalize the setup of the
360 * communication with the device and then will start to talk to it to
361 * finnish setting it up.
362 *
363 * Initialization is tricky; some instances of the hw are packed with
364 * others in a way that requires a third driver that enables the WiMAX
365 * function. In those cases, we can't enable the SDIO function and
366 * we'll return with -ENODEV. When the driver that enables the WiMAX
367 * function does its thing, it has to do a bus_rescan_devices() on the
368 * SDIO bus so this driver is called again to enumerate the WiMAX
369 * function.
370 */
371static
372int i2400ms_probe(struct sdio_func *func,
373 const struct sdio_device_id *id)
374{
375 int result;
376 struct net_device *net_dev;
377 struct device *dev = &func->dev;
378 struct i2400m *i2400m;
379 struct i2400ms *i2400ms;
380
381 /* Allocate instance [calls i2400m_netdev_setup() on it]. */
382 result = -ENOMEM;
383 net_dev = alloc_netdev(sizeof(*i2400ms), "wmx%d",
384 i2400ms_netdev_setup);
385 if (net_dev == NULL) {
386 dev_err(dev, "no memory for network device instance\n");
387 goto error_alloc_netdev;
388 }
389 SET_NETDEV_DEV(net_dev, dev);
390 i2400m = net_dev_to_i2400m(net_dev);
391 i2400ms = container_of(i2400m, struct i2400ms, i2400m);
392 i2400m->wimax_dev.net_dev = net_dev;
393 i2400ms->func = func;
394 sdio_set_drvdata(func, i2400ms);
395
396 i2400m->bus_tx_block_size = I2400MS_BLK_SIZE;
397 i2400m->bus_pl_size_max = I2400MS_PL_SIZE_MAX;
398 i2400m->bus_dev_start = i2400ms_bus_dev_start;
399 i2400m->bus_dev_stop = i2400ms_bus_dev_stop;
400 i2400m->bus_tx_kick = i2400ms_bus_tx_kick;
401 i2400m->bus_reset = i2400ms_bus_reset;
402 i2400m->bus_bm_cmd_send = i2400ms_bus_bm_cmd_send;
403 i2400m->bus_bm_wait_for_ack = i2400ms_bus_bm_wait_for_ack;
404 i2400m->bus_fw_name = I2400MS_FW_FILE_NAME;
405 i2400m->bus_bm_mac_addr_impaired = 1;
406
407 result = i2400ms_enable_function(i2400ms->func);
408 if (result < 0) {
409 dev_err(dev, "Cannot enable SDIO function: %d\n", result);
410 goto error_func_enable;
411 }
412
413 sdio_claim_host(func);
414 result = sdio_set_block_size(func, I2400MS_BLK_SIZE);
415 if (result < 0) {
416 dev_err(dev, "Failed to set block size: %d\n", result);
417 goto error_set_blk_size;
418 }
419 sdio_release_host(func);
420
421 result = i2400m_setup(i2400m, I2400M_BRI_NO_REBOOT);
422 if (result < 0) {
423 dev_err(dev, "cannot setup device: %d\n", result);
424 goto error_setup;
425 }
426
427 result = i2400ms_debugfs_add(i2400ms);
428 if (result < 0) {
429 dev_err(dev, "cannot create SDIO debugfs: %d\n",
430 result);
431 goto error_debugfs_add;
432 }
433 return 0;
434
435error_debugfs_add:
436 i2400m_release(i2400m);
437error_setup:
438 sdio_set_drvdata(func, NULL);
439 sdio_claim_host(func);
440error_set_blk_size:
441 sdio_disable_func(func);
442 sdio_release_host(func);
443error_func_enable:
444 free_netdev(net_dev);
445error_alloc_netdev:
446 return result;
447}
448
449
450static
451void i2400ms_remove(struct sdio_func *func)
452{
453 struct device *dev = &func->dev;
454 struct i2400ms *i2400ms = sdio_get_drvdata(func);
455 struct i2400m *i2400m = &i2400ms->i2400m;
456 struct net_device *net_dev = i2400m->wimax_dev.net_dev;
457
458 d_fnstart(3, dev, "SDIO func %p\n", func);
459 debugfs_remove_recursive(i2400ms->debugfs_dentry);
460 i2400m_release(i2400m);
461 sdio_set_drvdata(func, NULL);
462 sdio_claim_host(func);
463 sdio_disable_func(func);
464 sdio_release_host(func);
465 free_netdev(net_dev);
466 d_fnend(3, dev, "SDIO func %p\n", func);
467}
468
469enum {
470 I2400MS_INTEL_VID = 0x89,
471};
472
473static
474const struct sdio_device_id i2400ms_sdio_ids[] = {
475 /* Intel: i2400m WiMAX over SDIO */
476 { SDIO_DEVICE(I2400MS_INTEL_VID, 0x1402) },
477 { }, /* end: all zeroes */
478};
479MODULE_DEVICE_TABLE(sdio, i2400ms_sdio_ids);
480
481
482static
483struct sdio_driver i2400m_sdio_driver = {
484 .name = KBUILD_MODNAME,
485 .probe = i2400ms_probe,
486 .remove = i2400ms_remove,
487 .id_table = i2400ms_sdio_ids,
488};
489
490
491static
492int __init i2400ms_driver_init(void)
493{
494 return sdio_register_driver(&i2400m_sdio_driver);
495}
496module_init(i2400ms_driver_init);
497
498
499static
500void __exit i2400ms_driver_exit(void)
501{
502 flush_scheduled_work(); /* for the stuff we schedule */
503 sdio_unregister_driver(&i2400m_sdio_driver);
504}
505module_exit(i2400ms_driver_exit);
506
507
508MODULE_AUTHOR("Intel Corporation <linux-wimax@intel.com>");
509MODULE_DESCRIPTION("Intel 2400M WiMAX networking for SDIO");
510MODULE_LICENSE("GPL");
511MODULE_FIRMWARE(I2400MS_FW_FILE_NAME);
diff --git a/drivers/net/wimax/i2400m/tx.c b/drivers/net/wimax/i2400m/tx.c
new file mode 100644
index 000000000000..613a88ffd651
--- /dev/null
+++ b/drivers/net/wimax/i2400m/tx.c
@@ -0,0 +1,817 @@
1/*
2 * Intel Wireless WiMAX Connection 2400m
3 * Generic (non-bus specific) TX handling
4 *
5 *
6 * Copyright (C) 2007-2008 Intel Corporation. All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 *
12 * * Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * * Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in
16 * the documentation and/or other materials provided with the
17 * distribution.
18 * * Neither the name of Intel Corporation nor the names of its
19 * contributors may be used to endorse or promote products derived
20 * from this software without specific prior written permission.
21 *
22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 *
34 *
35 * Intel Corporation <linux-wimax@intel.com>
36 * Yanir Lubetkin <yanirx.lubetkin@intel.com>
37 * - Initial implementation
38 *
39 * Intel Corporation <linux-wimax@intel.com>
40 * Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
41 * - Rewritten to use a single FIFO to lower the memory allocation
42 * pressure and optimize cache hits when copying to the queue, as
43 * well as splitting out bus-specific code.
44 *
45 *
46 * Implements data transmission to the device; this is done through a
47 * software FIFO, as data/control frames can be coalesced (while the
48 * device is reading the previous tx transaction, others accumulate).
49 *
50 * A FIFO is used because at the end it is resource-cheaper that trying
51 * to implement scatter/gather over USB. As well, most traffic is going
52 * to be download (vs upload).
53 *
54 * The format for sending/receiving data to/from the i2400m is
55 * described in detail in rx.c:PROTOCOL FORMAT. In here we implement
56 * the transmission of that. This is split between a bus-independent
57 * part that just prepares everything and a bus-specific part that
58 * does the actual transmission over the bus to the device (in the
59 * bus-specific driver).
60 *
61 *
62 * The general format of a device-host transaction is MSG-HDR, PLD1,
63 * PLD2...PLDN, PL1, PL2,...PLN, PADDING.
64 *
65 * Because we need the send payload descriptors and then payloads and
66 * because it is kind of expensive to do scatterlists in USB (one URB
67 * per node), it becomes cheaper to append all the data to a FIFO
68 * (copying to a FIFO potentially in cache is cheaper).
69 *
70 * Then the bus-specific code takes the parts of that FIFO that are
71 * written and passes them to the device.
72 *
73 * So the concepts to keep in mind there are:
74 *
75 * We use a FIFO to queue the data in a linear buffer. We first append
76 * a MSG-HDR, space for I2400M_TX_PLD_MAX payload descriptors and then
77 * go appending payloads until we run out of space or of payload
78 * descriptors. Then we append padding to make the whole transaction a
79 * multiple of i2400m->bus_tx_block_size (as defined by the bus layer).
80 *
81 * - A TX message: a combination of a message header, payload
82 * descriptors and payloads.
83 *
84 * Open: it is marked as active (i2400m->tx_msg is valid) and we
85 * can keep adding payloads to it.
86 *
87 * Closed: we are not appending more payloads to this TX message
88 * (exahusted space in the queue, too many payloads or
89 * whichever). We have appended padding so the whole message
90 * length is aligned to i2400m->bus_tx_block_size (as set by the
91 * bus/transport layer).
92 *
93 * - Most of the time we keep a TX message open to which we append
94 * payloads.
95 *
96 * - If we are going to append and there is no more space (we are at
97 * the end of the FIFO), we close the message, mark the rest of the
98 * FIFO space unusable (skip_tail), create a new message at the
99 * beginning of the FIFO (if there is space) and append the message
100 * there.
101 *
102 * This is because we need to give linear TX messages to the bus
103 * engine. So we don't write a message to the remaining FIFO space
104 * until the tail and continue at the head of it.
105 *
106 * - We overload one of the fields in the message header to use it as
107 * 'size' of the TX message, so we can iterate over them. It also
108 * contains a flag that indicates if we have to skip it or not.
109 * When we send the buffer, we update that to its real on-the-wire
110 * value.
111 *
112 * - The MSG-HDR PLD1...PLD2 stuff has to be a size multiple of 16.
113 *
114 * It follows that if MSG-HDR says we have N messages, the whole
115 * header + descriptors is 16 + 4*N; for those to be a multiple of
116 * 16, it follows that N can be 4, 8, 12, ... (32, 48, 64, 80...
117 * bytes).
118 *
119 * So if we have only 1 payload, we have to submit a header that in
120 * all truth has space for 4.
121 *
122 * The implication is that we reserve space for 12 (64 bytes); but
123 * if we fill up only (eg) 2, our header becomes 32 bytes only. So
124 * the TX engine has to shift those 32 bytes of msg header and 2
125 * payloads and padding so that right after it the payloads start
126 * and the TX engine has to know about that.
127 *
128 * It is cheaper to move the header up than the whole payloads down.
129 *
130 * We do this in i2400m_tx_close(). See 'i2400m_msg_hdr->offset'.
131 *
132 * - Each payload has to be size-padded to 16 bytes; before appending
133 * it, we just do it.
134 *
135 * - The whole message has to be padded to i2400m->bus_tx_block_size;
136 * we do this at close time. Thus, when reserving space for the
137 * payload, we always make sure there is also free space for this
138 * padding that sooner or later will happen.
139 *
140 * When we append a message, we tell the bus specific code to kick in
141 * TXs. It will TX (in parallel) until the buffer is exhausted--hence
142 * the lockin we do. The TX code will only send a TX message at the
143 * time (which remember, might contain more than one payload). Of
144 * course, when the bus-specific driver attempts to TX a message that
145 * is still open, it gets closed first.
146 *
147 * Gee, this is messy; well a picture. In the example below we have a
148 * partially full FIFO, with a closed message ready to be delivered
149 * (with a moved message header to make sure it is size-aligned to
150 * 16), TAIL room that was unusable (and thus is marked with a message
151 * header that says 'skip this') and at the head of the buffer, an
152 * imcomplete message with a couple of payloads.
153 *
154 * N ___________________________________________________
155 * | |
156 * | TAIL room |
157 * | |
158 * | msg_hdr to skip (size |= 0x80000) |
159 * |---------------------------------------------------|-------
160 * | | /|\
161 * | | |
162 * | TX message padding | |
163 * | | |
164 * | | |
165 * |- - - - - - - - - - - - - - - - - - - - - - - - - -| |
166 * | | |
167 * | payload 1 | |
168 * | | N * tx_block_size
169 * | | |
170 * |- - - - - - - - - - - - - - - - - - - - - - - - - -| |
171 * | | |
172 * | payload 1 | |
173 * | | |
174 * | | |
175 * |- - - - - - - - - - - - - - - - - - - - - - - - - -|- -|- - - -
176 * | padding 3 /|\ | | /|\
177 * | padding 2 | | | |
178 * | pld 1 32 bytes (2 * 16) | | |
179 * | pld 0 | | | |
180 * | moved msg_hdr \|/ | \|/ |
181 * |- - - - - - - - - - - - - - - - - - - - - - - - - -|- - - |
182 * | | _PLD_SIZE
183 * | unused | |
184 * | | |
185 * |- - - - - - - - - - - - - - - - - - - - - - - - - -| |
186 * | msg_hdr (size X) [this message is closed] | \|/
187 * |===================================================|========== <=== OUT
188 * | |
189 * | |
190 * | |
191 * | Free rooom |
192 * | |
193 * | |
194 * | |
195 * | |
196 * | |
197 * | |
198 * | |
199 * | |
200 * | |
201 * |===================================================|========== <=== IN
202 * | |
203 * | |
204 * | |
205 * | |
206 * | payload 1 |
207 * | |
208 * | |
209 * |- - - - - - - - - - - - - - - - - - - - - - - - - -|
210 * | |
211 * | payload 0 |
212 * | |
213 * | |
214 * |- - - - - - - - - - - - - - - - - - - - - - - - - -|
215 * | pld 11 /|\ |
216 * | ... | |
217 * | pld 1 64 bytes (2 * 16) |
218 * | pld 0 | |
219 * | msg_hdr (size X) \|/ [message is open] |
220 * 0 ---------------------------------------------------
221 *
222 *
223 * ROADMAP
224 *
225 * i2400m_tx_setup() Called by i2400m_setup
226 * i2400m_tx_release() Called by i2400m_release()
227 *
228 * i2400m_tx() Called to send data or control frames
229 * i2400m_tx_fifo_push() Allocates append-space in the FIFO
230 * i2400m_tx_new() Opens a new message in the FIFO
231 * i2400m_tx_fits() Checks if a new payload fits in the message
232 * i2400m_tx_close() Closes an open message in the FIFO
233 * i2400m_tx_skip_tail() Marks unusable FIFO tail space
234 * i2400m->bus_tx_kick()
235 *
236 * Now i2400m->bus_tx_kick() is the the bus-specific driver backend
237 * implementation; that would do:
238 *
239 * i2400m->bus_tx_kick()
240 * i2400m_tx_msg_get() Gets first message ready to go
241 * ...sends it...
242 * i2400m_tx_msg_sent() Ack the message is sent; repeat from
243 * _tx_msg_get() until it returns NULL
244 * (FIFO empty).
245 */
246#include <linux/netdevice.h>
247#include "i2400m.h"
248
249
250#define D_SUBMODULE tx
251#include "debug-levels.h"
252
253enum {
254 /**
255 * TX Buffer size
256 *
257 * Doc says maximum transaction is 16KiB. If we had 16KiB en
258 * route and 16KiB being queued, it boils down to needing
259 * 32KiB.
260 */
261 I2400M_TX_BUF_SIZE = 32768,
262 /**
263 * Message header and payload descriptors have to be 16
264 * aligned (16 + 4 * N = 16 * M). If we take that average sent
265 * packets are MTU size (~1400-~1500) it follows that we could
266 * fit at most 10-11 payloads in one transaction. To meet the
267 * alignment requirement, that means we need to leave space
268 * for 12 (64 bytes). To simplify, we leave space for that. If
269 * at the end there are less, we pad up to the nearest
270 * multiple of 16.
271 */
272 I2400M_TX_PLD_MAX = 12,
273 I2400M_TX_PLD_SIZE = sizeof(struct i2400m_msg_hdr)
274 + I2400M_TX_PLD_MAX * sizeof(struct i2400m_pld),
275 I2400M_TX_SKIP = 0x80000000,
276};
277
278#define TAIL_FULL ((void *)~(unsigned long)NULL)
279
280/*
281 * Allocate @size bytes in the TX fifo, return a pointer to it
282 *
283 * @i2400m: device descriptor
284 * @size: size of the buffer we need to allocate
285 * @padding: ensure that there is at least this many bytes of free
286 * contiguous space in the fifo. This is needed because later on
287 * we might need to add padding.
288 *
289 * Returns:
290 *
291 * Pointer to the allocated space. NULL if there is no
292 * space. TAIL_FULL if there is no space at the tail but there is at
293 * the head (Case B below).
294 *
295 * These are the two basic cases we need to keep an eye for -- it is
296 * much better explained in linux/kernel/kfifo.c, but this code
297 * basically does the same. No rocket science here.
298 *
299 * Case A Case B
300 * N ___________ ___________
301 * | tail room | | data |
302 * | | | |
303 * |<- IN ->| |<- OUT ->|
304 * | | | |
305 * | data | | room |
306 * | | | |
307 * |<- OUT ->| |<- IN ->|
308 * | | | |
309 * | head room | | data |
310 * 0 ----------- -----------
311 *
312 * We allocate only *contiguous* space.
313 *
314 * We can allocate only from 'room'. In Case B, it is simple; in case
315 * A, we only try from the tail room; if it is not enough, we just
316 * fail and return TAIL_FULL and let the caller figure out if we wants to
317 * skip the tail room and try to allocate from the head.
318 *
319 * Note:
320 *
321 * Assumes i2400m->tx_lock is taken, and we use that as a barrier
322 *
323 * The indexes keep increasing and we reset them to zero when we
324 * pop data off the queue
325 */
326static
327void *i2400m_tx_fifo_push(struct i2400m *i2400m, size_t size, size_t padding)
328{
329 struct device *dev = i2400m_dev(i2400m);
330 size_t room, tail_room, needed_size;
331 void *ptr;
332
333 needed_size = size + padding;
334 room = I2400M_TX_BUF_SIZE - (i2400m->tx_in - i2400m->tx_out);
335 if (room < needed_size) { /* this takes care of Case B */
336 d_printf(2, dev, "fifo push %zu/%zu: no space\n",
337 size, padding);
338 return NULL;
339 }
340 /* Is there space at the tail? */
341 tail_room = I2400M_TX_BUF_SIZE - i2400m->tx_in % I2400M_TX_BUF_SIZE;
342 if (tail_room < needed_size) {
343 if (i2400m->tx_out % I2400M_TX_BUF_SIZE
344 < i2400m->tx_in % I2400M_TX_BUF_SIZE) {
345 d_printf(2, dev, "fifo push %zu/%zu: tail full\n",
346 size, padding);
347 return TAIL_FULL; /* There might be head space */
348 } else {
349 d_printf(2, dev, "fifo push %zu/%zu: no head space\n",
350 size, padding);
351 return NULL; /* There is no space */
352 }
353 }
354 ptr = i2400m->tx_buf + i2400m->tx_in % I2400M_TX_BUF_SIZE;
355 d_printf(2, dev, "fifo push %zu/%zu: at @%zu\n", size, padding,
356 i2400m->tx_in % I2400M_TX_BUF_SIZE);
357 i2400m->tx_in += size;
358 return ptr;
359}
360
361
362/*
363 * Mark the tail of the FIFO buffer as 'to-skip'
364 *
365 * We should never hit the BUG_ON() because all the sizes we push to
366 * the FIFO are padded to be a multiple of 16 -- the size of *msg
367 * (I2400M_PL_PAD for the payloads, I2400M_TX_PLD_SIZE for the
368 * header).
369 *
370 * Note:
371 *
372 * Assumes i2400m->tx_lock is taken, and we use that as a barrier
373 */
374static
375void i2400m_tx_skip_tail(struct i2400m *i2400m)
376{
377 struct device *dev = i2400m_dev(i2400m);
378 size_t tx_in = i2400m->tx_in % I2400M_TX_BUF_SIZE;
379 size_t tail_room = I2400M_TX_BUF_SIZE - tx_in;
380 struct i2400m_msg_hdr *msg = i2400m->tx_buf + tx_in;
381 BUG_ON(tail_room < sizeof(*msg));
382 msg->size = tail_room | I2400M_TX_SKIP;
383 d_printf(2, dev, "skip tail: skipping %zu bytes @%zu\n",
384 tail_room, tx_in);
385 i2400m->tx_in += tail_room;
386}
387
388
389/*
390 * Check if a skb will fit in the TX queue's current active TX
391 * message (if there are still descriptors left unused).
392 *
393 * Returns:
394 * 0 if the message won't fit, 1 if it will.
395 *
396 * Note:
397 *
398 * Assumes a TX message is active (i2400m->tx_msg).
399 *
400 * Assumes i2400m->tx_lock is taken, and we use that as a barrier
401 */
402static
403unsigned i2400m_tx_fits(struct i2400m *i2400m)
404{
405 struct i2400m_msg_hdr *msg_hdr = i2400m->tx_msg;
406 return le16_to_cpu(msg_hdr->num_pls) < I2400M_TX_PLD_MAX;
407
408}
409
410
411/*
412 * Start a new TX message header in the queue.
413 *
414 * Reserve memory from the base FIFO engine and then just initialize
415 * the message header.
416 *
417 * We allocate the biggest TX message header we might need (one that'd
418 * fit I2400M_TX_PLD_MAX payloads) -- when it is closed it will be
419 * 'ironed it out' and the unneeded parts removed.
420 *
421 * NOTE:
422 *
423 * Assumes that the previous message is CLOSED (eg: either
424 * there was none or 'i2400m_tx_close()' was called on it).
425 *
426 * Assumes i2400m->tx_lock is taken, and we use that as a barrier
427 */
428static
429void i2400m_tx_new(struct i2400m *i2400m)
430{
431 struct device *dev = i2400m_dev(i2400m);
432 struct i2400m_msg_hdr *tx_msg;
433 BUG_ON(i2400m->tx_msg != NULL);
434try_head:
435 tx_msg = i2400m_tx_fifo_push(i2400m, I2400M_TX_PLD_SIZE, 0);
436 if (tx_msg == NULL)
437 goto out;
438 else if (tx_msg == TAIL_FULL) {
439 i2400m_tx_skip_tail(i2400m);
440 d_printf(2, dev, "new TX message: tail full, trying head\n");
441 goto try_head;
442 }
443 memset(tx_msg, 0, I2400M_TX_PLD_SIZE);
444 tx_msg->size = I2400M_TX_PLD_SIZE;
445out:
446 i2400m->tx_msg = tx_msg;
447 d_printf(2, dev, "new TX message: %p @%zu\n",
448 tx_msg, (void *) tx_msg - i2400m->tx_buf);
449}
450
451
452/*
453 * Finalize the current TX message header
454 *
455 * Sets the message header to be at the proper location depending on
456 * how many descriptors we have (check documentation at the file's
457 * header for more info on that).
458 *
459 * Appends padding bytes to make sure the whole TX message (counting
460 * from the 'relocated' message header) is aligned to
461 * tx_block_size. We assume the _append() code has left enough space
462 * in the FIFO for that. If there are no payloads, just pass, as it
463 * won't be transferred.
464 *
465 * The amount of padding bytes depends on how many payloads are in the
466 * TX message, as the "msg header and payload descriptors" will be
467 * shifted up in the buffer.
468 */
469static
470void i2400m_tx_close(struct i2400m *i2400m)
471{
472 struct device *dev = i2400m_dev(i2400m);
473 struct i2400m_msg_hdr *tx_msg = i2400m->tx_msg;
474 struct i2400m_msg_hdr *tx_msg_moved;
475 size_t aligned_size, padding, hdr_size;
476 void *pad_buf;
477
478 if (tx_msg->size & I2400M_TX_SKIP) /* a skipper? nothing to do */
479 goto out;
480
481 /* Relocate the message header
482 *
483 * Find the current header size, align it to 16 and if we need
484 * to move it so the tail is next to the payloads, move it and
485 * set the offset.
486 *
487 * If it moved, this header is good only for transmission; the
488 * original one (it is kept if we moved) is still used to
489 * figure out where the next TX message starts (and where the
490 * offset to the moved header is).
491 */
492 hdr_size = sizeof(*tx_msg)
493 + le16_to_cpu(tx_msg->num_pls) * sizeof(tx_msg->pld[0]);
494 hdr_size = ALIGN(hdr_size, I2400M_PL_PAD);
495 tx_msg->offset = I2400M_TX_PLD_SIZE - hdr_size;
496 tx_msg_moved = (void *) tx_msg + tx_msg->offset;
497 memmove(tx_msg_moved, tx_msg, hdr_size);
498 tx_msg_moved->size -= tx_msg->offset;
499 /*
500 * Now figure out how much we have to add to the (moved!)
501 * message so the size is a multiple of i2400m->bus_tx_block_size.
502 */
503 aligned_size = ALIGN(tx_msg_moved->size, i2400m->bus_tx_block_size);
504 padding = aligned_size - tx_msg_moved->size;
505 if (padding > 0) {
506 pad_buf = i2400m_tx_fifo_push(i2400m, padding, 0);
507 if (unlikely(WARN_ON(pad_buf == NULL
508 || pad_buf == TAIL_FULL))) {
509 /* This should not happen -- append should verify
510 * there is always space left at least to append
511 * tx_block_size */
512 dev_err(dev,
513 "SW BUG! Possible data leakage from memory the "
514 "device should not read for padding - "
515 "size %lu aligned_size %zu tx_buf %p in "
516 "%zu out %zu\n",
517 (unsigned long) tx_msg_moved->size,
518 aligned_size, i2400m->tx_buf, i2400m->tx_in,
519 i2400m->tx_out);
520 } else
521 memset(pad_buf, 0xad, padding);
522 }
523 tx_msg_moved->padding = cpu_to_le16(padding);
524 tx_msg_moved->size += padding;
525 if (tx_msg != tx_msg_moved)
526 tx_msg->size += padding;
527out:
528 i2400m->tx_msg = NULL;
529}
530
531
532/**
533 * i2400m_tx - send the data in a buffer to the device
534 *
535 * @buf: pointer to the buffer to transmit
536 *
537 * @buf_len: buffer size
538 *
539 * @pl_type: type of the payload we are sending.
540 *
541 * Returns:
542 * 0 if ok, < 0 errno code on error (-ENOSPC, if there is no more
543 * room for the message in the queue).
544 *
545 * Appends the buffer to the TX FIFO and notifies the bus-specific
546 * part of the driver that there is new data ready to transmit.
547 * Once this function returns, the buffer has been copied, so it can
548 * be reused.
549 *
550 * The steps followed to append are explained in detail in the file
551 * header.
552 *
553 * Whenever we write to a message, we increase msg->size, so it
554 * reflects exactly how big the message is. This is needed so that if
555 * we concatenate two messages before they can be sent, the code that
556 * sends the messages can find the boundaries (and it will replace the
557 * size with the real barker before sending).
558 *
559 * Note:
560 *
561 * Cold and warm reset payloads need to be sent as a single
562 * payload, so we handle that.
563 */
564int i2400m_tx(struct i2400m *i2400m, const void *buf, size_t buf_len,
565 enum i2400m_pt pl_type)
566{
567 int result = -ENOSPC;
568 struct device *dev = i2400m_dev(i2400m);
569 unsigned long flags;
570 size_t padded_len;
571 void *ptr;
572 unsigned is_singleton = pl_type == I2400M_PT_RESET_WARM
573 || pl_type == I2400M_PT_RESET_COLD;
574
575 d_fnstart(3, dev, "(i2400m %p skb %p [%zu bytes] pt %u)\n",
576 i2400m, buf, buf_len, pl_type);
577 padded_len = ALIGN(buf_len, I2400M_PL_PAD);
578 d_printf(5, dev, "padded_len %zd buf_len %zd\n", padded_len, buf_len);
579 /* If there is no current TX message, create one; if the
580 * current one is out of payload slots or we have a singleton,
581 * close it and start a new one */
582 spin_lock_irqsave(&i2400m->tx_lock, flags);
583try_new:
584 if (unlikely(i2400m->tx_msg == NULL))
585 i2400m_tx_new(i2400m);
586 else if (unlikely(!i2400m_tx_fits(i2400m)
587 || (is_singleton && i2400m->tx_msg->num_pls != 0))) {
588 d_printf(2, dev, "closing TX message (fits %u singleton "
589 "%u num_pls %u)\n", i2400m_tx_fits(i2400m),
590 is_singleton, i2400m->tx_msg->num_pls);
591 i2400m_tx_close(i2400m);
592 i2400m_tx_new(i2400m);
593 }
594 if (i2400m->tx_msg->size + padded_len > I2400M_TX_BUF_SIZE / 2) {
595 d_printf(2, dev, "TX: message too big, going new\n");
596 i2400m_tx_close(i2400m);
597 i2400m_tx_new(i2400m);
598 }
599 if (i2400m->tx_msg == NULL)
600 goto error_tx_new;
601 /* So we have a current message header; now append space for
602 * the message -- if there is not enough, try the head */
603 ptr = i2400m_tx_fifo_push(i2400m, padded_len,
604 i2400m->bus_tx_block_size);
605 if (ptr == TAIL_FULL) { /* Tail is full, try head */
606 d_printf(2, dev, "pl append: tail full\n");
607 i2400m_tx_close(i2400m);
608 i2400m_tx_skip_tail(i2400m);
609 goto try_new;
610 } else if (ptr == NULL) { /* All full */
611 result = -ENOSPC;
612 d_printf(2, dev, "pl append: all full\n");
613 } else { /* Got space, copy it, set padding */
614 struct i2400m_msg_hdr *tx_msg = i2400m->tx_msg;
615 unsigned num_pls = le16_to_cpu(tx_msg->num_pls);
616 memcpy(ptr, buf, buf_len);
617 memset(ptr + buf_len, 0xad, padded_len - buf_len);
618 i2400m_pld_set(&tx_msg->pld[num_pls], buf_len, pl_type);
619 d_printf(3, dev, "pld 0x%08x (type 0x%1x len 0x%04zx\n",
620 le32_to_cpu(tx_msg->pld[num_pls].val),
621 pl_type, buf_len);
622 tx_msg->num_pls = le16_to_cpu(num_pls+1);
623 tx_msg->size += padded_len;
624 d_printf(2, dev, "TX: appended %zu b (up to %u b) pl #%u \n",
625 padded_len, tx_msg->size, num_pls+1);
626 d_printf(2, dev,
627 "TX: appended hdr @%zu %zu b pl #%u @%zu %zu/%zu b\n",
628 (void *)tx_msg - i2400m->tx_buf, (size_t)tx_msg->size,
629 num_pls+1, ptr - i2400m->tx_buf, buf_len, padded_len);
630 result = 0;
631 if (is_singleton)
632 i2400m_tx_close(i2400m);
633 }
634error_tx_new:
635 spin_unlock_irqrestore(&i2400m->tx_lock, flags);
636 i2400m->bus_tx_kick(i2400m); /* always kick, might free up space */
637 d_fnend(3, dev, "(i2400m %p skb %p [%zu bytes] pt %u) = %d\n",
638 i2400m, buf, buf_len, pl_type, result);
639 return result;
640}
641EXPORT_SYMBOL_GPL(i2400m_tx);
642
643
644/**
645 * i2400m_tx_msg_get - Get the first TX message in the FIFO to start sending it
646 *
647 * @i2400m: device descriptors
648 * @bus_size: where to place the size of the TX message
649 *
650 * Called by the bus-specific driver to get the first TX message at
651 * the FIF that is ready for transmission.
652 *
653 * It sets the state in @i2400m to indicate the bus-specific driver is
654 * transfering that message (i2400m->tx_msg_size).
655 *
656 * Once the transfer is completed, call i2400m_tx_msg_sent().
657 *
658 * Notes:
659 *
660 * The size of the TX message to be transmitted might be smaller than
661 * that of the TX message in the FIFO (in case the header was
662 * shorter). Hence, we copy it in @bus_size, for the bus layer to
663 * use. We keep the message's size in i2400m->tx_msg_size so that
664 * when the bus later is done transferring we know how much to
665 * advance the fifo.
666 *
667 * We collect statistics here as all the data is available and we
668 * assume it is going to work [see i2400m_tx_msg_sent()].
669 */
670struct i2400m_msg_hdr *i2400m_tx_msg_get(struct i2400m *i2400m,
671 size_t *bus_size)
672{
673 struct device *dev = i2400m_dev(i2400m);
674 struct i2400m_msg_hdr *tx_msg, *tx_msg_moved;
675 unsigned long flags, pls;
676
677 d_fnstart(3, dev, "(i2400m %p bus_size %p)\n", i2400m, bus_size);
678 spin_lock_irqsave(&i2400m->tx_lock, flags);
679skip:
680 tx_msg_moved = NULL;
681 if (i2400m->tx_in == i2400m->tx_out) { /* Empty FIFO? */
682 i2400m->tx_in = 0;
683 i2400m->tx_out = 0;
684 d_printf(2, dev, "TX: FIFO empty: resetting\n");
685 goto out_unlock;
686 }
687 tx_msg = i2400m->tx_buf + i2400m->tx_out % I2400M_TX_BUF_SIZE;
688 if (tx_msg->size & I2400M_TX_SKIP) { /* skip? */
689 d_printf(2, dev, "TX: skip: msg @%zu (%zu b)\n",
690 i2400m->tx_out % I2400M_TX_BUF_SIZE,
691 (size_t) tx_msg->size & ~I2400M_TX_SKIP);
692 i2400m->tx_out += tx_msg->size & ~I2400M_TX_SKIP;
693 goto skip;
694 }
695
696 if (tx_msg->num_pls == 0) { /* No payloads? */
697 if (tx_msg == i2400m->tx_msg) { /* open, we are done */
698 d_printf(2, dev,
699 "TX: FIFO empty: open msg w/o payloads @%zu\n",
700 (void *) tx_msg - i2400m->tx_buf);
701 tx_msg = NULL;
702 goto out_unlock;
703 } else { /* closed, skip it */
704 d_printf(2, dev,
705 "TX: skip msg w/o payloads @%zu (%zu b)\n",
706 (void *) tx_msg - i2400m->tx_buf,
707 (size_t) tx_msg->size);
708 i2400m->tx_out += tx_msg->size & ~I2400M_TX_SKIP;
709 goto skip;
710 }
711 }
712 if (tx_msg == i2400m->tx_msg) /* open msg? */
713 i2400m_tx_close(i2400m);
714
715 /* Now we have a valid TX message (with payloads) to TX */
716 tx_msg_moved = (void *) tx_msg + tx_msg->offset;
717 i2400m->tx_msg_size = tx_msg->size;
718 *bus_size = tx_msg_moved->size;
719 d_printf(2, dev, "TX: pid %d msg hdr at @%zu offset +@%zu "
720 "size %zu bus_size %zu\n",
721 current->pid, (void *) tx_msg - i2400m->tx_buf,
722 (size_t) tx_msg->offset, (size_t) tx_msg->size,
723 (size_t) tx_msg_moved->size);
724 tx_msg_moved->barker = le32_to_cpu(I2400M_H2D_PREVIEW_BARKER);
725 tx_msg_moved->sequence = le32_to_cpu(i2400m->tx_sequence++);
726
727 pls = le32_to_cpu(tx_msg_moved->num_pls);
728 i2400m->tx_pl_num += pls; /* Update stats */
729 if (pls > i2400m->tx_pl_max)
730 i2400m->tx_pl_max = pls;
731 if (pls < i2400m->tx_pl_min)
732 i2400m->tx_pl_min = pls;
733 i2400m->tx_num++;
734 i2400m->tx_size_acc += *bus_size;
735 if (*bus_size < i2400m->tx_size_min)
736 i2400m->tx_size_min = *bus_size;
737 if (*bus_size > i2400m->tx_size_max)
738 i2400m->tx_size_max = *bus_size;
739out_unlock:
740 spin_unlock_irqrestore(&i2400m->tx_lock, flags);
741 d_fnstart(3, dev, "(i2400m %p bus_size %p [%zu]) = %p\n",
742 i2400m, bus_size, *bus_size, tx_msg_moved);
743 return tx_msg_moved;
744}
745EXPORT_SYMBOL_GPL(i2400m_tx_msg_get);
746
747
748/**
749 * i2400m_tx_msg_sent - indicate the transmission of a TX message
750 *
751 * @i2400m: device descriptor
752 *
753 * Called by the bus-specific driver when a message has been sent;
754 * this pops it from the FIFO; and as there is space, start the queue
755 * in case it was stopped.
756 *
757 * Should be called even if the message send failed and we are
758 * dropping this TX message.
759 */
760void i2400m_tx_msg_sent(struct i2400m *i2400m)
761{
762 unsigned n;
763 unsigned long flags;
764 struct device *dev = i2400m_dev(i2400m);
765
766 d_fnstart(3, dev, "(i2400m %p)\n", i2400m);
767 spin_lock_irqsave(&i2400m->tx_lock, flags);
768 i2400m->tx_out += i2400m->tx_msg_size;
769 d_printf(2, dev, "TX: sent %zu b\n", (size_t) i2400m->tx_msg_size);
770 i2400m->tx_msg_size = 0;
771 BUG_ON(i2400m->tx_out > i2400m->tx_in);
772 /* level them FIFO markers off */
773 n = i2400m->tx_out / I2400M_TX_BUF_SIZE;
774 i2400m->tx_out %= I2400M_TX_BUF_SIZE;
775 i2400m->tx_in -= n * I2400M_TX_BUF_SIZE;
776 netif_start_queue(i2400m->wimax_dev.net_dev);
777 spin_unlock_irqrestore(&i2400m->tx_lock, flags);
778 d_fnend(3, dev, "(i2400m %p) = void\n", i2400m);
779}
780EXPORT_SYMBOL_GPL(i2400m_tx_msg_sent);
781
782
783/**
784 * i2400m_tx_setup - Initialize the TX queue and infrastructure
785 *
786 * Make sure we reset the TX sequence to zero, as when this function
787 * is called, the firmware has been just restarted.
788 */
789int i2400m_tx_setup(struct i2400m *i2400m)
790{
791 int result;
792
793 /* Do this here only once -- can't do on
794 * i2400m_hard_start_xmit() as we'll cause race conditions if
795 * the WS was scheduled on another CPU */
796 INIT_WORK(&i2400m->wake_tx_ws, i2400m_wake_tx_work);
797
798 i2400m->tx_sequence = 0;
799 i2400m->tx_buf = kmalloc(I2400M_TX_BUF_SIZE, GFP_KERNEL);
800 if (i2400m->tx_buf == NULL)
801 result = -ENOMEM;
802 else
803 result = 0;
804 /* Huh? the bus layer has to define this... */
805 BUG_ON(i2400m->bus_tx_block_size == 0);
806 return result;
807
808}
809
810
811/**
812 * i2400m_tx_release - Tear down the TX queue and infrastructure
813 */
814void i2400m_tx_release(struct i2400m *i2400m)
815{
816 kfree(i2400m->tx_buf);
817}
diff --git a/drivers/net/wimax/i2400m/usb-debug-levels.h b/drivers/net/wimax/i2400m/usb-debug-levels.h
new file mode 100644
index 000000000000..e4358bd880be
--- /dev/null
+++ b/drivers/net/wimax/i2400m/usb-debug-levels.h
@@ -0,0 +1,42 @@
1/*
2 * Intel Wireless WiMAX Connection 2400m
3 * Debug levels control file for the i2400m-usb module
4 *
5 *
6 * Copyright (C) 2007-2008 Intel Corporation <linux-wimax@intel.com>
7 * Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License version
11 * 2 as published by the Free Software Foundation.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21 * 02110-1301, USA.
22 */
23#ifndef __debug_levels__h__
24#define __debug_levels__h__
25
26/* Maximum compile and run time debug level for all submodules */
27#define D_MODULENAME i2400m_usb
28#define D_MASTER CONFIG_WIMAX_I2400M_DEBUG_LEVEL
29
30#include <linux/wimax/debug.h>
31
32/* List of all the enabled modules */
33enum d_module {
34 D_SUBMODULE_DECLARE(usb),
35 D_SUBMODULE_DECLARE(fw),
36 D_SUBMODULE_DECLARE(notif),
37 D_SUBMODULE_DECLARE(rx),
38 D_SUBMODULE_DECLARE(tx),
39};
40
41
42#endif /* #ifndef __debug_levels__h__ */
diff --git a/drivers/net/wimax/i2400m/usb-fw.c b/drivers/net/wimax/i2400m/usb-fw.c
new file mode 100644
index 000000000000..5ad287c228b8
--- /dev/null
+++ b/drivers/net/wimax/i2400m/usb-fw.c
@@ -0,0 +1,340 @@
1/*
2 * Intel Wireless WiMAX Connection 2400m
3 * Firmware uploader's USB specifics
4 *
5 *
6 * Copyright (C) 2007-2008 Intel Corporation. All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 *
12 * * Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * * Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in
16 * the documentation and/or other materials provided with the
17 * distribution.
18 * * Neither the name of Intel Corporation nor the names of its
19 * contributors may be used to endorse or promote products derived
20 * from this software without specific prior written permission.
21 *
22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 *
34 *
35 * Intel Corporation <linux-wimax@intel.com>
36 * Yanir Lubetkin <yanirx.lubetkin@intel.com>
37 * Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
38 * - Initial implementation
39 *
40 * Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
41 * - bus generic/specific split
42 *
43 * THE PROCEDURE
44 *
45 * See fw.c for the generic description of this procedure.
46 *
47 * This file implements only the USB specifics. It boils down to how
48 * to send a command and waiting for an acknowledgement from the
49 * device.
50 *
51 * This code (and process) is single threaded. It assumes it is the
52 * only thread poking around (guaranteed by fw.c).
53 *
54 * COMMAND EXECUTION
55 *
56 * A write URB is posted with the buffer to the bulk output endpoint.
57 *
58 * ACK RECEPTION
59 *
60 * We just post a URB to the notification endpoint and wait for
61 * data. We repeat until we get all the data we expect (as indicated
62 * by the call from the bus generic code).
63 *
64 * The data is not read from the bulk in endpoint for boot mode.
65 *
66 * ROADMAP
67 *
68 * i2400mu_bus_bm_cmd_send
69 * i2400m_bm_cmd_prepare...
70 * i2400mu_tx_bulk_out
71 *
72 * i2400mu_bus_bm_wait_for_ack
73 * i2400m_notif_submit
74 */
75#include <linux/usb.h>
76#include "i2400m-usb.h"
77
78
79#define D_SUBMODULE fw
80#include "usb-debug-levels.h"
81
82
83/*
84 * Synchronous write to the device
85 *
86 * Takes care of updating EDC counts and thus, handle device errors.
87 */
88static
89ssize_t i2400mu_tx_bulk_out(struct i2400mu *i2400mu, void *buf, size_t buf_size)
90{
91 int result;
92 struct device *dev = &i2400mu->usb_iface->dev;
93 int len;
94 struct usb_endpoint_descriptor *epd;
95 int pipe, do_autopm = 1;
96
97 result = usb_autopm_get_interface(i2400mu->usb_iface);
98 if (result < 0) {
99 dev_err(dev, "BM-CMD: can't get autopm: %d\n", result);
100 do_autopm = 0;
101 }
102 epd = usb_get_epd(i2400mu->usb_iface, I2400MU_EP_BULK_OUT);
103 pipe = usb_sndbulkpipe(i2400mu->usb_dev, epd->bEndpointAddress);
104retry:
105 result = usb_bulk_msg(i2400mu->usb_dev, pipe, buf, buf_size, &len, HZ);
106 switch (result) {
107 case 0:
108 if (len != buf_size) {
109 dev_err(dev, "BM-CMD: short write (%u B vs %zu "
110 "expected)\n", len, buf_size);
111 result = -EIO;
112 break;
113 }
114 result = len;
115 break;
116 case -EINVAL: /* while removing driver */
117 case -ENODEV: /* dev disconnect ... */
118 case -ENOENT: /* just ignore it */
119 case -ESHUTDOWN: /* and exit */
120 case -ECONNRESET:
121 result = -ESHUTDOWN;
122 break;
123 case -ETIMEDOUT: /* bah... */
124 break;
125 default: /* any other? */
126 if (edc_inc(&i2400mu->urb_edc,
127 EDC_MAX_ERRORS, EDC_ERROR_TIMEFRAME)) {
128 dev_err(dev, "BM-CMD: maximum errors in "
129 "URB exceeded; resetting device\n");
130 usb_queue_reset_device(i2400mu->usb_iface);
131 result = -ENODEV;
132 break;
133 }
134 dev_err(dev, "BM-CMD: URB error %d, retrying\n",
135 result);
136 goto retry;
137 }
138 result = len;
139 if (do_autopm)
140 usb_autopm_put_interface(i2400mu->usb_iface);
141 return result;
142}
143
144
145/*
146 * Send a boot-mode command over the bulk-out pipe
147 *
148 * Command can be a raw command, which requires no preparation (and
149 * which might not even be following the command format). Checks that
150 * the right amount of data was transfered.
151 *
152 * To satisfy USB requirements (no onstack, vmalloc or in data segment
153 * buffers), we copy the command to i2400m->bm_cmd_buf and send it from
154 * there.
155 *
156 * @flags: pass thru from i2400m_bm_cmd()
157 * @return: cmd_size if ok, < 0 errno code on error.
158 */
159ssize_t i2400mu_bus_bm_cmd_send(struct i2400m *i2400m,
160 const struct i2400m_bootrom_header *_cmd,
161 size_t cmd_size, int flags)
162{
163 ssize_t result;
164 struct device *dev = i2400m_dev(i2400m);
165 struct i2400mu *i2400mu = container_of(i2400m, struct i2400mu, i2400m);
166 int opcode = _cmd == NULL ? -1 : i2400m_brh_get_opcode(_cmd);
167 struct i2400m_bootrom_header *cmd;
168 size_t cmd_size_a = ALIGN(cmd_size, 16); /* USB restriction */
169
170 d_fnstart(8, dev, "(i2400m %p cmd %p size %zu)\n",
171 i2400m, _cmd, cmd_size);
172 result = -E2BIG;
173 if (cmd_size > I2400M_BM_CMD_BUF_SIZE)
174 goto error_too_big;
175 memcpy(i2400m->bm_cmd_buf, _cmd, cmd_size);
176 cmd = i2400m->bm_cmd_buf;
177 if (cmd_size_a > cmd_size) /* Zero pad space */
178 memset(i2400m->bm_cmd_buf + cmd_size, 0, cmd_size_a - cmd_size);
179 if ((flags & I2400M_BM_CMD_RAW) == 0) {
180 if (WARN_ON(i2400m_brh_get_response_required(cmd) == 0))
181 dev_warn(dev, "SW BUG: response_required == 0\n");
182 i2400m_bm_cmd_prepare(cmd);
183 }
184 result = i2400mu_tx_bulk_out(i2400mu, i2400m->bm_cmd_buf, cmd_size);
185 if (result < 0) {
186 dev_err(dev, "boot-mode cmd %d: cannot send: %zd\n",
187 opcode, result);
188 goto error_cmd_send;
189 }
190 if (result != cmd_size) { /* all was transferred? */
191 dev_err(dev, "boot-mode cmd %d: incomplete transfer "
192 "(%zu vs %zu submitted)\n", opcode, result, cmd_size);
193 result = -EIO;
194 goto error_cmd_size;
195 }
196error_cmd_size:
197error_cmd_send:
198error_too_big:
199 d_fnend(8, dev, "(i2400m %p cmd %p size %zu) = %zd\n",
200 i2400m, _cmd, cmd_size, result);
201 return result;
202}
203
204
205static
206void __i2400mu_bm_notif_cb(struct urb *urb)
207{
208 complete(urb->context);
209}
210
211
212/*
213 * submit a read to the notification endpoint
214 *
215 * @i2400m: device descriptor
216 * @urb: urb to use
217 * @completion: completion varible to complete when done
218 *
219 * Data is always read to i2400m->bm_ack_buf
220 */
221static
222int i2400mu_notif_submit(struct i2400mu *i2400mu, struct urb *urb,
223 struct completion *completion)
224{
225 struct i2400m *i2400m = &i2400mu->i2400m;
226 struct usb_endpoint_descriptor *epd;
227 int pipe;
228
229 epd = usb_get_epd(i2400mu->usb_iface, I2400MU_EP_NOTIFICATION);
230 pipe = usb_rcvintpipe(i2400mu->usb_dev, epd->bEndpointAddress);
231 usb_fill_int_urb(urb, i2400mu->usb_dev, pipe,
232 i2400m->bm_ack_buf, I2400M_BM_ACK_BUF_SIZE,
233 __i2400mu_bm_notif_cb, completion,
234 epd->bInterval);
235 return usb_submit_urb(urb, GFP_KERNEL);
236}
237
238
239/*
240 * Read an ack from the notification endpoint
241 *
242 * @i2400m:
243 * @_ack: pointer to where to store the read data
244 * @ack_size: how many bytes we should read
245 *
246 * Returns: < 0 errno code on error; otherwise, amount of received bytes.
247 *
248 * Submits a notification read, appends the read data to the given ack
249 * buffer and then repeats (until @ack_size bytes have been
250 * received).
251 */
252ssize_t i2400mu_bus_bm_wait_for_ack(struct i2400m *i2400m,
253 struct i2400m_bootrom_header *_ack,
254 size_t ack_size)
255{
256 ssize_t result = -ENOMEM;
257 struct device *dev = i2400m_dev(i2400m);
258 struct i2400mu *i2400mu = container_of(i2400m, struct i2400mu, i2400m);
259 struct urb notif_urb;
260 void *ack = _ack;
261 size_t offset, len;
262 long val;
263 int do_autopm = 1;
264 DECLARE_COMPLETION_ONSTACK(notif_completion);
265
266 d_fnstart(8, dev, "(i2400m %p ack %p size %zu)\n",
267 i2400m, ack, ack_size);
268 BUG_ON(_ack == i2400m->bm_ack_buf);
269 result = usb_autopm_get_interface(i2400mu->usb_iface);
270 if (result < 0) {
271 dev_err(dev, "BM-ACK: can't get autopm: %d\n", (int) result);
272 do_autopm = 0;
273 }
274 usb_init_urb(&notif_urb); /* ready notifications */
275 usb_get_urb(&notif_urb);
276 offset = 0;
277 while (offset < ack_size) {
278 init_completion(&notif_completion);
279 result = i2400mu_notif_submit(i2400mu, &notif_urb,
280 &notif_completion);
281 if (result < 0)
282 goto error_notif_urb_submit;
283 val = wait_for_completion_interruptible_timeout(
284 &notif_completion, HZ);
285 if (val == 0) {
286 result = -ETIMEDOUT;
287 usb_kill_urb(&notif_urb); /* Timedout */
288 goto error_notif_wait;
289 }
290 if (val == -ERESTARTSYS) {
291 result = -EINTR; /* Interrupted */
292 usb_kill_urb(&notif_urb);
293 goto error_notif_wait;
294 }
295 result = notif_urb.status; /* How was the ack? */
296 switch (result) {
297 case 0:
298 break;
299 case -EINVAL: /* while removing driver */
300 case -ENODEV: /* dev disconnect ... */
301 case -ENOENT: /* just ignore it */
302 case -ESHUTDOWN: /* and exit */
303 case -ECONNRESET:
304 result = -ESHUTDOWN;
305 goto error_dev_gone;
306 default: /* any other? */
307 usb_kill_urb(&notif_urb); /* Timedout */
308 if (edc_inc(&i2400mu->urb_edc,
309 EDC_MAX_ERRORS, EDC_ERROR_TIMEFRAME))
310 goto error_exceeded;
311 dev_err(dev, "BM-ACK: URB error %d, "
312 "retrying\n", notif_urb.status);
313 continue; /* retry */
314 }
315 if (notif_urb.actual_length == 0) {
316 d_printf(6, dev, "ZLP received, retrying\n");
317 continue;
318 }
319 /* Got data, append it to the buffer */
320 len = min(ack_size - offset, (size_t) notif_urb.actual_length);
321 memcpy(ack + offset, i2400m->bm_ack_buf, len);
322 offset += len;
323 }
324 result = offset;
325error_notif_urb_submit:
326error_notif_wait:
327error_dev_gone:
328out:
329 if (do_autopm)
330 usb_autopm_put_interface(i2400mu->usb_iface);
331 d_fnend(8, dev, "(i2400m %p ack %p size %zu) = %zd\n",
332 i2400m, ack, ack_size, result);
333 return result;
334
335error_exceeded:
336 dev_err(dev, "bm: maximum errors in notification URB exceeded; "
337 "resetting device\n");
338 usb_queue_reset_device(i2400mu->usb_iface);
339 goto out;
340}
diff --git a/drivers/net/wimax/i2400m/usb-notif.c b/drivers/net/wimax/i2400m/usb-notif.c
new file mode 100644
index 000000000000..9702c22b2497
--- /dev/null
+++ b/drivers/net/wimax/i2400m/usb-notif.c
@@ -0,0 +1,269 @@
1/*
2 * Intel Wireless WiMAX Connection 2400m over USB
3 * Notification handling
4 *
5 *
6 * Copyright (C) 2007-2008 Intel Corporation. All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 *
12 * * Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * * Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in
16 * the documentation and/or other materials provided with the
17 * distribution.
18 * * Neither the name of Intel Corporation nor the names of its
19 * contributors may be used to endorse or promote products derived
20 * from this software without specific prior written permission.
21 *
22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 *
34 *
35 * Intel Corporation <linux-wimax@intel.com>
36 * Yanir Lubetkin <yanirx.lubetkin@intel.com>
37 * Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
38 * - Initial implementation
39 *
40 *
41 * The notification endpoint is active when the device is not in boot
42 * mode; in here we just read and get notifications; based on those,
43 * we act to either reinitialize the device after a reboot or to
44 * submit a RX request.
45 *
46 * ROADMAP
47 *
48 * i2400mu_usb_notification_setup()
49 *
50 * i2400mu_usb_notification_release()
51 *
52 * i2400mu_usb_notification_cb() Called when a URB is ready
53 * i2400mu_notif_grok()
54 * i2400m_dev_reset_handle()
55 * i2400mu_rx_kick()
56 */
57#include <linux/usb.h>
58#include "i2400m-usb.h"
59
60
61#define D_SUBMODULE notif
62#include "usb-debug-levels.h"
63
64
65static const
66__le32 i2400m_ZERO_BARKER[4] = { 0, 0, 0, 0 };
67
68
69/*
70 * Process a received notification
71 *
72 * In normal operation mode, we can only receive two types of payloads
73 * on the notification endpoint:
74 *
75 * - a reboot barker, we do a bootstrap (the device has reseted).
76 *
77 * - a block of zeroes: there is pending data in the IN endpoint
78 */
79static
80int i2400mu_notification_grok(struct i2400mu *i2400mu, const void *buf,
81 size_t buf_len)
82{
83 int ret;
84 struct device *dev = &i2400mu->usb_iface->dev;
85 struct i2400m *i2400m = &i2400mu->i2400m;
86
87 d_fnstart(4, dev, "(i2400m %p buf %p buf_len %zu)\n",
88 i2400mu, buf, buf_len);
89 ret = -EIO;
90 if (buf_len < sizeof(i2400m_NBOOT_BARKER))
91 /* Not a bug, just ignore */
92 goto error_bad_size;
93 if (!memcmp(i2400m_NBOOT_BARKER, buf, sizeof(i2400m_NBOOT_BARKER))
94 || !memcmp(i2400m_SBOOT_BARKER, buf, sizeof(i2400m_SBOOT_BARKER)))
95 ret = i2400m_dev_reset_handle(i2400m);
96 else if (!memcmp(i2400m_ZERO_BARKER, buf, sizeof(i2400m_ZERO_BARKER))) {
97 i2400mu_rx_kick(i2400mu);
98 ret = 0;
99 } else { /* Unknown or unexpected data in the notif message */
100 char prefix[64];
101 ret = -EIO;
102 dev_err(dev, "HW BUG? Unknown/unexpected data in notification "
103 "message (%zu bytes)\n", buf_len);
104 snprintf(prefix, sizeof(prefix), "%s %s: ",
105 dev_driver_string(dev) , dev->bus_id);
106 if (buf_len > 64) {
107 print_hex_dump(KERN_ERR, prefix, DUMP_PREFIX_OFFSET,
108 8, 4, buf, 64, 0);
109 printk(KERN_ERR "%s... (only first 64 bytes "
110 "dumped)\n", prefix);
111 } else
112 print_hex_dump(KERN_ERR, prefix, DUMP_PREFIX_OFFSET,
113 8, 4, buf, buf_len, 0);
114 }
115error_bad_size:
116 d_fnend(4, dev, "(i2400m %p buf %p buf_len %zu) = %d\n",
117 i2400mu, buf, buf_len, ret);
118 return ret;
119}
120
121
122/*
123 * URB callback for the notification endpoint
124 *
125 * @urb: the urb received from the notification endpoint
126 *
127 * This function will just process the USB side of the transaction,
128 * checking everything is fine, pass the processing to
129 * i2400m_notification_grok() and resubmit the URB.
130 */
131static
132void i2400mu_notification_cb(struct urb *urb)
133{
134 int ret;
135 struct i2400mu *i2400mu = urb->context;
136 struct device *dev = &i2400mu->usb_iface->dev;
137
138 d_fnstart(4, dev, "(urb %p status %d actual_length %d)\n",
139 urb, urb->status, urb->actual_length);
140 ret = urb->status;
141 switch (ret) {
142 case 0:
143 ret = i2400mu_notification_grok(i2400mu, urb->transfer_buffer,
144 urb->actual_length);
145 if (ret == -EIO && edc_inc(&i2400mu->urb_edc, EDC_MAX_ERRORS,
146 EDC_ERROR_TIMEFRAME))
147 goto error_exceeded;
148 if (ret == -ENOMEM) /* uff...power cycle? shutdown? */
149 goto error_exceeded;
150 break;
151 case -EINVAL: /* while removing driver */
152 case -ENODEV: /* dev disconnect ... */
153 case -ENOENT: /* ditto */
154 case -ESHUTDOWN: /* URB killed */
155 case -ECONNRESET: /* disconnection */
156 goto out; /* Notify around */
157 default: /* Some error? */
158 if (edc_inc(&i2400mu->urb_edc,
159 EDC_MAX_ERRORS, EDC_ERROR_TIMEFRAME))
160 goto error_exceeded;
161 dev_err(dev, "notification: URB error %d, retrying\n",
162 urb->status);
163 }
164 usb_mark_last_busy(i2400mu->usb_dev);
165 ret = usb_submit_urb(i2400mu->notif_urb, GFP_ATOMIC);
166 switch (ret) {
167 case 0:
168 case -EINVAL: /* while removing driver */
169 case -ENODEV: /* dev disconnect ... */
170 case -ENOENT: /* ditto */
171 case -ESHUTDOWN: /* URB killed */
172 case -ECONNRESET: /* disconnection */
173 break; /* just ignore */
174 default: /* Some error? */
175 dev_err(dev, "notification: cannot submit URB: %d\n", ret);
176 goto error_submit;
177 }
178 d_fnend(4, dev, "(urb %p status %d actual_length %d) = void\n",
179 urb, urb->status, urb->actual_length);
180 return;
181
182error_exceeded:
183 dev_err(dev, "maximum errors in notification URB exceeded; "
184 "resetting device\n");
185error_submit:
186 usb_queue_reset_device(i2400mu->usb_iface);
187out:
188 d_fnend(4, dev, "(urb %p status %d actual_length %d) = void\n",
189 urb, urb->status, urb->actual_length);
190 return;
191}
192
193
194/*
195 * setup the notification endpoint
196 *
197 * @i2400m: device descriptor
198 *
199 * This procedure prepares the notification urb and handler for receiving
200 * unsolicited barkers from the device.
201 */
202int i2400mu_notification_setup(struct i2400mu *i2400mu)
203{
204 struct device *dev = &i2400mu->usb_iface->dev;
205 int usb_pipe, ret = 0;
206 struct usb_endpoint_descriptor *epd;
207 char *buf;
208
209 d_fnstart(4, dev, "(i2400m %p)\n", i2400mu);
210 buf = kmalloc(I2400MU_MAX_NOTIFICATION_LEN, GFP_KERNEL | GFP_DMA);
211 if (buf == NULL) {
212 dev_err(dev, "notification: buffer allocation failed\n");
213 ret = -ENOMEM;
214 goto error_buf_alloc;
215 }
216
217 i2400mu->notif_urb = usb_alloc_urb(0, GFP_KERNEL);
218 if (!i2400mu->notif_urb) {
219 ret = -ENOMEM;
220 dev_err(dev, "notification: cannot allocate URB\n");
221 goto error_alloc_urb;
222 }
223 epd = usb_get_epd(i2400mu->usb_iface, I2400MU_EP_NOTIFICATION);
224 usb_pipe = usb_rcvintpipe(i2400mu->usb_dev, epd->bEndpointAddress);
225 usb_fill_int_urb(i2400mu->notif_urb, i2400mu->usb_dev, usb_pipe,
226 buf, I2400MU_MAX_NOTIFICATION_LEN,
227 i2400mu_notification_cb, i2400mu, epd->bInterval);
228 ret = usb_submit_urb(i2400mu->notif_urb, GFP_KERNEL);
229 if (ret != 0) {
230 dev_err(dev, "notification: cannot submit URB: %d\n", ret);
231 goto error_submit;
232 }
233 d_fnend(4, dev, "(i2400m %p) = %d\n", i2400mu, ret);
234 return ret;
235
236error_submit:
237 usb_free_urb(i2400mu->notif_urb);
238error_alloc_urb:
239 kfree(buf);
240error_buf_alloc:
241 d_fnend(4, dev, "(i2400m %p) = %d\n", i2400mu, ret);
242 return ret;
243}
244
245
246/*
247 * Tear down of the notification mechanism
248 *
249 * @i2400m: device descriptor
250 *
251 * Kill the interrupt endpoint urb, free any allocated resources.
252 *
253 * We need to check if we have done it before as for example,
254 * _suspend() call this; if after a suspend() we get a _disconnect()
255 * (as the case is when hibernating), nothing bad happens.
256 */
257void i2400mu_notification_release(struct i2400mu *i2400mu)
258{
259 struct device *dev = &i2400mu->usb_iface->dev;
260
261 d_fnstart(4, dev, "(i2400mu %p)\n", i2400mu);
262 if (i2400mu->notif_urb != NULL) {
263 usb_kill_urb(i2400mu->notif_urb);
264 kfree(i2400mu->notif_urb->transfer_buffer);
265 usb_free_urb(i2400mu->notif_urb);
266 i2400mu->notif_urb = NULL;
267 }
268 d_fnend(4, dev, "(i2400mu %p)\n", i2400mu);
269}
diff --git a/drivers/net/wimax/i2400m/usb-rx.c b/drivers/net/wimax/i2400m/usb-rx.c
new file mode 100644
index 000000000000..074cc1f89853
--- /dev/null
+++ b/drivers/net/wimax/i2400m/usb-rx.c
@@ -0,0 +1,417 @@
1/*
2 * Intel Wireless WiMAX Connection 2400m
3 * USB RX handling
4 *
5 *
6 * Copyright (C) 2007-2008 Intel Corporation. All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 *
12 * * Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * * Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in
16 * the documentation and/or other materials provided with the
17 * distribution.
18 * * Neither the name of Intel Corporation nor the names of its
19 * contributors may be used to endorse or promote products derived
20 * from this software without specific prior written permission.
21 *
22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 *
34 *
35 * Intel Corporation <linux-wimax@intel.com>
36 * Yanir Lubetkin <yanirx.lubetkin@intel.com>
37 * - Initial implementation
38 * Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
39 * - Use skb_clone(), break up processing in chunks
40 * - Split transport/device specific
41 * - Make buffer size dynamic to exert less memory pressure
42 *
43 *
44 * This handles the RX path on USB.
45 *
46 * When a notification is received that says 'there is RX data ready',
47 * we call i2400mu_rx_kick(); that wakes up the RX kthread, which
48 * reads a buffer from USB and passes it to i2400m_rx() in the generic
49 * handling code. The RX buffer has an specific format that is
50 * described in rx.c.
51 *
52 * We use a kernel thread in a loop because:
53 *
54 * - we want to be able to call the USB power management get/put
55 * functions (blocking) before each transaction.
56 *
57 * - We might get a lot of notifications and we don't want to submit
58 * a zillion reads; by serializing, we are throttling.
59 *
60 * - RX data processing can get heavy enough so that it is not
61 * appropiate for doing it in the USB callback; thus we run it in a
62 * process context.
63 *
64 * We provide a read buffer of an arbitrary size (short of a page); if
65 * the callback reports -EOVERFLOW, it means it was too small, so we
66 * just double the size and retry (being careful to append, as
67 * sometimes the device provided some data). Every now and then we
68 * check if the average packet size is smaller than the current packet
69 * size and if so, we halve it. At the end, the size of the
70 * preallocated buffer should be following the average received
71 * transaction size, adapting dynamically to it.
72 *
73 * ROADMAP
74 *
75 * i2400mu_rx_kick() Called from notif.c when we get a
76 * 'data ready' notification
77 * i2400mu_rxd() Kernel RX daemon
78 * i2400mu_rx() Receive USB data
79 * i2400m_rx() Send data to generic i2400m RX handling
80 *
81 * i2400mu_rx_setup() called from i2400mu_bus_dev_start()
82 *
83 * i2400mu_rx_release() called from i2400mu_bus_dev_stop()
84 */
85#include <linux/workqueue.h>
86#include <linux/usb.h>
87#include "i2400m-usb.h"
88
89
90#define D_SUBMODULE rx
91#include "usb-debug-levels.h"
92
93/*
94 * Dynamic RX size
95 *
96 * We can't let the rx_size be a multiple of 512 bytes (the RX
97 * endpoint's max packet size). On some USB host controllers (we
98 * haven't been able to fully characterize which), if the device is
99 * about to send (for example) X bytes and we only post a buffer to
100 * receive n*512, it will fail to mark that as babble (so that
101 * i2400mu_rx() [case -EOVERFLOW] can resize the buffer and get the
102 * rest).
103 *
104 * So on growing or shrinking, if it is a multiple of the
105 * maxpacketsize, we remove some (instead of incresing some, so in a
106 * buddy allocator we try to waste less space).
107 *
108 * Note we also need a hook for this on i2400mu_rx() -- when we do the
109 * first read, we are sure we won't hit this spot because
110 * i240mm->rx_size has been set properly. However, if we have to
111 * double because of -EOVERFLOW, when we launch the read to get the
112 * rest of the data, we *have* to make sure that also is not a
113 * multiple of the max_pkt_size.
114 */
115
116static
117size_t i2400mu_rx_size_grow(struct i2400mu *i2400mu)
118{
119 struct device *dev = &i2400mu->usb_iface->dev;
120 size_t rx_size;
121 const size_t max_pkt_size = 512;
122
123 rx_size = 2 * i2400mu->rx_size;
124 if (rx_size % max_pkt_size == 0) {
125 rx_size -= 8;
126 d_printf(1, dev,
127 "RX: expected size grew to %zu [adjusted -8] "
128 "from %zu\n",
129 rx_size, i2400mu->rx_size);
130 } else
131 d_printf(1, dev,
132 "RX: expected size grew to %zu from %zu\n",
133 rx_size, i2400mu->rx_size);
134 return rx_size;
135}
136
137
138static
139void i2400mu_rx_size_maybe_shrink(struct i2400mu *i2400mu)
140{
141 const size_t max_pkt_size = 512;
142 struct device *dev = &i2400mu->usb_iface->dev;
143
144 if (unlikely(i2400mu->rx_size_cnt >= 100
145 && i2400mu->rx_size_auto_shrink)) {
146 size_t avg_rx_size =
147 i2400mu->rx_size_acc / i2400mu->rx_size_cnt;
148 size_t new_rx_size = i2400mu->rx_size / 2;
149 if (avg_rx_size < new_rx_size) {
150 if (new_rx_size % max_pkt_size == 0) {
151 new_rx_size -= 8;
152 d_printf(1, dev,
153 "RX: expected size shrank to %zu "
154 "[adjusted -8] from %zu\n",
155 new_rx_size, i2400mu->rx_size);
156 } else
157 d_printf(1, dev,
158 "RX: expected size shrank to %zu "
159 "from %zu\n",
160 new_rx_size, i2400mu->rx_size);
161 i2400mu->rx_size = new_rx_size;
162 i2400mu->rx_size_cnt = 0;
163 i2400mu->rx_size_acc = i2400mu->rx_size;
164 }
165 }
166}
167
168/*
169 * Receive a message with payloads from the USB bus into an skb
170 *
171 * @i2400mu: USB device descriptor
172 * @rx_skb: skb where to place the received message
173 *
174 * Deals with all the USB-specifics of receiving, dynamically
175 * increasing the buffer size if so needed. Returns the payload in the
176 * skb, ready to process. On a zero-length packet, we retry.
177 *
178 * On soft USB errors, we retry (until they become too frequent and
179 * then are promoted to hard); on hard USB errors, we reset the
180 * device. On other errors (skb realloacation, we just drop it and
181 * hope for the next invocation to solve it).
182 *
183 * Returns: pointer to the skb if ok, ERR_PTR on error.
184 * NOTE: this function might realloc the skb (if it is too small),
185 * so always update with the one returned.
186 * ERR_PTR() is < 0 on error.
187 */
188static
189struct sk_buff *i2400mu_rx(struct i2400mu *i2400mu, struct sk_buff *rx_skb)
190{
191 int result = 0;
192 struct device *dev = &i2400mu->usb_iface->dev;
193 int usb_pipe, read_size, rx_size, do_autopm;
194 struct usb_endpoint_descriptor *epd;
195 const size_t max_pkt_size = 512;
196
197 d_fnstart(4, dev, "(i2400mu %p)\n", i2400mu);
198 do_autopm = atomic_read(&i2400mu->do_autopm);
199 result = do_autopm ?
200 usb_autopm_get_interface(i2400mu->usb_iface) : 0;
201 if (result < 0) {
202 dev_err(dev, "RX: can't get autopm: %d\n", result);
203 do_autopm = 0;
204 }
205 epd = usb_get_epd(i2400mu->usb_iface, I2400MU_EP_BULK_IN);
206 usb_pipe = usb_rcvbulkpipe(i2400mu->usb_dev, epd->bEndpointAddress);
207retry:
208 rx_size = skb_end_pointer(rx_skb) - rx_skb->data - rx_skb->len;
209 if (unlikely(rx_size % max_pkt_size == 0)) {
210 rx_size -= 8;
211 d_printf(1, dev, "RX: rx_size adapted to %d [-8]\n", rx_size);
212 }
213 result = usb_bulk_msg(
214 i2400mu->usb_dev, usb_pipe, rx_skb->data + rx_skb->len,
215 rx_size, &read_size, HZ);
216 usb_mark_last_busy(i2400mu->usb_dev);
217 switch (result) {
218 case 0:
219 if (read_size == 0)
220 goto retry; /* ZLP, just resubmit */
221 skb_put(rx_skb, read_size);
222 break;
223 case -EINVAL: /* while removing driver */
224 case -ENODEV: /* dev disconnect ... */
225 case -ENOENT: /* just ignore it */
226 case -ESHUTDOWN:
227 case -ECONNRESET:
228 break;
229 case -EOVERFLOW: { /* too small, reallocate */
230 struct sk_buff *new_skb;
231 rx_size = i2400mu_rx_size_grow(i2400mu);
232 if (rx_size <= (1 << 16)) /* cap it */
233 i2400mu->rx_size = rx_size;
234 else if (printk_ratelimit()) {
235 dev_err(dev, "BUG? rx_size up to %d\n", rx_size);
236 result = -EINVAL;
237 goto out;
238 }
239 skb_put(rx_skb, read_size);
240 new_skb = skb_copy_expand(rx_skb, 0, rx_size - rx_skb->len,
241 GFP_KERNEL);
242 if (new_skb == NULL) {
243 if (printk_ratelimit())
244 dev_err(dev, "RX: Can't reallocate skb to %d; "
245 "RX dropped\n", rx_size);
246 kfree(rx_skb);
247 result = 0;
248 goto out; /* drop it...*/
249 }
250 kfree_skb(rx_skb);
251 rx_skb = new_skb;
252 i2400mu->rx_size_cnt = 0;
253 i2400mu->rx_size_acc = i2400mu->rx_size;
254 d_printf(1, dev, "RX: size changed to %d, received %d, "
255 "copied %d, capacity %ld\n",
256 rx_size, read_size, rx_skb->len,
257 (long) (skb_end_pointer(new_skb) - new_skb->head));
258 goto retry;
259 }
260 /* In most cases, it happens due to the hardware scheduling a
261 * read when there was no data - unfortunately, we have no way
262 * to tell this timeout from a USB timeout. So we just ignore
263 * it. */
264 case -ETIMEDOUT:
265 dev_err(dev, "RX: timeout: %d\n", result);
266 result = 0;
267 break;
268 default: /* Any error */
269 if (edc_inc(&i2400mu->urb_edc,
270 EDC_MAX_ERRORS, EDC_ERROR_TIMEFRAME))
271 goto error_reset;
272 dev_err(dev, "RX: error receiving URB: %d, retrying\n", result);
273 goto retry;
274 }
275out:
276 if (do_autopm)
277 usb_autopm_put_interface(i2400mu->usb_iface);
278 d_fnend(4, dev, "(i2400mu %p) = %p\n", i2400mu, rx_skb);
279 return rx_skb;
280
281error_reset:
282 dev_err(dev, "RX: maximum errors in URB exceeded; "
283 "resetting device\n");
284 usb_queue_reset_device(i2400mu->usb_iface);
285 rx_skb = ERR_PTR(result);
286 goto out;
287}
288
289
290/*
291 * Kernel thread for USB reception of data
292 *
293 * This thread waits for a kick; once kicked, it will allocate an skb
294 * and receive a single message to it from USB (using
295 * i2400mu_rx()). Once received, it is passed to the generic i2400m RX
296 * code for processing.
297 *
298 * When done processing, it runs some dirty statistics to verify if
299 * the last 100 messages received were smaller than half of the
300 * current RX buffer size. In that case, the RX buffer size is
301 * halved. This will helps lowering the pressure on the memory
302 * allocator.
303 *
304 * Hard errors force the thread to exit.
305 */
306static
307int i2400mu_rxd(void *_i2400mu)
308{
309 int result = 0;
310 struct i2400mu *i2400mu = _i2400mu;
311 struct i2400m *i2400m = &i2400mu->i2400m;
312 struct device *dev = &i2400mu->usb_iface->dev;
313 struct net_device *net_dev = i2400m->wimax_dev.net_dev;
314 size_t pending;
315 int rx_size;
316 struct sk_buff *rx_skb;
317
318 d_fnstart(4, dev, "(i2400mu %p)\n", i2400mu);
319 while (1) {
320 d_printf(2, dev, "TX: waiting for messages\n");
321 pending = 0;
322 wait_event_interruptible(
323 i2400mu->rx_wq,
324 (kthread_should_stop() /* check this first! */
325 || (pending = atomic_read(&i2400mu->rx_pending_count)))
326 );
327 if (kthread_should_stop())
328 break;
329 if (pending == 0)
330 continue;
331 rx_size = i2400mu->rx_size;
332 d_printf(2, dev, "RX: reading up to %d bytes\n", rx_size);
333 rx_skb = __netdev_alloc_skb(net_dev, rx_size, GFP_KERNEL);
334 if (rx_skb == NULL) {
335 dev_err(dev, "RX: can't allocate skb [%d bytes]\n",
336 rx_size);
337 msleep(50); /* give it some time? */
338 continue;
339 }
340
341 /* Receive the message with the payloads */
342 rx_skb = i2400mu_rx(i2400mu, rx_skb);
343 result = PTR_ERR(rx_skb);
344 if (IS_ERR(rx_skb))
345 goto out;
346 atomic_dec(&i2400mu->rx_pending_count);
347 if (rx_skb->len == 0) { /* some ignorable condition */
348 kfree_skb(rx_skb);
349 continue;
350 }
351
352 /* Deliver the message to the generic i2400m code */
353 i2400mu->rx_size_cnt++;
354 i2400mu->rx_size_acc += rx_skb->len;
355 result = i2400m_rx(i2400m, rx_skb);
356 if (result == -EIO
357 && edc_inc(&i2400mu->urb_edc,
358 EDC_MAX_ERRORS, EDC_ERROR_TIMEFRAME)) {
359 goto error_reset;
360 }
361
362 /* Maybe adjust RX buffer size */
363 i2400mu_rx_size_maybe_shrink(i2400mu);
364 }
365 result = 0;
366out:
367 d_fnend(4, dev, "(i2400mu %p) = %d\n", i2400mu, result);
368 return result;
369
370error_reset:
371 dev_err(dev, "RX: maximum errors in received buffer exceeded; "
372 "resetting device\n");
373 usb_queue_reset_device(i2400mu->usb_iface);
374 goto out;
375}
376
377
378/*
379 * Start reading from the device
380 *
381 * @i2400m: device instance
382 *
383 * Notify the RX thread that there is data pending.
384 */
385void i2400mu_rx_kick(struct i2400mu *i2400mu)
386{
387 struct i2400m *i2400m = &i2400mu->i2400m;
388 struct device *dev = &i2400mu->usb_iface->dev;
389
390 d_fnstart(3, dev, "(i2400mu %p)\n", i2400m);
391 atomic_inc(&i2400mu->rx_pending_count);
392 wake_up_all(&i2400mu->rx_wq);
393 d_fnend(3, dev, "(i2400m %p) = void\n", i2400m);
394}
395
396
397int i2400mu_rx_setup(struct i2400mu *i2400mu)
398{
399 int result = 0;
400 struct i2400m *i2400m = &i2400mu->i2400m;
401 struct device *dev = &i2400mu->usb_iface->dev;
402 struct wimax_dev *wimax_dev = &i2400m->wimax_dev;
403
404 i2400mu->rx_kthread = kthread_run(i2400mu_rxd, i2400mu, "%s-rx",
405 wimax_dev->name);
406 if (IS_ERR(i2400mu->rx_kthread)) {
407 result = PTR_ERR(i2400mu->rx_kthread);
408 dev_err(dev, "RX: cannot start thread: %d\n", result);
409 }
410 return result;
411}
412
413void i2400mu_rx_release(struct i2400mu *i2400mu)
414{
415 kthread_stop(i2400mu->rx_kthread);
416}
417
diff --git a/drivers/net/wimax/i2400m/usb-tx.c b/drivers/net/wimax/i2400m/usb-tx.c
new file mode 100644
index 000000000000..dfd893356f49
--- /dev/null
+++ b/drivers/net/wimax/i2400m/usb-tx.c
@@ -0,0 +1,229 @@
1/*
2 * Intel Wireless WiMAX Connection 2400m
3 * USB specific TX handling
4 *
5 *
6 * Copyright (C) 2007-2008 Intel Corporation. All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 *
12 * * Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * * Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in
16 * the documentation and/or other materials provided with the
17 * distribution.
18 * * Neither the name of Intel Corporation nor the names of its
19 * contributors may be used to endorse or promote products derived
20 * from this software without specific prior written permission.
21 *
22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 *
34 *
35 * Intel Corporation <linux-wimax@intel.com>
36 * Yanir Lubetkin <yanirx.lubetkin@intel.com>
37 * - Initial implementation
38 * Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
39 * - Split transport/device specific
40 *
41 *
42 * Takes the TX messages in the i2400m's driver TX FIFO and sends them
43 * to the device until there are no more.
44 *
45 * If we fail sending the message, we just drop it. There isn't much
46 * we can do at this point. We could also retry, but the USB stack has
47 * already retried and still failed, so there is not much of a
48 * point. As well, most of the traffic is network, which has recovery
49 * methods for dropped packets.
50 *
51 * For sending we just obtain a FIFO buffer to send, send it to the
52 * USB bulk out, tell the TX FIFO code we have sent it; query for
53 * another one, etc... until done.
54 *
55 * We use a thread so we can call usb_autopm_enable() and
56 * usb_autopm_disable() for each transaction; this way when the device
57 * goes idle, it will suspend. It also has less overhead than a
58 * dedicated workqueue, as it is being used for a single task.
59 *
60 * ROADMAP
61 *
62 * i2400mu_tx_setup()
63 * i2400mu_tx_release()
64 *
65 * i2400mu_bus_tx_kick() - Called by the tx.c code when there
66 * is new data in the FIFO.
67 * i2400mu_txd()
68 * i2400m_tx_msg_get()
69 * i2400m_tx_msg_sent()
70 */
71#include "i2400m-usb.h"
72
73
74#define D_SUBMODULE tx
75#include "usb-debug-levels.h"
76
77
78/*
79 * Get the next TX message in the TX FIFO and send it to the device
80 *
81 * Note that any iteration consumes a message to be sent, no matter if
82 * it succeeds or fails (we have no real way to retry or complain).
83 *
84 * Return: 0 if ok, < 0 errno code on hard error.
85 */
86static
87int i2400mu_tx(struct i2400mu *i2400mu, struct i2400m_msg_hdr *tx_msg,
88 size_t tx_msg_size)
89{
90 int result = 0;
91 struct i2400m *i2400m = &i2400mu->i2400m;
92 struct device *dev = &i2400mu->usb_iface->dev;
93 int usb_pipe, sent_size, do_autopm;
94 struct usb_endpoint_descriptor *epd;
95
96 d_fnstart(4, dev, "(i2400mu %p)\n", i2400mu);
97 do_autopm = atomic_read(&i2400mu->do_autopm);
98 result = do_autopm ?
99 usb_autopm_get_interface(i2400mu->usb_iface) : 0;
100 if (result < 0) {
101 dev_err(dev, "TX: can't get autopm: %d\n", result);
102 do_autopm = 0;
103 }
104 epd = usb_get_epd(i2400mu->usb_iface, I2400MU_EP_BULK_OUT);
105 usb_pipe = usb_sndbulkpipe(i2400mu->usb_dev, epd->bEndpointAddress);
106retry:
107 result = usb_bulk_msg(i2400mu->usb_dev, usb_pipe,
108 tx_msg, tx_msg_size, &sent_size, HZ);
109 usb_mark_last_busy(i2400mu->usb_dev);
110 switch (result) {
111 case 0:
112 if (sent_size != tx_msg_size) { /* Too short? drop it */
113 dev_err(dev, "TX: short write (%d B vs %zu "
114 "expected)\n", sent_size, tx_msg_size);
115 result = -EIO;
116 }
117 break;
118 case -EINVAL: /* while removing driver */
119 case -ENODEV: /* dev disconnect ... */
120 case -ENOENT: /* just ignore it */
121 case -ESHUTDOWN: /* and exit */
122 case -ECONNRESET:
123 result = -ESHUTDOWN;
124 break;
125 default: /* Some error? */
126 if (edc_inc(&i2400mu->urb_edc,
127 EDC_MAX_ERRORS, EDC_ERROR_TIMEFRAME)) {
128 dev_err(dev, "TX: maximum errors in URB "
129 "exceeded; resetting device\n");
130 usb_queue_reset_device(i2400mu->usb_iface);
131 } else {
132 dev_err(dev, "TX: cannot send URB; retrying. "
133 "tx_msg @%zu %zu B [%d sent]: %d\n",
134 (void *) tx_msg - i2400m->tx_buf,
135 tx_msg_size, sent_size, result);
136 goto retry;
137 }
138 }
139 if (do_autopm)
140 usb_autopm_put_interface(i2400mu->usb_iface);
141 d_fnend(4, dev, "(i2400mu %p) = result\n", i2400mu);
142 return result;
143}
144
145
146/*
147 * Get the next TX message in the TX FIFO and send it to the device
148 *
149 * Note we exit the loop if i2400mu_tx() fails; that funtion only
150 * fails on hard error (failing to tx a buffer not being one of them,
151 * see its doc).
152 *
153 * Return: 0
154 */
155static
156int i2400mu_txd(void *_i2400mu)
157{
158 int result = 0;
159 struct i2400mu *i2400mu = _i2400mu;
160 struct i2400m *i2400m = &i2400mu->i2400m;
161 struct device *dev = &i2400mu->usb_iface->dev;
162 struct i2400m_msg_hdr *tx_msg;
163 size_t tx_msg_size;
164
165 d_fnstart(4, dev, "(i2400mu %p)\n", i2400mu);
166
167 while (1) {
168 d_printf(2, dev, "TX: waiting for messages\n");
169 tx_msg = NULL;
170 wait_event_interruptible(
171 i2400mu->tx_wq,
172 (kthread_should_stop() /* check this first! */
173 || (tx_msg = i2400m_tx_msg_get(i2400m, &tx_msg_size)))
174 );
175 if (kthread_should_stop())
176 break;
177 WARN_ON(tx_msg == NULL); /* should not happen...*/
178 d_printf(2, dev, "TX: submitting %zu bytes\n", tx_msg_size);
179 d_dump(5, dev, tx_msg, tx_msg_size);
180 /* Yeah, we ignore errors ... not much we can do */
181 i2400mu_tx(i2400mu, tx_msg, tx_msg_size);
182 i2400m_tx_msg_sent(i2400m); /* ack it, advance the FIFO */
183 if (result < 0)
184 break;
185 }
186 d_fnend(4, dev, "(i2400mu %p) = %d\n", i2400mu, result);
187 return result;
188}
189
190
191/*
192 * i2400m TX engine notifies us that there is data in the FIFO ready
193 * for TX
194 *
195 * If there is a URB in flight, don't do anything; when it finishes,
196 * it will see there is data in the FIFO and send it. Else, just
197 * submit a write.
198 */
199void i2400mu_bus_tx_kick(struct i2400m *i2400m)
200{
201 struct i2400mu *i2400mu = container_of(i2400m, struct i2400mu, i2400m);
202 struct device *dev = &i2400mu->usb_iface->dev;
203
204 d_fnstart(3, dev, "(i2400m %p) = void\n", i2400m);
205 wake_up_all(&i2400mu->tx_wq);
206 d_fnend(3, dev, "(i2400m %p) = void\n", i2400m);
207}
208
209
210int i2400mu_tx_setup(struct i2400mu *i2400mu)
211{
212 int result = 0;
213 struct i2400m *i2400m = &i2400mu->i2400m;
214 struct device *dev = &i2400mu->usb_iface->dev;
215 struct wimax_dev *wimax_dev = &i2400m->wimax_dev;
216
217 i2400mu->tx_kthread = kthread_run(i2400mu_txd, i2400mu, "%s-tx",
218 wimax_dev->name);
219 if (IS_ERR(i2400mu->tx_kthread)) {
220 result = PTR_ERR(i2400mu->tx_kthread);
221 dev_err(dev, "TX: cannot start thread: %d\n", result);
222 }
223 return result;
224}
225
226void i2400mu_tx_release(struct i2400mu *i2400mu)
227{
228 kthread_stop(i2400mu->tx_kthread);
229}
diff --git a/drivers/net/wimax/i2400m/usb.c b/drivers/net/wimax/i2400m/usb.c
new file mode 100644
index 000000000000..6d4b65fd9c17
--- /dev/null
+++ b/drivers/net/wimax/i2400m/usb.c
@@ -0,0 +1,591 @@
1/*
2 * Intel Wireless WiMAX Connection 2400m
3 * Linux driver model glue for USB device, reset & fw upload
4 *
5 *
6 * Copyright (C) 2007-2008 Intel Corporation <linux-wimax@intel.com>
7 * Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
8 * Yanir Lubetkin <yanirx.lubetkin@intel.com>
9 *
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License version
12 * 2 as published by the Free Software Foundation.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
22 * 02110-1301, USA.
23 *
24 *
25 * See i2400m-usb.h for a general description of this driver.
26 *
27 * This file implements driver model glue, and hook ups for the
28 * generic driver to implement the bus-specific functions (device
29 * communication setup/tear down, firmware upload and resetting).
30 *
31 * ROADMAP
32 *
33 * i2400mu_probe()
34 * alloc_netdev()...
35 * i2400mu_netdev_setup()
36 * i2400mu_init()
37 * i2400m_netdev_setup()
38 * i2400m_setup()...
39 *
40 * i2400mu_disconnect
41 * i2400m_release()
42 * free_netdev()
43 *
44 * i2400mu_suspend()
45 * i2400m_cmd_enter_powersave()
46 * i2400mu_notification_release()
47 *
48 * i2400mu_resume()
49 * i2400mu_notification_setup()
50 *
51 * i2400mu_bus_dev_start() Called by i2400m_dev_start() [who is
52 * i2400mu_tx_setup() called by i2400m_setup()]
53 * i2400mu_rx_setup()
54 * i2400mu_notification_setup()
55 *
56 * i2400mu_bus_dev_stop() Called by i2400m_dev_stop() [who is
57 * i2400mu_notification_release() called by i2400m_release()]
58 * i2400mu_rx_release()
59 * i2400mu_tx_release()
60 *
61 * i2400mu_bus_reset() Called by i2400m->bus_reset
62 * __i2400mu_reset()
63 * __i2400mu_send_barker()
64 * usb_reset_device()
65 */
66#include "i2400m-usb.h"
67#include <linux/wimax/i2400m.h>
68#include <linux/debugfs.h>
69
70
71#define D_SUBMODULE usb
72#include "usb-debug-levels.h"
73
74
75/* Our firmware file name */
76#define I2400MU_FW_FILE_NAME "i2400m-fw-usb-" I2400M_FW_VERSION ".sbcf"
77
78static
79int i2400mu_bus_dev_start(struct i2400m *i2400m)
80{
81 int result;
82 struct i2400mu *i2400mu = container_of(i2400m, struct i2400mu, i2400m);
83 struct device *dev = &i2400mu->usb_iface->dev;
84
85 d_fnstart(3, dev, "(i2400m %p)\n", i2400m);
86 result = i2400mu_tx_setup(i2400mu);
87 if (result < 0)
88 goto error_usb_tx_setup;
89 result = i2400mu_rx_setup(i2400mu);
90 if (result < 0)
91 goto error_usb_rx_setup;
92 result = i2400mu_notification_setup(i2400mu);
93 if (result < 0)
94 goto error_notif_setup;
95 d_fnend(3, dev, "(i2400m %p) = %d\n", i2400m, result);
96 return result;
97
98error_notif_setup:
99 i2400mu_rx_release(i2400mu);
100error_usb_rx_setup:
101 i2400mu_tx_release(i2400mu);
102error_usb_tx_setup:
103 d_fnend(3, dev, "(i2400m %p) = void\n", i2400m);
104 return result;
105}
106
107
108static
109void i2400mu_bus_dev_stop(struct i2400m *i2400m)
110{
111 struct i2400mu *i2400mu = container_of(i2400m, struct i2400mu, i2400m);
112 struct device *dev = &i2400mu->usb_iface->dev;
113
114 d_fnstart(3, dev, "(i2400m %p)\n", i2400m);
115 i2400mu_notification_release(i2400mu);
116 i2400mu_rx_release(i2400mu);
117 i2400mu_tx_release(i2400mu);
118 d_fnend(3, dev, "(i2400m %p) = void\n", i2400m);
119}
120
121
122/*
123 * Sends a barker buffer to the device
124 *
125 * This helper will allocate a kmalloced buffer and use it to transmit
126 * (then free it). Reason for this is that other arches cannot use
127 * stack/vmalloc/text areas for DMA transfers.
128 *
129 * Error recovery here is simpler: anything is considered a hard error
130 * and will move the reset code to use a last-resort bus-based reset.
131 */
132static
133int __i2400mu_send_barker(struct i2400mu *i2400mu,
134 const __le32 *barker,
135 size_t barker_size,
136 unsigned endpoint)
137{
138 struct usb_endpoint_descriptor *epd = NULL;
139 int pipe, actual_len, ret;
140 struct device *dev = &i2400mu->usb_iface->dev;
141 void *buffer;
142 int do_autopm = 1;
143
144 ret = usb_autopm_get_interface(i2400mu->usb_iface);
145 if (ret < 0) {
146 dev_err(dev, "RESET: can't get autopm: %d\n", ret);
147 do_autopm = 0;
148 }
149 ret = -ENOMEM;
150 buffer = kmalloc(barker_size, GFP_KERNEL);
151 if (buffer == NULL)
152 goto error_kzalloc;
153 epd = usb_get_epd(i2400mu->usb_iface, endpoint);
154 pipe = usb_sndbulkpipe(i2400mu->usb_dev, epd->bEndpointAddress);
155 memcpy(buffer, barker, barker_size);
156 ret = usb_bulk_msg(i2400mu->usb_dev, pipe, buffer, barker_size,
157 &actual_len, HZ);
158 if (ret < 0) {
159 if (ret != -EINVAL)
160 dev_err(dev, "E: barker error: %d\n", ret);
161 } else if (actual_len != barker_size) {
162 dev_err(dev, "E: only %d bytes transmitted\n", actual_len);
163 ret = -EIO;
164 }
165 kfree(buffer);
166error_kzalloc:
167 if (do_autopm)
168 usb_autopm_put_interface(i2400mu->usb_iface);
169 return ret;
170}
171
172
173/*
174 * Reset a device at different levels (warm, cold or bus)
175 *
176 * @i2400m: device descriptor
177 * @reset_type: soft, warm or bus reset (I2400M_RT_WARM/SOFT/BUS)
178 *
179 * Warm and cold resets get a USB reset if they fail.
180 *
181 * Warm reset:
182 *
183 * The device will be fully reset internally, but won't be
184 * disconnected from the USB bus (so no reenumeration will
185 * happen). Firmware upload will be neccessary.
186 *
187 * The device will send a reboot barker in the notification endpoint
188 * that will trigger the driver to reinitialize the state
189 * automatically from notif.c:i2400m_notification_grok() into
190 * i2400m_dev_bootstrap_delayed().
191 *
192 * Cold and bus (USB) reset:
193 *
194 * The device will be fully reset internally, disconnected from the
195 * USB bus an a reenumeration will happen. Firmware upload will be
196 * neccessary. Thus, we don't do any locking or struct
197 * reinitialization, as we are going to be fully disconnected and
198 * reenumerated.
199 *
200 * Note we need to return -ENODEV if a warm reset was requested and we
201 * had to resort to a bus reset. See i2400m_op_reset(), wimax_reset()
202 * and wimax_dev->op_reset.
203 *
204 * WARNING: no driver state saved/fixed
205 */
206static
207int i2400mu_bus_reset(struct i2400m *i2400m, enum i2400m_reset_type rt)
208{
209 int result;
210 struct i2400mu *i2400mu =
211 container_of(i2400m, struct i2400mu, i2400m);
212 struct device *dev = i2400m_dev(i2400m);
213 static const __le32 i2400m_WARM_BOOT_BARKER[4] = {
214 __constant_cpu_to_le32(I2400M_WARM_RESET_BARKER),
215 __constant_cpu_to_le32(I2400M_WARM_RESET_BARKER),
216 __constant_cpu_to_le32(I2400M_WARM_RESET_BARKER),
217 __constant_cpu_to_le32(I2400M_WARM_RESET_BARKER),
218 };
219 static const __le32 i2400m_COLD_BOOT_BARKER[4] = {
220 __constant_cpu_to_le32(I2400M_COLD_RESET_BARKER),
221 __constant_cpu_to_le32(I2400M_COLD_RESET_BARKER),
222 __constant_cpu_to_le32(I2400M_COLD_RESET_BARKER),
223 __constant_cpu_to_le32(I2400M_COLD_RESET_BARKER),
224 };
225
226 d_fnstart(3, dev, "(i2400m %p rt %u)\n", i2400m, rt);
227 if (rt == I2400M_RT_WARM)
228 result = __i2400mu_send_barker(i2400mu, i2400m_WARM_BOOT_BARKER,
229 sizeof(i2400m_WARM_BOOT_BARKER),
230 I2400MU_EP_BULK_OUT);
231 else if (rt == I2400M_RT_COLD)
232 result = __i2400mu_send_barker(i2400mu, i2400m_COLD_BOOT_BARKER,
233 sizeof(i2400m_COLD_BOOT_BARKER),
234 I2400MU_EP_RESET_COLD);
235 else if (rt == I2400M_RT_BUS) {
236do_bus_reset:
237 result = usb_reset_device(i2400mu->usb_dev);
238 switch (result) {
239 case 0:
240 case -EINVAL: /* device is gone */
241 case -ENODEV:
242 case -ENOENT:
243 case -ESHUTDOWN:
244 result = rt == I2400M_RT_WARM ? -ENODEV : 0;
245 break; /* We assume the device is disconnected */
246 default:
247 dev_err(dev, "USB reset failed (%d), giving up!\n",
248 result);
249 }
250 } else
251 BUG();
252 if (result < 0
253 && result != -EINVAL /* device is gone */
254 && rt != I2400M_RT_BUS) {
255 dev_err(dev, "%s reset failed (%d); trying USB reset\n",
256 rt == I2400M_RT_WARM ? "warm" : "cold", result);
257 rt = I2400M_RT_BUS;
258 goto do_bus_reset;
259 }
260 d_fnend(3, dev, "(i2400m %p rt %u) = %d\n", i2400m, rt, result);
261 return result;
262}
263
264
265static
266void i2400mu_netdev_setup(struct net_device *net_dev)
267{
268 struct i2400m *i2400m = net_dev_to_i2400m(net_dev);
269 struct i2400mu *i2400mu = container_of(i2400m, struct i2400mu, i2400m);
270 i2400mu_init(i2400mu);
271 i2400m_netdev_setup(net_dev);
272}
273
274
275/*
276 * Debug levels control; see debug.h
277 */
278struct d_level D_LEVEL[] = {
279 D_SUBMODULE_DEFINE(usb),
280 D_SUBMODULE_DEFINE(fw),
281 D_SUBMODULE_DEFINE(notif),
282 D_SUBMODULE_DEFINE(rx),
283 D_SUBMODULE_DEFINE(tx),
284};
285size_t D_LEVEL_SIZE = ARRAY_SIZE(D_LEVEL);
286
287
288#define __debugfs_register(prefix, name, parent) \
289do { \
290 result = d_level_register_debugfs(prefix, name, parent); \
291 if (result < 0) \
292 goto error; \
293} while (0)
294
295
296static
297int i2400mu_debugfs_add(struct i2400mu *i2400mu)
298{
299 int result;
300 struct device *dev = &i2400mu->usb_iface->dev;
301 struct dentry *dentry = i2400mu->i2400m.wimax_dev.debugfs_dentry;
302 struct dentry *fd;
303
304 dentry = debugfs_create_dir("i2400m-usb", dentry);
305 result = PTR_ERR(dentry);
306 if (IS_ERR(dentry)) {
307 if (result == -ENODEV)
308 result = 0; /* No debugfs support */
309 goto error;
310 }
311 i2400mu->debugfs_dentry = dentry;
312 __debugfs_register("dl_", usb, dentry);
313 __debugfs_register("dl_", fw, dentry);
314 __debugfs_register("dl_", notif, dentry);
315 __debugfs_register("dl_", rx, dentry);
316 __debugfs_register("dl_", tx, dentry);
317
318 /* Don't touch these if you don't know what you are doing */
319 fd = debugfs_create_u8("rx_size_auto_shrink", 0600, dentry,
320 &i2400mu->rx_size_auto_shrink);
321 result = PTR_ERR(fd);
322 if (IS_ERR(fd) && result != -ENODEV) {
323 dev_err(dev, "Can't create debugfs entry "
324 "rx_size_auto_shrink: %d\n", result);
325 goto error;
326 }
327
328 fd = debugfs_create_size_t("rx_size", 0600, dentry,
329 &i2400mu->rx_size);
330 result = PTR_ERR(fd);
331 if (IS_ERR(fd) && result != -ENODEV) {
332 dev_err(dev, "Can't create debugfs entry "
333 "rx_size: %d\n", result);
334 goto error;
335 }
336
337 return 0;
338
339error:
340 debugfs_remove_recursive(i2400mu->debugfs_dentry);
341 return result;
342}
343
344
345/*
346 * Probe a i2400m interface and register it
347 *
348 * @iface: USB interface to link to
349 * @id: USB class/subclass/protocol id
350 * @returns: 0 if ok, < 0 errno code on error.
351 *
352 * Alloc a net device, initialize the bus-specific details and then
353 * calls the bus-generic initialization routine. That will register
354 * the wimax and netdev devices, upload the firmware [using
355 * _bus_bm_*()], call _bus_dev_start() to finalize the setup of the
356 * communication with the device and then will start to talk to it to
357 * finnish setting it up.
358 */
359static
360int i2400mu_probe(struct usb_interface *iface,
361 const struct usb_device_id *id)
362{
363 int result;
364 struct net_device *net_dev;
365 struct device *dev = &iface->dev;
366 struct i2400m *i2400m;
367 struct i2400mu *i2400mu;
368 struct usb_device *usb_dev = interface_to_usbdev(iface);
369
370 if (usb_dev->speed != USB_SPEED_HIGH)
371 dev_err(dev, "device not connected as high speed\n");
372
373 /* Allocate instance [calls i2400m_netdev_setup() on it]. */
374 result = -ENOMEM;
375 net_dev = alloc_netdev(sizeof(*i2400mu), "wmx%d",
376 i2400mu_netdev_setup);
377 if (net_dev == NULL) {
378 dev_err(dev, "no memory for network device instance\n");
379 goto error_alloc_netdev;
380 }
381 SET_NETDEV_DEV(net_dev, dev);
382 i2400m = net_dev_to_i2400m(net_dev);
383 i2400mu = container_of(i2400m, struct i2400mu, i2400m);
384 i2400m->wimax_dev.net_dev = net_dev;
385 i2400mu->usb_dev = usb_get_dev(usb_dev);
386 i2400mu->usb_iface = iface;
387 usb_set_intfdata(iface, i2400mu);
388
389 i2400m->bus_tx_block_size = I2400MU_BLK_SIZE;
390 i2400m->bus_pl_size_max = I2400MU_PL_SIZE_MAX;
391 i2400m->bus_dev_start = i2400mu_bus_dev_start;
392 i2400m->bus_dev_stop = i2400mu_bus_dev_stop;
393 i2400m->bus_tx_kick = i2400mu_bus_tx_kick;
394 i2400m->bus_reset = i2400mu_bus_reset;
395 i2400m->bus_bm_cmd_send = i2400mu_bus_bm_cmd_send;
396 i2400m->bus_bm_wait_for_ack = i2400mu_bus_bm_wait_for_ack;
397 i2400m->bus_fw_name = I2400MU_FW_FILE_NAME;
398 i2400m->bus_bm_mac_addr_impaired = 0;
399
400 iface->needs_remote_wakeup = 1; /* autosuspend (15s delay) */
401 device_init_wakeup(dev, 1);
402 usb_autopm_enable(i2400mu->usb_iface);
403 usb_dev->autosuspend_delay = 15 * HZ;
404 usb_dev->autosuspend_disabled = 0;
405
406 result = i2400m_setup(i2400m, I2400M_BRI_MAC_REINIT);
407 if (result < 0) {
408 dev_err(dev, "cannot setup device: %d\n", result);
409 goto error_setup;
410 }
411 result = i2400mu_debugfs_add(i2400mu);
412 if (result < 0) {
413 dev_err(dev, "Can't register i2400mu's debugfs: %d\n", result);
414 goto error_debugfs_add;
415 }
416 return 0;
417
418error_debugfs_add:
419 i2400m_release(i2400m);
420error_setup:
421 usb_set_intfdata(iface, NULL);
422 usb_put_dev(i2400mu->usb_dev);
423 free_netdev(net_dev);
424error_alloc_netdev:
425 return result;
426}
427
428
429/*
430 * Disconect a i2400m from the system.
431 *
432 * i2400m_stop() has been called before, so al the rx and tx contexts
433 * have been taken down already. Make sure the queue is stopped,
434 * unregister netdev and i2400m, free and kill.
435 */
436static
437void i2400mu_disconnect(struct usb_interface *iface)
438{
439 struct i2400mu *i2400mu = usb_get_intfdata(iface);
440 struct i2400m *i2400m = &i2400mu->i2400m;
441 struct net_device *net_dev = i2400m->wimax_dev.net_dev;
442 struct device *dev = &iface->dev;
443
444 d_fnstart(3, dev, "(iface %p i2400m %p)\n", iface, i2400m);
445
446 debugfs_remove_recursive(i2400mu->debugfs_dentry);
447 i2400m_release(i2400m);
448 usb_set_intfdata(iface, NULL);
449 usb_put_dev(i2400mu->usb_dev);
450 free_netdev(net_dev);
451 d_fnend(3, dev, "(iface %p i2400m %p) = void\n", iface, i2400m);
452}
453
454
455/*
456 * Get the device ready for USB port or system standby and hibernation
457 *
458 * USB port and system standby are handled the same.
459 *
460 * When the system hibernates, the USB device is powered down and then
461 * up, so we don't really have to do much here, as it will be seen as
462 * a reconnect. Still for simplicity we consider this case the same as
463 * suspend, so that the device has a chance to do notify the base
464 * station (if connected).
465 *
466 * So at the end, the three cases require common handling.
467 *
468 * If at the time of this call the device's firmware is not loaded,
469 * nothing has to be done.
470 *
471 * If the firmware is loaded, we need to:
472 *
473 * - tell the device to go into host interface power save mode, wait
474 * for it to ack
475 *
476 * This is quite more interesting than it is; we need to execute a
477 * command, but this time, we don't want the code in usb-{tx,rx}.c
478 * to call the usb_autopm_get/put_interface() barriers as it'd
479 * deadlock, so we need to decrement i2400mu->do_autopm, that acts
480 * as a poor man's semaphore. Ugly, but it works.
481 *
482 * As well, the device might refuse going to sleep for whichever
483 * reason. In this case we just fail. For system suspend/hibernate,
484 * we *can't* fail. We look at usb_dev->auto_pm to see if the
485 * suspend call comes from the USB stack or from the system and act
486 * in consequence.
487 *
488 * - stop the notification endpoint polling
489 */
490static
491int i2400mu_suspend(struct usb_interface *iface, pm_message_t pm_msg)
492{
493 int result = 0;
494 struct device *dev = &iface->dev;
495 struct i2400mu *i2400mu = usb_get_intfdata(iface);
496 struct usb_device *usb_dev = i2400mu->usb_dev;
497 struct i2400m *i2400m = &i2400mu->i2400m;
498
499 d_fnstart(3, dev, "(iface %p pm_msg %u)\n", iface, pm_msg.event);
500 if (i2400m->updown == 0)
501 goto no_firmware;
502 d_printf(1, dev, "fw up, requesting standby\n");
503 atomic_dec(&i2400mu->do_autopm);
504 result = i2400m_cmd_enter_powersave(i2400m);
505 atomic_inc(&i2400mu->do_autopm);
506 if (result < 0 && usb_dev->auto_pm == 0) {
507 /* System suspend, can't fail */
508 dev_err(dev, "failed to suspend, will reset on resume\n");
509 result = 0;
510 }
511 if (result < 0)
512 goto error_enter_powersave;
513 i2400mu_notification_release(i2400mu);
514 d_printf(1, dev, "fw up, got standby\n");
515error_enter_powersave:
516no_firmware:
517 d_fnend(3, dev, "(iface %p pm_msg %u) = %d\n",
518 iface, pm_msg.event, result);
519 return result;
520}
521
522
523static
524int i2400mu_resume(struct usb_interface *iface)
525{
526 int ret = 0;
527 struct device *dev = &iface->dev;
528 struct i2400mu *i2400mu = usb_get_intfdata(iface);
529 struct i2400m *i2400m = &i2400mu->i2400m;
530
531 d_fnstart(3, dev, "(iface %p)\n", iface);
532 if (i2400m->updown == 0) {
533 d_printf(1, dev, "fw was down, no resume neeed\n");
534 goto out;
535 }
536 d_printf(1, dev, "fw was up, resuming\n");
537 i2400mu_notification_setup(i2400mu);
538 /* USB has flow control, so we don't need to give it time to
539 * come back; otherwise, we'd use something like a get-state
540 * command... */
541out:
542 d_fnend(3, dev, "(iface %p) = %d\n", iface, ret);
543 return ret;
544}
545
546
547static
548struct usb_device_id i2400mu_id_table[] = {
549 { USB_DEVICE(0x8086, 0x0181) },
550 { USB_DEVICE(0x8086, 0x1403) },
551 { USB_DEVICE(0x8086, 0x1405) },
552 { USB_DEVICE(0x8086, 0x0180) },
553 { USB_DEVICE(0x8086, 0x0182) },
554 { USB_DEVICE(0x8086, 0x1406) },
555 { USB_DEVICE(0x8086, 0x1403) },
556 { },
557};
558MODULE_DEVICE_TABLE(usb, i2400mu_id_table);
559
560
561static
562struct usb_driver i2400mu_driver = {
563 .name = KBUILD_MODNAME,
564 .suspend = i2400mu_suspend,
565 .resume = i2400mu_resume,
566 .probe = i2400mu_probe,
567 .disconnect = i2400mu_disconnect,
568 .id_table = i2400mu_id_table,
569 .supports_autosuspend = 1,
570};
571
572static
573int __init i2400mu_driver_init(void)
574{
575 return usb_register(&i2400mu_driver);
576}
577module_init(i2400mu_driver_init);
578
579
580static
581void __exit i2400mu_driver_exit(void)
582{
583 flush_scheduled_work(); /* for the stuff we schedule from sysfs.c */
584 usb_deregister(&i2400mu_driver);
585}
586module_exit(i2400mu_driver_exit);
587
588MODULE_AUTHOR("Intel Corporation <linux-wimax@intel.com>");
589MODULE_DESCRIPTION("Intel 2400M WiMAX networking for USB");
590MODULE_LICENSE("GPL");
591MODULE_FIRMWARE(I2400MU_FW_FILE_NAME);
diff --git a/drivers/net/wireless/atmel.c b/drivers/net/wireless/atmel.c
index 350157fcd080..4223672c4432 100644
--- a/drivers/net/wireless/atmel.c
+++ b/drivers/net/wireless/atmel.c
@@ -3836,7 +3836,7 @@ static int reset_atmel_card(struct net_device *dev)
3836 This routine is also responsible for initialising some 3836 This routine is also responsible for initialising some
3837 hardware-specific fields in the atmel_private structure, 3837 hardware-specific fields in the atmel_private structure,
3838 including a copy of the firmware's hostinfo stucture 3838 including a copy of the firmware's hostinfo stucture
3839 which is the route into the rest of the firmare datastructures. */ 3839 which is the route into the rest of the firmware datastructures. */
3840 3840
3841 struct atmel_private *priv = netdev_priv(dev); 3841 struct atmel_private *priv = netdev_priv(dev);
3842 u8 configuration; 3842 u8 configuration;
diff --git a/drivers/net/wireless/ipw2x00/ipw2100.c b/drivers/net/wireless/ipw2x00/ipw2100.c
index 1667065b86a7..823c2bf5e31e 100644
--- a/drivers/net/wireless/ipw2x00/ipw2100.c
+++ b/drivers/net/wireless/ipw2x00/ipw2100.c
@@ -1332,7 +1332,7 @@ static int ipw2100_power_cycle_adapter(struct ipw2100_priv *priv)
1332 IPW_AUX_HOST_RESET_REG_STOP_MASTER); 1332 IPW_AUX_HOST_RESET_REG_STOP_MASTER);
1333 1333
1334 /* Step 2. Wait for stop Master Assert 1334 /* Step 2. Wait for stop Master Assert
1335 * (not more then 50us, otherwise ret error */ 1335 * (not more than 50us, otherwise ret error */
1336 i = 5; 1336 i = 5;
1337 do { 1337 do {
1338 udelay(IPW_WAIT_RESET_MASTER_ASSERT_COMPLETE_DELAY); 1338 udelay(IPW_WAIT_RESET_MASTER_ASSERT_COMPLETE_DELAY);
@@ -1830,7 +1830,7 @@ static void ipw2100_down(struct ipw2100_priv *priv)
1830 cancel_delayed_work(&priv->rf_kill); 1830 cancel_delayed_work(&priv->rf_kill);
1831 } 1831 }
1832 1832
1833 /* Kill the firmare hang check timer */ 1833 /* Kill the firmware hang check timer */
1834 if (!priv->stop_hang_check) { 1834 if (!priv->stop_hang_check) {
1835 priv->stop_hang_check = 1; 1835 priv->stop_hang_check = 1;
1836 cancel_delayed_work(&priv->hang_check); 1836 cancel_delayed_work(&priv->hang_check);
diff --git a/drivers/net/wireless/rt2x00/rt2x00crypto.c b/drivers/net/wireless/rt2x00/rt2x00crypto.c
index 37ad0d2fb64c..aee9cba13eb3 100644
--- a/drivers/net/wireless/rt2x00/rt2x00crypto.c
+++ b/drivers/net/wireless/rt2x00/rt2x00crypto.c
@@ -184,8 +184,8 @@ void rt2x00crypto_rx_insert_iv(struct sk_buff *skb, unsigned int align,
184 * Make room for new data, note that we increase both 184 * Make room for new data, note that we increase both
185 * headsize and tailsize when required. The tailsize is 185 * headsize and tailsize when required. The tailsize is
186 * only needed when ICV data needs to be inserted and 186 * only needed when ICV data needs to be inserted and
187 * the padding is smaller then the ICV data. 187 * the padding is smaller than the ICV data.
188 * When alignment requirements is greater then the 188 * When alignment requirements is greater than the
189 * ICV data we must trim the skb to the correct size 189 * ICV data we must trim the skb to the correct size
190 * because we need to remove the extra bytes. 190 * because we need to remove the extra bytes.
191 */ 191 */
diff --git a/drivers/net/wireless/strip.c b/drivers/net/wireless/strip.c
index dd0de3a9ed4e..7015f2480550 100644
--- a/drivers/net/wireless/strip.c
+++ b/drivers/net/wireless/strip.c
@@ -236,7 +236,7 @@ struct strip {
236 unsigned long tx_errors; /* Planned stuff */ 236 unsigned long tx_errors; /* Planned stuff */
237 unsigned long rx_dropped; /* No memory for skb */ 237 unsigned long rx_dropped; /* No memory for skb */
238 unsigned long tx_dropped; /* When MTU change */ 238 unsigned long tx_dropped; /* When MTU change */
239 unsigned long rx_over_errors; /* Frame bigger then STRIP buf. */ 239 unsigned long rx_over_errors; /* Frame bigger than STRIP buf. */
240 240
241 unsigned long pps_timer; /* Timer to determine pps */ 241 unsigned long pps_timer; /* Timer to determine pps */
242 unsigned long rx_pps_count; /* Counter to determine pps */ 242 unsigned long rx_pps_count; /* Counter to determine pps */
diff --git a/drivers/rtc/rtc-ds1511.c b/drivers/rtc/rtc-ds1511.c
index 23a07fe15a2c..0b6b7730c716 100644
--- a/drivers/rtc/rtc-ds1511.c
+++ b/drivers/rtc/rtc-ds1511.c
@@ -630,7 +630,7 @@ ds1511_rtc_init(void)
630 static void __exit 630 static void __exit
631ds1511_rtc_exit(void) 631ds1511_rtc_exit(void)
632{ 632{
633 return platform_driver_unregister(&ds1511_rtc_driver); 633 platform_driver_unregister(&ds1511_rtc_driver);
634} 634}
635 635
636module_init(ds1511_rtc_init); 636module_init(ds1511_rtc_init);
diff --git a/drivers/rtc/rtc-stk17ta8.c b/drivers/rtc/rtc-stk17ta8.c
index dc0b6224ad9b..7d1547b0070e 100644
--- a/drivers/rtc/rtc-stk17ta8.c
+++ b/drivers/rtc/rtc-stk17ta8.c
@@ -399,7 +399,7 @@ static __init int stk17ta8_init(void)
399 399
400static __exit void stk17ta8_exit(void) 400static __exit void stk17ta8_exit(void)
401{ 401{
402 return platform_driver_unregister(&stk17ta8_rtc_driver); 402 platform_driver_unregister(&stk17ta8_rtc_driver);
403} 403}
404 404
405module_init(stk17ta8_init); 405module_init(stk17ta8_init);
diff --git a/drivers/s390/block/dasd_eer.c b/drivers/s390/block/dasd_eer.c
index 892e2878d61b..f8e05ce98621 100644
--- a/drivers/s390/block/dasd_eer.c
+++ b/drivers/s390/block/dasd_eer.c
@@ -535,8 +535,8 @@ static int dasd_eer_open(struct inode *inp, struct file *filp)
535 eerb->buffer_page_count > INT_MAX / PAGE_SIZE) { 535 eerb->buffer_page_count > INT_MAX / PAGE_SIZE) {
536 kfree(eerb); 536 kfree(eerb);
537 MESSAGE(KERN_WARNING, "can't open device since module " 537 MESSAGE(KERN_WARNING, "can't open device since module "
538 "parameter eer_pages is smaller then 1 or" 538 "parameter eer_pages is smaller than 1 or"
539 " bigger then %d", (int)(INT_MAX / PAGE_SIZE)); 539 " bigger than %d", (int)(INT_MAX / PAGE_SIZE));
540 unlock_kernel(); 540 unlock_kernel();
541 return -EINVAL; 541 return -EINVAL;
542 } 542 }
diff --git a/drivers/s390/char/vmlogrdr.c b/drivers/s390/char/vmlogrdr.c
index aabbeb909cc6..d8a2289fcb69 100644
--- a/drivers/s390/char/vmlogrdr.c
+++ b/drivers/s390/char/vmlogrdr.c
@@ -427,7 +427,7 @@ static int vmlogrdr_receive_data(struct vmlogrdr_priv_t *priv)
427 buffer = priv->buffer + sizeof(int); 427 buffer = priv->buffer + sizeof(int);
428 } 428 }
429 /* 429 /*
430 * If the record is bigger then our buffer, we receive only 430 * If the record is bigger than our buffer, we receive only
431 * a part of it. We can get the rest later. 431 * a part of it. We can get the rest later.
432 */ 432 */
433 if (iucv_data_count > NET_BUFFER_SIZE) 433 if (iucv_data_count > NET_BUFFER_SIZE)
@@ -437,7 +437,7 @@ static int vmlogrdr_receive_data(struct vmlogrdr_priv_t *priv)
437 0, buffer, iucv_data_count, 437 0, buffer, iucv_data_count,
438 &priv->residual_length); 438 &priv->residual_length);
439 spin_unlock_bh(&priv->priv_lock); 439 spin_unlock_bh(&priv->priv_lock);
440 /* An rc of 5 indicates that the record was bigger then 440 /* An rc of 5 indicates that the record was bigger than
441 * the buffer, which is OK for us. A 9 indicates that the 441 * the buffer, which is OK for us. A 9 indicates that the
442 * record was purged befor we could receive it. 442 * record was purged befor we could receive it.
443 */ 443 */
diff --git a/drivers/scsi/a100u2w.c b/drivers/scsi/a100u2w.c
index 3c298c7253ee..964769f66eac 100644
--- a/drivers/scsi/a100u2w.c
+++ b/drivers/scsi/a100u2w.c
@@ -633,7 +633,7 @@ static int orc_device_reset(struct orc_host * host, struct scsi_cmnd *cmd, unsig
633 return FAILED; 633 return FAILED;
634 } 634 }
635 635
636 /* Reset device is handled by the firmare, we fill in an SCB and 636 /* Reset device is handled by the firmware, we fill in an SCB and
637 fire it at the controller, it does the rest */ 637 fire it at the controller, it does the rest */
638 scb->opcode = ORC_BUSDEVRST; 638 scb->opcode = ORC_BUSDEVRST;
639 scb->target = target; 639 scb->target = target;
diff --git a/drivers/scsi/lpfc/lpfc_hbadisc.c b/drivers/scsi/lpfc/lpfc_hbadisc.c
index 8c64494444bf..311ed6dea726 100644
--- a/drivers/scsi/lpfc/lpfc_hbadisc.c
+++ b/drivers/scsi/lpfc/lpfc_hbadisc.c
@@ -1964,10 +1964,10 @@ lpfc_set_disctmo(struct lpfc_vport *vport)
1964 uint32_t tmo; 1964 uint32_t tmo;
1965 1965
1966 if (vport->port_state == LPFC_LOCAL_CFG_LINK) { 1966 if (vport->port_state == LPFC_LOCAL_CFG_LINK) {
1967 /* For FAN, timeout should be greater then edtov */ 1967 /* For FAN, timeout should be greater than edtov */
1968 tmo = (((phba->fc_edtov + 999) / 1000) + 1); 1968 tmo = (((phba->fc_edtov + 999) / 1000) + 1);
1969 } else { 1969 } else {
1970 /* Normal discovery timeout should be > then ELS/CT timeout 1970 /* Normal discovery timeout should be > than ELS/CT timeout
1971 * FC spec states we need 3 * ratov for CT requests 1971 * FC spec states we need 3 * ratov for CT requests
1972 */ 1972 */
1973 tmo = ((phba->fc_ratov * 3) + 3); 1973 tmo = ((phba->fc_ratov * 3) + 3);
diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c
index 01dfdc8696f8..a36a120561e2 100644
--- a/drivers/scsi/lpfc/lpfc_sli.c
+++ b/drivers/scsi/lpfc/lpfc_sli.c
@@ -420,7 +420,7 @@ lpfc_sli_next_iocb_slot (struct lpfc_hba *phba, struct lpfc_sli_ring *pring)
420 if (unlikely(pring->local_getidx >= max_cmd_idx)) { 420 if (unlikely(pring->local_getidx >= max_cmd_idx)) {
421 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, 421 lpfc_printf_log(phba, KERN_ERR, LOG_SLI,
422 "0315 Ring %d issue: portCmdGet %d " 422 "0315 Ring %d issue: portCmdGet %d "
423 "is bigger then cmd ring %d\n", 423 "is bigger than cmd ring %d\n",
424 pring->ringno, 424 pring->ringno,
425 pring->local_getidx, max_cmd_idx); 425 pring->local_getidx, max_cmd_idx);
426 426
@@ -1628,12 +1628,12 @@ lpfc_sli_rsp_pointers_error(struct lpfc_hba *phba, struct lpfc_sli_ring *pring)
1628{ 1628{
1629 struct lpfc_pgp *pgp = &phba->port_gp[pring->ringno]; 1629 struct lpfc_pgp *pgp = &phba->port_gp[pring->ringno];
1630 /* 1630 /*
1631 * Ring <ringno> handler: portRspPut <portRspPut> is bigger then 1631 * Ring <ringno> handler: portRspPut <portRspPut> is bigger than
1632 * rsp ring <portRspMax> 1632 * rsp ring <portRspMax>
1633 */ 1633 */
1634 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, 1634 lpfc_printf_log(phba, KERN_ERR, LOG_SLI,
1635 "0312 Ring %d handler: portRspPut %d " 1635 "0312 Ring %d handler: portRspPut %d "
1636 "is bigger then rsp ring %d\n", 1636 "is bigger than rsp ring %d\n",
1637 pring->ringno, le32_to_cpu(pgp->rspPutInx), 1637 pring->ringno, le32_to_cpu(pgp->rspPutInx),
1638 pring->numRiocb); 1638 pring->numRiocb);
1639 1639
@@ -2083,12 +2083,12 @@ lpfc_sli_handle_slow_ring_event(struct lpfc_hba *phba,
2083 portRspPut = le32_to_cpu(pgp->rspPutInx); 2083 portRspPut = le32_to_cpu(pgp->rspPutInx);
2084 if (portRspPut >= portRspMax) { 2084 if (portRspPut >= portRspMax) {
2085 /* 2085 /*
2086 * Ring <ringno> handler: portRspPut <portRspPut> is bigger then 2086 * Ring <ringno> handler: portRspPut <portRspPut> is bigger than
2087 * rsp ring <portRspMax> 2087 * rsp ring <portRspMax>
2088 */ 2088 */
2089 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, 2089 lpfc_printf_log(phba, KERN_ERR, LOG_SLI,
2090 "0303 Ring %d handler: portRspPut %d " 2090 "0303 Ring %d handler: portRspPut %d "
2091 "is bigger then rsp ring %d\n", 2091 "is bigger than rsp ring %d\n",
2092 pring->ringno, portRspPut, portRspMax); 2092 pring->ringno, portRspPut, portRspMax);
2093 2093
2094 phba->link_state = LPFC_HBA_ERROR; 2094 phba->link_state = LPFC_HBA_ERROR;
diff --git a/drivers/scsi/megaraid.c b/drivers/scsi/megaraid.c
index 7dc62deb4087..9fdcd60c5493 100644
--- a/drivers/scsi/megaraid.c
+++ b/drivers/scsi/megaraid.c
@@ -1967,8 +1967,8 @@ megaraid_abort_and_reset(adapter_t *adapter, Scsi_Cmnd *cmd, int aor)
1967 scb->state |= aor; 1967 scb->state |= aor;
1968 1968
1969 /* 1969 /*
1970 * Check if this command has firmare owenership. If 1970 * Check if this command has firmware ownership. If
1971 * yes, we cannot reset this command. Whenever, f/w 1971 * yes, we cannot reset this command. Whenever f/w
1972 * completes this command, we will return appropriate 1972 * completes this command, we will return appropriate
1973 * status from ISR. 1973 * status from ISR.
1974 */ 1974 */
diff --git a/drivers/scsi/qla1280.c b/drivers/scsi/qla1280.c
index 8cb9240596ab..df09820e8916 100644
--- a/drivers/scsi/qla1280.c
+++ b/drivers/scsi/qla1280.c
@@ -128,7 +128,7 @@
128 - Integrate ql12160_set_target_parameters() with 1280 version 128 - Integrate ql12160_set_target_parameters() with 1280 version
129 - Make qla1280_setup() non static 129 - Make qla1280_setup() non static
130 - Do not call qla1280_check_for_dead_scsi_bus() on every I/O request 130 - Do not call qla1280_check_for_dead_scsi_bus() on every I/O request
131 sent to the card - this command pauses the firmare!!! 131 sent to the card - this command pauses the firmware!!!
132 Rev 3.23.15 Beta March 19, 2002, Jes Sorensen 132 Rev 3.23.15 Beta March 19, 2002, Jes Sorensen
133 - Clean up qla1280.h - remove obsolete QL_DEBUG_LEVEL_x definitions 133 - Clean up qla1280.h - remove obsolete QL_DEBUG_LEVEL_x definitions
134 - Remove a pile of pointless and confusing (srb_t **) and 134 - Remove a pile of pointless and confusing (srb_t **) and
@@ -659,7 +659,7 @@ static int qla1280_read_nvram(struct scsi_qla_host *ha)
659 /* The firmware interface is, um, interesting, in that the 659 /* The firmware interface is, um, interesting, in that the
660 * actual firmware image on the chip is little endian, thus, 660 * actual firmware image on the chip is little endian, thus,
661 * the process of taking that image to the CPU would end up 661 * the process of taking that image to the CPU would end up
662 * little endian. However, the firmare interface requires it 662 * little endian. However, the firmware interface requires it
663 * to be read a word (two bytes) at a time. 663 * to be read a word (two bytes) at a time.
664 * 664 *
665 * The net result of this would be that the word (and 665 * The net result of this would be that the word (and
diff --git a/drivers/scsi/qla4xxx/ql4_mbx.c b/drivers/scsi/qla4xxx/ql4_mbx.c
index c577d79bd7e8..051b0f5e8c8e 100644
--- a/drivers/scsi/qla4xxx/ql4_mbx.c
+++ b/drivers/scsi/qla4xxx/ql4_mbx.c
@@ -392,7 +392,7 @@ int qla4xxx_get_firmware_status(struct scsi_qla_host * ha)
392 ha->iocb_hiwat -= IOCB_HIWAT_CUSHION; 392 ha->iocb_hiwat -= IOCB_HIWAT_CUSHION;
393 else 393 else
394 dev_info(&ha->pdev->dev, "WARNING!!! You have less than %d " 394 dev_info(&ha->pdev->dev, "WARNING!!! You have less than %d "
395 "firmare IOCBs available (%d).\n", 395 "firmware IOCBs available (%d).\n",
396 IOCB_HIWAT_CUSHION, ha->iocb_hiwat); 396 IOCB_HIWAT_CUSHION, ha->iocb_hiwat);
397 397
398 return QLA_SUCCESS; 398 return QLA_SUCCESS;
diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
index 381838ebd460..d86ebea9350a 100644
--- a/drivers/scsi/scsi_error.c
+++ b/drivers/scsi/scsi_error.c
@@ -1650,7 +1650,7 @@ int scsi_error_handler(void *data)
1650 * We use TASK_INTERRUPTIBLE so that the thread is not 1650 * We use TASK_INTERRUPTIBLE so that the thread is not
1651 * counted against the load average as a running process. 1651 * counted against the load average as a running process.
1652 * We never actually get interrupted because kthread_run 1652 * We never actually get interrupted because kthread_run
1653 * disables singal delivery for the created thread. 1653 * disables signal delivery for the created thread.
1654 */ 1654 */
1655 set_current_state(TASK_INTERRUPTIBLE); 1655 set_current_state(TASK_INTERRUPTIBLE);
1656 while (!kthread_should_stop()) { 1656 while (!kthread_should_stop()) {
diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c
index 18486b51668d..17914a346f71 100644
--- a/drivers/scsi/scsi_scan.c
+++ b/drivers/scsi/scsi_scan.c
@@ -32,6 +32,7 @@
32#include <linux/delay.h> 32#include <linux/delay.h>
33#include <linux/kthread.h> 33#include <linux/kthread.h>
34#include <linux/spinlock.h> 34#include <linux/spinlock.h>
35#include <linux/async.h>
35 36
36#include <scsi/scsi.h> 37#include <scsi/scsi.h>
37#include <scsi/scsi_cmnd.h> 38#include <scsi/scsi_cmnd.h>
@@ -179,6 +180,8 @@ int scsi_complete_async_scans(void)
179 spin_unlock(&async_scan_lock); 180 spin_unlock(&async_scan_lock);
180 181
181 kfree(data); 182 kfree(data);
183 /* Synchronize async operations globally */
184 async_synchronize_full();
182 return 0; 185 return 0;
183} 186}
184 187
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index 62b28d58e65e..e035c1114010 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -48,6 +48,7 @@
48#include <linux/delay.h> 48#include <linux/delay.h>
49#include <linux/mutex.h> 49#include <linux/mutex.h>
50#include <linux/string_helpers.h> 50#include <linux/string_helpers.h>
51#include <linux/async.h>
51#include <asm/uaccess.h> 52#include <asm/uaccess.h>
52 53
53#include <scsi/scsi.h> 54#include <scsi/scsi.h>
@@ -1802,6 +1803,71 @@ static int sd_format_disk_name(char *prefix, int index, char *buf, int buflen)
1802 return 0; 1803 return 0;
1803} 1804}
1804 1805
1806/*
1807 * The asynchronous part of sd_probe
1808 */
1809static void sd_probe_async(void *data, async_cookie_t cookie)
1810{
1811 struct scsi_disk *sdkp = data;
1812 struct scsi_device *sdp;
1813 struct gendisk *gd;
1814 u32 index;
1815 struct device *dev;
1816
1817 sdp = sdkp->device;
1818 gd = sdkp->disk;
1819 index = sdkp->index;
1820 dev = &sdp->sdev_gendev;
1821
1822 if (!sdp->request_queue->rq_timeout) {
1823 if (sdp->type != TYPE_MOD)
1824 blk_queue_rq_timeout(sdp->request_queue, SD_TIMEOUT);
1825 else
1826 blk_queue_rq_timeout(sdp->request_queue,
1827 SD_MOD_TIMEOUT);
1828 }
1829
1830 device_initialize(&sdkp->dev);
1831 sdkp->dev.parent = &sdp->sdev_gendev;
1832 sdkp->dev.class = &sd_disk_class;
1833 strncpy(sdkp->dev.bus_id, sdp->sdev_gendev.bus_id, BUS_ID_SIZE);
1834
1835 if (device_add(&sdkp->dev))
1836 goto out_free_index;
1837
1838 get_device(&sdp->sdev_gendev);
1839
1840 if (index < SD_MAX_DISKS) {
1841 gd->major = sd_major((index & 0xf0) >> 4);
1842 gd->first_minor = ((index & 0xf) << 4) | (index & 0xfff00);
1843 gd->minors = SD_MINORS;
1844 }
1845 gd->fops = &sd_fops;
1846 gd->private_data = &sdkp->driver;
1847 gd->queue = sdkp->device->request_queue;
1848
1849 sd_revalidate_disk(gd);
1850
1851 blk_queue_prep_rq(sdp->request_queue, sd_prep_fn);
1852
1853 gd->driverfs_dev = &sdp->sdev_gendev;
1854 gd->flags = GENHD_FL_EXT_DEVT | GENHD_FL_DRIVERFS;
1855 if (sdp->removable)
1856 gd->flags |= GENHD_FL_REMOVABLE;
1857
1858 dev_set_drvdata(dev, sdkp);
1859 add_disk(gd);
1860 sd_dif_config_host(sdkp);
1861
1862 sd_printk(KERN_NOTICE, sdkp, "Attached SCSI %sdisk\n",
1863 sdp->removable ? "removable " : "");
1864
1865 return;
1866
1867 out_free_index:
1868 ida_remove(&sd_index_ida, index);
1869}
1870
1805/** 1871/**
1806 * sd_probe - called during driver initialization and whenever a 1872 * sd_probe - called during driver initialization and whenever a
1807 * new scsi device is attached to the system. It is called once 1873 * new scsi device is attached to the system. It is called once
@@ -1865,48 +1931,7 @@ static int sd_probe(struct device *dev)
1865 sdkp->openers = 0; 1931 sdkp->openers = 0;
1866 sdkp->previous_state = 1; 1932 sdkp->previous_state = 1;
1867 1933
1868 if (!sdp->request_queue->rq_timeout) { 1934 async_schedule(sd_probe_async, sdkp);
1869 if (sdp->type != TYPE_MOD)
1870 blk_queue_rq_timeout(sdp->request_queue, SD_TIMEOUT);
1871 else
1872 blk_queue_rq_timeout(sdp->request_queue,
1873 SD_MOD_TIMEOUT);
1874 }
1875
1876 device_initialize(&sdkp->dev);
1877 sdkp->dev.parent = &sdp->sdev_gendev;
1878 sdkp->dev.class = &sd_disk_class;
1879 strncpy(sdkp->dev.bus_id, sdp->sdev_gendev.bus_id, BUS_ID_SIZE);
1880
1881 if (device_add(&sdkp->dev))
1882 goto out_free_index;
1883
1884 get_device(&sdp->sdev_gendev);
1885
1886 if (index < SD_MAX_DISKS) {
1887 gd->major = sd_major((index & 0xf0) >> 4);
1888 gd->first_minor = ((index & 0xf) << 4) | (index & 0xfff00);
1889 gd->minors = SD_MINORS;
1890 }
1891 gd->fops = &sd_fops;
1892 gd->private_data = &sdkp->driver;
1893 gd->queue = sdkp->device->request_queue;
1894
1895 sd_revalidate_disk(gd);
1896
1897 blk_queue_prep_rq(sdp->request_queue, sd_prep_fn);
1898
1899 gd->driverfs_dev = &sdp->sdev_gendev;
1900 gd->flags = GENHD_FL_EXT_DEVT | GENHD_FL_DRIVERFS;
1901 if (sdp->removable)
1902 gd->flags |= GENHD_FL_REMOVABLE;
1903
1904 dev_set_drvdata(dev, sdkp);
1905 add_disk(gd);
1906 sd_dif_config_host(sdkp);
1907
1908 sd_printk(KERN_NOTICE, sdkp, "Attached SCSI %sdisk\n",
1909 sdp->removable ? "removable " : "");
1910 1935
1911 return 0; 1936 return 0;
1912 1937
diff --git a/drivers/serial/8250.c b/drivers/serial/8250.c
index daa00567bc44..1889a63ebc22 100644
--- a/drivers/serial/8250.c
+++ b/drivers/serial/8250.c
@@ -3123,7 +3123,7 @@ static int __init serial8250_init(void)
3123 if (nr_uarts > UART_NR) 3123 if (nr_uarts > UART_NR)
3124 nr_uarts = UART_NR; 3124 nr_uarts = UART_NR;
3125 3125
3126 printk(KERN_INFO "Serial: 8250/16550 driver" 3126 printk(KERN_INFO "Serial: 8250/16550 driver, "
3127 "%d ports, IRQ sharing %sabled\n", nr_uarts, 3127 "%d ports, IRQ sharing %sabled\n", nr_uarts,
3128 share_irqs ? "en" : "dis"); 3128 share_irqs ? "en" : "dis");
3129 3129
diff --git a/drivers/serial/crisv10.c b/drivers/serial/crisv10.c
index 8b2c619a09f2..e642c22c80e2 100644
--- a/drivers/serial/crisv10.c
+++ b/drivers/serial/crisv10.c
@@ -1203,7 +1203,7 @@ static void e100_disable_txdma_channel(struct e100_serial *info)
1203 unsigned long flags; 1203 unsigned long flags;
1204 1204
1205 /* Disable output DMA channel for the serial port in question 1205 /* Disable output DMA channel for the serial port in question
1206 * ( set to something other then serialX) 1206 * ( set to something other than serialX)
1207 */ 1207 */
1208 local_irq_save(flags); 1208 local_irq_save(flags);
1209 DFLOW(DEBUG_LOG(info->line, "disable_txdma_channel %i\n", info->line)); 1209 DFLOW(DEBUG_LOG(info->line, "disable_txdma_channel %i\n", info->line));
@@ -1266,7 +1266,7 @@ static void e100_disable_rxdma_channel(struct e100_serial *info)
1266 unsigned long flags; 1266 unsigned long flags;
1267 1267
1268 /* Disable input DMA channel for the serial port in question 1268 /* Disable input DMA channel for the serial port in question
1269 * ( set to something other then serialX) 1269 * ( set to something other than serialX)
1270 */ 1270 */
1271 local_irq_save(flags); 1271 local_irq_save(flags);
1272 if (info->line == 0) { 1272 if (info->line == 0) {
diff --git a/drivers/spi/spi_lm70llp.c b/drivers/spi/spi_lm70llp.c
index af6526767e2a..568c781ad91c 100644
--- a/drivers/spi/spi_lm70llp.c
+++ b/drivers/spi/spi_lm70llp.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * spi_lm70llp.c - driver for lm70llp eval board for the LM70 sensor 2 * spi_lm70llp.c - driver for LM70EVAL-LLP board for the LM70 sensor
3 * 3 *
4 * Copyright (C) 2006 Kaiwan N Billimoria <kaiwan@designergraphix.com> 4 * Copyright (C) 2006 Kaiwan N Billimoria <kaiwan@designergraphix.com>
5 * 5 *
@@ -40,8 +40,12 @@
40 * master controller driver. The hwmon/lm70 driver is a "SPI protocol 40 * master controller driver. The hwmon/lm70 driver is a "SPI protocol
41 * driver", layered on top of this one and usable without the lm70llp. 41 * driver", layered on top of this one and usable without the lm70llp.
42 * 42 *
43 * Datasheet and Schematic:
43 * The LM70 is a temperature sensor chip from National Semiconductor; its 44 * The LM70 is a temperature sensor chip from National Semiconductor; its
44 * datasheet is available at http://www.national.com/pf/LM/LM70.html 45 * datasheet is available at http://www.national.com/pf/LM/LM70.html
46 * The schematic for this particular board (the LM70EVAL-LLP) is
47 * available (on page 4) here:
48 * http://www.national.com/appinfo/tempsensors/files/LM70LLPEVALmanual.pdf
45 * 49 *
46 * Also see Documentation/spi/spi-lm70llp. The SPI<->parport code here is 50 * Also see Documentation/spi/spi-lm70llp. The SPI<->parport code here is
47 * (heavily) based on spi-butterfly by David Brownell. 51 * (heavily) based on spi-butterfly by David Brownell.
@@ -64,7 +68,7 @@
64 * 68 *
65 * Note that parport pin 13 actually gets inverted by the transistor 69 * Note that parport pin 13 actually gets inverted by the transistor
66 * arrangement which lets either the parport or the LM70 drive the 70 * arrangement which lets either the parport or the LM70 drive the
67 * SI/SO signal. 71 * SI/SO signal (see the schematic for details).
68 */ 72 */
69 73
70#define DRVNAME "spi-lm70llp" 74#define DRVNAME "spi-lm70llp"
@@ -106,12 +110,16 @@ static inline struct spi_lm70llp *spidev_to_pp(struct spi_device *spi)
106static inline void deassertCS(struct spi_lm70llp *pp) 110static inline void deassertCS(struct spi_lm70llp *pp)
107{ 111{
108 u8 data = parport_read_data(pp->port); 112 u8 data = parport_read_data(pp->port);
113
114 data &= ~0x80; /* pull D7/SI-out low while de-asserted */
109 parport_write_data(pp->port, data | nCS); 115 parport_write_data(pp->port, data | nCS);
110} 116}
111 117
112static inline void assertCS(struct spi_lm70llp *pp) 118static inline void assertCS(struct spi_lm70llp *pp)
113{ 119{
114 u8 data = parport_read_data(pp->port); 120 u8 data = parport_read_data(pp->port);
121
122 data |= 0x80; /* pull D7/SI-out high so lm70 drives SO-in */
115 parport_write_data(pp->port, data & ~nCS); 123 parport_write_data(pp->port, data & ~nCS);
116} 124}
117 125
@@ -184,22 +192,7 @@ static void lm70_chipselect(struct spi_device *spi, int value)
184 */ 192 */
185static u32 lm70_txrx(struct spi_device *spi, unsigned nsecs, u32 word, u8 bits) 193static u32 lm70_txrx(struct spi_device *spi, unsigned nsecs, u32 word, u8 bits)
186{ 194{
187 static u32 sio=0; 195 return bitbang_txrx_be_cpha0(spi, nsecs, 0, word, bits);
188 static int first_time=1;
189
190 /* First time: perform SPI bitbang and return the LSB of
191 * the result of the SPI call.
192 */
193 if (first_time) {
194 sio = bitbang_txrx_be_cpha0(spi, nsecs, 0, word, bits);
195 first_time=0;
196 return (sio & 0x00ff);
197 }
198 /* Return the MSB of the result of the SPI call */
199 else {
200 first_time=1;
201 return (sio >> 8);
202 }
203} 196}
204 197
205static void spi_lm70llp_attach(struct parport *p) 198static void spi_lm70llp_attach(struct parport *p)
@@ -293,10 +286,9 @@ static void spi_lm70llp_attach(struct parport *p)
293 status = -ENODEV; 286 status = -ENODEV;
294 goto out_bitbang_stop; 287 goto out_bitbang_stop;
295 } 288 }
296 pp->spidev_lm70->bits_per_word = 16; 289 pp->spidev_lm70->bits_per_word = 8;
297 290
298 lm70llp = pp; 291 lm70llp = pp;
299
300 return; 292 return;
301 293
302out_bitbang_stop: 294out_bitbang_stop:
@@ -326,7 +318,6 @@ static void spi_lm70llp_detach(struct parport *p)
326 318
327 /* power down */ 319 /* power down */
328 parport_write_data(pp->port, 0); 320 parport_write_data(pp->port, 0);
329 msleep(10);
330 321
331 parport_release(pp->pd); 322 parport_release(pp->pd);
332 parport_unregister_device(pp->pd); 323 parport_unregister_device(pp->pd);
diff --git a/drivers/usb/Kconfig b/drivers/usb/Kconfig
index 289d81adfb9c..83babb0a1df7 100644
--- a/drivers/usb/Kconfig
+++ b/drivers/usb/Kconfig
@@ -150,4 +150,6 @@ source "drivers/usb/atm/Kconfig"
150 150
151source "drivers/usb/gadget/Kconfig" 151source "drivers/usb/gadget/Kconfig"
152 152
153source "drivers/usb/otg/Kconfig"
154
153endif # USB_SUPPORT 155endif # USB_SUPPORT
diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
index d50a99f70aee..00b47ea24f86 100644
--- a/drivers/usb/class/cdc-acm.c
+++ b/drivers/usb/class/cdc-acm.c
@@ -1275,7 +1275,7 @@ static int acm_suspend(struct usb_interface *intf, pm_message_t message)
1275 struct acm *acm = usb_get_intfdata(intf); 1275 struct acm *acm = usb_get_intfdata(intf);
1276 int cnt; 1276 int cnt;
1277 1277
1278 if (acm->dev->auto_pm) { 1278 if (message.event & PM_EVENT_AUTO) {
1279 int b; 1279 int b;
1280 1280
1281 spin_lock_irq(&acm->read_lock); 1281 spin_lock_irq(&acm->read_lock);
diff --git a/drivers/usb/class/cdc-wdm.c b/drivers/usb/class/cdc-wdm.c
index 5a8ecc045e3f..3771d6e6d0cc 100644
--- a/drivers/usb/class/cdc-wdm.c
+++ b/drivers/usb/class/cdc-wdm.c
@@ -764,7 +764,8 @@ static int wdm_suspend(struct usb_interface *intf, pm_message_t message)
764 764
765 mutex_lock(&desc->plock); 765 mutex_lock(&desc->plock);
766#ifdef CONFIG_PM 766#ifdef CONFIG_PM
767 if (interface_to_usbdev(desc->intf)->auto_pm && test_bit(WDM_IN_USE, &desc->flags)) { 767 if ((message.event & PM_EVENT_AUTO) &&
768 test_bit(WDM_IN_USE, &desc->flags)) {
768 rv = -EBUSY; 769 rv = -EBUSY;
769 } else { 770 } else {
770#endif 771#endif
diff --git a/drivers/usb/class/usbtmc.c b/drivers/usb/class/usbtmc.c
index 43a863c5cc43..0f5c05f6f9df 100644
--- a/drivers/usb/class/usbtmc.c
+++ b/drivers/usb/class/usbtmc.c
@@ -21,6 +21,7 @@
21 21
22#include <linux/init.h> 22#include <linux/init.h>
23#include <linux/module.h> 23#include <linux/module.h>
24#include <linux/kernel.h>
24#include <linux/fs.h> 25#include <linux/fs.h>
25#include <linux/uaccess.h> 26#include <linux/uaccess.h>
26#include <linux/kref.h> 27#include <linux/kref.h>
@@ -482,7 +483,6 @@ static ssize_t usbtmc_write(struct file *filp, const char __user *buf,
482 int retval; 483 int retval;
483 int actual; 484 int actual;
484 unsigned long int n_bytes; 485 unsigned long int n_bytes;
485 int n;
486 int remaining; 486 int remaining;
487 int done; 487 int done;
488 int this_part; 488 int this_part;
@@ -526,11 +526,8 @@ static ssize_t usbtmc_write(struct file *filp, const char __user *buf,
526 goto exit; 526 goto exit;
527 } 527 }
528 528
529 n_bytes = 12 + this_part; 529 n_bytes = roundup(12 + this_part, 4);
530 if (this_part % 4) 530 memset(buffer + 12 + this_part, 0, n_bytes - (12 + this_part));
531 n_bytes += 4 - this_part % 4;
532 for (n = 12 + this_part; n < n_bytes; n++)
533 buffer[n] = 0;
534 531
535 retval = usb_bulk_msg(data->usb_dev, 532 retval = usb_bulk_msg(data->usb_dev,
536 usb_sndbulkpipe(data->usb_dev, 533 usb_sndbulkpipe(data->usb_dev,
diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c
index aa79280df15d..26fece124e0e 100644
--- a/drivers/usb/core/devio.c
+++ b/drivers/usb/core/devio.c
@@ -981,9 +981,6 @@ static int proc_do_submiturb(struct dev_state *ps, struct usbdevfs_urb *uurb,
981 return -EINVAL; 981 return -EINVAL;
982 if (!uurb->buffer) 982 if (!uurb->buffer)
983 return -EINVAL; 983 return -EINVAL;
984 if (uurb->signr != 0 && (uurb->signr < SIGRTMIN ||
985 uurb->signr > SIGRTMAX))
986 return -EINVAL;
987 if (!(uurb->type == USBDEVFS_URB_TYPE_CONTROL && 984 if (!(uurb->type == USBDEVFS_URB_TYPE_CONTROL &&
988 (uurb->endpoint & ~USB_ENDPOINT_DIR_MASK) == 0)) { 985 (uurb->endpoint & ~USB_ENDPOINT_DIR_MASK) == 0)) {
989 ifnum = findintfep(ps->dev, uurb->endpoint); 986 ifnum = findintfep(ps->dev, uurb->endpoint);
@@ -1320,7 +1317,7 @@ static int get_urb32(struct usbdevfs_urb *kurb,
1320 if (__get_user(uptr, &uurb->buffer)) 1317 if (__get_user(uptr, &uurb->buffer))
1321 return -EFAULT; 1318 return -EFAULT;
1322 kurb->buffer = compat_ptr(uptr); 1319 kurb->buffer = compat_ptr(uptr);
1323 if (__get_user(uptr, &uurb->buffer)) 1320 if (__get_user(uptr, &uurb->usercontext))
1324 return -EFAULT; 1321 return -EFAULT;
1325 kurb->usercontext = compat_ptr(uptr); 1322 kurb->usercontext = compat_ptr(uptr);
1326 1323
@@ -1401,8 +1398,6 @@ static int proc_disconnectsignal(struct dev_state *ps, void __user *arg)
1401 1398
1402 if (copy_from_user(&ds, arg, sizeof(ds))) 1399 if (copy_from_user(&ds, arg, sizeof(ds)))
1403 return -EFAULT; 1400 return -EFAULT;
1404 if (ds.signr != 0 && (ds.signr < SIGRTMIN || ds.signr > SIGRTMAX))
1405 return -EINVAL;
1406 ps->discsignr = ds.signr; 1401 ps->discsignr = ds.signr;
1407 ps->disccontext = ds.context; 1402 ps->disccontext = ds.context;
1408 return 0; 1403 return 0;
diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c
index 8c081308b0e2..98760553bc95 100644
--- a/drivers/usb/core/driver.c
+++ b/drivers/usb/core/driver.c
@@ -184,6 +184,20 @@ static int usb_unbind_device(struct device *dev)
184 return 0; 184 return 0;
185} 185}
186 186
187/*
188 * Cancel any pending scheduled resets
189 *
190 * [see usb_queue_reset_device()]
191 *
192 * Called after unconfiguring / when releasing interfaces. See
193 * comments in __usb_queue_reset_device() regarding
194 * udev->reset_running.
195 */
196static void usb_cancel_queued_reset(struct usb_interface *iface)
197{
198 if (iface->reset_running == 0)
199 cancel_work_sync(&iface->reset_ws);
200}
187 201
188/* called from driver core with dev locked */ 202/* called from driver core with dev locked */
189static int usb_probe_interface(struct device *dev) 203static int usb_probe_interface(struct device *dev)
@@ -242,6 +256,7 @@ static int usb_probe_interface(struct device *dev)
242 mark_quiesced(intf); 256 mark_quiesced(intf);
243 intf->needs_remote_wakeup = 0; 257 intf->needs_remote_wakeup = 0;
244 intf->condition = USB_INTERFACE_UNBOUND; 258 intf->condition = USB_INTERFACE_UNBOUND;
259 usb_cancel_queued_reset(intf);
245 } else 260 } else
246 intf->condition = USB_INTERFACE_BOUND; 261 intf->condition = USB_INTERFACE_BOUND;
247 262
@@ -272,6 +287,7 @@ static int usb_unbind_interface(struct device *dev)
272 usb_disable_interface(udev, intf); 287 usb_disable_interface(udev, intf);
273 288
274 driver->disconnect(intf); 289 driver->disconnect(intf);
290 usb_cancel_queued_reset(intf);
275 291
276 /* Reset other interface state. 292 /* Reset other interface state.
277 * We cannot do a Set-Interface if the device is suspended or 293 * We cannot do a Set-Interface if the device is suspended or
@@ -279,9 +295,12 @@ static int usb_unbind_interface(struct device *dev)
279 * altsetting means creating new endpoint device entries). 295 * altsetting means creating new endpoint device entries).
280 * When either of these happens, defer the Set-Interface. 296 * When either of these happens, defer the Set-Interface.
281 */ 297 */
282 if (intf->cur_altsetting->desc.bAlternateSetting == 0) 298 if (intf->cur_altsetting->desc.bAlternateSetting == 0) {
283 ; /* Already in altsetting 0 so skip Set-Interface */ 299 /* Already in altsetting 0 so skip Set-Interface.
284 else if (!error && intf->dev.power.status == DPM_ON) 300 * Just re-enable it without affecting the endpoint toggles.
301 */
302 usb_enable_interface(udev, intf, false);
303 } else if (!error && intf->dev.power.status == DPM_ON)
285 usb_set_interface(udev, intf->altsetting[0]. 304 usb_set_interface(udev, intf->altsetting[0].
286 desc.bInterfaceNumber, 0); 305 desc.bInterfaceNumber, 0);
287 else 306 else
@@ -380,8 +399,10 @@ void usb_driver_release_interface(struct usb_driver *driver,
380 if (device_is_registered(dev)) { 399 if (device_is_registered(dev)) {
381 iface->condition = USB_INTERFACE_UNBINDING; 400 iface->condition = USB_INTERFACE_UNBINDING;
382 device_release_driver(dev); 401 device_release_driver(dev);
402 } else {
403 iface->condition = USB_INTERFACE_UNBOUND;
404 usb_cancel_queued_reset(iface);
383 } 405 }
384
385 dev->driver = NULL; 406 dev->driver = NULL;
386 usb_set_intfdata(iface, NULL); 407 usb_set_intfdata(iface, NULL);
387 408
@@ -904,7 +925,7 @@ static int usb_suspend_device(struct usb_device *udev, pm_message_t msg)
904} 925}
905 926
906/* Caller has locked udev's pm_mutex */ 927/* Caller has locked udev's pm_mutex */
907static int usb_resume_device(struct usb_device *udev) 928static int usb_resume_device(struct usb_device *udev, pm_message_t msg)
908{ 929{
909 struct usb_device_driver *udriver; 930 struct usb_device_driver *udriver;
910 int status = 0; 931 int status = 0;
@@ -922,7 +943,7 @@ static int usb_resume_device(struct usb_device *udev)
922 udev->reset_resume = 1; 943 udev->reset_resume = 1;
923 944
924 udriver = to_usb_device_driver(udev->dev.driver); 945 udriver = to_usb_device_driver(udev->dev.driver);
925 status = udriver->resume(udev); 946 status = udriver->resume(udev, msg);
926 947
927 done: 948 done:
928 dev_vdbg(&udev->dev, "%s: status %d\n", __func__, status); 949 dev_vdbg(&udev->dev, "%s: status %d\n", __func__, status);
@@ -942,7 +963,8 @@ static int usb_suspend_interface(struct usb_device *udev,
942 if (udev->state == USB_STATE_NOTATTACHED || !is_active(intf)) 963 if (udev->state == USB_STATE_NOTATTACHED || !is_active(intf))
943 goto done; 964 goto done;
944 965
945 if (intf->condition == USB_INTERFACE_UNBOUND) /* This can't happen */ 966 /* This can happen; see usb_driver_release_interface() */
967 if (intf->condition == USB_INTERFACE_UNBOUND)
946 goto done; 968 goto done;
947 driver = to_usb_driver(intf->dev.driver); 969 driver = to_usb_driver(intf->dev.driver);
948 970
@@ -950,7 +972,7 @@ static int usb_suspend_interface(struct usb_device *udev,
950 status = driver->suspend(intf, msg); 972 status = driver->suspend(intf, msg);
951 if (status == 0) 973 if (status == 0)
952 mark_quiesced(intf); 974 mark_quiesced(intf);
953 else if (!udev->auto_pm) 975 else if (!(msg.event & PM_EVENT_AUTO))
954 dev_err(&intf->dev, "%s error %d\n", 976 dev_err(&intf->dev, "%s error %d\n",
955 "suspend", status); 977 "suspend", status);
956 } else { 978 } else {
@@ -968,7 +990,7 @@ static int usb_suspend_interface(struct usb_device *udev,
968 990
969/* Caller has locked intf's usb_device's pm_mutex */ 991/* Caller has locked intf's usb_device's pm_mutex */
970static int usb_resume_interface(struct usb_device *udev, 992static int usb_resume_interface(struct usb_device *udev,
971 struct usb_interface *intf, int reset_resume) 993 struct usb_interface *intf, pm_message_t msg, int reset_resume)
972{ 994{
973 struct usb_driver *driver; 995 struct usb_driver *driver;
974 int status = 0; 996 int status = 0;
@@ -1092,7 +1114,7 @@ static int autosuspend_check(struct usb_device *udev, int reschedule)
1092 if (reschedule) { 1114 if (reschedule) {
1093 if (!timer_pending(&udev->autosuspend.timer)) { 1115 if (!timer_pending(&udev->autosuspend.timer)) {
1094 queue_delayed_work(ksuspend_usb_wq, &udev->autosuspend, 1116 queue_delayed_work(ksuspend_usb_wq, &udev->autosuspend,
1095 round_jiffies_relative(suspend_time - j)); 1117 round_jiffies_up_relative(suspend_time - j));
1096 } 1118 }
1097 return -EAGAIN; 1119 return -EAGAIN;
1098 } 1120 }
@@ -1119,10 +1141,9 @@ static inline int autosuspend_check(struct usb_device *udev, int reschedule)
1119 * all the interfaces which were suspended are resumed so that they remain 1141 * all the interfaces which were suspended are resumed so that they remain
1120 * in the same state as the device. 1142 * in the same state as the device.
1121 * 1143 *
1122 * If an autosuspend is in progress (@udev->auto_pm is set), the routine 1144 * If an autosuspend is in progress the routine checks first to make sure
1123 * checks first to make sure that neither the device itself or any of its 1145 * that neither the device itself or any of its active interfaces is in use
1124 * active interfaces is in use (pm_usage_cnt is greater than 0). If they 1146 * (pm_usage_cnt is greater than 0). If they are, the autosuspend fails.
1125 * are, the autosuspend fails.
1126 * 1147 *
1127 * If the suspend succeeds, the routine recursively queues an autosuspend 1148 * If the suspend succeeds, the routine recursively queues an autosuspend
1128 * request for @udev's parent device, thereby propagating the change up 1149 * request for @udev's parent device, thereby propagating the change up
@@ -1157,7 +1178,7 @@ static int usb_suspend_both(struct usb_device *udev, pm_message_t msg)
1157 1178
1158 udev->do_remote_wakeup = device_may_wakeup(&udev->dev); 1179 udev->do_remote_wakeup = device_may_wakeup(&udev->dev);
1159 1180
1160 if (udev->auto_pm) { 1181 if (msg.event & PM_EVENT_AUTO) {
1161 status = autosuspend_check(udev, 0); 1182 status = autosuspend_check(udev, 0);
1162 if (status < 0) 1183 if (status < 0)
1163 goto done; 1184 goto done;
@@ -1177,13 +1198,16 @@ static int usb_suspend_both(struct usb_device *udev, pm_message_t msg)
1177 1198
1178 /* If the suspend failed, resume interfaces that did get suspended */ 1199 /* If the suspend failed, resume interfaces that did get suspended */
1179 if (status != 0) { 1200 if (status != 0) {
1201 pm_message_t msg2;
1202
1203 msg2.event = msg.event ^ (PM_EVENT_SUSPEND | PM_EVENT_RESUME);
1180 while (--i >= 0) { 1204 while (--i >= 0) {
1181 intf = udev->actconfig->interface[i]; 1205 intf = udev->actconfig->interface[i];
1182 usb_resume_interface(udev, intf, 0); 1206 usb_resume_interface(udev, intf, msg2, 0);
1183 } 1207 }
1184 1208
1185 /* Try another autosuspend when the interfaces aren't busy */ 1209 /* Try another autosuspend when the interfaces aren't busy */
1186 if (udev->auto_pm) 1210 if (msg.event & PM_EVENT_AUTO)
1187 autosuspend_check(udev, status == -EBUSY); 1211 autosuspend_check(udev, status == -EBUSY);
1188 1212
1189 /* If the suspend succeeded then prevent any more URB submissions, 1213 /* If the suspend succeeded then prevent any more URB submissions,
@@ -1213,6 +1237,7 @@ static int usb_suspend_both(struct usb_device *udev, pm_message_t msg)
1213/** 1237/**
1214 * usb_resume_both - resume a USB device and its interfaces 1238 * usb_resume_both - resume a USB device and its interfaces
1215 * @udev: the usb_device to resume 1239 * @udev: the usb_device to resume
1240 * @msg: Power Management message describing this state transition
1216 * 1241 *
1217 * This is the central routine for resuming USB devices. It calls the 1242 * This is the central routine for resuming USB devices. It calls the
1218 * the resume method for @udev and then calls the resume methods for all 1243 * the resume method for @udev and then calls the resume methods for all
@@ -1238,7 +1263,7 @@ static int usb_suspend_both(struct usb_device *udev, pm_message_t msg)
1238 * 1263 *
1239 * This routine can run only in process context. 1264 * This routine can run only in process context.
1240 */ 1265 */
1241static int usb_resume_both(struct usb_device *udev) 1266static int usb_resume_both(struct usb_device *udev, pm_message_t msg)
1242{ 1267{
1243 int status = 0; 1268 int status = 0;
1244 int i; 1269 int i;
@@ -1254,14 +1279,15 @@ static int usb_resume_both(struct usb_device *udev)
1254 1279
1255 /* Propagate the resume up the tree, if necessary */ 1280 /* Propagate the resume up the tree, if necessary */
1256 if (udev->state == USB_STATE_SUSPENDED) { 1281 if (udev->state == USB_STATE_SUSPENDED) {
1257 if (udev->auto_pm && udev->autoresume_disabled) { 1282 if ((msg.event & PM_EVENT_AUTO) &&
1283 udev->autoresume_disabled) {
1258 status = -EPERM; 1284 status = -EPERM;
1259 goto done; 1285 goto done;
1260 } 1286 }
1261 if (parent) { 1287 if (parent) {
1262 status = usb_autoresume_device(parent); 1288 status = usb_autoresume_device(parent);
1263 if (status == 0) { 1289 if (status == 0) {
1264 status = usb_resume_device(udev); 1290 status = usb_resume_device(udev, msg);
1265 if (status || udev->state == 1291 if (status || udev->state ==
1266 USB_STATE_NOTATTACHED) { 1292 USB_STATE_NOTATTACHED) {
1267 usb_autosuspend_device(parent); 1293 usb_autosuspend_device(parent);
@@ -1284,15 +1310,16 @@ static int usb_resume_both(struct usb_device *udev)
1284 /* We can't progagate beyond the USB subsystem, 1310 /* We can't progagate beyond the USB subsystem,
1285 * so if a root hub's controller is suspended 1311 * so if a root hub's controller is suspended
1286 * then we're stuck. */ 1312 * then we're stuck. */
1287 status = usb_resume_device(udev); 1313 status = usb_resume_device(udev, msg);
1288 } 1314 }
1289 } else if (udev->reset_resume) 1315 } else if (udev->reset_resume)
1290 status = usb_resume_device(udev); 1316 status = usb_resume_device(udev, msg);
1291 1317
1292 if (status == 0 && udev->actconfig) { 1318 if (status == 0 && udev->actconfig) {
1293 for (i = 0; i < udev->actconfig->desc.bNumInterfaces; i++) { 1319 for (i = 0; i < udev->actconfig->desc.bNumInterfaces; i++) {
1294 intf = udev->actconfig->interface[i]; 1320 intf = udev->actconfig->interface[i];
1295 usb_resume_interface(udev, intf, udev->reset_resume); 1321 usb_resume_interface(udev, intf, msg,
1322 udev->reset_resume);
1296 } 1323 }
1297 } 1324 }
1298 1325
@@ -1320,13 +1347,13 @@ static int usb_autopm_do_device(struct usb_device *udev, int inc_usage_cnt)
1320 udev->last_busy = jiffies; 1347 udev->last_busy = jiffies;
1321 if (inc_usage_cnt >= 0 && udev->pm_usage_cnt > 0) { 1348 if (inc_usage_cnt >= 0 && udev->pm_usage_cnt > 0) {
1322 if (udev->state == USB_STATE_SUSPENDED) 1349 if (udev->state == USB_STATE_SUSPENDED)
1323 status = usb_resume_both(udev); 1350 status = usb_resume_both(udev, PMSG_AUTO_RESUME);
1324 if (status != 0) 1351 if (status != 0)
1325 udev->pm_usage_cnt -= inc_usage_cnt; 1352 udev->pm_usage_cnt -= inc_usage_cnt;
1326 else if (inc_usage_cnt) 1353 else if (inc_usage_cnt)
1327 udev->last_busy = jiffies; 1354 udev->last_busy = jiffies;
1328 } else if (inc_usage_cnt <= 0 && udev->pm_usage_cnt <= 0) { 1355 } else if (inc_usage_cnt <= 0 && udev->pm_usage_cnt <= 0) {
1329 status = usb_suspend_both(udev, PMSG_SUSPEND); 1356 status = usb_suspend_both(udev, PMSG_AUTO_SUSPEND);
1330 } 1357 }
1331 usb_pm_unlock(udev); 1358 usb_pm_unlock(udev);
1332 return status; 1359 return status;
@@ -1341,6 +1368,19 @@ void usb_autosuspend_work(struct work_struct *work)
1341 usb_autopm_do_device(udev, 0); 1368 usb_autopm_do_device(udev, 0);
1342} 1369}
1343 1370
1371/* usb_autoresume_work - callback routine to autoresume a USB device */
1372void usb_autoresume_work(struct work_struct *work)
1373{
1374 struct usb_device *udev =
1375 container_of(work, struct usb_device, autoresume);
1376
1377 /* Wake it up, let the drivers do their thing, and then put it
1378 * back to sleep.
1379 */
1380 if (usb_autopm_do_device(udev, 1) == 0)
1381 usb_autopm_do_device(udev, -1);
1382}
1383
1344/** 1384/**
1345 * usb_autosuspend_device - delayed autosuspend of a USB device and its interfaces 1385 * usb_autosuspend_device - delayed autosuspend of a USB device and its interfaces
1346 * @udev: the usb_device to autosuspend 1386 * @udev: the usb_device to autosuspend
@@ -1437,13 +1477,14 @@ static int usb_autopm_do_interface(struct usb_interface *intf,
1437 udev->last_busy = jiffies; 1477 udev->last_busy = jiffies;
1438 if (inc_usage_cnt >= 0 && intf->pm_usage_cnt > 0) { 1478 if (inc_usage_cnt >= 0 && intf->pm_usage_cnt > 0) {
1439 if (udev->state == USB_STATE_SUSPENDED) 1479 if (udev->state == USB_STATE_SUSPENDED)
1440 status = usb_resume_both(udev); 1480 status = usb_resume_both(udev,
1481 PMSG_AUTO_RESUME);
1441 if (status != 0) 1482 if (status != 0)
1442 intf->pm_usage_cnt -= inc_usage_cnt; 1483 intf->pm_usage_cnt -= inc_usage_cnt;
1443 else 1484 else
1444 udev->last_busy = jiffies; 1485 udev->last_busy = jiffies;
1445 } else if (inc_usage_cnt <= 0 && intf->pm_usage_cnt <= 0) { 1486 } else if (inc_usage_cnt <= 0 && intf->pm_usage_cnt <= 0) {
1446 status = usb_suspend_both(udev, PMSG_SUSPEND); 1487 status = usb_suspend_both(udev, PMSG_AUTO_SUSPEND);
1447 } 1488 }
1448 } 1489 }
1449 usb_pm_unlock(udev); 1490 usb_pm_unlock(udev);
@@ -1492,6 +1533,45 @@ void usb_autopm_put_interface(struct usb_interface *intf)
1492EXPORT_SYMBOL_GPL(usb_autopm_put_interface); 1533EXPORT_SYMBOL_GPL(usb_autopm_put_interface);
1493 1534
1494/** 1535/**
1536 * usb_autopm_put_interface_async - decrement a USB interface's PM-usage counter
1537 * @intf: the usb_interface whose counter should be decremented
1538 *
1539 * This routine does essentially the same thing as
1540 * usb_autopm_put_interface(): it decrements @intf's usage counter and
1541 * queues a delayed autosuspend request if the counter is <= 0. The
1542 * difference is that it does not acquire the device's pm_mutex;
1543 * callers must handle all synchronization issues themselves.
1544 *
1545 * Typically a driver would call this routine during an URB's completion
1546 * handler, if no more URBs were pending.
1547 *
1548 * This routine can run in atomic context.
1549 */
1550void usb_autopm_put_interface_async(struct usb_interface *intf)
1551{
1552 struct usb_device *udev = interface_to_usbdev(intf);
1553 int status = 0;
1554
1555 if (intf->condition == USB_INTERFACE_UNBOUND) {
1556 status = -ENODEV;
1557 } else {
1558 udev->last_busy = jiffies;
1559 --intf->pm_usage_cnt;
1560 if (udev->autosuspend_disabled || udev->autosuspend_delay < 0)
1561 status = -EPERM;
1562 else if (intf->pm_usage_cnt <= 0 &&
1563 !timer_pending(&udev->autosuspend.timer)) {
1564 queue_delayed_work(ksuspend_usb_wq, &udev->autosuspend,
1565 round_jiffies_up_relative(
1566 udev->autosuspend_delay));
1567 }
1568 }
1569 dev_vdbg(&intf->dev, "%s: status %d cnt %d\n",
1570 __func__, status, intf->pm_usage_cnt);
1571}
1572EXPORT_SYMBOL_GPL(usb_autopm_put_interface_async);
1573
1574/**
1495 * usb_autopm_get_interface - increment a USB interface's PM-usage counter 1575 * usb_autopm_get_interface - increment a USB interface's PM-usage counter
1496 * @intf: the usb_interface whose counter should be incremented 1576 * @intf: the usb_interface whose counter should be incremented
1497 * 1577 *
@@ -1537,6 +1617,37 @@ int usb_autopm_get_interface(struct usb_interface *intf)
1537EXPORT_SYMBOL_GPL(usb_autopm_get_interface); 1617EXPORT_SYMBOL_GPL(usb_autopm_get_interface);
1538 1618
1539/** 1619/**
1620 * usb_autopm_get_interface_async - increment a USB interface's PM-usage counter
1621 * @intf: the usb_interface whose counter should be incremented
1622 *
1623 * This routine does much the same thing as
1624 * usb_autopm_get_interface(): it increments @intf's usage counter and
1625 * queues an autoresume request if the result is > 0. The differences
1626 * are that it does not acquire the device's pm_mutex (callers must
1627 * handle all synchronization issues themselves), and it does not
1628 * autoresume the device directly (it only queues a request). After a
1629 * successful call, the device will generally not yet be resumed.
1630 *
1631 * This routine can run in atomic context.
1632 */
1633int usb_autopm_get_interface_async(struct usb_interface *intf)
1634{
1635 struct usb_device *udev = interface_to_usbdev(intf);
1636 int status = 0;
1637
1638 if (intf->condition == USB_INTERFACE_UNBOUND)
1639 status = -ENODEV;
1640 else if (udev->autoresume_disabled)
1641 status = -EPERM;
1642 else if (++intf->pm_usage_cnt > 0 && udev->state == USB_STATE_SUSPENDED)
1643 queue_work(ksuspend_usb_wq, &udev->autoresume);
1644 dev_vdbg(&intf->dev, "%s: status %d cnt %d\n",
1645 __func__, status, intf->pm_usage_cnt);
1646 return status;
1647}
1648EXPORT_SYMBOL_GPL(usb_autopm_get_interface_async);
1649
1650/**
1540 * usb_autopm_set_interface - set a USB interface's autosuspend state 1651 * usb_autopm_set_interface - set a USB interface's autosuspend state
1541 * @intf: the usb_interface whose state should be set 1652 * @intf: the usb_interface whose state should be set
1542 * 1653 *
@@ -1563,6 +1674,9 @@ EXPORT_SYMBOL_GPL(usb_autopm_set_interface);
1563void usb_autosuspend_work(struct work_struct *work) 1674void usb_autosuspend_work(struct work_struct *work)
1564{} 1675{}
1565 1676
1677void usb_autoresume_work(struct work_struct *work)
1678{}
1679
1566#endif /* CONFIG_USB_SUSPEND */ 1680#endif /* CONFIG_USB_SUSPEND */
1567 1681
1568/** 1682/**
@@ -1595,6 +1709,7 @@ int usb_external_suspend_device(struct usb_device *udev, pm_message_t msg)
1595/** 1709/**
1596 * usb_external_resume_device - external resume of a USB device and its interfaces 1710 * usb_external_resume_device - external resume of a USB device and its interfaces
1597 * @udev: the usb_device to resume 1711 * @udev: the usb_device to resume
1712 * @msg: Power Management message describing this state transition
1598 * 1713 *
1599 * This routine handles external resume requests: ones not generated 1714 * This routine handles external resume requests: ones not generated
1600 * internally by a USB driver (autoresume) but rather coming from the user 1715 * internally by a USB driver (autoresume) but rather coming from the user
@@ -1603,13 +1718,13 @@ int usb_external_suspend_device(struct usb_device *udev, pm_message_t msg)
1603 * 1718 *
1604 * The caller must hold @udev's device lock. 1719 * The caller must hold @udev's device lock.
1605 */ 1720 */
1606int usb_external_resume_device(struct usb_device *udev) 1721int usb_external_resume_device(struct usb_device *udev, pm_message_t msg)
1607{ 1722{
1608 int status; 1723 int status;
1609 1724
1610 usb_pm_lock(udev); 1725 usb_pm_lock(udev);
1611 udev->auto_pm = 0; 1726 udev->auto_pm = 0;
1612 status = usb_resume_both(udev); 1727 status = usb_resume_both(udev, msg);
1613 udev->last_busy = jiffies; 1728 udev->last_busy = jiffies;
1614 usb_pm_unlock(udev); 1729 usb_pm_unlock(udev);
1615 if (status == 0) 1730 if (status == 0)
@@ -1622,7 +1737,7 @@ int usb_external_resume_device(struct usb_device *udev)
1622 return status; 1737 return status;
1623} 1738}
1624 1739
1625int usb_suspend(struct device *dev, pm_message_t message) 1740int usb_suspend(struct device *dev, pm_message_t msg)
1626{ 1741{
1627 struct usb_device *udev; 1742 struct usb_device *udev;
1628 1743
@@ -1641,10 +1756,10 @@ int usb_suspend(struct device *dev, pm_message_t message)
1641 } 1756 }
1642 1757
1643 udev->skip_sys_resume = 0; 1758 udev->skip_sys_resume = 0;
1644 return usb_external_suspend_device(udev, message); 1759 return usb_external_suspend_device(udev, msg);
1645} 1760}
1646 1761
1647int usb_resume(struct device *dev) 1762int usb_resume(struct device *dev, pm_message_t msg)
1648{ 1763{
1649 struct usb_device *udev; 1764 struct usb_device *udev;
1650 1765
@@ -1656,7 +1771,7 @@ int usb_resume(struct device *dev)
1656 */ 1771 */
1657 if (udev->skip_sys_resume) 1772 if (udev->skip_sys_resume)
1658 return 0; 1773 return 0;
1659 return usb_external_resume_device(udev); 1774 return usb_external_resume_device(udev, msg);
1660} 1775}
1661 1776
1662#endif /* CONFIG_PM */ 1777#endif /* CONFIG_PM */
diff --git a/drivers/usb/core/endpoint.c b/drivers/usb/core/endpoint.c
index 946fae43d622..e1710f260b4f 100644
--- a/drivers/usb/core/endpoint.c
+++ b/drivers/usb/core/endpoint.c
@@ -276,7 +276,7 @@ static void ep_device_release(struct device *dev)
276 kfree(ep_dev); 276 kfree(ep_dev);
277} 277}
278 278
279int usb_create_ep_files(struct device *parent, 279int usb_create_ep_devs(struct device *parent,
280 struct usb_host_endpoint *endpoint, 280 struct usb_host_endpoint *endpoint,
281 struct usb_device *udev) 281 struct usb_device *udev)
282{ 282{
@@ -340,7 +340,7 @@ exit:
340 return retval; 340 return retval;
341} 341}
342 342
343void usb_remove_ep_files(struct usb_host_endpoint *endpoint) 343void usb_remove_ep_devs(struct usb_host_endpoint *endpoint)
344{ 344{
345 struct ep_device *ep_dev = endpoint->ep_dev; 345 struct ep_device *ep_dev = endpoint->ep_dev;
346 346
diff --git a/drivers/usb/core/generic.c b/drivers/usb/core/generic.c
index 7e912f21fd36..30ecac3af15a 100644
--- a/drivers/usb/core/generic.c
+++ b/drivers/usb/core/generic.c
@@ -200,18 +200,18 @@ static int generic_suspend(struct usb_device *udev, pm_message_t msg)
200 * interfaces manually by doing a bus (or "global") suspend. 200 * interfaces manually by doing a bus (or "global") suspend.
201 */ 201 */
202 if (!udev->parent) 202 if (!udev->parent)
203 rc = hcd_bus_suspend(udev); 203 rc = hcd_bus_suspend(udev, msg);
204 204
205 /* Non-root devices don't need to do anything for FREEZE or PRETHAW */ 205 /* Non-root devices don't need to do anything for FREEZE or PRETHAW */
206 else if (msg.event == PM_EVENT_FREEZE || msg.event == PM_EVENT_PRETHAW) 206 else if (msg.event == PM_EVENT_FREEZE || msg.event == PM_EVENT_PRETHAW)
207 rc = 0; 207 rc = 0;
208 else 208 else
209 rc = usb_port_suspend(udev); 209 rc = usb_port_suspend(udev, msg);
210 210
211 return rc; 211 return rc;
212} 212}
213 213
214static int generic_resume(struct usb_device *udev) 214static int generic_resume(struct usb_device *udev, pm_message_t msg)
215{ 215{
216 int rc; 216 int rc;
217 217
@@ -221,9 +221,9 @@ static int generic_resume(struct usb_device *udev)
221 * interfaces manually by doing a bus (or "global") resume. 221 * interfaces manually by doing a bus (or "global") resume.
222 */ 222 */
223 if (!udev->parent) 223 if (!udev->parent)
224 rc = hcd_bus_resume(udev); 224 rc = hcd_bus_resume(udev, msg);
225 else 225 else
226 rc = usb_port_resume(udev); 226 rc = usb_port_resume(udev, msg);
227 return rc; 227 return rc;
228} 228}
229 229
diff --git a/drivers/usb/core/hcd-pci.c b/drivers/usb/core/hcd-pci.c
index 5b87ae7f0a6a..507741ed4482 100644
--- a/drivers/usb/core/hcd-pci.c
+++ b/drivers/usb/core/hcd-pci.c
@@ -128,6 +128,7 @@ int usb_hcd_pci_probe(struct pci_dev *dev, const struct pci_device_id *id)
128 } 128 }
129 129
130 pci_set_master(dev); 130 pci_set_master(dev);
131 device_set_wakeup_enable(&dev->dev, 1);
131 132
132 retval = usb_add_hcd(hcd, dev->irq, IRQF_DISABLED | IRQF_SHARED); 133 retval = usb_add_hcd(hcd, dev->irq, IRQF_DISABLED | IRQF_SHARED);
133 if (retval != 0) 134 if (retval != 0)
@@ -191,17 +192,15 @@ EXPORT_SYMBOL_GPL(usb_hcd_pci_remove);
191/** 192/**
192 * usb_hcd_pci_suspend - power management suspend of a PCI-based HCD 193 * usb_hcd_pci_suspend - power management suspend of a PCI-based HCD
193 * @dev: USB Host Controller being suspended 194 * @dev: USB Host Controller being suspended
194 * @message: semantics in flux 195 * @message: Power Management message describing this state transition
195 * 196 *
196 * Store this function in the HCD's struct pci_driver as suspend(). 197 * Store this function in the HCD's struct pci_driver as .suspend.
197 */ 198 */
198int usb_hcd_pci_suspend(struct pci_dev *dev, pm_message_t message) 199int usb_hcd_pci_suspend(struct pci_dev *dev, pm_message_t message)
199{ 200{
200 struct usb_hcd *hcd; 201 struct usb_hcd *hcd = pci_get_drvdata(dev);
201 int retval = 0; 202 int retval = 0;
202 int has_pci_pm; 203 int wake, w;
203
204 hcd = pci_get_drvdata(dev);
205 204
206 /* Root hub suspend should have stopped all downstream traffic, 205 /* Root hub suspend should have stopped all downstream traffic,
207 * and all bus master traffic. And done so for both the interface 206 * and all bus master traffic. And done so for both the interface
@@ -212,8 +211,15 @@ int usb_hcd_pci_suspend(struct pci_dev *dev, pm_message_t message)
212 * otherwise the swsusp will save (and restore) garbage state. 211 * otherwise the swsusp will save (and restore) garbage state.
213 */ 212 */
214 if (!(hcd->state == HC_STATE_SUSPENDED || 213 if (!(hcd->state == HC_STATE_SUSPENDED ||
215 hcd->state == HC_STATE_HALT)) 214 hcd->state == HC_STATE_HALT)) {
216 return -EBUSY; 215 dev_warn(&dev->dev, "Root hub is not suspended\n");
216 retval = -EBUSY;
217 goto done;
218 }
219
220 /* We might already be suspended (runtime PM -- not yet written) */
221 if (dev->current_state != PCI_D0)
222 goto done;
217 223
218 if (hcd->driver->pci_suspend) { 224 if (hcd->driver->pci_suspend) {
219 retval = hcd->driver->pci_suspend(hcd, message); 225 retval = hcd->driver->pci_suspend(hcd, message);
@@ -221,49 +227,60 @@ int usb_hcd_pci_suspend(struct pci_dev *dev, pm_message_t message)
221 if (retval) 227 if (retval)
222 goto done; 228 goto done;
223 } 229 }
224 synchronize_irq(dev->irq);
225 230
226 /* FIXME until the generic PM interfaces change a lot more, this 231 synchronize_irq(dev->irq);
227 * can't use PCI D1 and D2 states. For example, the confusion
228 * between messages and states will need to vanish, and messages
229 * will need to provide a target system state again.
230 *
231 * It'll be important to learn characteristics of the target state,
232 * especially on embedded hardware where the HCD will often be in
233 * charge of an external VBUS power supply and one or more clocks.
234 * Some target system states will leave them active; others won't.
235 * (With PCI, that's often handled by platform BIOS code.)
236 */
237 232
238 /* even when the PCI layer rejects some of the PCI calls 233 /* Don't fail on error to enable wakeup. We rely on pci code
239 * below, HCs can try global suspend and reduce DMA traffic. 234 * to reject requests the hardware can't implement, rather
240 * PM-sensitive HCDs may already have done this. 235 * than coding the same thing.
241 */ 236 */
242 has_pci_pm = pci_find_capability(dev, PCI_CAP_ID_PM); 237 wake = (hcd->state == HC_STATE_SUSPENDED &&
238 device_may_wakeup(&dev->dev));
239 w = pci_wake_from_d3(dev, wake);
240 if (w < 0)
241 wake = w;
242 dev_dbg(&dev->dev, "wakeup: %d\n", wake);
243 243
244 /* Downstream ports from this root hub should already be quiesced, so 244 /* Downstream ports from this root hub should already be quiesced, so
245 * there will be no DMA activity. Now we can shut down the upstream 245 * there will be no DMA activity. Now we can shut down the upstream
246 * link (except maybe for PME# resume signaling) and enter some PCI 246 * link (except maybe for PME# resume signaling) and enter some PCI
247 * low power state, if the hardware allows. 247 * low power state, if the hardware allows.
248 */ 248 */
249 if (hcd->state == HC_STATE_SUSPENDED) { 249 pci_disable_device(dev);
250 done:
251 return retval;
252}
253EXPORT_SYMBOL_GPL(usb_hcd_pci_suspend);
250 254
251 /* no DMA or IRQs except when HC is active */ 255/**
252 if (dev->current_state == PCI_D0) { 256 * usb_hcd_pci_suspend_late - suspend a PCI-based HCD after IRQs are disabled
253 pci_save_state(dev); 257 * @dev: USB Host Controller being suspended
254 pci_disable_device(dev); 258 * @message: Power Management message describing this state transition
255 } 259 *
260 * Store this function in the HCD's struct pci_driver as .suspend_late.
261 */
262int usb_hcd_pci_suspend_late(struct pci_dev *dev, pm_message_t message)
263{
264 int retval = 0;
265 int has_pci_pm;
256 266
257 if (message.event == PM_EVENT_FREEZE || 267 /* We might already be suspended (runtime PM -- not yet written) */
258 message.event == PM_EVENT_PRETHAW) { 268 if (dev->current_state != PCI_D0)
259 dev_dbg(hcd->self.controller, "--> no state change\n"); 269 goto done;
260 goto done;
261 }
262 270
263 if (!has_pci_pm) { 271 pci_save_state(dev);
264 dev_dbg(hcd->self.controller, "--> PCI D0/legacy\n"); 272
265 goto done; 273 /* Don't change state if we don't need to */
266 } 274 if (message.event == PM_EVENT_FREEZE ||
275 message.event == PM_EVENT_PRETHAW) {
276 dev_dbg(&dev->dev, "--> no state change\n");
277 goto done;
278 }
279
280 has_pci_pm = pci_find_capability(dev, PCI_CAP_ID_PM);
281 if (!has_pci_pm) {
282 dev_dbg(&dev->dev, "--> PCI D0 legacy\n");
283 } else {
267 284
268 /* NOTE: dev->current_state becomes nonzero only here, and 285 /* NOTE: dev->current_state becomes nonzero only here, and
269 * only for devices that support PCI PM. Also, exiting 286 * only for devices that support PCI PM. Also, exiting
@@ -273,35 +290,16 @@ int usb_hcd_pci_suspend(struct pci_dev *dev, pm_message_t message)
273 retval = pci_set_power_state(dev, PCI_D3hot); 290 retval = pci_set_power_state(dev, PCI_D3hot);
274 suspend_report_result(pci_set_power_state, retval); 291 suspend_report_result(pci_set_power_state, retval);
275 if (retval == 0) { 292 if (retval == 0) {
276 int wake = device_can_wakeup(&hcd->self.root_hub->dev); 293 dev_dbg(&dev->dev, "--> PCI D3\n");
277
278 wake = wake && device_may_wakeup(hcd->self.controller);
279
280 dev_dbg(hcd->self.controller, "--> PCI D3%s\n",
281 wake ? "/wakeup" : "");
282
283 /* Ignore these return values. We rely on pci code to
284 * reject requests the hardware can't implement, rather
285 * than coding the same thing.
286 */
287 (void) pci_enable_wake(dev, PCI_D3hot, wake);
288 (void) pci_enable_wake(dev, PCI_D3cold, wake);
289 } else { 294 } else {
290 dev_dbg(&dev->dev, "PCI D3 suspend fail, %d\n", 295 dev_dbg(&dev->dev, "PCI D3 suspend fail, %d\n",
291 retval); 296 retval);
292 (void) usb_hcd_pci_resume(dev); 297 pci_restore_state(dev);
293 } 298 }
294
295 } else if (hcd->state != HC_STATE_HALT) {
296 dev_dbg(hcd->self.controller, "hcd state %d; not suspended\n",
297 hcd->state);
298 WARN_ON(1);
299 retval = -EINVAL;
300 } 299 }
301 300
302done:
303 if (retval == 0) {
304#ifdef CONFIG_PPC_PMAC 301#ifdef CONFIG_PPC_PMAC
302 if (retval == 0) {
305 /* Disable ASIC clocks for USB */ 303 /* Disable ASIC clocks for USB */
306 if (machine_is(powermac)) { 304 if (machine_is(powermac)) {
307 struct device_node *of_node; 305 struct device_node *of_node;
@@ -311,30 +309,24 @@ done:
311 pmac_call_feature(PMAC_FTR_USB_ENABLE, 309 pmac_call_feature(PMAC_FTR_USB_ENABLE,
312 of_node, 0, 0); 310 of_node, 0, 0);
313 } 311 }
314#endif
315 } 312 }
313#endif
316 314
315 done:
317 return retval; 316 return retval;
318} 317}
319EXPORT_SYMBOL_GPL(usb_hcd_pci_suspend); 318EXPORT_SYMBOL_GPL(usb_hcd_pci_suspend_late);
320 319
321/** 320/**
322 * usb_hcd_pci_resume - power management resume of a PCI-based HCD 321 * usb_hcd_pci_resume_early - resume a PCI-based HCD before IRQs are enabled
323 * @dev: USB Host Controller being resumed 322 * @dev: USB Host Controller being resumed
324 * 323 *
325 * Store this function in the HCD's struct pci_driver as resume(). 324 * Store this function in the HCD's struct pci_driver as .resume_early.
326 */ 325 */
327int usb_hcd_pci_resume(struct pci_dev *dev) 326int usb_hcd_pci_resume_early(struct pci_dev *dev)
328{ 327{
329 struct usb_hcd *hcd; 328 int retval = 0;
330 int retval; 329 pci_power_t state = dev->current_state;
331
332 hcd = pci_get_drvdata(dev);
333 if (hcd->state != HC_STATE_SUSPENDED) {
334 dev_dbg(hcd->self.controller,
335 "can't resume, not suspended!\n");
336 return 0;
337 }
338 330
339#ifdef CONFIG_PPC_PMAC 331#ifdef CONFIG_PPC_PMAC
340 /* Reenable ASIC clocks for USB */ 332 /* Reenable ASIC clocks for USB */
@@ -352,7 +344,7 @@ int usb_hcd_pci_resume(struct pci_dev *dev)
352 * calls "standby", "suspend to RAM", and so on). There are also 344 * calls "standby", "suspend to RAM", and so on). There are also
353 * dirty cases when swsusp fakes a suspend in "shutdown" mode. 345 * dirty cases when swsusp fakes a suspend in "shutdown" mode.
354 */ 346 */
355 if (dev->current_state != PCI_D0) { 347 if (state != PCI_D0) {
356#ifdef DEBUG 348#ifdef DEBUG
357 int pci_pm; 349 int pci_pm;
358 u16 pmcr; 350 u16 pmcr;
@@ -364,8 +356,7 @@ int usb_hcd_pci_resume(struct pci_dev *dev)
364 /* Clean case: power to USB and to HC registers was 356 /* Clean case: power to USB and to HC registers was
365 * maintained; remote wakeup is easy. 357 * maintained; remote wakeup is easy.
366 */ 358 */
367 dev_dbg(hcd->self.controller, "resume from PCI D%d\n", 359 dev_dbg(&dev->dev, "resume from PCI D%d\n", pmcr);
368 pmcr);
369 } else { 360 } else {
370 /* Clean: HC lost Vcc power, D0 uninitialized 361 /* Clean: HC lost Vcc power, D0 uninitialized
371 * + Vaux may have preserved port and transceiver 362 * + Vaux may have preserved port and transceiver
@@ -376,32 +367,55 @@ int usb_hcd_pci_resume(struct pci_dev *dev)
376 * + after BIOS init 367 * + after BIOS init
377 * + after Linux init (HCD statically linked) 368 * + after Linux init (HCD statically linked)
378 */ 369 */
379 dev_dbg(hcd->self.controller, 370 dev_dbg(&dev->dev, "resume from previous PCI D%d\n",
380 "PCI D0, from previous PCI D%d\n", 371 state);
381 dev->current_state);
382 } 372 }
383#endif 373#endif
384 /* yes, ignore these results too... */ 374
385 (void) pci_enable_wake(dev, dev->current_state, 0); 375 retval = pci_set_power_state(dev, PCI_D0);
386 (void) pci_enable_wake(dev, PCI_D3cold, 0);
387 } else { 376 } else {
388 /* Same basic cases: clean (powered/not), dirty */ 377 /* Same basic cases: clean (powered/not), dirty */
389 dev_dbg(hcd->self.controller, "PCI legacy resume\n"); 378 dev_dbg(&dev->dev, "PCI legacy resume\n");
379 }
380
381 if (retval < 0)
382 dev_err(&dev->dev, "can't resume: %d\n", retval);
383 else
384 pci_restore_state(dev);
385
386 return retval;
387}
388EXPORT_SYMBOL_GPL(usb_hcd_pci_resume_early);
389
390/**
391 * usb_hcd_pci_resume - power management resume of a PCI-based HCD
392 * @dev: USB Host Controller being resumed
393 *
394 * Store this function in the HCD's struct pci_driver as .resume.
395 */
396int usb_hcd_pci_resume(struct pci_dev *dev)
397{
398 struct usb_hcd *hcd;
399 int retval;
400
401 hcd = pci_get_drvdata(dev);
402 if (hcd->state != HC_STATE_SUSPENDED) {
403 dev_dbg(hcd->self.controller,
404 "can't resume, not suspended!\n");
405 return 0;
390 } 406 }
391 407
392 /* NOTE: the PCI API itself is asymmetric here. We don't need to
393 * pci_set_power_state(PCI_D0) since that's part of re-enabling;
394 * but that won't re-enable bus mastering. Yet pci_disable_device()
395 * explicitly disables bus mastering...
396 */
397 retval = pci_enable_device(dev); 408 retval = pci_enable_device(dev);
398 if (retval < 0) { 409 if (retval < 0) {
399 dev_err(hcd->self.controller, 410 dev_err(&dev->dev, "can't re-enable after resume, %d!\n",
400 "can't re-enable after resume, %d!\n", retval); 411 retval);
401 return retval; 412 return retval;
402 } 413 }
414
403 pci_set_master(dev); 415 pci_set_master(dev);
404 pci_restore_state(dev); 416
417 /* yes, ignore this result too... */
418 (void) pci_wake_from_d3(dev, 0);
405 419
406 clear_bit(HCD_FLAG_SAW_IRQ, &hcd->flags); 420 clear_bit(HCD_FLAG_SAW_IRQ, &hcd->flags);
407 421
@@ -413,7 +427,6 @@ int usb_hcd_pci_resume(struct pci_dev *dev)
413 usb_hc_died(hcd); 427 usb_hc_died(hcd);
414 } 428 }
415 } 429 }
416
417 return retval; 430 return retval;
418} 431}
419EXPORT_SYMBOL_GPL(usb_hcd_pci_resume); 432EXPORT_SYMBOL_GPL(usb_hcd_pci_resume);
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
index e1b42626d04d..3c711db55d86 100644
--- a/drivers/usb/core/hcd.c
+++ b/drivers/usb/core/hcd.c
@@ -1010,7 +1010,7 @@ int usb_hcd_link_urb_to_ep(struct usb_hcd *hcd, struct urb *urb)
1010 spin_lock(&hcd_urb_list_lock); 1010 spin_lock(&hcd_urb_list_lock);
1011 1011
1012 /* Check that the URB isn't being killed */ 1012 /* Check that the URB isn't being killed */
1013 if (unlikely(urb->reject)) { 1013 if (unlikely(atomic_read(&urb->reject))) {
1014 rc = -EPERM; 1014 rc = -EPERM;
1015 goto done; 1015 goto done;
1016 } 1016 }
@@ -1340,7 +1340,7 @@ int usb_hcd_submit_urb (struct urb *urb, gfp_t mem_flags)
1340 INIT_LIST_HEAD(&urb->urb_list); 1340 INIT_LIST_HEAD(&urb->urb_list);
1341 atomic_dec(&urb->use_count); 1341 atomic_dec(&urb->use_count);
1342 atomic_dec(&urb->dev->urbnum); 1342 atomic_dec(&urb->dev->urbnum);
1343 if (urb->reject) 1343 if (atomic_read(&urb->reject))
1344 wake_up(&usb_kill_urb_queue); 1344 wake_up(&usb_kill_urb_queue);
1345 usb_put_urb(urb); 1345 usb_put_urb(urb);
1346 } 1346 }
@@ -1444,7 +1444,7 @@ void usb_hcd_giveback_urb(struct usb_hcd *hcd, struct urb *urb, int status)
1444 urb->status = status; 1444 urb->status = status;
1445 urb->complete (urb); 1445 urb->complete (urb);
1446 atomic_dec (&urb->use_count); 1446 atomic_dec (&urb->use_count);
1447 if (unlikely (urb->reject)) 1447 if (unlikely(atomic_read(&urb->reject)))
1448 wake_up (&usb_kill_urb_queue); 1448 wake_up (&usb_kill_urb_queue);
1449 usb_put_urb (urb); 1449 usb_put_urb (urb);
1450} 1450}
@@ -1573,14 +1573,14 @@ int usb_hcd_get_frame_number (struct usb_device *udev)
1573 1573
1574#ifdef CONFIG_PM 1574#ifdef CONFIG_PM
1575 1575
1576int hcd_bus_suspend(struct usb_device *rhdev) 1576int hcd_bus_suspend(struct usb_device *rhdev, pm_message_t msg)
1577{ 1577{
1578 struct usb_hcd *hcd = container_of(rhdev->bus, struct usb_hcd, self); 1578 struct usb_hcd *hcd = container_of(rhdev->bus, struct usb_hcd, self);
1579 int status; 1579 int status;
1580 int old_state = hcd->state; 1580 int old_state = hcd->state;
1581 1581
1582 dev_dbg(&rhdev->dev, "bus %s%s\n", 1582 dev_dbg(&rhdev->dev, "bus %s%s\n",
1583 rhdev->auto_pm ? "auto-" : "", "suspend"); 1583 (msg.event & PM_EVENT_AUTO ? "auto-" : ""), "suspend");
1584 if (!hcd->driver->bus_suspend) { 1584 if (!hcd->driver->bus_suspend) {
1585 status = -ENOENT; 1585 status = -ENOENT;
1586 } else { 1586 } else {
@@ -1598,14 +1598,14 @@ int hcd_bus_suspend(struct usb_device *rhdev)
1598 return status; 1598 return status;
1599} 1599}
1600 1600
1601int hcd_bus_resume(struct usb_device *rhdev) 1601int hcd_bus_resume(struct usb_device *rhdev, pm_message_t msg)
1602{ 1602{
1603 struct usb_hcd *hcd = container_of(rhdev->bus, struct usb_hcd, self); 1603 struct usb_hcd *hcd = container_of(rhdev->bus, struct usb_hcd, self);
1604 int status; 1604 int status;
1605 int old_state = hcd->state; 1605 int old_state = hcd->state;
1606 1606
1607 dev_dbg(&rhdev->dev, "usb %s%s\n", 1607 dev_dbg(&rhdev->dev, "usb %s%s\n",
1608 rhdev->auto_pm ? "auto-" : "", "resume"); 1608 (msg.event & PM_EVENT_AUTO ? "auto-" : ""), "resume");
1609 if (!hcd->driver->bus_resume) 1609 if (!hcd->driver->bus_resume)
1610 return -ENOENT; 1610 return -ENOENT;
1611 if (hcd->state == HC_STATE_RUNNING) 1611 if (hcd->state == HC_STATE_RUNNING)
@@ -1638,7 +1638,7 @@ static void hcd_resume_work(struct work_struct *work)
1638 1638
1639 usb_lock_device(udev); 1639 usb_lock_device(udev);
1640 usb_mark_last_busy(udev); 1640 usb_mark_last_busy(udev);
1641 usb_external_resume_device(udev); 1641 usb_external_resume_device(udev, PMSG_REMOTE_RESUME);
1642 usb_unlock_device(udev); 1642 usb_unlock_device(udev);
1643} 1643}
1644 1644
@@ -2028,7 +2028,7 @@ EXPORT_SYMBOL_GPL(usb_hcd_platform_shutdown);
2028 2028
2029/*-------------------------------------------------------------------------*/ 2029/*-------------------------------------------------------------------------*/
2030 2030
2031#if defined(CONFIG_USB_MON) 2031#if defined(CONFIG_USB_MON) || defined(CONFIG_USB_MON_MODULE)
2032 2032
2033struct usb_mon_operations *mon_ops; 2033struct usb_mon_operations *mon_ops;
2034 2034
@@ -2064,4 +2064,4 @@ void usb_mon_deregister (void)
2064} 2064}
2065EXPORT_SYMBOL_GPL (usb_mon_deregister); 2065EXPORT_SYMBOL_GPL (usb_mon_deregister);
2066 2066
2067#endif /* CONFIG_USB_MON */ 2067#endif /* CONFIG_USB_MON || CONFIG_USB_MON_MODULE */
diff --git a/drivers/usb/core/hcd.h b/drivers/usb/core/hcd.h
index 9465e70f4dd0..572d2cf46e8d 100644
--- a/drivers/usb/core/hcd.h
+++ b/drivers/usb/core/hcd.h
@@ -16,6 +16,8 @@
16 * Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 16 * Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17 */ 17 */
18 18
19#ifndef __USB_CORE_HCD_H
20#define __USB_CORE_HCD_H
19 21
20#ifdef __KERNEL__ 22#ifdef __KERNEL__
21 23
@@ -254,7 +256,9 @@ extern int usb_hcd_pci_probe(struct pci_dev *dev,
254extern void usb_hcd_pci_remove(struct pci_dev *dev); 256extern void usb_hcd_pci_remove(struct pci_dev *dev);
255 257
256#ifdef CONFIG_PM 258#ifdef CONFIG_PM
257extern int usb_hcd_pci_suspend(struct pci_dev *dev, pm_message_t state); 259extern int usb_hcd_pci_suspend(struct pci_dev *dev, pm_message_t msg);
260extern int usb_hcd_pci_suspend_late(struct pci_dev *dev, pm_message_t msg);
261extern int usb_hcd_pci_resume_early(struct pci_dev *dev);
258extern int usb_hcd_pci_resume(struct pci_dev *dev); 262extern int usb_hcd_pci_resume(struct pci_dev *dev);
259#endif /* CONFIG_PM */ 263#endif /* CONFIG_PM */
260 264
@@ -386,8 +390,8 @@ extern int usb_find_interface_driver(struct usb_device *dev,
386#ifdef CONFIG_PM 390#ifdef CONFIG_PM
387extern void usb_hcd_resume_root_hub(struct usb_hcd *hcd); 391extern void usb_hcd_resume_root_hub(struct usb_hcd *hcd);
388extern void usb_root_hub_lost_power(struct usb_device *rhdev); 392extern void usb_root_hub_lost_power(struct usb_device *rhdev);
389extern int hcd_bus_suspend(struct usb_device *rhdev); 393extern int hcd_bus_suspend(struct usb_device *rhdev, pm_message_t msg);
390extern int hcd_bus_resume(struct usb_device *rhdev); 394extern int hcd_bus_resume(struct usb_device *rhdev, pm_message_t msg);
391#else 395#else
392static inline void usb_hcd_resume_root_hub(struct usb_hcd *hcd) 396static inline void usb_hcd_resume_root_hub(struct usb_hcd *hcd)
393{ 397{
@@ -419,7 +423,7 @@ static inline void usbfs_cleanup(void) { }
419 423
420/*-------------------------------------------------------------------------*/ 424/*-------------------------------------------------------------------------*/
421 425
422#if defined(CONFIG_USB_MON) 426#if defined(CONFIG_USB_MON) || defined(CONFIG_USB_MON_MODULE)
423 427
424struct usb_mon_operations { 428struct usb_mon_operations {
425 void (*urb_submit)(struct usb_bus *bus, struct urb *urb); 429 void (*urb_submit)(struct usb_bus *bus, struct urb *urb);
@@ -461,7 +465,7 @@ static inline void usbmon_urb_submit_error(struct usb_bus *bus, struct urb *urb,
461static inline void usbmon_urb_complete(struct usb_bus *bus, struct urb *urb, 465static inline void usbmon_urb_complete(struct usb_bus *bus, struct urb *urb,
462 int status) {} 466 int status) {}
463 467
464#endif /* CONFIG_USB_MON */ 468#endif /* CONFIG_USB_MON || CONFIG_USB_MON_MODULE */
465 469
466/*-------------------------------------------------------------------------*/ 470/*-------------------------------------------------------------------------*/
467 471
@@ -490,3 +494,5 @@ extern struct rw_semaphore ehci_cf_port_reset_rwsem;
490extern unsigned long usb_hcds_loaded; 494extern unsigned long usb_hcds_loaded;
491 495
492#endif /* __KERNEL__ */ 496#endif /* __KERNEL__ */
497
498#endif /* __USB_CORE_HCD_H */
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index b19cbfcd51da..d5d0e40b1e2d 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -107,7 +107,9 @@ MODULE_PARM_DESC (blinkenlights, "true to cycle leds on hubs");
107/* define initial 64-byte descriptor request timeout in milliseconds */ 107/* define initial 64-byte descriptor request timeout in milliseconds */
108static int initial_descriptor_timeout = USB_CTRL_GET_TIMEOUT; 108static int initial_descriptor_timeout = USB_CTRL_GET_TIMEOUT;
109module_param(initial_descriptor_timeout, int, S_IRUGO|S_IWUSR); 109module_param(initial_descriptor_timeout, int, S_IRUGO|S_IWUSR);
110MODULE_PARM_DESC(initial_descriptor_timeout, "initial 64-byte descriptor request timeout in milliseconds (default 5000 - 5.0 seconds)"); 110MODULE_PARM_DESC(initial_descriptor_timeout,
111 "initial 64-byte descriptor request timeout in milliseconds "
112 "(default 5000 - 5.0 seconds)");
111 113
112/* 114/*
113 * As of 2.6.10 we introduce a new USB device initialization scheme which 115 * As of 2.6.10 we introduce a new USB device initialization scheme which
@@ -1136,8 +1138,8 @@ static int hub_probe(struct usb_interface *intf, const struct usb_device_id *id)
1136 hdev = interface_to_usbdev(intf); 1138 hdev = interface_to_usbdev(intf);
1137 1139
1138 if (hdev->level == MAX_TOPO_LEVEL) { 1140 if (hdev->level == MAX_TOPO_LEVEL) {
1139 dev_err(&intf->dev, "Unsupported bus topology: " 1141 dev_err(&intf->dev,
1140 "hub nested too deep\n"); 1142 "Unsupported bus topology: hub nested too deep\n");
1141 return -E2BIG; 1143 return -E2BIG;
1142 } 1144 }
1143 1145
@@ -1374,8 +1376,9 @@ static void usb_stop_pm(struct usb_device *udev)
1374 usb_autosuspend_device(udev->parent); 1376 usb_autosuspend_device(udev->parent);
1375 usb_pm_unlock(udev); 1377 usb_pm_unlock(udev);
1376 1378
1377 /* Stop any autosuspend requests already submitted */ 1379 /* Stop any autosuspend or autoresume requests already submitted */
1378 cancel_rearming_delayed_work(&udev->autosuspend); 1380 cancel_delayed_work_sync(&udev->autosuspend);
1381 cancel_work_sync(&udev->autoresume);
1379} 1382}
1380 1383
1381#else 1384#else
@@ -1434,17 +1437,12 @@ void usb_disconnect(struct usb_device **pdev)
1434 usb_disable_device(udev, 0); 1437 usb_disable_device(udev, 0);
1435 usb_hcd_synchronize_unlinks(udev); 1438 usb_hcd_synchronize_unlinks(udev);
1436 1439
1440 usb_remove_ep_devs(&udev->ep0);
1437 usb_unlock_device(udev); 1441 usb_unlock_device(udev);
1438 1442
1439 /* Remove the device-specific files from sysfs. This must be
1440 * done with udev unlocked, because some of the attribute
1441 * routines try to acquire the device lock.
1442 */
1443 usb_remove_sysfs_dev_files(udev);
1444
1445 /* Unregister the device. The device driver is responsible 1443 /* Unregister the device. The device driver is responsible
1446 * for removing the device files from usbfs and sysfs and for 1444 * for de-configuring the device and invoking the remove-device
1447 * de-configuring the device. 1445 * notifier chain (used by usbfs and possibly others).
1448 */ 1446 */
1449 device_del(&udev->dev); 1447 device_del(&udev->dev);
1450 1448
@@ -1476,8 +1474,8 @@ static void announce_device(struct usb_device *udev)
1476 dev_info(&udev->dev, "New USB device found, idVendor=%04x, idProduct=%04x\n", 1474 dev_info(&udev->dev, "New USB device found, idVendor=%04x, idProduct=%04x\n",
1477 le16_to_cpu(udev->descriptor.idVendor), 1475 le16_to_cpu(udev->descriptor.idVendor),
1478 le16_to_cpu(udev->descriptor.idProduct)); 1476 le16_to_cpu(udev->descriptor.idProduct));
1479 dev_info(&udev->dev, "New USB device strings: Mfr=%d, Product=%d, " 1477 dev_info(&udev->dev,
1480 "SerialNumber=%d\n", 1478 "New USB device strings: Mfr=%d, Product=%d, SerialNumber=%d\n",
1481 udev->descriptor.iManufacturer, 1479 udev->descriptor.iManufacturer,
1482 udev->descriptor.iProduct, 1480 udev->descriptor.iProduct,
1483 udev->descriptor.iSerialNumber); 1481 udev->descriptor.iSerialNumber);
@@ -1542,7 +1540,7 @@ static int usb_configure_device_otg(struct usb_device *udev)
1542 * customize to match your product. 1540 * customize to match your product.
1543 */ 1541 */
1544 dev_info(&udev->dev, 1542 dev_info(&udev->dev,
1545 "can't set HNP mode; %d\n", 1543 "can't set HNP mode: %d\n",
1546 err); 1544 err);
1547 bus->b_hnp_enable = 0; 1545 bus->b_hnp_enable = 0;
1548 } 1546 }
@@ -1635,6 +1633,10 @@ int usb_new_device(struct usb_device *udev)
1635{ 1633{
1636 int err; 1634 int err;
1637 1635
1636 /* Increment the parent's count of unsuspended children */
1637 if (udev->parent)
1638 usb_autoresume_device(udev->parent);
1639
1638 usb_detect_quirks(udev); /* Determine quirks */ 1640 usb_detect_quirks(udev); /* Determine quirks */
1639 err = usb_configure_device(udev); /* detect & probe dev/intfs */ 1641 err = usb_configure_device(udev); /* detect & probe dev/intfs */
1640 if (err < 0) 1642 if (err < 0)
@@ -1643,13 +1645,12 @@ int usb_new_device(struct usb_device *udev)
1643 udev->dev.devt = MKDEV(USB_DEVICE_MAJOR, 1645 udev->dev.devt = MKDEV(USB_DEVICE_MAJOR,
1644 (((udev->bus->busnum-1) * 128) + (udev->devnum-1))); 1646 (((udev->bus->busnum-1) * 128) + (udev->devnum-1)));
1645 1647
1646 /* Increment the parent's count of unsuspended children */ 1648 /* Tell the world! */
1647 if (udev->parent) 1649 announce_device(udev);
1648 usb_autoresume_device(udev->parent);
1649 1650
1650 /* Register the device. The device driver is responsible 1651 /* Register the device. The device driver is responsible
1651 * for adding the device files to sysfs and for configuring 1652 * for configuring the device and invoking the add-device
1652 * the device. 1653 * notifier chain (used by usbfs and possibly others).
1653 */ 1654 */
1654 err = device_add(&udev->dev); 1655 err = device_add(&udev->dev);
1655 if (err) { 1656 if (err) {
@@ -1657,15 +1658,12 @@ int usb_new_device(struct usb_device *udev)
1657 goto fail; 1658 goto fail;
1658 } 1659 }
1659 1660
1660 /* put device-specific files into sysfs */ 1661 (void) usb_create_ep_devs(&udev->dev, &udev->ep0, udev);
1661 usb_create_sysfs_dev_files(udev);
1662
1663 /* Tell the world! */
1664 announce_device(udev);
1665 return err; 1662 return err;
1666 1663
1667fail: 1664fail:
1668 usb_set_device_state(udev, USB_STATE_NOTATTACHED); 1665 usb_set_device_state(udev, USB_STATE_NOTATTACHED);
1666 usb_stop_pm(udev);
1669 return err; 1667 return err;
1670} 1668}
1671 1669
@@ -1982,7 +1980,7 @@ static int check_port_resume_type(struct usb_device *udev,
1982 * 1980 *
1983 * Returns 0 on success, else negative errno. 1981 * Returns 0 on success, else negative errno.
1984 */ 1982 */
1985int usb_port_suspend(struct usb_device *udev) 1983int usb_port_suspend(struct usb_device *udev, pm_message_t msg)
1986{ 1984{
1987 struct usb_hub *hub = hdev_to_hub(udev->parent); 1985 struct usb_hub *hub = hdev_to_hub(udev->parent);
1988 int port1 = udev->portnum; 1986 int port1 = udev->portnum;
@@ -2021,7 +2019,7 @@ int usb_port_suspend(struct usb_device *udev)
2021 } else { 2019 } else {
2022 /* device has up to 10 msec to fully suspend */ 2020 /* device has up to 10 msec to fully suspend */
2023 dev_dbg(&udev->dev, "usb %ssuspend\n", 2021 dev_dbg(&udev->dev, "usb %ssuspend\n",
2024 udev->auto_pm ? "auto-" : ""); 2022 (msg.event & PM_EVENT_AUTO ? "auto-" : ""));
2025 usb_set_device_state(udev, USB_STATE_SUSPENDED); 2023 usb_set_device_state(udev, USB_STATE_SUSPENDED);
2026 msleep(10); 2024 msleep(10);
2027 } 2025 }
@@ -2045,8 +2043,8 @@ static int finish_port_resume(struct usb_device *udev)
2045 u16 devstatus; 2043 u16 devstatus;
2046 2044
2047 /* caller owns the udev device lock */ 2045 /* caller owns the udev device lock */
2048 dev_dbg(&udev->dev, "finish %sresume\n", 2046 dev_dbg(&udev->dev, "%s\n",
2049 udev->reset_resume ? "reset-" : ""); 2047 udev->reset_resume ? "finish reset-resume" : "finish resume");
2050 2048
2051 /* usb ch9 identifies four variants of SUSPENDED, based on what 2049 /* usb ch9 identifies four variants of SUSPENDED, based on what
2052 * state the device resumes to. Linux currently won't see the 2050 * state the device resumes to. Linux currently won't see the
@@ -2098,8 +2096,9 @@ static int finish_port_resume(struct usb_device *udev)
2098 NULL, 0, 2096 NULL, 0,
2099 USB_CTRL_SET_TIMEOUT); 2097 USB_CTRL_SET_TIMEOUT);
2100 if (status) 2098 if (status)
2101 dev_dbg(&udev->dev, "disable remote " 2099 dev_dbg(&udev->dev,
2102 "wakeup, status %d\n", status); 2100 "disable remote wakeup, status %d\n",
2101 status);
2103 } 2102 }
2104 status = 0; 2103 status = 0;
2105 } 2104 }
@@ -2140,7 +2139,7 @@ static int finish_port_resume(struct usb_device *udev)
2140 * 2139 *
2141 * Returns 0 on success, else negative errno. 2140 * Returns 0 on success, else negative errno.
2142 */ 2141 */
2143int usb_port_resume(struct usb_device *udev) 2142int usb_port_resume(struct usb_device *udev, pm_message_t msg)
2144{ 2143{
2145 struct usb_hub *hub = hdev_to_hub(udev->parent); 2144 struct usb_hub *hub = hdev_to_hub(udev->parent);
2146 int port1 = udev->portnum; 2145 int port1 = udev->portnum;
@@ -2165,7 +2164,7 @@ int usb_port_resume(struct usb_device *udev)
2165 } else { 2164 } else {
2166 /* drive resume for at least 20 msec */ 2165 /* drive resume for at least 20 msec */
2167 dev_dbg(&udev->dev, "usb %sresume\n", 2166 dev_dbg(&udev->dev, "usb %sresume\n",
2168 udev->auto_pm ? "auto-" : ""); 2167 (msg.event & PM_EVENT_AUTO ? "auto-" : ""));
2169 msleep(25); 2168 msleep(25);
2170 2169
2171 /* Virtual root hubs can trigger on GET_PORT_STATUS to 2170 /* Virtual root hubs can trigger on GET_PORT_STATUS to
@@ -2206,7 +2205,7 @@ static int remote_wakeup(struct usb_device *udev)
2206 if (udev->state == USB_STATE_SUSPENDED) { 2205 if (udev->state == USB_STATE_SUSPENDED) {
2207 dev_dbg(&udev->dev, "usb %sresume\n", "wakeup-"); 2206 dev_dbg(&udev->dev, "usb %sresume\n", "wakeup-");
2208 usb_mark_last_busy(udev); 2207 usb_mark_last_busy(udev);
2209 status = usb_external_resume_device(udev); 2208 status = usb_external_resume_device(udev, PMSG_REMOTE_RESUME);
2210 } 2209 }
2211 return status; 2210 return status;
2212} 2211}
@@ -2215,14 +2214,14 @@ static int remote_wakeup(struct usb_device *udev)
2215 2214
2216/* When CONFIG_USB_SUSPEND isn't set, we never suspend or resume any ports. */ 2215/* When CONFIG_USB_SUSPEND isn't set, we never suspend or resume any ports. */
2217 2216
2218int usb_port_suspend(struct usb_device *udev) 2217int usb_port_suspend(struct usb_device *udev, pm_message_t msg)
2219{ 2218{
2220 return 0; 2219 return 0;
2221} 2220}
2222 2221
2223/* However we may need to do a reset-resume */ 2222/* However we may need to do a reset-resume */
2224 2223
2225int usb_port_resume(struct usb_device *udev) 2224int usb_port_resume(struct usb_device *udev, pm_message_t msg)
2226{ 2225{
2227 struct usb_hub *hub = hdev_to_hub(udev->parent); 2226 struct usb_hub *hub = hdev_to_hub(udev->parent);
2228 int port1 = udev->portnum; 2227 int port1 = udev->portnum;
@@ -2262,7 +2261,7 @@ static int hub_suspend(struct usb_interface *intf, pm_message_t msg)
2262 2261
2263 udev = hdev->children [port1-1]; 2262 udev = hdev->children [port1-1];
2264 if (udev && udev->can_submit) { 2263 if (udev && udev->can_submit) {
2265 if (!hdev->auto_pm) 2264 if (!(msg.event & PM_EVENT_AUTO))
2266 dev_dbg(&intf->dev, "port %d nyet suspended\n", 2265 dev_dbg(&intf->dev, "port %d nyet suspended\n",
2267 port1); 2266 port1);
2268 return -EBUSY; 2267 return -EBUSY;
@@ -2385,7 +2384,7 @@ void usb_ep0_reinit(struct usb_device *udev)
2385{ 2384{
2386 usb_disable_endpoint(udev, 0 + USB_DIR_IN); 2385 usb_disable_endpoint(udev, 0 + USB_DIR_IN);
2387 usb_disable_endpoint(udev, 0 + USB_DIR_OUT); 2386 usb_disable_endpoint(udev, 0 + USB_DIR_OUT);
2388 usb_enable_endpoint(udev, &udev->ep0); 2387 usb_enable_endpoint(udev, &udev->ep0, true);
2389} 2388}
2390EXPORT_SYMBOL_GPL(usb_ep0_reinit); 2389EXPORT_SYMBOL_GPL(usb_ep0_reinit);
2391 2390
@@ -2582,9 +2581,9 @@ hub_port_init (struct usb_hub *hub, struct usb_device *udev, int port1,
2582 goto fail; 2581 goto fail;
2583 } 2582 }
2584 if (r) { 2583 if (r) {
2585 dev_err(&udev->dev, "device descriptor " 2584 dev_err(&udev->dev,
2586 "read/%s, error %d\n", 2585 "device descriptor read/64, error %d\n",
2587 "64", r); 2586 r);
2588 retval = -EMSGSIZE; 2587 retval = -EMSGSIZE;
2589 continue; 2588 continue;
2590 } 2589 }
@@ -2621,9 +2620,9 @@ hub_port_init (struct usb_hub *hub, struct usb_device *udev, int port1,
2621 2620
2622 retval = usb_get_device_descriptor(udev, 8); 2621 retval = usb_get_device_descriptor(udev, 8);
2623 if (retval < 8) { 2622 if (retval < 8) {
2624 dev_err(&udev->dev, "device descriptor " 2623 dev_err(&udev->dev,
2625 "read/%s, error %d\n", 2624 "device descriptor read/8, error %d\n",
2626 "8", retval); 2625 retval);
2627 if (retval >= 0) 2626 if (retval >= 0)
2628 retval = -EMSGSIZE; 2627 retval = -EMSGSIZE;
2629 } else { 2628 } else {
@@ -2650,8 +2649,8 @@ hub_port_init (struct usb_hub *hub, struct usb_device *udev, int port1,
2650 2649
2651 retval = usb_get_device_descriptor(udev, USB_DT_DEVICE_SIZE); 2650 retval = usb_get_device_descriptor(udev, USB_DT_DEVICE_SIZE);
2652 if (retval < (signed)sizeof(udev->descriptor)) { 2651 if (retval < (signed)sizeof(udev->descriptor)) {
2653 dev_err(&udev->dev, "device descriptor read/%s, error %d\n", 2652 dev_err(&udev->dev, "device descriptor read/all, error %d\n",
2654 "all", retval); 2653 retval);
2655 if (retval >= 0) 2654 if (retval >= 0)
2656 retval = -ENOMSG; 2655 retval = -ENOMSG;
2657 goto fail; 2656 goto fail;
@@ -2719,9 +2718,9 @@ hub_power_remaining (struct usb_hub *hub)
2719 else 2718 else
2720 delta = 8; 2719 delta = 8;
2721 if (delta > hub->mA_per_port) 2720 if (delta > hub->mA_per_port)
2722 dev_warn(&udev->dev, "%dmA is over %umA budget " 2721 dev_warn(&udev->dev,
2723 "for port %d!\n", 2722 "%dmA is over %umA budget for port %d!\n",
2724 delta, hub->mA_per_port, port1); 2723 delta, hub->mA_per_port, port1);
2725 remaining -= delta; 2724 remaining -= delta;
2726 } 2725 }
2727 if (remaining < 0) { 2726 if (remaining < 0) {
@@ -3517,3 +3516,46 @@ int usb_reset_device(struct usb_device *udev)
3517 return ret; 3516 return ret;
3518} 3517}
3519EXPORT_SYMBOL_GPL(usb_reset_device); 3518EXPORT_SYMBOL_GPL(usb_reset_device);
3519
3520
3521/**
3522 * usb_queue_reset_device - Reset a USB device from an atomic context
3523 * @iface: USB interface belonging to the device to reset
3524 *
3525 * This function can be used to reset a USB device from an atomic
3526 * context, where usb_reset_device() won't work (as it blocks).
3527 *
3528 * Doing a reset via this method is functionally equivalent to calling
3529 * usb_reset_device(), except for the fact that it is delayed to a
3530 * workqueue. This means that any drivers bound to other interfaces
3531 * might be unbound, as well as users from usbfs in user space.
3532 *
3533 * Corner cases:
3534 *
3535 * - Scheduling two resets at the same time from two different drivers
3536 * attached to two different interfaces of the same device is
3537 * possible; depending on how the driver attached to each interface
3538 * handles ->pre_reset(), the second reset might happen or not.
3539 *
3540 * - If a driver is unbound and it had a pending reset, the reset will
3541 * be cancelled.
3542 *
3543 * - This function can be called during .probe() or .disconnect()
3544 * times. On return from .disconnect(), any pending resets will be
3545 * cancelled.
3546 *
3547 * There is no no need to lock/unlock the @reset_ws as schedule_work()
3548 * does its own.
3549 *
3550 * NOTE: We don't do any reference count tracking because it is not
3551 * needed. The lifecycle of the work_struct is tied to the
3552 * usb_interface. Before destroying the interface we cancel the
3553 * work_struct, so the fact that work_struct is queued and or
3554 * running means the interface (and thus, the device) exist and
3555 * are referenced.
3556 */
3557void usb_queue_reset_device(struct usb_interface *iface)
3558{
3559 schedule_work(&iface->reset_ws);
3560}
3561EXPORT_SYMBOL_GPL(usb_queue_reset_device);
diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c
index 6d1048faf08e..de51667dd64d 100644
--- a/drivers/usb/core/message.c
+++ b/drivers/usb/core/message.c
@@ -18,6 +18,8 @@
18#include "hcd.h" /* for usbcore internals */ 18#include "hcd.h" /* for usbcore internals */
19#include "usb.h" 19#include "usb.h"
20 20
21static void cancel_async_set_config(struct usb_device *udev);
22
21struct api_context { 23struct api_context {
22 struct completion done; 24 struct completion done;
23 int status; 25 int status;
@@ -139,9 +141,9 @@ int usb_control_msg(struct usb_device *dev, unsigned int pipe, __u8 request,
139 141
140 dr->bRequestType = requesttype; 142 dr->bRequestType = requesttype;
141 dr->bRequest = request; 143 dr->bRequest = request;
142 dr->wValue = cpu_to_le16p(&value); 144 dr->wValue = cpu_to_le16(value);
143 dr->wIndex = cpu_to_le16p(&index); 145 dr->wIndex = cpu_to_le16(index);
144 dr->wLength = cpu_to_le16p(&size); 146 dr->wLength = cpu_to_le16(size);
145 147
146 /* dbg("usb_control_msg"); */ 148 /* dbg("usb_control_msg"); */
147 149
@@ -1004,6 +1006,34 @@ int usb_clear_halt(struct usb_device *dev, int pipe)
1004} 1006}
1005EXPORT_SYMBOL_GPL(usb_clear_halt); 1007EXPORT_SYMBOL_GPL(usb_clear_halt);
1006 1008
1009static int create_intf_ep_devs(struct usb_interface *intf)
1010{
1011 struct usb_device *udev = interface_to_usbdev(intf);
1012 struct usb_host_interface *alt = intf->cur_altsetting;
1013 int i;
1014
1015 if (intf->ep_devs_created || intf->unregistering)
1016 return 0;
1017
1018 for (i = 0; i < alt->desc.bNumEndpoints; ++i)
1019 (void) usb_create_ep_devs(&intf->dev, &alt->endpoint[i], udev);
1020 intf->ep_devs_created = 1;
1021 return 0;
1022}
1023
1024static void remove_intf_ep_devs(struct usb_interface *intf)
1025{
1026 struct usb_host_interface *alt = intf->cur_altsetting;
1027 int i;
1028
1029 if (!intf->ep_devs_created)
1030 return;
1031
1032 for (i = 0; i < alt->desc.bNumEndpoints; ++i)
1033 usb_remove_ep_devs(&alt->endpoint[i]);
1034 intf->ep_devs_created = 0;
1035}
1036
1007/** 1037/**
1008 * usb_disable_endpoint -- Disable an endpoint by address 1038 * usb_disable_endpoint -- Disable an endpoint by address
1009 * @dev: the device whose endpoint is being disabled 1039 * @dev: the device whose endpoint is being disabled
@@ -1092,7 +1122,7 @@ void usb_disable_device(struct usb_device *dev, int skip_ep0)
1092 dev_dbg(&dev->dev, "unregistering interface %s\n", 1122 dev_dbg(&dev->dev, "unregistering interface %s\n",
1093 dev_name(&interface->dev)); 1123 dev_name(&interface->dev));
1094 interface->unregistering = 1; 1124 interface->unregistering = 1;
1095 usb_remove_sysfs_intf_files(interface); 1125 remove_intf_ep_devs(interface);
1096 device_del(&interface->dev); 1126 device_del(&interface->dev);
1097 } 1127 }
1098 1128
@@ -1113,22 +1143,26 @@ void usb_disable_device(struct usb_device *dev, int skip_ep0)
1113 * usb_enable_endpoint - Enable an endpoint for USB communications 1143 * usb_enable_endpoint - Enable an endpoint for USB communications
1114 * @dev: the device whose interface is being enabled 1144 * @dev: the device whose interface is being enabled
1115 * @ep: the endpoint 1145 * @ep: the endpoint
1146 * @reset_toggle: flag to set the endpoint's toggle back to 0
1116 * 1147 *
1117 * Resets the endpoint toggle, and sets dev->ep_{in,out} pointers. 1148 * Resets the endpoint toggle if asked, and sets dev->ep_{in,out} pointers.
1118 * For control endpoints, both the input and output sides are handled. 1149 * For control endpoints, both the input and output sides are handled.
1119 */ 1150 */
1120void usb_enable_endpoint(struct usb_device *dev, struct usb_host_endpoint *ep) 1151void usb_enable_endpoint(struct usb_device *dev, struct usb_host_endpoint *ep,
1152 bool reset_toggle)
1121{ 1153{
1122 int epnum = usb_endpoint_num(&ep->desc); 1154 int epnum = usb_endpoint_num(&ep->desc);
1123 int is_out = usb_endpoint_dir_out(&ep->desc); 1155 int is_out = usb_endpoint_dir_out(&ep->desc);
1124 int is_control = usb_endpoint_xfer_control(&ep->desc); 1156 int is_control = usb_endpoint_xfer_control(&ep->desc);
1125 1157
1126 if (is_out || is_control) { 1158 if (is_out || is_control) {
1127 usb_settoggle(dev, epnum, 1, 0); 1159 if (reset_toggle)
1160 usb_settoggle(dev, epnum, 1, 0);
1128 dev->ep_out[epnum] = ep; 1161 dev->ep_out[epnum] = ep;
1129 } 1162 }
1130 if (!is_out || is_control) { 1163 if (!is_out || is_control) {
1131 usb_settoggle(dev, epnum, 0, 0); 1164 if (reset_toggle)
1165 usb_settoggle(dev, epnum, 0, 0);
1132 dev->ep_in[epnum] = ep; 1166 dev->ep_in[epnum] = ep;
1133 } 1167 }
1134 ep->enabled = 1; 1168 ep->enabled = 1;
@@ -1138,17 +1172,18 @@ void usb_enable_endpoint(struct usb_device *dev, struct usb_host_endpoint *ep)
1138 * usb_enable_interface - Enable all the endpoints for an interface 1172 * usb_enable_interface - Enable all the endpoints for an interface
1139 * @dev: the device whose interface is being enabled 1173 * @dev: the device whose interface is being enabled
1140 * @intf: pointer to the interface descriptor 1174 * @intf: pointer to the interface descriptor
1175 * @reset_toggles: flag to set the endpoints' toggles back to 0
1141 * 1176 *
1142 * Enables all the endpoints for the interface's current altsetting. 1177 * Enables all the endpoints for the interface's current altsetting.
1143 */ 1178 */
1144static void usb_enable_interface(struct usb_device *dev, 1179void usb_enable_interface(struct usb_device *dev,
1145 struct usb_interface *intf) 1180 struct usb_interface *intf, bool reset_toggles)
1146{ 1181{
1147 struct usb_host_interface *alt = intf->cur_altsetting; 1182 struct usb_host_interface *alt = intf->cur_altsetting;
1148 int i; 1183 int i;
1149 1184
1150 for (i = 0; i < alt->desc.bNumEndpoints; ++i) 1185 for (i = 0; i < alt->desc.bNumEndpoints; ++i)
1151 usb_enable_endpoint(dev, &alt->endpoint[i]); 1186 usb_enable_endpoint(dev, &alt->endpoint[i], reset_toggles);
1152} 1187}
1153 1188
1154/** 1189/**
@@ -1235,8 +1270,10 @@ int usb_set_interface(struct usb_device *dev, int interface, int alternate)
1235 */ 1270 */
1236 1271
1237 /* prevent submissions using previous endpoint settings */ 1272 /* prevent submissions using previous endpoint settings */
1238 if (iface->cur_altsetting != alt) 1273 if (iface->cur_altsetting != alt) {
1274 remove_intf_ep_devs(iface);
1239 usb_remove_sysfs_intf_files(iface); 1275 usb_remove_sysfs_intf_files(iface);
1276 }
1240 usb_disable_interface(dev, iface); 1277 usb_disable_interface(dev, iface);
1241 1278
1242 iface->cur_altsetting = alt; 1279 iface->cur_altsetting = alt;
@@ -1271,10 +1308,11 @@ int usb_set_interface(struct usb_device *dev, int interface, int alternate)
1271 * during the SETUP stage - hence EP0 toggles are "don't care" here. 1308 * during the SETUP stage - hence EP0 toggles are "don't care" here.
1272 * (Likewise, EP0 never "halts" on well designed devices.) 1309 * (Likewise, EP0 never "halts" on well designed devices.)
1273 */ 1310 */
1274 usb_enable_interface(dev, iface); 1311 usb_enable_interface(dev, iface, true);
1275 if (device_is_registered(&iface->dev)) 1312 if (device_is_registered(&iface->dev)) {
1276 usb_create_sysfs_intf_files(iface); 1313 usb_create_sysfs_intf_files(iface);
1277 1314 create_intf_ep_devs(iface);
1315 }
1278 return 0; 1316 return 0;
1279} 1317}
1280EXPORT_SYMBOL_GPL(usb_set_interface); 1318EXPORT_SYMBOL_GPL(usb_set_interface);
@@ -1334,7 +1372,6 @@ int usb_reset_configuration(struct usb_device *dev)
1334 struct usb_interface *intf = config->interface[i]; 1372 struct usb_interface *intf = config->interface[i];
1335 struct usb_host_interface *alt; 1373 struct usb_host_interface *alt;
1336 1374
1337 usb_remove_sysfs_intf_files(intf);
1338 alt = usb_altnum_to_altsetting(intf, 0); 1375 alt = usb_altnum_to_altsetting(intf, 0);
1339 1376
1340 /* No altsetting 0? We'll assume the first altsetting. 1377 /* No altsetting 0? We'll assume the first altsetting.
@@ -1345,10 +1382,16 @@ int usb_reset_configuration(struct usb_device *dev)
1345 if (!alt) 1382 if (!alt)
1346 alt = &intf->altsetting[0]; 1383 alt = &intf->altsetting[0];
1347 1384
1385 if (alt != intf->cur_altsetting) {
1386 remove_intf_ep_devs(intf);
1387 usb_remove_sysfs_intf_files(intf);
1388 }
1348 intf->cur_altsetting = alt; 1389 intf->cur_altsetting = alt;
1349 usb_enable_interface(dev, intf); 1390 usb_enable_interface(dev, intf, true);
1350 if (device_is_registered(&intf->dev)) 1391 if (device_is_registered(&intf->dev)) {
1351 usb_create_sysfs_intf_files(intf); 1392 usb_create_sysfs_intf_files(intf);
1393 create_intf_ep_devs(intf);
1394 }
1352 } 1395 }
1353 return 0; 1396 return 0;
1354} 1397}
@@ -1441,6 +1484,46 @@ static struct usb_interface_assoc_descriptor *find_iad(struct usb_device *dev,
1441 return retval; 1484 return retval;
1442} 1485}
1443 1486
1487
1488/*
1489 * Internal function to queue a device reset
1490 *
1491 * This is initialized into the workstruct in 'struct
1492 * usb_device->reset_ws' that is launched by
1493 * message.c:usb_set_configuration() when initializing each 'struct
1494 * usb_interface'.
1495 *
1496 * It is safe to get the USB device without reference counts because
1497 * the life cycle of @iface is bound to the life cycle of @udev. Then,
1498 * this function will be ran only if @iface is alive (and before
1499 * freeing it any scheduled instances of it will have been cancelled).
1500 *
1501 * We need to set a flag (usb_dev->reset_running) because when we call
1502 * the reset, the interfaces might be unbound. The current interface
1503 * cannot try to remove the queued work as it would cause a deadlock
1504 * (you cannot remove your work from within your executing
1505 * workqueue). This flag lets it know, so that
1506 * usb_cancel_queued_reset() doesn't try to do it.
1507 *
1508 * See usb_queue_reset_device() for more details
1509 */
1510void __usb_queue_reset_device(struct work_struct *ws)
1511{
1512 int rc;
1513 struct usb_interface *iface =
1514 container_of(ws, struct usb_interface, reset_ws);
1515 struct usb_device *udev = interface_to_usbdev(iface);
1516
1517 rc = usb_lock_device_for_reset(udev, iface);
1518 if (rc >= 0) {
1519 iface->reset_running = 1;
1520 usb_reset_device(udev);
1521 iface->reset_running = 0;
1522 usb_unlock_device(udev);
1523 }
1524}
1525
1526
1444/* 1527/*
1445 * usb_set_configuration - Makes a particular device setting be current 1528 * usb_set_configuration - Makes a particular device setting be current
1446 * @dev: the device whose configuration is being updated 1529 * @dev: the device whose configuration is being updated
@@ -1560,6 +1643,9 @@ free_interfaces:
1560 if (dev->state != USB_STATE_ADDRESS) 1643 if (dev->state != USB_STATE_ADDRESS)
1561 usb_disable_device(dev, 1); /* Skip ep0 */ 1644 usb_disable_device(dev, 1); /* Skip ep0 */
1562 1645
1646 /* Get rid of pending async Set-Config requests for this device */
1647 cancel_async_set_config(dev);
1648
1563 ret = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), 1649 ret = usb_control_msg(dev, usb_sndctrlpipe(dev, 0),
1564 USB_REQ_SET_CONFIGURATION, 0, configuration, 0, 1650 USB_REQ_SET_CONFIGURATION, 0, configuration, 0,
1565 NULL, 0, USB_CTRL_SET_TIMEOUT); 1651 NULL, 0, USB_CTRL_SET_TIMEOUT);
@@ -1604,13 +1690,14 @@ free_interfaces:
1604 alt = &intf->altsetting[0]; 1690 alt = &intf->altsetting[0];
1605 1691
1606 intf->cur_altsetting = alt; 1692 intf->cur_altsetting = alt;
1607 usb_enable_interface(dev, intf); 1693 usb_enable_interface(dev, intf, true);
1608 intf->dev.parent = &dev->dev; 1694 intf->dev.parent = &dev->dev;
1609 intf->dev.driver = NULL; 1695 intf->dev.driver = NULL;
1610 intf->dev.bus = &usb_bus_type; 1696 intf->dev.bus = &usb_bus_type;
1611 intf->dev.type = &usb_if_device_type; 1697 intf->dev.type = &usb_if_device_type;
1612 intf->dev.groups = usb_interface_groups; 1698 intf->dev.groups = usb_interface_groups;
1613 intf->dev.dma_mask = dev->dev.dma_mask; 1699 intf->dev.dma_mask = dev->dev.dma_mask;
1700 INIT_WORK(&intf->reset_ws, __usb_queue_reset_device);
1614 device_initialize(&intf->dev); 1701 device_initialize(&intf->dev);
1615 mark_quiesced(intf); 1702 mark_quiesced(intf);
1616 dev_set_name(&intf->dev, "%d-%s:%d.%d", 1703 dev_set_name(&intf->dev, "%d-%s:%d.%d",
@@ -1641,17 +1728,21 @@ free_interfaces:
1641 dev_name(&intf->dev), ret); 1728 dev_name(&intf->dev), ret);
1642 continue; 1729 continue;
1643 } 1730 }
1644 usb_create_sysfs_intf_files(intf); 1731 create_intf_ep_devs(intf);
1645 } 1732 }
1646 1733
1647 usb_autosuspend_device(dev); 1734 usb_autosuspend_device(dev);
1648 return 0; 1735 return 0;
1649} 1736}
1650 1737
1738static LIST_HEAD(set_config_list);
1739static DEFINE_SPINLOCK(set_config_lock);
1740
1651struct set_config_request { 1741struct set_config_request {
1652 struct usb_device *udev; 1742 struct usb_device *udev;
1653 int config; 1743 int config;
1654 struct work_struct work; 1744 struct work_struct work;
1745 struct list_head node;
1655}; 1746};
1656 1747
1657/* Worker routine for usb_driver_set_configuration() */ 1748/* Worker routine for usb_driver_set_configuration() */
@@ -1659,14 +1750,35 @@ static void driver_set_config_work(struct work_struct *work)
1659{ 1750{
1660 struct set_config_request *req = 1751 struct set_config_request *req =
1661 container_of(work, struct set_config_request, work); 1752 container_of(work, struct set_config_request, work);
1753 struct usb_device *udev = req->udev;
1754
1755 usb_lock_device(udev);
1756 spin_lock(&set_config_lock);
1757 list_del(&req->node);
1758 spin_unlock(&set_config_lock);
1662 1759
1663 usb_lock_device(req->udev); 1760 if (req->config >= -1) /* Is req still valid? */
1664 usb_set_configuration(req->udev, req->config); 1761 usb_set_configuration(udev, req->config);
1665 usb_unlock_device(req->udev); 1762 usb_unlock_device(udev);
1666 usb_put_dev(req->udev); 1763 usb_put_dev(udev);
1667 kfree(req); 1764 kfree(req);
1668} 1765}
1669 1766
1767/* Cancel pending Set-Config requests for a device whose configuration
1768 * was just changed
1769 */
1770static void cancel_async_set_config(struct usb_device *udev)
1771{
1772 struct set_config_request *req;
1773
1774 spin_lock(&set_config_lock);
1775 list_for_each_entry(req, &set_config_list, node) {
1776 if (req->udev == udev)
1777 req->config = -999; /* Mark as cancelled */
1778 }
1779 spin_unlock(&set_config_lock);
1780}
1781
1670/** 1782/**
1671 * usb_driver_set_configuration - Provide a way for drivers to change device configurations 1783 * usb_driver_set_configuration - Provide a way for drivers to change device configurations
1672 * @udev: the device whose configuration is being updated 1784 * @udev: the device whose configuration is being updated
@@ -1698,6 +1810,10 @@ int usb_driver_set_configuration(struct usb_device *udev, int config)
1698 req->config = config; 1810 req->config = config;
1699 INIT_WORK(&req->work, driver_set_config_work); 1811 INIT_WORK(&req->work, driver_set_config_work);
1700 1812
1813 spin_lock(&set_config_lock);
1814 list_add(&req->node, &set_config_list);
1815 spin_unlock(&set_config_lock);
1816
1701 usb_get_dev(udev); 1817 usb_get_dev(udev);
1702 schedule_work(&req->work); 1818 schedule_work(&req->work);
1703 return 0; 1819 return 0;
diff --git a/drivers/usb/core/sysfs.c b/drivers/usb/core/sysfs.c
index 4fb65fdc9dc3..4cc2456ef3be 100644
--- a/drivers/usb/core/sysfs.c
+++ b/drivers/usb/core/sysfs.c
@@ -359,19 +359,19 @@ set_level(struct device *dev, struct device_attribute *attr,
359 strncmp(buf, on_string, len) == 0) { 359 strncmp(buf, on_string, len) == 0) {
360 udev->autosuspend_disabled = 1; 360 udev->autosuspend_disabled = 1;
361 udev->autoresume_disabled = 0; 361 udev->autoresume_disabled = 0;
362 rc = usb_external_resume_device(udev); 362 rc = usb_external_resume_device(udev, PMSG_USER_RESUME);
363 363
364 } else if (len == sizeof auto_string - 1 && 364 } else if (len == sizeof auto_string - 1 &&
365 strncmp(buf, auto_string, len) == 0) { 365 strncmp(buf, auto_string, len) == 0) {
366 udev->autosuspend_disabled = 0; 366 udev->autosuspend_disabled = 0;
367 udev->autoresume_disabled = 0; 367 udev->autoresume_disabled = 0;
368 rc = usb_external_resume_device(udev); 368 rc = usb_external_resume_device(udev, PMSG_USER_RESUME);
369 369
370 } else if (len == sizeof suspend_string - 1 && 370 } else if (len == sizeof suspend_string - 1 &&
371 strncmp(buf, suspend_string, len) == 0) { 371 strncmp(buf, suspend_string, len) == 0) {
372 udev->autosuspend_disabled = 0; 372 udev->autosuspend_disabled = 0;
373 udev->autoresume_disabled = 1; 373 udev->autoresume_disabled = 1;
374 rc = usb_external_suspend_device(udev, PMSG_SUSPEND); 374 rc = usb_external_suspend_device(udev, PMSG_USER_SUSPEND);
375 375
376 } else 376 } else
377 rc = -EINVAL; 377 rc = -EINVAL;
@@ -629,9 +629,6 @@ int usb_create_sysfs_dev_files(struct usb_device *udev)
629 struct device *dev = &udev->dev; 629 struct device *dev = &udev->dev;
630 int retval; 630 int retval;
631 631
632 /* Unforunately these attributes cannot be created before
633 * the uevent is broadcast.
634 */
635 retval = device_create_bin_file(dev, &dev_bin_attr_descriptors); 632 retval = device_create_bin_file(dev, &dev_bin_attr_descriptors);
636 if (retval) 633 if (retval)
637 goto error; 634 goto error;
@@ -643,11 +640,7 @@ int usb_create_sysfs_dev_files(struct usb_device *udev)
643 retval = add_power_attributes(dev); 640 retval = add_power_attributes(dev);
644 if (retval) 641 if (retval)
645 goto error; 642 goto error;
646 643 return retval;
647 retval = usb_create_ep_files(dev, &udev->ep0, udev);
648 if (retval)
649 goto error;
650 return 0;
651error: 644error:
652 usb_remove_sysfs_dev_files(udev); 645 usb_remove_sysfs_dev_files(udev);
653 return retval; 646 return retval;
@@ -657,7 +650,6 @@ void usb_remove_sysfs_dev_files(struct usb_device *udev)
657{ 650{
658 struct device *dev = &udev->dev; 651 struct device *dev = &udev->dev;
659 652
660 usb_remove_ep_files(&udev->ep0);
661 remove_power_attributes(dev); 653 remove_power_attributes(dev);
662 remove_persist_attributes(dev); 654 remove_persist_attributes(dev);
663 device_remove_bin_file(dev, &dev_bin_attr_descriptors); 655 device_remove_bin_file(dev, &dev_bin_attr_descriptors);
@@ -812,28 +804,6 @@ struct attribute_group *usb_interface_groups[] = {
812 NULL 804 NULL
813}; 805};
814 806
815static inline void usb_create_intf_ep_files(struct usb_interface *intf,
816 struct usb_device *udev)
817{
818 struct usb_host_interface *iface_desc;
819 int i;
820
821 iface_desc = intf->cur_altsetting;
822 for (i = 0; i < iface_desc->desc.bNumEndpoints; ++i)
823 usb_create_ep_files(&intf->dev, &iface_desc->endpoint[i],
824 udev);
825}
826
827static inline void usb_remove_intf_ep_files(struct usb_interface *intf)
828{
829 struct usb_host_interface *iface_desc;
830 int i;
831
832 iface_desc = intf->cur_altsetting;
833 for (i = 0; i < iface_desc->desc.bNumEndpoints; ++i)
834 usb_remove_ep_files(&iface_desc->endpoint[i]);
835}
836
837int usb_create_sysfs_intf_files(struct usb_interface *intf) 807int usb_create_sysfs_intf_files(struct usb_interface *intf)
838{ 808{
839 struct usb_device *udev = interface_to_usbdev(intf); 809 struct usb_device *udev = interface_to_usbdev(intf);
@@ -843,26 +813,19 @@ int usb_create_sysfs_intf_files(struct usb_interface *intf)
843 if (intf->sysfs_files_created || intf->unregistering) 813 if (intf->sysfs_files_created || intf->unregistering)
844 return 0; 814 return 0;
845 815
846 /* The interface string may be present in some altsettings
847 * and missing in others. Hence its attribute cannot be created
848 * before the uevent is broadcast.
849 */
850 if (alt->string == NULL) 816 if (alt->string == NULL)
851 alt->string = usb_cache_string(udev, alt->desc.iInterface); 817 alt->string = usb_cache_string(udev, alt->desc.iInterface);
852 if (alt->string) 818 if (alt->string)
853 retval = device_create_file(&intf->dev, &dev_attr_interface); 819 retval = device_create_file(&intf->dev, &dev_attr_interface);
854 usb_create_intf_ep_files(intf, udev);
855 intf->sysfs_files_created = 1; 820 intf->sysfs_files_created = 1;
856 return 0; 821 return 0;
857} 822}
858 823
859void usb_remove_sysfs_intf_files(struct usb_interface *intf) 824void usb_remove_sysfs_intf_files(struct usb_interface *intf)
860{ 825{
861 struct device *dev = &intf->dev;
862
863 if (!intf->sysfs_files_created) 826 if (!intf->sysfs_files_created)
864 return; 827 return;
865 usb_remove_intf_ep_files(intf); 828
866 device_remove_file(dev, &dev_attr_interface); 829 device_remove_file(&intf->dev, &dev_attr_interface);
867 intf->sysfs_files_created = 0; 830 intf->sysfs_files_created = 0;
868} 831}
diff --git a/drivers/usb/core/urb.c b/drivers/usb/core/urb.c
index 1f68af9db3f7..58bc5e3c2560 100644
--- a/drivers/usb/core/urb.c
+++ b/drivers/usb/core/urb.c
@@ -10,7 +10,6 @@
10 10
11#define to_urb(d) container_of(d, struct urb, kref) 11#define to_urb(d) container_of(d, struct urb, kref)
12 12
13static DEFINE_SPINLOCK(usb_reject_lock);
14 13
15static void urb_destroy(struct kref *kref) 14static void urb_destroy(struct kref *kref)
16{ 15{
@@ -131,9 +130,7 @@ void usb_anchor_urb(struct urb *urb, struct usb_anchor *anchor)
131 urb->anchor = anchor; 130 urb->anchor = anchor;
132 131
133 if (unlikely(anchor->poisoned)) { 132 if (unlikely(anchor->poisoned)) {
134 spin_lock(&usb_reject_lock); 133 atomic_inc(&urb->reject);
135 urb->reject++;
136 spin_unlock(&usb_reject_lock);
137 } 134 }
138 135
139 spin_unlock_irqrestore(&anchor->lock, flags); 136 spin_unlock_irqrestore(&anchor->lock, flags);
@@ -565,16 +562,12 @@ void usb_kill_urb(struct urb *urb)
565 might_sleep(); 562 might_sleep();
566 if (!(urb && urb->dev && urb->ep)) 563 if (!(urb && urb->dev && urb->ep))
567 return; 564 return;
568 spin_lock_irq(&usb_reject_lock); 565 atomic_inc(&urb->reject);
569 ++urb->reject;
570 spin_unlock_irq(&usb_reject_lock);
571 566
572 usb_hcd_unlink_urb(urb, -ENOENT); 567 usb_hcd_unlink_urb(urb, -ENOENT);
573 wait_event(usb_kill_urb_queue, atomic_read(&urb->use_count) == 0); 568 wait_event(usb_kill_urb_queue, atomic_read(&urb->use_count) == 0);
574 569
575 spin_lock_irq(&usb_reject_lock); 570 atomic_dec(&urb->reject);
576 --urb->reject;
577 spin_unlock_irq(&usb_reject_lock);
578} 571}
579EXPORT_SYMBOL_GPL(usb_kill_urb); 572EXPORT_SYMBOL_GPL(usb_kill_urb);
580 573
@@ -606,9 +599,7 @@ void usb_poison_urb(struct urb *urb)
606 might_sleep(); 599 might_sleep();
607 if (!(urb && urb->dev && urb->ep)) 600 if (!(urb && urb->dev && urb->ep))
608 return; 601 return;
609 spin_lock_irq(&usb_reject_lock); 602 atomic_inc(&urb->reject);
610 ++urb->reject;
611 spin_unlock_irq(&usb_reject_lock);
612 603
613 usb_hcd_unlink_urb(urb, -ENOENT); 604 usb_hcd_unlink_urb(urb, -ENOENT);
614 wait_event(usb_kill_urb_queue, atomic_read(&urb->use_count) == 0); 605 wait_event(usb_kill_urb_queue, atomic_read(&urb->use_count) == 0);
@@ -617,14 +608,10 @@ EXPORT_SYMBOL_GPL(usb_poison_urb);
617 608
618void usb_unpoison_urb(struct urb *urb) 609void usb_unpoison_urb(struct urb *urb)
619{ 610{
620 unsigned long flags;
621
622 if (!urb) 611 if (!urb)
623 return; 612 return;
624 613
625 spin_lock_irqsave(&usb_reject_lock, flags); 614 atomic_dec(&urb->reject);
626 --urb->reject;
627 spin_unlock_irqrestore(&usb_reject_lock, flags);
628} 615}
629EXPORT_SYMBOL_GPL(usb_unpoison_urb); 616EXPORT_SYMBOL_GPL(usb_unpoison_urb);
630 617
@@ -692,6 +679,26 @@ void usb_poison_anchored_urbs(struct usb_anchor *anchor)
692EXPORT_SYMBOL_GPL(usb_poison_anchored_urbs); 679EXPORT_SYMBOL_GPL(usb_poison_anchored_urbs);
693 680
694/** 681/**
682 * usb_unpoison_anchored_urbs - let an anchor be used successfully again
683 * @anchor: anchor the requests are bound to
684 *
685 * Reverses the effect of usb_poison_anchored_urbs
686 * the anchor can be used normally after it returns
687 */
688void usb_unpoison_anchored_urbs(struct usb_anchor *anchor)
689{
690 unsigned long flags;
691 struct urb *lazarus;
692
693 spin_lock_irqsave(&anchor->lock, flags);
694 list_for_each_entry(lazarus, &anchor->urb_list, anchor_list) {
695 usb_unpoison_urb(lazarus);
696 }
697 anchor->poisoned = 0;
698 spin_unlock_irqrestore(&anchor->lock, flags);
699}
700EXPORT_SYMBOL_GPL(usb_unpoison_anchored_urbs);
701/**
695 * usb_unlink_anchored_urbs - asynchronously cancel transfer requests en masse 702 * usb_unlink_anchored_urbs - asynchronously cancel transfer requests en masse
696 * @anchor: anchor the requests are bound to 703 * @anchor: anchor the requests are bound to
697 * 704 *
diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c
index 399e15fc5052..dcfc072630c1 100644
--- a/drivers/usb/core/usb.c
+++ b/drivers/usb/core/usb.c
@@ -253,7 +253,7 @@ static int usb_dev_prepare(struct device *dev)
253static void usb_dev_complete(struct device *dev) 253static void usb_dev_complete(struct device *dev)
254{ 254{
255 /* Currently used only for rebinding interfaces */ 255 /* Currently used only for rebinding interfaces */
256 usb_resume(dev); /* Implement eventually? */ 256 usb_resume(dev, PMSG_RESUME); /* Message event is meaningless */
257} 257}
258 258
259static int usb_dev_suspend(struct device *dev) 259static int usb_dev_suspend(struct device *dev)
@@ -263,7 +263,7 @@ static int usb_dev_suspend(struct device *dev)
263 263
264static int usb_dev_resume(struct device *dev) 264static int usb_dev_resume(struct device *dev)
265{ 265{
266 return usb_resume(dev); 266 return usb_resume(dev, PMSG_RESUME);
267} 267}
268 268
269static int usb_dev_freeze(struct device *dev) 269static int usb_dev_freeze(struct device *dev)
@@ -273,7 +273,7 @@ static int usb_dev_freeze(struct device *dev)
273 273
274static int usb_dev_thaw(struct device *dev) 274static int usb_dev_thaw(struct device *dev)
275{ 275{
276 return usb_resume(dev); 276 return usb_resume(dev, PMSG_THAW);
277} 277}
278 278
279static int usb_dev_poweroff(struct device *dev) 279static int usb_dev_poweroff(struct device *dev)
@@ -283,7 +283,7 @@ static int usb_dev_poweroff(struct device *dev)
283 283
284static int usb_dev_restore(struct device *dev) 284static int usb_dev_restore(struct device *dev)
285{ 285{
286 return usb_resume(dev); 286 return usb_resume(dev, PMSG_RESTORE);
287} 287}
288 288
289static struct dev_pm_ops usb_device_pm_ops = { 289static struct dev_pm_ops usb_device_pm_ops = {
@@ -362,7 +362,7 @@ struct usb_device *usb_alloc_dev(struct usb_device *parent,
362 dev->ep0.desc.bLength = USB_DT_ENDPOINT_SIZE; 362 dev->ep0.desc.bLength = USB_DT_ENDPOINT_SIZE;
363 dev->ep0.desc.bDescriptorType = USB_DT_ENDPOINT; 363 dev->ep0.desc.bDescriptorType = USB_DT_ENDPOINT;
364 /* ep0 maxpacket comes later, from device descriptor */ 364 /* ep0 maxpacket comes later, from device descriptor */
365 usb_enable_endpoint(dev, &dev->ep0); 365 usb_enable_endpoint(dev, &dev->ep0, true);
366 dev->can_submit = 1; 366 dev->can_submit = 1;
367 367
368 /* Save readable and stable topology id, distinguishing devices 368 /* Save readable and stable topology id, distinguishing devices
@@ -402,6 +402,7 @@ struct usb_device *usb_alloc_dev(struct usb_device *parent,
402#ifdef CONFIG_PM 402#ifdef CONFIG_PM
403 mutex_init(&dev->pm_mutex); 403 mutex_init(&dev->pm_mutex);
404 INIT_DELAYED_WORK(&dev->autosuspend, usb_autosuspend_work); 404 INIT_DELAYED_WORK(&dev->autosuspend, usb_autosuspend_work);
405 INIT_WORK(&dev->autoresume, usb_autoresume_work);
405 dev->autosuspend_delay = usb_autosuspend_delay * HZ; 406 dev->autosuspend_delay = usb_autosuspend_delay * HZ;
406 dev->connect_time = jiffies; 407 dev->connect_time = jiffies;
407 dev->active_duration = -jiffies; 408 dev->active_duration = -jiffies;
@@ -513,10 +514,7 @@ EXPORT_SYMBOL_GPL(usb_put_intf);
513 * disconnect; in some drivers (such as usb-storage) the disconnect() 514 * disconnect; in some drivers (such as usb-storage) the disconnect()
514 * or suspend() method will block waiting for a device reset to complete. 515 * or suspend() method will block waiting for a device reset to complete.
515 * 516 *
516 * Returns a negative error code for failure, otherwise 1 or 0 to indicate 517 * Returns a negative error code for failure, otherwise 0.
517 * that the device will or will not have to be unlocked. (0 can be
518 * returned when an interface is given and is BINDING, because in that
519 * case the driver already owns the device lock.)
520 */ 518 */
521int usb_lock_device_for_reset(struct usb_device *udev, 519int usb_lock_device_for_reset(struct usb_device *udev,
522 const struct usb_interface *iface) 520 const struct usb_interface *iface)
@@ -527,16 +525,9 @@ int usb_lock_device_for_reset(struct usb_device *udev,
527 return -ENODEV; 525 return -ENODEV;
528 if (udev->state == USB_STATE_SUSPENDED) 526 if (udev->state == USB_STATE_SUSPENDED)
529 return -EHOSTUNREACH; 527 return -EHOSTUNREACH;
530 if (iface) { 528 if (iface && (iface->condition == USB_INTERFACE_UNBINDING ||
531 switch (iface->condition) { 529 iface->condition == USB_INTERFACE_UNBOUND))
532 case USB_INTERFACE_BINDING: 530 return -EINTR;
533 return 0;
534 case USB_INTERFACE_BOUND:
535 break;
536 default:
537 return -EINTR;
538 }
539 }
540 531
541 while (usb_trylock_device(udev) != 0) { 532 while (usb_trylock_device(udev) != 0) {
542 533
@@ -550,10 +541,11 @@ int usb_lock_device_for_reset(struct usb_device *udev,
550 return -ENODEV; 541 return -ENODEV;
551 if (udev->state == USB_STATE_SUSPENDED) 542 if (udev->state == USB_STATE_SUSPENDED)
552 return -EHOSTUNREACH; 543 return -EHOSTUNREACH;
553 if (iface && iface->condition != USB_INTERFACE_BOUND) 544 if (iface && (iface->condition == USB_INTERFACE_UNBINDING ||
545 iface->condition == USB_INTERFACE_UNBOUND))
554 return -EINTR; 546 return -EINTR;
555 } 547 }
556 return 1; 548 return 0;
557} 549}
558EXPORT_SYMBOL_GPL(usb_lock_device_for_reset); 550EXPORT_SYMBOL_GPL(usb_lock_device_for_reset);
559 551
@@ -962,8 +954,12 @@ void usb_buffer_unmap_sg(const struct usb_device *dev, int is_in,
962} 954}
963EXPORT_SYMBOL_GPL(usb_buffer_unmap_sg); 955EXPORT_SYMBOL_GPL(usb_buffer_unmap_sg);
964 956
965/* format to disable USB on kernel command line is: nousb */ 957/* To disable USB, kernel command line is 'nousb' not 'usbcore.nousb' */
966__module_param_call("", nousb, param_set_bool, param_get_bool, &nousb, 0444); 958#ifdef MODULE
959module_param(nousb, bool, 0444);
960#else
961core_param(nousb, nousb, bool, 0444);
962#endif
967 963
968/* 964/*
969 * for external read access to <nousb> 965 * for external read access to <nousb>
@@ -975,6 +971,37 @@ int usb_disabled(void)
975EXPORT_SYMBOL_GPL(usb_disabled); 971EXPORT_SYMBOL_GPL(usb_disabled);
976 972
977/* 973/*
974 * Notifications of device and interface registration
975 */
976static int usb_bus_notify(struct notifier_block *nb, unsigned long action,
977 void *data)
978{
979 struct device *dev = data;
980
981 switch (action) {
982 case BUS_NOTIFY_ADD_DEVICE:
983 if (dev->type == &usb_device_type)
984 (void) usb_create_sysfs_dev_files(to_usb_device(dev));
985 else if (dev->type == &usb_if_device_type)
986 (void) usb_create_sysfs_intf_files(
987 to_usb_interface(dev));
988 break;
989
990 case BUS_NOTIFY_DEL_DEVICE:
991 if (dev->type == &usb_device_type)
992 usb_remove_sysfs_dev_files(to_usb_device(dev));
993 else if (dev->type == &usb_if_device_type)
994 usb_remove_sysfs_intf_files(to_usb_interface(dev));
995 break;
996 }
997 return 0;
998}
999
1000static struct notifier_block usb_bus_nb = {
1001 .notifier_call = usb_bus_notify,
1002};
1003
1004/*
978 * Init 1005 * Init
979 */ 1006 */
980static int __init usb_init(void) 1007static int __init usb_init(void)
@@ -991,6 +1018,9 @@ static int __init usb_init(void)
991 retval = bus_register(&usb_bus_type); 1018 retval = bus_register(&usb_bus_type);
992 if (retval) 1019 if (retval)
993 goto bus_register_failed; 1020 goto bus_register_failed;
1021 retval = bus_register_notifier(&usb_bus_type, &usb_bus_nb);
1022 if (retval)
1023 goto bus_notifier_failed;
994 retval = usb_host_init(); 1024 retval = usb_host_init();
995 if (retval) 1025 if (retval)
996 goto host_init_failed; 1026 goto host_init_failed;
@@ -1025,6 +1055,8 @@ driver_register_failed:
1025major_init_failed: 1055major_init_failed:
1026 usb_host_cleanup(); 1056 usb_host_cleanup();
1027host_init_failed: 1057host_init_failed:
1058 bus_unregister_notifier(&usb_bus_type, &usb_bus_nb);
1059bus_notifier_failed:
1028 bus_unregister(&usb_bus_type); 1060 bus_unregister(&usb_bus_type);
1029bus_register_failed: 1061bus_register_failed:
1030 ksuspend_usb_cleanup(); 1062 ksuspend_usb_cleanup();
@@ -1048,6 +1080,7 @@ static void __exit usb_exit(void)
1048 usb_devio_cleanup(); 1080 usb_devio_cleanup();
1049 usb_hub_cleanup(); 1081 usb_hub_cleanup();
1050 usb_host_cleanup(); 1082 usb_host_cleanup();
1083 bus_unregister_notifier(&usb_bus_type, &usb_bus_nb);
1051 bus_unregister(&usb_bus_type); 1084 bus_unregister(&usb_bus_type);
1052 ksuspend_usb_cleanup(); 1085 ksuspend_usb_cleanup();
1053} 1086}
diff --git a/drivers/usb/core/usb.h b/drivers/usb/core/usb.h
index 9a1a45ac3add..386177867a8a 100644
--- a/drivers/usb/core/usb.h
+++ b/drivers/usb/core/usb.h
@@ -1,16 +1,20 @@
1#include <linux/pm.h>
2
1/* Functions local to drivers/usb/core/ */ 3/* Functions local to drivers/usb/core/ */
2 4
3extern int usb_create_sysfs_dev_files(struct usb_device *dev); 5extern int usb_create_sysfs_dev_files(struct usb_device *dev);
4extern void usb_remove_sysfs_dev_files(struct usb_device *dev); 6extern void usb_remove_sysfs_dev_files(struct usb_device *dev);
5extern int usb_create_sysfs_intf_files(struct usb_interface *intf); 7extern int usb_create_sysfs_intf_files(struct usb_interface *intf);
6extern void usb_remove_sysfs_intf_files(struct usb_interface *intf); 8extern void usb_remove_sysfs_intf_files(struct usb_interface *intf);
7extern int usb_create_ep_files(struct device *parent, 9extern int usb_create_ep_devs(struct device *parent,
8 struct usb_host_endpoint *endpoint, 10 struct usb_host_endpoint *endpoint,
9 struct usb_device *udev); 11 struct usb_device *udev);
10extern void usb_remove_ep_files(struct usb_host_endpoint *endpoint); 12extern void usb_remove_ep_devs(struct usb_host_endpoint *endpoint);
11 13
12extern void usb_enable_endpoint(struct usb_device *dev, 14extern void usb_enable_endpoint(struct usb_device *dev,
13 struct usb_host_endpoint *ep); 15 struct usb_host_endpoint *ep, bool reset_toggle);
16extern void usb_enable_interface(struct usb_device *dev,
17 struct usb_interface *intf, bool reset_toggles);
14extern void usb_disable_endpoint(struct usb_device *dev, unsigned int epaddr); 18extern void usb_disable_endpoint(struct usb_device *dev, unsigned int epaddr);
15extern void usb_disable_interface(struct usb_device *dev, 19extern void usb_disable_interface(struct usb_device *dev,
16 struct usb_interface *intf); 20 struct usb_interface *intf);
@@ -42,14 +46,16 @@ extern void usb_host_cleanup(void);
42#ifdef CONFIG_PM 46#ifdef CONFIG_PM
43 47
44extern int usb_suspend(struct device *dev, pm_message_t msg); 48extern int usb_suspend(struct device *dev, pm_message_t msg);
45extern int usb_resume(struct device *dev); 49extern int usb_resume(struct device *dev, pm_message_t msg);
46 50
47extern void usb_autosuspend_work(struct work_struct *work); 51extern void usb_autosuspend_work(struct work_struct *work);
48extern int usb_port_suspend(struct usb_device *dev); 52extern void usb_autoresume_work(struct work_struct *work);
49extern int usb_port_resume(struct usb_device *dev); 53extern int usb_port_suspend(struct usb_device *dev, pm_message_t msg);
54extern int usb_port_resume(struct usb_device *dev, pm_message_t msg);
50extern int usb_external_suspend_device(struct usb_device *udev, 55extern int usb_external_suspend_device(struct usb_device *udev,
51 pm_message_t msg); 56 pm_message_t msg);
52extern int usb_external_resume_device(struct usb_device *udev); 57extern int usb_external_resume_device(struct usb_device *udev,
58 pm_message_t msg);
53 59
54static inline void usb_pm_lock(struct usb_device *udev) 60static inline void usb_pm_lock(struct usb_device *udev)
55{ 61{
@@ -63,12 +69,12 @@ static inline void usb_pm_unlock(struct usb_device *udev)
63 69
64#else 70#else
65 71
66static inline int usb_port_suspend(struct usb_device *udev) 72static inline int usb_port_suspend(struct usb_device *udev, pm_message_t msg)
67{ 73{
68 return 0; 74 return 0;
69} 75}
70 76
71static inline int usb_port_resume(struct usb_device *udev) 77static inline int usb_port_resume(struct usb_device *udev, pm_message_t msg)
72{ 78{
73 return 0; 79 return 0;
74} 80}
diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig
index dd4cd5a51370..3219d137340a 100644
--- a/drivers/usb/gadget/Kconfig
+++ b/drivers/usb/gadget/Kconfig
@@ -297,13 +297,34 @@ config USB_S3C2410_DEBUG
297 297
298# musb builds in ../musb along with host support 298# musb builds in ../musb along with host support
299config USB_GADGET_MUSB_HDRC 299config USB_GADGET_MUSB_HDRC
300 boolean "Inventra HDRC USB Peripheral (TI, ...)" 300 boolean "Inventra HDRC USB Peripheral (TI, ADI, ...)"
301 depends on USB_MUSB_HDRC && (USB_MUSB_PERIPHERAL || USB_MUSB_OTG) 301 depends on USB_MUSB_HDRC && (USB_MUSB_PERIPHERAL || USB_MUSB_OTG)
302 select USB_GADGET_DUALSPEED 302 select USB_GADGET_DUALSPEED
303 select USB_GADGET_SELECTED 303 select USB_GADGET_SELECTED
304 help 304 help
305 This OTG-capable silicon IP is used in dual designs including 305 This OTG-capable silicon IP is used in dual designs including
306 the TI DaVinci, OMAP 243x, OMAP 343x, and TUSB 6010. 306 the TI DaVinci, OMAP 243x, OMAP 343x, TUSB 6010, and ADI Blackfin
307
308config USB_GADGET_IMX
309 boolean "Freescale IMX USB Peripheral Controller"
310 depends on ARCH_MX1
311 help
312 Freescale's IMX series include an integrated full speed
313 USB 1.1 device controller. The controller in the IMX series
314 is register-compatible.
315
316 It has Six fixed-function endpoints, as well as endpoint
317 zero (for control transfers).
318
319 Say "y" to link the driver statically, or "m" to build a
320 dynamically linked module called "imx_udc" and force all
321 gadget drivers to also be dynamically linked.
322
323config USB_IMX
324 tristate
325 depends on USB_GADGET_IMX
326 default USB_GADGET
327 select USB_GADGET_SELECTED
307 328
308config USB_GADGET_M66592 329config USB_GADGET_M66592
309 boolean "Renesas M66592 USB Peripheral Controller" 330 boolean "Renesas M66592 USB Peripheral Controller"
@@ -377,6 +398,24 @@ config USB_FSL_QE
377 default USB_GADGET 398 default USB_GADGET
378 select USB_GADGET_SELECTED 399 select USB_GADGET_SELECTED
379 400
401config USB_GADGET_CI13XXX
402 boolean "MIPS USB CI13xxx"
403 depends on PCI
404 select USB_GADGET_DUALSPEED
405 help
406 MIPS USB IP core family device controller
407 Currently it only supports IP part number CI13412
408
409 Say "y" to link the driver statically, or "m" to build a
410 dynamically linked module called "ci13xxx_udc" and force all
411 gadget drivers to also be dynamically linked.
412
413config USB_CI13XXX
414 tristate
415 depends on USB_GADGET_CI13XXX
416 default USB_GADGET
417 select USB_GADGET_SELECTED
418
380config USB_GADGET_NET2280 419config USB_GADGET_NET2280
381 boolean "NetChip 228x" 420 boolean "NetChip 228x"
382 depends on PCI 421 depends on PCI
diff --git a/drivers/usb/gadget/Makefile b/drivers/usb/gadget/Makefile
index bd4041b47dce..39a51d746cb7 100644
--- a/drivers/usb/gadget/Makefile
+++ b/drivers/usb/gadget/Makefile
@@ -10,6 +10,7 @@ obj-$(CONFIG_USB_NET2280) += net2280.o
10obj-$(CONFIG_USB_AMD5536UDC) += amd5536udc.o 10obj-$(CONFIG_USB_AMD5536UDC) += amd5536udc.o
11obj-$(CONFIG_USB_PXA25X) += pxa25x_udc.o 11obj-$(CONFIG_USB_PXA25X) += pxa25x_udc.o
12obj-$(CONFIG_USB_PXA27X) += pxa27x_udc.o 12obj-$(CONFIG_USB_PXA27X) += pxa27x_udc.o
13obj-$(CONFIG_USB_IMX) += imx_udc.o
13obj-$(CONFIG_USB_GOKU) += goku_udc.o 14obj-$(CONFIG_USB_GOKU) += goku_udc.o
14obj-$(CONFIG_USB_OMAP) += omap_udc.o 15obj-$(CONFIG_USB_OMAP) += omap_udc.o
15obj-$(CONFIG_USB_LH7A40X) += lh7a40x_udc.o 16obj-$(CONFIG_USB_LH7A40X) += lh7a40x_udc.o
@@ -19,6 +20,7 @@ obj-$(CONFIG_USB_ATMEL_USBA) += atmel_usba_udc.o
19obj-$(CONFIG_USB_FSL_USB2) += fsl_usb2_udc.o 20obj-$(CONFIG_USB_FSL_USB2) += fsl_usb2_udc.o
20obj-$(CONFIG_USB_M66592) += m66592-udc.o 21obj-$(CONFIG_USB_M66592) += m66592-udc.o
21obj-$(CONFIG_USB_FSL_QE) += fsl_qe_udc.o 22obj-$(CONFIG_USB_FSL_QE) += fsl_qe_udc.o
23obj-$(CONFIG_USB_CI13XXX) += ci13xxx_udc.o
22 24
23# 25#
24# USB gadget drivers 26# USB gadget drivers
diff --git a/drivers/usb/gadget/ci13xxx_udc.c b/drivers/usb/gadget/ci13xxx_udc.c
new file mode 100644
index 000000000000..bebf911c7e5f
--- /dev/null
+++ b/drivers/usb/gadget/ci13xxx_udc.c
@@ -0,0 +1,2830 @@
1/*
2 * ci13xxx_udc.c - MIPS USB IP core family device controller
3 *
4 * Copyright (C) 2008 Chipidea - MIPS Technologies, Inc. All rights reserved.
5 *
6 * Author: David Lopo
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 */
12
13/*
14 * Description: MIPS USB IP core family device controller
15 * Currently it only supports IP part number CI13412
16 *
17 * This driver is composed of several blocks:
18 * - HW: hardware interface
19 * - DBG: debug facilities (optional)
20 * - UTIL: utilities
21 * - ISR: interrupts handling
22 * - ENDPT: endpoint operations (Gadget API)
23 * - GADGET: gadget operations (Gadget API)
24 * - BUS: bus glue code, bus abstraction layer
25 * - PCI: PCI core interface and PCI resources (interrupts, memory...)
26 *
27 * Compile Options
28 * - CONFIG_USB_GADGET_DEBUG_FILES: enable debug facilities
29 * - STALL_IN: non-empty bulk-in pipes cannot be halted
30 * if defined mass storage compliance succeeds but with warnings
31 * => case 4: Hi > Dn
32 * => case 5: Hi > Di
33 * => case 8: Hi <> Do
34 * if undefined usbtest 13 fails
35 * - TRACE: enable function tracing (depends on DEBUG)
36 *
37 * Main Features
38 * - Chapter 9 & Mass Storage Compliance with Gadget File Storage
39 * - Chapter 9 Compliance with Gadget Zero (STALL_IN undefined)
40 * - Normal & LPM support
41 *
42 * USBTEST Report
43 * - OK: 0-12, 13 (STALL_IN defined) & 14
44 * - Not Supported: 15 & 16 (ISO)
45 *
46 * TODO List
47 * - OTG
48 * - Isochronous & Interrupt Traffic
49 * - Handle requests which spawns into several TDs
50 * - GET_STATUS(device) - always reports 0
51 * - Gadget API (majority of optional features)
52 * - Suspend & Remote Wakeup
53 */
54#include <linux/device.h>
55#include <linux/dmapool.h>
56#include <linux/dma-mapping.h>
57#include <linux/init.h>
58#include <linux/interrupt.h>
59#include <linux/interrupt.h>
60#include <linux/io.h>
61#include <linux/irq.h>
62#include <linux/kernel.h>
63#include <linux/module.h>
64#include <linux/pci.h>
65#include <linux/usb/ch9.h>
66#include <linux/usb/gadget.h>
67
68#include "ci13xxx_udc.h"
69
70
71/******************************************************************************
72 * DEFINE
73 *****************************************************************************/
74/* ctrl register bank access */
75static DEFINE_SPINLOCK(udc_lock);
76
77/* driver name */
78#define UDC_DRIVER_NAME "ci13xxx_udc"
79
80/* control endpoint description */
81static const struct usb_endpoint_descriptor
82ctrl_endpt_desc = {
83 .bLength = USB_DT_ENDPOINT_SIZE,
84 .bDescriptorType = USB_DT_ENDPOINT,
85
86 .bmAttributes = USB_ENDPOINT_XFER_CONTROL,
87 .wMaxPacketSize = cpu_to_le16(CTRL_PAYLOAD_MAX),
88};
89
90/* UDC descriptor */
91static struct ci13xxx *_udc;
92
93/* Interrupt statistics */
94#define ISR_MASK 0x1F
95static struct {
96 u32 test;
97 u32 ui;
98 u32 uei;
99 u32 pci;
100 u32 uri;
101 u32 sli;
102 u32 none;
103 struct {
104 u32 cnt;
105 u32 buf[ISR_MASK+1];
106 u32 idx;
107 } hndl;
108} isr_statistics;
109
110/**
111 * ffs_nr: find first (least significant) bit set
112 * @x: the word to search
113 *
114 * This function returns bit number (instead of position)
115 */
116static int ffs_nr(u32 x)
117{
118 int n = ffs(x);
119
120 return n ? n-1 : 32;
121}
122
123/******************************************************************************
124 * HW block
125 *****************************************************************************/
126/* register bank descriptor */
127static struct {
128 unsigned lpm; /* is LPM? */
129 void __iomem *abs; /* bus map offset */
130 void __iomem *cap; /* bus map offset + CAP offset + CAP data */
131 size_t size; /* bank size */
132} hw_bank;
133
134/* UDC register map */
135#define ABS_CAPLENGTH (0x100UL)
136#define ABS_HCCPARAMS (0x108UL)
137#define ABS_DCCPARAMS (0x124UL)
138#define ABS_TESTMODE (hw_bank.lpm ? 0x0FCUL : 0x138UL)
139/* offset to CAPLENTGH (addr + data) */
140#define CAP_USBCMD (0x000UL)
141#define CAP_USBSTS (0x004UL)
142#define CAP_USBINTR (0x008UL)
143#define CAP_DEVICEADDR (0x014UL)
144#define CAP_ENDPTLISTADDR (0x018UL)
145#define CAP_PORTSC (0x044UL)
146#define CAP_DEVLC (0x0B4UL)
147#define CAP_USBMODE (hw_bank.lpm ? 0x0C8UL : 0x068UL)
148#define CAP_ENDPTSETUPSTAT (hw_bank.lpm ? 0x0D8UL : 0x06CUL)
149#define CAP_ENDPTPRIME (hw_bank.lpm ? 0x0DCUL : 0x070UL)
150#define CAP_ENDPTFLUSH (hw_bank.lpm ? 0x0E0UL : 0x074UL)
151#define CAP_ENDPTSTAT (hw_bank.lpm ? 0x0E4UL : 0x078UL)
152#define CAP_ENDPTCOMPLETE (hw_bank.lpm ? 0x0E8UL : 0x07CUL)
153#define CAP_ENDPTCTRL (hw_bank.lpm ? 0x0ECUL : 0x080UL)
154#define CAP_LAST (hw_bank.lpm ? 0x12CUL : 0x0C0UL)
155
156/* maximum number of enpoints: valid only after hw_device_reset() */
157static unsigned hw_ep_max;
158
159/**
160 * hw_ep_bit: calculates the bit number
161 * @num: endpoint number
162 * @dir: endpoint direction
163 *
164 * This function returns bit number
165 */
166static inline int hw_ep_bit(int num, int dir)
167{
168 return num + (dir ? 16 : 0);
169}
170
171/**
172 * hw_aread: reads from register bitfield
173 * @addr: address relative to bus map
174 * @mask: bitfield mask
175 *
176 * This function returns register bitfield data
177 */
178static u32 hw_aread(u32 addr, u32 mask)
179{
180 return ioread32(addr + hw_bank.abs) & mask;
181}
182
183/**
184 * hw_awrite: writes to register bitfield
185 * @addr: address relative to bus map
186 * @mask: bitfield mask
187 * @data: new data
188 */
189static void hw_awrite(u32 addr, u32 mask, u32 data)
190{
191 iowrite32(hw_aread(addr, ~mask) | (data & mask),
192 addr + hw_bank.abs);
193}
194
195/**
196 * hw_cread: reads from register bitfield
197 * @addr: address relative to CAP offset plus content
198 * @mask: bitfield mask
199 *
200 * This function returns register bitfield data
201 */
202static u32 hw_cread(u32 addr, u32 mask)
203{
204 return ioread32(addr + hw_bank.cap) & mask;
205}
206
207/**
208 * hw_cwrite: writes to register bitfield
209 * @addr: address relative to CAP offset plus content
210 * @mask: bitfield mask
211 * @data: new data
212 */
213static void hw_cwrite(u32 addr, u32 mask, u32 data)
214{
215 iowrite32(hw_cread(addr, ~mask) | (data & mask),
216 addr + hw_bank.cap);
217}
218
219/**
220 * hw_ctest_and_clear: tests & clears register bitfield
221 * @addr: address relative to CAP offset plus content
222 * @mask: bitfield mask
223 *
224 * This function returns register bitfield data
225 */
226static u32 hw_ctest_and_clear(u32 addr, u32 mask)
227{
228 u32 reg = hw_cread(addr, mask);
229
230 iowrite32(reg, addr + hw_bank.cap);
231 return reg;
232}
233
234/**
235 * hw_ctest_and_write: tests & writes register bitfield
236 * @addr: address relative to CAP offset plus content
237 * @mask: bitfield mask
238 * @data: new data
239 *
240 * This function returns register bitfield data
241 */
242static u32 hw_ctest_and_write(u32 addr, u32 mask, u32 data)
243{
244 u32 reg = hw_cread(addr, ~0);
245
246 iowrite32((reg & ~mask) | (data & mask), addr + hw_bank.cap);
247 return (reg & mask) >> ffs_nr(mask);
248}
249
250/**
251 * hw_device_reset: resets chip (execute without interruption)
252 * @base: register base address
253 *
254 * This function returns an error code
255 */
256static int hw_device_reset(void __iomem *base)
257{
258 u32 reg;
259
260 /* bank is a module variable */
261 hw_bank.abs = base;
262
263 hw_bank.cap = hw_bank.abs;
264 hw_bank.cap += ABS_CAPLENGTH;
265 hw_bank.cap += ioread8(hw_bank.cap);
266
267 reg = hw_aread(ABS_HCCPARAMS, HCCPARAMS_LEN) >> ffs_nr(HCCPARAMS_LEN);
268 hw_bank.lpm = reg;
269 hw_bank.size = hw_bank.cap - hw_bank.abs;
270 hw_bank.size += CAP_LAST;
271 hw_bank.size /= sizeof(u32);
272
273 /* should flush & stop before reset */
274 hw_cwrite(CAP_ENDPTFLUSH, ~0, ~0);
275 hw_cwrite(CAP_USBCMD, USBCMD_RS, 0);
276
277 hw_cwrite(CAP_USBCMD, USBCMD_RST, USBCMD_RST);
278 while (hw_cread(CAP_USBCMD, USBCMD_RST))
279 udelay(10); /* not RTOS friendly */
280
281 /* USBMODE should be configured step by step */
282 hw_cwrite(CAP_USBMODE, USBMODE_CM, USBMODE_CM_IDLE);
283 hw_cwrite(CAP_USBMODE, USBMODE_CM, USBMODE_CM_DEVICE);
284 hw_cwrite(CAP_USBMODE, USBMODE_SLOM, USBMODE_SLOM); /* HW >= 2.3 */
285
286 if (hw_cread(CAP_USBMODE, USBMODE_CM) != USBMODE_CM_DEVICE) {
287 pr_err("cannot enter in device mode");
288 pr_err("lpm = %i", hw_bank.lpm);
289 return -ENODEV;
290 }
291
292 reg = hw_aread(ABS_DCCPARAMS, DCCPARAMS_DEN) >> ffs_nr(DCCPARAMS_DEN);
293 if (reg == 0 || reg > ENDPT_MAX)
294 return -ENODEV;
295
296 hw_ep_max = reg; /* cache hw ENDPT_MAX */
297
298 /* setup lock mode ? */
299
300 /* ENDPTSETUPSTAT is '0' by default */
301
302 /* HCSPARAMS.bf.ppc SHOULD BE zero for device */
303
304 return 0;
305}
306
307/**
308 * hw_device_state: enables/disables interrupts & starts/stops device (execute
309 * without interruption)
310 * @dma: 0 => disable, !0 => enable and set dma engine
311 *
312 * This function returns an error code
313 */
314static int hw_device_state(u32 dma)
315{
316 if (dma) {
317 hw_cwrite(CAP_ENDPTLISTADDR, ~0, dma);
318 /* interrupt, error, port change, reset, sleep/suspend */
319 hw_cwrite(CAP_USBINTR, ~0,
320 USBi_UI|USBi_UEI|USBi_PCI|USBi_URI|USBi_SLI);
321 hw_cwrite(CAP_USBCMD, USBCMD_RS, USBCMD_RS);
322 } else {
323 hw_cwrite(CAP_USBCMD, USBCMD_RS, 0);
324 hw_cwrite(CAP_USBINTR, ~0, 0);
325 }
326 return 0;
327}
328
329/**
330 * hw_ep_flush: flush endpoint fifo (execute without interruption)
331 * @num: endpoint number
332 * @dir: endpoint direction
333 *
334 * This function returns an error code
335 */
336static int hw_ep_flush(int num, int dir)
337{
338 int n = hw_ep_bit(num, dir);
339
340 do {
341 /* flush any pending transfer */
342 hw_cwrite(CAP_ENDPTFLUSH, BIT(n), BIT(n));
343 while (hw_cread(CAP_ENDPTFLUSH, BIT(n)))
344 cpu_relax();
345 } while (hw_cread(CAP_ENDPTSTAT, BIT(n)));
346
347 return 0;
348}
349
350/**
351 * hw_ep_disable: disables endpoint (execute without interruption)
352 * @num: endpoint number
353 * @dir: endpoint direction
354 *
355 * This function returns an error code
356 */
357static int hw_ep_disable(int num, int dir)
358{
359 hw_ep_flush(num, dir);
360 hw_cwrite(CAP_ENDPTCTRL + num * sizeof(u32),
361 dir ? ENDPTCTRL_TXE : ENDPTCTRL_RXE, 0);
362 return 0;
363}
364
365/**
366 * hw_ep_enable: enables endpoint (execute without interruption)
367 * @num: endpoint number
368 * @dir: endpoint direction
369 * @type: endpoint type
370 *
371 * This function returns an error code
372 */
373static int hw_ep_enable(int num, int dir, int type)
374{
375 u32 mask, data;
376
377 if (dir) {
378 mask = ENDPTCTRL_TXT; /* type */
379 data = type << ffs_nr(mask);
380
381 mask |= ENDPTCTRL_TXS; /* unstall */
382 mask |= ENDPTCTRL_TXR; /* reset data toggle */
383 data |= ENDPTCTRL_TXR;
384 mask |= ENDPTCTRL_TXE; /* enable */
385 data |= ENDPTCTRL_TXE;
386 } else {
387 mask = ENDPTCTRL_RXT; /* type */
388 data = type << ffs_nr(mask);
389
390 mask |= ENDPTCTRL_RXS; /* unstall */
391 mask |= ENDPTCTRL_RXR; /* reset data toggle */
392 data |= ENDPTCTRL_RXR;
393 mask |= ENDPTCTRL_RXE; /* enable */
394 data |= ENDPTCTRL_RXE;
395 }
396 hw_cwrite(CAP_ENDPTCTRL + num * sizeof(u32), mask, data);
397 return 0;
398}
399
400/**
401 * hw_ep_get_halt: return endpoint halt status
402 * @num: endpoint number
403 * @dir: endpoint direction
404 *
405 * This function returns 1 if endpoint halted
406 */
407static int hw_ep_get_halt(int num, int dir)
408{
409 u32 mask = dir ? ENDPTCTRL_TXS : ENDPTCTRL_RXS;
410
411 return hw_cread(CAP_ENDPTCTRL + num * sizeof(u32), mask) ? 1 : 0;
412}
413
414/**
415 * hw_ep_is_primed: test if endpoint is primed (execute without interruption)
416 * @num: endpoint number
417 * @dir: endpoint direction
418 *
419 * This function returns true if endpoint primed
420 */
421static int hw_ep_is_primed(int num, int dir)
422{
423 u32 reg = hw_cread(CAP_ENDPTPRIME, ~0) | hw_cread(CAP_ENDPTSTAT, ~0);
424
425 return test_bit(hw_ep_bit(num, dir), (void *)&reg);
426}
427
428/**
429 * hw_test_and_clear_setup_status: test & clear setup status (execute without
430 * interruption)
431 * @n: bit number (endpoint)
432 *
433 * This function returns setup status
434 */
435static int hw_test_and_clear_setup_status(int n)
436{
437 return hw_ctest_and_clear(CAP_ENDPTSETUPSTAT, BIT(n));
438}
439
440/**
441 * hw_ep_prime: primes endpoint (execute without interruption)
442 * @num: endpoint number
443 * @dir: endpoint direction
444 * @is_ctrl: true if control endpoint
445 *
446 * This function returns an error code
447 */
448static int hw_ep_prime(int num, int dir, int is_ctrl)
449{
450 int n = hw_ep_bit(num, dir);
451
452 /* the caller should flush first */
453 if (hw_ep_is_primed(num, dir))
454 return -EBUSY;
455
456 if (is_ctrl && dir == RX && hw_cread(CAP_ENDPTSETUPSTAT, BIT(num)))
457 return -EAGAIN;
458
459 hw_cwrite(CAP_ENDPTPRIME, BIT(n), BIT(n));
460
461 while (hw_cread(CAP_ENDPTPRIME, BIT(n)))
462 cpu_relax();
463 if (is_ctrl && dir == RX && hw_cread(CAP_ENDPTSETUPSTAT, BIT(num)))
464 return -EAGAIN;
465
466 /* status shoult be tested according with manual but it doesn't work */
467 return 0;
468}
469
470/**
471 * hw_ep_set_halt: configures ep halt & resets data toggle after clear (execute
472 * without interruption)
473 * @num: endpoint number
474 * @dir: endpoint direction
475 * @value: true => stall, false => unstall
476 *
477 * This function returns an error code
478 */
479static int hw_ep_set_halt(int num, int dir, int value)
480{
481 if (value != 0 && value != 1)
482 return -EINVAL;
483
484 do {
485 u32 addr = CAP_ENDPTCTRL + num * sizeof(u32);
486 u32 mask_xs = dir ? ENDPTCTRL_TXS : ENDPTCTRL_RXS;
487 u32 mask_xr = dir ? ENDPTCTRL_TXR : ENDPTCTRL_RXR;
488
489 /* data toggle - reserved for EP0 but it's in ESS */
490 hw_cwrite(addr, mask_xs|mask_xr, value ? mask_xs : mask_xr);
491
492 } while (value != hw_ep_get_halt(num, dir));
493
494 return 0;
495}
496
497/**
498 * hw_intr_clear: disables interrupt & clears interrupt status (execute without
499 * interruption)
500 * @n: interrupt bit
501 *
502 * This function returns an error code
503 */
504static int hw_intr_clear(int n)
505{
506 if (n >= REG_BITS)
507 return -EINVAL;
508
509 hw_cwrite(CAP_USBINTR, BIT(n), 0);
510 hw_cwrite(CAP_USBSTS, BIT(n), BIT(n));
511 return 0;
512}
513
514/**
515 * hw_intr_force: enables interrupt & forces interrupt status (execute without
516 * interruption)
517 * @n: interrupt bit
518 *
519 * This function returns an error code
520 */
521static int hw_intr_force(int n)
522{
523 if (n >= REG_BITS)
524 return -EINVAL;
525
526 hw_awrite(ABS_TESTMODE, TESTMODE_FORCE, TESTMODE_FORCE);
527 hw_cwrite(CAP_USBINTR, BIT(n), BIT(n));
528 hw_cwrite(CAP_USBSTS, BIT(n), BIT(n));
529 hw_awrite(ABS_TESTMODE, TESTMODE_FORCE, 0);
530 return 0;
531}
532
533/**
534 * hw_is_port_high_speed: test if port is high speed
535 *
536 * This function returns true if high speed port
537 */
538static int hw_port_is_high_speed(void)
539{
540 return hw_bank.lpm ? hw_cread(CAP_DEVLC, DEVLC_PSPD) :
541 hw_cread(CAP_PORTSC, PORTSC_HSP);
542}
543
544/**
545 * hw_port_test_get: reads port test mode value
546 *
547 * This function returns port test mode value
548 */
549static u8 hw_port_test_get(void)
550{
551 return hw_cread(CAP_PORTSC, PORTSC_PTC) >> ffs_nr(PORTSC_PTC);
552}
553
554/**
555 * hw_port_test_set: writes port test mode (execute without interruption)
556 * @mode: new value
557 *
558 * This function returns an error code
559 */
560static int hw_port_test_set(u8 mode)
561{
562 const u8 TEST_MODE_MAX = 7;
563
564 if (mode > TEST_MODE_MAX)
565 return -EINVAL;
566
567 hw_cwrite(CAP_PORTSC, PORTSC_PTC, mode << ffs_nr(PORTSC_PTC));
568 return 0;
569}
570
571/**
572 * hw_read_intr_enable: returns interrupt enable register
573 *
574 * This function returns register data
575 */
576static u32 hw_read_intr_enable(void)
577{
578 return hw_cread(CAP_USBINTR, ~0);
579}
580
581/**
582 * hw_read_intr_status: returns interrupt status register
583 *
584 * This function returns register data
585 */
586static u32 hw_read_intr_status(void)
587{
588 return hw_cread(CAP_USBSTS, ~0);
589}
590
591/**
592 * hw_register_read: reads all device registers (execute without interruption)
593 * @buf: destination buffer
594 * @size: buffer size
595 *
596 * This function returns number of registers read
597 */
598static size_t hw_register_read(u32 *buf, size_t size)
599{
600 unsigned i;
601
602 if (size > hw_bank.size)
603 size = hw_bank.size;
604
605 for (i = 0; i < size; i++)
606 buf[i] = hw_aread(i * sizeof(u32), ~0);
607
608 return size;
609}
610
611/**
612 * hw_register_write: writes to register
613 * @addr: register address
614 * @data: register value
615 *
616 * This function returns an error code
617 */
618static int hw_register_write(u16 addr, u32 data)
619{
620 /* align */
621 addr /= sizeof(u32);
622
623 if (addr >= hw_bank.size)
624 return -EINVAL;
625
626 /* align */
627 addr *= sizeof(u32);
628
629 hw_awrite(addr, ~0, data);
630 return 0;
631}
632
633/**
634 * hw_test_and_clear_complete: test & clear complete status (execute without
635 * interruption)
636 * @n: bit number (endpoint)
637 *
638 * This function returns complete status
639 */
640static int hw_test_and_clear_complete(int n)
641{
642 return hw_ctest_and_clear(CAP_ENDPTCOMPLETE, BIT(n));
643}
644
645/**
646 * hw_test_and_clear_intr_active: test & clear active interrupts (execute
647 * without interruption)
648 *
649 * This function returns active interrutps
650 */
651static u32 hw_test_and_clear_intr_active(void)
652{
653 u32 reg = hw_read_intr_status() & hw_read_intr_enable();
654
655 hw_cwrite(CAP_USBSTS, ~0, reg);
656 return reg;
657}
658
659/**
660 * hw_test_and_clear_setup_guard: test & clear setup guard (execute without
661 * interruption)
662 *
663 * This function returns guard value
664 */
665static int hw_test_and_clear_setup_guard(void)
666{
667 return hw_ctest_and_write(CAP_USBCMD, USBCMD_SUTW, 0);
668}
669
670/**
671 * hw_test_and_set_setup_guard: test & set setup guard (execute without
672 * interruption)
673 *
674 * This function returns guard value
675 */
676static int hw_test_and_set_setup_guard(void)
677{
678 return hw_ctest_and_write(CAP_USBCMD, USBCMD_SUTW, USBCMD_SUTW);
679}
680
681/**
682 * hw_usb_set_address: configures USB address (execute without interruption)
683 * @value: new USB address
684 *
685 * This function returns an error code
686 */
687static int hw_usb_set_address(u8 value)
688{
689 /* advance */
690 hw_cwrite(CAP_DEVICEADDR, DEVICEADDR_USBADR | DEVICEADDR_USBADRA,
691 value << ffs_nr(DEVICEADDR_USBADR) | DEVICEADDR_USBADRA);
692 return 0;
693}
694
695/**
696 * hw_usb_reset: restart device after a bus reset (execute without
697 * interruption)
698 *
699 * This function returns an error code
700 */
701static int hw_usb_reset(void)
702{
703 hw_usb_set_address(0);
704
705 /* ESS flushes only at end?!? */
706 hw_cwrite(CAP_ENDPTFLUSH, ~0, ~0); /* flush all EPs */
707
708 /* clear setup token semaphores */
709 hw_cwrite(CAP_ENDPTSETUPSTAT, 0, 0); /* writes its content */
710
711 /* clear complete status */
712 hw_cwrite(CAP_ENDPTCOMPLETE, 0, 0); /* writes its content */
713
714 /* wait until all bits cleared */
715 while (hw_cread(CAP_ENDPTPRIME, ~0))
716 udelay(10); /* not RTOS friendly */
717
718 /* reset all endpoints ? */
719
720 /* reset internal status and wait for further instructions
721 no need to verify the port reset status (ESS does it) */
722
723 return 0;
724}
725
726/******************************************************************************
727 * DBG block
728 *****************************************************************************/
729/**
730 * show_device: prints information about device capabilities and status
731 *
732 * Check "device.h" for details
733 */
734static ssize_t show_device(struct device *dev, struct device_attribute *attr,
735 char *buf)
736{
737 struct ci13xxx *udc = container_of(dev, struct ci13xxx, gadget.dev);
738 struct usb_gadget *gadget = &udc->gadget;
739 int n = 0;
740
741 dbg_trace("[%s] %p\n", __func__, buf);
742 if (attr == NULL || buf == NULL) {
743 dev_err(dev, "[%s] EINVAL\n", __func__);
744 return 0;
745 }
746
747 n += scnprintf(buf + n, PAGE_SIZE - n, "speed = %d\n",
748 gadget->speed);
749 n += scnprintf(buf + n, PAGE_SIZE - n, "is_dualspeed = %d\n",
750 gadget->is_dualspeed);
751 n += scnprintf(buf + n, PAGE_SIZE - n, "is_otg = %d\n",
752 gadget->is_otg);
753 n += scnprintf(buf + n, PAGE_SIZE - n, "is_a_peripheral = %d\n",
754 gadget->is_a_peripheral);
755 n += scnprintf(buf + n, PAGE_SIZE - n, "b_hnp_enable = %d\n",
756 gadget->b_hnp_enable);
757 n += scnprintf(buf + n, PAGE_SIZE - n, "a_hnp_support = %d\n",
758 gadget->a_hnp_support);
759 n += scnprintf(buf + n, PAGE_SIZE - n, "a_alt_hnp_support = %d\n",
760 gadget->a_alt_hnp_support);
761 n += scnprintf(buf + n, PAGE_SIZE - n, "name = %s\n",
762 (gadget->name ? gadget->name : ""));
763
764 return n;
765}
766static DEVICE_ATTR(device, S_IRUSR, show_device, NULL);
767
768/**
769 * show_driver: prints information about attached gadget (if any)
770 *
771 * Check "device.h" for details
772 */
773static ssize_t show_driver(struct device *dev, struct device_attribute *attr,
774 char *buf)
775{
776 struct ci13xxx *udc = container_of(dev, struct ci13xxx, gadget.dev);
777 struct usb_gadget_driver *driver = udc->driver;
778 int n = 0;
779
780 dbg_trace("[%s] %p\n", __func__, buf);
781 if (attr == NULL || buf == NULL) {
782 dev_err(dev, "[%s] EINVAL\n", __func__);
783 return 0;
784 }
785
786 if (driver == NULL)
787 return scnprintf(buf, PAGE_SIZE,
788 "There is no gadget attached!\n");
789
790 n += scnprintf(buf + n, PAGE_SIZE - n, "function = %s\n",
791 (driver->function ? driver->function : ""));
792 n += scnprintf(buf + n, PAGE_SIZE - n, "max speed = %d\n",
793 driver->speed);
794
795 return n;
796}
797static DEVICE_ATTR(driver, S_IRUSR, show_driver, NULL);
798
799/* Maximum event message length */
800#define DBG_DATA_MSG 64UL
801
802/* Maximum event messages */
803#define DBG_DATA_MAX 128UL
804
805/* Event buffer descriptor */
806static struct {
807 char (buf[DBG_DATA_MAX])[DBG_DATA_MSG]; /* buffer */
808 unsigned idx; /* index */
809 unsigned tty; /* print to console? */
810 rwlock_t lck; /* lock */
811} dbg_data = {
812 .idx = 0,
813 .tty = 0,
814 .lck = __RW_LOCK_UNLOCKED(lck)
815};
816
817/**
818 * dbg_dec: decrements debug event index
819 * @idx: buffer index
820 */
821static void dbg_dec(unsigned *idx)
822{
823 *idx = (*idx - 1) & (DBG_DATA_MAX-1);
824}
825
826/**
827 * dbg_inc: increments debug event index
828 * @idx: buffer index
829 */
830static void dbg_inc(unsigned *idx)
831{
832 *idx = (*idx + 1) & (DBG_DATA_MAX-1);
833}
834
835/**
836 * dbg_print: prints the common part of the event
837 * @addr: endpoint address
838 * @name: event name
839 * @status: status
840 * @extra: extra information
841 */
842static void dbg_print(u8 addr, const char *name, int status, const char *extra)
843{
844 struct timeval tval;
845 unsigned int stamp;
846 unsigned long flags;
847
848 write_lock_irqsave(&dbg_data.lck, flags);
849
850 do_gettimeofday(&tval);
851 stamp = tval.tv_sec & 0xFFFF; /* 2^32 = 4294967296. Limit to 4096s */
852 stamp = stamp * 1000000 + tval.tv_usec;
853
854 scnprintf(dbg_data.buf[dbg_data.idx], DBG_DATA_MSG,
855 "%04X\t» %02X %-7.7s %4i «\t%s\n",
856 stamp, addr, name, status, extra);
857
858 dbg_inc(&dbg_data.idx);
859
860 write_unlock_irqrestore(&dbg_data.lck, flags);
861
862 if (dbg_data.tty != 0)
863 pr_notice("%04X\t» %02X %-7.7s %4i «\t%s\n",
864 stamp, addr, name, status, extra);
865}
866
867/**
868 * dbg_done: prints a DONE event
869 * @addr: endpoint address
870 * @td: transfer descriptor
871 * @status: status
872 */
873static void dbg_done(u8 addr, const u32 token, int status)
874{
875 char msg[DBG_DATA_MSG];
876
877 scnprintf(msg, sizeof(msg), "%d %02X",
878 (int)(token & TD_TOTAL_BYTES) >> ffs_nr(TD_TOTAL_BYTES),
879 (int)(token & TD_STATUS) >> ffs_nr(TD_STATUS));
880 dbg_print(addr, "DONE", status, msg);
881}
882
883/**
884 * dbg_event: prints a generic event
885 * @addr: endpoint address
886 * @name: event name
887 * @status: status
888 */
889static void dbg_event(u8 addr, const char *name, int status)
890{
891 if (name != NULL)
892 dbg_print(addr, name, status, "");
893}
894
895/*
896 * dbg_queue: prints a QUEUE event
897 * @addr: endpoint address
898 * @req: USB request
899 * @status: status
900 */
901static void dbg_queue(u8 addr, const struct usb_request *req, int status)
902{
903 char msg[DBG_DATA_MSG];
904
905 if (req != NULL) {
906 scnprintf(msg, sizeof(msg),
907 "%d %d", !req->no_interrupt, req->length);
908 dbg_print(addr, "QUEUE", status, msg);
909 }
910}
911
912/**
913 * dbg_setup: prints a SETUP event
914 * @addr: endpoint address
915 * @req: setup request
916 */
917static void dbg_setup(u8 addr, const struct usb_ctrlrequest *req)
918{
919 char msg[DBG_DATA_MSG];
920
921 if (req != NULL) {
922 scnprintf(msg, sizeof(msg),
923 "%02X %02X %04X %04X %d", req->bRequestType,
924 req->bRequest, le16_to_cpu(req->wValue),
925 le16_to_cpu(req->wIndex), le16_to_cpu(req->wLength));
926 dbg_print(addr, "SETUP", 0, msg);
927 }
928}
929
930/**
931 * show_events: displays the event buffer
932 *
933 * Check "device.h" for details
934 */
935static ssize_t show_events(struct device *dev, struct device_attribute *attr,
936 char *buf)
937{
938 unsigned long flags;
939 unsigned i, j, n = 0;
940
941 dbg_trace("[%s] %p\n", __func__, buf);
942 if (attr == NULL || buf == NULL) {
943 dev_err(dev, "[%s] EINVAL\n", __func__);
944 return 0;
945 }
946
947 read_lock_irqsave(&dbg_data.lck, flags);
948
949 i = dbg_data.idx;
950 for (dbg_dec(&i); i != dbg_data.idx; dbg_dec(&i)) {
951 n += strlen(dbg_data.buf[i]);
952 if (n >= PAGE_SIZE) {
953 n -= strlen(dbg_data.buf[i]);
954 break;
955 }
956 }
957 for (j = 0, dbg_inc(&i); j < n; dbg_inc(&i))
958 j += scnprintf(buf + j, PAGE_SIZE - j,
959 "%s", dbg_data.buf[i]);
960
961 read_unlock_irqrestore(&dbg_data.lck, flags);
962
963 return n;
964}
965
966/**
967 * store_events: configure if events are going to be also printed to console
968 *
969 * Check "device.h" for details
970 */
971static ssize_t store_events(struct device *dev, struct device_attribute *attr,
972 const char *buf, size_t count)
973{
974 unsigned tty;
975
976 dbg_trace("[%s] %p, %d\n", __func__, buf, count);
977 if (attr == NULL || buf == NULL) {
978 dev_err(dev, "[%s] EINVAL\n", __func__);
979 goto done;
980 }
981
982 if (sscanf(buf, "%u", &tty) != 1 || tty > 1) {
983 dev_err(dev, "<1|0>: enable|disable console log\n");
984 goto done;
985 }
986
987 dbg_data.tty = tty;
988 dev_info(dev, "tty = %u", dbg_data.tty);
989
990 done:
991 return count;
992}
993static DEVICE_ATTR(events, S_IRUSR | S_IWUSR, show_events, store_events);
994
995/**
996 * show_inters: interrupt status, enable status and historic
997 *
998 * Check "device.h" for details
999 */
1000static ssize_t show_inters(struct device *dev, struct device_attribute *attr,
1001 char *buf)
1002{
1003 struct ci13xxx *udc = container_of(dev, struct ci13xxx, gadget.dev);
1004 unsigned long flags;
1005 u32 intr;
1006 unsigned i, j, n = 0;
1007
1008 dbg_trace("[%s] %p\n", __func__, buf);
1009 if (attr == NULL || buf == NULL) {
1010 dev_err(dev, "[%s] EINVAL\n", __func__);
1011 return 0;
1012 }
1013
1014 spin_lock_irqsave(udc->lock, flags);
1015
1016 n += scnprintf(buf + n, PAGE_SIZE - n,
1017 "status = %08x\n", hw_read_intr_status());
1018 n += scnprintf(buf + n, PAGE_SIZE - n,
1019 "enable = %08x\n", hw_read_intr_enable());
1020
1021 n += scnprintf(buf + n, PAGE_SIZE - n, "*test = %d\n",
1022 isr_statistics.test);
1023 n += scnprintf(buf + n, PAGE_SIZE - n, "» ui = %d\n",
1024 isr_statistics.ui);
1025 n += scnprintf(buf + n, PAGE_SIZE - n, "» uei = %d\n",
1026 isr_statistics.uei);
1027 n += scnprintf(buf + n, PAGE_SIZE - n, "» pci = %d\n",
1028 isr_statistics.pci);
1029 n += scnprintf(buf + n, PAGE_SIZE - n, "» uri = %d\n",
1030 isr_statistics.uri);
1031 n += scnprintf(buf + n, PAGE_SIZE - n, "» sli = %d\n",
1032 isr_statistics.sli);
1033 n += scnprintf(buf + n, PAGE_SIZE - n, "*none = %d\n",
1034 isr_statistics.none);
1035 n += scnprintf(buf + n, PAGE_SIZE - n, "*hndl = %d\n",
1036 isr_statistics.hndl.cnt);
1037
1038 for (i = isr_statistics.hndl.idx, j = 0; j <= ISR_MASK; j++, i++) {
1039 i &= ISR_MASK;
1040 intr = isr_statistics.hndl.buf[i];
1041
1042 if (USBi_UI & intr)
1043 n += scnprintf(buf + n, PAGE_SIZE - n, "ui ");
1044 intr &= ~USBi_UI;
1045 if (USBi_UEI & intr)
1046 n += scnprintf(buf + n, PAGE_SIZE - n, "uei ");
1047 intr &= ~USBi_UEI;
1048 if (USBi_PCI & intr)
1049 n += scnprintf(buf + n, PAGE_SIZE - n, "pci ");
1050 intr &= ~USBi_PCI;
1051 if (USBi_URI & intr)
1052 n += scnprintf(buf + n, PAGE_SIZE - n, "uri ");
1053 intr &= ~USBi_URI;
1054 if (USBi_SLI & intr)
1055 n += scnprintf(buf + n, PAGE_SIZE - n, "sli ");
1056 intr &= ~USBi_SLI;
1057 if (intr)
1058 n += scnprintf(buf + n, PAGE_SIZE - n, "??? ");
1059 if (isr_statistics.hndl.buf[i])
1060 n += scnprintf(buf + n, PAGE_SIZE - n, "\n");
1061 }
1062
1063 spin_unlock_irqrestore(udc->lock, flags);
1064
1065 return n;
1066}
1067
1068/**
1069 * store_inters: enable & force or disable an individual interrutps
1070 * (to be used for test purposes only)
1071 *
1072 * Check "device.h" for details
1073 */
1074static ssize_t store_inters(struct device *dev, struct device_attribute *attr,
1075 const char *buf, size_t count)
1076{
1077 struct ci13xxx *udc = container_of(dev, struct ci13xxx, gadget.dev);
1078 unsigned long flags;
1079 unsigned en, bit;
1080
1081 dbg_trace("[%s] %p, %d\n", __func__, buf, count);
1082 if (attr == NULL || buf == NULL) {
1083 dev_err(dev, "[%s] EINVAL\n", __func__);
1084 goto done;
1085 }
1086
1087 if (sscanf(buf, "%u %u", &en, &bit) != 2 || en > 1) {
1088 dev_err(dev, "<1|0> <bit>: enable|disable interrupt");
1089 goto done;
1090 }
1091
1092 spin_lock_irqsave(udc->lock, flags);
1093 if (en) {
1094 if (hw_intr_force(bit))
1095 dev_err(dev, "invalid bit number\n");
1096 else
1097 isr_statistics.test++;
1098 } else {
1099 if (hw_intr_clear(bit))
1100 dev_err(dev, "invalid bit number\n");
1101 }
1102 spin_unlock_irqrestore(udc->lock, flags);
1103
1104 done:
1105 return count;
1106}
1107static DEVICE_ATTR(inters, S_IRUSR | S_IWUSR, show_inters, store_inters);
1108
1109/**
1110 * show_port_test: reads port test mode
1111 *
1112 * Check "device.h" for details
1113 */
1114static ssize_t show_port_test(struct device *dev,
1115 struct device_attribute *attr, char *buf)
1116{
1117 struct ci13xxx *udc = container_of(dev, struct ci13xxx, gadget.dev);
1118 unsigned long flags;
1119 unsigned mode;
1120
1121 dbg_trace("[%s] %p\n", __func__, buf);
1122 if (attr == NULL || buf == NULL) {
1123 dev_err(dev, "[%s] EINVAL\n", __func__);
1124 return 0;
1125 }
1126
1127 spin_lock_irqsave(udc->lock, flags);
1128 mode = hw_port_test_get();
1129 spin_unlock_irqrestore(udc->lock, flags);
1130
1131 return scnprintf(buf, PAGE_SIZE, "mode = %u\n", mode);
1132}
1133
1134/**
1135 * store_port_test: writes port test mode
1136 *
1137 * Check "device.h" for details
1138 */
1139static ssize_t store_port_test(struct device *dev,
1140 struct device_attribute *attr,
1141 const char *buf, size_t count)
1142{
1143 struct ci13xxx *udc = container_of(dev, struct ci13xxx, gadget.dev);
1144 unsigned long flags;
1145 unsigned mode;
1146
1147 dbg_trace("[%s] %p, %d\n", __func__, buf, count);
1148 if (attr == NULL || buf == NULL) {
1149 dev_err(dev, "[%s] EINVAL\n", __func__);
1150 goto done;
1151 }
1152
1153 if (sscanf(buf, "%u", &mode) != 1) {
1154 dev_err(dev, "<mode>: set port test mode");
1155 goto done;
1156 }
1157
1158 spin_lock_irqsave(udc->lock, flags);
1159 if (hw_port_test_set(mode))
1160 dev_err(dev, "invalid mode\n");
1161 spin_unlock_irqrestore(udc->lock, flags);
1162
1163 done:
1164 return count;
1165}
1166static DEVICE_ATTR(port_test, S_IRUSR | S_IWUSR,
1167 show_port_test, store_port_test);
1168
1169/**
1170 * show_qheads: DMA contents of all queue heads
1171 *
1172 * Check "device.h" for details
1173 */
1174static ssize_t show_qheads(struct device *dev, struct device_attribute *attr,
1175 char *buf)
1176{
1177 struct ci13xxx *udc = container_of(dev, struct ci13xxx, gadget.dev);
1178 unsigned long flags;
1179 unsigned i, j, n = 0;
1180
1181 dbg_trace("[%s] %p\n", __func__, buf);
1182 if (attr == NULL || buf == NULL) {
1183 dev_err(dev, "[%s] EINVAL\n", __func__);
1184 return 0;
1185 }
1186
1187 spin_lock_irqsave(udc->lock, flags);
1188 for (i = 0; i < hw_ep_max; i++) {
1189 struct ci13xxx_ep *mEp = &udc->ci13xxx_ep[i];
1190 n += scnprintf(buf + n, PAGE_SIZE - n,
1191 "EP=%02i: RX=%08X TX=%08X\n",
1192 i, (u32)mEp->qh[RX].dma, (u32)mEp->qh[TX].dma);
1193 for (j = 0; j < (sizeof(struct ci13xxx_qh)/sizeof(u32)); j++) {
1194 n += scnprintf(buf + n, PAGE_SIZE - n,
1195 " %04X: %08X %08X\n", j,
1196 *((u32 *)mEp->qh[RX].ptr + j),
1197 *((u32 *)mEp->qh[TX].ptr + j));
1198 }
1199 }
1200 spin_unlock_irqrestore(udc->lock, flags);
1201
1202 return n;
1203}
1204static DEVICE_ATTR(qheads, S_IRUSR, show_qheads, NULL);
1205
1206/**
1207 * show_registers: dumps all registers
1208 *
1209 * Check "device.h" for details
1210 */
1211static ssize_t show_registers(struct device *dev,
1212 struct device_attribute *attr, char *buf)
1213{
1214 struct ci13xxx *udc = container_of(dev, struct ci13xxx, gadget.dev);
1215 unsigned long flags;
1216 u32 dump[512];
1217 unsigned i, k, n = 0;
1218
1219 dbg_trace("[%s] %p\n", __func__, buf);
1220 if (attr == NULL || buf == NULL) {
1221 dev_err(dev, "[%s] EINVAL\n", __func__);
1222 return 0;
1223 }
1224
1225 spin_lock_irqsave(udc->lock, flags);
1226 k = hw_register_read(dump, sizeof(dump)/sizeof(u32));
1227 spin_unlock_irqrestore(udc->lock, flags);
1228
1229 for (i = 0; i < k; i++) {
1230 n += scnprintf(buf + n, PAGE_SIZE - n,
1231 "reg[0x%04X] = 0x%08X\n",
1232 i * (unsigned)sizeof(u32), dump[i]);
1233 }
1234
1235 return n;
1236}
1237
1238/**
1239 * store_registers: writes value to register address
1240 *
1241 * Check "device.h" for details
1242 */
1243static ssize_t store_registers(struct device *dev,
1244 struct device_attribute *attr,
1245 const char *buf, size_t count)
1246{
1247 struct ci13xxx *udc = container_of(dev, struct ci13xxx, gadget.dev);
1248 unsigned long addr, data, flags;
1249
1250 dbg_trace("[%s] %p, %d\n", __func__, buf, count);
1251 if (attr == NULL || buf == NULL) {
1252 dev_err(dev, "[%s] EINVAL\n", __func__);
1253 goto done;
1254 }
1255
1256 if (sscanf(buf, "%li %li", &addr, &data) != 2) {
1257 dev_err(dev, "<addr> <data>: write data to register address");
1258 goto done;
1259 }
1260
1261 spin_lock_irqsave(udc->lock, flags);
1262 if (hw_register_write(addr, data))
1263 dev_err(dev, "invalid address range\n");
1264 spin_unlock_irqrestore(udc->lock, flags);
1265
1266 done:
1267 return count;
1268}
1269static DEVICE_ATTR(registers, S_IRUSR | S_IWUSR,
1270 show_registers, store_registers);
1271
1272/**
1273 * show_requests: DMA contents of all requests currently queued (all endpts)
1274 *
1275 * Check "device.h" for details
1276 */
1277static ssize_t show_requests(struct device *dev, struct device_attribute *attr,
1278 char *buf)
1279{
1280 struct ci13xxx *udc = container_of(dev, struct ci13xxx, gadget.dev);
1281 unsigned long flags;
1282 struct list_head *ptr = NULL;
1283 struct ci13xxx_req *req = NULL;
1284 unsigned i, j, k, n = 0, qSize = sizeof(struct ci13xxx_td)/sizeof(u32);
1285
1286 dbg_trace("[%s] %p\n", __func__, buf);
1287 if (attr == NULL || buf == NULL) {
1288 dev_err(dev, "[%s] EINVAL\n", __func__);
1289 return 0;
1290 }
1291
1292 spin_lock_irqsave(udc->lock, flags);
1293 for (i = 0; i < hw_ep_max; i++)
1294 for (k = RX; k <= TX; k++)
1295 list_for_each(ptr, &udc->ci13xxx_ep[i].qh[k].queue)
1296 {
1297 req = list_entry(ptr,
1298 struct ci13xxx_req, queue);
1299
1300 n += scnprintf(buf + n, PAGE_SIZE - n,
1301 "EP=%02i: TD=%08X %s\n",
1302 i, (u32)req->dma,
1303 ((k == RX) ? "RX" : "TX"));
1304
1305 for (j = 0; j < qSize; j++)
1306 n += scnprintf(buf + n, PAGE_SIZE - n,
1307 " %04X: %08X\n", j,
1308 *((u32 *)req->ptr + j));
1309 }
1310 spin_unlock_irqrestore(udc->lock, flags);
1311
1312 return n;
1313}
1314static DEVICE_ATTR(requests, S_IRUSR, show_requests, NULL);
1315
1316/**
1317 * dbg_create_files: initializes the attribute interface
1318 * @dev: device
1319 *
1320 * This function returns an error code
1321 */
1322__maybe_unused static int dbg_create_files(struct device *dev)
1323{
1324 int retval = 0;
1325
1326 if (dev == NULL)
1327 return -EINVAL;
1328 retval = device_create_file(dev, &dev_attr_device);
1329 if (retval)
1330 goto done;
1331 retval = device_create_file(dev, &dev_attr_driver);
1332 if (retval)
1333 goto rm_device;
1334 retval = device_create_file(dev, &dev_attr_events);
1335 if (retval)
1336 goto rm_driver;
1337 retval = device_create_file(dev, &dev_attr_inters);
1338 if (retval)
1339 goto rm_events;
1340 retval = device_create_file(dev, &dev_attr_port_test);
1341 if (retval)
1342 goto rm_inters;
1343 retval = device_create_file(dev, &dev_attr_qheads);
1344 if (retval)
1345 goto rm_port_test;
1346 retval = device_create_file(dev, &dev_attr_registers);
1347 if (retval)
1348 goto rm_qheads;
1349 retval = device_create_file(dev, &dev_attr_requests);
1350 if (retval)
1351 goto rm_registers;
1352 return 0;
1353
1354 rm_registers:
1355 device_remove_file(dev, &dev_attr_registers);
1356 rm_qheads:
1357 device_remove_file(dev, &dev_attr_qheads);
1358 rm_port_test:
1359 device_remove_file(dev, &dev_attr_port_test);
1360 rm_inters:
1361 device_remove_file(dev, &dev_attr_inters);
1362 rm_events:
1363 device_remove_file(dev, &dev_attr_events);
1364 rm_driver:
1365 device_remove_file(dev, &dev_attr_driver);
1366 rm_device:
1367 device_remove_file(dev, &dev_attr_device);
1368 done:
1369 return retval;
1370}
1371
1372/**
1373 * dbg_remove_files: destroys the attribute interface
1374 * @dev: device
1375 *
1376 * This function returns an error code
1377 */
1378__maybe_unused static int dbg_remove_files(struct device *dev)
1379{
1380 if (dev == NULL)
1381 return -EINVAL;
1382 device_remove_file(dev, &dev_attr_requests);
1383 device_remove_file(dev, &dev_attr_registers);
1384 device_remove_file(dev, &dev_attr_qheads);
1385 device_remove_file(dev, &dev_attr_port_test);
1386 device_remove_file(dev, &dev_attr_inters);
1387 device_remove_file(dev, &dev_attr_events);
1388 device_remove_file(dev, &dev_attr_driver);
1389 device_remove_file(dev, &dev_attr_device);
1390 return 0;
1391}
1392
1393/******************************************************************************
1394 * UTIL block
1395 *****************************************************************************/
1396/**
1397 * _usb_addr: calculates endpoint address from direction & number
1398 * @ep: endpoint
1399 */
1400static inline u8 _usb_addr(struct ci13xxx_ep *ep)
1401{
1402 return ((ep->dir == TX) ? USB_ENDPOINT_DIR_MASK : 0) | ep->num;
1403}
1404
1405/**
1406 * _hardware_queue: configures a request at hardware level
1407 * @gadget: gadget
1408 * @mEp: endpoint
1409 *
1410 * This function returns an error code
1411 */
1412static int _hardware_enqueue(struct ci13xxx_ep *mEp, struct ci13xxx_req *mReq)
1413{
1414 unsigned i;
1415
1416 trace("%p, %p", mEp, mReq);
1417
1418 /* don't queue twice */
1419 if (mReq->req.status == -EALREADY)
1420 return -EALREADY;
1421
1422 if (hw_ep_is_primed(mEp->num, mEp->dir))
1423 return -EBUSY;
1424
1425 mReq->req.status = -EALREADY;
1426
1427 if (mReq->req.length && !mReq->req.dma) {
1428 mReq->req.dma = \
1429 dma_map_single(mEp->device, mReq->req.buf,
1430 mReq->req.length, mEp->dir ?
1431 DMA_TO_DEVICE : DMA_FROM_DEVICE);
1432 if (mReq->req.dma == 0)
1433 return -ENOMEM;
1434
1435 mReq->map = 1;
1436 }
1437
1438 /*
1439 * TD configuration
1440 * TODO - handle requests which spawns into several TDs
1441 */
1442 memset(mReq->ptr, 0, sizeof(*mReq->ptr));
1443 mReq->ptr->next |= TD_TERMINATE;
1444 mReq->ptr->token = mReq->req.length << ffs_nr(TD_TOTAL_BYTES);
1445 mReq->ptr->token &= TD_TOTAL_BYTES;
1446 mReq->ptr->token |= TD_IOC;
1447 mReq->ptr->token |= TD_STATUS_ACTIVE;
1448 mReq->ptr->page[0] = mReq->req.dma;
1449 for (i = 1; i < 5; i++)
1450 mReq->ptr->page[i] =
1451 (mReq->req.dma + i * PAGE_SIZE) & ~TD_RESERVED_MASK;
1452
1453 /*
1454 * QH configuration
1455 * At this point it's guaranteed exclusive access to qhead
1456 * (endpt is not primed) so it's no need to use tripwire
1457 */
1458 mEp->qh[mEp->dir].ptr->td.next = mReq->dma; /* TERMINATE = 0 */
1459 mEp->qh[mEp->dir].ptr->td.token &= ~TD_STATUS; /* clear status */
1460 if (mReq->req.zero == 0)
1461 mEp->qh[mEp->dir].ptr->cap |= QH_ZLT;
1462 else
1463 mEp->qh[mEp->dir].ptr->cap &= ~QH_ZLT;
1464
1465 wmb(); /* synchronize before ep prime */
1466
1467 return hw_ep_prime(mEp->num, mEp->dir,
1468 mEp->type == USB_ENDPOINT_XFER_CONTROL);
1469}
1470
1471/**
1472 * _hardware_dequeue: handles a request at hardware level
1473 * @gadget: gadget
1474 * @mEp: endpoint
1475 *
1476 * This function returns an error code
1477 */
1478static int _hardware_dequeue(struct ci13xxx_ep *mEp, struct ci13xxx_req *mReq)
1479{
1480 trace("%p, %p", mEp, mReq);
1481
1482 if (mReq->req.status != -EALREADY)
1483 return -EINVAL;
1484
1485 if (hw_ep_is_primed(mEp->num, mEp->dir))
1486 hw_ep_flush(mEp->num, mEp->dir);
1487
1488 mReq->req.status = 0;
1489
1490 if (mReq->map) {
1491 dma_unmap_single(mEp->device, mReq->req.dma, mReq->req.length,
1492 mEp->dir ? DMA_TO_DEVICE : DMA_FROM_DEVICE);
1493 mReq->req.dma = 0;
1494 mReq->map = 0;
1495 }
1496
1497 mReq->req.status = mReq->ptr->token & TD_STATUS;
1498 if ((TD_STATUS_ACTIVE & mReq->req.status) != 0)
1499 mReq->req.status = -ECONNRESET;
1500 else if ((TD_STATUS_HALTED & mReq->req.status) != 0)
1501 mReq->req.status = -1;
1502 else if ((TD_STATUS_DT_ERR & mReq->req.status) != 0)
1503 mReq->req.status = -1;
1504 else if ((TD_STATUS_TR_ERR & mReq->req.status) != 0)
1505 mReq->req.status = -1;
1506
1507 mReq->req.actual = mReq->ptr->token & TD_TOTAL_BYTES;
1508 mReq->req.actual >>= ffs_nr(TD_TOTAL_BYTES);
1509 mReq->req.actual = mReq->req.length - mReq->req.actual;
1510 mReq->req.actual = mReq->req.status ? 0 : mReq->req.actual;
1511
1512 return mReq->req.actual;
1513}
1514
1515/**
1516 * _ep_nuke: dequeues all endpoint requests
1517 * @mEp: endpoint
1518 *
1519 * This function returns an error code
1520 * Caller must hold lock
1521 */
1522static int _ep_nuke(struct ci13xxx_ep *mEp)
1523__releases(mEp->lock)
1524__acquires(mEp->lock)
1525{
1526 trace("%p", mEp);
1527
1528 if (mEp == NULL)
1529 return -EINVAL;
1530
1531 hw_ep_flush(mEp->num, mEp->dir);
1532
1533 while (!list_empty(&mEp->qh[mEp->dir].queue)) {
1534
1535 /* pop oldest request */
1536 struct ci13xxx_req *mReq = \
1537 list_entry(mEp->qh[mEp->dir].queue.next,
1538 struct ci13xxx_req, queue);
1539 list_del_init(&mReq->queue);
1540 mReq->req.status = -ESHUTDOWN;
1541
1542 if (!mReq->req.no_interrupt && mReq->req.complete != NULL) {
1543 spin_unlock(mEp->lock);
1544 mReq->req.complete(&mEp->ep, &mReq->req);
1545 spin_lock(mEp->lock);
1546 }
1547 }
1548 return 0;
1549}
1550
1551/**
1552 * _gadget_stop_activity: stops all USB activity, flushes & disables all endpts
1553 * @gadget: gadget
1554 *
1555 * This function returns an error code
1556 * Caller must hold lock
1557 */
1558static int _gadget_stop_activity(struct usb_gadget *gadget)
1559__releases(udc->lock)
1560__acquires(udc->lock)
1561{
1562 struct usb_ep *ep;
1563 struct ci13xxx *udc = container_of(gadget, struct ci13xxx, gadget);
1564 struct ci13xxx_ep *mEp = container_of(gadget->ep0,
1565 struct ci13xxx_ep, ep);
1566
1567 trace("%p", gadget);
1568
1569 if (gadget == NULL)
1570 return -EINVAL;
1571
1572 spin_unlock(udc->lock);
1573
1574 /* flush all endpoints */
1575 gadget_for_each_ep(ep, gadget) {
1576 usb_ep_fifo_flush(ep);
1577 }
1578 usb_ep_fifo_flush(gadget->ep0);
1579
1580 udc->driver->disconnect(gadget);
1581
1582 /* make sure to disable all endpoints */
1583 gadget_for_each_ep(ep, gadget) {
1584 usb_ep_disable(ep);
1585 }
1586 usb_ep_disable(gadget->ep0);
1587
1588 if (mEp->status != NULL) {
1589 usb_ep_free_request(gadget->ep0, mEp->status);
1590 mEp->status = NULL;
1591 }
1592
1593 spin_lock(udc->lock);
1594
1595 return 0;
1596}
1597
1598/******************************************************************************
1599 * ISR block
1600 *****************************************************************************/
1601/**
1602 * isr_reset_handler: USB reset interrupt handler
1603 * @udc: UDC device
1604 *
1605 * This function resets USB engine after a bus reset occurred
1606 */
1607static void isr_reset_handler(struct ci13xxx *udc)
1608__releases(udc->lock)
1609__acquires(udc->lock)
1610{
1611 struct ci13xxx_ep *mEp = &udc->ci13xxx_ep[0];
1612 int retval;
1613
1614 trace("%p", udc);
1615
1616 if (udc == NULL) {
1617 err("EINVAL");
1618 return;
1619 }
1620
1621 dbg_event(0xFF, "BUS RST", 0);
1622
1623 retval = _gadget_stop_activity(&udc->gadget);
1624 if (retval)
1625 goto done;
1626
1627 retval = hw_usb_reset();
1628 if (retval)
1629 goto done;
1630
1631 spin_unlock(udc->lock);
1632 retval = usb_ep_enable(&mEp->ep, &ctrl_endpt_desc);
1633 if (!retval) {
1634 mEp->status = usb_ep_alloc_request(&mEp->ep, GFP_KERNEL);
1635 if (mEp->status == NULL) {
1636 usb_ep_disable(&mEp->ep);
1637 retval = -ENOMEM;
1638 }
1639 }
1640 spin_lock(udc->lock);
1641
1642 done:
1643 if (retval)
1644 err("error: %i", retval);
1645}
1646
1647/**
1648 * isr_get_status_complete: get_status request complete function
1649 * @ep: endpoint
1650 * @req: request handled
1651 *
1652 * Caller must release lock
1653 */
1654static void isr_get_status_complete(struct usb_ep *ep, struct usb_request *req)
1655{
1656 trace("%p, %p", ep, req);
1657
1658 if (ep == NULL || req == NULL) {
1659 err("EINVAL");
1660 return;
1661 }
1662
1663 kfree(req->buf);
1664 usb_ep_free_request(ep, req);
1665}
1666
1667/**
1668 * isr_get_status_response: get_status request response
1669 * @ep: endpoint
1670 * @setup: setup request packet
1671 *
1672 * This function returns an error code
1673 */
1674static int isr_get_status_response(struct ci13xxx_ep *mEp,
1675 struct usb_ctrlrequest *setup)
1676__releases(mEp->lock)
1677__acquires(mEp->lock)
1678{
1679 struct usb_request *req = NULL;
1680 gfp_t gfp_flags = GFP_ATOMIC;
1681 int dir, num, retval;
1682
1683 trace("%p, %p", mEp, setup);
1684
1685 if (mEp == NULL || setup == NULL)
1686 return -EINVAL;
1687
1688 spin_unlock(mEp->lock);
1689 req = usb_ep_alloc_request(&mEp->ep, gfp_flags);
1690 spin_lock(mEp->lock);
1691 if (req == NULL)
1692 return -ENOMEM;
1693
1694 req->complete = isr_get_status_complete;
1695 req->length = 2;
1696 req->buf = kzalloc(req->length, gfp_flags);
1697 if (req->buf == NULL) {
1698 retval = -ENOMEM;
1699 goto err_free_req;
1700 }
1701
1702 if ((setup->bRequestType & USB_RECIP_MASK) == USB_RECIP_DEVICE) {
1703 /* TODO: D1 - Remote Wakeup; D0 - Self Powered */
1704 retval = 0;
1705 } else if ((setup->bRequestType & USB_RECIP_MASK) \
1706 == USB_RECIP_ENDPOINT) {
1707 dir = (le16_to_cpu(setup->wIndex) & USB_ENDPOINT_DIR_MASK) ?
1708 TX : RX;
1709 num = le16_to_cpu(setup->wIndex) & USB_ENDPOINT_NUMBER_MASK;
1710 *((u16 *)req->buf) = hw_ep_get_halt(num, dir);
1711 }
1712 /* else do nothing; reserved for future use */
1713
1714 spin_unlock(mEp->lock);
1715 retval = usb_ep_queue(&mEp->ep, req, gfp_flags);
1716 spin_lock(mEp->lock);
1717 if (retval)
1718 goto err_free_buf;
1719
1720 return 0;
1721
1722 err_free_buf:
1723 kfree(req->buf);
1724 err_free_req:
1725 spin_unlock(mEp->lock);
1726 usb_ep_free_request(&mEp->ep, req);
1727 spin_lock(mEp->lock);
1728 return retval;
1729}
1730
1731/**
1732 * isr_setup_status_phase: queues the status phase of a setup transation
1733 * @mEp: endpoint
1734 *
1735 * This function returns an error code
1736 */
1737static int isr_setup_status_phase(struct ci13xxx_ep *mEp)
1738__releases(mEp->lock)
1739__acquires(mEp->lock)
1740{
1741 int retval;
1742
1743 trace("%p", mEp);
1744
1745 /* mEp is always valid & configured */
1746
1747 if (mEp->type == USB_ENDPOINT_XFER_CONTROL)
1748 mEp->dir = (mEp->dir == TX) ? RX : TX;
1749
1750 mEp->status->no_interrupt = 1;
1751
1752 spin_unlock(mEp->lock);
1753 retval = usb_ep_queue(&mEp->ep, mEp->status, GFP_ATOMIC);
1754 spin_lock(mEp->lock);
1755
1756 return retval;
1757}
1758
1759/**
1760 * isr_tr_complete_low: transaction complete low level handler
1761 * @mEp: endpoint
1762 *
1763 * This function returns an error code
1764 * Caller must hold lock
1765 */
1766static int isr_tr_complete_low(struct ci13xxx_ep *mEp)
1767__releases(mEp->lock)
1768__acquires(mEp->lock)
1769{
1770 struct ci13xxx_req *mReq;
1771 int retval;
1772
1773 trace("%p", mEp);
1774
1775 if (list_empty(&mEp->qh[mEp->dir].queue))
1776 return -EINVAL;
1777
1778 /* pop oldest request */
1779 mReq = list_entry(mEp->qh[mEp->dir].queue.next,
1780 struct ci13xxx_req, queue);
1781 list_del_init(&mReq->queue);
1782
1783 retval = _hardware_dequeue(mEp, mReq);
1784 if (retval < 0) {
1785 dbg_event(_usb_addr(mEp), "DONE", retval);
1786 goto done;
1787 }
1788
1789 dbg_done(_usb_addr(mEp), mReq->ptr->token, retval);
1790
1791 if (!mReq->req.no_interrupt && mReq->req.complete != NULL) {
1792 spin_unlock(mEp->lock);
1793 mReq->req.complete(&mEp->ep, &mReq->req);
1794 spin_lock(mEp->lock);
1795 }
1796
1797 if (!list_empty(&mEp->qh[mEp->dir].queue)) {
1798 mReq = list_entry(mEp->qh[mEp->dir].queue.next,
1799 struct ci13xxx_req, queue);
1800 _hardware_enqueue(mEp, mReq);
1801 }
1802
1803 done:
1804 return retval;
1805}
1806
1807/**
1808 * isr_tr_complete_handler: transaction complete interrupt handler
1809 * @udc: UDC descriptor
1810 *
1811 * This function handles traffic events
1812 */
1813static void isr_tr_complete_handler(struct ci13xxx *udc)
1814__releases(udc->lock)
1815__acquires(udc->lock)
1816{
1817 unsigned i;
1818
1819 trace("%p", udc);
1820
1821 if (udc == NULL) {
1822 err("EINVAL");
1823 return;
1824 }
1825
1826 for (i = 0; i < hw_ep_max; i++) {
1827 struct ci13xxx_ep *mEp = &udc->ci13xxx_ep[i];
1828 int type, num, err = -EINVAL;
1829 struct usb_ctrlrequest req;
1830
1831
1832 if (mEp->desc == NULL)
1833 continue; /* not configured */
1834
1835 if ((mEp->dir == RX && hw_test_and_clear_complete(i)) ||
1836 (mEp->dir == TX && hw_test_and_clear_complete(i + 16))) {
1837 err = isr_tr_complete_low(mEp);
1838 if (mEp->type == USB_ENDPOINT_XFER_CONTROL) {
1839 if (err > 0) /* needs status phase */
1840 err = isr_setup_status_phase(mEp);
1841 if (err < 0) {
1842 dbg_event(_usb_addr(mEp),
1843 "ERROR", err);
1844 spin_unlock(udc->lock);
1845 if (usb_ep_set_halt(&mEp->ep))
1846 err("error: ep_set_halt");
1847 spin_lock(udc->lock);
1848 }
1849 }
1850 }
1851
1852 if (mEp->type != USB_ENDPOINT_XFER_CONTROL ||
1853 !hw_test_and_clear_setup_status(i))
1854 continue;
1855
1856 if (i != 0) {
1857 warn("ctrl traffic received at endpoint");
1858 continue;
1859 }
1860
1861 /* read_setup_packet */
1862 do {
1863 hw_test_and_set_setup_guard();
1864 memcpy(&req, &mEp->qh[RX].ptr->setup, sizeof(req));
1865 } while (!hw_test_and_clear_setup_guard());
1866
1867 type = req.bRequestType;
1868
1869 mEp->dir = (type & USB_DIR_IN) ? TX : RX;
1870
1871 dbg_setup(_usb_addr(mEp), &req);
1872
1873 switch (req.bRequest) {
1874 case USB_REQ_CLEAR_FEATURE:
1875 if (type != (USB_DIR_OUT|USB_RECIP_ENDPOINT) &&
1876 le16_to_cpu(req.wValue) != USB_ENDPOINT_HALT)
1877 goto delegate;
1878 if (req.wLength != 0)
1879 break;
1880 num = le16_to_cpu(req.wIndex);
1881 num &= USB_ENDPOINT_NUMBER_MASK;
1882 if (!udc->ci13xxx_ep[num].wedge) {
1883 spin_unlock(udc->lock);
1884 err = usb_ep_clear_halt(
1885 &udc->ci13xxx_ep[num].ep);
1886 spin_lock(udc->lock);
1887 if (err)
1888 break;
1889 }
1890 err = isr_setup_status_phase(mEp);
1891 break;
1892 case USB_REQ_GET_STATUS:
1893 if (type != (USB_DIR_IN|USB_RECIP_DEVICE) &&
1894 type != (USB_DIR_IN|USB_RECIP_ENDPOINT) &&
1895 type != (USB_DIR_IN|USB_RECIP_INTERFACE))
1896 goto delegate;
1897 if (le16_to_cpu(req.wLength) != 2 ||
1898 le16_to_cpu(req.wValue) != 0)
1899 break;
1900 err = isr_get_status_response(mEp, &req);
1901 break;
1902 case USB_REQ_SET_ADDRESS:
1903 if (type != (USB_DIR_OUT|USB_RECIP_DEVICE))
1904 goto delegate;
1905 if (le16_to_cpu(req.wLength) != 0 ||
1906 le16_to_cpu(req.wIndex) != 0)
1907 break;
1908 err = hw_usb_set_address((u8)le16_to_cpu(req.wValue));
1909 if (err)
1910 break;
1911 err = isr_setup_status_phase(mEp);
1912 break;
1913 case USB_REQ_SET_FEATURE:
1914 if (type != (USB_DIR_OUT|USB_RECIP_ENDPOINT) &&
1915 le16_to_cpu(req.wValue) != USB_ENDPOINT_HALT)
1916 goto delegate;
1917 if (req.wLength != 0)
1918 break;
1919 num = le16_to_cpu(req.wIndex);
1920 num &= USB_ENDPOINT_NUMBER_MASK;
1921
1922 spin_unlock(udc->lock);
1923 err = usb_ep_set_halt(&udc->ci13xxx_ep[num].ep);
1924 spin_lock(udc->lock);
1925 if (err)
1926 break;
1927 err = isr_setup_status_phase(mEp);
1928 break;
1929 default:
1930delegate:
1931 if (req.wLength == 0) /* no data phase */
1932 mEp->dir = TX;
1933
1934 spin_unlock(udc->lock);
1935 err = udc->driver->setup(&udc->gadget, &req);
1936 spin_lock(udc->lock);
1937 break;
1938 }
1939
1940 if (err < 0) {
1941 dbg_event(_usb_addr(mEp), "ERROR", err);
1942
1943 spin_unlock(udc->lock);
1944 if (usb_ep_set_halt(&mEp->ep))
1945 err("error: ep_set_halt");
1946 spin_lock(udc->lock);
1947 }
1948 }
1949}
1950
1951/******************************************************************************
1952 * ENDPT block
1953 *****************************************************************************/
1954/**
1955 * ep_enable: configure endpoint, making it usable
1956 *
1957 * Check usb_ep_enable() at "usb_gadget.h" for details
1958 */
1959static int ep_enable(struct usb_ep *ep,
1960 const struct usb_endpoint_descriptor *desc)
1961{
1962 struct ci13xxx_ep *mEp = container_of(ep, struct ci13xxx_ep, ep);
1963 int direction, retval = 0;
1964 unsigned long flags;
1965
1966 trace("%p, %p", ep, desc);
1967
1968 if (ep == NULL || desc == NULL)
1969 return -EINVAL;
1970
1971 spin_lock_irqsave(mEp->lock, flags);
1972
1973 /* only internal SW should enable ctrl endpts */
1974
1975 mEp->desc = desc;
1976
1977 if (!list_empty(&mEp->qh[mEp->dir].queue))
1978 warn("enabling a non-empty endpoint!");
1979
1980 mEp->dir = (desc->bEndpointAddress & USB_ENDPOINT_DIR_MASK) ? TX : RX;
1981 mEp->num = desc->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK;
1982 mEp->type = desc->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK;
1983
1984 mEp->ep.maxpacket = __constant_le16_to_cpu(desc->wMaxPacketSize);
1985
1986 direction = mEp->dir;
1987 do {
1988 dbg_event(_usb_addr(mEp), "ENABLE", 0);
1989
1990 if (mEp->type == USB_ENDPOINT_XFER_CONTROL)
1991 mEp->qh[mEp->dir].ptr->cap |= QH_IOS;
1992 else if (mEp->type == USB_ENDPOINT_XFER_ISOC)
1993 mEp->qh[mEp->dir].ptr->cap &= ~QH_MULT;
1994 else
1995 mEp->qh[mEp->dir].ptr->cap &= ~QH_ZLT;
1996
1997 mEp->qh[mEp->dir].ptr->cap |=
1998 (mEp->ep.maxpacket << ffs_nr(QH_MAX_PKT)) & QH_MAX_PKT;
1999 mEp->qh[mEp->dir].ptr->td.next |= TD_TERMINATE; /* needed? */
2000
2001 retval |= hw_ep_enable(mEp->num, mEp->dir, mEp->type);
2002
2003 if (mEp->type == USB_ENDPOINT_XFER_CONTROL)
2004 mEp->dir = (mEp->dir == TX) ? RX : TX;
2005
2006 } while (mEp->dir != direction);
2007
2008 spin_unlock_irqrestore(mEp->lock, flags);
2009 return retval;
2010}
2011
2012/**
2013 * ep_disable: endpoint is no longer usable
2014 *
2015 * Check usb_ep_disable() at "usb_gadget.h" for details
2016 */
2017static int ep_disable(struct usb_ep *ep)
2018{
2019 struct ci13xxx_ep *mEp = container_of(ep, struct ci13xxx_ep, ep);
2020 int direction, retval = 0;
2021 unsigned long flags;
2022
2023 trace("%p", ep);
2024
2025 if (ep == NULL)
2026 return -EINVAL;
2027 else if (mEp->desc == NULL)
2028 return -EBUSY;
2029
2030 spin_lock_irqsave(mEp->lock, flags);
2031
2032 /* only internal SW should disable ctrl endpts */
2033
2034 direction = mEp->dir;
2035 do {
2036 dbg_event(_usb_addr(mEp), "DISABLE", 0);
2037
2038 retval |= _ep_nuke(mEp);
2039 retval |= hw_ep_disable(mEp->num, mEp->dir);
2040
2041 if (mEp->type == USB_ENDPOINT_XFER_CONTROL)
2042 mEp->dir = (mEp->dir == TX) ? RX : TX;
2043
2044 } while (mEp->dir != direction);
2045
2046 mEp->desc = NULL;
2047
2048 spin_unlock_irqrestore(mEp->lock, flags);
2049 return retval;
2050}
2051
2052/**
2053 * ep_alloc_request: allocate a request object to use with this endpoint
2054 *
2055 * Check usb_ep_alloc_request() at "usb_gadget.h" for details
2056 */
2057static struct usb_request *ep_alloc_request(struct usb_ep *ep, gfp_t gfp_flags)
2058{
2059 struct ci13xxx_ep *mEp = container_of(ep, struct ci13xxx_ep, ep);
2060 struct ci13xxx_req *mReq = NULL;
2061 unsigned long flags;
2062
2063 trace("%p, %i", ep, gfp_flags);
2064
2065 if (ep == NULL) {
2066 err("EINVAL");
2067 return NULL;
2068 }
2069
2070 spin_lock_irqsave(mEp->lock, flags);
2071
2072 mReq = kzalloc(sizeof(struct ci13xxx_req), gfp_flags);
2073 if (mReq != NULL) {
2074 INIT_LIST_HEAD(&mReq->queue);
2075
2076 mReq->ptr = dma_pool_alloc(mEp->td_pool, gfp_flags,
2077 &mReq->dma);
2078 if (mReq->ptr == NULL) {
2079 kfree(mReq);
2080 mReq = NULL;
2081 }
2082 }
2083
2084 dbg_event(_usb_addr(mEp), "ALLOC", mReq == NULL);
2085
2086 spin_unlock_irqrestore(mEp->lock, flags);
2087
2088 return (mReq == NULL) ? NULL : &mReq->req;
2089}
2090
2091/**
2092 * ep_free_request: frees a request object
2093 *
2094 * Check usb_ep_free_request() at "usb_gadget.h" for details
2095 */
2096static void ep_free_request(struct usb_ep *ep, struct usb_request *req)
2097{
2098 struct ci13xxx_ep *mEp = container_of(ep, struct ci13xxx_ep, ep);
2099 struct ci13xxx_req *mReq = container_of(req, struct ci13xxx_req, req);
2100 unsigned long flags;
2101
2102 trace("%p, %p", ep, req);
2103
2104 if (ep == NULL || req == NULL) {
2105 err("EINVAL");
2106 return;
2107 } else if (!list_empty(&mReq->queue)) {
2108 err("EBUSY");
2109 return;
2110 }
2111
2112 spin_lock_irqsave(mEp->lock, flags);
2113
2114 if (mReq->ptr)
2115 dma_pool_free(mEp->td_pool, mReq->ptr, mReq->dma);
2116 kfree(mReq);
2117
2118 dbg_event(_usb_addr(mEp), "FREE", 0);
2119
2120 spin_unlock_irqrestore(mEp->lock, flags);
2121}
2122
2123/**
2124 * ep_queue: queues (submits) an I/O request to an endpoint
2125 *
2126 * Check usb_ep_queue()* at usb_gadget.h" for details
2127 */
2128static int ep_queue(struct usb_ep *ep, struct usb_request *req,
2129 gfp_t __maybe_unused gfp_flags)
2130{
2131 struct ci13xxx_ep *mEp = container_of(ep, struct ci13xxx_ep, ep);
2132 struct ci13xxx_req *mReq = container_of(req, struct ci13xxx_req, req);
2133 int retval = 0;
2134 unsigned long flags;
2135
2136 trace("%p, %p, %X", ep, req, gfp_flags);
2137
2138 if (ep == NULL || req == NULL || mEp->desc == NULL)
2139 return -EINVAL;
2140
2141 spin_lock_irqsave(mEp->lock, flags);
2142
2143 if (mEp->type == USB_ENDPOINT_XFER_CONTROL &&
2144 !list_empty(&mEp->qh[mEp->dir].queue)) {
2145 _ep_nuke(mEp);
2146 retval = -EOVERFLOW;
2147 warn("endpoint ctrl %X nuked", _usb_addr(mEp));
2148 }
2149
2150 /* first nuke then test link, e.g. previous status has not sent */
2151 if (!list_empty(&mReq->queue)) {
2152 retval = -EBUSY;
2153 err("request already in queue");
2154 goto done;
2155 }
2156
2157 if (req->length > (4 * PAGE_SIZE)) {
2158 req->length = (4 * PAGE_SIZE);
2159 retval = -EMSGSIZE;
2160 warn("request length truncated");
2161 }
2162
2163 dbg_queue(_usb_addr(mEp), req, retval);
2164
2165 /* push request */
2166 mReq->req.status = -EINPROGRESS;
2167 mReq->req.actual = 0;
2168 list_add_tail(&mReq->queue, &mEp->qh[mEp->dir].queue);
2169
2170 retval = _hardware_enqueue(mEp, mReq);
2171 if (retval == -EALREADY || retval == -EBUSY) {
2172 dbg_event(_usb_addr(mEp), "QUEUE", retval);
2173 retval = 0;
2174 }
2175
2176 done:
2177 spin_unlock_irqrestore(mEp->lock, flags);
2178 return retval;
2179}
2180
2181/**
2182 * ep_dequeue: dequeues (cancels, unlinks) an I/O request from an endpoint
2183 *
2184 * Check usb_ep_dequeue() at "usb_gadget.h" for details
2185 */
2186static int ep_dequeue(struct usb_ep *ep, struct usb_request *req)
2187{
2188 struct ci13xxx_ep *mEp = container_of(ep, struct ci13xxx_ep, ep);
2189 struct ci13xxx_req *mReq = container_of(req, struct ci13xxx_req, req);
2190 unsigned long flags;
2191
2192 trace("%p, %p", ep, req);
2193
2194 if (ep == NULL || req == NULL || mEp->desc == NULL ||
2195 list_empty(&mReq->queue) || list_empty(&mEp->qh[mEp->dir].queue))
2196 return -EINVAL;
2197
2198 spin_lock_irqsave(mEp->lock, flags);
2199
2200 dbg_event(_usb_addr(mEp), "DEQUEUE", 0);
2201
2202 if (mReq->req.status == -EALREADY)
2203 _hardware_dequeue(mEp, mReq);
2204
2205 /* pop request */
2206 list_del_init(&mReq->queue);
2207 req->status = -ECONNRESET;
2208
2209 if (!mReq->req.no_interrupt && mReq->req.complete != NULL) {
2210 spin_unlock(mEp->lock);
2211 mReq->req.complete(&mEp->ep, &mReq->req);
2212 spin_lock(mEp->lock);
2213 }
2214
2215 spin_unlock_irqrestore(mEp->lock, flags);
2216 return 0;
2217}
2218
2219/**
2220 * ep_set_halt: sets the endpoint halt feature
2221 *
2222 * Check usb_ep_set_halt() at "usb_gadget.h" for details
2223 */
2224static int ep_set_halt(struct usb_ep *ep, int value)
2225{
2226 struct ci13xxx_ep *mEp = container_of(ep, struct ci13xxx_ep, ep);
2227 int direction, retval = 0;
2228 unsigned long flags;
2229
2230 trace("%p, %i", ep, value);
2231
2232 if (ep == NULL || mEp->desc == NULL)
2233 return -EINVAL;
2234
2235 spin_lock_irqsave(mEp->lock, flags);
2236
2237#ifndef STALL_IN
2238 /* g_file_storage MS compliant but g_zero fails chapter 9 compliance */
2239 if (value && mEp->type == USB_ENDPOINT_XFER_BULK && mEp->dir == TX &&
2240 !list_empty(&mEp->qh[mEp->dir].queue)) {
2241 spin_unlock_irqrestore(mEp->lock, flags);
2242 return -EAGAIN;
2243 }
2244#endif
2245
2246 direction = mEp->dir;
2247 do {
2248 dbg_event(_usb_addr(mEp), "HALT", value);
2249 retval |= hw_ep_set_halt(mEp->num, mEp->dir, value);
2250
2251 if (!value)
2252 mEp->wedge = 0;
2253
2254 if (mEp->type == USB_ENDPOINT_XFER_CONTROL)
2255 mEp->dir = (mEp->dir == TX) ? RX : TX;
2256
2257 } while (mEp->dir != direction);
2258
2259 spin_unlock_irqrestore(mEp->lock, flags);
2260 return retval;
2261}
2262
2263/**
2264 * ep_set_wedge: sets the halt feature and ignores clear requests
2265 *
2266 * Check usb_ep_set_wedge() at "usb_gadget.h" for details
2267 */
2268static int ep_set_wedge(struct usb_ep *ep)
2269{
2270 struct ci13xxx_ep *mEp = container_of(ep, struct ci13xxx_ep, ep);
2271 unsigned long flags;
2272
2273 trace("%p", ep);
2274
2275 if (ep == NULL || mEp->desc == NULL)
2276 return -EINVAL;
2277
2278 spin_lock_irqsave(mEp->lock, flags);
2279
2280 dbg_event(_usb_addr(mEp), "WEDGE", 0);
2281 mEp->wedge = 1;
2282
2283 spin_unlock_irqrestore(mEp->lock, flags);
2284
2285 return usb_ep_set_halt(ep);
2286}
2287
2288/**
2289 * ep_fifo_flush: flushes contents of a fifo
2290 *
2291 * Check usb_ep_fifo_flush() at "usb_gadget.h" for details
2292 */
2293static void ep_fifo_flush(struct usb_ep *ep)
2294{
2295 struct ci13xxx_ep *mEp = container_of(ep, struct ci13xxx_ep, ep);
2296 unsigned long flags;
2297
2298 trace("%p", ep);
2299
2300 if (ep == NULL) {
2301 err("%02X: -EINVAL", _usb_addr(mEp));
2302 return;
2303 }
2304
2305 spin_lock_irqsave(mEp->lock, flags);
2306
2307 dbg_event(_usb_addr(mEp), "FFLUSH", 0);
2308 hw_ep_flush(mEp->num, mEp->dir);
2309
2310 spin_unlock_irqrestore(mEp->lock, flags);
2311}
2312
2313/**
2314 * Endpoint-specific part of the API to the USB controller hardware
2315 * Check "usb_gadget.h" for details
2316 */
2317static const struct usb_ep_ops usb_ep_ops = {
2318 .enable = ep_enable,
2319 .disable = ep_disable,
2320 .alloc_request = ep_alloc_request,
2321 .free_request = ep_free_request,
2322 .queue = ep_queue,
2323 .dequeue = ep_dequeue,
2324 .set_halt = ep_set_halt,
2325 .set_wedge = ep_set_wedge,
2326 .fifo_flush = ep_fifo_flush,
2327};
2328
2329/******************************************************************************
2330 * GADGET block
2331 *****************************************************************************/
2332/**
2333 * Device operations part of the API to the USB controller hardware,
2334 * which don't involve endpoints (or i/o)
2335 * Check "usb_gadget.h" for details
2336 */
2337static const struct usb_gadget_ops usb_gadget_ops;
2338
2339/**
2340 * usb_gadget_register_driver: register a gadget driver
2341 *
2342 * Check usb_gadget_register_driver() at "usb_gadget.h" for details
2343 * Interrupts are enabled here
2344 */
2345int usb_gadget_register_driver(struct usb_gadget_driver *driver)
2346{
2347 struct ci13xxx *udc = _udc;
2348 unsigned long i, k, flags;
2349 int retval = -ENOMEM;
2350
2351 trace("%p", driver);
2352
2353 if (driver == NULL ||
2354 driver->bind == NULL ||
2355 driver->unbind == NULL ||
2356 driver->setup == NULL ||
2357 driver->disconnect == NULL ||
2358 driver->suspend == NULL ||
2359 driver->resume == NULL)
2360 return -EINVAL;
2361 else if (udc == NULL)
2362 return -ENODEV;
2363 else if (udc->driver != NULL)
2364 return -EBUSY;
2365
2366 /* alloc resources */
2367 udc->qh_pool = dma_pool_create("ci13xxx_qh", &udc->gadget.dev,
2368 sizeof(struct ci13xxx_qh),
2369 64, PAGE_SIZE);
2370 if (udc->qh_pool == NULL)
2371 return -ENOMEM;
2372
2373 udc->td_pool = dma_pool_create("ci13xxx_td", &udc->gadget.dev,
2374 sizeof(struct ci13xxx_td),
2375 64, PAGE_SIZE);
2376 if (udc->td_pool == NULL) {
2377 dma_pool_destroy(udc->qh_pool);
2378 udc->qh_pool = NULL;
2379 return -ENOMEM;
2380 }
2381
2382 spin_lock_irqsave(udc->lock, flags);
2383
2384 info("hw_ep_max = %d", hw_ep_max);
2385
2386 udc->driver = driver;
2387 udc->gadget.ops = NULL;
2388 udc->gadget.dev.driver = NULL;
2389
2390 retval = 0;
2391 for (i = 0; i < hw_ep_max; i++) {
2392 struct ci13xxx_ep *mEp = &udc->ci13xxx_ep[i];
2393
2394 scnprintf(mEp->name, sizeof(mEp->name), "ep%i", (int)i);
2395
2396 mEp->lock = udc->lock;
2397 mEp->device = &udc->gadget.dev;
2398 mEp->td_pool = udc->td_pool;
2399
2400 mEp->ep.name = mEp->name;
2401 mEp->ep.ops = &usb_ep_ops;
2402 mEp->ep.maxpacket = CTRL_PAYLOAD_MAX;
2403
2404 /* this allocation cannot be random */
2405 for (k = RX; k <= TX; k++) {
2406 INIT_LIST_HEAD(&mEp->qh[k].queue);
2407 mEp->qh[k].ptr = dma_pool_alloc(udc->qh_pool,
2408 GFP_KERNEL,
2409 &mEp->qh[k].dma);
2410 if (mEp->qh[k].ptr == NULL)
2411 retval = -ENOMEM;
2412 else
2413 memset(mEp->qh[k].ptr, 0,
2414 sizeof(*mEp->qh[k].ptr));
2415 }
2416 if (i == 0)
2417 udc->gadget.ep0 = &mEp->ep;
2418 else
2419 list_add_tail(&mEp->ep.ep_list, &udc->gadget.ep_list);
2420 }
2421 if (retval)
2422 goto done;
2423
2424 /* bind gadget */
2425 driver->driver.bus = NULL;
2426 udc->gadget.ops = &usb_gadget_ops;
2427 udc->gadget.dev.driver = &driver->driver;
2428
2429 spin_unlock_irqrestore(udc->lock, flags);
2430 retval = driver->bind(&udc->gadget); /* MAY SLEEP */
2431 spin_lock_irqsave(udc->lock, flags);
2432
2433 if (retval) {
2434 udc->gadget.ops = NULL;
2435 udc->gadget.dev.driver = NULL;
2436 goto done;
2437 }
2438
2439 retval = hw_device_state(udc->ci13xxx_ep[0].qh[RX].dma);
2440
2441 done:
2442 spin_unlock_irqrestore(udc->lock, flags);
2443 if (retval)
2444 usb_gadget_unregister_driver(driver);
2445 return retval;
2446}
2447EXPORT_SYMBOL(usb_gadget_register_driver);
2448
2449/**
2450 * usb_gadget_unregister_driver: unregister a gadget driver
2451 *
2452 * Check usb_gadget_unregister_driver() at "usb_gadget.h" for details
2453 */
2454int usb_gadget_unregister_driver(struct usb_gadget_driver *driver)
2455{
2456 struct ci13xxx *udc = _udc;
2457 unsigned long i, k, flags;
2458
2459 trace("%p", driver);
2460
2461 if (driver == NULL ||
2462 driver->bind == NULL ||
2463 driver->unbind == NULL ||
2464 driver->setup == NULL ||
2465 driver->disconnect == NULL ||
2466 driver->suspend == NULL ||
2467 driver->resume == NULL ||
2468 driver != udc->driver)
2469 return -EINVAL;
2470
2471 spin_lock_irqsave(udc->lock, flags);
2472
2473 hw_device_state(0);
2474
2475 /* unbind gadget */
2476 if (udc->gadget.ops != NULL) {
2477 _gadget_stop_activity(&udc->gadget);
2478
2479 spin_unlock_irqrestore(udc->lock, flags);
2480 driver->unbind(&udc->gadget); /* MAY SLEEP */
2481 spin_lock_irqsave(udc->lock, flags);
2482
2483 udc->gadget.ops = NULL;
2484 udc->gadget.dev.driver = NULL;
2485 }
2486
2487 /* free resources */
2488 for (i = 0; i < hw_ep_max; i++) {
2489 struct ci13xxx_ep *mEp = &udc->ci13xxx_ep[i];
2490
2491 if (i == 0)
2492 udc->gadget.ep0 = NULL;
2493 else if (!list_empty(&mEp->ep.ep_list))
2494 list_del_init(&mEp->ep.ep_list);
2495
2496 for (k = RX; k <= TX; k++)
2497 if (mEp->qh[k].ptr != NULL)
2498 dma_pool_free(udc->qh_pool,
2499 mEp->qh[k].ptr, mEp->qh[k].dma);
2500 }
2501
2502 udc->driver = NULL;
2503
2504 spin_unlock_irqrestore(udc->lock, flags);
2505
2506 if (udc->td_pool != NULL) {
2507 dma_pool_destroy(udc->td_pool);
2508 udc->td_pool = NULL;
2509 }
2510 if (udc->qh_pool != NULL) {
2511 dma_pool_destroy(udc->qh_pool);
2512 udc->qh_pool = NULL;
2513 }
2514
2515 return 0;
2516}
2517EXPORT_SYMBOL(usb_gadget_unregister_driver);
2518
2519/******************************************************************************
2520 * BUS block
2521 *****************************************************************************/
2522/**
2523 * udc_irq: global interrupt handler
2524 *
2525 * This function returns IRQ_HANDLED if the IRQ has been handled
2526 * It locks access to registers
2527 */
2528static irqreturn_t udc_irq(void)
2529{
2530 struct ci13xxx *udc = _udc;
2531 irqreturn_t retval;
2532 u32 intr;
2533
2534 trace();
2535
2536 if (udc == NULL) {
2537 err("ENODEV");
2538 return IRQ_HANDLED;
2539 }
2540
2541 spin_lock(udc->lock);
2542 intr = hw_test_and_clear_intr_active();
2543 if (intr) {
2544 isr_statistics.hndl.buf[isr_statistics.hndl.idx++] = intr;
2545 isr_statistics.hndl.idx &= ISR_MASK;
2546 isr_statistics.hndl.cnt++;
2547
2548 /* order defines priority - do NOT change it */
2549 if (USBi_URI & intr) {
2550 isr_statistics.uri++;
2551 isr_reset_handler(udc);
2552 }
2553 if (USBi_PCI & intr) {
2554 isr_statistics.pci++;
2555 udc->gadget.speed = hw_port_is_high_speed() ?
2556 USB_SPEED_HIGH : USB_SPEED_FULL;
2557 }
2558 if (USBi_UEI & intr)
2559 isr_statistics.uei++;
2560 if (USBi_UI & intr) {
2561 isr_statistics.ui++;
2562 isr_tr_complete_handler(udc);
2563 }
2564 if (USBi_SLI & intr)
2565 isr_statistics.sli++;
2566 retval = IRQ_HANDLED;
2567 } else {
2568 isr_statistics.none++;
2569 retval = IRQ_NONE;
2570 }
2571 spin_unlock(udc->lock);
2572
2573 return retval;
2574}
2575
2576/**
2577 * udc_release: driver release function
2578 * @dev: device
2579 *
2580 * Currently does nothing
2581 */
2582static void udc_release(struct device *dev)
2583{
2584 trace("%p", dev);
2585
2586 if (dev == NULL)
2587 err("EINVAL");
2588}
2589
2590/**
2591 * udc_probe: parent probe must call this to initialize UDC
2592 * @dev: parent device
2593 * @regs: registers base address
2594 * @name: driver name
2595 *
2596 * This function returns an error code
2597 * No interrupts active, the IRQ has not been requested yet
2598 * Kernel assumes 32-bit DMA operations by default, no need to dma_set_mask
2599 */
2600static int udc_probe(struct device *dev, void __iomem *regs, const char *name)
2601{
2602 struct ci13xxx *udc;
2603 int retval = 0;
2604
2605 trace("%p, %p, %p", dev, regs, name);
2606
2607 if (dev == NULL || regs == NULL || name == NULL)
2608 return -EINVAL;
2609
2610 udc = kzalloc(sizeof(struct ci13xxx), GFP_KERNEL);
2611 if (udc == NULL)
2612 return -ENOMEM;
2613
2614 udc->lock = &udc_lock;
2615
2616 retval = hw_device_reset(regs);
2617 if (retval)
2618 goto done;
2619
2620 udc->gadget.ops = NULL;
2621 udc->gadget.speed = USB_SPEED_UNKNOWN;
2622 udc->gadget.is_dualspeed = 1;
2623 udc->gadget.is_otg = 0;
2624 udc->gadget.name = name;
2625
2626 INIT_LIST_HEAD(&udc->gadget.ep_list);
2627 udc->gadget.ep0 = NULL;
2628
2629 strcpy(udc->gadget.dev.bus_id, "gadget");
2630 udc->gadget.dev.dma_mask = dev->dma_mask;
2631 udc->gadget.dev.parent = dev;
2632 udc->gadget.dev.release = udc_release;
2633
2634 retval = device_register(&udc->gadget.dev);
2635 if (retval)
2636 goto done;
2637
2638#ifdef CONFIG_USB_GADGET_DEBUG_FILES
2639 retval = dbg_create_files(&udc->gadget.dev);
2640#endif
2641 if (retval) {
2642 device_unregister(&udc->gadget.dev);
2643 goto done;
2644 }
2645
2646 _udc = udc;
2647 return retval;
2648
2649 done:
2650 err("error = %i", retval);
2651 kfree(udc);
2652 _udc = NULL;
2653 return retval;
2654}
2655
2656/**
2657 * udc_remove: parent remove must call this to remove UDC
2658 *
2659 * No interrupts active, the IRQ has been released
2660 */
2661static void udc_remove(void)
2662{
2663 struct ci13xxx *udc = _udc;
2664
2665 if (udc == NULL) {
2666 err("EINVAL");
2667 return;
2668 }
2669
2670#ifdef CONFIG_USB_GADGET_DEBUG_FILES
2671 dbg_remove_files(&udc->gadget.dev);
2672#endif
2673 device_unregister(&udc->gadget.dev);
2674
2675 kfree(udc);
2676 _udc = NULL;
2677}
2678
2679/******************************************************************************
2680 * PCI block
2681 *****************************************************************************/
2682/**
2683 * ci13xxx_pci_irq: interrut handler
2684 * @irq: irq number
2685 * @pdev: USB Device Controller interrupt source
2686 *
2687 * This function returns IRQ_HANDLED if the IRQ has been handled
2688 * This is an ISR don't trace, use attribute interface instead
2689 */
2690static irqreturn_t ci13xxx_pci_irq(int irq, void *pdev)
2691{
2692 if (irq == 0) {
2693 dev_err(&((struct pci_dev *)pdev)->dev, "Invalid IRQ0 usage!");
2694 return IRQ_HANDLED;
2695 }
2696 return udc_irq();
2697}
2698
2699/**
2700 * ci13xxx_pci_probe: PCI probe
2701 * @pdev: USB device controller being probed
2702 * @id: PCI hotplug ID connecting controller to UDC framework
2703 *
2704 * This function returns an error code
2705 * Allocates basic PCI resources for this USB device controller, and then
2706 * invokes the udc_probe() method to start the UDC associated with it
2707 */
2708static int __devinit ci13xxx_pci_probe(struct pci_dev *pdev,
2709 const struct pci_device_id *id)
2710{
2711 void __iomem *regs = NULL;
2712 int retval = 0;
2713
2714 if (id == NULL)
2715 return -EINVAL;
2716
2717 retval = pci_enable_device(pdev);
2718 if (retval)
2719 goto done;
2720
2721 if (!pdev->irq) {
2722 dev_err(&pdev->dev, "No IRQ, check BIOS/PCI setup!");
2723 retval = -ENODEV;
2724 goto disable_device;
2725 }
2726
2727 retval = pci_request_regions(pdev, UDC_DRIVER_NAME);
2728 if (retval)
2729 goto disable_device;
2730
2731 /* BAR 0 holds all the registers */
2732 regs = pci_iomap(pdev, 0, 0);
2733 if (!regs) {
2734 dev_err(&pdev->dev, "Error mapping memory!");
2735 retval = -EFAULT;
2736 goto release_regions;
2737 }
2738 pci_set_drvdata(pdev, (__force void *)regs);
2739
2740 pci_set_master(pdev);
2741 pci_try_set_mwi(pdev);
2742
2743 retval = udc_probe(&pdev->dev, regs, UDC_DRIVER_NAME);
2744 if (retval)
2745 goto iounmap;
2746
2747 /* our device does not have MSI capability */
2748
2749 retval = request_irq(pdev->irq, ci13xxx_pci_irq, IRQF_SHARED,
2750 UDC_DRIVER_NAME, pdev);
2751 if (retval)
2752 goto gadget_remove;
2753
2754 return 0;
2755
2756 gadget_remove:
2757 udc_remove();
2758 iounmap:
2759 pci_iounmap(pdev, regs);
2760 release_regions:
2761 pci_release_regions(pdev);
2762 disable_device:
2763 pci_disable_device(pdev);
2764 done:
2765 return retval;
2766}
2767
2768/**
2769 * ci13xxx_pci_remove: PCI remove
2770 * @pdev: USB Device Controller being removed
2771 *
2772 * Reverses the effect of ci13xxx_pci_probe(),
2773 * first invoking the udc_remove() and then releases
2774 * all PCI resources allocated for this USB device controller
2775 */
2776static void __devexit ci13xxx_pci_remove(struct pci_dev *pdev)
2777{
2778 free_irq(pdev->irq, pdev);
2779 udc_remove();
2780 pci_iounmap(pdev, (__force void __iomem *)pci_get_drvdata(pdev));
2781 pci_release_regions(pdev);
2782 pci_disable_device(pdev);
2783}
2784
2785/**
2786 * PCI device table
2787 * PCI device structure
2788 *
2789 * Check "pci.h" for details
2790 */
2791static DEFINE_PCI_DEVICE_TABLE(ci13xxx_pci_id_table) = {
2792 { PCI_DEVICE(0x153F, 0x1004) },
2793 { PCI_DEVICE(0x153F, 0x1006) },
2794 { 0, 0, 0, 0, 0, 0, 0 /* end: all zeroes */ }
2795};
2796MODULE_DEVICE_TABLE(pci, ci13xxx_pci_id_table);
2797
2798static struct pci_driver ci13xxx_pci_driver = {
2799 .name = UDC_DRIVER_NAME,
2800 .id_table = ci13xxx_pci_id_table,
2801 .probe = ci13xxx_pci_probe,
2802 .remove = __devexit_p(ci13xxx_pci_remove),
2803};
2804
2805/**
2806 * ci13xxx_pci_init: module init
2807 *
2808 * Driver load
2809 */
2810static int __init ci13xxx_pci_init(void)
2811{
2812 return pci_register_driver(&ci13xxx_pci_driver);
2813}
2814module_init(ci13xxx_pci_init);
2815
2816/**
2817 * ci13xxx_pci_exit: module exit
2818 *
2819 * Driver unload
2820 */
2821static void __exit ci13xxx_pci_exit(void)
2822{
2823 pci_unregister_driver(&ci13xxx_pci_driver);
2824}
2825module_exit(ci13xxx_pci_exit);
2826
2827MODULE_AUTHOR("MIPS - David Lopo <dlopo@chipidea.mips.com>");
2828MODULE_DESCRIPTION("MIPS CI13XXX USB Peripheral Controller");
2829MODULE_LICENSE("GPL");
2830MODULE_VERSION("June 2008");
diff --git a/drivers/usb/gadget/ci13xxx_udc.h b/drivers/usb/gadget/ci13xxx_udc.h
new file mode 100644
index 000000000000..4026e9cede34
--- /dev/null
+++ b/drivers/usb/gadget/ci13xxx_udc.h
@@ -0,0 +1,195 @@
1/*
2 * ci13xxx_udc.h - structures, registers, and macros MIPS USB IP core
3 *
4 * Copyright (C) 2008 Chipidea - MIPS Technologies, Inc. All rights reserved.
5 *
6 * Author: David Lopo
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 *
12 * Description: MIPS USB IP core family device controller
13 * Structures, registers and logging macros
14 */
15
16#ifndef _CI13XXX_h_
17#define _CI13XXX_h_
18
19/******************************************************************************
20 * DEFINE
21 *****************************************************************************/
22#define ENDPT_MAX (16)
23#define CTRL_PAYLOAD_MAX (64)
24#define RX (0) /* similar to USB_DIR_OUT but can be used as an index */
25#define TX (1) /* similar to USB_DIR_IN but can be used as an index */
26
27/******************************************************************************
28 * STRUCTURES
29 *****************************************************************************/
30/* DMA layout of transfer descriptors */
31struct ci13xxx_td {
32 /* 0 */
33 u32 next;
34#define TD_TERMINATE BIT(0)
35 /* 1 */
36 u32 token;
37#define TD_STATUS (0x00FFUL << 0)
38#define TD_STATUS_TR_ERR BIT(3)
39#define TD_STATUS_DT_ERR BIT(5)
40#define TD_STATUS_HALTED BIT(6)
41#define TD_STATUS_ACTIVE BIT(7)
42#define TD_MULTO (0x0003UL << 10)
43#define TD_IOC BIT(15)
44#define TD_TOTAL_BYTES (0x7FFFUL << 16)
45 /* 2 */
46 u32 page[5];
47#define TD_CURR_OFFSET (0x0FFFUL << 0)
48#define TD_FRAME_NUM (0x07FFUL << 0)
49#define TD_RESERVED_MASK (0x0FFFUL << 0)
50} __attribute__ ((packed));
51
52/* DMA layout of queue heads */
53struct ci13xxx_qh {
54 /* 0 */
55 u32 cap;
56#define QH_IOS BIT(15)
57#define QH_MAX_PKT (0x07FFUL << 16)
58#define QH_ZLT BIT(29)
59#define QH_MULT (0x0003UL << 30)
60 /* 1 */
61 u32 curr;
62 /* 2 - 8 */
63 struct ci13xxx_td td;
64 /* 9 */
65 u32 RESERVED;
66 struct usb_ctrlrequest setup;
67} __attribute__ ((packed));
68
69/* Extension of usb_request */
70struct ci13xxx_req {
71 struct usb_request req;
72 unsigned map;
73 struct list_head queue;
74 struct ci13xxx_td *ptr;
75 dma_addr_t dma;
76};
77
78/* Extension of usb_ep */
79struct ci13xxx_ep {
80 struct usb_ep ep;
81 const struct usb_endpoint_descriptor *desc;
82 u8 dir;
83 u8 num;
84 u8 type;
85 char name[16];
86 struct {
87 struct list_head queue;
88 struct ci13xxx_qh *ptr;
89 dma_addr_t dma;
90 } qh[2];
91 struct usb_request *status;
92 int wedge;
93
94 /* global resources */
95 spinlock_t *lock;
96 struct device *device;
97 struct dma_pool *td_pool;
98};
99
100/* CI13XXX UDC descriptor & global resources */
101struct ci13xxx {
102 spinlock_t *lock; /* ctrl register bank access */
103
104 struct dma_pool *qh_pool; /* DMA pool for queue heads */
105 struct dma_pool *td_pool; /* DMA pool for transfer descs */
106
107 struct usb_gadget gadget; /* USB slave device */
108 struct ci13xxx_ep ci13xxx_ep[ENDPT_MAX]; /* extended endpts */
109
110 struct usb_gadget_driver *driver; /* 3rd party gadget driver */
111};
112
113/******************************************************************************
114 * REGISTERS
115 *****************************************************************************/
116/* register size */
117#define REG_BITS (32)
118
119/* HCCPARAMS */
120#define HCCPARAMS_LEN BIT(17)
121
122/* DCCPARAMS */
123#define DCCPARAMS_DEN (0x1F << 0)
124#define DCCPARAMS_DC BIT(7)
125
126/* TESTMODE */
127#define TESTMODE_FORCE BIT(0)
128
129/* USBCMD */
130#define USBCMD_RS BIT(0)
131#define USBCMD_RST BIT(1)
132#define USBCMD_SUTW BIT(13)
133
134/* USBSTS & USBINTR */
135#define USBi_UI BIT(0)
136#define USBi_UEI BIT(1)
137#define USBi_PCI BIT(2)
138#define USBi_URI BIT(6)
139#define USBi_SLI BIT(8)
140
141/* DEVICEADDR */
142#define DEVICEADDR_USBADRA BIT(24)
143#define DEVICEADDR_USBADR (0x7FUL << 25)
144
145/* PORTSC */
146#define PORTSC_SUSP BIT(7)
147#define PORTSC_HSP BIT(9)
148#define PORTSC_PTC (0x0FUL << 16)
149
150/* DEVLC */
151#define DEVLC_PSPD (0x03UL << 25)
152#define DEVLC_PSPD_HS (0x02UL << 25)
153
154/* USBMODE */
155#define USBMODE_CM (0x03UL << 0)
156#define USBMODE_CM_IDLE (0x00UL << 0)
157#define USBMODE_CM_DEVICE (0x02UL << 0)
158#define USBMODE_CM_HOST (0x03UL << 0)
159#define USBMODE_SLOM BIT(3)
160
161/* ENDPTCTRL */
162#define ENDPTCTRL_RXS BIT(0)
163#define ENDPTCTRL_RXT (0x03UL << 2)
164#define ENDPTCTRL_RXR BIT(6) /* reserved for port 0 */
165#define ENDPTCTRL_RXE BIT(7)
166#define ENDPTCTRL_TXS BIT(16)
167#define ENDPTCTRL_TXT (0x03UL << 18)
168#define ENDPTCTRL_TXR BIT(22) /* reserved for port 0 */
169#define ENDPTCTRL_TXE BIT(23)
170
171/******************************************************************************
172 * LOGGING
173 *****************************************************************************/
174#define ci13xxx_printk(level, format, args...) \
175do { \
176 if (_udc == NULL) \
177 printk(level "[%s] " format "\n", __func__, ## args); \
178 else \
179 dev_printk(level, _udc->gadget.dev.parent, \
180 "[%s] " format "\n", __func__, ## args); \
181} while (0)
182
183#define err(format, args...) ci13xxx_printk(KERN_ERR, format, ## args)
184#define warn(format, args...) ci13xxx_printk(KERN_WARNING, format, ## args)
185#define info(format, args...) ci13xxx_printk(KERN_INFO, format, ## args)
186
187#ifdef TRACE
188#define trace(format, args...) ci13xxx_printk(KERN_DEBUG, format, ## args)
189#define dbg_trace(format, args...) dev_dbg(dev, format, ##args)
190#else
191#define trace(format, args...) do {} while (0)
192#define dbg_trace(format, args...) do {} while (0)
193#endif
194
195#endif /* _CI13XXX_h_ */
diff --git a/drivers/usb/gadget/epautoconf.c b/drivers/usb/gadget/epautoconf.c
index 9462e30192d8..a36b1175b18d 100644
--- a/drivers/usb/gadget/epautoconf.c
+++ b/drivers/usb/gadget/epautoconf.c
@@ -161,7 +161,7 @@ ep_matches (
161 /* report address */ 161 /* report address */
162 desc->bEndpointAddress &= USB_DIR_IN; 162 desc->bEndpointAddress &= USB_DIR_IN;
163 if (isdigit (ep->name [2])) { 163 if (isdigit (ep->name [2])) {
164 u8 num = simple_strtol (&ep->name [2], NULL, 10); 164 u8 num = simple_strtoul (&ep->name [2], NULL, 10);
165 desc->bEndpointAddress |= num; 165 desc->bEndpointAddress |= num;
166#ifdef MANY_ENDPOINTS 166#ifdef MANY_ENDPOINTS
167 } else if (desc->bEndpointAddress & USB_DIR_IN) { 167 } else if (desc->bEndpointAddress & USB_DIR_IN) {
diff --git a/drivers/usb/gadget/file_storage.c b/drivers/usb/gadget/file_storage.c
index 2e71368f45b4..b10fa31cc915 100644
--- a/drivers/usb/gadget/file_storage.c
+++ b/drivers/usb/gadget/file_storage.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * file_storage.c -- File-backed USB Storage Gadget, for USB development 2 * file_storage.c -- File-backed USB Storage Gadget, for USB development
3 * 3 *
4 * Copyright (C) 2003-2007 Alan Stern 4 * Copyright (C) 2003-2008 Alan Stern
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
@@ -38,16 +38,17 @@
38 38
39/* 39/*
40 * The File-backed Storage Gadget acts as a USB Mass Storage device, 40 * The File-backed Storage Gadget acts as a USB Mass Storage device,
41 * appearing to the host as a disk drive. In addition to providing an 41 * appearing to the host as a disk drive or as a CD-ROM drive. In addition
42 * example of a genuinely useful gadget driver for a USB device, it also 42 * to providing an example of a genuinely useful gadget driver for a USB
43 * illustrates a technique of double-buffering for increased throughput. 43 * device, it also illustrates a technique of double-buffering for increased
44 * Last but not least, it gives an easy way to probe the behavior of the 44 * throughput. Last but not least, it gives an easy way to probe the
45 * Mass Storage drivers in a USB host. 45 * behavior of the Mass Storage drivers in a USB host.
46 * 46 *
47 * Backing storage is provided by a regular file or a block device, specified 47 * Backing storage is provided by a regular file or a block device, specified
48 * by the "file" module parameter. Access can be limited to read-only by 48 * by the "file" module parameter. Access can be limited to read-only by
49 * setting the optional "ro" module parameter. The gadget will indicate that 49 * setting the optional "ro" module parameter. (For CD-ROM emulation,
50 * it has removable media if the optional "removable" module parameter is set. 50 * access is always read-only.) The gadget will indicate that it has
51 * removable media if the optional "removable" module parameter is set.
51 * 52 *
52 * The gadget supports the Control-Bulk (CB), Control-Bulk-Interrupt (CBI), 53 * The gadget supports the Control-Bulk (CB), Control-Bulk-Interrupt (CBI),
53 * and Bulk-Only (also known as Bulk-Bulk-Bulk or BBB) transports, selected 54 * and Bulk-Only (also known as Bulk-Bulk-Bulk or BBB) transports, selected
@@ -64,7 +65,12 @@
64 * The default number of LUNs is taken from the number of "file" elements; 65 * The default number of LUNs is taken from the number of "file" elements;
65 * it is 1 if "file" is not given. If "removable" is not set then a backing 66 * it is 1 if "file" is not given. If "removable" is not set then a backing
66 * file must be specified for each LUN. If it is set, then an unspecified 67 * file must be specified for each LUN. If it is set, then an unspecified
67 * or empty backing filename means the LUN's medium is not loaded. 68 * or empty backing filename means the LUN's medium is not loaded. Ideally
69 * each LUN would be settable independently as a disk drive or a CD-ROM
70 * drive, but currently all LUNs have to be the same type. The CD-ROM
71 * emulation includes a single data track and no audio tracks; hence there
72 * need be only one backing file per LUN. Note also that the CD-ROM block
73 * length is set to 512 rather than the more common value 2048.
68 * 74 *
69 * Requirements are modest; only a bulk-in and a bulk-out endpoint are 75 * Requirements are modest; only a bulk-in and a bulk-out endpoint are
70 * needed (an interrupt-out endpoint is also needed for CBI). The memory 76 * needed (an interrupt-out endpoint is also needed for CBI). The memory
@@ -91,6 +97,8 @@
91 * USB device controller (usually true), 97 * USB device controller (usually true),
92 * boolean to permit the driver to halt 98 * boolean to permit the driver to halt
93 * bulk endpoints 99 * bulk endpoints
100 * cdrom Default false, boolean for whether to emulate
101 * a CD-ROM drive
94 * transport=XXX Default BBB, transport name (CB, CBI, or BBB) 102 * transport=XXX Default BBB, transport name (CB, CBI, or BBB)
95 * protocol=YYY Default SCSI, protocol name (RBC, 8020 or 103 * protocol=YYY Default SCSI, protocol name (RBC, 8020 or
96 * ATAPI, QIC, UFI, 8070, or SCSI; 104 * ATAPI, QIC, UFI, 8070, or SCSI;
@@ -103,15 +111,16 @@
103 * PAGE_CACHE_SIZE) 111 * PAGE_CACHE_SIZE)
104 * 112 *
105 * If CONFIG_USB_FILE_STORAGE_TEST is not set, only the "file", "ro", 113 * If CONFIG_USB_FILE_STORAGE_TEST is not set, only the "file", "ro",
106 * "removable", "luns", and "stall" options are available; default values 114 * "removable", "luns", "stall", and "cdrom" options are available; default
107 * are used for everything else. 115 * values are used for everything else.
108 * 116 *
109 * The pathnames of the backing files and the ro settings are available in 117 * The pathnames of the backing files and the ro settings are available in
110 * the attribute files "file" and "ro" in the lun<n> subdirectory of the 118 * the attribute files "file" and "ro" in the lun<n> subdirectory of the
111 * gadget's sysfs directory. If the "removable" option is set, writing to 119 * gadget's sysfs directory. If the "removable" option is set, writing to
112 * these files will simulate ejecting/loading the medium (writing an empty 120 * these files will simulate ejecting/loading the medium (writing an empty
113 * line means eject) and adjusting a write-enable tab. Changes to the ro 121 * line means eject) and adjusting a write-enable tab. Changes to the ro
114 * setting are not allowed when the medium is loaded. 122 * setting are not allowed when the medium is loaded or if CD-ROM emulation
123 * is being used.
115 * 124 *
116 * This gadget driver is heavily based on "Gadget Zero" by David Brownell. 125 * This gadget driver is heavily based on "Gadget Zero" by David Brownell.
117 * The driver's SCSI command interface was based on the "Information 126 * The driver's SCSI command interface was based on the "Information
@@ -261,7 +270,7 @@
261 270
262#define DRIVER_DESC "File-backed Storage Gadget" 271#define DRIVER_DESC "File-backed Storage Gadget"
263#define DRIVER_NAME "g_file_storage" 272#define DRIVER_NAME "g_file_storage"
264#define DRIVER_VERSION "7 August 2007" 273#define DRIVER_VERSION "20 November 2008"
265 274
266static const char longname[] = DRIVER_DESC; 275static const char longname[] = DRIVER_DESC;
267static const char shortname[] = DRIVER_NAME; 276static const char shortname[] = DRIVER_NAME;
@@ -341,6 +350,7 @@ static struct {
341 350
342 int removable; 351 int removable;
343 int can_stall; 352 int can_stall;
353 int cdrom;
344 354
345 char *transport_parm; 355 char *transport_parm;
346 char *protocol_parm; 356 char *protocol_parm;
@@ -359,6 +369,7 @@ static struct {
359 .protocol_parm = "SCSI", 369 .protocol_parm = "SCSI",
360 .removable = 0, 370 .removable = 0,
361 .can_stall = 1, 371 .can_stall = 1,
372 .cdrom = 0,
362 .vendor = DRIVER_VENDOR_ID, 373 .vendor = DRIVER_VENDOR_ID,
363 .product = DRIVER_PRODUCT_ID, 374 .product = DRIVER_PRODUCT_ID,
364 .release = 0xffff, // Use controller chip type 375 .release = 0xffff, // Use controller chip type
@@ -382,6 +393,9 @@ MODULE_PARM_DESC(removable, "true to simulate removable media");
382module_param_named(stall, mod_data.can_stall, bool, S_IRUGO); 393module_param_named(stall, mod_data.can_stall, bool, S_IRUGO);
383MODULE_PARM_DESC(stall, "false to prevent bulk stalls"); 394MODULE_PARM_DESC(stall, "false to prevent bulk stalls");
384 395
396module_param_named(cdrom, mod_data.cdrom, bool, S_IRUGO);
397MODULE_PARM_DESC(cdrom, "true to emulate cdrom instead of disk");
398
385 399
386/* In the non-TEST version, only the module parameters listed above 400/* In the non-TEST version, only the module parameters listed above
387 * are available. */ 401 * are available. */
@@ -411,6 +425,10 @@ MODULE_PARM_DESC(buflen, "I/O buffer size");
411 425
412/*-------------------------------------------------------------------------*/ 426/*-------------------------------------------------------------------------*/
413 427
428/* SCSI device types */
429#define TYPE_DISK 0x00
430#define TYPE_CDROM 0x05
431
414/* USB protocol value = the transport method */ 432/* USB protocol value = the transport method */
415#define USB_PR_CBI 0x00 // Control/Bulk/Interrupt 433#define USB_PR_CBI 0x00 // Control/Bulk/Interrupt
416#define USB_PR_CB 0x01 // Control/Bulk w/o interrupt 434#define USB_PR_CB 0x01 // Control/Bulk w/o interrupt
@@ -487,6 +505,8 @@ struct interrupt_data {
487#define SC_READ_12 0xa8 505#define SC_READ_12 0xa8
488#define SC_READ_CAPACITY 0x25 506#define SC_READ_CAPACITY 0x25
489#define SC_READ_FORMAT_CAPACITIES 0x23 507#define SC_READ_FORMAT_CAPACITIES 0x23
508#define SC_READ_HEADER 0x44
509#define SC_READ_TOC 0x43
490#define SC_RELEASE 0x17 510#define SC_RELEASE 0x17
491#define SC_REQUEST_SENSE 0x03 511#define SC_REQUEST_SENSE 0x03
492#define SC_RESERVE 0x16 512#define SC_RESERVE 0x16
@@ -2006,23 +2026,28 @@ static int do_inquiry(struct fsg_dev *fsg, struct fsg_buffhd *bh)
2006 u8 *buf = (u8 *) bh->buf; 2026 u8 *buf = (u8 *) bh->buf;
2007 2027
2008 static char vendor_id[] = "Linux "; 2028 static char vendor_id[] = "Linux ";
2009 static char product_id[] = "File-Stor Gadget"; 2029 static char product_disk_id[] = "File-Stor Gadget";
2030 static char product_cdrom_id[] = "File-CD Gadget ";
2010 2031
2011 if (!fsg->curlun) { // Unsupported LUNs are okay 2032 if (!fsg->curlun) { // Unsupported LUNs are okay
2012 fsg->bad_lun_okay = 1; 2033 fsg->bad_lun_okay = 1;
2013 memset(buf, 0, 36); 2034 memset(buf, 0, 36);
2014 buf[0] = 0x7f; // Unsupported, no device-type 2035 buf[0] = 0x7f; // Unsupported, no device-type
2036 buf[4] = 31; // Additional length
2015 return 36; 2037 return 36;
2016 } 2038 }
2017 2039
2018 memset(buf, 0, 8); // Non-removable, direct-access device 2040 memset(buf, 0, 8);
2041 buf[0] = (mod_data.cdrom ? TYPE_CDROM : TYPE_DISK);
2019 if (mod_data.removable) 2042 if (mod_data.removable)
2020 buf[1] = 0x80; 2043 buf[1] = 0x80;
2021 buf[2] = 2; // ANSI SCSI level 2 2044 buf[2] = 2; // ANSI SCSI level 2
2022 buf[3] = 2; // SCSI-2 INQUIRY data format 2045 buf[3] = 2; // SCSI-2 INQUIRY data format
2023 buf[4] = 31; // Additional length 2046 buf[4] = 31; // Additional length
2024 // No special options 2047 // No special options
2025 sprintf(buf + 8, "%-8s%-16s%04x", vendor_id, product_id, 2048 sprintf(buf + 8, "%-8s%-16s%04x", vendor_id,
2049 (mod_data.cdrom ? product_cdrom_id :
2050 product_disk_id),
2026 mod_data.release); 2051 mod_data.release);
2027 return 36; 2052 return 36;
2028} 2053}
@@ -2101,6 +2126,75 @@ static int do_read_capacity(struct fsg_dev *fsg, struct fsg_buffhd *bh)
2101} 2126}
2102 2127
2103 2128
2129static void store_cdrom_address(u8 *dest, int msf, u32 addr)
2130{
2131 if (msf) {
2132 /* Convert to Minutes-Seconds-Frames */
2133 addr >>= 2; /* Convert to 2048-byte frames */
2134 addr += 2*75; /* Lead-in occupies 2 seconds */
2135 dest[3] = addr % 75; /* Frames */
2136 addr /= 75;
2137 dest[2] = addr % 60; /* Seconds */
2138 addr /= 60;
2139 dest[1] = addr; /* Minutes */
2140 dest[0] = 0; /* Reserved */
2141 } else {
2142 /* Absolute sector */
2143 put_be32(dest, addr);
2144 }
2145}
2146
2147static int do_read_header(struct fsg_dev *fsg, struct fsg_buffhd *bh)
2148{
2149 struct lun *curlun = fsg->curlun;
2150 int msf = fsg->cmnd[1] & 0x02;
2151 u32 lba = get_be32(&fsg->cmnd[2]);
2152 u8 *buf = (u8 *) bh->buf;
2153
2154 if ((fsg->cmnd[1] & ~0x02) != 0) { /* Mask away MSF */
2155 curlun->sense_data = SS_INVALID_FIELD_IN_CDB;
2156 return -EINVAL;
2157 }
2158 if (lba >= curlun->num_sectors) {
2159 curlun->sense_data = SS_LOGICAL_BLOCK_ADDRESS_OUT_OF_RANGE;
2160 return -EINVAL;
2161 }
2162
2163 memset(buf, 0, 8);
2164 buf[0] = 0x01; /* 2048 bytes of user data, rest is EC */
2165 store_cdrom_address(&buf[4], msf, lba);
2166 return 8;
2167}
2168
2169
2170static int do_read_toc(struct fsg_dev *fsg, struct fsg_buffhd *bh)
2171{
2172 struct lun *curlun = fsg->curlun;
2173 int msf = fsg->cmnd[1] & 0x02;
2174 int start_track = fsg->cmnd[6];
2175 u8 *buf = (u8 *) bh->buf;
2176
2177 if ((fsg->cmnd[1] & ~0x02) != 0 || /* Mask away MSF */
2178 start_track > 1) {
2179 curlun->sense_data = SS_INVALID_FIELD_IN_CDB;
2180 return -EINVAL;
2181 }
2182
2183 memset(buf, 0, 20);
2184 buf[1] = (20-2); /* TOC data length */
2185 buf[2] = 1; /* First track number */
2186 buf[3] = 1; /* Last track number */
2187 buf[5] = 0x16; /* Data track, copying allowed */
2188 buf[6] = 0x01; /* Only track is number 1 */
2189 store_cdrom_address(&buf[8], msf, 0);
2190
2191 buf[13] = 0x16; /* Lead-out track is data */
2192 buf[14] = 0xAA; /* Lead-out track number */
2193 store_cdrom_address(&buf[16], msf, curlun->num_sectors);
2194 return 20;
2195}
2196
2197
2104static int do_mode_sense(struct fsg_dev *fsg, struct fsg_buffhd *bh) 2198static int do_mode_sense(struct fsg_dev *fsg, struct fsg_buffhd *bh)
2105{ 2199{
2106 struct lun *curlun = fsg->curlun; 2200 struct lun *curlun = fsg->curlun;
@@ -2848,6 +2942,26 @@ static int do_scsi_command(struct fsg_dev *fsg)
2848 reply = do_read_capacity(fsg, bh); 2942 reply = do_read_capacity(fsg, bh);
2849 break; 2943 break;
2850 2944
2945 case SC_READ_HEADER:
2946 if (!mod_data.cdrom)
2947 goto unknown_cmnd;
2948 fsg->data_size_from_cmnd = get_be16(&fsg->cmnd[7]);
2949 if ((reply = check_command(fsg, 10, DATA_DIR_TO_HOST,
2950 (3<<7) | (0x1f<<1), 1,
2951 "READ HEADER")) == 0)
2952 reply = do_read_header(fsg, bh);
2953 break;
2954
2955 case SC_READ_TOC:
2956 if (!mod_data.cdrom)
2957 goto unknown_cmnd;
2958 fsg->data_size_from_cmnd = get_be16(&fsg->cmnd[7]);
2959 if ((reply = check_command(fsg, 10, DATA_DIR_TO_HOST,
2960 (7<<6) | (1<<1), 1,
2961 "READ TOC")) == 0)
2962 reply = do_read_toc(fsg, bh);
2963 break;
2964
2851 case SC_READ_FORMAT_CAPACITIES: 2965 case SC_READ_FORMAT_CAPACITIES:
2852 fsg->data_size_from_cmnd = get_be16(&fsg->cmnd[7]); 2966 fsg->data_size_from_cmnd = get_be16(&fsg->cmnd[7]);
2853 if ((reply = check_command(fsg, 10, DATA_DIR_TO_HOST, 2967 if ((reply = check_command(fsg, 10, DATA_DIR_TO_HOST,
@@ -2933,6 +3047,7 @@ static int do_scsi_command(struct fsg_dev *fsg)
2933 // Fall through 3047 // Fall through
2934 3048
2935 default: 3049 default:
3050 unknown_cmnd:
2936 fsg->data_size_from_cmnd = 0; 3051 fsg->data_size_from_cmnd = 0;
2937 sprintf(unknown, "Unknown x%02x", fsg->cmnd[0]); 3052 sprintf(unknown, "Unknown x%02x", fsg->cmnd[0]);
2938 if ((reply = check_command(fsg, fsg->cmnd_size, 3053 if ((reply = check_command(fsg, fsg->cmnd_size,
@@ -3498,6 +3613,7 @@ static int open_backing_file(struct lun *curlun, const char *filename)
3498 struct inode *inode = NULL; 3613 struct inode *inode = NULL;
3499 loff_t size; 3614 loff_t size;
3500 loff_t num_sectors; 3615 loff_t num_sectors;
3616 loff_t min_sectors;
3501 3617
3502 /* R/W if we can, R/O if we must */ 3618 /* R/W if we can, R/O if we must */
3503 ro = curlun->ro; 3619 ro = curlun->ro;
@@ -3541,8 +3657,19 @@ static int open_backing_file(struct lun *curlun, const char *filename)
3541 rc = (int) size; 3657 rc = (int) size;
3542 goto out; 3658 goto out;
3543 } 3659 }
3544 num_sectors = size >> 9; // File size in 512-byte sectors 3660 num_sectors = size >> 9; // File size in 512-byte blocks
3545 if (num_sectors == 0) { 3661 min_sectors = 1;
3662 if (mod_data.cdrom) {
3663 num_sectors &= ~3; // Reduce to a multiple of 2048
3664 min_sectors = 300*4; // Smallest track is 300 frames
3665 if (num_sectors >= 256*60*75*4) {
3666 num_sectors = (256*60*75 - 1) * 4;
3667 LINFO(curlun, "file too big: %s\n", filename);
3668 LINFO(curlun, "using only first %d blocks\n",
3669 (int) num_sectors);
3670 }
3671 }
3672 if (num_sectors < min_sectors) {
3546 LINFO(curlun, "file too small: %s\n", filename); 3673 LINFO(curlun, "file too small: %s\n", filename);
3547 rc = -ETOOSMALL; 3674 rc = -ETOOSMALL;
3548 goto out; 3675 goto out;
@@ -3845,9 +3972,12 @@ static int __init fsg_bind(struct usb_gadget *gadget)
3845 goto out; 3972 goto out;
3846 3973
3847 if (mod_data.removable) { // Enable the store_xxx attributes 3974 if (mod_data.removable) { // Enable the store_xxx attributes
3848 dev_attr_ro.attr.mode = dev_attr_file.attr.mode = 0644; 3975 dev_attr_file.attr.mode = 0644;
3849 dev_attr_ro.store = store_ro;
3850 dev_attr_file.store = store_file; 3976 dev_attr_file.store = store_file;
3977 if (!mod_data.cdrom) {
3978 dev_attr_ro.attr.mode = 0644;
3979 dev_attr_ro.store = store_ro;
3980 }
3851 } 3981 }
3852 3982
3853 /* Find out how many LUNs there should be */ 3983 /* Find out how many LUNs there should be */
@@ -3872,6 +4002,8 @@ static int __init fsg_bind(struct usb_gadget *gadget)
3872 for (i = 0; i < fsg->nluns; ++i) { 4002 for (i = 0; i < fsg->nluns; ++i) {
3873 curlun = &fsg->luns[i]; 4003 curlun = &fsg->luns[i];
3874 curlun->ro = mod_data.ro[i]; 4004 curlun->ro = mod_data.ro[i];
4005 if (mod_data.cdrom)
4006 curlun->ro = 1;
3875 curlun->dev.release = lun_release; 4007 curlun->dev.release = lun_release;
3876 curlun->dev.parent = &gadget->dev; 4008 curlun->dev.parent = &gadget->dev;
3877 curlun->dev.driver = &fsg_driver.driver; 4009 curlun->dev.driver = &fsg_driver.driver;
@@ -4031,9 +4163,9 @@ static int __init fsg_bind(struct usb_gadget *gadget)
4031 mod_data.protocol_name, mod_data.protocol_type); 4163 mod_data.protocol_name, mod_data.protocol_type);
4032 DBG(fsg, "VendorID=x%04x, ProductID=x%04x, Release=x%04x\n", 4164 DBG(fsg, "VendorID=x%04x, ProductID=x%04x, Release=x%04x\n",
4033 mod_data.vendor, mod_data.product, mod_data.release); 4165 mod_data.vendor, mod_data.product, mod_data.release);
4034 DBG(fsg, "removable=%d, stall=%d, buflen=%u\n", 4166 DBG(fsg, "removable=%d, stall=%d, cdrom=%d, buflen=%u\n",
4035 mod_data.removable, mod_data.can_stall, 4167 mod_data.removable, mod_data.can_stall,
4036 mod_data.buflen); 4168 mod_data.cdrom, mod_data.buflen);
4037 DBG(fsg, "I/O thread pid: %d\n", task_pid_nr(fsg->thread_task)); 4169 DBG(fsg, "I/O thread pid: %d\n", task_pid_nr(fsg->thread_task));
4038 4170
4039 set_bit(REGISTERED, &fsg->atomic_bitflags); 4171 set_bit(REGISTERED, &fsg->atomic_bitflags);
@@ -4050,6 +4182,7 @@ out:
4050 fsg->state = FSG_STATE_TERMINATED; // The thread is dead 4182 fsg->state = FSG_STATE_TERMINATED; // The thread is dead
4051 fsg_unbind(gadget); 4183 fsg_unbind(gadget);
4052 close_all_backing_files(fsg); 4184 close_all_backing_files(fsg);
4185 complete(&fsg->thread_notifier);
4053 return rc; 4186 return rc;
4054} 4187}
4055 4188
diff --git a/drivers/usb/gadget/fsl_qe_udc.c b/drivers/usb/gadget/fsl_qe_udc.c
index f40272565098..d6c5bcd40064 100644
--- a/drivers/usb/gadget/fsl_qe_udc.c
+++ b/drivers/usb/gadget/fsl_qe_udc.c
@@ -26,6 +26,7 @@
26#include <linux/ioport.h> 26#include <linux/ioport.h>
27#include <linux/types.h> 27#include <linux/types.h>
28#include <linux/errno.h> 28#include <linux/errno.h>
29#include <linux/err.h>
29#include <linux/slab.h> 30#include <linux/slab.h>
30#include <linux/list.h> 31#include <linux/list.h>
31#include <linux/interrupt.h> 32#include <linux/interrupt.h>
@@ -370,6 +371,9 @@ static int qe_ep_bd_init(struct qe_udc *udc, unsigned char pipe_num)
370 /* alloc multi-ram for BD rings and set the ep parameters */ 371 /* alloc multi-ram for BD rings and set the ep parameters */
371 tmp_addr = cpm_muram_alloc(sizeof(struct qe_bd) * (bdring_len + 372 tmp_addr = cpm_muram_alloc(sizeof(struct qe_bd) * (bdring_len +
372 USB_BDRING_LEN_TX), QE_ALIGNMENT_OF_BD); 373 USB_BDRING_LEN_TX), QE_ALIGNMENT_OF_BD);
374 if (IS_ERR_VALUE(tmp_addr))
375 return -ENOMEM;
376
373 out_be16(&epparam->rbase, (u16)tmp_addr); 377 out_be16(&epparam->rbase, (u16)tmp_addr);
374 out_be16(&epparam->tbase, (u16)(tmp_addr + 378 out_be16(&epparam->tbase, (u16)(tmp_addr +
375 (sizeof(struct qe_bd) * bdring_len))); 379 (sizeof(struct qe_bd) * bdring_len)));
@@ -689,7 +693,7 @@ en_done2:
689en_done1: 693en_done1:
690 spin_unlock_irqrestore(&udc->lock, flags); 694 spin_unlock_irqrestore(&udc->lock, flags);
691en_done: 695en_done:
692 dev_dbg(udc->dev, "failed to initialize %s\n", ep->ep.name); 696 dev_err(udc->dev, "failed to initialize %s\n", ep->ep.name);
693 return -ENODEV; 697 return -ENODEV;
694} 698}
695 699
@@ -2408,6 +2412,8 @@ static struct qe_udc __devinit *qe_udc_config(struct of_device *ofdev)
2408 tmp_addr = cpm_muram_alloc((USB_MAX_ENDPOINTS * 2412 tmp_addr = cpm_muram_alloc((USB_MAX_ENDPOINTS *
2409 sizeof(struct usb_ep_para)), 2413 sizeof(struct usb_ep_para)),
2410 USB_EP_PARA_ALIGNMENT); 2414 USB_EP_PARA_ALIGNMENT);
2415 if (IS_ERR_VALUE(tmp_addr))
2416 goto cleanup;
2411 2417
2412 for (i = 0; i < USB_MAX_ENDPOINTS; i++) { 2418 for (i = 0; i < USB_MAX_ENDPOINTS; i++) {
2413 out_be16(&usbpram->epptr[i], (u16)tmp_addr); 2419 out_be16(&usbpram->epptr[i], (u16)tmp_addr);
@@ -2513,7 +2519,7 @@ static int __devinit qe_udc_probe(struct of_device *ofdev,
2513 /* Initialize the udc structure including QH member and other member */ 2519 /* Initialize the udc structure including QH member and other member */
2514 udc_controller = qe_udc_config(ofdev); 2520 udc_controller = qe_udc_config(ofdev);
2515 if (!udc_controller) { 2521 if (!udc_controller) {
2516 dev_dbg(&ofdev->dev, "udc_controll is NULL\n"); 2522 dev_err(&ofdev->dev, "failed to initialize\n");
2517 return -ENOMEM; 2523 return -ENOMEM;
2518 } 2524 }
2519 2525
@@ -2568,7 +2574,7 @@ static int __devinit qe_udc_probe(struct of_device *ofdev,
2568 /* create a buf for ZLP send, need to remain zeroed */ 2574 /* create a buf for ZLP send, need to remain zeroed */
2569 udc_controller->nullbuf = kzalloc(256, GFP_KERNEL); 2575 udc_controller->nullbuf = kzalloc(256, GFP_KERNEL);
2570 if (udc_controller->nullbuf == NULL) { 2576 if (udc_controller->nullbuf == NULL) {
2571 dev_dbg(udc_controller->dev, "cannot alloc nullbuf\n"); 2577 dev_err(udc_controller->dev, "cannot alloc nullbuf\n");
2572 ret = -ENOMEM; 2578 ret = -ENOMEM;
2573 goto err3; 2579 goto err3;
2574 } 2580 }
diff --git a/drivers/usb/gadget/gadget_chips.h b/drivers/usb/gadget/gadget_chips.h
index 4e3107dd2f34..ec6d439a2aa5 100644
--- a/drivers/usb/gadget/gadget_chips.h
+++ b/drivers/usb/gadget/gadget_chips.h
@@ -110,7 +110,6 @@
110#define gadget_is_at91(g) 0 110#define gadget_is_at91(g) 0
111#endif 111#endif
112 112
113/* status unclear */
114#ifdef CONFIG_USB_GADGET_IMX 113#ifdef CONFIG_USB_GADGET_IMX
115#define gadget_is_imx(g) !strcmp("imx_udc", (g)->name) 114#define gadget_is_imx(g) !strcmp("imx_udc", (g)->name)
116#else 115#else
@@ -158,6 +157,11 @@
158#define gadget_is_fsl_qe(g) 0 157#define gadget_is_fsl_qe(g) 0
159#endif 158#endif
160 159
160#ifdef CONFIG_USB_GADGET_CI13XXX
161#define gadget_is_ci13xxx(g) (!strcmp("ci13xxx_udc", (g)->name))
162#else
163#define gadget_is_ci13xxx(g) 0
164#endif
161 165
162// CONFIG_USB_GADGET_SX2 166// CONFIG_USB_GADGET_SX2
163// CONFIG_USB_GADGET_AU1X00 167// CONFIG_USB_GADGET_AU1X00
@@ -225,6 +229,8 @@ static inline int usb_gadget_controller_number(struct usb_gadget *gadget)
225 return 0x21; 229 return 0x21;
226 else if (gadget_is_fsl_qe(gadget)) 230 else if (gadget_is_fsl_qe(gadget))
227 return 0x22; 231 return 0x22;
232 else if (gadget_is_ci13xxx(gadget))
233 return 0x23;
228 return -ENOENT; 234 return -ENOENT;
229} 235}
230 236
diff --git a/drivers/usb/gadget/goku_udc.c b/drivers/usb/gadget/goku_udc.c
index 60aa04847b18..63419c4d503c 100644
--- a/drivers/usb/gadget/goku_udc.c
+++ b/drivers/usb/gadget/goku_udc.c
@@ -1349,7 +1349,7 @@ int usb_gadget_register_driver(struct usb_gadget_driver *driver)
1349 int retval; 1349 int retval;
1350 1350
1351 if (!driver 1351 if (!driver
1352 || driver->speed != USB_SPEED_FULL 1352 || driver->speed < USB_SPEED_FULL
1353 || !driver->bind 1353 || !driver->bind
1354 || !driver->disconnect 1354 || !driver->disconnect
1355 || !driver->setup) 1355 || !driver->setup)
diff --git a/drivers/usb/gadget/imx_udc.c b/drivers/usb/gadget/imx_udc.c
new file mode 100644
index 000000000000..cde8fdf15d5b
--- /dev/null
+++ b/drivers/usb/gadget/imx_udc.c
@@ -0,0 +1,1516 @@
1/*
2 * driver/usb/gadget/imx_udc.c
3 *
4 * Copyright (C) 2005 Mike Lee(eemike@gmail.com)
5 * Copyright (C) 2008 Darius Augulis <augulis.darius@gmail.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 */
17
18#include <linux/init.h>
19#include <linux/kernel.h>
20#include <linux/platform_device.h>
21#include <linux/module.h>
22#include <linux/errno.h>
23#include <linux/list.h>
24#include <linux/interrupt.h>
25#include <linux/io.h>
26#include <linux/irq.h>
27#include <linux/device.h>
28#include <linux/dma-mapping.h>
29#include <linux/clk.h>
30#include <linux/delay.h>
31
32#include <linux/usb/ch9.h>
33#include <linux/usb/gadget.h>
34
35#include <mach/usb.h>
36#include <mach/hardware.h>
37
38#include "imx_udc.h"
39
40static const char driver_name[] = "imx_udc";
41static const char ep0name[] = "ep0";
42
43void ep0_chg_stat(const char *label, struct imx_udc_struct *imx_usb,
44 enum ep0_state stat);
45
46/*******************************************************************************
47 * IMX UDC hardware related functions
48 *******************************************************************************
49 */
50
51void imx_udc_enable(struct imx_udc_struct *imx_usb)
52{
53 int temp = __raw_readl(imx_usb->base + USB_CTRL);
54 __raw_writel(temp | CTRL_FE_ENA | CTRL_AFE_ENA, imx_usb->base + USB_CTRL);
55 imx_usb->gadget.speed = USB_SPEED_FULL;
56}
57
58void imx_udc_disable(struct imx_udc_struct *imx_usb)
59{
60 int temp = __raw_readl(imx_usb->base + USB_CTRL);
61
62 __raw_writel(temp & ~(CTRL_FE_ENA | CTRL_AFE_ENA),
63 imx_usb->base + USB_CTRL);
64
65 ep0_chg_stat(__func__, imx_usb, EP0_IDLE);
66 imx_usb->gadget.speed = USB_SPEED_UNKNOWN;
67}
68
69void imx_udc_reset(struct imx_udc_struct *imx_usb)
70{
71 int temp = __raw_readl(imx_usb->base + USB_ENAB);
72
73 /* set RST bit */
74 __raw_writel(temp | ENAB_RST, imx_usb->base + USB_ENAB);
75
76 /* wait RST bit to clear */
77 do {} while (__raw_readl(imx_usb->base + USB_ENAB) & ENAB_RST);
78
79 /* wait CFG bit to assert */
80 do {} while (!(__raw_readl(imx_usb->base + USB_DADR) & DADR_CFG));
81
82 /* udc module is now ready */
83}
84
85void imx_udc_config(struct imx_udc_struct *imx_usb)
86{
87 u8 ep_conf[5];
88 u8 i, j, cfg;
89 struct imx_ep_struct *imx_ep;
90
91 /* wait CFG bit to assert */
92 do {} while (!(__raw_readl(imx_usb->base + USB_DADR) & DADR_CFG));
93
94 /* Download the endpoint buffer for endpoint 0. */
95 for (j = 0; j < 5; j++) {
96 i = (j == 2 ? imx_usb->imx_ep[0].fifosize : 0x00);
97 __raw_writeb(i, imx_usb->base + USB_DDAT);
98 do {} while (__raw_readl(imx_usb->base + USB_DADR) & DADR_BSY);
99 }
100
101 /* Download the endpoint buffers for endpoints 1-5.
102 * We specify two configurations, one interface
103 */
104 for (cfg = 1; cfg < 3; cfg++) {
105 for (i = 1; i < IMX_USB_NB_EP; i++) {
106 imx_ep = &imx_usb->imx_ep[i];
107 /* EP no | Config no */
108 ep_conf[0] = (i << 4) | (cfg << 2);
109 /* Type | Direction */
110 ep_conf[1] = (imx_ep->bmAttributes << 3) |
111 (EP_DIR(imx_ep) << 2);
112 /* Max packet size */
113 ep_conf[2] = imx_ep->fifosize;
114 /* TRXTYP */
115 ep_conf[3] = 0xC0;
116 /* FIFO no */
117 ep_conf[4] = i;
118
119 D_INI(imx_usb->dev,
120 "<%s> ep%d_conf[%d]:"
121 "[%02x-%02x-%02x-%02x-%02x]\n",
122 __func__, i, cfg,
123 ep_conf[0], ep_conf[1], ep_conf[2],
124 ep_conf[3], ep_conf[4]);
125
126 for (j = 0; j < 5; j++) {
127 __raw_writeb(ep_conf[j],
128 imx_usb->base + USB_DDAT);
129 do {} while (__raw_readl(imx_usb->base + USB_DADR)
130 & DADR_BSY);
131 }
132 }
133 }
134
135 /* wait CFG bit to clear */
136 do {} while (__raw_readl(imx_usb->base + USB_DADR) & DADR_CFG);
137}
138
139void imx_udc_init_irq(struct imx_udc_struct *imx_usb)
140{
141 int i;
142
143 /* Mask and clear all irqs */
144 __raw_writel(0xFFFFFFFF, imx_usb->base + USB_MASK);
145 __raw_writel(0xFFFFFFFF, imx_usb->base + USB_INTR);
146 for (i = 0; i < IMX_USB_NB_EP; i++) {
147 __raw_writel(0x1FF, imx_usb->base + USB_EP_MASK(i));
148 __raw_writel(0x1FF, imx_usb->base + USB_EP_INTR(i));
149 }
150
151 /* Enable USB irqs */
152 __raw_writel(INTR_MSOF | INTR_FRAME_MATCH, imx_usb->base + USB_MASK);
153
154 /* Enable EP0 irqs */
155 __raw_writel(0x1FF & ~(EPINTR_DEVREQ | EPINTR_MDEVREQ | EPINTR_EOT
156 | EPINTR_EOF | EPINTR_FIFO_EMPTY | EPINTR_FIFO_FULL),
157 imx_usb->base + USB_EP_MASK(0));
158}
159
160void imx_udc_init_ep(struct imx_udc_struct *imx_usb)
161{
162 int i, max, temp;
163 struct imx_ep_struct *imx_ep;
164 for (i = 0; i < IMX_USB_NB_EP; i++) {
165 imx_ep = &imx_usb->imx_ep[i];
166 switch (imx_ep->fifosize) {
167 case 8:
168 max = 0;
169 break;
170 case 16:
171 max = 1;
172 break;
173 case 32:
174 max = 2;
175 break;
176 case 64:
177 max = 3;
178 break;
179 default:
180 max = 1;
181 break;
182 }
183 temp = (EP_DIR(imx_ep) << 7) | (max << 5)
184 | (imx_ep->bmAttributes << 3);
185 __raw_writel(temp, imx_usb->base + USB_EP_STAT(i));
186 __raw_writel(temp | EPSTAT_FLUSH, imx_usb->base + USB_EP_STAT(i));
187 D_INI(imx_usb->dev, "<%s> ep%d_stat %08x\n", __func__, i,
188 __raw_readl(imx_usb->base + USB_EP_STAT(i)));
189 }
190}
191
192void imx_udc_init_fifo(struct imx_udc_struct *imx_usb)
193{
194 int i, temp;
195 struct imx_ep_struct *imx_ep;
196 for (i = 0; i < IMX_USB_NB_EP; i++) {
197 imx_ep = &imx_usb->imx_ep[i];
198
199 /* Fifo control */
200 temp = EP_DIR(imx_ep) ? 0x0B000000 : 0x0F000000;
201 __raw_writel(temp, imx_usb->base + USB_EP_FCTRL(i));
202 D_INI(imx_usb->dev, "<%s> ep%d_fctrl %08x\n", __func__, i,
203 __raw_readl(imx_usb->base + USB_EP_FCTRL(i)));
204
205 /* Fifo alarm */
206 temp = (i ? imx_ep->fifosize / 2 : 0);
207 __raw_writel(temp, imx_usb->base + USB_EP_FALRM(i));
208 D_INI(imx_usb->dev, "<%s> ep%d_falrm %08x\n", __func__, i,
209 __raw_readl(imx_usb->base + USB_EP_FALRM(i)));
210 }
211}
212
213static void imx_udc_init(struct imx_udc_struct *imx_usb)
214{
215 /* Reset UDC */
216 imx_udc_reset(imx_usb);
217
218 /* Download config to enpoint buffer */
219 imx_udc_config(imx_usb);
220
221 /* Setup interrups */
222 imx_udc_init_irq(imx_usb);
223
224 /* Setup endpoints */
225 imx_udc_init_ep(imx_usb);
226
227 /* Setup fifos */
228 imx_udc_init_fifo(imx_usb);
229}
230
231void imx_ep_irq_enable(struct imx_ep_struct *imx_ep)
232{
233
234 int i = EP_NO(imx_ep);
235
236 __raw_writel(0x1FF, imx_ep->imx_usb->base + USB_EP_MASK(i));
237 __raw_writel(0x1FF, imx_ep->imx_usb->base + USB_EP_INTR(i));
238 __raw_writel(0x1FF & ~(EPINTR_EOT | EPINTR_EOF),
239 imx_ep->imx_usb->base + USB_EP_MASK(i));
240}
241
242void imx_ep_irq_disable(struct imx_ep_struct *imx_ep)
243{
244
245 int i = EP_NO(imx_ep);
246
247 __raw_writel(0x1FF, imx_ep->imx_usb->base + USB_EP_MASK(i));
248 __raw_writel(0x1FF, imx_ep->imx_usb->base + USB_EP_INTR(i));
249}
250
251int imx_ep_empty(struct imx_ep_struct *imx_ep)
252{
253 struct imx_udc_struct *imx_usb = imx_ep->imx_usb;
254
255 return __raw_readl(imx_usb->base + USB_EP_FSTAT(EP_NO(imx_ep)))
256 & FSTAT_EMPTY;
257}
258
259unsigned imx_fifo_bcount(struct imx_ep_struct *imx_ep)
260{
261 struct imx_udc_struct *imx_usb = imx_ep->imx_usb;
262
263 return (__raw_readl(imx_usb->base + USB_EP_STAT(EP_NO(imx_ep)))
264 & EPSTAT_BCOUNT) >> 16;
265}
266
267void imx_flush(struct imx_ep_struct *imx_ep)
268{
269 struct imx_udc_struct *imx_usb = imx_ep->imx_usb;
270
271 int temp = __raw_readl(imx_usb->base + USB_EP_STAT(EP_NO(imx_ep)));
272 __raw_writel(temp | EPSTAT_FLUSH,
273 imx_usb->base + USB_EP_STAT(EP_NO(imx_ep)));
274}
275
276void imx_ep_stall(struct imx_ep_struct *imx_ep)
277{
278 struct imx_udc_struct *imx_usb = imx_ep->imx_usb;
279 int temp, i;
280
281 D_ERR(imx_usb->dev, "<%s> Forced stall on %s\n", __func__, imx_ep->ep.name);
282
283 imx_flush(imx_ep);
284
285 /* Special care for ep0 */
286 if (EP_NO(imx_ep)) {
287 temp = __raw_readl(imx_usb->base + USB_CTRL);
288 __raw_writel(temp | CTRL_CMDOVER | CTRL_CMDERROR, imx_usb->base + USB_CTRL);
289 do { } while (__raw_readl(imx_usb->base + USB_CTRL) & CTRL_CMDOVER);
290 temp = __raw_readl(imx_usb->base + USB_CTRL);
291 __raw_writel(temp & ~CTRL_CMDERROR, imx_usb->base + USB_CTRL);
292 }
293 else {
294 temp = __raw_readl(imx_usb->base + USB_EP_STAT(EP_NO(imx_ep)));
295 __raw_writel(temp | EPSTAT_STALL,
296 imx_usb->base + USB_EP_STAT(EP_NO(imx_ep)));
297
298 for (i = 0; i < 100; i ++) {
299 temp = __raw_readl(imx_usb->base + USB_EP_STAT(EP_NO(imx_ep)));
300 if (!temp & EPSTAT_STALL)
301 break;
302 udelay(20);
303 }
304 if (i == 50)
305 D_ERR(imx_usb->dev, "<%s> Non finished stall on %s\n",
306 __func__, imx_ep->ep.name);
307 }
308}
309
310static int imx_udc_get_frame(struct usb_gadget *_gadget)
311{
312 struct imx_udc_struct *imx_usb = container_of(_gadget,
313 struct imx_udc_struct, gadget);
314
315 return __raw_readl(imx_usb->base + USB_FRAME) & 0x7FF;
316}
317
318static int imx_udc_wakeup(struct usb_gadget *_gadget)
319{
320 return 0;
321}
322
323/*******************************************************************************
324 * USB request control functions
325 *******************************************************************************
326 */
327
328static void ep_add_request(struct imx_ep_struct *imx_ep, struct imx_request *req)
329{
330 if (unlikely(!req))
331 return;
332
333 req->in_use = 1;
334 list_add_tail(&req->queue, &imx_ep->queue);
335}
336
337static void ep_del_request(struct imx_ep_struct *imx_ep, struct imx_request *req)
338{
339 if (unlikely(!req))
340 return;
341
342 list_del_init(&req->queue);
343 req->in_use = 0;
344}
345
346static void done(struct imx_ep_struct *imx_ep, struct imx_request *req, int status)
347{
348 ep_del_request(imx_ep, req);
349
350 if (likely(req->req.status == -EINPROGRESS))
351 req->req.status = status;
352 else
353 status = req->req.status;
354
355 if (status && status != -ESHUTDOWN)
356 D_ERR(imx_ep->imx_usb->dev,
357 "<%s> complete %s req %p stat %d len %u/%u\n", __func__,
358 imx_ep->ep.name, &req->req, status,
359 req->req.actual, req->req.length);
360
361 req->req.complete(&imx_ep->ep, &req->req);
362}
363
364static void nuke(struct imx_ep_struct *imx_ep, int status)
365{
366 struct imx_request *req;
367
368 while (!list_empty(&imx_ep->queue)) {
369 req = list_entry(imx_ep->queue.next, struct imx_request, queue);
370 done(imx_ep, req, status);
371 }
372}
373
374/*******************************************************************************
375 * Data tansfer over USB functions
376 *******************************************************************************
377 */
378static int read_packet(struct imx_ep_struct *imx_ep, struct imx_request *req)
379{
380 u8 *buf;
381 int bytes_ep, bufferspace, count, i;
382
383 bytes_ep = imx_fifo_bcount(imx_ep);
384 bufferspace = req->req.length - req->req.actual;
385
386 buf = req->req.buf + req->req.actual;
387 prefetchw(buf);
388
389 if (unlikely(imx_ep_empty(imx_ep)))
390 count = 0; /* zlp */
391 else
392 count = min(bytes_ep, bufferspace);
393
394 for (i = count; i > 0; i--)
395 *buf++ = __raw_readb(imx_ep->imx_usb->base
396 + USB_EP_FDAT0(EP_NO(imx_ep)));
397 req->req.actual += count;
398
399 return count;
400}
401
402static int write_packet(struct imx_ep_struct *imx_ep, struct imx_request *req)
403{
404 u8 *buf;
405 int length, count, temp;
406
407 buf = req->req.buf + req->req.actual;
408 prefetch(buf);
409
410 length = min(req->req.length - req->req.actual, (u32)imx_ep->fifosize);
411
412 if (imx_fifo_bcount(imx_ep) + length > imx_ep->fifosize) {
413 D_TRX(imx_ep->imx_usb->dev, "<%s> packet overfill %s fifo\n",
414 __func__, imx_ep->ep.name);
415 return -1;
416 }
417
418 req->req.actual += length;
419 count = length;
420
421 if (!count && req->req.zero) { /* zlp */
422 temp = __raw_readl(imx_ep->imx_usb->base
423 + USB_EP_STAT(EP_NO(imx_ep)));
424 __raw_writel(temp | EPSTAT_ZLPS, imx_ep->imx_usb->base
425 + USB_EP_STAT(EP_NO(imx_ep)));
426 D_TRX(imx_ep->imx_usb->dev, "<%s> zero packet\n", __func__);
427 return 0;
428 }
429
430 while (count--) {
431 if (count == 0) { /* last byte */
432 temp = __raw_readl(imx_ep->imx_usb->base
433 + USB_EP_FCTRL(EP_NO(imx_ep)));
434 __raw_writel(temp | FCTRL_WFR, imx_ep->imx_usb->base
435 + USB_EP_FCTRL(EP_NO(imx_ep)));
436 }
437 __raw_writeb(*buf++,
438 imx_ep->imx_usb->base + USB_EP_FDAT0(EP_NO(imx_ep)));
439 }
440
441 return length;
442}
443
444static int read_fifo(struct imx_ep_struct *imx_ep, struct imx_request *req)
445{
446 int bytes = 0,
447 count,
448 completed = 0;
449
450 while (__raw_readl(imx_ep->imx_usb->base + USB_EP_FSTAT(EP_NO(imx_ep)))
451 & FSTAT_FR) {
452 count = read_packet(imx_ep, req);
453 bytes += count;
454
455 completed = (count != imx_ep->fifosize);
456 if (completed || req->req.actual == req->req.length) {
457 completed = 1;
458 break;
459 }
460 }
461
462 if (completed || !req->req.length) {
463 done(imx_ep, req, 0);
464 D_REQ(imx_ep->imx_usb->dev, "<%s> %s req<%p> %s\n",
465 __func__, imx_ep->ep.name, req,
466 completed ? "completed" : "not completed");
467 if (!EP_NO(imx_ep))
468 ep0_chg_stat(__func__, imx_ep->imx_usb, EP0_IDLE);
469 }
470
471 D_TRX(imx_ep->imx_usb->dev, "<%s> bytes read: %d\n", __func__, bytes);
472
473 return completed;
474}
475
476static int write_fifo(struct imx_ep_struct *imx_ep, struct imx_request *req)
477{
478 int bytes = 0,
479 count,
480 completed = 0;
481
482 while (!completed) {
483 count = write_packet(imx_ep, req);
484 if (count < 0)
485 break; /* busy */
486 bytes += count;
487
488 /* last packet "must be" short (or a zlp) */
489 completed = (count != imx_ep->fifosize);
490
491 if (unlikely(completed)) {
492 done(imx_ep, req, 0);
493 D_REQ(imx_ep->imx_usb->dev, "<%s> %s req<%p> %s\n",
494 __func__, imx_ep->ep.name, req,
495 completed ? "completed" : "not completed");
496 if (!EP_NO(imx_ep))
497 ep0_chg_stat(__func__, imx_ep->imx_usb, EP0_IDLE);
498 }
499 }
500
501 D_TRX(imx_ep->imx_usb->dev, "<%s> bytes sent: %d\n", __func__, bytes);
502
503 return completed;
504}
505
506/*******************************************************************************
507 * Endpoint handlers
508 *******************************************************************************
509 */
510static int handle_ep(struct imx_ep_struct *imx_ep)
511{
512 struct imx_request *req;
513 int completed = 0;
514
515 do {
516 if (!list_empty(&imx_ep->queue))
517 req = list_entry(imx_ep->queue.next,
518 struct imx_request, queue);
519 else {
520 D_REQ(imx_ep->imx_usb->dev, "<%s> no request on %s\n",
521 __func__, imx_ep->ep.name);
522 return 0;
523 }
524
525 if (EP_DIR(imx_ep)) /* to host */
526 completed = write_fifo(imx_ep, req);
527 else /* to device */
528 completed = read_fifo(imx_ep, req);
529
530 dump_ep_stat(__func__, imx_ep);
531
532 } while (completed);
533
534 return 0;
535}
536
537static int handle_ep0(struct imx_ep_struct *imx_ep)
538{
539 struct imx_request *req = NULL;
540 int ret = 0;
541
542 if (!list_empty(&imx_ep->queue))
543 req = list_entry(imx_ep->queue.next, struct imx_request, queue);
544
545 if (req) {
546 switch (imx_ep->imx_usb->ep0state) {
547
548 case EP0_IN_DATA_PHASE: /* GET_DESCRIPTOR */
549 write_fifo(imx_ep, req);
550 break;
551 case EP0_OUT_DATA_PHASE: /* SET_DESCRIPTOR */
552 read_fifo(imx_ep, req);
553 break;
554 default:
555 D_EP0(imx_ep->imx_usb->dev,
556 "<%s> ep0 i/o, odd state %d\n",
557 __func__, imx_ep->imx_usb->ep0state);
558 ep_del_request(imx_ep, req);
559 ret = -EL2HLT;
560 break;
561 }
562 }
563
564 return ret;
565}
566
567static void handle_ep0_devreq(struct imx_udc_struct *imx_usb)
568{
569 struct imx_ep_struct *imx_ep = &imx_usb->imx_ep[0];
570 union {
571 struct usb_ctrlrequest r;
572 u8 raw[8];
573 u32 word[2];
574 } u;
575 int temp, i;
576
577 nuke(imx_ep, -EPROTO);
578
579 /* read SETUP packet */
580 for (i = 0; i < 2; i++) {
581 if (imx_ep_empty(imx_ep)) {
582 D_ERR(imx_usb->dev,
583 "<%s> no setup packet received\n", __func__);
584 goto stall;
585 }
586 u.word[i] = __raw_readl(imx_usb->base + USB_EP_FDAT(EP_NO(imx_ep)));
587 }
588
589 temp = imx_ep_empty(imx_ep);
590 while (!imx_ep_empty(imx_ep)) {
591 i = __raw_readl(imx_usb->base + USB_EP_FDAT(EP_NO(imx_ep)));
592 D_ERR(imx_usb->dev,
593 "<%s> wrong to have extra bytes for setup : 0x%08x\n",
594 __func__, i);
595 }
596 if (!temp)
597 goto stall;
598
599 le16_to_cpus(&u.r.wValue);
600 le16_to_cpus(&u.r.wIndex);
601 le16_to_cpus(&u.r.wLength);
602
603 D_REQ(imx_usb->dev, "<%s> SETUP %02x.%02x v%04x i%04x l%04x\n",
604 __func__, u.r.bRequestType, u.r.bRequest,
605 u.r.wValue, u.r.wIndex, u.r.wLength);
606
607 if (imx_usb->set_config) {
608 /* NACK the host by using CMDOVER */
609 temp = __raw_readl(imx_usb->base + USB_CTRL);
610 __raw_writel(temp | CTRL_CMDOVER, imx_usb->base + USB_CTRL);
611
612 D_ERR(imx_usb->dev,
613 "<%s> set config req is pending, NACK the host\n",
614 __func__);
615 return;
616 }
617
618 if (u.r.bRequestType & USB_DIR_IN)
619 ep0_chg_stat(__func__, imx_usb, EP0_IN_DATA_PHASE);
620 else
621 ep0_chg_stat(__func__, imx_usb, EP0_OUT_DATA_PHASE);
622
623 i = imx_usb->driver->setup(&imx_usb->gadget, &u.r);
624 if (i < 0) {
625 D_ERR(imx_usb->dev, "<%s> device setup error %d\n",
626 __func__, i);
627 goto stall;
628 }
629
630 return;
631stall:
632 D_ERR(imx_usb->dev, "<%s> protocol STALL\n", __func__);
633 imx_ep_stall(imx_ep);
634 ep0_chg_stat(__func__, imx_usb, EP0_STALL);
635 return;
636}
637
638/*******************************************************************************
639 * USB gadget callback functions
640 *******************************************************************************
641 */
642
643static int imx_ep_enable(struct usb_ep *usb_ep,
644 const struct usb_endpoint_descriptor *desc)
645{
646 struct imx_ep_struct *imx_ep = container_of(usb_ep,
647 struct imx_ep_struct, ep);
648 struct imx_udc_struct *imx_usb = imx_ep->imx_usb;
649 unsigned long flags;
650
651 if (!usb_ep
652 || !desc
653 || !EP_NO(imx_ep)
654 || desc->bDescriptorType != USB_DT_ENDPOINT
655 || imx_ep->bEndpointAddress != desc->bEndpointAddress) {
656 D_ERR(imx_usb->dev,
657 "<%s> bad ep or descriptor\n", __func__);
658 return -EINVAL;
659 }
660
661 if (imx_ep->bmAttributes != desc->bmAttributes) {
662 D_ERR(imx_usb->dev,
663 "<%s> %s type mismatch\n", __func__, usb_ep->name);
664 return -EINVAL;
665 }
666
667 if (imx_ep->fifosize < le16_to_cpu(desc->wMaxPacketSize)) {
668 D_ERR(imx_usb->dev,
669 "<%s> bad %s maxpacket\n", __func__, usb_ep->name);
670 return -ERANGE;
671 }
672
673 if (!imx_usb->driver || imx_usb->gadget.speed == USB_SPEED_UNKNOWN) {
674 D_ERR(imx_usb->dev, "<%s> bogus device state\n", __func__);
675 return -ESHUTDOWN;
676 }
677
678 local_irq_save(flags);
679
680 imx_ep->stopped = 0;
681 imx_flush(imx_ep);
682 imx_ep_irq_enable(imx_ep);
683
684 local_irq_restore(flags);
685
686 D_EPX(imx_usb->dev, "<%s> ENABLED %s\n", __func__, usb_ep->name);
687 return 0;
688}
689
690static int imx_ep_disable(struct usb_ep *usb_ep)
691{
692 struct imx_ep_struct *imx_ep = container_of(usb_ep,
693 struct imx_ep_struct, ep);
694 unsigned long flags;
695
696 if (!usb_ep || !EP_NO(imx_ep) || !list_empty(&imx_ep->queue)) {
697 D_ERR(imx_ep->imx_usb->dev, "<%s> %s can not be disabled\n",
698 __func__, usb_ep ? imx_ep->ep.name : NULL);
699 return -EINVAL;
700 }
701
702 local_irq_save(flags);
703
704 imx_ep->stopped = 1;
705 nuke(imx_ep, -ESHUTDOWN);
706 imx_flush(imx_ep);
707 imx_ep_irq_disable(imx_ep);
708
709 local_irq_restore(flags);
710
711 D_EPX(imx_ep->imx_usb->dev,
712 "<%s> DISABLED %s\n", __func__, usb_ep->name);
713 return 0;
714}
715
716static struct usb_request *imx_ep_alloc_request
717 (struct usb_ep *usb_ep, gfp_t gfp_flags)
718{
719 struct imx_request *req;
720
721 req = kzalloc(sizeof *req, gfp_flags);
722 if (!req || !usb_ep)
723 return 0;
724
725 INIT_LIST_HEAD(&req->queue);
726 req->in_use = 0;
727
728 return &req->req;
729}
730
731static void imx_ep_free_request
732 (struct usb_ep *usb_ep, struct usb_request *usb_req)
733{
734 struct imx_request *req;
735
736 req = container_of(usb_req, struct imx_request, req);
737 WARN_ON(!list_empty(&req->queue));
738 kfree(req);
739}
740
741static int imx_ep_queue
742 (struct usb_ep *usb_ep, struct usb_request *usb_req, gfp_t gfp_flags)
743{
744 struct imx_ep_struct *imx_ep;
745 struct imx_udc_struct *imx_usb;
746 struct imx_request *req;
747 unsigned long flags;
748 int ret = 0;
749
750 imx_ep = container_of(usb_ep, struct imx_ep_struct, ep);
751 imx_usb = imx_ep->imx_usb;
752 req = container_of(usb_req, struct imx_request, req);
753
754 /*
755 Special care on IMX udc.
756 Ignore enqueue when after set configuration from the
757 host. This assume all gadget drivers reply set
758 configuration with the next ep0 req enqueue.
759 */
760 if (imx_usb->set_config && !EP_NO(imx_ep)) {
761 imx_usb->set_config = 0;
762 D_EPX(imx_usb->dev,
763 "<%s> gadget reply set config\n", __func__);
764 return 0;
765 }
766
767 if (unlikely(!usb_req || !req || !usb_req->complete || !usb_req->buf)) {
768 D_ERR(imx_usb->dev, "<%s> bad params\n", __func__);
769 return -EINVAL;
770 }
771
772 if (unlikely(!usb_ep || !imx_ep)) {
773 D_ERR(imx_usb->dev, "<%s> bad ep\n", __func__);
774 return -EINVAL;
775 }
776
777 if (!imx_usb->driver || imx_usb->gadget.speed == USB_SPEED_UNKNOWN) {
778 D_ERR(imx_usb->dev, "<%s> bogus device state\n", __func__);
779 return -ESHUTDOWN;
780 }
781
782 local_irq_save(flags);
783
784 /* Debug */
785 D_REQ(imx_usb->dev, "<%s> ep%d %s request for [%d] bytes\n",
786 __func__, EP_NO(imx_ep),
787 ((!EP_NO(imx_ep) && imx_ep->imx_usb->ep0state == EP0_IN_DATA_PHASE)
788 || (EP_NO(imx_ep) && EP_DIR(imx_ep))) ? "IN" : "OUT", usb_req->length);
789 dump_req(__func__, imx_ep, usb_req);
790
791 if (imx_ep->stopped) {
792 usb_req->status = -ESHUTDOWN;
793 ret = -ESHUTDOWN;
794 goto out;
795 }
796
797 if (req->in_use) {
798 D_ERR(imx_usb->dev,
799 "<%s> refusing to queue req %p (already queued)\n",
800 __func__, req);
801 goto out;
802 }
803
804 usb_req->status = -EINPROGRESS;
805 usb_req->actual = 0;
806
807 ep_add_request(imx_ep, req);
808
809 if (!EP_NO(imx_ep))
810 ret = handle_ep0(imx_ep);
811 else
812 ret = handle_ep(imx_ep);
813out:
814 local_irq_restore(flags);
815 return ret;
816}
817
818static int imx_ep_dequeue(struct usb_ep *usb_ep, struct usb_request *usb_req)
819{
820
821 struct imx_ep_struct *imx_ep = container_of
822 (usb_ep, struct imx_ep_struct, ep);
823 struct imx_request *req;
824 unsigned long flags;
825
826 if (unlikely(!usb_ep || !EP_NO(imx_ep))) {
827 D_ERR(imx_ep->imx_usb->dev, "<%s> bad ep\n", __func__);
828 return -EINVAL;
829 }
830
831 local_irq_save(flags);
832
833 /* make sure it's actually queued on this endpoint */
834 list_for_each_entry(req, &imx_ep->queue, queue) {
835 if (&req->req == usb_req)
836 break;
837 }
838 if (&req->req != usb_req) {
839 local_irq_restore(flags);
840 return -EINVAL;
841 }
842
843 done(imx_ep, req, -ECONNRESET);
844
845 local_irq_restore(flags);
846 return 0;
847}
848
849static int imx_ep_set_halt(struct usb_ep *usb_ep, int value)
850{
851 struct imx_ep_struct *imx_ep = container_of
852 (usb_ep, struct imx_ep_struct, ep);
853 unsigned long flags;
854
855 if (unlikely(!usb_ep || !EP_NO(imx_ep))) {
856 D_ERR(imx_ep->imx_usb->dev, "<%s> bad ep\n", __func__);
857 return -EINVAL;
858 }
859
860 local_irq_save(flags);
861
862 if ((imx_ep->bEndpointAddress & USB_DIR_IN)
863 && !list_empty(&imx_ep->queue)) {
864 local_irq_restore(flags);
865 return -EAGAIN;
866 }
867
868 imx_ep_stall(imx_ep);
869
870 local_irq_restore(flags);
871
872 D_EPX(imx_ep->imx_usb->dev, "<%s> %s halt\n", __func__, usb_ep->name);
873 return 0;
874}
875
876static int imx_ep_fifo_status(struct usb_ep *usb_ep)
877{
878 struct imx_ep_struct *imx_ep = container_of
879 (usb_ep, struct imx_ep_struct, ep);
880
881 if (!usb_ep) {
882 D_ERR(imx_ep->imx_usb->dev, "<%s> bad ep\n", __func__);
883 return -ENODEV;
884 }
885
886 if (imx_ep->imx_usb->gadget.speed == USB_SPEED_UNKNOWN)
887 return 0;
888 else
889 return imx_fifo_bcount(imx_ep);
890}
891
892static void imx_ep_fifo_flush(struct usb_ep *usb_ep)
893{
894 struct imx_ep_struct *imx_ep = container_of
895 (usb_ep, struct imx_ep_struct, ep);
896 unsigned long flags;
897
898 local_irq_save(flags);
899
900 if (!usb_ep || !EP_NO(imx_ep) || !list_empty(&imx_ep->queue)) {
901 D_ERR(imx_ep->imx_usb->dev, "<%s> bad ep\n", __func__);
902 local_irq_restore(flags);
903 return;
904 }
905
906 /* toggle and halt bits stay unchanged */
907 imx_flush(imx_ep);
908
909 local_irq_restore(flags);
910}
911
912static struct usb_ep_ops imx_ep_ops = {
913 .enable = imx_ep_enable,
914 .disable = imx_ep_disable,
915
916 .alloc_request = imx_ep_alloc_request,
917 .free_request = imx_ep_free_request,
918
919 .queue = imx_ep_queue,
920 .dequeue = imx_ep_dequeue,
921
922 .set_halt = imx_ep_set_halt,
923 .fifo_status = imx_ep_fifo_status,
924 .fifo_flush = imx_ep_fifo_flush,
925};
926
927/*******************************************************************************
928 * USB endpoint control functions
929 *******************************************************************************
930 */
931
932void ep0_chg_stat(const char *label,
933 struct imx_udc_struct *imx_usb, enum ep0_state stat)
934{
935 D_EP0(imx_usb->dev, "<%s> from %15s to %15s\n",
936 label, state_name[imx_usb->ep0state], state_name[stat]);
937
938 if (imx_usb->ep0state == stat)
939 return;
940
941 imx_usb->ep0state = stat;
942}
943
944static void usb_init_data(struct imx_udc_struct *imx_usb)
945{
946 struct imx_ep_struct *imx_ep;
947 u8 i;
948
949 /* device/ep0 records init */
950 INIT_LIST_HEAD(&imx_usb->gadget.ep_list);
951 INIT_LIST_HEAD(&imx_usb->gadget.ep0->ep_list);
952 ep0_chg_stat(__func__, imx_usb, EP0_IDLE);
953
954 /* basic endpoint records init */
955 for (i = 0; i < IMX_USB_NB_EP; i++) {
956 imx_ep = &imx_usb->imx_ep[i];
957
958 if (i) {
959 list_add_tail(&imx_ep->ep.ep_list,
960 &imx_usb->gadget.ep_list);
961 imx_ep->stopped = 1;
962 } else
963 imx_ep->stopped = 0;
964
965 INIT_LIST_HEAD(&imx_ep->queue);
966 }
967}
968
969static void udc_stop_activity(struct imx_udc_struct *imx_usb,
970 struct usb_gadget_driver *driver)
971{
972 struct imx_ep_struct *imx_ep;
973 int i;
974
975 if (imx_usb->gadget.speed == USB_SPEED_UNKNOWN)
976 driver = NULL;
977
978 /* prevent new request submissions, kill any outstanding requests */
979 for (i = 1; i < IMX_USB_NB_EP; i++) {
980 imx_ep = &imx_usb->imx_ep[i];
981 imx_flush(imx_ep);
982 imx_ep->stopped = 1;
983 imx_ep_irq_disable(imx_ep);
984 nuke(imx_ep, -ESHUTDOWN);
985 }
986
987 imx_usb->cfg = 0;
988 imx_usb->intf = 0;
989 imx_usb->alt = 0;
990
991 if (driver)
992 driver->disconnect(&imx_usb->gadget);
993}
994
995/*******************************************************************************
996 * Interrupt handlers
997 *******************************************************************************
998 */
999
1000static irqreturn_t imx_udc_irq(int irq, void *dev)
1001{
1002 struct imx_udc_struct *imx_usb = dev;
1003 struct usb_ctrlrequest u;
1004 int temp, cfg, intf, alt;
1005 int intr = __raw_readl(imx_usb->base + USB_INTR);
1006
1007 if (intr & (INTR_WAKEUP | INTR_SUSPEND | INTR_RESUME | INTR_RESET_START
1008 | INTR_RESET_STOP | INTR_CFG_CHG)) {
1009 dump_intr(__func__, intr, imx_usb->dev);
1010 dump_usb_stat(__func__, imx_usb);
1011 }
1012
1013 if (!imx_usb->driver) {
1014 /*imx_udc_disable(imx_usb);*/
1015 goto end_irq;
1016 }
1017
1018 if (intr & INTR_WAKEUP) {
1019 if (imx_usb->gadget.speed == USB_SPEED_UNKNOWN
1020 && imx_usb->driver && imx_usb->driver->resume)
1021 imx_usb->driver->resume(&imx_usb->gadget);
1022 imx_usb->set_config = 0;
1023 imx_usb->gadget.speed = USB_SPEED_FULL;
1024 }
1025
1026 if (intr & INTR_SUSPEND) {
1027 if (imx_usb->gadget.speed != USB_SPEED_UNKNOWN
1028 && imx_usb->driver && imx_usb->driver->suspend)
1029 imx_usb->driver->suspend(&imx_usb->gadget);
1030 imx_usb->set_config = 0;
1031 imx_usb->gadget.speed = USB_SPEED_UNKNOWN;
1032 }
1033
1034 if (intr & INTR_RESET_START) {
1035 __raw_writel(intr, imx_usb->base + USB_INTR);
1036 udc_stop_activity(imx_usb, imx_usb->driver);
1037 imx_usb->set_config = 0;
1038 imx_usb->gadget.speed = USB_SPEED_UNKNOWN;
1039 }
1040
1041 if (intr & INTR_RESET_STOP)
1042 imx_usb->gadget.speed = USB_SPEED_FULL;
1043
1044 if (intr & INTR_CFG_CHG) {
1045 __raw_writel(INTR_CFG_CHG, imx_usb->base + USB_INTR);
1046 temp = __raw_readl(imx_usb->base + USB_STAT);
1047 cfg = (temp & STAT_CFG) >> 5;
1048 intf = (temp & STAT_INTF) >> 3;
1049 alt = temp & STAT_ALTSET;
1050
1051 D_REQ(imx_usb->dev,
1052 "<%s> orig config C=%d, I=%d, A=%d / "
1053 "req config C=%d, I=%d, A=%d\n",
1054 __func__, imx_usb->cfg, imx_usb->intf, imx_usb->alt,
1055 cfg, intf, alt);
1056
1057 if (cfg != 1 && cfg != 2)
1058 goto end_irq;
1059
1060 imx_usb->set_config = 0;
1061
1062 /* Config setup */
1063 if (imx_usb->cfg != cfg) {
1064 D_REQ(imx_usb->dev, "<%s> Change config start\n",__func__);
1065 u.bRequest = USB_REQ_SET_CONFIGURATION;
1066 u.bRequestType = USB_DIR_OUT |
1067 USB_TYPE_STANDARD |
1068 USB_RECIP_DEVICE;
1069 u.wValue = cfg;
1070 u.wIndex = 0;
1071 u.wLength = 0;
1072 imx_usb->cfg = cfg;
1073 imx_usb->set_config = 1;
1074 imx_usb->driver->setup(&imx_usb->gadget, &u);
1075 imx_usb->set_config = 0;
1076 D_REQ(imx_usb->dev, "<%s> Change config done\n",__func__);
1077
1078 }
1079 if (imx_usb->intf != intf || imx_usb->alt != alt) {
1080 D_REQ(imx_usb->dev, "<%s> Change interface start\n",__func__);
1081 u.bRequest = USB_REQ_SET_INTERFACE;
1082 u.bRequestType = USB_DIR_OUT |
1083 USB_TYPE_STANDARD |
1084 USB_RECIP_INTERFACE;
1085 u.wValue = alt;
1086 u.wIndex = intf;
1087 u.wLength = 0;
1088 imx_usb->intf = intf;
1089 imx_usb->alt = alt;
1090 imx_usb->set_config = 1;
1091 imx_usb->driver->setup(&imx_usb->gadget, &u);
1092 imx_usb->set_config = 0;
1093 D_REQ(imx_usb->dev, "<%s> Change interface done\n",__func__);
1094 }
1095 }
1096
1097 if (intr & INTR_SOF) {
1098 if (imx_usb->ep0state == EP0_IDLE) {
1099 temp = __raw_readl(imx_usb->base + USB_CTRL);
1100 __raw_writel(temp | CTRL_CMDOVER, imx_usb->base + USB_CTRL);
1101 }
1102 }
1103
1104end_irq:
1105 __raw_writel(intr, imx_usb->base + USB_INTR);
1106 return IRQ_HANDLED;
1107}
1108
1109static irqreturn_t imx_udc_ctrl_irq(int irq, void *dev)
1110{
1111 struct imx_udc_struct *imx_usb = dev;
1112 int intr = __raw_readl(imx_usb->base + USB_EP_INTR(0));
1113
1114 dump_ep_intr(__func__, 0, intr, imx_usb->dev);
1115
1116 if (!imx_usb->driver) {
1117 __raw_writel(intr, imx_usb->base + USB_EP_INTR(0));
1118 return IRQ_HANDLED;
1119 }
1120
1121 /* DEVREQ IRQ has highest priority */
1122 if (intr & (EPINTR_DEVREQ | EPINTR_MDEVREQ))
1123 handle_ep0_devreq(imx_usb);
1124 /* Seem i.MX is missing EOF interrupt sometimes.
1125 * Therefore we monitor both EOF and FIFO_EMPTY interrups
1126 * when transmiting, and both EOF and FIFO_FULL when
1127 * receiving data.
1128 */
1129 else if (intr & (EPINTR_EOF | EPINTR_FIFO_EMPTY | EPINTR_FIFO_FULL))
1130 handle_ep0(&imx_usb->imx_ep[0]);
1131
1132 __raw_writel(intr, imx_usb->base + USB_EP_INTR(0));
1133
1134 return IRQ_HANDLED;
1135}
1136
1137static irqreturn_t imx_udc_bulk_irq(int irq, void *dev)
1138{
1139 struct imx_udc_struct *imx_usb = dev;
1140 struct imx_ep_struct *imx_ep = &imx_usb->imx_ep[irq - USBD_INT0];
1141 int intr = __raw_readl(imx_usb->base + USB_EP_INTR(EP_NO(imx_ep)));
1142
1143 dump_ep_intr(__func__, irq - USBD_INT0, intr, imx_usb->dev);
1144
1145 if (!imx_usb->driver) {
1146 __raw_writel(intr, imx_usb->base + USB_EP_INTR(EP_NO(imx_ep)));
1147 return IRQ_HANDLED;
1148 }
1149
1150 handle_ep(imx_ep);
1151
1152 __raw_writel(intr, imx_usb->base + USB_EP_INTR(EP_NO(imx_ep)));
1153
1154 return IRQ_HANDLED;
1155}
1156
1157irq_handler_t intr_handler(int i)
1158{
1159 switch (i) {
1160 case 0:
1161 return imx_udc_ctrl_irq;
1162 case 1:
1163 case 2:
1164 case 3:
1165 case 4:
1166 case 5:
1167 return imx_udc_bulk_irq;
1168 default:
1169 return imx_udc_irq;
1170 }
1171}
1172
1173/*******************************************************************************
1174 * Static defined IMX UDC structure
1175 *******************************************************************************
1176 */
1177
1178static const struct usb_gadget_ops imx_udc_ops = {
1179 .get_frame = imx_udc_get_frame,
1180 .wakeup = imx_udc_wakeup,
1181};
1182
1183static struct imx_udc_struct controller = {
1184 .gadget = {
1185 .ops = &imx_udc_ops,
1186 .ep0 = &controller.imx_ep[0].ep,
1187 .name = driver_name,
1188 .dev = {
1189 .bus_id = "gadget",
1190 },
1191 },
1192
1193 .imx_ep[0] = {
1194 .ep = {
1195 .name = ep0name,
1196 .ops = &imx_ep_ops,
1197 .maxpacket = 32,
1198 },
1199 .imx_usb = &controller,
1200 .fifosize = 32,
1201 .bEndpointAddress = 0,
1202 .bmAttributes = USB_ENDPOINT_XFER_CONTROL,
1203 },
1204 .imx_ep[1] = {
1205 .ep = {
1206 .name = "ep1in-bulk",
1207 .ops = &imx_ep_ops,
1208 .maxpacket = 64,
1209 },
1210 .imx_usb = &controller,
1211 .fifosize = 64,
1212 .bEndpointAddress = USB_DIR_IN | 1,
1213 .bmAttributes = USB_ENDPOINT_XFER_BULK,
1214 },
1215 .imx_ep[2] = {
1216 .ep = {
1217 .name = "ep2out-bulk",
1218 .ops = &imx_ep_ops,
1219 .maxpacket = 64,
1220 },
1221 .imx_usb = &controller,
1222 .fifosize = 64,
1223 .bEndpointAddress = USB_DIR_OUT | 2,
1224 .bmAttributes = USB_ENDPOINT_XFER_BULK,
1225 },
1226 .imx_ep[3] = {
1227 .ep = {
1228 .name = "ep3out-bulk",
1229 .ops = &imx_ep_ops,
1230 .maxpacket = 32,
1231 },
1232 .imx_usb = &controller,
1233 .fifosize = 32,
1234 .bEndpointAddress = USB_DIR_OUT | 3,
1235 .bmAttributes = USB_ENDPOINT_XFER_BULK,
1236 },
1237 .imx_ep[4] = {
1238 .ep = {
1239 .name = "ep4in-int",
1240 .ops = &imx_ep_ops,
1241 .maxpacket = 32,
1242 },
1243 .imx_usb = &controller,
1244 .fifosize = 32,
1245 .bEndpointAddress = USB_DIR_IN | 4,
1246 .bmAttributes = USB_ENDPOINT_XFER_INT,
1247 },
1248 .imx_ep[5] = {
1249 .ep = {
1250 .name = "ep5out-int",
1251 .ops = &imx_ep_ops,
1252 .maxpacket = 32,
1253 },
1254 .imx_usb = &controller,
1255 .fifosize = 32,
1256 .bEndpointAddress = USB_DIR_OUT | 5,
1257 .bmAttributes = USB_ENDPOINT_XFER_INT,
1258 },
1259};
1260
1261/*******************************************************************************
1262 * USB gadged driver functions
1263 *******************************************************************************
1264 */
1265int usb_gadget_register_driver(struct usb_gadget_driver *driver)
1266{
1267 struct imx_udc_struct *imx_usb = &controller;
1268 int retval;
1269
1270 if (!driver
1271 || driver->speed < USB_SPEED_FULL
1272 || !driver->bind
1273 || !driver->disconnect
1274 || !driver->setup)
1275 return -EINVAL;
1276 if (!imx_usb)
1277 return -ENODEV;
1278 if (imx_usb->driver)
1279 return -EBUSY;
1280
1281 /* first hook up the driver ... */
1282 imx_usb->driver = driver;
1283 imx_usb->gadget.dev.driver = &driver->driver;
1284
1285 retval = device_add(&imx_usb->gadget.dev);
1286 if (retval)
1287 goto fail;
1288 retval = driver->bind(&imx_usb->gadget);
1289 if (retval) {
1290 D_ERR(imx_usb->dev, "<%s> bind to driver %s --> error %d\n",
1291 __func__, driver->driver.name, retval);
1292 device_del(&imx_usb->gadget.dev);
1293
1294 goto fail;
1295 }
1296
1297 D_INI(imx_usb->dev, "<%s> registered gadget driver '%s'\n",
1298 __func__, driver->driver.name);
1299
1300 imx_udc_enable(imx_usb);
1301
1302 return 0;
1303fail:
1304 imx_usb->driver = NULL;
1305 imx_usb->gadget.dev.driver = NULL;
1306 return retval;
1307}
1308EXPORT_SYMBOL(usb_gadget_register_driver);
1309
1310int usb_gadget_unregister_driver(struct usb_gadget_driver *driver)
1311{
1312 struct imx_udc_struct *imx_usb = &controller;
1313
1314 if (!imx_usb)
1315 return -ENODEV;
1316 if (!driver || driver != imx_usb->driver || !driver->unbind)
1317 return -EINVAL;
1318
1319 udc_stop_activity(imx_usb, driver);
1320 imx_udc_disable(imx_usb);
1321
1322 driver->unbind(&imx_usb->gadget);
1323 imx_usb->gadget.dev.driver = NULL;
1324 imx_usb->driver = NULL;
1325
1326 device_del(&imx_usb->gadget.dev);
1327
1328 D_INI(imx_usb->dev, "<%s> unregistered gadget driver '%s'\n",
1329 __func__, driver->driver.name);
1330
1331 return 0;
1332}
1333EXPORT_SYMBOL(usb_gadget_unregister_driver);
1334
1335/*******************************************************************************
1336 * Module functions
1337 *******************************************************************************
1338 */
1339
1340static int __init imx_udc_probe(struct platform_device *pdev)
1341{
1342 struct imx_udc_struct *imx_usb = &controller;
1343 struct resource *res;
1344 struct imxusb_platform_data *pdata;
1345 struct clk *clk;
1346 void __iomem *base;
1347 int ret = 0;
1348 int i, res_size;
1349
1350 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
1351 if (!res) {
1352 dev_err(&pdev->dev, "can't get device resources\n");
1353 return -ENODEV;
1354 }
1355
1356 pdata = pdev->dev.platform_data;
1357 if (!pdata) {
1358 dev_err(&pdev->dev, "driver needs platform data\n");
1359 return -ENODEV;
1360 }
1361
1362 res_size = res->end - res->start + 1;
1363 if (!request_mem_region(res->start, res_size, res->name)) {
1364 dev_err(&pdev->dev, "can't allocate %d bytes at %d address\n",
1365 res_size, res->start);
1366 return -ENOMEM;
1367 }
1368
1369 if (pdata->init) {
1370 ret = pdata->init(&pdev->dev);
1371 if (ret)
1372 goto fail0;
1373 }
1374
1375 base = ioremap(res->start, res_size);
1376 if (!base) {
1377 dev_err(&pdev->dev, "ioremap failed\n");
1378 ret = -EIO;
1379 goto fail1;
1380 }
1381
1382 clk = clk_get(NULL, "usbd_clk");
1383 if (IS_ERR(clk)) {
1384 ret = PTR_ERR(clk);
1385 dev_err(&pdev->dev, "can't get USB clock\n");
1386 goto fail2;
1387 }
1388 clk_enable(clk);
1389
1390 if (clk_get_rate(clk) != 48000000) {
1391 D_INI(&pdev->dev,
1392 "Bad USB clock (%d Hz), changing to 48000000 Hz\n",
1393 (int)clk_get_rate(clk));
1394 if (clk_set_rate(clk, 48000000)) {
1395 dev_err(&pdev->dev,
1396 "Unable to set correct USB clock (48MHz)\n");
1397 ret = -EIO;
1398 goto fail3;
1399 }
1400 }
1401
1402 for (i = 0; i < IMX_USB_NB_EP + 1; i++) {
1403 imx_usb->usbd_int[i] = platform_get_irq(pdev, i);
1404 if (imx_usb->usbd_int[i] < 0) {
1405 dev_err(&pdev->dev, "can't get irq number\n");
1406 ret = -ENODEV;
1407 goto fail3;
1408 }
1409 }
1410
1411 for (i = 0; i < IMX_USB_NB_EP + 1; i++) {
1412 ret = request_irq(imx_usb->usbd_int[i], intr_handler(i),
1413 IRQF_DISABLED, driver_name, imx_usb);
1414 if (ret) {
1415 dev_err(&pdev->dev, "can't get irq %i, err %d\n",
1416 imx_usb->usbd_int[i], ret);
1417 for (--i; i >= 0; i--)
1418 free_irq(imx_usb->usbd_int[i], imx_usb);
1419 goto fail3;
1420 }
1421 }
1422
1423 imx_usb->res = res;
1424 imx_usb->base = base;
1425 imx_usb->clk = clk;
1426 imx_usb->dev = &pdev->dev;
1427
1428 device_initialize(&imx_usb->gadget.dev);
1429
1430 imx_usb->gadget.dev.parent = &pdev->dev;
1431 imx_usb->gadget.dev.dma_mask = pdev->dev.dma_mask;
1432
1433 platform_set_drvdata(pdev, imx_usb);
1434
1435 usb_init_data(imx_usb);
1436 imx_udc_init(imx_usb);
1437
1438 return 0;
1439
1440fail3:
1441 clk_put(clk);
1442 clk_disable(clk);
1443fail2:
1444 iounmap(base);
1445fail1:
1446 if (pdata->exit)
1447 pdata->exit(&pdev->dev);
1448fail0:
1449 release_mem_region(res->start, res_size);
1450 return ret;
1451}
1452
1453static int __exit imx_udc_remove(struct platform_device *pdev)
1454{
1455 struct imx_udc_struct *imx_usb = platform_get_drvdata(pdev);
1456 struct imxusb_platform_data *pdata = pdev->dev.platform_data;
1457 int i;
1458
1459 imx_udc_disable(imx_usb);
1460
1461 for (i = 0; i < IMX_USB_NB_EP + 1; i++)
1462 free_irq(imx_usb->usbd_int[i], imx_usb);
1463
1464 clk_put(imx_usb->clk);
1465 clk_disable(imx_usb->clk);
1466 iounmap(imx_usb->base);
1467
1468 release_mem_region(imx_usb->res->start,
1469 imx_usb->res->end - imx_usb->res->start + 1);
1470
1471 if (pdata->exit)
1472 pdata->exit(&pdev->dev);
1473
1474 platform_set_drvdata(pdev, NULL);
1475
1476 return 0;
1477}
1478
1479/*----------------------------------------------------------------------------*/
1480
1481#ifdef CONFIG_PM
1482#define imx_udc_suspend NULL
1483#define imx_udc_resume NULL
1484#else
1485#define imx_udc_suspend NULL
1486#define imx_udc_resume NULL
1487#endif
1488
1489/*----------------------------------------------------------------------------*/
1490
1491static struct platform_driver udc_driver = {
1492 .driver = {
1493 .name = driver_name,
1494 .owner = THIS_MODULE,
1495 },
1496 .remove = __exit_p(imx_udc_remove),
1497 .suspend = imx_udc_suspend,
1498 .resume = imx_udc_resume,
1499};
1500
1501static int __init udc_init(void)
1502{
1503 return platform_driver_probe(&udc_driver, imx_udc_probe);
1504}
1505module_init(udc_init);
1506
1507static void __exit udc_exit(void)
1508{
1509 platform_driver_unregister(&udc_driver);
1510}
1511module_exit(udc_exit);
1512
1513MODULE_DESCRIPTION("IMX USB Device Controller driver");
1514MODULE_AUTHOR("Darius Augulis <augulis.darius@gmail.com>");
1515MODULE_LICENSE("GPL");
1516MODULE_ALIAS("platform:imx_udc");
diff --git a/drivers/usb/gadget/imx_udc.h b/drivers/usb/gadget/imx_udc.h
new file mode 100644
index 000000000000..850076937d8d
--- /dev/null
+++ b/drivers/usb/gadget/imx_udc.h
@@ -0,0 +1,344 @@
1/*
2 * Copyright (C) 2005 Mike Lee(eemike@gmail.com)
3 *
4 * This udc driver is now under testing and code is based on pxa2xx_udc.h
5 * Please use it with your own risk!
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 */
17
18#ifndef __LINUX_USB_GADGET_IMX_H
19#define __LINUX_USB_GADGET_IMX_H
20
21#include <linux/types.h>
22
23/* Helper macros */
24#define EP_NO(ep) ((ep->bEndpointAddress) & ~USB_DIR_IN) /* IN:1, OUT:0 */
25#define EP_DIR(ep) ((ep->bEndpointAddress) & USB_DIR_IN ? 1 : 0)
26#define irq_to_ep(irq) (((irq) >= USBD_INT0) || ((irq) <= USBD_INT6) ? ((irq) - USBD_INT0) : (USBD_INT6)) /*should not happen*/
27#define ep_to_irq(ep) (EP_NO((ep)) + USBD_INT0)
28#define IMX_USB_NB_EP 6
29
30/* Driver structures */
31struct imx_request {
32 struct usb_request req;
33 struct list_head queue;
34 unsigned int in_use;
35};
36
37enum ep0_state {
38 EP0_IDLE,
39 EP0_IN_DATA_PHASE,
40 EP0_OUT_DATA_PHASE,
41 EP0_CONFIG,
42 EP0_STALL,
43};
44
45struct imx_ep_struct {
46 struct usb_ep ep;
47 struct imx_udc_struct *imx_usb;
48 struct list_head queue;
49 unsigned char stopped;
50 unsigned char fifosize;
51 unsigned char bEndpointAddress;
52 unsigned char bmAttributes;
53};
54
55struct imx_udc_struct {
56 struct usb_gadget gadget;
57 struct usb_gadget_driver *driver;
58 struct device *dev;
59 struct imx_ep_struct imx_ep[IMX_USB_NB_EP];
60 struct clk *clk;
61 enum ep0_state ep0state;
62 struct resource *res;
63 void __iomem *base;
64 unsigned char set_config;
65 int cfg,
66 intf,
67 alt,
68 usbd_int[7];
69};
70
71/* USB registers */
72#define USB_FRAME (0x00) /* USB frame */
73#define USB_SPEC (0x04) /* USB Spec */
74#define USB_STAT (0x08) /* USB Status */
75#define USB_CTRL (0x0C) /* USB Control */
76#define USB_DADR (0x10) /* USB Desc RAM addr */
77#define USB_DDAT (0x14) /* USB Desc RAM/EP buffer data */
78#define USB_INTR (0x18) /* USB interrupt */
79#define USB_MASK (0x1C) /* USB Mask */
80#define USB_ENAB (0x24) /* USB Enable */
81#define USB_EP_STAT(x) (0x30 + (x*0x30)) /* USB status/control */
82#define USB_EP_INTR(x) (0x34 + (x*0x30)) /* USB interrupt */
83#define USB_EP_MASK(x) (0x38 + (x*0x30)) /* USB mask */
84#define USB_EP_FDAT(x) (0x3C + (x*0x30)) /* USB FIFO data */
85#define USB_EP_FDAT0(x) (0x3C + (x*0x30)) /* USB FIFO data */
86#define USB_EP_FDAT1(x) (0x3D + (x*0x30)) /* USB FIFO data */
87#define USB_EP_FDAT2(x) (0x3E + (x*0x30)) /* USB FIFO data */
88#define USB_EP_FDAT3(x) (0x3F + (x*0x30)) /* USB FIFO data */
89#define USB_EP_FSTAT(x) (0x40 + (x*0x30)) /* USB FIFO status */
90#define USB_EP_FCTRL(x) (0x44 + (x*0x30)) /* USB FIFO control */
91#define USB_EP_LRFP(x) (0x48 + (x*0x30)) /* USB last read frame pointer */
92#define USB_EP_LWFP(x) (0x4C + (x*0x30)) /* USB last write frame pointer */
93#define USB_EP_FALRM(x) (0x50 + (x*0x30)) /* USB FIFO alarm */
94#define USB_EP_FRDP(x) (0x54 + (x*0x30)) /* USB FIFO read pointer */
95#define USB_EP_FWRP(x) (0x58 + (x*0x30)) /* USB FIFO write pointer */
96/* USB Control Register Bit Fields.*/
97#define CTRL_CMDOVER (1<<6) /* UDC status */
98#define CTRL_CMDERROR (1<<5) /* UDC status */
99#define CTRL_FE_ENA (1<<3) /* Enable Font End logic */
100#define CTRL_UDC_RST (1<<2) /* UDC reset */
101#define CTRL_AFE_ENA (1<<1) /* Analog Font end enable */
102#define CTRL_RESUME (1<<0) /* UDC resume */
103/* USB Status Register Bit Fields.*/
104#define STAT_RST (1<<8)
105#define STAT_SUSP (1<<7)
106#define STAT_CFG (3<<5)
107#define STAT_INTF (3<<3)
108#define STAT_ALTSET (7<<0)
109/* USB Interrupt Status/Mask Registers Bit fields */
110#define INTR_WAKEUP (1<<31) /* Wake up Interrupt */
111#define INTR_MSOF (1<<7) /* Missed Start of Frame */
112#define INTR_SOF (1<<6) /* Start of Frame */
113#define INTR_RESET_STOP (1<<5) /* Reset Signaling stop */
114#define INTR_RESET_START (1<<4) /* Reset Signaling start */
115#define INTR_RESUME (1<<3) /* Suspend to resume */
116#define INTR_SUSPEND (1<<2) /* Active to suspend */
117#define INTR_FRAME_MATCH (1<<1) /* Frame matched */
118#define INTR_CFG_CHG (1<<0) /* Configuration change occurred */
119/* USB Enable Register Bit Fields.*/
120#define ENAB_RST (1<<31) /* Reset USB modules */
121#define ENAB_ENAB (1<<30) /* Enable USB modules*/
122#define ENAB_SUSPEND (1<<29) /* Suspend USB modules */
123#define ENAB_ENDIAN (1<<28) /* Endian of USB modules */
124#define ENAB_PWRMD (1<<0) /* Power mode of USB modules */
125/* USB Descriptor Ram Address Register bit fields */
126#define DADR_CFG (1<<31) /* Configuration */
127#define DADR_BSY (1<<30) /* Busy status */
128#define DADR_DADR (0x1FF) /* Descriptor Ram Address */
129/* USB Descriptor RAM/Endpoint Buffer Data Register bit fields */
130#define DDAT_DDAT (0xFF) /* Descriptor Endpoint Buffer */
131/* USB Endpoint Status Register bit fields */
132#define EPSTAT_BCOUNT (0x7F<<16) /* Endpoint FIFO byte count */
133#define EPSTAT_SIP (1<<8) /* Endpoint setup in progress */
134#define EPSTAT_DIR (1<<7) /* Endpoint transfer direction */
135#define EPSTAT_MAX (3<<5) /* Endpoint Max packet size */
136#define EPSTAT_TYP (3<<3) /* Endpoint type */
137#define EPSTAT_ZLPS (1<<2) /* Send zero length packet */
138#define EPSTAT_FLUSH (1<<1) /* Endpoint FIFO Flush */
139#define EPSTAT_STALL (1<<0) /* Force stall */
140/* USB Endpoint FIFO Status Register bit fields */
141#define FSTAT_FRAME_STAT (0xF<<24) /* Frame status bit [0-3] */
142#define FSTAT_ERR (1<<22) /* FIFO error */
143#define FSTAT_UF (1<<21) /* FIFO underflow */
144#define FSTAT_OF (1<<20) /* FIFO overflow */
145#define FSTAT_FR (1<<19) /* FIFO frame ready */
146#define FSTAT_FULL (1<<18) /* FIFO full */
147#define FSTAT_ALRM (1<<17) /* FIFO alarm */
148#define FSTAT_EMPTY (1<<16) /* FIFO empty */
149/* USB Endpoint FIFO Control Register bit fields */
150#define FCTRL_WFR (1<<29) /* Write frame end */
151/* USB Endpoint Interrupt Status Regsiter bit fields */
152#define EPINTR_FIFO_FULL (1<<8) /* fifo full */
153#define EPINTR_FIFO_EMPTY (1<<7) /* fifo empty */
154#define EPINTR_FIFO_ERROR (1<<6) /* fifo error */
155#define EPINTR_FIFO_HIGH (1<<5) /* fifo high */
156#define EPINTR_FIFO_LOW (1<<4) /* fifo low */
157#define EPINTR_MDEVREQ (1<<3) /* multi Device request */
158#define EPINTR_EOT (1<<2) /* fifo end of transfer */
159#define EPINTR_DEVREQ (1<<1) /* Device request */
160#define EPINTR_EOF (1<<0) /* fifo end of frame */
161
162/* Debug macros */
163#ifdef DEBUG
164
165/* #define DEBUG_REQ */
166/* #define DEBUG_TRX */
167/* #define DEBUG_INIT */
168/* #define DEBUG_EP0 */
169/* #define DEBUG_EPX */
170/* #define DEBUG_IRQ */
171/* #define DEBUG_EPIRQ */
172/* #define DEBUG_DUMP */
173#define DEBUG_ERR
174
175#ifdef DEBUG_REQ
176 #define D_REQ(dev, args...) dev_dbg(dev, ## args)
177#else
178 #define D_REQ(dev, args...) do {} while (0)
179#endif /* DEBUG_REQ */
180
181#ifdef DEBUG_TRX
182 #define D_TRX(dev, args...) dev_dbg(dev, ## args)
183#else
184 #define D_TRX(dev, args...) do {} while (0)
185#endif /* DEBUG_TRX */
186
187#ifdef DEBUG_INIT
188 #define D_INI(dev, args...) dev_dbg(dev, ## args)
189#else
190 #define D_INI(dev, args...) do {} while (0)
191#endif /* DEBUG_INIT */
192
193#ifdef DEBUG_EP0
194 static const char *state_name[] = {
195 "EP0_IDLE",
196 "EP0_IN_DATA_PHASE",
197 "EP0_OUT_DATA_PHASE",
198 "EP0_CONFIG",
199 "EP0_STALL"
200 };
201 #define D_EP0(dev, args...) dev_dbg(dev, ## args)
202#else
203 #define D_EP0(dev, args...) do {} while (0)
204#endif /* DEBUG_EP0 */
205
206#ifdef DEBUG_EPX
207 #define D_EPX(dev, args...) dev_dbg(dev, ## args)
208#else
209 #define D_EPX(dev, args...) do {} while (0)
210#endif /* DEBUG_EP0 */
211
212#ifdef DEBUG_IRQ
213 static void dump_intr(const char *label, int irqreg, struct device *dev)
214 {
215 dev_dbg(dev, "<%s> USB_INTR=[%s%s%s%s%s%s%s%s%s]\n", label,
216 (irqreg & INTR_WAKEUP) ? " wake" : "",
217 (irqreg & INTR_MSOF) ? " msof" : "",
218 (irqreg & INTR_SOF) ? " sof" : "",
219 (irqreg & INTR_RESUME) ? " resume" : "",
220 (irqreg & INTR_SUSPEND) ? " suspend" : "",
221 (irqreg & INTR_RESET_STOP) ? " noreset" : "",
222 (irqreg & INTR_RESET_START) ? " reset" : "",
223 (irqreg & INTR_FRAME_MATCH) ? " fmatch" : "",
224 (irqreg & INTR_CFG_CHG) ? " config" : "");
225 }
226#else
227 #define dump_intr(x, y, z) do {} while (0)
228#endif /* DEBUG_IRQ */
229
230#ifdef DEBUG_EPIRQ
231 static void dump_ep_intr(const char *label, int nr, int irqreg, struct device *dev)
232 {
233 dev_dbg(dev, "<%s> EP%d_INTR=[%s%s%s%s%s%s%s%s%s]\n", label, nr,
234 (irqreg & EPINTR_FIFO_FULL) ? " full" : "",
235 (irqreg & EPINTR_FIFO_EMPTY) ? " fempty" : "",
236 (irqreg & EPINTR_FIFO_ERROR) ? " ferr" : "",
237 (irqreg & EPINTR_FIFO_HIGH) ? " fhigh" : "",
238 (irqreg & EPINTR_FIFO_LOW) ? " flow" : "",
239 (irqreg & EPINTR_MDEVREQ) ? " mreq" : "",
240 (irqreg & EPINTR_EOF) ? " eof" : "",
241 (irqreg & EPINTR_DEVREQ) ? " devreq" : "",
242 (irqreg & EPINTR_EOT) ? " eot" : "");
243 }
244#else
245 #define dump_ep_intr(x, y, z, i) do {} while (0)
246#endif /* DEBUG_IRQ */
247
248#ifdef DEBUG_DUMP
249 static void dump_usb_stat(const char *label, struct imx_udc_struct *imx_usb)
250 {
251 int temp = __raw_readl(imx_usb->base + USB_STAT);
252
253 dev_dbg(imx_usb->dev,
254 "<%s> USB_STAT=[%s%s CFG=%d, INTF=%d, ALTR=%d]\n", label,
255 (temp & STAT_RST) ? " reset" : "",
256 (temp & STAT_SUSP) ? " suspend" : "",
257 (temp & STAT_CFG) >> 5,
258 (temp & STAT_INTF) >> 3,
259 (temp & STAT_ALTSET));
260 }
261
262 static void dump_ep_stat(const char *label, struct imx_ep_struct *imx_ep)
263 {
264 int temp = __raw_readl(imx_ep->imx_usb->base + USB_EP_INTR(EP_NO(imx_ep)));
265
266 dev_dbg(imx_ep->imx_usb->dev,
267 "<%s> EP%d_INTR=[%s%s%s%s%s%s%s%s%s]\n", label, EP_NO(imx_ep),
268 (temp & EPINTR_FIFO_FULL) ? " full" : "",
269 (temp & EPINTR_FIFO_EMPTY) ? " fempty" : "",
270 (temp & EPINTR_FIFO_ERROR) ? " ferr" : "",
271 (temp & EPINTR_FIFO_HIGH) ? " fhigh" : "",
272 (temp & EPINTR_FIFO_LOW) ? " flow" : "",
273 (temp & EPINTR_MDEVREQ) ? " mreq" : "",
274 (temp & EPINTR_EOF) ? " eof" : "",
275 (temp & EPINTR_DEVREQ) ? " devreq" : "",
276 (temp & EPINTR_EOT) ? " eot" : "");
277
278 temp = __raw_readl(imx_ep->imx_usb->base + USB_EP_STAT(EP_NO(imx_ep)));
279
280 dev_dbg(imx_ep->imx_usb->dev,
281 "<%s> EP%d_STAT=[%s%s bcount=%d]\n", label, EP_NO(imx_ep),
282 (temp & EPSTAT_SIP) ? " sip" : "",
283 (temp & EPSTAT_STALL) ? " stall" : "",
284 (temp & EPSTAT_BCOUNT) >> 16);
285
286 temp = __raw_readl(imx_ep->imx_usb->base + USB_EP_FSTAT(EP_NO(imx_ep)));
287
288 dev_dbg(imx_ep->imx_usb->dev,
289 "<%s> EP%d_FSTAT=[%s%s%s%s%s%s%s]\n", label, EP_NO(imx_ep),
290 (temp & FSTAT_ERR) ? " ferr" : "",
291 (temp & FSTAT_UF) ? " funder" : "",
292 (temp & FSTAT_OF) ? " fover" : "",
293 (temp & FSTAT_FR) ? " fready" : "",
294 (temp & FSTAT_FULL) ? " ffull" : "",
295 (temp & FSTAT_ALRM) ? " falarm" : "",
296 (temp & FSTAT_EMPTY) ? " fempty" : "");
297 }
298
299 static void dump_req(const char *label, struct imx_ep_struct *imx_ep, struct usb_request *req)
300 {
301 int i;
302
303 if (!req || !req->buf) {
304 dev_dbg(imx_ep->imx_usb->dev, "<%s> req or req buf is free\n", label);
305 return;
306 }
307
308 if ((!EP_NO(imx_ep) && imx_ep->imx_usb->ep0state == EP0_IN_DATA_PHASE)
309 || (EP_NO(imx_ep) && EP_DIR(imx_ep))) {
310
311 dev_dbg(imx_ep->imx_usb->dev, "<%s> request dump <", label);
312 for (i = 0; i < req->length; i++)
313 printk("%02x-", *((u8 *)req->buf + i));
314 printk(">\n");
315 }
316 }
317
318#else
319 #define dump_ep_stat(x, y) do {} while (0)
320 #define dump_usb_stat(x, y) do {} while (0)
321 #define dump_req(x, y, z) do {} while (0)
322#endif /* DEBUG_DUMP */
323
324#ifdef DEBUG_ERR
325 #define D_ERR(dev, args...) dev_dbg(dev, ## args)
326#else
327 #define D_ERR(dev, args...) do {} while (0)
328#endif
329
330#else
331 #define D_REQ(dev, args...) do {} while (0)
332 #define D_TRX(dev, args...) do {} while (0)
333 #define D_INI(dev, args...) do {} while (0)
334 #define D_EP0(dev, args...) do {} while (0)
335 #define D_EPX(dev, args...) do {} while (0)
336 #define dump_ep_intr(x, y, z, i) do {} while (0)
337 #define dump_intr(x, y, z) do {} while (0)
338 #define dump_ep_stat(x, y) do {} while (0)
339 #define dump_usb_stat(x, y) do {} while (0)
340 #define dump_req(x, y, z) do {} while (0)
341 #define D_ERR(dev, args...) do {} while (0)
342#endif /* DEBUG */
343
344#endif /* __LINUX_USB_GADGET_IMX_H */
diff --git a/drivers/usb/gadget/m66592-udc.c b/drivers/usb/gadget/m66592-udc.c
index 3a8879ec2061..43dcf9e1af6b 100644
--- a/drivers/usb/gadget/m66592-udc.c
+++ b/drivers/usb/gadget/m66592-udc.c
@@ -1546,8 +1546,6 @@ static void nop_completion(struct usb_ep *ep, struct usb_request *r)
1546{ 1546{
1547} 1547}
1548 1548
1549#define resource_len(r) (((r)->end - (r)->start) + 1)
1550
1551static int __init m66592_probe(struct platform_device *pdev) 1549static int __init m66592_probe(struct platform_device *pdev)
1552{ 1550{
1553 struct resource *res; 1551 struct resource *res;
@@ -1560,11 +1558,10 @@ static int __init m66592_probe(struct platform_device *pdev)
1560 int ret = 0; 1558 int ret = 0;
1561 int i; 1559 int i;
1562 1560
1563 res = platform_get_resource_byname(pdev, IORESOURCE_MEM, 1561 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
1564 (char *)udc_name);
1565 if (!res) { 1562 if (!res) {
1566 ret = -ENODEV; 1563 ret = -ENODEV;
1567 pr_err("platform_get_resource_byname error.\n"); 1564 pr_err("platform_get_resource error.\n");
1568 goto clean_up; 1565 goto clean_up;
1569 } 1566 }
1570 1567
@@ -1575,7 +1572,7 @@ static int __init m66592_probe(struct platform_device *pdev)
1575 goto clean_up; 1572 goto clean_up;
1576 } 1573 }
1577 1574
1578 reg = ioremap(res->start, resource_len(res)); 1575 reg = ioremap(res->start, resource_size(res));
1579 if (reg == NULL) { 1576 if (reg == NULL) {
1580 ret = -ENOMEM; 1577 ret = -ENOMEM;
1581 pr_err("ioremap error.\n"); 1578 pr_err("ioremap error.\n");
diff --git a/drivers/usb/gadget/net2280.c b/drivers/usb/gadget/net2280.c
index 8ae70de2c37d..12c6d83b218c 100644
--- a/drivers/usb/gadget/net2280.c
+++ b/drivers/usb/gadget/net2280.c
@@ -669,7 +669,7 @@ fill_dma_desc (struct net2280_ep *ep, struct net2280_request *req, int valid)
669 669
670 /* 2280 may be polling VALID_BIT through ep->dma->dmadesc */ 670 /* 2280 may be polling VALID_BIT through ep->dma->dmadesc */
671 wmb (); 671 wmb ();
672 td->dmacount = cpu_to_le32p (&dmacount); 672 td->dmacount = cpu_to_le32(dmacount);
673} 673}
674 674
675static const u32 dmactl_default = 675static const u32 dmactl_default =
diff --git a/drivers/usb/gadget/omap_udc.c b/drivers/usb/gadget/omap_udc.c
index 34e9e393f929..57d9641c6bf8 100644
--- a/drivers/usb/gadget/omap_udc.c
+++ b/drivers/usb/gadget/omap_udc.c
@@ -3006,7 +3006,7 @@ cleanup1:
3006 3006
3007cleanup0: 3007cleanup0:
3008 if (xceiv) 3008 if (xceiv)
3009 put_device(xceiv->dev); 3009 otg_put_transceiver(xceiv);
3010 3010
3011 if (cpu_is_omap16xx() || cpu_is_omap24xx()) { 3011 if (cpu_is_omap16xx() || cpu_is_omap24xx()) {
3012 clk_disable(hhc_clk); 3012 clk_disable(hhc_clk);
@@ -3034,7 +3034,7 @@ static int __exit omap_udc_remove(struct platform_device *pdev)
3034 3034
3035 pullup_disable(udc); 3035 pullup_disable(udc);
3036 if (udc->transceiver) { 3036 if (udc->transceiver) {
3037 put_device(udc->transceiver->dev); 3037 otg_put_transceiver(udc->transceiver);
3038 udc->transceiver = NULL; 3038 udc->transceiver = NULL;
3039 } 3039 }
3040 omap_writew(0, UDC_SYSCON1); 3040 omap_writew(0, UDC_SYSCON1);
diff --git a/drivers/usb/gadget/pxa25x_udc.c b/drivers/usb/gadget/pxa25x_udc.c
index 697a0ca349bf..9b36205c5759 100644
--- a/drivers/usb/gadget/pxa25x_udc.c
+++ b/drivers/usb/gadget/pxa25x_udc.c
@@ -2198,7 +2198,7 @@ static int __init pxa25x_udc_probe(struct platform_device *pdev)
2198 udc_disable(dev); 2198 udc_disable(dev);
2199 udc_reinit(dev); 2199 udc_reinit(dev);
2200 2200
2201 dev->vbus = is_vbus_present(); 2201 dev->vbus = !!is_vbus_present();
2202 2202
2203 /* irq setup after old hardware state is cleaned up */ 2203 /* irq setup after old hardware state is cleaned up */
2204 retval = request_irq(irq, pxa25x_udc_irq, 2204 retval = request_irq(irq, pxa25x_udc_irq,
diff --git a/drivers/usb/gadget/pxa27x_udc.c b/drivers/usb/gadget/pxa27x_udc.c
index 65110d02a206..990f40f988d4 100644
--- a/drivers/usb/gadget/pxa27x_udc.c
+++ b/drivers/usb/gadget/pxa27x_udc.c
@@ -430,7 +430,6 @@ static void pio_irq_enable(struct pxa_ep *ep)
430/** 430/**
431 * pio_irq_disable - Disables irq generation for one endpoint 431 * pio_irq_disable - Disables irq generation for one endpoint
432 * @ep: udc endpoint 432 * @ep: udc endpoint
433 * @index: endpoint number
434 */ 433 */
435static void pio_irq_disable(struct pxa_ep *ep) 434static void pio_irq_disable(struct pxa_ep *ep)
436{ 435{
@@ -586,7 +585,6 @@ static void inc_ep_stats_reqs(struct pxa_ep *ep, int is_in)
586 * inc_ep_stats_bytes - Update ep stats counts 585 * inc_ep_stats_bytes - Update ep stats counts
587 * @ep: physical endpoint 586 * @ep: physical endpoint
588 * @count: bytes transfered on endpoint 587 * @count: bytes transfered on endpoint
589 * @req: usb request
590 * @is_in: ep direction (USB_DIR_IN or 0) 588 * @is_in: ep direction (USB_DIR_IN or 0)
591 */ 589 */
592static void inc_ep_stats_bytes(struct pxa_ep *ep, int count, int is_in) 590static void inc_ep_stats_bytes(struct pxa_ep *ep, int count, int is_in)
diff --git a/drivers/usb/gadget/s3c2410_udc.c b/drivers/usb/gadget/s3c2410_udc.c
index c7e255636803..9a2b8920532d 100644
--- a/drivers/usb/gadget/s3c2410_udc.c
+++ b/drivers/usb/gadget/s3c2410_udc.c
@@ -36,6 +36,7 @@
36#include <linux/interrupt.h> 36#include <linux/interrupt.h>
37#include <linux/platform_device.h> 37#include <linux/platform_device.h>
38#include <linux/clk.h> 38#include <linux/clk.h>
39#include <linux/gpio.h>
39 40
40#include <linux/debugfs.h> 41#include <linux/debugfs.h>
41#include <linux/seq_file.h> 42#include <linux/seq_file.h>
@@ -51,7 +52,6 @@
51#include <mach/irqs.h> 52#include <mach/irqs.h>
52 53
53#include <mach/hardware.h> 54#include <mach/hardware.h>
54#include <mach/regs-gpio.h>
55 55
56#include <plat/regs-udc.h> 56#include <plat/regs-udc.h>
57#include <plat/udc.h> 57#include <plat/udc.h>
@@ -1510,11 +1510,7 @@ static irqreturn_t s3c2410_udc_vbus_irq(int irq, void *_dev)
1510 1510
1511 dprintk(DEBUG_NORMAL, "%s()\n", __func__); 1511 dprintk(DEBUG_NORMAL, "%s()\n", __func__);
1512 1512
1513 /* some cpus cannot read from an line configured to IRQ! */ 1513 value = gpio_get_value(udc_info->vbus_pin) ? 1 : 0;
1514 s3c2410_gpio_cfgpin(udc_info->vbus_pin, S3C2410_GPIO_INPUT);
1515 value = s3c2410_gpio_getpin(udc_info->vbus_pin);
1516 s3c2410_gpio_cfgpin(udc_info->vbus_pin, S3C2410_GPIO_SFN2);
1517
1518 if (udc_info->vbus_pin_inverted) 1514 if (udc_info->vbus_pin_inverted)
1519 value = !value; 1515 value = !value;
1520 1516
@@ -1802,7 +1798,7 @@ static int s3c2410_udc_probe(struct platform_device *pdev)
1802 struct s3c2410_udc *udc = &memory; 1798 struct s3c2410_udc *udc = &memory;
1803 struct device *dev = &pdev->dev; 1799 struct device *dev = &pdev->dev;
1804 int retval; 1800 int retval;
1805 unsigned int irq; 1801 int irq;
1806 1802
1807 dev_dbg(dev, "%s()\n", __func__); 1803 dev_dbg(dev, "%s()\n", __func__);
1808 1804
@@ -1861,7 +1857,7 @@ static int s3c2410_udc_probe(struct platform_device *pdev)
1861 1857
1862 /* irq setup after old hardware state is cleaned up */ 1858 /* irq setup after old hardware state is cleaned up */
1863 retval = request_irq(IRQ_USBD, s3c2410_udc_irq, 1859 retval = request_irq(IRQ_USBD, s3c2410_udc_irq,
1864 IRQF_DISABLED, gadget_name, udc); 1860 IRQF_DISABLED, gadget_name, udc);
1865 1861
1866 if (retval != 0) { 1862 if (retval != 0) {
1867 dev_err(dev, "cannot get irq %i, err %d\n", IRQ_USBD, retval); 1863 dev_err(dev, "cannot get irq %i, err %d\n", IRQ_USBD, retval);
@@ -1872,17 +1868,28 @@ static int s3c2410_udc_probe(struct platform_device *pdev)
1872 dev_dbg(dev, "got irq %i\n", IRQ_USBD); 1868 dev_dbg(dev, "got irq %i\n", IRQ_USBD);
1873 1869
1874 if (udc_info && udc_info->vbus_pin > 0) { 1870 if (udc_info && udc_info->vbus_pin > 0) {
1875 irq = s3c2410_gpio_getirq(udc_info->vbus_pin); 1871 retval = gpio_request(udc_info->vbus_pin, "udc vbus");
1872 if (retval < 0) {
1873 dev_err(dev, "cannot claim vbus pin\n");
1874 goto err_int;
1875 }
1876
1877 irq = gpio_to_irq(udc_info->vbus_pin);
1878 if (irq < 0) {
1879 dev_err(dev, "no irq for gpio vbus pin\n");
1880 goto err_gpio_claim;
1881 }
1882
1876 retval = request_irq(irq, s3c2410_udc_vbus_irq, 1883 retval = request_irq(irq, s3c2410_udc_vbus_irq,
1877 IRQF_DISABLED | IRQF_TRIGGER_RISING 1884 IRQF_DISABLED | IRQF_TRIGGER_RISING
1878 | IRQF_TRIGGER_FALLING | IRQF_SHARED, 1885 | IRQF_TRIGGER_FALLING | IRQF_SHARED,
1879 gadget_name, udc); 1886 gadget_name, udc);
1880 1887
1881 if (retval != 0) { 1888 if (retval != 0) {
1882 dev_err(dev, "can't get vbus irq %i, err %d\n", 1889 dev_err(dev, "can't get vbus irq %d, err %d\n",
1883 irq, retval); 1890 irq, retval);
1884 retval = -EBUSY; 1891 retval = -EBUSY;
1885 goto err_int; 1892 goto err_gpio_claim;
1886 } 1893 }
1887 1894
1888 dev_dbg(dev, "got irq %i\n", irq); 1895 dev_dbg(dev, "got irq %i\n", irq);
@@ -1902,6 +1909,9 @@ static int s3c2410_udc_probe(struct platform_device *pdev)
1902 1909
1903 return 0; 1910 return 0;
1904 1911
1912err_gpio_claim:
1913 if (udc_info && udc_info->vbus_pin > 0)
1914 gpio_free(udc_info->vbus_pin);
1905err_int: 1915err_int:
1906 free_irq(IRQ_USBD, udc); 1916 free_irq(IRQ_USBD, udc);
1907err_map: 1917err_map:
@@ -1927,7 +1937,7 @@ static int s3c2410_udc_remove(struct platform_device *pdev)
1927 debugfs_remove(udc->regs_info); 1937 debugfs_remove(udc->regs_info);
1928 1938
1929 if (udc_info && udc_info->vbus_pin > 0) { 1939 if (udc_info && udc_info->vbus_pin > 0) {
1930 irq = s3c2410_gpio_getirq(udc_info->vbus_pin); 1940 irq = gpio_to_irq(udc_info->vbus_pin);
1931 free_irq(irq, udc); 1941 free_irq(irq, udc);
1932 } 1942 }
1933 1943
diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig
index f3a75a929e0a..2b476b6b3d4d 100644
--- a/drivers/usb/host/Kconfig
+++ b/drivers/usb/host/Kconfig
@@ -96,6 +96,19 @@ config USB_EHCI_HCD_PPC_OF
96 Enables support for the USB controller present on the PowerPC 96 Enables support for the USB controller present on the PowerPC
97 OpenFirmware platform bus. 97 OpenFirmware platform bus.
98 98
99config USB_OXU210HP_HCD
100 tristate "OXU210HP HCD support"
101 depends on USB
102 ---help---
103 The OXU210HP is an USB host/OTG/device controller. Enable this
104 option if your board has this chip. If unsure, say N.
105
106 This driver does not support isochronous transfers and doesn't
107 implement OTG nor USB device controllers.
108
109 To compile this driver as a module, choose M here: the
110 module will be called oxu210hp-hcd.
111
99config USB_ISP116X_HCD 112config USB_ISP116X_HCD
100 tristate "ISP116X HCD support" 113 tristate "ISP116X HCD support"
101 depends on USB 114 depends on USB
diff --git a/drivers/usb/host/Makefile b/drivers/usb/host/Makefile
index 23be22224044..e5f3f20787e4 100644
--- a/drivers/usb/host/Makefile
+++ b/drivers/usb/host/Makefile
@@ -13,6 +13,7 @@ obj-$(CONFIG_USB_WHCI_HCD) += whci/
13obj-$(CONFIG_PCI) += pci-quirks.o 13obj-$(CONFIG_PCI) += pci-quirks.o
14 14
15obj-$(CONFIG_USB_EHCI_HCD) += ehci-hcd.o 15obj-$(CONFIG_USB_EHCI_HCD) += ehci-hcd.o
16obj-$(CONFIG_USB_OXU210HP_HCD) += oxu210hp-hcd.o
16obj-$(CONFIG_USB_ISP116X_HCD) += isp116x-hcd.o 17obj-$(CONFIG_USB_ISP116X_HCD) += isp116x-hcd.o
17obj-$(CONFIG_USB_OHCI_HCD) += ohci-hcd.o 18obj-$(CONFIG_USB_OHCI_HCD) += ohci-hcd.o
18obj-$(CONFIG_USB_UHCI_HCD) += uhci-hcd.o 19obj-$(CONFIG_USB_UHCI_HCD) += uhci-hcd.o
diff --git a/drivers/usb/host/ehci-dbg.c b/drivers/usb/host/ehci-dbg.c
index 0cb53ca8d343..7f4ace73d44a 100644
--- a/drivers/usb/host/ehci-dbg.c
+++ b/drivers/usb/host/ehci-dbg.c
@@ -455,9 +455,7 @@ static void qh_lines (
455 (scratch >> 16) & 0x7fff, 455 (scratch >> 16) & 0x7fff,
456 scratch, 456 scratch,
457 td->urb); 457 td->urb);
458 if (temp < 0) 458 if (size < temp)
459 temp = 0;
460 else if (size < temp)
461 temp = size; 459 temp = size;
462 size -= temp; 460 size -= temp;
463 next += temp; 461 next += temp;
@@ -466,9 +464,7 @@ static void qh_lines (
466 } 464 }
467 465
468 temp = snprintf (next, size, "\n"); 466 temp = snprintf (next, size, "\n");
469 if (temp < 0) 467 if (size < temp)
470 temp = 0;
471 else if (size < temp)
472 temp = size; 468 temp = size;
473 size -= temp; 469 size -= temp;
474 next += temp; 470 next += temp;
diff --git a/drivers/usb/host/ehci-hub.c b/drivers/usb/host/ehci-hub.c
index 218f9660d7ee..97a53a48a3d8 100644
--- a/drivers/usb/host/ehci-hub.c
+++ b/drivers/usb/host/ehci-hub.c
@@ -194,6 +194,7 @@ static int ehci_bus_resume (struct usb_hcd *hcd)
194 u32 temp; 194 u32 temp;
195 u32 power_okay; 195 u32 power_okay;
196 int i; 196 int i;
197 u8 resume_needed = 0;
197 198
198 if (time_before (jiffies, ehci->next_statechange)) 199 if (time_before (jiffies, ehci->next_statechange))
199 msleep(5); 200 msleep(5);
@@ -228,7 +229,9 @@ static int ehci_bus_resume (struct usb_hcd *hcd)
228 229
229 /* Some controller/firmware combinations need a delay during which 230 /* Some controller/firmware combinations need a delay during which
230 * they set up the port statuses. See Bugzilla #8190. */ 231 * they set up the port statuses. See Bugzilla #8190. */
231 mdelay(8); 232 spin_unlock_irq(&ehci->lock);
233 msleep(8);
234 spin_lock_irq(&ehci->lock);
232 235
233 /* manually resume the ports we suspended during bus_suspend() */ 236 /* manually resume the ports we suspended during bus_suspend() */
234 i = HCS_N_PORTS (ehci->hcs_params); 237 i = HCS_N_PORTS (ehci->hcs_params);
@@ -236,12 +239,21 @@ static int ehci_bus_resume (struct usb_hcd *hcd)
236 temp = ehci_readl(ehci, &ehci->regs->port_status [i]); 239 temp = ehci_readl(ehci, &ehci->regs->port_status [i]);
237 temp &= ~(PORT_RWC_BITS | PORT_WAKE_BITS); 240 temp &= ~(PORT_RWC_BITS | PORT_WAKE_BITS);
238 if (test_bit(i, &ehci->bus_suspended) && 241 if (test_bit(i, &ehci->bus_suspended) &&
239 (temp & PORT_SUSPEND)) 242 (temp & PORT_SUSPEND)) {
240 temp |= PORT_RESUME; 243 temp |= PORT_RESUME;
244 resume_needed = 1;
245 }
241 ehci_writel(ehci, temp, &ehci->regs->port_status [i]); 246 ehci_writel(ehci, temp, &ehci->regs->port_status [i]);
242 } 247 }
248
249 /* msleep for 20ms only if code is trying to resume port */
250 if (resume_needed) {
251 spin_unlock_irq(&ehci->lock);
252 msleep(20);
253 spin_lock_irq(&ehci->lock);
254 }
255
243 i = HCS_N_PORTS (ehci->hcs_params); 256 i = HCS_N_PORTS (ehci->hcs_params);
244 mdelay (20);
245 while (i--) { 257 while (i--) {
246 temp = ehci_readl(ehci, &ehci->regs->port_status [i]); 258 temp = ehci_readl(ehci, &ehci->regs->port_status [i]);
247 if (test_bit(i, &ehci->bus_suspended) && 259 if (test_bit(i, &ehci->bus_suspended) &&
@@ -422,8 +434,15 @@ static int check_reset_complete (
422 port_status &= ~PORT_RWC_BITS; 434 port_status &= ~PORT_RWC_BITS;
423 ehci_writel(ehci, port_status, status_reg); 435 ehci_writel(ehci, port_status, status_reg);
424 436
425 } else 437 /* ensure 440EPX ohci controller state is operational */
438 if (ehci->has_amcc_usb23)
439 set_ohci_hcfs(ehci, 1);
440 } else {
426 ehci_dbg (ehci, "port %d high speed\n", index + 1); 441 ehci_dbg (ehci, "port %d high speed\n", index + 1);
442 /* ensure 440EPx ohci controller state is suspended */
443 if (ehci->has_amcc_usb23)
444 set_ohci_hcfs(ehci, 0);
445 }
427 446
428 return port_status; 447 return port_status;
429} 448}
diff --git a/drivers/usb/host/ehci-pci.c b/drivers/usb/host/ehci-pci.c
index 36864f958444..bdc6e86e1f8b 100644
--- a/drivers/usb/host/ehci-pci.c
+++ b/drivers/usb/host/ehci-pci.c
@@ -219,15 +219,19 @@ static int ehci_pci_setup(struct usb_hcd *hcd)
219 /* Serial Bus Release Number is at PCI 0x60 offset */ 219 /* Serial Bus Release Number is at PCI 0x60 offset */
220 pci_read_config_byte(pdev, 0x60, &ehci->sbrn); 220 pci_read_config_byte(pdev, 0x60, &ehci->sbrn);
221 221
222 /* Workaround current PCI init glitch: wakeup bits aren't 222 /* Keep this around for a while just in case some EHCI
223 * being set from PCI PM capability. 223 * implementation uses legacy PCI PM support. This test
224 * can be removed on 17 Dec 2009 if the dev_warn() hasn't
225 * been triggered by then.
224 */ 226 */
225 if (!device_can_wakeup(&pdev->dev)) { 227 if (!device_can_wakeup(&pdev->dev)) {
226 u16 port_wake; 228 u16 port_wake;
227 229
228 pci_read_config_word(pdev, 0x62, &port_wake); 230 pci_read_config_word(pdev, 0x62, &port_wake);
229 if (port_wake & 0x0001) 231 if (port_wake & 0x0001) {
232 dev_warn(&pdev->dev, "Enabling legacy PCI PM\n");
230 device_init_wakeup(&pdev->dev, 1); 233 device_init_wakeup(&pdev->dev, 1);
234 }
231 } 235 }
232 236
233#ifdef CONFIG_USB_SUSPEND 237#ifdef CONFIG_USB_SUSPEND
@@ -428,6 +432,8 @@ static struct pci_driver ehci_pci_driver = {
428 432
429#ifdef CONFIG_PM 433#ifdef CONFIG_PM
430 .suspend = usb_hcd_pci_suspend, 434 .suspend = usb_hcd_pci_suspend,
435 .suspend_late = usb_hcd_pci_suspend_late,
436 .resume_early = usb_hcd_pci_resume_early,
431 .resume = usb_hcd_pci_resume, 437 .resume = usb_hcd_pci_resume,
432#endif 438#endif
433 .shutdown = usb_hcd_pci_shutdown, 439 .shutdown = usb_hcd_pci_shutdown,
diff --git a/drivers/usb/host/ehci-ppc-of.c b/drivers/usb/host/ehci-ppc-of.c
index b018deed2e8f..ef732b704f53 100644
--- a/drivers/usb/host/ehci-ppc-of.c
+++ b/drivers/usb/host/ehci-ppc-of.c
@@ -107,11 +107,13 @@ ehci_hcd_ppc_of_probe(struct of_device *op, const struct of_device_id *match)
107{ 107{
108 struct device_node *dn = op->node; 108 struct device_node *dn = op->node;
109 struct usb_hcd *hcd; 109 struct usb_hcd *hcd;
110 struct ehci_hcd *ehci; 110 struct ehci_hcd *ehci = NULL;
111 struct resource res; 111 struct resource res;
112 int irq; 112 int irq;
113 int rv; 113 int rv;
114 114
115 struct device_node *np;
116
115 if (usb_disabled()) 117 if (usb_disabled())
116 return -ENODEV; 118 return -ENODEV;
117 119
@@ -149,6 +151,20 @@ ehci_hcd_ppc_of_probe(struct of_device *op, const struct of_device_id *match)
149 } 151 }
150 152
151 ehci = hcd_to_ehci(hcd); 153 ehci = hcd_to_ehci(hcd);
154 np = of_find_compatible_node(NULL, NULL, "ibm,usb-ohci-440epx");
155 if (np != NULL) {
156 /* claim we really affected by usb23 erratum */
157 if (!of_address_to_resource(np, 0, &res))
158 ehci->ohci_hcctrl_reg = ioremap(res.start +
159 OHCI_HCCTRL_OFFSET, OHCI_HCCTRL_LEN);
160 else
161 pr_debug(__FILE__ ": no ohci offset in fdt\n");
162 if (!ehci->ohci_hcctrl_reg) {
163 pr_debug(__FILE__ ": ioremap for ohci hcctrl failed\n");
164 } else {
165 ehci->has_amcc_usb23 = 1;
166 }
167 }
152 168
153 if (of_get_property(dn, "big-endian", NULL)) { 169 if (of_get_property(dn, "big-endian", NULL)) {
154 ehci->big_endian_mmio = 1; 170 ehci->big_endian_mmio = 1;
@@ -181,6 +197,9 @@ err_ioremap:
181 irq_dispose_mapping(irq); 197 irq_dispose_mapping(irq);
182err_irq: 198err_irq:
183 release_mem_region(hcd->rsrc_start, hcd->rsrc_len); 199 release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
200
201 if (ehci->has_amcc_usb23)
202 iounmap(ehci->ohci_hcctrl_reg);
184err_rmr: 203err_rmr:
185 usb_put_hcd(hcd); 204 usb_put_hcd(hcd);
186 205
@@ -191,6 +210,11 @@ err_rmr:
191static int ehci_hcd_ppc_of_remove(struct of_device *op) 210static int ehci_hcd_ppc_of_remove(struct of_device *op)
192{ 211{
193 struct usb_hcd *hcd = dev_get_drvdata(&op->dev); 212 struct usb_hcd *hcd = dev_get_drvdata(&op->dev);
213 struct ehci_hcd *ehci = hcd_to_ehci(hcd);
214
215 struct device_node *np;
216 struct resource res;
217
194 dev_set_drvdata(&op->dev, NULL); 218 dev_set_drvdata(&op->dev, NULL);
195 219
196 dev_dbg(&op->dev, "stopping PPC-OF USB Controller\n"); 220 dev_dbg(&op->dev, "stopping PPC-OF USB Controller\n");
@@ -201,6 +225,25 @@ static int ehci_hcd_ppc_of_remove(struct of_device *op)
201 irq_dispose_mapping(hcd->irq); 225 irq_dispose_mapping(hcd->irq);
202 release_mem_region(hcd->rsrc_start, hcd->rsrc_len); 226 release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
203 227
228 /* use request_mem_region to test if the ohci driver is loaded. if so
229 * ensure the ohci core is operational.
230 */
231 if (ehci->has_amcc_usb23) {
232 np = of_find_compatible_node(NULL, NULL, "ibm,usb-ohci-440epx");
233 if (np != NULL) {
234 if (!of_address_to_resource(np, 0, &res))
235 if (!request_mem_region(res.start,
236 0x4, hcd_name))
237 set_ohci_hcfs(ehci, 1);
238 else
239 release_mem_region(res.start, 0x4);
240 else
241 pr_debug(__FILE__ ": no ohci offset in fdt\n");
242 of_node_put(np);
243 }
244
245 iounmap(ehci->ohci_hcctrl_reg);
246 }
204 usb_put_hcd(hcd); 247 usb_put_hcd(hcd);
205 248
206 return 0; 249 return 0;
diff --git a/drivers/usb/host/ehci.h b/drivers/usb/host/ehci.h
index c7d4b5a06bdb..fb7054ccf4fc 100644
--- a/drivers/usb/host/ehci.h
+++ b/drivers/usb/host/ehci.h
@@ -120,6 +120,16 @@ struct ehci_hcd { /* one per controller */
120 unsigned has_fsl_port_bug:1; /* FreeScale */ 120 unsigned has_fsl_port_bug:1; /* FreeScale */
121 unsigned big_endian_mmio:1; 121 unsigned big_endian_mmio:1;
122 unsigned big_endian_desc:1; 122 unsigned big_endian_desc:1;
123 unsigned has_amcc_usb23:1;
124
125 /* required for usb32 quirk */
126 #define OHCI_CTRL_HCFS (3 << 6)
127 #define OHCI_USB_OPER (2 << 6)
128 #define OHCI_USB_SUSPEND (3 << 6)
129
130 #define OHCI_HCCTRL_OFFSET 0x4
131 #define OHCI_HCCTRL_LEN 0x4
132 __hc32 *ohci_hcctrl_reg;
123 133
124 u8 sbrn; /* packed release number */ 134 u8 sbrn; /* packed release number */
125 135
@@ -636,6 +646,30 @@ static inline void ehci_writel(const struct ehci_hcd *ehci,
636#endif 646#endif
637} 647}
638 648
649/*
650 * On certain ppc-44x SoC there is a HW issue, that could only worked around with
651 * explicit suspend/operate of OHCI. This function hereby makes sense only on that arch.
652 * Other common bits are dependant on has_amcc_usb23 quirk flag.
653 */
654#ifdef CONFIG_44x
655static inline void set_ohci_hcfs(struct ehci_hcd *ehci, int operational)
656{
657 u32 hc_control;
658
659 hc_control = (readl_be(ehci->ohci_hcctrl_reg) & ~OHCI_CTRL_HCFS);
660 if (operational)
661 hc_control |= OHCI_USB_OPER;
662 else
663 hc_control |= OHCI_USB_SUSPEND;
664
665 writel_be(hc_control, ehci->ohci_hcctrl_reg);
666 (void) readl_be(ehci->ohci_hcctrl_reg);
667}
668#else
669static inline void set_ohci_hcfs(struct ehci_hcd *ehci, int operational)
670{ }
671#endif
672
639/*-------------------------------------------------------------------------*/ 673/*-------------------------------------------------------------------------*/
640 674
641/* 675/*
diff --git a/drivers/usb/host/isp1760-hcd.c b/drivers/usb/host/isp1760-hcd.c
index 8017f1cf78e2..b899f1a59c26 100644
--- a/drivers/usb/host/isp1760-hcd.c
+++ b/drivers/usb/host/isp1760-hcd.c
@@ -435,14 +435,13 @@ static int isp1760_hc_setup(struct usb_hcd *hcd)
435 435
436 /* 436 /*
437 * PORT 1 Control register of the ISP1760 is the OTG control 437 * PORT 1 Control register of the ISP1760 is the OTG control
438 * register on ISP1761. 438 * register on ISP1761. Since there is no OTG or device controller
439 * support in this driver, we use port 1 as a "normal" USB host port on
440 * both chips.
439 */ 441 */
440 if (!(priv->devflags & ISP1760_FLAG_ISP1761) && 442 isp1760_writel(PORT1_POWER | PORT1_INIT2,
441 !(priv->devflags & ISP1760_FLAG_PORT1_DIS)) { 443 hcd->regs + HC_PORT1_CTRL);
442 isp1760_writel(PORT1_POWER | PORT1_INIT2, 444 mdelay(10);
443 hcd->regs + HC_PORT1_CTRL);
444 mdelay(10);
445 }
446 445
447 priv->hcs_params = isp1760_readl(hcd->regs + HC_HCSPARAMS); 446 priv->hcs_params = isp1760_readl(hcd->regs + HC_HCSPARAMS);
448 447
diff --git a/drivers/usb/host/isp1760-hcd.h b/drivers/usb/host/isp1760-hcd.h
index 4377277667d9..a9daea587962 100644
--- a/drivers/usb/host/isp1760-hcd.h
+++ b/drivers/usb/host/isp1760-hcd.h
@@ -135,7 +135,6 @@ typedef void (packet_enqueue)(struct usb_hcd *hcd, struct isp1760_qh *qh,
135 * indicate the most "atypical" case, so that a devflags of 0 is 135 * indicate the most "atypical" case, so that a devflags of 0 is
136 * a sane default configuration. 136 * a sane default configuration.
137 */ 137 */
138#define ISP1760_FLAG_PORT1_DIS 0x00000001 /* Port 1 disabled */
139#define ISP1760_FLAG_BUS_WIDTH_16 0x00000002 /* 16-bit data bus width */ 138#define ISP1760_FLAG_BUS_WIDTH_16 0x00000002 /* 16-bit data bus width */
140#define ISP1760_FLAG_OTG_EN 0x00000004 /* Port 1 supports OTG */ 139#define ISP1760_FLAG_OTG_EN 0x00000004 /* Port 1 supports OTG */
141#define ISP1760_FLAG_ANALOG_OC 0x00000008 /* Analog overcurrent */ 140#define ISP1760_FLAG_ANALOG_OC 0x00000008 /* Analog overcurrent */
diff --git a/drivers/usb/host/isp1760-if.c b/drivers/usb/host/isp1760-if.c
index b87ca7cf4b37..4cf7ca428b33 100644
--- a/drivers/usb/host/isp1760-if.c
+++ b/drivers/usb/host/isp1760-if.c
@@ -60,9 +60,6 @@ static int of_isp1760_probe(struct of_device *dev,
60 if (of_device_is_compatible(dp, "nxp,usb-isp1761")) 60 if (of_device_is_compatible(dp, "nxp,usb-isp1761"))
61 devflags |= ISP1760_FLAG_ISP1761; 61 devflags |= ISP1760_FLAG_ISP1761;
62 62
63 if (of_get_property(dp, "port1-disable", NULL) != NULL)
64 devflags |= ISP1760_FLAG_PORT1_DIS;
65
66 /* Some systems wire up only 16 of the 32 data lines */ 63 /* Some systems wire up only 16 of the 32 data lines */
67 prop = of_get_property(dp, "bus-width", NULL); 64 prop = of_get_property(dp, "bus-width", NULL);
68 if (prop && *prop == 16) 65 if (prop && *prop == 16)
@@ -129,23 +126,23 @@ static struct of_platform_driver isp1760_of_driver = {
129#endif 126#endif
130 127
131#ifdef CONFIG_PCI 128#ifdef CONFIG_PCI
132static u32 nxp_pci_io_base;
133static u32 iolength;
134static u32 pci_mem_phy0;
135static u32 length;
136static u8 __iomem *chip_addr;
137static u8 __iomem *iobase;
138
139static int __devinit isp1761_pci_probe(struct pci_dev *dev, 129static int __devinit isp1761_pci_probe(struct pci_dev *dev,
140 const struct pci_device_id *id) 130 const struct pci_device_id *id)
141{ 131{
142 u8 latency, limit; 132 u8 latency, limit;
143 __u32 reg_data; 133 __u32 reg_data;
144 int retry_count; 134 int retry_count;
145 int length;
146 int status = 1;
147 struct usb_hcd *hcd; 135 struct usb_hcd *hcd;
148 unsigned int devflags = 0; 136 unsigned int devflags = 0;
137 int ret_status = 0;
138
139 resource_size_t pci_mem_phy0;
140 resource_size_t memlength;
141
142 u8 __iomem *chip_addr;
143 u8 __iomem *iobase;
144 resource_size_t nxp_pci_io_base;
145 resource_size_t iolength;
149 146
150 if (usb_disabled()) 147 if (usb_disabled())
151 return -ENODEV; 148 return -ENODEV;
@@ -168,26 +165,30 @@ static int __devinit isp1761_pci_probe(struct pci_dev *dev,
168 iobase = ioremap_nocache(nxp_pci_io_base, iolength); 165 iobase = ioremap_nocache(nxp_pci_io_base, iolength);
169 if (!iobase) { 166 if (!iobase) {
170 printk(KERN_ERR "ioremap #1\n"); 167 printk(KERN_ERR "ioremap #1\n");
171 release_mem_region(nxp_pci_io_base, iolength); 168 ret_status = -ENOMEM;
172 return -ENOMEM; 169 goto cleanup1;
173 } 170 }
174 /* Grab the PLX PCI shared memory of the ISP 1761 we need */ 171 /* Grab the PLX PCI shared memory of the ISP 1761 we need */
175 pci_mem_phy0 = pci_resource_start(dev, 3); 172 pci_mem_phy0 = pci_resource_start(dev, 3);
176 length = pci_resource_len(dev, 3); 173 memlength = pci_resource_len(dev, 3);
177 174 if (memlength < 0xffff) {
178 if (length < 0xffff) { 175 printk(KERN_ERR "memory length for this resource is wrong\n");
179 printk(KERN_ERR "memory length for this resource is less than " 176 ret_status = -ENOMEM;
180 "required\n"); 177 goto cleanup2;
181 release_mem_region(nxp_pci_io_base, iolength);
182 iounmap(iobase);
183 return -ENOMEM;
184 } 178 }
185 179
186 if (!request_mem_region(pci_mem_phy0, length, "ISP-PCI")) { 180 if (!request_mem_region(pci_mem_phy0, memlength, "ISP-PCI")) {
187 printk(KERN_ERR "host controller already in use\n"); 181 printk(KERN_ERR "host controller already in use\n");
188 release_mem_region(nxp_pci_io_base, iolength); 182 ret_status = -EBUSY;
189 iounmap(iobase); 183 goto cleanup2;
190 return -EBUSY; 184 }
185
186 /* map available memory */
187 chip_addr = ioremap_nocache(pci_mem_phy0,memlength);
188 if (!chip_addr) {
189 printk(KERN_ERR "Error ioremap failed\n");
190 ret_status = -ENOMEM;
191 goto cleanup3;
191 } 192 }
192 193
193 /* bad pci latencies can contribute to overruns */ 194 /* bad pci latencies can contribute to overruns */
@@ -210,39 +211,54 @@ static int __devinit isp1761_pci_probe(struct pci_dev *dev,
210 * */ 211 * */
211 writel(0xface, chip_addr + HC_SCRATCH_REG); 212 writel(0xface, chip_addr + HC_SCRATCH_REG);
212 udelay(100); 213 udelay(100);
213 reg_data = readl(chip_addr + HC_SCRATCH_REG); 214 reg_data = readl(chip_addr + HC_SCRATCH_REG) & 0x0000ffff;
214 retry_count--; 215 retry_count--;
215 } 216 }
216 217
218 iounmap(chip_addr);
219
217 /* Host Controller presence is detected by writing to scratch register 220 /* Host Controller presence is detected by writing to scratch register
218 * and reading back and checking the contents are same or not 221 * and reading back and checking the contents are same or not
219 */ 222 */
220 if (reg_data != 0xFACE) { 223 if (reg_data != 0xFACE) {
221 dev_err(&dev->dev, "scratch register mismatch %x\n", reg_data); 224 dev_err(&dev->dev, "scratch register mismatch %x\n", reg_data);
222 goto clean; 225 ret_status = -ENOMEM;
226 goto cleanup3;
223 } 227 }
224 228
225 pci_set_master(dev); 229 pci_set_master(dev);
226 230
227 status = readl(iobase + 0x68); 231 /* configure PLX PCI chip to pass interrupts */
228 status |= 0x900; 232#define PLX_INT_CSR_REG 0x68
229 writel(status, iobase + 0x68); 233 reg_data = readl(iobase + PLX_INT_CSR_REG);
234 reg_data |= 0x900;
235 writel(reg_data, iobase + PLX_INT_CSR_REG);
230 236
231 dev->dev.dma_mask = NULL; 237 dev->dev.dma_mask = NULL;
232 hcd = isp1760_register(pci_mem_phy0, length, dev->irq, 238 hcd = isp1760_register(pci_mem_phy0, memlength, dev->irq,
233 IRQF_SHARED | IRQF_DISABLED, &dev->dev, dev_name(&dev->dev), 239 IRQF_SHARED | IRQF_DISABLED, &dev->dev, dev_name(&dev->dev),
234 devflags); 240 devflags);
235 if (!IS_ERR(hcd)) { 241 if (IS_ERR(hcd)) {
236 pci_set_drvdata(dev, hcd); 242 ret_status = -ENODEV;
237 return 0; 243 goto cleanup3;
238 } 244 }
239clean: 245
240 status = -ENODEV; 246 /* done with PLX IO access */
247 iounmap(iobase);
248 release_mem_region(nxp_pci_io_base, iolength);
249
250 pci_set_drvdata(dev, hcd);
251 return 0;
252
253cleanup3:
254 release_mem_region(pci_mem_phy0, memlength);
255cleanup2:
241 iounmap(iobase); 256 iounmap(iobase);
242 release_mem_region(pci_mem_phy0, length); 257cleanup1:
243 release_mem_region(nxp_pci_io_base, iolength); 258 release_mem_region(nxp_pci_io_base, iolength);
244 return status; 259 return ret_status;
245} 260}
261
246static void isp1761_pci_remove(struct pci_dev *dev) 262static void isp1761_pci_remove(struct pci_dev *dev)
247{ 263{
248 struct usb_hcd *hcd; 264 struct usb_hcd *hcd;
@@ -255,12 +271,6 @@ static void isp1761_pci_remove(struct pci_dev *dev)
255 usb_put_hcd(hcd); 271 usb_put_hcd(hcd);
256 272
257 pci_disable_device(dev); 273 pci_disable_device(dev);
258
259 iounmap(iobase);
260 iounmap(chip_addr);
261
262 release_mem_region(nxp_pci_io_base, iolength);
263 release_mem_region(pci_mem_phy0, length);
264} 274}
265 275
266static void isp1761_pci_shutdown(struct pci_dev *dev) 276static void isp1761_pci_shutdown(struct pci_dev *dev)
@@ -268,12 +278,16 @@ static void isp1761_pci_shutdown(struct pci_dev *dev)
268 printk(KERN_ERR "ips1761_pci_shutdown\n"); 278 printk(KERN_ERR "ips1761_pci_shutdown\n");
269} 279}
270 280
271static const struct pci_device_id isp1760_plx [] = { { 281static const struct pci_device_id isp1760_plx [] = {
272 /* handle any USB 2.0 EHCI controller */ 282 {
273 PCI_DEVICE_CLASS(((PCI_CLASS_BRIDGE_OTHER << 8) | (0x06 << 16)), ~0), 283 .class = PCI_CLASS_BRIDGE_OTHER << 8,
274 .driver_data = 0, 284 .class_mask = ~0,
275}, 285 .vendor = PCI_VENDOR_ID_PLX,
276{ /* end: all zeroes */ } 286 .device = 0x5406,
287 .subvendor = PCI_VENDOR_ID_PLX,
288 .subdevice = 0x9054,
289 },
290 { }
277}; 291};
278MODULE_DEVICE_TABLE(pci, isp1760_plx); 292MODULE_DEVICE_TABLE(pci, isp1760_plx);
279 293
diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c
index 8aa3f4556a32..65a9609f4ad6 100644
--- a/drivers/usb/host/ohci-hcd.c
+++ b/drivers/usb/host/ohci-hcd.c
@@ -589,13 +589,15 @@ static int ohci_run (struct ohci_hcd *ohci)
589 /* also: power/overcurrent flags in roothub.a */ 589 /* also: power/overcurrent flags in roothub.a */
590 } 590 }
591 591
592 /* Reset USB nearly "by the book". RemoteWakeupConnected was 592 /* Reset USB nearly "by the book". RemoteWakeupConnected has
593 * saved if boot firmware (BIOS/SMM/...) told us it's connected, 593 * to be checked in case boot firmware (BIOS/SMM/...) has set up
594 * or if bus glue did the same (e.g. for PCI add-in cards with 594 * wakeup in a way the bus isn't aware of (e.g., legacy PCI PM).
595 * PCI PM support). 595 * If the bus glue detected wakeup capability then it should
596 * already be enabled. Either way, if wakeup should be enabled
597 * but isn't, we'll enable it now.
596 */ 598 */
597 if ((ohci->hc_control & OHCI_CTRL_RWC) != 0 599 if ((ohci->hc_control & OHCI_CTRL_RWC) != 0
598 && !device_may_wakeup(hcd->self.controller)) 600 && !device_can_wakeup(hcd->self.controller))
599 device_init_wakeup(hcd->self.controller, 1); 601 device_init_wakeup(hcd->self.controller, 1);
600 602
601 switch (ohci->hc_control & OHCI_CTRL_HCFS) { 603 switch (ohci->hc_control & OHCI_CTRL_HCFS) {
diff --git a/drivers/usb/host/ohci-pci.c b/drivers/usb/host/ohci-pci.c
index a9c2ae36c7ad..8b28ae7865ba 100644
--- a/drivers/usb/host/ohci-pci.c
+++ b/drivers/usb/host/ohci-pci.c
@@ -355,9 +355,9 @@ static int __devinit ohci_pci_start (struct usb_hcd *hcd)
355 355
356 /* RWC may not be set for add-in PCI cards, since boot 356 /* RWC may not be set for add-in PCI cards, since boot
357 * firmware probably ignored them. This transfers PCI 357 * firmware probably ignored them. This transfers PCI
358 * PM wakeup capabilities (once the PCI layer is fixed). 358 * PM wakeup capabilities.
359 */ 359 */
360 if (device_may_wakeup(&pdev->dev)) 360 if (device_can_wakeup(&pdev->dev))
361 ohci->hc_control |= OHCI_CTRL_RWC; 361 ohci->hc_control |= OHCI_CTRL_RWC;
362 } 362 }
363#endif /* CONFIG_PM */ 363#endif /* CONFIG_PM */
@@ -487,6 +487,8 @@ static struct pci_driver ohci_pci_driver = {
487 487
488#ifdef CONFIG_PM 488#ifdef CONFIG_PM
489 .suspend = usb_hcd_pci_suspend, 489 .suspend = usb_hcd_pci_suspend,
490 .suspend_late = usb_hcd_pci_suspend_late,
491 .resume_early = usb_hcd_pci_resume_early,
490 .resume = usb_hcd_pci_resume, 492 .resume = usb_hcd_pci_resume,
491#endif 493#endif
492 494
diff --git a/drivers/usb/host/ohci-pnx4008.c b/drivers/usb/host/ohci-pnx4008.c
index e306ca6aef3d..100bf3d8437c 100644
--- a/drivers/usb/host/ohci-pnx4008.c
+++ b/drivers/usb/host/ohci-pnx4008.c
@@ -106,65 +106,34 @@ extern int ocpi_enable(void);
106 106
107static struct clk *usb_clk; 107static struct clk *usb_clk;
108 108
109static int isp1301_probe(struct i2c_adapter *adap);
110static int isp1301_detach(struct i2c_client *client);
111
112static const unsigned short normal_i2c[] = 109static const unsigned short normal_i2c[] =
113 { ISP1301_I2C_ADDR, ISP1301_I2C_ADDR + 1, I2C_CLIENT_END }; 110 { ISP1301_I2C_ADDR, ISP1301_I2C_ADDR + 1, I2C_CLIENT_END };
114static const unsigned short dummy_i2c_addrlist[] = { I2C_CLIENT_END };
115
116static struct i2c_client_address_data addr_data = {
117 .normal_i2c = normal_i2c,
118 .probe = dummy_i2c_addrlist,
119 .ignore = dummy_i2c_addrlist,
120};
121
122struct i2c_driver isp1301_driver = {
123 .driver = {
124 .name = "isp1301_pnx",
125 },
126 .attach_adapter = isp1301_probe,
127 .detach_client = isp1301_detach,
128};
129 111
130static int isp1301_attach(struct i2c_adapter *adap, int addr, int kind) 112static int isp1301_probe(struct i2c_client *client,
113 const struct i2c_device_id *id)
131{ 114{
132 struct i2c_client *c;
133 int err;
134
135 c = kzalloc(sizeof(*c), GFP_KERNEL);
136 if (!c)
137 return -ENOMEM;
138
139 strlcpy(c->name, "isp1301_pnx", I2C_NAME_SIZE);
140 c->flags = 0;
141 c->addr = addr;
142 c->adapter = adap;
143 c->driver = &isp1301_driver;
144
145 err = i2c_attach_client(c);
146 if (err) {
147 kfree(c);
148 return err;
149 }
150
151 isp1301_i2c_client = c;
152
153 return 0; 115 return 0;
154} 116}
155 117
156static int isp1301_probe(struct i2c_adapter *adap) 118static int isp1301_remove(struct i2c_client *client)
157{ 119{
158 return i2c_probe(adap, &addr_data, isp1301_attach);
159}
160
161static int isp1301_detach(struct i2c_client *client)
162{
163 i2c_detach_client(client);
164 kfree(isp1301_i2c_client);
165 return 0; 120 return 0;
166} 121}
167 122
123const struct i2c_device_id isp1301_id[] = {
124 { "isp1301_pnx", 0 },
125 { }
126};
127
128struct i2c_driver isp1301_driver = {
129 .driver = {
130 .name = "isp1301_pnx",
131 },
132 .probe = isp1301_probe,
133 .remove = isp1301_remove,
134 .id_table = isp1301_id,
135};
136
168static void i2c_write(u8 buf, u8 subaddr) 137static void i2c_write(u8 buf, u8 subaddr)
169{ 138{
170 char tmpbuf[2]; 139 char tmpbuf[2];
@@ -328,6 +297,8 @@ static int __devinit usb_hcd_pnx4008_probe(struct platform_device *pdev)
328 struct usb_hcd *hcd = 0; 297 struct usb_hcd *hcd = 0;
329 struct ohci_hcd *ohci; 298 struct ohci_hcd *ohci;
330 const struct hc_driver *driver = &ohci_pnx4008_hc_driver; 299 const struct hc_driver *driver = &ohci_pnx4008_hc_driver;
300 struct i2c_adapter *i2c_adap;
301 struct i2c_board_info i2c_info;
331 302
332 int ret = 0, irq; 303 int ret = 0, irq;
333 304
@@ -351,9 +322,20 @@ static int __devinit usb_hcd_pnx4008_probe(struct platform_device *pdev)
351 322
352 ret = i2c_add_driver(&isp1301_driver); 323 ret = i2c_add_driver(&isp1301_driver);
353 if (ret < 0) { 324 if (ret < 0) {
354 err("failed to connect I2C to ISP1301 USB Transceiver"); 325 err("failed to add ISP1301 driver");
355 goto out; 326 goto out;
356 } 327 }
328 i2c_adap = i2c_get_adapter(2);
329 memset(&i2c_info, 0, sizeof(struct i2c_board_info));
330 strlcpy(i2c_info.name, "isp1301_pnx", I2C_NAME_SIZE);
331 isp1301_i2c_client = i2c_new_probed_device(i2c_adap, &i2c_info,
332 normal_i2c);
333 i2c_put_adapter(i2c_adap);
334 if (!isp1301_i2c_client) {
335 err("failed to connect I2C to ISP1301 USB Transceiver");
336 ret = -ENODEV;
337 goto out_i2c_driver;
338 }
357 339
358 isp1301_configure(); 340 isp1301_configure();
359 341
@@ -429,6 +411,9 @@ out3:
429out2: 411out2:
430 clk_put(usb_clk); 412 clk_put(usb_clk);
431out1: 413out1:
414 i2c_unregister_client(isp1301_i2c_client);
415 isp1301_i2c_client = NULL;
416out_i2c_driver:
432 i2c_del_driver(&isp1301_driver); 417 i2c_del_driver(&isp1301_driver);
433out: 418out:
434 return ret; 419 return ret;
@@ -445,6 +430,8 @@ static int usb_hcd_pnx4008_remove(struct platform_device *pdev)
445 pnx4008_unset_usb_bits(); 430 pnx4008_unset_usb_bits();
446 clk_disable(usb_clk); 431 clk_disable(usb_clk);
447 clk_put(usb_clk); 432 clk_put(usb_clk);
433 i2c_unregister_client(isp1301_i2c_client);
434 isp1301_i2c_client = NULL;
448 i2c_del_driver(&isp1301_driver); 435 i2c_del_driver(&isp1301_driver);
449 436
450 platform_set_drvdata(pdev, NULL); 437 platform_set_drvdata(pdev, NULL);
diff --git a/drivers/usb/host/ohci-ppc-of.c b/drivers/usb/host/ohci-ppc-of.c
index 7ac53264ead3..68a301710297 100644
--- a/drivers/usb/host/ohci-ppc-of.c
+++ b/drivers/usb/host/ohci-ppc-of.c
@@ -91,6 +91,7 @@ ohci_hcd_ppc_of_probe(struct of_device *op, const struct of_device_id *match)
91 91
92 int rv; 92 int rv;
93 int is_bigendian; 93 int is_bigendian;
94 struct device_node *np;
94 95
95 if (usb_disabled()) 96 if (usb_disabled())
96 return -ENODEV; 97 return -ENODEV;
@@ -147,6 +148,30 @@ ohci_hcd_ppc_of_probe(struct of_device *op, const struct of_device_id *match)
147 if (rv == 0) 148 if (rv == 0)
148 return 0; 149 return 0;
149 150
151 /* by now, 440epx is known to show usb_23 erratum */
152 np = of_find_compatible_node(NULL, NULL, "ibm,usb-ehci-440epx");
153
154 /* Work around - At this point ohci_run has executed, the
155 * controller is running, everything, the root ports, etc., is
156 * set up. If the ehci driver is loaded, put the ohci core in
157 * the suspended state. The ehci driver will bring it out of
158 * suspended state when / if a non-high speed USB device is
159 * attached to the USB Host port. If the ehci driver is not
160 * loaded, do nothing. request_mem_region is used to test if
161 * the ehci driver is loaded.
162 */
163 if (np != NULL) {
164 if (!of_address_to_resource(np, 0, &res)) {
165 if (!request_mem_region(res.start, 0x4, hcd_name)) {
166 writel_be((readl_be(&ohci->regs->control) |
167 OHCI_USB_SUSPEND), &ohci->regs->control);
168 (void) readl_be(&ohci->regs->control);
169 } else
170 release_mem_region(res.start, 0x4);
171 } else
172 pr_debug(__FILE__ ": cannot get ehci offset from fdt\n");
173 }
174
150 iounmap(hcd->regs); 175 iounmap(hcd->regs);
151err_ioremap: 176err_ioremap:
152 irq_dispose_mapping(irq); 177 irq_dispose_mapping(irq);
diff --git a/drivers/usb/host/ohci-tmio.c b/drivers/usb/host/ohci-tmio.c
index f9f134af0bd1..8dabe8e31d8c 100644
--- a/drivers/usb/host/ohci-tmio.c
+++ b/drivers/usb/host/ohci-tmio.c
@@ -201,7 +201,7 @@ static int __devinit ohci_hcd_tmio_drv_probe(struct platform_device *dev)
201 if (!cell) 201 if (!cell)
202 return -EINVAL; 202 return -EINVAL;
203 203
204 hcd = usb_create_hcd(&ohci_tmio_hc_driver, &dev->dev, dev->dev.bus_id); 204 hcd = usb_create_hcd(&ohci_tmio_hc_driver, &dev->dev, dev_name(&dev->dev));
205 if (!hcd) { 205 if (!hcd) {
206 ret = -ENOMEM; 206 ret = -ENOMEM;
207 goto err_usb_create_hcd; 207 goto err_usb_create_hcd;
diff --git a/drivers/usb/host/oxu210hp-hcd.c b/drivers/usb/host/oxu210hp-hcd.c
new file mode 100644
index 000000000000..75548f7c716b
--- /dev/null
+++ b/drivers/usb/host/oxu210hp-hcd.c
@@ -0,0 +1,3985 @@
1/*
2 * Copyright (c) 2008 Rodolfo Giometti <giometti@linux.it>
3 * Copyright (c) 2008 Eurotech S.p.A. <info@eurtech.it>
4 *
5 * This code is *strongly* based on EHCI-HCD code by David Brownell since
6 * the chip is a quasi-EHCI compatible.
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
15 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 * for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software Foundation,
20 * Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 */
22
23#include <linux/module.h>
24#include <linux/pci.h>
25#include <linux/dmapool.h>
26#include <linux/kernel.h>
27#include <linux/delay.h>
28#include <linux/ioport.h>
29#include <linux/sched.h>
30#include <linux/slab.h>
31#include <linux/errno.h>
32#include <linux/init.h>
33#include <linux/timer.h>
34#include <linux/list.h>
35#include <linux/interrupt.h>
36#include <linux/reboot.h>
37#include <linux/usb.h>
38#include <linux/moduleparam.h>
39#include <linux/dma-mapping.h>
40#include <linux/io.h>
41
42#include "../core/hcd.h"
43
44#include <asm/irq.h>
45#include <asm/system.h>
46#include <asm/unaligned.h>
47
48#include <linux/irq.h>
49#include <linux/platform_device.h>
50
51#include "oxu210hp.h"
52
53#define DRIVER_VERSION "0.0.50"
54
55/*
56 * Main defines
57 */
58
59#define oxu_dbg(oxu, fmt, args...) \
60 dev_dbg(oxu_to_hcd(oxu)->self.controller , fmt , ## args)
61#define oxu_err(oxu, fmt, args...) \
62 dev_err(oxu_to_hcd(oxu)->self.controller , fmt , ## args)
63#define oxu_info(oxu, fmt, args...) \
64 dev_info(oxu_to_hcd(oxu)->self.controller , fmt , ## args)
65
66static inline struct usb_hcd *oxu_to_hcd(struct oxu_hcd *oxu)
67{
68 return container_of((void *) oxu, struct usb_hcd, hcd_priv);
69}
70
71static inline struct oxu_hcd *hcd_to_oxu(struct usb_hcd *hcd)
72{
73 return (struct oxu_hcd *) (hcd->hcd_priv);
74}
75
76/*
77 * Debug stuff
78 */
79
80#undef OXU_URB_TRACE
81#undef OXU_VERBOSE_DEBUG
82
83#ifdef OXU_VERBOSE_DEBUG
84#define oxu_vdbg oxu_dbg
85#else
86#define oxu_vdbg(oxu, fmt, args...) /* Nop */
87#endif
88
89#ifdef DEBUG
90
91static int __attribute__((__unused__))
92dbg_status_buf(char *buf, unsigned len, const char *label, u32 status)
93{
94 return scnprintf(buf, len, "%s%sstatus %04x%s%s%s%s%s%s%s%s%s%s",
95 label, label[0] ? " " : "", status,
96 (status & STS_ASS) ? " Async" : "",
97 (status & STS_PSS) ? " Periodic" : "",
98 (status & STS_RECL) ? " Recl" : "",
99 (status & STS_HALT) ? " Halt" : "",
100 (status & STS_IAA) ? " IAA" : "",
101 (status & STS_FATAL) ? " FATAL" : "",
102 (status & STS_FLR) ? " FLR" : "",
103 (status & STS_PCD) ? " PCD" : "",
104 (status & STS_ERR) ? " ERR" : "",
105 (status & STS_INT) ? " INT" : ""
106 );
107}
108
109static int __attribute__((__unused__))
110dbg_intr_buf(char *buf, unsigned len, const char *label, u32 enable)
111{
112 return scnprintf(buf, len, "%s%sintrenable %02x%s%s%s%s%s%s",
113 label, label[0] ? " " : "", enable,
114 (enable & STS_IAA) ? " IAA" : "",
115 (enable & STS_FATAL) ? " FATAL" : "",
116 (enable & STS_FLR) ? " FLR" : "",
117 (enable & STS_PCD) ? " PCD" : "",
118 (enable & STS_ERR) ? " ERR" : "",
119 (enable & STS_INT) ? " INT" : ""
120 );
121}
122
123static const char *const fls_strings[] =
124 { "1024", "512", "256", "??" };
125
126static int dbg_command_buf(char *buf, unsigned len,
127 const char *label, u32 command)
128{
129 return scnprintf(buf, len,
130 "%s%scommand %06x %s=%d ithresh=%d%s%s%s%s period=%s%s %s",
131 label, label[0] ? " " : "", command,
132 (command & CMD_PARK) ? "park" : "(park)",
133 CMD_PARK_CNT(command),
134 (command >> 16) & 0x3f,
135 (command & CMD_LRESET) ? " LReset" : "",
136 (command & CMD_IAAD) ? " IAAD" : "",
137 (command & CMD_ASE) ? " Async" : "",
138 (command & CMD_PSE) ? " Periodic" : "",
139 fls_strings[(command >> 2) & 0x3],
140 (command & CMD_RESET) ? " Reset" : "",
141 (command & CMD_RUN) ? "RUN" : "HALT"
142 );
143}
144
145static int dbg_port_buf(char *buf, unsigned len, const char *label,
146 int port, u32 status)
147{
148 char *sig;
149
150 /* signaling state */
151 switch (status & (3 << 10)) {
152 case 0 << 10:
153 sig = "se0";
154 break;
155 case 1 << 10:
156 sig = "k"; /* low speed */
157 break;
158 case 2 << 10:
159 sig = "j";
160 break;
161 default:
162 sig = "?";
163 break;
164 }
165
166 return scnprintf(buf, len,
167 "%s%sport %d status %06x%s%s sig=%s%s%s%s%s%s%s%s%s%s",
168 label, label[0] ? " " : "", port, status,
169 (status & PORT_POWER) ? " POWER" : "",
170 (status & PORT_OWNER) ? " OWNER" : "",
171 sig,
172 (status & PORT_RESET) ? " RESET" : "",
173 (status & PORT_SUSPEND) ? " SUSPEND" : "",
174 (status & PORT_RESUME) ? " RESUME" : "",
175 (status & PORT_OCC) ? " OCC" : "",
176 (status & PORT_OC) ? " OC" : "",
177 (status & PORT_PEC) ? " PEC" : "",
178 (status & PORT_PE) ? " PE" : "",
179 (status & PORT_CSC) ? " CSC" : "",
180 (status & PORT_CONNECT) ? " CONNECT" : ""
181 );
182}
183
184#else
185
186static inline int __attribute__((__unused__))
187dbg_status_buf(char *buf, unsigned len, const char *label, u32 status)
188{ return 0; }
189
190static inline int __attribute__((__unused__))
191dbg_command_buf(char *buf, unsigned len, const char *label, u32 command)
192{ return 0; }
193
194static inline int __attribute__((__unused__))
195dbg_intr_buf(char *buf, unsigned len, const char *label, u32 enable)
196{ return 0; }
197
198static inline int __attribute__((__unused__))
199dbg_port_buf(char *buf, unsigned len, const char *label, int port, u32 status)
200{ return 0; }
201
202#endif /* DEBUG */
203
204/* functions have the "wrong" filename when they're output... */
205#define dbg_status(oxu, label, status) { \
206 char _buf[80]; \
207 dbg_status_buf(_buf, sizeof _buf, label, status); \
208 oxu_dbg(oxu, "%s\n", _buf); \
209}
210
211#define dbg_cmd(oxu, label, command) { \
212 char _buf[80]; \
213 dbg_command_buf(_buf, sizeof _buf, label, command); \
214 oxu_dbg(oxu, "%s\n", _buf); \
215}
216
217#define dbg_port(oxu, label, port, status) { \
218 char _buf[80]; \
219 dbg_port_buf(_buf, sizeof _buf, label, port, status); \
220 oxu_dbg(oxu, "%s\n", _buf); \
221}
222
223/*
224 * Module parameters
225 */
226
227/* Initial IRQ latency: faster than hw default */
228static int log2_irq_thresh; /* 0 to 6 */
229module_param(log2_irq_thresh, int, S_IRUGO);
230MODULE_PARM_DESC(log2_irq_thresh, "log2 IRQ latency, 1-64 microframes");
231
232/* Initial park setting: slower than hw default */
233static unsigned park;
234module_param(park, uint, S_IRUGO);
235MODULE_PARM_DESC(park, "park setting; 1-3 back-to-back async packets");
236
237/* For flakey hardware, ignore overcurrent indicators */
238static int ignore_oc;
239module_param(ignore_oc, bool, S_IRUGO);
240MODULE_PARM_DESC(ignore_oc, "ignore bogus hardware overcurrent indications");
241
242
243static void ehci_work(struct oxu_hcd *oxu);
244static int oxu_hub_control(struct usb_hcd *hcd,
245 u16 typeReq, u16 wValue, u16 wIndex,
246 char *buf, u16 wLength);
247
248/*
249 * Local functions
250 */
251
252/* Low level read/write registers functions */
253static inline u32 oxu_readl(void *base, u32 reg)
254{
255 return readl(base + reg);
256}
257
258static inline void oxu_writel(void *base, u32 reg, u32 val)
259{
260 writel(val, base + reg);
261}
262
263static inline void timer_action_done(struct oxu_hcd *oxu,
264 enum ehci_timer_action action)
265{
266 clear_bit(action, &oxu->actions);
267}
268
269static inline void timer_action(struct oxu_hcd *oxu,
270 enum ehci_timer_action action)
271{
272 if (!test_and_set_bit(action, &oxu->actions)) {
273 unsigned long t;
274
275 switch (action) {
276 case TIMER_IAA_WATCHDOG:
277 t = EHCI_IAA_JIFFIES;
278 break;
279 case TIMER_IO_WATCHDOG:
280 t = EHCI_IO_JIFFIES;
281 break;
282 case TIMER_ASYNC_OFF:
283 t = EHCI_ASYNC_JIFFIES;
284 break;
285 case TIMER_ASYNC_SHRINK:
286 default:
287 t = EHCI_SHRINK_JIFFIES;
288 break;
289 }
290 t += jiffies;
291 /* all timings except IAA watchdog can be overridden.
292 * async queue SHRINK often precedes IAA. while it's ready
293 * to go OFF neither can matter, and afterwards the IO
294 * watchdog stops unless there's still periodic traffic.
295 */
296 if (action != TIMER_IAA_WATCHDOG
297 && t > oxu->watchdog.expires
298 && timer_pending(&oxu->watchdog))
299 return;
300 mod_timer(&oxu->watchdog, t);
301 }
302}
303
304/*
305 * handshake - spin reading hc until handshake completes or fails
306 * @ptr: address of hc register to be read
307 * @mask: bits to look at in result of read
308 * @done: value of those bits when handshake succeeds
309 * @usec: timeout in microseconds
310 *
311 * Returns negative errno, or zero on success
312 *
313 * Success happens when the "mask" bits have the specified value (hardware
314 * handshake done). There are two failure modes: "usec" have passed (major
315 * hardware flakeout), or the register reads as all-ones (hardware removed).
316 *
317 * That last failure should_only happen in cases like physical cardbus eject
318 * before driver shutdown. But it also seems to be caused by bugs in cardbus
319 * bridge shutdown: shutting down the bridge before the devices using it.
320 */
321static int handshake(struct oxu_hcd *oxu, void __iomem *ptr,
322 u32 mask, u32 done, int usec)
323{
324 u32 result;
325
326 do {
327 result = readl(ptr);
328 if (result == ~(u32)0) /* card removed */
329 return -ENODEV;
330 result &= mask;
331 if (result == done)
332 return 0;
333 udelay(1);
334 usec--;
335 } while (usec > 0);
336 return -ETIMEDOUT;
337}
338
339/* Force HC to halt state from unknown (EHCI spec section 2.3) */
340static int ehci_halt(struct oxu_hcd *oxu)
341{
342 u32 temp = readl(&oxu->regs->status);
343
344 /* disable any irqs left enabled by previous code */
345 writel(0, &oxu->regs->intr_enable);
346
347 if ((temp & STS_HALT) != 0)
348 return 0;
349
350 temp = readl(&oxu->regs->command);
351 temp &= ~CMD_RUN;
352 writel(temp, &oxu->regs->command);
353 return handshake(oxu, &oxu->regs->status,
354 STS_HALT, STS_HALT, 16 * 125);
355}
356
357/* Put TDI/ARC silicon into EHCI mode */
358static void tdi_reset(struct oxu_hcd *oxu)
359{
360 u32 __iomem *reg_ptr;
361 u32 tmp;
362
363 reg_ptr = (u32 __iomem *)(((u8 __iomem *)oxu->regs) + 0x68);
364 tmp = readl(reg_ptr);
365 tmp |= 0x3;
366 writel(tmp, reg_ptr);
367}
368
369/* Reset a non-running (STS_HALT == 1) controller */
370static int ehci_reset(struct oxu_hcd *oxu)
371{
372 int retval;
373 u32 command = readl(&oxu->regs->command);
374
375 command |= CMD_RESET;
376 dbg_cmd(oxu, "reset", command);
377 writel(command, &oxu->regs->command);
378 oxu_to_hcd(oxu)->state = HC_STATE_HALT;
379 oxu->next_statechange = jiffies;
380 retval = handshake(oxu, &oxu->regs->command,
381 CMD_RESET, 0, 250 * 1000);
382
383 if (retval)
384 return retval;
385
386 tdi_reset(oxu);
387
388 return retval;
389}
390
391/* Idle the controller (from running) */
392static void ehci_quiesce(struct oxu_hcd *oxu)
393{
394 u32 temp;
395
396#ifdef DEBUG
397 if (!HC_IS_RUNNING(oxu_to_hcd(oxu)->state))
398 BUG();
399#endif
400
401 /* wait for any schedule enables/disables to take effect */
402 temp = readl(&oxu->regs->command) << 10;
403 temp &= STS_ASS | STS_PSS;
404 if (handshake(oxu, &oxu->regs->status, STS_ASS | STS_PSS,
405 temp, 16 * 125) != 0) {
406 oxu_to_hcd(oxu)->state = HC_STATE_HALT;
407 return;
408 }
409
410 /* then disable anything that's still active */
411 temp = readl(&oxu->regs->command);
412 temp &= ~(CMD_ASE | CMD_IAAD | CMD_PSE);
413 writel(temp, &oxu->regs->command);
414
415 /* hardware can take 16 microframes to turn off ... */
416 if (handshake(oxu, &oxu->regs->status, STS_ASS | STS_PSS,
417 0, 16 * 125) != 0) {
418 oxu_to_hcd(oxu)->state = HC_STATE_HALT;
419 return;
420 }
421}
422
423static int check_reset_complete(struct oxu_hcd *oxu, int index,
424 u32 __iomem *status_reg, int port_status)
425{
426 if (!(port_status & PORT_CONNECT)) {
427 oxu->reset_done[index] = 0;
428 return port_status;
429 }
430
431 /* if reset finished and it's still not enabled -- handoff */
432 if (!(port_status & PORT_PE)) {
433 oxu_dbg(oxu, "Failed to enable port %d on root hub TT\n",
434 index+1);
435 return port_status;
436 } else
437 oxu_dbg(oxu, "port %d high speed\n", index + 1);
438
439 return port_status;
440}
441
442static void ehci_hub_descriptor(struct oxu_hcd *oxu,
443 struct usb_hub_descriptor *desc)
444{
445 int ports = HCS_N_PORTS(oxu->hcs_params);
446 u16 temp;
447
448 desc->bDescriptorType = 0x29;
449 desc->bPwrOn2PwrGood = 10; /* oxu 1.0, 2.3.9 says 20ms max */
450 desc->bHubContrCurrent = 0;
451
452 desc->bNbrPorts = ports;
453 temp = 1 + (ports / 8);
454 desc->bDescLength = 7 + 2 * temp;
455
456 /* two bitmaps: ports removable, and usb 1.0 legacy PortPwrCtrlMask */
457 memset(&desc->bitmap[0], 0, temp);
458 memset(&desc->bitmap[temp], 0xff, temp);
459
460 temp = 0x0008; /* per-port overcurrent reporting */
461 if (HCS_PPC(oxu->hcs_params))
462 temp |= 0x0001; /* per-port power control */
463 else
464 temp |= 0x0002; /* no power switching */
465 desc->wHubCharacteristics = (__force __u16)cpu_to_le16(temp);
466}
467
468
469/* Allocate an OXU210HP on-chip memory data buffer
470 *
471 * An on-chip memory data buffer is required for each OXU210HP USB transfer.
472 * Each transfer descriptor has one or more on-chip memory data buffers.
473 *
474 * Data buffers are allocated from a fix sized pool of data blocks.
475 * To minimise fragmentation and give reasonable memory utlisation,
476 * data buffers are allocated with sizes the power of 2 multiples of
477 * the block size, starting on an address a multiple of the allocated size.
478 *
479 * FIXME: callers of this function require a buffer to be allocated for
480 * len=0. This is a waste of on-chip memory and should be fix. Then this
481 * function should be changed to not allocate a buffer for len=0.
482 */
483static int oxu_buf_alloc(struct oxu_hcd *oxu, struct ehci_qtd *qtd, int len)
484{
485 int n_blocks; /* minium blocks needed to hold len */
486 int a_blocks; /* blocks allocated */
487 int i, j;
488
489 /* Don't allocte bigger than supported */
490 if (len > BUFFER_SIZE * BUFFER_NUM) {
491 oxu_err(oxu, "buffer too big (%d)\n", len);
492 return -ENOMEM;
493 }
494
495 spin_lock(&oxu->mem_lock);
496
497 /* Number of blocks needed to hold len */
498 n_blocks = (len + BUFFER_SIZE - 1) / BUFFER_SIZE;
499
500 /* Round the number of blocks up to the power of 2 */
501 for (a_blocks = 1; a_blocks < n_blocks; a_blocks <<= 1)
502 ;
503
504 /* Find a suitable available data buffer */
505 for (i = 0; i < BUFFER_NUM;
506 i += max(a_blocks, (int)oxu->db_used[i])) {
507
508 /* Check all the required blocks are available */
509 for (j = 0; j < a_blocks; j++)
510 if (oxu->db_used[i + j])
511 break;
512
513 if (j != a_blocks)
514 continue;
515
516 /* Allocate blocks found! */
517 qtd->buffer = (void *) &oxu->mem->db_pool[i];
518 qtd->buffer_dma = virt_to_phys(qtd->buffer);
519
520 qtd->qtd_buffer_len = BUFFER_SIZE * a_blocks;
521 oxu->db_used[i] = a_blocks;
522
523 spin_unlock(&oxu->mem_lock);
524
525 return 0;
526 }
527
528 /* Failed */
529
530 spin_unlock(&oxu->mem_lock);
531
532 return -ENOMEM;
533}
534
535static void oxu_buf_free(struct oxu_hcd *oxu, struct ehci_qtd *qtd)
536{
537 int index;
538
539 spin_lock(&oxu->mem_lock);
540
541 index = (qtd->buffer - (void *) &oxu->mem->db_pool[0])
542 / BUFFER_SIZE;
543 oxu->db_used[index] = 0;
544 qtd->qtd_buffer_len = 0;
545 qtd->buffer_dma = 0;
546 qtd->buffer = NULL;
547
548 spin_unlock(&oxu->mem_lock);
549
550 return;
551}
552
553static inline void ehci_qtd_init(struct ehci_qtd *qtd, dma_addr_t dma)
554{
555 memset(qtd, 0, sizeof *qtd);
556 qtd->qtd_dma = dma;
557 qtd->hw_token = cpu_to_le32(QTD_STS_HALT);
558 qtd->hw_next = EHCI_LIST_END;
559 qtd->hw_alt_next = EHCI_LIST_END;
560 INIT_LIST_HEAD(&qtd->qtd_list);
561}
562
563static inline void oxu_qtd_free(struct oxu_hcd *oxu, struct ehci_qtd *qtd)
564{
565 int index;
566
567 if (qtd->buffer)
568 oxu_buf_free(oxu, qtd);
569
570 spin_lock(&oxu->mem_lock);
571
572 index = qtd - &oxu->mem->qtd_pool[0];
573 oxu->qtd_used[index] = 0;
574
575 spin_unlock(&oxu->mem_lock);
576
577 return;
578}
579
580static struct ehci_qtd *ehci_qtd_alloc(struct oxu_hcd *oxu)
581{
582 int i;
583 struct ehci_qtd *qtd = NULL;
584
585 spin_lock(&oxu->mem_lock);
586
587 for (i = 0; i < QTD_NUM; i++)
588 if (!oxu->qtd_used[i])
589 break;
590
591 if (i < QTD_NUM) {
592 qtd = (struct ehci_qtd *) &oxu->mem->qtd_pool[i];
593 memset(qtd, 0, sizeof *qtd);
594
595 qtd->hw_token = cpu_to_le32(QTD_STS_HALT);
596 qtd->hw_next = EHCI_LIST_END;
597 qtd->hw_alt_next = EHCI_LIST_END;
598 INIT_LIST_HEAD(&qtd->qtd_list);
599
600 qtd->qtd_dma = virt_to_phys(qtd);
601
602 oxu->qtd_used[i] = 1;
603 }
604
605 spin_unlock(&oxu->mem_lock);
606
607 return qtd;
608}
609
610static void oxu_qh_free(struct oxu_hcd *oxu, struct ehci_qh *qh)
611{
612 int index;
613
614 spin_lock(&oxu->mem_lock);
615
616 index = qh - &oxu->mem->qh_pool[0];
617 oxu->qh_used[index] = 0;
618
619 spin_unlock(&oxu->mem_lock);
620
621 return;
622}
623
624static void qh_destroy(struct kref *kref)
625{
626 struct ehci_qh *qh = container_of(kref, struct ehci_qh, kref);
627 struct oxu_hcd *oxu = qh->oxu;
628
629 /* clean qtds first, and know this is not linked */
630 if (!list_empty(&qh->qtd_list) || qh->qh_next.ptr) {
631 oxu_dbg(oxu, "unused qh not empty!\n");
632 BUG();
633 }
634 if (qh->dummy)
635 oxu_qtd_free(oxu, qh->dummy);
636 oxu_qh_free(oxu, qh);
637}
638
639static struct ehci_qh *oxu_qh_alloc(struct oxu_hcd *oxu)
640{
641 int i;
642 struct ehci_qh *qh = NULL;
643
644 spin_lock(&oxu->mem_lock);
645
646 for (i = 0; i < QHEAD_NUM; i++)
647 if (!oxu->qh_used[i])
648 break;
649
650 if (i < QHEAD_NUM) {
651 qh = (struct ehci_qh *) &oxu->mem->qh_pool[i];
652 memset(qh, 0, sizeof *qh);
653
654 kref_init(&qh->kref);
655 qh->oxu = oxu;
656 qh->qh_dma = virt_to_phys(qh);
657 INIT_LIST_HEAD(&qh->qtd_list);
658
659 /* dummy td enables safe urb queuing */
660 qh->dummy = ehci_qtd_alloc(oxu);
661 if (qh->dummy == NULL) {
662 oxu_dbg(oxu, "no dummy td\n");
663 oxu->qh_used[i] = 0;
664
665 return NULL;
666 }
667
668 oxu->qh_used[i] = 1;
669 }
670
671 spin_unlock(&oxu->mem_lock);
672
673 return qh;
674}
675
676/* to share a qh (cpu threads, or hc) */
677static inline struct ehci_qh *qh_get(struct ehci_qh *qh)
678{
679 kref_get(&qh->kref);
680 return qh;
681}
682
683static inline void qh_put(struct ehci_qh *qh)
684{
685 kref_put(&qh->kref, qh_destroy);
686}
687
688static void oxu_murb_free(struct oxu_hcd *oxu, struct oxu_murb *murb)
689{
690 int index;
691
692 spin_lock(&oxu->mem_lock);
693
694 index = murb - &oxu->murb_pool[0];
695 oxu->murb_used[index] = 0;
696
697 spin_unlock(&oxu->mem_lock);
698
699 return;
700}
701
702static struct oxu_murb *oxu_murb_alloc(struct oxu_hcd *oxu)
703
704{
705 int i;
706 struct oxu_murb *murb = NULL;
707
708 spin_lock(&oxu->mem_lock);
709
710 for (i = 0; i < MURB_NUM; i++)
711 if (!oxu->murb_used[i])
712 break;
713
714 if (i < MURB_NUM) {
715 murb = &(oxu->murb_pool)[i];
716
717 oxu->murb_used[i] = 1;
718 }
719
720 spin_unlock(&oxu->mem_lock);
721
722 return murb;
723}
724
725/* The queue heads and transfer descriptors are managed from pools tied
726 * to each of the "per device" structures.
727 * This is the initialisation and cleanup code.
728 */
729static void ehci_mem_cleanup(struct oxu_hcd *oxu)
730{
731 kfree(oxu->murb_pool);
732 oxu->murb_pool = NULL;
733
734 if (oxu->async)
735 qh_put(oxu->async);
736 oxu->async = NULL;
737
738 del_timer(&oxu->urb_timer);
739
740 oxu->periodic = NULL;
741
742 /* shadow periodic table */
743 kfree(oxu->pshadow);
744 oxu->pshadow = NULL;
745}
746
747/* Remember to add cleanup code (above) if you add anything here.
748 */
749static int ehci_mem_init(struct oxu_hcd *oxu, gfp_t flags)
750{
751 int i;
752
753 for (i = 0; i < oxu->periodic_size; i++)
754 oxu->mem->frame_list[i] = EHCI_LIST_END;
755 for (i = 0; i < QHEAD_NUM; i++)
756 oxu->qh_used[i] = 0;
757 for (i = 0; i < QTD_NUM; i++)
758 oxu->qtd_used[i] = 0;
759
760 oxu->murb_pool = kcalloc(MURB_NUM, sizeof(struct oxu_murb), flags);
761 if (!oxu->murb_pool)
762 goto fail;
763
764 for (i = 0; i < MURB_NUM; i++)
765 oxu->murb_used[i] = 0;
766
767 oxu->async = oxu_qh_alloc(oxu);
768 if (!oxu->async)
769 goto fail;
770
771 oxu->periodic = (__le32 *) &oxu->mem->frame_list;
772 oxu->periodic_dma = virt_to_phys(oxu->periodic);
773
774 for (i = 0; i < oxu->periodic_size; i++)
775 oxu->periodic[i] = EHCI_LIST_END;
776
777 /* software shadow of hardware table */
778 oxu->pshadow = kcalloc(oxu->periodic_size, sizeof(void *), flags);
779 if (oxu->pshadow != NULL)
780 return 0;
781
782fail:
783 oxu_dbg(oxu, "couldn't init memory\n");
784 ehci_mem_cleanup(oxu);
785 return -ENOMEM;
786}
787
788/* Fill a qtd, returning how much of the buffer we were able to queue up.
789 */
790static int qtd_fill(struct ehci_qtd *qtd, dma_addr_t buf, size_t len,
791 int token, int maxpacket)
792{
793 int i, count;
794 u64 addr = buf;
795
796 /* one buffer entry per 4K ... first might be short or unaligned */
797 qtd->hw_buf[0] = cpu_to_le32((u32)addr);
798 qtd->hw_buf_hi[0] = cpu_to_le32((u32)(addr >> 32));
799 count = 0x1000 - (buf & 0x0fff); /* rest of that page */
800 if (likely(len < count)) /* ... iff needed */
801 count = len;
802 else {
803 buf += 0x1000;
804 buf &= ~0x0fff;
805
806 /* per-qtd limit: from 16K to 20K (best alignment) */
807 for (i = 1; count < len && i < 5; i++) {
808 addr = buf;
809 qtd->hw_buf[i] = cpu_to_le32((u32)addr);
810 qtd->hw_buf_hi[i] = cpu_to_le32((u32)(addr >> 32));
811 buf += 0x1000;
812 if ((count + 0x1000) < len)
813 count += 0x1000;
814 else
815 count = len;
816 }
817
818 /* short packets may only terminate transfers */
819 if (count != len)
820 count -= (count % maxpacket);
821 }
822 qtd->hw_token = cpu_to_le32((count << 16) | token);
823 qtd->length = count;
824
825 return count;
826}
827
828static inline void qh_update(struct oxu_hcd *oxu,
829 struct ehci_qh *qh, struct ehci_qtd *qtd)
830{
831 /* writes to an active overlay are unsafe */
832 BUG_ON(qh->qh_state != QH_STATE_IDLE);
833
834 qh->hw_qtd_next = QTD_NEXT(qtd->qtd_dma);
835 qh->hw_alt_next = EHCI_LIST_END;
836
837 /* Except for control endpoints, we make hardware maintain data
838 * toggle (like OHCI) ... here (re)initialize the toggle in the QH,
839 * and set the pseudo-toggle in udev. Only usb_clear_halt() will
840 * ever clear it.
841 */
842 if (!(qh->hw_info1 & cpu_to_le32(1 << 14))) {
843 unsigned is_out, epnum;
844
845 is_out = !(qtd->hw_token & cpu_to_le32(1 << 8));
846 epnum = (le32_to_cpup(&qh->hw_info1) >> 8) & 0x0f;
847 if (unlikely(!usb_gettoggle(qh->dev, epnum, is_out))) {
848 qh->hw_token &= ~__constant_cpu_to_le32(QTD_TOGGLE);
849 usb_settoggle(qh->dev, epnum, is_out, 1);
850 }
851 }
852
853 /* HC must see latest qtd and qh data before we clear ACTIVE+HALT */
854 wmb();
855 qh->hw_token &= __constant_cpu_to_le32(QTD_TOGGLE | QTD_STS_PING);
856}
857
858/* If it weren't for a common silicon quirk (writing the dummy into the qh
859 * overlay, so qh->hw_token wrongly becomes inactive/halted), only fault
860 * recovery (including urb dequeue) would need software changes to a QH...
861 */
862static void qh_refresh(struct oxu_hcd *oxu, struct ehci_qh *qh)
863{
864 struct ehci_qtd *qtd;
865
866 if (list_empty(&qh->qtd_list))
867 qtd = qh->dummy;
868 else {
869 qtd = list_entry(qh->qtd_list.next,
870 struct ehci_qtd, qtd_list);
871 /* first qtd may already be partially processed */
872 if (cpu_to_le32(qtd->qtd_dma) == qh->hw_current)
873 qtd = NULL;
874 }
875
876 if (qtd)
877 qh_update(oxu, qh, qtd);
878}
879
880static void qtd_copy_status(struct oxu_hcd *oxu, struct urb *urb,
881 size_t length, u32 token)
882{
883 /* count IN/OUT bytes, not SETUP (even short packets) */
884 if (likely(QTD_PID(token) != 2))
885 urb->actual_length += length - QTD_LENGTH(token);
886
887 /* don't modify error codes */
888 if (unlikely(urb->status != -EINPROGRESS))
889 return;
890
891 /* force cleanup after short read; not always an error */
892 if (unlikely(IS_SHORT_READ(token)))
893 urb->status = -EREMOTEIO;
894
895 /* serious "can't proceed" faults reported by the hardware */
896 if (token & QTD_STS_HALT) {
897 if (token & QTD_STS_BABBLE) {
898 /* FIXME "must" disable babbling device's port too */
899 urb->status = -EOVERFLOW;
900 } else if (token & QTD_STS_MMF) {
901 /* fs/ls interrupt xfer missed the complete-split */
902 urb->status = -EPROTO;
903 } else if (token & QTD_STS_DBE) {
904 urb->status = (QTD_PID(token) == 1) /* IN ? */
905 ? -ENOSR /* hc couldn't read data */
906 : -ECOMM; /* hc couldn't write data */
907 } else if (token & QTD_STS_XACT) {
908 /* timeout, bad crc, wrong PID, etc; retried */
909 if (QTD_CERR(token))
910 urb->status = -EPIPE;
911 else {
912 oxu_dbg(oxu, "devpath %s ep%d%s 3strikes\n",
913 urb->dev->devpath,
914 usb_pipeendpoint(urb->pipe),
915 usb_pipein(urb->pipe) ? "in" : "out");
916 urb->status = -EPROTO;
917 }
918 /* CERR nonzero + no errors + halt --> stall */
919 } else if (QTD_CERR(token))
920 urb->status = -EPIPE;
921 else /* unknown */
922 urb->status = -EPROTO;
923
924 oxu_vdbg(oxu, "dev%d ep%d%s qtd token %08x --> status %d\n",
925 usb_pipedevice(urb->pipe),
926 usb_pipeendpoint(urb->pipe),
927 usb_pipein(urb->pipe) ? "in" : "out",
928 token, urb->status);
929 }
930}
931
932static void ehci_urb_done(struct oxu_hcd *oxu, struct urb *urb)
933__releases(oxu->lock)
934__acquires(oxu->lock)
935{
936 if (likely(urb->hcpriv != NULL)) {
937 struct ehci_qh *qh = (struct ehci_qh *) urb->hcpriv;
938
939 /* S-mask in a QH means it's an interrupt urb */
940 if ((qh->hw_info2 & __constant_cpu_to_le32(QH_SMASK)) != 0) {
941
942 /* ... update hc-wide periodic stats (for usbfs) */
943 oxu_to_hcd(oxu)->self.bandwidth_int_reqs--;
944 }
945 qh_put(qh);
946 }
947
948 urb->hcpriv = NULL;
949 switch (urb->status) {
950 case -EINPROGRESS: /* success */
951 urb->status = 0;
952 default: /* fault */
953 break;
954 case -EREMOTEIO: /* fault or normal */
955 if (!(urb->transfer_flags & URB_SHORT_NOT_OK))
956 urb->status = 0;
957 break;
958 case -ECONNRESET: /* canceled */
959 case -ENOENT:
960 break;
961 }
962
963#ifdef OXU_URB_TRACE
964 oxu_dbg(oxu, "%s %s urb %p ep%d%s status %d len %d/%d\n",
965 __func__, urb->dev->devpath, urb,
966 usb_pipeendpoint(urb->pipe),
967 usb_pipein(urb->pipe) ? "in" : "out",
968 urb->status,
969 urb->actual_length, urb->transfer_buffer_length);
970#endif
971
972 /* complete() can reenter this HCD */
973 spin_unlock(&oxu->lock);
974 usb_hcd_giveback_urb(oxu_to_hcd(oxu), urb, urb->status);
975 spin_lock(&oxu->lock);
976}
977
978static void start_unlink_async(struct oxu_hcd *oxu, struct ehci_qh *qh);
979static void unlink_async(struct oxu_hcd *oxu, struct ehci_qh *qh);
980
981static void intr_deschedule(struct oxu_hcd *oxu, struct ehci_qh *qh);
982static int qh_schedule(struct oxu_hcd *oxu, struct ehci_qh *qh);
983
984#define HALT_BIT __constant_cpu_to_le32(QTD_STS_HALT)
985
986/* Process and free completed qtds for a qh, returning URBs to drivers.
987 * Chases up to qh->hw_current. Returns number of completions called,
988 * indicating how much "real" work we did.
989 */
990static unsigned qh_completions(struct oxu_hcd *oxu, struct ehci_qh *qh)
991{
992 struct ehci_qtd *last = NULL, *end = qh->dummy;
993 struct list_head *entry, *tmp;
994 int stopped;
995 unsigned count = 0;
996 int do_status = 0;
997 u8 state;
998 struct oxu_murb *murb = NULL;
999
1000 if (unlikely(list_empty(&qh->qtd_list)))
1001 return count;
1002
1003 /* completions (or tasks on other cpus) must never clobber HALT
1004 * till we've gone through and cleaned everything up, even when
1005 * they add urbs to this qh's queue or mark them for unlinking.
1006 *
1007 * NOTE: unlinking expects to be done in queue order.
1008 */
1009 state = qh->qh_state;
1010 qh->qh_state = QH_STATE_COMPLETING;
1011 stopped = (state == QH_STATE_IDLE);
1012
1013 /* remove de-activated QTDs from front of queue.
1014 * after faults (including short reads), cleanup this urb
1015 * then let the queue advance.
1016 * if queue is stopped, handles unlinks.
1017 */
1018 list_for_each_safe(entry, tmp, &qh->qtd_list) {
1019 struct ehci_qtd *qtd;
1020 struct urb *urb;
1021 u32 token = 0;
1022
1023 qtd = list_entry(entry, struct ehci_qtd, qtd_list);
1024 urb = qtd->urb;
1025
1026 /* Clean up any state from previous QTD ...*/
1027 if (last) {
1028 if (likely(last->urb != urb)) {
1029 if (last->urb->complete == NULL) {
1030 murb = (struct oxu_murb *) last->urb;
1031 last->urb = murb->main;
1032 if (murb->last) {
1033 ehci_urb_done(oxu, last->urb);
1034 count++;
1035 }
1036 oxu_murb_free(oxu, murb);
1037 } else {
1038 ehci_urb_done(oxu, last->urb);
1039 count++;
1040 }
1041 }
1042 oxu_qtd_free(oxu, last);
1043 last = NULL;
1044 }
1045
1046 /* ignore urbs submitted during completions we reported */
1047 if (qtd == end)
1048 break;
1049
1050 /* hardware copies qtd out of qh overlay */
1051 rmb();
1052 token = le32_to_cpu(qtd->hw_token);
1053
1054 /* always clean up qtds the hc de-activated */
1055 if ((token & QTD_STS_ACTIVE) == 0) {
1056
1057 if ((token & QTD_STS_HALT) != 0) {
1058 stopped = 1;
1059
1060 /* magic dummy for some short reads; qh won't advance.
1061 * that silicon quirk can kick in with this dummy too.
1062 */
1063 } else if (IS_SHORT_READ(token) &&
1064 !(qtd->hw_alt_next & EHCI_LIST_END)) {
1065 stopped = 1;
1066 goto halt;
1067 }
1068
1069 /* stop scanning when we reach qtds the hc is using */
1070 } else if (likely(!stopped &&
1071 HC_IS_RUNNING(oxu_to_hcd(oxu)->state))) {
1072 break;
1073
1074 } else {
1075 stopped = 1;
1076
1077 if (unlikely(!HC_IS_RUNNING(oxu_to_hcd(oxu)->state)))
1078 urb->status = -ESHUTDOWN;
1079
1080 /* ignore active urbs unless some previous qtd
1081 * for the urb faulted (including short read) or
1082 * its urb was canceled. we may patch qh or qtds.
1083 */
1084 if (likely(urb->status == -EINPROGRESS))
1085 continue;
1086
1087 /* issue status after short control reads */
1088 if (unlikely(do_status != 0)
1089 && QTD_PID(token) == 0 /* OUT */) {
1090 do_status = 0;
1091 continue;
1092 }
1093
1094 /* token in overlay may be most current */
1095 if (state == QH_STATE_IDLE
1096 && cpu_to_le32(qtd->qtd_dma)
1097 == qh->hw_current)
1098 token = le32_to_cpu(qh->hw_token);
1099
1100 /* force halt for unlinked or blocked qh, so we'll
1101 * patch the qh later and so that completions can't
1102 * activate it while we "know" it's stopped.
1103 */
1104 if ((HALT_BIT & qh->hw_token) == 0) {
1105halt:
1106 qh->hw_token |= HALT_BIT;
1107 wmb();
1108 }
1109 }
1110
1111 /* Remove it from the queue */
1112 qtd_copy_status(oxu, urb->complete ?
1113 urb : ((struct oxu_murb *) urb)->main,
1114 qtd->length, token);
1115 if ((usb_pipein(qtd->urb->pipe)) &&
1116 (NULL != qtd->transfer_buffer))
1117 memcpy(qtd->transfer_buffer, qtd->buffer, qtd->length);
1118 do_status = (urb->status == -EREMOTEIO)
1119 && usb_pipecontrol(urb->pipe);
1120
1121 if (stopped && qtd->qtd_list.prev != &qh->qtd_list) {
1122 last = list_entry(qtd->qtd_list.prev,
1123 struct ehci_qtd, qtd_list);
1124 last->hw_next = qtd->hw_next;
1125 }
1126 list_del(&qtd->qtd_list);
1127 last = qtd;
1128 }
1129
1130 /* last urb's completion might still need calling */
1131 if (likely(last != NULL)) {
1132 if (last->urb->complete == NULL) {
1133 murb = (struct oxu_murb *) last->urb;
1134 last->urb = murb->main;
1135 if (murb->last) {
1136 ehci_urb_done(oxu, last->urb);
1137 count++;
1138 }
1139 oxu_murb_free(oxu, murb);
1140 } else {
1141 ehci_urb_done(oxu, last->urb);
1142 count++;
1143 }
1144 oxu_qtd_free(oxu, last);
1145 }
1146
1147 /* restore original state; caller must unlink or relink */
1148 qh->qh_state = state;
1149
1150 /* be sure the hardware's done with the qh before refreshing
1151 * it after fault cleanup, or recovering from silicon wrongly
1152 * overlaying the dummy qtd (which reduces DMA chatter).
1153 */
1154 if (stopped != 0 || qh->hw_qtd_next == EHCI_LIST_END) {
1155 switch (state) {
1156 case QH_STATE_IDLE:
1157 qh_refresh(oxu, qh);
1158 break;
1159 case QH_STATE_LINKED:
1160 /* should be rare for periodic transfers,
1161 * except maybe high bandwidth ...
1162 */
1163 if ((__constant_cpu_to_le32(QH_SMASK)
1164 & qh->hw_info2) != 0) {
1165 intr_deschedule(oxu, qh);
1166 (void) qh_schedule(oxu, qh);
1167 } else
1168 unlink_async(oxu, qh);
1169 break;
1170 /* otherwise, unlink already started */
1171 }
1172 }
1173
1174 return count;
1175}
1176
1177/* High bandwidth multiplier, as encoded in highspeed endpoint descriptors */
1178#define hb_mult(wMaxPacketSize) (1 + (((wMaxPacketSize) >> 11) & 0x03))
1179/* ... and packet size, for any kind of endpoint descriptor */
1180#define max_packet(wMaxPacketSize) ((wMaxPacketSize) & 0x07ff)
1181
1182/* Reverse of qh_urb_transaction: free a list of TDs.
1183 * used for cleanup after errors, before HC sees an URB's TDs.
1184 */
1185static void qtd_list_free(struct oxu_hcd *oxu,
1186 struct urb *urb, struct list_head *qtd_list)
1187{
1188 struct list_head *entry, *temp;
1189
1190 list_for_each_safe(entry, temp, qtd_list) {
1191 struct ehci_qtd *qtd;
1192
1193 qtd = list_entry(entry, struct ehci_qtd, qtd_list);
1194 list_del(&qtd->qtd_list);
1195 oxu_qtd_free(oxu, qtd);
1196 }
1197}
1198
1199/* Create a list of filled qtds for this URB; won't link into qh.
1200 */
1201static struct list_head *qh_urb_transaction(struct oxu_hcd *oxu,
1202 struct urb *urb,
1203 struct list_head *head,
1204 gfp_t flags)
1205{
1206 struct ehci_qtd *qtd, *qtd_prev;
1207 dma_addr_t buf;
1208 int len, maxpacket;
1209 int is_input;
1210 u32 token;
1211 void *transfer_buf = NULL;
1212 int ret;
1213
1214 /*
1215 * URBs map to sequences of QTDs: one logical transaction
1216 */
1217 qtd = ehci_qtd_alloc(oxu);
1218 if (unlikely(!qtd))
1219 return NULL;
1220 list_add_tail(&qtd->qtd_list, head);
1221 qtd->urb = urb;
1222
1223 token = QTD_STS_ACTIVE;
1224 token |= (EHCI_TUNE_CERR << 10);
1225 /* for split transactions, SplitXState initialized to zero */
1226
1227 len = urb->transfer_buffer_length;
1228 is_input = usb_pipein(urb->pipe);
1229 if (!urb->transfer_buffer && urb->transfer_buffer_length && is_input)
1230 urb->transfer_buffer = phys_to_virt(urb->transfer_dma);
1231
1232 if (usb_pipecontrol(urb->pipe)) {
1233 /* SETUP pid */
1234 ret = oxu_buf_alloc(oxu, qtd, sizeof(struct usb_ctrlrequest));
1235 if (ret)
1236 goto cleanup;
1237
1238 qtd_fill(qtd, qtd->buffer_dma, sizeof(struct usb_ctrlrequest),
1239 token | (2 /* "setup" */ << 8), 8);
1240 memcpy(qtd->buffer, qtd->urb->setup_packet,
1241 sizeof(struct usb_ctrlrequest));
1242
1243 /* ... and always at least one more pid */
1244 token ^= QTD_TOGGLE;
1245 qtd_prev = qtd;
1246 qtd = ehci_qtd_alloc(oxu);
1247 if (unlikely(!qtd))
1248 goto cleanup;
1249 qtd->urb = urb;
1250 qtd_prev->hw_next = QTD_NEXT(qtd->qtd_dma);
1251 list_add_tail(&qtd->qtd_list, head);
1252
1253 /* for zero length DATA stages, STATUS is always IN */
1254 if (len == 0)
1255 token |= (1 /* "in" */ << 8);
1256 }
1257
1258 /*
1259 * Data transfer stage: buffer setup
1260 */
1261
1262 ret = oxu_buf_alloc(oxu, qtd, len);
1263 if (ret)
1264 goto cleanup;
1265
1266 buf = qtd->buffer_dma;
1267 transfer_buf = urb->transfer_buffer;
1268
1269 if (!is_input)
1270 memcpy(qtd->buffer, qtd->urb->transfer_buffer, len);
1271
1272 if (is_input)
1273 token |= (1 /* "in" */ << 8);
1274 /* else it's already initted to "out" pid (0 << 8) */
1275
1276 maxpacket = max_packet(usb_maxpacket(urb->dev, urb->pipe, !is_input));
1277
1278 /*
1279 * buffer gets wrapped in one or more qtds;
1280 * last one may be "short" (including zero len)
1281 * and may serve as a control status ack
1282 */
1283 for (;;) {
1284 int this_qtd_len;
1285
1286 this_qtd_len = qtd_fill(qtd, buf, len, token, maxpacket);
1287 qtd->transfer_buffer = transfer_buf;
1288 len -= this_qtd_len;
1289 buf += this_qtd_len;
1290 transfer_buf += this_qtd_len;
1291 if (is_input)
1292 qtd->hw_alt_next = oxu->async->hw_alt_next;
1293
1294 /* qh makes control packets use qtd toggle; maybe switch it */
1295 if ((maxpacket & (this_qtd_len + (maxpacket - 1))) == 0)
1296 token ^= QTD_TOGGLE;
1297
1298 if (likely(len <= 0))
1299 break;
1300
1301 qtd_prev = qtd;
1302 qtd = ehci_qtd_alloc(oxu);
1303 if (unlikely(!qtd))
1304 goto cleanup;
1305 if (likely(len > 0)) {
1306 ret = oxu_buf_alloc(oxu, qtd, len);
1307 if (ret)
1308 goto cleanup;
1309 }
1310 qtd->urb = urb;
1311 qtd_prev->hw_next = QTD_NEXT(qtd->qtd_dma);
1312 list_add_tail(&qtd->qtd_list, head);
1313 }
1314
1315 /* unless the bulk/interrupt caller wants a chance to clean
1316 * up after short reads, hc should advance qh past this urb
1317 */
1318 if (likely((urb->transfer_flags & URB_SHORT_NOT_OK) == 0
1319 || usb_pipecontrol(urb->pipe)))
1320 qtd->hw_alt_next = EHCI_LIST_END;
1321
1322 /*
1323 * control requests may need a terminating data "status" ack;
1324 * bulk ones may need a terminating short packet (zero length).
1325 */
1326 if (likely(urb->transfer_buffer_length != 0)) {
1327 int one_more = 0;
1328
1329 if (usb_pipecontrol(urb->pipe)) {
1330 one_more = 1;
1331 token ^= 0x0100; /* "in" <--> "out" */
1332 token |= QTD_TOGGLE; /* force DATA1 */
1333 } else if (usb_pipebulk(urb->pipe)
1334 && (urb->transfer_flags & URB_ZERO_PACKET)
1335 && !(urb->transfer_buffer_length % maxpacket)) {
1336 one_more = 1;
1337 }
1338 if (one_more) {
1339 qtd_prev = qtd;
1340 qtd = ehci_qtd_alloc(oxu);
1341 if (unlikely(!qtd))
1342 goto cleanup;
1343 qtd->urb = urb;
1344 qtd_prev->hw_next = QTD_NEXT(qtd->qtd_dma);
1345 list_add_tail(&qtd->qtd_list, head);
1346
1347 /* never any data in such packets */
1348 qtd_fill(qtd, 0, 0, token, 0);
1349 }
1350 }
1351
1352 /* by default, enable interrupt on urb completion */
1353 qtd->hw_token |= __constant_cpu_to_le32(QTD_IOC);
1354 return head;
1355
1356cleanup:
1357 qtd_list_free(oxu, urb, head);
1358 return NULL;
1359}
1360
1361/* Each QH holds a qtd list; a QH is used for everything except iso.
1362 *
1363 * For interrupt urbs, the scheduler must set the microframe scheduling
1364 * mask(s) each time the QH gets scheduled. For highspeed, that's
1365 * just one microframe in the s-mask. For split interrupt transactions
1366 * there are additional complications: c-mask, maybe FSTNs.
1367 */
1368static struct ehci_qh *qh_make(struct oxu_hcd *oxu,
1369 struct urb *urb, gfp_t flags)
1370{
1371 struct ehci_qh *qh = oxu_qh_alloc(oxu);
1372 u32 info1 = 0, info2 = 0;
1373 int is_input, type;
1374 int maxp = 0;
1375
1376 if (!qh)
1377 return qh;
1378
1379 /*
1380 * init endpoint/device data for this QH
1381 */
1382 info1 |= usb_pipeendpoint(urb->pipe) << 8;
1383 info1 |= usb_pipedevice(urb->pipe) << 0;
1384
1385 is_input = usb_pipein(urb->pipe);
1386 type = usb_pipetype(urb->pipe);
1387 maxp = usb_maxpacket(urb->dev, urb->pipe, !is_input);
1388
1389 /* Compute interrupt scheduling parameters just once, and save.
1390 * - allowing for high bandwidth, how many nsec/uframe are used?
1391 * - split transactions need a second CSPLIT uframe; same question
1392 * - splits also need a schedule gap (for full/low speed I/O)
1393 * - qh has a polling interval
1394 *
1395 * For control/bulk requests, the HC or TT handles these.
1396 */
1397 if (type == PIPE_INTERRUPT) {
1398 qh->usecs = NS_TO_US(usb_calc_bus_time(USB_SPEED_HIGH,
1399 is_input, 0,
1400 hb_mult(maxp) * max_packet(maxp)));
1401 qh->start = NO_FRAME;
1402
1403 if (urb->dev->speed == USB_SPEED_HIGH) {
1404 qh->c_usecs = 0;
1405 qh->gap_uf = 0;
1406
1407 qh->period = urb->interval >> 3;
1408 if (qh->period == 0 && urb->interval != 1) {
1409 /* NOTE interval 2 or 4 uframes could work.
1410 * But interval 1 scheduling is simpler, and
1411 * includes high bandwidth.
1412 */
1413 dbg("intr period %d uframes, NYET!",
1414 urb->interval);
1415 goto done;
1416 }
1417 } else {
1418 struct usb_tt *tt = urb->dev->tt;
1419 int think_time;
1420
1421 /* gap is f(FS/LS transfer times) */
1422 qh->gap_uf = 1 + usb_calc_bus_time(urb->dev->speed,
1423 is_input, 0, maxp) / (125 * 1000);
1424
1425 /* FIXME this just approximates SPLIT/CSPLIT times */
1426 if (is_input) { /* SPLIT, gap, CSPLIT+DATA */
1427 qh->c_usecs = qh->usecs + HS_USECS(0);
1428 qh->usecs = HS_USECS(1);
1429 } else { /* SPLIT+DATA, gap, CSPLIT */
1430 qh->usecs += HS_USECS(1);
1431 qh->c_usecs = HS_USECS(0);
1432 }
1433
1434 think_time = tt ? tt->think_time : 0;
1435 qh->tt_usecs = NS_TO_US(think_time +
1436 usb_calc_bus_time(urb->dev->speed,
1437 is_input, 0, max_packet(maxp)));
1438 qh->period = urb->interval;
1439 }
1440 }
1441
1442 /* support for tt scheduling, and access to toggles */
1443 qh->dev = urb->dev;
1444
1445 /* using TT? */
1446 switch (urb->dev->speed) {
1447 case USB_SPEED_LOW:
1448 info1 |= (1 << 12); /* EPS "low" */
1449 /* FALL THROUGH */
1450
1451 case USB_SPEED_FULL:
1452 /* EPS 0 means "full" */
1453 if (type != PIPE_INTERRUPT)
1454 info1 |= (EHCI_TUNE_RL_TT << 28);
1455 if (type == PIPE_CONTROL) {
1456 info1 |= (1 << 27); /* for TT */
1457 info1 |= 1 << 14; /* toggle from qtd */
1458 }
1459 info1 |= maxp << 16;
1460
1461 info2 |= (EHCI_TUNE_MULT_TT << 30);
1462 info2 |= urb->dev->ttport << 23;
1463
1464 /* NOTE: if (PIPE_INTERRUPT) { scheduler sets c-mask } */
1465
1466 break;
1467
1468 case USB_SPEED_HIGH: /* no TT involved */
1469 info1 |= (2 << 12); /* EPS "high" */
1470 if (type == PIPE_CONTROL) {
1471 info1 |= (EHCI_TUNE_RL_HS << 28);
1472 info1 |= 64 << 16; /* usb2 fixed maxpacket */
1473 info1 |= 1 << 14; /* toggle from qtd */
1474 info2 |= (EHCI_TUNE_MULT_HS << 30);
1475 } else if (type == PIPE_BULK) {
1476 info1 |= (EHCI_TUNE_RL_HS << 28);
1477 info1 |= 512 << 16; /* usb2 fixed maxpacket */
1478 info2 |= (EHCI_TUNE_MULT_HS << 30);
1479 } else { /* PIPE_INTERRUPT */
1480 info1 |= max_packet(maxp) << 16;
1481 info2 |= hb_mult(maxp) << 30;
1482 }
1483 break;
1484 default:
1485 dbg("bogus dev %p speed %d", urb->dev, urb->dev->speed);
1486done:
1487 qh_put(qh);
1488 return NULL;
1489 }
1490
1491 /* NOTE: if (PIPE_INTERRUPT) { scheduler sets s-mask } */
1492
1493 /* init as live, toggle clear, advance to dummy */
1494 qh->qh_state = QH_STATE_IDLE;
1495 qh->hw_info1 = cpu_to_le32(info1);
1496 qh->hw_info2 = cpu_to_le32(info2);
1497 usb_settoggle(urb->dev, usb_pipeendpoint(urb->pipe), !is_input, 1);
1498 qh_refresh(oxu, qh);
1499 return qh;
1500}
1501
1502/* Move qh (and its qtds) onto async queue; maybe enable queue.
1503 */
1504static void qh_link_async(struct oxu_hcd *oxu, struct ehci_qh *qh)
1505{
1506 __le32 dma = QH_NEXT(qh->qh_dma);
1507 struct ehci_qh *head;
1508
1509 /* (re)start the async schedule? */
1510 head = oxu->async;
1511 timer_action_done(oxu, TIMER_ASYNC_OFF);
1512 if (!head->qh_next.qh) {
1513 u32 cmd = readl(&oxu->regs->command);
1514
1515 if (!(cmd & CMD_ASE)) {
1516 /* in case a clear of CMD_ASE didn't take yet */
1517 (void)handshake(oxu, &oxu->regs->status,
1518 STS_ASS, 0, 150);
1519 cmd |= CMD_ASE | CMD_RUN;
1520 writel(cmd, &oxu->regs->command);
1521 oxu_to_hcd(oxu)->state = HC_STATE_RUNNING;
1522 /* posted write need not be known to HC yet ... */
1523 }
1524 }
1525
1526 /* clear halt and/or toggle; and maybe recover from silicon quirk */
1527 if (qh->qh_state == QH_STATE_IDLE)
1528 qh_refresh(oxu, qh);
1529
1530 /* splice right after start */
1531 qh->qh_next = head->qh_next;
1532 qh->hw_next = head->hw_next;
1533 wmb();
1534
1535 head->qh_next.qh = qh;
1536 head->hw_next = dma;
1537
1538 qh->qh_state = QH_STATE_LINKED;
1539 /* qtd completions reported later by interrupt */
1540}
1541
1542#define QH_ADDR_MASK __constant_cpu_to_le32(0x7f)
1543
1544/*
1545 * For control/bulk/interrupt, return QH with these TDs appended.
1546 * Allocates and initializes the QH if necessary.
1547 * Returns null if it can't allocate a QH it needs to.
1548 * If the QH has TDs (urbs) already, that's great.
1549 */
1550static struct ehci_qh *qh_append_tds(struct oxu_hcd *oxu,
1551 struct urb *urb, struct list_head *qtd_list,
1552 int epnum, void **ptr)
1553{
1554 struct ehci_qh *qh = NULL;
1555
1556 qh = (struct ehci_qh *) *ptr;
1557 if (unlikely(qh == NULL)) {
1558 /* can't sleep here, we have oxu->lock... */
1559 qh = qh_make(oxu, urb, GFP_ATOMIC);
1560 *ptr = qh;
1561 }
1562 if (likely(qh != NULL)) {
1563 struct ehci_qtd *qtd;
1564
1565 if (unlikely(list_empty(qtd_list)))
1566 qtd = NULL;
1567 else
1568 qtd = list_entry(qtd_list->next, struct ehci_qtd,
1569 qtd_list);
1570
1571 /* control qh may need patching ... */
1572 if (unlikely(epnum == 0)) {
1573
1574 /* usb_reset_device() briefly reverts to address 0 */
1575 if (usb_pipedevice(urb->pipe) == 0)
1576 qh->hw_info1 &= ~QH_ADDR_MASK;
1577 }
1578
1579 /* just one way to queue requests: swap with the dummy qtd.
1580 * only hc or qh_refresh() ever modify the overlay.
1581 */
1582 if (likely(qtd != NULL)) {
1583 struct ehci_qtd *dummy;
1584 dma_addr_t dma;
1585 __le32 token;
1586
1587 /* to avoid racing the HC, use the dummy td instead of
1588 * the first td of our list (becomes new dummy). both
1589 * tds stay deactivated until we're done, when the
1590 * HC is allowed to fetch the old dummy (4.10.2).
1591 */
1592 token = qtd->hw_token;
1593 qtd->hw_token = HALT_BIT;
1594 wmb();
1595 dummy = qh->dummy;
1596
1597 dma = dummy->qtd_dma;
1598 *dummy = *qtd;
1599 dummy->qtd_dma = dma;
1600
1601 list_del(&qtd->qtd_list);
1602 list_add(&dummy->qtd_list, qtd_list);
1603 list_splice(qtd_list, qh->qtd_list.prev);
1604
1605 ehci_qtd_init(qtd, qtd->qtd_dma);
1606 qh->dummy = qtd;
1607
1608 /* hc must see the new dummy at list end */
1609 dma = qtd->qtd_dma;
1610 qtd = list_entry(qh->qtd_list.prev,
1611 struct ehci_qtd, qtd_list);
1612 qtd->hw_next = QTD_NEXT(dma);
1613
1614 /* let the hc process these next qtds */
1615 dummy->hw_token = (token & ~(0x80));
1616 wmb();
1617 dummy->hw_token = token;
1618
1619 urb->hcpriv = qh_get(qh);
1620 }
1621 }
1622 return qh;
1623}
1624
1625static int submit_async(struct oxu_hcd *oxu, struct urb *urb,
1626 struct list_head *qtd_list, gfp_t mem_flags)
1627{
1628 struct ehci_qtd *qtd;
1629 int epnum;
1630 unsigned long flags;
1631 struct ehci_qh *qh = NULL;
1632 int rc = 0;
1633
1634 qtd = list_entry(qtd_list->next, struct ehci_qtd, qtd_list);
1635 epnum = urb->ep->desc.bEndpointAddress;
1636
1637#ifdef OXU_URB_TRACE
1638 oxu_dbg(oxu, "%s %s urb %p ep%d%s len %d, qtd %p [qh %p]\n",
1639 __func__, urb->dev->devpath, urb,
1640 epnum & 0x0f, (epnum & USB_DIR_IN) ? "in" : "out",
1641 urb->transfer_buffer_length,
1642 qtd, urb->ep->hcpriv);
1643#endif
1644
1645 spin_lock_irqsave(&oxu->lock, flags);
1646 if (unlikely(!test_bit(HCD_FLAG_HW_ACCESSIBLE,
1647 &oxu_to_hcd(oxu)->flags))) {
1648 rc = -ESHUTDOWN;
1649 goto done;
1650 }
1651
1652 qh = qh_append_tds(oxu, urb, qtd_list, epnum, &urb->ep->hcpriv);
1653 if (unlikely(qh == NULL)) {
1654 rc = -ENOMEM;
1655 goto done;
1656 }
1657
1658 /* Control/bulk operations through TTs don't need scheduling,
1659 * the HC and TT handle it when the TT has a buffer ready.
1660 */
1661 if (likely(qh->qh_state == QH_STATE_IDLE))
1662 qh_link_async(oxu, qh_get(qh));
1663done:
1664 spin_unlock_irqrestore(&oxu->lock, flags);
1665 if (unlikely(qh == NULL))
1666 qtd_list_free(oxu, urb, qtd_list);
1667 return rc;
1668}
1669
1670/* The async qh for the qtds being reclaimed are now unlinked from the HC */
1671
1672static void end_unlink_async(struct oxu_hcd *oxu)
1673{
1674 struct ehci_qh *qh = oxu->reclaim;
1675 struct ehci_qh *next;
1676
1677 timer_action_done(oxu, TIMER_IAA_WATCHDOG);
1678
1679 qh->qh_state = QH_STATE_IDLE;
1680 qh->qh_next.qh = NULL;
1681 qh_put(qh); /* refcount from reclaim */
1682
1683 /* other unlink(s) may be pending (in QH_STATE_UNLINK_WAIT) */
1684 next = qh->reclaim;
1685 oxu->reclaim = next;
1686 oxu->reclaim_ready = 0;
1687 qh->reclaim = NULL;
1688
1689 qh_completions(oxu, qh);
1690
1691 if (!list_empty(&qh->qtd_list)
1692 && HC_IS_RUNNING(oxu_to_hcd(oxu)->state))
1693 qh_link_async(oxu, qh);
1694 else {
1695 qh_put(qh); /* refcount from async list */
1696
1697 /* it's not free to turn the async schedule on/off; leave it
1698 * active but idle for a while once it empties.
1699 */
1700 if (HC_IS_RUNNING(oxu_to_hcd(oxu)->state)
1701 && oxu->async->qh_next.qh == NULL)
1702 timer_action(oxu, TIMER_ASYNC_OFF);
1703 }
1704
1705 if (next) {
1706 oxu->reclaim = NULL;
1707 start_unlink_async(oxu, next);
1708 }
1709}
1710
1711/* makes sure the async qh will become idle */
1712/* caller must own oxu->lock */
1713
1714static void start_unlink_async(struct oxu_hcd *oxu, struct ehci_qh *qh)
1715{
1716 int cmd = readl(&oxu->regs->command);
1717 struct ehci_qh *prev;
1718
1719#ifdef DEBUG
1720 assert_spin_locked(&oxu->lock);
1721 if (oxu->reclaim || (qh->qh_state != QH_STATE_LINKED
1722 && qh->qh_state != QH_STATE_UNLINK_WAIT))
1723 BUG();
1724#endif
1725
1726 /* stop async schedule right now? */
1727 if (unlikely(qh == oxu->async)) {
1728 /* can't get here without STS_ASS set */
1729 if (oxu_to_hcd(oxu)->state != HC_STATE_HALT
1730 && !oxu->reclaim) {
1731 /* ... and CMD_IAAD clear */
1732 writel(cmd & ~CMD_ASE, &oxu->regs->command);
1733 wmb();
1734 /* handshake later, if we need to */
1735 timer_action_done(oxu, TIMER_ASYNC_OFF);
1736 }
1737 return;
1738 }
1739
1740 qh->qh_state = QH_STATE_UNLINK;
1741 oxu->reclaim = qh = qh_get(qh);
1742
1743 prev = oxu->async;
1744 while (prev->qh_next.qh != qh)
1745 prev = prev->qh_next.qh;
1746
1747 prev->hw_next = qh->hw_next;
1748 prev->qh_next = qh->qh_next;
1749 wmb();
1750
1751 if (unlikely(oxu_to_hcd(oxu)->state == HC_STATE_HALT)) {
1752 /* if (unlikely(qh->reclaim != 0))
1753 * this will recurse, probably not much
1754 */
1755 end_unlink_async(oxu);
1756 return;
1757 }
1758
1759 oxu->reclaim_ready = 0;
1760 cmd |= CMD_IAAD;
1761 writel(cmd, &oxu->regs->command);
1762 (void) readl(&oxu->regs->command);
1763 timer_action(oxu, TIMER_IAA_WATCHDOG);
1764}
1765
1766static void scan_async(struct oxu_hcd *oxu)
1767{
1768 struct ehci_qh *qh;
1769 enum ehci_timer_action action = TIMER_IO_WATCHDOG;
1770
1771 if (!++(oxu->stamp))
1772 oxu->stamp++;
1773 timer_action_done(oxu, TIMER_ASYNC_SHRINK);
1774rescan:
1775 qh = oxu->async->qh_next.qh;
1776 if (likely(qh != NULL)) {
1777 do {
1778 /* clean any finished work for this qh */
1779 if (!list_empty(&qh->qtd_list)
1780 && qh->stamp != oxu->stamp) {
1781 int temp;
1782
1783 /* unlinks could happen here; completion
1784 * reporting drops the lock. rescan using
1785 * the latest schedule, but don't rescan
1786 * qhs we already finished (no looping).
1787 */
1788 qh = qh_get(qh);
1789 qh->stamp = oxu->stamp;
1790 temp = qh_completions(oxu, qh);
1791 qh_put(qh);
1792 if (temp != 0)
1793 goto rescan;
1794 }
1795
1796 /* unlink idle entries, reducing HC PCI usage as well
1797 * as HCD schedule-scanning costs. delay for any qh
1798 * we just scanned, there's a not-unusual case that it
1799 * doesn't stay idle for long.
1800 * (plus, avoids some kind of re-activation race.)
1801 */
1802 if (list_empty(&qh->qtd_list)) {
1803 if (qh->stamp == oxu->stamp)
1804 action = TIMER_ASYNC_SHRINK;
1805 else if (!oxu->reclaim
1806 && qh->qh_state == QH_STATE_LINKED)
1807 start_unlink_async(oxu, qh);
1808 }
1809
1810 qh = qh->qh_next.qh;
1811 } while (qh);
1812 }
1813 if (action == TIMER_ASYNC_SHRINK)
1814 timer_action(oxu, TIMER_ASYNC_SHRINK);
1815}
1816
1817/*
1818 * periodic_next_shadow - return "next" pointer on shadow list
1819 * @periodic: host pointer to qh/itd/sitd
1820 * @tag: hardware tag for type of this record
1821 */
1822static union ehci_shadow *periodic_next_shadow(union ehci_shadow *periodic,
1823 __le32 tag)
1824{
1825 switch (tag) {
1826 default:
1827 case Q_TYPE_QH:
1828 return &periodic->qh->qh_next;
1829 }
1830}
1831
1832/* caller must hold oxu->lock */
1833static void periodic_unlink(struct oxu_hcd *oxu, unsigned frame, void *ptr)
1834{
1835 union ehci_shadow *prev_p = &oxu->pshadow[frame];
1836 __le32 *hw_p = &oxu->periodic[frame];
1837 union ehci_shadow here = *prev_p;
1838
1839 /* find predecessor of "ptr"; hw and shadow lists are in sync */
1840 while (here.ptr && here.ptr != ptr) {
1841 prev_p = periodic_next_shadow(prev_p, Q_NEXT_TYPE(*hw_p));
1842 hw_p = here.hw_next;
1843 here = *prev_p;
1844 }
1845 /* an interrupt entry (at list end) could have been shared */
1846 if (!here.ptr)
1847 return;
1848
1849 /* update shadow and hardware lists ... the old "next" pointers
1850 * from ptr may still be in use, the caller updates them.
1851 */
1852 *prev_p = *periodic_next_shadow(&here, Q_NEXT_TYPE(*hw_p));
1853 *hw_p = *here.hw_next;
1854}
1855
1856/* how many of the uframe's 125 usecs are allocated? */
1857static unsigned short periodic_usecs(struct oxu_hcd *oxu,
1858 unsigned frame, unsigned uframe)
1859{
1860 __le32 *hw_p = &oxu->periodic[frame];
1861 union ehci_shadow *q = &oxu->pshadow[frame];
1862 unsigned usecs = 0;
1863
1864 while (q->ptr) {
1865 switch (Q_NEXT_TYPE(*hw_p)) {
1866 case Q_TYPE_QH:
1867 default:
1868 /* is it in the S-mask? */
1869 if (q->qh->hw_info2 & cpu_to_le32(1 << uframe))
1870 usecs += q->qh->usecs;
1871 /* ... or C-mask? */
1872 if (q->qh->hw_info2 & cpu_to_le32(1 << (8 + uframe)))
1873 usecs += q->qh->c_usecs;
1874 hw_p = &q->qh->hw_next;
1875 q = &q->qh->qh_next;
1876 break;
1877 }
1878 }
1879#ifdef DEBUG
1880 if (usecs > 100)
1881 oxu_err(oxu, "uframe %d sched overrun: %d usecs\n",
1882 frame * 8 + uframe, usecs);
1883#endif
1884 return usecs;
1885}
1886
1887static int enable_periodic(struct oxu_hcd *oxu)
1888{
1889 u32 cmd;
1890 int status;
1891
1892 /* did clearing PSE did take effect yet?
1893 * takes effect only at frame boundaries...
1894 */
1895 status = handshake(oxu, &oxu->regs->status, STS_PSS, 0, 9 * 125);
1896 if (status != 0) {
1897 oxu_to_hcd(oxu)->state = HC_STATE_HALT;
1898 return status;
1899 }
1900
1901 cmd = readl(&oxu->regs->command) | CMD_PSE;
1902 writel(cmd, &oxu->regs->command);
1903 /* posted write ... PSS happens later */
1904 oxu_to_hcd(oxu)->state = HC_STATE_RUNNING;
1905
1906 /* make sure ehci_work scans these */
1907 oxu->next_uframe = readl(&oxu->regs->frame_index)
1908 % (oxu->periodic_size << 3);
1909 return 0;
1910}
1911
1912static int disable_periodic(struct oxu_hcd *oxu)
1913{
1914 u32 cmd;
1915 int status;
1916
1917 /* did setting PSE not take effect yet?
1918 * takes effect only at frame boundaries...
1919 */
1920 status = handshake(oxu, &oxu->regs->status, STS_PSS, STS_PSS, 9 * 125);
1921 if (status != 0) {
1922 oxu_to_hcd(oxu)->state = HC_STATE_HALT;
1923 return status;
1924 }
1925
1926 cmd = readl(&oxu->regs->command) & ~CMD_PSE;
1927 writel(cmd, &oxu->regs->command);
1928 /* posted write ... */
1929
1930 oxu->next_uframe = -1;
1931 return 0;
1932}
1933
1934/* periodic schedule slots have iso tds (normal or split) first, then a
1935 * sparse tree for active interrupt transfers.
1936 *
1937 * this just links in a qh; caller guarantees uframe masks are set right.
1938 * no FSTN support (yet; oxu 0.96+)
1939 */
1940static int qh_link_periodic(struct oxu_hcd *oxu, struct ehci_qh *qh)
1941{
1942 unsigned i;
1943 unsigned period = qh->period;
1944
1945 dev_dbg(&qh->dev->dev,
1946 "link qh%d-%04x/%p start %d [%d/%d us]\n",
1947 period, le32_to_cpup(&qh->hw_info2) & (QH_CMASK | QH_SMASK),
1948 qh, qh->start, qh->usecs, qh->c_usecs);
1949
1950 /* high bandwidth, or otherwise every microframe */
1951 if (period == 0)
1952 period = 1;
1953
1954 for (i = qh->start; i < oxu->periodic_size; i += period) {
1955 union ehci_shadow *prev = &oxu->pshadow[i];
1956 __le32 *hw_p = &oxu->periodic[i];
1957 union ehci_shadow here = *prev;
1958 __le32 type = 0;
1959
1960 /* skip the iso nodes at list head */
1961 while (here.ptr) {
1962 type = Q_NEXT_TYPE(*hw_p);
1963 if (type == Q_TYPE_QH)
1964 break;
1965 prev = periodic_next_shadow(prev, type);
1966 hw_p = &here.qh->hw_next;
1967 here = *prev;
1968 }
1969
1970 /* sorting each branch by period (slow-->fast)
1971 * enables sharing interior tree nodes
1972 */
1973 while (here.ptr && qh != here.qh) {
1974 if (qh->period > here.qh->period)
1975 break;
1976 prev = &here.qh->qh_next;
1977 hw_p = &here.qh->hw_next;
1978 here = *prev;
1979 }
1980 /* link in this qh, unless some earlier pass did that */
1981 if (qh != here.qh) {
1982 qh->qh_next = here;
1983 if (here.qh)
1984 qh->hw_next = *hw_p;
1985 wmb();
1986 prev->qh = qh;
1987 *hw_p = QH_NEXT(qh->qh_dma);
1988 }
1989 }
1990 qh->qh_state = QH_STATE_LINKED;
1991 qh_get(qh);
1992
1993 /* update per-qh bandwidth for usbfs */
1994 oxu_to_hcd(oxu)->self.bandwidth_allocated += qh->period
1995 ? ((qh->usecs + qh->c_usecs) / qh->period)
1996 : (qh->usecs * 8);
1997
1998 /* maybe enable periodic schedule processing */
1999 if (!oxu->periodic_sched++)
2000 return enable_periodic(oxu);
2001
2002 return 0;
2003}
2004
2005static void qh_unlink_periodic(struct oxu_hcd *oxu, struct ehci_qh *qh)
2006{
2007 unsigned i;
2008 unsigned period;
2009
2010 /* FIXME:
2011 * IF this isn't high speed
2012 * and this qh is active in the current uframe
2013 * (and overlay token SplitXstate is false?)
2014 * THEN
2015 * qh->hw_info1 |= __constant_cpu_to_le32(1 << 7 "ignore");
2016 */
2017
2018 /* high bandwidth, or otherwise part of every microframe */
2019 period = qh->period;
2020 if (period == 0)
2021 period = 1;
2022
2023 for (i = qh->start; i < oxu->periodic_size; i += period)
2024 periodic_unlink(oxu, i, qh);
2025
2026 /* update per-qh bandwidth for usbfs */
2027 oxu_to_hcd(oxu)->self.bandwidth_allocated -= qh->period
2028 ? ((qh->usecs + qh->c_usecs) / qh->period)
2029 : (qh->usecs * 8);
2030
2031 dev_dbg(&qh->dev->dev,
2032 "unlink qh%d-%04x/%p start %d [%d/%d us]\n",
2033 qh->period,
2034 le32_to_cpup(&qh->hw_info2) & (QH_CMASK | QH_SMASK),
2035 qh, qh->start, qh->usecs, qh->c_usecs);
2036
2037 /* qh->qh_next still "live" to HC */
2038 qh->qh_state = QH_STATE_UNLINK;
2039 qh->qh_next.ptr = NULL;
2040 qh_put(qh);
2041
2042 /* maybe turn off periodic schedule */
2043 oxu->periodic_sched--;
2044 if (!oxu->periodic_sched)
2045 (void) disable_periodic(oxu);
2046}
2047
2048static void intr_deschedule(struct oxu_hcd *oxu, struct ehci_qh *qh)
2049{
2050 unsigned wait;
2051
2052 qh_unlink_periodic(oxu, qh);
2053
2054 /* simple/paranoid: always delay, expecting the HC needs to read
2055 * qh->hw_next or finish a writeback after SPLIT/CSPLIT ... and
2056 * expect khubd to clean up after any CSPLITs we won't issue.
2057 * active high speed queues may need bigger delays...
2058 */
2059 if (list_empty(&qh->qtd_list)
2060 || (__constant_cpu_to_le32(QH_CMASK) & qh->hw_info2) != 0)
2061 wait = 2;
2062 else
2063 wait = 55; /* worst case: 3 * 1024 */
2064
2065 udelay(wait);
2066 qh->qh_state = QH_STATE_IDLE;
2067 qh->hw_next = EHCI_LIST_END;
2068 wmb();
2069}
2070
2071static int check_period(struct oxu_hcd *oxu,
2072 unsigned frame, unsigned uframe,
2073 unsigned period, unsigned usecs)
2074{
2075 int claimed;
2076
2077 /* complete split running into next frame?
2078 * given FSTN support, we could sometimes check...
2079 */
2080 if (uframe >= 8)
2081 return 0;
2082
2083 /*
2084 * 80% periodic == 100 usec/uframe available
2085 * convert "usecs we need" to "max already claimed"
2086 */
2087 usecs = 100 - usecs;
2088
2089 /* we "know" 2 and 4 uframe intervals were rejected; so
2090 * for period 0, check _every_ microframe in the schedule.
2091 */
2092 if (unlikely(period == 0)) {
2093 do {
2094 for (uframe = 0; uframe < 7; uframe++) {
2095 claimed = periodic_usecs(oxu, frame, uframe);
2096 if (claimed > usecs)
2097 return 0;
2098 }
2099 } while ((frame += 1) < oxu->periodic_size);
2100
2101 /* just check the specified uframe, at that period */
2102 } else {
2103 do {
2104 claimed = periodic_usecs(oxu, frame, uframe);
2105 if (claimed > usecs)
2106 return 0;
2107 } while ((frame += period) < oxu->periodic_size);
2108 }
2109
2110 return 1;
2111}
2112
2113static int check_intr_schedule(struct oxu_hcd *oxu,
2114 unsigned frame, unsigned uframe,
2115 const struct ehci_qh *qh, __le32 *c_maskp)
2116{
2117 int retval = -ENOSPC;
2118
2119 if (qh->c_usecs && uframe >= 6) /* FSTN territory? */
2120 goto done;
2121
2122 if (!check_period(oxu, frame, uframe, qh->period, qh->usecs))
2123 goto done;
2124 if (!qh->c_usecs) {
2125 retval = 0;
2126 *c_maskp = 0;
2127 goto done;
2128 }
2129
2130done:
2131 return retval;
2132}
2133
2134/* "first fit" scheduling policy used the first time through,
2135 * or when the previous schedule slot can't be re-used.
2136 */
2137static int qh_schedule(struct oxu_hcd *oxu, struct ehci_qh *qh)
2138{
2139 int status;
2140 unsigned uframe;
2141 __le32 c_mask;
2142 unsigned frame; /* 0..(qh->period - 1), or NO_FRAME */
2143
2144 qh_refresh(oxu, qh);
2145 qh->hw_next = EHCI_LIST_END;
2146 frame = qh->start;
2147
2148 /* reuse the previous schedule slots, if we can */
2149 if (frame < qh->period) {
2150 uframe = ffs(le32_to_cpup(&qh->hw_info2) & QH_SMASK);
2151 status = check_intr_schedule(oxu, frame, --uframe,
2152 qh, &c_mask);
2153 } else {
2154 uframe = 0;
2155 c_mask = 0;
2156 status = -ENOSPC;
2157 }
2158
2159 /* else scan the schedule to find a group of slots such that all
2160 * uframes have enough periodic bandwidth available.
2161 */
2162 if (status) {
2163 /* "normal" case, uframing flexible except with splits */
2164 if (qh->period) {
2165 frame = qh->period - 1;
2166 do {
2167 for (uframe = 0; uframe < 8; uframe++) {
2168 status = check_intr_schedule(oxu,
2169 frame, uframe, qh,
2170 &c_mask);
2171 if (status == 0)
2172 break;
2173 }
2174 } while (status && frame--);
2175
2176 /* qh->period == 0 means every uframe */
2177 } else {
2178 frame = 0;
2179 status = check_intr_schedule(oxu, 0, 0, qh, &c_mask);
2180 }
2181 if (status)
2182 goto done;
2183 qh->start = frame;
2184
2185 /* reset S-frame and (maybe) C-frame masks */
2186 qh->hw_info2 &= __constant_cpu_to_le32(~(QH_CMASK | QH_SMASK));
2187 qh->hw_info2 |= qh->period
2188 ? cpu_to_le32(1 << uframe)
2189 : __constant_cpu_to_le32(QH_SMASK);
2190 qh->hw_info2 |= c_mask;
2191 } else
2192 oxu_dbg(oxu, "reused qh %p schedule\n", qh);
2193
2194 /* stuff into the periodic schedule */
2195 status = qh_link_periodic(oxu, qh);
2196done:
2197 return status;
2198}
2199
2200static int intr_submit(struct oxu_hcd *oxu, struct urb *urb,
2201 struct list_head *qtd_list, gfp_t mem_flags)
2202{
2203 unsigned epnum;
2204 unsigned long flags;
2205 struct ehci_qh *qh;
2206 int status = 0;
2207 struct list_head empty;
2208
2209 /* get endpoint and transfer/schedule data */
2210 epnum = urb->ep->desc.bEndpointAddress;
2211
2212 spin_lock_irqsave(&oxu->lock, flags);
2213
2214 if (unlikely(!test_bit(HCD_FLAG_HW_ACCESSIBLE,
2215 &oxu_to_hcd(oxu)->flags))) {
2216 status = -ESHUTDOWN;
2217 goto done;
2218 }
2219
2220 /* get qh and force any scheduling errors */
2221 INIT_LIST_HEAD(&empty);
2222 qh = qh_append_tds(oxu, urb, &empty, epnum, &urb->ep->hcpriv);
2223 if (qh == NULL) {
2224 status = -ENOMEM;
2225 goto done;
2226 }
2227 if (qh->qh_state == QH_STATE_IDLE) {
2228 status = qh_schedule(oxu, qh);
2229 if (status != 0)
2230 goto done;
2231 }
2232
2233 /* then queue the urb's tds to the qh */
2234 qh = qh_append_tds(oxu, urb, qtd_list, epnum, &urb->ep->hcpriv);
2235 BUG_ON(qh == NULL);
2236
2237 /* ... update usbfs periodic stats */
2238 oxu_to_hcd(oxu)->self.bandwidth_int_reqs++;
2239
2240done:
2241 spin_unlock_irqrestore(&oxu->lock, flags);
2242 if (status)
2243 qtd_list_free(oxu, urb, qtd_list);
2244
2245 return status;
2246}
2247
2248static inline int itd_submit(struct oxu_hcd *oxu, struct urb *urb,
2249 gfp_t mem_flags)
2250{
2251 oxu_dbg(oxu, "iso support is missing!\n");
2252 return -ENOSYS;
2253}
2254
2255static inline int sitd_submit(struct oxu_hcd *oxu, struct urb *urb,
2256 gfp_t mem_flags)
2257{
2258 oxu_dbg(oxu, "split iso support is missing!\n");
2259 return -ENOSYS;
2260}
2261
2262static void scan_periodic(struct oxu_hcd *oxu)
2263{
2264 unsigned frame, clock, now_uframe, mod;
2265 unsigned modified;
2266
2267 mod = oxu->periodic_size << 3;
2268
2269 /*
2270 * When running, scan from last scan point up to "now"
2271 * else clean up by scanning everything that's left.
2272 * Touches as few pages as possible: cache-friendly.
2273 */
2274 now_uframe = oxu->next_uframe;
2275 if (HC_IS_RUNNING(oxu_to_hcd(oxu)->state))
2276 clock = readl(&oxu->regs->frame_index);
2277 else
2278 clock = now_uframe + mod - 1;
2279 clock %= mod;
2280
2281 for (;;) {
2282 union ehci_shadow q, *q_p;
2283 __le32 type, *hw_p;
2284 unsigned uframes;
2285
2286 /* don't scan past the live uframe */
2287 frame = now_uframe >> 3;
2288 if (frame == (clock >> 3))
2289 uframes = now_uframe & 0x07;
2290 else {
2291 /* safe to scan the whole frame at once */
2292 now_uframe |= 0x07;
2293 uframes = 8;
2294 }
2295
2296restart:
2297 /* scan each element in frame's queue for completions */
2298 q_p = &oxu->pshadow[frame];
2299 hw_p = &oxu->periodic[frame];
2300 q.ptr = q_p->ptr;
2301 type = Q_NEXT_TYPE(*hw_p);
2302 modified = 0;
2303
2304 while (q.ptr != NULL) {
2305 union ehci_shadow temp;
2306 int live;
2307
2308 live = HC_IS_RUNNING(oxu_to_hcd(oxu)->state);
2309 switch (type) {
2310 case Q_TYPE_QH:
2311 /* handle any completions */
2312 temp.qh = qh_get(q.qh);
2313 type = Q_NEXT_TYPE(q.qh->hw_next);
2314 q = q.qh->qh_next;
2315 modified = qh_completions(oxu, temp.qh);
2316 if (unlikely(list_empty(&temp.qh->qtd_list)))
2317 intr_deschedule(oxu, temp.qh);
2318 qh_put(temp.qh);
2319 break;
2320 default:
2321 dbg("corrupt type %d frame %d shadow %p",
2322 type, frame, q.ptr);
2323 q.ptr = NULL;
2324 }
2325
2326 /* assume completion callbacks modify the queue */
2327 if (unlikely(modified))
2328 goto restart;
2329 }
2330
2331 /* Stop when we catch up to the HC */
2332
2333 /* FIXME: this assumes we won't get lapped when
2334 * latencies climb; that should be rare, but...
2335 * detect it, and just go all the way around.
2336 * FLR might help detect this case, so long as latencies
2337 * don't exceed periodic_size msec (default 1.024 sec).
2338 */
2339
2340 /* FIXME: likewise assumes HC doesn't halt mid-scan */
2341
2342 if (now_uframe == clock) {
2343 unsigned now;
2344
2345 if (!HC_IS_RUNNING(oxu_to_hcd(oxu)->state))
2346 break;
2347 oxu->next_uframe = now_uframe;
2348 now = readl(&oxu->regs->frame_index) % mod;
2349 if (now_uframe == now)
2350 break;
2351
2352 /* rescan the rest of this frame, then ... */
2353 clock = now;
2354 } else {
2355 now_uframe++;
2356 now_uframe %= mod;
2357 }
2358 }
2359}
2360
2361/* On some systems, leaving remote wakeup enabled prevents system shutdown.
2362 * The firmware seems to think that powering off is a wakeup event!
2363 * This routine turns off remote wakeup and everything else, on all ports.
2364 */
2365static void ehci_turn_off_all_ports(struct oxu_hcd *oxu)
2366{
2367 int port = HCS_N_PORTS(oxu->hcs_params);
2368
2369 while (port--)
2370 writel(PORT_RWC_BITS, &oxu->regs->port_status[port]);
2371}
2372
2373static void ehci_port_power(struct oxu_hcd *oxu, int is_on)
2374{
2375 unsigned port;
2376
2377 if (!HCS_PPC(oxu->hcs_params))
2378 return;
2379
2380 oxu_dbg(oxu, "...power%s ports...\n", is_on ? "up" : "down");
2381 for (port = HCS_N_PORTS(oxu->hcs_params); port > 0; )
2382 (void) oxu_hub_control(oxu_to_hcd(oxu),
2383 is_on ? SetPortFeature : ClearPortFeature,
2384 USB_PORT_FEAT_POWER,
2385 port--, NULL, 0);
2386 msleep(20);
2387}
2388
2389/* Called from some interrupts, timers, and so on.
2390 * It calls driver completion functions, after dropping oxu->lock.
2391 */
2392static void ehci_work(struct oxu_hcd *oxu)
2393{
2394 timer_action_done(oxu, TIMER_IO_WATCHDOG);
2395 if (oxu->reclaim_ready)
2396 end_unlink_async(oxu);
2397
2398 /* another CPU may drop oxu->lock during a schedule scan while
2399 * it reports urb completions. this flag guards against bogus
2400 * attempts at re-entrant schedule scanning.
2401 */
2402 if (oxu->scanning)
2403 return;
2404 oxu->scanning = 1;
2405 scan_async(oxu);
2406 if (oxu->next_uframe != -1)
2407 scan_periodic(oxu);
2408 oxu->scanning = 0;
2409
2410 /* the IO watchdog guards against hardware or driver bugs that
2411 * misplace IRQs, and should let us run completely without IRQs.
2412 * such lossage has been observed on both VT6202 and VT8235.
2413 */
2414 if (HC_IS_RUNNING(oxu_to_hcd(oxu)->state) &&
2415 (oxu->async->qh_next.ptr != NULL ||
2416 oxu->periodic_sched != 0))
2417 timer_action(oxu, TIMER_IO_WATCHDOG);
2418}
2419
2420static void unlink_async(struct oxu_hcd *oxu, struct ehci_qh *qh)
2421{
2422 /* if we need to use IAA and it's busy, defer */
2423 if (qh->qh_state == QH_STATE_LINKED
2424 && oxu->reclaim
2425 && HC_IS_RUNNING(oxu_to_hcd(oxu)->state)) {
2426 struct ehci_qh *last;
2427
2428 for (last = oxu->reclaim;
2429 last->reclaim;
2430 last = last->reclaim)
2431 continue;
2432 qh->qh_state = QH_STATE_UNLINK_WAIT;
2433 last->reclaim = qh;
2434
2435 /* bypass IAA if the hc can't care */
2436 } else if (!HC_IS_RUNNING(oxu_to_hcd(oxu)->state) && oxu->reclaim)
2437 end_unlink_async(oxu);
2438
2439 /* something else might have unlinked the qh by now */
2440 if (qh->qh_state == QH_STATE_LINKED)
2441 start_unlink_async(oxu, qh);
2442}
2443
2444/*
2445 * USB host controller methods
2446 */
2447
2448static irqreturn_t oxu210_hcd_irq(struct usb_hcd *hcd)
2449{
2450 struct oxu_hcd *oxu = hcd_to_oxu(hcd);
2451 u32 status, pcd_status = 0;
2452 int bh;
2453
2454 spin_lock(&oxu->lock);
2455
2456 status = readl(&oxu->regs->status);
2457
2458 /* e.g. cardbus physical eject */
2459 if (status == ~(u32) 0) {
2460 oxu_dbg(oxu, "device removed\n");
2461 goto dead;
2462 }
2463
2464 status &= INTR_MASK;
2465 if (!status) { /* irq sharing? */
2466 spin_unlock(&oxu->lock);
2467 return IRQ_NONE;
2468 }
2469
2470 /* clear (just) interrupts */
2471 writel(status, &oxu->regs->status);
2472 readl(&oxu->regs->command); /* unblock posted write */
2473 bh = 0;
2474
2475#ifdef OXU_VERBOSE_DEBUG
2476 /* unrequested/ignored: Frame List Rollover */
2477 dbg_status(oxu, "irq", status);
2478#endif
2479
2480 /* INT, ERR, and IAA interrupt rates can be throttled */
2481
2482 /* normal [4.15.1.2] or error [4.15.1.1] completion */
2483 if (likely((status & (STS_INT|STS_ERR)) != 0))
2484 bh = 1;
2485
2486 /* complete the unlinking of some qh [4.15.2.3] */
2487 if (status & STS_IAA) {
2488 oxu->reclaim_ready = 1;
2489 bh = 1;
2490 }
2491
2492 /* remote wakeup [4.3.1] */
2493 if (status & STS_PCD) {
2494 unsigned i = HCS_N_PORTS(oxu->hcs_params);
2495 pcd_status = status;
2496
2497 /* resume root hub? */
2498 if (!(readl(&oxu->regs->command) & CMD_RUN))
2499 usb_hcd_resume_root_hub(hcd);
2500
2501 while (i--) {
2502 int pstatus = readl(&oxu->regs->port_status[i]);
2503
2504 if (pstatus & PORT_OWNER)
2505 continue;
2506 if (!(pstatus & PORT_RESUME)
2507 || oxu->reset_done[i] != 0)
2508 continue;
2509
2510 /* start 20 msec resume signaling from this port,
2511 * and make khubd collect PORT_STAT_C_SUSPEND to
2512 * stop that signaling.
2513 */
2514 oxu->reset_done[i] = jiffies + msecs_to_jiffies(20);
2515 oxu_dbg(oxu, "port %d remote wakeup\n", i + 1);
2516 mod_timer(&hcd->rh_timer, oxu->reset_done[i]);
2517 }
2518 }
2519
2520 /* PCI errors [4.15.2.4] */
2521 if (unlikely((status & STS_FATAL) != 0)) {
2522 /* bogus "fatal" IRQs appear on some chips... why? */
2523 status = readl(&oxu->regs->status);
2524 dbg_cmd(oxu, "fatal", readl(&oxu->regs->command));
2525 dbg_status(oxu, "fatal", status);
2526 if (status & STS_HALT) {
2527 oxu_err(oxu, "fatal error\n");
2528dead:
2529 ehci_reset(oxu);
2530 writel(0, &oxu->regs->configured_flag);
2531 /* generic layer kills/unlinks all urbs, then
2532 * uses oxu_stop to clean up the rest
2533 */
2534 bh = 1;
2535 }
2536 }
2537
2538 if (bh)
2539 ehci_work(oxu);
2540 spin_unlock(&oxu->lock);
2541 if (pcd_status & STS_PCD)
2542 usb_hcd_poll_rh_status(hcd);
2543 return IRQ_HANDLED;
2544}
2545
2546static irqreturn_t oxu_irq(struct usb_hcd *hcd)
2547{
2548 struct oxu_hcd *oxu = hcd_to_oxu(hcd);
2549 int ret = IRQ_HANDLED;
2550
2551 u32 status = oxu_readl(hcd->regs, OXU_CHIPIRQSTATUS);
2552 u32 enable = oxu_readl(hcd->regs, OXU_CHIPIRQEN_SET);
2553
2554 /* Disable all interrupt */
2555 oxu_writel(hcd->regs, OXU_CHIPIRQEN_CLR, enable);
2556
2557 if ((oxu->is_otg && (status & OXU_USBOTGI)) ||
2558 (!oxu->is_otg && (status & OXU_USBSPHI)))
2559 oxu210_hcd_irq(hcd);
2560 else
2561 ret = IRQ_NONE;
2562
2563 /* Enable all interrupt back */
2564 oxu_writel(hcd->regs, OXU_CHIPIRQEN_SET, enable);
2565
2566 return ret;
2567}
2568
2569static void oxu_watchdog(unsigned long param)
2570{
2571 struct oxu_hcd *oxu = (struct oxu_hcd *) param;
2572 unsigned long flags;
2573
2574 spin_lock_irqsave(&oxu->lock, flags);
2575
2576 /* lost IAA irqs wedge things badly; seen with a vt8235 */
2577 if (oxu->reclaim) {
2578 u32 status = readl(&oxu->regs->status);
2579 if (status & STS_IAA) {
2580 oxu_vdbg(oxu, "lost IAA\n");
2581 writel(STS_IAA, &oxu->regs->status);
2582 oxu->reclaim_ready = 1;
2583 }
2584 }
2585
2586 /* stop async processing after it's idled a bit */
2587 if (test_bit(TIMER_ASYNC_OFF, &oxu->actions))
2588 start_unlink_async(oxu, oxu->async);
2589
2590 /* oxu could run by timer, without IRQs ... */
2591 ehci_work(oxu);
2592
2593 spin_unlock_irqrestore(&oxu->lock, flags);
2594}
2595
2596/* One-time init, only for memory state.
2597 */
2598static int oxu_hcd_init(struct usb_hcd *hcd)
2599{
2600 struct oxu_hcd *oxu = hcd_to_oxu(hcd);
2601 u32 temp;
2602 int retval;
2603 u32 hcc_params;
2604
2605 spin_lock_init(&oxu->lock);
2606
2607 init_timer(&oxu->watchdog);
2608 oxu->watchdog.function = oxu_watchdog;
2609 oxu->watchdog.data = (unsigned long) oxu;
2610
2611 /*
2612 * hw default: 1K periodic list heads, one per frame.
2613 * periodic_size can shrink by USBCMD update if hcc_params allows.
2614 */
2615 oxu->periodic_size = DEFAULT_I_TDPS;
2616 retval = ehci_mem_init(oxu, GFP_KERNEL);
2617 if (retval < 0)
2618 return retval;
2619
2620 /* controllers may cache some of the periodic schedule ... */
2621 hcc_params = readl(&oxu->caps->hcc_params);
2622 if (HCC_ISOC_CACHE(hcc_params)) /* full frame cache */
2623 oxu->i_thresh = 8;
2624 else /* N microframes cached */
2625 oxu->i_thresh = 2 + HCC_ISOC_THRES(hcc_params);
2626
2627 oxu->reclaim = NULL;
2628 oxu->reclaim_ready = 0;
2629 oxu->next_uframe = -1;
2630
2631 /*
2632 * dedicate a qh for the async ring head, since we couldn't unlink
2633 * a 'real' qh without stopping the async schedule [4.8]. use it
2634 * as the 'reclamation list head' too.
2635 * its dummy is used in hw_alt_next of many tds, to prevent the qh
2636 * from automatically advancing to the next td after short reads.
2637 */
2638 oxu->async->qh_next.qh = NULL;
2639 oxu->async->hw_next = QH_NEXT(oxu->async->qh_dma);
2640 oxu->async->hw_info1 = cpu_to_le32(QH_HEAD);
2641 oxu->async->hw_token = cpu_to_le32(QTD_STS_HALT);
2642 oxu->async->hw_qtd_next = EHCI_LIST_END;
2643 oxu->async->qh_state = QH_STATE_LINKED;
2644 oxu->async->hw_alt_next = QTD_NEXT(oxu->async->dummy->qtd_dma);
2645
2646 /* clear interrupt enables, set irq latency */
2647 if (log2_irq_thresh < 0 || log2_irq_thresh > 6)
2648 log2_irq_thresh = 0;
2649 temp = 1 << (16 + log2_irq_thresh);
2650 if (HCC_CANPARK(hcc_params)) {
2651 /* HW default park == 3, on hardware that supports it (like
2652 * NVidia and ALI silicon), maximizes throughput on the async
2653 * schedule by avoiding QH fetches between transfers.
2654 *
2655 * With fast usb storage devices and NForce2, "park" seems to
2656 * make problems: throughput reduction (!), data errors...
2657 */
2658 if (park) {
2659 park = min(park, (unsigned) 3);
2660 temp |= CMD_PARK;
2661 temp |= park << 8;
2662 }
2663 oxu_dbg(oxu, "park %d\n", park);
2664 }
2665 if (HCC_PGM_FRAMELISTLEN(hcc_params)) {
2666 /* periodic schedule size can be smaller than default */
2667 temp &= ~(3 << 2);
2668 temp |= (EHCI_TUNE_FLS << 2);
2669 }
2670 oxu->command = temp;
2671
2672 return 0;
2673}
2674
2675/* Called during probe() after chip reset completes.
2676 */
2677static int oxu_reset(struct usb_hcd *hcd)
2678{
2679 struct oxu_hcd *oxu = hcd_to_oxu(hcd);
2680 int ret;
2681
2682 spin_lock_init(&oxu->mem_lock);
2683 INIT_LIST_HEAD(&oxu->urb_list);
2684 oxu->urb_len = 0;
2685
2686 /* FIMXE */
2687 hcd->self.controller->dma_mask = 0UL;
2688
2689 if (oxu->is_otg) {
2690 oxu->caps = hcd->regs + OXU_OTG_CAP_OFFSET;
2691 oxu->regs = hcd->regs + OXU_OTG_CAP_OFFSET + \
2692 HC_LENGTH(readl(&oxu->caps->hc_capbase));
2693
2694 oxu->mem = hcd->regs + OXU_SPH_MEM;
2695 } else {
2696 oxu->caps = hcd->regs + OXU_SPH_CAP_OFFSET;
2697 oxu->regs = hcd->regs + OXU_SPH_CAP_OFFSET + \
2698 HC_LENGTH(readl(&oxu->caps->hc_capbase));
2699
2700 oxu->mem = hcd->regs + OXU_OTG_MEM;
2701 }
2702
2703 oxu->hcs_params = readl(&oxu->caps->hcs_params);
2704 oxu->sbrn = 0x20;
2705
2706 ret = oxu_hcd_init(hcd);
2707 if (ret)
2708 return ret;
2709
2710 return 0;
2711}
2712
2713static int oxu_run(struct usb_hcd *hcd)
2714{
2715 struct oxu_hcd *oxu = hcd_to_oxu(hcd);
2716 int retval;
2717 u32 temp, hcc_params;
2718
2719 hcd->uses_new_polling = 1;
2720 hcd->poll_rh = 0;
2721
2722 /* EHCI spec section 4.1 */
2723 retval = ehci_reset(oxu);
2724 if (retval != 0) {
2725 ehci_mem_cleanup(oxu);
2726 return retval;
2727 }
2728 writel(oxu->periodic_dma, &oxu->regs->frame_list);
2729 writel((u32) oxu->async->qh_dma, &oxu->regs->async_next);
2730
2731 /* hcc_params controls whether oxu->regs->segment must (!!!)
2732 * be used; it constrains QH/ITD/SITD and QTD locations.
2733 * pci_pool consistent memory always uses segment zero.
2734 * streaming mappings for I/O buffers, like pci_map_single(),
2735 * can return segments above 4GB, if the device allows.
2736 *
2737 * NOTE: the dma mask is visible through dma_supported(), so
2738 * drivers can pass this info along ... like NETIF_F_HIGHDMA,
2739 * Scsi_Host.highmem_io, and so forth. It's readonly to all
2740 * host side drivers though.
2741 */
2742 hcc_params = readl(&oxu->caps->hcc_params);
2743 if (HCC_64BIT_ADDR(hcc_params))
2744 writel(0, &oxu->regs->segment);
2745
2746 oxu->command &= ~(CMD_LRESET | CMD_IAAD | CMD_PSE |
2747 CMD_ASE | CMD_RESET);
2748 oxu->command |= CMD_RUN;
2749 writel(oxu->command, &oxu->regs->command);
2750 dbg_cmd(oxu, "init", oxu->command);
2751
2752 /*
2753 * Start, enabling full USB 2.0 functionality ... usb 1.1 devices
2754 * are explicitly handed to companion controller(s), so no TT is
2755 * involved with the root hub. (Except where one is integrated,
2756 * and there's no companion controller unless maybe for USB OTG.)
2757 */
2758 hcd->state = HC_STATE_RUNNING;
2759 writel(FLAG_CF, &oxu->regs->configured_flag);
2760 readl(&oxu->regs->command); /* unblock posted writes */
2761
2762 temp = HC_VERSION(readl(&oxu->caps->hc_capbase));
2763 oxu_info(oxu, "USB %x.%x started, quasi-EHCI %x.%02x, driver %s%s\n",
2764 ((oxu->sbrn & 0xf0)>>4), (oxu->sbrn & 0x0f),
2765 temp >> 8, temp & 0xff, DRIVER_VERSION,
2766 ignore_oc ? ", overcurrent ignored" : "");
2767
2768 writel(INTR_MASK, &oxu->regs->intr_enable); /* Turn On Interrupts */
2769
2770 return 0;
2771}
2772
2773static void oxu_stop(struct usb_hcd *hcd)
2774{
2775 struct oxu_hcd *oxu = hcd_to_oxu(hcd);
2776
2777 /* Turn off port power on all root hub ports. */
2778 ehci_port_power(oxu, 0);
2779
2780 /* no more interrupts ... */
2781 del_timer_sync(&oxu->watchdog);
2782
2783 spin_lock_irq(&oxu->lock);
2784 if (HC_IS_RUNNING(hcd->state))
2785 ehci_quiesce(oxu);
2786
2787 ehci_reset(oxu);
2788 writel(0, &oxu->regs->intr_enable);
2789 spin_unlock_irq(&oxu->lock);
2790
2791 /* let companion controllers work when we aren't */
2792 writel(0, &oxu->regs->configured_flag);
2793
2794 /* root hub is shut down separately (first, when possible) */
2795 spin_lock_irq(&oxu->lock);
2796 if (oxu->async)
2797 ehci_work(oxu);
2798 spin_unlock_irq(&oxu->lock);
2799 ehci_mem_cleanup(oxu);
2800
2801 dbg_status(oxu, "oxu_stop completed", readl(&oxu->regs->status));
2802}
2803
2804/* Kick in for silicon on any bus (not just pci, etc).
2805 * This forcibly disables dma and IRQs, helping kexec and other cases
2806 * where the next system software may expect clean state.
2807 */
2808static void oxu_shutdown(struct usb_hcd *hcd)
2809{
2810 struct oxu_hcd *oxu = hcd_to_oxu(hcd);
2811
2812 (void) ehci_halt(oxu);
2813 ehci_turn_off_all_ports(oxu);
2814
2815 /* make BIOS/etc use companion controller during reboot */
2816 writel(0, &oxu->regs->configured_flag);
2817
2818 /* unblock posted writes */
2819 readl(&oxu->regs->configured_flag);
2820}
2821
2822/* Non-error returns are a promise to giveback() the urb later
2823 * we drop ownership so next owner (or urb unlink) can get it
2824 *
2825 * urb + dev is in hcd.self.controller.urb_list
2826 * we're queueing TDs onto software and hardware lists
2827 *
2828 * hcd-specific init for hcpriv hasn't been done yet
2829 *
2830 * NOTE: control, bulk, and interrupt share the same code to append TDs
2831 * to a (possibly active) QH, and the same QH scanning code.
2832 */
2833static int __oxu_urb_enqueue(struct usb_hcd *hcd, struct urb *urb,
2834 gfp_t mem_flags)
2835{
2836 struct oxu_hcd *oxu = hcd_to_oxu(hcd);
2837 struct list_head qtd_list;
2838
2839 INIT_LIST_HEAD(&qtd_list);
2840
2841 switch (usb_pipetype(urb->pipe)) {
2842 case PIPE_CONTROL:
2843 case PIPE_BULK:
2844 default:
2845 if (!qh_urb_transaction(oxu, urb, &qtd_list, mem_flags))
2846 return -ENOMEM;
2847 return submit_async(oxu, urb, &qtd_list, mem_flags);
2848
2849 case PIPE_INTERRUPT:
2850 if (!qh_urb_transaction(oxu, urb, &qtd_list, mem_flags))
2851 return -ENOMEM;
2852 return intr_submit(oxu, urb, &qtd_list, mem_flags);
2853
2854 case PIPE_ISOCHRONOUS:
2855 if (urb->dev->speed == USB_SPEED_HIGH)
2856 return itd_submit(oxu, urb, mem_flags);
2857 else
2858 return sitd_submit(oxu, urb, mem_flags);
2859 }
2860}
2861
2862/* This function is responsible for breaking URBs with big data size
2863 * into smaller size and processing small urbs in sequence.
2864 */
2865static int oxu_urb_enqueue(struct usb_hcd *hcd, struct urb *urb,
2866 gfp_t mem_flags)
2867{
2868 struct oxu_hcd *oxu = hcd_to_oxu(hcd);
2869 int num, rem;
2870 int transfer_buffer_length;
2871 void *transfer_buffer;
2872 struct urb *murb;
2873 int i, ret;
2874
2875 /* If not bulk pipe just enqueue the URB */
2876 if (!usb_pipebulk(urb->pipe))
2877 return __oxu_urb_enqueue(hcd, urb, mem_flags);
2878
2879 /* Otherwise we should verify the USB transfer buffer size! */
2880 transfer_buffer = urb->transfer_buffer;
2881 transfer_buffer_length = urb->transfer_buffer_length;
2882
2883 num = urb->transfer_buffer_length / 4096;
2884 rem = urb->transfer_buffer_length % 4096;
2885 if (rem != 0)
2886 num++;
2887
2888 /* If URB is smaller than 4096 bytes just enqueue it! */
2889 if (num == 1)
2890 return __oxu_urb_enqueue(hcd, urb, mem_flags);
2891
2892 /* Ok, we have more job to do! :) */
2893
2894 for (i = 0; i < num - 1; i++) {
2895 /* Get free micro URB poll till a free urb is recieved */
2896
2897 do {
2898 murb = (struct urb *) oxu_murb_alloc(oxu);
2899 if (!murb)
2900 schedule();
2901 } while (!murb);
2902
2903 /* Coping the urb */
2904 memcpy(murb, urb, sizeof(struct urb));
2905
2906 murb->transfer_buffer_length = 4096;
2907 murb->transfer_buffer = transfer_buffer + i * 4096;
2908
2909 /* Null pointer for the encodes that this is a micro urb */
2910 murb->complete = NULL;
2911
2912 ((struct oxu_murb *) murb)->main = urb;
2913 ((struct oxu_murb *) murb)->last = 0;
2914
2915 /* This loop is to guarantee urb to be processed when there's
2916 * not enough resources at a particular time by retrying.
2917 */
2918 do {
2919 ret = __oxu_urb_enqueue(hcd, murb, mem_flags);
2920 if (ret)
2921 schedule();
2922 } while (ret);
2923 }
2924
2925 /* Last urb requires special handling */
2926
2927 /* Get free micro URB poll till a free urb is recieved */
2928 do {
2929 murb = (struct urb *) oxu_murb_alloc(oxu);
2930 if (!murb)
2931 schedule();
2932 } while (!murb);
2933
2934 /* Coping the urb */
2935 memcpy(murb, urb, sizeof(struct urb));
2936
2937 murb->transfer_buffer_length = rem > 0 ? rem : 4096;
2938 murb->transfer_buffer = transfer_buffer + (num - 1) * 4096;
2939
2940 /* Null pointer for the encodes that this is a micro urb */
2941 murb->complete = NULL;
2942
2943 ((struct oxu_murb *) murb)->main = urb;
2944 ((struct oxu_murb *) murb)->last = 1;
2945
2946 do {
2947 ret = __oxu_urb_enqueue(hcd, murb, mem_flags);
2948 if (ret)
2949 schedule();
2950 } while (ret);
2951
2952 return ret;
2953}
2954
2955/* Remove from hardware lists.
2956 * Completions normally happen asynchronously
2957 */
2958static int oxu_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status)
2959{
2960 struct oxu_hcd *oxu = hcd_to_oxu(hcd);
2961 struct ehci_qh *qh;
2962 unsigned long flags;
2963
2964 spin_lock_irqsave(&oxu->lock, flags);
2965 switch (usb_pipetype(urb->pipe)) {
2966 case PIPE_CONTROL:
2967 case PIPE_BULK:
2968 default:
2969 qh = (struct ehci_qh *) urb->hcpriv;
2970 if (!qh)
2971 break;
2972 unlink_async(oxu, qh);
2973 break;
2974
2975 case PIPE_INTERRUPT:
2976 qh = (struct ehci_qh *) urb->hcpriv;
2977 if (!qh)
2978 break;
2979 switch (qh->qh_state) {
2980 case QH_STATE_LINKED:
2981 intr_deschedule(oxu, qh);
2982 /* FALL THROUGH */
2983 case QH_STATE_IDLE:
2984 qh_completions(oxu, qh);
2985 break;
2986 default:
2987 oxu_dbg(oxu, "bogus qh %p state %d\n",
2988 qh, qh->qh_state);
2989 goto done;
2990 }
2991
2992 /* reschedule QH iff another request is queued */
2993 if (!list_empty(&qh->qtd_list)
2994 && HC_IS_RUNNING(hcd->state)) {
2995 int status;
2996
2997 status = qh_schedule(oxu, qh);
2998 spin_unlock_irqrestore(&oxu->lock, flags);
2999
3000 if (status != 0) {
3001 /* shouldn't happen often, but ...
3002 * FIXME kill those tds' urbs
3003 */
3004 err("can't reschedule qh %p, err %d",
3005 qh, status);
3006 }
3007 return status;
3008 }
3009 break;
3010 }
3011done:
3012 spin_unlock_irqrestore(&oxu->lock, flags);
3013 return 0;
3014}
3015
3016/* Bulk qh holds the data toggle */
3017static void oxu_endpoint_disable(struct usb_hcd *hcd,
3018 struct usb_host_endpoint *ep)
3019{
3020 struct oxu_hcd *oxu = hcd_to_oxu(hcd);
3021 unsigned long flags;
3022 struct ehci_qh *qh, *tmp;
3023
3024 /* ASSERT: any requests/urbs are being unlinked */
3025 /* ASSERT: nobody can be submitting urbs for this any more */
3026
3027rescan:
3028 spin_lock_irqsave(&oxu->lock, flags);
3029 qh = ep->hcpriv;
3030 if (!qh)
3031 goto done;
3032
3033 /* endpoints can be iso streams. for now, we don't
3034 * accelerate iso completions ... so spin a while.
3035 */
3036 if (qh->hw_info1 == 0) {
3037 oxu_vdbg(oxu, "iso delay\n");
3038 goto idle_timeout;
3039 }
3040
3041 if (!HC_IS_RUNNING(hcd->state))
3042 qh->qh_state = QH_STATE_IDLE;
3043 switch (qh->qh_state) {
3044 case QH_STATE_LINKED:
3045 for (tmp = oxu->async->qh_next.qh;
3046 tmp && tmp != qh;
3047 tmp = tmp->qh_next.qh)
3048 continue;
3049 /* periodic qh self-unlinks on empty */
3050 if (!tmp)
3051 goto nogood;
3052 unlink_async(oxu, qh);
3053 /* FALL THROUGH */
3054 case QH_STATE_UNLINK: /* wait for hw to finish? */
3055idle_timeout:
3056 spin_unlock_irqrestore(&oxu->lock, flags);
3057 schedule_timeout_uninterruptible(1);
3058 goto rescan;
3059 case QH_STATE_IDLE: /* fully unlinked */
3060 if (list_empty(&qh->qtd_list)) {
3061 qh_put(qh);
3062 break;
3063 }
3064 /* else FALL THROUGH */
3065 default:
3066nogood:
3067 /* caller was supposed to have unlinked any requests;
3068 * that's not our job. just leak this memory.
3069 */
3070 oxu_err(oxu, "qh %p (#%02x) state %d%s\n",
3071 qh, ep->desc.bEndpointAddress, qh->qh_state,
3072 list_empty(&qh->qtd_list) ? "" : "(has tds)");
3073 break;
3074 }
3075 ep->hcpriv = NULL;
3076done:
3077 spin_unlock_irqrestore(&oxu->lock, flags);
3078 return;
3079}
3080
3081static int oxu_get_frame(struct usb_hcd *hcd)
3082{
3083 struct oxu_hcd *oxu = hcd_to_oxu(hcd);
3084
3085 return (readl(&oxu->regs->frame_index) >> 3) %
3086 oxu->periodic_size;
3087}
3088
3089/* Build "status change" packet (one or two bytes) from HC registers */
3090static int oxu_hub_status_data(struct usb_hcd *hcd, char *buf)
3091{
3092 struct oxu_hcd *oxu = hcd_to_oxu(hcd);
3093 u32 temp, mask, status = 0;
3094 int ports, i, retval = 1;
3095 unsigned long flags;
3096
3097 /* if !USB_SUSPEND, root hub timers won't get shut down ... */
3098 if (!HC_IS_RUNNING(hcd->state))
3099 return 0;
3100
3101 /* init status to no-changes */
3102 buf[0] = 0;
3103 ports = HCS_N_PORTS(oxu->hcs_params);
3104 if (ports > 7) {
3105 buf[1] = 0;
3106 retval++;
3107 }
3108
3109 /* Some boards (mostly VIA?) report bogus overcurrent indications,
3110 * causing massive log spam unless we completely ignore them. It
3111 * may be relevant that VIA VT8235 controlers, where PORT_POWER is
3112 * always set, seem to clear PORT_OCC and PORT_CSC when writing to
3113 * PORT_POWER; that's surprising, but maybe within-spec.
3114 */
3115 if (!ignore_oc)
3116 mask = PORT_CSC | PORT_PEC | PORT_OCC;
3117 else
3118 mask = PORT_CSC | PORT_PEC;
3119
3120 /* no hub change reports (bit 0) for now (power, ...) */
3121
3122 /* port N changes (bit N)? */
3123 spin_lock_irqsave(&oxu->lock, flags);
3124 for (i = 0; i < ports; i++) {
3125 temp = readl(&oxu->regs->port_status[i]);
3126
3127 /*
3128 * Return status information even for ports with OWNER set.
3129 * Otherwise khubd wouldn't see the disconnect event when a
3130 * high-speed device is switched over to the companion
3131 * controller by the user.
3132 */
3133
3134 if (!(temp & PORT_CONNECT))
3135 oxu->reset_done[i] = 0;
3136 if ((temp & mask) != 0 || ((temp & PORT_RESUME) != 0 &&
3137 time_after_eq(jiffies, oxu->reset_done[i]))) {
3138 if (i < 7)
3139 buf[0] |= 1 << (i + 1);
3140 else
3141 buf[1] |= 1 << (i - 7);
3142 status = STS_PCD;
3143 }
3144 }
3145 /* FIXME autosuspend idle root hubs */
3146 spin_unlock_irqrestore(&oxu->lock, flags);
3147 return status ? retval : 0;
3148}
3149
3150/* Returns the speed of a device attached to a port on the root hub. */
3151static inline unsigned int oxu_port_speed(struct oxu_hcd *oxu,
3152 unsigned int portsc)
3153{
3154 switch ((portsc >> 26) & 3) {
3155 case 0:
3156 return 0;
3157 case 1:
3158 return 1 << USB_PORT_FEAT_LOWSPEED;
3159 case 2:
3160 default:
3161 return 1 << USB_PORT_FEAT_HIGHSPEED;
3162 }
3163}
3164
3165#define PORT_WAKE_BITS (PORT_WKOC_E|PORT_WKDISC_E|PORT_WKCONN_E)
3166static int oxu_hub_control(struct usb_hcd *hcd, u16 typeReq,
3167 u16 wValue, u16 wIndex, char *buf, u16 wLength)
3168{
3169 struct oxu_hcd *oxu = hcd_to_oxu(hcd);
3170 int ports = HCS_N_PORTS(oxu->hcs_params);
3171 u32 __iomem *status_reg = &oxu->regs->port_status[wIndex - 1];
3172 u32 temp, status;
3173 unsigned long flags;
3174 int retval = 0;
3175 unsigned selector;
3176
3177 /*
3178 * FIXME: support SetPortFeatures USB_PORT_FEAT_INDICATOR.
3179 * HCS_INDICATOR may say we can change LEDs to off/amber/green.
3180 * (track current state ourselves) ... blink for diagnostics,
3181 * power, "this is the one", etc. EHCI spec supports this.
3182 */
3183
3184 spin_lock_irqsave(&oxu->lock, flags);
3185 switch (typeReq) {
3186 case ClearHubFeature:
3187 switch (wValue) {
3188 case C_HUB_LOCAL_POWER:
3189 case C_HUB_OVER_CURRENT:
3190 /* no hub-wide feature/status flags */
3191 break;
3192 default:
3193 goto error;
3194 }
3195 break;
3196 case ClearPortFeature:
3197 if (!wIndex || wIndex > ports)
3198 goto error;
3199 wIndex--;
3200 temp = readl(status_reg);
3201
3202 /*
3203 * Even if OWNER is set, so the port is owned by the
3204 * companion controller, khubd needs to be able to clear
3205 * the port-change status bits (especially
3206 * USB_PORT_FEAT_C_CONNECTION).
3207 */
3208
3209 switch (wValue) {
3210 case USB_PORT_FEAT_ENABLE:
3211 writel(temp & ~PORT_PE, status_reg);
3212 break;
3213 case USB_PORT_FEAT_C_ENABLE:
3214 writel((temp & ~PORT_RWC_BITS) | PORT_PEC, status_reg);
3215 break;
3216 case USB_PORT_FEAT_SUSPEND:
3217 if (temp & PORT_RESET)
3218 goto error;
3219 if (temp & PORT_SUSPEND) {
3220 if ((temp & PORT_PE) == 0)
3221 goto error;
3222 /* resume signaling for 20 msec */
3223 temp &= ~(PORT_RWC_BITS | PORT_WAKE_BITS);
3224 writel(temp | PORT_RESUME, status_reg);
3225 oxu->reset_done[wIndex] = jiffies
3226 + msecs_to_jiffies(20);
3227 }
3228 break;
3229 case USB_PORT_FEAT_C_SUSPEND:
3230 /* we auto-clear this feature */
3231 break;
3232 case USB_PORT_FEAT_POWER:
3233 if (HCS_PPC(oxu->hcs_params))
3234 writel(temp & ~(PORT_RWC_BITS | PORT_POWER),
3235 status_reg);
3236 break;
3237 case USB_PORT_FEAT_C_CONNECTION:
3238 writel((temp & ~PORT_RWC_BITS) | PORT_CSC, status_reg);
3239 break;
3240 case USB_PORT_FEAT_C_OVER_CURRENT:
3241 writel((temp & ~PORT_RWC_BITS) | PORT_OCC, status_reg);
3242 break;
3243 case USB_PORT_FEAT_C_RESET:
3244 /* GetPortStatus clears reset */
3245 break;
3246 default:
3247 goto error;
3248 }
3249 readl(&oxu->regs->command); /* unblock posted write */
3250 break;
3251 case GetHubDescriptor:
3252 ehci_hub_descriptor(oxu, (struct usb_hub_descriptor *)
3253 buf);
3254 break;
3255 case GetHubStatus:
3256 /* no hub-wide feature/status flags */
3257 memset(buf, 0, 4);
3258 break;
3259 case GetPortStatus:
3260 if (!wIndex || wIndex > ports)
3261 goto error;
3262 wIndex--;
3263 status = 0;
3264 temp = readl(status_reg);
3265
3266 /* wPortChange bits */
3267 if (temp & PORT_CSC)
3268 status |= 1 << USB_PORT_FEAT_C_CONNECTION;
3269 if (temp & PORT_PEC)
3270 status |= 1 << USB_PORT_FEAT_C_ENABLE;
3271 if ((temp & PORT_OCC) && !ignore_oc)
3272 status |= 1 << USB_PORT_FEAT_C_OVER_CURRENT;
3273
3274 /* whoever resumes must GetPortStatus to complete it!! */
3275 if (temp & PORT_RESUME) {
3276
3277 /* Remote Wakeup received? */
3278 if (!oxu->reset_done[wIndex]) {
3279 /* resume signaling for 20 msec */
3280 oxu->reset_done[wIndex] = jiffies
3281 + msecs_to_jiffies(20);
3282 /* check the port again */
3283 mod_timer(&oxu_to_hcd(oxu)->rh_timer,
3284 oxu->reset_done[wIndex]);
3285 }
3286
3287 /* resume completed? */
3288 else if (time_after_eq(jiffies,
3289 oxu->reset_done[wIndex])) {
3290 status |= 1 << USB_PORT_FEAT_C_SUSPEND;
3291 oxu->reset_done[wIndex] = 0;
3292
3293 /* stop resume signaling */
3294 temp = readl(status_reg);
3295 writel(temp & ~(PORT_RWC_BITS | PORT_RESUME),
3296 status_reg);
3297 retval = handshake(oxu, status_reg,
3298 PORT_RESUME, 0, 2000 /* 2msec */);
3299 if (retval != 0) {
3300 oxu_err(oxu,
3301 "port %d resume error %d\n",
3302 wIndex + 1, retval);
3303 goto error;
3304 }
3305 temp &= ~(PORT_SUSPEND|PORT_RESUME|(3<<10));
3306 }
3307 }
3308
3309 /* whoever resets must GetPortStatus to complete it!! */
3310 if ((temp & PORT_RESET)
3311 && time_after_eq(jiffies,
3312 oxu->reset_done[wIndex])) {
3313 status |= 1 << USB_PORT_FEAT_C_RESET;
3314 oxu->reset_done[wIndex] = 0;
3315
3316 /* force reset to complete */
3317 writel(temp & ~(PORT_RWC_BITS | PORT_RESET),
3318 status_reg);
3319 /* REVISIT: some hardware needs 550+ usec to clear
3320 * this bit; seems too long to spin routinely...
3321 */
3322 retval = handshake(oxu, status_reg,
3323 PORT_RESET, 0, 750);
3324 if (retval != 0) {
3325 oxu_err(oxu, "port %d reset error %d\n",
3326 wIndex + 1, retval);
3327 goto error;
3328 }
3329
3330 /* see what we found out */
3331 temp = check_reset_complete(oxu, wIndex, status_reg,
3332 readl(status_reg));
3333 }
3334
3335 /* transfer dedicated ports to the companion hc */
3336 if ((temp & PORT_CONNECT) &&
3337 test_bit(wIndex, &oxu->companion_ports)) {
3338 temp &= ~PORT_RWC_BITS;
3339 temp |= PORT_OWNER;
3340 writel(temp, status_reg);
3341 oxu_dbg(oxu, "port %d --> companion\n", wIndex + 1);
3342 temp = readl(status_reg);
3343 }
3344
3345 /*
3346 * Even if OWNER is set, there's no harm letting khubd
3347 * see the wPortStatus values (they should all be 0 except
3348 * for PORT_POWER anyway).
3349 */
3350
3351 if (temp & PORT_CONNECT) {
3352 status |= 1 << USB_PORT_FEAT_CONNECTION;
3353 /* status may be from integrated TT */
3354 status |= oxu_port_speed(oxu, temp);
3355 }
3356 if (temp & PORT_PE)
3357 status |= 1 << USB_PORT_FEAT_ENABLE;
3358 if (temp & (PORT_SUSPEND|PORT_RESUME))
3359 status |= 1 << USB_PORT_FEAT_SUSPEND;
3360 if (temp & PORT_OC)
3361 status |= 1 << USB_PORT_FEAT_OVER_CURRENT;
3362 if (temp & PORT_RESET)
3363 status |= 1 << USB_PORT_FEAT_RESET;
3364 if (temp & PORT_POWER)
3365 status |= 1 << USB_PORT_FEAT_POWER;
3366
3367#ifndef OXU_VERBOSE_DEBUG
3368 if (status & ~0xffff) /* only if wPortChange is interesting */
3369#endif
3370 dbg_port(oxu, "GetStatus", wIndex + 1, temp);
3371 put_unaligned(cpu_to_le32(status), (__le32 *) buf);
3372 break;
3373 case SetHubFeature:
3374 switch (wValue) {
3375 case C_HUB_LOCAL_POWER:
3376 case C_HUB_OVER_CURRENT:
3377 /* no hub-wide feature/status flags */
3378 break;
3379 default:
3380 goto error;
3381 }
3382 break;
3383 case SetPortFeature:
3384 selector = wIndex >> 8;
3385 wIndex &= 0xff;
3386 if (!wIndex || wIndex > ports)
3387 goto error;
3388 wIndex--;
3389 temp = readl(status_reg);
3390 if (temp & PORT_OWNER)
3391 break;
3392
3393 temp &= ~PORT_RWC_BITS;
3394 switch (wValue) {
3395 case USB_PORT_FEAT_SUSPEND:
3396 if ((temp & PORT_PE) == 0
3397 || (temp & PORT_RESET) != 0)
3398 goto error;
3399 if (device_may_wakeup(&hcd->self.root_hub->dev))
3400 temp |= PORT_WAKE_BITS;
3401 writel(temp | PORT_SUSPEND, status_reg);
3402 break;
3403 case USB_PORT_FEAT_POWER:
3404 if (HCS_PPC(oxu->hcs_params))
3405 writel(temp | PORT_POWER, status_reg);
3406 break;
3407 case USB_PORT_FEAT_RESET:
3408 if (temp & PORT_RESUME)
3409 goto error;
3410 /* line status bits may report this as low speed,
3411 * which can be fine if this root hub has a
3412 * transaction translator built in.
3413 */
3414 oxu_vdbg(oxu, "port %d reset\n", wIndex + 1);
3415 temp |= PORT_RESET;
3416 temp &= ~PORT_PE;
3417
3418 /*
3419 * caller must wait, then call GetPortStatus
3420 * usb 2.0 spec says 50 ms resets on root
3421 */
3422 oxu->reset_done[wIndex] = jiffies
3423 + msecs_to_jiffies(50);
3424 writel(temp, status_reg);
3425 break;
3426
3427 /* For downstream facing ports (these): one hub port is put
3428 * into test mode according to USB2 11.24.2.13, then the hub
3429 * must be reset (which for root hub now means rmmod+modprobe,
3430 * or else system reboot). See EHCI 2.3.9 and 4.14 for info
3431 * about the EHCI-specific stuff.
3432 */
3433 case USB_PORT_FEAT_TEST:
3434 if (!selector || selector > 5)
3435 goto error;
3436 ehci_quiesce(oxu);
3437 ehci_halt(oxu);
3438 temp |= selector << 16;
3439 writel(temp, status_reg);
3440 break;
3441
3442 default:
3443 goto error;
3444 }
3445 readl(&oxu->regs->command); /* unblock posted writes */
3446 break;
3447
3448 default:
3449error:
3450 /* "stall" on error */
3451 retval = -EPIPE;
3452 }
3453 spin_unlock_irqrestore(&oxu->lock, flags);
3454 return retval;
3455}
3456
3457#ifdef CONFIG_PM
3458
3459static int oxu_bus_suspend(struct usb_hcd *hcd)
3460{
3461 struct oxu_hcd *oxu = hcd_to_oxu(hcd);
3462 int port;
3463 int mask;
3464
3465 oxu_dbg(oxu, "suspend root hub\n");
3466
3467 if (time_before(jiffies, oxu->next_statechange))
3468 msleep(5);
3469
3470 port = HCS_N_PORTS(oxu->hcs_params);
3471 spin_lock_irq(&oxu->lock);
3472
3473 /* stop schedules, clean any completed work */
3474 if (HC_IS_RUNNING(hcd->state)) {
3475 ehci_quiesce(oxu);
3476 hcd->state = HC_STATE_QUIESCING;
3477 }
3478 oxu->command = readl(&oxu->regs->command);
3479 if (oxu->reclaim)
3480 oxu->reclaim_ready = 1;
3481 ehci_work(oxu);
3482
3483 /* Unlike other USB host controller types, EHCI doesn't have
3484 * any notion of "global" or bus-wide suspend. The driver has
3485 * to manually suspend all the active unsuspended ports, and
3486 * then manually resume them in the bus_resume() routine.
3487 */
3488 oxu->bus_suspended = 0;
3489 while (port--) {
3490 u32 __iomem *reg = &oxu->regs->port_status[port];
3491 u32 t1 = readl(reg) & ~PORT_RWC_BITS;
3492 u32 t2 = t1;
3493
3494 /* keep track of which ports we suspend */
3495 if ((t1 & PORT_PE) && !(t1 & PORT_OWNER) &&
3496 !(t1 & PORT_SUSPEND)) {
3497 t2 |= PORT_SUSPEND;
3498 set_bit(port, &oxu->bus_suspended);
3499 }
3500
3501 /* enable remote wakeup on all ports */
3502 if (device_may_wakeup(&hcd->self.root_hub->dev))
3503 t2 |= PORT_WKOC_E|PORT_WKDISC_E|PORT_WKCONN_E;
3504 else
3505 t2 &= ~(PORT_WKOC_E|PORT_WKDISC_E|PORT_WKCONN_E);
3506
3507 if (t1 != t2) {
3508 oxu_vdbg(oxu, "port %d, %08x -> %08x\n",
3509 port + 1, t1, t2);
3510 writel(t2, reg);
3511 }
3512 }
3513
3514 /* turn off now-idle HC */
3515 del_timer_sync(&oxu->watchdog);
3516 ehci_halt(oxu);
3517 hcd->state = HC_STATE_SUSPENDED;
3518
3519 /* allow remote wakeup */
3520 mask = INTR_MASK;
3521 if (!device_may_wakeup(&hcd->self.root_hub->dev))
3522 mask &= ~STS_PCD;
3523 writel(mask, &oxu->regs->intr_enable);
3524 readl(&oxu->regs->intr_enable);
3525
3526 oxu->next_statechange = jiffies + msecs_to_jiffies(10);
3527 spin_unlock_irq(&oxu->lock);
3528 return 0;
3529}
3530
3531/* Caller has locked the root hub, and should reset/reinit on error */
3532static int oxu_bus_resume(struct usb_hcd *hcd)
3533{
3534 struct oxu_hcd *oxu = hcd_to_oxu(hcd);
3535 u32 temp;
3536 int i;
3537
3538 if (time_before(jiffies, oxu->next_statechange))
3539 msleep(5);
3540 spin_lock_irq(&oxu->lock);
3541
3542 /* Ideally and we've got a real resume here, and no port's power
3543 * was lost. (For PCI, that means Vaux was maintained.) But we
3544 * could instead be restoring a swsusp snapshot -- so that BIOS was
3545 * the last user of the controller, not reset/pm hardware keeping
3546 * state we gave to it.
3547 */
3548 temp = readl(&oxu->regs->intr_enable);
3549 oxu_dbg(oxu, "resume root hub%s\n", temp ? "" : " after power loss");
3550
3551 /* at least some APM implementations will try to deliver
3552 * IRQs right away, so delay them until we're ready.
3553 */
3554 writel(0, &oxu->regs->intr_enable);
3555
3556 /* re-init operational registers */
3557 writel(0, &oxu->regs->segment);
3558 writel(oxu->periodic_dma, &oxu->regs->frame_list);
3559 writel((u32) oxu->async->qh_dma, &oxu->regs->async_next);
3560
3561 /* restore CMD_RUN, framelist size, and irq threshold */
3562 writel(oxu->command, &oxu->regs->command);
3563
3564 /* Some controller/firmware combinations need a delay during which
3565 * they set up the port statuses. See Bugzilla #8190. */
3566 mdelay(8);
3567
3568 /* manually resume the ports we suspended during bus_suspend() */
3569 i = HCS_N_PORTS(oxu->hcs_params);
3570 while (i--) {
3571 temp = readl(&oxu->regs->port_status[i]);
3572 temp &= ~(PORT_RWC_BITS
3573 | PORT_WKOC_E | PORT_WKDISC_E | PORT_WKCONN_E);
3574 if (test_bit(i, &oxu->bus_suspended) && (temp & PORT_SUSPEND)) {
3575 oxu->reset_done[i] = jiffies + msecs_to_jiffies(20);
3576 temp |= PORT_RESUME;
3577 }
3578 writel(temp, &oxu->regs->port_status[i]);
3579 }
3580 i = HCS_N_PORTS(oxu->hcs_params);
3581 mdelay(20);
3582 while (i--) {
3583 temp = readl(&oxu->regs->port_status[i]);
3584 if (test_bit(i, &oxu->bus_suspended) && (temp & PORT_SUSPEND)) {
3585 temp &= ~(PORT_RWC_BITS | PORT_RESUME);
3586 writel(temp, &oxu->regs->port_status[i]);
3587 oxu_vdbg(oxu, "resumed port %d\n", i + 1);
3588 }
3589 }
3590 (void) readl(&oxu->regs->command);
3591
3592 /* maybe re-activate the schedule(s) */
3593 temp = 0;
3594 if (oxu->async->qh_next.qh)
3595 temp |= CMD_ASE;
3596 if (oxu->periodic_sched)
3597 temp |= CMD_PSE;
3598 if (temp) {
3599 oxu->command |= temp;
3600 writel(oxu->command, &oxu->regs->command);
3601 }
3602
3603 oxu->next_statechange = jiffies + msecs_to_jiffies(5);
3604 hcd->state = HC_STATE_RUNNING;
3605
3606 /* Now we can safely re-enable irqs */
3607 writel(INTR_MASK, &oxu->regs->intr_enable);
3608
3609 spin_unlock_irq(&oxu->lock);
3610 return 0;
3611}
3612
3613#else
3614
3615static int oxu_bus_suspend(struct usb_hcd *hcd)
3616{
3617 return 0;
3618}
3619
3620static int oxu_bus_resume(struct usb_hcd *hcd)
3621{
3622 return 0;
3623}
3624
3625#endif /* CONFIG_PM */
3626
3627static const struct hc_driver oxu_hc_driver = {
3628 .description = "oxu210hp_hcd",
3629 .product_desc = "oxu210hp HCD",
3630 .hcd_priv_size = sizeof(struct oxu_hcd),
3631
3632 /*
3633 * Generic hardware linkage
3634 */
3635 .irq = oxu_irq,
3636 .flags = HCD_MEMORY | HCD_USB2,
3637
3638 /*
3639 * Basic lifecycle operations
3640 */
3641 .reset = oxu_reset,
3642 .start = oxu_run,
3643 .stop = oxu_stop,
3644 .shutdown = oxu_shutdown,
3645
3646 /*
3647 * Managing i/o requests and associated device resources
3648 */
3649 .urb_enqueue = oxu_urb_enqueue,
3650 .urb_dequeue = oxu_urb_dequeue,
3651 .endpoint_disable = oxu_endpoint_disable,
3652
3653 /*
3654 * Scheduling support
3655 */
3656 .get_frame_number = oxu_get_frame,
3657
3658 /*
3659 * Root hub support
3660 */
3661 .hub_status_data = oxu_hub_status_data,
3662 .hub_control = oxu_hub_control,
3663 .bus_suspend = oxu_bus_suspend,
3664 .bus_resume = oxu_bus_resume,
3665};
3666
3667/*
3668 * Module stuff
3669 */
3670
3671static void oxu_configuration(struct platform_device *pdev, void *base)
3672{
3673 u32 tmp;
3674
3675 /* Initialize top level registers.
3676 * First write ever
3677 */
3678 oxu_writel(base, OXU_HOSTIFCONFIG, 0x0000037D);
3679 oxu_writel(base, OXU_SOFTRESET, OXU_SRESET);
3680 oxu_writel(base, OXU_HOSTIFCONFIG, 0x0000037D);
3681
3682 tmp = oxu_readl(base, OXU_PIOBURSTREADCTRL);
3683 oxu_writel(base, OXU_PIOBURSTREADCTRL, tmp | 0x0040);
3684
3685 oxu_writel(base, OXU_ASO, OXU_SPHPOEN | OXU_OVRCCURPUPDEN |
3686 OXU_COMPARATOR | OXU_ASO_OP);
3687
3688 tmp = oxu_readl(base, OXU_CLKCTRL_SET);
3689 oxu_writel(base, OXU_CLKCTRL_SET, tmp | OXU_SYSCLKEN | OXU_USBOTGCLKEN);
3690
3691 /* Clear all top interrupt enable */
3692 oxu_writel(base, OXU_CHIPIRQEN_CLR, 0xff);
3693
3694 /* Clear all top interrupt status */
3695 oxu_writel(base, OXU_CHIPIRQSTATUS, 0xff);
3696
3697 /* Enable all needed top interrupt except OTG SPH core */
3698 oxu_writel(base, OXU_CHIPIRQEN_SET, OXU_USBSPHLPWUI | OXU_USBOTGLPWUI);
3699}
3700
3701static int oxu_verify_id(struct platform_device *pdev, void *base)
3702{
3703 u32 id;
3704 char *bo[] = {
3705 "reserved",
3706 "128-pin LQFP",
3707 "84-pin TFBGA",
3708 "reserved",
3709 };
3710
3711 /* Read controller signature register to find a match */
3712 id = oxu_readl(base, OXU_DEVICEID);
3713 dev_info(&pdev->dev, "device ID %x\n", id);
3714 if ((id & OXU_REV_MASK) != (OXU_REV_2100 << OXU_REV_SHIFT))
3715 return -1;
3716
3717 dev_info(&pdev->dev, "found device %x %s (%04x:%04x)\n",
3718 id >> OXU_REV_SHIFT,
3719 bo[(id & OXU_BO_MASK) >> OXU_BO_SHIFT],
3720 (id & OXU_MAJ_REV_MASK) >> OXU_MAJ_REV_SHIFT,
3721 (id & OXU_MIN_REV_MASK) >> OXU_MIN_REV_SHIFT);
3722
3723 return 0;
3724}
3725
3726static const struct hc_driver oxu_hc_driver;
3727static struct usb_hcd *oxu_create(struct platform_device *pdev,
3728 unsigned long memstart, unsigned long memlen,
3729 void *base, int irq, int otg)
3730{
3731 struct device *dev = &pdev->dev;
3732
3733 struct usb_hcd *hcd;
3734 struct oxu_hcd *oxu;
3735 int ret;
3736
3737 /* Set endian mode and host mode */
3738 oxu_writel(base + (otg ? OXU_OTG_CORE_OFFSET : OXU_SPH_CORE_OFFSET),
3739 OXU_USBMODE,
3740 OXU_CM_HOST_ONLY | OXU_ES_LITTLE | OXU_VBPS);
3741
3742 hcd = usb_create_hcd(&oxu_hc_driver, dev,
3743 otg ? "oxu210hp_otg" : "oxu210hp_sph");
3744 if (!hcd)
3745 return ERR_PTR(-ENOMEM);
3746
3747 hcd->rsrc_start = memstart;
3748 hcd->rsrc_len = memlen;
3749 hcd->regs = base;
3750 hcd->irq = irq;
3751 hcd->state = HC_STATE_HALT;
3752
3753 oxu = hcd_to_oxu(hcd);
3754 oxu->is_otg = otg;
3755
3756 ret = usb_add_hcd(hcd, irq, IRQF_SHARED);
3757 if (ret < 0)
3758 return ERR_PTR(ret);
3759
3760 return hcd;
3761}
3762
3763static int oxu_init(struct platform_device *pdev,
3764 unsigned long memstart, unsigned long memlen,
3765 void *base, int irq)
3766{
3767 struct oxu_info *info = platform_get_drvdata(pdev);
3768 struct usb_hcd *hcd;
3769 int ret;
3770
3771 /* First time configuration at start up */
3772 oxu_configuration(pdev, base);
3773
3774 ret = oxu_verify_id(pdev, base);
3775 if (ret) {
3776 dev_err(&pdev->dev, "no devices found!\n");
3777 return -ENODEV;
3778 }
3779
3780 /* Create the OTG controller */
3781 hcd = oxu_create(pdev, memstart, memlen, base, irq, 1);
3782 if (IS_ERR(hcd)) {
3783 dev_err(&pdev->dev, "cannot create OTG controller!\n");
3784 ret = PTR_ERR(hcd);
3785 goto error_create_otg;
3786 }
3787 info->hcd[0] = hcd;
3788
3789 /* Create the SPH host controller */
3790 hcd = oxu_create(pdev, memstart, memlen, base, irq, 0);
3791 if (IS_ERR(hcd)) {
3792 dev_err(&pdev->dev, "cannot create SPH controller!\n");
3793 ret = PTR_ERR(hcd);
3794 goto error_create_sph;
3795 }
3796 info->hcd[1] = hcd;
3797
3798 oxu_writel(base, OXU_CHIPIRQEN_SET,
3799 oxu_readl(base, OXU_CHIPIRQEN_SET) | 3);
3800
3801 return 0;
3802
3803error_create_sph:
3804 usb_remove_hcd(info->hcd[0]);
3805 usb_put_hcd(info->hcd[0]);
3806
3807error_create_otg:
3808 return ret;
3809}
3810
3811static int oxu_drv_probe(struct platform_device *pdev)
3812{
3813 struct resource *res;
3814 void *base;
3815 unsigned long memstart, memlen;
3816 int irq, ret;
3817 struct oxu_info *info;
3818
3819 if (usb_disabled())
3820 return -ENODEV;
3821
3822 /*
3823 * Get the platform resources
3824 */
3825 res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
3826 if (!res) {
3827 dev_err(&pdev->dev,
3828 "no IRQ! Check %s setup!\n", dev_name(&pdev->dev));
3829 return -ENODEV;
3830 }
3831 irq = res->start;
3832 dev_dbg(&pdev->dev, "IRQ resource %d\n", irq);
3833
3834 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
3835 if (!res) {
3836 dev_err(&pdev->dev, "no registers address! Check %s setup!\n",
3837 dev_name(&pdev->dev));
3838 return -ENODEV;
3839 }
3840 memstart = res->start;
3841 memlen = res->end - res->start + 1;
3842 dev_dbg(&pdev->dev, "MEM resource %lx-%lx\n", memstart, memlen);
3843 if (!request_mem_region(memstart, memlen,
3844 oxu_hc_driver.description)) {
3845 dev_dbg(&pdev->dev, "memory area already in use\n");
3846 return -EBUSY;
3847 }
3848
3849 ret = set_irq_type(irq, IRQF_TRIGGER_FALLING);
3850 if (ret) {
3851 dev_err(&pdev->dev, "error setting irq type\n");
3852 ret = -EFAULT;
3853 goto error_set_irq_type;
3854 }
3855
3856 base = ioremap(memstart, memlen);
3857 if (!base) {
3858 dev_dbg(&pdev->dev, "error mapping memory\n");
3859 ret = -EFAULT;
3860 goto error_ioremap;
3861 }
3862
3863 /* Allocate a driver data struct to hold useful info for both
3864 * SPH & OTG devices
3865 */
3866 info = kzalloc(sizeof(struct oxu_info), GFP_KERNEL);
3867 if (!info) {
3868 dev_dbg(&pdev->dev, "error allocating memory\n");
3869 ret = -EFAULT;
3870 goto error_alloc;
3871 }
3872 platform_set_drvdata(pdev, info);
3873
3874 ret = oxu_init(pdev, memstart, memlen, base, irq);
3875 if (ret < 0) {
3876 dev_dbg(&pdev->dev, "cannot init USB devices\n");
3877 goto error_init;
3878 }
3879
3880 dev_info(&pdev->dev, "devices enabled and running\n");
3881 platform_set_drvdata(pdev, info);
3882
3883 return 0;
3884
3885error_init:
3886 kfree(info);
3887 platform_set_drvdata(pdev, NULL);
3888
3889error_alloc:
3890 iounmap(base);
3891
3892error_set_irq_type:
3893error_ioremap:
3894 release_mem_region(memstart, memlen);
3895
3896 dev_err(&pdev->dev, "init %s fail, %d\n", dev_name(&pdev->dev), ret);
3897 return ret;
3898}
3899
3900static void oxu_remove(struct platform_device *pdev, struct usb_hcd *hcd)
3901{
3902 usb_remove_hcd(hcd);
3903 usb_put_hcd(hcd);
3904}
3905
3906static int oxu_drv_remove(struct platform_device *pdev)
3907{
3908 struct oxu_info *info = platform_get_drvdata(pdev);
3909 unsigned long memstart = info->hcd[0]->rsrc_start,
3910 memlen = info->hcd[0]->rsrc_len;
3911 void *base = info->hcd[0]->regs;
3912
3913 oxu_remove(pdev, info->hcd[0]);
3914 oxu_remove(pdev, info->hcd[1]);
3915
3916 iounmap(base);
3917 release_mem_region(memstart, memlen);
3918
3919 kfree(info);
3920 platform_set_drvdata(pdev, NULL);
3921
3922 return 0;
3923}
3924
3925static void oxu_drv_shutdown(struct platform_device *pdev)
3926{
3927 oxu_drv_remove(pdev);
3928}
3929
3930#if 0
3931/* FIXME: TODO */
3932static int oxu_drv_suspend(struct device *dev)
3933{
3934 struct platform_device *pdev = to_platform_device(dev);
3935 struct usb_hcd *hcd = dev_get_drvdata(dev);
3936
3937 return 0;
3938}
3939
3940static int oxu_drv_resume(struct device *dev)
3941{
3942 struct platform_device *pdev = to_platform_device(dev);
3943 struct usb_hcd *hcd = dev_get_drvdata(dev);
3944
3945 return 0;
3946}
3947#else
3948#define oxu_drv_suspend NULL
3949#define oxu_drv_resume NULL
3950#endif
3951
3952static struct platform_driver oxu_driver = {
3953 .probe = oxu_drv_probe,
3954 .remove = oxu_drv_remove,
3955 .shutdown = oxu_drv_shutdown,
3956 .suspend = oxu_drv_suspend,
3957 .resume = oxu_drv_resume,
3958 .driver = {
3959 .name = "oxu210hp-hcd",
3960 .bus = &platform_bus_type
3961 }
3962};
3963
3964static int __init oxu_module_init(void)
3965{
3966 int retval = 0;
3967
3968 retval = platform_driver_register(&oxu_driver);
3969 if (retval < 0)
3970 return retval;
3971
3972 return retval;
3973}
3974
3975static void __exit oxu_module_cleanup(void)
3976{
3977 platform_driver_unregister(&oxu_driver);
3978}
3979
3980module_init(oxu_module_init);
3981module_exit(oxu_module_cleanup);
3982
3983MODULE_DESCRIPTION("Oxford OXU210HP HCD driver - ver. " DRIVER_VERSION);
3984MODULE_AUTHOR("Rodolfo Giometti <giometti@linux.it>");
3985MODULE_LICENSE("GPL");
diff --git a/drivers/usb/host/oxu210hp.h b/drivers/usb/host/oxu210hp.h
new file mode 100644
index 000000000000..8910e271cc7d
--- /dev/null
+++ b/drivers/usb/host/oxu210hp.h
@@ -0,0 +1,447 @@
1/*
2 * Host interface registers
3 */
4
5#define OXU_DEVICEID 0x00
6 #define OXU_REV_MASK 0xffff0000
7 #define OXU_REV_SHIFT 16
8 #define OXU_REV_2100 0x2100
9 #define OXU_BO_SHIFT 8
10 #define OXU_BO_MASK (0x3 << OXU_BO_SHIFT)
11 #define OXU_MAJ_REV_SHIFT 4
12 #define OXU_MAJ_REV_MASK (0xf << OXU_MAJ_REV_SHIFT)
13 #define OXU_MIN_REV_SHIFT 0
14 #define OXU_MIN_REV_MASK (0xf << OXU_MIN_REV_SHIFT)
15#define OXU_HOSTIFCONFIG 0x04
16#define OXU_SOFTRESET 0x08
17 #define OXU_SRESET (1 << 0)
18
19#define OXU_PIOBURSTREADCTRL 0x0C
20
21#define OXU_CHIPIRQSTATUS 0x10
22#define OXU_CHIPIRQEN_SET 0x14
23#define OXU_CHIPIRQEN_CLR 0x18
24 #define OXU_USBSPHLPWUI 0x00000080
25 #define OXU_USBOTGLPWUI 0x00000040
26 #define OXU_USBSPHI 0x00000002
27 #define OXU_USBOTGI 0x00000001
28
29#define OXU_CLKCTRL_SET 0x1C
30 #define OXU_SYSCLKEN 0x00000008
31 #define OXU_USBSPHCLKEN 0x00000002
32 #define OXU_USBOTGCLKEN 0x00000001
33
34#define OXU_ASO 0x68
35 #define OXU_SPHPOEN 0x00000100
36 #define OXU_OVRCCURPUPDEN 0x00000800
37 #define OXU_ASO_OP (1 << 10)
38 #define OXU_COMPARATOR 0x000004000
39
40#define OXU_USBMODE 0x1A8
41 #define OXU_VBPS 0x00000020
42 #define OXU_ES_LITTLE 0x00000000
43 #define OXU_CM_HOST_ONLY 0x00000003
44
45/*
46 * Proper EHCI structs & defines
47 */
48
49/* Magic numbers that can affect system performance */
50#define EHCI_TUNE_CERR 3 /* 0-3 qtd retries; 0 == don't stop */
51#define EHCI_TUNE_RL_HS 4 /* nak throttle; see 4.9 */
52#define EHCI_TUNE_RL_TT 0
53#define EHCI_TUNE_MULT_HS 1 /* 1-3 transactions/uframe; 4.10.3 */
54#define EHCI_TUNE_MULT_TT 1
55#define EHCI_TUNE_FLS 2 /* (small) 256 frame schedule */
56
57struct oxu_hcd;
58
59/* EHCI register interface, corresponds to EHCI Revision 0.95 specification */
60
61/* Section 2.2 Host Controller Capability Registers */
62struct ehci_caps {
63 /* these fields are specified as 8 and 16 bit registers,
64 * but some hosts can't perform 8 or 16 bit PCI accesses.
65 */
66 u32 hc_capbase;
67#define HC_LENGTH(p) (((p)>>00)&0x00ff) /* bits 7:0 */
68#define HC_VERSION(p) (((p)>>16)&0xffff) /* bits 31:16 */
69 u32 hcs_params; /* HCSPARAMS - offset 0x4 */
70#define HCS_DEBUG_PORT(p) (((p)>>20)&0xf) /* bits 23:20, debug port? */
71#define HCS_INDICATOR(p) ((p)&(1 << 16)) /* true: has port indicators */
72#define HCS_N_CC(p) (((p)>>12)&0xf) /* bits 15:12, #companion HCs */
73#define HCS_N_PCC(p) (((p)>>8)&0xf) /* bits 11:8, ports per CC */
74#define HCS_PORTROUTED(p) ((p)&(1 << 7)) /* true: port routing */
75#define HCS_PPC(p) ((p)&(1 << 4)) /* true: port power control */
76#define HCS_N_PORTS(p) (((p)>>0)&0xf) /* bits 3:0, ports on HC */
77
78 u32 hcc_params; /* HCCPARAMS - offset 0x8 */
79#define HCC_EXT_CAPS(p) (((p)>>8)&0xff) /* for pci extended caps */
80#define HCC_ISOC_CACHE(p) ((p)&(1 << 7)) /* true: can cache isoc frame */
81#define HCC_ISOC_THRES(p) (((p)>>4)&0x7) /* bits 6:4, uframes cached */
82#define HCC_CANPARK(p) ((p)&(1 << 2)) /* true: can park on async qh */
83#define HCC_PGM_FRAMELISTLEN(p) ((p)&(1 << 1)) /* true: periodic_size changes*/
84#define HCC_64BIT_ADDR(p) ((p)&(1)) /* true: can use 64-bit addr */
85 u8 portroute[8]; /* nibbles for routing - offset 0xC */
86} __attribute__ ((packed));
87
88
89/* Section 2.3 Host Controller Operational Registers */
90struct ehci_regs {
91 /* USBCMD: offset 0x00 */
92 u32 command;
93/* 23:16 is r/w intr rate, in microframes; default "8" == 1/msec */
94#define CMD_PARK (1<<11) /* enable "park" on async qh */
95#define CMD_PARK_CNT(c) (((c)>>8)&3) /* how many transfers to park for */
96#define CMD_LRESET (1<<7) /* partial reset (no ports, etc) */
97#define CMD_IAAD (1<<6) /* "doorbell" interrupt async advance */
98#define CMD_ASE (1<<5) /* async schedule enable */
99#define CMD_PSE (1<<4) /* periodic schedule enable */
100/* 3:2 is periodic frame list size */
101#define CMD_RESET (1<<1) /* reset HC not bus */
102#define CMD_RUN (1<<0) /* start/stop HC */
103
104 /* USBSTS: offset 0x04 */
105 u32 status;
106#define STS_ASS (1<<15) /* Async Schedule Status */
107#define STS_PSS (1<<14) /* Periodic Schedule Status */
108#define STS_RECL (1<<13) /* Reclamation */
109#define STS_HALT (1<<12) /* Not running (any reason) */
110/* some bits reserved */
111 /* these STS_* flags are also intr_enable bits (USBINTR) */
112#define STS_IAA (1<<5) /* Interrupted on async advance */
113#define STS_FATAL (1<<4) /* such as some PCI access errors */
114#define STS_FLR (1<<3) /* frame list rolled over */
115#define STS_PCD (1<<2) /* port change detect */
116#define STS_ERR (1<<1) /* "error" completion (overflow, ...) */
117#define STS_INT (1<<0) /* "normal" completion (short, ...) */
118
119#define INTR_MASK (STS_IAA | STS_FATAL | STS_PCD | STS_ERR | STS_INT)
120
121 /* USBINTR: offset 0x08 */
122 u32 intr_enable;
123
124 /* FRINDEX: offset 0x0C */
125 u32 frame_index; /* current microframe number */
126 /* CTRLDSSEGMENT: offset 0x10 */
127 u32 segment; /* address bits 63:32 if needed */
128 /* PERIODICLISTBASE: offset 0x14 */
129 u32 frame_list; /* points to periodic list */
130 /* ASYNCLISTADDR: offset 0x18 */
131 u32 async_next; /* address of next async queue head */
132
133 u32 reserved[9];
134
135 /* CONFIGFLAG: offset 0x40 */
136 u32 configured_flag;
137#define FLAG_CF (1<<0) /* true: we'll support "high speed" */
138
139 /* PORTSC: offset 0x44 */
140 u32 port_status[0]; /* up to N_PORTS */
141/* 31:23 reserved */
142#define PORT_WKOC_E (1<<22) /* wake on overcurrent (enable) */
143#define PORT_WKDISC_E (1<<21) /* wake on disconnect (enable) */
144#define PORT_WKCONN_E (1<<20) /* wake on connect (enable) */
145/* 19:16 for port testing */
146#define PORT_LED_OFF (0<<14)
147#define PORT_LED_AMBER (1<<14)
148#define PORT_LED_GREEN (2<<14)
149#define PORT_LED_MASK (3<<14)
150#define PORT_OWNER (1<<13) /* true: companion hc owns this port */
151#define PORT_POWER (1<<12) /* true: has power (see PPC) */
152#define PORT_USB11(x) (((x)&(3<<10)) == (1<<10)) /* USB 1.1 device */
153/* 11:10 for detecting lowspeed devices (reset vs release ownership) */
154/* 9 reserved */
155#define PORT_RESET (1<<8) /* reset port */
156#define PORT_SUSPEND (1<<7) /* suspend port */
157#define PORT_RESUME (1<<6) /* resume it */
158#define PORT_OCC (1<<5) /* over current change */
159#define PORT_OC (1<<4) /* over current active */
160#define PORT_PEC (1<<3) /* port enable change */
161#define PORT_PE (1<<2) /* port enable */
162#define PORT_CSC (1<<1) /* connect status change */
163#define PORT_CONNECT (1<<0) /* device connected */
164#define PORT_RWC_BITS (PORT_CSC | PORT_PEC | PORT_OCC)
165} __attribute__ ((packed));
166
167/* Appendix C, Debug port ... intended for use with special "debug devices"
168 * that can help if there's no serial console. (nonstandard enumeration.)
169 */
170struct ehci_dbg_port {
171 u32 control;
172#define DBGP_OWNER (1<<30)
173#define DBGP_ENABLED (1<<28)
174#define DBGP_DONE (1<<16)
175#define DBGP_INUSE (1<<10)
176#define DBGP_ERRCODE(x) (((x)>>7)&0x07)
177# define DBGP_ERR_BAD 1
178# define DBGP_ERR_SIGNAL 2
179#define DBGP_ERROR (1<<6)
180#define DBGP_GO (1<<5)
181#define DBGP_OUT (1<<4)
182#define DBGP_LEN(x) (((x)>>0)&0x0f)
183 u32 pids;
184#define DBGP_PID_GET(x) (((x)>>16)&0xff)
185#define DBGP_PID_SET(data, tok) (((data)<<8)|(tok))
186 u32 data03;
187 u32 data47;
188 u32 address;
189#define DBGP_EPADDR(dev, ep) (((dev)<<8)|(ep))
190} __attribute__ ((packed));
191
192
193#define QTD_NEXT(dma) cpu_to_le32((u32)dma)
194
195/*
196 * EHCI Specification 0.95 Section 3.5
197 * QTD: describe data transfer components (buffer, direction, ...)
198 * See Fig 3-6 "Queue Element Transfer Descriptor Block Diagram".
199 *
200 * These are associated only with "QH" (Queue Head) structures,
201 * used with control, bulk, and interrupt transfers.
202 */
203struct ehci_qtd {
204 /* first part defined by EHCI spec */
205 __le32 hw_next; /* see EHCI 3.5.1 */
206 __le32 hw_alt_next; /* see EHCI 3.5.2 */
207 __le32 hw_token; /* see EHCI 3.5.3 */
208#define QTD_TOGGLE (1 << 31) /* data toggle */
209#define QTD_LENGTH(tok) (((tok)>>16) & 0x7fff)
210#define QTD_IOC (1 << 15) /* interrupt on complete */
211#define QTD_CERR(tok) (((tok)>>10) & 0x3)
212#define QTD_PID(tok) (((tok)>>8) & 0x3)
213#define QTD_STS_ACTIVE (1 << 7) /* HC may execute this */
214#define QTD_STS_HALT (1 << 6) /* halted on error */
215#define QTD_STS_DBE (1 << 5) /* data buffer error (in HC) */
216#define QTD_STS_BABBLE (1 << 4) /* device was babbling (qtd halted) */
217#define QTD_STS_XACT (1 << 3) /* device gave illegal response */
218#define QTD_STS_MMF (1 << 2) /* incomplete split transaction */
219#define QTD_STS_STS (1 << 1) /* split transaction state */
220#define QTD_STS_PING (1 << 0) /* issue PING? */
221 __le32 hw_buf[5]; /* see EHCI 3.5.4 */
222 __le32 hw_buf_hi[5]; /* Appendix B */
223
224 /* the rest is HCD-private */
225 dma_addr_t qtd_dma; /* qtd address */
226 struct list_head qtd_list; /* sw qtd list */
227 struct urb *urb; /* qtd's urb */
228 size_t length; /* length of buffer */
229
230 u32 qtd_buffer_len;
231 void *buffer;
232 dma_addr_t buffer_dma;
233 void *transfer_buffer;
234 void *transfer_dma;
235} __attribute__ ((aligned(32)));
236
237/* mask NakCnt+T in qh->hw_alt_next */
238#define QTD_MASK __constant_cpu_to_le32 (~0x1f)
239
240#define IS_SHORT_READ(token) (QTD_LENGTH(token) != 0 && QTD_PID(token) == 1)
241
242/* Type tag from {qh, itd, sitd, fstn}->hw_next */
243#define Q_NEXT_TYPE(dma) ((dma) & __constant_cpu_to_le32 (3 << 1))
244
245/* values for that type tag */
246#define Q_TYPE_QH __constant_cpu_to_le32 (1 << 1)
247
248/* next async queue entry, or pointer to interrupt/periodic QH */
249#define QH_NEXT(dma) (cpu_to_le32(((u32)dma)&~0x01f)|Q_TYPE_QH)
250
251/* for periodic/async schedules and qtd lists, mark end of list */
252#define EHCI_LIST_END __constant_cpu_to_le32(1) /* "null pointer" to hw */
253
254/*
255 * Entries in periodic shadow table are pointers to one of four kinds
256 * of data structure. That's dictated by the hardware; a type tag is
257 * encoded in the low bits of the hardware's periodic schedule. Use
258 * Q_NEXT_TYPE to get the tag.
259 *
260 * For entries in the async schedule, the type tag always says "qh".
261 */
262union ehci_shadow {
263 struct ehci_qh *qh; /* Q_TYPE_QH */
264 __le32 *hw_next; /* (all types) */
265 void *ptr;
266};
267
268/*
269 * EHCI Specification 0.95 Section 3.6
270 * QH: describes control/bulk/interrupt endpoints
271 * See Fig 3-7 "Queue Head Structure Layout".
272 *
273 * These appear in both the async and (for interrupt) periodic schedules.
274 */
275
276struct ehci_qh {
277 /* first part defined by EHCI spec */
278 __le32 hw_next; /* see EHCI 3.6.1 */
279 __le32 hw_info1; /* see EHCI 3.6.2 */
280#define QH_HEAD 0x00008000
281 __le32 hw_info2; /* see EHCI 3.6.2 */
282#define QH_SMASK 0x000000ff
283#define QH_CMASK 0x0000ff00
284#define QH_HUBADDR 0x007f0000
285#define QH_HUBPORT 0x3f800000
286#define QH_MULT 0xc0000000
287 __le32 hw_current; /* qtd list - see EHCI 3.6.4 */
288
289 /* qtd overlay (hardware parts of a struct ehci_qtd) */
290 __le32 hw_qtd_next;
291 __le32 hw_alt_next;
292 __le32 hw_token;
293 __le32 hw_buf[5];
294 __le32 hw_buf_hi[5];
295
296 /* the rest is HCD-private */
297 dma_addr_t qh_dma; /* address of qh */
298 union ehci_shadow qh_next; /* ptr to qh; or periodic */
299 struct list_head qtd_list; /* sw qtd list */
300 struct ehci_qtd *dummy;
301 struct ehci_qh *reclaim; /* next to reclaim */
302
303 struct oxu_hcd *oxu;
304 struct kref kref;
305 unsigned stamp;
306
307 u8 qh_state;
308#define QH_STATE_LINKED 1 /* HC sees this */
309#define QH_STATE_UNLINK 2 /* HC may still see this */
310#define QH_STATE_IDLE 3 /* HC doesn't see this */
311#define QH_STATE_UNLINK_WAIT 4 /* LINKED and on reclaim q */
312#define QH_STATE_COMPLETING 5 /* don't touch token.HALT */
313
314 /* periodic schedule info */
315 u8 usecs; /* intr bandwidth */
316 u8 gap_uf; /* uframes split/csplit gap */
317 u8 c_usecs; /* ... split completion bw */
318 u16 tt_usecs; /* tt downstream bandwidth */
319 unsigned short period; /* polling interval */
320 unsigned short start; /* where polling starts */
321#define NO_FRAME ((unsigned short)~0) /* pick new start */
322 struct usb_device *dev; /* access to TT */
323} __attribute__ ((aligned(32)));
324
325/*
326 * Proper OXU210HP structs
327 */
328
329#define OXU_OTG_CORE_OFFSET 0x00400
330#define OXU_OTG_CAP_OFFSET (OXU_OTG_CORE_OFFSET + 0x100)
331#define OXU_SPH_CORE_OFFSET 0x00800
332#define OXU_SPH_CAP_OFFSET (OXU_SPH_CORE_OFFSET + 0x100)
333
334#define OXU_OTG_MEM 0xE000
335#define OXU_SPH_MEM 0x16000
336
337/* Only how many elements & element structure are specifies here. */
338/* 2 host controllers are enabled - total size <= 28 kbytes */
339#define DEFAULT_I_TDPS 1024
340#define QHEAD_NUM 16
341#define QTD_NUM 32
342#define SITD_NUM 8
343#define MURB_NUM 8
344
345#define BUFFER_NUM 8
346#define BUFFER_SIZE 512
347
348struct oxu_info {
349 struct usb_hcd *hcd[2];
350};
351
352struct oxu_buf {
353 u8 buffer[BUFFER_SIZE];
354} __attribute__ ((aligned(BUFFER_SIZE)));
355
356struct oxu_onchip_mem {
357 struct oxu_buf db_pool[BUFFER_NUM];
358
359 u32 frame_list[DEFAULT_I_TDPS];
360 struct ehci_qh qh_pool[QHEAD_NUM];
361 struct ehci_qtd qtd_pool[QTD_NUM];
362} __attribute__ ((aligned(4 << 10)));
363
364#define EHCI_MAX_ROOT_PORTS 15 /* see HCS_N_PORTS */
365
366struct oxu_murb {
367 struct urb urb;
368 struct urb *main;
369 u8 last;
370};
371
372struct oxu_hcd { /* one per controller */
373 unsigned int is_otg:1;
374
375 u8 qh_used[QHEAD_NUM];
376 u8 qtd_used[QTD_NUM];
377 u8 db_used[BUFFER_NUM];
378 u8 murb_used[MURB_NUM];
379
380 struct oxu_onchip_mem __iomem *mem;
381 spinlock_t mem_lock;
382
383 struct timer_list urb_timer;
384
385 struct ehci_caps __iomem *caps;
386 struct ehci_regs __iomem *regs;
387
388 __u32 hcs_params; /* cached register copy */
389 spinlock_t lock;
390
391 /* async schedule support */
392 struct ehci_qh *async;
393 struct ehci_qh *reclaim;
394 unsigned reclaim_ready:1;
395 unsigned scanning:1;
396
397 /* periodic schedule support */
398 unsigned periodic_size;
399 __le32 *periodic; /* hw periodic table */
400 dma_addr_t periodic_dma;
401 unsigned i_thresh; /* uframes HC might cache */
402
403 union ehci_shadow *pshadow; /* mirror hw periodic table */
404 int next_uframe; /* scan periodic, start here */
405 unsigned periodic_sched; /* periodic activity count */
406
407 /* per root hub port */
408 unsigned long reset_done[EHCI_MAX_ROOT_PORTS];
409 /* bit vectors (one bit per port) */
410 unsigned long bus_suspended; /* which ports were
411 * already suspended at the
412 * start of a bus suspend
413 */
414 unsigned long companion_ports;/* which ports are dedicated
415 * to the companion controller
416 */
417
418 struct timer_list watchdog;
419 unsigned long actions;
420 unsigned stamp;
421 unsigned long next_statechange;
422 u32 command;
423
424 /* SILICON QUIRKS */
425 struct list_head urb_list; /* this is the head to urb
426 * queue that didn't get enough
427 * resources
428 */
429 struct oxu_murb *murb_pool; /* murb per split big urb */
430 unsigned urb_len;
431
432 u8 sbrn; /* packed release number */
433};
434
435#define EHCI_IAA_JIFFIES (HZ/100) /* arbitrary; ~10 msec */
436#define EHCI_IO_JIFFIES (HZ/10) /* io watchdog > irq_thresh */
437#define EHCI_ASYNC_JIFFIES (HZ/20) /* async idle timeout */
438#define EHCI_SHRINK_JIFFIES (HZ/200) /* async qh unlink delay */
439
440enum ehci_timer_action {
441 TIMER_IO_WATCHDOG,
442 TIMER_IAA_WATCHDOG,
443 TIMER_ASYNC_SHRINK,
444 TIMER_ASYNC_OFF,
445};
446
447#include <linux/oxu210hp.h>
diff --git a/drivers/usb/host/pci-quirks.c b/drivers/usb/host/pci-quirks.c
index ae6e70edd745..75b69847918e 100644
--- a/drivers/usb/host/pci-quirks.c
+++ b/drivers/usb/host/pci-quirks.c
@@ -172,9 +172,9 @@ static void __devinit quirk_usb_handoff_ohci(struct pci_dev *pdev)
172 if (!mmio_resource_enabled(pdev, 0)) 172 if (!mmio_resource_enabled(pdev, 0))
173 return; 173 return;
174 174
175 base = ioremap_nocache(pci_resource_start(pdev, 0), 175 base = pci_ioremap_bar(pdev, 0);
176 pci_resource_len(pdev, 0)); 176 if (base == NULL)
177 if (base == NULL) return; 177 return;
178 178
179/* On PA-RISC, PDC can leave IR set incorrectly; ignore it there. */ 179/* On PA-RISC, PDC can leave IR set incorrectly; ignore it there. */
180#ifndef __hppa__ 180#ifndef __hppa__
@@ -221,9 +221,9 @@ static void __devinit quirk_usb_disable_ehci(struct pci_dev *pdev)
221 if (!mmio_resource_enabled(pdev, 0)) 221 if (!mmio_resource_enabled(pdev, 0))
222 return; 222 return;
223 223
224 base = ioremap_nocache(pci_resource_start(pdev, 0), 224 base = pci_ioremap_bar(pdev, 0);
225 pci_resource_len(pdev, 0)); 225 if (base == NULL)
226 if (base == NULL) return; 226 return;
227 227
228 cap_length = readb(base); 228 cap_length = readb(base);
229 op_reg_base = base + cap_length; 229 op_reg_base = base + cap_length;
@@ -271,7 +271,7 @@ static void __devinit quirk_usb_disable_ehci(struct pci_dev *pdev)
271 /* if boot firmware now owns EHCI, spin till 271 /* if boot firmware now owns EHCI, spin till
272 * it hands it over. 272 * it hands it over.
273 */ 273 */
274 msec = 5000; 274 msec = 1000;
275 while ((cap & EHCI_USBLEGSUP_BIOS) && (msec > 0)) { 275 while ((cap & EHCI_USBLEGSUP_BIOS) && (msec > 0)) {
276 tried_handoff = 1; 276 tried_handoff = 1;
277 msleep(10); 277 msleep(10);
diff --git a/drivers/usb/host/r8a66597-hcd.c b/drivers/usb/host/r8a66597-hcd.c
index c21f14e0666a..319041205b57 100644
--- a/drivers/usb/host/r8a66597-hcd.c
+++ b/drivers/usb/host/r8a66597-hcd.c
@@ -2275,7 +2275,6 @@ static int __init_or_module r8a66597_remove(struct platform_device *pdev)
2275 return 0; 2275 return 0;
2276} 2276}
2277 2277
2278#define resource_len(r) (((r)->end - (r)->start) + 1)
2279static int __init r8a66597_probe(struct platform_device *pdev) 2278static int __init r8a66597_probe(struct platform_device *pdev)
2280{ 2279{
2281#if defined(CONFIG_SUPERH_ON_CHIP_R8A66597) && defined(CONFIG_HAVE_CLK) 2280#if defined(CONFIG_SUPERH_ON_CHIP_R8A66597) && defined(CONFIG_HAVE_CLK)
@@ -2296,11 +2295,10 @@ static int __init r8a66597_probe(struct platform_device *pdev)
2296 goto clean_up; 2295 goto clean_up;
2297 } 2296 }
2298 2297
2299 res = platform_get_resource_byname(pdev, IORESOURCE_MEM, 2298 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
2300 (char *)hcd_name);
2301 if (!res) { 2299 if (!res) {
2302 ret = -ENODEV; 2300 ret = -ENODEV;
2303 dev_err(&pdev->dev, "platform_get_resource_byname error.\n"); 2301 dev_err(&pdev->dev, "platform_get_resource error.\n");
2304 goto clean_up; 2302 goto clean_up;
2305 } 2303 }
2306 2304
@@ -2315,7 +2313,7 @@ static int __init r8a66597_probe(struct platform_device *pdev)
2315 irq = ires->start; 2313 irq = ires->start;
2316 irq_trigger = ires->flags & IRQF_TRIGGER_MASK; 2314 irq_trigger = ires->flags & IRQF_TRIGGER_MASK;
2317 2315
2318 reg = ioremap(res->start, resource_len(res)); 2316 reg = ioremap(res->start, resource_size(res));
2319 if (reg == NULL) { 2317 if (reg == NULL) {
2320 ret = -ENOMEM; 2318 ret = -ENOMEM;
2321 dev_err(&pdev->dev, "ioremap error.\n"); 2319 dev_err(&pdev->dev, "ioremap error.\n");
diff --git a/drivers/usb/host/uhci-hcd.c b/drivers/usb/host/uhci-hcd.c
index cf5e4cf7ea42..4e221060f58c 100644
--- a/drivers/usb/host/uhci-hcd.c
+++ b/drivers/usb/host/uhci-hcd.c
@@ -942,6 +942,8 @@ static struct pci_driver uhci_pci_driver = {
942 942
943#ifdef CONFIG_PM 943#ifdef CONFIG_PM
944 .suspend = usb_hcd_pci_suspend, 944 .suspend = usb_hcd_pci_suspend,
945 .suspend_late = usb_hcd_pci_suspend_late,
946 .resume_early = usb_hcd_pci_resume_early,
945 .resume = usb_hcd_pci_resume, 947 .resume = usb_hcd_pci_resume,
946#endif /* PM */ 948#endif /* PM */
947}; 949};
diff --git a/drivers/usb/image/microtek.c b/drivers/usb/image/microtek.c
index 885867a86de8..4541dfcea88f 100644
--- a/drivers/usb/image/microtek.c
+++ b/drivers/usb/image/microtek.c
@@ -350,17 +350,16 @@ static int mts_scsi_abort(struct scsi_cmnd *srb)
350static int mts_scsi_host_reset(struct scsi_cmnd *srb) 350static int mts_scsi_host_reset(struct scsi_cmnd *srb)
351{ 351{
352 struct mts_desc* desc = (struct mts_desc*)(srb->device->host->hostdata[0]); 352 struct mts_desc* desc = (struct mts_desc*)(srb->device->host->hostdata[0]);
353 int result, rc; 353 int result;
354 354
355 MTS_DEBUG_GOT_HERE(); 355 MTS_DEBUG_GOT_HERE();
356 mts_debug_dump(desc); 356 mts_debug_dump(desc);
357 357
358 rc = usb_lock_device_for_reset(desc->usb_dev, desc->usb_intf); 358 result = usb_lock_device_for_reset(desc->usb_dev, desc->usb_intf);
359 if (rc < 0) 359 if (result == 0) {
360 return FAILED; 360 result = usb_reset_device(desc->usb_dev);
361 result = usb_reset_device(desc->usb_dev);
362 if (rc)
363 usb_unlock_device(desc->usb_dev); 361 usb_unlock_device(desc->usb_dev);
362 }
364 return result ? FAILED : SUCCESS; 363 return result ? FAILED : SUCCESS;
365} 364}
366 365
diff --git a/drivers/usb/misc/berry_charge.c b/drivers/usb/misc/berry_charge.c
index 24e2dc3148a4..c05a85bc5925 100644
--- a/drivers/usb/misc/berry_charge.c
+++ b/drivers/usb/misc/berry_charge.c
@@ -123,6 +123,11 @@ static int berry_probe(struct usb_interface *intf,
123{ 123{
124 struct usb_device *udev = interface_to_usbdev(intf); 124 struct usb_device *udev = interface_to_usbdev(intf);
125 125
126 if (udev->bus_mA < 500) {
127 dbg(&udev->dev, "Not enough power to charge available\n");
128 return -ENODEV;
129 }
130
126 dbg(&udev->dev, "Power is set to %dmA\n", 131 dbg(&udev->dev, "Power is set to %dmA\n",
127 udev->actconfig->desc.bMaxPower * 2); 132 udev->actconfig->desc.bMaxPower * 2);
128 133
diff --git a/drivers/usb/misc/emi26.c b/drivers/usb/misc/emi26.c
index e762beb5f3c6..879a980ca8c4 100644
--- a/drivers/usb/misc/emi26.c
+++ b/drivers/usb/misc/emi26.c
@@ -160,7 +160,7 @@ static int emi26_load_firmware (struct usb_device *dev)
160 err("%s - error loading firmware: error = %d", __func__, err); 160 err("%s - error loading firmware: error = %d", __func__, err);
161 goto wraperr; 161 goto wraperr;
162 } 162 }
163 } while (i > 0); 163 } while (rec);
164 164
165 /* Assert reset (stop the CPU in the EMI) */ 165 /* Assert reset (stop the CPU in the EMI) */
166 err = emi26_set_reset(dev,1); 166 err = emi26_set_reset(dev,1);
diff --git a/drivers/usb/misc/usbtest.c b/drivers/usb/misc/usbtest.c
index 444c69c447be..5f1a19d1497d 100644
--- a/drivers/usb/misc/usbtest.c
+++ b/drivers/usb/misc/usbtest.c
@@ -192,8 +192,6 @@ static struct urb *simple_alloc_urb (
192{ 192{
193 struct urb *urb; 193 struct urb *urb;
194 194
195 if (bytes < 0)
196 return NULL;
197 urb = usb_alloc_urb (0, GFP_KERNEL); 195 urb = usb_alloc_urb (0, GFP_KERNEL);
198 if (!urb) 196 if (!urb)
199 return urb; 197 return urb;
diff --git a/drivers/usb/mon/Kconfig b/drivers/usb/mon/Kconfig
index deb9ddffa402..f28f350cd96a 100644
--- a/drivers/usb/mon/Kconfig
+++ b/drivers/usb/mon/Kconfig
@@ -3,14 +3,13 @@
3# 3#
4 4
5config USB_MON 5config USB_MON
6 bool "USB Monitor" 6 tristate "USB Monitor"
7 depends on USB!=n 7 depends on USB
8 default y 8 default y if USB=y
9 default m if USB=m
9 help 10 help
10 If you say Y here, a component which captures the USB traffic 11 If you select this option, a component which captures the USB traffic
11 between peripheral-specific drivers and HC drivers will be built. 12 between peripheral-specific drivers and HC drivers will be built.
12 For more information, see <file:Documentation/usb/usbmon.txt>. 13 For more information, see <file:Documentation/usb/usbmon.txt>.
13 14
14 This is somewhat experimental at this time, but it should be safe. 15 If unsure, say Y (if allowed), otherwise M.
15
16 If unsure, say Y.
diff --git a/drivers/usb/mon/Makefile b/drivers/usb/mon/Makefile
index 0f76ed5e1617..c6516b566731 100644
--- a/drivers/usb/mon/Makefile
+++ b/drivers/usb/mon/Makefile
@@ -4,5 +4,4 @@
4 4
5usbmon-objs := mon_main.o mon_stat.o mon_text.o mon_bin.o mon_dma.o 5usbmon-objs := mon_main.o mon_stat.o mon_text.o mon_bin.o mon_dma.o
6 6
7# This does not use CONFIG_USB_MON because we want this to use a tristate. 7obj-$(CONFIG_USB_MON) += usbmon.o
8obj-$(CONFIG_USB) += usbmon.o
diff --git a/drivers/usb/musb/Kconfig b/drivers/usb/musb/Kconfig
index 4b9542bbb35c..5af7379cd9a3 100644
--- a/drivers/usb/musb/Kconfig
+++ b/drivers/usb/musb/Kconfig
@@ -11,7 +11,7 @@ config USB_MUSB_HDRC
11 depends on (USB || USB_GADGET) && HAVE_CLK 11 depends on (USB || USB_GADGET) && HAVE_CLK
12 depends on !SUPERH 12 depends on !SUPERH
13 select TWL4030_USB if MACH_OMAP_3430SDP 13 select TWL4030_USB if MACH_OMAP_3430SDP
14 tristate 'Inventra Highspeed Dual Role Controller (TI, ...)' 14 tristate 'Inventra Highspeed Dual Role Controller (TI, ADI, ...)'
15 help 15 help
16 Say Y here if your system has a dual role high speed USB 16 Say Y here if your system has a dual role high speed USB
17 controller based on the Mentor Graphics silicon IP. Then 17 controller based on the Mentor Graphics silicon IP. Then
@@ -22,6 +22,9 @@ config USB_MUSB_HDRC
22 Texas Instruments parts using this IP include DaVinci 644x, 22 Texas Instruments parts using this IP include DaVinci 644x,
23 OMAP 243x, OMAP 343x, and TUSB 6010. 23 OMAP 243x, OMAP 343x, and TUSB 6010.
24 24
25 Analog Devices parts using this IP include Blackfin BF54x,
26 BF525 and BF527.
27
25 If you do not know what this is, please say N. 28 If you do not know what this is, please say N.
26 29
27 To compile this driver as a module, choose M here; the 30 To compile this driver as a module, choose M here; the
@@ -33,6 +36,8 @@ config USB_MUSB_SOC
33 default y if ARCH_DAVINCI 36 default y if ARCH_DAVINCI
34 default y if ARCH_OMAP2430 37 default y if ARCH_OMAP2430
35 default y if ARCH_OMAP34XX 38 default y if ARCH_OMAP34XX
39 default y if (BF54x && !BF544)
40 default y if (BF52x && !BF522 && !BF523)
36 41
37comment "DaVinci 644x USB support" 42comment "DaVinci 644x USB support"
38 depends on USB_MUSB_HDRC && ARCH_DAVINCI 43 depends on USB_MUSB_HDRC && ARCH_DAVINCI
@@ -43,6 +48,9 @@ comment "OMAP 243x high speed USB support"
43comment "OMAP 343x high speed USB support" 48comment "OMAP 343x high speed USB support"
44 depends on USB_MUSB_HDRC && ARCH_OMAP34XX 49 depends on USB_MUSB_HDRC && ARCH_OMAP34XX
45 50
51comment "Blackfin high speed USB Support"
52 depends on USB_MUSB_HDRC && (BF54x && !BF544) || (BF52x && !BF522 && !BF523)
53
46config USB_TUSB6010 54config USB_TUSB6010
47 boolean "TUSB 6010 support" 55 boolean "TUSB 6010 support"
48 depends on USB_MUSB_HDRC && !USB_MUSB_SOC 56 depends on USB_MUSB_HDRC && !USB_MUSB_SOC
@@ -142,7 +150,7 @@ config MUSB_PIO_ONLY
142config USB_INVENTRA_DMA 150config USB_INVENTRA_DMA
143 bool 151 bool
144 depends on USB_MUSB_HDRC && !MUSB_PIO_ONLY 152 depends on USB_MUSB_HDRC && !MUSB_PIO_ONLY
145 default ARCH_OMAP2430 || ARCH_OMAP34XX 153 default ARCH_OMAP2430 || ARCH_OMAP34XX || BLACKFIN
146 help 154 help
147 Enable DMA transfers using Mentor's engine. 155 Enable DMA transfers using Mentor's engine.
148 156
diff --git a/drivers/usb/musb/Makefile b/drivers/usb/musb/Makefile
index b6af0d687a73..85710ccc1887 100644
--- a/drivers/usb/musb/Makefile
+++ b/drivers/usb/musb/Makefile
@@ -22,6 +22,14 @@ ifeq ($(CONFIG_ARCH_OMAP3430),y)
22 musb_hdrc-objs += omap2430.o 22 musb_hdrc-objs += omap2430.o
23endif 23endif
24 24
25ifeq ($(CONFIG_BF54x),y)
26 musb_hdrc-objs += blackfin.o
27endif
28
29ifeq ($(CONFIG_BF52x),y)
30 musb_hdrc-objs += blackfin.o
31endif
32
25ifeq ($(CONFIG_USB_GADGET_MUSB_HDRC),y) 33ifeq ($(CONFIG_USB_GADGET_MUSB_HDRC),y)
26 musb_hdrc-objs += musb_gadget_ep0.o musb_gadget.o 34 musb_hdrc-objs += musb_gadget_ep0.o musb_gadget.o
27endif 35endif
diff --git a/drivers/usb/musb/blackfin.c b/drivers/usb/musb/blackfin.c
new file mode 100644
index 000000000000..786134852092
--- /dev/null
+++ b/drivers/usb/musb/blackfin.c
@@ -0,0 +1,320 @@
1/*
2 * MUSB OTG controller driver for Blackfin Processors
3 *
4 * Copyright 2006-2008 Analog Devices Inc.
5 *
6 * Enter bugs at http://blackfin.uclinux.org/
7 *
8 * Licensed under the GPL-2 or later.
9 */
10
11#include <linux/module.h>
12#include <linux/kernel.h>
13#include <linux/sched.h>
14#include <linux/slab.h>
15#include <linux/init.h>
16#include <linux/list.h>
17#include <linux/clk.h>
18#include <linux/gpio.h>
19#include <linux/io.h>
20
21#include <asm/cacheflush.h>
22
23#include "musb_core.h"
24#include "blackfin.h"
25
26/*
27 * Load an endpoint's FIFO
28 */
29void musb_write_fifo(struct musb_hw_ep *hw_ep, u16 len, const u8 *src)
30{
31 void __iomem *fifo = hw_ep->fifo;
32 void __iomem *epio = hw_ep->regs;
33
34 prefetch((u8 *)src);
35
36 musb_writew(epio, MUSB_TXCOUNT, len);
37
38 DBG(4, "TX ep%d fifo %p count %d buf %p, epio %p\n",
39 hw_ep->epnum, fifo, len, src, epio);
40
41 dump_fifo_data(src, len);
42
43 if (unlikely((unsigned long)src & 0x01))
44 outsw_8((unsigned long)fifo, src,
45 len & 0x01 ? (len >> 1) + 1 : len >> 1);
46 else
47 outsw((unsigned long)fifo, src,
48 len & 0x01 ? (len >> 1) + 1 : len >> 1);
49}
50
51/*
52 * Unload an endpoint's FIFO
53 */
54void musb_read_fifo(struct musb_hw_ep *hw_ep, u16 len, u8 *dst)
55{
56 void __iomem *fifo = hw_ep->fifo;
57 u8 epnum = hw_ep->epnum;
58 u16 dma_reg = 0;
59
60 DBG(4, "%cX ep%d fifo %p count %d buf %p\n",
61 'R', hw_ep->epnum, fifo, len, dst);
62
63#ifdef CONFIG_BF52x
64 invalidate_dcache_range((unsigned int)dst,
65 (unsigned int)(dst + len));
66
67 /* Setup DMA address register */
68 dma_reg = (u16) ((u32) dst & 0xFFFF);
69 bfin_write16(USB_DMA_REG(epnum, USB_DMAx_ADDR_LOW), dma_reg);
70 SSYNC();
71
72 dma_reg = (u16) (((u32) dst >> 16) & 0xFFFF);
73 bfin_write16(USB_DMA_REG(epnum, USB_DMAx_ADDR_HIGH), dma_reg);
74 SSYNC();
75
76 /* Setup DMA count register */
77 bfin_write16(USB_DMA_REG(epnum, USB_DMAx_COUNT_LOW), len);
78 bfin_write16(USB_DMA_REG(epnum, USB_DMAx_COUNT_HIGH), 0);
79 SSYNC();
80
81 /* Enable the DMA */
82 dma_reg = (epnum << 4) | DMA_ENA | INT_ENA;
83 bfin_write16(USB_DMA_REG(epnum, USB_DMAx_CTRL), dma_reg);
84 SSYNC();
85
86 /* Wait for compelete */
87 while (!(bfin_read_USB_DMA_INTERRUPT() & (1 << epnum)))
88 cpu_relax();
89
90 /* acknowledge dma interrupt */
91 bfin_write_USB_DMA_INTERRUPT(1 << epnum);
92 SSYNC();
93
94 /* Reset DMA */
95 bfin_write16(USB_DMA_REG(epnum, USB_DMAx_CTRL), 0);
96 SSYNC();
97#else
98 if (unlikely((unsigned long)dst & 0x01))
99 insw_8((unsigned long)fifo, dst,
100 len & 0x01 ? (len >> 1) + 1 : len >> 1);
101 else
102 insw((unsigned long)fifo, dst,
103 len & 0x01 ? (len >> 1) + 1 : len >> 1);
104#endif
105
106 dump_fifo_data(dst, len);
107}
108
109static irqreturn_t blackfin_interrupt(int irq, void *__hci)
110{
111 unsigned long flags;
112 irqreturn_t retval = IRQ_NONE;
113 struct musb *musb = __hci;
114
115 spin_lock_irqsave(&musb->lock, flags);
116
117 musb->int_usb = musb_readb(musb->mregs, MUSB_INTRUSB);
118 musb->int_tx = musb_readw(musb->mregs, MUSB_INTRTX);
119 musb->int_rx = musb_readw(musb->mregs, MUSB_INTRRX);
120
121 if (musb->int_usb || musb->int_tx || musb->int_rx) {
122 musb_writeb(musb->mregs, MUSB_INTRUSB, musb->int_usb);
123 musb_writew(musb->mregs, MUSB_INTRTX, musb->int_tx);
124 musb_writew(musb->mregs, MUSB_INTRRX, musb->int_rx);
125 retval = musb_interrupt(musb);
126 }
127
128 spin_unlock_irqrestore(&musb->lock, flags);
129
130 /* REVISIT we sometimes get spurious IRQs on g_ep0
131 * not clear why... fall in BF54x too.
132 */
133 if (retval != IRQ_HANDLED)
134 DBG(5, "spurious?\n");
135
136 return IRQ_HANDLED;
137}
138
139static void musb_conn_timer_handler(unsigned long _musb)
140{
141 struct musb *musb = (void *)_musb;
142 unsigned long flags;
143 u16 val;
144
145 spin_lock_irqsave(&musb->lock, flags);
146 switch (musb->xceiv.state) {
147 case OTG_STATE_A_IDLE:
148 case OTG_STATE_A_WAIT_BCON:
149 /* Start a new session */
150 val = musb_readw(musb->mregs, MUSB_DEVCTL);
151 val |= MUSB_DEVCTL_SESSION;
152 musb_writew(musb->mregs, MUSB_DEVCTL, val);
153
154 val = musb_readw(musb->mregs, MUSB_DEVCTL);
155 if (!(val & MUSB_DEVCTL_BDEVICE)) {
156 gpio_set_value(musb->config->gpio_vrsel, 1);
157 musb->xceiv.state = OTG_STATE_A_WAIT_BCON;
158 } else {
159 gpio_set_value(musb->config->gpio_vrsel, 0);
160
161 /* Ignore VBUSERROR and SUSPEND IRQ */
162 val = musb_readb(musb->mregs, MUSB_INTRUSBE);
163 val &= ~MUSB_INTR_VBUSERROR;
164 musb_writeb(musb->mregs, MUSB_INTRUSBE, val);
165
166 val = MUSB_INTR_SUSPEND | MUSB_INTR_VBUSERROR;
167 musb_writeb(musb->mregs, MUSB_INTRUSB, val);
168
169 val = MUSB_POWER_HSENAB;
170 musb_writeb(musb->mregs, MUSB_POWER, val);
171 }
172 mod_timer(&musb_conn_timer, jiffies + TIMER_DELAY);
173 break;
174
175 default:
176 DBG(1, "%s state not handled\n", otg_state_string(musb));
177 break;
178 }
179 spin_unlock_irqrestore(&musb->lock, flags);
180
181 DBG(4, "state is %s\n", otg_state_string(musb));
182}
183
184void musb_platform_enable(struct musb *musb)
185{
186 if (is_host_enabled(musb)) {
187 mod_timer(&musb_conn_timer, jiffies + TIMER_DELAY);
188 musb->a_wait_bcon = TIMER_DELAY;
189 }
190}
191
192void musb_platform_disable(struct musb *musb)
193{
194}
195
196static void bfin_vbus_power(struct musb *musb, int is_on, int sleeping)
197{
198}
199
200static void bfin_set_vbus(struct musb *musb, int is_on)
201{
202 if (is_on)
203 gpio_set_value(musb->config->gpio_vrsel, 1);
204 else
205 gpio_set_value(musb->config->gpio_vrsel, 0);
206
207 DBG(1, "VBUS %s, devctl %02x "
208 /* otg %3x conf %08x prcm %08x */ "\n",
209 otg_state_string(musb),
210 musb_readb(musb->mregs, MUSB_DEVCTL));
211}
212
213static int bfin_set_power(struct otg_transceiver *x, unsigned mA)
214{
215 return 0;
216}
217
218void musb_platform_try_idle(struct musb *musb, unsigned long timeout)
219{
220 if (is_host_enabled(musb))
221 mod_timer(&musb_conn_timer, jiffies + TIMER_DELAY);
222}
223
224int musb_platform_get_vbus_status(struct musb *musb)
225{
226 return 0;
227}
228
229void musb_platform_set_mode(struct musb *musb, u8 musb_mode)
230{
231}
232
233int __init musb_platform_init(struct musb *musb)
234{
235
236 /*
237 * Rev 1.0 BF549 EZ-KITs require PE7 to be high for both DEVICE
238 * and OTG HOST modes, while rev 1.1 and greater require PE7 to
239 * be low for DEVICE mode and high for HOST mode. We set it high
240 * here because we are in host mode
241 */
242
243 if (gpio_request(musb->config->gpio_vrsel, "USB_VRSEL")) {
244 printk(KERN_ERR "Failed ro request USB_VRSEL GPIO_%d \n",
245 musb->config->gpio_vrsel);
246 return -ENODEV;
247 }
248 gpio_direction_output(musb->config->gpio_vrsel, 0);
249
250 if (ANOMALY_05000346) {
251 bfin_write_USB_APHY_CALIB(ANOMALY_05000346_value);
252 SSYNC();
253 }
254
255 if (ANOMALY_05000347) {
256 bfin_write_USB_APHY_CNTRL(0x0);
257 SSYNC();
258 }
259
260 /* TODO
261 * Set SIC-IVG register
262 */
263
264 /* Configure PLL oscillator register */
265 bfin_write_USB_PLLOSC_CTRL(0x30a8);
266 SSYNC();
267
268 bfin_write_USB_SRP_CLKDIV((get_sclk()/1000) / 32 - 1);
269 SSYNC();
270
271 bfin_write_USB_EP_NI0_RXMAXP(64);
272 SSYNC();
273
274 bfin_write_USB_EP_NI0_TXMAXP(64);
275 SSYNC();
276
277 /* Route INTRUSB/INTR_RX/INTR_TX to USB_INT0*/
278 bfin_write_USB_GLOBINTR(0x7);
279 SSYNC();
280
281 bfin_write_USB_GLOBAL_CTL(GLOBAL_ENA | EP1_TX_ENA | EP2_TX_ENA |
282 EP3_TX_ENA | EP4_TX_ENA | EP5_TX_ENA |
283 EP6_TX_ENA | EP7_TX_ENA | EP1_RX_ENA |
284 EP2_RX_ENA | EP3_RX_ENA | EP4_RX_ENA |
285 EP5_RX_ENA | EP6_RX_ENA | EP7_RX_ENA);
286 SSYNC();
287
288 if (is_host_enabled(musb)) {
289 musb->board_set_vbus = bfin_set_vbus;
290 setup_timer(&musb_conn_timer,
291 musb_conn_timer_handler, (unsigned long) musb);
292 }
293 if (is_peripheral_enabled(musb))
294 musb->xceiv.set_power = bfin_set_power;
295
296 musb->isr = blackfin_interrupt;
297
298 return 0;
299}
300
301int musb_platform_suspend(struct musb *musb)
302{
303 return 0;
304}
305
306int musb_platform_resume(struct musb *musb)
307{
308 return 0;
309}
310
311
312int musb_platform_exit(struct musb *musb)
313{
314
315 bfin_vbus_power(musb, 0 /*off*/, 1);
316 gpio_free(musb->config->gpio_vrsel);
317 musb_platform_suspend(musb);
318
319 return 0;
320}
diff --git a/drivers/usb/musb/blackfin.h b/drivers/usb/musb/blackfin.h
new file mode 100644
index 000000000000..a240c1e53d16
--- /dev/null
+++ b/drivers/usb/musb/blackfin.h
@@ -0,0 +1,52 @@
1/*
2 * Copyright (C) 2007 by Analog Devices, Inc.
3 *
4 * The Inventra Controller Driver for Linux is free software; you
5 * can redistribute it and/or modify it under the terms of the GNU
6 * General Public License version 2 as published by the Free Software
7 * Foundation.
8 */
9
10#ifndef __MUSB_BLACKFIN_H__
11#define __MUSB_BLACKFIN_H__
12
13/*
14 * Blackfin specific definitions
15 */
16
17#undef DUMP_FIFO_DATA
18#ifdef DUMP_FIFO_DATA
19static void dump_fifo_data(u8 *buf, u16 len)
20{
21 u8 *tmp = buf;
22 int i;
23
24 for (i = 0; i < len; i++) {
25 if (!(i % 16) && i)
26 pr_debug("\n");
27 pr_debug("%02x ", *tmp++);
28 }
29 pr_debug("\n");
30}
31#else
32#define dump_fifo_data(buf, len) do {} while (0)
33#endif
34
35#ifdef CONFIG_BF52x
36
37#define USB_DMA_BASE USB_DMA_INTERRUPT
38#define USB_DMAx_CTRL 0x04
39#define USB_DMAx_ADDR_LOW 0x08
40#define USB_DMAx_ADDR_HIGH 0x0C
41#define USB_DMAx_COUNT_LOW 0x10
42#define USB_DMAx_COUNT_HIGH 0x14
43
44#define USB_DMA_REG(ep, reg) (USB_DMA_BASE + 0x20 * ep + reg)
45#endif
46
47/* Almost 1 second */
48#define TIMER_DELAY (1 * HZ)
49
50static struct timer_list musb_conn_timer;
51
52#endif /* __MUSB_BLACKFIN_H__ */
diff --git a/drivers/usb/musb/davinci.c b/drivers/usb/musb/davinci.c
index dfb3bcbe00fc..0d566dc5ce06 100644
--- a/drivers/usb/musb/davinci.c
+++ b/drivers/usb/musb/davinci.c
@@ -32,9 +32,9 @@
32#include <linux/io.h> 32#include <linux/io.h>
33#include <linux/gpio.h> 33#include <linux/gpio.h>
34 34
35#include <asm/arch/hardware.h> 35#include <mach/arch/hardware.h>
36#include <asm/arch/memory.h> 36#include <mach/arch/memory.h>
37#include <asm/arch/gpio.h> 37#include <mach/arch/gpio.h>
38#include <asm/mach-types.h> 38#include <asm/mach-types.h>
39 39
40#include "musb_core.h" 40#include "musb_core.h"
@@ -364,6 +364,18 @@ static irqreturn_t davinci_interrupt(int irq, void *__hci)
364 return IRQ_HANDLED; 364 return IRQ_HANDLED;
365} 365}
366 366
367int musb_platform_set_mode(struct musb *musb, u8 mode)
368{
369 /* EVM can't do this (right?) */
370 return -EIO;
371}
372
373int musb_platform_set_mode(struct musb *musb, u8 mode)
374{
375 /* EVM can't do this (right?) */
376 return -EIO;
377}
378
367int __init musb_platform_init(struct musb *musb) 379int __init musb_platform_init(struct musb *musb)
368{ 380{
369 void __iomem *tibase = musb->ctrl_base; 381 void __iomem *tibase = musb->ctrl_base;
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index 5280dba9b1fb..6c7faacfb535 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -148,7 +148,8 @@ static inline struct musb *dev_to_musb(struct device *dev)
148 148
149/*-------------------------------------------------------------------------*/ 149/*-------------------------------------------------------------------------*/
150 150
151#ifndef CONFIG_USB_TUSB6010 151#if !defined(CONFIG_USB_TUSB6010) && !defined(CONFIG_BLACKFIN)
152
152/* 153/*
153 * Load an endpoint's FIFO 154 * Load an endpoint's FIFO
154 */ 155 */
@@ -1124,25 +1125,25 @@ fifo_setup(struct musb *musb, struct musb_hw_ep *hw_ep,
1124#endif 1125#endif
1125 switch (cfg->style) { 1126 switch (cfg->style) {
1126 case FIFO_TX: 1127 case FIFO_TX:
1127 musb_writeb(mbase, MUSB_TXFIFOSZ, c_size); 1128 musb_write_txfifosz(mbase, c_size);
1128 musb_writew(mbase, MUSB_TXFIFOADD, c_off); 1129 musb_write_txfifoadd(mbase, c_off);
1129 hw_ep->tx_double_buffered = !!(c_size & MUSB_FIFOSZ_DPB); 1130 hw_ep->tx_double_buffered = !!(c_size & MUSB_FIFOSZ_DPB);
1130 hw_ep->max_packet_sz_tx = maxpacket; 1131 hw_ep->max_packet_sz_tx = maxpacket;
1131 break; 1132 break;
1132 case FIFO_RX: 1133 case FIFO_RX:
1133 musb_writeb(mbase, MUSB_RXFIFOSZ, c_size); 1134 musb_write_rxfifosz(mbase, c_size);
1134 musb_writew(mbase, MUSB_RXFIFOADD, c_off); 1135 musb_write_rxfifoadd(mbase, c_off);
1135 hw_ep->rx_double_buffered = !!(c_size & MUSB_FIFOSZ_DPB); 1136 hw_ep->rx_double_buffered = !!(c_size & MUSB_FIFOSZ_DPB);
1136 hw_ep->max_packet_sz_rx = maxpacket; 1137 hw_ep->max_packet_sz_rx = maxpacket;
1137 break; 1138 break;
1138 case FIFO_RXTX: 1139 case FIFO_RXTX:
1139 musb_writeb(mbase, MUSB_TXFIFOSZ, c_size); 1140 musb_write_txfifosz(mbase, c_size);
1140 musb_writew(mbase, MUSB_TXFIFOADD, c_off); 1141 musb_write_txfifoadd(mbase, c_off);
1141 hw_ep->rx_double_buffered = !!(c_size & MUSB_FIFOSZ_DPB); 1142 hw_ep->rx_double_buffered = !!(c_size & MUSB_FIFOSZ_DPB);
1142 hw_ep->max_packet_sz_rx = maxpacket; 1143 hw_ep->max_packet_sz_rx = maxpacket;
1143 1144
1144 musb_writeb(mbase, MUSB_RXFIFOSZ, c_size); 1145 musb_write_rxfifosz(mbase, c_size);
1145 musb_writew(mbase, MUSB_RXFIFOADD, c_off); 1146 musb_write_rxfifoadd(mbase, c_off);
1146 hw_ep->tx_double_buffered = hw_ep->rx_double_buffered; 1147 hw_ep->tx_double_buffered = hw_ep->rx_double_buffered;
1147 hw_ep->max_packet_sz_tx = maxpacket; 1148 hw_ep->max_packet_sz_tx = maxpacket;
1148 1149
@@ -1212,7 +1213,7 @@ static int __init ep_config_from_table(struct musb *musb)
1212 if (epn >= musb->config->num_eps) { 1213 if (epn >= musb->config->num_eps) {
1213 pr_debug("%s: invalid ep %d\n", 1214 pr_debug("%s: invalid ep %d\n",
1214 musb_driver_name, epn); 1215 musb_driver_name, epn);
1215 continue; 1216 return -EINVAL;
1216 } 1217 }
1217 offset = fifo_setup(musb, hw_ep + epn, cfg++, offset); 1218 offset = fifo_setup(musb, hw_ep + epn, cfg++, offset);
1218 if (offset < 0) { 1219 if (offset < 0) {
@@ -1246,9 +1247,10 @@ static int __init ep_config_from_table(struct musb *musb)
1246 */ 1247 */
1247static int __init ep_config_from_hw(struct musb *musb) 1248static int __init ep_config_from_hw(struct musb *musb)
1248{ 1249{
1249 u8 epnum = 0, reg; 1250 u8 epnum = 0;
1250 struct musb_hw_ep *hw_ep; 1251 struct musb_hw_ep *hw_ep;
1251 void *mbase = musb->mregs; 1252 void *mbase = musb->mregs;
1253 int ret = 0;
1252 1254
1253 DBG(2, "<== static silicon ep config\n"); 1255 DBG(2, "<== static silicon ep config\n");
1254 1256
@@ -1258,26 +1260,9 @@ static int __init ep_config_from_hw(struct musb *musb)
1258 musb_ep_select(mbase, epnum); 1260 musb_ep_select(mbase, epnum);
1259 hw_ep = musb->endpoints + epnum; 1261 hw_ep = musb->endpoints + epnum;
1260 1262
1261 /* read from core using indexed model */ 1263 ret = musb_read_fifosize(musb, hw_ep, epnum);
1262 reg = musb_readb(hw_ep->regs, 0x10 + MUSB_FIFOSIZE); 1264 if (ret < 0)
1263 if (!reg) {
1264 /* 0's returned when no more endpoints */
1265 break; 1265 break;
1266 }
1267 musb->nr_endpoints++;
1268 musb->epmask |= (1 << epnum);
1269
1270 hw_ep->max_packet_sz_tx = 1 << (reg & 0x0f);
1271
1272 /* shared TX/RX FIFO? */
1273 if ((reg & 0xf0) == 0xf0) {
1274 hw_ep->max_packet_sz_rx = hw_ep->max_packet_sz_tx;
1275 hw_ep->is_shared_fifo = true;
1276 continue;
1277 } else {
1278 hw_ep->max_packet_sz_rx = 1 << ((reg & 0xf0) >> 4);
1279 hw_ep->is_shared_fifo = false;
1280 }
1281 1266
1282 /* FIXME set up hw_ep->{rx,tx}_double_buffered */ 1267 /* FIXME set up hw_ep->{rx,tx}_double_buffered */
1283 1268
@@ -1326,7 +1311,7 @@ static int __init musb_core_init(u16 musb_type, struct musb *musb)
1326 1311
1327 /* log core options (read using indexed model) */ 1312 /* log core options (read using indexed model) */
1328 musb_ep_select(mbase, 0); 1313 musb_ep_select(mbase, 0);
1329 reg = musb_readb(mbase, 0x10 + MUSB_CONFIGDATA); 1314 reg = musb_read_configdata(mbase);
1330 1315
1331 strcpy(aInfo, (reg & MUSB_CONFIGDATA_UTMIDW) ? "UTMI-16" : "UTMI-8"); 1316 strcpy(aInfo, (reg & MUSB_CONFIGDATA_UTMIDW) ? "UTMI-16" : "UTMI-8");
1332 if (reg & MUSB_CONFIGDATA_DYNFIFO) 1317 if (reg & MUSB_CONFIGDATA_DYNFIFO)
@@ -1391,7 +1376,7 @@ static int __init musb_core_init(u16 musb_type, struct musb *musb)
1391 } 1376 }
1392 1377
1393 /* log release info */ 1378 /* log release info */
1394 hwvers = musb_readw(mbase, MUSB_HWVERS); 1379 hwvers = musb_read_hwvers(mbase);
1395 rev_major = (hwvers >> 10) & 0x1f; 1380 rev_major = (hwvers >> 10) & 0x1f;
1396 rev_minor = hwvers & 0x3ff; 1381 rev_minor = hwvers & 0x3ff;
1397 snprintf(aRevision, 32, "%d.%d%s", rev_major, 1382 snprintf(aRevision, 32, "%d.%d%s", rev_major,
@@ -1400,8 +1385,7 @@ static int __init musb_core_init(u16 musb_type, struct musb *musb)
1400 musb_driver_name, type, aRevision, aDate); 1385 musb_driver_name, type, aRevision, aDate);
1401 1386
1402 /* configure ep0 */ 1387 /* configure ep0 */
1403 musb->endpoints[0].max_packet_sz_tx = MUSB_EP0_FIFOSIZE; 1388 musb_configure_ep0(musb);
1404 musb->endpoints[0].max_packet_sz_rx = MUSB_EP0_FIFOSIZE;
1405 1389
1406 /* discover endpoint configuration */ 1390 /* discover endpoint configuration */
1407 musb->nr_endpoints = 1; 1391 musb->nr_endpoints = 1;
@@ -1445,7 +1429,7 @@ static int __init musb_core_init(u16 musb_type, struct musb *musb)
1445 1429
1446 hw_ep->regs = MUSB_EP_OFFSET(i, 0) + mbase; 1430 hw_ep->regs = MUSB_EP_OFFSET(i, 0) + mbase;
1447#ifdef CONFIG_USB_MUSB_HDRC_HCD 1431#ifdef CONFIG_USB_MUSB_HDRC_HCD
1448 hw_ep->target_regs = MUSB_BUSCTL_OFFSET(i, 0) + mbase; 1432 hw_ep->target_regs = musb_read_target_reg_base(i, mbase);
1449 hw_ep->rx_reinit = 1; 1433 hw_ep->rx_reinit = 1;
1450 hw_ep->tx_reinit = 1; 1434 hw_ep->tx_reinit = 1;
1451#endif 1435#endif
@@ -1671,17 +1655,20 @@ musb_mode_store(struct device *dev, struct device_attribute *attr,
1671{ 1655{
1672 struct musb *musb = dev_to_musb(dev); 1656 struct musb *musb = dev_to_musb(dev);
1673 unsigned long flags; 1657 unsigned long flags;
1658 int status;
1674 1659
1675 spin_lock_irqsave(&musb->lock, flags); 1660 spin_lock_irqsave(&musb->lock, flags);
1676 if (!strncmp(buf, "host", 4)) 1661 if (sysfs_streq(buf, "host"))
1677 musb_platform_set_mode(musb, MUSB_HOST); 1662 status = musb_platform_set_mode(musb, MUSB_HOST);
1678 if (!strncmp(buf, "peripheral", 10)) 1663 else if (sysfs_streq(buf, "peripheral"))
1679 musb_platform_set_mode(musb, MUSB_PERIPHERAL); 1664 status = musb_platform_set_mode(musb, MUSB_PERIPHERAL);
1680 if (!strncmp(buf, "otg", 3)) 1665 else if (sysfs_streq(buf, "otg"))
1681 musb_platform_set_mode(musb, MUSB_OTG); 1666 status = musb_platform_set_mode(musb, MUSB_OTG);
1667 else
1668 status = -EINVAL;
1682 spin_unlock_irqrestore(&musb->lock, flags); 1669 spin_unlock_irqrestore(&musb->lock, flags);
1683 1670
1684 return n; 1671 return (status == 0) ? n : status;
1685} 1672}
1686static DEVICE_ATTR(mode, 0644, musb_mode_show, musb_mode_store); 1673static DEVICE_ATTR(mode, 0644, musb_mode_show, musb_mode_store);
1687 1674
@@ -1781,7 +1768,7 @@ allocate_instance(struct device *dev,
1781#ifdef CONFIG_USB_MUSB_HDRC_HCD 1768#ifdef CONFIG_USB_MUSB_HDRC_HCD
1782 struct usb_hcd *hcd; 1769 struct usb_hcd *hcd;
1783 1770
1784 hcd = usb_create_hcd(&musb_hc_driver, dev, dev->bus_id); 1771 hcd = usb_create_hcd(&musb_hc_driver, dev, dev_name(dev));
1785 if (!hcd) 1772 if (!hcd)
1786 return NULL; 1773 return NULL;
1787 /* usbcore sets dev->driver_data to hcd, and sometimes uses that... */ 1774 /* usbcore sets dev->driver_data to hcd, and sometimes uses that... */
@@ -1810,7 +1797,6 @@ allocate_instance(struct device *dev,
1810 for (epnum = 0, ep = musb->endpoints; 1797 for (epnum = 0, ep = musb->endpoints;
1811 epnum < musb->config->num_eps; 1798 epnum < musb->config->num_eps;
1812 epnum++, ep++) { 1799 epnum++, ep++) {
1813
1814 ep->musb = musb; 1800 ep->musb = musb;
1815 ep->epnum = epnum; 1801 ep->epnum = epnum;
1816 } 1802 }
@@ -1838,7 +1824,7 @@ static void musb_free(struct musb *musb)
1838 musb_gadget_cleanup(musb); 1824 musb_gadget_cleanup(musb);
1839#endif 1825#endif
1840 1826
1841 if (musb->nIrq >= 0) { 1827 if (musb->nIrq >= 0 && musb->irq_wake) {
1842 disable_irq_wake(musb->nIrq); 1828 disable_irq_wake(musb->nIrq);
1843 free_irq(musb->nIrq, musb); 1829 free_irq(musb->nIrq, musb);
1844 } 1830 }
@@ -1984,15 +1970,19 @@ bad_config:
1984 INIT_WORK(&musb->irq_work, musb_irq_work); 1970 INIT_WORK(&musb->irq_work, musb_irq_work);
1985 1971
1986 /* attach to the IRQ */ 1972 /* attach to the IRQ */
1987 if (request_irq(nIrq, musb->isr, 0, dev->bus_id, musb)) { 1973 if (request_irq(nIrq, musb->isr, 0, dev_name(dev), musb)) {
1988 dev_err(dev, "request_irq %d failed!\n", nIrq); 1974 dev_err(dev, "request_irq %d failed!\n", nIrq);
1989 status = -ENODEV; 1975 status = -ENODEV;
1990 goto fail2; 1976 goto fail2;
1991 } 1977 }
1992 musb->nIrq = nIrq; 1978 musb->nIrq = nIrq;
1993/* FIXME this handles wakeup irqs wrong */ 1979/* FIXME this handles wakeup irqs wrong */
1994 if (enable_irq_wake(nIrq) == 0) 1980 if (enable_irq_wake(nIrq) == 0) {
1981 musb->irq_wake = 1;
1995 device_init_wakeup(dev, 1); 1982 device_init_wakeup(dev, 1);
1983 } else {
1984 musb->irq_wake = 0;
1985 }
1996 1986
1997 pr_info("%s: USB %s mode controller at %p using %s, IRQ %d\n", 1987 pr_info("%s: USB %s mode controller at %p using %s, IRQ %d\n",
1998 musb_driver_name, 1988 musb_driver_name,
diff --git a/drivers/usb/musb/musb_core.h b/drivers/usb/musb/musb_core.h
index 82227251931b..630946a2d9fc 100644
--- a/drivers/usb/musb/musb_core.h
+++ b/drivers/usb/musb/musb_core.h
@@ -191,7 +191,7 @@ enum musb_g_ep0_state {
191 */ 191 */
192 192
193#if defined(CONFIG_ARCH_DAVINCI) || defined(CONFIG_ARCH_OMAP2430) \ 193#if defined(CONFIG_ARCH_DAVINCI) || defined(CONFIG_ARCH_OMAP2430) \
194 || defined(CONFIG_ARCH_OMAP3430) 194 || defined(CONFIG_ARCH_OMAP3430) || defined(CONFIG_BLACKFIN)
195/* REVISIT indexed access seemed to 195/* REVISIT indexed access seemed to
196 * misbehave (on DaVinci) for at least peripheral IN ... 196 * misbehave (on DaVinci) for at least peripheral IN ...
197 */ 197 */
@@ -359,6 +359,7 @@ struct musb {
359 struct otg_transceiver xceiv; 359 struct otg_transceiver xceiv;
360 360
361 int nIrq; 361 int nIrq;
362 unsigned irq_wake:1;
362 363
363 struct musb_hw_ep endpoints[MUSB_C_NUM_EPS]; 364 struct musb_hw_ep endpoints[MUSB_C_NUM_EPS];
364#define control_ep endpoints 365#define control_ep endpoints
@@ -447,6 +448,70 @@ static inline struct musb *gadget_to_musb(struct usb_gadget *g)
447} 448}
448#endif 449#endif
449 450
451#ifdef CONFIG_BLACKFIN
452static inline int musb_read_fifosize(struct musb *musb,
453 struct musb_hw_ep *hw_ep, u8 epnum)
454{
455 musb->nr_endpoints++;
456 musb->epmask |= (1 << epnum);
457
458 if (epnum < 5) {
459 hw_ep->max_packet_sz_tx = 128;
460 hw_ep->max_packet_sz_rx = 128;
461 } else {
462 hw_ep->max_packet_sz_tx = 1024;
463 hw_ep->max_packet_sz_rx = 1024;
464 }
465 hw_ep->is_shared_fifo = false;
466
467 return 0;
468}
469
470static inline void musb_configure_ep0(struct musb *musb)
471{
472 musb->endpoints[0].max_packet_sz_tx = MUSB_EP0_FIFOSIZE;
473 musb->endpoints[0].max_packet_sz_rx = MUSB_EP0_FIFOSIZE;
474 musb->endpoints[0].is_shared_fifo = true;
475}
476
477#else
478
479static inline int musb_read_fifosize(struct musb *musb,
480 struct musb_hw_ep *hw_ep, u8 epnum)
481{
482 u8 reg = 0;
483
484 /* read from core using indexed model */
485 reg = musb_readb(hw_ep->regs, 0x10 + MUSB_FIFOSIZE);
486 /* 0's returned when no more endpoints */
487 if (!reg)
488 return -ENODEV;
489
490 musb->nr_endpoints++;
491 musb->epmask |= (1 << epnum);
492
493 hw_ep->max_packet_sz_tx = 1 << (reg & 0x0f);
494
495 /* shared TX/RX FIFO? */
496 if ((reg & 0xf0) == 0xf0) {
497 hw_ep->max_packet_sz_rx = hw_ep->max_packet_sz_tx;
498 hw_ep->is_shared_fifo = true;
499 return 0;
500 } else {
501 hw_ep->max_packet_sz_rx = 1 << ((reg & 0xf0) >> 4);
502 hw_ep->is_shared_fifo = false;
503 }
504
505 return 0;
506}
507
508static inline void musb_configure_ep0(struct musb *musb)
509{
510 musb->endpoints[0].max_packet_sz_tx = MUSB_EP0_FIFOSIZE;
511 musb->endpoints[0].max_packet_sz_rx = MUSB_EP0_FIFOSIZE;
512}
513#endif /* CONFIG_BLACKFIN */
514
450 515
451/***************************** Glue it together *****************************/ 516/***************************** Glue it together *****************************/
452 517
@@ -467,16 +532,16 @@ extern void musb_platform_disable(struct musb *musb);
467 532
468extern void musb_hnp_stop(struct musb *musb); 533extern void musb_hnp_stop(struct musb *musb);
469 534
470extern void musb_platform_set_mode(struct musb *musb, u8 musb_mode); 535extern int musb_platform_set_mode(struct musb *musb, u8 musb_mode);
471 536
472#if defined(CONFIG_USB_TUSB6010) || \ 537#if defined(CONFIG_USB_TUSB6010) || defined(CONFIG_BLACKFIN) || \
473 defined(CONFIG_ARCH_OMAP2430) || defined(CONFIG_ARCH_OMAP34XX) 538 defined(CONFIG_ARCH_OMAP2430) || defined(CONFIG_ARCH_OMAP34XX)
474extern void musb_platform_try_idle(struct musb *musb, unsigned long timeout); 539extern void musb_platform_try_idle(struct musb *musb, unsigned long timeout);
475#else 540#else
476#define musb_platform_try_idle(x, y) do {} while (0) 541#define musb_platform_try_idle(x, y) do {} while (0)
477#endif 542#endif
478 543
479#ifdef CONFIG_USB_TUSB6010 544#if defined(CONFIG_USB_TUSB6010) || defined(CONFIG_BLACKFIN)
480extern int musb_platform_get_vbus_status(struct musb *musb); 545extern int musb_platform_get_vbus_status(struct musb *musb);
481#else 546#else
482#define musb_platform_get_vbus_status(x) 0 547#define musb_platform_get_vbus_status(x) 0
diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c
index d6a802c224fa..6197daeab8f9 100644
--- a/drivers/usb/musb/musb_gadget.c
+++ b/drivers/usb/musb/musb_gadget.c
@@ -1633,7 +1633,7 @@ int __init musb_gadget_setup(struct musb *musb)
1633 musb->g.speed = USB_SPEED_UNKNOWN; 1633 musb->g.speed = USB_SPEED_UNKNOWN;
1634 1634
1635 /* this "gadget" abstracts/virtualizes the controller */ 1635 /* this "gadget" abstracts/virtualizes the controller */
1636 strcpy(musb->g.dev.bus_id, "gadget"); 1636 dev_set_name(&musb->g.dev, "gadget");
1637 musb->g.dev.parent = musb->controller; 1637 musb->g.dev.parent = musb->controller;
1638 musb->g.dev.dma_mask = musb->controller->dma_mask; 1638 musb->g.dev.dma_mask = musb->controller->dma_mask;
1639 musb->g.dev.release = musb_gadget_release; 1639 musb->g.dev.release = musb_gadget_release;
diff --git a/drivers/usb/musb/musb_host.c b/drivers/usb/musb/musb_host.c
index cc64462d4c4e..99fa61234876 100644
--- a/drivers/usb/musb/musb_host.c
+++ b/drivers/usb/musb/musb_host.c
@@ -112,18 +112,21 @@ static void musb_h_tx_flush_fifo(struct musb_hw_ep *ep)
112{ 112{
113 void __iomem *epio = ep->regs; 113 void __iomem *epio = ep->regs;
114 u16 csr; 114 u16 csr;
115 u16 lastcsr = 0;
115 int retries = 1000; 116 int retries = 1000;
116 117
117 csr = musb_readw(epio, MUSB_TXCSR); 118 csr = musb_readw(epio, MUSB_TXCSR);
118 while (csr & MUSB_TXCSR_FIFONOTEMPTY) { 119 while (csr & MUSB_TXCSR_FIFONOTEMPTY) {
119 DBG(5, "Host TX FIFONOTEMPTY csr: %02x\n", csr); 120 if (csr != lastcsr)
121 DBG(3, "Host TX FIFONOTEMPTY csr: %02x\n", csr);
122 lastcsr = csr;
120 csr |= MUSB_TXCSR_FLUSHFIFO; 123 csr |= MUSB_TXCSR_FLUSHFIFO;
121 musb_writew(epio, MUSB_TXCSR, csr); 124 musb_writew(epio, MUSB_TXCSR, csr);
122 csr = musb_readw(epio, MUSB_TXCSR); 125 csr = musb_readw(epio, MUSB_TXCSR);
123 if (retries-- < 1) { 126 if (WARN(retries-- < 1,
124 ERR("Could not flush host TX fifo: csr: %04x\n", csr); 127 "Could not flush host TX%d fifo: csr: %04x\n",
128 ep->epnum, csr))
125 return; 129 return;
126 }
127 mdelay(1); 130 mdelay(1);
128 } 131 }
129} 132}
@@ -268,7 +271,7 @@ __musb_giveback(struct musb *musb, struct urb *urb, int status)
268__releases(musb->lock) 271__releases(musb->lock)
269__acquires(musb->lock) 272__acquires(musb->lock)
270{ 273{
271 DBG(({ int level; switch (urb->status) { 274 DBG(({ int level; switch (status) {
272 case 0: 275 case 0:
273 level = 4; 276 level = 4;
274 break; 277 break;
@@ -283,8 +286,8 @@ __acquires(musb->lock)
283 level = 2; 286 level = 2;
284 break; 287 break;
285 }; level; }), 288 }; level; }),
286 "complete %p (%d), dev%d ep%d%s, %d/%d\n", 289 "complete %p %pF (%d), dev%d ep%d%s, %d/%d\n",
287 urb, urb->status, 290 urb, urb->complete, status,
288 usb_pipedevice(urb->pipe), 291 usb_pipedevice(urb->pipe),
289 usb_pipeendpoint(urb->pipe), 292 usb_pipeendpoint(urb->pipe),
290 usb_pipein(urb->pipe) ? "in" : "out", 293 usb_pipein(urb->pipe) ? "in" : "out",
@@ -593,12 +596,10 @@ musb_rx_reinit(struct musb *musb, struct musb_qh *qh, struct musb_hw_ep *ep)
593 596
594 /* target addr and (for multipoint) hub addr/port */ 597 /* target addr and (for multipoint) hub addr/port */
595 if (musb->is_multipoint) { 598 if (musb->is_multipoint) {
596 musb_writeb(ep->target_regs, MUSB_RXFUNCADDR, 599 musb_write_rxfunaddr(ep->target_regs, qh->addr_reg);
597 qh->addr_reg); 600 musb_write_rxhubaddr(ep->target_regs, qh->h_addr_reg);
598 musb_writeb(ep->target_regs, MUSB_RXHUBADDR, 601 musb_write_rxhubport(ep->target_regs, qh->h_port_reg);
599 qh->h_addr_reg); 602
600 musb_writeb(ep->target_regs, MUSB_RXHUBPORT,
601 qh->h_port_reg);
602 } else 603 } else
603 musb_writeb(musb->mregs, MUSB_FADDR, qh->addr_reg); 604 musb_writeb(musb->mregs, MUSB_FADDR, qh->addr_reg);
604 605
@@ -712,15 +713,9 @@ static void musb_ep_program(struct musb *musb, u8 epnum,
712 713
713 /* target addr and (for multipoint) hub addr/port */ 714 /* target addr and (for multipoint) hub addr/port */
714 if (musb->is_multipoint) { 715 if (musb->is_multipoint) {
715 musb_writeb(mbase, 716 musb_write_txfunaddr(mbase, epnum, qh->addr_reg);
716 MUSB_BUSCTL_OFFSET(epnum, MUSB_TXFUNCADDR), 717 musb_write_txhubaddr(mbase, epnum, qh->h_addr_reg);
717 qh->addr_reg); 718 musb_write_txhubport(mbase, epnum, qh->h_port_reg);
718 musb_writeb(mbase,
719 MUSB_BUSCTL_OFFSET(epnum, MUSB_TXHUBADDR),
720 qh->h_addr_reg);
721 musb_writeb(mbase,
722 MUSB_BUSCTL_OFFSET(epnum, MUSB_TXHUBPORT),
723 qh->h_port_reg);
724/* FIXME if !epnum, do the same for RX ... */ 719/* FIXME if !epnum, do the same for RX ... */
725 } else 720 } else
726 musb_writeb(mbase, MUSB_FADDR, qh->addr_reg); 721 musb_writeb(mbase, MUSB_FADDR, qh->addr_reg);
@@ -988,8 +983,10 @@ static bool musb_h_ep0_continue(struct musb *musb, u16 len, struct urb *urb)
988 if (fifo_count) { 983 if (fifo_count) {
989 fifo_dest = (u8 *) (urb->transfer_buffer 984 fifo_dest = (u8 *) (urb->transfer_buffer
990 + urb->actual_length); 985 + urb->actual_length);
991 DBG(3, "Sending %d bytes to %p\n", 986 DBG(3, "Sending %d byte%s to ep0 fifo %p\n",
992 fifo_count, fifo_dest); 987 fifo_count,
988 (fifo_count == 1) ? "" : "s",
989 fifo_dest);
993 musb_write_fifo(hw_ep, fifo_count, fifo_dest); 990 musb_write_fifo(hw_ep, fifo_count, fifo_dest);
994 991
995 urb->actual_length += fifo_count; 992 urb->actual_length += fifo_count;
diff --git a/drivers/usb/musb/musb_io.h b/drivers/usb/musb/musb_io.h
index 223f0a514094..b06e9ef00cfc 100644
--- a/drivers/usb/musb/musb_io.h
+++ b/drivers/usb/musb/musb_io.h
@@ -39,7 +39,7 @@
39 39
40#if !defined(CONFIG_ARM) && !defined(CONFIG_SUPERH) \ 40#if !defined(CONFIG_ARM) && !defined(CONFIG_SUPERH) \
41 && !defined(CONFIG_AVR32) && !defined(CONFIG_PPC32) \ 41 && !defined(CONFIG_AVR32) && !defined(CONFIG_PPC32) \
42 && !defined(CONFIG_PPC64) 42 && !defined(CONFIG_PPC64) && !defined(CONFIG_BLACKFIN)
43static inline void readsl(const void __iomem *addr, void *buf, int len) 43static inline void readsl(const void __iomem *addr, void *buf, int len)
44 { insl((unsigned long)addr, buf, len); } 44 { insl((unsigned long)addr, buf, len); }
45static inline void readsw(const void __iomem *addr, void *buf, int len) 45static inline void readsw(const void __iomem *addr, void *buf, int len)
@@ -56,6 +56,8 @@ static inline void writesb(const void __iomem *addr, const void *buf, int len)
56 56
57#endif 57#endif
58 58
59#ifndef CONFIG_BLACKFIN
60
59/* NOTE: these offsets are all in bytes */ 61/* NOTE: these offsets are all in bytes */
60 62
61static inline u16 musb_readw(const void __iomem *addr, unsigned offset) 63static inline u16 musb_readw(const void __iomem *addr, unsigned offset)
@@ -114,4 +116,26 @@ static inline void musb_writeb(void __iomem *addr, unsigned offset, u8 data)
114 116
115#endif /* CONFIG_USB_TUSB6010 */ 117#endif /* CONFIG_USB_TUSB6010 */
116 118
119#else
120
121static inline u8 musb_readb(const void __iomem *addr, unsigned offset)
122 { return (u8) (bfin_read16(addr + offset)); }
123
124static inline u16 musb_readw(const void __iomem *addr, unsigned offset)
125 { return bfin_read16(addr + offset); }
126
127static inline u32 musb_readl(const void __iomem *addr, unsigned offset)
128 { return (u32) (bfin_read16(addr + offset)); }
129
130static inline void musb_writeb(void __iomem *addr, unsigned offset, u8 data)
131 { bfin_write16(addr + offset, (u16) data); }
132
133static inline void musb_writew(void __iomem *addr, unsigned offset, u16 data)
134 { bfin_write16(addr + offset, data); }
135
136static inline void musb_writel(void __iomem *addr, unsigned offset, u32 data)
137 { bfin_write16(addr + offset, (u16) data); }
138
139#endif /* CONFIG_BLACKFIN */
140
117#endif 141#endif
diff --git a/drivers/usb/musb/musb_regs.h b/drivers/usb/musb/musb_regs.h
index 9c228661aa5a..de3b2f18db44 100644
--- a/drivers/usb/musb/musb_regs.h
+++ b/drivers/usb/musb/musb_regs.h
@@ -38,97 +38,6 @@
38#define MUSB_EP0_FIFOSIZE 64 /* This is non-configurable */ 38#define MUSB_EP0_FIFOSIZE 64 /* This is non-configurable */
39 39
40/* 40/*
41 * Common USB registers
42 */
43
44#define MUSB_FADDR 0x00 /* 8-bit */
45#define MUSB_POWER 0x01 /* 8-bit */
46
47#define MUSB_INTRTX 0x02 /* 16-bit */
48#define MUSB_INTRRX 0x04
49#define MUSB_INTRTXE 0x06
50#define MUSB_INTRRXE 0x08
51#define MUSB_INTRUSB 0x0A /* 8 bit */
52#define MUSB_INTRUSBE 0x0B /* 8 bit */
53#define MUSB_FRAME 0x0C
54#define MUSB_INDEX 0x0E /* 8 bit */
55#define MUSB_TESTMODE 0x0F /* 8 bit */
56
57/* Get offset for a given FIFO from musb->mregs */
58#ifdef CONFIG_USB_TUSB6010
59#define MUSB_FIFO_OFFSET(epnum) (0x200 + ((epnum) * 0x20))
60#else
61#define MUSB_FIFO_OFFSET(epnum) (0x20 + ((epnum) * 4))
62#endif
63
64/*
65 * Additional Control Registers
66 */
67
68#define MUSB_DEVCTL 0x60 /* 8 bit */
69
70/* These are always controlled through the INDEX register */
71#define MUSB_TXFIFOSZ 0x62 /* 8-bit (see masks) */
72#define MUSB_RXFIFOSZ 0x63 /* 8-bit (see masks) */
73#define MUSB_TXFIFOADD 0x64 /* 16-bit offset shifted right 3 */
74#define MUSB_RXFIFOADD 0x66 /* 16-bit offset shifted right 3 */
75
76/* REVISIT: vctrl/vstatus: optional vendor utmi+phy register at 0x68 */
77#define MUSB_HWVERS 0x6C /* 8 bit */
78
79#define MUSB_EPINFO 0x78 /* 8 bit */
80#define MUSB_RAMINFO 0x79 /* 8 bit */
81#define MUSB_LINKINFO 0x7a /* 8 bit */
82#define MUSB_VPLEN 0x7b /* 8 bit */
83#define MUSB_HS_EOF1 0x7c /* 8 bit */
84#define MUSB_FS_EOF1 0x7d /* 8 bit */
85#define MUSB_LS_EOF1 0x7e /* 8 bit */
86
87/* Offsets to endpoint registers */
88#define MUSB_TXMAXP 0x00
89#define MUSB_TXCSR 0x02
90#define MUSB_CSR0 MUSB_TXCSR /* Re-used for EP0 */
91#define MUSB_RXMAXP 0x04
92#define MUSB_RXCSR 0x06
93#define MUSB_RXCOUNT 0x08
94#define MUSB_COUNT0 MUSB_RXCOUNT /* Re-used for EP0 */
95#define MUSB_TXTYPE 0x0A
96#define MUSB_TYPE0 MUSB_TXTYPE /* Re-used for EP0 */
97#define MUSB_TXINTERVAL 0x0B
98#define MUSB_NAKLIMIT0 MUSB_TXINTERVAL /* Re-used for EP0 */
99#define MUSB_RXTYPE 0x0C
100#define MUSB_RXINTERVAL 0x0D
101#define MUSB_FIFOSIZE 0x0F
102#define MUSB_CONFIGDATA MUSB_FIFOSIZE /* Re-used for EP0 */
103
104/* Offsets to endpoint registers in indexed model (using INDEX register) */
105#define MUSB_INDEXED_OFFSET(_epnum, _offset) \
106 (0x10 + (_offset))
107
108/* Offsets to endpoint registers in flat models */
109#define MUSB_FLAT_OFFSET(_epnum, _offset) \
110 (0x100 + (0x10*(_epnum)) + (_offset))
111
112#ifdef CONFIG_USB_TUSB6010
113/* TUSB6010 EP0 configuration register is special */
114#define MUSB_TUSB_OFFSET(_epnum, _offset) \
115 (0x10 + _offset)
116#include "tusb6010.h" /* Needed "only" for TUSB_EP0_CONF */
117#endif
118
119/* "bus control"/target registers, for host side multipoint (external hubs) */
120#define MUSB_TXFUNCADDR 0x00
121#define MUSB_TXHUBADDR 0x02
122#define MUSB_TXHUBPORT 0x03
123
124#define MUSB_RXFUNCADDR 0x04
125#define MUSB_RXHUBADDR 0x06
126#define MUSB_RXHUBPORT 0x07
127
128#define MUSB_BUSCTL_OFFSET(_epnum, _offset) \
129 (0x80 + (8*(_epnum)) + (_offset))
130
131/*
132 * MUSB Register bits 41 * MUSB Register bits
133 */ 42 */
134 43
@@ -228,7 +137,6 @@
228 137
229/* TXCSR in Peripheral and Host mode */ 138/* TXCSR in Peripheral and Host mode */
230#define MUSB_TXCSR_AUTOSET 0x8000 139#define MUSB_TXCSR_AUTOSET 0x8000
231#define MUSB_TXCSR_MODE 0x2000
232#define MUSB_TXCSR_DMAENAB 0x1000 140#define MUSB_TXCSR_DMAENAB 0x1000
233#define MUSB_TXCSR_FRCDATATOG 0x0800 141#define MUSB_TXCSR_FRCDATATOG 0x0800
234#define MUSB_TXCSR_DMAMODE 0x0400 142#define MUSB_TXCSR_DMAMODE 0x0400
@@ -297,4 +205,309 @@
297/* HUBADDR */ 205/* HUBADDR */
298#define MUSB_HUBADDR_MULTI_TT 0x80 206#define MUSB_HUBADDR_MULTI_TT 0x80
299 207
208
209#ifndef CONFIG_BLACKFIN
210
211/*
212 * Common USB registers
213 */
214
215#define MUSB_FADDR 0x00 /* 8-bit */
216#define MUSB_POWER 0x01 /* 8-bit */
217
218#define MUSB_INTRTX 0x02 /* 16-bit */
219#define MUSB_INTRRX 0x04
220#define MUSB_INTRTXE 0x06
221#define MUSB_INTRRXE 0x08
222#define MUSB_INTRUSB 0x0A /* 8 bit */
223#define MUSB_INTRUSBE 0x0B /* 8 bit */
224#define MUSB_FRAME 0x0C
225#define MUSB_INDEX 0x0E /* 8 bit */
226#define MUSB_TESTMODE 0x0F /* 8 bit */
227
228/* Get offset for a given FIFO from musb->mregs */
229#ifdef CONFIG_USB_TUSB6010
230#define MUSB_FIFO_OFFSET(epnum) (0x200 + ((epnum) * 0x20))
231#else
232#define MUSB_FIFO_OFFSET(epnum) (0x20 + ((epnum) * 4))
233#endif
234
235/*
236 * Additional Control Registers
237 */
238
239#define MUSB_DEVCTL 0x60 /* 8 bit */
240
241/* These are always controlled through the INDEX register */
242#define MUSB_TXFIFOSZ 0x62 /* 8-bit (see masks) */
243#define MUSB_RXFIFOSZ 0x63 /* 8-bit (see masks) */
244#define MUSB_TXFIFOADD 0x64 /* 16-bit offset shifted right 3 */
245#define MUSB_RXFIFOADD 0x66 /* 16-bit offset shifted right 3 */
246
247/* REVISIT: vctrl/vstatus: optional vendor utmi+phy register at 0x68 */
248#define MUSB_HWVERS 0x6C /* 8 bit */
249
250#define MUSB_EPINFO 0x78 /* 8 bit */
251#define MUSB_RAMINFO 0x79 /* 8 bit */
252#define MUSB_LINKINFO 0x7a /* 8 bit */
253#define MUSB_VPLEN 0x7b /* 8 bit */
254#define MUSB_HS_EOF1 0x7c /* 8 bit */
255#define MUSB_FS_EOF1 0x7d /* 8 bit */
256#define MUSB_LS_EOF1 0x7e /* 8 bit */
257
258/* Offsets to endpoint registers */
259#define MUSB_TXMAXP 0x00
260#define MUSB_TXCSR 0x02
261#define MUSB_CSR0 MUSB_TXCSR /* Re-used for EP0 */
262#define MUSB_RXMAXP 0x04
263#define MUSB_RXCSR 0x06
264#define MUSB_RXCOUNT 0x08
265#define MUSB_COUNT0 MUSB_RXCOUNT /* Re-used for EP0 */
266#define MUSB_TXTYPE 0x0A
267#define MUSB_TYPE0 MUSB_TXTYPE /* Re-used for EP0 */
268#define MUSB_TXINTERVAL 0x0B
269#define MUSB_NAKLIMIT0 MUSB_TXINTERVAL /* Re-used for EP0 */
270#define MUSB_RXTYPE 0x0C
271#define MUSB_RXINTERVAL 0x0D
272#define MUSB_FIFOSIZE 0x0F
273#define MUSB_CONFIGDATA MUSB_FIFOSIZE /* Re-used for EP0 */
274
275/* Offsets to endpoint registers in indexed model (using INDEX register) */
276#define MUSB_INDEXED_OFFSET(_epnum, _offset) \
277 (0x10 + (_offset))
278
279/* Offsets to endpoint registers in flat models */
280#define MUSB_FLAT_OFFSET(_epnum, _offset) \
281 (0x100 + (0x10*(_epnum)) + (_offset))
282
283#ifdef CONFIG_USB_TUSB6010
284/* TUSB6010 EP0 configuration register is special */
285#define MUSB_TUSB_OFFSET(_epnum, _offset) \
286 (0x10 + _offset)
287#include "tusb6010.h" /* Needed "only" for TUSB_EP0_CONF */
288#endif
289
290#define MUSB_TXCSR_MODE 0x2000
291
292/* "bus control"/target registers, for host side multipoint (external hubs) */
293#define MUSB_TXFUNCADDR 0x00
294#define MUSB_TXHUBADDR 0x02
295#define MUSB_TXHUBPORT 0x03
296
297#define MUSB_RXFUNCADDR 0x04
298#define MUSB_RXHUBADDR 0x06
299#define MUSB_RXHUBPORT 0x07
300
301#define MUSB_BUSCTL_OFFSET(_epnum, _offset) \
302 (0x80 + (8*(_epnum)) + (_offset))
303
304static inline void musb_write_txfifosz(void __iomem *mbase, u8 c_size)
305{
306 musb_writeb(mbase, MUSB_TXFIFOSZ, c_size);
307}
308
309static inline void musb_write_txfifoadd(void __iomem *mbase, u16 c_off)
310{
311 musb_writew(mbase, MUSB_TXFIFOADD, c_off);
312}
313
314static inline void musb_write_rxfifosz(void __iomem *mbase, u8 c_size)
315{
316 musb_writeb(mbase, MUSB_RXFIFOSZ, c_size);
317}
318
319static inline void musb_write_rxfifoadd(void __iomem *mbase, u16 c_off)
320{
321 musb_writew(mbase, MUSB_RXFIFOADD, c_off);
322}
323
324static inline u8 musb_read_configdata(void __iomem *mbase)
325{
326 return musb_readb(mbase, 0x10 + MUSB_CONFIGDATA);
327}
328
329static inline u16 musb_read_hwvers(void __iomem *mbase)
330{
331 return musb_readw(mbase, MUSB_HWVERS);
332}
333
334static inline void __iomem *musb_read_target_reg_base(u8 i, void __iomem *mbase)
335{
336 return (MUSB_BUSCTL_OFFSET(i, 0) + mbase);
337}
338
339static inline void musb_write_rxfunaddr(void __iomem *ep_target_regs,
340 u8 qh_addr_reg)
341{
342 musb_writeb(ep_target_regs, MUSB_RXFUNCADDR, qh_addr_reg);
343}
344
345static inline void musb_write_rxhubaddr(void __iomem *ep_target_regs,
346 u8 qh_h_addr_reg)
347{
348 musb_writeb(ep_target_regs, MUSB_RXHUBADDR, qh_h_addr_reg);
349}
350
351static inline void musb_write_rxhubport(void __iomem *ep_target_regs,
352 u8 qh_h_port_reg)
353{
354 musb_writeb(ep_target_regs, MUSB_RXHUBPORT, qh_h_port_reg);
355}
356
357static inline void musb_write_txfunaddr(void __iomem *mbase, u8 epnum,
358 u8 qh_addr_reg)
359{
360 musb_writeb(mbase, MUSB_BUSCTL_OFFSET(epnum, MUSB_TXFUNCADDR),
361 qh_addr_reg);
362}
363
364static inline void musb_write_txhubaddr(void __iomem *mbase, u8 epnum,
365 u8 qh_addr_reg)
366{
367 musb_writeb(mbase, MUSB_BUSCTL_OFFSET(epnum, MUSB_TXHUBADDR),
368 qh_addr_reg);
369}
370
371static inline void musb_write_txhubport(void __iomem *mbase, u8 epnum,
372 u8 qh_h_port_reg)
373{
374 musb_writeb(mbase, MUSB_BUSCTL_OFFSET(epnum, MUSB_TXHUBPORT),
375 qh_h_port_reg);
376}
377
378#else /* CONFIG_BLACKFIN */
379
380#define USB_BASE USB_FADDR
381#define USB_OFFSET(reg) (reg - USB_BASE)
382
383/*
384 * Common USB registers
385 */
386#define MUSB_FADDR USB_OFFSET(USB_FADDR) /* 8-bit */
387#define MUSB_POWER USB_OFFSET(USB_POWER) /* 8-bit */
388#define MUSB_INTRTX USB_OFFSET(USB_INTRTX) /* 16-bit */
389#define MUSB_INTRRX USB_OFFSET(USB_INTRRX)
390#define MUSB_INTRTXE USB_OFFSET(USB_INTRTXE)
391#define MUSB_INTRRXE USB_OFFSET(USB_INTRRXE)
392#define MUSB_INTRUSB USB_OFFSET(USB_INTRUSB) /* 8 bit */
393#define MUSB_INTRUSBE USB_OFFSET(USB_INTRUSBE)/* 8 bit */
394#define MUSB_FRAME USB_OFFSET(USB_FRAME)
395#define MUSB_INDEX USB_OFFSET(USB_INDEX) /* 8 bit */
396#define MUSB_TESTMODE USB_OFFSET(USB_TESTMODE)/* 8 bit */
397
398/* Get offset for a given FIFO from musb->mregs */
399#define MUSB_FIFO_OFFSET(epnum) \
400 (USB_OFFSET(USB_EP0_FIFO) + ((epnum) * 8))
401
402/*
403 * Additional Control Registers
404 */
405
406#define MUSB_DEVCTL USB_OFFSET(USB_OTG_DEV_CTL) /* 8 bit */
407
408#define MUSB_LINKINFO USB_OFFSET(USB_LINKINFO)/* 8 bit */
409#define MUSB_VPLEN USB_OFFSET(USB_VPLEN) /* 8 bit */
410#define MUSB_HS_EOF1 USB_OFFSET(USB_HS_EOF1) /* 8 bit */
411#define MUSB_FS_EOF1 USB_OFFSET(USB_FS_EOF1) /* 8 bit */
412#define MUSB_LS_EOF1 USB_OFFSET(USB_LS_EOF1) /* 8 bit */
413
414/* Offsets to endpoint registers */
415#define MUSB_TXMAXP 0x00
416#define MUSB_TXCSR 0x04
417#define MUSB_CSR0 MUSB_TXCSR /* Re-used for EP0 */
418#define MUSB_RXMAXP 0x08
419#define MUSB_RXCSR 0x0C
420#define MUSB_RXCOUNT 0x10
421#define MUSB_COUNT0 MUSB_RXCOUNT /* Re-used for EP0 */
422#define MUSB_TXTYPE 0x14
423#define MUSB_TYPE0 MUSB_TXTYPE /* Re-used for EP0 */
424#define MUSB_TXINTERVAL 0x18
425#define MUSB_NAKLIMIT0 MUSB_TXINTERVAL /* Re-used for EP0 */
426#define MUSB_RXTYPE 0x1C
427#define MUSB_RXINTERVAL 0x20
428#define MUSB_TXCOUNT 0x28
429
430/* Offsets to endpoint registers in indexed model (using INDEX register) */
431#define MUSB_INDEXED_OFFSET(_epnum, _offset) \
432 (0x40 + (_offset))
433
434/* Offsets to endpoint registers in flat models */
435#define MUSB_FLAT_OFFSET(_epnum, _offset) \
436 (USB_OFFSET(USB_EP_NI0_TXMAXP) + (0x40 * (_epnum)) + (_offset))
437
438/* Not implemented - HW has seperate Tx/Rx FIFO */
439#define MUSB_TXCSR_MODE 0x0000
440
441/*
442 * Dummy stub for clk framework, it will be removed
443 * until Blackfin supports clk framework
444 */
445#define clk_get(dev, id) NULL
446#define clk_put(clock) do {} while (0)
447#define clk_enable(clock) do {} while (0)
448#define clk_disable(clock) do {} while (0)
449
450static inline void musb_write_txfifosz(void __iomem *mbase, u8 c_size)
451{
452}
453
454static inline void musb_write_txfifoadd(void __iomem *mbase, u16 c_off)
455{
456}
457
458static inline void musb_write_rxfifosz(void __iomem *mbase, u8 c_size)
459{
460}
461
462static inline void musb_write_rxfifoadd(void __iomem *mbase, u16 c_off)
463{
464}
465
466static inline u8 musb_read_configdata(void __iomem *mbase)
467{
468 return 0;
469}
470
471static inline u16 musb_read_hwvers(void __iomem *mbase)
472{
473 return 0;
474}
475
476static inline u16 musb_read_target_reg_base(u8 i, void __iomem *mbase)
477{
478 return 0;
479}
480
481static inline void musb_write_rxfunaddr(void __iomem *ep_target_regs,
482 u8 qh_addr_req)
483{
484}
485
486static inline void musb_write_rxhubaddr(void __iomem *ep_target_regs,
487 u8 qh_h_addr_reg)
488{
489}
490
491static inline void musb_write_rxhubport(void __iomem *ep_target_regs,
492 u8 qh_h_port_reg)
493{
494}
495
496static inline void musb_write_txfunaddr(void __iomem *mbase, u8 epnum,
497 u8 qh_addr_reg)
498{
499}
500
501static inline void musb_write_txhubaddr(void __iomem *mbase, u8 epnum,
502 u8 qh_addr_reg)
503{
504}
505
506static inline void musb_write_txhubport(void __iomem *mbase, u8 epnum,
507 u8 qh_h_port_reg)
508{
509}
510
511#endif /* CONFIG_BLACKFIN */
512
300#endif /* __MUSB_REGS_H__ */ 513#endif /* __MUSB_REGS_H__ */
diff --git a/drivers/usb/musb/musbhsdma.c b/drivers/usb/musb/musbhsdma.c
index 8c734ef2c1ed..8662e9e159c3 100644
--- a/drivers/usb/musb/musbhsdma.c
+++ b/drivers/usb/musb/musbhsdma.c
@@ -34,58 +34,7 @@
34#include <linux/interrupt.h> 34#include <linux/interrupt.h>
35#include <linux/platform_device.h> 35#include <linux/platform_device.h>
36#include "musb_core.h" 36#include "musb_core.h"
37 37#include "musbhsdma.h"
38#if defined(CONFIG_ARCH_OMAP2430) || defined(CONFIG_ARCH_OMAP3430)
39#include "omap2430.h"
40#endif
41
42#define MUSB_HSDMA_BASE 0x200
43#define MUSB_HSDMA_INTR (MUSB_HSDMA_BASE + 0)
44#define MUSB_HSDMA_CONTROL 0x4
45#define MUSB_HSDMA_ADDRESS 0x8
46#define MUSB_HSDMA_COUNT 0xc
47
48#define MUSB_HSDMA_CHANNEL_OFFSET(_bchannel, _offset) \
49 (MUSB_HSDMA_BASE + (_bchannel << 4) + _offset)
50
51/* control register (16-bit): */
52#define MUSB_HSDMA_ENABLE_SHIFT 0
53#define MUSB_HSDMA_TRANSMIT_SHIFT 1
54#define MUSB_HSDMA_MODE1_SHIFT 2
55#define MUSB_HSDMA_IRQENABLE_SHIFT 3
56#define MUSB_HSDMA_ENDPOINT_SHIFT 4
57#define MUSB_HSDMA_BUSERROR_SHIFT 8
58#define MUSB_HSDMA_BURSTMODE_SHIFT 9
59#define MUSB_HSDMA_BURSTMODE (3 << MUSB_HSDMA_BURSTMODE_SHIFT)
60#define MUSB_HSDMA_BURSTMODE_UNSPEC 0
61#define MUSB_HSDMA_BURSTMODE_INCR4 1
62#define MUSB_HSDMA_BURSTMODE_INCR8 2
63#define MUSB_HSDMA_BURSTMODE_INCR16 3
64
65#define MUSB_HSDMA_CHANNELS 8
66
67struct musb_dma_controller;
68
69struct musb_dma_channel {
70 struct dma_channel channel;
71 struct musb_dma_controller *controller;
72 u32 start_addr;
73 u32 len;
74 u16 max_packet_sz;
75 u8 idx;
76 u8 epnum;
77 u8 transmit;
78};
79
80struct musb_dma_controller {
81 struct dma_controller controller;
82 struct musb_dma_channel channel[MUSB_HSDMA_CHANNELS];
83 void *private_data;
84 void __iomem *base;
85 u8 channel_count;
86 u8 used_channels;
87 u8 irq;
88};
89 38
90static int dma_controller_start(struct dma_controller *c) 39static int dma_controller_start(struct dma_controller *c)
91{ 40{
@@ -203,12 +152,8 @@ static void configure_channel(struct dma_channel *channel,
203 : 0); 152 : 0);
204 153
205 /* address/count */ 154 /* address/count */
206 musb_writel(mbase, 155 musb_write_hsdma_addr(mbase, bchannel, dma_addr);
207 MUSB_HSDMA_CHANNEL_OFFSET(bchannel, MUSB_HSDMA_ADDRESS), 156 musb_write_hsdma_count(mbase, bchannel, len);
208 dma_addr);
209 musb_writel(mbase,
210 MUSB_HSDMA_CHANNEL_OFFSET(bchannel, MUSB_HSDMA_COUNT),
211 len);
212 157
213 /* control (this should start things) */ 158 /* control (this should start things) */
214 musb_writew(mbase, 159 musb_writew(mbase,
@@ -279,13 +224,8 @@ static int dma_channel_abort(struct dma_channel *channel)
279 musb_writew(mbase, 224 musb_writew(mbase,
280 MUSB_HSDMA_CHANNEL_OFFSET(bchannel, MUSB_HSDMA_CONTROL), 225 MUSB_HSDMA_CHANNEL_OFFSET(bchannel, MUSB_HSDMA_CONTROL),
281 0); 226 0);
282 musb_writel(mbase, 227 musb_write_hsdma_addr(mbase, bchannel, 0);
283 MUSB_HSDMA_CHANNEL_OFFSET(bchannel, MUSB_HSDMA_ADDRESS), 228 musb_write_hsdma_count(mbase, bchannel, 0);
284 0);
285 musb_writel(mbase,
286 MUSB_HSDMA_CHANNEL_OFFSET(bchannel, MUSB_HSDMA_COUNT),
287 0);
288
289 channel->status = MUSB_DMA_STATUS_FREE; 229 channel->status = MUSB_DMA_STATUS_FREE;
290 } 230 }
291 231
@@ -333,10 +273,8 @@ static irqreturn_t dma_controller_irq(int irq, void *private_data)
333 } else { 273 } else {
334 u8 devctl; 274 u8 devctl;
335 275
336 addr = musb_readl(mbase, 276 addr = musb_read_hsdma_addr(mbase,
337 MUSB_HSDMA_CHANNEL_OFFSET( 277 bchannel);
338 bchannel,
339 MUSB_HSDMA_ADDRESS));
340 channel->actual_len = addr 278 channel->actual_len = addr
341 - musb_channel->start_addr; 279 - musb_channel->start_addr;
342 280
@@ -375,6 +313,12 @@ static irqreturn_t dma_controller_irq(int irq, void *private_data)
375 } 313 }
376 } 314 }
377 } 315 }
316
317#ifdef CONFIG_BLACKFIN
318 /* Clear DMA interrup flags */
319 musb_writeb(mbase, MUSB_HSDMA_INTR, int_hsdma);
320#endif
321
378 retval = IRQ_HANDLED; 322 retval = IRQ_HANDLED;
379done: 323done:
380 spin_unlock_irqrestore(&musb->lock, flags); 324 spin_unlock_irqrestore(&musb->lock, flags);
@@ -424,7 +368,7 @@ dma_controller_create(struct musb *musb, void __iomem *base)
424 controller->controller.channel_abort = dma_channel_abort; 368 controller->controller.channel_abort = dma_channel_abort;
425 369
426 if (request_irq(irq, dma_controller_irq, IRQF_DISABLED, 370 if (request_irq(irq, dma_controller_irq, IRQF_DISABLED,
427 musb->controller->bus_id, &controller->controller)) { 371 dev_name(musb->controller), &controller->controller)) {
428 dev_err(dev, "request_irq %d failed!\n", irq); 372 dev_err(dev, "request_irq %d failed!\n", irq);
429 dma_controller_destroy(&controller->controller); 373 dma_controller_destroy(&controller->controller);
430 374
diff --git a/drivers/usb/musb/musbhsdma.h b/drivers/usb/musb/musbhsdma.h
new file mode 100644
index 000000000000..1299d92dc83f
--- /dev/null
+++ b/drivers/usb/musb/musbhsdma.h
@@ -0,0 +1,149 @@
1/*
2 * MUSB OTG driver - support for Mentor's DMA controller
3 *
4 * Copyright 2005 Mentor Graphics Corporation
5 * Copyright (C) 2005-2007 by Texas Instruments
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * version 2 as published by the Free Software Foundation.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
19 * 02110-1301 USA
20 *
21 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
22 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
23 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
24 * NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT,
25 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
26 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
27 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
28 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
30 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 *
32 */
33
34#if defined(CONFIG_ARCH_OMAP2430) || defined(CONFIG_ARCH_OMAP3430)
35#include "omap2430.h"
36#endif
37
38#ifndef CONFIG_BLACKFIN
39
40#define MUSB_HSDMA_BASE 0x200
41#define MUSB_HSDMA_INTR (MUSB_HSDMA_BASE + 0)
42#define MUSB_HSDMA_CONTROL 0x4
43#define MUSB_HSDMA_ADDRESS 0x8
44#define MUSB_HSDMA_COUNT 0xc
45
46#define MUSB_HSDMA_CHANNEL_OFFSET(_bchannel, _offset) \
47 (MUSB_HSDMA_BASE + (_bchannel << 4) + _offset)
48
49#define musb_read_hsdma_addr(mbase, bchannel) \
50 musb_readl(mbase, \
51 MUSB_HSDMA_CHANNEL_OFFSET(bchannel, MUSB_HSDMA_ADDRESS))
52
53#define musb_write_hsdma_addr(mbase, bchannel, addr) \
54 musb_writel(mbase, \
55 MUSB_HSDMA_CHANNEL_OFFSET(bchannel, MUSB_HSDMA_ADDRESS), \
56 addr)
57
58#define musb_write_hsdma_count(mbase, bchannel, len) \
59 musb_writel(mbase, \
60 MUSB_HSDMA_CHANNEL_OFFSET(bchannel, MUSB_HSDMA_COUNT), \
61 len)
62#else
63
64#define MUSB_HSDMA_BASE 0x400
65#define MUSB_HSDMA_INTR (MUSB_HSDMA_BASE + 0)
66#define MUSB_HSDMA_CONTROL 0x04
67#define MUSB_HSDMA_ADDR_LOW 0x08
68#define MUSB_HSDMA_ADDR_HIGH 0x0C
69#define MUSB_HSDMA_COUNT_LOW 0x10
70#define MUSB_HSDMA_COUNT_HIGH 0x14
71
72#define MUSB_HSDMA_CHANNEL_OFFSET(_bchannel, _offset) \
73 (MUSB_HSDMA_BASE + (_bchannel * 0x20) + _offset)
74
75static inline u32 musb_read_hsdma_addr(void __iomem *mbase, u8 bchannel)
76{
77 u32 addr = musb_readw(mbase,
78 MUSB_HSDMA_CHANNEL_OFFSET(bchannel, MUSB_HSDMA_ADDR_HIGH));
79
80 addr = addr << 16;
81
82 addr |= musb_readw(mbase,
83 MUSB_HSDMA_CHANNEL_OFFSET(bchannel, MUSB_HSDMA_ADDR_LOW));
84
85 return addr;
86}
87
88static inline void musb_write_hsdma_addr(void __iomem *mbase,
89 u8 bchannel, dma_addr_t dma_addr)
90{
91 musb_writew(mbase,
92 MUSB_HSDMA_CHANNEL_OFFSET(bchannel, MUSB_HSDMA_ADDR_LOW),
93 ((u16)((u32) dma_addr & 0xFFFF)));
94 musb_writew(mbase,
95 MUSB_HSDMA_CHANNEL_OFFSET(bchannel, MUSB_HSDMA_ADDR_HIGH),
96 ((u16)(((u32) dma_addr >> 16) & 0xFFFF)));
97}
98
99static inline void musb_write_hsdma_count(void __iomem *mbase,
100 u8 bchannel, u32 len)
101{
102 musb_writew(mbase,
103 MUSB_HSDMA_CHANNEL_OFFSET(bchannel, MUSB_HSDMA_COUNT_LOW),
104 ((u16)((u32) len & 0xFFFF)));
105 musb_writew(mbase,
106 MUSB_HSDMA_CHANNEL_OFFSET(bchannel, MUSB_HSDMA_COUNT_HIGH),
107 ((u16)(((u32) len >> 16) & 0xFFFF)));
108}
109
110#endif /* CONFIG_BLACKFIN */
111
112/* control register (16-bit): */
113#define MUSB_HSDMA_ENABLE_SHIFT 0
114#define MUSB_HSDMA_TRANSMIT_SHIFT 1
115#define MUSB_HSDMA_MODE1_SHIFT 2
116#define MUSB_HSDMA_IRQENABLE_SHIFT 3
117#define MUSB_HSDMA_ENDPOINT_SHIFT 4
118#define MUSB_HSDMA_BUSERROR_SHIFT 8
119#define MUSB_HSDMA_BURSTMODE_SHIFT 9
120#define MUSB_HSDMA_BURSTMODE (3 << MUSB_HSDMA_BURSTMODE_SHIFT)
121#define MUSB_HSDMA_BURSTMODE_UNSPEC 0
122#define MUSB_HSDMA_BURSTMODE_INCR4 1
123#define MUSB_HSDMA_BURSTMODE_INCR8 2
124#define MUSB_HSDMA_BURSTMODE_INCR16 3
125
126#define MUSB_HSDMA_CHANNELS 8
127
128struct musb_dma_controller;
129
130struct musb_dma_channel {
131 struct dma_channel channel;
132 struct musb_dma_controller *controller;
133 u32 start_addr;
134 u32 len;
135 u16 max_packet_sz;
136 u8 idx;
137 u8 epnum;
138 u8 transmit;
139};
140
141struct musb_dma_controller {
142 struct dma_controller controller;
143 struct musb_dma_channel channel[MUSB_HSDMA_CHANNELS];
144 void *private_data;
145 void __iomem *base;
146 u8 channel_count;
147 u8 used_channels;
148 u8 irq;
149};
diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c
index ce6c162920f7..901dffdf23b1 100644
--- a/drivers/usb/musb/omap2430.c
+++ b/drivers/usb/musb/omap2430.c
@@ -58,10 +58,10 @@ static void musb_do_idle(unsigned long _musb)
58#endif 58#endif
59 u8 devctl; 59 u8 devctl;
60 60
61 devctl = musb_readb(musb->mregs, MUSB_DEVCTL);
62
63 spin_lock_irqsave(&musb->lock, flags); 61 spin_lock_irqsave(&musb->lock, flags);
64 62
63 devctl = musb_readb(musb->mregs, MUSB_DEVCTL);
64
65 switch (musb->xceiv.state) { 65 switch (musb->xceiv.state) {
66 case OTG_STATE_A_WAIT_BCON: 66 case OTG_STATE_A_WAIT_BCON:
67 devctl &= ~MUSB_DEVCTL_SESSION; 67 devctl &= ~MUSB_DEVCTL_SESSION;
@@ -196,7 +196,7 @@ static int omap_set_power(struct otg_transceiver *x, unsigned mA)
196 196
197static int musb_platform_resume(struct musb *musb); 197static int musb_platform_resume(struct musb *musb);
198 198
199void musb_platform_set_mode(struct musb *musb, u8 musb_mode) 199int musb_platform_set_mode(struct musb *musb, u8 musb_mode)
200{ 200{
201 u8 devctl = musb_readb(musb->mregs, MUSB_DEVCTL); 201 u8 devctl = musb_readb(musb->mregs, MUSB_DEVCTL);
202 202
@@ -204,15 +204,24 @@ void musb_platform_set_mode(struct musb *musb, u8 musb_mode)
204 musb_writeb(musb->mregs, MUSB_DEVCTL, devctl); 204 musb_writeb(musb->mregs, MUSB_DEVCTL, devctl);
205 205
206 switch (musb_mode) { 206 switch (musb_mode) {
207#ifdef CONFIG_USB_MUSB_HDRC_HCD
207 case MUSB_HOST: 208 case MUSB_HOST:
208 otg_set_host(&musb->xceiv, musb->xceiv.host); 209 otg_set_host(&musb->xceiv, musb->xceiv.host);
209 break; 210 break;
211#endif
212#ifdef CONFIG_USB_GADGET_MUSB_HDRC
210 case MUSB_PERIPHERAL: 213 case MUSB_PERIPHERAL:
211 otg_set_peripheral(&musb->xceiv, musb->xceiv.gadget); 214 otg_set_peripheral(&musb->xceiv, musb->xceiv.gadget);
212 break; 215 break;
216#endif
217#ifdef CONFIG_USB_MUSB_OTG
213 case MUSB_OTG: 218 case MUSB_OTG:
214 break; 219 break;
220#endif
221 default:
222 return -EINVAL;
215 } 223 }
224 return 0;
216} 225}
217 226
218int __init musb_platform_init(struct musb *musb) 227int __init musb_platform_init(struct musb *musb)
diff --git a/drivers/usb/musb/tusb6010.c b/drivers/usb/musb/tusb6010.c
index ee8fca92a4ac..9e20fd070d71 100644
--- a/drivers/usb/musb/tusb6010.c
+++ b/drivers/usb/musb/tusb6010.c
@@ -598,7 +598,7 @@ static void tusb_source_power(struct musb *musb, int is_on)
598 * and peripheral modes in non-OTG configurations by reconfiguring hardware 598 * and peripheral modes in non-OTG configurations by reconfiguring hardware
599 * and then setting musb->board_mode. For now, only support OTG mode. 599 * and then setting musb->board_mode. For now, only support OTG mode.
600 */ 600 */
601void musb_platform_set_mode(struct musb *musb, u8 musb_mode) 601int musb_platform_set_mode(struct musb *musb, u8 musb_mode)
602{ 602{
603 void __iomem *tbase = musb->ctrl_base; 603 void __iomem *tbase = musb->ctrl_base;
604 u32 otg_stat, phy_otg_ctrl, phy_otg_ena, dev_conf; 604 u32 otg_stat, phy_otg_ctrl, phy_otg_ena, dev_conf;
@@ -641,7 +641,8 @@ void musb_platform_set_mode(struct musb *musb, u8 musb_mode)
641#endif 641#endif
642 642
643 default: 643 default:
644 DBG(2, "Trying to set unknown mode %i\n", musb_mode); 644 DBG(2, "Trying to set mode %i\n", musb_mode);
645 return -EINVAL;
645 } 646 }
646 647
647 musb_writel(tbase, TUSB_PHY_OTG_CTRL, 648 musb_writel(tbase, TUSB_PHY_OTG_CTRL,
@@ -655,6 +656,8 @@ void musb_platform_set_mode(struct musb *musb, u8 musb_mode)
655 !(otg_stat & TUSB_DEV_OTG_STAT_ID_STATUS)) 656 !(otg_stat & TUSB_DEV_OTG_STAT_ID_STATUS))
656 INFO("Cannot be peripheral with mini-A cable " 657 INFO("Cannot be peripheral with mini-A cable "
657 "otg_stat: %08x\n", otg_stat); 658 "otg_stat: %08x\n", otg_stat);
659
660 return 0;
658} 661}
659 662
660static inline unsigned long 663static inline unsigned long
diff --git a/drivers/usb/otg/Kconfig b/drivers/usb/otg/Kconfig
new file mode 100644
index 000000000000..8e8dbdb9b39b
--- /dev/null
+++ b/drivers/usb/otg/Kconfig
@@ -0,0 +1,54 @@
1#
2# USB OTG infrastructure may be needed for peripheral-only, host-only,
3# or OTG-capable configurations when OTG transceivers or controllers
4# are used.
5#
6
7comment "OTG and related infrastructure"
8
9if USB || USB_GADGET
10
11config USB_OTG_UTILS
12 bool
13 help
14 Select this to make sure the build includes objects from
15 the OTG infrastructure directory.
16
17#
18# USB Transceiver Drivers
19#
20config USB_GPIO_VBUS
21 tristate "GPIO based peripheral-only VBUS sensing 'transceiver'"
22 depends on GENERIC_GPIO
23 select USB_OTG_UTILS
24 help
25 Provides simple GPIO VBUS sensing for controllers with an
26 internal transceiver via the otg_transceiver interface, and
27 optionally control of a D+ pullup GPIO as well as a VBUS
28 current limit regulator.
29
30config ISP1301_OMAP
31 tristate "Philips ISP1301 with OMAP OTG"
32 depends on I2C && ARCH_OMAP_OTG
33 select USB_OTG_UTILS
34 help
35 If you say yes here you get support for the Philips ISP1301
36 USB-On-The-Go transceiver working with the OMAP OTG controller.
37 The ISP1301 is a full speed USB transceiver which is used in
38 products including H2, H3, and H4 development boards for Texas
39 Instruments OMAP processors.
40
41 This driver can also be built as a module. If so, the module
42 will be called isp1301_omap.
43
44config TWL4030_USB
45 tristate "TWL4030 USB Transceiver Driver"
46 depends on TWL4030_CORE
47 select USB_OTG_UTILS
48 help
49 Enable this to support the USB OTG transceiver on TWL4030
50 family chips (including the TWL5030 and TPS659x0 devices).
51 This transceiver supports high and full speed devices plus,
52 in host mode, low speed.
53
54endif # USB || OTG
diff --git a/drivers/usb/otg/Makefile b/drivers/usb/otg/Makefile
new file mode 100644
index 000000000000..d73c7cf5e2f7
--- /dev/null
+++ b/drivers/usb/otg/Makefile
@@ -0,0 +1,15 @@
1#
2# OTG infrastructure and transceiver drivers
3#
4
5# infrastructure
6obj-$(CONFIG_USB_OTG_UTILS) += otg.o
7
8# transceiver drivers
9obj-$(CONFIG_USB_GPIO_VBUS) += gpio_vbus.o
10obj-$(CONFIG_ISP1301_OMAP) += isp1301_omap.o
11obj-$(CONFIG_TWL4030_USB) += twl4030-usb.o
12
13ccflags-$(CONFIG_USB_DEBUG) += -DDEBUG
14ccflags-$(CONFIG_USB_GADGET_DEBUG) += -DDEBUG
15
diff --git a/drivers/usb/otg/gpio_vbus.c b/drivers/usb/otg/gpio_vbus.c
new file mode 100644
index 000000000000..63a6036f04be
--- /dev/null
+++ b/drivers/usb/otg/gpio_vbus.c
@@ -0,0 +1,335 @@
1/*
2 * gpio-vbus.c - simple GPIO VBUS sensing driver for B peripheral devices
3 *
4 * Copyright (c) 2008 Philipp Zabel <philipp.zabel@gmail.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#include <linux/kernel.h>
12#include <linux/platform_device.h>
13#include <linux/gpio.h>
14#include <linux/interrupt.h>
15#include <linux/usb.h>
16
17#include <linux/regulator/consumer.h>
18
19#include <linux/usb/gadget.h>
20#include <linux/usb/gpio_vbus.h>
21#include <linux/usb/otg.h>
22
23
24/*
25 * A simple GPIO VBUS sensing driver for B peripheral only devices
26 * with internal transceivers. It can control a D+ pullup GPIO and
27 * a regulator to limit the current drawn from VBUS.
28 *
29 * Needs to be loaded before the UDC driver that will use it.
30 */
31struct gpio_vbus_data {
32 struct otg_transceiver otg;
33 struct device *dev;
34 struct regulator *vbus_draw;
35 int vbus_draw_enabled;
36 unsigned mA;
37};
38
39
40/*
41 * This driver relies on "both edges" triggering. VBUS has 100 msec to
42 * stabilize, so the peripheral controller driver may need to cope with
43 * some bouncing due to current surges (e.g. charging local capacitance)
44 * and contact chatter.
45 *
46 * REVISIT in desperate straits, toggling between rising and falling
47 * edges might be workable.
48 */
49#define VBUS_IRQ_FLAGS \
50 ( IRQF_SAMPLE_RANDOM | IRQF_SHARED \
51 | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING )
52
53
54/* interface to regulator framework */
55static void set_vbus_draw(struct gpio_vbus_data *gpio_vbus, unsigned mA)
56{
57 struct regulator *vbus_draw = gpio_vbus->vbus_draw;
58 int enabled;
59
60 if (!vbus_draw)
61 return;
62
63 enabled = gpio_vbus->vbus_draw_enabled;
64 if (mA) {
65 regulator_set_current_limit(vbus_draw, 0, 1000 * mA);
66 if (!enabled) {
67 regulator_enable(vbus_draw);
68 gpio_vbus->vbus_draw_enabled = 1;
69 }
70 } else {
71 if (enabled) {
72 regulator_disable(vbus_draw);
73 gpio_vbus->vbus_draw_enabled = 0;
74 }
75 }
76 gpio_vbus->mA = mA;
77}
78
79/* VBUS change IRQ handler */
80static irqreturn_t gpio_vbus_irq(int irq, void *data)
81{
82 struct platform_device *pdev = data;
83 struct gpio_vbus_mach_info *pdata = pdev->dev.platform_data;
84 struct gpio_vbus_data *gpio_vbus = platform_get_drvdata(pdev);
85 int gpio, vbus;
86
87 vbus = gpio_get_value(pdata->gpio_vbus);
88 if (pdata->gpio_vbus_inverted)
89 vbus = !vbus;
90
91 dev_dbg(&pdev->dev, "VBUS %s (gadget: %s)\n",
92 vbus ? "supplied" : "inactive",
93 gpio_vbus->otg.gadget ? gpio_vbus->otg.gadget->name : "none");
94
95 if (!gpio_vbus->otg.gadget)
96 return IRQ_HANDLED;
97
98 /* Peripheral controllers which manage the pullup themselves won't have
99 * gpio_pullup configured here. If it's configured here, we'll do what
100 * isp1301_omap::b_peripheral() does and enable the pullup here... although
101 * that may complicate usb_gadget_{,dis}connect() support.
102 */
103 gpio = pdata->gpio_pullup;
104 if (vbus) {
105 gpio_vbus->otg.state = OTG_STATE_B_PERIPHERAL;
106 usb_gadget_vbus_connect(gpio_vbus->otg.gadget);
107
108 /* drawing a "unit load" is *always* OK, except for OTG */
109 set_vbus_draw(gpio_vbus, 100);
110
111 /* optionally enable D+ pullup */
112 if (gpio_is_valid(gpio))
113 gpio_set_value(gpio, !pdata->gpio_pullup_inverted);
114 } else {
115 /* optionally disable D+ pullup */
116 if (gpio_is_valid(gpio))
117 gpio_set_value(gpio, pdata->gpio_pullup_inverted);
118
119 set_vbus_draw(gpio_vbus, 0);
120
121 usb_gadget_vbus_disconnect(gpio_vbus->otg.gadget);
122 gpio_vbus->otg.state = OTG_STATE_B_IDLE;
123 }
124
125 return IRQ_HANDLED;
126}
127
128/* OTG transceiver interface */
129
130/* bind/unbind the peripheral controller */
131static int gpio_vbus_set_peripheral(struct otg_transceiver *otg,
132 struct usb_gadget *gadget)
133{
134 struct gpio_vbus_data *gpio_vbus;
135 struct gpio_vbus_mach_info *pdata;
136 struct platform_device *pdev;
137 int gpio, irq;
138
139 gpio_vbus = container_of(otg, struct gpio_vbus_data, otg);
140 pdev = to_platform_device(gpio_vbus->dev);
141 pdata = gpio_vbus->dev->platform_data;
142 irq = gpio_to_irq(pdata->gpio_vbus);
143 gpio = pdata->gpio_pullup;
144
145 if (!gadget) {
146 dev_dbg(&pdev->dev, "unregistering gadget '%s'\n",
147 otg->gadget->name);
148
149 /* optionally disable D+ pullup */
150 if (gpio_is_valid(gpio))
151 gpio_set_value(gpio, pdata->gpio_pullup_inverted);
152
153 set_vbus_draw(gpio_vbus, 0);
154
155 usb_gadget_vbus_disconnect(otg->gadget);
156 otg->state = OTG_STATE_UNDEFINED;
157
158 otg->gadget = NULL;
159 return 0;
160 }
161
162 otg->gadget = gadget;
163 dev_dbg(&pdev->dev, "registered gadget '%s'\n", gadget->name);
164
165 /* initialize connection state */
166 gpio_vbus_irq(irq, pdev);
167 return 0;
168}
169
170/* effective for B devices, ignored for A-peripheral */
171static int gpio_vbus_set_power(struct otg_transceiver *otg, unsigned mA)
172{
173 struct gpio_vbus_data *gpio_vbus;
174
175 gpio_vbus = container_of(otg, struct gpio_vbus_data, otg);
176
177 if (otg->state == OTG_STATE_B_PERIPHERAL)
178 set_vbus_draw(gpio_vbus, mA);
179 return 0;
180}
181
182/* for non-OTG B devices: set/clear transceiver suspend mode */
183static int gpio_vbus_set_suspend(struct otg_transceiver *otg, int suspend)
184{
185 struct gpio_vbus_data *gpio_vbus;
186
187 gpio_vbus = container_of(otg, struct gpio_vbus_data, otg);
188
189 /* draw max 0 mA from vbus in suspend mode; or the previously
190 * recorded amount of current if not suspended
191 *
192 * NOTE: high powered configs (mA > 100) may draw up to 2.5 mA
193 * if they're wake-enabled ... we don't handle that yet.
194 */
195 return gpio_vbus_set_power(otg, suspend ? 0 : gpio_vbus->mA);
196}
197
198/* platform driver interface */
199
200static int __init gpio_vbus_probe(struct platform_device *pdev)
201{
202 struct gpio_vbus_mach_info *pdata = pdev->dev.platform_data;
203 struct gpio_vbus_data *gpio_vbus;
204 struct resource *res;
205 int err, gpio, irq;
206
207 if (!pdata || !gpio_is_valid(pdata->gpio_vbus))
208 return -EINVAL;
209 gpio = pdata->gpio_vbus;
210
211 gpio_vbus = kzalloc(sizeof(struct gpio_vbus_data), GFP_KERNEL);
212 if (!gpio_vbus)
213 return -ENOMEM;
214
215 platform_set_drvdata(pdev, gpio_vbus);
216 gpio_vbus->dev = &pdev->dev;
217 gpio_vbus->otg.label = "gpio-vbus";
218 gpio_vbus->otg.state = OTG_STATE_UNDEFINED;
219 gpio_vbus->otg.set_peripheral = gpio_vbus_set_peripheral;
220 gpio_vbus->otg.set_power = gpio_vbus_set_power;
221 gpio_vbus->otg.set_suspend = gpio_vbus_set_suspend;
222
223 err = gpio_request(gpio, "vbus_detect");
224 if (err) {
225 dev_err(&pdev->dev, "can't request vbus gpio %d, err: %d\n",
226 gpio, err);
227 goto err_gpio;
228 }
229 gpio_direction_input(gpio);
230
231 res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
232 if (res) {
233 irq = res->start;
234 res->flags &= IRQF_TRIGGER_MASK;
235 res->flags |= IRQF_SAMPLE_RANDOM | IRQF_SHARED;
236 } else
237 irq = gpio_to_irq(gpio);
238
239 /* if data line pullup is in use, initialize it to "not pulling up" */
240 gpio = pdata->gpio_pullup;
241 if (gpio_is_valid(gpio)) {
242 err = gpio_request(gpio, "udc_pullup");
243 if (err) {
244 dev_err(&pdev->dev,
245 "can't request pullup gpio %d, err: %d\n",
246 gpio, err);
247 gpio_free(pdata->gpio_vbus);
248 goto err_gpio;
249 }
250 gpio_direction_output(gpio, pdata->gpio_pullup_inverted);
251 }
252
253 err = request_irq(irq, gpio_vbus_irq, VBUS_IRQ_FLAGS,
254 "vbus_detect", pdev);
255 if (err) {
256 dev_err(&pdev->dev, "can't request irq %i, err: %d\n",
257 irq, err);
258 goto err_irq;
259 }
260
261 /* only active when a gadget is registered */
262 err = otg_set_transceiver(&gpio_vbus->otg);
263 if (err) {
264 dev_err(&pdev->dev, "can't register transceiver, err: %d\n",
265 err);
266 goto err_otg;
267 }
268
269 gpio_vbus->vbus_draw = regulator_get(&pdev->dev, "vbus_draw");
270 if (IS_ERR(gpio_vbus->vbus_draw)) {
271 dev_dbg(&pdev->dev, "can't get vbus_draw regulator, err: %ld\n",
272 PTR_ERR(gpio_vbus->vbus_draw));
273 gpio_vbus->vbus_draw = NULL;
274 }
275
276 return 0;
277err_otg:
278 free_irq(irq, &pdev->dev);
279err_irq:
280 if (gpio_is_valid(pdata->gpio_pullup))
281 gpio_free(pdata->gpio_pullup);
282 gpio_free(pdata->gpio_vbus);
283err_gpio:
284 platform_set_drvdata(pdev, NULL);
285 kfree(gpio_vbus);
286 return err;
287}
288
289static int __exit gpio_vbus_remove(struct platform_device *pdev)
290{
291 struct gpio_vbus_data *gpio_vbus = platform_get_drvdata(pdev);
292 struct gpio_vbus_mach_info *pdata = pdev->dev.platform_data;
293 int gpio = pdata->gpio_vbus;
294
295 regulator_put(gpio_vbus->vbus_draw);
296
297 otg_set_transceiver(NULL);
298
299 free_irq(gpio_to_irq(gpio), &pdev->dev);
300 if (gpio_is_valid(pdata->gpio_pullup))
301 gpio_free(pdata->gpio_pullup);
302 gpio_free(gpio);
303 platform_set_drvdata(pdev, NULL);
304 kfree(gpio_vbus);
305
306 return 0;
307}
308
309/* NOTE: the gpio-vbus device may *NOT* be hotplugged */
310
311MODULE_ALIAS("platform:gpio-vbus");
312
313static struct platform_driver gpio_vbus_driver = {
314 .driver = {
315 .name = "gpio-vbus",
316 .owner = THIS_MODULE,
317 },
318 .remove = __exit_p(gpio_vbus_remove),
319};
320
321static int __init gpio_vbus_init(void)
322{
323 return platform_driver_probe(&gpio_vbus_driver, gpio_vbus_probe);
324}
325module_init(gpio_vbus_init);
326
327static void __exit gpio_vbus_exit(void)
328{
329 platform_driver_unregister(&gpio_vbus_driver);
330}
331module_exit(gpio_vbus_exit);
332
333MODULE_DESCRIPTION("simple GPIO controlled OTG transceiver driver");
334MODULE_AUTHOR("Philipp Zabel");
335MODULE_LICENSE("GPL");
diff --git a/drivers/i2c/chips/isp1301_omap.c b/drivers/usb/otg/isp1301_omap.c
index e0d56ef2bcb0..e0d56ef2bcb0 100644
--- a/drivers/i2c/chips/isp1301_omap.c
+++ b/drivers/usb/otg/isp1301_omap.c
diff --git a/drivers/usb/otg/otg.c b/drivers/usb/otg/otg.c
new file mode 100644
index 000000000000..ff318fae7d4d
--- /dev/null
+++ b/drivers/usb/otg/otg.c
@@ -0,0 +1,65 @@
1/*
2 * otg.c -- USB OTG utility code
3 *
4 * Copyright (C) 2004 Texas Instruments
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 */
11
12#include <linux/kernel.h>
13#include <linux/device.h>
14
15#include <linux/usb/otg.h>
16
17static struct otg_transceiver *xceiv;
18
19/**
20 * otg_get_transceiver - find the (single) OTG transceiver
21 *
22 * Returns the transceiver driver, after getting a refcount to it; or
23 * null if there is no such transceiver. The caller is responsible for
24 * calling otg_put_transceiver() to release that count.
25 *
26 * For use by USB host and peripheral drivers.
27 */
28struct otg_transceiver *otg_get_transceiver(void)
29{
30 if (xceiv)
31 get_device(xceiv->dev);
32 return xceiv;
33}
34EXPORT_SYMBOL(otg_get_transceiver);
35
36/**
37 * otg_put_transceiver - release the (single) OTG transceiver
38 * @x: the transceiver returned by otg_get_transceiver()
39 *
40 * Releases a refcount the caller received from otg_get_transceiver().
41 *
42 * For use by USB host and peripheral drivers.
43 */
44void otg_put_transceiver(struct otg_transceiver *x)
45{
46 put_device(x->dev);
47}
48EXPORT_SYMBOL(otg_put_transceiver);
49
50/**
51 * otg_set_transceiver - declare the (single) OTG transceiver
52 * @x: the USB OTG transceiver to be used; or NULL
53 *
54 * This call is exclusively for use by transceiver drivers, which
55 * coordinate the activities of drivers for host and peripheral
56 * controllers, and in some cases for VBUS current regulation.
57 */
58int otg_set_transceiver(struct otg_transceiver *x)
59{
60 if (xceiv && x)
61 return -EBUSY;
62 xceiv = x;
63 return 0;
64}
65EXPORT_SYMBOL(otg_set_transceiver);
diff --git a/drivers/usb/otg/twl4030-usb.c b/drivers/usb/otg/twl4030-usb.c
new file mode 100644
index 000000000000..416e4410be02
--- /dev/null
+++ b/drivers/usb/otg/twl4030-usb.c
@@ -0,0 +1,721 @@
1/*
2 * twl4030_usb - TWL4030 USB transceiver, talking to OMAP OTG controller
3 *
4 * Copyright (C) 2004-2007 Texas Instruments
5 * Copyright (C) 2008 Nokia Corporation
6 * Contact: Felipe Balbi <felipe.balbi@nokia.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 *
22 * Current status:
23 * - HS USB ULPI mode works.
24 * - 3-pin mode support may be added in future.
25 */
26
27#include <linux/module.h>
28#include <linux/init.h>
29#include <linux/interrupt.h>
30#include <linux/platform_device.h>
31#include <linux/spinlock.h>
32#include <linux/workqueue.h>
33#include <linux/io.h>
34#include <linux/delay.h>
35#include <linux/usb/otg.h>
36#include <linux/i2c/twl4030.h>
37
38
39/* Register defines */
40
41#define VENDOR_ID_LO 0x00
42#define VENDOR_ID_HI 0x01
43#define PRODUCT_ID_LO 0x02
44#define PRODUCT_ID_HI 0x03
45
46#define FUNC_CTRL 0x04
47#define FUNC_CTRL_SET 0x05
48#define FUNC_CTRL_CLR 0x06
49#define FUNC_CTRL_SUSPENDM (1 << 6)
50#define FUNC_CTRL_RESET (1 << 5)
51#define FUNC_CTRL_OPMODE_MASK (3 << 3) /* bits 3 and 4 */
52#define FUNC_CTRL_OPMODE_NORMAL (0 << 3)
53#define FUNC_CTRL_OPMODE_NONDRIVING (1 << 3)
54#define FUNC_CTRL_OPMODE_DISABLE_BIT_NRZI (2 << 3)
55#define FUNC_CTRL_TERMSELECT (1 << 2)
56#define FUNC_CTRL_XCVRSELECT_MASK (3 << 0) /* bits 0 and 1 */
57#define FUNC_CTRL_XCVRSELECT_HS (0 << 0)
58#define FUNC_CTRL_XCVRSELECT_FS (1 << 0)
59#define FUNC_CTRL_XCVRSELECT_LS (2 << 0)
60#define FUNC_CTRL_XCVRSELECT_FS4LS (3 << 0)
61
62#define IFC_CTRL 0x07
63#define IFC_CTRL_SET 0x08
64#define IFC_CTRL_CLR 0x09
65#define IFC_CTRL_INTERFACE_PROTECT_DISABLE (1 << 7)
66#define IFC_CTRL_AUTORESUME (1 << 4)
67#define IFC_CTRL_CLOCKSUSPENDM (1 << 3)
68#define IFC_CTRL_CARKITMODE (1 << 2)
69#define IFC_CTRL_FSLSSERIALMODE_3PIN (1 << 1)
70
71#define TWL4030_OTG_CTRL 0x0A
72#define TWL4030_OTG_CTRL_SET 0x0B
73#define TWL4030_OTG_CTRL_CLR 0x0C
74#define TWL4030_OTG_CTRL_DRVVBUS (1 << 5)
75#define TWL4030_OTG_CTRL_CHRGVBUS (1 << 4)
76#define TWL4030_OTG_CTRL_DISCHRGVBUS (1 << 3)
77#define TWL4030_OTG_CTRL_DMPULLDOWN (1 << 2)
78#define TWL4030_OTG_CTRL_DPPULLDOWN (1 << 1)
79#define TWL4030_OTG_CTRL_IDPULLUP (1 << 0)
80
81#define USB_INT_EN_RISE 0x0D
82#define USB_INT_EN_RISE_SET 0x0E
83#define USB_INT_EN_RISE_CLR 0x0F
84#define USB_INT_EN_FALL 0x10
85#define USB_INT_EN_FALL_SET 0x11
86#define USB_INT_EN_FALL_CLR 0x12
87#define USB_INT_STS 0x13
88#define USB_INT_LATCH 0x14
89#define USB_INT_IDGND (1 << 4)
90#define USB_INT_SESSEND (1 << 3)
91#define USB_INT_SESSVALID (1 << 2)
92#define USB_INT_VBUSVALID (1 << 1)
93#define USB_INT_HOSTDISCONNECT (1 << 0)
94
95#define CARKIT_CTRL 0x19
96#define CARKIT_CTRL_SET 0x1A
97#define CARKIT_CTRL_CLR 0x1B
98#define CARKIT_CTRL_MICEN (1 << 6)
99#define CARKIT_CTRL_SPKRIGHTEN (1 << 5)
100#define CARKIT_CTRL_SPKLEFTEN (1 << 4)
101#define CARKIT_CTRL_RXDEN (1 << 3)
102#define CARKIT_CTRL_TXDEN (1 << 2)
103#define CARKIT_CTRL_IDGNDDRV (1 << 1)
104#define CARKIT_CTRL_CARKITPWR (1 << 0)
105#define CARKIT_PLS_CTRL 0x22
106#define CARKIT_PLS_CTRL_SET 0x23
107#define CARKIT_PLS_CTRL_CLR 0x24
108#define CARKIT_PLS_CTRL_SPKRRIGHT_BIASEN (1 << 3)
109#define CARKIT_PLS_CTRL_SPKRLEFT_BIASEN (1 << 2)
110#define CARKIT_PLS_CTRL_RXPLSEN (1 << 1)
111#define CARKIT_PLS_CTRL_TXPLSEN (1 << 0)
112
113#define MCPC_CTRL 0x30
114#define MCPC_CTRL_SET 0x31
115#define MCPC_CTRL_CLR 0x32
116#define MCPC_CTRL_RTSOL (1 << 7)
117#define MCPC_CTRL_EXTSWR (1 << 6)
118#define MCPC_CTRL_EXTSWC (1 << 5)
119#define MCPC_CTRL_VOICESW (1 << 4)
120#define MCPC_CTRL_OUT64K (1 << 3)
121#define MCPC_CTRL_RTSCTSSW (1 << 2)
122#define MCPC_CTRL_HS_UART (1 << 0)
123
124#define MCPC_IO_CTRL 0x33
125#define MCPC_IO_CTRL_SET 0x34
126#define MCPC_IO_CTRL_CLR 0x35
127#define MCPC_IO_CTRL_MICBIASEN (1 << 5)
128#define MCPC_IO_CTRL_CTS_NPU (1 << 4)
129#define MCPC_IO_CTRL_RXD_PU (1 << 3)
130#define MCPC_IO_CTRL_TXDTYP (1 << 2)
131#define MCPC_IO_CTRL_CTSTYP (1 << 1)
132#define MCPC_IO_CTRL_RTSTYP (1 << 0)
133
134#define MCPC_CTRL2 0x36
135#define MCPC_CTRL2_SET 0x37
136#define MCPC_CTRL2_CLR 0x38
137#define MCPC_CTRL2_MCPC_CK_EN (1 << 0)
138
139#define OTHER_FUNC_CTRL 0x80
140#define OTHER_FUNC_CTRL_SET 0x81
141#define OTHER_FUNC_CTRL_CLR 0x82
142#define OTHER_FUNC_CTRL_BDIS_ACON_EN (1 << 4)
143#define OTHER_FUNC_CTRL_FIVEWIRE_MODE (1 << 2)
144
145#define OTHER_IFC_CTRL 0x83
146#define OTHER_IFC_CTRL_SET 0x84
147#define OTHER_IFC_CTRL_CLR 0x85
148#define OTHER_IFC_CTRL_OE_INT_EN (1 << 6)
149#define OTHER_IFC_CTRL_CEA2011_MODE (1 << 5)
150#define OTHER_IFC_CTRL_FSLSSERIALMODE_4PIN (1 << 4)
151#define OTHER_IFC_CTRL_HIZ_ULPI_60MHZ_OUT (1 << 3)
152#define OTHER_IFC_CTRL_HIZ_ULPI (1 << 2)
153#define OTHER_IFC_CTRL_ALT_INT_REROUTE (1 << 0)
154
155#define OTHER_INT_EN_RISE 0x86
156#define OTHER_INT_EN_RISE_SET 0x87
157#define OTHER_INT_EN_RISE_CLR 0x88
158#define OTHER_INT_EN_FALL 0x89
159#define OTHER_INT_EN_FALL_SET 0x8A
160#define OTHER_INT_EN_FALL_CLR 0x8B
161#define OTHER_INT_STS 0x8C
162#define OTHER_INT_LATCH 0x8D
163#define OTHER_INT_VB_SESS_VLD (1 << 7)
164#define OTHER_INT_DM_HI (1 << 6) /* not valid for "latch" reg */
165#define OTHER_INT_DP_HI (1 << 5) /* not valid for "latch" reg */
166#define OTHER_INT_BDIS_ACON (1 << 3) /* not valid for "fall" regs */
167#define OTHER_INT_MANU (1 << 1)
168#define OTHER_INT_ABNORMAL_STRESS (1 << 0)
169
170#define ID_STATUS 0x96
171#define ID_RES_FLOAT (1 << 4)
172#define ID_RES_440K (1 << 3)
173#define ID_RES_200K (1 << 2)
174#define ID_RES_102K (1 << 1)
175#define ID_RES_GND (1 << 0)
176
177#define POWER_CTRL 0xAC
178#define POWER_CTRL_SET 0xAD
179#define POWER_CTRL_CLR 0xAE
180#define POWER_CTRL_OTG_ENAB (1 << 5)
181
182#define OTHER_IFC_CTRL2 0xAF
183#define OTHER_IFC_CTRL2_SET 0xB0
184#define OTHER_IFC_CTRL2_CLR 0xB1
185#define OTHER_IFC_CTRL2_ULPI_STP_LOW (1 << 4)
186#define OTHER_IFC_CTRL2_ULPI_TXEN_POL (1 << 3)
187#define OTHER_IFC_CTRL2_ULPI_4PIN_2430 (1 << 2)
188#define OTHER_IFC_CTRL2_USB_INT_OUTSEL_MASK (3 << 0) /* bits 0 and 1 */
189#define OTHER_IFC_CTRL2_USB_INT_OUTSEL_INT1N (0 << 0)
190#define OTHER_IFC_CTRL2_USB_INT_OUTSEL_INT2N (1 << 0)
191
192#define REG_CTRL_EN 0xB2
193#define REG_CTRL_EN_SET 0xB3
194#define REG_CTRL_EN_CLR 0xB4
195#define REG_CTRL_ERROR 0xB5
196#define ULPI_I2C_CONFLICT_INTEN (1 << 0)
197
198#define OTHER_FUNC_CTRL2 0xB8
199#define OTHER_FUNC_CTRL2_SET 0xB9
200#define OTHER_FUNC_CTRL2_CLR 0xBA
201#define OTHER_FUNC_CTRL2_VBAT_TIMER_EN (1 << 0)
202
203/* following registers do not have separate _clr and _set registers */
204#define VBUS_DEBOUNCE 0xC0
205#define ID_DEBOUNCE 0xC1
206#define VBAT_TIMER 0xD3
207#define PHY_PWR_CTRL 0xFD
208#define PHY_PWR_PHYPWD (1 << 0)
209#define PHY_CLK_CTRL 0xFE
210#define PHY_CLK_CTRL_CLOCKGATING_EN (1 << 2)
211#define PHY_CLK_CTRL_CLK32K_EN (1 << 1)
212#define REQ_PHY_DPLL_CLK (1 << 0)
213#define PHY_CLK_CTRL_STS 0xFF
214#define PHY_DPLL_CLK (1 << 0)
215
216/* In module TWL4030_MODULE_PM_MASTER */
217#define PROTECT_KEY 0x0E
218
219/* In module TWL4030_MODULE_PM_RECEIVER */
220#define VUSB_DEDICATED1 0x7D
221#define VUSB_DEDICATED2 0x7E
222#define VUSB1V5_DEV_GRP 0x71
223#define VUSB1V5_TYPE 0x72
224#define VUSB1V5_REMAP 0x73
225#define VUSB1V8_DEV_GRP 0x74
226#define VUSB1V8_TYPE 0x75
227#define VUSB1V8_REMAP 0x76
228#define VUSB3V1_DEV_GRP 0x77
229#define VUSB3V1_TYPE 0x78
230#define VUSB3V1_REMAP 0x79
231
232/* In module TWL4030_MODULE_INTBR */
233#define PMBR1 0x0D
234#define GPIO_USB_4PIN_ULPI_2430C (3 << 0)
235
236
237
238enum linkstat {
239 USB_LINK_UNKNOWN = 0,
240 USB_LINK_NONE,
241 USB_LINK_VBUS,
242 USB_LINK_ID,
243};
244
245struct twl4030_usb {
246 struct otg_transceiver otg;
247 struct device *dev;
248
249 /* for vbus reporting with irqs disabled */
250 spinlock_t lock;
251
252 /* pin configuration */
253 enum twl4030_usb_mode usb_mode;
254
255 int irq;
256 u8 linkstat;
257 u8 asleep;
258 bool irq_enabled;
259};
260
261/* internal define on top of container_of */
262#define xceiv_to_twl(x) container_of((x), struct twl4030_usb, otg);
263
264/*-------------------------------------------------------------------------*/
265
266static int twl4030_i2c_write_u8_verify(struct twl4030_usb *twl,
267 u8 module, u8 data, u8 address)
268{
269 u8 check;
270
271 if ((twl4030_i2c_write_u8(module, data, address) >= 0) &&
272 (twl4030_i2c_read_u8(module, &check, address) >= 0) &&
273 (check == data))
274 return 0;
275 dev_dbg(twl->dev, "Write%d[%d,0x%x] wrote %02x but read %02x\n",
276 1, module, address, check, data);
277
278 /* Failed once: Try again */
279 if ((twl4030_i2c_write_u8(module, data, address) >= 0) &&
280 (twl4030_i2c_read_u8(module, &check, address) >= 0) &&
281 (check == data))
282 return 0;
283 dev_dbg(twl->dev, "Write%d[%d,0x%x] wrote %02x but read %02x\n",
284 2, module, address, check, data);
285
286 /* Failed again: Return error */
287 return -EBUSY;
288}
289
290#define twl4030_usb_write_verify(twl, address, data) \
291 twl4030_i2c_write_u8_verify(twl, TWL4030_MODULE_USB, (data), (address))
292
293static inline int twl4030_usb_write(struct twl4030_usb *twl,
294 u8 address, u8 data)
295{
296 int ret = 0;
297
298 ret = twl4030_i2c_write_u8(TWL4030_MODULE_USB, data, address);
299 if (ret < 0)
300 dev_dbg(twl->dev,
301 "TWL4030:USB:Write[0x%x] Error %d\n", address, ret);
302 return ret;
303}
304
305static inline int twl4030_readb(struct twl4030_usb *twl, u8 module, u8 address)
306{
307 u8 data;
308 int ret = 0;
309
310 ret = twl4030_i2c_read_u8(module, &data, address);
311 if (ret >= 0)
312 ret = data;
313 else
314 dev_dbg(twl->dev,
315 "TWL4030:readb[0x%x,0x%x] Error %d\n",
316 module, address, ret);
317
318 return ret;
319}
320
321static inline int twl4030_usb_read(struct twl4030_usb *twl, u8 address)
322{
323 return twl4030_readb(twl, TWL4030_MODULE_USB, address);
324}
325
326/*-------------------------------------------------------------------------*/
327
328static inline int
329twl4030_usb_set_bits(struct twl4030_usb *twl, u8 reg, u8 bits)
330{
331 return twl4030_usb_write(twl, reg + 1, bits);
332}
333
334static inline int
335twl4030_usb_clear_bits(struct twl4030_usb *twl, u8 reg, u8 bits)
336{
337 return twl4030_usb_write(twl, reg + 2, bits);
338}
339
340/*-------------------------------------------------------------------------*/
341
342static enum linkstat twl4030_usb_linkstat(struct twl4030_usb *twl)
343{
344 int status;
345 int linkstat = USB_LINK_UNKNOWN;
346
347 /* STS_HW_CONDITIONS */
348 status = twl4030_readb(twl, TWL4030_MODULE_PM_MASTER, 0x0f);
349 if (status < 0)
350 dev_err(twl->dev, "USB link status err %d\n", status);
351 else if (status & BIT(7))
352 linkstat = USB_LINK_VBUS;
353 else if (status & BIT(2))
354 linkstat = USB_LINK_ID;
355 else
356 linkstat = USB_LINK_NONE;
357
358 dev_dbg(twl->dev, "HW_CONDITIONS 0x%02x/%d; link %d\n",
359 status, status, linkstat);
360
361 /* REVISIT this assumes host and peripheral controllers
362 * are registered, and that both are active...
363 */
364
365 spin_lock_irq(&twl->lock);
366 twl->linkstat = linkstat;
367 if (linkstat == USB_LINK_ID) {
368 twl->otg.default_a = true;
369 twl->otg.state = OTG_STATE_A_IDLE;
370 } else {
371 twl->otg.default_a = false;
372 twl->otg.state = OTG_STATE_B_IDLE;
373 }
374 spin_unlock_irq(&twl->lock);
375
376 return linkstat;
377}
378
379static void twl4030_usb_set_mode(struct twl4030_usb *twl, int mode)
380{
381 twl->usb_mode = mode;
382
383 switch (mode) {
384 case T2_USB_MODE_ULPI:
385 twl4030_usb_clear_bits(twl, IFC_CTRL, IFC_CTRL_CARKITMODE);
386 twl4030_usb_set_bits(twl, POWER_CTRL, POWER_CTRL_OTG_ENAB);
387 twl4030_usb_clear_bits(twl, FUNC_CTRL,
388 FUNC_CTRL_XCVRSELECT_MASK |
389 FUNC_CTRL_OPMODE_MASK);
390 break;
391 case -1:
392 /* FIXME: power on defaults */
393 break;
394 default:
395 dev_err(twl->dev, "unsupported T2 transceiver mode %d\n",
396 mode);
397 break;
398 };
399}
400
401static void twl4030_i2c_access(struct twl4030_usb *twl, int on)
402{
403 unsigned long timeout;
404 int val = twl4030_usb_read(twl, PHY_CLK_CTRL);
405
406 if (val >= 0) {
407 if (on) {
408 /* enable DPLL to access PHY registers over I2C */
409 val |= REQ_PHY_DPLL_CLK;
410 WARN_ON(twl4030_usb_write_verify(twl, PHY_CLK_CTRL,
411 (u8)val) < 0);
412
413 timeout = jiffies + HZ;
414 while (!(twl4030_usb_read(twl, PHY_CLK_CTRL_STS) &
415 PHY_DPLL_CLK)
416 && time_before(jiffies, timeout))
417 udelay(10);
418 if (!(twl4030_usb_read(twl, PHY_CLK_CTRL_STS) &
419 PHY_DPLL_CLK))
420 dev_err(twl->dev, "Timeout setting T2 HSUSB "
421 "PHY DPLL clock\n");
422 } else {
423 /* let ULPI control the DPLL clock */
424 val &= ~REQ_PHY_DPLL_CLK;
425 WARN_ON(twl4030_usb_write_verify(twl, PHY_CLK_CTRL,
426 (u8)val) < 0);
427 }
428 }
429}
430
431static void twl4030_phy_power(struct twl4030_usb *twl, int on)
432{
433 u8 pwr;
434
435 pwr = twl4030_usb_read(twl, PHY_PWR_CTRL);
436 if (on) {
437 pwr &= ~PHY_PWR_PHYPWD;
438 WARN_ON(twl4030_usb_write_verify(twl, PHY_PWR_CTRL, pwr) < 0);
439 twl4030_usb_write(twl, PHY_CLK_CTRL,
440 twl4030_usb_read(twl, PHY_CLK_CTRL) |
441 (PHY_CLK_CTRL_CLOCKGATING_EN |
442 PHY_CLK_CTRL_CLK32K_EN));
443 } else {
444 pwr |= PHY_PWR_PHYPWD;
445 WARN_ON(twl4030_usb_write_verify(twl, PHY_PWR_CTRL, pwr) < 0);
446 }
447}
448
449static void twl4030_phy_suspend(struct twl4030_usb *twl, int controller_off)
450{
451 if (twl->asleep)
452 return;
453
454 twl4030_phy_power(twl, 0);
455 twl->asleep = 1;
456}
457
458static void twl4030_phy_resume(struct twl4030_usb *twl)
459{
460 if (!twl->asleep)
461 return;
462
463 twl4030_phy_power(twl, 1);
464 twl4030_i2c_access(twl, 1);
465 twl4030_usb_set_mode(twl, twl->usb_mode);
466 if (twl->usb_mode == T2_USB_MODE_ULPI)
467 twl4030_i2c_access(twl, 0);
468 twl->asleep = 0;
469}
470
471static void twl4030_usb_ldo_init(struct twl4030_usb *twl)
472{
473 /* Enable writing to power configuration registers */
474 twl4030_i2c_write_u8(TWL4030_MODULE_PM_MASTER, 0xC0, PROTECT_KEY);
475 twl4030_i2c_write_u8(TWL4030_MODULE_PM_MASTER, 0x0C, PROTECT_KEY);
476
477 /* put VUSB3V1 LDO in active state */
478 twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, 0, VUSB_DEDICATED2);
479
480 /* input to VUSB3V1 LDO is from VBAT, not VBUS */
481 twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, 0x14, VUSB_DEDICATED1);
482
483 /* turn on 3.1V regulator */
484 twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, 0x20, VUSB3V1_DEV_GRP);
485 twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, 0, VUSB3V1_TYPE);
486
487 /* turn on 1.5V regulator */
488 twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, 0x20, VUSB1V5_DEV_GRP);
489 twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, 0, VUSB1V5_TYPE);
490
491 /* turn on 1.8V regulator */
492 twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, 0x20, VUSB1V8_DEV_GRP);
493 twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, 0, VUSB1V8_TYPE);
494
495 /* disable access to power configuration registers */
496 twl4030_i2c_write_u8(TWL4030_MODULE_PM_MASTER, 0, PROTECT_KEY);
497}
498
499static ssize_t twl4030_usb_vbus_show(struct device *dev,
500 struct device_attribute *attr, char *buf)
501{
502 struct twl4030_usb *twl = dev_get_drvdata(dev);
503 unsigned long flags;
504 int ret = -EINVAL;
505
506 spin_lock_irqsave(&twl->lock, flags);
507 ret = sprintf(buf, "%s\n",
508 (twl->linkstat == USB_LINK_VBUS) ? "on" : "off");
509 spin_unlock_irqrestore(&twl->lock, flags);
510
511 return ret;
512}
513static DEVICE_ATTR(vbus, 0444, twl4030_usb_vbus_show, NULL);
514
515static irqreturn_t twl4030_usb_irq(int irq, void *_twl)
516{
517 struct twl4030_usb *twl = _twl;
518 int status;
519
520#ifdef CONFIG_LOCKDEP
521 /* WORKAROUND for lockdep forcing IRQF_DISABLED on us, which
522 * we don't want and can't tolerate. Although it might be
523 * friendlier not to borrow this thread context...
524 */
525 local_irq_enable();
526#endif
527
528 status = twl4030_usb_linkstat(twl);
529 if (status != USB_LINK_UNKNOWN) {
530
531 /* FIXME add a set_power() method so that B-devices can
532 * configure the charger appropriately. It's not always
533 * correct to consume VBUS power, and how much current to
534 * consume is a function of the USB configuration chosen
535 * by the host.
536 *
537 * REVISIT usb_gadget_vbus_connect(...) as needed, ditto
538 * its disconnect() sibling, when changing to/from the
539 * USB_LINK_VBUS state. musb_hdrc won't care until it
540 * starts to handle softconnect right.
541 */
542 twl4030charger_usb_en(status == USB_LINK_VBUS);
543
544 if (status == USB_LINK_NONE)
545 twl4030_phy_suspend(twl, 0);
546 else
547 twl4030_phy_resume(twl);
548 }
549 sysfs_notify(&twl->dev->kobj, NULL, "vbus");
550
551 return IRQ_HANDLED;
552}
553
554static int twl4030_set_suspend(struct otg_transceiver *x, int suspend)
555{
556 struct twl4030_usb *twl = xceiv_to_twl(x);
557
558 if (suspend)
559 twl4030_phy_suspend(twl, 1);
560 else
561 twl4030_phy_resume(twl);
562
563 return 0;
564}
565
566static int twl4030_set_peripheral(struct otg_transceiver *x,
567 struct usb_gadget *gadget)
568{
569 struct twl4030_usb *twl;
570
571 if (!x)
572 return -ENODEV;
573
574 twl = xceiv_to_twl(x);
575 twl->otg.gadget = gadget;
576 if (!gadget)
577 twl->otg.state = OTG_STATE_UNDEFINED;
578
579 return 0;
580}
581
582static int twl4030_set_host(struct otg_transceiver *x, struct usb_bus *host)
583{
584 struct twl4030_usb *twl;
585
586 if (!x)
587 return -ENODEV;
588
589 twl = xceiv_to_twl(x);
590 twl->otg.host = host;
591 if (!host)
592 twl->otg.state = OTG_STATE_UNDEFINED;
593
594 return 0;
595}
596
597static int __init twl4030_usb_probe(struct platform_device *pdev)
598{
599 struct twl4030_usb_data *pdata = pdev->dev.platform_data;
600 struct twl4030_usb *twl;
601 int status;
602
603 if (!pdata) {
604 dev_dbg(&pdev->dev, "platform_data not available\n");
605 return -EINVAL;
606 }
607
608 twl = kzalloc(sizeof *twl, GFP_KERNEL);
609 if (!twl)
610 return -ENOMEM;
611
612 twl->dev = &pdev->dev;
613 twl->irq = platform_get_irq(pdev, 0);
614 twl->otg.dev = twl->dev;
615 twl->otg.label = "twl4030";
616 twl->otg.set_host = twl4030_set_host;
617 twl->otg.set_peripheral = twl4030_set_peripheral;
618 twl->otg.set_suspend = twl4030_set_suspend;
619 twl->usb_mode = pdata->usb_mode;
620 twl->asleep = 1;
621
622 /* init spinlock for workqueue */
623 spin_lock_init(&twl->lock);
624
625 twl4030_usb_ldo_init(twl);
626 otg_set_transceiver(&twl->otg);
627
628 platform_set_drvdata(pdev, twl);
629 if (device_create_file(&pdev->dev, &dev_attr_vbus))
630 dev_warn(&pdev->dev, "could not create sysfs file\n");
631
632 /* Our job is to use irqs and status from the power module
633 * to keep the transceiver disabled when nothing's connected.
634 *
635 * FIXME we actually shouldn't start enabling it until the
636 * USB controller drivers have said they're ready, by calling
637 * set_host() and/or set_peripheral() ... OTG_capable boards
638 * need both handles, otherwise just one suffices.
639 */
640 twl->irq_enabled = true;
641 status = request_irq(twl->irq, twl4030_usb_irq,
642 IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING,
643 "twl4030_usb", twl);
644 if (status < 0) {
645 dev_dbg(&pdev->dev, "can't get IRQ %d, err %d\n",
646 twl->irq, status);
647 kfree(twl);
648 return status;
649 }
650
651 /* The IRQ handler just handles changes from the previous states
652 * of the ID and VBUS pins ... in probe() we must initialize that
653 * previous state. The easy way: fake an IRQ.
654 *
655 * REVISIT: a real IRQ might have happened already, if PREEMPT is
656 * enabled. Else the IRQ may not yet be configured or enabled,
657 * because of scheduling delays.
658 */
659 twl4030_usb_irq(twl->irq, twl);
660
661 dev_info(&pdev->dev, "Initialized TWL4030 USB module\n");
662 return 0;
663}
664
665static int __exit twl4030_usb_remove(struct platform_device *pdev)
666{
667 struct twl4030_usb *twl = platform_get_drvdata(pdev);
668 int val;
669
670 free_irq(twl->irq, twl);
671 device_remove_file(twl->dev, &dev_attr_vbus);
672
673 /* set transceiver mode to power on defaults */
674 twl4030_usb_set_mode(twl, -1);
675
676 /* autogate 60MHz ULPI clock,
677 * clear dpll clock request for i2c access,
678 * disable 32KHz
679 */
680 val = twl4030_usb_read(twl, PHY_CLK_CTRL);
681 if (val >= 0) {
682 val |= PHY_CLK_CTRL_CLOCKGATING_EN;
683 val &= ~(PHY_CLK_CTRL_CLK32K_EN | REQ_PHY_DPLL_CLK);
684 twl4030_usb_write(twl, PHY_CLK_CTRL, (u8)val);
685 }
686
687 /* disable complete OTG block */
688 twl4030_usb_clear_bits(twl, POWER_CTRL, POWER_CTRL_OTG_ENAB);
689
690 twl4030_phy_power(twl, 0);
691
692 kfree(twl);
693
694 return 0;
695}
696
697static struct platform_driver twl4030_usb_driver = {
698 .probe = twl4030_usb_probe,
699 .remove = __exit_p(twl4030_usb_remove),
700 .driver = {
701 .name = "twl4030_usb",
702 .owner = THIS_MODULE,
703 },
704};
705
706static int __init twl4030_usb_init(void)
707{
708 return platform_driver_register(&twl4030_usb_driver);
709}
710subsys_initcall(twl4030_usb_init);
711
712static void __exit twl4030_usb_exit(void)
713{
714 platform_driver_unregister(&twl4030_usb_driver);
715}
716module_exit(twl4030_usb_exit);
717
718MODULE_ALIAS("platform:twl4030_usb");
719MODULE_AUTHOR("Texas Instruments, Inc, Nokia Corporation");
720MODULE_DESCRIPTION("TWL4030 USB transceiver driver");
721MODULE_LICENSE("GPL");
diff --git a/drivers/usb/serial/Kconfig b/drivers/usb/serial/Kconfig
index 70338f4ec918..b361f05cafac 100644
--- a/drivers/usb/serial/Kconfig
+++ b/drivers/usb/serial/Kconfig
@@ -496,6 +496,14 @@ config USB_SERIAL_SAFE_PADDED
496 bool "USB Secure Encapsulated Driver - Padded" 496 bool "USB Secure Encapsulated Driver - Padded"
497 depends on USB_SERIAL_SAFE 497 depends on USB_SERIAL_SAFE
498 498
499config USB_SERIAL_SIEMENS_MPI
500 tristate "USB Siemens MPI driver"
501 help
502 Say M here if you want to use a Siemens USB/MPI adapter.
503
504 To compile this driver as a module, choose M here: the
505 module will be called siemens_mpi.
506
499config USB_SERIAL_SIERRAWIRELESS 507config USB_SERIAL_SIERRAWIRELESS
500 tristate "USB Sierra Wireless Driver" 508 tristate "USB Sierra Wireless Driver"
501 help 509 help
@@ -565,6 +573,15 @@ config USB_SERIAL_OMNINET
565 To compile this driver as a module, choose M here: the 573 To compile this driver as a module, choose M here: the
566 module will be called omninet. 574 module will be called omninet.
567 575
576config USB_SERIAL_OPTICON
577 tristate "USB Opticon Barcode driver (serial mode)"
578 help
579 Say Y here if you want to use a Opticon USB Barcode device
580 in serial emulation mode.
581
582 To compile this driver as a module, choose M here: the
583 module will be called opticon.
584
568config USB_SERIAL_DEBUG 585config USB_SERIAL_DEBUG
569 tristate "USB Debugging Device" 586 tristate "USB Debugging Device"
570 help 587 help
diff --git a/drivers/usb/serial/Makefile b/drivers/usb/serial/Makefile
index 6047f818adfe..b75be91eb8f1 100644
--- a/drivers/usb/serial/Makefile
+++ b/drivers/usb/serial/Makefile
@@ -41,10 +41,12 @@ obj-$(CONFIG_USB_SERIAL_MOS7840) += mos7840.o
41obj-$(CONFIG_USB_SERIAL_MOTOROLA) += moto_modem.o 41obj-$(CONFIG_USB_SERIAL_MOTOROLA) += moto_modem.o
42obj-$(CONFIG_USB_SERIAL_NAVMAN) += navman.o 42obj-$(CONFIG_USB_SERIAL_NAVMAN) += navman.o
43obj-$(CONFIG_USB_SERIAL_OMNINET) += omninet.o 43obj-$(CONFIG_USB_SERIAL_OMNINET) += omninet.o
44obj-$(CONFIG_USB_SERIAL_OPTICON) += opticon.o
44obj-$(CONFIG_USB_SERIAL_OPTION) += option.o 45obj-$(CONFIG_USB_SERIAL_OPTION) += option.o
45obj-$(CONFIG_USB_SERIAL_OTI6858) += oti6858.o 46obj-$(CONFIG_USB_SERIAL_OTI6858) += oti6858.o
46obj-$(CONFIG_USB_SERIAL_PL2303) += pl2303.o 47obj-$(CONFIG_USB_SERIAL_PL2303) += pl2303.o
47obj-$(CONFIG_USB_SERIAL_SAFE) += safe_serial.o 48obj-$(CONFIG_USB_SERIAL_SAFE) += safe_serial.o
49obj-$(CONFIG_USB_SERIAL_SIEMENS_MPI) += siemens_mpi.o
48obj-$(CONFIG_USB_SERIAL_SIERRAWIRELESS) += sierra.o 50obj-$(CONFIG_USB_SERIAL_SIERRAWIRELESS) += sierra.o
49obj-$(CONFIG_USB_SERIAL_SPCP8X5) += spcp8x5.o 51obj-$(CONFIG_USB_SERIAL_SPCP8X5) += spcp8x5.o
50obj-$(CONFIG_USB_SERIAL_TI) += ti_usb_3410_5052.o 52obj-$(CONFIG_USB_SERIAL_TI) += ti_usb_3410_5052.o
diff --git a/drivers/usb/serial/digi_acceleport.c b/drivers/usb/serial/digi_acceleport.c
index 69f84f0ea6fe..38ba4ea8b6bf 100644
--- a/drivers/usb/serial/digi_acceleport.c
+++ b/drivers/usb/serial/digi_acceleport.c
@@ -635,8 +635,7 @@ static int digi_write_oob_command(struct usb_serial_port *port,
635 635
636 spin_lock_irqsave(&oob_priv->dp_port_lock, flags); 636 spin_lock_irqsave(&oob_priv->dp_port_lock, flags);
637 while (count > 0) { 637 while (count > 0) {
638 while (oob_port->write_urb->status == -EINPROGRESS 638 while (oob_priv->dp_write_urb_in_use) {
639 || oob_priv->dp_write_urb_in_use) {
640 cond_wait_interruptible_timeout_irqrestore( 639 cond_wait_interruptible_timeout_irqrestore(
641 &oob_port->write_wait, DIGI_RETRY_TIMEOUT, 640 &oob_port->write_wait, DIGI_RETRY_TIMEOUT,
642 &oob_priv->dp_port_lock, flags); 641 &oob_priv->dp_port_lock, flags);
@@ -699,9 +698,8 @@ static int digi_write_inb_command(struct usb_serial_port *port,
699 698
700 spin_lock_irqsave(&priv->dp_port_lock, flags); 699 spin_lock_irqsave(&priv->dp_port_lock, flags);
701 while (count > 0 && ret == 0) { 700 while (count > 0 && ret == 0) {
702 while ((port->write_urb->status == -EINPROGRESS 701 while (priv->dp_write_urb_in_use &&
703 || priv->dp_write_urb_in_use) 702 time_before(jiffies, timeout)) {
704 && time_before(jiffies, timeout)) {
705 cond_wait_interruptible_timeout_irqrestore( 703 cond_wait_interruptible_timeout_irqrestore(
706 &port->write_wait, DIGI_RETRY_TIMEOUT, 704 &port->write_wait, DIGI_RETRY_TIMEOUT,
707 &priv->dp_port_lock, flags); 705 &priv->dp_port_lock, flags);
@@ -779,8 +777,7 @@ static int digi_set_modem_signals(struct usb_serial_port *port,
779 spin_lock_irqsave(&oob_priv->dp_port_lock, flags); 777 spin_lock_irqsave(&oob_priv->dp_port_lock, flags);
780 spin_lock(&port_priv->dp_port_lock); 778 spin_lock(&port_priv->dp_port_lock);
781 779
782 while (oob_port->write_urb->status == -EINPROGRESS || 780 while (oob_priv->dp_write_urb_in_use) {
783 oob_priv->dp_write_urb_in_use) {
784 spin_unlock(&port_priv->dp_port_lock); 781 spin_unlock(&port_priv->dp_port_lock);
785 cond_wait_interruptible_timeout_irqrestore( 782 cond_wait_interruptible_timeout_irqrestore(
786 &oob_port->write_wait, DIGI_RETRY_TIMEOUT, 783 &oob_port->write_wait, DIGI_RETRY_TIMEOUT,
@@ -1168,12 +1165,10 @@ static int digi_write(struct tty_struct *tty, struct usb_serial_port *port,
1168 1165
1169 /* be sure only one write proceeds at a time */ 1166 /* be sure only one write proceeds at a time */
1170 /* there are races on the port private buffer */ 1167 /* there are races on the port private buffer */
1171 /* and races to check write_urb->status */
1172 spin_lock_irqsave(&priv->dp_port_lock, flags); 1168 spin_lock_irqsave(&priv->dp_port_lock, flags);
1173 1169
1174 /* wait for urb status clear to submit another urb */ 1170 /* wait for urb status clear to submit another urb */
1175 if (port->write_urb->status == -EINPROGRESS || 1171 if (priv->dp_write_urb_in_use) {
1176 priv->dp_write_urb_in_use) {
1177 /* buffer data if count is 1 (probably put_char) if possible */ 1172 /* buffer data if count is 1 (probably put_char) if possible */
1178 if (count == 1 && priv->dp_out_buf_len < DIGI_OUT_BUF_SIZE) { 1173 if (count == 1 && priv->dp_out_buf_len < DIGI_OUT_BUF_SIZE) {
1179 priv->dp_out_buf[priv->dp_out_buf_len++] = *buf; 1174 priv->dp_out_buf[priv->dp_out_buf_len++] = *buf;
@@ -1236,7 +1231,7 @@ static void digi_write_bulk_callback(struct urb *urb)
1236 int ret = 0; 1231 int ret = 0;
1237 int status = urb->status; 1232 int status = urb->status;
1238 1233
1239 dbg("digi_write_bulk_callback: TOP, urb->status=%d", status); 1234 dbg("digi_write_bulk_callback: TOP, status=%d", status);
1240 1235
1241 /* port and serial sanity check */ 1236 /* port and serial sanity check */
1242 if (port == NULL || (priv = usb_get_serial_port_data(port)) == NULL) { 1237 if (port == NULL || (priv = usb_get_serial_port_data(port)) == NULL) {
@@ -1266,8 +1261,7 @@ static void digi_write_bulk_callback(struct urb *urb)
1266 /* try to send any buffered data on this port, if it is open */ 1261 /* try to send any buffered data on this port, if it is open */
1267 spin_lock(&priv->dp_port_lock); 1262 spin_lock(&priv->dp_port_lock);
1268 priv->dp_write_urb_in_use = 0; 1263 priv->dp_write_urb_in_use = 0;
1269 if (port->port.count && port->write_urb->status != -EINPROGRESS 1264 if (port->port.count && priv->dp_out_buf_len > 0) {
1270 && priv->dp_out_buf_len > 0) {
1271 *((unsigned char *)(port->write_urb->transfer_buffer)) 1265 *((unsigned char *)(port->write_urb->transfer_buffer))
1272 = (unsigned char)DIGI_CMD_SEND_DATA; 1266 = (unsigned char)DIGI_CMD_SEND_DATA;
1273 *((unsigned char *)(port->write_urb->transfer_buffer) + 1) 1267 *((unsigned char *)(port->write_urb->transfer_buffer) + 1)
@@ -1305,8 +1299,7 @@ static int digi_write_room(struct tty_struct *tty)
1305 1299
1306 spin_lock_irqsave(&priv->dp_port_lock, flags); 1300 spin_lock_irqsave(&priv->dp_port_lock, flags);
1307 1301
1308 if (port->write_urb->status == -EINPROGRESS || 1302 if (priv->dp_write_urb_in_use)
1309 priv->dp_write_urb_in_use)
1310 room = 0; 1303 room = 0;
1311 else 1304 else
1312 room = port->bulk_out_size - 2 - priv->dp_out_buf_len; 1305 room = port->bulk_out_size - 2 - priv->dp_out_buf_len;
@@ -1322,8 +1315,7 @@ static int digi_chars_in_buffer(struct tty_struct *tty)
1322 struct usb_serial_port *port = tty->driver_data; 1315 struct usb_serial_port *port = tty->driver_data;
1323 struct digi_port *priv = usb_get_serial_port_data(port); 1316 struct digi_port *priv = usb_get_serial_port_data(port);
1324 1317
1325 if (port->write_urb->status == -EINPROGRESS 1318 if (priv->dp_write_urb_in_use) {
1326 || priv->dp_write_urb_in_use) {
1327 dbg("digi_chars_in_buffer: port=%d, chars=%d", 1319 dbg("digi_chars_in_buffer: port=%d, chars=%d",
1328 priv->dp_port_num, port->bulk_out_size - 2); 1320 priv->dp_port_num, port->bulk_out_size - 2);
1329 /* return(port->bulk_out_size - 2); */ 1321 /* return(port->bulk_out_size - 2); */
@@ -1702,7 +1694,7 @@ static int digi_read_inb_callback(struct urb *urb)
1702 /* short/multiple packet check */ 1694 /* short/multiple packet check */
1703 if (urb->actual_length != len + 2) { 1695 if (urb->actual_length != len + 2) {
1704 dev_err(&port->dev, "%s: INCOMPLETE OR MULTIPLE PACKET, " 1696 dev_err(&port->dev, "%s: INCOMPLETE OR MULTIPLE PACKET, "
1705 "urb->status=%d, port=%d, opcode=%d, len=%d, " 1697 "status=%d, port=%d, opcode=%d, len=%d, "
1706 "actual_length=%d, status=%d\n", __func__, status, 1698 "actual_length=%d, status=%d\n", __func__, status,
1707 priv->dp_port_num, opcode, len, urb->actual_length, 1699 priv->dp_port_num, opcode, len, urb->actual_length,
1708 port_status); 1700 port_status);
diff --git a/drivers/usb/serial/garmin_gps.c b/drivers/usb/serial/garmin_gps.c
index 8e6a66e38db2..a26a0e2cdb4a 100644
--- a/drivers/usb/serial/garmin_gps.c
+++ b/drivers/usb/serial/garmin_gps.c
@@ -1056,7 +1056,7 @@ static void garmin_write_bulk_callback(struct urb *urb)
1056 1056
1057 if (status) { 1057 if (status) {
1058 dbg("%s - nonzero write bulk status received: %d", 1058 dbg("%s - nonzero write bulk status received: %d",
1059 __func__, urb->status); 1059 __func__, status);
1060 spin_lock_irqsave(&garmin_data_p->lock, flags); 1060 spin_lock_irqsave(&garmin_data_p->lock, flags);
1061 garmin_data_p->flags |= CLEAR_HALT_REQUIRED; 1061 garmin_data_p->flags |= CLEAR_HALT_REQUIRED;
1062 spin_unlock_irqrestore(&garmin_data_p->lock, flags); 1062 spin_unlock_irqrestore(&garmin_data_p->lock, flags);
diff --git a/drivers/usb/serial/ipw.c b/drivers/usb/serial/ipw.c
index 3ac59a8a980f..f530032ed93d 100644
--- a/drivers/usb/serial/ipw.c
+++ b/drivers/usb/serial/ipw.c
@@ -473,7 +473,7 @@ static struct usb_serial_driver ipw_device = {
473 473
474 474
475 475
476static int usb_ipw_init(void) 476static int __init usb_ipw_init(void)
477{ 477{
478 int retval; 478 int retval;
479 479
@@ -490,7 +490,7 @@ static int usb_ipw_init(void)
490 return 0; 490 return 0;
491} 491}
492 492
493static void usb_ipw_exit(void) 493static void __exit usb_ipw_exit(void)
494{ 494{
495 usb_deregister(&usb_ipw_driver); 495 usb_deregister(&usb_ipw_driver);
496 usb_serial_deregister(&ipw_device); 496 usb_serial_deregister(&ipw_device);
diff --git a/drivers/usb/serial/iuu_phoenix.c b/drivers/usb/serial/iuu_phoenix.c
index e320972cb227..2314c6ae4fc2 100644
--- a/drivers/usb/serial/iuu_phoenix.c
+++ b/drivers/usb/serial/iuu_phoenix.c
@@ -190,10 +190,12 @@ static void iuu_rxcmd(struct urb *urb)
190{ 190{
191 struct usb_serial_port *port = urb->context; 191 struct usb_serial_port *port = urb->context;
192 int result; 192 int result;
193 int status = urb->status;
194
193 dbg("%s - enter", __func__); 195 dbg("%s - enter", __func__);
194 196
195 if (urb->status) { 197 if (status) {
196 dbg("%s - urb->status = %d", __func__, urb->status); 198 dbg("%s - status = %d", __func__, status);
197 /* error stop all */ 199 /* error stop all */
198 return; 200 return;
199 } 201 }
@@ -245,10 +247,12 @@ static void iuu_update_status_callback(struct urb *urb)
245 struct usb_serial_port *port = urb->context; 247 struct usb_serial_port *port = urb->context;
246 struct iuu_private *priv = usb_get_serial_port_data(port); 248 struct iuu_private *priv = usb_get_serial_port_data(port);
247 u8 *st; 249 u8 *st;
250 int status = urb->status;
251
248 dbg("%s - enter", __func__); 252 dbg("%s - enter", __func__);
249 253
250 if (urb->status) { 254 if (status) {
251 dbg("%s - urb->status = %d", __func__, urb->status); 255 dbg("%s - status = %d", __func__, status);
252 /* error stop all */ 256 /* error stop all */
253 return; 257 return;
254 } 258 }
@@ -274,9 +278,9 @@ static void iuu_status_callback(struct urb *urb)
274{ 278{
275 struct usb_serial_port *port = urb->context; 279 struct usb_serial_port *port = urb->context;
276 int result; 280 int result;
277 dbg("%s - enter", __func__); 281 int status = urb->status;
278 282
279 dbg("%s - urb->status = %d", __func__, urb->status); 283 dbg("%s - status = %d", __func__, status);
280 usb_fill_bulk_urb(port->read_urb, port->serial->dev, 284 usb_fill_bulk_urb(port->read_urb, port->serial->dev,
281 usb_rcvbulkpipe(port->serial->dev, 285 usb_rcvbulkpipe(port->serial->dev,
282 port->bulk_in_endpointAddress), 286 port->bulk_in_endpointAddress),
@@ -618,11 +622,12 @@ static void read_buf_callback(struct urb *urb)
618 struct usb_serial_port *port = urb->context; 622 struct usb_serial_port *port = urb->context;
619 unsigned char *data = urb->transfer_buffer; 623 unsigned char *data = urb->transfer_buffer;
620 struct tty_struct *tty; 624 struct tty_struct *tty;
621 dbg("%s - urb->status = %d", __func__, urb->status); 625 int status = urb->status;
622 626
623 if (urb->status) { 627 dbg("%s - status = %d", __func__, status);
624 dbg("%s - urb->status = %d", __func__, urb->status); 628
625 if (urb->status == -EPROTO) { 629 if (status) {
630 if (status == -EPROTO) {
626 /* reschedule needed */ 631 /* reschedule needed */
627 } 632 }
628 return; 633 return;
@@ -695,7 +700,7 @@ static void iuu_uart_read_callback(struct urb *urb)
695 struct usb_serial_port *port = urb->context; 700 struct usb_serial_port *port = urb->context;
696 struct iuu_private *priv = usb_get_serial_port_data(port); 701 struct iuu_private *priv = usb_get_serial_port_data(port);
697 unsigned long flags; 702 unsigned long flags;
698 int status; 703 int status = urb->status;
699 int error = 0; 704 int error = 0;
700 int len = 0; 705 int len = 0;
701 unsigned char *data = urb->transfer_buffer; 706 unsigned char *data = urb->transfer_buffer;
@@ -703,8 +708,8 @@ static void iuu_uart_read_callback(struct urb *urb)
703 708
704 dbg("%s - enter", __func__); 709 dbg("%s - enter", __func__);
705 710
706 if (urb->status) { 711 if (status) {
707 dbg("%s - urb->status = %d", __func__, urb->status); 712 dbg("%s - status = %d", __func__, status);
708 /* error stop all */ 713 /* error stop all */
709 return; 714 return;
710 } 715 }
@@ -782,12 +787,11 @@ static void read_rxcmd_callback(struct urb *urb)
782{ 787{
783 struct usb_serial_port *port = urb->context; 788 struct usb_serial_port *port = urb->context;
784 int result; 789 int result;
785 dbg("%s - enter", __func__); 790 int status = urb->status;
786 791
787 dbg("%s - urb->status = %d", __func__, urb->status); 792 dbg("%s - status = %d", __func__, status);
788 793
789 if (urb->status) { 794 if (status) {
790 dbg("%s - urb->status = %d", __func__, urb->status);
791 /* error stop all */ 795 /* error stop all */
792 return; 796 return;
793 } 797 }
diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c
index 96a8c7713212..2c20e88a91b3 100644
--- a/drivers/usb/serial/mos7840.c
+++ b/drivers/usb/serial/mos7840.c
@@ -214,6 +214,7 @@ struct moschip_port {
214 spinlock_t pool_lock; 214 spinlock_t pool_lock;
215 struct urb *write_urb_pool[NUM_URBS]; 215 struct urb *write_urb_pool[NUM_URBS];
216 char busy[NUM_URBS]; 216 char busy[NUM_URBS];
217 bool read_urb_busy;
217}; 218};
218 219
219 220
@@ -679,26 +680,30 @@ static void mos7840_bulk_in_callback(struct urb *urb)
679 struct tty_struct *tty; 680 struct tty_struct *tty;
680 int status = urb->status; 681 int status = urb->status;
681 682
682 if (status) {
683 dbg("nonzero read bulk status received: %d", status);
684 return;
685 }
686
687 mos7840_port = urb->context; 683 mos7840_port = urb->context;
688 if (!mos7840_port) { 684 if (!mos7840_port) {
689 dbg("%s", "NULL mos7840_port pointer \n"); 685 dbg("%s", "NULL mos7840_port pointer \n");
686 mos7840_port->read_urb_busy = false;
687 return;
688 }
689
690 if (status) {
691 dbg("nonzero read bulk status received: %d", status);
692 mos7840_port->read_urb_busy = false;
690 return; 693 return;
691 } 694 }
692 695
693 port = (struct usb_serial_port *)mos7840_port->port; 696 port = (struct usb_serial_port *)mos7840_port->port;
694 if (mos7840_port_paranoia_check(port, __func__)) { 697 if (mos7840_port_paranoia_check(port, __func__)) {
695 dbg("%s", "Port Paranoia failed \n"); 698 dbg("%s", "Port Paranoia failed \n");
699 mos7840_port->read_urb_busy = false;
696 return; 700 return;
697 } 701 }
698 702
699 serial = mos7840_get_usb_serial(port, __func__); 703 serial = mos7840_get_usb_serial(port, __func__);
700 if (!serial) { 704 if (!serial) {
701 dbg("%s\n", "Bad serial pointer "); 705 dbg("%s\n", "Bad serial pointer ");
706 mos7840_port->read_urb_busy = false;
702 return; 707 return;
703 } 708 }
704 709
@@ -725,17 +730,19 @@ static void mos7840_bulk_in_callback(struct urb *urb)
725 730
726 if (!mos7840_port->read_urb) { 731 if (!mos7840_port->read_urb) {
727 dbg("%s", "URB KILLED !!!\n"); 732 dbg("%s", "URB KILLED !!!\n");
733 mos7840_port->read_urb_busy = false;
728 return; 734 return;
729 } 735 }
730 736
731 737
732 mos7840_port->read_urb->dev = serial->dev; 738 mos7840_port->read_urb->dev = serial->dev;
733 739
740 mos7840_port->read_urb_busy = true;
734 retval = usb_submit_urb(mos7840_port->read_urb, GFP_ATOMIC); 741 retval = usb_submit_urb(mos7840_port->read_urb, GFP_ATOMIC);
735 742
736 if (retval) { 743 if (retval) {
737 dbg(" usb_submit_urb(read bulk) failed, retval = %d", 744 dbg("usb_submit_urb(read bulk) failed, retval = %d", retval);
738 retval); 745 mos7840_port->read_urb_busy = false;
739 } 746 }
740} 747}
741 748
@@ -1055,10 +1062,12 @@ static int mos7840_open(struct tty_struct *tty,
1055 1062
1056 dbg("mos7840_open: bulkin endpoint is %d\n", 1063 dbg("mos7840_open: bulkin endpoint is %d\n",
1057 port->bulk_in_endpointAddress); 1064 port->bulk_in_endpointAddress);
1065 mos7840_port->read_urb_busy = true;
1058 response = usb_submit_urb(mos7840_port->read_urb, GFP_KERNEL); 1066 response = usb_submit_urb(mos7840_port->read_urb, GFP_KERNEL);
1059 if (response) { 1067 if (response) {
1060 dev_err(&port->dev, "%s - Error %d submitting control urb\n", 1068 dev_err(&port->dev, "%s - Error %d submitting control urb\n",
1061 __func__, response); 1069 __func__, response);
1070 mos7840_port->read_urb_busy = false;
1062 } 1071 }
1063 1072
1064 /* initialize our wait queues */ 1073 /* initialize our wait queues */
@@ -1227,6 +1236,7 @@ static void mos7840_close(struct tty_struct *tty,
1227 if (mos7840_port->read_urb) { 1236 if (mos7840_port->read_urb) {
1228 dbg("%s", "Shutdown bulk read\n"); 1237 dbg("%s", "Shutdown bulk read\n");
1229 usb_kill_urb(mos7840_port->read_urb); 1238 usb_kill_urb(mos7840_port->read_urb);
1239 mos7840_port->read_urb_busy = false;
1230 } 1240 }
1231 if ((&mos7840_port->control_urb)) { 1241 if ((&mos7840_port->control_urb)) {
1232 dbg("%s", "Shutdown control read\n"); 1242 dbg("%s", "Shutdown control read\n");
@@ -2043,14 +2053,14 @@ static void mos7840_change_port_settings(struct tty_struct *tty,
2043 Data = 0x0c; 2053 Data = 0x0c;
2044 mos7840_set_uart_reg(port, INTERRUPT_ENABLE_REGISTER, Data); 2054 mos7840_set_uart_reg(port, INTERRUPT_ENABLE_REGISTER, Data);
2045 2055
2046 if (mos7840_port->read_urb->status != -EINPROGRESS) { 2056 if (mos7840_port->read_urb_busy == false) {
2047 mos7840_port->read_urb->dev = serial->dev; 2057 mos7840_port->read_urb->dev = serial->dev;
2048 2058 mos7840_port->read_urb_busy = true;
2049 status = usb_submit_urb(mos7840_port->read_urb, GFP_ATOMIC); 2059 status = usb_submit_urb(mos7840_port->read_urb, GFP_ATOMIC);
2050
2051 if (status) { 2060 if (status) {
2052 dbg(" usb_submit_urb(read bulk) failed, status = %d", 2061 dbg("usb_submit_urb(read bulk) failed, status = %d",
2053 status); 2062 status);
2063 mos7840_port->read_urb_busy = false;
2054 } 2064 }
2055 } 2065 }
2056 wake_up(&mos7840_port->delta_msr_wait); 2066 wake_up(&mos7840_port->delta_msr_wait);
@@ -2117,12 +2127,14 @@ static void mos7840_set_termios(struct tty_struct *tty,
2117 return; 2127 return;
2118 } 2128 }
2119 2129
2120 if (mos7840_port->read_urb->status != -EINPROGRESS) { 2130 if (mos7840_port->read_urb_busy == false) {
2121 mos7840_port->read_urb->dev = serial->dev; 2131 mos7840_port->read_urb->dev = serial->dev;
2132 mos7840_port->read_urb_busy = true;
2122 status = usb_submit_urb(mos7840_port->read_urb, GFP_ATOMIC); 2133 status = usb_submit_urb(mos7840_port->read_urb, GFP_ATOMIC);
2123 if (status) { 2134 if (status) {
2124 dbg(" usb_submit_urb(read bulk) failed, status = %d", 2135 dbg("usb_submit_urb(read bulk) failed, status = %d",
2125 status); 2136 status);
2137 mos7840_port->read_urb_busy = false;
2126 } 2138 }
2127 } 2139 }
2128 return; 2140 return;
diff --git a/drivers/usb/serial/opticon.c b/drivers/usb/serial/opticon.c
new file mode 100644
index 000000000000..cea326f1f105
--- /dev/null
+++ b/drivers/usb/serial/opticon.c
@@ -0,0 +1,358 @@
1/*
2 * Opticon USB barcode to serial driver
3 *
4 * Copyright (C) 2008 Greg Kroah-Hartman <gregkh@suse.de>
5 * Copyright (C) 2008 Novell Inc.
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License version
9 * 2 as published by the Free Software Foundation.
10 */
11
12#include <linux/kernel.h>
13#include <linux/init.h>
14#include <linux/tty.h>
15#include <linux/tty_driver.h>
16#include <linux/tty_flip.h>
17#include <linux/module.h>
18#include <linux/usb.h>
19#include <linux/usb/serial.h>
20#include <linux/uaccess.h>
21
22static int debug;
23
24static struct usb_device_id id_table[] = {
25 { USB_DEVICE(0x065a, 0x0009) },
26 { },
27};
28MODULE_DEVICE_TABLE(usb, id_table);
29
30/* This structure holds all of the individual device information */
31struct opticon_private {
32 struct usb_device *udev;
33 struct usb_serial *serial;
34 struct usb_serial_port *port;
35 unsigned char *bulk_in_buffer;
36 struct urb *bulk_read_urb;
37 int buffer_size;
38 u8 bulk_address;
39 spinlock_t lock; /* protects the following flags */
40 bool throttled;
41 bool actually_throttled;
42 bool rts;
43};
44
45static void opticon_bulk_callback(struct urb *urb)
46{
47 struct opticon_private *priv = urb->context;
48 unsigned char *data = urb->transfer_buffer;
49 struct usb_serial_port *port = priv->port;
50 int status = urb->status;
51 struct tty_struct *tty;
52 int result;
53 int available_room = 0;
54 int data_length;
55
56 dbg("%s - port %d", __func__, port->number);
57
58 switch (status) {
59 case 0:
60 /* success */
61 break;
62 case -ECONNRESET:
63 case -ENOENT:
64 case -ESHUTDOWN:
65 /* this urb is terminated, clean up */
66 dbg("%s - urb shutting down with status: %d",
67 __func__, status);
68 return;
69 default:
70 dbg("%s - nonzero urb status received: %d",
71 __func__, status);
72 goto exit;
73 }
74
75 usb_serial_debug_data(debug, &port->dev, __func__, urb->actual_length,
76 data);
77
78 if (urb->actual_length > 2) {
79 data_length = urb->actual_length - 2;
80
81 /*
82 * Data from the device comes with a 2 byte header:
83 *
84 * <0x00><0x00>data...
85 * This is real data to be sent to the tty layer
86 * <0x00><0x01)level
87 * This is a RTS level change, the third byte is the RTS
88 * value (0 for low, 1 for high).
89 */
90 if ((data[0] == 0x00) && (data[1] == 0x00)) {
91 /* real data, send it to the tty layer */
92 tty = tty_port_tty_get(&port->port);
93 if (tty) {
94 available_room = tty_buffer_request_room(tty,
95 data_length);
96 if (available_room) {
97 tty_insert_flip_string(tty, data,
98 available_room);
99 tty_flip_buffer_push(tty);
100 }
101 tty_kref_put(tty);
102 }
103 } else {
104 if ((data[0] == 0x00) && (data[1] == 0x01)) {
105 if (data[2] == 0x00)
106 priv->rts = false;
107 else
108 priv->rts = true;
109 /* FIXME change the RTS level */
110 } else {
111 dev_dbg(&priv->udev->dev,
112 "Unknown data packet received from the device:"
113 " %2x %2x\n",
114 data[0], data[1]);
115 }
116 }
117 } else {
118 dev_dbg(&priv->udev->dev,
119 "Improper ammount of data received from the device, "
120 "%d bytes", urb->actual_length);
121 }
122
123exit:
124 spin_lock(&priv->lock);
125
126 /* Continue trying to always read if we should */
127 if (!priv->throttled) {
128 usb_fill_bulk_urb(priv->bulk_read_urb, priv->udev,
129 usb_rcvbulkpipe(priv->udev,
130 priv->bulk_address),
131 priv->bulk_in_buffer, priv->buffer_size,
132 opticon_bulk_callback, priv);
133 result = usb_submit_urb(port->read_urb, GFP_ATOMIC);
134 if (result)
135 dev_err(&port->dev,
136 "%s - failed resubmitting read urb, error %d\n",
137 __func__, result);
138 } else
139 priv->actually_throttled = true;
140 spin_unlock(&priv->lock);
141}
142
143static int opticon_open(struct tty_struct *tty, struct usb_serial_port *port,
144 struct file *filp)
145{
146 struct opticon_private *priv = usb_get_serial_data(port->serial);
147 unsigned long flags;
148 int result = 0;
149
150 dbg("%s - port %d", __func__, port->number);
151
152 spin_lock_irqsave(&priv->lock, flags);
153 priv->throttled = false;
154 priv->actually_throttled = false;
155 priv->port = port;
156 spin_unlock_irqrestore(&priv->lock, flags);
157
158 /*
159 * Force low_latency on so that our tty_push actually forces the data
160 * through, otherwise it is scheduled, and with high data rates (like
161 * with OHCI) data can get lost.
162 */
163 if (tty)
164 tty->low_latency = 1;
165
166 /* Start reading from the device */
167 usb_fill_bulk_urb(priv->bulk_read_urb, priv->udev,
168 usb_rcvbulkpipe(priv->udev,
169 priv->bulk_address),
170 priv->bulk_in_buffer, priv->buffer_size,
171 opticon_bulk_callback, priv);
172 result = usb_submit_urb(priv->bulk_read_urb, GFP_KERNEL);
173 if (result)
174 dev_err(&port->dev,
175 "%s - failed resubmitting read urb, error %d\n",
176 __func__, result);
177 return result;
178}
179
180static void opticon_close(struct tty_struct *tty, struct usb_serial_port *port,
181 struct file *filp)
182{
183 struct opticon_private *priv = usb_get_serial_data(port->serial);
184
185 dbg("%s - port %d", __func__, port->number);
186
187 /* shutdown our urbs */
188 usb_kill_urb(priv->bulk_read_urb);
189}
190
191static void opticon_throttle(struct tty_struct *tty)
192{
193 struct usb_serial_port *port = tty->driver_data;
194 struct opticon_private *priv = usb_get_serial_data(port->serial);
195 unsigned long flags;
196
197 dbg("%s - port %d", __func__, port->number);
198 spin_lock_irqsave(&priv->lock, flags);
199 priv->throttled = true;
200 spin_unlock_irqrestore(&priv->lock, flags);
201}
202
203
204static void opticon_unthrottle(struct tty_struct *tty)
205{
206 struct usb_serial_port *port = tty->driver_data;
207 struct opticon_private *priv = usb_get_serial_data(port->serial);
208 unsigned long flags;
209 int result;
210
211 dbg("%s - port %d", __func__, port->number);
212
213 spin_lock_irqsave(&priv->lock, flags);
214 priv->throttled = false;
215 priv->actually_throttled = false;
216 spin_unlock_irqrestore(&priv->lock, flags);
217
218 priv->bulk_read_urb->dev = port->serial->dev;
219 result = usb_submit_urb(priv->bulk_read_urb, GFP_ATOMIC);
220 if (result)
221 dev_err(&port->dev,
222 "%s - failed submitting read urb, error %d\n",
223 __func__, result);
224}
225
226static int opticon_startup(struct usb_serial *serial)
227{
228 struct opticon_private *priv;
229 struct usb_host_interface *intf;
230 int i;
231 int retval = -ENOMEM;
232 bool bulk_in_found = false;
233
234 /* create our private serial structure */
235 priv = kzalloc(sizeof(*priv), GFP_KERNEL);
236 if (priv == NULL) {
237 dev_err(&serial->dev->dev, "%s - Out of memory\n", __func__);
238 return -ENOMEM;
239 }
240 spin_lock_init(&priv->lock);
241 priv->serial = serial;
242 priv->port = serial->port[0];
243 priv->udev = serial->dev;
244
245 /* find our bulk endpoint */
246 intf = serial->interface->altsetting;
247 for (i = 0; i < intf->desc.bNumEndpoints; ++i) {
248 struct usb_endpoint_descriptor *endpoint;
249
250 endpoint = &intf->endpoint[i].desc;
251 if (!usb_endpoint_is_bulk_in(endpoint))
252 continue;
253
254 priv->bulk_read_urb = usb_alloc_urb(0, GFP_KERNEL);
255 if (!priv->bulk_read_urb) {
256 dev_err(&priv->udev->dev, "out of memory\n");
257 goto error;
258 }
259
260 priv->buffer_size = le16_to_cpu(endpoint->wMaxPacketSize) * 2;
261 priv->bulk_in_buffer = kmalloc(priv->buffer_size, GFP_KERNEL);
262 if (!priv->bulk_in_buffer) {
263 dev_err(&priv->udev->dev, "out of memory\n");
264 goto error;
265 }
266
267 priv->bulk_address = endpoint->bEndpointAddress;
268
269 /* set up our bulk urb */
270 usb_fill_bulk_urb(priv->bulk_read_urb, priv->udev,
271 usb_rcvbulkpipe(priv->udev,
272 endpoint->bEndpointAddress),
273 priv->bulk_in_buffer, priv->buffer_size,
274 opticon_bulk_callback, priv);
275
276 bulk_in_found = true;
277 break;
278 }
279
280 if (!bulk_in_found) {
281 dev_err(&priv->udev->dev,
282 "Error - the proper endpoints were not found!\n");
283 goto error;
284 }
285
286 usb_set_serial_data(serial, priv);
287 return 0;
288
289error:
290 usb_free_urb(priv->bulk_read_urb);
291 kfree(priv->bulk_in_buffer);
292 kfree(priv);
293 return retval;
294}
295
296static void opticon_shutdown(struct usb_serial *serial)
297{
298 struct opticon_private *priv = usb_get_serial_data(serial);
299
300 dbg("%s", __func__);
301
302 usb_kill_urb(priv->bulk_read_urb);
303 usb_free_urb(priv->bulk_read_urb);
304 kfree(priv->bulk_in_buffer);
305 kfree(priv);
306 usb_set_serial_data(serial, NULL);
307}
308
309
310static struct usb_driver opticon_driver = {
311 .name = "opticon",
312 .probe = usb_serial_probe,
313 .disconnect = usb_serial_disconnect,
314 .id_table = id_table,
315 .no_dynamic_id = 1,
316};
317
318static struct usb_serial_driver opticon_device = {
319 .driver = {
320 .owner = THIS_MODULE,
321 .name = "opticon",
322 },
323 .id_table = id_table,
324 .usb_driver = &opticon_driver,
325 .num_ports = 1,
326 .attach = opticon_startup,
327 .open = opticon_open,
328 .close = opticon_close,
329 .shutdown = opticon_shutdown,
330 .throttle = opticon_throttle,
331 .unthrottle = opticon_unthrottle,
332};
333
334static int __init opticon_init(void)
335{
336 int retval;
337
338 retval = usb_serial_register(&opticon_device);
339 if (retval)
340 return retval;
341 retval = usb_register(&opticon_driver);
342 if (retval)
343 usb_serial_deregister(&opticon_device);
344 return retval;
345}
346
347static void __exit opticon_exit(void)
348{
349 usb_deregister(&opticon_driver);
350 usb_serial_deregister(&opticon_device);
351}
352
353module_init(opticon_init);
354module_exit(opticon_exit);
355MODULE_LICENSE("GPL");
356
357module_param(debug, bool, S_IRUGO | S_IWUSR);
358MODULE_PARM_DESC(debug, "Debug enabled or not");
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
index 809697b3c7fc..5ed183477aaf 100644
--- a/drivers/usb/serial/option.c
+++ b/drivers/usb/serial/option.c
@@ -522,9 +522,9 @@ static int debug;
522/* per port private data */ 522/* per port private data */
523 523
524#define N_IN_URB 4 524#define N_IN_URB 4
525#define N_OUT_URB 1 525#define N_OUT_URB 4
526#define IN_BUFLEN 4096 526#define IN_BUFLEN 4096
527#define OUT_BUFLEN 128 527#define OUT_BUFLEN 4096
528 528
529struct option_port_private { 529struct option_port_private {
530 /* Input endpoints and buffer for this port */ 530 /* Input endpoints and buffer for this port */
@@ -654,10 +654,6 @@ static int option_write(struct tty_struct *tty, struct usb_serial_port *port,
654 usb_unlink_urb(this_urb); 654 usb_unlink_urb(this_urb);
655 continue; 655 continue;
656 } 656 }
657 if (this_urb->status != 0)
658 dbg("usb_write %p failed (err=%d)",
659 this_urb, this_urb->status);
660
661 dbg("%s: endpoint %d buf %d", __func__, 657 dbg("%s: endpoint %d buf %d", __func__,
662 usb_pipeendpoint(this_urb->pipe), i); 658 usb_pipeendpoint(this_urb->pipe), i);
663 659
@@ -669,8 +665,7 @@ static int option_write(struct tty_struct *tty, struct usb_serial_port *port,
669 err = usb_submit_urb(this_urb, GFP_ATOMIC); 665 err = usb_submit_urb(this_urb, GFP_ATOMIC);
670 if (err) { 666 if (err) {
671 dbg("usb_submit_urb %p (write bulk) failed " 667 dbg("usb_submit_urb %p (write bulk) failed "
672 "(%d, has %d)", this_urb, 668 "(%d)", this_urb, err);
673 err, this_urb->status);
674 clear_bit(i, &portdata->out_busy); 669 clear_bit(i, &portdata->out_busy);
675 continue; 670 continue;
676 } 671 }
diff --git a/drivers/usb/serial/siemens_mpi.c b/drivers/usb/serial/siemens_mpi.c
new file mode 100644
index 000000000000..951ea0c6ba77
--- /dev/null
+++ b/drivers/usb/serial/siemens_mpi.c
@@ -0,0 +1,77 @@
1/*
2 * Siemens USB-MPI Serial USB driver
3 *
4 * Copyright (C) 2005 Thomas Hergenhahn <thomas.hergenhahn@suse.de>
5 * Copyright (C) 2005,2008 Greg Kroah-Hartman <gregkh@suse.de>
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License version
9 * 2 as published by the Free Software Foundation.
10 */
11
12#include <linux/kernel.h>
13#include <linux/init.h>
14#include <linux/tty.h>
15#include <linux/module.h>
16#include <linux/usb.h>
17#include <linux/usb/serial.h>
18
19/* Version Information */
20#define DRIVER_VERSION "Version 0.1 09/26/2005"
21#define DRIVER_AUTHOR "Thomas Hergenhahn@web.de http://libnodave.sf.net"
22#define DRIVER_DESC "Driver for Siemens USB/MPI adapter"
23
24
25static struct usb_device_id id_table[] = {
26 /* Vendor and product id for 6ES7-972-0CB20-0XA0 */
27 { USB_DEVICE(0x908, 0x0004) },
28 { },
29};
30MODULE_DEVICE_TABLE(usb, id_table);
31
32static struct usb_driver siemens_usb_mpi_driver = {
33 .name = "siemens_mpi",
34 .probe = usb_serial_probe,
35 .disconnect = usb_serial_disconnect,
36 .id_table = id_table,
37};
38
39static struct usb_serial_driver siemens_usb_mpi_device = {
40 .driver = {
41 .owner = THIS_MODULE,
42 .name = "siemens_mpi",
43 },
44 .id_table = id_table,
45 .num_ports = 1,
46};
47
48static int __init siemens_usb_mpi_init(void)
49{
50 int retval;
51
52 retval = usb_serial_register(&siemens_usb_mpi_device);
53 if (retval)
54 goto failed_usb_serial_register;
55 retval = usb_register(&siemens_usb_mpi_driver);
56 if (retval)
57 goto failed_usb_register;
58 printk(KERN_INFO DRIVER_DESC "\n");
59 printk(KERN_INFO DRIVER_VERSION " " DRIVER_AUTHOR "\n");
60 return retval;
61failed_usb_register:
62 usb_serial_deregister(&siemens_usb_mpi_device);
63failed_usb_serial_register:
64 return retval;
65}
66
67static void __exit siemens_usb_mpi_exit(void)
68{
69 usb_deregister(&siemens_usb_mpi_driver);
70 usb_serial_deregister(&siemens_usb_mpi_device);
71}
72
73module_init(siemens_usb_mpi_init);
74module_exit(siemens_usb_mpi_exit);
75MODULE_AUTHOR(DRIVER_AUTHOR);
76MODULE_DESCRIPTION(DRIVER_DESC);
77MODULE_LICENSE("GPL");
diff --git a/drivers/usb/serial/spcp8x5.c b/drivers/usb/serial/spcp8x5.c
index a65bc2bd8e71..5e7528cc81a8 100644
--- a/drivers/usb/serial/spcp8x5.c
+++ b/drivers/usb/serial/spcp8x5.c
@@ -709,21 +709,20 @@ static void spcp8x5_read_bulk_callback(struct urb *urb)
709 unsigned char *data = urb->transfer_buffer; 709 unsigned char *data = urb->transfer_buffer;
710 unsigned long flags; 710 unsigned long flags;
711 int i; 711 int i;
712 int result; 712 int result = urb->status;
713 u8 status = 0; 713 u8 status;
714 char tty_flag; 714 char tty_flag;
715 715
716 dev_dbg(&port->dev, "start, urb->status = %d, " 716 dev_dbg(&port->dev, "start, result = %d, urb->actual_length = %d\n,",
717 "urb->actual_length = %d\n,", urb->status, urb->actual_length); 717 result, urb->actual_length);
718 718
719 /* check the urb status */ 719 /* check the urb status */
720 if (urb->status) { 720 if (result) {
721 if (!port->port.count) 721 if (!port->port.count)
722 return; 722 return;
723 if (urb->status == -EPROTO) { 723 if (result == -EPROTO) {
724 /* spcp8x5 mysteriously fails with -EPROTO */ 724 /* spcp8x5 mysteriously fails with -EPROTO */
725 /* reschedule the read */ 725 /* reschedule the read */
726 urb->status = 0;
727 urb->dev = port->serial->dev; 726 urb->dev = port->serial->dev;
728 result = usb_submit_urb(urb , GFP_ATOMIC); 727 result = usb_submit_urb(urb , GFP_ATOMIC);
729 if (result) 728 if (result)
@@ -833,8 +832,9 @@ static void spcp8x5_write_bulk_callback(struct urb *urb)
833 struct usb_serial_port *port = urb->context; 832 struct usb_serial_port *port = urb->context;
834 struct spcp8x5_private *priv = usb_get_serial_port_data(port); 833 struct spcp8x5_private *priv = usb_get_serial_port_data(port);
835 int result; 834 int result;
835 int status = urb->status;
836 836
837 switch (urb->status) { 837 switch (status) {
838 case 0: 838 case 0:
839 /* success */ 839 /* success */
840 break; 840 break;
@@ -843,14 +843,14 @@ static void spcp8x5_write_bulk_callback(struct urb *urb)
843 case -ESHUTDOWN: 843 case -ESHUTDOWN:
844 /* this urb is terminated, clean up */ 844 /* this urb is terminated, clean up */
845 dev_dbg(&port->dev, "urb shutting down with status: %d\n", 845 dev_dbg(&port->dev, "urb shutting down with status: %d\n",
846 urb->status); 846 status);
847 priv->write_urb_in_use = 0; 847 priv->write_urb_in_use = 0;
848 return; 848 return;
849 default: 849 default:
850 /* error in the urb, so we have to resubmit it */ 850 /* error in the urb, so we have to resubmit it */
851 dbg("%s - Overflow in write", __func__); 851 dbg("%s - Overflow in write", __func__);
852 dbg("%s - nonzero write bulk status received: %d", 852 dbg("%s - nonzero write bulk status received: %d",
853 __func__, urb->status); 853 __func__, status);
854 port->write_urb->transfer_buffer_length = 1; 854 port->write_urb->transfer_buffer_length = 1;
855 port->write_urb->dev = port->serial->dev; 855 port->write_urb->dev = port->serial->dev;
856 result = usb_submit_urb(port->write_urb, GFP_ATOMIC); 856 result = usb_submit_urb(port->write_urb, GFP_ATOMIC);
diff --git a/drivers/usb/serial/usb_debug.c b/drivers/usb/serial/usb_debug.c
index fc5d9952b03b..6c9cbb59552a 100644
--- a/drivers/usb/serial/usb_debug.c
+++ b/drivers/usb/serial/usb_debug.c
@@ -31,7 +31,7 @@ static struct usb_driver debug_driver = {
31 .no_dynamic_id = 1, 31 .no_dynamic_id = 1,
32}; 32};
33 33
34int usb_debug_open(struct tty_struct *tty, struct usb_serial_port *port, 34static int usb_debug_open(struct tty_struct *tty, struct usb_serial_port *port,
35 struct file *filp) 35 struct file *filp)
36{ 36{
37 port->bulk_out_size = USB_DEBUG_MAX_PACKET_SIZE; 37 port->bulk_out_size = USB_DEBUG_MAX_PACKET_SIZE;
diff --git a/drivers/usb/storage/Kconfig b/drivers/usb/storage/Kconfig
index c68b738900bd..9df6887b91f6 100644
--- a/drivers/usb/storage/Kconfig
+++ b/drivers/usb/storage/Kconfig
@@ -61,13 +61,6 @@ config USB_STORAGE_ISD200
61 - CyQ've CQ8060A CDRW drive 61 - CyQ've CQ8060A CDRW drive
62 - Planex eXtreme Drive RX-25HU USB-IDE cable (not model RX-25U) 62 - Planex eXtreme Drive RX-25HU USB-IDE cable (not model RX-25U)
63 63
64config USB_STORAGE_DPCM
65 bool "Microtech/ZiO! CompactFlash/SmartMedia support"
66 depends on USB_STORAGE
67 help
68 Say Y here to support the Microtech/ZiO! CompactFlash reader.
69 There is a web page at <http://www.ziocorp.com/products/>.
70
71config USB_STORAGE_USBAT 64config USB_STORAGE_USBAT
72 bool "USBAT/USBAT02-based storage support" 65 bool "USBAT/USBAT02-based storage support"
73 depends on USB_STORAGE 66 depends on USB_STORAGE
@@ -90,12 +83,12 @@ config USB_STORAGE_USBAT
90 - Sandisk ImageMate SDDR-05b 83 - Sandisk ImageMate SDDR-05b
91 84
92config USB_STORAGE_SDDR09 85config USB_STORAGE_SDDR09
93 bool "SanDisk SDDR-09 (and other SmartMedia) support" 86 bool "SanDisk SDDR-09 (and other SmartMedia, including DPCM) support"
94 depends on USB_STORAGE 87 depends on USB_STORAGE
95 help 88 help
96 Say Y here to include additional code to support the Sandisk SDDR-09 89 Say Y here to include additional code to support the Sandisk SDDR-09
97 SmartMedia reader in the USB Mass Storage driver. 90 SmartMedia reader in the USB Mass Storage driver.
98 Also works for the Microtech Zio! SmartMedia reader. 91 Also works for the Microtech Zio! CompactFlash/SmartMedia reader.
99 92
100config USB_STORAGE_SDDR55 93config USB_STORAGE_SDDR55
101 bool "SanDisk SDDR-55 SmartMedia support" 94 bool "SanDisk SDDR-55 SmartMedia support"
diff --git a/drivers/usb/storage/Makefile b/drivers/usb/storage/Makefile
index 7f8beb5366ae..b32069313390 100644
--- a/drivers/usb/storage/Makefile
+++ b/drivers/usb/storage/Makefile
@@ -14,7 +14,6 @@ usb-storage-obj-$(CONFIG_USB_STORAGE_USBAT) += shuttle_usbat.o
14usb-storage-obj-$(CONFIG_USB_STORAGE_SDDR09) += sddr09.o 14usb-storage-obj-$(CONFIG_USB_STORAGE_SDDR09) += sddr09.o
15usb-storage-obj-$(CONFIG_USB_STORAGE_SDDR55) += sddr55.o 15usb-storage-obj-$(CONFIG_USB_STORAGE_SDDR55) += sddr55.o
16usb-storage-obj-$(CONFIG_USB_STORAGE_FREECOM) += freecom.o 16usb-storage-obj-$(CONFIG_USB_STORAGE_FREECOM) += freecom.o
17usb-storage-obj-$(CONFIG_USB_STORAGE_DPCM) += dpcm.o
18usb-storage-obj-$(CONFIG_USB_STORAGE_ISD200) += isd200.o 17usb-storage-obj-$(CONFIG_USB_STORAGE_ISD200) += isd200.o
19usb-storage-obj-$(CONFIG_USB_STORAGE_DATAFAB) += datafab.o 18usb-storage-obj-$(CONFIG_USB_STORAGE_DATAFAB) += datafab.o
20usb-storage-obj-$(CONFIG_USB_STORAGE_JUMPSHOT) += jumpshot.o 19usb-storage-obj-$(CONFIG_USB_STORAGE_JUMPSHOT) += jumpshot.o
@@ -24,7 +23,7 @@ usb-storage-obj-$(CONFIG_USB_STORAGE_KARMA) += karma.o
24usb-storage-obj-$(CONFIG_USB_STORAGE_CYPRESS_ATACB) += cypress_atacb.o 23usb-storage-obj-$(CONFIG_USB_STORAGE_CYPRESS_ATACB) += cypress_atacb.o
25 24
26usb-storage-objs := scsiglue.o protocol.o transport.o usb.o \ 25usb-storage-objs := scsiglue.o protocol.o transport.o usb.o \
27 initializers.o sierra_ms.o $(usb-storage-obj-y) 26 initializers.o sierra_ms.o option_ms.o $(usb-storage-obj-y)
28 27
29ifneq ($(CONFIG_USB_LIBUSUAL),) 28ifneq ($(CONFIG_USB_LIBUSUAL),)
30 obj-$(CONFIG_USB) += libusual.o 29 obj-$(CONFIG_USB) += libusual.o
diff --git a/drivers/usb/storage/dpcm.c b/drivers/usb/storage/dpcm.c
deleted file mode 100644
index 939923471af4..000000000000
--- a/drivers/usb/storage/dpcm.c
+++ /dev/null
@@ -1,86 +0,0 @@
1/* Driver for Microtech DPCM-USB CompactFlash/SmartMedia reader
2 *
3 * DPCM driver v0.1:
4 *
5 * First release
6 *
7 * Current development and maintenance by:
8 * (c) 2000 Brian Webb (webbb@earthlink.net)
9 *
10 * This device contains both a CompactFlash card reader, which
11 * uses the Control/Bulk w/o Interrupt protocol and
12 * a SmartMedia card reader that uses the same protocol
13 * as the SDDR09.
14 *
15 * This program is free software; you can redistribute it and/or modify it
16 * under the terms of the GNU General Public License as published by the
17 * Free Software Foundation; either version 2, or (at your option) any
18 * later version.
19 *
20 * This program is distributed in the hope that it will be useful, but
21 * WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
23 * General Public License for more details.
24 *
25 * You should have received a copy of the GNU General Public License along
26 * with this program; if not, write to the Free Software Foundation, Inc.,
27 * 675 Mass Ave, Cambridge, MA 02139, USA.
28 */
29
30#include <scsi/scsi.h>
31#include <scsi/scsi_cmnd.h>
32#include <scsi/scsi_device.h>
33
34#include "usb.h"
35#include "transport.h"
36#include "protocol.h"
37#include "debug.h"
38#include "dpcm.h"
39#include "sddr09.h"
40
41/*
42 * Transport for the Microtech DPCM-USB
43 *
44 */
45int dpcm_transport(struct scsi_cmnd *srb, struct us_data *us)
46{
47 int ret;
48
49 if (srb == NULL)
50 return USB_STOR_TRANSPORT_ERROR;
51
52 US_DEBUGP("dpcm_transport: LUN=%d\n", srb->device->lun);
53
54 switch (srb->device->lun) {
55 case 0:
56
57 /*
58 * LUN 0 corresponds to the CompactFlash card reader.
59 */
60 ret = usb_stor_CB_transport(srb, us);
61 break;
62
63#ifdef CONFIG_USB_STORAGE_SDDR09
64 case 1:
65
66 /*
67 * LUN 1 corresponds to the SmartMedia card reader.
68 */
69
70 /*
71 * Set the LUN to 0 (just in case).
72 */
73 srb->device->lun = 0; us->srb->device->lun = 0;
74 ret = sddr09_transport(srb, us);
75 srb->device->lun = 1; us->srb->device->lun = 1;
76 break;
77
78#endif
79
80 default:
81 US_DEBUGP("dpcm_transport: Invalid LUN %d\n", srb->device->lun);
82 ret = USB_STOR_TRANSPORT_ERROR;
83 break;
84 }
85 return ret;
86}
diff --git a/drivers/usb/storage/dpcm.h b/drivers/usb/storage/dpcm.h
deleted file mode 100644
index e7b7b0f120d7..000000000000
--- a/drivers/usb/storage/dpcm.h
+++ /dev/null
@@ -1,32 +0,0 @@
1/* Driver for Microtech DPCM-USB CompactFlash/SmartMedia reader
2 *
3 * DPCM driver v0.1:
4 *
5 * First release
6 *
7 * Current development and maintenance by:
8 * (c) 2000 Brian Webb (webbb@earthlink.net)
9 *
10 * See dpcm.c for more explanation
11 *
12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by the
14 * Free Software Foundation; either version 2, or (at your option) any
15 * later version.
16 *
17 * This program is distributed in the hope that it will be useful, but
18 * WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License along
23 * with this program; if not, write to the Free Software Foundation, Inc.,
24 * 675 Mass Ave, Cambridge, MA 02139, USA.
25 */
26
27#ifndef _MICROTECH_DPCM_USB_H
28#define _MICROTECH_DPCM_USB_H
29
30extern int dpcm_transport(struct scsi_cmnd *srb, struct us_data *us);
31
32#endif
diff --git a/drivers/usb/storage/libusual.c b/drivers/usb/storage/libusual.c
index d617e8ae6b00..f970b27ba308 100644
--- a/drivers/usb/storage/libusual.c
+++ b/drivers/usb/storage/libusual.c
@@ -46,6 +46,12 @@ static int usu_probe_thread(void *arg);
46{ USB_DEVICE_VER(id_vendor, id_product, bcdDeviceMin,bcdDeviceMax), \ 46{ USB_DEVICE_VER(id_vendor, id_product, bcdDeviceMin,bcdDeviceMax), \
47 .driver_info = (flags)|(USB_US_TYPE_STOR<<24) } 47 .driver_info = (flags)|(USB_US_TYPE_STOR<<24) }
48 48
49#define COMPLIANT_DEV(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax, \
50 vendorName, productName, useProtocol, useTransport, \
51 initFunction, flags) \
52{ USB_DEVICE_VER(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax), \
53 .driver_info = (flags) }
54
49#define USUAL_DEV(useProto, useTrans, useType) \ 55#define USUAL_DEV(useProto, useTrans, useType) \
50{ USB_INTERFACE_INFO(USB_CLASS_MASS_STORAGE, useProto, useTrans), \ 56{ USB_INTERFACE_INFO(USB_CLASS_MASS_STORAGE, useProto, useTrans), \
51 .driver_info = ((useType)<<24) } 57 .driver_info = ((useType)<<24) }
@@ -57,6 +63,7 @@ struct usb_device_id storage_usb_ids [] = {
57 63
58#undef USUAL_DEV 64#undef USUAL_DEV
59#undef UNUSUAL_DEV 65#undef UNUSUAL_DEV
66#undef COMPLIANT_DEV
60 67
61MODULE_DEVICE_TABLE(usb, storage_usb_ids); 68MODULE_DEVICE_TABLE(usb, storage_usb_ids);
62EXPORT_SYMBOL_GPL(storage_usb_ids); 69EXPORT_SYMBOL_GPL(storage_usb_ids);
diff --git a/drivers/usb/storage/option_ms.c b/drivers/usb/storage/option_ms.c
new file mode 100644
index 000000000000..353f922939a4
--- /dev/null
+++ b/drivers/usb/storage/option_ms.c
@@ -0,0 +1,147 @@
1/*
2 * Driver for Option High Speed Mobile Devices.
3 *
4 * (c) 2008 Dan Williams <dcbw@redhat.com>
5 *
6 * Inspiration taken from sierra_ms.c by Kevin Lloyd <klloyd@sierrawireless.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License along
19 * with this program; if not, write to the Free Software Foundation, Inc.,
20 * 675 Mass Ave, Cambridge, MA 02139, USA.
21 */
22
23#include <linux/usb.h>
24
25#include "usb.h"
26#include "transport.h"
27#include "option_ms.h"
28#include "debug.h"
29
30#define ZCD_FORCE_MODEM 0x01
31#define ZCD_ALLOW_MS 0x02
32
33static unsigned int option_zero_cd = ZCD_FORCE_MODEM;
34module_param(option_zero_cd, uint, S_IRUGO | S_IWUSR);
35MODULE_PARM_DESC(option_zero_cd, "ZeroCD mode (1=Force Modem (default),"
36 " 2=Allow CD-Rom");
37
38#define RESPONSE_LEN 1024
39
40static int option_rezero(struct us_data *us, int ep_in, int ep_out)
41{
42 const unsigned char rezero_msg[] = {
43 0x55, 0x53, 0x42, 0x43, 0x78, 0x56, 0x34, 0x12,
44 0x01, 0x00, 0x00, 0x00, 0x80, 0x00, 0x06, 0x01,
45 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
46 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
47 };
48 char *buffer;
49 int result;
50
51 US_DEBUGP("Option MS: %s", "DEVICE MODE SWITCH\n");
52
53 buffer = kzalloc(RESPONSE_LEN, GFP_KERNEL);
54 if (buffer == NULL)
55 return USB_STOR_TRANSPORT_ERROR;
56
57 memcpy(buffer, rezero_msg, sizeof (rezero_msg));
58 result = usb_stor_bulk_transfer_buf(us,
59 usb_sndbulkpipe(us->pusb_dev, ep_out),
60 buffer, sizeof (rezero_msg), NULL);
61 if (result != USB_STOR_XFER_GOOD) {
62 result = USB_STOR_XFER_ERROR;
63 goto out;
64 }
65
66 /* Some of the devices need to be asked for a response, but we don't
67 * care what that response is.
68 */
69 result = usb_stor_bulk_transfer_buf(us,
70 usb_sndbulkpipe(us->pusb_dev, ep_out),
71 buffer, RESPONSE_LEN, NULL);
72 result = USB_STOR_XFER_GOOD;
73
74out:
75 kfree(buffer);
76 return result;
77}
78
79int option_ms_init(struct us_data *us)
80{
81 struct usb_device *udev;
82 struct usb_interface *intf;
83 struct usb_host_interface *iface_desc;
84 struct usb_endpoint_descriptor *endpoint = NULL;
85 u8 ep_in = 0, ep_out = 0;
86 int ep_in_size = 0, ep_out_size = 0;
87 int i, result;
88
89 udev = us->pusb_dev;
90 intf = us->pusb_intf;
91
92 /* Ensure it's really a ZeroCD device; devices that are already
93 * in modem mode return 0xFF for class, subclass, and protocol.
94 */
95 if (udev->descriptor.bDeviceClass != 0 ||
96 udev->descriptor.bDeviceSubClass != 0 ||
97 udev->descriptor.bDeviceProtocol != 0)
98 return USB_STOR_TRANSPORT_GOOD;
99
100 US_DEBUGP("Option MS: option_ms_init called\n");
101
102 /* Find the right mass storage interface */
103 iface_desc = intf->cur_altsetting;
104 if (iface_desc->desc.bInterfaceClass != 0x8 ||
105 iface_desc->desc.bInterfaceSubClass != 0x6 ||
106 iface_desc->desc.bInterfaceProtocol != 0x50) {
107 US_DEBUGP("Option MS: mass storage interface not found, no action "
108 "required\n");
109 return USB_STOR_TRANSPORT_GOOD;
110 }
111
112 /* Find the mass storage bulk endpoints */
113 for (i = 0; i < iface_desc->desc.bNumEndpoints && (!ep_in_size || !ep_out_size); ++i) {
114 endpoint = &iface_desc->endpoint[i].desc;
115
116 if (usb_endpoint_is_bulk_in(endpoint)) {
117 ep_in = usb_endpoint_num(endpoint);
118 ep_in_size = le16_to_cpu(endpoint->wMaxPacketSize);
119 } else if (usb_endpoint_is_bulk_out(endpoint)) {
120 ep_out = usb_endpoint_num(endpoint);
121 ep_out_size = le16_to_cpu(endpoint->wMaxPacketSize);
122 }
123 }
124
125 /* Can't find the mass storage endpoints */
126 if (!ep_in_size || !ep_out_size) {
127 US_DEBUGP("Option MS: mass storage endpoints not found, no action "
128 "required\n");
129 return USB_STOR_TRANSPORT_GOOD;
130 }
131
132 /* Force Modem mode */
133 if (option_zero_cd == ZCD_FORCE_MODEM) {
134 US_DEBUGP("Option MS: %s", "Forcing Modem Mode\n");
135 result = option_rezero(us, ep_in, ep_out);
136 if (result != USB_STOR_XFER_GOOD)
137 US_DEBUGP("Option MS: Failed to switch to modem mode.\n");
138 return -EIO;
139 } else if (option_zero_cd == ZCD_ALLOW_MS) {
140 /* Allow Mass Storage mode (keep CD-Rom) */
141 US_DEBUGP("Option MS: %s", "Allowing Mass Storage Mode if device"
142 " requests it\n");
143 }
144
145 return USB_STOR_TRANSPORT_GOOD;
146}
147
diff --git a/drivers/usb/storage/option_ms.h b/drivers/usb/storage/option_ms.h
new file mode 100644
index 000000000000..b6e448cab039
--- /dev/null
+++ b/drivers/usb/storage/option_ms.h
@@ -0,0 +1,4 @@
1#ifndef _OPTION_MS_H_
2#define _OPTION_MS_H_
3extern int option_ms_init(struct us_data *us);
4#endif
diff --git a/drivers/usb/storage/protocol.c b/drivers/usb/storage/protocol.c
index 3b3357e20ea7..be441d84bc64 100644
--- a/drivers/usb/storage/protocol.c
+++ b/drivers/usb/storage/protocol.c
@@ -56,9 +56,9 @@
56 * Protocol routines 56 * Protocol routines
57 ***********************************************************************/ 57 ***********************************************************************/
58 58
59void usb_stor_qic157_command(struct scsi_cmnd *srb, struct us_data *us) 59void usb_stor_pad12_command(struct scsi_cmnd *srb, struct us_data *us)
60{ 60{
61 /* Pad the ATAPI command with zeros 61 /* Pad the SCSI command with zeros out to 12 bytes
62 * 62 *
63 * NOTE: This only works because a scsi_cmnd struct field contains 63 * NOTE: This only works because a scsi_cmnd struct field contains
64 * a unsigned char cmnd[16], so we know we have storage available 64 * a unsigned char cmnd[16], so we know we have storage available
@@ -73,26 +73,6 @@ void usb_stor_qic157_command(struct scsi_cmnd *srb, struct us_data *us)
73 usb_stor_invoke_transport(srb, us); 73 usb_stor_invoke_transport(srb, us);
74} 74}
75 75
76void usb_stor_ATAPI_command(struct scsi_cmnd *srb, struct us_data *us)
77{
78 /* Pad the ATAPI command with zeros
79 *
80 * NOTE: This only works because a scsi_cmnd struct field contains
81 * a unsigned char cmnd[16], so we know we have storage available
82 */
83
84 /* Pad the ATAPI command with zeros */
85 for (; srb->cmd_len<12; srb->cmd_len++)
86 srb->cmnd[srb->cmd_len] = 0;
87
88 /* set command length to 12 bytes */
89 srb->cmd_len = 12;
90
91 /* send the command to the transport layer */
92 usb_stor_invoke_transport(srb, us);
93}
94
95
96void usb_stor_ufi_command(struct scsi_cmnd *srb, struct us_data *us) 76void usb_stor_ufi_command(struct scsi_cmnd *srb, struct us_data *us)
97{ 77{
98 /* fix some commands -- this is a form of mode translation 78 /* fix some commands -- this is a form of mode translation
diff --git a/drivers/usb/storage/protocol.h b/drivers/usb/storage/protocol.h
index 487056ffb516..ffc3e2af0156 100644
--- a/drivers/usb/storage/protocol.h
+++ b/drivers/usb/storage/protocol.h
@@ -40,8 +40,7 @@
40#define _PROTOCOL_H_ 40#define _PROTOCOL_H_
41 41
42/* Protocol handling routines */ 42/* Protocol handling routines */
43extern void usb_stor_ATAPI_command(struct scsi_cmnd*, struct us_data*); 43extern void usb_stor_pad12_command(struct scsi_cmnd*, struct us_data*);
44extern void usb_stor_qic157_command(struct scsi_cmnd*, struct us_data*);
45extern void usb_stor_ufi_command(struct scsi_cmnd*, struct us_data*); 44extern void usb_stor_ufi_command(struct scsi_cmnd*, struct us_data*);
46extern void usb_stor_transparent_scsi_command(struct scsi_cmnd*, 45extern void usb_stor_transparent_scsi_command(struct scsi_cmnd*,
47 struct us_data*); 46 struct us_data*);
diff --git a/drivers/usb/storage/scsiglue.c b/drivers/usb/storage/scsiglue.c
index 09779f6a8179..2a42b862aa9f 100644
--- a/drivers/usb/storage/scsiglue.c
+++ b/drivers/usb/storage/scsiglue.c
@@ -59,6 +59,13 @@
59#include "transport.h" 59#include "transport.h"
60#include "protocol.h" 60#include "protocol.h"
61 61
62/* Vendor IDs for companies that seem to include the READ CAPACITY bug
63 * in all their devices
64 */
65#define VENDOR_ID_NOKIA 0x0421
66#define VENDOR_ID_NIKON 0x04b0
67#define VENDOR_ID_MOTOROLA 0x22b8
68
62/*********************************************************************** 69/***********************************************************************
63 * Host functions 70 * Host functions
64 ***********************************************************************/ 71 ***********************************************************************/
@@ -129,11 +136,35 @@ static int slave_configure(struct scsi_device *sdev)
129 max_sectors); 136 max_sectors);
130 } 137 }
131 138
139 /* Some USB host controllers can't do DMA; they have to use PIO.
140 * They indicate this by setting their dma_mask to NULL. For
141 * such controllers we need to make sure the block layer sets
142 * up bounce buffers in addressable memory.
143 */
144 if (!us->pusb_dev->bus->controller->dma_mask)
145 blk_queue_bounce_limit(sdev->request_queue, BLK_BOUNCE_HIGH);
146
132 /* We can't put these settings in slave_alloc() because that gets 147 /* We can't put these settings in slave_alloc() because that gets
133 * called before the device type is known. Consequently these 148 * called before the device type is known. Consequently these
134 * settings can't be overridden via the scsi devinfo mechanism. */ 149 * settings can't be overridden via the scsi devinfo mechanism. */
135 if (sdev->type == TYPE_DISK) { 150 if (sdev->type == TYPE_DISK) {
136 151
152 /* Some vendors seem to put the READ CAPACITY bug into
153 * all their devices -- primarily makers of cell phones
154 * and digital cameras. Since these devices always use
155 * flash media and can be expected to have an even number
156 * of sectors, we will always enable the CAPACITY_HEURISTICS
157 * flag unless told otherwise. */
158 switch (le16_to_cpu(us->pusb_dev->descriptor.idVendor)) {
159 case VENDOR_ID_NOKIA:
160 case VENDOR_ID_NIKON:
161 case VENDOR_ID_MOTOROLA:
162 if (!(us->fflags & (US_FL_FIX_CAPACITY |
163 US_FL_CAPACITY_OK)))
164 us->fflags |= US_FL_CAPACITY_HEURISTICS;
165 break;
166 }
167
137 /* Disk-type devices use MODE SENSE(6) if the protocol 168 /* Disk-type devices use MODE SENSE(6) if the protocol
138 * (SubClass) is Transparent SCSI, otherwise they use 169 * (SubClass) is Transparent SCSI, otherwise they use
139 * MODE SENSE(10). */ 170 * MODE SENSE(10). */
@@ -170,6 +201,10 @@ static int slave_configure(struct scsi_device *sdev)
170 if (us->fflags & US_FL_CAPACITY_HEURISTICS) 201 if (us->fflags & US_FL_CAPACITY_HEURISTICS)
171 sdev->guess_capacity = 1; 202 sdev->guess_capacity = 1;
172 203
204 /* assume SPC3 or latter devices support sense size > 18 */
205 if (sdev->scsi_level > SCSI_SPC_2)
206 us->fflags |= US_FL_SANE_SENSE;
207
173 /* Some devices report a SCSI revision level above 2 but are 208 /* Some devices report a SCSI revision level above 2 but are
174 * unable to handle the REPORT LUNS command (for which 209 * unable to handle the REPORT LUNS command (for which
175 * support is mandatory at level 3). Since we already have 210 * support is mandatory at level 3). Since we already have
@@ -196,6 +231,14 @@ static int slave_configure(struct scsi_device *sdev)
196 * sector in a larger then 1 sector read, since the performance 231 * sector in a larger then 1 sector read, since the performance
197 * impact is negible we set this flag for all USB disks */ 232 * impact is negible we set this flag for all USB disks */
198 sdev->last_sector_bug = 1; 233 sdev->last_sector_bug = 1;
234
235 /* Enable last-sector hacks for single-target devices using
236 * the Bulk-only transport, unless we already know the
237 * capacity will be decremented or is correct. */
238 if (!(us->fflags & (US_FL_FIX_CAPACITY | US_FL_CAPACITY_OK |
239 US_FL_SCM_MULT_TARG)) &&
240 us->protocol == US_PR_BULK)
241 us->use_last_sector_hacks = 1;
199 } else { 242 } else {
200 243
201 /* Non-disk-type devices don't need to blacklist any pages 244 /* Non-disk-type devices don't need to blacklist any pages
diff --git a/drivers/usb/storage/sddr09.c b/drivers/usb/storage/sddr09.c
index c5a54b872c24..531ae5c5abf3 100644
--- a/drivers/usb/storage/sddr09.c
+++ b/drivers/usb/storage/sddr09.c
@@ -45,6 +45,7 @@
45 45
46#include <scsi/scsi.h> 46#include <scsi/scsi.h>
47#include <scsi/scsi_cmnd.h> 47#include <scsi/scsi_cmnd.h>
48#include <scsi/scsi_device.h>
48 49
49#include "usb.h" 50#include "usb.h"
50#include "transport.h" 51#include "transport.h"
@@ -1446,6 +1447,48 @@ usb_stor_sddr09_dpcm_init(struct us_data *us) {
1446} 1447}
1447 1448
1448/* 1449/*
1450 * Transport for the Microtech DPCM-USB
1451 */
1452int dpcm_transport(struct scsi_cmnd *srb, struct us_data *us)
1453{
1454 int ret;
1455
1456 US_DEBUGP("dpcm_transport: LUN=%d\n", srb->device->lun);
1457
1458 switch (srb->device->lun) {
1459 case 0:
1460
1461 /*
1462 * LUN 0 corresponds to the CompactFlash card reader.
1463 */
1464 ret = usb_stor_CB_transport(srb, us);
1465 break;
1466
1467 case 1:
1468
1469 /*
1470 * LUN 1 corresponds to the SmartMedia card reader.
1471 */
1472
1473 /*
1474 * Set the LUN to 0 (just in case).
1475 */
1476 srb->device->lun = 0;
1477 ret = sddr09_transport(srb, us);
1478 srb->device->lun = 1;
1479 break;
1480
1481 default:
1482 US_DEBUGP("dpcm_transport: Invalid LUN %d\n",
1483 srb->device->lun);
1484 ret = USB_STOR_TRANSPORT_ERROR;
1485 break;
1486 }
1487 return ret;
1488}
1489
1490
1491/*
1449 * Transport for the Sandisk SDDR-09 1492 * Transport for the Sandisk SDDR-09
1450 */ 1493 */
1451int sddr09_transport(struct scsi_cmnd *srb, struct us_data *us) 1494int sddr09_transport(struct scsi_cmnd *srb, struct us_data *us)
diff --git a/drivers/usb/storage/sddr09.h b/drivers/usb/storage/sddr09.h
index e50033ad7b19..b701172e12e3 100644
--- a/drivers/usb/storage/sddr09.h
+++ b/drivers/usb/storage/sddr09.h
@@ -28,8 +28,11 @@
28/* Sandisk SDDR-09 stuff */ 28/* Sandisk SDDR-09 stuff */
29 29
30extern int sddr09_transport(struct scsi_cmnd *srb, struct us_data *us); 30extern int sddr09_transport(struct scsi_cmnd *srb, struct us_data *us);
31extern int usb_stor_sddr09_init(struct us_data *us);
32
33/* Microtech DPCM-USB stuff */
31 34
35extern int dpcm_transport(struct scsi_cmnd *srb, struct us_data *us);
32extern int usb_stor_sddr09_dpcm_init(struct us_data *us); 36extern int usb_stor_sddr09_dpcm_init(struct us_data *us);
33extern int usb_stor_sddr09_init(struct us_data *us);
34 37
35#endif 38#endif
diff --git a/drivers/usb/storage/transport.c b/drivers/usb/storage/transport.c
index 79108d5d3171..1d5438e6363b 100644
--- a/drivers/usb/storage/transport.c
+++ b/drivers/usb/storage/transport.c
@@ -57,6 +57,9 @@
57#include "scsiglue.h" 57#include "scsiglue.h"
58#include "debug.h" 58#include "debug.h"
59 59
60#include <linux/blkdev.h>
61#include "../../scsi/sd.h"
62
60 63
61/*********************************************************************** 64/***********************************************************************
62 * Data transfer routines 65 * Data transfer routines
@@ -511,6 +514,110 @@ int usb_stor_bulk_transfer_sg(struct us_data* us, unsigned int pipe,
511 * Transport routines 514 * Transport routines
512 ***********************************************************************/ 515 ***********************************************************************/
513 516
517/* There are so many devices that report the capacity incorrectly,
518 * this routine was written to counteract some of the resulting
519 * problems.
520 */
521static void last_sector_hacks(struct us_data *us, struct scsi_cmnd *srb)
522{
523 struct gendisk *disk;
524 struct scsi_disk *sdkp;
525 u32 sector;
526
527 /* To Report "Medium Error: Record Not Found */
528 static unsigned char record_not_found[18] = {
529 [0] = 0x70, /* current error */
530 [2] = MEDIUM_ERROR, /* = 0x03 */
531 [7] = 0x0a, /* additional length */
532 [12] = 0x14 /* Record Not Found */
533 };
534
535 /* If last-sector problems can't occur, whether because the
536 * capacity was already decremented or because the device is
537 * known to report the correct capacity, then we don't need
538 * to do anything.
539 */
540 if (!us->use_last_sector_hacks)
541 return;
542
543 /* Was this command a READ(10) or a WRITE(10)? */
544 if (srb->cmnd[0] != READ_10 && srb->cmnd[0] != WRITE_10)
545 goto done;
546
547 /* Did this command access the last sector? */
548 sector = (srb->cmnd[2] << 24) | (srb->cmnd[3] << 16) |
549 (srb->cmnd[4] << 8) | (srb->cmnd[5]);
550 disk = srb->request->rq_disk;
551 if (!disk)
552 goto done;
553 sdkp = scsi_disk(disk);
554 if (!sdkp)
555 goto done;
556 if (sector + 1 != sdkp->capacity)
557 goto done;
558
559 if (srb->result == SAM_STAT_GOOD && scsi_get_resid(srb) == 0) {
560
561 /* The command succeeded. If the capacity is odd
562 * (i.e., if the sector number is even) then the
563 * "always-even" heuristic would be wrong for this
564 * device. Issue a WARN() so that the kerneloops.org
565 * project will be notified and we will then know to
566 * mark the device with a CAPACITY_OK flag. Hopefully
567 * this will occur for only a few devices.
568 *
569 * Use the sign of us->last_sector_hacks to tell whether
570 * the warning has already been issued; we don't need
571 * more than one warning per device.
572 */
573 if (!(sector & 1) && us->use_last_sector_hacks > 0) {
574 unsigned vid = le16_to_cpu(
575 us->pusb_dev->descriptor.idVendor);
576 unsigned pid = le16_to_cpu(
577 us->pusb_dev->descriptor.idProduct);
578 unsigned rev = le16_to_cpu(
579 us->pusb_dev->descriptor.bcdDevice);
580
581 WARN(1, "%s: Successful last sector success at %u, "
582 "device %04x:%04x:%04x\n",
583 sdkp->disk->disk_name, sector,
584 vid, pid, rev);
585 us->use_last_sector_hacks = -1;
586 }
587
588 } else {
589 /* The command failed. Allow up to 3 retries in case this
590 * is some normal sort of failure. After that, assume the
591 * capacity is wrong and we're trying to access the sector
592 * beyond the end. Replace the result code and sense data
593 * with values that will cause the SCSI core to fail the
594 * command immediately, instead of going into an infinite
595 * (or even just a very long) retry loop.
596 */
597 if (++us->last_sector_retries < 3)
598 return;
599 srb->result = SAM_STAT_CHECK_CONDITION;
600 memcpy(srb->sense_buffer, record_not_found,
601 sizeof(record_not_found));
602
603 /* In theory we might want to issue a WARN() here if the
604 * capacity is even, since it could indicate the device
605 * has the READ CAPACITY bug _and_ the real capacity is
606 * odd. But it could also indicate that the device
607 * simply can't access its last sector, a failure mode
608 * which is surprisingly common. So no warning.
609 */
610 }
611
612 done:
613 /* Don't reset the retry counter for TEST UNIT READY commands,
614 * because they get issued after device resets which might be
615 * caused by a failed last-sector access.
616 */
617 if (srb->cmnd[0] != TEST_UNIT_READY)
618 us->last_sector_retries = 0;
619}
620
514/* Invoke the transport and basic error-handling/recovery methods 621/* Invoke the transport and basic error-handling/recovery methods
515 * 622 *
516 * This is used by the protocol layers to actually send the message to 623 * This is used by the protocol layers to actually send the message to
@@ -544,6 +651,7 @@ void usb_stor_invoke_transport(struct scsi_cmnd *srb, struct us_data *us)
544 /* if the transport provided its own sense data, don't auto-sense */ 651 /* if the transport provided its own sense data, don't auto-sense */
545 if (result == USB_STOR_TRANSPORT_NO_SENSE) { 652 if (result == USB_STOR_TRANSPORT_NO_SENSE) {
546 srb->result = SAM_STAT_CHECK_CONDITION; 653 srb->result = SAM_STAT_CHECK_CONDITION;
654 last_sector_hacks(us, srb);
547 return; 655 return;
548 } 656 }
549 657
@@ -579,6 +687,20 @@ void usb_stor_invoke_transport(struct scsi_cmnd *srb, struct us_data *us)
579 } 687 }
580 688
581 /* 689 /*
690 * Determine if this device is SAT by seeing if the
691 * command executed successfully. Otherwise we'll have
692 * to wait for at least one CHECK_CONDITION to determine
693 * SANE_SENSE support
694 */
695 if ((srb->cmnd[0] == ATA_16 || srb->cmnd[0] == ATA_12) &&
696 result == USB_STOR_TRANSPORT_GOOD &&
697 !(us->fflags & US_FL_SANE_SENSE) &&
698 !(srb->cmnd[2] & 0x20)) {
699 US_DEBUGP("-- SAT supported, increasing auto-sense\n");
700 us->fflags |= US_FL_SANE_SENSE;
701 }
702
703 /*
582 * A short transfer on a command where we don't expect it 704 * A short transfer on a command where we don't expect it
583 * is unusual, but it doesn't mean we need to auto-sense. 705 * is unusual, but it doesn't mean we need to auto-sense.
584 */ 706 */
@@ -595,10 +717,15 @@ void usb_stor_invoke_transport(struct scsi_cmnd *srb, struct us_data *us)
595 if (need_auto_sense) { 717 if (need_auto_sense) {
596 int temp_result; 718 int temp_result;
597 struct scsi_eh_save ses; 719 struct scsi_eh_save ses;
720 int sense_size = US_SENSE_SIZE;
721
722 /* device supports and needs bigger sense buffer */
723 if (us->fflags & US_FL_SANE_SENSE)
724 sense_size = ~0;
598 725
599 US_DEBUGP("Issuing auto-REQUEST_SENSE\n"); 726 US_DEBUGP("Issuing auto-REQUEST_SENSE\n");
600 727
601 scsi_eh_prep_cmnd(srb, &ses, NULL, 0, US_SENSE_SIZE); 728 scsi_eh_prep_cmnd(srb, &ses, NULL, 0, sense_size);
602 729
603 /* FIXME: we must do the protocol translation here */ 730 /* FIXME: we must do the protocol translation here */
604 if (us->subclass == US_SC_RBC || us->subclass == US_SC_SCSI || 731 if (us->subclass == US_SC_RBC || us->subclass == US_SC_SCSI ||
@@ -632,6 +759,25 @@ void usb_stor_invoke_transport(struct scsi_cmnd *srb, struct us_data *us)
632 return; 759 return;
633 } 760 }
634 761
762 /* If the sense data returned is larger than 18-bytes then we
763 * assume this device supports requesting more in the future.
764 * The response code must be 70h through 73h inclusive.
765 */
766 if (srb->sense_buffer[7] > (US_SENSE_SIZE - 8) &&
767 !(us->fflags & US_FL_SANE_SENSE) &&
768 (srb->sense_buffer[0] & 0x7C) == 0x70) {
769 US_DEBUGP("-- SANE_SENSE support enabled\n");
770 us->fflags |= US_FL_SANE_SENSE;
771
772 /* Indicate to the user that we truncated their sense
773 * because we didn't know it supported larger sense.
774 */
775 US_DEBUGP("-- Sense data truncated to %i from %i\n",
776 US_SENSE_SIZE,
777 srb->sense_buffer[7] + 8);
778 srb->sense_buffer[7] = (US_SENSE_SIZE - 8);
779 }
780
635 US_DEBUGP("-- Result from auto-sense is %d\n", temp_result); 781 US_DEBUGP("-- Result from auto-sense is %d\n", temp_result);
636 US_DEBUGP("-- code: 0x%x, key: 0x%x, ASC: 0x%x, ASCQ: 0x%x\n", 782 US_DEBUGP("-- code: 0x%x, key: 0x%x, ASC: 0x%x, ASCQ: 0x%x\n",
637 srb->sense_buffer[0], 783 srb->sense_buffer[0],
@@ -667,6 +813,7 @@ void usb_stor_invoke_transport(struct scsi_cmnd *srb, struct us_data *us)
667 scsi_bufflen(srb) - scsi_get_resid(srb) < srb->underflow) 813 scsi_bufflen(srb) - scsi_get_resid(srb) < srb->underflow)
668 srb->result = (DID_ERROR << 16) | (SUGGEST_RETRY << 24); 814 srb->result = (DID_ERROR << 16) | (SUGGEST_RETRY << 24);
669 815
816 last_sector_hacks(us, srb);
670 return; 817 return;
671 818
672 /* Error and abort processing: try to resynchronize with the device 819 /* Error and abort processing: try to resynchronize with the device
@@ -694,6 +841,7 @@ void usb_stor_invoke_transport(struct scsi_cmnd *srb, struct us_data *us)
694 us->transport_reset(us); 841 us->transport_reset(us);
695 } 842 }
696 clear_bit(US_FLIDX_RESETTING, &us->dflags); 843 clear_bit(US_FLIDX_RESETTING, &us->dflags);
844 last_sector_hacks(us, srb);
697} 845}
698 846
699/* Stop the current URB transfer */ 847/* Stop the current URB transfer */
@@ -718,10 +866,10 @@ void usb_stor_stop_transport(struct us_data *us)
718} 866}
719 867
720/* 868/*
721 * Control/Bulk/Interrupt transport 869 * Control/Bulk and Control/Bulk/Interrupt transport
722 */ 870 */
723 871
724int usb_stor_CBI_transport(struct scsi_cmnd *srb, struct us_data *us) 872int usb_stor_CB_transport(struct scsi_cmnd *srb, struct us_data *us)
725{ 873{
726 unsigned int transfer_length = scsi_bufflen(srb); 874 unsigned int transfer_length = scsi_bufflen(srb);
727 unsigned int pipe = 0; 875 unsigned int pipe = 0;
@@ -763,6 +911,13 @@ int usb_stor_CBI_transport(struct scsi_cmnd *srb, struct us_data *us)
763 } 911 }
764 912
765 /* STATUS STAGE */ 913 /* STATUS STAGE */
914
915 /* NOTE: CB does not have a status stage. Silly, I know. So
916 * we have to catch this at a higher level.
917 */
918 if (us->protocol != US_PR_CBI)
919 return USB_STOR_TRANSPORT_GOOD;
920
766 result = usb_stor_intr_transfer(us, us->iobuf, 2); 921 result = usb_stor_intr_transfer(us, us->iobuf, 2);
767 US_DEBUGP("Got interrupt data (0x%x, 0x%x)\n", 922 US_DEBUGP("Got interrupt data (0x%x, 0x%x)\n",
768 us->iobuf[0], us->iobuf[1]); 923 us->iobuf[0], us->iobuf[1]);
@@ -817,56 +972,6 @@ int usb_stor_CBI_transport(struct scsi_cmnd *srb, struct us_data *us)
817} 972}
818 973
819/* 974/*
820 * Control/Bulk transport
821 */
822int usb_stor_CB_transport(struct scsi_cmnd *srb, struct us_data *us)
823{
824 unsigned int transfer_length = scsi_bufflen(srb);
825 int result;
826
827 /* COMMAND STAGE */
828 /* let's send the command via the control pipe */
829 result = usb_stor_ctrl_transfer(us, us->send_ctrl_pipe,
830 US_CBI_ADSC,
831 USB_TYPE_CLASS | USB_RECIP_INTERFACE, 0,
832 us->ifnum, srb->cmnd, srb->cmd_len);
833
834 /* check the return code for the command */
835 US_DEBUGP("Call to usb_stor_ctrl_transfer() returned %d\n", result);
836
837 /* if we stalled the command, it means command failed */
838 if (result == USB_STOR_XFER_STALLED) {
839 return USB_STOR_TRANSPORT_FAILED;
840 }
841
842 /* Uh oh... serious problem here */
843 if (result != USB_STOR_XFER_GOOD) {
844 return USB_STOR_TRANSPORT_ERROR;
845 }
846
847 /* DATA STAGE */
848 /* transfer the data payload for this command, if one exists*/
849 if (transfer_length) {
850 unsigned int pipe = srb->sc_data_direction == DMA_FROM_DEVICE ?
851 us->recv_bulk_pipe : us->send_bulk_pipe;
852 result = usb_stor_bulk_srb(us, pipe, srb);
853 US_DEBUGP("CB data stage result is 0x%x\n", result);
854
855 /* if we stalled the data transfer it means command failed */
856 if (result == USB_STOR_XFER_STALLED)
857 return USB_STOR_TRANSPORT_FAILED;
858 if (result > USB_STOR_XFER_STALLED)
859 return USB_STOR_TRANSPORT_ERROR;
860 }
861
862 /* STATUS STAGE */
863 /* NOTE: CB does not have a status stage. Silly, I know. So
864 * we have to catch this at a higher level.
865 */
866 return USB_STOR_TRANSPORT_GOOD;
867}
868
869/*
870 * Bulk only transport 975 * Bulk only transport
871 */ 976 */
872 977
@@ -1173,10 +1278,9 @@ int usb_stor_Bulk_reset(struct us_data *us)
1173 */ 1278 */
1174int usb_stor_port_reset(struct us_data *us) 1279int usb_stor_port_reset(struct us_data *us)
1175{ 1280{
1176 int result, rc_lock; 1281 int result;
1177 1282
1178 result = rc_lock = 1283 result = usb_lock_device_for_reset(us->pusb_dev, us->pusb_intf);
1179 usb_lock_device_for_reset(us->pusb_dev, us->pusb_intf);
1180 if (result < 0) 1284 if (result < 0)
1181 US_DEBUGP("unable to lock device for reset: %d\n", result); 1285 US_DEBUGP("unable to lock device for reset: %d\n", result);
1182 else { 1286 else {
@@ -1189,8 +1293,7 @@ int usb_stor_port_reset(struct us_data *us)
1189 US_DEBUGP("usb_reset_device returns %d\n", 1293 US_DEBUGP("usb_reset_device returns %d\n",
1190 result); 1294 result);
1191 } 1295 }
1192 if (rc_lock) 1296 usb_unlock_device(us->pusb_dev);
1193 usb_unlock_device(us->pusb_dev);
1194 } 1297 }
1195 return result; 1298 return result;
1196} 1299}
diff --git a/drivers/usb/storage/transport.h b/drivers/usb/storage/transport.h
index e70b88182f0e..242ff5e791a5 100644
--- a/drivers/usb/storage/transport.h
+++ b/drivers/usb/storage/transport.h
@@ -113,8 +113,6 @@ struct bulk_cs_wrap {
113 113
114#define US_CBI_ADSC 0 114#define US_CBI_ADSC 0
115 115
116extern int usb_stor_CBI_transport(struct scsi_cmnd *, struct us_data*);
117
118extern int usb_stor_CB_transport(struct scsi_cmnd *, struct us_data*); 116extern int usb_stor_CB_transport(struct scsi_cmnd *, struct us_data*);
119extern int usb_stor_CB_reset(struct us_data*); 117extern int usb_stor_CB_reset(struct us_data*);
120 118
diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h
index bfcc1fe82518..a7f9513fa19d 100644
--- a/drivers/usb/storage/unusual_devs.h
+++ b/drivers/usb/storage/unusual_devs.h
@@ -27,7 +27,8 @@
27 27
28/* IMPORTANT NOTE: This file must be included in another file which does 28/* IMPORTANT NOTE: This file must be included in another file which does
29 * the following thing for it to work: 29 * the following thing for it to work:
30 * The macro UNUSUAL_DEV() must be defined before this file is included 30 * The UNUSUAL_DEV, COMPLIANT_DEV, and USUAL_DEV macros must be defined
31 * before this file is included.
31 */ 32 */
32 33
33/* If you edit this file, please try to keep it sorted first by VendorID, 34/* If you edit this file, please try to keep it sorted first by VendorID,
@@ -46,6 +47,12 @@
46 * <usb-storage@lists.one-eyed-alien.net> 47 * <usb-storage@lists.one-eyed-alien.net>
47 */ 48 */
48 49
50/* Note: If you add an entry only in order to set the CAPACITY_OK flag,
51 * use the COMPLIANT_DEV macro instead of UNUSUAL_DEV. This is
52 * because such entries mark devices which actually work correctly,
53 * as opposed to devices that do something strangely or wrongly.
54 */
55
49/* patch submitted by Vivian Bregier <Vivian.Bregier@imag.fr> 56/* patch submitted by Vivian Bregier <Vivian.Bregier@imag.fr>
50 */ 57 */
51UNUSUAL_DEV( 0x03eb, 0x2002, 0x0100, 0x0100, 58UNUSUAL_DEV( 0x03eb, 0x2002, 0x0100, 0x0100,
@@ -85,6 +92,13 @@ UNUSUAL_DEV( 0x03f0, 0x0307, 0x0001, 0x0001,
85 US_SC_8070, US_PR_USBAT, init_usbat_cd, 0), 92 US_SC_8070, US_PR_USBAT, init_usbat_cd, 0),
86#endif 93#endif
87 94
95/* Reported by Ben Efros <ben@pc-doctor.com> */
96UNUSUAL_DEV( 0x03f0, 0x070c, 0x0000, 0x0000,
97 "HP",
98 "Personal Media Drive",
99 US_SC_DEVICE, US_PR_DEVICE, NULL,
100 US_FL_SANE_SENSE ),
101
88/* Reported by Grant Grundler <grundler@parisc-linux.org> 102/* Reported by Grant Grundler <grundler@parisc-linux.org>
89 * HP r707 camera in "Disk" mode with 2.00.23 or 2.00.24 firmware. 103 * HP r707 camera in "Disk" mode with 2.00.23 or 2.00.24 firmware.
90 */ 104 */
@@ -160,34 +174,6 @@ UNUSUAL_DEV( 0x0421, 0x0019, 0x0592, 0x0592,
160 US_SC_DEVICE, US_PR_DEVICE, NULL, 174 US_SC_DEVICE, US_PR_DEVICE, NULL,
161 US_FL_MAX_SECTORS_64 ), 175 US_FL_MAX_SECTORS_64 ),
162 176
163/* Reported by Filip Joelsson <filip@blueturtle.nu> */
164UNUSUAL_DEV( 0x0421, 0x005d, 0x0001, 0x0600,
165 "Nokia",
166 "Nokia 3110c",
167 US_SC_DEVICE, US_PR_DEVICE, NULL,
168 US_FL_FIX_CAPACITY ),
169
170/* Reported by Ozan Sener <themgzzy@gmail.com> */
171UNUSUAL_DEV( 0x0421, 0x0060, 0x0551, 0x0551,
172 "Nokia",
173 "3500c",
174 US_SC_DEVICE, US_PR_DEVICE, NULL,
175 US_FL_FIX_CAPACITY ),
176
177/* Reported by CSECSY Laszlo <boobaa@frugalware.org> */
178UNUSUAL_DEV( 0x0421, 0x0063, 0x0001, 0x0601,
179 "Nokia",
180 "Nokia 3109c",
181 US_SC_DEVICE, US_PR_DEVICE, NULL,
182 US_FL_FIX_CAPACITY ),
183
184/* Patch for Nokia 5310 capacity */
185UNUSUAL_DEV( 0x0421, 0x006a, 0x0000, 0x0701,
186 "Nokia",
187 "5310",
188 US_SC_DEVICE, US_PR_DEVICE, NULL,
189 US_FL_FIX_CAPACITY ),
190
191/* Reported by Mario Rettig <mariorettig@web.de> */ 177/* Reported by Mario Rettig <mariorettig@web.de> */
192UNUSUAL_DEV( 0x0421, 0x042e, 0x0100, 0x0100, 178UNUSUAL_DEV( 0x0421, 0x042e, 0x0100, 0x0100,
193 "Nokia", 179 "Nokia",
@@ -253,35 +239,6 @@ UNUSUAL_DEV( 0x0421, 0x0495, 0x0370, 0x0370,
253 US_SC_DEVICE, US_PR_DEVICE, NULL, 239 US_SC_DEVICE, US_PR_DEVICE, NULL,
254 US_FL_MAX_SECTORS_64 ), 240 US_FL_MAX_SECTORS_64 ),
255 241
256/* Reported by Cedric Godin <cedric@belbone.be> */
257UNUSUAL_DEV( 0x0421, 0x04b9, 0x0500, 0x0551,
258 "Nokia",
259 "5300",
260 US_SC_DEVICE, US_PR_DEVICE, NULL,
261 US_FL_FIX_CAPACITY ),
262
263/* Reported by Richard Nauber <RichardNauber@web.de> */
264UNUSUAL_DEV( 0x0421, 0x04fa, 0x0550, 0x0660,
265 "Nokia",
266 "6300",
267 US_SC_DEVICE, US_PR_DEVICE, NULL,
268 US_FL_FIX_CAPACITY ),
269
270/* Patch for Nokia 5310 capacity */
271UNUSUAL_DEV( 0x0421, 0x006a, 0x0000, 0x0591,
272 "Nokia",
273 "5310",
274 US_SC_DEVICE, US_PR_DEVICE, NULL,
275 US_FL_FIX_CAPACITY ),
276
277/* Submitted by Ricky Wong Yung Fei <evilbladewarrior@gmail.com> */
278/* Nokia 7610 Supernova - Too many sectors reported in usb storage mode */
279UNUSUAL_DEV( 0x0421, 0x00f5, 0x0000, 0x0470,
280 "Nokia",
281 "7610 Supernova",
282 US_SC_DEVICE, US_PR_DEVICE, NULL,
283 US_FL_FIX_CAPACITY ),
284
285/* Reported by Olaf Hering <olh@suse.de> from novell bug #105878 */ 242/* Reported by Olaf Hering <olh@suse.de> from novell bug #105878 */
286UNUSUAL_DEV( 0x0424, 0x0fdc, 0x0210, 0x0210, 243UNUSUAL_DEV( 0x0424, 0x0fdc, 0x0210, 0x0210,
287 "SMSC", 244 "SMSC",
@@ -289,11 +246,17 @@ UNUSUAL_DEV( 0x0424, 0x0fdc, 0x0210, 0x0210,
289 US_SC_DEVICE, US_PR_DEVICE, NULL, 246 US_SC_DEVICE, US_PR_DEVICE, NULL,
290 US_FL_SINGLE_LUN ), 247 US_FL_SINGLE_LUN ),
291 248
292#ifdef CONFIG_USB_STORAGE_DPCM 249#ifdef CONFIG_USB_STORAGE_SDDR09
293UNUSUAL_DEV( 0x0436, 0x0005, 0x0100, 0x0100, 250UNUSUAL_DEV( 0x0436, 0x0005, 0x0100, 0x0100,
294 "Microtech", 251 "Microtech",
295 "CameraMate (DPCM_USB)", 252 "CameraMate (DPCM_USB)",
296 US_SC_SCSI, US_PR_DPCM_USB, NULL, 0 ), 253 US_SC_SCSI, US_PR_DPCM_USB, NULL, 0 ),
254#else
255UNUSUAL_DEV( 0x0436, 0x0005, 0x0100, 0x0100,
256 "Microtech",
257 "CameraMate",
258 US_SC_SCSI, US_PR_CB, NULL,
259 US_FL_SINGLE_LUN ),
297#endif 260#endif
298 261
299/* Patch submitted by Daniel Drake <dsd@gentoo.org> 262/* Patch submitted by Daniel Drake <dsd@gentoo.org>
@@ -388,6 +351,15 @@ UNUSUAL_DEV( 0x04a4, 0x0004, 0x0001, 0x0001,
388 "DVD-CAM DZ-MV100A Camcorder", 351 "DVD-CAM DZ-MV100A Camcorder",
389 US_SC_SCSI, US_PR_CB, NULL, US_FL_SINGLE_LUN), 352 US_SC_SCSI, US_PR_CB, NULL, US_FL_SINGLE_LUN),
390 353
354/* BENQ DC5330
355 * Reported by Manuel Fombuena <mfombuena@ya.com> and
356 * Frank Copeland <fjc@thingy.apana.org.au> */
357UNUSUAL_DEV( 0x04a5, 0x3010, 0x0100, 0x0100,
358 "Tekom Technologies, Inc",
359 "300_CAMERA",
360 US_SC_DEVICE, US_PR_DEVICE, NULL,
361 US_FL_IGNORE_RESIDUE ),
362
391/* Patch for Nikon coolpix 2000 363/* Patch for Nikon coolpix 2000
392 * Submitted by Fabien Cosse <fabien.cosse@wanadoo.fr>*/ 364 * Submitted by Fabien Cosse <fabien.cosse@wanadoo.fr>*/
393UNUSUAL_DEV( 0x04b0, 0x0301, 0x0010, 0x0010, 365UNUSUAL_DEV( 0x04b0, 0x0301, 0x0010, 0x0010,
@@ -396,83 +368,6 @@ UNUSUAL_DEV( 0x04b0, 0x0301, 0x0010, 0x0010,
396 US_SC_DEVICE, US_PR_DEVICE,NULL, 368 US_SC_DEVICE, US_PR_DEVICE,NULL,
397 US_FL_NOT_LOCKABLE ), 369 US_FL_NOT_LOCKABLE ),
398 370
399/* Reported by Stefan de Konink <skinkie@xs4all.nl> */
400UNUSUAL_DEV( 0x04b0, 0x0401, 0x0200, 0x0200,
401 "NIKON",
402 "NIKON DSC D100",
403 US_SC_DEVICE, US_PR_DEVICE, NULL,
404 US_FL_FIX_CAPACITY),
405
406/* Reported by Tobias Kunze Briseno <t-linux@fictive.com> */
407UNUSUAL_DEV( 0x04b0, 0x0403, 0x0200, 0x0200,
408 "NIKON",
409 "NIKON DSC D2H",
410 US_SC_DEVICE, US_PR_DEVICE, NULL,
411 US_FL_FIX_CAPACITY),
412
413/* Reported by Milinevsky Dmitry <niam.niam@gmail.com> */
414UNUSUAL_DEV( 0x04b0, 0x0409, 0x0100, 0x0100,
415 "NIKON",
416 "NIKON DSC D50",
417 US_SC_DEVICE, US_PR_DEVICE, NULL,
418 US_FL_FIX_CAPACITY),
419
420/* Reported by Andreas Bockhold <andreas@bockionline.de> */
421UNUSUAL_DEV( 0x04b0, 0x0405, 0x0100, 0x0100,
422 "NIKON",
423 "NIKON DSC D70",
424 US_SC_DEVICE, US_PR_DEVICE, NULL,
425 US_FL_FIX_CAPACITY),
426
427/* Reported by Jamie Kitson <jamie@staberinde.fsnet.co.uk> */
428UNUSUAL_DEV( 0x04b0, 0x040d, 0x0100, 0x0100,
429 "NIKON",
430 "NIKON DSC D70s",
431 US_SC_DEVICE, US_PR_DEVICE, NULL,
432 US_FL_FIX_CAPACITY),
433
434/* Reported by Graber and Mike Pagano <mpagano-kernel@mpagano.com> */
435UNUSUAL_DEV( 0x04b0, 0x040f, 0x0100, 0x0200,
436 "NIKON",
437 "NIKON DSC D200",
438 US_SC_DEVICE, US_PR_DEVICE, NULL,
439 US_FL_FIX_CAPACITY),
440
441/* Reported by Emil Larsson <emil@swip.net> */
442UNUSUAL_DEV( 0x04b0, 0x0411, 0x0100, 0x0111,
443 "NIKON",
444 "NIKON DSC D80",
445 US_SC_DEVICE, US_PR_DEVICE, NULL,
446 US_FL_FIX_CAPACITY),
447
448/* Reported by Ortwin Glueck <odi@odi.ch> */
449UNUSUAL_DEV( 0x04b0, 0x0413, 0x0110, 0x0111,
450 "NIKON",
451 "NIKON DSC D40",
452 US_SC_DEVICE, US_PR_DEVICE, NULL,
453 US_FL_FIX_CAPACITY),
454
455/* Reported by Paul Check <paul@openstreet.com> */
456UNUSUAL_DEV( 0x04b0, 0x0415, 0x0100, 0x0100,
457 "NIKON",
458 "NIKON DSC D2Xs",
459 US_SC_DEVICE, US_PR_DEVICE, NULL,
460 US_FL_FIX_CAPACITY),
461
462/* Reported by Shan Destromp (shansan@gmail.com) */
463UNUSUAL_DEV( 0x04b0, 0x0417, 0x0100, 0x0100,
464 "NIKON",
465 "NIKON DSC D40X",
466 US_SC_DEVICE, US_PR_DEVICE, NULL,
467 US_FL_FIX_CAPACITY),
468
469/* Reported by paul ready <lxtwin@homecall.co.uk> */
470UNUSUAL_DEV( 0x04b0, 0x0419, 0x0100, 0x0200,
471 "NIKON",
472 "NIKON DSC D300",
473 US_SC_DEVICE, US_PR_DEVICE, NULL,
474 US_FL_FIX_CAPACITY),
475
476/* Reported by Doug Maxey (dwm@austin.ibm.com) */ 371/* Reported by Doug Maxey (dwm@austin.ibm.com) */
477UNUSUAL_DEV( 0x04b3, 0x4001, 0x0110, 0x0110, 372UNUSUAL_DEV( 0x04b3, 0x4001, 0x0110, 0x0110,
478 "IBM", 373 "IBM",
@@ -480,15 +375,6 @@ UNUSUAL_DEV( 0x04b3, 0x4001, 0x0110, 0x0110,
480 US_SC_DEVICE, US_PR_CB, NULL, 375 US_SC_DEVICE, US_PR_CB, NULL,
481 US_FL_MAX_SECTORS_MIN), 376 US_FL_MAX_SECTORS_MIN),
482 377
483/* BENQ DC5330
484 * Reported by Manuel Fombuena <mfombuena@ya.com> and
485 * Frank Copeland <fjc@thingy.apana.org.au> */
486UNUSUAL_DEV( 0x04a5, 0x3010, 0x0100, 0x0100,
487 "Tekom Technologies, Inc",
488 "300_CAMERA",
489 US_SC_DEVICE, US_PR_DEVICE, NULL,
490 US_FL_IGNORE_RESIDUE ),
491
492#ifdef CONFIG_USB_STORAGE_CYPRESS_ATACB 378#ifdef CONFIG_USB_STORAGE_CYPRESS_ATACB
493/* CY7C68300 : support atacb */ 379/* CY7C68300 : support atacb */
494UNUSUAL_DEV( 0x04b4, 0x6830, 0x0000, 0x9999, 380UNUSUAL_DEV( 0x04b4, 0x6830, 0x0000, 0x9999,
@@ -594,6 +480,12 @@ UNUSUAL_DEV( 0x04e6, 0x0005, 0x0100, 0x0208,
594 "eUSB SmartMedia / CompactFlash Adapter", 480 "eUSB SmartMedia / CompactFlash Adapter",
595 US_SC_SCSI, US_PR_DPCM_USB, usb_stor_sddr09_dpcm_init, 481 US_SC_SCSI, US_PR_DPCM_USB, usb_stor_sddr09_dpcm_init,
596 0), 482 0),
483#else
484UNUSUAL_DEV( 0x04e6, 0x0005, 0x0100, 0x0208,
485 "SCM Microsystems",
486 "eUSB CompactFlash Adapter",
487 US_SC_SCSI, US_PR_CB, NULL,
488 US_FL_SINGLE_LUN),
597#endif 489#endif
598 490
599/* Reported by Markus Demleitner <msdemlei@cl.uni-heidelberg.de> */ 491/* Reported by Markus Demleitner <msdemlei@cl.uni-heidelberg.de> */
@@ -685,6 +577,13 @@ UNUSUAL_DEV( 0x0525, 0xa140, 0x0100, 0x0100,
685 US_SC_8070, US_PR_DEVICE, NULL, 577 US_SC_8070, US_PR_DEVICE, NULL,
686 US_FL_FIX_INQUIRY ), 578 US_FL_FIX_INQUIRY ),
687 579
580/* Added by Alan Stern <stern@rowland.harvard.edu> */
581COMPLIANT_DEV(0x0525, 0xa4a5, 0x0000, 0x9999,
582 "Linux",
583 "File-backed Storage Gadget",
584 US_SC_DEVICE, US_PR_DEVICE, NULL,
585 US_FL_CAPACITY_OK ),
586
688/* Yakumo Mega Image 37 587/* Yakumo Mega Image 37
689 * Submitted by Stephan Fuhrmann <atomenergie@t-online.de> */ 588 * Submitted by Stephan Fuhrmann <atomenergie@t-online.de> */
690UNUSUAL_DEV( 0x052b, 0x1801, 0x0100, 0x0100, 589UNUSUAL_DEV( 0x052b, 0x1801, 0x0100, 0x0100,
@@ -807,15 +706,15 @@ UNUSUAL_DEV( 0x054c, 0x006d, 0x0000, 0x9999,
807 US_SC_DEVICE, US_PR_DEVICE, NULL, 706 US_SC_DEVICE, US_PR_DEVICE, NULL,
808 US_FL_FIX_INQUIRY ), 707 US_FL_FIX_INQUIRY ),
809 708
810/* Submitted by Mike Alborn <malborn@deandra.homeip.net> */ 709/* Submitted by Frank Engel <frankie@cse.unsw.edu.au> */
811UNUSUAL_DEV( 0x054c, 0x016a, 0x0000, 0x9999, 710UNUSUAL_DEV( 0x054c, 0x0099, 0x0000, 0x9999,
812 "Sony", 711 "Sony",
813 "PEG Mass Storage", 712 "PEG Mass Storage",
814 US_SC_DEVICE, US_PR_DEVICE, NULL, 713 US_SC_DEVICE, US_PR_DEVICE, NULL,
815 US_FL_FIX_INQUIRY ), 714 US_FL_FIX_INQUIRY ),
816 715
817/* Submitted by Frank Engel <frankie@cse.unsw.edu.au> */ 716/* Submitted by Mike Alborn <malborn@deandra.homeip.net> */
818UNUSUAL_DEV( 0x054c, 0x0099, 0x0000, 0x9999, 717UNUSUAL_DEV( 0x054c, 0x016a, 0x0000, 0x9999,
819 "Sony", 718 "Sony",
820 "PEG Mass Storage", 719 "PEG Mass Storage",
821 US_SC_DEVICE, US_PR_DEVICE, NULL, 720 US_SC_DEVICE, US_PR_DEVICE, NULL,
@@ -966,6 +865,18 @@ UNUSUAL_DEV( 0x05ac, 0x120a, 0x0000, 0x9999,
966 US_SC_DEVICE, US_PR_DEVICE, NULL, 865 US_SC_DEVICE, US_PR_DEVICE, NULL,
967 US_FL_FIX_CAPACITY ), 866 US_FL_FIX_CAPACITY ),
968 867
868/* Reported by Dan Williams <dcbw@redhat.com>
869 * Option N.V. mobile broadband modems
870 * Ignore driver CD mode and force into modem mode by default.
871 */
872
873/* Globetrotter HSDPA; mass storage shows up as Qualcomm for vendor */
874UNUSUAL_DEV( 0x05c6, 0x1000, 0x0000, 0x9999,
875 "Option N.V.",
876 "Mass Storage",
877 US_SC_DEVICE, US_PR_DEVICE, option_ms_init,
878 0),
879
969#ifdef CONFIG_USB_STORAGE_JUMPSHOT 880#ifdef CONFIG_USB_STORAGE_JUMPSHOT
970UNUSUAL_DEV( 0x05dc, 0x0001, 0x0000, 0x0001, 881UNUSUAL_DEV( 0x05dc, 0x0001, 0x0000, 0x0001,
971 "Lexar", 882 "Lexar",
@@ -1004,6 +915,13 @@ UNUSUAL_DEV( 0x05e3, 0x0702, 0x0000, 0xffff,
1004 US_SC_DEVICE, US_PR_DEVICE, NULL, 915 US_SC_DEVICE, US_PR_DEVICE, NULL,
1005 US_FL_GO_SLOW | US_FL_MAX_SECTORS_64 ), 916 US_FL_GO_SLOW | US_FL_MAX_SECTORS_64 ),
1006 917
918/* Reported by Ben Efros <ben@pc-doctor.com> */
919UNUSUAL_DEV( 0x05e3, 0x0723, 0x9451, 0x9451,
920 "Genesys Logic",
921 "USB to SATA",
922 US_SC_DEVICE, US_PR_DEVICE, NULL,
923 US_FL_SANE_SENSE ),
924
1007/* Reported by Hanno Boeck <hanno@gmx.de> 925/* Reported by Hanno Boeck <hanno@gmx.de>
1008 * Taken from the Lycoris Kernel */ 926 * Taken from the Lycoris Kernel */
1009UNUSUAL_DEV( 0x0636, 0x0003, 0x0000, 0x9999, 927UNUSUAL_DEV( 0x0636, 0x0003, 0x0000, 0x9999,
@@ -1040,7 +958,7 @@ UNUSUAL_DEV( 0x067b, 0x2507, 0x0100, 0x0100,
1040 US_FL_FIX_CAPACITY | US_FL_GO_SLOW ), 958 US_FL_FIX_CAPACITY | US_FL_GO_SLOW ),
1041 959
1042/* Reported by Alex Butcher <alex.butcher@assursys.co.uk> */ 960/* Reported by Alex Butcher <alex.butcher@assursys.co.uk> */
1043UNUSUAL_DEV( 0x067b, 0x3507, 0x0001, 0x0001, 961UNUSUAL_DEV( 0x067b, 0x3507, 0x0001, 0x0101,
1044 "Prolific Technology Inc.", 962 "Prolific Technology Inc.",
1045 "ATAPI-6 Bridge Controller", 963 "ATAPI-6 Bridge Controller",
1046 US_SC_DEVICE, US_PR_DEVICE, NULL, 964 US_SC_DEVICE, US_PR_DEVICE, NULL,
@@ -1161,11 +1079,17 @@ UNUSUAL_DEV( 0x07af, 0x0005, 0x0100, 0x0100,
1161 US_SC_DEVICE, US_PR_DEVICE, usb_stor_euscsi_init, 1079 US_SC_DEVICE, US_PR_DEVICE, usb_stor_euscsi_init,
1162 US_FL_SCM_MULT_TARG ), 1080 US_FL_SCM_MULT_TARG ),
1163 1081
1164#ifdef CONFIG_USB_STORAGE_DPCM 1082#ifdef CONFIG_USB_STORAGE_SDDR09
1165UNUSUAL_DEV( 0x07af, 0x0006, 0x0100, 0x0100, 1083UNUSUAL_DEV( 0x07af, 0x0006, 0x0100, 0x0100,
1166 "Microtech", 1084 "Microtech",
1167 "CameraMate (DPCM_USB)", 1085 "CameraMate (DPCM_USB)",
1168 US_SC_SCSI, US_PR_DPCM_USB, NULL, 0 ), 1086 US_SC_SCSI, US_PR_DPCM_USB, NULL, 0 ),
1087#else
1088UNUSUAL_DEV( 0x07af, 0x0006, 0x0100, 0x0100,
1089 "Microtech",
1090 "CameraMate",
1091 US_SC_SCSI, US_PR_CB, NULL,
1092 US_FL_SINGLE_LUN ),
1169#endif 1093#endif
1170 1094
1171#ifdef CONFIG_USB_STORAGE_ALAUDA 1095#ifdef CONFIG_USB_STORAGE_ALAUDA
@@ -1320,6 +1244,13 @@ UNUSUAL_DEV( 0x0840, 0x0082, 0x0001, 0x0001,
1320 US_SC_DEVICE, US_PR_DEVICE, NULL, 1244 US_SC_DEVICE, US_PR_DEVICE, NULL,
1321 US_FL_FIX_CAPACITY), 1245 US_FL_FIX_CAPACITY),
1322 1246
1247/* Reported and patched by Nguyen Anh Quynh <aquynh@gmail.com> */
1248UNUSUAL_DEV( 0x0840, 0x0084, 0x0001, 0x0001,
1249 "Argosy",
1250 "Storage",
1251 US_SC_DEVICE, US_PR_DEVICE, NULL,
1252 US_FL_FIX_CAPACITY),
1253
1323/* Entry and supporting patch by Theodore Kilgore <kilgota@auburn.edu>. 1254/* Entry and supporting patch by Theodore Kilgore <kilgota@auburn.edu>.
1324 * Flag will support Bulk devices which use a standards-violating 32-byte 1255 * Flag will support Bulk devices which use a standards-violating 32-byte
1325 * Command Block Wrapper. Here, the "DC2MEGA" cameras (several brands) with 1256 * Command Block Wrapper. Here, the "DC2MEGA" cameras (several brands) with
@@ -1343,17 +1274,6 @@ UNUSUAL_DEV( 0x0851, 0x1543, 0x0200, 0x0200,
1343 US_SC_DEVICE, US_PR_DEVICE, NULL, 1274 US_SC_DEVICE, US_PR_DEVICE, NULL,
1344 US_FL_NOT_LOCKABLE), 1275 US_FL_NOT_LOCKABLE),
1345 1276
1346/* Andrew Lunn <andrew@lunn.ch>
1347 * PanDigital Digital Picture Frame. Does not like ALLOW_MEDIUM_REMOVAL
1348 * on LUN 4.
1349 * Note: Vend:Prod clash with "Ltd Maxell WS30 Slim Digital Camera"
1350*/
1351UNUSUAL_DEV( 0x0851, 0x1543, 0x0200, 0x0200,
1352 "PanDigital",
1353 "Photo Frame",
1354 US_SC_DEVICE, US_PR_DEVICE, NULL,
1355 US_FL_NOT_LOCKABLE),
1356
1357/* Submitted by Jan De Luyck <lkml@kcore.org> */ 1277/* Submitted by Jan De Luyck <lkml@kcore.org> */
1358UNUSUAL_DEV( 0x08bd, 0x1100, 0x0000, 0x0000, 1278UNUSUAL_DEV( 0x08bd, 0x1100, 0x0000, 0x0000,
1359 "CITIZEN", 1279 "CITIZEN",
@@ -1425,6 +1345,13 @@ UNUSUAL_DEV( 0x0a17, 0x006, 0x0000, 0xffff,
1425 US_SC_DEVICE, US_PR_DEVICE, NULL, 1345 US_SC_DEVICE, US_PR_DEVICE, NULL,
1426 US_FL_FIX_INQUIRY ), 1346 US_FL_FIX_INQUIRY ),
1427 1347
1348/* Reported by Jaak Ristioja <Ristioja@gmail.com> */
1349UNUSUAL_DEV( 0x0a17, 0x006e, 0x0100, 0x0100,
1350 "Pentax",
1351 "K10D",
1352 US_SC_DEVICE, US_PR_DEVICE, NULL,
1353 US_FL_FIX_CAPACITY ),
1354
1428/* These are virtual windows driver CDs, which the zd1211rw driver 1355/* These are virtual windows driver CDs, which the zd1211rw driver
1429 * automatically converts into WLAN devices. */ 1356 * automatically converts into WLAN devices. */
1430UNUSUAL_DEV( 0x0ace, 0x2011, 0x0101, 0x0101, 1357UNUSUAL_DEV( 0x0ace, 0x2011, 0x0101, 0x0101,
@@ -1439,6 +1366,18 @@ UNUSUAL_DEV( 0x0ace, 0x20ff, 0x0101, 0x0101,
1439 US_SC_DEVICE, US_PR_DEVICE, NULL, 1366 US_SC_DEVICE, US_PR_DEVICE, NULL,
1440 US_FL_IGNORE_DEVICE ), 1367 US_FL_IGNORE_DEVICE ),
1441 1368
1369/* Reported by Dan Williams <dcbw@redhat.com>
1370 * Option N.V. mobile broadband modems
1371 * Ignore driver CD mode and force into modem mode by default.
1372 */
1373
1374/* iCON 225 */
1375UNUSUAL_DEV( 0x0af0, 0x6971, 0x0000, 0x9999,
1376 "Option N.V.",
1377 "Mass Storage",
1378 US_SC_DEVICE, US_PR_DEVICE, option_ms_init,
1379 0),
1380
1442/* Reported by F. Aben <f.aben@option.com> 1381/* Reported by F. Aben <f.aben@option.com>
1443 * This device (wrongly) has a vendor-specific device descriptor. 1382 * This device (wrongly) has a vendor-specific device descriptor.
1444 * The entry is needed so usb-storage can bind to it's mass-storage 1383 * The entry is needed so usb-storage can bind to it's mass-storage
@@ -1449,6 +1388,13 @@ UNUSUAL_DEV( 0x0af0, 0x7401, 0x0000, 0x0000,
1449 US_SC_DEVICE, US_PR_DEVICE, NULL, 1388 US_SC_DEVICE, US_PR_DEVICE, NULL,
1450 0 ), 1389 0 ),
1451 1390
1391/* Reported by Ben Efros <ben@pc-doctor.com> */
1392UNUSUAL_DEV( 0x0bc2, 0x3010, 0x0000, 0x0000,
1393 "Seagate",
1394 "FreeAgent Pro",
1395 US_SC_DEVICE, US_PR_DEVICE, NULL,
1396 US_FL_SANE_SENSE ),
1397
1452#ifdef CONFIG_USB_STORAGE_ISD200 1398#ifdef CONFIG_USB_STORAGE_ISD200
1453UNUSUAL_DEV( 0x0bf6, 0xa001, 0x0100, 0x0110, 1399UNUSUAL_DEV( 0x0bf6, 0xa001, 0x0100, 0x0110,
1454 "ATI", 1400 "ATI",
@@ -1472,6 +1418,22 @@ UNUSUAL_DEV( 0x0c0b, 0xa109, 0x0000, 0xffff,
1472 US_FL_SINGLE_LUN ), 1418 US_FL_SINGLE_LUN ),
1473#endif 1419#endif
1474 1420
1421UNUSUAL_DEV( 0x0d49, 0x7310, 0x0000, 0x9999,
1422 "Maxtor",
1423 "USB to SATA",
1424 US_SC_DEVICE, US_PR_DEVICE, NULL,
1425 US_FL_SANE_SENSE),
1426
1427/*
1428 * Pete Zaitcev <zaitcev@yahoo.com>, bz#164688.
1429 * The device blatantly ignores LUN and returns 1 in GetMaxLUN.
1430 */
1431UNUSUAL_DEV( 0x0c45, 0x1060, 0x0100, 0x0100,
1432 "Unknown",
1433 "Unknown",
1434 US_SC_DEVICE, US_PR_DEVICE, NULL,
1435 US_FL_SINGLE_LUN ),
1436
1475/* Submitted by: Nick Sillik <n.sillik@temple.edu> 1437/* Submitted by: Nick Sillik <n.sillik@temple.edu>
1476 * Needed for OneTouch extension to usb-storage 1438 * Needed for OneTouch extension to usb-storage
1477 * 1439 *
@@ -1489,16 +1451,6 @@ UNUSUAL_DEV( 0x0c0b, 0xa109, 0x0000, 0xffff,
1489 0), 1451 0),
1490#endif 1452#endif
1491 1453
1492/*
1493 * Pete Zaitcev <zaitcev@yahoo.com>, bz#164688.
1494 * The device blatantly ignores LUN and returns 1 in GetMaxLUN.
1495 */
1496UNUSUAL_DEV( 0x0c45, 0x1060, 0x0100, 0x0100,
1497 "Unknown",
1498 "Unknown",
1499 US_SC_DEVICE, US_PR_DEVICE, NULL,
1500 US_FL_SINGLE_LUN ),
1501
1502/* Submitted by Joris Struyve <joris@struyve.be> */ 1454/* Submitted by Joris Struyve <joris@struyve.be> */
1503UNUSUAL_DEV( 0x0d96, 0x410a, 0x0001, 0xffff, 1455UNUSUAL_DEV( 0x0d96, 0x410a, 0x0001, 0xffff,
1504 "Medion", 1456 "Medion",
@@ -1516,6 +1468,13 @@ UNUSUAL_DEV( 0x0d96, 0x5200, 0x0001, 0x0200,
1516 "JD 5200 z3", 1468 "JD 5200 z3",
1517 US_SC_DEVICE, US_PR_DEVICE, NULL, US_FL_FIX_INQUIRY), 1469 US_SC_DEVICE, US_PR_DEVICE, NULL, US_FL_FIX_INQUIRY),
1518 1470
1471/* Reported by Jason Johnston <killean@shaw.ca> */
1472UNUSUAL_DEV( 0x0dc4, 0x0073, 0x0000, 0x0000,
1473 "Macpower Technology Co.LTD.",
1474 "USB 2.0 3.5\" DEVICE",
1475 US_SC_DEVICE, US_PR_DEVICE, NULL,
1476 US_FL_FIX_CAPACITY),
1477
1519/* Reported by Lubomir Blaha <tritol@trilogic.cz> 1478/* Reported by Lubomir Blaha <tritol@trilogic.cz>
1520 * I _REALLY_ don't know what 3rd, 4th number and all defines mean, but this 1479 * I _REALLY_ don't know what 3rd, 4th number and all defines mean, but this
1521 * works for me. Can anybody correct these values? (I able to test corrected 1480 * works for me. Can anybody correct these values? (I able to test corrected
@@ -1638,13 +1597,6 @@ UNUSUAL_DEV( 0x0fce, 0xe030, 0x0000, 0x0000,
1638 US_SC_DEVICE, US_PR_DEVICE, NULL, 1597 US_SC_DEVICE, US_PR_DEVICE, NULL,
1639 US_FL_FIX_CAPACITY | US_FL_IGNORE_RESIDUE ), 1598 US_FL_FIX_CAPACITY | US_FL_IGNORE_RESIDUE ),
1640 1599
1641/* Reported by Ricardo Barberis <ricardo@dattatec.com> */
1642UNUSUAL_DEV( 0x0fce, 0xe092, 0x0000, 0x0000,
1643 "Sony Ericsson",
1644 "P1i",
1645 US_SC_DEVICE, US_PR_DEVICE, NULL,
1646 US_FL_IGNORE_RESIDUE ),
1647
1648/* Reported by Emmanuel Vasilakis <evas@forthnet.gr> */ 1600/* Reported by Emmanuel Vasilakis <evas@forthnet.gr> */
1649UNUSUAL_DEV( 0x0fce, 0xe031, 0x0000, 0x0000, 1601UNUSUAL_DEV( 0x0fce, 0xe031, 0x0000, 0x0000,
1650 "Sony Ericsson", 1602 "Sony Ericsson",
@@ -1652,6 +1604,13 @@ UNUSUAL_DEV( 0x0fce, 0xe031, 0x0000, 0x0000,
1652 US_SC_DEVICE, US_PR_DEVICE, NULL, 1604 US_SC_DEVICE, US_PR_DEVICE, NULL,
1653 US_FL_IGNORE_RESIDUE | US_FL_FIX_CAPACITY ), 1605 US_FL_IGNORE_RESIDUE | US_FL_FIX_CAPACITY ),
1654 1606
1607/* Reported by Ricardo Barberis <ricardo@dattatec.com> */
1608UNUSUAL_DEV( 0x0fce, 0xe092, 0x0000, 0x0000,
1609 "Sony Ericsson",
1610 "P1i",
1611 US_SC_DEVICE, US_PR_DEVICE, NULL,
1612 US_FL_IGNORE_RESIDUE ),
1613
1655/* Reported by Kevin Cernekee <kpc-usbdev@gelato.uiuc.edu> 1614/* Reported by Kevin Cernekee <kpc-usbdev@gelato.uiuc.edu>
1656 * Tested on hardware version 1.10. 1615 * Tested on hardware version 1.10.
1657 * Entry is needed only for the initializer function override. 1616 * Entry is needed only for the initializer function override.
@@ -1664,6 +1623,12 @@ UNUSUAL_DEV( 0x1019, 0x0c55, 0x0000, 0x0110,
1664 US_SC_DEVICE, US_PR_DEVICE, usb_stor_ucr61s2b_init, 1623 US_SC_DEVICE, US_PR_DEVICE, usb_stor_ucr61s2b_init,
1665 0 ), 1624 0 ),
1666 1625
1626UNUSUAL_DEV( 0x1058, 0x0704, 0x0000, 0x9999,
1627 "Western Digital",
1628 "External HDD",
1629 US_SC_DEVICE, US_PR_DEVICE, NULL,
1630 US_FL_SANE_SENSE),
1631
1667/* Reported by Fabio Venturi <f.venturi@tdnet.it> 1632/* Reported by Fabio Venturi <f.venturi@tdnet.it>
1668 * The device reports a vendor-specific bDeviceClass. 1633 * The device reports a vendor-specific bDeviceClass.
1669 */ 1634 */
@@ -2053,10 +2018,10 @@ UNUSUAL_DEV( 0x14cd, 0x6600, 0x0201, 0x0201,
2053 * JMicron responds to USN and several other SCSI ioctls with a 2018 * JMicron responds to USN and several other SCSI ioctls with a
2054 * residue that causes subsequent I/O requests to fail. */ 2019 * residue that causes subsequent I/O requests to fail. */
2055UNUSUAL_DEV( 0x152d, 0x2329, 0x0100, 0x0100, 2020UNUSUAL_DEV( 0x152d, 0x2329, 0x0100, 0x0100,
2056 "JMicron", 2021 "JMicron",
2057 "USB to ATA/ATAPI Bridge", 2022 "USB to ATA/ATAPI Bridge",
2058 US_SC_DEVICE, US_PR_DEVICE, NULL, 2023 US_SC_DEVICE, US_PR_DEVICE, NULL,
2059 US_FL_IGNORE_RESIDUE ), 2024 US_FL_IGNORE_RESIDUE | US_FL_SANE_SENSE ),
2060 2025
2061/* Reported by Robert Schedel <r.schedel@yahoo.de> 2026/* Reported by Robert Schedel <r.schedel@yahoo.de>
2062 * Note: this is a 'super top' device like the above 14cd/6600 device */ 2027 * Note: this is a 'super top' device like the above 14cd/6600 device */
@@ -2086,27 +2051,6 @@ UNUSUAL_DEV( 0x22b8, 0x3010, 0x0001, 0x0001,
2086 US_FL_FIX_CAPACITY | US_FL_IGNORE_RESIDUE ), 2051 US_FL_FIX_CAPACITY | US_FL_IGNORE_RESIDUE ),
2087 2052
2088/* 2053/*
2089 * Patch by Pete Zaitcev <zaitcev@redhat.com>
2090 * Report by Mark Patton. Red Hat bz#208928.
2091 * Added support for rev 0x0002 (Motorola ROKR W5)
2092 * by Javier Smaldone <javier@smaldone.com.ar>
2093 */
2094UNUSUAL_DEV( 0x22b8, 0x4810, 0x0001, 0x0002,
2095 "Motorola",
2096 "RAZR V3i/ROKR W5",
2097 US_SC_DEVICE, US_PR_DEVICE, NULL,
2098 US_FL_FIX_CAPACITY),
2099
2100/*
2101 * Patch by Jost Diederichs <jost@qdusa.com>
2102 */
2103UNUSUAL_DEV(0x22b8, 0x6410, 0x0001, 0x9999,
2104 "Motorola Inc.",
2105 "Motorola Phone (RAZRV3xx)",
2106 US_SC_DEVICE, US_PR_DEVICE, NULL,
2107 US_FL_FIX_CAPACITY),
2108
2109/*
2110 * Patch by Constantin Baranov <const@tltsu.ru> 2054 * Patch by Constantin Baranov <const@tltsu.ru>
2111 * Report by Andreas Koenecke. 2055 * Report by Andreas Koenecke.
2112 * Motorola ROKR Z6. 2056 * Motorola ROKR Z6.
diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c
index 27016fd2cad1..4becf495ca2d 100644
--- a/drivers/usb/storage/usb.c
+++ b/drivers/usb/storage/usb.c
@@ -75,9 +75,6 @@
75#ifdef CONFIG_USB_STORAGE_SDDR55 75#ifdef CONFIG_USB_STORAGE_SDDR55
76#include "sddr55.h" 76#include "sddr55.h"
77#endif 77#endif
78#ifdef CONFIG_USB_STORAGE_DPCM
79#include "dpcm.h"
80#endif
81#ifdef CONFIG_USB_STORAGE_FREECOM 78#ifdef CONFIG_USB_STORAGE_FREECOM
82#include "freecom.h" 79#include "freecom.h"
83#endif 80#endif
@@ -103,6 +100,7 @@
103#include "cypress_atacb.h" 100#include "cypress_atacb.h"
104#endif 101#endif
105#include "sierra_ms.h" 102#include "sierra_ms.h"
103#include "option_ms.h"
106 104
107/* Some informational data */ 105/* Some informational data */
108MODULE_AUTHOR("Matthew Dharm <mdharm-usb@one-eyed-alien.net>"); 106MODULE_AUTHOR("Matthew Dharm <mdharm-usb@one-eyed-alien.net>");
@@ -113,6 +111,10 @@ static unsigned int delay_use = 5;
113module_param(delay_use, uint, S_IRUGO | S_IWUSR); 111module_param(delay_use, uint, S_IRUGO | S_IWUSR);
114MODULE_PARM_DESC(delay_use, "seconds to delay before using a new device"); 112MODULE_PARM_DESC(delay_use, "seconds to delay before using a new device");
115 113
114static char quirks[128];
115module_param_string(quirks, quirks, sizeof(quirks), S_IRUGO | S_IWUSR);
116MODULE_PARM_DESC(quirks, "supplemental list of device IDs and their quirks");
117
116 118
117/* 119/*
118 * The entries in this table correspond, line for line, 120 * The entries in this table correspond, line for line,
@@ -126,6 +128,8 @@ MODULE_PARM_DESC(delay_use, "seconds to delay before using a new device");
126{ USB_DEVICE_VER(id_vendor, id_product, bcdDeviceMin,bcdDeviceMax), \ 128{ USB_DEVICE_VER(id_vendor, id_product, bcdDeviceMin,bcdDeviceMax), \
127 .driver_info = (flags)|(USB_US_TYPE_STOR<<24) } 129 .driver_info = (flags)|(USB_US_TYPE_STOR<<24) }
128 130
131#define COMPLIANT_DEV UNUSUAL_DEV
132
129#define USUAL_DEV(useProto, useTrans, useType) \ 133#define USUAL_DEV(useProto, useTrans, useType) \
130{ USB_INTERFACE_INFO(USB_CLASS_MASS_STORAGE, useProto, useTrans), \ 134{ USB_INTERFACE_INFO(USB_CLASS_MASS_STORAGE, useProto, useTrans), \
131 .driver_info = (USB_US_TYPE_STOR<<24) } 135 .driver_info = (USB_US_TYPE_STOR<<24) }
@@ -134,6 +138,7 @@ static struct usb_device_id storage_usb_ids [] = {
134 138
135# include "unusual_devs.h" 139# include "unusual_devs.h"
136#undef UNUSUAL_DEV 140#undef UNUSUAL_DEV
141#undef COMPLIANT_DEV
137#undef USUAL_DEV 142#undef USUAL_DEV
138 /* Terminating entry */ 143 /* Terminating entry */
139 { } 144 { }
@@ -164,6 +169,8 @@ MODULE_DEVICE_TABLE (usb, storage_usb_ids);
164 .initFunction = init_function, \ 169 .initFunction = init_function, \
165} 170}
166 171
172#define COMPLIANT_DEV UNUSUAL_DEV
173
167#define USUAL_DEV(use_protocol, use_transport, use_type) \ 174#define USUAL_DEV(use_protocol, use_transport, use_type) \
168{ \ 175{ \
169 .useProtocol = use_protocol, \ 176 .useProtocol = use_protocol, \
@@ -173,6 +180,7 @@ MODULE_DEVICE_TABLE (usb, storage_usb_ids);
173static struct us_unusual_dev us_unusual_dev_list[] = { 180static struct us_unusual_dev us_unusual_dev_list[] = {
174# include "unusual_devs.h" 181# include "unusual_devs.h"
175# undef UNUSUAL_DEV 182# undef UNUSUAL_DEV
183# undef COMPLIANT_DEV
176# undef USUAL_DEV 184# undef USUAL_DEV
177 185
178 /* Terminating entry */ 186 /* Terminating entry */
@@ -464,13 +472,83 @@ static int associate_dev(struct us_data *us, struct usb_interface *intf)
464 US_DEBUGP("I/O buffer allocation failed\n"); 472 US_DEBUGP("I/O buffer allocation failed\n");
465 return -ENOMEM; 473 return -ENOMEM;
466 } 474 }
475 return 0;
476}
467 477
468 us->sensebuf = kmalloc(US_SENSE_SIZE, GFP_KERNEL); 478/* Works only for digits and letters, but small and fast */
469 if (!us->sensebuf) { 479#define TOLOWER(x) ((x) | 0x20)
470 US_DEBUGP("Sense buffer allocation failed\n"); 480
471 return -ENOMEM; 481/* Adjust device flags based on the "quirks=" module parameter */
482static void adjust_quirks(struct us_data *us)
483{
484 char *p;
485 u16 vid = le16_to_cpu(us->pusb_dev->descriptor.idVendor);
486 u16 pid = le16_to_cpu(us->pusb_dev->descriptor.idProduct);
487 unsigned f = 0;
488 unsigned int mask = (US_FL_SANE_SENSE | US_FL_FIX_CAPACITY |
489 US_FL_CAPACITY_HEURISTICS | US_FL_IGNORE_DEVICE |
490 US_FL_NOT_LOCKABLE | US_FL_MAX_SECTORS_64 |
491 US_FL_CAPACITY_OK | US_FL_IGNORE_RESIDUE |
492 US_FL_SINGLE_LUN | US_FL_NO_WP_DETECT);
493
494 p = quirks;
495 while (*p) {
496 /* Each entry consists of VID:PID:flags */
497 if (vid == simple_strtoul(p, &p, 16) &&
498 *p == ':' &&
499 pid == simple_strtoul(p+1, &p, 16) &&
500 *p == ':')
501 break;
502
503 /* Move forward to the next entry */
504 while (*p) {
505 if (*p++ == ',')
506 break;
507 }
472 } 508 }
473 return 0; 509 if (!*p) /* No match */
510 return;
511
512 /* Collect the flags */
513 while (*++p && *p != ',') {
514 switch (TOLOWER(*p)) {
515 case 'a':
516 f |= US_FL_SANE_SENSE;
517 break;
518 case 'c':
519 f |= US_FL_FIX_CAPACITY;
520 break;
521 case 'h':
522 f |= US_FL_CAPACITY_HEURISTICS;
523 break;
524 case 'i':
525 f |= US_FL_IGNORE_DEVICE;
526 break;
527 case 'l':
528 f |= US_FL_NOT_LOCKABLE;
529 break;
530 case 'm':
531 f |= US_FL_MAX_SECTORS_64;
532 break;
533 case 'o':
534 f |= US_FL_CAPACITY_OK;
535 break;
536 case 'r':
537 f |= US_FL_IGNORE_RESIDUE;
538 break;
539 case 's':
540 f |= US_FL_SINGLE_LUN;
541 break;
542 case 'w':
543 f |= US_FL_NO_WP_DETECT;
544 break;
545 /* Ignore unrecognized flag characters */
546 }
547 }
548 us->fflags = (us->fflags & ~mask) | f;
549 dev_info(&us->pusb_intf->dev, "Quirks match for "
550 "vid %04x pid %04x: %x\n",
551 vid, pid, f);
474} 552}
475 553
476/* Find an unusual_dev descriptor (always succeeds in the current code) */ 554/* Find an unusual_dev descriptor (always succeeds in the current code) */
@@ -497,6 +575,7 @@ static int get_device_info(struct us_data *us, const struct usb_device_id *id)
497 idesc->bInterfaceProtocol : 575 idesc->bInterfaceProtocol :
498 unusual_dev->useTransport; 576 unusual_dev->useTransport;
499 us->fflags = USB_US_ORIG_FLAGS(id->driver_info); 577 us->fflags = USB_US_ORIG_FLAGS(id->driver_info);
578 adjust_quirks(us);
500 579
501 if (us->fflags & US_FL_IGNORE_DEVICE) { 580 if (us->fflags & US_FL_IGNORE_DEVICE) {
502 printk(KERN_INFO USB_STORAGE "device ignored\n"); 581 printk(KERN_INFO USB_STORAGE "device ignored\n");
@@ -562,7 +641,7 @@ static int get_transport(struct us_data *us)
562 641
563 case US_PR_CBI: 642 case US_PR_CBI:
564 us->transport_name = "Control/Bulk/Interrupt"; 643 us->transport_name = "Control/Bulk/Interrupt";
565 us->transport = usb_stor_CBI_transport; 644 us->transport = usb_stor_CB_transport;
566 us->transport_reset = usb_stor_CB_reset; 645 us->transport_reset = usb_stor_CB_reset;
567 us->max_lun = 7; 646 us->max_lun = 7;
568 break; 647 break;
@@ -675,19 +754,19 @@ static int get_protocol(struct us_data *us)
675 754
676 case US_SC_8020: 755 case US_SC_8020:
677 us->protocol_name = "8020i"; 756 us->protocol_name = "8020i";
678 us->proto_handler = usb_stor_ATAPI_command; 757 us->proto_handler = usb_stor_pad12_command;
679 us->max_lun = 0; 758 us->max_lun = 0;
680 break; 759 break;
681 760
682 case US_SC_QIC: 761 case US_SC_QIC:
683 us->protocol_name = "QIC-157"; 762 us->protocol_name = "QIC-157";
684 us->proto_handler = usb_stor_qic157_command; 763 us->proto_handler = usb_stor_pad12_command;
685 us->max_lun = 0; 764 us->max_lun = 0;
686 break; 765 break;
687 766
688 case US_SC_8070: 767 case US_SC_8070:
689 us->protocol_name = "8070i"; 768 us->protocol_name = "8070i";
690 us->proto_handler = usb_stor_ATAPI_command; 769 us->proto_handler = usb_stor_pad12_command;
691 us->max_lun = 0; 770 us->max_lun = 0;
692 break; 771 break;
693 772
@@ -840,8 +919,6 @@ static void dissociate_dev(struct us_data *us)
840{ 919{
841 US_DEBUGP("-- %s\n", __func__); 920 US_DEBUGP("-- %s\n", __func__);
842 921
843 kfree(us->sensebuf);
844
845 /* Free the device-related DMA-mapped buffers */ 922 /* Free the device-related DMA-mapped buffers */
846 if (us->cr) 923 if (us->cr)
847 usb_buffer_free(us->pusb_dev, sizeof(*us->cr), us->cr, 924 usb_buffer_free(us->pusb_dev, sizeof(*us->cr), us->cr,
@@ -1064,6 +1141,7 @@ static struct usb_driver usb_storage_driver = {
1064static int __init usb_stor_init(void) 1141static int __init usb_stor_init(void)
1065{ 1142{
1066 int retval; 1143 int retval;
1144
1067 printk(KERN_INFO "Initializing USB Mass Storage driver...\n"); 1145 printk(KERN_INFO "Initializing USB Mass Storage driver...\n");
1068 1146
1069 /* register the driver, return usb_register return code if error */ 1147 /* register the driver, return usb_register return code if error */
diff --git a/drivers/usb/storage/usb.h b/drivers/usb/storage/usb.h
index a4ad73bd832d..65e674e4be99 100644
--- a/drivers/usb/storage/usb.h
+++ b/drivers/usb/storage/usb.h
@@ -138,7 +138,6 @@ struct us_data {
138 struct usb_ctrlrequest *cr; /* control requests */ 138 struct usb_ctrlrequest *cr; /* control requests */
139 struct usb_sg_request current_sg; /* scatter-gather req. */ 139 struct usb_sg_request current_sg; /* scatter-gather req. */
140 unsigned char *iobuf; /* I/O buffer */ 140 unsigned char *iobuf; /* I/O buffer */
141 unsigned char *sensebuf; /* sense data buffer */
142 dma_addr_t cr_dma; /* buffer DMA addresses */ 141 dma_addr_t cr_dma; /* buffer DMA addresses */
143 dma_addr_t iobuf_dma; 142 dma_addr_t iobuf_dma;
144 struct task_struct *ctl_thread; /* the control thread */ 143 struct task_struct *ctl_thread; /* the control thread */
@@ -155,6 +154,10 @@ struct us_data {
155#ifdef CONFIG_PM 154#ifdef CONFIG_PM
156 pm_hook suspend_resume_hook; 155 pm_hook suspend_resume_hook;
157#endif 156#endif
157
158 /* hacks for READ CAPACITY bug handling */
159 int use_last_sector_hacks;
160 int last_sector_retries;
158}; 161};
159 162
160/* Convert between us_data and the corresponding Scsi_Host */ 163/* Convert between us_data and the corresponding Scsi_Host */
diff --git a/drivers/usb/wusbcore/rh.c b/drivers/usb/wusbcore/rh.c
index 95c6fa3bf6b2..3937bf6f8cef 100644
--- a/drivers/usb/wusbcore/rh.c
+++ b/drivers/usb/wusbcore/rh.c
@@ -326,7 +326,7 @@ static int wusbhc_rh_clear_port_feat(struct wusbhc *wusbhc, u16 feature,
326static int wusbhc_rh_get_port_status(struct wusbhc *wusbhc, u16 port_idx, 326static int wusbhc_rh_get_port_status(struct wusbhc *wusbhc, u16 port_idx,
327 u32 *_buf, u16 wLength) 327 u32 *_buf, u16 wLength)
328{ 328{
329 u16 *buf = (u16 *) _buf; 329 __le16 *buf = (__le16 *)_buf;
330 330
331 if (port_idx > wusbhc->ports_max) 331 if (port_idx > wusbhc->ports_max)
332 return -EINVAL; 332 return -EINVAL;
diff --git a/drivers/uwb/i1480/dfu/usb.c b/drivers/uwb/i1480/dfu/usb.c
index 686795e97195..c7080d497311 100644
--- a/drivers/uwb/i1480/dfu/usb.c
+++ b/drivers/uwb/i1480/dfu/usb.c
@@ -387,7 +387,7 @@ int i1480_usb_probe(struct usb_interface *iface, const struct usb_device_id *id)
387 goto error_create; 387 goto error_create;
388 } 388 }
389 389
390 /* setup the fops and upload the firmare */ 390 /* setup the fops and upload the firmware */
391 i1480->pre_fw_name = "i1480-pre-phy-0.0.bin"; 391 i1480->pre_fw_name = "i1480-pre-phy-0.0.bin";
392 i1480->mac_fw_name = "i1480-usb-0.0.bin"; 392 i1480->mac_fw_name = "i1480-usb-0.0.bin";
393 i1480->mac_fw_name_deprecate = "ptc-0.0.bin"; 393 i1480->mac_fw_name_deprecate = "ptc-0.0.bin";
diff --git a/drivers/video/console/vgacon.c b/drivers/video/console/vgacon.c
index e6210725b9ab..d012edda6d11 100644
--- a/drivers/video/console/vgacon.c
+++ b/drivers/video/console/vgacon.c
@@ -1332,7 +1332,7 @@ static void vgacon_save_screen(struct vc_data *c)
1332 c->vc_y = screen_info.orig_y; 1332 c->vc_y = screen_info.orig_y;
1333 } 1333 }
1334 1334
1335 /* We can't copy in more then the size of the video buffer, 1335 /* We can't copy in more than the size of the video buffer,
1336 * or we'll be copying in VGA BIOS */ 1336 * or we'll be copying in VGA BIOS */
1337 1337
1338 if (!vga_is_gfx) 1338 if (!vga_is_gfx)
diff --git a/firmware/.gitignore b/firmware/.gitignore
index d9c69017bc9a..f89a21fffbf1 100644
--- a/firmware/.gitignore
+++ b/firmware/.gitignore
@@ -3,4 +3,3 @@
3*.bin 3*.bin
4*.csp 4*.csp
5*.dsp 5*.dsp
6ihex2fw
diff --git a/firmware/Makefile b/firmware/Makefile
index d872b7942a30..55d3082ea13e 100644
--- a/firmware/Makefile
+++ b/firmware/Makefile
@@ -99,10 +99,10 @@ quiet_cmd_ihex = IHEX $@
99 cmd_ihex = $(OBJCOPY) -Iihex -Obinary $< $@ 99 cmd_ihex = $(OBJCOPY) -Iihex -Obinary $< $@
100 100
101quiet_cmd_ihex2fw = IHEX2FW $@ 101quiet_cmd_ihex2fw = IHEX2FW $@
102 cmd_ihex2fw = $(objtree)/$(obj)/ihex2fw $< $@ 102 cmd_ihex2fw = $(objtree)/scripts/ihex2fw $< $@
103 103
104quiet_cmd_h16tofw = H16TOFW $@ 104quiet_cmd_h16tofw = H16TOFW $@
105 cmd_h16tofw = $(objtree)/$(obj)/ihex2fw -w $< $@ 105 cmd_h16tofw = $(objtree)/scripts/ihex2fw -w $< $@
106 106
107quiet_cmd_fwbin = MK_FW $@ 107quiet_cmd_fwbin = MK_FW $@
108 cmd_fwbin = FWNAME="$(patsubst firmware/%.gen.S,%,$@)"; \ 108 cmd_fwbin = FWNAME="$(patsubst firmware/%.gen.S,%,$@)"; \
@@ -165,11 +165,11 @@ $(obj)/%: $(obj)/%.ihex | $(objtree)/$(obj)/$$(dir %)
165# is actually meaningful, because the firmware has to be loaded in a certain 165# is actually meaningful, because the firmware has to be loaded in a certain
166# order rather than as a single binary blob. Thus, we convert them into our 166# order rather than as a single binary blob. Thus, we convert them into our
167# more compact binary representation of ihex records (<linux/ihex.h>) 167# more compact binary representation of ihex records (<linux/ihex.h>)
168$(obj)/%.fw: $(obj)/%.HEX $(obj)/ihex2fw | $(objtree)/$(obj)/$$(dir %) 168$(obj)/%.fw: $(obj)/%.HEX | $(objtree)/$(obj)/$$(dir %)
169 $(call cmd,ihex2fw) 169 $(call cmd,ihex2fw)
170 170
171# .H16 is our own modified form of Intel HEX, with 16-bit length for records. 171# .H16 is our own modified form of Intel HEX, with 16-bit length for records.
172$(obj)/%.fw: $(obj)/%.H16 $(obj)/ihex2fw | $(objtree)/$(obj)/$$(dir %) 172$(obj)/%.fw: $(obj)/%.H16 | $(objtree)/$(obj)/$$(dir %)
173 $(call cmd,h16tofw) 173 $(call cmd,h16tofw)
174 174
175$(firmware-dirs): 175$(firmware-dirs):
@@ -186,5 +186,3 @@ targets := $(fw-shipped-) $(patsubst $(obj)/%,%, \
186# Without this, built-in.o won't be created when it's empty, and the 186# Without this, built-in.o won't be created when it's empty, and the
187# final vmlinux link will fail. 187# final vmlinux link will fail.
188obj-n := dummy 188obj-n := dummy
189
190hostprogs-y := ihex2fw
diff --git a/fs/debugfs/file.c b/fs/debugfs/file.c
index 159a5efd6a8a..33a90120f6ad 100644
--- a/fs/debugfs/file.c
+++ b/fs/debugfs/file.c
@@ -294,6 +294,38 @@ struct dentry *debugfs_create_x32(const char *name, mode_t mode,
294} 294}
295EXPORT_SYMBOL_GPL(debugfs_create_x32); 295EXPORT_SYMBOL_GPL(debugfs_create_x32);
296 296
297
298static int debugfs_size_t_set(void *data, u64 val)
299{
300 *(size_t *)data = val;
301 return 0;
302}
303static int debugfs_size_t_get(void *data, u64 *val)
304{
305 *val = *(size_t *)data;
306 return 0;
307}
308DEFINE_SIMPLE_ATTRIBUTE(fops_size_t, debugfs_size_t_get, debugfs_size_t_set,
309 "%llu\n"); /* %llu and %zu are more or less the same */
310
311/**
312 * debugfs_create_size_t - create a debugfs file that is used to read and write an size_t value
313 * @name: a pointer to a string containing the name of the file to create.
314 * @mode: the permission that the file should have
315 * @parent: a pointer to the parent dentry for this file. This should be a
316 * directory dentry if set. If this parameter is %NULL, then the
317 * file will be created in the root of the debugfs filesystem.
318 * @value: a pointer to the variable that the file should read to and write
319 * from.
320 */
321struct dentry *debugfs_create_size_t(const char *name, mode_t mode,
322 struct dentry *parent, size_t *value)
323{
324 return debugfs_create_file(name, mode, parent, value, &fops_size_t);
325}
326EXPORT_SYMBOL_GPL(debugfs_create_size_t);
327
328
297static ssize_t read_file_bool(struct file *file, char __user *user_buf, 329static ssize_t read_file_bool(struct file *file, char __user *user_buf,
298 size_t count, loff_t *ppos) 330 size_t count, loff_t *ppos)
299{ 331{
diff --git a/fs/gfs2/Kconfig b/fs/gfs2/Kconfig
index ab2f57e3fb87..e563a6449811 100644
--- a/fs/gfs2/Kconfig
+++ b/fs/gfs2/Kconfig
@@ -1,6 +1,6 @@
1config GFS2_FS 1config GFS2_FS
2 tristate "GFS2 file system support" 2 tristate "GFS2 file system support"
3 depends on EXPERIMENTAL && (64BIT || (LSF && LBD)) 3 depends on EXPERIMENTAL && (64BIT || LBD)
4 select FS_POSIX_ACL 4 select FS_POSIX_ACL
5 select CRC32 5 select CRC32
6 help 6 help
diff --git a/fs/gfs2/ops_address.c b/fs/gfs2/ops_address.c
index 6e4ea36c6605..4ddab67867eb 100644
--- a/fs/gfs2/ops_address.c
+++ b/fs/gfs2/ops_address.c
@@ -675,6 +675,7 @@ static int gfs2_write_begin(struct file *file, struct address_space *mapping,
675 goto out_trans_fail; 675 goto out_trans_fail;
676 676
677 error = -ENOMEM; 677 error = -ENOMEM;
678 flags |= AOP_FLAG_NOFS;
678 page = grab_cache_page_write_begin(mapping, index, flags); 679 page = grab_cache_page_write_begin(mapping, index, flags);
679 *pagep = page; 680 *pagep = page;
680 if (unlikely(!page)) 681 if (unlikely(!page))
diff --git a/fs/gfs2/ops_file.c b/fs/gfs2/ops_file.c
index 289c5f54ba53..93fe41b67f97 100644
--- a/fs/gfs2/ops_file.c
+++ b/fs/gfs2/ops_file.c
@@ -342,7 +342,7 @@ static int gfs2_page_mkwrite(struct vm_area_struct *vma, struct page *page)
342 struct gfs2_inode *ip = GFS2_I(inode); 342 struct gfs2_inode *ip = GFS2_I(inode);
343 struct gfs2_sbd *sdp = GFS2_SB(inode); 343 struct gfs2_sbd *sdp = GFS2_SB(inode);
344 unsigned long last_index; 344 unsigned long last_index;
345 u64 pos = page->index << (PAGE_CACHE_SIZE - inode->i_blkbits); 345 u64 pos = page->index << PAGE_CACHE_SHIFT;
346 unsigned int data_blocks, ind_blocks, rblocks; 346 unsigned int data_blocks, ind_blocks, rblocks;
347 int alloc_required = 0; 347 int alloc_required = 0;
348 struct gfs2_holder gh; 348 struct gfs2_holder gh;
diff --git a/fs/inode.c b/fs/inode.c
index 7a6e8c2ff7b1..0013ac1af8e7 100644
--- a/fs/inode.c
+++ b/fs/inode.c
@@ -22,6 +22,7 @@
22#include <linux/bootmem.h> 22#include <linux/bootmem.h>
23#include <linux/inotify.h> 23#include <linux/inotify.h>
24#include <linux/mount.h> 24#include <linux/mount.h>
25#include <linux/async.h>
25 26
26/* 27/*
27 * This is needed for the following functions: 28 * This is needed for the following functions:
@@ -1138,16 +1139,11 @@ EXPORT_SYMBOL(remove_inode_hash);
1138 * I_FREEING is set so that no-one will take a new reference to the inode while 1139 * I_FREEING is set so that no-one will take a new reference to the inode while
1139 * it is being deleted. 1140 * it is being deleted.
1140 */ 1141 */
1141void generic_delete_inode(struct inode *inode) 1142static void generic_delete_inode_async(void *data, async_cookie_t cookie)
1142{ 1143{
1144 struct inode *inode = data;
1143 const struct super_operations *op = inode->i_sb->s_op; 1145 const struct super_operations *op = inode->i_sb->s_op;
1144 1146
1145 list_del_init(&inode->i_list);
1146 list_del_init(&inode->i_sb_list);
1147 inode->i_state |= I_FREEING;
1148 inodes_stat.nr_inodes--;
1149 spin_unlock(&inode_lock);
1150
1151 security_inode_delete(inode); 1147 security_inode_delete(inode);
1152 1148
1153 if (op->delete_inode) { 1149 if (op->delete_inode) {
@@ -1171,6 +1167,16 @@ void generic_delete_inode(struct inode *inode)
1171 destroy_inode(inode); 1167 destroy_inode(inode);
1172} 1168}
1173 1169
1170void generic_delete_inode(struct inode *inode)
1171{
1172 list_del_init(&inode->i_list);
1173 list_del_init(&inode->i_sb_list);
1174 inode->i_state |= I_FREEING;
1175 inodes_stat.nr_inodes--;
1176 spin_unlock(&inode_lock);
1177 async_schedule_special(generic_delete_inode_async, inode, &inode->i_sb->s_async_list);
1178}
1179
1174EXPORT_SYMBOL(generic_delete_inode); 1180EXPORT_SYMBOL(generic_delete_inode);
1175 1181
1176static void generic_forget_inode(struct inode *inode) 1182static void generic_forget_inode(struct inode *inode)
diff --git a/fs/ncpfs/ioctl.c b/fs/ncpfs/ioctl.c
index 6d04e050c74e..f54360f50a9c 100644
--- a/fs/ncpfs/ioctl.c
+++ b/fs/ncpfs/ioctl.c
@@ -98,7 +98,7 @@ struct compat_ncp_objectname_ioctl
98{ 98{
99 s32 auth_type; 99 s32 auth_type;
100 u32 object_name_len; 100 u32 object_name_len;
101 compat_caddr_t object_name; /* an userspace data, in most cases user name */ 101 compat_caddr_t object_name; /* a userspace data, in most cases user name */
102}; 102};
103 103
104struct compat_ncp_fs_info_v2 { 104struct compat_ncp_fs_info_v2 {
diff --git a/fs/ocfs2/cluster/heartbeat.c b/fs/ocfs2/cluster/heartbeat.c
index 6ebaa58e2c03..04697ba7f73e 100644
--- a/fs/ocfs2/cluster/heartbeat.c
+++ b/fs/ocfs2/cluster/heartbeat.c
@@ -854,7 +854,7 @@ static int o2hb_thread(void *data)
854 854
855 while (!kthread_should_stop() && !reg->hr_unclean_stop) { 855 while (!kthread_should_stop() && !reg->hr_unclean_stop) {
856 /* We track the time spent inside 856 /* We track the time spent inside
857 * o2hb_do_disk_heartbeat so that we avoid more then 857 * o2hb_do_disk_heartbeat so that we avoid more than
858 * hr_timeout_ms between disk writes. On busy systems 858 * hr_timeout_ms between disk writes. On busy systems
859 * this should result in a heartbeat which is less 859 * this should result in a heartbeat which is less
860 * likely to time itself out. */ 860 * likely to time itself out. */
diff --git a/fs/proc/base.c b/fs/proc/base.c
index 10fd5223d600..0c9de19a1633 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -65,6 +65,7 @@
65#include <linux/mm.h> 65#include <linux/mm.h>
66#include <linux/rcupdate.h> 66#include <linux/rcupdate.h>
67#include <linux/kallsyms.h> 67#include <linux/kallsyms.h>
68#include <linux/stacktrace.h>
68#include <linux/resource.h> 69#include <linux/resource.h>
69#include <linux/module.h> 70#include <linux/module.h>
70#include <linux/mount.h> 71#include <linux/mount.h>
@@ -109,25 +110,22 @@ struct pid_entry {
109 .op = OP, \ 110 .op = OP, \
110} 111}
111 112
112#define DIR(NAME, MODE, OTYPE) \ 113#define DIR(NAME, MODE, iops, fops) \
113 NOD(NAME, (S_IFDIR|(MODE)), \ 114 NOD(NAME, (S_IFDIR|(MODE)), &iops, &fops, {} )
114 &proc_##OTYPE##_inode_operations, &proc_##OTYPE##_operations, \ 115#define LNK(NAME, get_link) \
115 {} )
116#define LNK(NAME, OTYPE) \
117 NOD(NAME, (S_IFLNK|S_IRWXUGO), \ 116 NOD(NAME, (S_IFLNK|S_IRWXUGO), \
118 &proc_pid_link_inode_operations, NULL, \ 117 &proc_pid_link_inode_operations, NULL, \
119 { .proc_get_link = &proc_##OTYPE##_link } ) 118 { .proc_get_link = get_link } )
120#define REG(NAME, MODE, OTYPE) \ 119#define REG(NAME, MODE, fops) \
121 NOD(NAME, (S_IFREG|(MODE)), NULL, \ 120 NOD(NAME, (S_IFREG|(MODE)), NULL, &fops, {})
122 &proc_##OTYPE##_operations, {}) 121#define INF(NAME, MODE, read) \
123#define INF(NAME, MODE, OTYPE) \
124 NOD(NAME, (S_IFREG|(MODE)), \ 122 NOD(NAME, (S_IFREG|(MODE)), \
125 NULL, &proc_info_file_operations, \ 123 NULL, &proc_info_file_operations, \
126 { .proc_read = &proc_##OTYPE } ) 124 { .proc_read = read } )
127#define ONE(NAME, MODE, OTYPE) \ 125#define ONE(NAME, MODE, show) \
128 NOD(NAME, (S_IFREG|(MODE)), \ 126 NOD(NAME, (S_IFREG|(MODE)), \
129 NULL, &proc_single_file_operations, \ 127 NULL, &proc_single_file_operations, \
130 { .proc_show = &proc_##OTYPE } ) 128 { .proc_show = show } )
131 129
132/* 130/*
133 * Count the number of hardlinks for the pid_entry table, excluding the . 131 * Count the number of hardlinks for the pid_entry table, excluding the .
@@ -308,9 +306,9 @@ static int proc_pid_auxv(struct task_struct *task, char *buffer)
308 struct mm_struct *mm = get_task_mm(task); 306 struct mm_struct *mm = get_task_mm(task);
309 if (mm) { 307 if (mm) {
310 unsigned int nwords = 0; 308 unsigned int nwords = 0;
311 do 309 do {
312 nwords += 2; 310 nwords += 2;
313 while (mm->saved_auxv[nwords - 2] != 0); /* AT_NULL */ 311 } while (mm->saved_auxv[nwords - 2] != 0); /* AT_NULL */
314 res = nwords * sizeof(mm->saved_auxv[0]); 312 res = nwords * sizeof(mm->saved_auxv[0]);
315 if (res > PAGE_SIZE) 313 if (res > PAGE_SIZE)
316 res = PAGE_SIZE; 314 res = PAGE_SIZE;
@@ -340,6 +338,37 @@ static int proc_pid_wchan(struct task_struct *task, char *buffer)
340} 338}
341#endif /* CONFIG_KALLSYMS */ 339#endif /* CONFIG_KALLSYMS */
342 340
341#ifdef CONFIG_STACKTRACE
342
343#define MAX_STACK_TRACE_DEPTH 64
344
345static int proc_pid_stack(struct seq_file *m, struct pid_namespace *ns,
346 struct pid *pid, struct task_struct *task)
347{
348 struct stack_trace trace;
349 unsigned long *entries;
350 int i;
351
352 entries = kmalloc(MAX_STACK_TRACE_DEPTH * sizeof(*entries), GFP_KERNEL);
353 if (!entries)
354 return -ENOMEM;
355
356 trace.nr_entries = 0;
357 trace.max_entries = MAX_STACK_TRACE_DEPTH;
358 trace.entries = entries;
359 trace.skip = 0;
360 save_stack_trace_tsk(task, &trace);
361
362 for (i = 0; i < trace.nr_entries; i++) {
363 seq_printf(m, "[<%p>] %pS\n",
364 (void *)entries[i], (void *)entries[i]);
365 }
366 kfree(entries);
367
368 return 0;
369}
370#endif
371
343#ifdef CONFIG_SCHEDSTATS 372#ifdef CONFIG_SCHEDSTATS
344/* 373/*
345 * Provides /proc/PID/schedstat 374 * Provides /proc/PID/schedstat
@@ -1186,8 +1215,6 @@ static int sched_show(struct seq_file *m, void *v)
1186 struct inode *inode = m->private; 1215 struct inode *inode = m->private;
1187 struct task_struct *p; 1216 struct task_struct *p;
1188 1217
1189 WARN_ON(!inode);
1190
1191 p = get_proc_task(inode); 1218 p = get_proc_task(inode);
1192 if (!p) 1219 if (!p)
1193 return -ESRCH; 1220 return -ESRCH;
@@ -1205,8 +1232,6 @@ sched_write(struct file *file, const char __user *buf,
1205 struct inode *inode = file->f_path.dentry->d_inode; 1232 struct inode *inode = file->f_path.dentry->d_inode;
1206 struct task_struct *p; 1233 struct task_struct *p;
1207 1234
1208 WARN_ON(!inode);
1209
1210 p = get_proc_task(inode); 1235 p = get_proc_task(inode);
1211 if (!p) 1236 if (!p)
1212 return -ESRCH; 1237 return -ESRCH;
@@ -1974,13 +1999,11 @@ static struct dentry *proc_pident_lookup(struct inode *dir,
1974 const struct pid_entry *ents, 1999 const struct pid_entry *ents,
1975 unsigned int nents) 2000 unsigned int nents)
1976{ 2001{
1977 struct inode *inode;
1978 struct dentry *error; 2002 struct dentry *error;
1979 struct task_struct *task = get_proc_task(dir); 2003 struct task_struct *task = get_proc_task(dir);
1980 const struct pid_entry *p, *last; 2004 const struct pid_entry *p, *last;
1981 2005
1982 error = ERR_PTR(-ENOENT); 2006 error = ERR_PTR(-ENOENT);
1983 inode = NULL;
1984 2007
1985 if (!task) 2008 if (!task)
1986 goto out_no_task; 2009 goto out_no_task;
@@ -2136,12 +2159,12 @@ static const struct file_operations proc_pid_attr_operations = {
2136}; 2159};
2137 2160
2138static const struct pid_entry attr_dir_stuff[] = { 2161static const struct pid_entry attr_dir_stuff[] = {
2139 REG("current", S_IRUGO|S_IWUGO, pid_attr), 2162 REG("current", S_IRUGO|S_IWUGO, proc_pid_attr_operations),
2140 REG("prev", S_IRUGO, pid_attr), 2163 REG("prev", S_IRUGO, proc_pid_attr_operations),
2141 REG("exec", S_IRUGO|S_IWUGO, pid_attr), 2164 REG("exec", S_IRUGO|S_IWUGO, proc_pid_attr_operations),
2142 REG("fscreate", S_IRUGO|S_IWUGO, pid_attr), 2165 REG("fscreate", S_IRUGO|S_IWUGO, proc_pid_attr_operations),
2143 REG("keycreate", S_IRUGO|S_IWUGO, pid_attr), 2166 REG("keycreate", S_IRUGO|S_IWUGO, proc_pid_attr_operations),
2144 REG("sockcreate", S_IRUGO|S_IWUGO, pid_attr), 2167 REG("sockcreate", S_IRUGO|S_IWUGO, proc_pid_attr_operations),
2145}; 2168};
2146 2169
2147static int proc_attr_dir_readdir(struct file * filp, 2170static int proc_attr_dir_readdir(struct file * filp,
@@ -2461,74 +2484,77 @@ static const struct file_operations proc_task_operations;
2461static const struct inode_operations proc_task_inode_operations; 2484static const struct inode_operations proc_task_inode_operations;
2462 2485
2463static const struct pid_entry tgid_base_stuff[] = { 2486static const struct pid_entry tgid_base_stuff[] = {
2464 DIR("task", S_IRUGO|S_IXUGO, task), 2487 DIR("task", S_IRUGO|S_IXUGO, proc_task_inode_operations, proc_task_operations),
2465 DIR("fd", S_IRUSR|S_IXUSR, fd), 2488 DIR("fd", S_IRUSR|S_IXUSR, proc_fd_inode_operations, proc_fd_operations),
2466 DIR("fdinfo", S_IRUSR|S_IXUSR, fdinfo), 2489 DIR("fdinfo", S_IRUSR|S_IXUSR, proc_fdinfo_inode_operations, proc_fdinfo_operations),
2467#ifdef CONFIG_NET 2490#ifdef CONFIG_NET
2468 DIR("net", S_IRUGO|S_IXUGO, net), 2491 DIR("net", S_IRUGO|S_IXUGO, proc_net_inode_operations, proc_net_operations),
2469#endif 2492#endif
2470 REG("environ", S_IRUSR, environ), 2493 REG("environ", S_IRUSR, proc_environ_operations),
2471 INF("auxv", S_IRUSR, pid_auxv), 2494 INF("auxv", S_IRUSR, proc_pid_auxv),
2472 ONE("status", S_IRUGO, pid_status), 2495 ONE("status", S_IRUGO, proc_pid_status),
2473 ONE("personality", S_IRUSR, pid_personality), 2496 ONE("personality", S_IRUSR, proc_pid_personality),
2474 INF("limits", S_IRUSR, pid_limits), 2497 INF("limits", S_IRUSR, proc_pid_limits),
2475#ifdef CONFIG_SCHED_DEBUG 2498#ifdef CONFIG_SCHED_DEBUG
2476 REG("sched", S_IRUGO|S_IWUSR, pid_sched), 2499 REG("sched", S_IRUGO|S_IWUSR, proc_pid_sched_operations),
2477#endif 2500#endif
2478#ifdef CONFIG_HAVE_ARCH_TRACEHOOK 2501#ifdef CONFIG_HAVE_ARCH_TRACEHOOK
2479 INF("syscall", S_IRUSR, pid_syscall), 2502 INF("syscall", S_IRUSR, proc_pid_syscall),
2480#endif 2503#endif
2481 INF("cmdline", S_IRUGO, pid_cmdline), 2504 INF("cmdline", S_IRUGO, proc_pid_cmdline),
2482 ONE("stat", S_IRUGO, tgid_stat), 2505 ONE("stat", S_IRUGO, proc_tgid_stat),
2483 ONE("statm", S_IRUGO, pid_statm), 2506 ONE("statm", S_IRUGO, proc_pid_statm),
2484 REG("maps", S_IRUGO, maps), 2507 REG("maps", S_IRUGO, proc_maps_operations),
2485#ifdef CONFIG_NUMA 2508#ifdef CONFIG_NUMA
2486 REG("numa_maps", S_IRUGO, numa_maps), 2509 REG("numa_maps", S_IRUGO, proc_numa_maps_operations),
2487#endif 2510#endif
2488 REG("mem", S_IRUSR|S_IWUSR, mem), 2511 REG("mem", S_IRUSR|S_IWUSR, proc_mem_operations),
2489 LNK("cwd", cwd), 2512 LNK("cwd", proc_cwd_link),
2490 LNK("root", root), 2513 LNK("root", proc_root_link),
2491 LNK("exe", exe), 2514 LNK("exe", proc_exe_link),
2492 REG("mounts", S_IRUGO, mounts), 2515 REG("mounts", S_IRUGO, proc_mounts_operations),
2493 REG("mountinfo", S_IRUGO, mountinfo), 2516 REG("mountinfo", S_IRUGO, proc_mountinfo_operations),
2494 REG("mountstats", S_IRUSR, mountstats), 2517 REG("mountstats", S_IRUSR, proc_mountstats_operations),
2495#ifdef CONFIG_PROC_PAGE_MONITOR 2518#ifdef CONFIG_PROC_PAGE_MONITOR
2496 REG("clear_refs", S_IWUSR, clear_refs), 2519 REG("clear_refs", S_IWUSR, proc_clear_refs_operations),
2497 REG("smaps", S_IRUGO, smaps), 2520 REG("smaps", S_IRUGO, proc_smaps_operations),
2498 REG("pagemap", S_IRUSR, pagemap), 2521 REG("pagemap", S_IRUSR, proc_pagemap_operations),
2499#endif 2522#endif
2500#ifdef CONFIG_SECURITY 2523#ifdef CONFIG_SECURITY
2501 DIR("attr", S_IRUGO|S_IXUGO, attr_dir), 2524 DIR("attr", S_IRUGO|S_IXUGO, proc_attr_dir_inode_operations, proc_attr_dir_operations),
2502#endif 2525#endif
2503#ifdef CONFIG_KALLSYMS 2526#ifdef CONFIG_KALLSYMS
2504 INF("wchan", S_IRUGO, pid_wchan), 2527 INF("wchan", S_IRUGO, proc_pid_wchan),
2528#endif
2529#ifdef CONFIG_STACKTRACE
2530 ONE("stack", S_IRUSR, proc_pid_stack),
2505#endif 2531#endif
2506#ifdef CONFIG_SCHEDSTATS 2532#ifdef CONFIG_SCHEDSTATS
2507 INF("schedstat", S_IRUGO, pid_schedstat), 2533 INF("schedstat", S_IRUGO, proc_pid_schedstat),
2508#endif 2534#endif
2509#ifdef CONFIG_LATENCYTOP 2535#ifdef CONFIG_LATENCYTOP
2510 REG("latency", S_IRUGO, lstats), 2536 REG("latency", S_IRUGO, proc_lstats_operations),
2511#endif 2537#endif
2512#ifdef CONFIG_PROC_PID_CPUSET 2538#ifdef CONFIG_PROC_PID_CPUSET
2513 REG("cpuset", S_IRUGO, cpuset), 2539 REG("cpuset", S_IRUGO, proc_cpuset_operations),
2514#endif 2540#endif
2515#ifdef CONFIG_CGROUPS 2541#ifdef CONFIG_CGROUPS
2516 REG("cgroup", S_IRUGO, cgroup), 2542 REG("cgroup", S_IRUGO, proc_cgroup_operations),
2517#endif 2543#endif
2518 INF("oom_score", S_IRUGO, oom_score), 2544 INF("oom_score", S_IRUGO, proc_oom_score),
2519 REG("oom_adj", S_IRUGO|S_IWUSR, oom_adjust), 2545 REG("oom_adj", S_IRUGO|S_IWUSR, proc_oom_adjust_operations),
2520#ifdef CONFIG_AUDITSYSCALL 2546#ifdef CONFIG_AUDITSYSCALL
2521 REG("loginuid", S_IWUSR|S_IRUGO, loginuid), 2547 REG("loginuid", S_IWUSR|S_IRUGO, proc_loginuid_operations),
2522 REG("sessionid", S_IRUGO, sessionid), 2548 REG("sessionid", S_IRUGO, proc_sessionid_operations),
2523#endif 2549#endif
2524#ifdef CONFIG_FAULT_INJECTION 2550#ifdef CONFIG_FAULT_INJECTION
2525 REG("make-it-fail", S_IRUGO|S_IWUSR, fault_inject), 2551 REG("make-it-fail", S_IRUGO|S_IWUSR, proc_fault_inject_operations),
2526#endif 2552#endif
2527#if defined(USE_ELF_CORE_DUMP) && defined(CONFIG_ELF_CORE) 2553#if defined(USE_ELF_CORE_DUMP) && defined(CONFIG_ELF_CORE)
2528 REG("coredump_filter", S_IRUGO|S_IWUSR, coredump_filter), 2554 REG("coredump_filter", S_IRUGO|S_IWUSR, proc_coredump_filter_operations),
2529#endif 2555#endif
2530#ifdef CONFIG_TASK_IO_ACCOUNTING 2556#ifdef CONFIG_TASK_IO_ACCOUNTING
2531 INF("io", S_IRUGO, tgid_io_accounting), 2557 INF("io", S_IRUGO, proc_tgid_io_accounting),
2532#endif 2558#endif
2533}; 2559};
2534 2560
@@ -2801,66 +2827,69 @@ out_no_task:
2801 * Tasks 2827 * Tasks
2802 */ 2828 */
2803static const struct pid_entry tid_base_stuff[] = { 2829static const struct pid_entry tid_base_stuff[] = {
2804 DIR("fd", S_IRUSR|S_IXUSR, fd), 2830 DIR("fd", S_IRUSR|S_IXUSR, proc_fd_inode_operations, proc_fd_operations),
2805 DIR("fdinfo", S_IRUSR|S_IXUSR, fdinfo), 2831 DIR("fdinfo", S_IRUSR|S_IXUSR, proc_fdinfo_inode_operations, proc_fd_operations),
2806 REG("environ", S_IRUSR, environ), 2832 REG("environ", S_IRUSR, proc_environ_operations),
2807 INF("auxv", S_IRUSR, pid_auxv), 2833 INF("auxv", S_IRUSR, proc_pid_auxv),
2808 ONE("status", S_IRUGO, pid_status), 2834 ONE("status", S_IRUGO, proc_pid_status),
2809 ONE("personality", S_IRUSR, pid_personality), 2835 ONE("personality", S_IRUSR, proc_pid_personality),
2810 INF("limits", S_IRUSR, pid_limits), 2836 INF("limits", S_IRUSR, proc_pid_limits),
2811#ifdef CONFIG_SCHED_DEBUG 2837#ifdef CONFIG_SCHED_DEBUG
2812 REG("sched", S_IRUGO|S_IWUSR, pid_sched), 2838 REG("sched", S_IRUGO|S_IWUSR, proc_pid_sched_operations),
2813#endif 2839#endif
2814#ifdef CONFIG_HAVE_ARCH_TRACEHOOK 2840#ifdef CONFIG_HAVE_ARCH_TRACEHOOK
2815 INF("syscall", S_IRUSR, pid_syscall), 2841 INF("syscall", S_IRUSR, proc_pid_syscall),
2816#endif 2842#endif
2817 INF("cmdline", S_IRUGO, pid_cmdline), 2843 INF("cmdline", S_IRUGO, proc_pid_cmdline),
2818 ONE("stat", S_IRUGO, tid_stat), 2844 ONE("stat", S_IRUGO, proc_tid_stat),
2819 ONE("statm", S_IRUGO, pid_statm), 2845 ONE("statm", S_IRUGO, proc_pid_statm),
2820 REG("maps", S_IRUGO, maps), 2846 REG("maps", S_IRUGO, proc_maps_operations),
2821#ifdef CONFIG_NUMA 2847#ifdef CONFIG_NUMA
2822 REG("numa_maps", S_IRUGO, numa_maps), 2848 REG("numa_maps", S_IRUGO, proc_numa_maps_operations),
2823#endif 2849#endif
2824 REG("mem", S_IRUSR|S_IWUSR, mem), 2850 REG("mem", S_IRUSR|S_IWUSR, proc_mem_operations),
2825 LNK("cwd", cwd), 2851 LNK("cwd", proc_cwd_link),
2826 LNK("root", root), 2852 LNK("root", proc_root_link),
2827 LNK("exe", exe), 2853 LNK("exe", proc_exe_link),
2828 REG("mounts", S_IRUGO, mounts), 2854 REG("mounts", S_IRUGO, proc_mounts_operations),
2829 REG("mountinfo", S_IRUGO, mountinfo), 2855 REG("mountinfo", S_IRUGO, proc_mountinfo_operations),
2830#ifdef CONFIG_PROC_PAGE_MONITOR 2856#ifdef CONFIG_PROC_PAGE_MONITOR
2831 REG("clear_refs", S_IWUSR, clear_refs), 2857 REG("clear_refs", S_IWUSR, proc_clear_refs_operations),
2832 REG("smaps", S_IRUGO, smaps), 2858 REG("smaps", S_IRUGO, proc_smaps_operations),
2833 REG("pagemap", S_IRUSR, pagemap), 2859 REG("pagemap", S_IRUSR, proc_pagemap_operations),
2834#endif 2860#endif
2835#ifdef CONFIG_SECURITY 2861#ifdef CONFIG_SECURITY
2836 DIR("attr", S_IRUGO|S_IXUGO, attr_dir), 2862 DIR("attr", S_IRUGO|S_IXUGO, proc_attr_dir_inode_operations, proc_attr_dir_operations),
2837#endif 2863#endif
2838#ifdef CONFIG_KALLSYMS 2864#ifdef CONFIG_KALLSYMS
2839 INF("wchan", S_IRUGO, pid_wchan), 2865 INF("wchan", S_IRUGO, proc_pid_wchan),
2866#endif
2867#ifdef CONFIG_STACKTRACE
2868 ONE("stack", S_IRUSR, proc_pid_stack),
2840#endif 2869#endif
2841#ifdef CONFIG_SCHEDSTATS 2870#ifdef CONFIG_SCHEDSTATS
2842 INF("schedstat", S_IRUGO, pid_schedstat), 2871 INF("schedstat", S_IRUGO, proc_pid_schedstat),
2843#endif 2872#endif
2844#ifdef CONFIG_LATENCYTOP 2873#ifdef CONFIG_LATENCYTOP
2845 REG("latency", S_IRUGO, lstats), 2874 REG("latency", S_IRUGO, proc_lstats_operations),
2846#endif 2875#endif
2847#ifdef CONFIG_PROC_PID_CPUSET 2876#ifdef CONFIG_PROC_PID_CPUSET
2848 REG("cpuset", S_IRUGO, cpuset), 2877 REG("cpuset", S_IRUGO, proc_cpuset_operations),
2849#endif 2878#endif
2850#ifdef CONFIG_CGROUPS 2879#ifdef CONFIG_CGROUPS
2851 REG("cgroup", S_IRUGO, cgroup), 2880 REG("cgroup", S_IRUGO, proc_cgroup_operations),
2852#endif 2881#endif
2853 INF("oom_score", S_IRUGO, oom_score), 2882 INF("oom_score", S_IRUGO, proc_oom_score),
2854 REG("oom_adj", S_IRUGO|S_IWUSR, oom_adjust), 2883 REG("oom_adj", S_IRUGO|S_IWUSR, proc_oom_adjust_operations),
2855#ifdef CONFIG_AUDITSYSCALL 2884#ifdef CONFIG_AUDITSYSCALL
2856 REG("loginuid", S_IWUSR|S_IRUGO, loginuid), 2885 REG("loginuid", S_IWUSR|S_IRUGO, proc_loginuid_operations),
2857 REG("sessionid", S_IRUSR, sessionid), 2886 REG("sessionid", S_IRUSR, proc_sessionid_operations),
2858#endif 2887#endif
2859#ifdef CONFIG_FAULT_INJECTION 2888#ifdef CONFIG_FAULT_INJECTION
2860 REG("make-it-fail", S_IRUGO|S_IWUSR, fault_inject), 2889 REG("make-it-fail", S_IRUGO|S_IWUSR, proc_fault_inject_operations),
2861#endif 2890#endif
2862#ifdef CONFIG_TASK_IO_ACCOUNTING 2891#ifdef CONFIG_TASK_IO_ACCOUNTING
2863 INF("io", S_IRUGO, tid_io_accounting), 2892 INF("io", S_IRUGO, proc_tid_io_accounting),
2864#endif 2893#endif
2865}; 2894};
2866 2895
diff --git a/fs/proc/generic.c b/fs/proc/generic.c
index 60a359b35582..db7fa5cab988 100644
--- a/fs/proc/generic.c
+++ b/fs/proc/generic.c
@@ -14,7 +14,6 @@
14#include <linux/stat.h> 14#include <linux/stat.h>
15#include <linux/module.h> 15#include <linux/module.h>
16#include <linux/mount.h> 16#include <linux/mount.h>
17#include <linux/smp_lock.h>
18#include <linux/init.h> 17#include <linux/init.h>
19#include <linux/idr.h> 18#include <linux/idr.h>
20#include <linux/namei.h> 19#include <linux/namei.h>
@@ -379,7 +378,6 @@ struct dentry *proc_lookup_de(struct proc_dir_entry *de, struct inode *dir,
379 struct inode *inode = NULL; 378 struct inode *inode = NULL;
380 int error = -ENOENT; 379 int error = -ENOENT;
381 380
382 lock_kernel();
383 spin_lock(&proc_subdir_lock); 381 spin_lock(&proc_subdir_lock);
384 for (de = de->subdir; de ; de = de->next) { 382 for (de = de->subdir; de ; de = de->next) {
385 if (de->namelen != dentry->d_name.len) 383 if (de->namelen != dentry->d_name.len)
@@ -397,7 +395,6 @@ struct dentry *proc_lookup_de(struct proc_dir_entry *de, struct inode *dir,
397 } 395 }
398 spin_unlock(&proc_subdir_lock); 396 spin_unlock(&proc_subdir_lock);
399out_unlock: 397out_unlock:
400 unlock_kernel();
401 398
402 if (inode) { 399 if (inode) {
403 dentry->d_op = &proc_dentry_operations; 400 dentry->d_op = &proc_dentry_operations;
@@ -432,8 +429,6 @@ int proc_readdir_de(struct proc_dir_entry *de, struct file *filp, void *dirent,
432 struct inode *inode = filp->f_path.dentry->d_inode; 429 struct inode *inode = filp->f_path.dentry->d_inode;
433 int ret = 0; 430 int ret = 0;
434 431
435 lock_kernel();
436
437 ino = inode->i_ino; 432 ino = inode->i_ino;
438 i = filp->f_pos; 433 i = filp->f_pos;
439 switch (i) { 434 switch (i) {
@@ -487,7 +482,7 @@ int proc_readdir_de(struct proc_dir_entry *de, struct file *filp, void *dirent,
487 spin_unlock(&proc_subdir_lock); 482 spin_unlock(&proc_subdir_lock);
488 } 483 }
489 ret = 1; 484 ret = 1;
490out: unlock_kernel(); 485out:
491 return ret; 486 return ret;
492} 487}
493 488
@@ -504,6 +499,7 @@ int proc_readdir(struct file *filp, void *dirent, filldir_t filldir)
504 * the /proc directory. 499 * the /proc directory.
505 */ 500 */
506static const struct file_operations proc_dir_operations = { 501static const struct file_operations proc_dir_operations = {
502 .llseek = generic_file_llseek,
507 .read = generic_read_dir, 503 .read = generic_read_dir,
508 .readdir = proc_readdir, 504 .readdir = proc_readdir,
509}; 505};
diff --git a/fs/proc/inode.c b/fs/proc/inode.c
index 2543fd00c658..3e76bb9b3ad6 100644
--- a/fs/proc/inode.c
+++ b/fs/proc/inode.c
@@ -35,16 +35,13 @@ struct proc_dir_entry *de_get(struct proc_dir_entry *de)
35 */ 35 */
36void de_put(struct proc_dir_entry *de) 36void de_put(struct proc_dir_entry *de)
37{ 37{
38 lock_kernel();
39 if (!atomic_read(&de->count)) { 38 if (!atomic_read(&de->count)) {
40 printk("de_put: entry %s already free!\n", de->name); 39 printk("de_put: entry %s already free!\n", de->name);
41 unlock_kernel();
42 return; 40 return;
43 } 41 }
44 42
45 if (atomic_dec_and_test(&de->count)) 43 if (atomic_dec_and_test(&de->count))
46 free_proc_entry(de); 44 free_proc_entry(de);
47 unlock_kernel();
48} 45}
49 46
50/* 47/*
diff --git a/fs/proc/proc_net.c b/fs/proc/proc_net.c
index 7bc296f424ae..04d1270f1c38 100644
--- a/fs/proc/proc_net.c
+++ b/fs/proc/proc_net.c
@@ -18,7 +18,6 @@
18#include <linux/sched.h> 18#include <linux/sched.h>
19#include <linux/module.h> 19#include <linux/module.h>
20#include <linux/bitops.h> 20#include <linux/bitops.h>
21#include <linux/smp_lock.h>
22#include <linux/mount.h> 21#include <linux/mount.h>
23#include <linux/nsproxy.h> 22#include <linux/nsproxy.h>
24#include <net/net_namespace.h> 23#include <net/net_namespace.h>
@@ -172,6 +171,7 @@ static int proc_tgid_net_readdir(struct file *filp, void *dirent,
172} 171}
173 172
174const struct file_operations proc_net_operations = { 173const struct file_operations proc_net_operations = {
174 .llseek = generic_file_llseek,
175 .read = generic_read_dir, 175 .read = generic_read_dir,
176 .readdir = proc_tgid_net_readdir, 176 .readdir = proc_tgid_net_readdir,
177}; 177};
diff --git a/fs/proc/root.c b/fs/proc/root.c
index 7761602af9de..f6299a25594e 100644
--- a/fs/proc/root.c
+++ b/fs/proc/root.c
@@ -16,7 +16,6 @@
16#include <linux/sched.h> 16#include <linux/sched.h>
17#include <linux/module.h> 17#include <linux/module.h>
18#include <linux/bitops.h> 18#include <linux/bitops.h>
19#include <linux/smp_lock.h>
20#include <linux/mount.h> 19#include <linux/mount.h>
21#include <linux/pid_namespace.h> 20#include <linux/pid_namespace.h>
22 21
@@ -162,17 +161,12 @@ static int proc_root_readdir(struct file * filp,
162 unsigned int nr = filp->f_pos; 161 unsigned int nr = filp->f_pos;
163 int ret; 162 int ret;
164 163
165 lock_kernel();
166
167 if (nr < FIRST_PROCESS_ENTRY) { 164 if (nr < FIRST_PROCESS_ENTRY) {
168 int error = proc_readdir(filp, dirent, filldir); 165 int error = proc_readdir(filp, dirent, filldir);
169 if (error <= 0) { 166 if (error <= 0)
170 unlock_kernel();
171 return error; 167 return error;
172 }
173 filp->f_pos = FIRST_PROCESS_ENTRY; 168 filp->f_pos = FIRST_PROCESS_ENTRY;
174 } 169 }
175 unlock_kernel();
176 170
177 ret = proc_pid_readdir(filp, dirent, filldir); 171 ret = proc_pid_readdir(filp, dirent, filldir);
178 return ret; 172 return ret;
diff --git a/fs/proc/task_nommu.c b/fs/proc/task_nommu.c
index 219bd79ea894..d4a8be32b902 100644
--- a/fs/proc/task_nommu.c
+++ b/fs/proc/task_nommu.c
@@ -9,7 +9,7 @@
9 9
10/* 10/*
11 * Logic: we've got two memory sums for each process, "shared", and 11 * Logic: we've got two memory sums for each process, "shared", and
12 * "non-shared". Shared memory may get counted more then once, for 12 * "non-shared". Shared memory may get counted more than once, for
13 * each process that owns it. Non-shared memory is counted 13 * each process that owns it. Non-shared memory is counted
14 * accurately. 14 * accurately.
15 */ 15 */
diff --git a/fs/super.c b/fs/super.c
index ddba069d7a99..cb20744ec789 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -38,6 +38,7 @@
38#include <linux/kobject.h> 38#include <linux/kobject.h>
39#include <linux/mutex.h> 39#include <linux/mutex.h>
40#include <linux/file.h> 40#include <linux/file.h>
41#include <linux/async.h>
41#include <asm/uaccess.h> 42#include <asm/uaccess.h>
42#include "internal.h" 43#include "internal.h"
43 44
@@ -71,6 +72,7 @@ static struct super_block *alloc_super(struct file_system_type *type)
71 INIT_HLIST_HEAD(&s->s_anon); 72 INIT_HLIST_HEAD(&s->s_anon);
72 INIT_LIST_HEAD(&s->s_inodes); 73 INIT_LIST_HEAD(&s->s_inodes);
73 INIT_LIST_HEAD(&s->s_dentry_lru); 74 INIT_LIST_HEAD(&s->s_dentry_lru);
75 INIT_LIST_HEAD(&s->s_async_list);
74 init_rwsem(&s->s_umount); 76 init_rwsem(&s->s_umount);
75 mutex_init(&s->s_lock); 77 mutex_init(&s->s_lock);
76 lockdep_set_class(&s->s_umount, &type->s_umount_key); 78 lockdep_set_class(&s->s_umount, &type->s_umount_key);
@@ -289,11 +291,18 @@ void generic_shutdown_super(struct super_block *sb)
289{ 291{
290 const struct super_operations *sop = sb->s_op; 292 const struct super_operations *sop = sb->s_op;
291 293
294
292 if (sb->s_root) { 295 if (sb->s_root) {
293 shrink_dcache_for_umount(sb); 296 shrink_dcache_for_umount(sb);
294 fsync_super(sb); 297 fsync_super(sb);
295 lock_super(sb); 298 lock_super(sb);
296 sb->s_flags &= ~MS_ACTIVE; 299 sb->s_flags &= ~MS_ACTIVE;
300
301 /*
302 * wait for asynchronous fs operations to finish before going further
303 */
304 async_synchronize_full_special(&sb->s_async_list);
305
297 /* bad name - it should be evict_inodes() */ 306 /* bad name - it should be evict_inodes() */
298 invalidate_inodes(sb); 307 invalidate_inodes(sb);
299 lock_kernel(); 308 lock_kernel();
@@ -449,6 +458,7 @@ void sync_filesystems(int wait)
449 if (sb->s_flags & MS_RDONLY) 458 if (sb->s_flags & MS_RDONLY)
450 continue; 459 continue;
451 sb->s_need_sync_fs = 1; 460 sb->s_need_sync_fs = 1;
461 async_synchronize_full_special(&sb->s_async_list);
452 } 462 }
453 463
454restart: 464restart:
diff --git a/fs/ubifs/Kconfig b/fs/ubifs/Kconfig
index 91ceeda7e5bf..e35b54d5059d 100644
--- a/fs/ubifs/Kconfig
+++ b/fs/ubifs/Kconfig
@@ -40,7 +40,7 @@ config UBIFS_FS_ZLIB
40 depends on UBIFS_FS 40 depends on UBIFS_FS
41 default y 41 default y
42 help 42 help
43 Zlib copresses better then LZO but it is slower. Say 'Y' if unsure. 43 Zlib compresses better than LZO but it is slower. Say 'Y' if unsure.
44 44
45# Debugging-related stuff 45# Debugging-related stuff
46config UBIFS_FS_DEBUG 46config UBIFS_FS_DEBUG
diff --git a/fs/ubifs/budget.c b/fs/ubifs/budget.c
index 0e5e54d82924..175f9c590b77 100644
--- a/fs/ubifs/budget.c
+++ b/fs/ubifs/budget.c
@@ -142,7 +142,7 @@ static long long get_liability(struct ubifs_info *c)
142 * 142 *
143 * This function is called when an operation cannot be budgeted because there 143 * This function is called when an operation cannot be budgeted because there
144 * is supposedly no free space. But in most cases there is some free space: 144 * is supposedly no free space. But in most cases there is some free space:
145 * o budgeting is pessimistic, so it always budgets more then it is actually 145 * o budgeting is pessimistic, so it always budgets more than it is actually
146 * needed, so shrinking the liability is one way to make free space - the 146 * needed, so shrinking the liability is one way to make free space - the
147 * cached data will take less space then it was budgeted for; 147 * cached data will take less space then it was budgeted for;
148 * o GC may turn some dark space into free space (budgeting treats dark space 148 * o GC may turn some dark space into free space (budgeting treats dark space
@@ -606,7 +606,7 @@ void ubifs_release_budget(struct ubifs_info *c, struct ubifs_budget_req *req)
606 * @c: UBIFS file-system description object 606 * @c: UBIFS file-system description object
607 * 607 *
608 * This function converts budget which was allocated for a new page of data to 608 * This function converts budget which was allocated for a new page of data to
609 * the budget of changing an existing page of data. The latter is smaller then 609 * the budget of changing an existing page of data. The latter is smaller than
610 * the former, so this function only does simple re-calculation and does not 610 * the former, so this function only does simple re-calculation and does not
611 * involve any write-back. 611 * involve any write-back.
612 */ 612 */
diff --git a/fs/ubifs/gc.c b/fs/ubifs/gc.c
index 0bef6501d58a..9832f9abe28e 100644
--- a/fs/ubifs/gc.c
+++ b/fs/ubifs/gc.c
@@ -45,7 +45,7 @@
45#define SMALL_NODE_WM UBIFS_MAX_DENT_NODE_SZ 45#define SMALL_NODE_WM UBIFS_MAX_DENT_NODE_SZ
46 46
47/* 47/*
48 * GC may need to move more then one LEB to make progress. The below constants 48 * GC may need to move more than one LEB to make progress. The below constants
49 * define "soft" and "hard" limits on the number of LEBs the garbage collector 49 * define "soft" and "hard" limits on the number of LEBs the garbage collector
50 * may move. 50 * may move.
51 */ 51 */
diff --git a/fs/ubifs/journal.c b/fs/ubifs/journal.c
index 10ae25b7d1db..9b7c54e0cd2a 100644
--- a/fs/ubifs/journal.c
+++ b/fs/ubifs/journal.c
@@ -191,7 +191,7 @@ again:
191 if (wbuf->lnum != -1 && avail >= len) { 191 if (wbuf->lnum != -1 && avail >= len) {
192 /* 192 /*
193 * Someone else has switched the journal head and we have 193 * Someone else has switched the journal head and we have
194 * enough space now. This happens when more then one process is 194 * enough space now. This happens when more than one process is
195 * trying to write to the same journal head at the same time. 195 * trying to write to the same journal head at the same time.
196 */ 196 */
197 dbg_jnl("return LEB %d back, already have LEB %d:%d", 197 dbg_jnl("return LEB %d back, already have LEB %d:%d",
diff --git a/fs/ubifs/shrinker.c b/fs/ubifs/shrinker.c
index f248533841a2..e7bab52a1410 100644
--- a/fs/ubifs/shrinker.c
+++ b/fs/ubifs/shrinker.c
@@ -151,7 +151,7 @@ static int shrink_tnc(struct ubifs_info *c, int nr, int age, int *contention)
151 * @contention: if any contention, this is set to %1 151 * @contention: if any contention, this is set to %1
152 * 152 *
153 * This function walks the list of mounted UBIFS file-systems and frees clean 153 * This function walks the list of mounted UBIFS file-systems and frees clean
154 * znodes which are older then @age, until at least @nr znodes are freed. 154 * znodes which are older than @age, until at least @nr znodes are freed.
155 * Returns the number of freed znodes. 155 * Returns the number of freed znodes.
156 */ 156 */
157static int shrink_tnc_trees(int nr, int age, int *contention) 157static int shrink_tnc_trees(int nr, int age, int *contention)
diff --git a/fs/xfs/linux-2.6/xfs_super.c b/fs/xfs/linux-2.6/xfs_super.c
index 36f6cc703ef2..be846d606ae8 100644
--- a/fs/xfs/linux-2.6/xfs_super.c
+++ b/fs/xfs/linux-2.6/xfs_super.c
@@ -1348,7 +1348,7 @@ xfs_finish_flags(
1348{ 1348{
1349 int ronly = (mp->m_flags & XFS_MOUNT_RDONLY); 1349 int ronly = (mp->m_flags & XFS_MOUNT_RDONLY);
1350 1350
1351 /* Fail a mount where the logbuf is smaller then the log stripe */ 1351 /* Fail a mount where the logbuf is smaller than the log stripe */
1352 if (xfs_sb_version_haslogv2(&mp->m_sb)) { 1352 if (xfs_sb_version_haslogv2(&mp->m_sb)) {
1353 if (mp->m_logbsize <= 0 && 1353 if (mp->m_logbsize <= 0 &&
1354 mp->m_sb.sb_logsunit > XLOG_BIG_RECORD_BSIZE) { 1354 mp->m_sb.sb_logsunit > XLOG_BIG_RECORD_BSIZE) {
diff --git a/include/acpi/acmacros.h b/include/acpi/acmacros.h
index a597207e2835..1954c9d1d012 100644
--- a/include/acpi/acmacros.h
+++ b/include/acpi/acmacros.h
@@ -333,8 +333,8 @@ struct acpi_integer_overlay {
333#define ACPI_INSERT_BITS(target, mask, source) target = ((target & (~(mask))) | (source & mask)) 333#define ACPI_INSERT_BITS(target, mask, source) target = ((target & (~(mask))) | (source & mask))
334 334
335/* 335/*
336 * An struct acpi_namespace_node can appear in some contexts 336 * A struct acpi_namespace_node can appear in some contexts
337 * where a pointer to an union acpi_operand_object can also 337 * where a pointer to a union acpi_operand_object can also
338 * appear. This macro is used to distinguish them. 338 * appear. This macro is used to distinguish them.
339 * 339 *
340 * The "Descriptor" field is the first field in both structures. 340 * The "Descriptor" field is the first field in both structures.
diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h
index 7220361790b3..8222e8de0d1c 100644
--- a/include/acpi/actypes.h
+++ b/include/acpi/actypes.h
@@ -467,7 +467,7 @@ typedef u32 acpi_object_type;
467 467
468/* 468/*
469 * These are special object types that never appear in 469 * These are special object types that never appear in
470 * a Namespace node, only in an union acpi_operand_object 470 * a Namespace node, only in a union acpi_operand_object
471 */ 471 */
472#define ACPI_TYPE_LOCAL_EXTRA 0x1C 472#define ACPI_TYPE_LOCAL_EXTRA 0x1C
473#define ACPI_TYPE_LOCAL_DATA 0x1D 473#define ACPI_TYPE_LOCAL_DATA 0x1D
diff --git a/include/linux/Kbuild b/include/linux/Kbuild
index a3323f337e4d..12e9a2957caf 100644
--- a/include/linux/Kbuild
+++ b/include/linux/Kbuild
@@ -371,3 +371,5 @@ unifdef-y += xattr.h
371unifdef-y += xfrm.h 371unifdef-y += xfrm.h
372 372
373objhdr-y += version.h 373objhdr-y += version.h
374header-y += wimax.h
375header-y += wimax/
diff --git a/include/linux/async.h b/include/linux/async.h
new file mode 100644
index 000000000000..c4ecacd0b327
--- /dev/null
+++ b/include/linux/async.h
@@ -0,0 +1,25 @@
1/*
2 * async.h: Asynchronous function calls for boot performance
3 *
4 * (C) Copyright 2009 Intel Corporation
5 * Author: Arjan van de Ven <arjan@linux.intel.com>
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; version 2
10 * of the License.
11 */
12
13#include <linux/types.h>
14#include <linux/list.h>
15
16typedef u64 async_cookie_t;
17typedef void (async_func_ptr) (void *data, async_cookie_t cookie);
18
19extern async_cookie_t async_schedule(async_func_ptr *ptr, void *data);
20extern async_cookie_t async_schedule_special(async_func_ptr *ptr, void *data, struct list_head *list);
21extern void async_synchronize_full(void);
22extern void async_synchronize_full_special(struct list_head *list);
23extern void async_synchronize_cookie(async_cookie_t cookie);
24extern void async_synchronize_cookie_special(async_cookie_t cookie, struct list_head *list);
25
diff --git a/arch/avr32/include/asm/atmel-mci.h b/include/linux/atmel-mci.h
index 59f3fadd0b68..2a2213eefd85 100644
--- a/arch/avr32/include/asm/atmel-mci.h
+++ b/include/linux/atmel-mci.h
@@ -1,5 +1,5 @@
1#ifndef __ASM_AVR32_ATMEL_MCI_H 1#ifndef __LINUX_ATMEL_MCI_H
2#define __ASM_AVR32_ATMEL_MCI_H 2#define __LINUX_ATMEL_MCI_H
3 3
4#define ATMEL_MCI_MAX_NR_SLOTS 2 4#define ATMEL_MCI_MAX_NR_SLOTS 2
5 5
@@ -36,4 +36,4 @@ struct mci_platform_data {
36 struct mci_slot_pdata slot[ATMEL_MCI_MAX_NR_SLOTS]; 36 struct mci_slot_pdata slot[ATMEL_MCI_MAX_NR_SLOTS];
37}; 37};
38 38
39#endif /* __ASM_AVR32_ATMEL_MCI_H */ 39#endif /* __LINUX_ATMEL_MCI_H */
diff --git a/include/linux/debugfs.h b/include/linux/debugfs.h
index e1a6c046cea3..23936b16426b 100644
--- a/include/linux/debugfs.h
+++ b/include/linux/debugfs.h
@@ -63,6 +63,8 @@ struct dentry *debugfs_create_x16(const char *name, mode_t mode,
63 struct dentry *parent, u16 *value); 63 struct dentry *parent, u16 *value);
64struct dentry *debugfs_create_x32(const char *name, mode_t mode, 64struct dentry *debugfs_create_x32(const char *name, mode_t mode,
65 struct dentry *parent, u32 *value); 65 struct dentry *parent, u32 *value);
66struct dentry *debugfs_create_size_t(const char *name, mode_t mode,
67 struct dentry *parent, size_t *value);
66struct dentry *debugfs_create_bool(const char *name, mode_t mode, 68struct dentry *debugfs_create_bool(const char *name, mode_t mode,
67 struct dentry *parent, u32 *value); 69 struct dentry *parent, u32 *value);
68 70
diff --git a/include/linux/fs.h b/include/linux/fs.h
index d7eba77f666e..e38a64d71eff 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -1184,6 +1184,11 @@ struct super_block {
1184 * generic_show_options() 1184 * generic_show_options()
1185 */ 1185 */
1186 char *s_options; 1186 char *s_options;
1187
1188 /*
1189 * storage for asynchronous operations
1190 */
1191 struct list_head s_async_list;
1187}; 1192};
1188 1193
1189extern struct timespec current_fs_time(struct super_block *sb); 1194extern struct timespec current_fs_time(struct super_block *sb);
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index 33a5992d4936..20873d402467 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -393,11 +393,7 @@ static inline void i2c_set_adapdata(struct i2c_adapter *dev, void *data)
393#define I2C_CLASS_TV_ANALOG (1<<1) /* bttv + friends */ 393#define I2C_CLASS_TV_ANALOG (1<<1) /* bttv + friends */
394#define I2C_CLASS_TV_DIGITAL (1<<2) /* dvb cards */ 394#define I2C_CLASS_TV_DIGITAL (1<<2) /* dvb cards */
395#define I2C_CLASS_DDC (1<<3) /* DDC bus on graphics adapters */ 395#define I2C_CLASS_DDC (1<<3) /* DDC bus on graphics adapters */
396#define I2C_CLASS_CAM_ANALOG (1<<4) /* camera with analog CCD */
397#define I2C_CLASS_CAM_DIGITAL (1<<5) /* most webcams */
398#define I2C_CLASS_SOUND (1<<6) /* sound devices */
399#define I2C_CLASS_SPD (1<<7) /* SPD EEPROMs and similar */ 396#define I2C_CLASS_SPD (1<<7) /* SPD EEPROMs and similar */
400#define I2C_CLASS_ALL (UINT_MAX) /* all of the above */
401 397
402/* i2c_client_address_data is the struct for holding default client 398/* i2c_client_address_data is the struct for holding default client
403 * addresses for a driver and for the parameters supplied on the 399 * addresses for a driver and for the parameters supplied on the
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
index eae26bb6430a..64433eb411d7 100644
--- a/include/linux/mtd/mtd.h
+++ b/include/linux/mtd/mtd.h
@@ -83,7 +83,7 @@ typedef enum {
83 * @datbuf: data buffer - if NULL only oob data are read/written 83 * @datbuf: data buffer - if NULL only oob data are read/written
84 * @oobbuf: oob data buffer 84 * @oobbuf: oob data buffer
85 * 85 *
86 * Note, it is allowed to read more then one OOB area at one go, but not write. 86 * Note, it is allowed to read more than one OOB area at one go, but not write.
87 * The interface assumes that the OOB write requests program only one page's 87 * The interface assumes that the OOB write requests program only one page's
88 * OOB area. 88 * OOB area.
89 */ 89 */
diff --git a/include/linux/ncp_fs.h b/include/linux/ncp_fs.h
index 9f2d76347f19..f69e66d151cc 100644
--- a/include/linux/ncp_fs.h
+++ b/include/linux/ncp_fs.h
@@ -87,7 +87,7 @@ struct ncp_objectname_ioctl
87#define NCP_AUTH_NDS 0x32 87#define NCP_AUTH_NDS 0x32
88 int auth_type; 88 int auth_type;
89 size_t object_name_len; 89 size_t object_name_len;
90 void __user * object_name; /* an userspace data, in most cases user name */ 90 void __user * object_name; /* a userspace data, in most cases user name */
91}; 91};
92 92
93struct ncp_privatedata_ioctl 93struct ncp_privatedata_ioctl
diff --git a/include/linux/oxu210hp.h b/include/linux/oxu210hp.h
new file mode 100644
index 000000000000..0bf96eae5389
--- /dev/null
+++ b/include/linux/oxu210hp.h
@@ -0,0 +1,7 @@
1/* platform data for the OXU210HP HCD */
2
3struct oxu210hp_platform_data {
4 unsigned int bus16:1;
5 unsigned int use_hcd_otg:1;
6 unsigned int use_hcd_sph:1;
7};
diff --git a/include/linux/qnx4_fs.h b/include/linux/qnx4_fs.h
index 34a196ee7941..787d19ea9f46 100644
--- a/include/linux/qnx4_fs.h
+++ b/include/linux/qnx4_fs.h
@@ -2,14 +2,12 @@
2 * Name : qnx4_fs.h 2 * Name : qnx4_fs.h
3 * Author : Richard Frowijn 3 * Author : Richard Frowijn
4 * Function : qnx4 global filesystem definitions 4 * Function : qnx4 global filesystem definitions
5 * Version : 1.0.2
6 * Last modified : 2000-01-31
7 *
8 * History : 23-03-1998 created 5 * History : 23-03-1998 created
9 */ 6 */
10#ifndef _LINUX_QNX4_FS_H 7#ifndef _LINUX_QNX4_FS_H
11#define _LINUX_QNX4_FS_H 8#define _LINUX_QNX4_FS_H
12 9
10#include <linux/types.h>
13#include <linux/qnxtypes.h> 11#include <linux/qnxtypes.h>
14#include <linux/magic.h> 12#include <linux/magic.h>
15 13
diff --git a/include/linux/qnxtypes.h b/include/linux/qnxtypes.h
index a3eb1137857b..bebbe5cc4fb8 100644
--- a/include/linux/qnxtypes.h
+++ b/include/linux/qnxtypes.h
@@ -2,9 +2,6 @@
2 * Name : qnxtypes.h 2 * Name : qnxtypes.h
3 * Author : Richard Frowijn 3 * Author : Richard Frowijn
4 * Function : standard qnx types 4 * Function : standard qnx types
5 * Version : 1.0.2
6 * Last modified : 2000-01-06
7 *
8 * History : 22-03-1998 created 5 * History : 22-03-1998 created
9 * 6 *
10 */ 7 */
@@ -12,6 +9,8 @@
12#ifndef _QNX4TYPES_H 9#ifndef _QNX4TYPES_H
13#define _QNX4TYPES_H 10#define _QNX4TYPES_H
14 11
12#include <linux/types.h>
13
15typedef __le16 qnx4_nxtnt_t; 14typedef __le16 qnx4_nxtnt_t;
16typedef __u8 qnx4_ftype_t; 15typedef __u8 qnx4_ftype_t;
17 16
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h
index 82229317753d..68bb1c501d0d 100644
--- a/include/linux/spi/spi.h
+++ b/include/linux/spi/spi.h
@@ -327,9 +327,9 @@ extern struct spi_master *spi_busnum_to_master(u16 busnum);
327 * @tx_dma: DMA address of tx_buf, if @spi_message.is_dma_mapped 327 * @tx_dma: DMA address of tx_buf, if @spi_message.is_dma_mapped
328 * @rx_dma: DMA address of rx_buf, if @spi_message.is_dma_mapped 328 * @rx_dma: DMA address of rx_buf, if @spi_message.is_dma_mapped
329 * @len: size of rx and tx buffers (in bytes) 329 * @len: size of rx and tx buffers (in bytes)
330 * @speed_hz: Select a speed other then the device default for this 330 * @speed_hz: Select a speed other than the device default for this
331 * transfer. If 0 the default (from @spi_device) is used. 331 * transfer. If 0 the default (from @spi_device) is used.
332 * @bits_per_word: select a bits_per_word other then the device default 332 * @bits_per_word: select a bits_per_word other than the device default
333 * for this transfer. If 0 the default (from @spi_device) is used. 333 * for this transfer. If 0 the default (from @spi_device) is used.
334 * @cs_change: affects chipselect after this transfer completes 334 * @cs_change: affects chipselect after this transfer completes
335 * @delay_usecs: microseconds to delay after this transfer before 335 * @delay_usecs: microseconds to delay after this transfer before
diff --git a/include/linux/types.h b/include/linux/types.h
index 3b864f2d9560..712ca53bc348 100644
--- a/include/linux/types.h
+++ b/include/linux/types.h
@@ -176,10 +176,9 @@ typedef __u16 __bitwise __le16;
176typedef __u16 __bitwise __be16; 176typedef __u16 __bitwise __be16;
177typedef __u32 __bitwise __le32; 177typedef __u32 __bitwise __le32;
178typedef __u32 __bitwise __be32; 178typedef __u32 __bitwise __be32;
179#if defined(__GNUC__)
180typedef __u64 __bitwise __le64; 179typedef __u64 __bitwise __le64;
181typedef __u64 __bitwise __be64; 180typedef __u64 __bitwise __be64;
182#endif 181
183typedef __u16 __bitwise __sum16; 182typedef __u16 __bitwise __sum16;
184typedef __u32 __bitwise __wsum; 183typedef __u32 __bitwise __wsum;
185 184
diff --git a/include/linux/usb.h b/include/linux/usb.h
index f72aa51f7bcd..85ee9be9361e 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -108,6 +108,7 @@ enum usb_interface_condition {
108 * (in probe()), bound to a driver, or unbinding (in disconnect()) 108 * (in probe()), bound to a driver, or unbinding (in disconnect())
109 * @is_active: flag set when the interface is bound and not suspended. 109 * @is_active: flag set when the interface is bound and not suspended.
110 * @sysfs_files_created: sysfs attributes exist 110 * @sysfs_files_created: sysfs attributes exist
111 * @ep_devs_created: endpoint child pseudo-devices exist
111 * @unregistering: flag set when the interface is being unregistered 112 * @unregistering: flag set when the interface is being unregistered
112 * @needs_remote_wakeup: flag set when the driver requires remote-wakeup 113 * @needs_remote_wakeup: flag set when the driver requires remote-wakeup
113 * capability during autosuspend. 114 * capability during autosuspend.
@@ -120,6 +121,11 @@ enum usb_interface_condition {
120 * to the sysfs representation for that device. 121 * to the sysfs representation for that device.
121 * @pm_usage_cnt: PM usage counter for this interface; autosuspend is not 122 * @pm_usage_cnt: PM usage counter for this interface; autosuspend is not
122 * allowed unless the counter is 0. 123 * allowed unless the counter is 0.
124 * @reset_ws: Used for scheduling resets from atomic context.
125 * @reset_running: set to 1 if the interface is currently running a
126 * queued reset so that usb_cancel_queued_reset() doesn't try to
127 * remove from the workqueue when running inside the worker
128 * thread. See __usb_queue_reset_device().
123 * 129 *
124 * USB device drivers attach to interfaces on a physical device. Each 130 * USB device drivers attach to interfaces on a physical device. Each
125 * interface encapsulates a single high level function, such as feeding 131 * interface encapsulates a single high level function, such as feeding
@@ -164,14 +170,17 @@ struct usb_interface {
164 enum usb_interface_condition condition; /* state of binding */ 170 enum usb_interface_condition condition; /* state of binding */
165 unsigned is_active:1; /* the interface is not suspended */ 171 unsigned is_active:1; /* the interface is not suspended */
166 unsigned sysfs_files_created:1; /* the sysfs attributes exist */ 172 unsigned sysfs_files_created:1; /* the sysfs attributes exist */
173 unsigned ep_devs_created:1; /* endpoint "devices" exist */
167 unsigned unregistering:1; /* unregistration is in progress */ 174 unsigned unregistering:1; /* unregistration is in progress */
168 unsigned needs_remote_wakeup:1; /* driver requires remote wakeup */ 175 unsigned needs_remote_wakeup:1; /* driver requires remote wakeup */
169 unsigned needs_altsetting0:1; /* switch to altsetting 0 is pending */ 176 unsigned needs_altsetting0:1; /* switch to altsetting 0 is pending */
170 unsigned needs_binding:1; /* needs delayed unbind/rebind */ 177 unsigned needs_binding:1; /* needs delayed unbind/rebind */
178 unsigned reset_running:1;
171 179
172 struct device dev; /* interface specific device info */ 180 struct device dev; /* interface specific device info */
173 struct device *usb_dev; 181 struct device *usb_dev;
174 int pm_usage_cnt; /* usage counter for autosuspend */ 182 int pm_usage_cnt; /* usage counter for autosuspend */
183 struct work_struct reset_ws; /* for resets in atomic context */
175}; 184};
176#define to_usb_interface(d) container_of(d, struct usb_interface, dev) 185#define to_usb_interface(d) container_of(d, struct usb_interface, dev)
177#define interface_to_usbdev(intf) \ 186#define interface_to_usbdev(intf) \
@@ -329,7 +338,7 @@ struct usb_bus {
329#endif 338#endif
330 struct device *dev; /* device for this bus */ 339 struct device *dev; /* device for this bus */
331 340
332#if defined(CONFIG_USB_MON) 341#if defined(CONFIG_USB_MON) || defined(CONFIG_USB_MON_MODULE)
333 struct mon_bus *mon_bus; /* non-null when associated */ 342 struct mon_bus *mon_bus; /* non-null when associated */
334 int monitored; /* non-zero when monitored */ 343 int monitored; /* non-zero when monitored */
335#endif 344#endif
@@ -398,6 +407,7 @@ struct usb_tt;
398 * @urbnum: number of URBs submitted for the whole device 407 * @urbnum: number of URBs submitted for the whole device
399 * @active_duration: total time device is not suspended 408 * @active_duration: total time device is not suspended
400 * @autosuspend: for delayed autosuspends 409 * @autosuspend: for delayed autosuspends
410 * @autoresume: for autoresumes requested while in_interrupt
401 * @pm_mutex: protects PM operations 411 * @pm_mutex: protects PM operations
402 * @last_busy: time of last use 412 * @last_busy: time of last use
403 * @autosuspend_delay: in jiffies 413 * @autosuspend_delay: in jiffies
@@ -476,6 +486,7 @@ struct usb_device {
476 486
477#ifdef CONFIG_PM 487#ifdef CONFIG_PM
478 struct delayed_work autosuspend; 488 struct delayed_work autosuspend;
489 struct work_struct autoresume;
479 struct mutex pm_mutex; 490 struct mutex pm_mutex;
480 491
481 unsigned long last_busy; 492 unsigned long last_busy;
@@ -505,6 +516,7 @@ extern int usb_lock_device_for_reset(struct usb_device *udev,
505 516
506/* USB port reset for device reinitialization */ 517/* USB port reset for device reinitialization */
507extern int usb_reset_device(struct usb_device *dev); 518extern int usb_reset_device(struct usb_device *dev);
519extern void usb_queue_reset_device(struct usb_interface *dev);
508 520
509extern struct usb_device *usb_find_device(u16 vendor_id, u16 product_id); 521extern struct usb_device *usb_find_device(u16 vendor_id, u16 product_id);
510 522
@@ -513,6 +525,8 @@ extern struct usb_device *usb_find_device(u16 vendor_id, u16 product_id);
513extern int usb_autopm_set_interface(struct usb_interface *intf); 525extern int usb_autopm_set_interface(struct usb_interface *intf);
514extern int usb_autopm_get_interface(struct usb_interface *intf); 526extern int usb_autopm_get_interface(struct usb_interface *intf);
515extern void usb_autopm_put_interface(struct usb_interface *intf); 527extern void usb_autopm_put_interface(struct usb_interface *intf);
528extern int usb_autopm_get_interface_async(struct usb_interface *intf);
529extern void usb_autopm_put_interface_async(struct usb_interface *intf);
516 530
517static inline void usb_autopm_enable(struct usb_interface *intf) 531static inline void usb_autopm_enable(struct usb_interface *intf)
518{ 532{
@@ -539,8 +553,13 @@ static inline int usb_autopm_set_interface(struct usb_interface *intf)
539static inline int usb_autopm_get_interface(struct usb_interface *intf) 553static inline int usb_autopm_get_interface(struct usb_interface *intf)
540{ return 0; } 554{ return 0; }
541 555
556static inline int usb_autopm_get_interface_async(struct usb_interface *intf)
557{ return 0; }
558
542static inline void usb_autopm_put_interface(struct usb_interface *intf) 559static inline void usb_autopm_put_interface(struct usb_interface *intf)
543{ } 560{ }
561static inline void usb_autopm_put_interface_async(struct usb_interface *intf)
562{ }
544static inline void usb_autopm_enable(struct usb_interface *intf) 563static inline void usb_autopm_enable(struct usb_interface *intf)
545{ } 564{ }
546static inline void usb_autopm_disable(struct usb_interface *intf) 565static inline void usb_autopm_disable(struct usb_interface *intf)
@@ -1050,7 +1069,7 @@ struct usb_device_driver {
1050 void (*disconnect) (struct usb_device *udev); 1069 void (*disconnect) (struct usb_device *udev);
1051 1070
1052 int (*suspend) (struct usb_device *udev, pm_message_t message); 1071 int (*suspend) (struct usb_device *udev, pm_message_t message);
1053 int (*resume) (struct usb_device *udev); 1072 int (*resume) (struct usb_device *udev, pm_message_t message);
1054 struct usbdrv_wrap drvwrap; 1073 struct usbdrv_wrap drvwrap;
1055 unsigned int supports_autosuspend:1; 1074 unsigned int supports_autosuspend:1;
1056}; 1075};
@@ -1321,7 +1340,7 @@ struct urb {
1321 struct kref kref; /* reference count of the URB */ 1340 struct kref kref; /* reference count of the URB */
1322 void *hcpriv; /* private data for host controller */ 1341 void *hcpriv; /* private data for host controller */
1323 atomic_t use_count; /* concurrent submissions counter */ 1342 atomic_t use_count; /* concurrent submissions counter */
1324 u8 reject; /* submissions will fail */ 1343 atomic_t reject; /* submissions will fail */
1325 int unlinked; /* unlink error code */ 1344 int unlinked; /* unlink error code */
1326 1345
1327 /* public: documented fields in the urb that can be used by drivers */ 1346 /* public: documented fields in the urb that can be used by drivers */
@@ -1466,6 +1485,7 @@ extern void usb_poison_urb(struct urb *urb);
1466extern void usb_unpoison_urb(struct urb *urb); 1485extern void usb_unpoison_urb(struct urb *urb);
1467extern void usb_kill_anchored_urbs(struct usb_anchor *anchor); 1486extern void usb_kill_anchored_urbs(struct usb_anchor *anchor);
1468extern void usb_poison_anchored_urbs(struct usb_anchor *anchor); 1487extern void usb_poison_anchored_urbs(struct usb_anchor *anchor);
1488extern void usb_unpoison_anchored_urbs(struct usb_anchor *anchor);
1469extern void usb_unlink_anchored_urbs(struct usb_anchor *anchor); 1489extern void usb_unlink_anchored_urbs(struct usb_anchor *anchor);
1470extern void usb_anchor_urb(struct urb *urb, struct usb_anchor *anchor); 1490extern void usb_anchor_urb(struct urb *urb, struct usb_anchor *anchor);
1471extern void usb_unanchor_urb(struct urb *urb); 1491extern void usb_unanchor_urb(struct urb *urb);
@@ -1722,10 +1742,6 @@ extern void usb_unregister_notify(struct notifier_block *nb);
1722 1742
1723#define err(format, arg...) printk(KERN_ERR KBUILD_MODNAME ": " \ 1743#define err(format, arg...) printk(KERN_ERR KBUILD_MODNAME ": " \
1724 format "\n" , ## arg) 1744 format "\n" , ## arg)
1725#define info(format, arg...) printk(KERN_INFO KBUILD_MODNAME ": " \
1726 format "\n" , ## arg)
1727#define warn(format, arg...) printk(KERN_WARNING KBUILD_MODNAME ": " \
1728 format "\n" , ## arg)
1729 1745
1730#endif /* __KERNEL__ */ 1746#endif /* __KERNEL__ */
1731 1747
diff --git a/include/linux/usb/association.h b/include/linux/usb/association.h
index 07c5e3cf5898..0a4a18b3c1bb 100644
--- a/include/linux/usb/association.h
+++ b/include/linux/usb/association.h
@@ -28,17 +28,17 @@ struct wusb_am_attr {
28}; 28};
29 29
30/* Different fields defined by the spec */ 30/* Different fields defined by the spec */
31#define WUSB_AR_AssociationTypeId { .id = 0x0000, .len = 2 } 31#define WUSB_AR_AssociationTypeId { .id = cpu_to_le16(0x0000), .len = cpu_to_le16(2) }
32#define WUSB_AR_AssociationSubTypeId { .id = 0x0001, .len = 2 } 32#define WUSB_AR_AssociationSubTypeId { .id = cpu_to_le16(0x0001), .len = cpu_to_le16(2) }
33#define WUSB_AR_Length { .id = 0x0002, .len = 4 } 33#define WUSB_AR_Length { .id = cpu_to_le16(0x0002), .len = cpu_to_le16(4) }
34#define WUSB_AR_AssociationStatus { .id = 0x0004, .len = 4 } 34#define WUSB_AR_AssociationStatus { .id = cpu_to_le16(0x0004), .len = cpu_to_le16(4) }
35#define WUSB_AR_LangID { .id = 0x0008, .len = 2 } 35#define WUSB_AR_LangID { .id = cpu_to_le16(0x0008), .len = cpu_to_le16(2) }
36#define WUSB_AR_DeviceFriendlyName { .id = 0x000b, .len = 64 } /* max */ 36#define WUSB_AR_DeviceFriendlyName { .id = cpu_to_le16(0x000b), .len = cpu_to_le16(64) } /* max */
37#define WUSB_AR_HostFriendlyName { .id = 0x000c, .len = 64 } /* max */ 37#define WUSB_AR_HostFriendlyName { .id = cpu_to_le16(0x000c), .len = cpu_to_le16(64) } /* max */
38#define WUSB_AR_CHID { .id = 0x1000, .len = 16 } 38#define WUSB_AR_CHID { .id = cpu_to_le16(0x1000), .len = cpu_to_le16(16) }
39#define WUSB_AR_CDID { .id = 0x1001, .len = 16 } 39#define WUSB_AR_CDID { .id = cpu_to_le16(0x1001), .len = cpu_to_le16(16) }
40#define WUSB_AR_ConnectionContext { .id = 0x1002, .len = 48 } 40#define WUSB_AR_ConnectionContext { .id = cpu_to_le16(0x1002), .len = cpu_to_le16(48) }
41#define WUSB_AR_BandGroups { .id = 0x1004, .len = 2 } 41#define WUSB_AR_BandGroups { .id = cpu_to_le16(0x1004), .len = cpu_to_le16(2) }
42 42
43/* CBAF Control Requests (AMS1.0[T4-1] */ 43/* CBAF Control Requests (AMS1.0[T4-1] */
44enum { 44enum {
diff --git a/include/linux/usb/gpio_vbus.h b/include/linux/usb/gpio_vbus.h
new file mode 100644
index 000000000000..d9f03ccc2d60
--- /dev/null
+++ b/include/linux/usb/gpio_vbus.h
@@ -0,0 +1,30 @@
1/*
2 * A simple GPIO VBUS sensing driver for B peripheral only devices
3 * with internal transceivers.
4 * Optionally D+ pullup can be controlled by a second GPIO.
5 *
6 * Copyright (c) 2008 Philipp Zabel <philipp.zabel@gmail.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 *
12 */
13
14/**
15 * struct gpio_vbus_mach_info - configuration for gpio_vbus
16 * @gpio_vbus: VBUS sensing GPIO
17 * @gpio_pullup: optional D+ or D- pullup GPIO (else negative/invalid)
18 * @gpio_vbus_inverted: true if gpio_vbus is active low
19 * @gpio_pullup_inverted: true if gpio_pullup is active low
20 *
21 * The VBUS sensing GPIO should have a pulldown, which will normally be
22 * part of a resistor ladder turning a 4.0V-5.25V level on VBUS into a
23 * value the GPIO detects as active. Some systems will use comparators.
24 */
25struct gpio_vbus_mach_info {
26 int gpio_vbus;
27 int gpio_pullup;
28 bool gpio_vbus_inverted;
29 bool gpio_pullup_inverted;
30};
diff --git a/include/linux/usb/musb.h b/include/linux/usb/musb.h
index 630962c04ca4..d6aad0ea6033 100644
--- a/include/linux/usb/musb.h
+++ b/include/linux/usb/musb.h
@@ -47,6 +47,11 @@ struct musb_hdrc_config {
47 u8 ram_bits; /* ram address size */ 47 u8 ram_bits; /* ram address size */
48 48
49 struct musb_hdrc_eps_bits *eps_bits; 49 struct musb_hdrc_eps_bits *eps_bits;
50#ifdef CONFIG_BLACKFIN
51 /* A GPIO controlling VRSEL in Blackfin */
52 unsigned int gpio_vrsel;
53#endif
54
50}; 55};
51 56
52struct musb_hdrc_platform_data { 57struct musb_hdrc_platform_data {
diff --git a/include/linux/usb/otg.h b/include/linux/usb/otg.h
index 1db25d152ad8..94df4fe6c6c0 100644
--- a/include/linux/usb/otg.h
+++ b/include/linux/usb/otg.h
@@ -84,6 +84,7 @@ extern int otg_set_transceiver(struct otg_transceiver *);
84 84
85/* for usb host and peripheral controller drivers */ 85/* for usb host and peripheral controller drivers */
86extern struct otg_transceiver *otg_get_transceiver(void); 86extern struct otg_transceiver *otg_get_transceiver(void);
87extern void otg_put_transceiver(struct otg_transceiver *);
87 88
88static inline int 89static inline int
89otg_start_hnp(struct otg_transceiver *otg) 90otg_start_hnp(struct otg_transceiver *otg)
diff --git a/include/linux/usb_usual.h b/include/linux/usb_usual.h
index d9a3bbe38e6b..1eea1ab68dc4 100644
--- a/include/linux/usb_usual.h
+++ b/include/linux/usb_usual.h
@@ -52,8 +52,11 @@
52 US_FLAG(MAX_SECTORS_MIN,0x00002000) \ 52 US_FLAG(MAX_SECTORS_MIN,0x00002000) \
53 /* Sets max_sectors to arch min */ \ 53 /* Sets max_sectors to arch min */ \
54 US_FLAG(BULK_IGNORE_TAG,0x00004000) \ 54 US_FLAG(BULK_IGNORE_TAG,0x00004000) \
55 /* Ignore tag mismatch in bulk operations */ 55 /* Ignore tag mismatch in bulk operations */ \
56 56 US_FLAG(SANE_SENSE, 0x00008000) \
57 /* Sane Sense (> 18 bytes) */ \
58 US_FLAG(CAPACITY_OK, 0x00010000) \
59 /* READ CAPACITY response is correct */
57 60
58#define US_FLAG(name, value) US_FL_##name = value , 61#define US_FLAG(name, value) US_FL_##name = value ,
59enum { US_DO_ALL_FLAGS }; 62enum { US_DO_ALL_FLAGS };
diff --git a/include/linux/wimax.h b/include/linux/wimax.h
new file mode 100644
index 000000000000..c89de7f4e5b9
--- /dev/null
+++ b/include/linux/wimax.h
@@ -0,0 +1,234 @@
1/*
2 * Linux WiMax
3 * API for user space
4 *
5 *
6 * Copyright (C) 2007-2008 Intel Corporation. All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 *
12 * * Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * * Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in
16 * the documentation and/or other materials provided with the
17 * distribution.
18 * * Neither the name of Intel Corporation nor the names of its
19 * contributors may be used to endorse or promote products derived
20 * from this software without specific prior written permission.
21 *
22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 *
34 *
35 * Intel Corporation <linux-wimax@intel.com>
36 * Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
37 * - Initial implementation
38 *
39 *
40 * This file declares the user/kernel protocol that is spoken over
41 * Generic Netlink, as well as any type declaration that is to be used
42 * by kernel and user space.
43 *
44 * It is intended for user space to clone it verbatim to use it as a
45 * primary reference for definitions.
46 *
47 * Stuff intended for kernel usage as well as full protocol and stack
48 * documentation is rooted in include/net/wimax.h.
49 */
50
51#ifndef __LINUX__WIMAX_H__
52#define __LINUX__WIMAX_H__
53
54#include <linux/types.h>
55
56enum {
57 /**
58 * Version of the interface (unsigned decimal, MMm, max 25.5)
59 * M - Major: change if removing or modifying an existing call.
60 * m - minor: change when adding a new call
61 */
62 WIMAX_GNL_VERSION = 00,
63 /* Generic NetLink attributes */
64 WIMAX_GNL_ATTR_INVALID = 0x00,
65 WIMAX_GNL_ATTR_MAX = 10,
66};
67
68
69/*
70 * Generic NetLink operations
71 *
72 * Most of these map to an API call; _OP_ stands for operation, _RP_
73 * for reply and _RE_ for report (aka: signal).
74 */
75enum {
76 WIMAX_GNL_OP_MSG_FROM_USER, /* User to kernel message */
77 WIMAX_GNL_OP_MSG_TO_USER, /* Kernel to user message */
78 WIMAX_GNL_OP_RFKILL, /* Run wimax_rfkill() */
79 WIMAX_GNL_OP_RESET, /* Run wimax_rfkill() */
80 WIMAX_GNL_RE_STATE_CHANGE, /* Report: status change */
81};
82
83
84/* Message from user / to user */
85enum {
86 WIMAX_GNL_MSG_IFIDX = 1,
87 WIMAX_GNL_MSG_PIPE_NAME,
88 WIMAX_GNL_MSG_DATA,
89};
90
91
92/*
93 * wimax_rfkill()
94 *
95 * The state of the radio (ON/OFF) is mapped to the rfkill subsystem's
96 * switch state (DISABLED/ENABLED).
97 */
98enum wimax_rf_state {
99 WIMAX_RF_OFF = 0, /* Radio is off, rfkill on/enabled */
100 WIMAX_RF_ON = 1, /* Radio is on, rfkill off/disabled */
101 WIMAX_RF_QUERY = 2,
102};
103
104/* Attributes */
105enum {
106 WIMAX_GNL_RFKILL_IFIDX = 1,
107 WIMAX_GNL_RFKILL_STATE,
108};
109
110
111/* Attributes for wimax_reset() */
112enum {
113 WIMAX_GNL_RESET_IFIDX = 1,
114};
115
116
117/*
118 * Attributes for the Report State Change
119 *
120 * For now we just have the old and new states; new attributes might
121 * be added later on.
122 */
123enum {
124 WIMAX_GNL_STCH_IFIDX = 1,
125 WIMAX_GNL_STCH_STATE_OLD,
126 WIMAX_GNL_STCH_STATE_NEW,
127};
128
129
130/**
131 * enum wimax_st - The different states of a WiMAX device
132 * @__WIMAX_ST_NULL: The device structure has been allocated and zeroed,
133 * but still wimax_dev_add() hasn't been called. There is no state.
134 *
135 * @WIMAX_ST_DOWN: The device has been registered with the WiMAX and
136 * networking stacks, but it is not initialized (normally that is
137 * done with 'ifconfig DEV up' [or equivalent], which can upload
138 * firmware and enable communications with the device).
139 * In this state, the device is powered down and using as less
140 * power as possible.
141 * This state is the default after a call to wimax_dev_add(). It
142 * is ok to have drivers move directly to %WIMAX_ST_UNINITIALIZED
143 * or %WIMAX_ST_RADIO_OFF in _probe() after the call to
144 * wimax_dev_add().
145 * It is recommended that the driver leaves this state when
146 * calling 'ifconfig DEV up' and enters it back on 'ifconfig DEV
147 * down'.
148 *
149 * @__WIMAX_ST_QUIESCING: The device is being torn down, so no API
150 * operations are allowed to proceed except the ones needed to
151 * complete the device clean up process.
152 *
153 * @WIMAX_ST_UNINITIALIZED: [optional] Communication with the device
154 * is setup, but the device still requires some configuration
155 * before being operational.
156 * Some WiMAX API calls might work.
157 *
158 * @WIMAX_ST_RADIO_OFF: The device is fully up; radio is off (wether
159 * by hardware or software switches).
160 * It is recommended to always leave the device in this state
161 * after initialization.
162 *
163 * @WIMAX_ST_READY: The device is fully up and radio is on.
164 *
165 * @WIMAX_ST_SCANNING: [optional] The device has been instructed to
166 * scan. In this state, the device cannot be actively connected to
167 * a network.
168 *
169 * @WIMAX_ST_CONNECTING: The device is connecting to a network. This
170 * state exists because in some devices, the connect process can
171 * include a number of negotiations between user space, kernel
172 * space and the device. User space needs to know what the device
173 * is doing. If the connect sequence in a device is atomic and
174 * fast, the device can transition directly to CONNECTED
175 *
176 * @WIMAX_ST_CONNECTED: The device is connected to a network.
177 *
178 * @__WIMAX_ST_INVALID: This is an invalid state used to mark the
179 * maximum numeric value of states.
180 *
181 * Description:
182 *
183 * Transitions from one state to another one are atomic and can only
184 * be caused in kernel space with wimax_state_change(). To read the
185 * state, use wimax_state_get().
186 *
187 * States starting with __ are internal and shall not be used or
188 * referred to by drivers or userspace. They look ugly, but that's the
189 * point -- if any use is made non-internal to the stack, it is easier
190 * to catch on review.
191 *
192 * All API operations [with well defined exceptions] will take the
193 * device mutex before starting and then check the state. If the state
194 * is %__WIMAX_ST_NULL, %WIMAX_ST_DOWN, %WIMAX_ST_UNINITIALIZED or
195 * %__WIMAX_ST_QUIESCING, it will drop the lock and quit with
196 * -%EINVAL, -%ENOMEDIUM, -%ENOTCONN or -%ESHUTDOWN.
197 *
198 * The order of the definitions is important, so we can do numerical
199 * comparisons (eg: < %WIMAX_ST_RADIO_OFF means the device is not ready
200 * to operate).
201 */
202/*
203 * The allowed state transitions are described in the table below
204 * (states in rows can go to states in columns where there is an X):
205 *
206 * UNINI RADIO READY SCAN CONNEC CONNEC
207 * NULL DOWN QUIESCING TIALIZED OFF NING TING TED
208 * NULL - x
209 * DOWN - x x x
210 * QUIESCING x -
211 * UNINITIALIZED x - x
212 * RADIO_OFF x - x
213 * READY x x - x x x
214 * SCANNING x x x - x x
215 * CONNECTING x x x x - x
216 * CONNECTED x x x -
217 *
218 * This table not available in kernel-doc because the formatting messes it up.
219 */
220 enum wimax_st {
221 __WIMAX_ST_NULL = 0,
222 WIMAX_ST_DOWN,
223 __WIMAX_ST_QUIESCING,
224 WIMAX_ST_UNINITIALIZED,
225 WIMAX_ST_RADIO_OFF,
226 WIMAX_ST_READY,
227 WIMAX_ST_SCANNING,
228 WIMAX_ST_CONNECTING,
229 WIMAX_ST_CONNECTED,
230 __WIMAX_ST_INVALID /* Always keep last */
231};
232
233
234#endif /* #ifndef __LINUX__WIMAX_H__ */
diff --git a/include/linux/wimax/Kbuild b/include/linux/wimax/Kbuild
new file mode 100644
index 000000000000..3cb4f269bb09
--- /dev/null
+++ b/include/linux/wimax/Kbuild
@@ -0,0 +1 @@
header-y += i2400m.h
diff --git a/include/linux/wimax/debug.h b/include/linux/wimax/debug.h
new file mode 100644
index 000000000000..ba0c49399a83
--- /dev/null
+++ b/include/linux/wimax/debug.h
@@ -0,0 +1,453 @@
1/*
2 * Linux WiMAX
3 * Collection of tools to manage debug operations.
4 *
5 *
6 * Copyright (C) 2005-2007 Intel Corporation
7 * Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License version
11 * 2 as published by the Free Software Foundation.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21 * 02110-1301, USA.
22 *
23 *
24 * Don't #include this file directly, read on!
25 *
26 *
27 * EXECUTING DEBUGGING ACTIONS OR NOT
28 *
29 * The main thing this framework provides is decission power to take a
30 * debug action (like printing a message) if the current debug level
31 * allows it.
32 *
33 * The decission power is at two levels: at compile-time (what does
34 * not make it is compiled out) and at run-time. The run-time
35 * selection is done per-submodule (as they are declared by the user
36 * of the framework).
37 *
38 * A call to d_test(L) (L being the target debug level) returns true
39 * if the action should be taken because the current debug levels
40 * allow it (both compile and run time).
41 *
42 * It follows that a call to d_test() that can be determined to be
43 * always false at compile time will get the code depending on it
44 * compiled out by optimization.
45 *
46 *
47 * DEBUG LEVELS
48 *
49 * It is up to the caller to define how much a debugging level is.
50 *
51 * Convention sets 0 as "no debug" (so an action marked as debug level 0
52 * will always be taken). The increasing debug levels are used for
53 * increased verbosity.
54 *
55 *
56 * USAGE
57 *
58 * Group the code in modules and submodules inside each module [which
59 * in most cases maps to Linux modules and .c files that compose
60 * those].
61 *
62 *
63 * For each module, there is:
64 *
65 * - a MODULENAME (single word, legal C identifier)
66 *
67 * - a debug-levels.h header file that declares the list of
68 * submodules and that is included by all .c files that use
69 * the debugging tools. The file name can be anything.
70 *
71 * - some (optional) .c code to manipulate the runtime debug levels
72 * through debugfs.
73 *
74 * The debug-levels.h file would look like:
75 *
76 * #ifndef __debug_levels__h__
77 * #define __debug_levels__h__
78 *
79 * #define D_MODULENAME modulename
80 * #define D_MASTER 10
81 *
82 * #include <linux/wimax/debug.h>
83 *
84 * enum d_module {
85 * D_SUBMODULE_DECLARE(submodule_1),
86 * D_SUBMODULE_DECLARE(submodule_2),
87 * ...
88 * D_SUBMODULE_DECLARE(submodule_N)
89 * };
90 *
91 * #endif
92 *
93 * D_MASTER is the maximum compile-time debug level; any debug actions
94 * above this will be out. D_MODULENAME is the module name (legal C
95 * identifier), which has to be unique for each module (to avoid
96 * namespace collisions during linkage). Note those #defines need to
97 * be done before #including debug.h
98 *
99 * We declare N different submodules whose debug level can be
100 * independently controlled during runtime.
101 *
102 * In a .c file of the module (and only in one of them), define the
103 * following code:
104 *
105 * struct d_level D_LEVEL[] = {
106 * D_SUBMODULE_DEFINE(submodule_1),
107 * D_SUBMODULE_DEFINE(submodule_2),
108 * ...
109 * D_SUBMODULE_DEFINE(submodule_N),
110 * };
111 * size_t D_LEVEL_SIZE = ARRAY_SIZE(D_LEVEL);
112 *
113 * Externs for d_level_MODULENAME and d_level_size_MODULENAME are used
114 * and declared in this file using the D_LEVEL and D_LEVEL_SIZE macros
115 * #defined also in this file.
116 *
117 * To manipulate from user space the levels, create a debugfs dentry
118 * and then register each submodule with:
119 *
120 * result = d_level_register_debugfs("PREFIX_", submodule_X, parent);
121 * if (result < 0)
122 * goto error;
123 *
124 * Where PREFIX_ is a name of your chosing. This will create debugfs
125 * file with a single numeric value that can be use to tweak it. To
126 * remove the entires, just use debugfs_remove_recursive() on 'parent'.
127 *
128 * NOTE: remember that even if this will show attached to some
129 * particular instance of a device, the settings are *global*.
130 *
131 *
132 * On each submodule (for example, .c files), the debug infrastructure
133 * should be included like this:
134 *
135 * #define D_SUBMODULE submodule_x // matches one in debug-levels.h
136 * #include "debug-levels.h"
137 *
138 * after #including all your include files.
139 *
140 *
141 * Now you can use the d_*() macros below [d_test(), d_fnstart(),
142 * d_fnend(), d_printf(), d_dump()].
143 *
144 * If their debug level is greater than D_MASTER, they will be
145 * compiled out.
146 *
147 * If their debug level is lower or equal than D_MASTER but greater
148 * than the current debug level of their submodule, they'll be
149 * ignored.
150 *
151 * Otherwise, the action will be performed.
152 */
153#ifndef __debug__h__
154#define __debug__h__
155
156#include <linux/types.h>
157#include <linux/device.h>
158
159
160/* Backend stuff */
161
162/*
163 * Debug backend: generate a message header from a 'struct device'
164 *
165 * @head: buffer where to place the header
166 * @head_size: length of @head
167 * @dev: pointer to device used to generate a header from. If NULL,
168 * an empty ("") header is generated.
169 */
170static inline
171void __d_head(char *head, size_t head_size,
172 struct device *dev)
173{
174 if (dev == NULL)
175 head[0] = 0;
176 else if ((unsigned long)dev < 4096) {
177 printk(KERN_ERR "E: Corrupt dev %p\n", dev);
178 WARN_ON(1);
179 } else
180 snprintf(head, head_size, "%s %s: ",
181 dev_driver_string(dev), dev->bus_id);
182}
183
184
185/*
186 * Debug backend: log some message if debugging is enabled
187 *
188 * @l: intended debug level
189 * @tag: tag to prefix the message with
190 * @dev: 'struct device' associated to this message
191 * @f: printf-like format and arguments
192 *
193 * Note this is optimized out if it doesn't pass the compile-time
194 * check; however, it is *always* compiled. This is useful to make
195 * sure the printf-like formats and variables are always checked and
196 * they don't get bit rot if you have all the debugging disabled.
197 */
198#define _d_printf(l, tag, dev, f, a...) \
199do { \
200 char head[64]; \
201 if (!d_test(l)) \
202 break; \
203 __d_head(head, sizeof(head), dev); \
204 printk(KERN_ERR "%s%s%s: " f, head, __func__, tag, ##a); \
205} while (0)
206
207
208/*
209 * CPP sintatic sugar to generate A_B like symbol names when one of
210 * the arguments is a a preprocessor #define.
211 */
212#define __D_PASTE__(varname, modulename) varname##_##modulename
213#define __D_PASTE(varname, modulename) (__D_PASTE__(varname, modulename))
214#define _D_SUBMODULE_INDEX(_name) (D_SUBMODULE_DECLARE(_name))
215
216
217/*
218 * Store a submodule's runtime debug level and name
219 */
220struct d_level {
221 u8 level;
222 const char *name;
223};
224
225
226/*
227 * List of available submodules and their debug levels
228 *
229 * We call them d_level_MODULENAME and d_level_size_MODULENAME; the
230 * macros D_LEVEL and D_LEVEL_SIZE contain the name already for
231 * convenience.
232 *
233 * This array and the size are defined on some .c file that is part of
234 * the current module.
235 */
236#define D_LEVEL __D_PASTE(d_level, D_MODULENAME)
237#define D_LEVEL_SIZE __D_PASTE(d_level_size, D_MODULENAME)
238
239extern struct d_level D_LEVEL[];
240extern size_t D_LEVEL_SIZE;
241
242
243/*
244 * Frontend stuff
245 *
246 *
247 * Stuff you need to declare prior to using the actual "debug" actions
248 * (defined below).
249 */
250
251#ifndef D_MODULENAME
252#error D_MODULENAME is not defined in your debug-levels.h file
253/**
254 * D_MODULE - Name of the current module
255 *
256 * #define in your module's debug-levels.h, making sure it is
257 * unique. This has to be a legal C identifier.
258 */
259#define D_MODULENAME undefined_modulename
260#endif
261
262
263#ifndef D_MASTER
264#warning D_MASTER not defined, but debug.h included! [see docs]
265/**
266 * D_MASTER - Compile time maximum debug level
267 *
268 * #define in your debug-levels.h file to the maximum debug level the
269 * runtime code will be allowed to have. This allows you to provide a
270 * main knob.
271 *
272 * Anything above that level will be optimized out of the compile.
273 *
274 * Defaults to zero (no debug code compiled in).
275 *
276 * Maximum one definition per module (at the debug-levels.h file).
277 */
278#define D_MASTER 0
279#endif
280
281#ifndef D_SUBMODULE
282#error D_SUBMODULE not defined, but debug.h included! [see docs]
283/**
284 * D_SUBMODULE - Name of the current submodule
285 *
286 * #define in your submodule .c file before #including debug-levels.h
287 * to the name of the current submodule as previously declared and
288 * defined with D_SUBMODULE_DECLARE() (in your module's
289 * debug-levels.h) and D_SUBMODULE_DEFINE().
290 *
291 * This is used to provide runtime-control over the debug levels.
292 *
293 * Maximum one per .c file! Can be shared among different .c files
294 * (meaning they belong to the same submodule categorization).
295 */
296#define D_SUBMODULE undefined_module
297#endif
298
299
300/**
301 * D_SUBMODULE_DECLARE - Declare a submodule for runtime debug level control
302 *
303 * @_name: name of the submodule, restricted to the chars that make up a
304 * valid C identifier ([a-zA-Z0-9_]).
305 *
306 * Declare in the module's debug-levels.h header file as:
307 *
308 * enum d_module {
309 * D_SUBMODULE_DECLARE(submodule_1),
310 * D_SUBMODULE_DECLARE(submodule_2),
311 * D_SUBMODULE_DECLARE(submodule_3),
312 * };
313 *
314 * Some corresponding .c file needs to have a matching
315 * D_SUBMODULE_DEFINE().
316 */
317#define D_SUBMODULE_DECLARE(_name) __D_SUBMODULE_##_name
318
319
320/**
321 * D_SUBMODULE_DEFINE - Define a submodule for runtime debug level control
322 *
323 * @_name: name of the submodule, restricted to the chars that make up a
324 * valid C identifier ([a-zA-Z0-9_]).
325 *
326 * Use once per module (in some .c file) as:
327 *
328 * static
329 * struct d_level d_level_SUBMODULENAME[] = {
330 * D_SUBMODULE_DEFINE(submodule_1),
331 * D_SUBMODULE_DEFINE(submodule_2),
332 * D_SUBMODULE_DEFINE(submodule_3),
333 * };
334 * size_t d_level_size_SUBDMODULENAME = ARRAY_SIZE(d_level_SUBDMODULENAME);
335 *
336 * Matching D_SUBMODULE_DECLARE()s have to be present in a
337 * debug-levels.h header file.
338 */
339#define D_SUBMODULE_DEFINE(_name) \
340[__D_SUBMODULE_##_name] = { \
341 .level = 0, \
342 .name = #_name \
343}
344
345
346
347/* The actual "debug" operations */
348
349
350/**
351 * d_test - Returns true if debugging should be enabled
352 *
353 * @l: intended debug level (unsigned)
354 *
355 * If the master debug switch is enabled and the current settings are
356 * higher or equal to the requested level, then debugging
357 * output/actions should be enabled.
358 *
359 * NOTE:
360 *
361 * This needs to be coded so that it can be evaluated in compile
362 * time; this is why the ugly BUG_ON() is placed in there, so the
363 * D_MASTER evaluation compiles all out if it is compile-time false.
364 */
365#define d_test(l) \
366({ \
367 unsigned __l = l; /* type enforcer */ \
368 (D_MASTER) >= __l \
369 && ({ \
370 BUG_ON(_D_SUBMODULE_INDEX(D_SUBMODULE) >= D_LEVEL_SIZE);\
371 D_LEVEL[_D_SUBMODULE_INDEX(D_SUBMODULE)].level >= __l; \
372 }); \
373})
374
375
376/**
377 * d_fnstart - log message at function start if debugging enabled
378 *
379 * @l: intended debug level
380 * @_dev: 'struct device' pointer, NULL if none (for context)
381 * @f: printf-like format and arguments
382 */
383#define d_fnstart(l, _dev, f, a...) _d_printf(l, " FNSTART", _dev, f, ## a)
384
385
386/**
387 * d_fnend - log message at function end if debugging enabled
388 *
389 * @l: intended debug level
390 * @_dev: 'struct device' pointer, NULL if none (for context)
391 * @f: printf-like format and arguments
392 */
393#define d_fnend(l, _dev, f, a...) _d_printf(l, " FNEND", _dev, f, ## a)
394
395
396/**
397 * d_printf - log message if debugging enabled
398 *
399 * @l: intended debug level
400 * @_dev: 'struct device' pointer, NULL if none (for context)
401 * @f: printf-like format and arguments
402 */
403#define d_printf(l, _dev, f, a...) _d_printf(l, "", _dev, f, ## a)
404
405
406/**
407 * d_dump - log buffer hex dump if debugging enabled
408 *
409 * @l: intended debug level
410 * @_dev: 'struct device' pointer, NULL if none (for context)
411 * @f: printf-like format and arguments
412 */
413#define d_dump(l, dev, ptr, size) \
414do { \
415 char head[64]; \
416 if (!d_test(l)) \
417 break; \
418 __d_head(head, sizeof(head), dev); \
419 print_hex_dump(KERN_ERR, head, 0, 16, 1, \
420 ((void *) ptr), (size), 0); \
421} while (0)
422
423
424/**
425 * Export a submodule's debug level over debugfs as PREFIXSUBMODULE
426 *
427 * @prefix: string to prefix the name with
428 * @submodule: name of submodule (not a string, just the name)
429 * @dentry: debugfs parent dentry
430 *
431 * Returns: 0 if ok, < 0 errno on error.
432 *
433 * For removing, just use debugfs_remove_recursive() on the parent.
434 */
435#define d_level_register_debugfs(prefix, name, parent) \
436({ \
437 int rc; \
438 struct dentry *fd; \
439 struct dentry *verify_parent_type = parent; \
440 fd = debugfs_create_u8( \
441 prefix #name, 0600, verify_parent_type, \
442 &(D_LEVEL[__D_SUBMODULE_ ## name].level)); \
443 rc = PTR_ERR(fd); \
444 if (IS_ERR(fd) && rc != -ENODEV) \
445 printk(KERN_ERR "%s: Can't create debugfs entry %s: " \
446 "%d\n", __func__, prefix #name, rc); \
447 else \
448 rc = 0; \
449 rc; \
450})
451
452
453#endif /* #ifndef __debug__h__ */
diff --git a/include/linux/wimax/i2400m.h b/include/linux/wimax/i2400m.h
new file mode 100644
index 000000000000..74198f5bb4dc
--- /dev/null
+++ b/include/linux/wimax/i2400m.h
@@ -0,0 +1,512 @@
1/*
2 * Intel Wireless WiMax Connection 2400m
3 * Host-Device protocol interface definitions
4 *
5 *
6 * Copyright (C) 2007-2008 Intel Corporation. All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 *
12 * * Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * * Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in
16 * the documentation and/or other materials provided with the
17 * distribution.
18 * * Neither the name of Intel Corporation nor the names of its
19 * contributors may be used to endorse or promote products derived
20 * from this software without specific prior written permission.
21 *
22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 *
34 *
35 * Intel Corporation <linux-wimax@intel.com>
36 * Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
37 * - Initial implementation
38 *
39 *
40 * This header defines the data structures and constants used to
41 * communicate with the device.
42 *
43 * BOOTMODE/BOOTROM/FIRMWARE UPLOAD PROTOCOL
44 *
45 * The firmware upload protocol is quite simple and only requires a
46 * handful of commands. See drivers/net/wimax/i2400m/fw.c for more
47 * details.
48 *
49 * The BCF data structure is for the firmware file header.
50 *
51 *
52 * THE DATA / CONTROL PROTOCOL
53 *
54 * This is the normal protocol spoken with the device once the
55 * firmware is uploaded. It transports data payloads and control
56 * messages back and forth.
57 *
58 * It consists 'messages' that pack one or more payloads each. The
59 * format is described in detail in drivers/net/wimax/i2400m/rx.c and
60 * tx.c.
61 *
62 *
63 * THE L3L4 PROTOCOL
64 *
65 * The term L3L4 refers to Layer 3 (the device), Layer 4 (the
66 * driver/host software).
67 *
68 * This is the control protocol used by the host to control the i2400m
69 * device (scan, connect, disconnect...). This is sent to / received
70 * as control frames. These frames consist of a header and zero or
71 * more TLVs with information. We call each control frame a "message".
72 *
73 * Each message is composed of:
74 *
75 * HEADER
76 * [TLV0 + PAYLOAD0]
77 * [TLV1 + PAYLOAD1]
78 * [...]
79 * [TLVN + PAYLOADN]
80 *
81 * The HEADER is defined by 'struct i2400m_l3l4_hdr'. The payloads are
82 * defined by a TLV structure (Type Length Value) which is a 'header'
83 * (struct i2400m_tlv_hdr) and then the payload.
84 *
85 * All integers are represented as Little Endian.
86 *
87 * - REQUESTS AND EVENTS
88 *
89 * The requests can be clasified as follows:
90 *
91 * COMMAND: implies a request from the host to the device requesting
92 * an action being performed. The device will reply with a
93 * message (with the same type as the command), status and
94 * no (TLV) payload. Execution of a command might cause
95 * events (of different type) to be sent later on as
96 * device's state changes.
97 *
98 * GET/SET: similar to COMMAND, but will not cause other
99 * EVENTs. The reply, in the case of GET, will contain
100 * TLVs with the requested information.
101 *
102 * EVENT: asynchronous messages sent from the device, maybe as a
103 * consequence of previous COMMANDs but disassociated from
104 * them.
105 *
106 * Only one request might be pending at the same time (ie: don't
107 * parallelize nor post another GET request before the previous
108 * COMMAND has been acknowledged with it's corresponding reply by the
109 * device).
110 *
111 * The different requests and their formats are described below:
112 *
113 * I2400M_MT_* Message types
114 * I2400M_MS_* Message status (for replies, events)
115 * i2400m_tlv_* TLVs
116 *
117 * data types are named 'struct i2400m_msg_OPNAME', OPNAME matching the
118 * operation.
119 */
120
121#ifndef __LINUX__WIMAX__I2400M_H__
122#define __LINUX__WIMAX__I2400M_H__
123
124#include <linux/types.h>
125
126
127/*
128 * Host Device Interface (HDI) common to all busses
129 */
130
131/* Boot-mode (firmware upload mode) commands */
132
133/* Header for the firmware file */
134struct i2400m_bcf_hdr {
135 __le32 module_type;
136 __le32 header_len;
137 __le32 header_version;
138 __le32 module_id;
139 __le32 module_vendor;
140 __le32 date; /* BCD YYYMMDD */
141 __le32 size;
142 __le32 key_size; /* in dwords */
143 __le32 modulus_size; /* in dwords */
144 __le32 exponent_size; /* in dwords */
145 __u8 reserved[88];
146} __attribute__ ((packed));
147
148/* Boot mode opcodes */
149enum i2400m_brh_opcode {
150 I2400M_BRH_READ = 1,
151 I2400M_BRH_WRITE = 2,
152 I2400M_BRH_JUMP = 3,
153 I2400M_BRH_SIGNED_JUMP = 8,
154 I2400M_BRH_HASH_PAYLOAD_ONLY = 9,
155};
156
157/* Boot mode command masks and stuff */
158enum i2400m_brh {
159 I2400M_BRH_SIGNATURE = 0xcbbc0000,
160 I2400M_BRH_SIGNATURE_MASK = 0xffff0000,
161 I2400M_BRH_SIGNATURE_SHIFT = 16,
162 I2400M_BRH_OPCODE_MASK = 0x0000000f,
163 I2400M_BRH_RESPONSE_MASK = 0x000000f0,
164 I2400M_BRH_RESPONSE_SHIFT = 4,
165 I2400M_BRH_DIRECT_ACCESS = 0x00000400,
166 I2400M_BRH_RESPONSE_REQUIRED = 0x00000200,
167 I2400M_BRH_USE_CHECKSUM = 0x00000100,
168};
169
170
171/* Constants for bcf->module_id */
172enum i2400m_bcf_mod_id {
173 /* Firmware file carries its own pokes -- pokes are a set of
174 * magical values that have to be written in certain memory
175 * addresses to get the device up and ready for firmware
176 * download when it is in non-signed boot mode. */
177 I2400M_BCF_MOD_ID_POKES = 0x000000001,
178};
179
180
181/**
182 * i2400m_bootrom_header - Header for a boot-mode command
183 *
184 * @cmd: the above command descriptor
185 * @target_addr: where on the device memory should the action be performed.
186 * @data_size: for read/write, amount of data to be read/written
187 * @block_checksum: checksum value (if applicable)
188 * @payload: the beginning of data attached to this header
189 */
190struct i2400m_bootrom_header {
191 __le32 command; /* Compose with enum i2400_brh */
192 __le32 target_addr;
193 __le32 data_size;
194 __le32 block_checksum;
195 char payload[0];
196} __attribute__ ((packed));
197
198
199/*
200 * Data / control protocol
201 */
202
203/* Packet types for the host-device interface */
204enum i2400m_pt {
205 I2400M_PT_DATA = 0,
206 I2400M_PT_CTRL,
207 I2400M_PT_TRACE, /* For device debug */
208 I2400M_PT_RESET_WARM, /* device reset */
209 I2400M_PT_RESET_COLD, /* USB[transport] reset, like reconnect */
210 I2400M_PT_ILLEGAL
211};
212
213
214/*
215 * Payload for a data packet
216 *
217 * This is prefixed to each and every outgoing DATA type.
218 */
219struct i2400m_pl_data_hdr {
220 __le32 reserved;
221} __attribute__((packed));
222
223
224/* Misc constants */
225enum {
226 I2400M_PL_PAD = 16, /* Payload data size alignment */
227 I2400M_PL_SIZE_MAX = 0x3EFF,
228 I2400M_MAX_PLS_IN_MSG = 60,
229 /* protocol barkers: sync sequences; for notifications they
230 * are sent in groups of four. */
231 I2400M_H2D_PREVIEW_BARKER = 0xcafe900d,
232 I2400M_COLD_RESET_BARKER = 0xc01dc01d,
233 I2400M_WARM_RESET_BARKER = 0x50f750f7,
234 I2400M_NBOOT_BARKER = 0xdeadbeef,
235 I2400M_SBOOT_BARKER = 0x0ff1c1a1,
236 I2400M_ACK_BARKER = 0xfeedbabe,
237 I2400M_D2H_MSG_BARKER = 0xbeefbabe,
238};
239
240
241/*
242 * Hardware payload descriptor
243 *
244 * Bitfields encoded in a struct to enforce typing semantics.
245 *
246 * Look in rx.c and tx.c for a full description of the format.
247 */
248struct i2400m_pld {
249 __le32 val;
250} __attribute__ ((packed));
251
252#define I2400M_PLD_SIZE_MASK 0x00003fff
253#define I2400M_PLD_TYPE_SHIFT 16
254#define I2400M_PLD_TYPE_MASK 0x000f0000
255
256/*
257 * Header for a TX message or RX message
258 *
259 * @barker: preamble
260 * @size: used for management of the FIFO queue buffer; before
261 * sending, this is converted to be a real preamble. This
262 * indicates the real size of the TX message that starts at this
263 * point. If the highest bit is set, then this message is to be
264 * skipped.
265 * @sequence: sequence number of this message
266 * @offset: offset where the message itself starts -- see the comments
267 * in the file header about message header and payload descriptor
268 * alignment.
269 * @num_pls: number of payloads in this message
270 * @padding: amount of padding bytes at the end of the message to make
271 * it be of block-size aligned
272 *
273 * Look in rx.c and tx.c for a full description of the format.
274 */
275struct i2400m_msg_hdr {
276 union {
277 __le32 barker;
278 __u32 size; /* same size type as barker!! */
279 };
280 union {
281 __le32 sequence;
282 __u32 offset; /* same size type as barker!! */
283 };
284 __le16 num_pls;
285 __le16 rsv1;
286 __le16 padding;
287 __le16 rsv2;
288 struct i2400m_pld pld[0];
289} __attribute__ ((packed));
290
291
292
293/*
294 * L3/L4 control protocol
295 */
296
297enum {
298 /* Interface version */
299 I2400M_L3L4_VERSION = 0x0100,
300};
301
302/* Message types */
303enum i2400m_mt {
304 I2400M_MT_RESERVED = 0x0000,
305 I2400M_MT_INVALID = 0xffff,
306 I2400M_MT_REPORT_MASK = 0x8000,
307
308 I2400M_MT_GET_SCAN_RESULT = 0x4202,
309 I2400M_MT_SET_SCAN_PARAM = 0x4402,
310 I2400M_MT_CMD_RF_CONTROL = 0x4602,
311 I2400M_MT_CMD_SCAN = 0x4603,
312 I2400M_MT_CMD_CONNECT = 0x4604,
313 I2400M_MT_CMD_DISCONNECT = 0x4605,
314 I2400M_MT_CMD_EXIT_IDLE = 0x4606,
315 I2400M_MT_GET_LM_VERSION = 0x5201,
316 I2400M_MT_GET_DEVICE_INFO = 0x5202,
317 I2400M_MT_GET_LINK_STATUS = 0x5203,
318 I2400M_MT_GET_STATISTICS = 0x5204,
319 I2400M_MT_GET_STATE = 0x5205,
320 I2400M_MT_GET_MEDIA_STATUS = 0x5206,
321 I2400M_MT_SET_INIT_CONFIG = 0x5404,
322 I2400M_MT_CMD_INIT = 0x5601,
323 I2400M_MT_CMD_TERMINATE = 0x5602,
324 I2400M_MT_CMD_MODE_OF_OP = 0x5603,
325 I2400M_MT_CMD_RESET_DEVICE = 0x5604,
326 I2400M_MT_CMD_MONITOR_CONTROL = 0x5605,
327 I2400M_MT_CMD_ENTER_POWERSAVE = 0x5606,
328 I2400M_MT_GET_TLS_OPERATION_RESULT = 0x6201,
329 I2400M_MT_SET_EAP_SUCCESS = 0x6402,
330 I2400M_MT_SET_EAP_FAIL = 0x6403,
331 I2400M_MT_SET_EAP_KEY = 0x6404,
332 I2400M_MT_CMD_SEND_EAP_RESPONSE = 0x6602,
333 I2400M_MT_REPORT_SCAN_RESULT = 0xc002,
334 I2400M_MT_REPORT_STATE = 0xd002,
335 I2400M_MT_REPORT_POWERSAVE_READY = 0xd005,
336 I2400M_MT_REPORT_EAP_REQUEST = 0xe002,
337 I2400M_MT_REPORT_EAP_RESTART = 0xe003,
338 I2400M_MT_REPORT_ALT_ACCEPT = 0xe004,
339 I2400M_MT_REPORT_KEY_REQUEST = 0xe005,
340};
341
342
343/*
344 * Message Ack Status codes
345 *
346 * When a message is replied-to, this status is reported.
347 */
348enum i2400m_ms {
349 I2400M_MS_DONE_OK = 0,
350 I2400M_MS_DONE_IN_PROGRESS = 1,
351 I2400M_MS_INVALID_OP = 2,
352 I2400M_MS_BAD_STATE = 3,
353 I2400M_MS_ILLEGAL_VALUE = 4,
354 I2400M_MS_MISSING_PARAMS = 5,
355 I2400M_MS_VERSION_ERROR = 6,
356 I2400M_MS_ACCESSIBILITY_ERROR = 7,
357 I2400M_MS_BUSY = 8,
358 I2400M_MS_CORRUPTED_TLV = 9,
359 I2400M_MS_UNINITIALIZED = 10,
360 I2400M_MS_UNKNOWN_ERROR = 11,
361 I2400M_MS_PRODUCTION_ERROR = 12,
362 I2400M_MS_NO_RF = 13,
363 I2400M_MS_NOT_READY_FOR_POWERSAVE = 14,
364 I2400M_MS_THERMAL_CRITICAL = 15,
365 I2400M_MS_MAX
366};
367
368
369/**
370 * i2400m_tlv - enumeration of the different types of TLVs
371 *
372 * TLVs stand for type-length-value and are the header for a payload
373 * composed of almost anything. Each payload has a type assigned
374 * and a length.
375 */
376enum i2400m_tlv {
377 I2400M_TLV_L4_MESSAGE_VERSIONS = 129,
378 I2400M_TLV_SYSTEM_STATE = 141,
379 I2400M_TLV_MEDIA_STATUS = 161,
380 I2400M_TLV_RF_OPERATION = 162,
381 I2400M_TLV_RF_STATUS = 163,
382 I2400M_TLV_DEVICE_RESET_TYPE = 132,
383 I2400M_TLV_CONFIG_IDLE_PARAMETERS = 601,
384};
385
386
387struct i2400m_tlv_hdr {
388 __le16 type;
389 __le16 length; /* payload's */
390 __u8 pl[0];
391} __attribute__((packed));
392
393
394struct i2400m_l3l4_hdr {
395 __le16 type;
396 __le16 length; /* payload's */
397 __le16 version;
398 __le16 resv1;
399 __le16 status;
400 __le16 resv2;
401 struct i2400m_tlv_hdr pl[0];
402} __attribute__((packed));
403
404
405/**
406 * i2400m_system_state - different states of the device
407 */
408enum i2400m_system_state {
409 I2400M_SS_UNINITIALIZED = 1,
410 I2400M_SS_INIT,
411 I2400M_SS_READY,
412 I2400M_SS_SCAN,
413 I2400M_SS_STANDBY,
414 I2400M_SS_CONNECTING,
415 I2400M_SS_WIMAX_CONNECTED,
416 I2400M_SS_DATA_PATH_CONNECTED,
417 I2400M_SS_IDLE,
418 I2400M_SS_DISCONNECTING,
419 I2400M_SS_OUT_OF_ZONE,
420 I2400M_SS_SLEEPACTIVE,
421 I2400M_SS_PRODUCTION,
422 I2400M_SS_CONFIG,
423 I2400M_SS_RF_OFF,
424 I2400M_SS_RF_SHUTDOWN,
425 I2400M_SS_DEVICE_DISCONNECT,
426 I2400M_SS_MAX,
427};
428
429
430/**
431 * i2400m_tlv_system_state - report on the state of the system
432 *
433 * @state: see enum i2400m_system_state
434 */
435struct i2400m_tlv_system_state {
436 struct i2400m_tlv_hdr hdr;
437 __le32 state;
438} __attribute__((packed));
439
440
441struct i2400m_tlv_l4_message_versions {
442 struct i2400m_tlv_hdr hdr;
443 __le16 major;
444 __le16 minor;
445 __le16 branch;
446 __le16 reserved;
447} __attribute__((packed));
448
449
450struct i2400m_tlv_detailed_device_info {
451 struct i2400m_tlv_hdr hdr;
452 __u8 reserved1[400];
453 __u8 mac_address[6];
454 __u8 reserved2[2];
455} __attribute__((packed));
456
457
458enum i2400m_rf_switch_status {
459 I2400M_RF_SWITCH_ON = 1,
460 I2400M_RF_SWITCH_OFF = 2,
461};
462
463struct i2400m_tlv_rf_switches_status {
464 struct i2400m_tlv_hdr hdr;
465 __u8 sw_rf_switch; /* 1 ON, 2 OFF */
466 __u8 hw_rf_switch; /* 1 ON, 2 OFF */
467 __u8 reserved[2];
468} __attribute__((packed));
469
470
471enum {
472 i2400m_rf_operation_on = 1,
473 i2400m_rf_operation_off = 2
474};
475
476struct i2400m_tlv_rf_operation {
477 struct i2400m_tlv_hdr hdr;
478 __le32 status; /* 1 ON, 2 OFF */
479} __attribute__((packed));
480
481
482enum i2400m_tlv_reset_type {
483 I2400M_RESET_TYPE_COLD = 1,
484 I2400M_RESET_TYPE_WARM
485};
486
487struct i2400m_tlv_device_reset_type {
488 struct i2400m_tlv_hdr hdr;
489 __le32 reset_type;
490} __attribute__((packed));
491
492
493struct i2400m_tlv_config_idle_parameters {
494 struct i2400m_tlv_hdr hdr;
495 __le32 idle_timeout; /* 100 to 300000 ms [5min], 100 increments
496 * 0 disabled */
497 __le32 idle_paging_interval; /* frames */
498} __attribute__((packed));
499
500
501enum i2400m_media_status {
502 I2400M_MEDIA_STATUS_LINK_UP = 1,
503 I2400M_MEDIA_STATUS_LINK_DOWN,
504 I2400M_MEDIA_STATUS_LINK_RENEW,
505};
506
507struct i2400m_tlv_media_status {
508 struct i2400m_tlv_hdr hdr;
509 __le32 media_status;
510} __attribute__((packed));
511
512#endif /* #ifndef __LINUX__WIMAX__I2400M_H__ */
diff --git a/include/mtd/ubi-user.h b/include/mtd/ubi-user.h
index ccdc562e444e..2dc2eb2b8e22 100644
--- a/include/mtd/ubi-user.h
+++ b/include/mtd/ubi-user.h
@@ -253,7 +253,7 @@ struct ubi_mkvol_req {
253 * 253 *
254 * Re-sizing is possible for both dynamic and static volumes. But while dynamic 254 * Re-sizing is possible for both dynamic and static volumes. But while dynamic
255 * volumes may be re-sized arbitrarily, static volumes cannot be made to be 255 * volumes may be re-sized arbitrarily, static volumes cannot be made to be
256 * smaller then the number of bytes they bear. To arbitrarily shrink a static 256 * smaller than the number of bytes they bear. To arbitrarily shrink a static
257 * volume, it must be wiped out first (by means of volume update operation with 257 * volume, it must be wiped out first (by means of volume update operation with
258 * zero number of bytes). 258 * zero number of bytes).
259 */ 259 */
diff --git a/include/net/wimax.h b/include/net/wimax.h
new file mode 100644
index 000000000000..1602614fdaf9
--- /dev/null
+++ b/include/net/wimax.h
@@ -0,0 +1,520 @@
1/*
2 * Linux WiMAX
3 * Kernel space API for accessing WiMAX devices
4 *
5 *
6 * Copyright (C) 2007-2008 Intel Corporation <linux-wimax@intel.com>
7 * Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License version
11 * 2 as published by the Free Software Foundation.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21 * 02110-1301, USA.
22 *
23 *
24 * The WiMAX stack provides an API for controlling and managing the
25 * system's WiMAX devices. This API affects the control plane; the
26 * data plane is accessed via the network stack (netdev).
27 *
28 * Parts of the WiMAX stack API and notifications are exported to
29 * user space via Generic Netlink. In user space, libwimax (part of
30 * the wimax-tools package) provides a shim layer for accessing those
31 * calls.
32 *
33 * The API is standarized for all WiMAX devices and different drivers
34 * implement the backend support for it. However, device-specific
35 * messaging pipes are provided that can be used to issue commands and
36 * receive notifications in free form.
37 *
38 * Currently the messaging pipes are the only means of control as it
39 * is not known (due to the lack of more devices in the market) what
40 * will be a good abstraction layer. Expect this to change as more
41 * devices show in the market. This API is designed to be growable in
42 * order to address this problem.
43 *
44 * USAGE
45 *
46 * Embed a `struct wimax_dev` at the beginning of the the device's
47 * private structure, initialize and register it. For details, see
48 * `struct wimax_dev`s documentation.
49 *
50 * Once this is done, wimax-tools's libwimaxll can be used to
51 * communicate with the driver from user space. You user space
52 * application does not have to forcibily use libwimaxll and can talk
53 * the generic netlink protocol directly if desired.
54 *
55 * Remember this is a very low level API that will to provide all of
56 * WiMAX features. Other daemons and services running in user space
57 * are the expected clients of it. They offer a higher level API that
58 * applications should use (an example of this is the Intel's WiMAX
59 * Network Service for the i2400m).
60 *
61 * DESIGN
62 *
63 * Although not set on final stone, this very basic interface is
64 * mostly completed. Remember this is meant to grow as new common
65 * operations are decided upon. New operations will be added to the
66 * interface, intent being on keeping backwards compatibility as much
67 * as possible.
68 *
69 * This layer implements a set of calls to control a WiMAX device,
70 * exposing a frontend to the rest of the kernel and user space (via
71 * generic netlink) and a backend implementation in the driver through
72 * function pointers.
73 *
74 * WiMAX devices have a state, and a kernel-only API allows the
75 * drivers to manipulate that state. State transitions are atomic, and
76 * only some of them are allowed (see `enum wimax_st`).
77 *
78 * Most API calls will set the state automatically; in most cases
79 * drivers have to only report state changes due to external
80 * conditions.
81 *
82 * All API operations are 'atomic', serialized thorough a mutex in the
83 * `struct wimax_dev`.
84 *
85 * EXPORTING TO USER SPACE THROUGH GENERIC NETLINK
86 *
87 * The API is exported to user space using generic netlink (other
88 * methods can be added as needed).
89 *
90 * There is a Generic Netlink Family named "WiMAX", where interfaces
91 * supporting the WiMAX interface receive commands and broadcast their
92 * signals over a multicast group named "msg".
93 *
94 * Mapping to the source/destination interface is done by an interface
95 * index attribute.
96 *
97 * For user-to-kernel traffic (commands) we use a function call
98 * marshalling mechanism, where a message X with attributes A, B, C
99 * sent from user space to kernel space means executing the WiMAX API
100 * call wimax_X(A, B, C), sending the results back as a message.
101 *
102 * Kernel-to-user (notifications or signals) communication is sent
103 * over multicast groups. This allows to have multiple applications
104 * monitoring them.
105 *
106 * Each command/signal gets assigned it's own attribute policy. This
107 * way the validator will verify that all the attributes in there are
108 * only the ones that should be for each command/signal. Thing of an
109 * attribute mapping to a type+argumentname for each command/signal.
110 *
111 * If we had a single policy for *all* commands/signals, after running
112 * the validator we'd have to check "does this attribute belong in
113 * here"? for each one. It can be done manually, but it's just easier
114 * to have the validator do that job with multiple policies. As well,
115 * it makes it easier to later expand each command/signal signature
116 * without affecting others and keeping the namespace more or less
117 * sane. Not that it is too complicated, but it makes it even easier.
118 *
119 * No state information is maintained in the kernel for each user
120 * space connection (the connection is stateless).
121 *
122 * TESTING FOR THE INTERFACE AND VERSIONING
123 *
124 * If network interface X is a WiMAX device, there will be a Generic
125 * Netlink family named "WiMAX X" and the device will present a
126 * "wimax" directory in it's network sysfs directory
127 * (/sys/class/net/DEVICE/wimax) [used by HAL].
128 *
129 * The inexistence of any of these means the device does not support
130 * this WiMAX API.
131 *
132 * By querying the generic netlink controller, versioning information
133 * and the multicast groups available can be found. Applications using
134 * the interface can either rely on that or use the generic netlink
135 * controller to figure out which generic netlink commands/signals are
136 * supported.
137 *
138 * NOTE: this versioning is a last resort to avoid hard
139 * incompatibilities. It is the intention of the design of this
140 * stack not to introduce backward incompatible changes.
141 *
142 * The version code has to fit in one byte (restrictions imposed by
143 * generic netlink); we use `version / 10` for the major version and
144 * `version % 10` for the minor. This gives 9 minors for each major
145 * and 25 majors.
146 *
147 * The version change protocol is as follow:
148 *
149 * - Major versions: needs to be increased if an existing message/API
150 * call is changed or removed. Doesn't need to be changed if a new
151 * message is added.
152 *
153 * - Minor version: needs to be increased if new messages/API calls are
154 * being added or some other consideration that doesn't impact the
155 * user-kernel interface too much (like some kind of bug fix) and
156 * that is kind of left up in the air to common sense.
157 *
158 * User space code should not try to work if the major version it was
159 * compiled for differs from what the kernel offers. As well, if the
160 * minor version of the kernel interface is lower than the one user
161 * space is expecting (the one it was compiled for), the kernel
162 * might be missing API calls; user space shall be ready to handle
163 * said condition. Use the generic netlink controller operations to
164 * find which ones are supported and which not.
165 *
166 * libwimaxll:wimaxll_open() takes care of checking versions.
167 *
168 * THE OPERATIONS:
169 *
170 * Each operation is defined in its on file (drivers/net/wimax/op-*.c)
171 * for clarity. The parts needed for an operation are:
172 *
173 * - a function pointer in `struct wimax_dev`: optional, as the
174 * operation might be implemented by the stack and not by the
175 * driver.
176 *
177 * All function pointers are named wimax_dev->op_*(), and drivers
178 * must implement them except where noted otherwise.
179 *
180 * - When exported to user space, a `struct nla_policy` to define the
181 * attributes of the generic netlink command and a `struct genl_ops`
182 * to define the operation.
183 *
184 * All the declarations for the operation codes (WIMAX_GNL_OP_<NAME>)
185 * and generic netlink attributes (WIMAX_GNL_<NAME>_*) are declared in
186 * include/linux/wimax.h; this file is intended to be cloned by user
187 * space to gain access to those declarations.
188 *
189 * A few caveats to remember:
190 *
191 * - Need to define attribute numbers starting in 1; otherwise it
192 * fails.
193 *
194 * - the `struct genl_family` requires a maximum attribute id; when
195 * defining the `struct nla_policy` for each message, it has to have
196 * an array size of WIMAX_GNL_ATTR_MAX+1.
197 *
198 * THE PIPE INTERFACE:
199 *
200 * This interface is kept intentionally simple. The driver can send
201 * and receive free-form messages to/from user space through a
202 * pipe. See drivers/net/wimax/op-msg.c for details.
203 *
204 * The kernel-to-user messages are sent with
205 * wimax_msg(). user-to-kernel messages are delivered via
206 * wimax_dev->op_msg_from_user().
207 *
208 * RFKILL:
209 *
210 * RFKILL support is built into the wimax_dev layer; the driver just
211 * needs to call wimax_report_rfkill_{hw,sw}() to inform of changes in
212 * the hardware or software RF kill switches. When the stack wants to
213 * turn the radio off, it will call wimax_dev->op_rfkill_sw_toggle(),
214 * which the driver implements.
215 *
216 * User space can set the software RF Kill switch by calling
217 * wimax_rfkill().
218 *
219 * The code for now only supports devices that don't require polling;
220 * If the device needs to be polled, create a self-rearming delayed
221 * work struct for polling or look into adding polled support to the
222 * WiMAX stack.
223 *
224 * When initializing the hardware (_probe), after calling
225 * wimax_dev_add(), query the device for it's RF Kill switches status
226 * and feed it back to the WiMAX stack using
227 * wimax_report_rfkill_{hw,sw}(). If any switch is missing, always
228 * report it as ON.
229 *
230 * NOTE: the wimax stack uses an inverted terminology to that of the
231 * RFKILL subsystem:
232 *
233 * - ON: radio is ON, RFKILL is DISABLED or OFF.
234 * - OFF: radio is OFF, RFKILL is ENABLED or ON.
235 *
236 * MISCELLANEOUS OPS:
237 *
238 * wimax_reset() can be used to reset the device to power on state; by
239 * default it issues a warm reset that maintains the same device
240 * node. If that is not possible, it falls back to a cold reset
241 * (device reconnect). The driver implements the backend to this
242 * through wimax_dev->op_reset().
243 */
244
245#ifndef __NET__WIMAX_H__
246#define __NET__WIMAX_H__
247#ifdef __KERNEL__
248
249#include <linux/wimax.h>
250#include <net/genetlink.h>
251#include <linux/netdevice.h>
252
253struct net_device;
254struct genl_info;
255struct wimax_dev;
256struct input_dev;
257
258/**
259 * struct wimax_dev - Generic WiMAX device
260 *
261 * @net_dev: [fill] Pointer to the &struct net_device this WiMAX
262 * device implements.
263 *
264 * @op_msg_from_user: [fill] Driver-specific operation to
265 * handle a raw message from user space to the driver. The
266 * driver can send messages to user space using with
267 * wimax_msg_to_user().
268 *
269 * @op_rfkill_sw_toggle: [fill] Driver-specific operation to act on
270 * userspace (or any other agent) requesting the WiMAX device to
271 * change the RF Kill software switch (WIMAX_RF_ON or
272 * WIMAX_RF_OFF).
273 * If such hardware support is not present, it is assumed the
274 * radio cannot be switched off and it is always on (and the stack
275 * will error out when trying to switch it off). In such case,
276 * this function pointer can be left as NULL.
277 *
278 * @op_reset: [fill] Driver specific operation to reset the
279 * device.
280 * This operation should always attempt first a warm reset that
281 * does not disconnect the device from the bus and return 0.
282 * If that fails, it should resort to some sort of cold or bus
283 * reset (even if it implies a bus disconnection and device
284 * dissapearance). In that case, -ENODEV should be returned to
285 * indicate the device is gone.
286 * This operation has to be synchronous, and return only when the
287 * reset is complete. In case of having had to resort to bus/cold
288 * reset implying a device disconnection, the call is allowed to
289 * return inmediately.
290 * NOTE: wimax_dev->mutex is NOT locked when this op is being
291 * called; however, wimax_dev->mutex_reset IS locked to ensure
292 * serialization of calls to wimax_reset().
293 * See wimax_reset()'s documentation.
294 *
295 * @name: [fill] A way to identify this device. We need to register a
296 * name with many subsystems (input for RFKILL, workqueue
297 * creation, etc). We can't use the network device name as that
298 * might change and in some instances we don't know it yet (until
299 * we don't call register_netdev()). So we generate an unique one
300 * using the driver name and device bus id, place it here and use
301 * it across the board. Recommended naming:
302 * DRIVERNAME-BUSNAME:BUSID (dev->bus->name, dev->bus_id).
303 *
304 * @id_table_node: [private] link to the list of wimax devices kept by
305 * id-table.c. Protected by it's own spinlock.
306 *
307 * @mutex: [private] Serializes all concurrent access and execution of
308 * operations.
309 *
310 * @mutex_reset: [private] Serializes reset operations. Needs to be a
311 * different mutex because as part of the reset operation, the
312 * driver has to call back into the stack to do things such as
313 * state change, that require wimax_dev->mutex.
314 *
315 * @state: [private] Current state of the WiMAX device.
316 *
317 * @rfkill: [private] integration into the RF-Kill infrastructure.
318 *
319 * @rfkill_input: [private] virtual input device to process the
320 * hardware RF Kill switches.
321 *
322 * @rf_sw: [private] State of the software radio switch (OFF/ON)
323 *
324 * @rf_hw: [private] State of the hardware radio switch (OFF/ON)
325 *
326 * Description:
327 * This structure defines a common interface to access all WiMAX
328 * devices from different vendors and provides a common API as well as
329 * a free-form device-specific messaging channel.
330 *
331 * Usage:
332 * 1. Embed a &struct wimax_dev at *the beginning* the network
333 * device structure so that netdev_priv() points to it.
334 *
335 * 2. memset() it to zero
336 *
337 * 3. Initialize with wimax_dev_init(). This will leave the WiMAX
338 * device in the %__WIMAX_ST_NULL state.
339 *
340 * 4. Fill all the fields marked with [fill]; once called
341 * wimax_dev_add(), those fields CANNOT be modified.
342 *
343 * 5. Call wimax_dev_add() *after* registering the network
344 * device. This will leave the WiMAX device in the %WIMAX_ST_DOWN
345 * state.
346 * Protect the driver's net_device->open() against succeeding if
347 * the wimax device state is lower than %WIMAX_ST_DOWN.
348 *
349 * 6. Select when the device is going to be turned on/initialized;
350 * for example, it could be initialized on 'ifconfig up' (when the
351 * netdev op 'open()' is called on the driver).
352 *
353 * When the device is initialized (at `ifconfig up` time, or right
354 * after calling wimax_dev_add() from _probe(), make sure the
355 * following steps are taken
356 *
357 * a. Move the device to %WIMAX_ST_UNINITIALIZED. This is needed so
358 * some API calls that shouldn't work until the device is ready
359 * can be blocked.
360 *
361 * b. Initialize the device. Make sure to turn the SW radio switch
362 * off and move the device to state %WIMAX_ST_RADIO_OFF when
363 * done. When just initialized, a device should be left in RADIO
364 * OFF state until user space devices to turn it on.
365 *
366 * c. Query the device for the state of the hardware rfkill switch
367 * and call wimax_rfkill_report_hw() and wimax_rfkill_report_sw()
368 * as needed. See below.
369 *
370 * wimax_dev_rm() undoes before unregistering the network device. Once
371 * wimax_dev_add() is called, the driver can get called on the
372 * wimax_dev->op_* function pointers
373 *
374 * CONCURRENCY:
375 *
376 * The stack provides a mutex for each device that will disallow API
377 * calls happening concurrently; thus, op calls into the driver
378 * through the wimax_dev->op*() function pointers will always be
379 * serialized and *never* concurrent.
380 *
381 * For locking, take wimax_dev->mutex is taken; (most) operations in
382 * the API have to check for wimax_dev_is_ready() to return 0 before
383 * continuing (this is done internally).
384 *
385 * REFERENCE COUNTING:
386 *
387 * The WiMAX device is reference counted by the associated network
388 * device. The only operation that can be used to reference the device
389 * is wimax_dev_get_by_genl_info(), and the reference it acquires has
390 * to be released with dev_put(wimax_dev->net_dev).
391 *
392 * RFKILL:
393 *
394 * At startup, both HW and SW radio switchess are assumed to be off.
395 *
396 * At initialization time [after calling wimax_dev_add()], have the
397 * driver query the device for the status of the software and hardware
398 * RF kill switches and call wimax_report_rfkill_hw() and
399 * wimax_rfkill_report_sw() to indicate their state. If any is
400 * missing, just call it to indicate it is ON (radio always on).
401 *
402 * Whenever the driver detects a change in the state of the RF kill
403 * switches, it should call wimax_report_rfkill_hw() or
404 * wimax_report_rfkill_sw() to report it to the stack.
405 */
406struct wimax_dev {
407 struct net_device *net_dev;
408 struct list_head id_table_node;
409 struct mutex mutex; /* Protects all members and API calls */
410 struct mutex mutex_reset;
411 enum wimax_st state;
412
413 int (*op_msg_from_user)(struct wimax_dev *wimax_dev,
414 const char *,
415 const void *, size_t,
416 const struct genl_info *info);
417 int (*op_rfkill_sw_toggle)(struct wimax_dev *wimax_dev,
418 enum wimax_rf_state);
419 int (*op_reset)(struct wimax_dev *wimax_dev);
420
421 struct rfkill *rfkill;
422 struct input_dev *rfkill_input;
423 unsigned rf_hw;
424 unsigned rf_sw;
425 char name[32];
426
427 struct dentry *debugfs_dentry;
428};
429
430
431
432/*
433 * WiMAX stack public API for device drivers
434 * -----------------------------------------
435 *
436 * These functions are not exported to user space.
437 */
438extern void wimax_dev_init(struct wimax_dev *);
439extern int wimax_dev_add(struct wimax_dev *, struct net_device *);
440extern void wimax_dev_rm(struct wimax_dev *);
441
442static inline
443struct wimax_dev *net_dev_to_wimax(struct net_device *net_dev)
444{
445 return netdev_priv(net_dev);
446}
447
448static inline
449struct device *wimax_dev_to_dev(struct wimax_dev *wimax_dev)
450{
451 return wimax_dev->net_dev->dev.parent;
452}
453
454extern void wimax_state_change(struct wimax_dev *, enum wimax_st);
455extern enum wimax_st wimax_state_get(struct wimax_dev *);
456
457/*
458 * Radio Switch state reporting.
459 *
460 * enum wimax_rf_state is declared in linux/wimax.h so the exports
461 * to user space can use it.
462 */
463extern void wimax_report_rfkill_hw(struct wimax_dev *, enum wimax_rf_state);
464extern void wimax_report_rfkill_sw(struct wimax_dev *, enum wimax_rf_state);
465
466
467/*
468 * Free-form messaging to/from user space
469 *
470 * Sending a message:
471 *
472 * wimax_msg(wimax_dev, pipe_name, buf, buf_size, GFP_KERNEL);
473 *
474 * Broken up:
475 *
476 * skb = wimax_msg_alloc(wimax_dev, pipe_name, buf_size, GFP_KERNEL);
477 * ...fill up skb...
478 * wimax_msg_send(wimax_dev, pipe_name, skb);
479 *
480 * Be sure not to modify skb->data in the middle (ie: don't use
481 * skb_push()/skb_pull()/skb_reserve() on the skb).
482 *
483 * "pipe_name" is any string, than can be interpreted as the name of
484 * the pipe or destinatary; the interpretation of it is driver
485 * specific, so the recipient can multiplex it as wished. It can be
486 * NULL, it won't be used - an example is using a "diagnostics" tag to
487 * send diagnostics information that a device-specific diagnostics
488 * tool would be interested in.
489 */
490extern struct sk_buff *wimax_msg_alloc(struct wimax_dev *, const char *,
491 const void *, size_t, gfp_t);
492extern int wimax_msg_send(struct wimax_dev *, struct sk_buff *);
493extern int wimax_msg(struct wimax_dev *, const char *,
494 const void *, size_t, gfp_t);
495
496extern const void *wimax_msg_data_len(struct sk_buff *, size_t *);
497extern const void *wimax_msg_data(struct sk_buff *);
498extern ssize_t wimax_msg_len(struct sk_buff *);
499
500
501/*
502 * WiMAX stack user space API
503 * --------------------------
504 *
505 * This API is what gets exported to user space for general
506 * operations. As well, they can be called from within the kernel,
507 * (with a properly referenced `struct wimax_dev`).
508 *
509 * Properly referenced means: the 'struct net_device' that embeds the
510 * device's control structure and (as such) the 'struct wimax_dev' is
511 * referenced by the caller.
512 */
513extern int wimax_rfkill(struct wimax_dev *, enum wimax_rf_state);
514extern int wimax_reset(struct wimax_dev *);
515
516#else
517/* You might be looking for linux/wimax.h */
518#error This file should not be included from user space.
519#endif /* #ifdef __KERNEL__ */
520#endif /* #ifndef __NET__WIMAX_H__ */
diff --git a/init/do_mounts.c b/init/do_mounts.c
index 5efca73b39f9..708105e163df 100644
--- a/init/do_mounts.c
+++ b/init/do_mounts.c
@@ -13,6 +13,7 @@
13#include <linux/init.h> 13#include <linux/init.h>
14#include <linux/fs.h> 14#include <linux/fs.h>
15#include <linux/initrd.h> 15#include <linux/initrd.h>
16#include <linux/async.h>
16 17
17#include <linux/nfs_fs.h> 18#include <linux/nfs_fs.h>
18#include <linux/nfs_fs_sb.h> 19#include <linux/nfs_fs_sb.h>
@@ -372,6 +373,7 @@ void __init prepare_namespace(void)
372 /* wait for the known devices to complete their probing */ 373 /* wait for the known devices to complete their probing */
373 while (driver_probe_done() != 0) 374 while (driver_probe_done() != 0)
374 msleep(100); 375 msleep(100);
376 async_synchronize_full();
375 377
376 md_run_setup(); 378 md_run_setup();
377 379
diff --git a/init/main.c b/init/main.c
index b5a892c68375..844209453c02 100644
--- a/init/main.c
+++ b/init/main.c
@@ -62,6 +62,7 @@
62#include <linux/signal.h> 62#include <linux/signal.h>
63#include <linux/idr.h> 63#include <linux/idr.h>
64#include <linux/ftrace.h> 64#include <linux/ftrace.h>
65#include <linux/async.h>
65#include <trace/boot.h> 66#include <trace/boot.h>
66 67
67#include <asm/io.h> 68#include <asm/io.h>
@@ -599,7 +600,8 @@ asmlinkage void __init start_kernel(void)
599 sched_clock_init(); 600 sched_clock_init();
600 profile_init(); 601 profile_init();
601 if (!irqs_disabled()) 602 if (!irqs_disabled())
602 printk("start_kernel(): bug: interrupts were enabled early\n"); 603 printk(KERN_CRIT "start_kernel(): bug: interrupts were "
604 "enabled early\n");
603 early_boot_irqs_on(); 605 early_boot_irqs_on();
604 local_irq_enable(); 606 local_irq_enable();
605 607
@@ -684,7 +686,7 @@ asmlinkage void __init start_kernel(void)
684 rest_init(); 686 rest_init();
685} 687}
686 688
687static int initcall_debug; 689int initcall_debug;
688core_param(initcall_debug, initcall_debug, bool, 0644); 690core_param(initcall_debug, initcall_debug, bool, 0644);
689 691
690int do_one_initcall(initcall_t fn) 692int do_one_initcall(initcall_t fn)
@@ -785,6 +787,8 @@ static void run_init_process(char *init_filename)
785 */ 787 */
786static noinline int init_post(void) 788static noinline int init_post(void)
787{ 789{
790 /* need to finish all async __init code before freeing the memory */
791 async_synchronize_full();
788 free_initmem(); 792 free_initmem();
789 unlock_kernel(); 793 unlock_kernel();
790 mark_rodata_ro(); 794 mark_rodata_ro();
diff --git a/kernel/Makefile b/kernel/Makefile
index e1c5bf3365c0..2921d90ce32f 100644
--- a/kernel/Makefile
+++ b/kernel/Makefile
@@ -9,7 +9,8 @@ obj-y = sched.o fork.o exec_domain.o panic.o printk.o \
9 rcupdate.o extable.o params.o posix-timers.o \ 9 rcupdate.o extable.o params.o posix-timers.o \
10 kthread.o wait.o kfifo.o sys_ni.o posix-cpu-timers.o mutex.o \ 10 kthread.o wait.o kfifo.o sys_ni.o posix-cpu-timers.o mutex.o \
11 hrtimer.o rwsem.o nsproxy.o srcu.o semaphore.o \ 11 hrtimer.o rwsem.o nsproxy.o srcu.o semaphore.o \
12 notifier.o ksysfs.o pm_qos_params.o sched_clock.o cred.o 12 notifier.o ksysfs.o pm_qos_params.o sched_clock.o cred.o \
13 async.o
13 14
14ifdef CONFIG_FUNCTION_TRACER 15ifdef CONFIG_FUNCTION_TRACER
15# Do not trace debug files and internal ftrace files 16# Do not trace debug files and internal ftrace files
diff --git a/kernel/async.c b/kernel/async.c
new file mode 100644
index 000000000000..97373380c9e7
--- /dev/null
+++ b/kernel/async.c
@@ -0,0 +1,321 @@
1/*
2 * async.c: Asynchronous function calls for boot performance
3 *
4 * (C) Copyright 2009 Intel Corporation
5 * Author: Arjan van de Ven <arjan@linux.intel.com>
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; version 2
10 * of the License.
11 */
12
13
14/*
15
16Goals and Theory of Operation
17
18The primary goal of this feature is to reduce the kernel boot time,
19by doing various independent hardware delays and discovery operations
20decoupled and not strictly serialized.
21
22More specifically, the asynchronous function call concept allows
23certain operations (primarily during system boot) to happen
24asynchronously, out of order, while these operations still
25have their externally visible parts happen sequentially and in-order.
26(not unlike how out-of-order CPUs retire their instructions in order)
27
28Key to the asynchronous function call implementation is the concept of
29a "sequence cookie" (which, although it has an abstracted type, can be
30thought of as a monotonically incrementing number).
31
32The async core will assign each scheduled event such a sequence cookie and
33pass this to the called functions.
34
35The asynchronously called function should before doing a globally visible
36operation, such as registering device numbers, call the
37async_synchronize_cookie() function and pass in its own cookie. The
38async_synchronize_cookie() function will make sure that all asynchronous
39operations that were scheduled prior to the operation corresponding with the
40cookie have completed.
41
42Subsystem/driver initialization code that scheduled asynchronous probe
43functions, but which shares global resources with other drivers/subsystems
44that do not use the asynchronous call feature, need to do a full
45synchronization with the async_synchronize_full() function, before returning
46from their init function. This is to maintain strict ordering between the
47asynchronous and synchronous parts of the kernel.
48
49*/
50
51#include <linux/async.h>
52#include <linux/module.h>
53#include <linux/wait.h>
54#include <linux/sched.h>
55#include <linux/init.h>
56#include <linux/kthread.h>
57#include <asm/atomic.h>
58
59static async_cookie_t next_cookie = 1;
60
61#define MAX_THREADS 256
62#define MAX_WORK 32768
63
64static LIST_HEAD(async_pending);
65static LIST_HEAD(async_running);
66static DEFINE_SPINLOCK(async_lock);
67
68struct async_entry {
69 struct list_head list;
70 async_cookie_t cookie;
71 async_func_ptr *func;
72 void *data;
73 struct list_head *running;
74};
75
76static DECLARE_WAIT_QUEUE_HEAD(async_done);
77static DECLARE_WAIT_QUEUE_HEAD(async_new);
78
79static atomic_t entry_count;
80static atomic_t thread_count;
81
82extern int initcall_debug;
83
84
85/*
86 * MUST be called with the lock held!
87 */
88static async_cookie_t __lowest_in_progress(struct list_head *running)
89{
90 struct async_entry *entry;
91 if (!list_empty(&async_pending)) {
92 entry = list_first_entry(&async_pending,
93 struct async_entry, list);
94 return entry->cookie;
95 } else if (!list_empty(running)) {
96 entry = list_first_entry(running,
97 struct async_entry, list);
98 return entry->cookie;
99 } else {
100 /* nothing in progress... next_cookie is "infinity" */
101 return next_cookie;
102 }
103
104}
105/*
106 * pick the first pending entry and run it
107 */
108static void run_one_entry(void)
109{
110 unsigned long flags;
111 struct async_entry *entry;
112 ktime_t calltime, delta, rettime;
113
114 /* 1) pick one task from the pending queue */
115
116 spin_lock_irqsave(&async_lock, flags);
117 if (list_empty(&async_pending))
118 goto out;
119 entry = list_first_entry(&async_pending, struct async_entry, list);
120
121 /* 2) move it to the running queue */
122 list_del(&entry->list);
123 list_add_tail(&entry->list, &async_running);
124 spin_unlock_irqrestore(&async_lock, flags);
125
126 /* 3) run it (and print duration)*/
127 if (initcall_debug && system_state == SYSTEM_BOOTING) {
128 printk("calling %lli_%pF @ %i\n", entry->cookie, entry->func, task_pid_nr(current));
129 calltime = ktime_get();
130 }
131 entry->func(entry->data, entry->cookie);
132 if (initcall_debug && system_state == SYSTEM_BOOTING) {
133 rettime = ktime_get();
134 delta = ktime_sub(rettime, calltime);
135 printk("initcall %lli_%pF returned 0 after %lld usecs\n", entry->cookie,
136 entry->func, ktime_to_ns(delta) >> 10);
137 }
138
139 /* 4) remove it from the running queue */
140 spin_lock_irqsave(&async_lock, flags);
141 list_del(&entry->list);
142
143 /* 5) free the entry */
144 kfree(entry);
145 atomic_dec(&entry_count);
146
147 spin_unlock_irqrestore(&async_lock, flags);
148
149 /* 6) wake up any waiters. */
150 wake_up(&async_done);
151 return;
152
153out:
154 spin_unlock_irqrestore(&async_lock, flags);
155}
156
157
158static async_cookie_t __async_schedule(async_func_ptr *ptr, void *data, struct list_head *running)
159{
160 struct async_entry *entry;
161 unsigned long flags;
162 async_cookie_t newcookie;
163
164
165 /* allow irq-off callers */
166 entry = kzalloc(sizeof(struct async_entry), GFP_ATOMIC);
167
168 /*
169 * If we're out of memory or if there's too much work
170 * pending already, we execute synchronously.
171 */
172 if (!entry || atomic_read(&entry_count) > MAX_WORK) {
173 kfree(entry);
174 spin_lock_irqsave(&async_lock, flags);
175 newcookie = next_cookie++;
176 spin_unlock_irqrestore(&async_lock, flags);
177
178 /* low on memory.. run synchronously */
179 ptr(data, newcookie);
180 return newcookie;
181 }
182 entry->func = ptr;
183 entry->data = data;
184 entry->running = running;
185
186 spin_lock_irqsave(&async_lock, flags);
187 newcookie = entry->cookie = next_cookie++;
188 list_add_tail(&entry->list, &async_pending);
189 atomic_inc(&entry_count);
190 spin_unlock_irqrestore(&async_lock, flags);
191 wake_up(&async_new);
192 return newcookie;
193}
194
195async_cookie_t async_schedule(async_func_ptr *ptr, void *data)
196{
197 return __async_schedule(ptr, data, &async_pending);
198}
199EXPORT_SYMBOL_GPL(async_schedule);
200
201async_cookie_t async_schedule_special(async_func_ptr *ptr, void *data, struct list_head *running)
202{
203 return __async_schedule(ptr, data, running);
204}
205EXPORT_SYMBOL_GPL(async_schedule_special);
206
207void async_synchronize_full(void)
208{
209 async_synchronize_cookie(next_cookie);
210}
211EXPORT_SYMBOL_GPL(async_synchronize_full);
212
213void async_synchronize_full_special(struct list_head *list)
214{
215 async_synchronize_cookie_special(next_cookie, list);
216}
217EXPORT_SYMBOL_GPL(async_synchronize_full_special);
218
219void async_synchronize_cookie_special(async_cookie_t cookie, struct list_head *running)
220{
221 ktime_t starttime, delta, endtime;
222
223 if (initcall_debug && system_state == SYSTEM_BOOTING) {
224 printk("async_waiting @ %i\n", task_pid_nr(current));
225 starttime = ktime_get();
226 }
227
228 wait_event(async_done, __lowest_in_progress(running) >= cookie);
229
230 if (initcall_debug && system_state == SYSTEM_BOOTING) {
231 endtime = ktime_get();
232 delta = ktime_sub(endtime, starttime);
233
234 printk("async_continuing @ %i after %lli usec\n",
235 task_pid_nr(current), ktime_to_ns(delta) >> 10);
236 }
237}
238EXPORT_SYMBOL_GPL(async_synchronize_cookie_special);
239
240void async_synchronize_cookie(async_cookie_t cookie)
241{
242 async_synchronize_cookie_special(cookie, &async_running);
243}
244EXPORT_SYMBOL_GPL(async_synchronize_cookie);
245
246
247static int async_thread(void *unused)
248{
249 DECLARE_WAITQUEUE(wq, current);
250 add_wait_queue(&async_new, &wq);
251
252 while (!kthread_should_stop()) {
253 int ret = HZ;
254 set_current_state(TASK_INTERRUPTIBLE);
255 /*
256 * check the list head without lock.. false positives
257 * are dealt with inside run_one_entry() while holding
258 * the lock.
259 */
260 rmb();
261 if (!list_empty(&async_pending))
262 run_one_entry();
263 else
264 ret = schedule_timeout(HZ);
265
266 if (ret == 0) {
267 /*
268 * we timed out, this means we as thread are redundant.
269 * we sign off and die, but we to avoid any races there
270 * is a last-straw check to see if work snuck in.
271 */
272 atomic_dec(&thread_count);
273 wmb(); /* manager must see our departure first */
274 if (list_empty(&async_pending))
275 break;
276 /*
277 * woops work came in between us timing out and us
278 * signing off; we need to stay alive and keep working.
279 */
280 atomic_inc(&thread_count);
281 }
282 }
283 remove_wait_queue(&async_new, &wq);
284
285 return 0;
286}
287
288static int async_manager_thread(void *unused)
289{
290 DECLARE_WAITQUEUE(wq, current);
291 add_wait_queue(&async_new, &wq);
292
293 while (!kthread_should_stop()) {
294 int tc, ec;
295
296 set_current_state(TASK_INTERRUPTIBLE);
297
298 tc = atomic_read(&thread_count);
299 rmb();
300 ec = atomic_read(&entry_count);
301
302 while (tc < ec && tc < MAX_THREADS) {
303 kthread_run(async_thread, NULL, "async/%i", tc);
304 atomic_inc(&thread_count);
305 tc++;
306 }
307
308 schedule();
309 }
310 remove_wait_queue(&async_new, &wq);
311
312 return 0;
313}
314
315static int __init async_init(void)
316{
317 kthread_run(async_manager_thread, NULL, "async/mgr");
318 return 0;
319}
320
321core_initcall(async_init);
diff --git a/kernel/cpu.c b/kernel/cpu.c
index 30e74dd6d01b..79e40f00dcb8 100644
--- a/kernel/cpu.c
+++ b/kernel/cpu.c
@@ -379,8 +379,11 @@ static cpumask_var_t frozen_cpus;
379 379
380int disable_nonboot_cpus(void) 380int disable_nonboot_cpus(void)
381{ 381{
382 int cpu, first_cpu, error = 0; 382 int cpu, first_cpu, error;
383 383
384 error = stop_machine_create();
385 if (error)
386 return error;
384 cpu_maps_update_begin(); 387 cpu_maps_update_begin();
385 first_cpu = cpumask_first(cpu_online_mask); 388 first_cpu = cpumask_first(cpu_online_mask);
386 /* We take down all of the non-boot CPUs in one shot to avoid races 389 /* We take down all of the non-boot CPUs in one shot to avoid races
@@ -409,6 +412,7 @@ int disable_nonboot_cpus(void)
409 printk(KERN_ERR "Non-boot CPUs are not disabled\n"); 412 printk(KERN_ERR "Non-boot CPUs are not disabled\n");
410 } 413 }
411 cpu_maps_update_done(); 414 cpu_maps_update_done();
415 stop_machine_destroy();
412 return error; 416 return error;
413} 417}
414 418
diff --git a/kernel/irq/autoprobe.c b/kernel/irq/autoprobe.c
index cc0f7321b8ce..1de9700f416e 100644
--- a/kernel/irq/autoprobe.c
+++ b/kernel/irq/autoprobe.c
@@ -10,6 +10,7 @@
10#include <linux/module.h> 10#include <linux/module.h>
11#include <linux/interrupt.h> 11#include <linux/interrupt.h>
12#include <linux/delay.h> 12#include <linux/delay.h>
13#include <linux/async.h>
13 14
14#include "internals.h" 15#include "internals.h"
15 16
@@ -34,6 +35,10 @@ unsigned long probe_irq_on(void)
34 unsigned int status; 35 unsigned int status;
35 int i; 36 int i;
36 37
38 /*
39 * quiesce the kernel, or at least the asynchronous portion
40 */
41 async_synchronize_full();
37 mutex_lock(&probing_active); 42 mutex_lock(&probing_active);
38 /* 43 /*
39 * something may have generated an irq long ago and we want to 44 * something may have generated an irq long ago and we want to
diff --git a/kernel/module.c b/kernel/module.c
index 496dcb57b608..c9332c90d5a0 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -50,6 +50,7 @@
50#include <asm/sections.h> 50#include <asm/sections.h>
51#include <linux/tracepoint.h> 51#include <linux/tracepoint.h>
52#include <linux/ftrace.h> 52#include <linux/ftrace.h>
53#include <linux/async.h>
53 54
54#if 0 55#if 0
55#define DEBUGP printk 56#define DEBUGP printk
@@ -816,6 +817,7 @@ sys_delete_module(const char __user *name_user, unsigned int flags)
816 mod->exit(); 817 mod->exit();
817 blocking_notifier_call_chain(&module_notify_list, 818 blocking_notifier_call_chain(&module_notify_list,
818 MODULE_STATE_GOING, mod); 819 MODULE_STATE_GOING, mod);
820 async_synchronize_full();
819 mutex_lock(&module_mutex); 821 mutex_lock(&module_mutex);
820 /* Store the name of the last unloaded module for diagnostic purposes */ 822 /* Store the name of the last unloaded module for diagnostic purposes */
821 strlcpy(last_unloaded_module, mod->name, sizeof(last_unloaded_module)); 823 strlcpy(last_unloaded_module, mod->name, sizeof(last_unloaded_module));
diff --git a/kernel/pid.c b/kernel/pid.c
index 064e76afa507..af9224cdd6c0 100644
--- a/kernel/pid.c
+++ b/kernel/pid.c
@@ -475,7 +475,7 @@ pid_t task_session_nr_ns(struct task_struct *tsk, struct pid_namespace *ns)
475EXPORT_SYMBOL(task_session_nr_ns); 475EXPORT_SYMBOL(task_session_nr_ns);
476 476
477/* 477/*
478 * Used by proc to find the first pid that is greater then or equal to nr. 478 * Used by proc to find the first pid that is greater than or equal to nr.
479 * 479 *
480 * If there is a pid at nr this function is exactly the same as find_pid_ns. 480 * If there is a pid at nr this function is exactly the same as find_pid_ns.
481 */ 481 */
diff --git a/kernel/printk.c b/kernel/printk.c
index e651ab05655f..7015733793e8 100644
--- a/kernel/printk.c
+++ b/kernel/printk.c
@@ -619,7 +619,7 @@ static int acquire_console_semaphore_for_printk(unsigned int cpu)
619static const char recursion_bug_msg [] = 619static const char recursion_bug_msg [] =
620 KERN_CRIT "BUG: recent printk recursion!\n"; 620 KERN_CRIT "BUG: recent printk recursion!\n";
621static int recursion_bug; 621static int recursion_bug;
622 static int new_text_line = 1; 622static int new_text_line = 1;
623static char printk_buf[1024]; 623static char printk_buf[1024];
624 624
625asmlinkage int vprintk(const char *fmt, va_list args) 625asmlinkage int vprintk(const char *fmt, va_list args)
diff --git a/kernel/time/jiffies.c b/kernel/time/jiffies.c
index 1ca99557e929..06f197560f3b 100644
--- a/kernel/time/jiffies.c
+++ b/kernel/time/jiffies.c
@@ -45,7 +45,7 @@
45 * 45 *
46 * The value 8 is somewhat carefully chosen, as anything 46 * The value 8 is somewhat carefully chosen, as anything
47 * larger can result in overflows. NSEC_PER_JIFFY grows as 47 * larger can result in overflows. NSEC_PER_JIFFY grows as
48 * HZ shrinks, so values greater then 8 overflow 32bits when 48 * HZ shrinks, so values greater than 8 overflow 32bits when
49 * HZ=100. 49 * HZ=100.
50 */ 50 */
51#define JIFFIES_SHIFT 8 51#define JIFFIES_SHIFT 8
diff --git a/lib/radix-tree.c b/lib/radix-tree.c
index 8d3fb0bd1288..4bb42a0344ec 100644
--- a/lib/radix-tree.c
+++ b/lib/radix-tree.c
@@ -640,13 +640,14 @@ EXPORT_SYMBOL(radix_tree_tag_get);
640 * 640 *
641 * Returns: the index of the hole if found, otherwise returns an index 641 * Returns: the index of the hole if found, otherwise returns an index
642 * outside of the set specified (in which case 'return - index >= max_scan' 642 * outside of the set specified (in which case 'return - index >= max_scan'
643 * will be true). 643 * will be true). In rare cases of index wrap-around, 0 will be returned.
644 * 644 *
645 * radix_tree_next_hole may be called under rcu_read_lock. However, like 645 * radix_tree_next_hole may be called under rcu_read_lock. However, like
646 * radix_tree_gang_lookup, this will not atomically search a snapshot of the 646 * radix_tree_gang_lookup, this will not atomically search a snapshot of
647 * tree at a single point in time. For example, if a hole is created at index 647 * the tree at a single point in time. For example, if a hole is created
648 * 5, then subsequently a hole is created at index 10, radix_tree_next_hole 648 * at index 5, then subsequently a hole is created at index 10,
649 * covering both indexes may return 10 if called under rcu_read_lock. 649 * radix_tree_next_hole covering both indexes may return 10 if called
650 * under rcu_read_lock.
650 */ 651 */
651unsigned long radix_tree_next_hole(struct radix_tree_root *root, 652unsigned long radix_tree_next_hole(struct radix_tree_root *root,
652 unsigned long index, unsigned long max_scan) 653 unsigned long index, unsigned long max_scan)
diff --git a/mm/slub.c b/mm/slub.c
index f0e2892fe403..6392ae5cc6b1 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -2254,7 +2254,7 @@ static int calculate_sizes(struct kmem_cache *s, int forced_order)
2254 * Add some empty padding so that we can catch 2254 * Add some empty padding so that we can catch
2255 * overwrites from earlier objects rather than let 2255 * overwrites from earlier objects rather than let
2256 * tracking information or the free pointer be 2256 * tracking information or the free pointer be
2257 * corrupted if an user writes before the start 2257 * corrupted if a user writes before the start
2258 * of the object. 2258 * of the object.
2259 */ 2259 */
2260 size += sizeof(void *); 2260 size += sizeof(void *);
diff --git a/net/Kconfig b/net/Kconfig
index 6ec2cce7c167..bf2776018f71 100644
--- a/net/Kconfig
+++ b/net/Kconfig
@@ -254,6 +254,8 @@ source "net/mac80211/Kconfig"
254 254
255endif # WIRELESS 255endif # WIRELESS
256 256
257source "net/wimax/Kconfig"
258
257source "net/rfkill/Kconfig" 259source "net/rfkill/Kconfig"
258source "net/9p/Kconfig" 260source "net/9p/Kconfig"
259 261
diff --git a/net/Makefile b/net/Makefile
index ba4460432b7c..0fcce89d7169 100644
--- a/net/Makefile
+++ b/net/Makefile
@@ -63,3 +63,4 @@ endif
63ifeq ($(CONFIG_NET),y) 63ifeq ($(CONFIG_NET),y)
64obj-$(CONFIG_SYSCTL) += sysctl_net.o 64obj-$(CONFIG_SYSCTL) += sysctl_net.o
65endif 65endif
66obj-$(CONFIG_WIMAX) += wimax/
diff --git a/net/netlink/genetlink.c b/net/netlink/genetlink.c
index 3e1191cecaf0..1d3dd30099df 100644
--- a/net/netlink/genetlink.c
+++ b/net/netlink/genetlink.c
@@ -225,6 +225,7 @@ void genl_unregister_mc_group(struct genl_family *family,
225 __genl_unregister_mc_group(family, grp); 225 __genl_unregister_mc_group(family, grp);
226 genl_unlock(); 226 genl_unlock();
227} 227}
228EXPORT_SYMBOL(genl_unregister_mc_group);
228 229
229static void genl_unregister_mc_groups(struct genl_family *family) 230static void genl_unregister_mc_groups(struct genl_family *family)
230{ 231{
diff --git a/net/sctp/auth.c b/net/sctp/auth.c
index 52db5f60daa0..20c576f530fa 100644
--- a/net/sctp/auth.c
+++ b/net/sctp/auth.c
@@ -141,8 +141,8 @@ void sctp_auth_destroy_keys(struct list_head *keys)
141/* Compare two byte vectors as numbers. Return values 141/* Compare two byte vectors as numbers. Return values
142 * are: 142 * are:
143 * 0 - vectors are equal 143 * 0 - vectors are equal
144 * < 0 - vector 1 is smaller then vector2 144 * < 0 - vector 1 is smaller than vector2
145 * > 0 - vector 1 is greater then vector2 145 * > 0 - vector 1 is greater than vector2
146 * 146 *
147 * Algorithm is: 147 * Algorithm is:
148 * This is performed by selecting the numerically smaller key vector... 148 * This is performed by selecting the numerically smaller key vector...
diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c
index 1c4e5d6c29c0..3a0cd075914f 100644
--- a/net/sctp/sm_statefuns.c
+++ b/net/sctp/sm_statefuns.c
@@ -4268,9 +4268,9 @@ nomem:
4268 4268
4269/* 4269/*
4270 * Handle a protocol violation when the chunk length is invalid. 4270 * Handle a protocol violation when the chunk length is invalid.
4271 * "Invalid" length is identified as smaller then the minimal length a 4271 * "Invalid" length is identified as smaller than the minimal length a
4272 * given chunk can be. For example, a SACK chunk has invalid length 4272 * given chunk can be. For example, a SACK chunk has invalid length
4273 * if it's length is set to be smaller then the size of sctp_sack_chunk_t. 4273 * if its length is set to be smaller than the size of sctp_sack_chunk_t.
4274 * 4274 *
4275 * We inform the other end by sending an ABORT with a Protocol Violation 4275 * We inform the other end by sending an ABORT with a Protocol Violation
4276 * error code. 4276 * error code.
@@ -4300,7 +4300,7 @@ static sctp_disposition_t sctp_sf_violation_chunklen(
4300 4300
4301/* 4301/*
4302 * Handle a protocol violation when the parameter length is invalid. 4302 * Handle a protocol violation when the parameter length is invalid.
4303 * "Invalid" length is identified as smaller then the minimal length a 4303 * "Invalid" length is identified as smaller than the minimal length a
4304 * given parameter can be. 4304 * given parameter can be.
4305 */ 4305 */
4306static sctp_disposition_t sctp_sf_violation_paramlen( 4306static sctp_disposition_t sctp_sf_violation_paramlen(
diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index b14a8f33e42d..ff0a8f88de04 100644
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -2717,7 +2717,7 @@ static int sctp_setsockopt_associnfo(struct sock *sk, char __user *optval, int o
2717 paths++; 2717 paths++;
2718 } 2718 }
2719 2719
2720 /* Only validate asocmaxrxt if we have more then 2720 /* Only validate asocmaxrxt if we have more than
2721 * one path/transport. We do this because path 2721 * one path/transport. We do this because path
2722 * retransmissions are only counted when we have more 2722 * retransmissions are only counted when we have more
2723 * then one path. 2723 * then one path.
diff --git a/net/sctp/tsnmap.c b/net/sctp/tsnmap.c
index 35c73e82553a..9bd64565021a 100644
--- a/net/sctp/tsnmap.c
+++ b/net/sctp/tsnmap.c
@@ -227,7 +227,7 @@ void sctp_tsnmap_skip(struct sctp_tsnmap *map, __u32 tsn)
227 */ 227 */
228 bitmap_zero(map->tsn_map, map->len); 228 bitmap_zero(map->tsn_map, map->len);
229 } else { 229 } else {
230 /* If the gap is smaller then the map size, 230 /* If the gap is smaller than the map size,
231 * shift the map by 'gap' bits and update further. 231 * shift the map by 'gap' bits and update further.
232 */ 232 */
233 bitmap_shift_right(map->tsn_map, map->tsn_map, gap, map->len); 233 bitmap_shift_right(map->tsn_map, map->tsn_map, gap, map->len);
diff --git a/net/wimax/Kconfig b/net/wimax/Kconfig
new file mode 100644
index 000000000000..0bdbb6928205
--- /dev/null
+++ b/net/wimax/Kconfig
@@ -0,0 +1,38 @@
1#
2# WiMAX LAN device configuration
3#
4
5menuconfig WIMAX
6 tristate "WiMAX Wireless Broadband support"
7 help
8
9 Select to configure support for devices that provide
10 wireless broadband connectivity using the WiMAX protocol
11 (IEEE 802.16).
12
13 Please note that most of these devices require signing up
14 for a service plan with a provider.
15
16 The different WiMAX drivers can be enabled in the menu entry
17
18 Device Drivers > Network device support > WiMAX Wireless
19 Broadband devices
20
21 If unsure, it is safe to select M (module).
22
23config WIMAX_DEBUG_LEVEL
24 int "WiMAX debug level"
25 depends on WIMAX
26 default 8
27 help
28
29 Select the maximum debug verbosity level to be compiled into
30 the WiMAX stack code.
31
32 By default, debug messages are disabled at runtime and can
33 be selectively enabled for different parts of the code using
34 the sysfs debug-levels file.
35
36 If set at zero, this will compile out all the debug code.
37
38 It is recommended that it is left at 8.
diff --git a/net/wimax/Makefile b/net/wimax/Makefile
new file mode 100644
index 000000000000..5b80b941c2c9
--- /dev/null
+++ b/net/wimax/Makefile
@@ -0,0 +1,13 @@
1
2obj-$(CONFIG_WIMAX) += wimax.o
3
4wimax-y := \
5 id-table.o \
6 op-msg.o \
7 op-reset.o \
8 op-rfkill.o \
9 stack.o
10
11wimax-$(CONFIG_DEBUG_FS) += debugfs.o
12
13
diff --git a/net/wimax/debug-levels.h b/net/wimax/debug-levels.h
new file mode 100644
index 000000000000..1c29123a3aa9
--- /dev/null
+++ b/net/wimax/debug-levels.h
@@ -0,0 +1,42 @@
1/*
2 * Linux WiMAX Stack
3 * Debug levels control file for the wimax module
4 *
5 *
6 * Copyright (C) 2007-2008 Intel Corporation <linux-wimax@intel.com>
7 * Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License version
11 * 2 as published by the Free Software Foundation.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21 * 02110-1301, USA.
22 */
23#ifndef __debug_levels__h__
24#define __debug_levels__h__
25
26/* Maximum compile and run time debug level for all submodules */
27#define D_MODULENAME wimax
28#define D_MASTER CONFIG_WIMAX_DEBUG_LEVEL
29
30#include <linux/wimax/debug.h>
31
32/* List of all the enabled modules */
33enum d_module {
34 D_SUBMODULE_DECLARE(debugfs),
35 D_SUBMODULE_DECLARE(id_table),
36 D_SUBMODULE_DECLARE(op_msg),
37 D_SUBMODULE_DECLARE(op_reset),
38 D_SUBMODULE_DECLARE(op_rfkill),
39 D_SUBMODULE_DECLARE(stack),
40};
41
42#endif /* #ifndef __debug_levels__h__ */
diff --git a/net/wimax/debugfs.c b/net/wimax/debugfs.c
new file mode 100644
index 000000000000..87cf4430079c
--- /dev/null
+++ b/net/wimax/debugfs.c
@@ -0,0 +1,90 @@
1/*
2 * Linux WiMAX
3 * Debugfs support
4 *
5 *
6 * Copyright (C) 2005-2006 Intel Corporation <linux-wimax@intel.com>
7 * Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License version
11 * 2 as published by the Free Software Foundation.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21 * 02110-1301, USA.
22 */
23#include <linux/debugfs.h>
24#include <linux/wimax.h>
25#include "wimax-internal.h"
26
27#define D_SUBMODULE debugfs
28#include "debug-levels.h"
29
30
31/* Debug framework control of debug levels */
32struct d_level D_LEVEL[] = {
33 D_SUBMODULE_DEFINE(debugfs),
34 D_SUBMODULE_DEFINE(id_table),
35 D_SUBMODULE_DEFINE(op_msg),
36 D_SUBMODULE_DEFINE(op_reset),
37 D_SUBMODULE_DEFINE(op_rfkill),
38 D_SUBMODULE_DEFINE(stack),
39};
40size_t D_LEVEL_SIZE = ARRAY_SIZE(D_LEVEL);
41
42#define __debugfs_register(prefix, name, parent) \
43do { \
44 result = d_level_register_debugfs(prefix, name, parent); \
45 if (result < 0) \
46 goto error; \
47} while (0)
48
49
50int wimax_debugfs_add(struct wimax_dev *wimax_dev)
51{
52 int result;
53 struct net_device *net_dev = wimax_dev->net_dev;
54 struct device *dev = net_dev->dev.parent;
55 struct dentry *dentry;
56 char buf[128];
57
58 snprintf(buf, sizeof(buf), "wimax:%s", net_dev->name);
59 dentry = debugfs_create_dir(buf, NULL);
60 result = PTR_ERR(dentry);
61 if (IS_ERR(dentry)) {
62 if (result == -ENODEV)
63 result = 0; /* No debugfs support */
64 else
65 dev_err(dev, "Can't create debugfs dentry: %d\n",
66 result);
67 goto out;
68 }
69 wimax_dev->debugfs_dentry = dentry;
70 __debugfs_register("wimax_dl_", debugfs, dentry);
71 __debugfs_register("wimax_dl_", id_table, dentry);
72 __debugfs_register("wimax_dl_", op_msg, dentry);
73 __debugfs_register("wimax_dl_", op_reset, dentry);
74 __debugfs_register("wimax_dl_", op_rfkill, dentry);
75 __debugfs_register("wimax_dl_", stack, dentry);
76 result = 0;
77out:
78 return result;
79
80error:
81 debugfs_remove_recursive(wimax_dev->debugfs_dentry);
82 return result;
83}
84
85void wimax_debugfs_rm(struct wimax_dev *wimax_dev)
86{
87 debugfs_remove_recursive(wimax_dev->debugfs_dentry);
88}
89
90
diff --git a/net/wimax/id-table.c b/net/wimax/id-table.c
new file mode 100644
index 000000000000..d3b88558682c
--- /dev/null
+++ b/net/wimax/id-table.c
@@ -0,0 +1,142 @@
1/*
2 * Linux WiMAX
3 * Mappping of generic netlink family IDs to net devices
4 *
5 *
6 * Copyright (C) 2005-2006 Intel Corporation <linux-wimax@intel.com>
7 * Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License version
11 * 2 as published by the Free Software Foundation.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21 * 02110-1301, USA.
22 *
23 *
24 * We assign a single generic netlink family ID to each device (to
25 * simplify lookup).
26 *
27 * We need a way to map family ID to a wimax_dev pointer.
28 *
29 * The idea is to use a very simple lookup. Using a netlink attribute
30 * with (for example) the interface name implies a heavier search over
31 * all the network devices; seemed kind of a waste given that we know
32 * we are looking for a WiMAX device and that most systems will have
33 * just a single WiMAX adapter.
34 *
35 * We put all the WiMAX devices in the system in a linked list and
36 * match the generic link family ID against the list.
37 *
38 * By using a linked list, the case of a single adapter in the system
39 * becomes (almost) no overhead, while still working for many more. If
40 * it ever goes beyond two, I'll be surprised.
41 */
42#include <linux/device.h>
43#include <net/genetlink.h>
44#include <linux/netdevice.h>
45#include <linux/list.h>
46#include <linux/wimax.h>
47#include "wimax-internal.h"
48
49
50#define D_SUBMODULE id_table
51#include "debug-levels.h"
52
53
54static DEFINE_SPINLOCK(wimax_id_table_lock);
55static struct list_head wimax_id_table = LIST_HEAD_INIT(wimax_id_table);
56
57
58/*
59 * wimax_id_table_add - add a gennetlink familiy ID / wimax_dev mapping
60 *
61 * @wimax_dev: WiMAX device descriptor to associate to the Generic
62 * Netlink family ID.
63 *
64 * Look for an empty spot in the ID table; if none found, double the
65 * table's size and get the first spot.
66 */
67void wimax_id_table_add(struct wimax_dev *wimax_dev)
68{
69 d_fnstart(3, NULL, "(wimax_dev %p)\n", wimax_dev);
70 spin_lock(&wimax_id_table_lock);
71 list_add(&wimax_dev->id_table_node, &wimax_id_table);
72 spin_unlock(&wimax_id_table_lock);
73 d_fnend(3, NULL, "(wimax_dev %p)\n", wimax_dev);
74}
75
76
77/*
78 * wimax_get_netdev_by_info - lookup a wimax_dev from the gennetlink info
79 *
80 * The generic netlink family ID has been filled out in the
81 * nlmsghdr->nlmsg_type field, so we pull it from there, look it up in
82 * the mapping table and reference the wimax_dev.
83 *
84 * When done, the reference should be dropped with
85 * 'dev_put(wimax_dev->net_dev)'.
86 */
87struct wimax_dev *wimax_dev_get_by_genl_info(
88 struct genl_info *info, int ifindex)
89{
90 struct wimax_dev *wimax_dev = NULL;
91
92 d_fnstart(3, NULL, "(info %p ifindex %d)\n", info, ifindex);
93 spin_lock(&wimax_id_table_lock);
94 list_for_each_entry(wimax_dev, &wimax_id_table, id_table_node) {
95 if (wimax_dev->net_dev->ifindex == ifindex) {
96 dev_hold(wimax_dev->net_dev);
97 break;
98 }
99 }
100 if (wimax_dev == NULL)
101 d_printf(1, NULL, "wimax: no devices found with ifindex %d\n",
102 ifindex);
103 spin_unlock(&wimax_id_table_lock);
104 d_fnend(3, NULL, "(info %p ifindex %d) = %p\n",
105 info, ifindex, wimax_dev);
106 return wimax_dev;
107}
108
109
110/*
111 * wimax_id_table_rm - Remove a gennetlink familiy ID / wimax_dev mapping
112 *
113 * @id: family ID to remove from the table
114 */
115void wimax_id_table_rm(struct wimax_dev *wimax_dev)
116{
117 spin_lock(&wimax_id_table_lock);
118 list_del_init(&wimax_dev->id_table_node);
119 spin_unlock(&wimax_id_table_lock);
120}
121
122
123/*
124 * Release the gennetlink family id / mapping table
125 *
126 * On debug, verify that the table is empty upon removal.
127 */
128void wimax_id_table_release(void)
129{
130#ifndef CONFIG_BUG
131 return;
132#endif
133 struct wimax_dev *wimax_dev;
134
135 spin_lock(&wimax_id_table_lock);
136 list_for_each_entry(wimax_dev, &wimax_id_table, id_table_node) {
137 printk(KERN_ERR "BUG: %s wimax_dev %p ifindex %d not cleared\n",
138 __func__, wimax_dev, wimax_dev->net_dev->ifindex);
139 WARN_ON(1);
140 }
141 spin_unlock(&wimax_id_table_lock);
142}
diff --git a/net/wimax/op-msg.c b/net/wimax/op-msg.c
new file mode 100644
index 000000000000..cb3b4ad53683
--- /dev/null
+++ b/net/wimax/op-msg.c
@@ -0,0 +1,421 @@
1/*
2 * Linux WiMAX
3 * Generic messaging interface between userspace and driver/device
4 *
5 *
6 * Copyright (C) 2007-2008 Intel Corporation <linux-wimax@intel.com>
7 * Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License version
11 * 2 as published by the Free Software Foundation.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21 * 02110-1301, USA.
22 *
23 *
24 * This implements a direct communication channel between user space and
25 * the driver/device, by which free form messages can be sent back and
26 * forth.
27 *
28 * This is intended for device-specific features, vendor quirks, etc.
29 *
30 * See include/net/wimax.h
31 *
32 * GENERIC NETLINK ENCODING AND CAPACITY
33 *
34 * A destination "pipe name" is added to each message; it is up to the
35 * drivers to assign or use those names (if using them at all).
36 *
37 * Messages are encoded as a binary netlink attribute using nla_put()
38 * using type NLA_UNSPEC (as some versions of libnl still in
39 * deployment don't yet understand NLA_BINARY).
40 *
41 * The maximum capacity of this transport is PAGESIZE per message (so
42 * the actual payload will be bit smaller depending on the
43 * netlink/generic netlink attributes and headers).
44 *
45 * RECEPTION OF MESSAGES
46 *
47 * When a message is received from user space, it is passed verbatim
48 * to the driver calling wimax_dev->op_msg_from_user(). The return
49 * value from this function is passed back to user space as an ack
50 * over the generic netlink protocol.
51 *
52 * The stack doesn't do any processing or interpretation of these
53 * messages.
54 *
55 * SENDING MESSAGES
56 *
57 * Messages can be sent with wimax_msg().
58 *
59 * If the message delivery needs to happen on a different context to
60 * that of its creation, wimax_msg_alloc() can be used to get a
61 * pointer to the message that can be delivered later on with
62 * wimax_msg_send().
63 *
64 * ROADMAP
65 *
66 * wimax_gnl_doit_msg_from_user() Process a message from user space
67 * wimax_dev_get_by_genl_info()
68 * wimax_dev->op_msg_from_user() Delivery of message to the driver
69 *
70 * wimax_msg() Send a message to user space
71 * wimax_msg_alloc()
72 * wimax_msg_send()
73 */
74#include <linux/device.h>
75#include <net/genetlink.h>
76#include <linux/netdevice.h>
77#include <linux/wimax.h>
78#include <linux/security.h>
79#include "wimax-internal.h"
80
81
82#define D_SUBMODULE op_msg
83#include "debug-levels.h"
84
85
86/**
87 * wimax_msg_alloc - Create a new skb for sending a message to userspace
88 *
89 * @wimax_dev: WiMAX device descriptor
90 * @pipe_name: "named pipe" the message will be sent to
91 * @msg: pointer to the message data to send
92 * @size: size of the message to send (in bytes), including the header.
93 * @gfp_flags: flags for memory allocation.
94 *
95 * Returns: %0 if ok, negative errno code on error
96 *
97 * Description:
98 *
99 * Allocates an skb that will contain the message to send to user
100 * space over the messaging pipe and initializes it, copying the
101 * payload.
102 *
103 * Once this call is done, you can deliver it with
104 * wimax_msg_send().
105 *
106 * IMPORTANT:
107 *
108 * Don't use skb_push()/skb_pull()/skb_reserve() on the skb, as
109 * wimax_msg_send() depends on skb->data being placed at the
110 * beginning of the user message.
111 */
112struct sk_buff *wimax_msg_alloc(struct wimax_dev *wimax_dev,
113 const char *pipe_name,
114 const void *msg, size_t size,
115 gfp_t gfp_flags)
116{
117 int result;
118 struct device *dev = wimax_dev->net_dev->dev.parent;
119 size_t msg_size;
120 void *genl_msg;
121 struct sk_buff *skb;
122
123 msg_size = nla_total_size(size)
124 + nla_total_size(sizeof(u32))
125 + (pipe_name ? nla_total_size(strlen(pipe_name)) : 0);
126 result = -ENOMEM;
127 skb = genlmsg_new(msg_size, gfp_flags);
128 if (skb == NULL)
129 goto error_new;
130 genl_msg = genlmsg_put(skb, 0, 0, &wimax_gnl_family,
131 0, WIMAX_GNL_OP_MSG_TO_USER);
132 if (genl_msg == NULL) {
133 dev_err(dev, "no memory to create generic netlink message\n");
134 goto error_genlmsg_put;
135 }
136 result = nla_put_u32(skb, WIMAX_GNL_MSG_IFIDX,
137 wimax_dev->net_dev->ifindex);
138 if (result < 0) {
139 dev_err(dev, "no memory to add ifindex attribute\n");
140 goto error_nla_put;
141 }
142 if (pipe_name) {
143 result = nla_put_string(skb, WIMAX_GNL_MSG_PIPE_NAME,
144 pipe_name);
145 if (result < 0) {
146 dev_err(dev, "no memory to add pipe_name attribute\n");
147 goto error_nla_put;
148 }
149 }
150 result = nla_put(skb, WIMAX_GNL_MSG_DATA, size, msg);
151 if (result < 0) {
152 dev_err(dev, "no memory to add payload in attribute\n");
153 goto error_nla_put;
154 }
155 genlmsg_end(skb, genl_msg);
156 return skb;
157
158error_nla_put:
159error_genlmsg_put:
160error_new:
161 nlmsg_free(skb);
162 return ERR_PTR(result);
163
164}
165EXPORT_SYMBOL_GPL(wimax_msg_alloc);
166
167
168/**
169 * wimax_msg_data_len - Return a pointer and size of a message's payload
170 *
171 * @msg: Pointer to a message created with wimax_msg_alloc()
172 * @size: Pointer to where to store the message's size
173 *
174 * Returns the pointer to the message data.
175 */
176const void *wimax_msg_data_len(struct sk_buff *msg, size_t *size)
177{
178 struct nlmsghdr *nlh = (void *) msg->head;
179 struct nlattr *nla;
180
181 nla = nlmsg_find_attr(nlh, sizeof(struct genlmsghdr),
182 WIMAX_GNL_MSG_DATA);
183 if (nla == NULL) {
184 printk(KERN_ERR "Cannot find attribute WIMAX_GNL_MSG_DATA\n");
185 return NULL;
186 }
187 *size = nla_len(nla);
188 return nla_data(nla);
189}
190EXPORT_SYMBOL_GPL(wimax_msg_data_len);
191
192
193/**
194 * wimax_msg_data - Return a pointer to a message's payload
195 *
196 * @msg: Pointer to a message created with wimax_msg_alloc()
197 */
198const void *wimax_msg_data(struct sk_buff *msg)
199{
200 struct nlmsghdr *nlh = (void *) msg->head;
201 struct nlattr *nla;
202
203 nla = nlmsg_find_attr(nlh, sizeof(struct genlmsghdr),
204 WIMAX_GNL_MSG_DATA);
205 if (nla == NULL) {
206 printk(KERN_ERR "Cannot find attribute WIMAX_GNL_MSG_DATA\n");
207 return NULL;
208 }
209 return nla_data(nla);
210}
211EXPORT_SYMBOL_GPL(wimax_msg_data);
212
213
214/**
215 * wimax_msg_len - Return a message's payload length
216 *
217 * @msg: Pointer to a message created with wimax_msg_alloc()
218 */
219ssize_t wimax_msg_len(struct sk_buff *msg)
220{
221 struct nlmsghdr *nlh = (void *) msg->head;
222 struct nlattr *nla;
223
224 nla = nlmsg_find_attr(nlh, sizeof(struct genlmsghdr),
225 WIMAX_GNL_MSG_DATA);
226 if (nla == NULL) {
227 printk(KERN_ERR "Cannot find attribute WIMAX_GNL_MSG_DATA\n");
228 return -EINVAL;
229 }
230 return nla_len(nla);
231}
232EXPORT_SYMBOL_GPL(wimax_msg_len);
233
234
235/**
236 * wimax_msg_send - Send a pre-allocated message to user space
237 *
238 * @wimax_dev: WiMAX device descriptor
239 *
240 * @skb: &struct sk_buff returned by wimax_msg_alloc(). Note the
241 * ownership of @skb is transferred to this function.
242 *
243 * Returns: 0 if ok, < 0 errno code on error
244 *
245 * Description:
246 *
247 * Sends a free-form message that was preallocated with
248 * wimax_msg_alloc() and filled up.
249 *
250 * Assumes that once you pass an skb to this function for sending, it
251 * owns it and will release it when done (on success).
252 *
253 * IMPORTANT:
254 *
255 * Don't use skb_push()/skb_pull()/skb_reserve() on the skb, as
256 * wimax_msg_send() depends on skb->data being placed at the
257 * beginning of the user message.
258 */
259int wimax_msg_send(struct wimax_dev *wimax_dev, struct sk_buff *skb)
260{
261 int result;
262 struct device *dev = wimax_dev->net_dev->dev.parent;
263 void *msg = skb->data;
264 size_t size = skb->len;
265 might_sleep();
266
267 d_printf(1, dev, "CTX: wimax msg, %zu bytes\n", size);
268 d_dump(2, dev, msg, size);
269 result = genlmsg_multicast(skb, 0, wimax_gnl_mcg.id, GFP_KERNEL);
270 d_printf(1, dev, "CTX: genl multicast result %d\n", result);
271 if (result == -ESRCH) /* Nobody connected, ignore it */
272 result = 0; /* btw, the skb is freed already */
273 return result;
274}
275EXPORT_SYMBOL_GPL(wimax_msg_send);
276
277
278/**
279 * wimax_msg - Send a message to user space
280 *
281 * @wimax_dev: WiMAX device descriptor (properly referenced)
282 * @pipe_name: "named pipe" the message will be sent to
283 * @buf: pointer to the message to send.
284 * @size: size of the buffer pointed to by @buf (in bytes).
285 * @gfp_flags: flags for memory allocation.
286 *
287 * Returns: %0 if ok, negative errno code on error.
288 *
289 * Description:
290 *
291 * Sends a free-form message to user space on the device @wimax_dev.
292 *
293 * NOTES:
294 *
295 * Once the @skb is given to this function, who will own it and will
296 * release it when done (unless it returns error).
297 */
298int wimax_msg(struct wimax_dev *wimax_dev, const char *pipe_name,
299 const void *buf, size_t size, gfp_t gfp_flags)
300{
301 int result = -ENOMEM;
302 struct sk_buff *skb;
303
304 skb = wimax_msg_alloc(wimax_dev, pipe_name, buf, size, gfp_flags);
305 if (skb == NULL)
306 goto error_msg_new;
307 result = wimax_msg_send(wimax_dev, skb);
308error_msg_new:
309 return result;
310}
311EXPORT_SYMBOL_GPL(wimax_msg);
312
313
314static const
315struct nla_policy wimax_gnl_msg_policy[WIMAX_GNL_ATTR_MAX + 1] = {
316 [WIMAX_GNL_MSG_IFIDX] = {
317 .type = NLA_U32,
318 },
319 [WIMAX_GNL_MSG_DATA] = {
320 .type = NLA_UNSPEC, /* libnl doesn't grok BINARY yet */
321 },
322};
323
324
325/*
326 * Relays a message from user space to the driver
327 *
328 * The skb is passed to the driver-specific function with the netlink
329 * and generic netlink headers already stripped.
330 *
331 * This call will block while handling/relaying the message.
332 */
333static
334int wimax_gnl_doit_msg_from_user(struct sk_buff *skb, struct genl_info *info)
335{
336 int result, ifindex;
337 struct wimax_dev *wimax_dev;
338 struct device *dev;
339 struct nlmsghdr *nlh = info->nlhdr;
340 char *pipe_name;
341 void *msg_buf;
342 size_t msg_len;
343
344 might_sleep();
345 d_fnstart(3, NULL, "(skb %p info %p)\n", skb, info);
346 result = -ENODEV;
347 if (info->attrs[WIMAX_GNL_MSG_IFIDX] == NULL) {
348 printk(KERN_ERR "WIMAX_GNL_MSG_FROM_USER: can't find IFIDX "
349 "attribute\n");
350 goto error_no_wimax_dev;
351 }
352 ifindex = nla_get_u32(info->attrs[WIMAX_GNL_MSG_IFIDX]);
353 wimax_dev = wimax_dev_get_by_genl_info(info, ifindex);
354 if (wimax_dev == NULL)
355 goto error_no_wimax_dev;
356 dev = wimax_dev_to_dev(wimax_dev);
357
358 /* Unpack arguments */
359 result = -EINVAL;
360 if (info->attrs[WIMAX_GNL_MSG_DATA] == NULL) {
361 dev_err(dev, "WIMAX_GNL_MSG_FROM_USER: can't find MSG_DATA "
362 "attribute\n");
363 goto error_no_data;
364 }
365 msg_buf = nla_data(info->attrs[WIMAX_GNL_MSG_DATA]);
366 msg_len = nla_len(info->attrs[WIMAX_GNL_MSG_DATA]);
367
368 if (info->attrs[WIMAX_GNL_MSG_PIPE_NAME] == NULL)
369 pipe_name = NULL;
370 else {
371 struct nlattr *attr = info->attrs[WIMAX_GNL_MSG_PIPE_NAME];
372 size_t attr_len = nla_len(attr);
373 /* libnl-1.1 does not yet support NLA_NUL_STRING */
374 result = -ENOMEM;
375 pipe_name = kstrndup(nla_data(attr), attr_len + 1, GFP_KERNEL);
376 if (pipe_name == NULL)
377 goto error_alloc;
378 pipe_name[attr_len] = 0;
379 }
380 mutex_lock(&wimax_dev->mutex);
381 result = wimax_dev_is_ready(wimax_dev);
382 if (result < 0)
383 goto error_not_ready;
384 result = -ENOSYS;
385 if (wimax_dev->op_msg_from_user == NULL)
386 goto error_noop;
387
388 d_printf(1, dev,
389 "CRX: nlmsghdr len %u type %u flags 0x%04x seq 0x%x pid %u\n",
390 nlh->nlmsg_len, nlh->nlmsg_type, nlh->nlmsg_flags,
391 nlh->nlmsg_seq, nlh->nlmsg_pid);
392 d_printf(1, dev, "CRX: wimax message %zu bytes\n", msg_len);
393 d_dump(2, dev, msg_buf, msg_len);
394
395 result = wimax_dev->op_msg_from_user(wimax_dev, pipe_name,
396 msg_buf, msg_len, info);
397error_noop:
398error_not_ready:
399 mutex_unlock(&wimax_dev->mutex);
400error_alloc:
401 kfree(pipe_name);
402error_no_data:
403 dev_put(wimax_dev->net_dev);
404error_no_wimax_dev:
405 d_fnend(3, NULL, "(skb %p info %p) = %d\n", skb, info, result);
406 return result;
407}
408
409
410/*
411 * Generic Netlink glue
412 */
413
414struct genl_ops wimax_gnl_msg_from_user = {
415 .cmd = WIMAX_GNL_OP_MSG_FROM_USER,
416 .flags = GENL_ADMIN_PERM,
417 .policy = wimax_gnl_msg_policy,
418 .doit = wimax_gnl_doit_msg_from_user,
419 .dumpit = NULL,
420};
421
diff --git a/net/wimax/op-reset.c b/net/wimax/op-reset.c
new file mode 100644
index 000000000000..ca269178c4d4
--- /dev/null
+++ b/net/wimax/op-reset.c
@@ -0,0 +1,143 @@
1/*
2 * Linux WiMAX
3 * Implement and export a method for resetting a WiMAX device
4 *
5 *
6 * Copyright (C) 2008 Intel Corporation <linux-wimax@intel.com>
7 * Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License version
11 * 2 as published by the Free Software Foundation.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21 * 02110-1301, USA.
22 *
23 *
24 * This implements a simple synchronous call to reset a WiMAX device.
25 *
26 * Resets aim at being warm, keeping the device handles active;
27 * however, when that fails, it falls back to a cold reset (that will
28 * disconnect and reconnect the device).
29 */
30
31#include <net/wimax.h>
32#include <net/genetlink.h>
33#include <linux/wimax.h>
34#include <linux/security.h>
35#include "wimax-internal.h"
36
37#define D_SUBMODULE op_reset
38#include "debug-levels.h"
39
40
41/**
42 * wimax_reset - Reset a WiMAX device
43 *
44 * @wimax_dev: WiMAX device descriptor
45 *
46 * Returns:
47 *
48 * %0 if ok and a warm reset was done (the device still exists in
49 * the system).
50 *
51 * -%ENODEV if a cold/bus reset had to be done (device has
52 * disconnected and reconnected, so current handle is not valid
53 * any more).
54 *
55 * -%EINVAL if the device is not even registered.
56 *
57 * Any other negative error code shall be considered as
58 * non-recoverable.
59 *
60 * Description:
61 *
62 * Called when wanting to reset the device for any reason. Device is
63 * taken back to power on status.
64 *
65 * This call blocks; on succesful return, the device has completed the
66 * reset process and is ready to operate.
67 */
68int wimax_reset(struct wimax_dev *wimax_dev)
69{
70 int result = -EINVAL;
71 struct device *dev = wimax_dev_to_dev(wimax_dev);
72 enum wimax_st state;
73
74 might_sleep();
75 d_fnstart(3, dev, "(wimax_dev %p)\n", wimax_dev);
76 mutex_lock(&wimax_dev->mutex);
77 dev_hold(wimax_dev->net_dev);
78 state = wimax_dev->state;
79 mutex_unlock(&wimax_dev->mutex);
80
81 if (state >= WIMAX_ST_DOWN) {
82 mutex_lock(&wimax_dev->mutex_reset);
83 result = wimax_dev->op_reset(wimax_dev);
84 mutex_unlock(&wimax_dev->mutex_reset);
85 }
86 dev_put(wimax_dev->net_dev);
87
88 d_fnend(3, dev, "(wimax_dev %p) = %d\n", wimax_dev, result);
89 return result;
90}
91EXPORT_SYMBOL(wimax_reset);
92
93
94static const
95struct nla_policy wimax_gnl_reset_policy[WIMAX_GNL_ATTR_MAX + 1] = {
96 [WIMAX_GNL_RESET_IFIDX] = {
97 .type = NLA_U32,
98 },
99};
100
101
102/*
103 * Exporting to user space over generic netlink
104 *
105 * Parse the reset command from user space, return error code.
106 *
107 * No attributes.
108 */
109static
110int wimax_gnl_doit_reset(struct sk_buff *skb, struct genl_info *info)
111{
112 int result, ifindex;
113 struct wimax_dev *wimax_dev;
114 struct device *dev;
115
116 d_fnstart(3, NULL, "(skb %p info %p)\n", skb, info);
117 result = -ENODEV;
118 if (info->attrs[WIMAX_GNL_RESET_IFIDX] == NULL) {
119 printk(KERN_ERR "WIMAX_GNL_OP_RFKILL: can't find IFIDX "
120 "attribute\n");
121 goto error_no_wimax_dev;
122 }
123 ifindex = nla_get_u32(info->attrs[WIMAX_GNL_RESET_IFIDX]);
124 wimax_dev = wimax_dev_get_by_genl_info(info, ifindex);
125 if (wimax_dev == NULL)
126 goto error_no_wimax_dev;
127 dev = wimax_dev_to_dev(wimax_dev);
128 /* Execute the operation and send the result back to user space */
129 result = wimax_reset(wimax_dev);
130 dev_put(wimax_dev->net_dev);
131error_no_wimax_dev:
132 d_fnend(3, NULL, "(skb %p info %p) = %d\n", skb, info, result);
133 return result;
134}
135
136
137struct genl_ops wimax_gnl_reset = {
138 .cmd = WIMAX_GNL_OP_RESET,
139 .flags = GENL_ADMIN_PERM,
140 .policy = wimax_gnl_reset_policy,
141 .doit = wimax_gnl_doit_reset,
142 .dumpit = NULL,
143};
diff --git a/net/wimax/op-rfkill.c b/net/wimax/op-rfkill.c
new file mode 100644
index 000000000000..8745bac173f1
--- /dev/null
+++ b/net/wimax/op-rfkill.c
@@ -0,0 +1,532 @@
1/*
2 * Linux WiMAX
3 * RF-kill framework integration
4 *
5 *
6 * Copyright (C) 2008 Intel Corporation <linux-wimax@intel.com>
7 * Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License version
11 * 2 as published by the Free Software Foundation.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21 * 02110-1301, USA.
22 *
23 *
24 * This integrates into the Linux Kernel rfkill susbystem so that the
25 * drivers just have to do the bare minimal work, which is providing a
26 * method to set the software RF-Kill switch and to report changes in
27 * the software and hardware switch status.
28 *
29 * A non-polled generic rfkill device is embedded into the WiMAX
30 * subsystem's representation of a device.
31 *
32 * FIXME: Need polled support? use a timer or add the implementation
33 * to the stack.
34 *
35 * All device drivers have to do is after wimax_dev_init(), call
36 * wimax_report_rfkill_hw() and wimax_report_rfkill_sw() to update
37 * initial state and then every time it changes. See wimax.h:struct
38 * wimax_dev for more information.
39 *
40 * ROADMAP
41 *
42 * wimax_gnl_doit_rfkill() User space calling wimax_rfkill()
43 * wimax_rfkill() Kernel calling wimax_rfkill()
44 * __wimax_rf_toggle_radio()
45 *
46 * wimax_rfkill_toggle_radio() RF-Kill subsytem calling
47 * __wimax_rf_toggle_radio()
48 *
49 * __wimax_rf_toggle_radio()
50 * wimax_dev->op_rfkill_sw_toggle() Driver backend
51 * __wimax_state_change()
52 *
53 * wimax_report_rfkill_sw() Driver reports state change
54 * __wimax_state_change()
55 *
56 * wimax_report_rfkill_hw() Driver reports state change
57 * __wimax_state_change()
58 *
59 * wimax_rfkill_add() Initialize/shutdown rfkill support
60 * wimax_rfkill_rm() [called by wimax_dev_add/rm()]
61 */
62
63#include <net/wimax.h>
64#include <net/genetlink.h>
65#include <linux/wimax.h>
66#include <linux/security.h>
67#include <linux/rfkill.h>
68#include <linux/input.h>
69#include "wimax-internal.h"
70
71#define D_SUBMODULE op_rfkill
72#include "debug-levels.h"
73
74#ifdef CONFIG_RFKILL
75
76
77/**
78 * wimax_report_rfkill_hw - Reports changes in the hardware RF switch
79 *
80 * @wimax_dev: WiMAX device descriptor
81 *
82 * @state: New state of the RF Kill switch. %WIMAX_RF_ON radio on,
83 * %WIMAX_RF_OFF radio off.
84 *
85 * When the device detects a change in the state of thehardware RF
86 * switch, it must call this function to let the WiMAX kernel stack
87 * know that the state has changed so it can be properly propagated.
88 *
89 * The WiMAX stack caches the state (the driver doesn't need to). As
90 * well, as the change is propagated it will come back as a request to
91 * change the software state to mirror the hardware state.
92 *
93 * If the device doesn't have a hardware kill switch, just report
94 * it on initialization as always on (%WIMAX_RF_ON, radio on).
95 */
96void wimax_report_rfkill_hw(struct wimax_dev *wimax_dev,
97 enum wimax_rf_state state)
98{
99 int result;
100 struct device *dev = wimax_dev_to_dev(wimax_dev);
101 enum wimax_st wimax_state;
102 enum rfkill_state rfkill_state;
103
104 d_fnstart(3, dev, "(wimax_dev %p state %u)\n", wimax_dev, state);
105 BUG_ON(state == WIMAX_RF_QUERY);
106 BUG_ON(state != WIMAX_RF_ON && state != WIMAX_RF_OFF);
107
108 mutex_lock(&wimax_dev->mutex);
109 result = wimax_dev_is_ready(wimax_dev);
110 if (result < 0)
111 goto error_not_ready;
112
113 if (state != wimax_dev->rf_hw) {
114 wimax_dev->rf_hw = state;
115 rfkill_state = state == WIMAX_RF_ON ?
116 RFKILL_STATE_OFF : RFKILL_STATE_ON;
117 if (wimax_dev->rf_hw == WIMAX_RF_ON
118 && wimax_dev->rf_sw == WIMAX_RF_ON)
119 wimax_state = WIMAX_ST_READY;
120 else
121 wimax_state = WIMAX_ST_RADIO_OFF;
122 __wimax_state_change(wimax_dev, wimax_state);
123 input_report_key(wimax_dev->rfkill_input, KEY_WIMAX,
124 rfkill_state);
125 }
126error_not_ready:
127 mutex_unlock(&wimax_dev->mutex);
128 d_fnend(3, dev, "(wimax_dev %p state %u) = void [%d]\n",
129 wimax_dev, state, result);
130}
131EXPORT_SYMBOL_GPL(wimax_report_rfkill_hw);
132
133
134/**
135 * wimax_report_rfkill_sw - Reports changes in the software RF switch
136 *
137 * @wimax_dev: WiMAX device descriptor
138 *
139 * @state: New state of the RF kill switch. %WIMAX_RF_ON radio on,
140 * %WIMAX_RF_OFF radio off.
141 *
142 * Reports changes in the software RF switch state to the the WiMAX
143 * stack.
144 *
145 * The main use is during initialization, so the driver can query the
146 * device for its current software radio kill switch state and feed it
147 * to the system.
148 *
149 * On the side, the device does not change the software state by
150 * itself. In practice, this can happen, as the device might decide to
151 * switch (in software) the radio off for different reasons.
152 */
153void wimax_report_rfkill_sw(struct wimax_dev *wimax_dev,
154 enum wimax_rf_state state)
155{
156 int result;
157 struct device *dev = wimax_dev_to_dev(wimax_dev);
158 enum wimax_st wimax_state;
159
160 d_fnstart(3, dev, "(wimax_dev %p state %u)\n", wimax_dev, state);
161 BUG_ON(state == WIMAX_RF_QUERY);
162 BUG_ON(state != WIMAX_RF_ON && state != WIMAX_RF_OFF);
163
164 mutex_lock(&wimax_dev->mutex);
165 result = wimax_dev_is_ready(wimax_dev);
166 if (result < 0)
167 goto error_not_ready;
168
169 if (state != wimax_dev->rf_sw) {
170 wimax_dev->rf_sw = state;
171 if (wimax_dev->rf_hw == WIMAX_RF_ON
172 && wimax_dev->rf_sw == WIMAX_RF_ON)
173 wimax_state = WIMAX_ST_READY;
174 else
175 wimax_state = WIMAX_ST_RADIO_OFF;
176 __wimax_state_change(wimax_dev, wimax_state);
177 }
178error_not_ready:
179 mutex_unlock(&wimax_dev->mutex);
180 d_fnend(3, dev, "(wimax_dev %p state %u) = void [%d]\n",
181 wimax_dev, state, result);
182}
183EXPORT_SYMBOL_GPL(wimax_report_rfkill_sw);
184
185
186/*
187 * Callback for the RF Kill toggle operation
188 *
189 * This function is called by:
190 *
191 * - The rfkill subsystem when the RF-Kill key is pressed in the
192 * hardware and the driver notifies through
193 * wimax_report_rfkill_hw(). The rfkill subsystem ends up calling back
194 * here so the software RF Kill switch state is changed to reflect
195 * the hardware switch state.
196 *
197 * - When the user sets the state through sysfs' rfkill/state file
198 *
199 * - When the user calls wimax_rfkill().
200 *
201 * This call blocks!
202 *
203 * WARNING! When we call rfkill_unregister(), this will be called with
204 * state 0!
205 *
206 * WARNING: wimax_dev must be locked
207 */
208static
209int __wimax_rf_toggle_radio(struct wimax_dev *wimax_dev,
210 enum wimax_rf_state state)
211{
212 int result = 0;
213 struct device *dev = wimax_dev_to_dev(wimax_dev);
214 enum wimax_st wimax_state;
215
216 might_sleep();
217 d_fnstart(3, dev, "(wimax_dev %p state %u)\n", wimax_dev, state);
218 if (wimax_dev->rf_sw == state)
219 goto out_no_change;
220 if (wimax_dev->op_rfkill_sw_toggle != NULL)
221 result = wimax_dev->op_rfkill_sw_toggle(wimax_dev, state);
222 else if (state == WIMAX_RF_OFF) /* No op? can't turn off */
223 result = -ENXIO;
224 else /* No op? can turn on */
225 result = 0; /* should never happen tho */
226 if (result >= 0) {
227 result = 0;
228 wimax_dev->rf_sw = state;
229 wimax_state = state == WIMAX_RF_ON ?
230 WIMAX_ST_READY : WIMAX_ST_RADIO_OFF;
231 __wimax_state_change(wimax_dev, wimax_state);
232 }
233out_no_change:
234 d_fnend(3, dev, "(wimax_dev %p state %u) = %d\n",
235 wimax_dev, state, result);
236 return result;
237}
238
239
240/*
241 * Translate from rfkill state to wimax state
242 *
243 * NOTE: Special state handling rules here
244 *
245 * Just pretend the call didn't happen if we are in a state where
246 * we know for sure it cannot be handled (WIMAX_ST_DOWN or
247 * __WIMAX_ST_QUIESCING). rfkill() needs it to register and
248 * unregister, as it will run this path.
249 *
250 * NOTE: This call will block until the operation is completed.
251 */
252static
253int wimax_rfkill_toggle_radio(void *data, enum rfkill_state state)
254{
255 int result;
256 struct wimax_dev *wimax_dev = data;
257 struct device *dev = wimax_dev_to_dev(wimax_dev);
258 enum wimax_rf_state rf_state;
259
260 d_fnstart(3, dev, "(wimax_dev %p state %u)\n", wimax_dev, state);
261 switch (state) {
262 case RFKILL_STATE_ON:
263 rf_state = WIMAX_RF_OFF;
264 break;
265 case RFKILL_STATE_OFF:
266 rf_state = WIMAX_RF_ON;
267 break;
268 default:
269 BUG();
270 }
271 mutex_lock(&wimax_dev->mutex);
272 if (wimax_dev->state <= __WIMAX_ST_QUIESCING)
273 result = 0; /* just pretend it didn't happen */
274 else
275 result = __wimax_rf_toggle_radio(wimax_dev, rf_state);
276 mutex_unlock(&wimax_dev->mutex);
277 d_fnend(3, dev, "(wimax_dev %p state %u) = %d\n",
278 wimax_dev, state, result);
279 return result;
280}
281
282
283/**
284 * wimax_rfkill - Set the software RF switch state for a WiMAX device
285 *
286 * @wimax_dev: WiMAX device descriptor
287 *
288 * @state: New RF state.
289 *
290 * Returns:
291 *
292 * >= 0 toggle state if ok, < 0 errno code on error. The toggle state
293 * is returned as a bitmap, bit 0 being the hardware RF state, bit 1
294 * the software RF state.
295 *
296 * 0 means disabled (%WIMAX_RF_ON, radio on), 1 means enabled radio
297 * off (%WIMAX_RF_OFF).
298 *
299 * Description:
300 *
301 * Called by the user when he wants to request the WiMAX radio to be
302 * switched on (%WIMAX_RF_ON) or off (%WIMAX_RF_OFF). With
303 * %WIMAX_RF_QUERY, just the current state is returned.
304 *
305 * NOTE:
306 *
307 * This call will block until the operation is complete.
308 */
309int wimax_rfkill(struct wimax_dev *wimax_dev, enum wimax_rf_state state)
310{
311 int result;
312 struct device *dev = wimax_dev_to_dev(wimax_dev);
313
314 d_fnstart(3, dev, "(wimax_dev %p state %u)\n", wimax_dev, state);
315 mutex_lock(&wimax_dev->mutex);
316 result = wimax_dev_is_ready(wimax_dev);
317 if (result < 0)
318 goto error_not_ready;
319 switch (state) {
320 case WIMAX_RF_ON:
321 case WIMAX_RF_OFF:
322 result = __wimax_rf_toggle_radio(wimax_dev, state);
323 if (result < 0)
324 goto error;
325 break;
326 case WIMAX_RF_QUERY:
327 break;
328 default:
329 result = -EINVAL;
330 goto error;
331 }
332 result = wimax_dev->rf_sw << 1 | wimax_dev->rf_hw;
333error:
334error_not_ready:
335 mutex_unlock(&wimax_dev->mutex);
336 d_fnend(3, dev, "(wimax_dev %p state %u) = %d\n",
337 wimax_dev, state, result);
338 return result;
339}
340EXPORT_SYMBOL(wimax_rfkill);
341
342
343/*
344 * Register a new WiMAX device's RF Kill support
345 *
346 * WARNING: wimax_dev->mutex must be unlocked
347 */
348int wimax_rfkill_add(struct wimax_dev *wimax_dev)
349{
350 int result;
351 struct rfkill *rfkill;
352 struct input_dev *input_dev;
353 struct device *dev = wimax_dev_to_dev(wimax_dev);
354
355 d_fnstart(3, dev, "(wimax_dev %p)\n", wimax_dev);
356 /* Initialize RF Kill */
357 result = -ENOMEM;
358 rfkill = rfkill_allocate(dev, RFKILL_TYPE_WIMAX);
359 if (rfkill == NULL)
360 goto error_rfkill_allocate;
361 wimax_dev->rfkill = rfkill;
362
363 rfkill->name = wimax_dev->name;
364 rfkill->state = RFKILL_STATE_OFF;
365 rfkill->data = wimax_dev;
366 rfkill->toggle_radio = wimax_rfkill_toggle_radio;
367 rfkill->user_claim_unsupported = 1;
368
369 /* Initialize the input device for the hw key */
370 input_dev = input_allocate_device();
371 if (input_dev == NULL)
372 goto error_input_allocate;
373 wimax_dev->rfkill_input = input_dev;
374 d_printf(1, dev, "rfkill %p input %p\n", rfkill, input_dev);
375
376 input_dev->name = wimax_dev->name;
377 /* FIXME: get a real device bus ID and stuff? do we care? */
378 input_dev->id.bustype = BUS_HOST;
379 input_dev->id.vendor = 0xffff;
380 input_dev->evbit[0] = BIT(EV_KEY);
381 set_bit(KEY_WIMAX, input_dev->keybit);
382
383 /* Register both */
384 result = input_register_device(wimax_dev->rfkill_input);
385 if (result < 0)
386 goto error_input_register;
387 result = rfkill_register(wimax_dev->rfkill);
388 if (result < 0)
389 goto error_rfkill_register;
390
391 /* If there is no SW toggle op, SW RFKill is always on */
392 if (wimax_dev->op_rfkill_sw_toggle == NULL)
393 wimax_dev->rf_sw = WIMAX_RF_ON;
394
395 d_fnend(3, dev, "(wimax_dev %p) = 0\n", wimax_dev);
396 return 0;
397
398 /* if rfkill_register() suceeds, can't use rfkill_free() any
399 * more, only rfkill_unregister() [it owns the refcount]; with
400 * the input device we have the same issue--hence the if. */
401error_rfkill_register:
402 input_unregister_device(wimax_dev->rfkill_input);
403 wimax_dev->rfkill_input = NULL;
404error_input_register:
405 if (wimax_dev->rfkill_input)
406 input_free_device(wimax_dev->rfkill_input);
407error_input_allocate:
408 rfkill_free(wimax_dev->rfkill);
409error_rfkill_allocate:
410 d_fnend(3, dev, "(wimax_dev %p) = %d\n", wimax_dev, result);
411 return result;
412}
413
414
415/*
416 * Deregister a WiMAX device's RF Kill support
417 *
418 * Ick, we can't call rfkill_free() after rfkill_unregister()...oh
419 * well.
420 *
421 * WARNING: wimax_dev->mutex must be unlocked
422 */
423void wimax_rfkill_rm(struct wimax_dev *wimax_dev)
424{
425 struct device *dev = wimax_dev_to_dev(wimax_dev);
426 d_fnstart(3, dev, "(wimax_dev %p)\n", wimax_dev);
427 rfkill_unregister(wimax_dev->rfkill); /* frees */
428 input_unregister_device(wimax_dev->rfkill_input);
429 d_fnend(3, dev, "(wimax_dev %p)\n", wimax_dev);
430}
431
432
433#else /* #ifdef CONFIG_RFKILL */
434
435void wimax_report_rfkill_hw(struct wimax_dev *wimax_dev,
436 enum wimax_rf_state state)
437{
438}
439EXPORT_SYMBOL_GPL(wimax_report_rfkill_hw);
440
441void wimax_report_rfkill_sw(struct wimax_dev *wimax_dev,
442 enum wimax_rf_state state)
443{
444}
445EXPORT_SYMBOL_GPL(wimax_report_rfkill_sw);
446
447int wimax_rfkill(struct wimax_dev *wimax_dev,
448 enum wimax_rf_state state)
449{
450 return WIMAX_RF_ON << 1 | WIMAX_RF_ON;
451}
452EXPORT_SYMBOL_GPL(wimax_rfkill);
453
454int wimax_rfkill_add(struct wimax_dev *wimax_dev)
455{
456 return 0;
457}
458
459void wimax_rfkill_rm(struct wimax_dev *wimax_dev)
460{
461}
462
463#endif /* #ifdef CONFIG_RFKILL */
464
465
466/*
467 * Exporting to user space over generic netlink
468 *
469 * Parse the rfkill command from user space, return a combination
470 * value that describe the states of the different toggles.
471 *
472 * Only one attribute: the new state requested (on, off or no change,
473 * just query).
474 */
475
476static const
477struct nla_policy wimax_gnl_rfkill_policy[WIMAX_GNL_ATTR_MAX + 1] = {
478 [WIMAX_GNL_RFKILL_IFIDX] = {
479 .type = NLA_U32,
480 },
481 [WIMAX_GNL_RFKILL_STATE] = {
482 .type = NLA_U32 /* enum wimax_rf_state */
483 },
484};
485
486
487static
488int wimax_gnl_doit_rfkill(struct sk_buff *skb, struct genl_info *info)
489{
490 int result, ifindex;
491 struct wimax_dev *wimax_dev;
492 struct device *dev;
493 enum wimax_rf_state new_state;
494
495 d_fnstart(3, NULL, "(skb %p info %p)\n", skb, info);
496 result = -ENODEV;
497 if (info->attrs[WIMAX_GNL_RFKILL_IFIDX] == NULL) {
498 printk(KERN_ERR "WIMAX_GNL_OP_RFKILL: can't find IFIDX "
499 "attribute\n");
500 goto error_no_wimax_dev;
501 }
502 ifindex = nla_get_u32(info->attrs[WIMAX_GNL_RFKILL_IFIDX]);
503 wimax_dev = wimax_dev_get_by_genl_info(info, ifindex);
504 if (wimax_dev == NULL)
505 goto error_no_wimax_dev;
506 dev = wimax_dev_to_dev(wimax_dev);
507 result = -EINVAL;
508 if (info->attrs[WIMAX_GNL_RFKILL_STATE] == NULL) {
509 dev_err(dev, "WIMAX_GNL_RFKILL: can't find RFKILL_STATE "
510 "attribute\n");
511 goto error_no_pid;
512 }
513 new_state = nla_get_u32(info->attrs[WIMAX_GNL_RFKILL_STATE]);
514
515 /* Execute the operation and send the result back to user space */
516 result = wimax_rfkill(wimax_dev, new_state);
517error_no_pid:
518 dev_put(wimax_dev->net_dev);
519error_no_wimax_dev:
520 d_fnend(3, NULL, "(skb %p info %p) = %d\n", skb, info, result);
521 return result;
522}
523
524
525struct genl_ops wimax_gnl_rfkill = {
526 .cmd = WIMAX_GNL_OP_RFKILL,
527 .flags = GENL_ADMIN_PERM,
528 .policy = wimax_gnl_rfkill_policy,
529 .doit = wimax_gnl_doit_rfkill,
530 .dumpit = NULL,
531};
532
diff --git a/net/wimax/stack.c b/net/wimax/stack.c
new file mode 100644
index 000000000000..d4da92f8981a
--- /dev/null
+++ b/net/wimax/stack.c
@@ -0,0 +1,599 @@
1/*
2 * Linux WiMAX
3 * Initialization, addition and removal of wimax devices
4 *
5 *
6 * Copyright (C) 2005-2006 Intel Corporation <linux-wimax@intel.com>
7 * Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License version
11 * 2 as published by the Free Software Foundation.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21 * 02110-1301, USA.
22 *
23 *
24 * This implements:
25 *
26 * - basic life cycle of 'struct wimax_dev' [wimax_dev_*()]; on
27 * addition/registration initialize all subfields and allocate
28 * generic netlink resources for user space communication. On
29 * removal/unregistration, undo all that.
30 *
31 * - device state machine [wimax_state_change()] and support to send
32 * reports to user space when the state changes
33 * [wimax_gnl_re_state_change*()].
34 *
35 * See include/net/wimax.h for rationales and design.
36 *
37 * ROADMAP
38 *
39 * [__]wimax_state_change() Called by drivers to update device's state
40 * wimax_gnl_re_state_change_alloc()
41 * wimax_gnl_re_state_change_send()
42 *
43 * wimax_dev_init() Init a device
44 * wimax_dev_add() Register
45 * wimax_rfkill_add()
46 * wimax_gnl_add() Register all the generic netlink resources.
47 * wimax_id_table_add()
48 * wimax_dev_rm() Unregister
49 * wimax_id_table_rm()
50 * wimax_gnl_rm()
51 * wimax_rfkill_rm()
52 */
53#include <linux/device.h>
54#include <net/genetlink.h>
55#include <linux/netdevice.h>
56#include <linux/wimax.h>
57#include "wimax-internal.h"
58
59
60#define D_SUBMODULE stack
61#include "debug-levels.h"
62
63/*
64 * Authoritative source for the RE_STATE_CHANGE attribute policy
65 *
66 * We don't really use it here, but /me likes to keep the definition
67 * close to where the data is generated.
68 */
69/*
70static const
71struct nla_policy wimax_gnl_re_status_change[WIMAX_GNL_ATTR_MAX + 1] = {
72 [WIMAX_GNL_STCH_STATE_OLD] = { .type = NLA_U8 },
73 [WIMAX_GNL_STCH_STATE_NEW] = { .type = NLA_U8 },
74};
75*/
76
77
78/*
79 * Allocate a Report State Change message
80 *
81 * @header: save it, you need it for _send()
82 *
83 * Creates and fills a basic state change message; different code
84 * paths can then add more attributes to the message as needed.
85 *
86 * Use wimax_gnl_re_state_change_send() to send the returned skb.
87 *
88 * Returns: skb with the genl message if ok, IS_ERR() ptr on error
89 * with an errno code.
90 */
91static
92struct sk_buff *wimax_gnl_re_state_change_alloc(
93 struct wimax_dev *wimax_dev,
94 enum wimax_st new_state, enum wimax_st old_state,
95 void **header)
96{
97 int result;
98 struct device *dev = wimax_dev_to_dev(wimax_dev);
99 void *data;
100 struct sk_buff *report_skb;
101
102 d_fnstart(3, dev, "(wimax_dev %p new_state %u old_state %u)\n",
103 wimax_dev, new_state, old_state);
104 result = -ENOMEM;
105 report_skb = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL);
106 if (report_skb == NULL) {
107 dev_err(dev, "RE_STCH: can't create message\n");
108 goto error_new;
109 }
110 data = genlmsg_put(report_skb, 0, wimax_gnl_mcg.id, &wimax_gnl_family,
111 0, WIMAX_GNL_RE_STATE_CHANGE);
112 if (data == NULL) {
113 dev_err(dev, "RE_STCH: can't put data into message\n");
114 goto error_put;
115 }
116 *header = data;
117
118 result = nla_put_u8(report_skb, WIMAX_GNL_STCH_STATE_OLD, old_state);
119 if (result < 0) {
120 dev_err(dev, "RE_STCH: Error adding OLD attr: %d\n", result);
121 goto error_put;
122 }
123 result = nla_put_u8(report_skb, WIMAX_GNL_STCH_STATE_NEW, new_state);
124 if (result < 0) {
125 dev_err(dev, "RE_STCH: Error adding NEW attr: %d\n", result);
126 goto error_put;
127 }
128 result = nla_put_u32(report_skb, WIMAX_GNL_STCH_IFIDX,
129 wimax_dev->net_dev->ifindex);
130 if (result < 0) {
131 dev_err(dev, "RE_STCH: Error adding IFINDEX attribute\n");
132 goto error_put;
133 }
134 d_fnend(3, dev, "(wimax_dev %p new_state %u old_state %u) = %p\n",
135 wimax_dev, new_state, old_state, report_skb);
136 return report_skb;
137
138error_put:
139 nlmsg_free(report_skb);
140error_new:
141 d_fnend(3, dev, "(wimax_dev %p new_state %u old_state %u) = %d\n",
142 wimax_dev, new_state, old_state, result);
143 return ERR_PTR(result);
144}
145
146
147/*
148 * Send a Report State Change message (as created with _alloc).
149 *
150 * @report_skb: as returned by wimax_gnl_re_state_change_alloc()
151 * @header: as returned by wimax_gnl_re_state_change_alloc()
152 *
153 * Returns: 0 if ok, < 0 errno code on error.
154 *
155 * If the message is NULL, pretend it didn't happen.
156 */
157static
158int wimax_gnl_re_state_change_send(
159 struct wimax_dev *wimax_dev, struct sk_buff *report_skb,
160 void *header)
161{
162 int result = 0;
163 struct device *dev = wimax_dev_to_dev(wimax_dev);
164 d_fnstart(3, dev, "(wimax_dev %p report_skb %p)\n",
165 wimax_dev, report_skb);
166 if (report_skb == NULL)
167 goto out;
168 genlmsg_end(report_skb, header);
169 result = genlmsg_multicast(report_skb, 0, wimax_gnl_mcg.id, GFP_KERNEL);
170 if (result == -ESRCH) /* Nobody connected, ignore it */
171 result = 0; /* btw, the skb is freed already */
172 if (result < 0) {
173 dev_err(dev, "RE_STCH: Error sending: %d\n", result);
174 nlmsg_free(report_skb);
175 }
176out:
177 d_fnend(3, dev, "(wimax_dev %p report_skb %p) = %d\n",
178 wimax_dev, report_skb, result);
179 return result;
180}
181
182
183static
184void __check_new_state(enum wimax_st old_state, enum wimax_st new_state,
185 unsigned allowed_states_bm)
186{
187 if (WARN_ON(((1 << new_state) & allowed_states_bm) == 0)) {
188 printk(KERN_ERR "SW BUG! Forbidden state change %u -> %u\n",
189 old_state, new_state);
190 }
191}
192
193
194/*
195 * Set the current state of a WiMAX device [unlocking version of
196 * wimax_state_change().
197 */
198void __wimax_state_change(struct wimax_dev *wimax_dev, enum wimax_st new_state)
199{
200 struct device *dev = wimax_dev_to_dev(wimax_dev);
201 enum wimax_st old_state = wimax_dev->state;
202 struct sk_buff *stch_skb;
203 void *header;
204
205 d_fnstart(3, dev, "(wimax_dev %p new_state %u [old %u])\n",
206 wimax_dev, new_state, old_state);
207
208 if (WARN_ON(new_state >= __WIMAX_ST_INVALID)) {
209 dev_err(dev, "SW BUG: requesting invalid state %u\n",
210 new_state);
211 goto out;
212 }
213 if (old_state == new_state)
214 goto out;
215 header = NULL; /* gcc complains? can't grok why */
216 stch_skb = wimax_gnl_re_state_change_alloc(
217 wimax_dev, new_state, old_state, &header);
218
219 /* Verify the state transition and do exit-from-state actions */
220 switch (old_state) {
221 case __WIMAX_ST_NULL:
222 __check_new_state(old_state, new_state,
223 1 << WIMAX_ST_DOWN);
224 break;
225 case WIMAX_ST_DOWN:
226 __check_new_state(old_state, new_state,
227 1 << __WIMAX_ST_QUIESCING
228 | 1 << WIMAX_ST_UNINITIALIZED
229 | 1 << WIMAX_ST_RADIO_OFF);
230 break;
231 case __WIMAX_ST_QUIESCING:
232 __check_new_state(old_state, new_state, 1 << WIMAX_ST_DOWN);
233 break;
234 case WIMAX_ST_UNINITIALIZED:
235 __check_new_state(old_state, new_state,
236 1 << __WIMAX_ST_QUIESCING
237 | 1 << WIMAX_ST_RADIO_OFF);
238 break;
239 case WIMAX_ST_RADIO_OFF:
240 __check_new_state(old_state, new_state,
241 1 << __WIMAX_ST_QUIESCING
242 | 1 << WIMAX_ST_READY);
243 break;
244 case WIMAX_ST_READY:
245 __check_new_state(old_state, new_state,
246 1 << __WIMAX_ST_QUIESCING
247 | 1 << WIMAX_ST_RADIO_OFF
248 | 1 << WIMAX_ST_SCANNING
249 | 1 << WIMAX_ST_CONNECTING
250 | 1 << WIMAX_ST_CONNECTED);
251 break;
252 case WIMAX_ST_SCANNING:
253 __check_new_state(old_state, new_state,
254 1 << __WIMAX_ST_QUIESCING
255 | 1 << WIMAX_ST_RADIO_OFF
256 | 1 << WIMAX_ST_READY
257 | 1 << WIMAX_ST_CONNECTING
258 | 1 << WIMAX_ST_CONNECTED);
259 break;
260 case WIMAX_ST_CONNECTING:
261 __check_new_state(old_state, new_state,
262 1 << __WIMAX_ST_QUIESCING
263 | 1 << WIMAX_ST_RADIO_OFF
264 | 1 << WIMAX_ST_READY
265 | 1 << WIMAX_ST_SCANNING
266 | 1 << WIMAX_ST_CONNECTED);
267 break;
268 case WIMAX_ST_CONNECTED:
269 __check_new_state(old_state, new_state,
270 1 << __WIMAX_ST_QUIESCING
271 | 1 << WIMAX_ST_RADIO_OFF
272 | 1 << WIMAX_ST_READY);
273 netif_tx_disable(wimax_dev->net_dev);
274 netif_carrier_off(wimax_dev->net_dev);
275 break;
276 case __WIMAX_ST_INVALID:
277 default:
278 dev_err(dev, "SW BUG: wimax_dev %p is in unknown state %u\n",
279 wimax_dev, wimax_dev->state);
280 WARN_ON(1);
281 goto out;
282 }
283
284 /* Execute the actions of entry to the new state */
285 switch (new_state) {
286 case __WIMAX_ST_NULL:
287 dev_err(dev, "SW BUG: wimax_dev %p entering NULL state "
288 "from %u\n", wimax_dev, wimax_dev->state);
289 WARN_ON(1); /* Nobody can enter this state */
290 break;
291 case WIMAX_ST_DOWN:
292 break;
293 case __WIMAX_ST_QUIESCING:
294 break;
295 case WIMAX_ST_UNINITIALIZED:
296 break;
297 case WIMAX_ST_RADIO_OFF:
298 break;
299 case WIMAX_ST_READY:
300 break;
301 case WIMAX_ST_SCANNING:
302 break;
303 case WIMAX_ST_CONNECTING:
304 break;
305 case WIMAX_ST_CONNECTED:
306 netif_carrier_on(wimax_dev->net_dev);
307 netif_wake_queue(wimax_dev->net_dev);
308 break;
309 case __WIMAX_ST_INVALID:
310 default:
311 BUG();
312 }
313 __wimax_state_set(wimax_dev, new_state);
314 if (stch_skb)
315 wimax_gnl_re_state_change_send(wimax_dev, stch_skb, header);
316out:
317 d_fnend(3, dev, "(wimax_dev %p new_state %u [old %u]) = void\n",
318 wimax_dev, new_state, old_state);
319 return;
320}
321
322
323/**
324 * wimax_state_change - Set the current state of a WiMAX device
325 *
326 * @wimax_dev: WiMAX device descriptor (properly referenced)
327 * @new_state: New state to switch to
328 *
329 * This implements the state changes for the wimax devices. It will
330 *
331 * - verify that the state transition is legal (for now it'll just
332 * print a warning if not) according to the table in
333 * linux/wimax.h's documentation for 'enum wimax_st'.
334 *
335 * - perform the actions needed for leaving the current state and
336 * whichever are needed for entering the new state.
337 *
338 * - issue a report to user space indicating the new state (and an
339 * optional payload with information about the new state).
340 *
341 * NOTE: @wimax_dev must be locked
342 */
343void wimax_state_change(struct wimax_dev *wimax_dev, enum wimax_st new_state)
344{
345 mutex_lock(&wimax_dev->mutex);
346 __wimax_state_change(wimax_dev, new_state);
347 mutex_unlock(&wimax_dev->mutex);
348 return;
349}
350EXPORT_SYMBOL_GPL(wimax_state_change);
351
352
353/**
354 * wimax_state_get() - Return the current state of a WiMAX device
355 *
356 * @wimax_dev: WiMAX device descriptor
357 *
358 * Returns: Current state of the device according to its driver.
359 */
360enum wimax_st wimax_state_get(struct wimax_dev *wimax_dev)
361{
362 enum wimax_st state;
363 mutex_lock(&wimax_dev->mutex);
364 state = wimax_dev->state;
365 mutex_unlock(&wimax_dev->mutex);
366 return state;
367}
368EXPORT_SYMBOL_GPL(wimax_state_get);
369
370
371/**
372 * wimax_dev_init - initialize a newly allocated instance
373 *
374 * @wimax_dev: WiMAX device descriptor to initialize.
375 *
376 * Initializes fields of a freshly allocated @wimax_dev instance. This
377 * function assumes that after allocation, the memory occupied by
378 * @wimax_dev was zeroed.
379 */
380void wimax_dev_init(struct wimax_dev *wimax_dev)
381{
382 INIT_LIST_HEAD(&wimax_dev->id_table_node);
383 __wimax_state_set(wimax_dev, WIMAX_ST_UNINITIALIZED);
384 mutex_init(&wimax_dev->mutex);
385 mutex_init(&wimax_dev->mutex_reset);
386}
387EXPORT_SYMBOL_GPL(wimax_dev_init);
388
389/*
390 * This extern is declared here because it's easier to keep track --
391 * both declarations are a list of the same
392 */
393extern struct genl_ops
394 wimax_gnl_msg_from_user,
395 wimax_gnl_reset,
396 wimax_gnl_rfkill;
397
398static
399struct genl_ops *wimax_gnl_ops[] = {
400 &wimax_gnl_msg_from_user,
401 &wimax_gnl_reset,
402 &wimax_gnl_rfkill,
403};
404
405
406static
407size_t wimax_addr_scnprint(char *addr_str, size_t addr_str_size,
408 unsigned char *addr, size_t addr_len)
409{
410 unsigned cnt, total;
411 for (total = cnt = 0; cnt < addr_len; cnt++)
412 total += scnprintf(addr_str + total, addr_str_size - total,
413 "%02x%c", addr[cnt],
414 cnt == addr_len - 1 ? '\0' : ':');
415 return total;
416}
417
418
419/**
420 * wimax_dev_add - Register a new WiMAX device
421 *
422 * @wimax_dev: WiMAX device descriptor (as embedded in your @net_dev's
423 * priv data). You must have called wimax_dev_init() on it before.
424 *
425 * @net_dev: net device the @wimax_dev is associated with. The
426 * function expects SET_NETDEV_DEV() and register_netdev() were
427 * already called on it.
428 *
429 * Registers the new WiMAX device, sets up the user-kernel control
430 * interface (generic netlink) and common WiMAX infrastructure.
431 *
432 * Note that the parts that will allow interaction with user space are
433 * setup at the very end, when the rest is in place, as once that
434 * happens, the driver might get user space control requests via
435 * netlink or from debugfs that might translate into calls into
436 * wimax_dev->op_*().
437 */
438int wimax_dev_add(struct wimax_dev *wimax_dev, struct net_device *net_dev)
439{
440 int result;
441 struct device *dev = net_dev->dev.parent;
442 char addr_str[32];
443
444 d_fnstart(3, dev, "(wimax_dev %p net_dev %p)\n", wimax_dev, net_dev);
445
446 /* Do the RFKILL setup before locking, as RFKILL will call
447 * into our functions. */
448 wimax_dev->net_dev = net_dev;
449 result = wimax_rfkill_add(wimax_dev);
450 if (result < 0)
451 goto error_rfkill_add;
452
453 /* Set up user-space interaction */
454 mutex_lock(&wimax_dev->mutex);
455 wimax_id_table_add(wimax_dev);
456 result = wimax_debugfs_add(wimax_dev);
457 if (result < 0) {
458 dev_err(dev, "cannot initialize debugfs: %d\n",
459 result);
460 goto error_debugfs_add;
461 }
462
463 __wimax_state_set(wimax_dev, WIMAX_ST_DOWN);
464 mutex_unlock(&wimax_dev->mutex);
465
466 wimax_addr_scnprint(addr_str, sizeof(addr_str),
467 net_dev->dev_addr, net_dev->addr_len);
468 dev_err(dev, "WiMAX interface %s (%s) ready\n",
469 net_dev->name, addr_str);
470 d_fnend(3, dev, "(wimax_dev %p net_dev %p) = 0\n", wimax_dev, net_dev);
471 return 0;
472
473error_debugfs_add:
474 wimax_id_table_rm(wimax_dev);
475 mutex_unlock(&wimax_dev->mutex);
476 wimax_rfkill_rm(wimax_dev);
477error_rfkill_add:
478 d_fnend(3, dev, "(wimax_dev %p net_dev %p) = %d\n",
479 wimax_dev, net_dev, result);
480 return result;
481}
482EXPORT_SYMBOL_GPL(wimax_dev_add);
483
484
485/**
486 * wimax_dev_rm - Unregister an existing WiMAX device
487 *
488 * @wimax_dev: WiMAX device descriptor
489 *
490 * Unregisters a WiMAX device previously registered for use with
491 * wimax_add_rm().
492 *
493 * IMPORTANT! Must call before calling unregister_netdev().
494 *
495 * After this function returns, you will not get any more user space
496 * control requests (via netlink or debugfs) and thus to wimax_dev->ops.
497 *
498 * Reentrancy control is ensured by setting the state to
499 * %__WIMAX_ST_QUIESCING. rfkill operations coming through
500 * wimax_*rfkill*() will be stopped by the quiescing state; ops coming
501 * from the rfkill subsystem will be stopped by the support being
502 * removed by wimax_rfkill_rm().
503 */
504void wimax_dev_rm(struct wimax_dev *wimax_dev)
505{
506 d_fnstart(3, NULL, "(wimax_dev %p)\n", wimax_dev);
507
508 mutex_lock(&wimax_dev->mutex);
509 __wimax_state_change(wimax_dev, __WIMAX_ST_QUIESCING);
510 wimax_debugfs_rm(wimax_dev);
511 wimax_id_table_rm(wimax_dev);
512 __wimax_state_change(wimax_dev, WIMAX_ST_DOWN);
513 mutex_unlock(&wimax_dev->mutex);
514 wimax_rfkill_rm(wimax_dev);
515 d_fnend(3, NULL, "(wimax_dev %p) = void\n", wimax_dev);
516}
517EXPORT_SYMBOL_GPL(wimax_dev_rm);
518
519struct genl_family wimax_gnl_family = {
520 .id = GENL_ID_GENERATE,
521 .name = "WiMAX",
522 .version = WIMAX_GNL_VERSION,
523 .hdrsize = 0,
524 .maxattr = WIMAX_GNL_ATTR_MAX,
525};
526
527struct genl_multicast_group wimax_gnl_mcg = {
528 .name = "msg",
529};
530
531
532
533/* Shutdown the wimax stack */
534static
535int __init wimax_subsys_init(void)
536{
537 int result, cnt;
538
539 d_fnstart(4, NULL, "()\n");
540 snprintf(wimax_gnl_family.name, sizeof(wimax_gnl_family.name),
541 "WiMAX");
542 result = genl_register_family(&wimax_gnl_family);
543 if (unlikely(result < 0)) {
544 printk(KERN_ERR "cannot register generic netlink family: %d\n",
545 result);
546 goto error_register_family;
547 }
548
549 for (cnt = 0; cnt < ARRAY_SIZE(wimax_gnl_ops); cnt++) {
550 result = genl_register_ops(&wimax_gnl_family,
551 wimax_gnl_ops[cnt]);
552 d_printf(4, NULL, "registering generic netlink op code "
553 "%u: %d\n", wimax_gnl_ops[cnt]->cmd, result);
554 if (unlikely(result < 0)) {
555 printk(KERN_ERR "cannot register generic netlink op "
556 "code %u: %d\n",
557 wimax_gnl_ops[cnt]->cmd, result);
558 goto error_register_ops;
559 }
560 }
561
562 result = genl_register_mc_group(&wimax_gnl_family, &wimax_gnl_mcg);
563 if (result < 0)
564 goto error_mc_group;
565 d_fnend(4, NULL, "() = 0\n");
566 return 0;
567
568error_mc_group:
569error_register_ops:
570 for (cnt--; cnt >= 0; cnt--)
571 genl_unregister_ops(&wimax_gnl_family,
572 wimax_gnl_ops[cnt]);
573 genl_unregister_family(&wimax_gnl_family);
574error_register_family:
575 d_fnend(4, NULL, "() = %d\n", result);
576 return result;
577
578}
579module_init(wimax_subsys_init);
580
581
582/* Shutdown the wimax stack */
583static
584void __exit wimax_subsys_exit(void)
585{
586 int cnt;
587 wimax_id_table_release();
588 genl_unregister_mc_group(&wimax_gnl_family, &wimax_gnl_mcg);
589 for (cnt = ARRAY_SIZE(wimax_gnl_ops) - 1; cnt >= 0; cnt--)
590 genl_unregister_ops(&wimax_gnl_family,
591 wimax_gnl_ops[cnt]);
592 genl_unregister_family(&wimax_gnl_family);
593}
594module_exit(wimax_subsys_exit);
595
596MODULE_AUTHOR("Intel Corporation <linux-wimax@intel.com>");
597MODULE_DESCRIPTION("Linux WiMAX stack");
598MODULE_LICENSE("GPL");
599
diff --git a/net/wimax/wimax-internal.h b/net/wimax/wimax-internal.h
new file mode 100644
index 000000000000..1e743d214856
--- /dev/null
+++ b/net/wimax/wimax-internal.h
@@ -0,0 +1,91 @@
1/*
2 * Linux WiMAX
3 * Internal API for kernel space WiMAX stack
4 *
5 *
6 * Copyright (C) 2007 Intel Corporation <linux-wimax@intel.com>
7 * Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License version
11 * 2 as published by the Free Software Foundation.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21 * 02110-1301, USA.
22 *
23 *
24 * This header file is for declarations and definitions internal to
25 * the WiMAX stack. For public APIs and documentation, see
26 * include/net/wimax.h and include/linux/wimax.h.
27 */
28
29#ifndef __WIMAX_INTERNAL_H__
30#define __WIMAX_INTERNAL_H__
31#ifdef __KERNEL__
32
33#include <linux/device.h>
34#include <net/wimax.h>
35
36
37/*
38 * Decide if a (locked) device is ready for use
39 *
40 * Before using the device structure, it must be locked
41 * (wimax_dev->mutex). As well, most operations need to call this
42 * function to check if the state is the right one.
43 *
44 * An error value will be returned if the state is not the right
45 * one. In that case, the caller should not attempt to use the device
46 * and just unlock it.
47 */
48static inline __must_check
49int wimax_dev_is_ready(struct wimax_dev *wimax_dev)
50{
51 if (wimax_dev->state == __WIMAX_ST_NULL)
52 return -EINVAL; /* Device is not even registered! */
53 if (wimax_dev->state == WIMAX_ST_DOWN)
54 return -ENOMEDIUM;
55 if (wimax_dev->state == __WIMAX_ST_QUIESCING)
56 return -ESHUTDOWN;
57 return 0;
58}
59
60
61static inline
62void __wimax_state_set(struct wimax_dev *wimax_dev, enum wimax_st state)
63{
64 wimax_dev->state = state;
65}
66extern void __wimax_state_change(struct wimax_dev *, enum wimax_st);
67
68#ifdef CONFIG_DEBUG_FS
69extern int wimax_debugfs_add(struct wimax_dev *);
70extern void wimax_debugfs_rm(struct wimax_dev *);
71#else
72static inline int wimax_debugfs_add(struct wimax_dev *wimax_dev)
73{
74 return 0;
75}
76static inline void wimax_debugfs_rm(struct wimax_dev *wimax_dev) {}
77#endif
78
79extern void wimax_id_table_add(struct wimax_dev *);
80extern struct wimax_dev *wimax_dev_get_by_genl_info(struct genl_info *, int);
81extern void wimax_id_table_rm(struct wimax_dev *);
82extern void wimax_id_table_release(void);
83
84extern int wimax_rfkill_add(struct wimax_dev *);
85extern void wimax_rfkill_rm(struct wimax_dev *);
86
87extern struct genl_family wimax_gnl_family;
88extern struct genl_multicast_group wimax_gnl_mcg;
89
90#endif /* #ifdef __KERNEL__ */
91#endif /* #ifndef __WIMAX_INTERNAL_H__ */
diff --git a/scripts/.gitignore b/scripts/.gitignore
index b939fbd01195..09e2406f3b78 100644
--- a/scripts/.gitignore
+++ b/scripts/.gitignore
@@ -1,6 +1,7 @@
1# 1#
2# Generated files 2# Generated files
3# 3#
4ihex2fw
4conmakehash 5conmakehash
5kallsyms 6kallsyms
6pnmtologo 7pnmtologo
diff --git a/scripts/Makefile b/scripts/Makefile
index aafdf064feef..035182e16afb 100644
--- a/scripts/Makefile
+++ b/scripts/Makefile
@@ -2,11 +2,12 @@
2# scripts contains sources for various helper programs used throughout 2# scripts contains sources for various helper programs used throughout
3# the kernel for the build process. 3# the kernel for the build process.
4# --------------------------------------------------------------------------- 4# ---------------------------------------------------------------------------
5# ihex2fw: Parser/loader for IHEX formatted data
5# kallsyms: Find all symbols in vmlinux 6# kallsyms: Find all symbols in vmlinux
6# pnmttologo: Convert pnm files to logo files 7# pnmttologo: Convert pnm files to logo files
7# conmakehash: Create chartable
8# conmakehash: Create arrays for initializing the kernel console tables 8# conmakehash: Create arrays for initializing the kernel console tables
9 9
10hostprogs-y := ihex2fw
10hostprogs-$(CONFIG_KALLSYMS) += kallsyms 11hostprogs-$(CONFIG_KALLSYMS) += kallsyms
11hostprogs-$(CONFIG_LOGO) += pnmtologo 12hostprogs-$(CONFIG_LOGO) += pnmtologo
12hostprogs-$(CONFIG_VT) += conmakehash 13hostprogs-$(CONFIG_VT) += conmakehash
diff --git a/scripts/bootgraph.pl b/scripts/bootgraph.pl
index f0af9aa9b243..0a498e33b30b 100644
--- a/scripts/bootgraph.pl
+++ b/scripts/bootgraph.pl
@@ -88,7 +88,7 @@ END
88} 88}
89 89
90print "<?xml version=\"1.0\" standalone=\"no\"?> \n"; 90print "<?xml version=\"1.0\" standalone=\"no\"?> \n";
91print "<svg width=\"1000\" height=\"100%\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\">\n"; 91print "<svg width=\"2000\" height=\"100%\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\">\n";
92 92
93my @styles; 93my @styles;
94 94
@@ -105,8 +105,9 @@ $styles[9] = "fill:rgb(255,255,128);fill-opacity:0.5;stroke-width:1;stroke:rgb(0
105$styles[10] = "fill:rgb(255,128,255);fill-opacity:0.5;stroke-width:1;stroke:rgb(0,0,0)"; 105$styles[10] = "fill:rgb(255,128,255);fill-opacity:0.5;stroke-width:1;stroke:rgb(0,0,0)";
106$styles[11] = "fill:rgb(128,255,255);fill-opacity:0.5;stroke-width:1;stroke:rgb(0,0,0)"; 106$styles[11] = "fill:rgb(128,255,255);fill-opacity:0.5;stroke-width:1;stroke:rgb(0,0,0)";
107 107
108my $mult = 950.0 / ($maxtime - $firsttime); 108my $mult = 1950.0 / ($maxtime - $firsttime);
109my $threshold = ($maxtime - $firsttime) / 60.0; 109my $threshold2 = ($maxtime - $firsttime) / 120.0;
110my $threshold = $threshold2/10;
110my $stylecounter = 0; 111my $stylecounter = 0;
111my %rows; 112my %rows;
112my $rowscount = 1; 113my $rowscount = 1;
@@ -116,7 +117,7 @@ foreach my $key (@initcalls) {
116 my $duration = $end{$key} - $start{$key}; 117 my $duration = $end{$key} - $start{$key};
117 118
118 if ($duration >= $threshold) { 119 if ($duration >= $threshold) {
119 my ($s, $s2, $e, $w, $y, $y2, $style); 120 my ($s, $s2, $s3, $e, $w, $y, $y2, $style);
120 my $pid = $pids{$key}; 121 my $pid = $pids{$key};
121 122
122 if (!defined($rows{$pid})) { 123 if (!defined($rows{$pid})) {
@@ -125,6 +126,7 @@ foreach my $key (@initcalls) {
125 } 126 }
126 $s = ($start{$key} - $firsttime) * $mult; 127 $s = ($start{$key} - $firsttime) * $mult;
127 $s2 = $s + 6; 128 $s2 = $s + 6;
129 $s3 = $s + 1;
128 $e = ($end{$key} - $firsttime) * $mult; 130 $e = ($end{$key} - $firsttime) * $mult;
129 $w = $e - $s; 131 $w = $e - $s;
130 132
@@ -138,7 +140,11 @@ foreach my $key (@initcalls) {
138 }; 140 };
139 141
140 print "<rect x=\"$s\" width=\"$w\" y=\"$y\" height=\"145\" style=\"$style\"/>\n"; 142 print "<rect x=\"$s\" width=\"$w\" y=\"$y\" height=\"145\" style=\"$style\"/>\n";
141 print "<text transform=\"translate($s2,$y2) rotate(90)\">$key</text>\n"; 143 if ($duration >= $threshold2) {
144 print "<text transform=\"translate($s2,$y2) rotate(90)\">$key</text>\n";
145 } else {
146 print "<text transform=\"translate($s3,$y2) rotate(90)\" font-size=\"3pt\">$key</text>\n";
147 }
142 } 148 }
143} 149}
144 150
diff --git a/scripts/config b/scripts/config
new file mode 100755
index 000000000000..68b9761cdc38
--- /dev/null
+++ b/scripts/config
@@ -0,0 +1,150 @@
1#!/bin/bash
2# Manipulate options in a .config file from the command line
3
4usage() {
5 cat >&2 <<EOL
6Manipulate options in a .config file from the command line.
7Usage:
8config options command ...
9commands:
10 --enable|-e option Enable option
11 --disable|-d option Disable option
12 --module|-m option Turn option into a module
13 --state|-s option Print state of option (n,y,m,undef)
14
15 --enable-after|-E beforeopt option
16 Enable option directly after other option
17 --disable-after|-D beforeopt option
18 Disable option directly after other option
19 --module-after|-M beforeopt option
20 Turn option into module directly after other option
21
22 commands can be repeated multiple times
23
24options:
25 --file .config file to change (default .config)
26
27config doesn't check the validity of the .config file. This is done at next
28 make time.
29The options need to be already in the file before they can be changed,
30but sometimes you can cheat with the --*-after options.
31EOL
32 exit 1
33}
34
35checkarg() {
36 ARG="$1"
37 if [ "$ARG" = "" ] ; then
38 usage
39 fi
40 case "$ARG" in
41 CONFIG_*)
42 ARG="${ARG/CONFIG_/}"
43 ;;
44 esac
45 ARG="`echo $ARG | tr a-z A-Z`"
46}
47
48replace() {
49 sed -i -e "$@" $FN
50}
51
52if [ "$1" = "--file" ]; then
53 FN="$2"
54 if [ "$FN" = "" ] ; then
55 usage
56 fi
57 shift
58 shift
59else
60 FN=.config
61fi
62
63while [ "$1" != "" ] ; do
64 CMD="$1"
65 shift
66 case "$CMD" in
67 --enable|-e)
68 checkarg "$1"
69 replace "s/# CONFIG_$ARG is not set/CONFIG_$ARG=y/"
70 shift
71 ;;
72
73 --disable|-d)
74 checkarg "$1"
75 replace "s/CONFIG_$ARG=[my]/# CONFIG_$ARG is not set/"
76 shift
77 ;;
78
79 --module|-m)
80 checkarg "$1"
81 replace "s/CONFIG_$ARG=y/CONFIG_$ARG=m/" \
82 -e "s/# CONFIG_$ARG is not set/CONFIG_$ARG=m/"
83 shift
84 ;;
85
86 --state|-s)
87 checkarg "$1"
88 if grep -q "# CONFIG_$ARG is not set" $FN ; then
89 echo n
90 else
91 V="$(grep "^CONFIG_$ARG=" $FN)"
92 if [ $? != 0 ] ; then
93 echo undef
94 else
95 V="${V/CONFIG_$ARG=/}"
96 V="${V/\"/}"
97 echo "$V"
98 fi
99 fi
100 shift
101 ;;
102
103 --enable-after|-E)
104 checkarg "$1"
105 A=$ARG
106 checkarg "$2"
107 B=$ARG
108 replace "/CONFIG_$A=[my]/aCONFIG_$B=y" \
109 -e "/# CONFIG_$ARG is not set/a/CONFIG_$ARG=y" \
110 -e "s/# CONFIG_$ARG is not set/CONFIG_$ARG=y/"
111 shift
112 shift
113 ;;
114
115 --disable-after|-D)
116 checkarg "$1"
117 A=$ARG
118 checkarg "$2"
119 B=$ARG
120 replace "/CONFIG_$A=[my]/a# CONFIG_$B is not set" \
121 -e "/# CONFIG_$ARG is not set/a/# CONFIG_$ARG is not set" \
122 -e "s/CONFIG_$ARG=[my]/# CONFIG_$ARG is not set/"
123 shift
124 shift
125 ;;
126
127 --module-after|-M)
128 checkarg "$1"
129 A=$ARG
130 checkarg "$2"
131 B=$ARG
132 replace "/CONFIG_$A=[my]/aCONFIG_$B=m" \
133 -e "/# CONFIG_$ARG is not set/a/CONFIG_$ARG=m" \
134 -e "s/CONFIG_$ARG=y/CONFIG_$ARG=m/" \
135 -e "s/# CONFIG_$ARG is not set/CONFIG_$ARG=m/"
136 shift
137 shift
138 ;;
139
140 # undocumented because it ignores --file (fixme)
141 --refresh)
142 yes "" | make oldconfig
143 ;;
144
145 *)
146 usage
147 ;;
148 esac
149done
150
diff --git a/firmware/ihex2fw.c b/scripts/ihex2fw.c
index 8f7fdaa9e010..8f7fdaa9e010 100644
--- a/firmware/ihex2fw.c
+++ b/scripts/ihex2fw.c
diff --git a/scripts/tags.sh b/scripts/tags.sh
index 9e3451d2c3a1..fdbe78bb5e2b 100755
--- a/scripts/tags.sh
+++ b/scripts/tags.sh
@@ -24,6 +24,11 @@ else
24 tree=${srctree}/ 24 tree=${srctree}/
25fi 25fi
26 26
27# Detect if ALLSOURCE_ARCHS is set. If not, we assume SRCARCH
28if [ "${ALLSOURCE_ARCHS}" = "" ]; then
29 ALLSOURCE_ARCHS=${SRCARCH}
30fi
31
27# find sources in arch/$ARCH 32# find sources in arch/$ARCH
28find_arch_sources() 33find_arch_sources()
29{ 34{
@@ -54,26 +59,29 @@ find_other_sources()
54find_sources() 59find_sources()
55{ 60{
56 find_arch_sources $1 "$2" 61 find_arch_sources $1 "$2"
57 find_include_sources "$2"
58 find_other_sources "$2"
59} 62}
60 63
61all_sources() 64all_sources()
62{ 65{
63 find_sources $SRCARCH '*.[chS]' 66 for arch in $ALLSOURCE_ARCHS
67 do
68 find_sources $arch '*.[chS]'
69 done
64 if [ ! -z "$archinclude" ]; then 70 if [ ! -z "$archinclude" ]; then
65 find_arch_include_sources $archinclude '*.[chS]' 71 find_arch_include_sources $archinclude '*.[chS]'
66 fi 72 fi
73 find_include_sources '*.[chS]'
74 find_other_sources '*.[chS]'
67} 75}
68 76
69all_kconfigs() 77all_kconfigs()
70{ 78{
71 find_sources $SRCARCH 'Kconfig*' 79 find_sources $ALLSOURCE_ARCHS 'Kconfig*'
72} 80}
73 81
74all_defconfigs() 82all_defconfigs()
75{ 83{
76 find_sources $SRCARCH "defconfig" 84 find_sources $ALLSOURCE_ARCHS "defconfig"
77} 85}
78 86
79docscope() 87docscope()
diff --git a/sound/oss/aedsp16.c b/sound/oss/aedsp16.c
index a0274f3dac08..3ee9900ffd7b 100644
--- a/sound/oss/aedsp16.c
+++ b/sound/oss/aedsp16.c
@@ -157,7 +157,7 @@
157 157
158 Started Fri Mar 17 16:13:18 MET 1995 158 Started Fri Mar 17 16:13:18 MET 1995
159 159
160 v0.1 (ALPHA, was an user-level program called AudioExcelDSP16.c) 160 v0.1 (ALPHA, was a user-level program called AudioExcelDSP16.c)
161 - Initial code. 161 - Initial code.
162 v0.2 (ALPHA) 162 v0.2 (ALPHA)
163 - Cleanups. 163 - Cleanups.
diff --git a/sound/usb/usx2y/usbusx2y.c b/sound/usb/usx2y/usbusx2y.c
index ca26c532e77e..11639bd72a51 100644
--- a/sound/usb/usx2y/usbusx2y.c
+++ b/sound/usb/usx2y/usbusx2y.c
@@ -238,7 +238,7 @@ static void i_usX2Y_In04Int(struct urb *urb)
238 send = 0; 238 send = 0;
239 for (j = 0; j < URBS_AsyncSeq && !err; ++j) 239 for (j = 0; j < URBS_AsyncSeq && !err; ++j)
240 if (0 == usX2Y->AS04.urb[j]->status) { 240 if (0 == usX2Y->AS04.urb[j]->status) {
241 struct us428_p4out *p4out = us428ctls->p4out + send; // FIXME if more then 1 p4out is new, 1 gets lost. 241 struct us428_p4out *p4out = us428ctls->p4out + send; // FIXME if more than 1 p4out is new, 1 gets lost.
242 usb_fill_bulk_urb(usX2Y->AS04.urb[j], usX2Y->chip.dev, 242 usb_fill_bulk_urb(usX2Y->AS04.urb[j], usX2Y->chip.dev,
243 usb_sndbulkpipe(usX2Y->chip.dev, 0x04), &p4out->val.vol, 243 usb_sndbulkpipe(usX2Y->chip.dev, 0x04), &p4out->val.vol,
244 p4out->type == eLT_Light ? sizeof(struct us428_lights) : 5, 244 p4out->type == eLT_Light ? sizeof(struct us428_lights) : 5,