aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore12
-rw-r--r--Documentation/DocBook/kgdb.tmpl20
-rw-r--r--Documentation/feature-removal-schedule.txt9
-rw-r--r--Documentation/hwmon/sysfs-interface33
-rw-r--r--Documentation/i2c/writing-clients18
-rw-r--r--Documentation/kernel-parameters.txt5
-rw-r--r--Documentation/networking/ip-sysctl.txt12
-rw-r--r--Documentation/networking/s2io.txt6
-rw-r--r--Documentation/video4linux/CARDLIST.au08282
-rw-r--r--MAINTAINERS14
-rw-r--r--Makefile2
-rw-r--r--arch/alpha/Makefile1
-rw-r--r--arch/alpha/kernel/core_t2.c2
-rw-r--r--arch/alpha/kernel/pci.c17
-rw-r--r--arch/alpha/kernel/traps.c3
-rw-r--r--arch/arm/Kconfig80
-rw-r--r--arch/arm/Makefile7
-rw-r--r--arch/arm/boot/compressed/head.S4
-rw-r--r--arch/arm/common/Makefile1
-rw-r--r--arch/arm/common/dmabounce.c3
-rw-r--r--arch/arm/common/rtctime.c434
-rw-r--r--arch/arm/configs/at91cap9adk_defconfig82
-rw-r--r--arch/arm/configs/at91rm9200dk_defconfig1
-rw-r--r--arch/arm/configs/at91rm9200ek_defconfig1
-rw-r--r--arch/arm/configs/at91sam9260ek_defconfig1
-rw-r--r--arch/arm/configs/at91sam9261ek_defconfig1
-rw-r--r--arch/arm/configs/at91sam9263ek_defconfig1
-rw-r--r--arch/arm/configs/at91sam9g20ek_defconfig1168
-rw-r--r--arch/arm/configs/at91sam9rlek_defconfig1
-rw-r--r--arch/arm/configs/ateb9200_defconfig1
-rw-r--r--arch/arm/configs/cm_x270_defconfig1
-rw-r--r--arch/arm/configs/collie_defconfig1
-rw-r--r--arch/arm/configs/corgi_defconfig1
-rw-r--r--arch/arm/configs/ecbat91_defconfig1
-rw-r--r--arch/arm/configs/em_x270_defconfig1
-rw-r--r--arch/arm/configs/ep93xx_defconfig1
-rw-r--r--arch/arm/configs/eseries_pxa_defconfig1
-rw-r--r--arch/arm/configs/iop13xx_defconfig1
-rw-r--r--arch/arm/configs/iop32x_defconfig1
-rw-r--r--arch/arm/configs/iop33x_defconfig1
-rw-r--r--arch/arm/configs/ixp2000_defconfig1
-rw-r--r--arch/arm/configs/ixp23xx_defconfig1
-rw-r--r--arch/arm/configs/ixp4xx_defconfig9
-rw-r--r--arch/arm/configs/kafa_defconfig1
-rw-r--r--arch/arm/configs/kb9202_defconfig1
-rw-r--r--arch/arm/configs/kirkwood_defconfig1426
-rw-r--r--arch/arm/configs/ks8695_defconfig1
-rw-r--r--arch/arm/configs/loki_defconfig1147
-rw-r--r--arch/arm/configs/lpd270_defconfig1
-rw-r--r--arch/arm/configs/lpd7a404_defconfig1
-rw-r--r--arch/arm/configs/mv78xx0_defconfig1445
-rw-r--r--arch/arm/configs/netx_defconfig1
-rw-r--r--arch/arm/configs/onearm_defconfig1
-rw-r--r--arch/arm/configs/orion5x_defconfig319
-rw-r--r--arch/arm/configs/picotux200_defconfig1
-rw-r--r--arch/arm/configs/pnx4008_defconfig1
-rw-r--r--arch/arm/configs/qil-a9260_defconfig1256
-rw-r--r--arch/arm/configs/realview-smp_defconfig1
-rw-r--r--arch/arm/configs/realview_defconfig1
-rw-r--r--arch/arm/configs/rpc_defconfig1
-rw-r--r--arch/arm/configs/s3c2410_defconfig1043
-rw-r--r--arch/arm/configs/sam9_l9260_defconfig1
-rw-r--r--arch/arm/configs/spitz_defconfig1
-rw-r--r--arch/arm/configs/tct_hammer_defconfig1
-rw-r--r--arch/arm/configs/trizeps4_defconfig1
-rw-r--r--arch/arm/configs/usb-a9260_defconfig1142
-rw-r--r--arch/arm/configs/usb-a9263_defconfig1134
-rw-r--r--arch/arm/configs/versatile_defconfig1
-rw-r--r--arch/arm/kernel/atags.c83
-rw-r--r--arch/arm/kernel/process.c4
-rw-r--r--arch/arm/kernel/stacktrace.c34
-rw-r--r--arch/arm/kernel/time.c120
-rw-r--r--arch/arm/lib/copy_template.S12
-rw-r--r--arch/arm/lib/memmove.S14
-rw-r--r--arch/arm/lib/memset.S46
-rw-r--r--arch/arm/lib/memzero.S44
-rw-r--r--arch/arm/mach-at91/Kconfig56
-rw-r--r--arch/arm/mach-at91/Makefile8
-rw-r--r--arch/arm/mach-at91/at91cap9_devices.c99
-rw-r--r--arch/arm/mach-at91/at91sam9260.c16
-rw-r--r--arch/arm/mach-at91/at91sam9260_devices.c44
-rw-r--r--arch/arm/mach-at91/at91sam9261_devices.c12
-rw-r--r--arch/arm/mach-at91/at91sam9263_devices.c4
-rw-r--r--arch/arm/mach-at91/at91sam9rl_devices.c107
-rw-r--r--arch/arm/mach-at91/board-cap9adk.c9
-rw-r--r--arch/arm/mach-at91/board-carmeva.c23
-rw-r--r--arch/arm/mach-at91/board-csb637.c4
-rw-r--r--arch/arm/mach-at91/board-dk.c25
-rw-r--r--arch/arm/mach-at91/board-eb9200.c26
-rw-r--r--arch/arm/mach-at91/board-ek.c25
-rw-r--r--arch/arm/mach-at91/board-kb9202.c29
-rw-r--r--arch/arm/mach-at91/board-qil-a9260.c255
-rw-r--r--arch/arm/mach-at91/board-sam9g20ek.c218
-rw-r--r--arch/arm/mach-at91/board-sam9rlek.c10
-rw-r--r--arch/arm/mach-at91/board-usb-a9260.c215
-rw-r--r--arch/arm/mach-at91/board-usb-a9263.c230
-rwxr-xr-xarch/arm/mach-at91/board-yl-9200.c853
-rw-r--r--arch/arm/mach-at91/clock.c64
-rw-r--r--arch/arm/mach-at91/pm.c2
-rw-r--r--arch/arm/mach-ep93xx/clock.c5
-rw-r--r--arch/arm/mach-footbridge/Makefile2
-rw-r--r--arch/arm/mach-footbridge/co285.c39
-rw-r--r--arch/arm/mach-footbridge/common.c21
-rw-r--r--arch/arm/mach-footbridge/ebsa285-leds.c2
-rw-r--r--arch/arm/mach-footbridge/time.c3
-rw-r--r--arch/arm/mach-imx/dma.c13
-rw-r--r--arch/arm/mach-integrator/Makefile2
-rw-r--r--arch/arm/mach-integrator/time.c223
-rw-r--r--arch/arm/mach-ixp4xx/Kconfig9
-rw-r--r--arch/arm/mach-ixp4xx/Makefile2
-rw-r--r--arch/arm/mach-ixp4xx/fsg-pci.c71
-rw-r--r--arch/arm/mach-ixp4xx/fsg-setup.c276
-rw-r--r--arch/arm/mach-kirkwood/Kconfig25
-rw-r--r--arch/arm/mach-kirkwood/Makefile5
-rw-r--r--arch/arm/mach-kirkwood/Makefile.boot3
-rw-r--r--arch/arm/mach-kirkwood/addr-map.c139
-rw-r--r--arch/arm/mach-kirkwood/common.c331
-rw-r--r--arch/arm/mach-kirkwood/common.h42
-rw-r--r--arch/arm/mach-kirkwood/db88f6281-bp-setup.c68
-rw-r--r--arch/arm/mach-kirkwood/irq.c22
-rw-r--r--arch/arm/mach-kirkwood/pcie.c180
-rw-r--r--arch/arm/mach-kirkwood/rd88f6192-nas-setup.c69
-rw-r--r--arch/arm/mach-kirkwood/rd88f6281-setup.c113
-rw-r--r--arch/arm/mach-loki/Kconfig13
-rw-r--r--arch/arm/mach-loki/Makefile3
-rw-r--r--arch/arm/mach-loki/Makefile.boot3
-rw-r--r--arch/arm/mach-loki/addr-map.c121
-rw-r--r--arch/arm/mach-loki/common.c305
-rw-r--r--arch/arm/mach-loki/common.h36
-rw-r--r--arch/arm/mach-loki/irq.c21
-rw-r--r--arch/arm/mach-loki/lb88rc8480-setup.c100
-rw-r--r--arch/arm/mach-mv78xx0/Kconfig13
-rw-r--r--arch/arm/mach-mv78xx0/Makefile2
-rw-r--r--arch/arm/mach-mv78xx0/Makefile.boot3
-rw-r--r--arch/arm/mach-mv78xx0/addr-map.c156
-rw-r--r--arch/arm/mach-mv78xx0/common.c754
-rw-r--r--arch/arm/mach-mv78xx0/common.h49
-rw-r--r--arch/arm/mach-mv78xx0/db78x00-bp-setup.c94
-rw-r--r--arch/arm/mach-mv78xx0/irq.c22
-rw-r--r--arch/arm/mach-mv78xx0/pcie.c312
-rw-r--r--arch/arm/mach-omap1/Makefile4
-rw-r--r--arch/arm/mach-omap1/board-nokia770.c17
-rw-r--r--arch/arm/mach-omap1/board-osk.c18
-rw-r--r--arch/arm/mach-omap1/fpga.c10
-rw-r--r--arch/arm/mach-omap1/mcbsp.c280
-rw-r--r--arch/arm/mach-omap1/pm.c7
-rw-r--r--arch/arm/mach-omap1/sram.S (renamed from arch/arm/plat-omap/sram-fn.S)6
-rw-r--r--arch/arm/mach-omap2/Makefile8
-rw-r--r--arch/arm/mach-omap2/clock.c201
-rw-r--r--arch/arm/mach-omap2/clock.h6
-rw-r--r--arch/arm/mach-omap2/clock24xx.c12
-rw-r--r--arch/arm/mach-omap2/clock24xx.h47
-rw-r--r--arch/arm/mach-omap2/clock34xx.c299
-rw-r--r--arch/arm/mach-omap2/clock34xx.h147
-rw-r--r--arch/arm/mach-omap2/cm-regbits-34xx.h18
-rw-r--r--arch/arm/mach-omap2/cm.h15
-rw-r--r--arch/arm/mach-omap2/control.c24
-rw-r--r--arch/arm/mach-omap2/gpmc.c2
-rw-r--r--arch/arm/mach-omap2/id.c195
-rw-r--r--arch/arm/mach-omap2/mcbsp.c208
-rw-r--r--arch/arm/mach-omap2/memory.c11
-rw-r--r--arch/arm/mach-omap2/mux.c2
-rw-r--r--arch/arm/mach-omap2/pm.c7
-rw-r--r--arch/arm/mach-omap2/prcm-common.h1
-rw-r--r--arch/arm/mach-omap2/prcm.c98
-rw-r--r--arch/arm/mach-omap2/prm.h30
-rw-r--r--arch/arm/mach-omap2/sdrc.h10
-rw-r--r--arch/arm/mach-omap2/sram242x.S (renamed from arch/arm/mach-omap2/sram-fn.S)105
-rw-r--r--arch/arm/mach-omap2/sram243x.S321
-rw-r--r--arch/arm/mach-omap2/timer-gp.c9
-rw-r--r--arch/arm/mach-orion5x/Kconfig48
-rw-r--r--arch/arm/mach-orion5x/Makefile12
-rw-r--r--arch/arm/mach-orion5x/addr-map.c45
-rw-r--r--arch/arm/mach-orion5x/common.c307
-rw-r--r--arch/arm/mach-orion5x/common.h38
-rw-r--r--arch/arm/mach-orion5x/db88f5281-setup.c82
-rw-r--r--arch/arm/mach-orion5x/dns323-setup.c125
-rw-r--r--arch/arm/mach-orion5x/gpio.c47
-rw-r--r--arch/arm/mach-orion5x/irq.c18
-rw-r--r--arch/arm/mach-orion5x/kurobox_pro-setup.c224
-rw-r--r--arch/arm/mach-orion5x/mpp.c163
-rw-r--r--arch/arm/mach-orion5x/mpp.h74
-rw-r--r--arch/arm/mach-orion5x/mss2-setup.c270
-rw-r--r--arch/arm/mach-orion5x/mv2120-setup.c239
-rw-r--r--arch/arm/mach-orion5x/pci.c86
-rw-r--r--arch/arm/mach-orion5x/rd88f5181l-fxo-setup.c161
-rw-r--r--arch/arm/mach-orion5x/rd88f5181l-ge-setup.c172
-rw-r--r--arch/arm/mach-orion5x/rd88f5182-setup.c79
-rw-r--r--arch/arm/mach-orion5x/ts209-setup.c299
-rw-r--r--arch/arm/mach-orion5x/ts409-setup.c273
-rw-r--r--arch/arm/mach-orion5x/ts78xx-setup.c277
-rw-r--r--arch/arm/mach-orion5x/tsx09-common.c133
-rw-r--r--arch/arm/mach-orion5x/tsx09-common.h20
-rw-r--r--arch/arm/mach-orion5x/wnr854t-setup.c164
-rw-r--r--arch/arm/mach-orion5x/wrt350n-v2-setup.c173
-rw-r--r--arch/arm/mach-realview/platsmp.c2
-rw-r--r--arch/arm/mach-s3c2410/Kconfig21
-rw-r--r--arch/arm/mach-s3c2410/Makefile8
-rw-r--r--arch/arm/mach-s3c2410/bast-ide.c112
-rw-r--r--arch/arm/mach-s3c2410/mach-bast.c59
-rw-r--r--arch/arm/mach-s3c2410/mach-n30.c474
-rw-r--r--arch/arm/mach-s3c2410/mach-vr1000.c72
-rw-r--r--arch/arm/mach-s3c2410/nor-simtec.c86
-rw-r--r--arch/arm/mach-s3c2410/nor-simtec.h14
-rw-r--r--arch/arm/mach-s3c2412/Kconfig10
-rw-r--r--arch/arm/mach-s3c2412/Makefile1
-rw-r--r--arch/arm/mach-s3c2412/clock.c13
-rw-r--r--arch/arm/mach-s3c2412/mach-jive.c687
-rw-r--r--arch/arm/mach-s3c2440/Kconfig6
-rw-r--r--arch/arm/mach-s3c2440/Makefile1
-rw-r--r--arch/arm/mach-s3c2440/mach-anubis.c41
-rw-r--r--arch/arm/mach-s3c2440/mach-at2440evb.c198
-rw-r--r--arch/arm/mach-s3c2440/mach-osiris.c15
-rw-r--r--arch/arm/mach-s3c2443/clock.c91
-rw-r--r--arch/arm/mm/Kconfig21
-rw-r--r--arch/arm/mm/Makefile2
-rw-r--r--arch/arm/mm/cache-feroceon-l2.c318
-rw-r--r--arch/arm/mm/fault-armv.c4
-rw-r--r--arch/arm/mm/flush.c2
-rw-r--r--arch/arm/mm/proc-feroceon.S242
-rw-r--r--arch/arm/plat-iop/gpio.c43
-rw-r--r--arch/arm/plat-omap/Makefile2
-rw-r--r--arch/arm/plat-omap/clock.c128
-rw-r--r--arch/arm/plat-omap/common.c59
-rw-r--r--arch/arm/plat-omap/devices.c48
-rw-r--r--arch/arm/plat-omap/dma.c766
-rw-r--r--arch/arm/plat-omap/dmtimer.c212
-rw-r--r--arch/arm/plat-omap/mcbsp.c767
-rw-r--r--arch/arm/plat-omap/sram.c211
-rw-r--r--arch/arm/plat-omap/usb.c131
-rw-r--r--arch/arm/plat-orion/irq.c3
-rw-r--r--arch/arm/plat-orion/pcie.c6
-rw-r--r--arch/arm/plat-orion/time.c6
-rw-r--r--arch/arm/plat-s3c24xx/Kconfig8
-rw-r--r--arch/arm/plat-s3c24xx/Makefile3
-rw-r--r--arch/arm/plat-s3c24xx/devs.c100
-rw-r--r--arch/arm/plat-s3c24xx/gpiolib.c259
-rw-r--r--arch/arm/plat-s3c24xx/pwm-clock.c437
-rw-r--r--arch/arm/plat-s3c24xx/pwm.c402
-rw-r--r--arch/arm/tools/mach-types126
-rw-r--r--arch/blackfin/kernel/cplb-nompu/cplbinit.c6
-rw-r--r--arch/blackfin/kernel/irqchip.c5
-rw-r--r--arch/ia64/kernel/iosapic.c2
-rw-r--r--arch/ia64/kernel/setup.c6
-rw-r--r--arch/ia64/kernel/time.c1
-rw-r--r--arch/ia64/sn/kernel/sn2/sn2_smp.c2
-rw-r--r--arch/powerpc/boot/Makefile3
-rw-r--r--arch/powerpc/kernel/legacy_serial.c5
-rw-r--r--arch/powerpc/platforms/52xx/lite5200_pm.c14
-rw-r--r--arch/sh/configs/landisk_defconfig1
-rw-r--r--arch/sh/configs/lboxre2_defconfig1
-rw-r--r--arch/sh/configs/se7705_defconfig1
-rw-r--r--arch/sh/configs/se7712_defconfig1
-rw-r--r--arch/sh/configs/se7750_defconfig1
-rw-r--r--arch/x86/Kconfig9
-rw-r--r--arch/x86/kernel/Makefile1
-rw-r--r--arch/x86/kernel/i387.c4
-rw-r--r--arch/x86/kernel/kvmclock.c89
-rw-r--r--arch/x86/kernel/pvclock.c141
-rw-r--r--arch/x86/kernel/smpboot.c1
-rw-r--r--arch/x86/kvm/i8254.c9
-rw-r--r--arch/x86/kvm/lapic.c1
-rw-r--r--arch/x86/kvm/mmu.c19
-rw-r--r--arch/x86/kvm/vmx.c19
-rw-r--r--arch/x86/kvm/x86.c91
-rw-r--r--arch/x86/mm/init_64.c8
-rw-r--r--arch/x86/xen/Kconfig3
-rw-r--r--arch/x86/xen/enlighten.c56
-rw-r--r--arch/x86/xen/mmu.c75
-rw-r--r--arch/x86/xen/mmu.h24
-rw-r--r--arch/x86/xen/time.c132
-rw-r--r--arch/x86/xen/xen-head.S6
-rw-r--r--block/as-iosched.c2
-rw-r--r--drivers/acorn/char/Makefile5
-rw-r--r--drivers/acorn/char/defkeymap-l7200.c386
-rw-r--r--drivers/acpi/bay.c3
-rw-r--r--drivers/acpi/dock.c3
-rw-r--r--drivers/acpi/glue.c3
-rw-r--r--drivers/char/drm/i915_drv.c1
-rw-r--r--drivers/char/drm/i915_irq.c4
-rw-r--r--drivers/char/tty_io.c2
-rw-r--r--drivers/char/tty_ioctl.c7
-rw-r--r--drivers/connector/connector.c40
-rw-r--r--drivers/firewire/fw-sbp2.c3
-rw-r--r--drivers/hwmon/abituguru3.c18
-rw-r--r--drivers/hwmon/adt7473.c3
-rw-r--r--drivers/hwmon/lm75.c20
-rw-r--r--drivers/hwmon/lm85.c25
-rw-r--r--drivers/i2c/busses/i2c-s3c2410.c28
-rw-r--r--drivers/i2c/chips/isp1301_omap.c163
-rw-r--r--drivers/ide/Kconfig7
-rw-r--r--drivers/ide/arm/Makefile1
-rw-r--r--drivers/ide/arm/bast-ide.c90
-rw-r--r--drivers/ide/ide-proc.c2
-rw-r--r--drivers/infiniband/hw/mthca/mthca_memfree.c6
-rw-r--r--drivers/input/ff-core.c18
-rw-r--r--drivers/lguest/x86/core.c15
-rw-r--r--drivers/md/dm-crypt.c1
-rw-r--r--drivers/md/md.c6
-rw-r--r--drivers/md/raid10.c2
-rw-r--r--drivers/md/raid5.c7
-rw-r--r--drivers/media/common/ir-keymaps.c38
-rw-r--r--drivers/media/common/tuners/tda18271-common.c10
-rw-r--r--drivers/media/common/tuners/tda18271-fe.c53
-rw-r--r--drivers/media/common/tuners/xc5000.c30
-rw-r--r--drivers/media/common/tuners/xc5000_priv.h1
-rw-r--r--drivers/media/dvb/dvb-usb/gl861.c27
-rw-r--r--drivers/media/dvb/dvb-usb/umt-010.c2
-rw-r--r--drivers/media/dvb/frontends/au8522.c29
-rw-r--r--drivers/media/dvb/frontends/stv0299.c15
-rw-r--r--drivers/media/dvb/frontends/tda10023.c20
-rw-r--r--drivers/media/dvb/frontends/tda1004x.c29
-rw-r--r--drivers/media/dvb/ttpci/Kconfig1
-rw-r--r--drivers/media/dvb/ttpci/av7110_hw.c5
-rw-r--r--drivers/media/video/Kconfig8
-rw-r--r--drivers/media/video/Makefile2
-rw-r--r--drivers/media/video/au0828/au0828-cards.c18
-rw-r--r--drivers/media/video/cx18/Kconfig4
-rw-r--r--drivers/media/video/cx18/cx18-av-core.c73
-rw-r--r--drivers/media/video/cx18/cx18-av-core.h16
-rw-r--r--drivers/media/video/cx18/cx18-cards.c84
-rw-r--r--drivers/media/video/cx18/cx18-cards.h50
-rw-r--r--drivers/media/video/cx18/cx18-dvb.c17
-rw-r--r--drivers/media/video/cx18/cx18-gpio.c26
-rw-r--r--drivers/media/video/cx18/cx18-gpio.h1
-rw-r--r--drivers/media/video/cx18/cx18-i2c.c2
-rw-r--r--drivers/media/video/cx25840/cx25840-core.c2
-rw-r--r--drivers/media/video/cx88/cx88-alsa.c6
-rw-r--r--drivers/media/video/em28xx/em28xx-audio.c18
-rw-r--r--drivers/media/video/em28xx/em28xx-cards.c4
-rw-r--r--drivers/media/video/em28xx/em28xx-dvb.c10
-rw-r--r--drivers/media/video/em28xx/em28xx-reg.h1
-rw-r--r--drivers/media/video/em28xx/em28xx-video.c24
-rw-r--r--drivers/media/video/pxa_camera.c4
-rw-r--r--drivers/media/video/saa7134/saa7134-alsa.c8
-rw-r--r--drivers/media/video/saa7134/saa7134-cards.c56
-rw-r--r--drivers/media/video/saa7134/saa7134-dvb.c43
-rw-r--r--drivers/media/video/saa7134/saa7134-empress.c37
-rw-r--r--drivers/media/video/saa7134/saa7134-input.c9
-rw-r--r--drivers/media/video/soc_camera.c16
-rw-r--r--drivers/media/video/uvc/Makefile3
-rw-r--r--drivers/media/video/uvc/uvc_ctrl.c1256
-rw-r--r--drivers/media/video/uvc/uvc_driver.c1955
-rw-r--r--drivers/media/video/uvc/uvc_isight.c134
-rw-r--r--drivers/media/video/uvc/uvc_queue.c477
-rw-r--r--drivers/media/video/uvc/uvc_status.c207
-rw-r--r--drivers/media/video/uvc/uvc_v4l2.c1105
-rw-r--r--drivers/media/video/uvc/uvc_video.c934
-rw-r--r--drivers/media/video/uvc/uvcvideo.h796
-rw-r--r--drivers/media/video/videodev.c245
-rw-r--r--drivers/media/video/vivi.c7
-rw-r--r--drivers/mmc/host/imxmmc.c4
-rw-r--r--drivers/mtd/maps/omap_nor.c23
-rw-r--r--drivers/mtd/nand/orion_nand.c3
-rw-r--r--drivers/net/3c59x.c5
-rw-r--r--drivers/net/Kconfig2
-rw-r--r--drivers/net/e100.c2
-rw-r--r--drivers/net/e1000/e1000_ethtool.c2
-rw-r--r--drivers/net/e1000e/netdev.c3
-rw-r--r--drivers/net/hamradio/dmascc.c2
-rw-r--r--drivers/net/igb/igb_main.c3
-rw-r--r--drivers/net/ipg.c16
-rw-r--r--drivers/net/ixgbe/ixgbe_main.c3
-rw-r--r--drivers/net/netxen/netxen_nic_main.c18
-rw-r--r--drivers/net/pcmcia/axnet_cs.c2
-rw-r--r--drivers/net/pcmcia/pcnet_cs.c3
-rw-r--r--drivers/net/pppoe.c2
-rw-r--r--drivers/net/qla3xxx.c2
-rw-r--r--drivers/net/r6040.c2
-rw-r--r--drivers/net/s2io.c35
-rw-r--r--drivers/net/s2io.h4
-rw-r--r--drivers/net/tc35815.c4
-rw-r--r--drivers/net/wan/x25_asy.c3
-rw-r--r--drivers/net/wireless/b43/leds.c3
-rw-r--r--drivers/net/wireless/b43/main.c12
-rw-r--r--drivers/net/wireless/b43legacy/dma.c2
-rw-r--r--drivers/net/wireless/b43legacy/main.c6
-rw-r--r--drivers/net/wireless/hostap/hostap_80211_rx.c8
-rw-r--r--drivers/net/wireless/hostap/hostap_ap.c2
-rw-r--r--drivers/net/wireless/hostap/hostap_cs.c8
-rw-r--r--drivers/net/wireless/hostap/hostap_hw.c10
-rw-r--r--drivers/net/wireless/hostap/hostap_main.c5
-rw-r--r--drivers/net/wireless/iwlwifi/iwl3945-base.c33
-rw-r--r--drivers/net/wireless/iwlwifi/iwl4965-base.c39
-rw-r--r--drivers/net/wireless/prism54/islpci_eth.c2
-rw-r--r--drivers/net/wireless/rt2x00/rt2500usb.c36
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00.h1
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00dev.c38
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00mac.c4
-rw-r--r--drivers/net/wireless/rt2x00/rt73usb.c36
-rw-r--r--drivers/pci/access.c14
-rw-r--r--drivers/pci/hotplug/acpiphp_glue.c17
-rw-r--r--drivers/pci/pci-sysfs.c4
-rw-r--r--drivers/pci/pci.h2
-rw-r--r--drivers/pci/quirks.c42
-rw-r--r--drivers/pcmcia/omap_cf.c25
-rw-r--r--drivers/rtc/Kconfig19
-rw-r--r--drivers/rtc/Makefile1
-rw-r--r--drivers/rtc/rtc-at91rm9200.c4
-rw-r--r--drivers/rtc/rtc-at91sam9.c1
-rw-r--r--drivers/rtc/rtc-omap.c1
-rw-r--r--drivers/rtc/rtc-pl030.c217
-rw-r--r--drivers/rtc/rtc-pl031.c36
-rw-r--r--drivers/rtc/rtc-s3c.c4
-rw-r--r--drivers/rtc/rtc-sa1100.c41
-rw-r--r--drivers/scsi/esp_scsi.c22
-rw-r--r--drivers/scsi/ses.c2
-rw-r--r--drivers/serial/Kconfig54
-rw-r--r--drivers/serial/Makefile4
-rw-r--r--drivers/serial/s3c2400.c106
-rw-r--r--drivers/serial/s3c2410.c1860
-rw-r--r--drivers/serial/s3c2412.c151
-rw-r--r--drivers/serial/s3c2440.c181
-rw-r--r--drivers/serial/samsung.c1317
-rw-r--r--drivers/serial/samsung.h102
-rw-r--r--drivers/spi/spi_imx.c16
-rw-r--r--drivers/thermal/Kconfig9
-rw-r--r--drivers/thermal/thermal_sys.c4
-rw-r--r--drivers/usb/gadget/Kconfig4
-rw-r--r--drivers/usb/gadget/at91_udc.c4
-rw-r--r--drivers/usb/gadget/omap_udc.c510
-rw-r--r--drivers/usb/gadget/omap_udc.h61
-rw-r--r--drivers/usb/host/ohci-omap.c5
-rw-r--r--drivers/video/pxafb.c52
-rw-r--r--drivers/watchdog/Makefile1
-rw-r--r--drivers/xen/events.c2
-rw-r--r--fs/block_dev.c10
-rw-r--r--fs/buffer.c13
-rw-r--r--fs/dcache.c68
-rw-r--r--fs/ext4/resize.c3
-rw-r--r--fs/gfs2/bmap.c23
-rw-r--r--fs/gfs2/rgrp.c2
-rw-r--r--fs/locks.c6
-rw-r--r--fs/namei.c26
-rw-r--r--fs/nfs/mount_clnt.c5
-rw-r--r--fs/nfs/super.c76
-rw-r--r--fs/nfs/write.c7
-rw-r--r--fs/pipe.c10
-rw-r--r--fs/select.c2
-rw-r--r--fs/udf/super.c57
-rw-r--r--fs/utimes.c59
-rw-r--r--include/asm-alpha/core_mcpcia.h2
-rw-r--r--include/asm-alpha/core_t2.h14
-rw-r--r--include/asm-alpha/io.h6
-rw-r--r--include/asm-alpha/mmu_context.h6
-rw-r--r--include/asm-alpha/percpu.h74
-rw-r--r--include/asm-alpha/system.h10
-rw-r--r--include/asm-alpha/vga.h6
-rw-r--r--include/asm-arm/arch-at91/at91_pmc.h7
-rw-r--r--include/asm-arm/arch-at91/at91cap9.h2
-rw-r--r--include/asm-arm/arch-at91/at91cap9_matrix.h5
-rw-r--r--include/asm-arm/arch-at91/at91sam9260.h11
-rw-r--r--include/asm-arm/arch-at91/at91sam9rl.h2
-rw-r--r--include/asm-arm/arch-at91/board.h6
-rw-r--r--include/asm-arm/arch-at91/cpu.h7
-rw-r--r--include/asm-arm/arch-at91/hardware.h2
-rw-r--r--include/asm-arm/arch-at91/timex.h22
-rw-r--r--include/asm-arm/arch-ebsa285/hardware.h26
-rw-r--r--include/asm-arm/arch-ebsa285/memory.h19
-rw-r--r--include/asm-arm/arch-ebsa285/vmalloc.h4
-rw-r--r--include/asm-arm/arch-imx/imx-dma.h2
-rw-r--r--include/asm-arm/arch-iop13xx/dma.h2
-rw-r--r--include/asm-arm/arch-iop32x/gpio.h6
-rw-r--r--include/asm-arm/arch-iop33x/gpio.h6
-rw-r--r--include/asm-arm/arch-ixp4xx/fsg.h50
-rw-r--r--include/asm-arm/arch-ixp4xx/hardware.h1
-rw-r--r--include/asm-arm/arch-ixp4xx/irqs.h7
-rw-r--r--include/asm-arm/arch-kirkwood/debug-macro.S20
-rw-r--r--include/asm-arm/arch-kirkwood/dma.h1
-rw-r--r--include/asm-arm/arch-kirkwood/entry-macro.S40
-rw-r--r--include/asm-arm/arch-kirkwood/hardware.h21
-rw-r--r--include/asm-arm/arch-kirkwood/io.h26
-rw-r--r--include/asm-arm/arch-kirkwood/irqs.h63
-rw-r--r--include/asm-arm/arch-kirkwood/kirkwood.h100
-rw-r--r--include/asm-arm/arch-kirkwood/memory.h14
-rw-r--r--include/asm-arm/arch-kirkwood/system.h37
-rw-r--r--include/asm-arm/arch-kirkwood/timex.h11
-rw-r--r--include/asm-arm/arch-kirkwood/uncompress.h47
-rw-r--r--include/asm-arm/arch-kirkwood/vmalloc.h5
-rw-r--r--include/asm-arm/arch-loki/debug-macro.S20
-rw-r--r--include/asm-arm/arch-loki/dma.h1
-rw-r--r--include/asm-arm/arch-loki/entry-macro.S30
-rw-r--r--include/asm-arm/arch-loki/hardware.h15
-rw-r--r--include/asm-arm/arch-loki/io.h26
-rw-r--r--include/asm-arm/arch-loki/irqs.h58
-rw-r--r--include/asm-arm/arch-loki/loki.h97
-rw-r--r--include/asm-arm/arch-loki/memory.h14
-rw-r--r--include/asm-arm/arch-loki/system.h37
-rw-r--r--include/asm-arm/arch-loki/timex.h11
-rw-r--r--include/asm-arm/arch-loki/uncompress.h47
-rw-r--r--include/asm-arm/arch-loki/vmalloc.h5
-rw-r--r--include/asm-arm/arch-msm/irqs.h1
-rw-r--r--include/asm-arm/arch-msm/timex.h1
-rw-r--r--include/asm-arm/arch-mv78xx0/debug-macro.S20
-rw-r--r--include/asm-arm/arch-mv78xx0/dma.h1
-rw-r--r--include/asm-arm/arch-mv78xx0/entry-macro.S39
-rw-r--r--include/asm-arm/arch-mv78xx0/hardware.h21
-rw-r--r--include/asm-arm/arch-mv78xx0/io.h26
-rw-r--r--include/asm-arm/arch-mv78xx0/irqs.h91
-rw-r--r--include/asm-arm/arch-mv78xx0/memory.h14
-rw-r--r--include/asm-arm/arch-mv78xx0/mv78xx0.h126
-rw-r--r--include/asm-arm/arch-mv78xx0/system.h37
-rw-r--r--include/asm-arm/arch-mv78xx0/timex.h9
-rw-r--r--include/asm-arm/arch-mv78xx0/uncompress.h47
-rw-r--r--include/asm-arm/arch-mv78xx0/vmalloc.h5
-rw-r--r--include/asm-arm/arch-ns9xxx/hardware.h4
-rw-r--r--include/asm-arm/arch-omap/board-2430sdp.h5
-rw-r--r--include/asm-arm/arch-omap/board-h3.h6
-rw-r--r--include/asm-arm/arch-omap/board-innovator.h3
-rw-r--r--include/asm-arm/arch-omap/board-perseus2.h6
-rw-r--r--include/asm-arm/arch-omap/clock.h17
-rw-r--r--include/asm-arm/arch-omap/common.h15
-rw-r--r--include/asm-arm/arch-omap/control.h4
-rw-r--r--include/asm-arm/arch-omap/cpu.h39
-rw-r--r--include/asm-arm/arch-omap/dma.h378
-rw-r--r--include/asm-arm/arch-omap/dmtimer.h1
-rw-r--r--include/asm-arm/arch-omap/fpga.h49
-rw-r--r--include/asm-arm/arch-omap/hardware.h1
-rw-r--r--include/asm-arm/arch-omap/io.h26
-rw-r--r--include/asm-arm/arch-omap/irqs.h44
-rw-r--r--include/asm-arm/arch-omap/mcbsp.h62
-rw-r--r--include/asm-arm/arch-omap/omap34xx.h72
-rw-r--r--include/asm-arm/arch-omap/sram.h37
-rw-r--r--include/asm-arm/arch-omap/tc.h10
-rw-r--r--include/asm-arm/arch-omap/usb.h23
-rw-r--r--include/asm-arm/arch-orion5x/io.h8
-rw-r--r--include/asm-arm/arch-orion5x/orion5x.h7
-rw-r--r--include/asm-arm/arch-orion5x/uncompress.h29
-rw-r--r--include/asm-arm/arch-s3c2410/gpio.h74
-rw-r--r--include/asm-arm/arch-s3c2410/regs-clock.h2
-rw-r--r--include/asm-arm/assembler.h15
-rw-r--r--include/asm-arm/cacheflush.h13
-rw-r--r--include/asm-arm/dyntick.h6
-rw-r--r--include/asm-arm/hardware/iop3xx-gpio.h73
-rw-r--r--include/asm-arm/hw_irq.h11
-rw-r--r--include/asm-arm/kexec.h2
-rw-r--r--include/asm-arm/mach/time.h22
-rw-r--r--include/asm-arm/mmu_context.h5
-rw-r--r--include/asm-arm/plat-orion/cache-feroceon-l2.h11
-rw-r--r--include/asm-arm/plat-orion/orion_nand.h1
-rw-r--r--include/asm-arm/plat-orion/pcie.h1
-rw-r--r--include/asm-arm/plat-s3c/regs-timer.h9
-rw-r--r--include/asm-arm/plat-s3c24xx/devs.h7
-rw-r--r--include/asm-arm/rtc.h43
-rw-r--r--include/asm-arm/tlbflush.h30
-rw-r--r--include/asm-generic/Kbuild.asm2
-rw-r--r--include/asm-powerpc/Kbuild1
-rw-r--r--include/asm-x86/kvm_host.h4
-rw-r--r--include/asm-x86/kvm_para.h18
-rw-r--r--include/asm-x86/msr.h2
-rw-r--r--include/asm-x86/pvclock-abi.h42
-rw-r--r--include/asm-x86/pvclock.h13
-rw-r--r--include/asm-x86/xen/page.h4
-rw-r--r--include/linux/Kbuild2
-rw-r--r--include/linux/audit.h2
-rw-r--r--include/linux/bootmem.h2
-rw-r--r--include/linux/dcache.h2
-rw-r--r--include/linux/fs.h3
-rw-r--r--include/linux/i2c.h2
-rw-r--r--include/linux/inet_lro.h6
-rw-r--r--include/linux/input.h2
-rw-r--r--include/linux/kvm_host.h1
-rw-r--r--include/linux/netdevice.h4
-rw-r--r--include/linux/thermal.h6
-rw-r--r--include/linux/tty_driver.h5
-rw-r--r--include/media/cx25840.h6
-rw-r--r--include/media/ir-common.h1
-rw-r--r--include/media/v4l2-dev.h4
-rw-r--r--include/net/ipv6.h6
-rw-r--r--include/net/mac80211.h9
-rw-r--r--include/net/net_namespace.h11
-rw-r--r--include/net/sch_generic.h2
-rw-r--r--include/xen/interface/xen.h7
-rw-r--r--kernel/audit.c6
-rw-r--r--kernel/auditfilter.c3
-rw-r--r--kernel/futex.c93
-rw-r--r--kernel/hrtimer.c2
-rw-r--r--kernel/kgdb.c3
-rw-r--r--kernel/rcuclassic.c16
-rw-r--r--kernel/sched.c18
-rw-r--r--kernel/sched_rt.c3
-rw-r--r--kernel/sysctl.c12
-rw-r--r--kernel/timer.c10
-rw-r--r--lib/debugobjects.c15
-rw-r--r--lib/ts_bm.c2
-rw-r--r--mm/bootmem.c6
-rw-r--r--mm/memory.c50
-rw-r--r--mm/slab.c5
-rw-r--r--net/core/dev.c10
-rw-r--r--net/core/fib_rules.c4
-rw-r--r--net/core/filter.c1
-rw-r--r--net/core/net_namespace.c3
-rw-r--r--net/core/skbuff.c17
-rw-r--r--net/ipv4/inet_fragment.c16
-rw-r--r--net/ipv4/inet_lro.c3
-rw-r--r--net/ipv4/ip_fragment.c2
-rw-r--r--net/ipv4/tcp.c9
-rw-r--r--net/ipv4/tcp_ipv4.c6
-rw-r--r--net/ipv6/ip6_input.c9
-rw-r--r--net/ipv6/ipv6_sockglue.c11
-rw-r--r--net/ipv6/netfilter/ip6table_mangle.c2
-rw-r--r--net/ipv6/netfilter/nf_conntrack_reasm.c3
-rw-r--r--net/ipv6/reassembly.c2
-rw-r--r--net/ipv6/route.c6
-rw-r--r--net/ipv6/tcp_ipv6.c6
-rw-r--r--net/mac80211/key.c9
-rw-r--r--net/mac80211/tx.c9
-rw-r--r--net/mac80211/wext.c7
-rw-r--r--net/mac80211/wme.c3
-rw-r--r--net/netfilter/nf_conntrack_proto_tcp.c13
-rw-r--r--net/netlabel/netlabel_unlabeled.c2
-rw-r--r--net/netlink/af_netlink.c2
-rw-r--r--net/netlink/attr.c7
-rw-r--r--net/sched/Kconfig11
-rw-r--r--net/sched/sch_api.c6
-rw-r--r--net/sched/sch_atm.c7
-rw-r--r--net/sched/sch_cbq.c8
-rw-r--r--net/sched/sch_dsmark.c2
-rw-r--r--net/sched/sch_generic.c2
-rw-r--r--net/sched/sch_hfsc.c6
-rw-r--r--net/sched/sch_htb.c4
-rw-r--r--net/sched/sch_ingress.c2
-rw-r--r--net/sched/sch_prio.c2
-rw-r--r--net/sched/sch_sfq.c2
-rw-r--r--net/sctp/socket.c4
-rw-r--r--net/unix/af_unix.c52
-rw-r--r--net/wireless/reg.c18
-rw-r--r--sound/isa/sb/sb_mixer.c4
-rw-r--r--sound/pci/aw2/aw2-alsa.c4
-rw-r--r--sound/soc/at91/at91-ssc.c2
-rw-r--r--virt/kvm/ioapic.c31
631 files changed, 38826 insertions, 8871 deletions
diff --git a/.gitignore b/.gitignore
index 9bb1cb6d825d..869e1a3b64b6 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,6 +3,10 @@
3# subdirectories here. Add them in the ".gitignore" file 3# subdirectories here. Add them in the ".gitignore" file
4# in that subdirectory instead. 4# in that subdirectory instead.
5# 5#
6# NOTE! Please use 'git-ls-files -i --exclude-standard'
7# command after changing this file, to see if there are
8# any tracked files which get ignored after the change.
9#
6# Normal rules 10# Normal rules
7# 11#
8.* 12.*
@@ -18,19 +22,21 @@
18*.lst 22*.lst
19*.symtypes 23*.symtypes
20*.order 24*.order
25*.elf
26*.bin
27*.gz
21 28
22# 29#
23# Top-level generic files 30# Top-level generic files
24# 31#
25tags 32tags
26TAGS 33TAGS
27vmlinux* 34vmlinux
28!vmlinux.lds.S
29!vmlinux.lds.h
30System.map 35System.map
31Module.markers 36Module.markers
32Module.symvers 37Module.symvers
33!.gitignore 38!.gitignore
39!.mailmap
34 40
35# 41#
36# Generated include files 42# Generated include files
diff --git a/Documentation/DocBook/kgdb.tmpl b/Documentation/DocBook/kgdb.tmpl
index 028a8444d95e..e8acd1f03456 100644
--- a/Documentation/DocBook/kgdb.tmpl
+++ b/Documentation/DocBook/kgdb.tmpl
@@ -84,10 +84,9 @@
84 runs an instance of gdb against the vmlinux file which contains 84 runs an instance of gdb against the vmlinux file which contains
85 the symbols (not boot image such as bzImage, zImage, uImage...). 85 the symbols (not boot image such as bzImage, zImage, uImage...).
86 In gdb the developer specifies the connection parameters and 86 In gdb the developer specifies the connection parameters and
87 connects to kgdb. Depending on which kgdb I/O modules exist in 87 connects to kgdb. The type of connection a developer makes with
88 the kernel for a given architecture, it may be possible to debug 88 gdb depends on the availability of kgdb I/O modules compiled as
89 the test machine's kernel with the development machine using a 89 builtin's or kernel modules in the test machine's kernel.
90 rs232 or ethernet connection.
91 </para> 90 </para>
92 </chapter> 91 </chapter>
93 <chapter id="CompilingAKernel"> 92 <chapter id="CompilingAKernel">
@@ -223,7 +222,7 @@
223 </para> 222 </para>
224 <para> 223 <para>
225 IMPORTANT NOTE: Using this option with kgdb over the console 224 IMPORTANT NOTE: Using this option with kgdb over the console
226 (kgdboc) or kgdb over ethernet (kgdboe) is not supported. 225 (kgdboc) is not supported.
227 </para> 226 </para>
228 </sect1> 227 </sect1>
229 </chapter> 228 </chapter>
@@ -249,18 +248,11 @@
249 (gdb) target remote /dev/ttyS0 248 (gdb) target remote /dev/ttyS0
250 </programlisting> 249 </programlisting>
251 <para> 250 <para>
252 Example (kgdb to a terminal server): 251 Example (kgdb to a terminal server on tcp port 2012):
253 </para> 252 </para>
254 <programlisting> 253 <programlisting>
255 % gdb ./vmlinux 254 % gdb ./vmlinux
256 (gdb) target remote udp:192.168.2.2:6443 255 (gdb) target remote 192.168.2.2:2012
257 </programlisting>
258 <para>
259 Example (kgdb over ethernet):
260 </para>
261 <programlisting>
262 % gdb ./vmlinux
263 (gdb) target remote udp:192.168.2.2:6443
264 </programlisting> 256 </programlisting>
265 <para> 257 <para>
266 Once connected, you can debug a kernel the way you would debug an 258 Once connected, you can debug a kernel the way you would debug an
diff --git a/Documentation/feature-removal-schedule.txt b/Documentation/feature-removal-schedule.txt
index 5b3f31faed56..46ece3fba6f9 100644
--- a/Documentation/feature-removal-schedule.txt
+++ b/Documentation/feature-removal-schedule.txt
@@ -312,3 +312,12 @@ When: 2.6.26
312Why: Implementation became generic; users should now include 312Why: Implementation became generic; users should now include
313 linux/semaphore.h instead. 313 linux/semaphore.h instead.
314Who: Matthew Wilcox <willy@linux.intel.com> 314Who: Matthew Wilcox <willy@linux.intel.com>
315
316---------------------------
317
318What: CONFIG_THERMAL_HWMON
319When: January 2009
320Why: This option was introduced just to allow older lm-sensors userspace
321 to keep working over the upgrade to 2.6.26. At the scheduled time of
322 removal fixed lm-sensors (2.x or 3.x) should be readily available.
323Who: Rene Herman <rene.herman@gmail.com>
diff --git a/Documentation/hwmon/sysfs-interface b/Documentation/hwmon/sysfs-interface
index f4a8ebc1ef1a..2d845730d4e0 100644
--- a/Documentation/hwmon/sysfs-interface
+++ b/Documentation/hwmon/sysfs-interface
@@ -2,17 +2,12 @@ Naming and data format standards for sysfs files
2------------------------------------------------ 2------------------------------------------------
3 3
4The libsensors library offers an interface to the raw sensors data 4The libsensors library offers an interface to the raw sensors data
5through the sysfs interface. See libsensors documentation and source for 5through the sysfs interface. Since lm-sensors 3.0.0, libsensors is
6further information. As of writing this document, libsensors 6completely chip-independent. It assumes that all the kernel drivers
7(from lm_sensors 2.8.3) is heavily chip-dependent. Adding or updating 7implement the standard sysfs interface described in this document.
8support for any given chip requires modifying the library's code. 8This makes adding or updating support for any given chip very easy, as
9This is because libsensors was written for the procfs interface 9libsensors, and applications using it, do not need to be modified.
10older kernel modules were using, which wasn't standardized enough. 10This is a major improvement compared to lm-sensors 2.
11Recent versions of libsensors (from lm_sensors 2.8.2 and later) have
12support for the sysfs interface, though.
13
14The new sysfs interface was designed to be as chip-independent as
15possible.
16 11
17Note that motherboards vary widely in the connections to sensor chips. 12Note that motherboards vary widely in the connections to sensor chips.
18There is no standard that ensures, for example, that the second 13There is no standard that ensures, for example, that the second
@@ -35,19 +30,17 @@ access this data in a simple and consistent way. That said, such programs
35will have to implement conversion, labeling and hiding of inputs. For 30will have to implement conversion, labeling and hiding of inputs. For
36this reason, it is still not recommended to bypass the library. 31this reason, it is still not recommended to bypass the library.
37 32
38If you are developing a userspace application please send us feedback on
39this standard.
40
41Note that this standard isn't completely established yet, so it is subject
42to changes. If you are writing a new hardware monitoring driver those
43features can't seem to fit in this interface, please contact us with your
44extension proposal. Keep in mind that backward compatibility must be
45preserved.
46
47Each chip gets its own directory in the sysfs /sys/devices tree. To 33Each chip gets its own directory in the sysfs /sys/devices tree. To
48find all sensor chips, it is easier to follow the device symlinks from 34find all sensor chips, it is easier to follow the device symlinks from
49/sys/class/hwmon/hwmon*. 35/sys/class/hwmon/hwmon*.
50 36
37Up to lm-sensors 3.0.0, libsensors looks for hardware monitoring attributes
38in the "physical" device directory. Since lm-sensors 3.0.1, attributes found
39in the hwmon "class" device directory are also supported. Complex drivers
40(e.g. drivers for multifunction chips) may want to use this possibility to
41avoid namespace pollution. The only drawback will be that older versions of
42libsensors won't support the driver in question.
43
51All sysfs values are fixed point numbers. 44All sysfs values are fixed point numbers.
52 45
53There is only one value per file, unlike the older /proc specification. 46There is only one value per file, unlike the older /proc specification.
diff --git a/Documentation/i2c/writing-clients b/Documentation/i2c/writing-clients
index ee75cbace28d..d4cd4126d1ad 100644
--- a/Documentation/i2c/writing-clients
+++ b/Documentation/i2c/writing-clients
@@ -25,12 +25,23 @@ routines, and should be zero-initialized except for fields with data you
25provide. A client structure holds device-specific information like the 25provide. A client structure holds device-specific information like the
26driver model device node, and its I2C address. 26driver model device node, and its I2C address.
27 27
28/* iff driver uses driver model ("new style") binding model: */
29
30static struct i2c_device_id foo_idtable[] = {
31 { "foo", my_id_for_foo },
32 { "bar", my_id_for_bar },
33 { }
34};
35
36MODULE_DEVICE_TABLE(i2c, foo_idtable);
37
28static struct i2c_driver foo_driver = { 38static struct i2c_driver foo_driver = {
29 .driver = { 39 .driver = {
30 .name = "foo", 40 .name = "foo",
31 }, 41 },
32 42
33 /* iff driver uses driver model ("new style") binding model: */ 43 /* iff driver uses driver model ("new style") binding model: */
44 .id_table = foo_ids,
34 .probe = foo_probe, 45 .probe = foo_probe,
35 .remove = foo_remove, 46 .remove = foo_remove,
36 47
@@ -173,10 +184,9 @@ handle may be used during foo_probe(). If foo_probe() reports success
173(zero not a negative status code) it may save the handle and use it until 184(zero not a negative status code) it may save the handle and use it until
174foo_remove() returns. That binding model is used by most Linux drivers. 185foo_remove() returns. That binding model is used by most Linux drivers.
175 186
176Drivers match devices when i2c_client.driver_name and the driver name are 187The probe function is called when an entry in the id_table name field
177the same; this approach is used in several other busses that don't have 188matches the device's name. It is passed the entry that was matched so
178device typing support in the hardware. The driver and module name should 189the driver knows which one in the table matched.
179match, so hotplug/coldplug mechanisms will modprobe the driver.
180 190
181 191
182Device Creation (Standard driver model) 192Device Creation (Standard driver model)
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
index e07c432c731f..f1e970acad4c 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -1208,6 +1208,11 @@ and is between 256 and 4096 characters. It is defined in the file
1208 mtdparts= [MTD] 1208 mtdparts= [MTD]
1209 See drivers/mtd/cmdlinepart.c. 1209 See drivers/mtd/cmdlinepart.c.
1210 1210
1211 mtdset= [ARM]
1212 ARM/S3C2412 JIVE boot control
1213
1214 See arch/arm/mach-s3c2412/mach-jive.c
1215
1211 mtouchusb.raw_coordinates= 1216 mtouchusb.raw_coordinates=
1212 [HW] Make the MicroTouch USB driver use raw coordinates 1217 [HW] Make the MicroTouch USB driver use raw coordinates
1213 ('y', default) or cooked coordinates ('n') 1218 ('y', default) or cooked coordinates ('n')
diff --git a/Documentation/networking/ip-sysctl.txt b/Documentation/networking/ip-sysctl.txt
index 17a6e46fbd43..17f1f91af35c 100644
--- a/Documentation/networking/ip-sysctl.txt
+++ b/Documentation/networking/ip-sysctl.txt
@@ -81,23 +81,23 @@ inet_peer_minttl - INTEGER
81 Minimum time-to-live of entries. Should be enough to cover fragment 81 Minimum time-to-live of entries. Should be enough to cover fragment
82 time-to-live on the reassembling side. This minimum time-to-live is 82 time-to-live on the reassembling side. This minimum time-to-live is
83 guaranteed if the pool size is less than inet_peer_threshold. 83 guaranteed if the pool size is less than inet_peer_threshold.
84 Measured in jiffies(1). 84 Measured in seconds.
85 85
86inet_peer_maxttl - INTEGER 86inet_peer_maxttl - INTEGER
87 Maximum time-to-live of entries. Unused entries will expire after 87 Maximum time-to-live of entries. Unused entries will expire after
88 this period of time if there is no memory pressure on the pool (i.e. 88 this period of time if there is no memory pressure on the pool (i.e.
89 when the number of entries in the pool is very small). 89 when the number of entries in the pool is very small).
90 Measured in jiffies(1). 90 Measured in seconds.
91 91
92inet_peer_gc_mintime - INTEGER 92inet_peer_gc_mintime - INTEGER
93 Minimum interval between garbage collection passes. This interval is 93 Minimum interval between garbage collection passes. This interval is
94 in effect under high memory pressure on the pool. 94 in effect under high memory pressure on the pool.
95 Measured in jiffies(1). 95 Measured in seconds.
96 96
97inet_peer_gc_maxtime - INTEGER 97inet_peer_gc_maxtime - INTEGER
98 Minimum interval between garbage collection passes. This interval is 98 Minimum interval between garbage collection passes. This interval is
99 in effect under low (or absent) memory pressure on the pool. 99 in effect under low (or absent) memory pressure on the pool.
100 Measured in jiffies(1). 100 Measured in seconds.
101 101
102TCP variables: 102TCP variables:
103 103
@@ -794,10 +794,6 @@ tag - INTEGER
794 Allows you to write a number, which can be used as required. 794 Allows you to write a number, which can be used as required.
795 Default value is 0. 795 Default value is 0.
796 796
797(1) Jiffie: internal timeunit for the kernel. On the i386 1/100s, on the
798Alpha 1/1024s. See the HZ define in /usr/include/asm/param.h for the exact
799value on your system.
800
801Alexey Kuznetsov. 797Alexey Kuznetsov.
802kuznet@ms2.inr.ac.ru 798kuznet@ms2.inr.ac.ru
803 799
diff --git a/Documentation/networking/s2io.txt b/Documentation/networking/s2io.txt
index 4bde53e85f3f..1e28e2ddb90a 100644
--- a/Documentation/networking/s2io.txt
+++ b/Documentation/networking/s2io.txt
@@ -83,9 +83,9 @@ Valid range: Limited by memory on system
83Default: 30 83Default: 30
84 84
85e. intr_type 85e. intr_type
86Specifies interrupt type. Possible values 1(INTA), 2(MSI), 3(MSI-X) 86Specifies interrupt type. Possible values 0(INTA), 2(MSI-X)
87Valid range: 1-3 87Valid values: 0, 2
88Default: 1 88Default: 2
89 89
905. Performance suggestions 905. Performance suggestions
91General: 91General:
diff --git a/Documentation/video4linux/CARDLIST.au0828 b/Documentation/video4linux/CARDLIST.au0828
index aaae360312e4..86d1c8e7b18f 100644
--- a/Documentation/video4linux/CARDLIST.au0828
+++ b/Documentation/video4linux/CARDLIST.au0828
@@ -1,4 +1,4 @@
1 0 -> Unknown board (au0828) 1 0 -> Unknown board (au0828)
2 1 -> Hauppauge HVR950Q (au0828) [2040:7200] 2 1 -> Hauppauge HVR950Q (au0828) [2040:7200,2040:7210,2040:7217,2040:721b,2040:721f,2040:7280,0fd9:0008]
3 2 -> Hauppauge HVR850 (au0828) [2040:7240] 3 2 -> Hauppauge HVR850 (au0828) [2040:7240]
4 3 -> DViCO FusionHDTV USB (au0828) [0fe9:d620] 4 3 -> DViCO FusionHDTV USB (au0828) [0fe9:d620]
diff --git a/MAINTAINERS b/MAINTAINERS
index cd587eec9fa7..e6c06fa3290e 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -4314,6 +4314,14 @@ L: netdev@vger.kernel.org
4314W: http://www.linux-usb.org/usbnet 4314W: http://www.linux-usb.org/usbnet
4315S: Maintained 4315S: Maintained
4316 4316
4317USB VIDEO CLASS
4318P: Laurent Pinchart
4319M: laurent.pinchart@skynet.be
4320L: linx-uvc-devel@berlios.de
4321L: video4linux-list@redhat.com
4322W: http://linux-uvc.berlios.de
4323S: Maintained
4324
4317USB W996[87]CF DRIVER 4325USB W996[87]CF DRIVER
4318P: Luca Risolia 4326P: Luca Risolia
4319M: luca.risolia@studio.unibo.it 4327M: luca.risolia@studio.unibo.it
@@ -4431,10 +4439,10 @@ M: johnpol@2ka.mipt.ru
4431S: Maintained 4439S: Maintained
4432 4440
4433W83791D HARDWARE MONITORING DRIVER 4441W83791D HARDWARE MONITORING DRIVER
4434P: Charles Spirakis 4442P: Marc Hulsman
4435M: bezaur@gmail.com 4443M: m.hulsman@tudelft.nl
4436L: lm-sensors@lm-sensors.org 4444L: lm-sensors@lm-sensors.org
4437S: Odd Fixes 4445S: Maintained
4438 4446
4439W83793 HARDWARE MONITORING DRIVER 4447W83793 HARDWARE MONITORING DRIVER
4440P: Rudolf Marek 4448P: Rudolf Marek
diff --git a/Makefile b/Makefile
index 2b4977c9844e..6aff5f47c21d 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
1VERSION = 2 1VERSION = 2
2PATCHLEVEL = 6 2PATCHLEVEL = 6
3SUBLEVEL = 26 3SUBLEVEL = 26
4EXTRAVERSION = -rc7 4EXTRAVERSION = -rc8
5NAME = Rotary Wombat 5NAME = Rotary Wombat
6 6
7# *DOCUMENTATION* 7# *DOCUMENTATION*
diff --git a/arch/alpha/Makefile b/arch/alpha/Makefile
index 4e1a8e2c4541..4759fe751aa1 100644
--- a/arch/alpha/Makefile
+++ b/arch/alpha/Makefile
@@ -13,6 +13,7 @@ NM := $(NM) -B
13LDFLAGS_vmlinux := -static -N #-relax 13LDFLAGS_vmlinux := -static -N #-relax
14CHECKFLAGS += -D__alpha__ -m64 14CHECKFLAGS += -D__alpha__ -m64
15cflags-y := -pipe -mno-fp-regs -ffixed-8 -msmall-data 15cflags-y := -pipe -mno-fp-regs -ffixed-8 -msmall-data
16cflags-y += $(call cc-option, -fno-jump-tables)
16 17
17cpuflags-$(CONFIG_ALPHA_EV4) := -mcpu=ev4 18cpuflags-$(CONFIG_ALPHA_EV4) := -mcpu=ev4
18cpuflags-$(CONFIG_ALPHA_EV5) := -mcpu=ev5 19cpuflags-$(CONFIG_ALPHA_EV5) := -mcpu=ev5
diff --git a/arch/alpha/kernel/core_t2.c b/arch/alpha/kernel/core_t2.c
index c0750291b44a..d9980d47ab81 100644
--- a/arch/alpha/kernel/core_t2.c
+++ b/arch/alpha/kernel/core_t2.c
@@ -74,6 +74,8 @@
74# define DBG(args) 74# define DBG(args)
75#endif 75#endif
76 76
77DEFINE_SPINLOCK(t2_hae_lock);
78
77static volatile unsigned int t2_mcheck_any_expected; 79static volatile unsigned int t2_mcheck_any_expected;
78static volatile unsigned int t2_mcheck_last_taken; 80static volatile unsigned int t2_mcheck_last_taken;
79 81
diff --git a/arch/alpha/kernel/pci.c b/arch/alpha/kernel/pci.c
index 36ab22a7ea12..5cf45fc51343 100644
--- a/arch/alpha/kernel/pci.c
+++ b/arch/alpha/kernel/pci.c
@@ -71,6 +71,23 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82378, quirk_i
71static void __init 71static void __init
72quirk_cypress(struct pci_dev *dev) 72quirk_cypress(struct pci_dev *dev)
73{ 73{
74 /* The Notorious Cy82C693 chip. */
75
76 /* The generic legacy mode IDE fixup in drivers/pci/probe.c
77 doesn't work correctly with the Cypress IDE controller as
78 it has non-standard register layout. Fix that. */
79 if (dev->class >> 8 == PCI_CLASS_STORAGE_IDE) {
80 dev->resource[2].start = dev->resource[3].start = 0;
81 dev->resource[2].end = dev->resource[3].end = 0;
82 dev->resource[2].flags = dev->resource[3].flags = 0;
83 if (PCI_FUNC(dev->devfn) == 2) {
84 dev->resource[0].start = 0x170;
85 dev->resource[0].end = 0x177;
86 dev->resource[1].start = 0x376;
87 dev->resource[1].end = 0x376;
88 }
89 }
90
74 /* The Cypress bridge responds on the PCI bus in the address range 91 /* The Cypress bridge responds on the PCI bus in the address range
75 0xffff0000-0xffffffff (conventional x86 BIOS ROM). There is no 92 0xffff0000-0xffffffff (conventional x86 BIOS ROM). There is no
76 way to turn this off. The bridge also supports several extended 93 way to turn this off. The bridge also supports several extended
diff --git a/arch/alpha/kernel/traps.c b/arch/alpha/kernel/traps.c
index dc57790250d2..c778779007fc 100644
--- a/arch/alpha/kernel/traps.c
+++ b/arch/alpha/kernel/traps.c
@@ -447,7 +447,7 @@ struct unaligned_stat {
447 447
448 448
449/* Macro for exception fixup code to access integer registers. */ 449/* Macro for exception fixup code to access integer registers. */
450#define una_reg(r) (regs->regs[(r) >= 16 && (r) <= 18 ? (r)+19 : (r)]) 450#define una_reg(r) (_regs[(r) >= 16 && (r) <= 18 ? (r)+19 : (r)])
451 451
452 452
453asmlinkage void 453asmlinkage void
@@ -456,6 +456,7 @@ do_entUna(void * va, unsigned long opcode, unsigned long reg,
456{ 456{
457 long error, tmp1, tmp2, tmp3, tmp4; 457 long error, tmp1, tmp2, tmp3, tmp4;
458 unsigned long pc = regs->pc - 4; 458 unsigned long pc = regs->pc - 4;
459 unsigned long *_regs = regs->regs;
459 const struct exception_table_entry *fixup; 460 const struct exception_table_entry *fixup;
460 461
461 unaligned[0].count++; 462 unaligned[0].count++;
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 640df6a4c850..b92925c70172 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -84,6 +84,11 @@ config STACKTRACE_SUPPORT
84 bool 84 bool
85 default y 85 default y
86 86
87config HAVE_LATENCYTOP_SUPPORT
88 bool
89 depends on !SMP
90 default y
91
87config LOCKDEP_SUPPORT 92config LOCKDEP_SUPPORT
88 bool 93 bool
89 default y 94 default y
@@ -147,6 +152,10 @@ config FIQ
147config ARCH_MTD_XIP 152config ARCH_MTD_XIP
148 bool 153 bool
149 154
155config GENERIC_HARDIRQS_NO__DO_IRQ
156 bool
157 def_bool y
158
150if OPROFILE 159if OPROFILE
151 160
152config OPROFILE_ARMV6 161config OPROFILE_ARMV6
@@ -232,13 +241,6 @@ config ARCH_CLPS711X
232 help 241 help
233 Support for Cirrus Logic 711x/721x based boards. 242 Support for Cirrus Logic 711x/721x based boards.
234 243
235config ARCH_CO285
236 bool "Co-EBSA285"
237 select FOOTBRIDGE
238 select FOOTBRIDGE_ADDIN
239 help
240 Support for Intel's EBSA285 companion chip.
241
242config ARCH_EBSA110 244config ARCH_EBSA110
243 bool "EBSA-110" 245 bool "EBSA-110"
244 select ISA 246 select ISA
@@ -299,6 +301,8 @@ config ARCH_IOP32X
299 depends on MMU 301 depends on MMU
300 select PLAT_IOP 302 select PLAT_IOP
301 select PCI 303 select PCI
304 select GENERIC_GPIO
305 select HAVE_GPIO_LIB
302 help 306 help
303 Support for Intel's 80219 and IOP32X (XScale) family of 307 Support for Intel's 80219 and IOP32X (XScale) family of
304 processors. 308 processors.
@@ -308,6 +312,8 @@ config ARCH_IOP33X
308 depends on MMU 312 depends on MMU
309 select PLAT_IOP 313 select PLAT_IOP
310 select PCI 314 select PCI
315 select GENERIC_GPIO
316 select HAVE_GPIO_LIB
311 help 317 help
312 Support for Intel's IOP33X (XScale) family of processors. 318 Support for Intel's IOP33X (XScale) family of processors.
313 319
@@ -347,6 +353,16 @@ config ARCH_L7200
347 If you have any questions or comments about the Linux kernel port 353 If you have any questions or comments about the Linux kernel port
348 to this board, send e-mail to <sjhill@cotw.com>. 354 to this board, send e-mail to <sjhill@cotw.com>.
349 355
356config ARCH_KIRKWOOD
357 bool "Marvell Kirkwood"
358 select PCI
359 select GENERIC_TIME
360 select GENERIC_CLOCKEVENTS
361 select PLAT_ORION
362 help
363 Support for the following Marvell Kirkwood series SoCs:
364 88F6180, 88F6192 and 88F6281.
365
350config ARCH_KS8695 366config ARCH_KS8695
351 bool "Micrel/Kendin KS8695" 367 bool "Micrel/Kendin KS8695"
352 select GENERIC_GPIO 368 select GENERIC_GPIO
@@ -365,6 +381,24 @@ config ARCH_NS9XXX
365 381
366 <http://www.digi.com/products/microprocessors/index.jsp> 382 <http://www.digi.com/products/microprocessors/index.jsp>
367 383
384config ARCH_LOKI
385 bool "Marvell Loki (88RC8480)"
386 select GENERIC_TIME
387 select GENERIC_CLOCKEVENTS
388 select PLAT_ORION
389 help
390 Support for the Marvell Loki (88RC8480) SoC.
391
392config ARCH_MV78XX0
393 bool "Marvell MV78xx0"
394 select PCI
395 select GENERIC_TIME
396 select GENERIC_CLOCKEVENTS
397 select PLAT_ORION
398 help
399 Support for the following Marvell MV78xx0 series SoCs:
400 MV781x0, MV782x0.
401
368config ARCH_MXC 402config ARCH_MXC
369 bool "Freescale MXC/iMX-based" 403 bool "Freescale MXC/iMX-based"
370 select ARCH_MTD_XIP 404 select ARCH_MTD_XIP
@@ -381,7 +415,8 @@ config ARCH_ORION5X
381 select PLAT_ORION 415 select PLAT_ORION
382 help 416 help
383 Support for the following Marvell Orion 5x series SoCs: 417 Support for the following Marvell Orion 5x series SoCs:
384 Orion-1 (5181), Orion-NAS (5182), Orion-2 (5281.) 418 Orion-1 (5181), Orion-VoIP (5181L), Orion-NAS (5182),
419 Orion-2 (5281).
385 420
386config ARCH_PNX4008 421config ARCH_PNX4008
387 bool "Philips Nexperia PNX4008 Mobile" 422 bool "Philips Nexperia PNX4008 Mobile"
@@ -503,6 +538,10 @@ source "arch/arm/mach-ixp2000/Kconfig"
503 538
504source "arch/arm/mach-ixp23xx/Kconfig" 539source "arch/arm/mach-ixp23xx/Kconfig"
505 540
541source "arch/arm/mach-loki/Kconfig"
542
543source "arch/arm/mach-mv78xx0/Kconfig"
544
506source "arch/arm/mach-pxa/Kconfig" 545source "arch/arm/mach-pxa/Kconfig"
507 546
508source "arch/arm/mach-sa1100/Kconfig" 547source "arch/arm/mach-sa1100/Kconfig"
@@ -515,6 +554,8 @@ source "arch/arm/mach-omap2/Kconfig"
515 554
516source "arch/arm/mach-orion5x/Kconfig" 555source "arch/arm/mach-orion5x/Kconfig"
517 556
557source "arch/arm/mach-kirkwood/Kconfig"
558
518source "arch/arm/plat-s3c24xx/Kconfig" 559source "arch/arm/plat-s3c24xx/Kconfig"
519source "arch/arm/plat-s3c/Kconfig" 560source "arch/arm/plat-s3c/Kconfig"
520 561
@@ -704,27 +745,6 @@ config PREEMPT
704 Say Y here if you are building a kernel for a desktop, embedded 745 Say Y here if you are building a kernel for a desktop, embedded
705 or real-time system. Say N if you are unsure. 746 or real-time system. Say N if you are unsure.
706 747
707config NO_IDLE_HZ
708 bool "Dynamic tick timer"
709 depends on !GENERIC_CLOCKEVENTS
710 help
711 Select this option if you want to disable continuous timer ticks
712 and have them programmed to occur as required. This option saves
713 power as the system can remain in idle state for longer.
714
715 By default dynamic tick is disabled during the boot, and can be
716 manually enabled with:
717
718 echo 1 > /sys/devices/system/timer/timer0/dyn_tick
719
720 Alternatively, if you want dynamic tick automatically enabled
721 during boot, pass "dyntick=enable" via the kernel command string.
722
723 Please note that dynamic tick may affect the accuracy of
724 timekeeping on some platforms depending on the implementation.
725 Currently at least OMAP, PXA2xx and SA11x0 platforms are known
726 to have accurate timekeeping with dynamic tick.
727
728config HZ 748config HZ
729 int 749 int
730 default 128 if ARCH_L7200 750 default 128 if ARCH_L7200
@@ -790,7 +810,7 @@ source "mm/Kconfig"
790 810
791config LEDS 811config LEDS
792 bool "Timer and CPU usage LEDs" 812 bool "Timer and CPU usage LEDs"
793 depends on ARCH_CDB89712 || ARCH_CO285 || ARCH_EBSA110 || \ 813 depends on ARCH_CDB89712 || ARCH_EBSA110 || \
794 ARCH_EBSA285 || ARCH_IMX || ARCH_INTEGRATOR || \ 814 ARCH_EBSA285 || ARCH_IMX || ARCH_INTEGRATOR || \
795 ARCH_LUBBOCK || MACH_MAINSTONE || ARCH_NETWINDER || \ 815 ARCH_LUBBOCK || MACH_MAINSTONE || ARCH_NETWINDER || \
796 ARCH_OMAP || ARCH_P720T || ARCH_PXA_IDP || \ 816 ARCH_OMAP || ARCH_P720T || ARCH_PXA_IDP || \
diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index e72db27e0ba0..91fac81833e8 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -100,8 +100,6 @@ textofs-y := 0x00008000
100 incdir-$(CONFIG_ARCH_CLPS7500) := cl7500 100 incdir-$(CONFIG_ARCH_CLPS7500) := cl7500
101 machine-$(CONFIG_FOOTBRIDGE) := footbridge 101 machine-$(CONFIG_FOOTBRIDGE) := footbridge
102 incdir-$(CONFIG_FOOTBRIDGE) := ebsa285 102 incdir-$(CONFIG_FOOTBRIDGE) := ebsa285
103 machine-$(CONFIG_ARCH_CO285) := footbridge
104 incdir-$(CONFIG_ARCH_CO285) := ebsa285
105 machine-$(CONFIG_ARCH_SHARK) := shark 103 machine-$(CONFIG_ARCH_SHARK) := shark
106 machine-$(CONFIG_ARCH_SA1100) := sa1100 104 machine-$(CONFIG_ARCH_SA1100) := sa1100
107ifeq ($(CONFIG_ARCH_SA1100),y) 105ifeq ($(CONFIG_ARCH_SA1100),y)
@@ -135,11 +133,14 @@ endif
135 machine-$(CONFIG_ARCH_NETX) := netx 133 machine-$(CONFIG_ARCH_NETX) := netx
136 machine-$(CONFIG_ARCH_NS9XXX) := ns9xxx 134 machine-$(CONFIG_ARCH_NS9XXX) := ns9xxx
137 machine-$(CONFIG_ARCH_DAVINCI) := davinci 135 machine-$(CONFIG_ARCH_DAVINCI) := davinci
136 machine-$(CONFIG_ARCH_KIRKWOOD) := kirkwood
138 machine-$(CONFIG_ARCH_KS8695) := ks8695 137 machine-$(CONFIG_ARCH_KS8695) := ks8695
139 incdir-$(CONFIG_ARCH_MXC) := mxc 138 incdir-$(CONFIG_ARCH_MXC) := mxc
140 machine-$(CONFIG_ARCH_MX3) := mx3 139 machine-$(CONFIG_ARCH_MX3) := mx3
141 machine-$(CONFIG_ARCH_ORION5X) := orion5x 140 machine-$(CONFIG_ARCH_ORION5X) := orion5x
142 machine-$(CONFIG_ARCH_MSM7X00A) := msm 141 machine-$(CONFIG_ARCH_MSM7X00A) := msm
142 machine-$(CONFIG_ARCH_LOKI) := loki
143 machine-$(CONFIG_ARCH_MV78XX0) := mv78xx0
143 144
144ifeq ($(CONFIG_ARCH_EBSA110),y) 145ifeq ($(CONFIG_ARCH_EBSA110),y)
145# This is what happens if you forget the IOCS16 line. 146# This is what happens if you forget the IOCS16 line.
@@ -190,8 +191,6 @@ core-$(CONFIG_PLAT_S3C24XX) += arch/arm/plat-s3c24xx/
190core-$(CONFIG_ARCH_MXC) += arch/arm/plat-mxc/ 191core-$(CONFIG_ARCH_MXC) += arch/arm/plat-mxc/
191 192
192drivers-$(CONFIG_OPROFILE) += arch/arm/oprofile/ 193drivers-$(CONFIG_OPROFILE) += arch/arm/oprofile/
193drivers-$(CONFIG_ARCH_CLPS7500) += drivers/acorn/char/
194drivers-$(CONFIG_ARCH_L7200) += drivers/acorn/char/
195 194
196libs-y := arch/arm/lib/ $(libs-y) 195libs-y := arch/arm/lib/ $(libs-y)
197 196
diff --git a/arch/arm/boot/compressed/head.S b/arch/arm/boot/compressed/head.S
index 3c2c8f2a1dc4..de41daeab5e9 100644
--- a/arch/arm/boot/compressed/head.S
+++ b/arch/arm/boot/compressed/head.S
@@ -623,8 +623,8 @@ proc_types:
623 b __armv4_mmu_cache_off 623 b __armv4_mmu_cache_off
624 b __armv4_mmu_cache_flush 624 b __armv4_mmu_cache_flush
625 625
626 .word 0x56055310 @ Feroceon 626 .word 0x56050000 @ Feroceon
627 .word 0xfffffff0 627 .word 0xff0f0000
628 b __armv4_mmu_cache_on 628 b __armv4_mmu_cache_on
629 b __armv4_mmu_cache_off 629 b __armv4_mmu_cache_off
630 b __armv5tej_mmu_cache_flush 630 b __armv5tej_mmu_cache_flush
diff --git a/arch/arm/common/Makefile b/arch/arm/common/Makefile
index 3d0b9fa42f84..325e4b6a6afb 100644
--- a/arch/arm/common/Makefile
+++ b/arch/arm/common/Makefile
@@ -2,7 +2,6 @@
2# Makefile for the linux kernel. 2# Makefile for the linux kernel.
3# 3#
4 4
5obj-y += rtctime.o
6obj-$(CONFIG_ARM_GIC) += gic.o 5obj-$(CONFIG_ARM_GIC) += gic.o
7obj-$(CONFIG_ARM_VIC) += vic.o 6obj-$(CONFIG_ARM_VIC) += vic.o
8obj-$(CONFIG_ICST525) += icst525.o 7obj-$(CONFIG_ICST525) += icst525.o
diff --git a/arch/arm/common/dmabounce.c b/arch/arm/common/dmabounce.c
index 52fc6a883281..2744673314b4 100644
--- a/arch/arm/common/dmabounce.c
+++ b/arch/arm/common/dmabounce.c
@@ -650,7 +650,8 @@ EXPORT_SYMBOL(dma_map_sg);
650EXPORT_SYMBOL(dma_unmap_sg); 650EXPORT_SYMBOL(dma_unmap_sg);
651EXPORT_SYMBOL(dma_sync_single_for_cpu); 651EXPORT_SYMBOL(dma_sync_single_for_cpu);
652EXPORT_SYMBOL(dma_sync_single_for_device); 652EXPORT_SYMBOL(dma_sync_single_for_device);
653EXPORT_SYMBOL(dma_sync_sg); 653EXPORT_SYMBOL(dma_sync_sg_for_cpu);
654EXPORT_SYMBOL(dma_sync_sg_for_device);
654EXPORT_SYMBOL(dmabounce_register_dev); 655EXPORT_SYMBOL(dmabounce_register_dev);
655EXPORT_SYMBOL(dmabounce_unregister_dev); 656EXPORT_SYMBOL(dmabounce_unregister_dev);
656 657
diff --git a/arch/arm/common/rtctime.c b/arch/arm/common/rtctime.c
deleted file mode 100644
index aa8f7739c822..000000000000
--- a/arch/arm/common/rtctime.c
+++ /dev/null
@@ -1,434 +0,0 @@
1/*
2 * linux/arch/arm/common/rtctime.c
3 *
4 * Copyright (C) 2003 Deep Blue Solutions Ltd.
5 * Based on sa1100-rtc.c, Nils Faerber, CIH, Nicolas Pitre.
6 * Based on rtc.c by Paul Gortmaker
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#include <linux/module.h>
13#include <linux/kernel.h>
14#include <linux/time.h>
15#include <linux/rtc.h>
16#include <linux/poll.h>
17#include <linux/proc_fs.h>
18#include <linux/miscdevice.h>
19#include <linux/spinlock.h>
20#include <linux/capability.h>
21#include <linux/device.h>
22#include <linux/mutex.h>
23
24#include <asm/rtc.h>
25
26static DECLARE_WAIT_QUEUE_HEAD(rtc_wait);
27static struct fasync_struct *rtc_async_queue;
28
29/*
30 * rtc_lock protects rtc_irq_data
31 */
32static DEFINE_SPINLOCK(rtc_lock);
33static unsigned long rtc_irq_data;
34
35/*
36 * rtc_sem protects rtc_inuse and rtc_ops
37 */
38static DEFINE_MUTEX(rtc_mutex);
39static unsigned long rtc_inuse;
40static struct rtc_ops *rtc_ops;
41
42#define rtc_epoch 1900UL
43
44/*
45 * Calculate the next alarm time given the requested alarm time mask
46 * and the current time.
47 */
48void rtc_next_alarm_time(struct rtc_time *next, struct rtc_time *now, struct rtc_time *alrm)
49{
50 unsigned long next_time;
51 unsigned long now_time;
52
53 next->tm_year = now->tm_year;
54 next->tm_mon = now->tm_mon;
55 next->tm_mday = now->tm_mday;
56 next->tm_hour = alrm->tm_hour;
57 next->tm_min = alrm->tm_min;
58 next->tm_sec = alrm->tm_sec;
59
60 rtc_tm_to_time(now, &now_time);
61 rtc_tm_to_time(next, &next_time);
62
63 if (next_time < now_time) {
64 /* Advance one day */
65 next_time += 60 * 60 * 24;
66 rtc_time_to_tm(next_time, next);
67 }
68}
69EXPORT_SYMBOL(rtc_next_alarm_time);
70
71static inline int rtc_arm_read_time(struct rtc_ops *ops, struct rtc_time *tm)
72{
73 memset(tm, 0, sizeof(struct rtc_time));
74 return ops->read_time(tm);
75}
76
77static inline int rtc_arm_set_time(struct rtc_ops *ops, struct rtc_time *tm)
78{
79 int ret;
80
81 ret = rtc_valid_tm(tm);
82 if (ret == 0)
83 ret = ops->set_time(tm);
84
85 return ret;
86}
87
88static inline int rtc_arm_read_alarm(struct rtc_ops *ops, struct rtc_wkalrm *alrm)
89{
90 int ret = -EINVAL;
91 if (ops->read_alarm) {
92 memset(alrm, 0, sizeof(struct rtc_wkalrm));
93 ret = ops->read_alarm(alrm);
94 }
95 return ret;
96}
97
98static inline int rtc_arm_set_alarm(struct rtc_ops *ops, struct rtc_wkalrm *alrm)
99{
100 int ret = -EINVAL;
101 if (ops->set_alarm)
102 ret = ops->set_alarm(alrm);
103 return ret;
104}
105
106void rtc_update(unsigned long num, unsigned long events)
107{
108 spin_lock(&rtc_lock);
109 rtc_irq_data = (rtc_irq_data + (num << 8)) | events;
110 spin_unlock(&rtc_lock);
111
112 wake_up_interruptible(&rtc_wait);
113 kill_fasync(&rtc_async_queue, SIGIO, POLL_IN);
114}
115EXPORT_SYMBOL(rtc_update);
116
117
118static ssize_t
119rtc_read(struct file *file, char __user *buf, size_t count, loff_t *ppos)
120{
121 DECLARE_WAITQUEUE(wait, current);
122 unsigned long data;
123 ssize_t ret;
124
125 if (count < sizeof(unsigned long))
126 return -EINVAL;
127
128 add_wait_queue(&rtc_wait, &wait);
129 do {
130 __set_current_state(TASK_INTERRUPTIBLE);
131
132 spin_lock_irq(&rtc_lock);
133 data = rtc_irq_data;
134 rtc_irq_data = 0;
135 spin_unlock_irq(&rtc_lock);
136
137 if (data != 0) {
138 ret = 0;
139 break;
140 }
141 if (file->f_flags & O_NONBLOCK) {
142 ret = -EAGAIN;
143 break;
144 }
145 if (signal_pending(current)) {
146 ret = -ERESTARTSYS;
147 break;
148 }
149 schedule();
150 } while (1);
151 set_current_state(TASK_RUNNING);
152 remove_wait_queue(&rtc_wait, &wait);
153
154 if (ret == 0) {
155 ret = put_user(data, (unsigned long __user *)buf);
156 if (ret == 0)
157 ret = sizeof(unsigned long);
158 }
159 return ret;
160}
161
162static unsigned int rtc_poll(struct file *file, poll_table *wait)
163{
164 unsigned long data;
165
166 poll_wait(file, &rtc_wait, wait);
167
168 spin_lock_irq(&rtc_lock);
169 data = rtc_irq_data;
170 spin_unlock_irq(&rtc_lock);
171
172 return data != 0 ? POLLIN | POLLRDNORM : 0;
173}
174
175static int rtc_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
176 unsigned long arg)
177{
178 struct rtc_ops *ops = file->private_data;
179 struct rtc_time tm;
180 struct rtc_wkalrm alrm;
181 void __user *uarg = (void __user *)arg;
182 int ret = -EINVAL;
183
184 switch (cmd) {
185 case RTC_ALM_READ:
186 ret = rtc_arm_read_alarm(ops, &alrm);
187 if (ret)
188 break;
189 ret = copy_to_user(uarg, &alrm.time, sizeof(tm));
190 if (ret)
191 ret = -EFAULT;
192 break;
193
194 case RTC_ALM_SET:
195 ret = copy_from_user(&alrm.time, uarg, sizeof(tm));
196 if (ret) {
197 ret = -EFAULT;
198 break;
199 }
200 alrm.enabled = 0;
201 alrm.pending = 0;
202 alrm.time.tm_mday = -1;
203 alrm.time.tm_mon = -1;
204 alrm.time.tm_year = -1;
205 alrm.time.tm_wday = -1;
206 alrm.time.tm_yday = -1;
207 alrm.time.tm_isdst = -1;
208 ret = rtc_arm_set_alarm(ops, &alrm);
209 break;
210
211 case RTC_RD_TIME:
212 ret = rtc_arm_read_time(ops, &tm);
213 if (ret)
214 break;
215 ret = copy_to_user(uarg, &tm, sizeof(tm));
216 if (ret)
217 ret = -EFAULT;
218 break;
219
220 case RTC_SET_TIME:
221 if (!capable(CAP_SYS_TIME)) {
222 ret = -EACCES;
223 break;
224 }
225 ret = copy_from_user(&tm, uarg, sizeof(tm));
226 if (ret) {
227 ret = -EFAULT;
228 break;
229 }
230 ret = rtc_arm_set_time(ops, &tm);
231 break;
232
233 case RTC_EPOCH_SET:
234#ifndef rtc_epoch
235 /*
236 * There were no RTC clocks before 1900.
237 */
238 if (arg < 1900) {
239 ret = -EINVAL;
240 break;
241 }
242 if (!capable(CAP_SYS_TIME)) {
243 ret = -EACCES;
244 break;
245 }
246 rtc_epoch = arg;
247 ret = 0;
248#endif
249 break;
250
251 case RTC_EPOCH_READ:
252 ret = put_user(rtc_epoch, (unsigned long __user *)uarg);
253 break;
254
255 case RTC_WKALM_SET:
256 ret = copy_from_user(&alrm, uarg, sizeof(alrm));
257 if (ret) {
258 ret = -EFAULT;
259 break;
260 }
261 ret = rtc_arm_set_alarm(ops, &alrm);
262 break;
263
264 case RTC_WKALM_RD:
265 ret = rtc_arm_read_alarm(ops, &alrm);
266 if (ret)
267 break;
268 ret = copy_to_user(uarg, &alrm, sizeof(alrm));
269 if (ret)
270 ret = -EFAULT;
271 break;
272
273 default:
274 if (ops->ioctl)
275 ret = ops->ioctl(cmd, arg);
276 break;
277 }
278 return ret;
279}
280
281static int rtc_open(struct inode *inode, struct file *file)
282{
283 int ret;
284
285 mutex_lock(&rtc_mutex);
286
287 if (rtc_inuse) {
288 ret = -EBUSY;
289 } else if (!rtc_ops || !try_module_get(rtc_ops->owner)) {
290 ret = -ENODEV;
291 } else {
292 file->private_data = rtc_ops;
293
294 ret = rtc_ops->open ? rtc_ops->open() : 0;
295 if (ret == 0) {
296 spin_lock_irq(&rtc_lock);
297 rtc_irq_data = 0;
298 spin_unlock_irq(&rtc_lock);
299
300 rtc_inuse = 1;
301 }
302 }
303 mutex_unlock(&rtc_mutex);
304
305 return ret;
306}
307
308static int rtc_release(struct inode *inode, struct file *file)
309{
310 struct rtc_ops *ops = file->private_data;
311
312 if (ops->release)
313 ops->release();
314
315 spin_lock_irq(&rtc_lock);
316 rtc_irq_data = 0;
317 spin_unlock_irq(&rtc_lock);
318
319 module_put(rtc_ops->owner);
320 rtc_inuse = 0;
321
322 return 0;
323}
324
325static int rtc_fasync(int fd, struct file *file, int on)
326{
327 return fasync_helper(fd, file, on, &rtc_async_queue);
328}
329
330static const struct file_operations rtc_fops = {
331 .owner = THIS_MODULE,
332 .llseek = no_llseek,
333 .read = rtc_read,
334 .poll = rtc_poll,
335 .ioctl = rtc_ioctl,
336 .open = rtc_open,
337 .release = rtc_release,
338 .fasync = rtc_fasync,
339};
340
341static struct miscdevice rtc_miscdev = {
342 .minor = RTC_MINOR,
343 .name = "rtc",
344 .fops = &rtc_fops,
345};
346
347
348static int rtc_read_proc(char *page, char **start, off_t off, int count, int *eof, void *data)
349{
350 struct rtc_ops *ops = data;
351 struct rtc_wkalrm alrm;
352 struct rtc_time tm;
353 char *p = page;
354
355 if (rtc_arm_read_time(ops, &tm) == 0) {
356 p += sprintf(p,
357 "rtc_time\t: %02d:%02d:%02d\n"
358 "rtc_date\t: %04d-%02d-%02d\n"
359 "rtc_epoch\t: %04lu\n",
360 tm.tm_hour, tm.tm_min, tm.tm_sec,
361 tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday,
362 rtc_epoch);
363 }
364
365 if (rtc_arm_read_alarm(ops, &alrm) == 0) {
366 p += sprintf(p, "alrm_time\t: ");
367 if ((unsigned int)alrm.time.tm_hour <= 24)
368 p += sprintf(p, "%02d:", alrm.time.tm_hour);
369 else
370 p += sprintf(p, "**:");
371 if ((unsigned int)alrm.time.tm_min <= 59)
372 p += sprintf(p, "%02d:", alrm.time.tm_min);
373 else
374 p += sprintf(p, "**:");
375 if ((unsigned int)alrm.time.tm_sec <= 59)
376 p += sprintf(p, "%02d\n", alrm.time.tm_sec);
377 else
378 p += sprintf(p, "**\n");
379
380 p += sprintf(p, "alrm_date\t: ");
381 if ((unsigned int)alrm.time.tm_year <= 200)
382 p += sprintf(p, "%04d-", alrm.time.tm_year + 1900);
383 else
384 p += sprintf(p, "****-");
385 if ((unsigned int)alrm.time.tm_mon <= 11)
386 p += sprintf(p, "%02d-", alrm.time.tm_mon + 1);
387 else
388 p += sprintf(p, "**-");
389 if ((unsigned int)alrm.time.tm_mday <= 31)
390 p += sprintf(p, "%02d\n", alrm.time.tm_mday);
391 else
392 p += sprintf(p, "**\n");
393 p += sprintf(p, "alrm_wakeup\t: %s\n",
394 alrm.enabled ? "yes" : "no");
395 p += sprintf(p, "alrm_pending\t: %s\n",
396 alrm.pending ? "yes" : "no");
397 }
398
399 if (ops->proc)
400 p += ops->proc(p);
401
402 return p - page;
403}
404
405int register_rtc(struct rtc_ops *ops)
406{
407 int ret = -EBUSY;
408
409 mutex_lock(&rtc_mutex);
410 if (rtc_ops == NULL) {
411 rtc_ops = ops;
412
413 ret = misc_register(&rtc_miscdev);
414 if (ret == 0)
415 create_proc_read_entry("driver/rtc", 0, NULL,
416 rtc_read_proc, ops);
417 }
418 mutex_unlock(&rtc_mutex);
419
420 return ret;
421}
422EXPORT_SYMBOL(register_rtc);
423
424void unregister_rtc(struct rtc_ops *rtc)
425{
426 mutex_lock(&rtc_mutex);
427 if (rtc == rtc_ops) {
428 remove_proc_entry("driver/rtc", NULL);
429 misc_deregister(&rtc_miscdev);
430 rtc_ops = NULL;
431 }
432 mutex_unlock(&rtc_mutex);
433}
434EXPORT_SYMBOL(unregister_rtc);
diff --git a/arch/arm/configs/at91cap9adk_defconfig b/arch/arm/configs/at91cap9adk_defconfig
index e32e73648129..be2b2f38fd94 100644
--- a/arch/arm/configs/at91cap9adk_defconfig
+++ b/arch/arm/configs/at91cap9adk_defconfig
@@ -213,7 +213,6 @@ CONFIG_CPU_CP15_MMU=y
213# 213#
214# CONFIG_TICK_ONESHOT is not set 214# CONFIG_TICK_ONESHOT is not set
215# CONFIG_PREEMPT is not set 215# CONFIG_PREEMPT is not set
216# CONFIG_NO_IDLE_HZ is not set
217CONFIG_HZ=100 216CONFIG_HZ=100
218CONFIG_AEABI=y 217CONFIG_AEABI=y
219CONFIG_OABI_COMPAT=y 218CONFIG_OABI_COMPAT=y
@@ -907,7 +906,32 @@ CONFIG_USB_MON=y
907# 906#
908# USB Gadget Support 907# USB Gadget Support
909# 908#
910# CONFIG_USB_GADGET is not set 909CONFIG_USB_GADGET=y
910# CONFIG_USB_GADGET_DEBUG is not set
911# CONFIG_USB_GADGET_DEBUG_FILES is not set
912CONFIG_USB_GADGET_SELECTED=y
913# CONFIG_USB_GADGET_AMD5536UDC is not set
914CONFIG_USB_GADGET_ATMEL_USBA=y
915CONFIG_USB_ATMEL_USBA=y
916# CONFIG_USB_GADGET_FSL_USB2 is not set
917# CONFIG_USB_GADGET_NET2280 is not set
918# CONFIG_USB_GADGET_PXA2XX is not set
919# CONFIG_USB_GADGET_M66592 is not set
920# CONFIG_USB_GADGET_GOKU is not set
921# CONFIG_USB_GADGET_LH7A40X is not set
922# CONFIG_USB_GADGET_OMAP is not set
923# CONFIG_USB_GADGET_S3C2410 is not set
924# CONFIG_USB_GADGET_AT91 is not set
925# CONFIG_USB_GADGET_DUMMY_HCD is not set
926CONFIG_USB_GADGET_DUALSPEED=y
927# CONFIG_USB_ZERO is not set
928CONFIG_USB_ETH=m
929CONFIG_USB_ETH_RNDIS=y
930# CONFIG_USB_GADGETFS is not set
931CONFIG_USB_FILE_STORAGE=m
932# CONFIG_USB_FILE_STORAGE_TEST is not set
933# CONFIG_USB_G_SERIAL is not set
934# CONFIG_USB_MIDI_GADGET is not set
911CONFIG_MMC=y 935CONFIG_MMC=y
912# CONFIG_MMC_DEBUG is not set 936# CONFIG_MMC_DEBUG is not set
913# CONFIG_MMC_UNSAFE_RESUME is not set 937# CONFIG_MMC_UNSAFE_RESUME is not set
@@ -926,7 +950,59 @@ CONFIG_MMC_AT91=y
926# CONFIG_MMC_SPI is not set 950# CONFIG_MMC_SPI is not set
927# CONFIG_NEW_LEDS is not set 951# CONFIG_NEW_LEDS is not set
928CONFIG_RTC_LIB=y 952CONFIG_RTC_LIB=y
929# CONFIG_RTC_CLASS is not set 953CONFIG_RTC_CLASS=y
954CONFIG_RTC_HCTOSYS=y
955CONFIG_RTC_HCTOSYS_DEVICE="rtc0"
956# CONFIG_RTC_DEBUG is not set
957
958#
959# RTC interfaces
960#
961CONFIG_RTC_INTF_SYSFS=y
962CONFIG_RTC_INTF_PROC=y
963CONFIG_RTC_INTF_DEV=y
964# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set
965# CONFIG_RTC_DRV_TEST is not set
966
967#
968# I2C RTC drivers
969#
970# CONFIG_RTC_DRV_DS1307 is not set
971# CONFIG_RTC_DRV_DS1374 is not set
972# CONFIG_RTC_DRV_DS1672 is not set
973# CONFIG_RTC_DRV_MAX6900 is not set
974# CONFIG_RTC_DRV_RS5C372 is not set
975# CONFIG_RTC_DRV_ISL1208 is not set
976# CONFIG_RTC_DRV_X1205 is not set
977# CONFIG_RTC_DRV_PCF8563 is not set
978# CONFIG_RTC_DRV_PCF8583 is not set
979# CONFIG_RTC_DRV_M41T80 is not set
980
981#
982# SPI RTC drivers
983#
984# CONFIG_RTC_DRV_MAX6902 is not set
985# CONFIG_RTC_DRV_R9701 is not set
986# CONFIG_RTC_DRV_RS5C348 is not set
987
988#
989# Platform RTC drivers
990#
991# CONFIG_RTC_DRV_CMOS is not set
992# CONFIG_RTC_DRV_DS1511 is not set
993# CONFIG_RTC_DRV_DS1553 is not set
994# CONFIG_RTC_DRV_DS1742 is not set
995# CONFIG_RTC_DRV_STK17TA8 is not set
996# CONFIG_RTC_DRV_M48T86 is not set
997# CONFIG_RTC_DRV_M48T59 is not set
998# CONFIG_RTC_DRV_V3020 is not set
999
1000#
1001# on-CPU RTC drivers
1002#
1003CONFIG_RTC_DRV_AT91SAM9=y
1004CONFIG_RTC_DRV_AT91SAM9_RTT=0
1005CONFIG_RTC_DRV_AT91SAM9_GPBR=0
930 1006
931# 1007#
932# File systems 1008# File systems
diff --git a/arch/arm/configs/at91rm9200dk_defconfig b/arch/arm/configs/at91rm9200dk_defconfig
index 2dbbbc3d4ac3..868fb7b9530b 100644
--- a/arch/arm/configs/at91rm9200dk_defconfig
+++ b/arch/arm/configs/at91rm9200dk_defconfig
@@ -169,7 +169,6 @@ CONFIG_AT91_CF=y
169# Kernel Features 169# Kernel Features
170# 170#
171# CONFIG_PREEMPT is not set 171# CONFIG_PREEMPT is not set
172# CONFIG_NO_IDLE_HZ is not set
173# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set 172# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set
174CONFIG_SELECT_MEMORY_MODEL=y 173CONFIG_SELECT_MEMORY_MODEL=y
175CONFIG_FLATMEM_MANUAL=y 174CONFIG_FLATMEM_MANUAL=y
diff --git a/arch/arm/configs/at91rm9200ek_defconfig b/arch/arm/configs/at91rm9200ek_defconfig
index 6e994f7820c6..de43fc675616 100644
--- a/arch/arm/configs/at91rm9200ek_defconfig
+++ b/arch/arm/configs/at91rm9200ek_defconfig
@@ -160,7 +160,6 @@ CONFIG_ISA_DMA_API=y
160# Kernel Features 160# Kernel Features
161# 161#
162# CONFIG_PREEMPT is not set 162# CONFIG_PREEMPT is not set
163# CONFIG_NO_IDLE_HZ is not set
164# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set 163# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set
165CONFIG_SELECT_MEMORY_MODEL=y 164CONFIG_SELECT_MEMORY_MODEL=y
166CONFIG_FLATMEM_MANUAL=y 165CONFIG_FLATMEM_MANUAL=y
diff --git a/arch/arm/configs/at91sam9260ek_defconfig b/arch/arm/configs/at91sam9260ek_defconfig
index f659c938473f..2011adfa6758 100644
--- a/arch/arm/configs/at91sam9260ek_defconfig
+++ b/arch/arm/configs/at91sam9260ek_defconfig
@@ -220,7 +220,6 @@ CONFIG_CPU_CP15_MMU=y
220# 220#
221# CONFIG_TICK_ONESHOT is not set 221# CONFIG_TICK_ONESHOT is not set
222# CONFIG_PREEMPT is not set 222# CONFIG_PREEMPT is not set
223# CONFIG_NO_IDLE_HZ is not set
224CONFIG_HZ=100 223CONFIG_HZ=100
225# CONFIG_AEABI is not set 224# CONFIG_AEABI is not set
226# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set 225# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set
diff --git a/arch/arm/configs/at91sam9261ek_defconfig b/arch/arm/configs/at91sam9261ek_defconfig
index 3802e85f7483..4049768962d2 100644
--- a/arch/arm/configs/at91sam9261ek_defconfig
+++ b/arch/arm/configs/at91sam9261ek_defconfig
@@ -213,7 +213,6 @@ CONFIG_CPU_CP15_MMU=y
213# 213#
214# CONFIG_TICK_ONESHOT is not set 214# CONFIG_TICK_ONESHOT is not set
215# CONFIG_PREEMPT is not set 215# CONFIG_PREEMPT is not set
216# CONFIG_NO_IDLE_HZ is not set
217CONFIG_HZ=100 216CONFIG_HZ=100
218# CONFIG_AEABI is not set 217# CONFIG_AEABI is not set
219# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set 218# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set
diff --git a/arch/arm/configs/at91sam9263ek_defconfig b/arch/arm/configs/at91sam9263ek_defconfig
index 32a0d74e0c89..fa1c5aecb5a8 100644
--- a/arch/arm/configs/at91sam9263ek_defconfig
+++ b/arch/arm/configs/at91sam9263ek_defconfig
@@ -213,7 +213,6 @@ CONFIG_CPU_CP15_MMU=y
213# 213#
214# CONFIG_TICK_ONESHOT is not set 214# CONFIG_TICK_ONESHOT is not set
215# CONFIG_PREEMPT is not set 215# CONFIG_PREEMPT is not set
216# CONFIG_NO_IDLE_HZ is not set
217CONFIG_HZ=100 216CONFIG_HZ=100
218# CONFIG_AEABI is not set 217# CONFIG_AEABI is not set
219# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set 218# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set
diff --git a/arch/arm/configs/at91sam9g20ek_defconfig b/arch/arm/configs/at91sam9g20ek_defconfig
new file mode 100644
index 000000000000..c06863847364
--- /dev/null
+++ b/arch/arm/configs/at91sam9g20ek_defconfig
@@ -0,0 +1,1168 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.24
4# Tue Jun 10 15:51:52 2008
5#
6CONFIG_ARM=y
7CONFIG_SYS_SUPPORTS_APM_EMULATION=y
8CONFIG_GENERIC_GPIO=y
9CONFIG_GENERIC_TIME=y
10CONFIG_GENERIC_CLOCKEVENTS=y
11CONFIG_MMU=y
12# CONFIG_NO_IOPORT is not set
13CONFIG_GENERIC_HARDIRQS=y
14CONFIG_STACKTRACE_SUPPORT=y
15CONFIG_LOCKDEP_SUPPORT=y
16CONFIG_TRACE_IRQFLAGS_SUPPORT=y
17CONFIG_HARDIRQS_SW_RESEND=y
18CONFIG_GENERIC_IRQ_PROBE=y
19CONFIG_RWSEM_GENERIC_SPINLOCK=y
20# CONFIG_ARCH_HAS_ILOG2_U32 is not set
21# CONFIG_ARCH_HAS_ILOG2_U64 is not set
22CONFIG_GENERIC_HWEIGHT=y
23CONFIG_GENERIC_CALIBRATE_DELAY=y
24CONFIG_ZONE_DMA=y
25CONFIG_VECTORS_BASE=0xffff0000
26CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
27
28#
29# General setup
30#
31CONFIG_EXPERIMENTAL=y
32CONFIG_BROKEN_ON_SMP=y
33CONFIG_INIT_ENV_ARG_LIMIT=32
34CONFIG_LOCALVERSION=""
35# CONFIG_LOCALVERSION_AUTO is not set
36# CONFIG_SWAP is not set
37CONFIG_SYSVIPC=y
38CONFIG_SYSVIPC_SYSCTL=y
39# CONFIG_POSIX_MQUEUE is not set
40# CONFIG_BSD_PROCESS_ACCT is not set
41# CONFIG_TASKSTATS is not set
42# CONFIG_USER_NS is not set
43# CONFIG_PID_NS is not set
44# CONFIG_AUDIT is not set
45# CONFIG_IKCONFIG is not set
46CONFIG_LOG_BUF_SHIFT=14
47# CONFIG_CGROUPS is not set
48# CONFIG_FAIR_GROUP_SCHED is not set
49CONFIG_SYSFS_DEPRECATED=y
50# CONFIG_RELAY is not set
51CONFIG_BLK_DEV_INITRD=y
52CONFIG_INITRAMFS_SOURCE=""
53CONFIG_CC_OPTIMIZE_FOR_SIZE=y
54CONFIG_SYSCTL=y
55# CONFIG_EMBEDDED is not set
56CONFIG_UID16=y
57CONFIG_SYSCTL_SYSCALL=y
58CONFIG_KALLSYMS=y
59# CONFIG_KALLSYMS_EXTRA_PASS is not set
60CONFIG_HOTPLUG=y
61CONFIG_PRINTK=y
62CONFIG_BUG=y
63CONFIG_ELF_CORE=y
64CONFIG_BASE_FULL=y
65CONFIG_FUTEX=y
66CONFIG_ANON_INODES=y
67CONFIG_EPOLL=y
68CONFIG_SIGNALFD=y
69CONFIG_EVENTFD=y
70CONFIG_SHMEM=y
71CONFIG_VM_EVENT_COUNTERS=y
72CONFIG_SLAB=y
73# CONFIG_SLUB is not set
74# CONFIG_SLOB is not set
75CONFIG_SLABINFO=y
76CONFIG_RT_MUTEXES=y
77# CONFIG_TINY_SHMEM is not set
78CONFIG_BASE_SMALL=0
79CONFIG_MODULES=y
80CONFIG_MODULE_UNLOAD=y
81# CONFIG_MODULE_FORCE_UNLOAD is not set
82# CONFIG_MODVERSIONS is not set
83# CONFIG_MODULE_SRCVERSION_ALL is not set
84CONFIG_KMOD=y
85CONFIG_BLOCK=y
86# CONFIG_LBD is not set
87# CONFIG_BLK_DEV_IO_TRACE is not set
88# CONFIG_LSF is not set
89# CONFIG_BLK_DEV_BSG is not set
90
91#
92# IO Schedulers
93#
94CONFIG_IOSCHED_NOOP=y
95CONFIG_IOSCHED_AS=y
96# CONFIG_IOSCHED_DEADLINE is not set
97# CONFIG_IOSCHED_CFQ is not set
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"
103
104#
105# System Type
106#
107# CONFIG_ARCH_AAEC2000 is not set
108# CONFIG_ARCH_INTEGRATOR is not set
109# CONFIG_ARCH_REALVIEW is not set
110# CONFIG_ARCH_VERSATILE is not set
111CONFIG_ARCH_AT91=y
112# CONFIG_ARCH_CLPS7500 is not set
113# CONFIG_ARCH_CLPS711X is not set
114# CONFIG_ARCH_CO285 is not set
115# CONFIG_ARCH_EBSA110 is not set
116# CONFIG_ARCH_EP93XX is not set
117# CONFIG_ARCH_FOOTBRIDGE is not set
118# CONFIG_ARCH_NETX is not set
119# CONFIG_ARCH_H720X is not set
120# CONFIG_ARCH_IMX is not set
121# CONFIG_ARCH_IOP13XX is not set
122# CONFIG_ARCH_IOP32X is not set
123# CONFIG_ARCH_IOP33X is not set
124# CONFIG_ARCH_IXP23XX is not set
125# CONFIG_ARCH_IXP2000 is not set
126# CONFIG_ARCH_IXP4XX is not set
127# CONFIG_ARCH_L7200 is not set
128# CONFIG_ARCH_KS8695 is not set
129# CONFIG_ARCH_NS9XXX is not set
130# CONFIG_ARCH_MXC is not set
131# CONFIG_ARCH_PNX4008 is not set
132# CONFIG_ARCH_PXA is not set
133# CONFIG_ARCH_RPC is not set
134# CONFIG_ARCH_SA1100 is not set
135# CONFIG_ARCH_S3C2410 is not set
136# CONFIG_ARCH_SHARK is not set
137# CONFIG_ARCH_LH7A40X is not set
138# CONFIG_ARCH_DAVINCI is not set
139# CONFIG_ARCH_OMAP is not set
140
141#
142# Boot options
143#
144
145#
146# Power management
147#
148
149#
150# Atmel AT91 System-on-Chip
151#
152# CONFIG_ARCH_AT91RM9200 is not set
153# CONFIG_ARCH_AT91SAM9260 is not set
154# CONFIG_ARCH_AT91SAM9261 is not set
155# CONFIG_ARCH_AT91SAM9263 is not set
156# CONFIG_ARCH_AT91SAM9RL is not set
157CONFIG_ARCH_AT91SAM9G20=y
158# CONFIG_ARCH_AT91CAP9 is not set
159# CONFIG_ARCH_AT91X40 is not set
160CONFIG_AT91_PMC_UNIT=y
161
162#
163# AT91SAM9G20 Board Type
164#
165CONFIG_MACH_AT91SAM9G20EK=y
166
167#
168# AT91 Board Options
169#
170# CONFIG_MTD_AT91_DATAFLASH_CARD is not set
171# CONFIG_MTD_NAND_AT91_BUSWIDTH_16 is not set
172
173#
174# AT91 Feature Selections
175#
176CONFIG_AT91_PROGRAMMABLE_CLOCKS=y
177# CONFIG_AT91_SLOW_CLOCK is not set
178CONFIG_AT91_TIMER_HZ=100
179CONFIG_AT91_EARLY_DBGU=y
180# CONFIG_AT91_EARLY_USART0 is not set
181# CONFIG_AT91_EARLY_USART1 is not set
182# CONFIG_AT91_EARLY_USART2 is not set
183# CONFIG_AT91_EARLY_USART3 is not set
184# CONFIG_AT91_EARLY_USART4 is not set
185# CONFIG_AT91_EARLY_USART5 is not set
186
187#
188# Processor Type
189#
190CONFIG_CPU_32=y
191CONFIG_CPU_ARM926T=y
192CONFIG_CPU_32v5=y
193CONFIG_CPU_ABRT_EV5TJ=y
194CONFIG_CPU_CACHE_VIVT=y
195CONFIG_CPU_COPY_V4WB=y
196CONFIG_CPU_TLB_V4WBI=y
197CONFIG_CPU_CP15=y
198CONFIG_CPU_CP15_MMU=y
199
200#
201# Processor Features
202#
203# CONFIG_ARM_THUMB is not set
204# CONFIG_CPU_ICACHE_DISABLE is not set
205# CONFIG_CPU_DCACHE_DISABLE is not set
206# CONFIG_CPU_DCACHE_WRITETHROUGH is not set
207# CONFIG_CPU_CACHE_ROUND_ROBIN is not set
208# CONFIG_OUTER_CACHE is not set
209
210#
211# Bus support
212#
213# CONFIG_PCI_SYSCALL is not set
214# CONFIG_ARCH_SUPPORTS_MSI is not set
215# CONFIG_PCCARD is not set
216
217#
218# Kernel Features
219#
220# CONFIG_TICK_ONESHOT is not set
221# CONFIG_NO_HZ is not set
222# CONFIG_HIGH_RES_TIMERS is not set
223CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
224# CONFIG_PREEMPT is not set
225CONFIG_HZ=100
226CONFIG_AEABI=y
227CONFIG_OABI_COMPAT=y
228# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set
229CONFIG_SELECT_MEMORY_MODEL=y
230CONFIG_FLATMEM_MANUAL=y
231# CONFIG_DISCONTIGMEM_MANUAL is not set
232# CONFIG_SPARSEMEM_MANUAL is not set
233CONFIG_FLATMEM=y
234CONFIG_FLAT_NODE_MEM_MAP=y
235# CONFIG_SPARSEMEM_STATIC is not set
236# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
237CONFIG_SPLIT_PTLOCK_CPUS=4096
238# CONFIG_RESOURCES_64BIT is not set
239CONFIG_ZONE_DMA_FLAG=1
240CONFIG_BOUNCE=y
241CONFIG_VIRT_TO_BUS=y
242CONFIG_LEDS=y
243CONFIG_LEDS_CPU=y
244CONFIG_ALIGNMENT_TRAP=y
245
246#
247# Boot options
248#
249CONFIG_ZBOOT_ROM_TEXT=0x0
250CONFIG_ZBOOT_ROM_BSS=0x0
251CONFIG_CMDLINE="mem=64M console=ttyS0,115200 initrd=0x21100000,3145728 root=/dev/ram0 rw"
252# CONFIG_XIP_KERNEL is not set
253# CONFIG_KEXEC is not set
254
255#
256# Floating point emulation
257#
258
259#
260# At least one emulation must be selected
261#
262CONFIG_FPE_NWFPE=y
263# CONFIG_FPE_NWFPE_XP is not set
264# CONFIG_FPE_FASTFPE is not set
265# CONFIG_VFP is not set
266
267#
268# Userspace binary formats
269#
270CONFIG_BINFMT_ELF=y
271# CONFIG_BINFMT_AOUT is not set
272# CONFIG_BINFMT_MISC is not set
273
274#
275# Power management options
276#
277CONFIG_PM=y
278# CONFIG_PM_LEGACY is not set
279# CONFIG_PM_DEBUG is not set
280CONFIG_PM_SLEEP=y
281CONFIG_SUSPEND_UP_POSSIBLE=y
282CONFIG_SUSPEND=y
283# CONFIG_APM_EMULATION is not set
284
285#
286# Networking
287#
288CONFIG_NET=y
289
290#
291# Networking options
292#
293CONFIG_PACKET=y
294# CONFIG_PACKET_MMAP is not set
295CONFIG_UNIX=y
296# CONFIG_NET_KEY is not set
297CONFIG_INET=y
298# CONFIG_IP_MULTICAST is not set
299# CONFIG_IP_ADVANCED_ROUTER is not set
300CONFIG_IP_FIB_HASH=y
301CONFIG_IP_PNP=y
302# CONFIG_IP_PNP_DHCP is not set
303CONFIG_IP_PNP_BOOTP=y
304# CONFIG_IP_PNP_RARP is not set
305# CONFIG_NET_IPIP is not set
306# CONFIG_NET_IPGRE is not set
307# CONFIG_ARPD is not set
308# CONFIG_SYN_COOKIES is not set
309# CONFIG_INET_AH is not set
310# CONFIG_INET_ESP is not set
311# CONFIG_INET_IPCOMP is not set
312# CONFIG_INET_XFRM_TUNNEL is not set
313# CONFIG_INET_TUNNEL is not set
314# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
315# CONFIG_INET_XFRM_MODE_TUNNEL is not set
316# CONFIG_INET_XFRM_MODE_BEET is not set
317# CONFIG_INET_LRO is not set
318CONFIG_INET_DIAG=y
319CONFIG_INET_TCP_DIAG=y
320# CONFIG_TCP_CONG_ADVANCED is not set
321CONFIG_TCP_CONG_CUBIC=y
322CONFIG_DEFAULT_TCP_CONG="cubic"
323# CONFIG_TCP_MD5SIG is not set
324# CONFIG_IPV6 is not set
325# CONFIG_INET6_XFRM_TUNNEL is not set
326# CONFIG_INET6_TUNNEL is not set
327# CONFIG_NETWORK_SECMARK is not set
328# CONFIG_NETFILTER is not set
329# CONFIG_IP_DCCP is not set
330# CONFIG_IP_SCTP is not set
331# CONFIG_TIPC is not set
332# CONFIG_ATM is not set
333# CONFIG_BRIDGE is not set
334# CONFIG_VLAN_8021Q is not set
335# CONFIG_DECNET is not set
336# CONFIG_LLC2 is not set
337# CONFIG_IPX is not set
338# CONFIG_ATALK is not set
339# CONFIG_X25 is not set
340# CONFIG_LAPB is not set
341# CONFIG_ECONET is not set
342# CONFIG_WAN_ROUTER is not set
343# CONFIG_NET_SCHED is not set
344
345#
346# Network testing
347#
348# CONFIG_NET_PKTGEN is not set
349# CONFIG_HAMRADIO is not set
350# CONFIG_IRDA is not set
351# CONFIG_BT is not set
352# CONFIG_AF_RXRPC is not set
353
354#
355# Wireless
356#
357# CONFIG_CFG80211 is not set
358# CONFIG_WIRELESS_EXT is not set
359# CONFIG_MAC80211 is not set
360# CONFIG_IEEE80211 is not set
361# CONFIG_RFKILL is not set
362# CONFIG_NET_9P is not set
363
364#
365# Device Drivers
366#
367
368#
369# Generic Driver Options
370#
371CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
372CONFIG_STANDALONE=y
373CONFIG_PREVENT_FIRMWARE_BUILD=y
374# CONFIG_FW_LOADER is not set
375# CONFIG_SYS_HYPERVISOR is not set
376# CONFIG_CONNECTOR is not set
377CONFIG_MTD=y
378# CONFIG_MTD_DEBUG is not set
379CONFIG_MTD_CONCAT=y
380CONFIG_MTD_PARTITIONS=y
381# CONFIG_MTD_REDBOOT_PARTS is not set
382CONFIG_MTD_CMDLINE_PARTS=y
383# CONFIG_MTD_AFS_PARTS is not set
384
385#
386# User Modules And Translation Layers
387#
388CONFIG_MTD_CHAR=y
389CONFIG_MTD_BLKDEVS=y
390CONFIG_MTD_BLOCK=y
391# CONFIG_FTL is not set
392# CONFIG_NFTL is not set
393# CONFIG_INFTL is not set
394# CONFIG_RFD_FTL is not set
395# CONFIG_SSFDC is not set
396# CONFIG_MTD_OOPS is not set
397
398#
399# RAM/ROM/Flash chip drivers
400#
401# CONFIG_MTD_CFI is not set
402# CONFIG_MTD_JEDECPROBE 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_RAM is not set
414# CONFIG_MTD_ROM is not set
415# CONFIG_MTD_ABSENT is not set
416
417#
418# Mapping drivers for chip access
419#
420# CONFIG_MTD_COMPLEX_MAPPINGS is not set
421# CONFIG_MTD_PLATRAM is not set
422
423#
424# Self-contained MTD device drivers
425#
426CONFIG_MTD_DATAFLASH=y
427# CONFIG_MTD_M25P80 is not set
428# CONFIG_MTD_SLRAM is not set
429# CONFIG_MTD_PHRAM is not set
430# CONFIG_MTD_MTDRAM is not set
431# CONFIG_MTD_BLOCK2MTD is not set
432
433#
434# Disk-On-Chip Device Drivers
435#
436# CONFIG_MTD_DOC2000 is not set
437# CONFIG_MTD_DOC2001 is not set
438# CONFIG_MTD_DOC2001PLUS is not set
439CONFIG_MTD_NAND=y
440# CONFIG_MTD_NAND_VERIFY_WRITE is not set
441# CONFIG_MTD_NAND_ECC_SMC is not set
442# CONFIG_MTD_NAND_MUSEUM_IDS is not set
443CONFIG_MTD_NAND_IDS=y
444# CONFIG_MTD_NAND_DISKONCHIP is not set
445CONFIG_MTD_NAND_AT91=y
446CONFIG_MTD_NAND_AT91_ECC_SOFT=y
447# CONFIG_MTD_NAND_AT91_ECC_HW is not set
448# CONFIG_MTD_NAND_AT91_ECC_NONE is not set
449# CONFIG_MTD_NAND_NANDSIM is not set
450# CONFIG_MTD_NAND_PLATFORM is not set
451# CONFIG_MTD_ALAUDA is not set
452# CONFIG_MTD_ONENAND is not set
453
454#
455# UBI - Unsorted block images
456#
457# CONFIG_MTD_UBI is not set
458# CONFIG_PARPORT is not set
459CONFIG_BLK_DEV=y
460# CONFIG_BLK_DEV_COW_COMMON is not set
461CONFIG_BLK_DEV_LOOP=y
462# CONFIG_BLK_DEV_CRYPTOLOOP is not set
463# CONFIG_BLK_DEV_NBD is not set
464# CONFIG_BLK_DEV_UB is not set
465CONFIG_BLK_DEV_RAM=y
466CONFIG_BLK_DEV_RAM_COUNT=16
467CONFIG_BLK_DEV_RAM_SIZE=8192
468CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024
469# CONFIG_CDROM_PKTCDVD is not set
470# CONFIG_ATA_OVER_ETH is not set
471CONFIG_MISC_DEVICES=y
472CONFIG_ATMEL_PWM=y
473# CONFIG_EEPROM_93CX6 is not set
474CONFIG_ATMEL_SSC=y
475
476#
477# SCSI device support
478#
479# CONFIG_RAID_ATTRS is not set
480CONFIG_SCSI=y
481CONFIG_SCSI_DMA=y
482# CONFIG_SCSI_TGT is not set
483# CONFIG_SCSI_NETLINK is not set
484CONFIG_SCSI_PROC_FS=y
485
486#
487# SCSI support type (disk, tape, CD-ROM)
488#
489CONFIG_BLK_DEV_SD=y
490# CONFIG_CHR_DEV_ST is not set
491# CONFIG_CHR_DEV_OSST is not set
492# CONFIG_BLK_DEV_SR is not set
493# CONFIG_CHR_DEV_SG is not set
494# CONFIG_CHR_DEV_SCH is not set
495
496#
497# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
498#
499CONFIG_SCSI_MULTI_LUN=y
500# CONFIG_SCSI_CONSTANTS is not set
501# CONFIG_SCSI_LOGGING is not set
502# CONFIG_SCSI_SCAN_ASYNC is not set
503CONFIG_SCSI_WAIT_SCAN=m
504
505#
506# SCSI Transports
507#
508# CONFIG_SCSI_SPI_ATTRS is not set
509# CONFIG_SCSI_FC_ATTRS is not set
510# CONFIG_SCSI_ISCSI_ATTRS is not set
511# CONFIG_SCSI_SAS_LIBSAS is not set
512# CONFIG_SCSI_SRP_ATTRS is not set
513# CONFIG_SCSI_LOWLEVEL is not set
514# CONFIG_ATA is not set
515# CONFIG_MD is not set
516CONFIG_NETDEVICES=y
517# CONFIG_NETDEVICES_MULTIQUEUE is not set
518# CONFIG_DUMMY is not set
519# CONFIG_BONDING is not set
520# CONFIG_MACVLAN is not set
521# CONFIG_EQUALIZER is not set
522# CONFIG_TUN is not set
523# CONFIG_VETH is not set
524CONFIG_PHYLIB=y
525
526#
527# MII PHY device drivers
528#
529# CONFIG_MARVELL_PHY is not set
530# CONFIG_DAVICOM_PHY is not set
531# CONFIG_QSEMI_PHY is not set
532# CONFIG_LXT_PHY is not set
533# CONFIG_CICADA_PHY is not set
534# CONFIG_VITESSE_PHY is not set
535# CONFIG_SMSC_PHY is not set
536# CONFIG_BROADCOM_PHY is not set
537# CONFIG_ICPLUS_PHY is not set
538# CONFIG_FIXED_PHY is not set
539# CONFIG_MDIO_BITBANG is not set
540CONFIG_NET_ETHERNET=y
541CONFIG_MII=y
542CONFIG_MACB=y
543# CONFIG_AX88796 is not set
544# CONFIG_SMC91X is not set
545# CONFIG_DM9000 is not set
546# CONFIG_IBM_NEW_EMAC_ZMII is not set
547# CONFIG_IBM_NEW_EMAC_RGMII is not set
548# CONFIG_IBM_NEW_EMAC_TAH is not set
549# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
550# CONFIG_B44 is not set
551# CONFIG_NETDEV_1000 is not set
552# CONFIG_NETDEV_10000 is not set
553
554#
555# Wireless LAN
556#
557# CONFIG_WLAN_PRE80211 is not set
558# CONFIG_WLAN_80211 is not set
559
560#
561# USB Network Adapters
562#
563# CONFIG_USB_CATC is not set
564# CONFIG_USB_KAWETH is not set
565# CONFIG_USB_PEGASUS is not set
566# CONFIG_USB_RTL8150 is not set
567# CONFIG_USB_USBNET is not set
568# CONFIG_WAN is not set
569# CONFIG_PPP is not set
570# CONFIG_SLIP is not set
571# CONFIG_SHAPER is not set
572# CONFIG_NETCONSOLE is not set
573# CONFIG_NETPOLL is not set
574# CONFIG_NET_POLL_CONTROLLER is not set
575# CONFIG_ISDN is not set
576
577#
578# Input device support
579#
580CONFIG_INPUT=y
581# CONFIG_INPUT_FF_MEMLESS is not set
582# CONFIG_INPUT_POLLDEV is not set
583
584#
585# Userland interfaces
586#
587CONFIG_INPUT_MOUSEDEV=y
588# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
589CONFIG_INPUT_MOUSEDEV_SCREEN_X=320
590CONFIG_INPUT_MOUSEDEV_SCREEN_Y=240
591# CONFIG_INPUT_JOYDEV is not set
592CONFIG_INPUT_EVDEV=y
593# CONFIG_INPUT_EVBUG is not set
594
595#
596# Input Device Drivers
597#
598CONFIG_INPUT_KEYBOARD=y
599# CONFIG_KEYBOARD_ATKBD is not set
600# CONFIG_KEYBOARD_SUNKBD is not set
601# CONFIG_KEYBOARD_LKKBD is not set
602# CONFIG_KEYBOARD_XTKBD is not set
603# CONFIG_KEYBOARD_NEWTON is not set
604# CONFIG_KEYBOARD_STOWAWAY is not set
605CONFIG_KEYBOARD_GPIO=y
606# CONFIG_INPUT_MOUSE is not set
607# CONFIG_INPUT_JOYSTICK is not set
608# CONFIG_INPUT_TABLET is not set
609# CONFIG_INPUT_TOUCHSCREEN is not set
610# CONFIG_INPUT_MISC is not set
611
612#
613# Hardware I/O ports
614#
615CONFIG_SERIO=y
616CONFIG_SERIO_SERPORT=y
617# CONFIG_SERIO_RAW is not set
618# CONFIG_GAMEPORT is not set
619
620#
621# Character devices
622#
623CONFIG_VT=y
624CONFIG_VT_CONSOLE=y
625CONFIG_HW_CONSOLE=y
626# CONFIG_VT_HW_CONSOLE_BINDING is not set
627# CONFIG_SERIAL_NONSTANDARD is not set
628
629#
630# Serial drivers
631#
632# CONFIG_SERIAL_8250 is not set
633
634#
635# Non-8250 serial port support
636#
637CONFIG_SERIAL_ATMEL=y
638CONFIG_SERIAL_ATMEL_CONSOLE=y
639# CONFIG_SERIAL_ATMEL_TTYAT is not set
640CONFIG_SERIAL_CORE=y
641CONFIG_SERIAL_CORE_CONSOLE=y
642CONFIG_UNIX98_PTYS=y
643CONFIG_LEGACY_PTYS=y
644CONFIG_LEGACY_PTY_COUNT=16
645# CONFIG_IPMI_HANDLER is not set
646CONFIG_HW_RANDOM=y
647# CONFIG_NVRAM is not set
648# CONFIG_R3964 is not set
649# CONFIG_RAW_DRIVER is not set
650# CONFIG_TCG_TPM is not set
651# CONFIG_I2C is not set
652
653#
654# SPI support
655#
656CONFIG_SPI=y
657CONFIG_SPI_MASTER=y
658
659#
660# SPI Master Controller Drivers
661#
662CONFIG_SPI_ATMEL=y
663# CONFIG_SPI_BITBANG is not set
664
665#
666# SPI Protocol Masters
667#
668# CONFIG_SPI_AT25 is not set
669CONFIG_SPI_SPIDEV=y
670# CONFIG_SPI_TLE62X0 is not set
671# CONFIG_W1 is not set
672# CONFIG_POWER_SUPPLY is not set
673# CONFIG_HWMON is not set
674# CONFIG_WATCHDOG is not set
675
676#
677# Sonics Silicon Backplane
678#
679CONFIG_SSB_POSSIBLE=y
680# CONFIG_SSB is not set
681
682#
683# Multifunction device drivers
684#
685# CONFIG_MFD_SM501 is not set
686
687#
688# Multimedia devices
689#
690# CONFIG_VIDEO_DEV is not set
691# CONFIG_DVB_CORE is not set
692# CONFIG_DAB is not set
693
694#
695# Graphics support
696#
697# CONFIG_VGASTATE is not set
698# CONFIG_VIDEO_OUTPUT_CONTROL is not set
699# CONFIG_FB is not set
700# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
701
702#
703# Display device support
704#
705# CONFIG_DISPLAY_SUPPORT is not set
706
707#
708# Console display driver support
709#
710# CONFIG_VGA_CONSOLE is not set
711CONFIG_DUMMY_CONSOLE=y
712
713#
714# Sound
715#
716CONFIG_SOUND=y
717
718#
719# Advanced Linux Sound Architecture
720#
721CONFIG_SND=y
722CONFIG_SND_TIMER=y
723CONFIG_SND_PCM=y
724CONFIG_SND_SEQUENCER=y
725# CONFIG_SND_SEQ_DUMMY is not set
726CONFIG_SND_OSSEMUL=y
727CONFIG_SND_MIXER_OSS=y
728CONFIG_SND_PCM_OSS=y
729CONFIG_SND_PCM_OSS_PLUGINS=y
730CONFIG_SND_SEQUENCER_OSS=y
731# CONFIG_SND_DYNAMIC_MINORS is not set
732CONFIG_SND_SUPPORT_OLD_API=y
733# CONFIG_SND_VERBOSE_PROCFS is not set
734# CONFIG_SND_VERBOSE_PRINTK is not set
735# CONFIG_SND_DEBUG is not set
736
737#
738# Generic devices
739#
740# CONFIG_SND_DUMMY is not set
741# CONFIG_SND_VIRMIDI is not set
742# CONFIG_SND_MTPAV is not set
743# CONFIG_SND_SERIAL_U16550 is not set
744# CONFIG_SND_MPU401 is not set
745
746#
747# ALSA ARM devices
748#
749# CONFIG_SND_AT91_AC97 is not set
750
751#
752# SPI devices
753#
754CONFIG_SND_AT73C213=y
755CONFIG_SND_AT73C213_TARGET_BITRATE=48000
756
757#
758# USB devices
759#
760# CONFIG_SND_USB_AUDIO is not set
761# CONFIG_SND_USB_CAIAQ is not set
762
763#
764# System on Chip audio support
765#
766# CONFIG_SND_SOC is not set
767
768#
769# SoC Audio support for SuperH
770#
771
772#
773# Open Sound System
774#
775# CONFIG_SOUND_PRIME is not set
776CONFIG_HID_SUPPORT=y
777CONFIG_HID=y
778# CONFIG_HID_DEBUG is not set
779# CONFIG_HIDRAW is not set
780
781#
782# USB Input Devices
783#
784CONFIG_USB_HID=y
785# CONFIG_USB_HIDINPUT_POWERBOOK is not set
786# CONFIG_HID_FF is not set
787# CONFIG_USB_HIDDEV is not set
788CONFIG_USB_SUPPORT=y
789CONFIG_USB_ARCH_HAS_HCD=y
790CONFIG_USB_ARCH_HAS_OHCI=y
791# CONFIG_USB_ARCH_HAS_EHCI is not set
792CONFIG_USB=y
793# CONFIG_USB_DEBUG is not set
794
795#
796# Miscellaneous USB options
797#
798CONFIG_USB_DEVICEFS=y
799# CONFIG_USB_DEVICE_CLASS is not set
800# CONFIG_USB_DYNAMIC_MINORS is not set
801# CONFIG_USB_SUSPEND is not set
802# CONFIG_USB_PERSIST is not set
803# CONFIG_USB_OTG is not set
804
805#
806# USB Host Controller Drivers
807#
808# CONFIG_USB_ISP116X_HCD is not set
809CONFIG_USB_OHCI_HCD=y
810# CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set
811# CONFIG_USB_OHCI_BIG_ENDIAN_MMIO is not set
812CONFIG_USB_OHCI_LITTLE_ENDIAN=y
813# CONFIG_USB_SL811_HCD is not set
814# CONFIG_USB_R8A66597_HCD is not set
815
816#
817# USB Device Class drivers
818#
819# CONFIG_USB_ACM is not set
820# CONFIG_USB_PRINTER is not set
821
822#
823# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
824#
825
826#
827# may also be needed; see USB_STORAGE Help for more information
828#
829CONFIG_USB_STORAGE=y
830# CONFIG_USB_STORAGE_DEBUG is not set
831# CONFIG_USB_STORAGE_DATAFAB is not set
832# CONFIG_USB_STORAGE_FREECOM is not set
833# CONFIG_USB_STORAGE_ISD200 is not set
834# CONFIG_USB_STORAGE_DPCM is not set
835# CONFIG_USB_STORAGE_USBAT is not set
836# CONFIG_USB_STORAGE_SDDR09 is not set
837# CONFIG_USB_STORAGE_SDDR55 is not set
838# CONFIG_USB_STORAGE_JUMPSHOT is not set
839# CONFIG_USB_STORAGE_ALAUDA is not set
840# CONFIG_USB_STORAGE_KARMA is not set
841# CONFIG_USB_LIBUSUAL is not set
842
843#
844# USB Imaging devices
845#
846# CONFIG_USB_MDC800 is not set
847# CONFIG_USB_MICROTEK is not set
848CONFIG_USB_MON=y
849
850#
851# USB port drivers
852#
853
854#
855# USB Serial Converter support
856#
857# CONFIG_USB_SERIAL is not set
858
859#
860# USB Miscellaneous drivers
861#
862# CONFIG_USB_EMI62 is not set
863# CONFIG_USB_EMI26 is not set
864# CONFIG_USB_ADUTUX is not set
865# CONFIG_USB_AUERSWALD is not set
866# CONFIG_USB_RIO500 is not set
867# CONFIG_USB_LEGOTOWER is not set
868# CONFIG_USB_LCD is not set
869# CONFIG_USB_BERRY_CHARGE is not set
870# CONFIG_USB_LED is not set
871# CONFIG_USB_CYPRESS_CY7C63 is not set
872# CONFIG_USB_CYTHERM is not set
873# CONFIG_USB_PHIDGET is not set
874# CONFIG_USB_IDMOUSE is not set
875# CONFIG_USB_FTDI_ELAN is not set
876# CONFIG_USB_APPLEDISPLAY is not set
877# CONFIG_USB_LD is not set
878# CONFIG_USB_TRANCEVIBRATOR is not set
879# CONFIG_USB_IOWARRIOR is not set
880# CONFIG_USB_TEST is not set
881
882#
883# USB DSL modem support
884#
885
886#
887# USB Gadget Support
888#
889CONFIG_USB_GADGET=y
890# CONFIG_USB_GADGET_DEBUG_FILES is not set
891CONFIG_USB_GADGET_SELECTED=y
892# CONFIG_USB_GADGET_AMD5536UDC is not set
893# CONFIG_USB_GADGET_ATMEL_USBA is not set
894# CONFIG_USB_GADGET_FSL_USB2 is not set
895# CONFIG_USB_GADGET_NET2280 is not set
896# CONFIG_USB_GADGET_PXA2XX is not set
897# CONFIG_USB_GADGET_M66592 is not set
898# CONFIG_USB_GADGET_GOKU is not set
899# CONFIG_USB_GADGET_LH7A40X is not set
900# CONFIG_USB_GADGET_OMAP is not set
901# CONFIG_USB_GADGET_S3C2410 is not set
902CONFIG_USB_GADGET_AT91=y
903CONFIG_USB_AT91=y
904# CONFIG_USB_GADGET_DUMMY_HCD is not set
905# CONFIG_USB_GADGET_DUALSPEED is not set
906CONFIG_USB_ZERO=m
907# CONFIG_USB_ETH is not set
908CONFIG_USB_GADGETFS=m
909CONFIG_USB_FILE_STORAGE=m
910# CONFIG_USB_FILE_STORAGE_TEST is not set
911CONFIG_USB_G_SERIAL=m
912# CONFIG_USB_MIDI_GADGET is not set
913CONFIG_MMC=y
914# CONFIG_MMC_DEBUG is not set
915# CONFIG_MMC_UNSAFE_RESUME is not set
916
917#
918# MMC/SD Card Drivers
919#
920CONFIG_MMC_BLOCK=y
921CONFIG_MMC_BLOCK_BOUNCE=y
922# CONFIG_SDIO_UART is not set
923
924#
925# MMC/SD Host Controller Drivers
926#
927CONFIG_MMC_AT91=y
928# CONFIG_MMC_SPI is not set
929CONFIG_NEW_LEDS=y
930CONFIG_LEDS_CLASS=y
931
932#
933# LED drivers
934#
935CONFIG_LEDS_ATMEL_PWM=y
936CONFIG_LEDS_GPIO=y
937
938#
939# LED Triggers
940#
941CONFIG_LEDS_TRIGGERS=y
942CONFIG_LEDS_TRIGGER_TIMER=y
943CONFIG_LEDS_TRIGGER_HEARTBEAT=y
944CONFIG_RTC_LIB=y
945CONFIG_RTC_CLASS=y
946CONFIG_RTC_HCTOSYS=y
947CONFIG_RTC_HCTOSYS_DEVICE="rtc0"
948# CONFIG_RTC_DEBUG is not set
949
950#
951# RTC interfaces
952#
953CONFIG_RTC_INTF_SYSFS=y
954CONFIG_RTC_INTF_PROC=y
955CONFIG_RTC_INTF_DEV=y
956# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set
957# CONFIG_RTC_DRV_TEST is not set
958
959#
960# SPI RTC drivers
961#
962# CONFIG_RTC_DRV_RS5C348 is not set
963# CONFIG_RTC_DRV_MAX6902 is not set
964
965#
966# Platform RTC drivers
967#
968# CONFIG_RTC_DRV_CMOS is not set
969# CONFIG_RTC_DRV_DS1553 is not set
970# CONFIG_RTC_DRV_STK17TA8 is not set
971# CONFIG_RTC_DRV_DS1742 is not set
972# CONFIG_RTC_DRV_M48T86 is not set
973# CONFIG_RTC_DRV_M48T59 is not set
974# CONFIG_RTC_DRV_V3020 is not set
975
976#
977# on-CPU RTC drivers
978#
979CONFIG_RTC_DRV_AT91SAM9=y
980CONFIG_RTC_DRV_AT91SAM9_RTT=0
981CONFIG_RTC_DRV_AT91SAM9_GPBR=0
982
983#
984# File systems
985#
986CONFIG_EXT2_FS=y
987# CONFIG_EXT2_FS_XATTR is not set
988# CONFIG_EXT2_FS_XIP is not set
989# CONFIG_EXT3_FS is not set
990# CONFIG_EXT4DEV_FS is not set
991# CONFIG_REISERFS_FS is not set
992# CONFIG_JFS_FS is not set
993# CONFIG_FS_POSIX_ACL is not set
994# CONFIG_XFS_FS is not set
995# CONFIG_GFS2_FS is not set
996# CONFIG_OCFS2_FS is not set
997# CONFIG_MINIX_FS is not set
998# CONFIG_ROMFS_FS is not set
999CONFIG_INOTIFY=y
1000CONFIG_INOTIFY_USER=y
1001# CONFIG_QUOTA is not set
1002CONFIG_DNOTIFY=y
1003# CONFIG_AUTOFS_FS is not set
1004# CONFIG_AUTOFS4_FS is not set
1005# CONFIG_FUSE_FS is not set
1006
1007#
1008# CD-ROM/DVD Filesystems
1009#
1010# CONFIG_ISO9660_FS is not set
1011# CONFIG_UDF_FS is not set
1012
1013#
1014# DOS/FAT/NT Filesystems
1015#
1016CONFIG_FAT_FS=y
1017CONFIG_MSDOS_FS=y
1018CONFIG_VFAT_FS=y
1019CONFIG_FAT_DEFAULT_CODEPAGE=437
1020CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
1021# CONFIG_NTFS_FS is not set
1022
1023#
1024# Pseudo filesystems
1025#
1026CONFIG_PROC_FS=y
1027CONFIG_PROC_SYSCTL=y
1028CONFIG_SYSFS=y
1029CONFIG_TMPFS=y
1030# CONFIG_TMPFS_POSIX_ACL is not set
1031# CONFIG_HUGETLB_PAGE is not set
1032# CONFIG_CONFIGFS_FS is not set
1033
1034#
1035# Miscellaneous filesystems
1036#
1037# CONFIG_ADFS_FS is not set
1038# CONFIG_AFFS_FS is not set
1039# CONFIG_HFS_FS is not set
1040# CONFIG_HFSPLUS_FS is not set
1041# CONFIG_BEFS_FS is not set
1042# CONFIG_BFS_FS is not set
1043# CONFIG_EFS_FS is not set
1044CONFIG_JFFS2_FS=y
1045CONFIG_JFFS2_FS_DEBUG=0
1046CONFIG_JFFS2_FS_WRITEBUFFER=y
1047# CONFIG_JFFS2_FS_WBUF_VERIFY is not set
1048CONFIG_JFFS2_SUMMARY=y
1049# CONFIG_JFFS2_FS_XATTR is not set
1050# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set
1051CONFIG_JFFS2_ZLIB=y
1052# CONFIG_JFFS2_LZO is not set
1053CONFIG_JFFS2_RTIME=y
1054# CONFIG_JFFS2_RUBIN is not set
1055CONFIG_CRAMFS=y
1056# CONFIG_VXFS_FS is not set
1057# CONFIG_HPFS_FS is not set
1058# CONFIG_QNX4FS_FS is not set
1059# CONFIG_SYSV_FS is not set
1060# CONFIG_UFS_FS is not set
1061CONFIG_NETWORK_FILESYSTEMS=y
1062CONFIG_NFS_FS=y
1063CONFIG_NFS_V3=y
1064# CONFIG_NFS_V3_ACL is not set
1065# CONFIG_NFS_V4 is not set
1066# CONFIG_NFS_DIRECTIO is not set
1067# CONFIG_NFSD is not set
1068CONFIG_ROOT_NFS=y
1069CONFIG_LOCKD=y
1070CONFIG_LOCKD_V4=y
1071CONFIG_NFS_COMMON=y
1072CONFIG_SUNRPC=y
1073# CONFIG_SUNRPC_BIND34 is not set
1074# CONFIG_RPCSEC_GSS_KRB5 is not set
1075# CONFIG_RPCSEC_GSS_SPKM3 is not set
1076# CONFIG_SMB_FS is not set
1077# CONFIG_CIFS is not set
1078# CONFIG_NCP_FS is not set
1079# CONFIG_CODA_FS is not set
1080# CONFIG_AFS_FS is not set
1081
1082#
1083# Partition Types
1084#
1085# CONFIG_PARTITION_ADVANCED is not set
1086CONFIG_MSDOS_PARTITION=y
1087CONFIG_NLS=y
1088CONFIG_NLS_DEFAULT="iso8859-1"
1089CONFIG_NLS_CODEPAGE_437=y
1090# CONFIG_NLS_CODEPAGE_737 is not set
1091# CONFIG_NLS_CODEPAGE_775 is not set
1092CONFIG_NLS_CODEPAGE_850=y
1093# CONFIG_NLS_CODEPAGE_852 is not set
1094# CONFIG_NLS_CODEPAGE_855 is not set
1095# CONFIG_NLS_CODEPAGE_857 is not set
1096# CONFIG_NLS_CODEPAGE_860 is not set
1097# CONFIG_NLS_CODEPAGE_861 is not set
1098# CONFIG_NLS_CODEPAGE_862 is not set
1099# CONFIG_NLS_CODEPAGE_863 is not set
1100# CONFIG_NLS_CODEPAGE_864 is not set
1101# CONFIG_NLS_CODEPAGE_865 is not set
1102# CONFIG_NLS_CODEPAGE_866 is not set
1103# CONFIG_NLS_CODEPAGE_869 is not set
1104# CONFIG_NLS_CODEPAGE_936 is not set
1105# CONFIG_NLS_CODEPAGE_950 is not set
1106# CONFIG_NLS_CODEPAGE_932 is not set
1107# CONFIG_NLS_CODEPAGE_949 is not set
1108# CONFIG_NLS_CODEPAGE_874 is not set
1109# CONFIG_NLS_ISO8859_8 is not set
1110# CONFIG_NLS_CODEPAGE_1250 is not set
1111# CONFIG_NLS_CODEPAGE_1251 is not set
1112# CONFIG_NLS_ASCII is not set
1113CONFIG_NLS_ISO8859_1=y
1114# CONFIG_NLS_ISO8859_2 is not set
1115# CONFIG_NLS_ISO8859_3 is not set
1116# CONFIG_NLS_ISO8859_4 is not set
1117# CONFIG_NLS_ISO8859_5 is not set
1118# CONFIG_NLS_ISO8859_6 is not set
1119# CONFIG_NLS_ISO8859_7 is not set
1120# CONFIG_NLS_ISO8859_9 is not set
1121# CONFIG_NLS_ISO8859_13 is not set
1122# CONFIG_NLS_ISO8859_14 is not set
1123CONFIG_NLS_ISO8859_15=y
1124# CONFIG_NLS_KOI8_R is not set
1125# CONFIG_NLS_KOI8_U is not set
1126CONFIG_NLS_UTF8=y
1127# CONFIG_DLM is not set
1128# CONFIG_INSTRUMENTATION is not set
1129
1130#
1131# Kernel hacking
1132#
1133# CONFIG_PRINTK_TIME is not set
1134# CONFIG_ENABLE_WARN_DEPRECATED is not set
1135CONFIG_ENABLE_MUST_CHECK=y
1136# CONFIG_MAGIC_SYSRQ is not set
1137# CONFIG_UNUSED_SYMBOLS is not set
1138# CONFIG_DEBUG_FS is not set
1139# CONFIG_HEADERS_CHECK is not set
1140# CONFIG_DEBUG_KERNEL is not set
1141CONFIG_DEBUG_BUGVERBOSE=y
1142CONFIG_FRAME_POINTER=y
1143# CONFIG_SAMPLES is not set
1144# CONFIG_DEBUG_USER is not set
1145
1146#
1147# Security options
1148#
1149# CONFIG_KEYS is not set
1150# CONFIG_SECURITY is not set
1151# CONFIG_SECURITY_FILE_CAPABILITIES is not set
1152# CONFIG_CRYPTO is not set
1153
1154#
1155# Library routines
1156#
1157CONFIG_BITREVERSE=y
1158# CONFIG_CRC_CCITT is not set
1159# CONFIG_CRC16 is not set
1160# CONFIG_CRC_ITU_T is not set
1161CONFIG_CRC32=y
1162# CONFIG_CRC7 is not set
1163# CONFIG_LIBCRC32C is not set
1164CONFIG_ZLIB_INFLATE=y
1165CONFIG_ZLIB_DEFLATE=y
1166CONFIG_PLIST=y
1167CONFIG_HAS_IOMEM=y
1168CONFIG_HAS_IOPORT=y
diff --git a/arch/arm/configs/at91sam9rlek_defconfig b/arch/arm/configs/at91sam9rlek_defconfig
index 98e6746d02be..d8ec5f9ca6ec 100644
--- a/arch/arm/configs/at91sam9rlek_defconfig
+++ b/arch/arm/configs/at91sam9rlek_defconfig
@@ -211,7 +211,6 @@ CONFIG_CPU_CP15_MMU=y
211# 211#
212# CONFIG_TICK_ONESHOT is not set 212# CONFIG_TICK_ONESHOT is not set
213# CONFIG_PREEMPT is not set 213# CONFIG_PREEMPT is not set
214# CONFIG_NO_IDLE_HZ is not set
215CONFIG_HZ=100 214CONFIG_HZ=100
216# CONFIG_AEABI is not set 215# CONFIG_AEABI is not set
217# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set 216# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set
diff --git a/arch/arm/configs/ateb9200_defconfig b/arch/arm/configs/ateb9200_defconfig
index d846a492e5ce..85c80f723d8e 100644
--- a/arch/arm/configs/ateb9200_defconfig
+++ b/arch/arm/configs/ateb9200_defconfig
@@ -171,7 +171,6 @@ CONFIG_AT91_CF=m
171# Kernel Features 171# Kernel Features
172# 172#
173CONFIG_PREEMPT=y 173CONFIG_PREEMPT=y
174CONFIG_NO_IDLE_HZ=y
175CONFIG_HZ=100 174CONFIG_HZ=100
176# CONFIG_AEABI is not set 175# CONFIG_AEABI is not set
177# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set 176# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set
diff --git a/arch/arm/configs/cm_x270_defconfig b/arch/arm/configs/cm_x270_defconfig
index 5cab08397ae7..33b201c3b309 100644
--- a/arch/arm/configs/cm_x270_defconfig
+++ b/arch/arm/configs/cm_x270_defconfig
@@ -194,7 +194,6 @@ CONFIG_PCI_HOST_ITE8152=y
194# 194#
195# CONFIG_TICK_ONESHOT is not set 195# CONFIG_TICK_ONESHOT is not set
196# CONFIG_PREEMPT is not set 196# CONFIG_PREEMPT is not set
197# CONFIG_NO_IDLE_HZ is not set
198CONFIG_HZ=100 197CONFIG_HZ=100
199# CONFIG_AEABI is not set 198# CONFIG_AEABI is not set
200# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set 199# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set
diff --git a/arch/arm/configs/collie_defconfig b/arch/arm/configs/collie_defconfig
index 4264e273202d..f7622e658163 100644
--- a/arch/arm/configs/collie_defconfig
+++ b/arch/arm/configs/collie_defconfig
@@ -166,7 +166,6 @@ CONFIG_PCMCIA_SA1100=y
166# Kernel Features 166# Kernel Features
167# 167#
168# CONFIG_PREEMPT is not set 168# CONFIG_PREEMPT is not set
169# CONFIG_NO_IDLE_HZ is not set
170CONFIG_HZ=100 169CONFIG_HZ=100
171# CONFIG_AEABI is not set 170# CONFIG_AEABI is not set
172CONFIG_ARCH_DISCONTIGMEM_ENABLE=y 171CONFIG_ARCH_DISCONTIGMEM_ENABLE=y
diff --git a/arch/arm/configs/corgi_defconfig b/arch/arm/configs/corgi_defconfig
index e8980a9bb893..9b8748a8d9dd 100644
--- a/arch/arm/configs/corgi_defconfig
+++ b/arch/arm/configs/corgi_defconfig
@@ -165,7 +165,6 @@ CONFIG_PCMCIA_PXA2XX=y
165# Kernel Features 165# Kernel Features
166# 166#
167CONFIG_PREEMPT=y 167CONFIG_PREEMPT=y
168# CONFIG_NO_IDLE_HZ is not set
169# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set 168# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set
170CONFIG_SELECT_MEMORY_MODEL=y 169CONFIG_SELECT_MEMORY_MODEL=y
171CONFIG_FLATMEM_MANUAL=y 170CONFIG_FLATMEM_MANUAL=y
diff --git a/arch/arm/configs/ecbat91_defconfig b/arch/arm/configs/ecbat91_defconfig
index 90ed214e3673..cfeb817ad21a 100644
--- a/arch/arm/configs/ecbat91_defconfig
+++ b/arch/arm/configs/ecbat91_defconfig
@@ -230,7 +230,6 @@ CONFIG_AT91_CF=y
230# 230#
231# CONFIG_TICK_ONESHOT is not set 231# CONFIG_TICK_ONESHOT is not set
232CONFIG_PREEMPT=y 232CONFIG_PREEMPT=y
233# CONFIG_NO_IDLE_HZ is not set
234CONFIG_HZ=100 233CONFIG_HZ=100
235# CONFIG_AEABI is not set 234# CONFIG_AEABI is not set
236# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set 235# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set
diff --git a/arch/arm/configs/em_x270_defconfig b/arch/arm/configs/em_x270_defconfig
index 6bea0901bdf0..d3114c23603b 100644
--- a/arch/arm/configs/em_x270_defconfig
+++ b/arch/arm/configs/em_x270_defconfig
@@ -197,7 +197,6 @@ CONFIG_XSCALE_PMU=y
197# 197#
198# CONFIG_TICK_ONESHOT is not set 198# CONFIG_TICK_ONESHOT is not set
199# CONFIG_PREEMPT is not set 199# CONFIG_PREEMPT is not set
200# CONFIG_NO_IDLE_HZ is not set
201CONFIG_HZ=100 200CONFIG_HZ=100
202CONFIG_AEABI=y 201CONFIG_AEABI=y
203CONFIG_OABI_COMPAT=y 202CONFIG_OABI_COMPAT=y
diff --git a/arch/arm/configs/ep93xx_defconfig b/arch/arm/configs/ep93xx_defconfig
index 24a701ab33e5..21aa013793c6 100644
--- a/arch/arm/configs/ep93xx_defconfig
+++ b/arch/arm/configs/ep93xx_defconfig
@@ -184,7 +184,6 @@ CONFIG_ARM_AMBA=y
184# Kernel Features 184# Kernel Features
185# 185#
186# CONFIG_PREEMPT is not set 186# CONFIG_PREEMPT is not set
187# CONFIG_NO_IDLE_HZ is not set
188CONFIG_HZ=100 187CONFIG_HZ=100
189# CONFIG_AEABI is not set 188# CONFIG_AEABI is not set
190# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set 189# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set
diff --git a/arch/arm/configs/eseries_pxa_defconfig b/arch/arm/configs/eseries_pxa_defconfig
index ed487b90dbed..493ecee24f94 100644
--- a/arch/arm/configs/eseries_pxa_defconfig
+++ b/arch/arm/configs/eseries_pxa_defconfig
@@ -251,7 +251,6 @@ CONFIG_PCMCIA_PXA2XX=m
251# Kernel Features 251# Kernel Features
252# 252#
253# CONFIG_PREEMPT is not set 253# CONFIG_PREEMPT is not set
254# CONFIG_NO_IDLE_HZ is not set
255CONFIG_HZ=100 254CONFIG_HZ=100
256CONFIG_AEABI=y 255CONFIG_AEABI=y
257CONFIG_OABI_COMPAT=y 256CONFIG_OABI_COMPAT=y
diff --git a/arch/arm/configs/iop13xx_defconfig b/arch/arm/configs/iop13xx_defconfig
index 988b4d13e76f..482e57061053 100644
--- a/arch/arm/configs/iop13xx_defconfig
+++ b/arch/arm/configs/iop13xx_defconfig
@@ -197,7 +197,6 @@ CONFIG_PCI_LEGACY=y
197# 197#
198# CONFIG_TICK_ONESHOT is not set 198# CONFIG_TICK_ONESHOT is not set
199# CONFIG_PREEMPT is not set 199# CONFIG_PREEMPT is not set
200# CONFIG_NO_IDLE_HZ is not set
201CONFIG_HZ=100 200CONFIG_HZ=100
202# CONFIG_AEABI is not set 201# CONFIG_AEABI is not set
203# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set 202# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set
diff --git a/arch/arm/configs/iop32x_defconfig b/arch/arm/configs/iop32x_defconfig
index 83f40d4041a6..8612f58e1056 100644
--- a/arch/arm/configs/iop32x_defconfig
+++ b/arch/arm/configs/iop32x_defconfig
@@ -201,7 +201,6 @@ CONFIG_PCI_LEGACY=y
201# 201#
202# CONFIG_TICK_ONESHOT is not set 202# CONFIG_TICK_ONESHOT is not set
203# CONFIG_PREEMPT is not set 203# CONFIG_PREEMPT is not set
204# CONFIG_NO_IDLE_HZ is not set
205CONFIG_HZ=100 204CONFIG_HZ=100
206# CONFIG_AEABI is not set 205# CONFIG_AEABI is not set
207# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set 206# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set
diff --git a/arch/arm/configs/iop33x_defconfig b/arch/arm/configs/iop33x_defconfig
index 917afb5ccfac..8b0098d19d08 100644
--- a/arch/arm/configs/iop33x_defconfig
+++ b/arch/arm/configs/iop33x_defconfig
@@ -197,7 +197,6 @@ CONFIG_PCI_LEGACY=y
197# 197#
198# CONFIG_TICK_ONESHOT is not set 198# CONFIG_TICK_ONESHOT is not set
199# CONFIG_PREEMPT is not set 199# CONFIG_PREEMPT is not set
200# CONFIG_NO_IDLE_HZ is not set
201CONFIG_HZ=100 200CONFIG_HZ=100
202# CONFIG_AEABI is not set 201# CONFIG_AEABI is not set
203# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set 202# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set
diff --git a/arch/arm/configs/ixp2000_defconfig b/arch/arm/configs/ixp2000_defconfig
index f8f9793b526f..84680db6c615 100644
--- a/arch/arm/configs/ixp2000_defconfig
+++ b/arch/arm/configs/ixp2000_defconfig
@@ -184,7 +184,6 @@ CONFIG_PCI=y
184# Kernel Features 184# Kernel Features
185# 185#
186# CONFIG_PREEMPT is not set 186# CONFIG_PREEMPT is not set
187# CONFIG_NO_IDLE_HZ is not set
188CONFIG_HZ=100 187CONFIG_HZ=100
189# CONFIG_AEABI is not set 188# CONFIG_AEABI is not set
190# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set 189# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set
diff --git a/arch/arm/configs/ixp23xx_defconfig b/arch/arm/configs/ixp23xx_defconfig
index 27cf022dd807..4a2f7b2372db 100644
--- a/arch/arm/configs/ixp23xx_defconfig
+++ b/arch/arm/configs/ixp23xx_defconfig
@@ -180,7 +180,6 @@ CONFIG_PCI=y
180# Kernel Features 180# Kernel Features
181# 181#
182# CONFIG_PREEMPT is not set 182# CONFIG_PREEMPT is not set
183# CONFIG_NO_IDLE_HZ is not set
184CONFIG_HZ=100 183CONFIG_HZ=100
185# CONFIG_AEABI is not set 184# CONFIG_AEABI is not set
186# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set 185# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set
diff --git a/arch/arm/configs/ixp4xx_defconfig b/arch/arm/configs/ixp4xx_defconfig
index efa0485d2f7e..fc14932e3abd 100644
--- a/arch/arm/configs/ixp4xx_defconfig
+++ b/arch/arm/configs/ixp4xx_defconfig
@@ -165,6 +165,7 @@ CONFIG_ARCH_PRPMC1100=y
165CONFIG_MACH_NAS100D=y 165CONFIG_MACH_NAS100D=y
166CONFIG_MACH_DSMG600=y 166CONFIG_MACH_DSMG600=y
167CONFIG_ARCH_IXDP4XX=y 167CONFIG_ARCH_IXDP4XX=y
168CONFIG_MACH_FSG=y
168CONFIG_CPU_IXP46X=y 169CONFIG_CPU_IXP46X=y
169CONFIG_CPU_IXP43X=y 170CONFIG_CPU_IXP43X=y
170CONFIG_MACH_GTWX5715=y 171CONFIG_MACH_GTWX5715=y
@@ -770,7 +771,7 @@ CONFIG_ATA=y
770# CONFIG_SATA_SIL24 is not set 771# CONFIG_SATA_SIL24 is not set
771# CONFIG_SATA_SIS is not set 772# CONFIG_SATA_SIS is not set
772# CONFIG_SATA_ULI is not set 773# CONFIG_SATA_ULI is not set
773# CONFIG_SATA_VIA is not set 774CONFIG_SATA_VIA=y
774# CONFIG_SATA_VITESSE is not set 775# CONFIG_SATA_VITESSE is not set
775# CONFIG_SATA_INIC162X is not set 776# CONFIG_SATA_INIC162X is not set
776# CONFIG_PATA_ALI is not set 777# CONFIG_PATA_ALI is not set
@@ -1143,7 +1144,7 @@ CONFIG_HWMON=y
1143# CONFIG_SENSORS_VIA686A is not set 1144# CONFIG_SENSORS_VIA686A is not set
1144# CONFIG_SENSORS_VT1211 is not set 1145# CONFIG_SENSORS_VT1211 is not set
1145# CONFIG_SENSORS_VT8231 is not set 1146# CONFIG_SENSORS_VT8231 is not set
1146# CONFIG_SENSORS_W83781D is not set 1147CONFIG_SENSORS_W83781D=y
1147# CONFIG_SENSORS_W83791D is not set 1148# CONFIG_SENSORS_W83791D is not set
1148# CONFIG_SENSORS_W83792D is not set 1149# CONFIG_SENSORS_W83792D is not set
1149# CONFIG_SENSORS_W83793 is not set 1150# CONFIG_SENSORS_W83793 is not set
@@ -1334,8 +1335,8 @@ CONFIG_LEDS_CLASS=y
1334# 1335#
1335# LED drivers 1336# LED drivers
1336# 1337#
1337# CONFIG_LEDS_IXP4XX is not set
1338CONFIG_LEDS_GPIO=y 1338CONFIG_LEDS_GPIO=y
1339CONFIG_LEDS_FSG=y
1339 1340
1340# 1341#
1341# LED Triggers 1342# LED Triggers
@@ -1367,7 +1368,7 @@ CONFIG_RTC_INTF_DEV=y
1367# CONFIG_RTC_DRV_DS1672 is not set 1368# CONFIG_RTC_DRV_DS1672 is not set
1368# CONFIG_RTC_DRV_MAX6900 is not set 1369# CONFIG_RTC_DRV_MAX6900 is not set
1369# CONFIG_RTC_DRV_RS5C372 is not set 1370# CONFIG_RTC_DRV_RS5C372 is not set
1370# CONFIG_RTC_DRV_ISL1208 is not set 1371CONFIG_RTC_DRV_ISL1208=y
1371CONFIG_RTC_DRV_X1205=y 1372CONFIG_RTC_DRV_X1205=y
1372CONFIG_RTC_DRV_PCF8563=y 1373CONFIG_RTC_DRV_PCF8563=y
1373# CONFIG_RTC_DRV_PCF8583 is not set 1374# CONFIG_RTC_DRV_PCF8583 is not set
diff --git a/arch/arm/configs/kafa_defconfig b/arch/arm/configs/kafa_defconfig
index ae51a40db6f9..6dd95a2c8d5d 100644
--- a/arch/arm/configs/kafa_defconfig
+++ b/arch/arm/configs/kafa_defconfig
@@ -162,7 +162,6 @@ CONFIG_CPU_TLB_V4WBI=y
162# Kernel Features 162# Kernel Features
163# 163#
164CONFIG_PREEMPT=y 164CONFIG_PREEMPT=y
165# CONFIG_NO_IDLE_HZ is not set
166CONFIG_HZ=100 165CONFIG_HZ=100
167# CONFIG_AEABI is not set 166# CONFIG_AEABI is not set
168# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set 167# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set
diff --git a/arch/arm/configs/kb9202_defconfig b/arch/arm/configs/kb9202_defconfig
index c16537d9d67a..8e74c66f239d 100644
--- a/arch/arm/configs/kb9202_defconfig
+++ b/arch/arm/configs/kb9202_defconfig
@@ -126,7 +126,6 @@ CONFIG_ISA_DMA_API=y
126# 126#
127# Kernel Features 127# Kernel Features
128# 128#
129# CONFIG_NO_IDLE_HZ is not set
130# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set 129# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set
131CONFIG_FLATMEM=y 130CONFIG_FLATMEM=y
132CONFIG_FLAT_NODE_MEM_MAP=y 131CONFIG_FLAT_NODE_MEM_MAP=y
diff --git a/arch/arm/configs/kirkwood_defconfig b/arch/arm/configs/kirkwood_defconfig
new file mode 100644
index 000000000000..e3357ba10f1f
--- /dev/null
+++ b/arch/arm/configs/kirkwood_defconfig
@@ -0,0 +1,1426 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.26-rc5
4# Sun Jun 22 15:51:25 2008
5#
6CONFIG_ARM=y
7CONFIG_SYS_SUPPORTS_APM_EMULATION=y
8CONFIG_GENERIC_GPIO=y
9CONFIG_GENERIC_TIME=y
10CONFIG_GENERIC_CLOCKEVENTS=y
11CONFIG_MMU=y
12# CONFIG_NO_IOPORT is not set
13CONFIG_GENERIC_HARDIRQS=y
14CONFIG_STACKTRACE_SUPPORT=y
15CONFIG_HAVE_LATENCYTOP_SUPPORT=y
16CONFIG_LOCKDEP_SUPPORT=y
17CONFIG_TRACE_IRQFLAGS_SUPPORT=y
18CONFIG_HARDIRQS_SW_RESEND=y
19CONFIG_GENERIC_IRQ_PROBE=y
20CONFIG_RWSEM_GENERIC_SPINLOCK=y
21# CONFIG_ARCH_HAS_ILOG2_U32 is not set
22# CONFIG_ARCH_HAS_ILOG2_U64 is not set
23CONFIG_GENERIC_HWEIGHT=y
24CONFIG_GENERIC_CALIBRATE_DELAY=y
25CONFIG_ARCH_SUPPORTS_AOUT=y
26CONFIG_ZONE_DMA=y
27CONFIG_VECTORS_BASE=0xffff0000
28CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
29
30#
31# General setup
32#
33CONFIG_EXPERIMENTAL=y
34CONFIG_BROKEN_ON_SMP=y
35CONFIG_LOCK_KERNEL=y
36CONFIG_INIT_ENV_ARG_LIMIT=32
37CONFIG_LOCALVERSION=""
38CONFIG_LOCALVERSION_AUTO=y
39CONFIG_SWAP=y
40CONFIG_SYSVIPC=y
41CONFIG_SYSVIPC_SYSCTL=y
42# CONFIG_POSIX_MQUEUE is not set
43# CONFIG_BSD_PROCESS_ACCT is not set
44# CONFIG_TASKSTATS is not set
45# CONFIG_AUDIT is not set
46# CONFIG_IKCONFIG is not set
47CONFIG_LOG_BUF_SHIFT=14
48# CONFIG_CGROUPS is not set
49# CONFIG_GROUP_SCHED is not set
50# CONFIG_SYSFS_DEPRECATED_V2 is not set
51# CONFIG_RELAY is not set
52# CONFIG_NAMESPACES is not set
53# CONFIG_BLK_DEV_INITRD is not set
54CONFIG_CC_OPTIMIZE_FOR_SIZE=y
55CONFIG_SYSCTL=y
56CONFIG_EMBEDDED=y
57CONFIG_UID16=y
58CONFIG_SYSCTL_SYSCALL=y
59CONFIG_SYSCTL_SYSCALL_CHECK=y
60CONFIG_KALLSYMS=y
61# CONFIG_KALLSYMS_ALL is not set
62# CONFIG_KALLSYMS_EXTRA_PASS is not set
63CONFIG_HOTPLUG=y
64CONFIG_PRINTK=y
65CONFIG_BUG=y
66CONFIG_ELF_CORE=y
67CONFIG_COMPAT_BRK=y
68CONFIG_BASE_FULL=y
69CONFIG_FUTEX=y
70CONFIG_ANON_INODES=y
71CONFIG_EPOLL=y
72CONFIG_SIGNALFD=y
73CONFIG_TIMERFD=y
74CONFIG_EVENTFD=y
75CONFIG_SHMEM=y
76CONFIG_VM_EVENT_COUNTERS=y
77CONFIG_SLAB=y
78# CONFIG_SLUB is not set
79# CONFIG_SLOB is not set
80CONFIG_PROFILING=y
81# CONFIG_MARKERS is not set
82CONFIG_OPROFILE=y
83CONFIG_HAVE_OPROFILE=y
84CONFIG_KPROBES=y
85CONFIG_KRETPROBES=y
86CONFIG_HAVE_KPROBES=y
87CONFIG_HAVE_KRETPROBES=y
88# CONFIG_HAVE_DMA_ATTRS is not set
89CONFIG_PROC_PAGE_MONITOR=y
90CONFIG_SLABINFO=y
91CONFIG_RT_MUTEXES=y
92# CONFIG_TINY_SHMEM is not set
93CONFIG_BASE_SMALL=0
94CONFIG_MODULES=y
95# CONFIG_MODULE_FORCE_LOAD is not set
96CONFIG_MODULE_UNLOAD=y
97# CONFIG_MODULE_FORCE_UNLOAD is not set
98# CONFIG_MODVERSIONS is not set
99# CONFIG_MODULE_SRCVERSION_ALL is not set
100# CONFIG_KMOD is not set
101CONFIG_BLOCK=y
102# CONFIG_LBD is not set
103# CONFIG_BLK_DEV_IO_TRACE is not set
104# CONFIG_LSF is not set
105# CONFIG_BLK_DEV_BSG is not set
106
107#
108# IO Schedulers
109#
110CONFIG_IOSCHED_NOOP=y
111CONFIG_IOSCHED_AS=y
112CONFIG_IOSCHED_DEADLINE=y
113CONFIG_IOSCHED_CFQ=y
114# CONFIG_DEFAULT_AS is not set
115# CONFIG_DEFAULT_DEADLINE is not set
116CONFIG_DEFAULT_CFQ=y
117# CONFIG_DEFAULT_NOOP is not set
118CONFIG_DEFAULT_IOSCHED="cfq"
119CONFIG_CLASSIC_RCU=y
120
121#
122# System Type
123#
124# CONFIG_ARCH_AAEC2000 is not set
125# CONFIG_ARCH_INTEGRATOR is not set
126# CONFIG_ARCH_REALVIEW is not set
127# CONFIG_ARCH_VERSATILE is not set
128# CONFIG_ARCH_AT91 is not set
129# CONFIG_ARCH_CLPS7500 is not set
130# CONFIG_ARCH_CLPS711X is not set
131# CONFIG_ARCH_CO285 is not set
132# CONFIG_ARCH_EBSA110 is not set
133# CONFIG_ARCH_EP93XX is not set
134# CONFIG_ARCH_FOOTBRIDGE is not set
135# CONFIG_ARCH_NETX is not set
136# CONFIG_ARCH_H720X is not set
137# CONFIG_ARCH_IMX is not set
138# CONFIG_ARCH_IOP13XX is not set
139# CONFIG_ARCH_IOP32X is not set
140# CONFIG_ARCH_IOP33X is not set
141# CONFIG_ARCH_IXP23XX is not set
142# CONFIG_ARCH_IXP2000 is not set
143# CONFIG_ARCH_IXP4XX is not set
144# CONFIG_ARCH_L7200 is not set
145CONFIG_ARCH_KIRKWOOD=y
146# CONFIG_ARCH_KS8695 is not set
147# CONFIG_ARCH_NS9XXX is not set
148# CONFIG_ARCH_LOKI is not set
149# CONFIG_ARCH_MV78XX0 is not set
150# CONFIG_ARCH_MXC is not set
151# CONFIG_ARCH_ORION5X is not set
152# CONFIG_ARCH_PNX4008 is not set
153# CONFIG_ARCH_PXA is not set
154# CONFIG_ARCH_RPC is not set
155# CONFIG_ARCH_SA1100 is not set
156# CONFIG_ARCH_S3C2410 is not set
157# CONFIG_ARCH_SHARK is not set
158# CONFIG_ARCH_LH7A40X is not set
159# CONFIG_ARCH_DAVINCI is not set
160# CONFIG_ARCH_OMAP is not set
161# CONFIG_ARCH_MSM7X00A is not set
162
163#
164# Marvell Kirkwood Implementations
165#
166CONFIG_MACH_DB88F6281_BP=y
167CONFIG_MACH_RD88F6192_NAS=y
168CONFIG_MACH_RD88F6281=y
169
170#
171# Boot options
172#
173
174#
175# Power management
176#
177CONFIG_PLAT_ORION=y
178
179#
180# Processor Type
181#
182CONFIG_CPU_32=y
183CONFIG_CPU_FEROCEON=y
184# CONFIG_CPU_FEROCEON_OLD_ID is not set
185CONFIG_CPU_32v5=y
186CONFIG_CPU_ABRT_EV5T=y
187CONFIG_CPU_PABRT_NOIFAR=y
188CONFIG_CPU_CACHE_VIVT=y
189CONFIG_CPU_COPY_FEROCEON=y
190CONFIG_CPU_TLB_FEROCEON=y
191CONFIG_CPU_CP15=y
192CONFIG_CPU_CP15_MMU=y
193
194#
195# Processor Features
196#
197CONFIG_ARM_THUMB=y
198# CONFIG_CPU_ICACHE_DISABLE is not set
199# CONFIG_CPU_DCACHE_DISABLE is not set
200CONFIG_OUTER_CACHE=y
201CONFIG_CACHE_FEROCEON_L2=y
202
203#
204# Bus support
205#
206CONFIG_PCI=y
207CONFIG_PCI_SYSCALL=y
208# CONFIG_ARCH_SUPPORTS_MSI is not set
209CONFIG_PCI_LEGACY=y
210# CONFIG_PCI_DEBUG is not set
211# CONFIG_PCCARD is not set
212
213#
214# Kernel Features
215#
216CONFIG_TICK_ONESHOT=y
217CONFIG_NO_HZ=y
218CONFIG_HIGH_RES_TIMERS=y
219CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
220CONFIG_PREEMPT=y
221CONFIG_HZ=100
222CONFIG_AEABI=y
223# CONFIG_OABI_COMPAT is not set
224# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set
225CONFIG_SELECT_MEMORY_MODEL=y
226CONFIG_FLATMEM_MANUAL=y
227# CONFIG_DISCONTIGMEM_MANUAL is not set
228# CONFIG_SPARSEMEM_MANUAL is not set
229CONFIG_FLATMEM=y
230CONFIG_FLAT_NODE_MEM_MAP=y
231# CONFIG_SPARSEMEM_STATIC is not set
232# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
233CONFIG_PAGEFLAGS_EXTENDED=y
234CONFIG_SPLIT_PTLOCK_CPUS=4096
235# CONFIG_RESOURCES_64BIT is not set
236CONFIG_ZONE_DMA_FLAG=1
237CONFIG_BOUNCE=y
238CONFIG_VIRT_TO_BUS=y
239CONFIG_ALIGNMENT_TRAP=y
240
241#
242# Boot options
243#
244CONFIG_ZBOOT_ROM_TEXT=0x0
245CONFIG_ZBOOT_ROM_BSS=0x0
246CONFIG_CMDLINE=""
247# CONFIG_XIP_KERNEL is not set
248# CONFIG_KEXEC is not set
249
250#
251# Floating point emulation
252#
253
254#
255# At least one emulation must be selected
256#
257# CONFIG_VFP is not set
258
259#
260# Userspace binary formats
261#
262CONFIG_BINFMT_ELF=y
263# CONFIG_BINFMT_AOUT is not set
264# CONFIG_BINFMT_MISC is not set
265
266#
267# Power management options
268#
269# CONFIG_PM is not set
270CONFIG_ARCH_SUSPEND_POSSIBLE=y
271
272#
273# Networking
274#
275CONFIG_NET=y
276
277#
278# Networking options
279#
280CONFIG_PACKET=y
281CONFIG_PACKET_MMAP=y
282CONFIG_UNIX=y
283CONFIG_XFRM=y
284# CONFIG_XFRM_USER is not set
285# CONFIG_XFRM_SUB_POLICY is not set
286# CONFIG_XFRM_MIGRATE is not set
287# CONFIG_XFRM_STATISTICS is not set
288# CONFIG_NET_KEY is not set
289CONFIG_INET=y
290CONFIG_IP_MULTICAST=y
291# CONFIG_IP_ADVANCED_ROUTER is not set
292CONFIG_IP_FIB_HASH=y
293CONFIG_IP_PNP=y
294CONFIG_IP_PNP_DHCP=y
295CONFIG_IP_PNP_BOOTP=y
296# CONFIG_IP_PNP_RARP is not set
297# CONFIG_NET_IPIP is not set
298# CONFIG_NET_IPGRE is not set
299# CONFIG_IP_MROUTE is not set
300# CONFIG_ARPD is not set
301# CONFIG_SYN_COOKIES is not set
302# CONFIG_INET_AH is not set
303# CONFIG_INET_ESP is not set
304# CONFIG_INET_IPCOMP is not set
305# CONFIG_INET_XFRM_TUNNEL is not set
306# CONFIG_INET_TUNNEL is not set
307CONFIG_INET_XFRM_MODE_TRANSPORT=y
308CONFIG_INET_XFRM_MODE_TUNNEL=y
309CONFIG_INET_XFRM_MODE_BEET=y
310# CONFIG_INET_LRO is not set
311CONFIG_INET_DIAG=y
312CONFIG_INET_TCP_DIAG=y
313# CONFIG_TCP_CONG_ADVANCED is not set
314CONFIG_TCP_CONG_CUBIC=y
315CONFIG_DEFAULT_TCP_CONG="cubic"
316# CONFIG_TCP_MD5SIG is not set
317# CONFIG_IPV6 is not set
318# CONFIG_NETWORK_SECMARK is not set
319# CONFIG_NETFILTER is not set
320# CONFIG_IP_DCCP is not set
321# CONFIG_IP_SCTP is not set
322# CONFIG_TIPC is not set
323# CONFIG_ATM is not set
324# CONFIG_BRIDGE is not set
325# CONFIG_VLAN_8021Q is not set
326# CONFIG_DECNET is not set
327# CONFIG_LLC2 is not set
328# CONFIG_IPX is not set
329# CONFIG_ATALK is not set
330# CONFIG_X25 is not set
331# CONFIG_LAPB is not set
332# CONFIG_ECONET is not set
333# CONFIG_WAN_ROUTER is not set
334# CONFIG_NET_SCHED is not set
335
336#
337# Network testing
338#
339CONFIG_NET_PKTGEN=m
340# CONFIG_NET_TCPPROBE is not set
341# CONFIG_HAMRADIO is not set
342# CONFIG_CAN is not set
343# CONFIG_IRDA is not set
344# CONFIG_BT is not set
345# CONFIG_AF_RXRPC is not set
346
347#
348# Wireless
349#
350# CONFIG_CFG80211 is not set
351CONFIG_WIRELESS_EXT=y
352# CONFIG_MAC80211 is not set
353# CONFIG_IEEE80211 is not set
354# CONFIG_RFKILL is not set
355# CONFIG_NET_9P is not set
356
357#
358# Device Drivers
359#
360
361#
362# Generic Driver Options
363#
364CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
365CONFIG_STANDALONE=y
366CONFIG_PREVENT_FIRMWARE_BUILD=y
367CONFIG_FW_LOADER=y
368# CONFIG_DEBUG_DRIVER is not set
369# CONFIG_DEBUG_DEVRES is not set
370# CONFIG_SYS_HYPERVISOR is not set
371# CONFIG_CONNECTOR is not set
372CONFIG_MTD=y
373# CONFIG_MTD_DEBUG is not set
374# CONFIG_MTD_CONCAT is not set
375CONFIG_MTD_PARTITIONS=y
376# CONFIG_MTD_REDBOOT_PARTS is not set
377CONFIG_MTD_CMDLINE_PARTS=y
378# CONFIG_MTD_AFS_PARTS is not set
379# CONFIG_MTD_AR7_PARTS is not set
380
381#
382# User Modules And Translation Layers
383#
384CONFIG_MTD_CHAR=y
385CONFIG_MTD_BLKDEVS=y
386CONFIG_MTD_BLOCK=y
387# CONFIG_FTL is not set
388# CONFIG_NFTL is not set
389# CONFIG_INFTL is not set
390# CONFIG_RFD_FTL is not set
391# CONFIG_SSFDC is not set
392# CONFIG_MTD_OOPS is not set
393
394#
395# RAM/ROM/Flash chip drivers
396#
397CONFIG_MTD_CFI=y
398CONFIG_MTD_JEDECPROBE=y
399CONFIG_MTD_GEN_PROBE=y
400CONFIG_MTD_CFI_ADV_OPTIONS=y
401CONFIG_MTD_CFI_NOSWAP=y
402# CONFIG_MTD_CFI_BE_BYTE_SWAP is not set
403# CONFIG_MTD_CFI_LE_BYTE_SWAP is not set
404CONFIG_MTD_CFI_GEOMETRY=y
405CONFIG_MTD_MAP_BANK_WIDTH_1=y
406CONFIG_MTD_MAP_BANK_WIDTH_2=y
407# CONFIG_MTD_MAP_BANK_WIDTH_4 is not set
408# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
409# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
410# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
411CONFIG_MTD_CFI_I1=y
412CONFIG_MTD_CFI_I2=y
413# CONFIG_MTD_CFI_I4 is not set
414# CONFIG_MTD_CFI_I8 is not set
415# CONFIG_MTD_OTP is not set
416CONFIG_MTD_CFI_INTELEXT=y
417# CONFIG_MTD_CFI_AMDSTD is not set
418CONFIG_MTD_CFI_STAA=y
419CONFIG_MTD_CFI_UTIL=y
420# CONFIG_MTD_RAM is not set
421# CONFIG_MTD_ROM is not set
422# CONFIG_MTD_ABSENT is not set
423
424#
425# Mapping drivers for chip access
426#
427# CONFIG_MTD_COMPLEX_MAPPINGS is not set
428CONFIG_MTD_PHYSMAP=y
429CONFIG_MTD_PHYSMAP_START=0x0
430CONFIG_MTD_PHYSMAP_LEN=0x0
431CONFIG_MTD_PHYSMAP_BANKWIDTH=0
432# CONFIG_MTD_ARM_INTEGRATOR is not set
433# CONFIG_MTD_IMPA7 is not set
434# CONFIG_MTD_INTEL_VR_NOR is not set
435# CONFIG_MTD_PLATRAM is not set
436
437#
438# Self-contained MTD device drivers
439#
440# CONFIG_MTD_PMC551 is not set
441# CONFIG_MTD_DATAFLASH is not set
442CONFIG_MTD_M25P80=y
443CONFIG_M25PXX_USE_FAST_READ=y
444# CONFIG_MTD_SLRAM is not set
445# CONFIG_MTD_PHRAM is not set
446# CONFIG_MTD_MTDRAM is not set
447# CONFIG_MTD_BLOCK2MTD is not set
448
449#
450# Disk-On-Chip Device Drivers
451#
452# CONFIG_MTD_DOC2000 is not set
453# CONFIG_MTD_DOC2001 is not set
454# CONFIG_MTD_DOC2001PLUS is not set
455CONFIG_MTD_NAND=y
456CONFIG_MTD_NAND_VERIFY_WRITE=y
457# CONFIG_MTD_NAND_ECC_SMC is not set
458# CONFIG_MTD_NAND_MUSEUM_IDS is not set
459CONFIG_MTD_NAND_IDS=y
460# CONFIG_MTD_NAND_DISKONCHIP is not set
461# CONFIG_MTD_NAND_CAFE is not set
462# CONFIG_MTD_NAND_NANDSIM is not set
463# CONFIG_MTD_NAND_PLATFORM is not set
464# CONFIG_MTD_ALAUDA is not set
465CONFIG_MTD_NAND_ORION=y
466# CONFIG_MTD_ONENAND is not set
467
468#
469# UBI - Unsorted block images
470#
471# CONFIG_MTD_UBI is not set
472# CONFIG_PARPORT is not set
473CONFIG_BLK_DEV=y
474# CONFIG_BLK_CPQ_DA is not set
475# CONFIG_BLK_CPQ_CISS_DA is not set
476# CONFIG_BLK_DEV_DAC960 is not set
477# CONFIG_BLK_DEV_UMEM is not set
478# CONFIG_BLK_DEV_COW_COMMON is not set
479CONFIG_BLK_DEV_LOOP=y
480# CONFIG_BLK_DEV_CRYPTOLOOP is not set
481# CONFIG_BLK_DEV_NBD is not set
482# CONFIG_BLK_DEV_SX8 is not set
483# CONFIG_BLK_DEV_UB is not set
484# CONFIG_BLK_DEV_RAM is not set
485# CONFIG_CDROM_PKTCDVD is not set
486# CONFIG_ATA_OVER_ETH is not set
487# CONFIG_MISC_DEVICES is not set
488CONFIG_HAVE_IDE=y
489# CONFIG_IDE is not set
490
491#
492# SCSI device support
493#
494# CONFIG_RAID_ATTRS is not set
495CONFIG_SCSI=y
496CONFIG_SCSI_DMA=y
497# CONFIG_SCSI_TGT is not set
498# CONFIG_SCSI_NETLINK is not set
499# CONFIG_SCSI_PROC_FS is not set
500
501#
502# SCSI support type (disk, tape, CD-ROM)
503#
504CONFIG_BLK_DEV_SD=y
505# CONFIG_CHR_DEV_ST is not set
506# CONFIG_CHR_DEV_OSST is not set
507CONFIG_BLK_DEV_SR=m
508# CONFIG_BLK_DEV_SR_VENDOR is not set
509CONFIG_CHR_DEV_SG=m
510# CONFIG_CHR_DEV_SCH is not set
511
512#
513# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
514#
515# CONFIG_SCSI_MULTI_LUN is not set
516# CONFIG_SCSI_CONSTANTS is not set
517# CONFIG_SCSI_LOGGING is not set
518# CONFIG_SCSI_SCAN_ASYNC is not set
519CONFIG_SCSI_WAIT_SCAN=m
520
521#
522# SCSI Transports
523#
524# CONFIG_SCSI_SPI_ATTRS is not set
525# CONFIG_SCSI_FC_ATTRS is not set
526# CONFIG_SCSI_ISCSI_ATTRS is not set
527# CONFIG_SCSI_SAS_LIBSAS is not set
528# CONFIG_SCSI_SRP_ATTRS is not set
529CONFIG_SCSI_LOWLEVEL=y
530# CONFIG_ISCSI_TCP is not set
531# CONFIG_BLK_DEV_3W_XXXX_RAID is not set
532# CONFIG_SCSI_3W_9XXX is not set
533# CONFIG_SCSI_ACARD is not set
534# CONFIG_SCSI_AACRAID is not set
535# CONFIG_SCSI_AIC7XXX is not set
536# CONFIG_SCSI_AIC7XXX_OLD is not set
537# CONFIG_SCSI_AIC79XX is not set
538# CONFIG_SCSI_AIC94XX is not set
539# CONFIG_SCSI_DPT_I2O is not set
540# CONFIG_SCSI_ADVANSYS is not set
541# CONFIG_SCSI_ARCMSR is not set
542# CONFIG_MEGARAID_NEWGEN is not set
543# CONFIG_MEGARAID_LEGACY is not set
544# CONFIG_MEGARAID_SAS is not set
545# CONFIG_SCSI_HPTIOP is not set
546# CONFIG_SCSI_DMX3191D is not set
547# CONFIG_SCSI_FUTURE_DOMAIN is not set
548# CONFIG_SCSI_IPS is not set
549# CONFIG_SCSI_INITIO is not set
550# CONFIG_SCSI_INIA100 is not set
551# CONFIG_SCSI_MVSAS is not set
552# CONFIG_SCSI_STEX is not set
553# CONFIG_SCSI_SYM53C8XX_2 is not set
554# CONFIG_SCSI_IPR is not set
555# CONFIG_SCSI_QLOGIC_1280 is not set
556# CONFIG_SCSI_QLA_FC is not set
557# CONFIG_SCSI_QLA_ISCSI is not set
558# CONFIG_SCSI_LPFC is not set
559# CONFIG_SCSI_DC395x is not set
560# CONFIG_SCSI_DC390T is not set
561# CONFIG_SCSI_NSP32 is not set
562# CONFIG_SCSI_DEBUG is not set
563# CONFIG_SCSI_SRP is not set
564CONFIG_ATA=y
565# CONFIG_ATA_NONSTANDARD is not set
566CONFIG_SATA_PMP=y
567# CONFIG_SATA_AHCI is not set
568# CONFIG_SATA_SIL24 is not set
569CONFIG_ATA_SFF=y
570# CONFIG_SATA_SVW is not set
571# CONFIG_ATA_PIIX is not set
572CONFIG_SATA_MV=y
573# CONFIG_SATA_NV is not set
574# CONFIG_PDC_ADMA is not set
575# CONFIG_SATA_QSTOR is not set
576# CONFIG_SATA_PROMISE is not set
577# CONFIG_SATA_SX4 is not set
578# CONFIG_SATA_SIL is not set
579# CONFIG_SATA_SIS is not set
580# CONFIG_SATA_ULI is not set
581# CONFIG_SATA_VIA is not set
582# CONFIG_SATA_VITESSE is not set
583# CONFIG_SATA_INIC162X is not set
584# CONFIG_PATA_ALI is not set
585# CONFIG_PATA_AMD is not set
586# CONFIG_PATA_ARTOP is not set
587# CONFIG_PATA_ATIIXP is not set
588# CONFIG_PATA_CMD640_PCI is not set
589# CONFIG_PATA_CMD64X is not set
590# CONFIG_PATA_CS5520 is not set
591# CONFIG_PATA_CS5530 is not set
592# CONFIG_PATA_CYPRESS is not set
593# CONFIG_PATA_EFAR is not set
594# CONFIG_ATA_GENERIC is not set
595# CONFIG_PATA_HPT366 is not set
596# CONFIG_PATA_HPT37X is not set
597# CONFIG_PATA_HPT3X2N is not set
598# CONFIG_PATA_HPT3X3 is not set
599# CONFIG_PATA_IT821X is not set
600# CONFIG_PATA_IT8213 is not set
601# CONFIG_PATA_JMICRON is not set
602# CONFIG_PATA_TRIFLEX is not set
603# CONFIG_PATA_MARVELL is not set
604# CONFIG_PATA_MPIIX is not set
605# CONFIG_PATA_OLDPIIX is not set
606# CONFIG_PATA_NETCELL is not set
607# CONFIG_PATA_NINJA32 is not set
608# CONFIG_PATA_NS87410 is not set
609# CONFIG_PATA_NS87415 is not set
610# CONFIG_PATA_OPTI is not set
611# CONFIG_PATA_OPTIDMA is not set
612# CONFIG_PATA_PDC_OLD is not set
613# CONFIG_PATA_RADISYS is not set
614# CONFIG_PATA_RZ1000 is not set
615# CONFIG_PATA_SC1200 is not set
616# CONFIG_PATA_SERVERWORKS is not set
617# CONFIG_PATA_PDC2027X is not set
618# CONFIG_PATA_SIL680 is not set
619# CONFIG_PATA_SIS is not set
620# CONFIG_PATA_VIA is not set
621# CONFIG_PATA_WINBOND is not set
622# CONFIG_PATA_PLATFORM is not set
623# CONFIG_PATA_SCH is not set
624# CONFIG_MD is not set
625# CONFIG_FUSION is not set
626
627#
628# IEEE 1394 (FireWire) support
629#
630# CONFIG_FIREWIRE is not set
631# CONFIG_IEEE1394 is not set
632# CONFIG_I2O is not set
633CONFIG_NETDEVICES=y
634# CONFIG_NETDEVICES_MULTIQUEUE is not set
635# CONFIG_DUMMY is not set
636# CONFIG_BONDING is not set
637# CONFIG_MACVLAN is not set
638# CONFIG_EQUALIZER is not set
639# CONFIG_TUN is not set
640# CONFIG_VETH is not set
641# CONFIG_ARCNET is not set
642# CONFIG_PHYLIB is not set
643CONFIG_NET_ETHERNET=y
644CONFIG_MII=y
645# CONFIG_AX88796 is not set
646# CONFIG_HAPPYMEAL is not set
647# CONFIG_SUNGEM is not set
648# CONFIG_CASSINI is not set
649# CONFIG_NET_VENDOR_3COM is not set
650# CONFIG_SMC91X is not set
651# CONFIG_DM9000 is not set
652# CONFIG_ENC28J60 is not set
653# CONFIG_NET_TULIP is not set
654# CONFIG_HP100 is not set
655# CONFIG_IBM_NEW_EMAC_ZMII is not set
656# CONFIG_IBM_NEW_EMAC_RGMII is not set
657# CONFIG_IBM_NEW_EMAC_TAH is not set
658# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
659CONFIG_NET_PCI=y
660# CONFIG_PCNET32 is not set
661# CONFIG_AMD8111_ETH is not set
662# CONFIG_ADAPTEC_STARFIRE is not set
663# CONFIG_B44 is not set
664# CONFIG_FORCEDETH is not set
665# CONFIG_EEPRO100 is not set
666# CONFIG_E100 is not set
667# CONFIG_FEALNX is not set
668# CONFIG_NATSEMI is not set
669# CONFIG_NE2K_PCI is not set
670# CONFIG_8139CP is not set
671# CONFIG_8139TOO is not set
672# CONFIG_R6040 is not set
673# CONFIG_SIS900 is not set
674# CONFIG_EPIC100 is not set
675# CONFIG_SUNDANCE is not set
676# CONFIG_TLAN is not set
677# CONFIG_VIA_RHINE is not set
678# CONFIG_SC92031 is not set
679CONFIG_NETDEV_1000=y
680# CONFIG_ACENIC is not set
681# CONFIG_DL2K is not set
682CONFIG_E1000=y
683CONFIG_E1000_NAPI=y
684# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set
685# CONFIG_E1000E is not set
686# CONFIG_E1000E_ENABLED is not set
687# CONFIG_IP1000 is not set
688# CONFIG_IGB is not set
689# CONFIG_NS83820 is not set
690# CONFIG_HAMACHI is not set
691# CONFIG_YELLOWFIN is not set
692# CONFIG_R8169 is not set
693# CONFIG_SIS190 is not set
694# CONFIG_SKGE is not set
695# CONFIG_SKY2 is not set
696# CONFIG_VIA_VELOCITY is not set
697# CONFIG_TIGON3 is not set
698# CONFIG_BNX2 is not set
699CONFIG_MV643XX_ETH=y
700# CONFIG_QLA3XXX is not set
701# CONFIG_ATL1 is not set
702# CONFIG_NETDEV_10000 is not set
703# CONFIG_TR is not set
704
705#
706# Wireless LAN
707#
708# CONFIG_WLAN_PRE80211 is not set
709# CONFIG_WLAN_80211 is not set
710# CONFIG_IWLWIFI_LEDS is not set
711
712#
713# USB Network Adapters
714#
715# CONFIG_USB_CATC is not set
716# CONFIG_USB_KAWETH is not set
717# CONFIG_USB_PEGASUS is not set
718# CONFIG_USB_RTL8150 is not set
719# CONFIG_USB_USBNET is not set
720# CONFIG_WAN is not set
721# CONFIG_FDDI is not set
722# CONFIG_HIPPI is not set
723# CONFIG_PPP is not set
724# CONFIG_SLIP is not set
725# CONFIG_NET_FC is not set
726# CONFIG_NETCONSOLE is not set
727# CONFIG_NETPOLL is not set
728# CONFIG_NET_POLL_CONTROLLER is not set
729# CONFIG_ISDN is not set
730
731#
732# Input device support
733#
734CONFIG_INPUT=y
735# CONFIG_INPUT_FF_MEMLESS is not set
736# CONFIG_INPUT_POLLDEV is not set
737
738#
739# Userland interfaces
740#
741CONFIG_INPUT_MOUSEDEV=y
742CONFIG_INPUT_MOUSEDEV_PSAUX=y
743CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
744CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
745# CONFIG_INPUT_JOYDEV is not set
746# CONFIG_INPUT_EVDEV is not set
747# CONFIG_INPUT_EVBUG is not set
748
749#
750# Input Device Drivers
751#
752# CONFIG_INPUT_KEYBOARD is not set
753# CONFIG_INPUT_MOUSE is not set
754# CONFIG_INPUT_JOYSTICK is not set
755# CONFIG_INPUT_TABLET is not set
756# CONFIG_INPUT_TOUCHSCREEN is not set
757# CONFIG_INPUT_MISC is not set
758
759#
760# Hardware I/O ports
761#
762# CONFIG_SERIO is not set
763# CONFIG_GAMEPORT is not set
764
765#
766# Character devices
767#
768# CONFIG_VT is not set
769# CONFIG_DEVKMEM is not set
770# CONFIG_SERIAL_NONSTANDARD is not set
771# CONFIG_NOZOMI is not set
772
773#
774# Serial drivers
775#
776CONFIG_SERIAL_8250=y
777CONFIG_SERIAL_8250_CONSOLE=y
778# CONFIG_SERIAL_8250_PCI is not set
779CONFIG_SERIAL_8250_NR_UARTS=4
780CONFIG_SERIAL_8250_RUNTIME_UARTS=2
781# CONFIG_SERIAL_8250_EXTENDED is not set
782
783#
784# Non-8250 serial port support
785#
786CONFIG_SERIAL_CORE=y
787CONFIG_SERIAL_CORE_CONSOLE=y
788# CONFIG_SERIAL_JSM is not set
789CONFIG_UNIX98_PTYS=y
790CONFIG_LEGACY_PTYS=y
791CONFIG_LEGACY_PTY_COUNT=16
792# CONFIG_IPMI_HANDLER is not set
793# CONFIG_HW_RANDOM is not set
794# CONFIG_NVRAM is not set
795# CONFIG_R3964 is not set
796# CONFIG_APPLICOM is not set
797# CONFIG_RAW_DRIVER is not set
798# CONFIG_TCG_TPM is not set
799CONFIG_DEVPORT=y
800CONFIG_I2C=y
801CONFIG_I2C_BOARDINFO=y
802CONFIG_I2C_CHARDEV=y
803
804#
805# I2C Hardware Bus support
806#
807# CONFIG_I2C_ALI1535 is not set
808# CONFIG_I2C_ALI1563 is not set
809# CONFIG_I2C_ALI15X3 is not set
810# CONFIG_I2C_AMD756 is not set
811# CONFIG_I2C_AMD8111 is not set
812# CONFIG_I2C_GPIO is not set
813# CONFIG_I2C_I801 is not set
814# CONFIG_I2C_I810 is not set
815# CONFIG_I2C_PIIX4 is not set
816# CONFIG_I2C_NFORCE2 is not set
817# CONFIG_I2C_OCORES is not set
818# CONFIG_I2C_PARPORT_LIGHT is not set
819# CONFIG_I2C_PROSAVAGE is not set
820# CONFIG_I2C_SAVAGE4 is not set
821# CONFIG_I2C_SIMTEC is not set
822# CONFIG_I2C_SIS5595 is not set
823# CONFIG_I2C_SIS630 is not set
824# CONFIG_I2C_SIS96X is not set
825# CONFIG_I2C_TAOS_EVM is not set
826# CONFIG_I2C_STUB is not set
827# CONFIG_I2C_TINY_USB is not set
828# CONFIG_I2C_VIA is not set
829# CONFIG_I2C_VIAPRO is not set
830# CONFIG_I2C_VOODOO3 is not set
831# CONFIG_I2C_PCA_PLATFORM is not set
832CONFIG_I2C_MV64XXX=y
833
834#
835# Miscellaneous I2C Chip support
836#
837# CONFIG_DS1682 is not set
838# CONFIG_SENSORS_EEPROM is not set
839# CONFIG_SENSORS_PCF8574 is not set
840# CONFIG_PCF8575 is not set
841# CONFIG_SENSORS_PCF8591 is not set
842# CONFIG_SENSORS_MAX6875 is not set
843# CONFIG_SENSORS_TSL2550 is not set
844# CONFIG_I2C_DEBUG_CORE is not set
845# CONFIG_I2C_DEBUG_ALGO is not set
846# CONFIG_I2C_DEBUG_BUS is not set
847# CONFIG_I2C_DEBUG_CHIP is not set
848CONFIG_SPI=y
849# CONFIG_SPI_DEBUG is not set
850CONFIG_SPI_MASTER=y
851
852#
853# SPI Master Controller Drivers
854#
855# CONFIG_SPI_BITBANG is not set
856CONFIG_SPI_ORION=y
857
858#
859# SPI Protocol Masters
860#
861# CONFIG_SPI_AT25 is not set
862# CONFIG_SPI_SPIDEV is not set
863# CONFIG_SPI_TLE62X0 is not set
864# CONFIG_W1 is not set
865# CONFIG_POWER_SUPPLY is not set
866# CONFIG_HWMON is not set
867# CONFIG_WATCHDOG is not set
868
869#
870# Sonics Silicon Backplane
871#
872CONFIG_SSB_POSSIBLE=y
873# CONFIG_SSB is not set
874
875#
876# Multifunction device drivers
877#
878# CONFIG_MFD_SM501 is not set
879# CONFIG_MFD_ASIC3 is not set
880# CONFIG_HTC_PASIC3 is not set
881
882#
883# Multimedia devices
884#
885
886#
887# Multimedia core support
888#
889# CONFIG_VIDEO_DEV is not set
890# CONFIG_DVB_CORE is not set
891# CONFIG_VIDEO_MEDIA is not set
892
893#
894# Multimedia drivers
895#
896# CONFIG_DAB is not set
897
898#
899# Graphics support
900#
901# CONFIG_DRM is not set
902# CONFIG_VGASTATE is not set
903# CONFIG_VIDEO_OUTPUT_CONTROL is not set
904# CONFIG_FB is not set
905# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
906
907#
908# Display device support
909#
910# CONFIG_DISPLAY_SUPPORT is not set
911
912#
913# Sound
914#
915# CONFIG_SOUND is not set
916CONFIG_HID_SUPPORT=y
917CONFIG_HID=y
918# CONFIG_HID_DEBUG is not set
919# CONFIG_HIDRAW is not set
920
921#
922# USB Input Devices
923#
924CONFIG_USB_HID=y
925# CONFIG_USB_HIDINPUT_POWERBOOK is not set
926# CONFIG_HID_FF is not set
927# CONFIG_USB_HIDDEV is not set
928CONFIG_USB_SUPPORT=y
929CONFIG_USB_ARCH_HAS_HCD=y
930CONFIG_USB_ARCH_HAS_OHCI=y
931CONFIG_USB_ARCH_HAS_EHCI=y
932CONFIG_USB=y
933# CONFIG_USB_DEBUG is not set
934# CONFIG_USB_ANNOUNCE_NEW_DEVICES is not set
935
936#
937# Miscellaneous USB options
938#
939CONFIG_USB_DEVICEFS=y
940CONFIG_USB_DEVICE_CLASS=y
941# CONFIG_USB_DYNAMIC_MINORS is not set
942# CONFIG_USB_OTG is not set
943# CONFIG_USB_OTG_WHITELIST is not set
944# CONFIG_USB_OTG_BLACKLIST_HUB is not set
945
946#
947# USB Host Controller Drivers
948#
949# CONFIG_USB_C67X00_HCD is not set
950CONFIG_USB_EHCI_HCD=y
951CONFIG_USB_EHCI_ROOT_HUB_TT=y
952CONFIG_USB_EHCI_TT_NEWSCHED=y
953# CONFIG_USB_ISP116X_HCD is not set
954# CONFIG_USB_ISP1760_HCD is not set
955# CONFIG_USB_OHCI_HCD is not set
956# CONFIG_USB_UHCI_HCD is not set
957# CONFIG_USB_SL811_HCD is not set
958# CONFIG_USB_R8A66597_HCD is not set
959
960#
961# USB Device Class drivers
962#
963# CONFIG_USB_ACM is not set
964CONFIG_USB_PRINTER=y
965# CONFIG_USB_WDM is not set
966
967#
968# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
969#
970
971#
972# may also be needed; see USB_STORAGE Help for more information
973#
974CONFIG_USB_STORAGE=y
975# CONFIG_USB_STORAGE_DEBUG is not set
976CONFIG_USB_STORAGE_DATAFAB=y
977CONFIG_USB_STORAGE_FREECOM=y
978# CONFIG_USB_STORAGE_ISD200 is not set
979CONFIG_USB_STORAGE_DPCM=y
980# CONFIG_USB_STORAGE_USBAT is not set
981CONFIG_USB_STORAGE_SDDR09=y
982CONFIG_USB_STORAGE_SDDR55=y
983CONFIG_USB_STORAGE_JUMPSHOT=y
984# CONFIG_USB_STORAGE_ALAUDA is not set
985# CONFIG_USB_STORAGE_ONETOUCH is not set
986# CONFIG_USB_STORAGE_KARMA is not set
987# CONFIG_USB_STORAGE_CYPRESS_ATACB is not set
988# CONFIG_USB_LIBUSUAL is not set
989
990#
991# USB Imaging devices
992#
993# CONFIG_USB_MDC800 is not set
994# CONFIG_USB_MICROTEK is not set
995# CONFIG_USB_MON is not set
996
997#
998# USB port drivers
999#
1000# CONFIG_USB_SERIAL is not set
1001
1002#
1003# USB Miscellaneous drivers
1004#
1005# CONFIG_USB_EMI62 is not set
1006# CONFIG_USB_EMI26 is not set
1007# CONFIG_USB_ADUTUX is not set
1008# CONFIG_USB_AUERSWALD is not set
1009# CONFIG_USB_RIO500 is not set
1010# CONFIG_USB_LEGOTOWER is not set
1011# CONFIG_USB_LCD is not set
1012# CONFIG_USB_BERRY_CHARGE is not set
1013# CONFIG_USB_LED is not set
1014# CONFIG_USB_CYPRESS_CY7C63 is not set
1015# CONFIG_USB_CYTHERM is not set
1016# CONFIG_USB_PHIDGET is not set
1017# CONFIG_USB_IDMOUSE is not set
1018# CONFIG_USB_FTDI_ELAN is not set
1019# CONFIG_USB_APPLEDISPLAY is not set
1020# CONFIG_USB_SISUSBVGA is not set
1021# CONFIG_USB_LD is not set
1022# CONFIG_USB_TRANCEVIBRATOR is not set
1023# CONFIG_USB_IOWARRIOR is not set
1024# CONFIG_USB_TEST is not set
1025# CONFIG_USB_ISIGHTFW is not set
1026# CONFIG_USB_GADGET is not set
1027# CONFIG_MMC is not set
1028CONFIG_NEW_LEDS=y
1029# CONFIG_LEDS_CLASS is not set
1030
1031#
1032# LED drivers
1033#
1034
1035#
1036# LED Triggers
1037#
1038# CONFIG_LEDS_TRIGGERS is not set
1039CONFIG_RTC_LIB=y
1040CONFIG_RTC_CLASS=y
1041# CONFIG_RTC_DEBUG is not set
1042
1043#
1044# RTC interfaces
1045#
1046CONFIG_RTC_INTF_SYSFS=y
1047CONFIG_RTC_INTF_PROC=y
1048CONFIG_RTC_INTF_DEV=y
1049# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set
1050# CONFIG_RTC_DRV_TEST is not set
1051
1052#
1053# I2C RTC drivers
1054#
1055# CONFIG_RTC_DRV_DS1307 is not set
1056# CONFIG_RTC_DRV_DS1374 is not set
1057# CONFIG_RTC_DRV_DS1672 is not set
1058# CONFIG_RTC_DRV_MAX6900 is not set
1059CONFIG_RTC_DRV_MV=y
1060# CONFIG_RTC_DRV_RS5C372 is not set
1061# CONFIG_RTC_DRV_ISL1208 is not set
1062# CONFIG_RTC_DRV_X1205 is not set
1063# CONFIG_RTC_DRV_PCF8563 is not set
1064# CONFIG_RTC_DRV_PCF8583 is not set
1065# CONFIG_RTC_DRV_M41T80 is not set
1066# CONFIG_RTC_DRV_S35390A is not set
1067
1068#
1069# SPI RTC drivers
1070#
1071# CONFIG_RTC_DRV_MAX6902 is not set
1072# CONFIG_RTC_DRV_R9701 is not set
1073# CONFIG_RTC_DRV_RS5C348 is not set
1074
1075#
1076# Platform RTC drivers
1077#
1078# CONFIG_RTC_DRV_CMOS is not set
1079# CONFIG_RTC_DRV_DS1511 is not set
1080# CONFIG_RTC_DRV_DS1553 is not set
1081# CONFIG_RTC_DRV_DS1742 is not set
1082# CONFIG_RTC_DRV_STK17TA8 is not set
1083# CONFIG_RTC_DRV_M48T86 is not set
1084# CONFIG_RTC_DRV_M48T59 is not set
1085# CONFIG_RTC_DRV_V3020 is not set
1086
1087#
1088# on-CPU RTC drivers
1089#
1090CONFIG_DMADEVICES=y
1091
1092#
1093# DMA Devices
1094#
1095CONFIG_MV_XOR=y
1096CONFIG_DMA_ENGINE=y
1097
1098#
1099# DMA Clients
1100#
1101# CONFIG_NET_DMA is not set
1102# CONFIG_UIO is not set
1103
1104#
1105# File systems
1106#
1107CONFIG_EXT2_FS=y
1108# CONFIG_EXT2_FS_XATTR is not set
1109# CONFIG_EXT2_FS_XIP is not set
1110CONFIG_EXT3_FS=y
1111# CONFIG_EXT3_FS_XATTR is not set
1112# CONFIG_EXT4DEV_FS is not set
1113CONFIG_JBD=y
1114# CONFIG_REISERFS_FS is not set
1115# CONFIG_JFS_FS is not set
1116# CONFIG_FS_POSIX_ACL is not set
1117CONFIG_XFS_FS=y
1118# CONFIG_XFS_QUOTA is not set
1119# CONFIG_XFS_POSIX_ACL is not set
1120# CONFIG_XFS_RT is not set
1121# CONFIG_XFS_DEBUG is not set
1122# CONFIG_OCFS2_FS is not set
1123CONFIG_DNOTIFY=y
1124CONFIG_INOTIFY=y
1125CONFIG_INOTIFY_USER=y
1126# CONFIG_QUOTA is not set
1127# CONFIG_AUTOFS_FS is not set
1128# CONFIG_AUTOFS4_FS is not set
1129# CONFIG_FUSE_FS is not set
1130
1131#
1132# CD-ROM/DVD Filesystems
1133#
1134CONFIG_ISO9660_FS=y
1135CONFIG_JOLIET=y
1136# CONFIG_ZISOFS is not set
1137CONFIG_UDF_FS=m
1138CONFIG_UDF_NLS=y
1139
1140#
1141# DOS/FAT/NT Filesystems
1142#
1143CONFIG_FAT_FS=y
1144CONFIG_MSDOS_FS=y
1145CONFIG_VFAT_FS=y
1146CONFIG_FAT_DEFAULT_CODEPAGE=437
1147CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
1148# CONFIG_NTFS_FS is not set
1149
1150#
1151# Pseudo filesystems
1152#
1153CONFIG_PROC_FS=y
1154CONFIG_PROC_SYSCTL=y
1155CONFIG_SYSFS=y
1156CONFIG_TMPFS=y
1157# CONFIG_TMPFS_POSIX_ACL is not set
1158# CONFIG_HUGETLB_PAGE is not set
1159# CONFIG_CONFIGFS_FS is not set
1160
1161#
1162# Miscellaneous filesystems
1163#
1164# CONFIG_ADFS_FS is not set
1165# CONFIG_AFFS_FS is not set
1166# CONFIG_HFS_FS is not set
1167# CONFIG_HFSPLUS_FS is not set
1168# CONFIG_BEFS_FS is not set
1169# CONFIG_BFS_FS is not set
1170# CONFIG_EFS_FS is not set
1171CONFIG_JFFS2_FS=y
1172CONFIG_JFFS2_FS_DEBUG=0
1173CONFIG_JFFS2_FS_WRITEBUFFER=y
1174# CONFIG_JFFS2_FS_WBUF_VERIFY is not set
1175# CONFIG_JFFS2_SUMMARY is not set
1176# CONFIG_JFFS2_FS_XATTR is not set
1177# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set
1178CONFIG_JFFS2_ZLIB=y
1179# CONFIG_JFFS2_LZO is not set
1180CONFIG_JFFS2_RTIME=y
1181# CONFIG_JFFS2_RUBIN is not set
1182CONFIG_CRAMFS=y
1183# CONFIG_VXFS_FS is not set
1184# CONFIG_MINIX_FS is not set
1185# CONFIG_HPFS_FS is not set
1186# CONFIG_QNX4FS_FS is not set
1187# CONFIG_ROMFS_FS is not set
1188# CONFIG_SYSV_FS is not set
1189# CONFIG_UFS_FS is not set
1190CONFIG_NETWORK_FILESYSTEMS=y
1191CONFIG_NFS_FS=y
1192CONFIG_NFS_V3=y
1193# CONFIG_NFS_V3_ACL is not set
1194# CONFIG_NFS_V4 is not set
1195# CONFIG_NFSD is not set
1196CONFIG_ROOT_NFS=y
1197CONFIG_LOCKD=y
1198CONFIG_LOCKD_V4=y
1199CONFIG_NFS_COMMON=y
1200CONFIG_SUNRPC=y
1201# CONFIG_SUNRPC_BIND34 is not set
1202# CONFIG_RPCSEC_GSS_KRB5 is not set
1203# CONFIG_RPCSEC_GSS_SPKM3 is not set
1204# CONFIG_SMB_FS is not set
1205# CONFIG_CIFS is not set
1206# CONFIG_NCP_FS is not set
1207# CONFIG_CODA_FS is not set
1208# CONFIG_AFS_FS is not set
1209
1210#
1211# Partition Types
1212#
1213CONFIG_PARTITION_ADVANCED=y
1214# CONFIG_ACORN_PARTITION is not set
1215# CONFIG_OSF_PARTITION is not set
1216# CONFIG_AMIGA_PARTITION is not set
1217# CONFIG_ATARI_PARTITION is not set
1218# CONFIG_MAC_PARTITION is not set
1219CONFIG_MSDOS_PARTITION=y
1220# CONFIG_BSD_DISKLABEL is not set
1221# CONFIG_MINIX_SUBPARTITION is not set
1222# CONFIG_SOLARIS_X86_PARTITION is not set
1223# CONFIG_UNIXWARE_DISKLABEL is not set
1224# CONFIG_LDM_PARTITION is not set
1225# CONFIG_SGI_PARTITION is not set
1226# CONFIG_ULTRIX_PARTITION is not set
1227# CONFIG_SUN_PARTITION is not set
1228# CONFIG_KARMA_PARTITION is not set
1229# CONFIG_EFI_PARTITION is not set
1230# CONFIG_SYSV68_PARTITION is not set
1231CONFIG_NLS=y
1232CONFIG_NLS_DEFAULT="iso8859-1"
1233CONFIG_NLS_CODEPAGE_437=y
1234# CONFIG_NLS_CODEPAGE_737 is not set
1235# CONFIG_NLS_CODEPAGE_775 is not set
1236CONFIG_NLS_CODEPAGE_850=y
1237# CONFIG_NLS_CODEPAGE_852 is not set
1238# CONFIG_NLS_CODEPAGE_855 is not set
1239# CONFIG_NLS_CODEPAGE_857 is not set
1240# CONFIG_NLS_CODEPAGE_860 is not set
1241# CONFIG_NLS_CODEPAGE_861 is not set
1242# CONFIG_NLS_CODEPAGE_862 is not set
1243# CONFIG_NLS_CODEPAGE_863 is not set
1244# CONFIG_NLS_CODEPAGE_864 is not set
1245# CONFIG_NLS_CODEPAGE_865 is not set
1246# CONFIG_NLS_CODEPAGE_866 is not set
1247# CONFIG_NLS_CODEPAGE_869 is not set
1248# CONFIG_NLS_CODEPAGE_936 is not set
1249# CONFIG_NLS_CODEPAGE_950 is not set
1250# CONFIG_NLS_CODEPAGE_932 is not set
1251# CONFIG_NLS_CODEPAGE_949 is not set
1252# CONFIG_NLS_CODEPAGE_874 is not set
1253# CONFIG_NLS_ISO8859_8 is not set
1254# CONFIG_NLS_CODEPAGE_1250 is not set
1255# CONFIG_NLS_CODEPAGE_1251 is not set
1256# CONFIG_NLS_ASCII is not set
1257CONFIG_NLS_ISO8859_1=y
1258CONFIG_NLS_ISO8859_2=y
1259# CONFIG_NLS_ISO8859_3 is not set
1260# CONFIG_NLS_ISO8859_4 is not set
1261# CONFIG_NLS_ISO8859_5 is not set
1262# CONFIG_NLS_ISO8859_6 is not set
1263# CONFIG_NLS_ISO8859_7 is not set
1264# CONFIG_NLS_ISO8859_9 is not set
1265# CONFIG_NLS_ISO8859_13 is not set
1266# CONFIG_NLS_ISO8859_14 is not set
1267# CONFIG_NLS_ISO8859_15 is not set
1268# CONFIG_NLS_KOI8_R is not set
1269# CONFIG_NLS_KOI8_U is not set
1270CONFIG_NLS_UTF8=y
1271# CONFIG_DLM is not set
1272
1273#
1274# Kernel hacking
1275#
1276# CONFIG_PRINTK_TIME is not set
1277CONFIG_ENABLE_WARN_DEPRECATED=y
1278CONFIG_ENABLE_MUST_CHECK=y
1279CONFIG_FRAME_WARN=1024
1280CONFIG_MAGIC_SYSRQ=y
1281# CONFIG_UNUSED_SYMBOLS is not set
1282# CONFIG_DEBUG_FS is not set
1283# CONFIG_HEADERS_CHECK is not set
1284CONFIG_DEBUG_KERNEL=y
1285# CONFIG_DEBUG_SHIRQ is not set
1286CONFIG_DETECT_SOFTLOCKUP=y
1287# CONFIG_SCHED_DEBUG is not set
1288# CONFIG_SCHEDSTATS is not set
1289# CONFIG_TIMER_STATS is not set
1290# CONFIG_DEBUG_OBJECTS is not set
1291# CONFIG_DEBUG_SLAB is not set
1292# CONFIG_DEBUG_PREEMPT is not set
1293# CONFIG_DEBUG_RT_MUTEXES is not set
1294# CONFIG_RT_MUTEX_TESTER is not set
1295# CONFIG_DEBUG_SPINLOCK is not set
1296# CONFIG_DEBUG_MUTEXES is not set
1297# CONFIG_DEBUG_LOCK_ALLOC is not set
1298# CONFIG_PROVE_LOCKING is not set
1299# CONFIG_LOCK_STAT is not set
1300# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
1301# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
1302# CONFIG_DEBUG_KOBJECT is not set
1303# CONFIG_DEBUG_BUGVERBOSE is not set
1304CONFIG_DEBUG_INFO=y
1305# CONFIG_DEBUG_VM is not set
1306# CONFIG_DEBUG_WRITECOUNT is not set
1307# CONFIG_DEBUG_LIST is not set
1308# CONFIG_DEBUG_SG is not set
1309CONFIG_FRAME_POINTER=y
1310# CONFIG_BOOT_PRINTK_DELAY is not set
1311# CONFIG_RCU_TORTURE_TEST is not set
1312# CONFIG_KPROBES_SANITY_TEST is not set
1313# CONFIG_BACKTRACE_SELF_TEST is not set
1314# CONFIG_LKDTM is not set
1315# CONFIG_FAULT_INJECTION is not set
1316# CONFIG_LATENCYTOP is not set
1317# CONFIG_SAMPLES is not set
1318CONFIG_DEBUG_USER=y
1319CONFIG_DEBUG_ERRORS=y
1320# CONFIG_DEBUG_STACK_USAGE is not set
1321CONFIG_DEBUG_LL=y
1322# CONFIG_DEBUG_ICEDCC is not set
1323
1324#
1325# Security options
1326#
1327# CONFIG_KEYS is not set
1328# CONFIG_SECURITY is not set
1329# CONFIG_SECURITY_FILE_CAPABILITIES is not set
1330CONFIG_ASYNC_CORE=y
1331CONFIG_CRYPTO=y
1332
1333#
1334# Crypto core or helper
1335#
1336CONFIG_CRYPTO_ALGAPI=m
1337CONFIG_CRYPTO_BLKCIPHER=m
1338CONFIG_CRYPTO_MANAGER=m
1339# CONFIG_CRYPTO_GF128MUL is not set
1340# CONFIG_CRYPTO_NULL is not set
1341# CONFIG_CRYPTO_CRYPTD is not set
1342# CONFIG_CRYPTO_AUTHENC is not set
1343# CONFIG_CRYPTO_TEST is not set
1344
1345#
1346# Authenticated Encryption with Associated Data
1347#
1348# CONFIG_CRYPTO_CCM is not set
1349# CONFIG_CRYPTO_GCM is not set
1350# CONFIG_CRYPTO_SEQIV is not set
1351
1352#
1353# Block modes
1354#
1355CONFIG_CRYPTO_CBC=m
1356# CONFIG_CRYPTO_CTR is not set
1357# CONFIG_CRYPTO_CTS is not set
1358CONFIG_CRYPTO_ECB=m
1359# CONFIG_CRYPTO_LRW is not set
1360CONFIG_CRYPTO_PCBC=m
1361# CONFIG_CRYPTO_XTS is not set
1362
1363#
1364# Hash modes
1365#
1366# CONFIG_CRYPTO_HMAC is not set
1367# CONFIG_CRYPTO_XCBC is not set
1368
1369#
1370# Digest
1371#
1372# CONFIG_CRYPTO_CRC32C is not set
1373# CONFIG_CRYPTO_MD4 is not set
1374# CONFIG_CRYPTO_MD5 is not set
1375# CONFIG_CRYPTO_MICHAEL_MIC is not set
1376# CONFIG_CRYPTO_SHA1 is not set
1377# CONFIG_CRYPTO_SHA256 is not set
1378# CONFIG_CRYPTO_SHA512 is not set
1379# CONFIG_CRYPTO_TGR192 is not set
1380# CONFIG_CRYPTO_WP512 is not set
1381
1382#
1383# Ciphers
1384#
1385# CONFIG_CRYPTO_AES is not set
1386# CONFIG_CRYPTO_ANUBIS is not set
1387# CONFIG_CRYPTO_ARC4 is not set
1388# CONFIG_CRYPTO_BLOWFISH is not set
1389# CONFIG_CRYPTO_CAMELLIA is not set
1390# CONFIG_CRYPTO_CAST5 is not set
1391# CONFIG_CRYPTO_CAST6 is not set
1392# CONFIG_CRYPTO_DES is not set
1393# CONFIG_CRYPTO_FCRYPT is not set
1394# CONFIG_CRYPTO_KHAZAD is not set
1395# CONFIG_CRYPTO_SALSA20 is not set
1396# CONFIG_CRYPTO_SEED is not set
1397# CONFIG_CRYPTO_SERPENT is not set
1398# CONFIG_CRYPTO_TEA is not set
1399# CONFIG_CRYPTO_TWOFISH is not set
1400
1401#
1402# Compression
1403#
1404# CONFIG_CRYPTO_DEFLATE is not set
1405# CONFIG_CRYPTO_LZO is not set
1406CONFIG_CRYPTO_HW=y
1407# CONFIG_CRYPTO_DEV_HIFN_795X is not set
1408
1409#
1410# Library routines
1411#
1412CONFIG_BITREVERSE=y
1413# CONFIG_GENERIC_FIND_FIRST_BIT is not set
1414# CONFIG_GENERIC_FIND_NEXT_BIT is not set
1415CONFIG_CRC_CCITT=y
1416CONFIG_CRC16=y
1417CONFIG_CRC_ITU_T=m
1418CONFIG_CRC32=y
1419# CONFIG_CRC7 is not set
1420CONFIG_LIBCRC32C=y
1421CONFIG_ZLIB_INFLATE=y
1422CONFIG_ZLIB_DEFLATE=y
1423CONFIG_PLIST=y
1424CONFIG_HAS_IOMEM=y
1425CONFIG_HAS_IOPORT=y
1426CONFIG_HAS_DMA=y
diff --git a/arch/arm/configs/ks8695_defconfig b/arch/arm/configs/ks8695_defconfig
index 8ab21a0719e9..6077f2cb88e4 100644
--- a/arch/arm/configs/ks8695_defconfig
+++ b/arch/arm/configs/ks8695_defconfig
@@ -174,7 +174,6 @@ CONFIG_PCCARD_NONSTATIC=y
174# Kernel Features 174# Kernel Features
175# 175#
176# CONFIG_PREEMPT is not set 176# CONFIG_PREEMPT is not set
177# CONFIG_NO_IDLE_HZ is not set
178CONFIG_HZ=100 177CONFIG_HZ=100
179# CONFIG_AEABI is not set 178# CONFIG_AEABI is not set
180# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set 179# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set
diff --git a/arch/arm/configs/loki_defconfig b/arch/arm/configs/loki_defconfig
new file mode 100644
index 000000000000..17da7c3b3d53
--- /dev/null
+++ b/arch/arm/configs/loki_defconfig
@@ -0,0 +1,1147 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.26-rc5
4# Fri Jun 13 03:07:49 2008
5#
6CONFIG_ARM=y
7CONFIG_SYS_SUPPORTS_APM_EMULATION=y
8# CONFIG_GENERIC_GPIO is not set
9CONFIG_GENERIC_TIME=y
10CONFIG_GENERIC_CLOCKEVENTS=y
11CONFIG_MMU=y
12# CONFIG_NO_IOPORT is not set
13CONFIG_GENERIC_HARDIRQS=y
14CONFIG_STACKTRACE_SUPPORT=y
15CONFIG_HAVE_LATENCYTOP_SUPPORT=y
16CONFIG_LOCKDEP_SUPPORT=y
17CONFIG_TRACE_IRQFLAGS_SUPPORT=y
18CONFIG_HARDIRQS_SW_RESEND=y
19CONFIG_GENERIC_IRQ_PROBE=y
20CONFIG_RWSEM_GENERIC_SPINLOCK=y
21# CONFIG_ARCH_HAS_ILOG2_U32 is not set
22# CONFIG_ARCH_HAS_ILOG2_U64 is not set
23CONFIG_GENERIC_HWEIGHT=y
24CONFIG_GENERIC_CALIBRATE_DELAY=y
25CONFIG_ARCH_SUPPORTS_AOUT=y
26CONFIG_ZONE_DMA=y
27CONFIG_VECTORS_BASE=0xffff0000
28CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
29
30#
31# General setup
32#
33CONFIG_EXPERIMENTAL=y
34CONFIG_BROKEN_ON_SMP=y
35CONFIG_LOCK_KERNEL=y
36CONFIG_INIT_ENV_ARG_LIMIT=32
37CONFIG_LOCALVERSION=""
38CONFIG_LOCALVERSION_AUTO=y
39CONFIG_SWAP=y
40CONFIG_SYSVIPC=y
41CONFIG_SYSVIPC_SYSCTL=y
42# CONFIG_POSIX_MQUEUE is not set
43# CONFIG_BSD_PROCESS_ACCT is not set
44# CONFIG_TASKSTATS is not set
45# CONFIG_AUDIT is not set
46# CONFIG_IKCONFIG is not set
47CONFIG_LOG_BUF_SHIFT=14
48# CONFIG_CGROUPS is not set
49# CONFIG_GROUP_SCHED is not set
50# CONFIG_SYSFS_DEPRECATED_V2 is not set
51# CONFIG_RELAY is not set
52# CONFIG_NAMESPACES is not set
53# CONFIG_BLK_DEV_INITRD is not set
54CONFIG_CC_OPTIMIZE_FOR_SIZE=y
55CONFIG_SYSCTL=y
56CONFIG_EMBEDDED=y
57CONFIG_UID16=y
58CONFIG_SYSCTL_SYSCALL=y
59CONFIG_SYSCTL_SYSCALL_CHECK=y
60CONFIG_KALLSYMS=y
61# CONFIG_KALLSYMS_EXTRA_PASS is not set
62CONFIG_HOTPLUG=y
63CONFIG_PRINTK=y
64CONFIG_BUG=y
65CONFIG_ELF_CORE=y
66CONFIG_COMPAT_BRK=y
67CONFIG_BASE_FULL=y
68CONFIG_FUTEX=y
69CONFIG_ANON_INODES=y
70CONFIG_EPOLL=y
71CONFIG_SIGNALFD=y
72CONFIG_TIMERFD=y
73CONFIG_EVENTFD=y
74CONFIG_SHMEM=y
75CONFIG_VM_EVENT_COUNTERS=y
76CONFIG_SLAB=y
77# CONFIG_SLUB is not set
78# CONFIG_SLOB is not set
79# CONFIG_PROFILING is not set
80# CONFIG_MARKERS is not set
81CONFIG_HAVE_OPROFILE=y
82# CONFIG_KPROBES is not set
83CONFIG_HAVE_KPROBES=y
84CONFIG_HAVE_KRETPROBES=y
85# CONFIG_HAVE_DMA_ATTRS is not set
86CONFIG_PROC_PAGE_MONITOR=y
87CONFIG_SLABINFO=y
88CONFIG_RT_MUTEXES=y
89# CONFIG_TINY_SHMEM is not set
90CONFIG_BASE_SMALL=0
91CONFIG_MODULES=y
92# CONFIG_MODULE_FORCE_LOAD is not set
93CONFIG_MODULE_UNLOAD=y
94# CONFIG_MODULE_FORCE_UNLOAD is not set
95# CONFIG_MODVERSIONS is not set
96# CONFIG_MODULE_SRCVERSION_ALL is not set
97# CONFIG_KMOD is not set
98CONFIG_BLOCK=y
99# CONFIG_LBD is not set
100# CONFIG_BLK_DEV_IO_TRACE is not set
101# CONFIG_LSF is not set
102# CONFIG_BLK_DEV_BSG is not set
103
104#
105# IO Schedulers
106#
107CONFIG_IOSCHED_NOOP=y
108CONFIG_IOSCHED_AS=y
109CONFIG_IOSCHED_DEADLINE=y
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
118#
119# System Type
120#
121# CONFIG_ARCH_AAEC2000 is not set
122# CONFIG_ARCH_INTEGRATOR is not set
123# CONFIG_ARCH_REALVIEW is not set
124# CONFIG_ARCH_VERSATILE is not set
125# CONFIG_ARCH_AT91 is not set
126# CONFIG_ARCH_CLPS7500 is not set
127# CONFIG_ARCH_CLPS711X is not set
128# CONFIG_ARCH_CO285 is not set
129# CONFIG_ARCH_EBSA110 is not set
130# CONFIG_ARCH_EP93XX is not set
131# CONFIG_ARCH_FOOTBRIDGE is not set
132# CONFIG_ARCH_NETX is not set
133# CONFIG_ARCH_H720X is not set
134# CONFIG_ARCH_IMX is not set
135# CONFIG_ARCH_IOP13XX is not set
136# CONFIG_ARCH_IOP32X is not set
137# CONFIG_ARCH_IOP33X is not set
138# CONFIG_ARCH_IXP23XX is not set
139# CONFIG_ARCH_IXP2000 is not set
140# CONFIG_ARCH_IXP4XX is not set
141# CONFIG_ARCH_L7200 is not set
142# CONFIG_ARCH_KIRKWOOD is not set
143# CONFIG_ARCH_KS8695 is not set
144# CONFIG_ARCH_NS9XXX is not set
145CONFIG_ARCH_LOKI=y
146# CONFIG_ARCH_MV78XX0 is not set
147# CONFIG_ARCH_MXC is not set
148# CONFIG_ARCH_ORION5X is not set
149# CONFIG_ARCH_PNX4008 is not set
150# CONFIG_ARCH_PXA is not set
151# CONFIG_ARCH_RPC is not set
152# CONFIG_ARCH_SA1100 is not set
153# CONFIG_ARCH_S3C2410 is not set
154# CONFIG_ARCH_SHARK is not set
155# CONFIG_ARCH_LH7A40X is not set
156# CONFIG_ARCH_DAVINCI is not set
157# CONFIG_ARCH_OMAP is not set
158# CONFIG_ARCH_MSM7X00A is not set
159
160#
161# Marvell Loki (88RC8480) Implementations
162#
163CONFIG_MACH_LB88RC8480=y
164
165#
166# Boot options
167#
168
169#
170# Power management
171#
172CONFIG_PLAT_ORION=y
173
174#
175# Processor Type
176#
177CONFIG_CPU_32=y
178CONFIG_CPU_FEROCEON=y
179# CONFIG_CPU_FEROCEON_OLD_ID is not set
180CONFIG_CPU_32v5=y
181CONFIG_CPU_ABRT_EV5T=y
182CONFIG_CPU_PABRT_NOIFAR=y
183CONFIG_CPU_CACHE_VIVT=y
184CONFIG_CPU_COPY_FEROCEON=y
185CONFIG_CPU_TLB_FEROCEON=y
186CONFIG_CPU_CP15=y
187CONFIG_CPU_CP15_MMU=y
188
189#
190# Processor Features
191#
192CONFIG_ARM_THUMB=y
193# CONFIG_CPU_ICACHE_DISABLE is not set
194# CONFIG_CPU_DCACHE_DISABLE is not set
195# CONFIG_OUTER_CACHE is not set
196
197#
198# Bus support
199#
200# CONFIG_PCI_SYSCALL is not set
201# CONFIG_ARCH_SUPPORTS_MSI is not set
202# CONFIG_PCCARD is not set
203
204#
205# Kernel Features
206#
207CONFIG_TICK_ONESHOT=y
208CONFIG_NO_HZ=y
209CONFIG_HIGH_RES_TIMERS=y
210CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
211CONFIG_PREEMPT=y
212CONFIG_HZ=100
213CONFIG_AEABI=y
214CONFIG_OABI_COMPAT=y
215# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set
216CONFIG_SELECT_MEMORY_MODEL=y
217CONFIG_FLATMEM_MANUAL=y
218# CONFIG_DISCONTIGMEM_MANUAL is not set
219# CONFIG_SPARSEMEM_MANUAL is not set
220CONFIG_FLATMEM=y
221CONFIG_FLAT_NODE_MEM_MAP=y
222# CONFIG_SPARSEMEM_STATIC is not set
223# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
224CONFIG_PAGEFLAGS_EXTENDED=y
225CONFIG_SPLIT_PTLOCK_CPUS=4096
226# CONFIG_RESOURCES_64BIT is not set
227CONFIG_ZONE_DMA_FLAG=1
228CONFIG_BOUNCE=y
229CONFIG_VIRT_TO_BUS=y
230CONFIG_ALIGNMENT_TRAP=y
231
232#
233# Boot options
234#
235CONFIG_ZBOOT_ROM_TEXT=0x0
236CONFIG_ZBOOT_ROM_BSS=0x0
237CONFIG_CMDLINE=""
238# CONFIG_XIP_KERNEL is not set
239# CONFIG_KEXEC is not set
240
241#
242# Floating point emulation
243#
244
245#
246# At least one emulation must be selected
247#
248# CONFIG_FPE_NWFPE is not set
249# CONFIG_FPE_FASTFPE is not set
250# CONFIG_VFP is not set
251
252#
253# Userspace binary formats
254#
255CONFIG_BINFMT_ELF=y
256# CONFIG_BINFMT_AOUT is not set
257# CONFIG_BINFMT_MISC is not set
258
259#
260# Power management options
261#
262# CONFIG_PM is not set
263CONFIG_ARCH_SUSPEND_POSSIBLE=y
264
265#
266# Networking
267#
268CONFIG_NET=y
269
270#
271# Networking options
272#
273CONFIG_PACKET=y
274CONFIG_PACKET_MMAP=y
275CONFIG_UNIX=y
276CONFIG_XFRM=y
277# CONFIG_XFRM_USER is not set
278# CONFIG_XFRM_SUB_POLICY is not set
279# CONFIG_XFRM_MIGRATE is not set
280# CONFIG_XFRM_STATISTICS is not set
281# CONFIG_NET_KEY is not set
282CONFIG_INET=y
283CONFIG_IP_MULTICAST=y
284# CONFIG_IP_ADVANCED_ROUTER is not set
285CONFIG_IP_FIB_HASH=y
286CONFIG_IP_PNP=y
287CONFIG_IP_PNP_DHCP=y
288CONFIG_IP_PNP_BOOTP=y
289# CONFIG_IP_PNP_RARP is not set
290# CONFIG_NET_IPIP is not set
291# CONFIG_NET_IPGRE is not set
292# CONFIG_IP_MROUTE is not set
293# CONFIG_ARPD is not set
294# CONFIG_SYN_COOKIES is not set
295# CONFIG_INET_AH is not set
296# CONFIG_INET_ESP is not set
297# CONFIG_INET_IPCOMP is not set
298# CONFIG_INET_XFRM_TUNNEL is not set
299# CONFIG_INET_TUNNEL is not set
300CONFIG_INET_XFRM_MODE_TRANSPORT=y
301CONFIG_INET_XFRM_MODE_TUNNEL=y
302CONFIG_INET_XFRM_MODE_BEET=y
303# CONFIG_INET_LRO is not set
304CONFIG_INET_DIAG=y
305CONFIG_INET_TCP_DIAG=y
306# CONFIG_TCP_CONG_ADVANCED is not set
307CONFIG_TCP_CONG_CUBIC=y
308CONFIG_DEFAULT_TCP_CONG="cubic"
309# CONFIG_TCP_MD5SIG is not set
310# CONFIG_IPV6 is not set
311# CONFIG_NETWORK_SECMARK is not set
312# CONFIG_NETFILTER is not set
313# CONFIG_IP_DCCP is not set
314# CONFIG_IP_SCTP is not set
315# CONFIG_TIPC is not set
316# CONFIG_ATM is not set
317# CONFIG_BRIDGE is not set
318# CONFIG_VLAN_8021Q is not set
319# CONFIG_DECNET is not set
320# CONFIG_LLC2 is not set
321# CONFIG_IPX is not set
322# CONFIG_ATALK is not set
323# CONFIG_X25 is not set
324# CONFIG_LAPB is not set
325# CONFIG_ECONET is not set
326# CONFIG_WAN_ROUTER is not set
327# CONFIG_NET_SCHED is not set
328
329#
330# Network testing
331#
332CONFIG_NET_PKTGEN=m
333# CONFIG_HAMRADIO is not set
334# CONFIG_CAN is not set
335# CONFIG_IRDA is not set
336# CONFIG_BT is not set
337# CONFIG_AF_RXRPC is not set
338
339#
340# Wireless
341#
342# CONFIG_CFG80211 is not set
343CONFIG_WIRELESS_EXT=y
344# CONFIG_MAC80211 is not set
345# CONFIG_IEEE80211 is not set
346# CONFIG_RFKILL is not set
347# CONFIG_NET_9P is not set
348
349#
350# Device Drivers
351#
352
353#
354# Generic Driver Options
355#
356CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
357CONFIG_STANDALONE=y
358CONFIG_PREVENT_FIRMWARE_BUILD=y
359CONFIG_FW_LOADER=y
360# CONFIG_SYS_HYPERVISOR is not set
361# CONFIG_CONNECTOR is not set
362CONFIG_MTD=y
363# CONFIG_MTD_DEBUG is not set
364# CONFIG_MTD_CONCAT is not set
365CONFIG_MTD_PARTITIONS=y
366# CONFIG_MTD_REDBOOT_PARTS is not set
367CONFIG_MTD_CMDLINE_PARTS=y
368# CONFIG_MTD_AFS_PARTS is not set
369# CONFIG_MTD_AR7_PARTS is not set
370
371#
372# User Modules And Translation Layers
373#
374CONFIG_MTD_CHAR=y
375CONFIG_MTD_BLKDEVS=y
376CONFIG_MTD_BLOCK=y
377CONFIG_FTL=y
378CONFIG_NFTL=y
379# CONFIG_NFTL_RW is not set
380# CONFIG_INFTL is not set
381# CONFIG_RFD_FTL is not set
382# CONFIG_SSFDC is not set
383# CONFIG_MTD_OOPS is not set
384
385#
386# RAM/ROM/Flash chip drivers
387#
388CONFIG_MTD_CFI=y
389CONFIG_MTD_JEDECPROBE=y
390CONFIG_MTD_GEN_PROBE=y
391CONFIG_MTD_CFI_ADV_OPTIONS=y
392CONFIG_MTD_CFI_NOSWAP=y
393# CONFIG_MTD_CFI_BE_BYTE_SWAP is not set
394# CONFIG_MTD_CFI_LE_BYTE_SWAP is not set
395CONFIG_MTD_CFI_GEOMETRY=y
396CONFIG_MTD_MAP_BANK_WIDTH_1=y
397CONFIG_MTD_MAP_BANK_WIDTH_2=y
398CONFIG_MTD_MAP_BANK_WIDTH_4=y
399# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
400# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
401# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
402CONFIG_MTD_CFI_I1=y
403CONFIG_MTD_CFI_I2=y
404CONFIG_MTD_CFI_I4=y
405# CONFIG_MTD_CFI_I8 is not set
406# CONFIG_MTD_OTP is not set
407CONFIG_MTD_CFI_INTELEXT=y
408CONFIG_MTD_CFI_AMDSTD=y
409CONFIG_MTD_CFI_STAA=y
410CONFIG_MTD_CFI_UTIL=y
411# CONFIG_MTD_RAM is not set
412# CONFIG_MTD_ROM is not set
413# CONFIG_MTD_ABSENT is not set
414
415#
416# Mapping drivers for chip access
417#
418# CONFIG_MTD_COMPLEX_MAPPINGS is not set
419CONFIG_MTD_PHYSMAP=y
420CONFIG_MTD_PHYSMAP_START=0x0
421CONFIG_MTD_PHYSMAP_LEN=0x0
422CONFIG_MTD_PHYSMAP_BANKWIDTH=0
423# CONFIG_MTD_ARM_INTEGRATOR is not set
424# CONFIG_MTD_IMPA7 is not set
425# CONFIG_MTD_PLATRAM is not set
426
427#
428# Self-contained MTD device drivers
429#
430# CONFIG_MTD_DATAFLASH is not set
431CONFIG_MTD_M25P80=y
432CONFIG_M25PXX_USE_FAST_READ=y
433# CONFIG_MTD_SLRAM is not set
434# CONFIG_MTD_PHRAM is not set
435# CONFIG_MTD_MTDRAM is not set
436# CONFIG_MTD_BLOCK2MTD is not set
437
438#
439# Disk-On-Chip Device Drivers
440#
441# CONFIG_MTD_DOC2000 is not set
442# CONFIG_MTD_DOC2001 is not set
443# CONFIG_MTD_DOC2001PLUS is not set
444CONFIG_MTD_NAND=y
445CONFIG_MTD_NAND_VERIFY_WRITE=y
446# CONFIG_MTD_NAND_ECC_SMC is not set
447# CONFIG_MTD_NAND_MUSEUM_IDS is not set
448CONFIG_MTD_NAND_IDS=y
449# CONFIG_MTD_NAND_DISKONCHIP is not set
450# CONFIG_MTD_NAND_NANDSIM is not set
451# CONFIG_MTD_NAND_PLATFORM is not set
452# CONFIG_MTD_ALAUDA is not set
453CONFIG_MTD_NAND_ORION=y
454# CONFIG_MTD_ONENAND is not set
455
456#
457# UBI - Unsorted block images
458#
459# CONFIG_MTD_UBI is not set
460# CONFIG_PARPORT is not set
461CONFIG_BLK_DEV=y
462# CONFIG_BLK_DEV_COW_COMMON is not set
463CONFIG_BLK_DEV_LOOP=y
464# CONFIG_BLK_DEV_CRYPTOLOOP is not set
465# CONFIG_BLK_DEV_NBD is not set
466# CONFIG_BLK_DEV_UB is not set
467# CONFIG_BLK_DEV_RAM is not set
468# CONFIG_CDROM_PKTCDVD is not set
469# CONFIG_ATA_OVER_ETH is not set
470# CONFIG_MISC_DEVICES is not set
471CONFIG_HAVE_IDE=y
472# CONFIG_IDE is not set
473
474#
475# SCSI device support
476#
477# CONFIG_RAID_ATTRS is not set
478CONFIG_SCSI=y
479CONFIG_SCSI_DMA=y
480# CONFIG_SCSI_TGT is not set
481# CONFIG_SCSI_NETLINK is not set
482# CONFIG_SCSI_PROC_FS is not set
483
484#
485# SCSI support type (disk, tape, CD-ROM)
486#
487CONFIG_BLK_DEV_SD=y
488# CONFIG_CHR_DEV_ST is not set
489# CONFIG_CHR_DEV_OSST is not set
490CONFIG_BLK_DEV_SR=m
491# CONFIG_BLK_DEV_SR_VENDOR is not set
492CONFIG_CHR_DEV_SG=m
493# CONFIG_CHR_DEV_SCH is not set
494
495#
496# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
497#
498# CONFIG_SCSI_MULTI_LUN is not set
499# CONFIG_SCSI_CONSTANTS is not set
500# CONFIG_SCSI_LOGGING is not set
501# CONFIG_SCSI_SCAN_ASYNC is not set
502CONFIG_SCSI_WAIT_SCAN=m
503
504#
505# SCSI Transports
506#
507# CONFIG_SCSI_SPI_ATTRS is not set
508# CONFIG_SCSI_FC_ATTRS is not set
509# CONFIG_SCSI_ISCSI_ATTRS is not set
510# CONFIG_SCSI_SAS_LIBSAS is not set
511# CONFIG_SCSI_SRP_ATTRS is not set
512CONFIG_SCSI_LOWLEVEL=y
513# CONFIG_ISCSI_TCP is not set
514# CONFIG_SCSI_DEBUG is not set
515CONFIG_ATA=y
516# CONFIG_ATA_NONSTANDARD is not set
517CONFIG_SATA_PMP=y
518CONFIG_ATA_SFF=y
519CONFIG_SATA_MV=y
520# CONFIG_PATA_PLATFORM is not set
521# CONFIG_MD is not set
522CONFIG_NETDEVICES=y
523# CONFIG_NETDEVICES_MULTIQUEUE is not set
524# CONFIG_DUMMY is not set
525# CONFIG_BONDING is not set
526# CONFIG_MACVLAN is not set
527# CONFIG_EQUALIZER is not set
528# CONFIG_TUN is not set
529# CONFIG_VETH is not set
530# CONFIG_PHYLIB is not set
531CONFIG_NET_ETHERNET=y
532CONFIG_MII=y
533# CONFIG_AX88796 is not set
534# CONFIG_SMC91X is not set
535# CONFIG_DM9000 is not set
536# CONFIG_ENC28J60 is not set
537# CONFIG_IBM_NEW_EMAC_ZMII is not set
538# CONFIG_IBM_NEW_EMAC_RGMII is not set
539# CONFIG_IBM_NEW_EMAC_TAH is not set
540# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
541# CONFIG_B44 is not set
542CONFIG_NETDEV_1000=y
543# CONFIG_E1000E_ENABLED is not set
544CONFIG_MV643XX_ETH=y
545# CONFIG_NETDEV_10000 is not set
546
547#
548# Wireless LAN
549#
550# CONFIG_WLAN_PRE80211 is not set
551# CONFIG_WLAN_80211 is not set
552# CONFIG_IWLWIFI_LEDS is not set
553
554#
555# USB Network Adapters
556#
557# CONFIG_USB_CATC is not set
558# CONFIG_USB_KAWETH is not set
559# CONFIG_USB_PEGASUS is not set
560# CONFIG_USB_RTL8150 is not set
561# CONFIG_USB_USBNET is not set
562# CONFIG_WAN is not set
563# CONFIG_PPP is not set
564# CONFIG_SLIP is not set
565# CONFIG_NETCONSOLE is not set
566# CONFIG_NETPOLL is not set
567# CONFIG_NET_POLL_CONTROLLER is not set
568# CONFIG_ISDN is not set
569
570#
571# Input device support
572#
573CONFIG_INPUT=y
574# CONFIG_INPUT_FF_MEMLESS is not set
575# CONFIG_INPUT_POLLDEV is not set
576
577#
578# Userland interfaces
579#
580CONFIG_INPUT_MOUSEDEV=y
581CONFIG_INPUT_MOUSEDEV_PSAUX=y
582CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
583CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
584# CONFIG_INPUT_JOYDEV is not set
585# CONFIG_INPUT_EVDEV is not set
586# CONFIG_INPUT_EVBUG is not set
587
588#
589# Input Device Drivers
590#
591# CONFIG_INPUT_KEYBOARD is not set
592# CONFIG_INPUT_MOUSE is not set
593# CONFIG_INPUT_JOYSTICK is not set
594# CONFIG_INPUT_TABLET is not set
595# CONFIG_INPUT_TOUCHSCREEN is not set
596# CONFIG_INPUT_MISC is not set
597
598#
599# Hardware I/O ports
600#
601# CONFIG_SERIO is not set
602# CONFIG_GAMEPORT is not set
603
604#
605# Character devices
606#
607CONFIG_VT=y
608CONFIG_VT_CONSOLE=y
609CONFIG_HW_CONSOLE=y
610# CONFIG_VT_HW_CONSOLE_BINDING is not set
611CONFIG_DEVKMEM=y
612# CONFIG_SERIAL_NONSTANDARD is not set
613
614#
615# Serial drivers
616#
617CONFIG_SERIAL_8250=y
618CONFIG_SERIAL_8250_CONSOLE=y
619CONFIG_SERIAL_8250_NR_UARTS=4
620CONFIG_SERIAL_8250_RUNTIME_UARTS=2
621# CONFIG_SERIAL_8250_EXTENDED is not set
622
623#
624# Non-8250 serial port support
625#
626CONFIG_SERIAL_CORE=y
627CONFIG_SERIAL_CORE_CONSOLE=y
628CONFIG_UNIX98_PTYS=y
629CONFIG_LEGACY_PTYS=y
630CONFIG_LEGACY_PTY_COUNT=16
631# CONFIG_IPMI_HANDLER is not set
632CONFIG_HW_RANDOM=m
633# CONFIG_NVRAM is not set
634# CONFIG_R3964 is not set
635# CONFIG_RAW_DRIVER is not set
636# CONFIG_TCG_TPM is not set
637CONFIG_I2C=y
638CONFIG_I2C_BOARDINFO=y
639CONFIG_I2C_CHARDEV=y
640
641#
642# I2C Hardware Bus support
643#
644# CONFIG_I2C_OCORES is not set
645# CONFIG_I2C_PARPORT_LIGHT is not set
646# CONFIG_I2C_SIMTEC is not set
647# CONFIG_I2C_TAOS_EVM is not set
648# CONFIG_I2C_STUB is not set
649# CONFIG_I2C_TINY_USB is not set
650# CONFIG_I2C_PCA_PLATFORM is not set
651CONFIG_I2C_MV64XXX=y
652
653#
654# Miscellaneous I2C Chip support
655#
656# CONFIG_DS1682 is not set
657# CONFIG_SENSORS_EEPROM is not set
658# CONFIG_SENSORS_PCF8574 is not set
659# CONFIG_PCF8575 is not set
660# CONFIG_SENSORS_PCF8591 is not set
661# CONFIG_SENSORS_MAX6875 is not set
662# CONFIG_SENSORS_TSL2550 is not set
663# CONFIG_I2C_DEBUG_CORE is not set
664# CONFIG_I2C_DEBUG_ALGO is not set
665# CONFIG_I2C_DEBUG_BUS is not set
666# CONFIG_I2C_DEBUG_CHIP is not set
667CONFIG_SPI=y
668CONFIG_SPI_MASTER=y
669
670#
671# SPI Master Controller Drivers
672#
673# CONFIG_SPI_BITBANG is not set
674
675#
676# SPI Protocol Masters
677#
678# CONFIG_SPI_AT25 is not set
679# CONFIG_SPI_SPIDEV is not set
680# CONFIG_SPI_TLE62X0 is not set
681# CONFIG_W1 is not set
682# CONFIG_POWER_SUPPLY is not set
683# CONFIG_HWMON is not set
684# CONFIG_WATCHDOG is not set
685
686#
687# Sonics Silicon Backplane
688#
689CONFIG_SSB_POSSIBLE=y
690# CONFIG_SSB is not set
691
692#
693# Multifunction device drivers
694#
695# CONFIG_MFD_SM501 is not set
696# CONFIG_MFD_ASIC3 is not set
697# CONFIG_HTC_PASIC3 is not set
698
699#
700# Multimedia devices
701#
702
703#
704# Multimedia core support
705#
706# CONFIG_VIDEO_DEV is not set
707# CONFIG_DVB_CORE is not set
708# CONFIG_VIDEO_MEDIA is not set
709
710#
711# Multimedia drivers
712#
713# CONFIG_DAB is not set
714
715#
716# Graphics support
717#
718# CONFIG_VGASTATE is not set
719# CONFIG_VIDEO_OUTPUT_CONTROL is not set
720# CONFIG_FB is not set
721# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
722
723#
724# Display device support
725#
726# CONFIG_DISPLAY_SUPPORT is not set
727
728#
729# Console display driver support
730#
731# CONFIG_VGA_CONSOLE is not set
732CONFIG_DUMMY_CONSOLE=y
733
734#
735# Sound
736#
737# CONFIG_SOUND is not set
738CONFIG_HID_SUPPORT=y
739CONFIG_HID=y
740# CONFIG_HID_DEBUG is not set
741# CONFIG_HIDRAW is not set
742
743#
744# USB Input Devices
745#
746CONFIG_USB_HID=y
747# CONFIG_USB_HIDINPUT_POWERBOOK is not set
748# CONFIG_HID_FF is not set
749# CONFIG_USB_HIDDEV is not set
750CONFIG_USB_SUPPORT=y
751CONFIG_USB_ARCH_HAS_HCD=y
752# CONFIG_USB_ARCH_HAS_OHCI is not set
753# CONFIG_USB_ARCH_HAS_EHCI is not set
754CONFIG_USB=y
755# CONFIG_USB_DEBUG is not set
756# CONFIG_USB_ANNOUNCE_NEW_DEVICES is not set
757
758#
759# Miscellaneous USB options
760#
761CONFIG_USB_DEVICEFS=y
762CONFIG_USB_DEVICE_CLASS=y
763# CONFIG_USB_DYNAMIC_MINORS is not set
764# CONFIG_USB_OTG is not set
765# CONFIG_USB_OTG_WHITELIST is not set
766# CONFIG_USB_OTG_BLACKLIST_HUB is not set
767
768#
769# USB Host Controller Drivers
770#
771# CONFIG_USB_C67X00_HCD is not set
772# CONFIG_USB_ISP116X_HCD is not set
773# CONFIG_USB_ISP1760_HCD is not set
774# CONFIG_USB_SL811_HCD is not set
775# CONFIG_USB_R8A66597_HCD is not set
776
777#
778# USB Device Class drivers
779#
780# CONFIG_USB_ACM is not set
781CONFIG_USB_PRINTER=y
782# CONFIG_USB_WDM is not set
783
784#
785# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
786#
787
788#
789# may also be needed; see USB_STORAGE Help for more information
790#
791CONFIG_USB_STORAGE=y
792# CONFIG_USB_STORAGE_DEBUG is not set
793CONFIG_USB_STORAGE_DATAFAB=y
794CONFIG_USB_STORAGE_FREECOM=y
795# CONFIG_USB_STORAGE_ISD200 is not set
796CONFIG_USB_STORAGE_DPCM=y
797# CONFIG_USB_STORAGE_USBAT is not set
798CONFIG_USB_STORAGE_SDDR09=y
799CONFIG_USB_STORAGE_SDDR55=y
800CONFIG_USB_STORAGE_JUMPSHOT=y
801# CONFIG_USB_STORAGE_ALAUDA is not set
802# CONFIG_USB_STORAGE_ONETOUCH is not set
803# CONFIG_USB_STORAGE_KARMA is not set
804# CONFIG_USB_STORAGE_CYPRESS_ATACB is not set
805# CONFIG_USB_LIBUSUAL is not set
806
807#
808# USB Imaging devices
809#
810# CONFIG_USB_MDC800 is not set
811# CONFIG_USB_MICROTEK is not set
812# CONFIG_USB_MON is not set
813
814#
815# USB port drivers
816#
817# CONFIG_USB_SERIAL is not set
818
819#
820# USB Miscellaneous drivers
821#
822# CONFIG_USB_EMI62 is not set
823# CONFIG_USB_EMI26 is not set
824# CONFIG_USB_ADUTUX is not set
825# CONFIG_USB_AUERSWALD is not set
826# CONFIG_USB_RIO500 is not set
827# CONFIG_USB_LEGOTOWER is not set
828# CONFIG_USB_LCD is not set
829# CONFIG_USB_BERRY_CHARGE is not set
830# CONFIG_USB_LED is not set
831# CONFIG_USB_CYPRESS_CY7C63 is not set
832# CONFIG_USB_CYTHERM is not set
833# CONFIG_USB_PHIDGET is not set
834# CONFIG_USB_IDMOUSE is not set
835# CONFIG_USB_FTDI_ELAN is not set
836# CONFIG_USB_APPLEDISPLAY is not set
837# CONFIG_USB_LD is not set
838# CONFIG_USB_TRANCEVIBRATOR is not set
839# CONFIG_USB_IOWARRIOR is not set
840# CONFIG_USB_TEST is not set
841# CONFIG_USB_ISIGHTFW is not set
842# CONFIG_USB_GADGET is not set
843# CONFIG_MMC is not set
844CONFIG_NEW_LEDS=y
845# CONFIG_LEDS_CLASS is not set
846
847#
848# LED drivers
849#
850
851#
852# LED Triggers
853#
854# CONFIG_LEDS_TRIGGERS is not set
855CONFIG_RTC_LIB=y
856# CONFIG_RTC_CLASS is not set
857# CONFIG_UIO is not set
858
859#
860# File systems
861#
862CONFIG_EXT2_FS=y
863# CONFIG_EXT2_FS_XATTR is not set
864# CONFIG_EXT2_FS_XIP is not set
865CONFIG_EXT3_FS=y
866# CONFIG_EXT3_FS_XATTR is not set
867# CONFIG_EXT4DEV_FS is not set
868CONFIG_JBD=y
869# CONFIG_REISERFS_FS is not set
870# CONFIG_JFS_FS is not set
871# CONFIG_FS_POSIX_ACL is not set
872CONFIG_XFS_FS=y
873# CONFIG_XFS_QUOTA is not set
874# CONFIG_XFS_POSIX_ACL is not set
875# CONFIG_XFS_RT is not set
876# CONFIG_XFS_DEBUG is not set
877# CONFIG_OCFS2_FS is not set
878CONFIG_DNOTIFY=y
879CONFIG_INOTIFY=y
880CONFIG_INOTIFY_USER=y
881# CONFIG_QUOTA is not set
882# CONFIG_AUTOFS_FS is not set
883# CONFIG_AUTOFS4_FS is not set
884# CONFIG_FUSE_FS is not set
885
886#
887# CD-ROM/DVD Filesystems
888#
889CONFIG_ISO9660_FS=y
890# CONFIG_JOLIET is not set
891# CONFIG_ZISOFS is not set
892CONFIG_UDF_FS=m
893CONFIG_UDF_NLS=y
894
895#
896# DOS/FAT/NT Filesystems
897#
898CONFIG_FAT_FS=y
899CONFIG_MSDOS_FS=y
900CONFIG_VFAT_FS=y
901CONFIG_FAT_DEFAULT_CODEPAGE=437
902CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
903# CONFIG_NTFS_FS is not set
904
905#
906# Pseudo filesystems
907#
908CONFIG_PROC_FS=y
909CONFIG_PROC_SYSCTL=y
910CONFIG_SYSFS=y
911CONFIG_TMPFS=y
912# CONFIG_TMPFS_POSIX_ACL is not set
913# CONFIG_HUGETLB_PAGE is not set
914# CONFIG_CONFIGFS_FS is not set
915
916#
917# Miscellaneous filesystems
918#
919# CONFIG_ADFS_FS is not set
920# CONFIG_AFFS_FS is not set
921# CONFIG_HFS_FS is not set
922# CONFIG_HFSPLUS_FS is not set
923# CONFIG_BEFS_FS is not set
924# CONFIG_BFS_FS is not set
925# CONFIG_EFS_FS is not set
926CONFIG_JFFS2_FS=y
927CONFIG_JFFS2_FS_DEBUG=0
928CONFIG_JFFS2_FS_WRITEBUFFER=y
929# CONFIG_JFFS2_FS_WBUF_VERIFY is not set
930# CONFIG_JFFS2_SUMMARY is not set
931# CONFIG_JFFS2_FS_XATTR is not set
932# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set
933CONFIG_JFFS2_ZLIB=y
934# CONFIG_JFFS2_LZO is not set
935CONFIG_JFFS2_RTIME=y
936# CONFIG_JFFS2_RUBIN is not set
937CONFIG_CRAMFS=y
938# CONFIG_VXFS_FS is not set
939# CONFIG_MINIX_FS is not set
940# CONFIG_HPFS_FS is not set
941# CONFIG_QNX4FS_FS is not set
942# CONFIG_ROMFS_FS is not set
943# CONFIG_SYSV_FS is not set
944# CONFIG_UFS_FS is not set
945CONFIG_NETWORK_FILESYSTEMS=y
946CONFIG_NFS_FS=y
947CONFIG_NFS_V3=y
948# CONFIG_NFS_V3_ACL is not set
949# CONFIG_NFS_V4 is not set
950# CONFIG_NFSD is not set
951CONFIG_ROOT_NFS=y
952CONFIG_LOCKD=y
953CONFIG_LOCKD_V4=y
954CONFIG_NFS_COMMON=y
955CONFIG_SUNRPC=y
956# CONFIG_SUNRPC_BIND34 is not set
957# CONFIG_RPCSEC_GSS_KRB5 is not set
958# CONFIG_RPCSEC_GSS_SPKM3 is not set
959# CONFIG_SMB_FS is not set
960# CONFIG_CIFS is not set
961# CONFIG_NCP_FS is not set
962# CONFIG_CODA_FS is not set
963# CONFIG_AFS_FS is not set
964
965#
966# Partition Types
967#
968CONFIG_PARTITION_ADVANCED=y
969# CONFIG_ACORN_PARTITION is not set
970# CONFIG_OSF_PARTITION is not set
971# CONFIG_AMIGA_PARTITION is not set
972# CONFIG_ATARI_PARTITION is not set
973# CONFIG_MAC_PARTITION is not set
974CONFIG_MSDOS_PARTITION=y
975CONFIG_BSD_DISKLABEL=y
976CONFIG_MINIX_SUBPARTITION=y
977CONFIG_SOLARIS_X86_PARTITION=y
978CONFIG_UNIXWARE_DISKLABEL=y
979CONFIG_LDM_PARTITION=y
980CONFIG_LDM_DEBUG=y
981# CONFIG_SGI_PARTITION is not set
982# CONFIG_ULTRIX_PARTITION is not set
983CONFIG_SUN_PARTITION=y
984# CONFIG_KARMA_PARTITION is not set
985# CONFIG_EFI_PARTITION is not set
986# CONFIG_SYSV68_PARTITION is not set
987CONFIG_NLS=y
988CONFIG_NLS_DEFAULT="iso8859-1"
989CONFIG_NLS_CODEPAGE_437=y
990# CONFIG_NLS_CODEPAGE_737 is not set
991# CONFIG_NLS_CODEPAGE_775 is not set
992CONFIG_NLS_CODEPAGE_850=y
993# CONFIG_NLS_CODEPAGE_852 is not set
994# CONFIG_NLS_CODEPAGE_855 is not set
995# CONFIG_NLS_CODEPAGE_857 is not set
996# CONFIG_NLS_CODEPAGE_860 is not set
997# CONFIG_NLS_CODEPAGE_861 is not set
998# CONFIG_NLS_CODEPAGE_862 is not set
999# CONFIG_NLS_CODEPAGE_863 is not set
1000# CONFIG_NLS_CODEPAGE_864 is not set
1001# CONFIG_NLS_CODEPAGE_865 is not set
1002# CONFIG_NLS_CODEPAGE_866 is not set
1003# CONFIG_NLS_CODEPAGE_869 is not set
1004# CONFIG_NLS_CODEPAGE_936 is not set
1005# CONFIG_NLS_CODEPAGE_950 is not set
1006# CONFIG_NLS_CODEPAGE_932 is not set
1007# CONFIG_NLS_CODEPAGE_949 is not set
1008# CONFIG_NLS_CODEPAGE_874 is not set
1009# CONFIG_NLS_ISO8859_8 is not set
1010# CONFIG_NLS_CODEPAGE_1250 is not set
1011# CONFIG_NLS_CODEPAGE_1251 is not set
1012# CONFIG_NLS_ASCII is not set
1013CONFIG_NLS_ISO8859_1=y
1014CONFIG_NLS_ISO8859_2=y
1015# CONFIG_NLS_ISO8859_3 is not set
1016# CONFIG_NLS_ISO8859_4 is not set
1017# CONFIG_NLS_ISO8859_5 is not set
1018# CONFIG_NLS_ISO8859_6 is not set
1019# CONFIG_NLS_ISO8859_7 is not set
1020# CONFIG_NLS_ISO8859_9 is not set
1021# CONFIG_NLS_ISO8859_13 is not set
1022# CONFIG_NLS_ISO8859_14 is not set
1023# CONFIG_NLS_ISO8859_15 is not set
1024# CONFIG_NLS_KOI8_R is not set
1025# CONFIG_NLS_KOI8_U is not set
1026# CONFIG_NLS_UTF8 is not set
1027# CONFIG_DLM is not set
1028
1029#
1030# Kernel hacking
1031#
1032# CONFIG_PRINTK_TIME is not set
1033CONFIG_ENABLE_WARN_DEPRECATED=y
1034CONFIG_ENABLE_MUST_CHECK=y
1035CONFIG_FRAME_WARN=1024
1036CONFIG_MAGIC_SYSRQ=y
1037# CONFIG_UNUSED_SYMBOLS is not set
1038# CONFIG_DEBUG_FS is not set
1039# CONFIG_HEADERS_CHECK is not set
1040# CONFIG_DEBUG_KERNEL is not set
1041# CONFIG_DEBUG_BUGVERBOSE is not set
1042CONFIG_FRAME_POINTER=y
1043# CONFIG_LATENCYTOP is not set
1044# CONFIG_SAMPLES is not set
1045CONFIG_DEBUG_USER=y
1046
1047#
1048# Security options
1049#
1050# CONFIG_KEYS is not set
1051# CONFIG_SECURITY is not set
1052# CONFIG_SECURITY_FILE_CAPABILITIES is not set
1053CONFIG_CRYPTO=y
1054
1055#
1056# Crypto core or helper
1057#
1058CONFIG_CRYPTO_ALGAPI=m
1059CONFIG_CRYPTO_BLKCIPHER=m
1060CONFIG_CRYPTO_MANAGER=m
1061# CONFIG_CRYPTO_GF128MUL is not set
1062# CONFIG_CRYPTO_NULL is not set
1063# CONFIG_CRYPTO_CRYPTD is not set
1064# CONFIG_CRYPTO_AUTHENC is not set
1065# CONFIG_CRYPTO_TEST is not set
1066
1067#
1068# Authenticated Encryption with Associated Data
1069#
1070# CONFIG_CRYPTO_CCM is not set
1071# CONFIG_CRYPTO_GCM is not set
1072# CONFIG_CRYPTO_SEQIV is not set
1073
1074#
1075# Block modes
1076#
1077CONFIG_CRYPTO_CBC=m
1078# CONFIG_CRYPTO_CTR is not set
1079# CONFIG_CRYPTO_CTS is not set
1080CONFIG_CRYPTO_ECB=m
1081# CONFIG_CRYPTO_LRW is not set
1082CONFIG_CRYPTO_PCBC=m
1083# CONFIG_CRYPTO_XTS is not set
1084
1085#
1086# Hash modes
1087#
1088# CONFIG_CRYPTO_HMAC is not set
1089# CONFIG_CRYPTO_XCBC is not set
1090
1091#
1092# Digest
1093#
1094# CONFIG_CRYPTO_CRC32C is not set
1095# CONFIG_CRYPTO_MD4 is not set
1096# CONFIG_CRYPTO_MD5 is not set
1097# CONFIG_CRYPTO_MICHAEL_MIC is not set
1098# CONFIG_CRYPTO_SHA1 is not set
1099# CONFIG_CRYPTO_SHA256 is not set
1100# CONFIG_CRYPTO_SHA512 is not set
1101# CONFIG_CRYPTO_TGR192 is not set
1102# CONFIG_CRYPTO_WP512 is not set
1103
1104#
1105# Ciphers
1106#
1107# CONFIG_CRYPTO_AES is not set
1108# CONFIG_CRYPTO_ANUBIS is not set
1109# CONFIG_CRYPTO_ARC4 is not set
1110# CONFIG_CRYPTO_BLOWFISH is not set
1111# CONFIG_CRYPTO_CAMELLIA is not set
1112# CONFIG_CRYPTO_CAST5 is not set
1113# CONFIG_CRYPTO_CAST6 is not set
1114# CONFIG_CRYPTO_DES is not set
1115# CONFIG_CRYPTO_FCRYPT is not set
1116# CONFIG_CRYPTO_KHAZAD is not set
1117# CONFIG_CRYPTO_SALSA20 is not set
1118# CONFIG_CRYPTO_SEED is not set
1119# CONFIG_CRYPTO_SERPENT is not set
1120# CONFIG_CRYPTO_TEA is not set
1121# CONFIG_CRYPTO_TWOFISH is not set
1122
1123#
1124# Compression
1125#
1126# CONFIG_CRYPTO_DEFLATE is not set
1127# CONFIG_CRYPTO_LZO is not set
1128CONFIG_CRYPTO_HW=y
1129
1130#
1131# Library routines
1132#
1133CONFIG_BITREVERSE=y
1134# CONFIG_GENERIC_FIND_FIRST_BIT is not set
1135# CONFIG_GENERIC_FIND_NEXT_BIT is not set
1136CONFIG_CRC_CCITT=y
1137CONFIG_CRC16=y
1138CONFIG_CRC_ITU_T=m
1139CONFIG_CRC32=y
1140# CONFIG_CRC7 is not set
1141CONFIG_LIBCRC32C=y
1142CONFIG_ZLIB_INFLATE=y
1143CONFIG_ZLIB_DEFLATE=y
1144CONFIG_PLIST=y
1145CONFIG_HAS_IOMEM=y
1146CONFIG_HAS_IOPORT=y
1147CONFIG_HAS_DMA=y
diff --git a/arch/arm/configs/lpd270_defconfig b/arch/arm/configs/lpd270_defconfig
index a3bf5833b87a..1a38d8e3fe66 100644
--- a/arch/arm/configs/lpd270_defconfig
+++ b/arch/arm/configs/lpd270_defconfig
@@ -173,7 +173,6 @@ CONFIG_XSCALE_PMU=y
173# Kernel Features 173# Kernel Features
174# 174#
175# CONFIG_PREEMPT is not set 175# CONFIG_PREEMPT is not set
176# CONFIG_NO_IDLE_HZ is not set
177CONFIG_HZ=100 176CONFIG_HZ=100
178# CONFIG_AEABI is not set 177# CONFIG_AEABI is not set
179# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set 178# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set
diff --git a/arch/arm/configs/lpd7a404_defconfig b/arch/arm/configs/lpd7a404_defconfig
index 46a0f7fe1fa5..7a2e932da1c6 100644
--- a/arch/arm/configs/lpd7a404_defconfig
+++ b/arch/arm/configs/lpd7a404_defconfig
@@ -148,7 +148,6 @@ CONFIG_ARM_AMBA=y
148# Kernel Features 148# Kernel Features
149# 149#
150CONFIG_PREEMPT=y 150CONFIG_PREEMPT=y
151# CONFIG_NO_IDLE_HZ is not set
152# CONFIG_AEABI is not set 151# CONFIG_AEABI is not set
153CONFIG_ARCH_DISCONTIGMEM_ENABLE=y 152CONFIG_ARCH_DISCONTIGMEM_ENABLE=y
154CONFIG_SELECT_MEMORY_MODEL=y 153CONFIG_SELECT_MEMORY_MODEL=y
diff --git a/arch/arm/configs/mv78xx0_defconfig b/arch/arm/configs/mv78xx0_defconfig
new file mode 100644
index 000000000000..d38ebf8721a4
--- /dev/null
+++ b/arch/arm/configs/mv78xx0_defconfig
@@ -0,0 +1,1445 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.26-rc5
4# Fri Jun 13 02:57:32 2008
5#
6CONFIG_ARM=y
7CONFIG_SYS_SUPPORTS_APM_EMULATION=y
8# CONFIG_GENERIC_GPIO is not set
9CONFIG_GENERIC_TIME=y
10CONFIG_GENERIC_CLOCKEVENTS=y
11CONFIG_MMU=y
12# CONFIG_NO_IOPORT is not set
13CONFIG_GENERIC_HARDIRQS=y
14CONFIG_STACKTRACE_SUPPORT=y
15CONFIG_HAVE_LATENCYTOP_SUPPORT=y
16CONFIG_LOCKDEP_SUPPORT=y
17CONFIG_TRACE_IRQFLAGS_SUPPORT=y
18CONFIG_HARDIRQS_SW_RESEND=y
19CONFIG_GENERIC_IRQ_PROBE=y
20CONFIG_RWSEM_GENERIC_SPINLOCK=y
21# CONFIG_ARCH_HAS_ILOG2_U32 is not set
22# CONFIG_ARCH_HAS_ILOG2_U64 is not set
23CONFIG_GENERIC_HWEIGHT=y
24CONFIG_GENERIC_CALIBRATE_DELAY=y
25CONFIG_ARCH_SUPPORTS_AOUT=y
26CONFIG_ZONE_DMA=y
27CONFIG_VECTORS_BASE=0xffff0000
28CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
29
30#
31# General setup
32#
33CONFIG_EXPERIMENTAL=y
34CONFIG_BROKEN_ON_SMP=y
35CONFIG_LOCK_KERNEL=y
36CONFIG_INIT_ENV_ARG_LIMIT=32
37CONFIG_LOCALVERSION=""
38CONFIG_LOCALVERSION_AUTO=y
39CONFIG_SWAP=y
40CONFIG_SYSVIPC=y
41CONFIG_SYSVIPC_SYSCTL=y
42# CONFIG_POSIX_MQUEUE is not set
43# CONFIG_BSD_PROCESS_ACCT is not set
44# CONFIG_TASKSTATS is not set
45# CONFIG_AUDIT is not set
46# CONFIG_IKCONFIG is not set
47CONFIG_LOG_BUF_SHIFT=14
48# CONFIG_CGROUPS is not set
49# CONFIG_GROUP_SCHED is not set
50CONFIG_SYSFS_DEPRECATED=y
51CONFIG_SYSFS_DEPRECATED_V2=y
52# CONFIG_RELAY is not set
53# CONFIG_NAMESPACES is not set
54# CONFIG_BLK_DEV_INITRD is not set
55CONFIG_CC_OPTIMIZE_FOR_SIZE=y
56CONFIG_SYSCTL=y
57CONFIG_EMBEDDED=y
58CONFIG_UID16=y
59CONFIG_SYSCTL_SYSCALL=y
60CONFIG_SYSCTL_SYSCALL_CHECK=y
61CONFIG_KALLSYMS=y
62CONFIG_KALLSYMS_ALL=y
63# CONFIG_KALLSYMS_EXTRA_PASS is not set
64CONFIG_HOTPLUG=y
65CONFIG_PRINTK=y
66CONFIG_BUG=y
67CONFIG_ELF_CORE=y
68CONFIG_COMPAT_BRK=y
69CONFIG_BASE_FULL=y
70CONFIG_FUTEX=y
71CONFIG_ANON_INODES=y
72CONFIG_EPOLL=y
73CONFIG_SIGNALFD=y
74CONFIG_TIMERFD=y
75CONFIG_EVENTFD=y
76CONFIG_SHMEM=y
77CONFIG_VM_EVENT_COUNTERS=y
78# CONFIG_SLUB_DEBUG is not set
79# CONFIG_SLAB is not set
80CONFIG_SLUB=y
81# CONFIG_SLOB is not set
82CONFIG_PROFILING=y
83# CONFIG_MARKERS is not set
84CONFIG_OPROFILE=y
85CONFIG_HAVE_OPROFILE=y
86CONFIG_KPROBES=y
87CONFIG_KRETPROBES=y
88CONFIG_HAVE_KPROBES=y
89CONFIG_HAVE_KRETPROBES=y
90# CONFIG_HAVE_DMA_ATTRS is not set
91CONFIG_PROC_PAGE_MONITOR=y
92CONFIG_RT_MUTEXES=y
93# CONFIG_TINY_SHMEM is not set
94CONFIG_BASE_SMALL=0
95CONFIG_MODULES=y
96# CONFIG_MODULE_FORCE_LOAD is not set
97CONFIG_MODULE_UNLOAD=y
98# CONFIG_MODULE_FORCE_UNLOAD is not set
99# CONFIG_MODVERSIONS is not set
100# CONFIG_MODULE_SRCVERSION_ALL is not set
101# CONFIG_KMOD is not set
102CONFIG_BLOCK=y
103# CONFIG_LBD is not set
104# CONFIG_BLK_DEV_IO_TRACE is not set
105# CONFIG_LSF is not set
106# CONFIG_BLK_DEV_BSG is not set
107
108#
109# IO Schedulers
110#
111CONFIG_IOSCHED_NOOP=y
112CONFIG_IOSCHED_AS=y
113CONFIG_IOSCHED_DEADLINE=y
114CONFIG_IOSCHED_CFQ=y
115# CONFIG_DEFAULT_AS is not set
116# CONFIG_DEFAULT_DEADLINE is not set
117CONFIG_DEFAULT_CFQ=y
118# CONFIG_DEFAULT_NOOP is not set
119CONFIG_DEFAULT_IOSCHED="cfq"
120CONFIG_CLASSIC_RCU=y
121
122#
123# System Type
124#
125# CONFIG_ARCH_AAEC2000 is not set
126# CONFIG_ARCH_INTEGRATOR is not set
127# CONFIG_ARCH_REALVIEW is not set
128# CONFIG_ARCH_VERSATILE is not set
129# CONFIG_ARCH_AT91 is not set
130# CONFIG_ARCH_CLPS7500 is not set
131# CONFIG_ARCH_CLPS711X is not set
132# CONFIG_ARCH_CO285 is not set
133# CONFIG_ARCH_EBSA110 is not set
134# CONFIG_ARCH_EP93XX is not set
135# CONFIG_ARCH_FOOTBRIDGE is not set
136# CONFIG_ARCH_NETX is not set
137# CONFIG_ARCH_H720X is not set
138# CONFIG_ARCH_IMX is not set
139# CONFIG_ARCH_IOP13XX is not set
140# CONFIG_ARCH_IOP32X is not set
141# CONFIG_ARCH_IOP33X is not set
142# CONFIG_ARCH_IXP23XX is not set
143# CONFIG_ARCH_IXP2000 is not set
144# CONFIG_ARCH_IXP4XX is not set
145# CONFIG_ARCH_L7200 is not set
146# CONFIG_ARCH_KIRKWOOD is not set
147# CONFIG_ARCH_KS8695 is not set
148# CONFIG_ARCH_NS9XXX is not set
149# CONFIG_ARCH_LOKI is not set
150CONFIG_ARCH_MV78XX0=y
151# CONFIG_ARCH_MXC is not set
152# CONFIG_ARCH_ORION5X is not set
153# CONFIG_ARCH_PNX4008 is not set
154# CONFIG_ARCH_PXA is not set
155# CONFIG_ARCH_RPC is not set
156# CONFIG_ARCH_SA1100 is not set
157# CONFIG_ARCH_S3C2410 is not set
158# CONFIG_ARCH_SHARK is not set
159# CONFIG_ARCH_LH7A40X is not set
160# CONFIG_ARCH_DAVINCI is not set
161# CONFIG_ARCH_OMAP is not set
162# CONFIG_ARCH_MSM7X00A is not set
163
164#
165# Marvell MV78xx0 Implementations
166#
167CONFIG_MACH_DB78X00_BP=y
168
169#
170# Boot options
171#
172
173#
174# Power management
175#
176CONFIG_PLAT_ORION=y
177
178#
179# Processor Type
180#
181CONFIG_CPU_32=y
182CONFIG_CPU_FEROCEON=y
183CONFIG_CPU_FEROCEON_OLD_ID=y
184CONFIG_CPU_32v5=y
185CONFIG_CPU_ABRT_EV5T=y
186CONFIG_CPU_PABRT_NOIFAR=y
187CONFIG_CPU_CACHE_VIVT=y
188CONFIG_CPU_COPY_FEROCEON=y
189CONFIG_CPU_TLB_FEROCEON=y
190CONFIG_CPU_CP15=y
191CONFIG_CPU_CP15_MMU=y
192
193#
194# Processor Features
195#
196CONFIG_ARM_THUMB=y
197# CONFIG_CPU_ICACHE_DISABLE is not set
198# CONFIG_CPU_DCACHE_DISABLE is not set
199CONFIG_OUTER_CACHE=y
200CONFIG_CACHE_FEROCEON_L2=y
201
202#
203# Bus support
204#
205CONFIG_PCI=y
206CONFIG_PCI_SYSCALL=y
207# CONFIG_ARCH_SUPPORTS_MSI is not set
208CONFIG_PCI_LEGACY=y
209# CONFIG_PCI_DEBUG is not set
210# CONFIG_PCCARD is not set
211
212#
213# Kernel Features
214#
215CONFIG_TICK_ONESHOT=y
216CONFIG_NO_HZ=y
217CONFIG_HIGH_RES_TIMERS=y
218CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
219CONFIG_PREEMPT=y
220CONFIG_HZ=100
221CONFIG_AEABI=y
222CONFIG_OABI_COMPAT=y
223# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set
224CONFIG_SELECT_MEMORY_MODEL=y
225CONFIG_FLATMEM_MANUAL=y
226# CONFIG_DISCONTIGMEM_MANUAL is not set
227# CONFIG_SPARSEMEM_MANUAL is not set
228CONFIG_FLATMEM=y
229CONFIG_FLAT_NODE_MEM_MAP=y
230# CONFIG_SPARSEMEM_STATIC is not set
231# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
232CONFIG_PAGEFLAGS_EXTENDED=y
233CONFIG_SPLIT_PTLOCK_CPUS=4096
234# CONFIG_RESOURCES_64BIT is not set
235CONFIG_ZONE_DMA_FLAG=1
236CONFIG_BOUNCE=y
237CONFIG_VIRT_TO_BUS=y
238CONFIG_ALIGNMENT_TRAP=y
239
240#
241# Boot options
242#
243CONFIG_ZBOOT_ROM_TEXT=0x0
244CONFIG_ZBOOT_ROM_BSS=0x0
245CONFIG_CMDLINE=""
246# CONFIG_XIP_KERNEL is not set
247# CONFIG_KEXEC is not set
248
249#
250# Floating point emulation
251#
252
253#
254# At least one emulation must be selected
255#
256CONFIG_FPE_NWFPE=y
257# CONFIG_FPE_NWFPE_XP is not set
258# CONFIG_FPE_FASTFPE is not set
259CONFIG_VFP=y
260
261#
262# Userspace binary formats
263#
264CONFIG_BINFMT_ELF=y
265# CONFIG_BINFMT_AOUT is not set
266# CONFIG_BINFMT_MISC is not set
267
268#
269# Power management options
270#
271# CONFIG_PM is not set
272CONFIG_ARCH_SUSPEND_POSSIBLE=y
273
274#
275# Networking
276#
277CONFIG_NET=y
278
279#
280# Networking options
281#
282CONFIG_PACKET=y
283CONFIG_PACKET_MMAP=y
284CONFIG_UNIX=y
285CONFIG_XFRM=y
286# CONFIG_XFRM_USER is not set
287# CONFIG_XFRM_SUB_POLICY is not set
288# CONFIG_XFRM_MIGRATE is not set
289# CONFIG_XFRM_STATISTICS is not set
290# CONFIG_NET_KEY is not set
291CONFIG_INET=y
292CONFIG_IP_MULTICAST=y
293# CONFIG_IP_ADVANCED_ROUTER is not set
294CONFIG_IP_FIB_HASH=y
295CONFIG_IP_PNP=y
296CONFIG_IP_PNP_DHCP=y
297CONFIG_IP_PNP_BOOTP=y
298# CONFIG_IP_PNP_RARP is not set
299# CONFIG_NET_IPIP is not set
300# CONFIG_NET_IPGRE is not set
301# CONFIG_IP_MROUTE is not set
302# CONFIG_ARPD is not set
303# CONFIG_SYN_COOKIES is not set
304# CONFIG_INET_AH is not set
305# CONFIG_INET_ESP is not set
306# CONFIG_INET_IPCOMP is not set
307# CONFIG_INET_XFRM_TUNNEL is not set
308# CONFIG_INET_TUNNEL is not set
309CONFIG_INET_XFRM_MODE_TRANSPORT=y
310CONFIG_INET_XFRM_MODE_TUNNEL=y
311CONFIG_INET_XFRM_MODE_BEET=y
312# CONFIG_INET_LRO is not set
313CONFIG_INET_DIAG=y
314CONFIG_INET_TCP_DIAG=y
315# CONFIG_TCP_CONG_ADVANCED is not set
316CONFIG_TCP_CONG_CUBIC=y
317CONFIG_DEFAULT_TCP_CONG="cubic"
318# CONFIG_TCP_MD5SIG is not set
319# CONFIG_IPV6 is not set
320# CONFIG_NETWORK_SECMARK is not set
321# CONFIG_NETFILTER is not set
322# CONFIG_IP_DCCP is not set
323# CONFIG_IP_SCTP is not set
324# CONFIG_TIPC is not set
325# CONFIG_ATM is not set
326# CONFIG_BRIDGE is not set
327# CONFIG_VLAN_8021Q is not set
328# CONFIG_DECNET is not set
329# CONFIG_LLC2 is not set
330# CONFIG_IPX is not set
331# CONFIG_ATALK is not set
332# CONFIG_X25 is not set
333# CONFIG_LAPB is not set
334# CONFIG_ECONET is not set
335# CONFIG_WAN_ROUTER is not set
336# CONFIG_NET_SCHED is not set
337
338#
339# Network testing
340#
341CONFIG_NET_PKTGEN=m
342# CONFIG_NET_TCPPROBE is not set
343# CONFIG_HAMRADIO is not set
344# CONFIG_CAN is not set
345# CONFIG_IRDA is not set
346# CONFIG_BT is not set
347# CONFIG_AF_RXRPC is not set
348
349#
350# Wireless
351#
352# CONFIG_CFG80211 is not set
353CONFIG_WIRELESS_EXT=y
354# CONFIG_MAC80211 is not set
355# CONFIG_IEEE80211 is not set
356# CONFIG_RFKILL is not set
357# CONFIG_NET_9P is not set
358
359#
360# Device Drivers
361#
362
363#
364# Generic Driver Options
365#
366CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
367CONFIG_STANDALONE=y
368CONFIG_PREVENT_FIRMWARE_BUILD=y
369CONFIG_FW_LOADER=y
370# CONFIG_DEBUG_DRIVER is not set
371# CONFIG_DEBUG_DEVRES is not set
372# CONFIG_SYS_HYPERVISOR is not set
373# CONFIG_CONNECTOR is not set
374CONFIG_MTD=y
375# CONFIG_MTD_DEBUG is not set
376# CONFIG_MTD_CONCAT is not set
377CONFIG_MTD_PARTITIONS=y
378# CONFIG_MTD_REDBOOT_PARTS is not set
379CONFIG_MTD_CMDLINE_PARTS=y
380# CONFIG_MTD_AFS_PARTS is not set
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
400CONFIG_MTD_JEDECPROBE=y
401CONFIG_MTD_GEN_PROBE=y
402CONFIG_MTD_CFI_ADV_OPTIONS=y
403CONFIG_MTD_CFI_NOSWAP=y
404# CONFIG_MTD_CFI_BE_BYTE_SWAP is not set
405# CONFIG_MTD_CFI_LE_BYTE_SWAP is not set
406CONFIG_MTD_CFI_GEOMETRY=y
407CONFIG_MTD_MAP_BANK_WIDTH_1=y
408CONFIG_MTD_MAP_BANK_WIDTH_2=y
409CONFIG_MTD_MAP_BANK_WIDTH_4=y
410# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
411# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
412# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
413CONFIG_MTD_CFI_I1=y
414CONFIG_MTD_CFI_I2=y
415# CONFIG_MTD_CFI_I4 is not set
416# CONFIG_MTD_CFI_I8 is not set
417# CONFIG_MTD_OTP is not set
418CONFIG_MTD_CFI_INTELEXT=y
419CONFIG_MTD_CFI_AMDSTD=y
420# CONFIG_MTD_CFI_STAA is not set
421CONFIG_MTD_CFI_UTIL=y
422# CONFIG_MTD_RAM is not set
423# CONFIG_MTD_ROM is not set
424# CONFIG_MTD_ABSENT is not set
425
426#
427# Mapping drivers for chip access
428#
429# CONFIG_MTD_COMPLEX_MAPPINGS is not set
430CONFIG_MTD_PHYSMAP=y
431CONFIG_MTD_PHYSMAP_START=0x0
432CONFIG_MTD_PHYSMAP_LEN=0x0
433CONFIG_MTD_PHYSMAP_BANKWIDTH=0
434# CONFIG_MTD_ARM_INTEGRATOR is not set
435# CONFIG_MTD_IMPA7 is not set
436# CONFIG_MTD_INTEL_VR_NOR is not set
437# CONFIG_MTD_PLATRAM is not set
438
439#
440# Self-contained MTD device drivers
441#
442# CONFIG_MTD_PMC551 is not set
443# CONFIG_MTD_SLRAM is not set
444# CONFIG_MTD_PHRAM is not set
445# CONFIG_MTD_MTDRAM is not set
446# CONFIG_MTD_BLOCK2MTD is not set
447
448#
449# Disk-On-Chip Device Drivers
450#
451# CONFIG_MTD_DOC2000 is not set
452# CONFIG_MTD_DOC2001 is not set
453# CONFIG_MTD_DOC2001PLUS is not set
454CONFIG_MTD_NAND=y
455CONFIG_MTD_NAND_VERIFY_WRITE=y
456# CONFIG_MTD_NAND_ECC_SMC is not set
457# CONFIG_MTD_NAND_MUSEUM_IDS is not set
458CONFIG_MTD_NAND_IDS=y
459# CONFIG_MTD_NAND_DISKONCHIP is not set
460# CONFIG_MTD_NAND_CAFE is not set
461# CONFIG_MTD_NAND_NANDSIM is not set
462# CONFIG_MTD_NAND_PLATFORM is not set
463# CONFIG_MTD_ALAUDA is not set
464CONFIG_MTD_NAND_ORION=y
465# CONFIG_MTD_ONENAND is not set
466
467#
468# UBI - Unsorted block images
469#
470# CONFIG_MTD_UBI is not set
471# CONFIG_PARPORT is not set
472CONFIG_BLK_DEV=y
473# CONFIG_BLK_CPQ_DA is not set
474# CONFIG_BLK_CPQ_CISS_DA is not set
475# CONFIG_BLK_DEV_DAC960 is not set
476# CONFIG_BLK_DEV_UMEM is not set
477# CONFIG_BLK_DEV_COW_COMMON is not set
478CONFIG_BLK_DEV_LOOP=y
479# CONFIG_BLK_DEV_CRYPTOLOOP is not set
480# CONFIG_BLK_DEV_NBD is not set
481# CONFIG_BLK_DEV_SX8 is not set
482# CONFIG_BLK_DEV_UB is not set
483# CONFIG_BLK_DEV_RAM is not set
484# CONFIG_CDROM_PKTCDVD is not set
485# CONFIG_ATA_OVER_ETH is not set
486CONFIG_MISC_DEVICES=y
487# CONFIG_PHANTOM is not set
488# CONFIG_EEPROM_93CX6 is not set
489# CONFIG_SGI_IOC4 is not set
490# CONFIG_TIFM_CORE is not set
491# CONFIG_ENCLOSURE_SERVICES is not set
492CONFIG_HAVE_IDE=y
493# CONFIG_IDE is not set
494
495#
496# SCSI device support
497#
498# CONFIG_RAID_ATTRS is not set
499CONFIG_SCSI=y
500CONFIG_SCSI_DMA=y
501# CONFIG_SCSI_TGT is not set
502# CONFIG_SCSI_NETLINK is not set
503# CONFIG_SCSI_PROC_FS is not set
504
505#
506# SCSI support type (disk, tape, CD-ROM)
507#
508CONFIG_BLK_DEV_SD=y
509# CONFIG_CHR_DEV_ST is not set
510# CONFIG_CHR_DEV_OSST is not set
511CONFIG_BLK_DEV_SR=m
512# CONFIG_BLK_DEV_SR_VENDOR is not set
513CONFIG_CHR_DEV_SG=m
514# CONFIG_CHR_DEV_SCH is not set
515
516#
517# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
518#
519# CONFIG_SCSI_MULTI_LUN is not set
520# CONFIG_SCSI_CONSTANTS is not set
521# CONFIG_SCSI_LOGGING is not set
522# CONFIG_SCSI_SCAN_ASYNC is not set
523CONFIG_SCSI_WAIT_SCAN=m
524
525#
526# SCSI Transports
527#
528# CONFIG_SCSI_SPI_ATTRS is not set
529# CONFIG_SCSI_FC_ATTRS is not set
530# CONFIG_SCSI_ISCSI_ATTRS is not set
531# CONFIG_SCSI_SAS_LIBSAS is not set
532# CONFIG_SCSI_SRP_ATTRS is not set
533CONFIG_SCSI_LOWLEVEL=y
534# CONFIG_ISCSI_TCP is not set
535# CONFIG_BLK_DEV_3W_XXXX_RAID is not set
536# CONFIG_SCSI_3W_9XXX is not set
537# CONFIG_SCSI_ACARD is not set
538# CONFIG_SCSI_AACRAID is not set
539# CONFIG_SCSI_AIC7XXX is not set
540# CONFIG_SCSI_AIC7XXX_OLD is not set
541# CONFIG_SCSI_AIC79XX is not set
542# CONFIG_SCSI_AIC94XX is not set
543# CONFIG_SCSI_DPT_I2O is not set
544# CONFIG_SCSI_ADVANSYS is not set
545# CONFIG_SCSI_ARCMSR is not set
546# CONFIG_MEGARAID_NEWGEN is not set
547# CONFIG_MEGARAID_LEGACY is not set
548# CONFIG_MEGARAID_SAS is not set
549# CONFIG_SCSI_HPTIOP is not set
550# CONFIG_SCSI_DMX3191D is not set
551# CONFIG_SCSI_FUTURE_DOMAIN is not set
552# CONFIG_SCSI_IPS is not set
553# CONFIG_SCSI_INITIO is not set
554# CONFIG_SCSI_INIA100 is not set
555# CONFIG_SCSI_MVSAS is not set
556# CONFIG_SCSI_STEX is not set
557# CONFIG_SCSI_SYM53C8XX_2 is not set
558# CONFIG_SCSI_IPR is not set
559# CONFIG_SCSI_QLOGIC_1280 is not set
560# CONFIG_SCSI_QLA_FC is not set
561# CONFIG_SCSI_QLA_ISCSI is not set
562# CONFIG_SCSI_LPFC is not set
563# CONFIG_SCSI_DC395x is not set
564# CONFIG_SCSI_DC390T is not set
565# CONFIG_SCSI_NSP32 is not set
566# CONFIG_SCSI_DEBUG is not set
567# CONFIG_SCSI_SRP is not set
568CONFIG_ATA=y
569# CONFIG_ATA_NONSTANDARD is not set
570CONFIG_SATA_PMP=y
571# CONFIG_SATA_AHCI is not set
572# CONFIG_SATA_SIL24 is not set
573CONFIG_ATA_SFF=y
574# CONFIG_SATA_SVW is not set
575# CONFIG_ATA_PIIX is not set
576CONFIG_SATA_MV=y
577# CONFIG_SATA_NV is not set
578# CONFIG_PDC_ADMA is not set
579# CONFIG_SATA_QSTOR is not set
580# CONFIG_SATA_PROMISE is not set
581# CONFIG_SATA_SX4 is not set
582# CONFIG_SATA_SIL is not set
583# CONFIG_SATA_SIS is not set
584# CONFIG_SATA_ULI is not set
585# CONFIG_SATA_VIA is not set
586# CONFIG_SATA_VITESSE is not set
587# CONFIG_SATA_INIC162X is not set
588# CONFIG_PATA_ALI is not set
589# CONFIG_PATA_AMD is not set
590# CONFIG_PATA_ARTOP is not set
591# CONFIG_PATA_ATIIXP is not set
592# CONFIG_PATA_CMD640_PCI is not set
593# CONFIG_PATA_CMD64X is not set
594# CONFIG_PATA_CS5520 is not set
595# CONFIG_PATA_CS5530 is not set
596# CONFIG_PATA_CYPRESS is not set
597# CONFIG_PATA_EFAR is not set
598# CONFIG_ATA_GENERIC is not set
599# CONFIG_PATA_HPT366 is not set
600# CONFIG_PATA_HPT37X is not set
601# CONFIG_PATA_HPT3X2N is not set
602# CONFIG_PATA_HPT3X3 is not set
603# CONFIG_PATA_IT821X is not set
604# CONFIG_PATA_IT8213 is not set
605# CONFIG_PATA_JMICRON is not set
606# CONFIG_PATA_TRIFLEX is not set
607# CONFIG_PATA_MARVELL is not set
608# CONFIG_PATA_MPIIX is not set
609# CONFIG_PATA_OLDPIIX is not set
610# CONFIG_PATA_NETCELL is not set
611# CONFIG_PATA_NINJA32 is not set
612# CONFIG_PATA_NS87410 is not set
613# CONFIG_PATA_NS87415 is not set
614# CONFIG_PATA_OPTI is not set
615# CONFIG_PATA_OPTIDMA is not set
616# CONFIG_PATA_PDC_OLD is not set
617# CONFIG_PATA_RADISYS is not set
618# CONFIG_PATA_RZ1000 is not set
619# CONFIG_PATA_SC1200 is not set
620# CONFIG_PATA_SERVERWORKS is not set
621# CONFIG_PATA_PDC2027X is not set
622# CONFIG_PATA_SIL680 is not set
623# CONFIG_PATA_SIS is not set
624# CONFIG_PATA_VIA is not set
625# CONFIG_PATA_WINBOND is not set
626# CONFIG_PATA_PLATFORM is not set
627# CONFIG_PATA_SCH is not set
628# CONFIG_MD is not set
629# CONFIG_FUSION is not set
630
631#
632# IEEE 1394 (FireWire) support
633#
634# CONFIG_FIREWIRE is not set
635# CONFIG_IEEE1394 is not set
636# CONFIG_I2O is not set
637CONFIG_NETDEVICES=y
638# CONFIG_NETDEVICES_MULTIQUEUE is not set
639# CONFIG_DUMMY is not set
640# CONFIG_BONDING is not set
641# CONFIG_MACVLAN is not set
642# CONFIG_EQUALIZER is not set
643# CONFIG_TUN is not set
644# CONFIG_VETH is not set
645# CONFIG_ARCNET is not set
646# CONFIG_PHYLIB is not set
647CONFIG_NET_ETHERNET=y
648CONFIG_MII=y
649# CONFIG_AX88796 is not set
650# CONFIG_HAPPYMEAL is not set
651# CONFIG_SUNGEM is not set
652# CONFIG_CASSINI is not set
653# CONFIG_NET_VENDOR_3COM is not set
654# CONFIG_SMC91X is not set
655# CONFIG_DM9000 is not set
656# CONFIG_NET_TULIP is not set
657# CONFIG_HP100 is not set
658# CONFIG_IBM_NEW_EMAC_ZMII is not set
659# CONFIG_IBM_NEW_EMAC_RGMII is not set
660# CONFIG_IBM_NEW_EMAC_TAH is not set
661# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
662CONFIG_NET_PCI=y
663# CONFIG_PCNET32 is not set
664# CONFIG_AMD8111_ETH is not set
665# CONFIG_ADAPTEC_STARFIRE is not set
666# CONFIG_B44 is not set
667# CONFIG_FORCEDETH is not set
668# CONFIG_EEPRO100 is not set
669# CONFIG_E100 is not set
670# CONFIG_FEALNX is not set
671# CONFIG_NATSEMI is not set
672# CONFIG_NE2K_PCI is not set
673# CONFIG_8139CP is not set
674# CONFIG_8139TOO is not set
675# CONFIG_R6040 is not set
676# CONFIG_SIS900 is not set
677# CONFIG_EPIC100 is not set
678# CONFIG_SUNDANCE is not set
679# CONFIG_TLAN is not set
680# CONFIG_VIA_RHINE is not set
681# CONFIG_SC92031 is not set
682CONFIG_NETDEV_1000=y
683# CONFIG_ACENIC is not set
684# CONFIG_DL2K is not set
685# CONFIG_E1000 is not set
686# CONFIG_E1000E is not set
687# CONFIG_E1000E_ENABLED is not set
688# CONFIG_IP1000 is not set
689# CONFIG_IGB is not set
690# CONFIG_NS83820 is not set
691# CONFIG_HAMACHI is not set
692# CONFIG_YELLOWFIN is not set
693# CONFIG_R8169 is not set
694# CONFIG_SIS190 is not set
695# CONFIG_SKGE is not set
696# CONFIG_SKY2 is not set
697# CONFIG_VIA_VELOCITY is not set
698# CONFIG_TIGON3 is not set
699# CONFIG_BNX2 is not set
700CONFIG_MV643XX_ETH=y
701# CONFIG_QLA3XXX is not set
702# CONFIG_ATL1 is not set
703# CONFIG_NETDEV_10000 is not set
704# CONFIG_TR is not set
705
706#
707# Wireless LAN
708#
709# CONFIG_WLAN_PRE80211 is not set
710# CONFIG_WLAN_80211 is not set
711# CONFIG_IWLWIFI_LEDS is not set
712
713#
714# USB Network Adapters
715#
716# CONFIG_USB_CATC is not set
717# CONFIG_USB_KAWETH is not set
718# CONFIG_USB_PEGASUS is not set
719# CONFIG_USB_RTL8150 is not set
720# CONFIG_USB_USBNET is not set
721# CONFIG_WAN is not set
722# CONFIG_FDDI is not set
723# CONFIG_HIPPI is not set
724# CONFIG_PPP is not set
725# CONFIG_SLIP is not set
726# CONFIG_NET_FC is not set
727# CONFIG_NETCONSOLE is not set
728# CONFIG_NETPOLL is not set
729# CONFIG_NET_POLL_CONTROLLER is not set
730# CONFIG_ISDN is not set
731
732#
733# Input device support
734#
735CONFIG_INPUT=y
736# CONFIG_INPUT_FF_MEMLESS is not set
737# CONFIG_INPUT_POLLDEV is not set
738
739#
740# Userland interfaces
741#
742# CONFIG_INPUT_MOUSEDEV is not set
743# CONFIG_INPUT_JOYDEV is not set
744CONFIG_INPUT_EVDEV=y
745# CONFIG_INPUT_EVBUG is not set
746
747#
748# Input Device Drivers
749#
750# CONFIG_INPUT_KEYBOARD is not set
751# CONFIG_INPUT_MOUSE is not set
752# CONFIG_INPUT_JOYSTICK is not set
753# CONFIG_INPUT_TABLET is not set
754# CONFIG_INPUT_TOUCHSCREEN is not set
755# CONFIG_INPUT_MISC is not set
756
757#
758# Hardware I/O ports
759#
760# CONFIG_SERIO is not set
761# CONFIG_GAMEPORT is not set
762
763#
764# Character devices
765#
766# CONFIG_VT is not set
767CONFIG_DEVKMEM=y
768# CONFIG_SERIAL_NONSTANDARD is not set
769# CONFIG_NOZOMI is not set
770
771#
772# Serial drivers
773#
774CONFIG_SERIAL_8250=y
775CONFIG_SERIAL_8250_CONSOLE=y
776# CONFIG_SERIAL_8250_PCI is not set
777CONFIG_SERIAL_8250_NR_UARTS=4
778CONFIG_SERIAL_8250_RUNTIME_UARTS=2
779# CONFIG_SERIAL_8250_EXTENDED is not set
780
781#
782# Non-8250 serial port support
783#
784CONFIG_SERIAL_CORE=y
785CONFIG_SERIAL_CORE_CONSOLE=y
786# CONFIG_SERIAL_JSM is not set
787CONFIG_UNIX98_PTYS=y
788CONFIG_LEGACY_PTYS=y
789CONFIG_LEGACY_PTY_COUNT=16
790# CONFIG_IPMI_HANDLER is not set
791# CONFIG_HW_RANDOM is not set
792# CONFIG_NVRAM is not set
793# CONFIG_R3964 is not set
794# CONFIG_APPLICOM is not set
795# CONFIG_RAW_DRIVER is not set
796# CONFIG_TCG_TPM is not set
797CONFIG_DEVPORT=y
798CONFIG_I2C=y
799CONFIG_I2C_BOARDINFO=y
800CONFIG_I2C_CHARDEV=y
801
802#
803# I2C Hardware Bus support
804#
805# CONFIG_I2C_ALI1535 is not set
806# CONFIG_I2C_ALI1563 is not set
807# CONFIG_I2C_ALI15X3 is not set
808# CONFIG_I2C_AMD756 is not set
809# CONFIG_I2C_AMD8111 is not set
810# CONFIG_I2C_I801 is not set
811# CONFIG_I2C_I810 is not set
812# CONFIG_I2C_PIIX4 is not set
813# CONFIG_I2C_NFORCE2 is not set
814# CONFIG_I2C_OCORES is not set
815# CONFIG_I2C_PARPORT_LIGHT is not set
816# CONFIG_I2C_PROSAVAGE is not set
817# CONFIG_I2C_SAVAGE4 is not set
818# CONFIG_I2C_SIMTEC is not set
819# CONFIG_I2C_SIS5595 is not set
820# CONFIG_I2C_SIS630 is not set
821# CONFIG_I2C_SIS96X is not set
822# CONFIG_I2C_TAOS_EVM is not set
823# CONFIG_I2C_STUB is not set
824# CONFIG_I2C_TINY_USB is not set
825# CONFIG_I2C_VIA is not set
826# CONFIG_I2C_VIAPRO is not set
827# CONFIG_I2C_VOODOO3 is not set
828# CONFIG_I2C_PCA_PLATFORM is not set
829CONFIG_I2C_MV64XXX=y
830
831#
832# Miscellaneous I2C Chip support
833#
834# CONFIG_DS1682 is not set
835# CONFIG_SENSORS_EEPROM is not set
836# CONFIG_SENSORS_PCF8574 is not set
837# CONFIG_PCF8575 is not set
838# CONFIG_SENSORS_PCF8591 is not set
839# CONFIG_SENSORS_MAX6875 is not set
840# CONFIG_SENSORS_TSL2550 is not set
841# CONFIG_I2C_DEBUG_CORE is not set
842# CONFIG_I2C_DEBUG_ALGO is not set
843# CONFIG_I2C_DEBUG_BUS is not set
844# CONFIG_I2C_DEBUG_CHIP is not set
845# CONFIG_SPI is not set
846# CONFIG_W1 is not set
847# CONFIG_POWER_SUPPLY is not set
848CONFIG_HWMON=y
849# CONFIG_HWMON_VID is not set
850# CONFIG_SENSORS_AD7418 is not set
851# CONFIG_SENSORS_ADM1021 is not set
852# CONFIG_SENSORS_ADM1025 is not set
853# CONFIG_SENSORS_ADM1026 is not set
854# CONFIG_SENSORS_ADM1029 is not set
855# CONFIG_SENSORS_ADM1031 is not set
856# CONFIG_SENSORS_ADM9240 is not set
857# CONFIG_SENSORS_ADT7470 is not set
858# CONFIG_SENSORS_ADT7473 is not set
859# CONFIG_SENSORS_ATXP1 is not set
860# CONFIG_SENSORS_DS1621 is not set
861# CONFIG_SENSORS_I5K_AMB is not set
862# CONFIG_SENSORS_F71805F is not set
863# CONFIG_SENSORS_F71882FG is not set
864# CONFIG_SENSORS_F75375S is not set
865# CONFIG_SENSORS_GL518SM is not set
866# CONFIG_SENSORS_GL520SM is not set
867# CONFIG_SENSORS_IT87 is not set
868# CONFIG_SENSORS_LM63 is not set
869# CONFIG_SENSORS_LM75 is not set
870# CONFIG_SENSORS_LM77 is not set
871# CONFIG_SENSORS_LM78 is not set
872# CONFIG_SENSORS_LM80 is not set
873# CONFIG_SENSORS_LM83 is not set
874# CONFIG_SENSORS_LM85 is not set
875# CONFIG_SENSORS_LM87 is not set
876# CONFIG_SENSORS_LM90 is not set
877# CONFIG_SENSORS_LM92 is not set
878# CONFIG_SENSORS_LM93 is not set
879# CONFIG_SENSORS_MAX1619 is not set
880# CONFIG_SENSORS_MAX6650 is not set
881# CONFIG_SENSORS_PC87360 is not set
882# CONFIG_SENSORS_PC87427 is not set
883# CONFIG_SENSORS_SIS5595 is not set
884# CONFIG_SENSORS_DME1737 is not set
885# CONFIG_SENSORS_SMSC47M1 is not set
886# CONFIG_SENSORS_SMSC47M192 is not set
887# CONFIG_SENSORS_SMSC47B397 is not set
888# CONFIG_SENSORS_ADS7828 is not set
889# CONFIG_SENSORS_THMC50 is not set
890# CONFIG_SENSORS_VIA686A is not set
891# CONFIG_SENSORS_VT1211 is not set
892# CONFIG_SENSORS_VT8231 is not set
893# CONFIG_SENSORS_W83781D is not set
894# CONFIG_SENSORS_W83791D is not set
895# CONFIG_SENSORS_W83792D is not set
896# CONFIG_SENSORS_W83793 is not set
897# CONFIG_SENSORS_W83L785TS is not set
898# CONFIG_SENSORS_W83L786NG is not set
899# CONFIG_SENSORS_W83627HF is not set
900# CONFIG_SENSORS_W83627EHF is not set
901# CONFIG_HWMON_DEBUG_CHIP is not set
902# CONFIG_WATCHDOG is not set
903
904#
905# Sonics Silicon Backplane
906#
907CONFIG_SSB_POSSIBLE=y
908# CONFIG_SSB is not set
909
910#
911# Multifunction device drivers
912#
913# CONFIG_MFD_SM501 is not set
914# CONFIG_MFD_ASIC3 is not set
915# CONFIG_HTC_PASIC3 is not set
916
917#
918# Multimedia devices
919#
920
921#
922# Multimedia core support
923#
924# CONFIG_VIDEO_DEV is not set
925# CONFIG_DVB_CORE is not set
926# CONFIG_VIDEO_MEDIA is not set
927
928#
929# Multimedia drivers
930#
931# CONFIG_DAB is not set
932
933#
934# Graphics support
935#
936# CONFIG_DRM is not set
937# CONFIG_VGASTATE is not set
938# CONFIG_VIDEO_OUTPUT_CONTROL is not set
939# CONFIG_FB is not set
940# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
941
942#
943# Display device support
944#
945# CONFIG_DISPLAY_SUPPORT is not set
946
947#
948# Sound
949#
950# CONFIG_SOUND is not set
951CONFIG_HID_SUPPORT=y
952CONFIG_HID=y
953# CONFIG_HID_DEBUG is not set
954# CONFIG_HIDRAW is not set
955
956#
957# USB Input Devices
958#
959CONFIG_USB_HID=y
960# CONFIG_USB_HIDINPUT_POWERBOOK is not set
961# CONFIG_HID_FF is not set
962# CONFIG_USB_HIDDEV is not set
963CONFIG_USB_SUPPORT=y
964CONFIG_USB_ARCH_HAS_HCD=y
965CONFIG_USB_ARCH_HAS_OHCI=y
966CONFIG_USB_ARCH_HAS_EHCI=y
967CONFIG_USB=y
968# CONFIG_USB_DEBUG is not set
969# CONFIG_USB_ANNOUNCE_NEW_DEVICES is not set
970
971#
972# Miscellaneous USB options
973#
974CONFIG_USB_DEVICEFS=y
975CONFIG_USB_DEVICE_CLASS=y
976# CONFIG_USB_DYNAMIC_MINORS is not set
977# CONFIG_USB_OTG is not set
978# CONFIG_USB_OTG_WHITELIST is not set
979# CONFIG_USB_OTG_BLACKLIST_HUB is not set
980
981#
982# USB Host Controller Drivers
983#
984# CONFIG_USB_C67X00_HCD is not set
985CONFIG_USB_EHCI_HCD=y
986CONFIG_USB_EHCI_ROOT_HUB_TT=y
987CONFIG_USB_EHCI_TT_NEWSCHED=y
988# CONFIG_USB_ISP116X_HCD is not set
989# CONFIG_USB_ISP1760_HCD is not set
990# CONFIG_USB_OHCI_HCD is not set
991# CONFIG_USB_UHCI_HCD is not set
992# CONFIG_USB_SL811_HCD is not set
993# CONFIG_USB_R8A66597_HCD is not set
994
995#
996# USB Device Class drivers
997#
998# CONFIG_USB_ACM is not set
999CONFIG_USB_PRINTER=y
1000# CONFIG_USB_WDM is not set
1001
1002#
1003# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
1004#
1005
1006#
1007# may also be needed; see USB_STORAGE Help for more information
1008#
1009CONFIG_USB_STORAGE=y
1010# CONFIG_USB_STORAGE_DEBUG is not set
1011CONFIG_USB_STORAGE_DATAFAB=y
1012CONFIG_USB_STORAGE_FREECOM=y
1013# CONFIG_USB_STORAGE_ISD200 is not set
1014CONFIG_USB_STORAGE_DPCM=y
1015# CONFIG_USB_STORAGE_USBAT is not set
1016CONFIG_USB_STORAGE_SDDR09=y
1017CONFIG_USB_STORAGE_SDDR55=y
1018CONFIG_USB_STORAGE_JUMPSHOT=y
1019# CONFIG_USB_STORAGE_ALAUDA is not set
1020# CONFIG_USB_STORAGE_ONETOUCH is not set
1021# CONFIG_USB_STORAGE_KARMA is not set
1022# CONFIG_USB_STORAGE_CYPRESS_ATACB is not set
1023# CONFIG_USB_LIBUSUAL is not set
1024
1025#
1026# USB Imaging devices
1027#
1028# CONFIG_USB_MDC800 is not set
1029# CONFIG_USB_MICROTEK is not set
1030# CONFIG_USB_MON is not set
1031
1032#
1033# USB port drivers
1034#
1035# CONFIG_USB_SERIAL is not set
1036
1037#
1038# USB Miscellaneous drivers
1039#
1040# CONFIG_USB_EMI62 is not set
1041# CONFIG_USB_EMI26 is not set
1042# CONFIG_USB_ADUTUX is not set
1043# CONFIG_USB_AUERSWALD is not set
1044# CONFIG_USB_RIO500 is not set
1045# CONFIG_USB_LEGOTOWER is not set
1046# CONFIG_USB_LCD is not set
1047# CONFIG_USB_BERRY_CHARGE is not set
1048# CONFIG_USB_LED is not set
1049# CONFIG_USB_CYPRESS_CY7C63 is not set
1050# CONFIG_USB_CYTHERM is not set
1051# CONFIG_USB_PHIDGET is not set
1052# CONFIG_USB_IDMOUSE is not set
1053# CONFIG_USB_FTDI_ELAN is not set
1054# CONFIG_USB_APPLEDISPLAY is not set
1055# CONFIG_USB_SISUSBVGA is not set
1056# CONFIG_USB_LD is not set
1057# CONFIG_USB_TRANCEVIBRATOR is not set
1058# CONFIG_USB_IOWARRIOR is not set
1059# CONFIG_USB_TEST is not set
1060# CONFIG_USB_ISIGHTFW is not set
1061# CONFIG_USB_GADGET is not set
1062# CONFIG_MMC is not set
1063CONFIG_NEW_LEDS=y
1064CONFIG_LEDS_CLASS=y
1065
1066#
1067# LED drivers
1068#
1069
1070#
1071# LED Triggers
1072#
1073CONFIG_LEDS_TRIGGERS=y
1074CONFIG_LEDS_TRIGGER_TIMER=y
1075CONFIG_LEDS_TRIGGER_HEARTBEAT=y
1076# CONFIG_LEDS_TRIGGER_DEFAULT_ON is not set
1077CONFIG_RTC_LIB=y
1078CONFIG_RTC_CLASS=y
1079CONFIG_RTC_HCTOSYS=y
1080CONFIG_RTC_HCTOSYS_DEVICE="rtc0"
1081# CONFIG_RTC_DEBUG is not set
1082
1083#
1084# RTC interfaces
1085#
1086CONFIG_RTC_INTF_SYSFS=y
1087CONFIG_RTC_INTF_PROC=y
1088CONFIG_RTC_INTF_DEV=y
1089# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set
1090# CONFIG_RTC_DRV_TEST is not set
1091
1092#
1093# I2C RTC drivers
1094#
1095CONFIG_RTC_DRV_DS1307=y
1096# CONFIG_RTC_DRV_DS1374 is not set
1097# CONFIG_RTC_DRV_DS1672 is not set
1098# CONFIG_RTC_DRV_MAX6900 is not set
1099CONFIG_RTC_DRV_RS5C372=y
1100# CONFIG_RTC_DRV_ISL1208 is not set
1101# CONFIG_RTC_DRV_X1205 is not set
1102# CONFIG_RTC_DRV_PCF8563 is not set
1103# CONFIG_RTC_DRV_PCF8583 is not set
1104CONFIG_RTC_DRV_M41T80=y
1105# CONFIG_RTC_DRV_M41T80_WDT is not set
1106# CONFIG_RTC_DRV_S35390A is not set
1107
1108#
1109# SPI RTC drivers
1110#
1111
1112#
1113# Platform RTC drivers
1114#
1115# CONFIG_RTC_DRV_CMOS is not set
1116# CONFIG_RTC_DRV_DS1511 is not set
1117# CONFIG_RTC_DRV_DS1553 is not set
1118# CONFIG_RTC_DRV_DS1742 is not set
1119# CONFIG_RTC_DRV_STK17TA8 is not set
1120# CONFIG_RTC_DRV_M48T86 is not set
1121# CONFIG_RTC_DRV_M48T59 is not set
1122# CONFIG_RTC_DRV_V3020 is not set
1123
1124#
1125# on-CPU RTC drivers
1126#
1127# CONFIG_UIO is not set
1128
1129#
1130# File systems
1131#
1132CONFIG_EXT2_FS=y
1133# CONFIG_EXT2_FS_XATTR is not set
1134# CONFIG_EXT2_FS_XIP is not set
1135CONFIG_EXT3_FS=y
1136# CONFIG_EXT3_FS_XATTR is not set
1137# CONFIG_EXT4DEV_FS is not set
1138CONFIG_JBD=y
1139# CONFIG_REISERFS_FS is not set
1140# CONFIG_JFS_FS is not set
1141# CONFIG_FS_POSIX_ACL is not set
1142# CONFIG_XFS_FS is not set
1143# CONFIG_OCFS2_FS is not set
1144CONFIG_DNOTIFY=y
1145CONFIG_INOTIFY=y
1146CONFIG_INOTIFY_USER=y
1147# CONFIG_QUOTA is not set
1148# CONFIG_AUTOFS_FS is not set
1149# CONFIG_AUTOFS4_FS is not set
1150# CONFIG_FUSE_FS is not set
1151
1152#
1153# CD-ROM/DVD Filesystems
1154#
1155CONFIG_ISO9660_FS=m
1156CONFIG_JOLIET=y
1157# CONFIG_ZISOFS is not set
1158CONFIG_UDF_FS=m
1159CONFIG_UDF_NLS=y
1160
1161#
1162# DOS/FAT/NT Filesystems
1163#
1164CONFIG_FAT_FS=y
1165CONFIG_MSDOS_FS=y
1166CONFIG_VFAT_FS=y
1167CONFIG_FAT_DEFAULT_CODEPAGE=437
1168CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
1169# CONFIG_NTFS_FS is not set
1170
1171#
1172# Pseudo filesystems
1173#
1174CONFIG_PROC_FS=y
1175CONFIG_PROC_SYSCTL=y
1176CONFIG_SYSFS=y
1177CONFIG_TMPFS=y
1178# CONFIG_TMPFS_POSIX_ACL is not set
1179# CONFIG_HUGETLB_PAGE is not set
1180# CONFIG_CONFIGFS_FS is not set
1181
1182#
1183# Miscellaneous filesystems
1184#
1185# CONFIG_ADFS_FS is not set
1186# CONFIG_AFFS_FS is not set
1187# CONFIG_HFS_FS is not set
1188# CONFIG_HFSPLUS_FS is not set
1189# CONFIG_BEFS_FS is not set
1190# CONFIG_BFS_FS is not set
1191# CONFIG_EFS_FS is not set
1192CONFIG_JFFS2_FS=y
1193CONFIG_JFFS2_FS_DEBUG=0
1194CONFIG_JFFS2_FS_WRITEBUFFER=y
1195# CONFIG_JFFS2_FS_WBUF_VERIFY is not set
1196# CONFIG_JFFS2_SUMMARY is not set
1197# CONFIG_JFFS2_FS_XATTR is not set
1198# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set
1199CONFIG_JFFS2_ZLIB=y
1200# CONFIG_JFFS2_LZO is not set
1201CONFIG_JFFS2_RTIME=y
1202# CONFIG_JFFS2_RUBIN is not set
1203CONFIG_CRAMFS=y
1204# CONFIG_VXFS_FS is not set
1205# CONFIG_MINIX_FS is not set
1206# CONFIG_HPFS_FS is not set
1207# CONFIG_QNX4FS_FS is not set
1208# CONFIG_ROMFS_FS is not set
1209# CONFIG_SYSV_FS is not set
1210# CONFIG_UFS_FS is not set
1211CONFIG_NETWORK_FILESYSTEMS=y
1212CONFIG_NFS_FS=y
1213CONFIG_NFS_V3=y
1214# CONFIG_NFS_V3_ACL is not set
1215# CONFIG_NFS_V4 is not set
1216# CONFIG_NFSD is not set
1217CONFIG_ROOT_NFS=y
1218CONFIG_LOCKD=y
1219CONFIG_LOCKD_V4=y
1220CONFIG_NFS_COMMON=y
1221CONFIG_SUNRPC=y
1222# CONFIG_SUNRPC_BIND34 is not set
1223# CONFIG_RPCSEC_GSS_KRB5 is not set
1224# CONFIG_RPCSEC_GSS_SPKM3 is not set
1225# CONFIG_SMB_FS is not set
1226# CONFIG_CIFS is not set
1227# CONFIG_NCP_FS is not set
1228# CONFIG_CODA_FS is not set
1229# CONFIG_AFS_FS is not set
1230
1231#
1232# Partition Types
1233#
1234CONFIG_PARTITION_ADVANCED=y
1235# CONFIG_ACORN_PARTITION is not set
1236# CONFIG_OSF_PARTITION is not set
1237# CONFIG_AMIGA_PARTITION is not set
1238# CONFIG_ATARI_PARTITION is not set
1239# CONFIG_MAC_PARTITION is not set
1240CONFIG_MSDOS_PARTITION=y
1241CONFIG_BSD_DISKLABEL=y
1242# CONFIG_MINIX_SUBPARTITION is not set
1243# CONFIG_SOLARIS_X86_PARTITION is not set
1244# CONFIG_UNIXWARE_DISKLABEL is not set
1245# CONFIG_LDM_PARTITION is not set
1246# CONFIG_SGI_PARTITION is not set
1247# CONFIG_ULTRIX_PARTITION is not set
1248# CONFIG_SUN_PARTITION is not set
1249# CONFIG_KARMA_PARTITION is not set
1250# CONFIG_EFI_PARTITION is not set
1251# CONFIG_SYSV68_PARTITION is not set
1252CONFIG_NLS=y
1253CONFIG_NLS_DEFAULT="iso8859-1"
1254CONFIG_NLS_CODEPAGE_437=y
1255# CONFIG_NLS_CODEPAGE_737 is not set
1256# CONFIG_NLS_CODEPAGE_775 is not set
1257CONFIG_NLS_CODEPAGE_850=y
1258# CONFIG_NLS_CODEPAGE_852 is not set
1259# CONFIG_NLS_CODEPAGE_855 is not set
1260# CONFIG_NLS_CODEPAGE_857 is not set
1261# CONFIG_NLS_CODEPAGE_860 is not set
1262# CONFIG_NLS_CODEPAGE_861 is not set
1263# CONFIG_NLS_CODEPAGE_862 is not set
1264# CONFIG_NLS_CODEPAGE_863 is not set
1265# CONFIG_NLS_CODEPAGE_864 is not set
1266# CONFIG_NLS_CODEPAGE_865 is not set
1267# CONFIG_NLS_CODEPAGE_866 is not set
1268# CONFIG_NLS_CODEPAGE_869 is not set
1269# CONFIG_NLS_CODEPAGE_936 is not set
1270# CONFIG_NLS_CODEPAGE_950 is not set
1271# CONFIG_NLS_CODEPAGE_932 is not set
1272# CONFIG_NLS_CODEPAGE_949 is not set
1273# CONFIG_NLS_CODEPAGE_874 is not set
1274# CONFIG_NLS_ISO8859_8 is not set
1275# CONFIG_NLS_CODEPAGE_1250 is not set
1276# CONFIG_NLS_CODEPAGE_1251 is not set
1277# CONFIG_NLS_ASCII is not set
1278CONFIG_NLS_ISO8859_1=y
1279CONFIG_NLS_ISO8859_2=y
1280# CONFIG_NLS_ISO8859_3 is not set
1281# CONFIG_NLS_ISO8859_4 is not set
1282# CONFIG_NLS_ISO8859_5 is not set
1283# CONFIG_NLS_ISO8859_6 is not set
1284# CONFIG_NLS_ISO8859_7 is not set
1285# CONFIG_NLS_ISO8859_9 is not set
1286# CONFIG_NLS_ISO8859_13 is not set
1287# CONFIG_NLS_ISO8859_14 is not set
1288# CONFIG_NLS_ISO8859_15 is not set
1289# CONFIG_NLS_KOI8_R is not set
1290# CONFIG_NLS_KOI8_U is not set
1291# CONFIG_NLS_UTF8 is not set
1292# CONFIG_DLM is not set
1293
1294#
1295# Kernel hacking
1296#
1297# CONFIG_PRINTK_TIME is not set
1298CONFIG_ENABLE_WARN_DEPRECATED=y
1299CONFIG_ENABLE_MUST_CHECK=y
1300CONFIG_FRAME_WARN=1024
1301CONFIG_MAGIC_SYSRQ=y
1302# CONFIG_UNUSED_SYMBOLS is not set
1303# CONFIG_DEBUG_FS is not set
1304# CONFIG_HEADERS_CHECK is not set
1305CONFIG_DEBUG_KERNEL=y
1306# CONFIG_DEBUG_SHIRQ is not set
1307CONFIG_DETECT_SOFTLOCKUP=y
1308CONFIG_SCHED_DEBUG=y
1309CONFIG_SCHEDSTATS=y
1310# CONFIG_TIMER_STATS is not set
1311# CONFIG_DEBUG_OBJECTS is not set
1312CONFIG_DEBUG_PREEMPT=y
1313# CONFIG_DEBUG_RT_MUTEXES is not set
1314# CONFIG_RT_MUTEX_TESTER is not set
1315# CONFIG_DEBUG_SPINLOCK is not set
1316# CONFIG_DEBUG_MUTEXES is not set
1317# CONFIG_DEBUG_LOCK_ALLOC is not set
1318# CONFIG_PROVE_LOCKING is not set
1319# CONFIG_LOCK_STAT is not set
1320# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
1321# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
1322# CONFIG_DEBUG_KOBJECT is not set
1323# CONFIG_DEBUG_BUGVERBOSE is not set
1324CONFIG_DEBUG_INFO=y
1325# CONFIG_DEBUG_VM is not set
1326# CONFIG_DEBUG_WRITECOUNT is not set
1327# CONFIG_DEBUG_LIST is not set
1328# CONFIG_DEBUG_SG is not set
1329CONFIG_FRAME_POINTER=y
1330# CONFIG_BOOT_PRINTK_DELAY is not set
1331# CONFIG_RCU_TORTURE_TEST is not set
1332# CONFIG_KPROBES_SANITY_TEST is not set
1333# CONFIG_BACKTRACE_SELF_TEST is not set
1334# CONFIG_LKDTM is not set
1335# CONFIG_FAULT_INJECTION is not set
1336# CONFIG_LATENCYTOP is not set
1337# CONFIG_SAMPLES is not set
1338CONFIG_DEBUG_USER=y
1339CONFIG_DEBUG_ERRORS=y
1340# CONFIG_DEBUG_STACK_USAGE is not set
1341CONFIG_DEBUG_LL=y
1342# CONFIG_DEBUG_ICEDCC is not set
1343
1344#
1345# Security options
1346#
1347# CONFIG_KEYS is not set
1348# CONFIG_SECURITY is not set
1349# CONFIG_SECURITY_FILE_CAPABILITIES is not set
1350CONFIG_CRYPTO=y
1351
1352#
1353# Crypto core or helper
1354#
1355CONFIG_CRYPTO_ALGAPI=m
1356CONFIG_CRYPTO_BLKCIPHER=m
1357CONFIG_CRYPTO_MANAGER=m
1358# CONFIG_CRYPTO_GF128MUL is not set
1359# CONFIG_CRYPTO_NULL is not set
1360# CONFIG_CRYPTO_CRYPTD is not set
1361# CONFIG_CRYPTO_AUTHENC is not set
1362# CONFIG_CRYPTO_TEST is not set
1363
1364#
1365# Authenticated Encryption with Associated Data
1366#
1367# CONFIG_CRYPTO_CCM is not set
1368# CONFIG_CRYPTO_GCM is not set
1369# CONFIG_CRYPTO_SEQIV is not set
1370
1371#
1372# Block modes
1373#
1374CONFIG_CRYPTO_CBC=m
1375# CONFIG_CRYPTO_CTR is not set
1376# CONFIG_CRYPTO_CTS is not set
1377CONFIG_CRYPTO_ECB=m
1378# CONFIG_CRYPTO_LRW is not set
1379CONFIG_CRYPTO_PCBC=m
1380# CONFIG_CRYPTO_XTS is not set
1381
1382#
1383# Hash modes
1384#
1385# CONFIG_CRYPTO_HMAC is not set
1386# CONFIG_CRYPTO_XCBC is not set
1387
1388#
1389# Digest
1390#
1391# CONFIG_CRYPTO_CRC32C is not set
1392# CONFIG_CRYPTO_MD4 is not set
1393# CONFIG_CRYPTO_MD5 is not set
1394# CONFIG_CRYPTO_MICHAEL_MIC is not set
1395# CONFIG_CRYPTO_SHA1 is not set
1396# CONFIG_CRYPTO_SHA256 is not set
1397# CONFIG_CRYPTO_SHA512 is not set
1398# CONFIG_CRYPTO_TGR192 is not set
1399# CONFIG_CRYPTO_WP512 is not set
1400
1401#
1402# Ciphers
1403#
1404# CONFIG_CRYPTO_AES is not set
1405# CONFIG_CRYPTO_ANUBIS is not set
1406# CONFIG_CRYPTO_ARC4 is not set
1407# CONFIG_CRYPTO_BLOWFISH is not set
1408# CONFIG_CRYPTO_CAMELLIA is not set
1409# CONFIG_CRYPTO_CAST5 is not set
1410# CONFIG_CRYPTO_CAST6 is not set
1411# CONFIG_CRYPTO_DES is not set
1412# CONFIG_CRYPTO_FCRYPT is not set
1413# CONFIG_CRYPTO_KHAZAD is not set
1414# CONFIG_CRYPTO_SALSA20 is not set
1415# CONFIG_CRYPTO_SEED is not set
1416# CONFIG_CRYPTO_SERPENT is not set
1417# CONFIG_CRYPTO_TEA is not set
1418# CONFIG_CRYPTO_TWOFISH is not set
1419
1420#
1421# Compression
1422#
1423# CONFIG_CRYPTO_DEFLATE is not set
1424# CONFIG_CRYPTO_LZO is not set
1425CONFIG_CRYPTO_HW=y
1426# CONFIG_CRYPTO_DEV_HIFN_795X is not set
1427
1428#
1429# Library routines
1430#
1431CONFIG_BITREVERSE=y
1432# CONFIG_GENERIC_FIND_FIRST_BIT is not set
1433# CONFIG_GENERIC_FIND_NEXT_BIT is not set
1434# CONFIG_CRC_CCITT is not set
1435# CONFIG_CRC16 is not set
1436CONFIG_CRC_ITU_T=m
1437CONFIG_CRC32=y
1438# CONFIG_CRC7 is not set
1439# CONFIG_LIBCRC32C is not set
1440CONFIG_ZLIB_INFLATE=y
1441CONFIG_ZLIB_DEFLATE=y
1442CONFIG_PLIST=y
1443CONFIG_HAS_IOMEM=y
1444CONFIG_HAS_IOPORT=y
1445CONFIG_HAS_DMA=y
diff --git a/arch/arm/configs/netx_defconfig b/arch/arm/configs/netx_defconfig
index 57f32f39d0ff..0884f2370c3a 100644
--- a/arch/arm/configs/netx_defconfig
+++ b/arch/arm/configs/netx_defconfig
@@ -154,7 +154,6 @@ CONFIG_ARM_AMBA=y
154# Kernel Features 154# Kernel Features
155# 155#
156CONFIG_PREEMPT=y 156CONFIG_PREEMPT=y
157# CONFIG_NO_IDLE_HZ is not set
158CONFIG_HZ=100 157CONFIG_HZ=100
159# CONFIG_AEABI is not set 158# CONFIG_AEABI is not set
160# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set 159# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set
diff --git a/arch/arm/configs/onearm_defconfig b/arch/arm/configs/onearm_defconfig
index 650a248613e5..418ca2febbe3 100644
--- a/arch/arm/configs/onearm_defconfig
+++ b/arch/arm/configs/onearm_defconfig
@@ -202,7 +202,6 @@ CONFIG_AT91_CF=y
202# Kernel Features 202# Kernel Features
203# 203#
204# CONFIG_PREEMPT is not set 204# CONFIG_PREEMPT is not set
205# CONFIG_NO_IDLE_HZ is not set
206CONFIG_HZ=100 205CONFIG_HZ=100
207# CONFIG_AEABI is not set 206# CONFIG_AEABI is not set
208# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set 207# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set
diff --git a/arch/arm/configs/orion5x_defconfig b/arch/arm/configs/orion5x_defconfig
index 52cd99bd52fb..9578b5d9f9c7 100644
--- a/arch/arm/configs/orion5x_defconfig
+++ b/arch/arm/configs/orion5x_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 3# Linux kernel version: 2.6.26-rc4
4# Thu Feb 7 14:10:30 2008 4# Mon Jun 2 23:54:48 2008
5# 5#
6CONFIG_ARM=y 6CONFIG_ARM=y
7CONFIG_SYS_SUPPORTS_APM_EMULATION=y 7CONFIG_SYS_SUPPORTS_APM_EMULATION=y
@@ -21,6 +21,7 @@ CONFIG_RWSEM_GENERIC_SPINLOCK=y
21# CONFIG_ARCH_HAS_ILOG2_U64 is not set 21# CONFIG_ARCH_HAS_ILOG2_U64 is not set
22CONFIG_GENERIC_HWEIGHT=y 22CONFIG_GENERIC_HWEIGHT=y
23CONFIG_GENERIC_CALIBRATE_DELAY=y 23CONFIG_GENERIC_CALIBRATE_DELAY=y
24CONFIG_ARCH_SUPPORTS_AOUT=y
24CONFIG_ZONE_DMA=y 25CONFIG_ZONE_DMA=y
25CONFIG_VECTORS_BASE=0xffff0000 26CONFIG_VECTORS_BASE=0xffff0000
26CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 27CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
@@ -40,24 +41,24 @@ CONFIG_SYSVIPC_SYSCTL=y
40# CONFIG_POSIX_MQUEUE is not set 41# CONFIG_POSIX_MQUEUE is not set
41# CONFIG_BSD_PROCESS_ACCT is not set 42# CONFIG_BSD_PROCESS_ACCT is not set
42# CONFIG_TASKSTATS is not set 43# CONFIG_TASKSTATS is not set
43# CONFIG_USER_NS is not set
44# CONFIG_PID_NS is not set
45# CONFIG_AUDIT is not set 44# CONFIG_AUDIT is not set
46# CONFIG_IKCONFIG is not set 45# CONFIG_IKCONFIG is not set
47CONFIG_LOG_BUF_SHIFT=14 46CONFIG_LOG_BUF_SHIFT=14
48# CONFIG_CGROUPS is not set 47# CONFIG_CGROUPS is not set
49CONFIG_FAIR_GROUP_SCHED=y 48# CONFIG_GROUP_SCHED is not set
50CONFIG_FAIR_USER_SCHED=y
51# CONFIG_FAIR_CGROUP_SCHED is not set
52CONFIG_SYSFS_DEPRECATED=y 49CONFIG_SYSFS_DEPRECATED=y
50CONFIG_SYSFS_DEPRECATED_V2=y
53# CONFIG_RELAY is not set 51# CONFIG_RELAY is not set
52# CONFIG_NAMESPACES is not set
54# CONFIG_BLK_DEV_INITRD is not set 53# CONFIG_BLK_DEV_INITRD is not set
55CONFIG_CC_OPTIMIZE_FOR_SIZE=y 54CONFIG_CC_OPTIMIZE_FOR_SIZE=y
56CONFIG_SYSCTL=y 55CONFIG_SYSCTL=y
57CONFIG_EMBEDDED=y 56CONFIG_EMBEDDED=y
58CONFIG_UID16=y 57CONFIG_UID16=y
59CONFIG_SYSCTL_SYSCALL=y 58CONFIG_SYSCTL_SYSCALL=y
59CONFIG_SYSCTL_SYSCALL_CHECK=y
60CONFIG_KALLSYMS=y 60CONFIG_KALLSYMS=y
61CONFIG_KALLSYMS_ALL=y
61# CONFIG_KALLSYMS_EXTRA_PASS is not set 62# CONFIG_KALLSYMS_EXTRA_PASS is not set
62CONFIG_HOTPLUG=y 63CONFIG_HOTPLUG=y
63CONFIG_PRINTK=y 64CONFIG_PRINTK=y
@@ -73,20 +74,25 @@ CONFIG_TIMERFD=y
73CONFIG_EVENTFD=y 74CONFIG_EVENTFD=y
74CONFIG_SHMEM=y 75CONFIG_SHMEM=y
75CONFIG_VM_EVENT_COUNTERS=y 76CONFIG_VM_EVENT_COUNTERS=y
76CONFIG_SLAB=y 77# CONFIG_SLUB_DEBUG is not set
77# CONFIG_SLUB is not set 78# CONFIG_SLAB is not set
79CONFIG_SLUB=y
78# CONFIG_SLOB is not set 80# CONFIG_SLOB is not set
79# CONFIG_PROFILING is not set 81CONFIG_PROFILING=y
80# CONFIG_MARKERS is not set 82# CONFIG_MARKERS is not set
83CONFIG_OPROFILE=y
81CONFIG_HAVE_OPROFILE=y 84CONFIG_HAVE_OPROFILE=y
82# CONFIG_KPROBES is not set 85CONFIG_KPROBES=y
86CONFIG_KRETPROBES=y
83CONFIG_HAVE_KPROBES=y 87CONFIG_HAVE_KPROBES=y
88CONFIG_HAVE_KRETPROBES=y
89# CONFIG_HAVE_DMA_ATTRS is not set
84CONFIG_PROC_PAGE_MONITOR=y 90CONFIG_PROC_PAGE_MONITOR=y
85CONFIG_SLABINFO=y
86CONFIG_RT_MUTEXES=y 91CONFIG_RT_MUTEXES=y
87# CONFIG_TINY_SHMEM is not set 92# CONFIG_TINY_SHMEM is not set
88CONFIG_BASE_SMALL=0 93CONFIG_BASE_SMALL=0
89CONFIG_MODULES=y 94CONFIG_MODULES=y
95# CONFIG_MODULE_FORCE_LOAD is not set
90CONFIG_MODULE_UNLOAD=y 96CONFIG_MODULE_UNLOAD=y
91# CONFIG_MODULE_FORCE_UNLOAD is not set 97# CONFIG_MODULE_FORCE_UNLOAD is not set
92# CONFIG_MODVERSIONS is not set 98# CONFIG_MODVERSIONS is not set
@@ -111,7 +117,6 @@ CONFIG_DEFAULT_CFQ=y
111# CONFIG_DEFAULT_NOOP is not set 117# CONFIG_DEFAULT_NOOP is not set
112CONFIG_DEFAULT_IOSCHED="cfq" 118CONFIG_DEFAULT_IOSCHED="cfq"
113CONFIG_CLASSIC_RCU=y 119CONFIG_CLASSIC_RCU=y
114# CONFIG_PREEMPT_RCU is not set
115 120
116# 121#
117# System Type 122# System Type
@@ -160,6 +165,15 @@ CONFIG_MACH_RD88F5182=y
160CONFIG_MACH_KUROBOX_PRO=y 165CONFIG_MACH_KUROBOX_PRO=y
161CONFIG_MACH_DNS323=y 166CONFIG_MACH_DNS323=y
162CONFIG_MACH_TS209=y 167CONFIG_MACH_TS209=y
168CONFIG_MACH_LINKSTATION_PRO=y
169CONFIG_MACH_TS409=y
170CONFIG_MACH_WRT350N_V2=y
171CONFIG_MACH_TS78XX=y
172CONFIG_MACH_MV2120=y
173CONFIG_MACH_MSS2=y
174CONFIG_MACH_WNR854T=y
175CONFIG_MACH_RD88F5181L_GE=y
176CONFIG_MACH_RD88F5181L_FXO=y
163 177
164# 178#
165# Boot options 179# Boot options
@@ -168,6 +182,7 @@ CONFIG_MACH_TS209=y
168# 182#
169# Power management 183# Power management
170# 184#
185CONFIG_PLAT_ORION=y
171 186
172# 187#
173# Processor Type 188# Processor Type
@@ -177,8 +192,9 @@ CONFIG_CPU_FEROCEON=y
177CONFIG_CPU_FEROCEON_OLD_ID=y 192CONFIG_CPU_FEROCEON_OLD_ID=y
178CONFIG_CPU_32v5=y 193CONFIG_CPU_32v5=y
179CONFIG_CPU_ABRT_EV5T=y 194CONFIG_CPU_ABRT_EV5T=y
195CONFIG_CPU_PABRT_NOIFAR=y
180CONFIG_CPU_CACHE_VIVT=y 196CONFIG_CPU_CACHE_VIVT=y
181CONFIG_CPU_COPY_V4WB=y 197CONFIG_CPU_COPY_FEROCEON=y
182CONFIG_CPU_TLB_V4WBI=y 198CONFIG_CPU_TLB_V4WBI=y
183CONFIG_CPU_CP15=y 199CONFIG_CPU_CP15=y
184CONFIG_CPU_CP15_MMU=y 200CONFIG_CPU_CP15_MMU=y
@@ -189,7 +205,6 @@ CONFIG_CPU_CP15_MMU=y
189CONFIG_ARM_THUMB=y 205CONFIG_ARM_THUMB=y
190# CONFIG_CPU_ICACHE_DISABLE is not set 206# CONFIG_CPU_ICACHE_DISABLE is not set
191# CONFIG_CPU_DCACHE_DISABLE is not set 207# CONFIG_CPU_DCACHE_DISABLE is not set
192# CONFIG_CPU_DCACHE_WRITETHROUGH is not set
193# CONFIG_OUTER_CACHE is not set 208# CONFIG_OUTER_CACHE is not set
194 209
195# 210#
@@ -199,6 +214,7 @@ CONFIG_PCI=y
199CONFIG_PCI_SYSCALL=y 214CONFIG_PCI_SYSCALL=y
200# CONFIG_ARCH_SUPPORTS_MSI is not set 215# CONFIG_ARCH_SUPPORTS_MSI is not set
201CONFIG_PCI_LEGACY=y 216CONFIG_PCI_LEGACY=y
217# CONFIG_PCI_DEBUG is not set
202# CONFIG_PCCARD is not set 218# CONFIG_PCCARD is not set
203 219
204# 220#
@@ -221,6 +237,7 @@ CONFIG_FLATMEM=y
221CONFIG_FLAT_NODE_MEM_MAP=y 237CONFIG_FLAT_NODE_MEM_MAP=y
222# CONFIG_SPARSEMEM_STATIC is not set 238# CONFIG_SPARSEMEM_STATIC is not set
223# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set 239# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
240CONFIG_PAGEFLAGS_EXTENDED=y
224CONFIG_SPLIT_PTLOCK_CPUS=4096 241CONFIG_SPLIT_PTLOCK_CPUS=4096
225# CONFIG_RESOURCES_64BIT is not set 242# CONFIG_RESOURCES_64BIT is not set
226CONFIG_ZONE_DMA_FLAG=1 243CONFIG_ZONE_DMA_FLAG=1
@@ -238,7 +255,6 @@ CONFIG_ZBOOT_ROM_BSS=0x0
238CONFIG_CMDLINE="" 255CONFIG_CMDLINE=""
239# CONFIG_XIP_KERNEL is not set 256# CONFIG_XIP_KERNEL is not set
240# CONFIG_KEXEC is not set 257# CONFIG_KEXEC is not set
241# CONFIG_ATAGS_PROC is not set
242 258
243# 259#
244# Floating point emulation 260# Floating point emulation
@@ -311,8 +327,6 @@ CONFIG_TCP_CONG_CUBIC=y
311CONFIG_DEFAULT_TCP_CONG="cubic" 327CONFIG_DEFAULT_TCP_CONG="cubic"
312# CONFIG_TCP_MD5SIG is not set 328# CONFIG_TCP_MD5SIG is not set
313# CONFIG_IPV6 is not set 329# CONFIG_IPV6 is not set
314# CONFIG_INET6_XFRM_TUNNEL is not set
315# CONFIG_INET6_TUNNEL is not set
316# CONFIG_NETWORK_SECMARK is not set 330# CONFIG_NETWORK_SECMARK is not set
317# CONFIG_NETFILTER is not set 331# CONFIG_NETFILTER is not set
318# CONFIG_IP_DCCP is not set 332# CONFIG_IP_DCCP is not set
@@ -335,6 +349,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
335# Network testing 349# Network testing
336# 350#
337CONFIG_NET_PKTGEN=m 351CONFIG_NET_PKTGEN=m
352# CONFIG_NET_TCPPROBE is not set
338# CONFIG_HAMRADIO is not set 353# CONFIG_HAMRADIO is not set
339# CONFIG_CAN is not set 354# CONFIG_CAN is not set
340# CONFIG_IRDA is not set 355# CONFIG_IRDA is not set
@@ -362,6 +377,8 @@ CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
362CONFIG_STANDALONE=y 377CONFIG_STANDALONE=y
363CONFIG_PREVENT_FIRMWARE_BUILD=y 378CONFIG_PREVENT_FIRMWARE_BUILD=y
364CONFIG_FW_LOADER=y 379CONFIG_FW_LOADER=y
380# CONFIG_DEBUG_DRIVER is not set
381# CONFIG_DEBUG_DEVRES is not set
365# CONFIG_SYS_HYPERVISOR is not set 382# CONFIG_SYS_HYPERVISOR is not set
366# CONFIG_CONNECTOR is not set 383# CONFIG_CONNECTOR is not set
367CONFIG_MTD=y 384CONFIG_MTD=y
@@ -371,6 +388,7 @@ CONFIG_MTD_PARTITIONS=y
371# CONFIG_MTD_REDBOOT_PARTS is not set 388# CONFIG_MTD_REDBOOT_PARTS is not set
372CONFIG_MTD_CMDLINE_PARTS=y 389CONFIG_MTD_CMDLINE_PARTS=y
373# CONFIG_MTD_AFS_PARTS is not set 390# CONFIG_MTD_AFS_PARTS is not set
391# CONFIG_MTD_AR7_PARTS is not set
374 392
375# 393#
376# User Modules And Translation Layers 394# User Modules And Translation Layers
@@ -378,9 +396,8 @@ CONFIG_MTD_CMDLINE_PARTS=y
378CONFIG_MTD_CHAR=y 396CONFIG_MTD_CHAR=y
379CONFIG_MTD_BLKDEVS=y 397CONFIG_MTD_BLKDEVS=y
380CONFIG_MTD_BLOCK=y 398CONFIG_MTD_BLOCK=y
381CONFIG_FTL=y 399# CONFIG_FTL is not set
382CONFIG_NFTL=y 400# CONFIG_NFTL is not set
383# CONFIG_NFTL_RW is not set
384# CONFIG_INFTL is not set 401# CONFIG_INFTL is not set
385# CONFIG_RFD_FTL is not set 402# CONFIG_RFD_FTL is not set
386# CONFIG_SSFDC is not set 403# CONFIG_SSFDC is not set
@@ -405,12 +422,12 @@ CONFIG_MTD_MAP_BANK_WIDTH_4=y
405# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set 422# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
406CONFIG_MTD_CFI_I1=y 423CONFIG_MTD_CFI_I1=y
407CONFIG_MTD_CFI_I2=y 424CONFIG_MTD_CFI_I2=y
408CONFIG_MTD_CFI_I4=y 425# CONFIG_MTD_CFI_I4 is not set
409# CONFIG_MTD_CFI_I8 is not set 426# CONFIG_MTD_CFI_I8 is not set
410# CONFIG_MTD_OTP is not set 427# CONFIG_MTD_OTP is not set
411CONFIG_MTD_CFI_INTELEXT=y 428CONFIG_MTD_CFI_INTELEXT=y
412CONFIG_MTD_CFI_AMDSTD=y 429CONFIG_MTD_CFI_AMDSTD=y
413CONFIG_MTD_CFI_STAA=y 430# CONFIG_MTD_CFI_STAA is not set
414CONFIG_MTD_CFI_UTIL=y 431CONFIG_MTD_CFI_UTIL=y
415# CONFIG_MTD_RAM is not set 432# CONFIG_MTD_RAM is not set
416# CONFIG_MTD_ROM is not set 433# CONFIG_MTD_ROM is not set
@@ -481,6 +498,9 @@ CONFIG_MISC_DEVICES=y
481# CONFIG_EEPROM_93CX6 is not set 498# CONFIG_EEPROM_93CX6 is not set
482# CONFIG_SGI_IOC4 is not set 499# CONFIG_SGI_IOC4 is not set
483# CONFIG_TIFM_CORE is not set 500# CONFIG_TIFM_CORE is not set
501# CONFIG_ENCLOSURE_SERVICES is not set
502CONFIG_HAVE_IDE=y
503# CONFIG_IDE is not set
484 504
485# 505#
486# SCSI device support 506# SCSI device support
@@ -542,6 +562,7 @@ CONFIG_SCSI_LOWLEVEL=y
542# CONFIG_SCSI_IPS is not set 562# CONFIG_SCSI_IPS is not set
543# CONFIG_SCSI_INITIO is not set 563# CONFIG_SCSI_INITIO is not set
544# CONFIG_SCSI_INIA100 is not set 564# CONFIG_SCSI_INIA100 is not set
565# CONFIG_SCSI_MVSAS is not set
545# CONFIG_SCSI_STEX is not set 566# CONFIG_SCSI_STEX is not set
546# CONFIG_SCSI_SYM53C8XX_2 is not set 567# CONFIG_SCSI_SYM53C8XX_2 is not set
547# CONFIG_SCSI_IPR is not set 568# CONFIG_SCSI_IPR is not set
@@ -556,7 +577,10 @@ CONFIG_SCSI_LOWLEVEL=y
556# CONFIG_SCSI_SRP is not set 577# CONFIG_SCSI_SRP is not set
557CONFIG_ATA=y 578CONFIG_ATA=y
558# CONFIG_ATA_NONSTANDARD is not set 579# CONFIG_ATA_NONSTANDARD is not set
580CONFIG_SATA_PMP=y
559# CONFIG_SATA_AHCI is not set 581# CONFIG_SATA_AHCI is not set
582# CONFIG_SATA_SIL24 is not set
583CONFIG_ATA_SFF=y
560# CONFIG_SATA_SVW is not set 584# CONFIG_SATA_SVW is not set
561# CONFIG_ATA_PIIX is not set 585# CONFIG_ATA_PIIX is not set
562CONFIG_SATA_MV=y 586CONFIG_SATA_MV=y
@@ -566,7 +590,6 @@ CONFIG_SATA_MV=y
566# CONFIG_SATA_PROMISE is not set 590# CONFIG_SATA_PROMISE is not set
567# CONFIG_SATA_SX4 is not set 591# CONFIG_SATA_SX4 is not set
568# CONFIG_SATA_SIL is not set 592# CONFIG_SATA_SIL is not set
569# CONFIG_SATA_SIL24 is not set
570# CONFIG_SATA_SIS is not set 593# CONFIG_SATA_SIS is not set
571# CONFIG_SATA_ULI is not set 594# CONFIG_SATA_ULI is not set
572# CONFIG_SATA_VIA is not set 595# CONFIG_SATA_VIA is not set
@@ -611,6 +634,7 @@ CONFIG_SATA_MV=y
611# CONFIG_PATA_VIA is not set 634# CONFIG_PATA_VIA is not set
612# CONFIG_PATA_WINBOND is not set 635# CONFIG_PATA_WINBOND is not set
613# CONFIG_PATA_PLATFORM is not set 636# CONFIG_PATA_PLATFORM is not set
637# CONFIG_PATA_SCH is not set
614# CONFIG_MD is not set 638# CONFIG_MD is not set
615# CONFIG_FUSION is not set 639# CONFIG_FUSION is not set
616 640
@@ -652,7 +676,7 @@ CONFIG_NET_PCI=y
652# CONFIG_B44 is not set 676# CONFIG_B44 is not set
653# CONFIG_FORCEDETH is not set 677# CONFIG_FORCEDETH is not set
654# CONFIG_EEPRO100 is not set 678# CONFIG_EEPRO100 is not set
655CONFIG_E100=y 679# CONFIG_E100 is not set
656# CONFIG_FEALNX is not set 680# CONFIG_FEALNX is not set
657# CONFIG_NATSEMI is not set 681# CONFIG_NATSEMI is not set
658# CONFIG_NE2K_PCI is not set 682# CONFIG_NE2K_PCI is not set
@@ -668,9 +692,7 @@ CONFIG_E100=y
668CONFIG_NETDEV_1000=y 692CONFIG_NETDEV_1000=y
669# CONFIG_ACENIC is not set 693# CONFIG_ACENIC is not set
670# CONFIG_DL2K is not set 694# CONFIG_DL2K is not set
671CONFIG_E1000=y 695# CONFIG_E1000 is not set
672CONFIG_E1000_NAPI=y
673# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set
674# CONFIG_E1000E is not set 696# CONFIG_E1000E is not set
675# CONFIG_E1000E_ENABLED is not set 697# CONFIG_E1000E_ENABLED is not set
676# CONFIG_IP1000 is not set 698# CONFIG_IP1000 is not set
@@ -680,27 +702,15 @@ CONFIG_E1000_NAPI=y
680# CONFIG_YELLOWFIN is not set 702# CONFIG_YELLOWFIN is not set
681# CONFIG_R8169 is not set 703# CONFIG_R8169 is not set
682# CONFIG_SIS190 is not set 704# CONFIG_SIS190 is not set
683CONFIG_SKGE=y 705# CONFIG_SKGE is not set
684CONFIG_SKY2=y 706# CONFIG_SKY2 is not set
685# CONFIG_SK98LIN is not set
686# CONFIG_VIA_VELOCITY is not set 707# CONFIG_VIA_VELOCITY is not set
687CONFIG_TIGON3=y 708# CONFIG_TIGON3 is not set
688# CONFIG_BNX2 is not set 709# CONFIG_BNX2 is not set
689CONFIG_MV643XX_ETH=y 710CONFIG_MV643XX_ETH=y
690# CONFIG_QLA3XXX is not set 711# CONFIG_QLA3XXX is not set
691# CONFIG_ATL1 is not set 712# CONFIG_ATL1 is not set
692CONFIG_NETDEV_10000=y 713# CONFIG_NETDEV_10000 is not set
693# CONFIG_CHELSIO_T1 is not set
694# CONFIG_CHELSIO_T3 is not set
695# CONFIG_IXGBE is not set
696# CONFIG_IXGB is not set
697# CONFIG_S2IO is not set
698# CONFIG_MYRI10GE is not set
699# CONFIG_NETXEN_NIC is not set
700# CONFIG_NIU is not set
701# CONFIG_MLX4_CORE is not set
702# CONFIG_TEHUTI is not set
703# CONFIG_BNX2X is not set
704# CONFIG_TR is not set 714# CONFIG_TR is not set
705 715
706# 716#
@@ -708,6 +718,7 @@ CONFIG_NETDEV_10000=y
708# 718#
709# CONFIG_WLAN_PRE80211 is not set 719# CONFIG_WLAN_PRE80211 is not set
710# CONFIG_WLAN_80211 is not set 720# CONFIG_WLAN_80211 is not set
721# CONFIG_IWLWIFI_LEDS is not set
711 722
712# 723#
713# USB Network Adapters 724# USB Network Adapters
@@ -738,12 +749,9 @@ CONFIG_INPUT=y
738# 749#
739# Userland interfaces 750# Userland interfaces
740# 751#
741CONFIG_INPUT_MOUSEDEV=y 752# CONFIG_INPUT_MOUSEDEV is not set
742CONFIG_INPUT_MOUSEDEV_PSAUX=y
743CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
744CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
745# CONFIG_INPUT_JOYDEV is not set 753# CONFIG_INPUT_JOYDEV is not set
746# CONFIG_INPUT_EVDEV is not set 754CONFIG_INPUT_EVDEV=y
747# CONFIG_INPUT_EVBUG is not set 755# CONFIG_INPUT_EVBUG is not set
748 756
749# 757#
@@ -765,10 +773,8 @@ CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
765# 773#
766# Character devices 774# Character devices
767# 775#
768CONFIG_VT=y 776# CONFIG_VT is not set
769CONFIG_VT_CONSOLE=y 777CONFIG_DEVKMEM=y
770CONFIG_HW_CONSOLE=y
771# CONFIG_VT_HW_CONSOLE_BINDING is not set
772# CONFIG_SERIAL_NONSTANDARD is not set 778# CONFIG_SERIAL_NONSTANDARD is not set
773# CONFIG_NOZOMI is not set 779# CONFIG_NOZOMI is not set
774 780
@@ -777,7 +783,7 @@ CONFIG_HW_CONSOLE=y
777# 783#
778CONFIG_SERIAL_8250=y 784CONFIG_SERIAL_8250=y
779CONFIG_SERIAL_8250_CONSOLE=y 785CONFIG_SERIAL_8250_CONSOLE=y
780CONFIG_SERIAL_8250_PCI=y 786# CONFIG_SERIAL_8250_PCI is not set
781CONFIG_SERIAL_8250_NR_UARTS=4 787CONFIG_SERIAL_8250_NR_UARTS=4
782CONFIG_SERIAL_8250_RUNTIME_UARTS=2 788CONFIG_SERIAL_8250_RUNTIME_UARTS=2
783# CONFIG_SERIAL_8250_EXTENDED is not set 789# CONFIG_SERIAL_8250_EXTENDED is not set
@@ -792,7 +798,7 @@ CONFIG_UNIX98_PTYS=y
792CONFIG_LEGACY_PTYS=y 798CONFIG_LEGACY_PTYS=y
793CONFIG_LEGACY_PTY_COUNT=16 799CONFIG_LEGACY_PTY_COUNT=16
794# CONFIG_IPMI_HANDLER is not set 800# CONFIG_IPMI_HANDLER is not set
795CONFIG_HW_RANDOM=m 801# CONFIG_HW_RANDOM is not set
796# CONFIG_NVRAM is not set 802# CONFIG_NVRAM is not set
797# CONFIG_R3964 is not set 803# CONFIG_R3964 is not set
798# CONFIG_APPLICOM is not set 804# CONFIG_APPLICOM is not set
@@ -804,13 +810,6 @@ CONFIG_I2C_BOARDINFO=y
804CONFIG_I2C_CHARDEV=y 810CONFIG_I2C_CHARDEV=y
805 811
806# 812#
807# I2C Algorithms
808#
809# CONFIG_I2C_ALGOBIT is not set
810# CONFIG_I2C_ALGOPCF is not set
811# CONFIG_I2C_ALGOPCA is not set
812
813#
814# I2C Hardware Bus support 813# I2C Hardware Bus support
815# 814#
816# CONFIG_I2C_ALI1535 is not set 815# CONFIG_I2C_ALI1535 is not set
@@ -837,6 +836,7 @@ CONFIG_I2C_CHARDEV=y
837# CONFIG_I2C_VIA is not set 836# CONFIG_I2C_VIA is not set
838# CONFIG_I2C_VIAPRO is not set 837# CONFIG_I2C_VIAPRO is not set
839# CONFIG_I2C_VOODOO3 is not set 838# CONFIG_I2C_VOODOO3 is not set
839# CONFIG_I2C_PCA_PLATFORM is not set
840CONFIG_I2C_MV64XXX=y 840CONFIG_I2C_MV64XXX=y
841 841
842# 842#
@@ -847,19 +847,13 @@ CONFIG_I2C_MV64XXX=y
847# CONFIG_SENSORS_PCF8574 is not set 847# CONFIG_SENSORS_PCF8574 is not set
848# CONFIG_PCF8575 is not set 848# CONFIG_PCF8575 is not set
849# CONFIG_SENSORS_PCF8591 is not set 849# CONFIG_SENSORS_PCF8591 is not set
850# CONFIG_TPS65010 is not set
851# CONFIG_SENSORS_MAX6875 is not set 850# CONFIG_SENSORS_MAX6875 is not set
852# CONFIG_SENSORS_TSL2550 is not set 851# CONFIG_SENSORS_TSL2550 is not set
853# CONFIG_I2C_DEBUG_CORE is not set 852# CONFIG_I2C_DEBUG_CORE is not set
854# CONFIG_I2C_DEBUG_ALGO is not set 853# CONFIG_I2C_DEBUG_ALGO is not set
855# CONFIG_I2C_DEBUG_BUS is not set 854# CONFIG_I2C_DEBUG_BUS is not set
856# CONFIG_I2C_DEBUG_CHIP is not set 855# CONFIG_I2C_DEBUG_CHIP is not set
857
858#
859# SPI support
860#
861# CONFIG_SPI is not set 856# CONFIG_SPI is not set
862# CONFIG_SPI_MASTER is not set
863# CONFIG_W1 is not set 857# CONFIG_W1 is not set
864# CONFIG_POWER_SUPPLY is not set 858# CONFIG_POWER_SUPPLY is not set
865CONFIG_HWMON=y 859CONFIG_HWMON=y
@@ -872,6 +866,7 @@ CONFIG_HWMON=y
872# CONFIG_SENSORS_ADM1031 is not set 866# CONFIG_SENSORS_ADM1031 is not set
873# CONFIG_SENSORS_ADM9240 is not set 867# CONFIG_SENSORS_ADM9240 is not set
874# CONFIG_SENSORS_ADT7470 is not set 868# CONFIG_SENSORS_ADT7470 is not set
869# CONFIG_SENSORS_ADT7473 is not set
875# CONFIG_SENSORS_ATXP1 is not set 870# CONFIG_SENSORS_ATXP1 is not set
876# CONFIG_SENSORS_DS1621 is not set 871# CONFIG_SENSORS_DS1621 is not set
877# CONFIG_SENSORS_I5K_AMB is not set 872# CONFIG_SENSORS_I5K_AMB is not set
@@ -901,6 +896,7 @@ CONFIG_HWMON=y
901# CONFIG_SENSORS_SMSC47M1 is not set 896# CONFIG_SENSORS_SMSC47M1 is not set
902# CONFIG_SENSORS_SMSC47M192 is not set 897# CONFIG_SENSORS_SMSC47M192 is not set
903# CONFIG_SENSORS_SMSC47B397 is not set 898# CONFIG_SENSORS_SMSC47B397 is not set
899# CONFIG_SENSORS_ADS7828 is not set
904# CONFIG_SENSORS_THMC50 is not set 900# CONFIG_SENSORS_THMC50 is not set
905# CONFIG_SENSORS_VIA686A is not set 901# CONFIG_SENSORS_VIA686A is not set
906# CONFIG_SENSORS_VT1211 is not set 902# CONFIG_SENSORS_VT1211 is not set
@@ -910,6 +906,7 @@ CONFIG_HWMON=y
910# CONFIG_SENSORS_W83792D is not set 906# CONFIG_SENSORS_W83792D is not set
911# CONFIG_SENSORS_W83793 is not set 907# CONFIG_SENSORS_W83793 is not set
912# CONFIG_SENSORS_W83L785TS is not set 908# CONFIG_SENSORS_W83L785TS is not set
909# CONFIG_SENSORS_W83L786NG is not set
913# CONFIG_SENSORS_W83627HF is not set 910# CONFIG_SENSORS_W83627HF is not set
914# CONFIG_SENSORS_W83627EHF is not set 911# CONFIG_SENSORS_W83627EHF is not set
915# CONFIG_HWMON_DEBUG_CHIP is not set 912# CONFIG_HWMON_DEBUG_CHIP is not set
@@ -925,14 +922,24 @@ CONFIG_SSB_POSSIBLE=y
925# Multifunction device drivers 922# Multifunction device drivers
926# 923#
927# CONFIG_MFD_SM501 is not set 924# CONFIG_MFD_SM501 is not set
925# CONFIG_MFD_ASIC3 is not set
926# CONFIG_HTC_PASIC3 is not set
928 927
929# 928#
930# Multimedia devices 929# Multimedia devices
931# 930#
931
932#
933# Multimedia core support
934#
932# CONFIG_VIDEO_DEV is not set 935# CONFIG_VIDEO_DEV is not set
933# CONFIG_DVB_CORE is not set 936# CONFIG_DVB_CORE is not set
934CONFIG_DAB=y 937# CONFIG_VIDEO_MEDIA is not set
935# CONFIG_USB_DABUSB is not set 938
939#
940# Multimedia drivers
941#
942# CONFIG_DAB is not set
936 943
937# 944#
938# Graphics support 945# Graphics support
@@ -949,12 +956,6 @@ CONFIG_DAB=y
949# CONFIG_DISPLAY_SUPPORT is not set 956# CONFIG_DISPLAY_SUPPORT is not set
950 957
951# 958#
952# Console display driver support
953#
954# CONFIG_VGA_CONSOLE is not set
955CONFIG_DUMMY_CONSOLE=y
956
957#
958# Sound 959# Sound
959# 960#
960# CONFIG_SOUND is not set 961# CONFIG_SOUND is not set
@@ -985,14 +986,18 @@ CONFIG_USB_DEVICEFS=y
985CONFIG_USB_DEVICE_CLASS=y 986CONFIG_USB_DEVICE_CLASS=y
986# CONFIG_USB_DYNAMIC_MINORS is not set 987# CONFIG_USB_DYNAMIC_MINORS is not set
987# CONFIG_USB_OTG is not set 988# CONFIG_USB_OTG is not set
989# CONFIG_USB_OTG_WHITELIST is not set
990# CONFIG_USB_OTG_BLACKLIST_HUB is not set
988 991
989# 992#
990# USB Host Controller Drivers 993# USB Host Controller Drivers
991# 994#
995# CONFIG_USB_C67X00_HCD is not set
992CONFIG_USB_EHCI_HCD=y 996CONFIG_USB_EHCI_HCD=y
993CONFIG_USB_EHCI_ROOT_HUB_TT=y 997CONFIG_USB_EHCI_ROOT_HUB_TT=y
994CONFIG_USB_EHCI_TT_NEWSCHED=y 998CONFIG_USB_EHCI_TT_NEWSCHED=y
995# CONFIG_USB_ISP116X_HCD is not set 999# CONFIG_USB_ISP116X_HCD is not set
1000# CONFIG_USB_ISP1760_HCD is not set
996# CONFIG_USB_OHCI_HCD is not set 1001# CONFIG_USB_OHCI_HCD is not set
997# CONFIG_USB_UHCI_HCD is not set 1002# CONFIG_USB_UHCI_HCD is not set
998# CONFIG_USB_SL811_HCD is not set 1003# CONFIG_USB_SL811_HCD is not set
@@ -1003,6 +1008,7 @@ CONFIG_USB_EHCI_TT_NEWSCHED=y
1003# 1008#
1004# CONFIG_USB_ACM is not set 1009# CONFIG_USB_ACM is not set
1005CONFIG_USB_PRINTER=y 1010CONFIG_USB_PRINTER=y
1011# CONFIG_USB_WDM is not set
1006 1012
1007# 1013#
1008# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' 1014# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
@@ -1022,7 +1028,9 @@ CONFIG_USB_STORAGE_SDDR09=y
1022CONFIG_USB_STORAGE_SDDR55=y 1028CONFIG_USB_STORAGE_SDDR55=y
1023CONFIG_USB_STORAGE_JUMPSHOT=y 1029CONFIG_USB_STORAGE_JUMPSHOT=y
1024# CONFIG_USB_STORAGE_ALAUDA is not set 1030# CONFIG_USB_STORAGE_ALAUDA is not set
1031# CONFIG_USB_STORAGE_ONETOUCH is not set
1025# CONFIG_USB_STORAGE_KARMA is not set 1032# CONFIG_USB_STORAGE_KARMA is not set
1033# CONFIG_USB_STORAGE_CYPRESS_ATACB is not set
1026# CONFIG_USB_LIBUSUAL is not set 1034# CONFIG_USB_LIBUSUAL is not set
1027 1035
1028# 1036#
@@ -1060,6 +1068,7 @@ CONFIG_USB_STORAGE_JUMPSHOT=y
1060# CONFIG_USB_TRANCEVIBRATOR is not set 1068# CONFIG_USB_TRANCEVIBRATOR is not set
1061# CONFIG_USB_IOWARRIOR is not set 1069# CONFIG_USB_IOWARRIOR is not set
1062# CONFIG_USB_TEST is not set 1070# CONFIG_USB_TEST is not set
1071# CONFIG_USB_ISIGHTFW is not set
1063# CONFIG_USB_GADGET is not set 1072# CONFIG_USB_GADGET is not set
1064# CONFIG_MMC is not set 1073# CONFIG_MMC is not set
1065CONFIG_NEW_LEDS=y 1074CONFIG_NEW_LEDS=y
@@ -1068,7 +1077,7 @@ CONFIG_LEDS_CLASS=y
1068# 1077#
1069# LED drivers 1078# LED drivers
1070# 1079#
1071# CONFIG_LEDS_GPIO is not set 1080CONFIG_LEDS_GPIO=y
1072 1081
1073# 1082#
1074# LED Triggers 1083# LED Triggers
@@ -1076,6 +1085,7 @@ CONFIG_LEDS_CLASS=y
1076CONFIG_LEDS_TRIGGERS=y 1085CONFIG_LEDS_TRIGGERS=y
1077CONFIG_LEDS_TRIGGER_TIMER=y 1086CONFIG_LEDS_TRIGGER_TIMER=y
1078CONFIG_LEDS_TRIGGER_HEARTBEAT=y 1087CONFIG_LEDS_TRIGGER_HEARTBEAT=y
1088CONFIG_LEDS_TRIGGER_DEFAULT_ON=y
1079CONFIG_RTC_LIB=y 1089CONFIG_RTC_LIB=y
1080CONFIG_RTC_CLASS=y 1090CONFIG_RTC_CLASS=y
1081CONFIG_RTC_HCTOSYS=y 1091CONFIG_RTC_HCTOSYS=y
@@ -1105,6 +1115,7 @@ CONFIG_RTC_DRV_RS5C372=y
1105# CONFIG_RTC_DRV_PCF8583 is not set 1115# CONFIG_RTC_DRV_PCF8583 is not set
1106CONFIG_RTC_DRV_M41T80=y 1116CONFIG_RTC_DRV_M41T80=y
1107# CONFIG_RTC_DRV_M41T80_WDT is not set 1117# CONFIG_RTC_DRV_M41T80_WDT is not set
1118# CONFIG_RTC_DRV_S35390A is not set
1108 1119
1109# 1120#
1110# SPI RTC drivers 1121# SPI RTC drivers
@@ -1125,6 +1136,7 @@ CONFIG_RTC_DRV_M41T80=y
1125# 1136#
1126# on-CPU RTC drivers 1137# on-CPU RTC drivers
1127# 1138#
1139# CONFIG_UIO is not set
1128 1140
1129# 1141#
1130# File systems 1142# File systems
@@ -1140,14 +1152,11 @@ CONFIG_JBD=y
1140# CONFIG_JFS_FS is not set 1152# CONFIG_JFS_FS is not set
1141# CONFIG_FS_POSIX_ACL is not set 1153# CONFIG_FS_POSIX_ACL is not set
1142# CONFIG_XFS_FS is not set 1154# CONFIG_XFS_FS is not set
1143# CONFIG_GFS2_FS is not set
1144# CONFIG_OCFS2_FS is not set 1155# CONFIG_OCFS2_FS is not set
1145# CONFIG_MINIX_FS is not set 1156CONFIG_DNOTIFY=y
1146# CONFIG_ROMFS_FS is not set
1147CONFIG_INOTIFY=y 1157CONFIG_INOTIFY=y
1148CONFIG_INOTIFY_USER=y 1158CONFIG_INOTIFY_USER=y
1149# CONFIG_QUOTA is not set 1159# CONFIG_QUOTA is not set
1150CONFIG_DNOTIFY=y
1151# CONFIG_AUTOFS_FS is not set 1160# CONFIG_AUTOFS_FS is not set
1152# CONFIG_AUTOFS4_FS is not set 1161# CONFIG_AUTOFS4_FS is not set
1153# CONFIG_FUSE_FS is not set 1162# CONFIG_FUSE_FS is not set
@@ -1155,8 +1164,8 @@ CONFIG_DNOTIFY=y
1155# 1164#
1156# CD-ROM/DVD Filesystems 1165# CD-ROM/DVD Filesystems
1157# 1166#
1158CONFIG_ISO9660_FS=y 1167CONFIG_ISO9660_FS=m
1159# CONFIG_JOLIET is not set 1168CONFIG_JOLIET=y
1160# CONFIG_ZISOFS is not set 1169# CONFIG_ZISOFS is not set
1161CONFIG_UDF_FS=m 1170CONFIG_UDF_FS=m
1162CONFIG_UDF_NLS=y 1171CONFIG_UDF_NLS=y
@@ -1205,8 +1214,10 @@ CONFIG_JFFS2_RTIME=y
1205# CONFIG_JFFS2_RUBIN is not set 1214# CONFIG_JFFS2_RUBIN is not set
1206CONFIG_CRAMFS=y 1215CONFIG_CRAMFS=y
1207# CONFIG_VXFS_FS is not set 1216# CONFIG_VXFS_FS is not set
1217# CONFIG_MINIX_FS is not set
1208# CONFIG_HPFS_FS is not set 1218# CONFIG_HPFS_FS is not set
1209# CONFIG_QNX4FS_FS is not set 1219# CONFIG_QNX4FS_FS is not set
1220# CONFIG_ROMFS_FS is not set
1210# CONFIG_SYSV_FS is not set 1221# CONFIG_SYSV_FS is not set
1211# CONFIG_UFS_FS is not set 1222# CONFIG_UFS_FS is not set
1212CONFIG_NETWORK_FILESYSTEMS=y 1223CONFIG_NETWORK_FILESYSTEMS=y
@@ -1214,7 +1225,6 @@ CONFIG_NFS_FS=y
1214CONFIG_NFS_V3=y 1225CONFIG_NFS_V3=y
1215# CONFIG_NFS_V3_ACL is not set 1226# CONFIG_NFS_V3_ACL is not set
1216# CONFIG_NFS_V4 is not set 1227# CONFIG_NFS_V4 is not set
1217# CONFIG_NFS_DIRECTIO is not set
1218# CONFIG_NFSD is not set 1228# CONFIG_NFSD is not set
1219CONFIG_ROOT_NFS=y 1229CONFIG_ROOT_NFS=y
1220CONFIG_LOCKD=y 1230CONFIG_LOCKD=y
@@ -1241,14 +1251,13 @@ CONFIG_PARTITION_ADVANCED=y
1241# CONFIG_MAC_PARTITION is not set 1251# CONFIG_MAC_PARTITION is not set
1242CONFIG_MSDOS_PARTITION=y 1252CONFIG_MSDOS_PARTITION=y
1243CONFIG_BSD_DISKLABEL=y 1253CONFIG_BSD_DISKLABEL=y
1244CONFIG_MINIX_SUBPARTITION=y 1254# CONFIG_MINIX_SUBPARTITION is not set
1245CONFIG_SOLARIS_X86_PARTITION=y 1255# CONFIG_SOLARIS_X86_PARTITION is not set
1246CONFIG_UNIXWARE_DISKLABEL=y 1256# CONFIG_UNIXWARE_DISKLABEL is not set
1247CONFIG_LDM_PARTITION=y 1257# CONFIG_LDM_PARTITION is not set
1248CONFIG_LDM_DEBUG=y
1249# CONFIG_SGI_PARTITION is not set 1258# CONFIG_SGI_PARTITION is not set
1250# CONFIG_ULTRIX_PARTITION is not set 1259# CONFIG_ULTRIX_PARTITION is not set
1251CONFIG_SUN_PARTITION=y 1260# CONFIG_SUN_PARTITION is not set
1252# CONFIG_KARMA_PARTITION is not set 1261# CONFIG_KARMA_PARTITION is not set
1253# CONFIG_EFI_PARTITION is not set 1262# CONFIG_EFI_PARTITION is not set
1254# CONFIG_SYSV68_PARTITION is not set 1263# CONFIG_SYSV68_PARTITION is not set
@@ -1300,15 +1309,48 @@ CONFIG_NLS_ISO8859_2=y
1300# CONFIG_PRINTK_TIME is not set 1309# CONFIG_PRINTK_TIME is not set
1301CONFIG_ENABLE_WARN_DEPRECATED=y 1310CONFIG_ENABLE_WARN_DEPRECATED=y
1302CONFIG_ENABLE_MUST_CHECK=y 1311CONFIG_ENABLE_MUST_CHECK=y
1303# CONFIG_MAGIC_SYSRQ is not set 1312CONFIG_FRAME_WARN=1024
1313CONFIG_MAGIC_SYSRQ=y
1304# CONFIG_UNUSED_SYMBOLS is not set 1314# CONFIG_UNUSED_SYMBOLS is not set
1305# CONFIG_DEBUG_FS is not set 1315# CONFIG_DEBUG_FS is not set
1306# CONFIG_HEADERS_CHECK is not set 1316# CONFIG_HEADERS_CHECK is not set
1307# CONFIG_DEBUG_KERNEL is not set 1317CONFIG_DEBUG_KERNEL=y
1318# CONFIG_DEBUG_SHIRQ is not set
1319CONFIG_DETECT_SOFTLOCKUP=y
1320CONFIG_SCHED_DEBUG=y
1321CONFIG_SCHEDSTATS=y
1322# CONFIG_TIMER_STATS is not set
1323# CONFIG_DEBUG_OBJECTS is not set
1324CONFIG_DEBUG_PREEMPT=y
1325# CONFIG_DEBUG_RT_MUTEXES is not set
1326# CONFIG_RT_MUTEX_TESTER is not set
1327# CONFIG_DEBUG_SPINLOCK is not set
1328# CONFIG_DEBUG_MUTEXES is not set
1329# CONFIG_DEBUG_LOCK_ALLOC is not set
1330# CONFIG_PROVE_LOCKING is not set
1331# CONFIG_LOCK_STAT is not set
1332# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
1333# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
1334# CONFIG_DEBUG_KOBJECT is not set
1308# CONFIG_DEBUG_BUGVERBOSE is not set 1335# CONFIG_DEBUG_BUGVERBOSE is not set
1336CONFIG_DEBUG_INFO=y
1337# CONFIG_DEBUG_VM is not set
1338# CONFIG_DEBUG_WRITECOUNT is not set
1339# CONFIG_DEBUG_LIST is not set
1340# CONFIG_DEBUG_SG is not set
1309CONFIG_FRAME_POINTER=y 1341CONFIG_FRAME_POINTER=y
1342# CONFIG_BOOT_PRINTK_DELAY is not set
1343# CONFIG_RCU_TORTURE_TEST is not set
1344# CONFIG_KPROBES_SANITY_TEST is not set
1345# CONFIG_BACKTRACE_SELF_TEST is not set
1346# CONFIG_LKDTM is not set
1347# CONFIG_FAULT_INJECTION is not set
1310# CONFIG_SAMPLES is not set 1348# CONFIG_SAMPLES is not set
1311CONFIG_DEBUG_USER=y 1349CONFIG_DEBUG_USER=y
1350CONFIG_DEBUG_ERRORS=y
1351# CONFIG_DEBUG_STACK_USAGE is not set
1352CONFIG_DEBUG_LL=y
1353# CONFIG_DEBUG_ICEDCC is not set
1312 1354
1313# 1355#
1314# Security options 1356# Security options
@@ -1317,50 +1359,79 @@ CONFIG_DEBUG_USER=y
1317# CONFIG_SECURITY is not set 1359# CONFIG_SECURITY is not set
1318# CONFIG_SECURITY_FILE_CAPABILITIES is not set 1360# CONFIG_SECURITY_FILE_CAPABILITIES is not set
1319CONFIG_CRYPTO=y 1361CONFIG_CRYPTO=y
1362
1363#
1364# Crypto core or helper
1365#
1320CONFIG_CRYPTO_ALGAPI=m 1366CONFIG_CRYPTO_ALGAPI=m
1321CONFIG_CRYPTO_BLKCIPHER=m 1367CONFIG_CRYPTO_BLKCIPHER=m
1322# CONFIG_CRYPTO_SEQIV is not set
1323CONFIG_CRYPTO_MANAGER=m 1368CONFIG_CRYPTO_MANAGER=m
1369# CONFIG_CRYPTO_GF128MUL is not set
1370# CONFIG_CRYPTO_NULL is not set
1371# CONFIG_CRYPTO_CRYPTD is not set
1372# CONFIG_CRYPTO_AUTHENC is not set
1373# CONFIG_CRYPTO_TEST is not set
1374
1375#
1376# Authenticated Encryption with Associated Data
1377#
1378# CONFIG_CRYPTO_CCM is not set
1379# CONFIG_CRYPTO_GCM is not set
1380# CONFIG_CRYPTO_SEQIV is not set
1381
1382#
1383# Block modes
1384#
1385CONFIG_CRYPTO_CBC=m
1386# CONFIG_CRYPTO_CTR is not set
1387# CONFIG_CRYPTO_CTS is not set
1388CONFIG_CRYPTO_ECB=m
1389# CONFIG_CRYPTO_LRW is not set
1390CONFIG_CRYPTO_PCBC=m
1391# CONFIG_CRYPTO_XTS is not set
1392
1393#
1394# Hash modes
1395#
1324# CONFIG_CRYPTO_HMAC is not set 1396# CONFIG_CRYPTO_HMAC is not set
1325# CONFIG_CRYPTO_XCBC is not set 1397# CONFIG_CRYPTO_XCBC is not set
1326# CONFIG_CRYPTO_NULL is not set 1398
1399#
1400# Digest
1401#
1402# CONFIG_CRYPTO_CRC32C is not set
1327# CONFIG_CRYPTO_MD4 is not set 1403# CONFIG_CRYPTO_MD4 is not set
1328# CONFIG_CRYPTO_MD5 is not set 1404# CONFIG_CRYPTO_MD5 is not set
1405# CONFIG_CRYPTO_MICHAEL_MIC is not set
1329# CONFIG_CRYPTO_SHA1 is not set 1406# CONFIG_CRYPTO_SHA1 is not set
1330# CONFIG_CRYPTO_SHA256 is not set 1407# CONFIG_CRYPTO_SHA256 is not set
1331# CONFIG_CRYPTO_SHA512 is not set 1408# CONFIG_CRYPTO_SHA512 is not set
1332# CONFIG_CRYPTO_WP512 is not set
1333# CONFIG_CRYPTO_TGR192 is not set 1409# CONFIG_CRYPTO_TGR192 is not set
1334# CONFIG_CRYPTO_GF128MUL is not set 1410# CONFIG_CRYPTO_WP512 is not set
1335CONFIG_CRYPTO_ECB=m 1411
1336CONFIG_CRYPTO_CBC=m 1412#
1337CONFIG_CRYPTO_PCBC=m 1413# Ciphers
1338# CONFIG_CRYPTO_LRW is not set 1414#
1339# CONFIG_CRYPTO_XTS is not set
1340# CONFIG_CRYPTO_CTR is not set
1341# CONFIG_CRYPTO_GCM is not set
1342# CONFIG_CRYPTO_CCM is not set
1343# CONFIG_CRYPTO_CRYPTD is not set
1344# CONFIG_CRYPTO_DES is not set
1345# CONFIG_CRYPTO_FCRYPT is not set
1346# CONFIG_CRYPTO_BLOWFISH is not set
1347# CONFIG_CRYPTO_TWOFISH is not set
1348# CONFIG_CRYPTO_SERPENT is not set
1349# CONFIG_CRYPTO_AES is not set 1415# CONFIG_CRYPTO_AES is not set
1416# CONFIG_CRYPTO_ANUBIS is not set
1417# CONFIG_CRYPTO_ARC4 is not set
1418# CONFIG_CRYPTO_BLOWFISH is not set
1419# CONFIG_CRYPTO_CAMELLIA is not set
1350# CONFIG_CRYPTO_CAST5 is not set 1420# CONFIG_CRYPTO_CAST5 is not set
1351# CONFIG_CRYPTO_CAST6 is not set 1421# CONFIG_CRYPTO_CAST6 is not set
1352# CONFIG_CRYPTO_TEA is not set 1422# CONFIG_CRYPTO_DES is not set
1353# CONFIG_CRYPTO_ARC4 is not set 1423# CONFIG_CRYPTO_FCRYPT is not set
1354# CONFIG_CRYPTO_KHAZAD is not set 1424# CONFIG_CRYPTO_KHAZAD is not set
1355# CONFIG_CRYPTO_ANUBIS is not set
1356# CONFIG_CRYPTO_SEED is not set
1357# CONFIG_CRYPTO_SALSA20 is not set 1425# CONFIG_CRYPTO_SALSA20 is not set
1426# CONFIG_CRYPTO_SEED is not set
1427# CONFIG_CRYPTO_SERPENT is not set
1428# CONFIG_CRYPTO_TEA is not set
1429# CONFIG_CRYPTO_TWOFISH is not set
1430
1431#
1432# Compression
1433#
1358# CONFIG_CRYPTO_DEFLATE is not set 1434# CONFIG_CRYPTO_DEFLATE is not set
1359# CONFIG_CRYPTO_MICHAEL_MIC is not set
1360# CONFIG_CRYPTO_CRC32C is not set
1361# CONFIG_CRYPTO_CAMELLIA is not set
1362# CONFIG_CRYPTO_TEST is not set
1363# CONFIG_CRYPTO_AUTHENC is not set
1364# CONFIG_CRYPTO_LZO is not set 1435# CONFIG_CRYPTO_LZO is not set
1365CONFIG_CRYPTO_HW=y 1436CONFIG_CRYPTO_HW=y
1366# CONFIG_CRYPTO_DEV_HIFN_795X is not set 1437# CONFIG_CRYPTO_DEV_HIFN_795X is not set
@@ -1369,12 +1440,14 @@ CONFIG_CRYPTO_HW=y
1369# Library routines 1440# Library routines
1370# 1441#
1371CONFIG_BITREVERSE=y 1442CONFIG_BITREVERSE=y
1372CONFIG_CRC_CCITT=y 1443# CONFIG_GENERIC_FIND_FIRST_BIT is not set
1373CONFIG_CRC16=y 1444# CONFIG_GENERIC_FIND_NEXT_BIT is not set
1374# CONFIG_CRC_ITU_T is not set 1445# CONFIG_CRC_CCITT is not set
1446# CONFIG_CRC16 is not set
1447CONFIG_CRC_ITU_T=m
1375CONFIG_CRC32=y 1448CONFIG_CRC32=y
1376# CONFIG_CRC7 is not set 1449# CONFIG_CRC7 is not set
1377CONFIG_LIBCRC32C=y 1450# CONFIG_LIBCRC32C is not set
1378CONFIG_ZLIB_INFLATE=y 1451CONFIG_ZLIB_INFLATE=y
1379CONFIG_ZLIB_DEFLATE=y 1452CONFIG_ZLIB_DEFLATE=y
1380CONFIG_PLIST=y 1453CONFIG_PLIST=y
diff --git a/arch/arm/configs/picotux200_defconfig b/arch/arm/configs/picotux200_defconfig
index 95a22f512805..14826f0dabde 100644
--- a/arch/arm/configs/picotux200_defconfig
+++ b/arch/arm/configs/picotux200_defconfig
@@ -201,7 +201,6 @@ CONFIG_ARM_THUMB=y
201# Kernel Features 201# Kernel Features
202# 202#
203# CONFIG_PREEMPT is not set 203# CONFIG_PREEMPT is not set
204CONFIG_NO_IDLE_HZ=y
205CONFIG_HZ=100 204CONFIG_HZ=100
206CONFIG_AEABI=y 205CONFIG_AEABI=y
207CONFIG_OABI_COMPAT=y 206CONFIG_OABI_COMPAT=y
diff --git a/arch/arm/configs/pnx4008_defconfig b/arch/arm/configs/pnx4008_defconfig
index b5e11aa2e290..811b8f60d19d 100644
--- a/arch/arm/configs/pnx4008_defconfig
+++ b/arch/arm/configs/pnx4008_defconfig
@@ -151,7 +151,6 @@ CONFIG_ARM_THUMB=y
151# Kernel Features 151# Kernel Features
152# 152#
153CONFIG_PREEMPT=y 153CONFIG_PREEMPT=y
154# CONFIG_NO_IDLE_HZ is not set
155CONFIG_HZ=100 154CONFIG_HZ=100
156# CONFIG_AEABI is not set 155# CONFIG_AEABI is not set
157# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set 156# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set
diff --git a/arch/arm/configs/qil-a9260_defconfig b/arch/arm/configs/qil-a9260_defconfig
new file mode 100644
index 000000000000..ef903bed061e
--- /dev/null
+++ b/arch/arm/configs/qil-a9260_defconfig
@@ -0,0 +1,1256 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.24
4# Tue Apr 15 12:28:38 2008
5#
6CONFIG_ARM=y
7CONFIG_SYS_SUPPORTS_APM_EMULATION=y
8CONFIG_GENERIC_GPIO=y
9CONFIG_GENERIC_TIME=y
10CONFIG_GENERIC_CLOCKEVENTS=y
11CONFIG_MMU=y
12# CONFIG_NO_IOPORT is not set
13CONFIG_GENERIC_HARDIRQS=y
14CONFIG_STACKTRACE_SUPPORT=y
15CONFIG_LOCKDEP_SUPPORT=y
16CONFIG_TRACE_IRQFLAGS_SUPPORT=y
17CONFIG_HARDIRQS_SW_RESEND=y
18CONFIG_GENERIC_IRQ_PROBE=y
19CONFIG_RWSEM_GENERIC_SPINLOCK=y
20# CONFIG_ARCH_HAS_ILOG2_U32 is not set
21# CONFIG_ARCH_HAS_ILOG2_U64 is not set
22CONFIG_GENERIC_HWEIGHT=y
23CONFIG_GENERIC_CALIBRATE_DELAY=y
24CONFIG_ZONE_DMA=y
25CONFIG_VECTORS_BASE=0xffff0000
26CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
27
28#
29# General setup
30#
31CONFIG_EXPERIMENTAL=y
32CONFIG_BROKEN_ON_SMP=y
33CONFIG_INIT_ENV_ARG_LIMIT=32
34CONFIG_LOCALVERSION=""
35# CONFIG_LOCALVERSION_AUTO is not set
36# CONFIG_SWAP is not set
37CONFIG_SYSVIPC=y
38CONFIG_SYSVIPC_SYSCTL=y
39# CONFIG_POSIX_MQUEUE is not set
40# CONFIG_BSD_PROCESS_ACCT is not set
41# CONFIG_TASKSTATS is not set
42# CONFIG_USER_NS is not set
43# CONFIG_PID_NS is not set
44# CONFIG_AUDIT is not set
45# CONFIG_IKCONFIG is not set
46CONFIG_LOG_BUF_SHIFT=14
47# CONFIG_CGROUPS is not set
48CONFIG_FAIR_GROUP_SCHED=y
49CONFIG_FAIR_USER_SCHED=y
50# CONFIG_FAIR_CGROUP_SCHED is not set
51# CONFIG_SYSFS_DEPRECATED is not set
52# CONFIG_RELAY is not set
53# CONFIG_BLK_DEV_INITRD is not set
54# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
55CONFIG_SYSCTL=y
56# CONFIG_EMBEDDED is not set
57CONFIG_UID16=y
58CONFIG_SYSCTL_SYSCALL=y
59CONFIG_KALLSYMS=y
60# CONFIG_KALLSYMS_ALL is not set
61# CONFIG_KALLSYMS_EXTRA_PASS is not set
62CONFIG_HOTPLUG=y
63CONFIG_PRINTK=y
64CONFIG_BUG=y
65CONFIG_ELF_CORE=y
66CONFIG_BASE_FULL=y
67CONFIG_FUTEX=y
68CONFIG_ANON_INODES=y
69CONFIG_EPOLL=y
70CONFIG_SIGNALFD=y
71CONFIG_EVENTFD=y
72CONFIG_SHMEM=y
73CONFIG_VM_EVENT_COUNTERS=y
74CONFIG_SLAB=y
75# CONFIG_SLUB is not set
76# CONFIG_SLOB is not set
77CONFIG_SLABINFO=y
78CONFIG_RT_MUTEXES=y
79# CONFIG_TINY_SHMEM is not set
80CONFIG_BASE_SMALL=0
81CONFIG_MODULES=y
82CONFIG_MODULE_UNLOAD=y
83# CONFIG_MODULE_FORCE_UNLOAD is not set
84# CONFIG_MODVERSIONS is not set
85# CONFIG_MODULE_SRCVERSION_ALL is not set
86CONFIG_KMOD=y
87CONFIG_BLOCK=y
88# CONFIG_LBD is not set
89# CONFIG_BLK_DEV_IO_TRACE is not set
90# CONFIG_LSF is not set
91# CONFIG_BLK_DEV_BSG is not set
92
93#
94# IO Schedulers
95#
96CONFIG_IOSCHED_NOOP=y
97CONFIG_IOSCHED_AS=y
98# CONFIG_IOSCHED_DEADLINE is not set
99# CONFIG_IOSCHED_CFQ is not set
100CONFIG_DEFAULT_AS=y
101# CONFIG_DEFAULT_DEADLINE is not set
102# CONFIG_DEFAULT_CFQ is not set
103# CONFIG_DEFAULT_NOOP is not set
104CONFIG_DEFAULT_IOSCHED="anticipatory"
105
106#
107# System Type
108#
109# CONFIG_ARCH_AAEC2000 is not set
110# CONFIG_ARCH_INTEGRATOR is not set
111# CONFIG_ARCH_REALVIEW is not set
112# CONFIG_ARCH_VERSATILE is not set
113CONFIG_ARCH_AT91=y
114# CONFIG_ARCH_CLPS7500 is not set
115# CONFIG_ARCH_CLPS711X is not set
116# CONFIG_ARCH_CO285 is not set
117# CONFIG_ARCH_EBSA110 is not set
118# CONFIG_ARCH_EP93XX is not set
119# CONFIG_ARCH_FOOTBRIDGE is not set
120# CONFIG_ARCH_NETX is not set
121# CONFIG_ARCH_H720X is not set
122# CONFIG_ARCH_IMX is not set
123# CONFIG_ARCH_IOP13XX is not set
124# CONFIG_ARCH_IOP32X is not set
125# CONFIG_ARCH_IOP33X is not set
126# CONFIG_ARCH_IXP23XX is not set
127# CONFIG_ARCH_IXP2000 is not set
128# CONFIG_ARCH_IXP4XX is not set
129# CONFIG_ARCH_L7200 is not set
130# CONFIG_ARCH_KS8695 is not set
131# CONFIG_ARCH_NS9XXX is not set
132# CONFIG_ARCH_MXC is not set
133# CONFIG_ARCH_PNX4008 is not set
134# CONFIG_ARCH_PXA is not set
135# CONFIG_ARCH_RPC is not set
136# CONFIG_ARCH_SA1100 is not set
137# CONFIG_ARCH_S3C2410 is not set
138# CONFIG_ARCH_SHARK is not set
139# CONFIG_ARCH_LH7A40X is not set
140# CONFIG_ARCH_DAVINCI is not set
141# CONFIG_ARCH_OMAP is not set
142
143#
144# Boot options
145#
146
147#
148# Power management
149#
150
151#
152# Atmel AT91 System-on-Chip
153#
154# CONFIG_ARCH_AT91RM9200 is not set
155CONFIG_ARCH_AT91SAM9260=y
156# CONFIG_ARCH_AT91SAM9261 is not set
157# CONFIG_ARCH_AT91SAM9263 is not set
158# CONFIG_ARCH_AT91SAM9RL is not set
159# CONFIG_ARCH_AT91CAP9 is not set
160# CONFIG_ARCH_AT91X40 is not set
161CONFIG_AT91_PMC_UNIT=y
162
163#
164# AT91SAM9260 Variants
165#
166# CONFIG_ARCH_AT91SAM9260_SAM9XE is not set
167
168#
169# AT91SAM9260 / AT91SAM9XE Board Type
170#
171# CONFIG_MACH_AT91SAM9260EK is not set
172# CONFIG_MACH_CAM60 is not set
173# CONFIG_MACH_SAM9_L9260 is not set
174# CONFIG_MACH_USB_A9260 is not set
175CONFIG_MACH_QIL_A9260=y
176
177#
178# AT91 Board Options
179#
180
181#
182# AT91 Feature Selections
183#
184# CONFIG_AT91_PROGRAMMABLE_CLOCKS is not set
185CONFIG_AT91_SLOW_CLOCK=y
186CONFIG_AT91_TIMER_HZ=100
187# CONFIG_AT91_EARLY_DBGU is not set
188CONFIG_AT91_EARLY_USART0=y
189# CONFIG_AT91_EARLY_USART1 is not set
190# CONFIG_AT91_EARLY_USART2 is not set
191# CONFIG_AT91_EARLY_USART3 is not set
192# CONFIG_AT91_EARLY_USART4 is not set
193# CONFIG_AT91_EARLY_USART5 is not set
194
195#
196# Processor Type
197#
198CONFIG_CPU_32=y
199CONFIG_CPU_ARM926T=y
200CONFIG_CPU_32v5=y
201CONFIG_CPU_ABRT_EV5TJ=y
202CONFIG_CPU_CACHE_VIVT=y
203CONFIG_CPU_COPY_V4WB=y
204CONFIG_CPU_TLB_V4WBI=y
205CONFIG_CPU_CP15=y
206CONFIG_CPU_CP15_MMU=y
207
208#
209# Processor Features
210#
211# CONFIG_ARM_THUMB is not set
212# CONFIG_CPU_ICACHE_DISABLE is not set
213# CONFIG_CPU_DCACHE_DISABLE is not set
214# CONFIG_CPU_DCACHE_WRITETHROUGH is not set
215# CONFIG_CPU_CACHE_ROUND_ROBIN is not set
216# CONFIG_OUTER_CACHE is not set
217
218#
219# Bus support
220#
221# CONFIG_PCI_SYSCALL is not set
222# CONFIG_ARCH_SUPPORTS_MSI is not set
223# CONFIG_PCCARD is not set
224
225#
226# Kernel Features
227#
228# CONFIG_TICK_ONESHOT is not set
229# CONFIG_NO_HZ is not set
230# CONFIG_HIGH_RES_TIMERS is not set
231CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
232# CONFIG_PREEMPT is not set
233CONFIG_HZ=100
234CONFIG_AEABI=y
235CONFIG_OABI_COMPAT=y
236# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set
237CONFIG_SELECT_MEMORY_MODEL=y
238CONFIG_FLATMEM_MANUAL=y
239# CONFIG_DISCONTIGMEM_MANUAL is not set
240# CONFIG_SPARSEMEM_MANUAL is not set
241CONFIG_FLATMEM=y
242CONFIG_FLAT_NODE_MEM_MAP=y
243# CONFIG_SPARSEMEM_STATIC is not set
244# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
245CONFIG_SPLIT_PTLOCK_CPUS=4096
246# CONFIG_RESOURCES_64BIT is not set
247CONFIG_ZONE_DMA_FLAG=1
248CONFIG_BOUNCE=y
249CONFIG_VIRT_TO_BUS=y
250# CONFIG_LEDS is not set
251CONFIG_ALIGNMENT_TRAP=y
252
253#
254# Boot options
255#
256CONFIG_ZBOOT_ROM_TEXT=0x0
257CONFIG_ZBOOT_ROM_BSS=0x0
258CONFIG_CMDLINE="mem=64M console=ttyS1,115200"
259# CONFIG_XIP_KERNEL is not set
260# CONFIG_KEXEC is not set
261
262#
263# Floating point emulation
264#
265
266#
267# At least one emulation must be selected
268#
269CONFIG_FPE_NWFPE=y
270# CONFIG_FPE_NWFPE_XP is not set
271# CONFIG_FPE_FASTFPE is not set
272# CONFIG_VFP is not set
273
274#
275# Userspace binary formats
276#
277CONFIG_BINFMT_ELF=y
278# CONFIG_BINFMT_AOUT is not set
279# CONFIG_BINFMT_MISC is not set
280
281#
282# Power management options
283#
284CONFIG_PM=y
285# CONFIG_PM_LEGACY is not set
286# CONFIG_PM_DEBUG is not set
287CONFIG_PM_SLEEP=y
288CONFIG_SUSPEND_UP_POSSIBLE=y
289CONFIG_SUSPEND=y
290# CONFIG_APM_EMULATION is not set
291
292#
293# Networking
294#
295CONFIG_NET=y
296
297#
298# Networking options
299#
300CONFIG_PACKET=y
301# CONFIG_PACKET_MMAP is not set
302CONFIG_UNIX=y
303# CONFIG_NET_KEY is not set
304CONFIG_INET=y
305CONFIG_IP_MULTICAST=y
306CONFIG_IP_ADVANCED_ROUTER=y
307CONFIG_ASK_IP_FIB_HASH=y
308# CONFIG_IP_FIB_TRIE is not set
309CONFIG_IP_FIB_HASH=y
310# CONFIG_IP_MULTIPLE_TABLES is not set
311# CONFIG_IP_ROUTE_MULTIPATH is not set
312CONFIG_IP_ROUTE_VERBOSE=y
313CONFIG_IP_PNP=y
314# CONFIG_IP_PNP_DHCP is not set
315CONFIG_IP_PNP_BOOTP=y
316CONFIG_IP_PNP_RARP=y
317# CONFIG_NET_IPIP is not set
318# CONFIG_NET_IPGRE is not set
319CONFIG_IP_MROUTE=y
320CONFIG_IP_PIMSM_V1=y
321CONFIG_IP_PIMSM_V2=y
322# CONFIG_ARPD is not set
323# CONFIG_SYN_COOKIES is not set
324# CONFIG_INET_AH is not set
325# CONFIG_INET_ESP is not set
326# CONFIG_INET_IPCOMP is not set
327# CONFIG_INET_XFRM_TUNNEL is not set
328# CONFIG_INET_TUNNEL is not set
329# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
330# CONFIG_INET_XFRM_MODE_TUNNEL is not set
331# CONFIG_INET_XFRM_MODE_BEET is not set
332# CONFIG_INET_LRO is not set
333# CONFIG_INET_DIAG is not set
334# CONFIG_TCP_CONG_ADVANCED is not set
335CONFIG_TCP_CONG_CUBIC=y
336CONFIG_DEFAULT_TCP_CONG="cubic"
337# CONFIG_TCP_MD5SIG is not set
338# CONFIG_IPV6 is not set
339# CONFIG_INET6_XFRM_TUNNEL is not set
340# CONFIG_INET6_TUNNEL is not set
341# CONFIG_NETWORK_SECMARK is not set
342# CONFIG_NETFILTER is not set
343# CONFIG_IP_DCCP is not set
344# CONFIG_IP_SCTP is not set
345# CONFIG_TIPC is not set
346# CONFIG_ATM is not set
347# CONFIG_BRIDGE is not set
348# CONFIG_VLAN_8021Q is not set
349# CONFIG_DECNET is not set
350# CONFIG_LLC2 is not set
351# CONFIG_IPX is not set
352# CONFIG_ATALK is not set
353# CONFIG_X25 is not set
354# CONFIG_LAPB is not set
355# CONFIG_ECONET is not set
356# CONFIG_WAN_ROUTER is not set
357# CONFIG_NET_SCHED is not set
358
359#
360# Network testing
361#
362# CONFIG_NET_PKTGEN is not set
363# CONFIG_HAMRADIO is not set
364# CONFIG_IRDA is not set
365# CONFIG_BT is not set
366# CONFIG_AF_RXRPC is not set
367
368#
369# Wireless
370#
371# CONFIG_CFG80211 is not set
372# CONFIG_WIRELESS_EXT is not set
373# CONFIG_MAC80211 is not set
374# CONFIG_IEEE80211 is not set
375# CONFIG_RFKILL is not set
376# CONFIG_NET_9P is not set
377
378#
379# Device Drivers
380#
381
382#
383# Generic Driver Options
384#
385CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
386CONFIG_STANDALONE=y
387CONFIG_PREVENT_FIRMWARE_BUILD=y
388# CONFIG_FW_LOADER is not set
389# CONFIG_DEBUG_DRIVER is not set
390# CONFIG_DEBUG_DEVRES is not set
391# CONFIG_SYS_HYPERVISOR is not set
392# CONFIG_CONNECTOR is not set
393CONFIG_MTD=y
394# CONFIG_MTD_DEBUG is not set
395# CONFIG_MTD_CONCAT is not set
396CONFIG_MTD_PARTITIONS=y
397# CONFIG_MTD_REDBOOT_PARTS is not set
398CONFIG_MTD_CMDLINE_PARTS=y
399# CONFIG_MTD_AFS_PARTS is not set
400
401#
402# User Modules And Translation Layers
403#
404CONFIG_MTD_CHAR=y
405CONFIG_MTD_BLKDEVS=y
406CONFIG_MTD_BLOCK=y
407# CONFIG_FTL is not set
408# CONFIG_NFTL is not set
409# CONFIG_INFTL is not set
410# CONFIG_RFD_FTL is not set
411# CONFIG_SSFDC is not set
412# CONFIG_MTD_OOPS is not set
413
414#
415# RAM/ROM/Flash chip drivers
416#
417# CONFIG_MTD_CFI is not set
418# CONFIG_MTD_JEDECPROBE is not set
419CONFIG_MTD_MAP_BANK_WIDTH_1=y
420CONFIG_MTD_MAP_BANK_WIDTH_2=y
421CONFIG_MTD_MAP_BANK_WIDTH_4=y
422# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
423# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
424# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
425CONFIG_MTD_CFI_I1=y
426CONFIG_MTD_CFI_I2=y
427# CONFIG_MTD_CFI_I4 is not set
428# CONFIG_MTD_CFI_I8 is not set
429# CONFIG_MTD_RAM is not set
430# CONFIG_MTD_ROM is not set
431# CONFIG_MTD_ABSENT is not set
432
433#
434# Mapping drivers for chip access
435#
436# CONFIG_MTD_COMPLEX_MAPPINGS is not set
437# CONFIG_MTD_PLATRAM is not set
438
439#
440# Self-contained MTD device drivers
441#
442CONFIG_MTD_DATAFLASH=y
443# CONFIG_MTD_M25P80 is not set
444# CONFIG_MTD_SLRAM is not set
445# CONFIG_MTD_PHRAM is not set
446# CONFIG_MTD_MTDRAM is not set
447# CONFIG_MTD_BLOCK2MTD is not set
448
449#
450# Disk-On-Chip Device Drivers
451#
452# CONFIG_MTD_DOC2000 is not set
453# CONFIG_MTD_DOC2001 is not set
454# CONFIG_MTD_DOC2001PLUS is not set
455CONFIG_MTD_NAND=y
456# CONFIG_MTD_NAND_VERIFY_WRITE is not set
457# CONFIG_MTD_NAND_ECC_SMC is not set
458# CONFIG_MTD_NAND_MUSEUM_IDS is not set
459CONFIG_MTD_NAND_IDS=y
460# CONFIG_MTD_NAND_DISKONCHIP is not set
461CONFIG_MTD_NAND_AT91=y
462CONFIG_MTD_NAND_AT91_ECC_SOFT=y
463# CONFIG_MTD_NAND_AT91_ECC_HW is not set
464# CONFIG_MTD_NAND_AT91_ECC_NONE is not set
465# CONFIG_MTD_NAND_NANDSIM is not set
466# CONFIG_MTD_NAND_PLATFORM is not set
467# CONFIG_MTD_ALAUDA is not set
468# CONFIG_MTD_ONENAND is not set
469
470#
471# UBI - Unsorted block images
472#
473# CONFIG_MTD_UBI is not set
474# CONFIG_PARPORT is not set
475CONFIG_BLK_DEV=y
476# CONFIG_BLK_DEV_COW_COMMON is not set
477CONFIG_BLK_DEV_LOOP=y
478# CONFIG_BLK_DEV_CRYPTOLOOP is not set
479# CONFIG_BLK_DEV_NBD is not set
480# CONFIG_BLK_DEV_UB is not set
481# CONFIG_BLK_DEV_RAM is not set
482# CONFIG_CDROM_PKTCDVD is not set
483# CONFIG_ATA_OVER_ETH is not set
484# CONFIG_MISC_DEVICES is not set
485
486#
487# SCSI device support
488#
489# CONFIG_RAID_ATTRS is not set
490CONFIG_SCSI=y
491CONFIG_SCSI_DMA=y
492# CONFIG_SCSI_TGT is not set
493# CONFIG_SCSI_NETLINK is not set
494CONFIG_SCSI_PROC_FS=y
495
496#
497# SCSI support type (disk, tape, CD-ROM)
498#
499CONFIG_BLK_DEV_SD=y
500# CONFIG_CHR_DEV_ST is not set
501# CONFIG_CHR_DEV_OSST is not set
502# CONFIG_BLK_DEV_SR is not set
503# CONFIG_CHR_DEV_SG is not set
504# CONFIG_CHR_DEV_SCH is not set
505
506#
507# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
508#
509CONFIG_SCSI_MULTI_LUN=y
510# CONFIG_SCSI_CONSTANTS is not set
511# CONFIG_SCSI_LOGGING is not set
512# CONFIG_SCSI_SCAN_ASYNC is not set
513CONFIG_SCSI_WAIT_SCAN=m
514
515#
516# SCSI Transports
517#
518# CONFIG_SCSI_SPI_ATTRS is not set
519# CONFIG_SCSI_FC_ATTRS is not set
520# CONFIG_SCSI_ISCSI_ATTRS is not set
521# CONFIG_SCSI_SAS_LIBSAS is not set
522# CONFIG_SCSI_SRP_ATTRS is not set
523CONFIG_SCSI_LOWLEVEL=y
524# CONFIG_ISCSI_TCP is not set
525# CONFIG_SCSI_DEBUG is not set
526# CONFIG_ATA is not set
527# CONFIG_MD is not set
528CONFIG_NETDEVICES=y
529# CONFIG_NETDEVICES_MULTIQUEUE is not set
530# CONFIG_DUMMY is not set
531# CONFIG_BONDING is not set
532# CONFIG_MACVLAN is not set
533# CONFIG_EQUALIZER is not set
534# CONFIG_TUN is not set
535# CONFIG_VETH is not set
536CONFIG_PHYLIB=y
537
538#
539# MII PHY device drivers
540#
541# CONFIG_MARVELL_PHY is not set
542# CONFIG_DAVICOM_PHY is not set
543# CONFIG_QSEMI_PHY is not set
544# CONFIG_LXT_PHY is not set
545# CONFIG_CICADA_PHY is not set
546# CONFIG_VITESSE_PHY is not set
547# CONFIG_SMSC_PHY is not set
548# CONFIG_BROADCOM_PHY is not set
549# CONFIG_ICPLUS_PHY is not set
550# CONFIG_FIXED_PHY is not set
551# CONFIG_MDIO_BITBANG is not set
552CONFIG_NET_ETHERNET=y
553CONFIG_MII=y
554CONFIG_MACB=y
555# CONFIG_AX88796 is not set
556# CONFIG_SMC91X is not set
557# CONFIG_DM9000 is not set
558# CONFIG_IBM_NEW_EMAC_ZMII is not set
559# CONFIG_IBM_NEW_EMAC_RGMII is not set
560# CONFIG_IBM_NEW_EMAC_TAH is not set
561# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
562# CONFIG_B44 is not set
563CONFIG_NETDEV_1000=y
564CONFIG_NETDEV_10000=y
565
566#
567# Wireless LAN
568#
569# CONFIG_WLAN_PRE80211 is not set
570# CONFIG_WLAN_80211 is not set
571
572#
573# USB Network Adapters
574#
575# CONFIG_USB_CATC is not set
576# CONFIG_USB_KAWETH is not set
577# CONFIG_USB_PEGASUS is not set
578# CONFIG_USB_RTL8150 is not set
579# CONFIG_USB_USBNET is not set
580# CONFIG_WAN is not set
581# CONFIG_PPP is not set
582# CONFIG_SLIP is not set
583# CONFIG_SHAPER is not set
584# CONFIG_NETCONSOLE is not set
585# CONFIG_NETPOLL is not set
586# CONFIG_NET_POLL_CONTROLLER is not set
587# CONFIG_ISDN is not set
588
589#
590# Input device support
591#
592CONFIG_INPUT=y
593# CONFIG_INPUT_FF_MEMLESS is not set
594# CONFIG_INPUT_POLLDEV is not set
595
596#
597# Userland interfaces
598#
599CONFIG_INPUT_MOUSEDEV=y
600# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
601CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
602CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
603# CONFIG_INPUT_JOYDEV is not set
604CONFIG_INPUT_EVDEV=y
605CONFIG_INPUT_EVBUG=y
606
607#
608# Input Device Drivers
609#
610CONFIG_INPUT_KEYBOARD=y
611# CONFIG_KEYBOARD_ATKBD is not set
612# CONFIG_KEYBOARD_SUNKBD is not set
613# CONFIG_KEYBOARD_LKKBD is not set
614# CONFIG_KEYBOARD_XTKBD is not set
615# CONFIG_KEYBOARD_NEWTON is not set
616# CONFIG_KEYBOARD_STOWAWAY is not set
617CONFIG_KEYBOARD_GPIO=y
618# CONFIG_INPUT_MOUSE is not set
619# CONFIG_INPUT_JOYSTICK is not set
620# CONFIG_INPUT_TABLET is not set
621# CONFIG_INPUT_TOUCHSCREEN is not set
622# CONFIG_INPUT_MISC is not set
623
624#
625# Hardware I/O ports
626#
627# CONFIG_SERIO is not set
628# CONFIG_GAMEPORT is not set
629
630#
631# Character devices
632#
633CONFIG_VT=y
634CONFIG_VT_CONSOLE=y
635CONFIG_HW_CONSOLE=y
636# CONFIG_VT_HW_CONSOLE_BINDING is not set
637# CONFIG_SERIAL_NONSTANDARD is not set
638
639#
640# Serial drivers
641#
642# CONFIG_SERIAL_8250 is not set
643
644#
645# Non-8250 serial port support
646#
647CONFIG_SERIAL_ATMEL=y
648CONFIG_SERIAL_ATMEL_CONSOLE=y
649# CONFIG_SERIAL_ATMEL_TTYAT is not set
650CONFIG_SERIAL_CORE=y
651CONFIG_SERIAL_CORE_CONSOLE=y
652CONFIG_UNIX98_PTYS=y
653CONFIG_LEGACY_PTYS=y
654CONFIG_LEGACY_PTY_COUNT=256
655# CONFIG_IPMI_HANDLER is not set
656CONFIG_HW_RANDOM=y
657# CONFIG_NVRAM is not set
658# CONFIG_R3964 is not set
659# CONFIG_RAW_DRIVER is not set
660# CONFIG_TCG_TPM is not set
661CONFIG_I2C=y
662CONFIG_I2C_BOARDINFO=y
663CONFIG_I2C_CHARDEV=y
664
665#
666# I2C Algorithms
667#
668# CONFIG_I2C_ALGOBIT is not set
669# CONFIG_I2C_ALGOPCF is not set
670# CONFIG_I2C_ALGOPCA is not set
671
672#
673# I2C Hardware Bus support
674#
675# CONFIG_I2C_GPIO is not set
676# CONFIG_I2C_OCORES is not set
677# CONFIG_I2C_PARPORT_LIGHT is not set
678# CONFIG_I2C_SIMTEC is not set
679# CONFIG_I2C_TAOS_EVM is not set
680# CONFIG_I2C_STUB is not set
681# CONFIG_I2C_TINY_USB is not set
682# CONFIG_I2C_PCA is not set
683
684#
685# Miscellaneous I2C Chip support
686#
687# CONFIG_SENSORS_DS1337 is not set
688# CONFIG_SENSORS_DS1374 is not set
689# CONFIG_DS1682 is not set
690# CONFIG_SENSORS_EEPROM is not set
691# CONFIG_SENSORS_PCF8574 is not set
692# CONFIG_SENSORS_PCA9539 is not set
693# CONFIG_SENSORS_PCF8591 is not set
694# CONFIG_SENSORS_MAX6875 is not set
695# CONFIG_SENSORS_TSL2550 is not set
696# CONFIG_I2C_DEBUG_CORE is not set
697# CONFIG_I2C_DEBUG_ALGO is not set
698# CONFIG_I2C_DEBUG_BUS is not set
699# CONFIG_I2C_DEBUG_CHIP is not set
700
701#
702# SPI support
703#
704CONFIG_SPI=y
705# CONFIG_SPI_DEBUG is not set
706CONFIG_SPI_MASTER=y
707
708#
709# SPI Master Controller Drivers
710#
711CONFIG_SPI_ATMEL=y
712# CONFIG_SPI_BITBANG is not set
713
714#
715# SPI Protocol Masters
716#
717# CONFIG_SPI_AT25 is not set
718# CONFIG_SPI_SPIDEV is not set
719# CONFIG_SPI_TLE62X0 is not set
720# CONFIG_W1 is not set
721# CONFIG_POWER_SUPPLY is not set
722# CONFIG_HWMON is not set
723CONFIG_WATCHDOG=y
724CONFIG_WATCHDOG_NOWAYOUT=y
725
726#
727# Watchdog Device Drivers
728#
729# CONFIG_SOFT_WATCHDOG is not set
730# CONFIG_AT91SAM9_WATCHDOG is not set
731
732#
733# USB-based Watchdog Cards
734#
735# CONFIG_USBPCWATCHDOG is not set
736
737#
738# Sonics Silicon Backplane
739#
740CONFIG_SSB_POSSIBLE=y
741# CONFIG_SSB is not set
742
743#
744# Multifunction device drivers
745#
746# CONFIG_MFD_SM501 is not set
747
748#
749# Multimedia devices
750#
751# CONFIG_VIDEO_DEV is not set
752# CONFIG_DVB_CORE is not set
753# CONFIG_DAB is not set
754
755#
756# Graphics support
757#
758# CONFIG_VGASTATE is not set
759# CONFIG_VIDEO_OUTPUT_CONTROL is not set
760# CONFIG_FB is not set
761# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
762
763#
764# Display device support
765#
766# CONFIG_DISPLAY_SUPPORT is not set
767
768#
769# Console display driver support
770#
771# CONFIG_VGA_CONSOLE is not set
772CONFIG_DUMMY_CONSOLE=y
773
774#
775# Sound
776#
777# CONFIG_SOUND is not set
778CONFIG_HID_SUPPORT=y
779CONFIG_HID=y
780# CONFIG_HID_DEBUG is not set
781# CONFIG_HIDRAW is not set
782
783#
784# USB Input Devices
785#
786# CONFIG_USB_HID is not set
787
788#
789# USB HID Boot Protocol drivers
790#
791# CONFIG_USB_KBD is not set
792# CONFIG_USB_MOUSE is not set
793CONFIG_USB_SUPPORT=y
794CONFIG_USB_ARCH_HAS_HCD=y
795CONFIG_USB_ARCH_HAS_OHCI=y
796# CONFIG_USB_ARCH_HAS_EHCI is not set
797CONFIG_USB=y
798# CONFIG_USB_DEBUG is not set
799
800#
801# Miscellaneous USB options
802#
803CONFIG_USB_DEVICEFS=y
804CONFIG_USB_DEVICE_CLASS=y
805# CONFIG_USB_DYNAMIC_MINORS is not set
806# CONFIG_USB_SUSPEND is not set
807# CONFIG_USB_PERSIST is not set
808# CONFIG_USB_OTG is not set
809
810#
811# USB Host Controller Drivers
812#
813# CONFIG_USB_ISP116X_HCD is not set
814CONFIG_USB_OHCI_HCD=y
815# CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set
816# CONFIG_USB_OHCI_BIG_ENDIAN_MMIO is not set
817CONFIG_USB_OHCI_LITTLE_ENDIAN=y
818# CONFIG_USB_SL811_HCD is not set
819# CONFIG_USB_R8A66597_HCD is not set
820
821#
822# USB Device Class drivers
823#
824# CONFIG_USB_ACM is not set
825# CONFIG_USB_PRINTER is not set
826
827#
828# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
829#
830
831#
832# may also be needed; see USB_STORAGE Help for more information
833#
834CONFIG_USB_STORAGE=y
835# CONFIG_USB_STORAGE_DEBUG is not set
836# CONFIG_USB_STORAGE_DATAFAB is not set
837# CONFIG_USB_STORAGE_FREECOM is not set
838# CONFIG_USB_STORAGE_ISD200 is not set
839# CONFIG_USB_STORAGE_DPCM is not set
840# CONFIG_USB_STORAGE_USBAT is not set
841# CONFIG_USB_STORAGE_SDDR09 is not set
842# CONFIG_USB_STORAGE_SDDR55 is not set
843# CONFIG_USB_STORAGE_JUMPSHOT is not set
844# CONFIG_USB_STORAGE_ALAUDA is not set
845# CONFIG_USB_STORAGE_KARMA is not set
846# CONFIG_USB_LIBUSUAL is not set
847
848#
849# USB Imaging devices
850#
851# CONFIG_USB_MDC800 is not set
852# CONFIG_USB_MICROTEK is not set
853CONFIG_USB_MON=y
854
855#
856# USB port drivers
857#
858
859#
860# USB Serial Converter support
861#
862# CONFIG_USB_SERIAL is not set
863
864#
865# USB Miscellaneous drivers
866#
867# CONFIG_USB_EMI62 is not set
868# CONFIG_USB_EMI26 is not set
869# CONFIG_USB_ADUTUX is not set
870# CONFIG_USB_AUERSWALD is not set
871# CONFIG_USB_RIO500 is not set
872# CONFIG_USB_LEGOTOWER is not set
873# CONFIG_USB_LCD is not set
874# CONFIG_USB_BERRY_CHARGE is not set
875# CONFIG_USB_LED is not set
876# CONFIG_USB_CYPRESS_CY7C63 is not set
877# CONFIG_USB_CYTHERM is not set
878# CONFIG_USB_PHIDGET is not set
879# CONFIG_USB_IDMOUSE is not set
880# CONFIG_USB_FTDI_ELAN is not set
881# CONFIG_USB_APPLEDISPLAY is not set
882# CONFIG_USB_LD is not set
883# CONFIG_USB_TRANCEVIBRATOR is not set
884# CONFIG_USB_IOWARRIOR is not set
885# CONFIG_USB_TEST is not set
886
887#
888# USB DSL modem support
889#
890
891#
892# USB Gadget Support
893#
894CONFIG_USB_GADGET=y
895# CONFIG_USB_GADGET_DEBUG is not set
896# CONFIG_USB_GADGET_DEBUG_FILES is not set
897CONFIG_USB_GADGET_SELECTED=y
898# CONFIG_USB_GADGET_AMD5536UDC is not set
899# CONFIG_USB_GADGET_ATMEL_USBA is not set
900# CONFIG_USB_GADGET_FSL_USB2 is not set
901# CONFIG_USB_GADGET_NET2280 is not set
902# CONFIG_USB_GADGET_PXA2XX is not set
903# CONFIG_USB_GADGET_M66592 is not set
904# CONFIG_USB_GADGET_GOKU is not set
905# CONFIG_USB_GADGET_LH7A40X is not set
906# CONFIG_USB_GADGET_OMAP is not set
907# CONFIG_USB_GADGET_S3C2410 is not set
908CONFIG_USB_GADGET_AT91=y
909CONFIG_USB_AT91=y
910# CONFIG_USB_GADGET_DUMMY_HCD is not set
911# CONFIG_USB_GADGET_DUALSPEED is not set
912# CONFIG_USB_ZERO is not set
913CONFIG_USB_ETH=y
914CONFIG_USB_ETH_RNDIS=y
915# CONFIG_USB_GADGETFS is not set
916# CONFIG_USB_FILE_STORAGE is not set
917# CONFIG_USB_G_SERIAL is not set
918# CONFIG_USB_MIDI_GADGET is not set
919CONFIG_MMC=y
920# CONFIG_MMC_DEBUG is not set
921# CONFIG_MMC_UNSAFE_RESUME is not set
922
923#
924# MMC/SD Card Drivers
925#
926CONFIG_MMC_BLOCK=y
927CONFIG_MMC_BLOCK_BOUNCE=y
928# CONFIG_SDIO_UART is not set
929
930#
931# MMC/SD Host Controller Drivers
932#
933CONFIG_MMC_AT91=y
934# CONFIG_MMC_SPI is not set
935CONFIG_NEW_LEDS=y
936CONFIG_LEDS_CLASS=y
937
938#
939# LED drivers
940#
941CONFIG_LEDS_GPIO=y
942
943#
944# LED Triggers
945#
946CONFIG_LEDS_TRIGGERS=y
947# CONFIG_LEDS_TRIGGER_TIMER is not set
948CONFIG_LEDS_TRIGGER_HEARTBEAT=y
949CONFIG_RTC_LIB=y
950CONFIG_RTC_CLASS=y
951CONFIG_RTC_HCTOSYS=y
952CONFIG_RTC_HCTOSYS_DEVICE="rtc0"
953# CONFIG_RTC_DEBUG is not set
954
955#
956# RTC interfaces
957#
958CONFIG_RTC_INTF_SYSFS=y
959CONFIG_RTC_INTF_PROC=y
960CONFIG_RTC_INTF_DEV=y
961# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set
962# CONFIG_RTC_DRV_TEST is not set
963
964#
965# I2C RTC drivers
966#
967# CONFIG_RTC_DRV_DS1307 is not set
968# CONFIG_RTC_DRV_DS1374 is not set
969# CONFIG_RTC_DRV_DS1672 is not set
970# CONFIG_RTC_DRV_MAX6900 is not set
971# CONFIG_RTC_DRV_RS5C372 is not set
972# CONFIG_RTC_DRV_ISL1208 is not set
973# CONFIG_RTC_DRV_X1205 is not set
974# CONFIG_RTC_DRV_PCF8563 is not set
975# CONFIG_RTC_DRV_PCF8583 is not set
976# CONFIG_RTC_DRV_M41T80 is not set
977
978#
979# SPI RTC drivers
980#
981# CONFIG_RTC_DRV_RS5C348 is not set
982# CONFIG_RTC_DRV_MAX6902 is not set
983CONFIG_RTC_DRV_M41T94=y
984
985#
986# Platform RTC drivers
987#
988# CONFIG_RTC_DRV_CMOS is not set
989# CONFIG_RTC_DRV_DS1553 is not set
990# CONFIG_RTC_DRV_STK17TA8 is not set
991# CONFIG_RTC_DRV_DS1742 is not set
992# CONFIG_RTC_DRV_M48T86 is not set
993# CONFIG_RTC_DRV_M48T59 is not set
994# CONFIG_RTC_DRV_V3020 is not set
995
996#
997# on-CPU RTC drivers
998#
999# CONFIG_RTC_DRV_AT91SAM9 is not set
1000
1001#
1002# File systems
1003#
1004CONFIG_EXT2_FS=y
1005# CONFIG_EXT2_FS_XATTR is not set
1006# CONFIG_EXT2_FS_XIP is not set
1007# CONFIG_EXT3_FS is not set
1008# CONFIG_EXT4DEV_FS is not set
1009# CONFIG_REISERFS_FS is not set
1010# CONFIG_JFS_FS is not set
1011CONFIG_FS_POSIX_ACL=y
1012# CONFIG_XFS_FS is not set
1013# CONFIG_GFS2_FS is not set
1014# CONFIG_OCFS2_FS is not set
1015# CONFIG_MINIX_FS is not set
1016# CONFIG_ROMFS_FS is not set
1017CONFIG_INOTIFY=y
1018CONFIG_INOTIFY_USER=y
1019# CONFIG_QUOTA is not set
1020CONFIG_DNOTIFY=y
1021# CONFIG_AUTOFS_FS is not set
1022# CONFIG_AUTOFS4_FS is not set
1023CONFIG_FUSE_FS=m
1024
1025#
1026# CD-ROM/DVD Filesystems
1027#
1028# CONFIG_ISO9660_FS is not set
1029# CONFIG_UDF_FS is not set
1030
1031#
1032# DOS/FAT/NT Filesystems
1033#
1034CONFIG_FAT_FS=y
1035# CONFIG_MSDOS_FS is not set
1036CONFIG_VFAT_FS=y
1037CONFIG_FAT_DEFAULT_CODEPAGE=437
1038CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
1039# CONFIG_NTFS_FS is not set
1040
1041#
1042# Pseudo filesystems
1043#
1044CONFIG_PROC_FS=y
1045CONFIG_PROC_SYSCTL=y
1046CONFIG_SYSFS=y
1047CONFIG_TMPFS=y
1048# CONFIG_TMPFS_POSIX_ACL is not set
1049# CONFIG_HUGETLB_PAGE is not set
1050# CONFIG_CONFIGFS_FS is not set
1051
1052#
1053# Miscellaneous filesystems
1054#
1055# CONFIG_ADFS_FS is not set
1056# CONFIG_AFFS_FS is not set
1057# CONFIG_HFS_FS is not set
1058# CONFIG_HFSPLUS_FS is not set
1059# CONFIG_BEFS_FS is not set
1060# CONFIG_BFS_FS is not set
1061# CONFIG_EFS_FS is not set
1062CONFIG_JFFS2_FS=y
1063CONFIG_JFFS2_FS_DEBUG=0
1064CONFIG_JFFS2_FS_WRITEBUFFER=y
1065# CONFIG_JFFS2_FS_WBUF_VERIFY is not set
1066# CONFIG_JFFS2_SUMMARY is not set
1067# CONFIG_JFFS2_FS_XATTR is not set
1068# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set
1069CONFIG_JFFS2_ZLIB=y
1070# CONFIG_JFFS2_LZO is not set
1071CONFIG_JFFS2_RTIME=y
1072# CONFIG_JFFS2_RUBIN is not set
1073# CONFIG_CRAMFS is not set
1074# CONFIG_VXFS_FS is not set
1075# CONFIG_HPFS_FS is not set
1076# CONFIG_QNX4FS_FS is not set
1077# CONFIG_SYSV_FS is not set
1078# CONFIG_UFS_FS is not set
1079CONFIG_NETWORK_FILESYSTEMS=y
1080CONFIG_NFS_FS=y
1081CONFIG_NFS_V3=y
1082CONFIG_NFS_V3_ACL=y
1083CONFIG_NFS_V4=y
1084# CONFIG_NFS_DIRECTIO is not set
1085# CONFIG_NFSD is not set
1086CONFIG_ROOT_NFS=y
1087CONFIG_LOCKD=y
1088CONFIG_LOCKD_V4=y
1089CONFIG_NFS_ACL_SUPPORT=y
1090CONFIG_NFS_COMMON=y
1091CONFIG_SUNRPC=y
1092CONFIG_SUNRPC_GSS=y
1093# CONFIG_SUNRPC_BIND34 is not set
1094CONFIG_RPCSEC_GSS_KRB5=y
1095# CONFIG_RPCSEC_GSS_SPKM3 is not set
1096# CONFIG_SMB_FS is not set
1097# CONFIG_CIFS is not set
1098# CONFIG_NCP_FS is not set
1099# CONFIG_CODA_FS is not set
1100# CONFIG_AFS_FS is not set
1101
1102#
1103# Partition Types
1104#
1105# CONFIG_PARTITION_ADVANCED is not set
1106CONFIG_MSDOS_PARTITION=y
1107CONFIG_NLS=y
1108CONFIG_NLS_DEFAULT="iso8859-1"
1109CONFIG_NLS_CODEPAGE_437=y
1110# CONFIG_NLS_CODEPAGE_737 is not set
1111# CONFIG_NLS_CODEPAGE_775 is not set
1112CONFIG_NLS_CODEPAGE_850=y
1113# CONFIG_NLS_CODEPAGE_852 is not set
1114# CONFIG_NLS_CODEPAGE_855 is not set
1115# CONFIG_NLS_CODEPAGE_857 is not set
1116# CONFIG_NLS_CODEPAGE_860 is not set
1117# CONFIG_NLS_CODEPAGE_861 is not set
1118# CONFIG_NLS_CODEPAGE_862 is not set
1119# CONFIG_NLS_CODEPAGE_863 is not set
1120# CONFIG_NLS_CODEPAGE_864 is not set
1121# CONFIG_NLS_CODEPAGE_865 is not set
1122# CONFIG_NLS_CODEPAGE_866 is not set
1123# CONFIG_NLS_CODEPAGE_869 is not set
1124# CONFIG_NLS_CODEPAGE_936 is not set
1125# CONFIG_NLS_CODEPAGE_950 is not set
1126# CONFIG_NLS_CODEPAGE_932 is not set
1127# CONFIG_NLS_CODEPAGE_949 is not set
1128# CONFIG_NLS_CODEPAGE_874 is not set
1129# CONFIG_NLS_ISO8859_8 is not set
1130# CONFIG_NLS_CODEPAGE_1250 is not set
1131# CONFIG_NLS_CODEPAGE_1251 is not set
1132# CONFIG_NLS_ASCII is not set
1133CONFIG_NLS_ISO8859_1=y
1134# CONFIG_NLS_ISO8859_2 is not set
1135# CONFIG_NLS_ISO8859_3 is not set
1136# CONFIG_NLS_ISO8859_4 is not set
1137# CONFIG_NLS_ISO8859_5 is not set
1138# CONFIG_NLS_ISO8859_6 is not set
1139# CONFIG_NLS_ISO8859_7 is not set
1140# CONFIG_NLS_ISO8859_9 is not set
1141# CONFIG_NLS_ISO8859_13 is not set
1142# CONFIG_NLS_ISO8859_14 is not set
1143# CONFIG_NLS_ISO8859_15 is not set
1144# CONFIG_NLS_KOI8_R is not set
1145# CONFIG_NLS_KOI8_U is not set
1146# CONFIG_NLS_UTF8 is not set
1147# CONFIG_DLM is not set
1148# CONFIG_INSTRUMENTATION is not set
1149
1150#
1151# Kernel hacking
1152#
1153# CONFIG_PRINTK_TIME is not set
1154CONFIG_ENABLE_WARN_DEPRECATED=y
1155CONFIG_ENABLE_MUST_CHECK=y
1156# CONFIG_MAGIC_SYSRQ is not set
1157# CONFIG_UNUSED_SYMBOLS is not set
1158# CONFIG_DEBUG_FS is not set
1159# CONFIG_HEADERS_CHECK is not set
1160CONFIG_DEBUG_KERNEL=y
1161# CONFIG_DEBUG_SHIRQ is not set
1162CONFIG_DETECT_SOFTLOCKUP=y
1163CONFIG_SCHED_DEBUG=y
1164# CONFIG_SCHEDSTATS is not set
1165# CONFIG_TIMER_STATS is not set
1166# CONFIG_DEBUG_SLAB is not set
1167# CONFIG_DEBUG_RT_MUTEXES is not set
1168# CONFIG_RT_MUTEX_TESTER is not set
1169# CONFIG_DEBUG_SPINLOCK is not set
1170# CONFIG_DEBUG_MUTEXES is not set
1171# CONFIG_DEBUG_LOCK_ALLOC is not set
1172# CONFIG_PROVE_LOCKING is not set
1173# CONFIG_LOCK_STAT is not set
1174# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
1175# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
1176# CONFIG_DEBUG_KOBJECT is not set
1177CONFIG_DEBUG_BUGVERBOSE=y
1178# CONFIG_DEBUG_INFO is not set
1179# CONFIG_DEBUG_VM is not set
1180# CONFIG_DEBUG_LIST is not set
1181# CONFIG_DEBUG_SG is not set
1182CONFIG_FRAME_POINTER=y
1183CONFIG_FORCED_INLINING=y
1184# CONFIG_BOOT_PRINTK_DELAY is not set
1185# CONFIG_RCU_TORTURE_TEST is not set
1186# CONFIG_FAULT_INJECTION is not set
1187# CONFIG_SAMPLES is not set
1188CONFIG_DEBUG_USER=y
1189# CONFIG_DEBUG_ERRORS is not set
1190CONFIG_DEBUG_LL=y
1191# CONFIG_DEBUG_ICEDCC is not set
1192
1193#
1194# Security options
1195#
1196# CONFIG_KEYS is not set
1197# CONFIG_SECURITY is not set
1198# CONFIG_SECURITY_FILE_CAPABILITIES is not set
1199CONFIG_CRYPTO=y
1200CONFIG_CRYPTO_ALGAPI=y
1201CONFIG_CRYPTO_BLKCIPHER=y
1202CONFIG_CRYPTO_MANAGER=y
1203# CONFIG_CRYPTO_HMAC is not set
1204# CONFIG_CRYPTO_XCBC is not set
1205# CONFIG_CRYPTO_NULL is not set
1206# CONFIG_CRYPTO_MD4 is not set
1207CONFIG_CRYPTO_MD5=y
1208# CONFIG_CRYPTO_SHA1 is not set
1209# CONFIG_CRYPTO_SHA256 is not set
1210# CONFIG_CRYPTO_SHA512 is not set
1211# CONFIG_CRYPTO_WP512 is not set
1212# CONFIG_CRYPTO_TGR192 is not set
1213# CONFIG_CRYPTO_GF128MUL is not set
1214# CONFIG_CRYPTO_ECB is not set
1215CONFIG_CRYPTO_CBC=y
1216# CONFIG_CRYPTO_PCBC is not set
1217# CONFIG_CRYPTO_LRW is not set
1218# CONFIG_CRYPTO_XTS is not set
1219# CONFIG_CRYPTO_CRYPTD is not set
1220CONFIG_CRYPTO_DES=y
1221# CONFIG_CRYPTO_FCRYPT is not set
1222# CONFIG_CRYPTO_BLOWFISH is not set
1223# CONFIG_CRYPTO_TWOFISH is not set
1224# CONFIG_CRYPTO_SERPENT is not set
1225# CONFIG_CRYPTO_AES is not set
1226# CONFIG_CRYPTO_CAST5 is not set
1227# CONFIG_CRYPTO_CAST6 is not set
1228# CONFIG_CRYPTO_TEA is not set
1229# CONFIG_CRYPTO_ARC4 is not set
1230# CONFIG_CRYPTO_KHAZAD is not set
1231# CONFIG_CRYPTO_ANUBIS is not set
1232# CONFIG_CRYPTO_SEED is not set
1233# CONFIG_CRYPTO_DEFLATE is not set
1234# CONFIG_CRYPTO_MICHAEL_MIC is not set
1235# CONFIG_CRYPTO_CRC32C is not set
1236# CONFIG_CRYPTO_CAMELLIA is not set
1237# CONFIG_CRYPTO_TEST is not set
1238# CONFIG_CRYPTO_AUTHENC is not set
1239# CONFIG_CRYPTO_HW is not set
1240
1241#
1242# Library routines
1243#
1244CONFIG_BITREVERSE=y
1245# CONFIG_CRC_CCITT is not set
1246# CONFIG_CRC16 is not set
1247# CONFIG_CRC_ITU_T is not set
1248CONFIG_CRC32=y
1249# CONFIG_CRC7 is not set
1250# CONFIG_LIBCRC32C is not set
1251CONFIG_ZLIB_INFLATE=y
1252CONFIG_ZLIB_DEFLATE=y
1253CONFIG_PLIST=y
1254CONFIG_HAS_IOMEM=y
1255CONFIG_HAS_IOPORT=y
1256CONFIG_HAS_DMA=y
diff --git a/arch/arm/configs/realview-smp_defconfig b/arch/arm/configs/realview-smp_defconfig
index fc39ba1a89f3..0c09b23167ec 100644
--- a/arch/arm/configs/realview-smp_defconfig
+++ b/arch/arm/configs/realview-smp_defconfig
@@ -177,7 +177,6 @@ CONFIG_NR_CPUS=4
177CONFIG_HOTPLUG_CPU=y 177CONFIG_HOTPLUG_CPU=y
178CONFIG_LOCAL_TIMERS=y 178CONFIG_LOCAL_TIMERS=y
179# CONFIG_PREEMPT is not set 179# CONFIG_PREEMPT is not set
180# CONFIG_NO_IDLE_HZ is not set
181CONFIG_HZ=100 180CONFIG_HZ=100
182# CONFIG_AEABI is not set 181# CONFIG_AEABI is not set
183# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set 182# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set
diff --git a/arch/arm/configs/realview_defconfig b/arch/arm/configs/realview_defconfig
index accbf529ce5b..907e54344dad 100644
--- a/arch/arm/configs/realview_defconfig
+++ b/arch/arm/configs/realview_defconfig
@@ -126,7 +126,6 @@ CONFIG_ISA_DMA_API=y
126# 126#
127# Kernel Features 127# Kernel Features
128# 128#
129# CONFIG_NO_IDLE_HZ is not set
130# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set 129# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set
131CONFIG_FLATMEM=y 130CONFIG_FLATMEM=y
132CONFIG_FLAT_NODE_MEM_MAP=y 131CONFIG_FLAT_NODE_MEM_MAP=y
diff --git a/arch/arm/configs/rpc_defconfig b/arch/arm/configs/rpc_defconfig
index 5ddecb9ddf01..f62d1817d2c6 100644
--- a/arch/arm/configs/rpc_defconfig
+++ b/arch/arm/configs/rpc_defconfig
@@ -190,7 +190,6 @@ CONFIG_ISA_DMA_API=y
190# 190#
191# CONFIG_TICK_ONESHOT is not set 191# CONFIG_TICK_ONESHOT is not set
192# CONFIG_PREEMPT is not set 192# CONFIG_PREEMPT is not set
193# CONFIG_NO_IDLE_HZ is not set
194CONFIG_HZ=100 193CONFIG_HZ=100
195# CONFIG_AEABI is not set 194# CONFIG_AEABI is not set
196# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set 195# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set
diff --git a/arch/arm/configs/s3c2410_defconfig b/arch/arm/configs/s3c2410_defconfig
index f8a1645b3d4a..35faaea8623e 100644
--- a/arch/arm/configs/s3c2410_defconfig
+++ b/arch/arm/configs/s3c2410_defconfig
@@ -1,15 +1,18 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.21-rc6 3# Linux kernel version: 2.6.26-rc8
4# Mon Apr 9 10:12:58 2007 4# Mon Jul 7 16:59:23 2008
5# 5#
6CONFIG_ARM=y 6CONFIG_ARM=y
7CONFIG_SYS_SUPPORTS_APM_EMULATION=y 7CONFIG_SYS_SUPPORTS_APM_EMULATION=y
8CONFIG_GENERIC_GPIO=y 8CONFIG_GENERIC_GPIO=y
9# CONFIG_GENERIC_TIME is not set 9# CONFIG_GENERIC_TIME is not set
10# CONFIG_GENERIC_CLOCKEVENTS is not set
10CONFIG_MMU=y 11CONFIG_MMU=y
11CONFIG_NO_IOPORT=y 12CONFIG_NO_IOPORT=y
12CONFIG_GENERIC_HARDIRQS=y 13CONFIG_GENERIC_HARDIRQS=y
14CONFIG_STACKTRACE_SUPPORT=y
15CONFIG_LOCKDEP_SUPPORT=y
13CONFIG_TRACE_IRQFLAGS_SUPPORT=y 16CONFIG_TRACE_IRQFLAGS_SUPPORT=y
14CONFIG_HARDIRQS_SW_RESEND=y 17CONFIG_HARDIRQS_SW_RESEND=y
15CONFIG_GENERIC_IRQ_PROBE=y 18CONFIG_GENERIC_IRQ_PROBE=y
@@ -18,34 +21,39 @@ CONFIG_RWSEM_GENERIC_SPINLOCK=y
18# CONFIG_ARCH_HAS_ILOG2_U64 is not set 21# CONFIG_ARCH_HAS_ILOG2_U64 is not set
19CONFIG_GENERIC_HWEIGHT=y 22CONFIG_GENERIC_HWEIGHT=y
20CONFIG_GENERIC_CALIBRATE_DELAY=y 23CONFIG_GENERIC_CALIBRATE_DELAY=y
24CONFIG_ARCH_SUPPORTS_AOUT=y
21CONFIG_ZONE_DMA=y 25CONFIG_ZONE_DMA=y
22CONFIG_VECTORS_BASE=0xffff0000 26CONFIG_VECTORS_BASE=0xffff0000
23CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 27CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
24 28
25# 29#
26# Code maturity level options 30# General setup
27# 31#
28CONFIG_EXPERIMENTAL=y 32CONFIG_EXPERIMENTAL=y
29CONFIG_BROKEN_ON_SMP=y 33CONFIG_BROKEN_ON_SMP=y
30CONFIG_INIT_ENV_ARG_LIMIT=32 34CONFIG_INIT_ENV_ARG_LIMIT=32
31
32#
33# General setup
34#
35CONFIG_LOCALVERSION="" 35CONFIG_LOCALVERSION=""
36CONFIG_LOCALVERSION_AUTO=y 36CONFIG_LOCALVERSION_AUTO=y
37CONFIG_SWAP=y 37CONFIG_SWAP=y
38CONFIG_SYSVIPC=y 38CONFIG_SYSVIPC=y
39# CONFIG_IPC_NS is not set
40CONFIG_SYSVIPC_SYSCTL=y 39CONFIG_SYSVIPC_SYSCTL=y
41# CONFIG_POSIX_MQUEUE is not set 40# CONFIG_POSIX_MQUEUE is not set
42# CONFIG_BSD_PROCESS_ACCT is not set 41# CONFIG_BSD_PROCESS_ACCT is not set
43# CONFIG_TASKSTATS is not set 42# CONFIG_TASKSTATS is not set
44# CONFIG_UTS_NS is not set
45# CONFIG_AUDIT is not set 43# CONFIG_AUDIT is not set
46# CONFIG_IKCONFIG is not set 44CONFIG_IKCONFIG=m
45CONFIG_IKCONFIG_PROC=y
46CONFIG_LOG_BUF_SHIFT=16
47# CONFIG_CGROUPS is not set
48# CONFIG_GROUP_SCHED is not set
47CONFIG_SYSFS_DEPRECATED=y 49CONFIG_SYSFS_DEPRECATED=y
50CONFIG_SYSFS_DEPRECATED_V2=y
48# CONFIG_RELAY is not set 51# CONFIG_RELAY is not set
52CONFIG_NAMESPACES=y
53# CONFIG_UTS_NS is not set
54# CONFIG_IPC_NS is not set
55# CONFIG_USER_NS is not set
56# CONFIG_PID_NS is not set
49CONFIG_BLK_DEV_INITRD=y 57CONFIG_BLK_DEV_INITRD=y
50CONFIG_INITRAMFS_SOURCE="" 58CONFIG_INITRAMFS_SOURCE=""
51CONFIG_CC_OPTIMIZE_FOR_SIZE=y 59CONFIG_CC_OPTIMIZE_FOR_SIZE=y
@@ -53,6 +61,7 @@ CONFIG_SYSCTL=y
53# CONFIG_EMBEDDED is not set 61# CONFIG_EMBEDDED is not set
54CONFIG_UID16=y 62CONFIG_UID16=y
55CONFIG_SYSCTL_SYSCALL=y 63CONFIG_SYSCTL_SYSCALL=y
64CONFIG_SYSCTL_SYSCALL_CHECK=y
56CONFIG_KALLSYMS=y 65CONFIG_KALLSYMS=y
57# CONFIG_KALLSYMS_ALL is not set 66# CONFIG_KALLSYMS_ALL is not set
58# CONFIG_KALLSYMS_EXTRA_PASS is not set 67# CONFIG_KALLSYMS_EXTRA_PASS is not set
@@ -60,34 +69,43 @@ CONFIG_HOTPLUG=y
60CONFIG_PRINTK=y 69CONFIG_PRINTK=y
61CONFIG_BUG=y 70CONFIG_BUG=y
62CONFIG_ELF_CORE=y 71CONFIG_ELF_CORE=y
72CONFIG_COMPAT_BRK=y
63CONFIG_BASE_FULL=y 73CONFIG_BASE_FULL=y
64CONFIG_FUTEX=y 74CONFIG_FUTEX=y
75CONFIG_ANON_INODES=y
65CONFIG_EPOLL=y 76CONFIG_EPOLL=y
77CONFIG_SIGNALFD=y
78CONFIG_TIMERFD=y
79CONFIG_EVENTFD=y
66CONFIG_SHMEM=y 80CONFIG_SHMEM=y
67CONFIG_SLAB=y
68CONFIG_VM_EVENT_COUNTERS=y 81CONFIG_VM_EVENT_COUNTERS=y
82CONFIG_SLAB=y
83# CONFIG_SLUB is not set
84# CONFIG_SLOB is not set
85# CONFIG_PROFILING is not set
86# CONFIG_MARKERS is not set
87CONFIG_HAVE_OPROFILE=y
88# CONFIG_KPROBES is not set
89CONFIG_HAVE_KPROBES=y
90CONFIG_HAVE_KRETPROBES=y
91# CONFIG_HAVE_DMA_ATTRS is not set
92CONFIG_PROC_PAGE_MONITOR=y
93CONFIG_SLABINFO=y
69CONFIG_RT_MUTEXES=y 94CONFIG_RT_MUTEXES=y
70# CONFIG_TINY_SHMEM is not set 95# CONFIG_TINY_SHMEM is not set
71CONFIG_BASE_SMALL=0 96CONFIG_BASE_SMALL=0
72# CONFIG_SLOB is not set
73
74#
75# Loadable module support
76#
77CONFIG_MODULES=y 97CONFIG_MODULES=y
98# CONFIG_MODULE_FORCE_LOAD is not set
78CONFIG_MODULE_UNLOAD=y 99CONFIG_MODULE_UNLOAD=y
79# CONFIG_MODULE_FORCE_UNLOAD is not set 100# CONFIG_MODULE_FORCE_UNLOAD is not set
80# CONFIG_MODVERSIONS is not set 101# CONFIG_MODVERSIONS is not set
81# CONFIG_MODULE_SRCVERSION_ALL is not set 102# CONFIG_MODULE_SRCVERSION_ALL is not set
82CONFIG_KMOD=y 103CONFIG_KMOD=y
83
84#
85# Block layer
86#
87CONFIG_BLOCK=y 104CONFIG_BLOCK=y
88# CONFIG_LBD is not set 105# CONFIG_LBD is not set
89# CONFIG_BLK_DEV_IO_TRACE is not set 106# CONFIG_BLK_DEV_IO_TRACE is not set
90# CONFIG_LSF is not set 107# CONFIG_LSF is not set
108# CONFIG_BLK_DEV_BSG is not set
91 109
92# 110#
93# IO Schedulers 111# IO Schedulers
@@ -101,6 +119,7 @@ CONFIG_DEFAULT_AS=y
101# CONFIG_DEFAULT_CFQ is not set 119# CONFIG_DEFAULT_CFQ is not set
102# CONFIG_DEFAULT_NOOP is not set 120# CONFIG_DEFAULT_NOOP is not set
103CONFIG_DEFAULT_IOSCHED="anticipatory" 121CONFIG_DEFAULT_IOSCHED="anticipatory"
122CONFIG_CLASSIC_RCU=y
104 123
105# 124#
106# System Type 125# System Type
@@ -119,14 +138,17 @@ CONFIG_DEFAULT_IOSCHED="anticipatory"
119# CONFIG_ARCH_NETX is not set 138# CONFIG_ARCH_NETX is not set
120# CONFIG_ARCH_H720X is not set 139# CONFIG_ARCH_H720X is not set
121# CONFIG_ARCH_IMX is not set 140# CONFIG_ARCH_IMX is not set
141# CONFIG_ARCH_IOP13XX is not set
122# CONFIG_ARCH_IOP32X is not set 142# CONFIG_ARCH_IOP32X is not set
123# CONFIG_ARCH_IOP33X is not set 143# CONFIG_ARCH_IOP33X is not set
124# CONFIG_ARCH_IOP13XX is not set
125# CONFIG_ARCH_IXP4XX is not set
126# CONFIG_ARCH_IXP2000 is not set
127# CONFIG_ARCH_IXP23XX is not set 144# CONFIG_ARCH_IXP23XX is not set
145# CONFIG_ARCH_IXP2000 is not set
146# CONFIG_ARCH_IXP4XX is not set
128# CONFIG_ARCH_L7200 is not set 147# CONFIG_ARCH_L7200 is not set
148# CONFIG_ARCH_KS8695 is not set
129# CONFIG_ARCH_NS9XXX is not set 149# CONFIG_ARCH_NS9XXX is not set
150# CONFIG_ARCH_MXC is not set
151# CONFIG_ARCH_ORION5X is not set
130# CONFIG_ARCH_PNX4008 is not set 152# CONFIG_ARCH_PNX4008 is not set
131# CONFIG_ARCH_PXA is not set 153# CONFIG_ARCH_PXA is not set
132# CONFIG_ARCH_RPC is not set 154# CONFIG_ARCH_RPC is not set
@@ -134,18 +156,32 @@ CONFIG_DEFAULT_IOSCHED="anticipatory"
134CONFIG_ARCH_S3C2410=y 156CONFIG_ARCH_S3C2410=y
135# CONFIG_ARCH_SHARK is not set 157# CONFIG_ARCH_SHARK is not set
136# CONFIG_ARCH_LH7A40X is not set 158# CONFIG_ARCH_LH7A40X is not set
159# CONFIG_ARCH_DAVINCI is not set
137# CONFIG_ARCH_OMAP is not set 160# CONFIG_ARCH_OMAP is not set
161# CONFIG_ARCH_MSM7X00A is not set
138CONFIG_PLAT_S3C24XX=y 162CONFIG_PLAT_S3C24XX=y
139CONFIG_CPU_S3C244X=y 163CONFIG_CPU_S3C244X=y
164# CONFIG_S3C24XX_PWM is not set
140CONFIG_PM_SIMTEC=y 165CONFIG_PM_SIMTEC=y
166CONFIG_S3C2410_DMA=y
167# CONFIG_S3C2410_DMA_DEBUG is not set
168CONFIG_MACH_SMDK=y
169CONFIG_PLAT_S3C=y
170CONFIG_CPU_LLSERIAL_S3C2410=y
171CONFIG_CPU_LLSERIAL_S3C2440=y
172
173#
174# Boot options
175#
141# CONFIG_S3C_BOOT_WATCHDOG is not set 176# CONFIG_S3C_BOOT_WATCHDOG is not set
142# CONFIG_S3C_BOOT_ERROR_RESET is not set 177# CONFIG_S3C_BOOT_ERROR_RESET is not set
178
179#
180# Power management
181#
143# CONFIG_S3C2410_PM_DEBUG is not set 182# CONFIG_S3C2410_PM_DEBUG is not set
144# CONFIG_S3C2410_PM_CHECK is not set 183# CONFIG_S3C2410_PM_CHECK is not set
145CONFIG_S3C_LOWLEVEL_UART_PORT=0 184CONFIG_S3C_LOWLEVEL_UART_PORT=0
146CONFIG_S3C2410_DMA=y
147# CONFIG_S3C2410_DMA_DEBUG is not set
148CONFIG_MACH_SMDK=y
149 185
150# 186#
151# S3C2400 Machines 187# S3C2400 Machines
@@ -155,6 +191,8 @@ CONFIG_CPU_S3C2410_DMA=y
155CONFIG_S3C2410_PM=y 191CONFIG_S3C2410_PM=y
156CONFIG_S3C2410_GPIO=y 192CONFIG_S3C2410_GPIO=y
157CONFIG_S3C2410_CLOCK=y 193CONFIG_S3C2410_CLOCK=y
194CONFIG_SIMTEC_NOR=y
195CONFIG_MACH_BAST_IDE=y
158 196
159# 197#
160# S3C2410 Machines 198# S3C2410 Machines
@@ -167,6 +205,7 @@ CONFIG_ARCH_BAST=y
167CONFIG_MACH_OTOM=y 205CONFIG_MACH_OTOM=y
168CONFIG_MACH_AML_M5900=y 206CONFIG_MACH_AML_M5900=y
169CONFIG_BAST_PC104_IRQ=y 207CONFIG_BAST_PC104_IRQ=y
208# CONFIG_MACH_TCT_HAMMER is not set
170CONFIG_MACH_VR1000=y 209CONFIG_MACH_VR1000=y
171CONFIG_MACH_QT2410=y 210CONFIG_MACH_QT2410=y
172CONFIG_CPU_S3C2412=y 211CONFIG_CPU_S3C2412=y
@@ -176,8 +215,10 @@ CONFIG_S3C2412_PM=y
176# 215#
177# S3C2412 Machines 216# S3C2412 Machines
178# 217#
218# CONFIG_MACH_JIVE is not set
179CONFIG_MACH_SMDK2413=y 219CONFIG_MACH_SMDK2413=y
180CONFIG_MACH_S3C2413=y 220CONFIG_MACH_S3C2413=y
221# CONFIG_MACH_SMDK2412 is not set
181CONFIG_MACH_VSTMS=y 222CONFIG_MACH_VSTMS=y
182CONFIG_CPU_S3C2440=y 223CONFIG_CPU_S3C2440=y
183CONFIG_S3C2440_DMA=y 224CONFIG_S3C2440_DMA=y
@@ -191,6 +232,7 @@ CONFIG_MACH_RX3715=y
191CONFIG_ARCH_S3C2440=y 232CONFIG_ARCH_S3C2440=y
192CONFIG_MACH_NEXCODER_2440=y 233CONFIG_MACH_NEXCODER_2440=y
193CONFIG_SMDK2440_CPU2440=y 234CONFIG_SMDK2440_CPU2440=y
235# CONFIG_MACH_AT2440EVB is not set
194CONFIG_CPU_S3C2442=y 236CONFIG_CPU_S3C2442=y
195 237
196# 238#
@@ -215,6 +257,7 @@ CONFIG_CPU_32v4T=y
215CONFIG_CPU_32v5=y 257CONFIG_CPU_32v5=y
216CONFIG_CPU_ABRT_EV4T=y 258CONFIG_CPU_ABRT_EV4T=y
217CONFIG_CPU_ABRT_EV5TJ=y 259CONFIG_CPU_ABRT_EV5TJ=y
260CONFIG_CPU_PABRT_NOIFAR=y
218CONFIG_CPU_CACHE_V4WT=y 261CONFIG_CPU_CACHE_V4WT=y
219CONFIG_CPU_CACHE_VIVT=y 262CONFIG_CPU_CACHE_VIVT=y
220CONFIG_CPU_COPY_V4WB=y 263CONFIG_CPU_COPY_V4WB=y
@@ -236,17 +279,15 @@ CONFIG_CPU_CP15_MMU=y
236# Bus support 279# Bus support
237# 280#
238CONFIG_ISA=y 281CONFIG_ISA=y
239 282# CONFIG_PCI_SYSCALL is not set
240# 283# CONFIG_ARCH_SUPPORTS_MSI is not set
241# PCCARD (PCMCIA/CardBus) support
242#
243# CONFIG_PCCARD is not set 284# CONFIG_PCCARD is not set
244 285
245# 286#
246# Kernel Features 287# Kernel Features
247# 288#
289# CONFIG_TICK_ONESHOT is not set
248# CONFIG_PREEMPT is not set 290# CONFIG_PREEMPT is not set
249# CONFIG_NO_IDLE_HZ is not set
250CONFIG_HZ=200 291CONFIG_HZ=200
251# CONFIG_AEABI is not set 292# CONFIG_AEABI is not set
252# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set 293# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set
@@ -257,9 +298,13 @@ CONFIG_FLATMEM_MANUAL=y
257CONFIG_FLATMEM=y 298CONFIG_FLATMEM=y
258CONFIG_FLAT_NODE_MEM_MAP=y 299CONFIG_FLAT_NODE_MEM_MAP=y
259# CONFIG_SPARSEMEM_STATIC is not set 300# CONFIG_SPARSEMEM_STATIC is not set
301# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
302CONFIG_PAGEFLAGS_EXTENDED=y
260CONFIG_SPLIT_PTLOCK_CPUS=4096 303CONFIG_SPLIT_PTLOCK_CPUS=4096
261# CONFIG_RESOURCES_64BIT is not set 304# CONFIG_RESOURCES_64BIT is not set
262CONFIG_ZONE_DMA_FLAG=1 305CONFIG_ZONE_DMA_FLAG=1
306CONFIG_BOUNCE=y
307CONFIG_VIRT_TO_BUS=y
263CONFIG_ALIGNMENT_TRAP=y 308CONFIG_ALIGNMENT_TRAP=y
264 309
265# 310#
@@ -279,7 +324,7 @@ CONFIG_CMDLINE="root=/dev/hda1 ro init=/bin/bash console=ttySAC0"
279# At least one emulation must be selected 324# At least one emulation must be selected
280# 325#
281CONFIG_FPE_NWFPE=y 326CONFIG_FPE_NWFPE=y
282# CONFIG_FPE_NWFPE_XP is not set 327CONFIG_FPE_NWFPE_XP=y
283# CONFIG_FPE_FASTFPE is not set 328# CONFIG_FPE_FASTFPE is not set
284# CONFIG_VFP is not set 329# CONFIG_VFP is not set
285 330
@@ -295,10 +340,12 @@ CONFIG_BINFMT_AOUT=y
295# Power management options 340# Power management options
296# 341#
297CONFIG_PM=y 342CONFIG_PM=y
298# CONFIG_PM_LEGACY is not set
299# CONFIG_PM_DEBUG is not set 343# CONFIG_PM_DEBUG is not set
300# CONFIG_PM_SYSFS_DEPRECATED is not set 344CONFIG_PM_SLEEP=y
301# CONFIG_APM_EMULATION is not set 345CONFIG_SUSPEND=y
346CONFIG_SUSPEND_FREEZER=y
347CONFIG_APM_EMULATION=m
348CONFIG_ARCH_SUSPEND_POSSIBLE=y
302 349
303# 350#
304# Networking 351# Networking
@@ -308,59 +355,67 @@ CONFIG_NET=y
308# 355#
309# Networking options 356# Networking options
310# 357#
311# CONFIG_NETDEBUG is not set 358CONFIG_PACKET=y
312# CONFIG_PACKET is not set 359# CONFIG_PACKET_MMAP is not set
313CONFIG_UNIX=y 360CONFIG_UNIX=y
314CONFIG_XFRM=y 361CONFIG_XFRM=y
315# CONFIG_XFRM_USER is not set 362# CONFIG_XFRM_USER is not set
316# CONFIG_XFRM_SUB_POLICY is not set 363# CONFIG_XFRM_SUB_POLICY is not set
317# CONFIG_XFRM_MIGRATE is not set 364# CONFIG_XFRM_MIGRATE is not set
365# CONFIG_XFRM_STATISTICS is not set
318# CONFIG_NET_KEY is not set 366# CONFIG_NET_KEY is not set
319CONFIG_INET=y 367CONFIG_INET=y
320# CONFIG_IP_MULTICAST is not set 368CONFIG_IP_MULTICAST=y
321# CONFIG_IP_ADVANCED_ROUTER is not set 369# CONFIG_IP_ADVANCED_ROUTER is not set
322CONFIG_IP_FIB_HASH=y 370CONFIG_IP_FIB_HASH=y
323CONFIG_IP_PNP=y 371CONFIG_IP_PNP=y
324# CONFIG_IP_PNP_DHCP is not set 372CONFIG_IP_PNP_DHCP=y
325CONFIG_IP_PNP_BOOTP=y 373CONFIG_IP_PNP_BOOTP=y
326# CONFIG_IP_PNP_RARP is not set 374# CONFIG_IP_PNP_RARP is not set
327# CONFIG_NET_IPIP is not set 375# CONFIG_NET_IPIP is not set
328# CONFIG_NET_IPGRE is not set 376# CONFIG_NET_IPGRE is not set
377# CONFIG_IP_MROUTE is not set
329# CONFIG_ARPD is not set 378# CONFIG_ARPD is not set
330# CONFIG_SYN_COOKIES is not set 379# CONFIG_SYN_COOKIES is not set
331# CONFIG_INET_AH is not set 380# CONFIG_INET_AH is not set
332# CONFIG_INET_ESP is not set 381# CONFIG_INET_ESP is not set
333# CONFIG_INET_IPCOMP is not set 382# CONFIG_INET_IPCOMP is not set
334# CONFIG_INET_XFRM_TUNNEL is not set 383# CONFIG_INET_XFRM_TUNNEL is not set
335# CONFIG_INET_TUNNEL is not set 384CONFIG_INET_TUNNEL=m
336CONFIG_INET_XFRM_MODE_TRANSPORT=y 385CONFIG_INET_XFRM_MODE_TRANSPORT=y
337CONFIG_INET_XFRM_MODE_TUNNEL=y 386CONFIG_INET_XFRM_MODE_TUNNEL=y
338CONFIG_INET_XFRM_MODE_BEET=y 387CONFIG_INET_XFRM_MODE_BEET=y
388# CONFIG_INET_LRO is not set
339CONFIG_INET_DIAG=y 389CONFIG_INET_DIAG=y
340CONFIG_INET_TCP_DIAG=y 390CONFIG_INET_TCP_DIAG=y
341# CONFIG_TCP_CONG_ADVANCED is not set 391# CONFIG_TCP_CONG_ADVANCED is not set
342CONFIG_TCP_CONG_CUBIC=y 392CONFIG_TCP_CONG_CUBIC=y
343CONFIG_DEFAULT_TCP_CONG="cubic" 393CONFIG_DEFAULT_TCP_CONG="cubic"
344# CONFIG_TCP_MD5SIG is not set 394# CONFIG_TCP_MD5SIG is not set
345# CONFIG_IPV6 is not set 395CONFIG_IPV6=m
346# CONFIG_INET6_XFRM_TUNNEL is not set 396CONFIG_IPV6_PRIVACY=y
347# CONFIG_INET6_TUNNEL is not set 397CONFIG_IPV6_ROUTER_PREF=y
398# CONFIG_IPV6_ROUTE_INFO is not set
399# CONFIG_IPV6_OPTIMISTIC_DAD is not set
400CONFIG_INET6_AH=m
401CONFIG_INET6_ESP=m
402CONFIG_INET6_IPCOMP=m
403CONFIG_IPV6_MIP6=m
404CONFIG_INET6_XFRM_TUNNEL=m
405CONFIG_INET6_TUNNEL=m
406CONFIG_INET6_XFRM_MODE_TRANSPORT=m
407CONFIG_INET6_XFRM_MODE_TUNNEL=m
408CONFIG_INET6_XFRM_MODE_BEET=m
409CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION=m
410CONFIG_IPV6_SIT=m
411CONFIG_IPV6_NDISC_NODETYPE=y
412CONFIG_IPV6_TUNNEL=m
413# CONFIG_IPV6_MULTIPLE_TABLES is not set
414# CONFIG_IPV6_MROUTE is not set
348# CONFIG_NETWORK_SECMARK is not set 415# CONFIG_NETWORK_SECMARK is not set
349# CONFIG_NETFILTER is not set 416# CONFIG_NETFILTER is not set
350
351#
352# DCCP Configuration (EXPERIMENTAL)
353#
354# CONFIG_IP_DCCP is not set 417# CONFIG_IP_DCCP is not set
355
356#
357# SCTP Configuration (EXPERIMENTAL)
358#
359# CONFIG_IP_SCTP is not set 418# CONFIG_IP_SCTP is not set
360
361#
362# TIPC Configuration (EXPERIMENTAL)
363#
364# CONFIG_TIPC is not set 419# CONFIG_TIPC is not set
365# CONFIG_ATM is not set 420# CONFIG_ATM is not set
366# CONFIG_BRIDGE is not set 421# CONFIG_BRIDGE is not set
@@ -373,20 +428,71 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
373# CONFIG_LAPB is not set 428# CONFIG_LAPB is not set
374# CONFIG_ECONET is not set 429# CONFIG_ECONET is not set
375# CONFIG_WAN_ROUTER is not set 430# CONFIG_WAN_ROUTER is not set
376
377#
378# QoS and/or fair queueing
379#
380# CONFIG_NET_SCHED is not set 431# CONFIG_NET_SCHED is not set
432CONFIG_NET_SCH_FIFO=y
381 433
382# 434#
383# Network testing 435# Network testing
384# 436#
385# CONFIG_NET_PKTGEN is not set 437# CONFIG_NET_PKTGEN is not set
386# CONFIG_HAMRADIO is not set 438# CONFIG_HAMRADIO is not set
439# CONFIG_CAN is not set
387# CONFIG_IRDA is not set 440# CONFIG_IRDA is not set
388# CONFIG_BT is not set 441CONFIG_BT=m
442CONFIG_BT_L2CAP=m
443CONFIG_BT_SCO=m
444CONFIG_BT_RFCOMM=m
445CONFIG_BT_RFCOMM_TTY=y
446CONFIG_BT_BNEP=m
447CONFIG_BT_BNEP_MC_FILTER=y
448CONFIG_BT_BNEP_PROTO_FILTER=y
449CONFIG_BT_HIDP=m
450
451#
452# Bluetooth device drivers
453#
454CONFIG_BT_HCIUSB=m
455CONFIG_BT_HCIUSB_SCO=y
456CONFIG_BT_HCIUART=m
457CONFIG_BT_HCIUART_H4=y
458CONFIG_BT_HCIUART_BCSP=y
459CONFIG_BT_HCIUART_LL=y
460CONFIG_BT_HCIBCM203X=m
461CONFIG_BT_HCIBPA10X=m
462CONFIG_BT_HCIBFUSB=m
463CONFIG_BT_HCIVHCI=m
464# CONFIG_AF_RXRPC is not set
465
466#
467# Wireless
468#
469CONFIG_CFG80211=m
470CONFIG_NL80211=y
471CONFIG_WIRELESS_EXT=y
472CONFIG_MAC80211=m
473
474#
475# Rate control algorithm selection
476#
477CONFIG_MAC80211_RC_DEFAULT_PID=y
478# CONFIG_MAC80211_RC_DEFAULT_NONE is not set
479
480#
481# Selecting 'y' for an algorithm will
482#
483
484#
485# build the algorithm into mac80211.
486#
487CONFIG_MAC80211_RC_DEFAULT="pid"
488CONFIG_MAC80211_RC_PID=y
489CONFIG_MAC80211_MESH=y
490CONFIG_MAC80211_LEDS=y
491# CONFIG_MAC80211_DEBUG_PACKET_ALIGNMENT is not set
492# CONFIG_MAC80211_DEBUG is not set
389# CONFIG_IEEE80211 is not set 493# CONFIG_IEEE80211 is not set
494# CONFIG_RFKILL is not set
495# CONFIG_NET_9P is not set
390 496
391# 497#
392# Device Drivers 498# Device Drivers
@@ -395,21 +501,14 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
395# 501#
396# Generic Driver Options 502# Generic Driver Options
397# 503#
504CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
398CONFIG_STANDALONE=y 505CONFIG_STANDALONE=y
399CONFIG_PREVENT_FIRMWARE_BUILD=y 506CONFIG_PREVENT_FIRMWARE_BUILD=y
400# CONFIG_FW_LOADER is not set 507CONFIG_FW_LOADER=m
401# CONFIG_DEBUG_DRIVER is not set 508# CONFIG_DEBUG_DRIVER is not set
402# CONFIG_DEBUG_DEVRES is not set 509# CONFIG_DEBUG_DEVRES is not set
403# CONFIG_SYS_HYPERVISOR is not set 510# CONFIG_SYS_HYPERVISOR is not set
404
405#
406# Connector - unified userspace <-> kernelspace linker
407#
408# CONFIG_CONNECTOR is not set 511# CONFIG_CONNECTOR is not set
409
410#
411# Memory Technology Devices (MTD)
412#
413CONFIG_MTD=y 512CONFIG_MTD=y
414# CONFIG_MTD_DEBUG is not set 513# CONFIG_MTD_DEBUG is not set
415# CONFIG_MTD_CONCAT is not set 514# CONFIG_MTD_CONCAT is not set
@@ -420,6 +519,7 @@ CONFIG_MTD_REDBOOT_PARTS_UNALLOCATED=y
420# CONFIG_MTD_REDBOOT_PARTS_READONLY is not set 519# CONFIG_MTD_REDBOOT_PARTS_READONLY is not set
421CONFIG_MTD_CMDLINE_PARTS=y 520CONFIG_MTD_CMDLINE_PARTS=y
422# CONFIG_MTD_AFS_PARTS is not set 521# CONFIG_MTD_AFS_PARTS is not set
522# CONFIG_MTD_AR7_PARTS is not set
423 523
424# 524#
425# User Modules And Translation Layers 525# User Modules And Translation Layers
@@ -432,6 +532,7 @@ CONFIG_MTD_BLOCK=y
432# CONFIG_INFTL is not set 532# CONFIG_INFTL is not set
433# CONFIG_RFD_FTL is not set 533# CONFIG_RFD_FTL is not set
434# CONFIG_SSFDC is not set 534# CONFIG_SSFDC is not set
535# CONFIG_MTD_OOPS is not set
435 536
436# 537#
437# RAM/ROM/Flash chip drivers 538# RAM/ROM/Flash chip drivers
@@ -457,7 +558,6 @@ CONFIG_MTD_CFI_UTIL=y
457# CONFIG_MTD_RAM is not set 558# CONFIG_MTD_RAM is not set
458CONFIG_MTD_ROM=y 559CONFIG_MTD_ROM=y
459# CONFIG_MTD_ABSENT is not set 560# CONFIG_MTD_ABSENT is not set
460# CONFIG_MTD_OBSOLETE_CHIPS is not set
461 561
462# 562#
463# Mapping drivers for chip access 563# Mapping drivers for chip access
@@ -486,13 +586,10 @@ CONFIG_MTD_BAST_MAXSIZE=4
486# CONFIG_MTD_DOC2000 is not set 586# CONFIG_MTD_DOC2000 is not set
487# CONFIG_MTD_DOC2001 is not set 587# CONFIG_MTD_DOC2001 is not set
488# CONFIG_MTD_DOC2001PLUS is not set 588# CONFIG_MTD_DOC2001PLUS is not set
489
490#
491# NAND Flash Device Drivers
492#
493CONFIG_MTD_NAND=y 589CONFIG_MTD_NAND=y
494# CONFIG_MTD_NAND_VERIFY_WRITE is not set 590# CONFIG_MTD_NAND_VERIFY_WRITE is not set
495# CONFIG_MTD_NAND_ECC_SMC is not set 591# CONFIG_MTD_NAND_ECC_SMC is not set
592# CONFIG_MTD_NAND_MUSEUM_IDS is not set
496CONFIG_MTD_NAND_IDS=y 593CONFIG_MTD_NAND_IDS=y
497CONFIG_MTD_NAND_S3C2410=y 594CONFIG_MTD_NAND_S3C2410=y
498# CONFIG_MTD_NAND_S3C2410_DEBUG is not set 595# CONFIG_MTD_NAND_S3C2410_DEBUG is not set
@@ -500,30 +597,25 @@ CONFIG_MTD_NAND_S3C2410=y
500# CONFIG_MTD_NAND_S3C2410_CLKSTOP is not set 597# CONFIG_MTD_NAND_S3C2410_CLKSTOP is not set
501# CONFIG_MTD_NAND_DISKONCHIP is not set 598# CONFIG_MTD_NAND_DISKONCHIP is not set
502# CONFIG_MTD_NAND_NANDSIM is not set 599# CONFIG_MTD_NAND_NANDSIM is not set
503 600# CONFIG_MTD_NAND_PLATFORM is not set
504# 601# CONFIG_MTD_ALAUDA is not set
505# OneNAND Flash Device Drivers
506#
507# CONFIG_MTD_ONENAND is not set 602# CONFIG_MTD_ONENAND is not set
508 603
509# 604#
510# Parallel port support 605# UBI - Unsorted block images
511# 606#
607# CONFIG_MTD_UBI is not set
512CONFIG_PARPORT=y 608CONFIG_PARPORT=y
513# CONFIG_PARPORT_PC is not set 609CONFIG_PARPORT_PC=m
610# CONFIG_PARPORT_PC_FIFO is not set
611# CONFIG_PARPORT_PC_SUPERIO is not set
514# CONFIG_PARPORT_GSC is not set 612# CONFIG_PARPORT_GSC is not set
515# CONFIG_PARPORT_AX88796 is not set 613CONFIG_PARPORT_AX88796=m
516CONFIG_PARPORT_1284=y 614CONFIG_PARPORT_1284=y
517 615CONFIG_PARPORT_NOT_PC=y
518#
519# Plug and Play support
520#
521# CONFIG_PNP is not set 616# CONFIG_PNP is not set
522# CONFIG_PNPACPI is not set 617CONFIG_BLK_DEV=y
523 618# CONFIG_PARIDE is not set
524#
525# Block devices
526#
527# CONFIG_BLK_DEV_COW_COMMON is not set 619# CONFIG_BLK_DEV_COW_COMMON is not set
528CONFIG_BLK_DEV_LOOP=y 620CONFIG_BLK_DEV_LOOP=y
529# CONFIG_BLK_DEV_CRYPTOLOOP is not set 621# CONFIG_BLK_DEV_CRYPTOLOOP is not set
@@ -532,34 +624,34 @@ CONFIG_BLK_DEV_NBD=m
532CONFIG_BLK_DEV_RAM=y 624CONFIG_BLK_DEV_RAM=y
533CONFIG_BLK_DEV_RAM_COUNT=16 625CONFIG_BLK_DEV_RAM_COUNT=16
534CONFIG_BLK_DEV_RAM_SIZE=4096 626CONFIG_BLK_DEV_RAM_SIZE=4096
535CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024 627# CONFIG_BLK_DEV_XIP is not set
536# CONFIG_CDROM_PKTCDVD is not set 628# CONFIG_CDROM_PKTCDVD is not set
537CONFIG_ATA_OVER_ETH=m 629CONFIG_ATA_OVER_ETH=m
538 630CONFIG_MISC_DEVICES=y
539# 631# CONFIG_EEPROM_93CX6 is not set
540# ATA/ATAPI/MFM/RLL support 632# CONFIG_ENCLOSURE_SERVICES is not set
541# 633CONFIG_HAVE_IDE=y
542CONFIG_IDE=y 634CONFIG_IDE=y
543CONFIG_BLK_DEV_IDE=y 635CONFIG_BLK_DEV_IDE=y
544 636
545# 637#
546# Please see Documentation/ide.txt for help/info on IDE drives 638# Please see Documentation/ide/ide.txt for help/info on IDE drives
547# 639#
548# CONFIG_BLK_DEV_IDE_SATA is not set 640# CONFIG_BLK_DEV_IDE_SATA is not set
549CONFIG_BLK_DEV_IDEDISK=y 641CONFIG_BLK_DEV_IDEDISK=y
550# CONFIG_IDEDISK_MULTI_MODE is not set 642# CONFIG_IDEDISK_MULTI_MODE is not set
551CONFIG_BLK_DEV_IDECD=y 643CONFIG_BLK_DEV_IDECD=y
644CONFIG_BLK_DEV_IDECD_VERBOSE_ERRORS=y
552CONFIG_BLK_DEV_IDETAPE=m 645CONFIG_BLK_DEV_IDETAPE=m
553CONFIG_BLK_DEV_IDEFLOPPY=m 646CONFIG_BLK_DEV_IDEFLOPPY=m
647# CONFIG_BLK_DEV_IDESCSI is not set
554# CONFIG_IDE_TASK_IOCTL is not set 648# CONFIG_IDE_TASK_IOCTL is not set
649CONFIG_IDE_PROC_FS=y
555 650
556# 651#
557# IDE chipset support/bugfixes 652# IDE chipset support/bugfixes
558# 653#
559CONFIG_IDE_GENERIC=y 654# CONFIG_BLK_DEV_PLATFORM is not set
560# CONFIG_IDE_ARM is not set
561CONFIG_BLK_DEV_IDE_BAST=y
562# CONFIG_IDE_CHIPSETS is not set
563# CONFIG_BLK_DEV_IDEDMA is not set 655# CONFIG_BLK_DEV_IDEDMA is not set
564# CONFIG_BLK_DEV_HD is not set 656# CONFIG_BLK_DEV_HD is not set
565 657
@@ -567,101 +659,119 @@ CONFIG_BLK_DEV_IDE_BAST=y
567# SCSI device support 659# SCSI device support
568# 660#
569# CONFIG_RAID_ATTRS is not set 661# CONFIG_RAID_ATTRS is not set
570# CONFIG_SCSI is not set 662CONFIG_SCSI=y
663CONFIG_SCSI_DMA=y
664CONFIG_SCSI_TGT=m
571# CONFIG_SCSI_NETLINK is not set 665# CONFIG_SCSI_NETLINK is not set
572 666CONFIG_SCSI_PROC_FS=y
573# 667
574# Serial ATA (prod) and Parallel ATA (experimental) drivers 668#
575# 669# SCSI support type (disk, tape, CD-ROM)
670#
671CONFIG_BLK_DEV_SD=y
672CONFIG_CHR_DEV_ST=m
673# CONFIG_CHR_DEV_OSST is not set
674CONFIG_BLK_DEV_SR=m
675CONFIG_BLK_DEV_SR_VENDOR=y
676CONFIG_CHR_DEV_SG=y
677CONFIG_CHR_DEV_SCH=m
678
679#
680# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
681#
682CONFIG_SCSI_MULTI_LUN=y
683CONFIG_SCSI_CONSTANTS=y
684# CONFIG_SCSI_LOGGING is not set
685CONFIG_SCSI_SCAN_ASYNC=y
686CONFIG_SCSI_WAIT_SCAN=m
687
688#
689# SCSI Transports
690#
691# CONFIG_SCSI_SPI_ATTRS is not set
692# CONFIG_SCSI_FC_ATTRS is not set
693# CONFIG_SCSI_ISCSI_ATTRS is not set
694# CONFIG_SCSI_SAS_LIBSAS is not set
695# CONFIG_SCSI_SRP_ATTRS is not set
696CONFIG_SCSI_LOWLEVEL=y
697# CONFIG_ISCSI_TCP is not set
698# CONFIG_SCSI_AHA152X is not set
699# CONFIG_SCSI_AIC7XXX_OLD is not set
700# CONFIG_SCSI_ADVANSYS is not set
701# CONFIG_SCSI_IN2000 is not set
702# CONFIG_SCSI_DTC3280 is not set
703# CONFIG_SCSI_FUTURE_DOMAIN is not set
704# CONFIG_SCSI_GENERIC_NCR5380 is not set
705# CONFIG_SCSI_GENERIC_NCR5380_MMIO is not set
706# CONFIG_SCSI_PPA is not set
707# CONFIG_SCSI_IMM is not set
708# CONFIG_SCSI_NCR53C406A is not set
709# CONFIG_SCSI_PAS16 is not set
710# CONFIG_SCSI_QLOGIC_FAS is not set
711# CONFIG_SCSI_SYM53C416 is not set
712# CONFIG_SCSI_T128 is not set
713# CONFIG_SCSI_DEBUG is not set
576# CONFIG_ATA is not set 714# CONFIG_ATA is not set
577 715CONFIG_HAVE_PATA_PLATFORM=y
578#
579# Multi-device support (RAID and LVM)
580#
581# CONFIG_MD is not set 716# CONFIG_MD is not set
582
583#
584# Fusion MPT device support
585#
586# CONFIG_FUSION is not set
587
588#
589# IEEE 1394 (FireWire) support
590#
591
592#
593# I2O device support
594#
595
596#
597# Network device support
598#
599CONFIG_NETDEVICES=y 717CONFIG_NETDEVICES=y
718# CONFIG_NETDEVICES_MULTIQUEUE is not set
600# CONFIG_DUMMY is not set 719# CONFIG_DUMMY is not set
601# CONFIG_BONDING is not set 720# CONFIG_BONDING is not set
721# CONFIG_MACVLAN is not set
602# CONFIG_EQUALIZER is not set 722# CONFIG_EQUALIZER is not set
603# CONFIG_TUN is not set 723# CONFIG_TUN is not set
604 724# CONFIG_VETH is not set
605#
606# ARCnet devices
607#
608# CONFIG_ARCNET is not set 725# CONFIG_ARCNET is not set
609
610#
611# PHY device support
612#
613# CONFIG_PHYLIB is not set 726# CONFIG_PHYLIB is not set
614
615#
616# Ethernet (10 or 100Mbit)
617#
618CONFIG_NET_ETHERNET=y 727CONFIG_NET_ETHERNET=y
619CONFIG_MII=y 728CONFIG_MII=y
729# CONFIG_AX88796 is not set
620# CONFIG_NET_VENDOR_3COM is not set 730# CONFIG_NET_VENDOR_3COM is not set
621# CONFIG_NET_VENDOR_SMC is not set 731# CONFIG_NET_VENDOR_SMC is not set
622# CONFIG_SMC91X is not set 732# CONFIG_SMC91X is not set
623CONFIG_DM9000=y 733CONFIG_DM9000=y
734# CONFIG_ENC28J60 is not set
735CONFIG_DM9000_DEBUGLEVEL=4
624# CONFIG_NET_VENDOR_RACAL is not set 736# CONFIG_NET_VENDOR_RACAL is not set
625# CONFIG_AT1700 is not set 737# CONFIG_AT1700 is not set
626# CONFIG_DEPCA is not set 738# CONFIG_DEPCA is not set
627# CONFIG_HP100 is not set 739# CONFIG_HP100 is not set
628# CONFIG_NET_ISA is not set 740# CONFIG_NET_ISA is not set
741# CONFIG_IBM_NEW_EMAC_ZMII is not set
742# CONFIG_IBM_NEW_EMAC_RGMII is not set
743# CONFIG_IBM_NEW_EMAC_TAH is not set
744# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
629# CONFIG_NET_PCI is not set 745# CONFIG_NET_PCI is not set
746# CONFIG_B44 is not set
630# CONFIG_NET_POCKET is not set 747# CONFIG_NET_POCKET is not set
631 748CONFIG_NETDEV_1000=y
632# 749# CONFIG_E1000E_ENABLED is not set
633# Ethernet (1000 Mbit) 750CONFIG_NETDEV_10000=y
634#
635
636#
637# Ethernet (10000 Mbit)
638#
639
640#
641# Token Ring devices
642#
643# CONFIG_TR is not set 751# CONFIG_TR is not set
644 752
645# 753#
646# Wireless LAN (non-hamradio) 754# Wireless LAN
647# 755#
648# CONFIG_NET_RADIO is not set 756# CONFIG_WLAN_PRE80211 is not set
757# CONFIG_WLAN_80211 is not set
758# CONFIG_IWLWIFI_LEDS is not set
649 759
650# 760#
651# Wan interfaces 761# USB Network Adapters
652# 762#
763# CONFIG_USB_CATC is not set
764# CONFIG_USB_KAWETH is not set
765# CONFIG_USB_PEGASUS is not set
766# CONFIG_USB_RTL8150 is not set
767# CONFIG_USB_USBNET is not set
653# CONFIG_WAN is not set 768# CONFIG_WAN is not set
654# CONFIG_PLIP is not set 769# CONFIG_PLIP is not set
655# CONFIG_PPP is not set 770# CONFIG_PPP is not set
656# CONFIG_SLIP is not set 771# CONFIG_SLIP is not set
657# CONFIG_SHAPER is not set
658# CONFIG_NETCONSOLE is not set 772# CONFIG_NETCONSOLE is not set
659# CONFIG_NETPOLL is not set 773# CONFIG_NETPOLL is not set
660# CONFIG_NET_POLL_CONTROLLER is not set 774# CONFIG_NET_POLL_CONTROLLER is not set
661
662#
663# ISDN subsystem
664#
665# CONFIG_ISDN is not set 775# CONFIG_ISDN is not set
666 776
667# 777#
@@ -669,6 +779,7 @@ CONFIG_DM9000=y
669# 779#
670CONFIG_INPUT=y 780CONFIG_INPUT=y
671# CONFIG_INPUT_FF_MEMLESS is not set 781# CONFIG_INPUT_FF_MEMLESS is not set
782# CONFIG_INPUT_POLLDEV is not set
672 783
673# 784#
674# Userland interfaces 785# Userland interfaces
@@ -678,7 +789,6 @@ CONFIG_INPUT_MOUSEDEV_PSAUX=y
678CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024 789CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
679CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768 790CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
680# CONFIG_INPUT_JOYDEV is not set 791# CONFIG_INPUT_JOYDEV is not set
681# CONFIG_INPUT_TSDEV is not set
682# CONFIG_INPUT_EVDEV is not set 792# CONFIG_INPUT_EVDEV is not set
683# CONFIG_INPUT_EVBUG is not set 793# CONFIG_INPUT_EVBUG is not set
684 794
@@ -695,12 +805,21 @@ CONFIG_KEYBOARD_ATKBD=y
695# CONFIG_KEYBOARD_GPIO is not set 805# CONFIG_KEYBOARD_GPIO is not set
696CONFIG_INPUT_MOUSE=y 806CONFIG_INPUT_MOUSE=y
697CONFIG_MOUSE_PS2=y 807CONFIG_MOUSE_PS2=y
808CONFIG_MOUSE_PS2_ALPS=y
809CONFIG_MOUSE_PS2_LOGIPS2PP=y
810CONFIG_MOUSE_PS2_SYNAPTICS=y
811CONFIG_MOUSE_PS2_LIFEBOOK=y
812CONFIG_MOUSE_PS2_TRACKPOINT=y
813# CONFIG_MOUSE_PS2_TOUCHKIT is not set
698# CONFIG_MOUSE_SERIAL is not set 814# CONFIG_MOUSE_SERIAL is not set
815# CONFIG_MOUSE_APPLETOUCH is not set
699# CONFIG_MOUSE_INPORT is not set 816# CONFIG_MOUSE_INPORT is not set
700# CONFIG_MOUSE_LOGIBM is not set 817# CONFIG_MOUSE_LOGIBM is not set
701# CONFIG_MOUSE_PC110PAD is not set 818# CONFIG_MOUSE_PC110PAD is not set
702# CONFIG_MOUSE_VSXXXAA is not set 819# CONFIG_MOUSE_VSXXXAA is not set
820# CONFIG_MOUSE_GPIO is not set
703# CONFIG_INPUT_JOYSTICK is not set 821# CONFIG_INPUT_JOYSTICK is not set
822# CONFIG_INPUT_TABLET is not set
704# CONFIG_INPUT_TOUCHSCREEN is not set 823# CONFIG_INPUT_TOUCHSCREEN is not set
705# CONFIG_INPUT_MISC is not set 824# CONFIG_INPUT_MISC is not set
706 825
@@ -721,6 +840,7 @@ CONFIG_VT=y
721CONFIG_VT_CONSOLE=y 840CONFIG_VT_CONSOLE=y
722CONFIG_HW_CONSOLE=y 841CONFIG_HW_CONSOLE=y
723# CONFIG_VT_HW_CONSOLE_BINDING is not set 842# CONFIG_VT_HW_CONSOLE_BINDING is not set
843CONFIG_DEVKMEM=y
724CONFIG_SERIAL_NONSTANDARD=y 844CONFIG_SERIAL_NONSTANDARD=y
725# CONFIG_COMPUTONE is not set 845# CONFIG_COMPUTONE is not set
726# CONFIG_ROCKETPORT is not set 846# CONFIG_ROCKETPORT is not set
@@ -728,8 +848,6 @@ CONFIG_SERIAL_NONSTANDARD=y
728# CONFIG_DIGIEPCA is not set 848# CONFIG_DIGIEPCA is not set
729# CONFIG_MOXA_INTELLIO is not set 849# CONFIG_MOXA_INTELLIO is not set
730# CONFIG_MOXA_SMARTIO is not set 850# CONFIG_MOXA_SMARTIO is not set
731# CONFIG_MOXA_SMARTIO_NEW is not set
732# CONFIG_SYNCLINKMP is not set
733# CONFIG_N_HDLC is not set 851# CONFIG_N_HDLC is not set
734# CONFIG_RISCOM8 is not set 852# CONFIG_RISCOM8 is not set
735# CONFIG_SPECIALIX is not set 853# CONFIG_SPECIALIX is not set
@@ -758,8 +876,12 @@ CONFIG_SERIAL_8250_SHARE_IRQ=y
758# 876#
759# Non-8250 serial port support 877# Non-8250 serial port support
760# 878#
879CONFIG_SERIAL_SAMSUNG=y
880# CONFIG_SERIAL_SAMSUNG_DEBUG is not set
881CONFIG_SERIAL_SAMSUNG_CONSOLE=y
761CONFIG_SERIAL_S3C2410=y 882CONFIG_SERIAL_S3C2410=y
762CONFIG_SERIAL_S3C2410_CONSOLE=y 883CONFIG_SERIAL_S3C2412=y
884CONFIG_SERIAL_S3C2440=y
763CONFIG_SERIAL_CORE=y 885CONFIG_SERIAL_CORE=y
764CONFIG_SERIAL_CORE_CONSOLE=y 886CONFIG_SERIAL_CORE_CONSOLE=y
765CONFIG_UNIX98_PTYS=y 887CONFIG_UNIX98_PTYS=y
@@ -768,89 +890,50 @@ CONFIG_LEGACY_PTY_COUNT=256
768CONFIG_PRINTER=y 890CONFIG_PRINTER=y
769# CONFIG_LP_CONSOLE is not set 891# CONFIG_LP_CONSOLE is not set
770CONFIG_PPDEV=y 892CONFIG_PPDEV=y
771# CONFIG_TIPAR is not set
772
773#
774# IPMI
775#
776# CONFIG_IPMI_HANDLER is not set 893# CONFIG_IPMI_HANDLER is not set
777
778#
779# Watchdog Cards
780#
781CONFIG_WATCHDOG=y
782# CONFIG_WATCHDOG_NOWAYOUT is not set
783
784#
785# Watchdog Device Drivers
786#
787# CONFIG_SOFT_WATCHDOG is not set
788CONFIG_S3C2410_WATCHDOG=y
789
790#
791# ISA-based Watchdog Cards
792#
793# CONFIG_PCWATCHDOG is not set
794# CONFIG_MIXCOMWD is not set
795# CONFIG_WDT is not set
796
797#
798# USB-based Watchdog Cards
799#
800# CONFIG_USBPCWATCHDOG is not set
801CONFIG_HW_RANDOM=y 894CONFIG_HW_RANDOM=y
802# CONFIG_NVRAM is not set 895# CONFIG_NVRAM is not set
803# CONFIG_DTLK is not set 896# CONFIG_DTLK is not set
804# CONFIG_R3964 is not set 897# CONFIG_R3964 is not set
805# CONFIG_RAW_DRIVER is not set 898# CONFIG_RAW_DRIVER is not set
806
807#
808# TPM devices
809#
810# CONFIG_TCG_TPM is not set 899# CONFIG_TCG_TPM is not set
811 900CONFIG_DEVPORT=y
812#
813# I2C support
814#
815CONFIG_I2C=y 901CONFIG_I2C=y
902CONFIG_I2C_BOARDINFO=y
816CONFIG_I2C_CHARDEV=m 903CONFIG_I2C_CHARDEV=m
817 904CONFIG_I2C_ALGOBIT=y
818#
819# I2C Algorithms
820#
821CONFIG_I2C_ALGOBIT=m
822# CONFIG_I2C_ALGOPCF is not set
823# CONFIG_I2C_ALGOPCA is not set
824 905
825# 906#
826# I2C Hardware Bus support 907# I2C Hardware Bus support
827# 908#
828# CONFIG_I2C_ELEKTOR is not set 909# CONFIG_I2C_ELEKTOR is not set
910# CONFIG_I2C_GPIO is not set
829# CONFIG_I2C_OCORES is not set 911# CONFIG_I2C_OCORES is not set
830# CONFIG_I2C_PARPORT is not set 912# CONFIG_I2C_PARPORT is not set
831# CONFIG_I2C_PARPORT_LIGHT is not set 913# CONFIG_I2C_PARPORT_LIGHT is not set
832CONFIG_I2C_S3C2410=y 914CONFIG_I2C_S3C2410=y
915CONFIG_I2C_SIMTEC=y
916# CONFIG_I2C_TAOS_EVM is not set
833# CONFIG_I2C_STUB is not set 917# CONFIG_I2C_STUB is not set
918# CONFIG_I2C_TINY_USB is not set
834# CONFIG_I2C_PCA_ISA is not set 919# CONFIG_I2C_PCA_ISA is not set
920# CONFIG_I2C_PCA_PLATFORM is not set
835 921
836# 922#
837# Miscellaneous I2C Chip support 923# Miscellaneous I2C Chip support
838# 924#
839# CONFIG_SENSORS_DS1337 is not set 925# CONFIG_DS1682 is not set
840# CONFIG_SENSORS_DS1374 is not set
841CONFIG_SENSORS_EEPROM=m 926CONFIG_SENSORS_EEPROM=m
842# CONFIG_SENSORS_PCF8574 is not set 927# CONFIG_SENSORS_PCF8574 is not set
843# CONFIG_SENSORS_PCA9539 is not set 928# CONFIG_PCF8575 is not set
844# CONFIG_SENSORS_PCF8591 is not set 929# CONFIG_SENSORS_PCF8591 is not set
930# CONFIG_TPS65010 is not set
845# CONFIG_SENSORS_MAX6875 is not set 931# CONFIG_SENSORS_MAX6875 is not set
932# CONFIG_SENSORS_TSL2550 is not set
846# CONFIG_I2C_DEBUG_CORE is not set 933# CONFIG_I2C_DEBUG_CORE is not set
847# CONFIG_I2C_DEBUG_ALGO is not set 934# CONFIG_I2C_DEBUG_ALGO is not set
848# CONFIG_I2C_DEBUG_BUS is not set 935# CONFIG_I2C_DEBUG_BUS is not set
849# CONFIG_I2C_DEBUG_CHIP is not set 936# CONFIG_I2C_DEBUG_CHIP is not set
850
851#
852# SPI support
853#
854CONFIG_SPI=y 937CONFIG_SPI=y
855# CONFIG_SPI_DEBUG is not set 938# CONFIG_SPI_DEBUG is not set
856CONFIG_SPI_MASTER=y 939CONFIG_SPI_MASTER=y
@@ -860,6 +943,7 @@ CONFIG_SPI_MASTER=y
860# 943#
861CONFIG_SPI_BITBANG=m 944CONFIG_SPI_BITBANG=m
862# CONFIG_SPI_BUTTERFLY is not set 945# CONFIG_SPI_BUTTERFLY is not set
946# CONFIG_SPI_LM70_LLP is not set
863CONFIG_SPI_S3C24XX=m 947CONFIG_SPI_S3C24XX=m
864CONFIG_SPI_S3C24XX_GPIO=m 948CONFIG_SPI_S3C24XX_GPIO=m
865 949
@@ -867,30 +951,43 @@ CONFIG_SPI_S3C24XX_GPIO=m
867# SPI Protocol Masters 951# SPI Protocol Masters
868# 952#
869# CONFIG_SPI_AT25 is not set 953# CONFIG_SPI_AT25 is not set
954# CONFIG_SPI_SPIDEV is not set
955# CONFIG_SPI_TLE62X0 is not set
956CONFIG_HAVE_GPIO_LIB=y
870 957
871# 958#
872# Dallas's 1-wire bus 959# GPIO Support
873# 960#
874# CONFIG_W1 is not set 961# CONFIG_DEBUG_GPIO is not set
875 962
876# 963#
877# Hardware Monitoring support 964# I2C GPIO expanders:
965#
966# CONFIG_GPIO_PCA953X is not set
967# CONFIG_GPIO_PCF857X is not set
968
878# 969#
970# SPI GPIO expanders:
971#
972# CONFIG_GPIO_MCP23S08 is not set
973# CONFIG_W1 is not set
974# CONFIG_POWER_SUPPLY is not set
879CONFIG_HWMON=y 975CONFIG_HWMON=y
880CONFIG_HWMON_VID=m 976CONFIG_HWMON_VID=m
881# CONFIG_SENSORS_ABITUGURU is not set 977# CONFIG_SENSORS_AD7418 is not set
882# CONFIG_SENSORS_ADM1021 is not set 978# CONFIG_SENSORS_ADM1021 is not set
883# CONFIG_SENSORS_ADM1025 is not set 979# CONFIG_SENSORS_ADM1025 is not set
884# CONFIG_SENSORS_ADM1026 is not set 980# CONFIG_SENSORS_ADM1026 is not set
885# CONFIG_SENSORS_ADM1029 is not set 981# CONFIG_SENSORS_ADM1029 is not set
886# CONFIG_SENSORS_ADM1031 is not set 982# CONFIG_SENSORS_ADM1031 is not set
887# CONFIG_SENSORS_ADM9240 is not set 983# CONFIG_SENSORS_ADM9240 is not set
888# CONFIG_SENSORS_ASB100 is not set 984# CONFIG_SENSORS_ADT7470 is not set
985# CONFIG_SENSORS_ADT7473 is not set
889# CONFIG_SENSORS_ATXP1 is not set 986# CONFIG_SENSORS_ATXP1 is not set
890# CONFIG_SENSORS_DS1621 is not set 987# CONFIG_SENSORS_DS1621 is not set
891# CONFIG_SENSORS_F71805F is not set 988# CONFIG_SENSORS_F71805F is not set
892# CONFIG_SENSORS_FSCHER is not set 989# CONFIG_SENSORS_F71882FG is not set
893# CONFIG_SENSORS_FSCPOS is not set 990# CONFIG_SENSORS_F75375S is not set
894# CONFIG_SENSORS_GL518SM is not set 991# CONFIG_SENSORS_GL518SM is not set
895# CONFIG_SENSORS_GL520SM is not set 992# CONFIG_SENSORS_GL520SM is not set
896# CONFIG_SENSORS_IT87 is not set 993# CONFIG_SENSORS_IT87 is not set
@@ -905,72 +1002,95 @@ CONFIG_SENSORS_LM85=m
905# CONFIG_SENSORS_LM87 is not set 1002# CONFIG_SENSORS_LM87 is not set
906# CONFIG_SENSORS_LM90 is not set 1003# CONFIG_SENSORS_LM90 is not set
907# CONFIG_SENSORS_LM92 is not set 1004# CONFIG_SENSORS_LM92 is not set
1005# CONFIG_SENSORS_LM93 is not set
908# CONFIG_SENSORS_MAX1619 is not set 1006# CONFIG_SENSORS_MAX1619 is not set
1007# CONFIG_SENSORS_MAX6650 is not set
909# CONFIG_SENSORS_PC87360 is not set 1008# CONFIG_SENSORS_PC87360 is not set
910# CONFIG_SENSORS_PC87427 is not set 1009# CONFIG_SENSORS_PC87427 is not set
1010# CONFIG_SENSORS_DME1737 is not set
911# CONFIG_SENSORS_SMSC47M1 is not set 1011# CONFIG_SENSORS_SMSC47M1 is not set
912# CONFIG_SENSORS_SMSC47M192 is not set 1012# CONFIG_SENSORS_SMSC47M192 is not set
913# CONFIG_SENSORS_SMSC47B397 is not set 1013# CONFIG_SENSORS_SMSC47B397 is not set
1014# CONFIG_SENSORS_ADS7828 is not set
1015# CONFIG_SENSORS_THMC50 is not set
914# CONFIG_SENSORS_VT1211 is not set 1016# CONFIG_SENSORS_VT1211 is not set
915# CONFIG_SENSORS_W83781D is not set 1017# CONFIG_SENSORS_W83781D is not set
916# CONFIG_SENSORS_W83791D is not set 1018# CONFIG_SENSORS_W83791D is not set
917# CONFIG_SENSORS_W83792D is not set 1019# CONFIG_SENSORS_W83792D is not set
918# CONFIG_SENSORS_W83793 is not set 1020# CONFIG_SENSORS_W83793 is not set
919# CONFIG_SENSORS_W83L785TS is not set 1021# CONFIG_SENSORS_W83L785TS is not set
1022# CONFIG_SENSORS_W83L786NG is not set
920# CONFIG_SENSORS_W83627HF is not set 1023# CONFIG_SENSORS_W83627HF is not set
921# CONFIG_SENSORS_W83627EHF is not set 1024# CONFIG_SENSORS_W83627EHF is not set
922# CONFIG_HWMON_DEBUG_CHIP is not set 1025# CONFIG_HWMON_DEBUG_CHIP is not set
1026CONFIG_WATCHDOG=y
1027# CONFIG_WATCHDOG_NOWAYOUT is not set
923 1028
924# 1029#
925# Misc devices 1030# Watchdog Device Drivers
926# 1031#
1032# CONFIG_SOFT_WATCHDOG is not set
1033CONFIG_S3C2410_WATCHDOG=y
927 1034
928# 1035#
929# Multifunction device drivers 1036# ISA-based Watchdog Cards
930# 1037#
931# CONFIG_MFD_SM501 is not set 1038# CONFIG_PCWATCHDOG is not set
1039# CONFIG_MIXCOMWD is not set
1040# CONFIG_WDT is not set
932 1041
933# 1042#
934# LED devices 1043# USB-based Watchdog Cards
935# 1044#
936CONFIG_NEW_LEDS=y 1045# CONFIG_USBPCWATCHDOG is not set
937CONFIG_LEDS_CLASS=m
938 1046
939# 1047#
940# LED drivers 1048# Sonics Silicon Backplane
941# 1049#
942CONFIG_LEDS_S3C24XX=m 1050CONFIG_SSB_POSSIBLE=y
943CONFIG_LEDS_H1940=m 1051# CONFIG_SSB is not set
944 1052
945# 1053#
946# LED Triggers 1054# Multifunction device drivers
947# 1055#
948CONFIG_LEDS_TRIGGERS=y 1056CONFIG_MFD_SM501=y
949CONFIG_LEDS_TRIGGER_TIMER=m 1057# CONFIG_MFD_ASIC3 is not set
950# CONFIG_LEDS_TRIGGER_IDE_DISK is not set 1058# CONFIG_HTC_EGPIO is not set
951CONFIG_LEDS_TRIGGER_HEARTBEAT=m 1059# CONFIG_HTC_PASIC3 is not set
952 1060
953# 1061#
954# Multimedia devices 1062# Multimedia devices
955# 1063#
1064
1065#
1066# Multimedia core support
1067#
956# CONFIG_VIDEO_DEV is not set 1068# CONFIG_VIDEO_DEV is not set
1069# CONFIG_DVB_CORE is not set
1070# CONFIG_VIDEO_MEDIA is not set
957 1071
958# 1072#
959# Digital Video Broadcasting Devices 1073# Multimedia drivers
960# 1074#
961# CONFIG_DVB is not set 1075# CONFIG_DAB is not set
962# CONFIG_USB_DABUSB is not set
963 1076
964# 1077#
965# Graphics support 1078# Graphics support
966# 1079#
967# CONFIG_BACKLIGHT_LCD_SUPPORT is not set 1080# CONFIG_VGASTATE is not set
1081# CONFIG_VIDEO_OUTPUT_CONTROL is not set
968CONFIG_FB=y 1082CONFIG_FB=y
969CONFIG_FIRMWARE_EDID=y 1083CONFIG_FIRMWARE_EDID=y
970# CONFIG_FB_DDC is not set 1084# CONFIG_FB_DDC is not set
971CONFIG_FB_CFB_FILLRECT=y 1085CONFIG_FB_CFB_FILLRECT=y
972CONFIG_FB_CFB_COPYAREA=y 1086CONFIG_FB_CFB_COPYAREA=y
973CONFIG_FB_CFB_IMAGEBLIT=y 1087CONFIG_FB_CFB_IMAGEBLIT=y
1088# CONFIG_FB_CFB_REV_PIXELS_IN_BYTE is not set
1089# CONFIG_FB_SYS_FILLRECT is not set
1090# CONFIG_FB_SYS_COPYAREA is not set
1091# CONFIG_FB_SYS_IMAGEBLIT is not set
1092# CONFIG_FB_FOREIGN_ENDIAN is not set
1093# CONFIG_FB_SYS_FOPS is not set
974# CONFIG_FB_SVGALIB is not set 1094# CONFIG_FB_SVGALIB is not set
975# CONFIG_FB_MACMODES is not set 1095# CONFIG_FB_MACMODES is not set
976# CONFIG_FB_BACKLIGHT is not set 1096# CONFIG_FB_BACKLIGHT is not set
@@ -978,12 +1098,19 @@ CONFIG_FB_MODE_HELPERS=y
978# CONFIG_FB_TILEBLITTING is not set 1098# CONFIG_FB_TILEBLITTING is not set
979 1099
980# 1100#
981# Frambuffer hardware drivers 1101# Frame buffer hardware drivers
982# 1102#
983# CONFIG_FB_S1D13XXX is not set 1103# CONFIG_FB_S1D13XXX is not set
984CONFIG_FB_S3C2410=y 1104CONFIG_FB_S3C2410=y
985# CONFIG_FB_S3C2410_DEBUG is not set 1105# CONFIG_FB_S3C2410_DEBUG is not set
1106CONFIG_FB_SM501=y
986# CONFIG_FB_VIRTUAL is not set 1107# CONFIG_FB_VIRTUAL is not set
1108# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
1109
1110#
1111# Display device support
1112#
1113# CONFIG_DISPLAY_SUPPORT is not set
987 1114
988# 1115#
989# Console display driver support 1116# Console display driver support
@@ -992,40 +1119,45 @@ CONFIG_FB_S3C2410=y
992# CONFIG_MDA_CONSOLE is not set 1119# CONFIG_MDA_CONSOLE is not set
993CONFIG_DUMMY_CONSOLE=y 1120CONFIG_DUMMY_CONSOLE=y
994CONFIG_FRAMEBUFFER_CONSOLE=y 1121CONFIG_FRAMEBUFFER_CONSOLE=y
1122# CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY is not set
995# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set 1123# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set
996# CONFIG_FONTS is not set 1124# CONFIG_FONTS is not set
997CONFIG_FONT_8x8=y 1125CONFIG_FONT_8x8=y
998CONFIG_FONT_8x16=y 1126CONFIG_FONT_8x16=y
999
1000#
1001# Logo configuration
1002#
1003# CONFIG_LOGO is not set 1127# CONFIG_LOGO is not set
1004 1128
1005# 1129#
1006# Sound 1130# Sound
1007# 1131#
1008# CONFIG_SOUND is not set 1132# CONFIG_SOUND is not set
1133CONFIG_HID_SUPPORT=y
1134CONFIG_HID=y
1135# CONFIG_HID_DEBUG is not set
1136# CONFIG_HIDRAW is not set
1009 1137
1010# 1138#
1011# HID Devices 1139# USB Input Devices
1012# 1140#
1013CONFIG_HID=y 1141# CONFIG_USB_HID is not set
1014# CONFIG_HID_DEBUG is not set
1015 1142
1016# 1143#
1017# USB support 1144# USB HID Boot Protocol drivers
1018# 1145#
1146# CONFIG_USB_KBD is not set
1147# CONFIG_USB_MOUSE is not set
1148CONFIG_USB_SUPPORT=y
1019CONFIG_USB_ARCH_HAS_HCD=y 1149CONFIG_USB_ARCH_HAS_HCD=y
1020CONFIG_USB_ARCH_HAS_OHCI=y 1150CONFIG_USB_ARCH_HAS_OHCI=y
1021# CONFIG_USB_ARCH_HAS_EHCI is not set 1151# CONFIG_USB_ARCH_HAS_EHCI is not set
1022CONFIG_USB=y 1152CONFIG_USB=y
1023# CONFIG_USB_DEBUG is not set 1153# CONFIG_USB_DEBUG is not set
1154# CONFIG_USB_ANNOUNCE_NEW_DEVICES is not set
1024 1155
1025# 1156#
1026# Miscellaneous USB options 1157# Miscellaneous USB options
1027# 1158#
1028CONFIG_USB_DEVICEFS=y 1159CONFIG_USB_DEVICEFS=y
1160CONFIG_USB_DEVICE_CLASS=y
1029# CONFIG_USB_DYNAMIC_MINORS is not set 1161# CONFIG_USB_DYNAMIC_MINORS is not set
1030# CONFIG_USB_SUSPEND is not set 1162# CONFIG_USB_SUSPEND is not set
1031# CONFIG_USB_OTG is not set 1163# CONFIG_USB_OTG is not set
@@ -1033,18 +1165,22 @@ CONFIG_USB_DEVICEFS=y
1033# 1165#
1034# USB Host Controller Drivers 1166# USB Host Controller Drivers
1035# 1167#
1168# CONFIG_USB_C67X00_HCD is not set
1036# CONFIG_USB_ISP116X_HCD is not set 1169# CONFIG_USB_ISP116X_HCD is not set
1170# CONFIG_USB_ISP1760_HCD is not set
1037CONFIG_USB_OHCI_HCD=y 1171CONFIG_USB_OHCI_HCD=y
1038# CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set 1172# CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set
1039# CONFIG_USB_OHCI_BIG_ENDIAN_MMIO is not set 1173# CONFIG_USB_OHCI_BIG_ENDIAN_MMIO is not set
1040CONFIG_USB_OHCI_LITTLE_ENDIAN=y 1174CONFIG_USB_OHCI_LITTLE_ENDIAN=y
1041# CONFIG_USB_SL811_HCD is not set 1175# CONFIG_USB_SL811_HCD is not set
1176# CONFIG_USB_R8A66597_HCD is not set
1042 1177
1043# 1178#
1044# USB Device Class drivers 1179# USB Device Class drivers
1045# 1180#
1046# CONFIG_USB_ACM is not set 1181CONFIG_USB_ACM=m
1047# CONFIG_USB_PRINTER is not set 1182CONFIG_USB_PRINTER=m
1183CONFIG_USB_WDM=m
1048 1184
1049# 1185#
1050# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' 1186# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
@@ -1053,57 +1189,78 @@ CONFIG_USB_OHCI_LITTLE_ENDIAN=y
1053# 1189#
1054# may also be needed; see USB_STORAGE Help for more information 1190# may also be needed; see USB_STORAGE Help for more information
1055# 1191#
1056# CONFIG_USB_LIBUSUAL is not set 1192CONFIG_USB_STORAGE=m
1057 1193# CONFIG_USB_STORAGE_DEBUG is not set
1058# 1194# CONFIG_USB_STORAGE_DATAFAB is not set
1059# USB Input Devices 1195# CONFIG_USB_STORAGE_FREECOM is not set
1060# 1196# CONFIG_USB_STORAGE_ISD200 is not set
1061# CONFIG_USB_HID is not set 1197# CONFIG_USB_STORAGE_DPCM is not set
1062 1198# CONFIG_USB_STORAGE_USBAT is not set
1063# 1199# CONFIG_USB_STORAGE_SDDR09 is not set
1064# USB HID Boot Protocol drivers 1200# CONFIG_USB_STORAGE_SDDR55 is not set
1065# 1201# CONFIG_USB_STORAGE_JUMPSHOT is not set
1066# CONFIG_USB_KBD is not set 1202# CONFIG_USB_STORAGE_ALAUDA is not set
1067# CONFIG_USB_MOUSE is not set 1203# CONFIG_USB_STORAGE_ONETOUCH is not set
1068# CONFIG_USB_AIPTEK is not set 1204# CONFIG_USB_STORAGE_KARMA is not set
1069# CONFIG_USB_WACOM is not set 1205# CONFIG_USB_STORAGE_CYPRESS_ATACB is not set
1070# CONFIG_USB_ACECAD is not set 1206CONFIG_USB_LIBUSUAL=y
1071# CONFIG_USB_KBTAB is not set
1072# CONFIG_USB_POWERMATE is not set
1073# CONFIG_USB_TOUCHSCREEN is not set
1074# CONFIG_USB_YEALINK is not set
1075# CONFIG_USB_XPAD is not set
1076# CONFIG_USB_ATI_REMOTE is not set
1077# CONFIG_USB_ATI_REMOTE2 is not set
1078# CONFIG_USB_KEYSPAN_REMOTE is not set
1079# CONFIG_USB_APPLETOUCH is not set
1080# CONFIG_USB_GTCO is not set
1081 1207
1082# 1208#
1083# USB Imaging devices 1209# USB Imaging devices
1084# 1210#
1085# CONFIG_USB_MDC800 is not set 1211# CONFIG_USB_MDC800 is not set
1086 1212# CONFIG_USB_MICROTEK is not set
1087#
1088# USB Network Adapters
1089#
1090# CONFIG_USB_CATC is not set
1091# CONFIG_USB_KAWETH is not set
1092# CONFIG_USB_PEGASUS is not set
1093# CONFIG_USB_RTL8150 is not set
1094# CONFIG_USB_USBNET_MII is not set
1095# CONFIG_USB_USBNET is not set
1096CONFIG_USB_MON=y 1213CONFIG_USB_MON=y
1097 1214
1098# 1215#
1099# USB port drivers 1216# USB port drivers
1100# 1217#
1101# CONFIG_USB_USS720 is not set 1218# CONFIG_USB_USS720 is not set
1102 1219CONFIG_USB_SERIAL=y
1103# 1220# CONFIG_USB_SERIAL_CONSOLE is not set
1104# USB Serial Converter support 1221# CONFIG_USB_EZUSB is not set
1105# 1222CONFIG_USB_SERIAL_GENERIC=y
1106# CONFIG_USB_SERIAL is not set 1223# CONFIG_USB_SERIAL_AIRCABLE is not set
1224# CONFIG_USB_SERIAL_AIRPRIME is not set
1225# CONFIG_USB_SERIAL_ARK3116 is not set
1226# CONFIG_USB_SERIAL_BELKIN is not set
1227# CONFIG_USB_SERIAL_CH341 is not set
1228# CONFIG_USB_SERIAL_WHITEHEAT is not set
1229# CONFIG_USB_SERIAL_DIGI_ACCELEPORT is not set
1230# CONFIG_USB_SERIAL_CP2101 is not set
1231# CONFIG_USB_SERIAL_CYPRESS_M8 is not set
1232# CONFIG_USB_SERIAL_EMPEG is not set
1233CONFIG_USB_SERIAL_FTDI_SIO=y
1234# CONFIG_USB_SERIAL_FUNSOFT is not set
1235# CONFIG_USB_SERIAL_VISOR is not set
1236# CONFIG_USB_SERIAL_IPAQ is not set
1237# CONFIG_USB_SERIAL_IR is not set
1238# CONFIG_USB_SERIAL_EDGEPORT is not set
1239# CONFIG_USB_SERIAL_EDGEPORT_TI is not set
1240# CONFIG_USB_SERIAL_GARMIN is not set
1241# CONFIG_USB_SERIAL_IPW is not set
1242# CONFIG_USB_SERIAL_IUU is not set
1243# CONFIG_USB_SERIAL_KEYSPAN_PDA is not set
1244# CONFIG_USB_SERIAL_KEYSPAN is not set
1245# CONFIG_USB_SERIAL_KLSI is not set
1246# CONFIG_USB_SERIAL_KOBIL_SCT is not set
1247# CONFIG_USB_SERIAL_MCT_U232 is not set
1248# CONFIG_USB_SERIAL_MOS7720 is not set
1249# CONFIG_USB_SERIAL_MOS7840 is not set
1250# CONFIG_USB_SERIAL_MOTOROLA is not set
1251CONFIG_USB_SERIAL_NAVMAN=m
1252CONFIG_USB_SERIAL_PL2303=y
1253# CONFIG_USB_SERIAL_OTI6858 is not set
1254# CONFIG_USB_SERIAL_SPCP8X5 is not set
1255# CONFIG_USB_SERIAL_HP4X is not set
1256# CONFIG_USB_SERIAL_SAFE is not set
1257# CONFIG_USB_SERIAL_SIERRAWIRELESS is not set
1258# CONFIG_USB_SERIAL_TI is not set
1259# CONFIG_USB_SERIAL_CYBERJACK is not set
1260# CONFIG_USB_SERIAL_XIRCOM is not set
1261CONFIG_USB_SERIAL_OPTION=m
1262# CONFIG_USB_SERIAL_OMNINET is not set
1263# CONFIG_USB_SERIAL_DEBUG is not set
1107 1264
1108# 1265#
1109# USB Miscellaneous drivers 1266# USB Miscellaneous drivers
@@ -1116,35 +1273,38 @@ CONFIG_USB_MON=y
1116# CONFIG_USB_LEGOTOWER is not set 1273# CONFIG_USB_LEGOTOWER is not set
1117# CONFIG_USB_LCD is not set 1274# CONFIG_USB_LCD is not set
1118# CONFIG_USB_BERRY_CHARGE is not set 1275# CONFIG_USB_BERRY_CHARGE is not set
1119# CONFIG_USB_LED is not set 1276CONFIG_USB_LED=m
1120# CONFIG_USB_CYPRESS_CY7C63 is not set 1277# CONFIG_USB_CYPRESS_CY7C63 is not set
1121# CONFIG_USB_CYTHERM is not set 1278# CONFIG_USB_CYTHERM is not set
1122# CONFIG_USB_PHIDGET is not set 1279# CONFIG_USB_PHIDGET is not set
1123# CONFIG_USB_IDMOUSE is not set 1280# CONFIG_USB_IDMOUSE is not set
1124# CONFIG_USB_FTDI_ELAN is not set 1281# CONFIG_USB_FTDI_ELAN is not set
1125# CONFIG_USB_APPLEDISPLAY is not set 1282# CONFIG_USB_APPLEDISPLAY is not set
1126# CONFIG_USB_LD is not set 1283CONFIG_USB_LD=m
1127# CONFIG_USB_TRANCEVIBRATOR is not set 1284# CONFIG_USB_TRANCEVIBRATOR is not set
1128# CONFIG_USB_IOWARRIOR is not set 1285# CONFIG_USB_IOWARRIOR is not set
1129# CONFIG_USB_TEST is not set 1286# CONFIG_USB_TEST is not set
1130 1287# CONFIG_USB_ISIGHTFW is not set
1131#
1132# USB DSL modem support
1133#
1134
1135#
1136# USB Gadget Support
1137#
1138# CONFIG_USB_GADGET is not set 1288# CONFIG_USB_GADGET is not set
1289# CONFIG_MMC is not set
1290CONFIG_NEW_LEDS=y
1291CONFIG_LEDS_CLASS=m
1139 1292
1140# 1293#
1141# MMC/SD Card support 1294# LED drivers
1142# 1295#
1143# CONFIG_MMC is not set 1296CONFIG_LEDS_S3C24XX=m
1297CONFIG_LEDS_H1940=m
1298# CONFIG_LEDS_GPIO is not set
1144 1299
1145# 1300#
1146# Real Time Clock 1301# LED Triggers
1147# 1302#
1303CONFIG_LEDS_TRIGGERS=y
1304CONFIG_LEDS_TRIGGER_TIMER=m
1305# CONFIG_LEDS_TRIGGER_IDE_DISK is not set
1306CONFIG_LEDS_TRIGGER_HEARTBEAT=m
1307# CONFIG_LEDS_TRIGGER_DEFAULT_ON is not set
1148CONFIG_RTC_LIB=y 1308CONFIG_RTC_LIB=y
1149CONFIG_RTC_CLASS=y 1309CONFIG_RTC_CLASS=y
1150CONFIG_RTC_HCTOSYS=y 1310CONFIG_RTC_HCTOSYS=y
@@ -1158,61 +1318,86 @@ CONFIG_RTC_INTF_SYSFS=y
1158CONFIG_RTC_INTF_PROC=y 1318CONFIG_RTC_INTF_PROC=y
1159CONFIG_RTC_INTF_DEV=y 1319CONFIG_RTC_INTF_DEV=y
1160# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set 1320# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set
1321# CONFIG_RTC_DRV_TEST is not set
1161 1322
1162# 1323#
1163# RTC drivers 1324# I2C RTC drivers
1164# 1325#
1165# CONFIG_RTC_DRV_CMOS is not set
1166# CONFIG_RTC_DRV_X1205 is not set
1167# CONFIG_RTC_DRV_DS1307 is not set 1326# CONFIG_RTC_DRV_DS1307 is not set
1168# CONFIG_RTC_DRV_DS1553 is not set 1327# CONFIG_RTC_DRV_DS1374 is not set
1169# CONFIG_RTC_DRV_ISL1208 is not set
1170# CONFIG_RTC_DRV_DS1672 is not set 1328# CONFIG_RTC_DRV_DS1672 is not set
1171# CONFIG_RTC_DRV_DS1742 is not set 1329# CONFIG_RTC_DRV_MAX6900 is not set
1330# CONFIG_RTC_DRV_RS5C372 is not set
1331# CONFIG_RTC_DRV_ISL1208 is not set
1332# CONFIG_RTC_DRV_X1205 is not set
1172# CONFIG_RTC_DRV_PCF8563 is not set 1333# CONFIG_RTC_DRV_PCF8563 is not set
1334# CONFIG_RTC_DRV_PCF8583 is not set
1335# CONFIG_RTC_DRV_M41T80 is not set
1336# CONFIG_RTC_DRV_S35390A is not set
1337# CONFIG_RTC_DRV_FM3130 is not set
1338
1339#
1340# SPI RTC drivers
1341#
1342# CONFIG_RTC_DRV_MAX6902 is not set
1343# CONFIG_RTC_DRV_R9701 is not set
1173# CONFIG_RTC_DRV_RS5C348 is not set 1344# CONFIG_RTC_DRV_RS5C348 is not set
1174# CONFIG_RTC_DRV_RS5C372 is not set 1345
1175CONFIG_RTC_DRV_S3C=y 1346#
1347# Platform RTC drivers
1348#
1349# CONFIG_RTC_DRV_CMOS is not set
1350# CONFIG_RTC_DRV_DS1511 is not set
1351# CONFIG_RTC_DRV_DS1553 is not set
1352# CONFIG_RTC_DRV_DS1742 is not set
1353# CONFIG_RTC_DRV_STK17TA8 is not set
1176# CONFIG_RTC_DRV_M48T86 is not set 1354# CONFIG_RTC_DRV_M48T86 is not set
1177# CONFIG_RTC_DRV_TEST is not set 1355# CONFIG_RTC_DRV_M48T59 is not set
1178# CONFIG_RTC_DRV_MAX6902 is not set
1179# CONFIG_RTC_DRV_V3020 is not set 1356# CONFIG_RTC_DRV_V3020 is not set
1180 1357
1181# 1358#
1359# on-CPU RTC drivers
1360#
1361CONFIG_RTC_DRV_S3C=y
1362# CONFIG_UIO is not set
1363
1364#
1182# File systems 1365# File systems
1183# 1366#
1184CONFIG_EXT2_FS=y 1367CONFIG_EXT2_FS=y
1185# CONFIG_EXT2_FS_XATTR is not set 1368CONFIG_EXT2_FS_XATTR=y
1369CONFIG_EXT2_FS_POSIX_ACL=y
1370CONFIG_EXT2_FS_SECURITY=y
1186# CONFIG_EXT2_FS_XIP is not set 1371# CONFIG_EXT2_FS_XIP is not set
1187CONFIG_EXT3_FS=y 1372CONFIG_EXT3_FS=y
1188CONFIG_EXT3_FS_XATTR=y 1373CONFIG_EXT3_FS_XATTR=y
1189# CONFIG_EXT3_FS_POSIX_ACL is not set 1374CONFIG_EXT3_FS_POSIX_ACL=y
1190# CONFIG_EXT3_FS_SECURITY is not set 1375# CONFIG_EXT3_FS_SECURITY is not set
1191# CONFIG_EXT4DEV_FS is not set 1376# CONFIG_EXT4DEV_FS is not set
1192CONFIG_JBD=y 1377CONFIG_JBD=y
1193# CONFIG_JBD_DEBUG is not set
1194CONFIG_FS_MBCACHE=y 1378CONFIG_FS_MBCACHE=y
1195# CONFIG_REISERFS_FS is not set 1379# CONFIG_REISERFS_FS is not set
1196# CONFIG_JFS_FS is not set 1380# CONFIG_JFS_FS is not set
1197# CONFIG_FS_POSIX_ACL is not set 1381CONFIG_FS_POSIX_ACL=y
1198# CONFIG_XFS_FS is not set 1382# CONFIG_XFS_FS is not set
1199# CONFIG_GFS2_FS is not set
1200# CONFIG_OCFS2_FS is not set 1383# CONFIG_OCFS2_FS is not set
1201# CONFIG_MINIX_FS is not set 1384CONFIG_DNOTIFY=y
1202CONFIG_ROMFS_FS=y
1203CONFIG_INOTIFY=y 1385CONFIG_INOTIFY=y
1204CONFIG_INOTIFY_USER=y 1386CONFIG_INOTIFY_USER=y
1205# CONFIG_QUOTA is not set 1387# CONFIG_QUOTA is not set
1206CONFIG_DNOTIFY=y
1207# CONFIG_AUTOFS_FS is not set 1388# CONFIG_AUTOFS_FS is not set
1208# CONFIG_AUTOFS4_FS is not set 1389# CONFIG_AUTOFS4_FS is not set
1209# CONFIG_FUSE_FS is not set 1390# CONFIG_FUSE_FS is not set
1391CONFIG_GENERIC_ACL=y
1210 1392
1211# 1393#
1212# CD-ROM/DVD Filesystems 1394# CD-ROM/DVD Filesystems
1213# 1395#
1214# CONFIG_ISO9660_FS is not set 1396CONFIG_ISO9660_FS=y
1215# CONFIG_UDF_FS is not set 1397CONFIG_JOLIET=y
1398# CONFIG_ZISOFS is not set
1399CONFIG_UDF_FS=m
1400CONFIG_UDF_NLS=y
1216 1401
1217# 1402#
1218# DOS/FAT/NT Filesystems 1403# DOS/FAT/NT Filesystems
@@ -1222,7 +1407,9 @@ CONFIG_MSDOS_FS=y
1222CONFIG_VFAT_FS=y 1407CONFIG_VFAT_FS=y
1223CONFIG_FAT_DEFAULT_CODEPAGE=437 1408CONFIG_FAT_DEFAULT_CODEPAGE=437
1224CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1" 1409CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
1225# CONFIG_NTFS_FS is not set 1410CONFIG_NTFS_FS=m
1411# CONFIG_NTFS_DEBUG is not set
1412# CONFIG_NTFS_RW is not set
1226 1413
1227# 1414#
1228# Pseudo filesystems 1415# Pseudo filesystems
@@ -1230,10 +1417,10 @@ CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
1230CONFIG_PROC_FS=y 1417CONFIG_PROC_FS=y
1231CONFIG_PROC_SYSCTL=y 1418CONFIG_PROC_SYSCTL=y
1232CONFIG_SYSFS=y 1419CONFIG_SYSFS=y
1233# CONFIG_TMPFS is not set 1420CONFIG_TMPFS=y
1421CONFIG_TMPFS_POSIX_ACL=y
1234# CONFIG_HUGETLB_PAGE is not set 1422# CONFIG_HUGETLB_PAGE is not set
1235CONFIG_RAMFS=y 1423CONFIG_CONFIGFS_FS=m
1236# CONFIG_CONFIGFS_FS is not set
1237 1424
1238# 1425#
1239# Miscellaneous filesystems 1426# Miscellaneous filesystems
@@ -1248,31 +1435,32 @@ CONFIG_RAMFS=y
1248CONFIG_JFFS2_FS=y 1435CONFIG_JFFS2_FS=y
1249CONFIG_JFFS2_FS_DEBUG=0 1436CONFIG_JFFS2_FS_DEBUG=0
1250CONFIG_JFFS2_FS_WRITEBUFFER=y 1437CONFIG_JFFS2_FS_WRITEBUFFER=y
1251# CONFIG_JFFS2_SUMMARY is not set 1438# CONFIG_JFFS2_FS_WBUF_VERIFY is not set
1439CONFIG_JFFS2_SUMMARY=y
1252# CONFIG_JFFS2_FS_XATTR is not set 1440# CONFIG_JFFS2_FS_XATTR is not set
1253# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set 1441# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set
1254CONFIG_JFFS2_ZLIB=y 1442CONFIG_JFFS2_ZLIB=y
1443# CONFIG_JFFS2_LZO is not set
1255CONFIG_JFFS2_RTIME=y 1444CONFIG_JFFS2_RTIME=y
1256# CONFIG_JFFS2_RUBIN is not set 1445# CONFIG_JFFS2_RUBIN is not set
1257CONFIG_CRAMFS=y 1446CONFIG_CRAMFS=y
1258# CONFIG_VXFS_FS is not set 1447# CONFIG_VXFS_FS is not set
1448# CONFIG_MINIX_FS is not set
1259# CONFIG_HPFS_FS is not set 1449# CONFIG_HPFS_FS is not set
1260# CONFIG_QNX4FS_FS is not set 1450# CONFIG_QNX4FS_FS is not set
1451CONFIG_ROMFS_FS=y
1261# CONFIG_SYSV_FS is not set 1452# CONFIG_SYSV_FS is not set
1262# CONFIG_UFS_FS is not set 1453# CONFIG_UFS_FS is not set
1263 1454CONFIG_NETWORK_FILESYSTEMS=y
1264#
1265# Network File Systems
1266#
1267CONFIG_NFS_FS=y 1455CONFIG_NFS_FS=y
1268# CONFIG_NFS_V3 is not set 1456# CONFIG_NFS_V3 is not set
1269# CONFIG_NFS_V4 is not set 1457# CONFIG_NFS_V4 is not set
1270# CONFIG_NFS_DIRECTIO is not set
1271# CONFIG_NFSD is not set 1458# CONFIG_NFSD is not set
1272CONFIG_ROOT_NFS=y 1459CONFIG_ROOT_NFS=y
1273CONFIG_LOCKD=y 1460CONFIG_LOCKD=y
1274CONFIG_NFS_COMMON=y 1461CONFIG_NFS_COMMON=y
1275CONFIG_SUNRPC=y 1462CONFIG_SUNRPC=y
1463# CONFIG_SUNRPC_BIND34 is not set
1276# CONFIG_RPCSEC_GSS_KRB5 is not set 1464# CONFIG_RPCSEC_GSS_KRB5 is not set
1277# CONFIG_RPCSEC_GSS_SPKM3 is not set 1465# CONFIG_RPCSEC_GSS_SPKM3 is not set
1278# CONFIG_SMB_FS is not set 1466# CONFIG_SMB_FS is not set
@@ -1280,7 +1468,6 @@ CONFIG_SUNRPC=y
1280# CONFIG_NCP_FS is not set 1468# CONFIG_NCP_FS is not set
1281# CONFIG_CODA_FS is not set 1469# CONFIG_CODA_FS is not set
1282# CONFIG_AFS_FS is not set 1470# CONFIG_AFS_FS is not set
1283# CONFIG_9P_FS is not set
1284 1471
1285# 1472#
1286# Partition Types 1473# Partition Types
@@ -1302,94 +1489,93 @@ CONFIG_SOLARIS_X86_PARTITION=y
1302# CONFIG_SUN_PARTITION is not set 1489# CONFIG_SUN_PARTITION is not set
1303# CONFIG_KARMA_PARTITION is not set 1490# CONFIG_KARMA_PARTITION is not set
1304# CONFIG_EFI_PARTITION is not set 1491# CONFIG_EFI_PARTITION is not set
1305 1492# CONFIG_SYSV68_PARTITION is not set
1306#
1307# Native Language Support
1308#
1309CONFIG_NLS=y 1493CONFIG_NLS=y
1310CONFIG_NLS_DEFAULT="iso8859-1" 1494CONFIG_NLS_DEFAULT="iso8859-1"
1311# CONFIG_NLS_CODEPAGE_437 is not set 1495CONFIG_NLS_CODEPAGE_437=y
1312# CONFIG_NLS_CODEPAGE_737 is not set 1496CONFIG_NLS_CODEPAGE_737=m
1313# CONFIG_NLS_CODEPAGE_775 is not set 1497CONFIG_NLS_CODEPAGE_775=m
1314# CONFIG_NLS_CODEPAGE_850 is not set 1498CONFIG_NLS_CODEPAGE_850=y
1315# CONFIG_NLS_CODEPAGE_852 is not set 1499CONFIG_NLS_CODEPAGE_852=m
1316# CONFIG_NLS_CODEPAGE_855 is not set 1500CONFIG_NLS_CODEPAGE_855=m
1317# CONFIG_NLS_CODEPAGE_857 is not set 1501CONFIG_NLS_CODEPAGE_857=m
1318# CONFIG_NLS_CODEPAGE_860 is not set 1502CONFIG_NLS_CODEPAGE_860=m
1319# CONFIG_NLS_CODEPAGE_861 is not set 1503CONFIG_NLS_CODEPAGE_861=m
1320# CONFIG_NLS_CODEPAGE_862 is not set 1504CONFIG_NLS_CODEPAGE_862=m
1321# CONFIG_NLS_CODEPAGE_863 is not set 1505CONFIG_NLS_CODEPAGE_863=m
1322# CONFIG_NLS_CODEPAGE_864 is not set 1506CONFIG_NLS_CODEPAGE_864=m
1323# CONFIG_NLS_CODEPAGE_865 is not set 1507CONFIG_NLS_CODEPAGE_865=m
1324# CONFIG_NLS_CODEPAGE_866 is not set 1508CONFIG_NLS_CODEPAGE_866=m
1325# CONFIG_NLS_CODEPAGE_869 is not set 1509CONFIG_NLS_CODEPAGE_869=m
1326# CONFIG_NLS_CODEPAGE_936 is not set 1510CONFIG_NLS_CODEPAGE_936=m
1327# CONFIG_NLS_CODEPAGE_950 is not set 1511CONFIG_NLS_CODEPAGE_950=m
1328# CONFIG_NLS_CODEPAGE_932 is not set 1512CONFIG_NLS_CODEPAGE_932=m
1329# CONFIG_NLS_CODEPAGE_949 is not set 1513CONFIG_NLS_CODEPAGE_949=m
1330# CONFIG_NLS_CODEPAGE_874 is not set 1514CONFIG_NLS_CODEPAGE_874=m
1331# CONFIG_NLS_ISO8859_8 is not set 1515CONFIG_NLS_ISO8859_8=m
1332# CONFIG_NLS_CODEPAGE_1250 is not set 1516CONFIG_NLS_CODEPAGE_1250=m
1333# CONFIG_NLS_CODEPAGE_1251 is not set 1517CONFIG_NLS_CODEPAGE_1251=m
1334# CONFIG_NLS_ASCII is not set 1518CONFIG_NLS_ASCII=y
1335# CONFIG_NLS_ISO8859_1 is not set 1519CONFIG_NLS_ISO8859_1=y
1336# CONFIG_NLS_ISO8859_2 is not set 1520CONFIG_NLS_ISO8859_2=m
1337# CONFIG_NLS_ISO8859_3 is not set 1521CONFIG_NLS_ISO8859_3=m
1338# CONFIG_NLS_ISO8859_4 is not set 1522CONFIG_NLS_ISO8859_4=m
1339# CONFIG_NLS_ISO8859_5 is not set 1523CONFIG_NLS_ISO8859_5=m
1340# CONFIG_NLS_ISO8859_6 is not set 1524CONFIG_NLS_ISO8859_6=m
1341# CONFIG_NLS_ISO8859_7 is not set 1525CONFIG_NLS_ISO8859_7=m
1342# CONFIG_NLS_ISO8859_9 is not set 1526CONFIG_NLS_ISO8859_9=m
1343# CONFIG_NLS_ISO8859_13 is not set 1527CONFIG_NLS_ISO8859_13=m
1344# CONFIG_NLS_ISO8859_14 is not set 1528CONFIG_NLS_ISO8859_14=m
1345# CONFIG_NLS_ISO8859_15 is not set 1529CONFIG_NLS_ISO8859_15=m
1346# CONFIG_NLS_KOI8_R is not set 1530CONFIG_NLS_KOI8_R=m
1347# CONFIG_NLS_KOI8_U is not set 1531CONFIG_NLS_KOI8_U=m
1348# CONFIG_NLS_UTF8 is not set 1532CONFIG_NLS_UTF8=m
1349
1350#
1351# Distributed Lock Manager
1352#
1353# CONFIG_DLM is not set 1533# CONFIG_DLM is not set
1354 1534
1355# 1535#
1356# Profiling support
1357#
1358# CONFIG_PROFILING is not set
1359
1360#
1361# Kernel hacking 1536# Kernel hacking
1362# 1537#
1363# CONFIG_PRINTK_TIME is not set 1538# CONFIG_PRINTK_TIME is not set
1539CONFIG_ENABLE_WARN_DEPRECATED=y
1364CONFIG_ENABLE_MUST_CHECK=y 1540CONFIG_ENABLE_MUST_CHECK=y
1541CONFIG_FRAME_WARN=1024
1365CONFIG_MAGIC_SYSRQ=y 1542CONFIG_MAGIC_SYSRQ=y
1366# CONFIG_UNUSED_SYMBOLS is not set 1543# CONFIG_UNUSED_SYMBOLS is not set
1367# CONFIG_DEBUG_FS is not set 1544# CONFIG_DEBUG_FS is not set
1368# CONFIG_HEADERS_CHECK is not set 1545# CONFIG_HEADERS_CHECK is not set
1369CONFIG_DEBUG_KERNEL=y 1546CONFIG_DEBUG_KERNEL=y
1370# CONFIG_DEBUG_SHIRQ is not set 1547# CONFIG_DEBUG_SHIRQ is not set
1371CONFIG_LOG_BUF_SHIFT=16
1372CONFIG_DETECT_SOFTLOCKUP=y 1548CONFIG_DETECT_SOFTLOCKUP=y
1549CONFIG_SCHED_DEBUG=y
1373# CONFIG_SCHEDSTATS is not set 1550# CONFIG_SCHEDSTATS is not set
1374# CONFIG_TIMER_STATS is not set 1551# CONFIG_TIMER_STATS is not set
1552# CONFIG_DEBUG_OBJECTS is not set
1375# CONFIG_DEBUG_SLAB is not set 1553# CONFIG_DEBUG_SLAB is not set
1376# CONFIG_DEBUG_RT_MUTEXES is not set 1554# CONFIG_DEBUG_RT_MUTEXES is not set
1377# CONFIG_RT_MUTEX_TESTER is not set 1555# CONFIG_RT_MUTEX_TESTER is not set
1378# CONFIG_DEBUG_SPINLOCK is not set 1556# CONFIG_DEBUG_SPINLOCK is not set
1379CONFIG_DEBUG_MUTEXES=y 1557CONFIG_DEBUG_MUTEXES=y
1558# CONFIG_DEBUG_LOCK_ALLOC is not set
1559# CONFIG_PROVE_LOCKING is not set
1560# CONFIG_LOCK_STAT is not set
1380# CONFIG_DEBUG_SPINLOCK_SLEEP is not set 1561# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
1381# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set 1562# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
1382# CONFIG_DEBUG_KOBJECT is not set 1563# CONFIG_DEBUG_KOBJECT is not set
1383CONFIG_DEBUG_BUGVERBOSE=y 1564CONFIG_DEBUG_BUGVERBOSE=y
1384CONFIG_DEBUG_INFO=y 1565CONFIG_DEBUG_INFO=y
1385# CONFIG_DEBUG_VM is not set 1566# CONFIG_DEBUG_VM is not set
1567# CONFIG_DEBUG_WRITECOUNT is not set
1386# CONFIG_DEBUG_LIST is not set 1568# CONFIG_DEBUG_LIST is not set
1569# CONFIG_DEBUG_SG is not set
1387CONFIG_FRAME_POINTER=y 1570CONFIG_FRAME_POINTER=y
1388CONFIG_FORCED_INLINING=y 1571# CONFIG_BOOT_PRINTK_DELAY is not set
1389# CONFIG_RCU_TORTURE_TEST is not set 1572# CONFIG_RCU_TORTURE_TEST is not set
1573# CONFIG_BACKTRACE_SELF_TEST is not set
1390# CONFIG_FAULT_INJECTION is not set 1574# CONFIG_FAULT_INJECTION is not set
1575# CONFIG_SAMPLES is not set
1391CONFIG_DEBUG_USER=y 1576CONFIG_DEBUG_USER=y
1392# CONFIG_DEBUG_ERRORS is not set 1577CONFIG_DEBUG_ERRORS=y
1578# CONFIG_DEBUG_STACK_USAGE is not set
1393CONFIG_DEBUG_LL=y 1579CONFIG_DEBUG_LL=y
1394# CONFIG_DEBUG_ICEDCC is not set 1580# CONFIG_DEBUG_ICEDCC is not set
1395CONFIG_DEBUG_S3C_PORT=y 1581CONFIG_DEBUG_S3C_PORT=y
@@ -1400,21 +1586,100 @@ CONFIG_DEBUG_S3C_UART=0
1400# 1586#
1401# CONFIG_KEYS is not set 1587# CONFIG_KEYS is not set
1402# CONFIG_SECURITY is not set 1588# CONFIG_SECURITY is not set
1589# CONFIG_SECURITY_FILE_CAPABILITIES is not set
1590CONFIG_CRYPTO=y
1591
1592#
1593# Crypto core or helper
1594#
1595CONFIG_CRYPTO_ALGAPI=m
1596CONFIG_CRYPTO_AEAD=m
1597CONFIG_CRYPTO_BLKCIPHER=m
1598CONFIG_CRYPTO_HASH=m
1599CONFIG_CRYPTO_MANAGER=m
1600# CONFIG_CRYPTO_GF128MUL is not set
1601# CONFIG_CRYPTO_NULL is not set
1602# CONFIG_CRYPTO_CRYPTD is not set
1603CONFIG_CRYPTO_AUTHENC=m
1604# CONFIG_CRYPTO_TEST is not set
1605
1606#
1607# Authenticated Encryption with Associated Data
1608#
1609# CONFIG_CRYPTO_CCM is not set
1610# CONFIG_CRYPTO_GCM is not set
1611# CONFIG_CRYPTO_SEQIV is not set
1612
1613#
1614# Block modes
1615#
1616CONFIG_CRYPTO_CBC=m
1617# CONFIG_CRYPTO_CTR is not set
1618# CONFIG_CRYPTO_CTS is not set
1619CONFIG_CRYPTO_ECB=m
1620# CONFIG_CRYPTO_LRW is not set
1621# CONFIG_CRYPTO_PCBC is not set
1622# CONFIG_CRYPTO_XTS is not set
1623
1624#
1625# Hash modes
1626#
1627CONFIG_CRYPTO_HMAC=m
1628# CONFIG_CRYPTO_XCBC is not set
1629
1630#
1631# Digest
1632#
1633# CONFIG_CRYPTO_CRC32C is not set
1634# CONFIG_CRYPTO_MD4 is not set
1635CONFIG_CRYPTO_MD5=m
1636# CONFIG_CRYPTO_MICHAEL_MIC is not set
1637CONFIG_CRYPTO_SHA1=m
1638# CONFIG_CRYPTO_SHA256 is not set
1639# CONFIG_CRYPTO_SHA512 is not set
1640# CONFIG_CRYPTO_TGR192 is not set
1641# CONFIG_CRYPTO_WP512 is not set
1642
1643#
1644# Ciphers
1645#
1646CONFIG_CRYPTO_AES=m
1647# CONFIG_CRYPTO_ANUBIS is not set
1648CONFIG_CRYPTO_ARC4=m
1649# CONFIG_CRYPTO_BLOWFISH is not set
1650# CONFIG_CRYPTO_CAMELLIA is not set
1651# CONFIG_CRYPTO_CAST5 is not set
1652# CONFIG_CRYPTO_CAST6 is not set
1653CONFIG_CRYPTO_DES=m
1654# CONFIG_CRYPTO_FCRYPT is not set
1655# CONFIG_CRYPTO_KHAZAD is not set
1656# CONFIG_CRYPTO_SALSA20 is not set
1657# CONFIG_CRYPTO_SEED is not set
1658# CONFIG_CRYPTO_SERPENT is not set
1659# CONFIG_CRYPTO_TEA is not set
1660# CONFIG_CRYPTO_TWOFISH is not set
1403 1661
1404# 1662#
1405# Cryptographic options 1663# Compression
1406# 1664#
1407# CONFIG_CRYPTO is not set 1665CONFIG_CRYPTO_DEFLATE=m
1666# CONFIG_CRYPTO_LZO is not set
1667CONFIG_CRYPTO_HW=y
1408 1668
1409# 1669#
1410# Library routines 1670# Library routines
1411# 1671#
1412CONFIG_BITREVERSE=y 1672CONFIG_BITREVERSE=y
1673# CONFIG_GENERIC_FIND_FIRST_BIT is not set
1674# CONFIG_GENERIC_FIND_NEXT_BIT is not set
1413# CONFIG_CRC_CCITT is not set 1675# CONFIG_CRC_CCITT is not set
1414# CONFIG_CRC16 is not set 1676# CONFIG_CRC16 is not set
1677CONFIG_CRC_ITU_T=m
1415CONFIG_CRC32=y 1678CONFIG_CRC32=y
1679# CONFIG_CRC7 is not set
1416# CONFIG_LIBCRC32C is not set 1680# CONFIG_LIBCRC32C is not set
1417CONFIG_ZLIB_INFLATE=y 1681CONFIG_ZLIB_INFLATE=y
1418CONFIG_ZLIB_DEFLATE=y 1682CONFIG_ZLIB_DEFLATE=y
1419CONFIG_PLIST=y 1683CONFIG_PLIST=y
1420CONFIG_HAS_IOMEM=y 1684CONFIG_HAS_IOMEM=y
1685CONFIG_HAS_DMA=y
diff --git a/arch/arm/configs/sam9_l9260_defconfig b/arch/arm/configs/sam9_l9260_defconfig
index 484dc9739dfc..8688362bcf7b 100644
--- a/arch/arm/configs/sam9_l9260_defconfig
+++ b/arch/arm/configs/sam9_l9260_defconfig
@@ -211,7 +211,6 @@ CONFIG_ARM_THUMB=y
211# 211#
212# CONFIG_TICK_ONESHOT is not set 212# CONFIG_TICK_ONESHOT is not set
213CONFIG_PREEMPT=y 213CONFIG_PREEMPT=y
214# CONFIG_NO_IDLE_HZ is not set
215CONFIG_HZ=100 214CONFIG_HZ=100
216# CONFIG_AEABI is not set 215# CONFIG_AEABI is not set
217# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set 216# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set
diff --git a/arch/arm/configs/spitz_defconfig b/arch/arm/configs/spitz_defconfig
index aa7a01179500..7d59fb1f1cea 100644
--- a/arch/arm/configs/spitz_defconfig
+++ b/arch/arm/configs/spitz_defconfig
@@ -164,7 +164,6 @@ CONFIG_PCMCIA_PXA2XX=y
164# Kernel Features 164# Kernel Features
165# 165#
166CONFIG_PREEMPT=y 166CONFIG_PREEMPT=y
167# CONFIG_NO_IDLE_HZ is not set
168# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set 167# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set
169CONFIG_SELECT_MEMORY_MODEL=y 168CONFIG_SELECT_MEMORY_MODEL=y
170CONFIG_FLATMEM_MANUAL=y 169CONFIG_FLATMEM_MANUAL=y
diff --git a/arch/arm/configs/tct_hammer_defconfig b/arch/arm/configs/tct_hammer_defconfig
index 576b8339f0d6..07dfb98df4f0 100644
--- a/arch/arm/configs/tct_hammer_defconfig
+++ b/arch/arm/configs/tct_hammer_defconfig
@@ -247,7 +247,6 @@ CONFIG_ARM_THUMB=y
247# 247#
248# CONFIG_TICK_ONESHOT is not set 248# CONFIG_TICK_ONESHOT is not set
249# CONFIG_PREEMPT is not set 249# CONFIG_PREEMPT is not set
250# CONFIG_NO_IDLE_HZ is not set
251CONFIG_HZ=200 250CONFIG_HZ=200
252# CONFIG_AEABI is not set 251# CONFIG_AEABI is not set
253# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set 252# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set
diff --git a/arch/arm/configs/trizeps4_defconfig b/arch/arm/configs/trizeps4_defconfig
index 6db6392806f9..8b7a431a8bfc 100644
--- a/arch/arm/configs/trizeps4_defconfig
+++ b/arch/arm/configs/trizeps4_defconfig
@@ -195,7 +195,6 @@ CONFIG_PCMCIA_PXA2XX=y
195# Kernel Features 195# Kernel Features
196# 196#
197CONFIG_PREEMPT=y 197CONFIG_PREEMPT=y
198# CONFIG_NO_IDLE_HZ is not set
199CONFIG_HZ=100 198CONFIG_HZ=100
200CONFIG_AEABI=y 199CONFIG_AEABI=y
201CONFIG_OABI_COMPAT=y 200CONFIG_OABI_COMPAT=y
diff --git a/arch/arm/configs/usb-a9260_defconfig b/arch/arm/configs/usb-a9260_defconfig
new file mode 100644
index 000000000000..3680bd2df26d
--- /dev/null
+++ b/arch/arm/configs/usb-a9260_defconfig
@@ -0,0 +1,1142 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.24
4# Tue Apr 15 11:39:35 2008
5#
6CONFIG_ARM=y
7CONFIG_SYS_SUPPORTS_APM_EMULATION=y
8CONFIG_GENERIC_GPIO=y
9CONFIG_GENERIC_TIME=y
10CONFIG_GENERIC_CLOCKEVENTS=y
11CONFIG_MMU=y
12# CONFIG_NO_IOPORT is not set
13CONFIG_GENERIC_HARDIRQS=y
14CONFIG_STACKTRACE_SUPPORT=y
15CONFIG_LOCKDEP_SUPPORT=y
16CONFIG_TRACE_IRQFLAGS_SUPPORT=y
17CONFIG_HARDIRQS_SW_RESEND=y
18CONFIG_GENERIC_IRQ_PROBE=y
19CONFIG_RWSEM_GENERIC_SPINLOCK=y
20# CONFIG_ARCH_HAS_ILOG2_U32 is not set
21# CONFIG_ARCH_HAS_ILOG2_U64 is not set
22CONFIG_GENERIC_HWEIGHT=y
23CONFIG_GENERIC_CALIBRATE_DELAY=y
24CONFIG_ZONE_DMA=y
25CONFIG_VECTORS_BASE=0xffff0000
26CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
27
28#
29# General setup
30#
31CONFIG_EXPERIMENTAL=y
32CONFIG_BROKEN_ON_SMP=y
33CONFIG_INIT_ENV_ARG_LIMIT=32
34CONFIG_LOCALVERSION=""
35# CONFIG_LOCALVERSION_AUTO is not set
36# CONFIG_SWAP is not set
37CONFIG_SYSVIPC=y
38CONFIG_SYSVIPC_SYSCTL=y
39# CONFIG_POSIX_MQUEUE is not set
40# CONFIG_BSD_PROCESS_ACCT is not set
41# CONFIG_TASKSTATS is not set
42# CONFIG_USER_NS is not set
43# CONFIG_PID_NS is not set
44# CONFIG_AUDIT is not set
45# CONFIG_IKCONFIG is not set
46CONFIG_LOG_BUF_SHIFT=14
47# CONFIG_CGROUPS is not set
48CONFIG_FAIR_GROUP_SCHED=y
49CONFIG_FAIR_USER_SCHED=y
50# CONFIG_FAIR_CGROUP_SCHED is not set
51# CONFIG_SYSFS_DEPRECATED is not set
52# CONFIG_RELAY is not set
53# CONFIG_BLK_DEV_INITRD is not set
54# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
55CONFIG_SYSCTL=y
56# CONFIG_EMBEDDED is not set
57CONFIG_UID16=y
58CONFIG_SYSCTL_SYSCALL=y
59CONFIG_KALLSYMS=y
60# CONFIG_KALLSYMS_ALL is not set
61# CONFIG_KALLSYMS_EXTRA_PASS is not set
62CONFIG_HOTPLUG=y
63CONFIG_PRINTK=y
64CONFIG_BUG=y
65CONFIG_ELF_CORE=y
66CONFIG_BASE_FULL=y
67CONFIG_FUTEX=y
68CONFIG_ANON_INODES=y
69CONFIG_EPOLL=y
70CONFIG_SIGNALFD=y
71CONFIG_EVENTFD=y
72CONFIG_SHMEM=y
73CONFIG_VM_EVENT_COUNTERS=y
74CONFIG_SLAB=y
75# CONFIG_SLUB is not set
76# CONFIG_SLOB is not set
77CONFIG_SLABINFO=y
78CONFIG_RT_MUTEXES=y
79# CONFIG_TINY_SHMEM is not set
80CONFIG_BASE_SMALL=0
81CONFIG_MODULES=y
82CONFIG_MODULE_UNLOAD=y
83# CONFIG_MODULE_FORCE_UNLOAD is not set
84# CONFIG_MODVERSIONS is not set
85# CONFIG_MODULE_SRCVERSION_ALL is not set
86CONFIG_KMOD=y
87CONFIG_BLOCK=y
88# CONFIG_LBD is not set
89# CONFIG_BLK_DEV_IO_TRACE is not set
90# CONFIG_LSF is not set
91# CONFIG_BLK_DEV_BSG is not set
92
93#
94# IO Schedulers
95#
96CONFIG_IOSCHED_NOOP=y
97CONFIG_IOSCHED_AS=y
98# CONFIG_IOSCHED_DEADLINE is not set
99# CONFIG_IOSCHED_CFQ is not set
100CONFIG_DEFAULT_AS=y
101# CONFIG_DEFAULT_DEADLINE is not set
102# CONFIG_DEFAULT_CFQ is not set
103# CONFIG_DEFAULT_NOOP is not set
104CONFIG_DEFAULT_IOSCHED="anticipatory"
105
106#
107# System Type
108#
109# CONFIG_ARCH_AAEC2000 is not set
110# CONFIG_ARCH_INTEGRATOR is not set
111# CONFIG_ARCH_REALVIEW is not set
112# CONFIG_ARCH_VERSATILE is not set
113CONFIG_ARCH_AT91=y
114# CONFIG_ARCH_CLPS7500 is not set
115# CONFIG_ARCH_CLPS711X is not set
116# CONFIG_ARCH_CO285 is not set
117# CONFIG_ARCH_EBSA110 is not set
118# CONFIG_ARCH_EP93XX is not set
119# CONFIG_ARCH_FOOTBRIDGE is not set
120# CONFIG_ARCH_NETX is not set
121# CONFIG_ARCH_H720X is not set
122# CONFIG_ARCH_IMX is not set
123# CONFIG_ARCH_IOP13XX is not set
124# CONFIG_ARCH_IOP32X is not set
125# CONFIG_ARCH_IOP33X is not set
126# CONFIG_ARCH_IXP23XX is not set
127# CONFIG_ARCH_IXP2000 is not set
128# CONFIG_ARCH_IXP4XX is not set
129# CONFIG_ARCH_L7200 is not set
130# CONFIG_ARCH_KS8695 is not set
131# CONFIG_ARCH_NS9XXX is not set
132# CONFIG_ARCH_MXC is not set
133# CONFIG_ARCH_PNX4008 is not set
134# CONFIG_ARCH_PXA is not set
135# CONFIG_ARCH_RPC is not set
136# CONFIG_ARCH_SA1100 is not set
137# CONFIG_ARCH_S3C2410 is not set
138# CONFIG_ARCH_SHARK is not set
139# CONFIG_ARCH_LH7A40X is not set
140# CONFIG_ARCH_DAVINCI is not set
141# CONFIG_ARCH_OMAP is not set
142
143#
144# Boot options
145#
146
147#
148# Power management
149#
150
151#
152# Atmel AT91 System-on-Chip
153#
154# CONFIG_ARCH_AT91RM9200 is not set
155CONFIG_ARCH_AT91SAM9260=y
156# CONFIG_ARCH_AT91SAM9261 is not set
157# CONFIG_ARCH_AT91SAM9263 is not set
158# CONFIG_ARCH_AT91SAM9RL is not set
159# CONFIG_ARCH_AT91CAP9 is not set
160# CONFIG_ARCH_AT91X40 is not set
161CONFIG_AT91_PMC_UNIT=y
162
163#
164# AT91SAM9260 Variants
165#
166# CONFIG_ARCH_AT91SAM9260_SAM9XE is not set
167
168#
169# AT91SAM9260 / AT91SAM9XE Board Type
170#
171# CONFIG_MACH_AT91SAM9260EK is not set
172# CONFIG_MACH_CAM60 is not set
173# CONFIG_MACH_SAM9_L9260 is not set
174CONFIG_MACH_USB_A9260=y
175# CONFIG_MACH_QIL_A9260 is not set
176
177#
178# AT91 Board Options
179#
180
181#
182# AT91 Feature Selections
183#
184# CONFIG_AT91_PROGRAMMABLE_CLOCKS is not set
185CONFIG_AT91_SLOW_CLOCK=y
186CONFIG_AT91_TIMER_HZ=100
187CONFIG_AT91_EARLY_DBGU=y
188# CONFIG_AT91_EARLY_USART0 is not set
189# CONFIG_AT91_EARLY_USART1 is not set
190# CONFIG_AT91_EARLY_USART2 is not set
191# CONFIG_AT91_EARLY_USART3 is not set
192# CONFIG_AT91_EARLY_USART4 is not set
193# CONFIG_AT91_EARLY_USART5 is not set
194
195#
196# Processor Type
197#
198CONFIG_CPU_32=y
199CONFIG_CPU_ARM926T=y
200CONFIG_CPU_32v5=y
201CONFIG_CPU_ABRT_EV5TJ=y
202CONFIG_CPU_CACHE_VIVT=y
203CONFIG_CPU_COPY_V4WB=y
204CONFIG_CPU_TLB_V4WBI=y
205CONFIG_CPU_CP15=y
206CONFIG_CPU_CP15_MMU=y
207
208#
209# Processor Features
210#
211# CONFIG_ARM_THUMB is not set
212# CONFIG_CPU_ICACHE_DISABLE is not set
213# CONFIG_CPU_DCACHE_DISABLE is not set
214# CONFIG_CPU_DCACHE_WRITETHROUGH is not set
215# CONFIG_CPU_CACHE_ROUND_ROBIN is not set
216# CONFIG_OUTER_CACHE is not set
217
218#
219# Bus support
220#
221# CONFIG_PCI_SYSCALL is not set
222# CONFIG_ARCH_SUPPORTS_MSI is not set
223# CONFIG_PCCARD is not set
224
225#
226# Kernel Features
227#
228# CONFIG_TICK_ONESHOT is not set
229# CONFIG_NO_HZ is not set
230# CONFIG_HIGH_RES_TIMERS is not set
231CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
232# CONFIG_PREEMPT is not set
233CONFIG_HZ=100
234CONFIG_AEABI=y
235CONFIG_OABI_COMPAT=y
236# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set
237CONFIG_SELECT_MEMORY_MODEL=y
238CONFIG_FLATMEM_MANUAL=y
239# CONFIG_DISCONTIGMEM_MANUAL is not set
240# CONFIG_SPARSEMEM_MANUAL is not set
241CONFIG_FLATMEM=y
242CONFIG_FLAT_NODE_MEM_MAP=y
243# CONFIG_SPARSEMEM_STATIC is not set
244# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
245CONFIG_SPLIT_PTLOCK_CPUS=4096
246# CONFIG_RESOURCES_64BIT is not set
247CONFIG_ZONE_DMA_FLAG=1
248CONFIG_BOUNCE=y
249CONFIG_VIRT_TO_BUS=y
250# CONFIG_LEDS is not set
251CONFIG_ALIGNMENT_TRAP=y
252
253#
254# Boot options
255#
256CONFIG_ZBOOT_ROM_TEXT=0x0
257CONFIG_ZBOOT_ROM_BSS=0x0
258CONFIG_CMDLINE="mem=64M console=ttyS0,115200"
259# CONFIG_XIP_KERNEL is not set
260# CONFIG_KEXEC is not set
261
262#
263# Floating point emulation
264#
265
266#
267# At least one emulation must be selected
268#
269CONFIG_FPE_NWFPE=y
270# CONFIG_FPE_NWFPE_XP is not set
271# CONFIG_FPE_FASTFPE is not set
272# CONFIG_VFP is not set
273
274#
275# Userspace binary formats
276#
277CONFIG_BINFMT_ELF=y
278# CONFIG_BINFMT_AOUT is not set
279# CONFIG_BINFMT_MISC is not set
280
281#
282# Power management options
283#
284CONFIG_PM=y
285# CONFIG_PM_LEGACY is not set
286# CONFIG_PM_DEBUG is not set
287CONFIG_PM_SLEEP=y
288CONFIG_SUSPEND_UP_POSSIBLE=y
289CONFIG_SUSPEND=y
290# CONFIG_APM_EMULATION is not set
291
292#
293# Networking
294#
295CONFIG_NET=y
296
297#
298# Networking options
299#
300CONFIG_PACKET=y
301# CONFIG_PACKET_MMAP is not set
302CONFIG_UNIX=y
303# CONFIG_NET_KEY is not set
304CONFIG_INET=y
305CONFIG_IP_MULTICAST=y
306CONFIG_IP_ADVANCED_ROUTER=y
307CONFIG_ASK_IP_FIB_HASH=y
308# CONFIG_IP_FIB_TRIE is not set
309CONFIG_IP_FIB_HASH=y
310# CONFIG_IP_MULTIPLE_TABLES is not set
311# CONFIG_IP_ROUTE_MULTIPATH is not set
312CONFIG_IP_ROUTE_VERBOSE=y
313CONFIG_IP_PNP=y
314# CONFIG_IP_PNP_DHCP is not set
315CONFIG_IP_PNP_BOOTP=y
316CONFIG_IP_PNP_RARP=y
317# CONFIG_NET_IPIP is not set
318# CONFIG_NET_IPGRE is not set
319CONFIG_IP_MROUTE=y
320CONFIG_IP_PIMSM_V1=y
321CONFIG_IP_PIMSM_V2=y
322# CONFIG_ARPD is not set
323# CONFIG_SYN_COOKIES is not set
324# CONFIG_INET_AH is not set
325# CONFIG_INET_ESP is not set
326# CONFIG_INET_IPCOMP is not set
327# CONFIG_INET_XFRM_TUNNEL is not set
328# CONFIG_INET_TUNNEL is not set
329# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
330# CONFIG_INET_XFRM_MODE_TUNNEL is not set
331# CONFIG_INET_XFRM_MODE_BEET is not set
332# CONFIG_INET_LRO is not set
333# CONFIG_INET_DIAG is not set
334# CONFIG_TCP_CONG_ADVANCED is not set
335CONFIG_TCP_CONG_CUBIC=y
336CONFIG_DEFAULT_TCP_CONG="cubic"
337# CONFIG_TCP_MD5SIG is not set
338# CONFIG_IPV6 is not set
339# CONFIG_INET6_XFRM_TUNNEL is not set
340# CONFIG_INET6_TUNNEL is not set
341# CONFIG_NETWORK_SECMARK is not set
342# CONFIG_NETFILTER is not set
343# CONFIG_IP_DCCP is not set
344# CONFIG_IP_SCTP is not set
345# CONFIG_TIPC is not set
346# CONFIG_ATM is not set
347# CONFIG_BRIDGE is not set
348# CONFIG_VLAN_8021Q is not set
349# CONFIG_DECNET is not set
350# CONFIG_LLC2 is not set
351# CONFIG_IPX is not set
352# CONFIG_ATALK is not set
353# CONFIG_X25 is not set
354# CONFIG_LAPB is not set
355# CONFIG_ECONET is not set
356# CONFIG_WAN_ROUTER is not set
357# CONFIG_NET_SCHED is not set
358
359#
360# Network testing
361#
362# CONFIG_NET_PKTGEN is not set
363# CONFIG_HAMRADIO is not set
364# CONFIG_IRDA is not set
365# CONFIG_BT is not set
366# CONFIG_AF_RXRPC is not set
367
368#
369# Wireless
370#
371# CONFIG_CFG80211 is not set
372# CONFIG_WIRELESS_EXT is not set
373# CONFIG_MAC80211 is not set
374# CONFIG_IEEE80211 is not set
375# CONFIG_RFKILL is not set
376# CONFIG_NET_9P is not set
377
378#
379# Device Drivers
380#
381
382#
383# Generic Driver Options
384#
385CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
386CONFIG_STANDALONE=y
387CONFIG_PREVENT_FIRMWARE_BUILD=y
388# CONFIG_FW_LOADER is not set
389# CONFIG_DEBUG_DRIVER is not set
390# CONFIG_DEBUG_DEVRES is not set
391# CONFIG_SYS_HYPERVISOR is not set
392# CONFIG_CONNECTOR is not set
393CONFIG_MTD=y
394# CONFIG_MTD_DEBUG is not set
395# CONFIG_MTD_CONCAT is not set
396CONFIG_MTD_PARTITIONS=y
397# CONFIG_MTD_REDBOOT_PARTS is not set
398CONFIG_MTD_CMDLINE_PARTS=y
399# CONFIG_MTD_AFS_PARTS is not set
400
401#
402# User Modules And Translation Layers
403#
404CONFIG_MTD_CHAR=y
405CONFIG_MTD_BLKDEVS=y
406CONFIG_MTD_BLOCK=y
407# CONFIG_FTL is not set
408# CONFIG_NFTL is not set
409# CONFIG_INFTL is not set
410# CONFIG_RFD_FTL is not set
411# CONFIG_SSFDC is not set
412# CONFIG_MTD_OOPS is not set
413
414#
415# RAM/ROM/Flash chip drivers
416#
417# CONFIG_MTD_CFI is not set
418# CONFIG_MTD_JEDECPROBE is not set
419CONFIG_MTD_MAP_BANK_WIDTH_1=y
420CONFIG_MTD_MAP_BANK_WIDTH_2=y
421CONFIG_MTD_MAP_BANK_WIDTH_4=y
422# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
423# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
424# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
425CONFIG_MTD_CFI_I1=y
426CONFIG_MTD_CFI_I2=y
427# CONFIG_MTD_CFI_I4 is not set
428# CONFIG_MTD_CFI_I8 is not set
429# CONFIG_MTD_RAM is not set
430# CONFIG_MTD_ROM is not set
431# CONFIG_MTD_ABSENT is not set
432
433#
434# Mapping drivers for chip access
435#
436# CONFIG_MTD_COMPLEX_MAPPINGS is not set
437# CONFIG_MTD_PLATRAM is not set
438
439#
440# Self-contained MTD device drivers
441#
442CONFIG_MTD_DATAFLASH=y
443# CONFIG_MTD_M25P80 is not set
444# CONFIG_MTD_SLRAM is not set
445# CONFIG_MTD_PHRAM is not set
446# CONFIG_MTD_MTDRAM is not set
447# CONFIG_MTD_BLOCK2MTD is not set
448
449#
450# Disk-On-Chip Device Drivers
451#
452# CONFIG_MTD_DOC2000 is not set
453# CONFIG_MTD_DOC2001 is not set
454# CONFIG_MTD_DOC2001PLUS is not set
455CONFIG_MTD_NAND=y
456# CONFIG_MTD_NAND_VERIFY_WRITE is not set
457# CONFIG_MTD_NAND_ECC_SMC is not set
458# CONFIG_MTD_NAND_MUSEUM_IDS is not set
459CONFIG_MTD_NAND_IDS=y
460# CONFIG_MTD_NAND_DISKONCHIP is not set
461CONFIG_MTD_NAND_AT91=y
462CONFIG_MTD_NAND_AT91_ECC_SOFT=y
463# CONFIG_MTD_NAND_AT91_ECC_HW is not set
464# CONFIG_MTD_NAND_AT91_ECC_NONE is not set
465# CONFIG_MTD_NAND_NANDSIM is not set
466# CONFIG_MTD_NAND_PLATFORM is not set
467# CONFIG_MTD_ALAUDA is not set
468# CONFIG_MTD_ONENAND is not set
469
470#
471# UBI - Unsorted block images
472#
473# CONFIG_MTD_UBI is not set
474# CONFIG_PARPORT is not set
475CONFIG_BLK_DEV=y
476# CONFIG_BLK_DEV_COW_COMMON is not set
477CONFIG_BLK_DEV_LOOP=y
478# CONFIG_BLK_DEV_CRYPTOLOOP is not set
479# CONFIG_BLK_DEV_NBD is not set
480# CONFIG_BLK_DEV_UB is not set
481# CONFIG_BLK_DEV_RAM is not set
482# CONFIG_CDROM_PKTCDVD is not set
483# CONFIG_ATA_OVER_ETH is not set
484# CONFIG_MISC_DEVICES is not set
485
486#
487# SCSI device support
488#
489# CONFIG_RAID_ATTRS is not set
490CONFIG_SCSI=y
491CONFIG_SCSI_DMA=y
492# CONFIG_SCSI_TGT is not set
493# CONFIG_SCSI_NETLINK is not set
494CONFIG_SCSI_PROC_FS=y
495
496#
497# SCSI support type (disk, tape, CD-ROM)
498#
499CONFIG_BLK_DEV_SD=y
500# CONFIG_CHR_DEV_ST is not set
501# CONFIG_CHR_DEV_OSST is not set
502# CONFIG_BLK_DEV_SR is not set
503# CONFIG_CHR_DEV_SG is not set
504# CONFIG_CHR_DEV_SCH is not set
505
506#
507# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
508#
509CONFIG_SCSI_MULTI_LUN=y
510# CONFIG_SCSI_CONSTANTS is not set
511# CONFIG_SCSI_LOGGING is not set
512# CONFIG_SCSI_SCAN_ASYNC is not set
513CONFIG_SCSI_WAIT_SCAN=m
514
515#
516# SCSI Transports
517#
518# CONFIG_SCSI_SPI_ATTRS is not set
519# CONFIG_SCSI_FC_ATTRS is not set
520# CONFIG_SCSI_ISCSI_ATTRS is not set
521# CONFIG_SCSI_SAS_LIBSAS is not set
522# CONFIG_SCSI_SRP_ATTRS is not set
523CONFIG_SCSI_LOWLEVEL=y
524# CONFIG_ISCSI_TCP is not set
525# CONFIG_SCSI_DEBUG is not set
526# CONFIG_ATA is not set
527# CONFIG_MD is not set
528CONFIG_NETDEVICES=y
529# CONFIG_NETDEVICES_MULTIQUEUE is not set
530# CONFIG_DUMMY is not set
531# CONFIG_BONDING is not set
532# CONFIG_MACVLAN is not set
533# CONFIG_EQUALIZER is not set
534# CONFIG_TUN is not set
535# CONFIG_VETH is not set
536CONFIG_PHYLIB=y
537
538#
539# MII PHY device drivers
540#
541# CONFIG_MARVELL_PHY is not set
542# CONFIG_DAVICOM_PHY is not set
543# CONFIG_QSEMI_PHY is not set
544# CONFIG_LXT_PHY is not set
545# CONFIG_CICADA_PHY is not set
546# CONFIG_VITESSE_PHY is not set
547# CONFIG_SMSC_PHY is not set
548# CONFIG_BROADCOM_PHY is not set
549# CONFIG_ICPLUS_PHY is not set
550# CONFIG_FIXED_PHY is not set
551# CONFIG_MDIO_BITBANG is not set
552CONFIG_NET_ETHERNET=y
553CONFIG_MII=y
554CONFIG_MACB=y
555# CONFIG_AX88796 is not set
556# CONFIG_SMC91X is not set
557# CONFIG_DM9000 is not set
558# CONFIG_IBM_NEW_EMAC_ZMII is not set
559# CONFIG_IBM_NEW_EMAC_RGMII is not set
560# CONFIG_IBM_NEW_EMAC_TAH is not set
561# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
562# CONFIG_B44 is not set
563CONFIG_NETDEV_1000=y
564CONFIG_NETDEV_10000=y
565
566#
567# Wireless LAN
568#
569# CONFIG_WLAN_PRE80211 is not set
570# CONFIG_WLAN_80211 is not set
571
572#
573# USB Network Adapters
574#
575# CONFIG_USB_CATC is not set
576# CONFIG_USB_KAWETH is not set
577# CONFIG_USB_PEGASUS is not set
578# CONFIG_USB_RTL8150 is not set
579# CONFIG_USB_USBNET is not set
580# CONFIG_WAN is not set
581# CONFIG_PPP is not set
582# CONFIG_SLIP is not set
583# CONFIG_SHAPER is not set
584# CONFIG_NETCONSOLE is not set
585# CONFIG_NETPOLL is not set
586# CONFIG_NET_POLL_CONTROLLER is not set
587# CONFIG_ISDN is not set
588
589#
590# Input device support
591#
592CONFIG_INPUT=y
593# CONFIG_INPUT_FF_MEMLESS is not set
594# CONFIG_INPUT_POLLDEV is not set
595
596#
597# Userland interfaces
598#
599CONFIG_INPUT_MOUSEDEV=y
600# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
601CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
602CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
603# CONFIG_INPUT_JOYDEV is not set
604CONFIG_INPUT_EVDEV=y
605CONFIG_INPUT_EVBUG=y
606
607#
608# Input Device Drivers
609#
610CONFIG_INPUT_KEYBOARD=y
611# CONFIG_KEYBOARD_ATKBD is not set
612# CONFIG_KEYBOARD_SUNKBD is not set
613# CONFIG_KEYBOARD_LKKBD is not set
614# CONFIG_KEYBOARD_XTKBD is not set
615# CONFIG_KEYBOARD_NEWTON is not set
616# CONFIG_KEYBOARD_STOWAWAY is not set
617CONFIG_KEYBOARD_GPIO=y
618# CONFIG_INPUT_MOUSE is not set
619# CONFIG_INPUT_JOYSTICK is not set
620# CONFIG_INPUT_TABLET is not set
621# CONFIG_INPUT_TOUCHSCREEN is not set
622# CONFIG_INPUT_MISC is not set
623
624#
625# Hardware I/O ports
626#
627# CONFIG_SERIO is not set
628# CONFIG_GAMEPORT is not set
629
630#
631# Character devices
632#
633CONFIG_VT=y
634CONFIG_VT_CONSOLE=y
635CONFIG_HW_CONSOLE=y
636# CONFIG_VT_HW_CONSOLE_BINDING is not set
637# CONFIG_SERIAL_NONSTANDARD is not set
638
639#
640# Serial drivers
641#
642# CONFIG_SERIAL_8250 is not set
643
644#
645# Non-8250 serial port support
646#
647CONFIG_SERIAL_ATMEL=y
648CONFIG_SERIAL_ATMEL_CONSOLE=y
649# CONFIG_SERIAL_ATMEL_TTYAT is not set
650CONFIG_SERIAL_CORE=y
651CONFIG_SERIAL_CORE_CONSOLE=y
652CONFIG_UNIX98_PTYS=y
653CONFIG_LEGACY_PTYS=y
654CONFIG_LEGACY_PTY_COUNT=256
655# CONFIG_IPMI_HANDLER is not set
656CONFIG_HW_RANDOM=y
657# CONFIG_NVRAM is not set
658# CONFIG_R3964 is not set
659# CONFIG_RAW_DRIVER is not set
660# CONFIG_TCG_TPM is not set
661# CONFIG_I2C is not set
662
663#
664# SPI support
665#
666CONFIG_SPI=y
667# CONFIG_SPI_DEBUG is not set
668CONFIG_SPI_MASTER=y
669
670#
671# SPI Master Controller Drivers
672#
673CONFIG_SPI_ATMEL=y
674# CONFIG_SPI_BITBANG is not set
675
676#
677# SPI Protocol Masters
678#
679# CONFIG_SPI_AT25 is not set
680# CONFIG_SPI_SPIDEV is not set
681# CONFIG_SPI_TLE62X0 is not set
682# CONFIG_W1 is not set
683# CONFIG_POWER_SUPPLY is not set
684# CONFIG_HWMON is not set
685# CONFIG_WATCHDOG is not set
686
687#
688# Sonics Silicon Backplane
689#
690CONFIG_SSB_POSSIBLE=y
691# CONFIG_SSB is not set
692
693#
694# Multifunction device drivers
695#
696# CONFIG_MFD_SM501 is not set
697
698#
699# Multimedia devices
700#
701# CONFIG_VIDEO_DEV is not set
702# CONFIG_DVB_CORE is not set
703# CONFIG_DAB is not set
704
705#
706# Graphics support
707#
708# CONFIG_VGASTATE is not set
709# CONFIG_VIDEO_OUTPUT_CONTROL is not set
710# CONFIG_FB is not set
711# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
712
713#
714# Display device support
715#
716# CONFIG_DISPLAY_SUPPORT is not set
717
718#
719# Console display driver support
720#
721# CONFIG_VGA_CONSOLE is not set
722CONFIG_DUMMY_CONSOLE=y
723
724#
725# Sound
726#
727# CONFIG_SOUND is not set
728CONFIG_HID_SUPPORT=y
729CONFIG_HID=y
730# CONFIG_HID_DEBUG is not set
731# CONFIG_HIDRAW is not set
732
733#
734# USB Input Devices
735#
736# CONFIG_USB_HID is not set
737
738#
739# USB HID Boot Protocol drivers
740#
741# CONFIG_USB_KBD is not set
742# CONFIG_USB_MOUSE is not set
743CONFIG_USB_SUPPORT=y
744CONFIG_USB_ARCH_HAS_HCD=y
745CONFIG_USB_ARCH_HAS_OHCI=y
746# CONFIG_USB_ARCH_HAS_EHCI is not set
747CONFIG_USB=y
748# CONFIG_USB_DEBUG is not set
749
750#
751# Miscellaneous USB options
752#
753CONFIG_USB_DEVICEFS=y
754CONFIG_USB_DEVICE_CLASS=y
755# CONFIG_USB_DYNAMIC_MINORS is not set
756# CONFIG_USB_SUSPEND is not set
757# CONFIG_USB_PERSIST is not set
758# CONFIG_USB_OTG is not set
759
760#
761# USB Host Controller Drivers
762#
763# CONFIG_USB_ISP116X_HCD is not set
764CONFIG_USB_OHCI_HCD=y
765# CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set
766# CONFIG_USB_OHCI_BIG_ENDIAN_MMIO is not set
767CONFIG_USB_OHCI_LITTLE_ENDIAN=y
768# CONFIG_USB_SL811_HCD is not set
769# CONFIG_USB_R8A66597_HCD is not set
770
771#
772# USB Device Class drivers
773#
774# CONFIG_USB_ACM is not set
775# CONFIG_USB_PRINTER is not set
776
777#
778# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
779#
780
781#
782# may also be needed; see USB_STORAGE Help for more information
783#
784CONFIG_USB_STORAGE=y
785# CONFIG_USB_STORAGE_DEBUG is not set
786# CONFIG_USB_STORAGE_DATAFAB is not set
787# CONFIG_USB_STORAGE_FREECOM is not set
788# CONFIG_USB_STORAGE_ISD200 is not set
789# CONFIG_USB_STORAGE_DPCM is not set
790# CONFIG_USB_STORAGE_USBAT is not set
791# CONFIG_USB_STORAGE_SDDR09 is not set
792# CONFIG_USB_STORAGE_SDDR55 is not set
793# CONFIG_USB_STORAGE_JUMPSHOT is not set
794# CONFIG_USB_STORAGE_ALAUDA is not set
795# CONFIG_USB_STORAGE_KARMA is not set
796# CONFIG_USB_LIBUSUAL is not set
797
798#
799# USB Imaging devices
800#
801# CONFIG_USB_MDC800 is not set
802# CONFIG_USB_MICROTEK is not set
803CONFIG_USB_MON=y
804
805#
806# USB port drivers
807#
808
809#
810# USB Serial Converter support
811#
812# CONFIG_USB_SERIAL is not set
813
814#
815# USB Miscellaneous drivers
816#
817# CONFIG_USB_EMI62 is not set
818# CONFIG_USB_EMI26 is not set
819# CONFIG_USB_ADUTUX is not set
820# CONFIG_USB_AUERSWALD is not set
821# CONFIG_USB_RIO500 is not set
822# CONFIG_USB_LEGOTOWER is not set
823# CONFIG_USB_LCD is not set
824# CONFIG_USB_BERRY_CHARGE is not set
825# CONFIG_USB_LED is not set
826# CONFIG_USB_CYPRESS_CY7C63 is not set
827# CONFIG_USB_CYTHERM is not set
828# CONFIG_USB_PHIDGET is not set
829# CONFIG_USB_IDMOUSE is not set
830# CONFIG_USB_FTDI_ELAN is not set
831# CONFIG_USB_APPLEDISPLAY is not set
832# CONFIG_USB_LD is not set
833# CONFIG_USB_TRANCEVIBRATOR is not set
834# CONFIG_USB_IOWARRIOR is not set
835# CONFIG_USB_TEST is not set
836
837#
838# USB DSL modem support
839#
840
841#
842# USB Gadget Support
843#
844CONFIG_USB_GADGET=y
845# CONFIG_USB_GADGET_DEBUG is not set
846# CONFIG_USB_GADGET_DEBUG_FILES is not set
847CONFIG_USB_GADGET_SELECTED=y
848# CONFIG_USB_GADGET_AMD5536UDC is not set
849# CONFIG_USB_GADGET_ATMEL_USBA is not set
850# CONFIG_USB_GADGET_FSL_USB2 is not set
851# CONFIG_USB_GADGET_NET2280 is not set
852# CONFIG_USB_GADGET_PXA2XX is not set
853# CONFIG_USB_GADGET_M66592 is not set
854# CONFIG_USB_GADGET_GOKU is not set
855# CONFIG_USB_GADGET_LH7A40X is not set
856# CONFIG_USB_GADGET_OMAP is not set
857# CONFIG_USB_GADGET_S3C2410 is not set
858CONFIG_USB_GADGET_AT91=y
859CONFIG_USB_AT91=y
860# CONFIG_USB_GADGET_DUMMY_HCD is not set
861# CONFIG_USB_GADGET_DUALSPEED is not set
862# CONFIG_USB_ZERO is not set
863CONFIG_USB_ETH=y
864CONFIG_USB_ETH_RNDIS=y
865# CONFIG_USB_GADGETFS is not set
866# CONFIG_USB_FILE_STORAGE is not set
867# CONFIG_USB_G_SERIAL is not set
868# CONFIG_USB_MIDI_GADGET is not set
869# CONFIG_MMC is not set
870CONFIG_NEW_LEDS=y
871CONFIG_LEDS_CLASS=y
872
873#
874# LED drivers
875#
876CONFIG_LEDS_GPIO=y
877
878#
879# LED Triggers
880#
881CONFIG_LEDS_TRIGGERS=y
882# CONFIG_LEDS_TRIGGER_TIMER is not set
883CONFIG_LEDS_TRIGGER_HEARTBEAT=y
884CONFIG_RTC_LIB=y
885# CONFIG_RTC_CLASS is not set
886
887#
888# File systems
889#
890CONFIG_EXT2_FS=y
891# CONFIG_EXT2_FS_XATTR is not set
892# CONFIG_EXT2_FS_XIP is not set
893# CONFIG_EXT3_FS is not set
894# CONFIG_EXT4DEV_FS is not set
895# CONFIG_REISERFS_FS is not set
896# CONFIG_JFS_FS is not set
897CONFIG_FS_POSIX_ACL=y
898# CONFIG_XFS_FS is not set
899# CONFIG_GFS2_FS is not set
900# CONFIG_OCFS2_FS is not set
901# CONFIG_MINIX_FS is not set
902# CONFIG_ROMFS_FS is not set
903CONFIG_INOTIFY=y
904CONFIG_INOTIFY_USER=y
905# CONFIG_QUOTA is not set
906CONFIG_DNOTIFY=y
907# CONFIG_AUTOFS_FS is not set
908# CONFIG_AUTOFS4_FS is not set
909CONFIG_FUSE_FS=m
910
911#
912# CD-ROM/DVD Filesystems
913#
914# CONFIG_ISO9660_FS is not set
915# CONFIG_UDF_FS is not set
916
917#
918# DOS/FAT/NT Filesystems
919#
920CONFIG_FAT_FS=y
921# CONFIG_MSDOS_FS is not set
922CONFIG_VFAT_FS=y
923CONFIG_FAT_DEFAULT_CODEPAGE=437
924CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
925# CONFIG_NTFS_FS is not set
926
927#
928# Pseudo filesystems
929#
930CONFIG_PROC_FS=y
931CONFIG_PROC_SYSCTL=y
932CONFIG_SYSFS=y
933CONFIG_TMPFS=y
934# CONFIG_TMPFS_POSIX_ACL is not set
935# CONFIG_HUGETLB_PAGE is not set
936# CONFIG_CONFIGFS_FS is not set
937
938#
939# Miscellaneous filesystems
940#
941# CONFIG_ADFS_FS is not set
942# CONFIG_AFFS_FS is not set
943# CONFIG_HFS_FS is not set
944# CONFIG_HFSPLUS_FS is not set
945# CONFIG_BEFS_FS is not set
946# CONFIG_BFS_FS is not set
947# CONFIG_EFS_FS is not set
948CONFIG_JFFS2_FS=y
949CONFIG_JFFS2_FS_DEBUG=0
950CONFIG_JFFS2_FS_WRITEBUFFER=y
951# CONFIG_JFFS2_FS_WBUF_VERIFY is not set
952# CONFIG_JFFS2_SUMMARY is not set
953# CONFIG_JFFS2_FS_XATTR is not set
954# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set
955CONFIG_JFFS2_ZLIB=y
956# CONFIG_JFFS2_LZO is not set
957CONFIG_JFFS2_RTIME=y
958# CONFIG_JFFS2_RUBIN is not set
959# CONFIG_CRAMFS is not set
960# CONFIG_VXFS_FS is not set
961# CONFIG_HPFS_FS is not set
962# CONFIG_QNX4FS_FS is not set
963# CONFIG_SYSV_FS is not set
964# CONFIG_UFS_FS is not set
965CONFIG_NETWORK_FILESYSTEMS=y
966CONFIG_NFS_FS=y
967CONFIG_NFS_V3=y
968CONFIG_NFS_V3_ACL=y
969CONFIG_NFS_V4=y
970# CONFIG_NFS_DIRECTIO is not set
971# CONFIG_NFSD is not set
972CONFIG_ROOT_NFS=y
973CONFIG_LOCKD=y
974CONFIG_LOCKD_V4=y
975CONFIG_NFS_ACL_SUPPORT=y
976CONFIG_NFS_COMMON=y
977CONFIG_SUNRPC=y
978CONFIG_SUNRPC_GSS=y
979# CONFIG_SUNRPC_BIND34 is not set
980CONFIG_RPCSEC_GSS_KRB5=y
981# CONFIG_RPCSEC_GSS_SPKM3 is not set
982# CONFIG_SMB_FS is not set
983# CONFIG_CIFS is not set
984# CONFIG_NCP_FS is not set
985# CONFIG_CODA_FS is not set
986# CONFIG_AFS_FS is not set
987
988#
989# Partition Types
990#
991# CONFIG_PARTITION_ADVANCED is not set
992CONFIG_MSDOS_PARTITION=y
993CONFIG_NLS=y
994CONFIG_NLS_DEFAULT="iso8859-1"
995CONFIG_NLS_CODEPAGE_437=y
996# CONFIG_NLS_CODEPAGE_737 is not set
997# CONFIG_NLS_CODEPAGE_775 is not set
998CONFIG_NLS_CODEPAGE_850=y
999# CONFIG_NLS_CODEPAGE_852 is not set
1000# CONFIG_NLS_CODEPAGE_855 is not set
1001# CONFIG_NLS_CODEPAGE_857 is not set
1002# CONFIG_NLS_CODEPAGE_860 is not set
1003# CONFIG_NLS_CODEPAGE_861 is not set
1004# CONFIG_NLS_CODEPAGE_862 is not set
1005# CONFIG_NLS_CODEPAGE_863 is not set
1006# CONFIG_NLS_CODEPAGE_864 is not set
1007# CONFIG_NLS_CODEPAGE_865 is not set
1008# CONFIG_NLS_CODEPAGE_866 is not set
1009# CONFIG_NLS_CODEPAGE_869 is not set
1010# CONFIG_NLS_CODEPAGE_936 is not set
1011# CONFIG_NLS_CODEPAGE_950 is not set
1012# CONFIG_NLS_CODEPAGE_932 is not set
1013# CONFIG_NLS_CODEPAGE_949 is not set
1014# CONFIG_NLS_CODEPAGE_874 is not set
1015# CONFIG_NLS_ISO8859_8 is not set
1016# CONFIG_NLS_CODEPAGE_1250 is not set
1017# CONFIG_NLS_CODEPAGE_1251 is not set
1018# CONFIG_NLS_ASCII is not set
1019CONFIG_NLS_ISO8859_1=y
1020# CONFIG_NLS_ISO8859_2 is not set
1021# CONFIG_NLS_ISO8859_3 is not set
1022# CONFIG_NLS_ISO8859_4 is not set
1023# CONFIG_NLS_ISO8859_5 is not set
1024# CONFIG_NLS_ISO8859_6 is not set
1025# CONFIG_NLS_ISO8859_7 is not set
1026# CONFIG_NLS_ISO8859_9 is not set
1027# CONFIG_NLS_ISO8859_13 is not set
1028# CONFIG_NLS_ISO8859_14 is not set
1029# CONFIG_NLS_ISO8859_15 is not set
1030# CONFIG_NLS_KOI8_R is not set
1031# CONFIG_NLS_KOI8_U is not set
1032# CONFIG_NLS_UTF8 is not set
1033# CONFIG_DLM is not set
1034# CONFIG_INSTRUMENTATION is not set
1035
1036#
1037# Kernel hacking
1038#
1039# CONFIG_PRINTK_TIME is not set
1040CONFIG_ENABLE_WARN_DEPRECATED=y
1041CONFIG_ENABLE_MUST_CHECK=y
1042# CONFIG_MAGIC_SYSRQ is not set
1043# CONFIG_UNUSED_SYMBOLS is not set
1044# CONFIG_DEBUG_FS is not set
1045# CONFIG_HEADERS_CHECK is not set
1046CONFIG_DEBUG_KERNEL=y
1047# CONFIG_DEBUG_SHIRQ is not set
1048CONFIG_DETECT_SOFTLOCKUP=y
1049CONFIG_SCHED_DEBUG=y
1050# CONFIG_SCHEDSTATS is not set
1051# CONFIG_TIMER_STATS is not set
1052# CONFIG_DEBUG_SLAB is not set
1053# CONFIG_DEBUG_RT_MUTEXES is not set
1054# CONFIG_RT_MUTEX_TESTER is not set
1055# CONFIG_DEBUG_SPINLOCK is not set
1056# CONFIG_DEBUG_MUTEXES is not set
1057# CONFIG_DEBUG_LOCK_ALLOC is not set
1058# CONFIG_PROVE_LOCKING is not set
1059# CONFIG_LOCK_STAT is not set
1060# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
1061# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
1062# CONFIG_DEBUG_KOBJECT is not set
1063CONFIG_DEBUG_BUGVERBOSE=y
1064# CONFIG_DEBUG_INFO is not set
1065# CONFIG_DEBUG_VM is not set
1066# CONFIG_DEBUG_LIST is not set
1067# CONFIG_DEBUG_SG is not set
1068CONFIG_FRAME_POINTER=y
1069CONFIG_FORCED_INLINING=y
1070# CONFIG_BOOT_PRINTK_DELAY is not set
1071# CONFIG_RCU_TORTURE_TEST is not set
1072# CONFIG_FAULT_INJECTION is not set
1073# CONFIG_SAMPLES is not set
1074CONFIG_DEBUG_USER=y
1075# CONFIG_DEBUG_ERRORS is not set
1076CONFIG_DEBUG_LL=y
1077# CONFIG_DEBUG_ICEDCC is not set
1078
1079#
1080# Security options
1081#
1082# CONFIG_KEYS is not set
1083# CONFIG_SECURITY is not set
1084# CONFIG_SECURITY_FILE_CAPABILITIES is not set
1085CONFIG_CRYPTO=y
1086CONFIG_CRYPTO_ALGAPI=y
1087CONFIG_CRYPTO_BLKCIPHER=y
1088CONFIG_CRYPTO_MANAGER=y
1089# CONFIG_CRYPTO_HMAC is not set
1090# CONFIG_CRYPTO_XCBC is not set
1091# CONFIG_CRYPTO_NULL is not set
1092# CONFIG_CRYPTO_MD4 is not set
1093CONFIG_CRYPTO_MD5=y
1094# CONFIG_CRYPTO_SHA1 is not set
1095# CONFIG_CRYPTO_SHA256 is not set
1096# CONFIG_CRYPTO_SHA512 is not set
1097# CONFIG_CRYPTO_WP512 is not set
1098# CONFIG_CRYPTO_TGR192 is not set
1099# CONFIG_CRYPTO_GF128MUL is not set
1100# CONFIG_CRYPTO_ECB is not set
1101CONFIG_CRYPTO_CBC=y
1102# CONFIG_CRYPTO_PCBC is not set
1103# CONFIG_CRYPTO_LRW is not set
1104# CONFIG_CRYPTO_XTS is not set
1105# CONFIG_CRYPTO_CRYPTD is not set
1106CONFIG_CRYPTO_DES=y
1107# CONFIG_CRYPTO_FCRYPT is not set
1108# CONFIG_CRYPTO_BLOWFISH is not set
1109# CONFIG_CRYPTO_TWOFISH is not set
1110# CONFIG_CRYPTO_SERPENT is not set
1111# CONFIG_CRYPTO_AES is not set
1112# CONFIG_CRYPTO_CAST5 is not set
1113# CONFIG_CRYPTO_CAST6 is not set
1114# CONFIG_CRYPTO_TEA is not set
1115# CONFIG_CRYPTO_ARC4 is not set
1116# CONFIG_CRYPTO_KHAZAD is not set
1117# CONFIG_CRYPTO_ANUBIS is not set
1118# CONFIG_CRYPTO_SEED is not set
1119# CONFIG_CRYPTO_DEFLATE is not set
1120# CONFIG_CRYPTO_MICHAEL_MIC is not set
1121# CONFIG_CRYPTO_CRC32C is not set
1122# CONFIG_CRYPTO_CAMELLIA is not set
1123# CONFIG_CRYPTO_TEST is not set
1124# CONFIG_CRYPTO_AUTHENC is not set
1125# CONFIG_CRYPTO_HW is not set
1126
1127#
1128# Library routines
1129#
1130CONFIG_BITREVERSE=y
1131# CONFIG_CRC_CCITT is not set
1132# CONFIG_CRC16 is not set
1133# CONFIG_CRC_ITU_T is not set
1134CONFIG_CRC32=y
1135# CONFIG_CRC7 is not set
1136# CONFIG_LIBCRC32C is not set
1137CONFIG_ZLIB_INFLATE=y
1138CONFIG_ZLIB_DEFLATE=y
1139CONFIG_PLIST=y
1140CONFIG_HAS_IOMEM=y
1141CONFIG_HAS_IOPORT=y
1142CONFIG_HAS_DMA=y
diff --git a/arch/arm/configs/usb-a9263_defconfig b/arch/arm/configs/usb-a9263_defconfig
new file mode 100644
index 000000000000..48d455bc7363
--- /dev/null
+++ b/arch/arm/configs/usb-a9263_defconfig
@@ -0,0 +1,1134 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.24
4# Tue Apr 15 11:15:19 2008
5#
6CONFIG_ARM=y
7CONFIG_SYS_SUPPORTS_APM_EMULATION=y
8CONFIG_GENERIC_GPIO=y
9CONFIG_GENERIC_TIME=y
10CONFIG_GENERIC_CLOCKEVENTS=y
11CONFIG_MMU=y
12# CONFIG_NO_IOPORT is not set
13CONFIG_GENERIC_HARDIRQS=y
14CONFIG_STACKTRACE_SUPPORT=y
15CONFIG_LOCKDEP_SUPPORT=y
16CONFIG_TRACE_IRQFLAGS_SUPPORT=y
17CONFIG_HARDIRQS_SW_RESEND=y
18CONFIG_GENERIC_IRQ_PROBE=y
19CONFIG_RWSEM_GENERIC_SPINLOCK=y
20# CONFIG_ARCH_HAS_ILOG2_U32 is not set
21# CONFIG_ARCH_HAS_ILOG2_U64 is not set
22CONFIG_GENERIC_HWEIGHT=y
23CONFIG_GENERIC_CALIBRATE_DELAY=y
24CONFIG_ZONE_DMA=y
25CONFIG_VECTORS_BASE=0xffff0000
26CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
27
28#
29# General setup
30#
31CONFIG_EXPERIMENTAL=y
32CONFIG_BROKEN_ON_SMP=y
33CONFIG_INIT_ENV_ARG_LIMIT=32
34CONFIG_LOCALVERSION=""
35# CONFIG_LOCALVERSION_AUTO is not set
36# CONFIG_SWAP is not set
37CONFIG_SYSVIPC=y
38CONFIG_SYSVIPC_SYSCTL=y
39# CONFIG_POSIX_MQUEUE is not set
40# CONFIG_BSD_PROCESS_ACCT is not set
41# CONFIG_TASKSTATS is not set
42# CONFIG_USER_NS is not set
43# CONFIG_PID_NS is not set
44# CONFIG_AUDIT is not set
45# CONFIG_IKCONFIG is not set
46CONFIG_LOG_BUF_SHIFT=14
47# CONFIG_CGROUPS is not set
48CONFIG_FAIR_GROUP_SCHED=y
49CONFIG_FAIR_USER_SCHED=y
50# CONFIG_FAIR_CGROUP_SCHED is not set
51# CONFIG_SYSFS_DEPRECATED is not set
52# CONFIG_RELAY is not set
53# CONFIG_BLK_DEV_INITRD is not set
54# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
55CONFIG_SYSCTL=y
56# CONFIG_EMBEDDED is not set
57CONFIG_UID16=y
58CONFIG_SYSCTL_SYSCALL=y
59CONFIG_KALLSYMS=y
60# CONFIG_KALLSYMS_ALL is not set
61# CONFIG_KALLSYMS_EXTRA_PASS is not set
62CONFIG_HOTPLUG=y
63CONFIG_PRINTK=y
64CONFIG_BUG=y
65CONFIG_ELF_CORE=y
66CONFIG_BASE_FULL=y
67CONFIG_FUTEX=y
68CONFIG_ANON_INODES=y
69CONFIG_EPOLL=y
70CONFIG_SIGNALFD=y
71CONFIG_EVENTFD=y
72CONFIG_SHMEM=y
73CONFIG_VM_EVENT_COUNTERS=y
74CONFIG_SLAB=y
75# CONFIG_SLUB is not set
76# CONFIG_SLOB is not set
77CONFIG_SLABINFO=y
78CONFIG_RT_MUTEXES=y
79# CONFIG_TINY_SHMEM is not set
80CONFIG_BASE_SMALL=0
81CONFIG_MODULES=y
82CONFIG_MODULE_UNLOAD=y
83# CONFIG_MODULE_FORCE_UNLOAD is not set
84# CONFIG_MODVERSIONS is not set
85# CONFIG_MODULE_SRCVERSION_ALL is not set
86CONFIG_KMOD=y
87CONFIG_BLOCK=y
88# CONFIG_LBD is not set
89# CONFIG_BLK_DEV_IO_TRACE is not set
90# CONFIG_LSF is not set
91# CONFIG_BLK_DEV_BSG is not set
92
93#
94# IO Schedulers
95#
96CONFIG_IOSCHED_NOOP=y
97CONFIG_IOSCHED_AS=y
98# CONFIG_IOSCHED_DEADLINE is not set
99# CONFIG_IOSCHED_CFQ is not set
100CONFIG_DEFAULT_AS=y
101# CONFIG_DEFAULT_DEADLINE is not set
102# CONFIG_DEFAULT_CFQ is not set
103# CONFIG_DEFAULT_NOOP is not set
104CONFIG_DEFAULT_IOSCHED="anticipatory"
105
106#
107# System Type
108#
109# CONFIG_ARCH_AAEC2000 is not set
110# CONFIG_ARCH_INTEGRATOR is not set
111# CONFIG_ARCH_REALVIEW is not set
112# CONFIG_ARCH_VERSATILE is not set
113CONFIG_ARCH_AT91=y
114# CONFIG_ARCH_CLPS7500 is not set
115# CONFIG_ARCH_CLPS711X is not set
116# CONFIG_ARCH_CO285 is not set
117# CONFIG_ARCH_EBSA110 is not set
118# CONFIG_ARCH_EP93XX is not set
119# CONFIG_ARCH_FOOTBRIDGE is not set
120# CONFIG_ARCH_NETX is not set
121# CONFIG_ARCH_H720X is not set
122# CONFIG_ARCH_IMX is not set
123# CONFIG_ARCH_IOP13XX is not set
124# CONFIG_ARCH_IOP32X is not set
125# CONFIG_ARCH_IOP33X is not set
126# CONFIG_ARCH_IXP23XX is not set
127# CONFIG_ARCH_IXP2000 is not set
128# CONFIG_ARCH_IXP4XX is not set
129# CONFIG_ARCH_L7200 is not set
130# CONFIG_ARCH_KS8695 is not set
131# CONFIG_ARCH_NS9XXX is not set
132# CONFIG_ARCH_MXC is not set
133# CONFIG_ARCH_PNX4008 is not set
134# CONFIG_ARCH_PXA is not set
135# CONFIG_ARCH_RPC is not set
136# CONFIG_ARCH_SA1100 is not set
137# CONFIG_ARCH_S3C2410 is not set
138# CONFIG_ARCH_SHARK is not set
139# CONFIG_ARCH_LH7A40X is not set
140# CONFIG_ARCH_DAVINCI is not set
141# CONFIG_ARCH_OMAP is not set
142
143#
144# Boot options
145#
146
147#
148# Power management
149#
150
151#
152# Atmel AT91 System-on-Chip
153#
154# CONFIG_ARCH_AT91RM9200 is not set
155# CONFIG_ARCH_AT91SAM9260 is not set
156# CONFIG_ARCH_AT91SAM9261 is not set
157CONFIG_ARCH_AT91SAM9263=y
158# CONFIG_ARCH_AT91SAM9RL is not set
159# CONFIG_ARCH_AT91CAP9 is not set
160# CONFIG_ARCH_AT91X40 is not set
161CONFIG_AT91_PMC_UNIT=y
162
163#
164# AT91SAM9263 Board Type
165#
166# CONFIG_MACH_AT91SAM9263EK is not set
167CONFIG_MACH_USB_A9263=y
168
169#
170# AT91 Board Options
171#
172
173#
174# AT91 Feature Selections
175#
176# CONFIG_AT91_PROGRAMMABLE_CLOCKS is not set
177CONFIG_AT91_SLOW_CLOCK=y
178CONFIG_AT91_TIMER_HZ=100
179CONFIG_AT91_EARLY_DBGU=y
180# CONFIG_AT91_EARLY_USART0 is not set
181# CONFIG_AT91_EARLY_USART1 is not set
182# CONFIG_AT91_EARLY_USART2 is not set
183# CONFIG_AT91_EARLY_USART3 is not set
184# CONFIG_AT91_EARLY_USART4 is not set
185# CONFIG_AT91_EARLY_USART5 is not set
186
187#
188# Processor Type
189#
190CONFIG_CPU_32=y
191CONFIG_CPU_ARM926T=y
192CONFIG_CPU_32v5=y
193CONFIG_CPU_ABRT_EV5TJ=y
194CONFIG_CPU_CACHE_VIVT=y
195CONFIG_CPU_COPY_V4WB=y
196CONFIG_CPU_TLB_V4WBI=y
197CONFIG_CPU_CP15=y
198CONFIG_CPU_CP15_MMU=y
199
200#
201# Processor Features
202#
203# CONFIG_ARM_THUMB is not set
204# CONFIG_CPU_ICACHE_DISABLE is not set
205# CONFIG_CPU_DCACHE_DISABLE is not set
206# CONFIG_CPU_DCACHE_WRITETHROUGH is not set
207# CONFIG_CPU_CACHE_ROUND_ROBIN is not set
208# CONFIG_OUTER_CACHE is not set
209
210#
211# Bus support
212#
213# CONFIG_PCI_SYSCALL is not set
214# CONFIG_ARCH_SUPPORTS_MSI is not set
215# CONFIG_PCCARD is not set
216
217#
218# Kernel Features
219#
220# CONFIG_TICK_ONESHOT is not set
221# CONFIG_NO_HZ is not set
222# CONFIG_HIGH_RES_TIMERS is not set
223CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
224# CONFIG_PREEMPT is not set
225CONFIG_HZ=100
226CONFIG_AEABI=y
227CONFIG_OABI_COMPAT=y
228# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set
229CONFIG_SELECT_MEMORY_MODEL=y
230CONFIG_FLATMEM_MANUAL=y
231# CONFIG_DISCONTIGMEM_MANUAL is not set
232# CONFIG_SPARSEMEM_MANUAL is not set
233CONFIG_FLATMEM=y
234CONFIG_FLAT_NODE_MEM_MAP=y
235# CONFIG_SPARSEMEM_STATIC is not set
236# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
237CONFIG_SPLIT_PTLOCK_CPUS=4096
238# CONFIG_RESOURCES_64BIT is not set
239CONFIG_ZONE_DMA_FLAG=1
240CONFIG_BOUNCE=y
241CONFIG_VIRT_TO_BUS=y
242# CONFIG_LEDS is not set
243CONFIG_ALIGNMENT_TRAP=y
244
245#
246# Boot options
247#
248CONFIG_ZBOOT_ROM_TEXT=0x0
249CONFIG_ZBOOT_ROM_BSS=0x0
250CONFIG_CMDLINE="mem=64M console=ttyS0,115200"
251# CONFIG_XIP_KERNEL is not set
252# CONFIG_KEXEC is not set
253
254#
255# Floating point emulation
256#
257
258#
259# At least one emulation must be selected
260#
261CONFIG_FPE_NWFPE=y
262# CONFIG_FPE_NWFPE_XP is not set
263# CONFIG_FPE_FASTFPE is not set
264# CONFIG_VFP is not set
265
266#
267# Userspace binary formats
268#
269CONFIG_BINFMT_ELF=y
270# CONFIG_BINFMT_AOUT is not set
271# CONFIG_BINFMT_MISC is not set
272
273#
274# Power management options
275#
276CONFIG_PM=y
277# CONFIG_PM_LEGACY is not set
278# CONFIG_PM_DEBUG is not set
279CONFIG_PM_SLEEP=y
280CONFIG_SUSPEND_UP_POSSIBLE=y
281CONFIG_SUSPEND=y
282# CONFIG_APM_EMULATION is not set
283
284#
285# Networking
286#
287CONFIG_NET=y
288
289#
290# Networking options
291#
292CONFIG_PACKET=y
293# CONFIG_PACKET_MMAP is not set
294CONFIG_UNIX=y
295# CONFIG_NET_KEY is not set
296CONFIG_INET=y
297CONFIG_IP_MULTICAST=y
298CONFIG_IP_ADVANCED_ROUTER=y
299CONFIG_ASK_IP_FIB_HASH=y
300# CONFIG_IP_FIB_TRIE is not set
301CONFIG_IP_FIB_HASH=y
302# CONFIG_IP_MULTIPLE_TABLES is not set
303# CONFIG_IP_ROUTE_MULTIPATH is not set
304CONFIG_IP_ROUTE_VERBOSE=y
305CONFIG_IP_PNP=y
306# CONFIG_IP_PNP_DHCP is not set
307CONFIG_IP_PNP_BOOTP=y
308CONFIG_IP_PNP_RARP=y
309# CONFIG_NET_IPIP is not set
310# CONFIG_NET_IPGRE is not set
311CONFIG_IP_MROUTE=y
312CONFIG_IP_PIMSM_V1=y
313CONFIG_IP_PIMSM_V2=y
314# CONFIG_ARPD is not set
315# CONFIG_SYN_COOKIES is not set
316# CONFIG_INET_AH is not set
317# CONFIG_INET_ESP is not set
318# CONFIG_INET_IPCOMP is not set
319# CONFIG_INET_XFRM_TUNNEL is not set
320# CONFIG_INET_TUNNEL is not set
321# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
322# CONFIG_INET_XFRM_MODE_TUNNEL is not set
323# CONFIG_INET_XFRM_MODE_BEET is not set
324# CONFIG_INET_LRO is not set
325# CONFIG_INET_DIAG is not set
326# CONFIG_TCP_CONG_ADVANCED is not set
327CONFIG_TCP_CONG_CUBIC=y
328CONFIG_DEFAULT_TCP_CONG="cubic"
329# CONFIG_TCP_MD5SIG is not set
330# CONFIG_IPV6 is not set
331# CONFIG_INET6_XFRM_TUNNEL is not set
332# CONFIG_INET6_TUNNEL is not set
333# CONFIG_NETWORK_SECMARK is not set
334# CONFIG_NETFILTER is not set
335# CONFIG_IP_DCCP is not set
336# CONFIG_IP_SCTP is not set
337# CONFIG_TIPC is not set
338# CONFIG_ATM is not set
339# CONFIG_BRIDGE is not set
340# CONFIG_VLAN_8021Q is not set
341# CONFIG_DECNET is not set
342# CONFIG_LLC2 is not set
343# CONFIG_IPX is not set
344# CONFIG_ATALK is not set
345# CONFIG_X25 is not set
346# CONFIG_LAPB is not set
347# CONFIG_ECONET is not set
348# CONFIG_WAN_ROUTER is not set
349# CONFIG_NET_SCHED is not set
350
351#
352# Network testing
353#
354# CONFIG_NET_PKTGEN is not set
355# CONFIG_HAMRADIO is not set
356# CONFIG_IRDA is not set
357# CONFIG_BT is not set
358# CONFIG_AF_RXRPC is not set
359
360#
361# Wireless
362#
363# CONFIG_CFG80211 is not set
364# CONFIG_WIRELESS_EXT is not set
365# CONFIG_MAC80211 is not set
366# CONFIG_IEEE80211 is not set
367# CONFIG_RFKILL is not set
368# CONFIG_NET_9P is not set
369
370#
371# Device Drivers
372#
373
374#
375# Generic Driver Options
376#
377CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
378CONFIG_STANDALONE=y
379CONFIG_PREVENT_FIRMWARE_BUILD=y
380# CONFIG_FW_LOADER is not set
381# CONFIG_DEBUG_DRIVER is not set
382# CONFIG_DEBUG_DEVRES is not set
383# CONFIG_SYS_HYPERVISOR is not set
384# CONFIG_CONNECTOR is not set
385CONFIG_MTD=y
386# CONFIG_MTD_DEBUG is not set
387# CONFIG_MTD_CONCAT is not set
388CONFIG_MTD_PARTITIONS=y
389# CONFIG_MTD_REDBOOT_PARTS is not set
390CONFIG_MTD_CMDLINE_PARTS=y
391# CONFIG_MTD_AFS_PARTS is not set
392
393#
394# User Modules And Translation Layers
395#
396CONFIG_MTD_CHAR=y
397CONFIG_MTD_BLKDEVS=y
398CONFIG_MTD_BLOCK=y
399# CONFIG_FTL is not set
400# CONFIG_NFTL is not set
401# CONFIG_INFTL is not set
402# CONFIG_RFD_FTL is not set
403# CONFIG_SSFDC is not set
404# CONFIG_MTD_OOPS is not set
405
406#
407# RAM/ROM/Flash chip drivers
408#
409# CONFIG_MTD_CFI is not set
410# CONFIG_MTD_JEDECPROBE is not set
411CONFIG_MTD_MAP_BANK_WIDTH_1=y
412CONFIG_MTD_MAP_BANK_WIDTH_2=y
413CONFIG_MTD_MAP_BANK_WIDTH_4=y
414# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
415# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
416# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
417CONFIG_MTD_CFI_I1=y
418CONFIG_MTD_CFI_I2=y
419# CONFIG_MTD_CFI_I4 is not set
420# CONFIG_MTD_CFI_I8 is not set
421# CONFIG_MTD_RAM is not set
422# CONFIG_MTD_ROM is not set
423# CONFIG_MTD_ABSENT is not set
424
425#
426# Mapping drivers for chip access
427#
428# CONFIG_MTD_COMPLEX_MAPPINGS is not set
429# CONFIG_MTD_PLATRAM is not set
430
431#
432# Self-contained MTD device drivers
433#
434CONFIG_MTD_DATAFLASH=y
435# CONFIG_MTD_M25P80 is not set
436# CONFIG_MTD_SLRAM is not set
437# CONFIG_MTD_PHRAM is not set
438# CONFIG_MTD_MTDRAM is not set
439# CONFIG_MTD_BLOCK2MTD is not set
440
441#
442# Disk-On-Chip Device Drivers
443#
444# CONFIG_MTD_DOC2000 is not set
445# CONFIG_MTD_DOC2001 is not set
446# CONFIG_MTD_DOC2001PLUS is not set
447CONFIG_MTD_NAND=y
448# CONFIG_MTD_NAND_VERIFY_WRITE is not set
449# CONFIG_MTD_NAND_ECC_SMC is not set
450# CONFIG_MTD_NAND_MUSEUM_IDS is not set
451CONFIG_MTD_NAND_IDS=y
452# CONFIG_MTD_NAND_DISKONCHIP is not set
453CONFIG_MTD_NAND_AT91=y
454CONFIG_MTD_NAND_AT91_ECC_SOFT=y
455# CONFIG_MTD_NAND_AT91_ECC_HW is not set
456# CONFIG_MTD_NAND_AT91_ECC_NONE is not set
457# CONFIG_MTD_NAND_NANDSIM is not set
458# CONFIG_MTD_NAND_PLATFORM is not set
459# CONFIG_MTD_ALAUDA is not set
460# CONFIG_MTD_ONENAND is not set
461
462#
463# UBI - Unsorted block images
464#
465# CONFIG_MTD_UBI is not set
466# CONFIG_PARPORT is not set
467CONFIG_BLK_DEV=y
468# CONFIG_BLK_DEV_COW_COMMON is not set
469CONFIG_BLK_DEV_LOOP=y
470# CONFIG_BLK_DEV_CRYPTOLOOP is not set
471# CONFIG_BLK_DEV_NBD is not set
472# CONFIG_BLK_DEV_UB is not set
473# CONFIG_BLK_DEV_RAM is not set
474# CONFIG_CDROM_PKTCDVD is not set
475# CONFIG_ATA_OVER_ETH is not set
476# CONFIG_MISC_DEVICES is not set
477
478#
479# SCSI device support
480#
481# CONFIG_RAID_ATTRS is not set
482CONFIG_SCSI=y
483CONFIG_SCSI_DMA=y
484# CONFIG_SCSI_TGT is not set
485# CONFIG_SCSI_NETLINK is not set
486CONFIG_SCSI_PROC_FS=y
487
488#
489# SCSI support type (disk, tape, CD-ROM)
490#
491CONFIG_BLK_DEV_SD=y
492# CONFIG_CHR_DEV_ST is not set
493# CONFIG_CHR_DEV_OSST is not set
494# CONFIG_BLK_DEV_SR is not set
495# CONFIG_CHR_DEV_SG is not set
496# CONFIG_CHR_DEV_SCH is not set
497
498#
499# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
500#
501CONFIG_SCSI_MULTI_LUN=y
502# CONFIG_SCSI_CONSTANTS is not set
503# CONFIG_SCSI_LOGGING is not set
504# CONFIG_SCSI_SCAN_ASYNC is not set
505CONFIG_SCSI_WAIT_SCAN=m
506
507#
508# SCSI Transports
509#
510# CONFIG_SCSI_SPI_ATTRS is not set
511# CONFIG_SCSI_FC_ATTRS is not set
512# CONFIG_SCSI_ISCSI_ATTRS is not set
513# CONFIG_SCSI_SAS_LIBSAS is not set
514# CONFIG_SCSI_SRP_ATTRS is not set
515CONFIG_SCSI_LOWLEVEL=y
516# CONFIG_ISCSI_TCP is not set
517# CONFIG_SCSI_DEBUG is not set
518# CONFIG_ATA is not set
519# CONFIG_MD is not set
520CONFIG_NETDEVICES=y
521# CONFIG_NETDEVICES_MULTIQUEUE is not set
522# CONFIG_DUMMY is not set
523# CONFIG_BONDING is not set
524# CONFIG_MACVLAN is not set
525# CONFIG_EQUALIZER is not set
526# CONFIG_TUN is not set
527# CONFIG_VETH is not set
528CONFIG_PHYLIB=y
529
530#
531# MII PHY device drivers
532#
533# CONFIG_MARVELL_PHY is not set
534# CONFIG_DAVICOM_PHY is not set
535# CONFIG_QSEMI_PHY is not set
536# CONFIG_LXT_PHY is not set
537# CONFIG_CICADA_PHY is not set
538# CONFIG_VITESSE_PHY is not set
539# CONFIG_SMSC_PHY is not set
540# CONFIG_BROADCOM_PHY is not set
541# CONFIG_ICPLUS_PHY is not set
542# CONFIG_FIXED_PHY is not set
543# CONFIG_MDIO_BITBANG is not set
544CONFIG_NET_ETHERNET=y
545CONFIG_MII=y
546CONFIG_MACB=y
547# CONFIG_AX88796 is not set
548# CONFIG_SMC91X is not set
549# CONFIG_DM9000 is not set
550# CONFIG_IBM_NEW_EMAC_ZMII is not set
551# CONFIG_IBM_NEW_EMAC_RGMII is not set
552# CONFIG_IBM_NEW_EMAC_TAH is not set
553# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
554# CONFIG_B44 is not set
555CONFIG_NETDEV_1000=y
556CONFIG_NETDEV_10000=y
557
558#
559# Wireless LAN
560#
561# CONFIG_WLAN_PRE80211 is not set
562# CONFIG_WLAN_80211 is not set
563
564#
565# USB Network Adapters
566#
567# CONFIG_USB_CATC is not set
568# CONFIG_USB_KAWETH is not set
569# CONFIG_USB_PEGASUS is not set
570# CONFIG_USB_RTL8150 is not set
571# CONFIG_USB_USBNET is not set
572# CONFIG_WAN is not set
573# CONFIG_PPP is not set
574# CONFIG_SLIP is not set
575# CONFIG_SHAPER is not set
576# CONFIG_NETCONSOLE is not set
577# CONFIG_NETPOLL is not set
578# CONFIG_NET_POLL_CONTROLLER is not set
579# CONFIG_ISDN is not set
580
581#
582# Input device support
583#
584CONFIG_INPUT=y
585# CONFIG_INPUT_FF_MEMLESS is not set
586# CONFIG_INPUT_POLLDEV is not set
587
588#
589# Userland interfaces
590#
591CONFIG_INPUT_MOUSEDEV=y
592# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
593CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
594CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
595# CONFIG_INPUT_JOYDEV is not set
596CONFIG_INPUT_EVDEV=y
597CONFIG_INPUT_EVBUG=y
598
599#
600# Input Device Drivers
601#
602CONFIG_INPUT_KEYBOARD=y
603# CONFIG_KEYBOARD_ATKBD is not set
604# CONFIG_KEYBOARD_SUNKBD is not set
605# CONFIG_KEYBOARD_LKKBD is not set
606# CONFIG_KEYBOARD_XTKBD is not set
607# CONFIG_KEYBOARD_NEWTON is not set
608# CONFIG_KEYBOARD_STOWAWAY is not set
609CONFIG_KEYBOARD_GPIO=y
610# CONFIG_INPUT_MOUSE is not set
611# CONFIG_INPUT_JOYSTICK is not set
612# CONFIG_INPUT_TABLET is not set
613# CONFIG_INPUT_TOUCHSCREEN is not set
614# CONFIG_INPUT_MISC is not set
615
616#
617# Hardware I/O ports
618#
619# CONFIG_SERIO is not set
620# CONFIG_GAMEPORT is not set
621
622#
623# Character devices
624#
625CONFIG_VT=y
626CONFIG_VT_CONSOLE=y
627CONFIG_HW_CONSOLE=y
628# CONFIG_VT_HW_CONSOLE_BINDING is not set
629# CONFIG_SERIAL_NONSTANDARD is not set
630
631#
632# Serial drivers
633#
634# CONFIG_SERIAL_8250 is not set
635
636#
637# Non-8250 serial port support
638#
639CONFIG_SERIAL_ATMEL=y
640CONFIG_SERIAL_ATMEL_CONSOLE=y
641# CONFIG_SERIAL_ATMEL_TTYAT is not set
642CONFIG_SERIAL_CORE=y
643CONFIG_SERIAL_CORE_CONSOLE=y
644CONFIG_UNIX98_PTYS=y
645CONFIG_LEGACY_PTYS=y
646CONFIG_LEGACY_PTY_COUNT=256
647# CONFIG_IPMI_HANDLER is not set
648CONFIG_HW_RANDOM=y
649# CONFIG_NVRAM is not set
650# CONFIG_R3964 is not set
651# CONFIG_RAW_DRIVER is not set
652# CONFIG_TCG_TPM is not set
653# CONFIG_I2C is not set
654
655#
656# SPI support
657#
658CONFIG_SPI=y
659# CONFIG_SPI_DEBUG is not set
660CONFIG_SPI_MASTER=y
661
662#
663# SPI Master Controller Drivers
664#
665CONFIG_SPI_ATMEL=y
666# CONFIG_SPI_BITBANG is not set
667
668#
669# SPI Protocol Masters
670#
671# CONFIG_SPI_AT25 is not set
672# CONFIG_SPI_SPIDEV is not set
673# CONFIG_SPI_TLE62X0 is not set
674# CONFIG_W1 is not set
675# CONFIG_POWER_SUPPLY is not set
676# CONFIG_HWMON is not set
677# CONFIG_WATCHDOG is not set
678
679#
680# Sonics Silicon Backplane
681#
682CONFIG_SSB_POSSIBLE=y
683# CONFIG_SSB is not set
684
685#
686# Multifunction device drivers
687#
688# CONFIG_MFD_SM501 is not set
689
690#
691# Multimedia devices
692#
693# CONFIG_VIDEO_DEV is not set
694# CONFIG_DVB_CORE is not set
695# CONFIG_DAB is not set
696
697#
698# Graphics support
699#
700# CONFIG_VGASTATE is not set
701# CONFIG_VIDEO_OUTPUT_CONTROL is not set
702# CONFIG_FB is not set
703# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
704
705#
706# Display device support
707#
708# CONFIG_DISPLAY_SUPPORT is not set
709
710#
711# Console display driver support
712#
713# CONFIG_VGA_CONSOLE is not set
714CONFIG_DUMMY_CONSOLE=y
715
716#
717# Sound
718#
719# CONFIG_SOUND is not set
720CONFIG_HID_SUPPORT=y
721CONFIG_HID=y
722# CONFIG_HID_DEBUG is not set
723# CONFIG_HIDRAW is not set
724
725#
726# USB Input Devices
727#
728# CONFIG_USB_HID is not set
729
730#
731# USB HID Boot Protocol drivers
732#
733# CONFIG_USB_KBD is not set
734# CONFIG_USB_MOUSE is not set
735CONFIG_USB_SUPPORT=y
736CONFIG_USB_ARCH_HAS_HCD=y
737CONFIG_USB_ARCH_HAS_OHCI=y
738# CONFIG_USB_ARCH_HAS_EHCI is not set
739CONFIG_USB=y
740# CONFIG_USB_DEBUG is not set
741
742#
743# Miscellaneous USB options
744#
745CONFIG_USB_DEVICEFS=y
746CONFIG_USB_DEVICE_CLASS=y
747# CONFIG_USB_DYNAMIC_MINORS is not set
748# CONFIG_USB_SUSPEND is not set
749# CONFIG_USB_PERSIST is not set
750# CONFIG_USB_OTG is not set
751
752#
753# USB Host Controller Drivers
754#
755# CONFIG_USB_ISP116X_HCD is not set
756CONFIG_USB_OHCI_HCD=y
757# CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set
758# CONFIG_USB_OHCI_BIG_ENDIAN_MMIO is not set
759CONFIG_USB_OHCI_LITTLE_ENDIAN=y
760# CONFIG_USB_SL811_HCD is not set
761# CONFIG_USB_R8A66597_HCD is not set
762
763#
764# USB Device Class drivers
765#
766# CONFIG_USB_ACM is not set
767# CONFIG_USB_PRINTER is not set
768
769#
770# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
771#
772
773#
774# may also be needed; see USB_STORAGE Help for more information
775#
776CONFIG_USB_STORAGE=y
777# CONFIG_USB_STORAGE_DEBUG is not set
778# CONFIG_USB_STORAGE_DATAFAB is not set
779# CONFIG_USB_STORAGE_FREECOM is not set
780# CONFIG_USB_STORAGE_ISD200 is not set
781# CONFIG_USB_STORAGE_DPCM is not set
782# CONFIG_USB_STORAGE_USBAT is not set
783# CONFIG_USB_STORAGE_SDDR09 is not set
784# CONFIG_USB_STORAGE_SDDR55 is not set
785# CONFIG_USB_STORAGE_JUMPSHOT is not set
786# CONFIG_USB_STORAGE_ALAUDA is not set
787# CONFIG_USB_STORAGE_KARMA is not set
788# CONFIG_USB_LIBUSUAL is not set
789
790#
791# USB Imaging devices
792#
793# CONFIG_USB_MDC800 is not set
794# CONFIG_USB_MICROTEK is not set
795CONFIG_USB_MON=y
796
797#
798# USB port drivers
799#
800
801#
802# USB Serial Converter support
803#
804# CONFIG_USB_SERIAL is not set
805
806#
807# USB Miscellaneous drivers
808#
809# CONFIG_USB_EMI62 is not set
810# CONFIG_USB_EMI26 is not set
811# CONFIG_USB_ADUTUX is not set
812# CONFIG_USB_AUERSWALD is not set
813# CONFIG_USB_RIO500 is not set
814# CONFIG_USB_LEGOTOWER is not set
815# CONFIG_USB_LCD is not set
816# CONFIG_USB_BERRY_CHARGE is not set
817# CONFIG_USB_LED is not set
818# CONFIG_USB_CYPRESS_CY7C63 is not set
819# CONFIG_USB_CYTHERM is not set
820# CONFIG_USB_PHIDGET is not set
821# CONFIG_USB_IDMOUSE is not set
822# CONFIG_USB_FTDI_ELAN is not set
823# CONFIG_USB_APPLEDISPLAY is not set
824# CONFIG_USB_LD is not set
825# CONFIG_USB_TRANCEVIBRATOR is not set
826# CONFIG_USB_IOWARRIOR is not set
827# CONFIG_USB_TEST is not set
828
829#
830# USB DSL modem support
831#
832
833#
834# USB Gadget Support
835#
836CONFIG_USB_GADGET=y
837# CONFIG_USB_GADGET_DEBUG is not set
838# CONFIG_USB_GADGET_DEBUG_FILES is not set
839CONFIG_USB_GADGET_SELECTED=y
840# CONFIG_USB_GADGET_AMD5536UDC is not set
841# CONFIG_USB_GADGET_ATMEL_USBA is not set
842# CONFIG_USB_GADGET_FSL_USB2 is not set
843# CONFIG_USB_GADGET_NET2280 is not set
844# CONFIG_USB_GADGET_PXA2XX is not set
845# CONFIG_USB_GADGET_M66592 is not set
846# CONFIG_USB_GADGET_GOKU is not set
847# CONFIG_USB_GADGET_LH7A40X is not set
848# CONFIG_USB_GADGET_OMAP is not set
849# CONFIG_USB_GADGET_S3C2410 is not set
850CONFIG_USB_GADGET_AT91=y
851CONFIG_USB_AT91=y
852# CONFIG_USB_GADGET_DUMMY_HCD is not set
853# CONFIG_USB_GADGET_DUALSPEED is not set
854# CONFIG_USB_ZERO is not set
855CONFIG_USB_ETH=y
856CONFIG_USB_ETH_RNDIS=y
857# CONFIG_USB_GADGETFS is not set
858# CONFIG_USB_FILE_STORAGE is not set
859# CONFIG_USB_G_SERIAL is not set
860# CONFIG_USB_MIDI_GADGET is not set
861# CONFIG_MMC is not set
862CONFIG_NEW_LEDS=y
863CONFIG_LEDS_CLASS=y
864
865#
866# LED drivers
867#
868CONFIG_LEDS_GPIO=y
869
870#
871# LED Triggers
872#
873CONFIG_LEDS_TRIGGERS=y
874# CONFIG_LEDS_TRIGGER_TIMER is not set
875CONFIG_LEDS_TRIGGER_HEARTBEAT=y
876CONFIG_RTC_LIB=y
877# CONFIG_RTC_CLASS is not set
878
879#
880# File systems
881#
882CONFIG_EXT2_FS=y
883# CONFIG_EXT2_FS_XATTR is not set
884# CONFIG_EXT2_FS_XIP is not set
885# CONFIG_EXT3_FS is not set
886# CONFIG_EXT4DEV_FS is not set
887# CONFIG_REISERFS_FS is not set
888# CONFIG_JFS_FS is not set
889CONFIG_FS_POSIX_ACL=y
890# CONFIG_XFS_FS is not set
891# CONFIG_GFS2_FS is not set
892# CONFIG_OCFS2_FS is not set
893# CONFIG_MINIX_FS is not set
894# CONFIG_ROMFS_FS is not set
895CONFIG_INOTIFY=y
896CONFIG_INOTIFY_USER=y
897# CONFIG_QUOTA is not set
898CONFIG_DNOTIFY=y
899# CONFIG_AUTOFS_FS is not set
900# CONFIG_AUTOFS4_FS is not set
901CONFIG_FUSE_FS=m
902
903#
904# CD-ROM/DVD Filesystems
905#
906# CONFIG_ISO9660_FS is not set
907# CONFIG_UDF_FS is not set
908
909#
910# DOS/FAT/NT Filesystems
911#
912CONFIG_FAT_FS=y
913# CONFIG_MSDOS_FS is not set
914CONFIG_VFAT_FS=y
915CONFIG_FAT_DEFAULT_CODEPAGE=437
916CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
917# CONFIG_NTFS_FS is not set
918
919#
920# Pseudo filesystems
921#
922CONFIG_PROC_FS=y
923CONFIG_PROC_SYSCTL=y
924CONFIG_SYSFS=y
925CONFIG_TMPFS=y
926# CONFIG_TMPFS_POSIX_ACL is not set
927# CONFIG_HUGETLB_PAGE is not set
928# CONFIG_CONFIGFS_FS is not set
929
930#
931# Miscellaneous filesystems
932#
933# CONFIG_ADFS_FS is not set
934# CONFIG_AFFS_FS is not set
935# CONFIG_HFS_FS is not set
936# CONFIG_HFSPLUS_FS is not set
937# CONFIG_BEFS_FS is not set
938# CONFIG_BFS_FS is not set
939# CONFIG_EFS_FS is not set
940CONFIG_JFFS2_FS=y
941CONFIG_JFFS2_FS_DEBUG=0
942CONFIG_JFFS2_FS_WRITEBUFFER=y
943# CONFIG_JFFS2_FS_WBUF_VERIFY is not set
944# CONFIG_JFFS2_SUMMARY is not set
945# CONFIG_JFFS2_FS_XATTR is not set
946# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set
947CONFIG_JFFS2_ZLIB=y
948# CONFIG_JFFS2_LZO is not set
949CONFIG_JFFS2_RTIME=y
950# CONFIG_JFFS2_RUBIN is not set
951# CONFIG_CRAMFS is not set
952# CONFIG_VXFS_FS is not set
953# CONFIG_HPFS_FS is not set
954# CONFIG_QNX4FS_FS is not set
955# CONFIG_SYSV_FS is not set
956# CONFIG_UFS_FS is not set
957CONFIG_NETWORK_FILESYSTEMS=y
958CONFIG_NFS_FS=y
959CONFIG_NFS_V3=y
960CONFIG_NFS_V3_ACL=y
961CONFIG_NFS_V4=y
962# CONFIG_NFS_DIRECTIO is not set
963# CONFIG_NFSD is not set
964CONFIG_ROOT_NFS=y
965CONFIG_LOCKD=y
966CONFIG_LOCKD_V4=y
967CONFIG_NFS_ACL_SUPPORT=y
968CONFIG_NFS_COMMON=y
969CONFIG_SUNRPC=y
970CONFIG_SUNRPC_GSS=y
971# CONFIG_SUNRPC_BIND34 is not set
972CONFIG_RPCSEC_GSS_KRB5=y
973# CONFIG_RPCSEC_GSS_SPKM3 is not set
974# CONFIG_SMB_FS is not set
975# CONFIG_CIFS is not set
976# CONFIG_NCP_FS is not set
977# CONFIG_CODA_FS is not set
978# CONFIG_AFS_FS is not set
979
980#
981# Partition Types
982#
983# CONFIG_PARTITION_ADVANCED is not set
984CONFIG_MSDOS_PARTITION=y
985CONFIG_NLS=y
986CONFIG_NLS_DEFAULT="iso8859-1"
987CONFIG_NLS_CODEPAGE_437=y
988# CONFIG_NLS_CODEPAGE_737 is not set
989# CONFIG_NLS_CODEPAGE_775 is not set
990CONFIG_NLS_CODEPAGE_850=y
991# CONFIG_NLS_CODEPAGE_852 is not set
992# CONFIG_NLS_CODEPAGE_855 is not set
993# CONFIG_NLS_CODEPAGE_857 is not set
994# CONFIG_NLS_CODEPAGE_860 is not set
995# CONFIG_NLS_CODEPAGE_861 is not set
996# CONFIG_NLS_CODEPAGE_862 is not set
997# CONFIG_NLS_CODEPAGE_863 is not set
998# CONFIG_NLS_CODEPAGE_864 is not set
999# CONFIG_NLS_CODEPAGE_865 is not set
1000# CONFIG_NLS_CODEPAGE_866 is not set
1001# CONFIG_NLS_CODEPAGE_869 is not set
1002# CONFIG_NLS_CODEPAGE_936 is not set
1003# CONFIG_NLS_CODEPAGE_950 is not set
1004# CONFIG_NLS_CODEPAGE_932 is not set
1005# CONFIG_NLS_CODEPAGE_949 is not set
1006# CONFIG_NLS_CODEPAGE_874 is not set
1007# CONFIG_NLS_ISO8859_8 is not set
1008# CONFIG_NLS_CODEPAGE_1250 is not set
1009# CONFIG_NLS_CODEPAGE_1251 is not set
1010# CONFIG_NLS_ASCII is not set
1011CONFIG_NLS_ISO8859_1=y
1012# CONFIG_NLS_ISO8859_2 is not set
1013# CONFIG_NLS_ISO8859_3 is not set
1014# CONFIG_NLS_ISO8859_4 is not set
1015# CONFIG_NLS_ISO8859_5 is not set
1016# CONFIG_NLS_ISO8859_6 is not set
1017# CONFIG_NLS_ISO8859_7 is not set
1018# CONFIG_NLS_ISO8859_9 is not set
1019# CONFIG_NLS_ISO8859_13 is not set
1020# CONFIG_NLS_ISO8859_14 is not set
1021# CONFIG_NLS_ISO8859_15 is not set
1022# CONFIG_NLS_KOI8_R is not set
1023# CONFIG_NLS_KOI8_U is not set
1024# CONFIG_NLS_UTF8 is not set
1025# CONFIG_DLM is not set
1026# CONFIG_INSTRUMENTATION is not set
1027
1028#
1029# Kernel hacking
1030#
1031# CONFIG_PRINTK_TIME is not set
1032CONFIG_ENABLE_WARN_DEPRECATED=y
1033CONFIG_ENABLE_MUST_CHECK=y
1034# CONFIG_MAGIC_SYSRQ is not set
1035# CONFIG_UNUSED_SYMBOLS is not set
1036# CONFIG_DEBUG_FS is not set
1037# CONFIG_HEADERS_CHECK is not set
1038CONFIG_DEBUG_KERNEL=y
1039# CONFIG_DEBUG_SHIRQ is not set
1040CONFIG_DETECT_SOFTLOCKUP=y
1041CONFIG_SCHED_DEBUG=y
1042# CONFIG_SCHEDSTATS is not set
1043# CONFIG_TIMER_STATS is not set
1044# CONFIG_DEBUG_SLAB is not set
1045# CONFIG_DEBUG_RT_MUTEXES is not set
1046# CONFIG_RT_MUTEX_TESTER is not set
1047# CONFIG_DEBUG_SPINLOCK is not set
1048# CONFIG_DEBUG_MUTEXES is not set
1049# CONFIG_DEBUG_LOCK_ALLOC is not set
1050# CONFIG_PROVE_LOCKING is not set
1051# CONFIG_LOCK_STAT is not set
1052# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
1053# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
1054# CONFIG_DEBUG_KOBJECT is not set
1055CONFIG_DEBUG_BUGVERBOSE=y
1056# CONFIG_DEBUG_INFO is not set
1057# CONFIG_DEBUG_VM is not set
1058# CONFIG_DEBUG_LIST is not set
1059# CONFIG_DEBUG_SG is not set
1060CONFIG_FRAME_POINTER=y
1061CONFIG_FORCED_INLINING=y
1062# CONFIG_BOOT_PRINTK_DELAY is not set
1063# CONFIG_RCU_TORTURE_TEST is not set
1064# CONFIG_FAULT_INJECTION is not set
1065# CONFIG_SAMPLES is not set
1066CONFIG_DEBUG_USER=y
1067# CONFIG_DEBUG_ERRORS is not set
1068CONFIG_DEBUG_LL=y
1069# CONFIG_DEBUG_ICEDCC is not set
1070
1071#
1072# Security options
1073#
1074# CONFIG_KEYS is not set
1075# CONFIG_SECURITY is not set
1076# CONFIG_SECURITY_FILE_CAPABILITIES is not set
1077CONFIG_CRYPTO=y
1078CONFIG_CRYPTO_ALGAPI=y
1079CONFIG_CRYPTO_BLKCIPHER=y
1080CONFIG_CRYPTO_MANAGER=y
1081# CONFIG_CRYPTO_HMAC is not set
1082# CONFIG_CRYPTO_XCBC is not set
1083# CONFIG_CRYPTO_NULL is not set
1084# CONFIG_CRYPTO_MD4 is not set
1085CONFIG_CRYPTO_MD5=y
1086# CONFIG_CRYPTO_SHA1 is not set
1087# CONFIG_CRYPTO_SHA256 is not set
1088# CONFIG_CRYPTO_SHA512 is not set
1089# CONFIG_CRYPTO_WP512 is not set
1090# CONFIG_CRYPTO_TGR192 is not set
1091# CONFIG_CRYPTO_GF128MUL is not set
1092# CONFIG_CRYPTO_ECB is not set
1093CONFIG_CRYPTO_CBC=y
1094# CONFIG_CRYPTO_PCBC is not set
1095# CONFIG_CRYPTO_LRW is not set
1096# CONFIG_CRYPTO_XTS is not set
1097# CONFIG_CRYPTO_CRYPTD is not set
1098CONFIG_CRYPTO_DES=y
1099# CONFIG_CRYPTO_FCRYPT is not set
1100# CONFIG_CRYPTO_BLOWFISH is not set
1101# CONFIG_CRYPTO_TWOFISH is not set
1102# CONFIG_CRYPTO_SERPENT is not set
1103# CONFIG_CRYPTO_AES is not set
1104# CONFIG_CRYPTO_CAST5 is not set
1105# CONFIG_CRYPTO_CAST6 is not set
1106# CONFIG_CRYPTO_TEA is not set
1107# CONFIG_CRYPTO_ARC4 is not set
1108# CONFIG_CRYPTO_KHAZAD is not set
1109# CONFIG_CRYPTO_ANUBIS is not set
1110# CONFIG_CRYPTO_SEED is not set
1111# CONFIG_CRYPTO_DEFLATE is not set
1112# CONFIG_CRYPTO_MICHAEL_MIC is not set
1113# CONFIG_CRYPTO_CRC32C is not set
1114# CONFIG_CRYPTO_CAMELLIA is not set
1115# CONFIG_CRYPTO_TEST is not set
1116# CONFIG_CRYPTO_AUTHENC is not set
1117# CONFIG_CRYPTO_HW is not set
1118
1119#
1120# Library routines
1121#
1122CONFIG_BITREVERSE=y
1123# CONFIG_CRC_CCITT is not set
1124# CONFIG_CRC16 is not set
1125# CONFIG_CRC_ITU_T is not set
1126CONFIG_CRC32=y
1127# CONFIG_CRC7 is not set
1128# CONFIG_LIBCRC32C is not set
1129CONFIG_ZLIB_INFLATE=y
1130CONFIG_ZLIB_DEFLATE=y
1131CONFIG_PLIST=y
1132CONFIG_HAS_IOMEM=y
1133CONFIG_HAS_IOPORT=y
1134CONFIG_HAS_DMA=y
diff --git a/arch/arm/configs/versatile_defconfig b/arch/arm/configs/versatile_defconfig
index 48dca69addae..8355f88f7292 100644
--- a/arch/arm/configs/versatile_defconfig
+++ b/arch/arm/configs/versatile_defconfig
@@ -151,7 +151,6 @@ CONFIG_ARM_AMBA=y
151# Kernel Features 151# Kernel Features
152# 152#
153# CONFIG_PREEMPT is not set 153# CONFIG_PREEMPT is not set
154# CONFIG_NO_IDLE_HZ is not set
155CONFIG_HZ=100 154CONFIG_HZ=100
156# CONFIG_AEABI is not set 155# CONFIG_AEABI is not set
157# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set 156# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set
diff --git a/arch/arm/kernel/atags.c b/arch/arm/kernel/atags.c
index 64c420805e6f..42a1a1415fa6 100644
--- a/arch/arm/kernel/atags.c
+++ b/arch/arm/kernel/atags.c
@@ -1,5 +1,4 @@
1#include <linux/slab.h> 1#include <linux/slab.h>
2#include <linux/kexec.h>
3#include <linux/proc_fs.h> 2#include <linux/proc_fs.h>
4#include <asm/setup.h> 3#include <asm/setup.h>
5#include <asm/types.h> 4#include <asm/types.h>
@@ -7,9 +6,8 @@
7 6
8struct buffer { 7struct buffer {
9 size_t size; 8 size_t size;
10 char *data; 9 char data[];
11}; 10};
12static struct buffer tags_buffer;
13 11
14static int 12static int
15read_buffer(char* page, char** start, off_t off, int count, 13read_buffer(char* page, char** start, off_t off, int count,
@@ -29,58 +27,57 @@ read_buffer(char* page, char** start, off_t off, int count,
29 return count; 27 return count;
30} 28}
31 29
32 30#define BOOT_PARAMS_SIZE 1536
33static int 31static char __initdata atags_copy[BOOT_PARAMS_SIZE];
34create_proc_entries(void)
35{
36 struct proc_dir_entry* tags_entry;
37
38 tags_entry = create_proc_read_entry("atags", 0400, NULL, read_buffer, &tags_buffer);
39 if (!tags_entry)
40 return -ENOMEM;
41
42 return 0;
43}
44
45
46static char __initdata atags_copy_buf[KEXEC_BOOT_PARAMS_SIZE];
47static char __initdata *atags_copy;
48 32
49void __init save_atags(const struct tag *tags) 33void __init save_atags(const struct tag *tags)
50{ 34{
51 atags_copy = atags_copy_buf; 35 memcpy(atags_copy, tags, sizeof(atags_copy));
52 memcpy(atags_copy, tags, KEXEC_BOOT_PARAMS_SIZE);
53} 36}
54 37
55
56static int __init init_atags_procfs(void) 38static int __init init_atags_procfs(void)
57{ 39{
58 struct tag *tag; 40 /*
59 int error; 41 * This cannot go into save_atags() because kmalloc and proc don't work
42 * yet when it is called.
43 */
44 struct proc_dir_entry *tags_entry;
45 struct tag *tag = (struct tag *)atags_copy;
46 struct buffer *b;
47 size_t size;
60 48
61 if (!atags_copy) { 49 if (tag->hdr.tag != ATAG_CORE) {
62 printk(KERN_WARNING "Exporting ATAGs: No saved tags found\n"); 50 printk(KERN_INFO "No ATAGs?");
63 return -EIO; 51 return -EINVAL;
64 } 52 }
65 53
66 for (tag = (struct tag *) atags_copy; tag->hdr.size; tag = tag_next(tag)) 54 for (; tag->hdr.size; tag = tag_next(tag))
67 ; 55 ;
68 56
69 tags_buffer.size = ((char *) tag - atags_copy) + sizeof(tag->hdr); 57 /* include the terminating ATAG_NONE */
70 tags_buffer.data = kmalloc(tags_buffer.size, GFP_KERNEL); 58 size = (char *)tag - atags_copy + sizeof(struct tag_header);
71 if (tags_buffer.data == NULL)
72 return -ENOMEM;
73 memcpy(tags_buffer.data, atags_copy, tags_buffer.size);
74
75 error = create_proc_entries();
76 if (error) {
77 printk(KERN_ERR "Exporting ATAGs: not enough memory\n");
78 kfree(tags_buffer.data);
79 tags_buffer.size = 0;
80 tags_buffer.data = NULL;
81 }
82 59
83 return error; 60 WARN_ON(tag->hdr.tag != ATAG_NONE);
84} 61
62 b = kmalloc(sizeof(*b) + size, GFP_KERNEL);
63 if (!b)
64 goto nomem;
85 65
66 b->size = size;
67 memcpy(b->data, atags_copy, size);
68
69 tags_entry = create_proc_read_entry("atags", 0400,
70 NULL, read_buffer, b);
71
72 if (!tags_entry)
73 goto nomem;
74
75 return 0;
76
77nomem:
78 kfree(b);
79 printk(KERN_ERR "Exporting ATAGs: not enough memory\n");
80
81 return -ENOMEM;
82}
86arch_initcall(init_atags_procfs); 83arch_initcall(init_atags_procfs);
diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c
index 46bf2ede6128..199b3680118b 100644
--- a/arch/arm/kernel/process.c
+++ b/arch/arm/kernel/process.c
@@ -133,10 +133,8 @@ static void default_idle(void)
133 cpu_relax(); 133 cpu_relax();
134 else { 134 else {
135 local_irq_disable(); 135 local_irq_disable();
136 if (!need_resched()) { 136 if (!need_resched())
137 timer_dyn_reprogram();
138 arch_idle(); 137 arch_idle();
139 }
140 local_irq_enable(); 138 local_irq_enable();
141 } 139 }
142} 140}
diff --git a/arch/arm/kernel/stacktrace.c b/arch/arm/kernel/stacktrace.c
index ae31deb2d065..90e0c35ae60d 100644
--- a/arch/arm/kernel/stacktrace.c
+++ b/arch/arm/kernel/stacktrace.c
@@ -36,6 +36,7 @@ EXPORT_SYMBOL(walk_stackframe);
36#ifdef CONFIG_STACKTRACE 36#ifdef CONFIG_STACKTRACE
37struct stack_trace_data { 37struct stack_trace_data {
38 struct stack_trace *trace; 38 struct stack_trace *trace;
39 unsigned int no_sched_functions;
39 unsigned int skip; 40 unsigned int skip;
40}; 41};
41 42
@@ -43,27 +44,52 @@ static int save_trace(struct stackframe *frame, void *d)
43{ 44{
44 struct stack_trace_data *data = d; 45 struct stack_trace_data *data = d;
45 struct stack_trace *trace = data->trace; 46 struct stack_trace *trace = data->trace;
47 unsigned long addr = frame->lr;
46 48
49 if (data->no_sched_functions && in_sched_functions(addr))
50 return 0;
47 if (data->skip) { 51 if (data->skip) {
48 data->skip--; 52 data->skip--;
49 return 0; 53 return 0;
50 } 54 }
51 55
52 trace->entries[trace->nr_entries++] = frame->lr; 56 trace->entries[trace->nr_entries++] = addr;
53 57
54 return trace->nr_entries >= trace->max_entries; 58 return trace->nr_entries >= trace->max_entries;
55} 59}
56 60
57void save_stack_trace(struct stack_trace *trace) 61void save_stack_trace_tsk(struct task_struct *tsk, struct stack_trace *trace)
58{ 62{
59 struct stack_trace_data data; 63 struct stack_trace_data data;
60 unsigned long fp, base; 64 unsigned long fp, base;
61 65
62 data.trace = trace; 66 data.trace = trace;
63 data.skip = trace->skip; 67 data.skip = trace->skip;
64 base = (unsigned long)task_stack_page(current); 68 base = (unsigned long)task_stack_page(tsk);
65 asm("mov %0, fp" : "=r" (fp)); 69
70 if (tsk != current) {
71#ifdef CONFIG_SMP
72 /*
73 * What guarantees do we have here that 'tsk'
74 * is not running on another CPU?
75 */
76 BUG();
77#else
78 data.no_sched_functions = 1;
79 fp = thread_saved_fp(tsk);
80#endif
81 } else {
82 data.no_sched_functions = 0;
83 asm("mov %0, fp" : "=r" (fp));
84 }
66 85
67 walk_stackframe(fp, base, base + THREAD_SIZE, save_trace, &data); 86 walk_stackframe(fp, base, base + THREAD_SIZE, save_trace, &data);
87 if (trace->nr_entries < trace->max_entries)
88 trace->entries[trace->nr_entries++] = ULONG_MAX;
89}
90
91void save_stack_trace(struct stack_trace *trace)
92{
93 save_stack_trace_tsk(current, trace);
68} 94}
69#endif 95#endif
diff --git a/arch/arm/kernel/time.c b/arch/arm/kernel/time.c
index b5867eca1d0b..cc5145b28e7f 100644
--- a/arch/arm/kernel/time.c
+++ b/arch/arm/kernel/time.c
@@ -365,108 +365,6 @@ static struct sysdev_class timer_sysclass = {
365 .resume = timer_resume, 365 .resume = timer_resume,
366}; 366};
367 367
368#ifdef CONFIG_NO_IDLE_HZ
369static int timer_dyn_tick_enable(void)
370{
371 struct dyn_tick_timer *dyn_tick = system_timer->dyn_tick;
372 unsigned long flags;
373 int ret = -ENODEV;
374
375 if (dyn_tick) {
376 spin_lock_irqsave(&dyn_tick->lock, flags);
377 ret = 0;
378 if (!(dyn_tick->state & DYN_TICK_ENABLED)) {
379 ret = dyn_tick->enable();
380
381 if (ret == 0)
382 dyn_tick->state |= DYN_TICK_ENABLED;
383 }
384 spin_unlock_irqrestore(&dyn_tick->lock, flags);
385 }
386
387 return ret;
388}
389
390static int timer_dyn_tick_disable(void)
391{
392 struct dyn_tick_timer *dyn_tick = system_timer->dyn_tick;
393 unsigned long flags;
394 int ret = -ENODEV;
395
396 if (dyn_tick) {
397 spin_lock_irqsave(&dyn_tick->lock, flags);
398 ret = 0;
399 if (dyn_tick->state & DYN_TICK_ENABLED) {
400 ret = dyn_tick->disable();
401
402 if (ret == 0)
403 dyn_tick->state &= ~DYN_TICK_ENABLED;
404 }
405 spin_unlock_irqrestore(&dyn_tick->lock, flags);
406 }
407
408 return ret;
409}
410
411/*
412 * Reprogram the system timer for at least the calculated time interval.
413 * This function should be called from the idle thread with IRQs disabled,
414 * immediately before sleeping.
415 */
416void timer_dyn_reprogram(void)
417{
418 struct dyn_tick_timer *dyn_tick = system_timer->dyn_tick;
419 unsigned long next, seq, flags;
420
421 if (!dyn_tick)
422 return;
423
424 spin_lock_irqsave(&dyn_tick->lock, flags);
425 if (dyn_tick->state & DYN_TICK_ENABLED) {
426 next = next_timer_interrupt();
427 do {
428 seq = read_seqbegin(&xtime_lock);
429 dyn_tick->reprogram(next - jiffies);
430 } while (read_seqretry(&xtime_lock, seq));
431 }
432 spin_unlock_irqrestore(&dyn_tick->lock, flags);
433}
434
435static ssize_t timer_show_dyn_tick(struct sys_device *dev, char *buf)
436{
437 return sprintf(buf, "%i\n",
438 (system_timer->dyn_tick->state & DYN_TICK_ENABLED) >> 1);
439}
440
441static ssize_t timer_set_dyn_tick(struct sys_device *dev, const char *buf,
442 size_t count)
443{
444 unsigned int enable = simple_strtoul(buf, NULL, 2);
445
446 if (enable)
447 timer_dyn_tick_enable();
448 else
449 timer_dyn_tick_disable();
450
451 return count;
452}
453static SYSDEV_ATTR(dyn_tick, 0644, timer_show_dyn_tick, timer_set_dyn_tick);
454
455/*
456 * dyntick=enable|disable
457 */
458static char dyntick_str[4] __initdata = "";
459
460static int __init dyntick_setup(char *str)
461{
462 if (str)
463 strlcpy(dyntick_str, str, sizeof(dyntick_str));
464 return 1;
465}
466
467__setup("dyntick=", dyntick_setup);
468#endif
469
470static int __init timer_init_sysfs(void) 368static int __init timer_init_sysfs(void)
471{ 369{
472 int ret = sysdev_class_register(&timer_sysclass); 370 int ret = sysdev_class_register(&timer_sysclass);
@@ -475,19 +373,6 @@ static int __init timer_init_sysfs(void)
475 ret = sysdev_register(&system_timer->dev); 373 ret = sysdev_register(&system_timer->dev);
476 } 374 }
477 375
478#ifdef CONFIG_NO_IDLE_HZ
479 if (ret == 0 && system_timer->dyn_tick) {
480 ret = sysdev_create_file(&system_timer->dev, &attr_dyn_tick);
481
482 /*
483 * Turn on dynamic tick after calibrate delay
484 * for correct bogomips
485 */
486 if (ret == 0 && dyntick_str[0] == 'e')
487 ret = timer_dyn_tick_enable();
488 }
489#endif
490
491 return ret; 376 return ret;
492} 377}
493 378
@@ -500,10 +385,5 @@ void __init time_init(void)
500 system_timer->offset = dummy_gettimeoffset; 385 system_timer->offset = dummy_gettimeoffset;
501#endif 386#endif
502 system_timer->init(); 387 system_timer->init();
503
504#ifdef CONFIG_NO_IDLE_HZ
505 if (system_timer->dyn_tick)
506 spin_lock_init(&system_timer->dyn_tick->lock);
507#endif
508} 388}
509 389
diff --git a/arch/arm/lib/copy_template.S b/arch/arm/lib/copy_template.S
index cab355c0c1f7..139cce646055 100644
--- a/arch/arm/lib/copy_template.S
+++ b/arch/arm/lib/copy_template.S
@@ -13,14 +13,6 @@
13 */ 13 */
14 14
15/* 15/*
16 * This can be used to enable code to cacheline align the source pointer.
17 * Experiments on tested architectures (StrongARM and XScale) didn't show
18 * this a worthwhile thing to do. That might be different in the future.
19 */
20//#define CALGN(code...) code
21#define CALGN(code...)
22
23/*
24 * Theory of operation 16 * Theory of operation
25 * ------------------- 17 * -------------------
26 * 18 *
@@ -82,7 +74,7 @@
82 stmfd sp!, {r5 - r8} 74 stmfd sp!, {r5 - r8}
83 blt 5f 75 blt 5f
84 76
85 CALGN( ands ip, r1, #31 ) 77 CALGN( ands ip, r0, #31 )
86 CALGN( rsb r3, ip, #32 ) 78 CALGN( rsb r3, ip, #32 )
87 CALGN( sbcnes r4, r3, r2 ) @ C is always set here 79 CALGN( sbcnes r4, r3, r2 ) @ C is always set here
88 CALGN( bcs 2f ) 80 CALGN( bcs 2f )
@@ -168,7 +160,7 @@
168 subs r2, r2, #28 160 subs r2, r2, #28
169 blt 14f 161 blt 14f
170 162
171 CALGN( ands ip, r1, #31 ) 163 CALGN( ands ip, r0, #31 )
172 CALGN( rsb ip, ip, #32 ) 164 CALGN( rsb ip, ip, #32 )
173 CALGN( sbcnes r4, ip, r2 ) @ C is always set here 165 CALGN( sbcnes r4, ip, r2 ) @ C is always set here
174 CALGN( subcc r2, r2, ip ) 166 CALGN( subcc r2, r2, ip )
diff --git a/arch/arm/lib/memmove.S b/arch/arm/lib/memmove.S
index ef7fddc14ac9..2e301b7bd8f1 100644
--- a/arch/arm/lib/memmove.S
+++ b/arch/arm/lib/memmove.S
@@ -13,14 +13,6 @@
13#include <linux/linkage.h> 13#include <linux/linkage.h>
14#include <asm/assembler.h> 14#include <asm/assembler.h>
15 15
16/*
17 * This can be used to enable code to cacheline align the source pointer.
18 * Experiments on tested architectures (StrongARM and XScale) didn't show
19 * this a worthwhile thing to do. That might be different in the future.
20 */
21//#define CALGN(code...) code
22#define CALGN(code...)
23
24 .text 16 .text
25 17
26/* 18/*
@@ -55,11 +47,12 @@ ENTRY(memmove)
55 stmfd sp!, {r5 - r8} 47 stmfd sp!, {r5 - r8}
56 blt 5f 48 blt 5f
57 49
58 CALGN( ands ip, r1, #31 ) 50 CALGN( ands ip, r0, #31 )
59 CALGN( sbcnes r4, ip, r2 ) @ C is always set here 51 CALGN( sbcnes r4, ip, r2 ) @ C is always set here
60 CALGN( bcs 2f ) 52 CALGN( bcs 2f )
61 CALGN( adr r4, 6f ) 53 CALGN( adr r4, 6f )
62 CALGN( subs r2, r2, ip ) @ C is set here 54 CALGN( subs r2, r2, ip ) @ C is set here
55 CALGN( rsb ip, ip, #32 )
63 CALGN( add pc, r4, ip ) 56 CALGN( add pc, r4, ip )
64 57
65 PLD( pld [r1, #-4] ) 58 PLD( pld [r1, #-4] )
@@ -138,8 +131,7 @@ ENTRY(memmove)
138 subs r2, r2, #28 131 subs r2, r2, #28
139 blt 14f 132 blt 14f
140 133
141 CALGN( ands ip, r1, #31 ) 134 CALGN( ands ip, r0, #31 )
142 CALGN( rsb ip, ip, #32 )
143 CALGN( sbcnes r4, ip, r2 ) @ C is always set here 135 CALGN( sbcnes r4, ip, r2 ) @ C is always set here
144 CALGN( subcc r2, r2, ip ) 136 CALGN( subcc r2, r2, ip )
145 CALGN( bcc 15f ) 137 CALGN( bcc 15f )
diff --git a/arch/arm/lib/memset.S b/arch/arm/lib/memset.S
index 95b110b07a89..b477d4ac88ef 100644
--- a/arch/arm/lib/memset.S
+++ b/arch/arm/lib/memset.S
@@ -39,6 +39,9 @@ ENTRY(memset)
39 mov r3, r1 39 mov r3, r1
40 cmp r2, #16 40 cmp r2, #16
41 blt 4f 41 blt 4f
42
43#if ! CALGN(1)+0
44
42/* 45/*
43 * We need an extra register for this loop - save the return address and 46 * We need an extra register for this loop - save the return address and
44 * use the LR 47 * use the LR
@@ -64,6 +67,49 @@ ENTRY(memset)
64 stmneia r0!, {r1, r3, ip, lr} 67 stmneia r0!, {r1, r3, ip, lr}
65 ldr lr, [sp], #4 68 ldr lr, [sp], #4
66 69
70#else
71
72/*
73 * This version aligns the destination pointer in order to write
74 * whole cache lines at once.
75 */
76
77 stmfd sp!, {r4-r7, lr}
78 mov r4, r1
79 mov r5, r1
80 mov r6, r1
81 mov r7, r1
82 mov ip, r1
83 mov lr, r1
84
85 cmp r2, #96
86 tstgt r0, #31
87 ble 3f
88
89 and ip, r0, #31
90 rsb ip, ip, #32
91 sub r2, r2, ip
92 movs ip, ip, lsl #(32 - 4)
93 stmcsia r0!, {r4, r5, r6, r7}
94 stmmiia r0!, {r4, r5}
95 tst ip, #(1 << 30)
96 mov ip, r1
97 strne r1, [r0], #4
98
993: subs r2, r2, #64
100 stmgeia r0!, {r1, r3-r7, ip, lr}
101 stmgeia r0!, {r1, r3-r7, ip, lr}
102 bgt 3b
103 ldmeqfd sp!, {r4-r7, pc}
104
105 tst r2, #32
106 stmneia r0!, {r1, r3-r7, ip, lr}
107 tst r2, #16
108 stmneia r0!, {r4-r7}
109 ldmfd sp!, {r4-r7, lr}
110
111#endif
112
674: tst r2, #8 1134: tst r2, #8
68 stmneia r0!, {r1, r3} 114 stmneia r0!, {r1, r3}
69 tst r2, #4 115 tst r2, #4
diff --git a/arch/arm/lib/memzero.S b/arch/arm/lib/memzero.S
index abf2508e8221..b8f79d80ee9b 100644
--- a/arch/arm/lib/memzero.S
+++ b/arch/arm/lib/memzero.S
@@ -39,6 +39,9 @@ ENTRY(__memzero)
39 */ 39 */
40 cmp r1, #16 @ 1 we can skip this chunk if we 40 cmp r1, #16 @ 1 we can skip this chunk if we
41 blt 4f @ 1 have < 16 bytes 41 blt 4f @ 1 have < 16 bytes
42
43#if ! CALGN(1)+0
44
42/* 45/*
43 * We need an extra register for this loop - save the return address and 46 * We need an extra register for this loop - save the return address and
44 * use the LR 47 * use the LR
@@ -64,6 +67,47 @@ ENTRY(__memzero)
64 stmneia r0!, {r2, r3, ip, lr} @ 4 67 stmneia r0!, {r2, r3, ip, lr} @ 4
65 ldr lr, [sp], #4 @ 1 68 ldr lr, [sp], #4 @ 1
66 69
70#else
71
72/*
73 * This version aligns the destination pointer in order to write
74 * whole cache lines at once.
75 */
76
77 stmfd sp!, {r4-r7, lr}
78 mov r4, r2
79 mov r5, r2
80 mov r6, r2
81 mov r7, r2
82 mov ip, r2
83 mov lr, r2
84
85 cmp r1, #96
86 andgts ip, r0, #31
87 ble 3f
88
89 rsb ip, ip, #32
90 sub r1, r1, ip
91 movs ip, ip, lsl #(32 - 4)
92 stmcsia r0!, {r4, r5, r6, r7}
93 stmmiia r0!, {r4, r5}
94 movs ip, ip, lsl #2
95 strcs r2, [r0], #4
96
973: subs r1, r1, #64
98 stmgeia r0!, {r2-r7, ip, lr}
99 stmgeia r0!, {r2-r7, ip, lr}
100 bgt 3b
101 ldmeqfd sp!, {r4-r7, pc}
102
103 tst r1, #32
104 stmneia r0!, {r2-r7, ip, lr}
105 tst r1, #16
106 stmneia r0!, {r4-r7}
107 ldmfd sp!, {r4-r7, lr}
108
109#endif
110
674: tst r1, #8 @ 1 8 bytes or more? 1114: tst r1, #8 @ 1 8 bytes or more?
68 stmneia r0!, {r2, r3} @ 2 112 stmneia r0!, {r2, r3} @ 2
69 tst r1, #4 @ 1 4 bytes or more? 113 tst r1, #4 @ 1 4 bytes or more?
diff --git a/arch/arm/mach-at91/Kconfig b/arch/arm/mach-at91/Kconfig
index 0fc07b6db749..5bad6b9b00d7 100644
--- a/arch/arm/mach-at91/Kconfig
+++ b/arch/arm/mach-at91/Kconfig
@@ -30,6 +30,11 @@ config ARCH_AT91SAM9RL
30 select GENERIC_TIME 30 select GENERIC_TIME
31 select GENERIC_CLOCKEVENTS 31 select GENERIC_CLOCKEVENTS
32 32
33config ARCH_AT91SAM9G20
34 bool "AT91SAM9G20"
35 select GENERIC_TIME
36 select GENERIC_CLOCKEVENTS
37
33config ARCH_AT91CAP9 38config ARCH_AT91CAP9
34 bool "AT91CAP9" 39 bool "AT91CAP9"
35 select GENERIC_TIME 40 select GENERIC_TIME
@@ -126,6 +131,12 @@ config MACH_ECBAT91
126 Select this if you are using emQbit's ECB_AT91 board. 131 Select this if you are using emQbit's ECB_AT91 board.
127 <http://wiki.emqbit.com/free-ecb-at91> 132 <http://wiki.emqbit.com/free-ecb-at91>
128 133
134config MACH_YL9200
135 bool "ucDragon YL-9200"
136 depends on ARCH_AT91RM9200
137 help
138 Select this if you are using the ucDragon YL-9200 board.
139
129endif 140endif
130 141
131# ---------------------------------------------------------- 142# ----------------------------------------------------------
@@ -164,6 +175,20 @@ config MACH_SAM9_L9260
164 Select this if you are using Olimex's SAM9-L9260 board based on the Atmel AT91SAM9260. 175 Select this if you are using Olimex's SAM9-L9260 board based on the Atmel AT91SAM9260.
165 <http://www.olimex.com/dev/sam9-L9260.html> 176 <http://www.olimex.com/dev/sam9-L9260.html>
166 177
178config MACH_USB_A9260
179 bool "CALAO USB-A9260"
180 depends on ARCH_AT91SAM9260
181 help
182 Select this if you are using a Calao Systems USB-A9260.
183 <http://www.calao-systems.com>
184
185config MACH_QIL_A9260
186 bool "CALAO QIL-A9260 board"
187 depends on ARCH_AT91SAM9260
188 help
189 Select this if you are using a Calao Systems QIL-A9260 Board.
190 <http://www.calao-systems.com>
191
167endif 192endif
168 193
169# ---------------------------------------------------------- 194# ----------------------------------------------------------
@@ -194,6 +219,13 @@ config MACH_AT91SAM9263EK
194 Select this if you are using Atmel's AT91SAM9263-EK Evaluation Kit. 219 Select this if you are using Atmel's AT91SAM9263-EK Evaluation Kit.
195 <http://www.atmel.com/dyn/products/tools_card.asp?tool_id=4057> 220 <http://www.atmel.com/dyn/products/tools_card.asp?tool_id=4057>
196 221
222config MACH_USB_A9263
223 bool "CALAO USB-A9263"
224 depends on ARCH_AT91SAM9263
225 help
226 Select this if you are using a Calao Systems USB-A9263.
227 <http://www.calao-systems.com>
228
197endif 229endif
198 230
199# ---------------------------------------------------------- 231# ----------------------------------------------------------
@@ -212,6 +244,20 @@ endif
212 244
213# ---------------------------------------------------------- 245# ----------------------------------------------------------
214 246
247if ARCH_AT91SAM9G20
248
249comment "AT91SAM9G20 Board Type"
250
251config MACH_AT91SAM9G20EK
252 bool "Atmel AT91SAM9G20-EK Evaluation Kit"
253 depends on ARCH_AT91SAM9G20
254 help
255 Select this if you are using Atmel's AT91SAM9G20-EK Evaluation Kit.
256
257endif
258
259# ----------------------------------------------------------
260
215if ARCH_AT91CAP9 261if ARCH_AT91CAP9
216 262
217comment "AT91CAP9 Board Type" 263comment "AT91CAP9 Board Type"
@@ -247,13 +293,13 @@ comment "AT91 Board Options"
247 293
248config MTD_AT91_DATAFLASH_CARD 294config MTD_AT91_DATAFLASH_CARD
249 bool "Enable DataFlash Card support" 295 bool "Enable DataFlash Card support"
250 depends on (ARCH_AT91RM9200DK || MACH_AT91RM9200EK || MACH_AT91SAM9260EK || MACH_AT91SAM9261EK || MACH_AT91SAM9263EK || MACH_AT91CAP9ADK || MACH_SAM9_L9260 || MACH_ECBAT91) 296 depends on (ARCH_AT91RM9200DK || MACH_AT91RM9200EK || MACH_AT91SAM9260EK || MACH_AT91SAM9261EK || MACH_AT91SAM9263EK || MACH_AT91SAM9G20EK || MACH_ECBAT91 || MACH_SAM9_L9260 || MACH_AT91CAP9ADK)
251 help 297 help
252 Enable support for the DataFlash card. 298 Enable support for the DataFlash card.
253 299
254config MTD_NAND_AT91_BUSWIDTH_16 300config MTD_NAND_AT91_BUSWIDTH_16
255 bool "Enable 16-bit data bus interface to NAND flash" 301 bool "Enable 16-bit data bus interface to NAND flash"
256 depends on (MACH_AT91SAM9260EK || MACH_AT91SAM9261EK || MACH_AT91SAM9263EK || MACH_AT91CAP9ADK) 302 depends on (MACH_AT91SAM9260EK || MACH_AT91SAM9261EK || MACH_AT91SAM9263EK || MACH_AT91SAM9G20EK || MACH_AT91CAP9ADK)
257 help 303 help
258 On AT91SAM926x boards both types of NAND flash can be present 304 On AT91SAM926x boards both types of NAND flash can be present
259 (8 and 16 bit data bus width). 305 (8 and 16 bit data bus width).
@@ -302,15 +348,15 @@ config AT91_EARLY_USART2
302 348
303config AT91_EARLY_USART3 349config AT91_EARLY_USART3
304 bool "USART3" 350 bool "USART3"
305 depends on (ARCH_AT91RM9200 || ARCH_AT91SAM9RL || ARCH_AT91SAM9260) 351 depends on (ARCH_AT91RM9200 || ARCH_AT91SAM9RL || ARCH_AT91SAM9260 || ARCH_AT91SAM9G20)
306 352
307config AT91_EARLY_USART4 353config AT91_EARLY_USART4
308 bool "USART4" 354 bool "USART4"
309 depends on ARCH_AT91SAM9260 355 depends on ARCH_AT91SAM9260 || ARCH_AT91SAM9G20
310 356
311config AT91_EARLY_USART5 357config AT91_EARLY_USART5
312 bool "USART5" 358 bool "USART5"
313 depends on ARCH_AT91SAM9260 359 depends on ARCH_AT91SAM9260 || ARCH_AT91SAM9G20
314 360
315endchoice 361endchoice
316 362
diff --git a/arch/arm/mach-at91/Makefile b/arch/arm/mach-at91/Makefile
index 8d9bc0153b18..7d641f97516b 100644
--- a/arch/arm/mach-at91/Makefile
+++ b/arch/arm/mach-at91/Makefile
@@ -15,6 +15,7 @@ obj-$(CONFIG_ARCH_AT91SAM9260) += at91sam9260.o at91sam926x_time.o at91sam9260_d
15obj-$(CONFIG_ARCH_AT91SAM9261) += at91sam9261.o at91sam926x_time.o at91sam9261_devices.o 15obj-$(CONFIG_ARCH_AT91SAM9261) += at91sam9261.o at91sam926x_time.o at91sam9261_devices.o
16obj-$(CONFIG_ARCH_AT91SAM9263) += at91sam9263.o at91sam926x_time.o at91sam9263_devices.o 16obj-$(CONFIG_ARCH_AT91SAM9263) += at91sam9263.o at91sam926x_time.o at91sam9263_devices.o
17obj-$(CONFIG_ARCH_AT91SAM9RL) += at91sam9rl.o at91sam926x_time.o at91sam9rl_devices.o 17obj-$(CONFIG_ARCH_AT91SAM9RL) += at91sam9rl.o at91sam926x_time.o at91sam9rl_devices.o
18obj-$(CONFIG_ARCH_AT91SAM9G20) += at91sam9260.o at91sam926x_time.o at91sam9260_devices.o
18obj-$(CONFIG_ARCH_AT91CAP9) += at91cap9.o at91sam926x_time.o at91cap9_devices.o 19obj-$(CONFIG_ARCH_AT91CAP9) += at91cap9.o at91sam926x_time.o at91cap9_devices.o
19obj-$(CONFIG_ARCH_AT91X40) += at91x40.o at91x40_time.o 20obj-$(CONFIG_ARCH_AT91X40) += at91x40.o at91x40_time.o
20 21
@@ -30,21 +31,28 @@ obj-$(CONFIG_MACH_ATEB9200) += board-eb9200.o
30obj-$(CONFIG_MACH_KAFA) += board-kafa.o 31obj-$(CONFIG_MACH_KAFA) += board-kafa.o
31obj-$(CONFIG_MACH_PICOTUX2XX) += board-picotux200.o 32obj-$(CONFIG_MACH_PICOTUX2XX) += board-picotux200.o
32obj-$(CONFIG_MACH_ECBAT91) += board-ecbat91.o 33obj-$(CONFIG_MACH_ECBAT91) += board-ecbat91.o
34obj-$(CONFIG_MACH_YL9200) += board-yl-9200.o
33 35
34# AT91SAM9260 board-specific support 36# AT91SAM9260 board-specific support
35obj-$(CONFIG_MACH_AT91SAM9260EK) += board-sam9260ek.o 37obj-$(CONFIG_MACH_AT91SAM9260EK) += board-sam9260ek.o
36obj-$(CONFIG_MACH_CAM60) += board-cam60.o 38obj-$(CONFIG_MACH_CAM60) += board-cam60.o
37obj-$(CONFIG_MACH_SAM9_L9260) += board-sam9-l9260.o 39obj-$(CONFIG_MACH_SAM9_L9260) += board-sam9-l9260.o
40obj-$(CONFIG_MACH_USB_A9260) += board-usb-a9260.o
41obj-$(CONFIG_MACH_QIL_A9260) += board-qil-a9260.o
38 42
39# AT91SAM9261 board-specific support 43# AT91SAM9261 board-specific support
40obj-$(CONFIG_MACH_AT91SAM9261EK) += board-sam9261ek.o 44obj-$(CONFIG_MACH_AT91SAM9261EK) += board-sam9261ek.o
41 45
42# AT91SAM9263 board-specific support 46# AT91SAM9263 board-specific support
43obj-$(CONFIG_MACH_AT91SAM9263EK) += board-sam9263ek.o 47obj-$(CONFIG_MACH_AT91SAM9263EK) += board-sam9263ek.o
48obj-$(CONFIG_MACH_USB_A9263) += board-usb-a9263.o
44 49
45# AT91SAM9RL board-specific support 50# AT91SAM9RL board-specific support
46obj-$(CONFIG_MACH_AT91SAM9RLEK) += board-sam9rlek.o 51obj-$(CONFIG_MACH_AT91SAM9RLEK) += board-sam9rlek.o
47 52
53# AT91SAM9G20 board-specific support
54obj-$(CONFIG_MACH_AT91SAM9G20EK) += board-sam9g20ek.o
55
48# AT91CAP9 board-specific support 56# AT91CAP9 board-specific support
49obj-$(CONFIG_MACH_AT91CAP9ADK) += board-cap9adk.o 57obj-$(CONFIG_MACH_AT91CAP9ADK) += board-cap9adk.o
50 58
diff --git a/arch/arm/mach-at91/at91cap9_devices.c b/arch/arm/mach-at91/at91cap9_devices.c
index be526746e01e..747b9dedab88 100644
--- a/arch/arm/mach-at91/at91cap9_devices.c
+++ b/arch/arm/mach-at91/at91cap9_devices.c
@@ -84,6 +84,105 @@ void __init at91_add_device_usbh(struct at91_usbh_data *data) {}
84 84
85 85
86/* -------------------------------------------------------------------- 86/* --------------------------------------------------------------------
87 * USB HS Device (Gadget)
88 * -------------------------------------------------------------------- */
89
90#if defined(CONFIG_USB_GADGET_ATMEL_USBA) || defined(CONFIG_USB_GADGET_ATMEL_USBA_MODULE)
91
92static struct resource usba_udc_resources[] = {
93 [0] = {
94 .start = AT91CAP9_UDPHS_FIFO,
95 .end = AT91CAP9_UDPHS_FIFO + SZ_512K - 1,
96 .flags = IORESOURCE_MEM,
97 },
98 [1] = {
99 .start = AT91CAP9_BASE_UDPHS,
100 .end = AT91CAP9_BASE_UDPHS + SZ_1K - 1,
101 .flags = IORESOURCE_MEM,
102 },
103 [2] = {
104 .start = AT91CAP9_ID_UDPHS,
105 .end = AT91CAP9_ID_UDPHS,
106 .flags = IORESOURCE_IRQ,
107 },
108};
109
110#define EP(nam, idx, maxpkt, maxbk, dma, isoc) \
111 [idx] = { \
112 .name = nam, \
113 .index = idx, \
114 .fifo_size = maxpkt, \
115 .nr_banks = maxbk, \
116 .can_dma = dma, \
117 .can_isoc = isoc, \
118 }
119
120static struct usba_ep_data usba_udc_ep[] = {
121 EP("ep0", 0, 64, 1, 0, 0),
122 EP("ep1", 1, 1024, 3, 1, 1),
123 EP("ep2", 2, 1024, 3, 1, 1),
124 EP("ep3", 3, 1024, 2, 1, 1),
125 EP("ep4", 4, 1024, 2, 1, 1),
126 EP("ep5", 5, 1024, 2, 1, 0),
127 EP("ep6", 6, 1024, 2, 1, 0),
128 EP("ep7", 7, 1024, 2, 0, 0),
129};
130
131#undef EP
132
133/*
134 * pdata doesn't have room for any endpoints, so we need to
135 * append room for the ones we need right after it.
136 */
137static struct {
138 struct usba_platform_data pdata;
139 struct usba_ep_data ep[8];
140} usba_udc_data;
141
142static struct platform_device at91_usba_udc_device = {
143 .name = "atmel_usba_udc",
144 .id = -1,
145 .dev = {
146 .platform_data = &usba_udc_data.pdata,
147 },
148 .resource = usba_udc_resources,
149 .num_resources = ARRAY_SIZE(usba_udc_resources),
150};
151
152void __init at91_add_device_usba(struct usba_platform_data *data)
153{
154 at91_sys_write(AT91_MATRIX_UDPHS, AT91_MATRIX_SELECT_UDPHS |
155 AT91_MATRIX_UDPHS_BYPASS_LOCK);
156
157 /*
158 * Invalid pins are 0 on AT91, but the usba driver is shared
159 * with AVR32, which use negative values instead. Once/if
160 * gpio_is_valid() is ported to AT91, revisit this code.
161 */
162 usba_udc_data.pdata.vbus_pin = -EINVAL;
163 usba_udc_data.pdata.num_ep = ARRAY_SIZE(usba_udc_ep);
164 memcpy(usba_udc_data.ep, usba_udc_ep, sizeof(usba_udc_ep));;
165
166 if (data && data->vbus_pin > 0) {
167 at91_set_gpio_input(data->vbus_pin, 0);
168 at91_set_deglitch(data->vbus_pin, 1);
169 usba_udc_data.pdata.vbus_pin = data->vbus_pin;
170 }
171
172 /* Pullup pin is handled internally by USB device peripheral */
173
174 /* Clocks */
175 at91_clock_associate("utmi_clk", &at91_usba_udc_device.dev, "hclk");
176 at91_clock_associate("udphs_clk", &at91_usba_udc_device.dev, "pclk");
177
178 platform_device_register(&at91_usba_udc_device);
179}
180#else
181void __init at91_add_device_usba(struct usba_platform_data *data) {}
182#endif
183
184
185/* --------------------------------------------------------------------
87 * Ethernet 186 * Ethernet
88 * -------------------------------------------------------------------- */ 187 * -------------------------------------------------------------------- */
89 188
diff --git a/arch/arm/mach-at91/at91sam9260.c b/arch/arm/mach-at91/at91sam9260.c
index ee26550cdc21..380f12a12200 100644
--- a/arch/arm/mach-at91/at91sam9260.c
+++ b/arch/arm/mach-at91/at91sam9260.c
@@ -47,6 +47,20 @@ static struct map_desc at91sam9260_sram_desc[] __initdata = {
47 } 47 }
48}; 48};
49 49
50static struct map_desc at91sam9g20_sram_desc[] __initdata = {
51 {
52 .virtual = AT91_IO_VIRT_BASE - AT91SAM9G20_SRAM0_SIZE,
53 .pfn = __phys_to_pfn(AT91SAM9G20_SRAM0_BASE),
54 .length = AT91SAM9G20_SRAM0_SIZE,
55 .type = MT_DEVICE,
56 }, {
57 .virtual = AT91_IO_VIRT_BASE - AT91SAM9G20_SRAM0_SIZE - AT91SAM9G20_SRAM1_SIZE,
58 .pfn = __phys_to_pfn(AT91SAM9G20_SRAM1_BASE),
59 .length = AT91SAM9G20_SRAM1_SIZE,
60 .type = MT_DEVICE,
61 }
62};
63
50static struct map_desc at91sam9xe_sram_desc[] __initdata = { 64static struct map_desc at91sam9xe_sram_desc[] __initdata = {
51 { 65 {
52 .pfn = __phys_to_pfn(AT91SAM9XE_SRAM_BASE), 66 .pfn = __phys_to_pfn(AT91SAM9XE_SRAM_BASE),
@@ -307,6 +321,8 @@ void __init at91sam9260_initialize(unsigned long main_clock)
307 321
308 if (cpu_is_at91sam9xe()) 322 if (cpu_is_at91sam9xe())
309 at91sam9xe_initialize(); 323 at91sam9xe_initialize();
324 else if (cpu_is_at91sam9g20())
325 iotable_init(at91sam9g20_sram_desc, ARRAY_SIZE(at91sam9g20_sram_desc));
310 else 326 else
311 iotable_init(at91sam9260_sram_desc, ARRAY_SIZE(at91sam9260_sram_desc)); 327 iotable_init(at91sam9260_sram_desc, ARRAY_SIZE(at91sam9260_sram_desc));
312 328
diff --git a/arch/arm/mach-at91/at91sam9260_devices.c b/arch/arm/mach-at91/at91sam9260_devices.c
index 393a32aefce5..86cba4ac29b1 100644
--- a/arch/arm/mach-at91/at91sam9260_devices.c
+++ b/arch/arm/mach-at91/at91sam9260_devices.c
@@ -18,6 +18,7 @@
18 18
19#include <asm/arch/board.h> 19#include <asm/arch/board.h>
20#include <asm/arch/gpio.h> 20#include <asm/arch/gpio.h>
21#include <asm/arch/cpu.h>
21#include <asm/arch/at91sam9260.h> 22#include <asm/arch/at91sam9260.h>
22#include <asm/arch/at91sam9260_matrix.h> 23#include <asm/arch/at91sam9260_matrix.h>
23#include <asm/arch/at91sam9_smc.h> 24#include <asm/arch/at91sam9_smc.h>
@@ -320,20 +321,41 @@ void __init at91_add_device_nand(struct at91_nand_data *data)
320 csa = at91_sys_read(AT91_MATRIX_EBICSA); 321 csa = at91_sys_read(AT91_MATRIX_EBICSA);
321 at91_sys_write(AT91_MATRIX_EBICSA, csa | AT91_MATRIX_CS3A_SMC_SMARTMEDIA); 322 at91_sys_write(AT91_MATRIX_EBICSA, csa | AT91_MATRIX_CS3A_SMC_SMARTMEDIA);
322 323
323 /* set the bus interface characteristics */ 324 if (cpu_is_at91sam9260()) {
324 at91_sys_write(AT91_SMC_SETUP(3), AT91_SMC_NWESETUP_(0) | AT91_SMC_NCS_WRSETUP_(0) 325 /* Timing for sam9260 */
325 | AT91_SMC_NRDSETUP_(0) | AT91_SMC_NCS_RDSETUP_(0)); 326 /* set the bus interface characteristics */
327 at91_sys_write(AT91_SMC_SETUP(3), AT91_SMC_NWESETUP_(1) | AT91_SMC_NCS_WRSETUP_(0)
328 | AT91_SMC_NRDSETUP_(1) | AT91_SMC_NCS_RDSETUP_(0));
326 329
327 at91_sys_write(AT91_SMC_PULSE(3), AT91_SMC_NWEPULSE_(3) | AT91_SMC_NCS_WRPULSE_(3) 330 at91_sys_write(AT91_SMC_PULSE(3), AT91_SMC_NWEPULSE_(3) | AT91_SMC_NCS_WRPULSE_(3)
328 | AT91_SMC_NRDPULSE_(3) | AT91_SMC_NCS_RDPULSE_(3)); 331 | AT91_SMC_NRDPULSE_(3) | AT91_SMC_NCS_RDPULSE_(3));
329 332
330 at91_sys_write(AT91_SMC_CYCLE(3), AT91_SMC_NWECYCLE_(5) | AT91_SMC_NRDCYCLE_(5)); 333 at91_sys_write(AT91_SMC_CYCLE(3), AT91_SMC_NWECYCLE_(5) | AT91_SMC_NRDCYCLE_(5));
331 334
332 if (data->bus_width_16) 335 if (data->bus_width_16)
333 mode = AT91_SMC_DBW_16; 336 mode = AT91_SMC_DBW_16;
334 else 337 else
335 mode = AT91_SMC_DBW_8; 338 mode = AT91_SMC_DBW_8;
336 at91_sys_write(AT91_SMC_MODE(3), mode | AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE | AT91_SMC_TDF_(2)); 339 at91_sys_write(AT91_SMC_MODE(3), mode | AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE | AT91_SMC_TDF_(2));
340 }
341
342 if (cpu_is_at91sam9g20()) {
343 /* Timing for sam9g20 */
344 /* set the bus interface characteristics */
345 at91_sys_write(AT91_SMC_SETUP(3), AT91_SMC_NWESETUP_(2) | AT91_SMC_NCS_WRSETUP_(0)
346 | AT91_SMC_NRDSETUP_(2) | AT91_SMC_NCS_RDSETUP_(0));
347
348 at91_sys_write(AT91_SMC_PULSE(3), AT91_SMC_NWEPULSE_(4) | AT91_SMC_NCS_WRPULSE_(4)
349 | AT91_SMC_NRDPULSE_(4) | AT91_SMC_NCS_RDPULSE_(4));
350
351 at91_sys_write(AT91_SMC_CYCLE(3), AT91_SMC_NWECYCLE_(7) | AT91_SMC_NRDCYCLE_(7));
352
353 if (data->bus_width_16)
354 mode = AT91_SMC_DBW_16;
355 else
356 mode = AT91_SMC_DBW_8;
357 at91_sys_write(AT91_SMC_MODE(3), mode | AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE | AT91_SMC_TDF_(3));
358 }
337 359
338 /* enable pin */ 360 /* enable pin */
339 if (data->enable_pin) 361 if (data->enable_pin)
diff --git a/arch/arm/mach-at91/at91sam9261_devices.c b/arch/arm/mach-at91/at91sam9261_devices.c
index 0babb645b83c..ec1891375dfb 100644
--- a/arch/arm/mach-at91/at91sam9261_devices.c
+++ b/arch/arm/mach-at91/at91sam9261_devices.c
@@ -232,19 +232,19 @@ void __init at91_add_device_nand(struct at91_nand_data *data)
232 at91_sys_write(AT91_MATRIX_EBICSA, csa | AT91_MATRIX_CS3A_SMC_SMARTMEDIA); 232 at91_sys_write(AT91_MATRIX_EBICSA, csa | AT91_MATRIX_CS3A_SMC_SMARTMEDIA);
233 233
234 /* set the bus interface characteristics */ 234 /* set the bus interface characteristics */
235 at91_sys_write(AT91_SMC_SETUP(3), AT91_SMC_NWESETUP_(0) | AT91_SMC_NCS_WRSETUP_(0) 235 at91_sys_write(AT91_SMC_SETUP(3), AT91_SMC_NWESETUP_(1) | AT91_SMC_NCS_WRSETUP_(0)
236 | AT91_SMC_NRDSETUP_(0) | AT91_SMC_NCS_RDSETUP_(0)); 236 | AT91_SMC_NRDSETUP_(1) | AT91_SMC_NCS_RDSETUP_(0));
237 237
238 at91_sys_write(AT91_SMC_PULSE(3), AT91_SMC_NWEPULSE_(2) | AT91_SMC_NCS_WRPULSE_(5) 238 at91_sys_write(AT91_SMC_PULSE(3), AT91_SMC_NWEPULSE_(3) | AT91_SMC_NCS_WRPULSE_(3)
239 | AT91_SMC_NRDPULSE_(2) | AT91_SMC_NCS_RDPULSE_(5)); 239 | AT91_SMC_NRDPULSE_(3) | AT91_SMC_NCS_RDPULSE_(3));
240 240
241 at91_sys_write(AT91_SMC_CYCLE(3), AT91_SMC_NWECYCLE_(7) | AT91_SMC_NRDCYCLE_(7)); 241 at91_sys_write(AT91_SMC_CYCLE(3), AT91_SMC_NWECYCLE_(5) | AT91_SMC_NRDCYCLE_(5));
242 242
243 if (data->bus_width_16) 243 if (data->bus_width_16)
244 mode = AT91_SMC_DBW_16; 244 mode = AT91_SMC_DBW_16;
245 else 245 else
246 mode = AT91_SMC_DBW_8; 246 mode = AT91_SMC_DBW_8;
247 at91_sys_write(AT91_SMC_MODE(3), mode | AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE | AT91_SMC_TDF_(1)); 247 at91_sys_write(AT91_SMC_MODE(3), mode | AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE | AT91_SMC_TDF_(2));
248 248
249 /* enable pin */ 249 /* enable pin */
250 if (data->enable_pin) 250 if (data->enable_pin)
diff --git a/arch/arm/mach-at91/at91sam9263_devices.c b/arch/arm/mach-at91/at91sam9263_devices.c
index 719667e25c98..8a81f76f0200 100644
--- a/arch/arm/mach-at91/at91sam9263_devices.c
+++ b/arch/arm/mach-at91/at91sam9263_devices.c
@@ -391,8 +391,8 @@ void __init at91_add_device_nand(struct at91_nand_data *data)
391 at91_sys_write(AT91_MATRIX_EBI0CSA, csa | AT91_MATRIX_EBI0_CS3A_SMC_SMARTMEDIA); 391 at91_sys_write(AT91_MATRIX_EBI0CSA, csa | AT91_MATRIX_EBI0_CS3A_SMC_SMARTMEDIA);
392 392
393 /* set the bus interface characteristics */ 393 /* set the bus interface characteristics */
394 at91_sys_write(AT91_SMC_SETUP(3), AT91_SMC_NWESETUP_(0) | AT91_SMC_NCS_WRSETUP_(0) 394 at91_sys_write(AT91_SMC_SETUP(3), AT91_SMC_NWESETUP_(1) | AT91_SMC_NCS_WRSETUP_(0)
395 | AT91_SMC_NRDSETUP_(0) | AT91_SMC_NCS_RDSETUP_(0)); 395 | AT91_SMC_NRDSETUP_(1) | AT91_SMC_NCS_RDSETUP_(0));
396 396
397 at91_sys_write(AT91_SMC_PULSE(3), AT91_SMC_NWEPULSE_(3) | AT91_SMC_NCS_WRPULSE_(3) 397 at91_sys_write(AT91_SMC_PULSE(3), AT91_SMC_NWEPULSE_(3) | AT91_SMC_NCS_WRPULSE_(3)
398 | AT91_SMC_NRDPULSE_(3) | AT91_SMC_NCS_RDPULSE_(3)); 398 | AT91_SMC_NRDPULSE_(3) | AT91_SMC_NCS_RDPULSE_(3));
diff --git a/arch/arm/mach-at91/at91sam9rl_devices.c b/arch/arm/mach-at91/at91sam9rl_devices.c
index 450db304936f..ae28101e7542 100644
--- a/arch/arm/mach-at91/at91sam9rl_devices.c
+++ b/arch/arm/mach-at91/at91sam9rl_devices.c
@@ -26,6 +26,101 @@
26 26
27 27
28/* -------------------------------------------------------------------- 28/* --------------------------------------------------------------------
29 * USB HS Device (Gadget)
30 * -------------------------------------------------------------------- */
31
32#if defined(CONFIG_USB_GADGET_ATMEL_USBA) || defined(CONFIG_USB_GADGET_ATMEL_USBA_MODULE)
33
34static struct resource usba_udc_resources[] = {
35 [0] = {
36 .start = AT91SAM9RL_UDPHS_FIFO,
37 .end = AT91SAM9RL_UDPHS_FIFO + SZ_512K - 1,
38 .flags = IORESOURCE_MEM,
39 },
40 [1] = {
41 .start = AT91SAM9RL_BASE_UDPHS,
42 .end = AT91SAM9RL_BASE_UDPHS + SZ_1K - 1,
43 .flags = IORESOURCE_MEM,
44 },
45 [2] = {
46 .start = AT91SAM9RL_ID_UDPHS,
47 .end = AT91SAM9RL_ID_UDPHS,
48 .flags = IORESOURCE_IRQ,
49 },
50};
51
52#define EP(nam, idx, maxpkt, maxbk, dma, isoc) \
53 [idx] = { \
54 .name = nam, \
55 .index = idx, \
56 .fifo_size = maxpkt, \
57 .nr_banks = maxbk, \
58 .can_dma = dma, \
59 .can_isoc = isoc, \
60 }
61
62static struct usba_ep_data usba_udc_ep[] __initdata = {
63 EP("ep0", 0, 64, 1, 0, 0),
64 EP("ep1", 1, 1024, 2, 1, 1),
65 EP("ep2", 2, 1024, 2, 1, 1),
66 EP("ep3", 3, 1024, 3, 1, 0),
67 EP("ep4", 4, 1024, 3, 1, 0),
68 EP("ep5", 5, 1024, 3, 1, 1),
69 EP("ep6", 6, 1024, 3, 1, 1),
70};
71
72#undef EP
73
74/*
75 * pdata doesn't have room for any endpoints, so we need to
76 * append room for the ones we need right after it.
77 */
78static struct {
79 struct usba_platform_data pdata;
80 struct usba_ep_data ep[7];
81} usba_udc_data;
82
83static struct platform_device at91_usba_udc_device = {
84 .name = "atmel_usba_udc",
85 .id = -1,
86 .dev = {
87 .platform_data = &usba_udc_data.pdata,
88 },
89 .resource = usba_udc_resources,
90 .num_resources = ARRAY_SIZE(usba_udc_resources),
91};
92
93void __init at91_add_device_usba(struct usba_platform_data *data)
94{
95 /*
96 * Invalid pins are 0 on AT91, but the usba driver is shared
97 * with AVR32, which use negative values instead. Once/if
98 * gpio_is_valid() is ported to AT91, revisit this code.
99 */
100 usba_udc_data.pdata.vbus_pin = -EINVAL;
101 usba_udc_data.pdata.num_ep = ARRAY_SIZE(usba_udc_ep);
102 memcpy(usba_udc_data.ep, usba_udc_ep, sizeof(usba_udc_ep));;
103
104 if (data && data->vbus_pin > 0) {
105 at91_set_gpio_input(data->vbus_pin, 0);
106 at91_set_deglitch(data->vbus_pin, 1);
107 usba_udc_data.pdata.vbus_pin = data->vbus_pin;
108 }
109
110 /* Pullup pin is handled internally by USB device peripheral */
111
112 /* Clocks */
113 at91_clock_associate("utmi_clk", &at91_usba_udc_device.dev, "hclk");
114 at91_clock_associate("udphs_clk", &at91_usba_udc_device.dev, "pclk");
115
116 platform_device_register(&at91_usba_udc_device);
117}
118#else
119void __init at91_add_device_usba(struct usba_platform_data *data) {}
120#endif
121
122
123/* --------------------------------------------------------------------
29 * MMC / SD 124 * MMC / SD
30 * -------------------------------------------------------------------- */ 125 * -------------------------------------------------------------------- */
31 126
@@ -138,15 +233,15 @@ void __init at91_add_device_nand(struct at91_nand_data *data)
138 at91_sys_write(AT91_MATRIX_EBICSA, csa | AT91_MATRIX_CS3A_SMC_SMARTMEDIA); 233 at91_sys_write(AT91_MATRIX_EBICSA, csa | AT91_MATRIX_CS3A_SMC_SMARTMEDIA);
139 234
140 /* set the bus interface characteristics */ 235 /* set the bus interface characteristics */
141 at91_sys_write(AT91_SMC_SETUP(3), AT91_SMC_NWESETUP_(0) | AT91_SMC_NCS_WRSETUP_(0) 236 at91_sys_write(AT91_SMC_SETUP(3), AT91_SMC_NWESETUP_(1) | AT91_SMC_NCS_WRSETUP_(0)
142 | AT91_SMC_NRDSETUP_(0) | AT91_SMC_NCS_RDSETUP_(0)); 237 | AT91_SMC_NRDSETUP_(1) | AT91_SMC_NCS_RDSETUP_(0));
143 238
144 at91_sys_write(AT91_SMC_PULSE(3), AT91_SMC_NWEPULSE_(2) | AT91_SMC_NCS_WRPULSE_(5) 239 at91_sys_write(AT91_SMC_PULSE(3), AT91_SMC_NWEPULSE_(3) | AT91_SMC_NCS_WRPULSE_(3)
145 | AT91_SMC_NRDPULSE_(2) | AT91_SMC_NCS_RDPULSE_(5)); 240 | AT91_SMC_NRDPULSE_(3) | AT91_SMC_NCS_RDPULSE_(3));
146 241
147 at91_sys_write(AT91_SMC_CYCLE(3), AT91_SMC_NWECYCLE_(7) | AT91_SMC_NRDCYCLE_(7)); 242 at91_sys_write(AT91_SMC_CYCLE(3), AT91_SMC_NWECYCLE_(5) | AT91_SMC_NRDCYCLE_(5));
148 243
149 at91_sys_write(AT91_SMC_MODE(3), AT91_SMC_DBW_8 | AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE | AT91_SMC_TDF_(1)); 244 at91_sys_write(AT91_SMC_MODE(3), AT91_SMC_DBW_8 | AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE | AT91_SMC_TDF_(2));
150 245
151 /* enable pin */ 246 /* enable pin */
152 if (data->enable_pin) 247 if (data->enable_pin)
diff --git a/arch/arm/mach-at91/board-cap9adk.c b/arch/arm/mach-at91/board-cap9adk.c
index e5512d1ff217..8a2a958639db 100644
--- a/arch/arm/mach-at91/board-cap9adk.c
+++ b/arch/arm/mach-at91/board-cap9adk.c
@@ -78,6 +78,12 @@ static struct at91_usbh_data __initdata cap9adk_usbh_data = {
78 .ports = 2, 78 .ports = 2,
79}; 79};
80 80
81/*
82 * USB HS Device port
83 */
84static struct usba_platform_data __initdata cap9adk_usba_udc_data = {
85 .vbus_pin = AT91_PIN_PB31,
86};
81 87
82/* 88/*
83 * ADS7846 Touchscreen 89 * ADS7846 Touchscreen
@@ -326,6 +332,9 @@ static void __init cap9adk_board_init(void)
326 /* USB Host */ 332 /* USB Host */
327 set_irq_type(AT91CAP9_ID_UHP, IRQT_HIGH); 333 set_irq_type(AT91CAP9_ID_UHP, IRQT_HIGH);
328 at91_add_device_usbh(&cap9adk_usbh_data); 334 at91_add_device_usbh(&cap9adk_usbh_data);
335 /* USB HS */
336 set_irq_type(AT91CAP9_ID_UDPHS, IRQT_HIGH);
337 at91_add_device_usba(&cap9adk_usba_udc_data);
329 /* SPI */ 338 /* SPI */
330 at91_add_device_spi(cap9adk_spi_devices, ARRAY_SIZE(cap9adk_spi_devices)); 339 at91_add_device_spi(cap9adk_spi_devices, ARRAY_SIZE(cap9adk_spi_devices));
331 /* Touchscreen */ 340 /* Touchscreen */
diff --git a/arch/arm/mach-at91/board-carmeva.c b/arch/arm/mach-at91/board-carmeva.c
index 0f0878294a67..9854fc3dd1f2 100644
--- a/arch/arm/mach-at91/board-carmeva.c
+++ b/arch/arm/mach-at91/board-carmeva.c
@@ -40,24 +40,21 @@
40#include "generic.h" 40#include "generic.h"
41 41
42 42
43/*
44 * Serial port configuration.
45 * 0 .. 3 = USART0 .. USART3
46 * 4 = DBGU
47 */
48static struct at91_uart_config __initdata carmeva_uart_config = {
49 .console_tty = 0, /* ttyS0 */
50 .nr_tty = 2,
51 .tty_map = { 4, 1, -1, -1, -1 } /* ttyS0, ..., ttyS4 */
52};
53
54static void __init carmeva_map_io(void) 43static void __init carmeva_map_io(void)
55{ 44{
56 /* Initialize processor: 20.000 MHz crystal */ 45 /* Initialize processor: 20.000 MHz crystal */
57 at91rm9200_initialize(20000000, AT91RM9200_BGA); 46 at91rm9200_initialize(20000000, AT91RM9200_BGA);
58 47
59 /* Setup the serial ports and console */ 48 /* DBGU on ttyS0. (Rx & Tx only) */
60 at91_init_serial(&carmeva_uart_config); 49 at91_register_uart(0, 0, 0);
50
51 /* USART1 on ttyS1. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */
52 at91_register_uart(AT91RM9200_ID_US1, 1, ATMEL_UART_CTS | ATMEL_UART_RTS
53 | ATMEL_UART_DTR | ATMEL_UART_DSR | ATMEL_UART_DCD
54 | ATMEL_UART_RI);
55
56 /* set serial console to ttyS0 (ie, DBGU) */
57 at91_set_serial_console(0);
61} 58}
62 59
63static void __init carmeva_init_irq(void) 60static void __init carmeva_init_irq(void)
diff --git a/arch/arm/mach-at91/board-csb637.c b/arch/arm/mach-at91/board-csb637.c
index 419fd19b620b..bb1a5474ddab 100644
--- a/arch/arm/mach-at91/board-csb637.c
+++ b/arch/arm/mach-at91/board-csb637.c
@@ -45,10 +45,10 @@ static void __init csb637_map_io(void)
45 /* Initialize processor: 3.6864 MHz crystal */ 45 /* Initialize processor: 3.6864 MHz crystal */
46 at91rm9200_initialize(3686400, AT91RM9200_BGA); 46 at91rm9200_initialize(3686400, AT91RM9200_BGA);
47 47
48 /* DBGU on ttyS0 */ 48 /* DBGU on ttyS0. (Rx & Tx only) */
49 at91_register_uart(0, 0, 0); 49 at91_register_uart(0, 0, 0);
50 50
51 /* make console=ttyS0 the default */ 51 /* make console=ttyS0 (ie, DBGU) the default */
52 at91_set_serial_console(0); 52 at91_set_serial_console(0);
53} 53}
54 54
diff --git a/arch/arm/mach-at91/board-dk.c b/arch/arm/mach-at91/board-dk.c
index c1a813c7169b..dab958d25926 100644
--- a/arch/arm/mach-at91/board-dk.c
+++ b/arch/arm/mach-at91/board-dk.c
@@ -45,17 +45,6 @@
45#include "generic.h" 45#include "generic.h"
46 46
47 47
48/*
49 * Serial port configuration.
50 * 0 .. 3 = USART0 .. USART3
51 * 4 = DBGU
52 */
53static struct at91_uart_config __initdata dk_uart_config = {
54 .console_tty = 0, /* ttyS0 */
55 .nr_tty = 2,
56 .tty_map = { 4, 1, -1, -1, -1 } /* ttyS0, ..., ttyS4 */
57};
58
59static void __init dk_map_io(void) 48static void __init dk_map_io(void)
60{ 49{
61 /* Initialize processor: 18.432 MHz crystal */ 50 /* Initialize processor: 18.432 MHz crystal */
@@ -64,8 +53,16 @@ static void __init dk_map_io(void)
64 /* Setup the LEDs */ 53 /* Setup the LEDs */
65 at91_init_leds(AT91_PIN_PB2, AT91_PIN_PB2); 54 at91_init_leds(AT91_PIN_PB2, AT91_PIN_PB2);
66 55
67 /* Setup the serial ports and console */ 56 /* DBGU on ttyS0. (Rx & Tx only) */
68 at91_init_serial(&dk_uart_config); 57 at91_register_uart(0, 0, 0);
58
59 /* USART1 on ttyS1. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */
60 at91_register_uart(AT91RM9200_ID_US1, 1, ATMEL_UART_CTS | ATMEL_UART_RTS
61 | ATMEL_UART_DTR | ATMEL_UART_DSR | ATMEL_UART_DCD
62 | ATMEL_UART_RI);
63
64 /* set serial console to ttyS0 (ie, DBGU) */
65 at91_set_serial_console(0);
69} 66}
70 67
71static void __init dk_init_irq(void) 68static void __init dk_init_irq(void)
@@ -163,7 +160,7 @@ static struct at91_nand_data __initdata dk_nand_data = {
163#define DK_FLASH_SIZE 0x200000 160#define DK_FLASH_SIZE 0x200000
164 161
165static struct physmap_flash_data dk_flash_data = { 162static struct physmap_flash_data dk_flash_data = {
166 .width = 2, 163 .width = 2,
167}; 164};
168 165
169static struct resource dk_flash_resource = { 166static struct resource dk_flash_resource = {
diff --git a/arch/arm/mach-at91/board-eb9200.c b/arch/arm/mach-at91/board-eb9200.c
index af1a1d8ecc30..3fe054e0056b 100644
--- a/arch/arm/mach-at91/board-eb9200.c
+++ b/arch/arm/mach-at91/board-eb9200.c
@@ -40,24 +40,24 @@
40#include "generic.h" 40#include "generic.h"
41 41
42 42
43/*
44 * Serial port configuration.
45 * 0 .. 3 = USART0 .. USART3
46 * 4 = DBGU
47 */
48static struct at91_uart_config __initdata eb9200_uart_config = {
49 .console_tty = 0, /* ttyS0 */
50 .nr_tty = 2,
51 .tty_map = { 4, 1, -1, -1, -1 } /* ttyS0, ..., ttyS4 */
52};
53
54static void __init eb9200_map_io(void) 43static void __init eb9200_map_io(void)
55{ 44{
56 /* Initialize processor: 18.432 MHz crystal */ 45 /* Initialize processor: 18.432 MHz crystal */
57 at91rm9200_initialize(18432000, AT91RM9200_BGA); 46 at91rm9200_initialize(18432000, AT91RM9200_BGA);
58 47
59 /* Setup the serial ports and console */ 48 /* DBGU on ttyS0. (Rx & Tx only) */
60 at91_init_serial(&eb9200_uart_config); 49 at91_register_uart(0, 0, 0);
50
51 /* USART1 on ttyS1. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */
52 at91_register_uart(AT91RM9200_ID_US1, 1, ATMEL_UART_CTS | ATMEL_UART_RTS
53 | ATMEL_UART_DTR | ATMEL_UART_DSR | ATMEL_UART_DCD
54 | ATMEL_UART_RI);
55
56 /* USART2 on ttyS2. (Rx, Tx) - IRDA */
57 at91_register_uart(AT91RM9200_ID_US2, 2, 0);
58
59 /* set serial console to ttyS0 (ie, DBGU) */
60 at91_set_serial_console(0);
61} 61}
62 62
63static void __init eb9200_init_irq(void) 63static void __init eb9200_init_irq(void)
diff --git a/arch/arm/mach-at91/board-ek.c b/arch/arm/mach-at91/board-ek.c
index 0574e50a30dd..74aa4325eab3 100644
--- a/arch/arm/mach-at91/board-ek.c
+++ b/arch/arm/mach-at91/board-ek.c
@@ -45,17 +45,6 @@
45#include "generic.h" 45#include "generic.h"
46 46
47 47
48/*
49 * Serial port configuration.
50 * 0 .. 3 = USART0 .. USART3
51 * 4 = DBGU
52 */
53static struct at91_uart_config __initdata ek_uart_config = {
54 .console_tty = 0, /* ttyS0 */
55 .nr_tty = 2,
56 .tty_map = { 4, 1, -1, -1, -1 } /* ttyS0, ..., ttyS4 */
57};
58
59static void __init ek_map_io(void) 48static void __init ek_map_io(void)
60{ 49{
61 /* Initialize processor: 18.432 MHz crystal */ 50 /* Initialize processor: 18.432 MHz crystal */
@@ -64,8 +53,16 @@ static void __init ek_map_io(void)
64 /* Setup the LEDs */ 53 /* Setup the LEDs */
65 at91_init_leds(AT91_PIN_PB1, AT91_PIN_PB2); 54 at91_init_leds(AT91_PIN_PB1, AT91_PIN_PB2);
66 55
67 /* Setup the serial ports and console */ 56 /* DBGU on ttyS0. (Rx & Tx only) */
68 at91_init_serial(&ek_uart_config); 57 at91_register_uart(0, 0, 0);
58
59 /* USART1 on ttyS1. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */
60 at91_register_uart(AT91RM9200_ID_US1, 1, ATMEL_UART_CTS | ATMEL_UART_RTS
61 | ATMEL_UART_DTR | ATMEL_UART_DSR | ATMEL_UART_DCD
62 | ATMEL_UART_RI);
63
64 /* set serial console to ttyS0 (ie, DBGU) */
65 at91_set_serial_console(0);
69} 66}
70 67
71static void __init ek_init_irq(void) 68static void __init ek_init_irq(void)
@@ -122,7 +119,7 @@ static struct i2c_board_info __initdata ek_i2c_devices[] = {
122#define EK_FLASH_SIZE 0x200000 119#define EK_FLASH_SIZE 0x200000
123 120
124static struct physmap_flash_data ek_flash_data = { 121static struct physmap_flash_data ek_flash_data = {
125 .width = 2, 122 .width = 2,
126}; 123};
127 124
128static struct resource ek_flash_resource = { 125static struct resource ek_flash_resource = {
diff --git a/arch/arm/mach-at91/board-kb9202.c b/arch/arm/mach-at91/board-kb9202.c
index 4b39b9cda75b..cb065febd95e 100644
--- a/arch/arm/mach-at91/board-kb9202.c
+++ b/arch/arm/mach-at91/board-kb9202.c
@@ -37,19 +37,10 @@
37#include <asm/arch/board.h> 37#include <asm/arch/board.h>
38#include <asm/arch/gpio.h> 38#include <asm/arch/gpio.h>
39 39
40#include "generic.h" 40#include <asm/arch/at91rm9200_mc.h>
41 41
42#include "generic.h"
42 43
43/*
44 * Serial port configuration.
45 * 0 .. 3 = USART0 .. USART3
46 * 4 = DBGU
47 */
48static struct at91_uart_config __initdata kb9202_uart_config = {
49 .console_tty = 0, /* ttyS0 */
50 .nr_tty = 3,
51 .tty_map = { 4, 0, 1, -1, -1 } /* ttyS0, ..., ttyS4 */
52};
53 44
54static void __init kb9202_map_io(void) 45static void __init kb9202_map_io(void)
55{ 46{
@@ -59,8 +50,20 @@ static void __init kb9202_map_io(void)
59 /* Set up the LEDs */ 50 /* Set up the LEDs */
60 at91_init_leds(AT91_PIN_PC19, AT91_PIN_PC18); 51 at91_init_leds(AT91_PIN_PC19, AT91_PIN_PC18);
61 52
62 /* Setup the serial ports and console */ 53 /* DBGU on ttyS0. (Rx & Tx only) */
63 at91_init_serial(&kb9202_uart_config); 54 at91_register_uart(0, 0, 0);
55
56 /* USART0 on ttyS1 (Rx & Tx only) */
57 at91_register_uart(AT91RM9200_ID_US0, 1, 0);
58
59 /* USART1 on ttyS2 (Rx & Tx only) - IRDA (optional) */
60 at91_register_uart(AT91RM9200_ID_US1, 2, 0);
61
62 /* USART3 on ttyS3 (Rx, Tx, CTS, RTS) - RS485 (optional) */
63 at91_register_uart(AT91RM9200_ID_US3, 3, ATMEL_UART_CTS | ATMEL_UART_RTS);
64
65 /* set serial console to ttyS0 (ie, DBGU) */
66 at91_set_serial_console(0);
64} 67}
65 68
66static void __init kb9202_init_irq(void) 69static void __init kb9202_init_irq(void)
diff --git a/arch/arm/mach-at91/board-qil-a9260.c b/arch/arm/mach-at91/board-qil-a9260.c
new file mode 100644
index 000000000000..99b4ec3818d6
--- /dev/null
+++ b/arch/arm/mach-at91/board-qil-a9260.c
@@ -0,0 +1,255 @@
1/*
2 * linux/arch/arm/mach-at91/board-qil-a9260.c
3 *
4 * Copyright (C) 2005 SAN People
5 * Copyright (C) 2006 Atmel
6 * Copyright (C) 2007 Calao-systems
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */
22
23#include <linux/types.h>
24#include <linux/init.h>
25#include <linux/mm.h>
26#include <linux/module.h>
27#include <linux/platform_device.h>
28#include <linux/spi/spi.h>
29#include <linux/gpio_keys.h>
30#include <linux/input.h>
31#include <linux/clk.h>
32
33#include <asm/hardware.h>
34#include <asm/setup.h>
35#include <asm/mach-types.h>
36#include <asm/irq.h>
37
38#include <asm/mach/arch.h>
39#include <asm/mach/map.h>
40#include <asm/mach/irq.h>
41
42#include <asm/arch/board.h>
43#include <asm/arch/gpio.h>
44#include <asm/arch/at91_shdwc.h>
45
46#include "generic.h"
47
48
49static void __init ek_map_io(void)
50{
51 /* Initialize processor: 12.000 MHz crystal */
52 at91sam9260_initialize(12000000);
53
54 /* DGBU on ttyS0. (Rx & Tx only) */
55 at91_register_uart(0, 0, 0);
56
57 /* USART0 on ttyS1. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */
58 at91_register_uart(AT91SAM9260_ID_US0, 1, ATMEL_UART_CTS | ATMEL_UART_RTS
59 | ATMEL_UART_DTR | ATMEL_UART_DSR | ATMEL_UART_DCD
60 | ATMEL_UART_RI);
61
62 /* USART1 on ttyS2. (Rx, Tx, CTS, RTS) */
63 at91_register_uart(AT91SAM9260_ID_US1, 2, ATMEL_UART_CTS | ATMEL_UART_RTS);
64
65 /* USART2 on ttyS3. (Rx, Tx, CTS, RTS) */
66 at91_register_uart(AT91SAM9260_ID_US2, 3, ATMEL_UART_CTS | ATMEL_UART_RTS);
67
68 /* set serial console to ttyS1 (ie, USART0) */
69 at91_set_serial_console(1);
70
71}
72
73static void __init ek_init_irq(void)
74{
75 at91sam9260_init_interrupts(NULL);
76}
77
78
79/*
80 * USB Host port
81 */
82static struct at91_usbh_data __initdata ek_usbh_data = {
83 .ports = 2,
84};
85
86/*
87 * USB Device port
88 */
89static struct at91_udc_data __initdata ek_udc_data = {
90 .vbus_pin = AT91_PIN_PC5,
91 .pullup_pin = 0, /* pull-up driven by UDC */
92};
93
94/*
95 * SPI devices.
96 */
97static struct spi_board_info ek_spi_devices[] = {
98#if defined(CONFIG_RTC_DRV_M41T94)
99 { /* M41T94 RTC */
100 .modalias = "m41t94",
101 .chip_select = 0,
102 .max_speed_hz = 1 * 1000 * 1000,
103 .bus_num = 0,
104 }
105#endif
106};
107
108/*
109 * MACB Ethernet device
110 */
111static struct at91_eth_data __initdata ek_macb_data = {
112 .phy_irq_pin = AT91_PIN_PA31,
113 .is_rmii = 1,
114};
115
116/*
117 * NAND flash
118 */
119static struct mtd_partition __initdata ek_nand_partition[] = {
120 {
121 .name = "Uboot & Kernel",
122 .offset = 0x00000000,
123 .size = 16 * 1024 * 1024,
124 },
125 {
126 .name = "Root FS",
127 .offset = 0x01000000,
128 .size = 120 * 1024 * 1024,
129 },
130 {
131 .name = "FS",
132 .offset = 0x08800000,
133 .size = 120 * 1024 * 1024,
134 },
135};
136
137static struct mtd_partition * __init nand_partitions(int size, int *num_partitions)
138{
139 *num_partitions = ARRAY_SIZE(ek_nand_partition);
140 return ek_nand_partition;
141}
142
143static struct at91_nand_data __initdata ek_nand_data = {
144 .ale = 21,
145 .cle = 22,
146// .det_pin = ... not connected
147 .rdy_pin = AT91_PIN_PC13,
148 .enable_pin = AT91_PIN_PC14,
149 .partition_info = nand_partitions,
150#if defined(CONFIG_MTD_NAND_AT91_BUSWIDTH_16)
151 .bus_width_16 = 1,
152#else
153 .bus_width_16 = 0,
154#endif
155};
156
157/*
158 * MCI (SD/MMC)
159 */
160static struct at91_mmc_data __initdata ek_mmc_data = {
161 .slot_b = 0,
162 .wire4 = 1,
163// .det_pin = ... not connected
164// .wp_pin = ... not connected
165// .vcc_pin = ... not connected
166};
167
168/*
169 * GPIO Buttons
170 */
171#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
172static struct gpio_keys_button ek_buttons[] = {
173 { /* USER PUSH BUTTON */
174 .code = KEY_ENTER,
175 .gpio = AT91_PIN_PB10,
176 .active_low = 1,
177 .desc = "user_pb",
178 .wakeup = 1,
179 }
180};
181
182static struct gpio_keys_platform_data ek_button_data = {
183 .buttons = ek_buttons,
184 .nbuttons = ARRAY_SIZE(ek_buttons),
185};
186
187static struct platform_device ek_button_device = {
188 .name = "gpio-keys",
189 .id = -1,
190 .num_resources = 0,
191 .dev = {
192 .platform_data = &ek_button_data,
193 }
194};
195
196static void __init ek_add_device_buttons(void)
197{
198 at91_set_GPIO_periph(AT91_PIN_PB10, 1); /* user push button, pull up enabled */
199 at91_set_deglitch(AT91_PIN_PB10, 1);
200
201 platform_device_register(&ek_button_device);
202}
203#else
204static void __init ek_add_device_buttons(void) {}
205#endif
206
207/*
208 * LEDs
209 */
210static struct gpio_led ek_leds[] = {
211 { /* user_led (green) */
212 .name = "user_led",
213 .gpio = AT91_PIN_PB21,
214 .active_low = 0,
215 .default_trigger = "heartbeat",
216 }
217};
218
219static void __init ek_board_init(void)
220{
221 /* Serial */
222 at91_add_device_serial();
223 /* USB Host */
224 at91_add_device_usbh(&ek_usbh_data);
225 /* USB Device */
226 at91_add_device_udc(&ek_udc_data);
227 /* SPI */
228 at91_add_device_spi(ek_spi_devices, ARRAY_SIZE(ek_spi_devices));
229 /* NAND */
230 at91_add_device_nand(&ek_nand_data);
231 /* I2C */
232 at91_add_device_i2c(NULL, 0);
233 /* Ethernet */
234 at91_add_device_eth(&ek_macb_data);
235 /* MMC */
236 at91_add_device_mmc(0, &ek_mmc_data);
237 /* Push Buttons */
238 ek_add_device_buttons();
239 /* LEDs */
240 at91_gpio_leds(ek_leds, ARRAY_SIZE(ek_leds));
241 /* shutdown controller, wakeup button (5 msec low) */
242 at91_sys_write(AT91_SHDW_MR, AT91_SHDW_CPTWK0_(10) | AT91_SHDW_WKMODE0_LOW
243 | AT91_SHDW_RTTWKEN);
244}
245
246MACHINE_START(QIL_A9260, "CALAO QIL_A9260")
247 /* Maintainer: calao-systems */
248 .phys_io = AT91_BASE_SYS,
249 .io_pg_offst = (AT91_VA_BASE_SYS >> 18) & 0xfffc,
250 .boot_params = AT91_SDRAM_BASE + 0x100,
251 .timer = &at91sam926x_timer,
252 .map_io = ek_map_io,
253 .init_irq = ek_init_irq,
254 .init_machine = ek_board_init,
255MACHINE_END
diff --git a/arch/arm/mach-at91/board-sam9g20ek.c b/arch/arm/mach-at91/board-sam9g20ek.c
new file mode 100644
index 000000000000..45617c201240
--- /dev/null
+++ b/arch/arm/mach-at91/board-sam9g20ek.c
@@ -0,0 +1,218 @@
1/*
2 * Copyright (C) 2005 SAN People
3 * Copyright (C) 2008 Atmel
4 *
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
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19
20#include <linux/types.h>
21#include <linux/init.h>
22#include <linux/mm.h>
23#include <linux/module.h>
24#include <linux/platform_device.h>
25#include <linux/spi/spi.h>
26#include <linux/spi/at73c213.h>
27#include <linux/clk.h>
28
29#include <asm/hardware.h>
30#include <asm/setup.h>
31#include <asm/mach-types.h>
32#include <asm/irq.h>
33
34#include <asm/mach/arch.h>
35#include <asm/mach/map.h>
36#include <asm/mach/irq.h>
37
38#include <asm/arch/board.h>
39#include <asm/arch/gpio.h>
40
41#include "generic.h"
42
43
44static void __init ek_map_io(void)
45{
46 /* Initialize processor: 18.432 MHz crystal */
47 at91sam9260_initialize(18432000);
48
49 /* DGBU on ttyS0. (Rx & Tx only) */
50 at91_register_uart(0, 0, 0);
51
52 /* USART0 on ttyS1. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */
53 at91_register_uart(AT91SAM9260_ID_US0, 1, ATMEL_UART_CTS | ATMEL_UART_RTS
54 | ATMEL_UART_DTR | ATMEL_UART_DSR | ATMEL_UART_DCD
55 | ATMEL_UART_RI);
56
57 /* USART1 on ttyS2. (Rx, Tx, RTS, CTS) */
58 at91_register_uart(AT91SAM9260_ID_US1, 2, ATMEL_UART_CTS | ATMEL_UART_RTS);
59
60 /* set serial console to ttyS0 (ie, DBGU) */
61 at91_set_serial_console(0);
62}
63
64static void __init ek_init_irq(void)
65{
66 at91sam9260_init_interrupts(NULL);
67}
68
69
70/*
71 * USB Host port
72 */
73static struct at91_usbh_data __initdata ek_usbh_data = {
74 .ports = 2,
75};
76
77/*
78 * USB Device port
79 */
80static struct at91_udc_data __initdata ek_udc_data = {
81 .vbus_pin = AT91_PIN_PC5,
82 .pullup_pin = 0, /* pull-up driven by UDC */
83};
84
85
86/*
87 * SPI devices.
88 */
89static struct spi_board_info ek_spi_devices[] = {
90#if !defined(CONFIG_MMC_AT91)
91 { /* DataFlash chip */
92 .modalias = "mtd_dataflash",
93 .chip_select = 1,
94 .max_speed_hz = 15 * 1000 * 1000,
95 .bus_num = 0,
96 },
97#if defined(CONFIG_MTD_AT91_DATAFLASH_CARD)
98 { /* DataFlash card */
99 .modalias = "mtd_dataflash",
100 .chip_select = 0,
101 .max_speed_hz = 15 * 1000 * 1000,
102 .bus_num = 0,
103 },
104#endif
105#endif
106};
107
108
109/*
110 * MACB Ethernet device
111 */
112static struct at91_eth_data __initdata ek_macb_data = {
113 .phy_irq_pin = AT91_PIN_PA7,
114 .is_rmii = 1,
115};
116
117
118/*
119 * NAND flash
120 */
121static struct mtd_partition __initdata ek_nand_partition[] = {
122 {
123 .name = "Bootstrap",
124 .offset = 0,
125 .size = 4 * 1024 * 1024,
126 },
127 {
128 .name = "Partition 1",
129 .offset = 4 * 1024 * 1024,
130 .size = 60 * 1024 * 1024,
131 },
132 {
133 .name = "Partition 2",
134 .offset = 64 * 1024 * 1024,
135 .size = MTDPART_SIZ_FULL,
136 },
137};
138
139static struct mtd_partition * __init nand_partitions(int size, int *num_partitions)
140{
141 *num_partitions = ARRAY_SIZE(ek_nand_partition);
142 return ek_nand_partition;
143}
144
145/* det_pin is not connected */
146static struct at91_nand_data __initdata ek_nand_data = {
147 .ale = 21,
148 .cle = 22,
149 .rdy_pin = AT91_PIN_PC13,
150 .enable_pin = AT91_PIN_PC14,
151 .partition_info = nand_partitions,
152#if defined(CONFIG_MTD_NAND_AT91_BUSWIDTH_16)
153 .bus_width_16 = 1,
154#else
155 .bus_width_16 = 0,
156#endif
157};
158
159
160/*
161 * MCI (SD/MMC)
162 * det_pin, wp_pin and vcc_pin are not connected
163 */
164static struct at91_mmc_data __initdata ek_mmc_data = {
165 .slot_b = 1,
166 .wire4 = 1,
167};
168
169
170/*
171 * LEDs
172 */
173static struct gpio_led ek_leds[] = {
174 { /* "bottom" led, green, userled1 to be defined */
175 .name = "ds5",
176 .gpio = AT91_PIN_PA6,
177 .active_low = 1,
178 .default_trigger = "none",
179 },
180 { /* "power" led, yellow */
181 .name = "ds1",
182 .gpio = AT91_PIN_PA9,
183 .default_trigger = "heartbeat",
184 }
185};
186
187static void __init ek_board_init(void)
188{
189 /* Serial */
190 at91_add_device_serial();
191 /* USB Host */
192 at91_add_device_usbh(&ek_usbh_data);
193 /* USB Device */
194 at91_add_device_udc(&ek_udc_data);
195 /* SPI */
196 at91_add_device_spi(ek_spi_devices, ARRAY_SIZE(ek_spi_devices));
197 /* NAND */
198 at91_add_device_nand(&ek_nand_data);
199 /* Ethernet */
200 at91_add_device_eth(&ek_macb_data);
201 /* MMC */
202 at91_add_device_mmc(0, &ek_mmc_data);
203 /* I2C */
204 at91_add_device_i2c(NULL, 0);
205 /* LEDs */
206 at91_gpio_leds(ek_leds, ARRAY_SIZE(ek_leds));
207}
208
209MACHINE_START(AT91SAM9G20EK, "Atmel AT91SAM9G20-EK")
210 /* Maintainer: Atmel */
211 .phys_io = AT91_BASE_SYS,
212 .io_pg_offst = (AT91_VA_BASE_SYS >> 18) & 0xfffc,
213 .boot_params = AT91_SDRAM_BASE + 0x100,
214 .timer = &at91sam926x_timer,
215 .map_io = ek_map_io,
216 .init_irq = ek_init_irq,
217 .init_machine = ek_board_init,
218MACHINE_END
diff --git a/arch/arm/mach-at91/board-sam9rlek.c b/arch/arm/mach-at91/board-sam9rlek.c
index ffc0597aee8d..b6a70fc735c3 100644
--- a/arch/arm/mach-at91/board-sam9rlek.c
+++ b/arch/arm/mach-at91/board-sam9rlek.c
@@ -56,6 +56,14 @@ static void __init ek_init_irq(void)
56 56
57 57
58/* 58/*
59 * USB HS Device port
60 */
61static struct usba_platform_data __initdata ek_usba_udc_data = {
62 .vbus_pin = AT91_PIN_PA8,
63};
64
65
66/*
59 * MCI (SD/MMC) 67 * MCI (SD/MMC)
60 */ 68 */
61static struct at91_mmc_data __initdata ek_mmc_data = { 69static struct at91_mmc_data __initdata ek_mmc_data = {
@@ -175,6 +183,8 @@ static void __init ek_board_init(void)
175{ 183{
176 /* Serial */ 184 /* Serial */
177 at91_add_device_serial(); 185 at91_add_device_serial();
186 /* USB HS */
187 at91_add_device_usba(&ek_usba_udc_data);
178 /* I2C */ 188 /* I2C */
179 at91_add_device_i2c(NULL, 0); 189 at91_add_device_i2c(NULL, 0);
180 /* NAND */ 190 /* NAND */
diff --git a/arch/arm/mach-at91/board-usb-a9260.c b/arch/arm/mach-at91/board-usb-a9260.c
new file mode 100644
index 000000000000..837aedf8ffeb
--- /dev/null
+++ b/arch/arm/mach-at91/board-usb-a9260.c
@@ -0,0 +1,215 @@
1/*
2 * linux/arch/arm/mach-at91/board-usb-a9260.c
3 *
4 * Copyright (C) 2005 SAN People
5 * Copyright (C) 2006 Atmel
6 * Copyright (C) 2007 Calao-systems
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */
22
23#include <linux/types.h>
24#include <linux/init.h>
25#include <linux/mm.h>
26#include <linux/module.h>
27#include <linux/platform_device.h>
28#include <linux/spi/spi.h>
29#include <linux/gpio_keys.h>
30#include <linux/input.h>
31#include <linux/clk.h>
32
33#include <asm/hardware.h>
34#include <asm/setup.h>
35#include <asm/mach-types.h>
36#include <asm/irq.h>
37
38#include <asm/mach/arch.h>
39#include <asm/mach/map.h>
40#include <asm/mach/irq.h>
41
42#include <asm/arch/board.h>
43#include <asm/arch/gpio.h>
44#include <asm/arch/at91_shdwc.h>
45
46#include "generic.h"
47
48
49static void __init ek_map_io(void)
50{
51 /* Initialize processor: 12.000 MHz crystal */
52 at91sam9260_initialize(12000000);
53
54 /* DGBU on ttyS0. (Rx & Tx only) */
55 at91_register_uart(0, 0, 0);
56
57 /* set serial console to ttyS0 (ie, DBGU) */
58 at91_set_serial_console(0);
59}
60
61static void __init ek_init_irq(void)
62{
63 at91sam9260_init_interrupts(NULL);
64}
65
66
67/*
68 * USB Host port
69 */
70static struct at91_usbh_data __initdata ek_usbh_data = {
71 .ports = 2,
72};
73
74/*
75 * USB Device port
76 */
77static struct at91_udc_data __initdata ek_udc_data = {
78 .vbus_pin = AT91_PIN_PC5,
79 .pullup_pin = 0, /* pull-up driven by UDC */
80};
81
82/*
83 * MACB Ethernet device
84 */
85static struct at91_eth_data __initdata ek_macb_data = {
86 .phy_irq_pin = AT91_PIN_PA31,
87 .is_rmii = 1,
88};
89
90/*
91 * NAND flash
92 */
93static struct mtd_partition __initdata ek_nand_partition[] = {
94 {
95 .name = "Uboot & Kernel",
96 .offset = 0x00000000,
97 .size = 16 * 1024 * 1024,
98 },
99 {
100 .name = "Root FS",
101 .offset = 0x01000000,
102 .size = 120 * 1024 * 1024,
103 },
104 {
105 .name = "FS",
106 .offset = 0x08800000,
107 .size = 120 * 1024 * 1024,
108 }
109};
110
111static struct mtd_partition * __init nand_partitions(int size, int *num_partitions)
112{
113 *num_partitions = ARRAY_SIZE(ek_nand_partition);
114 return ek_nand_partition;
115}
116
117static struct at91_nand_data __initdata ek_nand_data = {
118 .ale = 21,
119 .cle = 22,
120// .det_pin = ... not connected
121 .rdy_pin = AT91_PIN_PC13,
122 .enable_pin = AT91_PIN_PC14,
123 .partition_info = nand_partitions,
124#if defined(CONFIG_MTD_NAND_AT91_BUSWIDTH_16)
125 .bus_width_16 = 1,
126#else
127 .bus_width_16 = 0,
128#endif
129};
130
131/*
132 * GPIO Buttons
133 */
134
135#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
136static struct gpio_keys_button ek_buttons[] = {
137 { /* USER PUSH BUTTON */
138 .code = KEY_ENTER,
139 .gpio = AT91_PIN_PB10,
140 .active_low = 1,
141 .desc = "user_pb",
142 .wakeup = 1,
143 }
144};
145
146static struct gpio_keys_platform_data ek_button_data = {
147 .buttons = ek_buttons,
148 .nbuttons = ARRAY_SIZE(ek_buttons),
149};
150
151static struct platform_device ek_button_device = {
152 .name = "gpio-keys",
153 .id = -1,
154 .num_resources = 0,
155 .dev = {
156 .platform_data = &ek_button_data,
157 }
158};
159
160static void __init ek_add_device_buttons(void)
161{
162 at91_set_GPIO_periph(AT91_PIN_PB10, 1); /* user push button, pull up enabled */
163 at91_set_deglitch(AT91_PIN_PB10, 1);
164
165 platform_device_register(&ek_button_device);
166}
167#else
168static void __init ek_add_device_buttons(void) {}
169#endif
170
171/*
172 * LEDs
173 */
174static struct gpio_led ek_leds[] = {
175 { /* user_led (green) */
176 .name = "user_led",
177 .gpio = AT91_PIN_PB21,
178 .active_low = 0,
179 .default_trigger = "heartbeat",
180 }
181};
182
183static void __init ek_board_init(void)
184{
185 /* Serial */
186 at91_add_device_serial();
187 /* USB Host */
188 at91_add_device_usbh(&ek_usbh_data);
189 /* USB Device */
190 at91_add_device_udc(&ek_udc_data);
191 /* NAND */
192 at91_add_device_nand(&ek_nand_data);
193 /* I2C */
194 at91_add_device_i2c(NULL, 0);
195 /* Ethernet */
196 at91_add_device_eth(&ek_macb_data);
197 /* Push Buttons */
198 ek_add_device_buttons();
199 /* LEDs */
200 at91_gpio_leds(ek_leds, ARRAY_SIZE(ek_leds));
201 /* shutdown controller, wakeup button (5 msec low) */
202 at91_sys_write(AT91_SHDW_MR, AT91_SHDW_CPTWK0_(10) | AT91_SHDW_WKMODE0_LOW
203 | AT91_SHDW_RTTWKEN);
204}
205
206MACHINE_START(USB_A9260, "CALAO USB_A9260")
207 /* Maintainer: calao-systems */
208 .phys_io = AT91_BASE_SYS,
209 .io_pg_offst = (AT91_VA_BASE_SYS >> 18) & 0xfffc,
210 .boot_params = AT91_SDRAM_BASE + 0x100,
211 .timer = &at91sam926x_timer,
212 .map_io = ek_map_io,
213 .init_irq = ek_init_irq,
214 .init_machine = ek_board_init,
215MACHINE_END
diff --git a/arch/arm/mach-at91/board-usb-a9263.c b/arch/arm/mach-at91/board-usb-a9263.c
new file mode 100644
index 000000000000..95800d32bd49
--- /dev/null
+++ b/arch/arm/mach-at91/board-usb-a9263.c
@@ -0,0 +1,230 @@
1/*
2 * linux/arch/arm/mach-at91/board-usb-a9263.c
3 *
4 * Copyright (C) 2005 SAN People
5 * Copyright (C) 2007 Atmel Corporation.
6 * Copyright (C) 2007 Calao-systems
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */
22
23#include <linux/types.h>
24#include <linux/init.h>
25#include <linux/mm.h>
26#include <linux/module.h>
27#include <linux/platform_device.h>
28#include <linux/spi/spi.h>
29#include <linux/gpio_keys.h>
30#include <linux/input.h>
31
32#include <asm/hardware.h>
33#include <asm/setup.h>
34#include <asm/mach-types.h>
35#include <asm/irq.h>
36
37#include <asm/mach/arch.h>
38#include <asm/mach/map.h>
39#include <asm/mach/irq.h>
40
41#include <asm/arch/board.h>
42#include <asm/arch/gpio.h>
43#include <asm/arch/at91_shdwc.h>
44
45#include "generic.h"
46
47
48static void __init ek_map_io(void)
49{
50 /* Initialize processor: 12.00 MHz crystal */
51 at91sam9263_initialize(12000000);
52
53 /* DGBU on ttyS0. (Rx & Tx only) */
54 at91_register_uart(0, 0, 0);
55
56 /* set serial console to ttyS0 (ie, DBGU) */
57 at91_set_serial_console(0);
58}
59
60static void __init ek_init_irq(void)
61{
62 at91sam9263_init_interrupts(NULL);
63}
64
65
66/*
67 * USB Host port
68 */
69static struct at91_usbh_data __initdata ek_usbh_data = {
70 .ports = 2,
71};
72
73/*
74 * USB Device port
75 */
76static struct at91_udc_data __initdata ek_udc_data = {
77 .vbus_pin = AT91_PIN_PB11,
78 .pullup_pin = 0, /* pull-up driven by UDC */
79};
80
81/*
82 * SPI devices.
83 */
84static struct spi_board_info ek_spi_devices[] = {
85#if !defined(CONFIG_MMC_AT91)
86 { /* DataFlash chip */
87 .modalias = "mtd_dataflash",
88 .chip_select = 0,
89 .max_speed_hz = 15 * 1000 * 1000,
90 .bus_num = 0,
91 }
92#endif
93};
94
95/*
96 * MACB Ethernet device
97 */
98static struct at91_eth_data __initdata ek_macb_data = {
99 .phy_irq_pin = AT91_PIN_PE31,
100 .is_rmii = 1,
101};
102
103/*
104 * NAND flash
105 */
106static struct mtd_partition __initdata ek_nand_partition[] = {
107 {
108 .name = "Linux Kernel",
109 .offset = 0x00000000,
110 .size = 16 * 1024 * 1024,
111 },
112 {
113 .name = "Root FS",
114 .offset = 0x01000000,
115 .size = 120 * 1024 * 1024,
116 },
117 {
118 .name = "FS",
119 .offset = 0x08800000,
120 .size = 120 * 1024 * 1024,
121 }
122};
123
124static struct mtd_partition * __init nand_partitions(int size, int *num_partitions)
125{
126 *num_partitions = ARRAY_SIZE(ek_nand_partition);
127 return ek_nand_partition;
128}
129
130static struct at91_nand_data __initdata ek_nand_data = {
131 .ale = 21,
132 .cle = 22,
133// .det_pin = ... not connected
134 .rdy_pin = AT91_PIN_PA22,
135 .enable_pin = AT91_PIN_PD15,
136 .partition_info = nand_partitions,
137#if defined(CONFIG_MTD_NAND_AT91_BUSWIDTH_16)
138 .bus_width_16 = 1,
139#else
140 .bus_width_16 = 0,
141#endif
142};
143
144/*
145 * GPIO Buttons
146 */
147#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
148static struct gpio_keys_button ek_buttons[] = {
149 { /* USER PUSH BUTTON */
150 .code = KEY_ENTER,
151 .gpio = AT91_PIN_PB10,
152 .active_low = 1,
153 .desc = "user_pb",
154 .wakeup = 1,
155 }
156};
157
158static struct gpio_keys_platform_data ek_button_data = {
159 .buttons = ek_buttons,
160 .nbuttons = ARRAY_SIZE(ek_buttons),
161};
162
163static struct platform_device ek_button_device = {
164 .name = "gpio-keys",
165 .id = -1,
166 .num_resources = 0,
167 .dev = {
168 .platform_data = &ek_button_data,
169 }
170};
171
172static void __init ek_add_device_buttons(void)
173{
174 at91_set_GPIO_periph(AT91_PIN_PB10, 1); /* user push button, pull up enabled */
175 at91_set_deglitch(AT91_PIN_PB10, 1);
176
177 platform_device_register(&ek_button_device);
178}
179#else
180static void __init ek_add_device_buttons(void) {}
181#endif
182
183/*
184 * LEDs
185 */
186static struct gpio_led ek_leds[] = {
187 { /* user_led (green) */
188 .name = "user_led",
189 .gpio = AT91_PIN_PB21,
190 .active_low = 1,
191 .default_trigger = "heartbeat",
192 }
193};
194
195
196static void __init ek_board_init(void)
197{
198 /* Serial */
199 at91_add_device_serial();
200 /* USB Host */
201 at91_add_device_usbh(&ek_usbh_data);
202 /* USB Device */
203 at91_add_device_udc(&ek_udc_data);
204 /* SPI */
205 at91_add_device_spi(ek_spi_devices, ARRAY_SIZE(ek_spi_devices));
206 /* Ethernet */
207 at91_add_device_eth(&ek_macb_data);
208 /* NAND */
209 at91_add_device_nand(&ek_nand_data);
210 /* I2C */
211 at91_add_device_i2c(NULL, 0);
212 /* Push Buttons */
213 ek_add_device_buttons();
214 /* LEDs */
215 at91_gpio_leds(ek_leds, ARRAY_SIZE(ek_leds));
216 /* shutdown controller, wakeup button (5 msec low) */
217 at91_sys_write(AT91_SHDW_MR, AT91_SHDW_CPTWK0_(10) | AT91_SHDW_WKMODE0_LOW
218 | AT91_SHDW_RTTWKEN);
219}
220
221MACHINE_START(USB_A9263, "CALAO USB_A9263")
222 /* Maintainer: calao-systems */
223 .phys_io = AT91_BASE_SYS,
224 .io_pg_offst = (AT91_VA_BASE_SYS >> 18) & 0xfffc,
225 .boot_params = AT91_SDRAM_BASE + 0x100,
226 .timer = &at91sam926x_timer,
227 .map_io = ek_map_io,
228 .init_irq = ek_init_irq,
229 .init_machine = ek_board_init,
230MACHINE_END
diff --git a/arch/arm/mach-at91/board-yl-9200.c b/arch/arm/mach-at91/board-yl-9200.c
index b5717108991d..7079050ab88d 100755
--- a/arch/arm/mach-at91/board-yl-9200.c
+++ b/arch/arm/mach-at91/board-yl-9200.c
@@ -1,11 +1,10 @@
1/* 1/*
2 * linux/arch/arm/mach-at91/board-yl-9200.c 2 * linux/arch/arm/mach-at91/board-yl-9200.c
3 * 3 *
4 * Adapted from: 4 * Adapted from various board files in arch/arm/mach-at91
5 *various board files in 5 *
6 * /arch/arm/mach-at91 6 * Modifications for YL-9200 platform:
7 * modifications to convert to YL-9200 platform 7 * Copyright (C) 2007 S. Birtles
8 * Copyright (C) 2007 S.Birtles
9 * 8 *
10 * This program is free software; you can redistribute it and/or modify 9 * 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 10 * it under the terms of the GNU General Public License as published by
@@ -26,13 +25,14 @@
26#include <linux/init.h> 25#include <linux/init.h>
27#include <linux/mm.h> 26#include <linux/mm.h>
28#include <linux/module.h> 27#include <linux/module.h>
28#include <linux/dma-mapping.h>
29#include <linux/platform_device.h> 29#include <linux/platform_device.h>
30#include <linux/spi/spi.h> 30#include <linux/spi/spi.h>
31/*#include <linux/can_bus/candata.h>*/
32#include <linux/spi/ads7846.h> 31#include <linux/spi/ads7846.h>
33#include <linux/mtd/physmap.h> 32#include <linux/mtd/physmap.h>
33#include <linux/gpio_keys.h>
34#include <linux/input.h>
34 35
35/*#include <sound/gpio_sounder.h>*/
36#include <asm/hardware.h> 36#include <asm/hardware.h>
37#include <asm/setup.h> 37#include <asm/setup.h>
38#include <asm/mach-types.h> 38#include <asm/mach-types.h>
@@ -45,179 +45,108 @@
45#include <asm/arch/board.h> 45#include <asm/arch/board.h>
46#include <asm/arch/gpio.h> 46#include <asm/arch/gpio.h>
47#include <asm/arch/at91rm9200_mc.h> 47#include <asm/arch/at91rm9200_mc.h>
48#include <linux/gpio_keys.h>
49#include <linux/input.h>
50 48
51#include "generic.h" 49#include "generic.h"
52#include <asm/arch/at91_pio.h>
53 50
54#define YL_9200_FLASH_BASE AT91_CHIPSELECT_0
55#define YL_9200_FLASH_SIZE 0x800000
56 51
57/* 52static void __init yl9200_map_io(void)
58 * Serial port configuration. 53{
59 * 0 .. 3 = USART0 .. USART3 54 /* Initialize processor: 18.432 MHz crystal */
60 * 4 = DBGU 55 at91rm9200_initialize(18432000, AT91RM9200_PQFP);
61 *atmel_usart.0: ttyS0 at MMIO 0xfefff200 (irq = 1) is a ATMEL_SERIAL
62 *atmel_usart.1: ttyS1 at MMIO 0xfffc0000 (irq = 6) is a ATMEL_SERIAL
63 *atmel_usart.2: ttyS2 at MMIO 0xfffc4000 (irq = 7) is a ATMEL_SERIAL
64 *atmel_usart.3: ttyS3 at MMIO 0xfffc8000 (irq = 8) is a ATMEL_SERIAL
65 *atmel_usart.4: ttyS4 at MMIO 0xfffcc000 (irq = 9) is a ATMEL_SERIAL
66 * on the YL-9200 we are sitting at the following
67 *ttyS0 at MMIO 0xfefff200 (irq = 1) is a AT91_SERIAL
68 *ttyS1 at MMIO 0xfefc4000 (irq = 7) is a AT91_SERIAL
69 */
70 56
71/* extern void __init yl_9200_add_device_sounder(struct gpio_sounder *sounders, int nr);*/ 57 /* Setup the LEDs D2=PB17 (timer), D3=PB16 (cpu) */
58 at91_init_leds(AT91_PIN_PB16, AT91_PIN_PB17);
72 59
73static struct at91_uart_config __initdata yl_9200_uart_config = { 60 /* DBGU on ttyS0. (Rx & Tx only) */
74 .console_tty = 0, /* ttyS0 */ 61 at91_register_uart(0, 0, 0);
75 .nr_tty = 3,
76 .tty_map = { 4, 1, 0, -1, -1 } /* ttyS0, ..., ttyS4 */
77};
78 62
79static void __init yl_9200_map_io(void) 63 /* USART1 on ttyS1. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */
80{ 64 at91_register_uart(AT91RM9200_ID_US1, 1, ATMEL_UART_CTS | ATMEL_UART_RTS
81 /* Initialize processor: 18.432 MHz crystal */ 65 | ATMEL_UART_DTR | ATMEL_UART_DSR | ATMEL_UART_DCD
82 /*Also initialises register clocks & gpio*/ 66 | ATMEL_UART_RI);
83 at91rm9200_initialize(18432000, AT91RM9200_PQFP); /*we have a 3 bank system*/
84 67
85 /* Setup the serial ports and console */ 68 /* USART0 on ttyS2. (Rx & Tx only to JP3) */
86 at91_init_serial(&yl_9200_uart_config); 69 at91_register_uart(AT91RM9200_ID_US0, 2, 0);
87 70
88 /* Setup the LEDs D2=PB17,D3=PB16 */ 71 /* USART3 on ttyS3. (Rx, Tx, RTS - RS485 interface) */
89 at91_init_leds(AT91_PIN_PB16,AT91_PIN_PB17); /*cpu-led,timer-led*/ 72 at91_register_uart(AT91RM9200_ID_US3, 3, ATMEL_UART_RTS);
73
74 /* set serial console to ttyS0 (ie, DBGU) */
75 at91_set_serial_console(0);
90} 76}
91 77
92static void __init yl_9200_init_irq(void) 78static void __init yl9200_init_irq(void)
93{ 79{
94 at91rm9200_init_interrupts(NULL); 80 at91rm9200_init_interrupts(NULL);
95} 81}
96 82
97static struct at91_eth_data __initdata yl_9200_eth_data = {
98 .phy_irq_pin = AT91_PIN_PB28,
99 .is_rmii = 1,
100};
101 83
102static struct at91_usbh_data __initdata yl_9200_usbh_data = { 84/*
103 .ports = 1, /* this should be 1 not 2 for the Yl9200*/ 85 * LEDs
86 */
87static struct gpio_led yl9200_leds[] = {
88 { /* D2 */
89 .name = "led2",
90 .gpio = AT91_PIN_PB17,
91 .active_low = 1,
92 .default_trigger = "timer",
93 },
94 { /* D3 */
95 .name = "led3",
96 .gpio = AT91_PIN_PB16,
97 .active_low = 1,
98 .default_trigger = "heartbeat",
99 },
100 { /* D4 */
101 .name = "led4",
102 .gpio = AT91_PIN_PB15,
103 .active_low = 1,
104 },
105 { /* D5 */
106 .name = "led5",
107 .gpio = AT91_PIN_PB8,
108 .active_low = 1,
109 }
104}; 110};
105 111
106static struct at91_udc_data __initdata yl_9200_udc_data = {
107/*on sheet 7 Schemitic rev 1.0*/
108 .pullup_pin = AT91_PIN_PC4,
109 .vbus_pin= AT91_PIN_PC5,
110 .pullup_active_low = 1, /*ACTIVE LOW!! due to PNP transistor on page 7*/
111
112};
113/* 112/*
114static struct at91_cf_data __initdata yl_9200_cf_data = { 113 * Ethernet
115TODO S.BIRTLES 114 */
116 .det_pin = AT91_PIN_xxx, 115static struct at91_eth_data __initdata yl9200_eth_data = {
117 .rst_pin = AT91_PIN_xxx, 116 .phy_irq_pin = AT91_PIN_PB28,
118 .irq_pin = ... not connected 117 .is_rmii = 1,
119 .vcc_pin = ... always powered
120
121}; 118};
122*/
123static struct at91_mmc_data __initdata yl_9200_mmc_data = {
124 .det_pin = AT91_PIN_PB9, /*THIS LOOKS CORRECT SHEET7*/
125/* .wp_pin = ... not connected SHEET7*/
126 .slot_b = 0,
127 .wire4 = 1,
128 119
120/*
121 * USB Host
122 */
123static struct at91_usbh_data __initdata yl9200_usbh_data = {
124 .ports = 1, /* PQFP version of AT91RM9200 */
129}; 125};
130 126
131/* -------------------------------------------------------------------- 127/*
132 * Touch screen 128 * USB Device
133 * -------------------------------------------------------------------- */ 129 */
134#if defined(CONFIG_TOUCHSCREEN_ADS7846) || defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE) 130static struct at91_udc_data __initdata yl9200_udc_data = {
135static int ads7843_pendown_state(void) 131 .pullup_pin = AT91_PIN_PC4,
136{ 132 .vbus_pin = AT91_PIN_PC5,
137 return !at91_get_gpio_value(AT91_PIN_PB11); /* Touchscreen PENIRQ */ 133 .pullup_active_low = 1, /* Active Low due to PNP transistor (pg 7) */
138}
139
140static void __init at91_init_device_ts(void)
141{
142/*IMPORTANT NOTE THE SPI INTERFACE IS ALREADY CONFIGURED BY XXX_DEVICES.C
143THAT IS TO SAY THAT MISO,MOSI,SPCK AND CS are already configured
144we only need to enable the other datapins which are:
145PB10/RK1 BUSY
146*/
147/* Touchscreen BUSY signal , pin,use pullup ( TODO not currently used in the ADS7843/6.c driver)*/
148at91_set_gpio_input(AT91_PIN_PB10, 1);
149}
150
151#else
152static void __init at91_init_device_ts(void) {}
153#endif
154
155static struct ads7846_platform_data ads_info = {
156 .model = 7843,
157 .x_min = 150,
158 .x_max = 3830,
159 .y_min = 190,
160 .y_max = 3830,
161 .vref_delay_usecs = 100,
162/* for a 8" touch screen*/
163 //.x_plate_ohms = 603, //= 450, S.Birtles TODO
164 //.y_plate_ohms = 332, //= 250, S.Birtles TODO
165/*for a 10.4" touch screen*/
166 //.x_plate_ohms =611,
167 //.y_plate_ohms =325,
168
169 .x_plate_ohms = 576,
170 .y_plate_ohms = 366,
171 //
172 .pressure_max = 15000, /*generally nonsense on the 7843*/
173 /*number of times to send query to chip in a given run 0 equals one time (do not set to 0!! ,there is a bug in ADS 7846 code)*/
174 .debounce_max = 1,
175 .debounce_rep = 0,
176 .debounce_tol = (~0),
177 .get_pendown_state = ads7843_pendown_state,
178};
179 134
180/*static struct canbus_platform_data can_info = {
181 .model = 2510,
182}; 135};
183*/
184
185static struct spi_board_info yl_9200_spi_devices[] = {
186/*this sticks it at:
187 /sys/devices/platform/atmel_spi.0/spi0.0
188 /sys/bus/platform/devices/
189Documentation/spi IIRC*/
190 136
191#if defined(CONFIG_TOUCHSCREEN_ADS7846) || defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE) 137/*
192 /*(this IS correct 04-NOV-2007)*/ 138 * MMC
193 { 139 */
194 .modalias = "ads7846", /* because the driver is called ads7846*/ 140static struct at91_mmc_data __initdata yl9200_mmc_data = {
195 .chip_select = 0, /*THIS MUST BE AN INDEX INTO AN ARRAY OF pins */ 141 .det_pin = AT91_PIN_PB9,
196/*this is ONLY TO BE USED if chipselect above is not used, it passes a pin directly for the chip select*/ 142 // .wp_pin = ... not connected
197 /*.controller_data =AT91_PIN_PA3 ,*/ 143 .wire4 = 1,
198 .max_speed_hz = 5000*26, /*(4700 * 26)-125000 * 26, (max sample rate @ 3V) * (cmd + data + overhead) */
199 .bus_num = 0,
200 .platform_data = &ads_info,
201 .irq = AT91_PIN_PB11,
202 },
203#endif
204/*we need to put our CAN driver data here!!*/
205/*THIS IS ALL DUMMY DATA*/
206/* {
207 .modalias = "mcp2510", //DUMMY for MCP2510 chip
208 .chip_select = 1,*/ /*THIS MUST BE AN INDEX INTO AN ARRAY OF pins */
209 /*this is ONLY TO BE USED if chipselect above is not used, it passes a pin directly for the chip select */
210 /* .controller_data =AT91_PIN_PA4 ,
211 .max_speed_hz = 25000 * 26,
212 .bus_num = 0,
213 .platform_data = &can_info,
214 .irq = AT91_PIN_PC0,
215 },
216 */
217 //max SPI chip needs to go here
218}; 144};
219 145
220static struct mtd_partition __initdata yl_9200_nand_partition[] = { 146/*
147 * NAND Flash
148 */
149static struct mtd_partition __initdata yl9200_nand_partition[] = {
221 { 150 {
222 .name = "AT91 NAND partition 1, boot", 151 .name = "AT91 NAND partition 1, boot",
223 .offset = 0, 152 .offset = 0,
@@ -242,442 +171,434 @@ static struct mtd_partition __initdata yl_9200_nand_partition[] = {
242 .name = "AT91 NAND partition 5, ext-fs", 171 .name = "AT91 NAND partition 5, ext-fs",
243 .offset = 32 * SZ_1M, 172 .offset = 32 * SZ_1M,
244 .size = 32 * SZ_1M 173 .size = 32 * SZ_1M
245 }, 174 }
246}; 175};
247 176
248static struct mtd_partition * __init nand_partitions(int size, int *num_partitions) 177static struct mtd_partition * __init nand_partitions(int size, int *num_partitions)
249{ 178{
250 *num_partitions = ARRAY_SIZE(yl_9200_nand_partition); 179 *num_partitions = ARRAY_SIZE(yl9200_nand_partition);
251 return yl_9200_nand_partition; 180 return yl9200_nand_partition;
252} 181}
253 182
254static struct at91_nand_data __initdata yl_9200_nand_data = { 183static struct at91_nand_data __initdata yl9200_nand_data = {
255 .ale= 6, 184 .ale = 6,
256 .cle= 7, 185 .cle = 7,
257 /*.det_pin = AT91_PIN_PCxx,*/ /*we don't have a det pin because NandFlash is fixed to board*/ 186 // .det_pin = ... not connected
258 .rdy_pin = AT91_PIN_PC14, /*R/!B Sheet10*/ 187 .rdy_pin = AT91_PIN_PC14, /* R/!B (Sheet10) */
259 .enable_pin = AT91_PIN_PC15, /*!CE Sheet10 */ 188 .enable_pin = AT91_PIN_PC15, /* !CE (Sheet10) */
260 .partition_info = nand_partitions, 189 .partition_info = nand_partitions,
261}; 190};
262 191
263
264
265/* 192/*
266TODO S.Birtles 193 * NOR Flash
267potentially a problem with the size above 194 */
268physmap platform flash device: 00800000 at 10000000 195#define YL9200_FLASH_BASE AT91_CHIPSELECT_0
269physmap-flash.0: Found 1 x16 devices at 0x0 in 16-bit bank 196#define YL9200_FLASH_SIZE 0x1000000
270NOR chip too large to fit in mapping. Attempting to cope...
271 Intel/Sharp Extended Query Table at 0x0031
272Using buffer write method
273cfi_cmdset_0001: Erase suspend on write enabled
274Reducing visibility of 16384KiB chip to 8192KiB
275*/
276 197
277static struct mtd_partition yl_9200_flash_partitions[] = { 198static struct mtd_partition yl9200_flash_partitions[] = {
199 {
200 .name = "Bootloader",
201 .size = 0x00040000,
202 .offset = 0,
203 .mask_flags = MTD_WRITEABLE, /* force read-only */
204 },
278 { 205 {
279 .name = "Bootloader", 206 .name = "Kernel",
280 .size = 0x00040000, 207 .size = 0x001C0000,
281 .offset = 0, 208 .offset = 0x00040000,
282 .mask_flags = MTD_WRITEABLE /* force read-only */ 209 },
283 },{ 210 {
284 .name = "Kernel", 211 .name = "Filesystem",
285 .size = 0x001C0000, 212 .size = MTDPART_SIZ_FULL,
286 .offset = 0x00040000, 213 .offset = 0x00200000
287 },{
288 .name = "Filesystem",
289 .size = MTDPART_SIZ_FULL,
290 .offset = 0x00200000
291 } 214 }
292
293}; 215};
294 216
295static struct physmap_flash_data yl_9200_flash_data = { 217static struct physmap_flash_data yl9200_flash_data = {
296 .width = 2, 218 .width = 2,
297 .parts = yl_9200_flash_partitions, 219 .parts = yl9200_flash_partitions,
298 .nr_parts = ARRAY_SIZE(yl_9200_flash_partitions), 220 .nr_parts = ARRAY_SIZE(yl9200_flash_partitions),
299}; 221};
300 222
301static struct resource yl_9200_flash_resources[] = { 223static struct resource yl9200_flash_resources[] = {
302{ 224 {
303 .start = YL_9200_FLASH_BASE, 225 .start = YL9200_FLASH_BASE,
304 .end = YL_9200_FLASH_BASE + YL_9200_FLASH_SIZE - 1, 226 .end = YL9200_FLASH_BASE + YL9200_FLASH_SIZE - 1,
305 .flags = IORESOURCE_MEM, 227 .flags = IORESOURCE_MEM,
306 } 228 }
307}; 229};
308 230
309static struct platform_device yl_9200_flash = { 231static struct platform_device yl9200_flash = {
310 .name = "physmap-flash", 232 .name = "physmap-flash",
311 .id = 0, 233 .id = 0,
312 .dev = { 234 .dev = {
313 .platform_data = &yl_9200_flash_data, 235 .platform_data = &yl9200_flash_data,
314 }, 236 },
315 .resource = yl_9200_flash_resources, 237 .resource = yl9200_flash_resources,
316 .num_resources = ARRAY_SIZE(yl_9200_flash_resources), 238 .num_resources = ARRAY_SIZE(yl9200_flash_resources),
317}; 239};
318 240
319 241/*
320static struct gpio_led yl_9200_leds[] = { 242 * I2C (TWI)
321/*D2 &D3 are passed directly in via at91_init_leds*/ 243 */
322 { 244static struct i2c_board_info __initdata yl9200_i2c_devices[] = {
323 .name = "led4", /*D4*/ 245 { /* EEPROM */
324 .gpio = AT91_PIN_PB15, 246 I2C_BOARD_INFO("24c128", 0x50),
325 .active_low = 1,
326 .default_trigger = "heartbeat",
327 /*.default_trigger = "timer",*/
328 },
329 {
330 .name = "led5", /*D5*/
331 .gpio = AT91_PIN_PB8,
332 .active_low = 1,
333 .default_trigger = "heartbeat",
334 }
335};
336
337//static struct gpio_sounder yl_9200_sounder[] = {*/
338/*This is a simple speaker attached to a gpo line*/
339
340// {
341// .name = "Speaker", /*LS1*/
342// .gpio = AT91_PIN_PA22,
343// .active_low = 0,
344// .default_trigger = "heartbeat",
345 /*.default_trigger = "timer",*/
346// },
347//};
348
349
350
351static struct i2c_board_info __initdata yl_9200_i2c_devices[] = {
352 {
353 /*TODO*/
354 I2C_BOARD_INFO("CS4334", 0x00),
355 } 247 }
356}; 248};
357 249
358 250/*
359 /*
360 * GPIO Buttons 251 * GPIO Buttons
361 */ 252*/
362#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE) 253#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
363static struct gpio_keys_button yl_9200_buttons[] = { 254static struct gpio_keys_button yl9200_buttons[] = {
364 { 255 {
365 .gpio = AT91_PIN_PA24, 256 .gpio = AT91_PIN_PA24,
366 .code = BTN_2, 257 .code = BTN_2,
367 .desc = "SW2", 258 .desc = "SW2",
368 .active_low = 1, 259 .active_low = 1,
369 .wakeup = 1, 260 .wakeup = 1,
370 }, 261 },
371 { 262 {
372 .gpio = AT91_PIN_PB1, 263 .gpio = AT91_PIN_PB1,
373 .code = BTN_3, 264 .code = BTN_3,
374 .desc = "SW3", 265 .desc = "SW3",
375 .active_low = 1, 266 .active_low = 1,
376 .wakeup = 1, 267 .wakeup = 1,
377 }, 268 },
378 { 269 {
379 .gpio = AT91_PIN_PB2, 270 .gpio = AT91_PIN_PB2,
380 .code = BTN_4, 271 .code = BTN_4,
381 .desc = "SW4", 272 .desc = "SW4",
382 .active_low = 1, 273 .active_low = 1,
383 .wakeup = 1, 274 .wakeup = 1,
384 }, 275 },
385 { 276 {
386 .gpio = AT91_PIN_PB6, 277 .gpio = AT91_PIN_PB6,
387 .code = BTN_5, 278 .code = BTN_5,
388 .desc = "SW5", 279 .desc = "SW5",
389 .active_low = 1, 280 .active_low = 1,
390 .wakeup = 1, 281 .wakeup = 1,
391 }, 282 }
392
393}; 283};
394 284
395static struct gpio_keys_platform_data yl_9200_button_data = { 285static struct gpio_keys_platform_data yl9200_button_data = {
396 .buttons = yl_9200_buttons, 286 .buttons = yl9200_buttons,
397 .nbuttons = ARRAY_SIZE(yl_9200_buttons), 287 .nbuttons = ARRAY_SIZE(yl9200_buttons),
398}; 288};
399 289
400static struct platform_device yl_9200_button_device = { 290static struct platform_device yl9200_button_device = {
401 .name = "gpio-keys", 291 .name = "gpio-keys",
402 .id = -1, 292 .id = -1,
403 .num_resources = 0, 293 .num_resources = 0,
404 .dev = { 294 .dev = {
405 .platform_data = &yl_9200_button_data, 295 .platform_data = &yl9200_button_data,
406 } 296 }
407}; 297};
408 298
409static void __init yl_9200_add_device_buttons(void) 299static void __init yl9200_add_device_buttons(void)
410{ 300{
411 //SW2 301 at91_set_gpio_input(AT91_PIN_PA24, 1); /* SW2 */
412 at91_set_gpio_input(AT91_PIN_PA24, 0);
413 at91_set_deglitch(AT91_PIN_PA24, 1); 302 at91_set_deglitch(AT91_PIN_PA24, 1);
414 303 at91_set_gpio_input(AT91_PIN_PB1, 1); /* SW3 */
415 //SW3
416 at91_set_gpio_input(AT91_PIN_PB1, 0);
417 at91_set_deglitch(AT91_PIN_PB1, 1); 304 at91_set_deglitch(AT91_PIN_PB1, 1);
418 //SW4 305 at91_set_gpio_input(AT91_PIN_PB2, 1); /* SW4 */
419 at91_set_gpio_input(AT91_PIN_PB2, 0);
420 at91_set_deglitch(AT91_PIN_PB2, 1); 306 at91_set_deglitch(AT91_PIN_PB2, 1);
421 307 at91_set_gpio_input(AT91_PIN_PB6, 1); /* SW5 */
422 //SW5
423 at91_set_gpio_input(AT91_PIN_PB6, 0);
424 at91_set_deglitch(AT91_PIN_PB6, 1); 308 at91_set_deglitch(AT91_PIN_PB6, 1);
425 309
310 /* Enable buttons (Sheet 5) */
311 at91_set_gpio_output(AT91_PIN_PB7, 1);
312
313 platform_device_register(&yl9200_button_device);
314}
315#else
316static void __init yl9200_add_device_buttons(void) {}
317#endif
318
319/*
320 * Touchscreen
321 */
322#if defined(CONFIG_TOUCHSCREEN_ADS7846) || defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE)
323static int ads7843_pendown_state(void)
324{
325 return !at91_get_gpio_value(AT91_PIN_PB11); /* Touchscreen PENIRQ */
326}
327
328static struct ads7846_platform_data ads_info = {
329 .model = 7843,
330 .x_min = 150,
331 .x_max = 3830,
332 .y_min = 190,
333 .y_max = 3830,
334 .vref_delay_usecs = 100,
335
336 /* For a 8" touch-screen */
337 // .x_plate_ohms = 603,
338 // .y_plate_ohms = 332,
339
340 /* For a 10.4" touch-screen */
341 // .x_plate_ohms = 611,
342 // .y_plate_ohms = 325,
343
344 .x_plate_ohms = 576,
345 .y_plate_ohms = 366,
346
347 .pressure_max = 15000, /* generally nonsense on the 7843 */
348 .debounce_max = 1,
349 .debounce_rep = 0,
350 .debounce_tol = (~0),
351 .get_pendown_state = ads7843_pendown_state,
352};
426 353
427 at91_set_gpio_output(AT91_PIN_PB7, 1); /* #TURN BUTTONS ON, SHEET 5 of schematics */ 354static void __init yl9200_add_device_ts(void)
428 platform_device_register(&yl_9200_button_device); 355{
356 at91_set_gpio_input(AT91_PIN_PB11, 1); /* Touchscreen interrupt pin */
357 at91_set_gpio_input(AT91_PIN_PB10, 1); /* Touchscreen BUSY signal - not used! */
429} 358}
430#else 359#else
431static void __init yl_9200_add_device_buttons(void) {} 360static void __init yl9200_add_device_ts(void) {}
361#endif
362
363/*
364 * SPI devices
365 */
366static struct spi_board_info yl9200_spi_devices[] = {
367#if defined(CONFIG_TOUCHSCREEN_ADS7846) || defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE)
368 { /* Touchscreen */
369 .modalias = "ads7846",
370 .chip_select = 0,
371 .max_speed_hz = 5000 * 26,
372 .platform_data = &ads_info,
373 .irq = AT91_PIN_PB11,
374 },
432#endif 375#endif
376 { /* CAN */
377 .modalias = "mcp2510",
378 .chip_select = 1,
379 .max_speed_hz = 25000 * 26,
380 .irq = AT91_PIN_PC0,
381 }
382};
433 383
384/*
385 * LCD / VGA
386 *
387 * EPSON S1D13806 FB (discontinued chip)
388 * EPSON S1D13506 FB
389 */
434#if defined(CONFIG_FB_S1D135XX) || defined(CONFIG_FB_S1D13XXX_MODULE) 390#if defined(CONFIG_FB_S1D135XX) || defined(CONFIG_FB_S1D13XXX_MODULE)
435#include <video/s1d13xxxfb.h> 391#include <video/s1d13xxxfb.h>
436 392
437/* EPSON S1D13806 FB (discontinued chip)*/
438/* EPSON S1D13506 FB */
439
440#define AT91_FB_REG_BASE 0x80000000L 393#define AT91_FB_REG_BASE 0x80000000L
441#define AT91_FB_REG_SIZE 0x200 394#define AT91_FB_REG_SIZE 0x200
442#define AT91_FB_VMEM_BASE 0x80200000L 395#define AT91_FB_VMEM_BASE 0x80200000L
443#define AT91_FB_VMEM_SIZE 0x200000L 396#define AT91_FB_VMEM_SIZE 0x200000L
444 397
445/*#define S1D_DISPLAY_WIDTH 640*/ 398static void __init yl9200_init_video(void)
446/*#define S1D_DISPLAY_HEIGHT 480*/
447
448
449static void __init yl_9200_init_video(void)
450{ 399{
451 at91_sys_write(AT91_PIOC + PIO_ASR,AT91_PIN_PC6); 400 /* NWAIT Signal */
452 at91_sys_write(AT91_PIOC + PIO_BSR,0); 401 at91_set_A_periph(AT91_PIN_PC6, 0);
453 at91_sys_write(AT91_PIOC + PIO_ASR,AT91_PIN_PC6);
454
455 at91_sys_write( AT91_SMC_CSR(2),
456 AT91_SMC_NWS_(0x4) |
457 AT91_SMC_WSEN |
458 AT91_SMC_TDF_(0x100) |
459 AT91_SMC_DBW
460 );
461
462
463 402
403 /* Initialization of the Static Memory Controller for Chip Select 2 */
404 at91_sys_write(AT91_SMC_CSR(2), AT91_SMC_DBW_16 /* 16 bit */
405 | AT91_SMC_WSEN | AT91_SMC_NWS_(0x4) /* wait states */
406 | AT91_SMC_TDF_(0x100) /* float time */
407 );
464} 408}
465 409
466 410static struct s1d13xxxfb_regval yl9200_s1dfb_initregs[] =
467static struct s1d13xxxfb_regval yl_9200_s1dfb_initregs[] =
468{ 411{
469 {S1DREG_MISC, 0x00}, /* Miscellaneous Register*/ 412 {S1DREG_MISC, 0x00}, /* Miscellaneous Register*/
470 {S1DREG_COM_DISP_MODE, 0x01}, /* Display Mode Register, LCD only*/ 413 {S1DREG_COM_DISP_MODE, 0x01}, /* Display Mode Register, LCD only*/
471 {S1DREG_GPIO_CNF0, 0x00}, /* General IO Pins Configuration Register*/ 414 {S1DREG_GPIO_CNF0, 0x00}, /* General IO Pins Configuration Register*/
472 {S1DREG_GPIO_CTL0, 0x00}, /* General IO Pins Control Register*/ 415 {S1DREG_GPIO_CTL0, 0x00}, /* General IO Pins Control Register*/
473 {S1DREG_CLK_CNF, 0x11}, /* Memory Clock Configuration Register*/ 416 {S1DREG_CLK_CNF, 0x11}, /* Memory Clock Configuration Register*/
474 {S1DREG_LCD_CLK_CNF, 0x10}, /* LCD Pixel Clock Configuration Register*/ 417 {S1DREG_LCD_CLK_CNF, 0x10}, /* LCD Pixel Clock Configuration Register*/
475 {S1DREG_CRT_CLK_CNF, 0x12}, /* CRT/TV Pixel Clock Configuration Register*/ 418 {S1DREG_CRT_CLK_CNF, 0x12}, /* CRT/TV Pixel Clock Configuration Register*/
476 {S1DREG_MPLUG_CLK_CNF, 0x01}, /* MediaPlug Clock Configuration Register*/ 419 {S1DREG_MPLUG_CLK_CNF, 0x01}, /* MediaPlug Clock Configuration Register*/
477 {S1DREG_CPU2MEM_WST_SEL, 0x02}, /* CPU To Memory Wait State Select Register*/ 420 {S1DREG_CPU2MEM_WST_SEL, 0x02}, /* CPU To Memory Wait State Select Register*/
478 {S1DREG_MEM_CNF, 0x00}, /* Memory Configuration Register*/ 421 {S1DREG_MEM_CNF, 0x00}, /* Memory Configuration Register*/
479 {S1DREG_SDRAM_REF_RATE, 0x04}, /* DRAM Refresh Rate Register, MCLK source*/ 422 {S1DREG_SDRAM_REF_RATE, 0x04}, /* DRAM Refresh Rate Register, MCLK source*/
480 {S1DREG_SDRAM_TC0, 0x12}, /* DRAM Timings Control Register 0*/ 423 {S1DREG_SDRAM_TC0, 0x12}, /* DRAM Timings Control Register 0*/
481 {S1DREG_SDRAM_TC1, 0x02}, /* DRAM Timings Control Register 1*/ 424 {S1DREG_SDRAM_TC1, 0x02}, /* DRAM Timings Control Register 1*/
482 {S1DREG_PANEL_TYPE, 0x25}, /* Panel Type Register*/ 425 {S1DREG_PANEL_TYPE, 0x25}, /* Panel Type Register*/
483 {S1DREG_MOD_RATE, 0x00}, /* MOD Rate Register*/ 426 {S1DREG_MOD_RATE, 0x00}, /* MOD Rate Register*/
484 {S1DREG_LCD_DISP_HWIDTH, 0x4F}, /* LCD Horizontal Display Width Register*/ 427 {S1DREG_LCD_DISP_HWIDTH, 0x4F}, /* LCD Horizontal Display Width Register*/
485 {S1DREG_LCD_NDISP_HPER, 0x13}, /* LCD Horizontal Non-Display Period Register*/ 428 {S1DREG_LCD_NDISP_HPER, 0x13}, /* LCD Horizontal Non-Display Period Register*/
486 {S1DREG_TFT_FPLINE_START, 0x01}, /* TFT FPLINE Start Position Register*/ 429 {S1DREG_TFT_FPLINE_START, 0x01}, /* TFT FPLINE Start Position Register*/
487 {S1DREG_TFT_FPLINE_PWIDTH, 0x0c}, /* TFT FPLINE Pulse Width Register*/ 430 {S1DREG_TFT_FPLINE_PWIDTH, 0x0c}, /* TFT FPLINE Pulse Width Register*/
488 {S1DREG_LCD_DISP_VHEIGHT0, 0xDF}, /* LCD Vertical Display Height Register 0*/ 431 {S1DREG_LCD_DISP_VHEIGHT0, 0xDF}, /* LCD Vertical Display Height Register 0*/
489 {S1DREG_LCD_DISP_VHEIGHT1, 0x01}, /* LCD Vertical Display Height Register 1*/ 432 {S1DREG_LCD_DISP_VHEIGHT1, 0x01}, /* LCD Vertical Display Height Register 1*/
490 {S1DREG_LCD_NDISP_VPER, 0x2c}, /* LCD Vertical Non-Display Period Register*/ 433 {S1DREG_LCD_NDISP_VPER, 0x2c}, /* LCD Vertical Non-Display Period Register*/
491 {S1DREG_TFT_FPFRAME_START, 0x0a}, /* TFT FPFRAME Start Position Register*/ 434 {S1DREG_TFT_FPFRAME_START, 0x0a}, /* TFT FPFRAME Start Position Register*/
492 {S1DREG_TFT_FPFRAME_PWIDTH, 0x02}, /* TFT FPFRAME Pulse Width Register*/ 435 {S1DREG_TFT_FPFRAME_PWIDTH, 0x02}, /* TFT FPFRAME Pulse Width Register*/
493 {S1DREG_LCD_DISP_MODE, 0x05}, /* LCD Display Mode Register*/ 436 {S1DREG_LCD_DISP_MODE, 0x05}, /* LCD Display Mode Register*/
494 {S1DREG_LCD_MISC, 0x01}, /* LCD Miscellaneous Register*/ 437 {S1DREG_LCD_MISC, 0x01}, /* LCD Miscellaneous Register*/
495 {S1DREG_LCD_DISP_START0, 0x00}, /* LCD Display Start Address Register 0*/ 438 {S1DREG_LCD_DISP_START0, 0x00}, /* LCD Display Start Address Register 0*/
496 {S1DREG_LCD_DISP_START1, 0x00}, /* LCD Display Start Address Register 1*/ 439 {S1DREG_LCD_DISP_START1, 0x00}, /* LCD Display Start Address Register 1*/
497 {S1DREG_LCD_DISP_START2, 0x00}, /* LCD Display Start Address Register 2*/ 440 {S1DREG_LCD_DISP_START2, 0x00}, /* LCD Display Start Address Register 2*/
498 {S1DREG_LCD_MEM_OFF0, 0x80}, /* LCD Memory Address Offset Register 0*/ 441 {S1DREG_LCD_MEM_OFF0, 0x80}, /* LCD Memory Address Offset Register 0*/
499 {S1DREG_LCD_MEM_OFF1, 0x02}, /* LCD Memory Address Offset Register 1*/ 442 {S1DREG_LCD_MEM_OFF1, 0x02}, /* LCD Memory Address Offset Register 1*/
500 {S1DREG_LCD_PIX_PAN, 0x03}, /* LCD Pixel Panning Register*/ 443 {S1DREG_LCD_PIX_PAN, 0x03}, /* LCD Pixel Panning Register*/
501 {S1DREG_LCD_DISP_FIFO_HTC, 0x00}, /* LCD Display FIFO High Threshold Control Register*/ 444 {S1DREG_LCD_DISP_FIFO_HTC, 0x00}, /* LCD Display FIFO High Threshold Control Register*/
502 {S1DREG_LCD_DISP_FIFO_LTC, 0x00}, /* LCD Display FIFO Low Threshold Control Register*/ 445 {S1DREG_LCD_DISP_FIFO_LTC, 0x00}, /* LCD Display FIFO Low Threshold Control Register*/
503 {S1DREG_CRT_DISP_HWIDTH, 0x4F}, /* CRT/TV Horizontal Display Width Register*/ 446 {S1DREG_CRT_DISP_HWIDTH, 0x4F}, /* CRT/TV Horizontal Display Width Register*/
504 {S1DREG_CRT_NDISP_HPER, 0x13}, /* CRT/TV Horizontal Non-Display Period Register*/ 447 {S1DREG_CRT_NDISP_HPER, 0x13}, /* CRT/TV Horizontal Non-Display Period Register*/
505 {S1DREG_CRT_HRTC_START, 0x01}, /* CRT/TV HRTC Start Position Register*/ 448 {S1DREG_CRT_HRTC_START, 0x01}, /* CRT/TV HRTC Start Position Register*/
506 {S1DREG_CRT_HRTC_PWIDTH, 0x0B}, /* CRT/TV HRTC Pulse Width Register*/ 449 {S1DREG_CRT_HRTC_PWIDTH, 0x0B}, /* CRT/TV HRTC Pulse Width Register*/
507 {S1DREG_CRT_DISP_VHEIGHT0, 0xDF}, /* CRT/TV Vertical Display Height Register 0*/ 450 {S1DREG_CRT_DISP_VHEIGHT0, 0xDF}, /* CRT/TV Vertical Display Height Register 0*/
508 {S1DREG_CRT_DISP_VHEIGHT1, 0x01}, /* CRT/TV Vertical Display Height Register 1*/ 451 {S1DREG_CRT_DISP_VHEIGHT1, 0x01}, /* CRT/TV Vertical Display Height Register 1*/
509 {S1DREG_CRT_NDISP_VPER, 0x2B}, /* CRT/TV Vertical Non-Display Period Register*/ 452 {S1DREG_CRT_NDISP_VPER, 0x2B}, /* CRT/TV Vertical Non-Display Period Register*/
510 {S1DREG_CRT_VRTC_START, 0x09}, /* CRT/TV VRTC Start Position Register*/ 453 {S1DREG_CRT_VRTC_START, 0x09}, /* CRT/TV VRTC Start Position Register*/
511 {S1DREG_CRT_VRTC_PWIDTH, 0x01}, /* CRT/TV VRTC Pulse Width Register*/ 454 {S1DREG_CRT_VRTC_PWIDTH, 0x01}, /* CRT/TV VRTC Pulse Width Register*/
512 {S1DREG_TV_OUT_CTL, 0x18}, /* TV Output Control Register */ 455 {S1DREG_TV_OUT_CTL, 0x18}, /* TV Output Control Register */
513 {S1DREG_CRT_DISP_MODE, 0x05}, /* CRT/TV Display Mode Register, 16BPP*/ 456 {S1DREG_CRT_DISP_MODE, 0x05}, /* CRT/TV Display Mode Register, 16BPP*/
514 {S1DREG_CRT_DISP_START0, 0x00}, /* CRT/TV Display Start Address Register 0*/ 457 {S1DREG_CRT_DISP_START0, 0x00}, /* CRT/TV Display Start Address Register 0*/
515 {S1DREG_CRT_DISP_START1, 0x00}, /* CRT/TV Display Start Address Register 1*/ 458 {S1DREG_CRT_DISP_START1, 0x00}, /* CRT/TV Display Start Address Register 1*/
516 {S1DREG_CRT_DISP_START2, 0x00}, /* CRT/TV Display Start Address Register 2*/ 459 {S1DREG_CRT_DISP_START2, 0x00}, /* CRT/TV Display Start Address Register 2*/
517 {S1DREG_CRT_MEM_OFF0, 0x80}, /* CRT/TV Memory Address Offset Register 0*/ 460 {S1DREG_CRT_MEM_OFF0, 0x80}, /* CRT/TV Memory Address Offset Register 0*/
518 {S1DREG_CRT_MEM_OFF1, 0x02}, /* CRT/TV Memory Address Offset Register 1*/ 461 {S1DREG_CRT_MEM_OFF1, 0x02}, /* CRT/TV Memory Address Offset Register 1*/
519 {S1DREG_CRT_PIX_PAN, 0x00}, /* CRT/TV Pixel Panning Register*/ 462 {S1DREG_CRT_PIX_PAN, 0x00}, /* CRT/TV Pixel Panning Register*/
520 {S1DREG_CRT_DISP_FIFO_HTC, 0x00}, /* CRT/TV Display FIFO High Threshold Control Register*/ 463 {S1DREG_CRT_DISP_FIFO_HTC, 0x00}, /* CRT/TV Display FIFO High Threshold Control Register*/
521 {S1DREG_CRT_DISP_FIFO_LTC, 0x00}, /* CRT/TV Display FIFO Low Threshold Control Register*/ 464 {S1DREG_CRT_DISP_FIFO_LTC, 0x00}, /* CRT/TV Display FIFO Low Threshold Control Register*/
522 {S1DREG_LCD_CUR_CTL, 0x00}, /* LCD Ink/Cursor Control Register*/ 465 {S1DREG_LCD_CUR_CTL, 0x00}, /* LCD Ink/Cursor Control Register*/
523 {S1DREG_LCD_CUR_START, 0x01}, /* LCD Ink/Cursor Start Address Register*/ 466 {S1DREG_LCD_CUR_START, 0x01}, /* LCD Ink/Cursor Start Address Register*/
524 {S1DREG_LCD_CUR_XPOS0, 0x00}, /* LCD Cursor X Position Register 0*/ 467 {S1DREG_LCD_CUR_XPOS0, 0x00}, /* LCD Cursor X Position Register 0*/
525 {S1DREG_LCD_CUR_XPOS1, 0x00}, /* LCD Cursor X Position Register 1*/ 468 {S1DREG_LCD_CUR_XPOS1, 0x00}, /* LCD Cursor X Position Register 1*/
526 {S1DREG_LCD_CUR_YPOS0, 0x00}, /* LCD Cursor Y Position Register 0*/ 469 {S1DREG_LCD_CUR_YPOS0, 0x00}, /* LCD Cursor Y Position Register 0*/
527 {S1DREG_LCD_CUR_YPOS1, 0x00}, /* LCD Cursor Y Position Register 1*/ 470 {S1DREG_LCD_CUR_YPOS1, 0x00}, /* LCD Cursor Y Position Register 1*/
528 {S1DREG_LCD_CUR_BCTL0, 0x00}, /* LCD Ink/Cursor Blue Color 0 Register*/ 471 {S1DREG_LCD_CUR_BCTL0, 0x00}, /* LCD Ink/Cursor Blue Color 0 Register*/
529 {S1DREG_LCD_CUR_GCTL0, 0x00}, /* LCD Ink/Cursor Green Color 0 Register*/ 472 {S1DREG_LCD_CUR_GCTL0, 0x00}, /* LCD Ink/Cursor Green Color 0 Register*/
530 {S1DREG_LCD_CUR_RCTL0, 0x00}, /* LCD Ink/Cursor Red Color 0 Register*/ 473 {S1DREG_LCD_CUR_RCTL0, 0x00}, /* LCD Ink/Cursor Red Color 0 Register*/
531 {S1DREG_LCD_CUR_BCTL1, 0x1F}, /* LCD Ink/Cursor Blue Color 1 Register*/ 474 {S1DREG_LCD_CUR_BCTL1, 0x1F}, /* LCD Ink/Cursor Blue Color 1 Register*/
532 {S1DREG_LCD_CUR_GCTL1, 0x3F}, /* LCD Ink/Cursor Green Color 1 Register*/ 475 {S1DREG_LCD_CUR_GCTL1, 0x3F}, /* LCD Ink/Cursor Green Color 1 Register*/
533 {S1DREG_LCD_CUR_RCTL1, 0x1F}, /* LCD Ink/Cursor Red Color 1 Register*/ 476 {S1DREG_LCD_CUR_RCTL1, 0x1F}, /* LCD Ink/Cursor Red Color 1 Register*/
534 {S1DREG_LCD_CUR_FIFO_HTC, 0x00}, /* LCD Ink/Cursor FIFO Threshold Register*/ 477 {S1DREG_LCD_CUR_FIFO_HTC, 0x00}, /* LCD Ink/Cursor FIFO Threshold Register*/
535 {S1DREG_CRT_CUR_CTL, 0x00}, /* CRT/TV Ink/Cursor Control Register*/ 478 {S1DREG_CRT_CUR_CTL, 0x00}, /* CRT/TV Ink/Cursor Control Register*/
536 {S1DREG_CRT_CUR_START, 0x01}, /* CRT/TV Ink/Cursor Start Address Register*/ 479 {S1DREG_CRT_CUR_START, 0x01}, /* CRT/TV Ink/Cursor Start Address Register*/
537 {S1DREG_CRT_CUR_XPOS0, 0x00}, /* CRT/TV Cursor X Position Register 0*/ 480 {S1DREG_CRT_CUR_XPOS0, 0x00}, /* CRT/TV Cursor X Position Register 0*/
538 {S1DREG_CRT_CUR_XPOS1, 0x00}, /* CRT/TV Cursor X Position Register 1*/ 481 {S1DREG_CRT_CUR_XPOS1, 0x00}, /* CRT/TV Cursor X Position Register 1*/
539 {S1DREG_CRT_CUR_YPOS0, 0x00}, /* CRT/TV Cursor Y Position Register 0*/ 482 {S1DREG_CRT_CUR_YPOS0, 0x00}, /* CRT/TV Cursor Y Position Register 0*/
540 {S1DREG_CRT_CUR_YPOS1, 0x00}, /* CRT/TV Cursor Y Position Register 1*/ 483 {S1DREG_CRT_CUR_YPOS1, 0x00}, /* CRT/TV Cursor Y Position Register 1*/
541 {S1DREG_CRT_CUR_BCTL0, 0x00}, /* CRT/TV Ink/Cursor Blue Color 0 Register*/ 484 {S1DREG_CRT_CUR_BCTL0, 0x00}, /* CRT/TV Ink/Cursor Blue Color 0 Register*/
542 {S1DREG_CRT_CUR_GCTL0, 0x00}, /* CRT/TV Ink/Cursor Green Color 0 Register*/ 485 {S1DREG_CRT_CUR_GCTL0, 0x00}, /* CRT/TV Ink/Cursor Green Color 0 Register*/
543 {S1DREG_CRT_CUR_RCTL0, 0x00}, /* CRT/TV Ink/Cursor Red Color 0 Register*/ 486 {S1DREG_CRT_CUR_RCTL0, 0x00}, /* CRT/TV Ink/Cursor Red Color 0 Register*/
544 {S1DREG_CRT_CUR_BCTL1, 0x1F}, /* CRT/TV Ink/Cursor Blue Color 1 Register*/ 487 {S1DREG_CRT_CUR_BCTL1, 0x1F}, /* CRT/TV Ink/Cursor Blue Color 1 Register*/
545 {S1DREG_CRT_CUR_GCTL1, 0x3F}, /* CRT/TV Ink/Cursor Green Color 1 Register*/ 488 {S1DREG_CRT_CUR_GCTL1, 0x3F}, /* CRT/TV Ink/Cursor Green Color 1 Register*/
546 {S1DREG_CRT_CUR_RCTL1, 0x1F}, /* CRT/TV Ink/Cursor Red Color 1 Register*/ 489 {S1DREG_CRT_CUR_RCTL1, 0x1F}, /* CRT/TV Ink/Cursor Red Color 1 Register*/
547 {S1DREG_CRT_CUR_FIFO_HTC, 0x00}, /* CRT/TV Ink/Cursor FIFO Threshold Register*/ 490 {S1DREG_CRT_CUR_FIFO_HTC, 0x00}, /* CRT/TV Ink/Cursor FIFO Threshold Register*/
548 {S1DREG_BBLT_CTL0, 0x00}, /* BitBlt Control Register 0*/ 491 {S1DREG_BBLT_CTL0, 0x00}, /* BitBlt Control Register 0*/
549 {S1DREG_BBLT_CTL1, 0x01}, /* BitBlt Control Register 1*/ 492 {S1DREG_BBLT_CTL1, 0x01}, /* BitBlt Control Register 1*/
550 {S1DREG_BBLT_CC_EXP, 0x00}, /* BitBlt ROP Code/Color Expansion Register*/ 493 {S1DREG_BBLT_CC_EXP, 0x00}, /* BitBlt ROP Code/Color Expansion Register*/
551 {S1DREG_BBLT_OP, 0x00}, /* BitBlt Operation Register*/ 494 {S1DREG_BBLT_OP, 0x00}, /* BitBlt Operation Register*/
552 {S1DREG_BBLT_SRC_START0, 0x00}, /* BitBlt Source Start Address Register 0*/ 495 {S1DREG_BBLT_SRC_START0, 0x00}, /* BitBlt Source Start Address Register 0*/
553 {S1DREG_BBLT_SRC_START1, 0x00}, /* BitBlt Source Start Address Register 1*/ 496 {S1DREG_BBLT_SRC_START1, 0x00}, /* BitBlt Source Start Address Register 1*/
554 {S1DREG_BBLT_SRC_START2, 0x00}, /* BitBlt Source Start Address Register 2*/ 497 {S1DREG_BBLT_SRC_START2, 0x00}, /* BitBlt Source Start Address Register 2*/
555 {S1DREG_BBLT_DST_START0, 0x00}, /* BitBlt Destination Start Address Register 0*/ 498 {S1DREG_BBLT_DST_START0, 0x00}, /* BitBlt Destination Start Address Register 0*/
556 {S1DREG_BBLT_DST_START1, 0x00}, /* BitBlt Destination Start Address Register 1*/ 499 {S1DREG_BBLT_DST_START1, 0x00}, /* BitBlt Destination Start Address Register 1*/
557 {S1DREG_BBLT_DST_START2, 0x00}, /* BitBlt Destination Start Address Register 2*/ 500 {S1DREG_BBLT_DST_START2, 0x00}, /* BitBlt Destination Start Address Register 2*/
558 {S1DREG_BBLT_MEM_OFF0, 0x00}, /* BitBlt Memory Address Offset Register 0*/ 501 {S1DREG_BBLT_MEM_OFF0, 0x00}, /* BitBlt Memory Address Offset Register 0*/
559 {S1DREG_BBLT_MEM_OFF1, 0x00}, /* BitBlt Memory Address Offset Register 1*/ 502 {S1DREG_BBLT_MEM_OFF1, 0x00}, /* BitBlt Memory Address Offset Register 1*/
560 {S1DREG_BBLT_WIDTH0, 0x00}, /* BitBlt Width Register 0*/ 503 {S1DREG_BBLT_WIDTH0, 0x00}, /* BitBlt Width Register 0*/
561 {S1DREG_BBLT_WIDTH1, 0x00}, /* BitBlt Width Register 1*/ 504 {S1DREG_BBLT_WIDTH1, 0x00}, /* BitBlt Width Register 1*/
562 {S1DREG_BBLT_HEIGHT0, 0x00}, /* BitBlt Height Register 0*/ 505 {S1DREG_BBLT_HEIGHT0, 0x00}, /* BitBlt Height Register 0*/
563 {S1DREG_BBLT_HEIGHT1, 0x00}, /* BitBlt Height Register 1*/ 506 {S1DREG_BBLT_HEIGHT1, 0x00}, /* BitBlt Height Register 1*/
564 {S1DREG_BBLT_BGC0, 0x00}, /* BitBlt Background Color Register 0*/ 507 {S1DREG_BBLT_BGC0, 0x00}, /* BitBlt Background Color Register 0*/
565 {S1DREG_BBLT_BGC1, 0x00}, /* BitBlt Background Color Register 1*/ 508 {S1DREG_BBLT_BGC1, 0x00}, /* BitBlt Background Color Register 1*/
566 {S1DREG_BBLT_FGC0, 0x00}, /* BitBlt Foreground Color Register 0*/ 509 {S1DREG_BBLT_FGC0, 0x00}, /* BitBlt Foreground Color Register 0*/
567 {S1DREG_BBLT_FGC1, 0x00}, /* BitBlt Foreground Color Register 1*/ 510 {S1DREG_BBLT_FGC1, 0x00}, /* BitBlt Foreground Color Register 1*/
568 {S1DREG_LKUP_MODE, 0x00}, /* Look-Up Table Mode Register*/ 511 {S1DREG_LKUP_MODE, 0x00}, /* Look-Up Table Mode Register*/
569 {S1DREG_LKUP_ADDR, 0x00}, /* Look-Up Table Address Register*/ 512 {S1DREG_LKUP_ADDR, 0x00}, /* Look-Up Table Address Register*/
570 {S1DREG_PS_CNF, 0x00}, /* Power Save Configuration Register*/ 513 {S1DREG_PS_CNF, 0x00}, /* Power Save Configuration Register*/
571 {S1DREG_PS_STATUS, 0x00}, /* Power Save Status Register*/ 514 {S1DREG_PS_STATUS, 0x00}, /* Power Save Status Register*/
572 {S1DREG_CPU2MEM_WDOGT, 0x00}, /* CPU-to-Memory Access Watchdog Timer Register*/ 515 {S1DREG_CPU2MEM_WDOGT, 0x00}, /* CPU-to-Memory Access Watchdog Timer Register*/
573 {S1DREG_COM_DISP_MODE, 0x01}, /* Display Mode Register, LCD only*/ 516 {S1DREG_COM_DISP_MODE, 0x01}, /* Display Mode Register, LCD only*/
574}; 517};
575 518
576static u64 s1dfb_dmamask = 0xffffffffUL; 519static u64 s1dfb_dmamask = DMA_BIT_MASK(32);
577 520
578static struct s1d13xxxfb_pdata yl_9200_s1dfb_pdata = { 521static struct s1d13xxxfb_pdata yl9200_s1dfb_pdata = {
579 .initregs = yl_9200_s1dfb_initregs, 522 .initregs = yl9200_s1dfb_initregs,
580 .initregssize = ARRAY_SIZE(yl_9200_s1dfb_initregs), 523 .initregssize = ARRAY_SIZE(yl9200_s1dfb_initregs),
581 .platform_init_video = yl_9200_init_video, 524 .platform_init_video = yl9200_init_video,
582}; 525};
583 526
584static struct resource yl_9200_s1dfb_resource[] = { 527static struct resource yl9200_s1dfb_resource[] = {
585 [0] = { /* video mem */ 528 [0] = { /* video mem */
586 .name = "s1d13xxxfb memory", 529 .name = "s1d13xxxfb memory",
587 /* .name = "s1d13806 memory",*/ 530 .start = AT91_FB_VMEM_BASE,
588 .start = AT91_FB_VMEM_BASE, 531 .end = AT91_FB_VMEM_BASE + AT91_FB_VMEM_SIZE -1,
589 .end = AT91_FB_VMEM_BASE + AT91_FB_VMEM_SIZE -1, 532 .flags = IORESOURCE_MEM,
590 .flags = IORESOURCE_MEM,
591 }, 533 },
592 [1] = { /* video registers */ 534 [1] = { /* video registers */
593 .name = "s1d13xxxfb registers", 535 .name = "s1d13xxxfb registers",
594 /* .name = "s1d13806 registers",*/ 536 .start = AT91_FB_REG_BASE,
595 .start = AT91_FB_REG_BASE, 537 .end = AT91_FB_REG_BASE + AT91_FB_REG_SIZE -1,
596 .end = AT91_FB_REG_BASE + AT91_FB_REG_SIZE -1, 538 .flags = IORESOURCE_MEM,
597 .flags = IORESOURCE_MEM,
598 }, 539 },
599}; 540};
600 541
601static struct platform_device yl_9200_s1dfb_device = { 542static struct platform_device yl9200_s1dfb_device = {
602 /*TODO S.Birtles , really we need the chip revision in here as well*/ 543 .name = "s1d13806fb",
603 .name = "s1d13806fb", 544 .id = -1,
604 /* .name = "s1d13506fb",*/ 545 .dev = {
605 .id = -1,
606 .dev = {
607 /*TODO theres a waring here!!*/
608 /*WARNING: vmlinux.o(.data+0x2dbc): Section mismatch: reference to .init.text: (between 'yl_9200_s1dfb_pdata' and 's1dfb_dmamask')*/
609 .dma_mask = &s1dfb_dmamask, 546 .dma_mask = &s1dfb_dmamask,
610 .coherent_dma_mask = 0xffffffff, 547 .coherent_dma_mask = DMA_BIT_MASK(32),
611 .platform_data = &yl_9200_s1dfb_pdata, 548 .platform_data = &yl9200_s1dfb_pdata,
612 }, 549 },
613 .resource = yl_9200_s1dfb_resource, 550 .resource = yl9200_s1dfb_resource,
614 .num_resources = ARRAY_SIZE(yl_9200_s1dfb_resource), 551 .num_resources = ARRAY_SIZE(yl9200_s1dfb_resource),
615}; 552};
616 553
617void __init yl_9200_add_device_video(void) 554void __init yl9200_add_device_video(void)
618{ 555{
619 platform_device_register(&yl_9200_s1dfb_device); 556 platform_device_register(&yl9200_s1dfb_device);
620} 557}
621#else 558#else
622 void __init yl_9200_add_device_video(void) {} 559void __init yl9200_add_device_video(void) {}
623#endif 560#endif
624 561
625/*this is not called first , yl_9200_map_io is called first*/ 562
626static void __init yl_9200_board_init(void) 563static void __init yl9200_board_init(void)
627{ 564{
628 /* Serial */ 565 /* Serial */
629 at91_add_device_serial(); 566 at91_add_device_serial();
630 /* Ethernet */ 567 /* Ethernet */
631 at91_add_device_eth(&yl_9200_eth_data); 568 at91_add_device_eth(&yl9200_eth_data);
632 /* USB Host */ 569 /* USB Host */
633 at91_add_device_usbh(&yl_9200_usbh_data); 570 at91_add_device_usbh(&yl9200_usbh_data);
634 /* USB Device */ 571 /* USB Device */
635 at91_add_device_udc(&yl_9200_udc_data); 572 at91_add_device_udc(&yl9200_udc_data);
636 /* pullup_pin it is actually active low, but this is not needed, driver sets it up */
637 /*at91_set_multi_drive(yl_9200_udc_data.pullup_pin, 0);*/
638
639 /* Compact Flash */
640 /*at91_add_device_cf(&yl_9200_cf_data);*/
641
642 /* I2C */ 573 /* I2C */
643 at91_add_device_i2c(yl_9200_i2c_devices, ARRAY_SIZE(yl_9200_i2c_devices)); 574 at91_add_device_i2c(yl9200_i2c_devices, ARRAY_SIZE(yl9200_i2c_devices));
644 /* SPI */ 575 /* MMC */
645 /*TODO YL9200 we have 2 spi interfaces touch screen & CAN*/ 576 at91_add_device_mmc(0, &yl9200_mmc_data);
646 /* AT91_PIN_PA5, AT91_PIN_PA6 , are used on the max 485 NOT SPI*/
647
648 /*touch screen and CAN*/
649 at91_add_device_spi(yl_9200_spi_devices, ARRAY_SIZE(yl_9200_spi_devices));
650
651 /*Basically the TS uses PB11 & PB10 , PB11 is configured by the SPI system BP10 IS NOT USED!!*/
652 /* we need this incase the board is running without a touch screen*/
653 #if defined(CONFIG_TOUCHSCREEN_ADS7846) || defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE)
654 at91_init_device_ts(); /*init the touch screen device*/
655 #endif
656 /* DataFlash card */
657 at91_add_device_mmc(0, &yl_9200_mmc_data);
658 /* NAND */ 577 /* NAND */
659 at91_add_device_nand(&yl_9200_nand_data); 578 at91_add_device_nand(&yl9200_nand_data);
660 /* NOR Flash */ 579 /* NOR Flash */
661 platform_device_register(&yl_9200_flash); 580 platform_device_register(&yl9200_flash);
662 /* LEDs. Note!! this does not include the led's we passed for the processor status */ 581#if defined(CONFIG_SPI_ATMEL) || defined(CONFIG_SPI_ATMEL_MODULE)
663 at91_gpio_leds(yl_9200_leds, ARRAY_SIZE(yl_9200_leds)); 582 /* SPI */
664 /* VGA */ 583 at91_add_device_spi(yl9200_spi_devices, ARRAY_SIZE(yl9200_spi_devices));
665 /*this is self registered by including the s1d13xxx chip in the kernel build*/ 584 /* Touchscreen */
666 yl_9200_add_device_video(); 585 yl9200_add_device_ts();
586#endif
587 /* LEDs. */
588 at91_gpio_leds(yl9200_leds, ARRAY_SIZE(yl9200_leds));
667 /* Push Buttons */ 589 /* Push Buttons */
668 yl_9200_add_device_buttons(); 590 yl9200_add_device_buttons();
669 /*TODO fixup the Sounder */ 591 /* VGA */
670// yl_9200_add_device_sounder(yl_9200_sounder,ARRAY_SIZE(yl_9200_sounder)); 592 yl9200_add_device_video();
671
672} 593}
673 594
674MACHINE_START(YL9200, "uCdragon YL-9200") 595MACHINE_START(YL9200, "uCdragon YL-9200")
675 /* Maintainer: S.Birtles*/ 596 /* Maintainer: S.Birtles */
676 .phys_io = AT91_BASE_SYS, 597 .phys_io = AT91_BASE_SYS,
677 .io_pg_offst = (AT91_VA_BASE_SYS >> 18) & 0xfffc, 598 .io_pg_offst = (AT91_VA_BASE_SYS >> 18) & 0xfffc,
678 .boot_params = AT91_SDRAM_BASE + 0x100, 599 .boot_params = AT91_SDRAM_BASE + 0x100,
679 .timer = &at91rm9200_timer, 600 .timer = &at91rm9200_timer,
680 .map_io = yl_9200_map_io, 601 .map_io = yl9200_map_io,
681 .init_irq = yl_9200_init_irq, 602 .init_irq = yl9200_init_irq,
682 .init_machine = yl_9200_board_init, 603 .init_machine = yl9200_board_init,
683MACHINE_END 604MACHINE_END
diff --git a/arch/arm/mach-at91/clock.c b/arch/arm/mach-at91/clock.c
index a33dfe450726..464bdbbf74df 100644
--- a/arch/arm/mach-at91/clock.c
+++ b/arch/arm/mach-at91/clock.c
@@ -112,12 +112,34 @@ static void pmc_sys_mode(struct clk *clk, int is_on)
112 at91_sys_write(AT91_PMC_SCDR, clk->pmc_mask); 112 at91_sys_write(AT91_PMC_SCDR, clk->pmc_mask);
113} 113}
114 114
115static void pmc_uckr_mode(struct clk *clk, int is_on)
116{
117 unsigned int uckr = at91_sys_read(AT91_CKGR_UCKR);
118
119 if (is_on) {
120 is_on = AT91_PMC_LOCKU;
121 at91_sys_write(AT91_CKGR_UCKR, uckr | clk->pmc_mask);
122 } else
123 at91_sys_write(AT91_CKGR_UCKR, uckr & ~(clk->pmc_mask));
124
125 do {
126 cpu_relax();
127 } while ((at91_sys_read(AT91_PMC_SR) & AT91_PMC_LOCKU) != is_on);
128}
129
115/* USB function clocks (PLLB must be 48 MHz) */ 130/* USB function clocks (PLLB must be 48 MHz) */
116static struct clk udpck = { 131static struct clk udpck = {
117 .name = "udpck", 132 .name = "udpck",
118 .parent = &pllb, 133 .parent = &pllb,
119 .mode = pmc_sys_mode, 134 .mode = pmc_sys_mode,
120}; 135};
136static struct clk utmi_clk = {
137 .name = "utmi_clk",
138 .parent = &main_clk,
139 .pmc_mask = AT91_PMC_UPLLEN, /* in CKGR_UCKR */
140 .mode = pmc_uckr_mode,
141 .type = CLK_TYPE_PLL,
142};
121static struct clk uhpck = { 143static struct clk uhpck = {
122 .name = "uhpck", 144 .name = "uhpck",
123 .parent = &pllb, 145 .parent = &pllb,
@@ -361,7 +383,7 @@ static void __init init_programmable_clock(struct clk *clk)
361 383
362static int at91_clk_show(struct seq_file *s, void *unused) 384static int at91_clk_show(struct seq_file *s, void *unused)
363{ 385{
364 u32 scsr, pcsr, sr; 386 u32 scsr, pcsr, uckr = 0, sr;
365 struct clk *clk; 387 struct clk *clk;
366 388
367 seq_printf(s, "SCSR = %8x\n", scsr = at91_sys_read(AT91_PMC_SCSR)); 389 seq_printf(s, "SCSR = %8x\n", scsr = at91_sys_read(AT91_PMC_SCSR));
@@ -369,7 +391,10 @@ static int at91_clk_show(struct seq_file *s, void *unused)
369 seq_printf(s, "MOR = %8x\n", at91_sys_read(AT91_CKGR_MOR)); 391 seq_printf(s, "MOR = %8x\n", at91_sys_read(AT91_CKGR_MOR));
370 seq_printf(s, "MCFR = %8x\n", at91_sys_read(AT91_CKGR_MCFR)); 392 seq_printf(s, "MCFR = %8x\n", at91_sys_read(AT91_CKGR_MCFR));
371 seq_printf(s, "PLLA = %8x\n", at91_sys_read(AT91_CKGR_PLLAR)); 393 seq_printf(s, "PLLA = %8x\n", at91_sys_read(AT91_CKGR_PLLAR));
372 seq_printf(s, "PLLB = %8x\n", at91_sys_read(AT91_CKGR_PLLBR)); 394 if (!cpu_is_at91sam9rl())
395 seq_printf(s, "PLLB = %8x\n", at91_sys_read(AT91_CKGR_PLLBR));
396 if (cpu_is_at91cap9() || cpu_is_at91sam9rl())
397 seq_printf(s, "UCKR = %8x\n", uckr = at91_sys_read(AT91_CKGR_UCKR));
373 seq_printf(s, "MCKR = %8x\n", at91_sys_read(AT91_PMC_MCKR)); 398 seq_printf(s, "MCKR = %8x\n", at91_sys_read(AT91_PMC_MCKR));
374 seq_printf(s, "SR = %8x\n", sr = at91_sys_read(AT91_PMC_SR)); 399 seq_printf(s, "SR = %8x\n", sr = at91_sys_read(AT91_PMC_SR));
375 400
@@ -382,6 +407,8 @@ static int at91_clk_show(struct seq_file *s, void *unused)
382 state = (scsr & clk->pmc_mask) ? "on" : "off"; 407 state = (scsr & clk->pmc_mask) ? "on" : "off";
383 else if (clk->mode == pmc_periph_mode) 408 else if (clk->mode == pmc_periph_mode)
384 state = (pcsr & clk->pmc_mask) ? "on" : "off"; 409 state = (pcsr & clk->pmc_mask) ? "on" : "off";
410 else if (clk->mode == pmc_uckr_mode)
411 state = (uckr & clk->pmc_mask) ? "on" : "off";
385 else if (clk->pmc_mask) 412 else if (clk->pmc_mask)
386 state = (sr & clk->pmc_mask) ? "on" : "off"; 413 state = (sr & clk->pmc_mask) ? "on" : "off";
387 else if (clk == &clk32k || clk == &main_clk) 414 else if (clk == &clk32k || clk == &main_clk)
@@ -488,14 +515,19 @@ static unsigned __init at91_pll_calc(unsigned main_freq, unsigned out_freq)
488 /* 515 /*
489 * PLL input between 1MHz and 32MHz per spec, but lower 516 * PLL input between 1MHz and 32MHz per spec, but lower
490 * frequences seem necessary in some cases so allow 100K. 517 * frequences seem necessary in some cases so allow 100K.
518 * Warning: some newer products need 2MHz min.
491 */ 519 */
492 input = main_freq / i; 520 input = main_freq / i;
521 if (cpu_is_at91sam9g20() && input < 2000000)
522 continue;
493 if (input < 100000) 523 if (input < 100000)
494 continue; 524 continue;
495 if (input > 32000000) 525 if (input > 32000000)
496 continue; 526 continue;
497 527
498 mul1 = out_freq / input; 528 mul1 = out_freq / input;
529 if (cpu_is_at91sam9g20() && mul > 63)
530 continue;
499 if (mul1 > 2048) 531 if (mul1 > 2048)
500 continue; 532 continue;
501 if (mul1 < 2) 533 if (mul1 < 2)
@@ -555,7 +587,8 @@ int __init at91_clock_init(unsigned long main_clock)
555 587
556 /* report if PLLA is more than mildly overclocked */ 588 /* report if PLLA is more than mildly overclocked */
557 plla.rate_hz = at91_pll_rate(&plla, main_clock, at91_sys_read(AT91_CKGR_PLLAR)); 589 plla.rate_hz = at91_pll_rate(&plla, main_clock, at91_sys_read(AT91_CKGR_PLLAR));
558 if (plla.rate_hz > 209000000) 590 if ((!cpu_is_at91sam9g20() && plla.rate_hz > 209000000)
591 || (cpu_is_at91sam9g20() && plla.rate_hz > 800000000))
559 pr_info("Clocks: PLLA overclocked, %ld MHz\n", plla.rate_hz / 1000000); 592 pr_info("Clocks: PLLA overclocked, %ld MHz\n", plla.rate_hz / 1000000);
560 593
561 /* 594 /*
@@ -570,7 +603,7 @@ int __init at91_clock_init(unsigned long main_clock)
570 uhpck.pmc_mask = AT91RM9200_PMC_UHP; 603 uhpck.pmc_mask = AT91RM9200_PMC_UHP;
571 udpck.pmc_mask = AT91RM9200_PMC_UDP; 604 udpck.pmc_mask = AT91RM9200_PMC_UDP;
572 at91_sys_write(AT91_PMC_SCER, AT91RM9200_PMC_MCKUDP); 605 at91_sys_write(AT91_PMC_SCER, AT91RM9200_PMC_MCKUDP);
573 } else if (cpu_is_at91sam9260() || cpu_is_at91sam9261() || cpu_is_at91sam9263()) { 606 } else if (cpu_is_at91sam9260() || cpu_is_at91sam9261() || cpu_is_at91sam9263() || cpu_is_at91sam9g20()) {
574 uhpck.pmc_mask = AT91SAM926x_PMC_UHP; 607 uhpck.pmc_mask = AT91SAM926x_PMC_UHP;
575 udpck.pmc_mask = AT91SAM926x_PMC_UDP; 608 udpck.pmc_mask = AT91SAM926x_PMC_UDP;
576 } else if (cpu_is_at91cap9()) { 609 } else if (cpu_is_at91cap9()) {
@@ -582,6 +615,17 @@ int __init at91_clock_init(unsigned long main_clock)
582 uhpck.rate_hz = at91_usb_rate(&pllb, pllb.rate_hz, at91_pllb_usb_init); 615 uhpck.rate_hz = at91_usb_rate(&pllb, pllb.rate_hz, at91_pllb_usb_init);
583 616
584 /* 617 /*
618 * USB HS clock init
619 */
620 if (cpu_is_at91cap9() || cpu_is_at91sam9rl()) {
621 /*
622 * multiplier is hard-wired to 40
623 * (obtain the USB High Speed 480 MHz when input is 12 MHz)
624 */
625 utmi_clk.rate_hz = 40 * utmi_clk.parent->rate_hz;
626 }
627
628 /*
585 * MCK and CPU derive from one of those primary clocks. 629 * MCK and CPU derive from one of those primary clocks.
586 * For now, assume this parentage won't change. 630 * For now, assume this parentage won't change.
587 */ 631 */
@@ -591,13 +635,21 @@ int __init at91_clock_init(unsigned long main_clock)
591 freq /= (1 << ((mckr & AT91_PMC_PRES) >> 2)); /* prescale */ 635 freq /= (1 << ((mckr & AT91_PMC_PRES) >> 2)); /* prescale */
592 if (cpu_is_at91rm9200()) 636 if (cpu_is_at91rm9200())
593 mck.rate_hz = freq / (1 + ((mckr & AT91_PMC_MDIV) >> 8)); /* mdiv */ 637 mck.rate_hz = freq / (1 + ((mckr & AT91_PMC_MDIV) >> 8)); /* mdiv */
594 else 638 else if (cpu_is_at91sam9g20()) {
595 mck.rate_hz = freq / (1 << ((mckr & AT91_PMC_MDIV) >> 8)); /* mdiv */ 639 mck.rate_hz = (mckr & AT91_PMC_MDIV) ?
640 freq / ((mckr & AT91_PMC_MDIV) >> 7) : freq; /* mdiv ; (x >> 7) = ((x >> 8) * 2) */
641 if (mckr & AT91_PMC_PDIV)
642 freq /= 2; /* processor clock division */
643 } else
644 mck.rate_hz = freq / (1 << ((mckr & AT91_PMC_MDIV) >> 8)); /* mdiv */
596 645
597 /* Register the PMC's standard clocks */ 646 /* Register the PMC's standard clocks */
598 for (i = 0; i < ARRAY_SIZE(standard_pmc_clocks); i++) 647 for (i = 0; i < ARRAY_SIZE(standard_pmc_clocks); i++)
599 list_add_tail(&standard_pmc_clocks[i]->node, &clocks); 648 list_add_tail(&standard_pmc_clocks[i]->node, &clocks);
600 649
650 if (cpu_is_at91cap9() || cpu_is_at91sam9rl())
651 list_add_tail(&utmi_clk.node, &clocks);
652
601 /* MCK and CPU clock are "always on" */ 653 /* MCK and CPU clock are "always on" */
602 clk_enable(&mck); 654 clk_enable(&mck);
603 655
diff --git a/arch/arm/mach-at91/pm.c b/arch/arm/mach-at91/pm.c
index aa863c157708..8ab4feb1ec5b 100644
--- a/arch/arm/mach-at91/pm.c
+++ b/arch/arm/mach-at91/pm.c
@@ -202,7 +202,7 @@ static int at91_pm_verify_clocks(void)
202 pr_debug("AT91: PM - Suspend-to-RAM with USB still active\n"); 202 pr_debug("AT91: PM - Suspend-to-RAM with USB still active\n");
203 return 0; 203 return 0;
204 } 204 }
205 } else if (cpu_is_at91sam9260() || cpu_is_at91sam9261() || cpu_is_at91sam9263()) { 205 } else if (cpu_is_at91sam9260() || cpu_is_at91sam9261() || cpu_is_at91sam9263() || cpu_is_at91sam9g20()) {
206 if ((scsr & (AT91SAM926x_PMC_UHP | AT91SAM926x_PMC_UDP)) != 0) { 206 if ((scsr & (AT91SAM926x_PMC_UHP | AT91SAM926x_PMC_UDP)) != 0) {
207 pr_debug("AT91: PM - Suspend-to-RAM with USB still active\n"); 207 pr_debug("AT91: PM - Suspend-to-RAM with USB still active\n");
208 return 0; 208 return 0;
diff --git a/arch/arm/mach-ep93xx/clock.c b/arch/arm/mach-ep93xx/clock.c
index 9d7515c36bff..f62c35500bb7 100644
--- a/arch/arm/mach-ep93xx/clock.c
+++ b/arch/arm/mach-ep93xx/clock.c
@@ -74,6 +74,7 @@ struct clk *clk_get(struct device *dev, const char *id)
74 74
75 return ERR_PTR(-ENOENT); 75 return ERR_PTR(-ENOENT);
76} 76}
77EXPORT_SYMBOL(clk_get);
77 78
78int clk_enable(struct clk *clk) 79int clk_enable(struct clk *clk)
79{ 80{
@@ -86,6 +87,7 @@ int clk_enable(struct clk *clk)
86 87
87 return 0; 88 return 0;
88} 89}
90EXPORT_SYMBOL(clk_enable);
89 91
90void clk_disable(struct clk *clk) 92void clk_disable(struct clk *clk)
91{ 93{
@@ -96,15 +98,18 @@ void clk_disable(struct clk *clk)
96 __raw_writel(value & ~clk->enable_mask, clk->enable_reg); 98 __raw_writel(value & ~clk->enable_mask, clk->enable_reg);
97 } 99 }
98} 100}
101EXPORT_SYMBOL(clk_disable);
99 102
100unsigned long clk_get_rate(struct clk *clk) 103unsigned long clk_get_rate(struct clk *clk)
101{ 104{
102 return clk->rate; 105 return clk->rate;
103} 106}
107EXPORT_SYMBOL(clk_get_rate);
104 108
105void clk_put(struct clk *clk) 109void clk_put(struct clk *clk)
106{ 110{
107} 111}
112EXPORT_SYMBOL(clk_put);
108 113
109 114
110 115
diff --git a/arch/arm/mach-footbridge/Makefile b/arch/arm/mach-footbridge/Makefile
index 0694ad6b6476..32f8609e4f85 100644
--- a/arch/arm/mach-footbridge/Makefile
+++ b/arch/arm/mach-footbridge/Makefile
@@ -14,12 +14,10 @@ pci-$(CONFIG_ARCH_EBSA285_HOST) += ebsa285-pci.o
14pci-$(CONFIG_ARCH_NETWINDER) += netwinder-pci.o 14pci-$(CONFIG_ARCH_NETWINDER) += netwinder-pci.o
15pci-$(CONFIG_ARCH_PERSONAL_SERVER) += personal-pci.o 15pci-$(CONFIG_ARCH_PERSONAL_SERVER) += personal-pci.o
16 16
17leds-$(CONFIG_ARCH_CO285) += ebsa285-leds.o
18leds-$(CONFIG_ARCH_EBSA285) += ebsa285-leds.o 17leds-$(CONFIG_ARCH_EBSA285) += ebsa285-leds.o
19leds-$(CONFIG_ARCH_NETWINDER) += netwinder-leds.o 18leds-$(CONFIG_ARCH_NETWINDER) += netwinder-leds.o
20 19
21obj-$(CONFIG_ARCH_CATS) += cats-hw.o isa-timer.o 20obj-$(CONFIG_ARCH_CATS) += cats-hw.o isa-timer.o
22obj-$(CONFIG_ARCH_CO285) += co285.o dc21285-timer.o
23obj-$(CONFIG_ARCH_EBSA285) += ebsa285.o dc21285-timer.o 21obj-$(CONFIG_ARCH_EBSA285) += ebsa285.o dc21285-timer.o
24obj-$(CONFIG_ARCH_NETWINDER) += netwinder-hw.o isa-timer.o 22obj-$(CONFIG_ARCH_NETWINDER) += netwinder-hw.o isa-timer.o
25obj-$(CONFIG_ARCH_PERSONAL_SERVER) += personal.o dc21285-timer.o 23obj-$(CONFIG_ARCH_PERSONAL_SERVER) += personal.o dc21285-timer.o
diff --git a/arch/arm/mach-footbridge/co285.c b/arch/arm/mach-footbridge/co285.c
deleted file mode 100644
index 4545576ad8d9..000000000000
--- a/arch/arm/mach-footbridge/co285.c
+++ /dev/null
@@ -1,39 +0,0 @@
1/*
2 * linux/arch/arm/mach-footbridge/co285.c
3 *
4 * CO285 machine fixup
5 */
6#include <linux/init.h>
7
8#include <asm/hardware/dec21285.h>
9#include <asm/mach-types.h>
10
11#include <asm/mach/arch.h>
12
13#include "common.h"
14
15static void __init
16fixup_coebsa285(struct machine_desc *desc, struct tag *tags,
17 char **cmdline, struct meminfo *mi)
18{
19 extern unsigned long boot_memory_end;
20 extern char boot_command_line[];
21
22 mi->nr_banks = 1;
23 mi->bank[0].start = PHYS_OFFSET;
24 mi->bank[0].size = boot_memory_end;
25 mi->bank[0].node = 0;
26
27 *cmdline = boot_command_line;
28}
29
30MACHINE_START(CO285, "co-EBSA285")
31 /* Maintainer: Mark van Doesburg */
32 .phys_io = DC21285_ARMCSR_BASE,
33 .io_pg_offst = ((0x7cf00000) >> 18) & 0xfffc,
34 .fixup = fixup_coebsa285,
35 .map_io = footbridge_map_io,
36 .init_irq = footbridge_init_irq,
37 .timer = &footbridge_timer,
38MACHINE_END
39
diff --git a/arch/arm/mach-footbridge/common.c b/arch/arm/mach-footbridge/common.c
index ef29fc34ce65..b08ab507c052 100644
--- a/arch/arm/mach-footbridge/common.c
+++ b/arch/arm/mach-footbridge/common.c
@@ -177,25 +177,6 @@ static struct map_desc ebsa285_host_io_desc[] __initdata = {
177#endif 177#endif
178}; 178};
179 179
180/*
181 * The CO-ebsa285 mapping.
182 */
183static struct map_desc co285_io_desc[] __initdata = {
184#ifdef CONFIG_ARCH_CO285
185 {
186 .virtual = PCIO_BASE,
187 .pfn = __phys_to_pfn(DC21285_PCI_IO),
188 .length = PCIO_SIZE,
189 .type = MT_DEVICE,
190 }, {
191 .virtual = PCIMEM_BASE,
192 .pfn = __phys_to_pfn(DC21285_PCI_MEM),
193 .length = PCIMEM_SIZE,
194 .type = MT_DEVICE,
195 },
196#endif
197};
198
199void __init footbridge_map_io(void) 180void __init footbridge_map_io(void)
200{ 181{
201 /* 182 /*
@@ -208,8 +189,6 @@ void __init footbridge_map_io(void)
208 * Now, work out what we've got to map in addition on this 189 * Now, work out what we've got to map in addition on this
209 * platform. 190 * platform.
210 */ 191 */
211 if (machine_is_co285())
212 iotable_init(co285_io_desc, ARRAY_SIZE(co285_io_desc));
213 if (footbridge_cfn_mode()) 192 if (footbridge_cfn_mode())
214 iotable_init(ebsa285_host_io_desc, ARRAY_SIZE(ebsa285_host_io_desc)); 193 iotable_init(ebsa285_host_io_desc, ARRAY_SIZE(ebsa285_host_io_desc));
215} 194}
diff --git a/arch/arm/mach-footbridge/ebsa285-leds.c b/arch/arm/mach-footbridge/ebsa285-leds.c
index a64e22226515..09c1fbc51876 100644
--- a/arch/arm/mach-footbridge/ebsa285-leds.c
+++ b/arch/arm/mach-footbridge/ebsa285-leds.c
@@ -128,7 +128,7 @@ static void ebsa285_leds_event(led_event_t evt)
128 128
129static int __init leds_init(void) 129static int __init leds_init(void)
130{ 130{
131 if (machine_is_ebsa285() || machine_is_co285()) 131 if (machine_is_ebsa285())
132 leds_event = ebsa285_leds_event; 132 leds_event = ebsa285_leds_event;
133 133
134 leds_event(led_start); 134 leds_event(led_start);
diff --git a/arch/arm/mach-footbridge/time.c b/arch/arm/mach-footbridge/time.c
index 5d02e95dede3..d5cfcda385d6 100644
--- a/arch/arm/mach-footbridge/time.c
+++ b/arch/arm/mach-footbridge/time.c
@@ -115,8 +115,7 @@ static int set_isa_cmos_time(void)
115 115
116void __init isa_rtc_init(void) 116void __init isa_rtc_init(void)
117{ 117{
118 if (machine_is_co285() || 118 if (machine_is_personal_server())
119 machine_is_personal_server())
120 /* 119 /*
121 * Add-in 21285s shouldn't access the RTC 120 * Add-in 21285s shouldn't access the RTC
122 */ 121 */
diff --git a/arch/arm/mach-imx/dma.c b/arch/arm/mach-imx/dma.c
index a59ff2987cb7..ee1c6f06ff64 100644
--- a/arch/arm/mach-imx/dma.c
+++ b/arch/arm/mach-imx/dma.c
@@ -410,7 +410,6 @@ void imx_dma_free(imx_dmach_t dma_ch)
410 410
411/** 411/**
412 * imx_dma_request_by_prio - find and request some of free channels best suiting requested priority 412 * imx_dma_request_by_prio - find and request some of free channels best suiting requested priority
413 * @dma_ch: i.MX DMA channel number
414 * @name: the driver/caller own non-%NULL identification 413 * @name: the driver/caller own non-%NULL identification
415 * @prio: one of the hardware distinguished priority level: 414 * @prio: one of the hardware distinguished priority level:
416 * %DMA_PRIO_HIGH, %DMA_PRIO_MEDIUM, %DMA_PRIO_LOW 415 * %DMA_PRIO_HIGH, %DMA_PRIO_MEDIUM, %DMA_PRIO_LOW
@@ -420,11 +419,9 @@ void imx_dma_free(imx_dmach_t dma_ch)
420 * in the higher and then even lower priority groups. 419 * in the higher and then even lower priority groups.
421 * 420 *
422 * Return value: If there is no free channel to allocate, -%ENODEV is returned. 421 * Return value: If there is no free channel to allocate, -%ENODEV is returned.
423 * Zero value indicates successful channel allocation. 422 * On successful allocation channel is returned.
424 */ 423 */
425int 424imx_dmach_t imx_dma_request_by_prio(const char *name, imx_dma_prio prio)
426imx_dma_request_by_prio(imx_dmach_t * pdma_ch, const char *name,
427 imx_dma_prio prio)
428{ 425{
429 int i; 426 int i;
430 int best; 427 int best;
@@ -444,15 +441,13 @@ imx_dma_request_by_prio(imx_dmach_t * pdma_ch, const char *name,
444 441
445 for (i = best; i < IMX_DMA_CHANNELS; i++) { 442 for (i = best; i < IMX_DMA_CHANNELS; i++) {
446 if (!imx_dma_request(i, name)) { 443 if (!imx_dma_request(i, name)) {
447 *pdma_ch = i; 444 return i;
448 return 0;
449 } 445 }
450 } 446 }
451 447
452 for (i = best - 1; i >= 0; i--) { 448 for (i = best - 1; i >= 0; i--) {
453 if (!imx_dma_request(i, name)) { 449 if (!imx_dma_request(i, name)) {
454 *pdma_ch = i; 450 return i;
455 return 0;
456 } 451 }
457 } 452 }
458 453
diff --git a/arch/arm/mach-integrator/Makefile b/arch/arm/mach-integrator/Makefile
index 158daaf9e3b0..6a5ef8d30b10 100644
--- a/arch/arm/mach-integrator/Makefile
+++ b/arch/arm/mach-integrator/Makefile
@@ -4,7 +4,7 @@
4 4
5# Object file lists. 5# Object file lists.
6 6
7obj-y := clock.o core.o lm.o time.o 7obj-y := clock.o core.o lm.o
8obj-$(CONFIG_ARCH_INTEGRATOR_AP) += integrator_ap.o 8obj-$(CONFIG_ARCH_INTEGRATOR_AP) += integrator_ap.o
9obj-$(CONFIG_ARCH_INTEGRATOR_CP) += integrator_cp.o 9obj-$(CONFIG_ARCH_INTEGRATOR_CP) += integrator_cp.o
10 10
diff --git a/arch/arm/mach-integrator/time.c b/arch/arm/mach-integrator/time.c
deleted file mode 100644
index 8508a0db3eaf..000000000000
--- a/arch/arm/mach-integrator/time.c
+++ /dev/null
@@ -1,223 +0,0 @@
1/*
2 * linux/arch/arm/mach-integrator/time.c
3 *
4 * Copyright (C) 2000-2001 Deep Blue Solutions Ltd.
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/module.h>
11#include <linux/kernel.h>
12#include <linux/time.h>
13#include <linux/mc146818rtc.h>
14#include <linux/interrupt.h>
15#include <linux/init.h>
16#include <linux/device.h>
17#include <linux/amba/bus.h>
18
19#include <asm/hardware.h>
20#include <asm/io.h>
21#include <asm/uaccess.h>
22#include <asm/rtc.h>
23
24#include <asm/mach/time.h>
25
26#define RTC_DR (0)
27#define RTC_MR (4)
28#define RTC_STAT (8)
29#define RTC_EOI (8)
30#define RTC_LR (12)
31#define RTC_CR (16)
32#define RTC_CR_MIE (1 << 0)
33
34extern int (*set_rtc)(void);
35static void __iomem *rtc_base;
36
37static int integrator_set_rtc(void)
38{
39 __raw_writel(xtime.tv_sec, rtc_base + RTC_LR);
40 return 1;
41}
42
43static int integrator_rtc_read_alarm(struct rtc_wkalrm *alrm)
44{
45 rtc_time_to_tm(readl(rtc_base + RTC_MR), &alrm->time);
46 return 0;
47}
48
49static inline int integrator_rtc_set_alarm(struct rtc_wkalrm *alrm)
50{
51 unsigned long time;
52 int ret;
53
54 /*
55 * At the moment, we can only deal with non-wildcarded alarm times.
56 */
57 ret = rtc_valid_tm(&alrm->time);
58 if (ret == 0)
59 ret = rtc_tm_to_time(&alrm->time, &time);
60 if (ret == 0)
61 writel(time, rtc_base + RTC_MR);
62 return ret;
63}
64
65static int integrator_rtc_read_time(struct rtc_time *tm)
66{
67 rtc_time_to_tm(readl(rtc_base + RTC_DR), tm);
68 return 0;
69}
70
71/*
72 * Set the RTC time. Unfortunately, we can't accurately set
73 * the point at which the counter updates.
74 *
75 * Also, since RTC_LR is transferred to RTC_CR on next rising
76 * edge of the 1Hz clock, we must write the time one second
77 * in advance.
78 */
79static inline int integrator_rtc_set_time(struct rtc_time *tm)
80{
81 unsigned long time;
82 int ret;
83
84 ret = rtc_tm_to_time(tm, &time);
85 if (ret == 0)
86 writel(time + 1, rtc_base + RTC_LR);
87
88 return ret;
89}
90
91static struct rtc_ops rtc_ops = {
92 .owner = THIS_MODULE,
93 .read_time = integrator_rtc_read_time,
94 .set_time = integrator_rtc_set_time,
95 .read_alarm = integrator_rtc_read_alarm,
96 .set_alarm = integrator_rtc_set_alarm,
97};
98
99static irqreturn_t arm_rtc_interrupt(int irq, void *dev_id)
100{
101 writel(0, rtc_base + RTC_EOI);
102 return IRQ_HANDLED;
103}
104
105static int rtc_probe(struct amba_device *dev, void *id)
106{
107 int ret;
108
109 if (rtc_base)
110 return -EBUSY;
111
112 ret = amba_request_regions(dev, NULL);
113 if (ret)
114 goto out;
115
116 rtc_base = ioremap(dev->res.start, SZ_4K);
117 if (!rtc_base) {
118 ret = -ENOMEM;
119 goto res_out;
120 }
121
122 __raw_writel(0, rtc_base + RTC_CR);
123 __raw_writel(0, rtc_base + RTC_EOI);
124
125 xtime.tv_sec = __raw_readl(rtc_base + RTC_DR);
126
127 /* note that 'dev' is merely used for irq disambiguation;
128 * it is not actually referenced in the irq handler
129 */
130 ret = request_irq(dev->irq[0], arm_rtc_interrupt, IRQF_DISABLED,
131 "rtc-pl030", dev);
132 if (ret)
133 goto map_out;
134
135 ret = register_rtc(&rtc_ops);
136 if (ret)
137 goto irq_out;
138
139 set_rtc = integrator_set_rtc;
140 return 0;
141
142 irq_out:
143 free_irq(dev->irq[0], dev);
144 map_out:
145 iounmap(rtc_base);
146 rtc_base = NULL;
147 res_out:
148 amba_release_regions(dev);
149 out:
150 return ret;
151}
152
153static int rtc_remove(struct amba_device *dev)
154{
155 set_rtc = NULL;
156
157 writel(0, rtc_base + RTC_CR);
158
159 free_irq(dev->irq[0], dev);
160 unregister_rtc(&rtc_ops);
161
162 iounmap(rtc_base);
163 rtc_base = NULL;
164 amba_release_regions(dev);
165
166 return 0;
167}
168
169static struct timespec rtc_delta;
170
171static int rtc_suspend(struct amba_device *dev, pm_message_t state)
172{
173 struct timespec rtc;
174
175 rtc.tv_sec = readl(rtc_base + RTC_DR);
176 rtc.tv_nsec = 0;
177 save_time_delta(&rtc_delta, &rtc);
178
179 return 0;
180}
181
182static int rtc_resume(struct amba_device *dev)
183{
184 struct timespec rtc;
185
186 rtc.tv_sec = readl(rtc_base + RTC_DR);
187 rtc.tv_nsec = 0;
188 restore_time_delta(&rtc_delta, &rtc);
189
190 return 0;
191}
192
193static struct amba_id rtc_ids[] = {
194 {
195 .id = 0x00041030,
196 .mask = 0x000fffff,
197 },
198 { 0, 0 },
199};
200
201static struct amba_driver rtc_driver = {
202 .drv = {
203 .name = "rtc-pl030",
204 },
205 .probe = rtc_probe,
206 .remove = rtc_remove,
207 .suspend = rtc_suspend,
208 .resume = rtc_resume,
209 .id_table = rtc_ids,
210};
211
212static int __init integrator_rtc_init(void)
213{
214 return amba_driver_register(&rtc_driver);
215}
216
217static void __exit integrator_rtc_exit(void)
218{
219 amba_driver_unregister(&rtc_driver);
220}
221
222module_init(integrator_rtc_init);
223module_exit(integrator_rtc_exit);
diff --git a/arch/arm/mach-ixp4xx/Kconfig b/arch/arm/mach-ixp4xx/Kconfig
index e774447c0592..db8b5fe06c0d 100644
--- a/arch/arm/mach-ixp4xx/Kconfig
+++ b/arch/arm/mach-ixp4xx/Kconfig
@@ -125,6 +125,15 @@ config ARCH_IXDP4XX
125 depends on ARCH_IXDP425 || MACH_IXDP465 || MACH_KIXRP435 125 depends on ARCH_IXDP425 || MACH_IXDP465 || MACH_KIXRP435
126 default y 126 default y
127 127
128config MACH_FSG
129 bool
130 prompt "Freecom FSG-3"
131 select PCI
132 help
133 Say 'Y' here if you want your kernel to support Freecom's
134 FSG-3 device. For more information on this platform,
135 see http://www.nslu2-linux.org/wiki/FSG3/HomePage
136
128# 137#
129# Certain registers and IRQs are only enabled if supporting IXP465 CPUs 138# Certain registers and IRQs are only enabled if supporting IXP465 CPUs
130# 139#
diff --git a/arch/arm/mach-ixp4xx/Makefile b/arch/arm/mach-ixp4xx/Makefile
index c1956882c48b..2e6bbf927a74 100644
--- a/arch/arm/mach-ixp4xx/Makefile
+++ b/arch/arm/mach-ixp4xx/Makefile
@@ -15,6 +15,7 @@ obj-pci-$(CONFIG_MACH_NAS100D) += nas100d-pci.o
15obj-pci-$(CONFIG_MACH_DSMG600) += dsmg600-pci.o 15obj-pci-$(CONFIG_MACH_DSMG600) += dsmg600-pci.o
16obj-pci-$(CONFIG_MACH_GATEWAY7001) += gateway7001-pci.o 16obj-pci-$(CONFIG_MACH_GATEWAY7001) += gateway7001-pci.o
17obj-pci-$(CONFIG_MACH_WG302V2) += wg302v2-pci.o 17obj-pci-$(CONFIG_MACH_WG302V2) += wg302v2-pci.o
18obj-pci-$(CONFIG_MACH_FSG) += fsg-pci.o
18 19
19obj-y += common.o 20obj-y += common.o
20 21
@@ -28,6 +29,7 @@ obj-$(CONFIG_MACH_NAS100D) += nas100d-setup.o
28obj-$(CONFIG_MACH_DSMG600) += dsmg600-setup.o 29obj-$(CONFIG_MACH_DSMG600) += dsmg600-setup.o
29obj-$(CONFIG_MACH_GATEWAY7001) += gateway7001-setup.o 30obj-$(CONFIG_MACH_GATEWAY7001) += gateway7001-setup.o
30obj-$(CONFIG_MACH_WG302V2) += wg302v2-setup.o 31obj-$(CONFIG_MACH_WG302V2) += wg302v2-setup.o
32obj-$(CONFIG_MACH_FSG) += fsg-setup.o
31 33
32obj-$(CONFIG_PCI) += $(obj-pci-$(CONFIG_PCI)) common-pci.o 34obj-$(CONFIG_PCI) += $(obj-pci-$(CONFIG_PCI)) common-pci.o
33obj-$(CONFIG_IXP4XX_QMGR) += ixp4xx_qmgr.o 35obj-$(CONFIG_IXP4XX_QMGR) += ixp4xx_qmgr.o
diff --git a/arch/arm/mach-ixp4xx/fsg-pci.c b/arch/arm/mach-ixp4xx/fsg-pci.c
new file mode 100644
index 000000000000..f19f3f6feda1
--- /dev/null
+++ b/arch/arm/mach-ixp4xx/fsg-pci.c
@@ -0,0 +1,71 @@
1/*
2 * arch/arch/mach-ixp4xx/fsg-pci.c
3 *
4 * FSG board-level PCI initialization
5 *
6 * Author: Rod Whitby <rod@whitby.id.au>
7 * Maintainer: http://www.nslu2-linux.org/
8 *
9 * based on ixdp425-pci.c:
10 * Copyright (C) 2002 Intel Corporation.
11 * Copyright (C) 2003-2004 MontaVista Software, Inc.
12 *
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License version 2 as
15 * published by the Free Software Foundation.
16 *
17 */
18
19#include <linux/pci.h>
20#include <linux/init.h>
21#include <linux/irq.h>
22
23#include <asm/mach/pci.h>
24#include <asm/mach-types.h>
25
26void __init fsg_pci_preinit(void)
27{
28 set_irq_type(IRQ_FSG_PCI_INTA, IRQT_LOW);
29 set_irq_type(IRQ_FSG_PCI_INTB, IRQT_LOW);
30 set_irq_type(IRQ_FSG_PCI_INTC, IRQT_LOW);
31
32 ixp4xx_pci_preinit();
33}
34
35static int __init fsg_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
36{
37 static int pci_irq_table[FSG_PCI_IRQ_LINES] = {
38 IRQ_FSG_PCI_INTC,
39 IRQ_FSG_PCI_INTB,
40 IRQ_FSG_PCI_INTA,
41 };
42
43 int irq = -1;
44 slot = slot - 11;
45
46 if (slot >= 1 && slot <= FSG_PCI_MAX_DEV &&
47 pin >= 1 && pin <= FSG_PCI_IRQ_LINES)
48 irq = pci_irq_table[(slot - 1)];
49 printk(KERN_INFO "%s: Mapped slot %d pin %d to IRQ %d\n",
50 __func__, slot, pin, irq);
51
52 return irq;
53}
54
55struct hw_pci fsg_pci __initdata = {
56 .nr_controllers = 1,
57 .preinit = fsg_pci_preinit,
58 .swizzle = pci_std_swizzle,
59 .setup = ixp4xx_setup,
60 .scan = ixp4xx_scan_bus,
61 .map_irq = fsg_map_irq,
62};
63
64int __init fsg_pci_init(void)
65{
66 if (machine_is_fsg())
67 pci_common_init(&fsg_pci);
68 return 0;
69}
70
71subsys_initcall(fsg_pci_init);
diff --git a/arch/arm/mach-ixp4xx/fsg-setup.c b/arch/arm/mach-ixp4xx/fsg-setup.c
new file mode 100644
index 000000000000..0db3a909ae61
--- /dev/null
+++ b/arch/arm/mach-ixp4xx/fsg-setup.c
@@ -0,0 +1,276 @@
1/*
2 * arch/arm/mach-ixp4xx/fsg-setup.c
3 *
4 * FSG board-setup
5 *
6 * Copyright (C) 2008 Rod Whitby <rod@whitby.id.au>
7 *
8 * based on ixdp425-setup.c:
9 * Copyright (C) 2003-2004 MontaVista Software, Inc.
10 * based on nslu2-power.c
11 * Copyright (C) 2005 Tower Technologies
12 *
13 * Author: Rod Whitby <rod@whitby.id.au>
14 * Maintainers: http://www.nslu2-linux.org/
15 *
16 */
17
18#include <linux/if_ether.h>
19#include <linux/irq.h>
20#include <linux/serial.h>
21#include <linux/serial_8250.h>
22#include <linux/leds.h>
23#include <linux/reboot.h>
24#include <linux/i2c.h>
25#include <linux/i2c-gpio.h>
26
27#include <asm/mach-types.h>
28#include <asm/mach/arch.h>
29#include <asm/mach/flash.h>
30#include <asm/io.h>
31#include <asm/gpio.h>
32
33static struct flash_platform_data fsg_flash_data = {
34 .map_name = "cfi_probe",
35 .width = 2,
36};
37
38static struct resource fsg_flash_resource = {
39 .flags = IORESOURCE_MEM,
40};
41
42static struct platform_device fsg_flash = {
43 .name = "IXP4XX-Flash",
44 .id = 0,
45 .dev = {
46 .platform_data = &fsg_flash_data,
47 },
48 .num_resources = 1,
49 .resource = &fsg_flash_resource,
50};
51
52static struct i2c_gpio_platform_data fsg_i2c_gpio_data = {
53 .sda_pin = FSG_SDA_PIN,
54 .scl_pin = FSG_SCL_PIN,
55};
56
57static struct platform_device fsg_i2c_gpio = {
58 .name = "i2c-gpio",
59 .id = 0,
60 .dev = {
61 .platform_data = &fsg_i2c_gpio_data,
62 },
63};
64
65static struct i2c_board_info __initdata fsg_i2c_board_info [] = {
66 {
67 I2C_BOARD_INFO("rtc-isl1208", 0x6f),
68 },
69};
70
71static struct resource fsg_uart_resources[] = {
72 {
73 .start = IXP4XX_UART1_BASE_PHYS,
74 .end = IXP4XX_UART1_BASE_PHYS + 0x0fff,
75 .flags = IORESOURCE_MEM,
76 },
77 {
78 .start = IXP4XX_UART2_BASE_PHYS,
79 .end = IXP4XX_UART2_BASE_PHYS + 0x0fff,
80 .flags = IORESOURCE_MEM,
81 }
82};
83
84static struct plat_serial8250_port fsg_uart_data[] = {
85 {
86 .mapbase = IXP4XX_UART1_BASE_PHYS,
87 .membase = (char *)IXP4XX_UART1_BASE_VIRT + REG_OFFSET,
88 .irq = IRQ_IXP4XX_UART1,
89 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
90 .iotype = UPIO_MEM,
91 .regshift = 2,
92 .uartclk = IXP4XX_UART_XTAL,
93 },
94 {
95 .mapbase = IXP4XX_UART2_BASE_PHYS,
96 .membase = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET,
97 .irq = IRQ_IXP4XX_UART2,
98 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
99 .iotype = UPIO_MEM,
100 .regshift = 2,
101 .uartclk = IXP4XX_UART_XTAL,
102 },
103 { }
104};
105
106static struct platform_device fsg_uart = {
107 .name = "serial8250",
108 .id = PLAT8250_DEV_PLATFORM,
109 .dev = {
110 .platform_data = fsg_uart_data,
111 },
112 .num_resources = ARRAY_SIZE(fsg_uart_resources),
113 .resource = fsg_uart_resources,
114};
115
116static struct platform_device fsg_leds = {
117 .name = "fsg-led",
118 .id = -1,
119};
120
121/* Built-in 10/100 Ethernet MAC interfaces */
122static struct eth_plat_info fsg_plat_eth[] = {
123 {
124 .phy = 5,
125 .rxq = 3,
126 .txreadyq = 20,
127 }, {
128 .phy = 4,
129 .rxq = 4,
130 .txreadyq = 21,
131 }
132};
133
134static struct platform_device fsg_eth[] = {
135 {
136 .name = "ixp4xx_eth",
137 .id = IXP4XX_ETH_NPEB,
138 .dev = {
139 .platform_data = fsg_plat_eth,
140 },
141 }, {
142 .name = "ixp4xx_eth",
143 .id = IXP4XX_ETH_NPEC,
144 .dev = {
145 .platform_data = fsg_plat_eth + 1,
146 },
147 }
148};
149
150static struct platform_device *fsg_devices[] __initdata = {
151 &fsg_i2c_gpio,
152 &fsg_flash,
153 &fsg_leds,
154 &fsg_eth[0],
155 &fsg_eth[1],
156};
157
158static irqreturn_t fsg_power_handler(int irq, void *dev_id)
159{
160 /* Signal init to do the ctrlaltdel action, this will bypass init if
161 * it hasn't started and do a kernel_restart.
162 */
163 ctrl_alt_del();
164
165 return IRQ_HANDLED;
166}
167
168static irqreturn_t fsg_reset_handler(int irq, void *dev_id)
169{
170 /* This is the paper-clip reset which does an emergency reboot. */
171 printk(KERN_INFO "Restarting system.\n");
172 machine_restart(NULL);
173
174 /* This should never be reached. */
175 return IRQ_HANDLED;
176}
177
178static void __init fsg_init(void)
179{
180 DECLARE_MAC_BUF(mac_buf);
181 uint8_t __iomem *f;
182 int i;
183
184 ixp4xx_sys_init();
185
186 fsg_flash_resource.start = IXP4XX_EXP_BUS_BASE(0);
187 fsg_flash_resource.end =
188 IXP4XX_EXP_BUS_BASE(0) + ixp4xx_exp_bus_size - 1;
189
190 *IXP4XX_EXP_CS0 |= IXP4XX_FLASH_WRITABLE;
191 *IXP4XX_EXP_CS1 = *IXP4XX_EXP_CS0;
192
193 /* Configure CS2 for operation, 8bit and writable */
194 *IXP4XX_EXP_CS2 = 0xbfff0002;
195
196 i2c_register_board_info(0, fsg_i2c_board_info,
197 ARRAY_SIZE(fsg_i2c_board_info));
198
199 /* This is only useful on a modified machine, but it is valuable
200 * to have it first in order to see debug messages, and so that
201 * it does *not* get removed if platform_add_devices fails!
202 */
203 (void)platform_device_register(&fsg_uart);
204
205 platform_add_devices(fsg_devices, ARRAY_SIZE(fsg_devices));
206
207 if (request_irq(gpio_to_irq(FSG_RB_GPIO), &fsg_reset_handler,
208 IRQF_DISABLED | IRQF_TRIGGER_LOW,
209 "FSG reset button", NULL) < 0) {
210
211 printk(KERN_DEBUG "Reset Button IRQ %d not available\n",
212 gpio_to_irq(FSG_RB_GPIO));
213 }
214
215 if (request_irq(gpio_to_irq(FSG_SB_GPIO), &fsg_power_handler,
216 IRQF_DISABLED | IRQF_TRIGGER_LOW,
217 "FSG power button", NULL) < 0) {
218
219 printk(KERN_DEBUG "Power Button IRQ %d not available\n",
220 gpio_to_irq(FSG_SB_GPIO));
221 }
222
223 /*
224 * Map in a portion of the flash and read the MAC addresses.
225 * Since it is stored in BE in the flash itself, we need to
226 * byteswap it if we're in LE mode.
227 */
228 f = ioremap(IXP4XX_EXP_BUS_BASE(0), 0x400000);
229 if (f) {
230#ifdef __ARMEB__
231 for (i = 0; i < 6; i++) {
232 fsg_plat_eth[0].hwaddr[i] = readb(f + 0x3C0422 + i);
233 fsg_plat_eth[1].hwaddr[i] = readb(f + 0x3C043B + i);
234 }
235#else
236
237 /*
238 Endian-swapped reads from unaligned addresses are
239 required to extract the two MACs from the big-endian
240 Redboot config area in flash.
241 */
242
243 fsg_plat_eth[0].hwaddr[0] = readb(f + 0x3C0421);
244 fsg_plat_eth[0].hwaddr[1] = readb(f + 0x3C0420);
245 fsg_plat_eth[0].hwaddr[2] = readb(f + 0x3C0427);
246 fsg_plat_eth[0].hwaddr[3] = readb(f + 0x3C0426);
247 fsg_plat_eth[0].hwaddr[4] = readb(f + 0x3C0425);
248 fsg_plat_eth[0].hwaddr[5] = readb(f + 0x3C0424);
249
250 fsg_plat_eth[1].hwaddr[0] = readb(f + 0x3C0439);
251 fsg_plat_eth[1].hwaddr[1] = readb(f + 0x3C043F);
252 fsg_plat_eth[1].hwaddr[2] = readb(f + 0x3C043E);
253 fsg_plat_eth[1].hwaddr[3] = readb(f + 0x3C043D);
254 fsg_plat_eth[1].hwaddr[4] = readb(f + 0x3C043C);
255 fsg_plat_eth[1].hwaddr[5] = readb(f + 0x3C0443);
256#endif
257 iounmap(f);
258 }
259 printk(KERN_INFO "FSG: Using MAC address %s for port 0\n",
260 print_mac(mac_buf, fsg_plat_eth[0].hwaddr));
261 printk(KERN_INFO "FSG: Using MAC address %s for port 1\n",
262 print_mac(mac_buf, fsg_plat_eth[1].hwaddr));
263
264}
265
266MACHINE_START(FSG, "Freecom FSG-3")
267 /* Maintainer: www.nslu2-linux.org */
268 .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS,
269 .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc,
270 .map_io = ixp4xx_map_io,
271 .init_irq = ixp4xx_init_irq,
272 .timer = &ixp4xx_timer,
273 .boot_params = 0x0100,
274 .init_machine = fsg_init,
275MACHINE_END
276
diff --git a/arch/arm/mach-kirkwood/Kconfig b/arch/arm/mach-kirkwood/Kconfig
new file mode 100644
index 000000000000..3600cd9f0519
--- /dev/null
+++ b/arch/arm/mach-kirkwood/Kconfig
@@ -0,0 +1,25 @@
1if ARCH_KIRKWOOD
2
3menu "Marvell Kirkwood Implementations"
4
5config MACH_DB88F6281_BP
6 bool "Marvell DB-88F6281-BP Development Board"
7 help
8 Say 'Y' here if you want your kernel to support the
9 Marvell DB-88F6281-BP Development Board.
10
11config MACH_RD88F6192_NAS
12 bool "Marvell RD-88F6192-NAS Reference Board"
13 help
14 Say 'Y' here if you want your kernel to support the
15 Marvell RD-88F6192-NAS Reference Board.
16
17config MACH_RD88F6281
18 bool "Marvell RD-88F6281 Reference Board"
19 help
20 Say 'Y' here if you want your kernel to support the
21 Marvell RD-88F6281 Reference Board.
22
23endmenu
24
25endif
diff --git a/arch/arm/mach-kirkwood/Makefile b/arch/arm/mach-kirkwood/Makefile
new file mode 100644
index 000000000000..e14bf40bfb07
--- /dev/null
+++ b/arch/arm/mach-kirkwood/Makefile
@@ -0,0 +1,5 @@
1obj-y += common.o addr-map.o irq.o pcie.o
2
3obj-$(CONFIG_MACH_DB88F6281_BP) += db88f6281-bp-setup.o
4obj-$(CONFIG_MACH_RD88F6192_NAS) += rd88f6192-nas-setup.o
5obj-$(CONFIG_MACH_RD88F6192_NAS) += rd88f6281-setup.o
diff --git a/arch/arm/mach-kirkwood/Makefile.boot b/arch/arm/mach-kirkwood/Makefile.boot
new file mode 100644
index 000000000000..67039c3e0c48
--- /dev/null
+++ b/arch/arm/mach-kirkwood/Makefile.boot
@@ -0,0 +1,3 @@
1 zreladdr-y := 0x00008000
2params_phys-y := 0x00000100
3initrd_phys-y := 0x00800000
diff --git a/arch/arm/mach-kirkwood/addr-map.c b/arch/arm/mach-kirkwood/addr-map.c
new file mode 100644
index 000000000000..a39f0f3c4730
--- /dev/null
+++ b/arch/arm/mach-kirkwood/addr-map.c
@@ -0,0 +1,139 @@
1/*
2 * arch/arm/mach-kirkwood/addr-map.c
3 *
4 * Address map functions for Marvell Kirkwood SoCs
5 *
6 * This file is licensed under the terms of the GNU General Public
7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied.
9 */
10
11#include <linux/kernel.h>
12#include <linux/init.h>
13#include <linux/mbus.h>
14#include <linux/io.h>
15#include <asm/hardware.h>
16#include "common.h"
17
18/*
19 * Generic Address Decode Windows bit settings
20 */
21#define TARGET_DDR 0
22#define TARGET_DEV_BUS 1
23#define TARGET_PCIE 4
24#define ATTR_DEV_SPI_ROM 0x1e
25#define ATTR_DEV_BOOT 0x1d
26#define ATTR_DEV_NAND 0x2f
27#define ATTR_DEV_CS3 0x37
28#define ATTR_DEV_CS2 0x3b
29#define ATTR_DEV_CS1 0x3d
30#define ATTR_DEV_CS0 0x3e
31#define ATTR_PCIE_IO 0xe0
32#define ATTR_PCIE_MEM 0xe8
33
34/*
35 * Helpers to get DDR bank info
36 */
37#define DDR_BASE_CS_OFF(n) (0x0000 + ((n) << 3))
38#define DDR_SIZE_CS_OFF(n) (0x0004 + ((n) << 3))
39
40/*
41 * CPU Address Decode Windows registers
42 */
43#define WIN_OFF(n) (BRIDGE_VIRT_BASE + 0x0000 + ((n) << 4))
44#define WIN_CTRL_OFF 0x0000
45#define WIN_BASE_OFF 0x0004
46#define WIN_REMAP_LO_OFF 0x0008
47#define WIN_REMAP_HI_OFF 0x000c
48
49
50struct mbus_dram_target_info kirkwood_mbus_dram_info;
51
52static int __init cpu_win_can_remap(int win)
53{
54 if (win < 4)
55 return 1;
56
57 return 0;
58}
59
60static void __init setup_cpu_win(int win, u32 base, u32 size,
61 u8 target, u8 attr, int remap)
62{
63 void __iomem *addr = (void __iomem *)WIN_OFF(win);
64 u32 ctrl;
65
66 base &= 0xffff0000;
67 ctrl = ((size - 1) & 0xffff0000) | (attr << 8) | (target << 4) | 1;
68
69 writel(base, addr + WIN_BASE_OFF);
70 writel(ctrl, addr + WIN_CTRL_OFF);
71 if (cpu_win_can_remap(win)) {
72 if (remap < 0)
73 remap = base;
74
75 writel(remap & 0xffff0000, addr + WIN_REMAP_LO_OFF);
76 writel(0, addr + WIN_REMAP_HI_OFF);
77 }
78}
79
80void __init kirkwood_setup_cpu_mbus(void)
81{
82 void __iomem *addr;
83 int i;
84 int cs;
85
86 /*
87 * First, disable and clear windows.
88 */
89 for (i = 0; i < 8; i++) {
90 addr = (void __iomem *)WIN_OFF(i);
91
92 writel(0, addr + WIN_BASE_OFF);
93 writel(0, addr + WIN_CTRL_OFF);
94 if (cpu_win_can_remap(i)) {
95 writel(0, addr + WIN_REMAP_LO_OFF);
96 writel(0, addr + WIN_REMAP_HI_OFF);
97 }
98 }
99
100 /*
101 * Setup windows for PCIe IO+MEM space.
102 */
103 setup_cpu_win(0, KIRKWOOD_PCIE_IO_PHYS_BASE, KIRKWOOD_PCIE_IO_SIZE,
104 TARGET_PCIE, ATTR_PCIE_IO, KIRKWOOD_PCIE_IO_BUS_BASE);
105 setup_cpu_win(1, KIRKWOOD_PCIE_MEM_PHYS_BASE, KIRKWOOD_PCIE_MEM_SIZE,
106 TARGET_PCIE, ATTR_PCIE_MEM, -1);
107
108 /*
109 * Setup window for NAND controller.
110 */
111 setup_cpu_win(2, KIRKWOOD_NAND_MEM_PHYS_BASE, KIRKWOOD_NAND_MEM_SIZE,
112 TARGET_DEV_BUS, ATTR_DEV_NAND, -1);
113
114 /*
115 * Setup MBUS dram target info.
116 */
117 kirkwood_mbus_dram_info.mbus_dram_target_id = TARGET_DDR;
118
119 addr = (void __iomem *)DDR_WINDOW_CPU_BASE;
120
121 for (i = 0, cs = 0; i < 4; i++) {
122 u32 base = readl(addr + DDR_BASE_CS_OFF(i));
123 u32 size = readl(addr + DDR_SIZE_CS_OFF(i));
124
125 /*
126 * Chip select enabled?
127 */
128 if (size & 1) {
129 struct mbus_dram_window *w;
130
131 w = &kirkwood_mbus_dram_info.cs[cs++];
132 w->cs_index = i;
133 w->mbus_attr = 0xf & ~(1 << i);
134 w->base = base & 0xffff0000;
135 w->size = (size | 0x0000ffff) + 1;
136 }
137 }
138 kirkwood_mbus_dram_info.num_cs = cs;
139}
diff --git a/arch/arm/mach-kirkwood/common.c b/arch/arm/mach-kirkwood/common.c
new file mode 100644
index 000000000000..5938a3b33cdc
--- /dev/null
+++ b/arch/arm/mach-kirkwood/common.c
@@ -0,0 +1,331 @@
1/*
2 * arch/arm/mach-kirkwood/common.c
3 *
4 * Core functions for Marvell Kirkwood SoCs
5 *
6 * This file is licensed under the terms of the GNU General Public
7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied.
9 */
10
11#include <linux/kernel.h>
12#include <linux/init.h>
13#include <linux/platform_device.h>
14#include <linux/serial_8250.h>
15#include <linux/mbus.h>
16#include <linux/mv643xx_eth.h>
17#include <linux/ata_platform.h>
18#include <asm/page.h>
19#include <asm/timex.h>
20#include <asm/mach/map.h>
21#include <asm/mach/time.h>
22#include <asm/arch/kirkwood.h>
23#include <asm/plat-orion/cache-feroceon-l2.h>
24#include <asm/plat-orion/ehci-orion.h>
25#include <asm/plat-orion/orion_nand.h>
26#include <asm/plat-orion/time.h>
27#include "common.h"
28
29/*****************************************************************************
30 * I/O Address Mapping
31 ****************************************************************************/
32static struct map_desc kirkwood_io_desc[] __initdata = {
33 {
34 .virtual = KIRKWOOD_PCIE_IO_VIRT_BASE,
35 .pfn = __phys_to_pfn(KIRKWOOD_PCIE_IO_PHYS_BASE),
36 .length = KIRKWOOD_PCIE_IO_SIZE,
37 .type = MT_DEVICE,
38 }, {
39 .virtual = KIRKWOOD_REGS_VIRT_BASE,
40 .pfn = __phys_to_pfn(KIRKWOOD_REGS_PHYS_BASE),
41 .length = KIRKWOOD_REGS_SIZE,
42 .type = MT_DEVICE,
43 },
44};
45
46void __init kirkwood_map_io(void)
47{
48 iotable_init(kirkwood_io_desc, ARRAY_SIZE(kirkwood_io_desc));
49}
50
51
52/*****************************************************************************
53 * EHCI
54 ****************************************************************************/
55static struct orion_ehci_data kirkwood_ehci_data = {
56 .dram = &kirkwood_mbus_dram_info,
57};
58
59static u64 ehci_dmamask = 0xffffffffUL;
60
61
62/*****************************************************************************
63 * EHCI0
64 ****************************************************************************/
65static struct resource kirkwood_ehci_resources[] = {
66 {
67 .start = USB_PHYS_BASE,
68 .end = USB_PHYS_BASE + 0x0fff,
69 .flags = IORESOURCE_MEM,
70 }, {
71 .start = IRQ_KIRKWOOD_USB,
72 .end = IRQ_KIRKWOOD_USB,
73 .flags = IORESOURCE_IRQ,
74 },
75};
76
77static struct platform_device kirkwood_ehci = {
78 .name = "orion-ehci",
79 .id = 0,
80 .dev = {
81 .dma_mask = &ehci_dmamask,
82 .coherent_dma_mask = 0xffffffff,
83 .platform_data = &kirkwood_ehci_data,
84 },
85 .resource = kirkwood_ehci_resources,
86 .num_resources = ARRAY_SIZE(kirkwood_ehci_resources),
87};
88
89void __init kirkwood_ehci_init(void)
90{
91 platform_device_register(&kirkwood_ehci);
92}
93
94
95/*****************************************************************************
96 * GE00
97 ****************************************************************************/
98struct mv643xx_eth_shared_platform_data kirkwood_ge00_shared_data = {
99 .t_clk = KIRKWOOD_TCLK,
100 .dram = &kirkwood_mbus_dram_info,
101};
102
103static struct resource kirkwood_ge00_shared_resources[] = {
104 {
105 .name = "ge00 base",
106 .start = GE00_PHYS_BASE + 0x2000,
107 .end = GE00_PHYS_BASE + 0x3fff,
108 .flags = IORESOURCE_MEM,
109 },
110};
111
112static struct platform_device kirkwood_ge00_shared = {
113 .name = MV643XX_ETH_SHARED_NAME,
114 .id = 0,
115 .dev = {
116 .platform_data = &kirkwood_ge00_shared_data,
117 },
118 .num_resources = 1,
119 .resource = kirkwood_ge00_shared_resources,
120};
121
122static struct resource kirkwood_ge00_resources[] = {
123 {
124 .name = "ge00 irq",
125 .start = IRQ_KIRKWOOD_GE00_SUM,
126 .end = IRQ_KIRKWOOD_GE00_SUM,
127 .flags = IORESOURCE_IRQ,
128 },
129};
130
131static struct platform_device kirkwood_ge00 = {
132 .name = MV643XX_ETH_NAME,
133 .id = 0,
134 .num_resources = 1,
135 .resource = kirkwood_ge00_resources,
136};
137
138void __init kirkwood_ge00_init(struct mv643xx_eth_platform_data *eth_data)
139{
140 eth_data->shared = &kirkwood_ge00_shared;
141 kirkwood_ge00.dev.platform_data = eth_data;
142
143 platform_device_register(&kirkwood_ge00_shared);
144 platform_device_register(&kirkwood_ge00);
145}
146
147
148/*****************************************************************************
149 * SoC RTC
150 ****************************************************************************/
151static struct resource kirkwood_rtc_resource = {
152 .start = RTC_PHYS_BASE,
153 .end = RTC_PHYS_BASE + SZ_16 - 1,
154 .flags = IORESOURCE_MEM,
155};
156
157void __init kirkwood_rtc_init(void)
158{
159 platform_device_register_simple("rtc-mv", -1, &kirkwood_rtc_resource, 1);
160}
161
162
163/*****************************************************************************
164 * SATA
165 ****************************************************************************/
166static struct resource kirkwood_sata_resources[] = {
167 {
168 .name = "sata base",
169 .start = SATA_PHYS_BASE,
170 .end = SATA_PHYS_BASE + 0x5000 - 1,
171 .flags = IORESOURCE_MEM,
172 }, {
173 .name = "sata irq",
174 .start = IRQ_KIRKWOOD_SATA,
175 .end = IRQ_KIRKWOOD_SATA,
176 .flags = IORESOURCE_IRQ,
177 },
178};
179
180static struct platform_device kirkwood_sata = {
181 .name = "sata_mv",
182 .id = 0,
183 .dev = {
184 .coherent_dma_mask = 0xffffffff,
185 },
186 .num_resources = ARRAY_SIZE(kirkwood_sata_resources),
187 .resource = kirkwood_sata_resources,
188};
189
190void __init kirkwood_sata_init(struct mv_sata_platform_data *sata_data)
191{
192 sata_data->dram = &kirkwood_mbus_dram_info;
193 kirkwood_sata.dev.platform_data = sata_data;
194 platform_device_register(&kirkwood_sata);
195}
196
197
198/*****************************************************************************
199 * UART0
200 ****************************************************************************/
201static struct plat_serial8250_port kirkwood_uart0_data[] = {
202 {
203 .mapbase = UART0_PHYS_BASE,
204 .membase = (char *)UART0_VIRT_BASE,
205 .irq = IRQ_KIRKWOOD_UART_0,
206 .flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF,
207 .iotype = UPIO_MEM,
208 .regshift = 2,
209 .uartclk = KIRKWOOD_TCLK,
210 }, {
211 },
212};
213
214static struct resource kirkwood_uart0_resources[] = {
215 {
216 .start = UART0_PHYS_BASE,
217 .end = UART0_PHYS_BASE + 0xff,
218 .flags = IORESOURCE_MEM,
219 }, {
220 .start = IRQ_KIRKWOOD_UART_0,
221 .end = IRQ_KIRKWOOD_UART_0,
222 .flags = IORESOURCE_IRQ,
223 },
224};
225
226static struct platform_device kirkwood_uart0 = {
227 .name = "serial8250",
228 .id = 0,
229 .dev = {
230 .platform_data = kirkwood_uart0_data,
231 },
232 .resource = kirkwood_uart0_resources,
233 .num_resources = ARRAY_SIZE(kirkwood_uart0_resources),
234};
235
236void __init kirkwood_uart0_init(void)
237{
238 platform_device_register(&kirkwood_uart0);
239}
240
241
242/*****************************************************************************
243 * UART1
244 ****************************************************************************/
245static struct plat_serial8250_port kirkwood_uart1_data[] = {
246 {
247 .mapbase = UART1_PHYS_BASE,
248 .membase = (char *)UART1_VIRT_BASE,
249 .irq = IRQ_KIRKWOOD_UART_1,
250 .flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF,
251 .iotype = UPIO_MEM,
252 .regshift = 2,
253 .uartclk = KIRKWOOD_TCLK,
254 }, {
255 },
256};
257
258static struct resource kirkwood_uart1_resources[] = {
259 {
260 .start = UART1_PHYS_BASE,
261 .end = UART1_PHYS_BASE + 0xff,
262 .flags = IORESOURCE_MEM,
263 }, {
264 .start = IRQ_KIRKWOOD_UART_1,
265 .end = IRQ_KIRKWOOD_UART_1,
266 .flags = IORESOURCE_IRQ,
267 },
268};
269
270static struct platform_device kirkwood_uart1 = {
271 .name = "serial8250",
272 .id = 1,
273 .dev = {
274 .platform_data = kirkwood_uart1_data,
275 },
276 .resource = kirkwood_uart1_resources,
277 .num_resources = ARRAY_SIZE(kirkwood_uart1_resources),
278};
279
280void __init kirkwood_uart1_init(void)
281{
282 platform_device_register(&kirkwood_uart1);
283}
284
285
286/*****************************************************************************
287 * Time handling
288 ****************************************************************************/
289static void kirkwood_timer_init(void)
290{
291 orion_time_init(IRQ_KIRKWOOD_BRIDGE, KIRKWOOD_TCLK);
292}
293
294struct sys_timer kirkwood_timer = {
295 .init = kirkwood_timer_init,
296};
297
298
299/*****************************************************************************
300 * General
301 ****************************************************************************/
302static char * __init kirkwood_id(void)
303{
304 switch (readl(DEVICE_ID) & 0x3) {
305 case 0:
306 return "88F6180";
307 case 1:
308 return "88F6192";
309 case 2:
310 return "88F6281";
311 }
312
313 return "unknown 88F6000 variant";
314}
315
316static int __init is_l2_writethrough(void)
317{
318 return !!(readl(L2_CONFIG_REG) & L2_WRITETHROUGH);
319}
320
321void __init kirkwood_init(void)
322{
323 printk(KERN_INFO "Kirkwood: %s, TCLK=%d.\n",
324 kirkwood_id(), KIRKWOOD_TCLK);
325
326 kirkwood_setup_cpu_mbus();
327
328#ifdef CONFIG_CACHE_FEROCEON_L2
329 feroceon_l2_init(is_l2_writethrough());
330#endif
331}
diff --git a/arch/arm/mach-kirkwood/common.h b/arch/arm/mach-kirkwood/common.h
new file mode 100644
index 000000000000..5dee2f6b40a5
--- /dev/null
+++ b/arch/arm/mach-kirkwood/common.h
@@ -0,0 +1,42 @@
1/*
2 * arch/arm/mach-kirkwood/common.h
3 *
4 * Core functions for Marvell Kirkwood SoCs
5 *
6 * This file is licensed under the terms of the GNU General Public
7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied.
9 */
10
11#ifndef __ARCH_KIRKWOOD_COMMON_H
12#define __ARCH_KIRKWOOD_COMMON_H
13
14struct mv643xx_eth_platform_data;
15struct mv_sata_platform_data;
16
17/*
18 * Basic Kirkwood init functions used early by machine-setup.
19 */
20void kirkwood_map_io(void);
21void kirkwood_init(void);
22void kirkwood_init_irq(void);
23
24extern struct mbus_dram_target_info kirkwood_mbus_dram_info;
25void kirkwood_setup_cpu_mbus(void);
26void kirkwood_setup_pcie_io_win(int window, u32 base, u32 size,
27 int maj, int min);
28void kirkwood_setup_pcie_mem_win(int window, u32 base, u32 size,
29 int maj, int min);
30
31void kirkwood_ehci_init(void);
32void kirkwood_ge00_init(struct mv643xx_eth_platform_data *eth_data);
33void kirkwood_pcie_init(void);
34void kirkwood_rtc_init(void);
35void kirkwood_sata_init(struct mv_sata_platform_data *sata_data);
36void kirkwood_uart0_init(void);
37void kirkwood_uart1_init(void);
38
39extern struct sys_timer kirkwood_timer;
40
41
42#endif
diff --git a/arch/arm/mach-kirkwood/db88f6281-bp-setup.c b/arch/arm/mach-kirkwood/db88f6281-bp-setup.c
new file mode 100644
index 000000000000..d5c482c628e3
--- /dev/null
+++ b/arch/arm/mach-kirkwood/db88f6281-bp-setup.c
@@ -0,0 +1,68 @@
1/*
2 * arch/arm/mach-kirkwood/db88f6281-bp-setup.c
3 *
4 * Marvell DB-88F6281-BP Development Board Setup
5 *
6 * This file is licensed under the terms of the GNU General Public
7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied.
9 */
10
11#include <linux/kernel.h>
12#include <linux/init.h>
13#include <linux/platform_device.h>
14#include <linux/pci.h>
15#include <linux/irq.h>
16#include <linux/mtd/physmap.h>
17#include <linux/mtd/nand.h>
18#include <linux/timer.h>
19#include <linux/ata_platform.h>
20#include <linux/mv643xx_eth.h>
21#include <asm/mach-types.h>
22#include <asm/mach/arch.h>
23#include <asm/mach/pci.h>
24#include <asm/arch/kirkwood.h>
25#include "common.h"
26
27static struct mv643xx_eth_platform_data db88f6281_ge00_data = {
28 .phy_addr = 8,
29};
30
31static struct mv_sata_platform_data db88f6281_sata_data = {
32 .n_ports = 2,
33};
34
35static void __init db88f6281_init(void)
36{
37 /*
38 * Basic setup. Needs to be called early.
39 */
40 kirkwood_init();
41
42 kirkwood_ehci_init();
43 kirkwood_ge00_init(&db88f6281_ge00_data);
44 kirkwood_rtc_init();
45 kirkwood_sata_init(&db88f6281_sata_data);
46 kirkwood_uart0_init();
47 kirkwood_uart1_init();
48}
49
50static int __init db88f6281_pci_init(void)
51{
52 if (machine_is_db88f6281_bp())
53 kirkwood_pcie_init();
54
55 return 0;
56}
57subsys_initcall(db88f6281_pci_init);
58
59MACHINE_START(DB88F6281_BP, "Marvell DB-88F6281-BP Development Board")
60 /* Maintainer: Saeed Bishara <saeed@marvell.com> */
61 .phys_io = KIRKWOOD_REGS_PHYS_BASE,
62 .io_pg_offst = ((KIRKWOOD_REGS_VIRT_BASE) >> 18) & 0xfffc,
63 .boot_params = 0x00000100,
64 .init_machine = db88f6281_init,
65 .map_io = kirkwood_map_io,
66 .init_irq = kirkwood_init_irq,
67 .timer = &kirkwood_timer,
68MACHINE_END
diff --git a/arch/arm/mach-kirkwood/irq.c b/arch/arm/mach-kirkwood/irq.c
new file mode 100644
index 000000000000..302bb2cf6669
--- /dev/null
+++ b/arch/arm/mach-kirkwood/irq.c
@@ -0,0 +1,22 @@
1/*
2 * arch/arm/mach-kirkwood/irq.c
3 *
4 * Kirkwood IRQ handling.
5 *
6 * This file is licensed under the terms of the GNU General Public
7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied.
9 */
10
11#include <linux/kernel.h>
12#include <linux/init.h>
13#include <linux/irq.h>
14#include <linux/io.h>
15#include <asm/plat-orion/irq.h>
16#include "common.h"
17
18void __init kirkwood_init_irq(void)
19{
20 orion_irq_init(0, (void __iomem *)(IRQ_VIRT_BASE + IRQ_MASK_LOW_OFF));
21 orion_irq_init(32, (void __iomem *)(IRQ_VIRT_BASE + IRQ_MASK_HIGH_OFF));
22}
diff --git a/arch/arm/mach-kirkwood/pcie.c b/arch/arm/mach-kirkwood/pcie.c
new file mode 100644
index 000000000000..8282d0ff84bf
--- /dev/null
+++ b/arch/arm/mach-kirkwood/pcie.c
@@ -0,0 +1,180 @@
1/*
2 * arch/arm/mach-kirkwood/pcie.c
3 *
4 * PCIe functions for Marvell Kirkwood SoCs
5 *
6 * This file is licensed under the terms of the GNU General Public
7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied.
9 */
10
11#include <linux/kernel.h>
12#include <linux/pci.h>
13#include <linux/mbus.h>
14#include <asm/mach/pci.h>
15#include <asm/plat-orion/pcie.h>
16#include "common.h"
17
18
19#define PCIE_BASE ((void __iomem *)PCIE_VIRT_BASE)
20
21static int pcie_valid_config(int bus, int dev)
22{
23 /*
24 * Don't go out when trying to access --
25 * 1. nonexisting device on local bus
26 * 2. where there's no device connected (no link)
27 */
28 if (bus == 0 && dev == 0)
29 return 1;
30
31 if (!orion_pcie_link_up(PCIE_BASE))
32 return 0;
33
34 if (bus == 0 && dev != 1)
35 return 0;
36
37 return 1;
38}
39
40
41/*
42 * PCIe config cycles are done by programming the PCIE_CONF_ADDR register
43 * and then reading the PCIE_CONF_DATA register. Need to make sure these
44 * transactions are atomic.
45 */
46static DEFINE_SPINLOCK(kirkwood_pcie_lock);
47
48static int pcie_rd_conf(struct pci_bus *bus, u32 devfn, int where,
49 int size, u32 *val)
50{
51 unsigned long flags;
52 int ret;
53
54 if (pcie_valid_config(bus->number, PCI_SLOT(devfn)) == 0) {
55 *val = 0xffffffff;
56 return PCIBIOS_DEVICE_NOT_FOUND;
57 }
58
59 spin_lock_irqsave(&kirkwood_pcie_lock, flags);
60 ret = orion_pcie_rd_conf(PCIE_BASE, bus, devfn, where, size, val);
61 spin_unlock_irqrestore(&kirkwood_pcie_lock, flags);
62
63 return ret;
64}
65
66static int pcie_wr_conf(struct pci_bus *bus, u32 devfn,
67 int where, int size, u32 val)
68{
69 unsigned long flags;
70 int ret;
71
72 if (pcie_valid_config(bus->number, PCI_SLOT(devfn)) == 0)
73 return PCIBIOS_DEVICE_NOT_FOUND;
74
75 spin_lock_irqsave(&kirkwood_pcie_lock, flags);
76 ret = orion_pcie_wr_conf(PCIE_BASE, bus, devfn, where, size, val);
77 spin_unlock_irqrestore(&kirkwood_pcie_lock, flags);
78
79 return ret;
80}
81
82static struct pci_ops pcie_ops = {
83 .read = pcie_rd_conf,
84 .write = pcie_wr_conf,
85};
86
87
88static int kirkwood_pcie_setup(int nr, struct pci_sys_data *sys)
89{
90 struct resource *res;
91
92 /*
93 * Generic PCIe unit setup.
94 */
95 orion_pcie_setup(PCIE_BASE, &kirkwood_mbus_dram_info);
96
97 /*
98 * Request resources.
99 */
100 res = kzalloc(sizeof(struct resource) * 2, GFP_KERNEL);
101 if (!res)
102 panic("pcie_setup unable to alloc resources");
103
104 /*
105 * IORESOURCE_IO
106 */
107 res[0].name = "PCIe I/O Space";
108 res[0].flags = IORESOURCE_IO;
109 res[0].start = KIRKWOOD_PCIE_IO_PHYS_BASE;
110 res[0].end = res[0].start + KIRKWOOD_PCIE_IO_SIZE - 1;
111 if (request_resource(&ioport_resource, &res[0]))
112 panic("Request PCIe IO resource failed\n");
113 sys->resource[0] = &res[0];
114
115 /*
116 * IORESOURCE_MEM
117 */
118 res[1].name = "PCIe Memory Space";
119 res[1].flags = IORESOURCE_MEM;
120 res[1].start = KIRKWOOD_PCIE_MEM_PHYS_BASE;
121 res[1].end = res[1].start + KIRKWOOD_PCIE_MEM_SIZE - 1;
122 if (request_resource(&iomem_resource, &res[1]))
123 panic("Request PCIe Memory resource failed\n");
124 sys->resource[1] = &res[1];
125
126 sys->resource[2] = NULL;
127 sys->io_offset = 0;
128
129 return 1;
130}
131
132static void __devinit rc_pci_fixup(struct pci_dev *dev)
133{
134 /*
135 * Prevent enumeration of root complex.
136 */
137 if (dev->bus->parent == NULL && dev->devfn == 0) {
138 int i;
139
140 for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) {
141 dev->resource[i].start = 0;
142 dev->resource[i].end = 0;
143 dev->resource[i].flags = 0;
144 }
145 }
146}
147DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_MARVELL, PCI_ANY_ID, rc_pci_fixup);
148
149static struct pci_bus __init *
150kirkwood_pcie_scan_bus(int nr, struct pci_sys_data *sys)
151{
152 struct pci_bus *bus;
153
154 if (nr == 0) {
155 bus = pci_scan_bus(sys->busnr, &pcie_ops, sys);
156 } else {
157 bus = NULL;
158 BUG();
159 }
160
161 return bus;
162}
163
164static int __init kirkwood_pcie_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
165{
166 return IRQ_KIRKWOOD_PCIE;
167}
168
169static struct hw_pci kirkwood_pci __initdata = {
170 .nr_controllers = 1,
171 .swizzle = pci_std_swizzle,
172 .setup = kirkwood_pcie_setup,
173 .scan = kirkwood_pcie_scan_bus,
174 .map_irq = kirkwood_pcie_map_irq,
175};
176
177void __init kirkwood_pcie_init(void)
178{
179 pci_common_init(&kirkwood_pci);
180}
diff --git a/arch/arm/mach-kirkwood/rd88f6192-nas-setup.c b/arch/arm/mach-kirkwood/rd88f6192-nas-setup.c
new file mode 100644
index 000000000000..6cf642c504d3
--- /dev/null
+++ b/arch/arm/mach-kirkwood/rd88f6192-nas-setup.c
@@ -0,0 +1,69 @@
1/*
2 * arch/arm/mach-kirkwood/rd88f6192-nas-setup.c
3 *
4 * Marvell RD-88F6192-NAS Reference Board Setup
5 *
6 * This file is licensed under the terms of the GNU General Public
7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied.
9 */
10
11#include <linux/kernel.h>
12#include <linux/init.h>
13#include <linux/platform_device.h>
14#include <linux/pci.h>
15#include <linux/irq.h>
16#include <linux/mtd/physmap.h>
17#include <linux/mtd/nand.h>
18#include <linux/timer.h>
19#include <linux/ata_platform.h>
20#include <linux/mv643xx_eth.h>
21#include <asm/mach-types.h>
22#include <asm/mach/arch.h>
23#include <asm/mach/pci.h>
24#include <asm/arch/kirkwood.h>
25#include "common.h"
26
27#define RD88F6192_GPIO_USB_VBUS 10
28
29static struct mv643xx_eth_platform_data rd88f6192_ge00_data = {
30 .phy_addr = 8,
31};
32
33static struct mv_sata_platform_data rd88f6192_sata_data = {
34 .n_ports = 2,
35};
36
37static void __init rd88f6192_init(void)
38{
39 /*
40 * Basic setup. Needs to be called early.
41 */
42 kirkwood_init();
43
44 kirkwood_ehci_init();
45 kirkwood_ge00_init(&rd88f6192_ge00_data);
46 kirkwood_rtc_init();
47 kirkwood_sata_init(&rd88f6192_sata_data);
48 kirkwood_uart0_init();
49}
50
51static int __init rd88f6192_pci_init(void)
52{
53 if (machine_is_rd88f6192_nas())
54 kirkwood_pcie_init();
55
56 return 0;
57}
58subsys_initcall(rd88f6192_pci_init);
59
60MACHINE_START(RD88F6192_NAS, "Marvell RD-88F6192-NAS Development Board")
61 /* Maintainer: Saeed Bishara <saeed@marvell.com> */
62 .phys_io = KIRKWOOD_REGS_PHYS_BASE,
63 .io_pg_offst = ((KIRKWOOD_REGS_VIRT_BASE) >> 18) & 0xfffc,
64 .boot_params = 0x00000100,
65 .init_machine = rd88f6192_init,
66 .map_io = kirkwood_map_io,
67 .init_irq = kirkwood_init_irq,
68 .timer = &kirkwood_timer,
69MACHINE_END
diff --git a/arch/arm/mach-kirkwood/rd88f6281-setup.c b/arch/arm/mach-kirkwood/rd88f6281-setup.c
new file mode 100644
index 000000000000..e1f8de2c74a2
--- /dev/null
+++ b/arch/arm/mach-kirkwood/rd88f6281-setup.c
@@ -0,0 +1,113 @@
1/*
2 * arch/arm/mach-kirkwood/rd88f6281-setup.c
3 *
4 * Marvell RD-88F6281 Reference Board Setup
5 *
6 * This file is licensed under the terms of the GNU General Public
7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied.
9 */
10
11#include <linux/kernel.h>
12#include <linux/init.h>
13#include <linux/platform_device.h>
14#include <linux/pci.h>
15#include <linux/irq.h>
16#include <linux/mtd/physmap.h>
17#include <linux/mtd/nand.h>
18#include <linux/timer.h>
19#include <linux/ata_platform.h>
20#include <linux/mv643xx_eth.h>
21#include <asm/mach-types.h>
22#include <asm/mach/arch.h>
23#include <asm/mach/pci.h>
24#include <asm/arch/kirkwood.h>
25#include <asm/plat-orion/orion_nand.h>
26#include "common.h"
27
28static struct mtd_partition rd88f6281_nand_parts[] = {
29 {
30 .name = "u-boot",
31 .offset = 0,
32 .size = SZ_1M
33 }, {
34 .name = "uImage",
35 .offset = MTDPART_OFS_NXTBLK,
36 .size = SZ_2M
37 }, {
38 .name = "root",
39 .offset = MTDPART_OFS_NXTBLK,
40 .size = MTDPART_SIZ_FULL
41 },
42};
43
44static struct resource rd88f6281_nand_resource = {
45 .flags = IORESOURCE_MEM,
46 .start = KIRKWOOD_NAND_MEM_PHYS_BASE,
47 .end = KIRKWOOD_NAND_MEM_PHYS_BASE +
48 KIRKWOOD_NAND_MEM_SIZE - 1,
49};
50
51static struct orion_nand_data rd88f6281_nand_data = {
52 .parts = rd88f6281_nand_parts,
53 .nr_parts = ARRAY_SIZE(rd88f6281_nand_parts),
54 .cle = 0,
55 .ale = 1,
56 .width = 8,
57 .chip_delay = 25,
58};
59
60static struct platform_device rd88f6281_nand_flash = {
61 .name = "orion_nand",
62 .id = -1,
63 .dev = {
64 .platform_data = &rd88f6281_nand_data,
65 },
66 .resource = &rd88f6281_nand_resource,
67 .num_resources = 1,
68};
69
70static struct mv643xx_eth_platform_data rd88f6281_ge00_data = {
71 .phy_addr = -1,
72};
73
74static struct mv_sata_platform_data rd88f6281_sata_data = {
75 .n_ports = 2,
76};
77
78static void __init rd88f6281_init(void)
79{
80 /*
81 * Basic setup. Needs to be called early.
82 */
83 kirkwood_init();
84
85 kirkwood_ehci_init();
86 kirkwood_ge00_init(&rd88f6281_ge00_data);
87 kirkwood_rtc_init();
88 kirkwood_sata_init(&rd88f6281_sata_data);
89 kirkwood_uart0_init();
90 kirkwood_uart1_init();
91
92 platform_device_register(&rd88f6281_nand_flash);
93}
94
95static int __init rd88f6281_pci_init(void)
96{
97 if (machine_is_rd88f6281())
98 kirkwood_pcie_init();
99
100 return 0;
101}
102subsys_initcall(rd88f6281_pci_init);
103
104MACHINE_START(RD88F6281, "Marvell RD-88F6281 Reference Board")
105 /* Maintainer: Saeed Bishara <saeed@marvell.com> */
106 .phys_io = KIRKWOOD_REGS_PHYS_BASE,
107 .io_pg_offst = ((KIRKWOOD_REGS_VIRT_BASE) >> 18) & 0xfffc,
108 .boot_params = 0x00000100,
109 .init_machine = rd88f6281_init,
110 .map_io = kirkwood_map_io,
111 .init_irq = kirkwood_init_irq,
112 .timer = &kirkwood_timer,
113MACHINE_END
diff --git a/arch/arm/mach-loki/Kconfig b/arch/arm/mach-loki/Kconfig
new file mode 100644
index 000000000000..0045bdd761ca
--- /dev/null
+++ b/arch/arm/mach-loki/Kconfig
@@ -0,0 +1,13 @@
1if ARCH_LOKI
2
3menu "Marvell Loki (88RC8480) Implementations"
4
5config MACH_LB88RC8480
6 bool "Marvell LB88RC8480 Development Board"
7 help
8 Say 'Y' here if you want your kernel to support the
9 Marvell LB88RC8480 Development Board.
10
11endmenu
12
13endif
diff --git a/arch/arm/mach-loki/Makefile b/arch/arm/mach-loki/Makefile
new file mode 100644
index 000000000000..d43233ee590f
--- /dev/null
+++ b/arch/arm/mach-loki/Makefile
@@ -0,0 +1,3 @@
1obj-y += common.o addr-map.o irq.o
2
3obj-$(CONFIG_MACH_LB88RC8480) += lb88rc8480-setup.o
diff --git a/arch/arm/mach-loki/Makefile.boot b/arch/arm/mach-loki/Makefile.boot
new file mode 100644
index 000000000000..67039c3e0c48
--- /dev/null
+++ b/arch/arm/mach-loki/Makefile.boot
@@ -0,0 +1,3 @@
1 zreladdr-y := 0x00008000
2params_phys-y := 0x00000100
3initrd_phys-y := 0x00800000
diff --git a/arch/arm/mach-loki/addr-map.c b/arch/arm/mach-loki/addr-map.c
new file mode 100644
index 000000000000..ba25e56ade58
--- /dev/null
+++ b/arch/arm/mach-loki/addr-map.c
@@ -0,0 +1,121 @@
1/*
2 * arch/arm/mach-loki/addr-map.c
3 *
4 * Address map functions for Marvell Loki (88RC8480) SoCs
5 *
6 * This file is licensed under the terms of the GNU General Public
7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied.
9 */
10
11#include <linux/kernel.h>
12#include <linux/init.h>
13#include <linux/mbus.h>
14#include <asm/hardware.h>
15#include <asm/io.h>
16#include "common.h"
17
18/*
19 * Generic Address Decode Windows bit settings
20 */
21#define TARGET_DDR 0
22#define TARGET_DEV_BUS 1
23#define TARGET_PCIE0 3
24#define TARGET_PCIE1 4
25#define ATTR_DEV_BOOT 0x0f
26#define ATTR_DEV_CS2 0x1b
27#define ATTR_DEV_CS1 0x1d
28#define ATTR_DEV_CS0 0x1e
29#define ATTR_PCIE_IO 0x51
30#define ATTR_PCIE_MEM 0x59
31
32/*
33 * Helpers to get DDR bank info
34 */
35#define DDR_SIZE_CS(n) DDR_REG(0x1500 + ((n) << 3))
36#define DDR_BASE_CS(n) DDR_REG(0x1504 + ((n) << 3))
37
38/*
39 * CPU Address Decode Windows registers
40 */
41#define CPU_WIN_CTRL(n) BRIDGE_REG(0x000 | ((n) << 4))
42#define CPU_WIN_BASE(n) BRIDGE_REG(0x004 | ((n) << 4))
43#define CPU_WIN_REMAP_LO(n) BRIDGE_REG(0x008 | ((n) << 4))
44#define CPU_WIN_REMAP_HI(n) BRIDGE_REG(0x00c | ((n) << 4))
45
46
47struct mbus_dram_target_info loki_mbus_dram_info;
48
49static void __init setup_cpu_win(int win, u32 base, u32 size,
50 u8 target, u8 attr, int remap)
51{
52 u32 ctrl;
53
54 base &= 0xffff0000;
55 ctrl = ((size - 1) & 0xffff0000) | (attr << 8) | (1 << 5) | target;
56
57 writel(base, CPU_WIN_BASE(win));
58 writel(ctrl, CPU_WIN_CTRL(win));
59 if (win < 2) {
60 if (remap < 0)
61 remap = base;
62
63 writel(remap & 0xffff0000, CPU_WIN_REMAP_LO(win));
64 writel(0, CPU_WIN_REMAP_HI(win));
65 }
66}
67
68void __init loki_setup_cpu_mbus(void)
69{
70 int i;
71 int cs;
72
73 /*
74 * First, disable and clear windows.
75 */
76 for (i = 0; i < 8; i++) {
77 writel(0, CPU_WIN_BASE(i));
78 writel(0, CPU_WIN_CTRL(i));
79 if (i < 2) {
80 writel(0, CPU_WIN_REMAP_LO(i));
81 writel(0, CPU_WIN_REMAP_HI(i));
82 }
83 }
84
85 /*
86 * Setup windows for PCIe IO+MEM space.
87 */
88 setup_cpu_win(2, LOKI_PCIE0_MEM_PHYS_BASE, LOKI_PCIE0_MEM_SIZE,
89 TARGET_PCIE0, ATTR_PCIE_MEM, -1);
90 setup_cpu_win(3, LOKI_PCIE1_MEM_PHYS_BASE, LOKI_PCIE1_MEM_SIZE,
91 TARGET_PCIE1, ATTR_PCIE_MEM, -1);
92
93 /*
94 * Setup MBUS dram target info.
95 */
96 loki_mbus_dram_info.mbus_dram_target_id = TARGET_DDR;
97
98 for (i = 0, cs = 0; i < 4; i++) {
99 u32 base = readl(DDR_BASE_CS(i));
100 u32 size = readl(DDR_SIZE_CS(i));
101
102 /*
103 * Chip select enabled?
104 */
105 if (size & 1) {
106 struct mbus_dram_window *w;
107
108 w = &loki_mbus_dram_info.cs[cs++];
109 w->cs_index = i;
110 w->mbus_attr = 0xf & ~(1 << i);
111 w->base = base & 0xffff0000;
112 w->size = (size | 0x0000ffff) + 1;
113 }
114 }
115 loki_mbus_dram_info.num_cs = cs;
116}
117
118void __init loki_setup_dev_boot_win(u32 base, u32 size)
119{
120 setup_cpu_win(4, base, size, TARGET_DEV_BUS, ATTR_DEV_BOOT, -1);
121}
diff --git a/arch/arm/mach-loki/common.c b/arch/arm/mach-loki/common.c
new file mode 100644
index 000000000000..410f50399dd3
--- /dev/null
+++ b/arch/arm/mach-loki/common.c
@@ -0,0 +1,305 @@
1/*
2 * arch/arm/mach-loki/common.c
3 *
4 * Core functions for Marvell Loki (88RC8480) SoCs
5 *
6 * This file is licensed under the terms of the GNU General Public
7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied.
9 */
10
11#include <linux/kernel.h>
12#include <linux/init.h>
13#include <linux/platform_device.h>
14#include <linux/serial_8250.h>
15#include <linux/mbus.h>
16#include <linux/mv643xx_eth.h>
17#include <asm/page.h>
18#include <asm/timex.h>
19#include <asm/mach/map.h>
20#include <asm/mach/time.h>
21#include <asm/arch/loki.h>
22#include <asm/plat-orion/orion_nand.h>
23#include <asm/plat-orion/time.h>
24#include "common.h"
25
26/*****************************************************************************
27 * I/O Address Mapping
28 ****************************************************************************/
29static struct map_desc loki_io_desc[] __initdata = {
30 {
31 .virtual = LOKI_REGS_VIRT_BASE,
32 .pfn = __phys_to_pfn(LOKI_REGS_PHYS_BASE),
33 .length = LOKI_REGS_SIZE,
34 .type = MT_DEVICE,
35 },
36};
37
38void __init loki_map_io(void)
39{
40 iotable_init(loki_io_desc, ARRAY_SIZE(loki_io_desc));
41}
42
43
44/*****************************************************************************
45 * GE0
46 ****************************************************************************/
47struct mv643xx_eth_shared_platform_data loki_ge0_shared_data = {
48 .t_clk = LOKI_TCLK,
49 .dram = &loki_mbus_dram_info,
50};
51
52static struct resource loki_ge0_shared_resources[] = {
53 {
54 .name = "ge0 base",
55 .start = GE0_PHYS_BASE + 0x2000,
56 .end = GE0_PHYS_BASE + 0x3fff,
57 .flags = IORESOURCE_MEM,
58 },
59};
60
61static struct platform_device loki_ge0_shared = {
62 .name = MV643XX_ETH_SHARED_NAME,
63 .id = 0,
64 .dev = {
65 .platform_data = &loki_ge0_shared_data,
66 },
67 .num_resources = 1,
68 .resource = loki_ge0_shared_resources,
69};
70
71static struct resource loki_ge0_resources[] = {
72 {
73 .name = "ge0 irq",
74 .start = IRQ_LOKI_GBE_A_INT,
75 .end = IRQ_LOKI_GBE_A_INT,
76 .flags = IORESOURCE_IRQ,
77 },
78};
79
80static struct platform_device loki_ge0 = {
81 .name = MV643XX_ETH_NAME,
82 .id = 0,
83 .num_resources = 1,
84 .resource = loki_ge0_resources,
85};
86
87void __init loki_ge0_init(struct mv643xx_eth_platform_data *eth_data)
88{
89 eth_data->shared = &loki_ge0_shared;
90 loki_ge0.dev.platform_data = eth_data;
91
92 writel(0x00079220, GE0_VIRT_BASE + 0x20b0);
93 platform_device_register(&loki_ge0_shared);
94 platform_device_register(&loki_ge0);
95}
96
97
98/*****************************************************************************
99 * GE1
100 ****************************************************************************/
101struct mv643xx_eth_shared_platform_data loki_ge1_shared_data = {
102 .t_clk = LOKI_TCLK,
103 .dram = &loki_mbus_dram_info,
104};
105
106static struct resource loki_ge1_shared_resources[] = {
107 {
108 .name = "ge1 base",
109 .start = GE1_PHYS_BASE + 0x2000,
110 .end = GE1_PHYS_BASE + 0x3fff,
111 .flags = IORESOURCE_MEM,
112 },
113};
114
115static struct platform_device loki_ge1_shared = {
116 .name = MV643XX_ETH_SHARED_NAME,
117 .id = 1,
118 .dev = {
119 .platform_data = &loki_ge1_shared_data,
120 },
121 .num_resources = 1,
122 .resource = loki_ge1_shared_resources,
123};
124
125static struct resource loki_ge1_resources[] = {
126 {
127 .name = "ge1 irq",
128 .start = IRQ_LOKI_GBE_B_INT,
129 .end = IRQ_LOKI_GBE_B_INT,
130 .flags = IORESOURCE_IRQ,
131 },
132};
133
134static struct platform_device loki_ge1 = {
135 .name = MV643XX_ETH_NAME,
136 .id = 1,
137 .num_resources = 1,
138 .resource = loki_ge1_resources,
139};
140
141void __init loki_ge1_init(struct mv643xx_eth_platform_data *eth_data)
142{
143 eth_data->shared = &loki_ge1_shared;
144 loki_ge1.dev.platform_data = eth_data;
145
146 writel(0x00079220, GE1_VIRT_BASE + 0x20b0);
147 platform_device_register(&loki_ge1_shared);
148 platform_device_register(&loki_ge1);
149}
150
151
152/*****************************************************************************
153 * SAS/SATA
154 ****************************************************************************/
155static struct resource loki_sas_resources[] = {
156 {
157 .name = "mvsas0 mem",
158 .start = SAS0_PHYS_BASE,
159 .end = SAS0_PHYS_BASE + 0x01ff,
160 .flags = IORESOURCE_MEM,
161 }, {
162 .name = "mvsas0 irq",
163 .start = IRQ_LOKI_SAS_A,
164 .end = IRQ_LOKI_SAS_A,
165 .flags = IORESOURCE_IRQ,
166 }, {
167 .name = "mvsas1 mem",
168 .start = SAS1_PHYS_BASE,
169 .end = SAS1_PHYS_BASE + 0x01ff,
170 .flags = IORESOURCE_MEM,
171 }, {
172 .name = "mvsas1 irq",
173 .start = IRQ_LOKI_SAS_B,
174 .end = IRQ_LOKI_SAS_B,
175 .flags = IORESOURCE_IRQ,
176 },
177};
178
179static struct platform_device loki_sas = {
180 .name = "mvsas",
181 .id = 0,
182 .dev = {
183 .coherent_dma_mask = 0xffffffff,
184 },
185 .num_resources = ARRAY_SIZE(loki_sas_resources),
186 .resource = loki_sas_resources,
187};
188
189void __init loki_sas_init(void)
190{
191 writel(0x8300f707, DDR_REG(0x1424));
192 platform_device_register(&loki_sas);
193}
194
195
196/*****************************************************************************
197 * UART0
198 ****************************************************************************/
199static struct plat_serial8250_port loki_uart0_data[] = {
200 {
201 .mapbase = UART0_PHYS_BASE,
202 .membase = (char *)UART0_VIRT_BASE,
203 .irq = IRQ_LOKI_UART0,
204 .flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF,
205 .iotype = UPIO_MEM,
206 .regshift = 2,
207 .uartclk = LOKI_TCLK,
208 }, {
209 },
210};
211
212static struct resource loki_uart0_resources[] = {
213 {
214 .start = UART0_PHYS_BASE,
215 .end = UART0_PHYS_BASE + 0xff,
216 .flags = IORESOURCE_MEM,
217 }, {
218 .start = IRQ_LOKI_UART0,
219 .end = IRQ_LOKI_UART0,
220 .flags = IORESOURCE_IRQ,
221 },
222};
223
224static struct platform_device loki_uart0 = {
225 .name = "serial8250",
226 .id = 0,
227 .dev = {
228 .platform_data = loki_uart0_data,
229 },
230 .resource = loki_uart0_resources,
231 .num_resources = ARRAY_SIZE(loki_uart0_resources),
232};
233
234void __init loki_uart0_init(void)
235{
236 platform_device_register(&loki_uart0);
237}
238
239
240/*****************************************************************************
241 * UART1
242 ****************************************************************************/
243static struct plat_serial8250_port loki_uart1_data[] = {
244 {
245 .mapbase = UART1_PHYS_BASE,
246 .membase = (char *)UART1_VIRT_BASE,
247 .irq = IRQ_LOKI_UART1,
248 .flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF,
249 .iotype = UPIO_MEM,
250 .regshift = 2,
251 .uartclk = LOKI_TCLK,
252 }, {
253 },
254};
255
256static struct resource loki_uart1_resources[] = {
257 {
258 .start = UART1_PHYS_BASE,
259 .end = UART1_PHYS_BASE + 0xff,
260 .flags = IORESOURCE_MEM,
261 }, {
262 .start = IRQ_LOKI_UART1,
263 .end = IRQ_LOKI_UART1,
264 .flags = IORESOURCE_IRQ,
265 },
266};
267
268static struct platform_device loki_uart1 = {
269 .name = "serial8250",
270 .id = 1,
271 .dev = {
272 .platform_data = loki_uart1_data,
273 },
274 .resource = loki_uart1_resources,
275 .num_resources = ARRAY_SIZE(loki_uart1_resources),
276};
277
278void __init loki_uart1_init(void)
279{
280 platform_device_register(&loki_uart1);
281}
282
283
284/*****************************************************************************
285 * Time handling
286 ****************************************************************************/
287static void loki_timer_init(void)
288{
289 orion_time_init(IRQ_LOKI_BRIDGE, LOKI_TCLK);
290}
291
292struct sys_timer loki_timer = {
293 .init = loki_timer_init,
294};
295
296
297/*****************************************************************************
298 * General
299 ****************************************************************************/
300void __init loki_init(void)
301{
302 printk(KERN_INFO "Loki ID: 88RC8480. TCLK=%d.\n", LOKI_TCLK);
303
304 loki_setup_cpu_mbus();
305}
diff --git a/arch/arm/mach-loki/common.h b/arch/arm/mach-loki/common.h
new file mode 100644
index 000000000000..26054fd0f05e
--- /dev/null
+++ b/arch/arm/mach-loki/common.h
@@ -0,0 +1,36 @@
1/*
2 * arch/arm/mach-loki/common.h
3 *
4 * Core functions for Marvell Loki (88RC8480) SoCs
5 *
6 * This file is licensed under the terms of the GNU General Public
7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied.
9 */
10
11#ifndef __ARCH_LOKI_COMMON_H
12#define __ARCH_LOKI_COMMON_H
13
14struct mv643xx_eth_platform_data;
15
16/*
17 * Basic Loki init functions used early by machine-setup.
18 */
19void loki_map_io(void);
20void loki_init(void);
21void loki_init_irq(void);
22
23extern struct mbus_dram_target_info loki_mbus_dram_info;
24void loki_setup_cpu_mbus(void);
25void loki_setup_dev_boot_win(u32 base, u32 size);
26
27void loki_ge0_init(struct mv643xx_eth_platform_data *eth_data);
28void loki_ge1_init(struct mv643xx_eth_platform_data *eth_data);
29void loki_sas_init(void);
30void loki_uart0_init(void);
31void loki_uart1_init(void);
32
33extern struct sys_timer loki_timer;
34
35
36#endif
diff --git a/arch/arm/mach-loki/irq.c b/arch/arm/mach-loki/irq.c
new file mode 100644
index 000000000000..d839af91fe03
--- /dev/null
+++ b/arch/arm/mach-loki/irq.c
@@ -0,0 +1,21 @@
1/*
2 * arch/arm/mach-loki/irq.c
3 *
4 * Marvell Loki (88RC8480) IRQ handling.
5 *
6 * This file is licensed under the terms of the GNU General Public
7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied.
9 */
10
11#include <linux/kernel.h>
12#include <linux/init.h>
13#include <linux/irq.h>
14#include <asm/io.h>
15#include <asm/plat-orion/irq.h>
16#include "common.h"
17
18void __init loki_init_irq(void)
19{
20 orion_irq_init(0, (void __iomem *)(IRQ_VIRT_BASE + IRQ_MASK_OFF));
21}
diff --git a/arch/arm/mach-loki/lb88rc8480-setup.c b/arch/arm/mach-loki/lb88rc8480-setup.c
new file mode 100644
index 000000000000..d1b9e6e6253a
--- /dev/null
+++ b/arch/arm/mach-loki/lb88rc8480-setup.c
@@ -0,0 +1,100 @@
1/*
2 * arch/arm/mach-loki/lb88rc8480-setup.c
3 *
4 * Marvell LB88RC8480 Development Board Setup
5 *
6 * This file is licensed under the terms of the GNU General Public
7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied.
9 */
10
11#include <linux/kernel.h>
12#include <linux/init.h>
13#include <linux/platform_device.h>
14#include <linux/irq.h>
15#include <linux/mtd/physmap.h>
16#include <linux/mtd/nand.h>
17#include <linux/timer.h>
18#include <linux/ata_platform.h>
19#include <linux/mv643xx_eth.h>
20#include <asm/mach-types.h>
21#include <asm/mach/arch.h>
22#include <asm/arch/loki.h>
23#include "common.h"
24
25#define LB88RC8480_FLASH_BOOT_CS_BASE 0xf8000000
26#define LB88RC8480_FLASH_BOOT_CS_SIZE SZ_128M
27
28#define LB88RC8480_NOR_BOOT_BASE 0xff000000
29#define LB88RC8480_NOR_BOOT_SIZE SZ_16M
30
31static struct mtd_partition lb88rc8480_boot_flash_parts[] = {
32 {
33 .name = "kernel",
34 .offset = 0,
35 .size = SZ_2M,
36 }, {
37 .name = "root-fs",
38 .offset = SZ_2M,
39 .size = (SZ_8M + SZ_4M + SZ_1M),
40 }, {
41 .name = "u-boot",
42 .offset = (SZ_8M + SZ_4M + SZ_2M + SZ_1M),
43 .size = SZ_1M,
44 },
45};
46
47static struct physmap_flash_data lb88rc8480_boot_flash_data = {
48 .parts = lb88rc8480_boot_flash_parts,
49 .nr_parts = ARRAY_SIZE(lb88rc8480_boot_flash_parts),
50 .width = 1, /* 8 bit bus width */
51};
52
53static struct resource lb88rc8480_boot_flash_resource = {
54 .flags = IORESOURCE_MEM,
55 .start = LB88RC8480_NOR_BOOT_BASE,
56 .end = LB88RC8480_NOR_BOOT_BASE + LB88RC8480_NOR_BOOT_SIZE - 1,
57};
58
59static struct platform_device lb88rc8480_boot_flash = {
60 .name = "physmap-flash",
61 .id = 0,
62 .dev = {
63 .platform_data = &lb88rc8480_boot_flash_data,
64 },
65 .num_resources = 1,
66 .resource = &lb88rc8480_boot_flash_resource,
67};
68
69static struct mv643xx_eth_platform_data lb88rc8480_ge0_data = {
70 .phy_addr = 1,
71 .mac_addr = { 0x00, 0x50, 0x43, 0x11, 0x22, 0x33 },
72};
73
74static void __init lb88rc8480_init(void)
75{
76 /*
77 * Basic setup. Needs to be called early.
78 */
79 loki_init();
80
81 loki_ge0_init(&lb88rc8480_ge0_data);
82 loki_sas_init();
83 loki_uart0_init();
84 loki_uart1_init();
85
86 loki_setup_dev_boot_win(LB88RC8480_FLASH_BOOT_CS_BASE,
87 LB88RC8480_FLASH_BOOT_CS_SIZE);
88 platform_device_register(&lb88rc8480_boot_flash);
89}
90
91MACHINE_START(LB88RC8480, "Marvell LB88RC8480 Development Board")
92 /* Maintainer: Ke Wei <kewei@marvell.com> */
93 .phys_io = LOKI_REGS_PHYS_BASE,
94 .io_pg_offst = ((LOKI_REGS_VIRT_BASE) >> 18) & 0xfffc,
95 .boot_params = 0x00000100,
96 .init_machine = lb88rc8480_init,
97 .map_io = loki_map_io,
98 .init_irq = loki_init_irq,
99 .timer = &loki_timer,
100MACHINE_END
diff --git a/arch/arm/mach-mv78xx0/Kconfig b/arch/arm/mach-mv78xx0/Kconfig
new file mode 100644
index 000000000000..d83cb86837db
--- /dev/null
+++ b/arch/arm/mach-mv78xx0/Kconfig
@@ -0,0 +1,13 @@
1if ARCH_MV78XX0
2
3menu "Marvell MV78xx0 Implementations"
4
5config MACH_DB78X00_BP
6 bool "Marvell DB-78x00-BP Development Board"
7 help
8 Say 'Y' here if you want your kernel to support the
9 Marvell DB-78x00-BP Development Board.
10
11endmenu
12
13endif
diff --git a/arch/arm/mach-mv78xx0/Makefile b/arch/arm/mach-mv78xx0/Makefile
new file mode 100644
index 000000000000..ec16c05c3b1b
--- /dev/null
+++ b/arch/arm/mach-mv78xx0/Makefile
@@ -0,0 +1,2 @@
1obj-y += common.o addr-map.o irq.o pcie.o
2obj-$(CONFIG_MACH_DB78X00_BP) += db78x00-bp-setup.o
diff --git a/arch/arm/mach-mv78xx0/Makefile.boot b/arch/arm/mach-mv78xx0/Makefile.boot
new file mode 100644
index 000000000000..67039c3e0c48
--- /dev/null
+++ b/arch/arm/mach-mv78xx0/Makefile.boot
@@ -0,0 +1,3 @@
1 zreladdr-y := 0x00008000
2params_phys-y := 0x00000100
3initrd_phys-y := 0x00800000
diff --git a/arch/arm/mach-mv78xx0/addr-map.c b/arch/arm/mach-mv78xx0/addr-map.c
new file mode 100644
index 000000000000..4004b672a2eb
--- /dev/null
+++ b/arch/arm/mach-mv78xx0/addr-map.c
@@ -0,0 +1,156 @@
1/*
2 * arch/arm/mach-mv78xx0/addr-map.c
3 *
4 * Address map functions for Marvell MV78xx0 SoCs
5 *
6 * This file is licensed under the terms of the GNU General Public
7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied.
9 */
10
11#include <linux/kernel.h>
12#include <linux/init.h>
13#include <linux/mbus.h>
14#include <asm/io.h>
15#include "common.h"
16
17/*
18 * Generic Address Decode Windows bit settings
19 */
20#define TARGET_DDR 0
21#define TARGET_DEV_BUS 1
22#define TARGET_PCIE0 4
23#define TARGET_PCIE1 8
24#define TARGET_PCIE(i) ((i) ? TARGET_PCIE1 : TARGET_PCIE0)
25#define ATTR_DEV_SPI_ROM 0x1f
26#define ATTR_DEV_BOOT 0x2f
27#define ATTR_DEV_CS3 0x37
28#define ATTR_DEV_CS2 0x3b
29#define ATTR_DEV_CS1 0x3d
30#define ATTR_DEV_CS0 0x3e
31#define ATTR_PCIE_IO(l) (0xf0 & ~(0x10 << (l)))
32#define ATTR_PCIE_MEM(l) (0xf8 & ~(0x10 << (l)))
33
34/*
35 * Helpers to get DDR bank info
36 */
37#define DDR_BASE_CS_OFF(n) (0x0000 + ((n) << 3))
38#define DDR_SIZE_CS_OFF(n) (0x0004 + ((n) << 3))
39
40/*
41 * CPU Address Decode Windows registers
42 */
43#define WIN0_OFF(n) (BRIDGE_VIRT_BASE + 0x0000 + ((n) << 4))
44#define WIN8_OFF(n) (BRIDGE_VIRT_BASE + 0x0900 + (((n) - 8) << 4))
45#define WIN_CTRL_OFF 0x0000
46#define WIN_BASE_OFF 0x0004
47#define WIN_REMAP_LO_OFF 0x0008
48#define WIN_REMAP_HI_OFF 0x000c
49
50
51struct mbus_dram_target_info mv78xx0_mbus_dram_info;
52
53static void __init __iomem *win_cfg_base(int win)
54{
55 /*
56 * Find the control register base address for this window.
57 *
58 * BRIDGE_VIRT_BASE points to the right (CPU0's or CPU1's)
59 * MBUS bridge depending on which CPU core we're running on,
60 * so we don't need to take that into account here.
61 */
62
63 return (void __iomem *)((win < 8) ? WIN0_OFF(win) : WIN8_OFF(win));
64}
65
66static int __init cpu_win_can_remap(int win)
67{
68 if (win < 8)
69 return 1;
70
71 return 0;
72}
73
74static void __init setup_cpu_win(int win, u32 base, u32 size,
75 u8 target, u8 attr, int remap)
76{
77 void __iomem *addr = win_cfg_base(win);
78 u32 ctrl;
79
80 base &= 0xffff0000;
81 ctrl = ((size - 1) & 0xffff0000) | (attr << 8) | (target << 4) | 1;
82
83 writel(base, addr + WIN_BASE_OFF);
84 writel(ctrl, addr + WIN_CTRL_OFF);
85 if (cpu_win_can_remap(win)) {
86 if (remap < 0)
87 remap = base;
88
89 writel(remap & 0xffff0000, addr + WIN_REMAP_LO_OFF);
90 writel(0, addr + WIN_REMAP_HI_OFF);
91 }
92}
93
94void __init mv78xx0_setup_cpu_mbus(void)
95{
96 void __iomem *addr;
97 int i;
98 int cs;
99
100 /*
101 * First, disable and clear windows.
102 */
103 for (i = 0; i < 14; i++) {
104 addr = win_cfg_base(i);
105
106 writel(0, addr + WIN_BASE_OFF);
107 writel(0, addr + WIN_CTRL_OFF);
108 if (cpu_win_can_remap(i)) {
109 writel(0, addr + WIN_REMAP_LO_OFF);
110 writel(0, addr + WIN_REMAP_HI_OFF);
111 }
112 }
113
114 /*
115 * Setup MBUS dram target info.
116 */
117 mv78xx0_mbus_dram_info.mbus_dram_target_id = TARGET_DDR;
118
119 if (mv78xx0_core_index() == 0)
120 addr = (void __iomem *)DDR_WINDOW_CPU0_BASE;
121 else
122 addr = (void __iomem *)DDR_WINDOW_CPU1_BASE;
123
124 for (i = 0, cs = 0; i < 4; i++) {
125 u32 base = readl(addr + DDR_BASE_CS_OFF(i));
126 u32 size = readl(addr + DDR_SIZE_CS_OFF(i));
127
128 /*
129 * Chip select enabled?
130 */
131 if (size & 1) {
132 struct mbus_dram_window *w;
133
134 w = &mv78xx0_mbus_dram_info.cs[cs++];
135 w->cs_index = i;
136 w->mbus_attr = 0xf & ~(1 << i);
137 w->base = base & 0xffff0000;
138 w->size = (size | 0x0000ffff) + 1;
139 }
140 }
141 mv78xx0_mbus_dram_info.num_cs = cs;
142}
143
144void __init mv78xx0_setup_pcie_io_win(int window, u32 base, u32 size,
145 int maj, int min)
146{
147 setup_cpu_win(window, base, size, TARGET_PCIE(maj),
148 ATTR_PCIE_IO(min), -1);
149}
150
151void __init mv78xx0_setup_pcie_mem_win(int window, u32 base, u32 size,
152 int maj, int min)
153{
154 setup_cpu_win(window, base, size, TARGET_PCIE(maj),
155 ATTR_PCIE_MEM(min), -1);
156}
diff --git a/arch/arm/mach-mv78xx0/common.c b/arch/arm/mach-mv78xx0/common.c
new file mode 100644
index 000000000000..d27b83b7bf62
--- /dev/null
+++ b/arch/arm/mach-mv78xx0/common.c
@@ -0,0 +1,754 @@
1/*
2 * arch/arm/mach-mv78xx0/common.c
3 *
4 * Core functions for Marvell MV78xx0 SoCs
5 *
6 * This file is licensed under the terms of the GNU General Public
7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied.
9 */
10
11#include <linux/kernel.h>
12#include <linux/init.h>
13#include <linux/platform_device.h>
14#include <linux/serial_8250.h>
15#include <linux/mbus.h>
16#include <linux/mv643xx_eth.h>
17#include <linux/ata_platform.h>
18#include <asm/mach/map.h>
19#include <asm/mach/time.h>
20#include <asm/arch/mv78xx0.h>
21#include <asm/plat-orion/cache-feroceon-l2.h>
22#include <asm/plat-orion/ehci-orion.h>
23#include <asm/plat-orion/orion_nand.h>
24#include <asm/plat-orion/time.h>
25#include "common.h"
26
27
28/*****************************************************************************
29 * Common bits
30 ****************************************************************************/
31int mv78xx0_core_index(void)
32{
33 u32 extra;
34
35 /*
36 * Read Extra Features register.
37 */
38 __asm__("mrc p15, 1, %0, c15, c1, 0" : "=r" (extra));
39
40 return !!(extra & 0x00004000);
41}
42
43static int get_hclk(void)
44{
45 int hclk;
46
47 /*
48 * HCLK tick rate is configured by DEV_D[7:5] pins.
49 */
50 switch ((readl(SAMPLE_AT_RESET_LOW) >> 5) & 7) {
51 case 0:
52 hclk = 166666667;
53 break;
54 case 1:
55 hclk = 200000000;
56 break;
57 case 2:
58 hclk = 266666667;
59 break;
60 case 3:
61 hclk = 333333333;
62 break;
63 case 4:
64 hclk = 400000000;
65 break;
66 default:
67 panic("unknown HCLK PLL setting: %.8x\n",
68 readl(SAMPLE_AT_RESET_LOW));
69 }
70
71 return hclk;
72}
73
74static void get_pclk_l2clk(int hclk, int core_index, int *pclk, int *l2clk)
75{
76 u32 cfg;
77
78 /*
79 * Core #0 PCLK/L2CLK is configured by bits [13:8], core #1
80 * PCLK/L2CLK by bits [19:14].
81 */
82 if (core_index == 0) {
83 cfg = (readl(SAMPLE_AT_RESET_LOW) >> 8) & 0x3f;
84 } else {
85 cfg = (readl(SAMPLE_AT_RESET_LOW) >> 14) & 0x3f;
86 }
87
88 /*
89 * Bits [11:8] ([17:14] for core #1) configure the PCLK:HCLK
90 * ratio (1, 1.5, 2, 2.5, 3, 3.5, 4, 4.5, 5, 5.5, 6).
91 */
92 *pclk = ((u64)hclk * (2 + (cfg & 0xf))) >> 1;
93
94 /*
95 * Bits [13:12] ([19:18] for core #1) configure the PCLK:L2CLK
96 * ratio (1, 2, 3).
97 */
98 *l2clk = *pclk / (((cfg >> 4) & 3) + 1);
99}
100
101static int get_tclk(void)
102{
103 int tclk;
104
105 /*
106 * TCLK tick rate is configured by DEV_A[2:0] strap pins.
107 */
108 switch ((readl(SAMPLE_AT_RESET_HIGH) >> 6) & 7) {
109 case 1:
110 tclk = 166666667;
111 break;
112 case 3:
113 tclk = 200000000;
114 break;
115 default:
116 panic("unknown TCLK PLL setting: %.8x\n",
117 readl(SAMPLE_AT_RESET_HIGH));
118 }
119
120 return tclk;
121}
122
123
124/*****************************************************************************
125 * I/O Address Mapping
126 ****************************************************************************/
127static struct map_desc mv78xx0_io_desc[] __initdata = {
128 {
129 .virtual = MV78XX0_CORE_REGS_VIRT_BASE,
130 .pfn = 0,
131 .length = MV78XX0_CORE_REGS_SIZE,
132 .type = MT_DEVICE,
133 }, {
134 .virtual = MV78XX0_PCIE_IO_VIRT_BASE(0),
135 .pfn = __phys_to_pfn(MV78XX0_PCIE_IO_PHYS_BASE(0)),
136 .length = MV78XX0_PCIE_IO_SIZE * 8,
137 .type = MT_DEVICE,
138 }, {
139 .virtual = MV78XX0_REGS_VIRT_BASE,
140 .pfn = __phys_to_pfn(MV78XX0_REGS_PHYS_BASE),
141 .length = MV78XX0_REGS_SIZE,
142 .type = MT_DEVICE,
143 },
144};
145
146void __init mv78xx0_map_io(void)
147{
148 unsigned long phys;
149
150 /*
151 * Map the right set of per-core registers depending on
152 * which core we are running on.
153 */
154 if (mv78xx0_core_index() == 0) {
155 phys = MV78XX0_CORE0_REGS_PHYS_BASE;
156 } else {
157 phys = MV78XX0_CORE1_REGS_PHYS_BASE;
158 }
159 mv78xx0_io_desc[0].pfn = __phys_to_pfn(phys);
160
161 iotable_init(mv78xx0_io_desc, ARRAY_SIZE(mv78xx0_io_desc));
162}
163
164
165/*****************************************************************************
166 * EHCI
167 ****************************************************************************/
168static struct orion_ehci_data mv78xx0_ehci_data = {
169 .dram = &mv78xx0_mbus_dram_info,
170};
171
172static u64 ehci_dmamask = 0xffffffffUL;
173
174
175/*****************************************************************************
176 * EHCI0
177 ****************************************************************************/
178static struct resource mv78xx0_ehci0_resources[] = {
179 {
180 .start = USB0_PHYS_BASE,
181 .end = USB0_PHYS_BASE + 0x0fff,
182 .flags = IORESOURCE_MEM,
183 }, {
184 .start = IRQ_MV78XX0_USB_0,
185 .end = IRQ_MV78XX0_USB_0,
186 .flags = IORESOURCE_IRQ,
187 },
188};
189
190static struct platform_device mv78xx0_ehci0 = {
191 .name = "orion-ehci",
192 .id = 0,
193 .dev = {
194 .dma_mask = &ehci_dmamask,
195 .coherent_dma_mask = 0xffffffff,
196 .platform_data = &mv78xx0_ehci_data,
197 },
198 .resource = mv78xx0_ehci0_resources,
199 .num_resources = ARRAY_SIZE(mv78xx0_ehci0_resources),
200};
201
202void __init mv78xx0_ehci0_init(void)
203{
204 platform_device_register(&mv78xx0_ehci0);
205}
206
207
208/*****************************************************************************
209 * EHCI1
210 ****************************************************************************/
211static struct resource mv78xx0_ehci1_resources[] = {
212 {
213 .start = USB1_PHYS_BASE,
214 .end = USB1_PHYS_BASE + 0x0fff,
215 .flags = IORESOURCE_MEM,
216 }, {
217 .start = IRQ_MV78XX0_USB_1,
218 .end = IRQ_MV78XX0_USB_1,
219 .flags = IORESOURCE_IRQ,
220 },
221};
222
223static struct platform_device mv78xx0_ehci1 = {
224 .name = "orion-ehci",
225 .id = 1,
226 .dev = {
227 .dma_mask = &ehci_dmamask,
228 .coherent_dma_mask = 0xffffffff,
229 .platform_data = &mv78xx0_ehci_data,
230 },
231 .resource = mv78xx0_ehci1_resources,
232 .num_resources = ARRAY_SIZE(mv78xx0_ehci1_resources),
233};
234
235void __init mv78xx0_ehci1_init(void)
236{
237 platform_device_register(&mv78xx0_ehci1);
238}
239
240
241/*****************************************************************************
242 * EHCI2
243 ****************************************************************************/
244static struct resource mv78xx0_ehci2_resources[] = {
245 {
246 .start = USB2_PHYS_BASE,
247 .end = USB2_PHYS_BASE + 0x0fff,
248 .flags = IORESOURCE_MEM,
249 }, {
250 .start = IRQ_MV78XX0_USB_2,
251 .end = IRQ_MV78XX0_USB_2,
252 .flags = IORESOURCE_IRQ,
253 },
254};
255
256static struct platform_device mv78xx0_ehci2 = {
257 .name = "orion-ehci",
258 .id = 2,
259 .dev = {
260 .dma_mask = &ehci_dmamask,
261 .coherent_dma_mask = 0xffffffff,
262 .platform_data = &mv78xx0_ehci_data,
263 },
264 .resource = mv78xx0_ehci2_resources,
265 .num_resources = ARRAY_SIZE(mv78xx0_ehci2_resources),
266};
267
268void __init mv78xx0_ehci2_init(void)
269{
270 platform_device_register(&mv78xx0_ehci2);
271}
272
273
274/*****************************************************************************
275 * GE00
276 ****************************************************************************/
277struct mv643xx_eth_shared_platform_data mv78xx0_ge00_shared_data = {
278 .t_clk = 0,
279 .dram = &mv78xx0_mbus_dram_info,
280};
281
282static struct resource mv78xx0_ge00_shared_resources[] = {
283 {
284 .name = "ge00 base",
285 .start = GE00_PHYS_BASE + 0x2000,
286 .end = GE00_PHYS_BASE + 0x3fff,
287 .flags = IORESOURCE_MEM,
288 },
289};
290
291static struct platform_device mv78xx0_ge00_shared = {
292 .name = MV643XX_ETH_SHARED_NAME,
293 .id = 0,
294 .dev = {
295 .platform_data = &mv78xx0_ge00_shared_data,
296 },
297 .num_resources = 1,
298 .resource = mv78xx0_ge00_shared_resources,
299};
300
301static struct resource mv78xx0_ge00_resources[] = {
302 {
303 .name = "ge00 irq",
304 .start = IRQ_MV78XX0_GE00_SUM,
305 .end = IRQ_MV78XX0_GE00_SUM,
306 .flags = IORESOURCE_IRQ,
307 },
308};
309
310static struct platform_device mv78xx0_ge00 = {
311 .name = MV643XX_ETH_NAME,
312 .id = 0,
313 .num_resources = 1,
314 .resource = mv78xx0_ge00_resources,
315};
316
317void __init mv78xx0_ge00_init(struct mv643xx_eth_platform_data *eth_data)
318{
319 eth_data->shared = &mv78xx0_ge00_shared;
320 mv78xx0_ge00.dev.platform_data = eth_data;
321
322 platform_device_register(&mv78xx0_ge00_shared);
323 platform_device_register(&mv78xx0_ge00);
324}
325
326
327/*****************************************************************************
328 * GE01
329 ****************************************************************************/
330struct mv643xx_eth_shared_platform_data mv78xx0_ge01_shared_data = {
331 .t_clk = 0,
332 .dram = &mv78xx0_mbus_dram_info,
333};
334
335static struct resource mv78xx0_ge01_shared_resources[] = {
336 {
337 .name = "ge01 base",
338 .start = GE01_PHYS_BASE + 0x2000,
339 .end = GE01_PHYS_BASE + 0x3fff,
340 .flags = IORESOURCE_MEM,
341 },
342};
343
344static struct platform_device mv78xx0_ge01_shared = {
345 .name = MV643XX_ETH_SHARED_NAME,
346 .id = 1,
347 .dev = {
348 .platform_data = &mv78xx0_ge01_shared_data,
349 },
350 .num_resources = 1,
351 .resource = mv78xx0_ge01_shared_resources,
352};
353
354static struct resource mv78xx0_ge01_resources[] = {
355 {
356 .name = "ge01 irq",
357 .start = IRQ_MV78XX0_GE01_SUM,
358 .end = IRQ_MV78XX0_GE01_SUM,
359 .flags = IORESOURCE_IRQ,
360 },
361};
362
363static struct platform_device mv78xx0_ge01 = {
364 .name = MV643XX_ETH_NAME,
365 .id = 1,
366 .num_resources = 1,
367 .resource = mv78xx0_ge01_resources,
368};
369
370void __init mv78xx0_ge01_init(struct mv643xx_eth_platform_data *eth_data)
371{
372 eth_data->shared = &mv78xx0_ge01_shared;
373 eth_data->shared_smi = &mv78xx0_ge00_shared;
374 mv78xx0_ge01.dev.platform_data = eth_data;
375
376 platform_device_register(&mv78xx0_ge01_shared);
377 platform_device_register(&mv78xx0_ge01);
378}
379
380
381/*****************************************************************************
382 * GE10
383 ****************************************************************************/
384struct mv643xx_eth_shared_platform_data mv78xx0_ge10_shared_data = {
385 .t_clk = 0,
386 .dram = &mv78xx0_mbus_dram_info,
387};
388
389static struct resource mv78xx0_ge10_shared_resources[] = {
390 {
391 .name = "ge10 base",
392 .start = GE10_PHYS_BASE + 0x2000,
393 .end = GE10_PHYS_BASE + 0x3fff,
394 .flags = IORESOURCE_MEM,
395 },
396};
397
398static struct platform_device mv78xx0_ge10_shared = {
399 .name = MV643XX_ETH_SHARED_NAME,
400 .id = 2,
401 .dev = {
402 .platform_data = &mv78xx0_ge10_shared_data,
403 },
404 .num_resources = 1,
405 .resource = mv78xx0_ge10_shared_resources,
406};
407
408static struct resource mv78xx0_ge10_resources[] = {
409 {
410 .name = "ge10 irq",
411 .start = IRQ_MV78XX0_GE10_SUM,
412 .end = IRQ_MV78XX0_GE10_SUM,
413 .flags = IORESOURCE_IRQ,
414 },
415};
416
417static struct platform_device mv78xx0_ge10 = {
418 .name = MV643XX_ETH_NAME,
419 .id = 2,
420 .num_resources = 1,
421 .resource = mv78xx0_ge10_resources,
422};
423
424void __init mv78xx0_ge10_init(struct mv643xx_eth_platform_data *eth_data)
425{
426 eth_data->shared = &mv78xx0_ge10_shared;
427 eth_data->shared_smi = &mv78xx0_ge00_shared;
428 mv78xx0_ge10.dev.platform_data = eth_data;
429
430 platform_device_register(&mv78xx0_ge10_shared);
431 platform_device_register(&mv78xx0_ge10);
432}
433
434
435/*****************************************************************************
436 * GE11
437 ****************************************************************************/
438struct mv643xx_eth_shared_platform_data mv78xx0_ge11_shared_data = {
439 .t_clk = 0,
440 .dram = &mv78xx0_mbus_dram_info,
441};
442
443static struct resource mv78xx0_ge11_shared_resources[] = {
444 {
445 .name = "ge11 base",
446 .start = GE11_PHYS_BASE + 0x2000,
447 .end = GE11_PHYS_BASE + 0x3fff,
448 .flags = IORESOURCE_MEM,
449 },
450};
451
452static struct platform_device mv78xx0_ge11_shared = {
453 .name = MV643XX_ETH_SHARED_NAME,
454 .id = 3,
455 .dev = {
456 .platform_data = &mv78xx0_ge11_shared_data,
457 },
458 .num_resources = 1,
459 .resource = mv78xx0_ge11_shared_resources,
460};
461
462static struct resource mv78xx0_ge11_resources[] = {
463 {
464 .name = "ge11 irq",
465 .start = IRQ_MV78XX0_GE11_SUM,
466 .end = IRQ_MV78XX0_GE11_SUM,
467 .flags = IORESOURCE_IRQ,
468 },
469};
470
471static struct platform_device mv78xx0_ge11 = {
472 .name = MV643XX_ETH_NAME,
473 .id = 3,
474 .num_resources = 1,
475 .resource = mv78xx0_ge11_resources,
476};
477
478void __init mv78xx0_ge11_init(struct mv643xx_eth_platform_data *eth_data)
479{
480 eth_data->shared = &mv78xx0_ge11_shared;
481 eth_data->shared_smi = &mv78xx0_ge00_shared;
482 mv78xx0_ge11.dev.platform_data = eth_data;
483
484 platform_device_register(&mv78xx0_ge11_shared);
485 platform_device_register(&mv78xx0_ge11);
486}
487
488
489/*****************************************************************************
490 * SATA
491 ****************************************************************************/
492static struct resource mv78xx0_sata_resources[] = {
493 {
494 .name = "sata base",
495 .start = SATA_PHYS_BASE,
496 .end = SATA_PHYS_BASE + 0x5000 - 1,
497 .flags = IORESOURCE_MEM,
498 }, {
499 .name = "sata irq",
500 .start = IRQ_MV78XX0_SATA,
501 .end = IRQ_MV78XX0_SATA,
502 .flags = IORESOURCE_IRQ,
503 },
504};
505
506static struct platform_device mv78xx0_sata = {
507 .name = "sata_mv",
508 .id = 0,
509 .dev = {
510 .coherent_dma_mask = 0xffffffff,
511 },
512 .num_resources = ARRAY_SIZE(mv78xx0_sata_resources),
513 .resource = mv78xx0_sata_resources,
514};
515
516void __init mv78xx0_sata_init(struct mv_sata_platform_data *sata_data)
517{
518 sata_data->dram = &mv78xx0_mbus_dram_info;
519 mv78xx0_sata.dev.platform_data = sata_data;
520 platform_device_register(&mv78xx0_sata);
521}
522
523
524/*****************************************************************************
525 * UART0
526 ****************************************************************************/
527static struct plat_serial8250_port mv78xx0_uart0_data[] = {
528 {
529 .mapbase = UART0_PHYS_BASE,
530 .membase = (char *)UART0_VIRT_BASE,
531 .irq = IRQ_MV78XX0_UART_0,
532 .flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF,
533 .iotype = UPIO_MEM,
534 .regshift = 2,
535 .uartclk = 0,
536 }, {
537 },
538};
539
540static struct resource mv78xx0_uart0_resources[] = {
541 {
542 .start = UART0_PHYS_BASE,
543 .end = UART0_PHYS_BASE + 0xff,
544 .flags = IORESOURCE_MEM,
545 }, {
546 .start = IRQ_MV78XX0_UART_0,
547 .end = IRQ_MV78XX0_UART_0,
548 .flags = IORESOURCE_IRQ,
549 },
550};
551
552static struct platform_device mv78xx0_uart0 = {
553 .name = "serial8250",
554 .id = 0,
555 .dev = {
556 .platform_data = mv78xx0_uart0_data,
557 },
558 .resource = mv78xx0_uart0_resources,
559 .num_resources = ARRAY_SIZE(mv78xx0_uart0_resources),
560};
561
562void __init mv78xx0_uart0_init(void)
563{
564 platform_device_register(&mv78xx0_uart0);
565}
566
567
568/*****************************************************************************
569 * UART1
570 ****************************************************************************/
571static struct plat_serial8250_port mv78xx0_uart1_data[] = {
572 {
573 .mapbase = UART1_PHYS_BASE,
574 .membase = (char *)UART1_VIRT_BASE,
575 .irq = IRQ_MV78XX0_UART_1,
576 .flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF,
577 .iotype = UPIO_MEM,
578 .regshift = 2,
579 .uartclk = 0,
580 }, {
581 },
582};
583
584static struct resource mv78xx0_uart1_resources[] = {
585 {
586 .start = UART1_PHYS_BASE,
587 .end = UART1_PHYS_BASE + 0xff,
588 .flags = IORESOURCE_MEM,
589 }, {
590 .start = IRQ_MV78XX0_UART_1,
591 .end = IRQ_MV78XX0_UART_1,
592 .flags = IORESOURCE_IRQ,
593 },
594};
595
596static struct platform_device mv78xx0_uart1 = {
597 .name = "serial8250",
598 .id = 1,
599 .dev = {
600 .platform_data = mv78xx0_uart1_data,
601 },
602 .resource = mv78xx0_uart1_resources,
603 .num_resources = ARRAY_SIZE(mv78xx0_uart1_resources),
604};
605
606void __init mv78xx0_uart1_init(void)
607{
608 platform_device_register(&mv78xx0_uart1);
609}
610
611
612/*****************************************************************************
613 * UART2
614 ****************************************************************************/
615static struct plat_serial8250_port mv78xx0_uart2_data[] = {
616 {
617 .mapbase = UART2_PHYS_BASE,
618 .membase = (char *)UART2_VIRT_BASE,
619 .irq = IRQ_MV78XX0_UART_2,
620 .flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF,
621 .iotype = UPIO_MEM,
622 .regshift = 2,
623 .uartclk = 0,
624 }, {
625 },
626};
627
628static struct resource mv78xx0_uart2_resources[] = {
629 {
630 .start = UART2_PHYS_BASE,
631 .end = UART2_PHYS_BASE + 0xff,
632 .flags = IORESOURCE_MEM,
633 }, {
634 .start = IRQ_MV78XX0_UART_2,
635 .end = IRQ_MV78XX0_UART_2,
636 .flags = IORESOURCE_IRQ,
637 },
638};
639
640static struct platform_device mv78xx0_uart2 = {
641 .name = "serial8250",
642 .id = 2,
643 .dev = {
644 .platform_data = mv78xx0_uart2_data,
645 },
646 .resource = mv78xx0_uart2_resources,
647 .num_resources = ARRAY_SIZE(mv78xx0_uart2_resources),
648};
649
650void __init mv78xx0_uart2_init(void)
651{
652 platform_device_register(&mv78xx0_uart2);
653}
654
655
656/*****************************************************************************
657 * UART3
658 ****************************************************************************/
659static struct plat_serial8250_port mv78xx0_uart3_data[] = {
660 {
661 .mapbase = UART3_PHYS_BASE,
662 .membase = (char *)UART3_VIRT_BASE,
663 .irq = IRQ_MV78XX0_UART_3,
664 .flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF,
665 .iotype = UPIO_MEM,
666 .regshift = 2,
667 .uartclk = 0,
668 }, {
669 },
670};
671
672static struct resource mv78xx0_uart3_resources[] = {
673 {
674 .start = UART3_PHYS_BASE,
675 .end = UART3_PHYS_BASE + 0xff,
676 .flags = IORESOURCE_MEM,
677 }, {
678 .start = IRQ_MV78XX0_UART_3,
679 .end = IRQ_MV78XX0_UART_3,
680 .flags = IORESOURCE_IRQ,
681 },
682};
683
684static struct platform_device mv78xx0_uart3 = {
685 .name = "serial8250",
686 .id = 3,
687 .dev = {
688 .platform_data = mv78xx0_uart3_data,
689 },
690 .resource = mv78xx0_uart3_resources,
691 .num_resources = ARRAY_SIZE(mv78xx0_uart3_resources),
692};
693
694void __init mv78xx0_uart3_init(void)
695{
696 platform_device_register(&mv78xx0_uart3);
697}
698
699
700/*****************************************************************************
701 * Time handling
702 ****************************************************************************/
703static void mv78xx0_timer_init(void)
704{
705 orion_time_init(IRQ_MV78XX0_TIMER_1, get_tclk());
706}
707
708struct sys_timer mv78xx0_timer = {
709 .init = mv78xx0_timer_init,
710};
711
712
713/*****************************************************************************
714 * General
715 ****************************************************************************/
716static int __init is_l2_writethrough(void)
717{
718 return !!(readl(CPU_CONTROL) & L2_WRITETHROUGH);
719}
720
721void __init mv78xx0_init(void)
722{
723 int core_index;
724 int hclk;
725 int pclk;
726 int l2clk;
727 int tclk;
728
729 core_index = mv78xx0_core_index();
730 hclk = get_hclk();
731 get_pclk_l2clk(hclk, core_index, &pclk, &l2clk);
732 tclk = get_tclk();
733
734 printk(KERN_INFO "MV78xx0 core #%d, ", core_index);
735 printk("PCLK = %dMHz, ", (pclk + 499999) / 1000000);
736 printk("L2 = %dMHz, ", (l2clk + 499999) / 1000000);
737 printk("HCLK = %dMHz, ", (hclk + 499999) / 1000000);
738 printk("TCLK = %dMHz\n", (tclk + 499999) / 1000000);
739
740 mv78xx0_setup_cpu_mbus();
741
742#ifdef CONFIG_CACHE_FEROCEON_L2
743 feroceon_l2_init(is_l2_writethrough());
744#endif
745
746 mv78xx0_ge00_shared_data.t_clk = tclk;
747 mv78xx0_ge01_shared_data.t_clk = tclk;
748 mv78xx0_ge10_shared_data.t_clk = tclk;
749 mv78xx0_ge11_shared_data.t_clk = tclk;
750 mv78xx0_uart0_data[0].uartclk = tclk;
751 mv78xx0_uart1_data[0].uartclk = tclk;
752 mv78xx0_uart2_data[0].uartclk = tclk;
753 mv78xx0_uart3_data[0].uartclk = tclk;
754}
diff --git a/arch/arm/mach-mv78xx0/common.h b/arch/arm/mach-mv78xx0/common.h
new file mode 100644
index 000000000000..78af5de319dd
--- /dev/null
+++ b/arch/arm/mach-mv78xx0/common.h
@@ -0,0 +1,49 @@
1/*
2 * arch/arm/mach-mv78xx0/common.h
3 *
4 * Core functions for Marvell MV78xx0 SoCs
5 *
6 * This file is licensed under the terms of the GNU General Public
7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied.
9 */
10
11#ifndef __ARCH_MV78XX0_COMMON_H
12#define __ARCH_MV78XX0_COMMON_H
13
14struct mv643xx_eth_platform_data;
15struct mv_sata_platform_data;
16
17/*
18 * Basic MV78xx0 init functions used early by machine-setup.
19 */
20int mv78xx0_core_index(void);
21void mv78xx0_map_io(void);
22void mv78xx0_init(void);
23void mv78xx0_init_irq(void);
24
25extern struct mbus_dram_target_info mv78xx0_mbus_dram_info;
26void mv78xx0_setup_cpu_mbus(void);
27void mv78xx0_setup_pcie_io_win(int window, u32 base, u32 size,
28 int maj, int min);
29void mv78xx0_setup_pcie_mem_win(int window, u32 base, u32 size,
30 int maj, int min);
31
32void mv78xx0_ehci0_init(void);
33void mv78xx0_ehci1_init(void);
34void mv78xx0_ehci2_init(void);
35void mv78xx0_ge00_init(struct mv643xx_eth_platform_data *eth_data);
36void mv78xx0_ge01_init(struct mv643xx_eth_platform_data *eth_data);
37void mv78xx0_ge10_init(struct mv643xx_eth_platform_data *eth_data);
38void mv78xx0_ge11_init(struct mv643xx_eth_platform_data *eth_data);
39void mv78xx0_pcie_init(int init_port0, int init_port1);
40void mv78xx0_sata_init(struct mv_sata_platform_data *sata_data);
41void mv78xx0_uart0_init(void);
42void mv78xx0_uart1_init(void);
43void mv78xx0_uart2_init(void);
44void mv78xx0_uart3_init(void);
45
46extern struct sys_timer mv78xx0_timer;
47
48
49#endif
diff --git a/arch/arm/mach-mv78xx0/db78x00-bp-setup.c b/arch/arm/mach-mv78xx0/db78x00-bp-setup.c
new file mode 100644
index 000000000000..0c93d19193df
--- /dev/null
+++ b/arch/arm/mach-mv78xx0/db78x00-bp-setup.c
@@ -0,0 +1,94 @@
1/*
2 * arch/arm/mach-mv78xx0/db78x00-bp-setup.c
3 *
4 * Marvell DB-78x00-BP Development Board Setup
5 *
6 * This file is licensed under the terms of the GNU General Public
7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied.
9 */
10
11#include <linux/kernel.h>
12#include <linux/init.h>
13#include <linux/platform_device.h>
14#include <linux/ata_platform.h>
15#include <linux/mv643xx_eth.h>
16#include <asm/arch/mv78xx0.h>
17#include <asm/mach-types.h>
18#include <asm/mach/arch.h>
19#include "common.h"
20
21static struct mv643xx_eth_platform_data db78x00_ge00_data = {
22 .phy_addr = 8,
23};
24
25static struct mv643xx_eth_platform_data db78x00_ge01_data = {
26 .phy_addr = 9,
27};
28
29static struct mv643xx_eth_platform_data db78x00_ge10_data = {
30 .phy_addr = -1,
31};
32
33static struct mv643xx_eth_platform_data db78x00_ge11_data = {
34 .phy_addr = -1,
35};
36
37static struct mv_sata_platform_data db78x00_sata_data = {
38 .n_ports = 2,
39};
40
41static void __init db78x00_init(void)
42{
43 /*
44 * Basic MV78xx0 setup. Needs to be called early.
45 */
46 mv78xx0_init();
47
48 /*
49 * Partition on-chip peripherals between the two CPU cores.
50 */
51 if (mv78xx0_core_index() == 0) {
52 mv78xx0_ehci0_init();
53 mv78xx0_ehci1_init();
54 mv78xx0_ehci2_init();
55 mv78xx0_ge00_init(&db78x00_ge00_data);
56 mv78xx0_ge01_init(&db78x00_ge01_data);
57 mv78xx0_ge10_init(&db78x00_ge10_data);
58 mv78xx0_ge11_init(&db78x00_ge11_data);
59 mv78xx0_sata_init(&db78x00_sata_data);
60 mv78xx0_uart0_init();
61 mv78xx0_uart2_init();
62 } else {
63 mv78xx0_uart1_init();
64 mv78xx0_uart3_init();
65 }
66}
67
68static int __init db78x00_pci_init(void)
69{
70 if (machine_is_db78x00_bp()) {
71 /*
72 * Assign the x16 PCIe slot on the board to CPU core
73 * #0, and let CPU core #1 have the four x1 slots.
74 */
75 if (mv78xx0_core_index() == 0)
76 mv78xx0_pcie_init(0, 1);
77 else
78 mv78xx0_pcie_init(1, 0);
79 }
80
81 return 0;
82}
83subsys_initcall(db78x00_pci_init);
84
85MACHINE_START(DB78X00_BP, "Marvell DB-78x00-BP Development Board")
86 /* Maintainer: Lennert Buytenhek <buytenh@marvell.com> */
87 .phys_io = MV78XX0_REGS_PHYS_BASE,
88 .io_pg_offst = ((MV78XX0_REGS_VIRT_BASE) >> 18) & 0xfffc,
89 .boot_params = 0x00000100,
90 .init_machine = db78x00_init,
91 .map_io = mv78xx0_map_io,
92 .init_irq = mv78xx0_init_irq,
93 .timer = &mv78xx0_timer,
94MACHINE_END
diff --git a/arch/arm/mach-mv78xx0/irq.c b/arch/arm/mach-mv78xx0/irq.c
new file mode 100644
index 000000000000..60f4ee4d4532
--- /dev/null
+++ b/arch/arm/mach-mv78xx0/irq.c
@@ -0,0 +1,22 @@
1/*
2 * arch/arm/mach-mv78xx0/irq.c
3 *
4 * MV78xx0 IRQ handling.
5 *
6 * This file is licensed under the terms of the GNU General Public
7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied.
9 */
10
11#include <linux/kernel.h>
12#include <linux/init.h>
13#include <linux/pci.h>
14#include <asm/arch/mv78xx0.h>
15#include <asm/plat-orion/irq.h>
16#include "common.h"
17
18void __init mv78xx0_init_irq(void)
19{
20 orion_irq_init(0, (void __iomem *)(IRQ_VIRT_BASE + IRQ_MASK_LOW_OFF));
21 orion_irq_init(32, (void __iomem *)(IRQ_VIRT_BASE + IRQ_MASK_HIGH_OFF));
22}
diff --git a/arch/arm/mach-mv78xx0/pcie.c b/arch/arm/mach-mv78xx0/pcie.c
new file mode 100644
index 000000000000..b78e1443159f
--- /dev/null
+++ b/arch/arm/mach-mv78xx0/pcie.c
@@ -0,0 +1,312 @@
1/*
2 * arch/arm/mach-mv78xx0/pcie.c
3 *
4 * PCIe functions for Marvell MV78xx0 SoCs
5 *
6 * This file is licensed under the terms of the GNU General Public
7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied.
9 */
10
11#include <linux/kernel.h>
12#include <linux/pci.h>
13#include <linux/mbus.h>
14#include <asm/mach/pci.h>
15#include <asm/plat-orion/pcie.h>
16#include "common.h"
17
18struct pcie_port {
19 u8 maj;
20 u8 min;
21 u8 root_bus_nr;
22 void __iomem *base;
23 spinlock_t conf_lock;
24 char io_space_name[16];
25 char mem_space_name[16];
26 struct resource res[2];
27};
28
29static struct pcie_port pcie_port[8];
30static int num_pcie_ports;
31static struct resource pcie_io_space;
32static struct resource pcie_mem_space;
33
34
35static void __init mv78xx0_pcie_preinit(void)
36{
37 int i;
38 u32 size_each;
39 u32 start;
40 int win;
41
42 pcie_io_space.name = "PCIe I/O Space";
43 pcie_io_space.start = MV78XX0_PCIE_IO_PHYS_BASE(0);
44 pcie_io_space.end =
45 MV78XX0_PCIE_IO_PHYS_BASE(0) + MV78XX0_PCIE_IO_SIZE * 8 - 1;
46 pcie_io_space.flags = IORESOURCE_IO;
47 if (request_resource(&iomem_resource, &pcie_io_space))
48 panic("can't allocate PCIe I/O space");
49
50 pcie_mem_space.name = "PCIe MEM Space";
51 pcie_mem_space.start = MV78XX0_PCIE_MEM_PHYS_BASE;
52 pcie_mem_space.end =
53 MV78XX0_PCIE_MEM_PHYS_BASE + MV78XX0_PCIE_MEM_SIZE - 1;
54 pcie_mem_space.flags = IORESOURCE_MEM;
55 if (request_resource(&iomem_resource, &pcie_mem_space))
56 panic("can't allocate PCIe MEM space");
57
58 for (i = 0; i < num_pcie_ports; i++) {
59 struct pcie_port *pp = pcie_port + i;
60
61 snprintf(pp->io_space_name, sizeof(pp->io_space_name),
62 "PCIe %d.%d I/O", pp->maj, pp->min);
63 pp->io_space_name[sizeof(pp->io_space_name) - 1] = 0;
64 pp->res[0].name = pp->io_space_name;
65 pp->res[0].start = MV78XX0_PCIE_IO_PHYS_BASE(i);
66 pp->res[0].end = pp->res[0].start + MV78XX0_PCIE_IO_SIZE - 1;
67 pp->res[0].flags = IORESOURCE_IO;
68
69 snprintf(pp->mem_space_name, sizeof(pp->mem_space_name),
70 "PCIe %d.%d MEM", pp->maj, pp->min);
71 pp->mem_space_name[sizeof(pp->mem_space_name) - 1] = 0;
72 pp->res[1].name = pp->mem_space_name;
73 pp->res[1].flags = IORESOURCE_MEM;
74 }
75
76 switch (num_pcie_ports) {
77 case 0:
78 size_each = 0;
79 break;
80
81 case 1:
82 size_each = 0x30000000;
83 break;
84
85 case 2 ... 3:
86 size_each = 0x10000000;
87 break;
88
89 case 4 ... 6:
90 size_each = 0x08000000;
91 break;
92
93 case 7:
94 size_each = 0x04000000;
95 break;
96
97 default:
98 panic("invalid number of PCIe ports");
99 }
100
101 start = MV78XX0_PCIE_MEM_PHYS_BASE;
102 for (i = 0; i < num_pcie_ports; i++) {
103 struct pcie_port *pp = pcie_port + i;
104
105 pp->res[1].start = start;
106 pp->res[1].end = start + size_each - 1;
107 start += size_each;
108 }
109
110 for (i = 0; i < num_pcie_ports; i++) {
111 struct pcie_port *pp = pcie_port + i;
112
113 if (request_resource(&pcie_io_space, &pp->res[0]))
114 panic("can't allocate PCIe I/O sub-space");
115
116 if (request_resource(&pcie_mem_space, &pp->res[1]))
117 panic("can't allocate PCIe MEM sub-space");
118 }
119
120 win = 0;
121 for (i = 0; i < num_pcie_ports; i++) {
122 struct pcie_port *pp = pcie_port + i;
123
124 mv78xx0_setup_pcie_io_win(win++, pp->res[0].start,
125 pp->res[0].end - pp->res[0].start + 1,
126 pp->maj, pp->min);
127
128 mv78xx0_setup_pcie_mem_win(win++, pp->res[1].start,
129 pp->res[1].end - pp->res[1].start + 1,
130 pp->maj, pp->min);
131 }
132}
133
134static int __init mv78xx0_pcie_setup(int nr, struct pci_sys_data *sys)
135{
136 struct pcie_port *pp;
137
138 if (nr >= num_pcie_ports)
139 return 0;
140
141 pp = &pcie_port[nr];
142 pp->root_bus_nr = sys->busnr;
143
144 /*
145 * Generic PCIe unit setup.
146 */
147 orion_pcie_set_local_bus_nr(pp->base, sys->busnr);
148 orion_pcie_setup(pp->base, &mv78xx0_mbus_dram_info);
149
150 sys->resource[0] = &pp->res[0];
151 sys->resource[1] = &pp->res[1];
152 sys->resource[2] = NULL;
153
154 return 1;
155}
156
157static struct pcie_port *bus_to_port(int bus)
158{
159 int i;
160
161 for (i = num_pcie_ports - 1; i >= 0; i--) {
162 int rbus = pcie_port[i].root_bus_nr;
163 if (rbus != -1 && rbus <= bus)
164 break;
165 }
166
167 return i >= 0 ? pcie_port + i : NULL;
168}
169
170static int pcie_valid_config(struct pcie_port *pp, int bus, int dev)
171{
172 /*
173 * Don't go out when trying to access nonexisting devices
174 * on the local bus.
175 */
176 if (bus == pp->root_bus_nr && dev > 1)
177 return 0;
178
179 return 1;
180}
181
182static int pcie_rd_conf(struct pci_bus *bus, u32 devfn, int where,
183 int size, u32 *val)
184{
185 struct pcie_port *pp = bus_to_port(bus->number);
186 unsigned long flags;
187 int ret;
188
189 if (pcie_valid_config(pp, bus->number, PCI_SLOT(devfn)) == 0) {
190 *val = 0xffffffff;
191 return PCIBIOS_DEVICE_NOT_FOUND;
192 }
193
194 spin_lock_irqsave(&pp->conf_lock, flags);
195 ret = orion_pcie_rd_conf(pp->base, bus, devfn, where, size, val);
196 spin_unlock_irqrestore(&pp->conf_lock, flags);
197
198 return ret;
199}
200
201static int pcie_wr_conf(struct pci_bus *bus, u32 devfn,
202 int where, int size, u32 val)
203{
204 struct pcie_port *pp = bus_to_port(bus->number);
205 unsigned long flags;
206 int ret;
207
208 if (pcie_valid_config(pp, bus->number, PCI_SLOT(devfn)) == 0)
209 return PCIBIOS_DEVICE_NOT_FOUND;
210
211 spin_lock_irqsave(&pp->conf_lock, flags);
212 ret = orion_pcie_wr_conf(pp->base, bus, devfn, where, size, val);
213 spin_unlock_irqrestore(&pp->conf_lock, flags);
214
215 return ret;
216}
217
218static struct pci_ops pcie_ops = {
219 .read = pcie_rd_conf,
220 .write = pcie_wr_conf,
221};
222
223static void __devinit rc_pci_fixup(struct pci_dev *dev)
224{
225 /*
226 * Prevent enumeration of root complex.
227 */
228 if (dev->bus->parent == NULL && dev->devfn == 0) {
229 int i;
230
231 for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) {
232 dev->resource[i].start = 0;
233 dev->resource[i].end = 0;
234 dev->resource[i].flags = 0;
235 }
236 }
237}
238DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_MARVELL, PCI_ANY_ID, rc_pci_fixup);
239
240static struct pci_bus __init *
241mv78xx0_pcie_scan_bus(int nr, struct pci_sys_data *sys)
242{
243 struct pci_bus *bus;
244
245 if (nr < num_pcie_ports) {
246 bus = pci_scan_bus(sys->busnr, &pcie_ops, sys);
247 } else {
248 bus = NULL;
249 BUG();
250 }
251
252 return bus;
253}
254
255static int __init mv78xx0_pcie_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
256{
257 struct pcie_port *pp = bus_to_port(dev->bus->number);
258
259 return IRQ_MV78XX0_PCIE_00 + (pp->maj << 2) + pp->min;
260}
261
262static struct hw_pci mv78xx0_pci __initdata = {
263 .nr_controllers = 8,
264 .preinit = mv78xx0_pcie_preinit,
265 .swizzle = pci_std_swizzle,
266 .setup = mv78xx0_pcie_setup,
267 .scan = mv78xx0_pcie_scan_bus,
268 .map_irq = mv78xx0_pcie_map_irq,
269};
270
271static void __init add_pcie_port(int maj, int min, unsigned long base)
272{
273 printk(KERN_INFO "MV78xx0 PCIe port %d.%d: ", maj, min);
274
275 if (orion_pcie_link_up((void __iomem *)base)) {
276 struct pcie_port *pp = &pcie_port[num_pcie_ports++];
277
278 printk("link up\n");
279
280 pp->maj = maj;
281 pp->min = min;
282 pp->root_bus_nr = -1;
283 pp->base = (void __iomem *)base;
284 spin_lock_init(&pp->conf_lock);
285 memset(pp->res, 0, sizeof(pp->res));
286 } else {
287 printk("link down, ignoring\n");
288 }
289}
290
291void __init mv78xx0_pcie_init(int init_port0, int init_port1)
292{
293 if (init_port0) {
294 add_pcie_port(0, 0, PCIE00_VIRT_BASE);
295 if (!orion_pcie_x4_mode((void __iomem *)PCIE00_VIRT_BASE)) {
296 add_pcie_port(0, 1, PCIE01_VIRT_BASE);
297 add_pcie_port(0, 2, PCIE02_VIRT_BASE);
298 add_pcie_port(0, 3, PCIE03_VIRT_BASE);
299 }
300 }
301
302 if (init_port1) {
303 add_pcie_port(1, 0, PCIE10_VIRT_BASE);
304 if (!orion_pcie_x4_mode((void __iomem *)PCIE10_VIRT_BASE)) {
305 add_pcie_port(1, 1, PCIE11_VIRT_BASE);
306 add_pcie_port(1, 2, PCIE12_VIRT_BASE);
307 add_pcie_port(1, 3, PCIE13_VIRT_BASE);
308 }
309 }
310
311 pci_common_init(&mv78xx0_pci);
312}
diff --git a/arch/arm/mach-omap1/Makefile b/arch/arm/mach-omap1/Makefile
index c06f5254c0f3..1bda8f5d7546 100644
--- a/arch/arm/mach-omap1/Makefile
+++ b/arch/arm/mach-omap1/Makefile
@@ -3,7 +3,9 @@
3# 3#
4 4
5# Common support 5# Common support
6obj-y := io.o id.o clock.o irq.o mux.o serial.o devices.o 6obj-y := io.o id.o sram.o clock.o irq.o mux.o serial.o devices.o
7
8obj-$(CONFIG_OMAP_MCBSP) += mcbsp.o
7 9
8obj-$(CONFIG_OMAP_MPU_TIMER) += time.o 10obj-$(CONFIG_OMAP_MPU_TIMER) += time.o
9obj-$(CONFIG_OMAP_32K_TIMER) += timer32k.o 11obj-$(CONFIG_OMAP_32K_TIMER) += timer32k.o
diff --git a/arch/arm/mach-omap1/board-nokia770.c b/arch/arm/mach-omap1/board-nokia770.c
index bcb984f2300f..3f39e0e79c9f 100644
--- a/arch/arm/mach-omap1/board-nokia770.c
+++ b/arch/arm/mach-omap1/board-nokia770.c
@@ -10,6 +10,7 @@
10 10
11#include <linux/kernel.h> 11#include <linux/kernel.h>
12#include <linux/init.h> 12#include <linux/init.h>
13#include <linux/mutex.h>
13#include <linux/platform_device.h> 14#include <linux/platform_device.h>
14#include <linux/input.h> 15#include <linux/input.h>
15#include <linux/clk.h> 16#include <linux/clk.h>
@@ -202,7 +203,7 @@ static struct omap_board_config_kernel nokia770_config[] __initdata = {
202#define AMPLIFIER_CTRL_GPIO 58 203#define AMPLIFIER_CTRL_GPIO 58
203 204
204static struct clk *dspxor_ck; 205static struct clk *dspxor_ck;
205static DECLARE_MUTEX(audio_pwr_sem); 206static DEFINE_MUTEX(audio_pwr_lock);
206/* 207/*
207 * audio_pwr_state 208 * audio_pwr_state
208 * +--+-------------------------+---------------------------------------+ 209 * +--+-------------------------+---------------------------------------+
@@ -218,7 +219,7 @@ static DECLARE_MUTEX(audio_pwr_sem);
218static int audio_pwr_state = -1; 219static int audio_pwr_state = -1;
219 220
220/* 221/*
221 * audio_pwr_up / down should be called under audio_pwr_sem 222 * audio_pwr_up / down should be called under audio_pwr_lock
222 */ 223 */
223static void nokia770_audio_pwr_up(void) 224static void nokia770_audio_pwr_up(void)
224{ 225{
@@ -237,11 +238,11 @@ static void nokia770_audio_pwr_up(void)
237 238
238static void codec_delayed_power_down(struct work_struct *work) 239static void codec_delayed_power_down(struct work_struct *work)
239{ 240{
240 down(&audio_pwr_sem); 241 mutex_lock(&audio_pwr_lock);
241 if (audio_pwr_state == -1) 242 if (audio_pwr_state == -1)
242 aic23_power_down(); 243 aic23_power_down();
243 clk_disable(dspxor_ck); 244 clk_disable(dspxor_ck);
244 up(&audio_pwr_sem); 245 mutex_unlock(&audio_pwr_lock);
245} 246}
246 247
247static DECLARE_DELAYED_WORK(codec_power_down_work, codec_delayed_power_down); 248static DECLARE_DELAYED_WORK(codec_power_down_work, codec_delayed_power_down);
@@ -258,19 +259,19 @@ static void nokia770_audio_pwr_down(void)
258static int 259static int
259nokia770_audio_pwr_up_request(struct dsp_kfunc_device *kdev, int stage) 260nokia770_audio_pwr_up_request(struct dsp_kfunc_device *kdev, int stage)
260{ 261{
261 down(&audio_pwr_sem); 262 mutex_lock(&audio_pwr_lock);
262 if (audio_pwr_state == -1) 263 if (audio_pwr_state == -1)
263 nokia770_audio_pwr_up(); 264 nokia770_audio_pwr_up();
264 /* force audio_pwr_state = 0, even if it was 1. */ 265 /* force audio_pwr_state = 0, even if it was 1. */
265 audio_pwr_state = 0; 266 audio_pwr_state = 0;
266 up(&audio_pwr_sem); 267 mutex_unlock(&audio_pwr_lock);
267 return 0; 268 return 0;
268} 269}
269 270
270static int 271static int
271nokia770_audio_pwr_down_request(struct dsp_kfunc_device *kdev, int stage) 272nokia770_audio_pwr_down_request(struct dsp_kfunc_device *kdev, int stage)
272{ 273{
273 down(&audio_pwr_sem); 274 mutex_lock(&audio_pwr_lock);
274 switch (stage) { 275 switch (stage) {
275 case 1: 276 case 1:
276 if (audio_pwr_state == 0) 277 if (audio_pwr_state == 0)
@@ -283,7 +284,7 @@ nokia770_audio_pwr_down_request(struct dsp_kfunc_device *kdev, int stage)
283 } 284 }
284 break; 285 break;
285 } 286 }
286 up(&audio_pwr_sem); 287 mutex_unlock(&audio_pwr_lock);
287 return 0; 288 return 0;
288} 289}
289 290
diff --git a/arch/arm/mach-omap1/board-osk.c b/arch/arm/mach-omap1/board-osk.c
index a66505f58b15..845c66371ca3 100644
--- a/arch/arm/mach-omap1/board-osk.c
+++ b/arch/arm/mach-omap1/board-osk.c
@@ -267,13 +267,17 @@ static struct i2c_board_info __initdata osk_i2c_board_info[] = {
267 267
268static void __init osk_init_smc91x(void) 268static void __init osk_init_smc91x(void)
269{ 269{
270 u32 l;
271
270 if ((gpio_request(0, "smc_irq")) < 0) { 272 if ((gpio_request(0, "smc_irq")) < 0) {
271 printk("Error requesting gpio 0 for smc91x irq\n"); 273 printk("Error requesting gpio 0 for smc91x irq\n");
272 return; 274 return;
273 } 275 }
274 276
275 /* Check EMIFS wait states to fix errors with SMC_GET_PKT_HDR */ 277 /* Check EMIFS wait states to fix errors with SMC_GET_PKT_HDR */
276 EMIFS_CCS(1) |= 0x3; 278 l = omap_readl(EMIFS_CCS(1));
279 l |= 0x3;
280 omap_writel(l, EMIFS_CCS(1));
277} 281}
278 282
279static void __init osk_init_cf(void) 283static void __init osk_init_cf(void)
@@ -526,20 +530,26 @@ static void __init osk_mistral_init(void) { }
526 530
527static void __init osk_init(void) 531static void __init osk_init(void)
528{ 532{
533 u32 l;
534
529 /* Workaround for wrong CS3 (NOR flash) timing 535 /* Workaround for wrong CS3 (NOR flash) timing
530 * There are some U-Boot versions out there which configure 536 * There are some U-Boot versions out there which configure
531 * wrong CS3 memory timings. This mainly leads to CRC 537 * wrong CS3 memory timings. This mainly leads to CRC
532 * or similar errors if you use NOR flash (e.g. with JFFS2) 538 * or similar errors if you use NOR flash (e.g. with JFFS2)
533 */ 539 */
534 if (EMIFS_CCS(3) != EMIFS_CS3_VAL) 540 l = omap_readl(EMIFS_CCS(3));
535 EMIFS_CCS(3) = EMIFS_CS3_VAL; 541 if (l != EMIFS_CS3_VAL)
542 omap_writel(EMIFS_CS3_VAL, EMIFS_CCS(3));
536 543
537 osk_flash_resource.end = osk_flash_resource.start = omap_cs3_phys(); 544 osk_flash_resource.end = osk_flash_resource.start = omap_cs3_phys();
538 osk_flash_resource.end += SZ_32M - 1; 545 osk_flash_resource.end += SZ_32M - 1;
539 platform_add_devices(osk5912_devices, ARRAY_SIZE(osk5912_devices)); 546 platform_add_devices(osk5912_devices, ARRAY_SIZE(osk5912_devices));
540 omap_board_config = osk_config; 547 omap_board_config = osk_config;
541 omap_board_config_size = ARRAY_SIZE(osk_config); 548 omap_board_config_size = ARRAY_SIZE(osk_config);
542 USB_TRANSCEIVER_CTRL_REG |= (3 << 1); 549
550 l = omap_readl(USB_TRANSCEIVER_CTRL);
551 l |= (3 << 1);
552 omap_writel(l, USB_TRANSCEIVER_CTRL);
543 553
544 /* irq for tps65010 chip */ 554 /* irq for tps65010 chip */
545 /* bootloader effectively does: omap_cfg_reg(U19_1610_MPUIO1); */ 555 /* bootloader effectively does: omap_cfg_reg(U19_1610_MPUIO1); */
diff --git a/arch/arm/mach-omap1/fpga.c b/arch/arm/mach-omap1/fpga.c
index 30e188109046..0cf62ef5ecb7 100644
--- a/arch/arm/mach-omap1/fpga.c
+++ b/arch/arm/mach-omap1/fpga.c
@@ -32,7 +32,7 @@
32 32
33static void fpga_mask_irq(unsigned int irq) 33static void fpga_mask_irq(unsigned int irq)
34{ 34{
35 irq -= OMAP1510_IH_FPGA_BASE; 35 irq -= OMAP_FPGA_IRQ_BASE;
36 36
37 if (irq < 8) 37 if (irq < 8)
38 __raw_writeb((__raw_readb(OMAP1510_FPGA_IMR_LO) 38 __raw_writeb((__raw_readb(OMAP1510_FPGA_IMR_LO)
@@ -65,7 +65,7 @@ static void fpga_ack_irq(unsigned int irq)
65 65
66static void fpga_unmask_irq(unsigned int irq) 66static void fpga_unmask_irq(unsigned int irq)
67{ 67{
68 irq -= OMAP1510_IH_FPGA_BASE; 68 irq -= OMAP_FPGA_IRQ_BASE;
69 69
70 if (irq < 8) 70 if (irq < 8)
71 __raw_writeb((__raw_readb(OMAP1510_FPGA_IMR_LO) | (1 << irq)), 71 __raw_writeb((__raw_readb(OMAP1510_FPGA_IMR_LO) | (1 << irq)),
@@ -95,8 +95,8 @@ void innovator_fpga_IRQ_demux(unsigned int irq, struct irq_desc *desc)
95 if (!stat) 95 if (!stat)
96 return; 96 return;
97 97
98 for (fpga_irq = OMAP1510_IH_FPGA_BASE; 98 for (fpga_irq = OMAP_FPGA_IRQ_BASE;
99 (fpga_irq < (OMAP1510_IH_FPGA_BASE + NR_FPGA_IRQS)) && stat; 99 (fpga_irq < OMAP_FPGA_IRQ_END) && stat;
100 fpga_irq++, stat >>= 1) { 100 fpga_irq++, stat >>= 1) {
101 if (stat & 1) { 101 if (stat & 1) {
102 d = irq_desc + fpga_irq; 102 d = irq_desc + fpga_irq;
@@ -151,7 +151,7 @@ void omap1510_fpga_init_irq(void)
151 __raw_writeb(0, OMAP1510_FPGA_IMR_HI); 151 __raw_writeb(0, OMAP1510_FPGA_IMR_HI);
152 __raw_writeb(0, INNOVATOR_FPGA_IMR2); 152 __raw_writeb(0, INNOVATOR_FPGA_IMR2);
153 153
154 for (i = OMAP1510_IH_FPGA_BASE; i < (OMAP1510_IH_FPGA_BASE + NR_FPGA_IRQS); i++) { 154 for (i = OMAP_FPGA_IRQ_BASE; i < OMAP_FPGA_IRQ_END; i++) {
155 155
156 if (i == OMAP1510_INT_FPGA_TS) { 156 if (i == OMAP1510_INT_FPGA_TS) {
157 /* 157 /*
diff --git a/arch/arm/mach-omap1/mcbsp.c b/arch/arm/mach-omap1/mcbsp.c
new file mode 100644
index 000000000000..2d2c2522b048
--- /dev/null
+++ b/arch/arm/mach-omap1/mcbsp.c
@@ -0,0 +1,280 @@
1/*
2 * linux/arch/arm/mach-omap1/mcbsp.c
3 *
4 * Copyright (C) 2008 Instituto Nokia de Tecnologia
5 * Contact: Eduardo Valentin <eduardo.valentin@indt.org.br>
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 version 2 as
9 * published by the Free Software Foundation.
10 *
11 * Multichannel mode not supported.
12 */
13#include <linux/module.h>
14#include <linux/init.h>
15#include <linux/clk.h>
16#include <linux/err.h>
17#include <linux/io.h>
18#include <linux/platform_device.h>
19
20#include <asm/arch/dma.h>
21#include <asm/arch/mux.h>
22#include <asm/arch/cpu.h>
23#include <asm/arch/mcbsp.h>
24#include <asm/arch/dsp_common.h>
25
26#define DPS_RSTCT2_PER_EN (1 << 0)
27#define DSP_RSTCT2_WD_PER_EN (1 << 1)
28
29struct mcbsp_internal_clk {
30 struct clk clk;
31 struct clk **childs;
32 int n_childs;
33};
34
35#if defined(CONFIG_ARCH_OMAP15XX) || defined(CONFIG_ARCH_OMAP16XX)
36static void omap_mcbsp_clk_init(struct mcbsp_internal_clk *mclk)
37{
38 const char *clk_names[] = { "dsp_ck", "api_ck", "dspxor_ck" };
39 int i;
40
41 mclk->n_childs = ARRAY_SIZE(clk_names);
42 mclk->childs = kzalloc(mclk->n_childs * sizeof(struct clk *),
43 GFP_KERNEL);
44
45 for (i = 0; i < mclk->n_childs; i++) {
46 /* We fake a platform device to get correct device id */
47 struct platform_device pdev;
48
49 pdev.dev.bus = &platform_bus_type;
50 pdev.id = mclk->clk.id;
51 mclk->childs[i] = clk_get(&pdev.dev, clk_names[i]);
52 if (IS_ERR(mclk->childs[i]))
53 printk(KERN_ERR "Could not get clock %s (%d).\n",
54 clk_names[i], mclk->clk.id);
55 }
56}
57
58static int omap_mcbsp_clk_enable(struct clk *clk)
59{
60 struct mcbsp_internal_clk *mclk = container_of(clk,
61 struct mcbsp_internal_clk, clk);
62 int i;
63
64 for (i = 0; i < mclk->n_childs; i++)
65 clk_enable(mclk->childs[i]);
66 return 0;
67}
68
69static void omap_mcbsp_clk_disable(struct clk *clk)
70{
71 struct mcbsp_internal_clk *mclk = container_of(clk,
72 struct mcbsp_internal_clk, clk);
73 int i;
74
75 for (i = 0; i < mclk->n_childs; i++)
76 clk_disable(mclk->childs[i]);
77}
78
79static struct mcbsp_internal_clk omap_mcbsp_clks[] = {
80 {
81 .clk = {
82 .name = "mcbsp_clk",
83 .id = 1,
84 .enable = omap_mcbsp_clk_enable,
85 .disable = omap_mcbsp_clk_disable,
86 },
87 },
88 {
89 .clk = {
90 .name = "mcbsp_clk",
91 .id = 3,
92 .enable = omap_mcbsp_clk_enable,
93 .disable = omap_mcbsp_clk_disable,
94 },
95 },
96};
97
98#define omap_mcbsp_clks_size ARRAY_SIZE(omap_mcbsp_clks)
99#else
100#define omap_mcbsp_clks_size 0
101static struct mcbsp_internal_clk __initdata *omap_mcbsp_clks;
102static inline void omap_mcbsp_clk_init(struct mcbsp_internal_clk *mclk)
103{ }
104#endif
105
106static int omap1_mcbsp_check(unsigned int id)
107{
108 /* REVISIT: Check correctly for number of registered McBSPs */
109 if (cpu_is_omap730()) {
110 if (id > OMAP_MAX_MCBSP_COUNT - 2) {
111 printk(KERN_ERR "OMAP-McBSP: McBSP%d doesn't exist\n",
112 id + 1);
113 return -ENODEV;
114 }
115 return 0;
116 }
117
118 if (cpu_is_omap15xx() || cpu_is_omap16xx()) {
119 if (id > OMAP_MAX_MCBSP_COUNT - 1) {
120 printk(KERN_ERR "OMAP-McBSP: McBSP%d doesn't exist\n",
121 id + 1);
122 return -ENODEV;
123 }
124 return 0;
125 }
126
127 return -ENODEV;
128}
129
130static void omap1_mcbsp_request(unsigned int id)
131{
132 /*
133 * On 1510, 1610 and 1710, McBSP1 and McBSP3
134 * are DSP public peripherals.
135 */
136 if (id == OMAP_MCBSP1 || id == OMAP_MCBSP3) {
137 omap_dsp_request_mem();
138 /*
139 * DSP external peripheral reset
140 * FIXME: This should be moved to dsp code
141 */
142 __raw_writew(__raw_readw(DSP_RSTCT2) | DPS_RSTCT2_PER_EN |
143 DSP_RSTCT2_WD_PER_EN, DSP_RSTCT2);
144 }
145}
146
147static void omap1_mcbsp_free(unsigned int id)
148{
149 if (id == OMAP_MCBSP1 || id == OMAP_MCBSP3)
150 omap_dsp_release_mem();
151}
152
153static struct omap_mcbsp_ops omap1_mcbsp_ops = {
154 .check = omap1_mcbsp_check,
155 .request = omap1_mcbsp_request,
156 .free = omap1_mcbsp_free,
157};
158
159#ifdef CONFIG_ARCH_OMAP730
160static struct omap_mcbsp_platform_data omap730_mcbsp_pdata[] = {
161 {
162 .virt_base = io_p2v(OMAP730_MCBSP1_BASE),
163 .dma_rx_sync = OMAP_DMA_MCBSP1_RX,
164 .dma_tx_sync = OMAP_DMA_MCBSP1_TX,
165 .rx_irq = INT_730_McBSP1RX,
166 .tx_irq = INT_730_McBSP1TX,
167 .ops = &omap1_mcbsp_ops,
168 },
169 {
170 .virt_base = io_p2v(OMAP730_MCBSP2_BASE),
171 .dma_rx_sync = OMAP_DMA_MCBSP3_RX,
172 .dma_tx_sync = OMAP_DMA_MCBSP3_TX,
173 .rx_irq = INT_730_McBSP2RX,
174 .tx_irq = INT_730_McBSP2TX,
175 .ops = &omap1_mcbsp_ops,
176 },
177};
178#define OMAP730_MCBSP_PDATA_SZ ARRAY_SIZE(omap730_mcbsp_pdata)
179#else
180#define omap730_mcbsp_pdata NULL
181#define OMAP730_MCBSP_PDATA_SZ 0
182#endif
183
184#ifdef CONFIG_ARCH_OMAP15XX
185static struct omap_mcbsp_platform_data omap15xx_mcbsp_pdata[] = {
186 {
187 .virt_base = OMAP1510_MCBSP1_BASE,
188 .dma_rx_sync = OMAP_DMA_MCBSP1_RX,
189 .dma_tx_sync = OMAP_DMA_MCBSP1_TX,
190 .rx_irq = INT_McBSP1RX,
191 .tx_irq = INT_McBSP1TX,
192 .ops = &omap1_mcbsp_ops,
193 .clk_name = "mcbsp_clk",
194 },
195 {
196 .virt_base = io_p2v(OMAP1510_MCBSP2_BASE),
197 .dma_rx_sync = OMAP_DMA_MCBSP2_RX,
198 .dma_tx_sync = OMAP_DMA_MCBSP2_TX,
199 .rx_irq = INT_1510_SPI_RX,
200 .tx_irq = INT_1510_SPI_TX,
201 .ops = &omap1_mcbsp_ops,
202 },
203 {
204 .virt_base = OMAP1510_MCBSP3_BASE,
205 .dma_rx_sync = OMAP_DMA_MCBSP3_RX,
206 .dma_tx_sync = OMAP_DMA_MCBSP3_TX,
207 .rx_irq = INT_McBSP3RX,
208 .tx_irq = INT_McBSP3TX,
209 .ops = &omap1_mcbsp_ops,
210 .clk_name = "mcbsp_clk",
211 },
212};
213#define OMAP15XX_MCBSP_PDATA_SZ ARRAY_SIZE(omap15xx_mcbsp_pdata)
214#else
215#define omap15xx_mcbsp_pdata NULL
216#define OMAP15XX_MCBSP_PDATA_SZ 0
217#endif
218
219#ifdef CONFIG_ARCH_OMAP16XX
220static struct omap_mcbsp_platform_data omap16xx_mcbsp_pdata[] = {
221 {
222 .virt_base = OMAP1610_MCBSP1_BASE,
223 .dma_rx_sync = OMAP_DMA_MCBSP1_RX,
224 .dma_tx_sync = OMAP_DMA_MCBSP1_TX,
225 .rx_irq = INT_McBSP1RX,
226 .tx_irq = INT_McBSP1TX,
227 .ops = &omap1_mcbsp_ops,
228 .clk_name = "mcbsp_clk",
229 },
230 {
231 .virt_base = io_p2v(OMAP1610_MCBSP2_BASE),
232 .dma_rx_sync = OMAP_DMA_MCBSP2_RX,
233 .dma_tx_sync = OMAP_DMA_MCBSP2_TX,
234 .rx_irq = INT_1610_McBSP2_RX,
235 .tx_irq = INT_1610_McBSP2_TX,
236 .ops = &omap1_mcbsp_ops,
237 },
238 {
239 .virt_base = OMAP1610_MCBSP3_BASE,
240 .dma_rx_sync = OMAP_DMA_MCBSP3_RX,
241 .dma_tx_sync = OMAP_DMA_MCBSP3_TX,
242 .rx_irq = INT_McBSP3RX,
243 .tx_irq = INT_McBSP3TX,
244 .ops = &omap1_mcbsp_ops,
245 .clk_name = "mcbsp_clk",
246 },
247};
248#define OMAP16XX_MCBSP_PDATA_SZ ARRAY_SIZE(omap16xx_mcbsp_pdata)
249#else
250#define omap16xx_mcbsp_pdata NULL
251#define OMAP16XX_MCBSP_PDATA_SZ 0
252#endif
253
254int __init omap1_mcbsp_init(void)
255{
256 int i;
257
258 for (i = 0; i < omap_mcbsp_clks_size; i++) {
259 if (cpu_is_omap15xx() || cpu_is_omap16xx()) {
260 omap_mcbsp_clk_init(&omap_mcbsp_clks[i]);
261 clk_register(&omap_mcbsp_clks[i].clk);
262 }
263 }
264
265 if (cpu_is_omap730())
266 omap_mcbsp_register_board_cfg(omap730_mcbsp_pdata,
267 OMAP730_MCBSP_PDATA_SZ);
268
269 if (cpu_is_omap15xx())
270 omap_mcbsp_register_board_cfg(omap15xx_mcbsp_pdata,
271 OMAP15XX_MCBSP_PDATA_SZ);
272
273 if (cpu_is_omap16xx())
274 omap_mcbsp_register_board_cfg(omap16xx_mcbsp_pdata,
275 OMAP16XX_MCBSP_PDATA_SZ);
276
277 return omap_mcbsp_init();
278}
279
280arch_initcall(omap1_mcbsp_init);
diff --git a/arch/arm/mach-omap1/pm.c b/arch/arm/mach-omap1/pm.c
index e6c64e10b7ec..742f79e73bd7 100644
--- a/arch/arm/mach-omap1/pm.c
+++ b/arch/arm/mach-omap1/pm.c
@@ -116,13 +116,6 @@ void omap_pm_idle(void)
116 return; 116 return;
117 } 117 }
118 118
119 /*
120 * Since an interrupt may set up a timer, we don't want to
121 * reprogram the hardware timer with interrupts enabled.
122 * Re-enable interrupts only after returning from idle.
123 */
124 timer_dyn_reprogram();
125
126#ifdef CONFIG_OMAP_MPU_TIMER 119#ifdef CONFIG_OMAP_MPU_TIMER
127#warning Enable 32kHz OS timer in order to allow sleep states in idle 120#warning Enable 32kHz OS timer in order to allow sleep states in idle
128 use_idlect1 = use_idlect1 & ~(1 << 9); 121 use_idlect1 = use_idlect1 & ~(1 << 9);
diff --git a/arch/arm/plat-omap/sram-fn.S b/arch/arm/mach-omap1/sram.S
index 9e1813c77e05..126d252062d7 100644
--- a/arch/arm/plat-omap/sram-fn.S
+++ b/arch/arm/mach-omap1/sram.S
@@ -18,7 +18,7 @@
18/* 18/*
19 * Reprograms ULPD and CKCTL. 19 * Reprograms ULPD and CKCTL.
20 */ 20 */
21ENTRY(sram_reprogram_clock) 21ENTRY(omap1_sram_reprogram_clock)
22 stmfd sp!, {r0 - r12, lr} @ save registers on stack 22 stmfd sp!, {r0 - r12, lr} @ save registers on stack
23 23
24 mov r2, #IO_ADDRESS(DPLL_CTL) & 0xff000000 24 mov r2, #IO_ADDRESS(DPLL_CTL) & 0xff000000
@@ -53,5 +53,5 @@ lock: ldrh r4, [r2], #0 @ read back dpll value
53 53
54out: 54out:
55 ldmfd sp!, {r0 - r12, pc} @ restore regs and return 55 ldmfd sp!, {r0 - r12, pc} @ restore regs and return
56ENTRY(sram_reprogram_clock_sz) 56ENTRY(omap1_sram_reprogram_clock_sz)
57 .word . - sram_reprogram_clock 57 .word . - omap1_sram_reprogram_clock
diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
index 2feb6870b735..93ee990618ef 100644
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -3,9 +3,15 @@
3# 3#
4 4
5# Common support 5# Common support
6obj-y := irq.o id.o io.o sram-fn.o memory.o control.o prcm.o clock.o mux.o \ 6obj-y := irq.o id.o io.o memory.o control.o prcm.o clock.o mux.o \
7 devices.o serial.o gpmc.o timer-gp.o 7 devices.o serial.o gpmc.o timer-gp.o
8 8
9obj-$(CONFIG_OMAP_MCBSP) += mcbsp.o
10
11# Functions loaded to SRAM
12obj-$(CONFIG_ARCH_OMAP2420) += sram242x.o
13obj-$(CONFIG_ARCH_OMAP2430) += sram243x.o
14
9# Power Management 15# Power Management
10obj-$(CONFIG_PM) += pm.o sleep.o 16obj-$(CONFIG_PM) += pm.o sleep.o
11 17
diff --git a/arch/arm/mach-omap2/clock.c b/arch/arm/mach-omap2/clock.c
index ab9fc57d25f1..15675bce8012 100644
--- a/arch/arm/mach-omap2/clock.c
+++ b/arch/arm/mach-omap2/clock.c
@@ -41,6 +41,24 @@
41 41
42#define MAX_CLOCK_ENABLE_WAIT 100000 42#define MAX_CLOCK_ENABLE_WAIT 100000
43 43
44/* DPLL rate rounding: minimum DPLL multiplier, divider values */
45#define DPLL_MIN_MULTIPLIER 1
46#define DPLL_MIN_DIVIDER 1
47
48/* Possible error results from _dpll_test_mult */
49#define DPLL_MULT_UNDERFLOW (1 << 0)
50
51/*
52 * Scale factor to mitigate roundoff errors in DPLL rate rounding.
53 * The higher the scale factor, the greater the risk of arithmetic overflow,
54 * but the closer the rounded rate to the target rate. DPLL_SCALE_FACTOR
55 * must be a power of DPLL_SCALE_BASE.
56 */
57#define DPLL_SCALE_FACTOR 64
58#define DPLL_SCALE_BASE 2
59#define DPLL_ROUNDING_VAL ((DPLL_SCALE_BASE / 2) * \
60 (DPLL_SCALE_FACTOR / DPLL_SCALE_BASE))
61
44u8 cpu_mask; 62u8 cpu_mask;
45 63
46/*------------------------------------------------------------------------- 64/*-------------------------------------------------------------------------
@@ -95,7 +113,7 @@ u32 omap2_get_dpll_rate(struct clk *clk)
95{ 113{
96 long long dpll_clk; 114 long long dpll_clk;
97 u32 dpll_mult, dpll_div, dpll; 115 u32 dpll_mult, dpll_div, dpll;
98 const struct dpll_data *dd; 116 struct dpll_data *dd;
99 117
100 dd = clk->dpll_data; 118 dd = clk->dpll_data;
101 /* REVISIT: What do we return on error? */ 119 /* REVISIT: What do we return on error? */
@@ -603,7 +621,8 @@ int omap2_clksel_set_rate(struct clk *clk, unsigned long rate)
603 clk->rate = clk->parent->rate / new_div; 621 clk->rate = clk->parent->rate / new_div;
604 622
605 if (clk->flags & DELAYED_APP && cpu_is_omap24xx()) { 623 if (clk->flags & DELAYED_APP && cpu_is_omap24xx()) {
606 __raw_writel(OMAP24XX_VALID_CONFIG, OMAP24XX_PRCM_CLKCFG_CTRL); 624 prm_write_mod_reg(OMAP24XX_VALID_CONFIG,
625 OMAP24XX_GR_MOD, OMAP24XX_PRCM_CLKCFG_CTRL_OFFSET);
607 wmb(); 626 wmb();
608 } 627 }
609 628
@@ -723,6 +742,184 @@ int omap2_clk_set_parent(struct clk *clk, struct clk *new_parent)
723 return 0; 742 return 0;
724} 743}
725 744
745/* DPLL rate rounding code */
746
747/**
748 * omap2_dpll_set_rate_tolerance: set the error tolerance during rate rounding
749 * @clk: struct clk * of the DPLL
750 * @tolerance: maximum rate error tolerance
751 *
752 * Set the maximum DPLL rate error tolerance for the rate rounding
753 * algorithm. The rate tolerance is an attempt to balance DPLL power
754 * saving (the least divider value "n") vs. rate fidelity (the least
755 * difference between the desired DPLL target rate and the rounded
756 * rate out of the algorithm). So, increasing the tolerance is likely
757 * to decrease DPLL power consumption and increase DPLL rate error.
758 * Returns -EINVAL if provided a null clock ptr or a clk that is not a
759 * DPLL; or 0 upon success.
760 */
761int omap2_dpll_set_rate_tolerance(struct clk *clk, unsigned int tolerance)
762{
763 if (!clk || !clk->dpll_data)
764 return -EINVAL;
765
766 clk->dpll_data->rate_tolerance = tolerance;
767
768 return 0;
769}
770
771static unsigned long _dpll_compute_new_rate(unsigned long parent_rate, unsigned int m, unsigned int n)
772{
773 unsigned long long num;
774
775 num = (unsigned long long)parent_rate * m;
776 do_div(num, n);
777 return num;
778}
779
780/*
781 * _dpll_test_mult - test a DPLL multiplier value
782 * @m: pointer to the DPLL m (multiplier) value under test
783 * @n: current DPLL n (divider) value under test
784 * @new_rate: pointer to storage for the resulting rounded rate
785 * @target_rate: the desired DPLL rate
786 * @parent_rate: the DPLL's parent clock rate
787 *
788 * This code tests a DPLL multiplier value, ensuring that the
789 * resulting rate will not be higher than the target_rate, and that
790 * the multiplier value itself is valid for the DPLL. Initially, the
791 * integer pointed to by the m argument should be prescaled by
792 * multiplying by DPLL_SCALE_FACTOR. The code will replace this with
793 * a non-scaled m upon return. This non-scaled m will result in a
794 * new_rate as close as possible to target_rate (but not greater than
795 * target_rate) given the current (parent_rate, n, prescaled m)
796 * triple. Returns DPLL_MULT_UNDERFLOW in the event that the
797 * non-scaled m attempted to underflow, which can allow the calling
798 * function to bail out early; or 0 upon success.
799 */
800static int _dpll_test_mult(int *m, int n, unsigned long *new_rate,
801 unsigned long target_rate,
802 unsigned long parent_rate)
803{
804 int flags = 0, carry = 0;
805
806 /* Unscale m and round if necessary */
807 if (*m % DPLL_SCALE_FACTOR >= DPLL_ROUNDING_VAL)
808 carry = 1;
809 *m = (*m / DPLL_SCALE_FACTOR) + carry;
810
811 /*
812 * The new rate must be <= the target rate to avoid programming
813 * a rate that is impossible for the hardware to handle
814 */
815 *new_rate = _dpll_compute_new_rate(parent_rate, *m, n);
816 if (*new_rate > target_rate) {
817 (*m)--;
818 *new_rate = 0;
819 }
820
821 /* Guard against m underflow */
822 if (*m < DPLL_MIN_MULTIPLIER) {
823 *m = DPLL_MIN_MULTIPLIER;
824 *new_rate = 0;
825 flags = DPLL_MULT_UNDERFLOW;
826 }
827
828 if (*new_rate == 0)
829 *new_rate = _dpll_compute_new_rate(parent_rate, *m, n);
830
831 return flags;
832}
833
834/**
835 * omap2_dpll_round_rate - round a target rate for an OMAP DPLL
836 * @clk: struct clk * for a DPLL
837 * @target_rate: desired DPLL clock rate
838 *
839 * Given a DPLL, a desired target rate, and a rate tolerance, round
840 * the target rate to a possible, programmable rate for this DPLL.
841 * Rate tolerance is assumed to be set by the caller before this
842 * function is called. Attempts to select the minimum possible n
843 * within the tolerance to reduce power consumption. Stores the
844 * computed (m, n) in the DPLL's dpll_data structure so set_rate()
845 * will not need to call this (expensive) function again. Returns ~0
846 * if the target rate cannot be rounded, either because the rate is
847 * too low or because the rate tolerance is set too tightly; or the
848 * rounded rate upon success.
849 */
850long omap2_dpll_round_rate(struct clk *clk, unsigned long target_rate)
851{
852 int m, n, r, e, scaled_max_m;
853 unsigned long scaled_rt_rp, new_rate;
854 int min_e = -1, min_e_m = -1, min_e_n = -1;
855
856 if (!clk || !clk->dpll_data)
857 return ~0;
858
859 pr_debug("clock: starting DPLL round_rate for clock %s, target rate "
860 "%ld\n", clk->name, target_rate);
861
862 scaled_rt_rp = target_rate / (clk->parent->rate / DPLL_SCALE_FACTOR);
863 scaled_max_m = clk->dpll_data->max_multiplier * DPLL_SCALE_FACTOR;
864
865 clk->dpll_data->last_rounded_rate = 0;
866
867 for (n = clk->dpll_data->max_divider; n >= DPLL_MIN_DIVIDER; n--) {
868
869 /* Compute the scaled DPLL multiplier, based on the divider */
870 m = scaled_rt_rp * n;
871
872 /*
873 * Since we're counting n down, a m overflow means we can
874 * can immediately skip to the next n
875 */
876 if (m > scaled_max_m)
877 continue;
878
879 r = _dpll_test_mult(&m, n, &new_rate, target_rate,
880 clk->parent->rate);
881
882 e = target_rate - new_rate;
883 pr_debug("clock: n = %d: m = %d: rate error is %d "
884 "(new_rate = %ld)\n", n, m, e, new_rate);
885
886 if (min_e == -1 ||
887 min_e >= (int)(abs(e) - clk->dpll_data->rate_tolerance)) {
888 min_e = e;
889 min_e_m = m;
890 min_e_n = n;
891
892 pr_debug("clock: found new least error %d\n", min_e);
893 }
894
895 /*
896 * Since we're counting n down, a m underflow means we
897 * can bail out completely (since as n decreases in
898 * the next iteration, there's no way that m can
899 * increase beyond the current m)
900 */
901 if (r & DPLL_MULT_UNDERFLOW)
902 break;
903 }
904
905 if (min_e < 0) {
906 pr_debug("clock: error: target rate or tolerance too low\n");
907 return ~0;
908 }
909
910 clk->dpll_data->last_rounded_m = min_e_m;
911 clk->dpll_data->last_rounded_n = min_e_n;
912 clk->dpll_data->last_rounded_rate =
913 _dpll_compute_new_rate(clk->parent->rate, min_e_m, min_e_n);
914
915 pr_debug("clock: final least error: e = %d, m = %d, n = %d\n",
916 min_e, min_e_m, min_e_n);
917 pr_debug("clock: final rate: %ld (target rate: %ld)\n",
918 clk->dpll_data->last_rounded_rate, target_rate);
919
920 return clk->dpll_data->last_rounded_rate;
921}
922
726/*------------------------------------------------------------------------- 923/*-------------------------------------------------------------------------
727 * Omap2 clock reset and init functions 924 * Omap2 clock reset and init functions
728 *-------------------------------------------------------------------------*/ 925 *-------------------------------------------------------------------------*/
diff --git a/arch/arm/mach-omap2/clock.h b/arch/arm/mach-omap2/clock.h
index d5980a9e09a4..3cd37cb57c5a 100644
--- a/arch/arm/mach-omap2/clock.h
+++ b/arch/arm/mach-omap2/clock.h
@@ -18,11 +18,16 @@
18 18
19#include <asm/arch/clock.h> 19#include <asm/arch/clock.h>
20 20
21/* The maximum error between a target DPLL rate and the rounded rate in Hz */
22#define DEFAULT_DPLL_RATE_TOLERANCE 50000
23
21int omap2_clk_enable(struct clk *clk); 24int omap2_clk_enable(struct clk *clk);
22void omap2_clk_disable(struct clk *clk); 25void omap2_clk_disable(struct clk *clk);
23long omap2_clk_round_rate(struct clk *clk, unsigned long rate); 26long omap2_clk_round_rate(struct clk *clk, unsigned long rate);
24int omap2_clk_set_rate(struct clk *clk, unsigned long rate); 27int omap2_clk_set_rate(struct clk *clk, unsigned long rate);
25int omap2_clk_set_parent(struct clk *clk, struct clk *new_parent); 28int omap2_clk_set_parent(struct clk *clk, struct clk *new_parent);
29int omap2_dpll_rate_tolerance_set(struct clk *clk, unsigned int tolerance);
30long omap2_dpll_round_rate(struct clk *clk, unsigned long target_rate);
26 31
27#ifdef CONFIG_OMAP_RESET_CLOCKS 32#ifdef CONFIG_OMAP_RESET_CLOCKS
28void omap2_clk_disable_unused(struct clk *clk); 33void omap2_clk_disable_unused(struct clk *clk);
@@ -42,6 +47,7 @@ long omap2_clksel_round_rate(struct clk *clk, unsigned long target_rate);
42int omap2_clksel_set_rate(struct clk *clk, unsigned long rate); 47int omap2_clksel_set_rate(struct clk *clk, unsigned long rate);
43u32 omap2_get_dpll_rate(struct clk *clk); 48u32 omap2_get_dpll_rate(struct clk *clk);
44int omap2_wait_clock_ready(void __iomem *reg, u32 cval, const char *name); 49int omap2_wait_clock_ready(void __iomem *reg, u32 cval, const char *name);
50void omap2_clk_prepare_for_reboot(void);
45 51
46extern u8 cpu_mask; 52extern u8 cpu_mask;
47 53
diff --git a/arch/arm/mach-omap2/clock24xx.c b/arch/arm/mach-omap2/clock24xx.c
index ece32d8acba4..aa567876651d 100644
--- a/arch/arm/mach-omap2/clock24xx.c
+++ b/arch/arm/mach-omap2/clock24xx.c
@@ -154,7 +154,7 @@ static void omap2_clk_fixed_disable(struct clk *clk)
154 * Uses the current prcm set to tell if a rate is valid. 154 * Uses the current prcm set to tell if a rate is valid.
155 * You can go slower, but not faster within a given rate set. 155 * You can go slower, but not faster within a given rate set.
156 */ 156 */
157static u32 omap2_dpll_round_rate(unsigned long target_rate) 157long omap2_dpllcore_round_rate(unsigned long target_rate)
158{ 158{
159 u32 high, low, core_clk_src; 159 u32 high, low, core_clk_src;
160 160
@@ -183,14 +183,14 @@ static u32 omap2_dpll_round_rate(unsigned long target_rate)
183 183
184} 184}
185 185
186static void omap2_dpll_recalc(struct clk *clk) 186static void omap2_dpllcore_recalc(struct clk *clk)
187{ 187{
188 clk->rate = omap2_get_dpll_rate_24xx(clk); 188 clk->rate = omap2_get_dpll_rate_24xx(clk);
189 189
190 propagate_rate(clk); 190 propagate_rate(clk);
191} 191}
192 192
193static int omap2_reprogram_dpll(struct clk *clk, unsigned long rate) 193static int omap2_reprogram_dpllcore(struct clk *clk, unsigned long rate)
194{ 194{
195 u32 cur_rate, low, mult, div, valid_rate, done_rate; 195 u32 cur_rate, low, mult, div, valid_rate, done_rate;
196 u32 bypass = 0; 196 u32 bypass = 0;
@@ -209,7 +209,7 @@ static int omap2_reprogram_dpll(struct clk *clk, unsigned long rate)
209 } else if ((rate == (cur_rate * 2)) && (mult == 1)) { 209 } else if ((rate == (cur_rate * 2)) && (mult == 1)) {
210 omap2_reprogram_sdrc(CORE_CLK_SRC_DPLL_X2, 1); 210 omap2_reprogram_sdrc(CORE_CLK_SRC_DPLL_X2, 1);
211 } else if (rate != cur_rate) { 211 } else if (rate != cur_rate) {
212 valid_rate = omap2_dpll_round_rate(rate); 212 valid_rate = omap2_dpllcore_round_rate(rate);
213 if (valid_rate != rate) 213 if (valid_rate != rate)
214 goto dpll_exit; 214 goto dpll_exit;
215 215
@@ -256,7 +256,7 @@ static int omap2_reprogram_dpll(struct clk *clk, unsigned long rate)
256 omap2_init_memory_params(omap2_dll_force_needed()); 256 omap2_init_memory_params(omap2_dll_force_needed());
257 omap2_reprogram_sdrc(done_rate, 0); 257 omap2_reprogram_sdrc(done_rate, 0);
258 } 258 }
259 omap2_dpll_recalc(&dpll_ck); 259 omap2_dpllcore_recalc(&dpll_ck);
260 ret = 0; 260 ret = 0;
261 261
262dpll_exit: 262dpll_exit:
@@ -383,7 +383,7 @@ static int omap2_select_table_rate(struct clk *clk, unsigned long rate)
383 383
384 local_irq_restore(flags); 384 local_irq_restore(flags);
385 } 385 }
386 omap2_dpll_recalc(&dpll_ck); 386 omap2_dpllcore_recalc(&dpll_ck);
387 387
388 return 0; 388 return 0;
389} 389}
diff --git a/arch/arm/mach-omap2/clock24xx.h b/arch/arm/mach-omap2/clock24xx.h
index 88081ed13f96..be4e25554e05 100644
--- a/arch/arm/mach-omap2/clock24xx.h
+++ b/arch/arm/mach-omap2/clock24xx.h
@@ -30,12 +30,12 @@ static long omap2_round_to_table_rate(struct clk *clk, unsigned long rate);
30static void omap2_sys_clk_recalc(struct clk *clk); 30static void omap2_sys_clk_recalc(struct clk *clk);
31static void omap2_osc_clk_recalc(struct clk *clk); 31static void omap2_osc_clk_recalc(struct clk *clk);
32static void omap2_sys_clk_recalc(struct clk *clk); 32static void omap2_sys_clk_recalc(struct clk *clk);
33static void omap2_dpll_recalc(struct clk *clk); 33static void omap2_dpllcore_recalc(struct clk *clk);
34static int omap2_clk_fixed_enable(struct clk *clk); 34static int omap2_clk_fixed_enable(struct clk *clk);
35static void omap2_clk_fixed_disable(struct clk *clk); 35static void omap2_clk_fixed_disable(struct clk *clk);
36static int omap2_enable_osc_ck(struct clk *clk); 36static int omap2_enable_osc_ck(struct clk *clk);
37static void omap2_disable_osc_ck(struct clk *clk); 37static void omap2_disable_osc_ck(struct clk *clk);
38static int omap2_reprogram_dpll(struct clk *clk, unsigned long rate); 38static int omap2_reprogram_dpllcore(struct clk *clk, unsigned long rate);
39 39
40/* Key dividers which make up a PRCM set. Ratio's for a PRCM are mandated. 40/* Key dividers which make up a PRCM set. Ratio's for a PRCM are mandated.
41 * xtal_speed, dpll_speed, mpu_speed, CM_CLKSEL_MPU,CM_CLKSEL_DSP 41 * xtal_speed, dpll_speed, mpu_speed, CM_CLKSEL_MPU,CM_CLKSEL_DSP
@@ -665,20 +665,27 @@ static struct clk alt_ck = { /* Typical 54M or 48M, may not exist */
665 * deal with this 665 * deal with this
666 */ 666 */
667 667
668static const struct dpll_data dpll_dd = { 668static struct dpll_data dpll_dd = {
669 .mult_div1_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1), 669 .mult_div1_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1),
670 .mult_mask = OMAP24XX_DPLL_MULT_MASK, 670 .mult_mask = OMAP24XX_DPLL_MULT_MASK,
671 .div1_mask = OMAP24XX_DPLL_DIV_MASK, 671 .div1_mask = OMAP24XX_DPLL_DIV_MASK,
672 .max_multiplier = 1024,
673 .max_divider = 16,
674 .rate_tolerance = DEFAULT_DPLL_RATE_TOLERANCE
672}; 675};
673 676
677/*
678 * XXX Cannot add round_rate here yet, as this is still a composite clock,
679 * not just a DPLL
680 */
674static struct clk dpll_ck = { 681static struct clk dpll_ck = {
675 .name = "dpll_ck", 682 .name = "dpll_ck",
676 .parent = &sys_ck, /* Can be func_32k also */ 683 .parent = &sys_ck, /* Can be func_32k also */
677 .dpll_data = &dpll_dd, 684 .dpll_data = &dpll_dd,
678 .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X | 685 .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X |
679 RATE_PROPAGATES | ALWAYS_ENABLED, 686 RATE_PROPAGATES | ALWAYS_ENABLED,
680 .recalc = &omap2_dpll_recalc, 687 .recalc = &omap2_dpllcore_recalc,
681 .set_rate = &omap2_reprogram_dpll, 688 .set_rate = &omap2_reprogram_dpllcore,
682}; 689};
683 690
684static struct clk apll96_ck = { 691static struct clk apll96_ck = {
@@ -1747,7 +1754,8 @@ static struct clk gpt12_fck = {
1747}; 1754};
1748 1755
1749static struct clk mcbsp1_ick = { 1756static struct clk mcbsp1_ick = {
1750 .name = "mcbsp1_ick", 1757 .name = "mcbsp_ick",
1758 .id = 1,
1751 .parent = &l4_ck, 1759 .parent = &l4_ck,
1752 .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, 1760 .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X,
1753 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), 1761 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
@@ -1756,7 +1764,8 @@ static struct clk mcbsp1_ick = {
1756}; 1764};
1757 1765
1758static struct clk mcbsp1_fck = { 1766static struct clk mcbsp1_fck = {
1759 .name = "mcbsp1_fck", 1767 .name = "mcbsp_fck",
1768 .id = 1,
1760 .parent = &func_96m_ck, 1769 .parent = &func_96m_ck,
1761 .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, 1770 .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X,
1762 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), 1771 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
@@ -1765,7 +1774,8 @@ static struct clk mcbsp1_fck = {
1765}; 1774};
1766 1775
1767static struct clk mcbsp2_ick = { 1776static struct clk mcbsp2_ick = {
1768 .name = "mcbsp2_ick", 1777 .name = "mcbsp_ick",
1778 .id = 2,
1769 .parent = &l4_ck, 1779 .parent = &l4_ck,
1770 .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, 1780 .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X,
1771 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), 1781 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
@@ -1774,7 +1784,8 @@ static struct clk mcbsp2_ick = {
1774}; 1784};
1775 1785
1776static struct clk mcbsp2_fck = { 1786static struct clk mcbsp2_fck = {
1777 .name = "mcbsp2_fck", 1787 .name = "mcbsp_fck",
1788 .id = 2,
1778 .parent = &func_96m_ck, 1789 .parent = &func_96m_ck,
1779 .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, 1790 .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X,
1780 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), 1791 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
@@ -1783,7 +1794,8 @@ static struct clk mcbsp2_fck = {
1783}; 1794};
1784 1795
1785static struct clk mcbsp3_ick = { 1796static struct clk mcbsp3_ick = {
1786 .name = "mcbsp3_ick", 1797 .name = "mcbsp_ick",
1798 .id = 3,
1787 .parent = &l4_ck, 1799 .parent = &l4_ck,
1788 .flags = CLOCK_IN_OMAP243X, 1800 .flags = CLOCK_IN_OMAP243X,
1789 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2), 1801 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
@@ -1792,7 +1804,8 @@ static struct clk mcbsp3_ick = {
1792}; 1804};
1793 1805
1794static struct clk mcbsp3_fck = { 1806static struct clk mcbsp3_fck = {
1795 .name = "mcbsp3_fck", 1807 .name = "mcbsp_fck",
1808 .id = 3,
1796 .parent = &func_96m_ck, 1809 .parent = &func_96m_ck,
1797 .flags = CLOCK_IN_OMAP243X, 1810 .flags = CLOCK_IN_OMAP243X,
1798 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2), 1811 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
@@ -1801,7 +1814,8 @@ static struct clk mcbsp3_fck = {
1801}; 1814};
1802 1815
1803static struct clk mcbsp4_ick = { 1816static struct clk mcbsp4_ick = {
1804 .name = "mcbsp4_ick", 1817 .name = "mcbsp_ick",
1818 .id = 4,
1805 .parent = &l4_ck, 1819 .parent = &l4_ck,
1806 .flags = CLOCK_IN_OMAP243X, 1820 .flags = CLOCK_IN_OMAP243X,
1807 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2), 1821 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
@@ -1810,7 +1824,8 @@ static struct clk mcbsp4_ick = {
1810}; 1824};
1811 1825
1812static struct clk mcbsp4_fck = { 1826static struct clk mcbsp4_fck = {
1813 .name = "mcbsp4_fck", 1827 .name = "mcbsp_fck",
1828 .id = 4,
1814 .parent = &func_96m_ck, 1829 .parent = &func_96m_ck,
1815 .flags = CLOCK_IN_OMAP243X, 1830 .flags = CLOCK_IN_OMAP243X,
1816 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2), 1831 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
@@ -1819,7 +1834,8 @@ static struct clk mcbsp4_fck = {
1819}; 1834};
1820 1835
1821static struct clk mcbsp5_ick = { 1836static struct clk mcbsp5_ick = {
1822 .name = "mcbsp5_ick", 1837 .name = "mcbsp_ick",
1838 .id = 5,
1823 .parent = &l4_ck, 1839 .parent = &l4_ck,
1824 .flags = CLOCK_IN_OMAP243X, 1840 .flags = CLOCK_IN_OMAP243X,
1825 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2), 1841 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
@@ -1828,7 +1844,8 @@ static struct clk mcbsp5_ick = {
1828}; 1844};
1829 1845
1830static struct clk mcbsp5_fck = { 1846static struct clk mcbsp5_fck = {
1831 .name = "mcbsp5_fck", 1847 .name = "mcbsp_fck",
1848 .id = 5,
1832 .parent = &func_96m_ck, 1849 .parent = &func_96m_ck,
1833 .flags = CLOCK_IN_OMAP243X, 1850 .flags = CLOCK_IN_OMAP243X,
1834 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2), 1851 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
diff --git a/arch/arm/mach-omap2/clock34xx.c b/arch/arm/mach-omap2/clock34xx.c
index b42bdd6079a5..4263099b1ad3 100644
--- a/arch/arm/mach-omap2/clock34xx.c
+++ b/arch/arm/mach-omap2/clock34xx.c
@@ -1,10 +1,11 @@
1/* 1/*
2 * OMAP3-specific clock framework functions 2 * OMAP3-specific clock framework functions
3 * 3 *
4 * Copyright (C) 2007 Texas Instruments, Inc. 4 * Copyright (C) 2007-2008 Texas Instruments, Inc.
5 * Copyright (C) 2007 Nokia Corporation 5 * Copyright (C) 2007-2008 Nokia Corporation
6 * 6 *
7 * Written by Paul Walmsley 7 * Written by Paul Walmsley
8 * Testing and integration fixes by Jouni Högander
8 * 9 *
9 * Parts of this code are based on code written by 10 * Parts of this code are based on code written by
10 * Richard Woodruff, Tony Lindgren, Tuukka Tikkanen, Karthik Dasu 11 * Richard Woodruff, Tony Lindgren, Tuukka Tikkanen, Karthik Dasu
@@ -23,6 +24,7 @@
23#include <linux/delay.h> 24#include <linux/delay.h>
24#include <linux/clk.h> 25#include <linux/clk.h>
25#include <linux/io.h> 26#include <linux/io.h>
27#include <linux/limits.h>
26 28
27#include <asm/arch/clock.h> 29#include <asm/arch/clock.h>
28#include <asm/arch/sram.h> 30#include <asm/arch/sram.h>
@@ -37,8 +39,11 @@
37#include "cm.h" 39#include "cm.h"
38#include "cm-regbits-34xx.h" 40#include "cm-regbits-34xx.h"
39 41
40/* CM_CLKEN_PLL*.EN* bit values */ 42/* CM_AUTOIDLE_PLL*.AUTO_* bit values */
41#define DPLL_LOCKED 0x7 43#define DPLL_AUTOIDLE_DISABLE 0x0
44#define DPLL_AUTOIDLE_LOW_POWER_STOP 0x1
45
46#define MAX_DPLL_WAIT_TRIES 1000000
42 47
43/** 48/**
44 * omap3_dpll_recalc - recalculate DPLL rate 49 * omap3_dpll_recalc - recalculate DPLL rate
@@ -53,6 +58,290 @@ static void omap3_dpll_recalc(struct clk *clk)
53 propagate_rate(clk); 58 propagate_rate(clk);
54} 59}
55 60
61/* _omap3_dpll_write_clken - write clken_bits arg to a DPLL's enable bits */
62static void _omap3_dpll_write_clken(struct clk *clk, u8 clken_bits)
63{
64 const struct dpll_data *dd;
65
66 dd = clk->dpll_data;
67
68 cm_rmw_reg_bits(dd->enable_mask, clken_bits << __ffs(dd->enable_mask),
69 dd->control_reg);
70}
71
72/* _omap3_wait_dpll_status: wait for a DPLL to enter a specific state */
73static int _omap3_wait_dpll_status(struct clk *clk, u8 state)
74{
75 const struct dpll_data *dd;
76 int i = 0;
77 int ret = -EINVAL;
78 u32 idlest_mask;
79
80 dd = clk->dpll_data;
81
82 state <<= dd->idlest_bit;
83 idlest_mask = 1 << dd->idlest_bit;
84
85 while (((cm_read_reg(dd->idlest_reg) & idlest_mask) != state) &&
86 i < MAX_DPLL_WAIT_TRIES) {
87 i++;
88 udelay(1);
89 }
90
91 if (i == MAX_DPLL_WAIT_TRIES) {
92 printk(KERN_ERR "clock: %s failed transition to '%s'\n",
93 clk->name, (state) ? "locked" : "bypassed");
94 } else {
95 pr_debug("clock: %s transition to '%s' in %d loops\n",
96 clk->name, (state) ? "locked" : "bypassed", i);
97
98 ret = 0;
99 }
100
101 return ret;
102}
103
104/* Non-CORE DPLL (e.g., DPLLs that do not control SDRC) clock functions */
105
106/*
107 * _omap3_noncore_dpll_lock - instruct a DPLL to lock and wait for readiness
108 * @clk: pointer to a DPLL struct clk
109 *
110 * Instructs a non-CORE DPLL to lock. Waits for the DPLL to report
111 * readiness before returning. Will save and restore the DPLL's
112 * autoidle state across the enable, per the CDP code. If the DPLL
113 * locked successfully, return 0; if the DPLL did not lock in the time
114 * allotted, or DPLL3 was passed in, return -EINVAL.
115 */
116static int _omap3_noncore_dpll_lock(struct clk *clk)
117{
118 u8 ai;
119 int r;
120
121 if (clk == &dpll3_ck)
122 return -EINVAL;
123
124 pr_debug("clock: locking DPLL %s\n", clk->name);
125
126 ai = omap3_dpll_autoidle_read(clk);
127
128 _omap3_dpll_write_clken(clk, DPLL_LOCKED);
129
130 if (ai) {
131 /*
132 * If no downstream clocks are enabled, CM_IDLEST bit
133 * may never become active, so don't wait for DPLL to lock.
134 */
135 r = 0;
136 omap3_dpll_allow_idle(clk);
137 } else {
138 r = _omap3_wait_dpll_status(clk, 1);
139 omap3_dpll_deny_idle(clk);
140 };
141
142 return r;
143}
144
145/*
146 * omap3_noncore_dpll_bypass - instruct a DPLL to bypass and wait for readiness
147 * @clk: pointer to a DPLL struct clk
148 *
149 * Instructs a non-CORE DPLL to enter low-power bypass mode. In
150 * bypass mode, the DPLL's rate is set equal to its parent clock's
151 * rate. Waits for the DPLL to report readiness before returning.
152 * Will save and restore the DPLL's autoidle state across the enable,
153 * per the CDP code. If the DPLL entered bypass mode successfully,
154 * return 0; if the DPLL did not enter bypass in the time allotted, or
155 * DPLL3 was passed in, or the DPLL does not support low-power bypass,
156 * return -EINVAL.
157 */
158static int _omap3_noncore_dpll_bypass(struct clk *clk)
159{
160 int r;
161 u8 ai;
162
163 if (clk == &dpll3_ck)
164 return -EINVAL;
165
166 if (!(clk->dpll_data->modes & (1 << DPLL_LOW_POWER_BYPASS)))
167 return -EINVAL;
168
169 pr_debug("clock: configuring DPLL %s for low-power bypass\n",
170 clk->name);
171
172 ai = omap3_dpll_autoidle_read(clk);
173
174 _omap3_dpll_write_clken(clk, DPLL_LOW_POWER_BYPASS);
175
176 r = _omap3_wait_dpll_status(clk, 0);
177
178 if (ai)
179 omap3_dpll_allow_idle(clk);
180 else
181 omap3_dpll_deny_idle(clk);
182
183 return r;
184}
185
186/*
187 * _omap3_noncore_dpll_stop - instruct a DPLL to stop
188 * @clk: pointer to a DPLL struct clk
189 *
190 * Instructs a non-CORE DPLL to enter low-power stop. Will save and
191 * restore the DPLL's autoidle state across the stop, per the CDP
192 * code. If DPLL3 was passed in, or the DPLL does not support
193 * low-power stop, return -EINVAL; otherwise, return 0.
194 */
195static int _omap3_noncore_dpll_stop(struct clk *clk)
196{
197 u8 ai;
198
199 if (clk == &dpll3_ck)
200 return -EINVAL;
201
202 if (!(clk->dpll_data->modes & (1 << DPLL_LOW_POWER_STOP)))
203 return -EINVAL;
204
205 pr_debug("clock: stopping DPLL %s\n", clk->name);
206
207 ai = omap3_dpll_autoidle_read(clk);
208
209 _omap3_dpll_write_clken(clk, DPLL_LOW_POWER_STOP);
210
211 if (ai)
212 omap3_dpll_allow_idle(clk);
213 else
214 omap3_dpll_deny_idle(clk);
215
216 return 0;
217}
218
219/**
220 * omap3_noncore_dpll_enable - instruct a DPLL to enter bypass or lock mode
221 * @clk: pointer to a DPLL struct clk
222 *
223 * Instructs a non-CORE DPLL to enable, e.g., to enter bypass or lock.
224 * The choice of modes depends on the DPLL's programmed rate: if it is
225 * the same as the DPLL's parent clock, it will enter bypass;
226 * otherwise, it will enter lock. This code will wait for the DPLL to
227 * indicate readiness before returning, unless the DPLL takes too long
228 * to enter the target state. Intended to be used as the struct clk's
229 * enable function. If DPLL3 was passed in, or the DPLL does not
230 * support low-power stop, or if the DPLL took too long to enter
231 * bypass or lock, return -EINVAL; otherwise, return 0.
232 */
233static int omap3_noncore_dpll_enable(struct clk *clk)
234{
235 int r;
236
237 if (clk == &dpll3_ck)
238 return -EINVAL;
239
240 if (clk->parent->rate == clk_get_rate(clk))
241 r = _omap3_noncore_dpll_bypass(clk);
242 else
243 r = _omap3_noncore_dpll_lock(clk);
244
245 return r;
246}
247
248/**
249 * omap3_noncore_dpll_enable - instruct a DPLL to enter bypass or lock mode
250 * @clk: pointer to a DPLL struct clk
251 *
252 * Instructs a non-CORE DPLL to enable, e.g., to enter bypass or lock.
253 * The choice of modes depends on the DPLL's programmed rate: if it is
254 * the same as the DPLL's parent clock, it will enter bypass;
255 * otherwise, it will enter lock. This code will wait for the DPLL to
256 * indicate readiness before returning, unless the DPLL takes too long
257 * to enter the target state. Intended to be used as the struct clk's
258 * enable function. If DPLL3 was passed in, or the DPLL does not
259 * support low-power stop, or if the DPLL took too long to enter
260 * bypass or lock, return -EINVAL; otherwise, return 0.
261 */
262static void omap3_noncore_dpll_disable(struct clk *clk)
263{
264 if (clk == &dpll3_ck)
265 return;
266
267 _omap3_noncore_dpll_stop(clk);
268}
269
270/**
271 * omap3_dpll_autoidle_read - read a DPLL's autoidle bits
272 * @clk: struct clk * of the DPLL to read
273 *
274 * Return the DPLL's autoidle bits, shifted down to bit 0. Returns
275 * -EINVAL if passed a null pointer or if the struct clk does not
276 * appear to refer to a DPLL.
277 */
278static u32 omap3_dpll_autoidle_read(struct clk *clk)
279{
280 const struct dpll_data *dd;
281 u32 v;
282
283 if (!clk || !clk->dpll_data)
284 return -EINVAL;
285
286 dd = clk->dpll_data;
287
288 v = cm_read_reg(dd->autoidle_reg);
289 v &= dd->autoidle_mask;
290 v >>= __ffs(dd->autoidle_mask);
291
292 return v;
293}
294
295/**
296 * omap3_dpll_allow_idle - enable DPLL autoidle bits
297 * @clk: struct clk * of the DPLL to operate on
298 *
299 * Enable DPLL automatic idle control. This automatic idle mode
300 * switching takes effect only when the DPLL is locked, at least on
301 * OMAP3430. The DPLL will enter low-power stop when its downstream
302 * clocks are gated. No return value.
303 */
304static void omap3_dpll_allow_idle(struct clk *clk)
305{
306 const struct dpll_data *dd;
307
308 if (!clk || !clk->dpll_data)
309 return;
310
311 dd = clk->dpll_data;
312
313 /*
314 * REVISIT: CORE DPLL can optionally enter low-power bypass
315 * by writing 0x5 instead of 0x1. Add some mechanism to
316 * optionally enter this mode.
317 */
318 cm_rmw_reg_bits(dd->autoidle_mask,
319 DPLL_AUTOIDLE_LOW_POWER_STOP << __ffs(dd->autoidle_mask),
320 dd->autoidle_reg);
321}
322
323/**
324 * omap3_dpll_deny_idle - prevent DPLL from automatically idling
325 * @clk: struct clk * of the DPLL to operate on
326 *
327 * Disable DPLL automatic idle control. No return value.
328 */
329static void omap3_dpll_deny_idle(struct clk *clk)
330{
331 const struct dpll_data *dd;
332
333 if (!clk || !clk->dpll_data)
334 return;
335
336 dd = clk->dpll_data;
337
338 cm_rmw_reg_bits(dd->autoidle_mask,
339 DPLL_AUTOIDLE_DISABLE << __ffs(dd->autoidle_mask),
340 dd->autoidle_reg);
341}
342
343/* Clock control for DPLL outputs */
344
56/** 345/**
57 * omap3_clkoutx2_recalc - recalculate DPLL X2 output virtual clock rate 346 * omap3_clkoutx2_recalc - recalculate DPLL X2 output virtual clock rate
58 * @clk: DPLL output struct clk 347 * @clk: DPLL output struct clk
@@ -89,6 +378,8 @@ static void omap3_clkoutx2_recalc(struct clk *clk)
89 propagate_rate(clk); 378 propagate_rate(clk);
90} 379}
91 380
381/* Common clock code */
382
92/* 383/*
93 * As it is structured now, this will prevent an OMAP2/3 multiboot 384 * As it is structured now, this will prevent an OMAP2/3 multiboot
94 * kernel from compiling. This will need further attention. 385 * kernel from compiling. This will need further attention.
diff --git a/arch/arm/mach-omap2/clock34xx.h b/arch/arm/mach-omap2/clock34xx.h
index c9c5972a2e25..05757eb032bc 100644
--- a/arch/arm/mach-omap2/clock34xx.h
+++ b/arch/arm/mach-omap2/clock34xx.h
@@ -1,14 +1,19 @@
1/* 1/*
2 * OMAP3 clock framework 2 * OMAP3 clock framework
3 * 3 *
4 * Virtual clocks are introduced as a convenient tools.
5 * They are sources for other clocks and not supposed
6 * to be requested from drivers directly.
7 *
8 * Copyright (C) 2007-2008 Texas Instruments, Inc. 4 * Copyright (C) 2007-2008 Texas Instruments, Inc.
9 * Copyright (C) 2007-2008 Nokia Corporation 5 * Copyright (C) 2007-2008 Nokia Corporation
10 * 6 *
11 * Written by Paul Walmsley 7 * Written by Paul Walmsley
8 * With many device clock fixes by Kevin Hilman and Jouni Högander
9 * DPLL bypass clock support added by Roman Tereshonkov
10 *
11 */
12
13/*
14 * Virtual clocks are introduced as convenient tools.
15 * They are sources for other clocks and not supposed
16 * to be requested from drivers directly.
12 */ 17 */
13 18
14#ifndef __ARCH_ARM_MACH_OMAP2_CLOCK34XX_H 19#ifndef __ARCH_ARM_MACH_OMAP2_CLOCK34XX_H
@@ -24,6 +29,15 @@
24 29
25static void omap3_dpll_recalc(struct clk *clk); 30static void omap3_dpll_recalc(struct clk *clk);
26static void omap3_clkoutx2_recalc(struct clk *clk); 31static void omap3_clkoutx2_recalc(struct clk *clk);
32static void omap3_dpll_allow_idle(struct clk *clk);
33static void omap3_dpll_deny_idle(struct clk *clk);
34static u32 omap3_dpll_autoidle_read(struct clk *clk);
35static int omap3_noncore_dpll_enable(struct clk *clk);
36static void omap3_noncore_dpll_disable(struct clk *clk);
37
38/* Maximum DPLL multiplier, divider values for OMAP3 */
39#define OMAP3_MAX_DPLL_MULT 2048
40#define OMAP3_MAX_DPLL_DIV 128
27 41
28/* 42/*
29 * DPLL1 supplies clock to the MPU. 43 * DPLL1 supplies clock to the MPU.
@@ -33,6 +47,11 @@ static void omap3_clkoutx2_recalc(struct clk *clk);
33 * DPLL5 supplies other peripheral clocks (USBHOST, USIM). 47 * DPLL5 supplies other peripheral clocks (USBHOST, USIM).
34 */ 48 */
35 49
50/* CM_CLKEN_PLL*.EN* bit values - not all are available for every DPLL */
51#define DPLL_LOW_POWER_STOP 0x1
52#define DPLL_LOW_POWER_BYPASS 0x5
53#define DPLL_LOCKED 0x7
54
36/* PRM CLOCKS */ 55/* PRM CLOCKS */
37 56
38/* According to timer32k.c, this is a 32768Hz clock, not a 32000Hz clock. */ 57/* According to timer32k.c, this is a 32768Hz clock, not a 32000Hz clock. */
@@ -240,15 +259,23 @@ static const struct clksel_rate div16_dpll_rates[] = {
240/* DPLL1 */ 259/* DPLL1 */
241/* MPU clock source */ 260/* MPU clock source */
242/* Type: DPLL */ 261/* Type: DPLL */
243static const struct dpll_data dpll1_dd = { 262static struct dpll_data dpll1_dd = {
244 .mult_div1_reg = OMAP_CM_REGADDR(MPU_MOD, OMAP3430_CM_CLKSEL1_PLL), 263 .mult_div1_reg = OMAP_CM_REGADDR(MPU_MOD, OMAP3430_CM_CLKSEL1_PLL),
245 .mult_mask = OMAP3430_MPU_DPLL_MULT_MASK, 264 .mult_mask = OMAP3430_MPU_DPLL_MULT_MASK,
246 .div1_mask = OMAP3430_MPU_DPLL_DIV_MASK, 265 .div1_mask = OMAP3430_MPU_DPLL_DIV_MASK,
247 .control_reg = OMAP_CM_REGADDR(MPU_MOD, OMAP3430_CM_CLKEN_PLL), 266 .control_reg = OMAP_CM_REGADDR(MPU_MOD, OMAP3430_CM_CLKEN_PLL),
248 .enable_mask = OMAP3430_EN_MPU_DPLL_MASK, 267 .enable_mask = OMAP3430_EN_MPU_DPLL_MASK,
268 .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
249 .auto_recal_bit = OMAP3430_EN_MPU_DPLL_DRIFTGUARD_SHIFT, 269 .auto_recal_bit = OMAP3430_EN_MPU_DPLL_DRIFTGUARD_SHIFT,
250 .recal_en_bit = OMAP3430_MPU_DPLL_RECAL_EN_SHIFT, 270 .recal_en_bit = OMAP3430_MPU_DPLL_RECAL_EN_SHIFT,
251 .recal_st_bit = OMAP3430_MPU_DPLL_ST_SHIFT, 271 .recal_st_bit = OMAP3430_MPU_DPLL_ST_SHIFT,
272 .autoidle_reg = OMAP_CM_REGADDR(MPU_MOD, OMAP3430_CM_AUTOIDLE_PLL),
273 .autoidle_mask = OMAP3430_AUTO_MPU_DPLL_MASK,
274 .idlest_reg = OMAP_CM_REGADDR(MPU_MOD, OMAP3430_CM_IDLEST_PLL),
275 .idlest_bit = OMAP3430_ST_MPU_CLK_SHIFT,
276 .max_multiplier = OMAP3_MAX_DPLL_MULT,
277 .max_divider = OMAP3_MAX_DPLL_DIV,
278 .rate_tolerance = DEFAULT_DPLL_RATE_TOLERANCE
252}; 279};
253 280
254static struct clk dpll1_ck = { 281static struct clk dpll1_ck = {
@@ -256,6 +283,7 @@ static struct clk dpll1_ck = {
256 .parent = &sys_ck, 283 .parent = &sys_ck,
257 .dpll_data = &dpll1_dd, 284 .dpll_data = &dpll1_dd,
258 .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES | ALWAYS_ENABLED, 285 .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES | ALWAYS_ENABLED,
286 .round_rate = &omap2_dpll_round_rate,
259 .recalc = &omap3_dpll_recalc, 287 .recalc = &omap3_dpll_recalc,
260}; 288};
261 289
@@ -297,22 +325,34 @@ static struct clk dpll1_x2m2_ck = {
297/* IVA2 clock source */ 325/* IVA2 clock source */
298/* Type: DPLL */ 326/* Type: DPLL */
299 327
300static const struct dpll_data dpll2_dd = { 328static struct dpll_data dpll2_dd = {
301 .mult_div1_reg = OMAP_CM_REGADDR(OMAP3430_IVA2_MOD, OMAP3430_CM_CLKSEL1_PLL), 329 .mult_div1_reg = OMAP_CM_REGADDR(OMAP3430_IVA2_MOD, OMAP3430_CM_CLKSEL1_PLL),
302 .mult_mask = OMAP3430_IVA2_DPLL_MULT_MASK, 330 .mult_mask = OMAP3430_IVA2_DPLL_MULT_MASK,
303 .div1_mask = OMAP3430_IVA2_DPLL_DIV_MASK, 331 .div1_mask = OMAP3430_IVA2_DPLL_DIV_MASK,
304 .control_reg = OMAP_CM_REGADDR(OMAP3430_IVA2_MOD, OMAP3430_CM_CLKEN_PLL), 332 .control_reg = OMAP_CM_REGADDR(OMAP3430_IVA2_MOD, OMAP3430_CM_CLKEN_PLL),
305 .enable_mask = OMAP3430_EN_IVA2_DPLL_MASK, 333 .enable_mask = OMAP3430_EN_IVA2_DPLL_MASK,
334 .modes = (1 << DPLL_LOW_POWER_STOP) | (1 << DPLL_LOCKED) |
335 (1 << DPLL_LOW_POWER_BYPASS),
306 .auto_recal_bit = OMAP3430_EN_IVA2_DPLL_DRIFTGUARD_SHIFT, 336 .auto_recal_bit = OMAP3430_EN_IVA2_DPLL_DRIFTGUARD_SHIFT,
307 .recal_en_bit = OMAP3430_PRM_IRQENABLE_MPU_IVA2_DPLL_RECAL_EN_SHIFT, 337 .recal_en_bit = OMAP3430_PRM_IRQENABLE_MPU_IVA2_DPLL_RECAL_EN_SHIFT,
308 .recal_st_bit = OMAP3430_PRM_IRQSTATUS_MPU_IVA2_DPLL_ST_SHIFT, 338 .recal_st_bit = OMAP3430_PRM_IRQSTATUS_MPU_IVA2_DPLL_ST_SHIFT,
339 .autoidle_reg = OMAP_CM_REGADDR(OMAP3430_IVA2_MOD, OMAP3430_CM_AUTOIDLE_PLL),
340 .autoidle_mask = OMAP3430_AUTO_IVA2_DPLL_MASK,
341 .idlest_reg = OMAP_CM_REGADDR(OMAP3430_IVA2_MOD, OMAP3430_CM_IDLEST_PLL),
342 .idlest_bit = OMAP3430_ST_IVA2_CLK_SHIFT,
343 .max_multiplier = OMAP3_MAX_DPLL_MULT,
344 .max_divider = OMAP3_MAX_DPLL_DIV,
345 .rate_tolerance = DEFAULT_DPLL_RATE_TOLERANCE
309}; 346};
310 347
311static struct clk dpll2_ck = { 348static struct clk dpll2_ck = {
312 .name = "dpll2_ck", 349 .name = "dpll2_ck",
313 .parent = &sys_ck, 350 .parent = &sys_ck,
314 .dpll_data = &dpll2_dd, 351 .dpll_data = &dpll2_dd,
315 .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES | ALWAYS_ENABLED, 352 .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES,
353 .enable = &omap3_noncore_dpll_enable,
354 .disable = &omap3_noncore_dpll_disable,
355 .round_rate = &omap2_dpll_round_rate,
316 .recalc = &omap3_dpll_recalc, 356 .recalc = &omap3_dpll_recalc,
317}; 357};
318 358
@@ -338,10 +378,12 @@ static struct clk dpll2_m2_ck = {
338 .recalc = &omap2_clksel_recalc, 378 .recalc = &omap2_clksel_recalc,
339}; 379};
340 380
341/* DPLL3 */ 381/*
342/* Source clock for all interfaces and for some device fclks */ 382 * DPLL3
343/* Type: DPLL */ 383 * Source clock for all interfaces and for some device fclks
344static const struct dpll_data dpll3_dd = { 384 * REVISIT: Also supports fast relock bypass - not included below
385 */
386static struct dpll_data dpll3_dd = {
345 .mult_div1_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1), 387 .mult_div1_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1),
346 .mult_mask = OMAP3430_CORE_DPLL_MULT_MASK, 388 .mult_mask = OMAP3430_CORE_DPLL_MULT_MASK,
347 .div1_mask = OMAP3430_CORE_DPLL_DIV_MASK, 389 .div1_mask = OMAP3430_CORE_DPLL_DIV_MASK,
@@ -350,6 +392,11 @@ static const struct dpll_data dpll3_dd = {
350 .auto_recal_bit = OMAP3430_EN_CORE_DPLL_DRIFTGUARD_SHIFT, 392 .auto_recal_bit = OMAP3430_EN_CORE_DPLL_DRIFTGUARD_SHIFT,
351 .recal_en_bit = OMAP3430_CORE_DPLL_RECAL_EN_SHIFT, 393 .recal_en_bit = OMAP3430_CORE_DPLL_RECAL_EN_SHIFT,
352 .recal_st_bit = OMAP3430_CORE_DPLL_ST_SHIFT, 394 .recal_st_bit = OMAP3430_CORE_DPLL_ST_SHIFT,
395 .autoidle_reg = OMAP_CM_REGADDR(PLL_MOD, CM_AUTOIDLE),
396 .autoidle_mask = OMAP3430_AUTO_CORE_DPLL_MASK,
397 .max_multiplier = OMAP3_MAX_DPLL_MULT,
398 .max_divider = OMAP3_MAX_DPLL_DIV,
399 .rate_tolerance = DEFAULT_DPLL_RATE_TOLERANCE
353}; 400};
354 401
355static struct clk dpll3_ck = { 402static struct clk dpll3_ck = {
@@ -357,6 +404,7 @@ static struct clk dpll3_ck = {
357 .parent = &sys_ck, 404 .parent = &sys_ck,
358 .dpll_data = &dpll3_dd, 405 .dpll_data = &dpll3_dd,
359 .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES | ALWAYS_ENABLED, 406 .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES | ALWAYS_ENABLED,
407 .round_rate = &omap2_dpll_round_rate,
360 .recalc = &omap3_dpll_recalc, 408 .recalc = &omap3_dpll_recalc,
361}; 409};
362 410
@@ -439,7 +487,7 @@ static struct clk core_ck = {
439 .name = "core_ck", 487 .name = "core_ck",
440 .init = &omap2_init_clksel_parent, 488 .init = &omap2_init_clksel_parent,
441 .clksel_reg = OMAP_CM_REGADDR(PLL_MOD, CM_IDLEST), 489 .clksel_reg = OMAP_CM_REGADDR(PLL_MOD, CM_IDLEST),
442 .clksel_mask = OMAP3430_ST_CORE_CLK, 490 .clksel_mask = OMAP3430_ST_CORE_CLK_MASK,
443 .clksel = core_ck_clksel, 491 .clksel = core_ck_clksel,
444 .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES | 492 .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES |
445 PARENT_CONTROLS_CLOCK, 493 PARENT_CONTROLS_CLOCK,
@@ -456,7 +504,7 @@ static struct clk dpll3_m2x2_ck = {
456 .name = "dpll3_m2x2_ck", 504 .name = "dpll3_m2x2_ck",
457 .init = &omap2_init_clksel_parent, 505 .init = &omap2_init_clksel_parent,
458 .clksel_reg = OMAP_CM_REGADDR(PLL_MOD, CM_IDLEST), 506 .clksel_reg = OMAP_CM_REGADDR(PLL_MOD, CM_IDLEST),
459 .clksel_mask = OMAP3430_ST_CORE_CLK, 507 .clksel_mask = OMAP3430_ST_CORE_CLK_MASK,
460 .clksel = dpll3_m2x2_ck_clksel, 508 .clksel = dpll3_m2x2_ck_clksel,
461 .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES | 509 .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES |
462 PARENT_CONTROLS_CLOCK, 510 PARENT_CONTROLS_CLOCK,
@@ -503,7 +551,7 @@ static struct clk emu_core_alwon_ck = {
503 .parent = &dpll3_m3x2_ck, 551 .parent = &dpll3_m3x2_ck,
504 .init = &omap2_init_clksel_parent, 552 .init = &omap2_init_clksel_parent,
505 .clksel_reg = OMAP_CM_REGADDR(PLL_MOD, CM_IDLEST), 553 .clksel_reg = OMAP_CM_REGADDR(PLL_MOD, CM_IDLEST),
506 .clksel_mask = OMAP3430_ST_CORE_CLK, 554 .clksel_mask = OMAP3430_ST_CORE_CLK_MASK,
507 .clksel = emu_core_alwon_ck_clksel, 555 .clksel = emu_core_alwon_ck_clksel,
508 .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES | 556 .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES |
509 PARENT_CONTROLS_CLOCK, 557 PARENT_CONTROLS_CLOCK,
@@ -513,22 +561,33 @@ static struct clk emu_core_alwon_ck = {
513/* DPLL4 */ 561/* DPLL4 */
514/* Supplies 96MHz, 54Mhz TV DAC, DSS fclk, CAM sensor clock, emul trace clk */ 562/* Supplies 96MHz, 54Mhz TV DAC, DSS fclk, CAM sensor clock, emul trace clk */
515/* Type: DPLL */ 563/* Type: DPLL */
516static const struct dpll_data dpll4_dd = { 564static struct dpll_data dpll4_dd = {
517 .mult_div1_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL2), 565 .mult_div1_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL2),
518 .mult_mask = OMAP3430_PERIPH_DPLL_MULT_MASK, 566 .mult_mask = OMAP3430_PERIPH_DPLL_MULT_MASK,
519 .div1_mask = OMAP3430_PERIPH_DPLL_DIV_MASK, 567 .div1_mask = OMAP3430_PERIPH_DPLL_DIV_MASK,
520 .control_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN), 568 .control_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN),
521 .enable_mask = OMAP3430_EN_PERIPH_DPLL_MASK, 569 .enable_mask = OMAP3430_EN_PERIPH_DPLL_MASK,
570 .modes = (1 << DPLL_LOW_POWER_STOP) | (1 << DPLL_LOCKED),
522 .auto_recal_bit = OMAP3430_EN_PERIPH_DPLL_DRIFTGUARD_SHIFT, 571 .auto_recal_bit = OMAP3430_EN_PERIPH_DPLL_DRIFTGUARD_SHIFT,
523 .recal_en_bit = OMAP3430_PERIPH_DPLL_RECAL_EN_SHIFT, 572 .recal_en_bit = OMAP3430_PERIPH_DPLL_RECAL_EN_SHIFT,
524 .recal_st_bit = OMAP3430_PERIPH_DPLL_ST_SHIFT, 573 .recal_st_bit = OMAP3430_PERIPH_DPLL_ST_SHIFT,
574 .autoidle_reg = OMAP_CM_REGADDR(PLL_MOD, CM_AUTOIDLE),
575 .autoidle_mask = OMAP3430_AUTO_PERIPH_DPLL_MASK,
576 .idlest_reg = OMAP_CM_REGADDR(PLL_MOD, CM_IDLEST),
577 .idlest_bit = OMAP3430_ST_PERIPH_CLK_SHIFT,
578 .max_multiplier = OMAP3_MAX_DPLL_MULT,
579 .max_divider = OMAP3_MAX_DPLL_DIV,
580 .rate_tolerance = DEFAULT_DPLL_RATE_TOLERANCE
525}; 581};
526 582
527static struct clk dpll4_ck = { 583static struct clk dpll4_ck = {
528 .name = "dpll4_ck", 584 .name = "dpll4_ck",
529 .parent = &sys_ck, 585 .parent = &sys_ck,
530 .dpll_data = &dpll4_dd, 586 .dpll_data = &dpll4_dd,
531 .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES | ALWAYS_ENABLED, 587 .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES,
588 .enable = &omap3_noncore_dpll_enable,
589 .disable = &omap3_noncore_dpll_disable,
590 .round_rate = &omap2_dpll_round_rate,
532 .recalc = &omap3_dpll_recalc, 591 .recalc = &omap3_dpll_recalc,
533}; 592};
534 593
@@ -584,7 +643,7 @@ static struct clk omap_96m_alwon_fck = {
584 .parent = &dpll4_m2x2_ck, 643 .parent = &dpll4_m2x2_ck,
585 .init = &omap2_init_clksel_parent, 644 .init = &omap2_init_clksel_parent,
586 .clksel_reg = OMAP_CM_REGADDR(PLL_MOD, CM_IDLEST), 645 .clksel_reg = OMAP_CM_REGADDR(PLL_MOD, CM_IDLEST),
587 .clksel_mask = OMAP3430_ST_PERIPH_CLK, 646 .clksel_mask = OMAP3430_ST_PERIPH_CLK_MASK,
588 .clksel = omap_96m_alwon_fck_clksel, 647 .clksel = omap_96m_alwon_fck_clksel,
589 .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES | 648 .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES |
590 PARENT_CONTROLS_CLOCK, 649 PARENT_CONTROLS_CLOCK,
@@ -610,7 +669,7 @@ static struct clk cm_96m_fck = {
610 .parent = &dpll4_m2x2_ck, 669 .parent = &dpll4_m2x2_ck,
611 .init = &omap2_init_clksel_parent, 670 .init = &omap2_init_clksel_parent,
612 .clksel_reg = OMAP_CM_REGADDR(PLL_MOD, CM_IDLEST), 671 .clksel_reg = OMAP_CM_REGADDR(PLL_MOD, CM_IDLEST),
613 .clksel_mask = OMAP3430_ST_PERIPH_CLK, 672 .clksel_mask = OMAP3430_ST_PERIPH_CLK_MASK,
614 .clksel = cm_96m_fck_clksel, 673 .clksel = cm_96m_fck_clksel,
615 .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES | 674 .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES |
616 PARENT_CONTROLS_CLOCK, 675 PARENT_CONTROLS_CLOCK,
@@ -652,7 +711,7 @@ static struct clk virt_omap_54m_fck = {
652 .parent = &dpll4_m3x2_ck, 711 .parent = &dpll4_m3x2_ck,
653 .init = &omap2_init_clksel_parent, 712 .init = &omap2_init_clksel_parent,
654 .clksel_reg = OMAP_CM_REGADDR(PLL_MOD, CM_IDLEST), 713 .clksel_reg = OMAP_CM_REGADDR(PLL_MOD, CM_IDLEST),
655 .clksel_mask = OMAP3430_ST_PERIPH_CLK, 714 .clksel_mask = OMAP3430_ST_PERIPH_CLK_MASK,
656 .clksel = virt_omap_54m_fck_clksel, 715 .clksel = virt_omap_54m_fck_clksel,
657 .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES | 716 .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES |
658 PARENT_CONTROLS_CLOCK, 717 PARENT_CONTROLS_CLOCK,
@@ -804,23 +863,33 @@ static struct clk emu_per_alwon_ck = {
804/* Supplies 120MHz clock, USIM source clock */ 863/* Supplies 120MHz clock, USIM source clock */
805/* Type: DPLL */ 864/* Type: DPLL */
806/* 3430ES2 only */ 865/* 3430ES2 only */
807static const struct dpll_data dpll5_dd = { 866static struct dpll_data dpll5_dd = {
808 .mult_div1_reg = OMAP_CM_REGADDR(PLL_MOD, OMAP3430ES2_CM_CLKSEL4), 867 .mult_div1_reg = OMAP_CM_REGADDR(PLL_MOD, OMAP3430ES2_CM_CLKSEL4),
809 .mult_mask = OMAP3430ES2_PERIPH2_DPLL_MULT_MASK, 868 .mult_mask = OMAP3430ES2_PERIPH2_DPLL_MULT_MASK,
810 .div1_mask = OMAP3430ES2_PERIPH2_DPLL_DIV_MASK, 869 .div1_mask = OMAP3430ES2_PERIPH2_DPLL_DIV_MASK,
811 .control_reg = OMAP_CM_REGADDR(PLL_MOD, OMAP3430ES2_CM_CLKEN2), 870 .control_reg = OMAP_CM_REGADDR(PLL_MOD, OMAP3430ES2_CM_CLKEN2),
812 .enable_mask = OMAP3430ES2_EN_PERIPH2_DPLL_MASK, 871 .enable_mask = OMAP3430ES2_EN_PERIPH2_DPLL_MASK,
872 .modes = (1 << DPLL_LOW_POWER_STOP) | (1 << DPLL_LOCKED),
813 .auto_recal_bit = OMAP3430ES2_EN_PERIPH2_DPLL_DRIFTGUARD_SHIFT, 873 .auto_recal_bit = OMAP3430ES2_EN_PERIPH2_DPLL_DRIFTGUARD_SHIFT,
814 .recal_en_bit = OMAP3430ES2_SND_PERIPH_DPLL_RECAL_EN_SHIFT, 874 .recal_en_bit = OMAP3430ES2_SND_PERIPH_DPLL_RECAL_EN_SHIFT,
815 .recal_st_bit = OMAP3430ES2_SND_PERIPH_DPLL_ST_SHIFT, 875 .recal_st_bit = OMAP3430ES2_SND_PERIPH_DPLL_ST_SHIFT,
876 .autoidle_reg = OMAP_CM_REGADDR(PLL_MOD, OMAP3430ES2_CM_AUTOIDLE2_PLL),
877 .autoidle_mask = OMAP3430ES2_AUTO_PERIPH2_DPLL_MASK,
878 .idlest_reg = OMAP_CM_REGADDR(PLL_MOD, CM_IDLEST2),
879 .idlest_bit = OMAP3430ES2_ST_PERIPH2_CLK_SHIFT,
880 .max_multiplier = OMAP3_MAX_DPLL_MULT,
881 .max_divider = OMAP3_MAX_DPLL_DIV,
882 .rate_tolerance = DEFAULT_DPLL_RATE_TOLERANCE
816}; 883};
817 884
818static struct clk dpll5_ck = { 885static struct clk dpll5_ck = {
819 .name = "dpll5_ck", 886 .name = "dpll5_ck",
820 .parent = &sys_ck, 887 .parent = &sys_ck,
821 .dpll_data = &dpll5_dd, 888 .dpll_data = &dpll5_dd,
822 .flags = CLOCK_IN_OMAP3430ES2 | RATE_PROPAGATES | 889 .flags = CLOCK_IN_OMAP3430ES2 | RATE_PROPAGATES,
823 ALWAYS_ENABLED, 890 .enable = &omap3_noncore_dpll_enable,
891 .disable = &omap3_noncore_dpll_disable,
892 .round_rate = &omap2_dpll_round_rate,
824 .recalc = &omap3_dpll_recalc, 893 .recalc = &omap3_dpll_recalc,
825}; 894};
826 895
@@ -1365,7 +1434,8 @@ static const struct clksel mcbsp_15_clksel[] = {
1365}; 1434};
1366 1435
1367static struct clk mcbsp5_fck = { 1436static struct clk mcbsp5_fck = {
1368 .name = "mcbsp5_fck", 1437 .name = "mcbsp_fck",
1438 .id = 5,
1369 .init = &omap2_init_clksel_parent, 1439 .init = &omap2_init_clksel_parent,
1370 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), 1440 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1371 .enable_bit = OMAP3430_EN_MCBSP5_SHIFT, 1441 .enable_bit = OMAP3430_EN_MCBSP5_SHIFT,
@@ -1377,7 +1447,8 @@ static struct clk mcbsp5_fck = {
1377}; 1447};
1378 1448
1379static struct clk mcbsp1_fck = { 1449static struct clk mcbsp1_fck = {
1380 .name = "mcbsp1_fck", 1450 .name = "mcbsp_fck",
1451 .id = 1,
1381 .init = &omap2_init_clksel_parent, 1452 .init = &omap2_init_clksel_parent,
1382 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), 1453 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1383 .enable_bit = OMAP3430_EN_MCBSP1_SHIFT, 1454 .enable_bit = OMAP3430_EN_MCBSP1_SHIFT,
@@ -1789,7 +1860,8 @@ static struct clk gpt10_ick = {
1789}; 1860};
1790 1861
1791static struct clk mcbsp5_ick = { 1862static struct clk mcbsp5_ick = {
1792 .name = "mcbsp5_ick", 1863 .name = "mcbsp_ick",
1864 .id = 5,
1793 .parent = &core_l4_ick, 1865 .parent = &core_l4_ick,
1794 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), 1866 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1795 .enable_bit = OMAP3430_EN_MCBSP5_SHIFT, 1867 .enable_bit = OMAP3430_EN_MCBSP5_SHIFT,
@@ -1798,7 +1870,8 @@ static struct clk mcbsp5_ick = {
1798}; 1870};
1799 1871
1800static struct clk mcbsp1_ick = { 1872static struct clk mcbsp1_ick = {
1801 .name = "mcbsp1_ick", 1873 .name = "mcbsp_ick",
1874 .id = 1,
1802 .parent = &core_l4_ick, 1875 .parent = &core_l4_ick,
1803 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), 1876 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1804 .enable_bit = OMAP3430_EN_MCBSP1_SHIFT, 1877 .enable_bit = OMAP3430_EN_MCBSP1_SHIFT,
@@ -1935,7 +2008,7 @@ static struct clk dss1_alwon_fck = {
1935 .enable_reg = OMAP_CM_REGADDR(OMAP3430_DSS_MOD, CM_FCLKEN), 2008 .enable_reg = OMAP_CM_REGADDR(OMAP3430_DSS_MOD, CM_FCLKEN),
1936 .enable_bit = OMAP3430_EN_DSS1_SHIFT, 2009 .enable_bit = OMAP3430_EN_DSS1_SHIFT,
1937 .clksel_reg = OMAP_CM_REGADDR(PLL_MOD, CM_IDLEST), 2010 .clksel_reg = OMAP_CM_REGADDR(PLL_MOD, CM_IDLEST),
1938 .clksel_mask = OMAP3430_ST_PERIPH_CLK, 2011 .clksel_mask = OMAP3430_ST_PERIPH_CLK_MASK,
1939 .clksel = dss1_alwon_fck_clksel, 2012 .clksel = dss1_alwon_fck_clksel,
1940 .flags = CLOCK_IN_OMAP343X, 2013 .flags = CLOCK_IN_OMAP343X,
1941 .recalc = &omap2_clksel_recalc, 2014 .recalc = &omap2_clksel_recalc,
@@ -1991,7 +2064,7 @@ static struct clk cam_mclk = {
1991 .parent = &dpll4_m5x2_ck, 2064 .parent = &dpll4_m5x2_ck,
1992 .init = &omap2_init_clksel_parent, 2065 .init = &omap2_init_clksel_parent,
1993 .clksel_reg = OMAP_CM_REGADDR(PLL_MOD, CM_IDLEST), 2066 .clksel_reg = OMAP_CM_REGADDR(PLL_MOD, CM_IDLEST),
1994 .clksel_mask = OMAP3430_ST_PERIPH_CLK, 2067 .clksel_mask = OMAP3430_ST_PERIPH_CLK_MASK,
1995 .clksel = cam_mclk_clksel, 2068 .clksel = cam_mclk_clksel,
1996 .enable_reg = OMAP_CM_REGADDR(OMAP3430_CAM_MOD, CM_FCLKEN), 2069 .enable_reg = OMAP_CM_REGADDR(OMAP3430_CAM_MOD, CM_FCLKEN),
1997 .enable_bit = OMAP3430_EN_CAM_SHIFT, 2070 .enable_bit = OMAP3430_EN_CAM_SHIFT,
@@ -2541,7 +2614,8 @@ static struct clk gpt2_ick = {
2541}; 2614};
2542 2615
2543static struct clk mcbsp2_ick = { 2616static struct clk mcbsp2_ick = {
2544 .name = "mcbsp2_ick", 2617 .name = "mcbsp_ick",
2618 .id = 2,
2545 .parent = &per_l4_ick, 2619 .parent = &per_l4_ick,
2546 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN), 2620 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
2547 .enable_bit = OMAP3430_EN_MCBSP2_SHIFT, 2621 .enable_bit = OMAP3430_EN_MCBSP2_SHIFT,
@@ -2550,7 +2624,8 @@ static struct clk mcbsp2_ick = {
2550}; 2624};
2551 2625
2552static struct clk mcbsp3_ick = { 2626static struct clk mcbsp3_ick = {
2553 .name = "mcbsp3_ick", 2627 .name = "mcbsp_ick",
2628 .id = 3,
2554 .parent = &per_l4_ick, 2629 .parent = &per_l4_ick,
2555 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN), 2630 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
2556 .enable_bit = OMAP3430_EN_MCBSP3_SHIFT, 2631 .enable_bit = OMAP3430_EN_MCBSP3_SHIFT,
@@ -2559,7 +2634,8 @@ static struct clk mcbsp3_ick = {
2559}; 2634};
2560 2635
2561static struct clk mcbsp4_ick = { 2636static struct clk mcbsp4_ick = {
2562 .name = "mcbsp4_ick", 2637 .name = "mcbsp_ick",
2638 .id = 4,
2563 .parent = &per_l4_ick, 2639 .parent = &per_l4_ick,
2564 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN), 2640 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
2565 .enable_bit = OMAP3430_EN_MCBSP4_SHIFT, 2641 .enable_bit = OMAP3430_EN_MCBSP4_SHIFT,
@@ -2574,7 +2650,8 @@ static const struct clksel mcbsp_234_clksel[] = {
2574}; 2650};
2575 2651
2576static struct clk mcbsp2_fck = { 2652static struct clk mcbsp2_fck = {
2577 .name = "mcbsp2_fck", 2653 .name = "mcbsp_fck",
2654 .id = 2,
2578 .init = &omap2_init_clksel_parent, 2655 .init = &omap2_init_clksel_parent,
2579 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN), 2656 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
2580 .enable_bit = OMAP3430_EN_MCBSP2_SHIFT, 2657 .enable_bit = OMAP3430_EN_MCBSP2_SHIFT,
@@ -2586,7 +2663,8 @@ static struct clk mcbsp2_fck = {
2586}; 2663};
2587 2664
2588static struct clk mcbsp3_fck = { 2665static struct clk mcbsp3_fck = {
2589 .name = "mcbsp3_fck", 2666 .name = "mcbsp_fck",
2667 .id = 3,
2590 .init = &omap2_init_clksel_parent, 2668 .init = &omap2_init_clksel_parent,
2591 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN), 2669 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
2592 .enable_bit = OMAP3430_EN_MCBSP3_SHIFT, 2670 .enable_bit = OMAP3430_EN_MCBSP3_SHIFT,
@@ -2598,7 +2676,8 @@ static struct clk mcbsp3_fck = {
2598}; 2676};
2599 2677
2600static struct clk mcbsp4_fck = { 2678static struct clk mcbsp4_fck = {
2601 .name = "mcbsp4_fck", 2679 .name = "mcbsp_fck",
2680 .id = 4,
2602 .init = &omap2_init_clksel_parent, 2681 .init = &omap2_init_clksel_parent,
2603 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN), 2682 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
2604 .enable_bit = OMAP3430_EN_MCBSP4_SHIFT, 2683 .enable_bit = OMAP3430_EN_MCBSP4_SHIFT,
diff --git a/arch/arm/mach-omap2/cm-regbits-34xx.h b/arch/arm/mach-omap2/cm-regbits-34xx.h
index 3c38395f6442..ee4c0ca1a708 100644
--- a/arch/arm/mach-omap2/cm-regbits-34xx.h
+++ b/arch/arm/mach-omap2/cm-regbits-34xx.h
@@ -72,7 +72,8 @@
72#define OMAP3430_ST_IVA2 (1 << 0) 72#define OMAP3430_ST_IVA2 (1 << 0)
73 73
74/* CM_IDLEST_PLL_IVA2 */ 74/* CM_IDLEST_PLL_IVA2 */
75#define OMAP3430_ST_IVA2_CLK (1 << 0) 75#define OMAP3430_ST_IVA2_CLK_SHIFT 0
76#define OMAP3430_ST_IVA2_CLK_MASK (1 << 0)
76 77
77/* CM_AUTOIDLE_PLL_IVA2 */ 78/* CM_AUTOIDLE_PLL_IVA2 */
78#define OMAP3430_AUTO_IVA2_DPLL_SHIFT 0 79#define OMAP3430_AUTO_IVA2_DPLL_SHIFT 0
@@ -115,10 +116,7 @@
115#define OMAP3430_ST_MPU (1 << 0) 116#define OMAP3430_ST_MPU (1 << 0)
116 117
117/* CM_IDLEST_PLL_MPU */ 118/* CM_IDLEST_PLL_MPU */
118#define OMAP3430_ST_MPU_CLK (1 << 0) 119#define OMAP3430_ST_MPU_CLK_SHIFT 0
119#define OMAP3430_ST_IVA2_CLK_MASK (1 << 0)
120
121/* CM_IDLEST_PLL_MPU */
122#define OMAP3430_ST_MPU_CLK_MASK (1 << 0) 120#define OMAP3430_ST_MPU_CLK_MASK (1 << 0)
123 121
124/* CM_AUTOIDLE_PLL_MPU */ 122/* CM_AUTOIDLE_PLL_MPU */
@@ -408,8 +406,10 @@
408#define OMAP3430_ST_12M_CLK (1 << 4) 406#define OMAP3430_ST_12M_CLK (1 << 4)
409#define OMAP3430_ST_48M_CLK (1 << 3) 407#define OMAP3430_ST_48M_CLK (1 << 3)
410#define OMAP3430_ST_96M_CLK (1 << 2) 408#define OMAP3430_ST_96M_CLK (1 << 2)
411#define OMAP3430_ST_PERIPH_CLK (1 << 1) 409#define OMAP3430_ST_PERIPH_CLK_SHIFT 1
412#define OMAP3430_ST_CORE_CLK (1 << 0) 410#define OMAP3430_ST_PERIPH_CLK_MASK (1 << 1)
411#define OMAP3430_ST_CORE_CLK_SHIFT 0
412#define OMAP3430_ST_CORE_CLK_MASK (1 << 0)
413 413
414/* CM_IDLEST2_CKGEN */ 414/* CM_IDLEST2_CKGEN */
415#define OMAP3430ES2_ST_120M_CLK_SHIFT 1 415#define OMAP3430ES2_ST_120M_CLK_SHIFT 1
@@ -423,6 +423,10 @@
423#define OMAP3430_AUTO_CORE_DPLL_SHIFT 0 423#define OMAP3430_AUTO_CORE_DPLL_SHIFT 0
424#define OMAP3430_AUTO_CORE_DPLL_MASK (0x7 << 0) 424#define OMAP3430_AUTO_CORE_DPLL_MASK (0x7 << 0)
425 425
426/* CM_AUTOIDLE2_PLL */
427#define OMAP3430ES2_AUTO_PERIPH2_DPLL_SHIFT 0
428#define OMAP3430ES2_AUTO_PERIPH2_DPLL_MASK (0x7 << 0)
429
426/* CM_CLKSEL1_PLL */ 430/* CM_CLKSEL1_PLL */
427/* Note that OMAP3430_CORE_DPLL_CLKOUT_DIV_MASK was (0x3 << 27) on 3430ES1 */ 431/* Note that OMAP3430_CORE_DPLL_CLKOUT_DIV_MASK was (0x3 << 27) on 3430ES1 */
428#define OMAP3430_CORE_DPLL_CLKOUT_DIV_SHIFT 27 432#define OMAP3430_CORE_DPLL_CLKOUT_DIV_SHIFT 27
diff --git a/arch/arm/mach-omap2/cm.h b/arch/arm/mach-omap2/cm.h
index 8489f3029fed..87a44c715aa4 100644
--- a/arch/arm/mach-omap2/cm.h
+++ b/arch/arm/mach-omap2/cm.h
@@ -81,6 +81,7 @@
81#define OMAP3430ES2_CM_FCLKEN3 0x0008 81#define OMAP3430ES2_CM_FCLKEN3 0x0008
82#define OMAP3430_CM_IDLEST_PLL CM_IDLEST2 82#define OMAP3430_CM_IDLEST_PLL CM_IDLEST2
83#define OMAP3430_CM_AUTOIDLE_PLL CM_AUTOIDLE2 83#define OMAP3430_CM_AUTOIDLE_PLL CM_AUTOIDLE2
84#define OMAP3430ES2_CM_AUTOIDLE2_PLL CM_AUTOIDLE2
84#define OMAP3430_CM_CLKSEL1 CM_CLKSEL 85#define OMAP3430_CM_CLKSEL1 CM_CLKSEL
85#define OMAP3430_CM_CLKSEL1_PLL CM_CLKSEL 86#define OMAP3430_CM_CLKSEL1_PLL CM_CLKSEL
86#define OMAP3430_CM_CLKSEL2_PLL CM_CLKSEL2 87#define OMAP3430_CM_CLKSEL2_PLL CM_CLKSEL2
@@ -96,15 +97,21 @@
96/* Clock management domain register get/set */ 97/* Clock management domain register get/set */
97 98
98#ifndef __ASSEMBLER__ 99#ifndef __ASSEMBLER__
99static inline void cm_write_mod_reg(u32 val, s16 module, s16 idx) 100
101extern u32 cm_read_mod_reg(s16 module, u16 idx);
102extern void cm_write_mod_reg(u32 val, s16 module, u16 idx);
103extern u32 cm_rmw_mod_reg_bits(u32 mask, u32 bits, s16 module, s16 idx);
104
105static inline u32 cm_set_mod_reg_bits(u32 bits, s16 module, s16 idx)
100{ 106{
101 __raw_writel(val, OMAP_CM_REGADDR(module, idx)); 107 return cm_rmw_mod_reg_bits(bits, bits, module, idx);
102} 108}
103 109
104static inline u32 cm_read_mod_reg(s16 module, s16 idx) 110static inline u32 cm_clear_mod_reg_bits(u32 bits, s16 module, s16 idx)
105{ 111{
106 return __raw_readl(OMAP_CM_REGADDR(module, idx)); 112 return cm_rmw_mod_reg_bits(bits, 0x0, module, idx);
107} 113}
114
108#endif 115#endif
109 116
110/* CM register bits shared between 24XX and 3430 */ 117/* CM register bits shared between 24XX and 3430 */
diff --git a/arch/arm/mach-omap2/control.c b/arch/arm/mach-omap2/control.c
index a5d86a49c213..51f70300996f 100644
--- a/arch/arm/mach-omap2/control.c
+++ b/arch/arm/mach-omap2/control.c
@@ -13,22 +13,21 @@
13#undef DEBUG 13#undef DEBUG
14 14
15#include <linux/kernel.h> 15#include <linux/kernel.h>
16#include <linux/io.h>
16 17
17#include <asm/io.h> 18#include <asm/arch/common.h>
18
19#include <asm/arch/control.h> 19#include <asm/arch/control.h>
20 20
21static u32 omap2_ctrl_base; 21static void __iomem *omap2_ctrl_base;
22 22
23#define OMAP_CTRL_REGADDR(reg) (void __iomem *)IO_ADDRESS(omap2_ctrl_base \ 23#define OMAP_CTRL_REGADDR(reg) (omap2_ctrl_base + (reg))
24 + (reg))
25 24
26void omap_ctrl_base_set(u32 base) 25void __init omap2_set_globals_control(struct omap_globals *omap2_globals)
27{ 26{
28 omap2_ctrl_base = base; 27 omap2_ctrl_base = omap2_globals->ctrl;
29} 28}
30 29
31u32 omap_ctrl_base_get(void) 30void __iomem *omap_ctrl_base_get(void)
32{ 31{
33 return omap2_ctrl_base; 32 return omap2_ctrl_base;
34} 33}
@@ -50,25 +49,16 @@ u32 omap_ctrl_readl(u16 offset)
50 49
51void omap_ctrl_writeb(u8 val, u16 offset) 50void omap_ctrl_writeb(u8 val, u16 offset)
52{ 51{
53 pr_debug("omap_ctrl_writeb: writing 0x%0x to 0x%0x\n", val,
54 (u32)OMAP_CTRL_REGADDR(offset));
55
56 __raw_writeb(val, OMAP_CTRL_REGADDR(offset)); 52 __raw_writeb(val, OMAP_CTRL_REGADDR(offset));
57} 53}
58 54
59void omap_ctrl_writew(u16 val, u16 offset) 55void omap_ctrl_writew(u16 val, u16 offset)
60{ 56{
61 pr_debug("omap_ctrl_writew: writing 0x%0x to 0x%0x\n", val,
62 (u32)OMAP_CTRL_REGADDR(offset));
63
64 __raw_writew(val, OMAP_CTRL_REGADDR(offset)); 57 __raw_writew(val, OMAP_CTRL_REGADDR(offset));
65} 58}
66 59
67void omap_ctrl_writel(u32 val, u16 offset) 60void omap_ctrl_writel(u32 val, u16 offset)
68{ 61{
69 pr_debug("omap_ctrl_writel: writing 0x%0x to 0x%0x\n", val,
70 (u32)OMAP_CTRL_REGADDR(offset));
71
72 __raw_writel(val, OMAP_CTRL_REGADDR(offset)); 62 __raw_writel(val, OMAP_CTRL_REGADDR(offset));
73} 63}
74 64
diff --git a/arch/arm/mach-omap2/gpmc.c b/arch/arm/mach-omap2/gpmc.c
index 02cede295e89..dbf68dc50ae2 100644
--- a/arch/arm/mach-omap2/gpmc.c
+++ b/arch/arm/mach-omap2/gpmc.c
@@ -42,7 +42,7 @@
42#define GPMC_STATUS 0x54 42#define GPMC_STATUS 0x54
43#define GPMC_PREFETCH_CONFIG1 0x1e0 43#define GPMC_PREFETCH_CONFIG1 0x1e0
44#define GPMC_PREFETCH_CONFIG2 0x1e4 44#define GPMC_PREFETCH_CONFIG2 0x1e4
45#define GPMC_PREFETCH_CONTROL 0x1e8 45#define GPMC_PREFETCH_CONTROL 0x1ec
46#define GPMC_PREFETCH_STATUS 0x1f0 46#define GPMC_PREFETCH_STATUS 0x1f0
47#define GPMC_ECC_CONFIG 0x1f4 47#define GPMC_ECC_CONFIG 0x1f4
48#define GPMC_ECC_CONTROL 0x1f8 48#define GPMC_ECC_CONTROL 0x1f8
diff --git a/arch/arm/mach-omap2/id.c b/arch/arm/mach-omap2/id.c
index 4dfd878d7968..dff4b16cead6 100644
--- a/arch/arm/mach-omap2/id.c
+++ b/arch/arm/mach-omap2/id.c
@@ -17,16 +17,23 @@
17 17
18#include <asm/io.h> 18#include <asm/io.h>
19 19
20#if defined(CONFIG_ARCH_OMAP2420) 20#include <asm/arch/control.h>
21#define OMAP24XX_TAP_BASE io_p2v(0x48014000) 21#include <asm/arch/cpu.h>
22#endif
23 22
24#if defined(CONFIG_ARCH_OMAP2430) 23#if defined(CONFIG_ARCH_OMAP2420)
25#define OMAP24XX_TAP_BASE io_p2v(0x4900A000) 24#define TAP_BASE io_p2v(0x48014000)
25#elif defined(CONFIG_ARCH_OMAP2430)
26#define TAP_BASE io_p2v(0x4900A000)
27#elif defined(CONFIG_ARCH_OMAP34XX)
28#define TAP_BASE io_p2v(0x4830A000)
26#endif 29#endif
27 30
28#define OMAP_TAP_IDCODE 0x0204 31#define OMAP_TAP_IDCODE 0x0204
32#if defined(CONFIG_ARCH_OMAP34XX)
33#define OMAP_TAP_PROD_ID 0x0210
34#else
29#define OMAP_TAP_PROD_ID 0x0208 35#define OMAP_TAP_PROD_ID 0x0208
36#endif
30 37
31#define OMAP_TAP_DIE_ID_0 0x0218 38#define OMAP_TAP_DIE_ID_0 0x0218
32#define OMAP_TAP_DIE_ID_1 0x021C 39#define OMAP_TAP_DIE_ID_1 0x021C
@@ -56,9 +63,134 @@ static struct omap_id omap_ids[] __initdata = {
56 { .hawkeye = 0xb68a, .dev = 0x0, .type = 0x24300000 }, 63 { .hawkeye = 0xb68a, .dev = 0x0, .type = 0x24300000 },
57}; 64};
58 65
66static struct omap_chip_id omap_chip;
67
68/**
69 * omap_chip_is - test whether currently running OMAP matches a chip type
70 * @oc: omap_chip_t to test against
71 *
72 * Test whether the currently-running OMAP chip matches the supplied
73 * chip type 'oc'. Returns 1 upon a match; 0 upon failure.
74 */
75int omap_chip_is(struct omap_chip_id oci)
76{
77 return (oci.oc & omap_chip.oc) ? 1 : 0;
78}
79EXPORT_SYMBOL(omap_chip_is);
80
59static u32 __init read_tap_reg(int reg) 81static u32 __init read_tap_reg(int reg)
60{ 82{
61 return __raw_readl(OMAP24XX_TAP_BASE + reg); 83 unsigned int regval = 0;
84 u32 cpuid;
85
86 /* Reading the IDCODE register on 3430 ES1 results in a
87 * data abort as the register is not exposed on the OCP
88 * Hence reading the Cortex Rev
89 */
90 cpuid = read_cpuid(CPUID_ID);
91
92 /* If the processor type is Cortex-A8 and the revision is 0x0
93 * it means its Cortex r0p0 which is 3430 ES1
94 */
95 if ((((cpuid >> 4) & 0xFFF) == 0xC08) && ((cpuid & 0xF) == 0x0)) {
96 switch (reg) {
97 case OMAP_TAP_IDCODE : regval = 0x0B7AE02F; break;
98 /* Making DevType as 0xF in ES1 to differ from ES2 */
99 case OMAP_TAP_PROD_ID : regval = 0x000F00F0; break;
100 case OMAP_TAP_DIE_ID_0: regval = 0x01000000; break;
101 case OMAP_TAP_DIE_ID_1: regval = 0x1012d687; break;
102 case OMAP_TAP_DIE_ID_2: regval = 0x00000000; break;
103 case OMAP_TAP_DIE_ID_3: regval = 0x2d2c0000; break;
104 }
105 } else
106 regval = __raw_readl(TAP_BASE + reg);
107
108 return regval;
109
110}
111
112/*
113 * _set_system_rev - set the system_rev global based on current OMAP chip type
114 *
115 * Set the system_rev global. This is primarily used by the cpu_is_omapxxxx()
116 * macros.
117 */
118static void __init _set_system_rev(u32 type, u8 rev)
119{
120 u32 i, ctrl_status;
121
122 /*
123 * system_rev encoding is as follows
124 * system_rev & 0xff000000 -> Omap Class (24xx/34xx)
125 * system_rev & 0xfff00000 -> Omap Sub Class (242x/343x)
126 * system_rev & 0xffff0000 -> Omap type (2420/2422/2423/2430/3430)
127 * system_rev & 0x0000f000 -> Silicon revision (ES1, ES2 )
128 * system_rev & 0x00000700 -> Device Type ( EMU/HS/GP/BAD )
129 * system_rev & 0x000000c0 -> IDCODE revision[6:7]
130 * system_rev & 0x0000003f -> sys_boot[0:5]
131 */
132 /* Embedding the ES revision info in type field */
133 system_rev = type;
134 /* Also add IDCODE revision info only two lower bits */
135 system_rev |= ((rev & 0x3) << 6);
136
137 /* Add in the device type and sys_boot fields (see above) */
138 if (cpu_is_omap24xx()) {
139 i = OMAP24XX_CONTROL_STATUS;
140 } else if (cpu_is_omap343x()) {
141 i = OMAP343X_CONTROL_STATUS;
142 } else {
143 printk(KERN_ERR "id: unknown CPU type\n");
144 BUG();
145 }
146 ctrl_status = omap_ctrl_readl(i);
147 system_rev |= (ctrl_status & (OMAP2_SYSBOOT_5_MASK |
148 OMAP2_SYSBOOT_4_MASK |
149 OMAP2_SYSBOOT_3_MASK |
150 OMAP2_SYSBOOT_2_MASK |
151 OMAP2_SYSBOOT_1_MASK |
152 OMAP2_SYSBOOT_0_MASK));
153 system_rev |= (ctrl_status & OMAP2_DEVICETYPE_MASK);
154}
155
156
157/*
158 * _set_omap_chip - set the omap_chip global based on OMAP chip type
159 *
160 * Build the omap_chip bits. This variable is used by powerdomain and
161 * clockdomain code to indicate whether structures are applicable for
162 * the current OMAP chip type by ANDing it against a 'platform' bitfield
163 * in the structure.
164 */
165static void __init _set_omap_chip(void)
166{
167 if (cpu_is_omap343x()) {
168
169 omap_chip.oc = CHIP_IS_OMAP3430;
170 if (is_sil_rev_equal_to(OMAP3430_REV_ES1_0))
171 omap_chip.oc |= CHIP_IS_OMAP3430ES1;
172 else if (is_sil_rev_greater_than(OMAP3430_REV_ES1_0))
173 omap_chip.oc |= CHIP_IS_OMAP3430ES2;
174
175 } else if (cpu_is_omap243x()) {
176
177 /* Currently only supports 2430ES2.1 and 2430-all */
178 omap_chip.oc |= CHIP_IS_OMAP2430;
179
180 } else if (cpu_is_omap242x()) {
181
182 /* Currently only supports 2420ES2.1.1 and 2420-all */
183 omap_chip.oc |= CHIP_IS_OMAP2420;
184
185 } else {
186
187 /* Current CPU not supported by this code. */
188 printk(KERN_WARNING "OMAP chip type code does not yet support "
189 "this CPU type.\n");
190 WARN_ON(1);
191
192 }
193
62} 194}
63 195
64void __init omap2_check_revision(void) 196void __init omap2_check_revision(void)
@@ -76,21 +208,31 @@ void __init omap2_check_revision(void)
76 rev = (idcode >> 28) & 0x0f; 208 rev = (idcode >> 28) & 0x0f;
77 dev_type = (prod_id >> 16) & 0x0f; 209 dev_type = (prod_id >> 16) & 0x0f;
78 210
79#ifdef DEBUG 211 pr_debug("OMAP_TAP_IDCODE 0x%08x REV %i HAWKEYE 0x%04x MANF %03x\n",
80 printk(KERN_DEBUG "OMAP_TAP_IDCODE 0x%08x REV %i HAWKEYE 0x%04x MANF %03x\n", 212 idcode, rev, hawkeye, (idcode >> 1) & 0x7ff);
81 idcode, rev, hawkeye, (idcode >> 1) & 0x7ff); 213 pr_debug("OMAP_TAP_DIE_ID_0: 0x%08x\n",
82 printk(KERN_DEBUG "OMAP_TAP_DIE_ID_0: 0x%08x\n", 214 read_tap_reg(OMAP_TAP_DIE_ID_0));
83 read_tap_reg(OMAP_TAP_DIE_ID_0)); 215 pr_debug("OMAP_TAP_DIE_ID_1: 0x%08x DEV_REV: %i\n",
84 printk(KERN_DEBUG "OMAP_TAP_DIE_ID_1: 0x%08x DEV_REV: %i\n", 216 read_tap_reg(OMAP_TAP_DIE_ID_1),
85 read_tap_reg(OMAP_TAP_DIE_ID_1), 217 (read_tap_reg(OMAP_TAP_DIE_ID_1) >> 28) & 0xf);
86 (read_tap_reg(OMAP_TAP_DIE_ID_1) >> 28) & 0xf); 218 pr_debug("OMAP_TAP_DIE_ID_2: 0x%08x\n",
87 printk(KERN_DEBUG "OMAP_TAP_DIE_ID_2: 0x%08x\n", 219 read_tap_reg(OMAP_TAP_DIE_ID_2));
88 read_tap_reg(OMAP_TAP_DIE_ID_2)); 220 pr_debug("OMAP_TAP_DIE_ID_3: 0x%08x\n",
89 printk(KERN_DEBUG "OMAP_TAP_DIE_ID_3: 0x%08x\n", 221 read_tap_reg(OMAP_TAP_DIE_ID_3));
90 read_tap_reg(OMAP_TAP_DIE_ID_3)); 222 pr_debug("OMAP_TAP_PROD_ID_0: 0x%08x DEV_TYPE: %i\n",
91 printk(KERN_DEBUG "OMAP_TAP_PROD_ID_0: 0x%08x DEV_TYPE: %i\n", 223 prod_id, dev_type);
92 prod_id, dev_type); 224
93#endif 225 /*
226 * Detection for 34xx ES2.0 and above can be done with just
227 * hawkeye and rev. See TRM 1.5.2 Device Identification.
228 * Note that rev cannot be used directly as ES1.0 uses value 0.
229 */
230 if (hawkeye == 0xb7ae) {
231 system_rev = 0x34300000 | ((1 + rev) << 12);
232 pr_info("OMAP%04x ES2.%i\n", system_rev >> 16, rev);
233 _set_omap_chip();
234 return;
235 }
94 236
95 /* Check hawkeye ids */ 237 /* Check hawkeye ids */
96 for (i = 0; i < ARRAY_SIZE(omap_ids); i++) { 238 for (i = 0; i < ARRAY_SIZE(omap_ids); i++) {
@@ -114,16 +256,15 @@ void __init omap2_check_revision(void)
114 omap_ids[i].type >> 16); 256 omap_ids[i].type >> 16);
115 j = i; 257 j = i;
116 } 258 }
117 system_rev = omap_ids[j].type;
118 259
119 system_rev |= rev << 8; 260 _set_system_rev(omap_ids[j].type, rev);
120 261
121 /* Add the cpu class info (24xx) */ 262 _set_omap_chip();
122 system_rev |= 0x24;
123 263
124 pr_info("OMAP%04x", system_rev >> 16); 264 pr_info("OMAP%04x", system_rev >> 16);
125 if ((system_rev >> 8) & 0x0f) 265 if ((system_rev >> 8) & 0x0f)
126 printk("%x", (system_rev >> 8) & 0x0f); 266 pr_info("ES%x", (system_rev >> 12) & 0xf);
127 printk("\n"); 267 pr_info("\n");
268
128} 269}
129 270
diff --git a/arch/arm/mach-omap2/mcbsp.c b/arch/arm/mach-omap2/mcbsp.c
new file mode 100644
index 000000000000..17cf199d1130
--- /dev/null
+++ b/arch/arm/mach-omap2/mcbsp.c
@@ -0,0 +1,208 @@
1/*
2 * linux/arch/arm/mach-omap2/mcbsp.c
3 *
4 * Copyright (C) 2008 Instituto Nokia de Tecnologia
5 * Contact: Eduardo Valentin <eduardo.valentin@indt.org.br>
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 version 2 as
9 * published by the Free Software Foundation.
10 *
11 * Multichannel mode not supported.
12 */
13#include <linux/module.h>
14#include <linux/init.h>
15#include <linux/clk.h>
16#include <linux/err.h>
17#include <linux/io.h>
18#include <linux/platform_device.h>
19
20#include <asm/arch/dma.h>
21#include <asm/arch/mux.h>
22#include <asm/arch/cpu.h>
23#include <asm/arch/mcbsp.h>
24
25struct mcbsp_internal_clk {
26 struct clk clk;
27 struct clk **childs;
28 int n_childs;
29};
30
31#if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX)
32static void omap_mcbsp_clk_init(struct mcbsp_internal_clk *mclk)
33{
34 const char *clk_names[] = { "mcbsp_ick", "mcbsp_fck" };
35 int i;
36
37 mclk->n_childs = ARRAY_SIZE(clk_names);
38 mclk->childs = kzalloc(mclk->n_childs * sizeof(struct clk *),
39 GFP_KERNEL);
40
41 for (i = 0; i < mclk->n_childs; i++) {
42 /* We fake a platform device to get correct device id */
43 struct platform_device pdev;
44
45 pdev.dev.bus = &platform_bus_type;
46 pdev.id = mclk->clk.id;
47 mclk->childs[i] = clk_get(&pdev.dev, clk_names[i]);
48 if (IS_ERR(mclk->childs[i]))
49 printk(KERN_ERR "Could not get clock %s (%d).\n",
50 clk_names[i], mclk->clk.id);
51 }
52}
53
54static int omap_mcbsp_clk_enable(struct clk *clk)
55{
56 struct mcbsp_internal_clk *mclk = container_of(clk,
57 struct mcbsp_internal_clk, clk);
58 int i;
59
60 for (i = 0; i < mclk->n_childs; i++)
61 clk_enable(mclk->childs[i]);
62 return 0;
63}
64
65static void omap_mcbsp_clk_disable(struct clk *clk)
66{
67 struct mcbsp_internal_clk *mclk = container_of(clk,
68 struct mcbsp_internal_clk, clk);
69 int i;
70
71 for (i = 0; i < mclk->n_childs; i++)
72 clk_disable(mclk->childs[i]);
73}
74
75static struct mcbsp_internal_clk omap_mcbsp_clks[] = {
76 {
77 .clk = {
78 .name = "mcbsp_clk",
79 .id = 1,
80 .enable = omap_mcbsp_clk_enable,
81 .disable = omap_mcbsp_clk_disable,
82 },
83 },
84 {
85 .clk = {
86 .name = "mcbsp_clk",
87 .id = 2,
88 .enable = omap_mcbsp_clk_enable,
89 .disable = omap_mcbsp_clk_disable,
90 },
91 },
92};
93
94#define omap_mcbsp_clks_size ARRAY_SIZE(omap_mcbsp_clks)
95#else
96#define omap_mcbsp_clks_size 0
97static struct mcbsp_internal_clk __initdata *omap_mcbsp_clks;
98static inline void omap_mcbsp_clk_init(struct clk *clk)
99{ }
100#endif
101
102static void omap2_mcbsp2_mux_setup(void)
103{
104 omap_cfg_reg(Y15_24XX_MCBSP2_CLKX);
105 omap_cfg_reg(R14_24XX_MCBSP2_FSX);
106 omap_cfg_reg(W15_24XX_MCBSP2_DR);
107 omap_cfg_reg(V15_24XX_MCBSP2_DX);
108 omap_cfg_reg(V14_24XX_GPIO117);
109 /*
110 * TODO: Need to add MUX settings for OMAP 2430 SDP
111 */
112}
113
114static void omap2_mcbsp_request(unsigned int id)
115{
116 if (cpu_is_omap2420() && (id == OMAP_MCBSP2))
117 omap2_mcbsp2_mux_setup();
118}
119
120static int omap2_mcbsp_check(unsigned int id)
121{
122 if (id > OMAP_MAX_MCBSP_COUNT - 1) {
123 printk(KERN_ERR "OMAP-McBSP: McBSP%d doesn't exist\n", id + 1);
124 return -ENODEV;
125 }
126 return 0;
127}
128
129static struct omap_mcbsp_ops omap2_mcbsp_ops = {
130 .request = omap2_mcbsp_request,
131 .check = omap2_mcbsp_check,
132};
133
134#ifdef CONFIG_ARCH_OMAP24XX
135static struct omap_mcbsp_platform_data omap24xx_mcbsp_pdata[] = {
136 {
137 .virt_base = IO_ADDRESS(OMAP24XX_MCBSP1_BASE),
138 .dma_rx_sync = OMAP24XX_DMA_MCBSP1_RX,
139 .dma_tx_sync = OMAP24XX_DMA_MCBSP1_TX,
140 .rx_irq = INT_24XX_MCBSP1_IRQ_RX,
141 .tx_irq = INT_24XX_MCBSP1_IRQ_TX,
142 .ops = &omap2_mcbsp_ops,
143 .clk_name = "mcbsp_clk",
144 },
145 {
146 .virt_base = IO_ADDRESS(OMAP24XX_MCBSP2_BASE),
147 .dma_rx_sync = OMAP24XX_DMA_MCBSP2_RX,
148 .dma_tx_sync = OMAP24XX_DMA_MCBSP2_TX,
149 .rx_irq = INT_24XX_MCBSP2_IRQ_RX,
150 .tx_irq = INT_24XX_MCBSP2_IRQ_TX,
151 .ops = &omap2_mcbsp_ops,
152 .clk_name = "mcbsp_clk",
153 },
154};
155#define OMAP24XX_MCBSP_PDATA_SZ ARRAY_SIZE(omap24xx_mcbsp_pdata)
156#else
157#define omap24xx_mcbsp_pdata NULL
158#define OMAP24XX_MCBSP_PDATA_SZ 0
159#endif
160
161#ifdef CONFIG_ARCH_OMAP34XX
162static struct omap_mcbsp_platform_data omap34xx_mcbsp_pdata[] = {
163 {
164 .virt_base = IO_ADDRESS(OMAP34XX_MCBSP1_BASE),
165 .dma_rx_sync = OMAP24XX_DMA_MCBSP1_RX,
166 .dma_tx_sync = OMAP24XX_DMA_MCBSP1_TX,
167 .rx_irq = INT_24XX_MCBSP1_IRQ_RX,
168 .tx_irq = INT_24XX_MCBSP1_IRQ_TX,
169 .ops = &omap2_mcbsp_ops,
170 .clk_name = "mcbsp_clk",
171 },
172 {
173 .virt_base = IO_ADDRESS(OMAP34XX_MCBSP2_BASE),
174 .dma_rx_sync = OMAP24XX_DMA_MCBSP2_RX,
175 .dma_tx_sync = OMAP24XX_DMA_MCBSP2_TX,
176 .rx_irq = INT_24XX_MCBSP2_IRQ_RX,
177 .tx_irq = INT_24XX_MCBSP2_IRQ_TX,
178 .ops = &omap2_mcbsp_ops,
179 .clk_name = "mcbsp_clk",
180 },
181};
182#define OMAP34XX_MCBSP_PDATA_SZ ARRAY_SIZE(omap34xx_mcbsp_pdata)
183#else
184#define omap34xx_mcbsp_pdata NULL
185#define OMAP34XX_MCBSP_PDATA_SZ 0
186#endif
187
188int __init omap2_mcbsp_init(void)
189{
190 int i;
191
192 for (i = 0; i < omap_mcbsp_clks_size; i++) {
193 /* Once we call clk_get inside init, we do not register it */
194 omap_mcbsp_clk_init(&omap_mcbsp_clks[i]);
195 clk_register(&omap_mcbsp_clks[i].clk);
196 }
197
198 if (cpu_is_omap24xx())
199 omap_mcbsp_register_board_cfg(omap24xx_mcbsp_pdata,
200 OMAP24XX_MCBSP_PDATA_SZ);
201
202 if (cpu_is_omap34xx())
203 omap_mcbsp_register_board_cfg(omap34xx_mcbsp_pdata,
204 OMAP34XX_MCBSP_PDATA_SZ);
205
206 return omap_mcbsp_init();
207}
208arch_initcall(omap2_mcbsp_init);
diff --git a/arch/arm/mach-omap2/memory.c b/arch/arm/mach-omap2/memory.c
index 12479081881a..73cadb2c75cf 100644
--- a/arch/arm/mach-omap2/memory.c
+++ b/arch/arm/mach-omap2/memory.c
@@ -24,6 +24,7 @@
24 24
25#include <asm/io.h> 25#include <asm/io.h>
26 26
27#include <asm/arch/common.h>
27#include <asm/arch/clock.h> 28#include <asm/arch/clock.h>
28#include <asm/arch/sram.h> 29#include <asm/arch/sram.h>
29 30
@@ -32,8 +33,8 @@
32#include "memory.h" 33#include "memory.h"
33#include "sdrc.h" 34#include "sdrc.h"
34 35
35unsigned long omap2_sdrc_base; 36void __iomem *omap2_sdrc_base;
36unsigned long omap2_sms_base; 37void __iomem *omap2_sms_base;
37 38
38static struct memory_timings mem_timings; 39static struct memory_timings mem_timings;
39static u32 curr_perf_level = CORE_CLK_SRC_DPLL_X2; 40static u32 curr_perf_level = CORE_CLK_SRC_DPLL_X2;
@@ -154,6 +155,12 @@ void omap2_init_memory_params(u32 force_lock_to_unlock_mode)
154 mem_timings.slow_dll_ctrl |= ((1 << 1) | (3 << 8)); 155 mem_timings.slow_dll_ctrl |= ((1 << 1) | (3 << 8));
155} 156}
156 157
158void __init omap2_set_globals_memory(struct omap_globals *omap2_globals)
159{
160 omap2_sdrc_base = omap2_globals->sdrc;
161 omap2_sms_base = omap2_globals->sms;
162}
163
157/* turn on smart idle modes for SDRAM scheduler and controller */ 164/* turn on smart idle modes for SDRAM scheduler and controller */
158void __init omap2_init_memory(void) 165void __init omap2_init_memory(void)
159{ 166{
diff --git a/arch/arm/mach-omap2/mux.c b/arch/arm/mach-omap2/mux.c
index 930770012a75..8f98b20f30a1 100644
--- a/arch/arm/mach-omap2/mux.c
+++ b/arch/arm/mach-omap2/mux.c
@@ -236,7 +236,7 @@ void __init_or_module omap2_cfg_debug(const struct pin_config *cfg, u8 reg)
236 warn = (orig != reg); 236 warn = (orig != reg);
237 if (debug || warn) 237 if (debug || warn)
238 printk(KERN_WARNING 238 printk(KERN_WARNING
239 "MUX: setup %s (0x%08x): 0x%02x -> 0x%02x\n", 239 "MUX: setup %s (0x%p): 0x%04x -> 0x%04x\n",
240 cfg->name, omap_ctrl_base_get() + cfg->mux_reg, 240 cfg->name, omap_ctrl_base_get() + cfg->mux_reg,
241 orig, reg); 241 orig, reg);
242} 242}
diff --git a/arch/arm/mach-omap2/pm.c b/arch/arm/mach-omap2/pm.c
index aad781dcf1b1..d6c9de82ca0c 100644
--- a/arch/arm/mach-omap2/pm.c
+++ b/arch/arm/mach-omap2/pm.c
@@ -57,13 +57,6 @@ void omap2_pm_idle(void)
57 return; 57 return;
58 } 58 }
59 59
60 /*
61 * Since an interrupt may set up a timer, we don't want to
62 * reprogram the hardware timer with interrupts enabled.
63 * Re-enable interrupts only after returning from idle.
64 */
65 timer_dyn_reprogram();
66
67 omap2_sram_idle(); 60 omap2_sram_idle();
68 local_fiq_enable(); 61 local_fiq_enable();
69 local_irq_enable(); 62 local_irq_enable();
diff --git a/arch/arm/mach-omap2/prcm-common.h b/arch/arm/mach-omap2/prcm-common.h
index cacb34086e35..54c32f482131 100644
--- a/arch/arm/mach-omap2/prcm-common.h
+++ b/arch/arm/mach-omap2/prcm-common.h
@@ -32,6 +32,7 @@
32 32
33 33
34/* Chip-specific module offsets */ 34/* Chip-specific module offsets */
35#define OMAP24XX_GR_MOD OCP_MOD
35#define OMAP24XX_DSP_MOD 0x800 36#define OMAP24XX_DSP_MOD 0x800
36 37
37#define OMAP2430_MDM_MOD 0xc00 38#define OMAP2430_MDM_MOD 0xc00
diff --git a/arch/arm/mach-omap2/prcm.c b/arch/arm/mach-omap2/prcm.c
index b12f423b8595..fd92a80f38f2 100644
--- a/arch/arm/mach-omap2/prcm.c
+++ b/arch/arm/mach-omap2/prcm.c
@@ -16,16 +16,21 @@
16#include <linux/module.h> 16#include <linux/module.h>
17#include <linux/init.h> 17#include <linux/init.h>
18#include <linux/clk.h> 18#include <linux/clk.h>
19#include <linux/io.h>
19 20
20#include <asm/io.h> 21#include <asm/arch/common.h>
22#include <asm/arch/prcm.h>
21 23
24#include "clock.h"
22#include "prm.h" 25#include "prm.h"
23#include "prm-regbits-24xx.h" 26#include "prm-regbits-24xx.h"
24 27
25extern void omap2_clk_prepare_for_reboot(void); 28static void __iomem *prm_base;
29static void __iomem *cm_base;
26 30
27u32 omap_prcm_get_reset_sources(void) 31u32 omap_prcm_get_reset_sources(void)
28{ 32{
33 /* XXX This presumably needs modification for 34XX */
29 return prm_read_mod_reg(WKUP_MOD, RM_RSTST) & 0x7f; 34 return prm_read_mod_reg(WKUP_MOD, RM_RSTST) & 0x7f;
30} 35}
31EXPORT_SYMBOL(omap_prcm_get_reset_sources); 36EXPORT_SYMBOL(omap_prcm_get_reset_sources);
@@ -33,11 +38,90 @@ EXPORT_SYMBOL(omap_prcm_get_reset_sources);
33/* Resets clock rates and reboots the system. Only called from system.h */ 38/* Resets clock rates and reboots the system. Only called from system.h */
34void omap_prcm_arch_reset(char mode) 39void omap_prcm_arch_reset(char mode)
35{ 40{
36 u32 wkup; 41 s16 prcm_offs;
37 omap2_clk_prepare_for_reboot(); 42 omap2_clk_prepare_for_reboot();
38 43
39 if (cpu_is_omap24xx()) { 44 if (cpu_is_omap24xx())
40 wkup = prm_read_mod_reg(WKUP_MOD, RM_RSTCTRL) | OMAP_RST_DPLL3; 45 prcm_offs = WKUP_MOD;
41 prm_write_mod_reg(wkup, WKUP_MOD, RM_RSTCTRL); 46 else if (cpu_is_omap34xx())
42 } 47 prcm_offs = OMAP3430_GR_MOD;
48 else
49 WARN_ON(1);
50
51 prm_set_mod_reg_bits(OMAP_RST_DPLL3, prcm_offs, RM_RSTCTRL);
52}
53
54static inline u32 __omap_prcm_read(void __iomem *base, s16 module, u16 reg)
55{
56 BUG_ON(!base);
57 return __raw_readl(base + module + reg);
58}
59
60static inline void __omap_prcm_write(u32 value, void __iomem *base,
61 s16 module, u16 reg)
62{
63 BUG_ON(!base);
64 __raw_writel(value, base + module + reg);
65}
66
67/* Read a register in a PRM module */
68u32 prm_read_mod_reg(s16 module, u16 idx)
69{
70 return __omap_prcm_read(prm_base, module, idx);
71}
72EXPORT_SYMBOL(prm_read_mod_reg);
73
74/* Write into a register in a PRM module */
75void prm_write_mod_reg(u32 val, s16 module, u16 idx)
76{
77 __omap_prcm_write(val, prm_base, module, idx);
78}
79EXPORT_SYMBOL(prm_write_mod_reg);
80
81/* Read-modify-write a register in a PRM module. Caller must lock */
82u32 prm_rmw_mod_reg_bits(u32 mask, u32 bits, s16 module, s16 idx)
83{
84 u32 v;
85
86 v = prm_read_mod_reg(module, idx);
87 v &= ~mask;
88 v |= bits;
89 prm_write_mod_reg(v, module, idx);
90
91 return v;
92}
93EXPORT_SYMBOL(prm_rmw_mod_reg_bits);
94
95/* Read a register in a CM module */
96u32 cm_read_mod_reg(s16 module, u16 idx)
97{
98 return __omap_prcm_read(cm_base, module, idx);
99}
100EXPORT_SYMBOL(cm_read_mod_reg);
101
102/* Write into a register in a CM module */
103void cm_write_mod_reg(u32 val, s16 module, u16 idx)
104{
105 __omap_prcm_write(val, cm_base, module, idx);
106}
107EXPORT_SYMBOL(cm_write_mod_reg);
108
109/* Read-modify-write a register in a CM module. Caller must lock */
110u32 cm_rmw_mod_reg_bits(u32 mask, u32 bits, s16 module, s16 idx)
111{
112 u32 v;
113
114 v = cm_read_mod_reg(module, idx);
115 v &= ~mask;
116 v |= bits;
117 cm_write_mod_reg(v, module, idx);
118
119 return v;
120}
121EXPORT_SYMBOL(cm_rmw_mod_reg_bits);
122
123void __init omap2_set_globals_prcm(struct omap_globals *omap2_globals)
124{
125 prm_base = omap2_globals->prm;
126 cm_base = omap2_globals->cm;
43} 127}
diff --git a/arch/arm/mach-omap2/prm.h b/arch/arm/mach-omap2/prm.h
index 618f8111658a..bbf41fc8e9a9 100644
--- a/arch/arm/mach-omap2/prm.h
+++ b/arch/arm/mach-omap2/prm.h
@@ -38,13 +38,29 @@
38 * 38 *
39 */ 39 */
40 40
41/* Global 24xx registers in GR_MOD (Same as OCP_MOD for 24xx) */
42#define OMAP24XX_PRCM_VOLTCTRL_OFFSET 0x0050
43#define OMAP24XX_PRCM_CLKCFG_CTRL_OFFSET 0x0080
44
45/* 242x GR_MOD registers, use these only for assembly code */
46#define OMAP242X_PRCM_VOLTCTRL OMAP2420_PRM_REGADDR(OMAP24XX_GR_MOD, \
47 OMAP24XX_PRCM_VOLTCTRL_OFFSET)
48#define OMAP242X_PRCM_CLKCFG_CTRL OMAP2420_PRM_REGADDR(OMAP24XX_GR_MOD, \
49 OMAP24XX_PRCM_CLKCFG_CTRL_OFFSET)
50
51/* 243x GR_MOD registers, use these only for assembly code */
52#define OMAP243X_PRCM_VOLTCTRL OMAP2430_PRM_REGADDR(OMAP24XX_GR_MOD, \
53 OMAP24XX_PRCM_VOLTCTRL_OFFSET)
54#define OMAP243X_PRCM_CLKCFG_CTRL OMAP2430_PRM_REGADDR(OMAP24XX_GR_MOD, \
55 OMAP24XX_PRCM_CLKCFG_CTRL_OFFSET)
56
57/* These will disappear */
41#define OMAP24XX_PRCM_REVISION OMAP_PRM_REGADDR(OCP_MOD, 0x0000) 58#define OMAP24XX_PRCM_REVISION OMAP_PRM_REGADDR(OCP_MOD, 0x0000)
42#define OMAP24XX_PRCM_SYSCONFIG OMAP_PRM_REGADDR(OCP_MOD, 0x0010) 59#define OMAP24XX_PRCM_SYSCONFIG OMAP_PRM_REGADDR(OCP_MOD, 0x0010)
43 60
44#define OMAP24XX_PRCM_IRQSTATUS_MPU OMAP_PRM_REGADDR(OCP_MOD, 0x0018) 61#define OMAP24XX_PRCM_IRQSTATUS_MPU OMAP_PRM_REGADDR(OCP_MOD, 0x0018)
45#define OMAP24XX_PRCM_IRQENABLE_MPU OMAP_PRM_REGADDR(OCP_MOD, 0x001c) 62#define OMAP24XX_PRCM_IRQENABLE_MPU OMAP_PRM_REGADDR(OCP_MOD, 0x001c)
46 63
47#define OMAP24XX_PRCM_VOLTCTRL OMAP_PRM_REGADDR(OCP_MOD, 0x0050)
48#define OMAP24XX_PRCM_VOLTST OMAP_PRM_REGADDR(OCP_MOD, 0x0054) 64#define OMAP24XX_PRCM_VOLTST OMAP_PRM_REGADDR(OCP_MOD, 0x0054)
49#define OMAP24XX_PRCM_CLKSRC_CTRL OMAP_PRM_REGADDR(OCP_MOD, 0x0060) 65#define OMAP24XX_PRCM_CLKSRC_CTRL OMAP_PRM_REGADDR(OCP_MOD, 0x0060)
50#define OMAP24XX_PRCM_CLKOUT_CTRL OMAP_PRM_REGADDR(OCP_MOD, 0x0070) 66#define OMAP24XX_PRCM_CLKOUT_CTRL OMAP_PRM_REGADDR(OCP_MOD, 0x0070)
@@ -150,15 +166,19 @@
150#ifndef __ASSEMBLER__ 166#ifndef __ASSEMBLER__
151 167
152/* Power/reset management domain register get/set */ 168/* Power/reset management domain register get/set */
169extern u32 prm_read_mod_reg(s16 module, u16 idx);
170extern void prm_write_mod_reg(u32 val, s16 module, u16 idx);
171extern u32 prm_rmw_mod_reg_bits(u32 mask, u32 bits, s16 module, s16 idx);
153 172
154static inline void prm_write_mod_reg(u32 val, s16 module, s16 idx) 173/* Read-modify-write bits in a PRM register (by domain) */
174static inline u32 prm_set_mod_reg_bits(u32 bits, s16 module, s16 idx)
155{ 175{
156 __raw_writel(val, OMAP_PRM_REGADDR(module, idx)); 176 return prm_rmw_mod_reg_bits(bits, bits, module, idx);
157} 177}
158 178
159static inline u32 prm_read_mod_reg(s16 module, s16 idx) 179static inline u32 prm_clear_mod_reg_bits(u32 bits, s16 module, s16 idx)
160{ 180{
161 return __raw_readl(OMAP_PRM_REGADDR(module, idx)); 181 return prm_rmw_mod_reg_bits(bits, 0x0, module, idx);
162} 182}
163 183
164#endif 184#endif
diff --git a/arch/arm/mach-omap2/sdrc.h b/arch/arm/mach-omap2/sdrc.h
index d7f23bc9550a..1b1fe4f6e030 100644
--- a/arch/arm/mach-omap2/sdrc.h
+++ b/arch/arm/mach-omap2/sdrc.h
@@ -18,13 +18,11 @@
18#include <asm/arch/sdrc.h> 18#include <asm/arch/sdrc.h>
19 19
20#ifndef __ASSEMBLER__ 20#ifndef __ASSEMBLER__
21extern unsigned long omap2_sdrc_base; 21extern void __iomem *omap2_sdrc_base;
22extern unsigned long omap2_sms_base; 22extern void __iomem *omap2_sms_base;
23 23
24#define OMAP_SDRC_REGADDR(reg) \ 24#define OMAP_SDRC_REGADDR(reg) (omap2_sdrc_base + (reg))
25 (void __iomem *)IO_ADDRESS(omap2_sdrc_base + (reg)) 25#define OMAP_SMS_REGADDR(reg) (omap2_sms_base + (reg))
26#define OMAP_SMS_REGADDR(reg) \
27 (void __iomem *)IO_ADDRESS(omap2_sms_base + (reg))
28 26
29/* SDRC global register get/set */ 27/* SDRC global register get/set */
30 28
diff --git a/arch/arm/mach-omap2/sram-fn.S b/arch/arm/mach-omap2/sram242x.S
index 4a9e49140716..4c274510f3e9 100644
--- a/arch/arm/mach-omap2/sram-fn.S
+++ b/arch/arm/mach-omap2/sram242x.S
@@ -1,5 +1,5 @@
1/* 1/*
2 * linux/arch/arm/mach-omap2/sram-fn.S 2 * linux/arch/arm/mach-omap2/sram242x.S
3 * 3 *
4 * Omap2 specific functions that need to be run in internal SRAM 4 * Omap2 specific functions that need to be run in internal SRAM
5 * 5 *
@@ -27,22 +27,20 @@
27#include <asm/arch/io.h> 27#include <asm/arch/io.h>
28#include <asm/hardware.h> 28#include <asm/hardware.h>
29 29
30#include "sdrc.h"
31#include "prm.h" 30#include "prm.h"
32#include "cm.h" 31#include "cm.h"
33 32#include "sdrc.h"
34#define TIMER_32KSYNCT_CR_V IO_ADDRESS(OMAP2420_32KSYNCT_BASE + 0x010)
35 33
36 .text 34 .text
37 35
38ENTRY(sram_ddr_init) 36ENTRY(omap242x_sram_ddr_init)
39 stmfd sp!, {r0 - r12, lr} @ save registers on stack 37 stmfd sp!, {r0 - r12, lr} @ save registers on stack
40 38
41 mov r12, r2 @ capture CS1 vs CS0 39 mov r12, r2 @ capture CS1 vs CS0
42 mov r8, r3 @ capture force parameter 40 mov r8, r3 @ capture force parameter
43 41
44 /* frequency shift down */ 42 /* frequency shift down */
45 ldr r2, cm_clksel2_pll @ get address of dpllout reg 43 ldr r2, omap242x_sdi_cm_clksel2_pll @ get address of dpllout reg
46 mov r3, #0x1 @ value for 1x operation 44 mov r3, #0x1 @ value for 1x operation
47 str r3, [r2] @ go to L1-freq operation 45 str r3, [r2] @ go to L1-freq operation
48 46
@@ -51,7 +49,7 @@ ENTRY(sram_ddr_init)
51 bl voltage_shift @ go drop voltage 49 bl voltage_shift @ go drop voltage
52 50
53 /* dll lock mode */ 51 /* dll lock mode */
54 ldr r11, sdrc_dlla_ctrl @ addr of dlla ctrl 52 ldr r11, omap242x_sdi_sdrc_dlla_ctrl @ addr of dlla ctrl
55 ldr r10, [r11] @ get current val 53 ldr r10, [r11] @ get current val
56 cmp r12, #0x1 @ cs1 base (2422 es2.05/1) 54 cmp r12, #0x1 @ cs1 base (2422 es2.05/1)
57 addeq r11, r11, #0x8 @ if cs1 base, move to DLLB 55 addeq r11, r11, #0x8 @ if cs1 base, move to DLLB
@@ -102,7 +100,7 @@ i_dll_delay:
102 * wait for it to finish, use 32k sync counter, 1tick=31uS. 100 * wait for it to finish, use 32k sync counter, 1tick=31uS.
103 */ 101 */
104voltage_shift: 102voltage_shift:
105 ldr r4, prcm_voltctrl @ get addr of volt ctrl. 103 ldr r4, omap242x_sdi_prcm_voltctrl @ get addr of volt ctrl.
106 ldr r5, [r4] @ get value. 104 ldr r5, [r4] @ get value.
107 ldr r6, prcm_mask_val @ get value of mask 105 ldr r6, prcm_mask_val @ get value of mask
108 and r5, r5, r6 @ apply mask to clear bits 106 and r5, r5, r6 @ apply mask to clear bits
@@ -112,7 +110,7 @@ voltage_shift:
112 orr r5, r5, r3 @ build value for force 110 orr r5, r5, r3 @ build value for force
113 str r5, [r4] @ Force transition to L1 111 str r5, [r4] @ Force transition to L1
114 112
115 ldr r3, timer_32ksynct_cr @ get addr of counter 113 ldr r3, omap242x_sdi_timer_32ksynct_cr @ get addr of counter
116 ldr r5, [r3] @ get value 114 ldr r5, [r3] @ get value
117 add r5, r5, #0x3 @ give it at most 93uS 115 add r5, r5, #0x3 @ give it at most 93uS
118volt_delay: 116volt_delay:
@@ -121,32 +119,31 @@ volt_delay:
121 bhi volt_delay @ not yet->branch 119 bhi volt_delay @ not yet->branch
122 mov pc, lr @ back to caller. 120 mov pc, lr @ back to caller.
123 121
124/* relative load constants */ 122omap242x_sdi_cm_clksel2_pll:
125cm_clksel2_pll:
126 .word OMAP2420_CM_REGADDR(PLL_MOD, CM_CLKSEL2) 123 .word OMAP2420_CM_REGADDR(PLL_MOD, CM_CLKSEL2)
127sdrc_dlla_ctrl: 124omap242x_sdi_sdrc_dlla_ctrl:
128 .word OMAP242X_SDRC_REGADDR(SDRC_DLLA_CTRL) 125 .word OMAP242X_SDRC_REGADDR(SDRC_DLLA_CTRL)
129prcm_voltctrl: 126omap242x_sdi_prcm_voltctrl:
130 .word OMAP2420_PRM_REGADDR(OCP_MOD, 0x50) 127 .word OMAP242X_PRCM_VOLTCTRL
131prcm_mask_val: 128prcm_mask_val:
132 .word 0xFFFF3FFC 129 .word 0xFFFF3FFC
133timer_32ksynct_cr: 130omap242x_sdi_timer_32ksynct_cr:
134 .word TIMER_32KSYNCT_CR_V 131 .word IO_ADDRESS(OMAP2_32KSYNCT_BASE + 0x010)
135ENTRY(sram_ddr_init_sz) 132ENTRY(omap242x_sram_ddr_init_sz)
136 .word . - sram_ddr_init 133 .word . - omap242x_sram_ddr_init
137 134
138/* 135/*
139 * Reprograms memory timings. 136 * Reprograms memory timings.
140 * r0 = [PRCM_FULL | PRCM_HALF] r1 = SDRC_DLLA_CTRL value r2 = [DDR | SDR] 137 * r0 = [PRCM_FULL | PRCM_HALF] r1 = SDRC_DLLA_CTRL value r2 = [DDR | SDR]
141 * PRCM_FULL = 2, PRCM_HALF = 1, DDR = 1, SDR = 0 138 * PRCM_FULL = 2, PRCM_HALF = 1, DDR = 1, SDR = 0
142 */ 139 */
143ENTRY(sram_reprogram_sdrc) 140ENTRY(omap242x_sram_reprogram_sdrc)
144 stmfd sp!, {r0 - r10, lr} @ save registers on stack 141 stmfd sp!, {r0 - r10, lr} @ save registers on stack
145 mov r3, #0x0 @ clear for mrc call 142 mov r3, #0x0 @ clear for mrc call
146 mcr p15, 0, r3, c7, c10, 4 @ memory barrier, finish ARM SDR/DDR 143 mcr p15, 0, r3, c7, c10, 4 @ memory barrier, finish ARM SDR/DDR
147 nop 144 nop
148 nop 145 nop
149 ldr r6, ddr_sdrc_rfr_ctrl @ get addr of refresh reg 146 ldr r6, omap242x_srs_sdrc_rfr_ctrl @ get addr of refresh reg
150 ldr r5, [r6] @ get value 147 ldr r5, [r6] @ get value
151 mov r5, r5, lsr #8 @ isolate rfr field and drop burst 148 mov r5, r5, lsr #8 @ isolate rfr field and drop burst
152 149
@@ -160,7 +157,7 @@ ENTRY(sram_reprogram_sdrc)
160 movne r5, r5, lsl #1 @ mult by 2 if to full 157 movne r5, r5, lsl #1 @ mult by 2 if to full
161 mov r5, r5, lsl #8 @ put rfr field back into place 158 mov r5, r5, lsl #8 @ put rfr field back into place
162 add r5, r5, #0x1 @ turn on burst of 1 159 add r5, r5, #0x1 @ turn on burst of 1
163 ldr r4, ddr_cm_clksel2_pll @ get address of out reg 160 ldr r4, omap242x_srs_cm_clksel2_pll @ get address of out reg
164 ldr r3, [r4] @ get curr value 161 ldr r3, [r4] @ get curr value
165 orr r3, r3, #0x3 162 orr r3, r3, #0x3
166 bic r3, r3, #0x3 @ clear lower bits 163 bic r3, r3, #0x3 @ clear lower bits
@@ -181,7 +178,7 @@ ENTRY(sram_reprogram_sdrc)
181 bne freq_out @ leave if SDR, no DLL function 178 bne freq_out @ leave if SDR, no DLL function
182 179
183 /* With DDR, we need to take care of the DLL for the frequency change */ 180 /* With DDR, we need to take care of the DLL for the frequency change */
184 ldr r2, ddr_sdrc_dlla_ctrl @ addr of dlla ctrl 181 ldr r2, omap242x_srs_sdrc_dlla_ctrl @ addr of dlla ctrl
185 str r1, [r2] @ write out new SDRC_DLLA_CTRL 182 str r1, [r2] @ write out new SDRC_DLLA_CTRL
186 add r2, r2, #0x8 @ addr to SDRC_DLLB_CTRL 183 add r2, r2, #0x8 @ addr to SDRC_DLLB_CTRL
187 str r1, [r2] @ commit to SDRC_DLLB_CTRL 184 str r1, [r2] @ commit to SDRC_DLLB_CTRL
@@ -197,7 +194,7 @@ freq_out:
197 * wait for it to finish, use 32k sync counter, 1tick=31uS. 194 * wait for it to finish, use 32k sync counter, 1tick=31uS.
198 */ 195 */
199voltage_shift_c: 196voltage_shift_c:
200 ldr r10, ddr_prcm_voltctrl @ get addr of volt ctrl 197 ldr r10, omap242x_srs_prcm_voltctrl @ get addr of volt ctrl
201 ldr r8, [r10] @ get value 198 ldr r8, [r10] @ get value
202 ldr r7, ddr_prcm_mask_val @ get value of mask 199 ldr r7, ddr_prcm_mask_val @ get value of mask
203 and r8, r8, r7 @ apply mask to clear bits 200 and r8, r8, r7 @ apply mask to clear bits
@@ -207,7 +204,7 @@ voltage_shift_c:
207 orr r8, r8, r7 @ build value for force 204 orr r8, r8, r7 @ build value for force
208 str r8, [r10] @ Force transition to L1 205 str r8, [r10] @ Force transition to L1
209 206
210 ldr r10, ddr_timer_32ksynct @ get addr of counter 207 ldr r10, omap242x_srs_timer_32ksynct @ get addr of counter
211 ldr r8, [r10] @ get value 208 ldr r8, [r10] @ get value
212 add r8, r8, #0x2 @ give it at most 62uS (min 31+) 209 add r8, r8, #0x2 @ give it at most 62uS (min 31+)
213volt_delay_c: 210volt_delay_c:
@@ -216,39 +213,39 @@ volt_delay_c:
216 bhi volt_delay_c @ not yet->branch 213 bhi volt_delay_c @ not yet->branch
217 mov pc, lr @ back to caller 214 mov pc, lr @ back to caller
218 215
219ddr_cm_clksel2_pll: 216omap242x_srs_cm_clksel2_pll:
220 .word OMAP2420_CM_REGADDR(PLL_MOD, CM_CLKSEL2) 217 .word OMAP2420_CM_REGADDR(PLL_MOD, CM_CLKSEL2)
221ddr_sdrc_dlla_ctrl: 218omap242x_srs_sdrc_dlla_ctrl:
222 .word OMAP242X_SDRC_REGADDR(SDRC_DLLA_CTRL) 219 .word OMAP242X_SDRC_REGADDR(SDRC_DLLA_CTRL)
223ddr_sdrc_rfr_ctrl: 220omap242x_srs_sdrc_rfr_ctrl:
224 .word OMAP242X_SDRC_REGADDR(SDRC_RFR_CTRL_0) 221 .word OMAP242X_SDRC_REGADDR(SDRC_RFR_CTRL_0)
225ddr_prcm_voltctrl: 222omap242x_srs_prcm_voltctrl:
226 .word OMAP2420_PRM_REGADDR(OCP_MOD, 0x50) 223 .word OMAP242X_PRCM_VOLTCTRL
227ddr_prcm_mask_val: 224ddr_prcm_mask_val:
228 .word 0xFFFF3FFC 225 .word 0xFFFF3FFC
229ddr_timer_32ksynct: 226omap242x_srs_timer_32ksynct:
230 .word TIMER_32KSYNCT_CR_V 227 .word IO_ADDRESS(OMAP2_32KSYNCT_BASE + 0x010)
231 228
232ENTRY(sram_reprogram_sdrc_sz) 229ENTRY(omap242x_sram_reprogram_sdrc_sz)
233 .word . - sram_reprogram_sdrc 230 .word . - omap242x_sram_reprogram_sdrc
234 231
235/* 232/*
236 * Set dividers and pll. Also recalculate DLL value for DDR and unlock mode. 233 * Set dividers and pll. Also recalculate DLL value for DDR and unlock mode.
237 */ 234 */
238ENTRY(sram_set_prcm) 235ENTRY(omap242x_sram_set_prcm)
239 stmfd sp!, {r0-r12, lr} @ regs to stack 236 stmfd sp!, {r0-r12, lr} @ regs to stack
240 adr r4, pbegin @ addr of preload start 237 adr r4, pbegin @ addr of preload start
241 adr r8, pend @ addr of preload end 238 adr r8, pend @ addr of preload end
242 mcrr p15, 1, r8, r4, c12 @ preload into icache 239 mcrr p15, 1, r8, r4, c12 @ preload into icache
243pbegin: 240pbegin:
244 /* move into fast relock bypass */ 241 /* move into fast relock bypass */
245 ldr r8, pll_ctl @ get addr 242 ldr r8, omap242x_ssp_pll_ctl @ get addr
246 ldr r5, [r8] @ get val 243 ldr r5, [r8] @ get val
247 mvn r6, #0x3 @ clear mask 244 mvn r6, #0x3 @ clear mask
248 and r5, r5, r6 @ clear field 245 and r5, r5, r6 @ clear field
249 orr r7, r5, #0x2 @ fast relock val 246 orr r7, r5, #0x2 @ fast relock val
250 str r7, [r8] @ go to fast relock 247 str r7, [r8] @ go to fast relock
251 ldr r4, pll_stat @ addr of stat 248 ldr r4, omap242x_ssp_pll_stat @ addr of stat
252block: 249block:
253 /* wait for bypass */ 250 /* wait for bypass */
254 ldr r8, [r4] @ stat value 251 ldr r8, [r4] @ stat value
@@ -257,10 +254,10 @@ block:
257 bne block @ loop if not 254 bne block @ loop if not
258 255
259 /* set new dpll dividers _after_ in bypass */ 256 /* set new dpll dividers _after_ in bypass */
260 ldr r4, pll_div @ get addr 257 ldr r4, omap242x_ssp_pll_div @ get addr
261 str r0, [r4] @ set dpll ctrl val 258 str r0, [r4] @ set dpll ctrl val
262 259
263 ldr r4, set_config @ get addr 260 ldr r4, omap242x_ssp_set_config @ get addr
264 mov r8, #1 @ valid cfg msk 261 mov r8, #1 @ valid cfg msk
265 str r8, [r4] @ make dividers take 262 str r8, [r4] @ make dividers take
266 263
@@ -274,8 +271,8 @@ wait_a_bit:
274 beq pend @ jump over dpll relock 271 beq pend @ jump over dpll relock
275 272
276 /* relock DPLL with new vals */ 273 /* relock DPLL with new vals */
277 ldr r5, pll_stat @ get addr 274 ldr r5, omap242x_ssp_pll_stat @ get addr
278 ldr r4, pll_ctl @ get addr 275 ldr r4, omap242x_ssp_pll_ctl @ get addr
279 orr r8, r7, #0x3 @ val for lock dpll 276 orr r8, r7, #0x3 @ val for lock dpll
280 str r8, [r4] @ set val 277 str r8, [r4] @ set val
281 mov r0, #1000 @ dead spin a bit 278 mov r0, #1000 @ dead spin a bit
@@ -289,9 +286,9 @@ wait_lock:
289 bne wait_lock @ wait if not 286 bne wait_lock @ wait if not
290pend: 287pend:
291 /* update memory timings & briefly lock dll */ 288 /* update memory timings & briefly lock dll */
292 ldr r4, sdrc_rfr @ get addr 289 ldr r4, omap242x_ssp_sdrc_rfr @ get addr
293 str r1, [r4] @ update refresh timing 290 str r1, [r4] @ update refresh timing
294 ldr r11, dlla_ctrl @ get addr of DLLA ctrl 291 ldr r11, omap242x_ssp_dlla_ctrl @ get addr of DLLA ctrl
295 ldr r10, [r11] @ get current val 292 ldr r10, [r11] @ get current val
296 mvn r9, #0x4 @ mask to get clear bit2 293 mvn r9, #0x4 @ mask to get clear bit2
297 and r10, r10, r9 @ clear bit2 for lock mode 294 and r10, r10, r9 @ clear bit2 for lock mode
@@ -307,18 +304,18 @@ wait_dll_lock:
307 nop 304 nop
308 ldmfd sp!, {r0-r12, pc} @ restore regs and return 305 ldmfd sp!, {r0-r12, pc} @ restore regs and return
309 306
310set_config: 307omap242x_ssp_set_config:
311 .word OMAP2420_PRM_REGADDR(OCP_MOD, 0x80) 308 .word OMAP242X_PRCM_CLKCFG_CTRL
312pll_ctl: 309omap242x_ssp_pll_ctl:
313 .word OMAP2420_CM_REGADDR(PLL_MOD, CM_FCLKEN1) 310 .word OMAP2420_CM_REGADDR(PLL_MOD, CM_CLKEN)
314pll_stat: 311omap242x_ssp_pll_stat:
315 .word OMAP2420_CM_REGADDR(PLL_MOD, CM_IDLEST1) 312 .word OMAP2420_CM_REGADDR(PLL_MOD, CM_IDLEST)
316pll_div: 313omap242x_ssp_pll_div:
317 .word OMAP2420_CM_REGADDR(PLL_MOD, CM_CLKSEL) 314 .word OMAP2420_CM_REGADDR(PLL_MOD, CM_CLKSEL1)
318sdrc_rfr: 315omap242x_ssp_sdrc_rfr:
319 .word OMAP242X_SDRC_REGADDR(SDRC_RFR_CTRL_0) 316 .word OMAP242X_SDRC_REGADDR(SDRC_RFR_CTRL_0)
320dlla_ctrl: 317omap242x_ssp_dlla_ctrl:
321 .word OMAP242X_SDRC_REGADDR(SDRC_DLLA_CTRL) 318 .word OMAP242X_SDRC_REGADDR(SDRC_DLLA_CTRL)
322 319
323ENTRY(sram_set_prcm_sz) 320ENTRY(omap242x_sram_set_prcm_sz)
324 .word . - sram_set_prcm 321 .word . - omap242x_sram_set_prcm
diff --git a/arch/arm/mach-omap2/sram243x.S b/arch/arm/mach-omap2/sram243x.S
new file mode 100644
index 000000000000..a3fa48dc08cd
--- /dev/null
+++ b/arch/arm/mach-omap2/sram243x.S
@@ -0,0 +1,321 @@
1/*
2 * linux/arch/arm/mach-omap2/sram243x.S
3 *
4 * Omap2 specific functions that need to be run in internal SRAM
5 *
6 * (C) Copyright 2004
7 * Texas Instruments, <www.ti.com>
8 * Richard Woodruff <r-woodruff2@ti.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 as
12 * published by the Free Software Foundation; either version 2 of
13 * the License, or (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, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
23 * MA 02111-1307 USA
24 */
25#include <linux/linkage.h>
26#include <asm/assembler.h>
27#include <asm/arch/io.h>
28#include <asm/hardware.h>
29
30#include "prm.h"
31#include "cm.h"
32#include "sdrc.h"
33
34 .text
35
36ENTRY(omap243x_sram_ddr_init)
37 stmfd sp!, {r0 - r12, lr} @ save registers on stack
38
39 mov r12, r2 @ capture CS1 vs CS0
40 mov r8, r3 @ capture force parameter
41
42 /* frequency shift down */
43 ldr r2, omap243x_sdi_cm_clksel2_pll @ get address of dpllout reg
44 mov r3, #0x1 @ value for 1x operation
45 str r3, [r2] @ go to L1-freq operation
46
47 /* voltage shift down */
48 mov r9, #0x1 @ set up for L1 voltage call
49 bl voltage_shift @ go drop voltage
50
51 /* dll lock mode */
52 ldr r11, omap243x_sdi_sdrc_dlla_ctrl @ addr of dlla ctrl
53 ldr r10, [r11] @ get current val
54 cmp r12, #0x1 @ cs1 base (2422 es2.05/1)
55 addeq r11, r11, #0x8 @ if cs1 base, move to DLLB
56 mvn r9, #0x4 @ mask to get clear bit2
57 and r10, r10, r9 @ clear bit2 for lock mode.
58 orr r10, r10, #0x8 @ make sure DLL on (es2 bit pos)
59 orr r10, r10, #0x2 @ 90 degree phase for all below 133Mhz
60 str r10, [r11] @ commit to DLLA_CTRL
61 bl i_dll_wait @ wait for dll to lock
62
63 /* get dll value */
64 add r11, r11, #0x4 @ get addr of status reg
65 ldr r10, [r11] @ get locked value
66
67 /* voltage shift up */
68 mov r9, #0x0 @ shift back to L0-voltage
69 bl voltage_shift @ go raise voltage
70
71 /* frequency shift up */
72 mov r3, #0x2 @ value for 2x operation
73 str r3, [r2] @ go to L0-freq operation
74
75 /* reset entry mode for dllctrl */
76 sub r11, r11, #0x4 @ move from status to ctrl
77 cmp r12, #0x1 @ normalize if cs1 based
78 subeq r11, r11, #0x8 @ possibly back to DLLA
79 cmp r8, #0x1 @ if forced unlock exit
80 orreq r1, r1, #0x4 @ make sure exit with unlocked value
81 str r1, [r11] @ restore DLLA_CTRL high value
82 add r11, r11, #0x8 @ move to DLLB_CTRL addr
83 str r1, [r11] @ set value DLLB_CTRL
84 bl i_dll_wait @ wait for possible lock
85
86 /* set up for return, DDR should be good */
87 str r10, [r0] @ write dll_status and return counter
88 ldmfd sp!, {r0 - r12, pc} @ restore regs and return
89
90 /* ensure the DLL has relocked */
91i_dll_wait:
92 mov r4, #0x800 @ delay DLL relock, min 0x400 L3 clocks
93i_dll_delay:
94 subs r4, r4, #0x1
95 bne i_dll_delay
96 mov pc, lr
97
98 /*
99 * shift up or down voltage, use R9 as input to tell level.
100 * wait for it to finish, use 32k sync counter, 1tick=31uS.
101 */
102voltage_shift:
103 ldr r4, omap243x_sdi_prcm_voltctrl @ get addr of volt ctrl.
104 ldr r5, [r4] @ get value.
105 ldr r6, prcm_mask_val @ get value of mask
106 and r5, r5, r6 @ apply mask to clear bits
107 orr r5, r5, r9 @ bulld value for L0/L1-volt operation.
108 str r5, [r4] @ set up for change.
109 mov r3, #0x4000 @ get val for force
110 orr r5, r5, r3 @ build value for force
111 str r5, [r4] @ Force transition to L1
112
113 ldr r3, omap243x_sdi_timer_32ksynct_cr @ get addr of counter
114 ldr r5, [r3] @ get value
115 add r5, r5, #0x3 @ give it at most 93uS
116volt_delay:
117 ldr r7, [r3] @ get timer value
118 cmp r5, r7 @ time up?
119 bhi volt_delay @ not yet->branch
120 mov pc, lr @ back to caller.
121
122omap243x_sdi_cm_clksel2_pll:
123 .word OMAP2430_CM_REGADDR(PLL_MOD, CM_CLKSEL2)
124omap243x_sdi_sdrc_dlla_ctrl:
125 .word OMAP243X_SDRC_REGADDR(SDRC_DLLA_CTRL)
126omap243x_sdi_prcm_voltctrl:
127 .word OMAP243X_PRCM_VOLTCTRL
128prcm_mask_val:
129 .word 0xFFFF3FFC
130omap243x_sdi_timer_32ksynct_cr:
131 .word IO_ADDRESS(OMAP2_32KSYNCT_BASE + 0x010)
132ENTRY(omap243x_sram_ddr_init_sz)
133 .word . - omap243x_sram_ddr_init
134
135/*
136 * Reprograms memory timings.
137 * r0 = [PRCM_FULL | PRCM_HALF] r1 = SDRC_DLLA_CTRL value r2 = [DDR | SDR]
138 * PRCM_FULL = 2, PRCM_HALF = 1, DDR = 1, SDR = 0
139 */
140ENTRY(omap243x_sram_reprogram_sdrc)
141 stmfd sp!, {r0 - r10, lr} @ save registers on stack
142 mov r3, #0x0 @ clear for mrc call
143 mcr p15, 0, r3, c7, c10, 4 @ memory barrier, finish ARM SDR/DDR
144 nop
145 nop
146 ldr r6, omap243x_srs_sdrc_rfr_ctrl @ get addr of refresh reg
147 ldr r5, [r6] @ get value
148 mov r5, r5, lsr #8 @ isolate rfr field and drop burst
149
150 cmp r0, #0x1 @ going to half speed?
151 movne r9, #0x0 @ if up set flag up for pre up, hi volt
152
153 blne voltage_shift_c @ adjust voltage
154
155 cmp r0, #0x1 @ going to half speed (post branch link)
156 moveq r5, r5, lsr #1 @ divide by 2 if to half
157 movne r5, r5, lsl #1 @ mult by 2 if to full
158 mov r5, r5, lsl #8 @ put rfr field back into place
159 add r5, r5, #0x1 @ turn on burst of 1
160 ldr r4, omap243x_srs_cm_clksel2_pll @ get address of out reg
161 ldr r3, [r4] @ get curr value
162 orr r3, r3, #0x3
163 bic r3, r3, #0x3 @ clear lower bits
164 orr r3, r3, r0 @ new state value
165 str r3, [r4] @ set new state (pll/x, x=1 or 2)
166 nop
167 nop
168
169 moveq r9, #0x1 @ if speed down, post down, drop volt
170 bleq voltage_shift_c
171
172 mcr p15, 0, r3, c7, c10, 4 @ memory barrier
173 str r5, [r6] @ set new RFR_1 value
174 add r6, r6, #0x30 @ get RFR_2 addr
175 str r5, [r6] @ set RFR_2
176 nop
177 cmp r2, #0x1 @ (SDR or DDR) do we need to adjust DLL
178 bne freq_out @ leave if SDR, no DLL function
179
180 /* With DDR, we need to take care of the DLL for the frequency change */
181 ldr r2, omap243x_srs_sdrc_dlla_ctrl @ addr of dlla ctrl
182 str r1, [r2] @ write out new SDRC_DLLA_CTRL
183 add r2, r2, #0x8 @ addr to SDRC_DLLB_CTRL
184 str r1, [r2] @ commit to SDRC_DLLB_CTRL
185 mov r1, #0x2000 @ wait DLL relock, min 0x400 L3 clocks
186dll_wait:
187 subs r1, r1, #0x1
188 bne dll_wait
189freq_out:
190 ldmfd sp!, {r0 - r10, pc} @ restore regs and return
191
192 /*
193 * shift up or down voltage, use R9 as input to tell level.
194 * wait for it to finish, use 32k sync counter, 1tick=31uS.
195 */
196voltage_shift_c:
197 ldr r10, omap243x_srs_prcm_voltctrl @ get addr of volt ctrl
198 ldr r8, [r10] @ get value
199 ldr r7, ddr_prcm_mask_val @ get value of mask
200 and r8, r8, r7 @ apply mask to clear bits
201 orr r8, r8, r9 @ bulld value for L0/L1-volt operation.
202 str r8, [r10] @ set up for change.
203 mov r7, #0x4000 @ get val for force
204 orr r8, r8, r7 @ build value for force
205 str r8, [r10] @ Force transition to L1
206
207 ldr r10, omap243x_srs_timer_32ksynct @ get addr of counter
208 ldr r8, [r10] @ get value
209 add r8, r8, #0x2 @ give it at most 62uS (min 31+)
210volt_delay_c:
211 ldr r7, [r10] @ get timer value
212 cmp r8, r7 @ time up?
213 bhi volt_delay_c @ not yet->branch
214 mov pc, lr @ back to caller
215
216omap243x_srs_cm_clksel2_pll:
217 .word OMAP2430_CM_REGADDR(PLL_MOD, CM_CLKSEL2)
218omap243x_srs_sdrc_dlla_ctrl:
219 .word OMAP243X_SDRC_REGADDR(SDRC_DLLA_CTRL)
220omap243x_srs_sdrc_rfr_ctrl:
221 .word OMAP243X_SDRC_REGADDR(SDRC_RFR_CTRL_0)
222omap243x_srs_prcm_voltctrl:
223 .word OMAP243X_PRCM_VOLTCTRL
224ddr_prcm_mask_val:
225 .word 0xFFFF3FFC
226omap243x_srs_timer_32ksynct:
227 .word IO_ADDRESS(OMAP2_32KSYNCT_BASE + 0x010)
228
229ENTRY(omap243x_sram_reprogram_sdrc_sz)
230 .word . - omap243x_sram_reprogram_sdrc
231
232/*
233 * Set dividers and pll. Also recalculate DLL value for DDR and unlock mode.
234 */
235ENTRY(omap243x_sram_set_prcm)
236 stmfd sp!, {r0-r12, lr} @ regs to stack
237 adr r4, pbegin @ addr of preload start
238 adr r8, pend @ addr of preload end
239 mcrr p15, 1, r8, r4, c12 @ preload into icache
240pbegin:
241 /* move into fast relock bypass */
242 ldr r8, omap243x_ssp_pll_ctl @ get addr
243 ldr r5, [r8] @ get val
244 mvn r6, #0x3 @ clear mask
245 and r5, r5, r6 @ clear field
246 orr r7, r5, #0x2 @ fast relock val
247 str r7, [r8] @ go to fast relock
248 ldr r4, omap243x_ssp_pll_stat @ addr of stat
249block:
250 /* wait for bypass */
251 ldr r8, [r4] @ stat value
252 and r8, r8, #0x3 @ mask for stat
253 cmp r8, #0x1 @ there yet
254 bne block @ loop if not
255
256 /* set new dpll dividers _after_ in bypass */
257 ldr r4, omap243x_ssp_pll_div @ get addr
258 str r0, [r4] @ set dpll ctrl val
259
260 ldr r4, omap243x_ssp_set_config @ get addr
261 mov r8, #1 @ valid cfg msk
262 str r8, [r4] @ make dividers take
263
264 mov r4, #100 @ dead spin a bit
265wait_a_bit:
266 subs r4, r4, #1 @ dec loop
267 bne wait_a_bit @ delay done?
268
269 /* check if staying in bypass */
270 cmp r2, #0x1 @ stay in bypass?
271 beq pend @ jump over dpll relock
272
273 /* relock DPLL with new vals */
274 ldr r5, omap243x_ssp_pll_stat @ get addr
275 ldr r4, omap243x_ssp_pll_ctl @ get addr
276 orr r8, r7, #0x3 @ val for lock dpll
277 str r8, [r4] @ set val
278 mov r0, #1000 @ dead spin a bit
279wait_more:
280 subs r0, r0, #1 @ dec loop
281 bne wait_more @ delay done?
282wait_lock:
283 ldr r8, [r5] @ get lock val
284 and r8, r8, #3 @ isolate field
285 cmp r8, #2 @ locked?
286 bne wait_lock @ wait if not
287pend:
288 /* update memory timings & briefly lock dll */
289 ldr r4, omap243x_ssp_sdrc_rfr @ get addr
290 str r1, [r4] @ update refresh timing
291 ldr r11, omap243x_ssp_dlla_ctrl @ get addr of DLLA ctrl
292 ldr r10, [r11] @ get current val
293 mvn r9, #0x4 @ mask to get clear bit2
294 and r10, r10, r9 @ clear bit2 for lock mode
295 orr r10, r10, #0x8 @ make sure DLL on (es2 bit pos)
296 str r10, [r11] @ commit to DLLA_CTRL
297 add r11, r11, #0x8 @ move to dllb
298 str r10, [r11] @ hit DLLB also
299
300 mov r4, #0x800 @ relock time (min 0x400 L3 clocks)
301wait_dll_lock:
302 subs r4, r4, #0x1
303 bne wait_dll_lock
304 nop
305 ldmfd sp!, {r0-r12, pc} @ restore regs and return
306
307omap243x_ssp_set_config:
308 .word OMAP243X_PRCM_CLKCFG_CTRL
309omap243x_ssp_pll_ctl:
310 .word OMAP2430_CM_REGADDR(PLL_MOD, CM_CLKEN)
311omap243x_ssp_pll_stat:
312 .word OMAP2430_CM_REGADDR(PLL_MOD, CM_IDLEST)
313omap243x_ssp_pll_div:
314 .word OMAP2430_CM_REGADDR(PLL_MOD, CM_CLKSEL1)
315omap243x_ssp_sdrc_rfr:
316 .word OMAP243X_SDRC_REGADDR(SDRC_RFR_CTRL_0)
317omap243x_ssp_dlla_ctrl:
318 .word OMAP243X_SDRC_REGADDR(SDRC_DLLA_CTRL)
319
320ENTRY(omap243x_sram_set_prcm_sz)
321 .word . - omap243x_sram_set_prcm
diff --git a/arch/arm/mach-omap2/timer-gp.c b/arch/arm/mach-omap2/timer-gp.c
index 78d05f203fff..557603f99313 100644
--- a/arch/arm/mach-omap2/timer-gp.c
+++ b/arch/arm/mach-omap2/timer-gp.c
@@ -59,8 +59,7 @@ static struct irqaction omap2_gp_timer_irq = {
59static int omap2_gp_timer_set_next_event(unsigned long cycles, 59static int omap2_gp_timer_set_next_event(unsigned long cycles,
60 struct clock_event_device *evt) 60 struct clock_event_device *evt)
61{ 61{
62 omap_dm_timer_set_load(gptimer, 0, 0xffffffff - cycles); 62 omap_dm_timer_set_load_start(gptimer, 0, 0xffffffff - cycles);
63 omap_dm_timer_start(gptimer);
64 63
65 return 0; 64 return 0;
66} 65}
@@ -77,8 +76,7 @@ static void omap2_gp_timer_set_mode(enum clock_event_mode mode,
77 period = clk_get_rate(omap_dm_timer_get_fclk(gptimer)) / HZ; 76 period = clk_get_rate(omap_dm_timer_get_fclk(gptimer)) / HZ;
78 period -= 1; 77 period -= 1;
79 78
80 omap_dm_timer_set_load(gptimer, 1, 0xffffffff - period); 79 omap_dm_timer_set_load_start(gptimer, 1, 0xffffffff - period);
81 omap_dm_timer_start(gptimer);
82 break; 80 break;
83 case CLOCK_EVT_MODE_ONESHOT: 81 case CLOCK_EVT_MODE_ONESHOT:
84 break; 82 break;
@@ -172,8 +170,7 @@ static void __init omap2_gp_clocksource_init(void)
172 tick_rate = clk_get_rate(omap_dm_timer_get_fclk(gpt)); 170 tick_rate = clk_get_rate(omap_dm_timer_get_fclk(gpt));
173 tick_period = (tick_rate / HZ) - 1; 171 tick_period = (tick_rate / HZ) - 1;
174 172
175 omap_dm_timer_set_load(gpt, 1, 0); 173 omap_dm_timer_set_load_start(gpt, 1, 0);
176 omap_dm_timer_start(gpt);
177 174
178 clocksource_gpt.mult = 175 clocksource_gpt.mult =
179 clocksource_khz2mult(tick_rate/1000, clocksource_gpt.shift); 176 clocksource_khz2mult(tick_rate/1000, clocksource_gpt.shift);
diff --git a/arch/arm/mach-orion5x/Kconfig b/arch/arm/mach-orion5x/Kconfig
index 93debf336155..ddcd41b15d17 100644
--- a/arch/arm/mach-orion5x/Kconfig
+++ b/arch/arm/mach-orion5x/Kconfig
@@ -44,6 +44,54 @@ config MACH_LINKSTATION_PRO
44 Buffalo Linkstation Pro/Live platform. Both v1 and 44 Buffalo Linkstation Pro/Live platform. Both v1 and
45 v2 devices are supported. 45 v2 devices are supported.
46 46
47config MACH_TS409
48 bool "QNAP TS-409"
49 help
50 Say 'Y' here if you want your kernel to support the
51 QNAP TS-409 platform.
52
53config MACH_WRT350N_V2
54 bool "Linksys WRT350N v2"
55 help
56 Say 'Y' here if you want your kernel to support the
57 Linksys WRT350N v2 platform.
58
59config MACH_TS78XX
60 bool "Technologic Systems TS-78xx"
61 help
62 Say 'Y' here if you want your kernel to support the
63 Technologic Systems TS-78xx platform.
64
65config MACH_MV2120
66 bool "HP Media Vault mv2120"
67 help
68 Say 'Y' here if you want your kernel to support the
69 HP Media Vault mv2120 or mv5100.
70
71config MACH_MSS2
72 bool "Maxtor Shared Storage II"
73 help
74 Say 'Y' here if you want your kernel to support the
75 Maxtor Shared Storage II platform.
76
77config MACH_WNR854T
78 bool "Netgear WNR854T"
79 help
80 Say 'Y' here if you want your kernel to support the
81 Netgear WNR854T platform.
82
83config MACH_RD88F5181L_GE
84 bool "Marvell Orion-VoIP GE Reference Design"
85 help
86 Say 'Y' here if you want your kernel to support the
87 Marvell Orion-VoIP GE (88F5181L) RD.
88
89config MACH_RD88F5181L_FXO
90 bool "Marvell Orion-VoIP FXO Reference Design"
91 help
92 Say 'Y' here if you want your kernel to support the
93 Marvell Orion-VoIP FXO (88F5181L) RD.
94
47endmenu 95endmenu
48 96
49endif 97endif
diff --git a/arch/arm/mach-orion5x/Makefile b/arch/arm/mach-orion5x/Makefile
index 9301bf55910b..fcc48a8864f3 100644
--- a/arch/arm/mach-orion5x/Makefile
+++ b/arch/arm/mach-orion5x/Makefile
@@ -1,7 +1,15 @@
1obj-y += common.o addr-map.o pci.o gpio.o irq.o 1obj-y += common.o addr-map.o pci.o gpio.o irq.o mpp.o
2obj-$(CONFIG_MACH_DB88F5281) += db88f5281-setup.o 2obj-$(CONFIG_MACH_DB88F5281) += db88f5281-setup.o
3obj-$(CONFIG_MACH_RD88F5182) += rd88f5182-setup.o 3obj-$(CONFIG_MACH_RD88F5182) += rd88f5182-setup.o
4obj-$(CONFIG_MACH_KUROBOX_PRO) += kurobox_pro-setup.o 4obj-$(CONFIG_MACH_KUROBOX_PRO) += kurobox_pro-setup.o
5obj-$(CONFIG_MACH_LINKSTATION_PRO) += kurobox_pro-setup.o 5obj-$(CONFIG_MACH_LINKSTATION_PRO) += kurobox_pro-setup.o
6obj-$(CONFIG_MACH_DNS323) += dns323-setup.o 6obj-$(CONFIG_MACH_DNS323) += dns323-setup.o
7obj-$(CONFIG_MACH_TS209) += ts209-setup.o 7obj-$(CONFIG_MACH_TS209) += ts209-setup.o tsx09-common.o
8obj-$(CONFIG_MACH_TS409) += ts409-setup.o tsx09-common.o
9obj-$(CONFIG_MACH_WRT350N_V2) += wrt350n-v2-setup.o
10obj-$(CONFIG_MACH_TS78XX) += ts78xx-setup.o
11obj-$(CONFIG_MACH_MV2120) += mv2120-setup.o
12obj-$(CONFIG_MACH_MSS2) += mss2-setup.o
13obj-$(CONFIG_MACH_WNR854T) += wnr854t-setup.o
14obj-$(CONFIG_MACH_RD88F5181L_GE) += rd88f5181l-ge-setup.o
15obj-$(CONFIG_MACH_RD88F5181L_FXO) += rd88f5181l-fxo-setup.o
diff --git a/arch/arm/mach-orion5x/addr-map.c b/arch/arm/mach-orion5x/addr-map.c
index e63fb05dc893..6f0dbda6c44c 100644
--- a/arch/arm/mach-orion5x/addr-map.c
+++ b/arch/arm/mach-orion5x/addr-map.c
@@ -70,6 +70,7 @@
70 70
71 71
72struct mbus_dram_target_info orion5x_mbus_dram_info; 72struct mbus_dram_target_info orion5x_mbus_dram_info;
73static int __initdata win_alloc_count;
73 74
74static int __init orion5x_cpu_win_can_remap(int win) 75static int __init orion5x_cpu_win_can_remap(int win)
75{ 76{
@@ -87,16 +88,22 @@ static int __init orion5x_cpu_win_can_remap(int win)
87static void __init setup_cpu_win(int win, u32 base, u32 size, 88static void __init setup_cpu_win(int win, u32 base, u32 size,
88 u8 target, u8 attr, int remap) 89 u8 target, u8 attr, int remap)
89{ 90{
90 orion5x_write(CPU_WIN_BASE(win), base & 0xffff0000); 91 if (win >= 8) {
91 orion5x_write(CPU_WIN_CTRL(win), 92 printk(KERN_ERR "setup_cpu_win: trying to allocate "
92 ((size - 1) & 0xffff0000) | (attr << 8) | (target << 4) | 1); 93 "window %d\n", win);
94 return;
95 }
96
97 writel(base & 0xffff0000, CPU_WIN_BASE(win));
98 writel(((size - 1) & 0xffff0000) | (attr << 8) | (target << 4) | 1,
99 CPU_WIN_CTRL(win));
93 100
94 if (orion5x_cpu_win_can_remap(win)) { 101 if (orion5x_cpu_win_can_remap(win)) {
95 if (remap < 0) 102 if (remap < 0)
96 remap = base; 103 remap = base;
97 104
98 orion5x_write(CPU_WIN_REMAP_LO(win), remap & 0xffff0000); 105 writel(remap & 0xffff0000, CPU_WIN_REMAP_LO(win));
99 orion5x_write(CPU_WIN_REMAP_HI(win), 0); 106 writel(0, CPU_WIN_REMAP_HI(win));
100 } 107 }
101} 108}
102 109
@@ -109,11 +116,11 @@ void __init orion5x_setup_cpu_mbus_bridge(void)
109 * First, disable and clear windows. 116 * First, disable and clear windows.
110 */ 117 */
111 for (i = 0; i < 8; i++) { 118 for (i = 0; i < 8; i++) {
112 orion5x_write(CPU_WIN_BASE(i), 0); 119 writel(0, CPU_WIN_BASE(i));
113 orion5x_write(CPU_WIN_CTRL(i), 0); 120 writel(0, CPU_WIN_CTRL(i));
114 if (orion5x_cpu_win_can_remap(i)) { 121 if (orion5x_cpu_win_can_remap(i)) {
115 orion5x_write(CPU_WIN_REMAP_LO(i), 0); 122 writel(0, CPU_WIN_REMAP_LO(i));
116 orion5x_write(CPU_WIN_REMAP_HI(i), 0); 123 writel(0, CPU_WIN_REMAP_HI(i));
117 } 124 }
118 } 125 }
119 126
@@ -128,6 +135,7 @@ void __init orion5x_setup_cpu_mbus_bridge(void)
128 TARGET_PCIE, ATTR_PCIE_MEM, -1); 135 TARGET_PCIE, ATTR_PCIE_MEM, -1);
129 setup_cpu_win(3, ORION5X_PCI_MEM_PHYS_BASE, ORION5X_PCI_MEM_SIZE, 136 setup_cpu_win(3, ORION5X_PCI_MEM_PHYS_BASE, ORION5X_PCI_MEM_SIZE,
130 TARGET_PCI, ATTR_PCI_MEM, -1); 137 TARGET_PCI, ATTR_PCI_MEM, -1);
138 win_alloc_count = 4;
131 139
132 /* 140 /*
133 * Setup MBUS dram target info. 141 * Setup MBUS dram target info.
@@ -147,8 +155,8 @@ void __init orion5x_setup_cpu_mbus_bridge(void)
147 w = &orion5x_mbus_dram_info.cs[cs++]; 155 w = &orion5x_mbus_dram_info.cs[cs++];
148 w->cs_index = i; 156 w->cs_index = i;
149 w->mbus_attr = 0xf & ~(1 << i); 157 w->mbus_attr = 0xf & ~(1 << i);
150 w->base = base & 0xff000000; 158 w->base = base & 0xffff0000;
151 w->size = (size | 0x00ffffff) + 1; 159 w->size = (size | 0x0000ffff) + 1;
152 } 160 }
153 } 161 }
154 orion5x_mbus_dram_info.num_cs = cs; 162 orion5x_mbus_dram_info.num_cs = cs;
@@ -156,25 +164,30 @@ void __init orion5x_setup_cpu_mbus_bridge(void)
156 164
157void __init orion5x_setup_dev_boot_win(u32 base, u32 size) 165void __init orion5x_setup_dev_boot_win(u32 base, u32 size)
158{ 166{
159 setup_cpu_win(4, base, size, TARGET_DEV_BUS, ATTR_DEV_BOOT, -1); 167 setup_cpu_win(win_alloc_count++, base, size,
168 TARGET_DEV_BUS, ATTR_DEV_BOOT, -1);
160} 169}
161 170
162void __init orion5x_setup_dev0_win(u32 base, u32 size) 171void __init orion5x_setup_dev0_win(u32 base, u32 size)
163{ 172{
164 setup_cpu_win(5, base, size, TARGET_DEV_BUS, ATTR_DEV_CS0, -1); 173 setup_cpu_win(win_alloc_count++, base, size,
174 TARGET_DEV_BUS, ATTR_DEV_CS0, -1);
165} 175}
166 176
167void __init orion5x_setup_dev1_win(u32 base, u32 size) 177void __init orion5x_setup_dev1_win(u32 base, u32 size)
168{ 178{
169 setup_cpu_win(6, base, size, TARGET_DEV_BUS, ATTR_DEV_CS1, -1); 179 setup_cpu_win(win_alloc_count++, base, size,
180 TARGET_DEV_BUS, ATTR_DEV_CS1, -1);
170} 181}
171 182
172void __init orion5x_setup_dev2_win(u32 base, u32 size) 183void __init orion5x_setup_dev2_win(u32 base, u32 size)
173{ 184{
174 setup_cpu_win(7, base, size, TARGET_DEV_BUS, ATTR_DEV_CS2, -1); 185 setup_cpu_win(win_alloc_count++, base, size,
186 TARGET_DEV_BUS, ATTR_DEV_CS2, -1);
175} 187}
176 188
177void __init orion5x_setup_pcie_wa_win(u32 base, u32 size) 189void __init orion5x_setup_pcie_wa_win(u32 base, u32 size)
178{ 190{
179 setup_cpu_win(7, base, size, TARGET_PCIE, ATTR_PCIE_WA, -1); 191 setup_cpu_win(win_alloc_count++, base, size,
192 TARGET_PCIE, ATTR_PCIE_WA, -1);
180} 193}
diff --git a/arch/arm/mach-orion5x/common.c b/arch/arm/mach-orion5x/common.c
index 4f13fd037f04..faf4e3211918 100644
--- a/arch/arm/mach-orion5x/common.c
+++ b/arch/arm/mach-orion5x/common.c
@@ -39,25 +39,22 @@ static struct map_desc orion5x_io_desc[] __initdata = {
39 .virtual = ORION5X_REGS_VIRT_BASE, 39 .virtual = ORION5X_REGS_VIRT_BASE,
40 .pfn = __phys_to_pfn(ORION5X_REGS_PHYS_BASE), 40 .pfn = __phys_to_pfn(ORION5X_REGS_PHYS_BASE),
41 .length = ORION5X_REGS_SIZE, 41 .length = ORION5X_REGS_SIZE,
42 .type = MT_DEVICE 42 .type = MT_DEVICE,
43 }, 43 }, {
44 {
45 .virtual = ORION5X_PCIE_IO_VIRT_BASE, 44 .virtual = ORION5X_PCIE_IO_VIRT_BASE,
46 .pfn = __phys_to_pfn(ORION5X_PCIE_IO_PHYS_BASE), 45 .pfn = __phys_to_pfn(ORION5X_PCIE_IO_PHYS_BASE),
47 .length = ORION5X_PCIE_IO_SIZE, 46 .length = ORION5X_PCIE_IO_SIZE,
48 .type = MT_DEVICE 47 .type = MT_DEVICE,
49 }, 48 }, {
50 {
51 .virtual = ORION5X_PCI_IO_VIRT_BASE, 49 .virtual = ORION5X_PCI_IO_VIRT_BASE,
52 .pfn = __phys_to_pfn(ORION5X_PCI_IO_PHYS_BASE), 50 .pfn = __phys_to_pfn(ORION5X_PCI_IO_PHYS_BASE),
53 .length = ORION5X_PCI_IO_SIZE, 51 .length = ORION5X_PCI_IO_SIZE,
54 .type = MT_DEVICE 52 .type = MT_DEVICE,
55 }, 53 }, {
56 {
57 .virtual = ORION5X_PCIE_WA_VIRT_BASE, 54 .virtual = ORION5X_PCIE_WA_VIRT_BASE,
58 .pfn = __phys_to_pfn(ORION5X_PCIE_WA_PHYS_BASE), 55 .pfn = __phys_to_pfn(ORION5X_PCIE_WA_PHYS_BASE),
59 .length = ORION5X_PCIE_WA_SIZE, 56 .length = ORION5X_PCIE_WA_SIZE,
60 .type = MT_DEVICE 57 .type = MT_DEVICE,
61 }, 58 },
62}; 59};
63 60
@@ -66,101 +63,32 @@ void __init orion5x_map_io(void)
66 iotable_init(orion5x_io_desc, ARRAY_SIZE(orion5x_io_desc)); 63 iotable_init(orion5x_io_desc, ARRAY_SIZE(orion5x_io_desc));
67} 64}
68 65
66
69/***************************************************************************** 67/*****************************************************************************
70 * UART 68 * EHCI
71 ****************************************************************************/ 69 ****************************************************************************/
72 70static struct orion_ehci_data orion5x_ehci_data = {
73static struct resource orion5x_uart_resources[] = { 71 .dram = &orion5x_mbus_dram_info,
74 {
75 .start = UART0_PHYS_BASE,
76 .end = UART0_PHYS_BASE + 0xff,
77 .flags = IORESOURCE_MEM,
78 },
79 {
80 .start = IRQ_ORION5X_UART0,
81 .end = IRQ_ORION5X_UART0,
82 .flags = IORESOURCE_IRQ,
83 },
84 {
85 .start = UART1_PHYS_BASE,
86 .end = UART1_PHYS_BASE + 0xff,
87 .flags = IORESOURCE_MEM,
88 },
89 {
90 .start = IRQ_ORION5X_UART1,
91 .end = IRQ_ORION5X_UART1,
92 .flags = IORESOURCE_IRQ,
93 },
94};
95
96static struct plat_serial8250_port orion5x_uart_data[] = {
97 {
98 .mapbase = UART0_PHYS_BASE,
99 .membase = (char *)UART0_VIRT_BASE,
100 .irq = IRQ_ORION5X_UART0,
101 .flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF,
102 .iotype = UPIO_MEM,
103 .regshift = 2,
104 .uartclk = ORION5X_TCLK,
105 },
106 {
107 .mapbase = UART1_PHYS_BASE,
108 .membase = (char *)UART1_VIRT_BASE,
109 .irq = IRQ_ORION5X_UART1,
110 .flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF,
111 .iotype = UPIO_MEM,
112 .regshift = 2,
113 .uartclk = ORION5X_TCLK,
114 },
115 { },
116}; 72};
117 73
118static struct platform_device orion5x_uart = { 74static u64 ehci_dmamask = 0xffffffffUL;
119 .name = "serial8250",
120 .id = PLAT8250_DEV_PLATFORM,
121 .dev = {
122 .platform_data = orion5x_uart_data,
123 },
124 .resource = orion5x_uart_resources,
125 .num_resources = ARRAY_SIZE(orion5x_uart_resources),
126};
127 75
128/*******************************************************************************
129 * USB Controller - 2 interfaces
130 ******************************************************************************/
131 76
77/*****************************************************************************
78 * EHCI0
79 ****************************************************************************/
132static struct resource orion5x_ehci0_resources[] = { 80static struct resource orion5x_ehci0_resources[] = {
133 { 81 {
134 .start = ORION5X_USB0_PHYS_BASE, 82 .start = ORION5X_USB0_PHYS_BASE,
135 .end = ORION5X_USB0_PHYS_BASE + SZ_4K - 1, 83 .end = ORION5X_USB0_PHYS_BASE + SZ_4K - 1,
136 .flags = IORESOURCE_MEM, 84 .flags = IORESOURCE_MEM,
137 }, 85 }, {
138 {
139 .start = IRQ_ORION5X_USB0_CTRL, 86 .start = IRQ_ORION5X_USB0_CTRL,
140 .end = IRQ_ORION5X_USB0_CTRL, 87 .end = IRQ_ORION5X_USB0_CTRL,
141 .flags = IORESOURCE_IRQ, 88 .flags = IORESOURCE_IRQ,
142 }, 89 },
143}; 90};
144 91
145static struct resource orion5x_ehci1_resources[] = {
146 {
147 .start = ORION5X_USB1_PHYS_BASE,
148 .end = ORION5X_USB1_PHYS_BASE + SZ_4K - 1,
149 .flags = IORESOURCE_MEM,
150 },
151 {
152 .start = IRQ_ORION5X_USB1_CTRL,
153 .end = IRQ_ORION5X_USB1_CTRL,
154 .flags = IORESOURCE_IRQ,
155 },
156};
157
158static struct orion_ehci_data orion5x_ehci_data = {
159 .dram = &orion5x_mbus_dram_info,
160};
161
162static u64 ehci_dmamask = 0xffffffffUL;
163
164static struct platform_device orion5x_ehci0 = { 92static struct platform_device orion5x_ehci0 = {
165 .name = "orion-ehci", 93 .name = "orion-ehci",
166 .id = 0, 94 .id = 0,
@@ -173,6 +101,27 @@ static struct platform_device orion5x_ehci0 = {
173 .num_resources = ARRAY_SIZE(orion5x_ehci0_resources), 101 .num_resources = ARRAY_SIZE(orion5x_ehci0_resources),
174}; 102};
175 103
104void __init orion5x_ehci0_init(void)
105{
106 platform_device_register(&orion5x_ehci0);
107}
108
109
110/*****************************************************************************
111 * EHCI1
112 ****************************************************************************/
113static struct resource orion5x_ehci1_resources[] = {
114 {
115 .start = ORION5X_USB1_PHYS_BASE,
116 .end = ORION5X_USB1_PHYS_BASE + SZ_4K - 1,
117 .flags = IORESOURCE_MEM,
118 }, {
119 .start = IRQ_ORION5X_USB1_CTRL,
120 .end = IRQ_ORION5X_USB1_CTRL,
121 .flags = IORESOURCE_IRQ,
122 },
123};
124
176static struct platform_device orion5x_ehci1 = { 125static struct platform_device orion5x_ehci1 = {
177 .name = "orion-ehci", 126 .name = "orion-ehci",
178 .id = 1, 127 .id = 1,
@@ -185,11 +134,15 @@ static struct platform_device orion5x_ehci1 = {
185 .num_resources = ARRAY_SIZE(orion5x_ehci1_resources), 134 .num_resources = ARRAY_SIZE(orion5x_ehci1_resources),
186}; 135};
187 136
137void __init orion5x_ehci1_init(void)
138{
139 platform_device_register(&orion5x_ehci1);
140}
141
142
188/***************************************************************************** 143/*****************************************************************************
189 * Gigabit Ethernet port 144 * GigE
190 * (The Orion and Discovery (MV643xx) families use the same Ethernet driver)
191 ****************************************************************************/ 145 ****************************************************************************/
192
193struct mv643xx_eth_shared_platform_data orion5x_eth_shared_data = { 146struct mv643xx_eth_shared_platform_data orion5x_eth_shared_data = {
194 .dram = &orion5x_mbus_dram_info, 147 .dram = &orion5x_mbus_dram_info,
195 .t_clk = ORION5X_TCLK, 148 .t_clk = ORION5X_TCLK,
@@ -219,7 +172,7 @@ static struct resource orion5x_eth_resources[] = {
219 .start = IRQ_ORION5X_ETH_SUM, 172 .start = IRQ_ORION5X_ETH_SUM,
220 .end = IRQ_ORION5X_ETH_SUM, 173 .end = IRQ_ORION5X_ETH_SUM,
221 .flags = IORESOURCE_IRQ, 174 .flags = IORESOURCE_IRQ,
222 } 175 },
223}; 176};
224 177
225static struct platform_device orion5x_eth = { 178static struct platform_device orion5x_eth = {
@@ -238,11 +191,10 @@ void __init orion5x_eth_init(struct mv643xx_eth_platform_data *eth_data)
238 platform_device_register(&orion5x_eth); 191 platform_device_register(&orion5x_eth);
239} 192}
240 193
194
241/***************************************************************************** 195/*****************************************************************************
242 * I2C controller 196 * I2C
243 * (The Orion and Discovery (MV643xx) families share the same I2C controller)
244 ****************************************************************************/ 197 ****************************************************************************/
245
246static struct mv64xxx_i2c_pdata orion5x_i2c_pdata = { 198static struct mv64xxx_i2c_pdata orion5x_i2c_pdata = {
247 .freq_m = 8, /* assumes 166 MHz TCLK */ 199 .freq_m = 8, /* assumes 166 MHz TCLK */
248 .freq_n = 3, 200 .freq_n = 3,
@@ -251,16 +203,15 @@ static struct mv64xxx_i2c_pdata orion5x_i2c_pdata = {
251 203
252static struct resource orion5x_i2c_resources[] = { 204static struct resource orion5x_i2c_resources[] = {
253 { 205 {
254 .name = "i2c base", 206 .name = "i2c base",
255 .start = I2C_PHYS_BASE, 207 .start = I2C_PHYS_BASE,
256 .end = I2C_PHYS_BASE + 0x20 -1, 208 .end = I2C_PHYS_BASE + 0x1f,
257 .flags = IORESOURCE_MEM, 209 .flags = IORESOURCE_MEM,
258 }, 210 }, {
259 { 211 .name = "i2c irq",
260 .name = "i2c irq", 212 .start = IRQ_ORION5X_I2C,
261 .start = IRQ_ORION5X_I2C, 213 .end = IRQ_ORION5X_I2C,
262 .end = IRQ_ORION5X_I2C, 214 .flags = IORESOURCE_IRQ,
263 .flags = IORESOURCE_IRQ,
264 }, 215 },
265}; 216};
266 217
@@ -270,36 +221,41 @@ static struct platform_device orion5x_i2c = {
270 .num_resources = ARRAY_SIZE(orion5x_i2c_resources), 221 .num_resources = ARRAY_SIZE(orion5x_i2c_resources),
271 .resource = orion5x_i2c_resources, 222 .resource = orion5x_i2c_resources,
272 .dev = { 223 .dev = {
273 .platform_data = &orion5x_i2c_pdata, 224 .platform_data = &orion5x_i2c_pdata,
274 }, 225 },
275}; 226};
276 227
228void __init orion5x_i2c_init(void)
229{
230 platform_device_register(&orion5x_i2c);
231}
232
233
277/***************************************************************************** 234/*****************************************************************************
278 * Sata port 235 * SATA
279 ****************************************************************************/ 236 ****************************************************************************/
280static struct resource orion5x_sata_resources[] = { 237static struct resource orion5x_sata_resources[] = {
281 {
282 .name = "sata base",
283 .start = ORION5X_SATA_PHYS_BASE,
284 .end = ORION5X_SATA_PHYS_BASE + 0x5000 - 1,
285 .flags = IORESOURCE_MEM,
286 },
287 { 238 {
288 .name = "sata irq", 239 .name = "sata base",
289 .start = IRQ_ORION5X_SATA, 240 .start = ORION5X_SATA_PHYS_BASE,
290 .end = IRQ_ORION5X_SATA, 241 .end = ORION5X_SATA_PHYS_BASE + 0x5000 - 1,
291 .flags = IORESOURCE_IRQ, 242 .flags = IORESOURCE_MEM,
292 }, 243 }, {
244 .name = "sata irq",
245 .start = IRQ_ORION5X_SATA,
246 .end = IRQ_ORION5X_SATA,
247 .flags = IORESOURCE_IRQ,
248 },
293}; 249};
294 250
295static struct platform_device orion5x_sata = { 251static struct platform_device orion5x_sata = {
296 .name = "sata_mv", 252 .name = "sata_mv",
297 .id = 0, 253 .id = 0,
298 .dev = { 254 .dev = {
299 .coherent_dma_mask = 0xffffffff, 255 .coherent_dma_mask = 0xffffffff,
300 }, 256 },
301 .num_resources = ARRAY_SIZE(orion5x_sata_resources), 257 .num_resources = ARRAY_SIZE(orion5x_sata_resources),
302 .resource = orion5x_sata_resources, 258 .resource = orion5x_sata_resources,
303}; 259};
304 260
305void __init orion5x_sata_init(struct mv_sata_platform_data *sata_data) 261void __init orion5x_sata_init(struct mv_sata_platform_data *sata_data)
@@ -309,23 +265,111 @@ void __init orion5x_sata_init(struct mv_sata_platform_data *sata_data)
309 platform_device_register(&orion5x_sata); 265 platform_device_register(&orion5x_sata);
310} 266}
311 267
268
312/***************************************************************************** 269/*****************************************************************************
313 * Time handling 270 * UART0
271 ****************************************************************************/
272static struct plat_serial8250_port orion5x_uart0_data[] = {
273 {
274 .mapbase = UART0_PHYS_BASE,
275 .membase = (char *)UART0_VIRT_BASE,
276 .irq = IRQ_ORION5X_UART0,
277 .flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF,
278 .iotype = UPIO_MEM,
279 .regshift = 2,
280 .uartclk = ORION5X_TCLK,
281 }, {
282 },
283};
284
285static struct resource orion5x_uart0_resources[] = {
286 {
287 .start = UART0_PHYS_BASE,
288 .end = UART0_PHYS_BASE + 0xff,
289 .flags = IORESOURCE_MEM,
290 }, {
291 .start = IRQ_ORION5X_UART0,
292 .end = IRQ_ORION5X_UART0,
293 .flags = IORESOURCE_IRQ,
294 },
295};
296
297static struct platform_device orion5x_uart0 = {
298 .name = "serial8250",
299 .id = PLAT8250_DEV_PLATFORM,
300 .dev = {
301 .platform_data = orion5x_uart0_data,
302 },
303 .resource = orion5x_uart0_resources,
304 .num_resources = ARRAY_SIZE(orion5x_uart0_resources),
305};
306
307void __init orion5x_uart0_init(void)
308{
309 platform_device_register(&orion5x_uart0);
310}
311
312
313/*****************************************************************************
314 * UART1
314 ****************************************************************************/ 315 ****************************************************************************/
316static struct plat_serial8250_port orion5x_uart1_data[] = {
317 {
318 .mapbase = UART1_PHYS_BASE,
319 .membase = (char *)UART1_VIRT_BASE,
320 .irq = IRQ_ORION5X_UART1,
321 .flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF,
322 .iotype = UPIO_MEM,
323 .regshift = 2,
324 .uartclk = ORION5X_TCLK,
325 }, {
326 },
327};
328
329static struct resource orion5x_uart1_resources[] = {
330 {
331 .start = UART1_PHYS_BASE,
332 .end = UART1_PHYS_BASE + 0xff,
333 .flags = IORESOURCE_MEM,
334 }, {
335 .start = IRQ_ORION5X_UART1,
336 .end = IRQ_ORION5X_UART1,
337 .flags = IORESOURCE_IRQ,
338 },
339};
340
341static struct platform_device orion5x_uart1 = {
342 .name = "serial8250",
343 .id = PLAT8250_DEV_PLATFORM1,
344 .dev = {
345 .platform_data = orion5x_uart1_data,
346 },
347 .resource = orion5x_uart1_resources,
348 .num_resources = ARRAY_SIZE(orion5x_uart1_resources),
349};
350
351void __init orion5x_uart1_init(void)
352{
353 platform_device_register(&orion5x_uart1);
354}
355
315 356
357/*****************************************************************************
358 * Time handling
359 ****************************************************************************/
316static void orion5x_timer_init(void) 360static void orion5x_timer_init(void)
317{ 361{
318 orion_time_init(IRQ_ORION5X_BRIDGE, ORION5X_TCLK); 362 orion_time_init(IRQ_ORION5X_BRIDGE, ORION5X_TCLK);
319} 363}
320 364
321struct sys_timer orion5x_timer = { 365struct sys_timer orion5x_timer = {
322 .init = orion5x_timer_init, 366 .init = orion5x_timer_init,
323}; 367};
324 368
369
325/***************************************************************************** 370/*****************************************************************************
326 * General 371 * General
327 ****************************************************************************/ 372 ****************************************************************************/
328
329/* 373/*
330 * Identify device ID and rev from PCIe configuration header space '0'. 374 * Identify device ID and rev from PCIe configuration header space '0'.
331 */ 375 */
@@ -350,8 +394,10 @@ static void __init orion5x_id(u32 *dev, u32 *rev, char **dev_name)
350 } else if (*dev == MV88F5181_DEV_ID) { 394 } else if (*dev == MV88F5181_DEV_ID) {
351 if (*rev == MV88F5181_REV_B1) { 395 if (*rev == MV88F5181_REV_B1) {
352 *dev_name = "MV88F5181-Rev-B1"; 396 *dev_name = "MV88F5181-Rev-B1";
397 } else if (*rev == MV88F5181L_REV_A1) {
398 *dev_name = "MV88F5181L-Rev-A1";
353 } else { 399 } else {
354 *dev_name = "MV88F5181-Rev-Unsupported"; 400 *dev_name = "MV88F5181(L)-Rev-Unsupported";
355 } 401 }
356 } else { 402 } else {
357 *dev_name = "Device-Unknown"; 403 *dev_name = "Device-Unknown";
@@ -370,15 +416,6 @@ void __init orion5x_init(void)
370 * Setup Orion address map 416 * Setup Orion address map
371 */ 417 */
372 orion5x_setup_cpu_mbus_bridge(); 418 orion5x_setup_cpu_mbus_bridge();
373
374 /*
375 * Register devices.
376 */
377 platform_device_register(&orion5x_uart);
378 platform_device_register(&orion5x_ehci0);
379 if (dev == MV88F5182_DEV_ID)
380 platform_device_register(&orion5x_ehci1);
381 platform_device_register(&orion5x_i2c);
382} 419}
383 420
384/* 421/*
diff --git a/arch/arm/mach-orion5x/common.h b/arch/arm/mach-orion5x/common.h
index bd0f05de6e18..f72cf0e77544 100644
--- a/arch/arm/mach-orion5x/common.h
+++ b/arch/arm/mach-orion5x/common.h
@@ -1,10 +1,12 @@
1#ifndef __ARCH_ORION5X_COMMON_H 1#ifndef __ARCH_ORION5X_COMMON_H
2#define __ARCH_ORION5X_COMMON_H 2#define __ARCH_ORION5X_COMMON_H
3 3
4struct mv643xx_eth_platform_data;
5struct mv_sata_platform_data;
6
4/* 7/*
5 * Basic Orion init functions used early by machine-setup. 8 * Basic Orion init functions used early by machine-setup.
6 */ 9 */
7
8void orion5x_map_io(void); 10void orion5x_map_io(void);
9void orion5x_init_irq(void); 11void orion5x_init_irq(void);
10void orion5x_init(void); 12void orion5x_init(void);
@@ -23,15 +25,22 @@ void orion5x_setup_dev1_win(u32 base, u32 size);
23void orion5x_setup_dev2_win(u32 base, u32 size); 25void orion5x_setup_dev2_win(u32 base, u32 size);
24void orion5x_setup_pcie_wa_win(u32 base, u32 size); 26void orion5x_setup_pcie_wa_win(u32 base, u32 size);
25 27
28void orion5x_ehci0_init(void);
29void orion5x_ehci1_init(void);
30void orion5x_eth_init(struct mv643xx_eth_platform_data *eth_data);
31void orion5x_i2c_init(void);
32void orion5x_sata_init(struct mv_sata_platform_data *sata_data);
33void orion5x_uart0_init(void);
34void orion5x_uart1_init(void);
35
26/* 36/*
27 * Shared code used internally by other Orion core functions. 37 * PCIe/PCI functions.
28 * (/mach-orion/pci.c)
29 */ 38 */
30
31struct pci_sys_data;
32struct pci_bus; 39struct pci_bus;
40struct pci_sys_data;
33 41
34void orion5x_pcie_id(u32 *dev, u32 *rev); 42void orion5x_pcie_id(u32 *dev, u32 *rev);
43void orion5x_pci_set_cardbus_mode(void);
35int orion5x_pci_sys_setup(int nr, struct pci_sys_data *sys); 44int orion5x_pci_sys_setup(int nr, struct pci_sys_data *sys);
36struct pci_bus *orion5x_pci_sys_scan_bus(int nr, struct pci_sys_data *sys); 45struct pci_bus *orion5x_pci_sys_scan_bus(int nr, struct pci_sys_data *sys);
37int orion5x_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin); 46int orion5x_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin);
@@ -40,26 +49,9 @@ int orion5x_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin);
40 * Valid GPIO pins according to MPP setup, used by machine-setup. 49 * Valid GPIO pins according to MPP setup, used by machine-setup.
41 * (/mach-orion/gpio.c). 50 * (/mach-orion/gpio.c).
42 */ 51 */
43 52void orion5x_gpio_set_valid(unsigned pin, int valid);
44void orion5x_gpio_set_valid_pins(u32 pins);
45void gpio_display(void); /* debug */ 53void gpio_display(void); /* debug */
46 54
47/*
48 * Pull in Orion Ethernet platform_data, used by machine-setup
49 */
50
51struct mv643xx_eth_platform_data;
52
53void orion5x_eth_init(struct mv643xx_eth_platform_data *eth_data);
54
55/*
56 * Orion Sata platform_data, used by machine-setup
57 */
58
59struct mv_sata_platform_data;
60
61void orion5x_sata_init(struct mv_sata_platform_data *sata_data);
62
63struct machine_desc; 55struct machine_desc;
64struct meminfo; 56struct meminfo;
65struct tag; 57struct tag;
diff --git a/arch/arm/mach-orion5x/db88f5281-setup.c b/arch/arm/mach-orion5x/db88f5281-setup.c
index 44c64342dacb..88405e74e5e3 100644
--- a/arch/arm/mach-orion5x/db88f5281-setup.c
+++ b/arch/arm/mach-orion5x/db88f5281-setup.c
@@ -27,6 +27,7 @@
27#include <asm/arch/orion5x.h> 27#include <asm/arch/orion5x.h>
28#include <asm/plat-orion/orion_nand.h> 28#include <asm/plat-orion/orion_nand.h>
29#include "common.h" 29#include "common.h"
30#include "mpp.h"
30 31
31/***************************************************************************** 32/*****************************************************************************
32 * DB-88F5281 on board devices 33 * DB-88F5281 on board devices
@@ -86,7 +87,7 @@ static struct platform_device db88f5281_boot_flash = {
86 .name = "physmap-flash", 87 .name = "physmap-flash",
87 .id = 0, 88 .id = 0,
88 .dev = { 89 .dev = {
89 .platform_data = &db88f5281_boot_flash_data, 90 .platform_data = &db88f5281_boot_flash_data,
90 }, 91 },
91 .num_resources = 1, 92 .num_resources = 1,
92 .resource = &db88f5281_boot_flash_resource, 93 .resource = &db88f5281_boot_flash_resource,
@@ -110,7 +111,7 @@ static struct platform_device db88f5281_nor_flash = {
110 .name = "physmap-flash", 111 .name = "physmap-flash",
111 .id = 1, 112 .id = 1,
112 .dev = { 113 .dev = {
113 .platform_data = &db88f5281_nor_flash_data, 114 .platform_data = &db88f5281_nor_flash_data,
114 }, 115 },
115 .num_resources = 1, 116 .num_resources = 1,
116 .resource = &db88f5281_nor_flash_resource, 117 .resource = &db88f5281_nor_flash_resource,
@@ -125,18 +126,15 @@ static struct mtd_partition db88f5281_nand_parts[] = {
125 .name = "kernel", 126 .name = "kernel",
126 .offset = 0, 127 .offset = 0,
127 .size = SZ_2M, 128 .size = SZ_2M,
128 }, 129 }, {
129 {
130 .name = "root", 130 .name = "root",
131 .offset = SZ_2M, 131 .offset = SZ_2M,
132 .size = (SZ_16M - SZ_2M), 132 .size = (SZ_16M - SZ_2M),
133 }, 133 }, {
134 {
135 .name = "user", 134 .name = "user",
136 .offset = SZ_16M, 135 .offset = SZ_16M,
137 .size = SZ_8M, 136 .size = SZ_8M,
138 }, 137 }, {
139 {
140 .name = "recovery", 138 .name = "recovery",
141 .offset = (SZ_16M + SZ_8M), 139 .offset = (SZ_16M + SZ_8M),
142 .size = SZ_8M, 140 .size = SZ_8M,
@@ -288,7 +286,6 @@ subsys_initcall(db88f5281_pci_init);
288 ****************************************************************************/ 286 ****************************************************************************/
289static struct mv643xx_eth_platform_data db88f5281_eth_data = { 287static struct mv643xx_eth_platform_data db88f5281_eth_data = {
290 .phy_addr = 8, 288 .phy_addr = 8,
291 .force_phy_addr = 1,
292}; 289};
293 290
294/***************************************************************************** 291/*****************************************************************************
@@ -301,11 +298,28 @@ static struct i2c_board_info __initdata db88f5281_i2c_rtc = {
301/***************************************************************************** 298/*****************************************************************************
302 * General Setup 299 * General Setup
303 ****************************************************************************/ 300 ****************************************************************************/
304 301static struct orion5x_mpp_mode db88f5281_mpp_modes[] __initdata = {
305static struct platform_device *db88f5281_devs[] __initdata = { 302 { 0, MPP_GPIO }, /* USB Over Current */
306 &db88f5281_boot_flash, 303 { 1, MPP_GPIO }, /* USB Vbat input */
307 &db88f5281_nor_flash, 304 { 2, MPP_PCI_ARB }, /* PCI_REQn[2] */
308 &db88f5281_nand_flash, 305 { 3, MPP_PCI_ARB }, /* PCI_GNTn[2] */
306 { 4, MPP_PCI_ARB }, /* PCI_REQn[3] */
307 { 5, MPP_PCI_ARB }, /* PCI_GNTn[3] */
308 { 6, MPP_GPIO }, /* JP0, CON17.2 */
309 { 7, MPP_GPIO }, /* JP1, CON17.1 */
310 { 8, MPP_GPIO }, /* JP2, CON11.2 */
311 { 9, MPP_GPIO }, /* JP3, CON11.3 */
312 { 10, MPP_GPIO }, /* RTC int */
313 { 11, MPP_GPIO }, /* Baud Rate Generator */
314 { 12, MPP_GPIO }, /* PCI int 1 */
315 { 13, MPP_GPIO }, /* PCI int 2 */
316 { 14, MPP_NAND }, /* NAND_REn[2] */
317 { 15, MPP_NAND }, /* NAND_WEn[2] */
318 { 16, MPP_UART }, /* UART1_RX */
319 { 17, MPP_UART }, /* UART1_TX */
320 { 18, MPP_UART }, /* UART1_CTSn */
321 { 19, MPP_UART }, /* UART1_RTSn */
322 { -1 },
309}; 323};
310 324
311static void __init db88f5281_init(void) 325static void __init db88f5281_init(void)
@@ -315,39 +329,31 @@ static void __init db88f5281_init(void)
315 */ 329 */
316 orion5x_init(); 330 orion5x_init();
317 331
332 orion5x_mpp_conf(db88f5281_mpp_modes);
333 writel(0, MPP_DEV_CTRL); /* DEV_D[31:16] */
334
318 /* 335 /*
319 * Setup the CPU address decode windows for our on-board devices 336 * Configure peripherals.
320 */ 337 */
338 orion5x_ehci0_init();
339 orion5x_eth_init(&db88f5281_eth_data);
340 orion5x_i2c_init();
341 orion5x_uart0_init();
342 orion5x_uart1_init();
343
321 orion5x_setup_dev_boot_win(DB88F5281_NOR_BOOT_BASE, 344 orion5x_setup_dev_boot_win(DB88F5281_NOR_BOOT_BASE,
322 DB88F5281_NOR_BOOT_SIZE); 345 DB88F5281_NOR_BOOT_SIZE);
346 platform_device_register(&db88f5281_boot_flash);
347
323 orion5x_setup_dev0_win(DB88F5281_7SEG_BASE, DB88F5281_7SEG_SIZE); 348 orion5x_setup_dev0_win(DB88F5281_7SEG_BASE, DB88F5281_7SEG_SIZE);
324 orion5x_setup_dev1_win(DB88F5281_NOR_BASE, DB88F5281_NOR_SIZE);
325 orion5x_setup_dev2_win(DB88F5281_NAND_BASE, DB88F5281_NAND_SIZE);
326 349
327 /* 350 orion5x_setup_dev1_win(DB88F5281_NOR_BASE, DB88F5281_NOR_SIZE);
328 * Setup Multiplexing Pins: 351 platform_device_register(&db88f5281_nor_flash);
329 * MPP0: GPIO (USB Over Current) MPP1: GPIO (USB Vbat input)
330 * MPP2: PCI_REQn[2] MPP3: PCI_GNTn[2]
331 * MPP4: PCI_REQn[3] MPP5: PCI_GNTn[3]
332 * MPP6: GPIO (JP0, CON17.2) MPP7: GPIO (JP1, CON17.1)
333 * MPP8: GPIO (JP2, CON11.2) MPP9: GPIO (JP3, CON11.3)
334 * MPP10: GPIO (RTC int) MPP11: GPIO (Baud Rate Generator)
335 * MPP12: GPIO (PCI int 1) MPP13: GPIO (PCI int 2)
336 * MPP14: NAND_REn[2] MPP15: NAND_WEn[2]
337 * MPP16: UART1_RX MPP17: UART1_TX
338 * MPP18: UART1_CTS MPP19: UART1_RTS
339 * MPP-DEV: DEV_D[16:31]
340 */
341 orion5x_write(MPP_0_7_CTRL, 0x00222203);
342 orion5x_write(MPP_8_15_CTRL, 0x44000000);
343 orion5x_write(MPP_16_19_CTRL, 0);
344 orion5x_write(MPP_DEV_CTRL, 0);
345 352
346 orion5x_gpio_set_valid_pins(0x00003fc3); 353 orion5x_setup_dev2_win(DB88F5281_NAND_BASE, DB88F5281_NAND_SIZE);
354 platform_device_register(&db88f5281_nand_flash);
347 355
348 platform_add_devices(db88f5281_devs, ARRAY_SIZE(db88f5281_devs));
349 i2c_register_board_info(0, &db88f5281_i2c_rtc, 1); 356 i2c_register_board_info(0, &db88f5281_i2c_rtc, 1);
350 orion5x_eth_init(&db88f5281_eth_data);
351} 357}
352 358
353MACHINE_START(DB88F5281, "Marvell Orion-2 Development Board") 359MACHINE_START(DB88F5281, "Marvell Orion-2 Development Board")
diff --git a/arch/arm/mach-orion5x/dns323-setup.c b/arch/arm/mach-orion5x/dns323-setup.c
index 27ce967ab9e5..3791ca6f001a 100644
--- a/arch/arm/mach-orion5x/dns323-setup.c
+++ b/arch/arm/mach-orion5x/dns323-setup.c
@@ -27,6 +27,7 @@
27#include <asm/mach/pci.h> 27#include <asm/mach/pci.h>
28#include <asm/arch/orion5x.h> 28#include <asm/arch/orion5x.h>
29#include "common.h" 29#include "common.h"
30#include "mpp.h"
30 31
31#define DNS323_GPIO_LED_RIGHT_AMBER 1 32#define DNS323_GPIO_LED_RIGHT_AMBER 1
32#define DNS323_GPIO_LED_LEFT_AMBER 2 33#define DNS323_GPIO_LED_LEFT_AMBER 2
@@ -52,8 +53,6 @@ static int __init dns323_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
52 if (irq != -1) 53 if (irq != -1)
53 return irq; 54 return irq;
54 55
55 pr_err("%s: requested mapping for unknown device\n", __func__);
56
57 return -1; 56 return -1;
58} 57}
59 58
@@ -81,7 +80,6 @@ subsys_initcall(dns323_pci_init);
81 80
82static struct mv643xx_eth_platform_data dns323_eth_data = { 81static struct mv643xx_eth_platform_data dns323_eth_data = {
83 .phy_addr = 8, 82 .phy_addr = 8,
84 .force_phy_addr = 1,
85}; 83};
86 84
87/**************************************************************************** 85/****************************************************************************
@@ -119,7 +117,7 @@ static struct mtd_partition dns323_partitions[] = {
119 .name = "u-boot", 117 .name = "u-boot",
120 .size = 0x00030000, 118 .size = 0x00030000,
121 .offset = 0x007d0000, 119 .offset = 0x007d0000,
122 } 120 },
123}; 121};
124 122
125static struct physmap_flash_data dns323_nor_flash_data = { 123static struct physmap_flash_data dns323_nor_flash_data = {
@@ -137,7 +135,9 @@ static struct resource dns323_nor_flash_resource = {
137static struct platform_device dns323_nor_flash = { 135static struct platform_device dns323_nor_flash = {
138 .name = "physmap-flash", 136 .name = "physmap-flash",
139 .id = 0, 137 .id = 0,
140 .dev = { .platform_data = &dns323_nor_flash_data, }, 138 .dev = {
139 .platform_data = &dns323_nor_flash_data,
140 },
141 .resource = &dns323_nor_flash_resource, 141 .resource = &dns323_nor_flash_resource,
142 .num_resources = 1, 142 .num_resources = 1,
143}; 143};
@@ -170,7 +170,9 @@ static struct gpio_led_platform_data dns323_led_data = {
170static struct platform_device dns323_gpio_leds = { 170static struct platform_device dns323_gpio_leds = {
171 .name = "leds-gpio", 171 .name = "leds-gpio",
172 .id = -1, 172 .id = -1,
173 .dev = { .platform_data = &dns323_led_data, }, 173 .dev = {
174 .platform_data = &dns323_led_data,
175 },
174}; 176};
175 177
176/**************************************************************************** 178/****************************************************************************
@@ -183,35 +185,53 @@ static struct gpio_keys_button dns323_buttons[] = {
183 .gpio = DNS323_GPIO_KEY_RESET, 185 .gpio = DNS323_GPIO_KEY_RESET,
184 .desc = "Reset Button", 186 .desc = "Reset Button",
185 .active_low = 1, 187 .active_low = 1,
186 }, 188 }, {
187 {
188 .code = KEY_POWER, 189 .code = KEY_POWER,
189 .gpio = DNS323_GPIO_KEY_POWER, 190 .gpio = DNS323_GPIO_KEY_POWER,
190 .desc = "Power Button", 191 .desc = "Power Button",
191 .active_low = 1, 192 .active_low = 1,
192 } 193 },
193}; 194};
194 195
195static struct gpio_keys_platform_data dns323_button_data = { 196static struct gpio_keys_platform_data dns323_button_data = {
196 .buttons = dns323_buttons, 197 .buttons = dns323_buttons,
197 .nbuttons = ARRAY_SIZE(dns323_buttons), 198 .nbuttons = ARRAY_SIZE(dns323_buttons),
198}; 199};
199 200
200static struct platform_device dns323_button_device = { 201static struct platform_device dns323_button_device = {
201 .name = "gpio-keys", 202 .name = "gpio-keys",
202 .id = -1, 203 .id = -1,
203 .num_resources = 0, 204 .num_resources = 0,
204 .dev = { .platform_data = &dns323_button_data, }, 205 .dev = {
206 .platform_data = &dns323_button_data,
207 },
205}; 208};
206 209
207/**************************************************************************** 210/****************************************************************************
208 * General Setup 211 * General Setup
209 */ 212 */
210 213static struct orion5x_mpp_mode dns323_mpp_modes[] __initdata = {
211static struct platform_device *dns323_plat_devices[] __initdata = { 214 { 0, MPP_PCIE_RST_OUTn },
212 &dns323_nor_flash, 215 { 1, MPP_GPIO }, /* right amber LED (sata ch0) */
213 &dns323_gpio_leds, 216 { 2, MPP_GPIO }, /* left amber LED (sata ch1) */
214 &dns323_button_device, 217 { 3, MPP_UNUSED },
218 { 4, MPP_GPIO }, /* power button LED */
219 { 5, MPP_GPIO }, /* power button LED */
220 { 6, MPP_GPIO }, /* GMT G751-2f overtemp */
221 { 7, MPP_GPIO }, /* M41T80 nIRQ/OUT/SQW */
222 { 8, MPP_GPIO }, /* triggers power off */
223 { 9, MPP_GPIO }, /* power button switch */
224 { 10, MPP_GPIO }, /* reset button switch */
225 { 11, MPP_UNUSED },
226 { 12, MPP_UNUSED },
227 { 13, MPP_UNUSED },
228 { 14, MPP_UNUSED },
229 { 15, MPP_UNUSED },
230 { 16, MPP_UNUSED },
231 { 17, MPP_UNUSED },
232 { 18, MPP_UNUSED },
233 { 19, MPP_UNUSED },
234 { -1 },
215}; 235};
216 236
217/* 237/*
@@ -225,17 +245,15 @@ static struct platform_device *dns323_plat_devices[] __initdata = {
225static struct i2c_board_info __initdata dns323_i2c_devices[] = { 245static struct i2c_board_info __initdata dns323_i2c_devices[] = {
226 { 246 {
227 I2C_BOARD_INFO("g760a", 0x3e), 247 I2C_BOARD_INFO("g760a", 0x3e),
228 },
229#if 0 248#if 0
230 /* this entry requires the new-style driver model lm75 driver, 249 /* this entry requires the new-style driver model lm75 driver,
231 * for the meantime "insmod lm75.ko force_lm75=0,0x48" is needed */ 250 * for the meantime "insmod lm75.ko force_lm75=0,0x48" is needed */
232 { 251 }, {
233 I2C_BOARD_INFO("g751", 0x48), 252 I2C_BOARD_INFO("g751", 0x48),
234 },
235#endif 253#endif
236 { 254 }, {
237 I2C_BOARD_INFO("m41t80", 0x68), 255 I2C_BOARD_INFO("m41t80", 0x68),
238 } 256 },
239}; 257};
240 258
241/* DNS-323 specific power off method */ 259/* DNS-323 specific power off method */
@@ -250,62 +268,35 @@ static void __init dns323_init(void)
250 /* Setup basic Orion functions. Need to be called early. */ 268 /* Setup basic Orion functions. Need to be called early. */
251 orion5x_init(); 269 orion5x_init();
252 270
271 orion5x_mpp_conf(dns323_mpp_modes);
272 writel(0, MPP_DEV_CTRL); /* DEV_D[31:16] */
273
274 /*
275 * Configure peripherals.
276 */
277 orion5x_ehci0_init();
278 orion5x_eth_init(&dns323_eth_data);
279 orion5x_i2c_init();
280 orion5x_uart0_init();
281
253 /* setup flash mapping 282 /* setup flash mapping
254 * CS3 holds a 8 MB Spansion S29GL064M90TFIR4 283 * CS3 holds a 8 MB Spansion S29GL064M90TFIR4
255 */ 284 */
256 orion5x_setup_dev_boot_win(DNS323_NOR_BOOT_BASE, DNS323_NOR_BOOT_SIZE); 285 orion5x_setup_dev_boot_win(DNS323_NOR_BOOT_BASE, DNS323_NOR_BOOT_SIZE);
286 platform_device_register(&dns323_nor_flash);
257 287
258 /* DNS-323 has a Marvell 88X7042 SATA controller attached via PCIe 288 platform_device_register(&dns323_gpio_leds);
259 *
260 * Open a special address decode windows for the PCIe WA.
261 */
262 orion5x_setup_pcie_wa_win(ORION5X_PCIE_WA_PHYS_BASE,
263 ORION5X_PCIE_WA_SIZE);
264
265 /* set MPP to 0 as D-Link's 2.6.12.6 kernel did */
266 orion5x_write(MPP_0_7_CTRL, 0);
267 orion5x_write(MPP_8_15_CTRL, 0);
268 orion5x_write(MPP_16_19_CTRL, 0);
269 orion5x_write(MPP_DEV_CTRL, 0);
270
271 /* Define used GPIO pins
272
273 GPIO Map:
274
275 | 0 | | PEX_RST_OUT (not controlled by GPIO)
276 | 1 | Out | right amber LED (= sata ch0 LED) (low-active)
277 | 2 | Out | left amber LED (= sata ch1 LED) (low-active)
278 | 3 | Out | //unknown//
279 | 4 | Out | power button LED (low-active, together with pin #5)
280 | 5 | Out | power button LED (low-active, together with pin #4)
281 | 6 | In | GMT G751-2f overtemp. shutdown signal (low-active)
282 | 7 | In | M41T80 nIRQ/OUT/SQW signal
283 | 8 | Out | triggers power off (high-active)
284 | 9 | In | power button switch (low-active)
285 | 10 | In | reset button switch (low-active)
286 | 11 | Out | //unknown//
287 | 12 | Out | //unknown//
288 | 13 | Out | //unknown//
289 | 14 | Out | //unknown//
290 | 15 | Out | //unknown//
291 */
292 orion5x_gpio_set_valid_pins(0x07f6);
293
294 /* register dns323 specific power-off method */
295 if ((gpio_request(DNS323_GPIO_POWER_OFF, "POWEROFF") != 0)
296 || (gpio_direction_output(DNS323_GPIO_POWER_OFF, 0) != 0))
297 pr_err("DNS323: failed to setup power-off GPIO\n");
298
299 pm_power_off = dns323_power_off;
300 289
301 /* register flash and other platform devices */ 290 platform_device_register(&dns323_button_device);
302 platform_add_devices(dns323_plat_devices,
303 ARRAY_SIZE(dns323_plat_devices));
304 291
305 i2c_register_board_info(0, dns323_i2c_devices, 292 i2c_register_board_info(0, dns323_i2c_devices,
306 ARRAY_SIZE(dns323_i2c_devices)); 293 ARRAY_SIZE(dns323_i2c_devices));
307 294
308 orion5x_eth_init(&dns323_eth_data); 295 /* register dns323 specific power-off method */
296 if (gpio_request(DNS323_GPIO_POWER_OFF, "POWEROFF") != 0 ||
297 gpio_direction_output(DNS323_GPIO_POWER_OFF, 0) != 0)
298 pr_err("DNS323: failed to setup power-off GPIO\n");
299 pm_power_off = dns323_power_off;
309} 300}
310 301
311/* Warning: D-Link uses a wrong mach-type (=526) in their bootloader */ 302/* Warning: D-Link uses a wrong mach-type (=526) in their bootloader */
diff --git a/arch/arm/mach-orion5x/gpio.c b/arch/arm/mach-orion5x/gpio.c
index 8108c316c426..d09797990f41 100644
--- a/arch/arm/mach-orion5x/gpio.c
+++ b/arch/arm/mach-orion5x/gpio.c
@@ -24,9 +24,12 @@ static DEFINE_SPINLOCK(gpio_lock);
24static unsigned long gpio_valid[BITS_TO_LONGS(GPIO_MAX)]; 24static unsigned long gpio_valid[BITS_TO_LONGS(GPIO_MAX)];
25static const char *gpio_label[GPIO_MAX]; /* non null for allocated GPIOs */ 25static const char *gpio_label[GPIO_MAX]; /* non null for allocated GPIOs */
26 26
27void __init orion5x_gpio_set_valid_pins(u32 pins) 27void __init orion5x_gpio_set_valid(unsigned pin, int valid)
28{ 28{
29 gpio_valid[0] = pins; 29 if (valid)
30 __set_bit(pin, gpio_valid);
31 else
32 __clear_bit(pin, gpio_valid);
30} 33}
31 34
32/* 35/*
@@ -93,10 +96,10 @@ int gpio_get_value(unsigned pin)
93{ 96{
94 int val, mask = 1 << pin; 97 int val, mask = 1 << pin;
95 98
96 if (orion5x_read(GPIO_IO_CONF) & mask) 99 if (readl(GPIO_IO_CONF) & mask)
97 val = orion5x_read(GPIO_DATA_IN) ^ orion5x_read(GPIO_IN_POL); 100 val = readl(GPIO_DATA_IN) ^ readl(GPIO_IN_POL);
98 else 101 else
99 val = orion5x_read(GPIO_OUT); 102 val = readl(GPIO_OUT);
100 103
101 return val & mask; 104 return val & mask;
102} 105}
@@ -188,39 +191,39 @@ void gpio_display(void)
188 printk("GPIO, free\n"); 191 printk("GPIO, free\n");
189 } else { 192 } else {
190 printk("GPIO, used by %s, ", gpio_label[i]); 193 printk("GPIO, used by %s, ", gpio_label[i]);
191 if (orion5x_read(GPIO_IO_CONF) & (1 << i)) { 194 if (readl(GPIO_IO_CONF) & (1 << i)) {
192 printk("input, active %s, level %s, edge %s\n", 195 printk("input, active %s, level %s, edge %s\n",
193 ((orion5x_read(GPIO_IN_POL) >> i) & 1) ? "low" : "high", 196 ((readl(GPIO_IN_POL) >> i) & 1) ? "low" : "high",
194 ((orion5x_read(GPIO_LEVEL_MASK) >> i) & 1) ? "enabled" : "masked", 197 ((readl(GPIO_LEVEL_MASK) >> i) & 1) ? "enabled" : "masked",
195 ((orion5x_read(GPIO_EDGE_MASK) >> i) & 1) ? "enabled" : "masked"); 198 ((readl(GPIO_EDGE_MASK) >> i) & 1) ? "enabled" : "masked");
196 } else { 199 } else {
197 printk("output, val=%d\n", (orion5x_read(GPIO_OUT) >> i) & 1); 200 printk("output, val=%d\n", (readl(GPIO_OUT) >> i) & 1);
198 } 201 }
199 } 202 }
200 } 203 }
201 204
202 printk(KERN_DEBUG "MPP_0_7_CTRL (0x%08x) = 0x%08x\n", 205 printk(KERN_DEBUG "MPP_0_7_CTRL (0x%08x) = 0x%08x\n",
203 MPP_0_7_CTRL, orion5x_read(MPP_0_7_CTRL)); 206 MPP_0_7_CTRL, readl(MPP_0_7_CTRL));
204 printk(KERN_DEBUG "MPP_8_15_CTRL (0x%08x) = 0x%08x\n", 207 printk(KERN_DEBUG "MPP_8_15_CTRL (0x%08x) = 0x%08x\n",
205 MPP_8_15_CTRL, orion5x_read(MPP_8_15_CTRL)); 208 MPP_8_15_CTRL, readl(MPP_8_15_CTRL));
206 printk(KERN_DEBUG "MPP_16_19_CTRL (0x%08x) = 0x%08x\n", 209 printk(KERN_DEBUG "MPP_16_19_CTRL (0x%08x) = 0x%08x\n",
207 MPP_16_19_CTRL, orion5x_read(MPP_16_19_CTRL)); 210 MPP_16_19_CTRL, readl(MPP_16_19_CTRL));
208 printk(KERN_DEBUG "MPP_DEV_CTRL (0x%08x) = 0x%08x\n", 211 printk(KERN_DEBUG "MPP_DEV_CTRL (0x%08x) = 0x%08x\n",
209 MPP_DEV_CTRL, orion5x_read(MPP_DEV_CTRL)); 212 MPP_DEV_CTRL, readl(MPP_DEV_CTRL));
210 printk(KERN_DEBUG "GPIO_OUT (0x%08x) = 0x%08x\n", 213 printk(KERN_DEBUG "GPIO_OUT (0x%08x) = 0x%08x\n",
211 GPIO_OUT, orion5x_read(GPIO_OUT)); 214 GPIO_OUT, readl(GPIO_OUT));
212 printk(KERN_DEBUG "GPIO_IO_CONF (0x%08x) = 0x%08x\n", 215 printk(KERN_DEBUG "GPIO_IO_CONF (0x%08x) = 0x%08x\n",
213 GPIO_IO_CONF, orion5x_read(GPIO_IO_CONF)); 216 GPIO_IO_CONF, readl(GPIO_IO_CONF));
214 printk(KERN_DEBUG "GPIO_BLINK_EN (0x%08x) = 0x%08x\n", 217 printk(KERN_DEBUG "GPIO_BLINK_EN (0x%08x) = 0x%08x\n",
215 GPIO_BLINK_EN, orion5x_read(GPIO_BLINK_EN)); 218 GPIO_BLINK_EN, readl(GPIO_BLINK_EN));
216 printk(KERN_DEBUG "GPIO_IN_POL (0x%08x) = 0x%08x\n", 219 printk(KERN_DEBUG "GPIO_IN_POL (0x%08x) = 0x%08x\n",
217 GPIO_IN_POL, orion5x_read(GPIO_IN_POL)); 220 GPIO_IN_POL, readl(GPIO_IN_POL));
218 printk(KERN_DEBUG "GPIO_DATA_IN (0x%08x) = 0x%08x\n", 221 printk(KERN_DEBUG "GPIO_DATA_IN (0x%08x) = 0x%08x\n",
219 GPIO_DATA_IN, orion5x_read(GPIO_DATA_IN)); 222 GPIO_DATA_IN, readl(GPIO_DATA_IN));
220 printk(KERN_DEBUG "GPIO_LEVEL_MASK (0x%08x) = 0x%08x\n", 223 printk(KERN_DEBUG "GPIO_LEVEL_MASK (0x%08x) = 0x%08x\n",
221 GPIO_LEVEL_MASK, orion5x_read(GPIO_LEVEL_MASK)); 224 GPIO_LEVEL_MASK, readl(GPIO_LEVEL_MASK));
222 printk(KERN_DEBUG "GPIO_EDGE_CAUSE (0x%08x) = 0x%08x\n", 225 printk(KERN_DEBUG "GPIO_EDGE_CAUSE (0x%08x) = 0x%08x\n",
223 GPIO_EDGE_CAUSE, orion5x_read(GPIO_EDGE_CAUSE)); 226 GPIO_EDGE_CAUSE, readl(GPIO_EDGE_CAUSE));
224 printk(KERN_DEBUG "GPIO_EDGE_MASK (0x%08x) = 0x%08x\n", 227 printk(KERN_DEBUG "GPIO_EDGE_MASK (0x%08x) = 0x%08x\n",
225 GPIO_EDGE_MASK, orion5x_read(GPIO_EDGE_MASK)); 228 GPIO_EDGE_MASK, readl(GPIO_EDGE_MASK));
226} 229}
diff --git a/arch/arm/mach-orion5x/irq.c b/arch/arm/mach-orion5x/irq.c
index dd21f38c5d37..e2a0084ab4a3 100644
--- a/arch/arm/mach-orion5x/irq.c
+++ b/arch/arm/mach-orion5x/irq.c
@@ -82,7 +82,7 @@ static int orion5x_gpio_set_irq_type(u32 irq, u32 type)
82 int pin = irq_to_gpio(irq); 82 int pin = irq_to_gpio(irq);
83 struct irq_desc *desc; 83 struct irq_desc *desc;
84 84
85 if ((orion5x_read(GPIO_IO_CONF) & (1 << pin)) == 0) { 85 if ((readl(GPIO_IO_CONF) & (1 << pin)) == 0) {
86 printk(KERN_ERR "orion5x_gpio_set_irq_type failed " 86 printk(KERN_ERR "orion5x_gpio_set_irq_type failed "
87 "(irq %d, pin %d).\n", irq, pin); 87 "(irq %d, pin %d).\n", irq, pin);
88 return -EINVAL; 88 return -EINVAL;
@@ -117,7 +117,7 @@ static int orion5x_gpio_set_irq_type(u32 irq, u32 type)
117 /* 117 /*
118 * set initial polarity based on current input level 118 * set initial polarity based on current input level
119 */ 119 */
120 if ((orion5x_read(GPIO_IN_POL) ^ orion5x_read(GPIO_DATA_IN)) 120 if ((readl(GPIO_IN_POL) ^ readl(GPIO_DATA_IN))
121 & (1 << pin)) 121 & (1 << pin))
122 orion5x_setbits(GPIO_IN_POL, (1 << pin)); /* falling */ 122 orion5x_setbits(GPIO_IN_POL, (1 << pin)); /* falling */
123 else 123 else
@@ -149,8 +149,8 @@ static void orion5x_gpio_irq_handler(unsigned int irq, struct irq_desc *desc)
149 149
150 BUG_ON(irq < IRQ_ORION5X_GPIO_0_7 || irq > IRQ_ORION5X_GPIO_24_31); 150 BUG_ON(irq < IRQ_ORION5X_GPIO_0_7 || irq > IRQ_ORION5X_GPIO_24_31);
151 offs = (irq - IRQ_ORION5X_GPIO_0_7) * 8; 151 offs = (irq - IRQ_ORION5X_GPIO_0_7) * 8;
152 cause = (orion5x_read(GPIO_DATA_IN) & orion5x_read(GPIO_LEVEL_MASK)) | 152 cause = (readl(GPIO_DATA_IN) & readl(GPIO_LEVEL_MASK)) |
153 (orion5x_read(GPIO_EDGE_CAUSE) & orion5x_read(GPIO_EDGE_MASK)); 153 (readl(GPIO_EDGE_CAUSE) & readl(GPIO_EDGE_MASK));
154 154
155 for (pin = offs; pin < offs + 8; pin++) { 155 for (pin = offs; pin < offs + 8; pin++) {
156 if (cause & (1 << pin)) { 156 if (cause & (1 << pin)) {
@@ -158,9 +158,9 @@ static void orion5x_gpio_irq_handler(unsigned int irq, struct irq_desc *desc)
158 desc = irq_desc + irq; 158 desc = irq_desc + irq;
159 if ((desc->status & IRQ_TYPE_SENSE_MASK) == IRQT_BOTHEDGE) { 159 if ((desc->status & IRQ_TYPE_SENSE_MASK) == IRQT_BOTHEDGE) {
160 /* Swap polarity (race with GPIO line) */ 160 /* Swap polarity (race with GPIO line) */
161 u32 polarity = orion5x_read(GPIO_IN_POL); 161 u32 polarity = readl(GPIO_IN_POL);
162 polarity ^= 1 << pin; 162 polarity ^= 1 << pin;
163 orion5x_write(GPIO_IN_POL, polarity); 163 writel(polarity, GPIO_IN_POL);
164 } 164 }
165 desc_handle_irq(irq, desc); 165 desc_handle_irq(irq, desc);
166 } 166 }
@@ -175,9 +175,9 @@ static void __init orion5x_init_gpio_irq(void)
175 /* 175 /*
176 * Mask and clear GPIO IRQ interrupts 176 * Mask and clear GPIO IRQ interrupts
177 */ 177 */
178 orion5x_write(GPIO_LEVEL_MASK, 0x0); 178 writel(0x0, GPIO_LEVEL_MASK);
179 orion5x_write(GPIO_EDGE_MASK, 0x0); 179 writel(0x0, GPIO_EDGE_MASK);
180 orion5x_write(GPIO_EDGE_CAUSE, 0x0); 180 writel(0x0, GPIO_EDGE_CAUSE);
181 181
182 /* 182 /*
183 * Register chained level handlers for GPIO IRQs by default. 183 * Register chained level handlers for GPIO IRQs by default.
diff --git a/arch/arm/mach-orion5x/kurobox_pro-setup.c b/arch/arm/mach-orion5x/kurobox_pro-setup.c
index f5074b877b7f..84feac4a1fe2 100644
--- a/arch/arm/mach-orion5x/kurobox_pro-setup.c
+++ b/arch/arm/mach-orion5x/kurobox_pro-setup.c
@@ -13,10 +13,12 @@
13#include <linux/platform_device.h> 13#include <linux/platform_device.h>
14#include <linux/pci.h> 14#include <linux/pci.h>
15#include <linux/irq.h> 15#include <linux/irq.h>
16#include <linux/delay.h>
16#include <linux/mtd/physmap.h> 17#include <linux/mtd/physmap.h>
17#include <linux/mtd/nand.h> 18#include <linux/mtd/nand.h>
18#include <linux/mv643xx_eth.h> 19#include <linux/mv643xx_eth.h>
19#include <linux/i2c.h> 20#include <linux/i2c.h>
21#include <linux/serial_reg.h>
20#include <linux/ata_platform.h> 22#include <linux/ata_platform.h>
21#include <asm/mach-types.h> 23#include <asm/mach-types.h>
22#include <asm/gpio.h> 24#include <asm/gpio.h>
@@ -25,6 +27,7 @@
25#include <asm/arch/orion5x.h> 27#include <asm/arch/orion5x.h>
26#include <asm/plat-orion/orion_nand.h> 28#include <asm/plat-orion/orion_nand.h>
27#include "common.h" 29#include "common.h"
30#include "mpp.h"
28 31
29/***************************************************************************** 32/*****************************************************************************
30 * KUROBOX-PRO Info 33 * KUROBOX-PRO Info
@@ -53,13 +56,11 @@ static struct mtd_partition kurobox_pro_nand_parts[] = {
53 .name = "uImage", 56 .name = "uImage",
54 .offset = 0, 57 .offset = 0,
55 .size = SZ_4M, 58 .size = SZ_4M,
56 }, 59 }, {
57 {
58 .name = "rootfs", 60 .name = "rootfs",
59 .offset = SZ_4M, 61 .offset = SZ_4M,
60 .size = SZ_64M, 62 .size = SZ_64M,
61 }, 63 }, {
62 {
63 .name = "extra", 64 .name = "extra",
64 .offset = SZ_4M + SZ_64M, 65 .offset = SZ_4M + SZ_64M,
65 .size = SZ_256M - (SZ_4M + SZ_64M), 66 .size = SZ_256M - (SZ_4M + SZ_64M),
@@ -132,8 +133,6 @@ static int __init kurobox_pro_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
132 /* 133 /*
133 * PCI isn't used on the Kuro 134 * PCI isn't used on the Kuro
134 */ 135 */
135 printk(KERN_ERR "kurobox_pro_pci_map_irq failed, unknown bus\n");
136
137 return -1; 136 return -1;
138} 137}
139 138
@@ -161,7 +160,6 @@ subsys_initcall(kurobox_pro_pci_init);
161 160
162static struct mv643xx_eth_platform_data kurobox_pro_eth_data = { 161static struct mv643xx_eth_platform_data kurobox_pro_eth_data = {
163 .phy_addr = 8, 162 .phy_addr = 8,
164 .force_phy_addr = 1,
165}; 163};
166 164
167/***************************************************************************** 165/*****************************************************************************
@@ -175,12 +173,169 @@ static struct i2c_board_info __initdata kurobox_pro_i2c_rtc = {
175 * SATA 173 * SATA
176 ****************************************************************************/ 174 ****************************************************************************/
177static struct mv_sata_platform_data kurobox_pro_sata_data = { 175static struct mv_sata_platform_data kurobox_pro_sata_data = {
178 .n_ports = 2, 176 .n_ports = 2,
179}; 177};
180 178
181/***************************************************************************** 179/*****************************************************************************
180 * Kurobox Pro specific power off method via UART1-attached microcontroller
181 ****************************************************************************/
182
183#define UART1_REG(x) (UART1_VIRT_BASE + ((UART_##x) << 2))
184
185static int kurobox_pro_miconread(unsigned char *buf, int count)
186{
187 int i;
188 int timeout;
189
190 for (i = 0; i < count; i++) {
191 timeout = 10;
192
193 while (!(readl(UART1_REG(LSR)) & UART_LSR_DR)) {
194 if (--timeout == 0)
195 break;
196 udelay(1000);
197 }
198
199 if (timeout == 0)
200 break;
201 buf[i] = readl(UART1_REG(RX));
202 }
203
204 /* return read bytes */
205 return i;
206}
207
208static int kurobox_pro_miconwrite(const unsigned char *buf, int count)
209{
210 int i = 0;
211
212 while (count--) {
213 while (!(readl(UART1_REG(LSR)) & UART_LSR_THRE))
214 barrier();
215 writel(buf[i++], UART1_REG(TX));
216 }
217
218 return 0;
219}
220
221static int kurobox_pro_miconsend(const unsigned char *data, int count)
222{
223 int i;
224 unsigned char checksum = 0;
225 unsigned char recv_buf[40];
226 unsigned char send_buf[40];
227 unsigned char correct_ack[3];
228 int retry = 2;
229
230 /* Generate checksum */
231 for (i = 0; i < count; i++)
232 checksum -= data[i];
233
234 do {
235 /* Send data */
236 kurobox_pro_miconwrite(data, count);
237
238 /* send checksum */
239 kurobox_pro_miconwrite(&checksum, 1);
240
241 if (kurobox_pro_miconread(recv_buf, sizeof(recv_buf)) <= 3) {
242 printk(KERN_ERR ">%s: receive failed.\n", __func__);
243
244 /* send preamble to clear the receive buffer */
245 memset(&send_buf, 0xff, sizeof(send_buf));
246 kurobox_pro_miconwrite(send_buf, sizeof(send_buf));
247
248 /* make dummy reads */
249 mdelay(100);
250 kurobox_pro_miconread(recv_buf, sizeof(recv_buf));
251 } else {
252 /* Generate expected ack */
253 correct_ack[0] = 0x01;
254 correct_ack[1] = data[1];
255 correct_ack[2] = 0x00;
256
257 /* checksum Check */
258 if ((recv_buf[0] + recv_buf[1] + recv_buf[2] +
259 recv_buf[3]) & 0xFF) {
260 printk(KERN_ERR ">%s: Checksum Error : "
261 "Received data[%02x, %02x, %02x, %02x]"
262 "\n", __func__, recv_buf[0],
263 recv_buf[1], recv_buf[2], recv_buf[3]);
264 } else {
265 /* Check Received Data */
266 if (correct_ack[0] == recv_buf[0] &&
267 correct_ack[1] == recv_buf[1] &&
268 correct_ack[2] == recv_buf[2]) {
269 /* Interval for next command */
270 mdelay(10);
271
272 /* Receive ACK */
273 return 0;
274 }
275 }
276 /* Received NAK or illegal Data */
277 printk(KERN_ERR ">%s: Error : NAK or Illegal Data "
278 "Received\n", __func__);
279 }
280 } while (retry--);
281
282 /* Interval for next command */
283 mdelay(10);
284
285 return -1;
286}
287
288static void kurobox_pro_power_off(void)
289{
290 const unsigned char watchdogkill[] = {0x01, 0x35, 0x00};
291 const unsigned char shutdownwait[] = {0x00, 0x0c};
292 const unsigned char poweroff[] = {0x00, 0x06};
293 /* 38400 baud divisor */
294 const unsigned divisor = ((ORION5X_TCLK + (8 * 38400)) / (16 * 38400));
295
296 pr_info("%s: triggering power-off...\n", __func__);
297
298 /* hijack uart1 and reset into sane state (38400,8n1,even parity) */
299 writel(0x83, UART1_REG(LCR));
300 writel(divisor & 0xff, UART1_REG(DLL));
301 writel((divisor >> 8) & 0xff, UART1_REG(DLM));
302 writel(0x1b, UART1_REG(LCR));
303 writel(0x00, UART1_REG(IER));
304 writel(0x07, UART1_REG(FCR));
305 writel(0x00, UART1_REG(MCR));
306
307 /* Send the commands to shutdown the Kurobox Pro */
308 kurobox_pro_miconsend(watchdogkill, sizeof(watchdogkill)) ;
309 kurobox_pro_miconsend(shutdownwait, sizeof(shutdownwait)) ;
310 kurobox_pro_miconsend(poweroff, sizeof(poweroff));
311}
312
313/*****************************************************************************
182 * General Setup 314 * General Setup
183 ****************************************************************************/ 315 ****************************************************************************/
316static struct orion5x_mpp_mode kurobox_pro_mpp_modes[] __initdata = {
317 { 0, MPP_UNUSED },
318 { 1, MPP_UNUSED },
319 { 2, MPP_GPIO }, /* GPIO Micon */
320 { 3, MPP_GPIO }, /* GPIO Rtc */
321 { 4, MPP_UNUSED },
322 { 5, MPP_UNUSED },
323 { 6, MPP_NAND }, /* NAND Flash REn */
324 { 7, MPP_NAND }, /* NAND Flash WEn */
325 { 8, MPP_UNUSED },
326 { 9, MPP_UNUSED },
327 { 10, MPP_UNUSED },
328 { 11, MPP_UNUSED },
329 { 12, MPP_SATA_LED }, /* SATA 0 presence */
330 { 13, MPP_SATA_LED }, /* SATA 1 presence */
331 { 14, MPP_SATA_LED }, /* SATA 0 active */
332 { 15, MPP_SATA_LED }, /* SATA 1 active */
333 { 16, MPP_UART }, /* UART1 RXD */
334 { 17, MPP_UART }, /* UART1 TXD */
335 { 18, MPP_UART }, /* UART1 CTSn */
336 { 19, MPP_UART }, /* UART1 RTSn */
337 { -1 },
338};
184 339
185static void __init kurobox_pro_init(void) 340static void __init kurobox_pro_init(void)
186{ 341{
@@ -189,46 +344,33 @@ static void __init kurobox_pro_init(void)
189 */ 344 */
190 orion5x_init(); 345 orion5x_init();
191 346
192 /* 347 orion5x_mpp_conf(kurobox_pro_mpp_modes);
193 * Setup the CPU address decode windows for our devices
194 */
195 orion5x_setup_dev_boot_win(KUROBOX_PRO_NOR_BOOT_BASE,
196 KUROBOX_PRO_NOR_BOOT_SIZE);
197 orion5x_setup_dev0_win(KUROBOX_PRO_NAND_BASE, KUROBOX_PRO_NAND_SIZE);
198 348
199 /* 349 /*
200 * Open a special address decode windows for the PCIe WA. 350 * Configure peripherals.
201 */ 351 */
202 orion5x_setup_pcie_wa_win(ORION5X_PCIE_WA_PHYS_BASE, 352 orion5x_ehci0_init();
203 ORION5X_PCIE_WA_SIZE); 353 orion5x_ehci1_init();
204 354 orion5x_eth_init(&kurobox_pro_eth_data);
205 /* 355 orion5x_i2c_init();
206 * Setup Multiplexing Pins -- 356 orion5x_sata_init(&kurobox_pro_sata_data);
207 * MPP[0-1] Not used 357 orion5x_uart0_init();
208 * MPP[2] GPIO Micon 358 orion5x_uart1_init();
209 * MPP[3] GPIO RTC
210 * MPP[4-5] Not used
211 * MPP[6] Nand Flash REn
212 * MPP[7] Nand Flash WEn
213 * MPP[8-11] Not used
214 * MPP[12] SATA 0 presence Indication
215 * MPP[13] SATA 1 presence Indication
216 * MPP[14] SATA 0 active Indication
217 * MPP[15] SATA 1 active indication
218 * MPP[16-19] Not used
219 */
220 orion5x_write(MPP_0_7_CTRL, 0x44220003);
221 orion5x_write(MPP_8_15_CTRL, 0x55550000);
222 orion5x_write(MPP_16_19_CTRL, 0x0);
223
224 orion5x_gpio_set_valid_pins(0x0000000c);
225 359
360 orion5x_setup_dev_boot_win(KUROBOX_PRO_NOR_BOOT_BASE,
361 KUROBOX_PRO_NOR_BOOT_SIZE);
226 platform_device_register(&kurobox_pro_nor_flash); 362 platform_device_register(&kurobox_pro_nor_flash);
227 if (machine_is_kurobox_pro()) 363
364 if (machine_is_kurobox_pro()) {
365 orion5x_setup_dev0_win(KUROBOX_PRO_NAND_BASE,
366 KUROBOX_PRO_NAND_SIZE);
228 platform_device_register(&kurobox_pro_nand_flash); 367 platform_device_register(&kurobox_pro_nand_flash);
368 }
369
229 i2c_register_board_info(0, &kurobox_pro_i2c_rtc, 1); 370 i2c_register_board_info(0, &kurobox_pro_i2c_rtc, 1);
230 orion5x_eth_init(&kurobox_pro_eth_data); 371
231 orion5x_sata_init(&kurobox_pro_sata_data); 372 /* register Kurobox Pro specific power-off method */
373 pm_power_off = kurobox_pro_power_off;
232} 374}
233 375
234#ifdef CONFIG_MACH_KUROBOX_PRO 376#ifdef CONFIG_MACH_KUROBOX_PRO
diff --git a/arch/arm/mach-orion5x/mpp.c b/arch/arm/mach-orion5x/mpp.c
new file mode 100644
index 000000000000..a48cadb01590
--- /dev/null
+++ b/arch/arm/mach-orion5x/mpp.c
@@ -0,0 +1,163 @@
1/*
2 * arch/arm/mach-orion5x/mpp.c
3 *
4 * MPP functions for Marvell Orion 5x SoCs
5 *
6 * This file is licensed under the terms of the GNU General Public
7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied.
9 */
10
11#include <linux/kernel.h>
12#include <linux/init.h>
13#include <linux/mbus.h>
14#include <asm/hardware.h>
15#include <asm/io.h>
16#include "common.h"
17#include "mpp.h"
18
19static int is_5181l(void)
20{
21 u32 dev;
22 u32 rev;
23
24 orion5x_pcie_id(&dev, &rev);
25
26 return !!(dev == MV88F5181_DEV_ID && rev >= MV88F5181L_REV_A0);
27}
28
29static int is_5182(void)
30{
31 u32 dev;
32 u32 rev;
33
34 orion5x_pcie_id(&dev, &rev);
35
36 return !!(dev == MV88F5182_DEV_ID);
37}
38
39static int is_5281(void)
40{
41 u32 dev;
42 u32 rev;
43
44 orion5x_pcie_id(&dev, &rev);
45
46 return !!(dev == MV88F5281_DEV_ID);
47}
48
49static int __init determine_type_encoding(int mpp, enum orion5x_mpp_type type)
50{
51 switch (type) {
52 case MPP_UNUSED:
53 case MPP_GPIO:
54 if (mpp == 0)
55 return 3;
56 if (mpp >= 1 && mpp <= 15)
57 return 0;
58 if (mpp >= 16 && mpp <= 19) {
59 if (is_5182())
60 return 5;
61 if (type == MPP_UNUSED)
62 return 0;
63 }
64 return -1;
65
66 case MPP_PCIE_RST_OUTn:
67 if (mpp == 0)
68 return 0;
69 return -1;
70
71 case MPP_PCI_ARB:
72 if (mpp >= 0 && mpp <= 7)
73 return 2;
74 return -1;
75
76 case MPP_PCI_PMEn:
77 if (mpp == 2)
78 return 3;
79 return -1;
80
81 case MPP_GIGE:
82 if (mpp >= 8 && mpp <= 19)
83 return 1;
84 return -1;
85
86 case MPP_NAND:
87 if (is_5182() || is_5281()) {
88 if (mpp >= 4 && mpp <= 7)
89 return 4;
90 if (mpp >= 12 && mpp <= 17)
91 return 4;
92 }
93 return -1;
94
95 case MPP_PCI_CLK:
96 if (is_5181l() && mpp >= 6 && mpp <= 7)
97 return 5;
98 return -1;
99
100 case MPP_SATA_LED:
101 if (is_5182()) {
102 if (mpp >= 4 && mpp <= 7)
103 return 5;
104 if (mpp >= 12 && mpp <= 15)
105 return 5;
106 }
107 return -1;
108
109 case MPP_UART:
110 if (mpp >= 16 && mpp <= 19)
111 return 0;
112 return -1;
113 }
114
115 printk(KERN_INFO "unknown MPP type %d\n", type);
116
117 return -1;
118}
119
120void __init orion5x_mpp_conf(struct orion5x_mpp_mode *mode)
121{
122 u32 mpp_0_7_ctrl = readl(MPP_0_7_CTRL);
123 u32 mpp_8_15_ctrl = readl(MPP_8_15_CTRL);
124 u32 mpp_16_19_ctrl = readl(MPP_16_19_CTRL);
125
126 while (mode->mpp >= 0) {
127 u32 *reg;
128 int num_type;
129 int shift;
130
131 if (mode->mpp >= 0 && mode->mpp <= 7)
132 reg = &mpp_0_7_ctrl;
133 else if (mode->mpp >= 8 && mode->mpp <= 15)
134 reg = &mpp_8_15_ctrl;
135 else if (mode->mpp >= 16 && mode->mpp <= 19)
136 reg = &mpp_16_19_ctrl;
137 else {
138 printk(KERN_ERR "orion5x_mpp_conf: invalid MPP "
139 "(%d)\n", mode->mpp);
140 continue;
141 }
142
143 num_type = determine_type_encoding(mode->mpp, mode->type);
144 if (num_type < 0) {
145 printk(KERN_ERR "orion5x_mpp_conf: invalid MPP "
146 "combination (%d, %d)\n", mode->mpp,
147 mode->type);
148 continue;
149 }
150
151 shift = (mode->mpp & 7) << 2;
152 *reg &= ~(0xf << shift);
153 *reg |= (num_type & 0xf) << shift;
154
155 orion5x_gpio_set_valid(mode->mpp, !!(mode->type == MPP_GPIO));
156
157 mode++;
158 }
159
160 writel(mpp_0_7_ctrl, MPP_0_7_CTRL);
161 writel(mpp_8_15_ctrl, MPP_8_15_CTRL);
162 writel(mpp_16_19_ctrl, MPP_16_19_CTRL);
163}
diff --git a/arch/arm/mach-orion5x/mpp.h b/arch/arm/mach-orion5x/mpp.h
new file mode 100644
index 000000000000..290e610dc012
--- /dev/null
+++ b/arch/arm/mach-orion5x/mpp.h
@@ -0,0 +1,74 @@
1#ifndef __ARCH_ORION5X_MPP_H
2#define __ARCH_ORION5X_MPP_H
3
4enum orion5x_mpp_type {
5 /*
6 * This MPP is unused.
7 */
8 MPP_UNUSED,
9
10 /*
11 * This MPP pin is used as a generic GPIO pin. Valid for
12 * MPPs 0-15 and device bus data pins 16-31. On 5182, also
13 * valid for MPPs 16-19.
14 */
15 MPP_GPIO,
16
17 /*
18 * This MPP is used as PCIe_RST_OUTn pin. Valid for
19 * MPP 0 only.
20 */
21 MPP_PCIE_RST_OUTn,
22
23 /*
24 * This MPP is used as PCI arbiter pin (REQn/GNTn).
25 * Valid for MPPs 0-7 only.
26 */
27 MPP_PCI_ARB,
28
29 /*
30 * This MPP is used as PCI_PMEn pin. Valid for MPP 2 only.
31 */
32 MPP_PCI_PMEn,
33
34 /*
35 * This MPP is used as GigE half-duplex (COL, CRS) or GMII
36 * (RXERR, CRS, TXERR, TXD[7:4], RXD[7:4]) pin. Valid for
37 * MPPs 8-19 only.
38 */
39 MPP_GIGE,
40
41 /*
42 * This MPP is used as NAND REn/WEn pin. Valid for MPPs
43 * 4-7 and 12-17 only, and only on the 5181l/5182/5281.
44 */
45 MPP_NAND,
46
47 /*
48 * This MPP is used as a PCI clock output pin. Valid for
49 * MPPs 6-7 only, and only on the 5181l.
50 */
51 MPP_PCI_CLK,
52
53 /*
54 * This MPP is used as a SATA presence/activity LED.
55 * Valid for MPPs 4-7 and 12-15 only, and only on the 5182.
56 */
57 MPP_SATA_LED,
58
59 /*
60 * This MPP is used as UART1 RXD/TXD/CTSn/RTSn pin.
61 * Valid for MPPs 16-19 only.
62 */
63 MPP_UART,
64};
65
66struct orion5x_mpp_mode {
67 int mpp;
68 enum orion5x_mpp_type type;
69};
70
71void orion5x_mpp_conf(struct orion5x_mpp_mode *mode);
72
73
74#endif
diff --git a/arch/arm/mach-orion5x/mss2-setup.c b/arch/arm/mach-orion5x/mss2-setup.c
new file mode 100644
index 000000000000..7ce9e407d9d1
--- /dev/null
+++ b/arch/arm/mach-orion5x/mss2-setup.c
@@ -0,0 +1,270 @@
1/*
2 * Maxtor Shared Storage II Board Setup
3 *
4 * Maintainer: Sylver Bruneau <sylver.bruneau@googlemail.com>
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12#include <linux/kernel.h>
13#include <linux/init.h>
14#include <linux/platform_device.h>
15#include <linux/pci.h>
16#include <linux/irq.h>
17#include <linux/mtd/physmap.h>
18#include <linux/mv643xx_eth.h>
19#include <linux/leds.h>
20#include <linux/gpio_keys.h>
21#include <linux/input.h>
22#include <linux/i2c.h>
23#include <linux/ata_platform.h>
24#include <linux/gpio.h>
25#include <asm/mach-types.h>
26#include <asm/mach/arch.h>
27#include <asm/mach/pci.h>
28#include <asm/arch/orion5x.h>
29#include "common.h"
30#include "mpp.h"
31
32#define MSS2_NOR_BOOT_BASE 0xff800000
33#define MSS2_NOR_BOOT_SIZE SZ_256K
34
35/*****************************************************************************
36 * Maxtor Shared Storage II Info
37 ****************************************************************************/
38
39/*
40 * Maxtor Shared Storage II hardware :
41 * - Marvell 88F5182-A2 C500
42 * - Marvell 88E1111 Gigabit Ethernet PHY
43 * - RTC M41T81 (@0x68) on I2C bus
44 * - 256KB NOR flash
45 * - 64MB of RAM
46 */
47
48/*****************************************************************************
49 * 256KB NOR Flash on BOOT Device
50 ****************************************************************************/
51
52static struct physmap_flash_data mss2_nor_flash_data = {
53 .width = 1,
54};
55
56static struct resource mss2_nor_flash_resource = {
57 .flags = IORESOURCE_MEM,
58 .start = MSS2_NOR_BOOT_BASE,
59 .end = MSS2_NOR_BOOT_BASE + MSS2_NOR_BOOT_SIZE - 1,
60};
61
62static struct platform_device mss2_nor_flash = {
63 .name = "physmap-flash",
64 .id = 0,
65 .dev = {
66 .platform_data = &mss2_nor_flash_data,
67 },
68 .resource = &mss2_nor_flash_resource,
69 .num_resources = 1,
70};
71
72/****************************************************************************
73 * PCI setup
74 ****************************************************************************/
75static int __init mss2_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
76{
77 int irq;
78
79 /*
80 * Check for devices with hard-wired IRQs.
81 */
82 irq = orion5x_pci_map_irq(dev, slot, pin);
83 if (irq != -1)
84 return irq;
85
86 return -1;
87}
88
89static struct hw_pci mss2_pci __initdata = {
90 .nr_controllers = 2,
91 .swizzle = pci_std_swizzle,
92 .setup = orion5x_pci_sys_setup,
93 .scan = orion5x_pci_sys_scan_bus,
94 .map_irq = mss2_pci_map_irq,
95};
96
97static int __init mss2_pci_init(void)
98{
99 if (machine_is_mss2())
100 pci_common_init(&mss2_pci);
101
102 return 0;
103}
104subsys_initcall(mss2_pci_init);
105
106
107/*****************************************************************************
108 * Ethernet
109 ****************************************************************************/
110
111static struct mv643xx_eth_platform_data mss2_eth_data = {
112 .phy_addr = 8,
113};
114
115/*****************************************************************************
116 * SATA
117 ****************************************************************************/
118
119static struct mv_sata_platform_data mss2_sata_data = {
120 .n_ports = 2,
121};
122
123/*****************************************************************************
124 * GPIO buttons
125 ****************************************************************************/
126
127#define MSS2_GPIO_KEY_RESET 12
128#define MSS2_GPIO_KEY_POWER 11
129
130static struct gpio_keys_button mss2_buttons[] = {
131 {
132 .code = KEY_POWER,
133 .gpio = MSS2_GPIO_KEY_POWER,
134 .desc = "Power",
135 .active_low = 1,
136 }, {
137 .code = KEY_RESTART,
138 .gpio = MSS2_GPIO_KEY_RESET,
139 .desc = "Reset",
140 .active_low = 1,
141 },
142};
143
144static struct gpio_keys_platform_data mss2_button_data = {
145 .buttons = mss2_buttons,
146 .nbuttons = ARRAY_SIZE(mss2_buttons),
147};
148
149static struct platform_device mss2_button_device = {
150 .name = "gpio-keys",
151 .id = -1,
152 .dev = {
153 .platform_data = &mss2_button_data,
154 },
155};
156
157/*****************************************************************************
158 * RTC m41t81 on I2C bus
159 ****************************************************************************/
160
161#define MSS2_GPIO_RTC_IRQ 3
162
163static struct i2c_board_info __initdata mss2_i2c_rtc = {
164 I2C_BOARD_INFO("m41t81", 0x68),
165};
166
167/*****************************************************************************
168 * MSS2 power off method
169 ****************************************************************************/
170/*
171 * On the Maxtor Shared Storage II, the shutdown process is the following :
172 * - Userland modifies U-boot env to tell U-boot to go idle at next boot
173 * - The board reboots
174 * - U-boot starts and go into an idle mode until the user press "power"
175 */
176static void mss2_power_off(void)
177{
178 u32 reg;
179
180 /*
181 * Enable and issue soft reset
182 */
183 reg = readl(CPU_RESET_MASK);
184 reg |= 1 << 2;
185 writel(reg, CPU_RESET_MASK);
186
187 reg = readl(CPU_SOFT_RESET);
188 reg |= 1;
189 writel(reg, CPU_SOFT_RESET);
190}
191
192/****************************************************************************
193 * General Setup
194 ****************************************************************************/
195static struct orion5x_mpp_mode mss2_mpp_modes[] __initdata = {
196 { 0, MPP_GPIO }, /* Power LED */
197 { 1, MPP_GPIO }, /* Error LED */
198 { 2, MPP_UNUSED },
199 { 3, MPP_GPIO }, /* RTC interrupt */
200 { 4, MPP_GPIO }, /* HDD ind. (Single/Dual)*/
201 { 5, MPP_GPIO }, /* HD0 5V control */
202 { 6, MPP_GPIO }, /* HD0 12V control */
203 { 7, MPP_GPIO }, /* HD1 5V control */
204 { 8, MPP_GPIO }, /* HD1 12V control */
205 { 9, MPP_UNUSED },
206 { 10, MPP_GPIO }, /* Fan control */
207 { 11, MPP_GPIO }, /* Power button */
208 { 12, MPP_GPIO }, /* Reset button */
209 { 13, MPP_UNUSED },
210 { 14, MPP_SATA_LED }, /* SATA 0 active */
211 { 15, MPP_SATA_LED }, /* SATA 1 active */
212 { 16, MPP_UNUSED },
213 { 17, MPP_UNUSED },
214 { 18, MPP_UNUSED },
215 { 19, MPP_UNUSED },
216 { -1 },
217};
218
219static void __init mss2_init(void)
220{
221 /* Setup basic Orion functions. Need to be called early. */
222 orion5x_init();
223
224 orion5x_mpp_conf(mss2_mpp_modes);
225
226 /*
227 * MPP[20] Unused
228 * MPP[21] PCI clock
229 * MPP[22] USB 0 over current
230 * MPP[23] USB 1 over current
231 */
232
233 /*
234 * Configure peripherals.
235 */
236 orion5x_ehci0_init();
237 orion5x_ehci1_init();
238 orion5x_eth_init(&mss2_eth_data);
239 orion5x_i2c_init();
240 orion5x_sata_init(&mss2_sata_data);
241 orion5x_uart0_init();
242
243 orion5x_setup_dev_boot_win(MSS2_NOR_BOOT_BASE, MSS2_NOR_BOOT_SIZE);
244 platform_device_register(&mss2_nor_flash);
245
246 platform_device_register(&mss2_button_device);
247
248 if (gpio_request(MSS2_GPIO_RTC_IRQ, "rtc") == 0) {
249 if (gpio_direction_input(MSS2_GPIO_RTC_IRQ) == 0)
250 mss2_i2c_rtc.irq = gpio_to_irq(MSS2_GPIO_RTC_IRQ);
251 else
252 gpio_free(MSS2_GPIO_RTC_IRQ);
253 }
254 i2c_register_board_info(0, &mss2_i2c_rtc, 1);
255
256 /* register mss2 specific power-off method */
257 pm_power_off = mss2_power_off;
258}
259
260MACHINE_START(MSS2, "Maxtor Shared Storage II")
261 /* Maintainer: Sylver Bruneau <sylver.bruneau@googlemail.com> */
262 .phys_io = ORION5X_REGS_PHYS_BASE,
263 .io_pg_offst = ((ORION5X_REGS_VIRT_BASE) >> 18) & 0xFFFC,
264 .boot_params = 0x00000100,
265 .init_machine = mss2_init,
266 .map_io = orion5x_map_io,
267 .init_irq = orion5x_init_irq,
268 .timer = &orion5x_timer,
269 .fixup = tag_fixup_mem32
270MACHINE_END
diff --git a/arch/arm/mach-orion5x/mv2120-setup.c b/arch/arm/mach-orion5x/mv2120-setup.c
new file mode 100644
index 000000000000..55f3b0fdef8b
--- /dev/null
+++ b/arch/arm/mach-orion5x/mv2120-setup.c
@@ -0,0 +1,239 @@
1/*
2 * Copyright (C) 2007 Herbert Valerio Riedel <hvr@gnu.org>
3 * Copyright (C) 2008 Martin Michlmayr <tbm@cyrius.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU Lesser General Public License as
7 * published by the Free Software Foundation; either version 2 of the
8 * License, or (at your option) any later version.
9 */
10
11#include <linux/kernel.h>
12#include <linux/init.h>
13#include <linux/platform_device.h>
14#include <linux/irq.h>
15#include <linux/mtd/physmap.h>
16#include <linux/mv643xx_eth.h>
17#include <linux/leds.h>
18#include <linux/gpio_keys.h>
19#include <linux/input.h>
20#include <linux/i2c.h>
21#include <linux/ata_platform.h>
22#include <asm/mach-types.h>
23#include <asm/gpio.h>
24#include <asm/mach/arch.h>
25#include <asm/arch/orion5x.h>
26#include "common.h"
27#include "mpp.h"
28
29#define MV2120_NOR_BOOT_BASE 0xf4000000
30#define MV2120_NOR_BOOT_SIZE SZ_512K
31
32#define MV2120_GPIO_RTC_IRQ 3
33#define MV2120_GPIO_KEY_RESET 17
34#define MV2120_GPIO_KEY_POWER 18
35#define MV2120_GPIO_POWER_OFF 19
36
37
38/*****************************************************************************
39 * Ethernet
40 ****************************************************************************/
41static struct mv643xx_eth_platform_data mv2120_eth_data = {
42 .phy_addr = 8,
43};
44
45static struct mv_sata_platform_data mv2120_sata_data = {
46 .n_ports = 2,
47};
48
49static struct mtd_partition mv2120_partitions[] = {
50 {
51 .name = "firmware",
52 .size = 0x00080000,
53 .offset = 0,
54 },
55};
56
57static struct physmap_flash_data mv2120_nor_flash_data = {
58 .width = 1,
59 .parts = mv2120_partitions,
60 .nr_parts = ARRAY_SIZE(mv2120_partitions)
61};
62
63static struct resource mv2120_nor_flash_resource = {
64 .flags = IORESOURCE_MEM,
65 .start = MV2120_NOR_BOOT_BASE,
66 .end = MV2120_NOR_BOOT_BASE + MV2120_NOR_BOOT_SIZE - 1,
67};
68
69static struct platform_device mv2120_nor_flash = {
70 .name = "physmap-flash",
71 .id = 0,
72 .dev = {
73 .platform_data = &mv2120_nor_flash_data,
74 },
75 .resource = &mv2120_nor_flash_resource,
76 .num_resources = 1,
77};
78
79static struct gpio_keys_button mv2120_buttons[] = {
80 {
81 .code = KEY_RESTART,
82 .gpio = MV2120_GPIO_KEY_RESET,
83 .desc = "reset",
84 .active_low = 1,
85 }, {
86 .code = KEY_POWER,
87 .gpio = MV2120_GPIO_KEY_POWER,
88 .desc = "power",
89 .active_low = 1,
90 },
91};
92
93static struct gpio_keys_platform_data mv2120_button_data = {
94 .buttons = mv2120_buttons,
95 .nbuttons = ARRAY_SIZE(mv2120_buttons),
96};
97
98static struct platform_device mv2120_button_device = {
99 .name = "gpio-keys",
100 .id = -1,
101 .num_resources = 0,
102 .dev = {
103 .platform_data = &mv2120_button_data,
104 },
105};
106
107
108/****************************************************************************
109 * General Setup
110 ****************************************************************************/
111static struct orion5x_mpp_mode mv2120_mpp_modes[] __initdata = {
112 { 0, MPP_GPIO }, /* Sys status LED */
113 { 1, MPP_GPIO }, /* Sys error LED */
114 { 2, MPP_GPIO }, /* OverTemp interrupt */
115 { 3, MPP_GPIO }, /* RTC interrupt */
116 { 4, MPP_GPIO }, /* V_LED 5V */
117 { 5, MPP_GPIO }, /* V_LED 3.3V */
118 { 6, MPP_UNUSED },
119 { 7, MPP_UNUSED },
120 { 8, MPP_GPIO }, /* SATA 0 fail LED */
121 { 9, MPP_GPIO }, /* SATA 1 fail LED */
122 { 10, MPP_UNUSED },
123 { 11, MPP_UNUSED },
124 { 12, MPP_SATA_LED }, /* SATA 0 presence */
125 { 13, MPP_SATA_LED }, /* SATA 1 presence */
126 { 14, MPP_SATA_LED }, /* SATA 0 active */
127 { 15, MPP_SATA_LED }, /* SATA 1 active */
128 { 16, MPP_UNUSED },
129 { 17, MPP_GPIO }, /* Reset button */
130 { 18, MPP_GPIO }, /* Power button */
131 { 19, MPP_GPIO }, /* Power off */
132 { -1 },
133};
134
135static struct i2c_board_info __initdata mv2120_i2c_rtc = {
136 I2C_BOARD_INFO("pcf8563", 0x51),
137 .irq = 0,
138};
139
140static struct gpio_led mv2120_led_pins[] = {
141 {
142 .name = "mv2120:blue:health",
143 .gpio = 0,
144 },
145 {
146 .name = "mv2120:red:health",
147 .gpio = 1,
148 },
149 {
150 .name = "mv2120:led:bright",
151 .gpio = 4,
152 .default_trigger = "default-on",
153 },
154 {
155 .name = "mv2120:led:dimmed",
156 .gpio = 5,
157 },
158 {
159 .name = "mv2120:red:sata0",
160 .gpio = 8,
161 .active_low = 1,
162 },
163 {
164 .name = "mv2120:red:sata1",
165 .gpio = 9,
166 .active_low = 1,
167 },
168
169};
170
171static struct gpio_led_platform_data mv2120_led_data = {
172 .leds = mv2120_led_pins,
173 .num_leds = ARRAY_SIZE(mv2120_led_pins),
174};
175
176static struct platform_device mv2120_leds = {
177 .name = "leds-gpio",
178 .id = -1,
179 .dev = {
180 .platform_data = &mv2120_led_data,
181 }
182};
183
184static void mv2120_power_off(void)
185{
186 pr_info("%s: triggering power-off...\n", __func__);
187 gpio_set_value(MV2120_GPIO_POWER_OFF, 0);
188}
189
190static void __init mv2120_init(void)
191{
192 /* Setup basic Orion functions. Need to be called early. */
193 orion5x_init();
194
195 orion5x_mpp_conf(mv2120_mpp_modes);
196
197 /*
198 * Configure peripherals.
199 */
200 orion5x_ehci0_init();
201 orion5x_ehci1_init();
202 orion5x_eth_init(&mv2120_eth_data);
203 orion5x_i2c_init();
204 orion5x_sata_init(&mv2120_sata_data);
205 orion5x_uart0_init();
206
207 orion5x_setup_dev_boot_win(MV2120_NOR_BOOT_BASE, MV2120_NOR_BOOT_SIZE);
208 platform_device_register(&mv2120_nor_flash);
209
210 platform_device_register(&mv2120_button_device);
211
212 if (gpio_request(MV2120_GPIO_RTC_IRQ, "rtc") == 0) {
213 if (gpio_direction_input(MV2120_GPIO_RTC_IRQ) == 0)
214 mv2120_i2c_rtc.irq = gpio_to_irq(MV2120_GPIO_RTC_IRQ);
215 else
216 gpio_free(MV2120_GPIO_RTC_IRQ);
217 }
218 i2c_register_board_info(0, &mv2120_i2c_rtc, 1);
219 platform_device_register(&mv2120_leds);
220
221 /* register mv2120 specific power-off method */
222 if (gpio_request(MV2120_GPIO_POWER_OFF, "POWEROFF") != 0 ||
223 gpio_direction_output(MV2120_GPIO_POWER_OFF, 1) != 0)
224 pr_err("mv2120: failed to setup power-off GPIO\n");
225 pm_power_off = mv2120_power_off;
226}
227
228/* Warning: HP uses a wrong mach-type (=526) in their bootloader */
229MACHINE_START(MV2120, "HP Media Vault mv2120")
230 /* Maintainer: Martin Michlmayr <tbm@cyrius.com> */
231 .phys_io = ORION5X_REGS_PHYS_BASE,
232 .io_pg_offst = ((ORION5X_REGS_VIRT_BASE) >> 18) & 0xFFFC,
233 .boot_params = 0x00000100,
234 .init_machine = mv2120_init,
235 .map_io = orion5x_map_io,
236 .init_irq = orion5x_init_irq,
237 .timer = &orion5x_timer,
238 .fixup = tag_fixup_mem32
239MACHINE_END
diff --git a/arch/arm/mach-orion5x/pci.c b/arch/arm/mach-orion5x/pci.c
index 9d5d39fa19c3..256a4f680935 100644
--- a/arch/arm/mach-orion5x/pci.c
+++ b/arch/arm/mach-orion5x/pci.c
@@ -152,6 +152,8 @@ static int __init pcie_setup(struct pci_sys_data *sys)
152 if (dev == MV88F5181_DEV_ID || dev == MV88F5182_DEV_ID) { 152 if (dev == MV88F5181_DEV_ID || dev == MV88F5182_DEV_ID) {
153 printk(KERN_NOTICE "Applying Orion-1/Orion-NAS PCIe config " 153 printk(KERN_NOTICE "Applying Orion-1/Orion-NAS PCIe config "
154 "read transaction workaround\n"); 154 "read transaction workaround\n");
155 orion5x_setup_pcie_wa_win(ORION5X_PCIE_WA_PHYS_BASE,
156 ORION5X_PCIE_WA_SIZE);
155 pcie_ops.read = pcie_rd_conf_wa; 157 pcie_ops.read = pcie_rd_conf_wa;
156 } 158 }
157 159
@@ -240,13 +242,13 @@ static int __init pcie_setup(struct pci_sys_data *sys)
240 * PCI Address Decode Windows registers 242 * PCI Address Decode Windows registers
241 */ 243 */
242#define PCI_BAR_SIZE_DDR_CS(n) (((n) == 0) ? ORION5X_PCI_REG(0xc08) : \ 244#define PCI_BAR_SIZE_DDR_CS(n) (((n) == 0) ? ORION5X_PCI_REG(0xc08) : \
243 ((n) == 1) ? ORION5X_PCI_REG(0xd08) : \ 245 ((n) == 1) ? ORION5X_PCI_REG(0xd08) : \
244 ((n) == 2) ? ORION5X_PCI_REG(0xc0c) : \ 246 ((n) == 2) ? ORION5X_PCI_REG(0xc0c) : \
245 ((n) == 3) ? ORION5X_PCI_REG(0xd0c) : 0) 247 ((n) == 3) ? ORION5X_PCI_REG(0xd0c) : 0)
246#define PCI_BAR_REMAP_DDR_CS(n) (((n) ==0) ? ORION5X_PCI_REG(0xc48) : \ 248#define PCI_BAR_REMAP_DDR_CS(n) (((n) == 0) ? ORION5X_PCI_REG(0xc48) : \
247 ((n) == 1) ? ORION5X_PCI_REG(0xd48) : \ 249 ((n) == 1) ? ORION5X_PCI_REG(0xd48) : \
248 ((n) == 2) ? ORION5X_PCI_REG(0xc4c) : \ 250 ((n) == 2) ? ORION5X_PCI_REG(0xc4c) : \
249 ((n) == 3) ? ORION5X_PCI_REG(0xd4c) : 0) 251 ((n) == 3) ? ORION5X_PCI_REG(0xd4c) : 0)
250#define PCI_BAR_ENABLE ORION5X_PCI_REG(0xc3c) 252#define PCI_BAR_ENABLE ORION5X_PCI_REG(0xc3c)
251#define PCI_ADDR_DECODE_CTRL ORION5X_PCI_REG(0xd3c) 253#define PCI_ADDR_DECODE_CTRL ORION5X_PCI_REG(0xd3c)
252 254
@@ -264,9 +266,11 @@ static int __init pcie_setup(struct pci_sys_data *sys)
264 */ 266 */
265static DEFINE_SPINLOCK(orion5x_pci_lock); 267static DEFINE_SPINLOCK(orion5x_pci_lock);
266 268
269static int orion5x_pci_cardbus_mode;
270
267static int orion5x_pci_local_bus_nr(void) 271static int orion5x_pci_local_bus_nr(void)
268{ 272{
269 u32 conf = orion5x_read(PCI_P2P_CONF); 273 u32 conf = readl(PCI_P2P_CONF);
270 return((conf & PCI_P2P_BUS_MASK) >> PCI_P2P_BUS_OFFS); 274 return((conf & PCI_P2P_BUS_MASK) >> PCI_P2P_BUS_OFFS);
271} 275}
272 276
@@ -276,11 +280,11 @@ static int orion5x_pci_hw_rd_conf(int bus, int dev, u32 func,
276 unsigned long flags; 280 unsigned long flags;
277 spin_lock_irqsave(&orion5x_pci_lock, flags); 281 spin_lock_irqsave(&orion5x_pci_lock, flags);
278 282
279 orion5x_write(PCI_CONF_ADDR, PCI_CONF_BUS(bus) | 283 writel(PCI_CONF_BUS(bus) |
280 PCI_CONF_DEV(dev) | PCI_CONF_REG(where) | 284 PCI_CONF_DEV(dev) | PCI_CONF_REG(where) |
281 PCI_CONF_FUNC(func) | PCI_CONF_ADDR_EN); 285 PCI_CONF_FUNC(func) | PCI_CONF_ADDR_EN, PCI_CONF_ADDR);
282 286
283 *val = orion5x_read(PCI_CONF_DATA); 287 *val = readl(PCI_CONF_DATA);
284 288
285 if (size == 1) 289 if (size == 1)
286 *val = (*val >> (8*(where & 0x3))) & 0xff; 290 *val = (*val >> (8*(where & 0x3))) & 0xff;
@@ -300,9 +304,9 @@ static int orion5x_pci_hw_wr_conf(int bus, int dev, u32 func,
300 304
301 spin_lock_irqsave(&orion5x_pci_lock, flags); 305 spin_lock_irqsave(&orion5x_pci_lock, flags);
302 306
303 orion5x_write(PCI_CONF_ADDR, PCI_CONF_BUS(bus) | 307 writel(PCI_CONF_BUS(bus) |
304 PCI_CONF_DEV(dev) | PCI_CONF_REG(where) | 308 PCI_CONF_DEV(dev) | PCI_CONF_REG(where) |
305 PCI_CONF_FUNC(func) | PCI_CONF_ADDR_EN); 309 PCI_CONF_FUNC(func) | PCI_CONF_ADDR_EN, PCI_CONF_ADDR);
306 310
307 if (size == 4) { 311 if (size == 4) {
308 __raw_writel(val, PCI_CONF_DATA); 312 __raw_writel(val, PCI_CONF_DATA);
@@ -319,14 +323,30 @@ static int orion5x_pci_hw_wr_conf(int bus, int dev, u32 func,
319 return ret; 323 return ret;
320} 324}
321 325
326static int orion5x_pci_valid_config(int bus, u32 devfn)
327{
328 if (bus == orion5x_pci_local_bus_nr()) {
329 /*
330 * Don't go out for local device
331 */
332 if (PCI_SLOT(devfn) == 0 && PCI_FUNC(devfn) != 0)
333 return 0;
334
335 /*
336 * When the PCI signals are directly connected to a
337 * Cardbus slot, ignore all but device IDs 0 and 1.
338 */
339 if (orion5x_pci_cardbus_mode && PCI_SLOT(devfn) > 1)
340 return 0;
341 }
342
343 return 1;
344}
345
322static int orion5x_pci_rd_conf(struct pci_bus *bus, u32 devfn, 346static int orion5x_pci_rd_conf(struct pci_bus *bus, u32 devfn,
323 int where, int size, u32 *val) 347 int where, int size, u32 *val)
324{ 348{
325 /* 349 if (!orion5x_pci_valid_config(bus->number, devfn)) {
326 * Don't go out for local device
327 */
328 if (bus->number == orion5x_pci_local_bus_nr() &&
329 PCI_SLOT(devfn) == 0 && PCI_FUNC(devfn) != 0) {
330 *val = 0xffffffff; 350 *val = 0xffffffff;
331 return PCIBIOS_DEVICE_NOT_FOUND; 351 return PCIBIOS_DEVICE_NOT_FOUND;
332 } 352 }
@@ -338,8 +358,7 @@ static int orion5x_pci_rd_conf(struct pci_bus *bus, u32 devfn,
338static int orion5x_pci_wr_conf(struct pci_bus *bus, u32 devfn, 358static int orion5x_pci_wr_conf(struct pci_bus *bus, u32 devfn,
339 int where, int size, u32 val) 359 int where, int size, u32 val)
340{ 360{
341 if (bus->number == orion5x_pci_local_bus_nr() && 361 if (!orion5x_pci_valid_config(bus->number, devfn))
342 PCI_SLOT(devfn) == 0 && PCI_FUNC(devfn) != 0)
343 return PCIBIOS_DEVICE_NOT_FOUND; 362 return PCIBIOS_DEVICE_NOT_FOUND;
344 363
345 return orion5x_pci_hw_wr_conf(bus->number, PCI_SLOT(devfn), 364 return orion5x_pci_hw_wr_conf(bus->number, PCI_SLOT(devfn),
@@ -353,9 +372,9 @@ static struct pci_ops pci_ops = {
353 372
354static void __init orion5x_pci_set_bus_nr(int nr) 373static void __init orion5x_pci_set_bus_nr(int nr)
355{ 374{
356 u32 p2p = orion5x_read(PCI_P2P_CONF); 375 u32 p2p = readl(PCI_P2P_CONF);
357 376
358 if (orion5x_read(PCI_MODE) & PCI_MODE_PCIX) { 377 if (readl(PCI_MODE) & PCI_MODE_PCIX) {
359 /* 378 /*
360 * PCI-X mode 379 * PCI-X mode
361 */ 380 */
@@ -372,7 +391,7 @@ static void __init orion5x_pci_set_bus_nr(int nr)
372 */ 391 */
373 p2p &= ~PCI_P2P_BUS_MASK; 392 p2p &= ~PCI_P2P_BUS_MASK;
374 p2p |= (nr << PCI_P2P_BUS_OFFS); 393 p2p |= (nr << PCI_P2P_BUS_OFFS);
375 orion5x_write(PCI_P2P_CONF, p2p); 394 writel(p2p, PCI_P2P_CONF);
376 } 395 }
377} 396}
378 397
@@ -399,7 +418,7 @@ static void __init orion5x_setup_pci_wins(struct mbus_dram_target_info *dram)
399 * First, disable windows. 418 * First, disable windows.
400 */ 419 */
401 win_enable = 0xffffffff; 420 win_enable = 0xffffffff;
402 orion5x_write(PCI_BAR_ENABLE, win_enable); 421 writel(win_enable, PCI_BAR_ENABLE);
403 422
404 /* 423 /*
405 * Setup windows for DDR banks. 424 * Setup windows for DDR banks.
@@ -425,10 +444,10 @@ static void __init orion5x_setup_pci_wins(struct mbus_dram_target_info *dram)
425 */ 444 */
426 reg = PCI_CONF_REG_BAR_HI_CS(cs->cs_index); 445 reg = PCI_CONF_REG_BAR_HI_CS(cs->cs_index);
427 orion5x_pci_hw_wr_conf(bus, 0, func, reg, 4, 0); 446 orion5x_pci_hw_wr_conf(bus, 0, func, reg, 4, 0);
428 orion5x_write(PCI_BAR_SIZE_DDR_CS(cs->cs_index), 447 writel((cs->size - 1) & 0xfffff000,
429 (cs->size - 1) & 0xfffff000); 448 PCI_BAR_SIZE_DDR_CS(cs->cs_index));
430 orion5x_write(PCI_BAR_REMAP_DDR_CS(cs->cs_index), 449 writel(cs->base & 0xfffff000,
431 cs->base & 0xfffff000); 450 PCI_BAR_REMAP_DDR_CS(cs->cs_index));
432 451
433 /* 452 /*
434 * Enable decode window for this chip select. 453 * Enable decode window for this chip select.
@@ -439,7 +458,7 @@ static void __init orion5x_setup_pci_wins(struct mbus_dram_target_info *dram)
439 /* 458 /*
440 * Re-enable decode windows. 459 * Re-enable decode windows.
441 */ 460 */
442 orion5x_write(PCI_BAR_ENABLE, win_enable); 461 writel(win_enable, PCI_BAR_ENABLE);
443 462
444 /* 463 /*
445 * Disable automatic update of address remaping when writing to BARs. 464 * Disable automatic update of address remaping when writing to BARs.
@@ -522,6 +541,11 @@ static void __devinit rc_pci_fixup(struct pci_dev *dev)
522} 541}
523DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_MARVELL, PCI_ANY_ID, rc_pci_fixup); 542DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_MARVELL, PCI_ANY_ID, rc_pci_fixup);
524 543
544void __init orion5x_pci_set_cardbus_mode(void)
545{
546 orion5x_pci_cardbus_mode = 1;
547}
548
525int __init orion5x_pci_sys_setup(int nr, struct pci_sys_data *sys) 549int __init orion5x_pci_sys_setup(int nr, struct pci_sys_data *sys)
526{ 550{
527 int ret = 0; 551 int ret = 0;
diff --git a/arch/arm/mach-orion5x/rd88f5181l-fxo-setup.c b/arch/arm/mach-orion5x/rd88f5181l-fxo-setup.c
new file mode 100644
index 000000000000..d50e3650a09e
--- /dev/null
+++ b/arch/arm/mach-orion5x/rd88f5181l-fxo-setup.c
@@ -0,0 +1,161 @@
1/*
2 * arch/arm/mach-orion5x/rd88f5181l-fxo-setup.c
3 *
4 * Marvell Orion-VoIP FXO Reference Design Setup
5 *
6 * This file is licensed under the terms of the GNU General Public
7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied.
9 */
10
11#include <linux/kernel.h>
12#include <linux/init.h>
13#include <linux/platform_device.h>
14#include <linux/pci.h>
15#include <linux/irq.h>
16#include <linux/mtd/physmap.h>
17#include <linux/mv643xx_eth.h>
18#include <asm/mach-types.h>
19#include <asm/gpio.h>
20#include <asm/leds.h>
21#include <asm/mach/arch.h>
22#include <asm/mach/pci.h>
23#include <asm/arch/orion5x.h>
24#include "common.h"
25#include "mpp.h"
26
27/*****************************************************************************
28 * RD-88F5181L FXO Info
29 ****************************************************************************/
30/*
31 * 8M NOR flash Device bus boot chip select
32 */
33#define RD88F5181L_FXO_NOR_BOOT_BASE 0xff800000
34#define RD88F5181L_FXO_NOR_BOOT_SIZE SZ_8M
35
36
37/*****************************************************************************
38 * 8M NOR Flash on Device bus Boot chip select
39 ****************************************************************************/
40static struct physmap_flash_data rd88f5181l_fxo_nor_boot_flash_data = {
41 .width = 1,
42};
43
44static struct resource rd88f5181l_fxo_nor_boot_flash_resource = {
45 .flags = IORESOURCE_MEM,
46 .start = RD88F5181L_FXO_NOR_BOOT_BASE,
47 .end = RD88F5181L_FXO_NOR_BOOT_BASE +
48 RD88F5181L_FXO_NOR_BOOT_SIZE - 1,
49};
50
51static struct platform_device rd88f5181l_fxo_nor_boot_flash = {
52 .name = "physmap-flash",
53 .id = 0,
54 .dev = {
55 .platform_data = &rd88f5181l_fxo_nor_boot_flash_data,
56 },
57 .num_resources = 1,
58 .resource = &rd88f5181l_fxo_nor_boot_flash_resource,
59};
60
61
62/*****************************************************************************
63 * General Setup
64 ****************************************************************************/
65static struct orion5x_mpp_mode rd88f5181l_fxo_mpp_modes[] __initdata = {
66 { 0, MPP_GPIO }, /* LED1 CardBus LED (front panel) */
67 { 1, MPP_GPIO }, /* PCI_intA */
68 { 2, MPP_GPIO }, /* Hard Reset / Factory Init*/
69 { 3, MPP_GPIO }, /* FXS or DAA select */
70 { 4, MPP_GPIO }, /* LED6 - phone LED (front panel) */
71 { 5, MPP_GPIO }, /* LED5 - phone LED (front panel) */
72 { 6, MPP_PCI_CLK }, /* CPU PCI refclk */
73 { 7, MPP_PCI_CLK }, /* PCI/PCIe refclk */
74 { 8, MPP_GPIO }, /* CardBus reset */
75 { 9, MPP_GPIO }, /* GE_RXERR */
76 { 10, MPP_GPIO }, /* LED2 MiniPCI LED (front panel) */
77 { 11, MPP_GPIO }, /* Lifeline control */
78 { 12, MPP_GIGE }, /* GE_TXD[4] */
79 { 13, MPP_GIGE }, /* GE_TXD[5] */
80 { 14, MPP_GIGE }, /* GE_TXD[6] */
81 { 15, MPP_GIGE }, /* GE_TXD[7] */
82 { 16, MPP_GIGE }, /* GE_RXD[4] */
83 { 17, MPP_GIGE }, /* GE_RXD[5] */
84 { 18, MPP_GIGE }, /* GE_RXD[6] */
85 { 19, MPP_GIGE }, /* GE_RXD[7] */
86 { -1 },
87};
88
89static struct mv643xx_eth_platform_data rd88f5181l_fxo_eth_data = {
90 .phy_addr = -1,
91};
92
93static void __init rd88f5181l_fxo_init(void)
94{
95 /*
96 * Setup basic Orion functions. Need to be called early.
97 */
98 orion5x_init();
99
100 orion5x_mpp_conf(rd88f5181l_fxo_mpp_modes);
101
102 /*
103 * Configure peripherals.
104 */
105 orion5x_ehci0_init();
106 orion5x_eth_init(&rd88f5181l_fxo_eth_data);
107 orion5x_uart0_init();
108
109 orion5x_setup_dev_boot_win(RD88F5181L_FXO_NOR_BOOT_BASE,
110 RD88F5181L_FXO_NOR_BOOT_SIZE);
111 platform_device_register(&rd88f5181l_fxo_nor_boot_flash);
112}
113
114static int __init
115rd88f5181l_fxo_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
116{
117 int irq;
118
119 /*
120 * Check for devices with hard-wired IRQs.
121 */
122 irq = orion5x_pci_map_irq(dev, slot, pin);
123 if (irq != -1)
124 return irq;
125
126 /*
127 * Mini-PCI / Cardbus slot.
128 */
129 return gpio_to_irq(1);
130}
131
132static struct hw_pci rd88f5181l_fxo_pci __initdata = {
133 .nr_controllers = 2,
134 .swizzle = pci_std_swizzle,
135 .setup = orion5x_pci_sys_setup,
136 .scan = orion5x_pci_sys_scan_bus,
137 .map_irq = rd88f5181l_fxo_pci_map_irq,
138};
139
140static int __init rd88f5181l_fxo_pci_init(void)
141{
142 if (machine_is_rd88f5181l_fxo()) {
143 orion5x_pci_set_cardbus_mode();
144 pci_common_init(&rd88f5181l_fxo_pci);
145 }
146
147 return 0;
148}
149subsys_initcall(rd88f5181l_fxo_pci_init);
150
151MACHINE_START(RD88F5181L_FXO, "Marvell Orion-VoIP FXO Reference Design")
152 /* Maintainer: Nicolas Pitre <nico@marvell.com> */
153 .phys_io = ORION5X_REGS_PHYS_BASE,
154 .io_pg_offst = ((ORION5X_REGS_VIRT_BASE) >> 18) & 0xFFFC,
155 .boot_params = 0x00000100,
156 .init_machine = rd88f5181l_fxo_init,
157 .map_io = orion5x_map_io,
158 .init_irq = orion5x_init_irq,
159 .timer = &orion5x_timer,
160 .fixup = tag_fixup_mem32,
161MACHINE_END
diff --git a/arch/arm/mach-orion5x/rd88f5181l-ge-setup.c b/arch/arm/mach-orion5x/rd88f5181l-ge-setup.c
new file mode 100644
index 000000000000..b56447d32e17
--- /dev/null
+++ b/arch/arm/mach-orion5x/rd88f5181l-ge-setup.c
@@ -0,0 +1,172 @@
1/*
2 * arch/arm/mach-orion5x/rd88f5181l-ge-setup.c
3 *
4 * Marvell Orion-VoIP GE Reference Design Setup
5 *
6 * This file is licensed under the terms of the GNU General Public
7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied.
9 */
10
11#include <linux/kernel.h>
12#include <linux/init.h>
13#include <linux/platform_device.h>
14#include <linux/pci.h>
15#include <linux/irq.h>
16#include <linux/mtd/physmap.h>
17#include <linux/mv643xx_eth.h>
18#include <linux/i2c.h>
19#include <asm/mach-types.h>
20#include <asm/gpio.h>
21#include <asm/leds.h>
22#include <asm/mach/arch.h>
23#include <asm/mach/pci.h>
24#include <asm/arch/orion5x.h>
25#include "common.h"
26#include "mpp.h"
27
28/*****************************************************************************
29 * RD-88F5181L GE Info
30 ****************************************************************************/
31/*
32 * 16M NOR flash Device bus boot chip select
33 */
34#define RD88F5181L_GE_NOR_BOOT_BASE 0xff000000
35#define RD88F5181L_GE_NOR_BOOT_SIZE SZ_16M
36
37
38/*****************************************************************************
39 * 16M NOR Flash on Device bus Boot chip select
40 ****************************************************************************/
41static struct physmap_flash_data rd88f5181l_ge_nor_boot_flash_data = {
42 .width = 1,
43};
44
45static struct resource rd88f5181l_ge_nor_boot_flash_resource = {
46 .flags = IORESOURCE_MEM,
47 .start = RD88F5181L_GE_NOR_BOOT_BASE,
48 .end = RD88F5181L_GE_NOR_BOOT_BASE +
49 RD88F5181L_GE_NOR_BOOT_SIZE - 1,
50};
51
52static struct platform_device rd88f5181l_ge_nor_boot_flash = {
53 .name = "physmap-flash",
54 .id = 0,
55 .dev = {
56 .platform_data = &rd88f5181l_ge_nor_boot_flash_data,
57 },
58 .num_resources = 1,
59 .resource = &rd88f5181l_ge_nor_boot_flash_resource,
60};
61
62
63/*****************************************************************************
64 * General Setup
65 ****************************************************************************/
66static struct orion5x_mpp_mode rd88f5181l_ge_mpp_modes[] __initdata = {
67 { 0, MPP_GPIO }, /* LED1 */
68 { 1, MPP_GPIO }, /* LED5 */
69 { 2, MPP_GPIO }, /* LED4 */
70 { 3, MPP_GPIO }, /* LED3 */
71 { 4, MPP_GPIO }, /* PCI_intA */
72 { 5, MPP_GPIO }, /* RTC interrupt */
73 { 6, MPP_PCI_CLK }, /* CPU PCI refclk */
74 { 7, MPP_PCI_CLK }, /* PCI/PCIe refclk */
75 { 8, MPP_GPIO }, /* 88e6131 interrupt */
76 { 9, MPP_GPIO }, /* GE_RXERR */
77 { 10, MPP_GPIO }, /* PCI_intB */
78 { 11, MPP_GPIO }, /* LED2 */
79 { 12, MPP_GIGE }, /* GE_TXD[4] */
80 { 13, MPP_GIGE }, /* GE_TXD[5] */
81 { 14, MPP_GIGE }, /* GE_TXD[6] */
82 { 15, MPP_GIGE }, /* GE_TXD[7] */
83 { 16, MPP_GIGE }, /* GE_RXD[4] */
84 { 17, MPP_GIGE }, /* GE_RXD[5] */
85 { 18, MPP_GIGE }, /* GE_RXD[6] */
86 { 19, MPP_GIGE }, /* GE_RXD[7] */
87 { -1 },
88};
89
90static struct mv643xx_eth_platform_data rd88f5181l_ge_eth_data = {
91 .phy_addr = -1,
92};
93
94static struct i2c_board_info __initdata rd88f5181l_ge_i2c_rtc = {
95 I2C_BOARD_INFO("ds1338", 0x68),
96};
97
98static void __init rd88f5181l_ge_init(void)
99{
100 /*
101 * Setup basic Orion functions. Need to be called early.
102 */
103 orion5x_init();
104
105 orion5x_mpp_conf(rd88f5181l_ge_mpp_modes);
106
107 /*
108 * Configure peripherals.
109 */
110 orion5x_ehci0_init();
111 orion5x_eth_init(&rd88f5181l_ge_eth_data);
112 orion5x_i2c_init();
113 orion5x_uart0_init();
114
115 orion5x_setup_dev_boot_win(RD88F5181L_GE_NOR_BOOT_BASE,
116 RD88F5181L_GE_NOR_BOOT_SIZE);
117 platform_device_register(&rd88f5181l_ge_nor_boot_flash);
118
119 i2c_register_board_info(0, &rd88f5181l_ge_i2c_rtc, 1);
120}
121
122static int __init
123rd88f5181l_ge_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
124{
125 int irq;
126
127 /*
128 * Check for devices with hard-wired IRQs.
129 */
130 irq = orion5x_pci_map_irq(dev, slot, pin);
131 if (irq != -1)
132 return irq;
133
134 /*
135 * Cardbus slot.
136 */
137 if (pin == 1)
138 return gpio_to_irq(4);
139 else
140 return gpio_to_irq(10);
141}
142
143static struct hw_pci rd88f5181l_ge_pci __initdata = {
144 .nr_controllers = 2,
145 .swizzle = pci_std_swizzle,
146 .setup = orion5x_pci_sys_setup,
147 .scan = orion5x_pci_sys_scan_bus,
148 .map_irq = rd88f5181l_ge_pci_map_irq,
149};
150
151static int __init rd88f5181l_ge_pci_init(void)
152{
153 if (machine_is_rd88f5181l_ge()) {
154 orion5x_pci_set_cardbus_mode();
155 pci_common_init(&rd88f5181l_ge_pci);
156 }
157
158 return 0;
159}
160subsys_initcall(rd88f5181l_ge_pci_init);
161
162MACHINE_START(RD88F5181L_GE, "Marvell Orion-VoIP GE Reference Design")
163 /* Maintainer: Lennert Buytenhek <buytenh@marvell.com> */
164 .phys_io = ORION5X_REGS_PHYS_BASE,
165 .io_pg_offst = ((ORION5X_REGS_VIRT_BASE) >> 18) & 0xFFFC,
166 .boot_params = 0x00000100,
167 .init_machine = rd88f5181l_ge_init,
168 .map_io = orion5x_map_io,
169 .init_irq = orion5x_init_irq,
170 .timer = &orion5x_timer,
171 .fixup = tag_fixup_mem32,
172MACHINE_END
diff --git a/arch/arm/mach-orion5x/rd88f5182-setup.c b/arch/arm/mach-orion5x/rd88f5182-setup.c
index 81abc1003aae..10ae62864269 100644
--- a/arch/arm/mach-orion5x/rd88f5182-setup.c
+++ b/arch/arm/mach-orion5x/rd88f5182-setup.c
@@ -26,6 +26,7 @@
26#include <asm/mach/pci.h> 26#include <asm/mach/pci.h>
27#include <asm/arch/orion5x.h> 27#include <asm/arch/orion5x.h>
28#include "common.h" 28#include "common.h"
29#include "mpp.h"
29 30
30/***************************************************************************** 31/*****************************************************************************
31 * RD-88F5182 Info 32 * RD-88F5182 Info
@@ -125,6 +126,7 @@ static int __init rd88f5182_dbgled_init(void)
125 126
126 leds_event = rd88f5182_dbgled_event; 127 leds_event = rd88f5182_dbgled_event;
127 } 128 }
129
128 return 0; 130 return 0;
129} 131}
130 132
@@ -220,7 +222,6 @@ subsys_initcall(rd88f5182_pci_init);
220 222
221static struct mv643xx_eth_platform_data rd88f5182_eth_data = { 223static struct mv643xx_eth_platform_data rd88f5182_eth_data = {
222 .phy_addr = 8, 224 .phy_addr = 8,
223 .force_phy_addr = 1,
224}; 225};
225 226
226/***************************************************************************** 227/*****************************************************************************
@@ -234,15 +235,34 @@ static struct i2c_board_info __initdata rd88f5182_i2c_rtc = {
234 * Sata 235 * Sata
235 ****************************************************************************/ 236 ****************************************************************************/
236static struct mv_sata_platform_data rd88f5182_sata_data = { 237static struct mv_sata_platform_data rd88f5182_sata_data = {
237 .n_ports = 2, 238 .n_ports = 2,
238}; 239};
239 240
240/***************************************************************************** 241/*****************************************************************************
241 * General Setup 242 * General Setup
242 ****************************************************************************/ 243 ****************************************************************************/
243 244static struct orion5x_mpp_mode rd88f5182_mpp_modes[] __initdata = {
244static struct platform_device *rd88f5182_devices[] __initdata = { 245 { 0, MPP_GPIO }, /* Debug Led */
245 &rd88f5182_nor_flash, 246 { 1, MPP_GPIO }, /* Reset Switch */
247 { 2, MPP_UNUSED },
248 { 3, MPP_GPIO }, /* RTC Int */
249 { 4, MPP_GPIO },
250 { 5, MPP_GPIO },
251 { 6, MPP_GPIO }, /* PCI_intA */
252 { 7, MPP_GPIO }, /* PCI_intB */
253 { 8, MPP_UNUSED },
254 { 9, MPP_UNUSED },
255 { 10, MPP_UNUSED },
256 { 11, MPP_UNUSED },
257 { 12, MPP_SATA_LED }, /* SATA 0 presence */
258 { 13, MPP_SATA_LED }, /* SATA 1 presence */
259 { 14, MPP_SATA_LED }, /* SATA 0 active */
260 { 15, MPP_SATA_LED }, /* SATA 1 active */
261 { 16, MPP_UNUSED },
262 { 17, MPP_UNUSED },
263 { 18, MPP_UNUSED },
264 { 19, MPP_UNUSED },
265 { -1 },
246}; 266};
247 267
248static void __init rd88f5182_init(void) 268static void __init rd88f5182_init(void)
@@ -252,35 +272,9 @@ static void __init rd88f5182_init(void)
252 */ 272 */
253 orion5x_init(); 273 orion5x_init();
254 274
255 /* 275 orion5x_mpp_conf(rd88f5182_mpp_modes);
256 * Setup the CPU address decode windows for our devices
257 */
258 orion5x_setup_dev_boot_win(RD88F5182_NOR_BOOT_BASE,
259 RD88F5182_NOR_BOOT_SIZE);
260 orion5x_setup_dev1_win(RD88F5182_NOR_BASE, RD88F5182_NOR_SIZE);
261
262 /*
263 * Open a special address decode windows for the PCIe WA.
264 */
265 orion5x_setup_pcie_wa_win(ORION5X_PCIE_WA_PHYS_BASE,
266 ORION5X_PCIE_WA_SIZE);
267 276
268 /* 277 /*
269 * Setup Multiplexing Pins --
270 * MPP[0] Debug Led (GPIO - Out)
271 * MPP[1] Debug Led (GPIO - Out)
272 * MPP[2] N/A
273 * MPP[3] RTC_Int (GPIO - In)
274 * MPP[4] GPIO
275 * MPP[5] GPIO
276 * MPP[6] PCI_intA (GPIO - In)
277 * MPP[7] PCI_intB (GPIO - In)
278 * MPP[8-11] N/A
279 * MPP[12] SATA 0 presence Indication
280 * MPP[13] SATA 1 presence Indication
281 * MPP[14] SATA 0 active Indication
282 * MPP[15] SATA 1 active indication
283 * MPP[16-19] Not used
284 * MPP[20] PCI Clock to MV88F5182 278 * MPP[20] PCI Clock to MV88F5182
285 * MPP[21] PCI Clock to mini PCI CON11 279 * MPP[21] PCI Clock to mini PCI CON11
286 * MPP[22] USB 0 over current indication 280 * MPP[22] USB 0 over current indication
@@ -289,16 +283,23 @@ static void __init rd88f5182_init(void)
289 * MPP[25] USB 0 over current enable 283 * MPP[25] USB 0 over current enable
290 */ 284 */
291 285
292 orion5x_write(MPP_0_7_CTRL, 0x00000003); 286 /*
293 orion5x_write(MPP_8_15_CTRL, 0x55550000); 287 * Configure peripherals.
294 orion5x_write(MPP_16_19_CTRL, 0x5555); 288 */
289 orion5x_ehci0_init();
290 orion5x_ehci1_init();
291 orion5x_eth_init(&rd88f5182_eth_data);
292 orion5x_i2c_init();
293 orion5x_sata_init(&rd88f5182_sata_data);
294 orion5x_uart0_init();
295 295
296 orion5x_gpio_set_valid_pins(0x000000fb); 296 orion5x_setup_dev_boot_win(RD88F5182_NOR_BOOT_BASE,
297 RD88F5182_NOR_BOOT_SIZE);
298
299 orion5x_setup_dev1_win(RD88F5182_NOR_BASE, RD88F5182_NOR_SIZE);
300 platform_device_register(&rd88f5182_nor_flash);
297 301
298 platform_add_devices(rd88f5182_devices, ARRAY_SIZE(rd88f5182_devices));
299 i2c_register_board_info(0, &rd88f5182_i2c_rtc, 1); 302 i2c_register_board_info(0, &rd88f5182_i2c_rtc, 1);
300 orion5x_eth_init(&rd88f5182_eth_data);
301 orion5x_sata_init(&rd88f5182_sata_data);
302} 303}
303 304
304MACHINE_START(RD88F5182, "Marvell Orion-NAS Reference Design") 305MACHINE_START(RD88F5182, "Marvell Orion-NAS Reference Design")
diff --git a/arch/arm/mach-orion5x/ts209-setup.c b/arch/arm/mach-orion5x/ts209-setup.c
index 9afb41ee6e07..a9cef9703d5b 100644
--- a/arch/arm/mach-orion5x/ts209-setup.c
+++ b/arch/arm/mach-orion5x/ts209-setup.c
@@ -28,6 +28,8 @@
28#include <asm/mach/pci.h> 28#include <asm/mach/pci.h>
29#include <asm/arch/orion5x.h> 29#include <asm/arch/orion5x.h>
30#include "common.h" 30#include "common.h"
31#include "mpp.h"
32#include "tsx09-common.h"
31 33
32#define QNAP_TS209_NOR_BOOT_BASE 0xf4000000 34#define QNAP_TS209_NOR_BOOT_BASE 0xf4000000
33#define QNAP_TS209_NOR_BOOT_SIZE SZ_8M 35#define QNAP_TS209_NOR_BOOT_SIZE SZ_8M
@@ -47,52 +49,54 @@
47 ***************************************************************************/ 49 ***************************************************************************/
48static struct mtd_partition qnap_ts209_partitions[] = { 50static struct mtd_partition qnap_ts209_partitions[] = {
49 { 51 {
50 .name = "U-Boot", 52 .name = "U-Boot",
51 .size = 0x00080000, 53 .size = 0x00080000,
52 .offset = 0x00780000, 54 .offset = 0x00780000,
53 .mask_flags = MTD_WRITEABLE, 55 .mask_flags = MTD_WRITEABLE,
54 }, { 56 }, {
55 .name = "Kernel", 57 .name = "Kernel",
56 .size = 0x00200000, 58 .size = 0x00200000,
57 .offset = 0, 59 .offset = 0,
58 }, { 60 }, {
59 .name = "RootFS1", 61 .name = "RootFS1",
60 .size = 0x00400000, 62 .size = 0x00400000,
61 .offset = 0x00200000, 63 .offset = 0x00200000,
62 }, { 64 }, {
63 .name = "RootFS2", 65 .name = "RootFS2",
64 .size = 0x00100000, 66 .size = 0x00100000,
65 .offset = 0x00600000, 67 .offset = 0x00600000,
66 }, { 68 }, {
67 .name = "U-Boot Config", 69 .name = "U-Boot Config",
68 .size = 0x00020000, 70 .size = 0x00020000,
69 .offset = 0x00760000, 71 .offset = 0x00760000,
70 }, { 72 }, {
71 .name = "NAS Config", 73 .name = "NAS Config",
72 .size = 0x00060000, 74 .size = 0x00060000,
73 .offset = 0x00700000, 75 .offset = 0x00700000,
74 .mask_flags = MTD_WRITEABLE, 76 .mask_flags = MTD_WRITEABLE,
75 } 77 },
76}; 78};
77 79
78static struct physmap_flash_data qnap_ts209_nor_flash_data = { 80static struct physmap_flash_data qnap_ts209_nor_flash_data = {
79 .width = 1, 81 .width = 1,
80 .parts = qnap_ts209_partitions, 82 .parts = qnap_ts209_partitions,
81 .nr_parts = ARRAY_SIZE(qnap_ts209_partitions) 83 .nr_parts = ARRAY_SIZE(qnap_ts209_partitions)
82}; 84};
83 85
84static struct resource qnap_ts209_nor_flash_resource = { 86static struct resource qnap_ts209_nor_flash_resource = {
85 .flags = IORESOURCE_MEM, 87 .flags = IORESOURCE_MEM,
86 .start = QNAP_TS209_NOR_BOOT_BASE, 88 .start = QNAP_TS209_NOR_BOOT_BASE,
87 .end = QNAP_TS209_NOR_BOOT_BASE + QNAP_TS209_NOR_BOOT_SIZE - 1, 89 .end = QNAP_TS209_NOR_BOOT_BASE + QNAP_TS209_NOR_BOOT_SIZE - 1,
88}; 90};
89 91
90static struct platform_device qnap_ts209_nor_flash = { 92static struct platform_device qnap_ts209_nor_flash = {
91 .name = "physmap-flash", 93 .name = "physmap-flash",
92 .id = 0, 94 .id = 0,
93 .dev = { .platform_data = &qnap_ts209_nor_flash_data, }, 95 .dev = {
94 .resource = &qnap_ts209_nor_flash_resource, 96 .platform_data = &qnap_ts209_nor_flash_data,
95 .num_resources = 1, 97 },
98 .resource = &qnap_ts209_nor_flash_resource,
99 .num_resources = 1,
96}; 100};
97 101
98/***************************************************************************** 102/*****************************************************************************
@@ -164,12 +168,12 @@ static int __init qnap_ts209_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
164} 168}
165 169
166static struct hw_pci qnap_ts209_pci __initdata = { 170static struct hw_pci qnap_ts209_pci __initdata = {
167 .nr_controllers = 2, 171 .nr_controllers = 2,
168 .preinit = qnap_ts209_pci_preinit, 172 .preinit = qnap_ts209_pci_preinit,
169 .swizzle = pci_std_swizzle, 173 .swizzle = pci_std_swizzle,
170 .setup = orion5x_pci_sys_setup, 174 .setup = orion5x_pci_sys_setup,
171 .scan = orion5x_pci_sys_scan_bus, 175 .scan = orion5x_pci_sys_scan_bus,
172 .map_irq = qnap_ts209_pci_map_irq, 176 .map_irq = qnap_ts209_pci_map_irq,
173}; 177};
174 178
175static int __init qnap_ts209_pci_init(void) 179static int __init qnap_ts209_pci_init(void)
@@ -183,96 +187,6 @@ static int __init qnap_ts209_pci_init(void)
183subsys_initcall(qnap_ts209_pci_init); 187subsys_initcall(qnap_ts209_pci_init);
184 188
185/***************************************************************************** 189/*****************************************************************************
186 * Ethernet
187 ****************************************************************************/
188
189static struct mv643xx_eth_platform_data qnap_ts209_eth_data = {
190 .phy_addr = 8,
191 .force_phy_addr = 1,
192};
193
194static int __init parse_hex_nibble(char n)
195{
196 if (n >= '0' && n <= '9')
197 return n - '0';
198
199 if (n >= 'A' && n <= 'F')
200 return n - 'A' + 10;
201
202 if (n >= 'a' && n <= 'f')
203 return n - 'a' + 10;
204
205 return -1;
206}
207
208static int __init parse_hex_byte(const char *b)
209{
210 int hi;
211 int lo;
212
213 hi = parse_hex_nibble(b[0]);
214 lo = parse_hex_nibble(b[1]);
215
216 if (hi < 0 || lo < 0)
217 return -1;
218
219 return (hi << 4) | lo;
220}
221
222static int __init check_mac_addr(const char *addr_str)
223{
224 u_int8_t addr[6];
225 int i;
226
227 for (i = 0; i < 6; i++) {
228 int byte;
229
230 /*
231 * Enforce "xx:xx:xx:xx:xx:xx\n" format.
232 */
233 if (addr_str[(i * 3) + 2] != ((i < 5) ? ':' : '\n'))
234 return -1;
235
236 byte = parse_hex_byte(addr_str + (i * 3));
237 if (byte < 0)
238 return -1;
239 addr[i] = byte;
240 }
241
242 printk(KERN_INFO "ts209: found ethernet mac address ");
243 for (i = 0; i < 6; i++)
244 printk("%.2x%s", addr[i], (i < 5) ? ":" : ".\n");
245
246 memcpy(qnap_ts209_eth_data.mac_addr, addr, 6);
247
248 return 0;
249}
250
251/*
252 * The 'NAS Config' flash partition has an ext2 filesystem which
253 * contains a file that has the ethernet MAC address in plain text
254 * (format "xx:xx:xx:xx:xx:xx\n".)
255 */
256static void __init ts209_find_mac_addr(void)
257{
258 unsigned long addr;
259
260 for (addr = 0x00700000; addr < 0x00760000; addr += 1024) {
261 char *nor_page;
262 int ret = 0;
263
264 nor_page = ioremap(QNAP_TS209_NOR_BOOT_BASE + addr, 1024);
265 if (nor_page != NULL) {
266 ret = check_mac_addr(nor_page);
267 iounmap(nor_page);
268 }
269
270 if (ret == 0)
271 break;
272 }
273}
274
275/*****************************************************************************
276 * RTC S35390A on I2C bus 190 * RTC S35390A on I2C bus
277 ****************************************************************************/ 191 ****************************************************************************/
278 192
@@ -280,7 +194,7 @@ static void __init ts209_find_mac_addr(void)
280 194
281static struct i2c_board_info __initdata qnap_ts209_i2c_rtc = { 195static struct i2c_board_info __initdata qnap_ts209_i2c_rtc = {
282 I2C_BOARD_INFO("s35390a", 0x30), 196 I2C_BOARD_INFO("s35390a", 0x30),
283 .irq = 0, 197 .irq = 0,
284}; 198};
285 199
286/**************************************************************************** 200/****************************************************************************
@@ -297,70 +211,63 @@ static struct gpio_keys_button qnap_ts209_buttons[] = {
297 .gpio = QNAP_TS209_GPIO_KEY_MEDIA, 211 .gpio = QNAP_TS209_GPIO_KEY_MEDIA,
298 .desc = "USB Copy Button", 212 .desc = "USB Copy Button",
299 .active_low = 1, 213 .active_low = 1,
300 }, 214 }, {
301 {
302 .code = KEY_POWER, 215 .code = KEY_POWER,
303 .gpio = QNAP_TS209_GPIO_KEY_RESET, 216 .gpio = QNAP_TS209_GPIO_KEY_RESET,
304 .desc = "Reset Button", 217 .desc = "Reset Button",
305 .active_low = 1, 218 .active_low = 1,
306 } 219 },
307}; 220};
308 221
309static struct gpio_keys_platform_data qnap_ts209_button_data = { 222static struct gpio_keys_platform_data qnap_ts209_button_data = {
310 .buttons = qnap_ts209_buttons, 223 .buttons = qnap_ts209_buttons,
311 .nbuttons = ARRAY_SIZE(qnap_ts209_buttons), 224 .nbuttons = ARRAY_SIZE(qnap_ts209_buttons),
312}; 225};
313 226
314static struct platform_device qnap_ts209_button_device = { 227static struct platform_device qnap_ts209_button_device = {
315 .name = "gpio-keys", 228 .name = "gpio-keys",
316 .id = -1, 229 .id = -1,
317 .num_resources = 0, 230 .num_resources = 0,
318 .dev = { .platform_data = &qnap_ts209_button_data, }, 231 .dev = {
232 .platform_data = &qnap_ts209_button_data,
233 },
319}; 234};
320 235
321/***************************************************************************** 236/*****************************************************************************
322 * SATA 237 * SATA
323 ****************************************************************************/ 238 ****************************************************************************/
324static struct mv_sata_platform_data qnap_ts209_sata_data = { 239static struct mv_sata_platform_data qnap_ts209_sata_data = {
325 .n_ports = 2, 240 .n_ports = 2,
326}; 241};
327 242
328/***************************************************************************** 243/*****************************************************************************
329 244
330 * General Setup 245 * General Setup
331 ****************************************************************************/ 246 ****************************************************************************/
332 247static struct orion5x_mpp_mode ts209_mpp_modes[] __initdata = {
333static struct platform_device *qnap_ts209_devices[] __initdata = { 248 { 0, MPP_UNUSED },
334 &qnap_ts209_nor_flash, 249 { 1, MPP_GPIO }, /* USB copy button */
335 &qnap_ts209_button_device, 250 { 2, MPP_GPIO }, /* Load defaults button */
251 { 3, MPP_GPIO }, /* GPIO RTC */
252 { 4, MPP_UNUSED },
253 { 5, MPP_UNUSED },
254 { 6, MPP_GPIO }, /* PCI Int A */
255 { 7, MPP_GPIO }, /* PCI Int B */
256 { 8, MPP_UNUSED },
257 { 9, MPP_UNUSED },
258 { 10, MPP_UNUSED },
259 { 11, MPP_UNUSED },
260 { 12, MPP_SATA_LED }, /* SATA 0 presence */
261 { 13, MPP_SATA_LED }, /* SATA 1 presence */
262 { 14, MPP_SATA_LED }, /* SATA 0 active */
263 { 15, MPP_SATA_LED }, /* SATA 1 active */
264 { 16, MPP_UART }, /* UART1 RXD */
265 { 17, MPP_UART }, /* UART1 TXD */
266 { 18, MPP_GPIO }, /* SW_RST */
267 { 19, MPP_UNUSED },
268 { -1 },
336}; 269};
337 270
338/*
339 * QNAP TS-[12]09 specific power off method via UART1-attached PIC
340 */
341
342#define UART1_REG(x) (UART1_VIRT_BASE + ((UART_##x) << 2))
343
344static void qnap_ts209_power_off(void)
345{
346 /* 19200 baud divisor */
347 const unsigned divisor = ((ORION5X_TCLK + (8 * 19200)) / (16 * 19200));
348
349 pr_info("%s: triggering power-off...\n", __func__);
350
351 /* hijack uart1 and reset into sane state (19200,8n1) */
352 orion5x_write(UART1_REG(LCR), 0x83);
353 orion5x_write(UART1_REG(DLL), divisor & 0xff);
354 orion5x_write(UART1_REG(DLM), (divisor >> 8) & 0xff);
355 orion5x_write(UART1_REG(LCR), 0x03);
356 orion5x_write(UART1_REG(IER), 0x00);
357 orion5x_write(UART1_REG(FCR), 0x00);
358 orion5x_write(UART1_REG(MCR), 0x00);
359
360 /* send the power-off command 'A' to PIC */
361 orion5x_write(UART1_REG(TX), 'A');
362}
363
364static void __init qnap_ts209_init(void) 271static void __init qnap_ts209_init(void)
365{ 272{
366 /* 273 /*
@@ -368,51 +275,33 @@ static void __init qnap_ts209_init(void)
368 */ 275 */
369 orion5x_init(); 276 orion5x_init();
370 277
371 /* 278 orion5x_mpp_conf(ts209_mpp_modes);
372 * Setup flash mapping
373 */
374 orion5x_setup_dev_boot_win(QNAP_TS209_NOR_BOOT_BASE,
375 QNAP_TS209_NOR_BOOT_SIZE);
376
377 /*
378 * Open a special address decode windows for the PCIe WA.
379 */
380 orion5x_setup_pcie_wa_win(ORION5X_PCIE_WA_PHYS_BASE,
381 ORION5X_PCIE_WA_SIZE);
382 279
383 /* 280 /*
384 * Setup Multiplexing Pins --
385 * MPP[0] Reserved
386 * MPP[1] USB copy button (0 active)
387 * MPP[2] Load defaults button (0 active)
388 * MPP[3] GPIO RTC
389 * MPP[4-5] Reserved
390 * MPP[6] PCI Int A
391 * MPP[7] PCI Int B
392 * MPP[8-11] Reserved
393 * MPP[12] SATA 0 presence
394 * MPP[13] SATA 1 presence
395 * MPP[14] SATA 0 active
396 * MPP[15] SATA 1 active
397 * MPP[16] UART1 RXD
398 * MPP[17] UART1 TXD
399 * MPP[18] SW_RST (0 active)
400 * MPP[19] Reserved
401 * MPP[20] PCI clock 0 281 * MPP[20] PCI clock 0
402 * MPP[21] PCI clock 1 282 * MPP[21] PCI clock 1
403 * MPP[22] USB 0 over current 283 * MPP[22] USB 0 over current
404 * MPP[23-25] Reserved 284 * MPP[23-25] Reserved
405 */ 285 */
406 orion5x_write(MPP_0_7_CTRL, 0x3);
407 orion5x_write(MPP_8_15_CTRL, 0x55550000);
408 orion5x_write(MPP_16_19_CTRL, 0x5500);
409 orion5x_gpio_set_valid_pins(0x3cc0fff);
410 286
411 /* register ts209 specific power-off method */ 287 /*
412 pm_power_off = qnap_ts209_power_off; 288 * Configure peripherals.
289 */
290 orion5x_ehci0_init();
291 orion5x_ehci1_init();
292 qnap_tsx09_find_mac_addr(QNAP_TS209_NOR_BOOT_BASE +
293 qnap_ts209_partitions[5].offset,
294 qnap_ts209_partitions[5].size);
295 orion5x_eth_init(&qnap_tsx09_eth_data);
296 orion5x_i2c_init();
297 orion5x_sata_init(&qnap_ts209_sata_data);
298 orion5x_uart0_init();
299
300 orion5x_setup_dev_boot_win(QNAP_TS209_NOR_BOOT_BASE,
301 QNAP_TS209_NOR_BOOT_SIZE);
302 platform_device_register(&qnap_ts209_nor_flash);
413 303
414 platform_add_devices(qnap_ts209_devices, 304 platform_device_register(&qnap_ts209_button_device);
415 ARRAY_SIZE(qnap_ts209_devices));
416 305
417 /* Get RTC IRQ and register the chip */ 306 /* Get RTC IRQ and register the chip */
418 if (gpio_request(TS209_RTC_GPIO, "rtc") == 0) { 307 if (gpio_request(TS209_RTC_GPIO, "rtc") == 0) {
@@ -425,14 +314,12 @@ static void __init qnap_ts209_init(void)
425 pr_warning("qnap_ts209_init: failed to get RTC IRQ\n"); 314 pr_warning("qnap_ts209_init: failed to get RTC IRQ\n");
426 i2c_register_board_info(0, &qnap_ts209_i2c_rtc, 1); 315 i2c_register_board_info(0, &qnap_ts209_i2c_rtc, 1);
427 316
428 ts209_find_mac_addr(); 317 /* register tsx09 specific power-off method */
429 orion5x_eth_init(&qnap_ts209_eth_data); 318 pm_power_off = qnap_tsx09_power_off;
430
431 orion5x_sata_init(&qnap_ts209_sata_data);
432} 319}
433 320
434MACHINE_START(TS209, "QNAP TS-109/TS-209") 321MACHINE_START(TS209, "QNAP TS-109/TS-209")
435 /* Maintainer: Byron Bradley <byron.bbradley@gmail.com> */ 322 /* Maintainer: Byron Bradley <byron.bbradley@gmail.com> */
436 .phys_io = ORION5X_REGS_PHYS_BASE, 323 .phys_io = ORION5X_REGS_PHYS_BASE,
437 .io_pg_offst = ((ORION5X_REGS_VIRT_BASE) >> 18) & 0xFFFC, 324 .io_pg_offst = ((ORION5X_REGS_VIRT_BASE) >> 18) & 0xFFFC,
438 .boot_params = 0x00000100, 325 .boot_params = 0x00000100,
diff --git a/arch/arm/mach-orion5x/ts409-setup.c b/arch/arm/mach-orion5x/ts409-setup.c
new file mode 100644
index 000000000000..32f0ff073b7e
--- /dev/null
+++ b/arch/arm/mach-orion5x/ts409-setup.c
@@ -0,0 +1,273 @@
1/*
2 * QNAP TS-409 Board Setup
3 *
4 * Maintainer: Sylver Bruneau <sylver.bruneau@gmail.com>
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12#include <linux/kernel.h>
13#include <linux/init.h>
14#include <linux/platform_device.h>
15#include <linux/pci.h>
16#include <linux/irq.h>
17#include <linux/mtd/physmap.h>
18#include <linux/mv643xx_eth.h>
19#include <linux/gpio_keys.h>
20#include <linux/input.h>
21#include <linux/i2c.h>
22#include <linux/serial_reg.h>
23#include <asm/mach-types.h>
24#include <asm/gpio.h>
25#include <asm/mach/arch.h>
26#include <asm/mach/pci.h>
27#include <asm/arch/orion5x.h>
28#include "common.h"
29#include "mpp.h"
30#include "tsx09-common.h"
31
32/*****************************************************************************
33 * QNAP TS-409 Info
34 ****************************************************************************/
35
36/*
37 * QNAP TS-409 hardware :
38 * - Marvell 88F5281-D0
39 * - Marvell 88SX7042 SATA controller (PCIe)
40 * - Marvell 88E1118 Gigabit Ethernet PHY
41 * - RTC S35390A (@0x30) on I2C bus
42 * - 8MB NOR flash
43 * - 256MB of DDR-2 RAM
44 */
45
46/*
47 * 8MB NOR flash Device bus boot chip select
48 */
49
50#define QNAP_TS409_NOR_BOOT_BASE 0xff800000
51#define QNAP_TS409_NOR_BOOT_SIZE SZ_8M
52
53/****************************************************************************
54 * 8MiB NOR flash. The struct mtd_partition is not in the same order as the
55 * partitions on the device because we want to keep compatability with
56 * existing QNAP firmware.
57 *
58 * Layout as used by QNAP:
59 * [2] 0x00000000-0x00200000 : "Kernel"
60 * [3] 0x00200000-0x00600000 : "RootFS1"
61 * [4] 0x00600000-0x00700000 : "RootFS2"
62 * [6] 0x00700000-0x00760000 : "NAS Config" (read-only)
63 * [5] 0x00760000-0x00780000 : "U-Boot Config"
64 * [1] 0x00780000-0x00800000 : "U-Boot" (read-only)
65 ***************************************************************************/
66static struct mtd_partition qnap_ts409_partitions[] = {
67 {
68 .name = "U-Boot",
69 .size = 0x00080000,
70 .offset = 0x00780000,
71 .mask_flags = MTD_WRITEABLE,
72 }, {
73 .name = "Kernel",
74 .size = 0x00200000,
75 .offset = 0,
76 }, {
77 .name = "RootFS1",
78 .size = 0x00400000,
79 .offset = 0x00200000,
80 }, {
81 .name = "RootFS2",
82 .size = 0x00100000,
83 .offset = 0x00600000,
84 }, {
85 .name = "U-Boot Config",
86 .size = 0x00020000,
87 .offset = 0x00760000,
88 }, {
89 .name = "NAS Config",
90 .size = 0x00060000,
91 .offset = 0x00700000,
92 .mask_flags = MTD_WRITEABLE,
93 },
94};
95
96static struct physmap_flash_data qnap_ts409_nor_flash_data = {
97 .width = 1,
98 .parts = qnap_ts409_partitions,
99 .nr_parts = ARRAY_SIZE(qnap_ts409_partitions)
100};
101
102static struct resource qnap_ts409_nor_flash_resource = {
103 .flags = IORESOURCE_MEM,
104 .start = QNAP_TS409_NOR_BOOT_BASE,
105 .end = QNAP_TS409_NOR_BOOT_BASE + QNAP_TS409_NOR_BOOT_SIZE - 1,
106};
107
108static struct platform_device qnap_ts409_nor_flash = {
109 .name = "physmap-flash",
110 .id = 0,
111 .dev = { .platform_data = &qnap_ts409_nor_flash_data, },
112 .num_resources = 1,
113 .resource = &qnap_ts409_nor_flash_resource,
114};
115
116/*****************************************************************************
117 * PCI
118 ****************************************************************************/
119
120static int __init qnap_ts409_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
121{
122 int irq;
123
124 /*
125 * Check for devices with hard-wired IRQs.
126 */
127 irq = orion5x_pci_map_irq(dev, slot, pin);
128 if (irq != -1)
129 return irq;
130
131 /*
132 * PCI isn't used on the TS-409
133 */
134 return -1;
135}
136
137static struct hw_pci qnap_ts409_pci __initdata = {
138 .nr_controllers = 2,
139 .swizzle = pci_std_swizzle,
140 .setup = orion5x_pci_sys_setup,
141 .scan = orion5x_pci_sys_scan_bus,
142 .map_irq = qnap_ts409_pci_map_irq,
143};
144
145static int __init qnap_ts409_pci_init(void)
146{
147 if (machine_is_ts409())
148 pci_common_init(&qnap_ts409_pci);
149
150 return 0;
151}
152
153subsys_initcall(qnap_ts409_pci_init);
154
155/*****************************************************************************
156 * RTC S35390A on I2C bus
157 ****************************************************************************/
158
159#define TS409_RTC_GPIO 10
160
161static struct i2c_board_info __initdata qnap_ts409_i2c_rtc = {
162 I2C_BOARD_INFO("s35390a", 0x30),
163};
164
165/****************************************************************************
166 * GPIO Attached Keys
167 * Power button is attached to the PIC microcontroller
168 ****************************************************************************/
169
170#define QNAP_TS409_GPIO_KEY_MEDIA 15
171
172static struct gpio_keys_button qnap_ts409_buttons[] = {
173 {
174 .code = KEY_RESTART,
175 .gpio = QNAP_TS409_GPIO_KEY_MEDIA,
176 .desc = "USB Copy Button",
177 .active_low = 1,
178 },
179};
180
181static struct gpio_keys_platform_data qnap_ts409_button_data = {
182 .buttons = qnap_ts409_buttons,
183 .nbuttons = ARRAY_SIZE(qnap_ts409_buttons),
184};
185
186static struct platform_device qnap_ts409_button_device = {
187 .name = "gpio-keys",
188 .id = -1,
189 .num_resources = 0,
190 .dev = {
191 .platform_data = &qnap_ts409_button_data,
192 },
193};
194
195/*****************************************************************************
196 * General Setup
197 ****************************************************************************/
198static struct orion5x_mpp_mode ts409_mpp_modes[] __initdata = {
199 { 0, MPP_UNUSED },
200 { 1, MPP_UNUSED },
201 { 2, MPP_UNUSED },
202 { 3, MPP_UNUSED },
203 { 4, MPP_GPIO }, /* HDD 1 status */
204 { 5, MPP_GPIO }, /* HDD 2 status */
205 { 6, MPP_GPIO }, /* HDD 3 status */
206 { 7, MPP_GPIO }, /* HDD 4 status */
207 { 8, MPP_UNUSED },
208 { 9, MPP_UNUSED },
209 { 10, MPP_GPIO }, /* RTC int */
210 { 11, MPP_UNUSED },
211 { 12, MPP_UNUSED },
212 { 13, MPP_UNUSED },
213 { 14, MPP_GPIO }, /* SW_RST */
214 { 15, MPP_GPIO }, /* USB copy button */
215 { 16, MPP_UART }, /* UART1 RXD */
216 { 17, MPP_UART }, /* UART1 TXD */
217 { 18, MPP_UNUSED },
218 { 19, MPP_UNUSED },
219 { -1 },
220};
221
222static void __init qnap_ts409_init(void)
223{
224 /*
225 * Setup basic Orion functions. Need to be called early.
226 */
227 orion5x_init();
228
229 orion5x_mpp_conf(ts409_mpp_modes);
230
231 /*
232 * Configure peripherals.
233 */
234 orion5x_ehci0_init();
235 qnap_tsx09_find_mac_addr(QNAP_TS409_NOR_BOOT_BASE +
236 qnap_ts409_partitions[5].offset,
237 qnap_ts409_partitions[5].size);
238 orion5x_eth_init(&qnap_tsx09_eth_data);
239 orion5x_i2c_init();
240 orion5x_uart0_init();
241
242 orion5x_setup_dev_boot_win(QNAP_TS409_NOR_BOOT_BASE,
243 QNAP_TS409_NOR_BOOT_SIZE);
244 platform_device_register(&qnap_ts409_nor_flash);
245
246 platform_device_register(&qnap_ts409_button_device);
247
248 /* Get RTC IRQ and register the chip */
249 if (gpio_request(TS409_RTC_GPIO, "rtc") == 0) {
250 if (gpio_direction_input(TS409_RTC_GPIO) == 0)
251 qnap_ts409_i2c_rtc.irq = gpio_to_irq(TS409_RTC_GPIO);
252 else
253 gpio_free(TS409_RTC_GPIO);
254 }
255 if (qnap_ts409_i2c_rtc.irq == 0)
256 pr_warning("qnap_ts409_init: failed to get RTC IRQ\n");
257 i2c_register_board_info(0, &qnap_ts409_i2c_rtc, 1);
258
259 /* register tsx09 specific power-off method */
260 pm_power_off = qnap_tsx09_power_off;
261}
262
263MACHINE_START(TS409, "QNAP TS-409")
264 /* Maintainer: Sylver Bruneau <sylver.bruneau@gmail.com> */
265 .phys_io = ORION5X_REGS_PHYS_BASE,
266 .io_pg_offst = ((ORION5X_REGS_VIRT_BASE) >> 18) & 0xFFFC,
267 .boot_params = 0x00000100,
268 .init_machine = qnap_ts409_init,
269 .map_io = orion5x_map_io,
270 .init_irq = orion5x_init_irq,
271 .timer = &orion5x_timer,
272 .fixup = tag_fixup_mem32,
273MACHINE_END
diff --git a/arch/arm/mach-orion5x/ts78xx-setup.c b/arch/arm/mach-orion5x/ts78xx-setup.c
new file mode 100644
index 000000000000..77e9f351f07a
--- /dev/null
+++ b/arch/arm/mach-orion5x/ts78xx-setup.c
@@ -0,0 +1,277 @@
1/*
2 * arch/arm/mach-orion5x/ts78xx-setup.c
3 *
4 * Maintainer: Alexander Clouter <alex@digriz.org.uk>
5 *
6 * This file is licensed under the terms of the GNU General Public
7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied.
9 */
10
11#include <linux/kernel.h>
12#include <linux/init.h>
13#include <linux/platform_device.h>
14#include <linux/mtd/physmap.h>
15#include <linux/mv643xx_eth.h>
16#include <linux/ata_platform.h>
17#include <linux/m48t86.h>
18#include <asm/mach-types.h>
19#include <asm/mach/arch.h>
20#include <asm/mach/map.h>
21#include <asm/arch/orion5x.h>
22#include "common.h"
23#include "mpp.h"
24
25/*****************************************************************************
26 * TS-78xx Info
27 ****************************************************************************/
28
29/*
30 * FPGA - lives where the PCI bus would be at ORION5X_PCI_MEM_PHYS_BASE
31 */
32#define TS78XX_FPGA_REGS_PHYS_BASE 0xe8000000
33#define TS78XX_FPGA_REGS_VIRT_BASE 0xff900000
34#define TS78XX_FPGA_REGS_SIZE SZ_1M
35
36#define TS78XX_FPGA_REGS_SYSCON_ID (TS78XX_FPGA_REGS_VIRT_BASE | 0x000)
37#define TS78XX_FPGA_REGS_SYSCON_LCDI (TS78XX_FPGA_REGS_VIRT_BASE | 0x004)
38#define TS78XX_FPGA_REGS_SYSCON_LCDO (TS78XX_FPGA_REGS_VIRT_BASE | 0x008)
39
40#define TS78XX_FPGA_REGS_RTC_CTRL (TS78XX_FPGA_REGS_VIRT_BASE | 0x808)
41#define TS78XX_FPGA_REGS_RTC_DATA (TS78XX_FPGA_REGS_VIRT_BASE | 0x80c)
42
43/*
44 * 512kB NOR flash Device
45 */
46#define TS78XX_NOR_BOOT_BASE 0xff800000
47#define TS78XX_NOR_BOOT_SIZE SZ_512K
48
49/*****************************************************************************
50 * I/O Address Mapping
51 ****************************************************************************/
52static struct map_desc ts78xx_io_desc[] __initdata = {
53 {
54 .virtual = TS78XX_FPGA_REGS_VIRT_BASE,
55 .pfn = __phys_to_pfn(TS78XX_FPGA_REGS_PHYS_BASE),
56 .length = TS78XX_FPGA_REGS_SIZE,
57 .type = MT_DEVICE,
58 },
59};
60
61void __init ts78xx_map_io(void)
62{
63 orion5x_map_io();
64 iotable_init(ts78xx_io_desc, ARRAY_SIZE(ts78xx_io_desc));
65}
66
67/*****************************************************************************
68 * 512kB NOR Boot Flash - the chip is a M25P40
69 ****************************************************************************/
70static struct mtd_partition ts78xx_nor_boot_flash_resources[] = {
71 {
72 .name = "ts-bootrom",
73 .offset = 0,
74 /* only the first 256kB is used */
75 .size = SZ_256K,
76 .mask_flags = MTD_WRITEABLE,
77 },
78};
79
80static struct physmap_flash_data ts78xx_nor_boot_flash_data = {
81 .width = 1,
82 .parts = ts78xx_nor_boot_flash_resources,
83 .nr_parts = ARRAY_SIZE(ts78xx_nor_boot_flash_resources),
84};
85
86static struct resource ts78xx_nor_boot_flash_resource = {
87 .flags = IORESOURCE_MEM,
88 .start = TS78XX_NOR_BOOT_BASE,
89 .end = TS78XX_NOR_BOOT_BASE + TS78XX_NOR_BOOT_SIZE - 1,
90};
91
92static struct platform_device ts78xx_nor_boot_flash = {
93 .name = "physmap-flash",
94 .id = -1,
95 .dev = {
96 .platform_data = &ts78xx_nor_boot_flash_data,
97 },
98 .num_resources = 1,
99 .resource = &ts78xx_nor_boot_flash_resource,
100};
101
102/*****************************************************************************
103 * Ethernet
104 ****************************************************************************/
105static struct mv643xx_eth_platform_data ts78xx_eth_data = {
106 .phy_addr = 0,
107 .force_phy_addr = 1,
108};
109
110/*****************************************************************************
111 * RTC M48T86 - nicked^Wborrowed from arch/arm/mach-ep93xx/ts72xx.c
112 ****************************************************************************/
113#ifdef CONFIG_RTC_DRV_M48T86
114static unsigned char ts78xx_rtc_readbyte(unsigned long addr)
115{
116 writeb(addr, TS78XX_FPGA_REGS_RTC_CTRL);
117 return readb(TS78XX_FPGA_REGS_RTC_DATA);
118}
119
120static void ts78xx_rtc_writebyte(unsigned char value, unsigned long addr)
121{
122 writeb(addr, TS78XX_FPGA_REGS_RTC_CTRL);
123 writeb(value, TS78XX_FPGA_REGS_RTC_DATA);
124}
125
126static struct m48t86_ops ts78xx_rtc_ops = {
127 .readbyte = ts78xx_rtc_readbyte,
128 .writebyte = ts78xx_rtc_writebyte,
129};
130
131static struct platform_device ts78xx_rtc_device = {
132 .name = "rtc-m48t86",
133 .id = -1,
134 .dev = {
135 .platform_data = &ts78xx_rtc_ops,
136 },
137 .num_resources = 0,
138};
139
140/*
141 * TS uses some of the user storage space on the RTC chip so see if it is
142 * present; as it's an optional feature at purchase time and not all boards
143 * will have it present
144 *
145 * I've used the method TS use in their rtc7800.c example for the detection
146 *
147 * TODO: track down a guinea pig without an RTC to see if we can work out a
148 * better RTC detection routine
149 */
150static int __init ts78xx_rtc_init(void)
151{
152 unsigned char tmp_rtc0, tmp_rtc1;
153
154 tmp_rtc0 = ts78xx_rtc_readbyte(126);
155 tmp_rtc1 = ts78xx_rtc_readbyte(127);
156
157 ts78xx_rtc_writebyte(0x00, 126);
158 ts78xx_rtc_writebyte(0x55, 127);
159 if (ts78xx_rtc_readbyte(127) == 0x55) {
160 ts78xx_rtc_writebyte(0xaa, 127);
161 if (ts78xx_rtc_readbyte(127) == 0xaa
162 && ts78xx_rtc_readbyte(126) == 0x00) {
163 ts78xx_rtc_writebyte(tmp_rtc0, 126);
164 ts78xx_rtc_writebyte(tmp_rtc1, 127);
165 platform_device_register(&ts78xx_rtc_device);
166 return 1;
167 }
168 }
169
170 return 0;
171};
172#else
173static int __init ts78xx_rtc_init(void)
174{
175 return 0;
176}
177#endif
178
179/*****************************************************************************
180 * SATA
181 ****************************************************************************/
182static struct mv_sata_platform_data ts78xx_sata_data = {
183 .n_ports = 2,
184};
185
186/*****************************************************************************
187 * print some information regarding the board
188 ****************************************************************************/
189static void __init ts78xx_print_board_id(void)
190{
191 unsigned int board_info;
192
193 board_info = readl(TS78XX_FPGA_REGS_SYSCON_ID);
194 printk(KERN_INFO "TS-78xx Info: FPGA rev=%.2x, Board Magic=%.6x, ",
195 board_info & 0xff,
196 (board_info >> 8) & 0xffffff);
197 board_info = readl(TS78XX_FPGA_REGS_SYSCON_LCDI);
198 printk("JP1=%d, JP2=%d\n",
199 (board_info >> 30) & 0x1,
200 (board_info >> 31) & 0x1);
201};
202
203/*****************************************************************************
204 * General Setup
205 ****************************************************************************/
206static struct orion5x_mpp_mode ts78xx_mpp_modes[] __initdata = {
207 { 0, MPP_UNUSED },
208 { 1, MPP_GPIO }, /* JTAG Clock */
209 { 2, MPP_GPIO }, /* JTAG Data In */
210 { 3, MPP_GPIO }, /* Lat ECP2 256 FPGA - PB2B */
211 { 4, MPP_GPIO }, /* JTAG Data Out */
212 { 5, MPP_GPIO }, /* JTAG TMS */
213 { 6, MPP_GPIO }, /* Lat ECP2 256 FPGA - PB31A_CLK4+ */
214 { 7, MPP_GPIO }, /* Lat ECP2 256 FPGA - PB22B */
215 { 8, MPP_UNUSED },
216 { 9, MPP_UNUSED },
217 { 10, MPP_UNUSED },
218 { 11, MPP_UNUSED },
219 { 12, MPP_UNUSED },
220 { 13, MPP_UNUSED },
221 { 14, MPP_UNUSED },
222 { 15, MPP_UNUSED },
223 { 16, MPP_UART },
224 { 17, MPP_UART },
225 { 18, MPP_UART },
226 { 19, MPP_UART },
227 { -1 },
228};
229
230static void __init ts78xx_init(void)
231{
232 /*
233 * Setup basic Orion functions. Need to be called early.
234 */
235 orion5x_init();
236
237 ts78xx_print_board_id();
238
239 orion5x_mpp_conf(ts78xx_mpp_modes);
240
241 /*
242 * MPP[20] PCI Clock Out 1
243 * MPP[21] PCI Clock Out 0
244 * MPP[22] Unused
245 * MPP[23] Unused
246 * MPP[24] Unused
247 * MPP[25] Unused
248 */
249
250 /*
251 * Configure peripherals.
252 */
253 orion5x_ehci0_init();
254 orion5x_ehci1_init();
255 orion5x_eth_init(&ts78xx_eth_data);
256 orion5x_sata_init(&ts78xx_sata_data);
257 orion5x_uart0_init();
258 orion5x_uart1_init();
259
260 orion5x_setup_dev_boot_win(TS78XX_NOR_BOOT_BASE,
261 TS78XX_NOR_BOOT_SIZE);
262 platform_device_register(&ts78xx_nor_boot_flash);
263
264 if (!ts78xx_rtc_init())
265 printk(KERN_INFO "TS-78xx RTC not detected or enabled\n");
266}
267
268MACHINE_START(TS78XX, "Technologic Systems TS-78xx SBC")
269 /* Maintainer: Alexander Clouter <alex@digriz.org.uk> */
270 .phys_io = ORION5X_REGS_PHYS_BASE,
271 .io_pg_offst = ((ORION5X_REGS_VIRT_BASE) >> 18) & 0xFFFC,
272 .boot_params = 0x00000100,
273 .init_machine = ts78xx_init,
274 .map_io = ts78xx_map_io,
275 .init_irq = orion5x_init_irq,
276 .timer = &orion5x_timer,
277MACHINE_END
diff --git a/arch/arm/mach-orion5x/tsx09-common.c b/arch/arm/mach-orion5x/tsx09-common.c
new file mode 100644
index 000000000000..83feac3147a6
--- /dev/null
+++ b/arch/arm/mach-orion5x/tsx09-common.c
@@ -0,0 +1,133 @@
1/*
2 * QNAP TS-x09 Boards common functions
3 *
4 * Maintainers: Lennert Buytenhek <buytenh@marvell.com>
5 * Byron Bradley <byron.bbradley@gmail.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; either version
10 * 2 of the License, or (at your option) any later version.
11 */
12
13#include <linux/kernel.h>
14#include <linux/pci.h>
15#include <linux/mv643xx_eth.h>
16#include <linux/timex.h>
17#include <linux/serial_reg.h>
18#include "tsx09-common.h"
19
20/*****************************************************************************
21 * QNAP TS-x09 specific power off method via UART1-attached PIC
22 ****************************************************************************/
23
24#define UART1_REG(x) (UART1_VIRT_BASE + ((UART_##x) << 2))
25
26void qnap_tsx09_power_off(void)
27{
28 /* 19200 baud divisor */
29 const unsigned divisor = ((ORION5X_TCLK + (8 * 19200)) / (16 * 19200));
30
31 pr_info("%s: triggering power-off...\n", __func__);
32
33 /* hijack uart1 and reset into sane state (19200,8n1) */
34 writel(0x83, UART1_REG(LCR));
35 writel(divisor & 0xff, UART1_REG(DLL));
36 writel((divisor >> 8) & 0xff, UART1_REG(DLM));
37 writel(0x03, UART1_REG(LCR));
38 writel(0x00, UART1_REG(IER));
39 writel(0x00, UART1_REG(FCR));
40 writel(0x00, UART1_REG(MCR));
41
42 /* send the power-off command 'A' to PIC */
43 writel('A', UART1_REG(TX));
44}
45
46/*****************************************************************************
47 * Ethernet
48 ****************************************************************************/
49
50struct mv643xx_eth_platform_data qnap_tsx09_eth_data = {
51 .phy_addr = 8,
52};
53
54static int __init qnap_tsx09_parse_hex_nibble(char n)
55{
56 if (n >= '0' && n <= '9')
57 return n - '0';
58
59 if (n >= 'A' && n <= 'F')
60 return n - 'A' + 10;
61
62 if (n >= 'a' && n <= 'f')
63 return n - 'a' + 10;
64
65 return -1;
66}
67
68static int __init qnap_tsx09_parse_hex_byte(const char *b)
69{
70 int hi;
71 int lo;
72
73 hi = qnap_tsx09_parse_hex_nibble(b[0]);
74 lo = qnap_tsx09_parse_hex_nibble(b[1]);
75
76 if (hi < 0 || lo < 0)
77 return -1;
78
79 return (hi << 4) | lo;
80}
81
82static int __init qnap_tsx09_check_mac_addr(const char *addr_str)
83{
84 u_int8_t addr[6];
85 int i;
86
87 for (i = 0; i < 6; i++) {
88 int byte;
89
90 /*
91 * Enforce "xx:xx:xx:xx:xx:xx\n" format.
92 */
93 if (addr_str[(i * 3) + 2] != ((i < 5) ? ':' : '\n'))
94 return -1;
95
96 byte = qnap_tsx09_parse_hex_byte(addr_str + (i * 3));
97 if (byte < 0)
98 return -1;
99 addr[i] = byte;
100 }
101
102 printk(KERN_INFO "tsx09: found ethernet mac address ");
103 for (i = 0; i < 6; i++)
104 printk("%.2x%s", addr[i], (i < 5) ? ":" : ".\n");
105
106 memcpy(qnap_tsx09_eth_data.mac_addr, addr, 6);
107
108 return 0;
109}
110
111/*
112 * The 'NAS Config' flash partition has an ext2 filesystem which
113 * contains a file that has the ethernet MAC address in plain text
114 * (format "xx:xx:xx:xx:xx:xx\n").
115 */
116void __init qnap_tsx09_find_mac_addr(u32 mem_base, u32 size)
117{
118 unsigned long addr;
119
120 for (addr = mem_base; addr < (mem_base + size); addr += 1024) {
121 char *nor_page;
122 int ret = 0;
123
124 nor_page = ioremap(addr, 1024);
125 if (nor_page != NULL) {
126 ret = qnap_tsx09_check_mac_addr(nor_page);
127 iounmap(nor_page);
128 }
129
130 if (ret == 0)
131 break;
132 }
133}
diff --git a/arch/arm/mach-orion5x/tsx09-common.h b/arch/arm/mach-orion5x/tsx09-common.h
new file mode 100644
index 000000000000..0984264616f0
--- /dev/null
+++ b/arch/arm/mach-orion5x/tsx09-common.h
@@ -0,0 +1,20 @@
1#ifndef __ARCH_ORION5X_TSX09_COMMON_H
2#define __ARCH_ORION5X_TSX09_COMMON_H
3
4/*
5 * QNAP TS-x09 Boards power-off function
6 */
7extern void qnap_tsx09_power_off(void);
8
9/*
10 * QNAP TS-x09 Boards function to find Ethernet MAC address in flash memory
11 */
12extern void __init qnap_tsx09_find_mac_addr(u32 mem_base, u32 size);
13
14/*
15 * QNAP TS-x09 Boards ethernet declaration
16 */
17extern struct mv643xx_eth_platform_data qnap_tsx09_eth_data;
18
19
20#endif
diff --git a/arch/arm/mach-orion5x/wnr854t-setup.c b/arch/arm/mach-orion5x/wnr854t-setup.c
new file mode 100644
index 000000000000..1af093ff8cf3
--- /dev/null
+++ b/arch/arm/mach-orion5x/wnr854t-setup.c
@@ -0,0 +1,164 @@
1/*
2 * arch/arm/mach-orion5x/wnr854t-setup.c
3 *
4 * This file is licensed under the terms of the GNU General Public
5 * License version 2. This program is licensed "as is" without any
6 * warranty of any kind, whether express or implied.
7 */
8
9#include <linux/kernel.h>
10#include <linux/init.h>
11#include <linux/platform_device.h>
12#include <linux/pci.h>
13#include <linux/irq.h>
14#include <linux/delay.h>
15#include <linux/mtd/physmap.h>
16#include <linux/mv643xx_eth.h>
17#include <asm/mach-types.h>
18#include <asm/gpio.h>
19#include <asm/mach/arch.h>
20#include <asm/mach/pci.h>
21#include <asm/arch/orion5x.h>
22#include "common.h"
23#include "mpp.h"
24
25static struct orion5x_mpp_mode wnr854t_mpp_modes[] __initdata = {
26 { 0, MPP_GPIO }, /* Power LED green (0=on) */
27 { 1, MPP_GPIO }, /* Reset Button (0=off) */
28 { 2, MPP_GPIO }, /* Power LED blink (0=off) */
29 { 3, MPP_GPIO }, /* WAN Status LED amber (0=off) */
30 { 4, MPP_GPIO }, /* PCI int */
31 { 5, MPP_GPIO }, /* ??? */
32 { 6, MPP_GPIO }, /* ??? */
33 { 7, MPP_GPIO }, /* ??? */
34 { 8, MPP_UNUSED }, /* ??? */
35 { 9, MPP_GIGE }, /* GE_RXERR */
36 { 10, MPP_UNUSED }, /* ??? */
37 { 11, MPP_UNUSED }, /* ??? */
38 { 12, MPP_GIGE }, /* GE_TXD[4] */
39 { 13, MPP_GIGE }, /* GE_TXD[5] */
40 { 14, MPP_GIGE }, /* GE_TXD[6] */
41 { 15, MPP_GIGE }, /* GE_TXD[7] */
42 { 16, MPP_GIGE }, /* GE_RXD[4] */
43 { 17, MPP_GIGE }, /* GE_RXD[5] */
44 { 18, MPP_GIGE }, /* GE_RXD[6] */
45 { 19, MPP_GIGE }, /* GE_RXD[7] */
46 { -1 },
47};
48
49/*
50 * 8M NOR flash Device bus boot chip select
51 */
52#define WNR854T_NOR_BOOT_BASE 0xf4000000
53#define WNR854T_NOR_BOOT_SIZE SZ_8M
54
55static struct mtd_partition wnr854t_nor_flash_partitions[] = {
56 {
57 .name = "kernel",
58 .offset = 0x00000000,
59 .size = 0x00100000,
60 }, {
61 .name = "rootfs",
62 .offset = 0x00100000,
63 .size = 0x00660000,
64 }, {
65 .name = "uboot",
66 .offset = 0x00760000,
67 .size = 0x00040000,
68 },
69};
70
71static struct physmap_flash_data wnr854t_nor_flash_data = {
72 .width = 2,
73 .parts = wnr854t_nor_flash_partitions,
74 .nr_parts = ARRAY_SIZE(wnr854t_nor_flash_partitions),
75};
76
77static struct resource wnr854t_nor_flash_resource = {
78 .flags = IORESOURCE_MEM,
79 .start = WNR854T_NOR_BOOT_BASE,
80 .end = WNR854T_NOR_BOOT_BASE + WNR854T_NOR_BOOT_SIZE - 1,
81};
82
83static struct platform_device wnr854t_nor_flash = {
84 .name = "physmap-flash",
85 .id = 0,
86 .dev = {
87 .platform_data = &wnr854t_nor_flash_data,
88 },
89 .num_resources = 1,
90 .resource = &wnr854t_nor_flash_resource,
91};
92
93static struct mv643xx_eth_platform_data wnr854t_eth_data = {
94 .phy_addr = -1,
95};
96
97static void __init wnr854t_init(void)
98{
99 /*
100 * Setup basic Orion functions. Need to be called early.
101 */
102 orion5x_init();
103
104 orion5x_mpp_conf(wnr854t_mpp_modes);
105
106 /*
107 * Configure peripherals.
108 */
109 orion5x_eth_init(&wnr854t_eth_data);
110 orion5x_uart0_init();
111
112 orion5x_setup_dev_boot_win(WNR854T_NOR_BOOT_BASE,
113 WNR854T_NOR_BOOT_SIZE);
114 platform_device_register(&wnr854t_nor_flash);
115}
116
117static int __init wnr854t_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
118{
119 int irq;
120
121 /*
122 * Check for devices with hard-wired IRQs.
123 */
124 irq = orion5x_pci_map_irq(dev, slot, pin);
125 if (irq != -1)
126 return irq;
127
128 /*
129 * Mini-PCI slot.
130 */
131 if (slot == 7)
132 return gpio_to_irq(4);
133
134 return -1;
135}
136
137static struct hw_pci wnr854t_pci __initdata = {
138 .nr_controllers = 2,
139 .swizzle = pci_std_swizzle,
140 .setup = orion5x_pci_sys_setup,
141 .scan = orion5x_pci_sys_scan_bus,
142 .map_irq = wnr854t_pci_map_irq,
143};
144
145static int __init wnr854t_pci_init(void)
146{
147 if (machine_is_wnr854t())
148 pci_common_init(&wnr854t_pci);
149
150 return 0;
151}
152subsys_initcall(wnr854t_pci_init);
153
154MACHINE_START(WNR854T, "Netgear WNR854T")
155 /* Maintainer: Imre Kaloz <kaloz@openwrt.org> */
156 .phys_io = ORION5X_REGS_PHYS_BASE,
157 .io_pg_offst = ((ORION5X_REGS_VIRT_BASE) >> 18) & 0xFFFC,
158 .boot_params = 0x00000100,
159 .init_machine = wnr854t_init,
160 .map_io = orion5x_map_io,
161 .init_irq = orion5x_init_irq,
162 .timer = &orion5x_timer,
163 .fixup = tag_fixup_mem32,
164MACHINE_END
diff --git a/arch/arm/mach-orion5x/wrt350n-v2-setup.c b/arch/arm/mach-orion5x/wrt350n-v2-setup.c
new file mode 100644
index 000000000000..aeab55c6a82d
--- /dev/null
+++ b/arch/arm/mach-orion5x/wrt350n-v2-setup.c
@@ -0,0 +1,173 @@
1/*
2 * arch/arm/mach-orion5x/wrt350n-v2-setup.c
3 *
4 * This file is licensed under the terms of the GNU General Public
5 * License version 2. This program is licensed "as is" without any
6 * warranty of any kind, whether express or implied.
7 */
8
9#include <linux/kernel.h>
10#include <linux/init.h>
11#include <linux/platform_device.h>
12#include <linux/pci.h>
13#include <linux/irq.h>
14#include <linux/delay.h>
15#include <linux/mtd/physmap.h>
16#include <linux/mv643xx_eth.h>
17#include <asm/mach-types.h>
18#include <asm/gpio.h>
19#include <asm/mach/arch.h>
20#include <asm/mach/pci.h>
21#include <asm/arch/orion5x.h>
22#include "common.h"
23#include "mpp.h"
24
25static struct orion5x_mpp_mode wrt350n_v2_mpp_modes[] __initdata = {
26 { 0, MPP_GPIO }, /* Power LED green (0=on) */
27 { 1, MPP_GPIO }, /* Security LED (0=on) */
28 { 2, MPP_GPIO }, /* Internal Button (0=on) */
29 { 3, MPP_GPIO }, /* Reset Button (0=on) */
30 { 4, MPP_GPIO }, /* PCI int */
31 { 5, MPP_GPIO }, /* Power LED orange (0=on) */
32 { 6, MPP_GPIO }, /* USB LED (0=on) */
33 { 7, MPP_GPIO }, /* Wireless LED (0=on) */
34 { 8, MPP_UNUSED }, /* ??? */
35 { 9, MPP_GIGE }, /* GE_RXERR */
36 { 10, MPP_UNUSED }, /* ??? */
37 { 11, MPP_UNUSED }, /* ??? */
38 { 12, MPP_GIGE }, /* GE_TXD[4] */
39 { 13, MPP_GIGE }, /* GE_TXD[5] */
40 { 14, MPP_GIGE }, /* GE_TXD[6] */
41 { 15, MPP_GIGE }, /* GE_TXD[7] */
42 { 16, MPP_GIGE }, /* GE_RXD[4] */
43 { 17, MPP_GIGE }, /* GE_RXD[5] */
44 { 18, MPP_GIGE }, /* GE_RXD[6] */
45 { 19, MPP_GIGE }, /* GE_RXD[7] */
46 { -1 },
47};
48
49/*
50 * 8M NOR flash Device bus boot chip select
51 */
52#define WRT350N_V2_NOR_BOOT_BASE 0xf4000000
53#define WRT350N_V2_NOR_BOOT_SIZE SZ_8M
54
55static struct mtd_partition wrt350n_v2_nor_flash_partitions[] = {
56 {
57 .name = "kernel",
58 .offset = 0x00000000,
59 .size = 0x00760000,
60 }, {
61 .name = "rootfs",
62 .offset = 0x001a0000,
63 .size = 0x005c0000,
64 }, {
65 .name = "lang",
66 .offset = 0x00760000,
67 .size = 0x00040000,
68 }, {
69 .name = "nvram",
70 .offset = 0x007a0000,
71 .size = 0x00020000,
72 }, {
73 .name = "u-boot",
74 .offset = 0x007c0000,
75 .size = 0x00040000,
76 },
77};
78
79static struct physmap_flash_data wrt350n_v2_nor_flash_data = {
80 .width = 1,
81 .parts = wrt350n_v2_nor_flash_partitions,
82 .nr_parts = ARRAY_SIZE(wrt350n_v2_nor_flash_partitions),
83};
84
85static struct resource wrt350n_v2_nor_flash_resource = {
86 .flags = IORESOURCE_MEM,
87 .start = WRT350N_V2_NOR_BOOT_BASE,
88 .end = WRT350N_V2_NOR_BOOT_BASE + WRT350N_V2_NOR_BOOT_SIZE - 1,
89};
90
91static struct platform_device wrt350n_v2_nor_flash = {
92 .name = "physmap-flash",
93 .id = 0,
94 .dev = {
95 .platform_data = &wrt350n_v2_nor_flash_data,
96 },
97 .num_resources = 1,
98 .resource = &wrt350n_v2_nor_flash_resource,
99};
100
101static struct mv643xx_eth_platform_data wrt350n_v2_eth_data = {
102 .phy_addr = -1,
103};
104
105static void __init wrt350n_v2_init(void)
106{
107 /*
108 * Setup basic Orion functions. Need to be called early.
109 */
110 orion5x_init();
111
112 orion5x_mpp_conf(wrt350n_v2_mpp_modes);
113
114 /*
115 * Configure peripherals.
116 */
117 orion5x_ehci0_init();
118 orion5x_eth_init(&wrt350n_v2_eth_data);
119 orion5x_uart0_init();
120
121 orion5x_setup_dev_boot_win(WRT350N_V2_NOR_BOOT_BASE,
122 WRT350N_V2_NOR_BOOT_SIZE);
123 platform_device_register(&wrt350n_v2_nor_flash);
124}
125
126static int __init wrt350n_v2_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
127{
128 int irq;
129
130 /*
131 * Check for devices with hard-wired IRQs.
132 */
133 irq = orion5x_pci_map_irq(dev, slot, pin);
134 if (irq != -1)
135 return irq;
136
137 /*
138 * Mini-PCI slot.
139 */
140 if (slot == 7)
141 return gpio_to_irq(4);
142
143 return -1;
144}
145
146static struct hw_pci wrt350n_v2_pci __initdata = {
147 .nr_controllers = 2,
148 .swizzle = pci_std_swizzle,
149 .setup = orion5x_pci_sys_setup,
150 .scan = orion5x_pci_sys_scan_bus,
151 .map_irq = wrt350n_v2_pci_map_irq,
152};
153
154static int __init wrt350n_v2_pci_init(void)
155{
156 if (machine_is_wrt350n_v2())
157 pci_common_init(&wrt350n_v2_pci);
158
159 return 0;
160}
161subsys_initcall(wrt350n_v2_pci_init);
162
163MACHINE_START(WRT350N_V2, "Linksys WRT350N v2")
164 /* Maintainer: Lennert Buytenhek <buytenh@marvell.com> */
165 .phys_io = ORION5X_REGS_PHYS_BASE,
166 .io_pg_offst = ((ORION5X_REGS_VIRT_BASE) >> 18) & 0xFFFC,
167 .boot_params = 0x00000100,
168 .init_machine = wrt350n_v2_init,
169 .map_io = orion5x_map_io,
170 .init_irq = orion5x_init_irq,
171 .timer = &orion5x_timer,
172 .fixup = tag_fixup_mem32,
173MACHINE_END
diff --git a/arch/arm/mach-realview/platsmp.c b/arch/arm/mach-realview/platsmp.c
index 3e57428affee..8e813ed57519 100644
--- a/arch/arm/mach-realview/platsmp.c
+++ b/arch/arm/mach-realview/platsmp.c
@@ -74,6 +74,8 @@ static DEFINE_SPINLOCK(boot_lock);
74 74
75void __cpuinit platform_secondary_init(unsigned int cpu) 75void __cpuinit platform_secondary_init(unsigned int cpu)
76{ 76{
77 trace_hardirqs_off();
78
77 /* 79 /*
78 * the primary core may have used a "cross call" soft interrupt 80 * the primary core may have used a "cross call" soft interrupt
79 * to get this processor out of WFI in the BootMonitor - make 81 * to get this processor out of WFI in the BootMonitor - make
diff --git a/arch/arm/mach-s3c2410/Kconfig b/arch/arm/mach-s3c2410/Kconfig
index cd3dc0834b3b..99fdc736698c 100644
--- a/arch/arm/mach-s3c2410/Kconfig
+++ b/arch/arm/mach-s3c2410/Kconfig
@@ -37,6 +37,17 @@ config S3C2410_CLOCK
37 help 37 help
38 Clock code for the S3C2410, and similar processors 38 Clock code for the S3C2410, and similar processors
39 39
40config SIMTEC_NOR
41 bool
42 help
43 Internal node to specify machine has simtec NOR mapping
44
45config MACH_BAST_IDE
46 bool
47 select HAVE_PATA_PLATFORM
48 help
49 Internal node for machines with an BAST style IDE
50 interface
40 51
41menu "S3C2410 Machines" 52menu "S3C2410 Machines"
42 53
@@ -61,15 +72,18 @@ config PM_H1940
61 Internal node for H1940 and related PM 72 Internal node for H1940 and related PM
62 73
63config MACH_N30 74config MACH_N30
64 bool "Acer N30" 75 bool "Acer N30 family"
65 select CPU_S3C2410 76 select CPU_S3C2410
66 help 77 help
67 Say Y here if you are using the Acer N30 78 Say Y here if you want suppt for the Acer N30, Acer N35,
79 Navman PiN570, Yakumo AlphaX or Airis NC05 PDAs.
68 80
69config ARCH_BAST 81config ARCH_BAST
70 bool "Simtec Electronics BAST (EB2410ITX)" 82 bool "Simtec Electronics BAST (EB2410ITX)"
71 select CPU_S3C2410 83 select CPU_S3C2410
72 select PM_SIMTEC if PM 84 select PM_SIMTEC if PM
85 select SIMTEC_NOR
86 select MACH_BAST_IDE
73 select ISA 87 select ISA
74 help 88 help
75 Say Y here if you are using the Simtec Electronics EB2410ITX 89 Say Y here if you are using the Simtec Electronics EB2410ITX
@@ -107,6 +121,8 @@ config MACH_TCT_HAMMER
107config MACH_VR1000 121config MACH_VR1000
108 bool "Thorcom VR1000" 122 bool "Thorcom VR1000"
109 select PM_SIMTEC if PM 123 select PM_SIMTEC if PM
124 select SIMTEC_NOR
125 select MACH_BAST_IDE
110 select CPU_S3C2410 126 select CPU_S3C2410
111 help 127 help
112 Say Y here if you are using the Thorcom VR1000 board. 128 Say Y here if you are using the Thorcom VR1000 board.
@@ -118,4 +134,3 @@ config MACH_QT2410
118 Say Y here if you are using the Armzone QT2410 134 Say Y here if you are using the Armzone QT2410
119 135
120endmenu 136endmenu
121
diff --git a/arch/arm/mach-s3c2410/Makefile b/arch/arm/mach-s3c2410/Makefile
index cabc13ce09e4..00f31f8c4e78 100644
--- a/arch/arm/mach-s3c2410/Makefile
+++ b/arch/arm/mach-s3c2410/Makefile
@@ -30,3 +30,11 @@ obj-$(CONFIG_BAST_PC104_IRQ) += bast-irq.o
30obj-$(CONFIG_MACH_TCT_HAMMER) += mach-tct_hammer.o 30obj-$(CONFIG_MACH_TCT_HAMMER) += mach-tct_hammer.o
31obj-$(CONFIG_MACH_VR1000) += mach-vr1000.o usb-simtec.o 31obj-$(CONFIG_MACH_VR1000) += mach-vr1000.o usb-simtec.o
32obj-$(CONFIG_MACH_QT2410) += mach-qt2410.o 32obj-$(CONFIG_MACH_QT2410) += mach-qt2410.o
33
34# Common bits of machine support
35
36obj-$(CONFIG_SIMTEC_NOR) += nor-simtec.o
37
38# machine additions
39
40obj-$(CONFIG_MACH_BAST_IDE) += bast-ide.o
diff --git a/arch/arm/mach-s3c2410/bast-ide.c b/arch/arm/mach-s3c2410/bast-ide.c
new file mode 100644
index 000000000000..df95fe37cdc8
--- /dev/null
+++ b/arch/arm/mach-s3c2410/bast-ide.c
@@ -0,0 +1,112 @@
1/* linux/arch/arm/mach-s3c2410/bast-ide.c
2 *
3 * Copyright 2007 Simtec Electronics
4 * http://www.simtec.co.uk/products/EB2410ITX/
5 * http://armlinux.simtec.co.uk/
6 * Ben Dooks <ben@simtec.co.uk>
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#include <linux/kernel.h>
14#include <linux/types.h>
15#include <linux/init.h>
16#include <linux/interrupt.h>
17
18#include <linux/platform_device.h>
19#include <linux/ata_platform.h>
20
21#include <asm/mach-types.h>
22
23#include <asm/mach/arch.h>
24#include <asm/mach/map.h>
25#include <asm/mach/irq.h>
26
27#include <asm/arch/map.h>
28#include <asm/arch/bast-map.h>
29#include <asm/arch/bast-irq.h>
30
31/* IDE ports */
32
33static struct pata_platform_info bast_ide_platdata = {
34 .ioport_shift = 5,
35};
36
37#define IDE_CS S3C2410_CS5
38
39static struct resource bast_ide0_resource[] = {
40 [0] = {
41 .start = IDE_CS + BAST_PA_IDEPRI,
42 .end = IDE_CS + BAST_PA_IDEPRI + (8 * 0x20) - 1,
43 .flags = IORESOURCE_MEM,
44 },
45 [1] = {
46 .start = IDE_CS + BAST_PA_IDEPRIAUX + (6 * 0x20) ,
47 .end = IDE_CS + BAST_PA_IDEPRIAUX + (7 * 0x20) - 1,
48 .flags = IORESOURCE_MEM,
49 },
50 [2] = {
51 .start = IRQ_IDE0,
52 .end = IRQ_IDE0,
53 .flags = IORESOURCE_IRQ,
54 },
55};
56
57static struct platform_device bast_device_ide0 = {
58 .name = "pata_platform",
59 .id = 0,
60 .num_resources = ARRAY_SIZE(bast_ide0_resource),
61 .resource = bast_ide0_resource,
62 .dev = {
63 .platform_data = &bast_ide_platdata,
64 .coherent_dma_mask = ~0,
65 }
66
67};
68
69static struct resource bast_ide1_resource[] = {
70 [0] = {
71 .start = IDE_CS + BAST_PA_IDESEC,
72 .end = IDE_CS + BAST_PA_IDESEC + (8 * 0x20) - 1,
73 .flags = IORESOURCE_MEM,
74 },
75 [1] = {
76 .start = IDE_CS + BAST_PA_IDESECAUX + (6 * 0x20),
77 .end = IDE_CS + BAST_PA_IDESECAUX + (7 * 0x20) - 1,
78 .flags = IORESOURCE_MEM,
79 },
80 [2] = {
81 .start = IRQ_IDE1,
82 .end = IRQ_IDE1,
83 .flags = IORESOURCE_IRQ,
84 },
85};
86
87static struct platform_device bast_device_ide1 = {
88 .name = "pata_platform",
89 .id = 1,
90 .num_resources = ARRAY_SIZE(bast_ide1_resource),
91 .resource = bast_ide1_resource,
92 .dev = {
93 .platform_data = &bast_ide_platdata,
94 .coherent_dma_mask = ~0,
95 }
96};
97
98static struct platform_device *bast_ide_devices[] __initdata = {
99 &bast_device_ide0,
100 &bast_device_ide1,
101};
102
103static __init int bast_ide_init(void)
104{
105 if (machine_is_bast() || machine_is_vr1000())
106 return platform_add_devices(bast_ide_devices,
107 ARRAY_SIZE(bast_ide_devices));
108
109 return 0;
110}
111
112fs_initcall(bast_ide_init);
diff --git a/arch/arm/mach-s3c2410/mach-bast.c b/arch/arm/mach-s3c2410/mach-bast.c
index 27f63d5d3a7b..965f27129707 100644
--- a/arch/arm/mach-s3c2410/mach-bast.c
+++ b/arch/arm/mach-s3c2410/mach-bast.c
@@ -1,6 +1,6 @@
1/* linux/arch/arm/mach-s3c2410/mach-bast.c 1/* linux/arch/arm/mach-s3c2410/mach-bast.c
2 * 2 *
3 * Copyright (c) 2003-2005 Simtec Electronics 3 * Copyright (c) 2003-2005,2008 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk> 4 * Ben Dooks <ben@simtec.co.uk>
5 * 5 *
6 * http://www.simtec.co.uk/products/EB2410ITX/ 6 * http://www.simtec.co.uk/products/EB2410ITX/
@@ -20,6 +20,8 @@
20#include <linux/serial_core.h> 20#include <linux/serial_core.h>
21#include <linux/platform_device.h> 21#include <linux/platform_device.h>
22#include <linux/dm9000.h> 22#include <linux/dm9000.h>
23#include <linux/ata_platform.h>
24#include <linux/i2c.h>
23 25
24#include <net/ax88796.h> 26#include <net/ax88796.h>
25 27
@@ -56,7 +58,9 @@
56#include <asm/plat-s3c24xx/clock.h> 58#include <asm/plat-s3c24xx/clock.h>
57#include <asm/plat-s3c24xx/devs.h> 59#include <asm/plat-s3c24xx/devs.h>
58#include <asm/plat-s3c24xx/cpu.h> 60#include <asm/plat-s3c24xx/cpu.h>
61
59#include "usb-simtec.h" 62#include "usb-simtec.h"
63#include "nor-simtec.h"
60 64
61#define COPYRIGHT ", (c) 2004-2005 Simtec Electronics" 65#define COPYRIGHT ", (c) 2004-2005 Simtec Electronics"
62 66
@@ -134,37 +138,21 @@ static struct map_desc bast_iodesc[] __initdata = {
134 { VA_C2(BAST_VA_ISAIO), PA_CS2(BAST_PA_ISAIO), SZ_16M, MT_DEVICE }, 138 { VA_C2(BAST_VA_ISAIO), PA_CS2(BAST_PA_ISAIO), SZ_16M, MT_DEVICE },
135 { VA_C2(BAST_VA_ISAMEM), PA_CS2(BAST_PA_ISAMEM), SZ_16M, MT_DEVICE }, 139 { VA_C2(BAST_VA_ISAMEM), PA_CS2(BAST_PA_ISAMEM), SZ_16M, MT_DEVICE },
136 { VA_C2(BAST_VA_SUPERIO), PA_CS2(BAST_PA_SUPERIO), SZ_1M, MT_DEVICE }, 140 { VA_C2(BAST_VA_SUPERIO), PA_CS2(BAST_PA_SUPERIO), SZ_1M, MT_DEVICE },
137 { VA_C2(BAST_VA_IDEPRI), PA_CS3(BAST_PA_IDEPRI), SZ_1M, MT_DEVICE },
138 { VA_C2(BAST_VA_IDESEC), PA_CS3(BAST_PA_IDESEC), SZ_1M, MT_DEVICE },
139 { VA_C2(BAST_VA_IDEPRIAUX), PA_CS3(BAST_PA_IDEPRIAUX), SZ_1M, MT_DEVICE },
140 { VA_C2(BAST_VA_IDESECAUX), PA_CS3(BAST_PA_IDESECAUX), SZ_1M, MT_DEVICE },
141 141
142 /* slow, word */ 142 /* slow, word */
143 { VA_C3(BAST_VA_ISAIO), PA_CS3(BAST_PA_ISAIO), SZ_16M, MT_DEVICE }, 143 { VA_C3(BAST_VA_ISAIO), PA_CS3(BAST_PA_ISAIO), SZ_16M, MT_DEVICE },
144 { VA_C3(BAST_VA_ISAMEM), PA_CS3(BAST_PA_ISAMEM), SZ_16M, MT_DEVICE }, 144 { VA_C3(BAST_VA_ISAMEM), PA_CS3(BAST_PA_ISAMEM), SZ_16M, MT_DEVICE },
145 { VA_C3(BAST_VA_SUPERIO), PA_CS3(BAST_PA_SUPERIO), SZ_1M, MT_DEVICE }, 145 { VA_C3(BAST_VA_SUPERIO), PA_CS3(BAST_PA_SUPERIO), SZ_1M, MT_DEVICE },
146 { VA_C3(BAST_VA_IDEPRI), PA_CS3(BAST_PA_IDEPRI), SZ_1M, MT_DEVICE },
147 { VA_C3(BAST_VA_IDESEC), PA_CS3(BAST_PA_IDESEC), SZ_1M, MT_DEVICE },
148 { VA_C3(BAST_VA_IDEPRIAUX), PA_CS3(BAST_PA_IDEPRIAUX), SZ_1M, MT_DEVICE },
149 { VA_C3(BAST_VA_IDESECAUX), PA_CS3(BAST_PA_IDESECAUX), SZ_1M, MT_DEVICE },
150 146
151 /* fast, byte */ 147 /* fast, byte */
152 { VA_C4(BAST_VA_ISAIO), PA_CS4(BAST_PA_ISAIO), SZ_16M, MT_DEVICE }, 148 { VA_C4(BAST_VA_ISAIO), PA_CS4(BAST_PA_ISAIO), SZ_16M, MT_DEVICE },
153 { VA_C4(BAST_VA_ISAMEM), PA_CS4(BAST_PA_ISAMEM), SZ_16M, MT_DEVICE }, 149 { VA_C4(BAST_VA_ISAMEM), PA_CS4(BAST_PA_ISAMEM), SZ_16M, MT_DEVICE },
154 { VA_C4(BAST_VA_SUPERIO), PA_CS4(BAST_PA_SUPERIO), SZ_1M, MT_DEVICE }, 150 { VA_C4(BAST_VA_SUPERIO), PA_CS4(BAST_PA_SUPERIO), SZ_1M, MT_DEVICE },
155 { VA_C4(BAST_VA_IDEPRI), PA_CS5(BAST_PA_IDEPRI), SZ_1M, MT_DEVICE },
156 { VA_C4(BAST_VA_IDESEC), PA_CS5(BAST_PA_IDESEC), SZ_1M, MT_DEVICE },
157 { VA_C4(BAST_VA_IDEPRIAUX), PA_CS5(BAST_PA_IDEPRIAUX), SZ_1M, MT_DEVICE },
158 { VA_C4(BAST_VA_IDESECAUX), PA_CS5(BAST_PA_IDESECAUX), SZ_1M, MT_DEVICE },
159 151
160 /* fast, word */ 152 /* fast, word */
161 { VA_C5(BAST_VA_ISAIO), PA_CS5(BAST_PA_ISAIO), SZ_16M, MT_DEVICE }, 153 { VA_C5(BAST_VA_ISAIO), PA_CS5(BAST_PA_ISAIO), SZ_16M, MT_DEVICE },
162 { VA_C5(BAST_VA_ISAMEM), PA_CS5(BAST_PA_ISAMEM), SZ_16M, MT_DEVICE }, 154 { VA_C5(BAST_VA_ISAMEM), PA_CS5(BAST_PA_ISAMEM), SZ_16M, MT_DEVICE },
163 { VA_C5(BAST_VA_SUPERIO), PA_CS5(BAST_PA_SUPERIO), SZ_1M, MT_DEVICE }, 155 { VA_C5(BAST_VA_SUPERIO), PA_CS5(BAST_PA_SUPERIO), SZ_1M, MT_DEVICE },
164 { VA_C5(BAST_VA_IDEPRI), PA_CS5(BAST_PA_IDEPRI), SZ_1M, MT_DEVICE },
165 { VA_C5(BAST_VA_IDESEC), PA_CS5(BAST_PA_IDESEC), SZ_1M, MT_DEVICE },
166 { VA_C5(BAST_VA_IDEPRIAUX), PA_CS5(BAST_PA_IDEPRIAUX), SZ_1M, MT_DEVICE },
167 { VA_C5(BAST_VA_IDESECAUX), PA_CS5(BAST_PA_IDESECAUX), SZ_1M, MT_DEVICE },
168}; 156};
169 157
170#define UCON S3C2410_UCON_DEFAULT | S3C2410_UCON_UCLK 158#define UCON S3C2410_UCON_DEFAULT | S3C2410_UCON_UCLK
@@ -218,23 +206,6 @@ static struct s3c2410_uartcfg bast_uartcfgs[] __initdata = {
218 } 206 }
219}; 207};
220 208
221/* NOR Flash on BAST board */
222
223static struct resource bast_nor_resource[] = {
224 [0] = {
225 .start = S3C2410_CS1 + 0x4000000,
226 .end = S3C2410_CS1 + 0x4000000 + (32*1024*1024) - 1,
227 .flags = IORESOURCE_MEM,
228 }
229};
230
231static struct platform_device bast_device_nor = {
232 .name = "bast-nor",
233 .id = -1,
234 .num_resources = ARRAY_SIZE(bast_nor_resource),
235 .resource = bast_nor_resource,
236};
237
238/* NAND Flash on BAST board */ 209/* NAND Flash on BAST board */
239 210
240#ifdef CONFIG_PM 211#ifdef CONFIG_PM
@@ -374,7 +345,7 @@ static struct resource bast_dm9k_resource[] = {
374 [2] = { 345 [2] = {
375 .start = IRQ_DM9000, 346 .start = IRQ_DM9000,
376 .end = IRQ_DM9000, 347 .end = IRQ_DM9000,
377 .flags = IORESOURCE_IRQ | IRQF_TRIGGER_HIGH, 348 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
378 } 349 }
379 350
380}; 351};
@@ -564,6 +535,18 @@ static struct s3c2410fb_mach_info __initdata bast_fb_info = {
564 .default_display = 1, 535 .default_display = 1,
565}; 536};
566 537
538/* I2C devices fitted. */
539
540static struct i2c_board_info bast_i2c_devs[] __initdata = {
541 {
542 I2C_BOARD_INFO("tlv320aic23", 0x1a),
543 }, {
544 I2C_BOARD_INFO("simtec-pmu", 0x6b),
545 }, {
546 I2C_BOARD_INFO("ch7013", 0x75),
547 },
548};
549
567/* Standard BAST devices */ 550/* Standard BAST devices */
568 551
569static struct platform_device *bast_devices[] __initdata = { 552static struct platform_device *bast_devices[] __initdata = {
@@ -573,7 +556,6 @@ static struct platform_device *bast_devices[] __initdata = {
573 &s3c_device_i2c, 556 &s3c_device_i2c,
574 &s3c_device_rtc, 557 &s3c_device_rtc,
575 &s3c_device_nand, 558 &s3c_device_nand,
576 &bast_device_nor,
577 &bast_device_dm9k, 559 &bast_device_dm9k,
578 &bast_device_asix, 560 &bast_device_asix,
579 &bast_device_axpp, 561 &bast_device_axpp,
@@ -622,6 +604,11 @@ static void __init bast_init(void)
622 604
623 s3c24xx_fb_set_platdata(&bast_fb_info); 605 s3c24xx_fb_set_platdata(&bast_fb_info);
624 platform_add_devices(bast_devices, ARRAY_SIZE(bast_devices)); 606 platform_add_devices(bast_devices, ARRAY_SIZE(bast_devices));
607
608 i2c_register_board_info(0, bast_i2c_devs,
609 ARRAY_SIZE(bast_i2c_devs));
610
611 nor_simtec_init();
625} 612}
626 613
627MACHINE_START(BAST, "Simtec-BAST") 614MACHINE_START(BAST, "Simtec-BAST")
diff --git a/arch/arm/mach-s3c2410/mach-n30.c b/arch/arm/mach-s3c2410/mach-n30.c
index 621f548da610..43c2e915c5bf 100644
--- a/arch/arm/mach-s3c2410/mach-n30.c
+++ b/arch/arm/mach-s3c2410/mach-n30.c
@@ -1,9 +1,10 @@
1/* linux/arch/arm/mach-s3c2410/mach-n30.c 1/* Machine specific code for the Acer n30, Acer N35, Navman PiN 570,
2 * Yakumo AlphaX and Airis NC05 PDAs.
2 * 3 *
3 * Copyright (c) 2003-2005 Simtec Electronics 4 * Copyright (c) 2003-2005 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk> 5 * Ben Dooks <ben@simtec.co.uk>
5 * 6 *
6 * Copyright (c) 2005 Christer Weinigel <christer@weinigel.se> 7 * Copyright (c) 2005-2008 Christer Weinigel <christer@weinigel.se>
7 * 8 *
8 * There is a wiki with more information about the n30 port at 9 * There is a wiki with more information about the n30 port at
9 * http://handhelds.org/moin/moin.cgi/AcerN30Documentation . 10 * http://handhelds.org/moin/moin.cgi/AcerN30Documentation .
@@ -11,36 +12,42 @@
11 * This program is free software; you can redistribute it and/or modify 12 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2 as 13 * it under the terms of the GNU General Public License version 2 as
13 * published by the Free Software Foundation. 14 * published by the Free Software Foundation.
14*/ 15 */
15 16
16#include <linux/kernel.h> 17#include <linux/kernel.h>
17#include <linux/types.h> 18#include <linux/types.h>
18#include <linux/interrupt.h> 19
19#include <linux/list.h>
20#include <linux/timer.h>
21#include <linux/init.h>
22#include <linux/delay.h> 20#include <linux/delay.h>
23#include <linux/serial_core.h> 21#include <linux/gpio_keys.h>
22#include <linux/init.h>
23#include <linux/input.h>
24#include <linux/interrupt.h>
24#include <linux/platform_device.h> 25#include <linux/platform_device.h>
25#include <linux/kthread.h> 26#include <linux/serial_core.h>
26 27#include <linux/timer.h>
27#include <asm/mach/arch.h>
28#include <asm/mach/map.h>
29#include <asm/mach/irq.h>
30 28
31#include <asm/hardware.h> 29#include <asm/hardware.h>
32#include <asm/io.h> 30#include <asm/io.h>
33#include <asm/irq.h> 31#include <asm/irq.h>
34#include <asm/mach-types.h> 32#include <asm/mach-types.h>
35 33
36#include <asm/plat-s3c/regs-serial.h> 34#include <asm/arch/fb.h>
35#include <asm/arch/leds-gpio.h>
37#include <asm/arch/regs-gpio.h> 36#include <asm/arch/regs-gpio.h>
37#include <asm/arch/regs-lcd.h>
38
39#include <asm/mach/arch.h>
40#include <asm/mach/irq.h>
41#include <asm/mach/map.h>
42
38#include <asm/plat-s3c/iic.h> 43#include <asm/plat-s3c/iic.h>
44#include <asm/plat-s3c/regs-serial.h>
39 45
40#include <asm/plat-s3c24xx/s3c2410.h>
41#include <asm/plat-s3c24xx/clock.h> 46#include <asm/plat-s3c24xx/clock.h>
42#include <asm/plat-s3c24xx/devs.h>
43#include <asm/plat-s3c24xx/cpu.h> 47#include <asm/plat-s3c24xx/cpu.h>
48#include <asm/plat-s3c24xx/devs.h>
49#include <asm/plat-s3c24xx/s3c2410.h>
50#include <asm/plat-s3c24xx/udc.h>
44 51
45static struct map_desc n30_iodesc[] __initdata = { 52static struct map_desc n30_iodesc[] __initdata = {
46 /* nothing here yet */ 53 /* nothing here yet */
@@ -64,7 +71,8 @@ static struct s3c2410_uartcfg n30_uartcfgs[] = {
64 .ulcon = 0x43, 71 .ulcon = 0x43,
65 .ufcon = 0x51, 72 .ufcon = 0x51,
66 }, 73 },
67 /* The BlueTooth controller is connected to port 2 */ 74 /* On the N30 the bluetooth controller is connected here.
75 * On the N35 and variants the GPS receiver is connected here. */
68 [2] = { 76 [2] = {
69 .hwport = 2, 77 .hwport = 2,
70 .flags = 0, 78 .flags = 0,
@@ -74,13 +82,260 @@ static struct s3c2410_uartcfg n30_uartcfgs[] = {
74 }, 82 },
75}; 83};
76 84
85static void n30_udc_pullup(enum s3c2410_udc_cmd_e cmd)
86{
87 switch (cmd) {
88 case S3C2410_UDC_P_ENABLE :
89 s3c2410_gpio_setpin(S3C2410_GPB3, 1);
90 break;
91 case S3C2410_UDC_P_DISABLE :
92 s3c2410_gpio_setpin(S3C2410_GPB3, 0);
93 break;
94 case S3C2410_UDC_P_RESET :
95 break;
96 default:
97 break;
98 }
99}
100
101static struct s3c2410_udc_mach_info n30_udc_cfg __initdata = {
102 .udc_command = n30_udc_pullup,
103 .vbus_pin = S3C2410_GPG1,
104 .vbus_pin_inverted = 0,
105};
106
107static struct gpio_keys_button n30_buttons[] = {
108 {
109 .gpio = S3C2410_GPF0,
110 .code = KEY_POWER,
111 .desc = "Power",
112 .active_low = 0,
113 },
114 {
115 .gpio = S3C2410_GPG9,
116 .code = KEY_UP,
117 .desc = "Thumbwheel Up",
118 .active_low = 0,
119 },
120 {
121 .gpio = S3C2410_GPG8,
122 .code = KEY_DOWN,
123 .desc = "Thumbwheel Down",
124 .active_low = 0,
125 },
126 {
127 .gpio = S3C2410_GPG7,
128 .code = KEY_ENTER,
129 .desc = "Thumbwheel Press",
130 .active_low = 0,
131 },
132 {
133 .gpio = S3C2410_GPF7,
134 .code = KEY_HOMEPAGE,
135 .desc = "Home",
136 .active_low = 0,
137 },
138 {
139 .gpio = S3C2410_GPF6,
140 .code = KEY_CALENDAR,
141 .desc = "Calendar",
142 .active_low = 0,
143 },
144 {
145 .gpio = S3C2410_GPF5,
146 .code = KEY_ADDRESSBOOK,
147 .desc = "Contacts",
148 .active_low = 0,
149 },
150 {
151 .gpio = S3C2410_GPF4,
152 .code = KEY_MAIL,
153 .desc = "Mail",
154 .active_low = 0,
155 },
156};
157
158static struct gpio_keys_platform_data n30_button_data = {
159 .buttons = n30_buttons,
160 .nbuttons = ARRAY_SIZE(n30_buttons),
161};
162
163static struct platform_device n30_button_device = {
164 .name = "gpio-keys",
165 .id = -1,
166 .dev = {
167 .platform_data = &n30_button_data,
168 }
169};
170
171static struct gpio_keys_button n35_buttons[] = {
172 {
173 .gpio = S3C2410_GPF0,
174 .code = KEY_POWER,
175 .desc = "Power",
176 .active_low = 0,
177 },
178 {
179 .gpio = S3C2410_GPG9,
180 .code = KEY_UP,
181 .desc = "Joystick Up",
182 .active_low = 0,
183 },
184 {
185 .gpio = S3C2410_GPG8,
186 .code = KEY_DOWN,
187 .desc = "Joystick Down",
188 .active_low = 0,
189 },
190 {
191 .gpio = S3C2410_GPG6,
192 .code = KEY_DOWN,
193 .desc = "Joystick Left",
194 .active_low = 0,
195 },
196 {
197 .gpio = S3C2410_GPG5,
198 .code = KEY_DOWN,
199 .desc = "Joystick Right",
200 .active_low = 0,
201 },
202 {
203 .gpio = S3C2410_GPG7,
204 .code = KEY_ENTER,
205 .desc = "Joystick Press",
206 .active_low = 0,
207 },
208 {
209 .gpio = S3C2410_GPF7,
210 .code = KEY_HOMEPAGE,
211 .desc = "Home",
212 .active_low = 0,
213 },
214 {
215 .gpio = S3C2410_GPF6,
216 .code = KEY_CALENDAR,
217 .desc = "Calendar",
218 .active_low = 0,
219 },
220 {
221 .gpio = S3C2410_GPF5,
222 .code = KEY_ADDRESSBOOK,
223 .desc = "Contacts",
224 .active_low = 0,
225 },
226 {
227 .gpio = S3C2410_GPF4,
228 .code = KEY_MAIL,
229 .desc = "Mail",
230 .active_low = 0,
231 },
232 {
233 .gpio = S3C2410_GPF3,
234 .code = SW_RADIO,
235 .desc = "GPS Antenna",
236 .active_low = 0,
237 },
238 {
239 .gpio = S3C2410_GPG2,
240 .code = SW_HEADPHONE_INSERT,
241 .desc = "Headphone",
242 .active_low = 0,
243 },
244};
245
246static struct gpio_keys_platform_data n35_button_data = {
247 .buttons = n35_buttons,
248 .nbuttons = ARRAY_SIZE(n35_buttons),
249};
250
251static struct platform_device n35_button_device = {
252 .name = "gpio-keys",
253 .id = -1,
254 .num_resources = 0,
255 .dev = {
256 .platform_data = &n35_button_data,
257 }
258};
259
260/* This is the bluetooth LED on the device. */
261static struct s3c24xx_led_platdata n30_blue_led_pdata = {
262 .name = "blue_led",
263 .gpio = S3C2410_GPG6,
264 .def_trigger = "",
265};
266
267/* This LED is driven by the battery microcontroller, and is blinking
268 * red, blinking green or solid green when the battery is low,
269 * charging or full respectively. By driving GPD9 low, it's possible
270 * to force the LED to blink red, so call that warning LED. */
271static struct s3c24xx_led_platdata n30_warning_led_pdata = {
272 .name = "warning_led",
273 .flags = S3C24XX_LEDF_ACTLOW,
274 .gpio = S3C2410_GPD9,
275 .def_trigger = "",
276};
277
278static struct platform_device n30_blue_led = {
279 .name = "s3c24xx_led",
280 .id = 1,
281 .dev = {
282 .platform_data = &n30_blue_led_pdata,
283 },
284};
285
286static struct platform_device n30_warning_led = {
287 .name = "s3c24xx_led",
288 .id = 2,
289 .dev = {
290 .platform_data = &n30_warning_led_pdata,
291 },
292};
293
294static struct s3c2410fb_display n30_display __initdata = {
295 .type = S3C2410_LCDCON1_TFT,
296 .width = 240,
297 .height = 320,
298 .pixclock = 170000,
299
300 .xres = 240,
301 .yres = 320,
302 .bpp = 16,
303 .left_margin = 3,
304 .right_margin = 40,
305 .hsync_len = 40,
306 .upper_margin = 2,
307 .lower_margin = 3,
308 .vsync_len = 2,
309
310 .lcdcon5 = S3C2410_LCDCON5_INVVLINE | S3C2410_LCDCON5_INVVFRAME,
311};
312
313static struct s3c2410fb_mach_info n30_fb_info __initdata = {
314 .displays = &n30_display,
315 .num_displays = 1,
316 .default_display = 0,
317 .lpcsel = 0x06,
318};
319
77static struct platform_device *n30_devices[] __initdata = { 320static struct platform_device *n30_devices[] __initdata = {
321 &s3c_device_lcd,
322 &s3c_device_wdt,
323 &s3c_device_i2c,
324 &s3c_device_iis,
78 &s3c_device_usb, 325 &s3c_device_usb,
326 &s3c_device_usbgadget,
327 &n30_button_device,
328 &n30_blue_led,
329 &n30_warning_led,
330};
331
332static struct platform_device *n35_devices[] __initdata = {
79 &s3c_device_lcd, 333 &s3c_device_lcd,
80 &s3c_device_wdt, 334 &s3c_device_wdt,
81 &s3c_device_i2c, 335 &s3c_device_i2c,
82 &s3c_device_iis, 336 &s3c_device_iis,
83 &s3c_device_usbgadget, 337 &s3c_device_usbgadget,
338 &n35_button_device,
84}; 339};
85 340
86static struct s3c2410_platform_i2c n30_i2ccfg = { 341static struct s3c2410_platform_i2c n30_i2ccfg = {
@@ -90,9 +345,148 @@ static struct s3c2410_platform_i2c n30_i2ccfg = {
90 .max_freq = 10*1000, 345 .max_freq = 10*1000,
91}; 346};
92 347
348/* Lots of hardcoded stuff, but it sets up the hardware in a useful
349 * state so that we can boot Linux directly from flash. */
350static void __init n30_hwinit(void)
351{
352 /* GPA0-11 special functions -- unknown what they do
353 * GPA12 N30 special function -- unknown what it does
354 * N35/PiN output -- unknown what it does
355 *
356 * A12 is nGCS1 on the N30 and an output on the N35/PiN. I
357 * don't think it does anything useful on the N30, so I ought
358 * to make it an output there too since it always driven to 0
359 * as far as I can tell. */
360 if (machine_is_n30())
361 __raw_writel(0x007fffff, S3C2410_GPACON);
362 if (machine_is_n35())
363 __raw_writel(0x007fefff, S3C2410_GPACON);
364 __raw_writel(0x00000000, S3C2410_GPADAT);
365
366 /* GPB0 TOUT0 backlight level
367 * GPB1 output 1=backlight on
368 * GPB2 output IrDA enable 0=transceiver enabled, 1=disabled
369 * GPB3 output USB D+ pull up 0=disabled, 1=enabled
370 * GPB4 N30 output -- unknown function
371 * N30/PiN GPS control 0=GPS enabled, 1=GPS disabled
372 * GPB5 output -- unknown function
373 * GPB6 input -- unknown function
374 * GPB7 output -- unknown function
375 * GPB8 output -- probably LCD driver enable
376 * GPB9 output -- probably LCD VSYNC driver enable
377 * GPB10 output -- probably LCD HSYNC driver enable
378 */
379 __raw_writel(0x00154556, S3C2410_GPBCON);
380 __raw_writel(0x00000750, S3C2410_GPBDAT);
381 __raw_writel(0x00000073, S3C2410_GPBUP);
382
383 /* GPC0 input RS232 DCD/DSR/RI
384 * GPC1 LCD
385 * GPC2 output RS232 DTR?
386 * GPC3 input RS232 DCD/DSR/RI
387 * GPC4 LCD
388 * GPC5 output 0=NAND write enabled, 1=NAND write protect
389 * GPC6 input -- unknown function
390 * GPC7 input charger status 0=charger connected
391 * this input can be triggered by power on the USB device
392 * port too, but will go back to disconnected soon after.
393 * GPC8 N30/N35 output -- unknown function, always driven to 1
394 * PiN input -- unknown function, always read as 1
395 * Make it an input with a pull up for all models.
396 * GPC9-15 LCD
397 */
398 __raw_writel(0xaaa80618, S3C2410_GPCCON);
399 __raw_writel(0x0000014c, S3C2410_GPCDAT);
400 __raw_writel(0x0000fef2, S3C2410_GPCUP);
401
402 /* GPD0 input -- unknown function
403 * GPD1-D7 LCD
404 * GPD8 N30 output -- unknown function
405 * N35/PiN output 1=GPS LED on
406 * GPD9 output 0=power led blinks red, 1=normal power led function
407 * GPD10 output -- unknown function
408 * GPD11-15 LCD drivers
409 */
410 __raw_writel(0xaa95aaa4, S3C2410_GPDCON);
411 __raw_writel(0x00000601, S3C2410_GPDDAT);
412 __raw_writel(0x0000fbfe, S3C2410_GPDUP);
413
414 /* GPE0-4 I2S audio bus
415 * GPE5-10 SD/MMC bus
416 * E11-13 outputs -- unknown function, probably power management
417 * E14-15 I2C bus connected to the battery controller
418 */
419 __raw_writel(0xa56aaaaa, S3C2410_GPECON);
420 __raw_writel(0x0000efc5, S3C2410_GPEDAT);
421 __raw_writel(0x0000f81f, S3C2410_GPEUP);
422
423 /* GPF0 input 0=power button pressed
424 * GPF1 input SD/MMC switch 0=card present
425 * GPF2 N30 1=reset button pressed (inverted compared to the rest)
426 * N35/PiN 0=reset button pressed
427 * GPF3 N30/PiN input -- unknown function
428 * N35 input GPS antenna position, 0=antenna closed, 1=open
429 * GPF4 input 0=button 4 pressed
430 * GPF5 input 0=button 3 pressed
431 * GPF6 input 0=button 2 pressed
432 * GPF7 input 0=button 1 pressed
433 */
434 __raw_writel(0x0000aaaa, S3C2410_GPFCON);
435 __raw_writel(0x00000000, S3C2410_GPFDAT);
436 __raw_writel(0x000000ff, S3C2410_GPFUP);
437
438 /* GPG0 input RS232 DCD/DSR/RI
439 * GPG1 input 1=USB gadget port has power from a host
440 * GPG2 N30 input -- unknown function
441 * N35/PiN input 0=headphones plugged in, 1=not plugged in
442 * GPG3 N30 output -- unknown function
443 * N35/PiN input with unknown function
444 * GPG4 N30 output 0=MMC enabled, 1=MMC disabled
445 * GPG5 N30 output 0=BlueTooth chip disabled, 1=enabled
446 * N35/PiN input joystick right
447 * GPG6 N30 output 0=blue led on, 1=off
448 * N35/PiN input joystick left
449 * GPG7 input 0=thumbwheel pressed
450 * GPG8 input 0=thumbwheel down
451 * GPG9 input 0=thumbwheel up
452 * GPG10 input SD/MMC write protect switch
453 * GPG11 N30 input -- unknown function
454 * N35 output 0=GPS antenna powered, 1=not powered
455 * PiN output -- unknown function
456 * GPG12-15 touch screen functions
457 *
458 * The pullups differ between the models, so enable all
459 * pullups that are enabled on any of the models.
460 */
461 if (machine_is_n30())
462 __raw_writel(0xff0a956a, S3C2410_GPGCON);
463 if (machine_is_n35())
464 __raw_writel(0xff4aa92a, S3C2410_GPGCON);
465 __raw_writel(0x0000e800, S3C2410_GPGDAT);
466 __raw_writel(0x0000f86f, S3C2410_GPGUP);
467
468 /* GPH0/1/2/3 RS232 serial port
469 * GPH4/5 IrDA serial port
470 * GPH6/7 N30 BlueTooth serial port
471 * N35/PiN GPS receiver
472 * GPH8 input -- unknown function
473 * GPH9 CLKOUT0 HCLK -- unknown use
474 * GPH10 CLKOUT1 FCLK -- unknown use
475 *
476 * The pull ups for H6/H7 are enabled on N30 but not on the
477 * N35/PiN. I suppose is useful for a budget model of the N30
478 * with no bluetooh. It doesn't hurt to have the pull ups
479 * enabled on the N35, so leave them enabled for all models.
480 */
481 __raw_writel(0x0028aaaa, S3C2410_GPHCON);
482 __raw_writel(0x000005ef, S3C2410_GPHDAT);
483 __raw_writel(0x0000063f, S3C2410_GPHUP);
484}
485
93static void __init n30_map_io(void) 486static void __init n30_map_io(void)
94{ 487{
95 s3c24xx_init_io(n30_iodesc, ARRAY_SIZE(n30_iodesc)); 488 s3c24xx_init_io(n30_iodesc, ARRAY_SIZE(n30_iodesc));
489 n30_hwinit();
96 s3c24xx_init_clocks(0); 490 s3c24xx_init_clocks(0);
97 s3c24xx_init_uarts(n30_uartcfgs, ARRAY_SIZE(n30_uartcfgs)); 491 s3c24xx_init_uarts(n30_uartcfgs, ARRAY_SIZE(n30_uartcfgs));
98} 492}
@@ -106,7 +500,9 @@ static void __init n30_init_irq(void)
106 500
107static void __init n30_init(void) 501static void __init n30_init(void)
108{ 502{
503 s3c24xx_fb_set_platdata(&n30_fb_info);
109 s3c_device_i2c.dev.platform_data = &n30_i2ccfg; 504 s3c_device_i2c.dev.platform_data = &n30_i2ccfg;
505 s3c24xx_udc_set_platdata(&n30_udc_cfg);
110 506
111 /* Turn off suspend on both USB ports, and switch the 507 /* Turn off suspend on both USB ports, and switch the
112 * selectable USB port to USB device mode. */ 508 * selectable USB port to USB device mode. */
@@ -115,7 +511,32 @@ static void __init n30_init(void)
115 S3C2410_MISCCR_USBSUSPND0 | 511 S3C2410_MISCCR_USBSUSPND0 |
116 S3C2410_MISCCR_USBSUSPND1, 0x0); 512 S3C2410_MISCCR_USBSUSPND1, 0x0);
117 513
118 platform_add_devices(n30_devices, ARRAY_SIZE(n30_devices)); 514 if (machine_is_n30()) {
515 /* Turn off suspend on both USB ports, and switch the
516 * selectable USB port to USB device mode. */
517 s3c2410_modify_misccr(S3C2410_MISCCR_USBHOST |
518 S3C2410_MISCCR_USBSUSPND0 |
519 S3C2410_MISCCR_USBSUSPND1, 0x0);
520
521 platform_add_devices(n30_devices, ARRAY_SIZE(n30_devices));
522 }
523
524 if (machine_is_n35()) {
525 /* Turn off suspend and switch the selectable USB port
526 * to USB device mode. Turn on suspend for the host
527 * port since it is not connected on the N35.
528 *
529 * Actually, the host port is available at some pads
530 * on the back of the device, so it would actually be
531 * possible to add a USB device inside the N35 if you
532 * are willing to do some hardware modifications. */
533 s3c2410_modify_misccr(S3C2410_MISCCR_USBHOST |
534 S3C2410_MISCCR_USBSUSPND0 |
535 S3C2410_MISCCR_USBSUSPND1,
536 S3C2410_MISCCR_USBSUSPND1);
537
538 platform_add_devices(n35_devices, ARRAY_SIZE(n35_devices));
539 }
119} 540}
120 541
121MACHINE_START(N30, "Acer-N30") 542MACHINE_START(N30, "Acer-N30")
@@ -131,9 +552,14 @@ MACHINE_START(N30, "Acer-N30")
131 .map_io = n30_map_io, 552 .map_io = n30_map_io,
132MACHINE_END 553MACHINE_END
133 554
134/* 555MACHINE_START(N35, "Acer-N35")
135 Local variables: 556 /* Maintainer: Christer Weinigel <christer@weinigel.se>
136 compile-command: "make ARCH=arm CROSS_COMPILE=/usr/local/arm/3.3.2/bin/arm-linux- -k -C ../../.." 557 */
137 c-basic-offset: 8 558 .phys_io = S3C2410_PA_UART,
138 End: 559 .io_pg_offst = (((u32)S3C24XX_VA_UART) >> 18) & 0xfffc,
139*/ 560 .boot_params = S3C2410_SDRAM_PA + 0x100,
561 .timer = &s3c24xx_timer,
562 .init_machine = n30_init,
563 .init_irq = n30_init_irq,
564 .map_io = n30_map_io,
565MACHINE_END
diff --git a/arch/arm/mach-s3c2410/mach-vr1000.c b/arch/arm/mach-s3c2410/mach-vr1000.c
index 4c4b5c4207c4..9a0965ac5e11 100644
--- a/arch/arm/mach-s3c2410/mach-vr1000.c
+++ b/arch/arm/mach-s3c2410/mach-vr1000.c
@@ -1,6 +1,6 @@
1/* linux/arch/arm/mach-s3c2410/mach-vr1000.c 1/* linux/arch/arm/mach-s3c2410/mach-vr1000.c
2 * 2 *
3 * Copyright (c) 2003-2005 Simtec Electronics 3 * Copyright (c) 2003-2005,2008 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk> 4 * Ben Dooks <ben@simtec.co.uk>
5 * 5 *
6 * Machine support for Thorcom VR1000 board. Designed for Thorcom by 6 * Machine support for Thorcom VR1000 board. Designed for Thorcom by
@@ -19,6 +19,7 @@
19#include <linux/timer.h> 19#include <linux/timer.h>
20#include <linux/init.h> 20#include <linux/init.h>
21#include <linux/dm9000.h> 21#include <linux/dm9000.h>
22#include <linux/i2c.h>
22 23
23#include <linux/serial.h> 24#include <linux/serial.h>
24#include <linux/tty.h> 25#include <linux/tty.h>
@@ -46,7 +47,9 @@
46#include <asm/plat-s3c24xx/clock.h> 47#include <asm/plat-s3c24xx/clock.h>
47#include <asm/plat-s3c24xx/devs.h> 48#include <asm/plat-s3c24xx/devs.h>
48#include <asm/plat-s3c24xx/cpu.h> 49#include <asm/plat-s3c24xx/cpu.h>
50
49#include "usb-simtec.h" 51#include "usb-simtec.h"
52#include "nor-simtec.h"
50 53
51/* macros for virtual address mods for the io space entries */ 54/* macros for virtual address mods for the io space entries */
52#define VA_C5(item) ((unsigned long)(item) + BAST_VAM_CS5) 55#define VA_C5(item) ((unsigned long)(item) + BAST_VAM_CS5)
@@ -97,34 +100,6 @@ static struct map_desc vr1000_iodesc[] __initdata = {
97 .length = SZ_1M, 100 .length = SZ_1M,
98 .type = MT_DEVICE, 101 .type = MT_DEVICE,
99 }, 102 },
100
101 /* peripheral space... one for each of fast/slow/byte/16bit */
102 /* note, ide is only decoded in word space, even though some registers
103 * are only 8bit */
104
105 /* slow, byte */
106 { VA_C2(VR1000_VA_IDEPRI), PA_CS3(VR1000_PA_IDEPRI), SZ_1M, MT_DEVICE },
107 { VA_C2(VR1000_VA_IDESEC), PA_CS3(VR1000_PA_IDESEC), SZ_1M, MT_DEVICE },
108 { VA_C2(VR1000_VA_IDEPRIAUX), PA_CS3(VR1000_PA_IDEPRIAUX), SZ_1M, MT_DEVICE },
109 { VA_C2(VR1000_VA_IDESECAUX), PA_CS3(VR1000_PA_IDESECAUX), SZ_1M, MT_DEVICE },
110
111 /* slow, word */
112 { VA_C3(VR1000_VA_IDEPRI), PA_CS3(VR1000_PA_IDEPRI), SZ_1M, MT_DEVICE },
113 { VA_C3(VR1000_VA_IDESEC), PA_CS3(VR1000_PA_IDESEC), SZ_1M, MT_DEVICE },
114 { VA_C3(VR1000_VA_IDEPRIAUX), PA_CS3(VR1000_PA_IDEPRIAUX), SZ_1M, MT_DEVICE },
115 { VA_C3(VR1000_VA_IDESECAUX), PA_CS3(VR1000_PA_IDESECAUX), SZ_1M, MT_DEVICE },
116
117 /* fast, byte */
118 { VA_C4(VR1000_VA_IDEPRI), PA_CS5(VR1000_PA_IDEPRI), SZ_1M, MT_DEVICE },
119 { VA_C4(VR1000_VA_IDESEC), PA_CS5(VR1000_PA_IDESEC), SZ_1M, MT_DEVICE },
120 { VA_C4(VR1000_VA_IDEPRIAUX), PA_CS5(VR1000_PA_IDEPRIAUX), SZ_1M, MT_DEVICE },
121 { VA_C4(VR1000_VA_IDESECAUX), PA_CS5(VR1000_PA_IDESECAUX), SZ_1M, MT_DEVICE },
122
123 /* fast, word */
124 { VA_C5(VR1000_VA_IDEPRI), PA_CS5(VR1000_PA_IDEPRI), SZ_1M, MT_DEVICE },
125 { VA_C5(VR1000_VA_IDESEC), PA_CS5(VR1000_PA_IDESEC), SZ_1M, MT_DEVICE },
126 { VA_C5(VR1000_VA_IDEPRIAUX), PA_CS5(VR1000_PA_IDEPRIAUX), SZ_1M, MT_DEVICE },
127 { VA_C5(VR1000_VA_IDESECAUX), PA_CS5(VR1000_PA_IDESECAUX), SZ_1M, MT_DEVICE },
128}; 103};
129 104
130#define UCON S3C2410_UCON_DEFAULT | S3C2410_UCON_UCLK 105#define UCON S3C2410_UCON_DEFAULT | S3C2410_UCON_UCLK
@@ -230,23 +205,6 @@ static struct platform_device serial_device = {
230 }, 205 },
231}; 206};
232 207
233/* MTD NOR Flash */
234
235static struct resource vr1000_nor_resource[] = {
236 [0] = {
237 .start = S3C2410_CS1 + 0x4000000,
238 .end = S3C2410_CS1 + 0x4000000 + SZ_16M - 1,
239 .flags = IORESOURCE_MEM,
240 }
241};
242
243static struct platform_device vr1000_nor = {
244 .name = "bast-nor",
245 .id = -1,
246 .num_resources = ARRAY_SIZE(vr1000_nor_resource),
247 .resource = vr1000_nor_resource,
248};
249
250/* DM9000 ethernet devices */ 208/* DM9000 ethernet devices */
251 209
252static struct resource vr1000_dm9k0_resource[] = { 210static struct resource vr1000_dm9k0_resource[] = {
@@ -263,7 +221,7 @@ static struct resource vr1000_dm9k0_resource[] = {
263 [2] = { 221 [2] = {
264 .start = IRQ_VR1000_DM9000A, 222 .start = IRQ_VR1000_DM9000A,
265 .end = IRQ_VR1000_DM9000A, 223 .end = IRQ_VR1000_DM9000A,
266 .flags = IORESOURCE_IRQ | IRQF_TRIGGER_HIGH, 224 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
267 } 225 }
268 226
269}; 227};
@@ -282,7 +240,7 @@ static struct resource vr1000_dm9k1_resource[] = {
282 [2] = { 240 [2] = {
283 .start = IRQ_VR1000_DM9000N, 241 .start = IRQ_VR1000_DM9000N,
284 .end = IRQ_VR1000_DM9000N, 242 .end = IRQ_VR1000_DM9000N,
285 .flags = IORESOURCE_IRQ | IRQF_TRIGGER_HIGH, 243 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
286 } 244 }
287}; 245};
288 246
@@ -358,6 +316,18 @@ static struct platform_device vr1000_led3 = {
358 }, 316 },
359}; 317};
360 318
319/* I2C devices. */
320
321static struct i2c_board_info vr1000_i2c_devs[] __initdata = {
322 {
323 I2C_BOARD_INFO("tlv320aic23", 0x1a),
324 }, {
325 I2C_BOARD_INFO("tmp101", 0x48),
326 }, {
327 I2C_BOARD_INFO("m41st87", 0x68),
328 },
329};
330
361/* devices for this board */ 331/* devices for this board */
362 332
363static struct platform_device *vr1000_devices[] __initdata = { 333static struct platform_device *vr1000_devices[] __initdata = {
@@ -367,7 +337,6 @@ static struct platform_device *vr1000_devices[] __initdata = {
367 &s3c_device_i2c, 337 &s3c_device_i2c,
368 &s3c_device_adc, 338 &s3c_device_adc,
369 &serial_device, 339 &serial_device,
370 &vr1000_nor,
371 &vr1000_dm9k0, 340 &vr1000_dm9k0,
372 &vr1000_dm9k1, 341 &vr1000_dm9k1,
373 &vr1000_led1, 342 &vr1000_led1,
@@ -416,6 +385,11 @@ static void __init vr1000_map_io(void)
416static void __init vr1000_init(void) 385static void __init vr1000_init(void)
417{ 386{
418 platform_add_devices(vr1000_devices, ARRAY_SIZE(vr1000_devices)); 387 platform_add_devices(vr1000_devices, ARRAY_SIZE(vr1000_devices));
388
389 i2c_register_board_info(0, vr1000_i2c_devs,
390 ARRAY_SIZE(vr1000_i2c_devs));
391
392 nor_simtec_init();
419} 393}
420 394
421MACHINE_START(VR1000, "Thorcom-VR1000") 395MACHINE_START(VR1000, "Thorcom-VR1000")
diff --git a/arch/arm/mach-s3c2410/nor-simtec.c b/arch/arm/mach-s3c2410/nor-simtec.c
new file mode 100644
index 000000000000..f44e21b9c3ba
--- /dev/null
+++ b/arch/arm/mach-s3c2410/nor-simtec.c
@@ -0,0 +1,86 @@
1/* linux/arch/arm/mach-s3c2410/nor-simtec.c
2 *
3 * Copyright (c) 2008 Simtec Electronics
4 * http://armlinux.simtec.co.uk/
5 * Ben Dooks <ben@simtec.co.uk>
6 *
7 * Simtec NOR mapping
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12*/
13
14#include <linux/module.h>
15#include <linux/types.h>
16#include <linux/init.h>
17#include <linux/kernel.h>
18#include <linux/platform_device.h>
19
20#include <linux/mtd/mtd.h>
21#include <linux/mtd/map.h>
22#include <linux/mtd/physmap.h>
23#include <linux/mtd/partitions.h>
24
25#include <asm/mach/arch.h>
26#include <asm/mach/map.h>
27#include <asm/mach/irq.h>
28
29#include <asm/arch/map.h>
30#include <asm/arch/bast-map.h>
31#include <asm/arch/bast-cpld.h>
32
33
34static void simtec_nor_vpp(struct map_info *map, int vpp)
35{
36 unsigned int val;
37 unsigned long flags;
38
39 local_irq_save(flags);
40 val = __raw_readb(BAST_VA_CTRL3);
41
42 printk(KERN_DEBUG "%s(%d)\n", __func__, vpp);
43
44 if (vpp)
45 val |= BAST_CPLD_CTRL3_ROMWEN;
46 else
47 val &= ~BAST_CPLD_CTRL3_ROMWEN;
48
49 __raw_writeb(val, BAST_VA_CTRL3);
50 local_irq_restore(flags);
51}
52
53struct physmap_flash_data simtec_nor_pdata = {
54 .width = 2,
55 .set_vpp = simtec_nor_vpp,
56 .nr_parts = 0,
57};
58
59static struct resource simtec_nor_resource[] = {
60 [0] = {
61 .start = S3C2410_CS1 + 0x4000000,
62 .end = S3C2410_CS1 + 0x4000000 + SZ_8M - 1,
63 .flags = IORESOURCE_MEM,
64 }
65};
66
67static struct platform_device simtec_device_nor = {
68 .name = "physmap-flash",
69 .id = -1,
70 .num_resources = ARRAY_SIZE(simtec_nor_resource),
71 .resource = simtec_nor_resource,
72 .dev = {
73 .platform_data = &simtec_nor_pdata,
74 },
75};
76
77void __init nor_simtec_init(void)
78{
79 int ret;
80
81 ret = platform_device_register(&simtec_device_nor);
82 if (ret < 0)
83 printk(KERN_ERR "failed to register physmap-flash device\n");
84 else
85 simtec_nor_vpp(NULL, 1);
86}
diff --git a/arch/arm/mach-s3c2410/nor-simtec.h b/arch/arm/mach-s3c2410/nor-simtec.h
new file mode 100644
index 000000000000..f619c1e0d0c8
--- /dev/null
+++ b/arch/arm/mach-s3c2410/nor-simtec.h
@@ -0,0 +1,14 @@
1/* linux/arch/arm/mach-s3c2410/nor-simtec.h
2 *
3 * Copyright (c) 2008 Simtec Electronics
4 * http://armlinux.simtec.co.uk/
5 * Ben Dooks <ben@simtec.co.uk>
6 *
7 * Simtec NOR mapping
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12*/
13
14extern void nor_simtec_init(void);
diff --git a/arch/arm/mach-s3c2412/Kconfig b/arch/arm/mach-s3c2412/Kconfig
index 0b43431d4b75..c59a9d2ee9a6 100644
--- a/arch/arm/mach-s3c2412/Kconfig
+++ b/arch/arm/mach-s3c2412/Kconfig
@@ -34,6 +34,16 @@ config S3C2412_PM
34 34
35menu "S3C2412 Machines" 35menu "S3C2412 Machines"
36 36
37config MACH_JIVE
38 bool "Logitech Jive"
39 select CPU_S3C2412
40 help
41 Say Y here if you are using the Logitech Jive.
42
43config MACH_JIVE_SHOW_BOOTLOADER
44 bool "Allow access to bootloader partitions in MTD"
45 depends on MACH_JIVE && EXPERIMENTAL
46
37config MACH_SMDK2413 47config MACH_SMDK2413
38 bool "SMDK2413" 48 bool "SMDK2413"
39 select CPU_S3C2412 49 select CPU_S3C2412
diff --git a/arch/arm/mach-s3c2412/Makefile b/arch/arm/mach-s3c2412/Makefile
index 267f3348301e..20918d5dc6a9 100644
--- a/arch/arm/mach-s3c2412/Makefile
+++ b/arch/arm/mach-s3c2412/Makefile
@@ -18,5 +18,6 @@ obj-$(CONFIG_S3C2412_PM) += pm.o sleep.o
18 18
19# Machine support 19# Machine support
20 20
21obj-$(CONFIG_MACH_JIVE) += mach-jive.o
21obj-$(CONFIG_MACH_SMDK2413) += mach-smdk2413.o 22obj-$(CONFIG_MACH_SMDK2413) += mach-smdk2413.o
22obj-$(CONFIG_MACH_VSTMS) += mach-vstms.o 23obj-$(CONFIG_MACH_VSTMS) += mach-vstms.o
diff --git a/arch/arm/mach-s3c2412/clock.c b/arch/arm/mach-s3c2412/clock.c
index 2697a65ba727..1157b5a16263 100644
--- a/arch/arm/mach-s3c2412/clock.c
+++ b/arch/arm/mach-s3c2412/clock.c
@@ -631,6 +631,17 @@ static struct clk_init clks_src[] __initdata = {
631 .bit = S3C2412_CLKSRC_USBCLK_HCLK, 631 .bit = S3C2412_CLKSRC_USBCLK_HCLK,
632 .src_0 = &clk_usysclk, 632 .src_0 = &clk_usysclk,
633 .src_1 = &clk_h, 633 .src_1 = &clk_h,
634 /* here we assume OM[4] select xtal */
635 }, {
636 .clk = &clk_erefclk,
637 .bit = S3C2412_CLKSRC_EREFCLK_EXTCLK,
638 .src_0 = &clk_xtal,
639 .src_1 = &clk_ext,
640 }, {
641 .clk = &clk_urefclk,
642 .bit = S3C2412_CLKSRC_UREFCLK_EXTCLK,
643 .src_0 = &clk_xtal,
644 .src_1 = &clk_ext,
634 }, 645 },
635}; 646};
636 647
@@ -666,8 +677,6 @@ static void __init s3c2412_clk_initparents(void)
666static struct clk *clks[] __initdata = { 677static struct clk *clks[] __initdata = {
667 &clk_ext, 678 &clk_ext,
668 &clk_usb_bus, 679 &clk_usb_bus,
669 &clk_erefclk,
670 &clk_urefclk,
671 &clk_mrefclk, 680 &clk_mrefclk,
672 &clk_armclk, 681 &clk_armclk,
673}; 682};
diff --git a/arch/arm/mach-s3c2412/mach-jive.c b/arch/arm/mach-s3c2412/mach-jive.c
new file mode 100644
index 000000000000..7f5924713485
--- /dev/null
+++ b/arch/arm/mach-s3c2412/mach-jive.c
@@ -0,0 +1,687 @@
1/* linux/arch/arm/mach-s3c2410/mach-jive.c
2 *
3 * Copyright 2007 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
5 *
6 * http://armlinux.simtec.co.uk/
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#include <linux/kernel.h>
14#include <linux/types.h>
15#include <linux/interrupt.h>
16#include <linux/list.h>
17#include <linux/timer.h>
18#include <linux/init.h>
19#include <linux/sysdev.h>
20#include <linux/delay.h>
21#include <linux/serial_core.h>
22#include <linux/platform_device.h>
23#include <linux/i2c.h>
24
25#include <video/ili9320.h>
26
27#include <linux/spi/spi.h>
28
29#include <linux/mtd/mtd.h>
30#include <linux/mtd/partitions.h>
31
32#include <asm/mach/arch.h>
33#include <asm/mach/map.h>
34#include <asm/mach/irq.h>
35
36#include <asm/plat-s3c/regs-serial.h>
37#include <asm/plat-s3c/nand.h>
38#include <asm/plat-s3c/iic.h>
39
40#include <asm/arch/regs-power.h>
41#include <asm/arch/regs-gpio.h>
42#include <asm/arch/regs-mem.h>
43#include <asm/arch/regs-lcd.h>
44#include <asm/arch/spi-gpio.h>
45#include <asm/arch/fb.h>
46
47#include <asm/mach-types.h>
48
49#include <linux/mtd/mtd.h>
50#include <linux/mtd/nand.h>
51#include <linux/mtd/nand_ecc.h>
52#include <linux/mtd/partitions.h>
53
54#include <asm/plat-s3c24xx/clock.h>
55#include <asm/plat-s3c24xx/devs.h>
56#include <asm/plat-s3c24xx/cpu.h>
57#include <asm/plat-s3c24xx/pm.h>
58#include <asm/plat-s3c24xx/udc.h>
59
60static struct map_desc jive_iodesc[] __initdata = {
61};
62
63#define UCON S3C2410_UCON_DEFAULT
64#define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE
65#define UFCON S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE
66
67static struct s3c2410_uartcfg jive_uartcfgs[] = {
68 [0] = {
69 .hwport = 0,
70 .flags = 0,
71 .ucon = UCON,
72 .ulcon = ULCON,
73 .ufcon = UFCON,
74 },
75 [1] = {
76 .hwport = 1,
77 .flags = 0,
78 .ucon = UCON,
79 .ulcon = ULCON,
80 .ufcon = UFCON,
81 },
82 [2] = {
83 .hwport = 2,
84 .flags = 0,
85 .ucon = UCON,
86 .ulcon = ULCON,
87 .ufcon = UFCON,
88 }
89};
90
91/* Jive flash assignment
92 *
93 * 0x00000000-0x00028000 : uboot
94 * 0x00028000-0x0002c000 : uboot env
95 * 0x0002c000-0x00030000 : spare
96 * 0x00030000-0x00200000 : zimage A
97 * 0x00200000-0x01600000 : cramfs A
98 * 0x01600000-0x017d0000 : zimage B
99 * 0x017d0000-0x02bd0000 : cramfs B
100 * 0x02bd0000-0x03fd0000 : yaffs
101 */
102static struct mtd_partition jive_imageA_nand_part[] = {
103
104#ifdef CONFIG_MACH_JIVE_SHOW_BOOTLOADER
105 /* Don't allow access to the bootloader from linux */
106 {
107 .name = "uboot",
108 .offset = 0,
109 .size = (160 * SZ_1K),
110 .mask_flags = MTD_WRITEABLE, /* force read-only */
111 },
112
113 /* spare */
114 {
115 .name = "spare",
116 .offset = (176 * SZ_1K),
117 .size = (16 * SZ_1K),
118 },
119#endif
120
121 /* booted images */
122 {
123 .name = "kernel (ro)",
124 .offset = (192 * SZ_1K),
125 .size = (SZ_2M) - (192 * SZ_1K),
126 .mask_flags = MTD_WRITEABLE, /* force read-only */
127 }, {
128 .name = "root (ro)",
129 .offset = (SZ_2M),
130 .size = (20 * SZ_1M),
131 .mask_flags = MTD_WRITEABLE, /* force read-only */
132 },
133
134 /* yaffs */
135 {
136 .name = "yaffs",
137 .offset = (44 * SZ_1M),
138 .size = (20 * SZ_1M),
139 },
140
141 /* bootloader environment */
142 {
143 .name = "env",
144 .offset = (160 * SZ_1K),
145 .size = (16 * SZ_1K),
146 },
147
148 /* upgrade images */
149 {
150 .name = "zimage",
151 .offset = (22 * SZ_1M),
152 .size = (2 * SZ_1M) - (192 * SZ_1K),
153 }, {
154 .name = "cramfs",
155 .offset = (24 * SZ_1M) - (192*SZ_1K),
156 .size = (20 * SZ_1M),
157 },
158};
159
160static struct mtd_partition jive_imageB_nand_part[] = {
161
162#ifdef CONFIG_MACH_JIVE_SHOW_BOOTLOADER
163 /* Don't allow access to the bootloader from linux */
164 {
165 .name = "uboot",
166 .offset = 0,
167 .size = (160 * SZ_1K),
168 .mask_flags = MTD_WRITEABLE, /* force read-only */
169 },
170
171 /* spare */
172 {
173 .name = "spare",
174 .offset = (176 * SZ_1K),
175 .size = (16 * SZ_1K),
176 },
177#endif
178
179 /* booted images */
180 {
181 .name = "kernel (ro)",
182 .offset = (22 * SZ_1M),
183 .size = (2 * SZ_1M) - (192 * SZ_1K),
184 .mask_flags = MTD_WRITEABLE, /* force read-only */
185 },
186 {
187 .name = "root (ro)",
188 .offset = (24 * SZ_1M) - (192 * SZ_1K),
189 .size = (20 * SZ_1M),
190 .mask_flags = MTD_WRITEABLE, /* force read-only */
191 },
192
193 /* yaffs */
194 {
195 .name = "yaffs",
196 .offset = (44 * SZ_1M),
197 .size = (20 * SZ_1M),
198 },
199
200 /* bootloader environment */
201 {
202 .name = "env",
203 .offset = (160 * SZ_1K),
204 .size = (16 * SZ_1K),
205 },
206
207 /* upgrade images */
208 {
209 .name = "zimage",
210 .offset = (192 * SZ_1K),
211 .size = (2 * SZ_1M) - (192 * SZ_1K),
212 }, {
213 .name = "cramfs",
214 .offset = (2 * SZ_1M),
215 .size = (20 * SZ_1M),
216 },
217};
218
219static struct s3c2410_nand_set jive_nand_sets[] = {
220 [0] = {
221 .name = "flash",
222 .nr_chips = 1,
223 .nr_partitions = ARRAY_SIZE(jive_imageA_nand_part),
224 .partitions = jive_imageA_nand_part,
225 },
226};
227
228static struct s3c2410_platform_nand jive_nand_info = {
229 /* set taken from osiris nand timings, possibly still conservative */
230 .tacls = 30,
231 .twrph0 = 55,
232 .twrph1 = 40,
233 .sets = jive_nand_sets,
234 .nr_sets = ARRAY_SIZE(jive_nand_sets),
235};
236
237static int __init jive_mtdset(char *options)
238{
239 struct s3c2410_nand_set *nand = &jive_nand_sets[0];
240 unsigned long set;
241
242 if (options == NULL || options[0] == '\0')
243 return 0;
244
245 if (strict_strtoul(options, 10, &set)) {
246 printk(KERN_ERR "failed to parse mtdset=%s\n", options);
247 return 0;
248 }
249
250 switch (set) {
251 case 1:
252 nand->nr_partitions = ARRAY_SIZE(jive_imageB_nand_part);
253 nand->partitions = jive_imageB_nand_part;
254 case 0:
255 /* this is already setup in the nand info */
256 break;
257 default:
258 printk(KERN_ERR "Unknown mtd set %ld specified,"
259 "using default.", set);
260 }
261
262 return 0;
263}
264
265/* parse the mtdset= option given to the kernel command line */
266__setup("mtdset=", jive_mtdset);
267
268/* LCD timing and setup */
269
270#define LCD_XRES (240)
271#define LCD_YRES (320)
272#define LCD_LEFT_MARGIN (12)
273#define LCD_RIGHT_MARGIN (12)
274#define LCD_LOWER_MARGIN (12)
275#define LCD_UPPER_MARGIN (12)
276#define LCD_VSYNC (2)
277#define LCD_HSYNC (2)
278
279#define LCD_REFRESH (60)
280
281#define LCD_HTOT (LCD_HSYNC + LCD_LEFT_MARGIN + LCD_XRES + LCD_RIGHT_MARGIN)
282#define LCD_VTOT (LCD_VSYNC + LCD_LOWER_MARGIN + LCD_YRES + LCD_UPPER_MARGIN)
283
284struct s3c2410fb_display jive_vgg2432a4_display[] = {
285 [0] = {
286 .width = LCD_XRES,
287 .height = LCD_YRES,
288 .xres = LCD_XRES,
289 .yres = LCD_YRES,
290 .left_margin = LCD_LEFT_MARGIN,
291 .right_margin = LCD_RIGHT_MARGIN,
292 .upper_margin = LCD_UPPER_MARGIN,
293 .lower_margin = LCD_LOWER_MARGIN,
294 .hsync_len = LCD_HSYNC,
295 .vsync_len = LCD_VSYNC,
296
297 .pixclock = (1000000000000LL /
298 (LCD_REFRESH * LCD_HTOT * LCD_VTOT)),
299
300 .bpp = 16,
301 .type = (S3C2410_LCDCON1_TFT16BPP |
302 S3C2410_LCDCON1_TFT),
303
304 .lcdcon5 = (S3C2410_LCDCON5_FRM565 |
305 S3C2410_LCDCON5_INVVLINE |
306 S3C2410_LCDCON5_INVVFRAME |
307 S3C2410_LCDCON5_INVVDEN |
308 S3C2410_LCDCON5_PWREN),
309 },
310};
311
312/* todo - put into gpio header */
313
314#define S3C2410_GPCCON_MASK(x) (3 << ((x) * 2))
315#define S3C2410_GPDCON_MASK(x) (3 << ((x) * 2))
316
317struct s3c2410fb_mach_info jive_lcd_config = {
318 .displays = jive_vgg2432a4_display,
319 .num_displays = ARRAY_SIZE(jive_vgg2432a4_display),
320 .default_display = 0,
321
322 /* Enable VD[2..7], VD[10..15], VD[18..23] and VCLK, syncs, VDEN
323 * and disable the pull down resistors on pins we are using for LCD
324 * data. */
325
326 .gpcup = (0xf << 1) | (0x3f << 10),
327
328 .gpccon = (S3C2410_GPC1_VCLK | S3C2410_GPC2_VLINE |
329 S3C2410_GPC3_VFRAME | S3C2410_GPC4_VM |
330 S3C2410_GPC10_VD2 | S3C2410_GPC11_VD3 |
331 S3C2410_GPC12_VD4 | S3C2410_GPC13_VD5 |
332 S3C2410_GPC14_VD6 | S3C2410_GPC15_VD7),
333
334 .gpccon_mask = (S3C2410_GPCCON_MASK(1) | S3C2410_GPCCON_MASK(2) |
335 S3C2410_GPCCON_MASK(3) | S3C2410_GPCCON_MASK(4) |
336 S3C2410_GPCCON_MASK(10) | S3C2410_GPCCON_MASK(11) |
337 S3C2410_GPCCON_MASK(12) | S3C2410_GPCCON_MASK(13) |
338 S3C2410_GPCCON_MASK(14) | S3C2410_GPCCON_MASK(15)),
339
340 .gpdup = (0x3f << 2) | (0x3f << 10),
341
342 .gpdcon = (S3C2410_GPD2_VD10 | S3C2410_GPD3_VD11 |
343 S3C2410_GPD4_VD12 | S3C2410_GPD5_VD13 |
344 S3C2410_GPD6_VD14 | S3C2410_GPD7_VD15 |
345 S3C2410_GPD10_VD18 | S3C2410_GPD11_VD19 |
346 S3C2410_GPD12_VD20 | S3C2410_GPD13_VD21 |
347 S3C2410_GPD14_VD22 | S3C2410_GPD15_VD23),
348
349 .gpdcon_mask = (S3C2410_GPDCON_MASK(2) | S3C2410_GPDCON_MASK(3) |
350 S3C2410_GPDCON_MASK(4) | S3C2410_GPDCON_MASK(5) |
351 S3C2410_GPDCON_MASK(6) | S3C2410_GPDCON_MASK(7) |
352 S3C2410_GPDCON_MASK(10) | S3C2410_GPDCON_MASK(11)|
353 S3C2410_GPDCON_MASK(12) | S3C2410_GPDCON_MASK(13)|
354 S3C2410_GPDCON_MASK(14) | S3C2410_GPDCON_MASK(15)),
355};
356
357/* ILI9320 support. */
358
359static void jive_lcm_reset(unsigned int set)
360{
361 printk(KERN_DEBUG "%s(%d)\n", __func__, set);
362
363 s3c2410_gpio_setpin(S3C2410_GPG13, set);
364 s3c2410_gpio_cfgpin(S3C2410_GPG13, S3C2410_GPIO_OUTPUT);
365}
366
367#undef LCD_UPPER_MARGIN
368#define LCD_UPPER_MARGIN 2
369
370static struct ili9320_platdata jive_lcm_config = {
371 .hsize = LCD_XRES,
372 .vsize = LCD_YRES,
373
374 .reset = jive_lcm_reset,
375 .suspend = ILI9320_SUSPEND_DEEP,
376
377 .entry_mode = ILI9320_ENTRYMODE_ID(3) | ILI9320_ENTRYMODE_BGR,
378 .display2 = (ILI9320_DISPLAY2_FP(LCD_UPPER_MARGIN) |
379 ILI9320_DISPLAY2_BP(LCD_LOWER_MARGIN)),
380 .display3 = 0x0,
381 .display4 = 0x0,
382 .rgb_if1 = (ILI9320_RGBIF1_RIM_RGB18 |
383 ILI9320_RGBIF1_RM | ILI9320_RGBIF1_CLK_RGBIF),
384 .rgb_if2 = ILI9320_RGBIF2_DPL,
385 .interface2 = 0x0,
386 .interface3 = 0x3,
387 .interface4 = (ILI9320_INTERFACE4_RTNE(16) |
388 ILI9320_INTERFACE4_DIVE(1)),
389 .interface5 = 0x0,
390 .interface6 = 0x0,
391};
392
393/* LCD SPI support */
394
395static void jive_lcd_spi_chipselect(struct s3c2410_spigpio_info *spi, int cs)
396{
397 s3c2410_gpio_setpin(S3C2410_GPB7, cs ? 0 : 1);
398}
399
400static struct s3c2410_spigpio_info jive_lcd_spi = {
401 .bus_num = 0,
402 .pin_clk = S3C2410_GPG8,
403 .pin_mosi = S3C2410_GPB8,
404 .chip_select = jive_lcd_spi_chipselect,
405};
406
407static struct platform_device jive_device_lcdspi = {
408 .name = "s3c24xx-spi-gpio",
409 .id = 1,
410 .num_resources = 0,
411 .dev.platform_data = &jive_lcd_spi,
412};
413
414/* WM8750 audio code SPI definition */
415
416static void jive_wm8750_chipselect(struct s3c2410_spigpio_info *spi, int cs)
417{
418 s3c2410_gpio_setpin(S3C2410_GPH10, cs ? 0 : 1);
419}
420
421static struct s3c2410_spigpio_info jive_wm8750_spi = {
422 .bus_num = 2,
423 .pin_clk = S3C2410_GPB4,
424 .pin_mosi = S3C2410_GPB9,
425 .chip_select = jive_wm8750_chipselect,
426};
427
428static struct platform_device jive_device_wm8750 = {
429 .name = "s3c24xx-spi-gpio",
430 .id = 2,
431 .num_resources = 0,
432 .dev.platform_data = &jive_wm8750_spi,
433};
434
435/* JIVE SPI devices. */
436
437static struct spi_board_info __initdata jive_spi_devs[] = {
438 [0] = {
439 .modalias = "VGG2432A4",
440 .bus_num = 1,
441 .chip_select = 0,
442 .mode = SPI_MODE_3, /* CPOL=1, CPHA=1 */
443 .max_speed_hz = 100000,
444 .platform_data = &jive_lcm_config,
445 }, {
446 .modalias = "WM8750",
447 .bus_num = 2,
448 .chip_select = 0,
449 .mode = SPI_MODE_0, /* CPOL=0, CPHA=0 */
450 .max_speed_hz = 100000,
451 },
452};
453
454/* I2C bus and device configuration. */
455
456static struct s3c2410_platform_i2c jive_i2c_cfg = {
457 .max_freq = 80 * 1000,
458 .bus_freq = 50 * 1000,
459 .flags = S3C_IICFLG_FILTER,
460 .sda_delay = 2,
461};
462
463static struct i2c_board_info jive_i2c_devs[] = {
464 [0] = {
465 I2C_BOARD_INFO("lis302dl", 0x1c),
466 .irq = IRQ_EINT14,
467 },
468};
469
470/* The platform devices being used. */
471
472static struct platform_device *jive_devices[] __initdata = {
473 &s3c_device_usb,
474 &s3c_device_rtc,
475 &s3c_device_wdt,
476 &s3c_device_i2c,
477 &s3c_device_lcd,
478 &jive_device_lcdspi,
479 &jive_device_wm8750,
480 &s3c_device_nand,
481 &s3c_device_usbgadget,
482};
483
484static struct s3c2410_udc_mach_info jive_udc_cfg __initdata = {
485 .vbus_pin = S3C2410_GPG1, /* detect is on GPG1 */
486};
487
488/* Jive power management device */
489
490#ifdef CONFIG_PM
491static int jive_pm_suspend(struct sys_device *sd, pm_message_t state)
492{
493 /* Write the magic value u-boot uses to check for resume into
494 * the INFORM0 register, and ensure INFORM1 is set to the
495 * correct address to resume from. */
496
497 __raw_writel(0x2BED, S3C2412_INFORM0);
498 __raw_writel(virt_to_phys(s3c2410_cpu_resume), S3C2412_INFORM1);
499
500 return 0;
501}
502
503static int jive_pm_resume(struct sys_device *sd)
504{
505 __raw_writel(0x0, S3C2412_INFORM0);
506 return 0;
507}
508
509#else
510#define jive_pm_suspend NULL
511#define jive_pm_resume NULL
512#endif
513
514static struct sysdev_class jive_pm_sysclass = {
515 .name = "jive-pm",
516 .suspend = jive_pm_suspend,
517 .resume = jive_pm_resume,
518};
519
520static struct sys_device jive_pm_sysdev = {
521 .cls = &jive_pm_sysclass,
522};
523
524static void __init jive_map_io(void)
525{
526 s3c24xx_init_io(jive_iodesc, ARRAY_SIZE(jive_iodesc));
527 s3c24xx_init_clocks(12000000);
528 s3c24xx_init_uarts(jive_uartcfgs, ARRAY_SIZE(jive_uartcfgs));
529}
530
531static void jive_power_off(void)
532{
533 printk(KERN_INFO "powering system down...\n");
534
535 s3c2410_gpio_setpin(S3C2410_GPC5, 1);
536 s3c2410_gpio_cfgpin(S3C2410_GPC5, S3C2410_GPIO_OUTPUT);
537}
538
539static void __init jive_machine_init(void)
540{
541 /* register system devices for managing low level suspend */
542
543 sysdev_class_register(&jive_pm_sysclass);
544 sysdev_register(&jive_pm_sysdev);
545
546 /* write our sleep configurations for the IO. Pull down all unused
547 * IO, ensure that we have turned off all peripherals we do not
548 * need, and configure the ones we do need. */
549
550 /* Port B sleep */
551
552 __raw_writel(S3C2412_SLPCON_IN(0) |
553 S3C2412_SLPCON_PULL(1) |
554 S3C2412_SLPCON_HIGH(2) |
555 S3C2412_SLPCON_PULL(3) |
556 S3C2412_SLPCON_PULL(4) |
557 S3C2412_SLPCON_PULL(5) |
558 S3C2412_SLPCON_PULL(6) |
559 S3C2412_SLPCON_HIGH(7) |
560 S3C2412_SLPCON_PULL(8) |
561 S3C2412_SLPCON_PULL(9) |
562 S3C2412_SLPCON_PULL(10), S3C2412_GPBSLPCON);
563
564 /* Port C sleep */
565
566 __raw_writel(S3C2412_SLPCON_PULL(0) |
567 S3C2412_SLPCON_PULL(1) |
568 S3C2412_SLPCON_PULL(2) |
569 S3C2412_SLPCON_PULL(3) |
570 S3C2412_SLPCON_PULL(4) |
571 S3C2412_SLPCON_PULL(5) |
572 S3C2412_SLPCON_LOW(6) |
573 S3C2412_SLPCON_PULL(6) |
574 S3C2412_SLPCON_PULL(7) |
575 S3C2412_SLPCON_PULL(8) |
576 S3C2412_SLPCON_PULL(9) |
577 S3C2412_SLPCON_PULL(10) |
578 S3C2412_SLPCON_PULL(11) |
579 S3C2412_SLPCON_PULL(12) |
580 S3C2412_SLPCON_PULL(13) |
581 S3C2412_SLPCON_PULL(14) |
582 S3C2412_SLPCON_PULL(15), S3C2412_GPCSLPCON);
583
584 /* Port D sleep */
585
586 __raw_writel(S3C2412_SLPCON_ALL_PULL, S3C2412_GPDSLPCON);
587
588 /* Port F sleep */
589
590 __raw_writel(S3C2412_SLPCON_LOW(0) |
591 S3C2412_SLPCON_LOW(1) |
592 S3C2412_SLPCON_LOW(2) |
593 S3C2412_SLPCON_EINT(3) |
594 S3C2412_SLPCON_EINT(4) |
595 S3C2412_SLPCON_EINT(5) |
596 S3C2412_SLPCON_EINT(6) |
597 S3C2412_SLPCON_EINT(7), S3C2412_GPFSLPCON);
598
599 /* Port G sleep */
600
601 __raw_writel(S3C2412_SLPCON_IN(0) |
602 S3C2412_SLPCON_IN(1) |
603 S3C2412_SLPCON_IN(2) |
604 S3C2412_SLPCON_IN(3) |
605 S3C2412_SLPCON_IN(4) |
606 S3C2412_SLPCON_IN(5) |
607 S3C2412_SLPCON_IN(6) |
608 S3C2412_SLPCON_IN(7) |
609 S3C2412_SLPCON_PULL(8) |
610 S3C2412_SLPCON_PULL(9) |
611 S3C2412_SLPCON_IN(10) |
612 S3C2412_SLPCON_PULL(11) |
613 S3C2412_SLPCON_PULL(12) |
614 S3C2412_SLPCON_PULL(13) |
615 S3C2412_SLPCON_IN(14) |
616 S3C2412_SLPCON_PULL(15), S3C2412_GPGSLPCON);
617
618 /* Port H sleep */
619
620 __raw_writel(S3C2412_SLPCON_PULL(0) |
621 S3C2412_SLPCON_PULL(1) |
622 S3C2412_SLPCON_PULL(2) |
623 S3C2412_SLPCON_PULL(3) |
624 S3C2412_SLPCON_PULL(4) |
625 S3C2412_SLPCON_PULL(5) |
626 S3C2412_SLPCON_PULL(6) |
627 S3C2412_SLPCON_IN(7) |
628 S3C2412_SLPCON_IN(8) |
629 S3C2412_SLPCON_PULL(9) |
630 S3C2412_SLPCON_IN(10), S3C2412_GPHSLPCON);
631
632 /* initialise the power management now we've setup everything. */
633
634 s3c2410_pm_init();
635
636 s3c_device_nand.dev.platform_data = &jive_nand_info;
637
638 /* initialise the spi */
639
640 s3c2410_gpio_setpin(S3C2410_GPG13, 0);
641 s3c2410_gpio_cfgpin(S3C2410_GPG13, S3C2410_GPIO_OUTPUT);
642
643 s3c2410_gpio_setpin(S3C2410_GPB7, 1);
644 s3c2410_gpio_cfgpin(S3C2410_GPB7, S3C2410_GPIO_OUTPUT);
645
646 s3c2410_gpio_setpin(S3C2410_GPB6, 0);
647 s3c2410_gpio_cfgpin(S3C2410_GPB6, S3C2410_GPIO_OUTPUT);
648
649 s3c2410_gpio_setpin(S3C2410_GPG8, 1);
650 s3c2410_gpio_cfgpin(S3C2410_GPG8, S3C2410_GPIO_OUTPUT);
651
652 /* initialise the WM8750 spi */
653
654 s3c2410_gpio_setpin(S3C2410_GPH10, 1);
655 s3c2410_gpio_cfgpin(S3C2410_GPH10, S3C2410_GPIO_OUTPUT);
656
657 /* Turn off suspend on both USB ports, and switch the
658 * selectable USB port to USB device mode. */
659
660 s3c2410_modify_misccr(S3C2410_MISCCR_USBHOST |
661 S3C2410_MISCCR_USBSUSPND0 |
662 S3C2410_MISCCR_USBSUSPND1, 0x0);
663
664 s3c24xx_udc_set_platdata(&jive_udc_cfg);
665 s3c24xx_fb_set_platdata(&jive_lcd_config);
666
667 spi_register_board_info(jive_spi_devs, ARRAY_SIZE(jive_spi_devs));
668
669 s3c_device_i2c.dev.platform_data = &jive_i2c_cfg;
670 i2c_register_board_info(0, jive_i2c_devs, ARRAY_SIZE(jive_i2c_devs));
671
672 pm_power_off = jive_power_off;
673
674 platform_add_devices(jive_devices, ARRAY_SIZE(jive_devices));
675}
676
677MACHINE_START(JIVE, "JIVE")
678 /* Maintainer: Ben Dooks <ben@fluff.org> */
679 .phys_io = S3C2410_PA_UART,
680 .io_pg_offst = (((u32)S3C24XX_VA_UART) >> 18) & 0xfffc,
681 .boot_params = S3C2410_SDRAM_PA + 0x100,
682
683 .init_irq = s3c24xx_init_irq,
684 .map_io = jive_map_io,
685 .init_machine = jive_machine_init,
686 .timer = &s3c24xx_timer,
687MACHINE_END
diff --git a/arch/arm/mach-s3c2440/Kconfig b/arch/arm/mach-s3c2440/Kconfig
index f1915bd61d15..25de042ab996 100644
--- a/arch/arm/mach-s3c2440/Kconfig
+++ b/arch/arm/mach-s3c2440/Kconfig
@@ -29,6 +29,7 @@ config MACH_ANUBIS
29 bool "Simtec Electronics ANUBIS" 29 bool "Simtec Electronics ANUBIS"
30 select CPU_S3C2440 30 select CPU_S3C2440
31 select PM_SIMTEC if PM 31 select PM_SIMTEC if PM
32 select HAVE_PATA_PLATFORM
32 help 33 help
33 Say Y here if you are using the Simtec Electronics ANUBIS 34 Say Y here if you are using the Simtec Electronics ANUBIS
34 development system 35 development system
@@ -67,6 +68,11 @@ config SMDK2440_CPU2440
67 default y if ARCH_S3C2440 68 default y if ARCH_S3C2440
68 select CPU_S3C2440 69 select CPU_S3C2440
69 70
71config MACH_AT2440EVB
72 bool "Avantech AT2440EVB development board"
73 select CPU_S3C2440
74 help
75 Say Y here if you are using the AT2440EVB development board
70 76
71endmenu 77endmenu
72 78
diff --git a/arch/arm/mach-s3c2440/Makefile b/arch/arm/mach-s3c2440/Makefile
index c81ed6248dcb..0b4440e79b90 100644
--- a/arch/arm/mach-s3c2440/Makefile
+++ b/arch/arm/mach-s3c2440/Makefile
@@ -21,3 +21,4 @@ obj-$(CONFIG_MACH_OSIRIS) += mach-osiris.o
21obj-$(CONFIG_MACH_RX3715) += mach-rx3715.o 21obj-$(CONFIG_MACH_RX3715) += mach-rx3715.o
22obj-$(CONFIG_ARCH_S3C2440) += mach-smdk2440.o 22obj-$(CONFIG_ARCH_S3C2440) += mach-smdk2440.o
23obj-$(CONFIG_MACH_NEXCODER_2440) += mach-nexcoder.o 23obj-$(CONFIG_MACH_NEXCODER_2440) += mach-nexcoder.o
24obj-$(CONFIG_MACH_AT2440EVB) += mach-at2440evb.o
diff --git a/arch/arm/mach-s3c2440/mach-anubis.c b/arch/arm/mach-s3c2440/mach-anubis.c
index 47258915a2f9..09af8b23500b 100644
--- a/arch/arm/mach-s3c2440/mach-anubis.c
+++ b/arch/arm/mach-s3c2440/mach-anubis.c
@@ -1,6 +1,6 @@
1/* linux/arch/arm/mach-s3c2440/mach-anubis.c 1/* linux/arch/arm/mach-s3c2440/mach-anubis.c
2 * 2 *
3 * Copyright (c) 2003-2005 Simtec Electronics 3 * Copyright (c) 2003-2005,2008 Simtec Electronics
4 * http://armlinux.simtec.co.uk/ 4 * http://armlinux.simtec.co.uk/
5 * Ben Dooks <ben@simtec.co.uk> 5 * Ben Dooks <ben@simtec.co.uk>
6 * 6 *
@@ -17,6 +17,8 @@
17#include <linux/init.h> 17#include <linux/init.h>
18#include <linux/serial_core.h> 18#include <linux/serial_core.h>
19#include <linux/platform_device.h> 19#include <linux/platform_device.h>
20#include <linux/ata_platform.h>
21#include <linux/i2c.h>
20 22
21#include <linux/sm501.h> 23#include <linux/sm501.h>
22#include <linux/sm501-regs.h> 24#include <linux/sm501-regs.h>
@@ -241,14 +243,18 @@ static struct s3c2410_platform_nand anubis_nand_info = {
241 243
242/* IDE channels */ 244/* IDE channels */
243 245
246struct pata_platform_info anubis_ide_platdata = {
247 .ioport_shift = 5,
248};
249
244static struct resource anubis_ide0_resource[] = { 250static struct resource anubis_ide0_resource[] = {
245 { 251 {
246 .start = S3C2410_CS3, 252 .start = S3C2410_CS3,
247 .end = S3C2410_CS3 + (8*32) - 1, 253 .end = S3C2410_CS3 + (8*32) - 1,
248 .flags = IORESOURCE_MEM, 254 .flags = IORESOURCE_MEM,
249 }, { 255 }, {
250 .start = S3C2410_CS3 + (1<<26), 256 .start = S3C2410_CS3 + (1<<26) + (6*32),
251 .end = S3C2410_CS3 + (1<<26) + (8*32) - 1, 257 .end = S3C2410_CS3 + (1<<26) + (7*32) - 1,
252 .flags = IORESOURCE_MEM, 258 .flags = IORESOURCE_MEM,
253 }, { 259 }, {
254 .start = IRQ_IDE0, 260 .start = IRQ_IDE0,
@@ -258,10 +264,14 @@ static struct resource anubis_ide0_resource[] = {
258}; 264};
259 265
260static struct platform_device anubis_device_ide0 = { 266static struct platform_device anubis_device_ide0 = {
261 .name = "simtec-ide", 267 .name = "pata_platform",
262 .id = 0, 268 .id = 0,
263 .num_resources = ARRAY_SIZE(anubis_ide0_resource), 269 .num_resources = ARRAY_SIZE(anubis_ide0_resource),
264 .resource = anubis_ide0_resource, 270 .resource = anubis_ide0_resource,
271 .dev = {
272 .platform_data = &anubis_ide_platdata,
273 .coherent_dma_mask = ~0,
274 },
265}; 275};
266 276
267static struct resource anubis_ide1_resource[] = { 277static struct resource anubis_ide1_resource[] = {
@@ -270,8 +280,8 @@ static struct resource anubis_ide1_resource[] = {
270 .end = S3C2410_CS4 + (8*32) - 1, 280 .end = S3C2410_CS4 + (8*32) - 1,
271 .flags = IORESOURCE_MEM, 281 .flags = IORESOURCE_MEM,
272 }, { 282 }, {
273 .start = S3C2410_CS4 + (1<<26), 283 .start = S3C2410_CS4 + (1<<26) + (6*32),
274 .end = S3C2410_CS4 + (1<<26) + (8*32) - 1, 284 .end = S3C2410_CS4 + (1<<26) + (7*32) - 1,
275 .flags = IORESOURCE_MEM, 285 .flags = IORESOURCE_MEM,
276 }, { 286 }, {
277 .start = IRQ_IDE0, 287 .start = IRQ_IDE0,
@@ -280,12 +290,15 @@ static struct resource anubis_ide1_resource[] = {
280 }, 290 },
281}; 291};
282 292
283
284static struct platform_device anubis_device_ide1 = { 293static struct platform_device anubis_device_ide1 = {
285 .name = "simtec-ide", 294 .name = "pata_platform",
286 .id = 1, 295 .id = 1,
287 .num_resources = ARRAY_SIZE(anubis_ide1_resource), 296 .num_resources = ARRAY_SIZE(anubis_ide1_resource),
288 .resource = anubis_ide1_resource, 297 .resource = anubis_ide1_resource,
298 .dev = {
299 .platform_data = &anubis_ide_platdata,
300 .coherent_dma_mask = ~0,
301 },
289}; 302};
290 303
291/* Asix AX88796 10/100 ethernet controller */ 304/* Asix AX88796 10/100 ethernet controller */
@@ -409,6 +422,15 @@ static struct clk *anubis_clocks[] = {
409 &s3c24xx_uclk, 422 &s3c24xx_uclk,
410}; 423};
411 424
425/* I2C devices. */
426
427static struct i2c_board_info anubis_i2c_devs[] __initdata = {
428 {
429 I2C_BOARD_INFO("tps65011", 0x48),
430 .irq = IRQ_EINT20,
431 }
432};
433
412static void __init anubis_map_io(void) 434static void __init anubis_map_io(void)
413{ 435{
414 /* initialise the clocks */ 436 /* initialise the clocks */
@@ -448,6 +470,9 @@ static void __init anubis_map_io(void)
448static void __init anubis_init(void) 470static void __init anubis_init(void)
449{ 471{
450 platform_add_devices(anubis_devices, ARRAY_SIZE(anubis_devices)); 472 platform_add_devices(anubis_devices, ARRAY_SIZE(anubis_devices));
473
474 i2c_register_board_info(0, anubis_i2c_devs,
475 ARRAY_SIZE(anubis_i2c_devs));
451} 476}
452 477
453 478
diff --git a/arch/arm/mach-s3c2440/mach-at2440evb.c b/arch/arm/mach-s3c2440/mach-at2440evb.c
new file mode 100644
index 000000000000..f5e3c7f27639
--- /dev/null
+++ b/arch/arm/mach-s3c2440/mach-at2440evb.c
@@ -0,0 +1,198 @@
1/* linux/arch/arm/mach-s3c2440/mach-at2440evb.c
2 *
3 * Copyright (c) 2008 Ramax Lo <ramaxlo@gmail.com>
4 * Based on mach-anubis.c by Ben Dooks <ben@simtec.co.uk>
5 * and modifications by SBZ <sbz@spgui.org> and
6 * Weibing <http://weibing.blogbus.com>
7 *
8 * For product information, visit http://www.arm9e.com/
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 version 2 as
12 * published by the Free Software Foundation.
13*/
14
15#include <linux/kernel.h>
16#include <linux/types.h>
17#include <linux/interrupt.h>
18#include <linux/list.h>
19#include <linux/timer.h>
20#include <linux/init.h>
21#include <linux/io.h>
22#include <linux/serial_core.h>
23#include <linux/dm9000.h>
24#include <linux/platform_device.h>
25
26#include <asm/mach/arch.h>
27#include <asm/mach/map.h>
28#include <asm/mach/irq.h>
29
30#include <asm/hardware.h>
31#include <asm/irq.h>
32#include <asm/mach-types.h>
33
34#include <asm/plat-s3c/regs-serial.h>
35#include <asm/arch/regs-gpio.h>
36#include <asm/arch/regs-mem.h>
37#include <asm/arch/regs-lcd.h>
38#include <asm/plat-s3c/nand.h>
39
40#include <linux/mtd/mtd.h>
41#include <linux/mtd/nand.h>
42#include <linux/mtd/nand_ecc.h>
43#include <linux/mtd/partitions.h>
44
45#include <asm/plat-s3c24xx/clock.h>
46#include <asm/plat-s3c24xx/devs.h>
47#include <asm/plat-s3c24xx/cpu.h>
48
49static struct map_desc at2440evb_iodesc[] __initdata = {
50 /* Nothing here */
51};
52
53#define UCON S3C2410_UCON_DEFAULT
54#define ULCON (S3C2410_LCON_CS8 | S3C2410_LCON_PNONE)
55#define UFCON (S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE)
56
57static struct s3c24xx_uart_clksrc at2440evb_serial_clocks[] = {
58 [0] = {
59 .name = "uclk",
60 .divisor = 1,
61 .min_baud = 0,
62 .max_baud = 0,
63 },
64 [1] = {
65 .name = "pclk",
66 .divisor = 1,
67 .min_baud = 0,
68 .max_baud = 0,
69 }
70};
71
72
73static struct s3c2410_uartcfg at2440evb_uartcfgs[] __initdata = {
74 [0] = {
75 .hwport = 0,
76 .flags = 0,
77 .ucon = UCON,
78 .ulcon = ULCON,
79 .ufcon = UFCON,
80 .clocks = at2440evb_serial_clocks,
81 .clocks_size = ARRAY_SIZE(at2440evb_serial_clocks),
82 },
83 [1] = {
84 .hwport = 1,
85 .flags = 0,
86 .ucon = UCON,
87 .ulcon = ULCON,
88 .ufcon = UFCON,
89 .clocks = at2440evb_serial_clocks,
90 .clocks_size = ARRAY_SIZE(at2440evb_serial_clocks),
91 },
92};
93
94/* NAND Flash on AT2440EVB board */
95
96static struct mtd_partition at2440evb_default_nand_part[] = {
97 [0] = {
98 .name = "Boot Agent",
99 .size = SZ_256K,
100 .offset = 0,
101 },
102 [1] = {
103 .name = "Kernel",
104 .size = SZ_2M,
105 .offset = SZ_256K,
106 },
107 [2] = {
108 .name = "Root",
109 .offset = SZ_256K + SZ_2M,
110 .size = MTDPART_SIZ_FULL,
111 },
112};
113
114static struct s3c2410_nand_set at2440evb_nand_sets[] = {
115 [0] = {
116 .name = "nand",
117 .nr_chips = 1,
118 .nr_partitions = ARRAY_SIZE(at2440evb_default_nand_part),
119 .partitions = at2440evb_default_nand_part,
120 },
121};
122
123static struct s3c2410_platform_nand at2440evb_nand_info = {
124 .tacls = 25,
125 .twrph0 = 55,
126 .twrph1 = 40,
127 .nr_sets = ARRAY_SIZE(at2440evb_nand_sets),
128 .sets = at2440evb_nand_sets,
129};
130
131/* DM9000AEP 10/100 ethernet controller */
132
133static struct resource at2440evb_dm9k_resource[] = {
134 [0] = {
135 .start = S3C2410_CS3,
136 .end = S3C2410_CS3 + 3,
137 .flags = IORESOURCE_MEM
138 },
139 [1] = {
140 .start = S3C2410_CS3 + 4,
141 .end = S3C2410_CS3 + 7,
142 .flags = IORESOURCE_MEM
143 },
144 [2] = {
145 .start = IRQ_EINT7,
146 .end = IRQ_EINT7,
147 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
148 }
149};
150
151static struct dm9000_plat_data at2440evb_dm9k_pdata = {
152 .flags = (DM9000_PLATF_16BITONLY | DM9000_PLATF_NO_EEPROM),
153};
154
155static struct platform_device at2440evb_device_eth = {
156 .name = "dm9000",
157 .id = -1,
158 .num_resources = ARRAY_SIZE(at2440evb_dm9k_resource),
159 .resource = at2440evb_dm9k_resource,
160 .dev = {
161 .platform_data = &at2440evb_dm9k_pdata,
162 },
163};
164
165static struct platform_device *at2440evb_devices[] __initdata = {
166 &s3c_device_usb,
167 &s3c_device_wdt,
168 &s3c_device_adc,
169 &s3c_device_i2c,
170 &s3c_device_rtc,
171 &s3c_device_nand,
172 &at2440evb_device_eth,
173};
174
175static void __init at2440evb_map_io(void)
176{
177 s3c_device_nand.dev.platform_data = &at2440evb_nand_info;
178
179 s3c24xx_init_io(at2440evb_iodesc, ARRAY_SIZE(at2440evb_iodesc));
180 s3c24xx_init_clocks(16934400);
181 s3c24xx_init_uarts(at2440evb_uartcfgs, ARRAY_SIZE(at2440evb_uartcfgs));
182}
183
184static void __init at2440evb_init(void)
185{
186 platform_add_devices(at2440evb_devices, ARRAY_SIZE(at2440evb_devices));
187}
188
189
190MACHINE_START(AT2440EVB, "AT2440EVB")
191 .phys_io = S3C2410_PA_UART,
192 .io_pg_offst = (((u32)S3C24XX_VA_UART) >> 18) & 0xfffc,
193 .boot_params = S3C2410_SDRAM_PA + 0x100,
194 .map_io = at2440evb_map_io,
195 .init_machine = at2440evb_init,
196 .init_irq = s3c24xx_init_irq,
197 .timer = &s3c24xx_timer,
198MACHINE_END
diff --git a/arch/arm/mach-s3c2440/mach-osiris.c b/arch/arm/mach-s3c2440/mach-osiris.c
index 8a8acdbd072d..af996b0e91e8 100644
--- a/arch/arm/mach-s3c2440/mach-osiris.c
+++ b/arch/arm/mach-s3c2440/mach-osiris.c
@@ -1,6 +1,6 @@
1/* linux/arch/arm/mach-s3c2440/mach-osiris.c 1/* linux/arch/arm/mach-s3c2440/mach-osiris.c
2 * 2 *
3 * Copyright (c) 2005 Simtec Electronics 3 * Copyright (c) 2005,2008 Simtec Electronics
4 * http://armlinux.simtec.co.uk/ 4 * http://armlinux.simtec.co.uk/
5 * Ben Dooks <ben@simtec.co.uk> 5 * Ben Dooks <ben@simtec.co.uk>
6 * 6 *
@@ -19,6 +19,7 @@
19#include <linux/sysdev.h> 19#include <linux/sysdev.h>
20#include <linux/serial_core.h> 20#include <linux/serial_core.h>
21#include <linux/clk.h> 21#include <linux/clk.h>
22#include <linux/i2c.h>
22 23
23#include <asm/mach/arch.h> 24#include <asm/mach/arch.h>
24#include <asm/mach/map.h> 25#include <asm/mach/map.h>
@@ -322,6 +323,15 @@ static struct sys_device osiris_pm_sysdev = {
322 .cls = &osiris_pm_sysclass, 323 .cls = &osiris_pm_sysclass,
323}; 324};
324 325
326/* I2C devices fitted. */
327
328static struct i2c_board_info osiris_i2c_devs[] __initdata = {
329 {
330 I2C_BOARD_INFO("tps65011", 0x48),
331 .irq = IRQ_EINT20,
332 },
333};
334
325/* Standard Osiris devices */ 335/* Standard Osiris devices */
326 336
327static struct platform_device *osiris_devices[] __initdata = { 337static struct platform_device *osiris_devices[] __initdata = {
@@ -388,6 +398,9 @@ static void __init osiris_init(void)
388 sysdev_class_register(&osiris_pm_sysclass); 398 sysdev_class_register(&osiris_pm_sysclass);
389 sysdev_register(&osiris_pm_sysdev); 399 sysdev_register(&osiris_pm_sysdev);
390 400
401 i2c_register_board_info(0, osiris_i2c_devs,
402 ARRAY_SIZE(osiris_i2c_devs));
403
391 platform_add_devices(osiris_devices, ARRAY_SIZE(osiris_devices)); 404 platform_add_devices(osiris_devices, ARRAY_SIZE(osiris_devices));
392}; 405};
393 406
diff --git a/arch/arm/mach-s3c2443/clock.c b/arch/arm/mach-s3c2443/clock.c
index b42f956738d0..17f064fabdaf 100644
--- a/arch/arm/mach-s3c2443/clock.c
+++ b/arch/arm/mach-s3c2443/clock.c
@@ -81,7 +81,7 @@ static int s3c2443_clkcon_enable_p(struct clk *clk, int enable)
81 else 81 else
82 clkcon &= ~clocks; 82 clkcon &= ~clocks;
83 83
84 __raw_writel(clkcon, S3C2443_HCLKCON); 84 __raw_writel(clkcon, S3C2443_PCLKCON);
85 85
86 return 0; 86 return 0;
87} 87}
@@ -221,7 +221,6 @@ static struct clk clk_mdivclk = {
221 .get_rate = s3c2443_getrate_mdivclk, 221 .get_rate = s3c2443_getrate_mdivclk,
222}; 222};
223 223
224
225static int s3c2443_setparent_msysclk(struct clk *clk, struct clk *parent) 224static int s3c2443_setparent_msysclk(struct clk *clk, struct clk *parent)
226{ 225{
227 unsigned long clksrc = __raw_readl(S3C2443_CLKSRC); 226 unsigned long clksrc = __raw_readl(S3C2443_CLKSRC);
@@ -249,6 +248,46 @@ static struct clk clk_msysclk = {
249 .set_parent = s3c2443_setparent_msysclk, 248 .set_parent = s3c2443_setparent_msysclk,
250}; 249};
251 250
251/* armdiv
252 *
253 * this clock is sourced from msysclk and can have a number of
254 * divider values applied to it to then be fed into armclk.
255*/
256
257static struct clk clk_armdiv = {
258 .name = "armdiv",
259 .id = -1,
260 .parent = &clk_msysclk,
261};
262
263/* armclk
264 *
265 * this is the clock fed into the ARM core itself, either from
266 * armdiv or from hclk.
267 */
268
269static int s3c2443_setparent_armclk(struct clk *clk, struct clk *parent)
270{
271 unsigned long clkdiv0;
272
273 clkdiv0 = __raw_readl(S3C2443_CLKDIV0);
274
275 if (parent == &clk_armdiv)
276 clkdiv0 &= ~S3C2443_CLKDIV0_DVS;
277 else if (parent == &clk_h)
278 clkdiv0 |= S3C2443_CLKDIV0_DVS;
279 else
280 return -EINVAL;
281
282 __raw_writel(clkdiv0, S3C2443_CLKDIV0);
283 return 0;
284}
285
286static struct clk clk_arm = {
287 .name = "armclk",
288 .id = -1,
289 .set_parent = s3c2443_setparent_armclk,
290};
252 291
253/* esysclk 292/* esysclk
254 * 293 *
@@ -639,6 +678,29 @@ static struct clk clk_display = {
639 .round_rate = s3c2443_roundrate_clksrc256, 678 .round_rate = s3c2443_roundrate_clksrc256,
640}; 679};
641 680
681/* prediv
682 *
683 * this divides the msysclk down to pass to h/p/etc.
684 */
685
686static unsigned long s3c2443_prediv_getrate(struct clk *clk)
687{
688 unsigned long rate = clk_get_rate(clk->parent);
689 unsigned long clkdiv0 = __raw_readl(S3C2443_CLKDIV0);
690
691 clkdiv0 &= S3C2443_CLKDIV0_PREDIV_MASK;
692 clkdiv0 >>= S3C2443_CLKDIV0_PREDIV_SHIFT;
693
694 return rate / (clkdiv0 + 1);
695}
696
697static struct clk clk_prediv = {
698 .name = "prediv",
699 .id = -1,
700 .parent = &clk_msysclk,
701 .get_rate = s3c2443_prediv_getrate,
702};
703
642/* standard clock definitions */ 704/* standard clock definitions */
643 705
644static struct clk init_clocks_disable[] = { 706static struct clk init_clocks_disable[] = {
@@ -887,6 +949,15 @@ static void __init s3c2443_clk_initparents(void)
887 } 949 }
888 950
889 clk_init_set_parent(&clk_msysclk, parent); 951 clk_init_set_parent(&clk_msysclk, parent);
952
953 /* arm */
954
955 if (__raw_readl(S3C2443_CLKDIV0) & S3C2443_CLKDIV0_DVS)
956 parent = &clk_h;
957 else
958 parent = &clk_armdiv;
959
960 clk_init_set_parent(&clk_arm, parent);
890} 961}
891 962
892/* armdiv divisor table */ 963/* armdiv divisor table */
@@ -909,10 +980,9 @@ static inline unsigned int s3c2443_fclk_div(unsigned long clkcon0)
909 return armdiv[clkcon0 >> S3C2443_CLKDIV0_ARMDIV_SHIFT]; 980 return armdiv[clkcon0 >> S3C2443_CLKDIV0_ARMDIV_SHIFT];
910} 981}
911 982
912static inline unsigned long s3c2443_get_prediv(unsigned long clkcon0) 983static inline unsigned long s3c2443_get_hdiv(unsigned long clkcon0)
913{ 984{
914 clkcon0 &= S3C2443_CLKDIV0_PREDIV_MASK; 985 clkcon0 &= S3C2443_CLKDIV0_HCLKDIV_MASK;
915 clkcon0 >>= S3C2443_CLKDIV0_PREDIV_SHIFT;
916 986
917 return clkcon0 + 1; 987 return clkcon0 + 1;
918} 988}
@@ -936,6 +1006,9 @@ static struct clk *clks[] __initdata = {
936 &clk_hsspi, 1006 &clk_hsspi,
937 &clk_hsmmc_div, 1007 &clk_hsmmc_div,
938 &clk_hsmmc, 1008 &clk_hsmmc,
1009 &clk_armdiv,
1010 &clk_arm,
1011 &clk_prediv,
939}; 1012};
940 1013
941void __init s3c2443_init_clocks(int xtal) 1014void __init s3c2443_init_clocks(int xtal)
@@ -951,10 +1024,16 @@ void __init s3c2443_init_clocks(int xtal)
951 int ret; 1024 int ret;
952 int ptr; 1025 int ptr;
953 1026
1027 /* s3c2443 parents h and p clocks from prediv */
1028 clk_h.parent = &clk_prediv;
1029 clk_p.parent = &clk_prediv;
1030
954 pll = s3c2443_get_mpll(mpllcon, xtal); 1031 pll = s3c2443_get_mpll(mpllcon, xtal);
1032 clk_msysclk.rate = pll;
955 1033
956 fclk = pll / s3c2443_fclk_div(clkdiv0); 1034 fclk = pll / s3c2443_fclk_div(clkdiv0);
957 hclk = fclk / s3c2443_get_prediv(clkdiv0); 1035 hclk = s3c2443_prediv_getrate(&clk_prediv);
1036 hclk = hclk / s3c2443_get_hdiv(clkdiv0);
958 hclk = hclk / ((clkdiv0 & S3C2443_CLKDIV0_HALF_HCLK) ? 2 : 1); 1037 hclk = hclk / ((clkdiv0 & S3C2443_CLKDIV0_HALF_HCLK) ? 2 : 1);
959 pclk = hclk / ((clkdiv0 & S3C2443_CLKDIV0_HALF_PCLK) ? 2 : 1); 1038 pclk = hclk / ((clkdiv0 & S3C2443_CLKDIV0_HALF_PCLK) ? 2 : 1);
960 1039
diff --git a/arch/arm/mm/Kconfig b/arch/arm/mm/Kconfig
index 33ed048502a3..a2c8b006d710 100644
--- a/arch/arm/mm/Kconfig
+++ b/arch/arm/mm/Kconfig
@@ -180,8 +180,8 @@ config CPU_ARM925T
180# ARM926T 180# ARM926T
181config CPU_ARM926T 181config CPU_ARM926T
182 bool "Support ARM926T processor" 182 bool "Support ARM926T processor"
183 depends on ARCH_INTEGRATOR || ARCH_VERSATILE_PB || MACH_VERSATILE_AB || ARCH_OMAP730 || ARCH_OMAP16XX || MACH_REALVIEW_EB || ARCH_PNX4008 || ARCH_NETX || CPU_S3C2412 || ARCH_AT91SAM9260 || ARCH_AT91SAM9261 || ARCH_AT91SAM9263 || ARCH_AT91SAM9RL || ARCH_AT91CAP9 || ARCH_NS9XXX || ARCH_DAVINCI 183 depends on ARCH_INTEGRATOR || ARCH_VERSATILE_PB || MACH_VERSATILE_AB || ARCH_OMAP730 || ARCH_OMAP16XX || MACH_REALVIEW_EB || ARCH_PNX4008 || ARCH_NETX || CPU_S3C2412 || ARCH_AT91SAM9260 || ARCH_AT91SAM9261 || ARCH_AT91SAM9263 || ARCH_AT91SAM9RL || ARCH_AT91SAM9G20 || ARCH_AT91CAP9 || ARCH_NS9XXX || ARCH_DAVINCI
184 default y if ARCH_VERSATILE_PB || MACH_VERSATILE_AB || ARCH_OMAP730 || ARCH_OMAP16XX || ARCH_PNX4008 || ARCH_NETX || CPU_S3C2412 || ARCH_AT91SAM9260 || ARCH_AT91SAM9261 || ARCH_AT91SAM9263 || ARCH_AT91SAM9RL || ARCH_AT91CAP9 || ARCH_NS9XXX || ARCH_DAVINCI 184 default y if ARCH_VERSATILE_PB || MACH_VERSATILE_AB || ARCH_OMAP730 || ARCH_OMAP16XX || ARCH_PNX4008 || ARCH_NETX || CPU_S3C2412 || ARCH_AT91SAM9260 || ARCH_AT91SAM9261 || ARCH_AT91SAM9263 || ARCH_AT91SAM9RL || ARCH_AT91SAM9G20 || ARCH_AT91CAP9 || ARCH_NS9XXX || ARCH_DAVINCI
185 select CPU_32v5 185 select CPU_32v5
186 select CPU_ABRT_EV5TJ 186 select CPU_ABRT_EV5TJ
187 select CPU_PABRT_NOIFAR 187 select CPU_PABRT_NOIFAR
@@ -365,7 +365,7 @@ config CPU_XSC3
365# Feroceon 365# Feroceon
366config CPU_FEROCEON 366config CPU_FEROCEON
367 bool 367 bool
368 depends on ARCH_ORION5X 368 depends on ARCH_ORION5X || ARCH_LOKI || ARCH_KIRKWOOD || ARCH_MV78XX0
369 default y 369 default y
370 select CPU_32v5 370 select CPU_32v5
371 select CPU_ABRT_EV5T 371 select CPU_ABRT_EV5T
@@ -373,7 +373,7 @@ config CPU_FEROCEON
373 select CPU_CACHE_VIVT 373 select CPU_CACHE_VIVT
374 select CPU_CP15_MMU 374 select CPU_CP15_MMU
375 select CPU_COPY_FEROCEON if MMU 375 select CPU_COPY_FEROCEON if MMU
376 select CPU_TLB_V4WBI if MMU 376 select CPU_TLB_FEROCEON if MMU
377 377
378config CPU_FEROCEON_OLD_ID 378config CPU_FEROCEON_OLD_ID
379 bool "Accept early Feroceon cores with an ARM926 ID" 379 bool "Accept early Feroceon cores with an ARM926 ID"
@@ -551,6 +551,11 @@ config CPU_TLB_V4WBI
551 ARM Architecture Version 4 TLB with writeback cache and invalidate 551 ARM Architecture Version 4 TLB with writeback cache and invalidate
552 instruction cache entry. 552 instruction cache entry.
553 553
554config CPU_TLB_FEROCEON
555 bool
556 help
557 Feroceon TLB (v4wbi with non-outer-cachable page table walks).
558
554config CPU_TLB_V6 559config CPU_TLB_V6
555 bool 560 bool
556 561
@@ -709,6 +714,14 @@ config OUTER_CACHE
709 bool 714 bool
710 default n 715 default n
711 716
717config CACHE_FEROCEON_L2
718 bool "Enable the Feroceon L2 cache controller"
719 depends on ARCH_KIRKWOOD || ARCH_MV78XX0
720 default y
721 select OUTER_CACHE
722 help
723 This option enables the Feroceon L2 cache controller.
724
712config CACHE_L2X0 725config CACHE_L2X0
713 bool "Enable the L2x0 outer cache controller" 726 bool "Enable the L2x0 outer cache controller"
714 depends on REALVIEW_EB_ARM11MP || MACH_REALVIEW_PB11MP || MACH_REALVIEW_PB1176 727 depends on REALVIEW_EB_ARM11MP || MACH_REALVIEW_PB11MP || MACH_REALVIEW_PB1176
diff --git a/arch/arm/mm/Makefile b/arch/arm/mm/Makefile
index 32b2d2d213a6..f64b92557b11 100644
--- a/arch/arm/mm/Makefile
+++ b/arch/arm/mm/Makefile
@@ -46,6 +46,7 @@ obj-$(CONFIG_CPU_TLB_V3) += tlb-v3.o
46obj-$(CONFIG_CPU_TLB_V4WT) += tlb-v4.o 46obj-$(CONFIG_CPU_TLB_V4WT) += tlb-v4.o
47obj-$(CONFIG_CPU_TLB_V4WB) += tlb-v4wb.o 47obj-$(CONFIG_CPU_TLB_V4WB) += tlb-v4wb.o
48obj-$(CONFIG_CPU_TLB_V4WBI) += tlb-v4wbi.o 48obj-$(CONFIG_CPU_TLB_V4WBI) += tlb-v4wbi.o
49obj-$(CONFIG_CPU_TLB_FEROCEON) += tlb-v4wbi.o # reuse v4wbi TLB functions
49obj-$(CONFIG_CPU_TLB_V6) += tlb-v6.o 50obj-$(CONFIG_CPU_TLB_V6) += tlb-v6.o
50obj-$(CONFIG_CPU_TLB_V7) += tlb-v7.o 51obj-$(CONFIG_CPU_TLB_V7) += tlb-v7.o
51 52
@@ -73,4 +74,5 @@ obj-$(CONFIG_CPU_FEROCEON) += proc-feroceon.o
73obj-$(CONFIG_CPU_V6) += proc-v6.o 74obj-$(CONFIG_CPU_V6) += proc-v6.o
74obj-$(CONFIG_CPU_V7) += proc-v7.o 75obj-$(CONFIG_CPU_V7) += proc-v7.o
75 76
77obj-$(CONFIG_CACHE_FEROCEON_L2) += cache-feroceon-l2.o
76obj-$(CONFIG_CACHE_L2X0) += cache-l2x0.o 78obj-$(CONFIG_CACHE_L2X0) += cache-l2x0.o
diff --git a/arch/arm/mm/cache-feroceon-l2.c b/arch/arm/mm/cache-feroceon-l2.c
new file mode 100644
index 000000000000..20eec4ba173f
--- /dev/null
+++ b/arch/arm/mm/cache-feroceon-l2.c
@@ -0,0 +1,318 @@
1/*
2 * arch/arm/mm/cache-feroceon-l2.c - Feroceon L2 cache controller support
3 *
4 * Copyright (C) 2008 Marvell Semiconductor
5 *
6 * This file is licensed under the terms of the GNU General Public
7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied.
9 *
10 * References:
11 * - Unified Layer 2 Cache for Feroceon CPU Cores,
12 * Document ID MV-S104858-00, Rev. A, October 23 2007.
13 */
14
15#include <linux/init.h>
16#include <asm/cacheflush.h>
17#include <asm/plat-orion/cache-feroceon-l2.h>
18
19
20/*
21 * Low-level cache maintenance operations.
22 *
23 * As well as the regular 'clean/invalidate/flush L2 cache line by
24 * MVA' instructions, the Feroceon L2 cache controller also features
25 * 'clean/invalidate L2 range by MVA' operations.
26 *
27 * Cache range operations are initiated by writing the start and
28 * end addresses to successive cp15 registers, and process every
29 * cache line whose first byte address lies in the inclusive range
30 * [start:end].
31 *
32 * The cache range operations stall the CPU pipeline until completion.
33 *
34 * The range operations require two successive cp15 writes, in
35 * between which we don't want to be preempted.
36 */
37static inline void l2_clean_pa(unsigned long addr)
38{
39 __asm__("mcr p15, 1, %0, c15, c9, 3" : : "r" (addr));
40}
41
42static inline void l2_clean_mva_range(unsigned long start, unsigned long end)
43{
44 unsigned long flags;
45
46 /*
47 * Make sure 'start' and 'end' reference the same page, as
48 * L2 is PIPT and range operations only do a TLB lookup on
49 * the start address.
50 */
51 BUG_ON((start ^ end) & ~(PAGE_SIZE - 1));
52
53 raw_local_irq_save(flags);
54 __asm__("mcr p15, 1, %0, c15, c9, 4" : : "r" (start));
55 __asm__("mcr p15, 1, %0, c15, c9, 5" : : "r" (end));
56 raw_local_irq_restore(flags);
57}
58
59static inline void l2_clean_pa_range(unsigned long start, unsigned long end)
60{
61 l2_clean_mva_range(__phys_to_virt(start), __phys_to_virt(end));
62}
63
64static inline void l2_clean_inv_pa(unsigned long addr)
65{
66 __asm__("mcr p15, 1, %0, c15, c10, 3" : : "r" (addr));
67}
68
69static inline void l2_inv_pa(unsigned long addr)
70{
71 __asm__("mcr p15, 1, %0, c15, c11, 3" : : "r" (addr));
72}
73
74static inline void l2_inv_mva_range(unsigned long start, unsigned long end)
75{
76 unsigned long flags;
77
78 /*
79 * Make sure 'start' and 'end' reference the same page, as
80 * L2 is PIPT and range operations only do a TLB lookup on
81 * the start address.
82 */
83 BUG_ON((start ^ end) & ~(PAGE_SIZE - 1));
84
85 raw_local_irq_save(flags);
86 __asm__("mcr p15, 1, %0, c15, c11, 4" : : "r" (start));
87 __asm__("mcr p15, 1, %0, c15, c11, 5" : : "r" (end));
88 raw_local_irq_restore(flags);
89}
90
91static inline void l2_inv_pa_range(unsigned long start, unsigned long end)
92{
93 l2_inv_mva_range(__phys_to_virt(start), __phys_to_virt(end));
94}
95
96
97/*
98 * Linux primitives.
99 *
100 * Note that the end addresses passed to Linux primitives are
101 * noninclusive, while the hardware cache range operations use
102 * inclusive start and end addresses.
103 */
104#define CACHE_LINE_SIZE 32
105#define MAX_RANGE_SIZE 1024
106
107static int l2_wt_override;
108
109static unsigned long calc_range_end(unsigned long start, unsigned long end)
110{
111 unsigned long range_end;
112
113 BUG_ON(start & (CACHE_LINE_SIZE - 1));
114 BUG_ON(end & (CACHE_LINE_SIZE - 1));
115
116 /*
117 * Try to process all cache lines between 'start' and 'end'.
118 */
119 range_end = end;
120
121 /*
122 * Limit the number of cache lines processed at once,
123 * since cache range operations stall the CPU pipeline
124 * until completion.
125 */
126 if (range_end > start + MAX_RANGE_SIZE)
127 range_end = start + MAX_RANGE_SIZE;
128
129 /*
130 * Cache range operations can't straddle a page boundary.
131 */
132 if (range_end > (start | (PAGE_SIZE - 1)) + 1)
133 range_end = (start | (PAGE_SIZE - 1)) + 1;
134
135 return range_end;
136}
137
138static void feroceon_l2_inv_range(unsigned long start, unsigned long end)
139{
140 /*
141 * Clean and invalidate partial first cache line.
142 */
143 if (start & (CACHE_LINE_SIZE - 1)) {
144 l2_clean_inv_pa(start & ~(CACHE_LINE_SIZE - 1));
145 start = (start | (CACHE_LINE_SIZE - 1)) + 1;
146 }
147
148 /*
149 * Clean and invalidate partial last cache line.
150 */
151 if (end & (CACHE_LINE_SIZE - 1)) {
152 l2_clean_inv_pa(end & ~(CACHE_LINE_SIZE - 1));
153 end &= ~(CACHE_LINE_SIZE - 1);
154 }
155
156 /*
157 * Invalidate all full cache lines between 'start' and 'end'.
158 */
159 while (start != end) {
160 unsigned long range_end = calc_range_end(start, end);
161 l2_inv_pa_range(start, range_end - CACHE_LINE_SIZE);
162 start = range_end;
163 }
164
165 dsb();
166}
167
168static void feroceon_l2_clean_range(unsigned long start, unsigned long end)
169{
170 /*
171 * If L2 is forced to WT, the L2 will always be clean and we
172 * don't need to do anything here.
173 */
174 if (!l2_wt_override) {
175 start &= ~(CACHE_LINE_SIZE - 1);
176 end = (end + CACHE_LINE_SIZE - 1) & ~(CACHE_LINE_SIZE - 1);
177 while (start != end) {
178 unsigned long range_end = calc_range_end(start, end);
179 l2_clean_pa_range(start, range_end - CACHE_LINE_SIZE);
180 start = range_end;
181 }
182 }
183
184 dsb();
185}
186
187static void feroceon_l2_flush_range(unsigned long start, unsigned long end)
188{
189 start &= ~(CACHE_LINE_SIZE - 1);
190 end = (end + CACHE_LINE_SIZE - 1) & ~(CACHE_LINE_SIZE - 1);
191 while (start != end) {
192 unsigned long range_end = calc_range_end(start, end);
193 if (!l2_wt_override)
194 l2_clean_pa_range(start, range_end - CACHE_LINE_SIZE);
195 l2_inv_pa_range(start, range_end - CACHE_LINE_SIZE);
196 start = range_end;
197 }
198
199 dsb();
200}
201
202
203/*
204 * Routines to disable and re-enable the D-cache and I-cache at run
205 * time. These are necessary because the L2 cache can only be enabled
206 * or disabled while the L1 Dcache and Icache are both disabled.
207 */
208static void __init invalidate_and_disable_dcache(void)
209{
210 u32 cr;
211
212 cr = get_cr();
213 if (cr & CR_C) {
214 unsigned long flags;
215
216 raw_local_irq_save(flags);
217 flush_cache_all();
218 set_cr(cr & ~CR_C);
219 raw_local_irq_restore(flags);
220 }
221}
222
223static void __init enable_dcache(void)
224{
225 u32 cr;
226
227 cr = get_cr();
228 if (!(cr & CR_C))
229 set_cr(cr | CR_C);
230}
231
232static void __init __invalidate_icache(void)
233{
234 int dummy;
235
236 __asm__ __volatile__("mcr p15, 0, %0, c7, c5, 0\n" : "=r" (dummy));
237}
238
239static void __init invalidate_and_disable_icache(void)
240{
241 u32 cr;
242
243 cr = get_cr();
244 if (cr & CR_I) {
245 set_cr(cr & ~CR_I);
246 __invalidate_icache();
247 }
248}
249
250static void __init enable_icache(void)
251{
252 u32 cr;
253
254 cr = get_cr();
255 if (!(cr & CR_I))
256 set_cr(cr | CR_I);
257}
258
259static inline u32 read_extra_features(void)
260{
261 u32 u;
262
263 __asm__("mrc p15, 1, %0, c15, c1, 0" : "=r" (u));
264
265 return u;
266}
267
268static inline void write_extra_features(u32 u)
269{
270 __asm__("mcr p15, 1, %0, c15, c1, 0" : : "r" (u));
271}
272
273static void __init disable_l2_prefetch(void)
274{
275 u32 u;
276
277 /*
278 * Read the CPU Extra Features register and verify that the
279 * Disable L2 Prefetch bit is set.
280 */
281 u = read_extra_features();
282 if (!(u & 0x01000000)) {
283 printk(KERN_INFO "Feroceon L2: Disabling L2 prefetch.\n");
284 write_extra_features(u | 0x01000000);
285 }
286}
287
288static void __init enable_l2(void)
289{
290 u32 u;
291
292 u = read_extra_features();
293 if (!(u & 0x00400000)) {
294 printk(KERN_INFO "Feroceon L2: Enabling L2\n");
295
296 invalidate_and_disable_dcache();
297 invalidate_and_disable_icache();
298 write_extra_features(u | 0x00400000);
299 enable_icache();
300 enable_dcache();
301 }
302}
303
304void __init feroceon_l2_init(int __l2_wt_override)
305{
306 l2_wt_override = __l2_wt_override;
307
308 disable_l2_prefetch();
309
310 outer_cache.inv_range = feroceon_l2_inv_range;
311 outer_cache.clean_range = feroceon_l2_clean_range;
312 outer_cache.flush_range = feroceon_l2_flush_range;
313
314 enable_l2();
315
316 printk(KERN_INFO "Feroceon L2: Cache support initialised%s.\n",
317 l2_wt_override ? ", in WT override mode" : "");
318}
diff --git a/arch/arm/mm/fault-armv.c b/arch/arm/mm/fault-armv.c
index 44558d5f9313..fbfa26058442 100644
--- a/arch/arm/mm/fault-armv.c
+++ b/arch/arm/mm/fault-armv.c
@@ -144,13 +144,17 @@ void update_mmu_cache(struct vm_area_struct *vma, unsigned long addr, pte_t pte)
144 page = pfn_to_page(pfn); 144 page = pfn_to_page(pfn);
145 mapping = page_mapping(page); 145 mapping = page_mapping(page);
146 if (mapping) { 146 if (mapping) {
147#ifndef CONFIG_SMP
147 int dirty = test_and_clear_bit(PG_dcache_dirty, &page->flags); 148 int dirty = test_and_clear_bit(PG_dcache_dirty, &page->flags);
148 149
149 if (dirty) 150 if (dirty)
150 __flush_dcache_page(mapping, page); 151 __flush_dcache_page(mapping, page);
152#endif
151 153
152 if (cache_is_vivt()) 154 if (cache_is_vivt())
153 make_coherent(mapping, vma, addr, pfn); 155 make_coherent(mapping, vma, addr, pfn);
156 else if (vma->vm_flags & VM_EXEC)
157 __flush_icache_all();
154 } 158 }
155} 159}
156 160
diff --git a/arch/arm/mm/flush.c b/arch/arm/mm/flush.c
index 9df507d36e0b..029ee65fda2b 100644
--- a/arch/arm/mm/flush.c
+++ b/arch/arm/mm/flush.c
@@ -199,6 +199,8 @@ void flush_dcache_page(struct page *page)
199 __flush_dcache_page(mapping, page); 199 __flush_dcache_page(mapping, page);
200 if (mapping && cache_is_vivt()) 200 if (mapping && cache_is_vivt())
201 __flush_dcache_aliases(mapping, page); 201 __flush_dcache_aliases(mapping, page);
202 else if (mapping)
203 __flush_icache_all();
202 } 204 }
203} 205}
204EXPORT_SYMBOL(flush_dcache_page); 206EXPORT_SYMBOL(flush_dcache_page);
diff --git a/arch/arm/mm/proc-feroceon.S b/arch/arm/mm/proc-feroceon.S
index a02c1712b52d..f2e5884c513a 100644
--- a/arch/arm/mm/proc-feroceon.S
+++ b/arch/arm/mm/proc-feroceon.S
@@ -44,11 +44,31 @@
44 */ 44 */
45#define CACHE_DLINESIZE 32 45#define CACHE_DLINESIZE 32
46 46
47 .bss
48 .align 3
49__cache_params_loc:
50 .space 8
51
47 .text 52 .text
53__cache_params:
54 .word __cache_params_loc
55
48/* 56/*
49 * cpu_feroceon_proc_init() 57 * cpu_feroceon_proc_init()
50 */ 58 */
51ENTRY(cpu_feroceon_proc_init) 59ENTRY(cpu_feroceon_proc_init)
60 mrc p15, 0, r0, c0, c0, 1 @ read cache type register
61 ldr r1, __cache_params
62 mov r2, #(16 << 5)
63 tst r0, #(1 << 16) @ get way
64 mov r0, r0, lsr #18 @ get cache size order
65 movne r3, #((4 - 1) << 30) @ 4-way
66 and r0, r0, #0xf
67 moveq r3, #0 @ 1-way
68 mov r2, r2, lsl r0 @ actual cache size
69 movne r2, r2, lsr #2 @ turned into # of sets
70 sub r2, r2, #(1 << 5)
71 stmia r1, {r2, r3}
52 mov pc, lr 72 mov pc, lr
53 73
54/* 74/*
@@ -59,6 +79,13 @@ ENTRY(cpu_feroceon_proc_fin)
59 mov ip, #PSR_F_BIT | PSR_I_BIT | SVC_MODE 79 mov ip, #PSR_F_BIT | PSR_I_BIT | SVC_MODE
60 msr cpsr_c, ip 80 msr cpsr_c, ip
61 bl feroceon_flush_kern_cache_all 81 bl feroceon_flush_kern_cache_all
82
83#if defined(CONFIG_CACHE_FEROCEON_L2) && !defined(CONFIG_L2_CACHE_WRITETHROUGH)
84 mov r0, #0
85 mcr p15, 1, r0, c15, c9, 0 @ clean L2
86 mcr p15, 0, r0, c7, c10, 4 @ drain WB
87#endif
88
62 mrc p15, 0, r0, c1, c0, 0 @ ctrl register 89 mrc p15, 0, r0, c1, c0, 0 @ ctrl register
63 bic r0, r0, #0x1000 @ ...i............ 90 bic r0, r0, #0x1000 @ ...i............
64 bic r0, r0, #0x000e @ ............wca. 91 bic r0, r0, #0x000e @ ............wca.
@@ -117,11 +144,19 @@ ENTRY(feroceon_flush_user_cache_all)
117 */ 144 */
118ENTRY(feroceon_flush_kern_cache_all) 145ENTRY(feroceon_flush_kern_cache_all)
119 mov r2, #VM_EXEC 146 mov r2, #VM_EXEC
120 mov ip, #0 147
121__flush_whole_cache: 148__flush_whole_cache:
1221: mrc p15, 0, r15, c7, c14, 3 @ test,clean,invalidate 149 ldr r1, __cache_params
123 bne 1b 150 ldmia r1, {r1, r3}
1511: orr ip, r1, r3
1522: mcr p15, 0, ip, c7, c14, 2 @ clean + invalidate D set/way
153 subs ip, ip, #(1 << 30) @ next way
154 bcs 2b
155 subs r1, r1, #(1 << 5) @ next set
156 bcs 1b
157
124 tst r2, #VM_EXEC 158 tst r2, #VM_EXEC
159 mov ip, #0
125 mcrne p15, 0, ip, c7, c5, 0 @ invalidate I cache 160 mcrne p15, 0, ip, c7, c5, 0 @ invalidate I cache
126 mcrne p15, 0, ip, c7, c10, 4 @ drain WB 161 mcrne p15, 0, ip, c7, c10, 4 @ drain WB
127 mov pc, lr 162 mov pc, lr
@@ -138,7 +173,6 @@ __flush_whole_cache:
138 */ 173 */
139 .align 5 174 .align 5
140ENTRY(feroceon_flush_user_cache_range) 175ENTRY(feroceon_flush_user_cache_range)
141 mov ip, #0
142 sub r3, r1, r0 @ calculate total size 176 sub r3, r1, r0 @ calculate total size
143 cmp r3, #CACHE_DLIMIT 177 cmp r3, #CACHE_DLIMIT
144 bgt __flush_whole_cache 178 bgt __flush_whole_cache
@@ -152,6 +186,7 @@ ENTRY(feroceon_flush_user_cache_range)
152 cmp r0, r1 186 cmp r0, r1
153 blo 1b 187 blo 1b
154 tst r2, #VM_EXEC 188 tst r2, #VM_EXEC
189 mov ip, #0
155 mcrne p15, 0, ip, c7, c10, 4 @ drain WB 190 mcrne p15, 0, ip, c7, c10, 4 @ drain WB
156 mov pc, lr 191 mov pc, lr
157 192
@@ -209,6 +244,20 @@ ENTRY(feroceon_flush_kern_dcache_page)
209 mcr p15, 0, r0, c7, c10, 4 @ drain WB 244 mcr p15, 0, r0, c7, c10, 4 @ drain WB
210 mov pc, lr 245 mov pc, lr
211 246
247 .align 5
248ENTRY(feroceon_range_flush_kern_dcache_page)
249 mrs r2, cpsr
250 add r1, r0, #PAGE_SZ - CACHE_DLINESIZE @ top addr is inclusive
251 orr r3, r2, #PSR_I_BIT
252 msr cpsr_c, r3 @ disable interrupts
253 mcr p15, 5, r0, c15, c15, 0 @ D clean/inv range start
254 mcr p15, 5, r1, c15, c15, 1 @ D clean/inv range top
255 msr cpsr_c, r2 @ restore interrupts
256 mov r0, #0
257 mcr p15, 0, r0, c7, c5, 0 @ invalidate I cache
258 mcr p15, 0, r0, c7, c10, 4 @ drain WB
259 mov pc, lr
260
212/* 261/*
213 * dma_inv_range(start, end) 262 * dma_inv_range(start, end)
214 * 263 *
@@ -225,10 +274,10 @@ ENTRY(feroceon_flush_kern_dcache_page)
225 .align 5 274 .align 5
226ENTRY(feroceon_dma_inv_range) 275ENTRY(feroceon_dma_inv_range)
227 tst r0, #CACHE_DLINESIZE - 1 276 tst r0, #CACHE_DLINESIZE - 1
277 bic r0, r0, #CACHE_DLINESIZE - 1
228 mcrne p15, 0, r0, c7, c10, 1 @ clean D entry 278 mcrne p15, 0, r0, c7, c10, 1 @ clean D entry
229 tst r1, #CACHE_DLINESIZE - 1 279 tst r1, #CACHE_DLINESIZE - 1
230 mcrne p15, 0, r1, c7, c10, 1 @ clean D entry 280 mcrne p15, 0, r1, c7, c10, 1 @ clean D entry
231 bic r0, r0, #CACHE_DLINESIZE - 1
2321: mcr p15, 0, r0, c7, c6, 1 @ invalidate D entry 2811: mcr p15, 0, r0, c7, c6, 1 @ invalidate D entry
233 add r0, r0, #CACHE_DLINESIZE 282 add r0, r0, #CACHE_DLINESIZE
234 cmp r0, r1 283 cmp r0, r1
@@ -236,6 +285,22 @@ ENTRY(feroceon_dma_inv_range)
236 mcr p15, 0, r0, c7, c10, 4 @ drain WB 285 mcr p15, 0, r0, c7, c10, 4 @ drain WB
237 mov pc, lr 286 mov pc, lr
238 287
288 .align 5
289ENTRY(feroceon_range_dma_inv_range)
290 mrs r2, cpsr
291 tst r0, #CACHE_DLINESIZE - 1
292 mcrne p15, 0, r0, c7, c10, 1 @ clean D entry
293 tst r1, #CACHE_DLINESIZE - 1
294 mcrne p15, 0, r1, c7, c10, 1 @ clean D entry
295 cmp r1, r0
296 subne r1, r1, #1 @ top address is inclusive
297 orr r3, r2, #PSR_I_BIT
298 msr cpsr_c, r3 @ disable interrupts
299 mcr p15, 5, r0, c15, c14, 0 @ D inv range start
300 mcr p15, 5, r1, c15, c14, 1 @ D inv range top
301 msr cpsr_c, r2 @ restore interrupts
302 mov pc, lr
303
239/* 304/*
240 * dma_clean_range(start, end) 305 * dma_clean_range(start, end)
241 * 306 *
@@ -256,6 +321,19 @@ ENTRY(feroceon_dma_clean_range)
256 mcr p15, 0, r0, c7, c10, 4 @ drain WB 321 mcr p15, 0, r0, c7, c10, 4 @ drain WB
257 mov pc, lr 322 mov pc, lr
258 323
324 .align 5
325ENTRY(feroceon_range_dma_clean_range)
326 mrs r2, cpsr
327 cmp r1, r0
328 subne r1, r1, #1 @ top address is inclusive
329 orr r3, r2, #PSR_I_BIT
330 msr cpsr_c, r3 @ disable interrupts
331 mcr p15, 5, r0, c15, c13, 0 @ D clean range start
332 mcr p15, 5, r1, c15, c13, 1 @ D clean range top
333 msr cpsr_c, r2 @ restore interrupts
334 mcr p15, 0, r0, c7, c10, 4 @ drain WB
335 mov pc, lr
336
259/* 337/*
260 * dma_flush_range(start, end) 338 * dma_flush_range(start, end)
261 * 339 *
@@ -274,6 +352,19 @@ ENTRY(feroceon_dma_flush_range)
274 mcr p15, 0, r0, c7, c10, 4 @ drain WB 352 mcr p15, 0, r0, c7, c10, 4 @ drain WB
275 mov pc, lr 353 mov pc, lr
276 354
355 .align 5
356ENTRY(feroceon_range_dma_flush_range)
357 mrs r2, cpsr
358 cmp r1, r0
359 subne r1, r1, #1 @ top address is inclusive
360 orr r3, r2, #PSR_I_BIT
361 msr cpsr_c, r3 @ disable interrupts
362 mcr p15, 5, r0, c15, c15, 0 @ D clean/inv range start
363 mcr p15, 5, r1, c15, c15, 1 @ D clean/inv range top
364 msr cpsr_c, r2 @ restore interrupts
365 mcr p15, 0, r0, c7, c10, 4 @ drain WB
366 mov pc, lr
367
277ENTRY(feroceon_cache_fns) 368ENTRY(feroceon_cache_fns)
278 .long feroceon_flush_kern_cache_all 369 .long feroceon_flush_kern_cache_all
279 .long feroceon_flush_user_cache_all 370 .long feroceon_flush_user_cache_all
@@ -285,12 +376,33 @@ ENTRY(feroceon_cache_fns)
285 .long feroceon_dma_clean_range 376 .long feroceon_dma_clean_range
286 .long feroceon_dma_flush_range 377 .long feroceon_dma_flush_range
287 378
379ENTRY(feroceon_range_cache_fns)
380 .long feroceon_flush_kern_cache_all
381 .long feroceon_flush_user_cache_all
382 .long feroceon_flush_user_cache_range
383 .long feroceon_coherent_kern_range
384 .long feroceon_coherent_user_range
385 .long feroceon_range_flush_kern_dcache_page
386 .long feroceon_range_dma_inv_range
387 .long feroceon_range_dma_clean_range
388 .long feroceon_range_dma_flush_range
389
288 .align 5 390 .align 5
289ENTRY(cpu_feroceon_dcache_clean_area) 391ENTRY(cpu_feroceon_dcache_clean_area)
392#if defined(CONFIG_CACHE_FEROCEON_L2) && !defined(CONFIG_L2_CACHE_WRITETHROUGH)
393 mov r2, r0
394 mov r3, r1
395#endif
2901: mcr p15, 0, r0, c7, c10, 1 @ clean D entry 3961: mcr p15, 0, r0, c7, c10, 1 @ clean D entry
291 add r0, r0, #CACHE_DLINESIZE 397 add r0, r0, #CACHE_DLINESIZE
292 subs r1, r1, #CACHE_DLINESIZE 398 subs r1, r1, #CACHE_DLINESIZE
293 bhi 1b 399 bhi 1b
400#if defined(CONFIG_CACHE_FEROCEON_L2) && !defined(CONFIG_L2_CACHE_WRITETHROUGH)
4011: mcr p15, 1, r2, c15, c9, 1 @ clean L2 entry
402 add r2, r2, #CACHE_DLINESIZE
403 subs r3, r3, #CACHE_DLINESIZE
404 bhi 1b
405#endif
294 mcr p15, 0, r0, c7, c10, 4 @ drain WB 406 mcr p15, 0, r0, c7, c10, 4 @ drain WB
295 mov pc, lr 407 mov pc, lr
296 408
@@ -306,16 +418,25 @@ ENTRY(cpu_feroceon_dcache_clean_area)
306 .align 5 418 .align 5
307ENTRY(cpu_feroceon_switch_mm) 419ENTRY(cpu_feroceon_switch_mm)
308#ifdef CONFIG_MMU 420#ifdef CONFIG_MMU
309 mov ip, #0 421 /*
310@ && 'Clean & Invalidate whole DCache' 422 * Note: we wish to call __flush_whole_cache but we need to preserve
3111: mrc p15, 0, r15, c7, c14, 3 @ test,clean,invalidate 423 * lr to do so. The only way without touching main memory is to
312 bne 1b 424 * use r2 which is normally used to test the VM_EXEC flag, and
313 mcr p15, 0, ip, c7, c5, 0 @ invalidate I cache 425 * compensate locally for the skipped ops if it is not set.
314 mcr p15, 0, ip, c7, c10, 4 @ drain WB 426 */
427 mov r2, lr @ abuse r2 to preserve lr
428 bl __flush_whole_cache
429 @ if r2 contains the VM_EXEC bit then the next 2 ops are done already
430 tst r2, #VM_EXEC
431 mcreq p15, 0, ip, c7, c5, 0 @ invalidate I cache
432 mcreq p15, 0, ip, c7, c10, 4 @ drain WB
433
315 mcr p15, 0, r0, c2, c0, 0 @ load page table pointer 434 mcr p15, 0, r0, c2, c0, 0 @ load page table pointer
316 mcr p15, 0, ip, c8, c7, 0 @ invalidate I & D TLBs 435 mcr p15, 0, ip, c8, c7, 0 @ invalidate I & D TLBs
317#endif 436 mov pc, r2
437#else
318 mov pc, lr 438 mov pc, lr
439#endif
319 440
320/* 441/*
321 * cpu_feroceon_set_pte_ext(ptep, pte, ext) 442 * cpu_feroceon_set_pte_ext(ptep, pte, ext)
@@ -345,6 +466,9 @@ ENTRY(cpu_feroceon_set_pte_ext)
345 str r2, [r0] @ hardware version 466 str r2, [r0] @ hardware version
346 mov r0, r0 467 mov r0, r0
347 mcr p15, 0, r0, c7, c10, 1 @ clean D entry 468 mcr p15, 0, r0, c7, c10, 1 @ clean D entry
469#if defined(CONFIG_CACHE_FEROCEON_L2) && !defined(CONFIG_L2_CACHE_WRITETHROUGH)
470 mcr p15, 1, r0, c15, c9, 1 @ clean L2 entry
471#endif
348 mcr p15, 0, r0, c7, c10, 4 @ drain WB 472 mcr p15, 0, r0, c7, c10, 4 @ drain WB
349#endif 473#endif
350 mov pc, lr 474 mov pc, lr
@@ -369,14 +493,15 @@ __feroceon_setup:
369 .size __feroceon_setup, . - __feroceon_setup 493 .size __feroceon_setup, . - __feroceon_setup
370 494
371 /* 495 /*
372 * R 496 * B
373 * .RVI ZFRS BLDP WCAM 497 * R P
374 * .011 0001 ..11 0101 498 * .RVI UFRS BLDP WCAM
499 * .011 .001 ..11 0101
375 * 500 *
376 */ 501 */
377 .type feroceon_crval, #object 502 .type feroceon_crval, #object
378feroceon_crval: 503feroceon_crval:
379 crval clear=0x00007f3f, mmuset=0x00003135, ucset=0x00001134 504 crval clear=0x0000773f, mmuset=0x00003135, ucset=0x00001134
380 505
381 __INITDATA 506 __INITDATA
382 507
@@ -414,6 +539,21 @@ cpu_feroceon_name:
414 .asciz "Feroceon" 539 .asciz "Feroceon"
415 .size cpu_feroceon_name, . - cpu_feroceon_name 540 .size cpu_feroceon_name, . - cpu_feroceon_name
416 541
542 .type cpu_88fr531_name, #object
543cpu_88fr531_name:
544 .asciz "Feroceon 88FR531-vd"
545 .size cpu_88fr531_name, . - cpu_88fr531_name
546
547 .type cpu_88fr571_name, #object
548cpu_88fr571_name:
549 .asciz "Feroceon 88FR571-vd"
550 .size cpu_88fr571_name, . - cpu_88fr571_name
551
552 .type cpu_88fr131_name, #object
553cpu_88fr131_name:
554 .asciz "Feroceon 88FR131"
555 .size cpu_88fr131_name, . - cpu_88fr131_name
556
417 .align 557 .align
418 558
419 .section ".proc.info.init", #alloc, #execinstr 559 .section ".proc.info.init", #alloc, #execinstr
@@ -421,15 +561,15 @@ cpu_feroceon_name:
421#ifdef CONFIG_CPU_FEROCEON_OLD_ID 561#ifdef CONFIG_CPU_FEROCEON_OLD_ID
422 .type __feroceon_old_id_proc_info,#object 562 .type __feroceon_old_id_proc_info,#object
423__feroceon_old_id_proc_info: 563__feroceon_old_id_proc_info:
424 .long 0x41069260 564 .long 0x41009260
425 .long 0xfffffff0 565 .long 0xff00fff0
426 .long PMD_TYPE_SECT | \ 566 .long PMD_TYPE_SECT | \
427 PMD_SECT_BUFFERABLE | \ 567 PMD_SECT_BUFFERABLE | \
428 PMD_SECT_CACHEABLE | \ 568 PMD_SECT_CACHEABLE | \
429 PMD_BIT4 | \ 569 PMD_BIT4 | \
430 PMD_SECT_AP_WRITE | \ 570 PMD_SECT_AP_WRITE | \
431 PMD_SECT_AP_READ 571 PMD_SECT_AP_READ
432 .long PMD_TYPE_SECT | \ 572 .long PMD_TYPE_SECT | \
433 PMD_BIT4 | \ 573 PMD_BIT4 | \
434 PMD_SECT_AP_WRITE | \ 574 PMD_SECT_AP_WRITE | \
435 PMD_SECT_AP_READ 575 PMD_SECT_AP_READ
@@ -445,17 +585,17 @@ __feroceon_old_id_proc_info:
445 .size __feroceon_old_id_proc_info, . - __feroceon_old_id_proc_info 585 .size __feroceon_old_id_proc_info, . - __feroceon_old_id_proc_info
446#endif 586#endif
447 587
448 .type __feroceon_proc_info,#object 588 .type __88fr531_proc_info,#object
449__feroceon_proc_info: 589__88fr531_proc_info:
450 .long 0x56055310 590 .long 0x56055310
451 .long 0xfffffff0 591 .long 0xfffffff0
452 .long PMD_TYPE_SECT | \ 592 .long PMD_TYPE_SECT | \
453 PMD_SECT_BUFFERABLE | \ 593 PMD_SECT_BUFFERABLE | \
454 PMD_SECT_CACHEABLE | \ 594 PMD_SECT_CACHEABLE | \
455 PMD_BIT4 | \ 595 PMD_BIT4 | \
456 PMD_SECT_AP_WRITE | \ 596 PMD_SECT_AP_WRITE | \
457 PMD_SECT_AP_READ 597 PMD_SECT_AP_READ
458 .long PMD_TYPE_SECT | \ 598 .long PMD_TYPE_SECT | \
459 PMD_BIT4 | \ 599 PMD_BIT4 | \
460 PMD_SECT_AP_WRITE | \ 600 PMD_SECT_AP_WRITE | \
461 PMD_SECT_AP_READ 601 PMD_SECT_AP_READ
@@ -463,9 +603,59 @@ __feroceon_proc_info:
463 .long cpu_arch_name 603 .long cpu_arch_name
464 .long cpu_elf_name 604 .long cpu_elf_name
465 .long HWCAP_SWP|HWCAP_HALF|HWCAP_THUMB|HWCAP_FAST_MULT|HWCAP_EDSP 605 .long HWCAP_SWP|HWCAP_HALF|HWCAP_THUMB|HWCAP_FAST_MULT|HWCAP_EDSP
466 .long cpu_feroceon_name 606 .long cpu_88fr531_name
467 .long feroceon_processor_functions 607 .long feroceon_processor_functions
468 .long v4wbi_tlb_fns 608 .long v4wbi_tlb_fns
469 .long feroceon_user_fns 609 .long feroceon_user_fns
470 .long feroceon_cache_fns 610 .long feroceon_cache_fns
471 .size __feroceon_proc_info, . - __feroceon_proc_info 611 .size __88fr531_proc_info, . - __88fr531_proc_info
612
613 .type __88fr571_proc_info,#object
614__88fr571_proc_info:
615 .long 0x56155710
616 .long 0xfffffff0
617 .long PMD_TYPE_SECT | \
618 PMD_SECT_BUFFERABLE | \
619 PMD_SECT_CACHEABLE | \
620 PMD_BIT4 | \
621 PMD_SECT_AP_WRITE | \
622 PMD_SECT_AP_READ
623 .long PMD_TYPE_SECT | \
624 PMD_BIT4 | \
625 PMD_SECT_AP_WRITE | \
626 PMD_SECT_AP_READ
627 b __feroceon_setup
628 .long cpu_arch_name
629 .long cpu_elf_name
630 .long HWCAP_SWP|HWCAP_HALF|HWCAP_THUMB|HWCAP_FAST_MULT|HWCAP_EDSP
631 .long cpu_88fr571_name
632 .long feroceon_processor_functions
633 .long v4wbi_tlb_fns
634 .long feroceon_user_fns
635 .long feroceon_range_cache_fns
636 .size __88fr571_proc_info, . - __88fr571_proc_info
637
638 .type __88fr131_proc_info,#object
639__88fr131_proc_info:
640 .long 0x56251310
641 .long 0xfffffff0
642 .long PMD_TYPE_SECT | \
643 PMD_SECT_BUFFERABLE | \
644 PMD_SECT_CACHEABLE | \
645 PMD_BIT4 | \
646 PMD_SECT_AP_WRITE | \
647 PMD_SECT_AP_READ
648 .long PMD_TYPE_SECT | \
649 PMD_BIT4 | \
650 PMD_SECT_AP_WRITE | \
651 PMD_SECT_AP_READ
652 b __feroceon_setup
653 .long cpu_arch_name
654 .long cpu_elf_name
655 .long HWCAP_SWP|HWCAP_HALF|HWCAP_THUMB|HWCAP_FAST_MULT|HWCAP_EDSP
656 .long cpu_88fr131_name
657 .long feroceon_processor_functions
658 .long v4wbi_tlb_fns
659 .long feroceon_user_fns
660 .long feroceon_range_cache_fns
661 .size __88fr131_proc_info, . - __88fr131_proc_info
diff --git a/arch/arm/plat-iop/gpio.c b/arch/arm/plat-iop/gpio.c
index eda436083417..640e498c12ef 100644
--- a/arch/arm/plat-iop/gpio.c
+++ b/arch/arm/plat-iop/gpio.c
@@ -11,6 +11,10 @@
11 */ 11 */
12 12
13#include <linux/device.h> 13#include <linux/device.h>
14#include <linux/init.h>
15#include <linux/types.h>
16#include <linux/errno.h>
17#include <linux/gpio.h>
14#include <asm/hardware/iop3xx.h> 18#include <asm/hardware/iop3xx.h>
15 19
16void gpio_line_config(int line, int direction) 20void gpio_line_config(int line, int direction)
@@ -46,3 +50,42 @@ void gpio_line_set(int line, int value)
46 local_irq_restore(flags); 50 local_irq_restore(flags);
47} 51}
48EXPORT_SYMBOL(gpio_line_set); 52EXPORT_SYMBOL(gpio_line_set);
53
54static int iop3xx_gpio_direction_input(struct gpio_chip *chip, unsigned gpio)
55{
56 gpio_line_config(gpio, GPIO_IN);
57 return 0;
58}
59
60static int iop3xx_gpio_direction_output(struct gpio_chip *chip, unsigned gpio, int level)
61{
62 gpio_line_set(gpio, level);
63 gpio_line_config(gpio, GPIO_OUT);
64 return 0;
65}
66
67static int iop3xx_gpio_get_value(struct gpio_chip *chip, unsigned gpio)
68{
69 return gpio_line_get(gpio);
70}
71
72static void iop3xx_gpio_set_value(struct gpio_chip *chip, unsigned gpio, int value)
73{
74 gpio_line_set(gpio, value);
75}
76
77static struct gpio_chip iop3xx_chip = {
78 .label = "iop3xx",
79 .direction_input = iop3xx_gpio_direction_input,
80 .get = iop3xx_gpio_get_value,
81 .direction_output = iop3xx_gpio_direction_output,
82 .set = iop3xx_gpio_set_value,
83 .base = 0,
84 .ngpio = IOP3XX_N_GPIOS,
85};
86
87static int __init iop3xx_gpio_setup(void)
88{
89 return gpiochip_add(&iop3xx_chip);
90}
91arch_initcall(iop3xx_gpio_setup);
diff --git a/arch/arm/plat-omap/Makefile b/arch/arm/plat-omap/Makefile
index bc639a30d6d1..2c4051cc79a1 100644
--- a/arch/arm/plat-omap/Makefile
+++ b/arch/arm/plat-omap/Makefile
@@ -3,7 +3,7 @@
3# 3#
4 4
5# Common support 5# Common support
6obj-y := common.o sram.o sram-fn.o clock.o devices.o dma.o mux.o gpio.o \ 6obj-y := common.o sram.o clock.o devices.o dma.o mux.o gpio.o \
7 usb.o fb.o 7 usb.o fb.o
8obj-m := 8obj-m :=
9obj-n := 9obj-n :=
diff --git a/arch/arm/plat-omap/clock.c b/arch/arm/plat-omap/clock.c
index 2db5580048d8..c2e741de0203 100644
--- a/arch/arm/plat-omap/clock.c
+++ b/arch/arm/plat-omap/clock.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * linux/arch/arm/plat-omap/clock.c 2 * linux/arch/arm/plat-omap/clock.c
3 * 3 *
4 * Copyright (C) 2004 - 2005 Nokia corporation 4 * Copyright (C) 2004 - 2008 Nokia corporation
5 * Written by Tuukka Tikkanen <tuukka.tikkanen@elektrobit.com> 5 * Written by Tuukka Tikkanen <tuukka.tikkanen@elektrobit.com>
6 * 6 *
7 * Modified for omap shared clock framework by Tony Lindgren <tony@atomide.com> 7 * Modified for omap shared clock framework by Tony Lindgren <tony@atomide.com>
@@ -22,6 +22,7 @@
22#include <linux/mutex.h> 22#include <linux/mutex.h>
23#include <linux/platform_device.h> 23#include <linux/platform_device.h>
24#include <linux/cpufreq.h> 24#include <linux/cpufreq.h>
25#include <linux/debugfs.h>
25 26
26#include <asm/io.h> 27#include <asm/io.h>
27 28
@@ -33,41 +34,6 @@ static DEFINE_SPINLOCK(clockfw_lock);
33 34
34static struct clk_functions *arch_clock; 35static struct clk_functions *arch_clock;
35 36
36#ifdef CONFIG_PM_DEBUG
37
38static void print_parents(struct clk *clk)
39{
40 struct clk *p;
41 int printed = 0;
42
43 list_for_each_entry(p, &clocks, node) {
44 if (p->parent == clk && p->usecount) {
45 if (!clk->usecount && !printed) {
46 printk("MISMATCH: %s\n", clk->name);
47 printed = 1;
48 }
49 printk("\t%-15s\n", p->name);
50 }
51 }
52}
53
54void clk_print_usecounts(void)
55{
56 unsigned long flags;
57 struct clk *p;
58
59 spin_lock_irqsave(&clockfw_lock, flags);
60 list_for_each_entry(p, &clocks, node) {
61 if (p->usecount)
62 printk("%-15s: %d\n", p->name, p->usecount);
63 print_parents(p);
64
65 }
66 spin_unlock_irqrestore(&clockfw_lock, flags);
67}
68
69#endif
70
71/*------------------------------------------------------------------------- 37/*-------------------------------------------------------------------------
72 * Standard clock functions defined in include/linux/clk.h 38 * Standard clock functions defined in include/linux/clk.h
73 *-------------------------------------------------------------------------*/ 39 *-------------------------------------------------------------------------*/
@@ -446,3 +412,93 @@ int __init clk_init(struct clk_functions * custom_clocks)
446 return 0; 412 return 0;
447} 413}
448 414
415#if defined(CONFIG_PM_DEBUG) && defined(CONFIG_DEBUG_FS)
416/*
417 * debugfs support to trace clock tree hierarchy and attributes
418 */
419static struct dentry *clk_debugfs_root;
420
421static int clk_debugfs_register_one(struct clk *c)
422{
423 int err;
424 struct dentry *d, *child;
425 struct clk *pa = c->parent;
426 char s[255];
427 char *p = s;
428
429 p += sprintf(p, "%s", c->name);
430 if (c->id != 0)
431 sprintf(p, ":%d", c->id);
432 d = debugfs_create_dir(s, pa ? pa->dent : clk_debugfs_root);
433 if (IS_ERR(d))
434 return PTR_ERR(d);
435 c->dent = d;
436
437 d = debugfs_create_u8("usecount", S_IRUGO, c->dent, (u8 *)&c->usecount);
438 if (IS_ERR(d)) {
439 err = PTR_ERR(d);
440 goto err_out;
441 }
442 d = debugfs_create_u32("rate", S_IRUGO, c->dent, (u32 *)&c->rate);
443 if (IS_ERR(d)) {
444 err = PTR_ERR(d);
445 goto err_out;
446 }
447 d = debugfs_create_x32("flags", S_IRUGO, c->dent, (u32 *)&c->flags);
448 if (IS_ERR(d)) {
449 err = PTR_ERR(d);
450 goto err_out;
451 }
452 return 0;
453
454err_out:
455 d = c->dent;
456 list_for_each_entry(child, &d->d_subdirs, d_u.d_child)
457 debugfs_remove(child);
458 debugfs_remove(c->dent);
459 return err;
460}
461
462static int clk_debugfs_register(struct clk *c)
463{
464 int err;
465 struct clk *pa = c->parent;
466
467 if (pa && !pa->dent) {
468 err = clk_debugfs_register(pa);
469 if (err)
470 return err;
471 }
472
473 if (!c->dent) {
474 err = clk_debugfs_register_one(c);
475 if (err)
476 return err;
477 }
478 return 0;
479}
480
481static int __init clk_debugfs_init(void)
482{
483 struct clk *c;
484 struct dentry *d;
485 int err;
486
487 d = debugfs_create_dir("clock", NULL);
488 if (IS_ERR(d))
489 return PTR_ERR(d);
490 clk_debugfs_root = d;
491
492 list_for_each_entry(c, &clocks, node) {
493 err = clk_debugfs_register(c);
494 if (err)
495 goto err_out;
496 }
497 return 0;
498err_out:
499 debugfs_remove(clk_debugfs_root); /* REVISIT: Cleanup correctly */
500 return err;
501}
502late_initcall(clk_debugfs_init);
503
504#endif /* defined(CONFIG_PM_DEBUG) && defined(CONFIG_DEBUG_FS) */
diff --git a/arch/arm/plat-omap/common.c b/arch/arm/plat-omap/common.c
index bd1cef2c3c14..8d04929a3c75 100644
--- a/arch/arm/plat-omap/common.c
+++ b/arch/arm/plat-omap/common.c
@@ -26,6 +26,7 @@
26#include <asm/io.h> 26#include <asm/io.h>
27#include <asm/setup.h> 27#include <asm/setup.h>
28 28
29#include <asm/arch/common.h>
29#include <asm/arch/board.h> 30#include <asm/arch/board.h>
30#include <asm/arch/control.h> 31#include <asm/arch/control.h>
31#include <asm/arch/mux.h> 32#include <asm/arch/mux.h>
@@ -241,30 +242,70 @@ arch_initcall(omap_init_clocksource_32k);
241 242
242/* Global address base setup code */ 243/* Global address base setup code */
243 244
245#if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3)
246
247static struct omap_globals *omap2_globals;
248
249static void __init __omap2_set_globals(void)
250{
251 omap2_set_globals_memory(omap2_globals);
252 omap2_set_globals_control(omap2_globals);
253 omap2_set_globals_prcm(omap2_globals);
254}
255
256#endif
257
244#if defined(CONFIG_ARCH_OMAP2420) 258#if defined(CONFIG_ARCH_OMAP2420)
259
260static struct omap_globals omap242x_globals = {
261 .tap = (__force void __iomem *)OMAP2_IO_ADDRESS(0x48014000),
262 .sdrc = (__force void __iomem *)OMAP2_IO_ADDRESS(OMAP2420_SDRC_BASE),
263 .sms = (__force void __iomem *)OMAP2_IO_ADDRESS(OMAP2420_SMS_BASE),
264 .ctrl = (__force void __iomem *)OMAP2_IO_ADDRESS(OMAP2420_CTRL_BASE),
265 .prm = (__force void __iomem *)OMAP2_IO_ADDRESS(OMAP2420_PRM_BASE),
266 .cm = (__force void __iomem *)OMAP2_IO_ADDRESS(OMAP2420_CM_BASE),
267};
268
245void __init omap2_set_globals_242x(void) 269void __init omap2_set_globals_242x(void)
246{ 270{
247 omap2_sdrc_base = OMAP2420_SDRC_BASE; 271 omap2_globals = &omap242x_globals;
248 omap2_sms_base = OMAP2420_SMS_BASE; 272 __omap2_set_globals();
249 omap_ctrl_base_set(OMAP2420_CTRL_BASE);
250} 273}
251#endif 274#endif
252 275
253#if defined(CONFIG_ARCH_OMAP2430) 276#if defined(CONFIG_ARCH_OMAP2430)
277
278static struct omap_globals omap243x_globals = {
279 .tap = (__force void __iomem *)OMAP2_IO_ADDRESS(0x4900a000),
280 .sdrc = (__force void __iomem *)OMAP2_IO_ADDRESS(OMAP243X_SDRC_BASE),
281 .sms = (__force void __iomem *)OMAP2_IO_ADDRESS(OMAP243X_SMS_BASE),
282 .ctrl = (__force void __iomem *)OMAP2_IO_ADDRESS(OMAP243X_CTRL_BASE),
283 .prm = (__force void __iomem *)OMAP2_IO_ADDRESS(OMAP2430_PRM_BASE),
284 .cm = (__force void __iomem *)OMAP2_IO_ADDRESS(OMAP2430_CM_BASE),
285};
286
254void __init omap2_set_globals_243x(void) 287void __init omap2_set_globals_243x(void)
255{ 288{
256 omap2_sdrc_base = OMAP243X_SDRC_BASE; 289 omap2_globals = &omap243x_globals;
257 omap2_sms_base = OMAP243X_SMS_BASE; 290 __omap2_set_globals();
258 omap_ctrl_base_set(OMAP243X_CTRL_BASE);
259} 291}
260#endif 292#endif
261 293
262#if defined(CONFIG_ARCH_OMAP3430) 294#if defined(CONFIG_ARCH_OMAP3430)
295
296static struct omap_globals omap343x_globals = {
297 .tap = (__force void __iomem *)OMAP2_IO_ADDRESS(0x4830A000),
298 .sdrc = (__force void __iomem *)OMAP2_IO_ADDRESS(OMAP343X_SDRC_BASE),
299 .sms = (__force void __iomem *)OMAP2_IO_ADDRESS(OMAP343X_SMS_BASE),
300 .ctrl = (__force void __iomem *)OMAP2_IO_ADDRESS(OMAP343X_CTRL_BASE),
301 .prm = (__force void __iomem *)OMAP2_IO_ADDRESS(OMAP3430_PRM_BASE),
302 .cm = (__force void __iomem *)OMAP2_IO_ADDRESS(OMAP3430_CM_BASE),
303};
304
263void __init omap2_set_globals_343x(void) 305void __init omap2_set_globals_343x(void)
264{ 306{
265 omap2_sdrc_base = OMAP343X_SDRC_BASE; 307 omap2_globals = &omap343x_globals;
266 omap2_sms_base = OMAP343X_SMS_BASE; 308 __omap2_set_globals();
267 omap_ctrl_base_set(OMAP343X_CTRL_BASE);
268} 309}
269#endif 310#endif
270 311
diff --git a/arch/arm/plat-omap/devices.c b/arch/arm/plat-omap/devices.c
index 4a53f9ba6c43..81002b722da1 100644
--- a/arch/arm/plat-omap/devices.c
+++ b/arch/arm/plat-omap/devices.c
@@ -24,6 +24,7 @@
24#include <asm/arch/mux.h> 24#include <asm/arch/mux.h>
25#include <asm/arch/gpio.h> 25#include <asm/arch/gpio.h>
26#include <asm/arch/menelaus.h> 26#include <asm/arch/menelaus.h>
27#include <asm/arch/mcbsp.h>
27 28
28#if defined(CONFIG_OMAP_DSP) || defined(CONFIG_OMAP_DSP_MODULE) 29#if defined(CONFIG_OMAP_DSP) || defined(CONFIG_OMAP_DSP_MODULE)
29 30
@@ -145,6 +146,53 @@ static inline void omap_init_kp(void) {}
145#endif 146#endif
146 147
147/*-------------------------------------------------------------------------*/ 148/*-------------------------------------------------------------------------*/
149#if defined(CONFIG_OMAP_MCBSP) || defined(CONFIG_OMAP_MCBSP_MODULE)
150
151static struct platform_device **omap_mcbsp_devices;
152
153void omap_mcbsp_register_board_cfg(struct omap_mcbsp_platform_data *config,
154 int size)
155{
156 int i;
157
158 if (size > OMAP_MAX_MCBSP_COUNT) {
159 printk(KERN_WARNING "Registered too many McBSPs platform_data."
160 " Using maximum (%d) available.\n",
161 OMAP_MAX_MCBSP_COUNT);
162 size = OMAP_MAX_MCBSP_COUNT;
163 }
164
165 omap_mcbsp_devices = kzalloc(size * sizeof(struct platform_device *),
166 GFP_KERNEL);
167 if (!omap_mcbsp_devices) {
168 printk(KERN_ERR "Could not register McBSP devices\n");
169 return;
170 }
171
172 for (i = 0; i < size; i++) {
173 struct platform_device *new_mcbsp;
174 int ret;
175
176 new_mcbsp = platform_device_alloc("omap-mcbsp", i + 1);
177 if (!new_mcbsp)
178 continue;
179 new_mcbsp->dev.platform_data = &config[i];
180 ret = platform_device_add(new_mcbsp);
181 if (ret) {
182 platform_device_put(new_mcbsp);
183 continue;
184 }
185 omap_mcbsp_devices[i] = new_mcbsp;
186 }
187}
188
189#else
190void omap_mcbsp_register_board_cfg(struct omap_mcbsp_platform_data *config,
191 int size)
192{ }
193#endif
194
195/*-------------------------------------------------------------------------*/
148 196
149#if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE) 197#if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE)
150 198
diff --git a/arch/arm/plat-omap/dma.c b/arch/arm/plat-omap/dma.c
index c00eda588cd8..fac8e994f588 100644
--- a/arch/arm/plat-omap/dma.c
+++ b/arch/arm/plat-omap/dma.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * linux/arch/arm/plat-omap/dma.c 2 * linux/arch/arm/plat-omap/dma.c
3 * 3 *
4 * Copyright (C) 2003 Nokia Corporation 4 * Copyright (C) 2003 - 2008 Nokia Corporation
5 * Author: Juha Yrjölä <juha.yrjola@nokia.com> 5 * Author: Juha Yrjölä <juha.yrjola@nokia.com>
6 * DMA channel linking for 1610 by Samuel Ortiz <samuel.ortiz@nokia.com> 6 * DMA channel linking for 1610 by Samuel Ortiz <samuel.ortiz@nokia.com>
7 * Graphics DMA and LCD DMA graphics tranformations 7 * Graphics DMA and LCD DMA graphics tranformations
@@ -25,11 +25,11 @@
25#include <linux/errno.h> 25#include <linux/errno.h>
26#include <linux/interrupt.h> 26#include <linux/interrupt.h>
27#include <linux/irq.h> 27#include <linux/irq.h>
28#include <linux/io.h>
28 29
29#include <asm/system.h> 30#include <asm/system.h>
30#include <asm/hardware.h> 31#include <asm/hardware.h>
31#include <asm/dma.h> 32#include <asm/dma.h>
32#include <asm/io.h>
33 33
34#include <asm/arch/tc.h> 34#include <asm/arch/tc.h>
35 35
@@ -43,13 +43,13 @@ enum { DMA_CH_ALLOC_DONE, DMA_CH_PARAMS_SET_DONE, DMA_CH_STARTED,
43enum { DMA_CHAIN_STARTED, DMA_CHAIN_NOTSTARTED }; 43enum { DMA_CHAIN_STARTED, DMA_CHAIN_NOTSTARTED };
44#endif 44#endif
45 45
46#define OMAP_DMA_ACTIVE 0x01 46#define OMAP_DMA_ACTIVE 0x01
47#define OMAP_DMA_CCR_EN (1 << 7) 47#define OMAP_DMA_CCR_EN (1 << 7)
48#define OMAP2_DMA_CSR_CLEAR_MASK 0xffe 48#define OMAP2_DMA_CSR_CLEAR_MASK 0xffe
49 49
50#define OMAP_FUNC_MUX_ARM_BASE (0xfffe1000 + 0xec) 50#define OMAP_FUNC_MUX_ARM_BASE (0xfffe1000 + 0xec)
51 51
52static int enable_1510_mode = 0; 52static int enable_1510_mode;
53 53
54struct omap_dma_lch { 54struct omap_dma_lch {
55 int next_lch; 55 int next_lch;
@@ -57,7 +57,7 @@ struct omap_dma_lch {
57 u16 saved_csr; 57 u16 saved_csr;
58 u16 enabled_irqs; 58 u16 enabled_irqs;
59 const char *dev_name; 59 const char *dev_name;
60 void (* callback)(int lch, u16 ch_status, void *data); 60 void (*callback)(int lch, u16 ch_status, void *data);
61 void *data; 61 void *data;
62 62
63#ifndef CONFIG_ARCH_OMAP1 63#ifndef CONFIG_ARCH_OMAP1
@@ -72,7 +72,6 @@ struct omap_dma_lch {
72 long flags; 72 long flags;
73}; 73};
74 74
75#ifndef CONFIG_ARCH_OMAP1
76struct dma_link_info { 75struct dma_link_info {
77 int *linked_dmach_q; 76 int *linked_dmach_q;
78 int no_of_lchs_linked; 77 int no_of_lchs_linked;
@@ -86,7 +85,9 @@ struct dma_link_info {
86 85
87}; 86};
88 87
89static struct dma_link_info dma_linked_lch[OMAP_LOGICAL_DMA_CH_COUNT]; 88static struct dma_link_info *dma_linked_lch;
89
90#ifndef CONFIG_ARCH_OMAP1
90 91
91/* Chain handling macros */ 92/* Chain handling macros */
92#define OMAP_DMA_CHAIN_QINIT(chain_id) \ 93#define OMAP_DMA_CHAIN_QINIT(chain_id) \
@@ -119,12 +120,15 @@ static struct dma_link_info dma_linked_lch[OMAP_LOGICAL_DMA_CH_COUNT];
119 dma_linked_lch[chain_id].q_count++; \ 120 dma_linked_lch[chain_id].q_count++; \
120 } while (0) 121 } while (0)
121#endif 122#endif
123
124static int dma_lch_count;
122static int dma_chan_count; 125static int dma_chan_count;
123 126
124static spinlock_t dma_chan_lock; 127static spinlock_t dma_chan_lock;
125static struct omap_dma_lch dma_chan[OMAP_LOGICAL_DMA_CH_COUNT]; 128static struct omap_dma_lch *dma_chan;
129static void __iomem *omap_dma_base;
126 130
127static const u8 omap1_dma_irq[OMAP_LOGICAL_DMA_CH_COUNT] = { 131static const u8 omap1_dma_irq[OMAP1_LOGICAL_DMA_CH_COUNT] = {
128 INT_DMA_CH0_6, INT_DMA_CH1_7, INT_DMA_CH2_8, INT_DMA_CH3, 132 INT_DMA_CH0_6, INT_DMA_CH1_7, INT_DMA_CH2_8, INT_DMA_CH3,
129 INT_DMA_CH4, INT_DMA_CH5, INT_1610_DMA_CH6, INT_1610_DMA_CH7, 133 INT_DMA_CH4, INT_DMA_CH5, INT_1610_DMA_CH6, INT_1610_DMA_CH7,
130 INT_1610_DMA_CH8, INT_1610_DMA_CH9, INT_1610_DMA_CH10, 134 INT_1610_DMA_CH8, INT_1610_DMA_CH9, INT_1610_DMA_CH10,
@@ -139,6 +143,24 @@ static inline void omap_enable_channel_irq(int lch);
139#define REVISIT_24XX() printk(KERN_ERR "FIXME: no %s on 24xx\n", \ 143#define REVISIT_24XX() printk(KERN_ERR "FIXME: no %s on 24xx\n", \
140 __func__); 144 __func__);
141 145
146#define dma_read(reg) \
147({ \
148 u32 __val; \
149 if (cpu_class_is_omap1()) \
150 __val = __raw_readw(omap_dma_base + OMAP1_DMA_##reg); \
151 else \
152 __val = __raw_readl(omap_dma_base + OMAP_DMA4_##reg); \
153 __val; \
154})
155
156#define dma_write(val, reg) \
157({ \
158 if (cpu_class_is_omap1()) \
159 __raw_writew((u16)(val), omap_dma_base + OMAP1_DMA_##reg); \
160 else \
161 __raw_writel((val), omap_dma_base + OMAP_DMA4_##reg); \
162})
163
142#ifdef CONFIG_ARCH_OMAP15XX 164#ifdef CONFIG_ARCH_OMAP15XX
143/* Returns 1 if the DMA module is in OMAP1510-compatible mode, 0 otherwise */ 165/* Returns 1 if the DMA module is in OMAP1510-compatible mode, 0 otherwise */
144int omap_dma_in_1510_mode(void) 166int omap_dma_in_1510_mode(void)
@@ -173,13 +195,14 @@ static inline void set_gdma_dev(int req, int dev)
173#define set_gdma_dev(req, dev) do {} while (0) 195#define set_gdma_dev(req, dev) do {} while (0)
174#endif 196#endif
175 197
198/* Omap1 only */
176static void clear_lch_regs(int lch) 199static void clear_lch_regs(int lch)
177{ 200{
178 int i; 201 int i;
179 u32 lch_base = OMAP_DMA_BASE + lch * 0x40; 202 void __iomem *lch_base = omap_dma_base + OMAP1_DMA_CH_BASE(lch);
180 203
181 for (i = 0; i < 0x2c; i += 2) 204 for (i = 0; i < 0x2c; i += 2)
182 omap_writew(0, lch_base + i); 205 __raw_writew(0, lch_base + i);
183} 206}
184 207
185void omap_set_dma_priority(int lch, int dst_port, int priority) 208void omap_set_dma_priority(int lch, int dst_port, int priority)
@@ -212,33 +235,49 @@ void omap_set_dma_priority(int lch, int dst_port, int priority)
212 } 235 }
213 236
214 if (cpu_class_is_omap2()) { 237 if (cpu_class_is_omap2()) {
238 u32 ccr;
239
240 ccr = dma_read(CCR(lch));
215 if (priority) 241 if (priority)
216 OMAP_DMA_CCR_REG(lch) |= (1 << 6); 242 ccr |= (1 << 6);
217 else 243 else
218 OMAP_DMA_CCR_REG(lch) &= ~(1 << 6); 244 ccr &= ~(1 << 6);
245 dma_write(ccr, CCR(lch));
219 } 246 }
220} 247}
248EXPORT_SYMBOL(omap_set_dma_priority);
221 249
222void omap_set_dma_transfer_params(int lch, int data_type, int elem_count, 250void omap_set_dma_transfer_params(int lch, int data_type, int elem_count,
223 int frame_count, int sync_mode, 251 int frame_count, int sync_mode,
224 int dma_trigger, int src_or_dst_synch) 252 int dma_trigger, int src_or_dst_synch)
225{ 253{
226 OMAP_DMA_CSDP_REG(lch) &= ~0x03; 254 u32 l;
227 OMAP_DMA_CSDP_REG(lch) |= data_type; 255
256 l = dma_read(CSDP(lch));
257 l &= ~0x03;
258 l |= data_type;
259 dma_write(l, CSDP(lch));
228 260
229 if (cpu_class_is_omap1()) { 261 if (cpu_class_is_omap1()) {
230 OMAP_DMA_CCR_REG(lch) &= ~(1 << 5); 262 u16 ccr;
263
264 ccr = dma_read(CCR(lch));
265 ccr &= ~(1 << 5);
231 if (sync_mode == OMAP_DMA_SYNC_FRAME) 266 if (sync_mode == OMAP_DMA_SYNC_FRAME)
232 OMAP_DMA_CCR_REG(lch) |= 1 << 5; 267 ccr |= 1 << 5;
268 dma_write(ccr, CCR(lch));
233 269
234 OMAP1_DMA_CCR2_REG(lch) &= ~(1 << 2); 270 ccr = dma_read(CCR2(lch));
271 ccr &= ~(1 << 2);
235 if (sync_mode == OMAP_DMA_SYNC_BLOCK) 272 if (sync_mode == OMAP_DMA_SYNC_BLOCK)
236 OMAP1_DMA_CCR2_REG(lch) |= 1 << 2; 273 ccr |= 1 << 2;
274 dma_write(ccr, CCR2(lch));
237 } 275 }
238 276
239 if (cpu_class_is_omap2() && dma_trigger) { 277 if (cpu_class_is_omap2() && dma_trigger) {
240 u32 val = OMAP_DMA_CCR_REG(lch); 278 u32 val;
241 279
280 val = dma_read(CCR(lch));
242 val &= ~(3 << 19); 281 val &= ~(3 << 19);
243 if (dma_trigger > 63) 282 if (dma_trigger > 63)
244 val |= 1 << 20; 283 val |= 1 << 20;
@@ -263,12 +302,13 @@ void omap_set_dma_transfer_params(int lch, int data_type, int elem_count,
263 else 302 else
264 val &= ~(1 << 24); /* dest synch */ 303 val &= ~(1 << 24); /* dest synch */
265 304
266 OMAP_DMA_CCR_REG(lch) = val; 305 dma_write(val, CCR(lch));
267 } 306 }
268 307
269 OMAP_DMA_CEN_REG(lch) = elem_count; 308 dma_write(elem_count, CEN(lch));
270 OMAP_DMA_CFN_REG(lch) = frame_count; 309 dma_write(frame_count, CFN(lch));
271} 310}
311EXPORT_SYMBOL(omap_set_dma_transfer_params);
272 312
273void omap_set_dma_color_mode(int lch, enum omap_dma_color_mode mode, u32 color) 313void omap_set_dma_color_mode(int lch, enum omap_dma_color_mode mode, u32 color)
274{ 314{
@@ -281,7 +321,9 @@ void omap_set_dma_color_mode(int lch, enum omap_dma_color_mode mode, u32 color)
281 return; 321 return;
282 } 322 }
283 323
284 w = OMAP1_DMA_CCR2_REG(lch) & ~0x03; 324 w = dma_read(CCR2(lch));
325 w &= ~0x03;
326
285 switch (mode) { 327 switch (mode) {
286 case OMAP_DMA_CONSTANT_FILL: 328 case OMAP_DMA_CONSTANT_FILL:
287 w |= 0x01; 329 w |= 0x01;
@@ -294,52 +336,81 @@ void omap_set_dma_color_mode(int lch, enum omap_dma_color_mode mode, u32 color)
294 default: 336 default:
295 BUG(); 337 BUG();
296 } 338 }
297 OMAP1_DMA_CCR2_REG(lch) = w; 339 dma_write(w, CCR2(lch));
298 340
299 w = OMAP1_DMA_LCH_CTRL_REG(lch) & ~0x0f; 341 w = dma_read(LCH_CTRL(lch));
342 w &= ~0x0f;
300 /* Default is channel type 2D */ 343 /* Default is channel type 2D */
301 if (mode) { 344 if (mode) {
302 OMAP1_DMA_COLOR_L_REG(lch) = (u16)color; 345 dma_write((u16)color, COLOR_L(lch));
303 OMAP1_DMA_COLOR_U_REG(lch) = (u16)(color >> 16); 346 dma_write((u16)(color >> 16), COLOR_U(lch));
304 w |= 1; /* Channel type G */ 347 w |= 1; /* Channel type G */
305 } 348 }
306 OMAP1_DMA_LCH_CTRL_REG(lch) = w; 349 dma_write(w, LCH_CTRL(lch));
307} 350}
351EXPORT_SYMBOL(omap_set_dma_color_mode);
308 352
309void omap_set_dma_write_mode(int lch, enum omap_dma_write_mode mode) 353void omap_set_dma_write_mode(int lch, enum omap_dma_write_mode mode)
310{ 354{
311 if (cpu_class_is_omap2()) { 355 if (cpu_class_is_omap2()) {
312 OMAP_DMA_CSDP_REG(lch) &= ~(0x3 << 16); 356 u32 csdp;
313 OMAP_DMA_CSDP_REG(lch) |= (mode << 16); 357
358 csdp = dma_read(CSDP(lch));
359 csdp &= ~(0x3 << 16);
360 csdp |= (mode << 16);
361 dma_write(csdp, CSDP(lch));
362 }
363}
364EXPORT_SYMBOL(omap_set_dma_write_mode);
365
366void omap_set_dma_channel_mode(int lch, enum omap_dma_channel_mode mode)
367{
368 if (cpu_class_is_omap1() && !cpu_is_omap15xx()) {
369 u32 l;
370
371 l = dma_read(LCH_CTRL(lch));
372 l &= ~0x7;
373 l |= mode;
374 dma_write(l, LCH_CTRL(lch));
314 } 375 }
315} 376}
377EXPORT_SYMBOL(omap_set_dma_channel_mode);
316 378
317/* Note that src_port is only for omap1 */ 379/* Note that src_port is only for omap1 */
318void omap_set_dma_src_params(int lch, int src_port, int src_amode, 380void omap_set_dma_src_params(int lch, int src_port, int src_amode,
319 unsigned long src_start, 381 unsigned long src_start,
320 int src_ei, int src_fi) 382 int src_ei, int src_fi)
321{ 383{
384 u32 l;
385
322 if (cpu_class_is_omap1()) { 386 if (cpu_class_is_omap1()) {
323 OMAP_DMA_CSDP_REG(lch) &= ~(0x1f << 2); 387 u16 w;
324 OMAP_DMA_CSDP_REG(lch) |= src_port << 2; 388
389 w = dma_read(CSDP(lch));
390 w &= ~(0x1f << 2);
391 w |= src_port << 2;
392 dma_write(w, CSDP(lch));
325 } 393 }
326 394
327 OMAP_DMA_CCR_REG(lch) &= ~(0x03 << 12); 395 l = dma_read(CCR(lch));
328 OMAP_DMA_CCR_REG(lch) |= src_amode << 12; 396 l &= ~(0x03 << 12);
397 l |= src_amode << 12;
398 dma_write(l, CCR(lch));
329 399
330 if (cpu_class_is_omap1()) { 400 if (cpu_class_is_omap1()) {
331 OMAP1_DMA_CSSA_U_REG(lch) = src_start >> 16; 401 dma_write(src_start >> 16, CSSA_U(lch));
332 OMAP1_DMA_CSSA_L_REG(lch) = src_start; 402 dma_write((u16)src_start, CSSA_L(lch));
333 } 403 }
334 404
335 if (cpu_class_is_omap2()) 405 if (cpu_class_is_omap2())
336 OMAP2_DMA_CSSA_REG(lch) = src_start; 406 dma_write(src_start, CSSA(lch));
337 407
338 OMAP_DMA_CSEI_REG(lch) = src_ei; 408 dma_write(src_ei, CSEI(lch));
339 OMAP_DMA_CSFI_REG(lch) = src_fi; 409 dma_write(src_fi, CSFI(lch));
340} 410}
411EXPORT_SYMBOL(omap_set_dma_src_params);
341 412
342void omap_set_dma_params(int lch, struct omap_dma_channel_params * params) 413void omap_set_dma_params(int lch, struct omap_dma_channel_params *params)
343{ 414{
344 omap_set_dma_transfer_params(lch, params->data_type, 415 omap_set_dma_transfer_params(lch, params->data_type,
345 params->elem_count, params->frame_count, 416 params->elem_count, params->frame_count,
@@ -356,28 +427,37 @@ void omap_set_dma_params(int lch, struct omap_dma_channel_params * params)
356 omap_dma_set_prio_lch(lch, params->read_prio, 427 omap_dma_set_prio_lch(lch, params->read_prio,
357 params->write_prio); 428 params->write_prio);
358} 429}
430EXPORT_SYMBOL(omap_set_dma_params);
359 431
360void omap_set_dma_src_index(int lch, int eidx, int fidx) 432void omap_set_dma_src_index(int lch, int eidx, int fidx)
361{ 433{
362 if (cpu_class_is_omap2()) { 434 if (cpu_class_is_omap2())
363 REVISIT_24XX();
364 return; 435 return;
365 } 436
366 OMAP_DMA_CSEI_REG(lch) = eidx; 437 dma_write(eidx, CSEI(lch));
367 OMAP_DMA_CSFI_REG(lch) = fidx; 438 dma_write(fidx, CSFI(lch));
368} 439}
440EXPORT_SYMBOL(omap_set_dma_src_index);
369 441
370void omap_set_dma_src_data_pack(int lch, int enable) 442void omap_set_dma_src_data_pack(int lch, int enable)
371{ 443{
372 OMAP_DMA_CSDP_REG(lch) &= ~(1 << 6); 444 u32 l;
445
446 l = dma_read(CSDP(lch));
447 l &= ~(1 << 6);
373 if (enable) 448 if (enable)
374 OMAP_DMA_CSDP_REG(lch) |= (1 << 6); 449 l |= (1 << 6);
450 dma_write(l, CSDP(lch));
375} 451}
452EXPORT_SYMBOL(omap_set_dma_src_data_pack);
376 453
377void omap_set_dma_src_burst_mode(int lch, enum omap_dma_burst_mode burst_mode) 454void omap_set_dma_src_burst_mode(int lch, enum omap_dma_burst_mode burst_mode)
378{ 455{
379 unsigned int burst = 0; 456 unsigned int burst = 0;
380 OMAP_DMA_CSDP_REG(lch) &= ~(0x03 << 7); 457 u32 l;
458
459 l = dma_read(CSDP(lch));
460 l &= ~(0x03 << 7);
381 461
382 switch (burst_mode) { 462 switch (burst_mode) {
383 case OMAP_DMA_DATA_BURST_DIS: 463 case OMAP_DMA_DATA_BURST_DIS:
@@ -408,55 +488,73 @@ void omap_set_dma_src_burst_mode(int lch, enum omap_dma_burst_mode burst_mode)
408 default: 488 default:
409 BUG(); 489 BUG();
410 } 490 }
411 OMAP_DMA_CSDP_REG(lch) |= (burst << 7); 491
492 l |= (burst << 7);
493 dma_write(l, CSDP(lch));
412} 494}
495EXPORT_SYMBOL(omap_set_dma_src_burst_mode);
413 496
414/* Note that dest_port is only for OMAP1 */ 497/* Note that dest_port is only for OMAP1 */
415void omap_set_dma_dest_params(int lch, int dest_port, int dest_amode, 498void omap_set_dma_dest_params(int lch, int dest_port, int dest_amode,
416 unsigned long dest_start, 499 unsigned long dest_start,
417 int dst_ei, int dst_fi) 500 int dst_ei, int dst_fi)
418{ 501{
502 u32 l;
503
419 if (cpu_class_is_omap1()) { 504 if (cpu_class_is_omap1()) {
420 OMAP_DMA_CSDP_REG(lch) &= ~(0x1f << 9); 505 l = dma_read(CSDP(lch));
421 OMAP_DMA_CSDP_REG(lch) |= dest_port << 9; 506 l &= ~(0x1f << 9);
507 l |= dest_port << 9;
508 dma_write(l, CSDP(lch));
422 } 509 }
423 510
424 OMAP_DMA_CCR_REG(lch) &= ~(0x03 << 14); 511 l = dma_read(CCR(lch));
425 OMAP_DMA_CCR_REG(lch) |= dest_amode << 14; 512 l &= ~(0x03 << 14);
513 l |= dest_amode << 14;
514 dma_write(l, CCR(lch));
426 515
427 if (cpu_class_is_omap1()) { 516 if (cpu_class_is_omap1()) {
428 OMAP1_DMA_CDSA_U_REG(lch) = dest_start >> 16; 517 dma_write(dest_start >> 16, CDSA_U(lch));
429 OMAP1_DMA_CDSA_L_REG(lch) = dest_start; 518 dma_write(dest_start, CDSA_L(lch));
430 } 519 }
431 520
432 if (cpu_class_is_omap2()) 521 if (cpu_class_is_omap2())
433 OMAP2_DMA_CDSA_REG(lch) = dest_start; 522 dma_write(dest_start, CDSA(lch));
434 523
435 OMAP_DMA_CDEI_REG(lch) = dst_ei; 524 dma_write(dst_ei, CDEI(lch));
436 OMAP_DMA_CDFI_REG(lch) = dst_fi; 525 dma_write(dst_fi, CDFI(lch));
437} 526}
527EXPORT_SYMBOL(omap_set_dma_dest_params);
438 528
439void omap_set_dma_dest_index(int lch, int eidx, int fidx) 529void omap_set_dma_dest_index(int lch, int eidx, int fidx)
440{ 530{
441 if (cpu_class_is_omap2()) { 531 if (cpu_class_is_omap2())
442 REVISIT_24XX();
443 return; 532 return;
444 } 533
445 OMAP_DMA_CDEI_REG(lch) = eidx; 534 dma_write(eidx, CDEI(lch));
446 OMAP_DMA_CDFI_REG(lch) = fidx; 535 dma_write(fidx, CDFI(lch));
447} 536}
537EXPORT_SYMBOL(omap_set_dma_dest_index);
448 538
449void omap_set_dma_dest_data_pack(int lch, int enable) 539void omap_set_dma_dest_data_pack(int lch, int enable)
450{ 540{
451 OMAP_DMA_CSDP_REG(lch) &= ~(1 << 13); 541 u32 l;
542
543 l = dma_read(CSDP(lch));
544 l &= ~(1 << 13);
452 if (enable) 545 if (enable)
453 OMAP_DMA_CSDP_REG(lch) |= 1 << 13; 546 l |= 1 << 13;
547 dma_write(l, CSDP(lch));
454} 548}
549EXPORT_SYMBOL(omap_set_dma_dest_data_pack);
455 550
456void omap_set_dma_dest_burst_mode(int lch, enum omap_dma_burst_mode burst_mode) 551void omap_set_dma_dest_burst_mode(int lch, enum omap_dma_burst_mode burst_mode)
457{ 552{
458 unsigned int burst = 0; 553 unsigned int burst = 0;
459 OMAP_DMA_CSDP_REG(lch) &= ~(0x03 << 14); 554 u32 l;
555
556 l = dma_read(CSDP(lch));
557 l &= ~(0x03 << 14);
460 558
461 switch (burst_mode) { 559 switch (burst_mode) {
462 case OMAP_DMA_DATA_BURST_DIS: 560 case OMAP_DMA_DATA_BURST_DIS:
@@ -486,8 +584,10 @@ void omap_set_dma_dest_burst_mode(int lch, enum omap_dma_burst_mode burst_mode)
486 BUG(); 584 BUG();
487 return; 585 return;
488 } 586 }
489 OMAP_DMA_CSDP_REG(lch) |= (burst << 14); 587 l |= (burst << 14);
588 dma_write(l, CSDP(lch));
490} 589}
590EXPORT_SYMBOL(omap_set_dma_dest_burst_mode);
491 591
492static inline void omap_enable_channel_irq(int lch) 592static inline void omap_enable_channel_irq(int lch)
493{ 593{
@@ -495,64 +595,74 @@ static inline void omap_enable_channel_irq(int lch)
495 595
496 /* Clear CSR */ 596 /* Clear CSR */
497 if (cpu_class_is_omap1()) 597 if (cpu_class_is_omap1())
498 status = OMAP_DMA_CSR_REG(lch); 598 status = dma_read(CSR(lch));
499 else if (cpu_class_is_omap2()) 599 else if (cpu_class_is_omap2())
500 OMAP_DMA_CSR_REG(lch) = OMAP2_DMA_CSR_CLEAR_MASK; 600 dma_write(OMAP2_DMA_CSR_CLEAR_MASK, CSR(lch));
501 601
502 /* Enable some nice interrupts. */ 602 /* Enable some nice interrupts. */
503 OMAP_DMA_CICR_REG(lch) = dma_chan[lch].enabled_irqs; 603 dma_write(dma_chan[lch].enabled_irqs, CICR(lch));
504
505 dma_chan[lch].flags |= OMAP_DMA_ACTIVE;
506} 604}
507 605
508static void omap_disable_channel_irq(int lch) 606static void omap_disable_channel_irq(int lch)
509{ 607{
510 if (cpu_class_is_omap2()) 608 if (cpu_class_is_omap2())
511 OMAP_DMA_CICR_REG(lch) = 0; 609 dma_write(0, CICR(lch));
512} 610}
513 611
514void omap_enable_dma_irq(int lch, u16 bits) 612void omap_enable_dma_irq(int lch, u16 bits)
515{ 613{
516 dma_chan[lch].enabled_irqs |= bits; 614 dma_chan[lch].enabled_irqs |= bits;
517} 615}
616EXPORT_SYMBOL(omap_enable_dma_irq);
518 617
519void omap_disable_dma_irq(int lch, u16 bits) 618void omap_disable_dma_irq(int lch, u16 bits)
520{ 619{
521 dma_chan[lch].enabled_irqs &= ~bits; 620 dma_chan[lch].enabled_irqs &= ~bits;
522} 621}
622EXPORT_SYMBOL(omap_disable_dma_irq);
523 623
524static inline void enable_lnk(int lch) 624static inline void enable_lnk(int lch)
525{ 625{
626 u32 l;
627
628 l = dma_read(CLNK_CTRL(lch));
629
526 if (cpu_class_is_omap1()) 630 if (cpu_class_is_omap1())
527 OMAP_DMA_CLNK_CTRL_REG(lch) &= ~(1 << 14); 631 l &= ~(1 << 14);
528 632
529 /* Set the ENABLE_LNK bits */ 633 /* Set the ENABLE_LNK bits */
530 if (dma_chan[lch].next_lch != -1) 634 if (dma_chan[lch].next_lch != -1)
531 OMAP_DMA_CLNK_CTRL_REG(lch) = 635 l = dma_chan[lch].next_lch | (1 << 15);
532 dma_chan[lch].next_lch | (1 << 15);
533 636
534#ifndef CONFIG_ARCH_OMAP1 637#ifndef CONFIG_ARCH_OMAP1
535 if (dma_chan[lch].next_linked_ch != -1) 638 if (cpu_class_is_omap2())
536 OMAP_DMA_CLNK_CTRL_REG(lch) = 639 if (dma_chan[lch].next_linked_ch != -1)
537 dma_chan[lch].next_linked_ch | (1 << 15); 640 l = dma_chan[lch].next_linked_ch | (1 << 15);
538#endif 641#endif
642
643 dma_write(l, CLNK_CTRL(lch));
539} 644}
540 645
541static inline void disable_lnk(int lch) 646static inline void disable_lnk(int lch)
542{ 647{
648 u32 l;
649
650 l = dma_read(CLNK_CTRL(lch));
651
543 /* Disable interrupts */ 652 /* Disable interrupts */
544 if (cpu_class_is_omap1()) { 653 if (cpu_class_is_omap1()) {
545 OMAP_DMA_CICR_REG(lch) = 0; 654 dma_write(0, CICR(lch));
546 /* Set the STOP_LNK bit */ 655 /* Set the STOP_LNK bit */
547 OMAP_DMA_CLNK_CTRL_REG(lch) |= 1 << 14; 656 l |= 1 << 14;
548 } 657 }
549 658
550 if (cpu_class_is_omap2()) { 659 if (cpu_class_is_omap2()) {
551 omap_disable_channel_irq(lch); 660 omap_disable_channel_irq(lch);
552 /* Clear the ENABLE_LNK bit */ 661 /* Clear the ENABLE_LNK bit */
553 OMAP_DMA_CLNK_CTRL_REG(lch) &= ~(1 << 15); 662 l &= ~(1 << 15);
554 } 663 }
555 664
665 dma_write(l, CLNK_CTRL(lch));
556 dma_chan[lch].flags &= ~OMAP_DMA_ACTIVE; 666 dma_chan[lch].flags &= ~OMAP_DMA_ACTIVE;
557} 667}
558 668
@@ -563,13 +673,13 @@ static inline void omap2_enable_irq_lch(int lch)
563 if (!cpu_class_is_omap2()) 673 if (!cpu_class_is_omap2())
564 return; 674 return;
565 675
566 val = omap_readl(OMAP_DMA4_IRQENABLE_L0); 676 val = dma_read(IRQENABLE_L0);
567 val |= 1 << lch; 677 val |= 1 << lch;
568 omap_writel(val, OMAP_DMA4_IRQENABLE_L0); 678 dma_write(val, IRQENABLE_L0);
569} 679}
570 680
571int omap_request_dma(int dev_id, const char *dev_name, 681int omap_request_dma(int dev_id, const char *dev_name,
572 void (* callback)(int lch, u16 ch_status, void *data), 682 void (*callback)(int lch, u16 ch_status, void *data),
573 void *data, int *dma_ch_out) 683 void *data, int *dma_ch_out)
574{ 684{
575 int ch, free_ch = -1; 685 int ch, free_ch = -1;
@@ -602,10 +712,14 @@ int omap_request_dma(int dev_id, const char *dev_name,
602 chan->dev_name = dev_name; 712 chan->dev_name = dev_name;
603 chan->callback = callback; 713 chan->callback = callback;
604 chan->data = data; 714 chan->data = data;
715
605#ifndef CONFIG_ARCH_OMAP1 716#ifndef CONFIG_ARCH_OMAP1
606 chan->chain_id = -1; 717 if (cpu_class_is_omap2()) {
607 chan->next_linked_ch = -1; 718 chan->chain_id = -1;
719 chan->next_linked_ch = -1;
720 }
608#endif 721#endif
722
609 chan->enabled_irqs = OMAP_DMA_DROP_IRQ | OMAP_DMA_BLOCK_IRQ; 723 chan->enabled_irqs = OMAP_DMA_DROP_IRQ | OMAP_DMA_BLOCK_IRQ;
610 724
611 if (cpu_class_is_omap1()) 725 if (cpu_class_is_omap1())
@@ -620,26 +734,28 @@ int omap_request_dma(int dev_id, const char *dev_name,
620 set_gdma_dev(free_ch + 1, dev_id); 734 set_gdma_dev(free_ch + 1, dev_id);
621 dev_id = free_ch + 1; 735 dev_id = free_ch + 1;
622 } 736 }
623 /* Disable the 1510 compatibility mode and set the sync device 737 /*
624 * id. */ 738 * Disable the 1510 compatibility mode and set the sync device
625 OMAP_DMA_CCR_REG(free_ch) = dev_id | (1 << 10); 739 * id.
740 */
741 dma_write(dev_id | (1 << 10), CCR(free_ch));
626 } else if (cpu_is_omap730() || cpu_is_omap15xx()) { 742 } else if (cpu_is_omap730() || cpu_is_omap15xx()) {
627 OMAP_DMA_CCR_REG(free_ch) = dev_id; 743 dma_write(dev_id, CCR(free_ch));
628 } 744 }
629 745
630 if (cpu_class_is_omap2()) { 746 if (cpu_class_is_omap2()) {
631 omap2_enable_irq_lch(free_ch); 747 omap2_enable_irq_lch(free_ch);
632
633 omap_enable_channel_irq(free_ch); 748 omap_enable_channel_irq(free_ch);
634 /* Clear the CSR register and IRQ status register */ 749 /* Clear the CSR register and IRQ status register */
635 OMAP_DMA_CSR_REG(free_ch) = OMAP2_DMA_CSR_CLEAR_MASK; 750 dma_write(OMAP2_DMA_CSR_CLEAR_MASK, CSR(free_ch));
636 omap_writel(1 << free_ch, OMAP_DMA4_IRQSTATUS_L0); 751 dma_write(1 << free_ch, IRQSTATUS_L0);
637 } 752 }
638 753
639 *dma_ch_out = free_ch; 754 *dma_ch_out = free_ch;
640 755
641 return 0; 756 return 0;
642} 757}
758EXPORT_SYMBOL(omap_request_dma);
643 759
644void omap_free_dma(int lch) 760void omap_free_dma(int lch)
645{ 761{
@@ -647,11 +763,12 @@ void omap_free_dma(int lch)
647 763
648 spin_lock_irqsave(&dma_chan_lock, flags); 764 spin_lock_irqsave(&dma_chan_lock, flags);
649 if (dma_chan[lch].dev_id == -1) { 765 if (dma_chan[lch].dev_id == -1) {
650 printk("omap_dma: trying to free nonallocated DMA channel %d\n", 766 pr_err("omap_dma: trying to free unallocated DMA channel %d\n",
651 lch); 767 lch);
652 spin_unlock_irqrestore(&dma_chan_lock, flags); 768 spin_unlock_irqrestore(&dma_chan_lock, flags);
653 return; 769 return;
654 } 770 }
771
655 dma_chan[lch].dev_id = -1; 772 dma_chan[lch].dev_id = -1;
656 dma_chan[lch].next_lch = -1; 773 dma_chan[lch].next_lch = -1;
657 dma_chan[lch].callback = NULL; 774 dma_chan[lch].callback = NULL;
@@ -659,30 +776,31 @@ void omap_free_dma(int lch)
659 776
660 if (cpu_class_is_omap1()) { 777 if (cpu_class_is_omap1()) {
661 /* Disable all DMA interrupts for the channel. */ 778 /* Disable all DMA interrupts for the channel. */
662 OMAP_DMA_CICR_REG(lch) = 0; 779 dma_write(0, CICR(lch));
663 /* Make sure the DMA transfer is stopped. */ 780 /* Make sure the DMA transfer is stopped. */
664 OMAP_DMA_CCR_REG(lch) = 0; 781 dma_write(0, CCR(lch));
665 } 782 }
666 783
667 if (cpu_class_is_omap2()) { 784 if (cpu_class_is_omap2()) {
668 u32 val; 785 u32 val;
669 /* Disable interrupts */ 786 /* Disable interrupts */
670 val = omap_readl(OMAP_DMA4_IRQENABLE_L0); 787 val = dma_read(IRQENABLE_L0);
671 val &= ~(1 << lch); 788 val &= ~(1 << lch);
672 omap_writel(val, OMAP_DMA4_IRQENABLE_L0); 789 dma_write(val, IRQENABLE_L0);
673 790
674 /* Clear the CSR register and IRQ status register */ 791 /* Clear the CSR register and IRQ status register */
675 OMAP_DMA_CSR_REG(lch) = OMAP2_DMA_CSR_CLEAR_MASK; 792 dma_write(OMAP2_DMA_CSR_CLEAR_MASK, CSR(lch));
676 omap_writel(1 << lch, OMAP_DMA4_IRQSTATUS_L0); 793 dma_write(1 << lch, IRQSTATUS_L0);
677 794
678 /* Disable all DMA interrupts for the channel. */ 795 /* Disable all DMA interrupts for the channel. */
679 OMAP_DMA_CICR_REG(lch) = 0; 796 dma_write(0, CICR(lch));
680 797
681 /* Make sure the DMA transfer is stopped. */ 798 /* Make sure the DMA transfer is stopped. */
682 OMAP_DMA_CCR_REG(lch) = 0; 799 dma_write(0, CCR(lch));
683 omap_clear_dma(lch); 800 omap_clear_dma(lch);
684 } 801 }
685} 802}
803EXPORT_SYMBOL(omap_free_dma);
686 804
687/** 805/**
688 * @brief omap_dma_set_global_params : Set global priority settings for dma 806 * @brief omap_dma_set_global_params : Set global priority settings for dma
@@ -710,7 +828,7 @@ omap_dma_set_global_params(int arb_rate, int max_fifo_depth, int tparams)
710 reg = (arb_rate & 0xff) << 16; 828 reg = (arb_rate & 0xff) << 16;
711 reg |= (0xff & max_fifo_depth); 829 reg |= (0xff & max_fifo_depth);
712 830
713 omap_writel(reg, OMAP_DMA4_GCR_REG); 831 dma_write(reg, GCR);
714} 832}
715EXPORT_SYMBOL(omap_dma_set_global_params); 833EXPORT_SYMBOL(omap_dma_set_global_params);
716 834
@@ -727,20 +845,21 @@ int
727omap_dma_set_prio_lch(int lch, unsigned char read_prio, 845omap_dma_set_prio_lch(int lch, unsigned char read_prio,
728 unsigned char write_prio) 846 unsigned char write_prio)
729{ 847{
730 u32 w; 848 u32 l;
731 849
732 if (unlikely((lch < 0 || lch >= OMAP_LOGICAL_DMA_CH_COUNT))) { 850 if (unlikely((lch < 0 || lch >= dma_lch_count))) {
733 printk(KERN_ERR "Invalid channel id\n"); 851 printk(KERN_ERR "Invalid channel id\n");
734 return -EINVAL; 852 return -EINVAL;
735 } 853 }
736 w = OMAP_DMA_CCR_REG(lch); 854 l = dma_read(CCR(lch));
737 w &= ~((1 << 6) | (1 << 26)); 855 l &= ~((1 << 6) | (1 << 26));
738 if (cpu_is_omap2430() || cpu_is_omap34xx()) 856 if (cpu_is_omap2430() || cpu_is_omap34xx())
739 w |= ((read_prio & 0x1) << 6) | ((write_prio & 0x1) << 26); 857 l |= ((read_prio & 0x1) << 6) | ((write_prio & 0x1) << 26);
740 else 858 else
741 w |= ((read_prio & 0x1) << 6); 859 l |= ((read_prio & 0x1) << 6);
860
861 dma_write(l, CCR(lch));
742 862
743 OMAP_DMA_CCR_REG(lch) = w;
744 return 0; 863 return 0;
745} 864}
746EXPORT_SYMBOL(omap_dma_set_prio_lch); 865EXPORT_SYMBOL(omap_dma_set_prio_lch);
@@ -756,28 +875,34 @@ void omap_clear_dma(int lch)
756 local_irq_save(flags); 875 local_irq_save(flags);
757 876
758 if (cpu_class_is_omap1()) { 877 if (cpu_class_is_omap1()) {
759 int status; 878 u32 l;
760 OMAP_DMA_CCR_REG(lch) &= ~OMAP_DMA_CCR_EN; 879
880 l = dma_read(CCR(lch));
881 l &= ~OMAP_DMA_CCR_EN;
882 dma_write(l, CCR(lch));
761 883
762 /* Clear pending interrupts */ 884 /* Clear pending interrupts */
763 status = OMAP_DMA_CSR_REG(lch); 885 l = dma_read(CSR(lch));
764 } 886 }
765 887
766 if (cpu_class_is_omap2()) { 888 if (cpu_class_is_omap2()) {
767 int i; 889 int i;
768 u32 lch_base = OMAP_DMA4_BASE + lch * 0x60 + 0x80; 890 void __iomem *lch_base = omap_dma_base + OMAP_DMA4_CH_BASE(lch);
769 for (i = 0; i < 0x44; i += 4) 891 for (i = 0; i < 0x44; i += 4)
770 omap_writel(0, lch_base + i); 892 __raw_writel(0, lch_base + i);
771 } 893 }
772 894
773 local_irq_restore(flags); 895 local_irq_restore(flags);
774} 896}
897EXPORT_SYMBOL(omap_clear_dma);
775 898
776void omap_start_dma(int lch) 899void omap_start_dma(int lch)
777{ 900{
901 u32 l;
902
778 if (!omap_dma_in_1510_mode() && dma_chan[lch].next_lch != -1) { 903 if (!omap_dma_in_1510_mode() && dma_chan[lch].next_lch != -1) {
779 int next_lch, cur_lch; 904 int next_lch, cur_lch;
780 char dma_chan_link_map[OMAP_LOGICAL_DMA_CH_COUNT]; 905 char dma_chan_link_map[OMAP_DMA4_LOGICAL_DMA_CH_COUNT];
781 906
782 dma_chan_link_map[lch] = 1; 907 dma_chan_link_map[lch] = 1;
783 /* Set the link register of the first channel */ 908 /* Set the link register of the first channel */
@@ -801,27 +926,34 @@ void omap_start_dma(int lch)
801 } while (next_lch != -1); 926 } while (next_lch != -1);
802 } else if (cpu_class_is_omap2()) { 927 } else if (cpu_class_is_omap2()) {
803 /* Errata: Need to write lch even if not using chaining */ 928 /* Errata: Need to write lch even if not using chaining */
804 OMAP_DMA_CLNK_CTRL_REG(lch) = lch; 929 dma_write(lch, CLNK_CTRL(lch));
805 } 930 }
806 931
807 omap_enable_channel_irq(lch); 932 omap_enable_channel_irq(lch);
808 933
809 /* Errata: On ES2.0 BUFFERING disable must be set. 934 l = dma_read(CCR(lch));
810 * This will always fail on ES1.0 */
811 if (cpu_is_omap24xx()) {
812 OMAP_DMA_CCR_REG(lch) |= OMAP_DMA_CCR_EN;
813 }
814 935
815 OMAP_DMA_CCR_REG(lch) |= OMAP_DMA_CCR_EN; 936 /*
937 * Errata: On ES2.0 BUFFERING disable must be set.
938 * This will always fail on ES1.0
939 */
940 if (cpu_is_omap24xx())
941 l |= OMAP_DMA_CCR_EN;
942
943 l |= OMAP_DMA_CCR_EN;
944 dma_write(l, CCR(lch));
816 945
817 dma_chan[lch].flags |= OMAP_DMA_ACTIVE; 946 dma_chan[lch].flags |= OMAP_DMA_ACTIVE;
818} 947}
948EXPORT_SYMBOL(omap_start_dma);
819 949
820void omap_stop_dma(int lch) 950void omap_stop_dma(int lch)
821{ 951{
952 u32 l;
953
822 if (!omap_dma_in_1510_mode() && dma_chan[lch].next_lch != -1) { 954 if (!omap_dma_in_1510_mode() && dma_chan[lch].next_lch != -1) {
823 int next_lch, cur_lch = lch; 955 int next_lch, cur_lch = lch;
824 char dma_chan_link_map[OMAP_LOGICAL_DMA_CH_COUNT]; 956 char dma_chan_link_map[OMAP_DMA4_LOGICAL_DMA_CH_COUNT];
825 957
826 memset(dma_chan_link_map, 0, sizeof(dma_chan_link_map)); 958 memset(dma_chan_link_map, 0, sizeof(dma_chan_link_map));
827 do { 959 do {
@@ -842,18 +974,22 @@ void omap_stop_dma(int lch)
842 974
843 /* Disable all interrupts on the channel */ 975 /* Disable all interrupts on the channel */
844 if (cpu_class_is_omap1()) 976 if (cpu_class_is_omap1())
845 OMAP_DMA_CICR_REG(lch) = 0; 977 dma_write(0, CICR(lch));
978
979 l = dma_read(CCR(lch));
980 l &= ~OMAP_DMA_CCR_EN;
981 dma_write(l, CCR(lch));
846 982
847 OMAP_DMA_CCR_REG(lch) &= ~OMAP_DMA_CCR_EN;
848 dma_chan[lch].flags &= ~OMAP_DMA_ACTIVE; 983 dma_chan[lch].flags &= ~OMAP_DMA_ACTIVE;
849} 984}
985EXPORT_SYMBOL(omap_stop_dma);
850 986
851/* 987/*
852 * Allows changing the DMA callback function or data. This may be needed if 988 * Allows changing the DMA callback function or data. This may be needed if
853 * the driver shares a single DMA channel for multiple dma triggers. 989 * the driver shares a single DMA channel for multiple dma triggers.
854 */ 990 */
855int omap_set_dma_callback(int lch, 991int omap_set_dma_callback(int lch,
856 void (* callback)(int lch, u16 ch_status, void *data), 992 void (*callback)(int lch, u16 ch_status, void *data),
857 void *data) 993 void *data)
858{ 994{
859 unsigned long flags; 995 unsigned long flags;
@@ -873,6 +1009,7 @@ int omap_set_dma_callback(int lch,
873 1009
874 return 0; 1010 return 0;
875} 1011}
1012EXPORT_SYMBOL(omap_set_dma_callback);
876 1013
877/* 1014/*
878 * Returns current physical source address for the given DMA channel. 1015 * Returns current physical source address for the given DMA channel.
@@ -886,15 +1023,24 @@ dma_addr_t omap_get_dma_src_pos(int lch)
886{ 1023{
887 dma_addr_t offset = 0; 1024 dma_addr_t offset = 0;
888 1025
889 if (cpu_class_is_omap1()) 1026 if (cpu_is_omap15xx())
890 offset = (dma_addr_t) (OMAP1_DMA_CSSA_L_REG(lch) | 1027 offset = dma_read(CPC(lch));
891 (OMAP1_DMA_CSSA_U_REG(lch) << 16)); 1028 else
1029 offset = dma_read(CSAC(lch));
892 1030
893 if (cpu_class_is_omap2()) 1031 /*
894 offset = OMAP_DMA_CSAC_REG(lch); 1032 * omap 3.2/3.3 erratum: sometimes 0 is returned if CSAC/CDAC is
1033 * read before the DMA controller finished disabling the channel.
1034 */
1035 if (!cpu_is_omap15xx() && offset == 0)
1036 offset = dma_read(CSAC(lch));
1037
1038 if (cpu_class_is_omap1())
1039 offset |= (dma_read(CSSA_U(lch)) << 16);
895 1040
896 return offset; 1041 return offset;
897} 1042}
1043EXPORT_SYMBOL(omap_get_dma_src_pos);
898 1044
899/* 1045/*
900 * Returns current physical destination address for the given DMA channel. 1046 * Returns current physical destination address for the given DMA channel.
@@ -908,25 +1054,30 @@ dma_addr_t omap_get_dma_dst_pos(int lch)
908{ 1054{
909 dma_addr_t offset = 0; 1055 dma_addr_t offset = 0;
910 1056
911 if (cpu_class_is_omap1()) 1057 if (cpu_is_omap15xx())
912 offset = (dma_addr_t) (OMAP1_DMA_CDSA_L_REG(lch) | 1058 offset = dma_read(CPC(lch));
913 (OMAP1_DMA_CDSA_U_REG(lch) << 16)); 1059 else
1060 offset = dma_read(CDAC(lch));
914 1061
915 if (cpu_class_is_omap2()) 1062 /*
916 offset = OMAP_DMA_CDAC_REG(lch); 1063 * omap 3.2/3.3 erratum: sometimes 0 is returned if CSAC/CDAC is
1064 * read before the DMA controller finished disabling the channel.
1065 */
1066 if (!cpu_is_omap15xx() && offset == 0)
1067 offset = dma_read(CDAC(lch));
1068
1069 if (cpu_class_is_omap1())
1070 offset |= (dma_read(CDSA_U(lch)) << 16);
917 1071
918 return offset; 1072 return offset;
919} 1073}
1074EXPORT_SYMBOL(omap_get_dma_dst_pos);
920 1075
921/* 1076int omap_get_dma_active_status(int lch)
922 * Returns current source transfer counting for the given DMA channel.
923 * Can be used to monitor the progress of a transfer inside a block.
924 * It must be called with disabled interrupts.
925 */
926int omap_get_dma_src_addr_counter(int lch)
927{ 1077{
928 return (dma_addr_t) OMAP_DMA_CSAC_REG(lch); 1078 return (dma_read(CCR(lch)) & OMAP_DMA_CCR_EN) != 0;
929} 1079}
1080EXPORT_SYMBOL(omap_get_dma_active_status);
930 1081
931int omap_dma_running(void) 1082int omap_dma_running(void)
932{ 1083{
@@ -938,7 +1089,7 @@ int omap_dma_running(void)
938 return 1; 1089 return 1;
939 1090
940 for (lch = 0; lch < dma_chan_count; lch++) 1091 for (lch = 0; lch < dma_chan_count; lch++)
941 if (OMAP_DMA_CCR_REG(lch) & OMAP_DMA_CCR_EN) 1092 if (dma_read(CCR(lch)) & OMAP_DMA_CCR_EN)
942 return 1; 1093 return 1;
943 1094
944 return 0; 1095 return 0;
@@ -949,7 +1100,7 @@ int omap_dma_running(void)
949 * For this DMA link to start, you still need to start (see omap_start_dma) 1100 * For this DMA link to start, you still need to start (see omap_start_dma)
950 * the first one. That will fire up the entire queue. 1101 * the first one. That will fire up the entire queue.
951 */ 1102 */
952void omap_dma_link_lch (int lch_head, int lch_queue) 1103void omap_dma_link_lch(int lch_head, int lch_queue)
953{ 1104{
954 if (omap_dma_in_1510_mode()) { 1105 if (omap_dma_in_1510_mode()) {
955 printk(KERN_ERR "DMA linking is not supported in 1510 mode\n"); 1106 printk(KERN_ERR "DMA linking is not supported in 1510 mode\n");
@@ -966,11 +1117,12 @@ void omap_dma_link_lch (int lch_head, int lch_queue)
966 1117
967 dma_chan[lch_head].next_lch = lch_queue; 1118 dma_chan[lch_head].next_lch = lch_queue;
968} 1119}
1120EXPORT_SYMBOL(omap_dma_link_lch);
969 1121
970/* 1122/*
971 * Once the DMA queue is stopped, we can destroy it. 1123 * Once the DMA queue is stopped, we can destroy it.
972 */ 1124 */
973void omap_dma_unlink_lch (int lch_head, int lch_queue) 1125void omap_dma_unlink_lch(int lch_head, int lch_queue)
974{ 1126{
975 if (omap_dma_in_1510_mode()) { 1127 if (omap_dma_in_1510_mode()) {
976 printk(KERN_ERR "DMA linking is not supported in 1510 mode\n"); 1128 printk(KERN_ERR "DMA linking is not supported in 1510 mode\n");
@@ -985,7 +1137,6 @@ void omap_dma_unlink_lch (int lch_head, int lch_queue)
985 dump_stack(); 1137 dump_stack();
986 } 1138 }
987 1139
988
989 if ((dma_chan[lch_head].flags & OMAP_DMA_ACTIVE) || 1140 if ((dma_chan[lch_head].flags & OMAP_DMA_ACTIVE) ||
990 (dma_chan[lch_head].flags & OMAP_DMA_ACTIVE)) { 1141 (dma_chan[lch_head].flags & OMAP_DMA_ACTIVE)) {
991 printk(KERN_ERR "omap_dma: You need to stop the DMA channels " 1142 printk(KERN_ERR "omap_dma: You need to stop the DMA channels "
@@ -995,12 +1146,15 @@ void omap_dma_unlink_lch (int lch_head, int lch_queue)
995 1146
996 dma_chan[lch_head].next_lch = -1; 1147 dma_chan[lch_head].next_lch = -1;
997} 1148}
1149EXPORT_SYMBOL(omap_dma_unlink_lch);
1150
1151/*----------------------------------------------------------------------------*/
998 1152
999#ifndef CONFIG_ARCH_OMAP1 1153#ifndef CONFIG_ARCH_OMAP1
1000/* Create chain of DMA channesls */ 1154/* Create chain of DMA channesls */
1001static void create_dma_lch_chain(int lch_head, int lch_queue) 1155static void create_dma_lch_chain(int lch_head, int lch_queue)
1002{ 1156{
1003 u32 w; 1157 u32 l;
1004 1158
1005 /* Check if this is the first link in chain */ 1159 /* Check if this is the first link in chain */
1006 if (dma_chan[lch_head].next_linked_ch == -1) { 1160 if (dma_chan[lch_head].next_linked_ch == -1) {
@@ -1020,15 +1174,15 @@ static void create_dma_lch_chain(int lch_head, int lch_queue)
1020 lch_queue; 1174 lch_queue;
1021 } 1175 }
1022 1176
1023 w = OMAP_DMA_CLNK_CTRL_REG(lch_head); 1177 l = dma_read(CLNK_CTRL(lch_head));
1024 w &= ~(0x1f); 1178 l &= ~(0x1f);
1025 w |= lch_queue; 1179 l |= lch_queue;
1026 OMAP_DMA_CLNK_CTRL_REG(lch_head) = w; 1180 dma_write(l, CLNK_CTRL(lch_head));
1027 1181
1028 w = OMAP_DMA_CLNK_CTRL_REG(lch_queue); 1182 l = dma_read(CLNK_CTRL(lch_queue));
1029 w &= ~(0x1f); 1183 l &= ~(0x1f);
1030 w |= (dma_chan[lch_queue].next_linked_ch); 1184 l |= (dma_chan[lch_queue].next_linked_ch);
1031 OMAP_DMA_CLNK_CTRL_REG(lch_queue) = w; 1185 dma_write(l, CLNK_CTRL(lch_queue));
1032} 1186}
1033 1187
1034/** 1188/**
@@ -1063,7 +1217,7 @@ int omap_request_dma_chain(int dev_id, const char *dev_name,
1063 } 1217 }
1064 1218
1065 if (unlikely((no_of_chans < 1 1219 if (unlikely((no_of_chans < 1
1066 || no_of_chans > OMAP_LOGICAL_DMA_CH_COUNT))) { 1220 || no_of_chans > dma_lch_count))) {
1067 printk(KERN_ERR "Invalid Number of channels requested\n"); 1221 printk(KERN_ERR "Invalid Number of channels requested\n");
1068 return -EINVAL; 1222 return -EINVAL;
1069 } 1223 }
@@ -1118,6 +1272,7 @@ int omap_request_dma_chain(int dev_id, const char *dev_name,
1118 for (i = 0; i < (no_of_chans - 1); i++) 1272 for (i = 0; i < (no_of_chans - 1); i++)
1119 create_dma_lch_chain(channels[i], channels[i + 1]); 1273 create_dma_lch_chain(channels[i], channels[i + 1]);
1120 } 1274 }
1275
1121 return 0; 1276 return 0;
1122} 1277}
1123EXPORT_SYMBOL(omap_request_dma_chain); 1278EXPORT_SYMBOL(omap_request_dma_chain);
@@ -1140,7 +1295,7 @@ int omap_modify_dma_chain_params(int chain_id,
1140 1295
1141 /* Check for input params */ 1296 /* Check for input params */
1142 if (unlikely((chain_id < 0 1297 if (unlikely((chain_id < 0
1143 || chain_id >= OMAP_LOGICAL_DMA_CH_COUNT))) { 1298 || chain_id >= dma_lch_count))) {
1144 printk(KERN_ERR "Invalid chain id\n"); 1299 printk(KERN_ERR "Invalid chain id\n");
1145 return -EINVAL; 1300 return -EINVAL;
1146 } 1301 }
@@ -1160,6 +1315,7 @@ int omap_modify_dma_chain_params(int chain_id,
1160 */ 1315 */
1161 omap_set_dma_params(channels[i], &params); 1316 omap_set_dma_params(channels[i], &params);
1162 } 1317 }
1318
1163 return 0; 1319 return 0;
1164} 1320}
1165EXPORT_SYMBOL(omap_modify_dma_chain_params); 1321EXPORT_SYMBOL(omap_modify_dma_chain_params);
@@ -1178,7 +1334,7 @@ int omap_free_dma_chain(int chain_id)
1178 u32 i; 1334 u32 i;
1179 1335
1180 /* Check for input params */ 1336 /* Check for input params */
1181 if (unlikely((chain_id < 0 || chain_id >= OMAP_LOGICAL_DMA_CH_COUNT))) { 1337 if (unlikely((chain_id < 0 || chain_id >= dma_lch_count))) {
1182 printk(KERN_ERR "Invalid chain id\n"); 1338 printk(KERN_ERR "Invalid chain id\n");
1183 return -EINVAL; 1339 return -EINVAL;
1184 } 1340 }
@@ -1203,6 +1359,7 @@ int omap_free_dma_chain(int chain_id)
1203 dma_linked_lch[chain_id].linked_dmach_q = NULL; 1359 dma_linked_lch[chain_id].linked_dmach_q = NULL;
1204 dma_linked_lch[chain_id].chain_mode = -1; 1360 dma_linked_lch[chain_id].chain_mode = -1;
1205 dma_linked_lch[chain_id].chain_state = -1; 1361 dma_linked_lch[chain_id].chain_state = -1;
1362
1206 return (0); 1363 return (0);
1207} 1364}
1208EXPORT_SYMBOL(omap_free_dma_chain); 1365EXPORT_SYMBOL(omap_free_dma_chain);
@@ -1218,7 +1375,7 @@ EXPORT_SYMBOL(omap_free_dma_chain);
1218int omap_dma_chain_status(int chain_id) 1375int omap_dma_chain_status(int chain_id)
1219{ 1376{
1220 /* Check for input params */ 1377 /* Check for input params */
1221 if (unlikely((chain_id < 0 || chain_id >= OMAP_LOGICAL_DMA_CH_COUNT))) { 1378 if (unlikely((chain_id < 0 || chain_id >= dma_lch_count))) {
1222 printk(KERN_ERR "Invalid chain id\n"); 1379 printk(KERN_ERR "Invalid chain id\n");
1223 return -EINVAL; 1380 return -EINVAL;
1224 } 1381 }
@@ -1233,6 +1390,7 @@ int omap_dma_chain_status(int chain_id)
1233 1390
1234 if (OMAP_DMA_CHAIN_QEMPTY(chain_id)) 1391 if (OMAP_DMA_CHAIN_QEMPTY(chain_id))
1235 return OMAP_DMA_CHAIN_INACTIVE; 1392 return OMAP_DMA_CHAIN_INACTIVE;
1393
1236 return OMAP_DMA_CHAIN_ACTIVE; 1394 return OMAP_DMA_CHAIN_ACTIVE;
1237} 1395}
1238EXPORT_SYMBOL(omap_dma_chain_status); 1396EXPORT_SYMBOL(omap_dma_chain_status);
@@ -1255,11 +1413,13 @@ int omap_dma_chain_a_transfer(int chain_id, int src_start, int dest_start,
1255 int elem_count, int frame_count, void *callbk_data) 1413 int elem_count, int frame_count, void *callbk_data)
1256{ 1414{
1257 int *channels; 1415 int *channels;
1258 u32 w, lch; 1416 u32 l, lch;
1259 int start_dma = 0; 1417 int start_dma = 0;
1260 1418
1261 /* if buffer size is less than 1 then there is 1419 /*
1262 * no use of starting the chain */ 1420 * if buffer size is less than 1 then there is
1421 * no use of starting the chain
1422 */
1263 if (elem_count < 1) { 1423 if (elem_count < 1) {
1264 printk(KERN_ERR "Invalid buffer size\n"); 1424 printk(KERN_ERR "Invalid buffer size\n");
1265 return -EINVAL; 1425 return -EINVAL;
@@ -1267,7 +1427,7 @@ int omap_dma_chain_a_transfer(int chain_id, int src_start, int dest_start,
1267 1427
1268 /* Check for input params */ 1428 /* Check for input params */
1269 if (unlikely((chain_id < 0 1429 if (unlikely((chain_id < 0
1270 || chain_id >= OMAP_LOGICAL_DMA_CH_COUNT))) { 1430 || chain_id >= dma_lch_count))) {
1271 printk(KERN_ERR "Invalid chain id\n"); 1431 printk(KERN_ERR "Invalid chain id\n");
1272 return -EINVAL; 1432 return -EINVAL;
1273 } 1433 }
@@ -1296,20 +1456,24 @@ int omap_dma_chain_a_transfer(int chain_id, int src_start, int dest_start,
1296 1456
1297 /* Set the params to the free channel */ 1457 /* Set the params to the free channel */
1298 if (src_start != 0) 1458 if (src_start != 0)
1299 OMAP2_DMA_CSSA_REG(lch) = src_start; 1459 dma_write(src_start, CSSA(lch));
1300 if (dest_start != 0) 1460 if (dest_start != 0)
1301 OMAP2_DMA_CDSA_REG(lch) = dest_start; 1461 dma_write(dest_start, CDSA(lch));
1302 1462
1303 /* Write the buffer size */ 1463 /* Write the buffer size */
1304 OMAP_DMA_CEN_REG(lch) = elem_count; 1464 dma_write(elem_count, CEN(lch));
1305 OMAP_DMA_CFN_REG(lch) = frame_count; 1465 dma_write(frame_count, CFN(lch));
1306 1466
1307 /* If the chain is dynamically linked, 1467 /*
1308 * then we may have to start the chain if its not active */ 1468 * If the chain is dynamically linked,
1469 * then we may have to start the chain if its not active
1470 */
1309 if (dma_linked_lch[chain_id].chain_mode == OMAP_DMA_DYNAMIC_CHAIN) { 1471 if (dma_linked_lch[chain_id].chain_mode == OMAP_DMA_DYNAMIC_CHAIN) {
1310 1472
1311 /* In Dynamic chain, if the chain is not started, 1473 /*
1312 * queue the channel */ 1474 * In Dynamic chain, if the chain is not started,
1475 * queue the channel
1476 */
1313 if (dma_linked_lch[chain_id].chain_state == 1477 if (dma_linked_lch[chain_id].chain_state ==
1314 DMA_CHAIN_NOTSTARTED) { 1478 DMA_CHAIN_NOTSTARTED) {
1315 /* Enable the link in previous channel */ 1479 /* Enable the link in previous channel */
@@ -1319,8 +1483,10 @@ int omap_dma_chain_a_transfer(int chain_id, int src_start, int dest_start,
1319 dma_chan[lch].state = DMA_CH_QUEUED; 1483 dma_chan[lch].state = DMA_CH_QUEUED;
1320 } 1484 }
1321 1485
1322 /* Chain is already started, make sure its active, 1486 /*
1323 * if not then start the chain */ 1487 * Chain is already started, make sure its active,
1488 * if not then start the chain
1489 */
1324 else { 1490 else {
1325 start_dma = 1; 1491 start_dma = 1;
1326 1492
@@ -1329,8 +1495,8 @@ int omap_dma_chain_a_transfer(int chain_id, int src_start, int dest_start,
1329 enable_lnk(dma_chan[lch].prev_linked_ch); 1495 enable_lnk(dma_chan[lch].prev_linked_ch);
1330 dma_chan[lch].state = DMA_CH_QUEUED; 1496 dma_chan[lch].state = DMA_CH_QUEUED;
1331 start_dma = 0; 1497 start_dma = 0;
1332 if (0 == ((1 << 7) & (OMAP_DMA_CCR_REG 1498 if (0 == ((1 << 7) & dma_read(
1333 (dma_chan[lch].prev_linked_ch)))) { 1499 CCR(dma_chan[lch].prev_linked_ch)))) {
1334 disable_lnk(dma_chan[lch]. 1500 disable_lnk(dma_chan[lch].
1335 prev_linked_ch); 1501 prev_linked_ch);
1336 pr_debug("\n prev ch is stopped\n"); 1502 pr_debug("\n prev ch is stopped\n");
@@ -1346,27 +1512,28 @@ int omap_dma_chain_a_transfer(int chain_id, int src_start, int dest_start,
1346 } 1512 }
1347 omap_enable_channel_irq(lch); 1513 omap_enable_channel_irq(lch);
1348 1514
1349 w = OMAP_DMA_CCR_REG(lch); 1515 l = dma_read(CCR(lch));
1350 1516
1351 if ((0 == (w & (1 << 24)))) 1517 if ((0 == (l & (1 << 24))))
1352 w &= ~(1 << 25); 1518 l &= ~(1 << 25);
1353 else 1519 else
1354 w |= (1 << 25); 1520 l |= (1 << 25);
1355 if (start_dma == 1) { 1521 if (start_dma == 1) {
1356 if (0 == (w & (1 << 7))) { 1522 if (0 == (l & (1 << 7))) {
1357 w |= (1 << 7); 1523 l |= (1 << 7);
1358 dma_chan[lch].state = DMA_CH_STARTED; 1524 dma_chan[lch].state = DMA_CH_STARTED;
1359 pr_debug("starting %d\n", lch); 1525 pr_debug("starting %d\n", lch);
1360 OMAP_DMA_CCR_REG(lch) = w; 1526 dma_write(l, CCR(lch));
1361 } else 1527 } else
1362 start_dma = 0; 1528 start_dma = 0;
1363 } else { 1529 } else {
1364 if (0 == (w & (1 << 7))) 1530 if (0 == (l & (1 << 7)))
1365 OMAP_DMA_CCR_REG(lch) = w; 1531 dma_write(l, CCR(lch));
1366 } 1532 }
1367 dma_chan[lch].flags |= OMAP_DMA_ACTIVE; 1533 dma_chan[lch].flags |= OMAP_DMA_ACTIVE;
1368 } 1534 }
1369 } 1535 }
1536
1370 return 0; 1537 return 0;
1371} 1538}
1372EXPORT_SYMBOL(omap_dma_chain_a_transfer); 1539EXPORT_SYMBOL(omap_dma_chain_a_transfer);
@@ -1382,9 +1549,9 @@ EXPORT_SYMBOL(omap_dma_chain_a_transfer);
1382int omap_start_dma_chain_transfers(int chain_id) 1549int omap_start_dma_chain_transfers(int chain_id)
1383{ 1550{
1384 int *channels; 1551 int *channels;
1385 u32 w, i; 1552 u32 l, i;
1386 1553
1387 if (unlikely((chain_id < 0 || chain_id >= OMAP_LOGICAL_DMA_CH_COUNT))) { 1554 if (unlikely((chain_id < 0 || chain_id >= dma_lch_count))) {
1388 printk(KERN_ERR "Invalid chain id\n"); 1555 printk(KERN_ERR "Invalid chain id\n");
1389 return -EINVAL; 1556 return -EINVAL;
1390 } 1557 }
@@ -1406,18 +1573,19 @@ int omap_start_dma_chain_transfers(int chain_id)
1406 omap_enable_channel_irq(channels[0]); 1573 omap_enable_channel_irq(channels[0]);
1407 } 1574 }
1408 1575
1409 w = OMAP_DMA_CCR_REG(channels[0]); 1576 l = dma_read(CCR(channels[0]));
1410 w |= (1 << 7); 1577 l |= (1 << 7);
1411 dma_linked_lch[chain_id].chain_state = DMA_CHAIN_STARTED; 1578 dma_linked_lch[chain_id].chain_state = DMA_CHAIN_STARTED;
1412 dma_chan[channels[0]].state = DMA_CH_STARTED; 1579 dma_chan[channels[0]].state = DMA_CH_STARTED;
1413 1580
1414 if ((0 == (w & (1 << 24)))) 1581 if ((0 == (l & (1 << 24))))
1415 w &= ~(1 << 25); 1582 l &= ~(1 << 25);
1416 else 1583 else
1417 w |= (1 << 25); 1584 l |= (1 << 25);
1418 OMAP_DMA_CCR_REG(channels[0]) = w; 1585 dma_write(l, CCR(channels[0]));
1419 1586
1420 dma_chan[channels[0]].flags |= OMAP_DMA_ACTIVE; 1587 dma_chan[channels[0]].flags |= OMAP_DMA_ACTIVE;
1588
1421 return 0; 1589 return 0;
1422} 1590}
1423EXPORT_SYMBOL(omap_start_dma_chain_transfers); 1591EXPORT_SYMBOL(omap_start_dma_chain_transfers);
@@ -1433,11 +1601,11 @@ EXPORT_SYMBOL(omap_start_dma_chain_transfers);
1433int omap_stop_dma_chain_transfers(int chain_id) 1601int omap_stop_dma_chain_transfers(int chain_id)
1434{ 1602{
1435 int *channels; 1603 int *channels;
1436 u32 w, i; 1604 u32 l, i;
1437 u32 sys_cf; 1605 u32 sys_cf;
1438 1606
1439 /* Check for input params */ 1607 /* Check for input params */
1440 if (unlikely((chain_id < 0 || chain_id >= OMAP_LOGICAL_DMA_CH_COUNT))) { 1608 if (unlikely((chain_id < 0 || chain_id >= dma_lch_count))) {
1441 printk(KERN_ERR "Invalid chain id\n"); 1609 printk(KERN_ERR "Invalid chain id\n");
1442 return -EINVAL; 1610 return -EINVAL;
1443 } 1611 }
@@ -1449,21 +1617,22 @@ int omap_stop_dma_chain_transfers(int chain_id)
1449 } 1617 }
1450 channels = dma_linked_lch[chain_id].linked_dmach_q; 1618 channels = dma_linked_lch[chain_id].linked_dmach_q;
1451 1619
1452 /* DMA Errata: 1620 /*
1621 * DMA Errata:
1453 * Special programming model needed to disable DMA before end of block 1622 * Special programming model needed to disable DMA before end of block
1454 */ 1623 */
1455 sys_cf = omap_readl(OMAP_DMA4_OCP_SYSCONFIG); 1624 sys_cf = dma_read(OCP_SYSCONFIG);
1456 w = sys_cf; 1625 l = sys_cf;
1457 /* Middle mode reg set no Standby */ 1626 /* Middle mode reg set no Standby */
1458 w &= ~((1 << 12)|(1 << 13)); 1627 l &= ~((1 << 12)|(1 << 13));
1459 omap_writel(w, OMAP_DMA4_OCP_SYSCONFIG); 1628 dma_write(l, OCP_SYSCONFIG);
1460 1629
1461 for (i = 0; i < dma_linked_lch[chain_id].no_of_lchs_linked; i++) { 1630 for (i = 0; i < dma_linked_lch[chain_id].no_of_lchs_linked; i++) {
1462 1631
1463 /* Stop the Channel transmission */ 1632 /* Stop the Channel transmission */
1464 w = OMAP_DMA_CCR_REG(channels[i]); 1633 l = dma_read(CCR(channels[i]));
1465 w &= ~(1 << 7); 1634 l &= ~(1 << 7);
1466 OMAP_DMA_CCR_REG(channels[i]) = w; 1635 dma_write(l, CCR(channels[i]));
1467 1636
1468 /* Disable the link in all the channels */ 1637 /* Disable the link in all the channels */
1469 disable_lnk(channels[i]); 1638 disable_lnk(channels[i]);
@@ -1476,7 +1645,8 @@ int omap_stop_dma_chain_transfers(int chain_id)
1476 OMAP_DMA_CHAIN_QINIT(chain_id); 1645 OMAP_DMA_CHAIN_QINIT(chain_id);
1477 1646
1478 /* Errata - put in the old value */ 1647 /* Errata - put in the old value */
1479 omap_writel(sys_cf, OMAP_DMA4_OCP_SYSCONFIG); 1648 dma_write(sys_cf, OCP_SYSCONFIG);
1649
1480 return 0; 1650 return 0;
1481} 1651}
1482EXPORT_SYMBOL(omap_stop_dma_chain_transfers); 1652EXPORT_SYMBOL(omap_stop_dma_chain_transfers);
@@ -1499,7 +1669,7 @@ int omap_get_dma_chain_index(int chain_id, int *ei, int *fi)
1499 int *channels; 1669 int *channels;
1500 1670
1501 /* Check for input params */ 1671 /* Check for input params */
1502 if (unlikely((chain_id < 0 || chain_id >= OMAP_LOGICAL_DMA_CH_COUNT))) { 1672 if (unlikely((chain_id < 0 || chain_id >= dma_lch_count))) {
1503 printk(KERN_ERR "Invalid chain id\n"); 1673 printk(KERN_ERR "Invalid chain id\n");
1504 return -EINVAL; 1674 return -EINVAL;
1505 } 1675 }
@@ -1517,8 +1687,8 @@ int omap_get_dma_chain_index(int chain_id, int *ei, int *fi)
1517 /* Get the current channel */ 1687 /* Get the current channel */
1518 lch = channels[dma_linked_lch[chain_id].q_head]; 1688 lch = channels[dma_linked_lch[chain_id].q_head];
1519 1689
1520 *ei = OMAP2_DMA_CCEN_REG(lch); 1690 *ei = dma_read(CCEN(lch));
1521 *fi = OMAP2_DMA_CCFN_REG(lch); 1691 *fi = dma_read(CCFN(lch));
1522 1692
1523 return 0; 1693 return 0;
1524} 1694}
@@ -1539,7 +1709,7 @@ int omap_get_dma_chain_dst_pos(int chain_id)
1539 int *channels; 1709 int *channels;
1540 1710
1541 /* Check for input params */ 1711 /* Check for input params */
1542 if (unlikely((chain_id < 0 || chain_id >= OMAP_LOGICAL_DMA_CH_COUNT))) { 1712 if (unlikely((chain_id < 0 || chain_id >= dma_lch_count))) {
1543 printk(KERN_ERR "Invalid chain id\n"); 1713 printk(KERN_ERR "Invalid chain id\n");
1544 return -EINVAL; 1714 return -EINVAL;
1545 } 1715 }
@@ -1555,7 +1725,7 @@ int omap_get_dma_chain_dst_pos(int chain_id)
1555 /* Get the current channel */ 1725 /* Get the current channel */
1556 lch = channels[dma_linked_lch[chain_id].q_head]; 1726 lch = channels[dma_linked_lch[chain_id].q_head];
1557 1727
1558 return (OMAP_DMA_CDAC_REG(lch)); 1728 return dma_read(CDAC(lch));
1559} 1729}
1560EXPORT_SYMBOL(omap_get_dma_chain_dst_pos); 1730EXPORT_SYMBOL(omap_get_dma_chain_dst_pos);
1561 1731
@@ -1573,7 +1743,7 @@ int omap_get_dma_chain_src_pos(int chain_id)
1573 int *channels; 1743 int *channels;
1574 1744
1575 /* Check for input params */ 1745 /* Check for input params */
1576 if (unlikely((chain_id < 0 || chain_id >= OMAP_LOGICAL_DMA_CH_COUNT))) { 1746 if (unlikely((chain_id < 0 || chain_id >= dma_lch_count))) {
1577 printk(KERN_ERR "Invalid chain id\n"); 1747 printk(KERN_ERR "Invalid chain id\n");
1578 return -EINVAL; 1748 return -EINVAL;
1579 } 1749 }
@@ -1589,10 +1759,10 @@ int omap_get_dma_chain_src_pos(int chain_id)
1589 /* Get the current channel */ 1759 /* Get the current channel */
1590 lch = channels[dma_linked_lch[chain_id].q_head]; 1760 lch = channels[dma_linked_lch[chain_id].q_head];
1591 1761
1592 return (OMAP_DMA_CSAC_REG(lch)); 1762 return dma_read(CSAC(lch));
1593} 1763}
1594EXPORT_SYMBOL(omap_get_dma_chain_src_pos); 1764EXPORT_SYMBOL(omap_get_dma_chain_src_pos);
1595#endif 1765#endif /* ifndef CONFIG_ARCH_OMAP1 */
1596 1766
1597/*----------------------------------------------------------------------------*/ 1767/*----------------------------------------------------------------------------*/
1598 1768
@@ -1600,13 +1770,13 @@ EXPORT_SYMBOL(omap_get_dma_chain_src_pos);
1600 1770
1601static int omap1_dma_handle_ch(int ch) 1771static int omap1_dma_handle_ch(int ch)
1602{ 1772{
1603 u16 csr; 1773 u32 csr;
1604 1774
1605 if (enable_1510_mode && ch >= 6) { 1775 if (enable_1510_mode && ch >= 6) {
1606 csr = dma_chan[ch].saved_csr; 1776 csr = dma_chan[ch].saved_csr;
1607 dma_chan[ch].saved_csr = 0; 1777 dma_chan[ch].saved_csr = 0;
1608 } else 1778 } else
1609 csr = OMAP_DMA_CSR_REG(ch); 1779 csr = dma_read(CSR(ch));
1610 if (enable_1510_mode && ch <= 2 && (csr >> 7) != 0) { 1780 if (enable_1510_mode && ch <= 2 && (csr >> 7) != 0) {
1611 dma_chan[ch + 6].saved_csr = csr >> 7; 1781 dma_chan[ch + 6].saved_csr = csr >> 7;
1612 csr &= 0x7f; 1782 csr &= 0x7f;
@@ -1628,6 +1798,7 @@ static int omap1_dma_handle_ch(int ch)
1628 dma_chan[ch].flags &= ~OMAP_DMA_ACTIVE; 1798 dma_chan[ch].flags &= ~OMAP_DMA_ACTIVE;
1629 if (likely(dma_chan[ch].callback != NULL)) 1799 if (likely(dma_chan[ch].callback != NULL))
1630 dma_chan[ch].callback(ch, csr, dma_chan[ch].data); 1800 dma_chan[ch].callback(ch, csr, dma_chan[ch].data);
1801
1631 return 1; 1802 return 1;
1632} 1803}
1633 1804
@@ -1658,12 +1829,13 @@ static irqreturn_t omap1_dma_irq_handler(int irq, void *dev_id)
1658 1829
1659static int omap2_dma_handle_ch(int ch) 1830static int omap2_dma_handle_ch(int ch)
1660{ 1831{
1661 u32 status = OMAP_DMA_CSR_REG(ch); 1832 u32 status = dma_read(CSR(ch));
1662 1833
1663 if (!status) { 1834 if (!status) {
1664 if (printk_ratelimit()) 1835 if (printk_ratelimit())
1665 printk(KERN_WARNING "Spurious DMA IRQ for lch %d\n", ch); 1836 printk(KERN_WARNING "Spurious DMA IRQ for lch %d\n",
1666 omap_writel(1 << ch, OMAP_DMA4_IRQSTATUS_L0); 1837 ch);
1838 dma_write(1 << ch, IRQSTATUS_L0);
1667 return 0; 1839 return 0;
1668 } 1840 }
1669 if (unlikely(dma_chan[ch].dev_id == -1)) { 1841 if (unlikely(dma_chan[ch].dev_id == -1)) {
@@ -1686,14 +1858,14 @@ static int omap2_dma_handle_ch(int ch)
1686 printk(KERN_INFO "DMA misaligned error with device %d\n", 1858 printk(KERN_INFO "DMA misaligned error with device %d\n",
1687 dma_chan[ch].dev_id); 1859 dma_chan[ch].dev_id);
1688 1860
1689 OMAP_DMA_CSR_REG(ch) = OMAP2_DMA_CSR_CLEAR_MASK; 1861 dma_write(OMAP2_DMA_CSR_CLEAR_MASK, CSR(ch));
1690 omap_writel(1 << ch, OMAP_DMA4_IRQSTATUS_L0); 1862 dma_write(1 << ch, IRQSTATUS_L0);
1691 1863
1692 /* If the ch is not chained then chain_id will be -1 */ 1864 /* If the ch is not chained then chain_id will be -1 */
1693 if (dma_chan[ch].chain_id != -1) { 1865 if (dma_chan[ch].chain_id != -1) {
1694 int chain_id = dma_chan[ch].chain_id; 1866 int chain_id = dma_chan[ch].chain_id;
1695 dma_chan[ch].state = DMA_CH_NOTSTARTED; 1867 dma_chan[ch].state = DMA_CH_NOTSTARTED;
1696 if (OMAP_DMA_CLNK_CTRL_REG(ch) & (1 << 15)) 1868 if (dma_read(CLNK_CTRL(ch)) & (1 << 15))
1697 dma_chan[dma_chan[ch].next_linked_ch].state = 1869 dma_chan[dma_chan[ch].next_linked_ch].state =
1698 DMA_CH_STARTED; 1870 DMA_CH_STARTED;
1699 if (dma_linked_lch[chain_id].chain_mode == 1871 if (dma_linked_lch[chain_id].chain_mode ==
@@ -1703,13 +1875,13 @@ static int omap2_dma_handle_ch(int ch)
1703 if (!OMAP_DMA_CHAIN_QEMPTY(chain_id)) 1875 if (!OMAP_DMA_CHAIN_QEMPTY(chain_id))
1704 OMAP_DMA_CHAIN_INCQHEAD(chain_id); 1876 OMAP_DMA_CHAIN_INCQHEAD(chain_id);
1705 1877
1706 status = OMAP_DMA_CSR_REG(ch); 1878 status = dma_read(CSR(ch));
1707 } 1879 }
1708 1880
1709 if (likely(dma_chan[ch].callback != NULL)) 1881 if (likely(dma_chan[ch].callback != NULL))
1710 dma_chan[ch].callback(ch, status, dma_chan[ch].data); 1882 dma_chan[ch].callback(ch, status, dma_chan[ch].data);
1711 1883
1712 OMAP_DMA_CSR_REG(ch) = status; 1884 dma_write(status, CSR(ch));
1713 1885
1714 return 0; 1886 return 0;
1715} 1887}
@@ -1720,13 +1892,13 @@ static irqreturn_t omap2_dma_irq_handler(int irq, void *dev_id)
1720 u32 val; 1892 u32 val;
1721 int i; 1893 int i;
1722 1894
1723 val = omap_readl(OMAP_DMA4_IRQSTATUS_L0); 1895 val = dma_read(IRQSTATUS_L0);
1724 if (val == 0) { 1896 if (val == 0) {
1725 if (printk_ratelimit()) 1897 if (printk_ratelimit())
1726 printk(KERN_WARNING "Spurious DMA IRQ\n"); 1898 printk(KERN_WARNING "Spurious DMA IRQ\n");
1727 return IRQ_HANDLED; 1899 return IRQ_HANDLED;
1728 } 1900 }
1729 for (i = 0; i < OMAP_LOGICAL_DMA_CH_COUNT && val != 0; i++) { 1901 for (i = 0; i < dma_lch_count && val != 0; i++) {
1730 if (val & 1) 1902 if (val & 1)
1731 omap2_dma_handle_ch(i); 1903 omap2_dma_handle_ch(i);
1732 val >>= 1; 1904 val >>= 1;
@@ -1750,7 +1922,7 @@ static struct irqaction omap24xx_dma_irq;
1750static struct lcd_dma_info { 1922static struct lcd_dma_info {
1751 spinlock_t lock; 1923 spinlock_t lock;
1752 int reserved; 1924 int reserved;
1753 void (* callback)(u16 status, void *data); 1925 void (*callback)(u16 status, void *data);
1754 void *cb_data; 1926 void *cb_data;
1755 1927
1756 int active; 1928 int active;
@@ -1772,6 +1944,7 @@ void omap_set_lcd_dma_b1(unsigned long addr, u16 fb_xres, u16 fb_yres,
1772 lcd_dma.xres = fb_xres; 1944 lcd_dma.xres = fb_xres;
1773 lcd_dma.yres = fb_yres; 1945 lcd_dma.yres = fb_yres;
1774} 1946}
1947EXPORT_SYMBOL(omap_set_lcd_dma_b1);
1775 1948
1776void omap_set_lcd_dma_src_port(int port) 1949void omap_set_lcd_dma_src_port(int port)
1777{ 1950{
@@ -1782,12 +1955,13 @@ void omap_set_lcd_dma_ext_controller(int external)
1782{ 1955{
1783 lcd_dma.ext_ctrl = external; 1956 lcd_dma.ext_ctrl = external;
1784} 1957}
1958EXPORT_SYMBOL(omap_set_lcd_dma_ext_controller);
1785 1959
1786void omap_set_lcd_dma_single_transfer(int single) 1960void omap_set_lcd_dma_single_transfer(int single)
1787{ 1961{
1788 lcd_dma.single_transfer = single; 1962 lcd_dma.single_transfer = single;
1789} 1963}
1790 1964EXPORT_SYMBOL(omap_set_lcd_dma_single_transfer);
1791 1965
1792void omap_set_lcd_dma_b1_rotation(int rotate) 1966void omap_set_lcd_dma_b1_rotation(int rotate)
1793{ 1967{
@@ -1798,6 +1972,7 @@ void omap_set_lcd_dma_b1_rotation(int rotate)
1798 } 1972 }
1799 lcd_dma.rotate = rotate; 1973 lcd_dma.rotate = rotate;
1800} 1974}
1975EXPORT_SYMBOL(omap_set_lcd_dma_b1_rotation);
1801 1976
1802void omap_set_lcd_dma_b1_mirror(int mirror) 1977void omap_set_lcd_dma_b1_mirror(int mirror)
1803{ 1978{
@@ -1807,6 +1982,7 @@ void omap_set_lcd_dma_b1_mirror(int mirror)
1807 } 1982 }
1808 lcd_dma.mirror = mirror; 1983 lcd_dma.mirror = mirror;
1809} 1984}
1985EXPORT_SYMBOL(omap_set_lcd_dma_b1_mirror);
1810 1986
1811void omap_set_lcd_dma_b1_vxres(unsigned long vxres) 1987void omap_set_lcd_dma_b1_vxres(unsigned long vxres)
1812{ 1988{
@@ -1817,6 +1993,7 @@ void omap_set_lcd_dma_b1_vxres(unsigned long vxres)
1817 } 1993 }
1818 lcd_dma.vxres = vxres; 1994 lcd_dma.vxres = vxres;
1819} 1995}
1996EXPORT_SYMBOL(omap_set_lcd_dma_b1_vxres);
1820 1997
1821void omap_set_lcd_dma_b1_scale(unsigned int xscale, unsigned int yscale) 1998void omap_set_lcd_dma_b1_scale(unsigned int xscale, unsigned int yscale)
1822{ 1999{
@@ -1827,6 +2004,7 @@ void omap_set_lcd_dma_b1_scale(unsigned int xscale, unsigned int yscale)
1827 lcd_dma.xscale = xscale; 2004 lcd_dma.xscale = xscale;
1828 lcd_dma.yscale = yscale; 2005 lcd_dma.yscale = yscale;
1829} 2006}
2007EXPORT_SYMBOL(omap_set_lcd_dma_b1_scale);
1830 2008
1831static void set_b1_regs(void) 2009static void set_b1_regs(void)
1832{ 2010{
@@ -1857,8 +2035,11 @@ static void set_b1_regs(void)
1857 xscale = lcd_dma.xscale ? lcd_dma.xscale : 1; 2035 xscale = lcd_dma.xscale ? lcd_dma.xscale : 1;
1858 yscale = lcd_dma.yscale ? lcd_dma.yscale : 1; 2036 yscale = lcd_dma.yscale ? lcd_dma.yscale : 1;
1859 BUG_ON(vxres < lcd_dma.xres); 2037 BUG_ON(vxres < lcd_dma.xres);
1860#define PIXADDR(x,y) (lcd_dma.addr + ((y) * vxres * yscale + (x) * xscale) * es) 2038
2039#define PIXADDR(x, y) (lcd_dma.addr + \
2040 ((y) * vxres * yscale + (x) * xscale) * es)
1861#define PIXSTEP(sx, sy, dx, dy) (PIXADDR(dx, dy) - PIXADDR(sx, sy) - es + 1) 2041#define PIXSTEP(sx, sy, dx, dy) (PIXADDR(dx, dy) - PIXADDR(sx, sy) - es + 1)
2042
1862 switch (lcd_dma.rotate) { 2043 switch (lcd_dma.rotate) {
1863 case 0: 2044 case 0:
1864 if (!lcd_dma.mirror) { 2045 if (!lcd_dma.mirror) {
@@ -1867,8 +2048,8 @@ static void set_b1_regs(void)
1867 /* 1510 DMA requires the bottom address to be 2 more 2048 /* 1510 DMA requires the bottom address to be 2 more
1868 * than the actual last memory access location. */ 2049 * than the actual last memory access location. */
1869 if (omap_dma_in_1510_mode() && 2050 if (omap_dma_in_1510_mode() &&
1870 lcd_dma.data_type == OMAP_DMA_DATA_TYPE_S32) 2051 lcd_dma.data_type == OMAP_DMA_DATA_TYPE_S32)
1871 bottom += 2; 2052 bottom += 2;
1872 ei = PIXSTEP(0, 0, 1, 0); 2053 ei = PIXSTEP(0, 0, 1, 0);
1873 fi = PIXSTEP(lcd_dma.xres - 1, 0, 0, 1); 2054 fi = PIXSTEP(lcd_dma.xres - 1, 0, 0, 1);
1874 } else { 2055 } else {
@@ -1995,7 +2176,7 @@ static irqreturn_t lcd_dma_irq_handler(int irq, void *dev_id)
1995 return IRQ_HANDLED; 2176 return IRQ_HANDLED;
1996} 2177}
1997 2178
1998int omap_request_lcd_dma(void (* callback)(u16 status, void *data), 2179int omap_request_lcd_dma(void (*callback)(u16 status, void *data),
1999 void *data) 2180 void *data)
2000{ 2181{
2001 spin_lock_irq(&lcd_dma.lock); 2182 spin_lock_irq(&lcd_dma.lock);
@@ -2021,6 +2202,7 @@ int omap_request_lcd_dma(void (* callback)(u16 status, void *data),
2021 2202
2022 return 0; 2203 return 0;
2023} 2204}
2205EXPORT_SYMBOL(omap_request_lcd_dma);
2024 2206
2025void omap_free_lcd_dma(void) 2207void omap_free_lcd_dma(void)
2026{ 2208{
@@ -2037,12 +2219,14 @@ void omap_free_lcd_dma(void)
2037 lcd_dma.reserved = 0; 2219 lcd_dma.reserved = 0;
2038 spin_unlock(&lcd_dma.lock); 2220 spin_unlock(&lcd_dma.lock);
2039} 2221}
2222EXPORT_SYMBOL(omap_free_lcd_dma);
2040 2223
2041void omap_enable_lcd_dma(void) 2224void omap_enable_lcd_dma(void)
2042{ 2225{
2043 u16 w; 2226 u16 w;
2044 2227
2045 /* Set the Enable bit only if an external controller is 2228 /*
2229 * Set the Enable bit only if an external controller is
2046 * connected. Otherwise the OMAP internal controller will 2230 * connected. Otherwise the OMAP internal controller will
2047 * start the transfer when it gets enabled. 2231 * start the transfer when it gets enabled.
2048 */ 2232 */
@@ -2059,6 +2243,7 @@ void omap_enable_lcd_dma(void)
2059 w |= 1 << 7; 2243 w |= 1 << 7;
2060 omap_writew(w, OMAP1610_DMA_LCD_CCR); 2244 omap_writew(w, OMAP1610_DMA_LCD_CCR);
2061} 2245}
2246EXPORT_SYMBOL(omap_enable_lcd_dma);
2062 2247
2063void omap_setup_lcd_dma(void) 2248void omap_setup_lcd_dma(void)
2064{ 2249{
@@ -2074,16 +2259,18 @@ void omap_setup_lcd_dma(void)
2074 u16 w; 2259 u16 w;
2075 2260
2076 w = omap_readw(OMAP1610_DMA_LCD_CCR); 2261 w = omap_readw(OMAP1610_DMA_LCD_CCR);
2077 /* If DMA was already active set the end_prog bit to have 2262 /*
2263 * If DMA was already active set the end_prog bit to have
2078 * the programmed register set loaded into the active 2264 * the programmed register set loaded into the active
2079 * register set. 2265 * register set.
2080 */ 2266 */
2081 w |= 1 << 11; /* End_prog */ 2267 w |= 1 << 11; /* End_prog */
2082 if (!lcd_dma.single_transfer) 2268 if (!lcd_dma.single_transfer)
2083 w |= (3 << 8); /* Auto_init, repeat */ 2269 w |= (3 << 8); /* Auto_init, repeat */
2084 omap_writew(w, OMAP1610_DMA_LCD_CCR); 2270 omap_writew(w, OMAP1610_DMA_LCD_CCR);
2085 } 2271 }
2086} 2272}
2273EXPORT_SYMBOL(omap_setup_lcd_dma);
2087 2274
2088void omap_stop_lcd_dma(void) 2275void omap_stop_lcd_dma(void)
2089{ 2276{
@@ -2101,6 +2288,7 @@ void omap_stop_lcd_dma(void)
2101 w &= ~(1 << 8); 2288 w &= ~(1 << 8);
2102 omap_writew(w, OMAP1610_DMA_LCD_CTRL); 2289 omap_writew(w, OMAP1610_DMA_LCD_CTRL);
2103} 2290}
2291EXPORT_SYMBOL(omap_stop_lcd_dma);
2104 2292
2105/*----------------------------------------------------------------------------*/ 2293/*----------------------------------------------------------------------------*/
2106 2294
@@ -2108,27 +2296,55 @@ static int __init omap_init_dma(void)
2108{ 2296{
2109 int ch, r; 2297 int ch, r;
2110 2298
2299 if (cpu_class_is_omap1()) {
2300 omap_dma_base = (void __iomem *)IO_ADDRESS(OMAP1_DMA_BASE);
2301 dma_lch_count = OMAP1_LOGICAL_DMA_CH_COUNT;
2302 } else if (cpu_is_omap24xx()) {
2303 omap_dma_base = (void __iomem *)IO_ADDRESS(OMAP24XX_DMA4_BASE);
2304 dma_lch_count = OMAP_DMA4_LOGICAL_DMA_CH_COUNT;
2305 } else if (cpu_is_omap34xx()) {
2306 omap_dma_base = (void __iomem *)IO_ADDRESS(OMAP34XX_DMA4_BASE);
2307 dma_lch_count = OMAP_DMA4_LOGICAL_DMA_CH_COUNT;
2308 } else {
2309 pr_err("DMA init failed for unsupported omap\n");
2310 return -ENODEV;
2311 }
2312
2313 dma_chan = kzalloc(sizeof(struct omap_dma_lch) * dma_lch_count,
2314 GFP_KERNEL);
2315 if (!dma_chan)
2316 return -ENOMEM;
2317
2318 if (cpu_class_is_omap2()) {
2319 dma_linked_lch = kzalloc(sizeof(struct dma_link_info) *
2320 dma_lch_count, GFP_KERNEL);
2321 if (!dma_linked_lch) {
2322 kfree(dma_chan);
2323 return -ENOMEM;
2324 }
2325 }
2326
2111 if (cpu_is_omap15xx()) { 2327 if (cpu_is_omap15xx()) {
2112 printk(KERN_INFO "DMA support for OMAP15xx initialized\n"); 2328 printk(KERN_INFO "DMA support for OMAP15xx initialized\n");
2113 dma_chan_count = 9; 2329 dma_chan_count = 9;
2114 enable_1510_mode = 1; 2330 enable_1510_mode = 1;
2115 } else if (cpu_is_omap16xx() || cpu_is_omap730()) { 2331 } else if (cpu_is_omap16xx() || cpu_is_omap730()) {
2116 printk(KERN_INFO "OMAP DMA hardware version %d\n", 2332 printk(KERN_INFO "OMAP DMA hardware version %d\n",
2117 omap_readw(OMAP_DMA_HW_ID)); 2333 dma_read(HW_ID));
2118 printk(KERN_INFO "DMA capabilities: %08x:%08x:%04x:%04x:%04x\n", 2334 printk(KERN_INFO "DMA capabilities: %08x:%08x:%04x:%04x:%04x\n",
2119 (omap_readw(OMAP_DMA_CAPS_0_U) << 16) | 2335 (dma_read(CAPS_0_U) << 16) |
2120 omap_readw(OMAP_DMA_CAPS_0_L), 2336 dma_read(CAPS_0_L),
2121 (omap_readw(OMAP_DMA_CAPS_1_U) << 16) | 2337 (dma_read(CAPS_1_U) << 16) |
2122 omap_readw(OMAP_DMA_CAPS_1_L), 2338 dma_read(CAPS_1_L),
2123 omap_readw(OMAP_DMA_CAPS_2), omap_readw(OMAP_DMA_CAPS_3), 2339 dma_read(CAPS_2), dma_read(CAPS_3),
2124 omap_readw(OMAP_DMA_CAPS_4)); 2340 dma_read(CAPS_4));
2125 if (!enable_1510_mode) { 2341 if (!enable_1510_mode) {
2126 u16 w; 2342 u16 w;
2127 2343
2128 /* Disable OMAP 3.0/3.1 compatibility mode. */ 2344 /* Disable OMAP 3.0/3.1 compatibility mode. */
2129 w = omap_readw(OMAP_DMA_GSCR); 2345 w = dma_read(GSCR);
2130 w |= 1 << 3; 2346 w |= 1 << 3;
2131 omap_writew(w, OMAP_DMA_GSCR); 2347 dma_write(w, GSCR);
2132 dma_chan_count = 16; 2348 dma_chan_count = 16;
2133 } else 2349 } else
2134 dma_chan_count = 9; 2350 dma_chan_count = 9;
@@ -2141,19 +2357,17 @@ static int __init omap_init_dma(void)
2141 omap_writew(w, OMAP1610_DMA_LCD_CTRL); 2357 omap_writew(w, OMAP1610_DMA_LCD_CTRL);
2142 } 2358 }
2143 } else if (cpu_class_is_omap2()) { 2359 } else if (cpu_class_is_omap2()) {
2144 u8 revision = omap_readb(OMAP_DMA4_REVISION); 2360 u8 revision = dma_read(REVISION) & 0xff;
2145 printk(KERN_INFO "OMAP DMA hardware revision %d.%d\n", 2361 printk(KERN_INFO "OMAP DMA hardware revision %d.%d\n",
2146 revision >> 4, revision & 0xf); 2362 revision >> 4, revision & 0xf);
2147 dma_chan_count = OMAP_LOGICAL_DMA_CH_COUNT; 2363 dma_chan_count = OMAP_DMA4_LOGICAL_DMA_CH_COUNT;
2148 } else { 2364 } else {
2149 dma_chan_count = 0; 2365 dma_chan_count = 0;
2150 return 0; 2366 return 0;
2151 } 2367 }
2152 2368
2153 memset(&lcd_dma, 0, sizeof(lcd_dma));
2154 spin_lock_init(&lcd_dma.lock); 2369 spin_lock_init(&lcd_dma.lock);
2155 spin_lock_init(&dma_chan_lock); 2370 spin_lock_init(&dma_chan_lock);
2156 memset(&dma_chan, 0, sizeof(dma_chan));
2157 2371
2158 for (ch = 0; ch < dma_chan_count; ch++) { 2372 for (ch = 0; ch < dma_chan_count; ch++) {
2159 omap_clear_dma(ch); 2373 omap_clear_dma(ch);
@@ -2164,8 +2378,10 @@ static int __init omap_init_dma(void)
2164 continue; 2378 continue;
2165 2379
2166 if (cpu_class_is_omap1()) { 2380 if (cpu_class_is_omap1()) {
2167 /* request_irq() doesn't like dev_id (ie. ch) being 2381 /*
2168 * zero, so we have to kludge around this. */ 2382 * request_irq() doesn't like dev_id (ie. ch) being
2383 * zero, so we have to kludge around this.
2384 */
2169 r = request_irq(omap1_dma_irq[ch], 2385 r = request_irq(omap1_dma_irq[ch],
2170 omap1_dma_irq_handler, 0, "DMA", 2386 omap1_dma_irq_handler, 0, "DMA",
2171 (void *) (ch + 1)); 2387 (void *) (ch + 1));
@@ -2210,48 +2426,4 @@ static int __init omap_init_dma(void)
2210 2426
2211arch_initcall(omap_init_dma); 2427arch_initcall(omap_init_dma);
2212 2428
2213EXPORT_SYMBOL(omap_get_dma_src_pos);
2214EXPORT_SYMBOL(omap_get_dma_dst_pos);
2215EXPORT_SYMBOL(omap_get_dma_src_addr_counter);
2216EXPORT_SYMBOL(omap_clear_dma);
2217EXPORT_SYMBOL(omap_set_dma_priority);
2218EXPORT_SYMBOL(omap_request_dma);
2219EXPORT_SYMBOL(omap_free_dma);
2220EXPORT_SYMBOL(omap_start_dma);
2221EXPORT_SYMBOL(omap_stop_dma);
2222EXPORT_SYMBOL(omap_set_dma_callback);
2223EXPORT_SYMBOL(omap_enable_dma_irq);
2224EXPORT_SYMBOL(omap_disable_dma_irq);
2225
2226EXPORT_SYMBOL(omap_set_dma_transfer_params);
2227EXPORT_SYMBOL(omap_set_dma_color_mode);
2228EXPORT_SYMBOL(omap_set_dma_write_mode);
2229
2230EXPORT_SYMBOL(omap_set_dma_src_params);
2231EXPORT_SYMBOL(omap_set_dma_src_index);
2232EXPORT_SYMBOL(omap_set_dma_src_data_pack);
2233EXPORT_SYMBOL(omap_set_dma_src_burst_mode);
2234
2235EXPORT_SYMBOL(omap_set_dma_dest_params);
2236EXPORT_SYMBOL(omap_set_dma_dest_index);
2237EXPORT_SYMBOL(omap_set_dma_dest_data_pack);
2238EXPORT_SYMBOL(omap_set_dma_dest_burst_mode);
2239
2240EXPORT_SYMBOL(omap_set_dma_params);
2241
2242EXPORT_SYMBOL(omap_dma_link_lch);
2243EXPORT_SYMBOL(omap_dma_unlink_lch);
2244
2245EXPORT_SYMBOL(omap_request_lcd_dma);
2246EXPORT_SYMBOL(omap_free_lcd_dma);
2247EXPORT_SYMBOL(omap_enable_lcd_dma);
2248EXPORT_SYMBOL(omap_setup_lcd_dma);
2249EXPORT_SYMBOL(omap_stop_lcd_dma);
2250EXPORT_SYMBOL(omap_set_lcd_dma_b1);
2251EXPORT_SYMBOL(omap_set_lcd_dma_single_transfer);
2252EXPORT_SYMBOL(omap_set_lcd_dma_ext_controller);
2253EXPORT_SYMBOL(omap_set_lcd_dma_b1_rotation);
2254EXPORT_SYMBOL(omap_set_lcd_dma_b1_vxres);
2255EXPORT_SYMBOL(omap_set_lcd_dma_b1_scale);
2256EXPORT_SYMBOL(omap_set_lcd_dma_b1_mirror);
2257 2429
diff --git a/arch/arm/plat-omap/dmtimer.c b/arch/arm/plat-omap/dmtimer.c
index 302ad8dff2cb..f22506af0e67 100644
--- a/arch/arm/plat-omap/dmtimer.c
+++ b/arch/arm/plat-omap/dmtimer.c
@@ -38,34 +38,113 @@
38#include <asm/arch/irqs.h> 38#include <asm/arch/irqs.h>
39 39
40/* register offsets */ 40/* register offsets */
41#define OMAP_TIMER_ID_REG 0x00 41#define _OMAP_TIMER_ID_OFFSET 0x00
42#define OMAP_TIMER_OCP_CFG_REG 0x10 42#define _OMAP_TIMER_OCP_CFG_OFFSET 0x10
43#define OMAP_TIMER_SYS_STAT_REG 0x14 43#define _OMAP_TIMER_SYS_STAT_OFFSET 0x14
44#define OMAP_TIMER_STAT_REG 0x18 44#define _OMAP_TIMER_STAT_OFFSET 0x18
45#define OMAP_TIMER_INT_EN_REG 0x1c 45#define _OMAP_TIMER_INT_EN_OFFSET 0x1c
46#define OMAP_TIMER_WAKEUP_EN_REG 0x20 46#define _OMAP_TIMER_WAKEUP_EN_OFFSET 0x20
47#define OMAP_TIMER_CTRL_REG 0x24 47#define _OMAP_TIMER_CTRL_OFFSET 0x24
48#define OMAP_TIMER_COUNTER_REG 0x28 48#define OMAP_TIMER_CTRL_GPOCFG (1 << 14)
49#define OMAP_TIMER_LOAD_REG 0x2c 49#define OMAP_TIMER_CTRL_CAPTMODE (1 << 13)
50#define OMAP_TIMER_TRIGGER_REG 0x30 50#define OMAP_TIMER_CTRL_PT (1 << 12)
51#define OMAP_TIMER_WRITE_PEND_REG 0x34 51#define OMAP_TIMER_CTRL_TCM_LOWTOHIGH (0x1 << 8)
52#define OMAP_TIMER_MATCH_REG 0x38 52#define OMAP_TIMER_CTRL_TCM_HIGHTOLOW (0x2 << 8)
53#define OMAP_TIMER_CAPTURE_REG 0x3c 53#define OMAP_TIMER_CTRL_TCM_BOTHEDGES (0x3 << 8)
54#define OMAP_TIMER_IF_CTRL_REG 0x40 54#define OMAP_TIMER_CTRL_SCPWM (1 << 7)
55 55#define OMAP_TIMER_CTRL_CE (1 << 6) /* compare enable */
56/* timer control reg bits */ 56#define OMAP_TIMER_CTRL_PRE (1 << 5) /* prescaler enable */
57#define OMAP_TIMER_CTRL_GPOCFG (1 << 14) 57#define OMAP_TIMER_CTRL_PTV_SHIFT 2 /* prescaler value shift */
58#define OMAP_TIMER_CTRL_CAPTMODE (1 << 13) 58#define OMAP_TIMER_CTRL_POSTED (1 << 2)
59#define OMAP_TIMER_CTRL_PT (1 << 12) 59#define OMAP_TIMER_CTRL_AR (1 << 1) /* auto-reload enable */
60#define OMAP_TIMER_CTRL_TCM_LOWTOHIGH (0x1 << 8) 60#define OMAP_TIMER_CTRL_ST (1 << 0) /* start timer */
61#define OMAP_TIMER_CTRL_TCM_HIGHTOLOW (0x2 << 8) 61#define _OMAP_TIMER_COUNTER_OFFSET 0x28
62#define OMAP_TIMER_CTRL_TCM_BOTHEDGES (0x3 << 8) 62#define _OMAP_TIMER_LOAD_OFFSET 0x2c
63#define OMAP_TIMER_CTRL_SCPWM (1 << 7) 63#define _OMAP_TIMER_TRIGGER_OFFSET 0x30
64#define OMAP_TIMER_CTRL_CE (1 << 6) /* compare enable */ 64#define _OMAP_TIMER_WRITE_PEND_OFFSET 0x34
65#define OMAP_TIMER_CTRL_PRE (1 << 5) /* prescaler enable */ 65#define WP_NONE 0 /* no write pending bit */
66#define OMAP_TIMER_CTRL_PTV_SHIFT 2 /* how much to shift the prescaler value */ 66#define WP_TCLR (1 << 0)
67#define OMAP_TIMER_CTRL_AR (1 << 1) /* auto-reload enable */ 67#define WP_TCRR (1 << 1)
68#define OMAP_TIMER_CTRL_ST (1 << 0) /* start timer */ 68#define WP_TLDR (1 << 2)
69#define WP_TTGR (1 << 3)
70#define WP_TMAR (1 << 4)
71#define WP_TPIR (1 << 5)
72#define WP_TNIR (1 << 6)
73#define WP_TCVR (1 << 7)
74#define WP_TOCR (1 << 8)
75#define WP_TOWR (1 << 9)
76#define _OMAP_TIMER_MATCH_OFFSET 0x38
77#define _OMAP_TIMER_CAPTURE_OFFSET 0x3c
78#define _OMAP_TIMER_IF_CTRL_OFFSET 0x40
79#define _OMAP_TIMER_CAPTURE2_OFFSET 0x44 /* TCAR2, 34xx only */
80#define _OMAP_TIMER_TICK_POS_OFFSET 0x48 /* TPIR, 34xx only */
81#define _OMAP_TIMER_TICK_NEG_OFFSET 0x4c /* TNIR, 34xx only */
82#define _OMAP_TIMER_TICK_COUNT_OFFSET 0x50 /* TCVR, 34xx only */
83#define _OMAP_TIMER_TICK_INT_MASK_SET_OFFSET 0x54 /* TOCR, 34xx only */
84#define _OMAP_TIMER_TICK_INT_MASK_COUNT_OFFSET 0x58 /* TOWR, 34xx only */
85
86/* register offsets with the write pending bit encoded */
87#define WPSHIFT 16
88
89#define OMAP_TIMER_ID_REG (_OMAP_TIMER_ID_OFFSET \
90 | (WP_NONE << WPSHIFT))
91
92#define OMAP_TIMER_OCP_CFG_REG (_OMAP_TIMER_OCP_CFG_OFFSET \
93 | (WP_NONE << WPSHIFT))
94
95#define OMAP_TIMER_SYS_STAT_REG (_OMAP_TIMER_SYS_STAT_OFFSET \
96 | (WP_NONE << WPSHIFT))
97
98#define OMAP_TIMER_STAT_REG (_OMAP_TIMER_STAT_OFFSET \
99 | (WP_NONE << WPSHIFT))
100
101#define OMAP_TIMER_INT_EN_REG (_OMAP_TIMER_INT_EN_OFFSET \
102 | (WP_NONE << WPSHIFT))
103
104#define OMAP_TIMER_WAKEUP_EN_REG (_OMAP_TIMER_WAKEUP_EN_OFFSET \
105 | (WP_NONE << WPSHIFT))
106
107#define OMAP_TIMER_CTRL_REG (_OMAP_TIMER_CTRL_OFFSET \
108 | (WP_TCLR << WPSHIFT))
109
110#define OMAP_TIMER_COUNTER_REG (_OMAP_TIMER_COUNTER_OFFSET \
111 | (WP_TCRR << WPSHIFT))
112
113#define OMAP_TIMER_LOAD_REG (_OMAP_TIMER_LOAD_OFFSET \
114 | (WP_TLDR << WPSHIFT))
115
116#define OMAP_TIMER_TRIGGER_REG (_OMAP_TIMER_TRIGGER_OFFSET \
117 | (WP_TTGR << WPSHIFT))
118
119#define OMAP_TIMER_WRITE_PEND_REG (_OMAP_TIMER_WRITE_PEND_OFFSET \
120 | (WP_NONE << WPSHIFT))
121
122#define OMAP_TIMER_MATCH_REG (_OMAP_TIMER_MATCH_OFFSET \
123 | (WP_TMAR << WPSHIFT))
124
125#define OMAP_TIMER_CAPTURE_REG (_OMAP_TIMER_CAPTURE_OFFSET \
126 | (WP_NONE << WPSHIFT))
127
128#define OMAP_TIMER_IF_CTRL_REG (_OMAP_TIMER_IF_CTRL_OFFSET \
129 | (WP_NONE << WPSHIFT))
130
131#define OMAP_TIMER_CAPTURE2_REG (_OMAP_TIMER_CAPTURE2_OFFSET \
132 | (WP_NONE << WPSHIFT))
133
134#define OMAP_TIMER_TICK_POS_REG (_OMAP_TIMER_TICK_POS_OFFSET \
135 | (WP_TPIR << WPSHIFT))
136
137#define OMAP_TIMER_TICK_NEG_REG (_OMAP_TIMER_TICK_NEG_OFFSET \
138 | (WP_TNIR << WPSHIFT))
139
140#define OMAP_TIMER_TICK_COUNT_REG (_OMAP_TIMER_TICK_COUNT_OFFSET \
141 | (WP_TCVR << WPSHIFT))
142
143#define OMAP_TIMER_TICK_INT_MASK_SET_REG \
144 (_OMAP_TIMER_TICK_INT_MASK_SET_OFFSET | (WP_TOCR << WPSHIFT))
145
146#define OMAP_TIMER_TICK_INT_MASK_COUNT_REG \
147 (_OMAP_TIMER_TICK_INT_MASK_COUNT_OFFSET | (WP_TOWR << WPSHIFT))
69 148
70struct omap_dm_timer { 149struct omap_dm_timer {
71 unsigned long phys_base; 150 unsigned long phys_base;
@@ -76,6 +155,7 @@ struct omap_dm_timer {
76 void __iomem *io_base; 155 void __iomem *io_base;
77 unsigned reserved:1; 156 unsigned reserved:1;
78 unsigned enabled:1; 157 unsigned enabled:1;
158 unsigned posted:1;
79}; 159};
80 160
81#ifdef CONFIG_ARCH_OMAP1 161#ifdef CONFIG_ARCH_OMAP1
@@ -181,16 +261,34 @@ static struct clk **dm_source_clocks;
181 261
182static spinlock_t dm_timer_lock; 262static spinlock_t dm_timer_lock;
183 263
184static inline u32 omap_dm_timer_read_reg(struct omap_dm_timer *timer, int reg) 264/*
265 * Reads timer registers in posted and non-posted mode. The posted mode bit
266 * is encoded in reg. Note that in posted mode write pending bit must be
267 * checked. Otherwise a read of a non completed write will produce an error.
268 */
269static inline u32 omap_dm_timer_read_reg(struct omap_dm_timer *timer, u32 reg)
185{ 270{
186 return readl(timer->io_base + reg); 271 if (timer->posted)
272 while (readl(timer->io_base + (OMAP_TIMER_WRITE_PEND_REG & 0xff))
273 & (reg >> WPSHIFT))
274 cpu_relax();
275 return readl(timer->io_base + (reg & 0xff));
187} 276}
188 277
189static void omap_dm_timer_write_reg(struct omap_dm_timer *timer, int reg, u32 value) 278/*
279 * Writes timer registers in posted and non-posted mode. The posted mode bit
280 * is encoded in reg. Note that in posted mode the write pending bit must be
281 * checked. Otherwise a write on a register which has a pending write will be
282 * lost.
283 */
284static void omap_dm_timer_write_reg(struct omap_dm_timer *timer, u32 reg,
285 u32 value)
190{ 286{
191 writel(value, timer->io_base + reg); 287 if (timer->posted)
192 while (omap_dm_timer_read_reg(timer, OMAP_TIMER_WRITE_PEND_REG)) 288 while (readl(timer->io_base + (OMAP_TIMER_WRITE_PEND_REG & 0xff))
193 ; 289 & (reg >> WPSHIFT))
290 cpu_relax();
291 writel(value, timer->io_base + (reg & 0xff));
194} 292}
195 293
196static void omap_dm_timer_wait_for_reset(struct omap_dm_timer *timer) 294static void omap_dm_timer_wait_for_reset(struct omap_dm_timer *timer)
@@ -217,17 +315,23 @@ static void omap_dm_timer_reset(struct omap_dm_timer *timer)
217 } 315 }
218 omap_dm_timer_set_source(timer, OMAP_TIMER_SRC_32_KHZ); 316 omap_dm_timer_set_source(timer, OMAP_TIMER_SRC_32_KHZ);
219 317
220 /* Set to smart-idle mode */
221 l = omap_dm_timer_read_reg(timer, OMAP_TIMER_OCP_CFG_REG); 318 l = omap_dm_timer_read_reg(timer, OMAP_TIMER_OCP_CFG_REG);
222 l |= 0x02 << 3; 319 l |= 0x02 << 3; /* Set to smart-idle mode */
223 320 l |= 0x2 << 8; /* Set clock activity to perserve f-clock on idle */
224 if (cpu_class_is_omap2() && timer == &dm_timers[0]) { 321
225 /* Enable wake-up only for GPT1 on OMAP2 CPUs*/ 322 /*
323 * Enable wake-up only for GPT1 on OMAP2 CPUs.
324 * FIXME: All timers should have wake-up enabled and clear
325 * PRCM status.
326 */
327 if (cpu_class_is_omap2() && (timer == &dm_timers[0]))
226 l |= 1 << 2; 328 l |= 1 << 2;
227 /* Non-posted mode */
228 omap_dm_timer_write_reg(timer, OMAP_TIMER_IF_CTRL_REG, 0);
229 }
230 omap_dm_timer_write_reg(timer, OMAP_TIMER_OCP_CFG_REG, l); 329 omap_dm_timer_write_reg(timer, OMAP_TIMER_OCP_CFG_REG, l);
330
331 /* Match hardware reset default of posted mode */
332 omap_dm_timer_write_reg(timer, OMAP_TIMER_IF_CTRL_REG,
333 OMAP_TIMER_CTRL_POSTED);
334 timer->posted = 1;
231} 335}
232 336
233static void omap_dm_timer_prepare(struct omap_dm_timer *timer) 337static void omap_dm_timer_prepare(struct omap_dm_timer *timer)
@@ -434,9 +538,32 @@ void omap_dm_timer_set_load(struct omap_dm_timer *timer, int autoreload,
434 l &= ~OMAP_TIMER_CTRL_AR; 538 l &= ~OMAP_TIMER_CTRL_AR;
435 omap_dm_timer_write_reg(timer, OMAP_TIMER_CTRL_REG, l); 539 omap_dm_timer_write_reg(timer, OMAP_TIMER_CTRL_REG, l);
436 omap_dm_timer_write_reg(timer, OMAP_TIMER_LOAD_REG, load); 540 omap_dm_timer_write_reg(timer, OMAP_TIMER_LOAD_REG, load);
541
542 /* REVISIT: hw feature, ttgr overtaking tldr? */
543 while (readl(timer->io_base + (OMAP_TIMER_WRITE_PEND_REG & 0xff)))
544 cpu_relax();
545
437 omap_dm_timer_write_reg(timer, OMAP_TIMER_TRIGGER_REG, 0); 546 omap_dm_timer_write_reg(timer, OMAP_TIMER_TRIGGER_REG, 0);
438} 547}
439 548
549/* Optimized set_load which removes costly spin wait in timer_start */
550void omap_dm_timer_set_load_start(struct omap_dm_timer *timer, int autoreload,
551 unsigned int load)
552{
553 u32 l;
554
555 l = omap_dm_timer_read_reg(timer, OMAP_TIMER_CTRL_REG);
556 if (autoreload)
557 l |= OMAP_TIMER_CTRL_AR;
558 else
559 l &= ~OMAP_TIMER_CTRL_AR;
560 l |= OMAP_TIMER_CTRL_ST;
561
562 omap_dm_timer_write_reg(timer, OMAP_TIMER_COUNTER_REG, load);
563 omap_dm_timer_write_reg(timer, OMAP_TIMER_LOAD_REG, load);
564 omap_dm_timer_write_reg(timer, OMAP_TIMER_CTRL_REG, l);
565}
566
440void omap_dm_timer_set_match(struct omap_dm_timer *timer, int enable, 567void omap_dm_timer_set_match(struct omap_dm_timer *timer, int enable,
441 unsigned int match) 568 unsigned int match)
442{ 569{
@@ -451,7 +578,6 @@ void omap_dm_timer_set_match(struct omap_dm_timer *timer, int enable,
451 omap_dm_timer_write_reg(timer, OMAP_TIMER_MATCH_REG, match); 578 omap_dm_timer_write_reg(timer, OMAP_TIMER_MATCH_REG, match);
452} 579}
453 580
454
455void omap_dm_timer_set_pwm(struct omap_dm_timer *timer, int def_on, 581void omap_dm_timer_set_pwm(struct omap_dm_timer *timer, int def_on,
456 int toggle, int trigger) 582 int toggle, int trigger)
457{ 583{
diff --git a/arch/arm/plat-omap/mcbsp.c b/arch/arm/plat-omap/mcbsp.c
index 9cf83c4da9fa..c7f74064696c 100644
--- a/arch/arm/plat-omap/mcbsp.c
+++ b/arch/arm/plat-omap/mcbsp.c
@@ -15,95 +15,66 @@
15#include <linux/module.h> 15#include <linux/module.h>
16#include <linux/init.h> 16#include <linux/init.h>
17#include <linux/device.h> 17#include <linux/device.h>
18#include <linux/platform_device.h>
18#include <linux/wait.h> 19#include <linux/wait.h>
19#include <linux/completion.h> 20#include <linux/completion.h>
20#include <linux/interrupt.h> 21#include <linux/interrupt.h>
21#include <linux/err.h> 22#include <linux/err.h>
22#include <linux/clk.h> 23#include <linux/clk.h>
23#include <linux/delay.h> 24#include <linux/delay.h>
24 25#include <linux/io.h>
25#include <asm/io.h>
26#include <asm/irq.h>
27 26
28#include <asm/arch/dma.h> 27#include <asm/arch/dma.h>
29#include <asm/arch/mux.h>
30#include <asm/arch/irqs.h>
31#include <asm/arch/dsp_common.h>
32#include <asm/arch/mcbsp.h> 28#include <asm/arch/mcbsp.h>
33 29
34#ifdef CONFIG_MCBSP_DEBUG
35#define DBG(x...) printk(x)
36#else
37#define DBG(x...) do { } while (0)
38#endif
39
40struct omap_mcbsp {
41 u32 io_base;
42 u8 id;
43 u8 free;
44 omap_mcbsp_word_length rx_word_length;
45 omap_mcbsp_word_length tx_word_length;
46
47 omap_mcbsp_io_type_t io_type; /* IRQ or poll */
48 /* IRQ based TX/RX */
49 int rx_irq;
50 int tx_irq;
51
52 /* DMA stuff */
53 u8 dma_rx_sync;
54 short dma_rx_lch;
55 u8 dma_tx_sync;
56 short dma_tx_lch;
57
58 /* Completion queues */
59 struct completion tx_irq_completion;
60 struct completion rx_irq_completion;
61 struct completion tx_dma_completion;
62 struct completion rx_dma_completion;
63
64 spinlock_t lock;
65};
66
67static struct omap_mcbsp mcbsp[OMAP_MAX_MCBSP_COUNT]; 30static struct omap_mcbsp mcbsp[OMAP_MAX_MCBSP_COUNT];
68#ifdef CONFIG_ARCH_OMAP1 31
69static struct clk *mcbsp_dsp_ck = 0; 32#define omap_mcbsp_check_valid_id(id) (mcbsp[id].pdata && \
70static struct clk *mcbsp_api_ck = 0; 33 mcbsp[id].pdata->ops && \
71static struct clk *mcbsp_dspxor_ck = 0; 34 mcbsp[id].pdata->ops->check && \
72#endif 35 (mcbsp[id].pdata->ops->check(id) == 0))
73#ifdef CONFIG_ARCH_OMAP2
74static struct clk *mcbsp1_ick = 0;
75static struct clk *mcbsp1_fck = 0;
76static struct clk *mcbsp2_ick = 0;
77static struct clk *mcbsp2_fck = 0;
78#endif
79 36
80static void omap_mcbsp_dump_reg(u8 id) 37static void omap_mcbsp_dump_reg(u8 id)
81{ 38{
82 DBG("**** MCBSP%d regs ****\n", mcbsp[id].id); 39 dev_dbg(mcbsp[id].dev, "**** McBSP%d regs ****\n", mcbsp[id].id);
83 DBG("DRR2: 0x%04x\n", OMAP_MCBSP_READ(mcbsp[id].io_base, DRR2)); 40 dev_dbg(mcbsp[id].dev, "DRR2: 0x%04x\n",
84 DBG("DRR1: 0x%04x\n", OMAP_MCBSP_READ(mcbsp[id].io_base, DRR1)); 41 OMAP_MCBSP_READ(mcbsp[id].io_base, DRR2));
85 DBG("DXR2: 0x%04x\n", OMAP_MCBSP_READ(mcbsp[id].io_base, DXR2)); 42 dev_dbg(mcbsp[id].dev, "DRR1: 0x%04x\n",
86 DBG("DXR1: 0x%04x\n", OMAP_MCBSP_READ(mcbsp[id].io_base, DXR1)); 43 OMAP_MCBSP_READ(mcbsp[id].io_base, DRR1));
87 DBG("SPCR2: 0x%04x\n", OMAP_MCBSP_READ(mcbsp[id].io_base, SPCR2)); 44 dev_dbg(mcbsp[id].dev, "DXR2: 0x%04x\n",
88 DBG("SPCR1: 0x%04x\n", OMAP_MCBSP_READ(mcbsp[id].io_base, SPCR1)); 45 OMAP_MCBSP_READ(mcbsp[id].io_base, DXR2));
89 DBG("RCR2: 0x%04x\n", OMAP_MCBSP_READ(mcbsp[id].io_base, RCR2)); 46 dev_dbg(mcbsp[id].dev, "DXR1: 0x%04x\n",
90 DBG("RCR1: 0x%04x\n", OMAP_MCBSP_READ(mcbsp[id].io_base, RCR1)); 47 OMAP_MCBSP_READ(mcbsp[id].io_base, DXR1));
91 DBG("XCR2: 0x%04x\n", OMAP_MCBSP_READ(mcbsp[id].io_base, XCR2)); 48 dev_dbg(mcbsp[id].dev, "SPCR2: 0x%04x\n",
92 DBG("XCR1: 0x%04x\n", OMAP_MCBSP_READ(mcbsp[id].io_base, XCR1)); 49 OMAP_MCBSP_READ(mcbsp[id].io_base, SPCR2));
93 DBG("SRGR2: 0x%04x\n", OMAP_MCBSP_READ(mcbsp[id].io_base, SRGR2)); 50 dev_dbg(mcbsp[id].dev, "SPCR1: 0x%04x\n",
94 DBG("SRGR1: 0x%04x\n", OMAP_MCBSP_READ(mcbsp[id].io_base, SRGR1)); 51 OMAP_MCBSP_READ(mcbsp[id].io_base, SPCR1));
95 DBG("PCR0: 0x%04x\n", OMAP_MCBSP_READ(mcbsp[id].io_base, PCR0)); 52 dev_dbg(mcbsp[id].dev, "RCR2: 0x%04x\n",
96 DBG("***********************\n"); 53 OMAP_MCBSP_READ(mcbsp[id].io_base, RCR2));
54 dev_dbg(mcbsp[id].dev, "RCR1: 0x%04x\n",
55 OMAP_MCBSP_READ(mcbsp[id].io_base, RCR1));
56 dev_dbg(mcbsp[id].dev, "XCR2: 0x%04x\n",
57 OMAP_MCBSP_READ(mcbsp[id].io_base, XCR2));
58 dev_dbg(mcbsp[id].dev, "XCR1: 0x%04x\n",
59 OMAP_MCBSP_READ(mcbsp[id].io_base, XCR1));
60 dev_dbg(mcbsp[id].dev, "SRGR2: 0x%04x\n",
61 OMAP_MCBSP_READ(mcbsp[id].io_base, SRGR2));
62 dev_dbg(mcbsp[id].dev, "SRGR1: 0x%04x\n",
63 OMAP_MCBSP_READ(mcbsp[id].io_base, SRGR1));
64 dev_dbg(mcbsp[id].dev, "PCR0: 0x%04x\n",
65 OMAP_MCBSP_READ(mcbsp[id].io_base, PCR0));
66 dev_dbg(mcbsp[id].dev, "***********************\n");
97} 67}
98 68
99static irqreturn_t omap_mcbsp_tx_irq_handler(int irq, void *dev_id) 69static irqreturn_t omap_mcbsp_tx_irq_handler(int irq, void *dev_id)
100{ 70{
101 struct omap_mcbsp *mcbsp_tx = dev_id; 71 struct omap_mcbsp *mcbsp_tx = dev_id;
102 72
103 DBG("TX IRQ callback : 0x%x\n", 73 dev_dbg(mcbsp_tx->dev, "TX IRQ callback : 0x%x\n",
104 OMAP_MCBSP_READ(mcbsp_tx->io_base, SPCR2)); 74 OMAP_MCBSP_READ(mcbsp_tx->io_base, SPCR2));
105 75
106 complete(&mcbsp_tx->tx_irq_completion); 76 complete(&mcbsp_tx->tx_irq_completion);
77
107 return IRQ_HANDLED; 78 return IRQ_HANDLED;
108} 79}
109 80
@@ -111,10 +82,11 @@ static irqreturn_t omap_mcbsp_rx_irq_handler(int irq, void *dev_id)
111{ 82{
112 struct omap_mcbsp *mcbsp_rx = dev_id; 83 struct omap_mcbsp *mcbsp_rx = dev_id;
113 84
114 DBG("RX IRQ callback : 0x%x\n", 85 dev_dbg(mcbsp_rx->dev, "RX IRQ callback : 0x%x\n",
115 OMAP_MCBSP_READ(mcbsp_rx->io_base, SPCR2)); 86 OMAP_MCBSP_READ(mcbsp_rx->io_base, SPCR2));
116 87
117 complete(&mcbsp_rx->rx_irq_completion); 88 complete(&mcbsp_rx->rx_irq_completion);
89
118 return IRQ_HANDLED; 90 return IRQ_HANDLED;
119} 91}
120 92
@@ -122,8 +94,8 @@ static void omap_mcbsp_tx_dma_callback(int lch, u16 ch_status, void *data)
122{ 94{
123 struct omap_mcbsp *mcbsp_dma_tx = data; 95 struct omap_mcbsp *mcbsp_dma_tx = data;
124 96
125 DBG("TX DMA callback : 0x%x\n", 97 dev_dbg(mcbsp_dma_tx->dev, "TX DMA callback : 0x%x\n",
126 OMAP_MCBSP_READ(mcbsp_dma_tx->io_base, SPCR2)); 98 OMAP_MCBSP_READ(mcbsp_dma_tx->io_base, SPCR2));
127 99
128 /* We can free the channels */ 100 /* We can free the channels */
129 omap_free_dma(mcbsp_dma_tx->dma_tx_lch); 101 omap_free_dma(mcbsp_dma_tx->dma_tx_lch);
@@ -136,8 +108,8 @@ static void omap_mcbsp_rx_dma_callback(int lch, u16 ch_status, void *data)
136{ 108{
137 struct omap_mcbsp *mcbsp_dma_rx = data; 109 struct omap_mcbsp *mcbsp_dma_rx = data;
138 110
139 DBG("RX DMA callback : 0x%x\n", 111 dev_dbg(mcbsp_dma_rx->dev, "RX DMA callback : 0x%x\n",
140 OMAP_MCBSP_READ(mcbsp_dma_rx->io_base, SPCR2)); 112 OMAP_MCBSP_READ(mcbsp_dma_rx->io_base, SPCR2));
141 113
142 /* We can free the channels */ 114 /* We can free the channels */
143 omap_free_dma(mcbsp_dma_rx->dma_rx_lch); 115 omap_free_dma(mcbsp_dma_rx->dma_rx_lch);
@@ -146,19 +118,24 @@ static void omap_mcbsp_rx_dma_callback(int lch, u16 ch_status, void *data)
146 complete(&mcbsp_dma_rx->rx_dma_completion); 118 complete(&mcbsp_dma_rx->rx_dma_completion);
147} 119}
148 120
149
150/* 121/*
151 * omap_mcbsp_config simply write a config to the 122 * omap_mcbsp_config simply write a config to the
152 * appropriate McBSP. 123 * appropriate McBSP.
153 * You either call this function or set the McBSP registers 124 * You either call this function or set the McBSP registers
154 * by yourself before calling omap_mcbsp_start(). 125 * by yourself before calling omap_mcbsp_start().
155 */ 126 */
156 127void omap_mcbsp_config(unsigned int id, const struct omap_mcbsp_reg_cfg *config)
157void omap_mcbsp_config(unsigned int id, const struct omap_mcbsp_reg_cfg * config)
158{ 128{
159 u32 io_base = mcbsp[id].io_base; 129 u32 io_base;
130
131 if (!omap_mcbsp_check_valid_id(id)) {
132 printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1);
133 return;
134 }
160 135
161 DBG("OMAP-McBSP: McBSP%d io_base: 0x%8x\n", id+1, io_base); 136 io_base = mcbsp[id].io_base;
137 dev_dbg(mcbsp[id].dev, "Configuring McBSP%d io_base: 0x%8x\n",
138 mcbsp[id].id, io_base);
162 139
163 /* We write the given config */ 140 /* We write the given config */
164 OMAP_MCBSP_WRITE(io_base, SPCR2, config->spcr2); 141 OMAP_MCBSP_WRITE(io_base, SPCR2, config->spcr2);
@@ -173,83 +150,7 @@ void omap_mcbsp_config(unsigned int id, const struct omap_mcbsp_reg_cfg * config
173 OMAP_MCBSP_WRITE(io_base, MCR1, config->mcr1); 150 OMAP_MCBSP_WRITE(io_base, MCR1, config->mcr1);
174 OMAP_MCBSP_WRITE(io_base, PCR0, config->pcr0); 151 OMAP_MCBSP_WRITE(io_base, PCR0, config->pcr0);
175} 152}
176 153EXPORT_SYMBOL(omap_mcbsp_config);
177
178
179static int omap_mcbsp_check(unsigned int id)
180{
181 if (cpu_is_omap730()) {
182 if (id > OMAP_MAX_MCBSP_COUNT - 1) {
183 printk(KERN_ERR "OMAP-McBSP: McBSP%d doesn't exist\n", id + 1);
184 return -1;
185 }
186 return 0;
187 }
188
189 if (cpu_is_omap15xx() || cpu_is_omap16xx() || cpu_is_omap24xx()) {
190 if (id > OMAP_MAX_MCBSP_COUNT) {
191 printk(KERN_ERR "OMAP-McBSP: McBSP%d doesn't exist\n", id + 1);
192 return -1;
193 }
194 return 0;
195 }
196
197 return -1;
198}
199
200#ifdef CONFIG_ARCH_OMAP1
201static void omap_mcbsp_dsp_request(void)
202{
203 if (cpu_is_omap15xx() || cpu_is_omap16xx()) {
204 int ret;
205
206 ret = omap_dsp_request_mem();
207 if (ret < 0) {
208 printk(KERN_ERR "Could not get dsp memory: %i\n", ret);
209 return;
210 }
211
212 clk_enable(mcbsp_dsp_ck);
213 clk_enable(mcbsp_api_ck);
214
215 /* enable 12MHz clock to mcbsp 1 & 3 */
216 clk_enable(mcbsp_dspxor_ck);
217
218 /*
219 * DSP external peripheral reset
220 * FIXME: This should be moved to dsp code
221 */
222 __raw_writew(__raw_readw(DSP_RSTCT2) | 1 | 1 << 1,
223 DSP_RSTCT2);
224 }
225}
226
227static void omap_mcbsp_dsp_free(void)
228{
229 if (cpu_is_omap15xx() || cpu_is_omap16xx()) {
230 omap_dsp_release_mem();
231 clk_disable(mcbsp_dspxor_ck);
232 clk_disable(mcbsp_dsp_ck);
233 clk_disable(mcbsp_api_ck);
234 }
235}
236#endif
237
238#ifdef CONFIG_ARCH_OMAP2
239static void omap2_mcbsp2_mux_setup(void)
240{
241 if (cpu_is_omap2420()) {
242 omap_cfg_reg(Y15_24XX_MCBSP2_CLKX);
243 omap_cfg_reg(R14_24XX_MCBSP2_FSX);
244 omap_cfg_reg(W15_24XX_MCBSP2_DR);
245 omap_cfg_reg(V15_24XX_MCBSP2_DX);
246 omap_cfg_reg(V14_24XX_GPIO117);
247 }
248 /*
249 * Need to add MUX settings for OMAP 2430 SDP
250 */
251}
252#endif
253 154
254/* 155/*
255 * We can choose between IRQ based or polled IO. 156 * We can choose between IRQ based or polled IO.
@@ -257,13 +158,16 @@ static void omap2_mcbsp2_mux_setup(void)
257 */ 158 */
258int omap_mcbsp_set_io_type(unsigned int id, omap_mcbsp_io_type_t io_type) 159int omap_mcbsp_set_io_type(unsigned int id, omap_mcbsp_io_type_t io_type)
259{ 160{
260 if (omap_mcbsp_check(id) < 0) 161 if (!omap_mcbsp_check_valid_id(id)) {
261 return -EINVAL; 162 printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1);
163 return -ENODEV;
164 }
262 165
263 spin_lock(&mcbsp[id].lock); 166 spin_lock(&mcbsp[id].lock);
264 167
265 if (!mcbsp[id].free) { 168 if (!mcbsp[id].free) {
266 printk (KERN_ERR "OMAP-McBSP: McBSP%d is currently in use\n", id + 1); 169 dev_err(mcbsp[id].dev, "McBSP%d is currently in use\n",
170 mcbsp[id].id);
267 spin_unlock(&mcbsp[id].lock); 171 spin_unlock(&mcbsp[id].lock);
268 return -EINVAL; 172 return -EINVAL;
269 } 173 }
@@ -274,38 +178,26 @@ int omap_mcbsp_set_io_type(unsigned int id, omap_mcbsp_io_type_t io_type)
274 178
275 return 0; 179 return 0;
276} 180}
181EXPORT_SYMBOL(omap_mcbsp_set_io_type);
277 182
278int omap_mcbsp_request(unsigned int id) 183int omap_mcbsp_request(unsigned int id)
279{ 184{
280 int err; 185 int err;
281 186
282 if (omap_mcbsp_check(id) < 0) 187 if (!omap_mcbsp_check_valid_id(id)) {
283 return -EINVAL; 188 printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1);
284 189 return -ENODEV;
285#ifdef CONFIG_ARCH_OMAP1
286 /*
287 * On 1510, 1610 and 1710, McBSP1 and McBSP3
288 * are DSP public peripherals.
289 */
290 if (id == OMAP_MCBSP1 || id == OMAP_MCBSP3)
291 omap_mcbsp_dsp_request();
292#endif
293
294#ifdef CONFIG_ARCH_OMAP2
295 if (cpu_is_omap24xx()) {
296 if (id == OMAP_MCBSP1) {
297 clk_enable(mcbsp1_ick);
298 clk_enable(mcbsp1_fck);
299 } else {
300 clk_enable(mcbsp2_ick);
301 clk_enable(mcbsp2_fck);
302 }
303 } 190 }
304#endif 191
192 if (mcbsp[id].pdata->ops->request)
193 mcbsp[id].pdata->ops->request(id);
194
195 clk_enable(mcbsp[id].clk);
305 196
306 spin_lock(&mcbsp[id].lock); 197 spin_lock(&mcbsp[id].lock);
307 if (!mcbsp[id].free) { 198 if (!mcbsp[id].free) {
308 printk (KERN_ERR "OMAP-McBSP: McBSP%d is currently in use\n", id + 1); 199 dev_err(mcbsp[id].dev, "McBSP%d is currently in use\n",
200 mcbsp[id].id);
309 spin_unlock(&mcbsp[id].lock); 201 spin_unlock(&mcbsp[id].lock);
310 return -1; 202 return -1;
311 } 203 }
@@ -315,24 +207,23 @@ int omap_mcbsp_request(unsigned int id)
315 207
316 if (mcbsp[id].io_type == OMAP_MCBSP_IRQ_IO) { 208 if (mcbsp[id].io_type == OMAP_MCBSP_IRQ_IO) {
317 /* We need to get IRQs here */ 209 /* We need to get IRQs here */
318 err = request_irq(mcbsp[id].tx_irq, omap_mcbsp_tx_irq_handler, 0, 210 err = request_irq(mcbsp[id].tx_irq, omap_mcbsp_tx_irq_handler,
319 "McBSP", 211 0, "McBSP", (void *) (&mcbsp[id]));
320 (void *) (&mcbsp[id]));
321 if (err != 0) { 212 if (err != 0) {
322 printk(KERN_ERR "OMAP-McBSP: Unable to request TX IRQ %d for McBSP%d\n", 213 dev_err(mcbsp[id].dev, "Unable to request TX IRQ %d "
323 mcbsp[id].tx_irq, mcbsp[id].id); 214 "for McBSP%d\n", mcbsp[id].tx_irq,
215 mcbsp[id].id);
324 return err; 216 return err;
325 } 217 }
326 218
327 init_completion(&(mcbsp[id].tx_irq_completion)); 219 init_completion(&(mcbsp[id].tx_irq_completion));
328 220
329 221 err = request_irq(mcbsp[id].rx_irq, omap_mcbsp_rx_irq_handler,
330 err = request_irq(mcbsp[id].rx_irq, omap_mcbsp_rx_irq_handler, 0, 222 0, "McBSP", (void *) (&mcbsp[id]));
331 "McBSP",
332 (void *) (&mcbsp[id]));
333 if (err != 0) { 223 if (err != 0) {
334 printk(KERN_ERR "OMAP-McBSP: Unable to request RX IRQ %d for McBSP%d\n", 224 dev_err(mcbsp[id].dev, "Unable to request RX IRQ %d "
335 mcbsp[id].rx_irq, mcbsp[id].id); 225 "for McBSP%d\n", mcbsp[id].rx_irq,
226 mcbsp[id].id);
336 free_irq(mcbsp[id].tx_irq, (void *) (&mcbsp[id])); 227 free_irq(mcbsp[id].tx_irq, (void *) (&mcbsp[id]));
337 return err; 228 return err;
338 } 229 }
@@ -341,36 +232,25 @@ int omap_mcbsp_request(unsigned int id)
341 } 232 }
342 233
343 return 0; 234 return 0;
344
345} 235}
236EXPORT_SYMBOL(omap_mcbsp_request);
346 237
347void omap_mcbsp_free(unsigned int id) 238void omap_mcbsp_free(unsigned int id)
348{ 239{
349 if (omap_mcbsp_check(id) < 0) 240 if (!omap_mcbsp_check_valid_id(id)) {
241 printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1);
350 return; 242 return;
351
352#ifdef CONFIG_ARCH_OMAP1
353 if (cpu_class_is_omap1()) {
354 if (id == OMAP_MCBSP1 || id == OMAP_MCBSP3)
355 omap_mcbsp_dsp_free();
356 } 243 }
357#endif 244
358 245 if (mcbsp[id].pdata->ops->free)
359#ifdef CONFIG_ARCH_OMAP2 246 mcbsp[id].pdata->ops->free(id);
360 if (cpu_is_omap24xx()) { 247
361 if (id == OMAP_MCBSP1) { 248 clk_disable(mcbsp[id].clk);
362 clk_disable(mcbsp1_ick);
363 clk_disable(mcbsp1_fck);
364 } else {
365 clk_disable(mcbsp2_ick);
366 clk_disable(mcbsp2_fck);
367 }
368 }
369#endif
370 249
371 spin_lock(&mcbsp[id].lock); 250 spin_lock(&mcbsp[id].lock);
372 if (mcbsp[id].free) { 251 if (mcbsp[id].free) {
373 printk (KERN_ERR "OMAP-McBSP: McBSP%d was not reserved\n", id + 1); 252 dev_err(mcbsp[id].dev, "McBSP%d was not reserved\n",
253 mcbsp[id].id);
374 spin_unlock(&mcbsp[id].lock); 254 spin_unlock(&mcbsp[id].lock);
375 return; 255 return;
376 } 256 }
@@ -384,6 +264,7 @@ void omap_mcbsp_free(unsigned int id)
384 free_irq(mcbsp[id].tx_irq, (void *) (&mcbsp[id])); 264 free_irq(mcbsp[id].tx_irq, (void *) (&mcbsp[id]));
385 } 265 }
386} 266}
267EXPORT_SYMBOL(omap_mcbsp_free);
387 268
388/* 269/*
389 * Here we start the McBSP, by enabling the sample 270 * Here we start the McBSP, by enabling the sample
@@ -395,13 +276,15 @@ void omap_mcbsp_start(unsigned int id)
395 u32 io_base; 276 u32 io_base;
396 u16 w; 277 u16 w;
397 278
398 if (omap_mcbsp_check(id) < 0) 279 if (!omap_mcbsp_check_valid_id(id)) {
280 printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1);
399 return; 281 return;
282 }
400 283
401 io_base = mcbsp[id].io_base; 284 io_base = mcbsp[id].io_base;
402 285
403 mcbsp[id].rx_word_length = ((OMAP_MCBSP_READ(io_base, RCR1) >> 5) & 0x7); 286 mcbsp[id].rx_word_length = (OMAP_MCBSP_READ(io_base, RCR1) >> 5) & 0x7;
404 mcbsp[id].tx_word_length = ((OMAP_MCBSP_READ(io_base, XCR1) >> 5) & 0x7); 287 mcbsp[id].tx_word_length = (OMAP_MCBSP_READ(io_base, XCR1) >> 5) & 0x7;
405 288
406 /* Start the sample generator */ 289 /* Start the sample generator */
407 w = OMAP_MCBSP_READ(io_base, SPCR2); 290 w = OMAP_MCBSP_READ(io_base, SPCR2);
@@ -422,20 +305,22 @@ void omap_mcbsp_start(unsigned int id)
422 305
423 /* Dump McBSP Regs */ 306 /* Dump McBSP Regs */
424 omap_mcbsp_dump_reg(id); 307 omap_mcbsp_dump_reg(id);
425
426} 308}
309EXPORT_SYMBOL(omap_mcbsp_start);
427 310
428void omap_mcbsp_stop(unsigned int id) 311void omap_mcbsp_stop(unsigned int id)
429{ 312{
430 u32 io_base; 313 u32 io_base;
431 u16 w; 314 u16 w;
432 315
433 if (omap_mcbsp_check(id) < 0) 316 if (!omap_mcbsp_check_valid_id(id)) {
317 printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1);
434 return; 318 return;
319 }
435 320
436 io_base = mcbsp[id].io_base; 321 io_base = mcbsp[id].io_base;
437 322
438 /* Reset transmitter */ 323 /* Reset transmitter */
439 w = OMAP_MCBSP_READ(io_base, SPCR2); 324 w = OMAP_MCBSP_READ(io_base, SPCR2);
440 OMAP_MCBSP_WRITE(io_base, SPCR2, w & ~(1)); 325 OMAP_MCBSP_WRITE(io_base, SPCR2, w & ~(1));
441 326
@@ -447,12 +332,19 @@ void omap_mcbsp_stop(unsigned int id)
447 w = OMAP_MCBSP_READ(io_base, SPCR2); 332 w = OMAP_MCBSP_READ(io_base, SPCR2);
448 OMAP_MCBSP_WRITE(io_base, SPCR2, w & ~(1 << 6)); 333 OMAP_MCBSP_WRITE(io_base, SPCR2, w & ~(1 << 6));
449} 334}
450 335EXPORT_SYMBOL(omap_mcbsp_stop);
451 336
452/* polled mcbsp i/o operations */ 337/* polled mcbsp i/o operations */
453int omap_mcbsp_pollwrite(unsigned int id, u16 buf) 338int omap_mcbsp_pollwrite(unsigned int id, u16 buf)
454{ 339{
455 u32 base = mcbsp[id].io_base; 340 u32 base;
341
342 if (!omap_mcbsp_check_valid_id(id)) {
343 printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1);
344 return -ENODEV;
345 }
346
347 base = mcbsp[id].io_base;
456 writew(buf, base + OMAP_MCBSP_REG_DXR1); 348 writew(buf, base + OMAP_MCBSP_REG_DXR1);
457 /* if frame sync error - clear the error */ 349 /* if frame sync error - clear the error */
458 if (readw(base + OMAP_MCBSP_REG_SPCR2) & XSYNC_ERR) { 350 if (readw(base + OMAP_MCBSP_REG_SPCR2) & XSYNC_ERR) {
@@ -474,18 +366,27 @@ int omap_mcbsp_pollwrite(unsigned int id, u16 buf)
474 (XRST), 366 (XRST),
475 base + OMAP_MCBSP_REG_SPCR2); 367 base + OMAP_MCBSP_REG_SPCR2);
476 udelay(10); 368 udelay(10);
477 printk(KERN_ERR 369 dev_err(mcbsp[id].dev, "Could not write to"
478 " Could not write to McBSP Register\n"); 370 " McBSP%d Register\n", mcbsp[id].id);
479 return -2; 371 return -2;
480 } 372 }
481 } 373 }
482 } 374 }
375
483 return 0; 376 return 0;
484} 377}
378EXPORT_SYMBOL(omap_mcbsp_pollwrite);
485 379
486int omap_mcbsp_pollread(unsigned int id, u16 * buf) 380int omap_mcbsp_pollread(unsigned int id, u16 *buf)
487{ 381{
488 u32 base = mcbsp[id].io_base; 382 u32 base;
383
384 if (!omap_mcbsp_check_valid_id(id)) {
385 printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1);
386 return -ENODEV;
387 }
388
389 base = mcbsp[id].io_base;
489 /* if frame sync error - clear the error */ 390 /* if frame sync error - clear the error */
490 if (readw(base + OMAP_MCBSP_REG_SPCR1) & RSYNC_ERR) { 391 if (readw(base + OMAP_MCBSP_REG_SPCR1) & RSYNC_ERR) {
491 /* clear error */ 392 /* clear error */
@@ -506,15 +407,17 @@ int omap_mcbsp_pollread(unsigned int id, u16 * buf)
506 (RRST), 407 (RRST),
507 base + OMAP_MCBSP_REG_SPCR1); 408 base + OMAP_MCBSP_REG_SPCR1);
508 udelay(10); 409 udelay(10);
509 printk(KERN_ERR 410 dev_err(mcbsp[id].dev, "Could not read from"
510 " Could not read from McBSP Register\n"); 411 " McBSP%d Register\n", mcbsp[id].id);
511 return -2; 412 return -2;
512 } 413 }
513 } 414 }
514 } 415 }
515 *buf = readw(base + OMAP_MCBSP_REG_DRR1); 416 *buf = readw(base + OMAP_MCBSP_REG_DRR1);
417
516 return 0; 418 return 0;
517} 419}
420EXPORT_SYMBOL(omap_mcbsp_pollread);
518 421
519/* 422/*
520 * IRQ based word transmission. 423 * IRQ based word transmission.
@@ -522,12 +425,15 @@ int omap_mcbsp_pollread(unsigned int id, u16 * buf)
522void omap_mcbsp_xmit_word(unsigned int id, u32 word) 425void omap_mcbsp_xmit_word(unsigned int id, u32 word)
523{ 426{
524 u32 io_base; 427 u32 io_base;
525 omap_mcbsp_word_length word_length = mcbsp[id].tx_word_length; 428 omap_mcbsp_word_length word_length;
526 429
527 if (omap_mcbsp_check(id) < 0) 430 if (!omap_mcbsp_check_valid_id(id)) {
431 printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1);
528 return; 432 return;
433 }
529 434
530 io_base = mcbsp[id].io_base; 435 io_base = mcbsp[id].io_base;
436 word_length = mcbsp[id].tx_word_length;
531 437
532 wait_for_completion(&(mcbsp[id].tx_irq_completion)); 438 wait_for_completion(&(mcbsp[id].tx_irq_completion));
533 439
@@ -535,16 +441,20 @@ void omap_mcbsp_xmit_word(unsigned int id, u32 word)
535 OMAP_MCBSP_WRITE(io_base, DXR2, word >> 16); 441 OMAP_MCBSP_WRITE(io_base, DXR2, word >> 16);
536 OMAP_MCBSP_WRITE(io_base, DXR1, word & 0xffff); 442 OMAP_MCBSP_WRITE(io_base, DXR1, word & 0xffff);
537} 443}
444EXPORT_SYMBOL(omap_mcbsp_xmit_word);
538 445
539u32 omap_mcbsp_recv_word(unsigned int id) 446u32 omap_mcbsp_recv_word(unsigned int id)
540{ 447{
541 u32 io_base; 448 u32 io_base;
542 u16 word_lsb, word_msb = 0; 449 u16 word_lsb, word_msb = 0;
543 omap_mcbsp_word_length word_length = mcbsp[id].rx_word_length; 450 omap_mcbsp_word_length word_length;
544 451
545 if (omap_mcbsp_check(id) < 0) 452 if (!omap_mcbsp_check_valid_id(id)) {
546 return -EINVAL; 453 printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1);
454 return -ENODEV;
455 }
547 456
457 word_length = mcbsp[id].rx_word_length;
548 io_base = mcbsp[id].io_base; 458 io_base = mcbsp[id].io_base;
549 459
550 wait_for_completion(&(mcbsp[id].rx_irq_completion)); 460 wait_for_completion(&(mcbsp[id].rx_irq_completion));
@@ -555,15 +465,24 @@ u32 omap_mcbsp_recv_word(unsigned int id)
555 465
556 return (word_lsb | (word_msb << 16)); 466 return (word_lsb | (word_msb << 16));
557} 467}
558 468EXPORT_SYMBOL(omap_mcbsp_recv_word);
559 469
560int omap_mcbsp_spi_master_xmit_word_poll(unsigned int id, u32 word) 470int omap_mcbsp_spi_master_xmit_word_poll(unsigned int id, u32 word)
561{ 471{
562 u32 io_base = mcbsp[id].io_base; 472 u32 io_base;
563 omap_mcbsp_word_length tx_word_length = mcbsp[id].tx_word_length; 473 omap_mcbsp_word_length tx_word_length;
564 omap_mcbsp_word_length rx_word_length = mcbsp[id].rx_word_length; 474 omap_mcbsp_word_length rx_word_length;
565 u16 spcr2, spcr1, attempts = 0, word_lsb, word_msb = 0; 475 u16 spcr2, spcr1, attempts = 0, word_lsb, word_msb = 0;
566 476
477 if (!omap_mcbsp_check_valid_id(id)) {
478 printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1);
479 return -ENODEV;
480 }
481
482 io_base = mcbsp[id].io_base;
483 tx_word_length = mcbsp[id].tx_word_length;
484 rx_word_length = mcbsp[id].rx_word_length;
485
567 if (tx_word_length != rx_word_length) 486 if (tx_word_length != rx_word_length)
568 return -EINVAL; 487 return -EINVAL;
569 488
@@ -577,7 +496,8 @@ int omap_mcbsp_spi_master_xmit_word_poll(unsigned int id, u32 word)
577 udelay(10); 496 udelay(10);
578 OMAP_MCBSP_WRITE(io_base, SPCR2, spcr2 | XRST); 497 OMAP_MCBSP_WRITE(io_base, SPCR2, spcr2 | XRST);
579 udelay(10); 498 udelay(10);
580 printk("McBSP transmitter not ready\n"); 499 dev_err(mcbsp[id].dev, "McBSP%d transmitter not "
500 "ready\n", mcbsp[id].id);
581 return -EAGAIN; 501 return -EAGAIN;
582 } 502 }
583 } 503 }
@@ -597,7 +517,8 @@ int omap_mcbsp_spi_master_xmit_word_poll(unsigned int id, u32 word)
597 udelay(10); 517 udelay(10);
598 OMAP_MCBSP_WRITE(io_base, SPCR1, spcr1 | RRST); 518 OMAP_MCBSP_WRITE(io_base, SPCR1, spcr1 | RRST);
599 udelay(10); 519 udelay(10);
600 printk("McBSP receiver not ready\n"); 520 dev_err(mcbsp[id].dev, "McBSP%d receiver not "
521 "ready\n", mcbsp[id].id);
601 return -EAGAIN; 522 return -EAGAIN;
602 } 523 }
603 } 524 }
@@ -609,14 +530,24 @@ int omap_mcbsp_spi_master_xmit_word_poll(unsigned int id, u32 word)
609 530
610 return 0; 531 return 0;
611} 532}
533EXPORT_SYMBOL(omap_mcbsp_spi_master_xmit_word_poll);
612 534
613int omap_mcbsp_spi_master_recv_word_poll(unsigned int id, u32 * word) 535int omap_mcbsp_spi_master_recv_word_poll(unsigned int id, u32 *word)
614{ 536{
615 u32 io_base = mcbsp[id].io_base, clock_word = 0; 537 u32 io_base, clock_word = 0;
616 omap_mcbsp_word_length tx_word_length = mcbsp[id].tx_word_length; 538 omap_mcbsp_word_length tx_word_length;
617 omap_mcbsp_word_length rx_word_length = mcbsp[id].rx_word_length; 539 omap_mcbsp_word_length rx_word_length;
618 u16 spcr2, spcr1, attempts = 0, word_lsb, word_msb = 0; 540 u16 spcr2, spcr1, attempts = 0, word_lsb, word_msb = 0;
619 541
542 if (!omap_mcbsp_check_valid_id(id)) {
543 printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1);
544 return -ENODEV;
545 }
546
547 io_base = mcbsp[id].io_base;
548 tx_word_length = mcbsp[id].tx_word_length;
549 rx_word_length = mcbsp[id].rx_word_length;
550
620 if (tx_word_length != rx_word_length) 551 if (tx_word_length != rx_word_length)
621 return -EINVAL; 552 return -EINVAL;
622 553
@@ -630,7 +561,8 @@ int omap_mcbsp_spi_master_recv_word_poll(unsigned int id, u32 * word)
630 udelay(10); 561 udelay(10);
631 OMAP_MCBSP_WRITE(io_base, SPCR2, spcr2 | XRST); 562 OMAP_MCBSP_WRITE(io_base, SPCR2, spcr2 | XRST);
632 udelay(10); 563 udelay(10);
633 printk("McBSP transmitter not ready\n"); 564 dev_err(mcbsp[id].dev, "McBSP%d transmitter not "
565 "ready\n", mcbsp[id].id);
634 return -EAGAIN; 566 return -EAGAIN;
635 } 567 }
636 } 568 }
@@ -650,7 +582,8 @@ int omap_mcbsp_spi_master_recv_word_poll(unsigned int id, u32 * word)
650 udelay(10); 582 udelay(10);
651 OMAP_MCBSP_WRITE(io_base, SPCR1, spcr1 | RRST); 583 OMAP_MCBSP_WRITE(io_base, SPCR1, spcr1 | RRST);
652 udelay(10); 584 udelay(10);
653 printk("McBSP receiver not ready\n"); 585 dev_err(mcbsp[id].dev, "McBSP%d receiver not "
586 "ready\n", mcbsp[id].id);
654 return -EAGAIN; 587 return -EAGAIN;
655 } 588 }
656 } 589 }
@@ -664,7 +597,7 @@ int omap_mcbsp_spi_master_recv_word_poll(unsigned int id, u32 * word)
664 597
665 return 0; 598 return 0;
666} 599}
667 600EXPORT_SYMBOL(omap_mcbsp_spi_master_recv_word_poll);
668 601
669/* 602/*
670 * Simple DMA based buffer rx/tx routines. 603 * Simple DMA based buffer rx/tx routines.
@@ -673,25 +606,32 @@ int omap_mcbsp_spi_master_recv_word_poll(unsigned int id, u32 * word)
673 * For anything fancier, you should use your own customized DMA 606 * For anything fancier, you should use your own customized DMA
674 * routines and callbacks. 607 * routines and callbacks.
675 */ 608 */
676int omap_mcbsp_xmit_buffer(unsigned int id, dma_addr_t buffer, unsigned int length) 609int omap_mcbsp_xmit_buffer(unsigned int id, dma_addr_t buffer,
610 unsigned int length)
677{ 611{
678 int dma_tx_ch; 612 int dma_tx_ch;
679 int src_port = 0; 613 int src_port = 0;
680 int dest_port = 0; 614 int dest_port = 0;
681 int sync_dev = 0; 615 int sync_dev = 0;
682 616
683 if (omap_mcbsp_check(id) < 0) 617 if (!omap_mcbsp_check_valid_id(id)) {
684 return -EINVAL; 618 printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1);
619 return -ENODEV;
620 }
685 621
686 if (omap_request_dma(mcbsp[id].dma_tx_sync, "McBSP TX", omap_mcbsp_tx_dma_callback, 622 if (omap_request_dma(mcbsp[id].dma_tx_sync, "McBSP TX",
687 &mcbsp[id], 623 omap_mcbsp_tx_dma_callback,
688 &dma_tx_ch)) { 624 &mcbsp[id],
689 printk("OMAP-McBSP: Unable to request DMA channel for McBSP%d TX. Trying IRQ based TX\n", id+1); 625 &dma_tx_ch)) {
626 dev_err(mcbsp[id].dev, " Unable to request DMA channel for "
627 "McBSP%d TX. Trying IRQ based TX\n",
628 mcbsp[id].id);
690 return -EAGAIN; 629 return -EAGAIN;
691 } 630 }
692 mcbsp[id].dma_tx_lch = dma_tx_ch; 631 mcbsp[id].dma_tx_lch = dma_tx_ch;
693 632
694 DBG("TX DMA on channel %d\n", dma_tx_ch); 633 dev_err(mcbsp[id].dev, "McBSP%d TX DMA on channel %d\n", mcbsp[id].id,
634 dma_tx_ch);
695 635
696 init_completion(&(mcbsp[id].tx_dma_completion)); 636 init_completion(&(mcbsp[id].tx_dma_completion));
697 637
@@ -699,7 +639,7 @@ int omap_mcbsp_xmit_buffer(unsigned int id, dma_addr_t buffer, unsigned int leng
699 src_port = OMAP_DMA_PORT_TIPB; 639 src_port = OMAP_DMA_PORT_TIPB;
700 dest_port = OMAP_DMA_PORT_EMIFF; 640 dest_port = OMAP_DMA_PORT_EMIFF;
701 } 641 }
702 if (cpu_is_omap24xx()) 642 if (cpu_class_is_omap2())
703 sync_dev = mcbsp[id].dma_tx_sync; 643 sync_dev = mcbsp[id].dma_tx_sync;
704 644
705 omap_set_dma_transfer_params(mcbsp[id].dma_tx_lch, 645 omap_set_dma_transfer_params(mcbsp[id].dma_tx_lch,
@@ -722,29 +662,37 @@ int omap_mcbsp_xmit_buffer(unsigned int id, dma_addr_t buffer, unsigned int leng
722 662
723 omap_start_dma(mcbsp[id].dma_tx_lch); 663 omap_start_dma(mcbsp[id].dma_tx_lch);
724 wait_for_completion(&(mcbsp[id].tx_dma_completion)); 664 wait_for_completion(&(mcbsp[id].tx_dma_completion));
665
725 return 0; 666 return 0;
726} 667}
668EXPORT_SYMBOL(omap_mcbsp_xmit_buffer);
727 669
728 670int omap_mcbsp_recv_buffer(unsigned int id, dma_addr_t buffer,
729int omap_mcbsp_recv_buffer(unsigned int id, dma_addr_t buffer, unsigned int length) 671 unsigned int length)
730{ 672{
731 int dma_rx_ch; 673 int dma_rx_ch;
732 int src_port = 0; 674 int src_port = 0;
733 int dest_port = 0; 675 int dest_port = 0;
734 int sync_dev = 0; 676 int sync_dev = 0;
735 677
736 if (omap_mcbsp_check(id) < 0) 678 if (!omap_mcbsp_check_valid_id(id)) {
737 return -EINVAL; 679 printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1);
680 return -ENODEV;
681 }
738 682
739 if (omap_request_dma(mcbsp[id].dma_rx_sync, "McBSP RX", omap_mcbsp_rx_dma_callback, 683 if (omap_request_dma(mcbsp[id].dma_rx_sync, "McBSP RX",
740 &mcbsp[id], 684 omap_mcbsp_rx_dma_callback,
741 &dma_rx_ch)) { 685 &mcbsp[id],
742 printk("Unable to request DMA channel for McBSP%d RX. Trying IRQ based RX\n", id+1); 686 &dma_rx_ch)) {
687 dev_err(mcbsp[id].dev, "Unable to request DMA channel for "
688 "McBSP%d RX. Trying IRQ based RX\n",
689 mcbsp[id].id);
743 return -EAGAIN; 690 return -EAGAIN;
744 } 691 }
745 mcbsp[id].dma_rx_lch = dma_rx_ch; 692 mcbsp[id].dma_rx_lch = dma_rx_ch;
746 693
747 DBG("RX DMA on channel %d\n", dma_rx_ch); 694 dev_err(mcbsp[id].dev, "McBSP%d RX DMA on channel %d\n", mcbsp[id].id,
695 dma_rx_ch);
748 696
749 init_completion(&(mcbsp[id].rx_dma_completion)); 697 init_completion(&(mcbsp[id].rx_dma_completion));
750 698
@@ -752,14 +700,14 @@ int omap_mcbsp_recv_buffer(unsigned int id, dma_addr_t buffer, unsigned int leng
752 src_port = OMAP_DMA_PORT_TIPB; 700 src_port = OMAP_DMA_PORT_TIPB;
753 dest_port = OMAP_DMA_PORT_EMIFF; 701 dest_port = OMAP_DMA_PORT_EMIFF;
754 } 702 }
755 if (cpu_is_omap24xx()) 703 if (cpu_class_is_omap2())
756 sync_dev = mcbsp[id].dma_rx_sync; 704 sync_dev = mcbsp[id].dma_rx_sync;
757 705
758 omap_set_dma_transfer_params(mcbsp[id].dma_rx_lch, 706 omap_set_dma_transfer_params(mcbsp[id].dma_rx_lch,
759 OMAP_DMA_DATA_TYPE_S16, 707 OMAP_DMA_DATA_TYPE_S16,
760 length >> 1, 1, 708 length >> 1, 1,
761 OMAP_DMA_SYNC_ELEMENT, 709 OMAP_DMA_SYNC_ELEMENT,
762 sync_dev, 0); 710 sync_dev, 0);
763 711
764 omap_set_dma_src_params(mcbsp[id].dma_rx_lch, 712 omap_set_dma_src_params(mcbsp[id].dma_rx_lch,
765 src_port, 713 src_port,
@@ -768,16 +716,17 @@ int omap_mcbsp_recv_buffer(unsigned int id, dma_addr_t buffer, unsigned int leng
768 0, 0); 716 0, 0);
769 717
770 omap_set_dma_dest_params(mcbsp[id].dma_rx_lch, 718 omap_set_dma_dest_params(mcbsp[id].dma_rx_lch,
771 dest_port, 719 dest_port,
772 OMAP_DMA_AMODE_POST_INC, 720 OMAP_DMA_AMODE_POST_INC,
773 buffer, 721 buffer,
774 0, 0); 722 0, 0);
775 723
776 omap_start_dma(mcbsp[id].dma_rx_lch); 724 omap_start_dma(mcbsp[id].dma_rx_lch);
777 wait_for_completion(&(mcbsp[id].rx_dma_completion)); 725 wait_for_completion(&(mcbsp[id].rx_dma_completion));
726
778 return 0; 727 return 0;
779} 728}
780 729EXPORT_SYMBOL(omap_mcbsp_recv_buffer);
781 730
782/* 731/*
783 * SPI wrapper. 732 * SPI wrapper.
@@ -785,12 +734,15 @@ int omap_mcbsp_recv_buffer(unsigned int id, dma_addr_t buffer, unsigned int leng
785 * this wrapper just need an omap_mcbsp_spi_cfg structure as an input. 734 * this wrapper just need an omap_mcbsp_spi_cfg structure as an input.
786 * Once this is done, you can call omap_mcbsp_start(). 735 * Once this is done, you can call omap_mcbsp_start().
787 */ 736 */
788void omap_mcbsp_set_spi_mode(unsigned int id, const struct omap_mcbsp_spi_cfg * spi_cfg) 737void omap_mcbsp_set_spi_mode(unsigned int id,
738 const struct omap_mcbsp_spi_cfg *spi_cfg)
789{ 739{
790 struct omap_mcbsp_reg_cfg mcbsp_cfg; 740 struct omap_mcbsp_reg_cfg mcbsp_cfg;
791 741
792 if (omap_mcbsp_check(id) < 0) 742 if (!omap_mcbsp_check_valid_id(id)) {
743 printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1);
793 return; 744 return;
745 }
794 746
795 memset(&mcbsp_cfg, 0, sizeof(struct omap_mcbsp_reg_cfg)); 747 memset(&mcbsp_cfg, 0, sizeof(struct omap_mcbsp_reg_cfg));
796 748
@@ -798,7 +750,7 @@ void omap_mcbsp_set_spi_mode(unsigned int id, const struct omap_mcbsp_spi_cfg *
798 mcbsp_cfg.rcr1 |= (RWDLEN1(spi_cfg->word_length) | RFRLEN1(0)); 750 mcbsp_cfg.rcr1 |= (RWDLEN1(spi_cfg->word_length) | RFRLEN1(0));
799 mcbsp_cfg.xcr1 |= (XWDLEN1(spi_cfg->word_length) | XFRLEN1(0)); 751 mcbsp_cfg.xcr1 |= (XWDLEN1(spi_cfg->word_length) | XFRLEN1(0));
800 752
801 /* Clock stop mode */ 753 /* Clock stop mode */
802 if (spi_cfg->clk_stp_mode == OMAP_MCBSP_CLK_STP_MODE_NO_DELAY) 754 if (spi_cfg->clk_stp_mode == OMAP_MCBSP_CLK_STP_MODE_NO_DELAY)
803 mcbsp_cfg.spcr1 |= (1 << 12); 755 mcbsp_cfg.spcr1 |= (1 << 12);
804 else 756 else
@@ -827,13 +779,12 @@ void omap_mcbsp_set_spi_mode(unsigned int id, const struct omap_mcbsp_spi_cfg *
827 779
828 if (spi_cfg->spi_mode == OMAP_MCBSP_SPI_MASTER) { 780 if (spi_cfg->spi_mode == OMAP_MCBSP_SPI_MASTER) {
829 mcbsp_cfg.pcr0 |= CLKXM; 781 mcbsp_cfg.pcr0 |= CLKXM;
830 mcbsp_cfg.srgr1 |= CLKGDV(spi_cfg->clk_div -1); 782 mcbsp_cfg.srgr1 |= CLKGDV(spi_cfg->clk_div - 1);
831 mcbsp_cfg.pcr0 |= FSXM; 783 mcbsp_cfg.pcr0 |= FSXM;
832 mcbsp_cfg.srgr2 &= ~FSGM; 784 mcbsp_cfg.srgr2 &= ~FSGM;
833 mcbsp_cfg.xcr2 |= XDATDLY(1); 785 mcbsp_cfg.xcr2 |= XDATDLY(1);
834 mcbsp_cfg.rcr2 |= RDATDLY(1); 786 mcbsp_cfg.rcr2 |= RDATDLY(1);
835 } 787 } else {
836 else {
837 mcbsp_cfg.pcr0 &= ~CLKXM; 788 mcbsp_cfg.pcr0 &= ~CLKXM;
838 mcbsp_cfg.srgr1 |= CLKGDV(1); 789 mcbsp_cfg.srgr1 |= CLKGDV(1);
839 mcbsp_cfg.pcr0 &= ~FSXM; 790 mcbsp_cfg.pcr0 &= ~FSXM;
@@ -846,199 +797,99 @@ void omap_mcbsp_set_spi_mode(unsigned int id, const struct omap_mcbsp_spi_cfg *
846 797
847 omap_mcbsp_config(id, &mcbsp_cfg); 798 omap_mcbsp_config(id, &mcbsp_cfg);
848} 799}
849 800EXPORT_SYMBOL(omap_mcbsp_set_spi_mode);
850 801
851/* 802/*
852 * McBSP1 and McBSP3 are directly mapped on 1610 and 1510. 803 * McBSP1 and McBSP3 are directly mapped on 1610 and 1510.
853 * 730 has only 2 McBSP, and both of them are MPU peripherals. 804 * 730 has only 2 McBSP, and both of them are MPU peripherals.
854 */ 805 */
855struct omap_mcbsp_info { 806static int __init omap_mcbsp_probe(struct platform_device *pdev)
856 u32 virt_base; 807{
857 u8 dma_rx_sync, dma_tx_sync; 808 struct omap_mcbsp_platform_data *pdata = pdev->dev.platform_data;
858 u16 rx_irq, tx_irq; 809 int id = pdev->id - 1;
859}; 810 int ret = 0;
860 811
861#ifdef CONFIG_ARCH_OMAP730 812 if (!pdata) {
862static const struct omap_mcbsp_info mcbsp_730[] = { 813 dev_err(&pdev->dev, "McBSP device initialized without"
863 [0] = { .virt_base = io_p2v(OMAP730_MCBSP1_BASE), 814 "platform data\n");
864 .dma_rx_sync = OMAP_DMA_MCBSP1_RX, 815 ret = -EINVAL;
865 .dma_tx_sync = OMAP_DMA_MCBSP1_TX, 816 goto exit;
866 .rx_irq = INT_730_McBSP1RX, 817 }
867 .tx_irq = INT_730_McBSP1TX }, 818
868 [1] = { .virt_base = io_p2v(OMAP730_MCBSP2_BASE), 819 dev_dbg(&pdev->dev, "Initializing OMAP McBSP (%d).\n", pdev->id);
869 .dma_rx_sync = OMAP_DMA_MCBSP3_RX, 820
870 .dma_tx_sync = OMAP_DMA_MCBSP3_TX, 821 if (id >= OMAP_MAX_MCBSP_COUNT) {
871 .rx_irq = INT_730_McBSP2RX, 822 dev_err(&pdev->dev, "Invalid McBSP device id (%d)\n", id);
872 .tx_irq = INT_730_McBSP2TX }, 823 ret = -EINVAL;
873}; 824 goto exit;
874#endif 825 }
875 826
876#ifdef CONFIG_ARCH_OMAP15XX 827 spin_lock_init(&mcbsp[id].lock);
877static const struct omap_mcbsp_info mcbsp_1510[] = { 828 mcbsp[id].id = id + 1;
878 [0] = { .virt_base = OMAP1510_MCBSP1_BASE, 829 mcbsp[id].free = 1;
879 .dma_rx_sync = OMAP_DMA_MCBSP1_RX, 830 mcbsp[id].dma_tx_lch = -1;
880 .dma_tx_sync = OMAP_DMA_MCBSP1_TX, 831 mcbsp[id].dma_rx_lch = -1;
881 .rx_irq = INT_McBSP1RX, 832
882 .tx_irq = INT_McBSP1TX }, 833 mcbsp[id].io_base = pdata->virt_base;
883 [1] = { .virt_base = io_p2v(OMAP1510_MCBSP2_BASE), 834 /* Default I/O is IRQ based */
884 .dma_rx_sync = OMAP_DMA_MCBSP2_RX, 835 mcbsp[id].io_type = OMAP_MCBSP_IRQ_IO;
885 .dma_tx_sync = OMAP_DMA_MCBSP2_TX, 836 mcbsp[id].tx_irq = pdata->tx_irq;
886 .rx_irq = INT_1510_SPI_RX, 837 mcbsp[id].rx_irq = pdata->rx_irq;
887 .tx_irq = INT_1510_SPI_TX }, 838 mcbsp[id].dma_rx_sync = pdata->dma_rx_sync;
888 [2] = { .virt_base = OMAP1510_MCBSP3_BASE, 839 mcbsp[id].dma_tx_sync = pdata->dma_tx_sync;
889 .dma_rx_sync = OMAP_DMA_MCBSP3_RX, 840
890 .dma_tx_sync = OMAP_DMA_MCBSP3_TX, 841 if (pdata->clk_name)
891 .rx_irq = INT_McBSP3RX, 842 mcbsp[id].clk = clk_get(&pdev->dev, pdata->clk_name);
892 .tx_irq = INT_McBSP3TX }, 843 if (IS_ERR(mcbsp[id].clk)) {
893}; 844 mcbsp[id].free = 0;
894#endif 845 dev_err(&pdev->dev,
895 846 "Invalid clock configuration for McBSP%d.\n",
896#if defined(CONFIG_ARCH_OMAP16XX) 847 mcbsp[id].id);
897static const struct omap_mcbsp_info mcbsp_1610[] = { 848 ret = -EINVAL;
898 [0] = { .virt_base = OMAP1610_MCBSP1_BASE, 849 goto exit;
899 .dma_rx_sync = OMAP_DMA_MCBSP1_RX, 850 }
900 .dma_tx_sync = OMAP_DMA_MCBSP1_TX, 851
901 .rx_irq = INT_McBSP1RX, 852 mcbsp[id].pdata = pdata;
902 .tx_irq = INT_McBSP1TX }, 853 mcbsp[id].dev = &pdev->dev;
903 [1] = { .virt_base = io_p2v(OMAP1610_MCBSP2_BASE), 854 platform_set_drvdata(pdev, &mcbsp[id]);
904 .dma_rx_sync = OMAP_DMA_MCBSP2_RX, 855
905 .dma_tx_sync = OMAP_DMA_MCBSP2_TX, 856exit:
906 .rx_irq = INT_1610_McBSP2_RX, 857 return ret;
907 .tx_irq = INT_1610_McBSP2_TX }, 858}
908 [2] = { .virt_base = OMAP1610_MCBSP3_BASE,
909 .dma_rx_sync = OMAP_DMA_MCBSP3_RX,
910 .dma_tx_sync = OMAP_DMA_MCBSP3_TX,
911 .rx_irq = INT_McBSP3RX,
912 .tx_irq = INT_McBSP3TX },
913};
914#endif
915
916#if defined(CONFIG_ARCH_OMAP24XX)
917static const struct omap_mcbsp_info mcbsp_24xx[] = {
918 [0] = { .virt_base = IO_ADDRESS(OMAP24XX_MCBSP1_BASE),
919 .dma_rx_sync = OMAP24XX_DMA_MCBSP1_RX,
920 .dma_tx_sync = OMAP24XX_DMA_MCBSP1_TX,
921 .rx_irq = INT_24XX_MCBSP1_IRQ_RX,
922 .tx_irq = INT_24XX_MCBSP1_IRQ_TX,
923 },
924 [1] = { .virt_base = IO_ADDRESS(OMAP24XX_MCBSP2_BASE),
925 .dma_rx_sync = OMAP24XX_DMA_MCBSP2_RX,
926 .dma_tx_sync = OMAP24XX_DMA_MCBSP2_TX,
927 .rx_irq = INT_24XX_MCBSP2_IRQ_RX,
928 .tx_irq = INT_24XX_MCBSP2_IRQ_TX,
929 },
930};
931#endif
932 859
933static int __init omap_mcbsp_init(void) 860static int omap_mcbsp_remove(struct platform_device *pdev)
934{ 861{
935 int mcbsp_count = 0, i; 862 struct omap_mcbsp *mcbsp = platform_get_drvdata(pdev);
936 static const struct omap_mcbsp_info *mcbsp_info;
937 863
938 printk("Initializing OMAP McBSP system\n"); 864 platform_set_drvdata(pdev, NULL);
865 if (mcbsp) {
939 866
940#ifdef CONFIG_ARCH_OMAP1 867 if (mcbsp->pdata && mcbsp->pdata->ops &&
941 mcbsp_dsp_ck = clk_get(0, "dsp_ck"); 868 mcbsp->pdata->ops->free)
942 if (IS_ERR(mcbsp_dsp_ck)) { 869 mcbsp->pdata->ops->free(mcbsp->id);
943 printk(KERN_ERR "mcbsp: could not acquire dsp_ck handle.\n");
944 return PTR_ERR(mcbsp_dsp_ck);
945 }
946 mcbsp_api_ck = clk_get(0, "api_ck");
947 if (IS_ERR(mcbsp_api_ck)) {
948 printk(KERN_ERR "mcbsp: could not acquire api_ck handle.\n");
949 return PTR_ERR(mcbsp_api_ck);
950 }
951 mcbsp_dspxor_ck = clk_get(0, "dspxor_ck");
952 if (IS_ERR(mcbsp_dspxor_ck)) {
953 printk(KERN_ERR "mcbsp: could not acquire dspxor_ck handle.\n");
954 return PTR_ERR(mcbsp_dspxor_ck);
955 }
956#endif
957#ifdef CONFIG_ARCH_OMAP2
958 mcbsp1_ick = clk_get(0, "mcbsp1_ick");
959 if (IS_ERR(mcbsp1_ick)) {
960 printk(KERN_ERR "mcbsp: could not acquire mcbsp1_ick handle.\n");
961 return PTR_ERR(mcbsp1_ick);
962 }
963 mcbsp1_fck = clk_get(0, "mcbsp1_fck");
964 if (IS_ERR(mcbsp1_fck)) {
965 printk(KERN_ERR "mcbsp: could not acquire mcbsp1_fck handle.\n");
966 return PTR_ERR(mcbsp1_fck);
967 }
968 mcbsp2_ick = clk_get(0, "mcbsp2_ick");
969 if (IS_ERR(mcbsp2_ick)) {
970 printk(KERN_ERR "mcbsp: could not acquire mcbsp2_ick handle.\n");
971 return PTR_ERR(mcbsp2_ick);
972 }
973 mcbsp2_fck = clk_get(0, "mcbsp2_fck");
974 if (IS_ERR(mcbsp2_fck)) {
975 printk(KERN_ERR "mcbsp: could not acquire mcbsp2_fck handle.\n");
976 return PTR_ERR(mcbsp2_fck);
977 }
978#endif
979 870
980#ifdef CONFIG_ARCH_OMAP730 871 clk_disable(mcbsp->clk);
981 if (cpu_is_omap730()) { 872 clk_put(mcbsp->clk);
982 mcbsp_info = mcbsp_730; 873
983 mcbsp_count = ARRAY_SIZE(mcbsp_730); 874 mcbsp->clk = NULL;
984 } 875 mcbsp->free = 0;
985#endif 876 mcbsp->dev = NULL;
986#ifdef CONFIG_ARCH_OMAP15XX
987 if (cpu_is_omap15xx()) {
988 mcbsp_info = mcbsp_1510;
989 mcbsp_count = ARRAY_SIZE(mcbsp_1510);
990 }
991#endif
992#if defined(CONFIG_ARCH_OMAP16XX)
993 if (cpu_is_omap16xx()) {
994 mcbsp_info = mcbsp_1610;
995 mcbsp_count = ARRAY_SIZE(mcbsp_1610);
996 }
997#endif
998#if defined(CONFIG_ARCH_OMAP24XX)
999 if (cpu_is_omap24xx()) {
1000 mcbsp_info = mcbsp_24xx;
1001 mcbsp_count = ARRAY_SIZE(mcbsp_24xx);
1002 omap2_mcbsp2_mux_setup();
1003 }
1004#endif
1005 for (i = 0; i < OMAP_MAX_MCBSP_COUNT ; i++) {
1006 if (i >= mcbsp_count) {
1007 mcbsp[i].io_base = 0;
1008 mcbsp[i].free = 0;
1009 continue;
1010 }
1011 mcbsp[i].id = i + 1;
1012 mcbsp[i].free = 1;
1013 mcbsp[i].dma_tx_lch = -1;
1014 mcbsp[i].dma_rx_lch = -1;
1015
1016 mcbsp[i].io_base = mcbsp_info[i].virt_base;
1017 mcbsp[i].io_type = OMAP_MCBSP_IRQ_IO; /* Default I/O is IRQ based */
1018 mcbsp[i].tx_irq = mcbsp_info[i].tx_irq;
1019 mcbsp[i].rx_irq = mcbsp_info[i].rx_irq;
1020 mcbsp[i].dma_rx_sync = mcbsp_info[i].dma_rx_sync;
1021 mcbsp[i].dma_tx_sync = mcbsp_info[i].dma_tx_sync;
1022 spin_lock_init(&mcbsp[i].lock);
1023 } 877 }
1024 878
1025 return 0; 879 return 0;
1026} 880}
1027 881
1028arch_initcall(omap_mcbsp_init); 882static struct platform_driver omap_mcbsp_driver = {
883 .probe = omap_mcbsp_probe,
884 .remove = omap_mcbsp_remove,
885 .driver = {
886 .name = "omap-mcbsp",
887 },
888};
889
890int __init omap_mcbsp_init(void)
891{
892 /* Register the McBSP driver */
893 return platform_driver_register(&omap_mcbsp_driver);
894}
1029 895
1030EXPORT_SYMBOL(omap_mcbsp_config);
1031EXPORT_SYMBOL(omap_mcbsp_request);
1032EXPORT_SYMBOL(omap_mcbsp_set_io_type);
1033EXPORT_SYMBOL(omap_mcbsp_free);
1034EXPORT_SYMBOL(omap_mcbsp_start);
1035EXPORT_SYMBOL(omap_mcbsp_stop);
1036EXPORT_SYMBOL(omap_mcbsp_pollread);
1037EXPORT_SYMBOL(omap_mcbsp_pollwrite);
1038EXPORT_SYMBOL(omap_mcbsp_xmit_word);
1039EXPORT_SYMBOL(omap_mcbsp_recv_word);
1040EXPORT_SYMBOL(omap_mcbsp_xmit_buffer);
1041EXPORT_SYMBOL(omap_mcbsp_recv_buffer);
1042EXPORT_SYMBOL(omap_mcbsp_spi_master_xmit_word_poll);
1043EXPORT_SYMBOL(omap_mcbsp_spi_master_recv_word_poll);
1044EXPORT_SYMBOL(omap_mcbsp_set_spi_mode);
diff --git a/arch/arm/plat-omap/sram.c b/arch/arm/plat-omap/sram.c
index 1f23f0459e5f..554ee58e1294 100644
--- a/arch/arm/plat-omap/sram.c
+++ b/arch/arm/plat-omap/sram.c
@@ -10,6 +10,7 @@
10 * it under the terms of the GNU General Public License version 2 as 10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation. 11 * published by the Free Software Foundation.
12 */ 12 */
13#undef DEBUG
13 14
14#include <linux/module.h> 15#include <linux/module.h>
15#include <linux/kernel.h> 16#include <linux/kernel.h>
@@ -24,25 +25,43 @@
24#include <asm/arch/sram.h> 25#include <asm/arch/sram.h>
25#include <asm/arch/board.h> 26#include <asm/arch/board.h>
26 27
28#include <asm/arch/control.h>
29
30#if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3)
31# include "../mach-omap2/prm.h"
32# include "../mach-omap2/cm.h"
33# include "../mach-omap2/sdrc.h"
34#endif
35
27#define OMAP1_SRAM_PA 0x20000000 36#define OMAP1_SRAM_PA 0x20000000
28#define OMAP1_SRAM_VA 0xd0000000 37#define OMAP1_SRAM_VA VMALLOC_END
29#define OMAP2_SRAM_PA 0x40200000 38#define OMAP2_SRAM_PA 0x40200000
30#define OMAP2_SRAM_PUB_PA 0x4020f800 39#define OMAP2_SRAM_PUB_PA 0x4020f800
31#define OMAP2_SRAM_VA 0xd0000000 40#define OMAP2_SRAM_VA VMALLOC_END
32#define OMAP2_SRAM_PUB_VA 0xd0000800 41#define OMAP2_SRAM_PUB_VA (VMALLOC_END + 0x800)
33 42#define OMAP3_SRAM_PA 0x40200000
34#if defined(CONFIG_ARCH_OMAP24XX) 43#define OMAP3_SRAM_VA 0xd7000000
44#define OMAP3_SRAM_PUB_PA 0x40208000
45#define OMAP3_SRAM_PUB_VA 0xd7008000
46
47#if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX)
35#define SRAM_BOOTLOADER_SZ 0x00 48#define SRAM_BOOTLOADER_SZ 0x00
36#else 49#else
37#define SRAM_BOOTLOADER_SZ 0x80 50#define SRAM_BOOTLOADER_SZ 0x80
38#endif 51#endif
39 52
40#define VA_REQINFOPERM0 IO_ADDRESS(0x68005048) 53#define OMAP24XX_VA_REQINFOPERM0 IO_ADDRESS(0x68005048)
41#define VA_READPERM0 IO_ADDRESS(0x68005050) 54#define OMAP24XX_VA_READPERM0 IO_ADDRESS(0x68005050)
42#define VA_WRITEPERM0 IO_ADDRESS(0x68005058) 55#define OMAP24XX_VA_WRITEPERM0 IO_ADDRESS(0x68005058)
43#define VA_CONTROL_STAT IO_ADDRESS(0x480002F8) 56
57#define OMAP34XX_VA_REQINFOPERM0 IO_ADDRESS(0x68012848)
58#define OMAP34XX_VA_READPERM0 IO_ADDRESS(0x68012850)
59#define OMAP34XX_VA_WRITEPERM0 IO_ADDRESS(0x68012858)
60#define OMAP34XX_VA_ADDR_MATCH2 IO_ADDRESS(0x68012880)
61#define OMAP34XX_VA_SMS_RG_ATT0 IO_ADDRESS(0x6C000048)
62#define OMAP34XX_VA_CONTROL_STAT IO_ADDRESS(0x480022F0)
63
44#define GP_DEVICE 0x300 64#define GP_DEVICE 0x300
45#define TYPE_MASK 0x700
46 65
47#define ROUND_DOWN(value,boundary) ((value) & (~((boundary)-1))) 66#define ROUND_DOWN(value,boundary) ((value) & (~((boundary)-1)))
48 67
@@ -68,14 +87,21 @@ static int is_sram_locked(void)
68 int type = 0; 87 int type = 0;
69 88
70 if (cpu_is_omap242x()) 89 if (cpu_is_omap242x())
71 type = __raw_readl(VA_CONTROL_STAT) & TYPE_MASK; 90 type = system_rev & OMAP2_DEVICETYPE_MASK;
72 91
73 if (type == GP_DEVICE) { 92 if (type == GP_DEVICE) {
74 /* RAMFW: R/W access to all initiators for all qualifier sets */ 93 /* RAMFW: R/W access to all initiators for all qualifier sets */
75 if (cpu_is_omap242x()) { 94 if (cpu_is_omap242x()) {
76 __raw_writel(0xFF, VA_REQINFOPERM0); /* all q-vects */ 95 __raw_writel(0xFF, OMAP24XX_VA_REQINFOPERM0); /* all q-vects */
77 __raw_writel(0xCFDE, VA_READPERM0); /* all i-read */ 96 __raw_writel(0xCFDE, OMAP24XX_VA_READPERM0); /* all i-read */
78 __raw_writel(0xCFDE, VA_WRITEPERM0); /* all i-write */ 97 __raw_writel(0xCFDE, OMAP24XX_VA_WRITEPERM0); /* all i-write */
98 }
99 if (cpu_is_omap34xx()) {
100 __raw_writel(0xFFFF, OMAP34XX_VA_REQINFOPERM0); /* all q-vects */
101 __raw_writel(0xFFFF, OMAP34XX_VA_READPERM0); /* all i-read */
102 __raw_writel(0xFFFF, OMAP34XX_VA_WRITEPERM0); /* all i-write */
103 __raw_writel(0x0, OMAP34XX_VA_ADDR_MATCH2);
104 __raw_writel(0xFFFFFFFF, OMAP34XX_VA_SMS_RG_ATT0);
79 } 105 }
80 return 0; 106 return 0;
81 } else 107 } else
@@ -92,18 +118,30 @@ void __init omap_detect_sram(void)
92{ 118{
93 unsigned long reserved; 119 unsigned long reserved;
94 120
95 if (cpu_is_omap24xx()) { 121 if (cpu_class_is_omap2()) {
96 if (is_sram_locked()) { 122 if (is_sram_locked()) {
97 omap_sram_base = OMAP2_SRAM_PUB_VA; 123 if (cpu_is_omap34xx()) {
98 omap_sram_start = OMAP2_SRAM_PUB_PA; 124 omap_sram_base = OMAP3_SRAM_PUB_VA;
99 omap_sram_size = 0x800; /* 2K */ 125 omap_sram_start = OMAP3_SRAM_PUB_PA;
126 omap_sram_size = 0x8000; /* 32K */
127 } else {
128 omap_sram_base = OMAP2_SRAM_PUB_VA;
129 omap_sram_start = OMAP2_SRAM_PUB_PA;
130 omap_sram_size = 0x800; /* 2K */
131 }
100 } else { 132 } else {
101 omap_sram_base = OMAP2_SRAM_VA; 133 if (cpu_is_omap34xx()) {
102 omap_sram_start = OMAP2_SRAM_PA; 134 omap_sram_base = OMAP3_SRAM_VA;
103 if (cpu_is_omap242x()) 135 omap_sram_start = OMAP3_SRAM_PA;
104 omap_sram_size = 0xa0000; /* 640K */
105 else if (cpu_is_omap243x())
106 omap_sram_size = 0x10000; /* 64K */ 136 omap_sram_size = 0x10000; /* 64K */
137 } else {
138 omap_sram_base = OMAP2_SRAM_VA;
139 omap_sram_start = OMAP2_SRAM_PA;
140 if (cpu_is_omap242x())
141 omap_sram_size = 0xa0000; /* 640K */
142 else if (cpu_is_omap243x())
143 omap_sram_size = 0x10000; /* 64K */
144 }
107 } 145 }
108 } else { 146 } else {
109 omap_sram_base = OMAP1_SRAM_VA; 147 omap_sram_base = OMAP1_SRAM_VA;
@@ -157,6 +195,13 @@ void __init omap_map_sram(void)
157 omap_sram_io_desc[0].pfn = __phys_to_pfn(base); 195 omap_sram_io_desc[0].pfn = __phys_to_pfn(base);
158 } 196 }
159 197
198 if (cpu_is_omap34xx()) {
199 omap_sram_io_desc[0].virtual = OMAP3_SRAM_VA;
200 base = OMAP3_SRAM_PA;
201 base = ROUND_DOWN(base, PAGE_SIZE);
202 omap_sram_io_desc[0].pfn = __phys_to_pfn(base);
203 }
204
160 omap_sram_io_desc[0].length = 1024 * 1024; /* Use section desc */ 205 omap_sram_io_desc[0].length = 1024 * 1024; /* Use section desc */
161 iotable_init(omap_sram_io_desc, ARRAY_SIZE(omap_sram_io_desc)); 206 iotable_init(omap_sram_io_desc, ARRAY_SIZE(omap_sram_io_desc));
162 207
@@ -191,6 +236,7 @@ void * omap_sram_push(void * start, unsigned long size)
191 omap_sram_ceil -= size; 236 omap_sram_ceil -= size;
192 omap_sram_ceil = ROUND_DOWN(omap_sram_ceil, sizeof(void *)); 237 omap_sram_ceil = ROUND_DOWN(omap_sram_ceil, sizeof(void *));
193 memcpy((void *)omap_sram_ceil, start, size); 238 memcpy((void *)omap_sram_ceil, start, size);
239 flush_icache_range((unsigned long)start, (unsigned long)(start + size));
194 240
195 return (void *)omap_sram_ceil; 241 return (void *)omap_sram_ceil;
196} 242}
@@ -214,8 +260,9 @@ void omap_sram_reprogram_clock(u32 dpllctl, u32 ckctl)
214 260
215int __init omap1_sram_init(void) 261int __init omap1_sram_init(void)
216{ 262{
217 _omap_sram_reprogram_clock = omap_sram_push(sram_reprogram_clock, 263 _omap_sram_reprogram_clock =
218 sram_reprogram_clock_sz); 264 omap_sram_push(omap1_sram_reprogram_clock,
265 omap1_sram_reprogram_clock_sz);
219 266
220 return 0; 267 return 0;
221} 268}
@@ -224,7 +271,7 @@ int __init omap1_sram_init(void)
224#define omap1_sram_init() do {} while (0) 271#define omap1_sram_init() do {} while (0)
225#endif 272#endif
226 273
227#ifdef CONFIG_ARCH_OMAP2 274#if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3)
228 275
229static void (*_omap2_sram_ddr_init)(u32 *slow_dll_ctrl, u32 fast_dll_ctrl, 276static void (*_omap2_sram_ddr_init)(u32 *slow_dll_ctrl, u32 fast_dll_ctrl,
230 u32 base_cs, u32 force_unlock); 277 u32 base_cs, u32 force_unlock);
@@ -259,19 +306,109 @@ u32 omap2_set_prcm(u32 dpll_ctrl_val, u32 sdrc_rfr_val, int bypass)
259 306
260 return _omap2_set_prcm(dpll_ctrl_val, sdrc_rfr_val, bypass); 307 return _omap2_set_prcm(dpll_ctrl_val, sdrc_rfr_val, bypass);
261} 308}
309#endif
310
311#ifdef CONFIG_ARCH_OMAP2420
312int __init omap242x_sram_init(void)
313{
314 _omap2_sram_ddr_init = omap_sram_push(omap242x_sram_ddr_init,
315 omap242x_sram_ddr_init_sz);
316
317 _omap2_sram_reprogram_sdrc = omap_sram_push(omap242x_sram_reprogram_sdrc,
318 omap242x_sram_reprogram_sdrc_sz);
319
320 _omap2_set_prcm = omap_sram_push(omap242x_sram_set_prcm,
321 omap242x_sram_set_prcm_sz);
322
323 return 0;
324}
325#else
326static inline int omap242x_sram_init(void)
327{
328 return 0;
329}
330#endif
331
332#ifdef CONFIG_ARCH_OMAP2430
333int __init omap243x_sram_init(void)
334{
335 _omap2_sram_ddr_init = omap_sram_push(omap243x_sram_ddr_init,
336 omap243x_sram_ddr_init_sz);
337
338 _omap2_sram_reprogram_sdrc = omap_sram_push(omap243x_sram_reprogram_sdrc,
339 omap243x_sram_reprogram_sdrc_sz);
340
341 _omap2_set_prcm = omap_sram_push(omap243x_sram_set_prcm,
342 omap243x_sram_set_prcm_sz);
343
344 return 0;
345}
346#else
347static inline int omap243x_sram_init(void)
348{
349 return 0;
350}
351#endif
352
353#ifdef CONFIG_ARCH_OMAP3
354
355static u32 (*_omap2_sram_reprogram_gpmc)(u32 perf_level);
356u32 omap2_sram_reprogram_gpmc(u32 perf_level)
357{
358 if (!_omap2_sram_reprogram_gpmc)
359 omap_sram_error();
360
361 return _omap2_sram_reprogram_gpmc(perf_level);
362}
363
364static u32 (*_omap2_sram_configure_core_dpll)(u32 m, u32 n,
365 u32 freqsel, u32 m2);
366u32 omap2_sram_configure_core_dpll(u32 m, u32 n, u32 freqsel, u32 m2)
367{
368 if (!_omap2_sram_configure_core_dpll)
369 omap_sram_error();
370
371 return _omap2_sram_configure_core_dpll(m, n, freqsel, m2);
372}
262 373
263int __init omap2_sram_init(void) 374/* REVISIT: Should this be same as omap34xx_sram_init() after off-idle? */
375void restore_sram_functions(void)
264{ 376{
265 _omap2_sram_ddr_init = omap_sram_push(sram_ddr_init, sram_ddr_init_sz); 377 omap_sram_ceil = omap_sram_base + omap_sram_size;
266 378
267 _omap2_sram_reprogram_sdrc = omap_sram_push(sram_reprogram_sdrc, 379 _omap2_sram_reprogram_gpmc = omap_sram_push(omap34xx_sram_reprogram_gpmc,
268 sram_reprogram_sdrc_sz); 380 omap34xx_sram_reprogram_gpmc_sz);
269 _omap2_set_prcm = omap_sram_push(sram_set_prcm, sram_set_prcm_sz); 381
382 _omap2_sram_configure_core_dpll =
383 omap_sram_push(omap34xx_sram_configure_core_dpll,
384 omap34xx_sram_configure_core_dpll_sz);
385}
386
387int __init omap34xx_sram_init(void)
388{
389 _omap2_sram_ddr_init = omap_sram_push(omap34xx_sram_ddr_init,
390 omap34xx_sram_ddr_init_sz);
391
392 _omap2_sram_reprogram_sdrc = omap_sram_push(omap34xx_sram_reprogram_sdrc,
393 omap34xx_sram_reprogram_sdrc_sz);
394
395 _omap2_set_prcm = omap_sram_push(omap34xx_sram_set_prcm,
396 omap34xx_sram_set_prcm_sz);
397
398 _omap2_sram_reprogram_gpmc = omap_sram_push(omap34xx_sram_reprogram_gpmc,
399 omap34xx_sram_reprogram_gpmc_sz);
400
401 _omap2_sram_configure_core_dpll =
402 omap_sram_push(omap34xx_sram_configure_core_dpll,
403 omap34xx_sram_configure_core_dpll_sz);
270 404
271 return 0; 405 return 0;
272} 406}
273#else 407#else
274#define omap2_sram_init() do {} while (0) 408static inline int omap34xx_sram_init(void)
409{
410 return 0;
411}
275#endif 412#endif
276 413
277int __init omap_sram_init(void) 414int __init omap_sram_init(void)
@@ -279,10 +416,14 @@ int __init omap_sram_init(void)
279 omap_detect_sram(); 416 omap_detect_sram();
280 omap_map_sram(); 417 omap_map_sram();
281 418
282 if (!cpu_is_omap24xx()) 419 if (!(cpu_class_is_omap2()))
283 omap1_sram_init(); 420 omap1_sram_init();
284 else 421 else if (cpu_is_omap242x())
285 omap2_sram_init(); 422 omap242x_sram_init();
423 else if (cpu_is_omap2430())
424 omap243x_sram_init();
425 else if (cpu_is_omap34xx())
426 omap34xx_sram_init();
286 427
287 return 0; 428 return 0;
288} 429}
diff --git a/arch/arm/plat-omap/usb.c b/arch/arm/plat-omap/usb.c
index a619475c4b76..2699c16d4da0 100644
--- a/arch/arm/plat-omap/usb.c
+++ b/arch/arm/plat-omap/usb.c
@@ -1,4 +1,4 @@
1/* 1 /*
2 * arch/arm/plat-omap/usb.c -- platform level USB initialization 2 * arch/arm/plat-omap/usb.c -- platform level USB initialization
3 * 3 *
4 * Copyright (C) 2004 Texas Instruments, Inc. 4 * Copyright (C) 2004 Texas Instruments, Inc.
@@ -156,8 +156,12 @@ static u32 __init omap_usb0_init(unsigned nwires, unsigned is_device)
156 156
157 if (nwires == 0) { 157 if (nwires == 0) {
158 if (cpu_class_is_omap1() && !cpu_is_omap15xx()) { 158 if (cpu_class_is_omap1() && !cpu_is_omap15xx()) {
159 u32 l;
160
159 /* pulldown D+/D- */ 161 /* pulldown D+/D- */
160 USB_TRANSCEIVER_CTRL_REG &= ~(3 << 1); 162 l = omap_readl(USB_TRANSCEIVER_CTRL);
163 l &= ~(3 << 1);
164 omap_writel(l, USB_TRANSCEIVER_CTRL);
161 } 165 }
162 return 0; 166 return 0;
163 } 167 }
@@ -171,6 +175,8 @@ static u32 __init omap_usb0_init(unsigned nwires, unsigned is_device)
171 175
172 /* internal transceiver (unavailable on 17xx, 24xx) */ 176 /* internal transceiver (unavailable on 17xx, 24xx) */
173 if (!cpu_class_is_omap2() && nwires == 2) { 177 if (!cpu_class_is_omap2() && nwires == 2) {
178 u32 l;
179
174 // omap_cfg_reg(P9_USB_DP); 180 // omap_cfg_reg(P9_USB_DP);
175 // omap_cfg_reg(R8_USB_DM); 181 // omap_cfg_reg(R8_USB_DM);
176 182
@@ -185,9 +191,11 @@ static u32 __init omap_usb0_init(unsigned nwires, unsigned is_device)
185 * - OTG support on this port not yet written 191 * - OTG support on this port not yet written
186 */ 192 */
187 193
188 USB_TRANSCEIVER_CTRL_REG &= ~(7 << 4); 194 l = omap_readl(USB_TRANSCEIVER_CTRL);
195 l &= ~(7 << 4);
189 if (!is_device) 196 if (!is_device)
190 USB_TRANSCEIVER_CTRL_REG |= (3 << 1); 197 l |= (3 << 1);
198 omap_writel(l, USB_TRANSCEIVER_CTRL);
191 199
192 return 3 << 16; 200 return 3 << 16;
193 } 201 }
@@ -217,8 +225,13 @@ static u32 __init omap_usb0_init(unsigned nwires, unsigned is_device)
217 * with VBUS switching and overcurrent detection. 225 * with VBUS switching and overcurrent detection.
218 */ 226 */
219 227
220 if (cpu_class_is_omap1() && nwires != 6) 228 if (cpu_class_is_omap1() && nwires != 6) {
221 USB_TRANSCEIVER_CTRL_REG &= ~CONF_USB2_UNI_R; 229 u32 l;
230
231 l = omap_readl(USB_TRANSCEIVER_CTRL);
232 l &= ~CONF_USB2_UNI_R;
233 omap_writel(l, USB_TRANSCEIVER_CTRL);
234 }
222 235
223 switch (nwires) { 236 switch (nwires) {
224 case 3: 237 case 3:
@@ -238,9 +251,13 @@ static u32 __init omap_usb0_init(unsigned nwires, unsigned is_device)
238 omap_cfg_reg(K20_24XX_USB0_VM); 251 omap_cfg_reg(K20_24XX_USB0_VM);
239 omap2_usb_devconf_set(0, USB_UNIDIR); 252 omap2_usb_devconf_set(0, USB_UNIDIR);
240 } else { 253 } else {
254 u32 l;
255
241 omap_cfg_reg(AA9_USB0_VP); 256 omap_cfg_reg(AA9_USB0_VP);
242 omap_cfg_reg(R9_USB0_VM); 257 omap_cfg_reg(R9_USB0_VM);
243 USB_TRANSCEIVER_CTRL_REG |= CONF_USB2_UNI_R; 258 l = omap_readl(USB_TRANSCEIVER_CTRL);
259 l |= CONF_USB2_UNI_R;
260 omap_writel(l, USB_TRANSCEIVER_CTRL);
244 } 261 }
245 break; 262 break;
246 default: 263 default:
@@ -254,8 +271,13 @@ static u32 __init omap_usb1_init(unsigned nwires)
254{ 271{
255 u32 syscon1 = 0; 272 u32 syscon1 = 0;
256 273
257 if (cpu_class_is_omap1() && !cpu_is_omap15xx() && nwires != 6) 274 if (cpu_class_is_omap1() && !cpu_is_omap15xx() && nwires != 6) {
258 USB_TRANSCEIVER_CTRL_REG &= ~CONF_USB1_UNI_R; 275 u32 l;
276
277 l = omap_readl(USB_TRANSCEIVER_CTRL);
278 l &= ~CONF_USB1_UNI_R;
279 omap_writel(l, USB_TRANSCEIVER_CTRL);
280 }
259 if (cpu_is_omap24xx()) 281 if (cpu_is_omap24xx())
260 omap2_usb_devconf_clear(1, USB_BIDIR_TLL); 282 omap2_usb_devconf_clear(1, USB_BIDIR_TLL);
261 283
@@ -316,8 +338,13 @@ static u32 __init omap_usb1_init(unsigned nwires)
316 syscon1 = 3; 338 syscon1 = 3;
317 omap_cfg_reg(USB1_VP); 339 omap_cfg_reg(USB1_VP);
318 omap_cfg_reg(USB1_VM); 340 omap_cfg_reg(USB1_VM);
319 if (!cpu_is_omap15xx()) 341 if (!cpu_is_omap15xx()) {
320 USB_TRANSCEIVER_CTRL_REG |= CONF_USB1_UNI_R; 342 u32 l;
343
344 l = omap_readl(USB_TRANSCEIVER_CTRL);
345 l |= CONF_USB1_UNI_R;
346 omap_writel(l, USB_TRANSCEIVER_CTRL);
347 }
321 break; 348 break;
322 default: 349 default:
323bad: 350bad:
@@ -340,8 +367,13 @@ static u32 __init omap_usb2_init(unsigned nwires, unsigned alt_pingroup)
340 if (alt_pingroup || nwires == 0) 367 if (alt_pingroup || nwires == 0)
341 return 0; 368 return 0;
342 369
343 if (cpu_class_is_omap1() && !cpu_is_omap15xx() && nwires != 6) 370 if (cpu_class_is_omap1() && !cpu_is_omap15xx() && nwires != 6) {
344 USB_TRANSCEIVER_CTRL_REG &= ~CONF_USB2_UNI_R; 371 u32 l;
372
373 l = omap_readl(USB_TRANSCEIVER_CTRL);
374 l &= ~CONF_USB2_UNI_R;
375 omap_writel(l, USB_TRANSCEIVER_CTRL);
376 }
345 377
346 /* external transceiver */ 378 /* external transceiver */
347 if (cpu_is_omap15xx()) { 379 if (cpu_is_omap15xx()) {
@@ -410,9 +442,13 @@ static u32 __init omap_usb2_init(unsigned nwires, unsigned alt_pingroup)
410 omap_cfg_reg(USB2_VP); 442 omap_cfg_reg(USB2_VP);
411 omap_cfg_reg(USB2_VM); 443 omap_cfg_reg(USB2_VM);
412 } else { 444 } else {
445 u32 l;
446
413 omap_cfg_reg(AA9_USB2_VP); 447 omap_cfg_reg(AA9_USB2_VP);
414 omap_cfg_reg(R9_USB2_VM); 448 omap_cfg_reg(R9_USB2_VM);
415 USB_TRANSCEIVER_CTRL_REG |= CONF_USB2_UNI_R; 449 l = omap_readl(USB_TRANSCEIVER_CTRL);
450 l |= CONF_USB2_UNI_R;
451 omap_writel(l, USB_TRANSCEIVER_CTRL);
416 } 452 }
417 break; 453 break;
418 default: 454 default:
@@ -531,10 +567,6 @@ static struct platform_device otg_device = {
531 567
532/*-------------------------------------------------------------------------*/ 568/*-------------------------------------------------------------------------*/
533 569
534#define ULPD_CLOCK_CTRL_REG __REG16(ULPD_CLOCK_CTRL)
535#define ULPD_SOFT_REQ_REG __REG16(ULPD_SOFT_REQ)
536
537
538// FIXME correct answer depends on hmc_mode, 570// FIXME correct answer depends on hmc_mode,
539// as does (on omap1) any nonzero value for config->otg port number 571// as does (on omap1) any nonzero value for config->otg port number
540#ifdef CONFIG_USB_GADGET_OMAP 572#ifdef CONFIG_USB_GADGET_OMAP
@@ -550,17 +582,17 @@ static struct platform_device otg_device = {
550void __init 582void __init
551omap_otg_init(struct omap_usb_config *config) 583omap_otg_init(struct omap_usb_config *config)
552{ 584{
553 u32 syscon = OTG_SYSCON_1_REG & 0xffff; 585 u32 syscon;
554 int status; 586 int status;
555 int alt_pingroup = 0; 587 int alt_pingroup = 0;
556 588
557 /* NOTE: no bus or clock setup (yet?) */ 589 /* NOTE: no bus or clock setup (yet?) */
558 590
559 syscon = OTG_SYSCON_1_REG & 0xffff; 591 syscon = omap_readl(OTG_SYSCON_1) & 0xffff;
560 if (!(syscon & OTG_RESET_DONE)) 592 if (!(syscon & OTG_RESET_DONE))
561 pr_debug("USB resets not complete?\n"); 593 pr_debug("USB resets not complete?\n");
562 594
563 // OTG_IRQ_EN_REG = 0; 595 //omap_writew(0, OTG_IRQ_EN);
564 596
565 /* pin muxing and transceiver pinouts */ 597 /* pin muxing and transceiver pinouts */
566 if (config->pins[0] > 2) /* alt pingroup 2 */ 598 if (config->pins[0] > 2) /* alt pingroup 2 */
@@ -568,8 +600,8 @@ omap_otg_init(struct omap_usb_config *config)
568 syscon |= omap_usb0_init(config->pins[0], is_usb0_device(config)); 600 syscon |= omap_usb0_init(config->pins[0], is_usb0_device(config));
569 syscon |= omap_usb1_init(config->pins[1]); 601 syscon |= omap_usb1_init(config->pins[1]);
570 syscon |= omap_usb2_init(config->pins[2], alt_pingroup); 602 syscon |= omap_usb2_init(config->pins[2], alt_pingroup);
571 pr_debug("OTG_SYSCON_1_REG = %08x\n", syscon); 603 pr_debug("OTG_SYSCON_1 = %08x\n", omap_readl(OTG_SYSCON_1));
572 OTG_SYSCON_1_REG = syscon; 604 omap_writel(syscon, OTG_SYSCON_1);
573 605
574 syscon = config->hmc_mode; 606 syscon = config->hmc_mode;
575 syscon |= USBX_SYNCHRO | (4 << 16) /* B_ASE0_BRST */; 607 syscon |= USBX_SYNCHRO | (4 << 16) /* B_ASE0_BRST */;
@@ -578,9 +610,10 @@ omap_otg_init(struct omap_usb_config *config)
578 syscon |= OTG_EN; 610 syscon |= OTG_EN;
579#endif 611#endif
580 if (cpu_class_is_omap1()) 612 if (cpu_class_is_omap1())
581 pr_debug("USB_TRANSCEIVER_CTRL_REG = %03x\n", USB_TRANSCEIVER_CTRL_REG); 613 pr_debug("USB_TRANSCEIVER_CTRL = %03x\n",
582 pr_debug("OTG_SYSCON_2_REG = %08x\n", syscon); 614 omap_readl(USB_TRANSCEIVER_CTRL));
583 OTG_SYSCON_2_REG = syscon; 615 pr_debug("OTG_SYSCON_2 = %08x\n", omap_readl(OTG_SYSCON_2));
616 omap_writel(syscon, OTG_SYSCON_2);
584 617
585 printk("USB: hmc %d", config->hmc_mode); 618 printk("USB: hmc %d", config->hmc_mode);
586 if (!alt_pingroup) 619 if (!alt_pingroup)
@@ -597,12 +630,19 @@ omap_otg_init(struct omap_usb_config *config)
597 printk("\n"); 630 printk("\n");
598 631
599 if (cpu_class_is_omap1()) { 632 if (cpu_class_is_omap1()) {
633 u16 w;
634
600 /* leave USB clocks/controllers off until needed */ 635 /* leave USB clocks/controllers off until needed */
601 ULPD_SOFT_REQ_REG &= ~SOFT_USB_CLK_REQ; 636 w = omap_readw(ULPD_SOFT_REQ);
602 ULPD_CLOCK_CTRL_REG &= ~USB_MCLK_EN; 637 w &= ~SOFT_USB_CLK_REQ;
603 ULPD_CLOCK_CTRL_REG |= DIS_USB_PVCI_CLK; 638 omap_writew(w, ULPD_SOFT_REQ);
639
640 w = omap_readw(ULPD_CLOCK_CTRL);
641 w &= ~USB_MCLK_EN;
642 w |= DIS_USB_PVCI_CLK;
643 omap_writew(w, ULPD_CLOCK_CTRL);
604 } 644 }
605 syscon = OTG_SYSCON_1_REG; 645 syscon = omap_readl(OTG_SYSCON_1);
606 syscon |= HST_IDLE_EN|DEV_IDLE_EN|OTG_IDLE_EN; 646 syscon |= HST_IDLE_EN|DEV_IDLE_EN|OTG_IDLE_EN;
607 647
608#ifdef CONFIG_USB_GADGET_OMAP 648#ifdef CONFIG_USB_GADGET_OMAP
@@ -639,8 +679,8 @@ omap_otg_init(struct omap_usb_config *config)
639 pr_debug("can't register OTG device, %d\n", status); 679 pr_debug("can't register OTG device, %d\n", status);
640 } 680 }
641#endif 681#endif
642 pr_debug("OTG_SYSCON_1_REG = %08x\n", syscon); 682 pr_debug("OTG_SYSCON_1 = %08x\n", omap_readl(OTG_SYSCON_1));
643 OTG_SYSCON_1_REG = syscon; 683 omap_writel(syscon, OTG_SYSCON_1);
644 684
645 status = 0; 685 status = 0;
646} 686}
@@ -653,18 +693,19 @@ static inline void omap_otg_init(struct omap_usb_config *config) {}
653 693
654#ifdef CONFIG_ARCH_OMAP15XX 694#ifdef CONFIG_ARCH_OMAP15XX
655 695
656#define ULPD_DPLL_CTRL_REG __REG16(ULPD_DPLL_CTRL) 696/* ULPD_DPLL_CTRL */
657#define DPLL_IOB (1 << 13) 697#define DPLL_IOB (1 << 13)
658#define DPLL_PLL_ENABLE (1 << 4) 698#define DPLL_PLL_ENABLE (1 << 4)
659#define DPLL_LOCK (1 << 0) 699#define DPLL_LOCK (1 << 0)
660 700
661#define ULPD_APLL_CTRL_REG __REG16(ULPD_APLL_CTRL) 701/* ULPD_APLL_CTRL */
662#define APLL_NDPLL_SWITCH (1 << 0) 702#define APLL_NDPLL_SWITCH (1 << 0)
663 703
664 704
665static void __init omap_1510_usb_init(struct omap_usb_config *config) 705static void __init omap_1510_usb_init(struct omap_usb_config *config)
666{ 706{
667 unsigned int val; 707 unsigned int val;
708 u16 w;
668 709
669 omap_usb0_init(config->pins[0], is_usb0_device(config)); 710 omap_usb0_init(config->pins[0], is_usb0_device(config));
670 omap_usb1_init(config->pins[1]); 711 omap_usb1_init(config->pins[1]);
@@ -685,12 +726,22 @@ static void __init omap_1510_usb_init(struct omap_usb_config *config)
685 printk("\n"); 726 printk("\n");
686 727
687 /* use DPLL for 48 MHz function clock */ 728 /* use DPLL for 48 MHz function clock */
688 pr_debug("APLL %04x DPLL %04x REQ %04x\n", ULPD_APLL_CTRL_REG, 729 pr_debug("APLL %04x DPLL %04x REQ %04x\n", omap_readw(ULPD_APLL_CTRL),
689 ULPD_DPLL_CTRL_REG, ULPD_SOFT_REQ_REG); 730 omap_readw(ULPD_DPLL_CTRL), omap_readw(ULPD_SOFT_REQ));
690 ULPD_APLL_CTRL_REG &= ~APLL_NDPLL_SWITCH; 731
691 ULPD_DPLL_CTRL_REG |= DPLL_IOB | DPLL_PLL_ENABLE; 732 w = omap_readw(ULPD_APLL_CTRL);
692 ULPD_SOFT_REQ_REG |= SOFT_UDC_REQ | SOFT_DPLL_REQ; 733 w &= ~APLL_NDPLL_SWITCH;
693 while (!(ULPD_DPLL_CTRL_REG & DPLL_LOCK)) 734 omap_writew(w, ULPD_APLL_CTRL);
735
736 w = omap_readw(ULPD_DPLL_CTRL);
737 w |= DPLL_IOB | DPLL_PLL_ENABLE;
738 omap_writew(w, ULPD_DPLL_CTRL);
739
740 w = omap_readw(ULPD_SOFT_REQ);
741 w |= SOFT_UDC_REQ | SOFT_DPLL_REQ;
742 omap_writew(w, ULPD_SOFT_REQ);
743
744 while (!(omap_readw(ULPD_DPLL_CTRL) & DPLL_LOCK))
694 cpu_relax(); 745 cpu_relax();
695 746
696#ifdef CONFIG_USB_GADGET_OMAP 747#ifdef CONFIG_USB_GADGET_OMAP
diff --git a/arch/arm/plat-orion/irq.c b/arch/arm/plat-orion/irq.c
index c5b669d234bc..fe66a1835169 100644
--- a/arch/arm/plat-orion/irq.c
+++ b/arch/arm/plat-orion/irq.c
@@ -36,8 +36,8 @@ static void orion_irq_unmask(u32 irq)
36 36
37static struct irq_chip orion_irq_chip = { 37static struct irq_chip orion_irq_chip = {
38 .name = "orion_irq", 38 .name = "orion_irq",
39 .ack = orion_irq_mask,
40 .mask = orion_irq_mask, 39 .mask = orion_irq_mask,
40 .mask_ack = orion_irq_mask,
41 .unmask = orion_irq_unmask, 41 .unmask = orion_irq_unmask,
42}; 42};
43 43
@@ -59,6 +59,7 @@ void __init orion_irq_init(unsigned int irq_start, void __iomem *maskaddr)
59 set_irq_chip(irq, &orion_irq_chip); 59 set_irq_chip(irq, &orion_irq_chip);
60 set_irq_chip_data(irq, maskaddr); 60 set_irq_chip_data(irq, maskaddr);
61 set_irq_handler(irq, handle_level_irq); 61 set_irq_handler(irq, handle_level_irq);
62 irq_desc[irq].status |= IRQ_LEVEL;
62 set_irq_flags(irq, IRQF_VALID); 63 set_irq_flags(irq, IRQF_VALID);
63 } 64 }
64} 65}
diff --git a/arch/arm/plat-orion/pcie.c b/arch/arm/plat-orion/pcie.c
index abfda53f1800..ca32c60e14d7 100644
--- a/arch/arm/plat-orion/pcie.c
+++ b/arch/arm/plat-orion/pcie.c
@@ -39,6 +39,7 @@
39#define PCIE_CONF_DATA_OFF 0x18fc 39#define PCIE_CONF_DATA_OFF 0x18fc
40#define PCIE_MASK_OFF 0x1910 40#define PCIE_MASK_OFF 0x1910
41#define PCIE_CTRL_OFF 0x1a00 41#define PCIE_CTRL_OFF 0x1a00
42#define PCIE_CTRL_X1_MODE 0x0001
42#define PCIE_STAT_OFF 0x1a04 43#define PCIE_STAT_OFF 0x1a04
43#define PCIE_STAT_DEV_OFFS 20 44#define PCIE_STAT_DEV_OFFS 20
44#define PCIE_STAT_DEV_MASK 0x1f 45#define PCIE_STAT_DEV_MASK 0x1f
@@ -62,6 +63,11 @@ int orion_pcie_link_up(void __iomem *base)
62 return !(readl(base + PCIE_STAT_OFF) & PCIE_STAT_LINK_DOWN); 63 return !(readl(base + PCIE_STAT_OFF) & PCIE_STAT_LINK_DOWN);
63} 64}
64 65
66int __init orion_pcie_x4_mode(void __iomem *base)
67{
68 return !(readl(base + PCIE_CTRL_OFF) & PCIE_CTRL_X1_MODE);
69}
70
65int orion_pcie_get_local_bus_nr(void __iomem *base) 71int orion_pcie_get_local_bus_nr(void __iomem *base)
66{ 72{
67 u32 stat = readl(base + PCIE_STAT_OFF); 73 u32 stat = readl(base + PCIE_STAT_OFF);
diff --git a/arch/arm/plat-orion/time.c b/arch/arm/plat-orion/time.c
index 28b5285446e8..93c4ef9f0067 100644
--- a/arch/arm/plat-orion/time.c
+++ b/arch/arm/plat-orion/time.c
@@ -74,7 +74,7 @@ orion_clkevt_next_event(unsigned long delta, struct clock_event_device *dev)
74 /* 74 /*
75 * Clear and enable clockevent timer interrupt. 75 * Clear and enable clockevent timer interrupt.
76 */ 76 */
77 writel(~BRIDGE_INT_TIMER1, BRIDGE_CAUSE); 77 writel(BRIDGE_INT_TIMER1_CLR, BRIDGE_CAUSE);
78 78
79 u = readl(BRIDGE_MASK); 79 u = readl(BRIDGE_MASK);
80 u |= BRIDGE_INT_TIMER1; 80 u |= BRIDGE_INT_TIMER1;
@@ -138,7 +138,7 @@ orion_clkevt_mode(enum clock_event_mode mode, struct clock_event_device *dev)
138 /* 138 /*
139 * ACK pending timer interrupt. 139 * ACK pending timer interrupt.
140 */ 140 */
141 writel(~BRIDGE_INT_TIMER1, BRIDGE_CAUSE); 141 writel(BRIDGE_INT_TIMER1_CLR, BRIDGE_CAUSE);
142 142
143 } 143 }
144 local_irq_restore(flags); 144 local_irq_restore(flags);
@@ -159,7 +159,7 @@ static irqreturn_t orion_timer_interrupt(int irq, void *dev_id)
159 /* 159 /*
160 * ACK timer interrupt and call event handler. 160 * ACK timer interrupt and call event handler.
161 */ 161 */
162 writel(~BRIDGE_INT_TIMER1, BRIDGE_CAUSE); 162 writel(BRIDGE_INT_TIMER1_CLR, BRIDGE_CAUSE);
163 orion_clkevt.event_handler(&orion_clkevt); 163 orion_clkevt.event_handler(&orion_clkevt);
164 164
165 return IRQ_HANDLED; 165 return IRQ_HANDLED;
diff --git a/arch/arm/plat-s3c24xx/Kconfig b/arch/arm/plat-s3c24xx/Kconfig
index b66fb3c4e228..5e28c217b8c2 100644
--- a/arch/arm/plat-s3c24xx/Kconfig
+++ b/arch/arm/plat-s3c24xx/Kconfig
@@ -9,6 +9,7 @@ config PLAT_S3C24XX
9 depends on ARCH_S3C2410 9 depends on ARCH_S3C2410
10 default y if ARCH_S3C2410 10 default y if ARCH_S3C2410
11 select NO_IOPORT 11 select NO_IOPORT
12 select HAVE_GPIO_LIB
12 help 13 help
13 Base platform code for any Samsung S3C24XX device 14 Base platform code for any Samsung S3C24XX device
14 15
@@ -20,6 +21,13 @@ config CPU_S3C244X
20 help 21 help
21 Support for S3C2440 and S3C2442 Samsung Mobile CPU based systems. 22 Support for S3C2440 and S3C2442 Samsung Mobile CPU based systems.
22 23
24config S3C24XX_PWM
25 bool "PWM device support"
26 select HAVE_PWM
27 help
28 Support for exporting the PWM timer blocks via the pwm device
29 system.
30
23config PM_SIMTEC 31config PM_SIMTEC
24 bool 32 bool
25 help 33 help
diff --git a/arch/arm/plat-s3c24xx/Makefile b/arch/arm/plat-s3c24xx/Makefile
index 131d20237dd7..d82767b2b833 100644
--- a/arch/arm/plat-s3c24xx/Makefile
+++ b/arch/arm/plat-s3c24xx/Makefile
@@ -16,8 +16,10 @@ obj-y += cpu.o
16obj-y += irq.o 16obj-y += irq.o
17obj-y += devs.o 17obj-y += devs.o
18obj-y += gpio.o 18obj-y += gpio.o
19obj-y += gpiolib.o
19obj-y += time.o 20obj-y += time.o
20obj-y += clock.o 21obj-y += clock.o
22obj-y += pwm-clock.o
21 23
22# Architecture dependant builds 24# Architecture dependant builds
23 25
@@ -27,5 +29,6 @@ obj-$(CONFIG_CPU_S3C244X) += s3c244x-clock.o
27obj-$(CONFIG_PM_SIMTEC) += pm-simtec.o 29obj-$(CONFIG_PM_SIMTEC) += pm-simtec.o
28obj-$(CONFIG_PM) += pm.o 30obj-$(CONFIG_PM) += pm.o
29obj-$(CONFIG_PM) += sleep.o 31obj-$(CONFIG_PM) += sleep.o
32obj-$(CONFIG_HAVE_PWM) += pwm.o
30obj-$(CONFIG_S3C2410_DMA) += dma.o 33obj-$(CONFIG_S3C2410_DMA) += dma.o
31obj-$(CONFIG_MACH_SMDK) += common-smdk.o 34obj-$(CONFIG_MACH_SMDK) += common-smdk.o
diff --git a/arch/arm/plat-s3c24xx/devs.c b/arch/arm/plat-s3c24xx/devs.c
index e546e933b3f7..eea3b32ff798 100644
--- a/arch/arm/plat-s3c24xx/devs.c
+++ b/arch/arm/plat-s3c24xx/devs.c
@@ -495,106 +495,6 @@ struct platform_device s3c_device_spi1 = {
495 495
496EXPORT_SYMBOL(s3c_device_spi1); 496EXPORT_SYMBOL(s3c_device_spi1);
497 497
498/* pwm timer blocks */
499
500static struct resource s3c_timer0_resource[] = {
501 [0] = {
502 .start = S3C24XX_PA_TIMER + 0x0C,
503 .end = S3C24XX_PA_TIMER + 0x0C + 0xB,
504 .flags = IORESOURCE_MEM,
505 },
506 [1] = {
507 .start = IRQ_TIMER0,
508 .end = IRQ_TIMER0,
509 .flags = IORESOURCE_IRQ,
510 }
511
512};
513
514struct platform_device s3c_device_timer0 = {
515 .name = "s3c2410-timer",
516 .id = 0,
517 .num_resources = ARRAY_SIZE(s3c_timer0_resource),
518 .resource = s3c_timer0_resource,
519};
520
521EXPORT_SYMBOL(s3c_device_timer0);
522
523/* timer 1 */
524
525static struct resource s3c_timer1_resource[] = {
526 [0] = {
527 .start = S3C24XX_PA_TIMER + 0x18,
528 .end = S3C24XX_PA_TIMER + 0x23,
529 .flags = IORESOURCE_MEM,
530 },
531 [1] = {
532 .start = IRQ_TIMER1,
533 .end = IRQ_TIMER1,
534 .flags = IORESOURCE_IRQ,
535 }
536
537};
538
539struct platform_device s3c_device_timer1 = {
540 .name = "s3c2410-timer",
541 .id = 1,
542 .num_resources = ARRAY_SIZE(s3c_timer1_resource),
543 .resource = s3c_timer1_resource,
544};
545
546EXPORT_SYMBOL(s3c_device_timer1);
547
548/* timer 2 */
549
550static struct resource s3c_timer2_resource[] = {
551 [0] = {
552 .start = S3C24XX_PA_TIMER + 0x24,
553 .end = S3C24XX_PA_TIMER + 0x2F,
554 .flags = IORESOURCE_MEM,
555 },
556 [1] = {
557 .start = IRQ_TIMER2,
558 .end = IRQ_TIMER2,
559 .flags = IORESOURCE_IRQ,
560 }
561
562};
563
564struct platform_device s3c_device_timer2 = {
565 .name = "s3c2410-timer",
566 .id = 2,
567 .num_resources = ARRAY_SIZE(s3c_timer2_resource),
568 .resource = s3c_timer2_resource,
569};
570
571EXPORT_SYMBOL(s3c_device_timer2);
572
573/* timer 3 */
574
575static struct resource s3c_timer3_resource[] = {
576 [0] = {
577 .start = S3C24XX_PA_TIMER + 0x30,
578 .end = S3C24XX_PA_TIMER + 0x3B,
579 .flags = IORESOURCE_MEM,
580 },
581 [1] = {
582 .start = IRQ_TIMER3,
583 .end = IRQ_TIMER3,
584 .flags = IORESOURCE_IRQ,
585 }
586
587};
588
589struct platform_device s3c_device_timer3 = {
590 .name = "s3c2410-timer",
591 .id = 3,
592 .num_resources = ARRAY_SIZE(s3c_timer3_resource),
593 .resource = s3c_timer3_resource,
594};
595
596EXPORT_SYMBOL(s3c_device_timer3);
597
598#ifdef CONFIG_CPU_S3C2440 498#ifdef CONFIG_CPU_S3C2440
599 499
600/* Camif Controller */ 500/* Camif Controller */
diff --git a/arch/arm/plat-s3c24xx/gpiolib.c b/arch/arm/plat-s3c24xx/gpiolib.c
new file mode 100644
index 000000000000..825d8d0c5ca2
--- /dev/null
+++ b/arch/arm/plat-s3c24xx/gpiolib.c
@@ -0,0 +1,259 @@
1/* linux/arch/arm/plat-s3c24xx/gpiolib.c
2 *
3 * Copyright (c) 2008 Simtec Electronics
4 * http://armlinux.simtec.co.uk/
5 * Ben Dooks <ben@simtec.co.uk>
6 *
7 * S3C24XX GPIOlib support
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License.
12*/
13
14#include <linux/kernel.h>
15#include <linux/init.h>
16#include <linux/module.h>
17#include <linux/interrupt.h>
18#include <linux/ioport.h>
19#include <linux/io.h>
20#include <linux/gpio.h>
21
22#include <asm/hardware.h>
23#include <asm/irq.h>
24
25#include <asm/arch/regs-gpio.h>
26
27struct s3c24xx_gpio_chip {
28 struct gpio_chip chip;
29 void __iomem *base;
30};
31
32static inline struct s3c24xx_gpio_chip *to_s3c_chip(struct gpio_chip *gpc)
33{
34 return container_of(gpc, struct s3c24xx_gpio_chip, chip);
35}
36
37/* these routines are exported for use by other parts of the platform
38 * and system support, but are not intended to be used directly by the
39 * drivers themsevles.
40 */
41
42int s3c24xx_gpiolib_input(struct gpio_chip *chip, unsigned offset)
43{
44 struct s3c24xx_gpio_chip *ourchip = to_s3c_chip(chip);
45 void __iomem *base = ourchip->base;
46 unsigned long flags;
47 unsigned long con;
48
49 local_irq_save(flags);
50
51 con = __raw_readl(base + 0x00);
52 con &= ~(3 << (offset * 2));
53 con |= (S3C2410_GPIO_OUTPUT & 0xf) << (offset * 2);
54
55 __raw_writel(con, base + 0x00);
56
57 local_irq_restore(flags);
58 return 0;
59}
60
61int s3c24xx_gpiolib_output(struct gpio_chip *chip,
62 unsigned offset, int value)
63{
64 struct s3c24xx_gpio_chip *ourchip = to_s3c_chip(chip);
65 void __iomem *base = ourchip->base;
66 unsigned long flags;
67 unsigned long dat;
68 unsigned long con;
69
70 local_irq_save(flags);
71
72 dat = __raw_readl(base + 0x04);
73 dat &= ~(1 << offset);
74 if (value)
75 dat |= 1 << offset;
76 __raw_writel(dat, base + 0x04);
77
78 con = __raw_readl(base + 0x00);
79 con &= ~(3 << (offset * 2));
80 con |= (S3C2410_GPIO_OUTPUT & 0xf) << (offset * 2);
81
82 __raw_writel(con, base + 0x00);
83 __raw_writel(dat, base + 0x04);
84
85 local_irq_restore(flags);
86 return 0;
87}
88
89void s3c24xx_gpiolib_set(struct gpio_chip *chip, unsigned offset, int value)
90{
91 struct s3c24xx_gpio_chip *ourchip = to_s3c_chip(chip);
92 void __iomem *base = ourchip->base;
93 unsigned long flags;
94 unsigned long dat;
95
96 local_irq_save(flags);
97
98 dat = __raw_readl(base + 0x04);
99 dat &= ~(1 << offset);
100 if (value)
101 dat |= 1 << offset;
102 __raw_writel(dat, base + 0x04);
103
104 local_irq_restore(flags);
105}
106
107int s3c24xx_gpiolib_get(struct gpio_chip *chip, unsigned offset)
108{
109 struct s3c24xx_gpio_chip *ourchip = to_s3c_chip(chip);
110 unsigned long val;
111
112 val = __raw_readl(ourchip->base + 0x04);
113 val >>= offset;
114 val &= 1;
115
116 return val;
117}
118
119static int s3c24xx_gpiolib_banka_input(struct gpio_chip *chip, unsigned offset)
120{
121 return -EINVAL;
122}
123
124static int s3c24xx_gpiolib_banka_output(struct gpio_chip *chip,
125 unsigned offset, int value)
126{
127 struct s3c24xx_gpio_chip *ourchip = to_s3c_chip(chip);
128 void __iomem *base = ourchip->base;
129 unsigned long flags;
130 unsigned long dat;
131 unsigned long con;
132
133 local_irq_save(flags);
134
135 con = __raw_readl(base + 0x00);
136 dat = __raw_readl(base + 0x04);
137
138 dat &= ~(1 << offset);
139 if (value)
140 dat |= 1 << offset;
141
142 __raw_writel(dat, base + 0x04);
143
144 con &= ~(1 << offset);
145
146 __raw_writel(con, base + 0x00);
147 __raw_writel(dat, base + 0x04);
148
149 local_irq_restore(flags);
150 return 0;
151}
152
153
154struct s3c24xx_gpio_chip gpios[] = {
155 [0] = {
156 .base = S3C24XX_GPIO_BASE(S3C2410_GPA0),
157 .chip = {
158 .base = S3C2410_GPA0,
159 .owner = THIS_MODULE,
160 .label = "GPIOA",
161 .ngpio = 24,
162 .direction_input = s3c24xx_gpiolib_banka_input,
163 .direction_output = s3c24xx_gpiolib_banka_output,
164 .set = s3c24xx_gpiolib_set,
165 .get = s3c24xx_gpiolib_get,
166 },
167 },
168 [1] = {
169 .base = S3C24XX_GPIO_BASE(S3C2410_GPB0),
170 .chip = {
171 .base = S3C2410_GPB0,
172 .owner = THIS_MODULE,
173 .label = "GPIOB",
174 .ngpio = 16,
175 .direction_input = s3c24xx_gpiolib_input,
176 .direction_output = s3c24xx_gpiolib_output,
177 .set = s3c24xx_gpiolib_set,
178 .get = s3c24xx_gpiolib_get,
179 },
180 },
181 [2] = {
182 .base = S3C24XX_GPIO_BASE(S3C2410_GPC0),
183 .chip = {
184 .base = S3C2410_GPC0,
185 .owner = THIS_MODULE,
186 .label = "GPIOC",
187 .ngpio = 16,
188 .direction_input = s3c24xx_gpiolib_input,
189 .direction_output = s3c24xx_gpiolib_output,
190 .set = s3c24xx_gpiolib_set,
191 .get = s3c24xx_gpiolib_get,
192 },
193 },
194 [3] = {
195 .base = S3C24XX_GPIO_BASE(S3C2410_GPD0),
196 .chip = {
197 .base = S3C2410_GPD0,
198 .owner = THIS_MODULE,
199 .label = "GPIOD",
200 .ngpio = 16,
201 .direction_input = s3c24xx_gpiolib_input,
202 .direction_output = s3c24xx_gpiolib_output,
203 .set = s3c24xx_gpiolib_set,
204 .get = s3c24xx_gpiolib_get,
205 },
206 },
207 [4] = {
208 .base = S3C24XX_GPIO_BASE(S3C2410_GPE0),
209 .chip = {
210 .base = S3C2410_GPE0,
211 .label = "GPIOE",
212 .owner = THIS_MODULE,
213 .ngpio = 16,
214 .direction_input = s3c24xx_gpiolib_input,
215 .direction_output = s3c24xx_gpiolib_output,
216 .set = s3c24xx_gpiolib_set,
217 .get = s3c24xx_gpiolib_get,
218 },
219 },
220 [5] = {
221 .base = S3C24XX_GPIO_BASE(S3C2410_GPF0),
222 .chip = {
223 .base = S3C2410_GPF0,
224 .owner = THIS_MODULE,
225 .label = "GPIOF",
226 .ngpio = 8,
227 .direction_input = s3c24xx_gpiolib_input,
228 .direction_output = s3c24xx_gpiolib_output,
229 .set = s3c24xx_gpiolib_set,
230 .get = s3c24xx_gpiolib_get,
231 },
232 },
233 [6] = {
234 .base = S3C24XX_GPIO_BASE(S3C2410_GPG0),
235 .chip = {
236 .base = S3C2410_GPG0,
237 .owner = THIS_MODULE,
238 .label = "GPIOG",
239 .ngpio = 10,
240 .direction_input = s3c24xx_gpiolib_input,
241 .direction_output = s3c24xx_gpiolib_output,
242 .set = s3c24xx_gpiolib_set,
243 .get = s3c24xx_gpiolib_get,
244 },
245 },
246};
247
248static __init int s3c24xx_gpiolib_init(void)
249{
250 struct s3c24xx_gpio_chip *chip = gpios;
251 int gpn;
252
253 for (gpn = 0; gpn < ARRAY_SIZE(gpios); gpn++, chip++)
254 gpiochip_add(&chip->chip);
255
256 return 0;
257}
258
259arch_initcall(s3c24xx_gpiolib_init);
diff --git a/arch/arm/plat-s3c24xx/pwm-clock.c b/arch/arm/plat-s3c24xx/pwm-clock.c
new file mode 100644
index 000000000000..2cda3e3c6786
--- /dev/null
+++ b/arch/arm/plat-s3c24xx/pwm-clock.c
@@ -0,0 +1,437 @@
1/* linux/arch/arm/plat-s3c24xx/pwm-clock.c
2 *
3 * Copyright (c) 2007 Simtec Electronics
4 * Copyright (c) 2007, 2008 Ben Dooks
5 * Ben Dooks <ben-linux@fluff.org>
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.
10*/
11
12#include <linux/init.h>
13#include <linux/module.h>
14#include <linux/kernel.h>
15#include <linux/list.h>
16#include <linux/errno.h>
17#include <linux/clk.h>
18#include <linux/err.h>
19#include <linux/io.h>
20
21#include <asm/hardware.h>
22#include <asm/irq.h>
23
24#include <asm/arch/regs-clock.h>
25#include <asm/arch/regs-gpio.h>
26
27#include <asm/plat-s3c24xx/clock.h>
28#include <asm/plat-s3c24xx/cpu.h>
29
30#include <asm/plat-s3c/regs-timer.h>
31
32/* Each of the timers 0 through 5 go through the following
33 * clock tree, with the inputs depending on the timers.
34 *
35 * pclk ---- [ prescaler 0 ] -+---> timer 0
36 * +---> timer 1
37 *
38 * pclk ---- [ prescaler 1 ] -+---> timer 2
39 * +---> timer 3
40 * \---> timer 4
41 *
42 * Which are fed into the timers as so:
43 *
44 * prescaled 0 ---- [ div 2,4,8,16 ] ---\
45 * [mux] -> timer 0
46 * tclk 0 ------------------------------/
47 *
48 * prescaled 0 ---- [ div 2,4,8,16 ] ---\
49 * [mux] -> timer 1
50 * tclk 0 ------------------------------/
51 *
52 *
53 * prescaled 1 ---- [ div 2,4,8,16 ] ---\
54 * [mux] -> timer 2
55 * tclk 1 ------------------------------/
56 *
57 * prescaled 1 ---- [ div 2,4,8,16 ] ---\
58 * [mux] -> timer 3
59 * tclk 1 ------------------------------/
60 *
61 * prescaled 1 ---- [ div 2,4,8, 16 ] --\
62 * [mux] -> timer 4
63 * tclk 1 ------------------------------/
64 *
65 * Since the mux and the divider are tied together in the
66 * same register space, it is impossible to set the parent
67 * and the rate at the same time. To avoid this, we add an
68 * intermediate 'prescaled-and-divided' clock to select
69 * as the parent for the timer input clock called tdiv.
70 *
71 * prescaled clk --> pwm-tdiv ---\
72 * [ mux ] --> timer X
73 * tclk -------------------------/
74*/
75
76static unsigned long clk_pwm_scaler_getrate(struct clk *clk)
77{
78 unsigned long tcfg0 = __raw_readl(S3C2410_TCFG0);
79
80 if (clk->id == 1) {
81 tcfg0 &= S3C2410_TCFG_PRESCALER1_MASK;
82 tcfg0 >>= S3C2410_TCFG_PRESCALER1_SHIFT;
83 } else {
84 tcfg0 &= S3C2410_TCFG_PRESCALER0_MASK;
85 }
86
87 return clk_get_rate(clk->parent) / (tcfg0 + 1);
88}
89
90/* TODO - add set rate calls. */
91
92struct clk clk_timer_scaler[] = {
93 [0] = {
94 .name = "pwm-scaler0",
95 .id = -1,
96 .get_rate = clk_pwm_scaler_getrate,
97 },
98 [1] = {
99 .name = "pwm-scaler1",
100 .id = -1,
101 .get_rate = clk_pwm_scaler_getrate,
102 },
103};
104
105struct clk clk_timer_tclk[] = {
106 [0] = {
107 .name = "pwm-tclk0",
108 .id = -1,
109 },
110 [1] = {
111 .name = "pwm-tclk1",
112 .id = -1,
113 },
114};
115
116struct pwm_tdiv_clk {
117 struct clk clk;
118 unsigned int divisor;
119};
120
121static inline struct pwm_tdiv_clk *to_tdiv(struct clk *clk)
122{
123 return container_of(clk, struct pwm_tdiv_clk, clk);
124}
125
126static inline unsigned long tcfg_to_divisor(unsigned long tcfg1)
127{
128 return 1 << (1 + tcfg1);
129}
130
131static unsigned long clk_pwm_tdiv_get_rate(struct clk *clk)
132{
133 unsigned long tcfg1 = __raw_readl(S3C2410_TCFG1);
134 unsigned int divisor;
135
136 tcfg1 >>= S3C2410_TCFG1_SHIFT(clk->id);
137 tcfg1 &= S3C2410_TCFG1_MUX_MASK;
138
139 if (tcfg1 == S3C2410_TCFG1_MUX_TCLK)
140 divisor = to_tdiv(clk)->divisor;
141 else
142 divisor = tcfg_to_divisor(tcfg1);
143
144 return clk_get_rate(clk->parent) / divisor;
145}
146
147static unsigned long clk_pwm_tdiv_round_rate(struct clk *clk,
148 unsigned long rate)
149{
150 unsigned long parent_rate;
151 unsigned long divisor;
152
153 parent_rate = clk_get_rate(clk->parent);
154 divisor = parent_rate / rate;
155
156 if (divisor <= 2)
157 divisor = 2;
158 else if (divisor <= 4)
159 divisor = 4;
160 else if (divisor <= 8)
161 divisor = 8;
162 else
163 divisor = 16;
164
165 return parent_rate / divisor;
166}
167
168static unsigned long clk_pwm_tdiv_bits(struct pwm_tdiv_clk *divclk)
169{
170 unsigned long bits;
171
172 switch (divclk->divisor) {
173 case 2:
174 bits = S3C2410_TCFG1_MUX_DIV2;
175 break;
176 case 4:
177 bits = S3C2410_TCFG1_MUX_DIV4;
178 break;
179 case 8:
180 bits = S3C2410_TCFG1_MUX_DIV8;
181 break;
182 case 16:
183 default:
184 bits = S3C2410_TCFG1_MUX_DIV16;
185 break;
186 }
187
188 return bits;
189}
190
191static void clk_pwm_tdiv_update(struct pwm_tdiv_clk *divclk)
192{
193 unsigned long tcfg1 = __raw_readl(S3C2410_TCFG1);
194 unsigned long bits = clk_pwm_tdiv_bits(divclk);
195 unsigned long flags;
196 unsigned long shift = S3C2410_TCFG1_SHIFT(divclk->clk.id);
197
198 local_irq_save(flags);
199
200 tcfg1 = __raw_readl(S3C2410_TCFG1);
201 tcfg1 &= ~(S3C2410_TCFG1_MUX_MASK << shift);
202 tcfg1 |= bits << shift;
203 __raw_writel(tcfg1, S3C2410_TCFG1);
204
205 local_irq_restore(flags);
206}
207
208static int clk_pwm_tdiv_set_rate(struct clk *clk, unsigned long rate)
209{
210 struct pwm_tdiv_clk *divclk = to_tdiv(clk);
211 unsigned long tcfg1 = __raw_readl(S3C2410_TCFG1);
212 unsigned long parent_rate = clk_get_rate(clk->parent);
213 unsigned long divisor;
214
215 tcfg1 >>= S3C2410_TCFG1_SHIFT(clk->id);
216 tcfg1 &= S3C2410_TCFG1_MUX_MASK;
217
218 rate = clk_round_rate(clk, rate);
219 divisor = parent_rate / rate;
220
221 if (divisor > 16)
222 return -EINVAL;
223
224 divclk->divisor = divisor;
225
226 /* Update the current MUX settings if we are currently
227 * selected as the clock source for this clock. */
228
229 if (tcfg1 != S3C2410_TCFG1_MUX_TCLK)
230 clk_pwm_tdiv_update(divclk);
231
232 return 0;
233}
234
235struct pwm_tdiv_clk clk_timer_tdiv[] = {
236 [0] = {
237 .clk = {
238 .name = "pwm-tdiv",
239 .parent = &clk_timer_scaler[0],
240 .get_rate = clk_pwm_tdiv_get_rate,
241 .set_rate = clk_pwm_tdiv_set_rate,
242 .round_rate = clk_pwm_tdiv_round_rate,
243 },
244 },
245 [1] = {
246 .clk = {
247 .name = "pwm-tdiv",
248 .parent = &clk_timer_scaler[0],
249 .get_rate = clk_pwm_tdiv_get_rate,
250 .set_rate = clk_pwm_tdiv_set_rate,
251 .round_rate = clk_pwm_tdiv_round_rate,
252 }
253 },
254 [2] = {
255 .clk = {
256 .name = "pwm-tdiv",
257 .parent = &clk_timer_scaler[1],
258 .get_rate = clk_pwm_tdiv_get_rate,
259 .set_rate = clk_pwm_tdiv_set_rate,
260 .round_rate = clk_pwm_tdiv_round_rate,
261 },
262 },
263 [3] = {
264 .clk = {
265 .name = "pwm-tdiv",
266 .parent = &clk_timer_scaler[1],
267 .get_rate = clk_pwm_tdiv_get_rate,
268 .set_rate = clk_pwm_tdiv_set_rate,
269 .round_rate = clk_pwm_tdiv_round_rate,
270 },
271 },
272 [4] = {
273 .clk = {
274 .name = "pwm-tdiv",
275 .parent = &clk_timer_scaler[1],
276 .get_rate = clk_pwm_tdiv_get_rate,
277 .set_rate = clk_pwm_tdiv_set_rate,
278 .round_rate = clk_pwm_tdiv_round_rate,
279 },
280 },
281};
282
283static int __init clk_pwm_tdiv_register(unsigned int id)
284{
285 struct pwm_tdiv_clk *divclk = &clk_timer_tdiv[id];
286 unsigned long tcfg1 = __raw_readl(S3C2410_TCFG1);
287
288 tcfg1 >>= S3C2410_TCFG1_SHIFT(id);
289 tcfg1 &= S3C2410_TCFG1_MUX_MASK;
290
291 divclk->clk.id = id;
292 divclk->divisor = tcfg_to_divisor(tcfg1);
293
294 return s3c24xx_register_clock(&divclk->clk);
295}
296
297static inline struct clk *s3c24xx_pwmclk_tclk(unsigned int id)
298{
299 return (id >= 2) ? &clk_timer_tclk[1] : &clk_timer_tclk[0];
300}
301
302static inline struct clk *s3c24xx_pwmclk_tdiv(unsigned int id)
303{
304 return &clk_timer_tdiv[id].clk;
305}
306
307static int clk_pwm_tin_set_parent(struct clk *clk, struct clk *parent)
308{
309 unsigned int id = clk->id;
310 unsigned long tcfg1;
311 unsigned long flags;
312 unsigned long bits;
313 unsigned long shift = S3C2410_TCFG1_SHIFT(id);
314
315 if (parent == s3c24xx_pwmclk_tclk(id))
316 bits = S3C2410_TCFG1_MUX_TCLK << shift;
317 else if (parent == s3c24xx_pwmclk_tdiv(id))
318 bits = clk_pwm_tdiv_bits(to_tdiv(clk)) << shift;
319 else
320 return -EINVAL;
321
322 clk->parent = parent;
323
324 local_irq_save(flags);
325
326 tcfg1 = __raw_readl(S3C2410_TCFG1);
327 tcfg1 &= ~(S3C2410_TCFG1_MUX_MASK << shift);
328 __raw_writel(tcfg1 | bits, S3C2410_TCFG1);
329
330 local_irq_restore(flags);
331
332 return 0;
333}
334
335static struct clk clk_tin[] = {
336 [0] = {
337 .name = "pwm-tin",
338 .id = 0,
339 .set_parent = clk_pwm_tin_set_parent,
340 },
341 [1] = {
342 .name = "pwm-tin",
343 .id = 1,
344 .set_parent = clk_pwm_tin_set_parent,
345 },
346 [2] = {
347 .name = "pwm-tin",
348 .id = 2,
349 .set_parent = clk_pwm_tin_set_parent,
350 },
351 [3] = {
352 .name = "pwm-tin",
353 .id = 3,
354 .set_parent = clk_pwm_tin_set_parent,
355 },
356 [4] = {
357 .name = "pwm-tin",
358 .id = 4,
359 .set_parent = clk_pwm_tin_set_parent,
360 },
361};
362
363static __init int clk_pwm_tin_register(struct clk *pwm)
364{
365 unsigned long tcfg1 = __raw_readl(S3C2410_TCFG1);
366 unsigned int id = pwm->id;
367
368 struct clk *parent;
369 int ret;
370
371 ret = s3c24xx_register_clock(pwm);
372 if (ret < 0)
373 return ret;
374
375 tcfg1 >>= S3C2410_TCFG1_SHIFT(id);
376 tcfg1 &= S3C2410_TCFG1_MUX_MASK;
377
378 if (tcfg1 == S3C2410_TCFG1_MUX_TCLK)
379 parent = s3c24xx_pwmclk_tclk(id);
380 else
381 parent = s3c24xx_pwmclk_tdiv(id);
382
383 return clk_set_parent(pwm, parent);
384}
385
386static __init int s3c24xx_pwmclk_init(void)
387{
388 struct clk *clk_timers;
389 unsigned int clk;
390 int ret;
391
392 clk_timers = clk_get(NULL, "timers");
393 if (IS_ERR(clk_timers)) {
394 printk(KERN_ERR "%s: no parent clock\n", __func__);
395 return -EINVAL;
396 }
397
398 for (clk = 0; clk < ARRAY_SIZE(clk_timer_scaler); clk++) {
399 clk_timer_scaler[clk].parent = clk_timers;
400 ret = s3c24xx_register_clock(&clk_timer_scaler[clk]);
401 if (ret < 0) {
402 printk(KERN_ERR "error adding pwm scaler%d clock\n", clk);
403 goto err;
404 }
405 }
406
407 for (clk = 0; clk < ARRAY_SIZE(clk_timer_tclk); clk++) {
408 ret = s3c24xx_register_clock(&clk_timer_tclk[clk]);
409 if (ret < 0) {
410 printk(KERN_ERR "error adding pww tclk%d\n", clk);
411 goto err;
412 }
413 }
414
415 for (clk = 0; clk < ARRAY_SIZE(clk_timer_tdiv); clk++) {
416 ret = clk_pwm_tdiv_register(clk);
417 if (ret < 0) {
418 printk(KERN_ERR "error adding pwm%d tdiv clock\n", clk);
419 goto err;
420 }
421 }
422
423 for (clk = 0; clk < ARRAY_SIZE(clk_tin); clk++) {
424 ret = clk_pwm_tin_register(&clk_tin[clk]);
425 if (ret < 0) {
426 printk(KERN_ERR "error adding pwm%d tin clock\n", clk);
427 goto err;
428 }
429 }
430
431 return 0;
432
433 err:
434 return ret;
435}
436
437arch_initcall(s3c24xx_pwmclk_init);
diff --git a/arch/arm/plat-s3c24xx/pwm.c b/arch/arm/plat-s3c24xx/pwm.c
new file mode 100644
index 000000000000..18c4bdc49a05
--- /dev/null
+++ b/arch/arm/plat-s3c24xx/pwm.c
@@ -0,0 +1,402 @@
1/* arch/arm/plat-s3c24xx/pwm.c
2 *
3 * Copyright (c) 2007 Ben Dooks
4 * Copyright (c) 2008 Simtec Electronics
5 * Ben Dooks <ben@simtec.co.uk>, <ben-linux@fluff.org>
6 *
7 * S3C24XX PWM device core
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License.
12*/
13
14#include <linux/module.h>
15#include <linux/kernel.h>
16#include <linux/platform_device.h>
17#include <linux/err.h>
18#include <linux/clk.h>
19#include <linux/io.h>
20#include <linux/pwm.h>
21
22#include <asm/plat-s3c/regs-timer.h>
23
24struct pwm_device {
25 struct list_head list;
26 struct platform_device *pdev;
27
28 struct clk *clk_div;
29 struct clk *clk;
30 const char *label;
31
32 unsigned int period_ns;
33 unsigned int duty_ns;
34
35 unsigned char tcon_base;
36 unsigned char running;
37 unsigned char use_count;
38 unsigned char pwm_id;
39};
40
41#define pwm_dbg(_pwm, msg...) dev_info(&(_pwm)->pdev->dev, msg)
42
43static struct clk *clk_scaler[2];
44
45/* Standard setup for a timer block. */
46
47#define TIMER_RESOURCE_SIZE (1)
48
49#define TIMER_RESOURCE(_tmr, _irq) \
50 (struct resource [TIMER_RESOURCE_SIZE]) { \
51 [0] = { \
52 .start = _irq, \
53 .end = _irq, \
54 .flags = IORESOURCE_IRQ \
55 } \
56 }
57
58#define DEFINE_TIMER(_tmr_no, _irq) \
59 .name = "s3c24xx-pwm", \
60 .id = _tmr_no, \
61 .num_resources = TIMER_RESOURCE_SIZE, \
62 .resource = TIMER_RESOURCE(_tmr_no, _irq), \
63
64/* since we already have an static mapping for the timer, we do not
65 * bother setting any IO resource for the base.
66 */
67
68struct platform_device s3c_device_timer[] = {
69 [0] = { DEFINE_TIMER(0, IRQ_TIMER0) },
70 [1] = { DEFINE_TIMER(1, IRQ_TIMER1) },
71 [2] = { DEFINE_TIMER(2, IRQ_TIMER2) },
72 [3] = { DEFINE_TIMER(3, IRQ_TIMER3) },
73 [4] = { DEFINE_TIMER(4, IRQ_TIMER4) },
74};
75
76static inline int pwm_is_tdiv(struct pwm_device *pwm)
77{
78 return clk_get_parent(pwm->clk) == pwm->clk_div;
79}
80
81static DEFINE_MUTEX(pwm_lock);
82static LIST_HEAD(pwm_list);
83
84struct pwm_device *pwm_request(int pwm_id, const char *label)
85{
86 struct pwm_device *pwm;
87 int found = 0;
88
89 mutex_lock(&pwm_lock);
90
91 list_for_each_entry(pwm, &pwm_list, list) {
92 if (pwm->pwm_id == pwm_id) {
93 found = 1;
94 break;
95 }
96 }
97
98 if (found) {
99 if (pwm->use_count == 0) {
100 pwm->use_count = 1;
101 pwm->label = label;
102 } else
103 pwm = ERR_PTR(-EBUSY);
104 } else
105 pwm = ERR_PTR(-ENOENT);
106
107 mutex_unlock(&pwm_lock);
108 return pwm;
109}
110
111EXPORT_SYMBOL(pwm_request);
112
113
114void pwm_free(struct pwm_device *pwm)
115{
116 mutex_lock(&pwm_lock);
117
118 if (pwm->use_count) {
119 pwm->use_count--;
120 pwm->label = NULL;
121 } else
122 printk(KERN_ERR "PWM%d device already freed\n", pwm->pwm_id);
123
124 mutex_unlock(&pwm_lock);
125}
126
127EXPORT_SYMBOL(pwm_free);
128
129#define pwm_tcon_start(pwm) (1 << (pwm->tcon_base + 0))
130#define pwm_tcon_invert(pwm) (1 << (pwm->tcon_base + 2))
131#define pwm_tcon_autoreload(pwm) (1 << (pwm->tcon_base + 3))
132#define pwm_tcon_manulupdate(pwm) (1 << (pwm->tcon_base + 1))
133
134int pwm_enable(struct pwm_device *pwm)
135{
136 unsigned long flags;
137 unsigned long tcon;
138
139 local_irq_save(flags);
140
141 tcon = __raw_readl(S3C2410_TCON);
142 tcon |= pwm_tcon_start(pwm);
143 __raw_writel(tcon, S3C2410_TCON);
144
145 local_irq_restore(flags);
146
147 pwm->running = 1;
148 return 0;
149}
150
151EXPORT_SYMBOL(pwm_enable);
152
153void pwm_disable(struct pwm_device *pwm)
154{
155 unsigned long flags;
156 unsigned long tcon;
157
158 local_irq_save(flags);
159
160 tcon = __raw_readl(S3C2410_TCON);
161 tcon &= ~pwm_tcon_start(pwm);
162 __raw_writel(tcon, S3C2410_TCON);
163
164 local_irq_restore(flags);
165
166 pwm->running = 0;
167}
168
169EXPORT_SYMBOL(pwm_disable);
170
171unsigned long pwm_calc_tin(struct pwm_device *pwm, unsigned long freq)
172{
173 unsigned long tin_parent_rate;
174 unsigned int div;
175
176 tin_parent_rate = clk_get_rate(clk_get_parent(pwm->clk_div));
177 pwm_dbg(pwm, "tin parent at %lu\n", tin_parent_rate);
178
179 for (div = 2; div <= 16; div *= 2) {
180 if ((tin_parent_rate / (div << 16)) < freq)
181 return tin_parent_rate / div;
182 }
183
184 return tin_parent_rate / 16;
185}
186
187#define NS_IN_HZ (1000000000UL)
188
189int pwm_config(struct pwm_device *pwm, int duty_ns, int period_ns)
190{
191 unsigned long tin_rate;
192 unsigned long tin_ns;
193 unsigned long period;
194 unsigned long flags;
195 unsigned long tcon;
196 unsigned long tcnt;
197 long tcmp;
198
199 /* We currently avoid using 64bit arithmetic by using the
200 * fact that anything faster than 1Hz is easily representable
201 * by 32bits. */
202
203 if (period_ns > NS_IN_HZ || duty_ns > NS_IN_HZ)
204 return -ERANGE;
205
206 if (duty_ns > period_ns)
207 return -EINVAL;
208
209 if (period_ns == pwm->period_ns &&
210 duty_ns == pwm->duty_ns)
211 return 0;
212
213 /* The TCMP and TCNT can be read without a lock, they're not
214 * shared between the timers. */
215
216 tcmp = __raw_readl(S3C2410_TCMPB(pwm->pwm_id));
217 tcnt = __raw_readl(S3C2410_TCNTB(pwm->pwm_id));
218
219 period = NS_IN_HZ / period_ns;
220
221 pwm_dbg(pwm, "duty_ns=%d, period_ns=%d (%lu)\n",
222 duty_ns, period_ns, period);
223
224 /* Check to see if we are changing the clock rate of the PWM */
225
226 if (pwm->period_ns != period_ns) {
227 if (pwm_is_tdiv(pwm)) {
228 tin_rate = pwm_calc_tin(pwm, period);
229 clk_set_rate(pwm->clk_div, tin_rate);
230 } else
231 tin_rate = clk_get_rate(pwm->clk);
232
233 pwm->period_ns = period_ns;
234
235 pwm_dbg(pwm, "tin_rate=%lu\n", tin_rate);
236
237 tin_ns = NS_IN_HZ / tin_rate;
238 tcnt = period_ns / tin_ns;
239 } else
240 tin_ns = NS_IN_HZ / clk_get_rate(pwm->clk);
241
242 /* Note, counters count down */
243
244 tcmp = duty_ns / tin_ns;
245 tcmp = tcnt - tcmp;
246
247 pwm_dbg(pwm, "tin_ns=%lu, tcmp=%ld/%lu\n", tin_ns, tcmp, tcnt);
248
249 if (tcmp < 0)
250 tcmp = 0;
251
252 /* Update the PWM register block. */
253
254 local_irq_save(flags);
255
256 __raw_writel(tcmp, S3C2410_TCMPB(pwm->pwm_id));
257 __raw_writel(tcnt, S3C2410_TCNTB(pwm->pwm_id));
258
259 tcon = __raw_readl(S3C2410_TCON);
260 tcon |= pwm_tcon_manulupdate(pwm);
261 tcon |= pwm_tcon_autoreload(pwm);
262 __raw_writel(tcon, S3C2410_TCON);
263
264 tcon &= ~pwm_tcon_manulupdate(pwm);
265 __raw_writel(tcon, S3C2410_TCON);
266
267 local_irq_restore(flags);
268
269 return 0;
270}
271
272EXPORT_SYMBOL(pwm_config);
273
274static int pwm_register(struct pwm_device *pwm)
275{
276 pwm->duty_ns = -1;
277 pwm->period_ns = -1;
278
279 mutex_lock(&pwm_lock);
280 list_add_tail(&pwm->list, &pwm_list);
281 mutex_unlock(&pwm_lock);
282
283 return 0;
284}
285
286static int s3c_pwm_probe(struct platform_device *pdev)
287{
288 struct device *dev = &pdev->dev;
289 struct pwm_device *pwm;
290 unsigned long flags;
291 unsigned long tcon;
292 unsigned int id = pdev->id;
293 int ret;
294
295 if (id == 4) {
296 dev_err(dev, "TIMER4 is currently not supported\n");
297 return -ENXIO;
298 }
299
300 pwm = kzalloc(sizeof(struct pwm_device), GFP_KERNEL);
301 if (pwm == NULL) {
302 dev_err(dev, "failed to allocate pwm_device\n");
303 return -ENOMEM;
304 }
305
306 pwm->pdev = pdev;
307 pwm->pwm_id = id;
308
309 /* calculate base of control bits in TCON */
310 pwm->tcon_base = id == 0 ? 0 : (id * 4) + 4;
311
312 pwm->clk = clk_get(dev, "pwm-tin");
313 if (IS_ERR(pwm->clk)) {
314 dev_err(dev, "failed to get pwm tin clk\n");
315 ret = PTR_ERR(pwm->clk);
316 goto err_alloc;
317 }
318
319 pwm->clk_div = clk_get(dev, "pwm-tdiv");
320 if (IS_ERR(pwm->clk_div)) {
321 dev_err(dev, "failed to get pwm tdiv clk\n");
322 ret = PTR_ERR(pwm->clk_div);
323 goto err_clk_tin;
324 }
325
326 local_irq_save(flags);
327
328 tcon = __raw_readl(S3C2410_TCON);
329 tcon |= pwm_tcon_invert(pwm);
330 __raw_writel(tcon, S3C2410_TCON);
331
332 local_irq_restore(flags);
333
334
335 ret = pwm_register(pwm);
336 if (ret) {
337 dev_err(dev, "failed to register pwm\n");
338 goto err_clk_tdiv;
339 }
340
341 pwm_dbg(pwm, "config bits %02x\n",
342 (__raw_readl(S3C2410_TCON) >> pwm->tcon_base) & 0x0f);
343
344 dev_info(dev, "tin at %lu, tdiv at %lu, tin=%sclk, base %d\n",
345 clk_get_rate(pwm->clk),
346 clk_get_rate(pwm->clk_div),
347 pwm_is_tdiv(pwm) ? "div" : "ext", pwm->tcon_base);
348
349 platform_set_drvdata(pdev, pwm);
350 return 0;
351
352 err_clk_tdiv:
353 clk_put(pwm->clk_div);
354
355 err_clk_tin:
356 clk_put(pwm->clk);
357
358 err_alloc:
359 kfree(pwm);
360 return ret;
361}
362
363static int s3c_pwm_remove(struct platform_device *pdev)
364{
365 struct pwm_device *pwm = platform_get_drvdata(pdev);
366
367 clk_put(pwm->clk_div);
368 clk_put(pwm->clk);
369 kfree(pwm);
370
371 return 0;
372}
373
374static struct platform_driver s3c_pwm_driver = {
375 .driver = {
376 .name = "s3c24xx-pwm",
377 .owner = THIS_MODULE,
378 },
379 .probe = s3c_pwm_probe,
380 .remove = __devexit_p(s3c_pwm_remove),
381};
382
383static int __init pwm_init(void)
384{
385 int ret;
386
387 clk_scaler[0] = clk_get(NULL, "pwm-scaler0");
388 clk_scaler[1] = clk_get(NULL, "pwm-scaler1");
389
390 if (IS_ERR(clk_scaler[0]) || IS_ERR(clk_scaler[1])) {
391 printk(KERN_ERR "%s: failed to get scaler clocks\n", __func__);
392 return -EINVAL;
393 }
394
395 ret = platform_driver_register(&s3c_pwm_driver);
396 if (ret)
397 printk(KERN_ERR "%s: failed to add pwm driver\n", __func__);
398
399 return ret;
400}
401
402arch_initcall(pwm_init);
diff --git a/arch/arm/tools/mach-types b/arch/arm/tools/mach-types
index 207a8b5a0c4a..0be5630ff568 100644
--- a/arch/arm/tools/mach-types
+++ b/arch/arm/tools/mach-types
@@ -12,7 +12,7 @@
12# 12#
13# http://www.arm.linux.org.uk/developer/machines/?action=new 13# http://www.arm.linux.org.uk/developer/machines/?action=new
14# 14#
15# Last update: Sat Apr 19 11:23:38 2008 15# Last update: Mon Jul 7 16:25:39 2008
16# 16#
17# machine_is_xxx CONFIG_xxxx MACH_TYPE_xxx number 17# machine_is_xxx CONFIG_xxxx MACH_TYPE_xxx number
18# 18#
@@ -560,7 +560,6 @@ husky MACH_HUSKY HUSKY 543
560boxer MACH_BOXER BOXER 544 560boxer MACH_BOXER BOXER 544
561shepherd MACH_SHEPHERD SHEPHERD 545 561shepherd MACH_SHEPHERD SHEPHERD 545
562aml42800aa MACH_AML42800AA AML42800AA 546 562aml42800aa MACH_AML42800AA AML42800AA 546
563ml674001 MACH_MACH_TYPE_ML674001 MACH_TYPE_ML674001 547
564lpc2294 MACH_LPC2294 LPC2294 548 563lpc2294 MACH_LPC2294 LPC2294 548
565switchgrass MACH_SWITCHGRASS SWITCHGRASS 549 564switchgrass MACH_SWITCHGRASS SWITCHGRASS 549
566ens_cmu MACH_ENS_CMU ENS_CMU 550 565ens_cmu MACH_ENS_CMU ENS_CMU 550
@@ -748,7 +747,6 @@ anubis MACH_ANUBIS ANUBIS 734
748ite8152 MACH_ITE8152 ITE8152 735 747ite8152 MACH_ITE8152 ITE8152 735
749lpc3xxx MACH_LPC3XXX LPC3XXX 736 748lpc3xxx MACH_LPC3XXX LPC3XXX 736
750puppeteer MACH_PUPPETEER PUPPETEER 737 749puppeteer MACH_PUPPETEER PUPPETEER 737
751vt001 MACH_MACH_VADATECH MACH_VADATECH 738
752e570 MACH_E570 E570 739 750e570 MACH_E570 E570 739
753x50 MACH_X50 X50 740 751x50 MACH_X50 X50 740
754recon MACH_RECON RECON 741 752recon MACH_RECON RECON 741
@@ -839,7 +837,7 @@ ccxp270 MACH_CCXP CCXP 825
839omap_gsample MACH_OMAP_GSAMPLE OMAP_GSAMPLE 826 837omap_gsample MACH_OMAP_GSAMPLE OMAP_GSAMPLE 826
840realview_eb MACH_REALVIEW_EB REALVIEW_EB 827 838realview_eb MACH_REALVIEW_EB REALVIEW_EB 827
841samoa MACH_SAMOA SAMOA 828 839samoa MACH_SAMOA SAMOA 828
842t3xscale MACH_T3XSCALE T3XSCALE 829 840palmt3 MACH_PALMT3 PALMT3 829
843i878 MACH_I878 I878 830 841i878 MACH_I878 I878 830
844borzoi MACH_BORZOI BORZOI 831 842borzoi MACH_BORZOI BORZOI 831
845gecko MACH_GECKO GECKO 832 843gecko MACH_GECKO GECKO 832
@@ -895,7 +893,7 @@ mio8390 MACH_MIO8390 MIO8390 881
895omi_board MACH_OMI_BOARD OMI_BOARD 882 893omi_board MACH_OMI_BOARD OMI_BOARD 882
896mx21civ MACH_MX21CIV MX21CIV 883 894mx21civ MACH_MX21CIV MX21CIV 883
897mahi_cdac MACH_MAHI_CDAC MAHI_CDAC 884 895mahi_cdac MACH_MAHI_CDAC MAHI_CDAC 884
898xscale_palmtx MACH_XSCALE_PALMTX XSCALE_PALMTX 885 896palmtx MACH_PALMTX PALMTX 885
899s3c2413 MACH_S3C2413 S3C2413 887 897s3c2413 MACH_S3C2413 S3C2413 887
900samsys_ep0 MACH_SAMSYS_EP0 SAMSYS_EP0 888 898samsys_ep0 MACH_SAMSYS_EP0 SAMSYS_EP0 888
901wg302v1 MACH_WG302V1 WG302V1 889 899wg302v1 MACH_WG302V1 WG302V1 889
@@ -918,7 +916,7 @@ nxdb500 MACH_NXDB500 NXDB500 905
918apf9328 MACH_APF9328 APF9328 906 916apf9328 MACH_APF9328 APF9328 906
919omap_wipoq MACH_OMAP_WIPOQ OMAP_WIPOQ 907 917omap_wipoq MACH_OMAP_WIPOQ OMAP_WIPOQ 907
920omap_twip MACH_OMAP_TWIP OMAP_TWIP 908 918omap_twip MACH_OMAP_TWIP OMAP_TWIP 908
921xscale_treo650 MACH_XSCALE_PALMTREO650 XSCALE_PALMTREO650 909 919palmtreo650 MACH_PALMTREO650 PALMTREO650 909
922acumen MACH_ACUMEN ACUMEN 910 920acumen MACH_ACUMEN ACUMEN 910
923xp100 MACH_XP100 XP100 911 921xp100 MACH_XP100 XP100 911
924fs2410 MACH_FS2410 FS2410 912 922fs2410 MACH_FS2410 FS2410 912
@@ -926,8 +924,8 @@ pxa270_cerf MACH_PXA270_CERF PXA270_CERF 913
926sq2ftlpalm MACH_SQ2FTLPALM SQ2FTLPALM 914 924sq2ftlpalm MACH_SQ2FTLPALM SQ2FTLPALM 914
927bsemserver MACH_BSEMSERVER BSEMSERVER 915 925bsemserver MACH_BSEMSERVER BSEMSERVER 915
928netclient MACH_NETCLIENT NETCLIENT 916 926netclient MACH_NETCLIENT NETCLIENT 916
929xscale_palmtt5 MACH_XSCALE_PALMTT5 XSCALE_PALMTT5 917 927palmt5 MACH_PALMT5 PALMT5 917
930xscale_palmtc MACH_OMAP_PALMTC OMAP_PALMTC 918 928palmtc MACH_PALMTC PALMTC 918
931omap_apollon MACH_OMAP_APOLLON OMAP_APOLLON 919 929omap_apollon MACH_OMAP_APOLLON OMAP_APOLLON 919
932mxc30030evb MACH_MXC30030EVB MXC30030EVB 920 930mxc30030evb MACH_MXC30030EVB MXC30030EVB 920
933rea_2d MACH_REA_2D REA_2D 921 931rea_2d MACH_REA_2D REA_2D 921
@@ -1220,7 +1218,6 @@ empca400 MACH_EMPCA400 EMPCA400 1211
1220em7210 MACH_EM7210 EM7210 1212 1218em7210 MACH_EM7210 EM7210 1212
1221htchermes MACH_HTCHERMES HTCHERMES 1213 1219htchermes MACH_HTCHERMES HTCHERMES 1213
1222eti_c1 MACH_ETI_C1 ETI_C1 1214 1220eti_c1 MACH_ETI_C1 ETI_C1 1214
1223mach_dep2410 MACH_MACH_DEP2410 MACH_DEP2410 1215
1224ac100 MACH_AC100 AC100 1216 1221ac100 MACH_AC100 AC100 1216
1225sneetch MACH_SNEETCH SNEETCH 1217 1222sneetch MACH_SNEETCH SNEETCH 1217
1226studentmate MACH_STUDENTMATE STUDENTMATE 1218 1223studentmate MACH_STUDENTMATE STUDENTMATE 1218
@@ -1421,10 +1418,10 @@ looxc550 MACH_LOOXC550 LOOXC550 1417
1421cnty_titan MACH_CNTY_TITAN CNTY_TITAN 1418 1418cnty_titan MACH_CNTY_TITAN CNTY_TITAN 1418
1422app3xx MACH_APP3XX APP3XX 1419 1419app3xx MACH_APP3XX APP3XX 1419
1423sideoatsgrama MACH_SIDEOATSGRAMA SIDEOATSGRAMA 1420 1420sideoatsgrama MACH_SIDEOATSGRAMA SIDEOATSGRAMA 1420
1424xscale_palmt700p MACH_XSCALE_PALMT700P XSCALE_PALMT700P 1421 1421palmtreo700p MACH_PALMTREO700P PALMTREO700P 1421
1425xscale_palmt700w MACH_XSCALE_PALMT700W XSCALE_PALMT700W 1422 1422palmtreo700w MACH_PALMTREO700W PALMTREO700W 1422
1426xscale_palmt750 MACH_XSCALE_PALMT750 XSCALE_PALMT750 1423 1423palmtreo750 MACH_PALMTREO750 PALMTREO750 1423
1427xscale_palmt755p MACH_XSCALE_PALMT755P XSCALE_PALMT755P 1424 1424palmtreo755p MACH_PALMTREO755P PALMTREO755P 1424
1428ezreganut9200 MACH_EZREGANUT9200 EZREGANUT9200 1425 1425ezreganut9200 MACH_EZREGANUT9200 EZREGANUT9200 1425
1429sarge MACH_SARGE SARGE 1426 1426sarge MACH_SARGE SARGE 1426
1430a696 MACH_A696 A696 1427 1427a696 MACH_A696 A696 1427
@@ -1463,7 +1460,7 @@ artemis MACH_ARTEMIS ARTEMIS 1462
1463htctitan MACH_HTCTITAN HTCTITAN 1463 1460htctitan MACH_HTCTITAN HTCTITAN 1463
1464qranium MACH_QRANIUM QRANIUM 1464 1461qranium MACH_QRANIUM QRANIUM 1464
1465adx_wsc2 MACH_ADX_WSC2 ADX_WSC2 1465 1462adx_wsc2 MACH_ADX_WSC2 ADX_WSC2 1465
1466adx_medcom MACH_ADX_MEDINET ADX_MEDINET 1466 1463adx_medcom MACH_ADX_MEDCOM ADX_MEDCOM 1466
1467bboard MACH_BBOARD BBOARD 1467 1464bboard MACH_BBOARD BBOARD 1467
1468cambria MACH_CAMBRIA CAMBRIA 1468 1465cambria MACH_CAMBRIA CAMBRIA 1468
1469mt7xxx MACH_MT7XXX MT7XXX 1469 1466mt7xxx MACH_MT7XXX MT7XXX 1469
@@ -1519,7 +1516,7 @@ wp188 MACH_WP188 WP188 1518
1519corsica MACH_CORSICA CORSICA 1519 1516corsica MACH_CORSICA CORSICA 1519
1520bigeye MACH_BIGEYE BIGEYE 1520 1517bigeye MACH_BIGEYE BIGEYE 1520
1521tll5000 MACH_TLL5000 TLL5000 1522 1518tll5000 MACH_TLL5000 TLL5000 1522
1522hni270 MACH_HNI_X270 HNI_X270 1523 1519bebot MACH_BEBOT BEBOT 1523
1523qong MACH_QONG QONG 1524 1520qong MACH_QONG QONG 1524
1524tcompact MACH_TCOMPACT TCOMPACT 1525 1521tcompact MACH_TCOMPACT TCOMPACT 1525
1525puma5 MACH_PUMA5 PUMA5 1526 1522puma5 MACH_PUMA5 PUMA5 1526
@@ -1636,7 +1633,6 @@ awlug4lcu MACH_AWLUG4LCU AWLUG4LCU 1637
1636palermoc MACH_PALERMOC PALERMOC 1638 1633palermoc MACH_PALERMOC PALERMOC 1638
1637omap_ldp MACH_OMAP_LDP OMAP_LDP 1639 1634omap_ldp MACH_OMAP_LDP OMAP_LDP 1639
1638ip500 MACH_IP500 IP500 1640 1635ip500 MACH_IP500 IP500 1640
1639mx35ads MACH_MACH_MX35ADS MACH_MX35ADS 1641
1640ase2 MACH_ASE2 ASE2 1642 1636ase2 MACH_ASE2 ASE2 1642
1641mx35evb MACH_MX35EVB MX35EVB 1643 1637mx35evb MACH_MX35EVB MX35EVB 1643
1642aml_m8050 MACH_AML_M8050 AML_M8050 1644 1638aml_m8050 MACH_AML_M8050 AML_M8050 1644
@@ -1647,7 +1643,7 @@ badger MACH_BADGER BADGER 1648
1647trizeps4wl MACH_TRIZEPS4WL TRIZEPS4WL 1649 1643trizeps4wl MACH_TRIZEPS4WL TRIZEPS4WL 1649
1648trizeps5 MACH_TRIZEPS5 TRIZEPS5 1650 1644trizeps5 MACH_TRIZEPS5 TRIZEPS5 1650
1649marlin MACH_MARLIN MARLIN 1651 1645marlin MACH_MARLIN MARLIN 1651
1650ts7800 MACH_TS7800 TS7800 1652 1646ts78xx MACH_TS78XX TS78XX 1652
1651hpipaq214 MACH_HPIPAQ214 HPIPAQ214 1653 1647hpipaq214 MACH_HPIPAQ214 HPIPAQ214 1653
1652at572d940dcm MACH_AT572D940DCM AT572D940DCM 1654 1648at572d940dcm MACH_AT572D940DCM AT572D940DCM 1654
1653ne1board MACH_NE1BOARD NE1BOARD 1655 1649ne1board MACH_NE1BOARD NE1BOARD 1655
@@ -1720,3 +1716,99 @@ htc_kaiser MACH_HTC_KAISER HTC_KAISER 1724
1720lg_ks20 MACH_LG_KS20 LG_KS20 1725 1716lg_ks20 MACH_LG_KS20 LG_KS20 1725
1721hhgps MACH_HHGPS HHGPS 1726 1717hhgps MACH_HHGPS HHGPS 1726
1722nokia_n810_wimax MACH_NOKIA_N810_WIMAX NOKIA_N810_WIMAX 1727 1718nokia_n810_wimax MACH_NOKIA_N810_WIMAX NOKIA_N810_WIMAX 1727
1719insight MACH_INSIGHT INSIGHT 1728
1720sapphire MACH_SAPPHIRE SAPPHIRE 1729
1721csb637xo MACH_CSB637XO CSB637XO 1730
1722evisiong MACH_EVISIONG EVISIONG 1731
1723stmp37xx MACH_STMP37XX STMP37XX 1732
1724stmp378x MACH_STMP38XX STMP38XX 1733
1725tnt MACH_TNT TNT 1734
1726tbxt MACH_TBXT TBXT 1735
1727playmate MACH_PLAYMATE PLAYMATE 1736
1728pns10 MACH_PNS10 PNS10 1737
1729eznavi MACH_EZNAVI EZNAVI 1738
1730ps4000 MACH_PS4000 PS4000 1739
1731ezx_a780 MACH_EZX_A780 EZX_A780 1740
1732ezx_e680 MACH_EZX_E680 EZX_E680 1741
1733ezx_a1200 MACH_EZX_A1200 EZX_A1200 1742
1734ezx_e6 MACH_EZX_E6 EZX_E6 1743
1735ezx_e2 MACH_EZX_E2 EZX_E2 1744
1736ezx_a910 MACH_EZX_A910 EZX_A910 1745
1737cwmx31 MACH_CWMX31 CWMX31 1746
1738sl2312 MACH_SL2312 SL2312 1747
1739blenny MACH_BLENNY BLENNY 1748
1740ds107 MACH_DS107 DS107 1749
1741dsx07 MACH_DSX07 DSX07 1750
1742picocom1 MACH_PICOCOM1 PICOCOM1 1751
1743lynx_wolverine MACH_LYNX_WOLVERINE LYNX_WOLVERINE 1752
1744ubisys_p9_sc19 MACH_UBISYS_P9_SC19 UBISYS_P9_SC19 1753
1745kratos_low MACH_KRATOS_LOW KRATOS_LOW 1754
1746m700 MACH_M700 M700 1755
1747edmini_v2 MACH_EDMINI_V2 EDMINI_V2 1756
1748zipit2 MACH_ZIPIT2 ZIPIT2 1757
1749hslfemtocell MACH_HSLFEMTOCELL HSLFEMTOCELL 1758
1750daintree_at91 MACH_DAINTREE_AT91 DAINTREE_AT91 1759
1751sg560usb MACH_SG560USB SG560USB 1760
1752omap3_pandora MACH_OMAP3_PANDORA OMAP3_PANDORA 1761
1753usr8200 MACH_USR8200 USR8200 1762
1754s1s65k MACH_S1S65K S1S65K 1763
1755s2s65a MACH_S2S65A S2S65A 1764
1756icore MACH_ICORE ICORE 1765
1757mss2 MACH_MSS2 MSS2 1766
1758belmont MACH_BELMONT BELMONT 1767
1759asusp525 MACH_ASUSP525 ASUSP525 1768
1760lb88rc8480 MACH_LB88RC8480 LB88RC8480 1769
1761hipxa MACH_HIPXA HIPXA 1770
1762mx25_3ds MACH_MX25_3DS MX25_3DS 1771
1763m800 MACH_M800 M800 1772
1764omap3530_lv_som MACH_OMAP3530_LV_SOM OMAP3530_LV_SOM 1773
1765prima_evb MACH_PRIMA_EVB PRIMA_EVB 1774
1766mx31bt1 MACH_MX31BT1 MX31BT1 1775
1767atlas4_evb MACH_ATLAS4_EVB ATLAS4_EVB 1776
1768mx31cicada MACH_MX31CICADA MX31CICADA 1777
1769mi424wr MACH_MI424WR MI424WR 1778
1770axs_ultrax MACH_AXS_ULTRAX AXS_ULTRAX 1779
1771at572d940deb MACH_AT572D940DEB AT572D940DEB 1780
1772davinci_da8xx_evm MACH_DAVINCI_DA8XX_EVM DAVINCI_DA8XX_EVM 1781
1773ep9302 MACH_EP9302 EP9302 1782
1774at572d940hfeb MACH_AT572D940HFEB AT572D940HFEB 1783
1775cybook3 MACH_CYBOOK3 CYBOOK3 1784
1776wdg002 MACH_WDG002 WDG002 1785
1777sg560adsl MACH_SG560ADSL SG560ADSL 1786
1778nextio_n2800_ica MACH_NEXTIO_N2800_ICA NEXTIO_N2800_ICA 1787
1779marvell_newdb MACH_MARVELL_NEWDB MARVELL_NEWDB 1789
1780vandihud MACH_VANDIHUD VANDIHUD 1790
1781magx_e8 MACH_MAGX_E8 MAGX_E8 1791
1782magx_z6 MACH_MAGX_Z6 MAGX_Z6 1792
1783magx_v8 MACH_MAGX_V8 MAGX_V8 1793
1784magx_u9 MACH_MAGX_U9 MAGX_U9 1794
1785toughcf08 MACH_TOUGHCF08 TOUGHCF08 1795
1786zw4400 MACH_ZW4400 ZW4400 1796
1787marat91 MACH_MARAT91 MARAT91 1797
1788overo MACH_OVERO OVERO 1798
1789at2440evb MACH_AT2440EVB AT2440EVB 1799
1790neocore926 MACH_NEOCORE926 NEOCORE926 1800
1791wnr854t MACH_WNR854T WNR854T 1801
1792imx27 MACH_IMX27 IMX27 1802
1793moose_db MACH_MOOSE_DB MOOSE_DB 1803
1794fab4 MACH_FAB4 FAB4 1804
1795htcdiamond MACH_HTCDIAMOND HTCDIAMOND 1805
1796fiona MACH_FIONA FIONA 1806
1797mxc30030_x MACH_MXC30030_X MXC30030_X 1807
1798bmp1000 MACH_BMP1000 BMP1000 1808
1799logi9200 MACH_LOGI9200 LOGI9200 1809
1800tqma31 MACH_TQMA31 TQMA31 1810
1801ccw9p9215js MACH_CCW9P9215JS CCW9P9215JS 1811
1802rd88f5181l_ge MACH_RD88F5181L_GE RD88F5181L_GE 1812
1803sifmain MACH_SIFMAIN SIFMAIN 1813
1804sam9_l9261 MACH_SAM9_L9261 SAM9_L9261 1814
1805cc9m2443js MACH_CC9M2443JS CC9M2443JS 1815
1806xaria300 MACH_XARIA300 XARIA300 1816
1807it9200 MACH_IT9200 IT9200 1817
1808rd88f5181l_fxo MACH_RD88F5181L_FXO RD88F5181L_FXO 1818
1809kriss_sensor MACH_KRISS_SENSOR KRISS_SENSOR 1819
1810pilz_pmi5 MACH_PILZ_PMI5 PILZ_PMI5 1820
1811jade MACH_JADE JADE 1821
1812ks8695_softplc MACH_KS8695_SOFTPLC KS8695_SOFTPLC 1822
1813gprisc4 MACH_GPRISC4 GPRISC4 1823
1814stamp9260 MACH_STAMP9260 STAMP9260 1824
diff --git a/arch/blackfin/kernel/cplb-nompu/cplbinit.c b/arch/blackfin/kernel/cplb-nompu/cplbinit.c
index 917325bfbd84..6be0c50122e8 100644
--- a/arch/blackfin/kernel/cplb-nompu/cplbinit.c
+++ b/arch/blackfin/kernel/cplb-nompu/cplbinit.c
@@ -254,7 +254,8 @@ close_cplbtab(struct cplb_tab *table)
254} 254}
255 255
256/* helper function */ 256/* helper function */
257static void __fill_code_cplbtab(struct cplb_tab *t, int i, u32 a_start, u32 a_end) 257static void __init
258__fill_code_cplbtab(struct cplb_tab *t, int i, u32 a_start, u32 a_end)
258{ 259{
259 if (cplb_data[i].psize) { 260 if (cplb_data[i].psize) {
260 fill_cplbtab(t, 261 fill_cplbtab(t,
@@ -291,7 +292,8 @@ static void __fill_code_cplbtab(struct cplb_tab *t, int i, u32 a_start, u32 a_en
291 } 292 }
292} 293}
293 294
294static void __fill_data_cplbtab(struct cplb_tab *t, int i, u32 a_start, u32 a_end) 295static void __init
296__fill_data_cplbtab(struct cplb_tab *t, int i, u32 a_start, u32 a_end)
295{ 297{
296 if (cplb_data[i].psize) { 298 if (cplb_data[i].psize) {
297 fill_cplbtab(t, 299 fill_cplbtab(t,
diff --git a/arch/blackfin/kernel/irqchip.c b/arch/blackfin/kernel/irqchip.c
index 73647c158774..07402f57c9de 100644
--- a/arch/blackfin/kernel/irqchip.c
+++ b/arch/blackfin/kernel/irqchip.c
@@ -60,9 +60,14 @@ static struct irq_chip bad_chip = {
60}; 60};
61 61
62static struct irq_desc bad_irq_desc = { 62static struct irq_desc bad_irq_desc = {
63 .status = IRQ_DISABLED,
63 .chip = &bad_chip, 64 .chip = &bad_chip,
64 .handle_irq = handle_bad_irq, 65 .handle_irq = handle_bad_irq,
65 .depth = 1, 66 .depth = 1,
67 .lock = __SPIN_LOCK_UNLOCKED(irq_desc->lock),
68#ifdef CONFIG_SMP
69 .affinity = CPU_MASK_ALL
70#endif
66}; 71};
67 72
68int show_interrupts(struct seq_file *p, void *v) 73int show_interrupts(struct seq_file *p, void *v)
diff --git a/arch/ia64/kernel/iosapic.c b/arch/ia64/kernel/iosapic.c
index 082c31dcfd99..39752cdef6ff 100644
--- a/arch/ia64/kernel/iosapic.c
+++ b/arch/ia64/kernel/iosapic.c
@@ -558,8 +558,6 @@ static struct iosapic_rte_info * __init_refok iosapic_alloc_rte (void)
558 if (!iosapic_kmalloc_ok && list_empty(&free_rte_list)) { 558 if (!iosapic_kmalloc_ok && list_empty(&free_rte_list)) {
559 rte = alloc_bootmem(sizeof(struct iosapic_rte_info) * 559 rte = alloc_bootmem(sizeof(struct iosapic_rte_info) *
560 NR_PREALLOCATE_RTE_ENTRIES); 560 NR_PREALLOCATE_RTE_ENTRIES);
561 if (!rte)
562 return NULL;
563 for (i = 0; i < NR_PREALLOCATE_RTE_ENTRIES; i++, rte++) 561 for (i = 0; i < NR_PREALLOCATE_RTE_ENTRIES; i++, rte++)
564 list_add(&rte->rte_list, &free_rte_list); 562 list_add(&rte->rte_list, &free_rte_list);
565 } 563 }
diff --git a/arch/ia64/kernel/setup.c b/arch/ia64/kernel/setup.c
index f48a809c686d..632cda8f2e76 100644
--- a/arch/ia64/kernel/setup.c
+++ b/arch/ia64/kernel/setup.c
@@ -547,7 +547,8 @@ setup_arch (char **cmdline_p)
547# ifdef CONFIG_ACPI_NUMA 547# ifdef CONFIG_ACPI_NUMA
548 acpi_numa_init(); 548 acpi_numa_init();
549 per_cpu_scan_finalize((cpus_weight(early_cpu_possible_map) == 0 ? 549 per_cpu_scan_finalize((cpus_weight(early_cpu_possible_map) == 0 ?
550 32 : cpus_weight(early_cpu_possible_map)), additional_cpus); 550 32 : cpus_weight(early_cpu_possible_map)),
551 additional_cpus > 0 ? additional_cpus : 0);
551# endif 552# endif
552#else 553#else
553# ifdef CONFIG_SMP 554# ifdef CONFIG_SMP
@@ -578,8 +579,6 @@ setup_arch (char **cmdline_p)
578 cpu_init(); /* initialize the bootstrap CPU */ 579 cpu_init(); /* initialize the bootstrap CPU */
579 mmu_context_init(); /* initialize context_id bitmap */ 580 mmu_context_init(); /* initialize context_id bitmap */
580 581
581 check_sal_cache_flush();
582
583#ifdef CONFIG_ACPI 582#ifdef CONFIG_ACPI
584 acpi_boot_init(); 583 acpi_boot_init();
585#endif 584#endif
@@ -607,6 +606,7 @@ setup_arch (char **cmdline_p)
607 ia64_mca_init(); 606 ia64_mca_init();
608 607
609 platform_setup(cmdline_p); 608 platform_setup(cmdline_p);
609 check_sal_cache_flush();
610 paging_init(); 610 paging_init();
611} 611}
612 612
diff --git a/arch/ia64/kernel/time.c b/arch/ia64/kernel/time.c
index 8c73643f2d66..aad1b7b1fff9 100644
--- a/arch/ia64/kernel/time.c
+++ b/arch/ia64/kernel/time.c
@@ -117,6 +117,7 @@ void account_system_vtime(struct task_struct *tsk)
117 117
118 local_irq_restore(flags); 118 local_irq_restore(flags);
119} 119}
120EXPORT_SYMBOL_GPL(account_system_vtime);
120 121
121/* 122/*
122 * Called from the timer interrupt handler to charge accumulated user time 123 * Called from the timer interrupt handler to charge accumulated user time
diff --git a/arch/ia64/sn/kernel/sn2/sn2_smp.c b/arch/ia64/sn/kernel/sn2/sn2_smp.c
index 49d3120415eb..e585f9a2afb9 100644
--- a/arch/ia64/sn/kernel/sn2/sn2_smp.c
+++ b/arch/ia64/sn/kernel/sn2/sn2_smp.c
@@ -512,6 +512,8 @@ static ssize_t sn2_ptc_proc_write(struct file *file, const char __user *user, si
512 int cpu; 512 int cpu;
513 char optstr[64]; 513 char optstr[64];
514 514
515 if (count == 0 || count > sizeof(optstr))
516 return -EINVAL;
515 if (copy_from_user(optstr, user, count)) 517 if (copy_from_user(optstr, user, count))
516 return -EFAULT; 518 return -EFAULT;
517 optstr[count - 1] = '\0'; 519 optstr[count - 1] = '\0';
diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile
index 1cee2f9fdf06..095e04db1c0e 100644
--- a/arch/powerpc/boot/Makefile
+++ b/arch/powerpc/boot/Makefile
@@ -273,7 +273,8 @@ endif
273initrd- := $(patsubst zImage%, zImage.initrd%, $(image-n) $(image-)) 273initrd- := $(patsubst zImage%, zImage.initrd%, $(image-n) $(image-))
274initrd-y := $(patsubst zImage%, zImage.initrd%, \ 274initrd-y := $(patsubst zImage%, zImage.initrd%, \
275 $(patsubst dtbImage%, dtbImage.initrd%, \ 275 $(patsubst dtbImage%, dtbImage.initrd%, \
276 $(patsubst treeImage%, treeImage.initrd%, $(image-y)))) 276 $(patsubst simpleImage%, simpleImage.initrd%, \
277 $(patsubst treeImage%, treeImage.initrd%, $(image-y)))))
277initrd-y := $(filter-out $(image-y), $(initrd-y)) 278initrd-y := $(filter-out $(image-y), $(initrd-y))
278targets += $(image-y) $(initrd-y) 279targets += $(image-y) $(initrd-y)
279 280
diff --git a/arch/powerpc/kernel/legacy_serial.c b/arch/powerpc/kernel/legacy_serial.c
index 61dd17449ddc..cf37f5ca4b71 100644
--- a/arch/powerpc/kernel/legacy_serial.c
+++ b/arch/powerpc/kernel/legacy_serial.c
@@ -136,6 +136,11 @@ static int __init add_legacy_soc_port(struct device_node *np,
136 if (of_get_property(np, "clock-frequency", NULL) == NULL) 136 if (of_get_property(np, "clock-frequency", NULL) == NULL)
137 return -1; 137 return -1;
138 138
139 /* if reg-shift or offset, don't try to use it */
140 if ((of_get_property(np, "reg-shift", NULL) != NULL) ||
141 (of_get_property(np, "reg-offset", NULL) != NULL))
142 return -1;
143
139 /* if rtas uses this device, don't try to use it as well */ 144 /* if rtas uses this device, don't try to use it as well */
140 if (of_get_property(np, "used-by-rtas", NULL) != NULL) 145 if (of_get_property(np, "used-by-rtas", NULL) != NULL)
141 return -1; 146 return -1;
diff --git a/arch/powerpc/platforms/52xx/lite5200_pm.c b/arch/powerpc/platforms/52xx/lite5200_pm.c
index 41c7fd91e99e..fe92e65103ed 100644
--- a/arch/powerpc/platforms/52xx/lite5200_pm.c
+++ b/arch/powerpc/platforms/52xx/lite5200_pm.c
@@ -14,6 +14,7 @@ static struct mpc52xx_sdma __iomem *bes;
14static struct mpc52xx_xlb __iomem *xlb; 14static struct mpc52xx_xlb __iomem *xlb;
15static struct mpc52xx_gpio __iomem *gps; 15static struct mpc52xx_gpio __iomem *gps;
16static struct mpc52xx_gpio_wkup __iomem *gpw; 16static struct mpc52xx_gpio_wkup __iomem *gpw;
17static void __iomem *pci;
17static void __iomem *sram; 18static void __iomem *sram;
18static const int sram_size = 0x4000; /* 16 kBytes */ 19static const int sram_size = 0x4000; /* 16 kBytes */
19static void __iomem *mbar; 20static void __iomem *mbar;
@@ -50,6 +51,8 @@ static int lite5200_pm_prepare(void)
50 { .type = "builtin", .compatible = "mpc5200", }, /* efika */ 51 { .type = "builtin", .compatible = "mpc5200", }, /* efika */
51 {} 52 {}
52 }; 53 };
54 u64 regaddr64 = 0;
55 const u32 *regaddr_p;
53 56
54 /* deep sleep? let mpc52xx code handle that */ 57 /* deep sleep? let mpc52xx code handle that */
55 if (lite5200_pm_target_state == PM_SUSPEND_STANDBY) 58 if (lite5200_pm_target_state == PM_SUSPEND_STANDBY)
@@ -60,8 +63,12 @@ static int lite5200_pm_prepare(void)
60 63
61 /* map registers */ 64 /* map registers */
62 np = of_find_matching_node(NULL, immr_ids); 65 np = of_find_matching_node(NULL, immr_ids);
63 mbar = of_iomap(np, 0); 66 regaddr_p = of_get_address(np, 0, NULL, NULL);
67 if (regaddr_p)
68 regaddr64 = of_translate_address(np, regaddr_p);
64 of_node_put(np); 69 of_node_put(np);
70
71 mbar = ioremap((u32) regaddr64, 0xC000);
65 if (!mbar) { 72 if (!mbar) {
66 printk(KERN_ERR "%s:%i Error mapping registers\n", __func__, __LINE__); 73 printk(KERN_ERR "%s:%i Error mapping registers\n", __func__, __LINE__);
67 return -ENOSYS; 74 return -ENOSYS;
@@ -71,6 +78,7 @@ static int lite5200_pm_prepare(void)
71 pic = mbar + 0x500; 78 pic = mbar + 0x500;
72 gps = mbar + 0xb00; 79 gps = mbar + 0xb00;
73 gpw = mbar + 0xc00; 80 gpw = mbar + 0xc00;
81 pci = mbar + 0xd00;
74 bes = mbar + 0x1200; 82 bes = mbar + 0x1200;
75 xlb = mbar + 0x1f00; 83 xlb = mbar + 0x1f00;
76 sram = mbar + 0x8000; 84 sram = mbar + 0x8000;
@@ -85,6 +93,7 @@ static struct mpc52xx_sdma sbes;
85static struct mpc52xx_xlb sxlb; 93static struct mpc52xx_xlb sxlb;
86static struct mpc52xx_gpio sgps; 94static struct mpc52xx_gpio sgps;
87static struct mpc52xx_gpio_wkup sgpw; 95static struct mpc52xx_gpio_wkup sgpw;
96static char spci[0x200];
88 97
89static void lite5200_save_regs(void) 98static void lite5200_save_regs(void)
90{ 99{
@@ -94,6 +103,7 @@ static void lite5200_save_regs(void)
94 _memcpy_fromio(&sxlb, xlb, sizeof(*xlb)); 103 _memcpy_fromio(&sxlb, xlb, sizeof(*xlb));
95 _memcpy_fromio(&sgps, gps, sizeof(*gps)); 104 _memcpy_fromio(&sgps, gps, sizeof(*gps));
96 _memcpy_fromio(&sgpw, gpw, sizeof(*gpw)); 105 _memcpy_fromio(&sgpw, gpw, sizeof(*gpw));
106 _memcpy_fromio(spci, pci, 0x200);
97 107
98 _memcpy_fromio(saved_sram, sram, sram_size); 108 _memcpy_fromio(saved_sram, sram, sram_size);
99} 109}
@@ -103,6 +113,8 @@ static void lite5200_restore_regs(void)
103 int i; 113 int i;
104 _memcpy_toio(sram, saved_sram, sram_size); 114 _memcpy_toio(sram, saved_sram, sram_size);
105 115
116 /* PCI Configuration */
117 _memcpy_toio(pci, spci, 0x200);
106 118
107 /* 119 /*
108 * GPIOs. Interrupt Master Enable has higher address then other 120 * GPIOs. Interrupt Master Enable has higher address then other
diff --git a/arch/sh/configs/landisk_defconfig b/arch/sh/configs/landisk_defconfig
index f52db125432f..38f934ab50c7 100644
--- a/arch/sh/configs/landisk_defconfig
+++ b/arch/sh/configs/landisk_defconfig
@@ -226,7 +226,6 @@ CONFIG_CPU_HAS_PTEA=y
226# 226#
227CONFIG_SH_TMU=y 227CONFIG_SH_TMU=y
228CONFIG_SH_TIMER_IRQ=16 228CONFIG_SH_TIMER_IRQ=16
229# CONFIG_NO_IDLE_HZ is not set
230CONFIG_SH_PCLK_FREQ=33333333 229CONFIG_SH_PCLK_FREQ=33333333
231 230
232# 231#
diff --git a/arch/sh/configs/lboxre2_defconfig b/arch/sh/configs/lboxre2_defconfig
index 9fa66d92a4e7..b68b6cdbb78f 100644
--- a/arch/sh/configs/lboxre2_defconfig
+++ b/arch/sh/configs/lboxre2_defconfig
@@ -231,7 +231,6 @@ CONFIG_CPU_HAS_PTEA=y
231# 231#
232CONFIG_SH_TMU=y 232CONFIG_SH_TMU=y
233CONFIG_SH_TIMER_IRQ=16 233CONFIG_SH_TIMER_IRQ=16
234# CONFIG_NO_IDLE_HZ is not set
235CONFIG_SH_PCLK_FREQ=40000000 234CONFIG_SH_PCLK_FREQ=40000000
236 235
237# 236#
diff --git a/arch/sh/configs/se7705_defconfig b/arch/sh/configs/se7705_defconfig
index 84717d854867..490dcbc2ce33 100644
--- a/arch/sh/configs/se7705_defconfig
+++ b/arch/sh/configs/se7705_defconfig
@@ -239,7 +239,6 @@ CONFIG_CPU_HAS_SR_RB=y
239# 239#
240CONFIG_SH_TMU=y 240CONFIG_SH_TMU=y
241CONFIG_SH_TIMER_IRQ=16 241CONFIG_SH_TIMER_IRQ=16
242# CONFIG_NO_IDLE_HZ is not set
243CONFIG_SH_PCLK_FREQ=33333333 242CONFIG_SH_PCLK_FREQ=33333333
244 243
245# 244#
diff --git a/arch/sh/configs/se7712_defconfig b/arch/sh/configs/se7712_defconfig
index 240a1cef69aa..2dd83af988f0 100644
--- a/arch/sh/configs/se7712_defconfig
+++ b/arch/sh/configs/se7712_defconfig
@@ -236,7 +236,6 @@ CONFIG_CPU_HAS_SR_RB=y
236# 236#
237CONFIG_SH_TMU=y 237CONFIG_SH_TMU=y
238CONFIG_SH_TIMER_IRQ=16 238CONFIG_SH_TIMER_IRQ=16
239# CONFIG_NO_IDLE_HZ is not set
240CONFIG_SH_PCLK_FREQ=66666666 239CONFIG_SH_PCLK_FREQ=66666666
241 240
242# 241#
diff --git a/arch/sh/configs/se7750_defconfig b/arch/sh/configs/se7750_defconfig
index c60b6fd4fc42..167786f9a9bd 100644
--- a/arch/sh/configs/se7750_defconfig
+++ b/arch/sh/configs/se7750_defconfig
@@ -235,7 +235,6 @@ CONFIG_CPU_HAS_PTEA=y
235# 235#
236CONFIG_SH_TMU=y 236CONFIG_SH_TMU=y
237CONFIG_SH_TIMER_IRQ=16 237CONFIG_SH_TIMER_IRQ=16
238# CONFIG_NO_IDLE_HZ is not set
239CONFIG_SH_PCLK_FREQ=33333333 238CONFIG_SH_PCLK_FREQ=33333333
240 239
241# 240#
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 52e18e6d2ba0..bf07b6f50fa1 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -383,6 +383,7 @@ config VMI
383config KVM_CLOCK 383config KVM_CLOCK
384 bool "KVM paravirtualized clock" 384 bool "KVM paravirtualized clock"
385 select PARAVIRT 385 select PARAVIRT
386 select PARAVIRT_CLOCK
386 depends on !(X86_VISWS || X86_VOYAGER) 387 depends on !(X86_VISWS || X86_VOYAGER)
387 help 388 help
388 Turning on this option will allow you to run a paravirtualized clock 389 Turning on this option will allow you to run a paravirtualized clock
@@ -410,6 +411,10 @@ config PARAVIRT
410 over full virtualization. However, when run without a hypervisor 411 over full virtualization. However, when run without a hypervisor
411 the kernel is theoretically slower and slightly larger. 412 the kernel is theoretically slower and slightly larger.
412 413
414config PARAVIRT_CLOCK
415 bool
416 default n
417
413endif 418endif
414 419
415config MEMTEST_BOOTPARAM 420config MEMTEST_BOOTPARAM
@@ -961,8 +966,8 @@ config NUMA_EMU
961 number of nodes. This is only useful for debugging. 966 number of nodes. This is only useful for debugging.
962 967
963config NODES_SHIFT 968config NODES_SHIFT
964 int "Max num nodes shift(1-15)" 969 int "Max num nodes shift(1-9)"
965 range 1 15 if X86_64 970 range 1 9 if X86_64
966 default "6" if X86_64 971 default "6" if X86_64
967 default "4" if X86_NUMAQ 972 default "4" if X86_NUMAQ
968 default "3" 973 default "3"
diff --git a/arch/x86/kernel/Makefile b/arch/x86/kernel/Makefile
index 5e618c3b4720..77807d4769c9 100644
--- a/arch/x86/kernel/Makefile
+++ b/arch/x86/kernel/Makefile
@@ -82,6 +82,7 @@ obj-$(CONFIG_VMI) += vmi_32.o vmiclock_32.o
82obj-$(CONFIG_KVM_GUEST) += kvm.o 82obj-$(CONFIG_KVM_GUEST) += kvm.o
83obj-$(CONFIG_KVM_CLOCK) += kvmclock.o 83obj-$(CONFIG_KVM_CLOCK) += kvmclock.o
84obj-$(CONFIG_PARAVIRT) += paravirt.o paravirt_patch_$(BITS).o 84obj-$(CONFIG_PARAVIRT) += paravirt.o paravirt_patch_$(BITS).o
85obj-$(CONFIG_PARAVIRT_CLOCK) += pvclock.o
85 86
86obj-$(CONFIG_PCSPKR_PLATFORM) += pcspeaker.o 87obj-$(CONFIG_PCSPKR_PLATFORM) += pcspeaker.o
87 88
diff --git a/arch/x86/kernel/i387.c b/arch/x86/kernel/i387.c
index eb9ddd8efb82..95e80e5033c3 100644
--- a/arch/x86/kernel/i387.c
+++ b/arch/x86/kernel/i387.c
@@ -162,7 +162,7 @@ int xfpregs_get(struct task_struct *target, const struct user_regset *regset,
162 int ret; 162 int ret;
163 163
164 if (!cpu_has_fxsr) 164 if (!cpu_has_fxsr)
165 return -ENODEV; 165 return -EIO;
166 166
167 ret = init_fpu(target); 167 ret = init_fpu(target);
168 if (ret) 168 if (ret)
@@ -179,7 +179,7 @@ int xfpregs_set(struct task_struct *target, const struct user_regset *regset,
179 int ret; 179 int ret;
180 180
181 if (!cpu_has_fxsr) 181 if (!cpu_has_fxsr)
182 return -ENODEV; 182 return -EIO;
183 183
184 ret = init_fpu(target); 184 ret = init_fpu(target);
185 if (ret) 185 if (ret)
diff --git a/arch/x86/kernel/kvmclock.c b/arch/x86/kernel/kvmclock.c
index 08a30986d472..87edf1ceb1df 100644
--- a/arch/x86/kernel/kvmclock.c
+++ b/arch/x86/kernel/kvmclock.c
@@ -18,6 +18,7 @@
18 18
19#include <linux/clocksource.h> 19#include <linux/clocksource.h>
20#include <linux/kvm_para.h> 20#include <linux/kvm_para.h>
21#include <asm/pvclock.h>
21#include <asm/arch_hooks.h> 22#include <asm/arch_hooks.h>
22#include <asm/msr.h> 23#include <asm/msr.h>
23#include <asm/apic.h> 24#include <asm/apic.h>
@@ -36,18 +37,9 @@ static int parse_no_kvmclock(char *arg)
36early_param("no-kvmclock", parse_no_kvmclock); 37early_param("no-kvmclock", parse_no_kvmclock);
37 38
38/* The hypervisor will put information about time periodically here */ 39/* The hypervisor will put information about time periodically here */
39static DEFINE_PER_CPU_SHARED_ALIGNED(struct kvm_vcpu_time_info, hv_clock); 40static DEFINE_PER_CPU_SHARED_ALIGNED(struct pvclock_vcpu_time_info, hv_clock);
40#define get_clock(cpu, field) per_cpu(hv_clock, cpu).field 41static struct pvclock_wall_clock wall_clock;
41 42
42static inline u64 kvm_get_delta(u64 last_tsc)
43{
44 int cpu = smp_processor_id();
45 u64 delta = native_read_tsc() - last_tsc;
46 return (delta * get_clock(cpu, tsc_to_system_mul)) >> KVM_SCALE;
47}
48
49static struct kvm_wall_clock wall_clock;
50static cycle_t kvm_clock_read(void);
51/* 43/*
52 * The wallclock is the time of day when we booted. Since then, some time may 44 * The wallclock is the time of day when we booted. Since then, some time may
53 * have elapsed since the hypervisor wrote the data. So we try to account for 45 * have elapsed since the hypervisor wrote the data. So we try to account for
@@ -55,64 +47,37 @@ static cycle_t kvm_clock_read(void);
55 */ 47 */
56static unsigned long kvm_get_wallclock(void) 48static unsigned long kvm_get_wallclock(void)
57{ 49{
58 u32 wc_sec, wc_nsec; 50 struct pvclock_vcpu_time_info *vcpu_time;
59 u64 delta;
60 struct timespec ts; 51 struct timespec ts;
61 int version, nsec;
62 int low, high; 52 int low, high;
63 53
64 low = (int)__pa(&wall_clock); 54 low = (int)__pa(&wall_clock);
65 high = ((u64)__pa(&wall_clock) >> 32); 55 high = ((u64)__pa(&wall_clock) >> 32);
56 native_write_msr(MSR_KVM_WALL_CLOCK, low, high);
66 57
67 delta = kvm_clock_read(); 58 vcpu_time = &get_cpu_var(hv_clock);
59 pvclock_read_wallclock(&wall_clock, vcpu_time, &ts);
60 put_cpu_var(hv_clock);
68 61
69 native_write_msr(MSR_KVM_WALL_CLOCK, low, high); 62 return ts.tv_sec;
70 do {
71 version = wall_clock.wc_version;
72 rmb();
73 wc_sec = wall_clock.wc_sec;
74 wc_nsec = wall_clock.wc_nsec;
75 rmb();
76 } while ((wall_clock.wc_version != version) || (version & 1));
77
78 delta = kvm_clock_read() - delta;
79 delta += wc_nsec;
80 nsec = do_div(delta, NSEC_PER_SEC);
81 set_normalized_timespec(&ts, wc_sec + delta, nsec);
82 /*
83 * Of all mechanisms of time adjustment I've tested, this one
84 * was the champion!
85 */
86 return ts.tv_sec + 1;
87} 63}
88 64
89static int kvm_set_wallclock(unsigned long now) 65static int kvm_set_wallclock(unsigned long now)
90{ 66{
91 return 0; 67 return -1;
92} 68}
93 69
94/*
95 * This is our read_clock function. The host puts an tsc timestamp each time
96 * it updates a new time. Without the tsc adjustment, we can have a situation
97 * in which a vcpu starts to run earlier (smaller system_time), but probes
98 * time later (compared to another vcpu), leading to backwards time
99 */
100static cycle_t kvm_clock_read(void) 70static cycle_t kvm_clock_read(void)
101{ 71{
102 u64 last_tsc, now; 72 struct pvclock_vcpu_time_info *src;
103 int cpu; 73 cycle_t ret;
104 74
105 preempt_disable(); 75 src = &get_cpu_var(hv_clock);
106 cpu = smp_processor_id(); 76 ret = pvclock_clocksource_read(src);
107 77 put_cpu_var(hv_clock);
108 last_tsc = get_clock(cpu, tsc_timestamp); 78 return ret;
109 now = get_clock(cpu, system_time);
110
111 now += kvm_get_delta(last_tsc);
112 preempt_enable();
113
114 return now;
115} 79}
80
116static struct clocksource kvm_clock = { 81static struct clocksource kvm_clock = {
117 .name = "kvm-clock", 82 .name = "kvm-clock",
118 .read = kvm_clock_read, 83 .read = kvm_clock_read,
@@ -123,13 +88,14 @@ static struct clocksource kvm_clock = {
123 .flags = CLOCK_SOURCE_IS_CONTINUOUS, 88 .flags = CLOCK_SOURCE_IS_CONTINUOUS,
124}; 89};
125 90
126static int kvm_register_clock(void) 91static int kvm_register_clock(char *txt)
127{ 92{
128 int cpu = smp_processor_id(); 93 int cpu = smp_processor_id();
129 int low, high; 94 int low, high;
130 low = (int)__pa(&per_cpu(hv_clock, cpu)) | 1; 95 low = (int)__pa(&per_cpu(hv_clock, cpu)) | 1;
131 high = ((u64)__pa(&per_cpu(hv_clock, cpu)) >> 32); 96 high = ((u64)__pa(&per_cpu(hv_clock, cpu)) >> 32);
132 97 printk(KERN_INFO "kvm-clock: cpu %d, msr %x:%x, %s\n",
98 cpu, high, low, txt);
133 return native_write_msr_safe(MSR_KVM_SYSTEM_TIME, low, high); 99 return native_write_msr_safe(MSR_KVM_SYSTEM_TIME, low, high);
134} 100}
135 101
@@ -140,12 +106,20 @@ static void kvm_setup_secondary_clock(void)
140 * Now that the first cpu already had this clocksource initialized, 106 * Now that the first cpu already had this clocksource initialized,
141 * we shouldn't fail. 107 * we shouldn't fail.
142 */ 108 */
143 WARN_ON(kvm_register_clock()); 109 WARN_ON(kvm_register_clock("secondary cpu clock"));
144 /* ok, done with our trickery, call native */ 110 /* ok, done with our trickery, call native */
145 setup_secondary_APIC_clock(); 111 setup_secondary_APIC_clock();
146} 112}
147#endif 113#endif
148 114
115#ifdef CONFIG_SMP
116void __init kvm_smp_prepare_boot_cpu(void)
117{
118 WARN_ON(kvm_register_clock("primary cpu clock"));
119 native_smp_prepare_boot_cpu();
120}
121#endif
122
149/* 123/*
150 * After the clock is registered, the host will keep writing to the 124 * After the clock is registered, the host will keep writing to the
151 * registered memory location. If the guest happens to shutdown, this memory 125 * registered memory location. If the guest happens to shutdown, this memory
@@ -174,7 +148,7 @@ void __init kvmclock_init(void)
174 return; 148 return;
175 149
176 if (kvmclock && kvm_para_has_feature(KVM_FEATURE_CLOCKSOURCE)) { 150 if (kvmclock && kvm_para_has_feature(KVM_FEATURE_CLOCKSOURCE)) {
177 if (kvm_register_clock()) 151 if (kvm_register_clock("boot clock"))
178 return; 152 return;
179 pv_time_ops.get_wallclock = kvm_get_wallclock; 153 pv_time_ops.get_wallclock = kvm_get_wallclock;
180 pv_time_ops.set_wallclock = kvm_set_wallclock; 154 pv_time_ops.set_wallclock = kvm_set_wallclock;
@@ -182,6 +156,9 @@ void __init kvmclock_init(void)
182#ifdef CONFIG_X86_LOCAL_APIC 156#ifdef CONFIG_X86_LOCAL_APIC
183 pv_apic_ops.setup_secondary_clock = kvm_setup_secondary_clock; 157 pv_apic_ops.setup_secondary_clock = kvm_setup_secondary_clock;
184#endif 158#endif
159#ifdef CONFIG_SMP
160 smp_ops.smp_prepare_boot_cpu = kvm_smp_prepare_boot_cpu;
161#endif
185 machine_ops.shutdown = kvm_shutdown; 162 machine_ops.shutdown = kvm_shutdown;
186#ifdef CONFIG_KEXEC 163#ifdef CONFIG_KEXEC
187 machine_ops.crash_shutdown = kvm_crash_shutdown; 164 machine_ops.crash_shutdown = kvm_crash_shutdown;
diff --git a/arch/x86/kernel/pvclock.c b/arch/x86/kernel/pvclock.c
new file mode 100644
index 000000000000..05fbe9a0325a
--- /dev/null
+++ b/arch/x86/kernel/pvclock.c
@@ -0,0 +1,141 @@
1/* paravirtual clock -- common code used by kvm/xen
2
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation; either version 2 of the License, or
6 (at your option) any later version.
7
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12
13 You should have received a copy of the GNU General Public License
14 along with this program; if not, write to the Free Software
15 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
16*/
17
18#include <linux/kernel.h>
19#include <linux/percpu.h>
20#include <asm/pvclock.h>
21
22/*
23 * These are perodically updated
24 * xen: magic shared_info page
25 * kvm: gpa registered via msr
26 * and then copied here.
27 */
28struct pvclock_shadow_time {
29 u64 tsc_timestamp; /* TSC at last update of time vals. */
30 u64 system_timestamp; /* Time, in nanosecs, since boot. */
31 u32 tsc_to_nsec_mul;
32 int tsc_shift;
33 u32 version;
34};
35
36/*
37 * Scale a 64-bit delta by scaling and multiplying by a 32-bit fraction,
38 * yielding a 64-bit result.
39 */
40static inline u64 scale_delta(u64 delta, u32 mul_frac, int shift)
41{
42 u64 product;
43#ifdef __i386__
44 u32 tmp1, tmp2;
45#endif
46
47 if (shift < 0)
48 delta >>= -shift;
49 else
50 delta <<= shift;
51
52#ifdef __i386__
53 __asm__ (
54 "mul %5 ; "
55 "mov %4,%%eax ; "
56 "mov %%edx,%4 ; "
57 "mul %5 ; "
58 "xor %5,%5 ; "
59 "add %4,%%eax ; "
60 "adc %5,%%edx ; "
61 : "=A" (product), "=r" (tmp1), "=r" (tmp2)
62 : "a" ((u32)delta), "1" ((u32)(delta >> 32)), "2" (mul_frac) );
63#elif __x86_64__
64 __asm__ (
65 "mul %%rdx ; shrd $32,%%rdx,%%rax"
66 : "=a" (product) : "0" (delta), "d" ((u64)mul_frac) );
67#else
68#error implement me!
69#endif
70
71 return product;
72}
73
74static u64 pvclock_get_nsec_offset(struct pvclock_shadow_time *shadow)
75{
76 u64 delta = native_read_tsc() - shadow->tsc_timestamp;
77 return scale_delta(delta, shadow->tsc_to_nsec_mul, shadow->tsc_shift);
78}
79
80/*
81 * Reads a consistent set of time-base values from hypervisor,
82 * into a shadow data area.
83 */
84static unsigned pvclock_get_time_values(struct pvclock_shadow_time *dst,
85 struct pvclock_vcpu_time_info *src)
86{
87 do {
88 dst->version = src->version;
89 rmb(); /* fetch version before data */
90 dst->tsc_timestamp = src->tsc_timestamp;
91 dst->system_timestamp = src->system_time;
92 dst->tsc_to_nsec_mul = src->tsc_to_system_mul;
93 dst->tsc_shift = src->tsc_shift;
94 rmb(); /* test version after fetching data */
95 } while ((src->version & 1) || (dst->version != src->version));
96
97 return dst->version;
98}
99
100cycle_t pvclock_clocksource_read(struct pvclock_vcpu_time_info *src)
101{
102 struct pvclock_shadow_time shadow;
103 unsigned version;
104 cycle_t ret, offset;
105
106 do {
107 version = pvclock_get_time_values(&shadow, src);
108 barrier();
109 offset = pvclock_get_nsec_offset(&shadow);
110 ret = shadow.system_timestamp + offset;
111 barrier();
112 } while (version != src->version);
113
114 return ret;
115}
116
117void pvclock_read_wallclock(struct pvclock_wall_clock *wall_clock,
118 struct pvclock_vcpu_time_info *vcpu_time,
119 struct timespec *ts)
120{
121 u32 version;
122 u64 delta;
123 struct timespec now;
124
125 /* get wallclock at system boot */
126 do {
127 version = wall_clock->version;
128 rmb(); /* fetch version before time */
129 now.tv_sec = wall_clock->sec;
130 now.tv_nsec = wall_clock->nsec;
131 rmb(); /* fetch time before checking version */
132 } while ((wall_clock->version & 1) || (version != wall_clock->version));
133
134 delta = pvclock_clocksource_read(vcpu_time); /* time since system boot */
135 delta += now.tv_sec * (u64)NSEC_PER_SEC + now.tv_nsec;
136
137 now.tv_nsec = do_div(delta, NSEC_PER_SEC);
138 now.tv_sec = delta;
139
140 set_normalized_timespec(ts, now.tv_sec, now.tv_nsec);
141}
diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
index 56078d61c793..3e1cecedde42 100644
--- a/arch/x86/kernel/smpboot.c
+++ b/arch/x86/kernel/smpboot.c
@@ -996,7 +996,6 @@ do_rest:
996#endif 996#endif
997 cpu_clear(cpu, cpu_callout_map); /* was set by do_boot_cpu() */ 997 cpu_clear(cpu, cpu_callout_map); /* was set by do_boot_cpu() */
998 cpu_clear(cpu, cpu_initialized); /* was set by cpu_init() */ 998 cpu_clear(cpu, cpu_initialized); /* was set by cpu_init() */
999 cpu_clear(cpu, cpu_possible_map);
1000 cpu_clear(cpu, cpu_present_map); 999 cpu_clear(cpu, cpu_present_map);
1001 per_cpu(x86_cpu_to_apicid, cpu) = BAD_APICID; 1000 per_cpu(x86_cpu_to_apicid, cpu) = BAD_APICID;
1002 } 1001 }
diff --git a/arch/x86/kvm/i8254.c b/arch/x86/kvm/i8254.c
index f2f5d260874e..3829aa7b663f 100644
--- a/arch/x86/kvm/i8254.c
+++ b/arch/x86/kvm/i8254.c
@@ -200,9 +200,12 @@ int __pit_timer_fn(struct kvm_kpit_state *ps)
200 200
201 atomic_inc(&pt->pending); 201 atomic_inc(&pt->pending);
202 smp_mb__after_atomic_inc(); 202 smp_mb__after_atomic_inc();
203 if (vcpu0 && waitqueue_active(&vcpu0->wq)) { 203 if (vcpu0) {
204 vcpu0->arch.mp_state = KVM_MP_STATE_RUNNABLE; 204 set_bit(KVM_REQ_PENDING_TIMER, &vcpu0->requests);
205 wake_up_interruptible(&vcpu0->wq); 205 if (waitqueue_active(&vcpu0->wq)) {
206 vcpu0->arch.mp_state = KVM_MP_STATE_RUNNABLE;
207 wake_up_interruptible(&vcpu0->wq);
208 }
206 } 209 }
207 210
208 pt->timer.expires = ktime_add_ns(pt->timer.expires, pt->period); 211 pt->timer.expires = ktime_add_ns(pt->timer.expires, pt->period);
diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c
index c297c50eba63..ebc03f5ae162 100644
--- a/arch/x86/kvm/lapic.c
+++ b/arch/x86/kvm/lapic.c
@@ -940,6 +940,7 @@ static int __apic_timer_fn(struct kvm_lapic *apic)
940 wait_queue_head_t *q = &apic->vcpu->wq; 940 wait_queue_head_t *q = &apic->vcpu->wq;
941 941
942 atomic_inc(&apic->timer.pending); 942 atomic_inc(&apic->timer.pending);
943 set_bit(KVM_REQ_PENDING_TIMER, &apic->vcpu->requests);
943 if (waitqueue_active(q)) { 944 if (waitqueue_active(q)) {
944 apic->vcpu->arch.mp_state = KVM_MP_STATE_RUNNABLE; 945 apic->vcpu->arch.mp_state = KVM_MP_STATE_RUNNABLE;
945 wake_up_interruptible(q); 946 wake_up_interruptible(q);
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
index ee3f53098f0c..7e7c3969f7a2 100644
--- a/arch/x86/kvm/mmu.c
+++ b/arch/x86/kvm/mmu.c
@@ -640,6 +640,7 @@ static void rmap_write_protect(struct kvm *kvm, u64 gfn)
640 rmap_remove(kvm, spte); 640 rmap_remove(kvm, spte);
641 --kvm->stat.lpages; 641 --kvm->stat.lpages;
642 set_shadow_pte(spte, shadow_trap_nonpresent_pte); 642 set_shadow_pte(spte, shadow_trap_nonpresent_pte);
643 spte = NULL;
643 write_protected = 1; 644 write_protected = 1;
644 } 645 }
645 spte = rmap_next(kvm, rmapp, spte); 646 spte = rmap_next(kvm, rmapp, spte);
@@ -1082,10 +1083,6 @@ static void mmu_set_spte(struct kvm_vcpu *vcpu, u64 *shadow_pte,
1082 struct kvm_mmu_page *shadow; 1083 struct kvm_mmu_page *shadow;
1083 1084
1084 spte |= PT_WRITABLE_MASK; 1085 spte |= PT_WRITABLE_MASK;
1085 if (user_fault) {
1086 mmu_unshadow(vcpu->kvm, gfn);
1087 goto unshadowed;
1088 }
1089 1086
1090 shadow = kvm_mmu_lookup_page(vcpu->kvm, gfn); 1087 shadow = kvm_mmu_lookup_page(vcpu->kvm, gfn);
1091 if (shadow || 1088 if (shadow ||
@@ -1102,8 +1099,6 @@ static void mmu_set_spte(struct kvm_vcpu *vcpu, u64 *shadow_pte,
1102 } 1099 }
1103 } 1100 }
1104 1101
1105unshadowed:
1106
1107 if (pte_access & ACC_WRITE_MASK) 1102 if (pte_access & ACC_WRITE_MASK)
1108 mark_page_dirty(vcpu->kvm, gfn); 1103 mark_page_dirty(vcpu->kvm, gfn);
1109 1104
@@ -1580,11 +1575,13 @@ static void mmu_pte_write_new_pte(struct kvm_vcpu *vcpu,
1580 u64 *spte, 1575 u64 *spte,
1581 const void *new) 1576 const void *new)
1582{ 1577{
1583 if ((sp->role.level != PT_PAGE_TABLE_LEVEL) 1578 if (sp->role.level != PT_PAGE_TABLE_LEVEL) {
1584 && !vcpu->arch.update_pte.largepage) { 1579 if (!vcpu->arch.update_pte.largepage ||
1585 ++vcpu->kvm->stat.mmu_pde_zapped; 1580 sp->role.glevels == PT32_ROOT_LEVEL) {
1586 return; 1581 ++vcpu->kvm->stat.mmu_pde_zapped;
1587 } 1582 return;
1583 }
1584 }
1588 1585
1589 ++vcpu->kvm->stat.mmu_pte_updated; 1586 ++vcpu->kvm->stat.mmu_pte_updated;
1590 if (sp->role.glevels == PT32_ROOT_LEVEL) 1587 if (sp->role.glevels == PT32_ROOT_LEVEL)
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index 02efbe75f317..540e95179074 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -566,7 +566,7 @@ static void vmx_save_host_state(struct kvm_vcpu *vcpu)
566 load_transition_efer(vmx); 566 load_transition_efer(vmx);
567} 567}
568 568
569static void vmx_load_host_state(struct vcpu_vmx *vmx) 569static void __vmx_load_host_state(struct vcpu_vmx *vmx)
570{ 570{
571 unsigned long flags; 571 unsigned long flags;
572 572
@@ -596,6 +596,13 @@ static void vmx_load_host_state(struct vcpu_vmx *vmx)
596 reload_host_efer(vmx); 596 reload_host_efer(vmx);
597} 597}
598 598
599static void vmx_load_host_state(struct vcpu_vmx *vmx)
600{
601 preempt_disable();
602 __vmx_load_host_state(vmx);
603 preempt_enable();
604}
605
599/* 606/*
600 * Switches to specified vcpu, until a matching vcpu_put(), but assumes 607 * Switches to specified vcpu, until a matching vcpu_put(), but assumes
601 * vcpu mutex is already taken. 608 * vcpu mutex is already taken.
@@ -654,7 +661,7 @@ static void vmx_vcpu_load(struct kvm_vcpu *vcpu, int cpu)
654 661
655static void vmx_vcpu_put(struct kvm_vcpu *vcpu) 662static void vmx_vcpu_put(struct kvm_vcpu *vcpu)
656{ 663{
657 vmx_load_host_state(to_vmx(vcpu)); 664 __vmx_load_host_state(to_vmx(vcpu));
658} 665}
659 666
660static void vmx_fpu_activate(struct kvm_vcpu *vcpu) 667static void vmx_fpu_activate(struct kvm_vcpu *vcpu)
@@ -884,11 +891,8 @@ static int vmx_set_msr(struct kvm_vcpu *vcpu, u32 msr_index, u64 data)
884 switch (msr_index) { 891 switch (msr_index) {
885#ifdef CONFIG_X86_64 892#ifdef CONFIG_X86_64
886 case MSR_EFER: 893 case MSR_EFER:
894 vmx_load_host_state(vmx);
887 ret = kvm_set_msr_common(vcpu, msr_index, data); 895 ret = kvm_set_msr_common(vcpu, msr_index, data);
888 if (vmx->host_state.loaded) {
889 reload_host_efer(vmx);
890 load_transition_efer(vmx);
891 }
892 break; 896 break;
893 case MSR_FS_BASE: 897 case MSR_FS_BASE:
894 vmcs_writel(GUEST_FS_BASE, data); 898 vmcs_writel(GUEST_FS_BASE, data);
@@ -910,11 +914,10 @@ static int vmx_set_msr(struct kvm_vcpu *vcpu, u32 msr_index, u64 data)
910 guest_write_tsc(data); 914 guest_write_tsc(data);
911 break; 915 break;
912 default: 916 default:
917 vmx_load_host_state(vmx);
913 msr = find_msr_entry(vmx, msr_index); 918 msr = find_msr_entry(vmx, msr_index);
914 if (msr) { 919 if (msr) {
915 msr->data = data; 920 msr->data = data;
916 if (vmx->host_state.loaded)
917 load_msrs(vmx->guest_msrs, vmx->save_nmsrs);
918 break; 921 break;
919 } 922 }
920 ret = kvm_set_msr_common(vcpu, msr_index, data); 923 ret = kvm_set_msr_common(vcpu, msr_index, data);
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 00acf1301a15..63a77caa59f1 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -492,8 +492,8 @@ static int do_set_msr(struct kvm_vcpu *vcpu, unsigned index, u64 *data)
492static void kvm_write_wall_clock(struct kvm *kvm, gpa_t wall_clock) 492static void kvm_write_wall_clock(struct kvm *kvm, gpa_t wall_clock)
493{ 493{
494 static int version; 494 static int version;
495 struct kvm_wall_clock wc; 495 struct pvclock_wall_clock wc;
496 struct timespec wc_ts; 496 struct timespec now, sys, boot;
497 497
498 if (!wall_clock) 498 if (!wall_clock)
499 return; 499 return;
@@ -502,10 +502,19 @@ static void kvm_write_wall_clock(struct kvm *kvm, gpa_t wall_clock)
502 502
503 kvm_write_guest(kvm, wall_clock, &version, sizeof(version)); 503 kvm_write_guest(kvm, wall_clock, &version, sizeof(version));
504 504
505 wc_ts = current_kernel_time(); 505 /*
506 wc.wc_sec = wc_ts.tv_sec; 506 * The guest calculates current wall clock time by adding
507 wc.wc_nsec = wc_ts.tv_nsec; 507 * system time (updated by kvm_write_guest_time below) to the
508 wc.wc_version = version; 508 * wall clock specified here. guest system time equals host
509 * system time for us, thus we must fill in host boot time here.
510 */
511 now = current_kernel_time();
512 ktime_get_ts(&sys);
513 boot = ns_to_timespec(timespec_to_ns(&now) - timespec_to_ns(&sys));
514
515 wc.sec = boot.tv_sec;
516 wc.nsec = boot.tv_nsec;
517 wc.version = version;
509 518
510 kvm_write_guest(kvm, wall_clock, &wc, sizeof(wc)); 519 kvm_write_guest(kvm, wall_clock, &wc, sizeof(wc));
511 520
@@ -513,6 +522,45 @@ static void kvm_write_wall_clock(struct kvm *kvm, gpa_t wall_clock)
513 kvm_write_guest(kvm, wall_clock, &version, sizeof(version)); 522 kvm_write_guest(kvm, wall_clock, &version, sizeof(version));
514} 523}
515 524
525static uint32_t div_frac(uint32_t dividend, uint32_t divisor)
526{
527 uint32_t quotient, remainder;
528
529 /* Don't try to replace with do_div(), this one calculates
530 * "(dividend << 32) / divisor" */
531 __asm__ ( "divl %4"
532 : "=a" (quotient), "=d" (remainder)
533 : "0" (0), "1" (dividend), "r" (divisor) );
534 return quotient;
535}
536
537static void kvm_set_time_scale(uint32_t tsc_khz, struct pvclock_vcpu_time_info *hv_clock)
538{
539 uint64_t nsecs = 1000000000LL;
540 int32_t shift = 0;
541 uint64_t tps64;
542 uint32_t tps32;
543
544 tps64 = tsc_khz * 1000LL;
545 while (tps64 > nsecs*2) {
546 tps64 >>= 1;
547 shift--;
548 }
549
550 tps32 = (uint32_t)tps64;
551 while (tps32 <= (uint32_t)nsecs) {
552 tps32 <<= 1;
553 shift++;
554 }
555
556 hv_clock->tsc_shift = shift;
557 hv_clock->tsc_to_system_mul = div_frac(nsecs, tps32);
558
559 pr_debug("%s: tsc_khz %u, tsc_shift %d, tsc_mul %u\n",
560 __FUNCTION__, tsc_khz, hv_clock->tsc_shift,
561 hv_clock->tsc_to_system_mul);
562}
563
516static void kvm_write_guest_time(struct kvm_vcpu *v) 564static void kvm_write_guest_time(struct kvm_vcpu *v)
517{ 565{
518 struct timespec ts; 566 struct timespec ts;
@@ -523,6 +571,11 @@ static void kvm_write_guest_time(struct kvm_vcpu *v)
523 if ((!vcpu->time_page)) 571 if ((!vcpu->time_page))
524 return; 572 return;
525 573
574 if (unlikely(vcpu->hv_clock_tsc_khz != tsc_khz)) {
575 kvm_set_time_scale(tsc_khz, &vcpu->hv_clock);
576 vcpu->hv_clock_tsc_khz = tsc_khz;
577 }
578
526 /* Keep irq disabled to prevent changes to the clock */ 579 /* Keep irq disabled to prevent changes to the clock */
527 local_irq_save(flags); 580 local_irq_save(flags);
528 kvm_get_msr(v, MSR_IA32_TIME_STAMP_COUNTER, 581 kvm_get_msr(v, MSR_IA32_TIME_STAMP_COUNTER,
@@ -537,14 +590,14 @@ static void kvm_write_guest_time(struct kvm_vcpu *v)
537 /* 590 /*
538 * The interface expects us to write an even number signaling that the 591 * The interface expects us to write an even number signaling that the
539 * update is finished. Since the guest won't see the intermediate 592 * update is finished. Since the guest won't see the intermediate
540 * state, we just write "2" at the end 593 * state, we just increase by 2 at the end.
541 */ 594 */
542 vcpu->hv_clock.version = 2; 595 vcpu->hv_clock.version += 2;
543 596
544 shared_kaddr = kmap_atomic(vcpu->time_page, KM_USER0); 597 shared_kaddr = kmap_atomic(vcpu->time_page, KM_USER0);
545 598
546 memcpy(shared_kaddr + vcpu->time_offset, &vcpu->hv_clock, 599 memcpy(shared_kaddr + vcpu->time_offset, &vcpu->hv_clock,
547 sizeof(vcpu->hv_clock)); 600 sizeof(vcpu->hv_clock));
548 601
549 kunmap_atomic(shared_kaddr, KM_USER0); 602 kunmap_atomic(shared_kaddr, KM_USER0);
550 603
@@ -599,10 +652,6 @@ int kvm_set_msr_common(struct kvm_vcpu *vcpu, u32 msr, u64 data)
599 /* ...but clean it before doing the actual write */ 652 /* ...but clean it before doing the actual write */
600 vcpu->arch.time_offset = data & ~(PAGE_MASK | 1); 653 vcpu->arch.time_offset = data & ~(PAGE_MASK | 1);
601 654
602 vcpu->arch.hv_clock.tsc_to_system_mul =
603 clocksource_khz2mult(tsc_khz, 22);
604 vcpu->arch.hv_clock.tsc_shift = 22;
605
606 down_read(&current->mm->mmap_sem); 655 down_read(&current->mm->mmap_sem);
607 vcpu->arch.time_page = 656 vcpu->arch.time_page =
608 gfn_to_page(vcpu->kvm, data >> PAGE_SHIFT); 657 gfn_to_page(vcpu->kvm, data >> PAGE_SHIFT);
@@ -2759,6 +2808,8 @@ again:
2759 if (vcpu->requests) { 2808 if (vcpu->requests) {
2760 if (test_and_clear_bit(KVM_REQ_MIGRATE_TIMER, &vcpu->requests)) 2809 if (test_and_clear_bit(KVM_REQ_MIGRATE_TIMER, &vcpu->requests))
2761 __kvm_migrate_timers(vcpu); 2810 __kvm_migrate_timers(vcpu);
2811 if (test_and_clear_bit(KVM_REQ_TLB_FLUSH, &vcpu->requests))
2812 kvm_x86_ops->tlb_flush(vcpu);
2762 if (test_and_clear_bit(KVM_REQ_REPORT_TPR_ACCESS, 2813 if (test_and_clear_bit(KVM_REQ_REPORT_TPR_ACCESS,
2763 &vcpu->requests)) { 2814 &vcpu->requests)) {
2764 kvm_run->exit_reason = KVM_EXIT_TPR_ACCESS; 2815 kvm_run->exit_reason = KVM_EXIT_TPR_ACCESS;
@@ -2772,6 +2823,7 @@ again:
2772 } 2823 }
2773 } 2824 }
2774 2825
2826 clear_bit(KVM_REQ_PENDING_TIMER, &vcpu->requests);
2775 kvm_inject_pending_timer_irqs(vcpu); 2827 kvm_inject_pending_timer_irqs(vcpu);
2776 2828
2777 preempt_disable(); 2829 preempt_disable();
@@ -2781,21 +2833,13 @@ again:
2781 2833
2782 local_irq_disable(); 2834 local_irq_disable();
2783 2835
2784 if (need_resched()) { 2836 if (vcpu->requests || need_resched()) {
2785 local_irq_enable(); 2837 local_irq_enable();
2786 preempt_enable(); 2838 preempt_enable();
2787 r = 1; 2839 r = 1;
2788 goto out; 2840 goto out;
2789 } 2841 }
2790 2842
2791 if (vcpu->requests)
2792 if (test_bit(KVM_REQ_MMU_RELOAD, &vcpu->requests)) {
2793 local_irq_enable();
2794 preempt_enable();
2795 r = 1;
2796 goto out;
2797 }
2798
2799 if (signal_pending(current)) { 2843 if (signal_pending(current)) {
2800 local_irq_enable(); 2844 local_irq_enable();
2801 preempt_enable(); 2845 preempt_enable();
@@ -2825,9 +2869,6 @@ again:
2825 2869
2826 kvm_guest_enter(); 2870 kvm_guest_enter();
2827 2871
2828 if (vcpu->requests)
2829 if (test_and_clear_bit(KVM_REQ_TLB_FLUSH, &vcpu->requests))
2830 kvm_x86_ops->tlb_flush(vcpu);
2831 2872
2832 KVMTRACE_0D(VMENTRY, vcpu, entryexit); 2873 KVMTRACE_0D(VMENTRY, vcpu, entryexit);
2833 kvm_x86_ops->run(vcpu, kvm_run); 2874 kvm_x86_ops->run(vcpu, kvm_run);
diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
index 156e6d7b0e32..f6d20be7a8f4 100644
--- a/arch/x86/mm/init_64.c
+++ b/arch/x86/mm/init_64.c
@@ -135,7 +135,7 @@ static __init void *spp_getpage(void)
135 return ptr; 135 return ptr;
136} 136}
137 137
138static void 138static __init void
139set_pte_phys(unsigned long vaddr, unsigned long phys, pgprot_t prot) 139set_pte_phys(unsigned long vaddr, unsigned long phys, pgprot_t prot)
140{ 140{
141 pgd_t *pgd; 141 pgd_t *pgd;
@@ -214,7 +214,7 @@ void __init cleanup_highmap(void)
214} 214}
215 215
216/* NOTE: this is meant to be run only at boot */ 216/* NOTE: this is meant to be run only at boot */
217void __set_fixmap(enum fixed_addresses idx, unsigned long phys, pgprot_t prot) 217void __init __set_fixmap(enum fixed_addresses idx, unsigned long phys, pgprot_t prot)
218{ 218{
219 unsigned long address = __fix_to_virt(idx); 219 unsigned long address = __fix_to_virt(idx);
220 220
@@ -506,7 +506,7 @@ early_param("memtest", parse_memtest);
506 506
507static void __init early_memtest(unsigned long start, unsigned long end) 507static void __init early_memtest(unsigned long start, unsigned long end)
508{ 508{
509 u64 t_start, t_size; 509 unsigned long t_start, t_size;
510 unsigned pattern; 510 unsigned pattern;
511 511
512 if (!memtest_pattern) 512 if (!memtest_pattern)
@@ -525,7 +525,7 @@ static void __init early_memtest(unsigned long start, unsigned long end)
525 if (t_start + t_size > end) 525 if (t_start + t_size > end)
526 t_size = end - t_start; 526 t_size = end - t_start;
527 527
528 printk(KERN_CONT "\n %016llx - %016llx pattern %d", 528 printk(KERN_CONT "\n %016lx - %016lx pattern %d",
529 t_start, t_start + t_size, pattern); 529 t_start, t_start + t_size, pattern);
530 530
531 memtest(t_start, t_size, pattern); 531 memtest(t_start, t_size, pattern);
diff --git a/arch/x86/xen/Kconfig b/arch/x86/xen/Kconfig
index 2e641be2737e..6c388e593bc8 100644
--- a/arch/x86/xen/Kconfig
+++ b/arch/x86/xen/Kconfig
@@ -5,8 +5,9 @@
5config XEN 5config XEN
6 bool "Xen guest support" 6 bool "Xen guest support"
7 select PARAVIRT 7 select PARAVIRT
8 select PARAVIRT_CLOCK
8 depends on X86_32 9 depends on X86_32
9 depends on X86_CMPXCHG && X86_TSC && !(X86_VISWS || X86_VOYAGER) 10 depends on X86_CMPXCHG && X86_TSC && X86_PAE && !(X86_VISWS || X86_VOYAGER)
10 help 11 help
11 This is the Linux Xen port. Enabling this will allow the 12 This is the Linux Xen port. Enabling this will allow the
12 kernel to boot in a paravirtualized environment under the 13 kernel to boot in a paravirtualized environment under the
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index c8a56e457d61..f09c1c69c37a 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -785,38 +785,35 @@ static __init void xen_set_pte_init(pte_t *ptep, pte_t pte)
785static __init void xen_pagetable_setup_start(pgd_t *base) 785static __init void xen_pagetable_setup_start(pgd_t *base)
786{ 786{
787 pgd_t *xen_pgd = (pgd_t *)xen_start_info->pt_base; 787 pgd_t *xen_pgd = (pgd_t *)xen_start_info->pt_base;
788 int i;
788 789
789 /* special set_pte for pagetable initialization */ 790 /* special set_pte for pagetable initialization */
790 pv_mmu_ops.set_pte = xen_set_pte_init; 791 pv_mmu_ops.set_pte = xen_set_pte_init;
791 792
792 init_mm.pgd = base; 793 init_mm.pgd = base;
793 /* 794 /*
794 * copy top-level of Xen-supplied pagetable into place. For 795 * copy top-level of Xen-supplied pagetable into place. This
795 * !PAE we can use this as-is, but for PAE it is a stand-in 796 * is a stand-in while we copy the pmd pages.
796 * while we copy the pmd pages.
797 */ 797 */
798 memcpy(base, xen_pgd, PTRS_PER_PGD * sizeof(pgd_t)); 798 memcpy(base, xen_pgd, PTRS_PER_PGD * sizeof(pgd_t));
799 799
800 if (PTRS_PER_PMD > 1) { 800 /*
801 int i; 801 * For PAE, need to allocate new pmds, rather than
802 /* 802 * share Xen's, since Xen doesn't like pmd's being
803 * For PAE, need to allocate new pmds, rather than 803 * shared between address spaces.
804 * share Xen's, since Xen doesn't like pmd's being 804 */
805 * shared between address spaces. 805 for (i = 0; i < PTRS_PER_PGD; i++) {
806 */ 806 if (pgd_val_ma(xen_pgd[i]) & _PAGE_PRESENT) {
807 for (i = 0; i < PTRS_PER_PGD; i++) { 807 pmd_t *pmd = (pmd_t *)alloc_bootmem_low_pages(PAGE_SIZE);
808 if (pgd_val_ma(xen_pgd[i]) & _PAGE_PRESENT) {
809 pmd_t *pmd = (pmd_t *)alloc_bootmem_low_pages(PAGE_SIZE);
810 808
811 memcpy(pmd, (void *)pgd_page_vaddr(xen_pgd[i]), 809 memcpy(pmd, (void *)pgd_page_vaddr(xen_pgd[i]),
812 PAGE_SIZE); 810 PAGE_SIZE);
813 811
814 make_lowmem_page_readonly(pmd); 812 make_lowmem_page_readonly(pmd);
815 813
816 set_pgd(&base[i], __pgd(1 + __pa(pmd))); 814 set_pgd(&base[i], __pgd(1 + __pa(pmd)));
817 } else 815 } else
818 pgd_clear(&base[i]); 816 pgd_clear(&base[i]);
819 }
820 } 817 }
821 818
822 /* make sure zero_page is mapped RO so we can use it in pagetables */ 819 /* make sure zero_page is mapped RO so we can use it in pagetables */
@@ -873,17 +870,7 @@ static __init void xen_pagetable_setup_done(pgd_t *base)
873 870
874 /* Actually pin the pagetable down, but we can't set PG_pinned 871 /* Actually pin the pagetable down, but we can't set PG_pinned
875 yet because the page structures don't exist yet. */ 872 yet because the page structures don't exist yet. */
876 { 873 pin_pagetable_pfn(MMUEXT_PIN_L3_TABLE, PFN_DOWN(__pa(base)));
877 unsigned level;
878
879#ifdef CONFIG_X86_PAE
880 level = MMUEXT_PIN_L3_TABLE;
881#else
882 level = MMUEXT_PIN_L2_TABLE;
883#endif
884
885 pin_pagetable_pfn(level, PFN_DOWN(__pa(base)));
886 }
887} 874}
888 875
889/* This is called once we have the cpu_possible_map */ 876/* This is called once we have the cpu_possible_map */
@@ -1093,7 +1080,6 @@ static const struct pv_mmu_ops xen_mmu_ops __initdata = {
1093 .make_pte = xen_make_pte, 1080 .make_pte = xen_make_pte,
1094 .make_pgd = xen_make_pgd, 1081 .make_pgd = xen_make_pgd,
1095 1082
1096#ifdef CONFIG_X86_PAE
1097 .set_pte_atomic = xen_set_pte_atomic, 1083 .set_pte_atomic = xen_set_pte_atomic,
1098 .set_pte_present = xen_set_pte_at, 1084 .set_pte_present = xen_set_pte_at,
1099 .set_pud = xen_set_pud, 1085 .set_pud = xen_set_pud,
@@ -1102,7 +1088,6 @@ static const struct pv_mmu_ops xen_mmu_ops __initdata = {
1102 1088
1103 .make_pmd = xen_make_pmd, 1089 .make_pmd = xen_make_pmd,
1104 .pmd_val = xen_pmd_val, 1090 .pmd_val = xen_pmd_val,
1105#endif /* PAE */
1106 1091
1107 .activate_mm = xen_activate_mm, 1092 .activate_mm = xen_activate_mm,
1108 .dup_mmap = xen_dup_mmap, 1093 .dup_mmap = xen_dup_mmap,
@@ -1228,6 +1213,11 @@ asmlinkage void __init xen_start_kernel(void)
1228 if (xen_feature(XENFEAT_supervisor_mode_kernel)) 1213 if (xen_feature(XENFEAT_supervisor_mode_kernel))
1229 pv_info.kernel_rpl = 0; 1214 pv_info.kernel_rpl = 0;
1230 1215
1216 /* Prevent unwanted bits from being set in PTEs. */
1217 __supported_pte_mask &= ~_PAGE_GLOBAL;
1218 if (!is_initial_xendomain())
1219 __supported_pte_mask &= ~(_PAGE_PWT | _PAGE_PCD);
1220
1231 /* set the limit of our address space */ 1221 /* set the limit of our address space */
1232 xen_reserve_top(); 1222 xen_reserve_top();
1233 1223
diff --git a/arch/x86/xen/mmu.c b/arch/x86/xen/mmu.c
index 3525ef523a74..df40bf74ea75 100644
--- a/arch/x86/xen/mmu.c
+++ b/arch/x86/xen/mmu.c
@@ -179,50 +179,56 @@ out:
179 preempt_enable(); 179 preempt_enable();
180} 180}
181 181
182pteval_t xen_pte_val(pte_t pte) 182/* Assume pteval_t is equivalent to all the other *val_t types. */
183static pteval_t pte_mfn_to_pfn(pteval_t val)
184{
185 if (val & _PAGE_PRESENT) {
186 unsigned long mfn = (val & PTE_MASK) >> PAGE_SHIFT;
187 pteval_t flags = val & ~PTE_MASK;
188 val = (mfn_to_pfn(mfn) << PAGE_SHIFT) | flags;
189 }
190
191 return val;
192}
193
194static pteval_t pte_pfn_to_mfn(pteval_t val)
183{ 195{
184 pteval_t ret = pte.pte; 196 if (val & _PAGE_PRESENT) {
197 unsigned long pfn = (val & PTE_MASK) >> PAGE_SHIFT;
198 pteval_t flags = val & ~PTE_MASK;
199 val = (pfn_to_mfn(pfn) << PAGE_SHIFT) | flags;
200 }
185 201
186 if (ret & _PAGE_PRESENT) 202 return val;
187 ret = machine_to_phys(XMADDR(ret)).paddr | _PAGE_PRESENT; 203}
188 204
189 return ret; 205pteval_t xen_pte_val(pte_t pte)
206{
207 return pte_mfn_to_pfn(pte.pte);
190} 208}
191 209
192pgdval_t xen_pgd_val(pgd_t pgd) 210pgdval_t xen_pgd_val(pgd_t pgd)
193{ 211{
194 pgdval_t ret = pgd.pgd; 212 return pte_mfn_to_pfn(pgd.pgd);
195 if (ret & _PAGE_PRESENT)
196 ret = machine_to_phys(XMADDR(ret)).paddr | _PAGE_PRESENT;
197 return ret;
198} 213}
199 214
200pte_t xen_make_pte(pteval_t pte) 215pte_t xen_make_pte(pteval_t pte)
201{ 216{
202 if (pte & _PAGE_PRESENT) { 217 pte = pte_pfn_to_mfn(pte);
203 pte = phys_to_machine(XPADDR(pte)).maddr; 218 return native_make_pte(pte);
204 pte &= ~(_PAGE_PCD | _PAGE_PWT);
205 }
206
207 return (pte_t){ .pte = pte };
208} 219}
209 220
210pgd_t xen_make_pgd(pgdval_t pgd) 221pgd_t xen_make_pgd(pgdval_t pgd)
211{ 222{
212 if (pgd & _PAGE_PRESENT) 223 pgd = pte_pfn_to_mfn(pgd);
213 pgd = phys_to_machine(XPADDR(pgd)).maddr; 224 return native_make_pgd(pgd);
214
215 return (pgd_t){ pgd };
216} 225}
217 226
218pmdval_t xen_pmd_val(pmd_t pmd) 227pmdval_t xen_pmd_val(pmd_t pmd)
219{ 228{
220 pmdval_t ret = native_pmd_val(pmd); 229 return pte_mfn_to_pfn(pmd.pmd);
221 if (ret & _PAGE_PRESENT)
222 ret = machine_to_phys(XMADDR(ret)).paddr | _PAGE_PRESENT;
223 return ret;
224} 230}
225#ifdef CONFIG_X86_PAE 231
226void xen_set_pud(pud_t *ptr, pud_t val) 232void xen_set_pud(pud_t *ptr, pud_t val)
227{ 233{
228 struct multicall_space mcs; 234 struct multicall_space mcs;
@@ -267,17 +273,9 @@ void xen_pmd_clear(pmd_t *pmdp)
267 273
268pmd_t xen_make_pmd(pmdval_t pmd) 274pmd_t xen_make_pmd(pmdval_t pmd)
269{ 275{
270 if (pmd & _PAGE_PRESENT) 276 pmd = pte_pfn_to_mfn(pmd);
271 pmd = phys_to_machine(XPADDR(pmd)).maddr;
272
273 return native_make_pmd(pmd); 277 return native_make_pmd(pmd);
274} 278}
275#else /* !PAE */
276void xen_set_pte(pte_t *ptep, pte_t pte)
277{
278 *ptep = pte;
279}
280#endif /* CONFIG_X86_PAE */
281 279
282/* 280/*
283 (Yet another) pagetable walker. This one is intended for pinning a 281 (Yet another) pagetable walker. This one is intended for pinning a
@@ -430,8 +428,6 @@ static int pin_page(struct page *page, enum pt_level level)
430 read-only, and can be pinned. */ 428 read-only, and can be pinned. */
431void xen_pgd_pin(pgd_t *pgd) 429void xen_pgd_pin(pgd_t *pgd)
432{ 430{
433 unsigned level;
434
435 xen_mc_batch(); 431 xen_mc_batch();
436 432
437 if (pgd_walk(pgd, pin_page, TASK_SIZE)) { 433 if (pgd_walk(pgd, pin_page, TASK_SIZE)) {
@@ -441,14 +437,7 @@ void xen_pgd_pin(pgd_t *pgd)
441 xen_mc_batch(); 437 xen_mc_batch();
442 } 438 }
443 439
444#ifdef CONFIG_X86_PAE 440 xen_do_pin(MMUEXT_PIN_L3_TABLE, PFN_DOWN(__pa(pgd)));
445 level = MMUEXT_PIN_L3_TABLE;
446#else
447 level = MMUEXT_PIN_L2_TABLE;
448#endif
449
450 xen_do_pin(level, PFN_DOWN(__pa(pgd)));
451
452 xen_mc_issue(0); 441 xen_mc_issue(0);
453} 442}
454 443
diff --git a/arch/x86/xen/mmu.h b/arch/x86/xen/mmu.h
index b5e189b1519d..5fe961caffd4 100644
--- a/arch/x86/xen/mmu.h
+++ b/arch/x86/xen/mmu.h
@@ -37,14 +37,13 @@ void xen_exit_mmap(struct mm_struct *mm);
37void xen_pgd_pin(pgd_t *pgd); 37void xen_pgd_pin(pgd_t *pgd);
38//void xen_pgd_unpin(pgd_t *pgd); 38//void xen_pgd_unpin(pgd_t *pgd);
39 39
40#ifdef CONFIG_X86_PAE 40pteval_t xen_pte_val(pte_t);
41unsigned long long xen_pte_val(pte_t); 41pmdval_t xen_pmd_val(pmd_t);
42unsigned long long xen_pmd_val(pmd_t); 42pgdval_t xen_pgd_val(pgd_t);
43unsigned long long xen_pgd_val(pgd_t);
44 43
45pte_t xen_make_pte(unsigned long long); 44pte_t xen_make_pte(pteval_t);
46pmd_t xen_make_pmd(unsigned long long); 45pmd_t xen_make_pmd(pmdval_t);
47pgd_t xen_make_pgd(unsigned long long); 46pgd_t xen_make_pgd(pgdval_t);
48 47
49void xen_set_pte_at(struct mm_struct *mm, unsigned long addr, 48void xen_set_pte_at(struct mm_struct *mm, unsigned long addr,
50 pte_t *ptep, pte_t pteval); 49 pte_t *ptep, pte_t pteval);
@@ -53,15 +52,4 @@ void xen_set_pud(pud_t *ptr, pud_t val);
53void xen_pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep); 52void xen_pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep);
54void xen_pmd_clear(pmd_t *pmdp); 53void xen_pmd_clear(pmd_t *pmdp);
55 54
56
57#else
58unsigned long xen_pte_val(pte_t);
59unsigned long xen_pmd_val(pmd_t);
60unsigned long xen_pgd_val(pgd_t);
61
62pte_t xen_make_pte(unsigned long);
63pmd_t xen_make_pmd(unsigned long);
64pgd_t xen_make_pgd(unsigned long);
65#endif
66
67#endif /* _XEN_MMU_H */ 55#endif /* _XEN_MMU_H */
diff --git a/arch/x86/xen/time.c b/arch/x86/xen/time.c
index 52b2e3856980..41e217503c96 100644
--- a/arch/x86/xen/time.c
+++ b/arch/x86/xen/time.c
@@ -14,6 +14,7 @@
14#include <linux/kernel_stat.h> 14#include <linux/kernel_stat.h>
15#include <linux/math64.h> 15#include <linux/math64.h>
16 16
17#include <asm/pvclock.h>
17#include <asm/xen/hypervisor.h> 18#include <asm/xen/hypervisor.h>
18#include <asm/xen/hypercall.h> 19#include <asm/xen/hypercall.h>
19 20
@@ -31,17 +32,6 @@
31 32
32static cycle_t xen_clocksource_read(void); 33static cycle_t xen_clocksource_read(void);
33 34
34/* These are perodically updated in shared_info, and then copied here. */
35struct shadow_time_info {
36 u64 tsc_timestamp; /* TSC at last update of time vals. */
37 u64 system_timestamp; /* Time, in nanosecs, since boot. */
38 u32 tsc_to_nsec_mul;
39 int tsc_shift;
40 u32 version;
41};
42
43static DEFINE_PER_CPU(struct shadow_time_info, shadow_time);
44
45/* runstate info updated by Xen */ 35/* runstate info updated by Xen */
46static DEFINE_PER_CPU(struct vcpu_runstate_info, runstate); 36static DEFINE_PER_CPU(struct vcpu_runstate_info, runstate);
47 37
@@ -211,7 +201,7 @@ unsigned long long xen_sched_clock(void)
211unsigned long xen_cpu_khz(void) 201unsigned long xen_cpu_khz(void)
212{ 202{
213 u64 xen_khz = 1000000ULL << 32; 203 u64 xen_khz = 1000000ULL << 32;
214 const struct vcpu_time_info *info = 204 const struct pvclock_vcpu_time_info *info =
215 &HYPERVISOR_shared_info->vcpu_info[0].time; 205 &HYPERVISOR_shared_info->vcpu_info[0].time;
216 206
217 do_div(xen_khz, info->tsc_to_system_mul); 207 do_div(xen_khz, info->tsc_to_system_mul);
@@ -223,121 +213,26 @@ unsigned long xen_cpu_khz(void)
223 return xen_khz; 213 return xen_khz;
224} 214}
225 215
226/*
227 * Reads a consistent set of time-base values from Xen, into a shadow data
228 * area.
229 */
230static unsigned get_time_values_from_xen(void)
231{
232 struct vcpu_time_info *src;
233 struct shadow_time_info *dst;
234
235 /* src is shared memory with the hypervisor, so we need to
236 make sure we get a consistent snapshot, even in the face of
237 being preempted. */
238 src = &__get_cpu_var(xen_vcpu)->time;
239 dst = &__get_cpu_var(shadow_time);
240
241 do {
242 dst->version = src->version;
243 rmb(); /* fetch version before data */
244 dst->tsc_timestamp = src->tsc_timestamp;
245 dst->system_timestamp = src->system_time;
246 dst->tsc_to_nsec_mul = src->tsc_to_system_mul;
247 dst->tsc_shift = src->tsc_shift;
248 rmb(); /* test version after fetching data */
249 } while ((src->version & 1) | (dst->version ^ src->version));
250
251 return dst->version;
252}
253
254/*
255 * Scale a 64-bit delta by scaling and multiplying by a 32-bit fraction,
256 * yielding a 64-bit result.
257 */
258static inline u64 scale_delta(u64 delta, u32 mul_frac, int shift)
259{
260 u64 product;
261#ifdef __i386__
262 u32 tmp1, tmp2;
263#endif
264
265 if (shift < 0)
266 delta >>= -shift;
267 else
268 delta <<= shift;
269
270#ifdef __i386__
271 __asm__ (
272 "mul %5 ; "
273 "mov %4,%%eax ; "
274 "mov %%edx,%4 ; "
275 "mul %5 ; "
276 "xor %5,%5 ; "
277 "add %4,%%eax ; "
278 "adc %5,%%edx ; "
279 : "=A" (product), "=r" (tmp1), "=r" (tmp2)
280 : "a" ((u32)delta), "1" ((u32)(delta >> 32)), "2" (mul_frac) );
281#elif __x86_64__
282 __asm__ (
283 "mul %%rdx ; shrd $32,%%rdx,%%rax"
284 : "=a" (product) : "0" (delta), "d" ((u64)mul_frac) );
285#else
286#error implement me!
287#endif
288
289 return product;
290}
291
292static u64 get_nsec_offset(struct shadow_time_info *shadow)
293{
294 u64 now, delta;
295 now = native_read_tsc();
296 delta = now - shadow->tsc_timestamp;
297 return scale_delta(delta, shadow->tsc_to_nsec_mul, shadow->tsc_shift);
298}
299
300static cycle_t xen_clocksource_read(void) 216static cycle_t xen_clocksource_read(void)
301{ 217{
302 struct shadow_time_info *shadow = &get_cpu_var(shadow_time); 218 struct pvclock_vcpu_time_info *src;
303 cycle_t ret; 219 cycle_t ret;
304 unsigned version;
305
306 do {
307 version = get_time_values_from_xen();
308 barrier();
309 ret = shadow->system_timestamp + get_nsec_offset(shadow);
310 barrier();
311 } while (version != __get_cpu_var(xen_vcpu)->time.version);
312
313 put_cpu_var(shadow_time);
314 220
221 src = &get_cpu_var(xen_vcpu)->time;
222 ret = pvclock_clocksource_read(src);
223 put_cpu_var(xen_vcpu);
315 return ret; 224 return ret;
316} 225}
317 226
318static void xen_read_wallclock(struct timespec *ts) 227static void xen_read_wallclock(struct timespec *ts)
319{ 228{
320 const struct shared_info *s = HYPERVISOR_shared_info; 229 struct shared_info *s = HYPERVISOR_shared_info;
321 u32 version; 230 struct pvclock_wall_clock *wall_clock = &(s->wc);
322 u64 delta; 231 struct pvclock_vcpu_time_info *vcpu_time;
323 struct timespec now;
324
325 /* get wallclock at system boot */
326 do {
327 version = s->wc_version;
328 rmb(); /* fetch version before time */
329 now.tv_sec = s->wc_sec;
330 now.tv_nsec = s->wc_nsec;
331 rmb(); /* fetch time before checking version */
332 } while ((s->wc_version & 1) | (version ^ s->wc_version));
333 232
334 delta = xen_clocksource_read(); /* time since system boot */ 233 vcpu_time = &get_cpu_var(xen_vcpu)->time;
335 delta += now.tv_sec * (u64)NSEC_PER_SEC + now.tv_nsec; 234 pvclock_read_wallclock(wall_clock, vcpu_time, ts);
336 235 put_cpu_var(xen_vcpu);
337 now.tv_nsec = do_div(delta, NSEC_PER_SEC);
338 now.tv_sec = delta;
339
340 set_normalized_timespec(ts, now.tv_sec, now.tv_nsec);
341} 236}
342 237
343unsigned long xen_get_wallclock(void) 238unsigned long xen_get_wallclock(void)
@@ -345,7 +240,6 @@ unsigned long xen_get_wallclock(void)
345 struct timespec ts; 240 struct timespec ts;
346 241
347 xen_read_wallclock(&ts); 242 xen_read_wallclock(&ts);
348
349 return ts.tv_sec; 243 return ts.tv_sec;
350} 244}
351 245
@@ -569,8 +463,6 @@ __init void xen_time_init(void)
569{ 463{
570 int cpu = smp_processor_id(); 464 int cpu = smp_processor_id();
571 465
572 get_time_values_from_xen();
573
574 clocksource_register(&xen_clocksource); 466 clocksource_register(&xen_clocksource);
575 467
576 if (HYPERVISOR_vcpu_op(VCPUOP_stop_periodic_timer, cpu, NULL) == 0) { 468 if (HYPERVISOR_vcpu_op(VCPUOP_stop_periodic_timer, cpu, NULL) == 0) {
diff --git a/arch/x86/xen/xen-head.S b/arch/x86/xen/xen-head.S
index 288d587ce73c..6ec3b4f7719b 100644
--- a/arch/x86/xen/xen-head.S
+++ b/arch/x86/xen/xen-head.S
@@ -17,7 +17,7 @@ ENTRY(startup_xen)
17 17
18 __FINIT 18 __FINIT
19 19
20.pushsection .bss.page_aligned 20.pushsection .text
21 .align PAGE_SIZE_asm 21 .align PAGE_SIZE_asm
22ENTRY(hypercall_page) 22ENTRY(hypercall_page)
23 .skip 0x1000 23 .skip 0x1000
@@ -30,11 +30,7 @@ ENTRY(hypercall_page)
30 ELFNOTE(Xen, XEN_ELFNOTE_ENTRY, .long startup_xen) 30 ELFNOTE(Xen, XEN_ELFNOTE_ENTRY, .long startup_xen)
31 ELFNOTE(Xen, XEN_ELFNOTE_HYPERCALL_PAGE, .long hypercall_page) 31 ELFNOTE(Xen, XEN_ELFNOTE_HYPERCALL_PAGE, .long hypercall_page)
32 ELFNOTE(Xen, XEN_ELFNOTE_FEATURES, .asciz "!writable_page_tables|pae_pgdir_above_4gb") 32 ELFNOTE(Xen, XEN_ELFNOTE_FEATURES, .asciz "!writable_page_tables|pae_pgdir_above_4gb")
33#ifdef CONFIG_X86_PAE
34 ELFNOTE(Xen, XEN_ELFNOTE_PAE_MODE, .asciz "yes") 33 ELFNOTE(Xen, XEN_ELFNOTE_PAE_MODE, .asciz "yes")
35#else
36 ELFNOTE(Xen, XEN_ELFNOTE_PAE_MODE, .asciz "no")
37#endif
38 ELFNOTE(Xen, XEN_ELFNOTE_LOADER, .asciz "generic") 34 ELFNOTE(Xen, XEN_ELFNOTE_LOADER, .asciz "generic")
39 35
40#endif /*CONFIG_XEN */ 36#endif /*CONFIG_XEN */
diff --git a/block/as-iosched.c b/block/as-iosched.c
index 8c3946787dbb..743f33a01a07 100644
--- a/block/as-iosched.c
+++ b/block/as-iosched.c
@@ -831,6 +831,8 @@ static void as_completed_request(struct request_queue *q, struct request *rq)
831 } 831 }
832 832
833 if (ad->changed_batch && ad->nr_dispatched == 1) { 833 if (ad->changed_batch && ad->nr_dispatched == 1) {
834 ad->current_batch_expires = jiffies +
835 ad->batch_expire[ad->batch_data_dir];
834 kblockd_schedule_work(&ad->antic_work); 836 kblockd_schedule_work(&ad->antic_work);
835 ad->changed_batch = 0; 837 ad->changed_batch = 0;
836 838
diff --git a/drivers/acorn/char/Makefile b/drivers/acorn/char/Makefile
deleted file mode 100644
index d006c9f168d2..000000000000
--- a/drivers/acorn/char/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
1#
2# Makefile for the acorn character device drivers.
3#
4
5obj-$(CONFIG_L7200_KEYB) += defkeymap-l7200.o keyb_l7200.o
diff --git a/drivers/acorn/char/defkeymap-l7200.c b/drivers/acorn/char/defkeymap-l7200.c
deleted file mode 100644
index 93d80a1c36f9..000000000000
--- a/drivers/acorn/char/defkeymap-l7200.c
+++ /dev/null
@@ -1,386 +0,0 @@
1/*
2 * linux/drivers/acorn/char/defkeymap-l7200.c
3 *
4 * Default keyboard maps for LinkUp Systems L7200 board
5 *
6 * Copyright (C) 2000 Steve Hill (sjhill@cotw.com)
7 *
8 * Changelog:
9 * 08-04-2000 SJH Created file
10 */
11
12#include <linux/types.h>
13#include <linux/keyboard.h>
14#include <linux/kd.h>
15
16/* Normal (maps 1:1 with no processing) */
17#define KTn 0xF0
18/* Function keys */
19#define KTf 0xF1
20/* Special (Performs special house-keeping funcs) */
21#define KTs 0xF2
22#define KIGNORE K(KTs, 0) /* Ignore */
23#define KENTER K(KTs, 1) /* Enter */
24#define KREGS K(KTs, 2) /* Regs */
25#define KMEM K(KTs, 3) /* Mem */
26#define KSTAT K(KTs, 4) /* State */
27#define KINTR K(KTs, 5) /* Intr */
28#define Ksl 6 /* Last console */
29#define KCAPSLK K(KTs, 7) /* Caps lock */
30#define KNUMLK K(KTs, 8) /* Num-lock */
31#define KSCRLLK K(KTs, 9) /* Scroll-lock */
32#define KSCRLFOR K(KTs,10) /* Scroll forward */
33#define KSCRLBAK K(KTs,11) /* Scroll back */
34#define KREBOOT K(KTs,12) /* Reboot */
35#define KCAPSON K(KTs,13) /* Caps on */
36#define KCOMPOSE K(KTs,14) /* Compose */
37#define KSAK K(KTs,15) /* SAK */
38#define CONS_DEC K(KTs,16) /* Dec console */
39#define CONS_INC K(KTs,17) /* Incr console */
40#define KFLOPPY K(KTs,18) /* Floppy */
41/* Key pad (0-9 = digits, 10=+, 11=-, 12=*, 13=/, 14=enter, 16=., 17=# */
42#define KTp 0xF3
43#define KPAD_0 K(KTp, 0 )
44#define KPAD_1 K(KTp, 1 )
45#define KPAD_2 K(KTp, 2 )
46#define KPAD_3 K(KTp, 3 )
47#define KPAD_4 K(KTp, 4 )
48#define KPAD_5 K(KTp, 5 )
49#define KPAD_6 K(KTp, 6 )
50#define KPAD_7 K(KTp, 7 )
51#define KPAD_8 K(KTp, 8 )
52#define KPAD_9 K(KTp, 9 )
53#define KPAD_PL K(KTp,10 )
54#define KPAD_MI K(KTp,11 )
55#define KPAD_ML K(KTp,12 )
56#define KPAD_DV K(KTp,13 )
57#define KPAD_EN K(KTp,14 )
58#define KPAD_DT K(KTp,16 )
59#define KPAD_HS K(KTp,20 )
60/* Console switching */
61#define KCn 0xF5
62/* Cursor */
63#define KTc 0xF6
64#define Kcd 0 /* Cursor down */
65#define Kcl 1 /* Cursor left */
66#define Kcr 2 /* Cursor right */
67#define Kcu 3 /* Cursor up */
68/* Shift/alt modifiers etc */
69#define KMd 0xF7
70#define KSHIFT K(KMd, 0 )
71#define KALTGR K(KMd, 1 )
72#define KCTRL K(KMd, 2 )
73#define KALT K(KMd, 3 )
74/* Meta */
75#define KMt 0xF8
76#define KAs 0xF9
77#define KPADA_0 K(KAs, 0 )
78#define KPADA_1 K(KAs, 1 )
79#define KPADA_2 K(KAs, 2 )
80#define KPADA_3 K(KAs, 3 )
81#define KPADA_4 K(KAs, 4 )
82#define KPADA_5 K(KAs, 5 )
83#define KPADA_6 K(KAs, 6 )
84#define KPADA_7 K(KAs, 7 )
85#define KPADA_8 K(KAs, 8 )
86#define KPADA_9 K(KAs, 9 )
87#define KPADB_0 K(KAs,10 )
88#define KPADB_1 K(KAs,11 )
89#define KPADB_2 K(KAs,12 )
90#define KPADB_3 K(KAs,13 )
91#define KPADB_4 K(KAs,14 )
92#define KPADB_5 K(KAs,15 )
93#define KPADB_6 K(KAs,16 )
94#define KPADB_7 K(KAs,17 )
95#define KPADB_8 K(KAs,18 )
96#define KPADB_9 K(KAs,19 )
97/* Locking keys */
98#define KLk 0xFA
99/* Letters */
100#define KTl 0xFB
101
102/*
103 * Here is the layout of the keys for the Fujitsu QWERTY
104 * style keyboard:
105 *
106 * static char Fujitsu_Key_Table[] =
107 * {
108 * KALT, '`' , KNUL, KCTL, KFUN, KESC, '1' , '2' ,
109 * '9' , '0' , '-' , '=' , KNUL, KBSP, KNUL, KNUL,
110 * KNUL, KBSL, KSHF, KNUL, KNUL, KDEL, KNUL, 't' ,
111 * 'y' , 'u' , 'i' , KRET, KSHF, KPGD, KNUL, KNUL,
112 * KNUL, KTAB, KNUL, KNUL, KNUL, 'q' , 'w' , 'e' ,
113 * 'r' , 'o' , 'p' , '[' , KNUL, ']' , KNUL, KNUL,
114 * KNUL, 'z' , KNUL, KNUL, KNUL, KSHL, KNUL, KNUL,
115 * 'k' , 'l' , ';' , KSQT, KNUL, KPGU, KNUL, KNUL,
116 * KNUL, 'a' , KNUL, KNUL, KNUL, 's' , 'd' , 'f' ,
117 * 'g' , 'h' , 'j' , '/' , KNUL, KHME, KNUL, KNUL,
118 * KNUL, 'x' , KNUL, KNUL, KNUL, 'c' , 'v' , 'b' ,
119 * 'n' , 'm' , ',' , '.' , KNUL, ' ' , KNUL, KNUL,
120 * KNUL, KNUL, KNUL, KNUL, KNUL, '3' , '4' , '5' ,
121 * '6' , '7' , '8' , KNUL, KPRG, KNUL, KEND, KNUL,
122 * };
123 */
124
125u_short plain_map[NR_KEYS]=
126{
127 0xf703, 0xf060, 0xf200, 0xf702, 0xf200, 0xf01b, 0xf031, 0xf032,
128 0xf039, 0xf030, 0xf02d, 0xf03d, 0xf200, 0xf07f, 0xf200, 0xf200,
129 0xf200, 0xf05c, 0xf700, 0xf200, 0xf200, 0xf116, 0xf000, 0xfb74,
130 0xfb79, 0xfb75, 0xfb69, 0xf201, 0xf700, 0xf600, 0xf200, 0xf200,
131 0xf200, 0xf009, 0xf200, 0xf200, 0xf200, 0xfb71, 0xfb77, 0xfb65,
132 0xfb72, 0xfb6f, 0xfb70, 0xf05b, 0xf200, 0xf05d, 0xf200, 0xf200,
133 0xf200, 0xfb7a, 0xf200, 0xf200, 0xf200, 0xf207, 0xf200, 0xf200,
134 0xfb6b, 0xfb6c, 0xf03b, 0xf027, 0xf200, 0xf603, 0xf200, 0xf200,
135 0xf200, 0xfb61, 0xf200, 0xf200, 0xf200, 0xfb73, 0xfb64, 0xfb66,
136 0xfb67, 0xfb68, 0xfb6a, 0xf02f, 0xf200, 0xf601, 0xf200, 0xf200,
137 0xf200, 0xfb78, 0xf200, 0xf200, 0xf200, 0xfb63, 0xfb76, 0xfb62,
138 0xfb6e, 0xfb6d, 0xf02c, 0xf02e, 0xf200, 0xf020, 0xf200, 0xf200,
139 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf033, 0xf034, 0xf035,
140 0xf036, 0xf037, 0xf038, 0xf200, 0xf200, 0xf200, 0xf602, 0xf200,
141 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
142 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
143};
144
145u_short shift_map[NR_KEYS]=
146{
147 0xf703, 0xf07e, 0xf200, 0xf702, 0xf200, 0xf01b, 0xf021, 0xf040,
148 0xf028, 0xf029, 0xf05f, 0xf02b, 0xf200, 0xf07f, 0xf200, 0xf200,
149 0xf200, 0xf07c, 0xf700, 0xf200, 0xf200, 0xf116, 0xf000, 0xfb54,
150 0xfb59, 0xfb55, 0xfb49, 0xf201, 0xf700, 0xf600, 0xf200, 0xf200,
151 0xf200, 0xf009, 0xf200, 0xf200, 0xf200, 0xfb51, 0xfb57, 0xfb45,
152 0xfb52, 0xfb4f, 0xfb50, 0xf07b, 0xf200, 0xf07d, 0xf200, 0xf200,
153 0xf200, 0xfb5a, 0xf200, 0xf200, 0xf200, 0xf207, 0xf200, 0xf200,
154 0xfb4b, 0xfb4c, 0xf03a, 0xf022, 0xf200, 0xf603, 0xf200, 0xf200,
155 0xf200, 0xfb41, 0xf200, 0xf200, 0xf200, 0xfb53, 0xfb44, 0xfb46,
156 0xfb47, 0xfb48, 0xfb4a, 0xf03f, 0xf200, 0xf601, 0xf200, 0xf200,
157 0xf200, 0xfb58, 0xf200, 0xf200, 0xf200, 0xfb43, 0xfb56, 0xfb42,
158 0xfb4e, 0xfb4d, 0xf03c, 0xf03e, 0xf200, 0xf020, 0xf200, 0xf200,
159 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf023, 0xf024, 0xf025,
160 0xf05e, 0xf026, 0xf02a, 0xf200, 0xf200, 0xf200, 0xf602, 0xf200,
161 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
162 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
163};
164
165u_short altgr_map[NR_KEYS]=
166{
167 KIGNORE ,K(KCn,12 ),K(KCn,13 ),K(KCn,14 ),K(KCn,15 ),K(KCn,16 ),K(KCn,17 ),K(KCn, 18),
168 K(KCn, 19),K(KCn,20 ),K(KCn,21 ),K(KCn,22 ),K(KCn,23 ),KIGNORE ,KREGS ,KINTR ,
169 KIGNORE ,KIGNORE ,K(KTn,'@'),KIGNORE ,K(KTn,'$'),KIGNORE ,KIGNORE ,K(KTn,'{'),
170 K(KTn,'['),K(KTn,']'),K(KTn,'}'),K(KTn,'\\'),KIGNORE ,KIGNORE ,KIGNORE ,K(KTf,21 ),
171 K(KTf,20 ),K(KTf,24 ),KNUMLK ,KPAD_DV ,KPAD_ML ,KPAD_HS ,KIGNORE ,K(KTl,'q'),
172 K(KTl,'w'),K(KTl,'e'),K(KTl,'r'),K(KTl,'t' ),K(KTl,'y'),K(KTl,'u'),K(KTl,'i' ),K(KTl,'o'),
173 K(KTl,'p'),KIGNORE ,K(KTn,'~'),KIGNORE ,K(KTf,22 ),K(KTf,23 ),K(KTf,25 ),KPADB_7 ,
174 KPADB_8 ,KPADB_9 ,KPAD_MI ,KCTRL ,K(KAs,20 ),K(KTl,'s'),K(KAs,23 ),K(KAs,25 ),
175 K(KTl,'g'),K(KTl,'h'),K(KTl,'j'),K(KTl,'k' ),K(KTl,'l'),KIGNORE ,KIGNORE ,KENTER ,
176 KPADB_4 ,KPADB_5 ,KPADB_6 ,KPAD_PL ,KSHIFT ,KIGNORE ,K(KTl,'z' ),K(KTl,'x'),
177 K(KAs,22 ),K(KTl,'v'),K(KTl,21 ),K(KTl,'n' ),K(KTl,'m'),KIGNORE ,KIGNORE ,KIGNORE ,
178 KSHIFT ,K(KTc,Kcu),KPADB_1 ,KPADB_2 ,KPADB_3 ,KCAPSLK ,KALT ,KIGNORE ,
179 KALTGR ,KCTRL ,K(KTc,Kcl),K(KTc,Kcd ),K(KTc,Kcr),KPADB_0 ,KPAD_DT ,KPAD_EN ,
180 KIGNORE ,KIGNORE ,KIGNORE ,KIGNORE ,KIGNORE ,KIGNORE ,KIGNORE ,KIGNORE ,
181 KIGNORE ,KIGNORE ,KIGNORE ,KIGNORE ,KIGNORE ,KIGNORE ,KIGNORE ,KIGNORE ,
182 KIGNORE ,KIGNORE ,KIGNORE ,KIGNORE ,KIGNORE ,KIGNORE ,KIGNORE ,KIGNORE ,
183};
184
185u_short ctrl_map[NR_KEYS]=
186{
187 0xf703, 0xf200, 0xf200, 0xf702, 0xf200, 0xf200, 0xf001, 0xf002,
188 0xf009, 0xf000, 0xf031, 0xf200, 0xf200, 0xf07f, 0xf200, 0xf200,
189 0xf200, 0xf01c, 0xf700, 0xf200, 0xf200, 0xf116, 0xf000, 0xf020,
190 0xf019, 0xf015, 0xf009, 0xf201, 0xf700, 0xf600, 0xf200, 0xf200,
191 0xf200, 0xf009, 0xf200, 0xf200, 0xf200, 0xf011, 0xf017, 0xf005,
192 0xf012, 0xf00f, 0xf010, 0xf01b, 0xf200, 0xf01d, 0xf200, 0xf200,
193 0xf200, 0xf01a, 0xf200, 0xf200, 0xf200, 0xf207, 0xf200, 0xf200,
194 0xf00b, 0xf00c, 0xf200, 0xf007, 0xf200, 0xf603, 0xf200, 0xf200,
195 0xf200, 0xf001, 0xf200, 0xf200, 0xf200, 0xf001, 0xf013, 0xf006,
196 0xf007, 0xf008, 0xf00a, 0xf07f, 0xf200, 0xf601, 0xf200, 0xf200,
197 0xf200, 0xf018, 0xf200, 0xf200, 0xf200, 0xf003, 0xf016, 0xf002,
198 0xf00e, 0xf00d, 0xf200, 0xf200, 0xf200, 0xf000, 0xf200, 0xf200,
199 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf01b, 0xf01c, 0xf01d,
200 0xf036, 0xf037, 0xf038, 0xf200, 0xf200, 0xf200, 0xf602, 0xf200,
201 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
202 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf602, 0xf200,
203};
204
205u_short shift_ctrl_map[NR_KEYS]=
206{
207 KIGNORE ,KIGNORE ,KIGNORE ,KIGNORE ,KIGNORE ,KIGNORE ,KIGNORE ,KIGNORE ,
208 KIGNORE ,KIGNORE ,KIGNORE ,KIGNORE ,KIGNORE ,KIGNORE ,KFLOPPY ,KINTR ,
209 KIGNORE ,KIGNORE ,K(KTn, 0 ),KIGNORE ,KIGNORE ,KIGNORE ,KIGNORE ,KIGNORE ,
210 KIGNORE ,KIGNORE ,KIGNORE ,K(KTn,31 ),KIGNORE ,KIGNORE ,KIGNORE ,K(KTf,21 ),
211 K(KTf,20 ),K(KTf,24 ),KNUMLK ,KPAD_DV ,KPAD_ML ,KPAD_HS ,KIGNORE ,K(KTn,17 ),
212 K(KTn,23 ),K(KTn, 5 ),K(KTn,18 ),K(KTn,20 ),K(KTn,25 ),K(KTn,21 ),K(KTn, 9 ),K(KTn,15 ),
213 K(KTn,16 ),KIGNORE ,KIGNORE ,KIGNORE ,K(KTf,22 ),K(KTf,23 ),K(KTf,25 ),KPAD_7 ,
214 KPAD_8 ,KPAD_9 ,KPAD_MI ,KCTRL ,K(KTn, 1 ),K(KTn,19 ),K(KTn, 4 ),K(KTn, 6 ),
215 K(KTn, 7 ),K(KTn, 8 ),K(KTn,10 ),K(KTn,11 ),K(KTn,12 ),KIGNORE ,K(KTn, 7 ),KENTER ,
216 KPAD_4 ,KPAD_5 ,KPAD_6 ,KPAD_PL ,KSHIFT ,KIGNORE ,K(KTn,26 ),K(KTn,24 ),
217 K(KTn, 3 ),K(KTn,22 ),K(KTn, 2 ),K(KTn,14 ),K(KTn,13 ),KIGNORE ,KIGNORE ,KIGNORE ,
218 KSHIFT ,K(KTc,Kcu),KPAD_1 ,KPAD_2 ,KPAD_3 ,KCAPSLK ,KALT ,K(KTn, 0 ),
219 KALTGR ,KCTRL ,K(KTc,Kcl),K(KTc,Kcd ),K(KTc,Kcr),KPAD_0 ,KPAD_DT ,KPAD_EN ,
220 KIGNORE ,KIGNORE ,KIGNORE ,KIGNORE ,KIGNORE ,KIGNORE ,KIGNORE ,KIGNORE ,
221 KIGNORE ,KIGNORE ,KIGNORE ,KIGNORE ,KIGNORE ,KIGNORE ,KIGNORE ,KIGNORE ,
222 KIGNORE ,KIGNORE ,KIGNORE ,KIGNORE ,KIGNORE ,KIGNORE ,KIGNORE ,KIGNORE ,
223};
224
225u_short alt_map[NR_KEYS]=
226{
227 K(KMt,27 ),K(KCn, 0 ),K(KCn, 1 ),K(KCn, 2 ),K(KCn, 3 ),K(KCn, 4 ),K(KCn, 5 ),K(KCn, 6 ),
228 K(KCn, 7 ),K(KCn, 8 ),K(KCn, 9 ),K(KCn,10 ),K(KCn,11 ),KIGNORE ,KSCRLLK ,KINTR ,
229 K(KMt,'`'),K(KMt,'1'),K(KMt,'2'),K(KMt,'3' ),K(KMt,'4'),K(KMt,'5'),K(KMt,'6' ),K(KMt,'7'),
230 K(KMt,'8'),K(KMt,'9'),K(KMt,'0'),K(KMt,'-' ),K(KMt,'='),K(KMt,'£'),K(KMt,127 ),K(KTf,21 ),
231 K(KTf,20 ),K(KTf,24 ),KNUMLK ,KPAD_DV ,KPAD_ML ,KPAD_HS ,K(KMt, 9 ),K(KMt,'q'),
232 K(KMt,'w'),K(KMt,'e'),K(KMt,'r'),K(KMt,'t' ),K(KMt,'y'),K(KMt,'u'),K(KMt,'i' ),K(KMt,'o'),
233 K(KMt,'p'),K(KMt,'['),K(KMt,']'),K(KMt,'\\'),K(KTf,22 ),K(KTf,23 ),K(KTf,25 ),KPADA_7 ,
234 KPADA_8 ,KPADA_9 ,KPAD_MI ,KCTRL ,K(KMt,'a'),K(KMt,'s'),K(KMt,'d' ),K(KMt,'f'),
235 K(KMt,'g'),K(KMt,'h'),K(KMt,'j'),K(KMt,'k' ),K(KMt,'l'),K(KMt,';'),K(KMt,'\''),K(KMt,13 ),
236 KPADA_4 ,KPADA_5 ,KPADA_6 ,KPAD_PL ,KSHIFT ,KIGNORE ,K(KMt,'z' ),K(KMt,'x'),
237 K(KMt,'c'),K(KMt,'v'),K(KMt,'b'),K(KMt,'n' ),K(KMt,'m'),K(KMt,','),K(KMt,'.' ),KIGNORE ,
238 KSHIFT ,K(KTc,Kcu),KPADA_1 ,KPADA_2 ,KPADA_3 ,KCAPSLK ,KALT ,K(KMt,' '),
239 KALTGR ,KCTRL ,CONS_DEC ,K(KTc,Kcd ),CONS_INC ,KPADA_0 ,KPAD_DT ,KPAD_EN ,
240 KIGNORE ,KIGNORE ,KIGNORE ,KIGNORE ,KIGNORE ,KIGNORE ,KIGNORE ,KIGNORE ,
241 KIGNORE ,KIGNORE ,KIGNORE ,KIGNORE ,KIGNORE ,KIGNORE ,KIGNORE ,KIGNORE ,
242 KIGNORE ,KIGNORE ,KIGNORE ,KIGNORE ,KIGNORE ,KIGNORE ,KIGNORE ,KIGNORE ,
243};
244
245u_short ctrl_alt_map[NR_KEYS]=
246{
247 KIGNORE ,K(KCn, 0 ),K(KCn, 1 ),K(KCn, 2 ),K(KCn, 3 ),K(KCn, 4 ),K(KCn, 5 ),K(KCn, 6 ),
248 K(KCn, 7 ),K(KCn, 8 ),K(KCn, 9 ),K(KCn,10 ),K(KCn,11 ),KIGNORE ,KIGNORE ,KINTR ,
249 KIGNORE ,KIGNORE ,KIGNORE ,KIGNORE ,KIGNORE ,KIGNORE ,KIGNORE ,KIGNORE ,
250 KIGNORE ,KIGNORE ,KIGNORE ,KIGNORE ,KIGNORE ,KIGNORE ,KIGNORE ,K(KTf,21 ),
251 K(KTf,20 ),K(KTf,24 ),KNUMLK ,KPAD_DV ,KPAD_ML ,KPAD_HS ,KIGNORE ,K(KMt,17 ),
252 K(KMt,23 ),K(KMt, 5 ),K(KMt,18 ),K(KMt,20 ),K(KMt,25 ),K(KMt,21 ),K(KMt, 9 ),K(KMt,15 ),
253 K(KMt,16 ),KIGNORE ,KIGNORE ,KIGNORE ,KREBOOT ,K(KTf,23 ),K(KTf,25 ),KPAD_7 ,
254 KPAD_8 ,KPAD_9 ,KPAD_MI ,KCTRL ,K(KMt, 1 ),K(KMt,19 ),K(KMt, 4 ),K(KMt, 6 ),
255 K(KMt, 7 ),K(KMt, 8 ),K(KMt,10 ),K(KMt,11 ),K(KMt,12 ),KIGNORE ,KIGNORE ,KENTER ,
256 KPAD_4 ,KPAD_5 ,KPAD_6 ,KPAD_PL ,KSHIFT ,KIGNORE ,K(KMt,26 ),K(KMt,24 ),
257 K(KMt, 3 ),K(KMt,22 ),K(KMt, 2 ),K(KMt,14 ),K(KMt,13 ),KIGNORE ,KIGNORE ,KIGNORE ,
258 KSHIFT ,K(KTc,Kcu),KPAD_1 ,KPAD_2 ,KPAD_3 ,KCAPSLK ,KALT ,KIGNORE ,
259 KALTGR ,KCTRL ,K(KTc,Kcl),K(KTc,Kcd ),K(KTc,Kcr),KPAD_0 ,KREBOOT ,KPAD_EN ,
260 KIGNORE ,KIGNORE ,KIGNORE ,KIGNORE ,KIGNORE ,KIGNORE ,KIGNORE ,KIGNORE ,
261 KIGNORE ,KIGNORE ,KIGNORE ,KIGNORE ,KIGNORE ,KIGNORE ,KIGNORE ,KIGNORE ,
262 KIGNORE ,KIGNORE ,KIGNORE ,KIGNORE ,KIGNORE ,KIGNORE ,KIGNORE ,KIGNORE ,
263};
264
265ushort *key_maps[MAX_NR_KEYMAPS] = {
266 plain_map, shift_map, altgr_map, 0,
267 ctrl_map, shift_ctrl_map, 0, 0,
268 alt_map, 0, 0, 0,
269 ctrl_alt_map, 0
270};
271
272unsigned int keymap_count = 7;
273
274/*
275 * Philosophy: most people do not define more strings, but they who do
276 * often want quite a lot of string space. So, we statically allocate
277 * the default and allocate dynamically in chunks of 512 bytes.
278 */
279
280char func_buf[] = {
281 '\033', '[', '[', 'A', 0,
282 '\033', '[', '[', 'B', 0,
283 '\033', '[', '[', 'C', 0,
284 '\033', '[', '[', 'D', 0,
285 '\033', '[', '[', 'E', 0,
286 '\033', '[', '1', '7', '~', 0,
287 '\033', '[', '1', '8', '~', 0,
288 '\033', '[', '1', '9', '~', 0,
289 '\033', '[', '2', '0', '~', 0,
290 '\033', '[', '2', '1', '~', 0,
291 '\033', '[', '2', '3', '~', 0,
292 '\033', '[', '2', '4', '~', 0,
293 '\033', '[', '2', '5', '~', 0,
294 '\033', '[', '2', '6', '~', 0,
295 '\033', '[', '2', '8', '~', 0,
296 '\033', '[', '2', '9', '~', 0,
297 '\033', '[', '3', '1', '~', 0,
298 '\033', '[', '3', '2', '~', 0,
299 '\033', '[', '3', '3', '~', 0,
300 '\033', '[', '3', '4', '~', 0,
301 '\033', '[', '1', '~', 0,
302 '\033', '[', '2', '~', 0,
303 '\033', '[', '3', '~', 0,
304 '\033', '[', '4', '~', 0,
305 '\033', '[', '5', '~', 0,
306 '\033', '[', '6', '~', 0,
307 '\033', '[', 'M', 0,
308 '\033', '[', 'P', 0,
309};
310
311char *funcbufptr = func_buf;
312int funcbufsize = sizeof(func_buf);
313int funcbufleft = 0; /* space left */
314
315char *func_table[MAX_NR_FUNC] = {
316 func_buf + 0,
317 func_buf + 5,
318 func_buf + 10,
319 func_buf + 15,
320 func_buf + 20,
321 func_buf + 25,
322 func_buf + 31,
323 func_buf + 37,
324 func_buf + 43,
325 func_buf + 49,
326 func_buf + 55,
327 func_buf + 61,
328 func_buf + 67,
329 func_buf + 73,
330 func_buf + 79,
331 func_buf + 85,
332 func_buf + 91,
333 func_buf + 97,
334 func_buf + 103,
335 func_buf + 109,
336 func_buf + 115,
337 func_buf + 120,
338 func_buf + 125,
339 func_buf + 130,
340 func_buf + 135,
341 func_buf + 140,
342 func_buf + 145,
343 0,
344 0,
345 func_buf + 149,
346 0,
347};
348
349struct kbdiacruc accent_table[MAX_DIACR] = {
350 {'`', 'A', 0300}, {'`', 'a', 0340},
351 {'\'', 'A', 0301}, {'\'', 'a', 0341},
352 {'^', 'A', 0302}, {'^', 'a', 0342},
353 {'~', 'A', 0303}, {'~', 'a', 0343},
354 {'"', 'A', 0304}, {'"', 'a', 0344},
355 {'O', 'A', 0305}, {'o', 'a', 0345},
356 {'0', 'A', 0305}, {'0', 'a', 0345},
357 {'A', 'A', 0305}, {'a', 'a', 0345},
358 {'A', 'E', 0306}, {'a', 'e', 0346},
359 {',', 'C', 0307}, {',', 'c', 0347},
360 {'`', 'E', 0310}, {'`', 'e', 0350},
361 {'\'', 'E', 0311}, {'\'', 'e', 0351},
362 {'^', 'E', 0312}, {'^', 'e', 0352},
363 {'"', 'E', 0313}, {'"', 'e', 0353},
364 {'`', 'I', 0314}, {'`', 'i', 0354},
365 {'\'', 'I', 0315}, {'\'', 'i', 0355},
366 {'^', 'I', 0316}, {'^', 'i', 0356},
367 {'"', 'I', 0317}, {'"', 'i', 0357},
368 {'-', 'D', 0320}, {'-', 'd', 0360},
369 {'~', 'N', 0321}, {'~', 'n', 0361},
370 {'`', 'O', 0322}, {'`', 'o', 0362},
371 {'\'', 'O', 0323}, {'\'', 'o', 0363},
372 {'^', 'O', 0324}, {'^', 'o', 0364},
373 {'~', 'O', 0325}, {'~', 'o', 0365},
374 {'"', 'O', 0326}, {'"', 'o', 0366},
375 {'/', 'O', 0330}, {'/', 'o', 0370},
376 {'`', 'U', 0331}, {'`', 'u', 0371},
377 {'\'', 'U', 0332}, {'\'', 'u', 0372},
378 {'^', 'U', 0333}, {'^', 'u', 0373},
379 {'"', 'U', 0334}, {'"', 'u', 0374},
380 {'\'', 'Y', 0335}, {'\'', 'y', 0375},
381 {'T', 'H', 0336}, {'t', 'h', 0376},
382 {'s', 's', 0337}, {'"', 'y', 0377},
383 {'s', 'z', 0337}, {'i', 'j', 0377},
384};
385
386unsigned int accent_table_size = 68;
diff --git a/drivers/acpi/bay.c b/drivers/acpi/bay.c
index 26038c2a2a71..61b6c5beb2d3 100644
--- a/drivers/acpi/bay.c
+++ b/drivers/acpi/bay.c
@@ -377,6 +377,9 @@ static int __init bay_init(void)
377 377
378 INIT_LIST_HEAD(&drive_bays); 378 INIT_LIST_HEAD(&drive_bays);
379 379
380 if (acpi_disabled)
381 return -ENODEV;
382
380 /* look for dockable drive bays */ 383 /* look for dockable drive bays */
381 acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, 384 acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT,
382 ACPI_UINT32_MAX, find_bay, &bays, NULL); 385 ACPI_UINT32_MAX, find_bay, &bays, NULL);
diff --git a/drivers/acpi/dock.c b/drivers/acpi/dock.c
index 96c542f7fded..bb7c51f712bd 100644
--- a/drivers/acpi/dock.c
+++ b/drivers/acpi/dock.c
@@ -917,6 +917,9 @@ static int __init dock_init(void)
917 917
918 dock_station = NULL; 918 dock_station = NULL;
919 919
920 if (acpi_disabled)
921 return 0;
922
920 /* look for a dock station */ 923 /* look for a dock station */
921 acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, 924 acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT,
922 ACPI_UINT32_MAX, find_dock, &num, NULL); 925 ACPI_UINT32_MAX, find_dock, &num, NULL);
diff --git a/drivers/acpi/glue.c b/drivers/acpi/glue.c
index 2808dc60fd67..9b227d4dc9c9 100644
--- a/drivers/acpi/glue.c
+++ b/drivers/acpi/glue.c
@@ -333,6 +333,9 @@ static int __init acpi_rtc_init(void)
333{ 333{
334 struct device *dev = get_rtc_dev(); 334 struct device *dev = get_rtc_dev();
335 335
336 if (acpi_disabled)
337 return 0;
338
336 if (dev) { 339 if (dev) {
337 rtc_wake_setup(); 340 rtc_wake_setup();
338 rtc_info.wake_on = rtc_wake_on; 341 rtc_info.wake_on = rtc_wake_on;
diff --git a/drivers/char/drm/i915_drv.c b/drivers/char/drm/i915_drv.c
index e8f3d682e3b1..93aed1c38bd2 100644
--- a/drivers/char/drm/i915_drv.c
+++ b/drivers/char/drm/i915_drv.c
@@ -389,6 +389,7 @@ static int i915_resume(struct drm_device *dev)
389 pci_restore_state(dev->pdev); 389 pci_restore_state(dev->pdev);
390 if (pci_enable_device(dev->pdev)) 390 if (pci_enable_device(dev->pdev))
391 return -1; 391 return -1;
392 pci_set_master(dev->pdev);
392 393
393 pci_write_config_byte(dev->pdev, LBB, dev_priv->saveLBB); 394 pci_write_config_byte(dev->pdev, LBB, dev_priv->saveLBB);
394 395
diff --git a/drivers/char/drm/i915_irq.c b/drivers/char/drm/i915_irq.c
index f7f16e7a8bf3..df036118b8b1 100644
--- a/drivers/char/drm/i915_irq.c
+++ b/drivers/char/drm/i915_irq.c
@@ -62,11 +62,11 @@ static void i915_vblank_tasklet(struct drm_device *dev)
62 u32 ropcpp = (0xcc << 16) | ((cpp - 1) << 24); 62 u32 ropcpp = (0xcc << 16) | ((cpp - 1) << 24);
63 RING_LOCALS; 63 RING_LOCALS;
64 64
65 if (sarea_priv->front_tiled) { 65 if (IS_I965G(dev) && sarea_priv->front_tiled) {
66 cmd |= XY_SRC_COPY_BLT_DST_TILED; 66 cmd |= XY_SRC_COPY_BLT_DST_TILED;
67 dst_pitch >>= 2; 67 dst_pitch >>= 2;
68 } 68 }
69 if (sarea_priv->back_tiled) { 69 if (IS_I965G(dev) && sarea_priv->back_tiled) {
70 cmd |= XY_SRC_COPY_BLT_SRC_TILED; 70 cmd |= XY_SRC_COPY_BLT_SRC_TILED;
71 src_pitch >>= 2; 71 src_pitch >>= 2;
72 } 72 }
diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c
index e94bee032314..750131010af0 100644
--- a/drivers/char/tty_io.c
+++ b/drivers/char/tty_io.c
@@ -3322,7 +3322,7 @@ static int send_break(struct tty_struct *tty, unsigned int duration)
3322 msleep_interruptible(duration); 3322 msleep_interruptible(duration);
3323 tty->ops->break_ctl(tty, 0); 3323 tty->ops->break_ctl(tty, 0);
3324 tty_write_unlock(tty); 3324 tty_write_unlock(tty);
3325 if (!signal_pending(current)) 3325 if (signal_pending(current))
3326 return -EINTR; 3326 return -EINTR;
3327 return 0; 3327 return 0;
3328} 3328}
diff --git a/drivers/char/tty_ioctl.c b/drivers/char/tty_ioctl.c
index b1a757a5ee27..8f81139d6194 100644
--- a/drivers/char/tty_ioctl.c
+++ b/drivers/char/tty_ioctl.c
@@ -981,16 +981,9 @@ EXPORT_SYMBOL_GPL(tty_perform_flush);
981int n_tty_ioctl(struct tty_struct *tty, struct file *file, 981int n_tty_ioctl(struct tty_struct *tty, struct file *file,
982 unsigned int cmd, unsigned long arg) 982 unsigned int cmd, unsigned long arg)
983{ 983{
984 struct tty_struct *real_tty;
985 unsigned long flags; 984 unsigned long flags;
986 int retval; 985 int retval;
987 986
988 if (tty->driver->type == TTY_DRIVER_TYPE_PTY &&
989 tty->driver->subtype == PTY_TYPE_MASTER)
990 real_tty = tty->link;
991 else
992 real_tty = tty;
993
994 switch (cmd) { 987 switch (cmd) {
995 case TCXONC: 988 case TCXONC:
996 retval = tty_check_change(tty); 989 retval = tty_check_change(tty);
diff --git a/drivers/connector/connector.c b/drivers/connector/connector.c
index 85e2ba7fcfba..bf4830082a13 100644
--- a/drivers/connector/connector.c
+++ b/drivers/connector/connector.c
@@ -27,6 +27,8 @@
27#include <linux/moduleparam.h> 27#include <linux/moduleparam.h>
28#include <linux/connector.h> 28#include <linux/connector.h>
29#include <linux/mutex.h> 29#include <linux/mutex.h>
30#include <linux/proc_fs.h>
31#include <linux/spinlock.h>
30 32
31#include <net/sock.h> 33#include <net/sock.h>
32 34
@@ -403,6 +405,40 @@ static void cn_callback(void *data)
403 mutex_unlock(&notify_lock); 405 mutex_unlock(&notify_lock);
404} 406}
405 407
408static int cn_proc_show(struct seq_file *m, void *v)
409{
410 struct cn_queue_dev *dev = cdev.cbdev;
411 struct cn_callback_entry *cbq;
412
413 seq_printf(m, "Name ID\n");
414
415 spin_lock_bh(&dev->queue_lock);
416
417 list_for_each_entry(cbq, &dev->queue_list, callback_entry) {
418 seq_printf(m, "%-15s %u:%u\n",
419 cbq->id.name,
420 cbq->id.id.idx,
421 cbq->id.id.val);
422 }
423
424 spin_unlock_bh(&dev->queue_lock);
425
426 return 0;
427}
428
429static int cn_proc_open(struct inode *inode, struct file *file)
430{
431 return single_open(file, cn_proc_show, NULL);
432}
433
434static const struct file_operations cn_file_ops = {
435 .owner = THIS_MODULE,
436 .open = cn_proc_open,
437 .read = seq_read,
438 .llseek = seq_lseek,
439 .release = single_release
440};
441
406static int __devinit cn_init(void) 442static int __devinit cn_init(void)
407{ 443{
408 struct cn_dev *dev = &cdev; 444 struct cn_dev *dev = &cdev;
@@ -434,6 +470,8 @@ static int __devinit cn_init(void)
434 return -EINVAL; 470 return -EINVAL;
435 } 471 }
436 472
473 proc_net_fops_create(&init_net, "connector", S_IRUGO, &cn_file_ops);
474
437 return 0; 475 return 0;
438} 476}
439 477
@@ -443,6 +481,8 @@ static void __devexit cn_fini(void)
443 481
444 cn_already_initialized = 0; 482 cn_already_initialized = 0;
445 483
484 proc_net_remove(&init_net, "connector");
485
446 cn_del_callback(&dev->id); 486 cn_del_callback(&dev->id);
447 cn_queue_free_dev(dev->cbdev); 487 cn_queue_free_dev(dev->cbdev);
448 netlink_kernel_release(dev->nls); 488 netlink_kernel_release(dev->nls);
diff --git a/drivers/firewire/fw-sbp2.c b/drivers/firewire/fw-sbp2.c
index b2458bb8e9ca..227d2e036cd8 100644
--- a/drivers/firewire/fw-sbp2.c
+++ b/drivers/firewire/fw-sbp2.c
@@ -1051,7 +1051,8 @@ static int sbp2_scan_unit_dir(struct sbp2_target *tgt, u32 *directory,
1051 break; 1051 break;
1052 1052
1053 case SBP2_CSR_LOGICAL_UNIT_DIRECTORY: 1053 case SBP2_CSR_LOGICAL_UNIT_DIRECTORY:
1054 if (sbp2_scan_logical_unit_dir(tgt, ci.p + value) < 0) 1054 /* Adjust for the increment in the iterator */
1055 if (sbp2_scan_logical_unit_dir(tgt, ci.p - 1 + value) < 0)
1055 return -ENOMEM; 1056 return -ENOMEM;
1056 break; 1057 break;
1057 } 1058 }
diff --git a/drivers/hwmon/abituguru3.c b/drivers/hwmon/abituguru3.c
index ed33fddc4dee..f00f497b9ca9 100644
--- a/drivers/hwmon/abituguru3.c
+++ b/drivers/hwmon/abituguru3.c
@@ -30,6 +30,7 @@
30#include <linux/platform_device.h> 30#include <linux/platform_device.h>
31#include <linux/hwmon.h> 31#include <linux/hwmon.h>
32#include <linux/hwmon-sysfs.h> 32#include <linux/hwmon-sysfs.h>
33#include <linux/dmi.h>
33#include <asm/io.h> 34#include <asm/io.h>
34 35
35/* uGuru3 bank addresses */ 36/* uGuru3 bank addresses */
@@ -323,7 +324,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = {
323 { "AUX1 Fan", 36, 2, 60, 1, 0 }, 324 { "AUX1 Fan", 36, 2, 60, 1, 0 },
324 { NULL, 0, 0, 0, 0, 0 } } 325 { NULL, 0, 0, 0, 0, 0 } }
325 }, 326 },
326 { 0x0013, "unknown", { 327 { 0x0013, "Abit AW8D", {
327 { "CPU Core", 0, 0, 10, 1, 0 }, 328 { "CPU Core", 0, 0, 10, 1, 0 },
328 { "DDR", 1, 0, 10, 1, 0 }, 329 { "DDR", 1, 0, 10, 1, 0 },
329 { "DDR VTT", 2, 0, 10, 1, 0 }, 330 { "DDR VTT", 2, 0, 10, 1, 0 },
@@ -349,6 +350,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = {
349 { "AUX2 Fan", 36, 2, 60, 1, 0 }, 350 { "AUX2 Fan", 36, 2, 60, 1, 0 },
350 { "AUX3 Fan", 37, 2, 60, 1, 0 }, 351 { "AUX3 Fan", 37, 2, 60, 1, 0 },
351 { "AUX4 Fan", 38, 2, 60, 1, 0 }, 352 { "AUX4 Fan", 38, 2, 60, 1, 0 },
353 { "AUX5 Fan", 39, 2, 60, 1, 0 },
352 { NULL, 0, 0, 0, 0, 0 } } 354 { NULL, 0, 0, 0, 0, 0 } }
353 }, 355 },
354 { 0x0014, "Abit AB9 Pro", { 356 { 0x0014, "Abit AB9 Pro", {
@@ -1111,11 +1113,12 @@ static int __init abituguru3_detect(void)
1111{ 1113{
1112 /* See if there is an uguru3 there. An idle uGuru3 will hold 0x00 or 1114 /* See if there is an uguru3 there. An idle uGuru3 will hold 0x00 or
1113 0x08 at DATA and 0xAC at CMD. Sometimes the uGuru3 will hold 0x05 1115 0x08 at DATA and 0xAC at CMD. Sometimes the uGuru3 will hold 0x05
1114 at CMD instead, why is unknown. So we test for 0x05 too. */ 1116 or 0x55 at CMD instead, why is unknown. */
1115 u8 data_val = inb_p(ABIT_UGURU3_BASE + ABIT_UGURU3_DATA); 1117 u8 data_val = inb_p(ABIT_UGURU3_BASE + ABIT_UGURU3_DATA);
1116 u8 cmd_val = inb_p(ABIT_UGURU3_BASE + ABIT_UGURU3_CMD); 1118 u8 cmd_val = inb_p(ABIT_UGURU3_BASE + ABIT_UGURU3_CMD);
1117 if (((data_val == 0x00) || (data_val == 0x08)) && 1119 if (((data_val == 0x00) || (data_val == 0x08)) &&
1118 ((cmd_val == 0xAC) || (cmd_val == 0x05))) 1120 ((cmd_val == 0xAC) || (cmd_val == 0x05) ||
1121 (cmd_val == 0x55)))
1119 return ABIT_UGURU3_BASE; 1122 return ABIT_UGURU3_BASE;
1120 1123
1121 ABIT_UGURU3_DEBUG("no Abit uGuru3 found, data = 0x%02X, cmd = " 1124 ABIT_UGURU3_DEBUG("no Abit uGuru3 found, data = 0x%02X, cmd = "
@@ -1138,6 +1141,15 @@ static int __init abituguru3_init(void)
1138 int address, err; 1141 int address, err;
1139 struct resource res = { .flags = IORESOURCE_IO }; 1142 struct resource res = { .flags = IORESOURCE_IO };
1140 1143
1144#ifdef CONFIG_DMI
1145 const char *board_vendor = dmi_get_system_info(DMI_BOARD_VENDOR);
1146
1147 /* safety check, refuse to load on non Abit motherboards */
1148 if (!force && (!board_vendor ||
1149 strcmp(board_vendor, "http://www.abit.com.tw/")))
1150 return -ENODEV;
1151#endif
1152
1141 address = abituguru3_detect(); 1153 address = abituguru3_detect();
1142 if (address < 0) 1154 if (address < 0)
1143 return address; 1155 return address;
diff --git a/drivers/hwmon/adt7473.c b/drivers/hwmon/adt7473.c
index c1009d6f9796..93dbf5e7ff8a 100644
--- a/drivers/hwmon/adt7473.c
+++ b/drivers/hwmon/adt7473.c
@@ -309,6 +309,9 @@ no_sensor_update:
309 ADT7473_REG_PWM_BHVR(i)); 309 ADT7473_REG_PWM_BHVR(i));
310 } 310 }
311 311
312 i = i2c_smbus_read_byte_data(client, ADT7473_REG_CFG4);
313 data->max_duty_at_overheat = !!(i & ADT7473_CFG4_MAX_DUTY_AT_OVT);
314
312 data->limits_last_updated = local_jiffies; 315 data->limits_last_updated = local_jiffies;
313 data->limits_valid = 1; 316 data->limits_valid = 1;
314 317
diff --git a/drivers/hwmon/lm75.c b/drivers/hwmon/lm75.c
index fa7696905154..de698dc73020 100644
--- a/drivers/hwmon/lm75.c
+++ b/drivers/hwmon/lm75.c
@@ -251,10 +251,13 @@ static int lm75_detach_client(struct i2c_client *client)
251 the SMBus standard. */ 251 the SMBus standard. */
252static int lm75_read_value(struct i2c_client *client, u8 reg) 252static int lm75_read_value(struct i2c_client *client, u8 reg)
253{ 253{
254 int value;
255
254 if (reg == LM75_REG_CONF) 256 if (reg == LM75_REG_CONF)
255 return i2c_smbus_read_byte_data(client, reg); 257 return i2c_smbus_read_byte_data(client, reg);
256 else 258
257 return swab16(i2c_smbus_read_word_data(client, reg)); 259 value = i2c_smbus_read_word_data(client, reg);
260 return (value < 0) ? value : swab16(value);
258} 261}
259 262
260static int lm75_write_value(struct i2c_client *client, u8 reg, u16 value) 263static int lm75_write_value(struct i2c_client *client, u8 reg, u16 value)
@@ -287,9 +290,16 @@ static struct lm75_data *lm75_update_device(struct device *dev)
287 int i; 290 int i;
288 dev_dbg(&client->dev, "Starting lm75 update\n"); 291 dev_dbg(&client->dev, "Starting lm75 update\n");
289 292
290 for (i = 0; i < ARRAY_SIZE(data->temp); i++) 293 for (i = 0; i < ARRAY_SIZE(data->temp); i++) {
291 data->temp[i] = lm75_read_value(client, 294 int status;
292 LM75_REG_TEMP[i]); 295
296 status = lm75_read_value(client, LM75_REG_TEMP[i]);
297 if (status < 0)
298 dev_dbg(&client->dev, "reg %d, err %d\n",
299 LM75_REG_TEMP[i], status);
300 else
301 data->temp[i] = status;
302 }
293 data->last_updated = jiffies; 303 data->last_updated = jiffies;
294 data->valid = 1; 304 data->valid = 1;
295 } 305 }
diff --git a/drivers/hwmon/lm85.c b/drivers/hwmon/lm85.c
index 182fe6a5605f..ee5eca1c1921 100644
--- a/drivers/hwmon/lm85.c
+++ b/drivers/hwmon/lm85.c
@@ -192,23 +192,20 @@ static int RANGE_TO_REG( int range )
192{ 192{
193 int i; 193 int i;
194 194
195 if ( range < lm85_range_map[0] ) { 195 if (range >= lm85_range_map[15])
196 return 0 ;
197 } else if ( range > lm85_range_map[15] ) {
198 return 15 ; 196 return 15 ;
199 } else { /* find closest match */ 197
200 for ( i = 14 ; i >= 0 ; --i ) { 198 /* Find the closest match */
201 if ( range > lm85_range_map[i] ) { /* range bracketed */ 199 for (i = 14; i >= 0; --i) {
202 if ((lm85_range_map[i+1] - range) < 200 if (range >= lm85_range_map[i]) {
203 (range - lm85_range_map[i])) { 201 if ((lm85_range_map[i + 1] - range) <
204 i++; 202 (range - lm85_range_map[i]))
205 break; 203 return i + 1;
206 } 204 return i;
207 break;
208 }
209 } 205 }
210 } 206 }
211 return( i & 0x0f ); 207
208 return 0;
212} 209}
213#define RANGE_FROM_REG(val) (lm85_range_map[(val)&0x0f]) 210#define RANGE_FROM_REG(val) (lm85_range_map[(val)&0x0f])
214 211
diff --git a/drivers/i2c/busses/i2c-s3c2410.c b/drivers/i2c/busses/i2c-s3c2410.c
index 1305ef190fc1..9e8c875437be 100644
--- a/drivers/i2c/busses/i2c-s3c2410.c
+++ b/drivers/i2c/busses/i2c-s3c2410.c
@@ -290,12 +290,12 @@ static int i2s_s3c_irq_nextbyte(struct s3c24xx_i2c *i2c, unsigned long iicstat)
290 * bus, or started a new i2c message 290 * bus, or started a new i2c message
291 */ 291 */
292 292
293 if (iicstat & S3C2410_IICSTAT_LASTBIT && 293 if (iicstat & S3C2410_IICSTAT_LASTBIT &&
294 !(i2c->msg->flags & I2C_M_IGNORE_NAK)) { 294 !(i2c->msg->flags & I2C_M_IGNORE_NAK)) {
295 /* ack was not received... */ 295 /* ack was not received... */
296 296
297 dev_dbg(i2c->dev, "ack was not received\n"); 297 dev_dbg(i2c->dev, "ack was not received\n");
298 s3c24xx_i2c_stop(i2c, -EREMOTEIO); 298 s3c24xx_i2c_stop(i2c, -ENXIO);
299 goto out_ack; 299 goto out_ack;
300 } 300 }
301 301
@@ -305,7 +305,7 @@ static int i2s_s3c_irq_nextbyte(struct s3c24xx_i2c *i2c, unsigned long iicstat)
305 i2c->state = STATE_WRITE; 305 i2c->state = STATE_WRITE;
306 306
307 /* terminate the transfer if there is nothing to do 307 /* terminate the transfer if there is nothing to do
308 * (used by the i2c probe to find devices */ 308 * as this is used by the i2c probe to find devices. */
309 309
310 if (is_lastmsg(i2c) && i2c->msg->len == 0) { 310 if (is_lastmsg(i2c) && i2c->msg->len == 0) {
311 s3c24xx_i2c_stop(i2c, 0); 311 s3c24xx_i2c_stop(i2c, 0);
@@ -323,7 +323,17 @@ static int i2s_s3c_irq_nextbyte(struct s3c24xx_i2c *i2c, unsigned long iicstat)
323 * end of the message, and if so, work out what to do 323 * end of the message, and if so, work out what to do
324 */ 324 */
325 325
326 if (!(i2c->msg->flags & I2C_M_IGNORE_NAK)) {
327 if (iicstat & S3C2410_IICSTAT_LASTBIT) {
328 dev_dbg(i2c->dev, "WRITE: No Ack\n");
329
330 s3c24xx_i2c_stop(i2c, -ECONNREFUSED);
331 goto out_ack;
332 }
333 }
334
326 retry_write: 335 retry_write:
336
327 if (!is_msgend(i2c)) { 337 if (!is_msgend(i2c)) {
328 byte = i2c->msg->buf[i2c->msg_ptr++]; 338 byte = i2c->msg->buf[i2c->msg_ptr++];
329 writeb(byte, i2c->regs + S3C2410_IICDS); 339 writeb(byte, i2c->regs + S3C2410_IICDS);
@@ -377,17 +387,6 @@ static int i2s_s3c_irq_nextbyte(struct s3c24xx_i2c *i2c, unsigned long iicstat)
377 * going to do any more read/write 387 * going to do any more read/write
378 */ 388 */
379 389
380 if (!(i2c->msg->flags & I2C_M_IGNORE_NAK) &&
381 !(is_msglast(i2c) && is_lastmsg(i2c))) {
382
383 if (iicstat & S3C2410_IICSTAT_LASTBIT) {
384 dev_dbg(i2c->dev, "READ: No Ack\n");
385
386 s3c24xx_i2c_stop(i2c, -ECONNREFUSED);
387 goto out_ack;
388 }
389 }
390
391 byte = readb(i2c->regs + S3C2410_IICDS); 390 byte = readb(i2c->regs + S3C2410_IICDS);
392 i2c->msg->buf[i2c->msg_ptr++] = byte; 391 i2c->msg->buf[i2c->msg_ptr++] = byte;
393 392
@@ -949,3 +948,4 @@ MODULE_DESCRIPTION("S3C24XX I2C Bus driver");
949MODULE_AUTHOR("Ben Dooks, <ben@simtec.co.uk>"); 948MODULE_AUTHOR("Ben Dooks, <ben@simtec.co.uk>");
950MODULE_LICENSE("GPL"); 949MODULE_LICENSE("GPL");
951MODULE_ALIAS("platform:s3c2410-i2c"); 950MODULE_ALIAS("platform:s3c2410-i2c");
951MODULE_ALIAS("platform:s3c2440-i2c");
diff --git a/drivers/i2c/chips/isp1301_omap.c b/drivers/i2c/chips/isp1301_omap.c
index b1b45dddb17e..03a33f1b9cd3 100644
--- a/drivers/i2c/chips/isp1301_omap.c
+++ b/drivers/i2c/chips/isp1301_omap.c
@@ -72,7 +72,7 @@ struct isp1301 {
72}; 72};
73 73
74 74
75/* bits in OTG_CTRL_REG */ 75/* bits in OTG_CTRL */
76 76
77#define OTG_XCEIV_OUTPUTS \ 77#define OTG_XCEIV_OUTPUTS \
78 (OTG_ASESSVLD|OTG_BSESSEND|OTG_BSESSVLD|OTG_VBUSVLD|OTG_ID) 78 (OTG_ASESSVLD|OTG_BSESSEND|OTG_BSESSVLD|OTG_VBUSVLD|OTG_ID)
@@ -186,8 +186,8 @@ isp1301_clear_bits(struct isp1301 *isp, u8 reg, u8 bits)
186 186
187/* operational registers */ 187/* operational registers */
188#define ISP1301_MODE_CONTROL_1 0x04 /* u8 read, set, +1 clear */ 188#define ISP1301_MODE_CONTROL_1 0x04 /* u8 read, set, +1 clear */
189# define MC1_SPEED_REG (1 << 0) 189# define MC1_SPEED (1 << 0)
190# define MC1_SUSPEND_REG (1 << 1) 190# define MC1_SUSPEND (1 << 1)
191# define MC1_DAT_SE0 (1 << 2) 191# define MC1_DAT_SE0 (1 << 2)
192# define MC1_TRANSPARENT (1 << 3) 192# define MC1_TRANSPARENT (1 << 3)
193# define MC1_BDIS_ACON_EN (1 << 4) 193# define MC1_BDIS_ACON_EN (1 << 4)
@@ -274,7 +274,7 @@ static void power_down(struct isp1301 *isp)
274 isp->otg.state = OTG_STATE_UNDEFINED; 274 isp->otg.state = OTG_STATE_UNDEFINED;
275 275
276 // isp1301_set_bits(isp, ISP1301_MODE_CONTROL_2, MC2_GLOBAL_PWR_DN); 276 // isp1301_set_bits(isp, ISP1301_MODE_CONTROL_2, MC2_GLOBAL_PWR_DN);
277 isp1301_set_bits(isp, ISP1301_MODE_CONTROL_1, MC1_SUSPEND_REG); 277 isp1301_set_bits(isp, ISP1301_MODE_CONTROL_1, MC1_SUSPEND);
278 278
279 isp1301_clear_bits(isp, ISP1301_OTG_CONTROL_1, OTG1_ID_PULLDOWN); 279 isp1301_clear_bits(isp, ISP1301_OTG_CONTROL_1, OTG1_ID_PULLDOWN);
280 isp1301_clear_bits(isp, ISP1301_MODE_CONTROL_1, MC1_DAT_SE0); 280 isp1301_clear_bits(isp, ISP1301_MODE_CONTROL_1, MC1_DAT_SE0);
@@ -283,7 +283,7 @@ static void power_down(struct isp1301 *isp)
283static void power_up(struct isp1301 *isp) 283static void power_up(struct isp1301 *isp)
284{ 284{
285 // isp1301_clear_bits(isp, ISP1301_MODE_CONTROL_2, MC2_GLOBAL_PWR_DN); 285 // isp1301_clear_bits(isp, ISP1301_MODE_CONTROL_2, MC2_GLOBAL_PWR_DN);
286 isp1301_clear_bits(isp, ISP1301_MODE_CONTROL_1, MC1_SUSPEND_REG); 286 isp1301_clear_bits(isp, ISP1301_MODE_CONTROL_1, MC1_SUSPEND);
287 287
288 /* do this only when cpu is driving transceiver, 288 /* do this only when cpu is driving transceiver,
289 * so host won't see a low speed device... 289 * so host won't see a low speed device...
@@ -360,6 +360,8 @@ isp1301_defer_work(struct isp1301 *isp, int work)
360/* called from irq handlers */ 360/* called from irq handlers */
361static void a_idle(struct isp1301 *isp, const char *tag) 361static void a_idle(struct isp1301 *isp, const char *tag)
362{ 362{
363 u32 l;
364
363 if (isp->otg.state == OTG_STATE_A_IDLE) 365 if (isp->otg.state == OTG_STATE_A_IDLE)
364 return; 366 return;
365 367
@@ -373,13 +375,17 @@ static void a_idle(struct isp1301 *isp, const char *tag)
373 gadget_suspend(isp); 375 gadget_suspend(isp);
374 } 376 }
375 isp->otg.state = OTG_STATE_A_IDLE; 377 isp->otg.state = OTG_STATE_A_IDLE;
376 isp->last_otg_ctrl = OTG_CTRL_REG = OTG_CTRL_REG & OTG_XCEIV_OUTPUTS; 378 l = omap_readl(OTG_CTRL) & OTG_XCEIV_OUTPUTS;
379 omap_writel(l, OTG_CTRL);
380 isp->last_otg_ctrl = l;
377 pr_debug(" --> %s/%s\n", state_name(isp), tag); 381 pr_debug(" --> %s/%s\n", state_name(isp), tag);
378} 382}
379 383
380/* called from irq handlers */ 384/* called from irq handlers */
381static void b_idle(struct isp1301 *isp, const char *tag) 385static void b_idle(struct isp1301 *isp, const char *tag)
382{ 386{
387 u32 l;
388
383 if (isp->otg.state == OTG_STATE_B_IDLE) 389 if (isp->otg.state == OTG_STATE_B_IDLE)
384 return; 390 return;
385 391
@@ -393,7 +399,9 @@ static void b_idle(struct isp1301 *isp, const char *tag)
393 gadget_suspend(isp); 399 gadget_suspend(isp);
394 } 400 }
395 isp->otg.state = OTG_STATE_B_IDLE; 401 isp->otg.state = OTG_STATE_B_IDLE;
396 isp->last_otg_ctrl = OTG_CTRL_REG = OTG_CTRL_REG & OTG_XCEIV_OUTPUTS; 402 l = omap_readl(OTG_CTRL) & OTG_XCEIV_OUTPUTS;
403 omap_writel(l, OTG_CTRL);
404 isp->last_otg_ctrl = l;
397 pr_debug(" --> %s/%s\n", state_name(isp), tag); 405 pr_debug(" --> %s/%s\n", state_name(isp), tag);
398} 406}
399 407
@@ -406,7 +414,7 @@ dump_regs(struct isp1301 *isp, const char *label)
406 u8 src = isp1301_get_u8(isp, ISP1301_INTERRUPT_SOURCE); 414 u8 src = isp1301_get_u8(isp, ISP1301_INTERRUPT_SOURCE);
407 415
408 pr_debug("otg: %06x, %s %s, otg/%02x stat/%02x.%02x\n", 416 pr_debug("otg: %06x, %s %s, otg/%02x stat/%02x.%02x\n",
409 OTG_CTRL_REG, label, state_name(isp), 417 omap_readl(OTG_CTRL), label, state_name(isp),
410 ctrl, status, src); 418 ctrl, status, src);
411 /* mode control and irq enables don't change much */ 419 /* mode control and irq enables don't change much */
412#endif 420#endif
@@ -429,7 +437,7 @@ dump_regs(struct isp1301 *isp, const char *label)
429static void check_state(struct isp1301 *isp, const char *tag) 437static void check_state(struct isp1301 *isp, const char *tag)
430{ 438{
431 enum usb_otg_state state = OTG_STATE_UNDEFINED; 439 enum usb_otg_state state = OTG_STATE_UNDEFINED;
432 u8 fsm = OTG_TEST_REG & 0x0ff; 440 u8 fsm = omap_readw(OTG_TEST) & 0x0ff;
433 unsigned extra = 0; 441 unsigned extra = 0;
434 442
435 switch (fsm) { 443 switch (fsm) {
@@ -494,7 +502,8 @@ static void check_state(struct isp1301 *isp, const char *tag)
494 if (isp->otg.state == state && !extra) 502 if (isp->otg.state == state && !extra)
495 return; 503 return;
496 pr_debug("otg: %s FSM %s/%02x, %s, %06x\n", tag, 504 pr_debug("otg: %s FSM %s/%02x, %s, %06x\n", tag,
497 state_string(state), fsm, state_name(isp), OTG_CTRL_REG); 505 state_string(state), fsm, state_name(isp),
506 omap_readl(OTG_CTRL));
498} 507}
499 508
500#else 509#else
@@ -508,10 +517,11 @@ static void update_otg1(struct isp1301 *isp, u8 int_src)
508{ 517{
509 u32 otg_ctrl; 518 u32 otg_ctrl;
510 519
511 otg_ctrl = OTG_CTRL_REG 520 otg_ctrl = omap_readl(OTG_CTRL) & OTG_CTRL_MASK;
512 & OTG_CTRL_MASK 521 otg_ctrl &= ~OTG_XCEIV_INPUTS;
513 & ~OTG_XCEIV_INPUTS 522 otg_ctrl &= ~(OTG_ID|OTG_ASESSVLD|OTG_VBUSVLD);
514 & ~(OTG_ID|OTG_ASESSVLD|OTG_VBUSVLD); 523
524
515 if (int_src & INTR_SESS_VLD) 525 if (int_src & INTR_SESS_VLD)
516 otg_ctrl |= OTG_ASESSVLD; 526 otg_ctrl |= OTG_ASESSVLD;
517 else if (isp->otg.state == OTG_STATE_A_WAIT_VFALL) { 527 else if (isp->otg.state == OTG_STATE_A_WAIT_VFALL) {
@@ -534,7 +544,7 @@ static void update_otg1(struct isp1301 *isp, u8 int_src)
534 return; 544 return;
535 } 545 }
536 } 546 }
537 OTG_CTRL_REG = otg_ctrl; 547 omap_writel(otg_ctrl, OTG_CTRL);
538} 548}
539 549
540/* outputs from ISP1301_OTG_STATUS */ 550/* outputs from ISP1301_OTG_STATUS */
@@ -542,15 +552,14 @@ static void update_otg2(struct isp1301 *isp, u8 otg_status)
542{ 552{
543 u32 otg_ctrl; 553 u32 otg_ctrl;
544 554
545 otg_ctrl = OTG_CTRL_REG 555 otg_ctrl = omap_readl(OTG_CTRL) & OTG_CTRL_MASK;
546 & OTG_CTRL_MASK 556 otg_ctrl &= ~OTG_XCEIV_INPUTS;
547 & ~OTG_XCEIV_INPUTS 557 otg_ctrl &= ~(OTG_BSESSVLD | OTG_BSESSEND);
548 & ~(OTG_BSESSVLD|OTG_BSESSEND);
549 if (otg_status & OTG_B_SESS_VLD) 558 if (otg_status & OTG_B_SESS_VLD)
550 otg_ctrl |= OTG_BSESSVLD; 559 otg_ctrl |= OTG_BSESSVLD;
551 else if (otg_status & OTG_B_SESS_END) 560 else if (otg_status & OTG_B_SESS_END)
552 otg_ctrl |= OTG_BSESSEND; 561 otg_ctrl |= OTG_BSESSEND;
553 OTG_CTRL_REG = otg_ctrl; 562 omap_writel(otg_ctrl, OTG_CTRL);
554} 563}
555 564
556/* inputs going to ISP1301 */ 565/* inputs going to ISP1301 */
@@ -559,7 +568,7 @@ static void otg_update_isp(struct isp1301 *isp)
559 u32 otg_ctrl, otg_change; 568 u32 otg_ctrl, otg_change;
560 u8 set = OTG1_DM_PULLDOWN, clr = OTG1_DM_PULLUP; 569 u8 set = OTG1_DM_PULLDOWN, clr = OTG1_DM_PULLUP;
561 570
562 otg_ctrl = OTG_CTRL_REG; 571 otg_ctrl = omap_readl(OTG_CTRL);
563 otg_change = otg_ctrl ^ isp->last_otg_ctrl; 572 otg_change = otg_ctrl ^ isp->last_otg_ctrl;
564 isp->last_otg_ctrl = otg_ctrl; 573 isp->last_otg_ctrl = otg_ctrl;
565 otg_ctrl = otg_ctrl & OTG_XCEIV_INPUTS; 574 otg_ctrl = otg_ctrl & OTG_XCEIV_INPUTS;
@@ -639,6 +648,8 @@ pulldown:
639 648
640 /* HNP switch to host or peripheral; and SRP */ 649 /* HNP switch to host or peripheral; and SRP */
641 if (otg_change & OTG_PULLUP) { 650 if (otg_change & OTG_PULLUP) {
651 u32 l;
652
642 switch (isp->otg.state) { 653 switch (isp->otg.state) {
643 case OTG_STATE_B_IDLE: 654 case OTG_STATE_B_IDLE:
644 if (clr & OTG1_DP_PULLUP) 655 if (clr & OTG1_DP_PULLUP)
@@ -655,7 +666,9 @@ pulldown:
655 default: 666 default:
656 break; 667 break;
657 } 668 }
658 OTG_CTRL_REG |= OTG_PULLUP; 669 l = omap_readl(OTG_CTRL);
670 l |= OTG_PULLUP;
671 omap_writel(l, OTG_CTRL);
659 } 672 }
660 673
661 check_state(isp, __func__); 674 check_state(isp, __func__);
@@ -664,20 +677,20 @@ pulldown:
664 677
665static irqreturn_t omap_otg_irq(int irq, void *_isp) 678static irqreturn_t omap_otg_irq(int irq, void *_isp)
666{ 679{
667 u16 otg_irq = OTG_IRQ_SRC_REG; 680 u16 otg_irq = omap_readw(OTG_IRQ_SRC);
668 u32 otg_ctrl; 681 u32 otg_ctrl;
669 int ret = IRQ_NONE; 682 int ret = IRQ_NONE;
670 struct isp1301 *isp = _isp; 683 struct isp1301 *isp = _isp;
671 684
672 /* update ISP1301 transciever from OTG controller */ 685 /* update ISP1301 transciever from OTG controller */
673 if (otg_irq & OPRT_CHG) { 686 if (otg_irq & OPRT_CHG) {
674 OTG_IRQ_SRC_REG = OPRT_CHG; 687 omap_writew(OPRT_CHG, OTG_IRQ_SRC);
675 isp1301_defer_work(isp, WORK_UPDATE_ISP); 688 isp1301_defer_work(isp, WORK_UPDATE_ISP);
676 ret = IRQ_HANDLED; 689 ret = IRQ_HANDLED;
677 690
678 /* SRP to become b_peripheral failed */ 691 /* SRP to become b_peripheral failed */
679 } else if (otg_irq & B_SRP_TMROUT) { 692 } else if (otg_irq & B_SRP_TMROUT) {
680 pr_debug("otg: B_SRP_TIMEOUT, %06x\n", OTG_CTRL_REG); 693 pr_debug("otg: B_SRP_TIMEOUT, %06x\n", omap_readl(OTG_CTRL));
681 notresponding(isp); 694 notresponding(isp);
682 695
683 /* gadget drivers that care should monitor all kinds of 696 /* gadget drivers that care should monitor all kinds of
@@ -687,31 +700,31 @@ static irqreturn_t omap_otg_irq(int irq, void *_isp)
687 if (isp->otg.state == OTG_STATE_B_SRP_INIT) 700 if (isp->otg.state == OTG_STATE_B_SRP_INIT)
688 b_idle(isp, "srp_timeout"); 701 b_idle(isp, "srp_timeout");
689 702
690 OTG_IRQ_SRC_REG = B_SRP_TMROUT; 703 omap_writew(B_SRP_TMROUT, OTG_IRQ_SRC);
691 ret = IRQ_HANDLED; 704 ret = IRQ_HANDLED;
692 705
693 /* HNP to become b_host failed */ 706 /* HNP to become b_host failed */
694 } else if (otg_irq & B_HNP_FAIL) { 707 } else if (otg_irq & B_HNP_FAIL) {
695 pr_debug("otg: %s B_HNP_FAIL, %06x\n", 708 pr_debug("otg: %s B_HNP_FAIL, %06x\n",
696 state_name(isp), OTG_CTRL_REG); 709 state_name(isp), omap_readl(OTG_CTRL));
697 notresponding(isp); 710 notresponding(isp);
698 711
699 otg_ctrl = OTG_CTRL_REG; 712 otg_ctrl = omap_readl(OTG_CTRL);
700 otg_ctrl |= OTG_BUSDROP; 713 otg_ctrl |= OTG_BUSDROP;
701 otg_ctrl &= OTG_CTRL_MASK & ~OTG_XCEIV_INPUTS; 714 otg_ctrl &= OTG_CTRL_MASK & ~OTG_XCEIV_INPUTS;
702 OTG_CTRL_REG = otg_ctrl; 715 omap_writel(otg_ctrl, OTG_CTRL);
703 716
704 /* subset of b_peripheral()... */ 717 /* subset of b_peripheral()... */
705 isp->otg.state = OTG_STATE_B_PERIPHERAL; 718 isp->otg.state = OTG_STATE_B_PERIPHERAL;
706 pr_debug(" --> b_peripheral\n"); 719 pr_debug(" --> b_peripheral\n");
707 720
708 OTG_IRQ_SRC_REG = B_HNP_FAIL; 721 omap_writew(B_HNP_FAIL, OTG_IRQ_SRC);
709 ret = IRQ_HANDLED; 722 ret = IRQ_HANDLED;
710 723
711 /* detect SRP from B-device ... */ 724 /* detect SRP from B-device ... */
712 } else if (otg_irq & A_SRP_DETECT) { 725 } else if (otg_irq & A_SRP_DETECT) {
713 pr_debug("otg: %s SRP_DETECT, %06x\n", 726 pr_debug("otg: %s SRP_DETECT, %06x\n",
714 state_name(isp), OTG_CTRL_REG); 727 state_name(isp), omap_readl(OTG_CTRL));
715 728
716 isp1301_defer_work(isp, WORK_UPDATE_OTG); 729 isp1301_defer_work(isp, WORK_UPDATE_OTG);
717 switch (isp->otg.state) { 730 switch (isp->otg.state) {
@@ -719,49 +732,49 @@ static irqreturn_t omap_otg_irq(int irq, void *_isp)
719 if (!isp->otg.host) 732 if (!isp->otg.host)
720 break; 733 break;
721 isp1301_defer_work(isp, WORK_HOST_RESUME); 734 isp1301_defer_work(isp, WORK_HOST_RESUME);
722 otg_ctrl = OTG_CTRL_REG; 735 otg_ctrl = omap_readl(OTG_CTRL);
723 otg_ctrl |= OTG_A_BUSREQ; 736 otg_ctrl |= OTG_A_BUSREQ;
724 otg_ctrl &= ~(OTG_BUSDROP|OTG_B_BUSREQ) 737 otg_ctrl &= ~(OTG_BUSDROP|OTG_B_BUSREQ)
725 & ~OTG_XCEIV_INPUTS 738 & ~OTG_XCEIV_INPUTS
726 & OTG_CTRL_MASK; 739 & OTG_CTRL_MASK;
727 OTG_CTRL_REG = otg_ctrl; 740 omap_writel(otg_ctrl, OTG_CTRL);
728 break; 741 break;
729 default: 742 default:
730 break; 743 break;
731 } 744 }
732 745
733 OTG_IRQ_SRC_REG = A_SRP_DETECT; 746 omap_writew(A_SRP_DETECT, OTG_IRQ_SRC);
734 ret = IRQ_HANDLED; 747 ret = IRQ_HANDLED;
735 748
736 /* timer expired: T(a_wait_bcon) and maybe T(a_wait_vrise) 749 /* timer expired: T(a_wait_bcon) and maybe T(a_wait_vrise)
737 * we don't track them separately 750 * we don't track them separately
738 */ 751 */
739 } else if (otg_irq & A_REQ_TMROUT) { 752 } else if (otg_irq & A_REQ_TMROUT) {
740 otg_ctrl = OTG_CTRL_REG; 753 otg_ctrl = omap_readl(OTG_CTRL);
741 pr_info("otg: BCON_TMOUT from %s, %06x\n", 754 pr_info("otg: BCON_TMOUT from %s, %06x\n",
742 state_name(isp), otg_ctrl); 755 state_name(isp), otg_ctrl);
743 notresponding(isp); 756 notresponding(isp);
744 757
745 otg_ctrl |= OTG_BUSDROP; 758 otg_ctrl |= OTG_BUSDROP;
746 otg_ctrl &= ~OTG_A_BUSREQ & OTG_CTRL_MASK & ~OTG_XCEIV_INPUTS; 759 otg_ctrl &= ~OTG_A_BUSREQ & OTG_CTRL_MASK & ~OTG_XCEIV_INPUTS;
747 OTG_CTRL_REG = otg_ctrl; 760 omap_writel(otg_ctrl, OTG_CTRL);
748 isp->otg.state = OTG_STATE_A_WAIT_VFALL; 761 isp->otg.state = OTG_STATE_A_WAIT_VFALL;
749 762
750 OTG_IRQ_SRC_REG = A_REQ_TMROUT; 763 omap_writew(A_REQ_TMROUT, OTG_IRQ_SRC);
751 ret = IRQ_HANDLED; 764 ret = IRQ_HANDLED;
752 765
753 /* A-supplied voltage fell too low; overcurrent */ 766 /* A-supplied voltage fell too low; overcurrent */
754 } else if (otg_irq & A_VBUS_ERR) { 767 } else if (otg_irq & A_VBUS_ERR) {
755 otg_ctrl = OTG_CTRL_REG; 768 otg_ctrl = omap_readl(OTG_CTRL);
756 printk(KERN_ERR "otg: %s, VBUS_ERR %04x ctrl %06x\n", 769 printk(KERN_ERR "otg: %s, VBUS_ERR %04x ctrl %06x\n",
757 state_name(isp), otg_irq, otg_ctrl); 770 state_name(isp), otg_irq, otg_ctrl);
758 771
759 otg_ctrl |= OTG_BUSDROP; 772 otg_ctrl |= OTG_BUSDROP;
760 otg_ctrl &= ~OTG_A_BUSREQ & OTG_CTRL_MASK & ~OTG_XCEIV_INPUTS; 773 otg_ctrl &= ~OTG_A_BUSREQ & OTG_CTRL_MASK & ~OTG_XCEIV_INPUTS;
761 OTG_CTRL_REG = otg_ctrl; 774 omap_writel(otg_ctrl, OTG_CTRL);
762 isp->otg.state = OTG_STATE_A_VBUS_ERR; 775 isp->otg.state = OTG_STATE_A_VBUS_ERR;
763 776
764 OTG_IRQ_SRC_REG = A_VBUS_ERR; 777 omap_writew(A_VBUS_ERR, OTG_IRQ_SRC);
765 ret = IRQ_HANDLED; 778 ret = IRQ_HANDLED;
766 779
767 /* switch driver; the transciever code activates it, 780 /* switch driver; the transciever code activates it,
@@ -770,7 +783,7 @@ static irqreturn_t omap_otg_irq(int irq, void *_isp)
770 } else if (otg_irq & DRIVER_SWITCH) { 783 } else if (otg_irq & DRIVER_SWITCH) {
771 int kick = 0; 784 int kick = 0;
772 785
773 otg_ctrl = OTG_CTRL_REG; 786 otg_ctrl = omap_readl(OTG_CTRL);
774 printk(KERN_NOTICE "otg: %s, SWITCH to %s, ctrl %06x\n", 787 printk(KERN_NOTICE "otg: %s, SWITCH to %s, ctrl %06x\n",
775 state_name(isp), 788 state_name(isp),
776 (otg_ctrl & OTG_DRIVER_SEL) 789 (otg_ctrl & OTG_DRIVER_SEL)
@@ -793,7 +806,7 @@ static irqreturn_t omap_otg_irq(int irq, void *_isp)
793 } else { 806 } else {
794 if (!(otg_ctrl & OTG_ID)) { 807 if (!(otg_ctrl & OTG_ID)) {
795 otg_ctrl &= OTG_CTRL_MASK & ~OTG_XCEIV_INPUTS; 808 otg_ctrl &= OTG_CTRL_MASK & ~OTG_XCEIV_INPUTS;
796 OTG_CTRL_REG = otg_ctrl | OTG_A_BUSREQ; 809 omap_writel(otg_ctrl | OTG_A_BUSREQ, OTG_CTRL);
797 } 810 }
798 811
799 if (isp->otg.host) { 812 if (isp->otg.host) {
@@ -818,7 +831,7 @@ static irqreturn_t omap_otg_irq(int irq, void *_isp)
818 } 831 }
819 } 832 }
820 833
821 OTG_IRQ_SRC_REG = DRIVER_SWITCH; 834 omap_writew(DRIVER_SWITCH, OTG_IRQ_SRC);
822 ret = IRQ_HANDLED; 835 ret = IRQ_HANDLED;
823 836
824 if (kick) 837 if (kick)
@@ -834,12 +847,15 @@ static struct platform_device *otg_dev;
834 847
835static int otg_init(struct isp1301 *isp) 848static int otg_init(struct isp1301 *isp)
836{ 849{
850 u32 l;
851
837 if (!otg_dev) 852 if (!otg_dev)
838 return -ENODEV; 853 return -ENODEV;
839 854
840 dump_regs(isp, __func__); 855 dump_regs(isp, __func__);
841 /* some of these values are board-specific... */ 856 /* some of these values are board-specific... */
842 OTG_SYSCON_2_REG |= OTG_EN 857 l = omap_readl(OTG_SYSCON_2);
858 l |= OTG_EN
843 /* for B-device: */ 859 /* for B-device: */
844 | SRP_GPDATA /* 9msec Bdev D+ pulse */ 860 | SRP_GPDATA /* 9msec Bdev D+ pulse */
845 | SRP_GPDVBUS /* discharge after VBUS pulse */ 861 | SRP_GPDVBUS /* discharge after VBUS pulse */
@@ -849,18 +865,22 @@ static int otg_init(struct isp1301 *isp)
849 | SRP_DPW /* detect 167+ns SRP pulses */ 865 | SRP_DPW /* detect 167+ns SRP pulses */
850 | SRP_DATA | SRP_VBUS /* accept both kinds of SRP pulse */ 866 | SRP_DATA | SRP_VBUS /* accept both kinds of SRP pulse */
851 ; 867 ;
868 omap_writel(l, OTG_SYSCON_2);
852 869
853 update_otg1(isp, isp1301_get_u8(isp, ISP1301_INTERRUPT_SOURCE)); 870 update_otg1(isp, isp1301_get_u8(isp, ISP1301_INTERRUPT_SOURCE));
854 update_otg2(isp, isp1301_get_u8(isp, ISP1301_OTG_STATUS)); 871 update_otg2(isp, isp1301_get_u8(isp, ISP1301_OTG_STATUS));
855 872
856 check_state(isp, __func__); 873 check_state(isp, __func__);
857 pr_debug("otg: %s, %s %06x\n", 874 pr_debug("otg: %s, %s %06x\n",
858 state_name(isp), __func__, OTG_CTRL_REG); 875 state_name(isp), __func__, omap_readl(OTG_CTRL));
859 876
860 OTG_IRQ_EN_REG = DRIVER_SWITCH | OPRT_CHG 877 omap_writew(DRIVER_SWITCH | OPRT_CHG
861 | B_SRP_TMROUT | B_HNP_FAIL 878 | B_SRP_TMROUT | B_HNP_FAIL
862 | A_VBUS_ERR | A_SRP_DETECT | A_REQ_TMROUT; 879 | A_VBUS_ERR | A_SRP_DETECT | A_REQ_TMROUT, OTG_IRQ_EN);
863 OTG_SYSCON_2_REG |= OTG_EN; 880
881 l = omap_readl(OTG_SYSCON_2);
882 l |= OTG_EN;
883 omap_writel(l, OTG_SYSCON_2);
864 884
865 return 0; 885 return 0;
866} 886}
@@ -927,7 +947,11 @@ static void otg_unbind(struct isp1301 *isp)
927 947
928static void b_peripheral(struct isp1301 *isp) 948static void b_peripheral(struct isp1301 *isp)
929{ 949{
930 OTG_CTRL_REG = OTG_CTRL_REG & OTG_XCEIV_OUTPUTS; 950 u32 l;
951
952 l = omap_readl(OTG_CTRL) & OTG_XCEIV_OUTPUTS;
953 omap_writel(l, OTG_CTRL);
954
931 usb_gadget_vbus_connect(isp->otg.gadget); 955 usb_gadget_vbus_connect(isp->otg.gadget);
932 956
933#ifdef CONFIG_USB_OTG 957#ifdef CONFIG_USB_OTG
@@ -999,6 +1023,8 @@ static void isp_update_otg(struct isp1301 *isp, u8 stat)
999 isp_bstat = 0; 1023 isp_bstat = 0;
1000 } 1024 }
1001 } else { 1025 } else {
1026 u32 l;
1027
1002 /* if user unplugged mini-A end of cable, 1028 /* if user unplugged mini-A end of cable,
1003 * don't bypass A_WAIT_VFALL. 1029 * don't bypass A_WAIT_VFALL.
1004 */ 1030 */
@@ -1019,8 +1045,9 @@ static void isp_update_otg(struct isp1301 *isp, u8 stat)
1019 isp1301_clear_bits(isp, ISP1301_MODE_CONTROL_1, 1045 isp1301_clear_bits(isp, ISP1301_MODE_CONTROL_1,
1020 MC1_BDIS_ACON_EN); 1046 MC1_BDIS_ACON_EN);
1021 isp->otg.state = OTG_STATE_B_IDLE; 1047 isp->otg.state = OTG_STATE_B_IDLE;
1022 OTG_CTRL_REG &= OTG_CTRL_REG & OTG_CTRL_MASK 1048 l = omap_readl(OTG_CTRL) & OTG_CTRL_MASK;
1023 & ~OTG_CTRL_BITS; 1049 l &= ~OTG_CTRL_BITS;
1050 omap_writel(l, OTG_CTRL);
1024 break; 1051 break;
1025 case OTG_STATE_B_IDLE: 1052 case OTG_STATE_B_IDLE:
1026 break; 1053 break;
@@ -1046,7 +1073,8 @@ static void isp_update_otg(struct isp1301 *isp, u8 stat)
1046 /* FALLTHROUGH */ 1073 /* FALLTHROUGH */
1047 case OTG_STATE_B_SRP_INIT: 1074 case OTG_STATE_B_SRP_INIT:
1048 b_idle(isp, __func__); 1075 b_idle(isp, __func__);
1049 OTG_CTRL_REG &= OTG_CTRL_REG & OTG_XCEIV_OUTPUTS; 1076 l = omap_readl(OTG_CTRL) & OTG_XCEIV_OUTPUTS;
1077 omap_writel(l, OTG_CTRL);
1050 /* FALLTHROUGH */ 1078 /* FALLTHROUGH */
1051 case OTG_STATE_B_IDLE: 1079 case OTG_STATE_B_IDLE:
1052 if (isp->otg.gadget && (isp_bstat & OTG_B_SESS_VLD)) { 1080 if (isp->otg.gadget && (isp_bstat & OTG_B_SESS_VLD)) {
@@ -1130,11 +1158,11 @@ isp1301_work(struct work_struct *work)
1130 case OTG_STATE_A_WAIT_VRISE: 1158 case OTG_STATE_A_WAIT_VRISE:
1131 isp->otg.state = OTG_STATE_A_HOST; 1159 isp->otg.state = OTG_STATE_A_HOST;
1132 pr_debug(" --> a_host\n"); 1160 pr_debug(" --> a_host\n");
1133 otg_ctrl = OTG_CTRL_REG; 1161 otg_ctrl = omap_readl(OTG_CTRL);
1134 otg_ctrl |= OTG_A_BUSREQ; 1162 otg_ctrl |= OTG_A_BUSREQ;
1135 otg_ctrl &= ~(OTG_BUSDROP|OTG_B_BUSREQ) 1163 otg_ctrl &= ~(OTG_BUSDROP|OTG_B_BUSREQ)
1136 & OTG_CTRL_MASK; 1164 & OTG_CTRL_MASK;
1137 OTG_CTRL_REG = otg_ctrl; 1165 omap_writel(otg_ctrl, OTG_CTRL);
1138 break; 1166 break;
1139 case OTG_STATE_B_WAIT_ACON: 1167 case OTG_STATE_B_WAIT_ACON:
1140 isp->otg.state = OTG_STATE_B_HOST; 1168 isp->otg.state = OTG_STATE_B_HOST;
@@ -1274,7 +1302,7 @@ isp1301_set_host(struct otg_transceiver *otg, struct usb_bus *host)
1274 return -ENODEV; 1302 return -ENODEV;
1275 1303
1276 if (!host) { 1304 if (!host) {
1277 OTG_IRQ_EN_REG = 0; 1305 omap_writew(0, OTG_IRQ_EN);
1278 power_down(isp); 1306 power_down(isp);
1279 isp->otg.host = 0; 1307 isp->otg.host = 0;
1280 return 0; 1308 return 0;
@@ -1325,12 +1353,13 @@ static int
1325isp1301_set_peripheral(struct otg_transceiver *otg, struct usb_gadget *gadget) 1353isp1301_set_peripheral(struct otg_transceiver *otg, struct usb_gadget *gadget)
1326{ 1354{
1327 struct isp1301 *isp = container_of(otg, struct isp1301, otg); 1355 struct isp1301 *isp = container_of(otg, struct isp1301, otg);
1356 u32 l;
1328 1357
1329 if (!otg || isp != the_transceiver) 1358 if (!otg || isp != the_transceiver)
1330 return -ENODEV; 1359 return -ENODEV;
1331 1360
1332 if (!gadget) { 1361 if (!gadget) {
1333 OTG_IRQ_EN_REG = 0; 1362 omap_writew(0, OTG_IRQ_EN);
1334 if (!isp->otg.default_a) 1363 if (!isp->otg.default_a)
1335 enable_vbus_draw(isp, 0); 1364 enable_vbus_draw(isp, 0);
1336 usb_gadget_vbus_disconnect(isp->otg.gadget); 1365 usb_gadget_vbus_disconnect(isp->otg.gadget);
@@ -1351,9 +1380,11 @@ isp1301_set_peripheral(struct otg_transceiver *otg, struct usb_gadget *gadget)
1351 isp->otg.gadget = gadget; 1380 isp->otg.gadget = gadget;
1352 // FIXME update its refcount 1381 // FIXME update its refcount
1353 1382
1354 OTG_CTRL_REG = (OTG_CTRL_REG & OTG_CTRL_MASK 1383 l = omap_readl(OTG_CTRL) & OTG_CTRL_MASK;
1355 & ~(OTG_XCEIV_OUTPUTS|OTG_CTRL_BITS)) 1384 l &= ~(OTG_XCEIV_OUTPUTS|OTG_CTRL_BITS);
1356 | OTG_ID; 1385 l |= OTG_ID;
1386 omap_writel(l, OTG_CTRL);
1387
1357 power_up(isp); 1388 power_up(isp);
1358 isp->otg.state = OTG_STATE_B_IDLE; 1389 isp->otg.state = OTG_STATE_B_IDLE;
1359 1390
@@ -1405,16 +1436,17 @@ isp1301_start_srp(struct otg_transceiver *dev)
1405 || isp->otg.state != OTG_STATE_B_IDLE) 1436 || isp->otg.state != OTG_STATE_B_IDLE)
1406 return -ENODEV; 1437 return -ENODEV;
1407 1438
1408 otg_ctrl = OTG_CTRL_REG; 1439 otg_ctrl = omap_readl(OTG_CTRL);
1409 if (!(otg_ctrl & OTG_BSESSEND)) 1440 if (!(otg_ctrl & OTG_BSESSEND))
1410 return -EINVAL; 1441 return -EINVAL;
1411 1442
1412 otg_ctrl |= OTG_B_BUSREQ; 1443 otg_ctrl |= OTG_B_BUSREQ;
1413 otg_ctrl &= ~OTG_A_BUSREQ & OTG_CTRL_MASK; 1444 otg_ctrl &= ~OTG_A_BUSREQ & OTG_CTRL_MASK;
1414 OTG_CTRL_REG = otg_ctrl; 1445 omap_writel(otg_ctrl, OTG_CTRL);
1415 isp->otg.state = OTG_STATE_B_SRP_INIT; 1446 isp->otg.state = OTG_STATE_B_SRP_INIT;
1416 1447
1417 pr_debug("otg: SRP, %s ... %06x\n", state_name(isp), OTG_CTRL_REG); 1448 pr_debug("otg: SRP, %s ... %06x\n", state_name(isp),
1449 omap_readl(OTG_CTRL));
1418#ifdef CONFIG_USB_OTG 1450#ifdef CONFIG_USB_OTG
1419 check_state(isp, __func__); 1451 check_state(isp, __func__);
1420#endif 1452#endif
@@ -1426,6 +1458,7 @@ isp1301_start_hnp(struct otg_transceiver *dev)
1426{ 1458{
1427#ifdef CONFIG_USB_OTG 1459#ifdef CONFIG_USB_OTG
1428 struct isp1301 *isp = container_of(dev, struct isp1301, otg); 1460 struct isp1301 *isp = container_of(dev, struct isp1301, otg);
1461 u32 l;
1429 1462
1430 if (!dev || isp != the_transceiver) 1463 if (!dev || isp != the_transceiver)
1431 return -ENODEV; 1464 return -ENODEV;
@@ -1452,7 +1485,9 @@ isp1301_start_hnp(struct otg_transceiver *dev)
1452#endif 1485#endif
1453 /* caller must suspend then clear A_BUSREQ */ 1486 /* caller must suspend then clear A_BUSREQ */
1454 usb_gadget_vbus_connect(isp->otg.gadget); 1487 usb_gadget_vbus_connect(isp->otg.gadget);
1455 OTG_CTRL_REG |= OTG_A_SETB_HNPEN; 1488 l = omap_readl(OTG_CTRL);
1489 l |= OTG_A_SETB_HNPEN;
1490 omap_writel(l, OTG_CTRL);
1456 1491
1457 break; 1492 break;
1458 case OTG_STATE_A_PERIPHERAL: 1493 case OTG_STATE_A_PERIPHERAL:
@@ -1462,7 +1497,7 @@ isp1301_start_hnp(struct otg_transceiver *dev)
1462 return -EILSEQ; 1497 return -EILSEQ;
1463 } 1498 }
1464 pr_debug("otg: HNP %s, %06x ...\n", 1499 pr_debug("otg: HNP %s, %06x ...\n",
1465 state_name(isp), OTG_CTRL_REG); 1500 state_name(isp), omap_readl(OTG_CTRL));
1466 check_state(isp, __func__); 1501 check_state(isp, __func__);
1467 return 0; 1502 return 0;
1468#else 1503#else
diff --git a/drivers/ide/Kconfig b/drivers/ide/Kconfig
index 8e07de23d220..1607536ff5fb 100644
--- a/drivers/ide/Kconfig
+++ b/drivers/ide/Kconfig
@@ -823,6 +823,13 @@ config BLK_DEV_IDE_RAPIDE
823 Say Y here if you want to support the Yellowstone RapIDE controller 823 Say Y here if you want to support the Yellowstone RapIDE controller
824 manufactured for use with Acorn computers. 824 manufactured for use with Acorn computers.
825 825
826config BLK_DEV_IDE_BAST
827 tristate "Simtec BAST / Thorcom VR1000 IDE support"
828 depends on ARM && (ARCH_BAST || MACH_VR1000)
829 help
830 Say Y here if you want to support the onboard IDE channels on the
831 Simtec BAST or the Thorcom VR1000
832
826config IDE_H8300 833config IDE_H8300
827 tristate "H8300 IDE support" 834 tristate "H8300 IDE support"
828 depends on H8300 835 depends on H8300
diff --git a/drivers/ide/arm/Makefile b/drivers/ide/arm/Makefile
index 5bc26053afa6..936e7b0237f5 100644
--- a/drivers/ide/arm/Makefile
+++ b/drivers/ide/arm/Makefile
@@ -1,6 +1,7 @@
1 1
2obj-$(CONFIG_BLK_DEV_IDE_ICSIDE) += icside.o 2obj-$(CONFIG_BLK_DEV_IDE_ICSIDE) += icside.o
3obj-$(CONFIG_BLK_DEV_IDE_RAPIDE) += rapide.o 3obj-$(CONFIG_BLK_DEV_IDE_RAPIDE) += rapide.o
4obj-$(CONFIG_BLK_DEV_IDE_BAST) += bast-ide.o
4obj-$(CONFIG_BLK_DEV_PALMCHIP_BK3710) += palm_bk3710.o 5obj-$(CONFIG_BLK_DEV_PALMCHIP_BK3710) += palm_bk3710.o
5 6
6ifeq ($(CONFIG_IDE_ARM), m) 7ifeq ($(CONFIG_IDE_ARM), m)
diff --git a/drivers/ide/arm/bast-ide.c b/drivers/ide/arm/bast-ide.c
new file mode 100644
index 000000000000..8e8c28104b45
--- /dev/null
+++ b/drivers/ide/arm/bast-ide.c
@@ -0,0 +1,90 @@
1/*
2 * Copyright (c) 2003-2004 Simtec Electronics
3 * Ben Dooks <ben@simtec.co.uk>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
8 *
9*/
10
11#include <linux/module.h>
12#include <linux/errno.h>
13#include <linux/ide.h>
14#include <linux/init.h>
15
16#include <asm/mach-types.h>
17
18#include <asm/io.h>
19#include <asm/irq.h>
20#include <asm/arch/map.h>
21#include <asm/arch/bast-map.h>
22#include <asm/arch/bast-irq.h>
23
24#define DRV_NAME "bast-ide"
25
26static int __init bastide_register(unsigned int base, unsigned int aux, int irq)
27{
28 ide_hwif_t *hwif;
29 hw_regs_t hw;
30 int i;
31 u8 idx[4] = { 0xff, 0xff, 0xff, 0xff };
32
33 memset(&hw, 0, sizeof(hw));
34
35 base += BAST_IDE_CS;
36 aux += BAST_IDE_CS;
37
38 for (i = 0; i <= 7; i++) {
39 hw.io_ports_array[i] = (unsigned long)base;
40 base += 0x20;
41 }
42
43 hw.io_ports.ctl_addr = aux + (6 * 0x20);
44 hw.irq = irq;
45 hw.chipset = ide_generic;
46
47 hwif = ide_find_port();
48 if (hwif == NULL)
49 goto out;
50
51 i = hwif->index;
52
53 ide_init_port_data(hwif, i);
54 ide_init_port_hw(hwif, &hw);
55 hwif->port_ops = NULL;
56
57 idx[0] = i;
58
59 ide_device_add(idx, NULL);
60out:
61 return 0;
62}
63
64static int __init bastide_init(void)
65{
66 unsigned long base = BAST_VA_IDEPRI + BAST_IDE_CS;
67
68 /* we can treat the VR1000 and the BAST the same */
69
70 if (!(machine_is_bast() || machine_is_vr1000()))
71 return 0;
72
73 printk("BAST: IDE driver, (c) 2003-2004 Simtec Electronics\n");
74
75 if (!request_mem_region(base, 0x400000, DRV_NAME)) {
76 printk(KERN_ERR "%s: resources busy\n", DRV_NAME);
77 return -EBUSY;
78 }
79
80 bastide_register(BAST_VA_IDEPRI, BAST_VA_IDEPRIAUX, IRQ_IDE0);
81 bastide_register(BAST_VA_IDESEC, BAST_VA_IDESECAUX, IRQ_IDE1);
82
83 return 0;
84}
85
86module_init(bastide_init);
87
88MODULE_AUTHOR("Ben Dooks <ben@simtec.co.uk>");
89MODULE_LICENSE("GPL");
90MODULE_DESCRIPTION("Simtec BAST / Thorcom VR1000 IDE driver");
diff --git a/drivers/ide/ide-proc.c b/drivers/ide/ide-proc.c
index 55ec7f798772..8af88bf0969b 100644
--- a/drivers/ide/ide-proc.c
+++ b/drivers/ide/ide-proc.c
@@ -76,7 +76,7 @@ static int proc_ide_read_mate
76 ide_hwif_t *hwif = (ide_hwif_t *) data; 76 ide_hwif_t *hwif = (ide_hwif_t *) data;
77 int len; 77 int len;
78 78
79 if (hwif && hwif->mate && hwif->mate->present) 79 if (hwif && hwif->mate)
80 len = sprintf(page, "%s\n", hwif->mate->name); 80 len = sprintf(page, "%s\n", hwif->mate->name);
81 else 81 else
82 len = sprintf(page, "(none)\n"); 82 len = sprintf(page, "(none)\n");
diff --git a/drivers/infiniband/hw/mthca/mthca_memfree.c b/drivers/infiniband/hw/mthca/mthca_memfree.c
index b224079d4e1f..d5862e5d99a0 100644
--- a/drivers/infiniband/hw/mthca/mthca_memfree.c
+++ b/drivers/infiniband/hw/mthca/mthca_memfree.c
@@ -109,7 +109,11 @@ static int mthca_alloc_icm_pages(struct scatterlist *mem, int order, gfp_t gfp_m
109{ 109{
110 struct page *page; 110 struct page *page;
111 111
112 page = alloc_pages(gfp_mask, order); 112 /*
113 * Use __GFP_ZERO because buggy firmware assumes ICM pages are
114 * cleared, and subtle failures are seen if they aren't.
115 */
116 page = alloc_pages(gfp_mask | __GFP_ZERO, order);
113 if (!page) 117 if (!page)
114 return -ENOMEM; 118 return -ENOMEM;
115 119
diff --git a/drivers/input/ff-core.c b/drivers/input/ff-core.c
index eebc72465fc9..72c63e5dd630 100644
--- a/drivers/input/ff-core.c
+++ b/drivers/input/ff-core.c
@@ -28,6 +28,7 @@
28#include <linux/input.h> 28#include <linux/input.h>
29#include <linux/module.h> 29#include <linux/module.h>
30#include <linux/mutex.h> 30#include <linux/mutex.h>
31#include <linux/sched.h>
31 32
32/* 33/*
33 * Check that the effect_id is a valid effect and whether the user 34 * Check that the effect_id is a valid effect and whether the user
@@ -166,8 +167,10 @@ int input_ff_upload(struct input_dev *dev, struct ff_effect *effect,
166 if (ret) 167 if (ret)
167 goto out; 168 goto out;
168 169
170 spin_lock_irq(&dev->event_lock);
169 ff->effects[id] = *effect; 171 ff->effects[id] = *effect;
170 ff->effect_owners[id] = file; 172 ff->effect_owners[id] = file;
173 spin_unlock_irq(&dev->event_lock);
171 174
172 out: 175 out:
173 mutex_unlock(&ff->mutex); 176 mutex_unlock(&ff->mutex);
@@ -189,16 +192,22 @@ static int erase_effect(struct input_dev *dev, int effect_id,
189 if (error) 192 if (error)
190 return error; 193 return error;
191 194
195 spin_lock_irq(&dev->event_lock);
192 ff->playback(dev, effect_id, 0); 196 ff->playback(dev, effect_id, 0);
197 ff->effect_owners[effect_id] = NULL;
198 spin_unlock_irq(&dev->event_lock);
193 199
194 if (ff->erase) { 200 if (ff->erase) {
195 error = ff->erase(dev, effect_id); 201 error = ff->erase(dev, effect_id);
196 if (error) 202 if (error) {
203 spin_lock_irq(&dev->event_lock);
204 ff->effect_owners[effect_id] = file;
205 spin_unlock_irq(&dev->event_lock);
206
197 return error; 207 return error;
208 }
198 } 209 }
199 210
200 ff->effect_owners[effect_id] = NULL;
201
202 return 0; 211 return 0;
203} 212}
204 213
@@ -263,8 +272,6 @@ int input_ff_event(struct input_dev *dev, unsigned int type,
263 if (type != EV_FF) 272 if (type != EV_FF)
264 return 0; 273 return 0;
265 274
266 mutex_lock(&ff->mutex);
267
268 switch (code) { 275 switch (code) {
269 case FF_GAIN: 276 case FF_GAIN:
270 if (!test_bit(FF_GAIN, dev->ffbit) || value > 0xffff) 277 if (!test_bit(FF_GAIN, dev->ffbit) || value > 0xffff)
@@ -286,7 +293,6 @@ int input_ff_event(struct input_dev *dev, unsigned int type,
286 break; 293 break;
287 } 294 }
288 295
289 mutex_unlock(&ff->mutex);
290 return 0; 296 return 0;
291} 297}
292EXPORT_SYMBOL_GPL(input_ff_event); 298EXPORT_SYMBOL_GPL(input_ff_event);
diff --git a/drivers/lguest/x86/core.c b/drivers/lguest/x86/core.c
index 5126d5d9ea0e..2e554a4ab337 100644
--- a/drivers/lguest/x86/core.c
+++ b/drivers/lguest/x86/core.c
@@ -176,7 +176,7 @@ void lguest_arch_run_guest(struct lg_cpu *cpu)
176 * we set it now, so we can trap and pass that trap to the Guest if it 176 * we set it now, so we can trap and pass that trap to the Guest if it
177 * uses the FPU. */ 177 * uses the FPU. */
178 if (cpu->ts) 178 if (cpu->ts)
179 lguest_set_ts(); 179 unlazy_fpu(current);
180 180
181 /* SYSENTER is an optimized way of doing system calls. We can't allow 181 /* SYSENTER is an optimized way of doing system calls. We can't allow
182 * it because it always jumps to privilege level 0. A normal Guest 182 * it because it always jumps to privilege level 0. A normal Guest
@@ -196,6 +196,10 @@ void lguest_arch_run_guest(struct lg_cpu *cpu)
196 * trap made the switcher code come back, and an error code which some 196 * trap made the switcher code come back, and an error code which some
197 * traps set. */ 197 * traps set. */
198 198
199 /* Restore SYSENTER if it's supposed to be on. */
200 if (boot_cpu_has(X86_FEATURE_SEP))
201 wrmsr(MSR_IA32_SYSENTER_CS, __KERNEL_CS, 0);
202
199 /* If the Guest page faulted, then the cr2 register will tell us the 203 /* If the Guest page faulted, then the cr2 register will tell us the
200 * bad virtual address. We have to grab this now, because once we 204 * bad virtual address. We have to grab this now, because once we
201 * re-enable interrupts an interrupt could fault and thus overwrite 205 * re-enable interrupts an interrupt could fault and thus overwrite
@@ -203,13 +207,12 @@ void lguest_arch_run_guest(struct lg_cpu *cpu)
203 if (cpu->regs->trapnum == 14) 207 if (cpu->regs->trapnum == 14)
204 cpu->arch.last_pagefault = read_cr2(); 208 cpu->arch.last_pagefault = read_cr2();
205 /* Similarly, if we took a trap because the Guest used the FPU, 209 /* Similarly, if we took a trap because the Guest used the FPU,
206 * we have to restore the FPU it expects to see. */ 210 * we have to restore the FPU it expects to see.
211 * math_state_restore() may sleep and we may even move off to
212 * a different CPU. So all the critical stuff should be done
213 * before this. */
207 else if (cpu->regs->trapnum == 7) 214 else if (cpu->regs->trapnum == 7)
208 math_state_restore(); 215 math_state_restore();
209
210 /* Restore SYSENTER if it's supposed to be on. */
211 if (boot_cpu_has(X86_FEATURE_SEP))
212 wrmsr(MSR_IA32_SYSENTER_CS, __KERNEL_CS, 0);
213} 216}
214 217
215/*H:130 Now we've examined the hypercall code; our Guest can make requests. 218/*H:130 Now we've examined the hypercall code; our Guest can make requests.
diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c
index 835def11419d..ab6a61db63ce 100644
--- a/drivers/md/dm-crypt.c
+++ b/drivers/md/dm-crypt.c
@@ -432,6 +432,7 @@ static int crypt_convert(struct crypt_config *cc,
432 case 0: 432 case 0:
433 atomic_dec(&ctx->pending); 433 atomic_dec(&ctx->pending);
434 ctx->sector++; 434 ctx->sector++;
435 cond_resched();
435 continue; 436 continue;
436 437
437 /* error */ 438 /* error */
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 7cf512a34ccf..2580ac1b9b0f 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -3897,8 +3897,10 @@ static void autorun_devices(int part)
3897 3897
3898 md_probe(dev, NULL, NULL); 3898 md_probe(dev, NULL, NULL);
3899 mddev = mddev_find(dev); 3899 mddev = mddev_find(dev);
3900 if (!mddev) { 3900 if (!mddev || !mddev->gendisk) {
3901 printk(KERN_ERR 3901 if (mddev)
3902 mddev_put(mddev);
3903 printk(KERN_ERR
3902 "md: cannot allocate memory for md drive.\n"); 3904 "md: cannot allocate memory for md drive.\n");
3903 break; 3905 break;
3904 } 3906 }
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
index 1de17da34a95..a71277b640ab 100644
--- a/drivers/md/raid10.c
+++ b/drivers/md/raid10.c
@@ -2137,6 +2137,8 @@ static int run(mddev_t *mddev)
2137 !test_bit(In_sync, &disk->rdev->flags)) { 2137 !test_bit(In_sync, &disk->rdev->flags)) {
2138 disk->head_position = 0; 2138 disk->head_position = 0;
2139 mddev->degraded++; 2139 mddev->degraded++;
2140 if (disk->rdev)
2141 conf->fullsync = 1;
2140 } 2142 }
2141 } 2143 }
2142 2144
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index c37e256b1176..54c8ee28fcc4 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -2898,6 +2898,8 @@ static void handle_stripe5(struct stripe_head *sh)
2898 2898
2899 for (i = conf->raid_disks; i--; ) { 2899 for (i = conf->raid_disks; i--; ) {
2900 set_bit(R5_Wantwrite, &sh->dev[i].flags); 2900 set_bit(R5_Wantwrite, &sh->dev[i].flags);
2901 set_bit(R5_LOCKED, &dev->flags);
2902 s.locked++;
2901 if (!test_and_set_bit(STRIPE_OP_IO, &sh->ops.pending)) 2903 if (!test_and_set_bit(STRIPE_OP_IO, &sh->ops.pending))
2902 sh->ops.count++; 2904 sh->ops.count++;
2903 } 2905 }
@@ -2911,6 +2913,7 @@ static void handle_stripe5(struct stripe_head *sh)
2911 conf->raid_disks); 2913 conf->raid_disks);
2912 s.locked += handle_write_operations5(sh, 1, 1); 2914 s.locked += handle_write_operations5(sh, 1, 1);
2913 } else if (s.expanded && 2915 } else if (s.expanded &&
2916 s.locked == 0 &&
2914 !test_bit(STRIPE_OP_POSTXOR, &sh->ops.pending)) { 2917 !test_bit(STRIPE_OP_POSTXOR, &sh->ops.pending)) {
2915 clear_bit(STRIPE_EXPAND_READY, &sh->state); 2918 clear_bit(STRIPE_EXPAND_READY, &sh->state);
2916 atomic_dec(&conf->reshape_stripes); 2919 atomic_dec(&conf->reshape_stripes);
@@ -4305,7 +4308,9 @@ static int run(mddev_t *mddev)
4305 " disk %d\n", bdevname(rdev->bdev,b), 4308 " disk %d\n", bdevname(rdev->bdev,b),
4306 raid_disk); 4309 raid_disk);
4307 working_disks++; 4310 working_disks++;
4308 } 4311 } else
4312 /* Cannot rely on bitmap to complete recovery */
4313 conf->fullsync = 1;
4309 } 4314 }
4310 4315
4311 /* 4316 /*
diff --git a/drivers/media/common/ir-keymaps.c b/drivers/media/common/ir-keymaps.c
index a3485817e46c..8fa91f846d59 100644
--- a/drivers/media/common/ir-keymaps.c
+++ b/drivers/media/common/ir-keymaps.c
@@ -2201,3 +2201,41 @@ IR_KEYTAB_TYPE ir_codes_powercolor_real_angel[IR_KEYTAB_SIZE] = {
2201 [0x25] = KEY_POWER, /* power */ 2201 [0x25] = KEY_POWER, /* power */
2202}; 2202};
2203EXPORT_SYMBOL_GPL(ir_codes_powercolor_real_angel); 2203EXPORT_SYMBOL_GPL(ir_codes_powercolor_real_angel);
2204
2205IR_KEYTAB_TYPE ir_codes_avermedia_a16d[IR_KEYTAB_SIZE] = {
2206 [0x20] = KEY_LIST,
2207 [0x00] = KEY_POWER,
2208 [0x28] = KEY_1,
2209 [0x18] = KEY_2,
2210 [0x38] = KEY_3,
2211 [0x24] = KEY_4,
2212 [0x14] = KEY_5,
2213 [0x34] = KEY_6,
2214 [0x2c] = KEY_7,
2215 [0x1c] = KEY_8,
2216 [0x3c] = KEY_9,
2217 [0x12] = KEY_SUBTITLE,
2218 [0x22] = KEY_0,
2219 [0x32] = KEY_REWIND,
2220 [0x3a] = KEY_SHUFFLE,
2221 [0x02] = KEY_PRINT,
2222 [0x11] = KEY_CHANNELDOWN,
2223 [0x31] = KEY_CHANNELUP,
2224 [0x0c] = KEY_ZOOM,
2225 [0x1e] = KEY_VOLUMEDOWN,
2226 [0x3e] = KEY_VOLUMEUP,
2227 [0x0a] = KEY_MUTE,
2228 [0x04] = KEY_AUDIO,
2229 [0x26] = KEY_RECORD,
2230 [0x06] = KEY_PLAY,
2231 [0x36] = KEY_STOP,
2232 [0x16] = KEY_PAUSE,
2233 [0x2e] = KEY_REWIND,
2234 [0x0e] = KEY_FASTFORWARD,
2235 [0x30] = KEY_TEXT,
2236 [0x21] = KEY_GREEN,
2237 [0x01] = KEY_BLUE,
2238 [0x08] = KEY_EPG,
2239 [0x2a] = KEY_MENU,
2240};
2241EXPORT_SYMBOL_GPL(ir_codes_avermedia_a16d);
diff --git a/drivers/media/common/tuners/tda18271-common.c b/drivers/media/common/tuners/tda18271-common.c
index f1894fec32b9..6fb5b4586569 100644
--- a/drivers/media/common/tuners/tda18271-common.c
+++ b/drivers/media/common/tuners/tda18271-common.c
@@ -649,9 +649,17 @@ int tda18271_calc_rf_cal(struct dvb_frontend *fe, u32 *freq)
649 u8 val; 649 u8 val;
650 650
651 int ret = tda18271_lookup_map(fe, RF_CAL, freq, &val); 651 int ret = tda18271_lookup_map(fe, RF_CAL, freq, &val);
652 /* The TDA18271HD/C1 rf_cal map lookup is expected to go out of range
653 * for frequencies above 61.1 MHz. In these cases, the internal RF
654 * tracking filters calibration mechanism is used.
655 *
656 * There is no need to warn the user about this.
657 */
658 if (ret < 0)
659 goto fail;
652 660
653 regs[R_EB14] = val; 661 regs[R_EB14] = val;
654 662fail:
655 return ret; 663 return ret;
656} 664}
657 665
diff --git a/drivers/media/common/tuners/tda18271-fe.c b/drivers/media/common/tuners/tda18271-fe.c
index 89c01fb1f859..93063c6fbbf6 100644
--- a/drivers/media/common/tuners/tda18271-fe.c
+++ b/drivers/media/common/tuners/tda18271-fe.c
@@ -45,6 +45,21 @@ static inline int charge_pump_source(struct dvb_frontend *fe, int force)
45 TDA18271_MAIN_PLL, force); 45 TDA18271_MAIN_PLL, force);
46} 46}
47 47
48static inline void tda18271_set_if_notch(struct dvb_frontend *fe)
49{
50 struct tda18271_priv *priv = fe->tuner_priv;
51 unsigned char *regs = priv->tda18271_regs;
52
53 switch (priv->mode) {
54 case TDA18271_ANALOG:
55 regs[R_MPD] &= ~0x80; /* IF notch = 0 */
56 break;
57 case TDA18271_DIGITAL:
58 regs[R_MPD] |= 0x80; /* IF notch = 1 */
59 break;
60 }
61}
62
48static int tda18271_channel_configuration(struct dvb_frontend *fe, 63static int tda18271_channel_configuration(struct dvb_frontend *fe,
49 struct tda18271_std_map_item *map, 64 struct tda18271_std_map_item *map,
50 u32 freq, u32 bw) 65 u32 freq, u32 bw)
@@ -60,25 +75,18 @@ static int tda18271_channel_configuration(struct dvb_frontend *fe,
60 regs[R_EP3] &= ~0x1f; /* clear std bits */ 75 regs[R_EP3] &= ~0x1f; /* clear std bits */
61 regs[R_EP3] |= (map->agc_mode << 3) | map->std; 76 regs[R_EP3] |= (map->agc_mode << 3) | map->std;
62 77
63 /* set rfagc to high speed mode */ 78 if (priv->id == TDA18271HDC2) {
64 regs[R_EP3] &= ~0x04; 79 /* set rfagc to high speed mode */
80 regs[R_EP3] &= ~0x04;
81 }
65 82
66 /* set cal mode to normal */ 83 /* set cal mode to normal */
67 regs[R_EP4] &= ~0x03; 84 regs[R_EP4] &= ~0x03;
68 85
69 /* update IF output level & IF notch frequency */ 86 /* update IF output level */
70 regs[R_EP4] &= ~0x1c; /* clear if level bits */ 87 regs[R_EP4] &= ~0x1c; /* clear if level bits */
71 regs[R_EP4] |= (map->if_lvl << 2); 88 regs[R_EP4] |= (map->if_lvl << 2);
72 89
73 switch (priv->mode) {
74 case TDA18271_ANALOG:
75 regs[R_MPD] &= ~0x80; /* IF notch = 0 */
76 break;
77 case TDA18271_DIGITAL:
78 regs[R_MPD] |= 0x80; /* IF notch = 1 */
79 break;
80 }
81
82 /* update FM_RFn */ 90 /* update FM_RFn */
83 regs[R_EP4] &= ~0x80; 91 regs[R_EP4] &= ~0x80;
84 regs[R_EP4] |= map->fm_rfn << 7; 92 regs[R_EP4] |= map->fm_rfn << 7;
@@ -95,6 +103,9 @@ static int tda18271_channel_configuration(struct dvb_frontend *fe,
95 /* disable Power Level Indicator */ 103 /* disable Power Level Indicator */
96 regs[R_EP1] |= 0x40; 104 regs[R_EP1] |= 0x40;
97 105
106 /* make sure thermometer is off */
107 regs[R_TM] &= ~0x10;
108
98 /* frequency dependent parameters */ 109 /* frequency dependent parameters */
99 110
100 tda18271_calc_ir_measure(fe, &freq); 111 tda18271_calc_ir_measure(fe, &freq);
@@ -135,6 +146,7 @@ static int tda18271_channel_configuration(struct dvb_frontend *fe,
135 switch (priv->role) { 146 switch (priv->role) {
136 case TDA18271_MASTER: 147 case TDA18271_MASTER:
137 tda18271_calc_main_pll(fe, N); 148 tda18271_calc_main_pll(fe, N);
149 tda18271_set_if_notch(fe);
138 tda18271_write_regs(fe, R_MPD, 4); 150 tda18271_write_regs(fe, R_MPD, 4);
139 break; 151 break;
140 case TDA18271_SLAVE: 152 case TDA18271_SLAVE:
@@ -142,6 +154,7 @@ static int tda18271_channel_configuration(struct dvb_frontend *fe,
142 tda18271_write_regs(fe, R_CPD, 4); 154 tda18271_write_regs(fe, R_CPD, 4);
143 155
144 regs[R_MPD] = regs[R_CPD] & 0x7f; 156 regs[R_MPD] = regs[R_CPD] & 0x7f;
157 tda18271_set_if_notch(fe);
145 tda18271_write_regs(fe, R_MPD, 1); 158 tda18271_write_regs(fe, R_MPD, 1);
146 break; 159 break;
147 } 160 }
@@ -160,12 +173,14 @@ static int tda18271_channel_configuration(struct dvb_frontend *fe,
160 173
161 msleep(20); 174 msleep(20);
162 175
163 /* set rfagc to normal speed mode */ 176 if (priv->id == TDA18271HDC2) {
164 if (map->fm_rfn) 177 /* set rfagc to normal speed mode */
165 regs[R_EP3] &= ~0x04; 178 if (map->fm_rfn)
166 else 179 regs[R_EP3] &= ~0x04;
167 regs[R_EP3] |= 0x04; 180 else
168 ret = tda18271_write_regs(fe, R_EP3, 1); 181 regs[R_EP3] |= 0x04;
182 ret = tda18271_write_regs(fe, R_EP3, 1);
183 }
169fail: 184fail:
170 return ret; 185 return ret;
171} 186}
@@ -507,7 +522,7 @@ static int tda18271_powerscan_init(struct dvb_frontend *fe)
507 /* set cal mode to normal */ 522 /* set cal mode to normal */
508 regs[R_EP4] &= ~0x03; 523 regs[R_EP4] &= ~0x03;
509 524
510 /* update IF output level & IF notch frequency */ 525 /* update IF output level */
511 regs[R_EP4] &= ~0x1c; /* clear if level bits */ 526 regs[R_EP4] &= ~0x1c; /* clear if level bits */
512 527
513 ret = tda18271_write_regs(fe, R_EP3, 2); 528 ret = tda18271_write_regs(fe, R_EP3, 2);
diff --git a/drivers/media/common/tuners/xc5000.c b/drivers/media/common/tuners/xc5000.c
index ceae6db901ec..7cf4f5bdb2ec 100644
--- a/drivers/media/common/tuners/xc5000.c
+++ b/drivers/media/common/tuners/xc5000.c
@@ -177,6 +177,7 @@ static XC_TV_STANDARD XC5000_Standard[MAX_TV_STANDARD] = {
177 {"FM Radio-INPUT1", 0x0208, 0x9002} 177 {"FM Radio-INPUT1", 0x0208, 0x9002}
178}; 178};
179 179
180static int xc5000_is_firmware_loaded(struct dvb_frontend *fe);
180static int xc5000_writeregs(struct xc5000_priv *priv, u8 *buf, u8 len); 181static int xc5000_writeregs(struct xc5000_priv *priv, u8 *buf, u8 len);
181static int xc5000_readregs(struct xc5000_priv *priv, u8 *buf, u8 len); 182static int xc5000_readregs(struct xc5000_priv *priv, u8 *buf, u8 len);
182static void xc5000_TunerReset(struct dvb_frontend *fe); 183static void xc5000_TunerReset(struct dvb_frontend *fe);
@@ -352,7 +353,7 @@ static int xc_SetTVStandard(struct xc5000_priv *priv,
352 353
353static int xc_shutdown(struct xc5000_priv *priv) 354static int xc_shutdown(struct xc5000_priv *priv)
354{ 355{
355 return 0; 356 return XC_RESULT_SUCCESS;
356 /* Fixme: cannot bring tuner back alive once shutdown 357 /* Fixme: cannot bring tuner back alive once shutdown
357 * without reloading the driver modules. 358 * without reloading the driver modules.
358 * return xc_write_reg(priv, XREG_POWER_DOWN, 0); 359 * return xc_write_reg(priv, XREG_POWER_DOWN, 0);
@@ -685,6 +686,25 @@ static int xc5000_set_params(struct dvb_frontend *fe,
685 return 0; 686 return 0;
686} 687}
687 688
689static int xc5000_is_firmware_loaded(struct dvb_frontend *fe)
690{
691 struct xc5000_priv *priv = fe->tuner_priv;
692 int ret;
693 u16 id;
694
695 ret = xc5000_readreg(priv, XREG_PRODUCT_ID, &id);
696 if (ret == XC_RESULT_SUCCESS) {
697 if (id == XC_PRODUCT_ID_FW_NOT_LOADED)
698 ret = XC_RESULT_RESET_FAILURE;
699 else
700 ret = XC_RESULT_SUCCESS;
701 }
702
703 dprintk(1, "%s() returns %s id = 0x%x\n", __func__,
704 ret == XC_RESULT_SUCCESS ? "True" : "False", id);
705 return ret;
706}
707
688static int xc_load_fw_and_init_tuner(struct dvb_frontend *fe); 708static int xc_load_fw_and_init_tuner(struct dvb_frontend *fe);
689 709
690static int xc5000_set_analog_params(struct dvb_frontend *fe, 710static int xc5000_set_analog_params(struct dvb_frontend *fe,
@@ -693,7 +713,7 @@ static int xc5000_set_analog_params(struct dvb_frontend *fe,
693 struct xc5000_priv *priv = fe->tuner_priv; 713 struct xc5000_priv *priv = fe->tuner_priv;
694 int ret; 714 int ret;
695 715
696 if(priv->fwloaded == 0) 716 if (xc5000_is_firmware_loaded(fe) != XC_RESULT_SUCCESS)
697 xc_load_fw_and_init_tuner(fe); 717 xc_load_fw_and_init_tuner(fe);
698 718
699 dprintk(1, "%s() frequency=%d (in units of 62.5khz)\n", 719 dprintk(1, "%s() frequency=%d (in units of 62.5khz)\n",
@@ -808,11 +828,10 @@ static int xc_load_fw_and_init_tuner(struct dvb_frontend *fe)
808 struct xc5000_priv *priv = fe->tuner_priv; 828 struct xc5000_priv *priv = fe->tuner_priv;
809 int ret = 0; 829 int ret = 0;
810 830
811 if (priv->fwloaded == 0) { 831 if (xc5000_is_firmware_loaded(fe) != XC_RESULT_SUCCESS) {
812 ret = xc5000_fwupload(fe); 832 ret = xc5000_fwupload(fe);
813 if (ret != XC_RESULT_SUCCESS) 833 if (ret != XC_RESULT_SUCCESS)
814 return ret; 834 return ret;
815 priv->fwloaded = 1;
816 } 835 }
817 836
818 /* Start the tuner self-calibration process */ 837 /* Start the tuner self-calibration process */
@@ -852,7 +871,6 @@ static int xc5000_sleep(struct dvb_frontend *fe)
852 return -EREMOTEIO; 871 return -EREMOTEIO;
853 } 872 }
854 else { 873 else {
855 /* priv->fwloaded = 0; */
856 return XC_RESULT_SUCCESS; 874 return XC_RESULT_SUCCESS;
857 } 875 }
858} 876}
@@ -933,7 +951,6 @@ struct dvb_frontend *xc5000_attach(struct dvb_frontend *fe,
933 cfg->i2c_address); 951 cfg->i2c_address);
934 printk(KERN_INFO 952 printk(KERN_INFO
935 "xc5000: Firmware has been loaded previously\n"); 953 "xc5000: Firmware has been loaded previously\n");
936 priv->fwloaded = 1;
937 break; 954 break;
938 case XC_PRODUCT_ID_FW_NOT_LOADED: 955 case XC_PRODUCT_ID_FW_NOT_LOADED:
939 printk(KERN_INFO 956 printk(KERN_INFO
@@ -941,7 +958,6 @@ struct dvb_frontend *xc5000_attach(struct dvb_frontend *fe,
941 cfg->i2c_address); 958 cfg->i2c_address);
942 printk(KERN_INFO 959 printk(KERN_INFO
943 "xc5000: Firmware has not been loaded previously\n"); 960 "xc5000: Firmware has not been loaded previously\n");
944 priv->fwloaded = 0;
945 break; 961 break;
946 default: 962 default:
947 printk(KERN_ERR 963 printk(KERN_ERR
diff --git a/drivers/media/common/tuners/xc5000_priv.h b/drivers/media/common/tuners/xc5000_priv.h
index ecebfe4745ad..a72a9887fe7f 100644
--- a/drivers/media/common/tuners/xc5000_priv.h
+++ b/drivers/media/common/tuners/xc5000_priv.h
@@ -30,7 +30,6 @@ struct xc5000_priv {
30 u32 bandwidth; 30 u32 bandwidth;
31 u8 video_standard; 31 u8 video_standard;
32 u8 rf_mode; 32 u8 rf_mode;
33 u8 fwloaded;
34 33
35 void *devptr; 34 void *devptr;
36}; 35};
diff --git a/drivers/media/dvb/dvb-usb/gl861.c b/drivers/media/dvb/dvb-usb/gl861.c
index 0a8ac64a4e33..037f7ffb47b2 100644
--- a/drivers/media/dvb/dvb-usb/gl861.c
+++ b/drivers/media/dvb/dvb-usb/gl861.c
@@ -47,6 +47,8 @@ static int gl861_i2c_msg(struct dvb_usb_device *d, u8 addr,
47 return -EINVAL; 47 return -EINVAL;
48 } 48 }
49 49
50 msleep(1); /* avoid I2C errors */
51
50 return usb_control_msg(d->udev, usb_rcvctrlpipe(d->udev, 0), req, type, 52 return usb_control_msg(d->udev, usb_rcvctrlpipe(d->udev, 0), req, type,
51 value, index, rbuf, rlen, 2000); 53 value, index, rbuf, rlen, 2000);
52} 54}
@@ -92,16 +94,6 @@ static struct i2c_algorithm gl861_i2c_algo = {
92}; 94};
93 95
94/* Callbacks for DVB USB */ 96/* Callbacks for DVB USB */
95static int gl861_identify_state(struct usb_device *udev,
96 struct dvb_usb_device_properties *props,
97 struct dvb_usb_device_description **desc,
98 int *cold)
99{
100 *cold = 0;
101
102 return 0;
103}
104
105static struct zl10353_config gl861_zl10353_config = { 97static struct zl10353_config gl861_zl10353_config = {
106 .demod_address = 0x0f, 98 .demod_address = 0x0f,
107 .no_tuner = 1, 99 .no_tuner = 1,
@@ -172,7 +164,6 @@ static struct dvb_usb_device_properties gl861_properties = {
172 164
173 .size_of_priv = 0, 165 .size_of_priv = 0,
174 166
175 .identify_state = gl861_identify_state,
176 .num_adapters = 1, 167 .num_adapters = 1,
177 .adapter = {{ 168 .adapter = {{
178 169
@@ -194,13 +185,15 @@ static struct dvb_usb_device_properties gl861_properties = {
194 185
195 .num_device_descs = 2, 186 .num_device_descs = 2,
196 .devices = { 187 .devices = {
197 { "MSI Mega Sky 55801 DVB-T USB2.0", 188 {
198 { &gl861_table[0], NULL }, 189 .name = "MSI Mega Sky 55801 DVB-T USB2.0",
199 { NULL }, 190 .cold_ids = { NULL },
191 .warm_ids = { &gl861_table[0], NULL },
200 }, 192 },
201 { "A-LINK DTU DVB-T USB2.0", 193 {
202 { &gl861_table[1], NULL }, 194 .name = "A-LINK DTU DVB-T USB2.0",
203 { NULL }, 195 .cold_ids = { NULL },
196 .warm_ids = { &gl861_table[1], NULL },
204 }, 197 },
205 } 198 }
206}; 199};
diff --git a/drivers/media/dvb/dvb-usb/umt-010.c b/drivers/media/dvb/dvb-usb/umt-010.c
index 9e7653bb3b66..118aab1a3e54 100644
--- a/drivers/media/dvb/dvb-usb/umt-010.c
+++ b/drivers/media/dvb/dvb-usb/umt-010.c
@@ -107,7 +107,7 @@ static struct dvb_usb_device_properties umt_properties = {
107 /* parameter for the MPEG2-data transfer */ 107 /* parameter for the MPEG2-data transfer */
108 .stream = { 108 .stream = {
109 .type = USB_BULK, 109 .type = USB_BULK,
110 .count = 20, 110 .count = MAX_NO_URBS_FOR_DATA_STREAM,
111 .endpoint = 0x06, 111 .endpoint = 0x06,
112 .u = { 112 .u = {
113 .bulk = { 113 .bulk = {
diff --git a/drivers/media/dvb/frontends/au8522.c b/drivers/media/dvb/frontends/au8522.c
index 084a280c2d7f..03900d241a76 100644
--- a/drivers/media/dvb/frontends/au8522.c
+++ b/drivers/media/dvb/frontends/au8522.c
@@ -463,10 +463,13 @@ static int au8522_set_frontend(struct dvb_frontend *fe,
463 struct dvb_frontend_parameters *p) 463 struct dvb_frontend_parameters *p)
464{ 464{
465 struct au8522_state *state = fe->demodulator_priv; 465 struct au8522_state *state = fe->demodulator_priv;
466 int ret = -EINVAL;
466 467
467 dprintk("%s(frequency=%d)\n", __func__, p->frequency); 468 dprintk("%s(frequency=%d)\n", __func__, p->frequency);
468 469
469 state->current_frequency = p->frequency; 470 if ((state->current_frequency == p->frequency) &&
471 (state->current_modulation == p->u.vsb.modulation))
472 return 0;
470 473
471 au8522_enable_modulation(fe, p->u.vsb.modulation); 474 au8522_enable_modulation(fe, p->u.vsb.modulation);
472 475
@@ -476,11 +479,16 @@ static int au8522_set_frontend(struct dvb_frontend *fe,
476 if (fe->ops.tuner_ops.set_params) { 479 if (fe->ops.tuner_ops.set_params) {
477 if (fe->ops.i2c_gate_ctrl) 480 if (fe->ops.i2c_gate_ctrl)
478 fe->ops.i2c_gate_ctrl(fe, 1); 481 fe->ops.i2c_gate_ctrl(fe, 1);
479 fe->ops.tuner_ops.set_params(fe, p); 482 ret = fe->ops.tuner_ops.set_params(fe, p);
480 if (fe->ops.i2c_gate_ctrl) 483 if (fe->ops.i2c_gate_ctrl)
481 fe->ops.i2c_gate_ctrl(fe, 0); 484 fe->ops.i2c_gate_ctrl(fe, 0);
482 } 485 }
483 486
487 if (ret < 0)
488 return ret;
489
490 state->current_frequency = p->frequency;
491
484 return 0; 492 return 0;
485} 493}
486 494
@@ -498,6 +506,16 @@ static int au8522_init(struct dvb_frontend *fe)
498 return 0; 506 return 0;
499} 507}
500 508
509static int au8522_sleep(struct dvb_frontend *fe)
510{
511 struct au8522_state *state = fe->demodulator_priv;
512 dprintk("%s()\n", __func__);
513
514 state->current_frequency = 0;
515
516 return 0;
517}
518
501static int au8522_read_status(struct dvb_frontend *fe, fe_status_t *status) 519static int au8522_read_status(struct dvb_frontend *fe, fe_status_t *status)
502{ 520{
503 struct au8522_state *state = fe->demodulator_priv; 521 struct au8522_state *state = fe->demodulator_priv;
@@ -509,10 +527,8 @@ static int au8522_read_status(struct dvb_frontend *fe, fe_status_t *status)
509 if (state->current_modulation == VSB_8) { 527 if (state->current_modulation == VSB_8) {
510 dprintk("%s() Checking VSB_8\n", __func__); 528 dprintk("%s() Checking VSB_8\n", __func__);
511 reg = au8522_readreg(state, 0x4088); 529 reg = au8522_readreg(state, 0x4088);
512 if (reg & 0x01) 530 if ((reg & 0x03) == 0x03)
513 *status |= FE_HAS_VITERBI; 531 *status |= FE_HAS_LOCK | FE_HAS_SYNC | FE_HAS_VITERBI;
514 if (reg & 0x02)
515 *status |= FE_HAS_LOCK | FE_HAS_SYNC;
516 } else { 532 } else {
517 dprintk("%s() Checking QAM\n", __func__); 533 dprintk("%s() Checking QAM\n", __func__);
518 reg = au8522_readreg(state, 0x4541); 534 reg = au8522_readreg(state, 0x4541);
@@ -672,6 +688,7 @@ static struct dvb_frontend_ops au8522_ops = {
672 }, 688 },
673 689
674 .init = au8522_init, 690 .init = au8522_init,
691 .sleep = au8522_sleep,
675 .i2c_gate_ctrl = au8522_i2c_gate_ctrl, 692 .i2c_gate_ctrl = au8522_i2c_gate_ctrl,
676 .set_frontend = au8522_set_frontend, 693 .set_frontend = au8522_set_frontend,
677 .get_frontend = au8522_get_frontend, 694 .get_frontend = au8522_get_frontend,
diff --git a/drivers/media/dvb/frontends/stv0299.c b/drivers/media/dvb/frontends/stv0299.c
index 17556183e871..35435bef8e79 100644
--- a/drivers/media/dvb/frontends/stv0299.c
+++ b/drivers/media/dvb/frontends/stv0299.c
@@ -63,6 +63,7 @@ struct stv0299_state {
63 u32 symbol_rate; 63 u32 symbol_rate;
64 fe_code_rate_t fec_inner; 64 fe_code_rate_t fec_inner;
65 int errmode; 65 int errmode;
66 u32 ucblocks;
66}; 67};
67 68
68#define STATUS_BER 0 69#define STATUS_BER 0
@@ -501,8 +502,10 @@ static int stv0299_read_ber(struct dvb_frontend* fe, u32* ber)
501{ 502{
502 struct stv0299_state* state = fe->demodulator_priv; 503 struct stv0299_state* state = fe->demodulator_priv;
503 504
504 if (state->errmode != STATUS_BER) return 0; 505 if (state->errmode != STATUS_BER)
505 *ber = (stv0299_readreg (state, 0x1d) << 8) | stv0299_readreg (state, 0x1e); 506 return -ENOSYS;
507
508 *ber = stv0299_readreg(state, 0x1e) | (stv0299_readreg(state, 0x1d) << 8);
506 509
507 return 0; 510 return 0;
508} 511}
@@ -540,8 +543,12 @@ static int stv0299_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks)
540{ 543{
541 struct stv0299_state* state = fe->demodulator_priv; 544 struct stv0299_state* state = fe->demodulator_priv;
542 545
543 if (state->errmode != STATUS_UCBLOCKS) *ucblocks = 0; 546 if (state->errmode != STATUS_UCBLOCKS)
544 else *ucblocks = (stv0299_readreg (state, 0x1d) << 8) | stv0299_readreg (state, 0x1e); 547 return -ENOSYS;
548
549 state->ucblocks += stv0299_readreg(state, 0x1e);
550 state->ucblocks += (stv0299_readreg(state, 0x1d) << 8);
551 *ucblocks = state->ucblocks;
545 552
546 return 0; 553 return 0;
547} 554}
diff --git a/drivers/media/dvb/frontends/tda10023.c b/drivers/media/dvb/frontends/tda10023.c
index 0727b80bc4d2..c6ff5b82ff80 100644
--- a/drivers/media/dvb/frontends/tda10023.c
+++ b/drivers/media/dvb/frontends/tda10023.c
@@ -116,9 +116,12 @@ static u8 tda10023_readreg (struct tda10023_state* state, u8 reg)
116 int ret; 116 int ret;
117 117
118 ret = i2c_transfer (state->i2c, msg, 2); 118 ret = i2c_transfer (state->i2c, msg, 2);
119 if (ret != 2) 119 if (ret != 2) {
120 printk("DVB: TDA10023: %s: readreg error (ret == %i)\n", 120 int num = state->frontend.dvb ? state->frontend.dvb->num : -1;
121 __func__, ret); 121 printk(KERN_ERR "DVB: TDA10023(%d): %s: readreg error "
122 "(reg == 0x%02x, ret == %i)\n",
123 num, __func__, reg, ret);
124 }
122 return b1[0]; 125 return b1[0];
123} 126}
124 127
@@ -129,11 +132,12 @@ static int tda10023_writereg (struct tda10023_state* state, u8 reg, u8 data)
129 int ret; 132 int ret;
130 133
131 ret = i2c_transfer (state->i2c, &msg, 1); 134 ret = i2c_transfer (state->i2c, &msg, 1);
132 if (ret != 1) 135 if (ret != 1) {
133 printk("DVB: TDA10023(%d): %s, writereg error " 136 int num = state->frontend.dvb ? state->frontend.dvb->num : -1;
137 printk(KERN_ERR "DVB: TDA10023(%d): %s, writereg error "
134 "(reg == 0x%02x, val == 0x%02x, ret == %i)\n", 138 "(reg == 0x%02x, val == 0x%02x, ret == %i)\n",
135 state->frontend.dvb->num, __func__, reg, data, ret); 139 num, __func__, reg, data, ret);
136 140 }
137 return (ret != 1) ? -EREMOTEIO : 0; 141 return (ret != 1) ? -EREMOTEIO : 0;
138} 142}
139 143
@@ -464,7 +468,7 @@ struct dvb_frontend* tda10023_attach(const struct tda1002x_config* config,
464 int i; 468 int i;
465 469
466 /* allocate memory for the internal state */ 470 /* allocate memory for the internal state */
467 state = kmalloc(sizeof(struct tda10023_state), GFP_KERNEL); 471 state = kzalloc(sizeof(struct tda10023_state), GFP_KERNEL);
468 if (state == NULL) goto error; 472 if (state == NULL) goto error;
469 473
470 /* setup the state */ 474 /* setup the state */
diff --git a/drivers/media/dvb/frontends/tda1004x.c b/drivers/media/dvb/frontends/tda1004x.c
index 49973846373e..a0d638653567 100644
--- a/drivers/media/dvb/frontends/tda1004x.c
+++ b/drivers/media/dvb/frontends/tda1004x.c
@@ -1248,11 +1248,14 @@ struct dvb_frontend* tda10045_attach(const struct tda1004x_config* config,
1248 struct i2c_adapter* i2c) 1248 struct i2c_adapter* i2c)
1249{ 1249{
1250 struct tda1004x_state *state; 1250 struct tda1004x_state *state;
1251 int id;
1251 1252
1252 /* allocate memory for the internal state */ 1253 /* allocate memory for the internal state */
1253 state = kmalloc(sizeof(struct tda1004x_state), GFP_KERNEL); 1254 state = kmalloc(sizeof(struct tda1004x_state), GFP_KERNEL);
1254 if (!state) 1255 if (!state) {
1256 printk(KERN_ERR "Can't alocate memory for tda10045 state\n");
1255 return NULL; 1257 return NULL;
1258 }
1256 1259
1257 /* setup the state */ 1260 /* setup the state */
1258 state->config = config; 1261 state->config = config;
@@ -1260,7 +1263,15 @@ struct dvb_frontend* tda10045_attach(const struct tda1004x_config* config,
1260 state->demod_type = TDA1004X_DEMOD_TDA10045; 1263 state->demod_type = TDA1004X_DEMOD_TDA10045;
1261 1264
1262 /* check if the demod is there */ 1265 /* check if the demod is there */
1263 if (tda1004x_read_byte(state, TDA1004X_CHIPID) != 0x25) { 1266 id = tda1004x_read_byte(state, TDA1004X_CHIPID);
1267 if (id < 0) {
1268 printk(KERN_ERR "tda10045: chip is not answering. Giving up.\n");
1269 kfree(state);
1270 return NULL;
1271 }
1272
1273 if (id != 0x25) {
1274 printk(KERN_ERR "Invalid tda1004x ID = 0x%02x. Can't proceed\n", id);
1264 kfree(state); 1275 kfree(state);
1265 return NULL; 1276 return NULL;
1266 } 1277 }
@@ -1307,11 +1318,14 @@ struct dvb_frontend* tda10046_attach(const struct tda1004x_config* config,
1307 struct i2c_adapter* i2c) 1318 struct i2c_adapter* i2c)
1308{ 1319{
1309 struct tda1004x_state *state; 1320 struct tda1004x_state *state;
1321 int id;
1310 1322
1311 /* allocate memory for the internal state */ 1323 /* allocate memory for the internal state */
1312 state = kmalloc(sizeof(struct tda1004x_state), GFP_KERNEL); 1324 state = kmalloc(sizeof(struct tda1004x_state), GFP_KERNEL);
1313 if (!state) 1325 if (!state) {
1326 printk(KERN_ERR "Can't alocate memory for tda10046 state\n");
1314 return NULL; 1327 return NULL;
1328 }
1315 1329
1316 /* setup the state */ 1330 /* setup the state */
1317 state->config = config; 1331 state->config = config;
@@ -1319,7 +1333,14 @@ struct dvb_frontend* tda10046_attach(const struct tda1004x_config* config,
1319 state->demod_type = TDA1004X_DEMOD_TDA10046; 1333 state->demod_type = TDA1004X_DEMOD_TDA10046;
1320 1334
1321 /* check if the demod is there */ 1335 /* check if the demod is there */
1322 if (tda1004x_read_byte(state, TDA1004X_CHIPID) != 0x46) { 1336 id = tda1004x_read_byte(state, TDA1004X_CHIPID);
1337 if (id < 0) {
1338 printk(KERN_ERR "tda10046: chip is not answering. Giving up.\n");
1339 kfree(state);
1340 return NULL;
1341 }
1342 if (id != 0x46) {
1343 printk(KERN_ERR "Invalid tda1004x ID = 0x%02x. Can't proceed\n", id);
1323 kfree(state); 1344 kfree(state);
1324 return NULL; 1345 return NULL;
1325 } 1346 }
diff --git a/drivers/media/dvb/ttpci/Kconfig b/drivers/media/dvb/ttpci/Kconfig
index d4339b1b3b68..07643e010093 100644
--- a/drivers/media/dvb/ttpci/Kconfig
+++ b/drivers/media/dvb/ttpci/Kconfig
@@ -101,6 +101,7 @@ config DVB_BUDGET
101config DVB_BUDGET_CI 101config DVB_BUDGET_CI
102 tristate "Budget cards with onboard CI connector" 102 tristate "Budget cards with onboard CI connector"
103 depends on DVB_BUDGET_CORE && I2C 103 depends on DVB_BUDGET_CORE && I2C
104 depends on INPUT # due to IR
104 select DVB_STV0297 if !DVB_FE_CUSTOMISE 105 select DVB_STV0297 if !DVB_FE_CUSTOMISE
105 select DVB_STV0299 if !DVB_FE_CUSTOMISE 106 select DVB_STV0299 if !DVB_FE_CUSTOMISE
106 select DVB_TDA1004X if !DVB_FE_CUSTOMISE 107 select DVB_TDA1004X if !DVB_FE_CUSTOMISE
diff --git a/drivers/media/dvb/ttpci/av7110_hw.c b/drivers/media/dvb/ttpci/av7110_hw.c
index 9d81074b31df..3a3f5279e927 100644
--- a/drivers/media/dvb/ttpci/av7110_hw.c
+++ b/drivers/media/dvb/ttpci/av7110_hw.c
@@ -427,6 +427,7 @@ static int __av7110_send_fw_cmd(struct av7110 *av7110, u16* buf, int length)
427 if (err) { 427 if (err) {
428 printk(KERN_ERR "%s: timeout waiting on busy %s QUEUE\n", 428 printk(KERN_ERR "%s: timeout waiting on busy %s QUEUE\n",
429 __func__, type); 429 __func__, type);
430 av7110->arm_errors++;
430 return -ETIMEDOUT; 431 return -ETIMEDOUT;
431 } 432 }
432 msleep(1); 433 msleep(1);
@@ -853,10 +854,8 @@ static osd_raw_window_t bpp2bit[8] = {
853 854
854static inline int WaitUntilBmpLoaded(struct av7110 *av7110) 855static inline int WaitUntilBmpLoaded(struct av7110 *av7110)
855{ 856{
856 int ret = wait_event_interruptible_timeout(av7110->bmpq, 857 int ret = wait_event_timeout(av7110->bmpq,
857 av7110->bmp_state != BMP_LOADING, 10*HZ); 858 av7110->bmp_state != BMP_LOADING, 10*HZ);
858 if (ret == -ERESTARTSYS)
859 return ret;
860 if (ret == 0) { 859 if (ret == 0) {
861 printk("dvb-ttpci: warning: timeout waiting in LoadBitmap: %d, %d\n", 860 printk("dvb-ttpci: warning: timeout waiting in LoadBitmap: %d, %d\n",
862 ret, av7110->bmp_state); 861 ret, av7110->bmp_state);
diff --git a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig
index 3b26fbd3e558..5ccb0aeca8cc 100644
--- a/drivers/media/video/Kconfig
+++ b/drivers/media/video/Kconfig
@@ -793,6 +793,14 @@ menuconfig V4L_USB_DRIVERS
793 793
794if V4L_USB_DRIVERS && USB 794if V4L_USB_DRIVERS && USB
795 795
796config USB_VIDEO_CLASS
797 tristate "USB Video Class (UVC)"
798 ---help---
799 Support for the USB Video Class (UVC). Currently only video
800 input devices, such as webcams, are supported.
801
802 For more information see: <http://linux-uvc.berlios.de/>
803
796source "drivers/media/video/pvrusb2/Kconfig" 804source "drivers/media/video/pvrusb2/Kconfig"
797 805
798source "drivers/media/video/em28xx/Kconfig" 806source "drivers/media/video/em28xx/Kconfig"
diff --git a/drivers/media/video/Makefile b/drivers/media/video/Makefile
index dff0d6abe917..ecbbfaab24d5 100644
--- a/drivers/media/video/Makefile
+++ b/drivers/media/video/Makefile
@@ -136,6 +136,8 @@ obj-$(CONFIG_SOC_CAMERA_MT9V022) += mt9v022.o
136 136
137obj-$(CONFIG_VIDEO_AU0828) += au0828/ 137obj-$(CONFIG_VIDEO_AU0828) += au0828/
138 138
139obj-$(CONFIG_USB_VIDEO_CLASS) += uvc/
140
139EXTRA_CFLAGS += -Idrivers/media/dvb/dvb-core 141EXTRA_CFLAGS += -Idrivers/media/dvb/dvb-core
140EXTRA_CFLAGS += -Idrivers/media/dvb/frontends 142EXTRA_CFLAGS += -Idrivers/media/dvb/frontends
141EXTRA_CFLAGS += -Idrivers/media/common/tuners 143EXTRA_CFLAGS += -Idrivers/media/common/tuners
diff --git a/drivers/media/video/au0828/au0828-cards.c b/drivers/media/video/au0828/au0828-cards.c
index a2a6983444fa..898e12395e7c 100644
--- a/drivers/media/video/au0828/au0828-cards.c
+++ b/drivers/media/video/au0828/au0828-cards.c
@@ -77,8 +77,14 @@ static void hauppauge_eeprom(struct au0828_dev *dev, u8 *eeprom_data)
77 77
78 /* Make sure we support the board model */ 78 /* Make sure we support the board model */
79 switch (tv.model) { 79 switch (tv.model) {
80 case 72000: /* WinTV-HVR950q (Retail, IR, ATSC/QAM */
80 case 72001: /* WinTV-HVR950q (Retail, IR, ATSC/QAM and basic analog video */ 81 case 72001: /* WinTV-HVR950q (Retail, IR, ATSC/QAM and basic analog video */
82 case 72211: /* WinTV-HVR950q (OEM, IR, ATSC/QAM and basic analog video */
83 case 72221: /* WinTV-HVR950q (OEM, IR, ATSC/QAM and basic analog video */
84 case 72231: /* WinTV-HVR950q (OEM, IR, ATSC/QAM and basic analog video */
85 case 72241: /* WinTV-HVR950q (OEM, No IR, ATSC/QAM and basic analog video */
81 case 72301: /* WinTV-HVR850 (Retail, IR, ATSC and basic analog video */ 86 case 72301: /* WinTV-HVR850 (Retail, IR, ATSC and basic analog video */
87 case 72500: /* WinTV-HVR950q (OEM, No IR, ATSC/QAM */
82 break; 88 break;
83 default: 89 default:
84 printk(KERN_WARNING "%s: warning: " 90 printk(KERN_WARNING "%s: warning: "
@@ -175,6 +181,18 @@ struct usb_device_id au0828_usb_id_table [] = {
175 .driver_info = AU0828_BOARD_HAUPPAUGE_HVR850 }, 181 .driver_info = AU0828_BOARD_HAUPPAUGE_HVR850 },
176 { USB_DEVICE(0x0fe9, 0xd620), 182 { USB_DEVICE(0x0fe9, 0xd620),
177 .driver_info = AU0828_BOARD_DVICO_FUSIONHDTV7 }, 183 .driver_info = AU0828_BOARD_DVICO_FUSIONHDTV7 },
184 { USB_DEVICE(0x2040, 0x7210),
185 .driver_info = AU0828_BOARD_HAUPPAUGE_HVR950Q },
186 { USB_DEVICE(0x2040, 0x7217),
187 .driver_info = AU0828_BOARD_HAUPPAUGE_HVR950Q },
188 { USB_DEVICE(0x2040, 0x721b),
189 .driver_info = AU0828_BOARD_HAUPPAUGE_HVR950Q },
190 { USB_DEVICE(0x2040, 0x721f),
191 .driver_info = AU0828_BOARD_HAUPPAUGE_HVR950Q },
192 { USB_DEVICE(0x2040, 0x7280),
193 .driver_info = AU0828_BOARD_HAUPPAUGE_HVR950Q },
194 { USB_DEVICE(0x0fd9, 0x0008),
195 .driver_info = AU0828_BOARD_HAUPPAUGE_HVR950Q },
178 { }, 196 { },
179}; 197};
180 198
diff --git a/drivers/media/video/cx18/Kconfig b/drivers/media/video/cx18/Kconfig
index 5f942690570c..9aefdc5ea79a 100644
--- a/drivers/media/video/cx18/Kconfig
+++ b/drivers/media/video/cx18/Kconfig
@@ -10,8 +10,8 @@ config VIDEO_CX18
10 select VIDEO_TVEEPROM 10 select VIDEO_TVEEPROM
11 select VIDEO_CX2341X 11 select VIDEO_CX2341X
12 select VIDEO_CS5345 12 select VIDEO_CS5345
13 select DVB_S5H1409 13 select DVB_S5H1409 if !DVB_FE_CUSTOMISE
14 select MEDIA_TUNER_MXL5005S 14 select MEDIA_TUNER_MXL5005S if !DVB_FE_CUSTOMISE
15 ---help--- 15 ---help---
16 This is a video4linux driver for Conexant cx23418 based 16 This is a video4linux driver for Conexant cx23418 based
17 PCI combo video recorder devices. 17 PCI combo video recorder devices.
diff --git a/drivers/media/video/cx18/cx18-av-core.c b/drivers/media/video/cx18/cx18-av-core.c
index 9a26751615c6..faca43eb940f 100644
--- a/drivers/media/video/cx18/cx18-av-core.c
+++ b/drivers/media/video/cx18/cx18-av-core.c
@@ -69,6 +69,58 @@ int cx18_av_and_or4(struct cx18 *cx, u16 addr, u32 and_mask,
69 or_value); 69 or_value);
70} 70}
71 71
72int cx18_av_write_no_acfg(struct cx18 *cx, u16 addr, u8 value, int no_acfg_mask)
73{
74 int retval;
75 u32 saved_reg[8] = {0};
76
77 if (no_acfg_mask & CXADEC_NO_ACFG_AFE) {
78 saved_reg[0] = cx18_av_read4(cx, CXADEC_CHIP_CTRL);
79 saved_reg[1] = cx18_av_read4(cx, CXADEC_AFE_CTRL);
80 }
81
82 if (no_acfg_mask & CXADEC_NO_ACFG_PLL) {
83 saved_reg[2] = cx18_av_read4(cx, CXADEC_PLL_CTRL1);
84 saved_reg[3] = cx18_av_read4(cx, CXADEC_VID_PLL_FRAC);
85 }
86
87 if (no_acfg_mask & CXADEC_NO_ACFG_VID) {
88 saved_reg[4] = cx18_av_read4(cx, CXADEC_HORIZ_TIM_CTRL);
89 saved_reg[5] = cx18_av_read4(cx, CXADEC_VERT_TIM_CTRL);
90 saved_reg[6] = cx18_av_read4(cx, CXADEC_SRC_COMB_CFG);
91 saved_reg[7] = cx18_av_read4(cx, CXADEC_CHROMA_VBIOFF_CFG);
92 }
93
94 retval = cx18_av_write(cx, addr, value);
95
96 if (no_acfg_mask & CXADEC_NO_ACFG_AFE) {
97 cx18_av_write4(cx, CXADEC_CHIP_CTRL, saved_reg[0]);
98 cx18_av_write4(cx, CXADEC_AFE_CTRL, saved_reg[1]);
99 }
100
101 if (no_acfg_mask & CXADEC_NO_ACFG_PLL) {
102 cx18_av_write4(cx, CXADEC_PLL_CTRL1, saved_reg[2]);
103 cx18_av_write4(cx, CXADEC_VID_PLL_FRAC, saved_reg[3]);
104 }
105
106 if (no_acfg_mask & CXADEC_NO_ACFG_VID) {
107 cx18_av_write4(cx, CXADEC_HORIZ_TIM_CTRL, saved_reg[4]);
108 cx18_av_write4(cx, CXADEC_VERT_TIM_CTRL, saved_reg[5]);
109 cx18_av_write4(cx, CXADEC_SRC_COMB_CFG, saved_reg[6]);
110 cx18_av_write4(cx, CXADEC_CHROMA_VBIOFF_CFG, saved_reg[7]);
111 }
112
113 return retval;
114}
115
116int cx18_av_and_or_no_acfg(struct cx18 *cx, u16 addr, unsigned and_mask,
117 u8 or_value, int no_acfg_mask)
118{
119 return cx18_av_write_no_acfg(cx, addr,
120 (cx18_av_read(cx, addr) & and_mask) |
121 or_value, no_acfg_mask);
122}
123
72/* ----------------------------------------------------------------------- */ 124/* ----------------------------------------------------------------------- */
73 125
74static int set_input(struct cx18 *cx, enum cx18_av_video_input vid_input, 126static int set_input(struct cx18 *cx, enum cx18_av_video_input vid_input,
@@ -170,13 +222,15 @@ static void input_change(struct cx18 *cx)
170 222
171 /* Follow step 8c and 8d of section 3.16 in the cx18_av datasheet */ 223 /* Follow step 8c and 8d of section 3.16 in the cx18_av datasheet */
172 if (std & V4L2_STD_SECAM) 224 if (std & V4L2_STD_SECAM)
173 cx18_av_write(cx, 0x402, 0); 225 cx18_av_write_no_acfg(cx, 0x402, 0, CXADEC_NO_ACFG_ALL);
174 else { 226 else {
175 cx18_av_write(cx, 0x402, 0x04); 227 cx18_av_write_no_acfg(cx, 0x402, 0x04, CXADEC_NO_ACFG_ALL);
176 cx18_av_write(cx, 0x49f, (std & V4L2_STD_NTSC) ? 0x14 : 0x11); 228 cx18_av_write(cx, 0x49f, (std & V4L2_STD_NTSC) ? 0x14 : 0x11);
177 } 229 }
178 cx18_av_and_or(cx, 0x401, ~0x60, 0); 230 cx18_av_and_or_no_acfg(cx, 0x401, ~0x60, 0,
179 cx18_av_and_or(cx, 0x401, ~0x60, 0x60); 231 CXADEC_NO_ACFG_PLL | CXADEC_NO_ACFG_VID);
232 cx18_av_and_or_no_acfg(cx, 0x401, ~0x60, 0x60,
233 CXADEC_NO_ACFG_PLL | CXADEC_NO_ACFG_VID);
180 234
181 if (std & V4L2_STD_525_60) { 235 if (std & V4L2_STD_525_60) {
182 if (std == V4L2_STD_NTSC_M_JP) { 236 if (std == V4L2_STD_NTSC_M_JP) {
@@ -228,7 +282,7 @@ static int set_input(struct cx18 *cx, enum cx18_av_video_input vid_input,
228 282
229 if ((vid_input & ~0xff0) || 283 if ((vid_input & ~0xff0) ||
230 luma < CX18_AV_SVIDEO_LUMA1 || 284 luma < CX18_AV_SVIDEO_LUMA1 ||
231 luma > CX18_AV_SVIDEO_LUMA4 || 285 luma > CX18_AV_SVIDEO_LUMA8 ||
232 chroma < CX18_AV_SVIDEO_CHROMA4 || 286 chroma < CX18_AV_SVIDEO_CHROMA4 ||
233 chroma > CX18_AV_SVIDEO_CHROMA8) { 287 chroma > CX18_AV_SVIDEO_CHROMA8) {
234 CX18_ERR("0x%04x is not a valid video input!\n", 288 CX18_ERR("0x%04x is not a valid video input!\n",
@@ -262,7 +316,8 @@ static int set_input(struct cx18 *cx, enum cx18_av_video_input vid_input,
262 316
263 cx18_av_write(cx, 0x103, reg); 317 cx18_av_write(cx, 0x103, reg);
264 /* Set INPUT_MODE to Composite (0) or S-Video (1) */ 318 /* Set INPUT_MODE to Composite (0) or S-Video (1) */
265 cx18_av_and_or(cx, 0x401, ~0x6, is_composite ? 0 : 0x02); 319 cx18_av_and_or_no_acfg(cx, 0x401, ~0x6, is_composite ? 0 : 0x02,
320 CXADEC_NO_ACFG_PLL | CXADEC_NO_ACFG_VID);
266 /* Set CH_SEL_ADC2 to 1 if input comes from CH3 */ 321 /* Set CH_SEL_ADC2 to 1 if input comes from CH3 */
267 cx18_av_and_or(cx, 0x102, ~0x2, (reg & 0x80) == 0 ? 2 : 0); 322 cx18_av_and_or(cx, 0x102, ~0x2, (reg & 0x80) == 0 ? 2 : 0);
268 /* Set DUAL_MODE_ADC2 to 1 if input comes from both CH2 and CH3 */ 323 /* Set DUAL_MODE_ADC2 to 1 if input comes from both CH2 and CH3 */
@@ -318,12 +373,12 @@ static int set_v4lstd(struct cx18 *cx)
318 This happens for example with the Yuan MPC622. */ 373 This happens for example with the Yuan MPC622. */
319 if (fmt >= 4 && fmt < 8) { 374 if (fmt >= 4 && fmt < 8) {
320 /* Set format to NTSC-M */ 375 /* Set format to NTSC-M */
321 cx18_av_and_or(cx, 0x400, ~0xf, 1); 376 cx18_av_and_or_no_acfg(cx, 0x400, ~0xf, 1, CXADEC_NO_ACFG_AFE);
322 /* Turn off LCOMB */ 377 /* Turn off LCOMB */
323 cx18_av_and_or(cx, 0x47b, ~6, 0); 378 cx18_av_and_or(cx, 0x47b, ~6, 0);
324 } 379 }
325 cx18_av_and_or(cx, 0x400, ~0xf, fmt); 380 cx18_av_and_or_no_acfg(cx, 0x400, ~0xf, fmt, CXADEC_NO_ACFG_AFE);
326 cx18_av_and_or(cx, 0x403, ~0x3, pal_m); 381 cx18_av_and_or_no_acfg(cx, 0x403, ~0x3, pal_m, CXADEC_NO_ACFG_ALL);
327 cx18_av_vbi_setup(cx); 382 cx18_av_vbi_setup(cx);
328 input_change(cx); 383 input_change(cx);
329 return 0; 384 return 0;
diff --git a/drivers/media/video/cx18/cx18-av-core.h b/drivers/media/video/cx18/cx18-av-core.h
index 786901d72e9a..c172823ce1d8 100644
--- a/drivers/media/video/cx18/cx18-av-core.h
+++ b/drivers/media/video/cx18/cx18-av-core.h
@@ -37,12 +37,16 @@ enum cx18_av_video_input {
37 CX18_AV_COMPOSITE7, 37 CX18_AV_COMPOSITE7,
38 CX18_AV_COMPOSITE8, 38 CX18_AV_COMPOSITE8,
39 39
40 /* S-Video inputs consist of one luma input (In1-In4) ORed with one 40 /* S-Video inputs consist of one luma input (In1-In8) ORed with one
41 chroma input (In5-In8) */ 41 chroma input (In5-In8) */
42 CX18_AV_SVIDEO_LUMA1 = 0x10, 42 CX18_AV_SVIDEO_LUMA1 = 0x10,
43 CX18_AV_SVIDEO_LUMA2 = 0x20, 43 CX18_AV_SVIDEO_LUMA2 = 0x20,
44 CX18_AV_SVIDEO_LUMA3 = 0x30, 44 CX18_AV_SVIDEO_LUMA3 = 0x30,
45 CX18_AV_SVIDEO_LUMA4 = 0x40, 45 CX18_AV_SVIDEO_LUMA4 = 0x40,
46 CX18_AV_SVIDEO_LUMA5 = 0x50,
47 CX18_AV_SVIDEO_LUMA6 = 0x60,
48 CX18_AV_SVIDEO_LUMA7 = 0x70,
49 CX18_AV_SVIDEO_LUMA8 = 0x80,
46 CX18_AV_SVIDEO_CHROMA4 = 0x400, 50 CX18_AV_SVIDEO_CHROMA4 = 0x400,
47 CX18_AV_SVIDEO_CHROMA5 = 0x500, 51 CX18_AV_SVIDEO_CHROMA5 = 0x500,
48 CX18_AV_SVIDEO_CHROMA6 = 0x600, 52 CX18_AV_SVIDEO_CHROMA6 = 0x600,
@@ -291,14 +295,24 @@ struct cx18_av_state {
291#define CXADEC_SELECT_AUDIO_STANDARD_FM 0xF9 /* FM radio */ 295#define CXADEC_SELECT_AUDIO_STANDARD_FM 0xF9 /* FM radio */
292#define CXADEC_SELECT_AUDIO_STANDARD_AUTO 0xFF /* Auto detect */ 296#define CXADEC_SELECT_AUDIO_STANDARD_AUTO 0xFF /* Auto detect */
293 297
298/* Flags on what to preserve on write to 0x400-0x403 with cx18_av_.*_no_acfg()*/
299#define CXADEC_NO_ACFG_AFE 0x01 /* Preserve 0x100-0x107 */
300#define CXADEC_NO_ACFG_PLL 0x02 /* Preserve 0x108-0x10f */
301#define CXADEC_NO_ACFG_VID 0x04 /* Preserve 0x470-0x47f */
302#define CXADEC_NO_ACFG_ALL 0x07
303
294/* ----------------------------------------------------------------------- */ 304/* ----------------------------------------------------------------------- */
295/* cx18_av-core.c */ 305/* cx18_av-core.c */
296int cx18_av_write(struct cx18 *cx, u16 addr, u8 value); 306int cx18_av_write(struct cx18 *cx, u16 addr, u8 value);
297int cx18_av_write4(struct cx18 *cx, u16 addr, u32 value); 307int cx18_av_write4(struct cx18 *cx, u16 addr, u32 value);
308int cx18_av_write_no_acfg(struct cx18 *cx, u16 addr, u8 value,
309 int no_acfg_mask);
298u8 cx18_av_read(struct cx18 *cx, u16 addr); 310u8 cx18_av_read(struct cx18 *cx, u16 addr);
299u32 cx18_av_read4(struct cx18 *cx, u16 addr); 311u32 cx18_av_read4(struct cx18 *cx, u16 addr);
300int cx18_av_and_or(struct cx18 *cx, u16 addr, unsigned mask, u8 value); 312int cx18_av_and_or(struct cx18 *cx, u16 addr, unsigned mask, u8 value);
301int cx18_av_and_or4(struct cx18 *cx, u16 addr, u32 mask, u32 value); 313int cx18_av_and_or4(struct cx18 *cx, u16 addr, u32 mask, u32 value);
314int cx18_av_and_or_no_acfg(struct cx18 *cx, u16 addr, unsigned mask, u8 value,
315 int no_acfg_mask);
302int cx18_av_cmd(struct cx18 *cx, unsigned int cmd, void *arg); 316int cx18_av_cmd(struct cx18 *cx, unsigned int cmd, void *arg);
303 317
304/* ----------------------------------------------------------------------- */ 318/* ----------------------------------------------------------------------- */
diff --git a/drivers/media/video/cx18/cx18-cards.c b/drivers/media/video/cx18/cx18-cards.c
index baccd079243d..c26e0ef5b075 100644
--- a/drivers/media/video/cx18/cx18-cards.c
+++ b/drivers/media/video/cx18/cx18-cards.c
@@ -23,6 +23,7 @@
23 23
24#include "cx18-driver.h" 24#include "cx18-driver.h"
25#include "cx18-cards.h" 25#include "cx18-cards.h"
26#include "cx18-av-core.h"
26#include "cx18-i2c.h" 27#include "cx18-i2c.h"
27#include <media/cs5345.h> 28#include <media/cs5345.h>
28 29
@@ -54,22 +55,22 @@ static const struct cx18_card cx18_card_hvr1600_esmt = {
54 .hw_all = CX18_HW_TVEEPROM | CX18_HW_TUNER | 55 .hw_all = CX18_HW_TVEEPROM | CX18_HW_TUNER |
55 CX18_HW_CS5345 | CX18_HW_DVB, 56 CX18_HW_CS5345 | CX18_HW_DVB,
56 .video_inputs = { 57 .video_inputs = {
57 { CX18_CARD_INPUT_VID_TUNER, 0, CX23418_COMPOSITE7 }, 58 { CX18_CARD_INPUT_VID_TUNER, 0, CX18_AV_COMPOSITE7 },
58 { CX18_CARD_INPUT_SVIDEO1, 1, CX23418_SVIDEO1 }, 59 { CX18_CARD_INPUT_SVIDEO1, 1, CX18_AV_SVIDEO1 },
59 { CX18_CARD_INPUT_COMPOSITE1, 1, CX23418_COMPOSITE3 }, 60 { CX18_CARD_INPUT_COMPOSITE1, 1, CX18_AV_COMPOSITE3 },
60 { CX18_CARD_INPUT_SVIDEO2, 2, CX23418_SVIDEO2 }, 61 { CX18_CARD_INPUT_SVIDEO2, 2, CX18_AV_SVIDEO2 },
61 { CX18_CARD_INPUT_COMPOSITE2, 2, CX23418_COMPOSITE4 }, 62 { CX18_CARD_INPUT_COMPOSITE2, 2, CX18_AV_COMPOSITE4 },
62 }, 63 },
63 .audio_inputs = { 64 .audio_inputs = {
64 { CX18_CARD_INPUT_AUD_TUNER, 65 { CX18_CARD_INPUT_AUD_TUNER,
65 CX23418_AUDIO8, CS5345_IN_1 | CS5345_MCLK_1_5 }, 66 CX18_AV_AUDIO8, CS5345_IN_1 | CS5345_MCLK_1_5 },
66 { CX18_CARD_INPUT_LINE_IN1, 67 { CX18_CARD_INPUT_LINE_IN1,
67 CX23418_AUDIO_SERIAL, CS5345_IN_2 }, 68 CX18_AV_AUDIO_SERIAL, CS5345_IN_2 },
68 { CX18_CARD_INPUT_LINE_IN2, 69 { CX18_CARD_INPUT_LINE_IN2,
69 CX23418_AUDIO_SERIAL, CS5345_IN_2 }, 70 CX18_AV_AUDIO_SERIAL, CS5345_IN_3 },
70 }, 71 },
71 .radio_input = { CX18_CARD_INPUT_AUD_TUNER, 72 .radio_input = { CX18_CARD_INPUT_AUD_TUNER,
72 CX23418_AUDIO_SERIAL, 0 }, 73 CX18_AV_AUDIO_SERIAL, CS5345_IN_4 },
73 .ddr = { 74 .ddr = {
74 /* ESMT M13S128324A-5B memory */ 75 /* ESMT M13S128324A-5B memory */
75 .chip_config = 0x003, 76 .chip_config = 0x003,
@@ -81,6 +82,11 @@ static const struct cx18_card cx18_card_hvr1600_esmt = {
81 }, 82 },
82 .gpio_init.initial_value = 0x3001, 83 .gpio_init.initial_value = 0x3001,
83 .gpio_init.direction = 0x3001, 84 .gpio_init.direction = 0x3001,
85 .gpio_i2c_slave_reset = {
86 .active_lo_mask = 0x3001,
87 .msecs_asserted = 10,
88 .msecs_recovery = 40,
89 },
84 .i2c = &cx18_i2c_std, 90 .i2c = &cx18_i2c_std,
85}; 91};
86 92
@@ -94,22 +100,22 @@ static const struct cx18_card cx18_card_hvr1600_samsung = {
94 .hw_all = CX18_HW_TVEEPROM | CX18_HW_TUNER | 100 .hw_all = CX18_HW_TVEEPROM | CX18_HW_TUNER |
95 CX18_HW_CS5345 | CX18_HW_DVB, 101 CX18_HW_CS5345 | CX18_HW_DVB,
96 .video_inputs = { 102 .video_inputs = {
97 { CX18_CARD_INPUT_VID_TUNER, 0, CX23418_COMPOSITE7 }, 103 { CX18_CARD_INPUT_VID_TUNER, 0, CX18_AV_COMPOSITE7 },
98 { CX18_CARD_INPUT_SVIDEO1, 1, CX23418_SVIDEO1 }, 104 { CX18_CARD_INPUT_SVIDEO1, 1, CX18_AV_SVIDEO1 },
99 { CX18_CARD_INPUT_COMPOSITE1, 1, CX23418_COMPOSITE3 }, 105 { CX18_CARD_INPUT_COMPOSITE1, 1, CX18_AV_COMPOSITE3 },
100 { CX18_CARD_INPUT_SVIDEO2, 2, CX23418_SVIDEO2 }, 106 { CX18_CARD_INPUT_SVIDEO2, 2, CX18_AV_SVIDEO2 },
101 { CX18_CARD_INPUT_COMPOSITE2, 2, CX23418_COMPOSITE4 }, 107 { CX18_CARD_INPUT_COMPOSITE2, 2, CX18_AV_COMPOSITE4 },
102 }, 108 },
103 .audio_inputs = { 109 .audio_inputs = {
104 { CX18_CARD_INPUT_AUD_TUNER, 110 { CX18_CARD_INPUT_AUD_TUNER,
105 CX23418_AUDIO8, CS5345_IN_1 | CS5345_MCLK_1_5 }, 111 CX18_AV_AUDIO8, CS5345_IN_1 | CS5345_MCLK_1_5 },
106 { CX18_CARD_INPUT_LINE_IN1, 112 { CX18_CARD_INPUT_LINE_IN1,
107 CX23418_AUDIO_SERIAL, CS5345_IN_2 }, 113 CX18_AV_AUDIO_SERIAL, CS5345_IN_2 },
108 { CX18_CARD_INPUT_LINE_IN2, 114 { CX18_CARD_INPUT_LINE_IN2,
109 CX23418_AUDIO_SERIAL, CS5345_IN_2 }, 115 CX18_AV_AUDIO_SERIAL, CS5345_IN_3 },
110 }, 116 },
111 .radio_input = { CX18_CARD_INPUT_AUD_TUNER, 117 .radio_input = { CX18_CARD_INPUT_AUD_TUNER,
112 CX23418_AUDIO_SERIAL, 0 }, 118 CX18_AV_AUDIO_SERIAL, CS5345_IN_4 },
113 .ddr = { 119 .ddr = {
114 /* Samsung K4D263238G-VC33 memory */ 120 /* Samsung K4D263238G-VC33 memory */
115 .chip_config = 0x003, 121 .chip_config = 0x003,
@@ -121,6 +127,11 @@ static const struct cx18_card cx18_card_hvr1600_samsung = {
121 }, 127 },
122 .gpio_init.initial_value = 0x3001, 128 .gpio_init.initial_value = 0x3001,
123 .gpio_init.direction = 0x3001, 129 .gpio_init.direction = 0x3001,
130 .gpio_i2c_slave_reset = {
131 .active_lo_mask = 0x3001,
132 .msecs_asserted = 10,
133 .msecs_recovery = 40,
134 },
124 .i2c = &cx18_i2c_std, 135 .i2c = &cx18_i2c_std,
125}; 136};
126 137
@@ -141,19 +152,19 @@ static const struct cx18_card cx18_card_h900 = {
141 .hw_audio_ctrl = CX18_HW_CX23418, 152 .hw_audio_ctrl = CX18_HW_CX23418,
142 .hw_all = CX18_HW_TUNER, 153 .hw_all = CX18_HW_TUNER,
143 .video_inputs = { 154 .video_inputs = {
144 { CX18_CARD_INPUT_VID_TUNER, 0, CX23418_COMPOSITE2 }, 155 { CX18_CARD_INPUT_VID_TUNER, 0, CX18_AV_COMPOSITE2 },
145 { CX18_CARD_INPUT_SVIDEO1, 1, 156 { CX18_CARD_INPUT_SVIDEO1, 1,
146 CX23418_SVIDEO_LUMA3 | CX23418_SVIDEO_CHROMA4 }, 157 CX18_AV_SVIDEO_LUMA3 | CX18_AV_SVIDEO_CHROMA4 },
147 { CX18_CARD_INPUT_COMPOSITE1, 1, CX23418_COMPOSITE1 }, 158 { CX18_CARD_INPUT_COMPOSITE1, 1, CX18_AV_COMPOSITE1 },
148 }, 159 },
149 .audio_inputs = { 160 .audio_inputs = {
150 { CX18_CARD_INPUT_AUD_TUNER, 161 { CX18_CARD_INPUT_AUD_TUNER,
151 CX23418_AUDIO8, 0 }, 162 CX18_AV_AUDIO8, 0 },
152 { CX18_CARD_INPUT_LINE_IN1, 163 { CX18_CARD_INPUT_LINE_IN1,
153 CX23418_AUDIO_SERIAL, 0 }, 164 CX18_AV_AUDIO_SERIAL, 0 },
154 }, 165 },
155 .radio_input = { CX18_CARD_INPUT_AUD_TUNER, 166 .radio_input = { CX18_CARD_INPUT_AUD_TUNER,
156 CX23418_AUDIO_SERIAL, 0 }, 167 CX18_AV_AUDIO_SERIAL, 0 },
157 .tuners = { 168 .tuners = {
158 { .std = V4L2_STD_ALL, .tuner = TUNER_XC2028 }, 169 { .std = V4L2_STD_ALL, .tuner = TUNER_XC2028 },
159 }, 170 },
@@ -183,23 +194,26 @@ static const struct cx18_card_pci_info cx18_pci_mpc718[] = {
183static const struct cx18_card cx18_card_mpc718 = { 194static const struct cx18_card cx18_card_mpc718 = {
184 .type = CX18_CARD_YUAN_MPC718, 195 .type = CX18_CARD_YUAN_MPC718,
185 .name = "Yuan MPC718", 196 .name = "Yuan MPC718",
186 .comment = "Not yet supported!\n", 197 .comment = "Some Composite and S-Video inputs are currently working.\n",
187 .v4l2_capabilities = 0, 198 .v4l2_capabilities = CX18_CAP_ENCODER,
188 .hw_audio_ctrl = CX18_HW_CX23418, 199 .hw_audio_ctrl = CX18_HW_CX23418,
189 .hw_all = CX18_HW_TUNER, 200 .hw_all = CX18_HW_TUNER,
190 .video_inputs = { 201 .video_inputs = {
191 { CX18_CARD_INPUT_VID_TUNER, 0, CX23418_COMPOSITE7 }, 202 { CX18_CARD_INPUT_VID_TUNER, 0, CX18_AV_COMPOSITE2 },
192 { CX18_CARD_INPUT_SVIDEO1, 1, CX23418_SVIDEO1 }, 203 { CX18_CARD_INPUT_SVIDEO1, 1,
193 { CX18_CARD_INPUT_COMPOSITE1, 1, CX23418_COMPOSITE3 }, 204 CX18_AV_SVIDEO_LUMA3 | CX18_AV_SVIDEO_CHROMA4 },
205 { CX18_CARD_INPUT_COMPOSITE1, 1, CX18_AV_COMPOSITE1 },
206 { CX18_CARD_INPUT_SVIDEO2, 2,
207 CX18_AV_SVIDEO_LUMA7 | CX18_AV_SVIDEO_CHROMA8 },
208 { CX18_CARD_INPUT_COMPOSITE2, 2, CX18_AV_COMPOSITE6 },
209 { CX18_CARD_INPUT_COMPOSITE3, 2, CX18_AV_COMPOSITE3 },
194 }, 210 },
195 .audio_inputs = { 211 .audio_inputs = {
196 { CX18_CARD_INPUT_AUD_TUNER, 212 { CX18_CARD_INPUT_AUD_TUNER, CX18_AV_AUDIO5, 0 },
197 CX23418_AUDIO8, 0 }, 213 { CX18_CARD_INPUT_LINE_IN1, CX18_AV_AUDIO_SERIAL, 0 },
198 { CX18_CARD_INPUT_LINE_IN1, 214 { CX18_CARD_INPUT_LINE_IN2, CX18_AV_AUDIO_SERIAL, 0 },
199 CX23418_AUDIO_SERIAL, 0 },
200 }, 215 },
201 .radio_input = { CX18_CARD_INPUT_AUD_TUNER, 216 .radio_input = { CX18_CARD_INPUT_AUD_TUNER, CX18_AV_AUDIO_SERIAL, 0 },
202 CX23418_AUDIO_SERIAL, 0 },
203 .tuners = { 217 .tuners = {
204 /* XC3028 tuner */ 218 /* XC3028 tuner */
205 { .std = V4L2_STD_ALL, .tuner = TUNER_XC2028 }, 219 { .std = V4L2_STD_ALL, .tuner = TUNER_XC2028 },
diff --git a/drivers/media/video/cx18/cx18-cards.h b/drivers/media/video/cx18/cx18-cards.h
index bccb67f0db16..dc2dd945d4c3 100644
--- a/drivers/media/video/cx18/cx18-cards.h
+++ b/drivers/media/video/cx18/cx18-cards.h
@@ -36,36 +36,6 @@
36#define CX18_CARD_INPUT_COMPOSITE2 5 36#define CX18_CARD_INPUT_COMPOSITE2 5
37#define CX18_CARD_INPUT_COMPOSITE3 6 37#define CX18_CARD_INPUT_COMPOSITE3 6
38 38
39enum cx34180_video_input {
40 /* Composite video inputs In1-In8 */
41 CX23418_COMPOSITE1 = 1,
42 CX23418_COMPOSITE2,
43 CX23418_COMPOSITE3,
44 CX23418_COMPOSITE4,
45 CX23418_COMPOSITE5,
46 CX23418_COMPOSITE6,
47 CX23418_COMPOSITE7,
48 CX23418_COMPOSITE8,
49
50 /* S-Video inputs consist of one luma input (In1-In4) ORed with one
51 chroma input (In5-In8) */
52 CX23418_SVIDEO_LUMA1 = 0x10,
53 CX23418_SVIDEO_LUMA2 = 0x20,
54 CX23418_SVIDEO_LUMA3 = 0x30,
55 CX23418_SVIDEO_LUMA4 = 0x40,
56 CX23418_SVIDEO_CHROMA4 = 0x400,
57 CX23418_SVIDEO_CHROMA5 = 0x500,
58 CX23418_SVIDEO_CHROMA6 = 0x600,
59 CX23418_SVIDEO_CHROMA7 = 0x700,
60 CX23418_SVIDEO_CHROMA8 = 0x800,
61
62 /* S-Video aliases for common luma/chroma combinations */
63 CX23418_SVIDEO1 = 0x510,
64 CX23418_SVIDEO2 = 0x620,
65 CX23418_SVIDEO3 = 0x730,
66 CX23418_SVIDEO4 = 0x840,
67};
68
69/* audio inputs */ 39/* audio inputs */
70#define CX18_CARD_INPUT_AUD_TUNER 1 40#define CX18_CARD_INPUT_AUD_TUNER 1
71#define CX18_CARD_INPUT_LINE_IN1 2 41#define CX18_CARD_INPUT_LINE_IN1 2
@@ -75,16 +45,6 @@ enum cx34180_video_input {
75#define CX18_CARD_MAX_AUDIO_INPUTS 3 45#define CX18_CARD_MAX_AUDIO_INPUTS 3
76#define CX18_CARD_MAX_TUNERS 2 46#define CX18_CARD_MAX_TUNERS 2
77 47
78enum cx23418_audio_input {
79 /* Audio inputs: serial or In4-In8 */
80 CX23418_AUDIO_SERIAL,
81 CX23418_AUDIO4 = 4,
82 CX23418_AUDIO5,
83 CX23418_AUDIO6,
84 CX23418_AUDIO7,
85 CX23418_AUDIO8,
86};
87
88/* V4L2 capability aliases */ 48/* V4L2 capability aliases */
89#define CX18_CAP_ENCODER (V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_TUNER | \ 49#define CX18_CAP_ENCODER (V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_TUNER | \
90 V4L2_CAP_AUDIO | V4L2_CAP_READWRITE) 50 V4L2_CAP_AUDIO | V4L2_CAP_READWRITE)
@@ -118,6 +78,13 @@ struct cx18_gpio_init { /* set initial GPIO DIR and OUT values */
118 u32 initial_value; 78 u32 initial_value;
119}; 79};
120 80
81struct cx18_gpio_i2c_slave_reset {
82 u32 active_lo_mask; /* GPIO outputs that reset i2c chips when low */
83 u32 active_hi_mask; /* GPIO outputs that reset i2c chips when high */
84 int msecs_asserted; /* time period reset must remain asserted */
85 int msecs_recovery; /* time after deassert for chips to be ready */
86};
87
121struct cx18_card_tuner { 88struct cx18_card_tuner {
122 v4l2_std_id std; /* standard for which the tuner is suitable */ 89 v4l2_std_id std; /* standard for which the tuner is suitable */
123 int tuner; /* tuner ID (from tuner.h) */ 90 int tuner; /* tuner ID (from tuner.h) */
@@ -154,7 +121,8 @@ struct cx18_card {
154 121
155 /* GPIO card-specific settings */ 122 /* GPIO card-specific settings */
156 u8 xceive_pin; /* XCeive tuner GPIO reset pin */ 123 u8 xceive_pin; /* XCeive tuner GPIO reset pin */
157 struct cx18_gpio_init gpio_init; 124 struct cx18_gpio_init gpio_init;
125 struct cx18_gpio_i2c_slave_reset gpio_i2c_slave_reset;
158 126
159 struct cx18_card_tuner tuners[CX18_CARD_MAX_TUNERS]; 127 struct cx18_card_tuner tuners[CX18_CARD_MAX_TUNERS];
160 struct cx18_card_tuner_i2c *i2c; 128 struct cx18_card_tuner_i2c *i2c;
diff --git a/drivers/media/video/cx18/cx18-dvb.c b/drivers/media/video/cx18/cx18-dvb.c
index c9744173f969..cae38985b131 100644
--- a/drivers/media/video/cx18/cx18-dvb.c
+++ b/drivers/media/video/cx18/cx18-dvb.c
@@ -69,11 +69,21 @@ static int cx18_dvb_start_feed(struct dvb_demux_feed *feed)
69 struct dvb_demux *demux = feed->demux; 69 struct dvb_demux *demux = feed->demux;
70 struct cx18_stream *stream = (struct cx18_stream *) demux->priv; 70 struct cx18_stream *stream = (struct cx18_stream *) demux->priv;
71 struct cx18 *cx = stream->cx; 71 struct cx18 *cx = stream->cx;
72 int ret = -EINVAL; 72 int ret;
73 u32 v; 73 u32 v;
74 74
75 CX18_DEBUG_INFO("Start feed: pid = 0x%x index = %d\n", 75 CX18_DEBUG_INFO("Start feed: pid = 0x%x index = %d\n",
76 feed->pid, feed->index); 76 feed->pid, feed->index);
77
78 mutex_lock(&cx->serialize_lock);
79 ret = cx18_init_on_first_open(cx);
80 mutex_unlock(&cx->serialize_lock);
81 if (ret) {
82 CX18_ERR("Failed to initialize firmware starting DVB feed\n");
83 return ret;
84 }
85 ret = -EINVAL;
86
77 switch (cx->card->type) { 87 switch (cx->card->type) {
78 case CX18_CARD_HVR_1600_ESMT: 88 case CX18_CARD_HVR_1600_ESMT:
79 case CX18_CARD_HVR_1600_SAMSUNG: 89 case CX18_CARD_HVR_1600_SAMSUNG:
@@ -101,6 +111,11 @@ static int cx18_dvb_start_feed(struct dvb_demux_feed *feed)
101 if (stream->dvb.feeding++ == 0) { 111 if (stream->dvb.feeding++ == 0) {
102 CX18_DEBUG_INFO("Starting Transport DMA\n"); 112 CX18_DEBUG_INFO("Starting Transport DMA\n");
103 ret = cx18_start_v4l2_encode_stream(stream); 113 ret = cx18_start_v4l2_encode_stream(stream);
114 if (ret < 0) {
115 CX18_DEBUG_INFO(
116 "Failed to start Transport DMA\n");
117 stream->dvb.feeding--;
118 }
104 } else 119 } else
105 ret = 0; 120 ret = 0;
106 mutex_unlock(&stream->dvb.feedlock); 121 mutex_unlock(&stream->dvb.feedlock);
diff --git a/drivers/media/video/cx18/cx18-gpio.c b/drivers/media/video/cx18/cx18-gpio.c
index ceb63653c926..b302833f6f9d 100644
--- a/drivers/media/video/cx18/cx18-gpio.c
+++ b/drivers/media/video/cx18/cx18-gpio.c
@@ -53,10 +53,34 @@ static void gpio_write(struct cx18 *cx)
53 write_reg(((dir & 0xffff) << 16) | (val & 0xffff), 53 write_reg(((dir & 0xffff) << 16) | (val & 0xffff),
54 CX18_REG_GPIO_OUT1); 54 CX18_REG_GPIO_OUT1);
55 write_reg(dir & 0xffff0000, CX18_REG_GPIO_DIR2); 55 write_reg(dir & 0xffff0000, CX18_REG_GPIO_DIR2);
56 write_reg((dir & 0xffff0000) | ((val & 0xffff0000) >> 16), 56 write_reg_sync((dir & 0xffff0000) | ((val & 0xffff0000) >> 16),
57 CX18_REG_GPIO_OUT2); 57 CX18_REG_GPIO_OUT2);
58} 58}
59 59
60void cx18_reset_i2c_slaves_gpio(struct cx18 *cx)
61{
62 const struct cx18_gpio_i2c_slave_reset *p;
63
64 p = &cx->card->gpio_i2c_slave_reset;
65
66 if ((p->active_lo_mask | p->active_hi_mask) == 0)
67 return;
68
69 /* Assuming that the masks are a subset of the bits in gpio_dir */
70
71 /* Assert */
72 cx->gpio_val =
73 (cx->gpio_val | p->active_hi_mask) & ~(p->active_lo_mask);
74 gpio_write(cx);
75 schedule_timeout_uninterruptible(msecs_to_jiffies(p->msecs_asserted));
76
77 /* Deassert */
78 cx->gpio_val =
79 (cx->gpio_val | p->active_lo_mask) & ~(p->active_hi_mask);
80 gpio_write(cx);
81 schedule_timeout_uninterruptible(msecs_to_jiffies(p->msecs_recovery));
82}
83
60void cx18_gpio_init(struct cx18 *cx) 84void cx18_gpio_init(struct cx18 *cx)
61{ 85{
62 cx->gpio_dir = cx->card->gpio_init.direction; 86 cx->gpio_dir = cx->card->gpio_init.direction;
diff --git a/drivers/media/video/cx18/cx18-gpio.h b/drivers/media/video/cx18/cx18-gpio.h
index 41bac8856b50..525c328f748a 100644
--- a/drivers/media/video/cx18/cx18-gpio.h
+++ b/drivers/media/video/cx18/cx18-gpio.h
@@ -21,4 +21,5 @@
21 */ 21 */
22 22
23void cx18_gpio_init(struct cx18 *cx); 23void cx18_gpio_init(struct cx18 *cx);
24void cx18_reset_i2c_slaves_gpio(struct cx18 *cx);
24int cx18_reset_tuner_gpio(void *dev, int cmd, int value); 25int cx18_reset_tuner_gpio(void *dev, int cmd, int value);
diff --git a/drivers/media/video/cx18/cx18-i2c.c b/drivers/media/video/cx18/cx18-i2c.c
index 1d6c51a75313..680bc4e35b79 100644
--- a/drivers/media/video/cx18/cx18-i2c.c
+++ b/drivers/media/video/cx18/cx18-i2c.c
@@ -405,6 +405,8 @@ int init_cx18_i2c(struct cx18 *cx)
405 cx18_setscl(&cx->i2c_algo_cb_data[1], 1); 405 cx18_setscl(&cx->i2c_algo_cb_data[1], 1);
406 cx18_setsda(&cx->i2c_algo_cb_data[1], 1); 406 cx18_setsda(&cx->i2c_algo_cb_data[1], 1);
407 407
408 cx18_reset_i2c_slaves_gpio(cx);
409
408 return i2c_bit_add_bus(&cx->i2c_adap[0]) || 410 return i2c_bit_add_bus(&cx->i2c_adap[0]) ||
409 i2c_bit_add_bus(&cx->i2c_adap[1]); 411 i2c_bit_add_bus(&cx->i2c_adap[1]);
410} 412}
diff --git a/drivers/media/video/cx25840/cx25840-core.c b/drivers/media/video/cx25840/cx25840-core.c
index 607efdcd22f8..1da6f134888d 100644
--- a/drivers/media/video/cx25840/cx25840-core.c
+++ b/drivers/media/video/cx25840/cx25840-core.c
@@ -433,7 +433,7 @@ static int set_input(struct i2c_client *client, enum cx25840_video_input vid_inp
433 int chroma = vid_input & 0xf00; 433 int chroma = vid_input & 0xf00;
434 434
435 if ((vid_input & ~0xff0) || 435 if ((vid_input & ~0xff0) ||
436 luma < CX25840_SVIDEO_LUMA1 || luma > CX25840_SVIDEO_LUMA4 || 436 luma < CX25840_SVIDEO_LUMA1 || luma > CX25840_SVIDEO_LUMA8 ||
437 chroma < CX25840_SVIDEO_CHROMA4 || chroma > CX25840_SVIDEO_CHROMA8) { 437 chroma < CX25840_SVIDEO_CHROMA4 || chroma > CX25840_SVIDEO_CHROMA8) {
438 v4l_err(client, "0x%04x is not a valid video input!\n", 438 v4l_err(client, "0x%04x is not a valid video input!\n",
439 vid_input); 439 vid_input);
diff --git a/drivers/media/video/cx88/cx88-alsa.c b/drivers/media/video/cx88/cx88-alsa.c
index e976fc6bef7c..80c8883e54b5 100644
--- a/drivers/media/video/cx88/cx88-alsa.c
+++ b/drivers/media/video/cx88/cx88-alsa.c
@@ -332,6 +332,12 @@ static int snd_cx88_pcm_open(struct snd_pcm_substream *substream)
332 struct snd_pcm_runtime *runtime = substream->runtime; 332 struct snd_pcm_runtime *runtime = substream->runtime;
333 int err; 333 int err;
334 334
335 if (!chip) {
336 printk(KERN_ERR "BUG: cx88 can't find device struct."
337 " Can't proceed with open\n");
338 return -ENODEV;
339 }
340
335 err = snd_pcm_hw_constraint_pow2(runtime, 0, SNDRV_PCM_HW_PARAM_PERIODS); 341 err = snd_pcm_hw_constraint_pow2(runtime, 0, SNDRV_PCM_HW_PARAM_PERIODS);
336 if (err < 0) 342 if (err < 0)
337 goto _error; 343 goto _error;
diff --git a/drivers/media/video/em28xx/em28xx-audio.c b/drivers/media/video/em28xx/em28xx-audio.c
index 92b2a6db4fdc..3c006103c1eb 100644
--- a/drivers/media/video/em28xx/em28xx-audio.c
+++ b/drivers/media/video/em28xx/em28xx-audio.c
@@ -268,6 +268,12 @@ static int snd_em28xx_capture_open(struct snd_pcm_substream *substream)
268 268
269 dprintk("opening device and trying to acquire exclusive lock\n"); 269 dprintk("opening device and trying to acquire exclusive lock\n");
270 270
271 if (!dev) {
272 printk(KERN_ERR "BUG: em28xx can't find device struct."
273 " Can't proceed with open\n");
274 return -ENODEV;
275 }
276
271 /* Sets volume, mute, etc */ 277 /* Sets volume, mute, etc */
272 278
273 dev->mute = 0; 279 dev->mute = 0;
@@ -415,6 +421,12 @@ static int em28xx_audio_init(struct em28xx *dev)
415 static int devnr; 421 static int devnr;
416 int ret, err; 422 int ret, err;
417 423
424 if (dev->has_audio_class) {
425 /* This device does not support the extension (in this case
426 the device is expecting the snd-usb-audio module */
427 return 0;
428 }
429
418 printk(KERN_INFO "em28xx-audio.c: probing for em28x1 " 430 printk(KERN_INFO "em28xx-audio.c: probing for em28x1 "
419 "non standard usbaudio\n"); 431 "non standard usbaudio\n");
420 printk(KERN_INFO "em28xx-audio.c: Copyright (C) 2006 Markus " 432 printk(KERN_INFO "em28xx-audio.c: Copyright (C) 2006 Markus "
@@ -458,6 +470,12 @@ static int em28xx_audio_fini(struct em28xx *dev)
458 if (dev == NULL) 470 if (dev == NULL)
459 return 0; 471 return 0;
460 472
473 if (dev->has_audio_class) {
474 /* This device does not support the extension (in this case
475 the device is expecting the snd-usb-audio module */
476 return 0;
477 }
478
461 if (dev->adev) { 479 if (dev->adev) {
462 snd_card_free(dev->adev->sndcard); 480 snd_card_free(dev->adev->sndcard);
463 kfree(dev->adev); 481 kfree(dev->adev);
diff --git a/drivers/media/video/em28xx/em28xx-cards.c b/drivers/media/video/em28xx/em28xx-cards.c
index 3e4f3c7e92e7..8cbda43727c3 100644
--- a/drivers/media/video/em28xx/em28xx-cards.c
+++ b/drivers/media/video/em28xx/em28xx-cards.c
@@ -157,6 +157,7 @@ struct em28xx_board em28xx_boards[] = {
157 .tda9887_conf = TDA9887_PRESENT, 157 .tda9887_conf = TDA9887_PRESENT,
158 .tuner_type = TUNER_XC2028, 158 .tuner_type = TUNER_XC2028,
159 .mts_firmware = 1, 159 .mts_firmware = 1,
160 .has_dvb = 1,
160 .decoder = EM28XX_TVP5150, 161 .decoder = EM28XX_TVP5150,
161 .input = { { 162 .input = { {
162 .type = EM28XX_VMUX_TELEVISION, 163 .type = EM28XX_VMUX_TELEVISION,
@@ -524,6 +525,9 @@ void em28xx_pre_card_setup(struct em28xx *dev)
524 rc = em28xx_read_reg(dev, EM28XX_R0A_CHIPID); 525 rc = em28xx_read_reg(dev, EM28XX_R0A_CHIPID);
525 if (rc > 0) { 526 if (rc > 0) {
526 switch (rc) { 527 switch (rc) {
528 case CHIP_ID_EM2860:
529 em28xx_info("chip ID is em2860\n");
530 break;
527 case CHIP_ID_EM2883: 531 case CHIP_ID_EM2883:
528 em28xx_info("chip ID is em2882/em2883\n"); 532 em28xx_info("chip ID is em2882/em2883\n");
529 dev->wait_after_write = 0; 533 dev->wait_after_write = 0;
diff --git a/drivers/media/video/em28xx/em28xx-dvb.c b/drivers/media/video/em28xx/em28xx-dvb.c
index 8cf4983f0039..0b2333ee07f8 100644
--- a/drivers/media/video/em28xx/em28xx-dvb.c
+++ b/drivers/media/video/em28xx/em28xx-dvb.c
@@ -382,6 +382,11 @@ static int dvb_init(struct em28xx *dev)
382 int result = 0; 382 int result = 0;
383 struct em28xx_dvb *dvb; 383 struct em28xx_dvb *dvb;
384 384
385 if (!dev->has_dvb) {
386 /* This device does not support the extension */
387 return 0;
388 }
389
385 dvb = kzalloc(sizeof(struct em28xx_dvb), GFP_KERNEL); 390 dvb = kzalloc(sizeof(struct em28xx_dvb), GFP_KERNEL);
386 391
387 if (dvb == NULL) { 392 if (dvb == NULL) {
@@ -444,6 +449,11 @@ out_free:
444 449
445static int dvb_fini(struct em28xx *dev) 450static int dvb_fini(struct em28xx *dev)
446{ 451{
452 if (!dev->has_dvb) {
453 /* This device does not support the extension */
454 return 0;
455 }
456
447 if (dev->dvb) { 457 if (dev->dvb) {
448 unregister_dvb(dev->dvb); 458 unregister_dvb(dev->dvb);
449 dev->dvb = NULL; 459 dev->dvb = NULL;
diff --git a/drivers/media/video/em28xx/em28xx-reg.h b/drivers/media/video/em28xx/em28xx-reg.h
index 9058bed07953..fac1ab23f621 100644
--- a/drivers/media/video/em28xx/em28xx-reg.h
+++ b/drivers/media/video/em28xx/em28xx-reg.h
@@ -84,5 +84,6 @@
84 84
85/* FIXME: Need to be populated with the other chip ID's */ 85/* FIXME: Need to be populated with the other chip ID's */
86enum em28xx_chip_id { 86enum em28xx_chip_id {
87 CHIP_ID_EM2860 = 34,
87 CHIP_ID_EM2883 = 36, 88 CHIP_ID_EM2883 = 36,
88}; 89};
diff --git a/drivers/media/video/em28xx/em28xx-video.c b/drivers/media/video/em28xx/em28xx-video.c
index fb163ecd9216..285bc62bbe46 100644
--- a/drivers/media/video/em28xx/em28xx-video.c
+++ b/drivers/media/video/em28xx/em28xx-video.c
@@ -1848,32 +1848,28 @@ static DEFINE_MUTEX(em28xx_extension_devlist_lock);
1848 1848
1849int em28xx_register_extension(struct em28xx_ops *ops) 1849int em28xx_register_extension(struct em28xx_ops *ops)
1850{ 1850{
1851 struct em28xx *h, *dev = NULL; 1851 struct em28xx *dev = NULL;
1852
1853 list_for_each_entry(h, &em28xx_devlist, devlist)
1854 dev = h;
1855 1852
1856 mutex_lock(&em28xx_extension_devlist_lock); 1853 mutex_lock(&em28xx_extension_devlist_lock);
1857 list_add_tail(&ops->next, &em28xx_extension_devlist); 1854 list_add_tail(&ops->next, &em28xx_extension_devlist);
1858 if (dev) 1855 list_for_each_entry(dev, &em28xx_devlist, devlist) {
1859 ops->init(dev); 1856 if (dev)
1860 1857 ops->init(dev);
1858 }
1861 printk(KERN_INFO "Em28xx: Initialized (%s) extension\n", ops->name); 1859 printk(KERN_INFO "Em28xx: Initialized (%s) extension\n", ops->name);
1862 mutex_unlock(&em28xx_extension_devlist_lock); 1860 mutex_unlock(&em28xx_extension_devlist_lock);
1863
1864 return 0; 1861 return 0;
1865} 1862}
1866EXPORT_SYMBOL(em28xx_register_extension); 1863EXPORT_SYMBOL(em28xx_register_extension);
1867 1864
1868void em28xx_unregister_extension(struct em28xx_ops *ops) 1865void em28xx_unregister_extension(struct em28xx_ops *ops)
1869{ 1866{
1870 struct em28xx *h, *dev = NULL; 1867 struct em28xx *dev = NULL;
1871
1872 list_for_each_entry(h, &em28xx_devlist, devlist)
1873 dev = h;
1874 1868
1875 if (dev) 1869 list_for_each_entry(dev, &em28xx_devlist, devlist) {
1876 ops->fini(dev); 1870 if (dev)
1871 ops->fini(dev);
1872 }
1877 1873
1878 mutex_lock(&em28xx_extension_devlist_lock); 1874 mutex_lock(&em28xx_extension_devlist_lock);
1879 printk(KERN_INFO "Em28xx: Removed (%s) extension\n", ops->name); 1875 printk(KERN_INFO "Em28xx: Removed (%s) extension\n", ops->name);
diff --git a/drivers/media/video/pxa_camera.c b/drivers/media/video/pxa_camera.c
index 7cc8e9b19fb7..5ec5bb9a94d2 100644
--- a/drivers/media/video/pxa_camera.c
+++ b/drivers/media/video/pxa_camera.c
@@ -1019,12 +1019,12 @@ static int pxa_camera_probe(struct platform_device *pdev)
1019 struct pxa_camera_dev *pcdev; 1019 struct pxa_camera_dev *pcdev;
1020 struct resource *res; 1020 struct resource *res;
1021 void __iomem *base; 1021 void __iomem *base;
1022 unsigned int irq; 1022 int irq;
1023 int err = 0; 1023 int err = 0;
1024 1024
1025 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 1025 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
1026 irq = platform_get_irq(pdev, 0); 1026 irq = platform_get_irq(pdev, 0);
1027 if (!res || !irq) { 1027 if (!res || irq < 0) {
1028 err = -ENODEV; 1028 err = -ENODEV;
1029 goto exit; 1029 goto exit;
1030 } 1030 }
diff --git a/drivers/media/video/saa7134/saa7134-alsa.c b/drivers/media/video/saa7134/saa7134-alsa.c
index ba3082422a01..f118de6e3672 100644
--- a/drivers/media/video/saa7134/saa7134-alsa.c
+++ b/drivers/media/video/saa7134/saa7134-alsa.c
@@ -613,9 +613,15 @@ static int snd_card_saa7134_capture_open(struct snd_pcm_substream * substream)
613 struct snd_pcm_runtime *runtime = substream->runtime; 613 struct snd_pcm_runtime *runtime = substream->runtime;
614 snd_card_saa7134_pcm_t *pcm; 614 snd_card_saa7134_pcm_t *pcm;
615 snd_card_saa7134_t *saa7134 = snd_pcm_substream_chip(substream); 615 snd_card_saa7134_t *saa7134 = snd_pcm_substream_chip(substream);
616 struct saa7134_dev *dev = saa7134->dev; 616 struct saa7134_dev *dev;
617 int amux, err; 617 int amux, err;
618 618
619 if (!saa7134) {
620 printk(KERN_ERR "BUG: saa7134 can't find device struct."
621 " Can't proceed with open\n");
622 return -ENODEV;
623 }
624 dev = saa7134->dev;
619 mutex_lock(&dev->dmasound.lock); 625 mutex_lock(&dev->dmasound.lock);
620 626
621 dev->dmasound.read_count = 0; 627 dev->dmasound.read_count = 0;
diff --git a/drivers/media/video/saa7134/saa7134-cards.c b/drivers/media/video/saa7134/saa7134-cards.c
index b111903aa322..2618cfa592e7 100644
--- a/drivers/media/video/saa7134/saa7134-cards.c
+++ b/drivers/media/video/saa7134/saa7134-cards.c
@@ -4114,11 +4114,7 @@ struct saa7134_board saa7134_boards[] = {
4114 .radio_type = UNSET, 4114 .radio_type = UNSET,
4115 .tuner_addr = ADDR_UNSET, 4115 .tuner_addr = ADDR_UNSET,
4116 .radio_addr = ADDR_UNSET, 4116 .radio_addr = ADDR_UNSET,
4117 /*
4118 TODO:
4119 .mpeg = SAA7134_MPEG_DVB, 4117 .mpeg = SAA7134_MPEG_DVB,
4120 */
4121
4122 .inputs = {{ 4118 .inputs = {{
4123 .name = name_tv, 4119 .name = name_tv,
4124 .vmux = 1, 4120 .vmux = 1,
@@ -4157,7 +4153,7 @@ struct saa7134_board saa7134_boards[] = {
4157 } }, 4153 } },
4158 .radio = { 4154 .radio = {
4159 .name = name_radio, 4155 .name = name_radio,
4160 .amux = LINE1, 4156 .amux = TV,
4161 }, 4157 },
4162 }, 4158 },
4163 [SAA7134_BOARD_AVERMEDIA_M115] = { 4159 [SAA7134_BOARD_AVERMEDIA_M115] = {
@@ -4167,6 +4163,7 @@ struct saa7134_board saa7134_boards[] = {
4167 .radio_type = UNSET, 4163 .radio_type = UNSET,
4168 .tuner_addr = ADDR_UNSET, 4164 .tuner_addr = ADDR_UNSET,
4169 .radio_addr = ADDR_UNSET, 4165 .radio_addr = ADDR_UNSET,
4166 .mpeg = SAA7134_MPEG_DVB,
4170 .inputs = {{ 4167 .inputs = {{
4171 .name = name_tv, 4168 .name = name_tv,
4172 .vmux = 1, 4169 .vmux = 1,
@@ -5351,22 +5348,21 @@ static int saa7134_xc2028_callback(struct saa7134_dev *dev,
5351{ 5348{
5352 switch (command) { 5349 switch (command) {
5353 case XC2028_TUNER_RESET: 5350 case XC2028_TUNER_RESET:
5354 saa_andorl(SAA7134_GPIO_GPMODE0 >> 2, 0x06e20000, 0x06e20000); 5351 saa_andorl(SAA7134_GPIO_GPSTATUS0 >> 2, 0x00008000, 0x00000000);
5355 saa_andorl(SAA7134_GPIO_GPSTATUS0 >> 2, 0x06a20000, 0x06a20000); 5352 saa_andorl(SAA7134_GPIO_GPSTATUS0 >> 2, 0x00008000, 0x00008000);
5356 mdelay(250); 5353 switch (dev->board) {
5357 saa_andorl(SAA7134_GPIO_GPMODE0 >> 2, 0x06e20000, 0); 5354 case SAA7134_BOARD_AVERMEDIA_CARDBUS_506:
5358 saa_andorl(SAA7134_GPIO_GPSTATUS0 >> 2, 0x06a20000, 0); 5355 saa7134_set_gpio(dev, 23, 0);
5359 mdelay(250); 5356 msleep(10);
5360 saa_andorl(SAA7134_GPIO_GPMODE0 >> 2, 0x06e20000, 0x06e20000); 5357 saa7134_set_gpio(dev, 23, 1);
5361 saa_andorl(SAA7134_GPIO_GPSTATUS0 >> 2, 0x06a20000, 0x06a20000); 5358 break;
5362 mdelay(250); 5359 case SAA7134_BOARD_AVERMEDIA_A16D:
5363 saa_andorl(SAA7133_ANALOG_IO_SELECT >> 2, 0x02, 0x02); 5360 saa7134_set_gpio(dev, 21, 0);
5364 saa_andorl(SAA7134_ANALOG_IN_CTRL1 >> 2, 0x81, 0x81); 5361 msleep(10);
5365 saa_andorl(SAA7134_AUDIO_CLOCK0 >> 2, 0x03187de7, 0x03187de7); 5362 saa7134_set_gpio(dev, 21, 1);
5366 saa_andorl(SAA7134_AUDIO_PLL_CTRL >> 2, 0x03, 0x03); 5363 break;
5367 saa_andorl(SAA7134_AUDIO_CLOCKS_PER_FIELD0 >> 2, 5364 }
5368 0x0001e000, 0x0001e000); 5365 return 0;
5369 return 0;
5370 } 5366 }
5371 return -EINVAL; 5367 return -EINVAL;
5372} 5368}
@@ -5553,9 +5549,7 @@ int saa7134_board_init1(struct saa7134_dev *dev)
5553 saa_andorl(SAA7134_GPIO_GPSTATUS0 >> 2, 0x08000000, 0x00000000); 5549 saa_andorl(SAA7134_GPIO_GPSTATUS0 >> 2, 0x08000000, 0x00000000);
5554 break; 5550 break;
5555 case SAA7134_BOARD_AVERMEDIA_CARDBUS: 5551 case SAA7134_BOARD_AVERMEDIA_CARDBUS:
5556 case SAA7134_BOARD_AVERMEDIA_CARDBUS_506:
5557 case SAA7134_BOARD_AVERMEDIA_M115: 5552 case SAA7134_BOARD_AVERMEDIA_M115:
5558 case SAA7134_BOARD_AVERMEDIA_A16D:
5559 /* power-down tuner chip */ 5553 /* power-down tuner chip */
5560 saa_andorl(SAA7134_GPIO_GPMODE0 >> 2, 0xffffffff, 0); 5554 saa_andorl(SAA7134_GPIO_GPMODE0 >> 2, 0xffffffff, 0);
5561 saa_andorl(SAA7134_GPIO_GPSTATUS0 >> 2, 0xffffffff, 0); 5555 saa_andorl(SAA7134_GPIO_GPSTATUS0 >> 2, 0xffffffff, 0);
@@ -5565,6 +5559,18 @@ int saa7134_board_init1(struct saa7134_dev *dev)
5565 saa_andorl(SAA7134_GPIO_GPSTATUS0 >> 2, 0xffffffff, 0xffffffff); 5559 saa_andorl(SAA7134_GPIO_GPSTATUS0 >> 2, 0xffffffff, 0xffffffff);
5566 msleep(10); 5560 msleep(10);
5567 break; 5561 break;
5562 case SAA7134_BOARD_AVERMEDIA_CARDBUS_506:
5563 saa7134_set_gpio(dev, 23, 0);
5564 msleep(10);
5565 saa7134_set_gpio(dev, 23, 1);
5566 break;
5567 case SAA7134_BOARD_AVERMEDIA_A16D:
5568 saa7134_set_gpio(dev, 21, 0);
5569 msleep(10);
5570 saa7134_set_gpio(dev, 21, 1);
5571 msleep(1);
5572 dev->has_remote = SAA7134_REMOTE_GPIO;
5573 break;
5568 case SAA7134_BOARD_BEHOLD_COLUMBUS_TVFM: 5574 case SAA7134_BOARD_BEHOLD_COLUMBUS_TVFM:
5569 /* power-down tuner chip */ 5575 /* power-down tuner chip */
5570 saa_andorl(SAA7134_GPIO_GPMODE0 >> 2, 0x000A8004, 0x000A8004); 5576 saa_andorl(SAA7134_GPIO_GPMODE0 >> 2, 0x000A8004, 0x000A8004);
@@ -5615,7 +5621,8 @@ int saa7134_board_init1(struct saa7134_dev *dev)
5615 saa_andorl(SAA7134_GPIO_GPMODE0 >> 2, 0x80040100, 0x80040100); 5621 saa_andorl(SAA7134_GPIO_GPMODE0 >> 2, 0x80040100, 0x80040100);
5616 saa_andorl(SAA7134_GPIO_GPSTATUS0 >> 2, 0x80040100, 0x00040100); 5622 saa_andorl(SAA7134_GPIO_GPSTATUS0 >> 2, 0x80040100, 0x00040100);
5617 printk("%s: %s: hybrid analog/dvb card\n" 5623 printk("%s: %s: hybrid analog/dvb card\n"
5618 "%s: Sorry, only the analog inputs are supported for now.\n", 5624 "%s: Sorry, only analog s-video and composite input "
5625 "are supported for now.\n",
5619 dev->name, card(dev).name, dev->name); 5626 dev->name, card(dev).name, dev->name);
5620 break; 5627 break;
5621 } 5628 }
@@ -5675,6 +5682,7 @@ static void saa7134_tuner_setup(struct saa7134_dev *dev)
5675 5682
5676 switch (dev->board) { 5683 switch (dev->board) {
5677 case SAA7134_BOARD_AVERMEDIA_A16D: 5684 case SAA7134_BOARD_AVERMEDIA_A16D:
5685 case SAA7134_BOARD_AVERMEDIA_CARDBUS_506:
5678 ctl.demod = XC3028_FE_ZARLINK456; 5686 ctl.demod = XC3028_FE_ZARLINK456;
5679 break; 5687 break;
5680 default: 5688 default:
diff --git a/drivers/media/video/saa7134/saa7134-dvb.c b/drivers/media/video/saa7134/saa7134-dvb.c
index 469f93aac008..341b101b0357 100644
--- a/drivers/media/video/saa7134/saa7134-dvb.c
+++ b/drivers/media/video/saa7134/saa7134-dvb.c
@@ -153,12 +153,12 @@ static int mt352_aver777_init(struct dvb_frontend* fe)
153 return 0; 153 return 0;
154} 154}
155 155
156static int mt352_aver_a16d_init(struct dvb_frontend *fe) 156static int mt352_avermedia_xc3028_init(struct dvb_frontend *fe)
157{ 157{
158 static u8 clock_config [] = { CLOCK_CTL, 0x38, 0x2d }; 158 static u8 clock_config [] = { CLOCK_CTL, 0x38, 0x2d };
159 static u8 reset [] = { RESET, 0x80 }; 159 static u8 reset [] = { RESET, 0x80 };
160 static u8 adc_ctl_1_cfg [] = { ADC_CTL_1, 0x40 }; 160 static u8 adc_ctl_1_cfg [] = { ADC_CTL_1, 0x40 };
161 static u8 agc_cfg [] = { AGC_TARGET, 0x28, 0xa0 }; 161 static u8 agc_cfg [] = { AGC_TARGET, 0xe };
162 static u8 capt_range_cfg[] = { CAPT_RANGE, 0x33 }; 162 static u8 capt_range_cfg[] = { CAPT_RANGE, 0x33 };
163 163
164 mt352_write(fe, clock_config, sizeof(clock_config)); 164 mt352_write(fe, clock_config, sizeof(clock_config));
@@ -167,12 +167,9 @@ static int mt352_aver_a16d_init(struct dvb_frontend *fe)
167 mt352_write(fe, adc_ctl_1_cfg, sizeof(adc_ctl_1_cfg)); 167 mt352_write(fe, adc_ctl_1_cfg, sizeof(adc_ctl_1_cfg));
168 mt352_write(fe, agc_cfg, sizeof(agc_cfg)); 168 mt352_write(fe, agc_cfg, sizeof(agc_cfg));
169 mt352_write(fe, capt_range_cfg, sizeof(capt_range_cfg)); 169 mt352_write(fe, capt_range_cfg, sizeof(capt_range_cfg));
170
171 return 0; 170 return 0;
172} 171}
173 172
174
175
176static int mt352_pinnacle_tuner_set_params(struct dvb_frontend* fe, 173static int mt352_pinnacle_tuner_set_params(struct dvb_frontend* fe,
177 struct dvb_frontend_parameters* params) 174 struct dvb_frontend_parameters* params)
178{ 175{
@@ -215,14 +212,10 @@ static struct mt352_config avermedia_777 = {
215 .demod_init = mt352_aver777_init, 212 .demod_init = mt352_aver777_init,
216}; 213};
217 214
218static struct mt352_config avermedia_16d = { 215static struct mt352_config avermedia_xc3028_mt352_dev = {
219 .demod_address = 0xf,
220 .demod_init = mt352_aver_a16d_init,
221};
222
223static struct mt352_config avermedia_e506r_mt352_dev = {
224 .demod_address = (0x1e >> 1), 216 .demod_address = (0x1e >> 1),
225 .no_tuner = 1, 217 .no_tuner = 1,
218 .demod_init = mt352_avermedia_xc3028_init,
226}; 219};
227 220
228/* ================================================================== 221/* ==================================================================
@@ -975,9 +968,10 @@ static int dvb_init(struct saa7134_dev *dev)
975 } 968 }
976 break; 969 break;
977 case SAA7134_BOARD_AVERMEDIA_A16D: 970 case SAA7134_BOARD_AVERMEDIA_A16D:
978 dprintk("avertv A16D dvb setup\n"); 971 dprintk("AverMedia A16D dvb setup\n");
979 dev->dvb.frontend = dvb_attach(mt352_attach, &avermedia_16d, 972 dev->dvb.frontend = dvb_attach(mt352_attach,
980 &dev->i2c_adap); 973 &avermedia_xc3028_mt352_dev,
974 &dev->i2c_adap);
981 attach_xc3028 = 1; 975 attach_xc3028 = 1;
982 break; 976 break;
983 case SAA7134_BOARD_MD7134: 977 case SAA7134_BOARD_MD7134:
@@ -1091,7 +1085,8 @@ static int dvb_init(struct saa7134_dev *dev)
1091 ads_tech_duo_config.tuner_address); 1085 ads_tech_duo_config.tuner_address);
1092 goto dettach_frontend; 1086 goto dettach_frontend;
1093 } 1087 }
1094 } 1088 } else
1089 wprintk("failed to attach tda10046\n");
1095 break; 1090 break;
1096 case SAA7134_BOARD_TEVION_DVBT_220RF: 1091 case SAA7134_BOARD_TEVION_DVBT_220RF:
1097 if (configure_tda827x_fe(dev, &tevion_dvbt220rf_config, 1092 if (configure_tda827x_fe(dev, &tevion_dvbt220rf_config,
@@ -1260,11 +1255,14 @@ static int dvb_init(struct saa7134_dev *dev)
1260 goto dettach_frontend; 1255 goto dettach_frontend;
1261 break; 1256 break;
1262 case SAA7134_BOARD_AVERMEDIA_CARDBUS_506: 1257 case SAA7134_BOARD_AVERMEDIA_CARDBUS_506:
1258 dprintk("AverMedia E506R dvb setup\n");
1259 saa7134_set_gpio(dev, 25, 0);
1260 msleep(10);
1261 saa7134_set_gpio(dev, 25, 1);
1263 dev->dvb.frontend = dvb_attach(mt352_attach, 1262 dev->dvb.frontend = dvb_attach(mt352_attach,
1264 &avermedia_e506r_mt352_dev, 1263 &avermedia_xc3028_mt352_dev,
1265 &dev->i2c_adap); 1264 &dev->i2c_adap);
1266 attach_xc3028 = 1; 1265 attach_xc3028 = 1;
1267 break;
1268 case SAA7134_BOARD_MD7134_BRIDGE_2: 1266 case SAA7134_BOARD_MD7134_BRIDGE_2:
1269 dev->dvb.frontend = dvb_attach(tda10086_attach, 1267 dev->dvb.frontend = dvb_attach(tda10086_attach,
1270 &sd1878_4m, &dev->i2c_adap); 1268 &sd1878_4m, &dev->i2c_adap);
@@ -1338,7 +1336,8 @@ static int dvb_init(struct saa7134_dev *dev)
1338 return ret; 1336 return ret;
1339 1337
1340dettach_frontend: 1338dettach_frontend:
1341 dvb_frontend_detach(dev->dvb.frontend); 1339 if (dev->dvb.frontend)
1340 dvb_frontend_detach(dev->dvb.frontend);
1342 dev->dvb.frontend = NULL; 1341 dev->dvb.frontend = NULL;
1343 1342
1344 return -1; 1343 return -1;
diff --git a/drivers/media/video/saa7134/saa7134-empress.c b/drivers/media/video/saa7134/saa7134-empress.c
index 81431ee41842..3ae71a340822 100644
--- a/drivers/media/video/saa7134/saa7134-empress.c
+++ b/drivers/media/video/saa7134/saa7134-empress.c
@@ -110,9 +110,10 @@ static int ts_release(struct inode *inode, struct file *file)
110{ 110{
111 struct saa7134_dev *dev = file->private_data; 111 struct saa7134_dev *dev = file->private_data;
112 112
113 mutex_lock(&dev->empress_tsq.vb_lock);
114
113 videobuf_stop(&dev->empress_tsq); 115 videobuf_stop(&dev->empress_tsq);
114 videobuf_mmap_free(&dev->empress_tsq); 116 videobuf_mmap_free(&dev->empress_tsq);
115 dev->empress_users--;
116 117
117 /* stop the encoder */ 118 /* stop the encoder */
118 ts_reset_encoder(dev); 119 ts_reset_encoder(dev);
@@ -121,6 +122,10 @@ static int ts_release(struct inode *inode, struct file *file)
121 saa_writeb(SAA7134_AUDIO_MUTE_CTRL, 122 saa_writeb(SAA7134_AUDIO_MUTE_CTRL,
122 saa_readb(SAA7134_AUDIO_MUTE_CTRL) | (1 << 6)); 123 saa_readb(SAA7134_AUDIO_MUTE_CTRL) | (1 << 6));
123 124
125 dev->empress_users--;
126
127 mutex_unlock(&dev->empress_tsq.vb_lock);
128
124 return 0; 129 return 0;
125} 130}
126 131
@@ -218,8 +223,7 @@ static int empress_enum_fmt_cap(struct file *file, void *priv,
218static int empress_g_fmt_cap(struct file *file, void *priv, 223static int empress_g_fmt_cap(struct file *file, void *priv,
219 struct v4l2_format *f) 224 struct v4l2_format *f)
220{ 225{
221 struct saa7134_fh *fh = priv; 226 struct saa7134_dev *dev = file->private_data;
222 struct saa7134_dev *dev = fh->dev;
223 227
224 saa7134_i2c_call_clients(dev, VIDIOC_G_FMT, f); 228 saa7134_i2c_call_clients(dev, VIDIOC_G_FMT, f);
225 229
@@ -232,8 +236,7 @@ static int empress_g_fmt_cap(struct file *file, void *priv,
232static int empress_s_fmt_cap(struct file *file, void *priv, 236static int empress_s_fmt_cap(struct file *file, void *priv,
233 struct v4l2_format *f) 237 struct v4l2_format *f)
234{ 238{
235 struct saa7134_fh *fh = priv; 239 struct saa7134_dev *dev = file->private_data;
236 struct saa7134_dev *dev = fh->dev;
237 240
238 saa7134_i2c_call_clients(dev, VIDIOC_S_FMT, f); 241 saa7134_i2c_call_clients(dev, VIDIOC_S_FMT, f);
239 242
@@ -247,8 +250,7 @@ static int empress_s_fmt_cap(struct file *file, void *priv,
247static int empress_reqbufs(struct file *file, void *priv, 250static int empress_reqbufs(struct file *file, void *priv,
248 struct v4l2_requestbuffers *p) 251 struct v4l2_requestbuffers *p)
249{ 252{
250 struct saa7134_fh *fh = priv; 253 struct saa7134_dev *dev = file->private_data;
251 struct saa7134_dev *dev = fh->dev;
252 254
253 return videobuf_reqbufs(&dev->empress_tsq, p); 255 return videobuf_reqbufs(&dev->empress_tsq, p);
254} 256}
@@ -256,24 +258,21 @@ static int empress_reqbufs(struct file *file, void *priv,
256static int empress_querybuf(struct file *file, void *priv, 258static int empress_querybuf(struct file *file, void *priv,
257 struct v4l2_buffer *b) 259 struct v4l2_buffer *b)
258{ 260{
259 struct saa7134_fh *fh = priv; 261 struct saa7134_dev *dev = file->private_data;
260 struct saa7134_dev *dev = fh->dev;
261 262
262 return videobuf_querybuf(&dev->empress_tsq, b); 263 return videobuf_querybuf(&dev->empress_tsq, b);
263} 264}
264 265
265static int empress_qbuf(struct file *file, void *priv, struct v4l2_buffer *b) 266static int empress_qbuf(struct file *file, void *priv, struct v4l2_buffer *b)
266{ 267{
267 struct saa7134_fh *fh = priv; 268 struct saa7134_dev *dev = file->private_data;
268 struct saa7134_dev *dev = fh->dev;
269 269
270 return videobuf_qbuf(&dev->empress_tsq, b); 270 return videobuf_qbuf(&dev->empress_tsq, b);
271} 271}
272 272
273static int empress_dqbuf(struct file *file, void *priv, struct v4l2_buffer *b) 273static int empress_dqbuf(struct file *file, void *priv, struct v4l2_buffer *b)
274{ 274{
275 struct saa7134_fh *fh = priv; 275 struct saa7134_dev *dev = file->private_data;
276 struct saa7134_dev *dev = fh->dev;
277 276
278 return videobuf_dqbuf(&dev->empress_tsq, b, 277 return videobuf_dqbuf(&dev->empress_tsq, b,
279 file->f_flags & O_NONBLOCK); 278 file->f_flags & O_NONBLOCK);
@@ -282,8 +281,7 @@ static int empress_dqbuf(struct file *file, void *priv, struct v4l2_buffer *b)
282static int empress_streamon(struct file *file, void *priv, 281static int empress_streamon(struct file *file, void *priv,
283 enum v4l2_buf_type type) 282 enum v4l2_buf_type type)
284{ 283{
285 struct saa7134_fh *fh = priv; 284 struct saa7134_dev *dev = file->private_data;
286 struct saa7134_dev *dev = fh->dev;
287 285
288 return videobuf_streamon(&dev->empress_tsq); 286 return videobuf_streamon(&dev->empress_tsq);
289} 287}
@@ -291,8 +289,7 @@ static int empress_streamon(struct file *file, void *priv,
291static int empress_streamoff(struct file *file, void *priv, 289static int empress_streamoff(struct file *file, void *priv,
292 enum v4l2_buf_type type) 290 enum v4l2_buf_type type)
293{ 291{
294 struct saa7134_fh *fh = priv; 292 struct saa7134_dev *dev = file->private_data;
295 struct saa7134_dev *dev = fh->dev;
296 293
297 return videobuf_streamoff(&dev->empress_tsq); 294 return videobuf_streamoff(&dev->empress_tsq);
298} 295}
@@ -300,8 +297,7 @@ static int empress_streamoff(struct file *file, void *priv,
300static int empress_s_ext_ctrls(struct file *file, void *priv, 297static int empress_s_ext_ctrls(struct file *file, void *priv,
301 struct v4l2_ext_controls *ctrls) 298 struct v4l2_ext_controls *ctrls)
302{ 299{
303 struct saa7134_fh *fh = priv; 300 struct saa7134_dev *dev = file->private_data;
304 struct saa7134_dev *dev = fh->dev;
305 301
306 /* count == 0 is abused in saa6752hs.c, so that special 302 /* count == 0 is abused in saa6752hs.c, so that special
307 case is handled here explicitly. */ 303 case is handled here explicitly. */
@@ -320,8 +316,7 @@ static int empress_s_ext_ctrls(struct file *file, void *priv,
320static int empress_g_ext_ctrls(struct file *file, void *priv, 316static int empress_g_ext_ctrls(struct file *file, void *priv,
321 struct v4l2_ext_controls *ctrls) 317 struct v4l2_ext_controls *ctrls)
322{ 318{
323 struct saa7134_fh *fh = priv; 319 struct saa7134_dev *dev = file->private_data;
324 struct saa7134_dev *dev = fh->dev;
325 320
326 if (ctrls->ctrl_class != V4L2_CTRL_CLASS_MPEG) 321 if (ctrls->ctrl_class != V4L2_CTRL_CLASS_MPEG)
327 return -EINVAL; 322 return -EINVAL;
diff --git a/drivers/media/video/saa7134/saa7134-input.c b/drivers/media/video/saa7134/saa7134-input.c
index 919632b10aae..76e6501d238d 100644
--- a/drivers/media/video/saa7134/saa7134-input.c
+++ b/drivers/media/video/saa7134/saa7134-input.c
@@ -323,6 +323,15 @@ int saa7134_input_init1(struct saa7134_dev *dev)
323 saa_setb(SAA7134_GPIO_GPMODE1, 0x1); 323 saa_setb(SAA7134_GPIO_GPMODE1, 0x1);
324 saa_setb(SAA7134_GPIO_GPSTATUS1, 0x1); 324 saa_setb(SAA7134_GPIO_GPSTATUS1, 0x1);
325 break; 325 break;
326 case SAA7134_BOARD_AVERMEDIA_A16D:
327 ir_codes = ir_codes_avermedia_a16d;
328 mask_keycode = 0x02F200;
329 mask_keydown = 0x000400;
330 polling = 50; /* ms */
331 /* Without this we won't receive key up events */
332 saa_setb(SAA7134_GPIO_GPMODE1, 0x1);
333 saa_setb(SAA7134_GPIO_GPSTATUS1, 0x1);
334 break;
326 case SAA7134_BOARD_KWORLD_TERMINATOR: 335 case SAA7134_BOARD_KWORLD_TERMINATOR:
327 ir_codes = ir_codes_pixelview; 336 ir_codes = ir_codes_pixelview;
328 mask_keycode = 0x00001f; 337 mask_keycode = 0x00001f;
diff --git a/drivers/media/video/soc_camera.c b/drivers/media/video/soc_camera.c
index a1b92446c8b4..d015bfe00950 100644
--- a/drivers/media/video/soc_camera.c
+++ b/drivers/media/video/soc_camera.c
@@ -763,15 +763,6 @@ static struct device_driver ic_drv = {
763 .owner = THIS_MODULE, 763 .owner = THIS_MODULE,
764}; 764};
765 765
766/*
767 * Image capture host - this is a host device, not a bus device, so,
768 * no bus reference, no probing.
769 */
770static struct class soc_camera_host_class = {
771 .owner = THIS_MODULE,
772 .name = "camera_host",
773};
774
775static void dummy_release(struct device *dev) 766static void dummy_release(struct device *dev)
776{ 767{
777} 768}
@@ -801,7 +792,6 @@ int soc_camera_host_register(struct soc_camera_host *ici)
801 792
802 /* Number might be equal to the platform device ID */ 793 /* Number might be equal to the platform device ID */
803 sprintf(ici->dev.bus_id, "camera_host%d", ici->nr); 794 sprintf(ici->dev.bus_id, "camera_host%d", ici->nr);
804 ici->dev.class = &soc_camera_host_class;
805 795
806 mutex_lock(&list_lock); 796 mutex_lock(&list_lock);
807 list_for_each_entry(ix, &hosts, list) { 797 list_for_each_entry(ix, &hosts, list) {
@@ -1003,14 +993,9 @@ static int __init soc_camera_init(void)
1003 ret = driver_register(&ic_drv); 993 ret = driver_register(&ic_drv);
1004 if (ret) 994 if (ret)
1005 goto edrvr; 995 goto edrvr;
1006 ret = class_register(&soc_camera_host_class);
1007 if (ret)
1008 goto eclr;
1009 996
1010 return 0; 997 return 0;
1011 998
1012eclr:
1013 driver_unregister(&ic_drv);
1014edrvr: 999edrvr:
1015 bus_unregister(&soc_camera_bus_type); 1000 bus_unregister(&soc_camera_bus_type);
1016 return ret; 1001 return ret;
@@ -1018,7 +1003,6 @@ edrvr:
1018 1003
1019static void __exit soc_camera_exit(void) 1004static void __exit soc_camera_exit(void)
1020{ 1005{
1021 class_unregister(&soc_camera_host_class);
1022 driver_unregister(&ic_drv); 1006 driver_unregister(&ic_drv);
1023 bus_unregister(&soc_camera_bus_type); 1007 bus_unregister(&soc_camera_bus_type);
1024} 1008}
diff --git a/drivers/media/video/uvc/Makefile b/drivers/media/video/uvc/Makefile
new file mode 100644
index 000000000000..968c1994eda0
--- /dev/null
+++ b/drivers/media/video/uvc/Makefile
@@ -0,0 +1,3 @@
1uvcvideo-objs := uvc_driver.o uvc_queue.o uvc_v4l2.o uvc_video.o uvc_ctrl.o \
2 uvc_status.o uvc_isight.o
3obj-$(CONFIG_USB_VIDEO_CLASS) += uvcvideo.o
diff --git a/drivers/media/video/uvc/uvc_ctrl.c b/drivers/media/video/uvc/uvc_ctrl.c
new file mode 100644
index 000000000000..f0ee46d15540
--- /dev/null
+++ b/drivers/media/video/uvc/uvc_ctrl.c
@@ -0,0 +1,1256 @@
1/*
2 * uvc_ctrl.c -- USB Video Class driver - Controls
3 *
4 * Copyright (C) 2005-2008
5 * Laurent Pinchart (laurent.pinchart@skynet.be)
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 */
13
14#include <linux/kernel.h>
15#include <linux/version.h>
16#include <linux/list.h>
17#include <linux/module.h>
18#include <linux/uaccess.h>
19#include <linux/usb.h>
20#include <linux/videodev2.h>
21#include <linux/vmalloc.h>
22#include <linux/wait.h>
23#include <asm/atomic.h>
24
25#include "uvcvideo.h"
26
27#define UVC_CTRL_NDATA 2
28#define UVC_CTRL_DATA_CURRENT 0
29#define UVC_CTRL_DATA_BACKUP 1
30
31/* ------------------------------------------------------------------------
32 * Control, formats, ...
33 */
34
35static struct uvc_control_info uvc_ctrls[] = {
36 {
37 .entity = UVC_GUID_UVC_PROCESSING,
38 .selector = PU_BRIGHTNESS_CONTROL,
39 .index = 0,
40 .size = 2,
41 .flags = UVC_CONTROL_SET_CUR | UVC_CONTROL_GET_RANGE
42 | UVC_CONTROL_RESTORE,
43 },
44 {
45 .entity = UVC_GUID_UVC_PROCESSING,
46 .selector = PU_CONTRAST_CONTROL,
47 .index = 1,
48 .size = 2,
49 .flags = UVC_CONTROL_SET_CUR | UVC_CONTROL_GET_RANGE
50 | UVC_CONTROL_RESTORE,
51 },
52 {
53 .entity = UVC_GUID_UVC_PROCESSING,
54 .selector = PU_HUE_CONTROL,
55 .index = 2,
56 .size = 2,
57 .flags = UVC_CONTROL_SET_CUR | UVC_CONTROL_GET_RANGE
58 | UVC_CONTROL_RESTORE | UVC_CONTROL_AUTO_UPDATE,
59 },
60 {
61 .entity = UVC_GUID_UVC_PROCESSING,
62 .selector = PU_SATURATION_CONTROL,
63 .index = 3,
64 .size = 2,
65 .flags = UVC_CONTROL_SET_CUR | UVC_CONTROL_GET_RANGE
66 | UVC_CONTROL_RESTORE,
67 },
68 {
69 .entity = UVC_GUID_UVC_PROCESSING,
70 .selector = PU_SHARPNESS_CONTROL,
71 .index = 4,
72 .size = 2,
73 .flags = UVC_CONTROL_SET_CUR | UVC_CONTROL_GET_RANGE
74 | UVC_CONTROL_RESTORE,
75 },
76 {
77 .entity = UVC_GUID_UVC_PROCESSING,
78 .selector = PU_GAMMA_CONTROL,
79 .index = 5,
80 .size = 2,
81 .flags = UVC_CONTROL_SET_CUR | UVC_CONTROL_GET_RANGE
82 | UVC_CONTROL_RESTORE,
83 },
84 {
85 .entity = UVC_GUID_UVC_PROCESSING,
86 .selector = PU_BACKLIGHT_COMPENSATION_CONTROL,
87 .index = 8,
88 .size = 2,
89 .flags = UVC_CONTROL_SET_CUR | UVC_CONTROL_GET_RANGE
90 | UVC_CONTROL_RESTORE,
91 },
92 {
93 .entity = UVC_GUID_UVC_PROCESSING,
94 .selector = PU_GAIN_CONTROL,
95 .index = 9,
96 .size = 2,
97 .flags = UVC_CONTROL_SET_CUR | UVC_CONTROL_GET_RANGE
98 | UVC_CONTROL_RESTORE,
99 },
100 {
101 .entity = UVC_GUID_UVC_PROCESSING,
102 .selector = PU_POWER_LINE_FREQUENCY_CONTROL,
103 .index = 10,
104 .size = 1,
105 .flags = UVC_CONTROL_SET_CUR | UVC_CONTROL_GET_RANGE
106 | UVC_CONTROL_RESTORE,
107 },
108 {
109 .entity = UVC_GUID_UVC_PROCESSING,
110 .selector = PU_HUE_AUTO_CONTROL,
111 .index = 11,
112 .size = 1,
113 .flags = UVC_CONTROL_SET_CUR | UVC_CONTROL_GET_CUR
114 | UVC_CONTROL_GET_DEF | UVC_CONTROL_RESTORE,
115 },
116 {
117 .entity = UVC_GUID_UVC_CAMERA,
118 .selector = CT_AE_MODE_CONTROL,
119 .index = 1,
120 .size = 1,
121 .flags = UVC_CONTROL_SET_CUR | UVC_CONTROL_GET_CUR
122 | UVC_CONTROL_GET_DEF | UVC_CONTROL_GET_RES
123 | UVC_CONTROL_RESTORE,
124 },
125 {
126 .entity = UVC_GUID_UVC_CAMERA,
127 .selector = CT_AE_PRIORITY_CONTROL,
128 .index = 2,
129 .size = 1,
130 .flags = UVC_CONTROL_SET_CUR | UVC_CONTROL_GET_CUR
131 | UVC_CONTROL_RESTORE,
132 },
133 {
134 .entity = UVC_GUID_UVC_CAMERA,
135 .selector = CT_EXPOSURE_TIME_ABSOLUTE_CONTROL,
136 .index = 3,
137 .size = 4,
138 .flags = UVC_CONTROL_SET_CUR | UVC_CONTROL_GET_RANGE
139 | UVC_CONTROL_RESTORE,
140 },
141 {
142 .entity = UVC_GUID_UVC_CAMERA,
143 .selector = CT_FOCUS_ABSOLUTE_CONTROL,
144 .index = 5,
145 .size = 2,
146 .flags = UVC_CONTROL_SET_CUR | UVC_CONTROL_GET_RANGE
147 | UVC_CONTROL_RESTORE | UVC_CONTROL_AUTO_UPDATE,
148 },
149 {
150 .entity = UVC_GUID_UVC_CAMERA,
151 .selector = CT_FOCUS_AUTO_CONTROL,
152 .index = 17,
153 .size = 1,
154 .flags = UVC_CONTROL_SET_CUR | UVC_CONTROL_GET_CUR
155 | UVC_CONTROL_GET_DEF | UVC_CONTROL_RESTORE,
156 },
157 {
158 .entity = UVC_GUID_UVC_PROCESSING,
159 .selector = PU_WHITE_BALANCE_TEMPERATURE_AUTO_CONTROL,
160 .index = 12,
161 .size = 1,
162 .flags = UVC_CONTROL_SET_CUR | UVC_CONTROL_GET_CUR
163 | UVC_CONTROL_GET_DEF | UVC_CONTROL_RESTORE,
164 },
165 {
166 .entity = UVC_GUID_UVC_PROCESSING,
167 .selector = PU_WHITE_BALANCE_TEMPERATURE_CONTROL,
168 .index = 6,
169 .size = 2,
170 .flags = UVC_CONTROL_SET_CUR | UVC_CONTROL_GET_RANGE
171 | UVC_CONTROL_RESTORE | UVC_CONTROL_AUTO_UPDATE,
172 },
173 {
174 .entity = UVC_GUID_UVC_PROCESSING,
175 .selector = PU_WHITE_BALANCE_COMPONENT_AUTO_CONTROL,
176 .index = 13,
177 .size = 1,
178 .flags = UVC_CONTROL_SET_CUR | UVC_CONTROL_GET_CUR
179 | UVC_CONTROL_GET_DEF | UVC_CONTROL_RESTORE,
180 },
181 {
182 .entity = UVC_GUID_UVC_PROCESSING,
183 .selector = PU_WHITE_BALANCE_COMPONENT_CONTROL,
184 .index = 7,
185 .size = 4,
186 .flags = UVC_CONTROL_SET_CUR | UVC_CONTROL_GET_RANGE
187 | UVC_CONTROL_RESTORE | UVC_CONTROL_AUTO_UPDATE,
188 },
189};
190
191static struct uvc_menu_info power_line_frequency_controls[] = {
192 { 0, "Disabled" },
193 { 1, "50 Hz" },
194 { 2, "60 Hz" },
195};
196
197static struct uvc_menu_info exposure_auto_controls[] = {
198 { 1, "Manual Mode" },
199 { 2, "Auto Mode" },
200 { 4, "Shutter Priority Mode" },
201 { 8, "Aperture Priority Mode" },
202};
203
204static struct uvc_control_mapping uvc_ctrl_mappings[] = {
205 {
206 .id = V4L2_CID_BRIGHTNESS,
207 .name = "Brightness",
208 .entity = UVC_GUID_UVC_PROCESSING,
209 .selector = PU_BRIGHTNESS_CONTROL,
210 .size = 16,
211 .offset = 0,
212 .v4l2_type = V4L2_CTRL_TYPE_INTEGER,
213 .data_type = UVC_CTRL_DATA_TYPE_SIGNED,
214 },
215 {
216 .id = V4L2_CID_CONTRAST,
217 .name = "Contrast",
218 .entity = UVC_GUID_UVC_PROCESSING,
219 .selector = PU_CONTRAST_CONTROL,
220 .size = 16,
221 .offset = 0,
222 .v4l2_type = V4L2_CTRL_TYPE_INTEGER,
223 .data_type = UVC_CTRL_DATA_TYPE_UNSIGNED,
224 },
225 {
226 .id = V4L2_CID_HUE,
227 .name = "Hue",
228 .entity = UVC_GUID_UVC_PROCESSING,
229 .selector = PU_HUE_CONTROL,
230 .size = 16,
231 .offset = 0,
232 .v4l2_type = V4L2_CTRL_TYPE_INTEGER,
233 .data_type = UVC_CTRL_DATA_TYPE_SIGNED,
234 },
235 {
236 .id = V4L2_CID_SATURATION,
237 .name = "Saturation",
238 .entity = UVC_GUID_UVC_PROCESSING,
239 .selector = PU_SATURATION_CONTROL,
240 .size = 16,
241 .offset = 0,
242 .v4l2_type = V4L2_CTRL_TYPE_INTEGER,
243 .data_type = UVC_CTRL_DATA_TYPE_UNSIGNED,
244 },
245 {
246 .id = V4L2_CID_SHARPNESS,
247 .name = "Sharpness",
248 .entity = UVC_GUID_UVC_PROCESSING,
249 .selector = PU_SHARPNESS_CONTROL,
250 .size = 16,
251 .offset = 0,
252 .v4l2_type = V4L2_CTRL_TYPE_INTEGER,
253 .data_type = UVC_CTRL_DATA_TYPE_UNSIGNED,
254 },
255 {
256 .id = V4L2_CID_GAMMA,
257 .name = "Gamma",
258 .entity = UVC_GUID_UVC_PROCESSING,
259 .selector = PU_GAMMA_CONTROL,
260 .size = 16,
261 .offset = 0,
262 .v4l2_type = V4L2_CTRL_TYPE_INTEGER,
263 .data_type = UVC_CTRL_DATA_TYPE_UNSIGNED,
264 },
265 {
266 .id = V4L2_CID_BACKLIGHT_COMPENSATION,
267 .name = "Backlight Compensation",
268 .entity = UVC_GUID_UVC_PROCESSING,
269 .selector = PU_BACKLIGHT_COMPENSATION_CONTROL,
270 .size = 16,
271 .offset = 0,
272 .v4l2_type = V4L2_CTRL_TYPE_INTEGER,
273 .data_type = UVC_CTRL_DATA_TYPE_UNSIGNED,
274 },
275 {
276 .id = V4L2_CID_GAIN,
277 .name = "Gain",
278 .entity = UVC_GUID_UVC_PROCESSING,
279 .selector = PU_GAIN_CONTROL,
280 .size = 16,
281 .offset = 0,
282 .v4l2_type = V4L2_CTRL_TYPE_INTEGER,
283 .data_type = UVC_CTRL_DATA_TYPE_UNSIGNED,
284 },
285 {
286 .id = V4L2_CID_POWER_LINE_FREQUENCY,
287 .name = "Power Line Frequency",
288 .entity = UVC_GUID_UVC_PROCESSING,
289 .selector = PU_POWER_LINE_FREQUENCY_CONTROL,
290 .size = 2,
291 .offset = 0,
292 .v4l2_type = V4L2_CTRL_TYPE_MENU,
293 .data_type = UVC_CTRL_DATA_TYPE_ENUM,
294 .menu_info = power_line_frequency_controls,
295 .menu_count = ARRAY_SIZE(power_line_frequency_controls),
296 },
297 {
298 .id = V4L2_CID_HUE_AUTO,
299 .name = "Hue, Auto",
300 .entity = UVC_GUID_UVC_PROCESSING,
301 .selector = PU_HUE_AUTO_CONTROL,
302 .size = 1,
303 .offset = 0,
304 .v4l2_type = V4L2_CTRL_TYPE_BOOLEAN,
305 .data_type = UVC_CTRL_DATA_TYPE_BOOLEAN,
306 },
307 {
308 .id = V4L2_CID_EXPOSURE_AUTO,
309 .name = "Exposure, Auto",
310 .entity = UVC_GUID_UVC_CAMERA,
311 .selector = CT_AE_MODE_CONTROL,
312 .size = 4,
313 .offset = 0,
314 .v4l2_type = V4L2_CTRL_TYPE_MENU,
315 .data_type = UVC_CTRL_DATA_TYPE_BITMASK,
316 .menu_info = exposure_auto_controls,
317 .menu_count = ARRAY_SIZE(exposure_auto_controls),
318 },
319 {
320 .id = V4L2_CID_EXPOSURE_AUTO_PRIORITY,
321 .name = "Exposure, Auto Priority",
322 .entity = UVC_GUID_UVC_CAMERA,
323 .selector = CT_AE_PRIORITY_CONTROL,
324 .size = 1,
325 .offset = 0,
326 .v4l2_type = V4L2_CTRL_TYPE_BOOLEAN,
327 .data_type = UVC_CTRL_DATA_TYPE_BOOLEAN,
328 },
329 {
330 .id = V4L2_CID_EXPOSURE_ABSOLUTE,
331 .name = "Exposure (Absolute)",
332 .entity = UVC_GUID_UVC_CAMERA,
333 .selector = CT_EXPOSURE_TIME_ABSOLUTE_CONTROL,
334 .size = 32,
335 .offset = 0,
336 .v4l2_type = V4L2_CTRL_TYPE_INTEGER,
337 .data_type = UVC_CTRL_DATA_TYPE_UNSIGNED,
338 },
339 {
340 .id = V4L2_CID_AUTO_WHITE_BALANCE,
341 .name = "White Balance Temperature, Auto",
342 .entity = UVC_GUID_UVC_PROCESSING,
343 .selector = PU_WHITE_BALANCE_TEMPERATURE_AUTO_CONTROL,
344 .size = 1,
345 .offset = 0,
346 .v4l2_type = V4L2_CTRL_TYPE_BOOLEAN,
347 .data_type = UVC_CTRL_DATA_TYPE_BOOLEAN,
348 },
349 {
350 .id = V4L2_CID_WHITE_BALANCE_TEMPERATURE,
351 .name = "White Balance Temperature",
352 .entity = UVC_GUID_UVC_PROCESSING,
353 .selector = PU_WHITE_BALANCE_TEMPERATURE_CONTROL,
354 .size = 16,
355 .offset = 0,
356 .v4l2_type = V4L2_CTRL_TYPE_INTEGER,
357 .data_type = UVC_CTRL_DATA_TYPE_UNSIGNED,
358 },
359 {
360 .id = V4L2_CID_AUTO_WHITE_BALANCE,
361 .name = "White Balance Component, Auto",
362 .entity = UVC_GUID_UVC_PROCESSING,
363 .selector = PU_WHITE_BALANCE_COMPONENT_AUTO_CONTROL,
364 .size = 1,
365 .offset = 0,
366 .v4l2_type = V4L2_CTRL_TYPE_BOOLEAN,
367 .data_type = UVC_CTRL_DATA_TYPE_BOOLEAN,
368 },
369 {
370 .id = V4L2_CID_BLUE_BALANCE,
371 .name = "White Balance Blue Component",
372 .entity = UVC_GUID_UVC_PROCESSING,
373 .selector = PU_WHITE_BALANCE_COMPONENT_CONTROL,
374 .size = 16,
375 .offset = 0,
376 .v4l2_type = V4L2_CTRL_TYPE_INTEGER,
377 .data_type = UVC_CTRL_DATA_TYPE_SIGNED,
378 },
379 {
380 .id = V4L2_CID_RED_BALANCE,
381 .name = "White Balance Red Component",
382 .entity = UVC_GUID_UVC_PROCESSING,
383 .selector = PU_WHITE_BALANCE_COMPONENT_CONTROL,
384 .size = 16,
385 .offset = 16,
386 .v4l2_type = V4L2_CTRL_TYPE_INTEGER,
387 .data_type = UVC_CTRL_DATA_TYPE_SIGNED,
388 },
389 {
390 .id = V4L2_CID_FOCUS_ABSOLUTE,
391 .name = "Focus (absolute)",
392 .entity = UVC_GUID_UVC_CAMERA,
393 .selector = CT_FOCUS_ABSOLUTE_CONTROL,
394 .size = 16,
395 .offset = 0,
396 .v4l2_type = V4L2_CTRL_TYPE_INTEGER,
397 .data_type = UVC_CTRL_DATA_TYPE_UNSIGNED,
398 },
399 {
400 .id = V4L2_CID_FOCUS_AUTO,
401 .name = "Focus, Auto",
402 .entity = UVC_GUID_UVC_CAMERA,
403 .selector = CT_FOCUS_AUTO_CONTROL,
404 .size = 1,
405 .offset = 0,
406 .v4l2_type = V4L2_CTRL_TYPE_BOOLEAN,
407 .data_type = UVC_CTRL_DATA_TYPE_BOOLEAN,
408 },
409};
410
411/* ------------------------------------------------------------------------
412 * Utility functions
413 */
414
415static inline __u8 *uvc_ctrl_data(struct uvc_control *ctrl, int id)
416{
417 return ctrl->data + id * ctrl->info->size;
418}
419
420static inline int uvc_get_bit(const __u8 *data, int bit)
421{
422 return (data[bit >> 3] >> (bit & 7)) & 1;
423}
424
425/* Extract the bit string specified by mapping->offset and mapping->size
426 * from the little-endian data stored at 'data' and return the result as
427 * a signed 32bit integer. Sign extension will be performed if the mapping
428 * references a signed data type.
429 */
430static __s32 uvc_get_le_value(const __u8 *data,
431 struct uvc_control_mapping *mapping)
432{
433 int bits = mapping->size;
434 int offset = mapping->offset;
435 __s32 value = 0;
436 __u8 mask;
437
438 data += offset / 8;
439 offset &= 7;
440 mask = ((1LL << bits) - 1) << offset;
441
442 for (; bits > 0; data++) {
443 __u8 byte = *data & mask;
444 value |= offset > 0 ? (byte >> offset) : (byte << (-offset));
445 bits -= 8 - (offset > 0 ? offset : 0);
446 offset -= 8;
447 mask = (1 << bits) - 1;
448 }
449
450 /* Sign-extend the value if needed */
451 if (mapping->data_type == UVC_CTRL_DATA_TYPE_SIGNED)
452 value |= -(value & (1 << (mapping->size - 1)));
453
454 return value;
455}
456
457/* Set the bit string specified by mapping->offset and mapping->size
458 * in the little-endian data stored at 'data' to the value 'value'.
459 */
460static void uvc_set_le_value(__s32 value, __u8 *data,
461 struct uvc_control_mapping *mapping)
462{
463 int bits = mapping->size;
464 int offset = mapping->offset;
465 __u8 mask;
466
467 data += offset / 8;
468 offset &= 7;
469
470 for (; bits > 0; data++) {
471 mask = ((1LL << bits) - 1) << offset;
472 *data = (*data & ~mask) | ((value << offset) & mask);
473 value >>= offset ? offset : 8;
474 bits -= 8 - offset;
475 offset = 0;
476 }
477}
478
479/* ------------------------------------------------------------------------
480 * Terminal and unit management
481 */
482
483static const __u8 uvc_processing_guid[16] = UVC_GUID_UVC_PROCESSING;
484static const __u8 uvc_camera_guid[16] = UVC_GUID_UVC_CAMERA;
485static const __u8 uvc_media_transport_input_guid[16] =
486 UVC_GUID_UVC_MEDIA_TRANSPORT_INPUT;
487
488static int uvc_entity_match_guid(struct uvc_entity *entity, __u8 guid[16])
489{
490 switch (UVC_ENTITY_TYPE(entity)) {
491 case ITT_CAMERA:
492 return memcmp(uvc_camera_guid, guid, 16) == 0;
493
494 case ITT_MEDIA_TRANSPORT_INPUT:
495 return memcmp(uvc_media_transport_input_guid, guid, 16) == 0;
496
497 case VC_PROCESSING_UNIT:
498 return memcmp(uvc_processing_guid, guid, 16) == 0;
499
500 case VC_EXTENSION_UNIT:
501 return memcmp(entity->extension.guidExtensionCode,
502 guid, 16) == 0;
503
504 default:
505 return 0;
506 }
507}
508
509/* ------------------------------------------------------------------------
510 * UVC Controls
511 */
512
513static void __uvc_find_control(struct uvc_entity *entity, __u32 v4l2_id,
514 struct uvc_control_mapping **mapping, struct uvc_control **control,
515 int next)
516{
517 struct uvc_control *ctrl;
518 struct uvc_control_mapping *map;
519 unsigned int i;
520
521 if (entity == NULL)
522 return;
523
524 for (i = 0; i < entity->ncontrols; ++i) {
525 ctrl = &entity->controls[i];
526 if (ctrl->info == NULL)
527 continue;
528
529 list_for_each_entry(map, &ctrl->info->mappings, list) {
530 if ((map->id == v4l2_id) && !next) {
531 *control = ctrl;
532 *mapping = map;
533 return;
534 }
535
536 if ((*mapping == NULL || (*mapping)->id > map->id) &&
537 (map->id > v4l2_id) && next) {
538 *control = ctrl;
539 *mapping = map;
540 }
541 }
542 }
543}
544
545struct uvc_control *uvc_find_control(struct uvc_video_device *video,
546 __u32 v4l2_id, struct uvc_control_mapping **mapping)
547{
548 struct uvc_control *ctrl = NULL;
549 struct uvc_entity *entity;
550 int next = v4l2_id & V4L2_CTRL_FLAG_NEXT_CTRL;
551
552 *mapping = NULL;
553
554 /* Mask the query flags. */
555 v4l2_id &= V4L2_CTRL_ID_MASK;
556
557 /* Find the control. */
558 __uvc_find_control(video->processing, v4l2_id, mapping, &ctrl, next);
559 if (ctrl && !next)
560 return ctrl;
561
562 list_for_each_entry(entity, &video->iterms, chain) {
563 __uvc_find_control(entity, v4l2_id, mapping, &ctrl, next);
564 if (ctrl && !next)
565 return ctrl;
566 }
567
568 list_for_each_entry(entity, &video->extensions, chain) {
569 __uvc_find_control(entity, v4l2_id, mapping, &ctrl, next);
570 if (ctrl && !next)
571 return ctrl;
572 }
573
574 if (ctrl == NULL && !next)
575 uvc_trace(UVC_TRACE_CONTROL, "Control 0x%08x not found.\n",
576 v4l2_id);
577
578 return ctrl;
579}
580
581int uvc_query_v4l2_ctrl(struct uvc_video_device *video,
582 struct v4l2_queryctrl *v4l2_ctrl)
583{
584 struct uvc_control *ctrl;
585 struct uvc_control_mapping *mapping;
586 struct uvc_menu_info *menu;
587 unsigned int i;
588 __u8 data[8];
589 int ret;
590
591 ctrl = uvc_find_control(video, v4l2_ctrl->id, &mapping);
592 if (ctrl == NULL)
593 return -EINVAL;
594
595 v4l2_ctrl->id = mapping->id;
596 v4l2_ctrl->type = mapping->v4l2_type;
597 strncpy(v4l2_ctrl->name, mapping->name, sizeof v4l2_ctrl->name);
598 v4l2_ctrl->flags = 0;
599
600 if (!(ctrl->info->flags & UVC_CONTROL_SET_CUR))
601 v4l2_ctrl->flags |= V4L2_CTRL_FLAG_READ_ONLY;
602
603 if (ctrl->info->flags & UVC_CONTROL_GET_DEF) {
604 if ((ret = uvc_query_ctrl(video->dev, GET_DEF, ctrl->entity->id,
605 video->dev->intfnum, ctrl->info->selector,
606 &data, ctrl->info->size)) < 0)
607 return ret;
608 v4l2_ctrl->default_value = uvc_get_le_value(data, mapping);
609 }
610
611 if (mapping->v4l2_type == V4L2_CTRL_TYPE_MENU) {
612 v4l2_ctrl->minimum = 0;
613 v4l2_ctrl->maximum = mapping->menu_count - 1;
614 v4l2_ctrl->step = 1;
615
616 menu = mapping->menu_info;
617 for (i = 0; i < mapping->menu_count; ++i, ++menu) {
618 if (menu->value == v4l2_ctrl->default_value) {
619 v4l2_ctrl->default_value = i;
620 break;
621 }
622 }
623
624 return 0;
625 }
626
627 if (ctrl->info->flags & UVC_CONTROL_GET_MIN) {
628 if ((ret = uvc_query_ctrl(video->dev, GET_MIN, ctrl->entity->id,
629 video->dev->intfnum, ctrl->info->selector,
630 &data, ctrl->info->size)) < 0)
631 return ret;
632 v4l2_ctrl->minimum = uvc_get_le_value(data, mapping);
633 }
634 if (ctrl->info->flags & UVC_CONTROL_GET_MAX) {
635 if ((ret = uvc_query_ctrl(video->dev, GET_MAX, ctrl->entity->id,
636 video->dev->intfnum, ctrl->info->selector,
637 &data, ctrl->info->size)) < 0)
638 return ret;
639 v4l2_ctrl->maximum = uvc_get_le_value(data, mapping);
640 }
641 if (ctrl->info->flags & UVC_CONTROL_GET_RES) {
642 if ((ret = uvc_query_ctrl(video->dev, GET_RES, ctrl->entity->id,
643 video->dev->intfnum, ctrl->info->selector,
644 &data, ctrl->info->size)) < 0)
645 return ret;
646 v4l2_ctrl->step = uvc_get_le_value(data, mapping);
647 }
648
649 return 0;
650}
651
652
653/* --------------------------------------------------------------------------
654 * Control transactions
655 *
656 * To make extended set operations as atomic as the hardware allows, controls
657 * are handled using begin/commit/rollback operations.
658 *
659 * At the beginning of a set request, uvc_ctrl_begin should be called to
660 * initialize the request. This function acquires the control lock.
661 *
662 * When setting a control, the new value is stored in the control data field
663 * at position UVC_CTRL_DATA_CURRENT. The control is then marked as dirty for
664 * later processing. If the UVC and V4L2 control sizes differ, the current
665 * value is loaded from the hardware before storing the new value in the data
666 * field.
667 *
668 * After processing all controls in the transaction, uvc_ctrl_commit or
669 * uvc_ctrl_rollback must be called to apply the pending changes to the
670 * hardware or revert them. When applying changes, all controls marked as
671 * dirty will be modified in the UVC device, and the dirty flag will be
672 * cleared. When reverting controls, the control data field
673 * UVC_CTRL_DATA_CURRENT is reverted to its previous value
674 * (UVC_CTRL_DATA_BACKUP) for all dirty controls. Both functions release the
675 * control lock.
676 */
677int uvc_ctrl_begin(struct uvc_video_device *video)
678{
679 return mutex_lock_interruptible(&video->ctrl_mutex) ? -ERESTARTSYS : 0;
680}
681
682static int uvc_ctrl_commit_entity(struct uvc_device *dev,
683 struct uvc_entity *entity, int rollback)
684{
685 struct uvc_control *ctrl;
686 unsigned int i;
687 int ret;
688
689 if (entity == NULL)
690 return 0;
691
692 for (i = 0; i < entity->ncontrols; ++i) {
693 ctrl = &entity->controls[i];
694 if (ctrl->info == NULL || !ctrl->dirty)
695 continue;
696
697 if (!rollback)
698 ret = uvc_query_ctrl(dev, SET_CUR, ctrl->entity->id,
699 dev->intfnum, ctrl->info->selector,
700 uvc_ctrl_data(ctrl, UVC_CTRL_DATA_CURRENT),
701 ctrl->info->size);
702 else
703 ret = 0;
704
705 if (rollback || ret < 0)
706 memcpy(uvc_ctrl_data(ctrl, UVC_CTRL_DATA_CURRENT),
707 uvc_ctrl_data(ctrl, UVC_CTRL_DATA_BACKUP),
708 ctrl->info->size);
709
710 if ((ctrl->info->flags & UVC_CONTROL_GET_CUR) == 0)
711 ctrl->loaded = 0;
712
713 ctrl->dirty = 0;
714
715 if (ret < 0)
716 return ret;
717 }
718
719 return 0;
720}
721
722int __uvc_ctrl_commit(struct uvc_video_device *video, int rollback)
723{
724 struct uvc_entity *entity;
725 int ret = 0;
726
727 /* Find the control. */
728 ret = uvc_ctrl_commit_entity(video->dev, video->processing, rollback);
729 if (ret < 0)
730 goto done;
731
732 list_for_each_entry(entity, &video->iterms, chain) {
733 ret = uvc_ctrl_commit_entity(video->dev, entity, rollback);
734 if (ret < 0)
735 goto done;
736 }
737
738 list_for_each_entry(entity, &video->extensions, chain) {
739 ret = uvc_ctrl_commit_entity(video->dev, entity, rollback);
740 if (ret < 0)
741 goto done;
742 }
743
744done:
745 mutex_unlock(&video->ctrl_mutex);
746 return ret;
747}
748
749int uvc_ctrl_get(struct uvc_video_device *video,
750 struct v4l2_ext_control *xctrl)
751{
752 struct uvc_control *ctrl;
753 struct uvc_control_mapping *mapping;
754 struct uvc_menu_info *menu;
755 unsigned int i;
756 int ret;
757
758 ctrl = uvc_find_control(video, xctrl->id, &mapping);
759 if (ctrl == NULL || (ctrl->info->flags & UVC_CONTROL_GET_CUR) == 0)
760 return -EINVAL;
761
762 if (!ctrl->loaded) {
763 ret = uvc_query_ctrl(video->dev, GET_CUR, ctrl->entity->id,
764 video->dev->intfnum, ctrl->info->selector,
765 uvc_ctrl_data(ctrl, UVC_CTRL_DATA_CURRENT),
766 ctrl->info->size);
767 if (ret < 0)
768 return ret;
769
770 if ((ctrl->info->flags & UVC_CONTROL_AUTO_UPDATE) == 0)
771 ctrl->loaded = 1;
772 }
773
774 xctrl->value = uvc_get_le_value(
775 uvc_ctrl_data(ctrl, UVC_CTRL_DATA_CURRENT), mapping);
776
777 if (mapping->v4l2_type == V4L2_CTRL_TYPE_MENU) {
778 menu = mapping->menu_info;
779 for (i = 0; i < mapping->menu_count; ++i, ++menu) {
780 if (menu->value == xctrl->value) {
781 xctrl->value = i;
782 break;
783 }
784 }
785 }
786
787 return 0;
788}
789
790int uvc_ctrl_set(struct uvc_video_device *video,
791 struct v4l2_ext_control *xctrl)
792{
793 struct uvc_control *ctrl;
794 struct uvc_control_mapping *mapping;
795 s32 value = xctrl->value;
796 int ret;
797
798 ctrl = uvc_find_control(video, xctrl->id, &mapping);
799 if (ctrl == NULL || (ctrl->info->flags & UVC_CONTROL_SET_CUR) == 0)
800 return -EINVAL;
801
802 if (mapping->v4l2_type == V4L2_CTRL_TYPE_MENU) {
803 if (value < 0 || value >= mapping->menu_count)
804 return -EINVAL;
805 value = mapping->menu_info[value].value;
806 }
807
808 if (!ctrl->loaded && (ctrl->info->size * 8) != mapping->size) {
809 if ((ctrl->info->flags & UVC_CONTROL_GET_CUR) == 0) {
810 memset(uvc_ctrl_data(ctrl, UVC_CTRL_DATA_CURRENT),
811 0, ctrl->info->size);
812 } else {
813 ret = uvc_query_ctrl(video->dev, GET_CUR,
814 ctrl->entity->id, video->dev->intfnum,
815 ctrl->info->selector,
816 uvc_ctrl_data(ctrl, UVC_CTRL_DATA_CURRENT),
817 ctrl->info->size);
818 if (ret < 0)
819 return ret;
820 }
821
822 if ((ctrl->info->flags & UVC_CONTROL_AUTO_UPDATE) == 0)
823 ctrl->loaded = 1;
824 }
825
826 if (!ctrl->dirty) {
827 memcpy(uvc_ctrl_data(ctrl, UVC_CTRL_DATA_BACKUP),
828 uvc_ctrl_data(ctrl, UVC_CTRL_DATA_CURRENT),
829 ctrl->info->size);
830 }
831
832 uvc_set_le_value(value,
833 uvc_ctrl_data(ctrl, UVC_CTRL_DATA_CURRENT), mapping);
834
835 ctrl->dirty = 1;
836 ctrl->modified = 1;
837 return 0;
838}
839
840/* --------------------------------------------------------------------------
841 * Dynamic controls
842 */
843
844int uvc_xu_ctrl_query(struct uvc_video_device *video,
845 struct uvc_xu_control *xctrl, int set)
846{
847 struct uvc_entity *entity;
848 struct uvc_control *ctrl = NULL;
849 unsigned int i, found = 0;
850 __u8 *data;
851 int ret;
852
853 /* Find the extension unit. */
854 list_for_each_entry(entity, &video->extensions, chain) {
855 if (entity->id == xctrl->unit)
856 break;
857 }
858
859 if (entity->id != xctrl->unit) {
860 uvc_trace(UVC_TRACE_CONTROL, "Extension unit %u not found.\n",
861 xctrl->unit);
862 return -EINVAL;
863 }
864
865 /* Find the control. */
866 for (i = 0; i < entity->ncontrols; ++i) {
867 ctrl = &entity->controls[i];
868 if (ctrl->info == NULL)
869 continue;
870
871 if (ctrl->info->selector == xctrl->selector) {
872 found = 1;
873 break;
874 }
875 }
876
877 if (!found) {
878 uvc_trace(UVC_TRACE_CONTROL,
879 "Control " UVC_GUID_FORMAT "/%u not found.\n",
880 UVC_GUID_ARGS(entity->extension.guidExtensionCode),
881 xctrl->selector);
882 return -EINVAL;
883 }
884
885 /* Validate control data size. */
886 if (ctrl->info->size != xctrl->size)
887 return -EINVAL;
888
889 if ((set && !(ctrl->info->flags & UVC_CONTROL_SET_CUR)) ||
890 (!set && !(ctrl->info->flags & UVC_CONTROL_GET_CUR)))
891 return -EINVAL;
892
893 if (mutex_lock_interruptible(&video->ctrl_mutex))
894 return -ERESTARTSYS;
895
896 memcpy(uvc_ctrl_data(ctrl, UVC_CTRL_DATA_BACKUP),
897 uvc_ctrl_data(ctrl, UVC_CTRL_DATA_CURRENT),
898 xctrl->size);
899 data = uvc_ctrl_data(ctrl, UVC_CTRL_DATA_CURRENT);
900
901 if (set && copy_from_user(data, xctrl->data, xctrl->size)) {
902 ret = -EFAULT;
903 goto out;
904 }
905
906 ret = uvc_query_ctrl(video->dev, set ? SET_CUR : GET_CUR, xctrl->unit,
907 video->dev->intfnum, xctrl->selector, data,
908 xctrl->size);
909 if (ret < 0)
910 goto out;
911
912 if (!set && copy_to_user(xctrl->data, data, xctrl->size)) {
913 ret = -EFAULT;
914 goto out;
915 }
916
917out:
918 if (ret)
919 memcpy(uvc_ctrl_data(ctrl, UVC_CTRL_DATA_CURRENT),
920 uvc_ctrl_data(ctrl, UVC_CTRL_DATA_BACKUP),
921 xctrl->size);
922
923 mutex_unlock(&video->ctrl_mutex);
924 return ret;
925}
926
927/* --------------------------------------------------------------------------
928 * Suspend/resume
929 */
930
931/*
932 * Restore control values after resume, skipping controls that haven't been
933 * changed.
934 *
935 * TODO
936 * - Don't restore modified controls that are back to their default value.
937 * - Handle restore order (Auto-Exposure Mode should be restored before
938 * Exposure Time).
939 */
940int uvc_ctrl_resume_device(struct uvc_device *dev)
941{
942 struct uvc_control *ctrl;
943 struct uvc_entity *entity;
944 unsigned int i;
945 int ret;
946
947 /* Walk the entities list and restore controls when possible. */
948 list_for_each_entry(entity, &dev->entities, list) {
949
950 for (i = 0; i < entity->ncontrols; ++i) {
951 ctrl = &entity->controls[i];
952
953 if (ctrl->info == NULL || !ctrl->modified ||
954 (ctrl->info->flags & UVC_CONTROL_RESTORE) == 0)
955 continue;
956
957 printk(KERN_INFO "restoring control " UVC_GUID_FORMAT
958 "/%u/%u\n", UVC_GUID_ARGS(ctrl->info->entity),
959 ctrl->info->index, ctrl->info->selector);
960 ctrl->dirty = 1;
961 }
962
963 ret = uvc_ctrl_commit_entity(dev, entity, 0);
964 if (ret < 0)
965 return ret;
966 }
967
968 return 0;
969}
970
971/* --------------------------------------------------------------------------
972 * Control and mapping handling
973 */
974
975static void uvc_ctrl_add_ctrl(struct uvc_device *dev,
976 struct uvc_control_info *info)
977{
978 struct uvc_entity *entity;
979 struct uvc_control *ctrl = NULL;
980 int ret, found = 0;
981 unsigned int i;
982
983 list_for_each_entry(entity, &dev->entities, list) {
984 if (!uvc_entity_match_guid(entity, info->entity))
985 continue;
986
987 for (i = 0; i < entity->ncontrols; ++i) {
988 ctrl = &entity->controls[i];
989 if (ctrl->index == info->index) {
990 found = 1;
991 break;
992 }
993 }
994
995 if (found)
996 break;
997 }
998
999 if (!found)
1000 return;
1001
1002 if (UVC_ENTITY_TYPE(entity) == VC_EXTENSION_UNIT) {
1003 /* Check if the device control information and length match
1004 * the user supplied information.
1005 */
1006 __u32 flags;
1007 __le16 size;
1008 __u8 inf;
1009
1010 if ((ret = uvc_query_ctrl(dev, GET_LEN, ctrl->entity->id,
1011 dev->intfnum, info->selector, (__u8 *)&size, 2)) < 0) {
1012 uvc_trace(UVC_TRACE_CONTROL, "GET_LEN failed on "
1013 "control " UVC_GUID_FORMAT "/%u (%d).\n",
1014 UVC_GUID_ARGS(info->entity), info->selector,
1015 ret);
1016 return;
1017 }
1018
1019 if (info->size != le16_to_cpu(size)) {
1020 uvc_trace(UVC_TRACE_CONTROL, "Control " UVC_GUID_FORMAT
1021 "/%u size doesn't match user supplied "
1022 "value.\n", UVC_GUID_ARGS(info->entity),
1023 info->selector);
1024 return;
1025 }
1026
1027 if ((ret = uvc_query_ctrl(dev, GET_INFO, ctrl->entity->id,
1028 dev->intfnum, info->selector, &inf, 1)) < 0) {
1029 uvc_trace(UVC_TRACE_CONTROL, "GET_INFO failed on "
1030 "control " UVC_GUID_FORMAT "/%u (%d).\n",
1031 UVC_GUID_ARGS(info->entity), info->selector,
1032 ret);
1033 return;
1034 }
1035
1036 flags = info->flags;
1037 if (((flags & UVC_CONTROL_GET_CUR) && !(inf & (1 << 0))) ||
1038 ((flags & UVC_CONTROL_SET_CUR) && !(inf & (1 << 1)))) {
1039 uvc_trace(UVC_TRACE_CONTROL, "Control "
1040 UVC_GUID_FORMAT "/%u flags don't match "
1041 "supported operations.\n",
1042 UVC_GUID_ARGS(info->entity), info->selector);
1043 return;
1044 }
1045 }
1046
1047 ctrl->info = info;
1048 ctrl->data = kmalloc(ctrl->info->size * UVC_CTRL_NDATA, GFP_KERNEL);
1049 uvc_trace(UVC_TRACE_CONTROL, "Added control " UVC_GUID_FORMAT "/%u "
1050 "to device %s entity %u\n", UVC_GUID_ARGS(ctrl->info->entity),
1051 ctrl->info->selector, dev->udev->devpath, entity->id);
1052}
1053
1054/*
1055 * Add an item to the UVC control information list, and instantiate a control
1056 * structure for each device that supports the control.
1057 */
1058int uvc_ctrl_add_info(struct uvc_control_info *info)
1059{
1060 struct uvc_control_info *ctrl;
1061 struct uvc_device *dev;
1062 int ret = 0;
1063
1064 /* Find matching controls by walking the devices, entities and
1065 * controls list.
1066 */
1067 mutex_lock(&uvc_driver.ctrl_mutex);
1068
1069 /* First check if the list contains a control matching the new one.
1070 * Bail out if it does.
1071 */
1072 list_for_each_entry(ctrl, &uvc_driver.controls, list) {
1073 if (memcmp(ctrl->entity, info->entity, 16))
1074 continue;
1075
1076 if (ctrl->selector == info->selector) {
1077 uvc_trace(UVC_TRACE_CONTROL, "Control "
1078 UVC_GUID_FORMAT "/%u is already defined.\n",
1079 UVC_GUID_ARGS(info->entity), info->selector);
1080 ret = -EEXIST;
1081 goto end;
1082 }
1083 if (ctrl->index == info->index) {
1084 uvc_trace(UVC_TRACE_CONTROL, "Control "
1085 UVC_GUID_FORMAT "/%u would overwrite index "
1086 "%d.\n", UVC_GUID_ARGS(info->entity),
1087 info->selector, info->index);
1088 ret = -EEXIST;
1089 goto end;
1090 }
1091 }
1092
1093 list_for_each_entry(dev, &uvc_driver.devices, list)
1094 uvc_ctrl_add_ctrl(dev, info);
1095
1096 INIT_LIST_HEAD(&info->mappings);
1097 list_add_tail(&info->list, &uvc_driver.controls);
1098end:
1099 mutex_unlock(&uvc_driver.ctrl_mutex);
1100 return ret;
1101}
1102
1103int uvc_ctrl_add_mapping(struct uvc_control_mapping *mapping)
1104{
1105 struct uvc_control_info *info;
1106 struct uvc_control_mapping *map;
1107 int ret = -EINVAL;
1108
1109 if (mapping->id & ~V4L2_CTRL_ID_MASK) {
1110 uvc_trace(UVC_TRACE_CONTROL, "Can't add mapping '%s' with "
1111 "invalid control id 0x%08x\n", mapping->name,
1112 mapping->id);
1113 return -EINVAL;
1114 }
1115
1116 mutex_lock(&uvc_driver.ctrl_mutex);
1117 list_for_each_entry(info, &uvc_driver.controls, list) {
1118 if (memcmp(info->entity, mapping->entity, 16) ||
1119 info->selector != mapping->selector)
1120 continue;
1121
1122 if (info->size * 8 < mapping->size + mapping->offset) {
1123 uvc_trace(UVC_TRACE_CONTROL, "Mapping '%s' would "
1124 "overflow control " UVC_GUID_FORMAT "/%u\n",
1125 mapping->name, UVC_GUID_ARGS(info->entity),
1126 info->selector);
1127 ret = -EOVERFLOW;
1128 goto end;
1129 }
1130
1131 /* Check if the list contains a mapping matching the new one.
1132 * Bail out if it does.
1133 */
1134 list_for_each_entry(map, &info->mappings, list) {
1135 if (map->id == mapping->id) {
1136 uvc_trace(UVC_TRACE_CONTROL, "Mapping '%s' is "
1137 "already defined.\n", mapping->name);
1138 ret = -EEXIST;
1139 goto end;
1140 }
1141 }
1142
1143 mapping->ctrl = info;
1144 list_add_tail(&mapping->list, &info->mappings);
1145 uvc_trace(UVC_TRACE_CONTROL, "Adding mapping %s to control "
1146 UVC_GUID_FORMAT "/%u.\n", mapping->name,
1147 UVC_GUID_ARGS(info->entity), info->selector);
1148
1149 ret = 0;
1150 break;
1151 }
1152end:
1153 mutex_unlock(&uvc_driver.ctrl_mutex);
1154 return ret;
1155}
1156
1157/*
1158 * Initialize device controls.
1159 */
1160int uvc_ctrl_init_device(struct uvc_device *dev)
1161{
1162 struct uvc_control_info *info;
1163 struct uvc_control *ctrl;
1164 struct uvc_entity *entity;
1165 unsigned int i;
1166
1167 /* Walk the entities list and instantiate controls */
1168 list_for_each_entry(entity, &dev->entities, list) {
1169 unsigned int bControlSize = 0, ncontrols = 0;
1170 __u8 *bmControls = NULL;
1171
1172 if (UVC_ENTITY_TYPE(entity) == VC_EXTENSION_UNIT) {
1173 bmControls = entity->extension.bmControls;
1174 bControlSize = entity->extension.bControlSize;
1175 } else if (UVC_ENTITY_TYPE(entity) == VC_PROCESSING_UNIT) {
1176 bmControls = entity->processing.bmControls;
1177 bControlSize = entity->processing.bControlSize;
1178 } else if (UVC_ENTITY_TYPE(entity) == ITT_CAMERA) {
1179 bmControls = entity->camera.bmControls;
1180 bControlSize = entity->camera.bControlSize;
1181 }
1182
1183 for (i = 0; i < bControlSize; ++i)
1184 ncontrols += hweight8(bmControls[i]);
1185
1186 if (ncontrols == 0)
1187 continue;
1188
1189 entity->controls = kzalloc(ncontrols*sizeof *ctrl, GFP_KERNEL);
1190 if (entity->controls == NULL)
1191 return -ENOMEM;
1192
1193 entity->ncontrols = ncontrols;
1194
1195 ctrl = entity->controls;
1196 for (i = 0; i < bControlSize * 8; ++i) {
1197 if (uvc_get_bit(bmControls, i) == 0)
1198 continue;
1199
1200 ctrl->entity = entity;
1201 ctrl->index = i;
1202 ctrl++;
1203 }
1204 }
1205
1206 /* Walk the controls info list and associate them with the device
1207 * controls, then add the device to the global device list. This has
1208 * to be done while holding the controls lock, to make sure
1209 * uvc_ctrl_add_info() will not get called in-between.
1210 */
1211 mutex_lock(&uvc_driver.ctrl_mutex);
1212 list_for_each_entry(info, &uvc_driver.controls, list)
1213 uvc_ctrl_add_ctrl(dev, info);
1214
1215 list_add_tail(&dev->list, &uvc_driver.devices);
1216 mutex_unlock(&uvc_driver.ctrl_mutex);
1217
1218 return 0;
1219}
1220
1221/*
1222 * Cleanup device controls.
1223 */
1224void uvc_ctrl_cleanup_device(struct uvc_device *dev)
1225{
1226 struct uvc_entity *entity;
1227 unsigned int i;
1228
1229 /* Remove the device from the global devices list */
1230 mutex_lock(&uvc_driver.ctrl_mutex);
1231 if (dev->list.next != NULL)
1232 list_del(&dev->list);
1233 mutex_unlock(&uvc_driver.ctrl_mutex);
1234
1235 list_for_each_entry(entity, &dev->entities, list) {
1236 for (i = 0; i < entity->ncontrols; ++i)
1237 kfree(entity->controls[i].data);
1238
1239 kfree(entity->controls);
1240 }
1241}
1242
1243void uvc_ctrl_init(void)
1244{
1245 struct uvc_control_info *ctrl = uvc_ctrls;
1246 struct uvc_control_info *cend = ctrl + ARRAY_SIZE(uvc_ctrls);
1247 struct uvc_control_mapping *mapping = uvc_ctrl_mappings;
1248 struct uvc_control_mapping *mend =
1249 mapping + ARRAY_SIZE(uvc_ctrl_mappings);
1250
1251 for (; ctrl < cend; ++ctrl)
1252 uvc_ctrl_add_info(ctrl);
1253
1254 for (; mapping < mend; ++mapping)
1255 uvc_ctrl_add_mapping(mapping);
1256}
diff --git a/drivers/media/video/uvc/uvc_driver.c b/drivers/media/video/uvc/uvc_driver.c
new file mode 100644
index 000000000000..60ced589f898
--- /dev/null
+++ b/drivers/media/video/uvc/uvc_driver.c
@@ -0,0 +1,1955 @@
1/*
2 * uvc_driver.c -- USB Video Class driver
3 *
4 * Copyright (C) 2005-2008
5 * Laurent Pinchart (laurent.pinchart@skynet.be)
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 */
13
14/*
15 * This driver aims to support video input devices compliant with the 'USB
16 * Video Class' specification.
17 *
18 * The driver doesn't support the deprecated v4l1 interface. It implements the
19 * mmap capture method only, and doesn't do any image format conversion in
20 * software. If your user-space application doesn't support YUYV or MJPEG, fix
21 * it :-). Please note that the MJPEG data have been stripped from their
22 * Huffman tables (DHT marker), you will need to add it back if your JPEG
23 * codec can't handle MJPEG data.
24 */
25
26#include <linux/kernel.h>
27#include <linux/version.h>
28#include <linux/list.h>
29#include <linux/module.h>
30#include <linux/usb.h>
31#include <linux/videodev2.h>
32#include <linux/vmalloc.h>
33#include <linux/wait.h>
34#include <asm/atomic.h>
35
36#include <media/v4l2-common.h>
37
38#include "uvcvideo.h"
39
40#define DRIVER_AUTHOR "Laurent Pinchart <laurent.pinchart@skynet.be>"
41#define DRIVER_DESC "USB Video Class driver"
42#ifndef DRIVER_VERSION
43#define DRIVER_VERSION "v0.1.0"
44#endif
45
46static unsigned int uvc_quirks_param;
47unsigned int uvc_trace_param;
48
49/* ------------------------------------------------------------------------
50 * Control, formats, ...
51 */
52
53static struct uvc_format_desc uvc_fmts[] = {
54 {
55 .name = "YUV 4:2:2 (YUYV)",
56 .guid = UVC_GUID_FORMAT_YUY2,
57 .fcc = V4L2_PIX_FMT_YUYV,
58 },
59 {
60 .name = "YUV 4:2:0 (NV12)",
61 .guid = UVC_GUID_FORMAT_NV12,
62 .fcc = V4L2_PIX_FMT_NV12,
63 },
64 {
65 .name = "MJPEG",
66 .guid = UVC_GUID_FORMAT_MJPEG,
67 .fcc = V4L2_PIX_FMT_MJPEG,
68 },
69 {
70 .name = "YVU 4:2:0 (YV12)",
71 .guid = UVC_GUID_FORMAT_YV12,
72 .fcc = V4L2_PIX_FMT_YVU420,
73 },
74 {
75 .name = "YUV 4:2:0 (I420)",
76 .guid = UVC_GUID_FORMAT_I420,
77 .fcc = V4L2_PIX_FMT_YUV420,
78 },
79 {
80 .name = "YUV 4:2:2 (UYVY)",
81 .guid = UVC_GUID_FORMAT_UYVY,
82 .fcc = V4L2_PIX_FMT_UYVY,
83 },
84 {
85 .name = "Greyscale",
86 .guid = UVC_GUID_FORMAT_Y800,
87 .fcc = V4L2_PIX_FMT_GREY,
88 },
89 {
90 .name = "RGB Bayer",
91 .guid = UVC_GUID_FORMAT_BY8,
92 .fcc = V4L2_PIX_FMT_SBGGR8,
93 },
94};
95
96/* ------------------------------------------------------------------------
97 * Utility functions
98 */
99
100struct usb_host_endpoint *uvc_find_endpoint(struct usb_host_interface *alts,
101 __u8 epaddr)
102{
103 struct usb_host_endpoint *ep;
104 unsigned int i;
105
106 for (i = 0; i < alts->desc.bNumEndpoints; ++i) {
107 ep = &alts->endpoint[i];
108 if (ep->desc.bEndpointAddress == epaddr)
109 return ep;
110 }
111
112 return NULL;
113}
114
115static struct uvc_format_desc *uvc_format_by_guid(const __u8 guid[16])
116{
117 unsigned int len = ARRAY_SIZE(uvc_fmts);
118 unsigned int i;
119
120 for (i = 0; i < len; ++i) {
121 if (memcmp(guid, uvc_fmts[i].guid, 16) == 0)
122 return &uvc_fmts[i];
123 }
124
125 return NULL;
126}
127
128static __u32 uvc_colorspace(const __u8 primaries)
129{
130 static const __u8 colorprimaries[] = {
131 0,
132 V4L2_COLORSPACE_SRGB,
133 V4L2_COLORSPACE_470_SYSTEM_M,
134 V4L2_COLORSPACE_470_SYSTEM_BG,
135 V4L2_COLORSPACE_SMPTE170M,
136 V4L2_COLORSPACE_SMPTE240M,
137 };
138
139 if (primaries < ARRAY_SIZE(colorprimaries))
140 return colorprimaries[primaries];
141
142 return 0;
143}
144
145/* Simplify a fraction using a simple continued fraction decomposition. The
146 * idea here is to convert fractions such as 333333/10000000 to 1/30 using
147 * 32 bit arithmetic only. The algorithm is not perfect and relies upon two
148 * arbitrary parameters to remove non-significative terms from the simple
149 * continued fraction decomposition. Using 8 and 333 for n_terms and threshold
150 * respectively seems to give nice results.
151 */
152void uvc_simplify_fraction(uint32_t *numerator, uint32_t *denominator,
153 unsigned int n_terms, unsigned int threshold)
154{
155 uint32_t *an;
156 uint32_t x, y, r;
157 unsigned int i, n;
158
159 an = kmalloc(n_terms * sizeof *an, GFP_KERNEL);
160 if (an == NULL)
161 return;
162
163 /* Convert the fraction to a simple continued fraction. See
164 * http://mathforum.org/dr.math/faq/faq.fractions.html
165 * Stop if the current term is bigger than or equal to the given
166 * threshold.
167 */
168 x = *numerator;
169 y = *denominator;
170
171 for (n = 0; n < n_terms && y != 0; ++n) {
172 an[n] = x / y;
173 if (an[n] >= threshold) {
174 if (n < 2)
175 n++;
176 break;
177 }
178
179 r = x - an[n] * y;
180 x = y;
181 y = r;
182 }
183
184 /* Expand the simple continued fraction back to an integer fraction. */
185 x = 0;
186 y = 1;
187
188 for (i = n; i > 0; --i) {
189 r = y;
190 y = an[i-1] * y + x;
191 x = r;
192 }
193
194 *numerator = y;
195 *denominator = x;
196 kfree(an);
197}
198
199/* Convert a fraction to a frame interval in 100ns multiples. The idea here is
200 * to compute numerator / denominator * 10000000 using 32 bit fixed point
201 * arithmetic only.
202 */
203uint32_t uvc_fraction_to_interval(uint32_t numerator, uint32_t denominator)
204{
205 uint32_t multiplier;
206
207 /* Saturate the result if the operation would overflow. */
208 if (denominator == 0 ||
209 numerator/denominator >= ((uint32_t)-1)/10000000)
210 return (uint32_t)-1;
211
212 /* Divide both the denominator and the multiplier by two until
213 * numerator * multiplier doesn't overflow. If anyone knows a better
214 * algorithm please let me know.
215 */
216 multiplier = 10000000;
217 while (numerator > ((uint32_t)-1)/multiplier) {
218 multiplier /= 2;
219 denominator /= 2;
220 }
221
222 return denominator ? numerator * multiplier / denominator : 0;
223}
224
225/* ------------------------------------------------------------------------
226 * Terminal and unit management
227 */
228
229static struct uvc_entity *uvc_entity_by_id(struct uvc_device *dev, int id)
230{
231 struct uvc_entity *entity;
232
233 list_for_each_entry(entity, &dev->entities, list) {
234 if (entity->id == id)
235 return entity;
236 }
237
238 return NULL;
239}
240
241static struct uvc_entity *uvc_entity_by_reference(struct uvc_device *dev,
242 int id, struct uvc_entity *entity)
243{
244 unsigned int i;
245
246 if (entity == NULL)
247 entity = list_entry(&dev->entities, struct uvc_entity, list);
248
249 list_for_each_entry_continue(entity, &dev->entities, list) {
250 switch (UVC_ENTITY_TYPE(entity)) {
251 case TT_STREAMING:
252 if (entity->output.bSourceID == id)
253 return entity;
254 break;
255
256 case VC_PROCESSING_UNIT:
257 if (entity->processing.bSourceID == id)
258 return entity;
259 break;
260
261 case VC_SELECTOR_UNIT:
262 for (i = 0; i < entity->selector.bNrInPins; ++i)
263 if (entity->selector.baSourceID[i] == id)
264 return entity;
265 break;
266
267 case VC_EXTENSION_UNIT:
268 for (i = 0; i < entity->extension.bNrInPins; ++i)
269 if (entity->extension.baSourceID[i] == id)
270 return entity;
271 break;
272 }
273 }
274
275 return NULL;
276}
277
278/* ------------------------------------------------------------------------
279 * Descriptors handling
280 */
281
282static int uvc_parse_format(struct uvc_device *dev,
283 struct uvc_streaming *streaming, struct uvc_format *format,
284 __u32 **intervals, unsigned char *buffer, int buflen)
285{
286 struct usb_interface *intf = streaming->intf;
287 struct usb_host_interface *alts = intf->cur_altsetting;
288 struct uvc_format_desc *fmtdesc;
289 struct uvc_frame *frame;
290 const unsigned char *start = buffer;
291 unsigned int interval;
292 unsigned int i, n;
293 __u8 ftype;
294
295 format->type = buffer[2];
296 format->index = buffer[3];
297
298 switch (buffer[2]) {
299 case VS_FORMAT_UNCOMPRESSED:
300 case VS_FORMAT_FRAME_BASED:
301 if (buflen < 27) {
302 uvc_trace(UVC_TRACE_DESCR, "device %d videostreaming"
303 "interface %d FORMAT error\n",
304 dev->udev->devnum,
305 alts->desc.bInterfaceNumber);
306 return -EINVAL;
307 }
308
309 /* Find the format descriptor from its GUID. */
310 fmtdesc = uvc_format_by_guid(&buffer[5]);
311
312 if (fmtdesc != NULL) {
313 strncpy(format->name, fmtdesc->name,
314 sizeof format->name);
315 format->fcc = fmtdesc->fcc;
316 } else {
317 uvc_printk(KERN_INFO, "Unknown video format "
318 UVC_GUID_FORMAT "\n",
319 UVC_GUID_ARGS(&buffer[5]));
320 snprintf(format->name, sizeof format->name,
321 UVC_GUID_FORMAT, UVC_GUID_ARGS(&buffer[5]));
322 format->fcc = 0;
323 }
324
325 format->bpp = buffer[21];
326 if (buffer[2] == VS_FORMAT_UNCOMPRESSED) {
327 ftype = VS_FRAME_UNCOMPRESSED;
328 } else {
329 ftype = VS_FRAME_FRAME_BASED;
330 if (buffer[27])
331 format->flags = UVC_FMT_FLAG_COMPRESSED;
332 }
333 break;
334
335 case VS_FORMAT_MJPEG:
336 if (buflen < 11) {
337 uvc_trace(UVC_TRACE_DESCR, "device %d videostreaming"
338 "interface %d FORMAT error\n",
339 dev->udev->devnum,
340 alts->desc.bInterfaceNumber);
341 return -EINVAL;
342 }
343
344 strncpy(format->name, "MJPEG", sizeof format->name);
345 format->fcc = V4L2_PIX_FMT_MJPEG;
346 format->flags = UVC_FMT_FLAG_COMPRESSED;
347 format->bpp = 0;
348 ftype = VS_FRAME_MJPEG;
349 break;
350
351 case VS_FORMAT_DV:
352 if (buflen < 9) {
353 uvc_trace(UVC_TRACE_DESCR, "device %d videostreaming"
354 "interface %d FORMAT error\n",
355 dev->udev->devnum,
356 alts->desc.bInterfaceNumber);
357 return -EINVAL;
358 }
359
360 switch (buffer[8] & 0x7f) {
361 case 0:
362 strncpy(format->name, "SD-DV", sizeof format->name);
363 break;
364 case 1:
365 strncpy(format->name, "SDL-DV", sizeof format->name);
366 break;
367 case 2:
368 strncpy(format->name, "HD-DV", sizeof format->name);
369 break;
370 default:
371 uvc_trace(UVC_TRACE_DESCR, "device %d videostreaming"
372 "interface %d: unknown DV format %u\n",
373 dev->udev->devnum,
374 alts->desc.bInterfaceNumber, buffer[8]);
375 return -EINVAL;
376 }
377
378 strncat(format->name, buffer[8] & (1 << 7) ? " 60Hz" : " 50Hz",
379 sizeof format->name);
380
381 format->fcc = V4L2_PIX_FMT_DV;
382 format->flags = UVC_FMT_FLAG_COMPRESSED | UVC_FMT_FLAG_STREAM;
383 format->bpp = 0;
384 ftype = 0;
385
386 /* Create a dummy frame descriptor. */
387 frame = &format->frame[0];
388 memset(&format->frame[0], 0, sizeof format->frame[0]);
389 frame->bFrameIntervalType = 1;
390 frame->dwDefaultFrameInterval = 1;
391 frame->dwFrameInterval = *intervals;
392 *(*intervals)++ = 1;
393 format->nframes = 1;
394 break;
395
396 case VS_FORMAT_MPEG2TS:
397 case VS_FORMAT_STREAM_BASED:
398 /* Not supported yet. */
399 default:
400 uvc_trace(UVC_TRACE_DESCR, "device %d videostreaming"
401 "interface %d unsupported format %u\n",
402 dev->udev->devnum, alts->desc.bInterfaceNumber,
403 buffer[2]);
404 return -EINVAL;
405 }
406
407 uvc_trace(UVC_TRACE_DESCR, "Found format %s.\n", format->name);
408
409 buflen -= buffer[0];
410 buffer += buffer[0];
411
412 /* Parse the frame descriptors. Only uncompressed, MJPEG and frame
413 * based formats have frame descriptors.
414 */
415 while (buflen > 2 && buffer[2] == ftype) {
416 frame = &format->frame[format->nframes];
417
418 if (ftype != VS_FRAME_FRAME_BASED)
419 n = buflen > 25 ? buffer[25] : 0;
420 else
421 n = buflen > 21 ? buffer[21] : 0;
422
423 n = n ? n : 3;
424
425 if (buflen < 26 + 4*n) {
426 uvc_trace(UVC_TRACE_DESCR, "device %d videostreaming"
427 "interface %d FRAME error\n", dev->udev->devnum,
428 alts->desc.bInterfaceNumber);
429 return -EINVAL;
430 }
431
432 frame->bFrameIndex = buffer[3];
433 frame->bmCapabilities = buffer[4];
434 frame->wWidth = le16_to_cpup((__le16 *)&buffer[5]);
435 frame->wHeight = le16_to_cpup((__le16 *)&buffer[7]);
436 frame->dwMinBitRate = le32_to_cpup((__le32 *)&buffer[9]);
437 frame->dwMaxBitRate = le32_to_cpup((__le32 *)&buffer[13]);
438 if (ftype != VS_FRAME_FRAME_BASED) {
439 frame->dwMaxVideoFrameBufferSize =
440 le32_to_cpup((__le32 *)&buffer[17]);
441 frame->dwDefaultFrameInterval =
442 le32_to_cpup((__le32 *)&buffer[21]);
443 frame->bFrameIntervalType = buffer[25];
444 } else {
445 frame->dwMaxVideoFrameBufferSize = 0;
446 frame->dwDefaultFrameInterval =
447 le32_to_cpup((__le32 *)&buffer[17]);
448 frame->bFrameIntervalType = buffer[21];
449 }
450 frame->dwFrameInterval = *intervals;
451
452 /* Several UVC chipsets screw up dwMaxVideoFrameBufferSize
453 * completely. Observed behaviours range from setting the
454 * value to 1.1x the actual frame size of hardwiring the
455 * 16 low bits to 0. This results in a higher than necessary
456 * memory usage as well as a wrong image size information. For
457 * uncompressed formats this can be fixed by computing the
458 * value from the frame size.
459 */
460 if (!(format->flags & UVC_FMT_FLAG_COMPRESSED))
461 frame->dwMaxVideoFrameBufferSize = format->bpp
462 * frame->wWidth * frame->wHeight / 8;
463
464 /* Some bogus devices report dwMinFrameInterval equal to
465 * dwMaxFrameInterval and have dwFrameIntervalStep set to
466 * zero. Setting all null intervals to 1 fixes the problem and
467 * some other divisions by zero which could happen.
468 */
469 for (i = 0; i < n; ++i) {
470 interval = le32_to_cpup((__le32 *)&buffer[26+4*i]);
471 *(*intervals)++ = interval ? interval : 1;
472 }
473
474 /* Make sure that the default frame interval stays between
475 * the boundaries.
476 */
477 n -= frame->bFrameIntervalType ? 1 : 2;
478 frame->dwDefaultFrameInterval =
479 min(frame->dwFrameInterval[n],
480 max(frame->dwFrameInterval[0],
481 frame->dwDefaultFrameInterval));
482
483 uvc_trace(UVC_TRACE_DESCR, "- %ux%u (%u.%u fps)\n",
484 frame->wWidth, frame->wHeight,
485 10000000/frame->dwDefaultFrameInterval,
486 (100000000/frame->dwDefaultFrameInterval)%10);
487
488 format->nframes++;
489 buflen -= buffer[0];
490 buffer += buffer[0];
491 }
492
493 if (buflen > 2 && buffer[2] == VS_STILL_IMAGE_FRAME) {
494 buflen -= buffer[0];
495 buffer += buffer[0];
496 }
497
498 if (buflen > 2 && buffer[2] == VS_COLORFORMAT) {
499 if (buflen < 6) {
500 uvc_trace(UVC_TRACE_DESCR, "device %d videostreaming"
501 "interface %d COLORFORMAT error\n",
502 dev->udev->devnum,
503 alts->desc.bInterfaceNumber);
504 return -EINVAL;
505 }
506
507 format->colorspace = uvc_colorspace(buffer[3]);
508
509 buflen -= buffer[0];
510 buffer += buffer[0];
511 }
512
513 return buffer - start;
514}
515
516static int uvc_parse_streaming(struct uvc_device *dev,
517 struct usb_interface *intf)
518{
519 struct uvc_streaming *streaming = NULL;
520 struct uvc_format *format;
521 struct uvc_frame *frame;
522 struct usb_host_interface *alts = &intf->altsetting[0];
523 unsigned char *_buffer, *buffer = alts->extra;
524 int _buflen, buflen = alts->extralen;
525 unsigned int nformats = 0, nframes = 0, nintervals = 0;
526 unsigned int size, i, n, p;
527 __u32 *interval;
528 __u16 psize;
529 int ret = -EINVAL;
530
531 if (intf->cur_altsetting->desc.bInterfaceSubClass
532 != SC_VIDEOSTREAMING) {
533 uvc_trace(UVC_TRACE_DESCR, "device %d interface %d isn't a "
534 "video streaming interface\n", dev->udev->devnum,
535 intf->altsetting[0].desc.bInterfaceNumber);
536 return -EINVAL;
537 }
538
539 if (usb_driver_claim_interface(&uvc_driver.driver, intf, dev)) {
540 uvc_trace(UVC_TRACE_DESCR, "device %d interface %d is already "
541 "claimed\n", dev->udev->devnum,
542 intf->altsetting[0].desc.bInterfaceNumber);
543 return -EINVAL;
544 }
545
546 streaming = kzalloc(sizeof *streaming, GFP_KERNEL);
547 if (streaming == NULL) {
548 usb_driver_release_interface(&uvc_driver.driver, intf);
549 return -EINVAL;
550 }
551
552 mutex_init(&streaming->mutex);
553 streaming->intf = usb_get_intf(intf);
554 streaming->intfnum = intf->cur_altsetting->desc.bInterfaceNumber;
555
556 /* The Pico iMage webcam has its class-specific interface descriptors
557 * after the endpoint descriptors.
558 */
559 if (buflen == 0) {
560 for (i = 0; i < alts->desc.bNumEndpoints; ++i) {
561 struct usb_host_endpoint *ep = &alts->endpoint[i];
562
563 if (ep->extralen == 0)
564 continue;
565
566 if (ep->extralen > 2 &&
567 ep->extra[1] == USB_DT_CS_INTERFACE) {
568 uvc_trace(UVC_TRACE_DESCR, "trying extra data "
569 "from endpoint %u.\n", i);
570 buffer = alts->endpoint[i].extra;
571 buflen = alts->endpoint[i].extralen;
572 break;
573 }
574 }
575 }
576
577 /* Skip the standard interface descriptors. */
578 while (buflen > 2 && buffer[1] != USB_DT_CS_INTERFACE) {
579 buflen -= buffer[0];
580 buffer += buffer[0];
581 }
582
583 if (buflen <= 2) {
584 uvc_trace(UVC_TRACE_DESCR, "no class-specific streaming "
585 "interface descriptors found.\n");
586 goto error;
587 }
588
589 /* Parse the header descriptor. */
590 if (buffer[2] == VS_OUTPUT_HEADER) {
591 uvc_trace(UVC_TRACE_DESCR, "device %d videostreaming interface "
592 "%d OUTPUT HEADER descriptor is not supported.\n",
593 dev->udev->devnum, alts->desc.bInterfaceNumber);
594 goto error;
595 } else if (buffer[2] == VS_INPUT_HEADER) {
596 p = buflen >= 5 ? buffer[3] : 0;
597 n = buflen >= 12 ? buffer[12] : 0;
598
599 if (buflen < 13 + p*n || buffer[2] != VS_INPUT_HEADER) {
600 uvc_trace(UVC_TRACE_DESCR, "device %d videostreaming "
601 "interface %d INPUT HEADER descriptor is "
602 "invalid.\n", dev->udev->devnum,
603 alts->desc.bInterfaceNumber);
604 goto error;
605 }
606
607 streaming->header.bNumFormats = p;
608 streaming->header.bEndpointAddress = buffer[6];
609 streaming->header.bmInfo = buffer[7];
610 streaming->header.bTerminalLink = buffer[8];
611 streaming->header.bStillCaptureMethod = buffer[9];
612 streaming->header.bTriggerSupport = buffer[10];
613 streaming->header.bTriggerUsage = buffer[11];
614 streaming->header.bControlSize = n;
615
616 streaming->header.bmaControls = kmalloc(p*n, GFP_KERNEL);
617 if (streaming->header.bmaControls == NULL) {
618 ret = -ENOMEM;
619 goto error;
620 }
621
622 memcpy(streaming->header.bmaControls, &buffer[13], p*n);
623 } else {
624 uvc_trace(UVC_TRACE_DESCR, "device %d videostreaming interface "
625 "%d HEADER descriptor not found.\n", dev->udev->devnum,
626 alts->desc.bInterfaceNumber);
627 goto error;
628 }
629
630 buflen -= buffer[0];
631 buffer += buffer[0];
632
633 _buffer = buffer;
634 _buflen = buflen;
635
636 /* Count the format and frame descriptors. */
637 while (_buflen > 2) {
638 switch (_buffer[2]) {
639 case VS_FORMAT_UNCOMPRESSED:
640 case VS_FORMAT_MJPEG:
641 case VS_FORMAT_FRAME_BASED:
642 nformats++;
643 break;
644
645 case VS_FORMAT_DV:
646 /* DV format has no frame descriptor. We will create a
647 * dummy frame descriptor with a dummy frame interval.
648 */
649 nformats++;
650 nframes++;
651 nintervals++;
652 break;
653
654 case VS_FORMAT_MPEG2TS:
655 case VS_FORMAT_STREAM_BASED:
656 uvc_trace(UVC_TRACE_DESCR, "device %d videostreaming "
657 "interface %d FORMAT %u is not supported.\n",
658 dev->udev->devnum,
659 alts->desc.bInterfaceNumber, _buffer[2]);
660 break;
661
662 case VS_FRAME_UNCOMPRESSED:
663 case VS_FRAME_MJPEG:
664 nframes++;
665 if (_buflen > 25)
666 nintervals += _buffer[25] ? _buffer[25] : 3;
667 break;
668
669 case VS_FRAME_FRAME_BASED:
670 nframes++;
671 if (_buflen > 21)
672 nintervals += _buffer[21] ? _buffer[21] : 3;
673 break;
674 }
675
676 _buflen -= _buffer[0];
677 _buffer += _buffer[0];
678 }
679
680 if (nformats == 0) {
681 uvc_trace(UVC_TRACE_DESCR, "device %d videostreaming interface "
682 "%d has no supported formats defined.\n",
683 dev->udev->devnum, alts->desc.bInterfaceNumber);
684 goto error;
685 }
686
687 size = nformats * sizeof *format + nframes * sizeof *frame
688 + nintervals * sizeof *interval;
689 format = kzalloc(size, GFP_KERNEL);
690 if (format == NULL) {
691 ret = -ENOMEM;
692 goto error;
693 }
694
695 frame = (struct uvc_frame *)&format[nformats];
696 interval = (__u32 *)&frame[nframes];
697
698 streaming->format = format;
699 streaming->nformats = nformats;
700
701 /* Parse the format descriptors. */
702 while (buflen > 2) {
703 switch (buffer[2]) {
704 case VS_FORMAT_UNCOMPRESSED:
705 case VS_FORMAT_MJPEG:
706 case VS_FORMAT_DV:
707 case VS_FORMAT_FRAME_BASED:
708 format->frame = frame;
709 ret = uvc_parse_format(dev, streaming, format,
710 &interval, buffer, buflen);
711 if (ret < 0)
712 goto error;
713
714 frame += format->nframes;
715 format++;
716
717 buflen -= ret;
718 buffer += ret;
719 continue;
720
721 default:
722 break;
723 }
724
725 buflen -= buffer[0];
726 buffer += buffer[0];
727 }
728
729 /* Parse the alternate settings to find the maximum bandwidth. */
730 for (i = 0; i < intf->num_altsetting; ++i) {
731 struct usb_host_endpoint *ep;
732 alts = &intf->altsetting[i];
733 ep = uvc_find_endpoint(alts,
734 streaming->header.bEndpointAddress);
735 if (ep == NULL)
736 continue;
737
738 psize = le16_to_cpu(ep->desc.wMaxPacketSize);
739 psize = (psize & 0x07ff) * (1 + ((psize >> 11) & 3));
740 if (psize > streaming->maxpsize)
741 streaming->maxpsize = psize;
742 }
743
744 list_add_tail(&streaming->list, &dev->streaming);
745 return 0;
746
747error:
748 usb_driver_release_interface(&uvc_driver.driver, intf);
749 usb_put_intf(intf);
750 kfree(streaming->format);
751 kfree(streaming->header.bmaControls);
752 kfree(streaming);
753 return ret;
754}
755
756/* Parse vendor-specific extensions. */
757static int uvc_parse_vendor_control(struct uvc_device *dev,
758 const unsigned char *buffer, int buflen)
759{
760 struct usb_device *udev = dev->udev;
761 struct usb_host_interface *alts = dev->intf->cur_altsetting;
762 struct uvc_entity *unit;
763 unsigned int n, p;
764 int handled = 0;
765
766 switch (le16_to_cpu(dev->udev->descriptor.idVendor)) {
767 case 0x046d: /* Logitech */
768 if (buffer[1] != 0x41 || buffer[2] != 0x01)
769 break;
770
771 /* Logitech implements several vendor specific functions
772 * through vendor specific extension units (LXU).
773 *
774 * The LXU descriptors are similar to XU descriptors
775 * (see "USB Device Video Class for Video Devices", section
776 * 3.7.2.6 "Extension Unit Descriptor") with the following
777 * differences:
778 *
779 * ----------------------------------------------------------
780 * 0 bLength 1 Number
781 * Size of this descriptor, in bytes: 24+p+n*2
782 * ----------------------------------------------------------
783 * 23+p+n bmControlsType N Bitmap
784 * Individual bits in the set are defined:
785 * 0: Absolute
786 * 1: Relative
787 *
788 * This bitset is mapped exactly the same as bmControls.
789 * ----------------------------------------------------------
790 * 23+p+n*2 bReserved 1 Boolean
791 * ----------------------------------------------------------
792 * 24+p+n*2 iExtension 1 Index
793 * Index of a string descriptor that describes this
794 * extension unit.
795 * ----------------------------------------------------------
796 */
797 p = buflen >= 22 ? buffer[21] : 0;
798 n = buflen >= 25 + p ? buffer[22+p] : 0;
799
800 if (buflen < 25 + p + 2*n) {
801 uvc_trace(UVC_TRACE_DESCR, "device %d videocontrol "
802 "interface %d EXTENSION_UNIT error\n",
803 udev->devnum, alts->desc.bInterfaceNumber);
804 break;
805 }
806
807 unit = kzalloc(sizeof *unit + p + 2*n, GFP_KERNEL);
808 if (unit == NULL)
809 return -ENOMEM;
810
811 unit->id = buffer[3];
812 unit->type = VC_EXTENSION_UNIT;
813 memcpy(unit->extension.guidExtensionCode, &buffer[4], 16);
814 unit->extension.bNumControls = buffer[20];
815 unit->extension.bNrInPins =
816 le16_to_cpup((__le16 *)&buffer[21]);
817 unit->extension.baSourceID = (__u8 *)unit + sizeof *unit;
818 memcpy(unit->extension.baSourceID, &buffer[22], p);
819 unit->extension.bControlSize = buffer[22+p];
820 unit->extension.bmControls = (__u8 *)unit + sizeof *unit + p;
821 unit->extension.bmControlsType = (__u8 *)unit + sizeof *unit
822 + p + n;
823 memcpy(unit->extension.bmControls, &buffer[23+p], 2*n);
824
825 if (buffer[24+p+2*n] != 0)
826 usb_string(udev, buffer[24+p+2*n], unit->name,
827 sizeof unit->name);
828 else
829 sprintf(unit->name, "Extension %u", buffer[3]);
830
831 list_add_tail(&unit->list, &dev->entities);
832 handled = 1;
833 break;
834 }
835
836 return handled;
837}
838
839static int uvc_parse_standard_control(struct uvc_device *dev,
840 const unsigned char *buffer, int buflen)
841{
842 struct usb_device *udev = dev->udev;
843 struct uvc_entity *unit, *term;
844 struct usb_interface *intf;
845 struct usb_host_interface *alts = dev->intf->cur_altsetting;
846 unsigned int i, n, p, len;
847 __u16 type;
848
849 switch (buffer[2]) {
850 case VC_HEADER:
851 n = buflen >= 12 ? buffer[11] : 0;
852
853 if (buflen < 12 || buflen < 12 + n) {
854 uvc_trace(UVC_TRACE_DESCR, "device %d videocontrol "
855 "interface %d HEADER error\n", udev->devnum,
856 alts->desc.bInterfaceNumber);
857 return -EINVAL;
858 }
859
860 dev->uvc_version = le16_to_cpup((__le16 *)&buffer[3]);
861 dev->clock_frequency = le32_to_cpup((__le32 *)&buffer[7]);
862
863 /* Parse all USB Video Streaming interfaces. */
864 for (i = 0; i < n; ++i) {
865 intf = usb_ifnum_to_if(udev, buffer[12+i]);
866 if (intf == NULL) {
867 uvc_trace(UVC_TRACE_DESCR, "device %d "
868 "interface %d doesn't exists\n",
869 udev->devnum, i);
870 continue;
871 }
872
873 uvc_parse_streaming(dev, intf);
874 }
875 break;
876
877 case VC_INPUT_TERMINAL:
878 if (buflen < 8) {
879 uvc_trace(UVC_TRACE_DESCR, "device %d videocontrol "
880 "interface %d INPUT_TERMINAL error\n",
881 udev->devnum, alts->desc.bInterfaceNumber);
882 return -EINVAL;
883 }
884
885 /* Make sure the terminal type MSB is not null, otherwise it
886 * could be confused with a unit.
887 */
888 type = le16_to_cpup((__le16 *)&buffer[4]);
889 if ((type & 0xff00) == 0) {
890 uvc_trace(UVC_TRACE_DESCR, "device %d videocontrol "
891 "interface %d INPUT_TERMINAL %d has invalid "
892 "type 0x%04x, skipping\n", udev->devnum,
893 alts->desc.bInterfaceNumber,
894 buffer[3], type);
895 return 0;
896 }
897
898 n = 0;
899 p = 0;
900 len = 8;
901
902 if (type == ITT_CAMERA) {
903 n = buflen >= 15 ? buffer[14] : 0;
904 len = 15;
905
906 } else if (type == ITT_MEDIA_TRANSPORT_INPUT) {
907 n = buflen >= 9 ? buffer[8] : 0;
908 p = buflen >= 10 + n ? buffer[9+n] : 0;
909 len = 10;
910 }
911
912 if (buflen < len + n + p) {
913 uvc_trace(UVC_TRACE_DESCR, "device %d videocontrol "
914 "interface %d INPUT_TERMINAL error\n",
915 udev->devnum, alts->desc.bInterfaceNumber);
916 return -EINVAL;
917 }
918
919 term = kzalloc(sizeof *term + n + p, GFP_KERNEL);
920 if (term == NULL)
921 return -ENOMEM;
922
923 term->id = buffer[3];
924 term->type = type | UVC_TERM_INPUT;
925
926 if (UVC_ENTITY_TYPE(term) == ITT_CAMERA) {
927 term->camera.bControlSize = n;
928 term->camera.bmControls = (__u8 *)term + sizeof *term;
929 term->camera.wObjectiveFocalLengthMin =
930 le16_to_cpup((__le16 *)&buffer[8]);
931 term->camera.wObjectiveFocalLengthMax =
932 le16_to_cpup((__le16 *)&buffer[10]);
933 term->camera.wOcularFocalLength =
934 le16_to_cpup((__le16 *)&buffer[12]);
935 memcpy(term->camera.bmControls, &buffer[15], n);
936 } else if (UVC_ENTITY_TYPE(term) == ITT_MEDIA_TRANSPORT_INPUT) {
937 term->media.bControlSize = n;
938 term->media.bmControls = (__u8 *)term + sizeof *term;
939 term->media.bTransportModeSize = p;
940 term->media.bmTransportModes = (__u8 *)term
941 + sizeof *term + n;
942 memcpy(term->media.bmControls, &buffer[9], n);
943 memcpy(term->media.bmTransportModes, &buffer[10+n], p);
944 }
945
946 if (buffer[7] != 0)
947 usb_string(udev, buffer[7], term->name,
948 sizeof term->name);
949 else if (UVC_ENTITY_TYPE(term) == ITT_CAMERA)
950 sprintf(term->name, "Camera %u", buffer[3]);
951 else if (UVC_ENTITY_TYPE(term) == ITT_MEDIA_TRANSPORT_INPUT)
952 sprintf(term->name, "Media %u", buffer[3]);
953 else
954 sprintf(term->name, "Input %u", buffer[3]);
955
956 list_add_tail(&term->list, &dev->entities);
957 break;
958
959 case VC_OUTPUT_TERMINAL:
960 if (buflen < 9) {
961 uvc_trace(UVC_TRACE_DESCR, "device %d videocontrol "
962 "interface %d OUTPUT_TERMINAL error\n",
963 udev->devnum, alts->desc.bInterfaceNumber);
964 return -EINVAL;
965 }
966
967 /* Make sure the terminal type MSB is not null, otherwise it
968 * could be confused with a unit.
969 */
970 type = le16_to_cpup((__le16 *)&buffer[4]);
971 if ((type & 0xff00) == 0) {
972 uvc_trace(UVC_TRACE_DESCR, "device %d videocontrol "
973 "interface %d OUTPUT_TERMINAL %d has invalid "
974 "type 0x%04x, skipping\n", udev->devnum,
975 alts->desc.bInterfaceNumber, buffer[3], type);
976 return 0;
977 }
978
979 term = kzalloc(sizeof *term, GFP_KERNEL);
980 if (term == NULL)
981 return -ENOMEM;
982
983 term->id = buffer[3];
984 term->type = type | UVC_TERM_OUTPUT;
985 term->output.bSourceID = buffer[7];
986
987 if (buffer[8] != 0)
988 usb_string(udev, buffer[8], term->name,
989 sizeof term->name);
990 else
991 sprintf(term->name, "Output %u", buffer[3]);
992
993 list_add_tail(&term->list, &dev->entities);
994 break;
995
996 case VC_SELECTOR_UNIT:
997 p = buflen >= 5 ? buffer[4] : 0;
998
999 if (buflen < 5 || buflen < 6 + p) {
1000 uvc_trace(UVC_TRACE_DESCR, "device %d videocontrol "
1001 "interface %d SELECTOR_UNIT error\n",
1002 udev->devnum, alts->desc.bInterfaceNumber);
1003 return -EINVAL;
1004 }
1005
1006 unit = kzalloc(sizeof *unit + p, GFP_KERNEL);
1007 if (unit == NULL)
1008 return -ENOMEM;
1009
1010 unit->id = buffer[3];
1011 unit->type = buffer[2];
1012 unit->selector.bNrInPins = buffer[4];
1013 unit->selector.baSourceID = (__u8 *)unit + sizeof *unit;
1014 memcpy(unit->selector.baSourceID, &buffer[5], p);
1015
1016 if (buffer[5+p] != 0)
1017 usb_string(udev, buffer[5+p], unit->name,
1018 sizeof unit->name);
1019 else
1020 sprintf(unit->name, "Selector %u", buffer[3]);
1021
1022 list_add_tail(&unit->list, &dev->entities);
1023 break;
1024
1025 case VC_PROCESSING_UNIT:
1026 n = buflen >= 8 ? buffer[7] : 0;
1027 p = dev->uvc_version >= 0x0110 ? 10 : 9;
1028
1029 if (buflen < p + n) {
1030 uvc_trace(UVC_TRACE_DESCR, "device %d videocontrol "
1031 "interface %d PROCESSING_UNIT error\n",
1032 udev->devnum, alts->desc.bInterfaceNumber);
1033 return -EINVAL;
1034 }
1035
1036 unit = kzalloc(sizeof *unit + n, GFP_KERNEL);
1037 if (unit == NULL)
1038 return -ENOMEM;
1039
1040 unit->id = buffer[3];
1041 unit->type = buffer[2];
1042 unit->processing.bSourceID = buffer[4];
1043 unit->processing.wMaxMultiplier =
1044 le16_to_cpup((__le16 *)&buffer[5]);
1045 unit->processing.bControlSize = buffer[7];
1046 unit->processing.bmControls = (__u8 *)unit + sizeof *unit;
1047 memcpy(unit->processing.bmControls, &buffer[8], n);
1048 if (dev->uvc_version >= 0x0110)
1049 unit->processing.bmVideoStandards = buffer[9+n];
1050
1051 if (buffer[8+n] != 0)
1052 usb_string(udev, buffer[8+n], unit->name,
1053 sizeof unit->name);
1054 else
1055 sprintf(unit->name, "Processing %u", buffer[3]);
1056
1057 list_add_tail(&unit->list, &dev->entities);
1058 break;
1059
1060 case VC_EXTENSION_UNIT:
1061 p = buflen >= 22 ? buffer[21] : 0;
1062 n = buflen >= 24 + p ? buffer[22+p] : 0;
1063
1064 if (buflen < 24 + p + n) {
1065 uvc_trace(UVC_TRACE_DESCR, "device %d videocontrol "
1066 "interface %d EXTENSION_UNIT error\n",
1067 udev->devnum, alts->desc.bInterfaceNumber);
1068 return -EINVAL;
1069 }
1070
1071 unit = kzalloc(sizeof *unit + p + n, GFP_KERNEL);
1072 if (unit == NULL)
1073 return -ENOMEM;
1074
1075 unit->id = buffer[3];
1076 unit->type = buffer[2];
1077 memcpy(unit->extension.guidExtensionCode, &buffer[4], 16);
1078 unit->extension.bNumControls = buffer[20];
1079 unit->extension.bNrInPins =
1080 le16_to_cpup((__le16 *)&buffer[21]);
1081 unit->extension.baSourceID = (__u8 *)unit + sizeof *unit;
1082 memcpy(unit->extension.baSourceID, &buffer[22], p);
1083 unit->extension.bControlSize = buffer[22+p];
1084 unit->extension.bmControls = (__u8 *)unit + sizeof *unit + p;
1085 memcpy(unit->extension.bmControls, &buffer[23+p], n);
1086
1087 if (buffer[23+p+n] != 0)
1088 usb_string(udev, buffer[23+p+n], unit->name,
1089 sizeof unit->name);
1090 else
1091 sprintf(unit->name, "Extension %u", buffer[3]);
1092
1093 list_add_tail(&unit->list, &dev->entities);
1094 break;
1095
1096 default:
1097 uvc_trace(UVC_TRACE_DESCR, "Found an unknown CS_INTERFACE "
1098 "descriptor (%u)\n", buffer[2]);
1099 break;
1100 }
1101
1102 return 0;
1103}
1104
1105static int uvc_parse_control(struct uvc_device *dev)
1106{
1107 struct usb_host_interface *alts = dev->intf->cur_altsetting;
1108 unsigned char *buffer = alts->extra;
1109 int buflen = alts->extralen;
1110 int ret;
1111
1112 /* Parse the default alternate setting only, as the UVC specification
1113 * defines a single alternate setting, the default alternate setting
1114 * zero.
1115 */
1116
1117 while (buflen > 2) {
1118 if (uvc_parse_vendor_control(dev, buffer, buflen) ||
1119 buffer[1] != USB_DT_CS_INTERFACE)
1120 goto next_descriptor;
1121
1122 if ((ret = uvc_parse_standard_control(dev, buffer, buflen)) < 0)
1123 return ret;
1124
1125next_descriptor:
1126 buflen -= buffer[0];
1127 buffer += buffer[0];
1128 }
1129
1130 /* Check if the optional status endpoint is present. */
1131 if (alts->desc.bNumEndpoints == 1) {
1132 struct usb_host_endpoint *ep = &alts->endpoint[0];
1133 struct usb_endpoint_descriptor *desc = &ep->desc;
1134
1135 if (usb_endpoint_is_int_in(desc) &&
1136 le16_to_cpu(desc->wMaxPacketSize) >= 8 &&
1137 desc->bInterval != 0) {
1138 uvc_trace(UVC_TRACE_DESCR, "Found a Status endpoint "
1139 "(addr %02x).\n", desc->bEndpointAddress);
1140 dev->int_ep = ep;
1141 }
1142 }
1143
1144 return 0;
1145}
1146
1147/* ------------------------------------------------------------------------
1148 * USB probe and disconnect
1149 */
1150
1151/*
1152 * Unregister the video devices.
1153 */
1154static void uvc_unregister_video(struct uvc_device *dev)
1155{
1156 if (dev->video.vdev) {
1157 if (dev->video.vdev->minor == -1)
1158 video_device_release(dev->video.vdev);
1159 else
1160 video_unregister_device(dev->video.vdev);
1161 dev->video.vdev = NULL;
1162 }
1163}
1164
1165/*
1166 * Scan the UVC descriptors to locate a chain starting at an Output Terminal
1167 * and containing the following units:
1168 *
1169 * - a USB Streaming Output Terminal
1170 * - zero or one Processing Unit
1171 * - zero, one or mode single-input Selector Units
1172 * - zero or one multiple-input Selector Units, provided all inputs are
1173 * connected to input terminals
1174 * - zero, one or mode single-input Extension Units
1175 * - one Camera Input Terminal, or one or more External terminals.
1176 *
1177 * A side forward scan is made on each detected entity to check for additional
1178 * extension units.
1179 */
1180static int uvc_scan_chain_entity(struct uvc_video_device *video,
1181 struct uvc_entity *entity)
1182{
1183 switch (UVC_ENTITY_TYPE(entity)) {
1184 case VC_EXTENSION_UNIT:
1185 if (uvc_trace_param & UVC_TRACE_PROBE)
1186 printk(" <- XU %d", entity->id);
1187
1188 if (entity->extension.bNrInPins != 1) {
1189 uvc_trace(UVC_TRACE_DESCR, "Extension unit %d has more "
1190 "than 1 input pin.\n", entity->id);
1191 return -1;
1192 }
1193
1194 list_add_tail(&entity->chain, &video->extensions);
1195 break;
1196
1197 case VC_PROCESSING_UNIT:
1198 if (uvc_trace_param & UVC_TRACE_PROBE)
1199 printk(" <- PU %d", entity->id);
1200
1201 if (video->processing != NULL) {
1202 uvc_trace(UVC_TRACE_DESCR, "Found multiple "
1203 "Processing Units in chain.\n");
1204 return -1;
1205 }
1206
1207 video->processing = entity;
1208 break;
1209
1210 case VC_SELECTOR_UNIT:
1211 if (uvc_trace_param & UVC_TRACE_PROBE)
1212 printk(" <- SU %d", entity->id);
1213
1214 /* Single-input selector units are ignored. */
1215 if (entity->selector.bNrInPins == 1)
1216 break;
1217
1218 if (video->selector != NULL) {
1219 uvc_trace(UVC_TRACE_DESCR, "Found multiple Selector "
1220 "Units in chain.\n");
1221 return -1;
1222 }
1223
1224 video->selector = entity;
1225 break;
1226
1227 case ITT_VENDOR_SPECIFIC:
1228 case ITT_CAMERA:
1229 case ITT_MEDIA_TRANSPORT_INPUT:
1230 if (uvc_trace_param & UVC_TRACE_PROBE)
1231 printk(" <- IT %d\n", entity->id);
1232
1233 list_add_tail(&entity->chain, &video->iterms);
1234 break;
1235
1236 default:
1237 uvc_trace(UVC_TRACE_DESCR, "Unsupported entity type "
1238 "0x%04x found in chain.\n", UVC_ENTITY_TYPE(entity));
1239 return -1;
1240 }
1241
1242 return 0;
1243}
1244
1245static int uvc_scan_chain_forward(struct uvc_video_device *video,
1246 struct uvc_entity *entity, struct uvc_entity *prev)
1247{
1248 struct uvc_entity *forward;
1249 int found;
1250
1251 /* Forward scan */
1252 forward = NULL;
1253 found = 0;
1254
1255 while (1) {
1256 forward = uvc_entity_by_reference(video->dev, entity->id,
1257 forward);
1258 if (forward == NULL)
1259 break;
1260
1261 if (UVC_ENTITY_TYPE(forward) != VC_EXTENSION_UNIT ||
1262 forward == prev)
1263 continue;
1264
1265 if (forward->extension.bNrInPins != 1) {
1266 uvc_trace(UVC_TRACE_DESCR, "Extension unit %d has"
1267 "more than 1 input pin.\n", entity->id);
1268 return -1;
1269 }
1270
1271 list_add_tail(&forward->chain, &video->extensions);
1272 if (uvc_trace_param & UVC_TRACE_PROBE) {
1273 if (!found)
1274 printk(" (-> XU");
1275
1276 printk(" %d", forward->id);
1277 found = 1;
1278 }
1279 }
1280 if (found)
1281 printk(")");
1282
1283 return 0;
1284}
1285
1286static int uvc_scan_chain_backward(struct uvc_video_device *video,
1287 struct uvc_entity *entity)
1288{
1289 struct uvc_entity *term;
1290 int id = -1, i;
1291
1292 switch (UVC_ENTITY_TYPE(entity)) {
1293 case VC_EXTENSION_UNIT:
1294 id = entity->extension.baSourceID[0];
1295 break;
1296
1297 case VC_PROCESSING_UNIT:
1298 id = entity->processing.bSourceID;
1299 break;
1300
1301 case VC_SELECTOR_UNIT:
1302 /* Single-input selector units are ignored. */
1303 if (entity->selector.bNrInPins == 1) {
1304 id = entity->selector.baSourceID[0];
1305 break;
1306 }
1307
1308 if (uvc_trace_param & UVC_TRACE_PROBE)
1309 printk(" <- IT");
1310
1311 video->selector = entity;
1312 for (i = 0; i < entity->selector.bNrInPins; ++i) {
1313 id = entity->selector.baSourceID[i];
1314 term = uvc_entity_by_id(video->dev, id);
1315 if (term == NULL || !UVC_ENTITY_IS_ITERM(term)) {
1316 uvc_trace(UVC_TRACE_DESCR, "Selector unit %d "
1317 "input %d isn't connected to an "
1318 "input terminal\n", entity->id, i);
1319 return -1;
1320 }
1321
1322 if (uvc_trace_param & UVC_TRACE_PROBE)
1323 printk(" %d", term->id);
1324
1325 list_add_tail(&term->chain, &video->iterms);
1326 uvc_scan_chain_forward(video, term, entity);
1327 }
1328
1329 if (uvc_trace_param & UVC_TRACE_PROBE)
1330 printk("\n");
1331
1332 id = 0;
1333 break;
1334 }
1335
1336 return id;
1337}
1338
1339static int uvc_scan_chain(struct uvc_video_device *video)
1340{
1341 struct uvc_entity *entity, *prev;
1342 int id;
1343
1344 entity = video->oterm;
1345 uvc_trace(UVC_TRACE_PROBE, "Scanning UVC chain: OT %d", entity->id);
1346 id = entity->output.bSourceID;
1347 while (id != 0) {
1348 prev = entity;
1349 entity = uvc_entity_by_id(video->dev, id);
1350 if (entity == NULL) {
1351 uvc_trace(UVC_TRACE_DESCR, "Found reference to "
1352 "unknown entity %d.\n", id);
1353 return -1;
1354 }
1355
1356 /* Process entity */
1357 if (uvc_scan_chain_entity(video, entity) < 0)
1358 return -1;
1359
1360 /* Forward scan */
1361 if (uvc_scan_chain_forward(video, entity, prev) < 0)
1362 return -1;
1363
1364 /* Stop when a terminal is found. */
1365 if (!UVC_ENTITY_IS_UNIT(entity))
1366 break;
1367
1368 /* Backward scan */
1369 id = uvc_scan_chain_backward(video, entity);
1370 if (id < 0)
1371 return id;
1372 }
1373
1374 /* Initialize the video buffers queue. */
1375 uvc_queue_init(&video->queue);
1376
1377 return 0;
1378}
1379
1380/*
1381 * Register the video devices.
1382 *
1383 * The driver currently supports a single video device per control interface
1384 * only. The terminal and units must match the following structure:
1385 *
1386 * ITT_CAMERA -> VC_PROCESSING_UNIT -> VC_EXTENSION_UNIT{0,n} -> TT_STREAMING
1387 *
1388 * The Extension Units, if present, must have a single input pin. The
1389 * Processing Unit and Extension Units can be in any order. Additional
1390 * Extension Units connected to the main chain as single-unit branches are
1391 * also supported.
1392 */
1393static int uvc_register_video(struct uvc_device *dev)
1394{
1395 struct video_device *vdev;
1396 struct uvc_entity *term;
1397 int found = 0, ret;
1398
1399 /* Check if the control interface matches the structure we expect. */
1400 list_for_each_entry(term, &dev->entities, list) {
1401 struct uvc_streaming *streaming;
1402
1403 if (UVC_ENTITY_TYPE(term) != TT_STREAMING)
1404 continue;
1405
1406 memset(&dev->video, 0, sizeof dev->video);
1407 mutex_init(&dev->video.ctrl_mutex);
1408 INIT_LIST_HEAD(&dev->video.iterms);
1409 INIT_LIST_HEAD(&dev->video.extensions);
1410 dev->video.oterm = term;
1411 dev->video.dev = dev;
1412 if (uvc_scan_chain(&dev->video) < 0)
1413 continue;
1414
1415 list_for_each_entry(streaming, &dev->streaming, list) {
1416 if (streaming->header.bTerminalLink == term->id) {
1417 dev->video.streaming = streaming;
1418 found = 1;
1419 break;
1420 }
1421 }
1422
1423 if (found)
1424 break;
1425 }
1426
1427 if (!found) {
1428 uvc_printk(KERN_INFO, "No valid video chain found.\n");
1429 return -1;
1430 }
1431
1432 if (uvc_trace_param & UVC_TRACE_PROBE) {
1433 uvc_printk(KERN_INFO, "Found a valid video chain (");
1434 list_for_each_entry(term, &dev->video.iterms, chain) {
1435 printk("%d", term->id);
1436 if (term->chain.next != &dev->video.iterms)
1437 printk(",");
1438 }
1439 printk(" -> %d).\n", dev->video.oterm->id);
1440 }
1441
1442 /* Initialize the streaming interface with default streaming
1443 * parameters.
1444 */
1445 if ((ret = uvc_video_init(&dev->video)) < 0) {
1446 uvc_printk(KERN_ERR, "Failed to initialize the device "
1447 "(%d).\n", ret);
1448 return ret;
1449 }
1450
1451 /* Register the device with V4L. */
1452 vdev = video_device_alloc();
1453 if (vdev == NULL)
1454 return -1;
1455
1456 /* We already hold a reference to dev->udev. The video device will be
1457 * unregistered before the reference is released, so we don't need to
1458 * get another one.
1459 */
1460 vdev->dev = &dev->intf->dev;
1461 vdev->type = 0;
1462 vdev->type2 = 0;
1463 vdev->minor = -1;
1464 vdev->fops = &uvc_fops;
1465 vdev->release = video_device_release;
1466 strncpy(vdev->name, dev->name, sizeof vdev->name);
1467
1468 /* Set the driver data before calling video_register_device, otherwise
1469 * uvc_v4l2_open might race us.
1470 *
1471 * FIXME: usb_set_intfdata hasn't been called so far. Is that a
1472 * problem ? Does any function which could be called here get
1473 * a pointer to the usb_interface ?
1474 */
1475 dev->video.vdev = vdev;
1476 video_set_drvdata(vdev, &dev->video);
1477
1478 if (video_register_device(vdev, VFL_TYPE_GRABBER, -1) < 0) {
1479 dev->video.vdev = NULL;
1480 video_device_release(vdev);
1481 return -1;
1482 }
1483
1484 return 0;
1485}
1486
1487/*
1488 * Delete the UVC device.
1489 *
1490 * Called by the kernel when the last reference to the uvc_device structure
1491 * is released.
1492 *
1493 * Unregistering the video devices is done here because every opened instance
1494 * must be closed before the device can be unregistered. An alternative would
1495 * have been to use another reference count for uvc_v4l2_open/uvc_release, and
1496 * unregister the video devices on disconnect when that reference count drops
1497 * to zero.
1498 *
1499 * As this function is called after or during disconnect(), all URBs have
1500 * already been canceled by the USB core. There is no need to kill the
1501 * interrupt URB manually.
1502 */
1503void uvc_delete(struct kref *kref)
1504{
1505 struct uvc_device *dev = container_of(kref, struct uvc_device, kref);
1506 struct list_head *p, *n;
1507
1508 /* Unregister the video device */
1509 uvc_unregister_video(dev);
1510 usb_put_intf(dev->intf);
1511 usb_put_dev(dev->udev);
1512
1513 uvc_status_cleanup(dev);
1514 uvc_ctrl_cleanup_device(dev);
1515
1516 list_for_each_safe(p, n, &dev->entities) {
1517 struct uvc_entity *entity;
1518 entity = list_entry(p, struct uvc_entity, list);
1519 kfree(entity);
1520 }
1521
1522 list_for_each_safe(p, n, &dev->streaming) {
1523 struct uvc_streaming *streaming;
1524 streaming = list_entry(p, struct uvc_streaming, list);
1525 usb_driver_release_interface(&uvc_driver.driver,
1526 streaming->intf);
1527 usb_put_intf(streaming->intf);
1528 kfree(streaming->format);
1529 kfree(streaming->header.bmaControls);
1530 kfree(streaming);
1531 }
1532
1533 kfree(dev);
1534}
1535
1536static int uvc_probe(struct usb_interface *intf,
1537 const struct usb_device_id *id)
1538{
1539 struct usb_device *udev = interface_to_usbdev(intf);
1540 struct uvc_device *dev;
1541 int ret;
1542
1543 if (id->idVendor && id->idProduct)
1544 uvc_trace(UVC_TRACE_PROBE, "Probing known UVC device %s "
1545 "(%04x:%04x)\n", udev->devpath, id->idVendor,
1546 id->idProduct);
1547 else
1548 uvc_trace(UVC_TRACE_PROBE, "Probing generic UVC device %s\n",
1549 udev->devpath);
1550
1551 /* Allocate memory for the device and initialize it */
1552 if ((dev = kzalloc(sizeof *dev, GFP_KERNEL)) == NULL)
1553 return -ENOMEM;
1554
1555 INIT_LIST_HEAD(&dev->entities);
1556 INIT_LIST_HEAD(&dev->streaming);
1557 kref_init(&dev->kref);
1558
1559 dev->udev = usb_get_dev(udev);
1560 dev->intf = usb_get_intf(intf);
1561 dev->intfnum = intf->cur_altsetting->desc.bInterfaceNumber;
1562 dev->quirks = id->driver_info | uvc_quirks_param;
1563
1564 if (udev->product != NULL)
1565 strncpy(dev->name, udev->product, sizeof dev->name);
1566 else
1567 snprintf(dev->name, sizeof dev->name,
1568 "UVC Camera (%04x:%04x)",
1569 le16_to_cpu(udev->descriptor.idVendor),
1570 le16_to_cpu(udev->descriptor.idProduct));
1571
1572 /* Parse the Video Class control descriptor */
1573 if (uvc_parse_control(dev) < 0) {
1574 uvc_trace(UVC_TRACE_PROBE, "Unable to parse UVC "
1575 "descriptors.\n");
1576 goto error;
1577 }
1578
1579 uvc_printk(KERN_INFO, "Found UVC %u.%02u device %s (%04x:%04x)\n",
1580 dev->uvc_version >> 8, dev->uvc_version & 0xff,
1581 udev->product ? udev->product : "<unnamed>",
1582 le16_to_cpu(udev->descriptor.idVendor),
1583 le16_to_cpu(udev->descriptor.idProduct));
1584
1585 if (uvc_quirks_param != 0) {
1586 uvc_printk(KERN_INFO, "Forcing device quirks 0x%x by module "
1587 "parameter for testing purpose.\n", uvc_quirks_param);
1588 uvc_printk(KERN_INFO, "Please report required quirks to the "
1589 "linux-uvc-devel mailing list.\n");
1590 }
1591
1592 /* Initialize controls */
1593 if (uvc_ctrl_init_device(dev) < 0)
1594 goto error;
1595
1596 /* Register the video devices */
1597 if (uvc_register_video(dev) < 0)
1598 goto error;
1599
1600 /* Save our data pointer in the interface data */
1601 usb_set_intfdata(intf, dev);
1602
1603 /* Initialize the interrupt URB */
1604 if ((ret = uvc_status_init(dev)) < 0) {
1605 uvc_printk(KERN_INFO, "Unable to initialize the status "
1606 "endpoint (%d), status interrupt will not be "
1607 "supported.\n", ret);
1608 }
1609
1610 uvc_trace(UVC_TRACE_PROBE, "UVC device initialized.\n");
1611 return 0;
1612
1613error:
1614 kref_put(&dev->kref, uvc_delete);
1615 return -ENODEV;
1616}
1617
1618static void uvc_disconnect(struct usb_interface *intf)
1619{
1620 struct uvc_device *dev = usb_get_intfdata(intf);
1621
1622 /* Set the USB interface data to NULL. This can be done outside the
1623 * lock, as there's no other reader.
1624 */
1625 usb_set_intfdata(intf, NULL);
1626
1627 if (intf->cur_altsetting->desc.bInterfaceSubClass == SC_VIDEOSTREAMING)
1628 return;
1629
1630 /* uvc_v4l2_open() might race uvc_disconnect(). A static driver-wide
1631 * lock is needed to prevent uvc_disconnect from releasing its
1632 * reference to the uvc_device instance after uvc_v4l2_open() received
1633 * the pointer to the device (video_devdata) but before it got the
1634 * chance to increase the reference count (kref_get).
1635 */
1636 mutex_lock(&uvc_driver.open_mutex);
1637
1638 dev->state |= UVC_DEV_DISCONNECTED;
1639 kref_put(&dev->kref, uvc_delete);
1640
1641 mutex_unlock(&uvc_driver.open_mutex);
1642}
1643
1644static int uvc_suspend(struct usb_interface *intf, pm_message_t message)
1645{
1646 struct uvc_device *dev = usb_get_intfdata(intf);
1647
1648 uvc_trace(UVC_TRACE_SUSPEND, "Suspending interface %u\n",
1649 intf->cur_altsetting->desc.bInterfaceNumber);
1650
1651 /* Controls are cached on the fly so they don't need to be saved. */
1652 if (intf->cur_altsetting->desc.bInterfaceSubClass == SC_VIDEOCONTROL)
1653 return uvc_status_suspend(dev);
1654
1655 if (dev->video.streaming->intf != intf) {
1656 uvc_trace(UVC_TRACE_SUSPEND, "Suspend: video streaming USB "
1657 "interface mismatch.\n");
1658 return -EINVAL;
1659 }
1660
1661 return uvc_video_suspend(&dev->video);
1662}
1663
1664static int uvc_resume(struct usb_interface *intf)
1665{
1666 struct uvc_device *dev = usb_get_intfdata(intf);
1667 int ret;
1668
1669 uvc_trace(UVC_TRACE_SUSPEND, "Resuming interface %u\n",
1670 intf->cur_altsetting->desc.bInterfaceNumber);
1671
1672 if (intf->cur_altsetting->desc.bInterfaceSubClass == SC_VIDEOCONTROL) {
1673 if ((ret = uvc_ctrl_resume_device(dev)) < 0)
1674 return ret;
1675
1676 return uvc_status_resume(dev);
1677 }
1678
1679 if (dev->video.streaming->intf != intf) {
1680 uvc_trace(UVC_TRACE_SUSPEND, "Resume: video streaming USB "
1681 "interface mismatch.\n");
1682 return -EINVAL;
1683 }
1684
1685 return uvc_video_resume(&dev->video);
1686}
1687
1688/* ------------------------------------------------------------------------
1689 * Driver initialization and cleanup
1690 */
1691
1692/*
1693 * The Logitech cameras listed below have their interface class set to
1694 * VENDOR_SPEC because they don't announce themselves as UVC devices, even
1695 * though they are compliant.
1696 */
1697static struct usb_device_id uvc_ids[] = {
1698 /* ALi M5606 (Clevo M540SR) */
1699 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
1700 | USB_DEVICE_ID_MATCH_INT_INFO,
1701 .idVendor = 0x0402,
1702 .idProduct = 0x5606,
1703 .bInterfaceClass = USB_CLASS_VIDEO,
1704 .bInterfaceSubClass = 1,
1705 .bInterfaceProtocol = 0,
1706 .driver_info = UVC_QUIRK_PROBE_MINMAX },
1707 /* Creative Live! Optia */
1708 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
1709 | USB_DEVICE_ID_MATCH_INT_INFO,
1710 .idVendor = 0x041e,
1711 .idProduct = 0x4057,
1712 .bInterfaceClass = USB_CLASS_VIDEO,
1713 .bInterfaceSubClass = 1,
1714 .bInterfaceProtocol = 0,
1715 .driver_info = UVC_QUIRK_PROBE_MINMAX },
1716 /* Microsoft Lifecam NX-6000 */
1717 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
1718 | USB_DEVICE_ID_MATCH_INT_INFO,
1719 .idVendor = 0x045e,
1720 .idProduct = 0x00f8,
1721 .bInterfaceClass = USB_CLASS_VIDEO,
1722 .bInterfaceSubClass = 1,
1723 .bInterfaceProtocol = 0,
1724 .driver_info = UVC_QUIRK_PROBE_MINMAX },
1725 /* Microsoft Lifecam VX-7000 */
1726 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
1727 | USB_DEVICE_ID_MATCH_INT_INFO,
1728 .idVendor = 0x045e,
1729 .idProduct = 0x0723,
1730 .bInterfaceClass = USB_CLASS_VIDEO,
1731 .bInterfaceSubClass = 1,
1732 .bInterfaceProtocol = 0,
1733 .driver_info = UVC_QUIRK_PROBE_MINMAX },
1734 /* Logitech Quickcam Fusion */
1735 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
1736 | USB_DEVICE_ID_MATCH_INT_INFO,
1737 .idVendor = 0x046d,
1738 .idProduct = 0x08c1,
1739 .bInterfaceClass = USB_CLASS_VENDOR_SPEC,
1740 .bInterfaceSubClass = 1,
1741 .bInterfaceProtocol = 0 },
1742 /* Logitech Quickcam Orbit MP */
1743 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
1744 | USB_DEVICE_ID_MATCH_INT_INFO,
1745 .idVendor = 0x046d,
1746 .idProduct = 0x08c2,
1747 .bInterfaceClass = USB_CLASS_VENDOR_SPEC,
1748 .bInterfaceSubClass = 1,
1749 .bInterfaceProtocol = 0 },
1750 /* Logitech Quickcam Pro for Notebook */
1751 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
1752 | USB_DEVICE_ID_MATCH_INT_INFO,
1753 .idVendor = 0x046d,
1754 .idProduct = 0x08c3,
1755 .bInterfaceClass = USB_CLASS_VENDOR_SPEC,
1756 .bInterfaceSubClass = 1,
1757 .bInterfaceProtocol = 0 },
1758 /* Logitech Quickcam Pro 5000 */
1759 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
1760 | USB_DEVICE_ID_MATCH_INT_INFO,
1761 .idVendor = 0x046d,
1762 .idProduct = 0x08c5,
1763 .bInterfaceClass = USB_CLASS_VENDOR_SPEC,
1764 .bInterfaceSubClass = 1,
1765 .bInterfaceProtocol = 0 },
1766 /* Logitech Quickcam OEM Dell Notebook */
1767 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
1768 | USB_DEVICE_ID_MATCH_INT_INFO,
1769 .idVendor = 0x046d,
1770 .idProduct = 0x08c6,
1771 .bInterfaceClass = USB_CLASS_VENDOR_SPEC,
1772 .bInterfaceSubClass = 1,
1773 .bInterfaceProtocol = 0 },
1774 /* Logitech Quickcam OEM Cisco VT Camera II */
1775 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
1776 | USB_DEVICE_ID_MATCH_INT_INFO,
1777 .idVendor = 0x046d,
1778 .idProduct = 0x08c7,
1779 .bInterfaceClass = USB_CLASS_VENDOR_SPEC,
1780 .bInterfaceSubClass = 1,
1781 .bInterfaceProtocol = 0 },
1782 /* Apple Built-In iSight */
1783 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
1784 | USB_DEVICE_ID_MATCH_INT_INFO,
1785 .idVendor = 0x05ac,
1786 .idProduct = 0x8501,
1787 .bInterfaceClass = USB_CLASS_VIDEO,
1788 .bInterfaceSubClass = 1,
1789 .bInterfaceProtocol = 0,
1790 .driver_info = UVC_QUIRK_PROBE_MINMAX
1791 | UVC_QUIRK_BUILTIN_ISIGHT },
1792 /* Genesys Logic USB 2.0 PC Camera */
1793 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
1794 | USB_DEVICE_ID_MATCH_INT_INFO,
1795 .idVendor = 0x05e3,
1796 .idProduct = 0x0505,
1797 .bInterfaceClass = USB_CLASS_VIDEO,
1798 .bInterfaceSubClass = 1,
1799 .bInterfaceProtocol = 0,
1800 .driver_info = UVC_QUIRK_STREAM_NO_FID },
1801 /* Silicon Motion SM371 */
1802 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
1803 | USB_DEVICE_ID_MATCH_INT_INFO,
1804 .idVendor = 0x090c,
1805 .idProduct = 0xb371,
1806 .bInterfaceClass = USB_CLASS_VIDEO,
1807 .bInterfaceSubClass = 1,
1808 .bInterfaceProtocol = 0,
1809 .driver_info = UVC_QUIRK_PROBE_MINMAX },
1810 /* MT6227 */
1811 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
1812 | USB_DEVICE_ID_MATCH_INT_INFO,
1813 .idVendor = 0x0e8d,
1814 .idProduct = 0x0004,
1815 .bInterfaceClass = USB_CLASS_VIDEO,
1816 .bInterfaceSubClass = 1,
1817 .bInterfaceProtocol = 0,
1818 .driver_info = UVC_QUIRK_PROBE_MINMAX },
1819 /* Syntek (HP Spartan) */
1820 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
1821 | USB_DEVICE_ID_MATCH_INT_INFO,
1822 .idVendor = 0x174f,
1823 .idProduct = 0x5212,
1824 .bInterfaceClass = USB_CLASS_VIDEO,
1825 .bInterfaceSubClass = 1,
1826 .bInterfaceProtocol = 0,
1827 .driver_info = UVC_QUIRK_STREAM_NO_FID },
1828 /* Syntek (Asus U3S) */
1829 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
1830 | USB_DEVICE_ID_MATCH_INT_INFO,
1831 .idVendor = 0x174f,
1832 .idProduct = 0x8a33,
1833 .bInterfaceClass = USB_CLASS_VIDEO,
1834 .bInterfaceSubClass = 1,
1835 .bInterfaceProtocol = 0,
1836 .driver_info = UVC_QUIRK_STREAM_NO_FID },
1837 /* Ecamm Pico iMage */
1838 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
1839 | USB_DEVICE_ID_MATCH_INT_INFO,
1840 .idVendor = 0x18cd,
1841 .idProduct = 0xcafe,
1842 .bInterfaceClass = USB_CLASS_VIDEO,
1843 .bInterfaceSubClass = 1,
1844 .bInterfaceProtocol = 0,
1845 .driver_info = UVC_QUIRK_PROBE_EXTRAFIELDS },
1846 /* Bodelin ProScopeHR */
1847 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
1848 | USB_DEVICE_ID_MATCH_DEV_HI
1849 | USB_DEVICE_ID_MATCH_INT_INFO,
1850 .idVendor = 0x19ab,
1851 .idProduct = 0x1000,
1852 .bcdDevice_hi = 0x0126,
1853 .bInterfaceClass = USB_CLASS_VIDEO,
1854 .bInterfaceSubClass = 1,
1855 .bInterfaceProtocol = 0,
1856 .driver_info = UVC_QUIRK_STATUS_INTERVAL },
1857 /* SiGma Micro USB Web Camera */
1858 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
1859 | USB_DEVICE_ID_MATCH_INT_INFO,
1860 .idVendor = 0x1c4f,
1861 .idProduct = 0x3000,
1862 .bInterfaceClass = USB_CLASS_VIDEO,
1863 .bInterfaceSubClass = 1,
1864 .bInterfaceProtocol = 0,
1865 .driver_info = UVC_QUIRK_PROBE_MINMAX
1866 | UVC_QUIRK_IGNORE_SELECTOR_UNIT},
1867 /* Acer OEM Webcam - Unknown vendor */
1868 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
1869 | USB_DEVICE_ID_MATCH_INT_INFO,
1870 .idVendor = 0x5986,
1871 .idProduct = 0x0100,
1872 .bInterfaceClass = USB_CLASS_VIDEO,
1873 .bInterfaceSubClass = 1,
1874 .bInterfaceProtocol = 0,
1875 .driver_info = UVC_QUIRK_PROBE_MINMAX },
1876 /* Packard Bell OEM Webcam */
1877 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
1878 | USB_DEVICE_ID_MATCH_INT_INFO,
1879 .idVendor = 0x5986,
1880 .idProduct = 0x0101,
1881 .bInterfaceClass = USB_CLASS_VIDEO,
1882 .bInterfaceSubClass = 1,
1883 .bInterfaceProtocol = 0,
1884 .driver_info = UVC_QUIRK_PROBE_MINMAX },
1885 /* Acer Crystal Eye webcam */
1886 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
1887 | USB_DEVICE_ID_MATCH_INT_INFO,
1888 .idVendor = 0x5986,
1889 .idProduct = 0x0102,
1890 .bInterfaceClass = USB_CLASS_VIDEO,
1891 .bInterfaceSubClass = 1,
1892 .bInterfaceProtocol = 0,
1893 .driver_info = UVC_QUIRK_PROBE_MINMAX },
1894 /* Acer OrbiCam - Unknown vendor */
1895 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
1896 | USB_DEVICE_ID_MATCH_INT_INFO,
1897 .idVendor = 0x5986,
1898 .idProduct = 0x0200,
1899 .bInterfaceClass = USB_CLASS_VIDEO,
1900 .bInterfaceSubClass = 1,
1901 .bInterfaceProtocol = 0,
1902 .driver_info = UVC_QUIRK_PROBE_MINMAX },
1903 /* Generic USB Video Class */
1904 { USB_INTERFACE_INFO(USB_CLASS_VIDEO, 1, 0) },
1905 {}
1906};
1907
1908MODULE_DEVICE_TABLE(usb, uvc_ids);
1909
1910struct uvc_driver uvc_driver = {
1911 .driver = {
1912 .name = "uvcvideo",
1913 .probe = uvc_probe,
1914 .disconnect = uvc_disconnect,
1915 .suspend = uvc_suspend,
1916 .resume = uvc_resume,
1917 .id_table = uvc_ids,
1918 .supports_autosuspend = 1,
1919 },
1920};
1921
1922static int __init uvc_init(void)
1923{
1924 int result;
1925
1926 INIT_LIST_HEAD(&uvc_driver.devices);
1927 INIT_LIST_HEAD(&uvc_driver.controls);
1928 mutex_init(&uvc_driver.open_mutex);
1929 mutex_init(&uvc_driver.ctrl_mutex);
1930
1931 uvc_ctrl_init();
1932
1933 result = usb_register(&uvc_driver.driver);
1934 if (result == 0)
1935 printk(KERN_INFO DRIVER_DESC " (" DRIVER_VERSION ")\n");
1936 return result;
1937}
1938
1939static void __exit uvc_cleanup(void)
1940{
1941 usb_deregister(&uvc_driver.driver);
1942}
1943
1944module_init(uvc_init);
1945module_exit(uvc_cleanup);
1946
1947module_param_named(quirks, uvc_quirks_param, uint, S_IRUGO|S_IWUSR);
1948MODULE_PARM_DESC(quirks, "Forced device quirks");
1949module_param_named(trace, uvc_trace_param, uint, S_IRUGO|S_IWUSR);
1950MODULE_PARM_DESC(trace, "Trace level bitmask");
1951
1952MODULE_AUTHOR(DRIVER_AUTHOR);
1953MODULE_DESCRIPTION(DRIVER_DESC);
1954MODULE_LICENSE("GPL");
1955MODULE_VERSION(DRIVER_VERSION);
diff --git a/drivers/media/video/uvc/uvc_isight.c b/drivers/media/video/uvc/uvc_isight.c
new file mode 100644
index 000000000000..37bdefdbead5
--- /dev/null
+++ b/drivers/media/video/uvc/uvc_isight.c
@@ -0,0 +1,134 @@
1/*
2 * uvc_isight.c -- USB Video Class driver - iSight support
3 *
4 * Copyright (C) 2006-2007
5 * Ivan N. Zlatev <contact@i-nz.net>
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 */
13
14#include <linux/usb.h>
15#include <linux/kernel.h>
16#include <linux/mm.h>
17
18#include "uvcvideo.h"
19
20/* Built-in iSight webcams implements most of UVC 1.0 except a
21 * different packet format. Instead of sending a header at the
22 * beginning of each isochronous transfer payload, the webcam sends a
23 * single header per image (on its own in a packet), followed by
24 * packets containing data only.
25 *
26 * Offset Size (bytes) Description
27 * ------------------------------------------------------------------
28 * 0x00 1 Header length
29 * 0x01 1 Flags (UVC-compliant)
30 * 0x02 4 Always equal to '11223344'
31 * 0x06 8 Always equal to 'deadbeefdeadface'
32 * 0x0e 16 Unknown
33 *
34 * The header can be prefixed by an optional, unknown-purpose byte.
35 */
36
37static int isight_decode(struct uvc_video_queue *queue, struct uvc_buffer *buf,
38 const __u8 *data, unsigned int len)
39{
40 static const __u8 hdr[] = {
41 0x11, 0x22, 0x33, 0x44,
42 0xde, 0xad, 0xbe, 0xef,
43 0xde, 0xad, 0xfa, 0xce
44 };
45
46 unsigned int maxlen, nbytes;
47 __u8 *mem;
48 int is_header = 0;
49
50 if (buf == NULL)
51 return 0;
52
53 if ((len >= 14 && memcmp(&data[2], hdr, 12) == 0) ||
54 (len >= 15 && memcmp(&data[3], hdr, 12) == 0)) {
55 uvc_trace(UVC_TRACE_FRAME, "iSight header found\n");
56 is_header = 1;
57 }
58
59 /* Synchronize to the input stream by waiting for a header packet. */
60 if (buf->state != UVC_BUF_STATE_ACTIVE) {
61 if (!is_header) {
62 uvc_trace(UVC_TRACE_FRAME, "Dropping packet (out of "
63 "sync).\n");
64 return 0;
65 }
66
67 buf->state = UVC_BUF_STATE_ACTIVE;
68 }
69
70 /* Mark the buffer as done if we're at the beginning of a new frame.
71 *
72 * Empty buffers (bytesused == 0) don't trigger end of frame detection
73 * as it doesn't make sense to return an empty buffer.
74 */
75 if (is_header && buf->buf.bytesused != 0) {
76 buf->state = UVC_BUF_STATE_DONE;
77 return -EAGAIN;
78 }
79
80 /* Copy the video data to the buffer. Skip header packets, as they
81 * contain no data.
82 */
83 if (!is_header) {
84 maxlen = buf->buf.length - buf->buf.bytesused;
85 mem = queue->mem + buf->buf.m.offset + buf->buf.bytesused;
86 nbytes = min(len, maxlen);
87 memcpy(mem, data, nbytes);
88 buf->buf.bytesused += nbytes;
89
90 if (len > maxlen || buf->buf.bytesused == buf->buf.length) {
91 uvc_trace(UVC_TRACE_FRAME, "Frame complete "
92 "(overflow).\n");
93 buf->state = UVC_BUF_STATE_DONE;
94 }
95 }
96
97 return 0;
98}
99
100void uvc_video_decode_isight(struct urb *urb, struct uvc_video_device *video,
101 struct uvc_buffer *buf)
102{
103 int ret, i;
104
105 for (i = 0; i < urb->number_of_packets; ++i) {
106 if (urb->iso_frame_desc[i].status < 0) {
107 uvc_trace(UVC_TRACE_FRAME, "USB isochronous frame "
108 "lost (%d).\n",
109 urb->iso_frame_desc[i].status);
110 }
111
112 /* Decode the payload packet.
113 * uvc_video_decode is entered twice when a frame transition
114 * has been detected because the end of frame can only be
115 * reliably detected when the first packet of the new frame
116 * is processed. The first pass detects the transition and
117 * closes the previous frame's buffer, the second pass
118 * processes the data of the first payload of the new frame.
119 */
120 do {
121 ret = isight_decode(&video->queue, buf,
122 urb->transfer_buffer +
123 urb->iso_frame_desc[i].offset,
124 urb->iso_frame_desc[i].actual_length);
125
126 if (buf == NULL)
127 break;
128
129 if (buf->state == UVC_BUF_STATE_DONE ||
130 buf->state == UVC_BUF_STATE_ERROR)
131 buf = uvc_queue_next_buffer(&video->queue, buf);
132 } while (ret == -EAGAIN);
133 }
134}
diff --git a/drivers/media/video/uvc/uvc_queue.c b/drivers/media/video/uvc/uvc_queue.c
new file mode 100644
index 000000000000..0923f0e3b3d4
--- /dev/null
+++ b/drivers/media/video/uvc/uvc_queue.c
@@ -0,0 +1,477 @@
1/*
2 * uvc_queue.c -- USB Video Class driver - Buffers management
3 *
4 * Copyright (C) 2005-2008
5 * Laurent Pinchart (laurent.pinchart@skynet.be)
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 */
13
14#include <linux/kernel.h>
15#include <linux/version.h>
16#include <linux/list.h>
17#include <linux/module.h>
18#include <linux/usb.h>
19#include <linux/videodev2.h>
20#include <linux/vmalloc.h>
21#include <linux/wait.h>
22#include <asm/atomic.h>
23
24#include "uvcvideo.h"
25
26/* ------------------------------------------------------------------------
27 * Video buffers queue management.
28 *
29 * Video queues is initialized by uvc_queue_init(). The function performs
30 * basic initialization of the uvc_video_queue struct and never fails.
31 *
32 * Video buffer allocation and freeing are performed by uvc_alloc_buffers and
33 * uvc_free_buffers respectively. The former acquires the video queue lock,
34 * while the later must be called with the lock held (so that allocation can
35 * free previously allocated buffers). Trying to free buffers that are mapped
36 * to user space will return -EBUSY.
37 *
38 * Video buffers are managed using two queues. However, unlike most USB video
39 * drivers which use an in queue and an out queue, we use a main queue which
40 * holds all queued buffers (both 'empty' and 'done' buffers), and an irq
41 * queue which holds empty buffers. This design (copied from video-buf)
42 * minimizes locking in interrupt, as only one queue is shared between
43 * interrupt and user contexts.
44 *
45 * Use cases
46 * ---------
47 *
48 * Unless stated otherwise, all operations which modify the irq buffers queue
49 * are protected by the irq spinlock.
50 *
51 * 1. The user queues the buffers, starts streaming and dequeues a buffer.
52 *
53 * The buffers are added to the main and irq queues. Both operations are
54 * protected by the queue lock, and the latert is protected by the irq
55 * spinlock as well.
56 *
57 * The completion handler fetches a buffer from the irq queue and fills it
58 * with video data. If no buffer is available (irq queue empty), the handler
59 * returns immediately.
60 *
61 * When the buffer is full, the completion handler removes it from the irq
62 * queue, marks it as ready (UVC_BUF_STATE_DONE) and wake its wait queue.
63 * At that point, any process waiting on the buffer will be woken up. If a
64 * process tries to dequeue a buffer after it has been marked ready, the
65 * dequeing will succeed immediately.
66 *
67 * 2. Buffers are queued, user is waiting on a buffer and the device gets
68 * disconnected.
69 *
70 * When the device is disconnected, the kernel calls the completion handler
71 * with an appropriate status code. The handler marks all buffers in the
72 * irq queue as being erroneous (UVC_BUF_STATE_ERROR) and wakes them up so
73 * that any process waiting on a buffer gets woken up.
74 *
75 * Waking up up the first buffer on the irq list is not enough, as the
76 * process waiting on the buffer might restart the dequeue operation
77 * immediately.
78 *
79 */
80
81void uvc_queue_init(struct uvc_video_queue *queue)
82{
83 mutex_init(&queue->mutex);
84 spin_lock_init(&queue->irqlock);
85 INIT_LIST_HEAD(&queue->mainqueue);
86 INIT_LIST_HEAD(&queue->irqqueue);
87}
88
89/*
90 * Allocate the video buffers.
91 *
92 * Pages are reserved to make sure they will not be swaped, as they will be
93 * filled in URB completion handler.
94 *
95 * Buffers will be individually mapped, so they must all be page aligned.
96 */
97int uvc_alloc_buffers(struct uvc_video_queue *queue, unsigned int nbuffers,
98 unsigned int buflength)
99{
100 unsigned int bufsize = PAGE_ALIGN(buflength);
101 unsigned int i;
102 void *mem = NULL;
103 int ret;
104
105 if (nbuffers > UVC_MAX_VIDEO_BUFFERS)
106 nbuffers = UVC_MAX_VIDEO_BUFFERS;
107
108 mutex_lock(&queue->mutex);
109
110 if ((ret = uvc_free_buffers(queue)) < 0)
111 goto done;
112
113 /* Bail out if no buffers should be allocated. */
114 if (nbuffers == 0)
115 goto done;
116
117 /* Decrement the number of buffers until allocation succeeds. */
118 for (; nbuffers > 0; --nbuffers) {
119 mem = vmalloc_32(nbuffers * bufsize);
120 if (mem != NULL)
121 break;
122 }
123
124 if (mem == NULL) {
125 ret = -ENOMEM;
126 goto done;
127 }
128
129 for (i = 0; i < nbuffers; ++i) {
130 memset(&queue->buffer[i], 0, sizeof queue->buffer[i]);
131 queue->buffer[i].buf.index = i;
132 queue->buffer[i].buf.m.offset = i * bufsize;
133 queue->buffer[i].buf.length = buflength;
134 queue->buffer[i].buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
135 queue->buffer[i].buf.sequence = 0;
136 queue->buffer[i].buf.field = V4L2_FIELD_NONE;
137 queue->buffer[i].buf.memory = V4L2_MEMORY_MMAP;
138 queue->buffer[i].buf.flags = 0;
139 init_waitqueue_head(&queue->buffer[i].wait);
140 }
141
142 queue->mem = mem;
143 queue->count = nbuffers;
144 queue->buf_size = bufsize;
145 ret = nbuffers;
146
147done:
148 mutex_unlock(&queue->mutex);
149 return ret;
150}
151
152/*
153 * Free the video buffers.
154 *
155 * This function must be called with the queue lock held.
156 */
157int uvc_free_buffers(struct uvc_video_queue *queue)
158{
159 unsigned int i;
160
161 for (i = 0; i < queue->count; ++i) {
162 if (queue->buffer[i].vma_use_count != 0)
163 return -EBUSY;
164 }
165
166 if (queue->count) {
167 vfree(queue->mem);
168 queue->count = 0;
169 }
170
171 return 0;
172}
173
174static void __uvc_query_buffer(struct uvc_buffer *buf,
175 struct v4l2_buffer *v4l2_buf)
176{
177 memcpy(v4l2_buf, &buf->buf, sizeof *v4l2_buf);
178
179 if (buf->vma_use_count)
180 v4l2_buf->flags |= V4L2_BUF_FLAG_MAPPED;
181
182 switch (buf->state) {
183 case UVC_BUF_STATE_ERROR:
184 case UVC_BUF_STATE_DONE:
185 v4l2_buf->flags |= V4L2_BUF_FLAG_DONE;
186 break;
187 case UVC_BUF_STATE_QUEUED:
188 case UVC_BUF_STATE_ACTIVE:
189 v4l2_buf->flags |= V4L2_BUF_FLAG_QUEUED;
190 break;
191 case UVC_BUF_STATE_IDLE:
192 default:
193 break;
194 }
195}
196
197int uvc_query_buffer(struct uvc_video_queue *queue,
198 struct v4l2_buffer *v4l2_buf)
199{
200 int ret = 0;
201
202 mutex_lock(&queue->mutex);
203 if (v4l2_buf->index >= queue->count) {
204 ret = -EINVAL;
205 goto done;
206 }
207
208 __uvc_query_buffer(&queue->buffer[v4l2_buf->index], v4l2_buf);
209
210done:
211 mutex_unlock(&queue->mutex);
212 return ret;
213}
214
215/*
216 * Queue a video buffer. Attempting to queue a buffer that has already been
217 * queued will return -EINVAL.
218 */
219int uvc_queue_buffer(struct uvc_video_queue *queue,
220 struct v4l2_buffer *v4l2_buf)
221{
222 struct uvc_buffer *buf;
223 unsigned long flags;
224 int ret = 0;
225
226 uvc_trace(UVC_TRACE_CAPTURE, "Queuing buffer %u.\n", v4l2_buf->index);
227
228 if (v4l2_buf->type != V4L2_BUF_TYPE_VIDEO_CAPTURE ||
229 v4l2_buf->memory != V4L2_MEMORY_MMAP) {
230 uvc_trace(UVC_TRACE_CAPTURE, "[E] Invalid buffer type (%u) "
231 "and/or memory (%u).\n", v4l2_buf->type,
232 v4l2_buf->memory);
233 return -EINVAL;
234 }
235
236 mutex_lock(&queue->mutex);
237 if (v4l2_buf->index >= queue->count) {
238 uvc_trace(UVC_TRACE_CAPTURE, "[E] Out of range index.\n");
239 ret = -EINVAL;
240 goto done;
241 }
242
243 buf = &queue->buffer[v4l2_buf->index];
244 if (buf->state != UVC_BUF_STATE_IDLE) {
245 uvc_trace(UVC_TRACE_CAPTURE, "[E] Invalid buffer state "
246 "(%u).\n", buf->state);
247 ret = -EINVAL;
248 goto done;
249 }
250
251 spin_lock_irqsave(&queue->irqlock, flags);
252 if (queue->flags & UVC_QUEUE_DISCONNECTED) {
253 spin_unlock_irqrestore(&queue->irqlock, flags);
254 ret = -ENODEV;
255 goto done;
256 }
257 buf->state = UVC_BUF_STATE_QUEUED;
258 buf->buf.bytesused = 0;
259 list_add_tail(&buf->stream, &queue->mainqueue);
260 list_add_tail(&buf->queue, &queue->irqqueue);
261 spin_unlock_irqrestore(&queue->irqlock, flags);
262
263done:
264 mutex_unlock(&queue->mutex);
265 return ret;
266}
267
268static int uvc_queue_waiton(struct uvc_buffer *buf, int nonblocking)
269{
270 if (nonblocking) {
271 return (buf->state != UVC_BUF_STATE_QUEUED &&
272 buf->state != UVC_BUF_STATE_ACTIVE)
273 ? 0 : -EAGAIN;
274 }
275
276 return wait_event_interruptible(buf->wait,
277 buf->state != UVC_BUF_STATE_QUEUED &&
278 buf->state != UVC_BUF_STATE_ACTIVE);
279}
280
281/*
282 * Dequeue a video buffer. If nonblocking is false, block until a buffer is
283 * available.
284 */
285int uvc_dequeue_buffer(struct uvc_video_queue *queue,
286 struct v4l2_buffer *v4l2_buf, int nonblocking)
287{
288 struct uvc_buffer *buf;
289 int ret = 0;
290
291 if (v4l2_buf->type != V4L2_BUF_TYPE_VIDEO_CAPTURE ||
292 v4l2_buf->memory != V4L2_MEMORY_MMAP) {
293 uvc_trace(UVC_TRACE_CAPTURE, "[E] Invalid buffer type (%u) "
294 "and/or memory (%u).\n", v4l2_buf->type,
295 v4l2_buf->memory);
296 return -EINVAL;
297 }
298
299 mutex_lock(&queue->mutex);
300 if (list_empty(&queue->mainqueue)) {
301 uvc_trace(UVC_TRACE_CAPTURE, "[E] Empty buffer queue.\n");
302 ret = -EINVAL;
303 goto done;
304 }
305
306 buf = list_first_entry(&queue->mainqueue, struct uvc_buffer, stream);
307 if ((ret = uvc_queue_waiton(buf, nonblocking)) < 0)
308 goto done;
309
310 uvc_trace(UVC_TRACE_CAPTURE, "Dequeuing buffer %u (%u, %u bytes).\n",
311 buf->buf.index, buf->state, buf->buf.bytesused);
312
313 switch (buf->state) {
314 case UVC_BUF_STATE_ERROR:
315 uvc_trace(UVC_TRACE_CAPTURE, "[W] Corrupted data "
316 "(transmission error).\n");
317 ret = -EIO;
318 case UVC_BUF_STATE_DONE:
319 buf->state = UVC_BUF_STATE_IDLE;
320 break;
321
322 case UVC_BUF_STATE_IDLE:
323 case UVC_BUF_STATE_QUEUED:
324 case UVC_BUF_STATE_ACTIVE:
325 default:
326 uvc_trace(UVC_TRACE_CAPTURE, "[E] Invalid buffer state %u "
327 "(driver bug?).\n", buf->state);
328 ret = -EINVAL;
329 goto done;
330 }
331
332 list_del(&buf->stream);
333 __uvc_query_buffer(buf, v4l2_buf);
334
335done:
336 mutex_unlock(&queue->mutex);
337 return ret;
338}
339
340/*
341 * Poll the video queue.
342 *
343 * This function implements video queue polling and is intended to be used by
344 * the device poll handler.
345 */
346unsigned int uvc_queue_poll(struct uvc_video_queue *queue, struct file *file,
347 poll_table *wait)
348{
349 struct uvc_buffer *buf;
350 unsigned int mask = 0;
351
352 mutex_lock(&queue->mutex);
353 if (list_empty(&queue->mainqueue)) {
354 mask |= POLLERR;
355 goto done;
356 }
357 buf = list_first_entry(&queue->mainqueue, struct uvc_buffer, stream);
358
359 poll_wait(file, &buf->wait, wait);
360 if (buf->state == UVC_BUF_STATE_DONE ||
361 buf->state == UVC_BUF_STATE_ERROR)
362 mask |= POLLIN | POLLRDNORM;
363
364done:
365 mutex_unlock(&queue->mutex);
366 return mask;
367}
368
369/*
370 * Enable or disable the video buffers queue.
371 *
372 * The queue must be enabled before starting video acquisition and must be
373 * disabled after stopping it. This ensures that the video buffers queue
374 * state can be properly initialized before buffers are accessed from the
375 * interrupt handler.
376 *
377 * Enabling the video queue initializes parameters (such as sequence number,
378 * sync pattern, ...). If the queue is already enabled, return -EBUSY.
379 *
380 * Disabling the video queue cancels the queue and removes all buffers from
381 * the main queue.
382 *
383 * This function can't be called from interrupt context. Use
384 * uvc_queue_cancel() instead.
385 */
386int uvc_queue_enable(struct uvc_video_queue *queue, int enable)
387{
388 unsigned int i;
389 int ret = 0;
390
391 mutex_lock(&queue->mutex);
392 if (enable) {
393 if (uvc_queue_streaming(queue)) {
394 ret = -EBUSY;
395 goto done;
396 }
397 queue->sequence = 0;
398 queue->flags |= UVC_QUEUE_STREAMING;
399 } else {
400 uvc_queue_cancel(queue, 0);
401 INIT_LIST_HEAD(&queue->mainqueue);
402
403 for (i = 0; i < queue->count; ++i)
404 queue->buffer[i].state = UVC_BUF_STATE_IDLE;
405
406 queue->flags &= ~UVC_QUEUE_STREAMING;
407 }
408
409done:
410 mutex_unlock(&queue->mutex);
411 return ret;
412}
413
414/*
415 * Cancel the video buffers queue.
416 *
417 * Cancelling the queue marks all buffers on the irq queue as erroneous,
418 * wakes them up and remove them from the queue.
419 *
420 * If the disconnect parameter is set, further calls to uvc_queue_buffer will
421 * fail with -ENODEV.
422 *
423 * This function acquires the irq spinlock and can be called from interrupt
424 * context.
425 */
426void uvc_queue_cancel(struct uvc_video_queue *queue, int disconnect)
427{
428 struct uvc_buffer *buf;
429 unsigned long flags;
430
431 spin_lock_irqsave(&queue->irqlock, flags);
432 while (!list_empty(&queue->irqqueue)) {
433 buf = list_first_entry(&queue->irqqueue, struct uvc_buffer,
434 queue);
435 list_del(&buf->queue);
436 buf->state = UVC_BUF_STATE_ERROR;
437 wake_up(&buf->wait);
438 }
439 /* This must be protected by the irqlock spinlock to avoid race
440 * conditions between uvc_queue_buffer and the disconnection event that
441 * could result in an interruptible wait in uvc_dequeue_buffer. Do not
442 * blindly replace this logic by checking for the UVC_DEV_DISCONNECTED
443 * state outside the queue code.
444 */
445 if (disconnect)
446 queue->flags |= UVC_QUEUE_DISCONNECTED;
447 spin_unlock_irqrestore(&queue->irqlock, flags);
448}
449
450struct uvc_buffer *uvc_queue_next_buffer(struct uvc_video_queue *queue,
451 struct uvc_buffer *buf)
452{
453 struct uvc_buffer *nextbuf;
454 unsigned long flags;
455
456 if ((queue->flags & UVC_QUEUE_DROP_INCOMPLETE) &&
457 buf->buf.length != buf->buf.bytesused) {
458 buf->state = UVC_BUF_STATE_QUEUED;
459 buf->buf.bytesused = 0;
460 return buf;
461 }
462
463 spin_lock_irqsave(&queue->irqlock, flags);
464 list_del(&buf->queue);
465 if (!list_empty(&queue->irqqueue))
466 nextbuf = list_first_entry(&queue->irqqueue, struct uvc_buffer,
467 queue);
468 else
469 nextbuf = NULL;
470 spin_unlock_irqrestore(&queue->irqlock, flags);
471
472 buf->buf.sequence = queue->sequence++;
473 do_gettimeofday(&buf->buf.timestamp);
474
475 wake_up(&buf->wait);
476 return nextbuf;
477}
diff --git a/drivers/media/video/uvc/uvc_status.c b/drivers/media/video/uvc/uvc_status.c
new file mode 100644
index 000000000000..be9084e5eace
--- /dev/null
+++ b/drivers/media/video/uvc/uvc_status.c
@@ -0,0 +1,207 @@
1/*
2 * uvc_status.c -- USB Video Class driver - Status endpoint
3 *
4 * Copyright (C) 2007-2008
5 * Laurent Pinchart (laurent.pinchart@skynet.be)
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 */
13
14#include <linux/kernel.h>
15#include <linux/version.h>
16#include <linux/input.h>
17#include <linux/usb.h>
18#include <linux/usb/input.h>
19
20#include "uvcvideo.h"
21
22/* --------------------------------------------------------------------------
23 * Input device
24 */
25static int uvc_input_init(struct uvc_device *dev)
26{
27 struct usb_device *udev = dev->udev;
28 struct input_dev *input;
29 char *phys = NULL;
30 int ret;
31
32 input = input_allocate_device();
33 if (input == NULL)
34 return -ENOMEM;
35
36 phys = kmalloc(6 + strlen(udev->bus->bus_name) + strlen(udev->devpath),
37 GFP_KERNEL);
38 if (phys == NULL) {
39 ret = -ENOMEM;
40 goto error;
41 }
42 sprintf(phys, "usb-%s-%s", udev->bus->bus_name, udev->devpath);
43
44 input->name = dev->name;
45 input->phys = phys;
46 usb_to_input_id(udev, &input->id);
47 input->dev.parent = &dev->intf->dev;
48
49 set_bit(EV_KEY, input->evbit);
50 set_bit(BTN_0, input->keybit);
51
52 if ((ret = input_register_device(input)) < 0)
53 goto error;
54
55 dev->input = input;
56 return 0;
57
58error:
59 input_free_device(input);
60 kfree(phys);
61 return ret;
62}
63
64static void uvc_input_cleanup(struct uvc_device *dev)
65{
66 if (dev->input)
67 input_unregister_device(dev->input);
68}
69
70/* --------------------------------------------------------------------------
71 * Status interrupt endpoint
72 */
73static void uvc_event_streaming(struct uvc_device *dev, __u8 *data, int len)
74{
75 if (len < 3) {
76 uvc_trace(UVC_TRACE_STATUS, "Invalid streaming status event "
77 "received.\n");
78 return;
79 }
80
81 if (data[2] == 0) {
82 if (len < 4)
83 return;
84 uvc_trace(UVC_TRACE_STATUS, "Button (intf %u) %s len %d\n",
85 data[1], data[3] ? "pressed" : "released", len);
86 if (dev->input)
87 input_report_key(dev->input, BTN_0, data[3]);
88 } else {
89 uvc_trace(UVC_TRACE_STATUS, "Stream %u error event %02x %02x "
90 "len %d.\n", data[1], data[2], data[3], len);
91 }
92}
93
94static void uvc_event_control(struct uvc_device *dev, __u8 *data, int len)
95{
96 char *attrs[3] = { "value", "info", "failure" };
97
98 if (len < 6 || data[2] != 0 || data[4] > 2) {
99 uvc_trace(UVC_TRACE_STATUS, "Invalid control status event "
100 "received.\n");
101 return;
102 }
103
104 uvc_trace(UVC_TRACE_STATUS, "Control %u/%u %s change len %d.\n",
105 data[1], data[3], attrs[data[4]], len);
106}
107
108static void uvc_status_complete(struct urb *urb)
109{
110 struct uvc_device *dev = urb->context;
111 int len, ret;
112
113 switch (urb->status) {
114 case 0:
115 break;
116
117 case -ENOENT: /* usb_kill_urb() called. */
118 case -ECONNRESET: /* usb_unlink_urb() called. */
119 case -ESHUTDOWN: /* The endpoint is being disabled. */
120 case -EPROTO: /* Device is disconnected (reported by some
121 * host controller). */
122 return;
123
124 default:
125 uvc_printk(KERN_WARNING, "Non-zero status (%d) in status "
126 "completion handler.\n", urb->status);
127 return;
128 }
129
130 len = urb->actual_length;
131 if (len > 0) {
132 switch (dev->status[0] & 0x0f) {
133 case UVC_STATUS_TYPE_CONTROL:
134 uvc_event_control(dev, dev->status, len);
135 break;
136
137 case UVC_STATUS_TYPE_STREAMING:
138 uvc_event_streaming(dev, dev->status, len);
139 break;
140
141 default:
142 uvc_printk(KERN_INFO, "unknown event type %u.\n",
143 dev->status[0]);
144 break;
145 }
146 }
147
148 /* Resubmit the URB. */
149 urb->interval = dev->int_ep->desc.bInterval;
150 if ((ret = usb_submit_urb(urb, GFP_ATOMIC)) < 0) {
151 uvc_printk(KERN_ERR, "Failed to resubmit status URB (%d).\n",
152 ret);
153 }
154}
155
156int uvc_status_init(struct uvc_device *dev)
157{
158 struct usb_host_endpoint *ep = dev->int_ep;
159 unsigned int pipe;
160 int interval;
161
162 if (ep == NULL)
163 return 0;
164
165 uvc_input_init(dev);
166
167 dev->int_urb = usb_alloc_urb(0, GFP_KERNEL);
168 if (dev->int_urb == NULL)
169 return -ENOMEM;
170
171 pipe = usb_rcvintpipe(dev->udev, ep->desc.bEndpointAddress);
172
173 /* For high-speed interrupt endpoints, the bInterval value is used as
174 * an exponent of two. Some developers forgot about it.
175 */
176 interval = ep->desc.bInterval;
177 if (interval > 16 && dev->udev->speed == USB_SPEED_HIGH &&
178 (dev->quirks & UVC_QUIRK_STATUS_INTERVAL))
179 interval = fls(interval) - 1;
180
181 usb_fill_int_urb(dev->int_urb, dev->udev, pipe,
182 dev->status, sizeof dev->status, uvc_status_complete,
183 dev, interval);
184
185 return usb_submit_urb(dev->int_urb, GFP_KERNEL);
186}
187
188void uvc_status_cleanup(struct uvc_device *dev)
189{
190 usb_kill_urb(dev->int_urb);
191 usb_free_urb(dev->int_urb);
192 uvc_input_cleanup(dev);
193}
194
195int uvc_status_suspend(struct uvc_device *dev)
196{
197 usb_kill_urb(dev->int_urb);
198 return 0;
199}
200
201int uvc_status_resume(struct uvc_device *dev)
202{
203 if (dev->int_urb == NULL)
204 return 0;
205
206 return usb_submit_urb(dev->int_urb, GFP_KERNEL);
207}
diff --git a/drivers/media/video/uvc/uvc_v4l2.c b/drivers/media/video/uvc/uvc_v4l2.c
new file mode 100644
index 000000000000..2e0a66575bb4
--- /dev/null
+++ b/drivers/media/video/uvc/uvc_v4l2.c
@@ -0,0 +1,1105 @@
1/*
2 * uvc_v4l2.c -- USB Video Class driver - V4L2 API
3 *
4 * Copyright (C) 2005-2008
5 * Laurent Pinchart (laurent.pinchart@skynet.be)
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 */
13
14#include <linux/kernel.h>
15#include <linux/version.h>
16#include <linux/list.h>
17#include <linux/module.h>
18#include <linux/usb.h>
19#include <linux/videodev2.h>
20#include <linux/vmalloc.h>
21#include <linux/mm.h>
22#include <linux/wait.h>
23#include <asm/atomic.h>
24
25#include <media/v4l2-common.h>
26
27#include "uvcvideo.h"
28
29/* ------------------------------------------------------------------------
30 * V4L2 interface
31 */
32
33/*
34 * Mapping V4L2 controls to UVC controls can be straighforward if done well.
35 * Most of the UVC controls exist in V4L2, and can be mapped directly. Some
36 * must be grouped (for instance the Red Balance, Blue Balance and Do White
37 * Balance V4L2 controls use the White Balance Component UVC control) or
38 * otherwise translated. The approach we take here is to use a translation
39 * table for the controls which can be mapped directly, and handle the others
40 * manually.
41 */
42static int uvc_v4l2_query_menu(struct uvc_video_device *video,
43 struct v4l2_querymenu *query_menu)
44{
45 struct uvc_menu_info *menu_info;
46 struct uvc_control_mapping *mapping;
47 struct uvc_control *ctrl;
48
49 ctrl = uvc_find_control(video, query_menu->id, &mapping);
50 if (ctrl == NULL || mapping->v4l2_type != V4L2_CTRL_TYPE_MENU)
51 return -EINVAL;
52
53 if (query_menu->index >= mapping->menu_count)
54 return -EINVAL;
55
56 menu_info = &mapping->menu_info[query_menu->index];
57 strncpy(query_menu->name, menu_info->name, 32);
58 return 0;
59}
60
61/*
62 * Find the frame interval closest to the requested frame interval for the
63 * given frame format and size. This should be done by the device as part of
64 * the Video Probe and Commit negotiation, but some hardware don't implement
65 * that feature.
66 */
67static __u32 uvc_try_frame_interval(struct uvc_frame *frame, __u32 interval)
68{
69 unsigned int i;
70
71 if (frame->bFrameIntervalType) {
72 __u32 best = -1, dist;
73
74 for (i = 0; i < frame->bFrameIntervalType; ++i) {
75 dist = interval > frame->dwFrameInterval[i]
76 ? interval - frame->dwFrameInterval[i]
77 : frame->dwFrameInterval[i] - interval;
78
79 if (dist > best)
80 break;
81
82 best = dist;
83 }
84
85 interval = frame->dwFrameInterval[i-1];
86 } else {
87 const __u32 min = frame->dwFrameInterval[0];
88 const __u32 max = frame->dwFrameInterval[1];
89 const __u32 step = frame->dwFrameInterval[2];
90
91 interval = min + (interval - min + step/2) / step * step;
92 if (interval > max)
93 interval = max;
94 }
95
96 return interval;
97}
98
99static int uvc_v4l2_try_format(struct uvc_video_device *video,
100 struct v4l2_format *fmt, struct uvc_streaming_control *probe,
101 struct uvc_format **uvc_format, struct uvc_frame **uvc_frame)
102{
103 struct uvc_format *format = NULL;
104 struct uvc_frame *frame = NULL;
105 __u16 rw, rh;
106 unsigned int d, maxd;
107 unsigned int i;
108 __u32 interval;
109 int ret = 0;
110 __u8 *fcc;
111
112 if (fmt->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
113 return -EINVAL;
114
115 fcc = (__u8 *)&fmt->fmt.pix.pixelformat;
116 uvc_trace(UVC_TRACE_FORMAT, "Trying format 0x%08x (%c%c%c%c): %ux%u.\n",
117 fmt->fmt.pix.pixelformat,
118 fcc[0], fcc[1], fcc[2], fcc[3],
119 fmt->fmt.pix.width, fmt->fmt.pix.height);
120
121 /* Check if the hardware supports the requested format. */
122 for (i = 0; i < video->streaming->nformats; ++i) {
123 format = &video->streaming->format[i];
124 if (format->fcc == fmt->fmt.pix.pixelformat)
125 break;
126 }
127
128 if (format == NULL || format->fcc != fmt->fmt.pix.pixelformat) {
129 uvc_trace(UVC_TRACE_FORMAT, "Unsupported format 0x%08x.\n",
130 fmt->fmt.pix.pixelformat);
131 return -EINVAL;
132 }
133
134 /* Find the closest image size. The distance between image sizes is
135 * the size in pixels of the non-overlapping regions between the
136 * requested size and the frame-specified size.
137 */
138 rw = fmt->fmt.pix.width;
139 rh = fmt->fmt.pix.height;
140 maxd = (unsigned int)-1;
141
142 for (i = 0; i < format->nframes; ++i) {
143 __u16 w = format->frame[i].wWidth;
144 __u16 h = format->frame[i].wHeight;
145
146 d = min(w, rw) * min(h, rh);
147 d = w*h + rw*rh - 2*d;
148 if (d < maxd) {
149 maxd = d;
150 frame = &format->frame[i];
151 }
152
153 if (maxd == 0)
154 break;
155 }
156
157 if (frame == NULL) {
158 uvc_trace(UVC_TRACE_FORMAT, "Unsupported size %ux%u.\n",
159 fmt->fmt.pix.width, fmt->fmt.pix.height);
160 return -EINVAL;
161 }
162
163 /* Use the default frame interval. */
164 interval = frame->dwDefaultFrameInterval;
165 uvc_trace(UVC_TRACE_FORMAT, "Using default frame interval %u.%u us "
166 "(%u.%u fps).\n", interval/10, interval%10, 10000000/interval,
167 (100000000/interval)%10);
168
169 /* Set the format index, frame index and frame interval. */
170 memset(probe, 0, sizeof *probe);
171 probe->bmHint = 1; /* dwFrameInterval */
172 probe->bFormatIndex = format->index;
173 probe->bFrameIndex = frame->bFrameIndex;
174 probe->dwFrameInterval = uvc_try_frame_interval(frame, interval);
175 /* Some webcams stall the probe control set request when the
176 * dwMaxVideoFrameSize field is set to zero. The UVC specification
177 * clearly states that the field is read-only from the host, so this
178 * is a webcam bug. Set dwMaxVideoFrameSize to the value reported by
179 * the webcam to work around the problem.
180 *
181 * The workaround could probably be enabled for all webcams, so the
182 * quirk can be removed if needed. It's currently useful to detect
183 * webcam bugs and fix them before they hit the market (providing
184 * developers test their webcams with the Linux driver as well as with
185 * the Windows driver).
186 */
187 if (video->dev->quirks & UVC_QUIRK_PROBE_EXTRAFIELDS)
188 probe->dwMaxVideoFrameSize =
189 video->streaming->ctrl.dwMaxVideoFrameSize;
190
191 /* Probe the device */
192 if ((ret = uvc_probe_video(video, probe)) < 0)
193 goto done;
194
195 fmt->fmt.pix.width = frame->wWidth;
196 fmt->fmt.pix.height = frame->wHeight;
197 fmt->fmt.pix.field = V4L2_FIELD_NONE;
198 fmt->fmt.pix.bytesperline = format->bpp * frame->wWidth / 8;
199 fmt->fmt.pix.sizeimage = probe->dwMaxVideoFrameSize;
200 fmt->fmt.pix.colorspace = format->colorspace;
201 fmt->fmt.pix.priv = 0;
202
203 if (uvc_format != NULL)
204 *uvc_format = format;
205 if (uvc_frame != NULL)
206 *uvc_frame = frame;
207
208done:
209 return ret;
210}
211
212static int uvc_v4l2_get_format(struct uvc_video_device *video,
213 struct v4l2_format *fmt)
214{
215 struct uvc_format *format = video->streaming->cur_format;
216 struct uvc_frame *frame = video->streaming->cur_frame;
217
218 if (fmt->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
219 return -EINVAL;
220
221 if (format == NULL || frame == NULL)
222 return -EINVAL;
223
224 fmt->fmt.pix.pixelformat = format->fcc;
225 fmt->fmt.pix.width = frame->wWidth;
226 fmt->fmt.pix.height = frame->wHeight;
227 fmt->fmt.pix.field = V4L2_FIELD_NONE;
228 fmt->fmt.pix.bytesperline = format->bpp * frame->wWidth / 8;
229 fmt->fmt.pix.sizeimage = video->streaming->ctrl.dwMaxVideoFrameSize;
230 fmt->fmt.pix.colorspace = format->colorspace;
231 fmt->fmt.pix.priv = 0;
232
233 return 0;
234}
235
236static int uvc_v4l2_set_format(struct uvc_video_device *video,
237 struct v4l2_format *fmt)
238{
239 struct uvc_streaming_control probe;
240 struct uvc_format *format;
241 struct uvc_frame *frame;
242 int ret;
243
244 if (fmt->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
245 return -EINVAL;
246
247 if (uvc_queue_streaming(&video->queue))
248 return -EBUSY;
249
250 ret = uvc_v4l2_try_format(video, fmt, &probe, &format, &frame);
251 if (ret < 0)
252 return ret;
253
254 if ((ret = uvc_set_video_ctrl(video, &probe, 0)) < 0)
255 return ret;
256
257 memcpy(&video->streaming->ctrl, &probe, sizeof probe);
258 video->streaming->cur_format = format;
259 video->streaming->cur_frame = frame;
260
261 return 0;
262}
263
264static int uvc_v4l2_get_streamparm(struct uvc_video_device *video,
265 struct v4l2_streamparm *parm)
266{
267 uint32_t numerator, denominator;
268
269 if (parm->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
270 return -EINVAL;
271
272 numerator = video->streaming->ctrl.dwFrameInterval;
273 denominator = 10000000;
274 uvc_simplify_fraction(&numerator, &denominator, 8, 333);
275
276 memset(parm, 0, sizeof *parm);
277 parm->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
278 parm->parm.capture.capability = V4L2_CAP_TIMEPERFRAME;
279 parm->parm.capture.capturemode = 0;
280 parm->parm.capture.timeperframe.numerator = numerator;
281 parm->parm.capture.timeperframe.denominator = denominator;
282 parm->parm.capture.extendedmode = 0;
283 parm->parm.capture.readbuffers = 0;
284
285 return 0;
286}
287
288static int uvc_v4l2_set_streamparm(struct uvc_video_device *video,
289 struct v4l2_streamparm *parm)
290{
291 struct uvc_frame *frame = video->streaming->cur_frame;
292 struct uvc_streaming_control probe;
293 uint32_t interval;
294 int ret;
295
296 if (parm->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
297 return -EINVAL;
298
299 if (uvc_queue_streaming(&video->queue))
300 return -EBUSY;
301
302 memcpy(&probe, &video->streaming->ctrl, sizeof probe);
303 interval = uvc_fraction_to_interval(
304 parm->parm.capture.timeperframe.numerator,
305 parm->parm.capture.timeperframe.denominator);
306
307 uvc_trace(UVC_TRACE_FORMAT, "Setting frame interval to %u/%u (%u).\n",
308 parm->parm.capture.timeperframe.numerator,
309 parm->parm.capture.timeperframe.denominator,
310 interval);
311 probe.dwFrameInterval = uvc_try_frame_interval(frame, interval);
312
313 /* Probe the device with the new settings. */
314 if ((ret = uvc_probe_video(video, &probe)) < 0)
315 return ret;
316
317 /* Commit the new settings. */
318 if ((ret = uvc_set_video_ctrl(video, &probe, 0)) < 0)
319 return ret;
320
321 memcpy(&video->streaming->ctrl, &probe, sizeof probe);
322
323 /* Return the actual frame period. */
324 parm->parm.capture.timeperframe.numerator = probe.dwFrameInterval;
325 parm->parm.capture.timeperframe.denominator = 10000000;
326 uvc_simplify_fraction(&parm->parm.capture.timeperframe.numerator,
327 &parm->parm.capture.timeperframe.denominator,
328 8, 333);
329
330 return 0;
331}
332
333/* ------------------------------------------------------------------------
334 * Privilege management
335 */
336
337/*
338 * Privilege management is the multiple-open implementation basis. The current
339 * implementation is completely transparent for the end-user and doesn't
340 * require explicit use of the VIDIOC_G_PRIORITY and VIDIOC_S_PRIORITY ioctls.
341 * Those ioctls enable finer control on the device (by making possible for a
342 * user to request exclusive access to a device), but are not mature yet.
343 * Switching to the V4L2 priority mechanism might be considered in the future
344 * if this situation changes.
345 *
346 * Each open instance of a UVC device can either be in a privileged or
347 * unprivileged state. Only a single instance can be in a privileged state at
348 * a given time. Trying to perform an operation which requires privileges will
349 * automatically acquire the required privileges if possible, or return -EBUSY
350 * otherwise. Privileges are dismissed when closing the instance.
351 *
352 * Operations which require privileges are:
353 *
354 * - VIDIOC_S_INPUT
355 * - VIDIOC_S_PARM
356 * - VIDIOC_S_FMT
357 * - VIDIOC_TRY_FMT
358 * - VIDIOC_REQBUFS
359 */
360static int uvc_acquire_privileges(struct uvc_fh *handle)
361{
362 int ret = 0;
363
364 /* Always succeed if the handle is already privileged. */
365 if (handle->state == UVC_HANDLE_ACTIVE)
366 return 0;
367
368 /* Check if the device already has a privileged handle. */
369 mutex_lock(&uvc_driver.open_mutex);
370 if (atomic_inc_return(&handle->device->active) != 1) {
371 atomic_dec(&handle->device->active);
372 ret = -EBUSY;
373 goto done;
374 }
375
376 handle->state = UVC_HANDLE_ACTIVE;
377
378done:
379 mutex_unlock(&uvc_driver.open_mutex);
380 return ret;
381}
382
383static void uvc_dismiss_privileges(struct uvc_fh *handle)
384{
385 if (handle->state == UVC_HANDLE_ACTIVE)
386 atomic_dec(&handle->device->active);
387
388 handle->state = UVC_HANDLE_PASSIVE;
389}
390
391static int uvc_has_privileges(struct uvc_fh *handle)
392{
393 return handle->state == UVC_HANDLE_ACTIVE;
394}
395
396/* ------------------------------------------------------------------------
397 * V4L2 file operations
398 */
399
400static int uvc_v4l2_open(struct inode *inode, struct file *file)
401{
402 struct video_device *vdev;
403 struct uvc_video_device *video;
404 struct uvc_fh *handle;
405 int ret = 0;
406
407 uvc_trace(UVC_TRACE_CALLS, "uvc_v4l2_open\n");
408 mutex_lock(&uvc_driver.open_mutex);
409 vdev = video_devdata(file);
410 video = video_get_drvdata(vdev);
411
412 if (video->dev->state & UVC_DEV_DISCONNECTED) {
413 ret = -ENODEV;
414 goto done;
415 }
416
417 ret = usb_autopm_get_interface(video->dev->intf);
418 if (ret < 0)
419 goto done;
420
421 /* Create the device handle. */
422 handle = kzalloc(sizeof *handle, GFP_KERNEL);
423 if (handle == NULL) {
424 usb_autopm_put_interface(video->dev->intf);
425 ret = -ENOMEM;
426 goto done;
427 }
428
429 handle->device = video;
430 handle->state = UVC_HANDLE_PASSIVE;
431 file->private_data = handle;
432
433 kref_get(&video->dev->kref);
434
435done:
436 mutex_unlock(&uvc_driver.open_mutex);
437 return ret;
438}
439
440static int uvc_v4l2_release(struct inode *inode, struct file *file)
441{
442 struct video_device *vdev = video_devdata(file);
443 struct uvc_video_device *video = video_get_drvdata(vdev);
444 struct uvc_fh *handle = (struct uvc_fh *)file->private_data;
445
446 uvc_trace(UVC_TRACE_CALLS, "uvc_v4l2_release\n");
447
448 /* Only free resources if this is a privileged handle. */
449 if (uvc_has_privileges(handle)) {
450 uvc_video_enable(video, 0);
451
452 mutex_lock(&video->queue.mutex);
453 if (uvc_free_buffers(&video->queue) < 0)
454 uvc_printk(KERN_ERR, "uvc_v4l2_release: Unable to "
455 "free buffers.\n");
456 mutex_unlock(&video->queue.mutex);
457 }
458
459 /* Release the file handle. */
460 uvc_dismiss_privileges(handle);
461 kfree(handle);
462 file->private_data = NULL;
463
464 usb_autopm_put_interface(video->dev->intf);
465 kref_put(&video->dev->kref, uvc_delete);
466 return 0;
467}
468
469static int uvc_v4l2_do_ioctl(struct inode *inode, struct file *file,
470 unsigned int cmd, void *arg)
471{
472 struct video_device *vdev = video_devdata(file);
473 struct uvc_video_device *video = video_get_drvdata(vdev);
474 struct uvc_fh *handle = (struct uvc_fh *)file->private_data;
475 int ret = 0;
476
477 if (uvc_trace_param & UVC_TRACE_IOCTL)
478 v4l_printk_ioctl(cmd);
479
480 switch (cmd) {
481 /* Query capabilities */
482 case VIDIOC_QUERYCAP:
483 {
484 struct v4l2_capability *cap = arg;
485
486 memset(cap, 0, sizeof *cap);
487 strncpy(cap->driver, "uvcvideo", sizeof cap->driver);
488 strncpy(cap->card, vdev->name, 32);
489 strncpy(cap->bus_info, video->dev->udev->bus->bus_name,
490 sizeof cap->bus_info);
491 cap->version = DRIVER_VERSION_NUMBER;
492 cap->capabilities = V4L2_CAP_VIDEO_CAPTURE
493 | V4L2_CAP_STREAMING;
494 break;
495 }
496
497 /* Get, Set & Query control */
498 case VIDIOC_QUERYCTRL:
499 return uvc_query_v4l2_ctrl(video, arg);
500
501 case VIDIOC_G_CTRL:
502 {
503 struct v4l2_control *ctrl = arg;
504 struct v4l2_ext_control xctrl;
505
506 memset(&xctrl, 0, sizeof xctrl);
507 xctrl.id = ctrl->id;
508
509 uvc_ctrl_begin(video);
510 ret = uvc_ctrl_get(video, &xctrl);
511 uvc_ctrl_rollback(video);
512 if (ret >= 0)
513 ctrl->value = xctrl.value;
514 break;
515 }
516
517 case VIDIOC_S_CTRL:
518 {
519 struct v4l2_control *ctrl = arg;
520 struct v4l2_ext_control xctrl;
521
522 memset(&xctrl, 0, sizeof xctrl);
523 xctrl.id = ctrl->id;
524 xctrl.value = ctrl->value;
525
526 uvc_ctrl_begin(video);
527 ret = uvc_ctrl_set(video, &xctrl);
528 if (ret < 0) {
529 uvc_ctrl_rollback(video);
530 return ret;
531 }
532 ret = uvc_ctrl_commit(video);
533 break;
534 }
535
536 case VIDIOC_QUERYMENU:
537 return uvc_v4l2_query_menu(video, arg);
538
539 case VIDIOC_G_EXT_CTRLS:
540 {
541 struct v4l2_ext_controls *ctrls = arg;
542 struct v4l2_ext_control *ctrl = ctrls->controls;
543 unsigned int i;
544
545 uvc_ctrl_begin(video);
546 for (i = 0; i < ctrls->count; ++ctrl, ++i) {
547 ret = uvc_ctrl_get(video, ctrl);
548 if (ret < 0) {
549 uvc_ctrl_rollback(video);
550 ctrls->error_idx = i;
551 return ret;
552 }
553 }
554 ctrls->error_idx = 0;
555 ret = uvc_ctrl_rollback(video);
556 break;
557 }
558
559 case VIDIOC_S_EXT_CTRLS:
560 case VIDIOC_TRY_EXT_CTRLS:
561 {
562 struct v4l2_ext_controls *ctrls = arg;
563 struct v4l2_ext_control *ctrl = ctrls->controls;
564 unsigned int i;
565
566 ret = uvc_ctrl_begin(video);
567 if (ret < 0)
568 return ret;
569
570 for (i = 0; i < ctrls->count; ++ctrl, ++i) {
571 ret = uvc_ctrl_set(video, ctrl);
572 if (ret < 0) {
573 uvc_ctrl_rollback(video);
574 ctrls->error_idx = i;
575 return ret;
576 }
577 }
578
579 ctrls->error_idx = 0;
580
581 if (cmd == VIDIOC_S_EXT_CTRLS)
582 ret = uvc_ctrl_commit(video);
583 else
584 ret = uvc_ctrl_rollback(video);
585 break;
586 }
587
588 /* Get, Set & Enum input */
589 case VIDIOC_ENUMINPUT:
590 {
591 const struct uvc_entity *selector = video->selector;
592 struct v4l2_input *input = arg;
593 struct uvc_entity *iterm = NULL;
594 u32 index = input->index;
595 int pin = 0;
596
597 if (selector == NULL ||
598 (video->dev->quirks & UVC_QUIRK_IGNORE_SELECTOR_UNIT)) {
599 if (index != 0)
600 return -EINVAL;
601 iterm = list_first_entry(&video->iterms,
602 struct uvc_entity, chain);
603 pin = iterm->id;
604 } else if (pin < selector->selector.bNrInPins) {
605 pin = selector->selector.baSourceID[index];
606 list_for_each_entry(iterm, video->iterms.next, chain) {
607 if (iterm->id == pin)
608 break;
609 }
610 }
611
612 if (iterm == NULL || iterm->id != pin)
613 return -EINVAL;
614
615 memset(input, 0, sizeof *input);
616 input->index = index;
617 strncpy(input->name, iterm->name, sizeof input->name);
618 if (UVC_ENTITY_TYPE(iterm) == ITT_CAMERA)
619 input->type = V4L2_INPUT_TYPE_CAMERA;
620 break;
621 }
622
623 case VIDIOC_G_INPUT:
624 {
625 u8 input;
626
627 if (video->selector == NULL ||
628 (video->dev->quirks & UVC_QUIRK_IGNORE_SELECTOR_UNIT)) {
629 *(int *)arg = 0;
630 break;
631 }
632
633 ret = uvc_query_ctrl(video->dev, GET_CUR, video->selector->id,
634 video->dev->intfnum, SU_INPUT_SELECT_CONTROL,
635 &input, 1);
636 if (ret < 0)
637 return ret;
638
639 *(int *)arg = input - 1;
640 break;
641 }
642
643 case VIDIOC_S_INPUT:
644 {
645 u8 input = *(u32 *)arg + 1;
646
647 if ((ret = uvc_acquire_privileges(handle)) < 0)
648 return ret;
649
650 if (video->selector == NULL ||
651 (video->dev->quirks & UVC_QUIRK_IGNORE_SELECTOR_UNIT)) {
652 if (input != 1)
653 return -EINVAL;
654 break;
655 }
656
657 if (input > video->selector->selector.bNrInPins)
658 return -EINVAL;
659
660 return uvc_query_ctrl(video->dev, SET_CUR, video->selector->id,
661 video->dev->intfnum, SU_INPUT_SELECT_CONTROL,
662 &input, 1);
663 }
664
665 /* Try, Get, Set & Enum format */
666 case VIDIOC_ENUM_FMT:
667 {
668 struct v4l2_fmtdesc *fmt = arg;
669 struct uvc_format *format;
670
671 if (fmt->type != V4L2_BUF_TYPE_VIDEO_CAPTURE ||
672 fmt->index >= video->streaming->nformats)
673 return -EINVAL;
674
675 format = &video->streaming->format[fmt->index];
676 fmt->flags = 0;
677 if (format->flags & UVC_FMT_FLAG_COMPRESSED)
678 fmt->flags |= V4L2_FMT_FLAG_COMPRESSED;
679 strncpy(fmt->description, format->name,
680 sizeof fmt->description);
681 fmt->description[sizeof fmt->description - 1] = 0;
682 fmt->pixelformat = format->fcc;
683 break;
684 }
685
686 case VIDIOC_TRY_FMT:
687 {
688 struct uvc_streaming_control probe;
689
690 if ((ret = uvc_acquire_privileges(handle)) < 0)
691 return ret;
692
693 return uvc_v4l2_try_format(video, arg, &probe, NULL, NULL);
694 }
695
696 case VIDIOC_S_FMT:
697 if ((ret = uvc_acquire_privileges(handle)) < 0)
698 return ret;
699
700 return uvc_v4l2_set_format(video, arg);
701
702 case VIDIOC_G_FMT:
703 return uvc_v4l2_get_format(video, arg);
704
705 /* Frame size enumeration */
706 case VIDIOC_ENUM_FRAMESIZES:
707 {
708 struct v4l2_frmsizeenum *fsize = arg;
709 struct uvc_format *format = NULL;
710 struct uvc_frame *frame;
711 int i;
712
713 /* Look for the given pixel format */
714 for (i = 0; i < video->streaming->nformats; i++) {
715 if (video->streaming->format[i].fcc ==
716 fsize->pixel_format) {
717 format = &video->streaming->format[i];
718 break;
719 }
720 }
721 if (format == NULL)
722 return -EINVAL;
723
724 if (fsize->index >= format->nframes)
725 return -EINVAL;
726
727 frame = &format->frame[fsize->index];
728 fsize->type = V4L2_FRMSIZE_TYPE_DISCRETE;
729 fsize->discrete.width = frame->wWidth;
730 fsize->discrete.height = frame->wHeight;
731 break;
732 }
733
734 /* Frame interval enumeration */
735 case VIDIOC_ENUM_FRAMEINTERVALS:
736 {
737 struct v4l2_frmivalenum *fival = arg;
738 struct uvc_format *format = NULL;
739 struct uvc_frame *frame = NULL;
740 int i;
741
742 /* Look for the given pixel format and frame size */
743 for (i = 0; i < video->streaming->nformats; i++) {
744 if (video->streaming->format[i].fcc ==
745 fival->pixel_format) {
746 format = &video->streaming->format[i];
747 break;
748 }
749 }
750 if (format == NULL)
751 return -EINVAL;
752
753 for (i = 0; i < format->nframes; i++) {
754 if (format->frame[i].wWidth == fival->width &&
755 format->frame[i].wHeight == fival->height) {
756 frame = &format->frame[i];
757 break;
758 }
759 }
760 if (frame == NULL)
761 return -EINVAL;
762
763 if (frame->bFrameIntervalType) {
764 if (fival->index >= frame->bFrameIntervalType)
765 return -EINVAL;
766
767 fival->type = V4L2_FRMIVAL_TYPE_DISCRETE;
768 fival->discrete.numerator =
769 frame->dwFrameInterval[fival->index];
770 fival->discrete.denominator = 10000000;
771 uvc_simplify_fraction(&fival->discrete.numerator,
772 &fival->discrete.denominator, 8, 333);
773 } else {
774 fival->type = V4L2_FRMIVAL_TYPE_STEPWISE;
775 fival->stepwise.min.numerator =
776 frame->dwFrameInterval[0];
777 fival->stepwise.min.denominator = 10000000;
778 fival->stepwise.max.numerator =
779 frame->dwFrameInterval[1];
780 fival->stepwise.max.denominator = 10000000;
781 fival->stepwise.step.numerator =
782 frame->dwFrameInterval[2];
783 fival->stepwise.step.denominator = 10000000;
784 uvc_simplify_fraction(&fival->stepwise.min.numerator,
785 &fival->stepwise.min.denominator, 8, 333);
786 uvc_simplify_fraction(&fival->stepwise.max.numerator,
787 &fival->stepwise.max.denominator, 8, 333);
788 uvc_simplify_fraction(&fival->stepwise.step.numerator,
789 &fival->stepwise.step.denominator, 8, 333);
790 }
791 break;
792 }
793
794 /* Get & Set streaming parameters */
795 case VIDIOC_G_PARM:
796 return uvc_v4l2_get_streamparm(video, arg);
797
798 case VIDIOC_S_PARM:
799 if ((ret = uvc_acquire_privileges(handle)) < 0)
800 return ret;
801
802 return uvc_v4l2_set_streamparm(video, arg);
803
804 /* Cropping and scaling */
805 case VIDIOC_CROPCAP:
806 {
807 struct v4l2_cropcap *ccap = arg;
808 struct uvc_frame *frame = video->streaming->cur_frame;
809
810 if (ccap->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
811 return -EINVAL;
812
813 ccap->bounds.left = 0;
814 ccap->bounds.top = 0;
815 ccap->bounds.width = frame->wWidth;
816 ccap->bounds.height = frame->wHeight;
817
818 ccap->defrect = ccap->bounds;
819
820 ccap->pixelaspect.numerator = 1;
821 ccap->pixelaspect.denominator = 1;
822 break;
823 }
824
825 case VIDIOC_G_CROP:
826 case VIDIOC_S_CROP:
827 return -EINVAL;
828
829 /* Buffers & streaming */
830 case VIDIOC_REQBUFS:
831 {
832 struct v4l2_requestbuffers *rb = arg;
833 unsigned int bufsize =
834 video->streaming->ctrl.dwMaxVideoFrameSize;
835
836 if (rb->type != V4L2_BUF_TYPE_VIDEO_CAPTURE ||
837 rb->memory != V4L2_MEMORY_MMAP)
838 return -EINVAL;
839
840 if ((ret = uvc_acquire_privileges(handle)) < 0)
841 return ret;
842
843 ret = uvc_alloc_buffers(&video->queue, rb->count, bufsize);
844 if (ret < 0)
845 return ret;
846
847 if (!(video->streaming->cur_format->flags &
848 UVC_FMT_FLAG_COMPRESSED))
849 video->queue.flags |= UVC_QUEUE_DROP_INCOMPLETE;
850
851 rb->count = ret;
852 ret = 0;
853 break;
854 }
855
856 case VIDIOC_QUERYBUF:
857 {
858 struct v4l2_buffer *buf = arg;
859
860 if (buf->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
861 return -EINVAL;
862
863 if (!uvc_has_privileges(handle))
864 return -EBUSY;
865
866 return uvc_query_buffer(&video->queue, buf);
867 }
868
869 case VIDIOC_QBUF:
870 if (!uvc_has_privileges(handle))
871 return -EBUSY;
872
873 return uvc_queue_buffer(&video->queue, arg);
874
875 case VIDIOC_DQBUF:
876 if (!uvc_has_privileges(handle))
877 return -EBUSY;
878
879 return uvc_dequeue_buffer(&video->queue, arg,
880 file->f_flags & O_NONBLOCK);
881
882 case VIDIOC_STREAMON:
883 {
884 int *type = arg;
885
886 if (*type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
887 return -EINVAL;
888
889 if (!uvc_has_privileges(handle))
890 return -EBUSY;
891
892 if ((ret = uvc_video_enable(video, 1)) < 0)
893 return ret;
894 break;
895 }
896
897 case VIDIOC_STREAMOFF:
898 {
899 int *type = arg;
900
901 if (*type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
902 return -EINVAL;
903
904 if (!uvc_has_privileges(handle))
905 return -EBUSY;
906
907 return uvc_video_enable(video, 0);
908 }
909
910 /* Analog video standards make no sense for digital cameras. */
911 case VIDIOC_ENUMSTD:
912 case VIDIOC_QUERYSTD:
913 case VIDIOC_G_STD:
914 case VIDIOC_S_STD:
915
916 case VIDIOC_OVERLAY:
917
918 case VIDIOC_ENUMAUDIO:
919 case VIDIOC_ENUMAUDOUT:
920
921 case VIDIOC_ENUMOUTPUT:
922 uvc_trace(UVC_TRACE_IOCTL, "Unsupported ioctl 0x%08x\n", cmd);
923 return -EINVAL;
924
925 /* Dynamic controls. */
926 case UVCIOC_CTRL_ADD:
927 {
928 struct uvc_xu_control_info *xinfo = arg;
929 struct uvc_control_info *info;
930
931 if (!capable(CAP_SYS_ADMIN))
932 return -EPERM;
933
934 info = kmalloc(sizeof *info, GFP_KERNEL);
935 if (info == NULL)
936 return -ENOMEM;
937
938 memcpy(info->entity, xinfo->entity, sizeof info->entity);
939 info->index = xinfo->index;
940 info->selector = xinfo->selector;
941 info->size = xinfo->size;
942 info->flags = xinfo->flags;
943
944 info->flags |= UVC_CONTROL_GET_MIN | UVC_CONTROL_GET_MAX |
945 UVC_CONTROL_GET_RES | UVC_CONTROL_GET_DEF;
946
947 ret = uvc_ctrl_add_info(info);
948 if (ret < 0)
949 kfree(info);
950 break;
951 }
952
953 case UVCIOC_CTRL_MAP:
954 {
955 struct uvc_xu_control_mapping *xmap = arg;
956 struct uvc_control_mapping *map;
957
958 if (!capable(CAP_SYS_ADMIN))
959 return -EPERM;
960
961 map = kmalloc(sizeof *map, GFP_KERNEL);
962 if (map == NULL)
963 return -ENOMEM;
964
965 map->id = xmap->id;
966 memcpy(map->name, xmap->name, sizeof map->name);
967 memcpy(map->entity, xmap->entity, sizeof map->entity);
968 map->selector = xmap->selector;
969 map->size = xmap->size;
970 map->offset = xmap->offset;
971 map->v4l2_type = xmap->v4l2_type;
972 map->data_type = xmap->data_type;
973
974 ret = uvc_ctrl_add_mapping(map);
975 if (ret < 0)
976 kfree(map);
977 break;
978 }
979
980 case UVCIOC_CTRL_GET:
981 return uvc_xu_ctrl_query(video, arg, 0);
982
983 case UVCIOC_CTRL_SET:
984 return uvc_xu_ctrl_query(video, arg, 1);
985
986 default:
987 if ((ret = v4l_compat_translate_ioctl(inode, file, cmd, arg,
988 uvc_v4l2_do_ioctl)) == -ENOIOCTLCMD)
989 uvc_trace(UVC_TRACE_IOCTL, "Unknown ioctl 0x%08x\n",
990 cmd);
991 return ret;
992 }
993
994 return ret;
995}
996
997static int uvc_v4l2_ioctl(struct inode *inode, struct file *file,
998 unsigned int cmd, unsigned long arg)
999{
1000 uvc_trace(UVC_TRACE_CALLS, "uvc_v4l2_ioctl\n");
1001 return video_usercopy(inode, file, cmd, arg, uvc_v4l2_do_ioctl);
1002}
1003
1004static ssize_t uvc_v4l2_read(struct file *file, char __user *data,
1005 size_t count, loff_t *ppos)
1006{
1007 uvc_trace(UVC_TRACE_CALLS, "uvc_v4l2_read: not implemented.\n");
1008 return -ENODEV;
1009}
1010
1011/*
1012 * VMA operations.
1013 */
1014static void uvc_vm_open(struct vm_area_struct *vma)
1015{
1016 struct uvc_buffer *buffer = vma->vm_private_data;
1017 buffer->vma_use_count++;
1018}
1019
1020static void uvc_vm_close(struct vm_area_struct *vma)
1021{
1022 struct uvc_buffer *buffer = vma->vm_private_data;
1023 buffer->vma_use_count--;
1024}
1025
1026static struct vm_operations_struct uvc_vm_ops = {
1027 .open = uvc_vm_open,
1028 .close = uvc_vm_close,
1029};
1030
1031static int uvc_v4l2_mmap(struct file *file, struct vm_area_struct *vma)
1032{
1033 struct video_device *vdev = video_devdata(file);
1034 struct uvc_video_device *video = video_get_drvdata(vdev);
1035 struct uvc_buffer *buffer;
1036 struct page *page;
1037 unsigned long addr, start, size;
1038 unsigned int i;
1039 int ret = 0;
1040
1041 uvc_trace(UVC_TRACE_CALLS, "uvc_v4l2_mmap\n");
1042
1043 start = vma->vm_start;
1044 size = vma->vm_end - vma->vm_start;
1045
1046 mutex_lock(&video->queue.mutex);
1047
1048 for (i = 0; i < video->queue.count; ++i) {
1049 buffer = &video->queue.buffer[i];
1050 if ((buffer->buf.m.offset >> PAGE_SHIFT) == vma->vm_pgoff)
1051 break;
1052 }
1053
1054 if (i == video->queue.count || size != video->queue.buf_size) {
1055 ret = -EINVAL;
1056 goto done;
1057 }
1058
1059 /*
1060 * VM_IO marks the area as being an mmaped region for I/O to a
1061 * device. It also prevents the region from being core dumped.
1062 */
1063 vma->vm_flags |= VM_IO;
1064
1065 addr = (unsigned long)video->queue.mem + buffer->buf.m.offset;
1066 while (size > 0) {
1067 page = vmalloc_to_page((void *)addr);
1068 if ((ret = vm_insert_page(vma, start, page)) < 0)
1069 goto done;
1070
1071 start += PAGE_SIZE;
1072 addr += PAGE_SIZE;
1073 size -= PAGE_SIZE;
1074 }
1075
1076 vma->vm_ops = &uvc_vm_ops;
1077 vma->vm_private_data = buffer;
1078 uvc_vm_open(vma);
1079
1080done:
1081 mutex_unlock(&video->queue.mutex);
1082 return ret;
1083}
1084
1085static unsigned int uvc_v4l2_poll(struct file *file, poll_table *wait)
1086{
1087 struct video_device *vdev = video_devdata(file);
1088 struct uvc_video_device *video = video_get_drvdata(vdev);
1089
1090 uvc_trace(UVC_TRACE_CALLS, "uvc_v4l2_poll\n");
1091
1092 return uvc_queue_poll(&video->queue, file, wait);
1093}
1094
1095struct file_operations uvc_fops = {
1096 .owner = THIS_MODULE,
1097 .open = uvc_v4l2_open,
1098 .release = uvc_v4l2_release,
1099 .ioctl = uvc_v4l2_ioctl,
1100 .compat_ioctl = v4l_compat_ioctl32,
1101 .llseek = no_llseek,
1102 .read = uvc_v4l2_read,
1103 .mmap = uvc_v4l2_mmap,
1104 .poll = uvc_v4l2_poll,
1105};
diff --git a/drivers/media/video/uvc/uvc_video.c b/drivers/media/video/uvc/uvc_video.c
new file mode 100644
index 000000000000..6faf1fb21614
--- /dev/null
+++ b/drivers/media/video/uvc/uvc_video.c
@@ -0,0 +1,934 @@
1/*
2 * uvc_video.c -- USB Video Class driver - Video handling
3 *
4 * Copyright (C) 2005-2008
5 * Laurent Pinchart (laurent.pinchart@skynet.be)
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 */
13
14#include <linux/kernel.h>
15#include <linux/version.h>
16#include <linux/list.h>
17#include <linux/module.h>
18#include <linux/usb.h>
19#include <linux/videodev2.h>
20#include <linux/vmalloc.h>
21#include <linux/wait.h>
22#include <asm/atomic.h>
23#include <asm/unaligned.h>
24
25#include <media/v4l2-common.h>
26
27#include "uvcvideo.h"
28
29/* ------------------------------------------------------------------------
30 * UVC Controls
31 */
32
33static int __uvc_query_ctrl(struct uvc_device *dev, __u8 query, __u8 unit,
34 __u8 intfnum, __u8 cs, void *data, __u16 size,
35 int timeout)
36{
37 __u8 type = USB_TYPE_CLASS | USB_RECIP_INTERFACE;
38 unsigned int pipe;
39 int ret;
40
41 pipe = (query & 0x80) ? usb_rcvctrlpipe(dev->udev, 0)
42 : usb_sndctrlpipe(dev->udev, 0);
43 type |= (query & 0x80) ? USB_DIR_IN : USB_DIR_OUT;
44
45 ret = usb_control_msg(dev->udev, pipe, query, type, cs << 8,
46 unit << 8 | intfnum, data, size, timeout);
47
48 if (ret != size) {
49 uvc_printk(KERN_ERR, "Failed to query (%u) UVC control %u "
50 "(unit %u) : %d (exp. %u).\n", query, cs, unit, ret,
51 size);
52 return -EIO;
53 }
54
55 return 0;
56}
57
58int uvc_query_ctrl(struct uvc_device *dev, __u8 query, __u8 unit,
59 __u8 intfnum, __u8 cs, void *data, __u16 size)
60{
61 return __uvc_query_ctrl(dev, query, unit, intfnum, cs, data, size,
62 UVC_CTRL_CONTROL_TIMEOUT);
63}
64
65static void uvc_fixup_buffer_size(struct uvc_video_device *video,
66 struct uvc_streaming_control *ctrl)
67{
68 struct uvc_format *format;
69 struct uvc_frame *frame;
70
71 if (ctrl->bFormatIndex <= 0 ||
72 ctrl->bFormatIndex > video->streaming->nformats)
73 return;
74
75 format = &video->streaming->format[ctrl->bFormatIndex - 1];
76
77 if (ctrl->bFrameIndex <= 0 ||
78 ctrl->bFrameIndex > format->nframes)
79 return;
80
81 frame = &format->frame[ctrl->bFrameIndex - 1];
82
83 if (!(format->flags & UVC_FMT_FLAG_COMPRESSED) ||
84 (ctrl->dwMaxVideoFrameSize == 0 &&
85 video->dev->uvc_version < 0x0110))
86 ctrl->dwMaxVideoFrameSize =
87 frame->dwMaxVideoFrameBufferSize;
88}
89
90static int uvc_get_video_ctrl(struct uvc_video_device *video,
91 struct uvc_streaming_control *ctrl, int probe, __u8 query)
92{
93 __u8 data[34];
94 __u8 size;
95 int ret;
96
97 size = video->dev->uvc_version >= 0x0110 ? 34 : 26;
98 ret = __uvc_query_ctrl(video->dev, query, 0, video->streaming->intfnum,
99 probe ? VS_PROBE_CONTROL : VS_COMMIT_CONTROL, &data, size,
100 UVC_CTRL_STREAMING_TIMEOUT);
101
102 if (ret < 0)
103 return ret;
104
105 ctrl->bmHint = le16_to_cpup((__le16 *)&data[0]);
106 ctrl->bFormatIndex = data[2];
107 ctrl->bFrameIndex = data[3];
108 ctrl->dwFrameInterval = le32_to_cpup((__le32 *)&data[4]);
109 ctrl->wKeyFrameRate = le16_to_cpup((__le16 *)&data[8]);
110 ctrl->wPFrameRate = le16_to_cpup((__le16 *)&data[10]);
111 ctrl->wCompQuality = le16_to_cpup((__le16 *)&data[12]);
112 ctrl->wCompWindowSize = le16_to_cpup((__le16 *)&data[14]);
113 ctrl->wDelay = le16_to_cpup((__le16 *)&data[16]);
114 ctrl->dwMaxVideoFrameSize =
115 le32_to_cpu(get_unaligned((__le32 *)&data[18]));
116 ctrl->dwMaxPayloadTransferSize =
117 le32_to_cpu(get_unaligned((__le32 *)&data[22]));
118
119 if (size == 34) {
120 ctrl->dwClockFrequency =
121 le32_to_cpu(get_unaligned((__le32 *)&data[26]));
122 ctrl->bmFramingInfo = data[30];
123 ctrl->bPreferedVersion = data[31];
124 ctrl->bMinVersion = data[32];
125 ctrl->bMaxVersion = data[33];
126 } else {
127 ctrl->dwClockFrequency = video->dev->clock_frequency;
128 ctrl->bmFramingInfo = 0;
129 ctrl->bPreferedVersion = 0;
130 ctrl->bMinVersion = 0;
131 ctrl->bMaxVersion = 0;
132 }
133
134 /* Some broken devices return a null or wrong dwMaxVideoFrameSize.
135 * Try to get the value from the format and frame descriptor.
136 */
137 uvc_fixup_buffer_size(video, ctrl);
138
139 return 0;
140}
141
142int uvc_set_video_ctrl(struct uvc_video_device *video,
143 struct uvc_streaming_control *ctrl, int probe)
144{
145 __u8 data[34];
146 __u8 size;
147
148 size = video->dev->uvc_version >= 0x0110 ? 34 : 26;
149 memset(data, 0, sizeof data);
150
151 *(__le16 *)&data[0] = cpu_to_le16(ctrl->bmHint);
152 data[2] = ctrl->bFormatIndex;
153 data[3] = ctrl->bFrameIndex;
154 *(__le32 *)&data[4] = cpu_to_le32(ctrl->dwFrameInterval);
155 *(__le16 *)&data[8] = cpu_to_le16(ctrl->wKeyFrameRate);
156 *(__le16 *)&data[10] = cpu_to_le16(ctrl->wPFrameRate);
157 *(__le16 *)&data[12] = cpu_to_le16(ctrl->wCompQuality);
158 *(__le16 *)&data[14] = cpu_to_le16(ctrl->wCompWindowSize);
159 *(__le16 *)&data[16] = cpu_to_le16(ctrl->wDelay);
160 /* Note: Some of the fields below are not required for IN devices (see
161 * UVC spec, 4.3.1.1), but we still copy them in case support for OUT
162 * devices is added in the future. */
163 put_unaligned(cpu_to_le32(ctrl->dwMaxVideoFrameSize),
164 (__le32 *)&data[18]);
165 put_unaligned(cpu_to_le32(ctrl->dwMaxPayloadTransferSize),
166 (__le32 *)&data[22]);
167
168 if (size == 34) {
169 put_unaligned(cpu_to_le32(ctrl->dwClockFrequency),
170 (__le32 *)&data[26]);
171 data[30] = ctrl->bmFramingInfo;
172 data[31] = ctrl->bPreferedVersion;
173 data[32] = ctrl->bMinVersion;
174 data[33] = ctrl->bMaxVersion;
175 }
176
177 return __uvc_query_ctrl(video->dev, SET_CUR, 0,
178 video->streaming->intfnum,
179 probe ? VS_PROBE_CONTROL : VS_COMMIT_CONTROL, &data, size,
180 UVC_CTRL_STREAMING_TIMEOUT);
181}
182
183int uvc_probe_video(struct uvc_video_device *video,
184 struct uvc_streaming_control *probe)
185{
186 struct uvc_streaming_control probe_min, probe_max;
187 __u16 bandwidth;
188 unsigned int i;
189 int ret;
190
191 mutex_lock(&video->streaming->mutex);
192
193 /* Perform probing. The device should adjust the requested values
194 * according to its capabilities. However, some devices, namely the
195 * first generation UVC Logitech webcams, don't implement the Video
196 * Probe control properly, and just return the needed bandwidth. For
197 * that reason, if the needed bandwidth exceeds the maximum available
198 * bandwidth, try to lower the quality.
199 */
200 if ((ret = uvc_set_video_ctrl(video, probe, 1)) < 0)
201 goto done;
202
203 /* Get the minimum and maximum values for compression settings. */
204 if (!(video->dev->quirks & UVC_QUIRK_PROBE_MINMAX)) {
205 ret = uvc_get_video_ctrl(video, &probe_min, 1, GET_MIN);
206 if (ret < 0)
207 goto done;
208 ret = uvc_get_video_ctrl(video, &probe_max, 1, GET_MAX);
209 if (ret < 0)
210 goto done;
211
212 probe->wCompQuality = probe_max.wCompQuality;
213 }
214
215 for (i = 0; i < 2; ++i) {
216 if ((ret = uvc_set_video_ctrl(video, probe, 1)) < 0 ||
217 (ret = uvc_get_video_ctrl(video, probe, 1, GET_CUR)) < 0)
218 goto done;
219
220 if (video->streaming->intf->num_altsetting == 1)
221 break;
222
223 bandwidth = probe->dwMaxPayloadTransferSize;
224 if (bandwidth <= video->streaming->maxpsize)
225 break;
226
227 if (video->dev->quirks & UVC_QUIRK_PROBE_MINMAX) {
228 ret = -ENOSPC;
229 goto done;
230 }
231
232 /* TODO: negotiate compression parameters */
233 probe->wKeyFrameRate = probe_min.wKeyFrameRate;
234 probe->wPFrameRate = probe_min.wPFrameRate;
235 probe->wCompQuality = probe_max.wCompQuality;
236 probe->wCompWindowSize = probe_min.wCompWindowSize;
237 }
238
239done:
240 mutex_unlock(&video->streaming->mutex);
241 return ret;
242}
243
244/* ------------------------------------------------------------------------
245 * Video codecs
246 */
247
248/* Values for bmHeaderInfo (Video and Still Image Payload Headers, 2.4.3.3) */
249#define UVC_STREAM_EOH (1 << 7)
250#define UVC_STREAM_ERR (1 << 6)
251#define UVC_STREAM_STI (1 << 5)
252#define UVC_STREAM_RES (1 << 4)
253#define UVC_STREAM_SCR (1 << 3)
254#define UVC_STREAM_PTS (1 << 2)
255#define UVC_STREAM_EOF (1 << 1)
256#define UVC_STREAM_FID (1 << 0)
257
258/* Video payload decoding is handled by uvc_video_decode_start(),
259 * uvc_video_decode_data() and uvc_video_decode_end().
260 *
261 * uvc_video_decode_start is called with URB data at the start of a bulk or
262 * isochronous payload. It processes header data and returns the header size
263 * in bytes if successful. If an error occurs, it returns a negative error
264 * code. The following error codes have special meanings.
265 *
266 * - EAGAIN informs the caller that the current video buffer should be marked
267 * as done, and that the function should be called again with the same data
268 * and a new video buffer. This is used when end of frame conditions can be
269 * reliably detected at the beginning of the next frame only.
270 *
271 * If an error other than -EAGAIN is returned, the caller will drop the current
272 * payload. No call to uvc_video_decode_data and uvc_video_decode_end will be
273 * made until the next payload. -ENODATA can be used to drop the current
274 * payload if no other error code is appropriate.
275 *
276 * uvc_video_decode_data is called for every URB with URB data. It copies the
277 * data to the video buffer.
278 *
279 * uvc_video_decode_end is called with header data at the end of a bulk or
280 * isochronous payload. It performs any additional header data processing and
281 * returns 0 or a negative error code if an error occured. As header data have
282 * already been processed by uvc_video_decode_start, this functions isn't
283 * required to perform sanity checks a second time.
284 *
285 * For isochronous transfers where a payload is always transfered in a single
286 * URB, the three functions will be called in a row.
287 *
288 * To let the decoder process header data and update its internal state even
289 * when no video buffer is available, uvc_video_decode_start must be prepared
290 * to be called with a NULL buf parameter. uvc_video_decode_data and
291 * uvc_video_decode_end will never be called with a NULL buffer.
292 */
293static int uvc_video_decode_start(struct uvc_video_device *video,
294 struct uvc_buffer *buf, const __u8 *data, int len)
295{
296 __u8 fid;
297
298 /* Sanity checks:
299 * - packet must be at least 2 bytes long
300 * - bHeaderLength value must be at least 2 bytes (see above)
301 * - bHeaderLength value can't be larger than the packet size.
302 */
303 if (len < 2 || data[0] < 2 || data[0] > len)
304 return -EINVAL;
305
306 /* Skip payloads marked with the error bit ("error frames"). */
307 if (data[1] & UVC_STREAM_ERR) {
308 uvc_trace(UVC_TRACE_FRAME, "Dropping payload (error bit "
309 "set).\n");
310 return -ENODATA;
311 }
312
313 fid = data[1] & UVC_STREAM_FID;
314
315 /* Store the payload FID bit and return immediately when the buffer is
316 * NULL.
317 */
318 if (buf == NULL) {
319 video->last_fid = fid;
320 return -ENODATA;
321 }
322
323 /* Synchronize to the input stream by waiting for the FID bit to be
324 * toggled when the the buffer state is not UVC_BUF_STATE_ACTIVE.
325 * queue->last_fid is initialized to -1, so the first isochronous
326 * frame will always be in sync.
327 *
328 * If the device doesn't toggle the FID bit, invert video->last_fid
329 * when the EOF bit is set to force synchronisation on the next packet.
330 */
331 if (buf->state != UVC_BUF_STATE_ACTIVE) {
332 if (fid == video->last_fid) {
333 uvc_trace(UVC_TRACE_FRAME, "Dropping payload (out of "
334 "sync).\n");
335 if ((video->dev->quirks & UVC_QUIRK_STREAM_NO_FID) &&
336 (data[1] & UVC_STREAM_EOF))
337 video->last_fid ^= UVC_STREAM_FID;
338 return -ENODATA;
339 }
340
341 /* TODO: Handle PTS and SCR. */
342 buf->state = UVC_BUF_STATE_ACTIVE;
343 }
344
345 /* Mark the buffer as done if we're at the beginning of a new frame.
346 * End of frame detection is better implemented by checking the EOF
347 * bit (FID bit toggling is delayed by one frame compared to the EOF
348 * bit), but some devices don't set the bit at end of frame (and the
349 * last payload can be lost anyway). We thus must check if the FID has
350 * been toggled.
351 *
352 * queue->last_fid is initialized to -1, so the first isochronous
353 * frame will never trigger an end of frame detection.
354 *
355 * Empty buffers (bytesused == 0) don't trigger end of frame detection
356 * as it doesn't make sense to return an empty buffer. This also
357 * avoids detecting and of frame conditions at FID toggling if the
358 * previous payload had the EOF bit set.
359 */
360 if (fid != video->last_fid && buf->buf.bytesused != 0) {
361 uvc_trace(UVC_TRACE_FRAME, "Frame complete (FID bit "
362 "toggled).\n");
363 buf->state = UVC_BUF_STATE_DONE;
364 return -EAGAIN;
365 }
366
367 video->last_fid = fid;
368
369 return data[0];
370}
371
372static void uvc_video_decode_data(struct uvc_video_device *video,
373 struct uvc_buffer *buf, const __u8 *data, int len)
374{
375 struct uvc_video_queue *queue = &video->queue;
376 unsigned int maxlen, nbytes;
377 void *mem;
378
379 if (len <= 0)
380 return;
381
382 /* Copy the video data to the buffer. */
383 maxlen = buf->buf.length - buf->buf.bytesused;
384 mem = queue->mem + buf->buf.m.offset + buf->buf.bytesused;
385 nbytes = min((unsigned int)len, maxlen);
386 memcpy(mem, data, nbytes);
387 buf->buf.bytesused += nbytes;
388
389 /* Complete the current frame if the buffer size was exceeded. */
390 if (len > maxlen) {
391 uvc_trace(UVC_TRACE_FRAME, "Frame complete (overflow).\n");
392 buf->state = UVC_BUF_STATE_DONE;
393 }
394}
395
396static void uvc_video_decode_end(struct uvc_video_device *video,
397 struct uvc_buffer *buf, const __u8 *data, int len)
398{
399 /* Mark the buffer as done if the EOF marker is set. */
400 if (data[1] & UVC_STREAM_EOF && buf->buf.bytesused != 0) {
401 uvc_trace(UVC_TRACE_FRAME, "Frame complete (EOF found).\n");
402 if (data[0] == len)
403 uvc_trace(UVC_TRACE_FRAME, "EOF in empty payload.\n");
404 buf->state = UVC_BUF_STATE_DONE;
405 if (video->dev->quirks & UVC_QUIRK_STREAM_NO_FID)
406 video->last_fid ^= UVC_STREAM_FID;
407 }
408}
409
410/* ------------------------------------------------------------------------
411 * URB handling
412 */
413
414/*
415 * Completion handler for video URBs.
416 */
417static void uvc_video_decode_isoc(struct urb *urb,
418 struct uvc_video_device *video, struct uvc_buffer *buf)
419{
420 u8 *mem;
421 int ret, i;
422
423 for (i = 0; i < urb->number_of_packets; ++i) {
424 if (urb->iso_frame_desc[i].status < 0) {
425 uvc_trace(UVC_TRACE_FRAME, "USB isochronous frame "
426 "lost (%d).\n", urb->iso_frame_desc[i].status);
427 continue;
428 }
429
430 /* Decode the payload header. */
431 mem = urb->transfer_buffer + urb->iso_frame_desc[i].offset;
432 do {
433 ret = uvc_video_decode_start(video, buf, mem,
434 urb->iso_frame_desc[i].actual_length);
435 if (ret == -EAGAIN)
436 buf = uvc_queue_next_buffer(&video->queue, buf);
437 } while (ret == -EAGAIN);
438
439 if (ret < 0)
440 continue;
441
442 /* Decode the payload data. */
443 uvc_video_decode_data(video, buf, mem + ret,
444 urb->iso_frame_desc[i].actual_length - ret);
445
446 /* Process the header again. */
447 uvc_video_decode_end(video, buf, mem, ret);
448
449 if (buf->state == UVC_BUF_STATE_DONE ||
450 buf->state == UVC_BUF_STATE_ERROR)
451 buf = uvc_queue_next_buffer(&video->queue, buf);
452 }
453}
454
455static void uvc_video_decode_bulk(struct urb *urb,
456 struct uvc_video_device *video, struct uvc_buffer *buf)
457{
458 u8 *mem;
459 int len, ret;
460
461 mem = urb->transfer_buffer;
462 len = urb->actual_length;
463 video->bulk.payload_size += len;
464
465 /* If the URB is the first of its payload, decode and save the
466 * header.
467 */
468 if (video->bulk.header_size == 0) {
469 do {
470 ret = uvc_video_decode_start(video, buf, mem, len);
471 if (ret == -EAGAIN)
472 buf = uvc_queue_next_buffer(&video->queue, buf);
473 } while (ret == -EAGAIN);
474
475 /* If an error occured skip the rest of the payload. */
476 if (ret < 0 || buf == NULL) {
477 video->bulk.skip_payload = 1;
478 return;
479 }
480
481 video->bulk.header_size = ret;
482 memcpy(video->bulk.header, mem, video->bulk.header_size);
483
484 mem += ret;
485 len -= ret;
486 }
487
488 /* The buffer queue might have been cancelled while a bulk transfer
489 * was in progress, so we can reach here with buf equal to NULL. Make
490 * sure buf is never dereferenced if NULL.
491 */
492
493 /* Process video data. */
494 if (!video->bulk.skip_payload && buf != NULL)
495 uvc_video_decode_data(video, buf, mem, len);
496
497 /* Detect the payload end by a URB smaller than the maximum size (or
498 * a payload size equal to the maximum) and process the header again.
499 */
500 if (urb->actual_length < urb->transfer_buffer_length ||
501 video->bulk.payload_size >= video->bulk.max_payload_size) {
502 if (!video->bulk.skip_payload && buf != NULL) {
503 uvc_video_decode_end(video, buf, video->bulk.header,
504 video->bulk.header_size);
505 if (buf->state == UVC_BUF_STATE_DONE ||
506 buf->state == UVC_BUF_STATE_ERROR)
507 buf = uvc_queue_next_buffer(&video->queue, buf);
508 }
509
510 video->bulk.header_size = 0;
511 video->bulk.skip_payload = 0;
512 video->bulk.payload_size = 0;
513 }
514}
515
516static void uvc_video_complete(struct urb *urb)
517{
518 struct uvc_video_device *video = urb->context;
519 struct uvc_video_queue *queue = &video->queue;
520 struct uvc_buffer *buf = NULL;
521 unsigned long flags;
522 int ret;
523
524 switch (urb->status) {
525 case 0:
526 break;
527
528 default:
529 uvc_printk(KERN_WARNING, "Non-zero status (%d) in video "
530 "completion handler.\n", urb->status);
531
532 case -ENOENT: /* usb_kill_urb() called. */
533 if (video->frozen)
534 return;
535
536 case -ECONNRESET: /* usb_unlink_urb() called. */
537 case -ESHUTDOWN: /* The endpoint is being disabled. */
538 uvc_queue_cancel(queue, urb->status == -ESHUTDOWN);
539 return;
540 }
541
542 spin_lock_irqsave(&queue->irqlock, flags);
543 if (!list_empty(&queue->irqqueue))
544 buf = list_first_entry(&queue->irqqueue, struct uvc_buffer,
545 queue);
546 spin_unlock_irqrestore(&queue->irqlock, flags);
547
548 video->decode(urb, video, buf);
549
550 if ((ret = usb_submit_urb(urb, GFP_ATOMIC)) < 0) {
551 uvc_printk(KERN_ERR, "Failed to resubmit video URB (%d).\n",
552 ret);
553 }
554}
555
556/*
557 * Uninitialize isochronous/bulk URBs and free transfer buffers.
558 */
559static void uvc_uninit_video(struct uvc_video_device *video)
560{
561 struct urb *urb;
562 unsigned int i;
563
564 for (i = 0; i < UVC_URBS; ++i) {
565 if ((urb = video->urb[i]) == NULL)
566 continue;
567
568 usb_kill_urb(urb);
569 /* urb->transfer_buffer_length is not touched by USB core, so
570 * we can use it here as the buffer length.
571 */
572 if (video->urb_buffer[i]) {
573 usb_buffer_free(video->dev->udev,
574 urb->transfer_buffer_length,
575 video->urb_buffer[i], urb->transfer_dma);
576 video->urb_buffer[i] = NULL;
577 }
578
579 usb_free_urb(urb);
580 video->urb[i] = NULL;
581 }
582}
583
584/*
585 * Initialize isochronous URBs and allocate transfer buffers. The packet size
586 * is given by the endpoint.
587 */
588static int uvc_init_video_isoc(struct uvc_video_device *video,
589 struct usb_host_endpoint *ep)
590{
591 struct urb *urb;
592 unsigned int npackets, i, j;
593 __u16 psize;
594 __u32 size;
595
596 /* Compute the number of isochronous packets to allocate by dividing
597 * the maximum video frame size by the packet size. Limit the result
598 * to UVC_MAX_ISO_PACKETS.
599 */
600 psize = le16_to_cpu(ep->desc.wMaxPacketSize);
601 psize = (psize & 0x07ff) * (1 + ((psize >> 11) & 3));
602
603 size = video->streaming->ctrl.dwMaxVideoFrameSize;
604 if (size > UVC_MAX_FRAME_SIZE)
605 return -EINVAL;
606
607 npackets = (size + psize - 1) / psize;
608 if (npackets > UVC_MAX_ISO_PACKETS)
609 npackets = UVC_MAX_ISO_PACKETS;
610
611 size = npackets * psize;
612
613 for (i = 0; i < UVC_URBS; ++i) {
614 urb = usb_alloc_urb(npackets, GFP_KERNEL);
615 if (urb == NULL) {
616 uvc_uninit_video(video);
617 return -ENOMEM;
618 }
619
620 video->urb_buffer[i] = usb_buffer_alloc(video->dev->udev,
621 size, GFP_KERNEL, &urb->transfer_dma);
622 if (video->urb_buffer[i] == NULL) {
623 usb_free_urb(urb);
624 uvc_uninit_video(video);
625 return -ENOMEM;
626 }
627
628 urb->dev = video->dev->udev;
629 urb->context = video;
630 urb->pipe = usb_rcvisocpipe(video->dev->udev,
631 ep->desc.bEndpointAddress);
632 urb->transfer_flags = URB_ISO_ASAP | URB_NO_TRANSFER_DMA_MAP;
633 urb->interval = ep->desc.bInterval;
634 urb->transfer_buffer = video->urb_buffer[i];
635 urb->complete = uvc_video_complete;
636 urb->number_of_packets = npackets;
637 urb->transfer_buffer_length = size;
638
639 for (j = 0; j < npackets; ++j) {
640 urb->iso_frame_desc[j].offset = j * psize;
641 urb->iso_frame_desc[j].length = psize;
642 }
643
644 video->urb[i] = urb;
645 }
646
647 return 0;
648}
649
650/*
651 * Initialize bulk URBs and allocate transfer buffers. The packet size is
652 * given by the endpoint.
653 */
654static int uvc_init_video_bulk(struct uvc_video_device *video,
655 struct usb_host_endpoint *ep)
656{
657 struct urb *urb;
658 unsigned int pipe, i;
659 __u16 psize;
660 __u32 size;
661
662 /* Compute the bulk URB size. Some devices set the maximum payload
663 * size to a value too high for memory-constrained devices. We must
664 * then transfer the payload accross multiple URBs. To be consistant
665 * with isochronous mode, allocate maximum UVC_MAX_ISO_PACKETS per bulk
666 * URB.
667 */
668 psize = le16_to_cpu(ep->desc.wMaxPacketSize) & 0x07ff;
669 size = video->streaming->ctrl.dwMaxPayloadTransferSize;
670 video->bulk.max_payload_size = size;
671 if (size > psize * UVC_MAX_ISO_PACKETS)
672 size = psize * UVC_MAX_ISO_PACKETS;
673
674 pipe = usb_rcvbulkpipe(video->dev->udev, ep->desc.bEndpointAddress);
675
676 for (i = 0; i < UVC_URBS; ++i) {
677 urb = usb_alloc_urb(0, GFP_KERNEL);
678 if (urb == NULL) {
679 uvc_uninit_video(video);
680 return -ENOMEM;
681 }
682
683 video->urb_buffer[i] = usb_buffer_alloc(video->dev->udev,
684 size, GFP_KERNEL, &urb->transfer_dma);
685 if (video->urb_buffer[i] == NULL) {
686 usb_free_urb(urb);
687 uvc_uninit_video(video);
688 return -ENOMEM;
689 }
690
691 usb_fill_bulk_urb(urb, video->dev->udev, pipe,
692 video->urb_buffer[i], size, uvc_video_complete,
693 video);
694 urb->transfer_flags = URB_NO_TRANSFER_DMA_MAP;
695
696 video->urb[i] = urb;
697 }
698
699 return 0;
700}
701
702/*
703 * Initialize isochronous/bulk URBs and allocate transfer buffers.
704 */
705static int uvc_init_video(struct uvc_video_device *video)
706{
707 struct usb_interface *intf = video->streaming->intf;
708 struct usb_host_interface *alts;
709 struct usb_host_endpoint *ep = NULL;
710 int intfnum = video->streaming->intfnum;
711 unsigned int bandwidth, psize, i;
712 int ret;
713
714 video->last_fid = -1;
715 video->bulk.header_size = 0;
716 video->bulk.skip_payload = 0;
717 video->bulk.payload_size = 0;
718
719 if (intf->num_altsetting > 1) {
720 /* Isochronous endpoint, select the alternate setting. */
721 bandwidth = video->streaming->ctrl.dwMaxPayloadTransferSize;
722
723 if (bandwidth == 0) {
724 uvc_printk(KERN_WARNING, "device %s requested null "
725 "bandwidth, defaulting to lowest.\n",
726 video->vdev->name);
727 bandwidth = 1;
728 }
729
730 for (i = 0; i < intf->num_altsetting; ++i) {
731 alts = &intf->altsetting[i];
732 ep = uvc_find_endpoint(alts,
733 video->streaming->header.bEndpointAddress);
734 if (ep == NULL)
735 continue;
736
737 /* Check if the bandwidth is high enough. */
738 psize = le16_to_cpu(ep->desc.wMaxPacketSize);
739 psize = (psize & 0x07ff) * (1 + ((psize >> 11) & 3));
740 if (psize >= bandwidth)
741 break;
742 }
743
744 if (i >= intf->num_altsetting)
745 return -EIO;
746
747 if ((ret = usb_set_interface(video->dev->udev, intfnum, i)) < 0)
748 return ret;
749
750 ret = uvc_init_video_isoc(video, ep);
751 } else {
752 /* Bulk endpoint, proceed to URB initialization. */
753 ep = uvc_find_endpoint(&intf->altsetting[0],
754 video->streaming->header.bEndpointAddress);
755 if (ep == NULL)
756 return -EIO;
757
758 ret = uvc_init_video_bulk(video, ep);
759 }
760
761 if (ret < 0)
762 return ret;
763
764 /* Submit the URBs. */
765 for (i = 0; i < UVC_URBS; ++i) {
766 if ((ret = usb_submit_urb(video->urb[i], GFP_KERNEL)) < 0) {
767 uvc_printk(KERN_ERR, "Failed to submit URB %u "
768 "(%d).\n", i, ret);
769 uvc_uninit_video(video);
770 return ret;
771 }
772 }
773
774 return 0;
775}
776
777/* --------------------------------------------------------------------------
778 * Suspend/resume
779 */
780
781/*
782 * Stop streaming without disabling the video queue.
783 *
784 * To let userspace applications resume without trouble, we must not touch the
785 * video buffers in any way. We mark the device as frozen to make sure the URB
786 * completion handler won't try to cancel the queue when we kill the URBs.
787 */
788int uvc_video_suspend(struct uvc_video_device *video)
789{
790 if (!uvc_queue_streaming(&video->queue))
791 return 0;
792
793 video->frozen = 1;
794 uvc_uninit_video(video);
795 usb_set_interface(video->dev->udev, video->streaming->intfnum, 0);
796 return 0;
797}
798
799/*
800 * Reconfigure the video interface and restart streaming if it was enable
801 * before suspend.
802 *
803 * If an error occurs, disable the video queue. This will wake all pending
804 * buffers, making sure userspace applications are notified of the problem
805 * instead of waiting forever.
806 */
807int uvc_video_resume(struct uvc_video_device *video)
808{
809 int ret;
810
811 video->frozen = 0;
812
813 if ((ret = uvc_set_video_ctrl(video, &video->streaming->ctrl, 0)) < 0) {
814 uvc_queue_enable(&video->queue, 0);
815 return ret;
816 }
817
818 if (!uvc_queue_streaming(&video->queue))
819 return 0;
820
821 if ((ret = uvc_init_video(video)) < 0)
822 uvc_queue_enable(&video->queue, 0);
823
824 return ret;
825}
826
827/* ------------------------------------------------------------------------
828 * Video device
829 */
830
831/*
832 * Initialize the UVC video device by retrieving the default format and
833 * committing it.
834 *
835 * Some cameras (namely the Fuji Finepix) set the format and frame
836 * indexes to zero. The UVC standard doesn't clearly make this a spec
837 * violation, so try to silently fix the values if possible.
838 *
839 * This function is called before registering the device with V4L.
840 */
841int uvc_video_init(struct uvc_video_device *video)
842{
843 struct uvc_streaming_control *probe = &video->streaming->ctrl;
844 struct uvc_format *format = NULL;
845 struct uvc_frame *frame = NULL;
846 unsigned int i;
847 int ret;
848
849 if (video->streaming->nformats == 0) {
850 uvc_printk(KERN_INFO, "No supported video formats found.\n");
851 return -EINVAL;
852 }
853
854 /* Alternate setting 0 should be the default, yet the XBox Live Vision
855 * Cam (and possibly other devices) crash or otherwise misbehave if
856 * they don't receive a SET_INTERFACE request before any other video
857 * control request.
858 */
859 usb_set_interface(video->dev->udev, video->streaming->intfnum, 0);
860
861 /* Some webcams don't suport GET_DEF request on the probe control. We
862 * fall back to GET_CUR if GET_DEF fails.
863 */
864 if ((ret = uvc_get_video_ctrl(video, probe, 1, GET_DEF)) < 0 &&
865 (ret = uvc_get_video_ctrl(video, probe, 1, GET_CUR)) < 0)
866 return ret;
867
868 /* Check if the default format descriptor exists. Use the first
869 * available format otherwise.
870 */
871 for (i = video->streaming->nformats; i > 0; --i) {
872 format = &video->streaming->format[i-1];
873 if (format->index == probe->bFormatIndex)
874 break;
875 }
876
877 if (format->nframes == 0) {
878 uvc_printk(KERN_INFO, "No frame descriptor found for the "
879 "default format.\n");
880 return -EINVAL;
881 }
882
883 /* Zero bFrameIndex might be correct. Stream-based formats (including
884 * MPEG-2 TS and DV) do not support frames but have a dummy frame
885 * descriptor with bFrameIndex set to zero. If the default frame
886 * descriptor is not found, use the first avalable frame.
887 */
888 for (i = format->nframes; i > 0; --i) {
889 frame = &format->frame[i-1];
890 if (frame->bFrameIndex == probe->bFrameIndex)
891 break;
892 }
893
894 /* Commit the default settings. */
895 probe->bFormatIndex = format->index;
896 probe->bFrameIndex = frame->bFrameIndex;
897 if ((ret = uvc_set_video_ctrl(video, probe, 0)) < 0)
898 return ret;
899
900 video->streaming->cur_format = format;
901 video->streaming->cur_frame = frame;
902 atomic_set(&video->active, 0);
903
904 /* Select the video decoding function */
905 if (video->dev->quirks & UVC_QUIRK_BUILTIN_ISIGHT)
906 video->decode = uvc_video_decode_isight;
907 else if (video->streaming->intf->num_altsetting > 1)
908 video->decode = uvc_video_decode_isoc;
909 else
910 video->decode = uvc_video_decode_bulk;
911
912 return 0;
913}
914
915/*
916 * Enable or disable the video stream.
917 */
918int uvc_video_enable(struct uvc_video_device *video, int enable)
919{
920 int ret;
921
922 if (!enable) {
923 uvc_uninit_video(video);
924 usb_set_interface(video->dev->udev,
925 video->streaming->intfnum, 0);
926 uvc_queue_enable(&video->queue, 0);
927 return 0;
928 }
929
930 if ((ret = uvc_queue_enable(&video->queue, 1)) < 0)
931 return ret;
932
933 return uvc_init_video(video);
934}
diff --git a/drivers/media/video/uvc/uvcvideo.h b/drivers/media/video/uvc/uvcvideo.h
new file mode 100644
index 000000000000..a995a780db1c
--- /dev/null
+++ b/drivers/media/video/uvc/uvcvideo.h
@@ -0,0 +1,796 @@
1#ifndef _USB_VIDEO_H_
2#define _USB_VIDEO_H_
3
4#include <linux/kernel.h>
5#include <linux/videodev2.h>
6
7
8/*
9 * Dynamic controls
10 */
11
12/* Data types for UVC control data */
13#define UVC_CTRL_DATA_TYPE_RAW 0
14#define UVC_CTRL_DATA_TYPE_SIGNED 1
15#define UVC_CTRL_DATA_TYPE_UNSIGNED 2
16#define UVC_CTRL_DATA_TYPE_BOOLEAN 3
17#define UVC_CTRL_DATA_TYPE_ENUM 4
18#define UVC_CTRL_DATA_TYPE_BITMASK 5
19
20/* Control flags */
21#define UVC_CONTROL_SET_CUR (1 << 0)
22#define UVC_CONTROL_GET_CUR (1 << 1)
23#define UVC_CONTROL_GET_MIN (1 << 2)
24#define UVC_CONTROL_GET_MAX (1 << 3)
25#define UVC_CONTROL_GET_RES (1 << 4)
26#define UVC_CONTROL_GET_DEF (1 << 5)
27/* Control should be saved at suspend and restored at resume. */
28#define UVC_CONTROL_RESTORE (1 << 6)
29/* Control can be updated by the camera. */
30#define UVC_CONTROL_AUTO_UPDATE (1 << 7)
31
32#define UVC_CONTROL_GET_RANGE (UVC_CONTROL_GET_CUR | UVC_CONTROL_GET_MIN | \
33 UVC_CONTROL_GET_MAX | UVC_CONTROL_GET_RES | \
34 UVC_CONTROL_GET_DEF)
35
36struct uvc_xu_control_info {
37 __u8 entity[16];
38 __u8 index;
39 __u8 selector;
40 __u16 size;
41 __u32 flags;
42};
43
44struct uvc_xu_control_mapping {
45 __u32 id;
46 __u8 name[32];
47 __u8 entity[16];
48 __u8 selector;
49
50 __u8 size;
51 __u8 offset;
52 enum v4l2_ctrl_type v4l2_type;
53 __u32 data_type;
54};
55
56struct uvc_xu_control {
57 __u8 unit;
58 __u8 selector;
59 __u16 size;
60 __u8 __user *data;
61};
62
63#define UVCIOC_CTRL_ADD _IOW('U', 1, struct uvc_xu_control_info)
64#define UVCIOC_CTRL_MAP _IOWR('U', 2, struct uvc_xu_control_mapping)
65#define UVCIOC_CTRL_GET _IOWR('U', 3, struct uvc_xu_control)
66#define UVCIOC_CTRL_SET _IOW('U', 4, struct uvc_xu_control)
67
68#ifdef __KERNEL__
69
70#include <linux/poll.h>
71
72/* --------------------------------------------------------------------------
73 * UVC constants
74 */
75
76#define SC_UNDEFINED 0x00
77#define SC_VIDEOCONTROL 0x01
78#define SC_VIDEOSTREAMING 0x02
79#define SC_VIDEO_INTERFACE_COLLECTION 0x03
80
81#define PC_PROTOCOL_UNDEFINED 0x00
82
83#define CS_UNDEFINED 0x20
84#define CS_DEVICE 0x21
85#define CS_CONFIGURATION 0x22
86#define CS_STRING 0x23
87#define CS_INTERFACE 0x24
88#define CS_ENDPOINT 0x25
89
90/* VideoControl class specific interface descriptor */
91#define VC_DESCRIPTOR_UNDEFINED 0x00
92#define VC_HEADER 0x01
93#define VC_INPUT_TERMINAL 0x02
94#define VC_OUTPUT_TERMINAL 0x03
95#define VC_SELECTOR_UNIT 0x04
96#define VC_PROCESSING_UNIT 0x05
97#define VC_EXTENSION_UNIT 0x06
98
99/* VideoStreaming class specific interface descriptor */
100#define VS_UNDEFINED 0x00
101#define VS_INPUT_HEADER 0x01
102#define VS_OUTPUT_HEADER 0x02
103#define VS_STILL_IMAGE_FRAME 0x03
104#define VS_FORMAT_UNCOMPRESSED 0x04
105#define VS_FRAME_UNCOMPRESSED 0x05
106#define VS_FORMAT_MJPEG 0x06
107#define VS_FRAME_MJPEG 0x07
108#define VS_FORMAT_MPEG2TS 0x0a
109#define VS_FORMAT_DV 0x0c
110#define VS_COLORFORMAT 0x0d
111#define VS_FORMAT_FRAME_BASED 0x10
112#define VS_FRAME_FRAME_BASED 0x11
113#define VS_FORMAT_STREAM_BASED 0x12
114
115/* Endpoint type */
116#define EP_UNDEFINED 0x00
117#define EP_GENERAL 0x01
118#define EP_ENDPOINT 0x02
119#define EP_INTERRUPT 0x03
120
121/* Request codes */
122#define RC_UNDEFINED 0x00
123#define SET_CUR 0x01
124#define GET_CUR 0x81
125#define GET_MIN 0x82
126#define GET_MAX 0x83
127#define GET_RES 0x84
128#define GET_LEN 0x85
129#define GET_INFO 0x86
130#define GET_DEF 0x87
131
132/* VideoControl interface controls */
133#define VC_CONTROL_UNDEFINED 0x00
134#define VC_VIDEO_POWER_MODE_CONTROL 0x01
135#define VC_REQUEST_ERROR_CODE_CONTROL 0x02
136
137/* Terminal controls */
138#define TE_CONTROL_UNDEFINED 0x00
139
140/* Selector Unit controls */
141#define SU_CONTROL_UNDEFINED 0x00
142#define SU_INPUT_SELECT_CONTROL 0x01
143
144/* Camera Terminal controls */
145#define CT_CONTROL_UNDEFINED 0x00
146#define CT_SCANNING_MODE_CONTROL 0x01
147#define CT_AE_MODE_CONTROL 0x02
148#define CT_AE_PRIORITY_CONTROL 0x03
149#define CT_EXPOSURE_TIME_ABSOLUTE_CONTROL 0x04
150#define CT_EXPOSURE_TIME_RELATIVE_CONTROL 0x05
151#define CT_FOCUS_ABSOLUTE_CONTROL 0x06
152#define CT_FOCUS_RELATIVE_CONTROL 0x07
153#define CT_FOCUS_AUTO_CONTROL 0x08
154#define CT_IRIS_ABSOLUTE_CONTROL 0x09
155#define CT_IRIS_RELATIVE_CONTROL 0x0a
156#define CT_ZOOM_ABSOLUTE_CONTROL 0x0b
157#define CT_ZOOM_RELATIVE_CONTROL 0x0c
158#define CT_PANTILT_ABSOLUTE_CONTROL 0x0d
159#define CT_PANTILT_RELATIVE_CONTROL 0x0e
160#define CT_ROLL_ABSOLUTE_CONTROL 0x0f
161#define CT_ROLL_RELATIVE_CONTROL 0x10
162#define CT_PRIVACY_CONTROL 0x11
163
164/* Processing Unit controls */
165#define PU_CONTROL_UNDEFINED 0x00
166#define PU_BACKLIGHT_COMPENSATION_CONTROL 0x01
167#define PU_BRIGHTNESS_CONTROL 0x02
168#define PU_CONTRAST_CONTROL 0x03
169#define PU_GAIN_CONTROL 0x04
170#define PU_POWER_LINE_FREQUENCY_CONTROL 0x05
171#define PU_HUE_CONTROL 0x06
172#define PU_SATURATION_CONTROL 0x07
173#define PU_SHARPNESS_CONTROL 0x08
174#define PU_GAMMA_CONTROL 0x09
175#define PU_WHITE_BALANCE_TEMPERATURE_CONTROL 0x0a
176#define PU_WHITE_BALANCE_TEMPERATURE_AUTO_CONTROL 0x0b
177#define PU_WHITE_BALANCE_COMPONENT_CONTROL 0x0c
178#define PU_WHITE_BALANCE_COMPONENT_AUTO_CONTROL 0x0d
179#define PU_DIGITAL_MULTIPLIER_CONTROL 0x0e
180#define PU_DIGITAL_MULTIPLIER_LIMIT_CONTROL 0x0f
181#define PU_HUE_AUTO_CONTROL 0x10
182#define PU_ANALOG_VIDEO_STANDARD_CONTROL 0x11
183#define PU_ANALOG_LOCK_STATUS_CONTROL 0x12
184
185#define LXU_MOTOR_PANTILT_RELATIVE_CONTROL 0x01
186#define LXU_MOTOR_PANTILT_RESET_CONTROL 0x02
187#define LXU_MOTOR_FOCUS_MOTOR_CONTROL 0x03
188
189/* VideoStreaming interface controls */
190#define VS_CONTROL_UNDEFINED 0x00
191#define VS_PROBE_CONTROL 0x01
192#define VS_COMMIT_CONTROL 0x02
193#define VS_STILL_PROBE_CONTROL 0x03
194#define VS_STILL_COMMIT_CONTROL 0x04
195#define VS_STILL_IMAGE_TRIGGER_CONTROL 0x05
196#define VS_STREAM_ERROR_CODE_CONTROL 0x06
197#define VS_GENERATE_KEY_FRAME_CONTROL 0x07
198#define VS_UPDATE_FRAME_SEGMENT_CONTROL 0x08
199#define VS_SYNC_DELAY_CONTROL 0x09
200
201#define TT_VENDOR_SPECIFIC 0x0100
202#define TT_STREAMING 0x0101
203
204/* Input Terminal types */
205#define ITT_VENDOR_SPECIFIC 0x0200
206#define ITT_CAMERA 0x0201
207#define ITT_MEDIA_TRANSPORT_INPUT 0x0202
208
209/* Output Terminal types */
210#define OTT_VENDOR_SPECIFIC 0x0300
211#define OTT_DISPLAY 0x0301
212#define OTT_MEDIA_TRANSPORT_OUTPUT 0x0302
213
214/* External Terminal types */
215#define EXTERNAL_VENDOR_SPECIFIC 0x0400
216#define COMPOSITE_CONNECTOR 0x0401
217#define SVIDEO_CONNECTOR 0x0402
218#define COMPONENT_CONNECTOR 0x0403
219
220#define UVC_TERM_INPUT 0x0000
221#define UVC_TERM_OUTPUT 0x8000
222
223#define UVC_ENTITY_TYPE(entity) ((entity)->type & 0x7fff)
224#define UVC_ENTITY_IS_UNIT(entity) (((entity)->type & 0xff00) == 0)
225#define UVC_ENTITY_IS_TERM(entity) (((entity)->type & 0xff00) != 0)
226#define UVC_ENTITY_IS_ITERM(entity) \
227 (((entity)->type & 0x8000) == UVC_TERM_INPUT)
228#define UVC_ENTITY_IS_OTERM(entity) \
229 (((entity)->type & 0x8000) == UVC_TERM_OUTPUT)
230
231#define UVC_STATUS_TYPE_CONTROL 1
232#define UVC_STATUS_TYPE_STREAMING 2
233
234/* ------------------------------------------------------------------------
235 * GUIDs
236 */
237#define UVC_GUID_UVC_CAMERA \
238 {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
239 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01}
240#define UVC_GUID_UVC_OUTPUT \
241 {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
242 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02}
243#define UVC_GUID_UVC_MEDIA_TRANSPORT_INPUT \
244 {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
245 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03}
246#define UVC_GUID_UVC_PROCESSING \
247 {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
248 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01}
249#define UVC_GUID_UVC_SELECTOR \
250 {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
251 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02}
252
253#define UVC_GUID_LOGITECH_DEV_INFO \
254 {0x82, 0x06, 0x61, 0x63, 0x70, 0x50, 0xab, 0x49, \
255 0xb8, 0xcc, 0xb3, 0x85, 0x5e, 0x8d, 0x22, 0x1e}
256#define UVC_GUID_LOGITECH_USER_HW \
257 {0x82, 0x06, 0x61, 0x63, 0x70, 0x50, 0xab, 0x49, \
258 0xb8, 0xcc, 0xb3, 0x85, 0x5e, 0x8d, 0x22, 0x1f}
259#define UVC_GUID_LOGITECH_VIDEO \
260 {0x82, 0x06, 0x61, 0x63, 0x70, 0x50, 0xab, 0x49, \
261 0xb8, 0xcc, 0xb3, 0x85, 0x5e, 0x8d, 0x22, 0x50}
262#define UVC_GUID_LOGITECH_MOTOR \
263 {0x82, 0x06, 0x61, 0x63, 0x70, 0x50, 0xab, 0x49, \
264 0xb8, 0xcc, 0xb3, 0x85, 0x5e, 0x8d, 0x22, 0x56}
265
266#define UVC_GUID_FORMAT_MJPEG \
267 { 'M', 'J', 'P', 'G', 0x00, 0x00, 0x10, 0x00, \
268 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
269#define UVC_GUID_FORMAT_YUY2 \
270 { 'Y', 'U', 'Y', '2', 0x00, 0x00, 0x10, 0x00, \
271 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
272#define UVC_GUID_FORMAT_NV12 \
273 { 'N', 'V', '1', '2', 0x00, 0x00, 0x10, 0x00, \
274 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
275#define UVC_GUID_FORMAT_YV12 \
276 { 'Y', 'V', '1', '2', 0x00, 0x00, 0x10, 0x00, \
277 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
278#define UVC_GUID_FORMAT_I420 \
279 { 'I', '4', '2', '0', 0x00, 0x00, 0x10, 0x00, \
280 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
281#define UVC_GUID_FORMAT_UYVY \
282 { 'U', 'Y', 'V', 'Y', 0x00, 0x00, 0x10, 0x00, \
283 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
284#define UVC_GUID_FORMAT_Y800 \
285 { 'Y', '8', '0', '0', 0x00, 0x00, 0x10, 0x00, \
286 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
287#define UVC_GUID_FORMAT_BY8 \
288 { 'B', 'Y', '8', ' ', 0x00, 0x00, 0x10, 0x00, \
289 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
290
291
292/* ------------------------------------------------------------------------
293 * Driver specific constants.
294 */
295
296#define DRIVER_VERSION_NUMBER KERNEL_VERSION(0, 1, 0)
297
298/* Number of isochronous URBs. */
299#define UVC_URBS 5
300/* Maximum number of packets per isochronous URB. */
301#define UVC_MAX_ISO_PACKETS 40
302/* Maximum frame size in bytes, for sanity checking. */
303#define UVC_MAX_FRAME_SIZE (16*1024*1024)
304/* Maximum number of video buffers. */
305#define UVC_MAX_VIDEO_BUFFERS 32
306
307#define UVC_CTRL_CONTROL_TIMEOUT 300
308#define UVC_CTRL_STREAMING_TIMEOUT 1000
309
310/* Devices quirks */
311#define UVC_QUIRK_STATUS_INTERVAL 0x00000001
312#define UVC_QUIRK_PROBE_MINMAX 0x00000002
313#define UVC_QUIRK_PROBE_EXTRAFIELDS 0x00000004
314#define UVC_QUIRK_BUILTIN_ISIGHT 0x00000008
315#define UVC_QUIRK_STREAM_NO_FID 0x00000010
316#define UVC_QUIRK_IGNORE_SELECTOR_UNIT 0x00000020
317
318/* Format flags */
319#define UVC_FMT_FLAG_COMPRESSED 0x00000001
320#define UVC_FMT_FLAG_STREAM 0x00000002
321
322/* ------------------------------------------------------------------------
323 * Structures.
324 */
325
326struct uvc_device;
327
328/* TODO: Put the most frequently accessed fields at the beginning of
329 * structures to maximize cache efficiency.
330 */
331struct uvc_streaming_control {
332 __u16 bmHint;
333 __u8 bFormatIndex;
334 __u8 bFrameIndex;
335 __u32 dwFrameInterval;
336 __u16 wKeyFrameRate;
337 __u16 wPFrameRate;
338 __u16 wCompQuality;
339 __u16 wCompWindowSize;
340 __u16 wDelay;
341 __u32 dwMaxVideoFrameSize;
342 __u32 dwMaxPayloadTransferSize;
343 __u32 dwClockFrequency;
344 __u8 bmFramingInfo;
345 __u8 bPreferedVersion;
346 __u8 bMinVersion;
347 __u8 bMaxVersion;
348};
349
350struct uvc_menu_info {
351 __u32 value;
352 __u8 name[32];
353};
354
355struct uvc_control_info {
356 struct list_head list;
357 struct list_head mappings;
358
359 __u8 entity[16];
360 __u8 index;
361 __u8 selector;
362
363 __u16 size;
364 __u32 flags;
365};
366
367struct uvc_control_mapping {
368 struct list_head list;
369
370 struct uvc_control_info *ctrl;
371
372 __u32 id;
373 __u8 name[32];
374 __u8 entity[16];
375 __u8 selector;
376
377 __u8 size;
378 __u8 offset;
379 enum v4l2_ctrl_type v4l2_type;
380 __u32 data_type;
381
382 struct uvc_menu_info *menu_info;
383 __u32 menu_count;
384};
385
386struct uvc_control {
387 struct uvc_entity *entity;
388 struct uvc_control_info *info;
389
390 __u8 index; /* Used to match the uvc_control entry with a
391 uvc_control_info. */
392 __u8 dirty : 1,
393 loaded : 1,
394 modified : 1;
395
396 __u8 *data;
397};
398
399struct uvc_format_desc {
400 char *name;
401 __u8 guid[16];
402 __u32 fcc;
403};
404
405/* The term 'entity' refers to both UVC units and UVC terminals.
406 *
407 * The type field is either the terminal type (wTerminalType in the terminal
408 * descriptor), or the unit type (bDescriptorSubtype in the unit descriptor).
409 * As the bDescriptorSubtype field is one byte long, the type value will
410 * always have a null MSB for units. All terminal types defined by the UVC
411 * specification have a non-null MSB, so it is safe to use the MSB to
412 * differentiate between units and terminals as long as the descriptor parsing
413 * code makes sure terminal types have a non-null MSB.
414 *
415 * For terminals, the type's most significant bit stores the terminal
416 * direction (either UVC_TERM_INPUT or UVC_TERM_OUTPUT). The type field should
417 * always be accessed with the UVC_ENTITY_* macros and never directly.
418 */
419
420struct uvc_entity {
421 struct list_head list; /* Entity as part of a UVC device. */
422 struct list_head chain; /* Entity as part of a video device
423 * chain. */
424 __u8 id;
425 __u16 type;
426 char name[64];
427
428 union {
429 struct {
430 __u16 wObjectiveFocalLengthMin;
431 __u16 wObjectiveFocalLengthMax;
432 __u16 wOcularFocalLength;
433 __u8 bControlSize;
434 __u8 *bmControls;
435 } camera;
436
437 struct {
438 __u8 bControlSize;
439 __u8 *bmControls;
440 __u8 bTransportModeSize;
441 __u8 *bmTransportModes;
442 } media;
443
444 struct {
445 __u8 bSourceID;
446 } output;
447
448 struct {
449 __u8 bSourceID;
450 __u16 wMaxMultiplier;
451 __u8 bControlSize;
452 __u8 *bmControls;
453 __u8 bmVideoStandards;
454 } processing;
455
456 struct {
457 __u8 bNrInPins;
458 __u8 *baSourceID;
459 } selector;
460
461 struct {
462 __u8 guidExtensionCode[16];
463 __u8 bNumControls;
464 __u8 bNrInPins;
465 __u8 *baSourceID;
466 __u8 bControlSize;
467 __u8 *bmControls;
468 __u8 *bmControlsType;
469 } extension;
470 };
471
472 unsigned int ncontrols;
473 struct uvc_control *controls;
474};
475
476struct uvc_frame {
477 __u8 bFrameIndex;
478 __u8 bmCapabilities;
479 __u16 wWidth;
480 __u16 wHeight;
481 __u32 dwMinBitRate;
482 __u32 dwMaxBitRate;
483 __u32 dwMaxVideoFrameBufferSize;
484 __u8 bFrameIntervalType;
485 __u32 dwDefaultFrameInterval;
486 __u32 *dwFrameInterval;
487};
488
489struct uvc_format {
490 __u8 type;
491 __u8 index;
492 __u8 bpp;
493 __u8 colorspace;
494 __u32 fcc;
495 __u32 flags;
496
497 char name[32];
498
499 unsigned int nframes;
500 struct uvc_frame *frame;
501};
502
503struct uvc_streaming_header {
504 __u8 bNumFormats;
505 __u8 bEndpointAddress;
506 __u8 bTerminalLink;
507 __u8 bControlSize;
508 __u8 *bmaControls;
509 /* The following fields are used by input headers only. */
510 __u8 bmInfo;
511 __u8 bStillCaptureMethod;
512 __u8 bTriggerSupport;
513 __u8 bTriggerUsage;
514};
515
516struct uvc_streaming {
517 struct list_head list;
518
519 struct usb_interface *intf;
520 int intfnum;
521 __u16 maxpsize;
522
523 struct uvc_streaming_header header;
524
525 unsigned int nformats;
526 struct uvc_format *format;
527
528 struct uvc_streaming_control ctrl;
529 struct uvc_format *cur_format;
530 struct uvc_frame *cur_frame;
531
532 struct mutex mutex;
533};
534
535enum uvc_buffer_state {
536 UVC_BUF_STATE_IDLE = 0,
537 UVC_BUF_STATE_QUEUED = 1,
538 UVC_BUF_STATE_ACTIVE = 2,
539 UVC_BUF_STATE_DONE = 3,
540 UVC_BUF_STATE_ERROR = 4,
541};
542
543struct uvc_buffer {
544 unsigned long vma_use_count;
545 struct list_head stream;
546
547 /* Touched by interrupt handler. */
548 struct v4l2_buffer buf;
549 struct list_head queue;
550 wait_queue_head_t wait;
551 enum uvc_buffer_state state;
552};
553
554#define UVC_QUEUE_STREAMING (1 << 0)
555#define UVC_QUEUE_DISCONNECTED (1 << 1)
556#define UVC_QUEUE_DROP_INCOMPLETE (1 << 2)
557
558struct uvc_video_queue {
559 void *mem;
560 unsigned int flags;
561 __u32 sequence;
562
563 unsigned int count;
564 unsigned int buf_size;
565 struct uvc_buffer buffer[UVC_MAX_VIDEO_BUFFERS];
566 struct mutex mutex; /* protects buffers and mainqueue */
567 spinlock_t irqlock; /* protects irqqueue */
568
569 struct list_head mainqueue;
570 struct list_head irqqueue;
571};
572
573struct uvc_video_device {
574 struct uvc_device *dev;
575 struct video_device *vdev;
576 atomic_t active;
577 unsigned int frozen : 1;
578
579 struct list_head iterms;
580 struct uvc_entity *oterm;
581 struct uvc_entity *processing;
582 struct uvc_entity *selector;
583 struct list_head extensions;
584 struct mutex ctrl_mutex;
585
586 struct uvc_video_queue queue;
587
588 /* Video streaming object, must always be non-NULL. */
589 struct uvc_streaming *streaming;
590
591 void (*decode) (struct urb *urb, struct uvc_video_device *video,
592 struct uvc_buffer *buf);
593
594 /* Context data used by the bulk completion handler. */
595 struct {
596 __u8 header[256];
597 unsigned int header_size;
598 int skip_payload;
599 __u32 payload_size;
600 __u32 max_payload_size;
601 } bulk;
602
603 struct urb *urb[UVC_URBS];
604 char *urb_buffer[UVC_URBS];
605
606 __u8 last_fid;
607};
608
609enum uvc_device_state {
610 UVC_DEV_DISCONNECTED = 1,
611};
612
613struct uvc_device {
614 struct usb_device *udev;
615 struct usb_interface *intf;
616 __u32 quirks;
617 int intfnum;
618 char name[32];
619
620 enum uvc_device_state state;
621 struct kref kref;
622 struct list_head list;
623
624 /* Video control interface */
625 __u16 uvc_version;
626 __u32 clock_frequency;
627
628 struct list_head entities;
629
630 struct uvc_video_device video;
631
632 /* Status Interrupt Endpoint */
633 struct usb_host_endpoint *int_ep;
634 struct urb *int_urb;
635 __u8 status[16];
636 struct input_dev *input;
637
638 /* Video Streaming interfaces */
639 struct list_head streaming;
640};
641
642enum uvc_handle_state {
643 UVC_HANDLE_PASSIVE = 0,
644 UVC_HANDLE_ACTIVE = 1,
645};
646
647struct uvc_fh {
648 struct uvc_video_device *device;
649 enum uvc_handle_state state;
650};
651
652struct uvc_driver {
653 struct usb_driver driver;
654
655 struct mutex open_mutex; /* protects from open/disconnect race */
656
657 struct list_head devices; /* struct uvc_device list */
658 struct list_head controls; /* struct uvc_control_info list */
659 struct mutex ctrl_mutex; /* protects controls and devices
660 lists */
661};
662
663/* ------------------------------------------------------------------------
664 * Debugging, printing and logging
665 */
666
667#define UVC_TRACE_PROBE (1 << 0)
668#define UVC_TRACE_DESCR (1 << 1)
669#define UVC_TRACE_CONTROL (1 << 2)
670#define UVC_TRACE_FORMAT (1 << 3)
671#define UVC_TRACE_CAPTURE (1 << 4)
672#define UVC_TRACE_CALLS (1 << 5)
673#define UVC_TRACE_IOCTL (1 << 6)
674#define UVC_TRACE_FRAME (1 << 7)
675#define UVC_TRACE_SUSPEND (1 << 8)
676#define UVC_TRACE_STATUS (1 << 9)
677
678extern unsigned int uvc_trace_param;
679
680#define uvc_trace(flag, msg...) \
681 do { \
682 if (uvc_trace_param & flag) \
683 printk(KERN_DEBUG "uvcvideo: " msg); \
684 } while (0)
685
686#define uvc_printk(level, msg...) \
687 printk(level "uvcvideo: " msg)
688
689#define UVC_GUID_FORMAT "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-" \
690 "%02x%02x%02x%02x%02x%02x"
691#define UVC_GUID_ARGS(guid) \
692 (guid)[3], (guid)[2], (guid)[1], (guid)[0], \
693 (guid)[5], (guid)[4], \
694 (guid)[7], (guid)[6], \
695 (guid)[8], (guid)[9], \
696 (guid)[10], (guid)[11], (guid)[12], \
697 (guid)[13], (guid)[14], (guid)[15]
698
699/* --------------------------------------------------------------------------
700 * Internal functions.
701 */
702
703/* Core driver */
704extern struct uvc_driver uvc_driver;
705extern void uvc_delete(struct kref *kref);
706
707/* Video buffers queue management. */
708extern void uvc_queue_init(struct uvc_video_queue *queue);
709extern int uvc_alloc_buffers(struct uvc_video_queue *queue,
710 unsigned int nbuffers, unsigned int buflength);
711extern int uvc_free_buffers(struct uvc_video_queue *queue);
712extern int uvc_query_buffer(struct uvc_video_queue *queue,
713 struct v4l2_buffer *v4l2_buf);
714extern int uvc_queue_buffer(struct uvc_video_queue *queue,
715 struct v4l2_buffer *v4l2_buf);
716extern int uvc_dequeue_buffer(struct uvc_video_queue *queue,
717 struct v4l2_buffer *v4l2_buf, int nonblocking);
718extern int uvc_queue_enable(struct uvc_video_queue *queue, int enable);
719extern void uvc_queue_cancel(struct uvc_video_queue *queue, int disconnect);
720extern struct uvc_buffer *uvc_queue_next_buffer(struct uvc_video_queue *queue,
721 struct uvc_buffer *buf);
722extern unsigned int uvc_queue_poll(struct uvc_video_queue *queue,
723 struct file *file, poll_table *wait);
724static inline int uvc_queue_streaming(struct uvc_video_queue *queue)
725{
726 return queue->flags & UVC_QUEUE_STREAMING;
727}
728
729/* V4L2 interface */
730extern struct file_operations uvc_fops;
731
732/* Video */
733extern int uvc_video_init(struct uvc_video_device *video);
734extern int uvc_video_suspend(struct uvc_video_device *video);
735extern int uvc_video_resume(struct uvc_video_device *video);
736extern int uvc_video_enable(struct uvc_video_device *video, int enable);
737extern int uvc_probe_video(struct uvc_video_device *video,
738 struct uvc_streaming_control *probe);
739extern int uvc_query_ctrl(struct uvc_device *dev, __u8 query, __u8 unit,
740 __u8 intfnum, __u8 cs, void *data, __u16 size);
741extern int uvc_set_video_ctrl(struct uvc_video_device *video,
742 struct uvc_streaming_control *ctrl, int probe);
743
744/* Status */
745extern int uvc_status_init(struct uvc_device *dev);
746extern void uvc_status_cleanup(struct uvc_device *dev);
747extern int uvc_status_suspend(struct uvc_device *dev);
748extern int uvc_status_resume(struct uvc_device *dev);
749
750/* Controls */
751extern struct uvc_control *uvc_find_control(struct uvc_video_device *video,
752 __u32 v4l2_id, struct uvc_control_mapping **mapping);
753extern int uvc_query_v4l2_ctrl(struct uvc_video_device *video,
754 struct v4l2_queryctrl *v4l2_ctrl);
755
756extern int uvc_ctrl_add_info(struct uvc_control_info *info);
757extern int uvc_ctrl_add_mapping(struct uvc_control_mapping *mapping);
758extern int uvc_ctrl_init_device(struct uvc_device *dev);
759extern void uvc_ctrl_cleanup_device(struct uvc_device *dev);
760extern int uvc_ctrl_resume_device(struct uvc_device *dev);
761extern void uvc_ctrl_init(void);
762
763extern int uvc_ctrl_begin(struct uvc_video_device *video);
764extern int __uvc_ctrl_commit(struct uvc_video_device *video, int rollback);
765static inline int uvc_ctrl_commit(struct uvc_video_device *video)
766{
767 return __uvc_ctrl_commit(video, 0);
768}
769static inline int uvc_ctrl_rollback(struct uvc_video_device *video)
770{
771 return __uvc_ctrl_commit(video, 1);
772}
773
774extern int uvc_ctrl_get(struct uvc_video_device *video,
775 struct v4l2_ext_control *xctrl);
776extern int uvc_ctrl_set(struct uvc_video_device *video,
777 struct v4l2_ext_control *xctrl);
778
779extern int uvc_xu_ctrl_query(struct uvc_video_device *video,
780 struct uvc_xu_control *ctrl, int set);
781
782/* Utility functions */
783extern void uvc_simplify_fraction(uint32_t *numerator, uint32_t *denominator,
784 unsigned int n_terms, unsigned int threshold);
785extern uint32_t uvc_fraction_to_interval(uint32_t numerator,
786 uint32_t denominator);
787extern struct usb_host_endpoint *uvc_find_endpoint(
788 struct usb_host_interface *alts, __u8 epaddr);
789
790/* Quirks support */
791void uvc_video_decode_isight(struct urb *urb, struct uvc_video_device *video,
792 struct uvc_buffer *buf);
793
794#endif /* __KERNEL__ */
795
796#endif
diff --git a/drivers/media/video/videodev.c b/drivers/media/video/videodev.c
index 31e8af0ba278..67a661cf5219 100644
--- a/drivers/media/video/videodev.c
+++ b/drivers/media/video/videodev.c
@@ -51,12 +51,51 @@
51#define VIDEO_NUM_DEVICES 256 51#define VIDEO_NUM_DEVICES 256
52#define VIDEO_NAME "video4linux" 52#define VIDEO_NAME "video4linux"
53 53
54struct std_descr {
55 v4l2_std_id std;
56 const char *descr;
57};
58
59static const struct std_descr standards[] = {
60 { V4L2_STD_NTSC, "NTSC" },
61 { V4L2_STD_NTSC_M, "NTSC-M" },
62 { V4L2_STD_NTSC_M_JP, "NTSC-M-JP" },
63 { V4L2_STD_NTSC_M_KR, "NTSC-M-KR" },
64 { V4L2_STD_NTSC_443, "NTSC-443" },
65 { V4L2_STD_PAL, "PAL" },
66 { V4L2_STD_PAL_BG, "PAL-BG" },
67 { V4L2_STD_PAL_B, "PAL-B" },
68 { V4L2_STD_PAL_B1, "PAL-B1" },
69 { V4L2_STD_PAL_G, "PAL-G" },
70 { V4L2_STD_PAL_H, "PAL-H" },
71 { V4L2_STD_PAL_I, "PAL-I" },
72 { V4L2_STD_PAL_DK, "PAL-DK" },
73 { V4L2_STD_PAL_D, "PAL-D" },
74 { V4L2_STD_PAL_D1, "PAL-D1" },
75 { V4L2_STD_PAL_K, "PAL-K" },
76 { V4L2_STD_PAL_M, "PAL-M" },
77 { V4L2_STD_PAL_N, "PAL-N" },
78 { V4L2_STD_PAL_Nc, "PAL-Nc" },
79 { V4L2_STD_PAL_60, "PAL-60" },
80 { V4L2_STD_SECAM, "SECAM" },
81 { V4L2_STD_SECAM_B, "SECAM-B" },
82 { V4L2_STD_SECAM_G, "SECAM-G" },
83 { V4L2_STD_SECAM_H, "SECAM-H" },
84 { V4L2_STD_SECAM_DK, "SECAM-DK" },
85 { V4L2_STD_SECAM_D, "SECAM-D" },
86 { V4L2_STD_SECAM_K, "SECAM-K" },
87 { V4L2_STD_SECAM_K1, "SECAM-K1" },
88 { V4L2_STD_SECAM_L, "SECAM-L" },
89 { V4L2_STD_SECAM_LC, "SECAM-Lc" },
90 { 0, "Unknown" }
91};
92
54/* video4linux standard ID conversion to standard name 93/* video4linux standard ID conversion to standard name
55 */ 94 */
56char *v4l2_norm_to_name(v4l2_std_id id) 95const char *v4l2_norm_to_name(v4l2_std_id id)
57{ 96{
58 char *name;
59 u32 myid = id; 97 u32 myid = id;
98 int i;
60 99
61 /* HACK: ppc32 architecture doesn't have __ucmpdi2 function to handle 100 /* HACK: ppc32 architecture doesn't have __ucmpdi2 function to handle
62 64 bit comparations. So, on that architecture, with some gcc 101 64 bit comparations. So, on that architecture, with some gcc
@@ -64,110 +103,17 @@ char *v4l2_norm_to_name(v4l2_std_id id)
64 */ 103 */
65 BUG_ON(myid != id); 104 BUG_ON(myid != id);
66 105
67 switch (myid) { 106 for (i = 0; standards[i].std; i++)
68 case V4L2_STD_PAL: 107 if (myid == standards[i].std)
69 name = "PAL"; 108 break;
70 break; 109 return standards[i].descr;
71 case V4L2_STD_PAL_BG:
72 name = "PAL-BG";
73 break;
74 case V4L2_STD_PAL_DK:
75 name = "PAL-DK";
76 break;
77 case V4L2_STD_PAL_B:
78 name = "PAL-B";
79 break;
80 case V4L2_STD_PAL_B1:
81 name = "PAL-B1";
82 break;
83 case V4L2_STD_PAL_G:
84 name = "PAL-G";
85 break;
86 case V4L2_STD_PAL_H:
87 name = "PAL-H";
88 break;
89 case V4L2_STD_PAL_I:
90 name = "PAL-I";
91 break;
92 case V4L2_STD_PAL_D:
93 name = "PAL-D";
94 break;
95 case V4L2_STD_PAL_D1:
96 name = "PAL-D1";
97 break;
98 case V4L2_STD_PAL_K:
99 name = "PAL-K";
100 break;
101 case V4L2_STD_PAL_M:
102 name = "PAL-M";
103 break;
104 case V4L2_STD_PAL_N:
105 name = "PAL-N";
106 break;
107 case V4L2_STD_PAL_Nc:
108 name = "PAL-Nc";
109 break;
110 case V4L2_STD_PAL_60:
111 name = "PAL-60";
112 break;
113 case V4L2_STD_NTSC:
114 name = "NTSC";
115 break;
116 case V4L2_STD_NTSC_M:
117 name = "NTSC-M";
118 break;
119 case V4L2_STD_NTSC_M_JP:
120 name = "NTSC-M-JP";
121 break;
122 case V4L2_STD_NTSC_443:
123 name = "NTSC-443";
124 break;
125 case V4L2_STD_NTSC_M_KR:
126 name = "NTSC-M-KR";
127 break;
128 case V4L2_STD_SECAM:
129 name = "SECAM";
130 break;
131 case V4L2_STD_SECAM_DK:
132 name = "SECAM-DK";
133 break;
134 case V4L2_STD_SECAM_B:
135 name = "SECAM-B";
136 break;
137 case V4L2_STD_SECAM_D:
138 name = "SECAM-D";
139 break;
140 case V4L2_STD_SECAM_G:
141 name = "SECAM-G";
142 break;
143 case V4L2_STD_SECAM_H:
144 name = "SECAM-H";
145 break;
146 case V4L2_STD_SECAM_K:
147 name = "SECAM-K";
148 break;
149 case V4L2_STD_SECAM_K1:
150 name = "SECAM-K1";
151 break;
152 case V4L2_STD_SECAM_L:
153 name = "SECAM-L";
154 break;
155 case V4L2_STD_SECAM_LC:
156 name = "SECAM-LC";
157 break;
158 default:
159 name = "Unknown";
160 break;
161 }
162
163 return name;
164} 110}
165EXPORT_SYMBOL(v4l2_norm_to_name); 111EXPORT_SYMBOL(v4l2_norm_to_name);
166 112
167/* Fill in the fields of a v4l2_standard structure according to the 113/* Fill in the fields of a v4l2_standard structure according to the
168 'id' and 'transmission' parameters. Returns negative on error. */ 114 'id' and 'transmission' parameters. Returns negative on error. */
169int v4l2_video_std_construct(struct v4l2_standard *vs, 115int v4l2_video_std_construct(struct v4l2_standard *vs,
170 int id, char *name) 116 int id, const char *name)
171{ 117{
172 u32 index = vs->index; 118 u32 index = vs->index;
173 119
@@ -1218,95 +1164,40 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
1218 case VIDIOC_ENUMSTD: 1164 case VIDIOC_ENUMSTD:
1219 { 1165 {
1220 struct v4l2_standard *p = arg; 1166 struct v4l2_standard *p = arg;
1221 v4l2_std_id id = vfd->tvnorms,curr_id=0; 1167 v4l2_std_id id = vfd->tvnorms, curr_id = 0;
1222 unsigned int index = p->index,i; 1168 unsigned int index = p->index, i, j = 0;
1223 1169 const char *descr = "";
1224 if (index<0) { 1170
1225 ret=-EINVAL; 1171 /* Return norm array in a canonical way */
1226 break; 1172 for (i = 0; i <= index && id; i++) {
1227 } 1173 /* last std value in the standards array is 0, so this
1228 1174 while always ends there since (id & 0) == 0. */
1229 /* Return norm array on a canonical way */ 1175 while ((id & standards[j].std) != standards[j].std)
1230 for (i=0;i<= index && id; i++) { 1176 j++;
1231 if ( (id & V4L2_STD_PAL) == V4L2_STD_PAL) { 1177 curr_id = standards[j].std;
1232 curr_id = V4L2_STD_PAL; 1178 descr = standards[j].descr;
1233 } else if ( (id & V4L2_STD_PAL_BG) == V4L2_STD_PAL_BG) { 1179 j++;
1234 curr_id = V4L2_STD_PAL_BG; 1180 if (curr_id == 0)
1235 } else if ( (id & V4L2_STD_PAL_DK) == V4L2_STD_PAL_DK) {
1236 curr_id = V4L2_STD_PAL_DK;
1237 } else if ( (id & V4L2_STD_PAL_B) == V4L2_STD_PAL_B) {
1238 curr_id = V4L2_STD_PAL_B;
1239 } else if ( (id & V4L2_STD_PAL_B1) == V4L2_STD_PAL_B1) {
1240 curr_id = V4L2_STD_PAL_B1;
1241 } else if ( (id & V4L2_STD_PAL_G) == V4L2_STD_PAL_G) {
1242 curr_id = V4L2_STD_PAL_G;
1243 } else if ( (id & V4L2_STD_PAL_H) == V4L2_STD_PAL_H) {
1244 curr_id = V4L2_STD_PAL_H;
1245 } else if ( (id & V4L2_STD_PAL_I) == V4L2_STD_PAL_I) {
1246 curr_id = V4L2_STD_PAL_I;
1247 } else if ( (id & V4L2_STD_PAL_D) == V4L2_STD_PAL_D) {
1248 curr_id = V4L2_STD_PAL_D;
1249 } else if ( (id & V4L2_STD_PAL_D1) == V4L2_STD_PAL_D1) {
1250 curr_id = V4L2_STD_PAL_D1;
1251 } else if ( (id & V4L2_STD_PAL_K) == V4L2_STD_PAL_K) {
1252 curr_id = V4L2_STD_PAL_K;
1253 } else if ( (id & V4L2_STD_PAL_M) == V4L2_STD_PAL_M) {
1254 curr_id = V4L2_STD_PAL_M;
1255 } else if ( (id & V4L2_STD_PAL_N) == V4L2_STD_PAL_N) {
1256 curr_id = V4L2_STD_PAL_N;
1257 } else if ( (id & V4L2_STD_PAL_Nc) == V4L2_STD_PAL_Nc) {
1258 curr_id = V4L2_STD_PAL_Nc;
1259 } else if ( (id & V4L2_STD_PAL_60) == V4L2_STD_PAL_60) {
1260 curr_id = V4L2_STD_PAL_60;
1261 } else if ( (id & V4L2_STD_NTSC) == V4L2_STD_NTSC) {
1262 curr_id = V4L2_STD_NTSC;
1263 } else if ( (id & V4L2_STD_NTSC_M) == V4L2_STD_NTSC_M) {
1264 curr_id = V4L2_STD_NTSC_M;
1265 } else if ( (id & V4L2_STD_NTSC_M_JP) == V4L2_STD_NTSC_M_JP) {
1266 curr_id = V4L2_STD_NTSC_M_JP;
1267 } else if ( (id & V4L2_STD_NTSC_443) == V4L2_STD_NTSC_443) {
1268 curr_id = V4L2_STD_NTSC_443;
1269 } else if ( (id & V4L2_STD_NTSC_M_KR) == V4L2_STD_NTSC_M_KR) {
1270 curr_id = V4L2_STD_NTSC_M_KR;
1271 } else if ( (id & V4L2_STD_SECAM) == V4L2_STD_SECAM) {
1272 curr_id = V4L2_STD_SECAM;
1273 } else if ( (id & V4L2_STD_SECAM_DK) == V4L2_STD_SECAM_DK) {
1274 curr_id = V4L2_STD_SECAM_DK;
1275 } else if ( (id & V4L2_STD_SECAM_B) == V4L2_STD_SECAM_B) {
1276 curr_id = V4L2_STD_SECAM_B;
1277 } else if ( (id & V4L2_STD_SECAM_D) == V4L2_STD_SECAM_D) {
1278 curr_id = V4L2_STD_SECAM_D;
1279 } else if ( (id & V4L2_STD_SECAM_G) == V4L2_STD_SECAM_G) {
1280 curr_id = V4L2_STD_SECAM_G;
1281 } else if ( (id & V4L2_STD_SECAM_H) == V4L2_STD_SECAM_H) {
1282 curr_id = V4L2_STD_SECAM_H;
1283 } else if ( (id & V4L2_STD_SECAM_K) == V4L2_STD_SECAM_K) {
1284 curr_id = V4L2_STD_SECAM_K;
1285 } else if ( (id & V4L2_STD_SECAM_K1) == V4L2_STD_SECAM_K1) {
1286 curr_id = V4L2_STD_SECAM_K1;
1287 } else if ( (id & V4L2_STD_SECAM_L) == V4L2_STD_SECAM_L) {
1288 curr_id = V4L2_STD_SECAM_L;
1289 } else if ( (id & V4L2_STD_SECAM_LC) == V4L2_STD_SECAM_LC) {
1290 curr_id = V4L2_STD_SECAM_LC;
1291 } else {
1292 break; 1181 break;
1293 } 1182 if (curr_id != V4L2_STD_PAL &&
1294 id &= ~curr_id; 1183 curr_id != V4L2_STD_SECAM &&
1184 curr_id != V4L2_STD_NTSC)
1185 id &= ~curr_id;
1295 } 1186 }
1296 if (i<=index) 1187 if (i <= index)
1297 return -EINVAL; 1188 return -EINVAL;
1298 1189
1299 v4l2_video_std_construct(p, curr_id,v4l2_norm_to_name(curr_id)); 1190 v4l2_video_std_construct(p, curr_id, descr);
1300 p->index = index; 1191 p->index = index;
1301 1192
1302 dbgarg (cmd, "index=%d, id=%Ld, name=%s, fps=%d/%d, " 1193 dbgarg(cmd, "index=%d, id=%Ld, name=%s, fps=%d/%d, "
1303 "framelines=%d\n", p->index, 1194 "framelines=%d\n", p->index,
1304 (unsigned long long)p->id, p->name, 1195 (unsigned long long)p->id, p->name,
1305 p->frameperiod.numerator, 1196 p->frameperiod.numerator,
1306 p->frameperiod.denominator, 1197 p->frameperiod.denominator,
1307 p->framelines); 1198 p->framelines);
1308 1199
1309 ret=0; 1200 ret = 0;
1310 break; 1201 break;
1311 } 1202 }
1312 case VIDIOC_G_STD: 1203 case VIDIOC_G_STD:
diff --git a/drivers/media/video/vivi.c b/drivers/media/video/vivi.c
index 845be1864f68..5ff9a58b6135 100644
--- a/drivers/media/video/vivi.c
+++ b/drivers/media/video/vivi.c
@@ -327,13 +327,14 @@ static void vivi_fillbuff(struct vivi_dev *dev, struct vivi_buffer *buf)
327 int hmax = buf->vb.height; 327 int hmax = buf->vb.height;
328 int wmax = buf->vb.width; 328 int wmax = buf->vb.width;
329 struct timeval ts; 329 struct timeval ts;
330 char *tmpbuf = kmalloc(wmax * 2, GFP_ATOMIC); 330 char *tmpbuf;
331 void *vbuf = videobuf_to_vmalloc(&buf->vb); 331 void *vbuf = videobuf_to_vmalloc(&buf->vb);
332 332
333 if (!tmpbuf) 333 if (!vbuf)
334 return; 334 return;
335 335
336 if (!vbuf) 336 tmpbuf = kmalloc(wmax * 2, GFP_ATOMIC);
337 if (!tmpbuf)
337 return; 338 return;
338 339
339 for (h = 0; h < hmax; h++) { 340 for (h = 0; h < hmax; h++) {
diff --git a/drivers/mmc/host/imxmmc.c b/drivers/mmc/host/imxmmc.c
index 95f33e87a99c..c4349c746cb3 100644
--- a/drivers/mmc/host/imxmmc.c
+++ b/drivers/mmc/host/imxmmc.c
@@ -1017,8 +1017,8 @@ static int imxmci_probe(struct platform_device *pdev)
1017 host->imask = IMXMCI_INT_MASK_DEFAULT; 1017 host->imask = IMXMCI_INT_MASK_DEFAULT;
1018 MMC_INT_MASK = host->imask; 1018 MMC_INT_MASK = host->imask;
1019 1019
1020 1020 host->dma = imx_dma_request_by_prio(DRIVER_NAME, DMA_PRIO_LOW);
1021 if(imx_dma_request_by_prio(&host->dma, DRIVER_NAME, DMA_PRIO_LOW)<0){ 1021 if(host->dma < 0) {
1022 dev_err(mmc_dev(host->mmc), "imx_dma_request_by_prio failed\n"); 1022 dev_err(mmc_dev(host->mmc), "imx_dma_request_by_prio failed\n");
1023 ret = -EBUSY; 1023 ret = -EBUSY;
1024 goto out; 1024 goto out;
diff --git a/drivers/mtd/maps/omap_nor.c b/drivers/mtd/maps/omap_nor.c
index c12d8056bebd..68eec6c6c517 100644
--- a/drivers/mtd/maps/omap_nor.c
+++ b/drivers/mtd/maps/omap_nor.c
@@ -60,13 +60,22 @@ struct omapflash_info {
60static void omap_set_vpp(struct map_info *map, int enable) 60static void omap_set_vpp(struct map_info *map, int enable)
61{ 61{
62 static int count; 62 static int count;
63 63 u32 l;
64 if (enable) { 64
65 if (count++ == 0) 65 if (cpu_class_is_omap1()) {
66 OMAP_EMIFS_CONFIG_REG |= OMAP_EMIFS_CONFIG_WP; 66 if (enable) {
67 } else { 67 if (count++ == 0) {
68 if (count && (--count == 0)) 68 l = omap_readl(EMIFS_CONFIG);
69 OMAP_EMIFS_CONFIG_REG &= ~OMAP_EMIFS_CONFIG_WP; 69 l |= OMAP_EMIFS_CONFIG_WP;
70 omap_writel(l, EMIFS_CONFIG);
71 }
72 } else {
73 if (count && (--count == 0)) {
74 l = omap_readl(EMIFS_CONFIG);
75 l &= ~OMAP_EMIFS_CONFIG_WP;
76 omap_writel(l, EMIFS_CONFIG);
77 }
78 }
70 } 79 }
71} 80}
72 81
diff --git a/drivers/mtd/nand/orion_nand.c b/drivers/mtd/nand/orion_nand.c
index 59e05a1c50cf..ee2ac3948cd8 100644
--- a/drivers/mtd/nand/orion_nand.c
+++ b/drivers/mtd/nand/orion_nand.c
@@ -85,6 +85,9 @@ static int __init orion_nand_probe(struct platform_device *pdev)
85 nc->cmd_ctrl = orion_nand_cmd_ctrl; 85 nc->cmd_ctrl = orion_nand_cmd_ctrl;
86 nc->ecc.mode = NAND_ECC_SOFT; 86 nc->ecc.mode = NAND_ECC_SOFT;
87 87
88 if (board->chip_delay)
89 nc->chip_delay = board->chip_delay;
90
88 if (board->width == 16) 91 if (board->width == 16)
89 nc->options |= NAND_BUSWIDTH_16; 92 nc->options |= NAND_BUSWIDTH_16;
90 93
diff --git a/drivers/net/3c59x.c b/drivers/net/3c59x.c
index 2edda8cc7f99..aabad8ce7458 100644
--- a/drivers/net/3c59x.c
+++ b/drivers/net/3c59x.c
@@ -1768,9 +1768,10 @@ vortex_timer(unsigned long data)
1768 case XCVR_MII: case XCVR_NWAY: 1768 case XCVR_MII: case XCVR_NWAY:
1769 { 1769 {
1770 ok = 1; 1770 ok = 1;
1771 spin_lock_bh(&vp->lock); 1771 /* Interrupts are already disabled */
1772 spin_lock(&vp->lock);
1772 vortex_check_media(dev, 0); 1773 vortex_check_media(dev, 0);
1773 spin_unlock_bh(&vp->lock); 1774 spin_unlock(&vp->lock);
1774 } 1775 }
1775 break; 1776 break;
1776 default: /* Other media types handled by Tx timeouts. */ 1777 default: /* Other media types handled by Tx timeouts. */
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index f4182cfffe9d..45a41b597da9 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -217,7 +217,7 @@ config MII
217 217
218config MACB 218config MACB
219 tristate "Atmel MACB support" 219 tristate "Atmel MACB support"
220 depends on AVR32 || ARCH_AT91SAM9260 || ARCH_AT91SAM9263 || ARCH_AT91CAP9 220 depends on AVR32 || ARCH_AT91SAM9260 || ARCH_AT91SAM9263 || ARCH_AT91SAM9G20 || ARCH_AT91CAP9
221 select PHYLIB 221 select PHYLIB
222 help 222 help
223 The Atmel MACB ethernet interface is found on many AT32 and AT91 223 The Atmel MACB ethernet interface is found on many AT32 and AT91
diff --git a/drivers/net/e100.c b/drivers/net/e100.c
index f3cba5e24ec5..1037b1332312 100644
--- a/drivers/net/e100.c
+++ b/drivers/net/e100.c
@@ -1803,6 +1803,8 @@ static int e100_rx_alloc_skb(struct nic *nic, struct rx *rx)
1803 if (rx->prev->skb) { 1803 if (rx->prev->skb) {
1804 struct rfd *prev_rfd = (struct rfd *)rx->prev->skb->data; 1804 struct rfd *prev_rfd = (struct rfd *)rx->prev->skb->data;
1805 put_unaligned_le32(rx->dma_addr, &prev_rfd->link); 1805 put_unaligned_le32(rx->dma_addr, &prev_rfd->link);
1806 pci_dma_sync_single_for_device(nic->pdev, rx->prev->dma_addr,
1807 sizeof(struct rfd), PCI_DMA_TODEVICE);
1806 } 1808 }
1807 1809
1808 return 0; 1810 return 0;
diff --git a/drivers/net/e1000/e1000_ethtool.c b/drivers/net/e1000/e1000_ethtool.c
index 701531e72e7b..a3f6a9c72ec8 100644
--- a/drivers/net/e1000/e1000_ethtool.c
+++ b/drivers/net/e1000/e1000_ethtool.c
@@ -347,7 +347,7 @@ e1000_set_tso(struct net_device *netdev, u32 data)
347 else 347 else
348 netdev->features &= ~NETIF_F_TSO; 348 netdev->features &= ~NETIF_F_TSO;
349 349
350 if (data) 350 if (data && (adapter->hw.mac_type > e1000_82547_rev_2))
351 netdev->features |= NETIF_F_TSO6; 351 netdev->features |= NETIF_F_TSO6;
352 else 352 else
353 netdev->features &= ~NETIF_F_TSO6; 353 netdev->features &= ~NETIF_F_TSO6;
diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c
index cab1835173cd..648a87bbf467 100644
--- a/drivers/net/e1000e/netdev.c
+++ b/drivers/net/e1000e/netdev.c
@@ -2535,7 +2535,8 @@ void e1000e_down(struct e1000_adapter *adapter)
2535 adapter->link_speed = 0; 2535 adapter->link_speed = 0;
2536 adapter->link_duplex = 0; 2536 adapter->link_duplex = 0;
2537 2537
2538 e1000e_reset(adapter); 2538 if (!pci_channel_offline(adapter->pdev))
2539 e1000e_reset(adapter);
2539 e1000_clean_tx_ring(adapter); 2540 e1000_clean_tx_ring(adapter);
2540 e1000_clean_rx_ring(adapter); 2541 e1000_clean_rx_ring(adapter);
2541 2542
diff --git a/drivers/net/hamradio/dmascc.c b/drivers/net/hamradio/dmascc.c
index 0b94833e23f7..e8cfadefa4b6 100644
--- a/drivers/net/hamradio/dmascc.c
+++ b/drivers/net/hamradio/dmascc.c
@@ -1077,8 +1077,6 @@ static inline void rx_off(struct scc_priv *priv)
1077 1077
1078static void start_timer(struct scc_priv *priv, int t, int r15) 1078static void start_timer(struct scc_priv *priv, int t, int r15)
1079{ 1079{
1080 unsigned long flags;
1081
1082 outb(priv->tmr_mode, priv->tmr_ctrl); 1080 outb(priv->tmr_mode, priv->tmr_ctrl);
1083 if (t == 0) { 1081 if (t == 0) {
1084 tm_isr(priv); 1082 tm_isr(priv);
diff --git a/drivers/net/igb/igb_main.c b/drivers/net/igb/igb_main.c
index ae398f04c7b4..e79a26a886c8 100644
--- a/drivers/net/igb/igb_main.c
+++ b/drivers/net/igb/igb_main.c
@@ -718,7 +718,8 @@ void igb_down(struct igb_adapter *adapter)
718 adapter->link_speed = 0; 718 adapter->link_speed = 0;
719 adapter->link_duplex = 0; 719 adapter->link_duplex = 0;
720 720
721 igb_reset(adapter); 721 if (!pci_channel_offline(adapter->pdev))
722 igb_reset(adapter);
722 igb_clean_all_tx_rings(adapter); 723 igb_clean_all_tx_rings(adapter);
723 igb_clean_all_rx_rings(adapter); 724 igb_clean_all_rx_rings(adapter);
724} 725}
diff --git a/drivers/net/ipg.c b/drivers/net/ipg.c
index 679a0826780e..2c03f4e2ccc4 100644
--- a/drivers/net/ipg.c
+++ b/drivers/net/ipg.c
@@ -1271,7 +1271,7 @@ static void ipg_nic_rx_with_end(struct net_device *dev,
1271 1271
1272 framelen = le64_to_cpu(rxfd->rfs) & IPG_RFS_RXFRAMELEN; 1272 framelen = le64_to_cpu(rxfd->rfs) & IPG_RFS_RXFRAMELEN;
1273 1273
1274 endframeLen = framelen - jumbo->current_size; 1274 endframelen = framelen - jumbo->current_size;
1275 /* 1275 /*
1276 if (framelen > IPG_RXFRAG_SIZE) 1276 if (framelen > IPG_RXFRAG_SIZE)
1277 framelen=IPG_RXFRAG_SIZE; 1277 framelen=IPG_RXFRAG_SIZE;
@@ -1279,8 +1279,8 @@ static void ipg_nic_rx_with_end(struct net_device *dev,
1279 if (framelen > IPG_RXSUPPORT_SIZE) 1279 if (framelen > IPG_RXSUPPORT_SIZE)
1280 dev_kfree_skb_irq(jumbo->skb); 1280 dev_kfree_skb_irq(jumbo->skb);
1281 else { 1281 else {
1282 memcpy(skb_put(jumbo->skb, endframeLen), 1282 memcpy(skb_put(jumbo->skb, endframelen),
1283 skb->data, endframeLen); 1283 skb->data, endframelen);
1284 1284
1285 jumbo->skb->protocol = 1285 jumbo->skb->protocol =
1286 eth_type_trans(jumbo->skb, dev); 1286 eth_type_trans(jumbo->skb, dev);
@@ -1352,16 +1352,16 @@ static int ipg_nic_rx(struct net_device *dev)
1352 1352
1353 switch (ipg_nic_rx_check_frame_type(dev)) { 1353 switch (ipg_nic_rx_check_frame_type(dev)) {
1354 case FRAME_WITH_START_WITH_END: 1354 case FRAME_WITH_START_WITH_END:
1355 ipg_nic_rx_with_start_and_end(dev, tp, rxfd, entry); 1355 ipg_nic_rx_with_start_and_end(dev, sp, rxfd, entry);
1356 break; 1356 break;
1357 case FRAME_WITH_START: 1357 case FRAME_WITH_START:
1358 ipg_nic_rx_with_start(dev, tp, rxfd, entry); 1358 ipg_nic_rx_with_start(dev, sp, rxfd, entry);
1359 break; 1359 break;
1360 case FRAME_WITH_END: 1360 case FRAME_WITH_END:
1361 ipg_nic_rx_with_end(dev, tp, rxfd, entry); 1361 ipg_nic_rx_with_end(dev, sp, rxfd, entry);
1362 break; 1362 break;
1363 case FRAME_NO_START_NO_END: 1363 case FRAME_NO_START_NO_END:
1364 ipg_nic_rx_no_start_no_end(dev, tp, rxfd, entry); 1364 ipg_nic_rx_no_start_no_end(dev, sp, rxfd, entry);
1365 break; 1365 break;
1366 } 1366 }
1367 } 1367 }
@@ -1808,7 +1808,7 @@ static int ipg_nic_open(struct net_device *dev)
1808 /* initialize JUMBO Frame control variable */ 1808 /* initialize JUMBO Frame control variable */
1809 sp->jumbo.found_start = 0; 1809 sp->jumbo.found_start = 0;
1810 sp->jumbo.current_size = 0; 1810 sp->jumbo.current_size = 0;
1811 sp->jumbo.skb = 0; 1811 sp->jumbo.skb = NULL;
1812 dev->mtu = IPG_TXFRAG_SIZE; 1812 dev->mtu = IPG_TXFRAG_SIZE;
1813#endif 1813#endif
1814 1814
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c
index 7b859220c255..8f0460901153 100644
--- a/drivers/net/ixgbe/ixgbe_main.c
+++ b/drivers/net/ixgbe/ixgbe_main.c
@@ -1969,7 +1969,8 @@ void ixgbe_down(struct ixgbe_adapter *adapter)
1969 netif_carrier_off(netdev); 1969 netif_carrier_off(netdev);
1970 netif_stop_queue(netdev); 1970 netif_stop_queue(netdev);
1971 1971
1972 ixgbe_reset(adapter); 1972 if (!pci_channel_offline(adapter->pdev))
1973 ixgbe_reset(adapter);
1973 ixgbe_clean_all_tx_rings(adapter); 1974 ixgbe_clean_all_tx_rings(adapter);
1974 ixgbe_clean_all_rx_rings(adapter); 1975 ixgbe_clean_all_rx_rings(adapter);
1975 1976
diff --git a/drivers/net/netxen/netxen_nic_main.c b/drivers/net/netxen/netxen_nic_main.c
index 6797ed069f1f..63cd67b931e7 100644
--- a/drivers/net/netxen/netxen_nic_main.c
+++ b/drivers/net/netxen/netxen_nic_main.c
@@ -71,14 +71,18 @@ static irqreturn_t netxen_intr(int irq, void *data);
71static irqreturn_t netxen_msi_intr(int irq, void *data); 71static irqreturn_t netxen_msi_intr(int irq, void *data);
72 72
73/* PCI Device ID Table */ 73/* PCI Device ID Table */
74#define ENTRY(device) \
75 {PCI_DEVICE(0x4040, (device)), \
76 .class = PCI_CLASS_NETWORK_ETHERNET << 8, .class_mask = ~0}
77
74static struct pci_device_id netxen_pci_tbl[] __devinitdata = { 78static struct pci_device_id netxen_pci_tbl[] __devinitdata = {
75 {PCI_DEVICE(0x4040, 0x0001), PCI_DEVICE_CLASS(0x020000, ~0)}, 79 ENTRY(0x0001),
76 {PCI_DEVICE(0x4040, 0x0002), PCI_DEVICE_CLASS(0x020000, ~0)}, 80 ENTRY(0x0002),
77 {PCI_DEVICE(0x4040, 0x0003), PCI_DEVICE_CLASS(0x020000, ~0)}, 81 ENTRY(0x0003),
78 {PCI_DEVICE(0x4040, 0x0004), PCI_DEVICE_CLASS(0x020000, ~0)}, 82 ENTRY(0x0004),
79 {PCI_DEVICE(0x4040, 0x0005), PCI_DEVICE_CLASS(0x020000, ~0)}, 83 ENTRY(0x0005),
80 {PCI_DEVICE(0x4040, 0x0024), PCI_DEVICE_CLASS(0x020000, ~0)}, 84 ENTRY(0x0024),
81 {PCI_DEVICE(0x4040, 0x0025), PCI_DEVICE_CLASS(0x020000, ~0)}, 85 ENTRY(0x0025),
82 {0,} 86 {0,}
83}; 87};
84 88
diff --git a/drivers/net/pcmcia/axnet_cs.c b/drivers/net/pcmcia/axnet_cs.c
index ce95c5d168fe..70d012e90dcf 100644
--- a/drivers/net/pcmcia/axnet_cs.c
+++ b/drivers/net/pcmcia/axnet_cs.c
@@ -525,12 +525,14 @@ static int axnet_open(struct net_device *dev)
525 int ret; 525 int ret;
526 axnet_dev_t *info = PRIV(dev); 526 axnet_dev_t *info = PRIV(dev);
527 struct pcmcia_device *link = info->p_dev; 527 struct pcmcia_device *link = info->p_dev;
528 unsigned int nic_base = dev->base_addr;
528 529
529 DEBUG(2, "axnet_open('%s')\n", dev->name); 530 DEBUG(2, "axnet_open('%s')\n", dev->name);
530 531
531 if (!pcmcia_dev_present(link)) 532 if (!pcmcia_dev_present(link))
532 return -ENODEV; 533 return -ENODEV;
533 534
535 outb_p(0xFF, nic_base + EN0_ISR); /* Clear bogus intr. */
534 ret = request_irq(dev->irq, ei_irq_wrapper, IRQF_SHARED, "axnet_cs", dev); 536 ret = request_irq(dev->irq, ei_irq_wrapper, IRQF_SHARED, "axnet_cs", dev);
535 if (ret) 537 if (ret)
536 return ret; 538 return ret;
diff --git a/drivers/net/pcmcia/pcnet_cs.c b/drivers/net/pcmcia/pcnet_cs.c
index fd8158a86f64..2d4c4ad89b8d 100644
--- a/drivers/net/pcmcia/pcnet_cs.c
+++ b/drivers/net/pcmcia/pcnet_cs.c
@@ -969,6 +969,7 @@ static int pcnet_open(struct net_device *dev)
969 int ret; 969 int ret;
970 pcnet_dev_t *info = PRIV(dev); 970 pcnet_dev_t *info = PRIV(dev);
971 struct pcmcia_device *link = info->p_dev; 971 struct pcmcia_device *link = info->p_dev;
972 unsigned int nic_base = dev->base_addr;
972 973
973 DEBUG(2, "pcnet_open('%s')\n", dev->name); 974 DEBUG(2, "pcnet_open('%s')\n", dev->name);
974 975
@@ -976,6 +977,8 @@ static int pcnet_open(struct net_device *dev)
976 return -ENODEV; 977 return -ENODEV;
977 978
978 set_misc_reg(dev); 979 set_misc_reg(dev);
980
981 outb_p(0xFF, nic_base + EN0_ISR); /* Clear bogus intr. */
979 ret = request_irq(dev->irq, ei_irq_wrapper, IRQF_SHARED, dev_info, dev); 982 ret = request_irq(dev->irq, ei_irq_wrapper, IRQF_SHARED, dev_info, dev);
980 if (ret) 983 if (ret)
981 return ret; 984 return ret;
diff --git a/drivers/net/pppoe.c b/drivers/net/pppoe.c
index bafb69b6f7cb..fc6f4b8c64b3 100644
--- a/drivers/net/pppoe.c
+++ b/drivers/net/pppoe.c
@@ -942,7 +942,7 @@ static int pppoe_recvmsg(struct kiocb *iocb, struct socket *sock,
942 m->msg_namelen = 0; 942 m->msg_namelen = 0;
943 943
944 if (skb) { 944 if (skb) {
945 total_len = min(total_len, skb->len); 945 total_len = min_t(size_t, total_len, skb->len);
946 error = skb_copy_datagram_iovec(skb, 0, m->msg_iov, total_len); 946 error = skb_copy_datagram_iovec(skb, 0, m->msg_iov, total_len);
947 if (error == 0) 947 if (error == 0)
948 error = total_len; 948 error = total_len;
diff --git a/drivers/net/qla3xxx.c b/drivers/net/qla3xxx.c
index b7f7b2227d56..bccee68bd48a 100644
--- a/drivers/net/qla3xxx.c
+++ b/drivers/net/qla3xxx.c
@@ -3701,7 +3701,9 @@ static int ql_cycle_adapter(struct ql3_adapter *qdev, int reset)
3701 printk(KERN_ERR PFX 3701 printk(KERN_ERR PFX
3702 "%s: Driver up/down cycle failed, " 3702 "%s: Driver up/down cycle failed, "
3703 "closing device\n",qdev->ndev->name); 3703 "closing device\n",qdev->ndev->name);
3704 rtnl_lock();
3704 dev_close(qdev->ndev); 3705 dev_close(qdev->ndev);
3706 rtnl_unlock();
3705 return -1; 3707 return -1;
3706 } 3708 }
3707 return 0; 3709 return 0;
diff --git a/drivers/net/r6040.c b/drivers/net/r6040.c
index 858b191517b3..504a48ff73c8 100644
--- a/drivers/net/r6040.c
+++ b/drivers/net/r6040.c
@@ -273,7 +273,7 @@ static void r6040_init_ring_desc(struct r6040_descriptor *desc_ring,
273 dma_addr_t mapping = desc_dma; 273 dma_addr_t mapping = desc_dma;
274 274
275 while (size-- > 0) { 275 while (size-- > 0) {
276 mapping += sizeof(sizeof(*desc)); 276 mapping += sizeof(*desc);
277 desc->ndesc = cpu_to_le32(mapping); 277 desc->ndesc = cpu_to_le32(mapping);
278 desc->vndescp = desc + 1; 278 desc->vndescp = desc + 1;
279 desc++; 279 desc++;
diff --git a/drivers/net/s2io.c b/drivers/net/s2io.c
index b5c1e663417d..ae7b697456b4 100644
--- a/drivers/net/s2io.c
+++ b/drivers/net/s2io.c
@@ -2625,9 +2625,7 @@ static int fill_rx_buffers(struct ring_info *ring)
2625 rxdp1->Buffer0_ptr = pci_map_single 2625 rxdp1->Buffer0_ptr = pci_map_single
2626 (ring->pdev, skb->data, size - NET_IP_ALIGN, 2626 (ring->pdev, skb->data, size - NET_IP_ALIGN,
2627 PCI_DMA_FROMDEVICE); 2627 PCI_DMA_FROMDEVICE);
2628 if( (rxdp1->Buffer0_ptr == 0) || 2628 if(pci_dma_mapping_error(rxdp1->Buffer0_ptr))
2629 (rxdp1->Buffer0_ptr ==
2630 DMA_ERROR_CODE))
2631 goto pci_map_failed; 2629 goto pci_map_failed;
2632 2630
2633 rxdp->Control_2 = 2631 rxdp->Control_2 =
@@ -2657,6 +2655,7 @@ static int fill_rx_buffers(struct ring_info *ring)
2657 skb->data = (void *) (unsigned long)tmp; 2655 skb->data = (void *) (unsigned long)tmp;
2658 skb_reset_tail_pointer(skb); 2656 skb_reset_tail_pointer(skb);
2659 2657
2658 /* AK: check is wrong. 0 can be valid dma address */
2660 if (!(rxdp3->Buffer0_ptr)) 2659 if (!(rxdp3->Buffer0_ptr))
2661 rxdp3->Buffer0_ptr = 2660 rxdp3->Buffer0_ptr =
2662 pci_map_single(ring->pdev, ba->ba_0, 2661 pci_map_single(ring->pdev, ba->ba_0,
@@ -2665,8 +2664,7 @@ static int fill_rx_buffers(struct ring_info *ring)
2665 pci_dma_sync_single_for_device(ring->pdev, 2664 pci_dma_sync_single_for_device(ring->pdev,
2666 (dma_addr_t) rxdp3->Buffer0_ptr, 2665 (dma_addr_t) rxdp3->Buffer0_ptr,
2667 BUF0_LEN, PCI_DMA_FROMDEVICE); 2666 BUF0_LEN, PCI_DMA_FROMDEVICE);
2668 if( (rxdp3->Buffer0_ptr == 0) || 2667 if (pci_dma_mapping_error(rxdp3->Buffer0_ptr))
2669 (rxdp3->Buffer0_ptr == DMA_ERROR_CODE))
2670 goto pci_map_failed; 2668 goto pci_map_failed;
2671 2669
2672 rxdp->Control_2 = SET_BUFFER0_SIZE_3(BUF0_LEN); 2670 rxdp->Control_2 = SET_BUFFER0_SIZE_3(BUF0_LEN);
@@ -2681,18 +2679,17 @@ static int fill_rx_buffers(struct ring_info *ring)
2681 (ring->pdev, skb->data, ring->mtu + 4, 2679 (ring->pdev, skb->data, ring->mtu + 4,
2682 PCI_DMA_FROMDEVICE); 2680 PCI_DMA_FROMDEVICE);
2683 2681
2684 if( (rxdp3->Buffer2_ptr == 0) || 2682 if (pci_dma_mapping_error(rxdp3->Buffer2_ptr))
2685 (rxdp3->Buffer2_ptr == DMA_ERROR_CODE))
2686 goto pci_map_failed; 2683 goto pci_map_failed;
2687 2684
2685 /* AK: check is wrong */
2688 if (!rxdp3->Buffer1_ptr) 2686 if (!rxdp3->Buffer1_ptr)
2689 rxdp3->Buffer1_ptr = 2687 rxdp3->Buffer1_ptr =
2690 pci_map_single(ring->pdev, 2688 pci_map_single(ring->pdev,
2691 ba->ba_1, BUF1_LEN, 2689 ba->ba_1, BUF1_LEN,
2692 PCI_DMA_FROMDEVICE); 2690 PCI_DMA_FROMDEVICE);
2693 2691
2694 if( (rxdp3->Buffer1_ptr == 0) || 2692 if (pci_dma_mapping_error(rxdp3->Buffer1_ptr)) {
2695 (rxdp3->Buffer1_ptr == DMA_ERROR_CODE)) {
2696 pci_unmap_single 2693 pci_unmap_single
2697 (ring->pdev, 2694 (ring->pdev,
2698 (dma_addr_t)(unsigned long) 2695 (dma_addr_t)(unsigned long)
@@ -4264,16 +4261,14 @@ static int s2io_xmit(struct sk_buff *skb, struct net_device *dev)
4264 txdp->Buffer_Pointer = pci_map_single(sp->pdev, 4261 txdp->Buffer_Pointer = pci_map_single(sp->pdev,
4265 fifo->ufo_in_band_v, 4262 fifo->ufo_in_band_v,
4266 sizeof(u64), PCI_DMA_TODEVICE); 4263 sizeof(u64), PCI_DMA_TODEVICE);
4267 if((txdp->Buffer_Pointer == 0) || 4264 if (pci_dma_mapping_error(txdp->Buffer_Pointer))
4268 (txdp->Buffer_Pointer == DMA_ERROR_CODE))
4269 goto pci_map_failed; 4265 goto pci_map_failed;
4270 txdp++; 4266 txdp++;
4271 } 4267 }
4272 4268
4273 txdp->Buffer_Pointer = pci_map_single 4269 txdp->Buffer_Pointer = pci_map_single
4274 (sp->pdev, skb->data, frg_len, PCI_DMA_TODEVICE); 4270 (sp->pdev, skb->data, frg_len, PCI_DMA_TODEVICE);
4275 if((txdp->Buffer_Pointer == 0) || 4271 if (pci_dma_mapping_error(txdp->Buffer_Pointer))
4276 (txdp->Buffer_Pointer == DMA_ERROR_CODE))
4277 goto pci_map_failed; 4272 goto pci_map_failed;
4278 4273
4279 txdp->Host_Control = (unsigned long) skb; 4274 txdp->Host_Control = (unsigned long) skb;
@@ -6884,10 +6879,8 @@ static int set_rxd_buffer_pointer(struct s2io_nic *sp, struct RxD_t *rxdp,
6884 pci_map_single( sp->pdev, (*skb)->data, 6879 pci_map_single( sp->pdev, (*skb)->data,
6885 size - NET_IP_ALIGN, 6880 size - NET_IP_ALIGN,
6886 PCI_DMA_FROMDEVICE); 6881 PCI_DMA_FROMDEVICE);
6887 if( (rxdp1->Buffer0_ptr == 0) || 6882 if (pci_dma_mapping_error(rxdp1->Buffer0_ptr))
6888 (rxdp1->Buffer0_ptr == DMA_ERROR_CODE)) {
6889 goto memalloc_failed; 6883 goto memalloc_failed;
6890 }
6891 rxdp->Host_Control = (unsigned long) (*skb); 6884 rxdp->Host_Control = (unsigned long) (*skb);
6892 } 6885 }
6893 } else if ((sp->rxd_mode == RXD_MODE_3B) && (rxdp->Host_Control == 0)) { 6886 } else if ((sp->rxd_mode == RXD_MODE_3B) && (rxdp->Host_Control == 0)) {
@@ -6913,15 +6906,12 @@ static int set_rxd_buffer_pointer(struct s2io_nic *sp, struct RxD_t *rxdp,
6913 pci_map_single(sp->pdev, (*skb)->data, 6906 pci_map_single(sp->pdev, (*skb)->data,
6914 dev->mtu + 4, 6907 dev->mtu + 4,
6915 PCI_DMA_FROMDEVICE); 6908 PCI_DMA_FROMDEVICE);
6916 if( (rxdp3->Buffer2_ptr == 0) || 6909 if (pci_dma_mapping_error(rxdp3->Buffer2_ptr))
6917 (rxdp3->Buffer2_ptr == DMA_ERROR_CODE)) {
6918 goto memalloc_failed; 6910 goto memalloc_failed;
6919 }
6920 rxdp3->Buffer0_ptr = *temp0 = 6911 rxdp3->Buffer0_ptr = *temp0 =
6921 pci_map_single( sp->pdev, ba->ba_0, BUF0_LEN, 6912 pci_map_single( sp->pdev, ba->ba_0, BUF0_LEN,
6922 PCI_DMA_FROMDEVICE); 6913 PCI_DMA_FROMDEVICE);
6923 if( (rxdp3->Buffer0_ptr == 0) || 6914 if (pci_dma_mapping_error(rxdp3->Buffer0_ptr)) {
6924 (rxdp3->Buffer0_ptr == DMA_ERROR_CODE)) {
6925 pci_unmap_single (sp->pdev, 6915 pci_unmap_single (sp->pdev,
6926 (dma_addr_t)rxdp3->Buffer2_ptr, 6916 (dma_addr_t)rxdp3->Buffer2_ptr,
6927 dev->mtu + 4, PCI_DMA_FROMDEVICE); 6917 dev->mtu + 4, PCI_DMA_FROMDEVICE);
@@ -6933,8 +6923,7 @@ static int set_rxd_buffer_pointer(struct s2io_nic *sp, struct RxD_t *rxdp,
6933 rxdp3->Buffer1_ptr = *temp1 = 6923 rxdp3->Buffer1_ptr = *temp1 =
6934 pci_map_single(sp->pdev, ba->ba_1, BUF1_LEN, 6924 pci_map_single(sp->pdev, ba->ba_1, BUF1_LEN,
6935 PCI_DMA_FROMDEVICE); 6925 PCI_DMA_FROMDEVICE);
6936 if( (rxdp3->Buffer1_ptr == 0) || 6926 if (pci_dma_mapping_error(rxdp3->Buffer1_ptr)) {
6937 (rxdp3->Buffer1_ptr == DMA_ERROR_CODE)) {
6938 pci_unmap_single (sp->pdev, 6927 pci_unmap_single (sp->pdev,
6939 (dma_addr_t)rxdp3->Buffer0_ptr, 6928 (dma_addr_t)rxdp3->Buffer0_ptr,
6940 BUF0_LEN, PCI_DMA_FROMDEVICE); 6929 BUF0_LEN, PCI_DMA_FROMDEVICE);
diff --git a/drivers/net/s2io.h b/drivers/net/s2io.h
index 4706f7f9acb6..1827b6686c98 100644
--- a/drivers/net/s2io.h
+++ b/drivers/net/s2io.h
@@ -75,10 +75,6 @@ static int debug_level = ERR_DBG;
75/* DEBUG message print. */ 75/* DEBUG message print. */
76#define DBG_PRINT(dbg_level, args...) if(!(debug_level<dbg_level)) printk(args) 76#define DBG_PRINT(dbg_level, args...) if(!(debug_level<dbg_level)) printk(args)
77 77
78#ifndef DMA_ERROR_CODE
79#define DMA_ERROR_CODE (~(dma_addr_t)0x0)
80#endif
81
82/* Protocol assist features of the NIC */ 78/* Protocol assist features of the NIC */
83#define L3_CKSUM_OK 0xFFFF 79#define L3_CKSUM_OK 0xFFFF
84#define L4_CKSUM_OK 0xFFFF 80#define L4_CKSUM_OK 0xFFFF
diff --git a/drivers/net/tc35815.c b/drivers/net/tc35815.c
index 10e4e85da3fc..b07b8cbadeaf 100644
--- a/drivers/net/tc35815.c
+++ b/drivers/net/tc35815.c
@@ -1394,6 +1394,7 @@ tc35815_open(struct net_device *dev)
1394 tc35815_chip_init(dev); 1394 tc35815_chip_init(dev);
1395 spin_unlock_irq(&lp->lock); 1395 spin_unlock_irq(&lp->lock);
1396 1396
1397 netif_carrier_off(dev);
1397 /* schedule a link state check */ 1398 /* schedule a link state check */
1398 phy_start(lp->phy_dev); 1399 phy_start(lp->phy_dev);
1399 1400
@@ -1735,7 +1736,6 @@ tc35815_rx(struct net_device *dev)
1735 skb = lp->rx_skbs[cur_bd].skb; 1736 skb = lp->rx_skbs[cur_bd].skb;
1736 prefetch(skb->data); 1737 prefetch(skb->data);
1737 lp->rx_skbs[cur_bd].skb = NULL; 1738 lp->rx_skbs[cur_bd].skb = NULL;
1738 lp->fbl_count--;
1739 pci_unmap_single(lp->pci_dev, 1739 pci_unmap_single(lp->pci_dev,
1740 lp->rx_skbs[cur_bd].skb_dma, 1740 lp->rx_skbs[cur_bd].skb_dma,
1741 RX_BUF_SIZE, PCI_DMA_FROMDEVICE); 1741 RX_BUF_SIZE, PCI_DMA_FROMDEVICE);
@@ -1791,6 +1791,7 @@ tc35815_rx(struct net_device *dev)
1791#ifdef TC35815_USE_PACKEDBUFFER 1791#ifdef TC35815_USE_PACKEDBUFFER
1792 while (lp->fbl_curid != id) 1792 while (lp->fbl_curid != id)
1793#else 1793#else
1794 lp->fbl_count--;
1794 while (lp->fbl_count < RX_BUF_NUM) 1795 while (lp->fbl_count < RX_BUF_NUM)
1795#endif 1796#endif
1796 { 1797 {
@@ -2453,6 +2454,7 @@ static int tc35815_resume(struct pci_dev *pdev)
2453 return 0; 2454 return 0;
2454 pci_set_power_state(pdev, PCI_D0); 2455 pci_set_power_state(pdev, PCI_D0);
2455 tc35815_restart(dev); 2456 tc35815_restart(dev);
2457 netif_carrier_off(dev);
2456 if (lp->phy_dev) 2458 if (lp->phy_dev)
2457 phy_start(lp->phy_dev); 2459 phy_start(lp->phy_dev);
2458 netif_device_attach(dev); 2460 netif_device_attach(dev);
diff --git a/drivers/net/wan/x25_asy.c b/drivers/net/wan/x25_asy.c
index 249e18053d5f..069f8bb0a99f 100644
--- a/drivers/net/wan/x25_asy.c
+++ b/drivers/net/wan/x25_asy.c
@@ -32,6 +32,7 @@
32#include <linux/x25.h> 32#include <linux/x25.h>
33#include <linux/lapb.h> 33#include <linux/lapb.h>
34#include <linux/init.h> 34#include <linux/init.h>
35#include <linux/rtnetlink.h>
35#include "x25_asy.h" 36#include "x25_asy.h"
36 37
37#include <net/x25device.h> 38#include <net/x25device.h>
@@ -601,8 +602,10 @@ static void x25_asy_close_tty(struct tty_struct *tty)
601 if (!sl || sl->magic != X25_ASY_MAGIC) 602 if (!sl || sl->magic != X25_ASY_MAGIC)
602 return; 603 return;
603 604
605 rtnl_lock();
604 if (sl->dev->flags & IFF_UP) 606 if (sl->dev->flags & IFF_UP)
605 dev_close(sl->dev); 607 dev_close(sl->dev);
608 rtnl_unlock();
606 609
607 tty->disc_data = NULL; 610 tty->disc_data = NULL;
608 sl->tty = NULL; 611 sl->tty = NULL;
diff --git a/drivers/net/wireless/b43/leds.c b/drivers/net/wireless/b43/leds.c
index 36a9c42df835..76f4c7bad8b8 100644
--- a/drivers/net/wireless/b43/leds.c
+++ b/drivers/net/wireless/b43/leds.c
@@ -72,6 +72,9 @@ static void b43_led_brightness_set(struct led_classdev *led_dev,
72 struct b43_wldev *dev = led->dev; 72 struct b43_wldev *dev = led->dev;
73 bool radio_enabled; 73 bool radio_enabled;
74 74
75 if (unlikely(b43_status(dev) < B43_STAT_INITIALIZED))
76 return;
77
75 /* Checking the radio-enabled status here is slightly racy, 78 /* Checking the radio-enabled status here is slightly racy,
76 * but we want to avoid the locking overhead and we don't care 79 * but we want to avoid the locking overhead and we don't care
77 * whether the LED has the wrong state for a second. */ 80 * whether the LED has the wrong state for a second. */
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c
index fa4b0d8b74a2..a70827793086 100644
--- a/drivers/net/wireless/b43/main.c
+++ b/drivers/net/wireless/b43/main.c
@@ -2883,12 +2883,11 @@ static int b43_op_tx(struct ieee80211_hw *hw,
2883 2883
2884 if (unlikely(skb->len < 2 + 2 + 6)) { 2884 if (unlikely(skb->len < 2 + 2 + 6)) {
2885 /* Too short, this can't be a valid frame. */ 2885 /* Too short, this can't be a valid frame. */
2886 dev_kfree_skb_any(skb); 2886 goto drop_packet;
2887 return NETDEV_TX_OK;
2888 } 2887 }
2889 B43_WARN_ON(skb_shinfo(skb)->nr_frags); 2888 B43_WARN_ON(skb_shinfo(skb)->nr_frags);
2890 if (unlikely(!dev)) 2889 if (unlikely(!dev))
2891 return NETDEV_TX_BUSY; 2890 goto drop_packet;
2892 2891
2893 /* Transmissions on seperate queues can run concurrently. */ 2892 /* Transmissions on seperate queues can run concurrently. */
2894 read_lock_irqsave(&wl->tx_lock, flags); 2893 read_lock_irqsave(&wl->tx_lock, flags);
@@ -2904,7 +2903,12 @@ static int b43_op_tx(struct ieee80211_hw *hw,
2904 read_unlock_irqrestore(&wl->tx_lock, flags); 2903 read_unlock_irqrestore(&wl->tx_lock, flags);
2905 2904
2906 if (unlikely(err)) 2905 if (unlikely(err))
2907 return NETDEV_TX_BUSY; 2906 goto drop_packet;
2907 return NETDEV_TX_OK;
2908
2909drop_packet:
2910 /* We can not transmit this packet. Drop it. */
2911 dev_kfree_skb_any(skb);
2908 return NETDEV_TX_OK; 2912 return NETDEV_TX_OK;
2909} 2913}
2910 2914
diff --git a/drivers/net/wireless/b43legacy/dma.c b/drivers/net/wireless/b43legacy/dma.c
index c990f87b107a..93ddc1cbcc8b 100644
--- a/drivers/net/wireless/b43legacy/dma.c
+++ b/drivers/net/wireless/b43legacy/dma.c
@@ -876,6 +876,7 @@ struct b43legacy_dmaring *b43legacy_setup_dmaring(struct b43legacy_wldev *dev,
876 if (!ring) 876 if (!ring)
877 goto out; 877 goto out;
878 ring->type = type; 878 ring->type = type;
879 ring->dev = dev;
879 880
880 nr_slots = B43legacy_RXRING_SLOTS; 881 nr_slots = B43legacy_RXRING_SLOTS;
881 if (for_tx) 882 if (for_tx)
@@ -922,7 +923,6 @@ struct b43legacy_dmaring *b43legacy_setup_dmaring(struct b43legacy_wldev *dev,
922 DMA_TO_DEVICE); 923 DMA_TO_DEVICE);
923 } 924 }
924 925
925 ring->dev = dev;
926 ring->nr_slots = nr_slots; 926 ring->nr_slots = nr_slots;
927 ring->mmio_base = b43legacy_dmacontroller_base(type, controller_index); 927 ring->mmio_base = b43legacy_dmacontroller_base(type, controller_index);
928 ring->index = controller_index; 928 ring->index = controller_index;
diff --git a/drivers/net/wireless/b43legacy/main.c b/drivers/net/wireless/b43legacy/main.c
index 204077c13870..3e612d0a13e8 100644
--- a/drivers/net/wireless/b43legacy/main.c
+++ b/drivers/net/wireless/b43legacy/main.c
@@ -2378,8 +2378,10 @@ static int b43legacy_op_tx(struct ieee80211_hw *hw,
2378 } else 2378 } else
2379 err = b43legacy_dma_tx(dev, skb, ctl); 2379 err = b43legacy_dma_tx(dev, skb, ctl);
2380out: 2380out:
2381 if (unlikely(err)) 2381 if (unlikely(err)) {
2382 return NETDEV_TX_BUSY; 2382 /* Drop the packet. */
2383 dev_kfree_skb_any(skb);
2384 }
2383 return NETDEV_TX_OK; 2385 return NETDEV_TX_OK;
2384} 2386}
2385 2387
diff --git a/drivers/net/wireless/hostap/hostap_80211_rx.c b/drivers/net/wireless/hostap/hostap_80211_rx.c
index 4fd73809602e..020f450e9dba 100644
--- a/drivers/net/wireless/hostap/hostap_80211_rx.c
+++ b/drivers/net/wireless/hostap/hostap_80211_rx.c
@@ -64,7 +64,7 @@ int prism2_rx_80211(struct net_device *dev, struct sk_buff *skb,
64 int hdrlen, phdrlen, head_need, tail_need; 64 int hdrlen, phdrlen, head_need, tail_need;
65 u16 fc; 65 u16 fc;
66 int prism_header, ret; 66 int prism_header, ret;
67 struct ieee80211_hdr_4addr *hdr; 67 struct ieee80211_hdr_4addr *fhdr;
68 68
69 iface = netdev_priv(dev); 69 iface = netdev_priv(dev);
70 local = iface->local; 70 local = iface->local;
@@ -83,8 +83,8 @@ int prism2_rx_80211(struct net_device *dev, struct sk_buff *skb,
83 phdrlen = 0; 83 phdrlen = 0;
84 } 84 }
85 85
86 hdr = (struct ieee80211_hdr_4addr *) skb->data; 86 fhdr = (struct ieee80211_hdr_4addr *) skb->data;
87 fc = le16_to_cpu(hdr->frame_ctl); 87 fc = le16_to_cpu(fhdr->frame_ctl);
88 88
89 if (type == PRISM2_RX_MGMT && (fc & IEEE80211_FCTL_VERS)) { 89 if (type == PRISM2_RX_MGMT && (fc & IEEE80211_FCTL_VERS)) {
90 printk(KERN_DEBUG "%s: dropped management frame with header " 90 printk(KERN_DEBUG "%s: dropped management frame with header "
@@ -551,7 +551,7 @@ hostap_rx_frame_wds(local_info_t *local, struct ieee80211_hdr_4addr *hdr,
551 hdr->addr1[2] != 0xff || hdr->addr1[3] != 0xff || 551 hdr->addr1[2] != 0xff || hdr->addr1[3] != 0xff ||
552 hdr->addr1[4] != 0xff || hdr->addr1[5] != 0xff)) { 552 hdr->addr1[4] != 0xff || hdr->addr1[5] != 0xff)) {
553 /* RA (or BSSID) is not ours - drop */ 553 /* RA (or BSSID) is not ours - drop */
554 PDEBUG(DEBUG_EXTRA, "%s: received WDS frame with " 554 PDEBUG(DEBUG_EXTRA2, "%s: received WDS frame with "
555 "not own or broadcast %s=%s\n", 555 "not own or broadcast %s=%s\n",
556 local->dev->name, 556 local->dev->name,
557 fc & IEEE80211_FCTL_FROMDS ? "RA" : "BSSID", 557 fc & IEEE80211_FCTL_FROMDS ? "RA" : "BSSID",
diff --git a/drivers/net/wireless/hostap/hostap_ap.c b/drivers/net/wireless/hostap/hostap_ap.c
index 0acd9589c48c..ab981afd481d 100644
--- a/drivers/net/wireless/hostap/hostap_ap.c
+++ b/drivers/net/wireless/hostap/hostap_ap.c
@@ -1930,7 +1930,7 @@ static void handle_pspoll(local_info_t *local,
1930 PDEBUG(DEBUG_PS, " PSPOLL and AID[15:14] not set\n"); 1930 PDEBUG(DEBUG_PS, " PSPOLL and AID[15:14] not set\n");
1931 return; 1931 return;
1932 } 1932 }
1933 aid &= ~BIT(15) & ~BIT(14); 1933 aid &= ~(BIT(15) | BIT(14));
1934 if (aid == 0 || aid > MAX_AID_TABLE_SIZE) { 1934 if (aid == 0 || aid > MAX_AID_TABLE_SIZE) {
1935 PDEBUG(DEBUG_PS, " invalid aid=%d\n", aid); 1935 PDEBUG(DEBUG_PS, " invalid aid=%d\n", aid);
1936 return; 1936 return;
diff --git a/drivers/net/wireless/hostap/hostap_cs.c b/drivers/net/wireless/hostap/hostap_cs.c
index ed4317a17cbb..80039a0ae027 100644
--- a/drivers/net/wireless/hostap/hostap_cs.c
+++ b/drivers/net/wireless/hostap/hostap_cs.c
@@ -533,10 +533,10 @@ static void prism2_detach(struct pcmcia_device *link)
533do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) 533do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
534 534
535#define CFG_CHECK2(fn, retf) \ 535#define CFG_CHECK2(fn, retf) \
536do { int ret = (retf); \ 536do { int _ret = (retf); \
537if (ret != 0) { \ 537if (_ret != 0) { \
538 PDEBUG(DEBUG_EXTRA, "CardServices(" #fn ") returned %d\n", ret); \ 538 PDEBUG(DEBUG_EXTRA, "CardServices(" #fn ") returned %d\n", _ret); \
539 cs_error(link, fn, ret); \ 539 cs_error(link, fn, _ret); \
540 goto next_entry; \ 540 goto next_entry; \
541} \ 541} \
542} while (0) 542} while (0)
diff --git a/drivers/net/wireless/hostap/hostap_hw.c b/drivers/net/wireless/hostap/hostap_hw.c
index cdf90c40f11b..936f52e3d95c 100644
--- a/drivers/net/wireless/hostap/hostap_hw.c
+++ b/drivers/net/wireless/hostap/hostap_hw.c
@@ -2835,7 +2835,7 @@ static void hostap_passive_scan(unsigned long data)
2835{ 2835{
2836 local_info_t *local = (local_info_t *) data; 2836 local_info_t *local = (local_info_t *) data;
2837 struct net_device *dev = local->dev; 2837 struct net_device *dev = local->dev;
2838 u16 channel; 2838 u16 chan;
2839 2839
2840 if (local->passive_scan_interval <= 0) 2840 if (local->passive_scan_interval <= 0)
2841 return; 2841 return;
@@ -2872,11 +2872,11 @@ static void hostap_passive_scan(unsigned long data)
2872 2872
2873 printk(KERN_DEBUG "%s: passive scan channel %d\n", 2873 printk(KERN_DEBUG "%s: passive scan channel %d\n",
2874 dev->name, local->passive_scan_channel); 2874 dev->name, local->passive_scan_channel);
2875 channel = local->passive_scan_channel; 2875 chan = local->passive_scan_channel;
2876 local->passive_scan_state = PASSIVE_SCAN_WAIT; 2876 local->passive_scan_state = PASSIVE_SCAN_WAIT;
2877 local->passive_scan_timer.expires = jiffies + HZ / 10; 2877 local->passive_scan_timer.expires = jiffies + HZ / 10;
2878 } else { 2878 } else {
2879 channel = local->channel; 2879 chan = local->channel;
2880 local->passive_scan_state = PASSIVE_SCAN_LISTEN; 2880 local->passive_scan_state = PASSIVE_SCAN_LISTEN;
2881 local->passive_scan_timer.expires = jiffies + 2881 local->passive_scan_timer.expires = jiffies +
2882 local->passive_scan_interval * HZ; 2882 local->passive_scan_interval * HZ;
@@ -2884,9 +2884,9 @@ static void hostap_passive_scan(unsigned long data)
2884 2884
2885 if (hfa384x_cmd_callback(dev, HFA384X_CMDCODE_TEST | 2885 if (hfa384x_cmd_callback(dev, HFA384X_CMDCODE_TEST |
2886 (HFA384X_TEST_CHANGE_CHANNEL << 8), 2886 (HFA384X_TEST_CHANGE_CHANNEL << 8),
2887 channel, NULL, 0)) 2887 chan, NULL, 0))
2888 printk(KERN_ERR "%s: passive scan channel set %d " 2888 printk(KERN_ERR "%s: passive scan channel set %d "
2889 "failed\n", dev->name, channel); 2889 "failed\n", dev->name, chan);
2890 2890
2891 add_timer(&local->passive_scan_timer); 2891 add_timer(&local->passive_scan_timer);
2892} 2892}
diff --git a/drivers/net/wireless/hostap/hostap_main.c b/drivers/net/wireless/hostap/hostap_main.c
index f7aec9309d04..a38e85f334df 100644
--- a/drivers/net/wireless/hostap/hostap_main.c
+++ b/drivers/net/wireless/hostap/hostap_main.c
@@ -594,7 +594,8 @@ void hostap_dump_tx_header(const char *name, const struct hfa384x_tx_frame *tx)
594} 594}
595 595
596 596
597int hostap_80211_header_parse(const struct sk_buff *skb, unsigned char *haddr) 597static int hostap_80211_header_parse(const struct sk_buff *skb,
598 unsigned char *haddr)
598{ 599{
599 struct hostap_interface *iface = netdev_priv(skb->dev); 600 struct hostap_interface *iface = netdev_priv(skb->dev);
600 local_info_t *local = iface->local; 601 local_info_t *local = iface->local;
@@ -857,7 +858,6 @@ const struct header_ops hostap_80211_ops = {
857 .rebuild = eth_rebuild_header, 858 .rebuild = eth_rebuild_header,
858 .cache = eth_header_cache, 859 .cache = eth_header_cache,
859 .cache_update = eth_header_cache_update, 860 .cache_update = eth_header_cache_update,
860
861 .parse = hostap_80211_header_parse, 861 .parse = hostap_80211_header_parse,
862}; 862};
863EXPORT_SYMBOL(hostap_80211_ops); 863EXPORT_SYMBOL(hostap_80211_ops);
@@ -1150,7 +1150,6 @@ EXPORT_SYMBOL(hostap_set_roaming);
1150EXPORT_SYMBOL(hostap_set_auth_algs); 1150EXPORT_SYMBOL(hostap_set_auth_algs);
1151EXPORT_SYMBOL(hostap_dump_rx_header); 1151EXPORT_SYMBOL(hostap_dump_rx_header);
1152EXPORT_SYMBOL(hostap_dump_tx_header); 1152EXPORT_SYMBOL(hostap_dump_tx_header);
1153EXPORT_SYMBOL(hostap_80211_header_parse);
1154EXPORT_SYMBOL(hostap_80211_get_hdrlen); 1153EXPORT_SYMBOL(hostap_80211_get_hdrlen);
1155EXPORT_SYMBOL(hostap_get_stats); 1154EXPORT_SYMBOL(hostap_get_stats);
1156EXPORT_SYMBOL(hostap_setup_dev); 1155EXPORT_SYMBOL(hostap_setup_dev);
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index 13925b627e3b..b1b3c523185d 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -2227,7 +2227,10 @@ static int iwl3945_scan_initiate(struct iwl3945_priv *priv)
2227 } 2227 }
2228 2228
2229 IWL_DEBUG_INFO("Starting scan...\n"); 2229 IWL_DEBUG_INFO("Starting scan...\n");
2230 priv->scan_bands = 2; 2230 if (priv->cfg->sku & IWL_SKU_G)
2231 priv->scan_bands |= BIT(IEEE80211_BAND_2GHZ);
2232 if (priv->cfg->sku & IWL_SKU_A)
2233 priv->scan_bands |= BIT(IEEE80211_BAND_5GHZ);
2231 set_bit(STATUS_SCANNING, &priv->status); 2234 set_bit(STATUS_SCANNING, &priv->status);
2232 priv->scan_start = jiffies; 2235 priv->scan_start = jiffies;
2233 priv->scan_pass_start = priv->scan_start; 2236 priv->scan_pass_start = priv->scan_start;
@@ -3352,13 +3355,18 @@ static void iwl3945_rx_scan_complete_notif(struct iwl3945_priv *priv,
3352 cancel_delayed_work(&priv->scan_check); 3355 cancel_delayed_work(&priv->scan_check);
3353 3356
3354 IWL_DEBUG_INFO("Scan pass on %sGHz took %dms\n", 3357 IWL_DEBUG_INFO("Scan pass on %sGHz took %dms\n",
3355 (priv->scan_bands == 2) ? "2.4" : "5.2", 3358 (priv->scan_bands & BIT(IEEE80211_BAND_2GHZ)) ?
3359 "2.4" : "5.2",
3356 jiffies_to_msecs(elapsed_jiffies 3360 jiffies_to_msecs(elapsed_jiffies
3357 (priv->scan_pass_start, jiffies))); 3361 (priv->scan_pass_start, jiffies)));
3358 3362
3359 /* Remove this scanned band from the list 3363 /* Remove this scanned band from the list of pending
3360 * of pending bands to scan */ 3364 * bands to scan, band G precedes A in order of scanning
3361 priv->scan_bands--; 3365 * as seen in iwl3945_bg_request_scan */
3366 if (priv->scan_bands & BIT(IEEE80211_BAND_2GHZ))
3367 priv->scan_bands &= ~BIT(IEEE80211_BAND_2GHZ);
3368 else if (priv->scan_bands & BIT(IEEE80211_BAND_5GHZ))
3369 priv->scan_bands &= ~BIT(IEEE80211_BAND_5GHZ);
3362 3370
3363 /* If a request to abort was given, or the scan did not succeed 3371 /* If a request to abort was given, or the scan did not succeed
3364 * then we reset the scan state machine and terminate, 3372 * then we reset the scan state machine and terminate,
@@ -4972,7 +4980,7 @@ static int iwl3945_get_channels_for_scan(struct iwl3945_priv *priv,
4972 4980
4973 ch_info = iwl3945_get_channel_info(priv, band, scan_ch->channel); 4981 ch_info = iwl3945_get_channel_info(priv, band, scan_ch->channel);
4974 if (!is_channel_valid(ch_info)) { 4982 if (!is_channel_valid(ch_info)) {
4975 IWL_DEBUG_SCAN("Channel %d is INVALID for this SKU.\n", 4983 IWL_DEBUG_SCAN("Channel %d is INVALID for this band.\n",
4976 scan_ch->channel); 4984 scan_ch->channel);
4977 continue; 4985 continue;
4978 } 4986 }
@@ -6315,21 +6323,16 @@ static void iwl3945_bg_request_scan(struct work_struct *data)
6315 6323
6316 /* flags + rate selection */ 6324 /* flags + rate selection */
6317 6325
6318 switch (priv->scan_bands) { 6326 if (priv->scan_bands & BIT(IEEE80211_BAND_2GHZ)) {
6319 case 2:
6320 scan->flags = RXON_FLG_BAND_24G_MSK | RXON_FLG_AUTO_DETECT_MSK; 6327 scan->flags = RXON_FLG_BAND_24G_MSK | RXON_FLG_AUTO_DETECT_MSK;
6321 scan->tx_cmd.rate = IWL_RATE_1M_PLCP; 6328 scan->tx_cmd.rate = IWL_RATE_1M_PLCP;
6322 scan->good_CRC_th = 0; 6329 scan->good_CRC_th = 0;
6323 band = IEEE80211_BAND_2GHZ; 6330 band = IEEE80211_BAND_2GHZ;
6324 break; 6331 } else if (priv->scan_bands & BIT(IEEE80211_BAND_5GHZ)) {
6325
6326 case 1:
6327 scan->tx_cmd.rate = IWL_RATE_6M_PLCP; 6332 scan->tx_cmd.rate = IWL_RATE_6M_PLCP;
6328 scan->good_CRC_th = IWL_GOOD_CRC_TH; 6333 scan->good_CRC_th = IWL_GOOD_CRC_TH;
6329 band = IEEE80211_BAND_5GHZ; 6334 band = IEEE80211_BAND_5GHZ;
6330 break; 6335 } else {
6331
6332 default:
6333 IWL_WARNING("Invalid scan band count\n"); 6336 IWL_WARNING("Invalid scan band count\n");
6334 goto done; 6337 goto done;
6335 } 6338 }
@@ -6770,7 +6773,7 @@ static int iwl3945_mac_config(struct ieee80211_hw *hw, struct ieee80211_conf *co
6770 ch_info = iwl3945_get_channel_info(priv, conf->channel->band, 6773 ch_info = iwl3945_get_channel_info(priv, conf->channel->band,
6771 conf->channel->hw_value); 6774 conf->channel->hw_value);
6772 if (!is_channel_valid(ch_info)) { 6775 if (!is_channel_valid(ch_info)) {
6773 IWL_DEBUG_SCAN("Channel %d [%d] is INVALID for this SKU.\n", 6776 IWL_DEBUG_SCAN("Channel %d [%d] is INVALID for this band.\n",
6774 conf->channel->hw_value, conf->channel->band); 6777 conf->channel->hw_value, conf->channel->band);
6775 IWL_DEBUG_MAC80211("leave - invalid channel\n"); 6778 IWL_DEBUG_MAC80211("leave - invalid channel\n");
6776 spin_unlock_irqrestore(&priv->lock, flags); 6779 spin_unlock_irqrestore(&priv->lock, flags);
diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c
index 883b42f7e998..5ed16ce78468 100644
--- a/drivers/net/wireless/iwlwifi/iwl4965-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c
@@ -1774,7 +1774,10 @@ static int iwl4965_scan_initiate(struct iwl_priv *priv)
1774 } 1774 }
1775 1775
1776 IWL_DEBUG_INFO("Starting scan...\n"); 1776 IWL_DEBUG_INFO("Starting scan...\n");
1777 priv->scan_bands = 2; 1777 if (priv->cfg->sku & IWL_SKU_G)
1778 priv->scan_bands |= BIT(IEEE80211_BAND_2GHZ);
1779 if (priv->cfg->sku & IWL_SKU_A)
1780 priv->scan_bands |= BIT(IEEE80211_BAND_5GHZ);
1778 set_bit(STATUS_SCANNING, &priv->status); 1781 set_bit(STATUS_SCANNING, &priv->status);
1779 priv->scan_start = jiffies; 1782 priv->scan_start = jiffies;
1780 priv->scan_pass_start = priv->scan_start; 1783 priv->scan_pass_start = priv->scan_start;
@@ -3023,8 +3026,9 @@ static void iwl4965_rx_reply_tx(struct iwl_priv *priv,
3023 3026
3024 IWL_DEBUG_TX_REPLY("Tx queue reclaim %d\n", index); 3027 IWL_DEBUG_TX_REPLY("Tx queue reclaim %d\n", index);
3025 if (index != -1) { 3028 if (index != -1) {
3026 int freed = iwl4965_tx_queue_reclaim(priv, txq_id, index);
3027#ifdef CONFIG_IWL4965_HT 3029#ifdef CONFIG_IWL4965_HT
3030 int freed = iwl4965_tx_queue_reclaim(priv, txq_id, index);
3031
3028 if (tid != MAX_TID_COUNT) 3032 if (tid != MAX_TID_COUNT)
3029 priv->stations[sta_id].tid[tid].tfds_in_queue -= freed; 3033 priv->stations[sta_id].tid[tid].tfds_in_queue -= freed;
3030 if (iwl4965_queue_space(&txq->q) > txq->q.low_mark && 3034 if (iwl4965_queue_space(&txq->q) > txq->q.low_mark &&
@@ -3276,13 +3280,18 @@ static void iwl4965_rx_scan_complete_notif(struct iwl_priv *priv,
3276 cancel_delayed_work(&priv->scan_check); 3280 cancel_delayed_work(&priv->scan_check);
3277 3281
3278 IWL_DEBUG_INFO("Scan pass on %sGHz took %dms\n", 3282 IWL_DEBUG_INFO("Scan pass on %sGHz took %dms\n",
3279 (priv->scan_bands == 2) ? "2.4" : "5.2", 3283 (priv->scan_bands & BIT(IEEE80211_BAND_2GHZ)) ?
3284 "2.4" : "5.2",
3280 jiffies_to_msecs(elapsed_jiffies 3285 jiffies_to_msecs(elapsed_jiffies
3281 (priv->scan_pass_start, jiffies))); 3286 (priv->scan_pass_start, jiffies)));
3282 3287
3283 /* Remove this scanned band from the list 3288 /* Remove this scanned band from the list of pending
3284 * of pending bands to scan */ 3289 * bands to scan, band G precedes A in order of scanning
3285 priv->scan_bands--; 3290 * as seen in iwl_bg_request_scan */
3291 if (priv->scan_bands & BIT(IEEE80211_BAND_2GHZ))
3292 priv->scan_bands &= ~BIT(IEEE80211_BAND_2GHZ);
3293 else if (priv->scan_bands & BIT(IEEE80211_BAND_5GHZ))
3294 priv->scan_bands &= ~BIT(IEEE80211_BAND_5GHZ);
3286 3295
3287 /* If a request to abort was given, or the scan did not succeed 3296 /* If a request to abort was given, or the scan did not succeed
3288 * then we reset the scan state machine and terminate, 3297 * then we reset the scan state machine and terminate,
@@ -3292,7 +3301,7 @@ static void iwl4965_rx_scan_complete_notif(struct iwl_priv *priv,
3292 clear_bit(STATUS_SCAN_ABORTING, &priv->status); 3301 clear_bit(STATUS_SCAN_ABORTING, &priv->status);
3293 } else { 3302 } else {
3294 /* If there are more bands on this scan pass reschedule */ 3303 /* If there are more bands on this scan pass reschedule */
3295 if (priv->scan_bands > 0) 3304 if (priv->scan_bands)
3296 goto reschedule; 3305 goto reschedule;
3297 } 3306 }
3298 3307
@@ -4635,10 +4644,9 @@ static int iwl4965_get_channels_for_scan(struct iwl_priv *priv,
4635 4644
4636 scan_ch->channel = ieee80211_frequency_to_channel(channels[i].center_freq); 4645 scan_ch->channel = ieee80211_frequency_to_channel(channels[i].center_freq);
4637 4646
4638 ch_info = iwl_get_channel_info(priv, band, 4647 ch_info = iwl_get_channel_info(priv, band, scan_ch->channel);
4639 scan_ch->channel);
4640 if (!is_channel_valid(ch_info)) { 4648 if (!is_channel_valid(ch_info)) {
4641 IWL_DEBUG_SCAN("Channel %d is INVALID for this SKU.\n", 4649 IWL_DEBUG_SCAN("Channel %d is INVALID for this band.\n",
4642 scan_ch->channel); 4650 scan_ch->channel);
4643 continue; 4651 continue;
4644 } 4652 }
@@ -5830,8 +5838,7 @@ static void iwl4965_bg_request_scan(struct work_struct *data)
5830 scan->tx_cmd.stop_time.life_time = TX_CMD_LIFE_TIME_INFINITE; 5838 scan->tx_cmd.stop_time.life_time = TX_CMD_LIFE_TIME_INFINITE;
5831 5839
5832 5840
5833 switch (priv->scan_bands) { 5841 if (priv->scan_bands & BIT(IEEE80211_BAND_2GHZ)) {
5834 case 2:
5835 scan->flags = RXON_FLG_BAND_24G_MSK | RXON_FLG_AUTO_DETECT_MSK; 5842 scan->flags = RXON_FLG_BAND_24G_MSK | RXON_FLG_AUTO_DETECT_MSK;
5836 scan->tx_cmd.rate_n_flags = 5843 scan->tx_cmd.rate_n_flags =
5837 iwl4965_hw_set_rate_n_flags(IWL_RATE_1M_PLCP, 5844 iwl4965_hw_set_rate_n_flags(IWL_RATE_1M_PLCP,
@@ -5839,17 +5846,13 @@ static void iwl4965_bg_request_scan(struct work_struct *data)
5839 5846
5840 scan->good_CRC_th = 0; 5847 scan->good_CRC_th = 0;
5841 band = IEEE80211_BAND_2GHZ; 5848 band = IEEE80211_BAND_2GHZ;
5842 break; 5849 } else if (priv->scan_bands & BIT(IEEE80211_BAND_5GHZ)) {
5843
5844 case 1:
5845 scan->tx_cmd.rate_n_flags = 5850 scan->tx_cmd.rate_n_flags =
5846 iwl4965_hw_set_rate_n_flags(IWL_RATE_6M_PLCP, 5851 iwl4965_hw_set_rate_n_flags(IWL_RATE_6M_PLCP,
5847 RATE_MCS_ANT_B_MSK); 5852 RATE_MCS_ANT_B_MSK);
5848 scan->good_CRC_th = IWL_GOOD_CRC_TH; 5853 scan->good_CRC_th = IWL_GOOD_CRC_TH;
5849 band = IEEE80211_BAND_5GHZ; 5854 band = IEEE80211_BAND_5GHZ;
5850 break; 5855 } else {
5851
5852 default:
5853 IWL_WARNING("Invalid scan band count\n"); 5856 IWL_WARNING("Invalid scan band count\n");
5854 goto done; 5857 goto done;
5855 } 5858 }
diff --git a/drivers/net/wireless/prism54/islpci_eth.c b/drivers/net/wireless/prism54/islpci_eth.c
index 762e85bef55d..e43bae97ed8f 100644
--- a/drivers/net/wireless/prism54/islpci_eth.c
+++ b/drivers/net/wireless/prism54/islpci_eth.c
@@ -290,7 +290,7 @@ islpci_monitor_rx(islpci_private *priv, struct sk_buff **skb)
290 290
291 avs->version = cpu_to_be32(P80211CAPTURE_VERSION); 291 avs->version = cpu_to_be32(P80211CAPTURE_VERSION);
292 avs->length = cpu_to_be32(sizeof (struct avs_80211_1_header)); 292 avs->length = cpu_to_be32(sizeof (struct avs_80211_1_header));
293 avs->mactime = cpu_to_be64(le64_to_cpu(clock)); 293 avs->mactime = cpu_to_be64(clock);
294 avs->hosttime = cpu_to_be64(jiffies); 294 avs->hosttime = cpu_to_be64(jiffies);
295 avs->phytype = cpu_to_be32(6); /*OFDM: 6 for (g), 8 for (a) */ 295 avs->phytype = cpu_to_be32(6); /*OFDM: 6 for (g), 8 for (a) */
296 avs->channel = cpu_to_be32(channel_of_freq(freq)); 296 avs->channel = cpu_to_be32(channel_of_freq(freq));
diff --git a/drivers/net/wireless/rt2x00/rt2500usb.c b/drivers/net/wireless/rt2x00/rt2500usb.c
index fdbd0ef2be4b..61e59c17a60a 100644
--- a/drivers/net/wireless/rt2x00/rt2500usb.c
+++ b/drivers/net/wireless/rt2x00/rt2500usb.c
@@ -138,11 +138,8 @@ static void rt2500usb_bbp_write(struct rt2x00_dev *rt2x00dev,
138 * Wait until the BBP becomes ready. 138 * Wait until the BBP becomes ready.
139 */ 139 */
140 reg = rt2500usb_bbp_check(rt2x00dev); 140 reg = rt2500usb_bbp_check(rt2x00dev);
141 if (rt2x00_get_field16(reg, PHY_CSR8_BUSY)) { 141 if (rt2x00_get_field16(reg, PHY_CSR8_BUSY))
142 ERROR(rt2x00dev, "PHY_CSR8 register busy. Write failed.\n"); 142 goto exit_fail;
143 mutex_unlock(&rt2x00dev->usb_cache_mutex);
144 return;
145 }
146 143
147 /* 144 /*
148 * Write the data into the BBP. 145 * Write the data into the BBP.
@@ -155,6 +152,13 @@ static void rt2500usb_bbp_write(struct rt2x00_dev *rt2x00dev,
155 rt2500usb_register_write_lock(rt2x00dev, PHY_CSR7, reg); 152 rt2500usb_register_write_lock(rt2x00dev, PHY_CSR7, reg);
156 153
157 mutex_unlock(&rt2x00dev->usb_cache_mutex); 154 mutex_unlock(&rt2x00dev->usb_cache_mutex);
155
156 return;
157
158exit_fail:
159 mutex_unlock(&rt2x00dev->usb_cache_mutex);
160
161 ERROR(rt2x00dev, "PHY_CSR8 register busy. Write failed.\n");
158} 162}
159 163
160static void rt2500usb_bbp_read(struct rt2x00_dev *rt2x00dev, 164static void rt2500usb_bbp_read(struct rt2x00_dev *rt2x00dev,
@@ -168,10 +172,8 @@ static void rt2500usb_bbp_read(struct rt2x00_dev *rt2x00dev,
168 * Wait until the BBP becomes ready. 172 * Wait until the BBP becomes ready.
169 */ 173 */
170 reg = rt2500usb_bbp_check(rt2x00dev); 174 reg = rt2500usb_bbp_check(rt2x00dev);
171 if (rt2x00_get_field16(reg, PHY_CSR8_BUSY)) { 175 if (rt2x00_get_field16(reg, PHY_CSR8_BUSY))
172 ERROR(rt2x00dev, "PHY_CSR8 register busy. Read failed.\n"); 176 goto exit_fail;
173 return;
174 }
175 177
176 /* 178 /*
177 * Write the request into the BBP. 179 * Write the request into the BBP.
@@ -186,17 +188,21 @@ static void rt2500usb_bbp_read(struct rt2x00_dev *rt2x00dev,
186 * Wait until the BBP becomes ready. 188 * Wait until the BBP becomes ready.
187 */ 189 */
188 reg = rt2500usb_bbp_check(rt2x00dev); 190 reg = rt2500usb_bbp_check(rt2x00dev);
189 if (rt2x00_get_field16(reg, PHY_CSR8_BUSY)) { 191 if (rt2x00_get_field16(reg, PHY_CSR8_BUSY))
190 ERROR(rt2x00dev, "PHY_CSR8 register busy. Read failed.\n"); 192 goto exit_fail;
191 *value = 0xff;
192 mutex_unlock(&rt2x00dev->usb_cache_mutex);
193 return;
194 }
195 193
196 rt2500usb_register_read_lock(rt2x00dev, PHY_CSR7, &reg); 194 rt2500usb_register_read_lock(rt2x00dev, PHY_CSR7, &reg);
197 *value = rt2x00_get_field16(reg, PHY_CSR7_DATA); 195 *value = rt2x00_get_field16(reg, PHY_CSR7_DATA);
198 196
199 mutex_unlock(&rt2x00dev->usb_cache_mutex); 197 mutex_unlock(&rt2x00dev->usb_cache_mutex);
198
199 return;
200
201exit_fail:
202 mutex_unlock(&rt2x00dev->usb_cache_mutex);
203
204 ERROR(rt2x00dev, "PHY_CSR8 register busy. Read failed.\n");
205 *value = 0xff;
200} 206}
201 207
202static void rt2500usb_rf_write(struct rt2x00_dev *rt2x00dev, 208static void rt2500usb_rf_write(struct rt2x00_dev *rt2x00dev,
diff --git a/drivers/net/wireless/rt2x00/rt2x00.h b/drivers/net/wireless/rt2x00/rt2x00.h
index 611d98320593..b4bf1e09cf9a 100644
--- a/drivers/net/wireless/rt2x00/rt2x00.h
+++ b/drivers/net/wireless/rt2x00/rt2x00.h
@@ -821,6 +821,7 @@ struct rt2x00_dev {
821 /* 821 /*
822 * Scheduled work. 822 * Scheduled work.
823 */ 823 */
824 struct workqueue_struct *workqueue;
824 struct work_struct intf_work; 825 struct work_struct intf_work;
825 struct work_struct filter_work; 826 struct work_struct filter_work;
826 827
diff --git a/drivers/net/wireless/rt2x00/rt2x00dev.c b/drivers/net/wireless/rt2x00/rt2x00dev.c
index 2673d568bcac..c997d4f28ab3 100644
--- a/drivers/net/wireless/rt2x00/rt2x00dev.c
+++ b/drivers/net/wireless/rt2x00/rt2x00dev.c
@@ -75,7 +75,7 @@ static void rt2x00lib_start_link_tuner(struct rt2x00_dev *rt2x00dev)
75 75
76 rt2x00lib_reset_link_tuner(rt2x00dev); 76 rt2x00lib_reset_link_tuner(rt2x00dev);
77 77
78 queue_delayed_work(rt2x00dev->hw->workqueue, 78 queue_delayed_work(rt2x00dev->workqueue,
79 &rt2x00dev->link.work, LINK_TUNE_INTERVAL); 79 &rt2x00dev->link.work, LINK_TUNE_INTERVAL);
80} 80}
81 81
@@ -137,14 +137,6 @@ void rt2x00lib_disable_radio(struct rt2x00_dev *rt2x00dev)
137 return; 137 return;
138 138
139 /* 139 /*
140 * Stop all scheduled work.
141 */
142 if (work_pending(&rt2x00dev->intf_work))
143 cancel_work_sync(&rt2x00dev->intf_work);
144 if (work_pending(&rt2x00dev->filter_work))
145 cancel_work_sync(&rt2x00dev->filter_work);
146
147 /*
148 * Stop the TX queues. 140 * Stop the TX queues.
149 */ 141 */
150 ieee80211_stop_queues(rt2x00dev->hw); 142 ieee80211_stop_queues(rt2x00dev->hw);
@@ -398,8 +390,8 @@ static void rt2x00lib_link_tuner(struct work_struct *work)
398 * Increase tuner counter, and reschedule the next link tuner run. 390 * Increase tuner counter, and reschedule the next link tuner run.
399 */ 391 */
400 rt2x00dev->link.count++; 392 rt2x00dev->link.count++;
401 queue_delayed_work(rt2x00dev->hw->workqueue, &rt2x00dev->link.work, 393 queue_delayed_work(rt2x00dev->workqueue,
402 LINK_TUNE_INTERVAL); 394 &rt2x00dev->link.work, LINK_TUNE_INTERVAL);
403} 395}
404 396
405static void rt2x00lib_packetfilter_scheduled(struct work_struct *work) 397static void rt2x00lib_packetfilter_scheduled(struct work_struct *work)
@@ -433,6 +425,15 @@ static void rt2x00lib_intf_scheduled_iter(void *data, u8 *mac,
433 425
434 spin_unlock(&intf->lock); 426 spin_unlock(&intf->lock);
435 427
428 /*
429 * It is possible the radio was disabled while the work had been
430 * scheduled. If that happens we should return here immediately,
431 * note that in the spinlock protected area above the delayed_flags
432 * have been cleared correctly.
433 */
434 if (!test_bit(DEVICE_ENABLED_RADIO, &rt2x00dev->flags))
435 return;
436
436 if (delayed_flags & DELAYED_UPDATE_BEACON) { 437 if (delayed_flags & DELAYED_UPDATE_BEACON) {
437 skb = ieee80211_beacon_get(rt2x00dev->hw, vif, &control); 438 skb = ieee80211_beacon_get(rt2x00dev->hw, vif, &control);
438 if (skb && rt2x00dev->ops->hw->beacon_update(rt2x00dev->hw, 439 if (skb && rt2x00dev->ops->hw->beacon_update(rt2x00dev->hw,
@@ -441,7 +442,7 @@ static void rt2x00lib_intf_scheduled_iter(void *data, u8 *mac,
441 } 442 }
442 443
443 if (delayed_flags & DELAYED_CONFIG_ERP) 444 if (delayed_flags & DELAYED_CONFIG_ERP)
444 rt2x00lib_config_erp(rt2x00dev, intf, &intf->conf); 445 rt2x00lib_config_erp(rt2x00dev, intf, &conf);
445 446
446 if (delayed_flags & DELAYED_LED_ASSOC) 447 if (delayed_flags & DELAYED_LED_ASSOC)
447 rt2x00leds_led_assoc(rt2x00dev, !!rt2x00dev->intf_associated); 448 rt2x00leds_led_assoc(rt2x00dev, !!rt2x00dev->intf_associated);
@@ -487,7 +488,7 @@ void rt2x00lib_beacondone(struct rt2x00_dev *rt2x00dev)
487 rt2x00lib_beacondone_iter, 488 rt2x00lib_beacondone_iter,
488 rt2x00dev); 489 rt2x00dev);
489 490
490 queue_work(rt2x00dev->hw->workqueue, &rt2x00dev->intf_work); 491 queue_work(rt2x00dev->workqueue, &rt2x00dev->intf_work);
491} 492}
492EXPORT_SYMBOL_GPL(rt2x00lib_beacondone); 493EXPORT_SYMBOL_GPL(rt2x00lib_beacondone);
493 494
@@ -1130,6 +1131,10 @@ int rt2x00lib_probe_dev(struct rt2x00_dev *rt2x00dev)
1130 /* 1131 /*
1131 * Initialize configuration work. 1132 * Initialize configuration work.
1132 */ 1133 */
1134 rt2x00dev->workqueue = create_singlethread_workqueue("rt2x00lib");
1135 if (!rt2x00dev->workqueue)
1136 goto exit;
1137
1133 INIT_WORK(&rt2x00dev->intf_work, rt2x00lib_intf_scheduled); 1138 INIT_WORK(&rt2x00dev->intf_work, rt2x00lib_intf_scheduled);
1134 INIT_WORK(&rt2x00dev->filter_work, rt2x00lib_packetfilter_scheduled); 1139 INIT_WORK(&rt2x00dev->filter_work, rt2x00lib_packetfilter_scheduled);
1135 INIT_DELAYED_WORK(&rt2x00dev->link.work, rt2x00lib_link_tuner); 1140 INIT_DELAYED_WORK(&rt2x00dev->link.work, rt2x00lib_link_tuner);
@@ -1190,6 +1195,13 @@ void rt2x00lib_remove_dev(struct rt2x00_dev *rt2x00dev)
1190 rt2x00leds_unregister(rt2x00dev); 1195 rt2x00leds_unregister(rt2x00dev);
1191 1196
1192 /* 1197 /*
1198 * Stop all queued work. Note that most tasks will already be halted
1199 * during rt2x00lib_disable_radio() and rt2x00lib_uninitialize().
1200 */
1201 flush_workqueue(rt2x00dev->workqueue);
1202 destroy_workqueue(rt2x00dev->workqueue);
1203
1204 /*
1193 * Free ieee80211_hw memory. 1205 * Free ieee80211_hw memory.
1194 */ 1206 */
1195 rt2x00lib_remove_hw(rt2x00dev); 1207 rt2x00lib_remove_hw(rt2x00dev);
diff --git a/drivers/net/wireless/rt2x00/rt2x00mac.c b/drivers/net/wireless/rt2x00/rt2x00mac.c
index 87e280a21971..9cb023edd2e9 100644
--- a/drivers/net/wireless/rt2x00/rt2x00mac.c
+++ b/drivers/net/wireless/rt2x00/rt2x00mac.c
@@ -428,7 +428,7 @@ void rt2x00mac_configure_filter(struct ieee80211_hw *hw,
428 if (!test_bit(DRIVER_REQUIRE_SCHEDULED, &rt2x00dev->flags)) 428 if (!test_bit(DRIVER_REQUIRE_SCHEDULED, &rt2x00dev->flags))
429 rt2x00dev->ops->lib->config_filter(rt2x00dev, *total_flags); 429 rt2x00dev->ops->lib->config_filter(rt2x00dev, *total_flags);
430 else 430 else
431 queue_work(rt2x00dev->hw->workqueue, &rt2x00dev->filter_work); 431 queue_work(rt2x00dev->workqueue, &rt2x00dev->filter_work);
432} 432}
433EXPORT_SYMBOL_GPL(rt2x00mac_configure_filter); 433EXPORT_SYMBOL_GPL(rt2x00mac_configure_filter);
434 434
@@ -509,7 +509,7 @@ void rt2x00mac_bss_info_changed(struct ieee80211_hw *hw,
509 memcpy(&intf->conf, bss_conf, sizeof(*bss_conf)); 509 memcpy(&intf->conf, bss_conf, sizeof(*bss_conf));
510 if (delayed) { 510 if (delayed) {
511 intf->delayed_flags |= delayed; 511 intf->delayed_flags |= delayed;
512 queue_work(rt2x00dev->hw->workqueue, &rt2x00dev->intf_work); 512 queue_work(rt2x00dev->workqueue, &rt2x00dev->intf_work);
513 } 513 }
514 spin_unlock(&intf->lock); 514 spin_unlock(&intf->lock);
515} 515}
diff --git a/drivers/net/wireless/rt2x00/rt73usb.c b/drivers/net/wireless/rt2x00/rt73usb.c
index fff8386e816b..83cc0147f698 100644
--- a/drivers/net/wireless/rt2x00/rt73usb.c
+++ b/drivers/net/wireless/rt2x00/rt73usb.c
@@ -134,11 +134,8 @@ static void rt73usb_bbp_write(struct rt2x00_dev *rt2x00dev,
134 * Wait until the BBP becomes ready. 134 * Wait until the BBP becomes ready.
135 */ 135 */
136 reg = rt73usb_bbp_check(rt2x00dev); 136 reg = rt73usb_bbp_check(rt2x00dev);
137 if (rt2x00_get_field32(reg, PHY_CSR3_BUSY)) { 137 if (rt2x00_get_field32(reg, PHY_CSR3_BUSY))
138 ERROR(rt2x00dev, "PHY_CSR3 register busy. Write failed.\n"); 138 goto exit_fail;
139 mutex_unlock(&rt2x00dev->usb_cache_mutex);
140 return;
141 }
142 139
143 /* 140 /*
144 * Write the data into the BBP. 141 * Write the data into the BBP.
@@ -151,6 +148,13 @@ static void rt73usb_bbp_write(struct rt2x00_dev *rt2x00dev,
151 148
152 rt73usb_register_write_lock(rt2x00dev, PHY_CSR3, reg); 149 rt73usb_register_write_lock(rt2x00dev, PHY_CSR3, reg);
153 mutex_unlock(&rt2x00dev->usb_cache_mutex); 150 mutex_unlock(&rt2x00dev->usb_cache_mutex);
151
152 return;
153
154exit_fail:
155 mutex_unlock(&rt2x00dev->usb_cache_mutex);
156
157 ERROR(rt2x00dev, "PHY_CSR3 register busy. Write failed.\n");
154} 158}
155 159
156static void rt73usb_bbp_read(struct rt2x00_dev *rt2x00dev, 160static void rt73usb_bbp_read(struct rt2x00_dev *rt2x00dev,
@@ -164,11 +168,8 @@ static void rt73usb_bbp_read(struct rt2x00_dev *rt2x00dev,
164 * Wait until the BBP becomes ready. 168 * Wait until the BBP becomes ready.
165 */ 169 */
166 reg = rt73usb_bbp_check(rt2x00dev); 170 reg = rt73usb_bbp_check(rt2x00dev);
167 if (rt2x00_get_field32(reg, PHY_CSR3_BUSY)) { 171 if (rt2x00_get_field32(reg, PHY_CSR3_BUSY))
168 ERROR(rt2x00dev, "PHY_CSR3 register busy. Read failed.\n"); 172 goto exit_fail;
169 mutex_unlock(&rt2x00dev->usb_cache_mutex);
170 return;
171 }
172 173
173 /* 174 /*
174 * Write the request into the BBP. 175 * Write the request into the BBP.
@@ -184,14 +185,19 @@ static void rt73usb_bbp_read(struct rt2x00_dev *rt2x00dev,
184 * Wait until the BBP becomes ready. 185 * Wait until the BBP becomes ready.
185 */ 186 */
186 reg = rt73usb_bbp_check(rt2x00dev); 187 reg = rt73usb_bbp_check(rt2x00dev);
187 if (rt2x00_get_field32(reg, PHY_CSR3_BUSY)) { 188 if (rt2x00_get_field32(reg, PHY_CSR3_BUSY))
188 ERROR(rt2x00dev, "PHY_CSR3 register busy. Read failed.\n"); 189 goto exit_fail;
189 *value = 0xff;
190 return;
191 }
192 190
193 *value = rt2x00_get_field32(reg, PHY_CSR3_VALUE); 191 *value = rt2x00_get_field32(reg, PHY_CSR3_VALUE);
194 mutex_unlock(&rt2x00dev->usb_cache_mutex); 192 mutex_unlock(&rt2x00dev->usb_cache_mutex);
193
194 return;
195
196exit_fail:
197 mutex_unlock(&rt2x00dev->usb_cache_mutex);
198
199 ERROR(rt2x00dev, "PHY_CSR3 register busy. Read failed.\n");
200 *value = 0xff;
195} 201}
196 202
197static void rt73usb_rf_write(struct rt2x00_dev *rt2x00dev, 203static void rt73usb_rf_write(struct rt2x00_dev *rt2x00dev,
diff --git a/drivers/pci/access.c b/drivers/pci/access.c
index ec8f7002b09d..39bb96b413ef 100644
--- a/drivers/pci/access.c
+++ b/drivers/pci/access.c
@@ -178,8 +178,7 @@ static int pci_vpd_pci22_read(struct pci_dev *dev, int pos, int size,
178 int ret; 178 int ret;
179 int begin, end, i; 179 int begin, end, i;
180 180
181 if (pos < 0 || pos > PCI_VPD_PCI22_SIZE || 181 if (pos < 0 || pos > vpd->base.len || size > vpd->base.len - pos)
182 size > PCI_VPD_PCI22_SIZE - pos)
183 return -EINVAL; 182 return -EINVAL;
184 if (size == 0) 183 if (size == 0)
185 return 0; 184 return 0;
@@ -223,8 +222,8 @@ static int pci_vpd_pci22_write(struct pci_dev *dev, int pos, int size,
223 u32 val; 222 u32 val;
224 int ret; 223 int ret;
225 224
226 if (pos < 0 || pos > PCI_VPD_PCI22_SIZE || pos & 3 || 225 if (pos < 0 || pos > vpd->base.len || pos & 3 ||
227 size > PCI_VPD_PCI22_SIZE - pos || size < 4) 226 size > vpd->base.len - pos || size < 4)
228 return -EINVAL; 227 return -EINVAL;
229 228
230 val = (u8) *buf++; 229 val = (u8) *buf++;
@@ -255,11 +254,6 @@ out:
255 return 4; 254 return 4;
256} 255}
257 256
258static int pci_vpd_pci22_get_size(struct pci_dev *dev)
259{
260 return PCI_VPD_PCI22_SIZE;
261}
262
263static void pci_vpd_pci22_release(struct pci_dev *dev) 257static void pci_vpd_pci22_release(struct pci_dev *dev)
264{ 258{
265 kfree(container_of(dev->vpd, struct pci_vpd_pci22, base)); 259 kfree(container_of(dev->vpd, struct pci_vpd_pci22, base));
@@ -268,7 +262,6 @@ static void pci_vpd_pci22_release(struct pci_dev *dev)
268static struct pci_vpd_ops pci_vpd_pci22_ops = { 262static struct pci_vpd_ops pci_vpd_pci22_ops = {
269 .read = pci_vpd_pci22_read, 263 .read = pci_vpd_pci22_read,
270 .write = pci_vpd_pci22_write, 264 .write = pci_vpd_pci22_write,
271 .get_size = pci_vpd_pci22_get_size,
272 .release = pci_vpd_pci22_release, 265 .release = pci_vpd_pci22_release,
273}; 266};
274 267
@@ -284,6 +277,7 @@ int pci_vpd_pci22_init(struct pci_dev *dev)
284 if (!vpd) 277 if (!vpd)
285 return -ENOMEM; 278 return -ENOMEM;
286 279
280 vpd->base.len = PCI_VPD_PCI22_SIZE;
287 vpd->base.ops = &pci_vpd_pci22_ops; 281 vpd->base.ops = &pci_vpd_pci22_ops;
288 spin_lock_init(&vpd->lock); 282 spin_lock_init(&vpd->lock);
289 vpd->cap = cap; 283 vpd->cap = cap;
diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c
index 648596d469f6..91156f85a926 100644
--- a/drivers/pci/hotplug/acpiphp_glue.c
+++ b/drivers/pci/hotplug/acpiphp_glue.c
@@ -700,9 +700,10 @@ cleanup_p2p_bridge(acpi_handle handle, u32 lvl, void *context, void **rv)
700 acpi_walk_namespace(ACPI_TYPE_DEVICE, handle, (u32)1, 700 acpi_walk_namespace(ACPI_TYPE_DEVICE, handle, (u32)1,
701 cleanup_p2p_bridge, NULL, NULL); 701 cleanup_p2p_bridge, NULL, NULL);
702 702
703 if (!(bridge = acpiphp_handle_to_bridge(handle))) 703 bridge = acpiphp_handle_to_bridge(handle);
704 return AE_OK; 704 if (bridge)
705 cleanup_bridge(bridge); 705 cleanup_bridge(bridge);
706
706 return AE_OK; 707 return AE_OK;
707} 708}
708 709
@@ -715,9 +716,19 @@ static void remove_bridge(acpi_handle handle)
715 acpi_walk_namespace(ACPI_TYPE_DEVICE, handle, 716 acpi_walk_namespace(ACPI_TYPE_DEVICE, handle,
716 (u32)1, cleanup_p2p_bridge, NULL, NULL); 717 (u32)1, cleanup_p2p_bridge, NULL, NULL);
717 718
719 /*
720 * On root bridges with hotplug slots directly underneath (ie,
721 * no p2p bridge inbetween), we call cleanup_bridge().
722 *
723 * The else clause cleans up root bridges that either had no
724 * hotplug slots at all, or had a p2p bridge underneath.
725 */
718 bridge = acpiphp_handle_to_bridge(handle); 726 bridge = acpiphp_handle_to_bridge(handle);
719 if (bridge) 727 if (bridge)
720 cleanup_bridge(bridge); 728 cleanup_bridge(bridge);
729 else
730 acpi_remove_notify_handler(handle, ACPI_SYSTEM_NOTIFY,
731 handle_hotplug_event_bridge);
721} 732}
722 733
723static struct pci_dev * get_apic_pci_info(acpi_handle handle) 734static struct pci_dev * get_apic_pci_info(acpi_handle handle)
diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c
index 6f3c7446c329..9c718583a237 100644
--- a/drivers/pci/pci-sysfs.c
+++ b/drivers/pci/pci-sysfs.c
@@ -736,9 +736,9 @@ int __must_check pci_create_sysfs_dev_files (struct pci_dev *pdev)
736 attr = kzalloc(sizeof(*attr), GFP_ATOMIC); 736 attr = kzalloc(sizeof(*attr), GFP_ATOMIC);
737 if (attr) { 737 if (attr) {
738 pdev->vpd->attr = attr; 738 pdev->vpd->attr = attr;
739 attr->size = pdev->vpd->ops->get_size(pdev); 739 attr->size = pdev->vpd->len;
740 attr->attr.name = "vpd"; 740 attr->attr.name = "vpd";
741 attr->attr.mode = S_IRUGO | S_IWUSR; 741 attr->attr.mode = S_IRUSR | S_IWUSR;
742 attr->read = pci_read_vpd; 742 attr->read = pci_read_vpd;
743 attr->write = pci_write_vpd; 743 attr->write = pci_write_vpd;
744 retval = sysfs_create_bin_file(&pdev->dev.kobj, attr); 744 retval = sysfs_create_bin_file(&pdev->dev.kobj, attr);
diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h
index 0a497c1b4227..00408c97e5fc 100644
--- a/drivers/pci/pci.h
+++ b/drivers/pci/pci.h
@@ -21,11 +21,11 @@ extern int pci_user_write_config_dword(struct pci_dev *dev, int where, u32 val);
21struct pci_vpd_ops { 21struct pci_vpd_ops {
22 int (*read)(struct pci_dev *dev, int pos, int size, char *buf); 22 int (*read)(struct pci_dev *dev, int pos, int size, char *buf);
23 int (*write)(struct pci_dev *dev, int pos, int size, const char *buf); 23 int (*write)(struct pci_dev *dev, int pos, int size, const char *buf);
24 int (*get_size)(struct pci_dev *dev);
25 void (*release)(struct pci_dev *dev); 24 void (*release)(struct pci_dev *dev);
26}; 25};
27 26
28struct pci_vpd { 27struct pci_vpd {
28 unsigned int len;
29 struct pci_vpd_ops *ops; 29 struct pci_vpd_ops *ops;
30 struct bin_attribute *attr; /* descriptor for sysfs VPD entry */ 30 struct bin_attribute *attr; /* descriptor for sysfs VPD entry */
31}; 31};
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index dabb563f51d9..a3497dc6ebcf 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -1670,6 +1670,48 @@ static void __devinit quirk_via_cx700_pci_parking_caching(struct pci_dev *dev)
1670} 1670}
1671DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_VIA, 0x324e, quirk_via_cx700_pci_parking_caching); 1671DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_VIA, 0x324e, quirk_via_cx700_pci_parking_caching);
1672 1672
1673/*
1674 * For Broadcom 5706, 5708, 5709 rev. A nics, any read beyond the
1675 * VPD end tag will hang the device. This problem was initially
1676 * observed when a vpd entry was created in sysfs
1677 * ('/sys/bus/pci/devices/<id>/vpd'). A read to this sysfs entry
1678 * will dump 32k of data. Reading a full 32k will cause an access
1679 * beyond the VPD end tag causing the device to hang. Once the device
1680 * is hung, the bnx2 driver will not be able to reset the device.
1681 * We believe that it is legal to read beyond the end tag and
1682 * therefore the solution is to limit the read/write length.
1683 */
1684static void __devinit quirk_brcm_570x_limit_vpd(struct pci_dev *dev)
1685{
1686 /* Only disable the VPD capability for 5706, 5708, and 5709 rev. A */
1687 if ((dev->device == PCI_DEVICE_ID_NX2_5706) ||
1688 (dev->device == PCI_DEVICE_ID_NX2_5708) ||
1689 ((dev->device == PCI_DEVICE_ID_NX2_5709) &&
1690 (dev->revision & 0xf0) == 0x0)) {
1691 if (dev->vpd)
1692 dev->vpd->len = 0x80;
1693 }
1694}
1695
1696DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_BROADCOM,
1697 PCI_DEVICE_ID_NX2_5706,
1698 quirk_brcm_570x_limit_vpd);
1699DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_BROADCOM,
1700 PCI_DEVICE_ID_NX2_5706S,
1701 quirk_brcm_570x_limit_vpd);
1702DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_BROADCOM,
1703 PCI_DEVICE_ID_NX2_5708,
1704 quirk_brcm_570x_limit_vpd);
1705DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_BROADCOM,
1706 PCI_DEVICE_ID_NX2_5708S,
1707 quirk_brcm_570x_limit_vpd);
1708DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_BROADCOM,
1709 PCI_DEVICE_ID_NX2_5709,
1710 quirk_brcm_570x_limit_vpd);
1711DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_BROADCOM,
1712 PCI_DEVICE_ID_NX2_5709S,
1713 quirk_brcm_570x_limit_vpd);
1714
1673#ifdef CONFIG_PCI_MSI 1715#ifdef CONFIG_PCI_MSI
1674/* Some chipsets do not support MSI. We cannot easily rely on setting 1716/* Some chipsets do not support MSI. We cannot easily rely on setting
1675 * PCI_BUS_FLAGS_NO_MSI in its bus flags because there are actually 1717 * PCI_BUS_FLAGS_NO_MSI in its bus flags because there are actually
diff --git a/drivers/pcmcia/omap_cf.c b/drivers/pcmcia/omap_cf.c
index 46314b420765..569b746b5731 100644
--- a/drivers/pcmcia/omap_cf.c
+++ b/drivers/pcmcia/omap_cf.c
@@ -38,19 +38,19 @@
38#define CF_BASE 0xfffe2800 38#define CF_BASE 0xfffe2800
39 39
40/* status; read after IRQ */ 40/* status; read after IRQ */
41#define CF_STATUS_REG __REG16(CF_BASE + 0x00) 41#define CF_STATUS (CF_BASE + 0x00)
42# define CF_STATUS_BAD_READ (1 << 2) 42# define CF_STATUS_BAD_READ (1 << 2)
43# define CF_STATUS_BAD_WRITE (1 << 1) 43# define CF_STATUS_BAD_WRITE (1 << 1)
44# define CF_STATUS_CARD_DETECT (1 << 0) 44# define CF_STATUS_CARD_DETECT (1 << 0)
45 45
46/* which chipselect (CS0..CS3) is used for CF (active low) */ 46/* which chipselect (CS0..CS3) is used for CF (active low) */
47#define CF_CFG_REG __REG16(CF_BASE + 0x02) 47#define CF_CFG (CF_BASE + 0x02)
48 48
49/* card reset */ 49/* card reset */
50#define CF_CONTROL_REG __REG16(CF_BASE + 0x04) 50#define CF_CONTROL (CF_BASE + 0x04)
51# define CF_CONTROL_RESET (1 << 0) 51# define CF_CONTROL_RESET (1 << 0)
52 52
53#define omap_cf_present() (!(CF_STATUS_REG & CF_STATUS_CARD_DETECT)) 53#define omap_cf_present() (!(omap_readw(CF_STATUS) & CF_STATUS_CARD_DETECT))
54 54
55/*--------------------------------------------------------------------------*/ 55/*--------------------------------------------------------------------------*/
56 56
@@ -139,11 +139,11 @@ omap_cf_set_socket(struct pcmcia_socket *sock, struct socket_state_t *s)
139 return -EINVAL; 139 return -EINVAL;
140 } 140 }
141 141
142 control = CF_CONTROL_REG; 142 control = omap_readw(CF_CONTROL);
143 if (s->flags & SS_RESET) 143 if (s->flags & SS_RESET)
144 CF_CONTROL_REG = CF_CONTROL_RESET; 144 omap_writew(CF_CONTROL_RESET, CF_CONTROL);
145 else 145 else
146 CF_CONTROL_REG = 0; 146 omap_writew(0, CF_CONTROL);
147 147
148 pr_debug("%s: Vcc %d, io_irq %d, flags %04x csc %04x\n", 148 pr_debug("%s: Vcc %d, io_irq %d, flags %04x csc %04x\n",
149 driver_name, s->Vcc, s->io_irq, s->flags, s->csc_mask); 149 driver_name, s->Vcc, s->io_irq, s->flags, s->csc_mask);
@@ -270,7 +270,7 @@ static int __init omap_cf_probe(struct platform_device *pdev)
270 omap_cfg_reg(V10_1610_CF_IREQ); 270 omap_cfg_reg(V10_1610_CF_IREQ);
271 omap_cfg_reg(W10_1610_CF_RESET); 271 omap_cfg_reg(W10_1610_CF_RESET);
272 272
273 CF_CFG_REG = ~(1 << seg); 273 omap_writew(~(1 << seg), CF_CFG);
274 274
275 pr_info("%s: cs%d on irq %d\n", driver_name, seg, irq); 275 pr_info("%s: cs%d on irq %d\n", driver_name, seg, irq);
276 276
@@ -279,14 +279,15 @@ static int __init omap_cf_probe(struct platform_device *pdev)
279 * CF/PCMCIA variants... 279 * CF/PCMCIA variants...
280 */ 280 */
281 pr_debug("%s: cs%d, previous ccs %08x acs %08x\n", driver_name, 281 pr_debug("%s: cs%d, previous ccs %08x acs %08x\n", driver_name,
282 seg, EMIFS_CCS(seg), EMIFS_ACS(seg)); 282 seg, omap_readl(EMIFS_CCS(seg)), omap_readl(EMIFS_ACS(seg)));
283 EMIFS_CCS(seg) = 0x0004a1b3; /* synch mode 4 etc */ 283 omap_writel(0x0004a1b3, EMIFS_CCS(seg)); /* synch mode 4 etc */
284 EMIFS_ACS(seg) = 0x00000000; /* OE hold/setup */ 284 omap_writel(0x00000000, EMIFS_ACS(seg)); /* OE hold/setup */
285 285
286 /* CF uses armxor_ck, which is "always" available */ 286 /* CF uses armxor_ck, which is "always" available */
287 287
288 pr_debug("%s: sts %04x cfg %04x control %04x %s\n", driver_name, 288 pr_debug("%s: sts %04x cfg %04x control %04x %s\n", driver_name,
289 CF_STATUS_REG, CF_CFG_REG, CF_CONTROL_REG, 289 omap_readw(CF_STATUS), omap_readw(CF_CFG),
290 omap_readw(CF_CONTROL),
290 omap_cf_present() ? "present" : "(not present)"); 291 omap_cf_present() ? "present" : "(not present)");
291 292
292 cf->socket.owner = THIS_MODULE; 293 cf->socket.owner = THIS_MODULE;
diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig
index 4949dc4859be..fc85bf2e4a97 100644
--- a/drivers/rtc/Kconfig
+++ b/drivers/rtc/Kconfig
@@ -469,6 +469,16 @@ config RTC_DRV_VR41XX
469 To compile this driver as a module, choose M here: the 469 To compile this driver as a module, choose M here: the
470 module will be called rtc-vr41xx. 470 module will be called rtc-vr41xx.
471 471
472config RTC_DRV_PL030
473 tristate "ARM AMBA PL030 RTC"
474 depends on ARM_AMBA
475 help
476 If you say Y here you will get access to ARM AMBA
477 PrimeCell PL030 RTC found on certain ARM SOCs.
478
479 To compile this driver as a module, choose M here: the
480 module will be called rtc-pl030.
481
472config RTC_DRV_PL031 482config RTC_DRV_PL031
473 tristate "ARM AMBA PL031 RTC" 483 tristate "ARM AMBA PL031 RTC"
474 depends on ARM_AMBA 484 depends on ARM_AMBA
@@ -495,12 +505,13 @@ config RTC_DRV_AT91RM9200
495 this is powered by the backup power supply. 505 this is powered by the backup power supply.
496 506
497config RTC_DRV_AT91SAM9 507config RTC_DRV_AT91SAM9
498 tristate "AT91SAM9x" 508 tristate "AT91SAM9x/AT91CAP9"
499 depends on ARCH_AT91 && !(ARCH_AT91RM9200 || ARCH_AT91X40) 509 depends on ARCH_AT91 && !(ARCH_AT91RM9200 || ARCH_AT91X40)
500 help 510 help
501 RTC driver for the Atmel AT91SAM9x internal RTT (Real Time Timer). 511 RTC driver for the Atmel AT91SAM9x and AT91CAP9 internal RTT
502 These timers are powered by the backup power supply (such as a 512 (Real Time Timer). These timers are powered by the backup power
503 small coin cell battery), but do not need to be used as RTCs. 513 supply (such as a small coin cell battery), but do not need to
514 be used as RTCs.
504 515
505 (On AT91SAM9rl chips you probably want to use the dedicated RTC 516 (On AT91SAM9rl chips you probably want to use the dedicated RTC
506 module and leave the RTT available for other uses.) 517 module and leave the RTT available for other uses.)
diff --git a/drivers/rtc/Makefile b/drivers/rtc/Makefile
index b6e14d51670b..b5d9d67df887 100644
--- a/drivers/rtc/Makefile
+++ b/drivers/rtc/Makefile
@@ -41,6 +41,7 @@ obj-$(CONFIG_RTC_DRV_MAX6902) += rtc-max6902.o
41obj-$(CONFIG_RTC_DRV_OMAP) += rtc-omap.o 41obj-$(CONFIG_RTC_DRV_OMAP) += rtc-omap.o
42obj-$(CONFIG_RTC_DRV_PCF8563) += rtc-pcf8563.o 42obj-$(CONFIG_RTC_DRV_PCF8563) += rtc-pcf8563.o
43obj-$(CONFIG_RTC_DRV_PCF8583) += rtc-pcf8583.o 43obj-$(CONFIG_RTC_DRV_PCF8583) += rtc-pcf8583.o
44obj-$(CONFIG_RTC_DRV_PL030) += rtc-pl030.o
44obj-$(CONFIG_RTC_DRV_PL031) += rtc-pl031.o 45obj-$(CONFIG_RTC_DRV_PL031) += rtc-pl031.o
45obj-$(CONFIG_RTC_DRV_PPC) += rtc-ppc.o 46obj-$(CONFIG_RTC_DRV_PPC) += rtc-ppc.o
46obj-$(CONFIG_RTC_DRV_R9701) += rtc-r9701.o 47obj-$(CONFIG_RTC_DRV_R9701) += rtc-r9701.o
diff --git a/drivers/rtc/rtc-at91rm9200.c b/drivers/rtc/rtc-at91rm9200.c
index 39e64ab1ecb7..9c3db934cc24 100644
--- a/drivers/rtc/rtc-at91rm9200.c
+++ b/drivers/rtc/rtc-at91rm9200.c
@@ -29,10 +29,6 @@
29#include <linux/completion.h> 29#include <linux/completion.h>
30 30
31#include <asm/uaccess.h> 31#include <asm/uaccess.h>
32#include <asm/rtc.h>
33
34#include <asm/mach/time.h>
35
36#include <asm/arch/at91_rtc.h> 32#include <asm/arch/at91_rtc.h>
37 33
38 34
diff --git a/drivers/rtc/rtc-at91sam9.c b/drivers/rtc/rtc-at91sam9.c
index 38d8742a4bdf..f0246ef413a4 100644
--- a/drivers/rtc/rtc-at91sam9.c
+++ b/drivers/rtc/rtc-at91sam9.c
@@ -19,7 +19,6 @@
19#include <linux/interrupt.h> 19#include <linux/interrupt.h>
20#include <linux/ioctl.h> 20#include <linux/ioctl.h>
21 21
22#include <asm/mach/time.h>
23#include <asm/arch/board.h> 22#include <asm/arch/board.h>
24#include <asm/arch/at91_rtt.h> 23#include <asm/arch/at91_rtt.h>
25 24
diff --git a/drivers/rtc/rtc-omap.c b/drivers/rtc/rtc-omap.c
index 58f81c774943..eb23d8423f42 100644
--- a/drivers/rtc/rtc-omap.c
+++ b/drivers/rtc/rtc-omap.c
@@ -22,7 +22,6 @@
22#include <linux/platform_device.h> 22#include <linux/platform_device.h>
23 23
24#include <asm/io.h> 24#include <asm/io.h>
25#include <asm/mach/time.h>
26 25
27 26
28/* The OMAP1 RTC is a year/month/day/hours/minutes/seconds BCD clock 27/* The OMAP1 RTC is a year/month/day/hours/minutes/seconds BCD clock
diff --git a/drivers/rtc/rtc-pl030.c b/drivers/rtc/rtc-pl030.c
new file mode 100644
index 000000000000..8448eeb9d675
--- /dev/null
+++ b/drivers/rtc/rtc-pl030.c
@@ -0,0 +1,217 @@
1/*
2 * linux/drivers/rtc/rtc-pl030.c
3 *
4 * Copyright (C) 2000-2001 Deep Blue Solutions Ltd.
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/module.h>
11#include <linux/rtc.h>
12#include <linux/init.h>
13#include <linux/interrupt.h>
14#include <linux/amba/bus.h>
15#include <linux/io.h>
16
17#define RTC_DR (0)
18#define RTC_MR (4)
19#define RTC_STAT (8)
20#define RTC_EOI (8)
21#define RTC_LR (12)
22#define RTC_CR (16)
23#define RTC_CR_MIE (1 << 0)
24
25struct pl030_rtc {
26 struct rtc_device *rtc;
27 void __iomem *base;
28};
29
30static irqreturn_t pl030_interrupt(int irq, void *dev_id)
31{
32 struct pl030_rtc *rtc = dev_id;
33 writel(0, rtc->base + RTC_EOI);
34 return IRQ_HANDLED;
35}
36
37static int pl030_open(struct device *dev)
38{
39 return 0;
40}
41
42static void pl030_release(struct device *dev)
43{
44}
45
46static int pl030_ioctl(struct device *dev, unsigned int cmd, unsigned long arg)
47{
48 return -ENOIOCTLCMD;
49}
50
51static int pl030_read_alarm(struct device *dev, struct rtc_wkalrm *alrm)
52{
53 struct pl030_rtc *rtc = dev_get_drvdata(dev);
54
55 rtc_time_to_tm(readl(rtc->base + RTC_MR), &alrm->time);
56 return 0;
57}
58
59static int pl030_set_alarm(struct device *dev, struct rtc_wkalrm *alrm)
60{
61 struct pl030_rtc *rtc = dev_get_drvdata(dev);
62 unsigned long time;
63 int ret;
64
65 /*
66 * At the moment, we can only deal with non-wildcarded alarm times.
67 */
68 ret = rtc_valid_tm(&alrm->time);
69 if (ret == 0)
70 ret = rtc_tm_to_time(&alrm->time, &time);
71 if (ret == 0)
72 writel(time, rtc->base + RTC_MR);
73 return ret;
74}
75
76static int pl030_read_time(struct device *dev, struct rtc_time *tm)
77{
78 struct pl030_rtc *rtc = dev_get_drvdata(dev);
79
80 rtc_time_to_tm(readl(rtc->base + RTC_DR), tm);
81
82 return 0;
83}
84
85/*
86 * Set the RTC time. Unfortunately, we can't accurately set
87 * the point at which the counter updates.
88 *
89 * Also, since RTC_LR is transferred to RTC_CR on next rising
90 * edge of the 1Hz clock, we must write the time one second
91 * in advance.
92 */
93static int pl030_set_time(struct device *dev, struct rtc_time *tm)
94{
95 struct pl030_rtc *rtc = dev_get_drvdata(dev);
96 unsigned long time;
97 int ret;
98
99 ret = rtc_tm_to_time(tm, &time);
100 if (ret == 0)
101 writel(time + 1, rtc->base + RTC_LR);
102
103 return ret;
104}
105
106static const struct rtc_class_ops pl030_ops = {
107 .open = pl030_open,
108 .release = pl030_release,
109 .ioctl = pl030_ioctl,
110 .read_time = pl030_read_time,
111 .set_time = pl030_set_time,
112 .read_alarm = pl030_read_alarm,
113 .set_alarm = pl030_set_alarm,
114};
115
116static int pl030_probe(struct amba_device *dev, void *id)
117{
118 struct pl030_rtc *rtc;
119 int ret;
120
121 ret = amba_request_regions(dev, NULL);
122 if (ret)
123 goto err_req;
124
125 rtc = kmalloc(sizeof(*rtc), GFP_KERNEL);
126 if (!rtc) {
127 ret = -ENOMEM;
128 goto err_rtc;
129 }
130
131 rtc->base = ioremap(dev->res.start, SZ_4K);
132 if (!rtc->base) {
133 ret = -ENOMEM;
134 goto err_map;
135 }
136
137 __raw_writel(0, rtc->base + RTC_CR);
138 __raw_writel(0, rtc->base + RTC_EOI);
139
140 amba_set_drvdata(dev, rtc);
141
142 ret = request_irq(dev->irq[0], pl030_interrupt, IRQF_DISABLED,
143 "rtc-pl030", rtc);
144 if (ret)
145 goto err_irq;
146
147 rtc->rtc = rtc_device_register("pl030", &dev->dev, &pl030_ops,
148 THIS_MODULE);
149 if (IS_ERR(rtc->rtc)) {
150 ret = PTR_ERR(rtc->rtc);
151 goto err_reg;
152 }
153
154 return 0;
155
156 err_reg:
157 free_irq(dev->irq[0], rtc);
158 err_irq:
159 iounmap(rtc->base);
160 err_map:
161 kfree(rtc);
162 err_rtc:
163 amba_release_regions(dev);
164 err_req:
165 return ret;
166}
167
168static int pl030_remove(struct amba_device *dev)
169{
170 struct pl030_rtc *rtc = amba_get_drvdata(dev);
171
172 amba_set_drvdata(dev, NULL);
173
174 writel(0, rtc->base + RTC_CR);
175
176 free_irq(dev->irq[0], rtc);
177 rtc_device_unregister(rtc->rtc);
178 iounmap(rtc->base);
179 kfree(rtc);
180 amba_release_regions(dev);
181
182 return 0;
183}
184
185static struct amba_id pl030_ids[] = {
186 {
187 .id = 0x00041030,
188 .mask = 0x000fffff,
189 },
190 { 0, 0 },
191};
192
193static struct amba_driver pl030_driver = {
194 .drv = {
195 .name = "rtc-pl030",
196 },
197 .probe = pl030_probe,
198 .remove = pl030_remove,
199 .id_table = pl030_ids,
200};
201
202static int __init pl030_init(void)
203{
204 return amba_driver_register(&pl030_driver);
205}
206
207static void __exit pl030_exit(void)
208{
209 amba_driver_unregister(&pl030_driver);
210}
211
212module_init(pl030_init);
213module_exit(pl030_exit);
214
215MODULE_AUTHOR("Russell King <rmk@arm.linux.org.uk>");
216MODULE_DESCRIPTION("ARM AMBA PL030 RTC Driver");
217MODULE_LICENSE("GPL");
diff --git a/drivers/rtc/rtc-pl031.c b/drivers/rtc/rtc-pl031.c
index 2fd49edcc712..08b4610ec5a6 100644
--- a/drivers/rtc/rtc-pl031.c
+++ b/drivers/rtc/rtc-pl031.c
@@ -12,23 +12,12 @@
12 * as published by the Free Software Foundation; either version 12 * as published by the Free Software Foundation; either version
13 * 2 of the License, or (at your option) any later version. 13 * 2 of the License, or (at your option) any later version.
14 */ 14 */
15
16#include <linux/platform_device.h>
17#include <linux/module.h> 15#include <linux/module.h>
18#include <linux/rtc.h> 16#include <linux/rtc.h>
19#include <linux/init.h> 17#include <linux/init.h>
20#include <linux/fs.h>
21#include <linux/interrupt.h> 18#include <linux/interrupt.h>
22#include <linux/string.h>
23#include <linux/pm.h>
24#include <linux/bitops.h>
25
26#include <linux/amba/bus.h> 19#include <linux/amba/bus.h>
27 20#include <linux/io.h>
28#include <asm/io.h>
29#include <asm/hardware.h>
30#include <asm/irq.h>
31#include <asm/rtc.h>
32 21
33/* 22/*
34 * Register definitions 23 * Register definitions
@@ -142,13 +131,12 @@ static int pl031_remove(struct amba_device *adev)
142{ 131{
143 struct pl031_local *ldata = dev_get_drvdata(&adev->dev); 132 struct pl031_local *ldata = dev_get_drvdata(&adev->dev);
144 133
145 if (ldata) { 134 amba_set_drvdata(adev, NULL);
146 dev_set_drvdata(&adev->dev, NULL); 135 free_irq(adev->irq[0], ldata->rtc);
147 free_irq(adev->irq[0], ldata->rtc); 136 rtc_device_unregister(ldata->rtc);
148 rtc_device_unregister(ldata->rtc); 137 iounmap(ldata->base);
149 iounmap(ldata->base); 138 kfree(ldata);
150 kfree(ldata); 139 amba_release_regions(adev);
151 }
152 140
153 return 0; 141 return 0;
154} 142}
@@ -158,13 +146,15 @@ static int pl031_probe(struct amba_device *adev, void *id)
158 int ret; 146 int ret;
159 struct pl031_local *ldata; 147 struct pl031_local *ldata;
160 148
149 ret = amba_request_regions(adev, NULL);
150 if (ret)
151 goto err_req;
161 152
162 ldata = kmalloc(sizeof(struct pl031_local), GFP_KERNEL); 153 ldata = kmalloc(sizeof(struct pl031_local), GFP_KERNEL);
163 if (!ldata) { 154 if (!ldata) {
164 ret = -ENOMEM; 155 ret = -ENOMEM;
165 goto out; 156 goto out;
166 } 157 }
167 dev_set_drvdata(&adev->dev, ldata);
168 158
169 ldata->base = ioremap(adev->res.start, 159 ldata->base = ioremap(adev->res.start,
170 adev->res.end - adev->res.start + 1); 160 adev->res.end - adev->res.start + 1);
@@ -173,6 +163,8 @@ static int pl031_probe(struct amba_device *adev, void *id)
173 goto out_no_remap; 163 goto out_no_remap;
174 } 164 }
175 165
166 amba_set_drvdata(adev, ldata);
167
176 if (request_irq(adev->irq[0], pl031_interrupt, IRQF_DISABLED, 168 if (request_irq(adev->irq[0], pl031_interrupt, IRQF_DISABLED,
177 "rtc-pl031", ldata->rtc)) { 169 "rtc-pl031", ldata->rtc)) {
178 ret = -EIO; 170 ret = -EIO;
@@ -192,10 +184,12 @@ out_no_rtc:
192 free_irq(adev->irq[0], ldata->rtc); 184 free_irq(adev->irq[0], ldata->rtc);
193out_no_irq: 185out_no_irq:
194 iounmap(ldata->base); 186 iounmap(ldata->base);
187 amba_set_drvdata(adev, NULL);
195out_no_remap: 188out_no_remap:
196 dev_set_drvdata(&adev->dev, NULL);
197 kfree(ldata); 189 kfree(ldata);
198out: 190out:
191 amba_release_regions(adev);
192err_req:
199 return ret; 193 return ret;
200} 194}
201 195
diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c
index f26e0cad8f16..fed86e507fdf 100644
--- a/drivers/rtc/rtc-s3c.c
+++ b/drivers/rtc/rtc-s3c.c
@@ -26,10 +26,6 @@
26#include <asm/uaccess.h> 26#include <asm/uaccess.h>
27#include <asm/io.h> 27#include <asm/io.h>
28#include <asm/irq.h> 28#include <asm/irq.h>
29#include <asm/rtc.h>
30
31#include <asm/mach/time.h>
32
33#include <asm/plat-s3c/regs-rtc.h> 29#include <asm/plat-s3c/regs-rtc.h>
34 30
35/* I have yet to find an S3C implementation with more than one 31/* I have yet to find an S3C implementation with more than one
diff --git a/drivers/rtc/rtc-sa1100.c b/drivers/rtc/rtc-sa1100.c
index 82f62d25f921..f47294c60148 100644
--- a/drivers/rtc/rtc-sa1100.c
+++ b/drivers/rtc/rtc-sa1100.c
@@ -33,7 +33,6 @@
33 33
34#include <asm/hardware.h> 34#include <asm/hardware.h>
35#include <asm/irq.h> 35#include <asm/irq.h>
36#include <asm/rtc.h>
37 36
38#ifdef CONFIG_ARCH_PXA 37#ifdef CONFIG_ARCH_PXA
39#include <asm/arch/pxa-regs.h> 38#include <asm/arch/pxa-regs.h>
@@ -47,6 +46,42 @@ static unsigned long rtc_freq = 1024;
47static struct rtc_time rtc_alarm; 46static struct rtc_time rtc_alarm;
48static DEFINE_SPINLOCK(sa1100_rtc_lock); 47static DEFINE_SPINLOCK(sa1100_rtc_lock);
49 48
49static inline int rtc_periodic_alarm(struct rtc_time *tm)
50{
51 return (tm->tm_year == -1) ||
52 ((unsigned)tm->tm_mon >= 12) ||
53 ((unsigned)(tm->tm_mday - 1) >= 31) ||
54 ((unsigned)tm->tm_hour > 23) ||
55 ((unsigned)tm->tm_min > 59) ||
56 ((unsigned)tm->tm_sec > 59);
57}
58
59/*
60 * Calculate the next alarm time given the requested alarm time mask
61 * and the current time.
62 */
63static void rtc_next_alarm_time(struct rtc_time *next, struct rtc_time *now, struct rtc_time *alrm)
64{
65 unsigned long next_time;
66 unsigned long now_time;
67
68 next->tm_year = now->tm_year;
69 next->tm_mon = now->tm_mon;
70 next->tm_mday = now->tm_mday;
71 next->tm_hour = alrm->tm_hour;
72 next->tm_min = alrm->tm_min;
73 next->tm_sec = alrm->tm_sec;
74
75 rtc_tm_to_time(now, &now_time);
76 rtc_tm_to_time(next, &next_time);
77
78 if (next_time < now_time) {
79 /* Advance one day */
80 next_time += 60 * 60 * 24;
81 rtc_time_to_tm(next_time, next);
82 }
83}
84
50static int rtc_update_alarm(struct rtc_time *alrm) 85static int rtc_update_alarm(struct rtc_time *alrm)
51{ 86{
52 struct rtc_time alarm_tm, now_tm; 87 struct rtc_time alarm_tm, now_tm;
@@ -331,14 +366,14 @@ static int sa1100_rtc_probe(struct platform_device *pdev)
331 RCNR = 0; 366 RCNR = 0;
332 } 367 }
333 368
369 device_init_wakeup(&pdev->dev, 1);
370
334 rtc = rtc_device_register(pdev->name, &pdev->dev, &sa1100_rtc_ops, 371 rtc = rtc_device_register(pdev->name, &pdev->dev, &sa1100_rtc_ops,
335 THIS_MODULE); 372 THIS_MODULE);
336 373
337 if (IS_ERR(rtc)) 374 if (IS_ERR(rtc))
338 return PTR_ERR(rtc); 375 return PTR_ERR(rtc);
339 376
340 device_init_wakeup(&pdev->dev, 1);
341
342 platform_set_drvdata(pdev, rtc); 377 platform_set_drvdata(pdev, rtc);
343 378
344 return 0; 379 return 0;
diff --git a/drivers/scsi/esp_scsi.c b/drivers/scsi/esp_scsi.c
index a0b6d414953d..59fbef08d690 100644
--- a/drivers/scsi/esp_scsi.c
+++ b/drivers/scsi/esp_scsi.c
@@ -2359,6 +2359,24 @@ void scsi_esp_unregister(struct esp *esp)
2359} 2359}
2360EXPORT_SYMBOL(scsi_esp_unregister); 2360EXPORT_SYMBOL(scsi_esp_unregister);
2361 2361
2362static int esp_target_alloc(struct scsi_target *starget)
2363{
2364 struct esp *esp = shost_priv(dev_to_shost(&starget->dev));
2365 struct esp_target_data *tp = &esp->target[starget->id];
2366
2367 tp->starget = starget;
2368
2369 return 0;
2370}
2371
2372static void esp_target_destroy(struct scsi_target *starget)
2373{
2374 struct esp *esp = shost_priv(dev_to_shost(&starget->dev));
2375 struct esp_target_data *tp = &esp->target[starget->id];
2376
2377 tp->starget = NULL;
2378}
2379
2362static int esp_slave_alloc(struct scsi_device *dev) 2380static int esp_slave_alloc(struct scsi_device *dev)
2363{ 2381{
2364 struct esp *esp = shost_priv(dev->host); 2382 struct esp *esp = shost_priv(dev->host);
@@ -2370,8 +2388,6 @@ static int esp_slave_alloc(struct scsi_device *dev)
2370 return -ENOMEM; 2388 return -ENOMEM;
2371 dev->hostdata = lp; 2389 dev->hostdata = lp;
2372 2390
2373 tp->starget = dev->sdev_target;
2374
2375 spi_min_period(tp->starget) = esp->min_period; 2391 spi_min_period(tp->starget) = esp->min_period;
2376 spi_max_offset(tp->starget) = 15; 2392 spi_max_offset(tp->starget) = 15;
2377 2393
@@ -2608,6 +2624,8 @@ struct scsi_host_template scsi_esp_template = {
2608 .name = "esp", 2624 .name = "esp",
2609 .info = esp_info, 2625 .info = esp_info,
2610 .queuecommand = esp_queuecommand, 2626 .queuecommand = esp_queuecommand,
2627 .target_alloc = esp_target_alloc,
2628 .target_destroy = esp_target_destroy,
2611 .slave_alloc = esp_slave_alloc, 2629 .slave_alloc = esp_slave_alloc,
2612 .slave_configure = esp_slave_configure, 2630 .slave_configure = esp_slave_configure,
2613 .slave_destroy = esp_slave_destroy, 2631 .slave_destroy = esp_slave_destroy,
diff --git a/drivers/scsi/ses.c b/drivers/scsi/ses.c
index 45df83b9d847..0fe031f003e7 100644
--- a/drivers/scsi/ses.c
+++ b/drivers/scsi/ses.c
@@ -61,7 +61,7 @@ static int ses_probe(struct device *dev)
61 return err; 61 return err;
62} 62}
63 63
64#define SES_TIMEOUT 30 64#define SES_TIMEOUT (30 * HZ)
65#define SES_RETRIES 3 65#define SES_RETRIES 3
66 66
67static int ses_recv_diag(struct scsi_device *sdev, int page_code, 67static int ses_recv_diag(struct scsi_device *sdev, int page_code,
diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig
index 9bc42763623c..5a9754455eed 100644
--- a/drivers/serial/Kconfig
+++ b/drivers/serial/Kconfig
@@ -448,22 +448,27 @@ config SERIAL_CLPS711X_CONSOLE
448 your boot loader (lilo or loadlin) about how to pass options to the 448 your boot loader (lilo or loadlin) about how to pass options to the
449 kernel at boot time.) 449 kernel at boot time.)
450 450
451config SERIAL_S3C2410 451config SERIAL_SAMSUNG
452 tristate "Samsung S3C2410/S3C2440/S3C2442/S3C2412 Serial port support" 452 tristate "Samsung SoC serial support"
453 depends on ARM && ARCH_S3C2410 453 depends on ARM && PLAT_S3C24XX
454 select SERIAL_CORE
455 help 454 help
456 Support for the on-chip UARTs on the Samsung S3C24XX series CPUs, 455 Support for the on-chip UARTs on the Samsung S3C24XX series CPUs,
457 providing /dev/ttySAC0, 1 and 2 (note, some machines may not 456 providing /dev/ttySAC0, 1 and 2 (note, some machines may not
458 provide all of these ports, depending on how the serial port 457 provide all of these ports, depending on how the serial port
459 pins are configured. 458 pins are configured.
460 459
461 Currently this driver supports the UARTS on the S3C2410, S3C2440, 460config SERIAL_SAMSUNG_DEBUG
462 S3C2442, S3C2412 and S3C2413 CPUs. 461 bool "Samsung SoC serial debug"
462 depends on SERIAL_SAMSUNG
463 help
464 Add support for debugging the serial driver. Since this is
465 generally being used as a console, we use our own output
466 routines that go via the low-level debug printascii()
467 function.
463 468
464config SERIAL_S3C2410_CONSOLE 469config SERIAL_SAMSUNG_CONSOLE
465 bool "Support for console on S3C2410 serial port" 470 bool "Support for console on Samsung SoC serial port"
466 depends on SERIAL_S3C2410=y 471 depends on SERIAL_SAMSUNG=y
467 select SERIAL_CORE_CONSOLE 472 select SERIAL_CORE_CONSOLE
468 help 473 help
469 Allow selection of the S3C24XX on-board serial ports for use as 474 Allow selection of the S3C24XX on-board serial ports for use as
@@ -476,6 +481,37 @@ config SERIAL_S3C2410_CONSOLE
476 your boot loader about how to pass options to the kernel at 481 your boot loader about how to pass options to the kernel at
477 boot time.) 482 boot time.)
478 483
484config SERIAL_S3C2400
485 tristate "Samsung S3C2410 Serial port support"
486 depends on ARM && SERIAL_SAMSUNG && CPU_S3C2400
487 default y if CPU_S3C2400
488 help
489 Serial port support for the Samsung S3C2400 SoC
490
491config SERIAL_S3C2410
492 tristate "Samsung S3C2410 Serial port support"
493 depends on SERIAL_SAMSUNG && CPU_S3C2410
494 default y if CPU_S3C2410
495 help
496 Serial port support for the Samsung S3C2410 SoC
497
498config SERIAL_S3C2412
499 tristate "Samsung S3C2412/S3C2413 Serial port support"
500 depends on SERIAL_SAMSUNG && CPU_S3C2412
501 default y if CPU_S3C2412
502 help
503 Serial port support for the Samsung S3C2412 and S3C2413 SoC
504
505config SERIAL_S3C2440
506 tristate "Samsung S3C2440/S3C2442 Serial port support"
507 depends on SERIAL_SAMSUNG && (CPU_S3C2440 || CPU_S3C2442)
508 default y if CPU_S3C2440
509 default y if CPU_S3C2442
510 help
511 Serial port support for the Samsung S3C2440 and S3C2442 SoC
512
513
514
479config SERIAL_DZ 515config SERIAL_DZ
480 bool "DECstation DZ serial driver" 516 bool "DECstation DZ serial driver"
481 depends on MACH_DECSTATION && 32BIT 517 depends on MACH_DECSTATION && 32BIT
diff --git a/drivers/serial/Makefile b/drivers/serial/Makefile
index 0d9c09b1e836..7d85c1fbe7e0 100644
--- a/drivers/serial/Makefile
+++ b/drivers/serial/Makefile
@@ -28,7 +28,11 @@ obj-$(CONFIG_SERIAL_PNX8XXX) += pnx8xxx_uart.o
28obj-$(CONFIG_SERIAL_SA1100) += sa1100.o 28obj-$(CONFIG_SERIAL_SA1100) += sa1100.o
29obj-$(CONFIG_SERIAL_BFIN) += bfin_5xx.o 29obj-$(CONFIG_SERIAL_BFIN) += bfin_5xx.o
30obj-$(CONFIG_SERIAL_BFIN_SPORT) += bfin_sport_uart.o 30obj-$(CONFIG_SERIAL_BFIN_SPORT) += bfin_sport_uart.o
31obj-$(CONFIG_SERIAL_SAMSUNG) += samsung.o
32obj-$(CONFIG_SERIAL_S3C2400) += s3c2400.o
31obj-$(CONFIG_SERIAL_S3C2410) += s3c2410.o 33obj-$(CONFIG_SERIAL_S3C2410) += s3c2410.o
34obj-$(CONFIG_SERIAL_S3C2412) += s3c2412.o
35obj-$(CONFIG_SERIAL_S3C2440) += s3c2440.o
32obj-$(CONFIG_SERIAL_SUNCORE) += suncore.o 36obj-$(CONFIG_SERIAL_SUNCORE) += suncore.o
33obj-$(CONFIG_SERIAL_SUNHV) += sunhv.o 37obj-$(CONFIG_SERIAL_SUNHV) += sunhv.o
34obj-$(CONFIG_SERIAL_SUNZILOG) += sunzilog.o 38obj-$(CONFIG_SERIAL_SUNZILOG) += sunzilog.o
diff --git a/drivers/serial/s3c2400.c b/drivers/serial/s3c2400.c
new file mode 100644
index 000000000000..a1102053e553
--- /dev/null
+++ b/drivers/serial/s3c2400.c
@@ -0,0 +1,106 @@
1/* linux/drivers/serial/s3c240.c
2 *
3 * Driver for Samsung SoC onboard UARTs.
4 *
5 * Ben Dooks, Copyright (c) 2003-2005 Simtec Electronics
6 * http://armlinux.simtec.co.uk/
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#include <linux/module.h>
14#include <linux/ioport.h>
15#include <linux/io.h>
16#include <linux/platform_device.h>
17
18#include <asm/irq.h>
19
20#include <asm/hardware.h>
21
22#include <asm/plat-s3c/regs-serial.h>
23#include <asm/arch/regs-gpio.h>
24
25#include "samsung.h"
26
27static int s3c2400_serial_getsource(struct uart_port *port,
28 struct s3c24xx_uart_clksrc *clk)
29{
30 clk->divisor = 1;
31 clk->name = "pclk";
32
33 return 0;
34}
35
36static int s3c2400_serial_setsource(struct uart_port *port,
37 struct s3c24xx_uart_clksrc *clk)
38{
39 return 0;
40}
41
42static int s3c2400_serial_resetport(struct uart_port *port,
43 struct s3c2410_uartcfg *cfg)
44{
45 dbg("s3c2400_serial_resetport: port=%p (%08lx), cfg=%p\n",
46 port, port->mapbase, cfg);
47
48 wr_regl(port, S3C2410_UCON, cfg->ucon);
49 wr_regl(port, S3C2410_ULCON, cfg->ulcon);
50
51 /* reset both fifos */
52
53 wr_regl(port, S3C2410_UFCON, cfg->ufcon | S3C2410_UFCON_RESETBOTH);
54 wr_regl(port, S3C2410_UFCON, cfg->ufcon);
55
56 return 0;
57}
58
59static struct s3c24xx_uart_info s3c2400_uart_inf = {
60 .name = "Samsung S3C2400 UART",
61 .type = PORT_S3C2400,
62 .fifosize = 16,
63 .rx_fifomask = S3C2410_UFSTAT_RXMASK,
64 .rx_fifoshift = S3C2410_UFSTAT_RXSHIFT,
65 .rx_fifofull = S3C2410_UFSTAT_RXFULL,
66 .tx_fifofull = S3C2410_UFSTAT_TXFULL,
67 .tx_fifomask = S3C2410_UFSTAT_TXMASK,
68 .tx_fifoshift = S3C2410_UFSTAT_TXSHIFT,
69 .get_clksrc = s3c2400_serial_getsource,
70 .set_clksrc = s3c2400_serial_setsource,
71 .reset_port = s3c2400_serial_resetport,
72};
73
74static int s3c2400_serial_probe(struct platform_device *dev)
75{
76 return s3c24xx_serial_probe(dev, &s3c2400_uart_inf);
77}
78
79static struct platform_driver s3c2400_serial_drv = {
80 .probe = s3c2400_serial_probe,
81 .remove = s3c24xx_serial_remove,
82 .driver = {
83 .name = "s3c2400-uart",
84 .owner = THIS_MODULE,
85 },
86};
87
88s3c24xx_console_init(&s3c2400_serial_drv, &s3c2400_uart_inf);
89
90static inline int s3c2400_serial_init(void)
91{
92 return s3c24xx_serial_init(&s3c2400_serial_drv, &s3c2400_uart_inf);
93}
94
95static inline void s3c2400_serial_exit(void)
96{
97 platform_driver_unregister(&s3c2400_serial_drv);
98}
99
100module_init(s3c2400_serial_init);
101module_exit(s3c2400_serial_exit);
102
103MODULE_LICENSE("GPL v2");
104MODULE_AUTHOR("Ben Dooks <ben@simtec.co.uk>");
105MODULE_DESCRIPTION("Samsung S3C2400 SoC Serial port driver");
106MODULE_ALIAS("platform:s3c2400-uart");
diff --git a/drivers/serial/s3c2410.c b/drivers/serial/s3c2410.c
index 2b6a013639e6..c5f03f41686f 100644
--- a/drivers/serial/s3c2410.c
+++ b/drivers/serial/s3c2410.c
@@ -1,1270 +1,30 @@
1/* 1/* linux/drivers/serial/s3c2410.c
2 * linux/drivers/serial/s3c2410.c
3 * 2 *
4 * Driver for onboard UARTs on the Samsung S3C24XX 3 * Driver for Samsung S3C2410 SoC onboard UARTs.
5 * 4 *
6 * Based on drivers/char/serial.c and drivers/char/21285.c 5 * Ben Dooks, Copyright (c) 2003-2005,2008 Simtec Electronics
6 * http://armlinux.simtec.co.uk/
7 * 7 *
8 * Ben Dooks, (c) 2003-2005 Simtec Electronics 8 * This program is free software; you can redistribute it and/or modify
9 * http://www.simtec.co.uk/products/SWLINUX/ 9 * it under the terms of the GNU General Public License version 2 as
10 * 10 * published by the Free Software Foundation.
11 * Changelog:
12 *
13 * 22-Jul-2004 BJD Finished off device rewrite
14 *
15 * 21-Jul-2004 BJD Thanks to <herbet@13thfloor.at> for pointing out
16 * problems with baud rate and loss of IR settings. Update
17 * to add configuration via platform_device structure
18 *
19 * 28-Sep-2004 BJD Re-write for the following items
20 * - S3C2410 and S3C2440 serial support
21 * - Power Management support
22 * - Fix console via IrDA devices
23 * - SysReq (Herbert Pötzl)
24 * - Break character handling (Herbert Pötzl)
25 * - spin-lock initialisation (Dimitry Andric)
26 * - added clock control
27 * - updated init code to use platform_device info
28 *
29 * 06-Mar-2005 BJD Add s3c2440 fclk clock source
30 *
31 * 09-Mar-2005 BJD Add s3c2400 support
32 *
33 * 10-Mar-2005 LCVR Changed S3C2410_VA_UART to S3C24XX_VA_UART
34*/
35
36/* Note on 2440 fclk clock source handling
37 *
38 * Whilst it is possible to use the fclk as clock source, the method
39 * of properly switching too/from this is currently un-implemented, so
40 * whichever way is configured at startup is the one that will be used.
41*/
42
43/* Hote on 2410 error handling
44 *
45 * The s3c2410 manual has a love/hate affair with the contents of the
46 * UERSTAT register in the UART blocks, and keeps marking some of the
47 * error bits as reserved. Having checked with the s3c2410x01,
48 * it copes with BREAKs properly, so I am happy to ignore the RESERVED
49 * feature from the latter versions of the manual.
50 *
51 * If it becomes aparrent that latter versions of the 2410 remove these
52 * bits, then action will have to be taken to differentiate the versions
53 * and change the policy on BREAK
54 *
55 * BJD, 04-Nov-2004
56*/ 11*/
57 12
58
59#if defined(CONFIG_SERIAL_S3C2410_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
60#define SUPPORT_SYSRQ
61#endif
62
63#include <linux/module.h> 13#include <linux/module.h>
64#include <linux/ioport.h> 14#include <linux/ioport.h>
15#include <linux/io.h>
65#include <linux/platform_device.h> 16#include <linux/platform_device.h>
66#include <linux/init.h> 17#include <linux/init.h>
67#include <linux/sysrq.h>
68#include <linux/console.h>
69#include <linux/tty.h>
70#include <linux/tty_flip.h>
71#include <linux/serial_core.h> 18#include <linux/serial_core.h>
72#include <linux/serial.h> 19#include <linux/serial.h>
73#include <linux/delay.h>
74#include <linux/clk.h>
75 20
76#include <asm/io.h>
77#include <asm/irq.h> 21#include <asm/irq.h>
78
79#include <asm/hardware.h> 22#include <asm/hardware.h>
80 23
81#include <asm/plat-s3c/regs-serial.h> 24#include <asm/plat-s3c/regs-serial.h>
82#include <asm/arch/regs-gpio.h> 25#include <asm/arch/regs-gpio.h>
83 26
84/* structures */ 27#include "samsung.h"
85
86struct s3c24xx_uart_info {
87 char *name;
88 unsigned int type;
89 unsigned int fifosize;
90 unsigned long rx_fifomask;
91 unsigned long rx_fifoshift;
92 unsigned long rx_fifofull;
93 unsigned long tx_fifomask;
94 unsigned long tx_fifoshift;
95 unsigned long tx_fifofull;
96
97 /* clock source control */
98
99 int (*get_clksrc)(struct uart_port *, struct s3c24xx_uart_clksrc *clk);
100 int (*set_clksrc)(struct uart_port *, struct s3c24xx_uart_clksrc *clk);
101
102 /* uart controls */
103 int (*reset_port)(struct uart_port *, struct s3c2410_uartcfg *);
104};
105
106struct s3c24xx_uart_port {
107 unsigned char rx_claimed;
108 unsigned char tx_claimed;
109
110 struct s3c24xx_uart_info *info;
111 struct s3c24xx_uart_clksrc *clksrc;
112 struct clk *clk;
113 struct clk *baudclk;
114 struct uart_port port;
115};
116
117
118/* configuration defines */
119
120#if 0
121#if 1
122/* send debug to the low-level output routines */
123
124extern void printascii(const char *);
125
126static void
127s3c24xx_serial_dbg(const char *fmt, ...)
128{
129 va_list va;
130 char buff[256];
131
132 va_start(va, fmt);
133 vsprintf(buff, fmt, va);
134 va_end(va);
135
136 printascii(buff);
137}
138
139#define dbg(x...) s3c24xx_serial_dbg(x)
140
141#else
142#define dbg(x...) printk(KERN_DEBUG "s3c24xx: ");
143#endif
144#else /* no debug */
145#define dbg(x...) do {} while(0)
146#endif
147
148/* UART name and device definitions */
149
150#define S3C24XX_SERIAL_NAME "ttySAC"
151#define S3C24XX_SERIAL_MAJOR 204
152#define S3C24XX_SERIAL_MINOR 64
153
154
155/* conversion functions */
156
157#define s3c24xx_dev_to_port(__dev) (struct uart_port *)dev_get_drvdata(__dev)
158#define s3c24xx_dev_to_cfg(__dev) (struct s3c2410_uartcfg *)((__dev)->platform_data)
159
160/* we can support 3 uarts, but not always use them */
161
162#ifdef CONFIG_CPU_S3C2400
163#define NR_PORTS (2)
164#else
165#define NR_PORTS (3)
166#endif
167
168/* port irq numbers */
169
170#define TX_IRQ(port) ((port)->irq + 1)
171#define RX_IRQ(port) ((port)->irq)
172
173/* register access controls */
174
175#define portaddr(port, reg) ((port)->membase + (reg))
176
177#define rd_regb(port, reg) (__raw_readb(portaddr(port, reg)))
178#define rd_regl(port, reg) (__raw_readl(portaddr(port, reg)))
179
180#define wr_regb(port, reg, val) \
181 do { __raw_writeb(val, portaddr(port, reg)); } while(0)
182
183#define wr_regl(port, reg, val) \
184 do { __raw_writel(val, portaddr(port, reg)); } while(0)
185
186/* macros to change one thing to another */
187
188#define tx_enabled(port) ((port)->unused[0])
189#define rx_enabled(port) ((port)->unused[1])
190
191/* flag to ignore all characters comming in */
192#define RXSTAT_DUMMY_READ (0x10000000)
193
194static inline struct s3c24xx_uart_port *to_ourport(struct uart_port *port)
195{
196 return container_of(port, struct s3c24xx_uart_port, port);
197}
198
199/* translate a port to the device name */
200
201static inline const char *s3c24xx_serial_portname(struct uart_port *port)
202{
203 return to_platform_device(port->dev)->name;
204}
205
206static int s3c24xx_serial_txempty_nofifo(struct uart_port *port)
207{
208 return (rd_regl(port, S3C2410_UTRSTAT) & S3C2410_UTRSTAT_TXE);
209}
210
211static void s3c24xx_serial_rx_enable(struct uart_port *port)
212{
213 unsigned long flags;
214 unsigned int ucon, ufcon;
215 int count = 10000;
216
217 spin_lock_irqsave(&port->lock, flags);
218
219 while (--count && !s3c24xx_serial_txempty_nofifo(port))
220 udelay(100);
221
222 ufcon = rd_regl(port, S3C2410_UFCON);
223 ufcon |= S3C2410_UFCON_RESETRX;
224 wr_regl(port, S3C2410_UFCON, ufcon);
225
226 ucon = rd_regl(port, S3C2410_UCON);
227 ucon |= S3C2410_UCON_RXIRQMODE;
228 wr_regl(port, S3C2410_UCON, ucon);
229
230 rx_enabled(port) = 1;
231 spin_unlock_irqrestore(&port->lock, flags);
232}
233
234static void s3c24xx_serial_rx_disable(struct uart_port *port)
235{
236 unsigned long flags;
237 unsigned int ucon;
238
239 spin_lock_irqsave(&port->lock, flags);
240
241 ucon = rd_regl(port, S3C2410_UCON);
242 ucon &= ~S3C2410_UCON_RXIRQMODE;
243 wr_regl(port, S3C2410_UCON, ucon);
244
245 rx_enabled(port) = 0;
246 spin_unlock_irqrestore(&port->lock, flags);
247}
248
249static void s3c24xx_serial_stop_tx(struct uart_port *port)
250{
251 if (tx_enabled(port)) {
252 disable_irq(TX_IRQ(port));
253 tx_enabled(port) = 0;
254 if (port->flags & UPF_CONS_FLOW)
255 s3c24xx_serial_rx_enable(port);
256 }
257}
258
259static void s3c24xx_serial_start_tx(struct uart_port *port)
260{
261 if (!tx_enabled(port)) {
262 if (port->flags & UPF_CONS_FLOW)
263 s3c24xx_serial_rx_disable(port);
264
265 enable_irq(TX_IRQ(port));
266 tx_enabled(port) = 1;
267 }
268}
269
270
271static void s3c24xx_serial_stop_rx(struct uart_port *port)
272{
273 if (rx_enabled(port)) {
274 dbg("s3c24xx_serial_stop_rx: port=%p\n", port);
275 disable_irq(RX_IRQ(port));
276 rx_enabled(port) = 0;
277 }
278}
279
280static void s3c24xx_serial_enable_ms(struct uart_port *port)
281{
282}
283
284static inline struct s3c24xx_uart_info *s3c24xx_port_to_info(struct uart_port *port)
285{
286 return to_ourport(port)->info;
287}
288
289static inline struct s3c2410_uartcfg *s3c24xx_port_to_cfg(struct uart_port *port)
290{
291 if (port->dev == NULL)
292 return NULL;
293
294 return (struct s3c2410_uartcfg *)port->dev->platform_data;
295}
296
297static int s3c24xx_serial_rx_fifocnt(struct s3c24xx_uart_port *ourport,
298 unsigned long ufstat)
299{
300 struct s3c24xx_uart_info *info = ourport->info;
301
302 if (ufstat & info->rx_fifofull)
303 return info->fifosize;
304
305 return (ufstat & info->rx_fifomask) >> info->rx_fifoshift;
306}
307
308
309/* ? - where has parity gone?? */
310#define S3C2410_UERSTAT_PARITY (0x1000)
311
312static irqreturn_t
313s3c24xx_serial_rx_chars(int irq, void *dev_id)
314{
315 struct s3c24xx_uart_port *ourport = dev_id;
316 struct uart_port *port = &ourport->port;
317 struct tty_struct *tty = port->info->tty;
318 unsigned int ufcon, ch, flag, ufstat, uerstat;
319 int max_count = 64;
320
321 while (max_count-- > 0) {
322 ufcon = rd_regl(port, S3C2410_UFCON);
323 ufstat = rd_regl(port, S3C2410_UFSTAT);
324
325 if (s3c24xx_serial_rx_fifocnt(ourport, ufstat) == 0)
326 break;
327
328 uerstat = rd_regl(port, S3C2410_UERSTAT);
329 ch = rd_regb(port, S3C2410_URXH);
330
331 if (port->flags & UPF_CONS_FLOW) {
332 int txe = s3c24xx_serial_txempty_nofifo(port);
333
334 if (rx_enabled(port)) {
335 if (!txe) {
336 rx_enabled(port) = 0;
337 continue;
338 }
339 } else {
340 if (txe) {
341 ufcon |= S3C2410_UFCON_RESETRX;
342 wr_regl(port, S3C2410_UFCON, ufcon);
343 rx_enabled(port) = 1;
344 goto out;
345 }
346 continue;
347 }
348 }
349
350 /* insert the character into the buffer */
351
352 flag = TTY_NORMAL;
353 port->icount.rx++;
354
355 if (unlikely(uerstat & S3C2410_UERSTAT_ANY)) {
356 dbg("rxerr: port ch=0x%02x, rxs=0x%08x\n",
357 ch, uerstat);
358
359 /* check for break */
360 if (uerstat & S3C2410_UERSTAT_BREAK) {
361 dbg("break!\n");
362 port->icount.brk++;
363 if (uart_handle_break(port))
364 goto ignore_char;
365 }
366
367 if (uerstat & S3C2410_UERSTAT_FRAME)
368 port->icount.frame++;
369 if (uerstat & S3C2410_UERSTAT_OVERRUN)
370 port->icount.overrun++;
371
372 uerstat &= port->read_status_mask;
373
374 if (uerstat & S3C2410_UERSTAT_BREAK)
375 flag = TTY_BREAK;
376 else if (uerstat & S3C2410_UERSTAT_PARITY)
377 flag = TTY_PARITY;
378 else if (uerstat & ( S3C2410_UERSTAT_FRAME | S3C2410_UERSTAT_OVERRUN))
379 flag = TTY_FRAME;
380 }
381
382 if (uart_handle_sysrq_char(port, ch))
383 goto ignore_char;
384
385 uart_insert_char(port, uerstat, S3C2410_UERSTAT_OVERRUN, ch, flag);
386
387 ignore_char:
388 continue;
389 }
390 tty_flip_buffer_push(tty);
391
392 out:
393 return IRQ_HANDLED;
394}
395
396static irqreturn_t s3c24xx_serial_tx_chars(int irq, void *id)
397{
398 struct s3c24xx_uart_port *ourport = id;
399 struct uart_port *port = &ourport->port;
400 struct circ_buf *xmit = &port->info->xmit;
401 int count = 256;
402
403 if (port->x_char) {
404 wr_regb(port, S3C2410_UTXH, port->x_char);
405 port->icount.tx++;
406 port->x_char = 0;
407 goto out;
408 }
409
410 /* if there isnt anything more to transmit, or the uart is now
411 * stopped, disable the uart and exit
412 */
413
414 if (uart_circ_empty(xmit) || uart_tx_stopped(port)) {
415 s3c24xx_serial_stop_tx(port);
416 goto out;
417 }
418
419 /* try and drain the buffer... */
420
421 while (!uart_circ_empty(xmit) && count-- > 0) {
422 if (rd_regl(port, S3C2410_UFSTAT) & ourport->info->tx_fifofull)
423 break;
424
425 wr_regb(port, S3C2410_UTXH, xmit->buf[xmit->tail]);
426 xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);
427 port->icount.tx++;
428 }
429
430 if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS)
431 uart_write_wakeup(port);
432
433 if (uart_circ_empty(xmit))
434 s3c24xx_serial_stop_tx(port);
435
436 out:
437 return IRQ_HANDLED;
438}
439
440static unsigned int s3c24xx_serial_tx_empty(struct uart_port *port)
441{
442 struct s3c24xx_uart_info *info = s3c24xx_port_to_info(port);
443 unsigned long ufstat = rd_regl(port, S3C2410_UFSTAT);
444 unsigned long ufcon = rd_regl(port, S3C2410_UFCON);
445
446 if (ufcon & S3C2410_UFCON_FIFOMODE) {
447 if ((ufstat & info->tx_fifomask) != 0 ||
448 (ufstat & info->tx_fifofull))
449 return 0;
450
451 return 1;
452 }
453
454 return s3c24xx_serial_txempty_nofifo(port);
455}
456
457/* no modem control lines */
458static unsigned int s3c24xx_serial_get_mctrl(struct uart_port *port)
459{
460 unsigned int umstat = rd_regb(port,S3C2410_UMSTAT);
461
462 if (umstat & S3C2410_UMSTAT_CTS)
463 return TIOCM_CAR | TIOCM_DSR | TIOCM_CTS;
464 else
465 return TIOCM_CAR | TIOCM_DSR;
466}
467
468static void s3c24xx_serial_set_mctrl(struct uart_port *port, unsigned int mctrl)
469{
470 /* todo - possibly remove AFC and do manual CTS */
471}
472
473static void s3c24xx_serial_break_ctl(struct uart_port *port, int break_state)
474{
475 unsigned long flags;
476 unsigned int ucon;
477
478 spin_lock_irqsave(&port->lock, flags);
479
480 ucon = rd_regl(port, S3C2410_UCON);
481
482 if (break_state)
483 ucon |= S3C2410_UCON_SBREAK;
484 else
485 ucon &= ~S3C2410_UCON_SBREAK;
486
487 wr_regl(port, S3C2410_UCON, ucon);
488
489 spin_unlock_irqrestore(&port->lock, flags);
490}
491
492static void s3c24xx_serial_shutdown(struct uart_port *port)
493{
494 struct s3c24xx_uart_port *ourport = to_ourport(port);
495
496 if (ourport->tx_claimed) {
497 free_irq(TX_IRQ(port), ourport);
498 tx_enabled(port) = 0;
499 ourport->tx_claimed = 0;
500 }
501
502 if (ourport->rx_claimed) {
503 free_irq(RX_IRQ(port), ourport);
504 ourport->rx_claimed = 0;
505 rx_enabled(port) = 0;
506 }
507}
508
509
510static int s3c24xx_serial_startup(struct uart_port *port)
511{
512 struct s3c24xx_uart_port *ourport = to_ourport(port);
513 int ret;
514
515 dbg("s3c24xx_serial_startup: port=%p (%08lx,%p)\n",
516 port->mapbase, port->membase);
517
518 rx_enabled(port) = 1;
519
520 ret = request_irq(RX_IRQ(port),
521 s3c24xx_serial_rx_chars, 0,
522 s3c24xx_serial_portname(port), ourport);
523
524 if (ret != 0) {
525 printk(KERN_ERR "cannot get irq %d\n", RX_IRQ(port));
526 return ret;
527 }
528
529 ourport->rx_claimed = 1;
530
531 dbg("requesting tx irq...\n");
532
533 tx_enabled(port) = 1;
534
535 ret = request_irq(TX_IRQ(port),
536 s3c24xx_serial_tx_chars, 0,
537 s3c24xx_serial_portname(port), ourport);
538
539 if (ret) {
540 printk(KERN_ERR "cannot get irq %d\n", TX_IRQ(port));
541 goto err;
542 }
543
544 ourport->tx_claimed = 1;
545
546 dbg("s3c24xx_serial_startup ok\n");
547
548 /* the port reset code should have done the correct
549 * register setup for the port controls */
550
551 return ret;
552
553 err:
554 s3c24xx_serial_shutdown(port);
555 return ret;
556}
557
558/* power power management control */
559
560static void s3c24xx_serial_pm(struct uart_port *port, unsigned int level,
561 unsigned int old)
562{
563 struct s3c24xx_uart_port *ourport = to_ourport(port);
564
565 switch (level) {
566 case 3:
567 if (!IS_ERR(ourport->baudclk) && ourport->baudclk != NULL)
568 clk_disable(ourport->baudclk);
569
570 clk_disable(ourport->clk);
571 break;
572
573 case 0:
574 clk_enable(ourport->clk);
575
576 if (!IS_ERR(ourport->baudclk) && ourport->baudclk != NULL)
577 clk_enable(ourport->baudclk);
578
579 break;
580 default:
581 printk(KERN_ERR "s3c24xx_serial: unknown pm %d\n", level);
582 }
583}
584
585/* baud rate calculation
586 *
587 * The UARTs on the S3C2410/S3C2440 can take their clocks from a number
588 * of different sources, including the peripheral clock ("pclk") and an
589 * external clock ("uclk"). The S3C2440 also adds the core clock ("fclk")
590 * with a programmable extra divisor.
591 *
592 * The following code goes through the clock sources, and calculates the
593 * baud clocks (and the resultant actual baud rates) and then tries to
594 * pick the closest one and select that.
595 *
596*/
597
598
599#define MAX_CLKS (8)
600
601static struct s3c24xx_uart_clksrc tmp_clksrc = {
602 .name = "pclk",
603 .min_baud = 0,
604 .max_baud = 0,
605 .divisor = 1,
606};
607
608static inline int
609s3c24xx_serial_getsource(struct uart_port *port, struct s3c24xx_uart_clksrc *c)
610{
611 struct s3c24xx_uart_info *info = s3c24xx_port_to_info(port);
612
613 return (info->get_clksrc)(port, c);
614}
615
616static inline int
617s3c24xx_serial_setsource(struct uart_port *port, struct s3c24xx_uart_clksrc *c)
618{
619 struct s3c24xx_uart_info *info = s3c24xx_port_to_info(port);
620
621 return (info->set_clksrc)(port, c);
622}
623
624struct baud_calc {
625 struct s3c24xx_uart_clksrc *clksrc;
626 unsigned int calc;
627 unsigned int quot;
628 struct clk *src;
629};
630
631static int s3c24xx_serial_calcbaud(struct baud_calc *calc,
632 struct uart_port *port,
633 struct s3c24xx_uart_clksrc *clksrc,
634 unsigned int baud)
635{
636 unsigned long rate;
637
638 calc->src = clk_get(port->dev, clksrc->name);
639 if (calc->src == NULL || IS_ERR(calc->src))
640 return 0;
641
642 rate = clk_get_rate(calc->src);
643 rate /= clksrc->divisor;
644
645 calc->clksrc = clksrc;
646 calc->quot = (rate + (8 * baud)) / (16 * baud);
647 calc->calc = (rate / (calc->quot * 16));
648
649 calc->quot--;
650 return 1;
651}
652
653static unsigned int s3c24xx_serial_getclk(struct uart_port *port,
654 struct s3c24xx_uart_clksrc **clksrc,
655 struct clk **clk,
656 unsigned int baud)
657{
658 struct s3c2410_uartcfg *cfg = s3c24xx_port_to_cfg(port);
659 struct s3c24xx_uart_clksrc *clkp;
660 struct baud_calc res[MAX_CLKS];
661 struct baud_calc *resptr, *best, *sptr;
662 int i;
663
664 clkp = cfg->clocks;
665 best = NULL;
666
667 if (cfg->clocks_size < 2) {
668 if (cfg->clocks_size == 0)
669 clkp = &tmp_clksrc;
670
671 /* check to see if we're sourcing fclk, and if so we're
672 * going to have to update the clock source
673 */
674
675 if (strcmp(clkp->name, "fclk") == 0) {
676 struct s3c24xx_uart_clksrc src;
677
678 s3c24xx_serial_getsource(port, &src);
679
680 /* check that the port already using fclk, and if
681 * not, then re-select fclk
682 */
683
684 if (strcmp(src.name, clkp->name) == 0) {
685 s3c24xx_serial_setsource(port, clkp);
686 s3c24xx_serial_getsource(port, &src);
687 }
688
689 clkp->divisor = src.divisor;
690 }
691
692 s3c24xx_serial_calcbaud(res, port, clkp, baud);
693 best = res;
694 resptr = best + 1;
695 } else {
696 resptr = res;
697
698 for (i = 0; i < cfg->clocks_size; i++, clkp++) {
699 if (s3c24xx_serial_calcbaud(resptr, port, clkp, baud))
700 resptr++;
701 }
702 }
703
704 /* ok, we now need to select the best clock we found */
705
706 if (!best) {
707 unsigned int deviation = (1<<30)|((1<<30)-1);
708 int calc_deviation;
709
710 for (sptr = res; sptr < resptr; sptr++) {
711 printk(KERN_DEBUG
712 "found clk %p (%s) quot %d, calc %d\n",
713 sptr->clksrc, sptr->clksrc->name,
714 sptr->quot, sptr->calc);
715
716 calc_deviation = baud - sptr->calc;
717 if (calc_deviation < 0)
718 calc_deviation = -calc_deviation;
719
720 if (calc_deviation < deviation) {
721 best = sptr;
722 deviation = calc_deviation;
723 }
724 }
725
726 printk(KERN_DEBUG "best %p (deviation %d)\n", best, deviation);
727 }
728
729 printk(KERN_DEBUG "selected clock %p (%s) quot %d, calc %d\n",
730 best->clksrc, best->clksrc->name, best->quot, best->calc);
731
732 /* store results to pass back */
733
734 *clksrc = best->clksrc;
735 *clk = best->src;
736
737 return best->quot;
738}
739
740static void s3c24xx_serial_set_termios(struct uart_port *port,
741 struct ktermios *termios,
742 struct ktermios *old)
743{
744 struct s3c2410_uartcfg *cfg = s3c24xx_port_to_cfg(port);
745 struct s3c24xx_uart_port *ourport = to_ourport(port);
746 struct s3c24xx_uart_clksrc *clksrc = NULL;
747 struct clk *clk = NULL;
748 unsigned long flags;
749 unsigned int baud, quot;
750 unsigned int ulcon;
751 unsigned int umcon;
752
753 /*
754 * We don't support modem control lines.
755 */
756 termios->c_cflag &= ~(HUPCL | CMSPAR);
757 termios->c_cflag |= CLOCAL;
758
759 /*
760 * Ask the core to calculate the divisor for us.
761 */
762
763 baud = uart_get_baud_rate(port, termios, old, 0, 115200*8);
764
765 if (baud == 38400 && (port->flags & UPF_SPD_MASK) == UPF_SPD_CUST)
766 quot = port->custom_divisor;
767 else
768 quot = s3c24xx_serial_getclk(port, &clksrc, &clk, baud);
769
770 /* check to see if we need to change clock source */
771
772 if (ourport->clksrc != clksrc || ourport->baudclk != clk) {
773 s3c24xx_serial_setsource(port, clksrc);
774
775 if (ourport->baudclk != NULL && !IS_ERR(ourport->baudclk)) {
776 clk_disable(ourport->baudclk);
777 ourport->baudclk = NULL;
778 }
779
780 clk_enable(clk);
781
782 ourport->clksrc = clksrc;
783 ourport->baudclk = clk;
784 }
785
786 switch (termios->c_cflag & CSIZE) {
787 case CS5:
788 dbg("config: 5bits/char\n");
789 ulcon = S3C2410_LCON_CS5;
790 break;
791 case CS6:
792 dbg("config: 6bits/char\n");
793 ulcon = S3C2410_LCON_CS6;
794 break;
795 case CS7:
796 dbg("config: 7bits/char\n");
797 ulcon = S3C2410_LCON_CS7;
798 break;
799 case CS8:
800 default:
801 dbg("config: 8bits/char\n");
802 ulcon = S3C2410_LCON_CS8;
803 break;
804 }
805
806 /* preserve original lcon IR settings */
807 ulcon |= (cfg->ulcon & S3C2410_LCON_IRM);
808
809 if (termios->c_cflag & CSTOPB)
810 ulcon |= S3C2410_LCON_STOPB;
811
812 umcon = (termios->c_cflag & CRTSCTS) ? S3C2410_UMCOM_AFC : 0;
813
814 if (termios->c_cflag & PARENB) {
815 if (termios->c_cflag & PARODD)
816 ulcon |= S3C2410_LCON_PODD;
817 else
818 ulcon |= S3C2410_LCON_PEVEN;
819 } else {
820 ulcon |= S3C2410_LCON_PNONE;
821 }
822
823 spin_lock_irqsave(&port->lock, flags);
824
825 dbg("setting ulcon to %08x, brddiv to %d\n", ulcon, quot);
826
827 wr_regl(port, S3C2410_ULCON, ulcon);
828 wr_regl(port, S3C2410_UBRDIV, quot);
829 wr_regl(port, S3C2410_UMCON, umcon);
830
831 dbg("uart: ulcon = 0x%08x, ucon = 0x%08x, ufcon = 0x%08x\n",
832 rd_regl(port, S3C2410_ULCON),
833 rd_regl(port, S3C2410_UCON),
834 rd_regl(port, S3C2410_UFCON));
835
836 /*
837 * Update the per-port timeout.
838 */
839 uart_update_timeout(port, termios->c_cflag, baud);
840
841 /*
842 * Which character status flags are we interested in?
843 */
844 port->read_status_mask = S3C2410_UERSTAT_OVERRUN;
845 if (termios->c_iflag & INPCK)
846 port->read_status_mask |= S3C2410_UERSTAT_FRAME | S3C2410_UERSTAT_PARITY;
847
848 /*
849 * Which character status flags should we ignore?
850 */
851 port->ignore_status_mask = 0;
852 if (termios->c_iflag & IGNPAR)
853 port->ignore_status_mask |= S3C2410_UERSTAT_OVERRUN;
854 if (termios->c_iflag & IGNBRK && termios->c_iflag & IGNPAR)
855 port->ignore_status_mask |= S3C2410_UERSTAT_FRAME;
856
857 /*
858 * Ignore all characters if CREAD is not set.
859 */
860 if ((termios->c_cflag & CREAD) == 0)
861 port->ignore_status_mask |= RXSTAT_DUMMY_READ;
862
863 spin_unlock_irqrestore(&port->lock, flags);
864}
865
866static const char *s3c24xx_serial_type(struct uart_port *port)
867{
868 switch (port->type) {
869 case PORT_S3C2410:
870 return "S3C2410";
871 case PORT_S3C2440:
872 return "S3C2440";
873 case PORT_S3C2412:
874 return "S3C2412";
875 default:
876 return NULL;
877 }
878}
879
880#define MAP_SIZE (0x100)
881
882static void s3c24xx_serial_release_port(struct uart_port *port)
883{
884 release_mem_region(port->mapbase, MAP_SIZE);
885}
886
887static int s3c24xx_serial_request_port(struct uart_port *port)
888{
889 const char *name = s3c24xx_serial_portname(port);
890 return request_mem_region(port->mapbase, MAP_SIZE, name) ? 0 : -EBUSY;
891}
892
893static void s3c24xx_serial_config_port(struct uart_port *port, int flags)
894{
895 struct s3c24xx_uart_info *info = s3c24xx_port_to_info(port);
896
897 if (flags & UART_CONFIG_TYPE &&
898 s3c24xx_serial_request_port(port) == 0)
899 port->type = info->type;
900}
901
902/*
903 * verify the new serial_struct (for TIOCSSERIAL).
904 */
905static int
906s3c24xx_serial_verify_port(struct uart_port *port, struct serial_struct *ser)
907{
908 struct s3c24xx_uart_info *info = s3c24xx_port_to_info(port);
909
910 if (ser->type != PORT_UNKNOWN && ser->type != info->type)
911 return -EINVAL;
912
913 return 0;
914}
915
916
917#ifdef CONFIG_SERIAL_S3C2410_CONSOLE
918
919static struct console s3c24xx_serial_console;
920
921#define S3C24XX_SERIAL_CONSOLE &s3c24xx_serial_console
922#else
923#define S3C24XX_SERIAL_CONSOLE NULL
924#endif
925
926static struct uart_ops s3c24xx_serial_ops = {
927 .pm = s3c24xx_serial_pm,
928 .tx_empty = s3c24xx_serial_tx_empty,
929 .get_mctrl = s3c24xx_serial_get_mctrl,
930 .set_mctrl = s3c24xx_serial_set_mctrl,
931 .stop_tx = s3c24xx_serial_stop_tx,
932 .start_tx = s3c24xx_serial_start_tx,
933 .stop_rx = s3c24xx_serial_stop_rx,
934 .enable_ms = s3c24xx_serial_enable_ms,
935 .break_ctl = s3c24xx_serial_break_ctl,
936 .startup = s3c24xx_serial_startup,
937 .shutdown = s3c24xx_serial_shutdown,
938 .set_termios = s3c24xx_serial_set_termios,
939 .type = s3c24xx_serial_type,
940 .release_port = s3c24xx_serial_release_port,
941 .request_port = s3c24xx_serial_request_port,
942 .config_port = s3c24xx_serial_config_port,
943 .verify_port = s3c24xx_serial_verify_port,
944};
945
946
947static struct uart_driver s3c24xx_uart_drv = {
948 .owner = THIS_MODULE,
949 .dev_name = "s3c2410_serial",
950 .nr = 3,
951 .cons = S3C24XX_SERIAL_CONSOLE,
952 .driver_name = S3C24XX_SERIAL_NAME,
953 .major = S3C24XX_SERIAL_MAJOR,
954 .minor = S3C24XX_SERIAL_MINOR,
955};
956
957static struct s3c24xx_uart_port s3c24xx_serial_ports[NR_PORTS] = {
958 [0] = {
959 .port = {
960 .lock = __SPIN_LOCK_UNLOCKED(s3c24xx_serial_ports[0].port.lock),
961 .iotype = UPIO_MEM,
962 .irq = IRQ_S3CUART_RX0,
963 .uartclk = 0,
964 .fifosize = 16,
965 .ops = &s3c24xx_serial_ops,
966 .flags = UPF_BOOT_AUTOCONF,
967 .line = 0,
968 }
969 },
970 [1] = {
971 .port = {
972 .lock = __SPIN_LOCK_UNLOCKED(s3c24xx_serial_ports[1].port.lock),
973 .iotype = UPIO_MEM,
974 .irq = IRQ_S3CUART_RX1,
975 .uartclk = 0,
976 .fifosize = 16,
977 .ops = &s3c24xx_serial_ops,
978 .flags = UPF_BOOT_AUTOCONF,
979 .line = 1,
980 }
981 },
982#if NR_PORTS > 2
983
984 [2] = {
985 .port = {
986 .lock = __SPIN_LOCK_UNLOCKED(s3c24xx_serial_ports[2].port.lock),
987 .iotype = UPIO_MEM,
988 .irq = IRQ_S3CUART_RX2,
989 .uartclk = 0,
990 .fifosize = 16,
991 .ops = &s3c24xx_serial_ops,
992 .flags = UPF_BOOT_AUTOCONF,
993 .line = 2,
994 }
995 }
996#endif
997};
998
999/* s3c24xx_serial_resetport
1000 *
1001 * wrapper to call the specific reset for this port (reset the fifos
1002 * and the settings)
1003*/
1004
1005static inline int s3c24xx_serial_resetport(struct uart_port * port,
1006 struct s3c2410_uartcfg *cfg)
1007{
1008 struct s3c24xx_uart_info *info = s3c24xx_port_to_info(port);
1009
1010 return (info->reset_port)(port, cfg);
1011}
1012
1013/* s3c24xx_serial_init_port
1014 *
1015 * initialise a single serial port from the platform device given
1016 */
1017
1018static int s3c24xx_serial_init_port(struct s3c24xx_uart_port *ourport,
1019 struct s3c24xx_uart_info *info,
1020 struct platform_device *platdev)
1021{
1022 struct uart_port *port = &ourport->port;
1023 struct s3c2410_uartcfg *cfg;
1024 struct resource *res;
1025 int ret;
1026
1027 dbg("s3c24xx_serial_init_port: port=%p, platdev=%p\n", port, platdev);
1028
1029 if (platdev == NULL)
1030 return -ENODEV;
1031
1032 cfg = s3c24xx_dev_to_cfg(&platdev->dev);
1033
1034 if (port->mapbase != 0)
1035 return 0;
1036
1037 if (cfg->hwport > 3)
1038 return -EINVAL;
1039
1040 /* setup info for port */
1041 port->dev = &platdev->dev;
1042 ourport->info = info;
1043
1044 /* copy the info in from provided structure */
1045 ourport->port.fifosize = info->fifosize;
1046
1047 dbg("s3c24xx_serial_init_port: %p (hw %d)...\n", port, cfg->hwport);
1048
1049 port->uartclk = 1;
1050
1051 if (cfg->uart_flags & UPF_CONS_FLOW) {
1052 dbg("s3c24xx_serial_init_port: enabling flow control\n");
1053 port->flags |= UPF_CONS_FLOW;
1054 }
1055
1056 /* sort our the physical and virtual addresses for each UART */
1057
1058 res = platform_get_resource(platdev, IORESOURCE_MEM, 0);
1059 if (res == NULL) {
1060 printk(KERN_ERR "failed to find memory resource for uart\n");
1061 return -EINVAL;
1062 }
1063
1064 dbg("resource %p (%lx..%lx)\n", res, res->start, res->end);
1065
1066 port->mapbase = res->start;
1067 port->membase = S3C24XX_VA_UART + (res->start - S3C24XX_PA_UART);
1068 ret = platform_get_irq(platdev, 0);
1069 if (ret < 0)
1070 port->irq = 0;
1071 else
1072 port->irq = ret;
1073
1074 ourport->clk = clk_get(&platdev->dev, "uart");
1075
1076 dbg("port: map=%08x, mem=%08x, irq=%d, clock=%ld\n",
1077 port->mapbase, port->membase, port->irq, port->uartclk);
1078
1079 /* reset the fifos (and setup the uart) */
1080 s3c24xx_serial_resetport(port, cfg);
1081 return 0;
1082}
1083
1084/* Device driver serial port probe */
1085
1086static int probe_index = 0;
1087
1088static int s3c24xx_serial_probe(struct platform_device *dev,
1089 struct s3c24xx_uart_info *info)
1090{
1091 struct s3c24xx_uart_port *ourport;
1092 int ret;
1093
1094 dbg("s3c24xx_serial_probe(%p, %p) %d\n", dev, info, probe_index);
1095
1096 ourport = &s3c24xx_serial_ports[probe_index];
1097 probe_index++;
1098
1099 dbg("%s: initialising port %p...\n", __func__, ourport);
1100
1101 ret = s3c24xx_serial_init_port(ourport, info, dev);
1102 if (ret < 0)
1103 goto probe_err;
1104
1105 dbg("%s: adding port\n", __func__);
1106 uart_add_one_port(&s3c24xx_uart_drv, &ourport->port);
1107 platform_set_drvdata(dev, &ourport->port);
1108
1109 return 0;
1110
1111 probe_err:
1112 return ret;
1113}
1114
1115static int s3c24xx_serial_remove(struct platform_device *dev)
1116{
1117 struct uart_port *port = s3c24xx_dev_to_port(&dev->dev);
1118
1119 if (port)
1120 uart_remove_one_port(&s3c24xx_uart_drv, port);
1121
1122 return 0;
1123}
1124
1125/* UART power management code */
1126
1127#ifdef CONFIG_PM
1128
1129static int s3c24xx_serial_suspend(struct platform_device *dev, pm_message_t state)
1130{
1131 struct uart_port *port = s3c24xx_dev_to_port(&dev->dev);
1132
1133 if (port)
1134 uart_suspend_port(&s3c24xx_uart_drv, port);
1135
1136 return 0;
1137}
1138
1139static int s3c24xx_serial_resume(struct platform_device *dev)
1140{
1141 struct uart_port *port = s3c24xx_dev_to_port(&dev->dev);
1142 struct s3c24xx_uart_port *ourport = to_ourport(port);
1143
1144 if (port) {
1145 clk_enable(ourport->clk);
1146 s3c24xx_serial_resetport(port, s3c24xx_port_to_cfg(port));
1147 clk_disable(ourport->clk);
1148
1149 uart_resume_port(&s3c24xx_uart_drv, port);
1150 }
1151
1152 return 0;
1153}
1154
1155#else
1156#define s3c24xx_serial_suspend NULL
1157#define s3c24xx_serial_resume NULL
1158#endif
1159
1160static int s3c24xx_serial_init(struct platform_driver *drv,
1161 struct s3c24xx_uart_info *info)
1162{
1163 dbg("s3c24xx_serial_init(%p,%p)\n", drv, info);
1164 return platform_driver_register(drv);
1165}
1166
1167
1168/* now comes the code to initialise either the s3c2410 or s3c2440 serial
1169 * port information
1170*/
1171
1172/* cpu specific variations on the serial port support */
1173
1174#ifdef CONFIG_CPU_S3C2400
1175
1176static int s3c2400_serial_getsource(struct uart_port *port,
1177 struct s3c24xx_uart_clksrc *clk)
1178{
1179 clk->divisor = 1;
1180 clk->name = "pclk";
1181
1182 return 0;
1183}
1184
1185static int s3c2400_serial_setsource(struct uart_port *port,
1186 struct s3c24xx_uart_clksrc *clk)
1187{
1188 return 0;
1189}
1190
1191static int s3c2400_serial_resetport(struct uart_port *port,
1192 struct s3c2410_uartcfg *cfg)
1193{
1194 dbg("s3c2400_serial_resetport: port=%p (%08lx), cfg=%p\n",
1195 port, port->mapbase, cfg);
1196
1197 wr_regl(port, S3C2410_UCON, cfg->ucon);
1198 wr_regl(port, S3C2410_ULCON, cfg->ulcon);
1199
1200 /* reset both fifos */
1201
1202 wr_regl(port, S3C2410_UFCON, cfg->ufcon | S3C2410_UFCON_RESETBOTH);
1203 wr_regl(port, S3C2410_UFCON, cfg->ufcon);
1204
1205 return 0;
1206}
1207
1208static struct s3c24xx_uart_info s3c2400_uart_inf = {
1209 .name = "Samsung S3C2400 UART",
1210 .type = PORT_S3C2400,
1211 .fifosize = 16,
1212 .rx_fifomask = S3C2410_UFSTAT_RXMASK,
1213 .rx_fifoshift = S3C2410_UFSTAT_RXSHIFT,
1214 .rx_fifofull = S3C2410_UFSTAT_RXFULL,
1215 .tx_fifofull = S3C2410_UFSTAT_TXFULL,
1216 .tx_fifomask = S3C2410_UFSTAT_TXMASK,
1217 .tx_fifoshift = S3C2410_UFSTAT_TXSHIFT,
1218 .get_clksrc = s3c2400_serial_getsource,
1219 .set_clksrc = s3c2400_serial_setsource,
1220 .reset_port = s3c2400_serial_resetport,
1221};
1222
1223static int s3c2400_serial_probe(struct platform_device *dev)
1224{
1225 return s3c24xx_serial_probe(dev, &s3c2400_uart_inf);
1226}
1227
1228static struct platform_driver s3c2400_serial_drv = {
1229 .probe = s3c2400_serial_probe,
1230 .remove = s3c24xx_serial_remove,
1231 .suspend = s3c24xx_serial_suspend,
1232 .resume = s3c24xx_serial_resume,
1233 .driver = {
1234 .name = "s3c2400-uart",
1235 .owner = THIS_MODULE,
1236 },
1237};
1238
1239static inline int s3c2400_serial_init(void)
1240{
1241 return s3c24xx_serial_init(&s3c2400_serial_drv, &s3c2400_uart_inf);
1242}
1243
1244static inline void s3c2400_serial_exit(void)
1245{
1246 platform_driver_unregister(&s3c2400_serial_drv);
1247}
1248
1249#define s3c2400_uart_inf_at &s3c2400_uart_inf
1250#else
1251
1252static inline int s3c2400_serial_init(void)
1253{
1254 return 0;
1255}
1256
1257static inline void s3c2400_serial_exit(void)
1258{
1259}
1260
1261#define s3c2400_uart_inf_at NULL
1262
1263#endif /* CONFIG_CPU_S3C2400 */
1264
1265/* S3C2410 support */
1266
1267#ifdef CONFIG_CPU_S3C2410
1268 28
1269static int s3c2410_serial_setsource(struct uart_port *port, 29static int s3c2410_serial_setsource(struct uart_port *port,
1270 struct s3c24xx_uart_clksrc *clk) 30 struct s3c24xx_uart_clksrc *clk)
@@ -1323,8 +83,6 @@ static struct s3c24xx_uart_info s3c2410_uart_inf = {
1323 .reset_port = s3c2410_serial_resetport, 83 .reset_port = s3c2410_serial_resetport,
1324}; 84};
1325 85
1326/* device management */
1327
1328static int s3c2410_serial_probe(struct platform_device *dev) 86static int s3c2410_serial_probe(struct platform_device *dev)
1329{ 87{
1330 return s3c24xx_serial_probe(dev, &s3c2410_uart_inf); 88 return s3c24xx_serial_probe(dev, &s3c2410_uart_inf);
@@ -1333,612 +91,28 @@ static int s3c2410_serial_probe(struct platform_device *dev)
1333static struct platform_driver s3c2410_serial_drv = { 91static struct platform_driver s3c2410_serial_drv = {
1334 .probe = s3c2410_serial_probe, 92 .probe = s3c2410_serial_probe,
1335 .remove = s3c24xx_serial_remove, 93 .remove = s3c24xx_serial_remove,
1336 .suspend = s3c24xx_serial_suspend,
1337 .resume = s3c24xx_serial_resume,
1338 .driver = { 94 .driver = {
1339 .name = "s3c2410-uart", 95 .name = "s3c2410-uart",
1340 .owner = THIS_MODULE, 96 .owner = THIS_MODULE,
1341 }, 97 },
1342}; 98};
1343 99
1344static inline int s3c2410_serial_init(void) 100s3c24xx_console_init(&s3c2410_serial_drv, &s3c2410_uart_inf);
101
102static int __init s3c2410_serial_init(void)
1345{ 103{
1346 return s3c24xx_serial_init(&s3c2410_serial_drv, &s3c2410_uart_inf); 104 return s3c24xx_serial_init(&s3c2410_serial_drv, &s3c2410_uart_inf);
1347} 105}
1348 106
1349static inline void s3c2410_serial_exit(void) 107static void __exit s3c2410_serial_exit(void)
1350{ 108{
1351 platform_driver_unregister(&s3c2410_serial_drv); 109 platform_driver_unregister(&s3c2410_serial_drv);
1352} 110}
1353 111
1354#define s3c2410_uart_inf_at &s3c2410_uart_inf 112module_init(s3c2410_serial_init);
1355#else 113module_exit(s3c2410_serial_exit);
1356
1357static inline int s3c2410_serial_init(void)
1358{
1359 return 0;
1360}
1361
1362static inline void s3c2410_serial_exit(void)
1363{
1364}
1365
1366#define s3c2410_uart_inf_at NULL
1367
1368#endif /* CONFIG_CPU_S3C2410 */
1369
1370#if defined(CONFIG_CPU_S3C2440) || defined(CONFIG_CPU_S3C2442)
1371
1372static int s3c2440_serial_setsource(struct uart_port *port,
1373 struct s3c24xx_uart_clksrc *clk)
1374{
1375 unsigned long ucon = rd_regl(port, S3C2410_UCON);
1376
1377 // todo - proper fclk<>nonfclk switch //
1378
1379 ucon &= ~S3C2440_UCON_CLKMASK;
1380
1381 if (strcmp(clk->name, "uclk") == 0)
1382 ucon |= S3C2440_UCON_UCLK;
1383 else if (strcmp(clk->name, "pclk") == 0)
1384 ucon |= S3C2440_UCON_PCLK;
1385 else if (strcmp(clk->name, "fclk") == 0)
1386 ucon |= S3C2440_UCON_FCLK;
1387 else {
1388 printk(KERN_ERR "unknown clock source %s\n", clk->name);
1389 return -EINVAL;
1390 }
1391
1392 wr_regl(port, S3C2410_UCON, ucon);
1393 return 0;
1394}
1395
1396
1397static int s3c2440_serial_getsource(struct uart_port *port,
1398 struct s3c24xx_uart_clksrc *clk)
1399{
1400 unsigned long ucon = rd_regl(port, S3C2410_UCON);
1401 unsigned long ucon0, ucon1, ucon2;
1402
1403 switch (ucon & S3C2440_UCON_CLKMASK) {
1404 case S3C2440_UCON_UCLK:
1405 clk->divisor = 1;
1406 clk->name = "uclk";
1407 break;
1408
1409 case S3C2440_UCON_PCLK:
1410 case S3C2440_UCON_PCLK2:
1411 clk->divisor = 1;
1412 clk->name = "pclk";
1413 break;
1414
1415 case S3C2440_UCON_FCLK:
1416 /* the fun of calculating the uart divisors on
1417 * the s3c2440 */
1418
1419 ucon0 = __raw_readl(S3C24XX_VA_UART0 + S3C2410_UCON);
1420 ucon1 = __raw_readl(S3C24XX_VA_UART1 + S3C2410_UCON);
1421 ucon2 = __raw_readl(S3C24XX_VA_UART2 + S3C2410_UCON);
1422
1423 printk("ucons: %08lx, %08lx, %08lx\n", ucon0, ucon1, ucon2);
1424
1425 ucon0 &= S3C2440_UCON0_DIVMASK;
1426 ucon1 &= S3C2440_UCON1_DIVMASK;
1427 ucon2 &= S3C2440_UCON2_DIVMASK;
1428
1429 if (ucon0 != 0) {
1430 clk->divisor = ucon0 >> S3C2440_UCON_DIVSHIFT;
1431 clk->divisor += 6;
1432 } else if (ucon1 != 0) {
1433 clk->divisor = ucon1 >> S3C2440_UCON_DIVSHIFT;
1434 clk->divisor += 21;
1435 } else if (ucon2 != 0) {
1436 clk->divisor = ucon2 >> S3C2440_UCON_DIVSHIFT;
1437 clk->divisor += 36;
1438 } else {
1439 /* manual calims 44, seems to be 9 */
1440 clk->divisor = 9;
1441 }
1442
1443 clk->name = "fclk";
1444 break;
1445 }
1446
1447 return 0;
1448}
1449
1450static int s3c2440_serial_resetport(struct uart_port *port,
1451 struct s3c2410_uartcfg *cfg)
1452{
1453 unsigned long ucon = rd_regl(port, S3C2410_UCON);
1454
1455 dbg("s3c2440_serial_resetport: port=%p (%08lx), cfg=%p\n",
1456 port, port->mapbase, cfg);
1457
1458 /* ensure we don't change the clock settings... */
1459
1460 ucon &= (S3C2440_UCON0_DIVMASK | (3<<10));
1461
1462 wr_regl(port, S3C2410_UCON, ucon | cfg->ucon);
1463 wr_regl(port, S3C2410_ULCON, cfg->ulcon);
1464
1465 /* reset both fifos */
1466
1467 wr_regl(port, S3C2410_UFCON, cfg->ufcon | S3C2410_UFCON_RESETBOTH);
1468 wr_regl(port, S3C2410_UFCON, cfg->ufcon);
1469
1470 return 0;
1471}
1472
1473static struct s3c24xx_uart_info s3c2440_uart_inf = {
1474 .name = "Samsung S3C2440 UART",
1475 .type = PORT_S3C2440,
1476 .fifosize = 64,
1477 .rx_fifomask = S3C2440_UFSTAT_RXMASK,
1478 .rx_fifoshift = S3C2440_UFSTAT_RXSHIFT,
1479 .rx_fifofull = S3C2440_UFSTAT_RXFULL,
1480 .tx_fifofull = S3C2440_UFSTAT_TXFULL,
1481 .tx_fifomask = S3C2440_UFSTAT_TXMASK,
1482 .tx_fifoshift = S3C2440_UFSTAT_TXSHIFT,
1483 .get_clksrc = s3c2440_serial_getsource,
1484 .set_clksrc = s3c2440_serial_setsource,
1485 .reset_port = s3c2440_serial_resetport,
1486};
1487
1488/* device management */
1489
1490static int s3c2440_serial_probe(struct platform_device *dev)
1491{
1492 dbg("s3c2440_serial_probe: dev=%p\n", dev);
1493 return s3c24xx_serial_probe(dev, &s3c2440_uart_inf);
1494}
1495
1496static struct platform_driver s3c2440_serial_drv = {
1497 .probe = s3c2440_serial_probe,
1498 .remove = s3c24xx_serial_remove,
1499 .suspend = s3c24xx_serial_suspend,
1500 .resume = s3c24xx_serial_resume,
1501 .driver = {
1502 .name = "s3c2440-uart",
1503 .owner = THIS_MODULE,
1504 },
1505};
1506
1507
1508static inline int s3c2440_serial_init(void)
1509{
1510 return s3c24xx_serial_init(&s3c2440_serial_drv, &s3c2440_uart_inf);
1511}
1512
1513static inline void s3c2440_serial_exit(void)
1514{
1515 platform_driver_unregister(&s3c2440_serial_drv);
1516}
1517
1518#define s3c2440_uart_inf_at &s3c2440_uart_inf
1519#else
1520
1521static inline int s3c2440_serial_init(void)
1522{
1523 return 0;
1524}
1525
1526static inline void s3c2440_serial_exit(void)
1527{
1528}
1529
1530#define s3c2440_uart_inf_at NULL
1531#endif /* CONFIG_CPU_S3C2440 */
1532
1533#if defined(CONFIG_CPU_S3C2412)
1534
1535static int s3c2412_serial_setsource(struct uart_port *port,
1536 struct s3c24xx_uart_clksrc *clk)
1537{
1538 unsigned long ucon = rd_regl(port, S3C2410_UCON);
1539
1540 ucon &= ~S3C2412_UCON_CLKMASK;
1541
1542 if (strcmp(clk->name, "uclk") == 0)
1543 ucon |= S3C2440_UCON_UCLK;
1544 else if (strcmp(clk->name, "pclk") == 0)
1545 ucon |= S3C2440_UCON_PCLK;
1546 else if (strcmp(clk->name, "usysclk") == 0)
1547 ucon |= S3C2412_UCON_USYSCLK;
1548 else {
1549 printk(KERN_ERR "unknown clock source %s\n", clk->name);
1550 return -EINVAL;
1551 }
1552
1553 wr_regl(port, S3C2410_UCON, ucon);
1554 return 0;
1555}
1556
1557
1558static int s3c2412_serial_getsource(struct uart_port *port,
1559 struct s3c24xx_uart_clksrc *clk)
1560{
1561 unsigned long ucon = rd_regl(port, S3C2410_UCON);
1562
1563 switch (ucon & S3C2412_UCON_CLKMASK) {
1564 case S3C2412_UCON_UCLK:
1565 clk->divisor = 1;
1566 clk->name = "uclk";
1567 break;
1568
1569 case S3C2412_UCON_PCLK:
1570 case S3C2412_UCON_PCLK2:
1571 clk->divisor = 1;
1572 clk->name = "pclk";
1573 break;
1574
1575 case S3C2412_UCON_USYSCLK:
1576 clk->divisor = 1;
1577 clk->name = "usysclk";
1578 break;
1579 }
1580
1581 return 0;
1582}
1583
1584static int s3c2412_serial_resetport(struct uart_port *port,
1585 struct s3c2410_uartcfg *cfg)
1586{
1587 unsigned long ucon = rd_regl(port, S3C2410_UCON);
1588
1589 dbg("%s: port=%p (%08lx), cfg=%p\n",
1590 __func__, port, port->mapbase, cfg);
1591
1592 /* ensure we don't change the clock settings... */
1593
1594 ucon &= S3C2412_UCON_CLKMASK;
1595
1596 wr_regl(port, S3C2410_UCON, ucon | cfg->ucon);
1597 wr_regl(port, S3C2410_ULCON, cfg->ulcon);
1598
1599 /* reset both fifos */
1600
1601 wr_regl(port, S3C2410_UFCON, cfg->ufcon | S3C2410_UFCON_RESETBOTH);
1602 wr_regl(port, S3C2410_UFCON, cfg->ufcon);
1603
1604 return 0;
1605}
1606
1607static struct s3c24xx_uart_info s3c2412_uart_inf = {
1608 .name = "Samsung S3C2412 UART",
1609 .type = PORT_S3C2412,
1610 .fifosize = 64,
1611 .rx_fifomask = S3C2440_UFSTAT_RXMASK,
1612 .rx_fifoshift = S3C2440_UFSTAT_RXSHIFT,
1613 .rx_fifofull = S3C2440_UFSTAT_RXFULL,
1614 .tx_fifofull = S3C2440_UFSTAT_TXFULL,
1615 .tx_fifomask = S3C2440_UFSTAT_TXMASK,
1616 .tx_fifoshift = S3C2440_UFSTAT_TXSHIFT,
1617 .get_clksrc = s3c2412_serial_getsource,
1618 .set_clksrc = s3c2412_serial_setsource,
1619 .reset_port = s3c2412_serial_resetport,
1620};
1621
1622/* device management */
1623
1624static int s3c2412_serial_probe(struct platform_device *dev)
1625{
1626 dbg("s3c2440_serial_probe: dev=%p\n", dev);
1627 return s3c24xx_serial_probe(dev, &s3c2412_uart_inf);
1628}
1629
1630static struct platform_driver s3c2412_serial_drv = {
1631 .probe = s3c2412_serial_probe,
1632 .remove = s3c24xx_serial_remove,
1633 .suspend = s3c24xx_serial_suspend,
1634 .resume = s3c24xx_serial_resume,
1635 .driver = {
1636 .name = "s3c2412-uart",
1637 .owner = THIS_MODULE,
1638 },
1639};
1640
1641
1642static inline int s3c2412_serial_init(void)
1643{
1644 return s3c24xx_serial_init(&s3c2412_serial_drv, &s3c2412_uart_inf);
1645}
1646
1647static inline void s3c2412_serial_exit(void)
1648{
1649 platform_driver_unregister(&s3c2412_serial_drv);
1650}
1651
1652#define s3c2412_uart_inf_at &s3c2412_uart_inf
1653#else
1654
1655static inline int s3c2412_serial_init(void)
1656{
1657 return 0;
1658}
1659
1660static inline void s3c2412_serial_exit(void)
1661{
1662}
1663
1664#define s3c2412_uart_inf_at NULL
1665#endif /* CONFIG_CPU_S3C2440 */
1666
1667
1668/* module initialisation code */
1669
1670static int __init s3c24xx_serial_modinit(void)
1671{
1672 int ret;
1673
1674 ret = uart_register_driver(&s3c24xx_uart_drv);
1675 if (ret < 0) {
1676 printk(KERN_ERR "failed to register UART driver\n");
1677 return -1;
1678 }
1679
1680 s3c2400_serial_init();
1681 s3c2410_serial_init();
1682 s3c2412_serial_init();
1683 s3c2440_serial_init();
1684
1685 return 0;
1686}
1687
1688static void __exit s3c24xx_serial_modexit(void)
1689{
1690 s3c2400_serial_exit();
1691 s3c2410_serial_exit();
1692 s3c2412_serial_exit();
1693 s3c2440_serial_exit();
1694
1695 uart_unregister_driver(&s3c24xx_uart_drv);
1696}
1697
1698
1699module_init(s3c24xx_serial_modinit);
1700module_exit(s3c24xx_serial_modexit);
1701
1702/* Console code */
1703
1704#ifdef CONFIG_SERIAL_S3C2410_CONSOLE
1705
1706static struct uart_port *cons_uart;
1707
1708static int
1709s3c24xx_serial_console_txrdy(struct uart_port *port, unsigned int ufcon)
1710{
1711 struct s3c24xx_uart_info *info = s3c24xx_port_to_info(port);
1712 unsigned long ufstat, utrstat;
1713
1714 if (ufcon & S3C2410_UFCON_FIFOMODE) {
1715 /* fifo mode - check ammount of data in fifo registers... */
1716
1717 ufstat = rd_regl(port, S3C2410_UFSTAT);
1718 return (ufstat & info->tx_fifofull) ? 0 : 1;
1719 }
1720
1721 /* in non-fifo mode, we go and use the tx buffer empty */
1722
1723 utrstat = rd_regl(port, S3C2410_UTRSTAT);
1724 return (utrstat & S3C2410_UTRSTAT_TXE) ? 1 : 0;
1725}
1726
1727static void
1728s3c24xx_serial_console_putchar(struct uart_port *port, int ch)
1729{
1730 unsigned int ufcon = rd_regl(cons_uart, S3C2410_UFCON);
1731 while (!s3c24xx_serial_console_txrdy(port, ufcon))
1732 barrier();
1733 wr_regb(cons_uart, S3C2410_UTXH, ch);
1734}
1735
1736static void
1737s3c24xx_serial_console_write(struct console *co, const char *s,
1738 unsigned int count)
1739{
1740 uart_console_write(cons_uart, s, count, s3c24xx_serial_console_putchar);
1741}
1742
1743static void __init
1744s3c24xx_serial_get_options(struct uart_port *port, int *baud,
1745 int *parity, int *bits)
1746{
1747 struct s3c24xx_uart_clksrc clksrc;
1748 struct clk *clk;
1749 unsigned int ulcon;
1750 unsigned int ucon;
1751 unsigned int ubrdiv;
1752 unsigned long rate;
1753
1754 ulcon = rd_regl(port, S3C2410_ULCON);
1755 ucon = rd_regl(port, S3C2410_UCON);
1756 ubrdiv = rd_regl(port, S3C2410_UBRDIV);
1757
1758 dbg("s3c24xx_serial_get_options: port=%p\n"
1759 "registers: ulcon=%08x, ucon=%08x, ubdriv=%08x\n",
1760 port, ulcon, ucon, ubrdiv);
1761
1762 if ((ucon & 0xf) != 0) {
1763 /* consider the serial port configured if the tx/rx mode set */
1764
1765 switch (ulcon & S3C2410_LCON_CSMASK) {
1766 case S3C2410_LCON_CS5:
1767 *bits = 5;
1768 break;
1769 case S3C2410_LCON_CS6:
1770 *bits = 6;
1771 break;
1772 case S3C2410_LCON_CS7:
1773 *bits = 7;
1774 break;
1775 default:
1776 case S3C2410_LCON_CS8:
1777 *bits = 8;
1778 break;
1779 }
1780
1781 switch (ulcon & S3C2410_LCON_PMASK) {
1782 case S3C2410_LCON_PEVEN:
1783 *parity = 'e';
1784 break;
1785
1786 case S3C2410_LCON_PODD:
1787 *parity = 'o';
1788 break;
1789
1790 case S3C2410_LCON_PNONE:
1791 default:
1792 *parity = 'n';
1793 }
1794
1795 /* now calculate the baud rate */
1796
1797 s3c24xx_serial_getsource(port, &clksrc);
1798
1799 clk = clk_get(port->dev, clksrc.name);
1800 if (!IS_ERR(clk) && clk != NULL)
1801 rate = clk_get_rate(clk) / clksrc.divisor;
1802 else
1803 rate = 1;
1804
1805
1806 *baud = rate / ( 16 * (ubrdiv + 1));
1807 dbg("calculated baud %d\n", *baud);
1808 }
1809
1810}
1811
1812/* s3c24xx_serial_init_ports
1813 *
1814 * initialise the serial ports from the machine provided initialisation
1815 * data.
1816*/
1817
1818static int s3c24xx_serial_init_ports(struct s3c24xx_uart_info *info)
1819{
1820 struct s3c24xx_uart_port *ptr = s3c24xx_serial_ports;
1821 struct platform_device **platdev_ptr;
1822 int i;
1823
1824 dbg("s3c24xx_serial_init_ports: initialising ports...\n");
1825
1826 platdev_ptr = s3c24xx_uart_devs;
1827
1828 for (i = 0; i < NR_PORTS; i++, ptr++, platdev_ptr++) {
1829 s3c24xx_serial_init_port(ptr, info, *platdev_ptr);
1830 }
1831
1832 return 0;
1833}
1834
1835static int __init
1836s3c24xx_serial_console_setup(struct console *co, char *options)
1837{
1838 struct uart_port *port;
1839 int baud = 9600;
1840 int bits = 8;
1841 int parity = 'n';
1842 int flow = 'n';
1843
1844 dbg("s3c24xx_serial_console_setup: co=%p (%d), %s\n",
1845 co, co->index, options);
1846
1847 /* is this a valid port */
1848
1849 if (co->index == -1 || co->index >= NR_PORTS)
1850 co->index = 0;
1851
1852 port = &s3c24xx_serial_ports[co->index].port;
1853
1854 /* is the port configured? */
1855
1856 if (port->mapbase == 0x0) {
1857 co->index = 0;
1858 port = &s3c24xx_serial_ports[co->index].port;
1859 }
1860
1861 cons_uart = port;
1862
1863 dbg("s3c24xx_serial_console_setup: port=%p (%d)\n", port, co->index);
1864
1865 /*
1866 * Check whether an invalid uart number has been specified, and
1867 * if so, search for the first available port that does have
1868 * console support.
1869 */
1870 if (options)
1871 uart_parse_options(options, &baud, &parity, &bits, &flow);
1872 else
1873 s3c24xx_serial_get_options(port, &baud, &parity, &bits);
1874
1875 dbg("s3c24xx_serial_console_setup: baud %d\n", baud);
1876
1877 return uart_set_options(port, co, baud, parity, bits, flow);
1878}
1879
1880/* s3c24xx_serial_initconsole
1881 *
1882 * initialise the console from one of the uart drivers
1883*/
1884
1885static struct console s3c24xx_serial_console =
1886{
1887 .name = S3C24XX_SERIAL_NAME,
1888 .device = uart_console_device,
1889 .flags = CON_PRINTBUFFER,
1890 .index = -1,
1891 .write = s3c24xx_serial_console_write,
1892 .setup = s3c24xx_serial_console_setup
1893};
1894
1895static int s3c24xx_serial_initconsole(void)
1896{
1897 struct s3c24xx_uart_info *info;
1898 struct platform_device *dev = s3c24xx_uart_devs[0];
1899
1900 dbg("s3c24xx_serial_initconsole\n");
1901
1902 /* select driver based on the cpu */
1903
1904 if (dev == NULL) {
1905 printk(KERN_ERR "s3c24xx: no devices for console init\n");
1906 return 0;
1907 }
1908
1909 if (strcmp(dev->name, "s3c2400-uart") == 0) {
1910 info = s3c2400_uart_inf_at;
1911 } else if (strcmp(dev->name, "s3c2410-uart") == 0) {
1912 info = s3c2410_uart_inf_at;
1913 } else if (strcmp(dev->name, "s3c2440-uart") == 0) {
1914 info = s3c2440_uart_inf_at;
1915 } else if (strcmp(dev->name, "s3c2412-uart") == 0) {
1916 info = s3c2412_uart_inf_at;
1917 } else {
1918 printk(KERN_ERR "s3c24xx: no driver for %s\n", dev->name);
1919 return 0;
1920 }
1921
1922 if (info == NULL) {
1923 printk(KERN_ERR "s3c24xx: no driver for console\n");
1924 return 0;
1925 }
1926
1927 s3c24xx_serial_console.data = &s3c24xx_uart_drv;
1928 s3c24xx_serial_init_ports(info);
1929
1930 register_console(&s3c24xx_serial_console);
1931 return 0;
1932}
1933
1934console_initcall(s3c24xx_serial_initconsole);
1935
1936#endif /* CONFIG_SERIAL_S3C2410_CONSOLE */
1937 114
1938MODULE_LICENSE("GPL"); 115MODULE_LICENSE("GPL v2");
1939MODULE_AUTHOR("Ben Dooks <ben@simtec.co.uk>"); 116MODULE_AUTHOR("Ben Dooks <ben@simtec.co.uk>");
1940MODULE_DESCRIPTION("Samsung S3C2410/S3C2440/S3C2412 Serial port driver"); 117MODULE_DESCRIPTION("Samsung S3C2410 SoC Serial port driver");
1941MODULE_ALIAS("platform:s3c2400-uart");
1942MODULE_ALIAS("platform:s3c2410-uart"); 118MODULE_ALIAS("platform:s3c2410-uart");
1943MODULE_ALIAS("platform:s3c2412-uart");
1944MODULE_ALIAS("platform:s3c2440-uart");
diff --git a/drivers/serial/s3c2412.c b/drivers/serial/s3c2412.c
new file mode 100644
index 000000000000..ce0c220e3e92
--- /dev/null
+++ b/drivers/serial/s3c2412.c
@@ -0,0 +1,151 @@
1/* linux/drivers/serial/s3c2412.c
2 *
3 * Driver for Samsung S3C2412 and S3C2413 SoC onboard UARTs.
4 *
5 * Ben Dooks, Copyright (c) 2003-2005,2008 Simtec Electronics
6 * http://armlinux.simtec.co.uk/
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#include <linux/module.h>
14#include <linux/ioport.h>
15#include <linux/io.h>
16#include <linux/platform_device.h>
17#include <linux/init.h>
18#include <linux/serial_core.h>
19#include <linux/serial.h>
20
21#include <asm/irq.h>
22#include <asm/hardware.h>
23
24#include <asm/plat-s3c/regs-serial.h>
25#include <asm/arch/regs-gpio.h>
26
27#include "samsung.h"
28
29static int s3c2412_serial_setsource(struct uart_port *port,
30 struct s3c24xx_uart_clksrc *clk)
31{
32 unsigned long ucon = rd_regl(port, S3C2410_UCON);
33
34 ucon &= ~S3C2412_UCON_CLKMASK;
35
36 if (strcmp(clk->name, "uclk") == 0)
37 ucon |= S3C2440_UCON_UCLK;
38 else if (strcmp(clk->name, "pclk") == 0)
39 ucon |= S3C2440_UCON_PCLK;
40 else if (strcmp(clk->name, "usysclk") == 0)
41 ucon |= S3C2412_UCON_USYSCLK;
42 else {
43 printk(KERN_ERR "unknown clock source %s\n", clk->name);
44 return -EINVAL;
45 }
46
47 wr_regl(port, S3C2410_UCON, ucon);
48 return 0;
49}
50
51
52static int s3c2412_serial_getsource(struct uart_port *port,
53 struct s3c24xx_uart_clksrc *clk)
54{
55 unsigned long ucon = rd_regl(port, S3C2410_UCON);
56
57 switch (ucon & S3C2412_UCON_CLKMASK) {
58 case S3C2412_UCON_UCLK:
59 clk->divisor = 1;
60 clk->name = "uclk";
61 break;
62
63 case S3C2412_UCON_PCLK:
64 case S3C2412_UCON_PCLK2:
65 clk->divisor = 1;
66 clk->name = "pclk";
67 break;
68
69 case S3C2412_UCON_USYSCLK:
70 clk->divisor = 1;
71 clk->name = "usysclk";
72 break;
73 }
74
75 return 0;
76}
77
78static int s3c2412_serial_resetport(struct uart_port *port,
79 struct s3c2410_uartcfg *cfg)
80{
81 unsigned long ucon = rd_regl(port, S3C2410_UCON);
82
83 dbg("%s: port=%p (%08lx), cfg=%p\n",
84 __func__, port, port->mapbase, cfg);
85
86 /* ensure we don't change the clock settings... */
87
88 ucon &= S3C2412_UCON_CLKMASK;
89
90 wr_regl(port, S3C2410_UCON, ucon | cfg->ucon);
91 wr_regl(port, S3C2410_ULCON, cfg->ulcon);
92
93 /* reset both fifos */
94
95 wr_regl(port, S3C2410_UFCON, cfg->ufcon | S3C2410_UFCON_RESETBOTH);
96 wr_regl(port, S3C2410_UFCON, cfg->ufcon);
97
98 return 0;
99}
100
101static struct s3c24xx_uart_info s3c2412_uart_inf = {
102 .name = "Samsung S3C2412 UART",
103 .type = PORT_S3C2412,
104 .fifosize = 64,
105 .rx_fifomask = S3C2440_UFSTAT_RXMASK,
106 .rx_fifoshift = S3C2440_UFSTAT_RXSHIFT,
107 .rx_fifofull = S3C2440_UFSTAT_RXFULL,
108 .tx_fifofull = S3C2440_UFSTAT_TXFULL,
109 .tx_fifomask = S3C2440_UFSTAT_TXMASK,
110 .tx_fifoshift = S3C2440_UFSTAT_TXSHIFT,
111 .get_clksrc = s3c2412_serial_getsource,
112 .set_clksrc = s3c2412_serial_setsource,
113 .reset_port = s3c2412_serial_resetport,
114};
115
116/* device management */
117
118static int s3c2412_serial_probe(struct platform_device *dev)
119{
120 dbg("s3c2440_serial_probe: dev=%p\n", dev);
121 return s3c24xx_serial_probe(dev, &s3c2412_uart_inf);
122}
123
124static struct platform_driver s3c2412_serial_drv = {
125 .probe = s3c2412_serial_probe,
126 .remove = s3c24xx_serial_remove,
127 .driver = {
128 .name = "s3c2412-uart",
129 .owner = THIS_MODULE,
130 },
131};
132
133s3c24xx_console_init(&s3c2412_serial_drv, &s3c2412_uart_inf);
134
135static inline int s3c2412_serial_init(void)
136{
137 return s3c24xx_serial_init(&s3c2412_serial_drv, &s3c2412_uart_inf);
138}
139
140static inline void s3c2412_serial_exit(void)
141{
142 platform_driver_unregister(&s3c2412_serial_drv);
143}
144
145module_init(s3c2412_serial_init);
146module_exit(s3c2412_serial_exit);
147
148MODULE_DESCRIPTION("Samsung S3C2412,S3C2413 SoC Serial port driver");
149MODULE_AUTHOR("Ben Dooks <ben@simtec.co.uk>");
150MODULE_LICENSE("GPL v2");
151MODULE_ALIAS("platform:s3c2412-uart");
diff --git a/drivers/serial/s3c2440.c b/drivers/serial/s3c2440.c
new file mode 100644
index 000000000000..38f954bd39c6
--- /dev/null
+++ b/drivers/serial/s3c2440.c
@@ -0,0 +1,181 @@
1/* linux/drivers/serial/s3c2440.c
2 *
3 * Driver for Samsung S3C2440 and S3C2442 SoC onboard UARTs.
4 *
5 * Ben Dooks, Copyright (c) 2003-2005,2008 Simtec Electronics
6 * http://armlinux.simtec.co.uk/
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#include <linux/module.h>
14#include <linux/ioport.h>
15#include <linux/io.h>
16#include <linux/platform_device.h>
17#include <linux/init.h>
18#include <linux/serial_core.h>
19#include <linux/serial.h>
20
21#include <asm/irq.h>
22#include <asm/hardware.h>
23
24#include <asm/plat-s3c/regs-serial.h>
25#include <asm/arch/regs-gpio.h>
26
27#include "samsung.h"
28
29
30static int s3c2440_serial_setsource(struct uart_port *port,
31 struct s3c24xx_uart_clksrc *clk)
32{
33 unsigned long ucon = rd_regl(port, S3C2410_UCON);
34
35 /* todo - proper fclk<>nonfclk switch. */
36
37 ucon &= ~S3C2440_UCON_CLKMASK;
38
39 if (strcmp(clk->name, "uclk") == 0)
40 ucon |= S3C2440_UCON_UCLK;
41 else if (strcmp(clk->name, "pclk") == 0)
42 ucon |= S3C2440_UCON_PCLK;
43 else if (strcmp(clk->name, "fclk") == 0)
44 ucon |= S3C2440_UCON_FCLK;
45 else {
46 printk(KERN_ERR "unknown clock source %s\n", clk->name);
47 return -EINVAL;
48 }
49
50 wr_regl(port, S3C2410_UCON, ucon);
51 return 0;
52}
53
54
55static int s3c2440_serial_getsource(struct uart_port *port,
56 struct s3c24xx_uart_clksrc *clk)
57{
58 unsigned long ucon = rd_regl(port, S3C2410_UCON);
59 unsigned long ucon0, ucon1, ucon2;
60
61 switch (ucon & S3C2440_UCON_CLKMASK) {
62 case S3C2440_UCON_UCLK:
63 clk->divisor = 1;
64 clk->name = "uclk";
65 break;
66
67 case S3C2440_UCON_PCLK:
68 case S3C2440_UCON_PCLK2:
69 clk->divisor = 1;
70 clk->name = "pclk";
71 break;
72
73 case S3C2440_UCON_FCLK:
74 /* the fun of calculating the uart divisors on
75 * the s3c2440 */
76
77 ucon0 = __raw_readl(S3C24XX_VA_UART0 + S3C2410_UCON);
78 ucon1 = __raw_readl(S3C24XX_VA_UART1 + S3C2410_UCON);
79 ucon2 = __raw_readl(S3C24XX_VA_UART2 + S3C2410_UCON);
80
81 printk("ucons: %08lx, %08lx, %08lx\n", ucon0, ucon1, ucon2);
82
83 ucon0 &= S3C2440_UCON0_DIVMASK;
84 ucon1 &= S3C2440_UCON1_DIVMASK;
85 ucon2 &= S3C2440_UCON2_DIVMASK;
86
87 if (ucon0 != 0) {
88 clk->divisor = ucon0 >> S3C2440_UCON_DIVSHIFT;
89 clk->divisor += 6;
90 } else if (ucon1 != 0) {
91 clk->divisor = ucon1 >> S3C2440_UCON_DIVSHIFT;
92 clk->divisor += 21;
93 } else if (ucon2 != 0) {
94 clk->divisor = ucon2 >> S3C2440_UCON_DIVSHIFT;
95 clk->divisor += 36;
96 } else {
97 /* manual calims 44, seems to be 9 */
98 clk->divisor = 9;
99 }
100
101 clk->name = "fclk";
102 break;
103 }
104
105 return 0;
106}
107
108static int s3c2440_serial_resetport(struct uart_port *port,
109 struct s3c2410_uartcfg *cfg)
110{
111 unsigned long ucon = rd_regl(port, S3C2410_UCON);
112
113 dbg("s3c2440_serial_resetport: port=%p (%08lx), cfg=%p\n",
114 port, port->mapbase, cfg);
115
116 /* ensure we don't change the clock settings... */
117
118 ucon &= (S3C2440_UCON0_DIVMASK | (3<<10));
119
120 wr_regl(port, S3C2410_UCON, ucon | cfg->ucon);
121 wr_regl(port, S3C2410_ULCON, cfg->ulcon);
122
123 /* reset both fifos */
124
125 wr_regl(port, S3C2410_UFCON, cfg->ufcon | S3C2410_UFCON_RESETBOTH);
126 wr_regl(port, S3C2410_UFCON, cfg->ufcon);
127
128 return 0;
129}
130
131static struct s3c24xx_uart_info s3c2440_uart_inf = {
132 .name = "Samsung S3C2440 UART",
133 .type = PORT_S3C2440,
134 .fifosize = 64,
135 .rx_fifomask = S3C2440_UFSTAT_RXMASK,
136 .rx_fifoshift = S3C2440_UFSTAT_RXSHIFT,
137 .rx_fifofull = S3C2440_UFSTAT_RXFULL,
138 .tx_fifofull = S3C2440_UFSTAT_TXFULL,
139 .tx_fifomask = S3C2440_UFSTAT_TXMASK,
140 .tx_fifoshift = S3C2440_UFSTAT_TXSHIFT,
141 .get_clksrc = s3c2440_serial_getsource,
142 .set_clksrc = s3c2440_serial_setsource,
143 .reset_port = s3c2440_serial_resetport,
144};
145
146/* device management */
147
148static int s3c2440_serial_probe(struct platform_device *dev)
149{
150 dbg("s3c2440_serial_probe: dev=%p\n", dev);
151 return s3c24xx_serial_probe(dev, &s3c2440_uart_inf);
152}
153
154static struct platform_driver s3c2440_serial_drv = {
155 .probe = s3c2440_serial_probe,
156 .remove = s3c24xx_serial_remove,
157 .driver = {
158 .name = "s3c2440-uart",
159 .owner = THIS_MODULE,
160 },
161};
162
163s3c24xx_console_init(&s3c2440_serial_drv, &s3c2440_uart_inf);
164
165static int __init s3c2440_serial_init(void)
166{
167 return s3c24xx_serial_init(&s3c2440_serial_drv, &s3c2440_uart_inf);
168}
169
170static void __exit s3c2440_serial_exit(void)
171{
172 platform_driver_unregister(&s3c2440_serial_drv);
173}
174
175module_init(s3c2440_serial_init);
176module_exit(s3c2440_serial_exit);
177
178MODULE_DESCRIPTION("Samsung S3C2440,S3C2442 SoC Serial port driver");
179MODULE_AUTHOR("Ben Dooks <ben@simtec.co.uk>");
180MODULE_LICENSE("GPLi v2");
181MODULE_ALIAS("platform:s3c2440-uart");
diff --git a/drivers/serial/samsung.c b/drivers/serial/samsung.c
new file mode 100644
index 000000000000..4a3ecaa629e6
--- /dev/null
+++ b/drivers/serial/samsung.c
@@ -0,0 +1,1317 @@
1/* linux/drivers/serial/samsuing.c
2 *
3 * Driver core for Samsung SoC onboard UARTs.
4 *
5 * Ben Dooks, Copyright (c) 2003-2005,2008 Simtec Electronics
6 * http://armlinux.simtec.co.uk/
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/* Hote on 2410 error handling
14 *
15 * The s3c2410 manual has a love/hate affair with the contents of the
16 * UERSTAT register in the UART blocks, and keeps marking some of the
17 * error bits as reserved. Having checked with the s3c2410x01,
18 * it copes with BREAKs properly, so I am happy to ignore the RESERVED
19 * feature from the latter versions of the manual.
20 *
21 * If it becomes aparrent that latter versions of the 2410 remove these
22 * bits, then action will have to be taken to differentiate the versions
23 * and change the policy on BREAK
24 *
25 * BJD, 04-Nov-2004
26*/
27
28#if defined(CONFIG_SERIAL_SAMSUNG_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
29#define SUPPORT_SYSRQ
30#endif
31
32#include <linux/module.h>
33#include <linux/ioport.h>
34#include <linux/io.h>
35#include <linux/platform_device.h>
36#include <linux/init.h>
37#include <linux/sysrq.h>
38#include <linux/console.h>
39#include <linux/tty.h>
40#include <linux/tty_flip.h>
41#include <linux/serial_core.h>
42#include <linux/serial.h>
43#include <linux/delay.h>
44#include <linux/clk.h>
45
46#include <asm/irq.h>
47
48#include <asm/hardware.h>
49
50#include <asm/plat-s3c/regs-serial.h>
51#include <asm/arch/regs-gpio.h>
52
53#include "samsung.h"
54
55/* UART name and device definitions */
56
57#define S3C24XX_SERIAL_NAME "ttySAC"
58#define S3C24XX_SERIAL_MAJOR 204
59#define S3C24XX_SERIAL_MINOR 64
60
61/* we can support 3 uarts, but not always use them */
62
63#ifdef CONFIG_CPU_S3C2400
64#define NR_PORTS (2)
65#else
66#define NR_PORTS (3)
67#endif
68
69/* port irq numbers */
70
71#define TX_IRQ(port) ((port)->irq + 1)
72#define RX_IRQ(port) ((port)->irq)
73
74/* macros to change one thing to another */
75
76#define tx_enabled(port) ((port)->unused[0])
77#define rx_enabled(port) ((port)->unused[1])
78
79/* flag to ignore all characters comming in */
80#define RXSTAT_DUMMY_READ (0x10000000)
81
82static inline struct s3c24xx_uart_port *to_ourport(struct uart_port *port)
83{
84 return container_of(port, struct s3c24xx_uart_port, port);
85}
86
87/* translate a port to the device name */
88
89static inline const char *s3c24xx_serial_portname(struct uart_port *port)
90{
91 return to_platform_device(port->dev)->name;
92}
93
94static int s3c24xx_serial_txempty_nofifo(struct uart_port *port)
95{
96 return (rd_regl(port, S3C2410_UTRSTAT) & S3C2410_UTRSTAT_TXE);
97}
98
99static void s3c24xx_serial_rx_enable(struct uart_port *port)
100{
101 unsigned long flags;
102 unsigned int ucon, ufcon;
103 int count = 10000;
104
105 spin_lock_irqsave(&port->lock, flags);
106
107 while (--count && !s3c24xx_serial_txempty_nofifo(port))
108 udelay(100);
109
110 ufcon = rd_regl(port, S3C2410_UFCON);
111 ufcon |= S3C2410_UFCON_RESETRX;
112 wr_regl(port, S3C2410_UFCON, ufcon);
113
114 ucon = rd_regl(port, S3C2410_UCON);
115 ucon |= S3C2410_UCON_RXIRQMODE;
116 wr_regl(port, S3C2410_UCON, ucon);
117
118 rx_enabled(port) = 1;
119 spin_unlock_irqrestore(&port->lock, flags);
120}
121
122static void s3c24xx_serial_rx_disable(struct uart_port *port)
123{
124 unsigned long flags;
125 unsigned int ucon;
126
127 spin_lock_irqsave(&port->lock, flags);
128
129 ucon = rd_regl(port, S3C2410_UCON);
130 ucon &= ~S3C2410_UCON_RXIRQMODE;
131 wr_regl(port, S3C2410_UCON, ucon);
132
133 rx_enabled(port) = 0;
134 spin_unlock_irqrestore(&port->lock, flags);
135}
136
137static void s3c24xx_serial_stop_tx(struct uart_port *port)
138{
139 if (tx_enabled(port)) {
140 disable_irq(TX_IRQ(port));
141 tx_enabled(port) = 0;
142 if (port->flags & UPF_CONS_FLOW)
143 s3c24xx_serial_rx_enable(port);
144 }
145}
146
147static void s3c24xx_serial_start_tx(struct uart_port *port)
148{
149 if (!tx_enabled(port)) {
150 if (port->flags & UPF_CONS_FLOW)
151 s3c24xx_serial_rx_disable(port);
152
153 enable_irq(TX_IRQ(port));
154 tx_enabled(port) = 1;
155 }
156}
157
158
159static void s3c24xx_serial_stop_rx(struct uart_port *port)
160{
161 if (rx_enabled(port)) {
162 dbg("s3c24xx_serial_stop_rx: port=%p\n", port);
163 disable_irq(RX_IRQ(port));
164 rx_enabled(port) = 0;
165 }
166}
167
168static void s3c24xx_serial_enable_ms(struct uart_port *port)
169{
170}
171
172static inline struct s3c24xx_uart_info *s3c24xx_port_to_info(struct uart_port *port)
173{
174 return to_ourport(port)->info;
175}
176
177static inline struct s3c2410_uartcfg *s3c24xx_port_to_cfg(struct uart_port *port)
178{
179 if (port->dev == NULL)
180 return NULL;
181
182 return (struct s3c2410_uartcfg *)port->dev->platform_data;
183}
184
185static int s3c24xx_serial_rx_fifocnt(struct s3c24xx_uart_port *ourport,
186 unsigned long ufstat)
187{
188 struct s3c24xx_uart_info *info = ourport->info;
189
190 if (ufstat & info->rx_fifofull)
191 return info->fifosize;
192
193 return (ufstat & info->rx_fifomask) >> info->rx_fifoshift;
194}
195
196
197/* ? - where has parity gone?? */
198#define S3C2410_UERSTAT_PARITY (0x1000)
199
200static irqreturn_t
201s3c24xx_serial_rx_chars(int irq, void *dev_id)
202{
203 struct s3c24xx_uart_port *ourport = dev_id;
204 struct uart_port *port = &ourport->port;
205 struct tty_struct *tty = port->info->tty;
206 unsigned int ufcon, ch, flag, ufstat, uerstat;
207 int max_count = 64;
208
209 while (max_count-- > 0) {
210 ufcon = rd_regl(port, S3C2410_UFCON);
211 ufstat = rd_regl(port, S3C2410_UFSTAT);
212
213 if (s3c24xx_serial_rx_fifocnt(ourport, ufstat) == 0)
214 break;
215
216 uerstat = rd_regl(port, S3C2410_UERSTAT);
217 ch = rd_regb(port, S3C2410_URXH);
218
219 if (port->flags & UPF_CONS_FLOW) {
220 int txe = s3c24xx_serial_txempty_nofifo(port);
221
222 if (rx_enabled(port)) {
223 if (!txe) {
224 rx_enabled(port) = 0;
225 continue;
226 }
227 } else {
228 if (txe) {
229 ufcon |= S3C2410_UFCON_RESETRX;
230 wr_regl(port, S3C2410_UFCON, ufcon);
231 rx_enabled(port) = 1;
232 goto out;
233 }
234 continue;
235 }
236 }
237
238 /* insert the character into the buffer */
239
240 flag = TTY_NORMAL;
241 port->icount.rx++;
242
243 if (unlikely(uerstat & S3C2410_UERSTAT_ANY)) {
244 dbg("rxerr: port ch=0x%02x, rxs=0x%08x\n",
245 ch, uerstat);
246
247 /* check for break */
248 if (uerstat & S3C2410_UERSTAT_BREAK) {
249 dbg("break!\n");
250 port->icount.brk++;
251 if (uart_handle_break(port))
252 goto ignore_char;
253 }
254
255 if (uerstat & S3C2410_UERSTAT_FRAME)
256 port->icount.frame++;
257 if (uerstat & S3C2410_UERSTAT_OVERRUN)
258 port->icount.overrun++;
259
260 uerstat &= port->read_status_mask;
261
262 if (uerstat & S3C2410_UERSTAT_BREAK)
263 flag = TTY_BREAK;
264 else if (uerstat & S3C2410_UERSTAT_PARITY)
265 flag = TTY_PARITY;
266 else if (uerstat & (S3C2410_UERSTAT_FRAME |
267 S3C2410_UERSTAT_OVERRUN))
268 flag = TTY_FRAME;
269 }
270
271 if (uart_handle_sysrq_char(port, ch))
272 goto ignore_char;
273
274 uart_insert_char(port, uerstat, S3C2410_UERSTAT_OVERRUN,
275 ch, flag);
276
277 ignore_char:
278 continue;
279 }
280 tty_flip_buffer_push(tty);
281
282 out:
283 return IRQ_HANDLED;
284}
285
286static irqreturn_t s3c24xx_serial_tx_chars(int irq, void *id)
287{
288 struct s3c24xx_uart_port *ourport = id;
289 struct uart_port *port = &ourport->port;
290 struct circ_buf *xmit = &port->info->xmit;
291 int count = 256;
292
293 if (port->x_char) {
294 wr_regb(port, S3C2410_UTXH, port->x_char);
295 port->icount.tx++;
296 port->x_char = 0;
297 goto out;
298 }
299
300 /* if there isnt anything more to transmit, or the uart is now
301 * stopped, disable the uart and exit
302 */
303
304 if (uart_circ_empty(xmit) || uart_tx_stopped(port)) {
305 s3c24xx_serial_stop_tx(port);
306 goto out;
307 }
308
309 /* try and drain the buffer... */
310
311 while (!uart_circ_empty(xmit) && count-- > 0) {
312 if (rd_regl(port, S3C2410_UFSTAT) & ourport->info->tx_fifofull)
313 break;
314
315 wr_regb(port, S3C2410_UTXH, xmit->buf[xmit->tail]);
316 xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);
317 port->icount.tx++;
318 }
319
320 if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS)
321 uart_write_wakeup(port);
322
323 if (uart_circ_empty(xmit))
324 s3c24xx_serial_stop_tx(port);
325
326 out:
327 return IRQ_HANDLED;
328}
329
330static unsigned int s3c24xx_serial_tx_empty(struct uart_port *port)
331{
332 struct s3c24xx_uart_info *info = s3c24xx_port_to_info(port);
333 unsigned long ufstat = rd_regl(port, S3C2410_UFSTAT);
334 unsigned long ufcon = rd_regl(port, S3C2410_UFCON);
335
336 if (ufcon & S3C2410_UFCON_FIFOMODE) {
337 if ((ufstat & info->tx_fifomask) != 0 ||
338 (ufstat & info->tx_fifofull))
339 return 0;
340
341 return 1;
342 }
343
344 return s3c24xx_serial_txempty_nofifo(port);
345}
346
347/* no modem control lines */
348static unsigned int s3c24xx_serial_get_mctrl(struct uart_port *port)
349{
350 unsigned int umstat = rd_regb(port, S3C2410_UMSTAT);
351
352 if (umstat & S3C2410_UMSTAT_CTS)
353 return TIOCM_CAR | TIOCM_DSR | TIOCM_CTS;
354 else
355 return TIOCM_CAR | TIOCM_DSR;
356}
357
358static void s3c24xx_serial_set_mctrl(struct uart_port *port, unsigned int mctrl)
359{
360 /* todo - possibly remove AFC and do manual CTS */
361}
362
363static void s3c24xx_serial_break_ctl(struct uart_port *port, int break_state)
364{
365 unsigned long flags;
366 unsigned int ucon;
367
368 spin_lock_irqsave(&port->lock, flags);
369
370 ucon = rd_regl(port, S3C2410_UCON);
371
372 if (break_state)
373 ucon |= S3C2410_UCON_SBREAK;
374 else
375 ucon &= ~S3C2410_UCON_SBREAK;
376
377 wr_regl(port, S3C2410_UCON, ucon);
378
379 spin_unlock_irqrestore(&port->lock, flags);
380}
381
382static void s3c24xx_serial_shutdown(struct uart_port *port)
383{
384 struct s3c24xx_uart_port *ourport = to_ourport(port);
385
386 if (ourport->tx_claimed) {
387 free_irq(TX_IRQ(port), ourport);
388 tx_enabled(port) = 0;
389 ourport->tx_claimed = 0;
390 }
391
392 if (ourport->rx_claimed) {
393 free_irq(RX_IRQ(port), ourport);
394 ourport->rx_claimed = 0;
395 rx_enabled(port) = 0;
396 }
397}
398
399
400static int s3c24xx_serial_startup(struct uart_port *port)
401{
402 struct s3c24xx_uart_port *ourport = to_ourport(port);
403 int ret;
404
405 dbg("s3c24xx_serial_startup: port=%p (%08lx,%p)\n",
406 port->mapbase, port->membase);
407
408 rx_enabled(port) = 1;
409
410 ret = request_irq(RX_IRQ(port),
411 s3c24xx_serial_rx_chars, 0,
412 s3c24xx_serial_portname(port), ourport);
413
414 if (ret != 0) {
415 printk(KERN_ERR "cannot get irq %d\n", RX_IRQ(port));
416 return ret;
417 }
418
419 ourport->rx_claimed = 1;
420
421 dbg("requesting tx irq...\n");
422
423 tx_enabled(port) = 1;
424
425 ret = request_irq(TX_IRQ(port),
426 s3c24xx_serial_tx_chars, 0,
427 s3c24xx_serial_portname(port), ourport);
428
429 if (ret) {
430 printk(KERN_ERR "cannot get irq %d\n", TX_IRQ(port));
431 goto err;
432 }
433
434 ourport->tx_claimed = 1;
435
436 dbg("s3c24xx_serial_startup ok\n");
437
438 /* the port reset code should have done the correct
439 * register setup for the port controls */
440
441 return ret;
442
443 err:
444 s3c24xx_serial_shutdown(port);
445 return ret;
446}
447
448/* power power management control */
449
450static void s3c24xx_serial_pm(struct uart_port *port, unsigned int level,
451 unsigned int old)
452{
453 struct s3c24xx_uart_port *ourport = to_ourport(port);
454
455 switch (level) {
456 case 3:
457 if (!IS_ERR(ourport->baudclk) && ourport->baudclk != NULL)
458 clk_disable(ourport->baudclk);
459
460 clk_disable(ourport->clk);
461 break;
462
463 case 0:
464 clk_enable(ourport->clk);
465
466 if (!IS_ERR(ourport->baudclk) && ourport->baudclk != NULL)
467 clk_enable(ourport->baudclk);
468
469 break;
470 default:
471 printk(KERN_ERR "s3c24xx_serial: unknown pm %d\n", level);
472 }
473}
474
475/* baud rate calculation
476 *
477 * The UARTs on the S3C2410/S3C2440 can take their clocks from a number
478 * of different sources, including the peripheral clock ("pclk") and an
479 * external clock ("uclk"). The S3C2440 also adds the core clock ("fclk")
480 * with a programmable extra divisor.
481 *
482 * The following code goes through the clock sources, and calculates the
483 * baud clocks (and the resultant actual baud rates) and then tries to
484 * pick the closest one and select that.
485 *
486*/
487
488
489#define MAX_CLKS (8)
490
491static struct s3c24xx_uart_clksrc tmp_clksrc = {
492 .name = "pclk",
493 .min_baud = 0,
494 .max_baud = 0,
495 .divisor = 1,
496};
497
498static inline int
499s3c24xx_serial_getsource(struct uart_port *port, struct s3c24xx_uart_clksrc *c)
500{
501 struct s3c24xx_uart_info *info = s3c24xx_port_to_info(port);
502
503 return (info->get_clksrc)(port, c);
504}
505
506static inline int
507s3c24xx_serial_setsource(struct uart_port *port, struct s3c24xx_uart_clksrc *c)
508{
509 struct s3c24xx_uart_info *info = s3c24xx_port_to_info(port);
510
511 return (info->set_clksrc)(port, c);
512}
513
514struct baud_calc {
515 struct s3c24xx_uart_clksrc *clksrc;
516 unsigned int calc;
517 unsigned int quot;
518 struct clk *src;
519};
520
521static int s3c24xx_serial_calcbaud(struct baud_calc *calc,
522 struct uart_port *port,
523 struct s3c24xx_uart_clksrc *clksrc,
524 unsigned int baud)
525{
526 unsigned long rate;
527
528 calc->src = clk_get(port->dev, clksrc->name);
529 if (calc->src == NULL || IS_ERR(calc->src))
530 return 0;
531
532 rate = clk_get_rate(calc->src);
533 rate /= clksrc->divisor;
534
535 calc->clksrc = clksrc;
536 calc->quot = (rate + (8 * baud)) / (16 * baud);
537 calc->calc = (rate / (calc->quot * 16));
538
539 calc->quot--;
540 return 1;
541}
542
543static unsigned int s3c24xx_serial_getclk(struct uart_port *port,
544 struct s3c24xx_uart_clksrc **clksrc,
545 struct clk **clk,
546 unsigned int baud)
547{
548 struct s3c2410_uartcfg *cfg = s3c24xx_port_to_cfg(port);
549 struct s3c24xx_uart_clksrc *clkp;
550 struct baud_calc res[MAX_CLKS];
551 struct baud_calc *resptr, *best, *sptr;
552 int i;
553
554 clkp = cfg->clocks;
555 best = NULL;
556
557 if (cfg->clocks_size < 2) {
558 if (cfg->clocks_size == 0)
559 clkp = &tmp_clksrc;
560
561 /* check to see if we're sourcing fclk, and if so we're
562 * going to have to update the clock source
563 */
564
565 if (strcmp(clkp->name, "fclk") == 0) {
566 struct s3c24xx_uart_clksrc src;
567
568 s3c24xx_serial_getsource(port, &src);
569
570 /* check that the port already using fclk, and if
571 * not, then re-select fclk
572 */
573
574 if (strcmp(src.name, clkp->name) == 0) {
575 s3c24xx_serial_setsource(port, clkp);
576 s3c24xx_serial_getsource(port, &src);
577 }
578
579 clkp->divisor = src.divisor;
580 }
581
582 s3c24xx_serial_calcbaud(res, port, clkp, baud);
583 best = res;
584 resptr = best + 1;
585 } else {
586 resptr = res;
587
588 for (i = 0; i < cfg->clocks_size; i++, clkp++) {
589 if (s3c24xx_serial_calcbaud(resptr, port, clkp, baud))
590 resptr++;
591 }
592 }
593
594 /* ok, we now need to select the best clock we found */
595
596 if (!best) {
597 unsigned int deviation = (1<<30)|((1<<30)-1);
598 int calc_deviation;
599
600 for (sptr = res; sptr < resptr; sptr++) {
601 calc_deviation = baud - sptr->calc;
602 if (calc_deviation < 0)
603 calc_deviation = -calc_deviation;
604
605 if (calc_deviation < deviation) {
606 best = sptr;
607 deviation = calc_deviation;
608 }
609 }
610 }
611
612 /* store results to pass back */
613
614 *clksrc = best->clksrc;
615 *clk = best->src;
616
617 return best->quot;
618}
619
620static void s3c24xx_serial_set_termios(struct uart_port *port,
621 struct ktermios *termios,
622 struct ktermios *old)
623{
624 struct s3c2410_uartcfg *cfg = s3c24xx_port_to_cfg(port);
625 struct s3c24xx_uart_port *ourport = to_ourport(port);
626 struct s3c24xx_uart_clksrc *clksrc = NULL;
627 struct clk *clk = NULL;
628 unsigned long flags;
629 unsigned int baud, quot;
630 unsigned int ulcon;
631 unsigned int umcon;
632
633 /*
634 * We don't support modem control lines.
635 */
636 termios->c_cflag &= ~(HUPCL | CMSPAR);
637 termios->c_cflag |= CLOCAL;
638
639 /*
640 * Ask the core to calculate the divisor for us.
641 */
642
643 baud = uart_get_baud_rate(port, termios, old, 0, 115200*8);
644
645 if (baud == 38400 && (port->flags & UPF_SPD_MASK) == UPF_SPD_CUST)
646 quot = port->custom_divisor;
647 else
648 quot = s3c24xx_serial_getclk(port, &clksrc, &clk, baud);
649
650 /* check to see if we need to change clock source */
651
652 if (ourport->clksrc != clksrc || ourport->baudclk != clk) {
653 s3c24xx_serial_setsource(port, clksrc);
654
655 if (ourport->baudclk != NULL && !IS_ERR(ourport->baudclk)) {
656 clk_disable(ourport->baudclk);
657 ourport->baudclk = NULL;
658 }
659
660 clk_enable(clk);
661
662 ourport->clksrc = clksrc;
663 ourport->baudclk = clk;
664 }
665
666 switch (termios->c_cflag & CSIZE) {
667 case CS5:
668 dbg("config: 5bits/char\n");
669 ulcon = S3C2410_LCON_CS5;
670 break;
671 case CS6:
672 dbg("config: 6bits/char\n");
673 ulcon = S3C2410_LCON_CS6;
674 break;
675 case CS7:
676 dbg("config: 7bits/char\n");
677 ulcon = S3C2410_LCON_CS7;
678 break;
679 case CS8:
680 default:
681 dbg("config: 8bits/char\n");
682 ulcon = S3C2410_LCON_CS8;
683 break;
684 }
685
686 /* preserve original lcon IR settings */
687 ulcon |= (cfg->ulcon & S3C2410_LCON_IRM);
688
689 if (termios->c_cflag & CSTOPB)
690 ulcon |= S3C2410_LCON_STOPB;
691
692 umcon = (termios->c_cflag & CRTSCTS) ? S3C2410_UMCOM_AFC : 0;
693
694 if (termios->c_cflag & PARENB) {
695 if (termios->c_cflag & PARODD)
696 ulcon |= S3C2410_LCON_PODD;
697 else
698 ulcon |= S3C2410_LCON_PEVEN;
699 } else {
700 ulcon |= S3C2410_LCON_PNONE;
701 }
702
703 spin_lock_irqsave(&port->lock, flags);
704
705 dbg("setting ulcon to %08x, brddiv to %d\n", ulcon, quot);
706
707 wr_regl(port, S3C2410_ULCON, ulcon);
708 wr_regl(port, S3C2410_UBRDIV, quot);
709 wr_regl(port, S3C2410_UMCON, umcon);
710
711 dbg("uart: ulcon = 0x%08x, ucon = 0x%08x, ufcon = 0x%08x\n",
712 rd_regl(port, S3C2410_ULCON),
713 rd_regl(port, S3C2410_UCON),
714 rd_regl(port, S3C2410_UFCON));
715
716 /*
717 * Update the per-port timeout.
718 */
719 uart_update_timeout(port, termios->c_cflag, baud);
720
721 /*
722 * Which character status flags are we interested in?
723 */
724 port->read_status_mask = S3C2410_UERSTAT_OVERRUN;
725 if (termios->c_iflag & INPCK)
726 port->read_status_mask |= S3C2410_UERSTAT_FRAME | S3C2410_UERSTAT_PARITY;
727
728 /*
729 * Which character status flags should we ignore?
730 */
731 port->ignore_status_mask = 0;
732 if (termios->c_iflag & IGNPAR)
733 port->ignore_status_mask |= S3C2410_UERSTAT_OVERRUN;
734 if (termios->c_iflag & IGNBRK && termios->c_iflag & IGNPAR)
735 port->ignore_status_mask |= S3C2410_UERSTAT_FRAME;
736
737 /*
738 * Ignore all characters if CREAD is not set.
739 */
740 if ((termios->c_cflag & CREAD) == 0)
741 port->ignore_status_mask |= RXSTAT_DUMMY_READ;
742
743 spin_unlock_irqrestore(&port->lock, flags);
744}
745
746static const char *s3c24xx_serial_type(struct uart_port *port)
747{
748 switch (port->type) {
749 case PORT_S3C2410:
750 return "S3C2410";
751 case PORT_S3C2440:
752 return "S3C2440";
753 case PORT_S3C2412:
754 return "S3C2412";
755 default:
756 return NULL;
757 }
758}
759
760#define MAP_SIZE (0x100)
761
762static void s3c24xx_serial_release_port(struct uart_port *port)
763{
764 release_mem_region(port->mapbase, MAP_SIZE);
765}
766
767static int s3c24xx_serial_request_port(struct uart_port *port)
768{
769 const char *name = s3c24xx_serial_portname(port);
770 return request_mem_region(port->mapbase, MAP_SIZE, name) ? 0 : -EBUSY;
771}
772
773static void s3c24xx_serial_config_port(struct uart_port *port, int flags)
774{
775 struct s3c24xx_uart_info *info = s3c24xx_port_to_info(port);
776
777 if (flags & UART_CONFIG_TYPE &&
778 s3c24xx_serial_request_port(port) == 0)
779 port->type = info->type;
780}
781
782/*
783 * verify the new serial_struct (for TIOCSSERIAL).
784 */
785static int
786s3c24xx_serial_verify_port(struct uart_port *port, struct serial_struct *ser)
787{
788 struct s3c24xx_uart_info *info = s3c24xx_port_to_info(port);
789
790 if (ser->type != PORT_UNKNOWN && ser->type != info->type)
791 return -EINVAL;
792
793 return 0;
794}
795
796
797#ifdef CONFIG_SERIAL_SAMSUNG_CONSOLE
798
799static struct console s3c24xx_serial_console;
800
801#define S3C24XX_SERIAL_CONSOLE &s3c24xx_serial_console
802#else
803#define S3C24XX_SERIAL_CONSOLE NULL
804#endif
805
806static struct uart_ops s3c24xx_serial_ops = {
807 .pm = s3c24xx_serial_pm,
808 .tx_empty = s3c24xx_serial_tx_empty,
809 .get_mctrl = s3c24xx_serial_get_mctrl,
810 .set_mctrl = s3c24xx_serial_set_mctrl,
811 .stop_tx = s3c24xx_serial_stop_tx,
812 .start_tx = s3c24xx_serial_start_tx,
813 .stop_rx = s3c24xx_serial_stop_rx,
814 .enable_ms = s3c24xx_serial_enable_ms,
815 .break_ctl = s3c24xx_serial_break_ctl,
816 .startup = s3c24xx_serial_startup,
817 .shutdown = s3c24xx_serial_shutdown,
818 .set_termios = s3c24xx_serial_set_termios,
819 .type = s3c24xx_serial_type,
820 .release_port = s3c24xx_serial_release_port,
821 .request_port = s3c24xx_serial_request_port,
822 .config_port = s3c24xx_serial_config_port,
823 .verify_port = s3c24xx_serial_verify_port,
824};
825
826
827static struct uart_driver s3c24xx_uart_drv = {
828 .owner = THIS_MODULE,
829 .dev_name = "s3c2410_serial",
830 .nr = 3,
831 .cons = S3C24XX_SERIAL_CONSOLE,
832 .driver_name = S3C24XX_SERIAL_NAME,
833 .major = S3C24XX_SERIAL_MAJOR,
834 .minor = S3C24XX_SERIAL_MINOR,
835};
836
837static struct s3c24xx_uart_port s3c24xx_serial_ports[NR_PORTS] = {
838 [0] = {
839 .port = {
840 .lock = __SPIN_LOCK_UNLOCKED(s3c24xx_serial_ports[0].port.lock),
841 .iotype = UPIO_MEM,
842 .irq = IRQ_S3CUART_RX0,
843 .uartclk = 0,
844 .fifosize = 16,
845 .ops = &s3c24xx_serial_ops,
846 .flags = UPF_BOOT_AUTOCONF,
847 .line = 0,
848 }
849 },
850 [1] = {
851 .port = {
852 .lock = __SPIN_LOCK_UNLOCKED(s3c24xx_serial_ports[1].port.lock),
853 .iotype = UPIO_MEM,
854 .irq = IRQ_S3CUART_RX1,
855 .uartclk = 0,
856 .fifosize = 16,
857 .ops = &s3c24xx_serial_ops,
858 .flags = UPF_BOOT_AUTOCONF,
859 .line = 1,
860 }
861 },
862#if NR_PORTS > 2
863
864 [2] = {
865 .port = {
866 .lock = __SPIN_LOCK_UNLOCKED(s3c24xx_serial_ports[2].port.lock),
867 .iotype = UPIO_MEM,
868 .irq = IRQ_S3CUART_RX2,
869 .uartclk = 0,
870 .fifosize = 16,
871 .ops = &s3c24xx_serial_ops,
872 .flags = UPF_BOOT_AUTOCONF,
873 .line = 2,
874 }
875 }
876#endif
877};
878
879/* s3c24xx_serial_resetport
880 *
881 * wrapper to call the specific reset for this port (reset the fifos
882 * and the settings)
883*/
884
885static inline int s3c24xx_serial_resetport(struct uart_port *port,
886 struct s3c2410_uartcfg *cfg)
887{
888 struct s3c24xx_uart_info *info = s3c24xx_port_to_info(port);
889
890 return (info->reset_port)(port, cfg);
891}
892
893/* s3c24xx_serial_init_port
894 *
895 * initialise a single serial port from the platform device given
896 */
897
898static int s3c24xx_serial_init_port(struct s3c24xx_uart_port *ourport,
899 struct s3c24xx_uart_info *info,
900 struct platform_device *platdev)
901{
902 struct uart_port *port = &ourport->port;
903 struct s3c2410_uartcfg *cfg;
904 struct resource *res;
905 int ret;
906
907 dbg("s3c24xx_serial_init_port: port=%p, platdev=%p\n", port, platdev);
908
909 if (platdev == NULL)
910 return -ENODEV;
911
912 cfg = s3c24xx_dev_to_cfg(&platdev->dev);
913
914 if (port->mapbase != 0)
915 return 0;
916
917 if (cfg->hwport > 3)
918 return -EINVAL;
919
920 /* setup info for port */
921 port->dev = &platdev->dev;
922 ourport->info = info;
923
924 /* copy the info in from provided structure */
925 ourport->port.fifosize = info->fifosize;
926
927 dbg("s3c24xx_serial_init_port: %p (hw %d)...\n", port, cfg->hwport);
928
929 port->uartclk = 1;
930
931 if (cfg->uart_flags & UPF_CONS_FLOW) {
932 dbg("s3c24xx_serial_init_port: enabling flow control\n");
933 port->flags |= UPF_CONS_FLOW;
934 }
935
936 /* sort our the physical and virtual addresses for each UART */
937
938 res = platform_get_resource(platdev, IORESOURCE_MEM, 0);
939 if (res == NULL) {
940 printk(KERN_ERR "failed to find memory resource for uart\n");
941 return -EINVAL;
942 }
943
944 dbg("resource %p (%lx..%lx)\n", res, res->start, res->end);
945
946 port->mapbase = res->start;
947 port->membase = S3C24XX_VA_UART + (res->start - S3C24XX_PA_UART);
948 ret = platform_get_irq(platdev, 0);
949 if (ret < 0)
950 port->irq = 0;
951 else
952 port->irq = ret;
953
954 ourport->clk = clk_get(&platdev->dev, "uart");
955
956 dbg("port: map=%08x, mem=%08x, irq=%d, clock=%ld\n",
957 port->mapbase, port->membase, port->irq, port->uartclk);
958
959 /* reset the fifos (and setup the uart) */
960 s3c24xx_serial_resetport(port, cfg);
961 return 0;
962}
963
964static ssize_t s3c24xx_serial_show_clksrc(struct device *dev,
965 struct device_attribute *attr,
966 char *buf)
967{
968 struct uart_port *port = s3c24xx_dev_to_port(dev);
969 struct s3c24xx_uart_port *ourport = to_ourport(port);
970
971 return snprintf(buf, PAGE_SIZE, "* %s\n", ourport->clksrc->name);
972}
973
974static DEVICE_ATTR(clock_source, S_IRUGO, s3c24xx_serial_show_clksrc, NULL);
975
976/* Device driver serial port probe */
977
978static int probe_index;
979
980int s3c24xx_serial_probe(struct platform_device *dev,
981 struct s3c24xx_uart_info *info)
982{
983 struct s3c24xx_uart_port *ourport;
984 int ret;
985
986 dbg("s3c24xx_serial_probe(%p, %p) %d\n", dev, info, probe_index);
987
988 ourport = &s3c24xx_serial_ports[probe_index];
989 probe_index++;
990
991 dbg("%s: initialising port %p...\n", __func__, ourport);
992
993 ret = s3c24xx_serial_init_port(ourport, info, dev);
994 if (ret < 0)
995 goto probe_err;
996
997 dbg("%s: adding port\n", __func__);
998 uart_add_one_port(&s3c24xx_uart_drv, &ourport->port);
999 platform_set_drvdata(dev, &ourport->port);
1000
1001 ret = device_create_file(&dev->dev, &dev_attr_clock_source);
1002 if (ret < 0)
1003 printk(KERN_ERR "%s: failed to add clksrc attr.\n", __func__);
1004
1005 return 0;
1006
1007 probe_err:
1008 return ret;
1009}
1010
1011EXPORT_SYMBOL_GPL(s3c24xx_serial_probe);
1012
1013int s3c24xx_serial_remove(struct platform_device *dev)
1014{
1015 struct uart_port *port = s3c24xx_dev_to_port(&dev->dev);
1016
1017 if (port) {
1018 device_remove_file(&dev->dev, &dev_attr_clock_source);
1019 uart_remove_one_port(&s3c24xx_uart_drv, port);
1020 }
1021
1022 return 0;
1023}
1024
1025EXPORT_SYMBOL_GPL(s3c24xx_serial_remove);
1026
1027/* UART power management code */
1028
1029#ifdef CONFIG_PM
1030
1031static int s3c24xx_serial_suspend(struct platform_device *dev, pm_message_t state)
1032{
1033 struct uart_port *port = s3c24xx_dev_to_port(&dev->dev);
1034
1035 if (port)
1036 uart_suspend_port(&s3c24xx_uart_drv, port);
1037
1038 return 0;
1039}
1040
1041static int s3c24xx_serial_resume(struct platform_device *dev)
1042{
1043 struct uart_port *port = s3c24xx_dev_to_port(&dev->dev);
1044 struct s3c24xx_uart_port *ourport = to_ourport(port);
1045
1046 if (port) {
1047 clk_enable(ourport->clk);
1048 s3c24xx_serial_resetport(port, s3c24xx_port_to_cfg(port));
1049 clk_disable(ourport->clk);
1050
1051 uart_resume_port(&s3c24xx_uart_drv, port);
1052 }
1053
1054 return 0;
1055}
1056#endif
1057
1058int s3c24xx_serial_init(struct platform_driver *drv,
1059 struct s3c24xx_uart_info *info)
1060{
1061 dbg("s3c24xx_serial_init(%p,%p)\n", drv, info);
1062
1063#ifdef CONFIG_PM
1064 drv->suspend = s3c24xx_serial_suspend;
1065 drv->resume = s3c24xx_serial_resume;
1066#endif
1067
1068 return platform_driver_register(drv);
1069}
1070
1071EXPORT_SYMBOL_GPL(s3c24xx_serial_init);
1072
1073/* module initialisation code */
1074
1075static int __init s3c24xx_serial_modinit(void)
1076{
1077 int ret;
1078
1079 ret = uart_register_driver(&s3c24xx_uart_drv);
1080 if (ret < 0) {
1081 printk(KERN_ERR "failed to register UART driver\n");
1082 return -1;
1083 }
1084
1085 return 0;
1086}
1087
1088static void __exit s3c24xx_serial_modexit(void)
1089{
1090 uart_unregister_driver(&s3c24xx_uart_drv);
1091}
1092
1093module_init(s3c24xx_serial_modinit);
1094module_exit(s3c24xx_serial_modexit);
1095
1096/* Console code */
1097
1098#ifdef CONFIG_SERIAL_SAMSUNG_CONSOLE
1099
1100static struct uart_port *cons_uart;
1101
1102static int
1103s3c24xx_serial_console_txrdy(struct uart_port *port, unsigned int ufcon)
1104{
1105 struct s3c24xx_uart_info *info = s3c24xx_port_to_info(port);
1106 unsigned long ufstat, utrstat;
1107
1108 if (ufcon & S3C2410_UFCON_FIFOMODE) {
1109 /* fifo mode - check ammount of data in fifo registers... */
1110
1111 ufstat = rd_regl(port, S3C2410_UFSTAT);
1112 return (ufstat & info->tx_fifofull) ? 0 : 1;
1113 }
1114
1115 /* in non-fifo mode, we go and use the tx buffer empty */
1116
1117 utrstat = rd_regl(port, S3C2410_UTRSTAT);
1118 return (utrstat & S3C2410_UTRSTAT_TXE) ? 1 : 0;
1119}
1120
1121static void
1122s3c24xx_serial_console_putchar(struct uart_port *port, int ch)
1123{
1124 unsigned int ufcon = rd_regl(cons_uart, S3C2410_UFCON);
1125 while (!s3c24xx_serial_console_txrdy(port, ufcon))
1126 barrier();
1127 wr_regb(cons_uart, S3C2410_UTXH, ch);
1128}
1129
1130static void
1131s3c24xx_serial_console_write(struct console *co, const char *s,
1132 unsigned int count)
1133{
1134 uart_console_write(cons_uart, s, count, s3c24xx_serial_console_putchar);
1135}
1136
1137static void __init
1138s3c24xx_serial_get_options(struct uart_port *port, int *baud,
1139 int *parity, int *bits)
1140{
1141 struct s3c24xx_uart_clksrc clksrc;
1142 struct clk *clk;
1143 unsigned int ulcon;
1144 unsigned int ucon;
1145 unsigned int ubrdiv;
1146 unsigned long rate;
1147
1148 ulcon = rd_regl(port, S3C2410_ULCON);
1149 ucon = rd_regl(port, S3C2410_UCON);
1150 ubrdiv = rd_regl(port, S3C2410_UBRDIV);
1151
1152 dbg("s3c24xx_serial_get_options: port=%p\n"
1153 "registers: ulcon=%08x, ucon=%08x, ubdriv=%08x\n",
1154 port, ulcon, ucon, ubrdiv);
1155
1156 if ((ucon & 0xf) != 0) {
1157 /* consider the serial port configured if the tx/rx mode set */
1158
1159 switch (ulcon & S3C2410_LCON_CSMASK) {
1160 case S3C2410_LCON_CS5:
1161 *bits = 5;
1162 break;
1163 case S3C2410_LCON_CS6:
1164 *bits = 6;
1165 break;
1166 case S3C2410_LCON_CS7:
1167 *bits = 7;
1168 break;
1169 default:
1170 case S3C2410_LCON_CS8:
1171 *bits = 8;
1172 break;
1173 }
1174
1175 switch (ulcon & S3C2410_LCON_PMASK) {
1176 case S3C2410_LCON_PEVEN:
1177 *parity = 'e';
1178 break;
1179
1180 case S3C2410_LCON_PODD:
1181 *parity = 'o';
1182 break;
1183
1184 case S3C2410_LCON_PNONE:
1185 default:
1186 *parity = 'n';
1187 }
1188
1189 /* now calculate the baud rate */
1190
1191 s3c24xx_serial_getsource(port, &clksrc);
1192
1193 clk = clk_get(port->dev, clksrc.name);
1194 if (!IS_ERR(clk) && clk != NULL)
1195 rate = clk_get_rate(clk) / clksrc.divisor;
1196 else
1197 rate = 1;
1198
1199
1200 *baud = rate / (16 * (ubrdiv + 1));
1201 dbg("calculated baud %d\n", *baud);
1202 }
1203
1204}
1205
1206/* s3c24xx_serial_init_ports
1207 *
1208 * initialise the serial ports from the machine provided initialisation
1209 * data.
1210*/
1211
1212static int s3c24xx_serial_init_ports(struct s3c24xx_uart_info *info)
1213{
1214 struct s3c24xx_uart_port *ptr = s3c24xx_serial_ports;
1215 struct platform_device **platdev_ptr;
1216 int i;
1217
1218 dbg("s3c24xx_serial_init_ports: initialising ports...\n");
1219
1220 platdev_ptr = s3c24xx_uart_devs;
1221
1222 for (i = 0; i < NR_PORTS; i++, ptr++, platdev_ptr++) {
1223 s3c24xx_serial_init_port(ptr, info, *platdev_ptr);
1224 }
1225
1226 return 0;
1227}
1228
1229static int __init
1230s3c24xx_serial_console_setup(struct console *co, char *options)
1231{
1232 struct uart_port *port;
1233 int baud = 9600;
1234 int bits = 8;
1235 int parity = 'n';
1236 int flow = 'n';
1237
1238 dbg("s3c24xx_serial_console_setup: co=%p (%d), %s\n",
1239 co, co->index, options);
1240
1241 /* is this a valid port */
1242
1243 if (co->index == -1 || co->index >= NR_PORTS)
1244 co->index = 0;
1245
1246 port = &s3c24xx_serial_ports[co->index].port;
1247
1248 /* is the port configured? */
1249
1250 if (port->mapbase == 0x0) {
1251 co->index = 0;
1252 port = &s3c24xx_serial_ports[co->index].port;
1253 }
1254
1255 cons_uart = port;
1256
1257 dbg("s3c24xx_serial_console_setup: port=%p (%d)\n", port, co->index);
1258
1259 /*
1260 * Check whether an invalid uart number has been specified, and
1261 * if so, search for the first available port that does have
1262 * console support.
1263 */
1264 if (options)
1265 uart_parse_options(options, &baud, &parity, &bits, &flow);
1266 else
1267 s3c24xx_serial_get_options(port, &baud, &parity, &bits);
1268
1269 dbg("s3c24xx_serial_console_setup: baud %d\n", baud);
1270
1271 return uart_set_options(port, co, baud, parity, bits, flow);
1272}
1273
1274/* s3c24xx_serial_initconsole
1275 *
1276 * initialise the console from one of the uart drivers
1277*/
1278
1279static struct console s3c24xx_serial_console = {
1280 .name = S3C24XX_SERIAL_NAME,
1281 .device = uart_console_device,
1282 .flags = CON_PRINTBUFFER,
1283 .index = -1,
1284 .write = s3c24xx_serial_console_write,
1285 .setup = s3c24xx_serial_console_setup
1286};
1287
1288int s3c24xx_serial_initconsole(struct platform_driver *drv,
1289 struct s3c24xx_uart_info *info)
1290
1291{
1292 struct platform_device *dev = s3c24xx_uart_devs[0];
1293
1294 dbg("s3c24xx_serial_initconsole\n");
1295
1296 /* select driver based on the cpu */
1297
1298 if (dev == NULL) {
1299 printk(KERN_ERR "s3c24xx: no devices for console init\n");
1300 return 0;
1301 }
1302
1303 if (strcmp(dev->name, drv->driver.name) != 0)
1304 return 0;
1305
1306 s3c24xx_serial_console.data = &s3c24xx_uart_drv;
1307 s3c24xx_serial_init_ports(info);
1308
1309 register_console(&s3c24xx_serial_console);
1310 return 0;
1311}
1312
1313#endif /* CONFIG_SERIAL_SAMSUNG_CONSOLE */
1314
1315MODULE_DESCRIPTION("Samsung SoC Serial port driver");
1316MODULE_AUTHOR("Ben Dooks <ben@simtec.co.uk>");
1317MODULE_LICENSE("GPL v2");
diff --git a/drivers/serial/samsung.h b/drivers/serial/samsung.h
new file mode 100644
index 000000000000..5c92ebbe7d9e
--- /dev/null
+++ b/drivers/serial/samsung.h
@@ -0,0 +1,102 @@
1/* linux/drivers/serial/samsung.h
2 *
3 * Driver for Samsung SoC onboard UARTs.
4 *
5 * Ben Dooks, Copyright (c) 2003-2005,2008 Simtec Electronics
6 * http://armlinux.simtec.co.uk/
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
13struct s3c24xx_uart_info {
14 char *name;
15 unsigned int type;
16 unsigned int fifosize;
17 unsigned long rx_fifomask;
18 unsigned long rx_fifoshift;
19 unsigned long rx_fifofull;
20 unsigned long tx_fifomask;
21 unsigned long tx_fifoshift;
22 unsigned long tx_fifofull;
23
24 /* clock source control */
25
26 int (*get_clksrc)(struct uart_port *, struct s3c24xx_uart_clksrc *clk);
27 int (*set_clksrc)(struct uart_port *, struct s3c24xx_uart_clksrc *clk);
28
29 /* uart controls */
30 int (*reset_port)(struct uart_port *, struct s3c2410_uartcfg *);
31};
32
33struct s3c24xx_uart_port {
34 unsigned char rx_claimed;
35 unsigned char tx_claimed;
36
37 struct s3c24xx_uart_info *info;
38 struct s3c24xx_uart_clksrc *clksrc;
39 struct clk *clk;
40 struct clk *baudclk;
41 struct uart_port port;
42};
43
44/* conversion functions */
45
46#define s3c24xx_dev_to_port(__dev) (struct uart_port *)dev_get_drvdata(__dev)
47#define s3c24xx_dev_to_cfg(__dev) (struct s3c2410_uartcfg *)((__dev)->platform_data)
48
49/* register access controls */
50
51#define portaddr(port, reg) ((port)->membase + (reg))
52
53#define rd_regb(port, reg) (__raw_readb(portaddr(port, reg)))
54#define rd_regl(port, reg) (__raw_readl(portaddr(port, reg)))
55
56#define wr_regb(port, reg, val) __raw_writeb(val, portaddr(port, reg))
57#define wr_regl(port, reg, val) __raw_writel(val, portaddr(port, reg))
58
59extern int s3c24xx_serial_probe(struct platform_device *dev,
60 struct s3c24xx_uart_info *uart);
61
62extern int s3c24xx_serial_remove(struct platform_device *dev);
63
64extern int s3c24xx_serial_initconsole(struct platform_driver *drv,
65 struct s3c24xx_uart_info *uart);
66
67extern int s3c24xx_serial_init(struct platform_driver *drv,
68 struct s3c24xx_uart_info *info);
69
70#ifdef CONFIG_SERIAL_SAMSUNG_CONSOLE
71
72#define s3c24xx_console_init(__drv, __inf) \
73static int __init s3c_serial_console_init(void) \
74{ \
75 return s3c24xx_serial_initconsole(__drv, __inf); \
76} \
77 \
78console_initcall(s3c_serial_console_init)
79
80#else
81#define s3c24xx_console_init(drv, inf) extern void no_console(void)
82#endif
83
84#ifdef CONFIG_SERIAL_SAMSUNG_DEBUG
85
86extern void printascii(const char *);
87
88static void dbg(const char *fmt, ...)
89{
90 va_list va;
91 char buff[256];
92
93 va_start(va, fmt);
94 vsprintf(buff, fmt, va);
95 va_end(va);
96
97 printascii(buff);
98}
99
100#else
101#define dbg(x...) do { } while (0)
102#endif
diff --git a/drivers/spi/spi_imx.c b/drivers/spi/spi_imx.c
index c730d05bfeb6..547e30298278 100644
--- a/drivers/spi/spi_imx.c
+++ b/drivers/spi/spi_imx.c
@@ -1526,24 +1526,24 @@ static int __init spi_imx_probe(struct platform_device *pdev)
1526 drv_data->rx_channel = -1; 1526 drv_data->rx_channel = -1;
1527 if (platform_info->enable_dma) { 1527 if (platform_info->enable_dma) {
1528 /* Get rx DMA channel */ 1528 /* Get rx DMA channel */
1529 status = imx_dma_request_by_prio(&drv_data->rx_channel, 1529 drv_data->rx_channel = imx_dma_request_by_prio("spi_imx_rx",
1530 "spi_imx_rx", DMA_PRIO_HIGH); 1530 DMA_PRIO_HIGH);
1531 if (status < 0) { 1531 if (drv_data->rx_channel < 0) {
1532 dev_err(dev, 1532 dev_err(dev,
1533 "probe - problem (%d) requesting rx channel\n", 1533 "probe - problem (%d) requesting rx channel\n",
1534 status); 1534 drv_data->rx_channel);
1535 goto err_no_rxdma; 1535 goto err_no_rxdma;
1536 } else 1536 } else
1537 imx_dma_setup_handlers(drv_data->rx_channel, NULL, 1537 imx_dma_setup_handlers(drv_data->rx_channel, NULL,
1538 dma_err_handler, drv_data); 1538 dma_err_handler, drv_data);
1539 1539
1540 /* Get tx DMA channel */ 1540 /* Get tx DMA channel */
1541 status = imx_dma_request_by_prio(&drv_data->tx_channel, 1541 drv_data->tx_channel = imx_dma_request_by_prio("spi_imx_tx",
1542 "spi_imx_tx", DMA_PRIO_MEDIUM); 1542 DMA_PRIO_MEDIUM);
1543 if (status < 0) { 1543 if (drv_data->tx_channel < 0) {
1544 dev_err(dev, 1544 dev_err(dev,
1545 "probe - problem (%d) requesting tx channel\n", 1545 "probe - problem (%d) requesting tx channel\n",
1546 status); 1546 drv_data->tx_channel);
1547 imx_dma_free(drv_data->rx_channel); 1547 imx_dma_free(drv_data->rx_channel);
1548 goto err_no_txdma; 1548 goto err_no_txdma;
1549 } else 1549 } else
diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig
index 4b628526df09..a86e952ed4ca 100644
--- a/drivers/thermal/Kconfig
+++ b/drivers/thermal/Kconfig
@@ -12,3 +12,12 @@ menuconfig THERMAL
12 cooling devices. 12 cooling devices.
13 All platforms with ACPI thermal support can use this driver. 13 All platforms with ACPI thermal support can use this driver.
14 If you want this support, you should say Y or M here. 14 If you want this support, you should say Y or M here.
15
16config THERMAL_HWMON
17 bool "Hardware monitoring support"
18 depends on HWMON=y || HWMON=THERMAL
19 help
20 The generic thermal sysfs driver's hardware monitoring support
21 requires a 2.10.7/3.0.2 or later lm-sensors userspace.
22
23 Say Y if your user-space is new enough.
diff --git a/drivers/thermal/thermal_sys.c b/drivers/thermal/thermal_sys.c
index 6098787341f3..fe07462d5947 100644
--- a/drivers/thermal/thermal_sys.c
+++ b/drivers/thermal/thermal_sys.c
@@ -295,8 +295,8 @@ thermal_cooling_device_trip_point_show(struct device *dev,
295 295
296/* Device management */ 296/* Device management */
297 297
298#if defined(CONFIG_HWMON) || \ 298#if defined(CONFIG_THERMAL_HWMON)
299 (defined(CONFIG_HWMON_MODULE) && defined(CONFIG_THERMAL_MODULE)) 299
300/* hwmon sys I/F */ 300/* hwmon sys I/F */
301#include <linux/hwmon.h> 301#include <linux/hwmon.h>
302static LIST_HEAD(thermal_hwmon_list); 302static LIST_HEAD(thermal_hwmon_list);
diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig
index 6e784d2db423..3565d4352826 100644
--- a/drivers/usb/gadget/Kconfig
+++ b/drivers/usb/gadget/Kconfig
@@ -118,10 +118,10 @@ config USB_AMD5536UDC
118config USB_GADGET_ATMEL_USBA 118config USB_GADGET_ATMEL_USBA
119 boolean "Atmel USBA" 119 boolean "Atmel USBA"
120 select USB_GADGET_DUALSPEED 120 select USB_GADGET_DUALSPEED
121 depends on AVR32 || ARCH_AT91CAP9 121 depends on AVR32 || ARCH_AT91CAP9 || ARCH_AT91SAM9RL
122 help 122 help
123 USBA is the integrated high-speed USB Device controller on 123 USBA is the integrated high-speed USB Device controller on
124 the AT32AP700x and AT91CAP9 processors from Atmel. 124 the AT32AP700x, some AT91SAM9 and AT91CAP9 processors from Atmel.
125 125
126config USB_ATMEL_USBA 126config USB_ATMEL_USBA
127 tristate 127 tristate
diff --git a/drivers/usb/gadget/at91_udc.c b/drivers/usb/gadget/at91_udc.c
index 274c60a970cd..b6b2a0a5ba37 100644
--- a/drivers/usb/gadget/at91_udc.c
+++ b/drivers/usb/gadget/at91_udc.c
@@ -888,7 +888,7 @@ static void pullup(struct at91_udc *udc, int is_on)
888 at91_udp_write(udc, AT91_UDP_TXVC, 0); 888 at91_udp_write(udc, AT91_UDP_TXVC, 0);
889 if (cpu_is_at91rm9200()) 889 if (cpu_is_at91rm9200())
890 gpio_set_value(udc->board.pullup_pin, active); 890 gpio_set_value(udc->board.pullup_pin, active);
891 else if (cpu_is_at91sam9260() || cpu_is_at91sam9263()) { 891 else if (cpu_is_at91sam9260() || cpu_is_at91sam9263() || cpu_is_at91sam9g20()) {
892 u32 txvc = at91_udp_read(udc, AT91_UDP_TXVC); 892 u32 txvc = at91_udp_read(udc, AT91_UDP_TXVC);
893 893
894 txvc |= AT91_UDP_TXVC_PUON; 894 txvc |= AT91_UDP_TXVC_PUON;
@@ -906,7 +906,7 @@ static void pullup(struct at91_udc *udc, int is_on)
906 at91_udp_write(udc, AT91_UDP_TXVC, AT91_UDP_TXVC_TXVDIS); 906 at91_udp_write(udc, AT91_UDP_TXVC, AT91_UDP_TXVC_TXVDIS);
907 if (cpu_is_at91rm9200()) 907 if (cpu_is_at91rm9200())
908 gpio_set_value(udc->board.pullup_pin, !active); 908 gpio_set_value(udc->board.pullup_pin, !active);
909 else if (cpu_is_at91sam9260() || cpu_is_at91sam9263()) { 909 else if (cpu_is_at91sam9260() || cpu_is_at91sam9263() || cpu_is_at91sam9g20()) {
910 u32 txvc = at91_udp_read(udc, AT91_UDP_TXVC); 910 u32 txvc = at91_udp_read(udc, AT91_UDP_TXVC);
911 911
912 txvc &= ~AT91_UDP_TXVC_PUON; 912 txvc &= ~AT91_UDP_TXVC_PUON;
diff --git a/drivers/usb/gadget/omap_udc.c b/drivers/usb/gadget/omap_udc.c
index 881d74c3d964..03a7f49d207d 100644
--- a/drivers/usb/gadget/omap_udc.c
+++ b/drivers/usb/gadget/omap_udc.c
@@ -135,13 +135,17 @@ static void use_ep(struct omap_ep *ep, u16 select)
135 135
136 if (ep->bEndpointAddress & USB_DIR_IN) 136 if (ep->bEndpointAddress & USB_DIR_IN)
137 num |= UDC_EP_DIR; 137 num |= UDC_EP_DIR;
138 UDC_EP_NUM_REG = num | select; 138 omap_writew(num | select, UDC_EP_NUM);
139 /* when select, MUST deselect later !! */ 139 /* when select, MUST deselect later !! */
140} 140}
141 141
142static inline void deselect_ep(void) 142static inline void deselect_ep(void)
143{ 143{
144 UDC_EP_NUM_REG &= ~UDC_EP_SEL; 144 u16 w;
145
146 w = omap_readw(UDC_EP_NUM);
147 w &= ~UDC_EP_SEL;
148 omap_writew(w, UDC_EP_NUM);
145 /* 6 wait states before TX will happen */ 149 /* 6 wait states before TX will happen */
146} 150}
147 151
@@ -216,7 +220,7 @@ static int omap_ep_enable(struct usb_ep *_ep,
216 ep->has_dma = 0; 220 ep->has_dma = 0;
217 ep->lch = -1; 221 ep->lch = -1;
218 use_ep(ep, UDC_EP_SEL); 222 use_ep(ep, UDC_EP_SEL);
219 UDC_CTRL_REG = udc->clr_halt; 223 omap_writew(udc->clr_halt, UDC_CTRL);
220 ep->ackwait = 0; 224 ep->ackwait = 0;
221 deselect_ep(); 225 deselect_ep();
222 226
@@ -232,7 +236,7 @@ static int omap_ep_enable(struct usb_ep *_ep,
232 if (desc->bmAttributes != USB_ENDPOINT_XFER_ISOC 236 if (desc->bmAttributes != USB_ENDPOINT_XFER_ISOC
233 && !ep->has_dma 237 && !ep->has_dma
234 && !(ep->bEndpointAddress & USB_DIR_IN)) { 238 && !(ep->bEndpointAddress & USB_DIR_IN)) {
235 UDC_CTRL_REG = UDC_SET_FIFO_EN; 239 omap_writew(UDC_SET_FIFO_EN, UDC_CTRL);
236 ep->ackwait = 1 + ep->double_buf; 240 ep->ackwait = 1 + ep->double_buf;
237 } 241 }
238 242
@@ -259,7 +263,7 @@ static int omap_ep_disable(struct usb_ep *_ep)
259 nuke (ep, -ESHUTDOWN); 263 nuke (ep, -ESHUTDOWN);
260 ep->ep.maxpacket = ep->maxpacket; 264 ep->ep.maxpacket = ep->maxpacket;
261 ep->has_dma = 0; 265 ep->has_dma = 0;
262 UDC_CTRL_REG = UDC_SET_HALT; 266 omap_writew(UDC_SET_HALT, UDC_CTRL);
263 list_del_init(&ep->iso); 267 list_del_init(&ep->iso);
264 del_timer(&ep->timer); 268 del_timer(&ep->timer);
265 269
@@ -360,13 +364,13 @@ write_packet(u8 *buf, struct omap_req *req, unsigned max)
360 if (likely((((int)buf) & 1) == 0)) { 364 if (likely((((int)buf) & 1) == 0)) {
361 wp = (u16 *)buf; 365 wp = (u16 *)buf;
362 while (max >= 2) { 366 while (max >= 2) {
363 UDC_DATA_REG = *wp++; 367 omap_writew(*wp++, UDC_DATA);
364 max -= 2; 368 max -= 2;
365 } 369 }
366 buf = (u8 *)wp; 370 buf = (u8 *)wp;
367 } 371 }
368 while (max--) 372 while (max--)
369 *(volatile u8 *)&UDC_DATA_REG = *buf++; 373 omap_writeb(*buf++, UDC_DATA);
370 return len; 374 return len;
371} 375}
372 376
@@ -385,13 +389,13 @@ static int write_fifo(struct omap_ep *ep, struct omap_req *req)
385 prefetch(buf); 389 prefetch(buf);
386 390
387 /* PIO-IN isn't double buffered except for iso */ 391 /* PIO-IN isn't double buffered except for iso */
388 ep_stat = UDC_STAT_FLG_REG; 392 ep_stat = omap_readw(UDC_STAT_FLG);
389 if (ep_stat & UDC_FIFO_UNWRITABLE) 393 if (ep_stat & UDC_FIFO_UNWRITABLE)
390 return 0; 394 return 0;
391 395
392 count = ep->ep.maxpacket; 396 count = ep->ep.maxpacket;
393 count = write_packet(buf, req, count); 397 count = write_packet(buf, req, count);
394 UDC_CTRL_REG = UDC_SET_FIFO_EN; 398 omap_writew(UDC_SET_FIFO_EN, UDC_CTRL);
395 ep->ackwait = 1; 399 ep->ackwait = 1;
396 400
397 /* last packet is often short (sometimes a zlp) */ 401 /* last packet is often short (sometimes a zlp) */
@@ -425,13 +429,13 @@ read_packet(u8 *buf, struct omap_req *req, unsigned avail)
425 if (likely((((int)buf) & 1) == 0)) { 429 if (likely((((int)buf) & 1) == 0)) {
426 wp = (u16 *)buf; 430 wp = (u16 *)buf;
427 while (avail >= 2) { 431 while (avail >= 2) {
428 *wp++ = UDC_DATA_REG; 432 *wp++ = omap_readw(UDC_DATA);
429 avail -= 2; 433 avail -= 2;
430 } 434 }
431 buf = (u8 *)wp; 435 buf = (u8 *)wp;
432 } 436 }
433 while (avail--) 437 while (avail--)
434 *buf++ = *(volatile u8 *)&UDC_DATA_REG; 438 *buf++ = omap_readb(UDC_DATA);
435 return len; 439 return len;
436} 440}
437 441
@@ -446,7 +450,7 @@ static int read_fifo(struct omap_ep *ep, struct omap_req *req)
446 prefetchw(buf); 450 prefetchw(buf);
447 451
448 for (;;) { 452 for (;;) {
449 u16 ep_stat = UDC_STAT_FLG_REG; 453 u16 ep_stat = omap_readw(UDC_STAT_FLG);
450 454
451 is_last = 0; 455 is_last = 0;
452 if (ep_stat & FIFO_EMPTY) { 456 if (ep_stat & FIFO_EMPTY) {
@@ -460,7 +464,7 @@ static int read_fifo(struct omap_ep *ep, struct omap_req *req)
460 if (ep_stat & UDC_FIFO_FULL) 464 if (ep_stat & UDC_FIFO_FULL)
461 avail = ep->ep.maxpacket; 465 avail = ep->ep.maxpacket;
462 else { 466 else {
463 avail = UDC_RXFSTAT_REG; 467 avail = omap_readw(UDC_RXFSTAT);
464 ep->fnf = ep->double_buf; 468 ep->fnf = ep->double_buf;
465 } 469 }
466 count = read_packet(buf, req, avail); 470 count = read_packet(buf, req, avail);
@@ -473,7 +477,7 @@ static int read_fifo(struct omap_ep *ep, struct omap_req *req)
473 req->req.status = -EOVERFLOW; 477 req->req.status = -EOVERFLOW;
474 avail -= count; 478 avail -= count;
475 while (avail--) 479 while (avail--)
476 (void) *(volatile u8 *)&UDC_DATA_REG; 480 omap_readw(UDC_DATA);
477 } 481 }
478 } else if (req->req.length == req->req.actual) 482 } else if (req->req.length == req->req.actual)
479 is_last = 1; 483 is_last = 1;
@@ -491,32 +495,6 @@ static int read_fifo(struct omap_ep *ep, struct omap_req *req)
491 495
492/*-------------------------------------------------------------------------*/ 496/*-------------------------------------------------------------------------*/
493 497
494static inline dma_addr_t dma_csac(unsigned lch)
495{
496 dma_addr_t csac;
497
498 /* omap 3.2/3.3 erratum: sometimes 0 is returned if CSAC/CDAC is
499 * read before the DMA controller finished disabling the channel.
500 */
501 csac = OMAP_DMA_CSAC_REG(lch);
502 if (csac == 0)
503 csac = OMAP_DMA_CSAC_REG(lch);
504 return csac;
505}
506
507static inline dma_addr_t dma_cdac(unsigned lch)
508{
509 dma_addr_t cdac;
510
511 /* omap 3.2/3.3 erratum: sometimes 0 is returned if CSAC/CDAC is
512 * read before the DMA controller finished disabling the channel.
513 */
514 cdac = OMAP_DMA_CDAC_REG(lch);
515 if (cdac == 0)
516 cdac = OMAP_DMA_CDAC_REG(lch);
517 return cdac;
518}
519
520static u16 dma_src_len(struct omap_ep *ep, dma_addr_t start) 498static u16 dma_src_len(struct omap_ep *ep, dma_addr_t start)
521{ 499{
522 dma_addr_t end; 500 dma_addr_t end;
@@ -527,7 +505,7 @@ static u16 dma_src_len(struct omap_ep *ep, dma_addr_t start)
527 if (cpu_is_omap15xx()) 505 if (cpu_is_omap15xx())
528 return 0; 506 return 0;
529 507
530 end = dma_csac(ep->lch); 508 end = omap_get_dma_src_pos(ep->lch);
531 if (end == ep->dma_counter) 509 if (end == ep->dma_counter)
532 return 0; 510 return 0;
533 511
@@ -537,15 +515,11 @@ static u16 dma_src_len(struct omap_ep *ep, dma_addr_t start)
537 return end - start; 515 return end - start;
538} 516}
539 517
540#define DMA_DEST_LAST(x) (cpu_is_omap15xx() \
541 ? OMAP_DMA_CSAC_REG(x) /* really: CPC */ \
542 : dma_cdac(x))
543
544static u16 dma_dest_len(struct omap_ep *ep, dma_addr_t start) 518static u16 dma_dest_len(struct omap_ep *ep, dma_addr_t start)
545{ 519{
546 dma_addr_t end; 520 dma_addr_t end;
547 521
548 end = DMA_DEST_LAST(ep->lch); 522 end = omap_get_dma_dst_pos(ep->lch);
549 if (end == ep->dma_counter) 523 if (end == ep->dma_counter)
550 return 0; 524 return 0;
551 525
@@ -565,7 +539,7 @@ static u16 dma_dest_len(struct omap_ep *ep, dma_addr_t start)
565 539
566static void next_in_dma(struct omap_ep *ep, struct omap_req *req) 540static void next_in_dma(struct omap_ep *ep, struct omap_req *req)
567{ 541{
568 u16 txdma_ctrl; 542 u16 txdma_ctrl, w;
569 unsigned length = req->req.length - req->req.actual; 543 unsigned length = req->req.length - req->req.actual;
570 const int sync_mode = cpu_is_omap15xx() 544 const int sync_mode = cpu_is_omap15xx()
571 ? OMAP_DMA_SYNC_FRAME 545 ? OMAP_DMA_SYNC_FRAME
@@ -596,14 +570,18 @@ static void next_in_dma(struct omap_ep *ep, struct omap_req *req)
596 0, 0); 570 0, 0);
597 571
598 omap_start_dma(ep->lch); 572 omap_start_dma(ep->lch);
599 ep->dma_counter = dma_csac(ep->lch); 573 ep->dma_counter = omap_get_dma_src_pos(ep->lch);
600 UDC_DMA_IRQ_EN_REG |= UDC_TX_DONE_IE(ep->dma_channel); 574 w = omap_readw(UDC_DMA_IRQ_EN);
601 UDC_TXDMA_REG(ep->dma_channel) = UDC_TXN_START | txdma_ctrl; 575 w |= UDC_TX_DONE_IE(ep->dma_channel);
576 omap_writew(w, UDC_DMA_IRQ_EN);
577 omap_writew(UDC_TXN_START | txdma_ctrl, UDC_TXDMA(ep->dma_channel));
602 req->dma_bytes = length; 578 req->dma_bytes = length;
603} 579}
604 580
605static void finish_in_dma(struct omap_ep *ep, struct omap_req *req, int status) 581static void finish_in_dma(struct omap_ep *ep, struct omap_req *req, int status)
606{ 582{
583 u16 w;
584
607 if (status == 0) { 585 if (status == 0) {
608 req->req.actual += req->dma_bytes; 586 req->req.actual += req->dma_bytes;
609 587
@@ -620,7 +598,9 @@ static void finish_in_dma(struct omap_ep *ep, struct omap_req *req, int status)
620 598
621 /* tx completion */ 599 /* tx completion */
622 omap_stop_dma(ep->lch); 600 omap_stop_dma(ep->lch);
623 UDC_DMA_IRQ_EN_REG &= ~UDC_TX_DONE_IE(ep->dma_channel); 601 w = omap_readw(UDC_DMA_IRQ_EN);
602 w &= ~UDC_TX_DONE_IE(ep->dma_channel);
603 omap_writew(w, UDC_DMA_IRQ_EN);
624 done(ep, req, status); 604 done(ep, req, status);
625} 605}
626 606
@@ -628,6 +608,7 @@ static void next_out_dma(struct omap_ep *ep, struct omap_req *req)
628{ 608{
629 unsigned packets = req->req.length - req->req.actual; 609 unsigned packets = req->req.length - req->req.actual;
630 int dma_trigger = 0; 610 int dma_trigger = 0;
611 u16 w;
631 612
632 if (cpu_is_omap24xx()) 613 if (cpu_is_omap24xx())
633 dma_trigger = OMAP24XX_DMA(USB_W2FC_RX0, ep->dma_channel); 614 dma_trigger = OMAP24XX_DMA(USB_W2FC_RX0, ep->dma_channel);
@@ -654,12 +635,14 @@ static void next_out_dma(struct omap_ep *ep, struct omap_req *req)
654 omap_set_dma_dest_params(ep->lch, OMAP_DMA_PORT_EMIFF, 635 omap_set_dma_dest_params(ep->lch, OMAP_DMA_PORT_EMIFF,
655 OMAP_DMA_AMODE_POST_INC, req->req.dma + req->req.actual, 636 OMAP_DMA_AMODE_POST_INC, req->req.dma + req->req.actual,
656 0, 0); 637 0, 0);
657 ep->dma_counter = DMA_DEST_LAST(ep->lch); 638 ep->dma_counter = omap_get_dma_dst_pos(ep->lch);
658 639
659 UDC_RXDMA_REG(ep->dma_channel) = UDC_RXN_STOP | (packets - 1); 640 omap_writew(UDC_RXN_STOP | (packets - 1), UDC_RXDMA(ep->dma_channel));
660 UDC_DMA_IRQ_EN_REG |= UDC_RX_EOT_IE(ep->dma_channel); 641 w = omap_readw(UDC_DMA_IRQ_EN);
661 UDC_EP_NUM_REG = (ep->bEndpointAddress & 0xf); 642 w |= UDC_RX_EOT_IE(ep->dma_channel);
662 UDC_CTRL_REG = UDC_SET_FIFO_EN; 643 omap_writew(w, UDC_DMA_IRQ_EN);
644 omap_writew(ep->bEndpointAddress & 0xf, UDC_EP_NUM);
645 omap_writew(UDC_SET_FIFO_EN, UDC_CTRL);
663 646
664 omap_start_dma(ep->lch); 647 omap_start_dma(ep->lch);
665} 648}
@@ -667,7 +650,7 @@ static void next_out_dma(struct omap_ep *ep, struct omap_req *req)
667static void 650static void
668finish_out_dma(struct omap_ep *ep, struct omap_req *req, int status, int one) 651finish_out_dma(struct omap_ep *ep, struct omap_req *req, int status, int one)
669{ 652{
670 u16 count; 653 u16 count, w;
671 654
672 if (status == 0) 655 if (status == 0)
673 ep->dma_counter = (u16) (req->req.dma + req->req.actual); 656 ep->dma_counter = (u16) (req->req.dma + req->req.actual);
@@ -686,13 +669,15 @@ finish_out_dma(struct omap_ep *ep, struct omap_req *req, int status, int one)
686 return; 669 return;
687 670
688 /* rx completion */ 671 /* rx completion */
689 UDC_DMA_IRQ_EN_REG &= ~UDC_RX_EOT_IE(ep->dma_channel); 672 w = omap_readw(UDC_DMA_IRQ_EN);
673 w &= ~UDC_RX_EOT_IE(ep->dma_channel);
674 omap_writew(w, UDC_DMA_IRQ_EN);
690 done(ep, req, status); 675 done(ep, req, status);
691} 676}
692 677
693static void dma_irq(struct omap_udc *udc, u16 irq_src) 678static void dma_irq(struct omap_udc *udc, u16 irq_src)
694{ 679{
695 u16 dman_stat = UDC_DMAN_STAT_REG; 680 u16 dman_stat = omap_readw(UDC_DMAN_STAT);
696 struct omap_ep *ep; 681 struct omap_ep *ep;
697 struct omap_req *req; 682 struct omap_req *req;
698 683
@@ -706,7 +691,7 @@ static void dma_irq(struct omap_udc *udc, u16 irq_src)
706 struct omap_req, queue); 691 struct omap_req, queue);
707 finish_in_dma(ep, req, 0); 692 finish_in_dma(ep, req, 0);
708 } 693 }
709 UDC_IRQ_SRC_REG = UDC_TXN_DONE; 694 omap_writew(UDC_TXN_DONE, UDC_IRQ_SRC);
710 695
711 if (!list_empty (&ep->queue)) { 696 if (!list_empty (&ep->queue)) {
712 req = container_of(ep->queue.next, 697 req = container_of(ep->queue.next,
@@ -725,7 +710,7 @@ static void dma_irq(struct omap_udc *udc, u16 irq_src)
725 struct omap_req, queue); 710 struct omap_req, queue);
726 finish_out_dma(ep, req, 0, dman_stat & UDC_DMA_RX_SB); 711 finish_out_dma(ep, req, 0, dman_stat & UDC_DMA_RX_SB);
727 } 712 }
728 UDC_IRQ_SRC_REG = UDC_RXN_EOT; 713 omap_writew(UDC_RXN_EOT, UDC_IRQ_SRC);
729 714
730 if (!list_empty (&ep->queue)) { 715 if (!list_empty (&ep->queue)) {
731 req = container_of(ep->queue.next, 716 req = container_of(ep->queue.next,
@@ -739,7 +724,7 @@ static void dma_irq(struct omap_udc *udc, u16 irq_src)
739 ep->irqs++; 724 ep->irqs++;
740 /* omap15xx does this unasked... */ 725 /* omap15xx does this unasked... */
741 VDBG("%s, RX_CNT irq?\n", ep->ep.name); 726 VDBG("%s, RX_CNT irq?\n", ep->ep.name);
742 UDC_IRQ_SRC_REG = UDC_RXN_CNT; 727 omap_writew(UDC_RXN_CNT, UDC_IRQ_SRC);
743 } 728 }
744} 729}
745 730
@@ -762,9 +747,9 @@ static void dma_channel_claim(struct omap_ep *ep, unsigned channel)
762 747
763 is_in = ep->bEndpointAddress & USB_DIR_IN; 748 is_in = ep->bEndpointAddress & USB_DIR_IN;
764 if (is_in) 749 if (is_in)
765 reg = UDC_TXDMA_CFG_REG; 750 reg = omap_readw(UDC_TXDMA_CFG);
766 else 751 else
767 reg = UDC_RXDMA_CFG_REG; 752 reg = omap_readw(UDC_RXDMA_CFG);
768 reg |= UDC_DMA_REQ; /* "pulse" activated */ 753 reg |= UDC_DMA_REQ; /* "pulse" activated */
769 754
770 ep->dma_channel = 0; 755 ep->dma_channel = 0;
@@ -792,7 +777,7 @@ static void dma_channel_claim(struct omap_ep *ep, unsigned channel)
792 status = omap_request_dma(dma_channel, 777 status = omap_request_dma(dma_channel,
793 ep->ep.name, dma_error, ep, &ep->lch); 778 ep->ep.name, dma_error, ep, &ep->lch);
794 if (status == 0) { 779 if (status == 0) {
795 UDC_TXDMA_CFG_REG = reg; 780 omap_writew(reg, UDC_TXDMA_CFG);
796 /* EMIFF or SDRC */ 781 /* EMIFF or SDRC */
797 omap_set_dma_src_burst_mode(ep->lch, 782 omap_set_dma_src_burst_mode(ep->lch,
798 OMAP_DMA_DATA_BURST_4); 783 OMAP_DMA_DATA_BURST_4);
@@ -801,7 +786,7 @@ static void dma_channel_claim(struct omap_ep *ep, unsigned channel)
801 omap_set_dma_dest_params(ep->lch, 786 omap_set_dma_dest_params(ep->lch,
802 OMAP_DMA_PORT_TIPB, 787 OMAP_DMA_PORT_TIPB,
803 OMAP_DMA_AMODE_CONSTANT, 788 OMAP_DMA_AMODE_CONSTANT,
804 (unsigned long) io_v2p((u32)&UDC_DATA_DMA_REG), 789 (unsigned long) io_v2p(UDC_DATA_DMA),
805 0, 0); 790 0, 0);
806 } 791 }
807 } else { 792 } else {
@@ -813,12 +798,12 @@ static void dma_channel_claim(struct omap_ep *ep, unsigned channel)
813 status = omap_request_dma(dma_channel, 798 status = omap_request_dma(dma_channel,
814 ep->ep.name, dma_error, ep, &ep->lch); 799 ep->ep.name, dma_error, ep, &ep->lch);
815 if (status == 0) { 800 if (status == 0) {
816 UDC_RXDMA_CFG_REG = reg; 801 omap_writew(reg, UDC_RXDMA_CFG);
817 /* TIPB */ 802 /* TIPB */
818 omap_set_dma_src_params(ep->lch, 803 omap_set_dma_src_params(ep->lch,
819 OMAP_DMA_PORT_TIPB, 804 OMAP_DMA_PORT_TIPB,
820 OMAP_DMA_AMODE_CONSTANT, 805 OMAP_DMA_AMODE_CONSTANT,
821 (unsigned long) io_v2p((u32)&UDC_DATA_DMA_REG), 806 (unsigned long) io_v2p(UDC_DATA_DMA),
822 0, 0); 807 0, 0);
823 /* EMIFF or SDRC */ 808 /* EMIFF or SDRC */
824 omap_set_dma_dest_burst_mode(ep->lch, 809 omap_set_dma_dest_burst_mode(ep->lch,
@@ -834,7 +819,7 @@ static void dma_channel_claim(struct omap_ep *ep, unsigned channel)
834 819
835 /* channel type P: hw synch (fifo) */ 820 /* channel type P: hw synch (fifo) */
836 if (cpu_class_is_omap1() && !cpu_is_omap15xx()) 821 if (cpu_class_is_omap1() && !cpu_is_omap15xx())
837 OMAP1_DMA_LCH_CTRL_REG(ep->lch) = 2; 822 omap_set_dma_channel_mode(ep->lch, OMAP_DMA_LCH_P);
838 } 823 }
839 824
840just_restart: 825just_restart:
@@ -860,7 +845,7 @@ just_restart:
860 (is_in ? write_fifo : read_fifo)(ep, req); 845 (is_in ? write_fifo : read_fifo)(ep, req);
861 deselect_ep(); 846 deselect_ep();
862 if (!is_in) { 847 if (!is_in) {
863 UDC_CTRL_REG = UDC_SET_FIFO_EN; 848 omap_writew(UDC_SET_FIFO_EN, UDC_CTRL);
864 ep->ackwait = 1 + ep->double_buf; 849 ep->ackwait = 1 + ep->double_buf;
865 } 850 }
866 /* IN: 6 wait states before it'll tx */ 851 /* IN: 6 wait states before it'll tx */
@@ -881,7 +866,7 @@ static void dma_channel_release(struct omap_ep *ep)
881 else 866 else
882 req = NULL; 867 req = NULL;
883 868
884 active = ((1 << 7) & OMAP_DMA_CCR_REG(ep->lch)) != 0; 869 active = omap_get_dma_active_status(ep->lch);
885 870
886 DBG("%s release %s %cxdma%d %p\n", ep->ep.name, 871 DBG("%s release %s %cxdma%d %p\n", ep->ep.name,
887 active ? "active" : "idle", 872 active ? "active" : "idle",
@@ -894,23 +879,25 @@ static void dma_channel_release(struct omap_ep *ep)
894 879
895 /* wait till current packet DMA finishes, and fifo empties */ 880 /* wait till current packet DMA finishes, and fifo empties */
896 if (ep->bEndpointAddress & USB_DIR_IN) { 881 if (ep->bEndpointAddress & USB_DIR_IN) {
897 UDC_TXDMA_CFG_REG = (UDC_TXDMA_CFG_REG & ~mask) | UDC_DMA_REQ; 882 omap_writew((omap_readw(UDC_TXDMA_CFG) & ~mask) | UDC_DMA_REQ,
883 UDC_TXDMA_CFG);
898 884
899 if (req) { 885 if (req) {
900 finish_in_dma(ep, req, -ECONNRESET); 886 finish_in_dma(ep, req, -ECONNRESET);
901 887
902 /* clear FIFO; hosts probably won't empty it */ 888 /* clear FIFO; hosts probably won't empty it */
903 use_ep(ep, UDC_EP_SEL); 889 use_ep(ep, UDC_EP_SEL);
904 UDC_CTRL_REG = UDC_CLR_EP; 890 omap_writew(UDC_CLR_EP, UDC_CTRL);
905 deselect_ep(); 891 deselect_ep();
906 } 892 }
907 while (UDC_TXDMA_CFG_REG & mask) 893 while (omap_readw(UDC_TXDMA_CFG) & mask)
908 udelay(10); 894 udelay(10);
909 } else { 895 } else {
910 UDC_RXDMA_CFG_REG = (UDC_RXDMA_CFG_REG & ~mask) | UDC_DMA_REQ; 896 omap_writew((omap_readw(UDC_RXDMA_CFG) & ~mask) | UDC_DMA_REQ,
897 UDC_RXDMA_CFG);
911 898
912 /* dma empties the fifo */ 899 /* dma empties the fifo */
913 while (UDC_RXDMA_CFG_REG & mask) 900 while (omap_readw(UDC_RXDMA_CFG) & mask)
914 udelay(10); 901 udelay(10);
915 if (req) 902 if (req)
916 finish_out_dma(ep, req, -ECONNRESET, 0); 903 finish_out_dma(ep, req, -ECONNRESET, 0);
@@ -997,9 +984,13 @@ omap_ep_queue(struct usb_ep *_ep, struct usb_request *_req, gfp_t gfp_flags)
997 req->req.actual = 0; 984 req->req.actual = 0;
998 985
999 /* maybe kickstart non-iso i/o queues */ 986 /* maybe kickstart non-iso i/o queues */
1000 if (is_iso) 987 if (is_iso) {
1001 UDC_IRQ_EN_REG |= UDC_SOF_IE; 988 u16 w;
1002 else if (list_empty(&ep->queue) && !ep->stopped && !ep->ackwait) { 989
990 w = omap_readw(UDC_IRQ_EN);
991 w |= UDC_SOF_IE;
992 omap_writew(w, UDC_IRQ_EN);
993 } else if (list_empty(&ep->queue) && !ep->stopped && !ep->ackwait) {
1003 int is_in; 994 int is_in;
1004 995
1005 if (ep->bEndpointAddress == 0) { 996 if (ep->bEndpointAddress == 0) {
@@ -1017,23 +1008,23 @@ omap_ep_queue(struct usb_ep *_ep, struct usb_request *_req, gfp_t gfp_flags)
1017 * requests to non-control endpoints 1008 * requests to non-control endpoints
1018 */ 1009 */
1019 if (udc->ep0_set_config) { 1010 if (udc->ep0_set_config) {
1020 u16 irq_en = UDC_IRQ_EN_REG; 1011 u16 irq_en = omap_readw(UDC_IRQ_EN);
1021 1012
1022 irq_en |= UDC_DS_CHG_IE | UDC_EP0_IE; 1013 irq_en |= UDC_DS_CHG_IE | UDC_EP0_IE;
1023 if (!udc->ep0_reset_config) 1014 if (!udc->ep0_reset_config)
1024 irq_en |= UDC_EPN_RX_IE 1015 irq_en |= UDC_EPN_RX_IE
1025 | UDC_EPN_TX_IE; 1016 | UDC_EPN_TX_IE;
1026 UDC_IRQ_EN_REG = irq_en; 1017 omap_writew(irq_en, UDC_IRQ_EN);
1027 } 1018 }
1028 1019
1029 /* STATUS for zero length DATA stages is 1020 /* STATUS for zero length DATA stages is
1030 * always an IN ... even for IN transfers, 1021 * always an IN ... even for IN transfers,
1031 * a weird case which seem to stall OMAP. 1022 * a weird case which seem to stall OMAP.
1032 */ 1023 */
1033 UDC_EP_NUM_REG = (UDC_EP_SEL|UDC_EP_DIR); 1024 omap_writew(UDC_EP_SEL | UDC_EP_DIR, UDC_EP_NUM);
1034 UDC_CTRL_REG = UDC_CLR_EP; 1025 omap_writew(UDC_CLR_EP, UDC_CTRL);
1035 UDC_CTRL_REG = UDC_SET_FIFO_EN; 1026 omap_writew(UDC_SET_FIFO_EN, UDC_CTRL);
1036 UDC_EP_NUM_REG = UDC_EP_DIR; 1027 omap_writew(UDC_EP_DIR, UDC_EP_NUM);
1037 1028
1038 /* cleanup */ 1029 /* cleanup */
1039 udc->ep0_pending = 0; 1030 udc->ep0_pending = 0;
@@ -1042,11 +1033,11 @@ omap_ep_queue(struct usb_ep *_ep, struct usb_request *_req, gfp_t gfp_flags)
1042 1033
1043 /* non-empty DATA stage */ 1034 /* non-empty DATA stage */
1044 } else if (is_in) { 1035 } else if (is_in) {
1045 UDC_EP_NUM_REG = UDC_EP_SEL|UDC_EP_DIR; 1036 omap_writew(UDC_EP_SEL | UDC_EP_DIR, UDC_EP_NUM);
1046 } else { 1037 } else {
1047 if (udc->ep0_setup) 1038 if (udc->ep0_setup)
1048 goto irq_wait; 1039 goto irq_wait;
1049 UDC_EP_NUM_REG = UDC_EP_SEL; 1040 omap_writew(UDC_EP_SEL, UDC_EP_NUM);
1050 } 1041 }
1051 } else { 1042 } else {
1052 is_in = ep->bEndpointAddress & USB_DIR_IN; 1043 is_in = ep->bEndpointAddress & USB_DIR_IN;
@@ -1062,7 +1053,7 @@ omap_ep_queue(struct usb_ep *_ep, struct usb_request *_req, gfp_t gfp_flags)
1062 req = NULL; 1053 req = NULL;
1063 deselect_ep(); 1054 deselect_ep();
1064 if (!is_in) { 1055 if (!is_in) {
1065 UDC_CTRL_REG = UDC_SET_FIFO_EN; 1056 omap_writew(UDC_SET_FIFO_EN, UDC_CTRL);
1066 ep->ackwait = 1 + ep->double_buf; 1057 ep->ackwait = 1 + ep->double_buf;
1067 } 1058 }
1068 /* IN: 6 wait states before it'll tx */ 1059 /* IN: 6 wait states before it'll tx */
@@ -1130,9 +1121,9 @@ static int omap_ep_set_halt(struct usb_ep *_ep, int value)
1130 else if (value) { 1121 else if (value) {
1131 if (ep->udc->ep0_set_config) { 1122 if (ep->udc->ep0_set_config) {
1132 WARN("error changing config?\n"); 1123 WARN("error changing config?\n");
1133 UDC_SYSCON2_REG = UDC_CLR_CFG; 1124 omap_writew(UDC_CLR_CFG, UDC_SYSCON2);
1134 } 1125 }
1135 UDC_SYSCON2_REG = UDC_STALL_CMD; 1126 omap_writew(UDC_STALL_CMD, UDC_SYSCON2);
1136 ep->udc->ep0_pending = 0; 1127 ep->udc->ep0_pending = 0;
1137 status = 0; 1128 status = 0;
1138 } else /* NOP */ 1129 } else /* NOP */
@@ -1159,8 +1150,8 @@ static int omap_ep_set_halt(struct usb_ep *_ep, int value)
1159 channel = 0; 1150 channel = 0;
1160 1151
1161 use_ep(ep, UDC_EP_SEL); 1152 use_ep(ep, UDC_EP_SEL);
1162 if (UDC_STAT_FLG_REG & UDC_NON_ISO_FIFO_EMPTY) { 1153 if (omap_readw(UDC_STAT_FLG) & UDC_NON_ISO_FIFO_EMPTY) {
1163 UDC_CTRL_REG = UDC_SET_HALT; 1154 omap_writew(UDC_SET_HALT, UDC_CTRL);
1164 status = 0; 1155 status = 0;
1165 } else 1156 } else
1166 status = -EAGAIN; 1157 status = -EAGAIN;
@@ -1170,10 +1161,10 @@ static int omap_ep_set_halt(struct usb_ep *_ep, int value)
1170 dma_channel_claim(ep, channel); 1161 dma_channel_claim(ep, channel);
1171 } else { 1162 } else {
1172 use_ep(ep, 0); 1163 use_ep(ep, 0);
1173 UDC_CTRL_REG = ep->udc->clr_halt; 1164 omap_writew(ep->udc->clr_halt, UDC_CTRL);
1174 ep->ackwait = 0; 1165 ep->ackwait = 0;
1175 if (!(ep->bEndpointAddress & USB_DIR_IN)) { 1166 if (!(ep->bEndpointAddress & USB_DIR_IN)) {
1176 UDC_CTRL_REG = UDC_SET_FIFO_EN; 1167 omap_writew(UDC_SET_FIFO_EN, UDC_CTRL);
1177 ep->ackwait = 1 + ep->double_buf; 1168 ep->ackwait = 1 + ep->double_buf;
1178 } 1169 }
1179 } 1170 }
@@ -1205,7 +1196,7 @@ static struct usb_ep_ops omap_ep_ops = {
1205 1196
1206static int omap_get_frame(struct usb_gadget *gadget) 1197static int omap_get_frame(struct usb_gadget *gadget)
1207{ 1198{
1208 u16 sof = UDC_SOF_REG; 1199 u16 sof = omap_readw(UDC_SOF);
1209 return (sof & UDC_TS_OK) ? (sof & UDC_TS) : -EL2NSYNC; 1200 return (sof & UDC_TS_OK) ? (sof & UDC_TS) : -EL2NSYNC;
1210} 1201}
1211 1202
@@ -1224,7 +1215,7 @@ static int omap_wakeup(struct usb_gadget *gadget)
1224 */ 1215 */
1225 if (udc->devstat & (UDC_B_HNP_ENABLE|UDC_R_WK_OK)) { 1216 if (udc->devstat & (UDC_B_HNP_ENABLE|UDC_R_WK_OK)) {
1226 DBG("remote wakeup...\n"); 1217 DBG("remote wakeup...\n");
1227 UDC_SYSCON2_REG = UDC_RMT_WKP; 1218 omap_writew(UDC_RMT_WKP, UDC_SYSCON2);
1228 retval = 0; 1219 retval = 0;
1229 } 1220 }
1230 1221
@@ -1247,12 +1238,12 @@ omap_set_selfpowered(struct usb_gadget *gadget, int is_selfpowered)
1247 1238
1248 udc = container_of(gadget, struct omap_udc, gadget); 1239 udc = container_of(gadget, struct omap_udc, gadget);
1249 spin_lock_irqsave(&udc->lock, flags); 1240 spin_lock_irqsave(&udc->lock, flags);
1250 syscon1 = UDC_SYSCON1_REG; 1241 syscon1 = omap_readw(UDC_SYSCON1);
1251 if (is_selfpowered) 1242 if (is_selfpowered)
1252 syscon1 |= UDC_SELF_PWR; 1243 syscon1 |= UDC_SELF_PWR;
1253 else 1244 else
1254 syscon1 &= ~UDC_SELF_PWR; 1245 syscon1 &= ~UDC_SELF_PWR;
1255 UDC_SYSCON1_REG = syscon1; 1246 omap_writew(syscon1, UDC_SYSCON1);
1256 spin_unlock_irqrestore(&udc->lock, flags); 1247 spin_unlock_irqrestore(&udc->lock, flags);
1257 1248
1258 return 0; 1249 return 0;
@@ -1265,18 +1256,36 @@ static int can_pullup(struct omap_udc *udc)
1265 1256
1266static void pullup_enable(struct omap_udc *udc) 1257static void pullup_enable(struct omap_udc *udc)
1267{ 1258{
1268 UDC_SYSCON1_REG |= UDC_PULLUP_EN; 1259 u16 w;
1269 if (!gadget_is_otg(&udc->gadget) && !cpu_is_omap15xx()) 1260
1270 OTG_CTRL_REG |= OTG_BSESSVLD; 1261 w = omap_readw(UDC_SYSCON1);
1271 UDC_IRQ_EN_REG = UDC_DS_CHG_IE; 1262 w |= UDC_PULLUP_EN;
1263 omap_writew(w, UDC_SYSCON1);
1264 if (!gadget_is_otg(&udc->gadget) && !cpu_is_omap15xx()) {
1265 u32 l;
1266
1267 l = omap_readl(OTG_CTRL);
1268 l |= OTG_BSESSVLD;
1269 omap_writel(l, OTG_CTRL);
1270 }
1271 omap_writew(UDC_DS_CHG_IE, UDC_IRQ_EN);
1272} 1272}
1273 1273
1274static void pullup_disable(struct omap_udc *udc) 1274static void pullup_disable(struct omap_udc *udc)
1275{ 1275{
1276 if (!gadget_is_otg(&udc->gadget) && !cpu_is_omap15xx()) 1276 u16 w;
1277 OTG_CTRL_REG &= ~OTG_BSESSVLD; 1277
1278 UDC_IRQ_EN_REG = UDC_DS_CHG_IE; 1278 if (!gadget_is_otg(&udc->gadget) && !cpu_is_omap15xx()) {
1279 UDC_SYSCON1_REG &= ~UDC_PULLUP_EN; 1279 u32 l;
1280
1281 l = omap_readl(OTG_CTRL);
1282 l &= ~OTG_BSESSVLD;
1283 omap_writel(l, OTG_CTRL);
1284 }
1285 omap_writew(UDC_DS_CHG_IE, UDC_IRQ_EN);
1286 w = omap_readw(UDC_SYSCON1);
1287 w &= ~UDC_PULLUP_EN;
1288 omap_writew(w, UDC_SYSCON1);
1280} 1289}
1281 1290
1282static struct omap_udc *udc; 1291static struct omap_udc *udc;
@@ -1304,6 +1313,7 @@ static int omap_vbus_session(struct usb_gadget *gadget, int is_active)
1304{ 1313{
1305 struct omap_udc *udc; 1314 struct omap_udc *udc;
1306 unsigned long flags; 1315 unsigned long flags;
1316 u32 l;
1307 1317
1308 udc = container_of(gadget, struct omap_udc, gadget); 1318 udc = container_of(gadget, struct omap_udc, gadget);
1309 spin_lock_irqsave(&udc->lock, flags); 1319 spin_lock_irqsave(&udc->lock, flags);
@@ -1311,10 +1321,12 @@ static int omap_vbus_session(struct usb_gadget *gadget, int is_active)
1311 udc->vbus_active = (is_active != 0); 1321 udc->vbus_active = (is_active != 0);
1312 if (cpu_is_omap15xx()) { 1322 if (cpu_is_omap15xx()) {
1313 /* "software" detect, ignored if !VBUS_MODE_1510 */ 1323 /* "software" detect, ignored if !VBUS_MODE_1510 */
1324 l = omap_readl(FUNC_MUX_CTRL_0);
1314 if (is_active) 1325 if (is_active)
1315 FUNC_MUX_CTRL_0_REG |= VBUS_CTRL_1510; 1326 l |= VBUS_CTRL_1510;
1316 else 1327 else
1317 FUNC_MUX_CTRL_0_REG &= ~VBUS_CTRL_1510; 1328 l &= ~VBUS_CTRL_1510;
1329 omap_writel(l, FUNC_MUX_CTRL_0);
1318 } 1330 }
1319 if (udc->dc_clk != NULL && is_active) { 1331 if (udc->dc_clk != NULL && is_active) {
1320 if (!udc->clk_requested) { 1332 if (!udc->clk_requested) {
@@ -1384,9 +1396,9 @@ static void nuke(struct omap_ep *ep, int status)
1384 dma_channel_release(ep); 1396 dma_channel_release(ep);
1385 1397
1386 use_ep(ep, 0); 1398 use_ep(ep, 0);
1387 UDC_CTRL_REG = UDC_CLR_EP; 1399 omap_writew(UDC_CLR_EP, UDC_CTRL);
1388 if (ep->bEndpointAddress && ep->bmAttributes != USB_ENDPOINT_XFER_ISOC) 1400 if (ep->bEndpointAddress && ep->bmAttributes != USB_ENDPOINT_XFER_ISOC)
1389 UDC_CTRL_REG = UDC_SET_HALT; 1401 omap_writew(UDC_SET_HALT, UDC_CTRL);
1390 1402
1391 while (!list_empty(&ep->queue)) { 1403 while (!list_empty(&ep->queue)) {
1392 req = list_entry(ep->queue.next, struct omap_req, queue); 1404 req = list_entry(ep->queue.next, struct omap_req, queue);
@@ -1414,8 +1426,8 @@ static void update_otg(struct omap_udc *udc)
1414 if (!gadget_is_otg(&udc->gadget)) 1426 if (!gadget_is_otg(&udc->gadget))
1415 return; 1427 return;
1416 1428
1417 if (OTG_CTRL_REG & OTG_ID) 1429 if (omap_readl(OTG_CTRL) & OTG_ID)
1418 devstat = UDC_DEVSTAT_REG; 1430 devstat = omap_readw(UDC_DEVSTAT);
1419 else 1431 else
1420 devstat = 0; 1432 devstat = 0;
1421 1433
@@ -1426,9 +1438,14 @@ static void update_otg(struct omap_udc *udc)
1426 /* Enable HNP early, avoiding races on suspend irq path. 1438 /* Enable HNP early, avoiding races on suspend irq path.
1427 * ASSUMES OTG state machine B_BUS_REQ input is true. 1439 * ASSUMES OTG state machine B_BUS_REQ input is true.
1428 */ 1440 */
1429 if (udc->gadget.b_hnp_enable) 1441 if (udc->gadget.b_hnp_enable) {
1430 OTG_CTRL_REG = (OTG_CTRL_REG | OTG_B_HNPEN | OTG_B_BUSREQ) 1442 u32 l;
1431 & ~OTG_PULLUP; 1443
1444 l = omap_readl(OTG_CTRL);
1445 l |= OTG_B_HNPEN | OTG_B_BUSREQ;
1446 l &= ~OTG_PULLUP;
1447 omap_writel(l, OTG_CTRL);
1448 }
1432} 1449}
1433 1450
1434static void ep0_irq(struct omap_udc *udc, u16 irq_src) 1451static void ep0_irq(struct omap_udc *udc, u16 irq_src)
@@ -1446,7 +1463,7 @@ static void ep0_irq(struct omap_udc *udc, u16 irq_src)
1446 1463
1447 nuke(ep0, 0); 1464 nuke(ep0, 0);
1448 if (ack) { 1465 if (ack) {
1449 UDC_IRQ_SRC_REG = ack; 1466 omap_writew(ack, UDC_IRQ_SRC);
1450 irq_src = UDC_SETUP; 1467 irq_src = UDC_SETUP;
1451 } 1468 }
1452 } 1469 }
@@ -1466,9 +1483,9 @@ static void ep0_irq(struct omap_udc *udc, u16 irq_src)
1466 if (irq_src & UDC_EP0_TX) { 1483 if (irq_src & UDC_EP0_TX) {
1467 int stat; 1484 int stat;
1468 1485
1469 UDC_IRQ_SRC_REG = UDC_EP0_TX; 1486 omap_writew(UDC_EP0_TX, UDC_IRQ_SRC);
1470 UDC_EP_NUM_REG = UDC_EP_SEL|UDC_EP_DIR; 1487 omap_writew(UDC_EP_SEL|UDC_EP_DIR, UDC_EP_NUM);
1471 stat = UDC_STAT_FLG_REG; 1488 stat = omap_readw(UDC_STAT_FLG);
1472 if (stat & UDC_ACK) { 1489 if (stat & UDC_ACK) {
1473 if (udc->ep0_in) { 1490 if (udc->ep0_in) {
1474 /* write next IN packet from response, 1491 /* write next IN packet from response,
@@ -1476,26 +1493,26 @@ static void ep0_irq(struct omap_udc *udc, u16 irq_src)
1476 */ 1493 */
1477 if (req) 1494 if (req)
1478 stat = write_fifo(ep0, req); 1495 stat = write_fifo(ep0, req);
1479 UDC_EP_NUM_REG = UDC_EP_DIR; 1496 omap_writew(UDC_EP_DIR, UDC_EP_NUM);
1480 if (!req && udc->ep0_pending) { 1497 if (!req && udc->ep0_pending) {
1481 UDC_EP_NUM_REG = UDC_EP_SEL; 1498 omap_writew(UDC_EP_SEL, UDC_EP_NUM);
1482 UDC_CTRL_REG = UDC_CLR_EP; 1499 omap_writew(UDC_CLR_EP, UDC_CTRL);
1483 UDC_CTRL_REG = UDC_SET_FIFO_EN; 1500 omap_writew(UDC_SET_FIFO_EN, UDC_CTRL);
1484 UDC_EP_NUM_REG = 0; 1501 omap_writew(0, UDC_EP_NUM);
1485 udc->ep0_pending = 0; 1502 udc->ep0_pending = 0;
1486 } /* else: 6 wait states before it'll tx */ 1503 } /* else: 6 wait states before it'll tx */
1487 } else { 1504 } else {
1488 /* ack status stage of OUT transfer */ 1505 /* ack status stage of OUT transfer */
1489 UDC_EP_NUM_REG = UDC_EP_DIR; 1506 omap_writew(UDC_EP_DIR, UDC_EP_NUM);
1490 if (req) 1507 if (req)
1491 done(ep0, req, 0); 1508 done(ep0, req, 0);
1492 } 1509 }
1493 req = NULL; 1510 req = NULL;
1494 } else if (stat & UDC_STALL) { 1511 } else if (stat & UDC_STALL) {
1495 UDC_CTRL_REG = UDC_CLR_HALT; 1512 omap_writew(UDC_CLR_HALT, UDC_CTRL);
1496 UDC_EP_NUM_REG = UDC_EP_DIR; 1513 omap_writew(UDC_EP_DIR, UDC_EP_NUM);
1497 } else { 1514 } else {
1498 UDC_EP_NUM_REG = UDC_EP_DIR; 1515 omap_writew(UDC_EP_DIR, UDC_EP_NUM);
1499 } 1516 }
1500 } 1517 }
1501 1518
@@ -1503,9 +1520,9 @@ static void ep0_irq(struct omap_udc *udc, u16 irq_src)
1503 if (irq_src & UDC_EP0_RX) { 1520 if (irq_src & UDC_EP0_RX) {
1504 int stat; 1521 int stat;
1505 1522
1506 UDC_IRQ_SRC_REG = UDC_EP0_RX; 1523 omap_writew(UDC_EP0_RX, UDC_IRQ_SRC);
1507 UDC_EP_NUM_REG = UDC_EP_SEL; 1524 omap_writew(UDC_EP_SEL, UDC_EP_NUM);
1508 stat = UDC_STAT_FLG_REG; 1525 stat = omap_readw(UDC_STAT_FLG);
1509 if (stat & UDC_ACK) { 1526 if (stat & UDC_ACK) {
1510 if (!udc->ep0_in) { 1527 if (!udc->ep0_in) {
1511 stat = 0; 1528 stat = 0;
@@ -1513,34 +1530,35 @@ static void ep0_irq(struct omap_udc *udc, u16 irq_src)
1513 * reactiviting the fifo; stall on errors. 1530 * reactiviting the fifo; stall on errors.
1514 */ 1531 */
1515 if (!req || (stat = read_fifo(ep0, req)) < 0) { 1532 if (!req || (stat = read_fifo(ep0, req)) < 0) {
1516 UDC_SYSCON2_REG = UDC_STALL_CMD; 1533 omap_writew(UDC_STALL_CMD, UDC_SYSCON2);
1517 udc->ep0_pending = 0; 1534 udc->ep0_pending = 0;
1518 stat = 0; 1535 stat = 0;
1519 } else if (stat == 0) 1536 } else if (stat == 0)
1520 UDC_CTRL_REG = UDC_SET_FIFO_EN; 1537 omap_writew(UDC_SET_FIFO_EN, UDC_CTRL);
1521 UDC_EP_NUM_REG = 0; 1538 omap_writew(0, UDC_EP_NUM);
1522 1539
1523 /* activate status stage */ 1540 /* activate status stage */
1524 if (stat == 1) { 1541 if (stat == 1) {
1525 done(ep0, req, 0); 1542 done(ep0, req, 0);
1526 /* that may have STALLed ep0... */ 1543 /* that may have STALLed ep0... */
1527 UDC_EP_NUM_REG = UDC_EP_SEL|UDC_EP_DIR; 1544 omap_writew(UDC_EP_SEL | UDC_EP_DIR,
1528 UDC_CTRL_REG = UDC_CLR_EP; 1545 UDC_EP_NUM);
1529 UDC_CTRL_REG = UDC_SET_FIFO_EN; 1546 omap_writew(UDC_CLR_EP, UDC_CTRL);
1530 UDC_EP_NUM_REG = UDC_EP_DIR; 1547 omap_writew(UDC_SET_FIFO_EN, UDC_CTRL);
1548 omap_writew(UDC_EP_DIR, UDC_EP_NUM);
1531 udc->ep0_pending = 0; 1549 udc->ep0_pending = 0;
1532 } 1550 }
1533 } else { 1551 } else {
1534 /* ack status stage of IN transfer */ 1552 /* ack status stage of IN transfer */
1535 UDC_EP_NUM_REG = 0; 1553 omap_writew(0, UDC_EP_NUM);
1536 if (req) 1554 if (req)
1537 done(ep0, req, 0); 1555 done(ep0, req, 0);
1538 } 1556 }
1539 } else if (stat & UDC_STALL) { 1557 } else if (stat & UDC_STALL) {
1540 UDC_CTRL_REG = UDC_CLR_HALT; 1558 omap_writew(UDC_CLR_HALT, UDC_CTRL);
1541 UDC_EP_NUM_REG = 0; 1559 omap_writew(0, UDC_EP_NUM);
1542 } else { 1560 } else {
1543 UDC_EP_NUM_REG = 0; 1561 omap_writew(0, UDC_EP_NUM);
1544 } 1562 }
1545 } 1563 }
1546 1564
@@ -1555,14 +1573,14 @@ static void ep0_irq(struct omap_udc *udc, u16 irq_src)
1555 1573
1556 /* read the (latest) SETUP message */ 1574 /* read the (latest) SETUP message */
1557 do { 1575 do {
1558 UDC_EP_NUM_REG = UDC_SETUP_SEL; 1576 omap_writew(UDC_SETUP_SEL, UDC_EP_NUM);
1559 /* two bytes at a time */ 1577 /* two bytes at a time */
1560 u.word[0] = UDC_DATA_REG; 1578 u.word[0] = omap_readw(UDC_DATA);
1561 u.word[1] = UDC_DATA_REG; 1579 u.word[1] = omap_readw(UDC_DATA);
1562 u.word[2] = UDC_DATA_REG; 1580 u.word[2] = omap_readw(UDC_DATA);
1563 u.word[3] = UDC_DATA_REG; 1581 u.word[3] = omap_readw(UDC_DATA);
1564 UDC_EP_NUM_REG = 0; 1582 omap_writew(0, UDC_EP_NUM);
1565 } while (UDC_IRQ_SRC_REG & UDC_SETUP); 1583 } while (omap_readw(UDC_IRQ_SRC) & UDC_SETUP);
1566 1584
1567#define w_value le16_to_cpu(u.r.wValue) 1585#define w_value le16_to_cpu(u.r.wValue)
1568#define w_index le16_to_cpu(u.r.wIndex) 1586#define w_index le16_to_cpu(u.r.wIndex)
@@ -1593,9 +1611,9 @@ static void ep0_irq(struct omap_udc *udc, u16 irq_src)
1593 * later if it fails the request. 1611 * later if it fails the request.
1594 */ 1612 */
1595 if (udc->ep0_reset_config) 1613 if (udc->ep0_reset_config)
1596 UDC_SYSCON2_REG = UDC_CLR_CFG; 1614 omap_writew(UDC_CLR_CFG, UDC_SYSCON2);
1597 else 1615 else
1598 UDC_SYSCON2_REG = UDC_DEV_CFG; 1616 omap_writew(UDC_DEV_CFG, UDC_SYSCON2);
1599 update_otg(udc); 1617 update_otg(udc);
1600 goto delegate; 1618 goto delegate;
1601 case USB_REQ_CLEAR_FEATURE: 1619 case USB_REQ_CLEAR_FEATURE:
@@ -1613,10 +1631,10 @@ static void ep0_irq(struct omap_udc *udc, u16 irq_src)
1613 || !ep->desc) 1631 || !ep->desc)
1614 goto do_stall; 1632 goto do_stall;
1615 use_ep(ep, 0); 1633 use_ep(ep, 0);
1616 UDC_CTRL_REG = udc->clr_halt; 1634 omap_writew(udc->clr_halt, UDC_CTRL);
1617 ep->ackwait = 0; 1635 ep->ackwait = 0;
1618 if (!(ep->bEndpointAddress & USB_DIR_IN)) { 1636 if (!(ep->bEndpointAddress & USB_DIR_IN)) {
1619 UDC_CTRL_REG = UDC_SET_FIFO_EN; 1637 omap_writew(UDC_SET_FIFO_EN, UDC_CTRL);
1620 ep->ackwait = 1 + ep->double_buf; 1638 ep->ackwait = 1 + ep->double_buf;
1621 } 1639 }
1622 /* NOTE: assumes the host behaves sanely, 1640 /* NOTE: assumes the host behaves sanely,
@@ -1649,15 +1667,15 @@ static void ep0_irq(struct omap_udc *udc, u16 irq_src)
1649 } 1667 }
1650 use_ep(ep, 0); 1668 use_ep(ep, 0);
1651 /* can't halt if fifo isn't empty... */ 1669 /* can't halt if fifo isn't empty... */
1652 UDC_CTRL_REG = UDC_CLR_EP; 1670 omap_writew(UDC_CLR_EP, UDC_CTRL);
1653 UDC_CTRL_REG = UDC_SET_HALT; 1671 omap_writew(UDC_SET_HALT, UDC_CTRL);
1654 VDBG("%s halted by host\n", ep->name); 1672 VDBG("%s halted by host\n", ep->name);
1655ep0out_status_stage: 1673ep0out_status_stage:
1656 status = 0; 1674 status = 0;
1657 UDC_EP_NUM_REG = UDC_EP_SEL|UDC_EP_DIR; 1675 omap_writew(UDC_EP_SEL|UDC_EP_DIR, UDC_EP_NUM);
1658 UDC_CTRL_REG = UDC_CLR_EP; 1676 omap_writew(UDC_CLR_EP, UDC_CTRL);
1659 UDC_CTRL_REG = UDC_SET_FIFO_EN; 1677 omap_writew(UDC_SET_FIFO_EN, UDC_CTRL);
1660 UDC_EP_NUM_REG = UDC_EP_DIR; 1678 omap_writew(UDC_EP_DIR, UDC_EP_NUM);
1661 udc->ep0_pending = 0; 1679 udc->ep0_pending = 0;
1662 break; 1680 break;
1663 case USB_REQ_GET_STATUS: 1681 case USB_REQ_GET_STATUS:
@@ -1694,10 +1712,10 @@ intf_status:
1694 1712
1695zero_status: 1713zero_status:
1696 /* return two zero bytes */ 1714 /* return two zero bytes */
1697 UDC_EP_NUM_REG = UDC_EP_SEL|UDC_EP_DIR; 1715 omap_writew(UDC_EP_SEL|UDC_EP_DIR, UDC_EP_NUM);
1698 UDC_DATA_REG = 0; 1716 omap_writew(0, UDC_DATA);
1699 UDC_CTRL_REG = UDC_SET_FIFO_EN; 1717 omap_writew(UDC_SET_FIFO_EN, UDC_CTRL);
1700 UDC_EP_NUM_REG = UDC_EP_DIR; 1718 omap_writew(UDC_EP_DIR, UDC_EP_NUM);
1701 status = 0; 1719 status = 0;
1702 VDBG("GET_STATUS, interface %d\n", w_index); 1720 VDBG("GET_STATUS, interface %d\n", w_index);
1703 /* next, status stage */ 1721 /* next, status stage */
@@ -1706,8 +1724,8 @@ zero_status:
1706delegate: 1724delegate:
1707 /* activate the ep0out fifo right away */ 1725 /* activate the ep0out fifo right away */
1708 if (!udc->ep0_in && w_length) { 1726 if (!udc->ep0_in && w_length) {
1709 UDC_EP_NUM_REG = 0; 1727 omap_writew(0, UDC_EP_NUM);
1710 UDC_CTRL_REG = UDC_SET_FIFO_EN; 1728 omap_writew(UDC_SET_FIFO_EN, UDC_CTRL);
1711 } 1729 }
1712 1730
1713 /* gadget drivers see class/vendor specific requests, 1731 /* gadget drivers see class/vendor specific requests,
@@ -1748,9 +1766,9 @@ do_stall:
1748 if (udc->ep0_reset_config) 1766 if (udc->ep0_reset_config)
1749 WARN("error resetting config?\n"); 1767 WARN("error resetting config?\n");
1750 else 1768 else
1751 UDC_SYSCON2_REG = UDC_CLR_CFG; 1769 omap_writew(UDC_CLR_CFG, UDC_SYSCON2);
1752 } 1770 }
1753 UDC_SYSCON2_REG = UDC_STALL_CMD; 1771 omap_writew(UDC_STALL_CMD, UDC_SYSCON2);
1754 udc->ep0_pending = 0; 1772 udc->ep0_pending = 0;
1755 } 1773 }
1756 } 1774 }
@@ -1764,7 +1782,7 @@ static void devstate_irq(struct omap_udc *udc, u16 irq_src)
1764{ 1782{
1765 u16 devstat, change; 1783 u16 devstat, change;
1766 1784
1767 devstat = UDC_DEVSTAT_REG; 1785 devstat = omap_readw(UDC_DEVSTAT);
1768 change = devstat ^ udc->devstat; 1786 change = devstat ^ udc->devstat;
1769 udc->devstat = devstat; 1787 udc->devstat = devstat;
1770 1788
@@ -1804,7 +1822,8 @@ static void devstate_irq(struct omap_udc *udc, u16 irq_src)
1804 INFO("USB reset done, gadget %s\n", 1822 INFO("USB reset done, gadget %s\n",
1805 udc->driver->driver.name); 1823 udc->driver->driver.name);
1806 /* ep0 traffic is legal from now on */ 1824 /* ep0 traffic is legal from now on */
1807 UDC_IRQ_EN_REG = UDC_DS_CHG_IE | UDC_EP0_IE; 1825 omap_writew(UDC_DS_CHG_IE | UDC_EP0_IE,
1826 UDC_IRQ_EN);
1808 } 1827 }
1809 change &= ~UDC_USB_RESET; 1828 change &= ~UDC_USB_RESET;
1810 } 1829 }
@@ -1848,7 +1867,7 @@ static void devstate_irq(struct omap_udc *udc, u16 irq_src)
1848 VDBG("devstat %03x, ignore change %03x\n", 1867 VDBG("devstat %03x, ignore change %03x\n",
1849 devstat, change); 1868 devstat, change);
1850 1869
1851 UDC_IRQ_SRC_REG = UDC_DS_CHG; 1870 omap_writew(UDC_DS_CHG, UDC_IRQ_SRC);
1852} 1871}
1853 1872
1854static irqreturn_t omap_udc_irq(int irq, void *_udc) 1873static irqreturn_t omap_udc_irq(int irq, void *_udc)
@@ -1859,7 +1878,7 @@ static irqreturn_t omap_udc_irq(int irq, void *_udc)
1859 unsigned long flags; 1878 unsigned long flags;
1860 1879
1861 spin_lock_irqsave(&udc->lock, flags); 1880 spin_lock_irqsave(&udc->lock, flags);
1862 irq_src = UDC_IRQ_SRC_REG; 1881 irq_src = omap_readw(UDC_IRQ_SRC);
1863 1882
1864 /* Device state change (usb ch9 stuff) */ 1883 /* Device state change (usb ch9 stuff) */
1865 if (irq_src & UDC_DS_CHG) { 1884 if (irq_src & UDC_DS_CHG) {
@@ -1882,7 +1901,7 @@ static irqreturn_t omap_udc_irq(int irq, void *_udc)
1882 irq_src &= ~(UDC_TXN_DONE|UDC_RXN_CNT|UDC_RXN_EOT); 1901 irq_src &= ~(UDC_TXN_DONE|UDC_RXN_CNT|UDC_RXN_EOT);
1883 } 1902 }
1884 1903
1885 irq_src &= ~(UDC_SOF|UDC_EPN_TX|UDC_EPN_RX); 1904 irq_src &= ~(UDC_IRQ_SOF | UDC_EPN_TX|UDC_EPN_RX);
1886 if (irq_src) 1905 if (irq_src)
1887 DBG("udc_irq, unhandled %03x\n", irq_src); 1906 DBG("udc_irq, unhandled %03x\n", irq_src);
1888 spin_unlock_irqrestore(&udc->lock, flags); 1907 spin_unlock_irqrestore(&udc->lock, flags);
@@ -1903,7 +1922,7 @@ static void pio_out_timer(unsigned long _ep)
1903 spin_lock_irqsave(&ep->udc->lock, flags); 1922 spin_lock_irqsave(&ep->udc->lock, flags);
1904 if (!list_empty(&ep->queue) && ep->ackwait) { 1923 if (!list_empty(&ep->queue) && ep->ackwait) {
1905 use_ep(ep, UDC_EP_SEL); 1924 use_ep(ep, UDC_EP_SEL);
1906 stat_flg = UDC_STAT_FLG_REG; 1925 stat_flg = omap_readw(UDC_STAT_FLG);
1907 1926
1908 if ((stat_flg & UDC_ACK) && (!(stat_flg & UDC_FIFO_EN) 1927 if ((stat_flg & UDC_ACK) && (!(stat_flg & UDC_FIFO_EN)
1909 || (ep->double_buf && HALF_FULL(stat_flg)))) { 1928 || (ep->double_buf && HALF_FULL(stat_flg)))) {
@@ -1913,8 +1932,8 @@ static void pio_out_timer(unsigned long _ep)
1913 req = container_of(ep->queue.next, 1932 req = container_of(ep->queue.next,
1914 struct omap_req, queue); 1933 struct omap_req, queue);
1915 (void) read_fifo(ep, req); 1934 (void) read_fifo(ep, req);
1916 UDC_EP_NUM_REG = ep->bEndpointAddress; 1935 omap_writew(ep->bEndpointAddress, UDC_EP_NUM);
1917 UDC_CTRL_REG = UDC_SET_FIFO_EN; 1936 omap_writew(UDC_SET_FIFO_EN, UDC_CTRL);
1918 ep->ackwait = 1 + ep->double_buf; 1937 ep->ackwait = 1 + ep->double_buf;
1919 } else 1938 } else
1920 deselect_ep(); 1939 deselect_ep();
@@ -1934,20 +1953,20 @@ static irqreturn_t omap_udc_pio_irq(int irq, void *_dev)
1934 unsigned long flags; 1953 unsigned long flags;
1935 1954
1936 spin_lock_irqsave(&udc->lock, flags); 1955 spin_lock_irqsave(&udc->lock, flags);
1937 epn_stat = UDC_EPN_STAT_REG; 1956 epn_stat = omap_readw(UDC_EPN_STAT);
1938 irq_src = UDC_IRQ_SRC_REG; 1957 irq_src = omap_readw(UDC_IRQ_SRC);
1939 1958
1940 /* handle OUT first, to avoid some wasteful NAKs */ 1959 /* handle OUT first, to avoid some wasteful NAKs */
1941 if (irq_src & UDC_EPN_RX) { 1960 if (irq_src & UDC_EPN_RX) {
1942 epnum = (epn_stat >> 8) & 0x0f; 1961 epnum = (epn_stat >> 8) & 0x0f;
1943 UDC_IRQ_SRC_REG = UDC_EPN_RX; 1962 omap_writew(UDC_EPN_RX, UDC_IRQ_SRC);
1944 status = IRQ_HANDLED; 1963 status = IRQ_HANDLED;
1945 ep = &udc->ep[epnum]; 1964 ep = &udc->ep[epnum];
1946 ep->irqs++; 1965 ep->irqs++;
1947 1966
1948 UDC_EP_NUM_REG = epnum | UDC_EP_SEL; 1967 omap_writew(epnum | UDC_EP_SEL, UDC_EP_NUM);
1949 ep->fnf = 0; 1968 ep->fnf = 0;
1950 if ((UDC_STAT_FLG_REG & UDC_ACK)) { 1969 if (omap_readw(UDC_STAT_FLG) & UDC_ACK) {
1951 ep->ackwait--; 1970 ep->ackwait--;
1952 if (!list_empty(&ep->queue)) { 1971 if (!list_empty(&ep->queue)) {
1953 int stat; 1972 int stat;
@@ -1959,15 +1978,15 @@ static irqreturn_t omap_udc_pio_irq(int irq, void *_dev)
1959 } 1978 }
1960 } 1979 }
1961 /* min 6 clock delay before clearing EP_SEL ... */ 1980 /* min 6 clock delay before clearing EP_SEL ... */
1962 epn_stat = UDC_EPN_STAT_REG; 1981 epn_stat = omap_readw(UDC_EPN_STAT);
1963 epn_stat = UDC_EPN_STAT_REG; 1982 epn_stat = omap_readw(UDC_EPN_STAT);
1964 UDC_EP_NUM_REG = epnum; 1983 omap_writew(epnum, UDC_EP_NUM);
1965 1984
1966 /* enabling fifo _after_ clearing ACK, contrary to docs, 1985 /* enabling fifo _after_ clearing ACK, contrary to docs,
1967 * reduces lossage; timer still needed though (sigh). 1986 * reduces lossage; timer still needed though (sigh).
1968 */ 1987 */
1969 if (ep->fnf) { 1988 if (ep->fnf) {
1970 UDC_CTRL_REG = UDC_SET_FIFO_EN; 1989 omap_writew(UDC_SET_FIFO_EN, UDC_CTRL);
1971 ep->ackwait = 1 + ep->double_buf; 1990 ep->ackwait = 1 + ep->double_buf;
1972 } 1991 }
1973 mod_timer(&ep->timer, PIO_OUT_TIMEOUT); 1992 mod_timer(&ep->timer, PIO_OUT_TIMEOUT);
@@ -1976,13 +1995,13 @@ static irqreturn_t omap_udc_pio_irq(int irq, void *_dev)
1976 /* then IN transfers */ 1995 /* then IN transfers */
1977 else if (irq_src & UDC_EPN_TX) { 1996 else if (irq_src & UDC_EPN_TX) {
1978 epnum = epn_stat & 0x0f; 1997 epnum = epn_stat & 0x0f;
1979 UDC_IRQ_SRC_REG = UDC_EPN_TX; 1998 omap_writew(UDC_EPN_TX, UDC_IRQ_SRC);
1980 status = IRQ_HANDLED; 1999 status = IRQ_HANDLED;
1981 ep = &udc->ep[16 + epnum]; 2000 ep = &udc->ep[16 + epnum];
1982 ep->irqs++; 2001 ep->irqs++;
1983 2002
1984 UDC_EP_NUM_REG = epnum | UDC_EP_DIR | UDC_EP_SEL; 2003 omap_writew(epnum | UDC_EP_DIR | UDC_EP_SEL, UDC_EP_NUM);
1985 if ((UDC_STAT_FLG_REG & UDC_ACK)) { 2004 if (omap_readw(UDC_STAT_FLG) & UDC_ACK) {
1986 ep->ackwait = 0; 2005 ep->ackwait = 0;
1987 if (!list_empty(&ep->queue)) { 2006 if (!list_empty(&ep->queue)) {
1988 req = container_of(ep->queue.next, 2007 req = container_of(ep->queue.next,
@@ -1991,9 +2010,9 @@ static irqreturn_t omap_udc_pio_irq(int irq, void *_dev)
1991 } 2010 }
1992 } 2011 }
1993 /* min 6 clock delay before clearing EP_SEL ... */ 2012 /* min 6 clock delay before clearing EP_SEL ... */
1994 epn_stat = UDC_EPN_STAT_REG; 2013 epn_stat = omap_readw(UDC_EPN_STAT);
1995 epn_stat = UDC_EPN_STAT_REG; 2014 epn_stat = omap_readw(UDC_EPN_STAT);
1996 UDC_EP_NUM_REG = epnum | UDC_EP_DIR; 2015 omap_writew(epnum | UDC_EP_DIR, UDC_EP_NUM);
1997 /* then 6 clocks before it'd tx */ 2016 /* then 6 clocks before it'd tx */
1998 } 2017 }
1999 2018
@@ -2021,7 +2040,7 @@ static irqreturn_t omap_udc_iso_irq(int irq, void *_dev)
2021 req = list_entry(ep->queue.next, struct omap_req, queue); 2040 req = list_entry(ep->queue.next, struct omap_req, queue);
2022 2041
2023 use_ep(ep, UDC_EP_SEL); 2042 use_ep(ep, UDC_EP_SEL);
2024 stat = UDC_STAT_FLG_REG; 2043 stat = omap_readw(UDC_STAT_FLG);
2025 2044
2026 /* NOTE: like the other controller drivers, this isn't 2045 /* NOTE: like the other controller drivers, this isn't
2027 * currently reporting lost or damaged frames. 2046 * currently reporting lost or damaged frames.
@@ -2053,9 +2072,14 @@ static irqreturn_t omap_udc_iso_irq(int irq, void *_dev)
2053 if (!list_empty(&ep->queue)) 2072 if (!list_empty(&ep->queue))
2054 pending = 1; 2073 pending = 1;
2055 } 2074 }
2056 if (!pending) 2075 if (!pending) {
2057 UDC_IRQ_EN_REG &= ~UDC_SOF_IE; 2076 u16 w;
2058 UDC_IRQ_SRC_REG = UDC_SOF; 2077
2078 w = omap_readw(UDC_IRQ_EN);
2079 w &= ~UDC_SOF_IE;
2080 omap_writew(w, UDC_IRQ_EN);
2081 }
2082 omap_writew(UDC_IRQ_SOF, UDC_IRQ_SRC);
2059 2083
2060 spin_unlock_irqrestore(&udc->lock, flags); 2084 spin_unlock_irqrestore(&udc->lock, flags);
2061 return IRQ_HANDLED; 2085 return IRQ_HANDLED;
@@ -2104,7 +2128,7 @@ int usb_gadget_register_driver (struct usb_gadget_driver *driver)
2104 if (ep->bmAttributes == USB_ENDPOINT_XFER_ISOC) 2128 if (ep->bmAttributes == USB_ENDPOINT_XFER_ISOC)
2105 continue; 2129 continue;
2106 use_ep(ep, 0); 2130 use_ep(ep, 0);
2107 UDC_CTRL_REG = UDC_SET_HALT; 2131 omap_writew(UDC_SET_HALT, UDC_CTRL);
2108 } 2132 }
2109 udc->ep0_pending = 0; 2133 udc->ep0_pending = 0;
2110 udc->ep[0].irqs = 0; 2134 udc->ep[0].irqs = 0;
@@ -2128,7 +2152,7 @@ int usb_gadget_register_driver (struct usb_gadget_driver *driver)
2128 } 2152 }
2129 DBG("bound to driver %s\n", driver->driver.name); 2153 DBG("bound to driver %s\n", driver->driver.name);
2130 2154
2131 UDC_IRQ_SRC_REG = UDC_IRQ_SRC_MASK; 2155 omap_writew(UDC_IRQ_SRC_MASK, UDC_IRQ_SRC);
2132 2156
2133 /* connect to bus through transceiver */ 2157 /* connect to bus through transceiver */
2134 if (udc->transceiver) { 2158 if (udc->transceiver) {
@@ -2225,7 +2249,7 @@ static void proc_ep_show(struct seq_file *s, struct omap_ep *ep)
2225 else 2249 else
2226 buf[0] = 0; 2250 buf[0] = 0;
2227 2251
2228 stat_flg = UDC_STAT_FLG_REG; 2252 stat_flg = omap_readw(UDC_STAT_FLG);
2229 seq_printf(s, 2253 seq_printf(s,
2230 "\n%s %s%s%sirqs %ld stat %04x " EIGHTBITS FOURBITS "%s\n", 2254 "\n%s %s%s%sirqs %ld stat %04x " EIGHTBITS FOURBITS "%s\n",
2231 ep->name, buf, 2255 ep->name, buf,
@@ -2292,11 +2316,11 @@ static int proc_otg_show(struct seq_file *s)
2292 trans = CONTROL_DEVCONF_REG; 2316 trans = CONTROL_DEVCONF_REG;
2293 } else { 2317 } else {
2294 ctrl_name = "tranceiver_ctrl"; 2318 ctrl_name = "tranceiver_ctrl";
2295 trans = USB_TRANSCEIVER_CTRL_REG; 2319 trans = omap_readw(USB_TRANSCEIVER_CTRL);
2296 } 2320 }
2297 seq_printf(s, "\nOTG rev %d.%d, %s %05x\n", 2321 seq_printf(s, "\nOTG rev %d.%d, %s %05x\n",
2298 tmp >> 4, tmp & 0xf, ctrl_name, trans); 2322 tmp >> 4, tmp & 0xf, ctrl_name, trans);
2299 tmp = OTG_SYSCON_1_REG; 2323 tmp = omap_readw(OTG_SYSCON_1);
2300 seq_printf(s, "otg_syscon1 %08x usb2 %s, usb1 %s, usb0 %s," 2324 seq_printf(s, "otg_syscon1 %08x usb2 %s, usb1 %s, usb0 %s,"
2301 FOURBITS "\n", tmp, 2325 FOURBITS "\n", tmp,
2302 trx_mode(USB2_TRX_MODE(tmp), trans & CONF_USB2_UNI_R), 2326 trx_mode(USB2_TRX_MODE(tmp), trans & CONF_USB2_UNI_R),
@@ -2308,7 +2332,7 @@ static int proc_otg_show(struct seq_file *s)
2308 (tmp & HST_IDLE_EN) ? " !host" : "", 2332 (tmp & HST_IDLE_EN) ? " !host" : "",
2309 (tmp & DEV_IDLE_EN) ? " !dev" : "", 2333 (tmp & DEV_IDLE_EN) ? " !dev" : "",
2310 (tmp & OTG_RESET_DONE) ? " reset_done" : " reset_active"); 2334 (tmp & OTG_RESET_DONE) ? " reset_done" : " reset_active");
2311 tmp = OTG_SYSCON_2_REG; 2335 tmp = omap_readl(OTG_SYSCON_2);
2312 seq_printf(s, "otg_syscon2 %08x%s" EIGHTBITS 2336 seq_printf(s, "otg_syscon2 %08x%s" EIGHTBITS
2313 " b_ase_brst=%d hmc=%d\n", tmp, 2337 " b_ase_brst=%d hmc=%d\n", tmp,
2314 (tmp & OTG_EN) ? " otg_en" : "", 2338 (tmp & OTG_EN) ? " otg_en" : "",
@@ -2323,7 +2347,7 @@ static int proc_otg_show(struct seq_file *s)
2323 (tmp & HMC_TLLATTACH) ? " tllattach" : "", 2347 (tmp & HMC_TLLATTACH) ? " tllattach" : "",
2324 B_ASE_BRST(tmp), 2348 B_ASE_BRST(tmp),
2325 OTG_HMC(tmp)); 2349 OTG_HMC(tmp));
2326 tmp = OTG_CTRL_REG; 2350 tmp = omap_readl(OTG_CTRL);
2327 seq_printf(s, "otg_ctrl %06x" EIGHTBITS EIGHTBITS "%s\n", tmp, 2351 seq_printf(s, "otg_ctrl %06x" EIGHTBITS EIGHTBITS "%s\n", tmp,
2328 (tmp & OTG_ASESSVLD) ? " asess" : "", 2352 (tmp & OTG_ASESSVLD) ? " asess" : "",
2329 (tmp & OTG_BSESSEND) ? " bsess_end" : "", 2353 (tmp & OTG_BSESSEND) ? " bsess_end" : "",
@@ -2343,13 +2367,13 @@ static int proc_otg_show(struct seq_file *s)
2343 (tmp & OTG_PU_VBUS) ? " pu_vb" : "", 2367 (tmp & OTG_PU_VBUS) ? " pu_vb" : "",
2344 (tmp & OTG_PU_ID) ? " pu_id" : "" 2368 (tmp & OTG_PU_ID) ? " pu_id" : ""
2345 ); 2369 );
2346 tmp = OTG_IRQ_EN_REG; 2370 tmp = omap_readw(OTG_IRQ_EN);
2347 seq_printf(s, "otg_irq_en %04x" "\n", tmp); 2371 seq_printf(s, "otg_irq_en %04x" "\n", tmp);
2348 tmp = OTG_IRQ_SRC_REG; 2372 tmp = omap_readw(OTG_IRQ_SRC);
2349 seq_printf(s, "otg_irq_src %04x" "\n", tmp); 2373 seq_printf(s, "otg_irq_src %04x" "\n", tmp);
2350 tmp = OTG_OUTCTRL_REG; 2374 tmp = omap_readw(OTG_OUTCTRL);
2351 seq_printf(s, "otg_outctrl %04x" "\n", tmp); 2375 seq_printf(s, "otg_outctrl %04x" "\n", tmp);
2352 tmp = OTG_TEST_REG; 2376 tmp = omap_readw(OTG_TEST);
2353 seq_printf(s, "otg_test %04x" "\n", tmp); 2377 seq_printf(s, "otg_test %04x" "\n", tmp);
2354 return 0; 2378 return 0;
2355} 2379}
@@ -2370,7 +2394,7 @@ static int proc_udc_show(struct seq_file *s, void *_)
2370 driver_desc, 2394 driver_desc,
2371 use_dma ? " (dma)" : ""); 2395 use_dma ? " (dma)" : "");
2372 2396
2373 tmp = UDC_REV_REG & 0xff; 2397 tmp = omap_readw(UDC_REV) & 0xff;
2374 seq_printf(s, 2398 seq_printf(s,
2375 "UDC rev %d.%d, fifo mode %d, gadget %s\n" 2399 "UDC rev %d.%d, fifo mode %d, gadget %s\n"
2376 "hmc %d, transceiver %s\n", 2400 "hmc %d, transceiver %s\n",
@@ -2384,16 +2408,16 @@ static int proc_udc_show(struct seq_file *s, void *_)
2384 ? "external" : "(none)")); 2408 ? "external" : "(none)"));
2385 if (cpu_class_is_omap1()) { 2409 if (cpu_class_is_omap1()) {
2386 seq_printf(s, "ULPD control %04x req %04x status %04x\n", 2410 seq_printf(s, "ULPD control %04x req %04x status %04x\n",
2387 __REG16(ULPD_CLOCK_CTRL), 2411 omap_readw(ULPD_CLOCK_CTRL),
2388 __REG16(ULPD_SOFT_REQ), 2412 omap_readw(ULPD_SOFT_REQ),
2389 __REG16(ULPD_STATUS_REQ)); 2413 omap_readw(ULPD_STATUS_REQ));
2390 } 2414 }
2391 2415
2392 /* OTG controller registers */ 2416 /* OTG controller registers */
2393 if (!cpu_is_omap15xx()) 2417 if (!cpu_is_omap15xx())
2394 proc_otg_show(s); 2418 proc_otg_show(s);
2395 2419
2396 tmp = UDC_SYSCON1_REG; 2420 tmp = omap_readw(UDC_SYSCON1);
2397 seq_printf(s, "\nsyscon1 %04x" EIGHTBITS "\n", tmp, 2421 seq_printf(s, "\nsyscon1 %04x" EIGHTBITS "\n", tmp,
2398 (tmp & UDC_CFG_LOCK) ? " cfg_lock" : "", 2422 (tmp & UDC_CFG_LOCK) ? " cfg_lock" : "",
2399 (tmp & UDC_DATA_ENDIAN) ? " data_endian" : "", 2423 (tmp & UDC_DATA_ENDIAN) ? " data_endian" : "",
@@ -2412,7 +2436,7 @@ static int proc_udc_show(struct seq_file *s, void *_)
2412 return 0; 2436 return 0;
2413 } 2437 }
2414 2438
2415 tmp = UDC_DEVSTAT_REG; 2439 tmp = omap_readw(UDC_DEVSTAT);
2416 seq_printf(s, "devstat %04x" EIGHTBITS "%s%s\n", tmp, 2440 seq_printf(s, "devstat %04x" EIGHTBITS "%s%s\n", tmp,
2417 (tmp & UDC_B_HNP_ENABLE) ? " b_hnp" : "", 2441 (tmp & UDC_B_HNP_ENABLE) ? " b_hnp" : "",
2418 (tmp & UDC_A_HNP_SUPPORT) ? " a_hnp" : "", 2442 (tmp & UDC_A_HNP_SUPPORT) ? " a_hnp" : "",
@@ -2424,20 +2448,20 @@ static int proc_udc_show(struct seq_file *s, void *_)
2424 (tmp & UDC_ADD) ? " ADD" : "", 2448 (tmp & UDC_ADD) ? " ADD" : "",
2425 (tmp & UDC_DEF) ? " DEF" : "", 2449 (tmp & UDC_DEF) ? " DEF" : "",
2426 (tmp & UDC_ATT) ? " ATT" : ""); 2450 (tmp & UDC_ATT) ? " ATT" : "");
2427 seq_printf(s, "sof %04x\n", UDC_SOF_REG); 2451 seq_printf(s, "sof %04x\n", omap_readw(UDC_SOF));
2428 tmp = UDC_IRQ_EN_REG; 2452 tmp = omap_readw(UDC_IRQ_EN);
2429 seq_printf(s, "irq_en %04x" FOURBITS "%s\n", tmp, 2453 seq_printf(s, "irq_en %04x" FOURBITS "%s\n", tmp,
2430 (tmp & UDC_SOF_IE) ? " sof" : "", 2454 (tmp & UDC_SOF_IE) ? " sof" : "",
2431 (tmp & UDC_EPN_RX_IE) ? " epn_rx" : "", 2455 (tmp & UDC_EPN_RX_IE) ? " epn_rx" : "",
2432 (tmp & UDC_EPN_TX_IE) ? " epn_tx" : "", 2456 (tmp & UDC_EPN_TX_IE) ? " epn_tx" : "",
2433 (tmp & UDC_DS_CHG_IE) ? " ds_chg" : "", 2457 (tmp & UDC_DS_CHG_IE) ? " ds_chg" : "",
2434 (tmp & UDC_EP0_IE) ? " ep0" : ""); 2458 (tmp & UDC_EP0_IE) ? " ep0" : "");
2435 tmp = UDC_IRQ_SRC_REG; 2459 tmp = omap_readw(UDC_IRQ_SRC);
2436 seq_printf(s, "irq_src %04x" EIGHTBITS "%s%s\n", tmp, 2460 seq_printf(s, "irq_src %04x" EIGHTBITS "%s%s\n", tmp,
2437 (tmp & UDC_TXN_DONE) ? " txn_done" : "", 2461 (tmp & UDC_TXN_DONE) ? " txn_done" : "",
2438 (tmp & UDC_RXN_CNT) ? " rxn_cnt" : "", 2462 (tmp & UDC_RXN_CNT) ? " rxn_cnt" : "",
2439 (tmp & UDC_RXN_EOT) ? " rxn_eot" : "", 2463 (tmp & UDC_RXN_EOT) ? " rxn_eot" : "",
2440 (tmp & UDC_SOF) ? " sof" : "", 2464 (tmp & UDC_IRQ_SOF) ? " sof" : "",
2441 (tmp & UDC_EPN_RX) ? " epn_rx" : "", 2465 (tmp & UDC_EPN_RX) ? " epn_rx" : "",
2442 (tmp & UDC_EPN_TX) ? " epn_tx" : "", 2466 (tmp & UDC_EPN_TX) ? " epn_tx" : "",
2443 (tmp & UDC_DS_CHG) ? " ds_chg" : "", 2467 (tmp & UDC_DS_CHG) ? " ds_chg" : "",
@@ -2447,7 +2471,7 @@ static int proc_udc_show(struct seq_file *s, void *_)
2447 if (use_dma) { 2471 if (use_dma) {
2448 unsigned i; 2472 unsigned i;
2449 2473
2450 tmp = UDC_DMA_IRQ_EN_REG; 2474 tmp = omap_readw(UDC_DMA_IRQ_EN);
2451 seq_printf(s, "dma_irq_en %04x%s" EIGHTBITS "\n", tmp, 2475 seq_printf(s, "dma_irq_en %04x%s" EIGHTBITS "\n", tmp,
2452 (tmp & UDC_TX_DONE_IE(3)) ? " tx2_done" : "", 2476 (tmp & UDC_TX_DONE_IE(3)) ? " tx2_done" : "",
2453 (tmp & UDC_RX_CNT_IE(3)) ? " rx2_cnt" : "", 2477 (tmp & UDC_RX_CNT_IE(3)) ? " rx2_cnt" : "",
@@ -2461,29 +2485,29 @@ static int proc_udc_show(struct seq_file *s, void *_)
2461 (tmp & UDC_RX_CNT_IE(1)) ? " rx0_cnt" : "", 2485 (tmp & UDC_RX_CNT_IE(1)) ? " rx0_cnt" : "",
2462 (tmp & UDC_RX_EOT_IE(1)) ? " rx0_eot" : ""); 2486 (tmp & UDC_RX_EOT_IE(1)) ? " rx0_eot" : "");
2463 2487
2464 tmp = UDC_RXDMA_CFG_REG; 2488 tmp = omap_readw(UDC_RXDMA_CFG);
2465 seq_printf(s, "rxdma_cfg %04x\n", tmp); 2489 seq_printf(s, "rxdma_cfg %04x\n", tmp);
2466 if (tmp) { 2490 if (tmp) {
2467 for (i = 0; i < 3; i++) { 2491 for (i = 0; i < 3; i++) {
2468 if ((tmp & (0x0f << (i * 4))) == 0) 2492 if ((tmp & (0x0f << (i * 4))) == 0)
2469 continue; 2493 continue;
2470 seq_printf(s, "rxdma[%d] %04x\n", i, 2494 seq_printf(s, "rxdma[%d] %04x\n", i,
2471 UDC_RXDMA_REG(i + 1)); 2495 omap_readw(UDC_RXDMA(i + 1)));
2472 } 2496 }
2473 } 2497 }
2474 tmp = UDC_TXDMA_CFG_REG; 2498 tmp = omap_readw(UDC_TXDMA_CFG);
2475 seq_printf(s, "txdma_cfg %04x\n", tmp); 2499 seq_printf(s, "txdma_cfg %04x\n", tmp);
2476 if (tmp) { 2500 if (tmp) {
2477 for (i = 0; i < 3; i++) { 2501 for (i = 0; i < 3; i++) {
2478 if (!(tmp & (0x0f << (i * 4)))) 2502 if (!(tmp & (0x0f << (i * 4))))
2479 continue; 2503 continue;
2480 seq_printf(s, "txdma[%d] %04x\n", i, 2504 seq_printf(s, "txdma[%d] %04x\n", i,
2481 UDC_TXDMA_REG(i + 1)); 2505 omap_readw(UDC_TXDMA(i + 1)));
2482 } 2506 }
2483 } 2507 }
2484 } 2508 }
2485 2509
2486 tmp = UDC_DEVSTAT_REG; 2510 tmp = omap_readw(UDC_DEVSTAT);
2487 if (tmp & UDC_ATT) { 2511 if (tmp & UDC_ATT) {
2488 proc_ep_show(s, &udc->ep[0]); 2512 proc_ep_show(s, &udc->ep[0]);
2489 if (tmp & UDC_ADD) { 2513 if (tmp & UDC_ADD) {
@@ -2535,7 +2559,7 @@ static inline void remove_proc_file(void) {}
2535 * buffer space among the endpoints we'll be operating. 2559 * buffer space among the endpoints we'll be operating.
2536 * 2560 *
2537 * NOTE: as of OMAP 1710 ES2.0, writing a new endpoint config when 2561 * NOTE: as of OMAP 1710 ES2.0, writing a new endpoint config when
2538 * UDC_SYSCON_1_REG.CFG_LOCK is set can now work. We won't use that 2562 * UDC_SYSCON_1.CFG_LOCK is set can now work. We won't use that
2539 * capability yet though. 2563 * capability yet though.
2540 */ 2564 */
2541static unsigned __init 2565static unsigned __init
@@ -2597,9 +2621,9 @@ omap_ep_setup(char *name, u8 addr, u8 type,
2597 name, addr, epn_rxtx, maxp, dbuf ? "x2" : "", buf); 2621 name, addr, epn_rxtx, maxp, dbuf ? "x2" : "", buf);
2598 2622
2599 if (addr & USB_DIR_IN) 2623 if (addr & USB_DIR_IN)
2600 UDC_EP_TX_REG(addr & 0xf) = epn_rxtx; 2624 omap_writew(epn_rxtx, UDC_EP_TX(addr & 0xf));
2601 else 2625 else
2602 UDC_EP_RX_REG(addr) = epn_rxtx; 2626 omap_writew(epn_rxtx, UDC_EP_RX(addr));
2603 2627
2604 /* next endpoint's buffer starts after this one's */ 2628 /* next endpoint's buffer starts after this one's */
2605 buf += maxp; 2629 buf += maxp;
@@ -2638,15 +2662,15 @@ omap_udc_setup(struct platform_device *odev, struct otg_transceiver *xceiv)
2638 unsigned tmp, buf; 2662 unsigned tmp, buf;
2639 2663
2640 /* abolish any previous hardware state */ 2664 /* abolish any previous hardware state */
2641 UDC_SYSCON1_REG = 0; 2665 omap_writew(0, UDC_SYSCON1);
2642 UDC_IRQ_EN_REG = 0; 2666 omap_writew(0, UDC_IRQ_EN);
2643 UDC_IRQ_SRC_REG = UDC_IRQ_SRC_MASK; 2667 omap_writew(UDC_IRQ_SRC_MASK, UDC_IRQ_SRC);
2644 UDC_DMA_IRQ_EN_REG = 0; 2668 omap_writew(0, UDC_DMA_IRQ_EN);
2645 UDC_RXDMA_CFG_REG = 0; 2669 omap_writew(0, UDC_RXDMA_CFG);
2646 UDC_TXDMA_CFG_REG = 0; 2670 omap_writew(0, UDC_TXDMA_CFG);
2647 2671
2648 /* UDC_PULLUP_EN gates the chip clock */ 2672 /* UDC_PULLUP_EN gates the chip clock */
2649 // OTG_SYSCON_1_REG |= DEV_IDLE_EN; 2673 // OTG_SYSCON_1 |= DEV_IDLE_EN;
2650 2674
2651 udc = kzalloc(sizeof(*udc), GFP_KERNEL); 2675 udc = kzalloc(sizeof(*udc), GFP_KERNEL);
2652 if (!udc) 2676 if (!udc)
@@ -2677,8 +2701,8 @@ omap_udc_setup(struct platform_device *odev, struct otg_transceiver *xceiv)
2677 2701
2678 /* initially disable all non-ep0 endpoints */ 2702 /* initially disable all non-ep0 endpoints */
2679 for (tmp = 1; tmp < 15; tmp++) { 2703 for (tmp = 1; tmp < 15; tmp++) {
2680 UDC_EP_RX_REG(tmp) = 0; 2704 omap_writew(0, UDC_EP_RX(tmp));
2681 UDC_EP_TX_REG(tmp) = 0; 2705 omap_writew(0, UDC_EP_TX(tmp));
2682 } 2706 }
2683 2707
2684#define OMAP_BULK_EP(name,addr) \ 2708#define OMAP_BULK_EP(name,addr) \
@@ -2763,7 +2787,7 @@ omap_udc_setup(struct platform_device *odev, struct otg_transceiver *xceiv)
2763 ERR("unsupported fifo_mode #%d\n", fifo_mode); 2787 ERR("unsupported fifo_mode #%d\n", fifo_mode);
2764 return -ENODEV; 2788 return -ENODEV;
2765 } 2789 }
2766 UDC_SYSCON1_REG = UDC_CFG_LOCK|UDC_SELF_PWR; 2790 omap_writew(UDC_CFG_LOCK|UDC_SELF_PWR, UDC_SYSCON1);
2767 INFO("fifo mode %d, %d bytes not used\n", fifo_mode, 2048 - buf); 2791 INFO("fifo mode %d, %d bytes not used\n", fifo_mode, 2048 - buf);
2768 return 0; 2792 return 0;
2769} 2793}
@@ -2807,7 +2831,7 @@ static int __init omap_udc_probe(struct platform_device *pdev)
2807 } 2831 }
2808 2832
2809 INFO("OMAP UDC rev %d.%d%s\n", 2833 INFO("OMAP UDC rev %d.%d%s\n",
2810 UDC_REV_REG >> 4, UDC_REV_REG & 0xf, 2834 omap_readw(UDC_REV) >> 4, omap_readw(UDC_REV) & 0xf,
2811 config->otg ? ", Mini-AB" : ""); 2835 config->otg ? ", Mini-AB" : "");
2812 2836
2813 /* use the mode given to us by board init code */ 2837 /* use the mode given to us by board init code */
@@ -2822,12 +2846,12 @@ static int __init omap_udc_probe(struct platform_device *pdev)
2822 * know when to turn PULLUP_EN on/off; and that 2846 * know when to turn PULLUP_EN on/off; and that
2823 * means we always "need" the 48MHz clock. 2847 * means we always "need" the 48MHz clock.
2824 */ 2848 */
2825 u32 tmp = FUNC_MUX_CTRL_0_REG; 2849 u32 tmp = omap_readl(FUNC_MUX_CTRL_0);
2826 2850 tmp &= ~VBUS_CTRL_1510;
2827 FUNC_MUX_CTRL_0_REG &= ~VBUS_CTRL_1510; 2851 omap_writel(tmp, FUNC_MUX_CTRL_0);
2828 tmp |= VBUS_MODE_1510; 2852 tmp |= VBUS_MODE_1510;
2829 tmp &= ~VBUS_CTRL_1510; 2853 tmp &= ~VBUS_CTRL_1510;
2830 FUNC_MUX_CTRL_0_REG = tmp; 2854 omap_writel(tmp, FUNC_MUX_CTRL_0);
2831 } 2855 }
2832 } else { 2856 } else {
2833 /* The transceiver may package some GPIO logic or handle 2857 /* The transceiver may package some GPIO logic or handle
@@ -2907,7 +2931,7 @@ known:
2907#endif 2931#endif
2908 2932
2909 /* starting with omap1710 es2.0, clear toggle is a separate bit */ 2933 /* starting with omap1710 es2.0, clear toggle is a separate bit */
2910 if (UDC_REV_REG >= 0x61) 2934 if (omap_readw(UDC_REV) >= 0x61)
2911 udc->clr_halt = UDC_RESET_EP | UDC_CLRDATA_TOGGLE; 2935 udc->clr_halt = UDC_RESET_EP | UDC_CLRDATA_TOGGLE;
2912 else 2936 else
2913 udc->clr_halt = UDC_RESET_EP; 2937 udc->clr_halt = UDC_RESET_EP;
@@ -3005,7 +3029,7 @@ static int __exit omap_udc_remove(struct platform_device *pdev)
3005 put_device(udc->transceiver->dev); 3029 put_device(udc->transceiver->dev);
3006 udc->transceiver = NULL; 3030 udc->transceiver = NULL;
3007 } 3031 }
3008 UDC_SYSCON1_REG = 0; 3032 omap_writew(0, UDC_SYSCON1);
3009 3033
3010 remove_proc_file(); 3034 remove_proc_file();
3011 3035
@@ -3036,7 +3060,7 @@ static int __exit omap_udc_remove(struct platform_device *pdev)
3036 * 3060 *
3037 * REVISIT we should probably reject suspend requests when there's a host 3061 * REVISIT we should probably reject suspend requests when there's a host
3038 * session active, rather than disconnecting, at least on boards that can 3062 * session active, rather than disconnecting, at least on boards that can
3039 * report VBUS irqs (UDC_DEVSTAT_REG.UDC_ATT). And in any case, we need to 3063 * report VBUS irqs (UDC_DEVSTAT.UDC_ATT). And in any case, we need to
3040 * make host resumes and VBUS detection trigger OMAP wakeup events; that 3064 * make host resumes and VBUS detection trigger OMAP wakeup events; that
3041 * may involve talking to an external transceiver (e.g. isp1301). 3065 * may involve talking to an external transceiver (e.g. isp1301).
3042 */ 3066 */
@@ -3045,7 +3069,7 @@ static int omap_udc_suspend(struct platform_device *dev, pm_message_t message)
3045{ 3069{
3046 u32 devstat; 3070 u32 devstat;
3047 3071
3048 devstat = UDC_DEVSTAT_REG; 3072 devstat = omap_readw(UDC_DEVSTAT);
3049 3073
3050 /* we're requesting 48 MHz clock if the pullup is enabled 3074 /* we're requesting 48 MHz clock if the pullup is enabled
3051 * (== we're attached to the host) and we're not suspended, 3075 * (== we're attached to the host) and we're not suspended,
diff --git a/drivers/usb/gadget/omap_udc.h b/drivers/usb/gadget/omap_udc.h
index c6b9cbc7230a..8522bbb12278 100644
--- a/drivers/usb/gadget/omap_udc.h
+++ b/drivers/usb/gadget/omap_udc.h
@@ -8,23 +8,22 @@
8/* 8/*
9 * USB device/endpoint management registers 9 * USB device/endpoint management registers
10 */ 10 */
11#define UDC_REG(offset) __REG16(UDC_BASE + (offset))
12 11
13#define UDC_REV_REG UDC_REG(0x0) /* Revision */ 12#define UDC_REV (UDC_BASE + 0x0) /* Revision */
14#define UDC_EP_NUM_REG UDC_REG(0x4) /* Which endpoint */ 13#define UDC_EP_NUM (UDC_BASE + 0x4) /* Which endpoint */
15# define UDC_SETUP_SEL (1 << 6) 14# define UDC_SETUP_SEL (1 << 6)
16# define UDC_EP_SEL (1 << 5) 15# define UDC_EP_SEL (1 << 5)
17# define UDC_EP_DIR (1 << 4) 16# define UDC_EP_DIR (1 << 4)
18 /* low 4 bits for endpoint number */ 17 /* low 4 bits for endpoint number */
19#define UDC_DATA_REG UDC_REG(0x08) /* Endpoint FIFO */ 18#define UDC_DATA (UDC_BASE + 0x08) /* Endpoint FIFO */
20#define UDC_CTRL_REG UDC_REG(0x0C) /* Endpoint control */ 19#define UDC_CTRL (UDC_BASE + 0x0C) /* Endpoint control */
21# define UDC_CLR_HALT (1 << 7) 20# define UDC_CLR_HALT (1 << 7)
22# define UDC_SET_HALT (1 << 6) 21# define UDC_SET_HALT (1 << 6)
23# define UDC_CLRDATA_TOGGLE (1 << 3) 22# define UDC_CLRDATA_TOGGLE (1 << 3)
24# define UDC_SET_FIFO_EN (1 << 2) 23# define UDC_SET_FIFO_EN (1 << 2)
25# define UDC_CLR_EP (1 << 1) 24# define UDC_CLR_EP (1 << 1)
26# define UDC_RESET_EP (1 << 0) 25# define UDC_RESET_EP (1 << 0)
27#define UDC_STAT_FLG_REG UDC_REG(0x10) /* Endpoint status */ 26#define UDC_STAT_FLG (UDC_BASE + 0x10) /* Endpoint status */
28# define UDC_NO_RXPACKET (1 << 15) 27# define UDC_NO_RXPACKET (1 << 15)
29# define UDC_MISS_IN (1 << 14) 28# define UDC_MISS_IN (1 << 14)
30# define UDC_DATA_FLUSH (1 << 13) 29# define UDC_DATA_FLUSH (1 << 13)
@@ -38,8 +37,8 @@
38# define UDC_FIFO_EN (1 << 2) 37# define UDC_FIFO_EN (1 << 2)
39# define UDC_NON_ISO_FIFO_EMPTY (1 << 1) 38# define UDC_NON_ISO_FIFO_EMPTY (1 << 1)
40# define UDC_NON_ISO_FIFO_FULL (1 << 0) 39# define UDC_NON_ISO_FIFO_FULL (1 << 0)
41#define UDC_RXFSTAT_REG UDC_REG(0x14) /* OUT bytecount */ 40#define UDC_RXFSTAT (UDC_BASE + 0x14) /* OUT bytecount */
42#define UDC_SYSCON1_REG UDC_REG(0x18) /* System config 1 */ 41#define UDC_SYSCON1 (UDC_BASE + 0x18) /* System config 1 */
43# define UDC_CFG_LOCK (1 << 8) 42# define UDC_CFG_LOCK (1 << 8)
44# define UDC_DATA_ENDIAN (1 << 7) 43# define UDC_DATA_ENDIAN (1 << 7)
45# define UDC_DMA_ENDIAN (1 << 6) 44# define UDC_DMA_ENDIAN (1 << 6)
@@ -48,12 +47,12 @@
48# define UDC_SELF_PWR (1 << 2) 47# define UDC_SELF_PWR (1 << 2)
49# define UDC_SOFF_DIS (1 << 1) 48# define UDC_SOFF_DIS (1 << 1)
50# define UDC_PULLUP_EN (1 << 0) 49# define UDC_PULLUP_EN (1 << 0)
51#define UDC_SYSCON2_REG UDC_REG(0x1C) /* System config 2 */ 50#define UDC_SYSCON2 (UDC_BASE + 0x1C) /* System config 2 */
52# define UDC_RMT_WKP (1 << 6) 51# define UDC_RMT_WKP (1 << 6)
53# define UDC_STALL_CMD (1 << 5) 52# define UDC_STALL_CMD (1 << 5)
54# define UDC_DEV_CFG (1 << 3) 53# define UDC_DEV_CFG (1 << 3)
55# define UDC_CLR_CFG (1 << 2) 54# define UDC_CLR_CFG (1 << 2)
56#define UDC_DEVSTAT_REG UDC_REG(0x20) /* Device status */ 55#define UDC_DEVSTAT (UDC_BASE + 0x20) /* Device status */
57# define UDC_B_HNP_ENABLE (1 << 9) 56# define UDC_B_HNP_ENABLE (1 << 9)
58# define UDC_A_HNP_SUPPORT (1 << 8) 57# define UDC_A_HNP_SUPPORT (1 << 8)
59# define UDC_A_ALT_HNP_SUPPORT (1 << 7) 58# define UDC_A_ALT_HNP_SUPPORT (1 << 7)
@@ -64,26 +63,26 @@
64# define UDC_ADD (1 << 2) 63# define UDC_ADD (1 << 2)
65# define UDC_DEF (1 << 1) 64# define UDC_DEF (1 << 1)
66# define UDC_ATT (1 << 0) 65# define UDC_ATT (1 << 0)
67#define UDC_SOF_REG UDC_REG(0x24) /* Start of frame */ 66#define UDC_SOF (UDC_BASE + 0x24) /* Start of frame */
68# define UDC_FT_LOCK (1 << 12) 67# define UDC_FT_LOCK (1 << 12)
69# define UDC_TS_OK (1 << 11) 68# define UDC_TS_OK (1 << 11)
70# define UDC_TS 0x03ff 69# define UDC_TS 0x03ff
71#define UDC_IRQ_EN_REG UDC_REG(0x28) /* Interrupt enable */ 70#define UDC_IRQ_EN (UDC_BASE + 0x28) /* Interrupt enable */
72# define UDC_SOF_IE (1 << 7) 71# define UDC_SOF_IE (1 << 7)
73# define UDC_EPN_RX_IE (1 << 5) 72# define UDC_EPN_RX_IE (1 << 5)
74# define UDC_EPN_TX_IE (1 << 4) 73# define UDC_EPN_TX_IE (1 << 4)
75# define UDC_DS_CHG_IE (1 << 3) 74# define UDC_DS_CHG_IE (1 << 3)
76# define UDC_EP0_IE (1 << 0) 75# define UDC_EP0_IE (1 << 0)
77#define UDC_DMA_IRQ_EN_REG UDC_REG(0x2C) /* DMA irq enable */ 76#define UDC_DMA_IRQ_EN (UDC_BASE + 0x2C) /* DMA irq enable */
78 /* rx/tx dma channels numbered 1-3 not 0-2 */ 77 /* rx/tx dma channels numbered 1-3 not 0-2 */
79# define UDC_TX_DONE_IE(n) (1 << (4 * (n) - 2)) 78# define UDC_TX_DONE_IE(n) (1 << (4 * (n) - 2))
80# define UDC_RX_CNT_IE(n) (1 << (4 * (n) - 3)) 79# define UDC_RX_CNT_IE(n) (1 << (4 * (n) - 3))
81# define UDC_RX_EOT_IE(n) (1 << (4 * (n) - 4)) 80# define UDC_RX_EOT_IE(n) (1 << (4 * (n) - 4))
82#define UDC_IRQ_SRC_REG UDC_REG(0x30) /* Interrupt source */ 81#define UDC_IRQ_SRC (UDC_BASE + 0x30) /* Interrupt source */
83# define UDC_TXN_DONE (1 << 10) 82# define UDC_TXN_DONE (1 << 10)
84# define UDC_RXN_CNT (1 << 9) 83# define UDC_RXN_CNT (1 << 9)
85# define UDC_RXN_EOT (1 << 8) 84# define UDC_RXN_EOT (1 << 8)
86# define UDC_SOF (1 << 7) 85# define UDC_IRQ_SOF (1 << 7)
87# define UDC_EPN_RX (1 << 5) 86# define UDC_EPN_RX (1 << 5)
88# define UDC_EPN_TX (1 << 4) 87# define UDC_EPN_TX (1 << 4)
89# define UDC_DS_CHG (1 << 3) 88# define UDC_DS_CHG (1 << 3)
@@ -91,41 +90,41 @@
91# define UDC_EP0_RX (1 << 1) 90# define UDC_EP0_RX (1 << 1)
92# define UDC_EP0_TX (1 << 0) 91# define UDC_EP0_TX (1 << 0)
93# define UDC_IRQ_SRC_MASK 0x7bf 92# define UDC_IRQ_SRC_MASK 0x7bf
94#define UDC_EPN_STAT_REG UDC_REG(0x34) /* EP irq status */ 93#define UDC_EPN_STAT (UDC_BASE + 0x34) /* EP irq status */
95#define UDC_DMAN_STAT_REG UDC_REG(0x38) /* DMA irq status */ 94#define UDC_DMAN_STAT (UDC_BASE + 0x38) /* DMA irq status */
96# define UDC_DMA_RX_SB (1 << 12) 95# define UDC_DMA_RX_SB (1 << 12)
97# define UDC_DMA_RX_SRC(x) (((x)>>8) & 0xf) 96# define UDC_DMA_RX_SRC(x) (((x)>>8) & 0xf)
98# define UDC_DMA_TX_SRC(x) (((x)>>0) & 0xf) 97# define UDC_DMA_TX_SRC(x) (((x)>>0) & 0xf)
99 98
100 99
101/* DMA configuration registers: up to three channels in each direction. */ 100/* DMA configuration registers: up to three channels in each direction. */
102#define UDC_RXDMA_CFG_REG UDC_REG(0x40) /* 3 eps for RX DMA */ 101#define UDC_RXDMA_CFG (UDC_BASE + 0x40) /* 3 eps for RX DMA */
103# define UDC_DMA_REQ (1 << 12) 102# define UDC_DMA_REQ (1 << 12)
104#define UDC_TXDMA_CFG_REG UDC_REG(0x44) /* 3 eps for TX DMA */ 103#define UDC_TXDMA_CFG (UDC_BASE + 0x44) /* 3 eps for TX DMA */
105#define UDC_DATA_DMA_REG UDC_REG(0x48) /* rx/tx fifo addr */ 104#define UDC_DATA_DMA (UDC_BASE + 0x48) /* rx/tx fifo addr */
106 105
107/* rx/tx dma control, numbering channels 1-3 not 0-2 */ 106/* rx/tx dma control, numbering channels 1-3 not 0-2 */
108#define UDC_TXDMA_REG(chan) UDC_REG(0x50 - 4 + 4 * (chan)) 107#define UDC_TXDMA(chan) (UDC_BASE + 0x50 - 4 + 4 * (chan))
109# define UDC_TXN_EOT (1 << 15) /* bytes vs packets */ 108# define UDC_TXN_EOT (1 << 15) /* bytes vs packets */
110# define UDC_TXN_START (1 << 14) /* start transfer */ 109# define UDC_TXN_START (1 << 14) /* start transfer */
111# define UDC_TXN_TSC 0x03ff /* units in xfer */ 110# define UDC_TXN_TSC 0x03ff /* units in xfer */
112#define UDC_RXDMA_REG(chan) UDC_REG(0x60 - 4 + 4 * (chan)) 111#define UDC_RXDMA(chan) (UDC_BASE + 0x60 - 4 + 4 * (chan))
113# define UDC_RXN_STOP (1 << 15) /* enable EOT irq */ 112# define UDC_RXN_STOP (1 << 15) /* enable EOT irq */
114# define UDC_RXN_TC 0x00ff /* packets in xfer */ 113# define UDC_RXN_TC 0x00ff /* packets in xfer */
115 114
116 115
117/* 116/*
118 * Endpoint configuration registers (used before CFG_LOCK is set) 117 * Endpoint configuration registers (used before CFG_LOCK is set)
119 * UDC_EP_TX_REG(0) is unused 118 * UDC_EP_TX(0) is unused
120 */ 119 */
121#define UDC_EP_RX_REG(endpoint) UDC_REG(0x80 + (endpoint)*4) 120#define UDC_EP_RX(endpoint) (UDC_BASE + 0x80 + (endpoint)*4)
122# define UDC_EPN_RX_VALID (1 << 15) 121# define UDC_EPN_RX_VALID (1 << 15)
123# define UDC_EPN_RX_DB (1 << 14) 122# define UDC_EPN_RX_DB (1 << 14)
124 /* buffer size in bits 13, 12 */ 123 /* buffer size in bits 13, 12 */
125# define UDC_EPN_RX_ISO (1 << 11) 124# define UDC_EPN_RX_ISO (1 << 11)
126 /* buffer pointer in low 11 bits */ 125 /* buffer pointer in low 11 bits */
127#define UDC_EP_TX_REG(endpoint) UDC_REG(0xc0 + (endpoint)*4) 126#define UDC_EP_TX(endpoint) (UDC_BASE + 0xc0 + (endpoint)*4)
128 /* same bitfields as in RX_REG */ 127 /* same bitfields as in RX */
129 128
130/*-------------------------------------------------------------------------*/ 129/*-------------------------------------------------------------------------*/
131 130
@@ -195,14 +194,14 @@ struct omap_udc {
195 194
196/*-------------------------------------------------------------------------*/ 195/*-------------------------------------------------------------------------*/
197 196
198#define MOD_CONF_CTRL_0_REG __REG32(MOD_CONF_CTRL_0) 197/* MOD_CONF_CTRL_0 */
199#define VBUS_W2FC_1510 (1 << 17) /* 0 gpio0, 1 dvdd2 pin */ 198#define VBUS_W2FC_1510 (1 << 17) /* 0 gpio0, 1 dvdd2 pin */
200 199
201#define FUNC_MUX_CTRL_0_REG __REG32(FUNC_MUX_CTRL_0) 200/* FUNC_MUX_CTRL_0 */
202#define VBUS_CTRL_1510 (1 << 19) /* 1 connected (software) */ 201#define VBUS_CTRL_1510 (1 << 19) /* 1 connected (software) */
203#define VBUS_MODE_1510 (1 << 18) /* 0 hardware, 1 software */ 202#define VBUS_MODE_1510 (1 << 18) /* 0 hardware, 1 software */
204 203
205#define HMC_1510 ((MOD_CONF_CTRL_0_REG >> 1) & 0x3f) 204#define HMC_1510 ((omap_readl(MOD_CONF_CTRL_0) >> 1) & 0x3f)
206#define HMC_1610 (OTG_SYSCON_2_REG & 0x3f) 205#define HMC_1610 (omap_readl(OTG_SYSCON_2) & 0x3f)
207#define HMC (cpu_is_omap15xx() ? HMC_1510 : HMC_1610) 206#define HMC (cpu_is_omap15xx() ? HMC_1510 : HMC_1610)
208 207
diff --git a/drivers/usb/host/ohci-omap.c b/drivers/usb/host/ohci-omap.c
index 6859fb5f1d6f..2b7c04079d56 100644
--- a/drivers/usb/host/ohci-omap.c
+++ b/drivers/usb/host/ohci-omap.c
@@ -169,13 +169,16 @@ static void start_hnp(struct ohci_hcd *ohci)
169{ 169{
170 const unsigned port = ohci_to_hcd(ohci)->self.otg_port - 1; 170 const unsigned port = ohci_to_hcd(ohci)->self.otg_port - 1;
171 unsigned long flags; 171 unsigned long flags;
172 u32 l;
172 173
173 otg_start_hnp(ohci->transceiver); 174 otg_start_hnp(ohci->transceiver);
174 175
175 local_irq_save(flags); 176 local_irq_save(flags);
176 ohci->transceiver->state = OTG_STATE_A_SUSPEND; 177 ohci->transceiver->state = OTG_STATE_A_SUSPEND;
177 writel (RH_PS_PSS, &ohci->regs->roothub.portstatus [port]); 178 writel (RH_PS_PSS, &ohci->regs->roothub.portstatus [port]);
178 OTG_CTRL_REG &= ~OTG_A_BUSREQ; 179 l = omap_readl(OTG_CTRL);
180 l &= ~OTG_A_BUSREQ;
181 omap_writel(l, OTG_CTRL);
179 local_irq_restore(flags); 182 local_irq_restore(flags);
180} 183}
181 184
diff --git a/drivers/video/pxafb.c b/drivers/video/pxafb.c
index 7dcda187d9ba..fafe7db20d6d 100644
--- a/drivers/video/pxafb.c
+++ b/drivers/video/pxafb.c
@@ -1246,7 +1246,7 @@ static int pxafb_resume(struct platform_device *dev)
1246 * cache. Once this area is remapped, all virtual memory 1246 * cache. Once this area is remapped, all virtual memory
1247 * access to the video memory should occur at the new region. 1247 * access to the video memory should occur at the new region.
1248 */ 1248 */
1249static int __init pxafb_map_video_memory(struct pxafb_info *fbi) 1249static int __devinit pxafb_map_video_memory(struct pxafb_info *fbi)
1250{ 1250{
1251 /* 1251 /*
1252 * We reserve one page for the palette, plus the size 1252 * We reserve one page for the palette, plus the size
@@ -1348,7 +1348,7 @@ decode_mode:
1348 pxafb_decode_mode_info(fbi, inf->modes, inf->num_modes); 1348 pxafb_decode_mode_info(fbi, inf->modes, inf->num_modes);
1349} 1349}
1350 1350
1351static struct pxafb_info * __init pxafb_init_fbinfo(struct device *dev) 1351static struct pxafb_info * __devinit pxafb_init_fbinfo(struct device *dev)
1352{ 1352{
1353 struct pxafb_info *fbi; 1353 struct pxafb_info *fbi;
1354 void *addr; 1354 void *addr;
@@ -1410,7 +1410,7 @@ static struct pxafb_info * __init pxafb_init_fbinfo(struct device *dev)
1410} 1410}
1411 1411
1412#ifdef CONFIG_FB_PXA_PARAMETERS 1412#ifdef CONFIG_FB_PXA_PARAMETERS
1413static int __init parse_opt_mode(struct device *dev, const char *this_opt) 1413static int __devinit parse_opt_mode(struct device *dev, const char *this_opt)
1414{ 1414{
1415 struct pxafb_mach_info *inf = dev->platform_data; 1415 struct pxafb_mach_info *inf = dev->platform_data;
1416 1416
@@ -1469,7 +1469,7 @@ done:
1469 return 0; 1469 return 0;
1470} 1470}
1471 1471
1472static int __init parse_opt(struct device *dev, char *this_opt) 1472static int __devinit parse_opt(struct device *dev, char *this_opt)
1473{ 1473{
1474 struct pxafb_mach_info *inf = dev->platform_data; 1474 struct pxafb_mach_info *inf = dev->platform_data;
1475 struct pxafb_mode_info *mode = &inf->modes[0]; 1475 struct pxafb_mode_info *mode = &inf->modes[0];
@@ -1567,7 +1567,7 @@ static int __init parse_opt(struct device *dev, char *this_opt)
1567 return 0; 1567 return 0;
1568} 1568}
1569 1569
1570static int __init pxafb_parse_options(struct device *dev, char *options) 1570static int __devinit pxafb_parse_options(struct device *dev, char *options)
1571{ 1571{
1572 char *this_opt; 1572 char *this_opt;
1573 int ret; 1573 int ret;
@@ -1588,8 +1588,8 @@ static int __init pxafb_parse_options(struct device *dev, char *options)
1588 1588
1589static char g_options[256] __devinitdata = ""; 1589static char g_options[256] __devinitdata = "";
1590 1590
1591#ifndef CONFIG_MODULES 1591#ifndef MODULE
1592static int __devinit pxafb_setup_options(void) 1592static int __init pxafb_setup_options(void)
1593{ 1593{
1594 char *options = NULL; 1594 char *options = NULL;
1595 1595
@@ -1613,7 +1613,7 @@ MODULE_PARM_DESC(options, "LCD parameters (see Documentation/fb/pxafb.txt)");
1613#define pxafb_setup_options() (0) 1613#define pxafb_setup_options() (0)
1614#endif 1614#endif
1615 1615
1616static int __init pxafb_probe(struct platform_device *dev) 1616static int __devinit pxafb_probe(struct platform_device *dev)
1617{ 1617{
1618 struct pxafb_info *fbi; 1618 struct pxafb_info *fbi;
1619 struct pxafb_mach_info *inf; 1619 struct pxafb_mach_info *inf;
@@ -1685,14 +1685,14 @@ static int __init pxafb_probe(struct platform_device *dev)
1685 if (r == NULL) { 1685 if (r == NULL) {
1686 dev_err(&dev->dev, "no I/O memory resource defined\n"); 1686 dev_err(&dev->dev, "no I/O memory resource defined\n");
1687 ret = -ENODEV; 1687 ret = -ENODEV;
1688 goto failed; 1688 goto failed_fbi;
1689 } 1689 }
1690 1690
1691 r = request_mem_region(r->start, r->end - r->start + 1, dev->name); 1691 r = request_mem_region(r->start, r->end - r->start + 1, dev->name);
1692 if (r == NULL) { 1692 if (r == NULL) {
1693 dev_err(&dev->dev, "failed to request I/O memory\n"); 1693 dev_err(&dev->dev, "failed to request I/O memory\n");
1694 ret = -EBUSY; 1694 ret = -EBUSY;
1695 goto failed; 1695 goto failed_fbi;
1696 } 1696 }
1697 1697
1698 fbi->mmio_base = ioremap(r->start, r->end - r->start + 1); 1698 fbi->mmio_base = ioremap(r->start, r->end - r->start + 1);
@@ -1735,8 +1735,17 @@ static int __init pxafb_probe(struct platform_device *dev)
1735 * This makes sure that our colour bitfield 1735 * This makes sure that our colour bitfield
1736 * descriptors are correctly initialised. 1736 * descriptors are correctly initialised.
1737 */ 1737 */
1738 pxafb_check_var(&fbi->fb.var, &fbi->fb); 1738 ret = pxafb_check_var(&fbi->fb.var, &fbi->fb);
1739 pxafb_set_par(&fbi->fb); 1739 if (ret) {
1740 dev_err(&dev->dev, "failed to get suitable mode\n");
1741 goto failed_free_irq;
1742 }
1743
1744 ret = pxafb_set_par(&fbi->fb);
1745 if (ret) {
1746 dev_err(&dev->dev, "Failed to set parameters\n");
1747 goto failed_free_irq;
1748 }
1740 1749
1741 platform_set_drvdata(dev, fbi); 1750 platform_set_drvdata(dev, fbi);
1742 1751
@@ -1744,7 +1753,7 @@ static int __init pxafb_probe(struct platform_device *dev)
1744 if (ret < 0) { 1753 if (ret < 0) {
1745 dev_err(&dev->dev, 1754 dev_err(&dev->dev,
1746 "Failed to register framebuffer device: %d\n", ret); 1755 "Failed to register framebuffer device: %d\n", ret);
1747 goto failed_free_irq; 1756 goto failed_free_cmap;
1748 } 1757 }
1749 1758
1750#ifdef CONFIG_CPU_FREQ 1759#ifdef CONFIG_CPU_FREQ
@@ -1763,18 +1772,23 @@ static int __init pxafb_probe(struct platform_device *dev)
1763 1772
1764 return 0; 1773 return 0;
1765 1774
1775failed_free_cmap:
1776 if (fbi->fb.cmap.len)
1777 fb_dealloc_cmap(&fbi->fb.cmap);
1766failed_free_irq: 1778failed_free_irq:
1767 free_irq(irq, fbi); 1779 free_irq(irq, fbi);
1768failed_free_res:
1769 release_mem_region(r->start, r->end - r->start + 1);
1770failed_free_io:
1771 iounmap(fbi->mmio_base);
1772failed_free_mem: 1780failed_free_mem:
1773 dma_free_writecombine(&dev->dev, fbi->map_size, 1781 dma_free_writecombine(&dev->dev, fbi->map_size,
1774 fbi->map_cpu, fbi->map_dma); 1782 fbi->map_cpu, fbi->map_dma);
1775failed: 1783failed_free_io:
1784 iounmap(fbi->mmio_base);
1785failed_free_res:
1786 release_mem_region(r->start, r->end - r->start + 1);
1787failed_fbi:
1788 clk_put(fbi->clk);
1776 platform_set_drvdata(dev, NULL); 1789 platform_set_drvdata(dev, NULL);
1777 kfree(fbi); 1790 kfree(fbi);
1791failed:
1778 return ret; 1792 return ret;
1779} 1793}
1780 1794
@@ -1787,7 +1801,7 @@ static struct platform_driver pxafb_driver = {
1787 }, 1801 },
1788}; 1802};
1789 1803
1790static int __devinit pxafb_init(void) 1804static int __init pxafb_init(void)
1791{ 1805{
1792 if (pxafb_setup_options()) 1806 if (pxafb_setup_options())
1793 return -EINVAL; 1807 return -EINVAL;
diff --git a/drivers/watchdog/Makefile b/drivers/watchdog/Makefile
index 8662a6b7a30b..25b352b664d9 100644
--- a/drivers/watchdog/Makefile
+++ b/drivers/watchdog/Makefile
@@ -68,7 +68,6 @@ obj-$(CONFIG_WAFER_WDT) += wafer5823wdt.o
68obj-$(CONFIG_I6300ESB_WDT) += i6300esb.o 68obj-$(CONFIG_I6300ESB_WDT) += i6300esb.o
69obj-$(CONFIG_ITCO_WDT) += iTCO_wdt.o iTCO_vendor_support.o 69obj-$(CONFIG_ITCO_WDT) += iTCO_wdt.o iTCO_vendor_support.o
70obj-$(CONFIG_IT8712F_WDT) += it8712f_wdt.o 70obj-$(CONFIG_IT8712F_WDT) += it8712f_wdt.o
71CFLAGS_hpwdt.o += -O
72obj-$(CONFIG_HP_WATCHDOG) += hpwdt.o 71obj-$(CONFIG_HP_WATCHDOG) += hpwdt.o
73obj-$(CONFIG_SC1200_WDT) += sc1200wdt.o 72obj-$(CONFIG_SC1200_WDT) += sc1200wdt.o
74obj-$(CONFIG_SCx200_WDT) += scx200_wdt.o 73obj-$(CONFIG_SCx200_WDT) += scx200_wdt.o
diff --git a/drivers/xen/events.c b/drivers/xen/events.c
index 4f0f22b020ea..76e5b7386af9 100644
--- a/drivers/xen/events.c
+++ b/drivers/xen/events.c
@@ -529,7 +529,7 @@ void xen_evtchn_do_upcall(struct pt_regs *regs)
529 529
530#ifndef CONFIG_X86 /* No need for a barrier -- XCHG is a barrier on x86. */ 530#ifndef CONFIG_X86 /* No need for a barrier -- XCHG is a barrier on x86. */
531 /* Clear master flag /before/ clearing selector flag. */ 531 /* Clear master flag /before/ clearing selector flag. */
532 rmb(); 532 wmb();
533#endif 533#endif
534 pending_words = xchg(&vcpu_info->evtchn_pending_sel, 0); 534 pending_words = xchg(&vcpu_info->evtchn_pending_sel, 0);
535 while (pending_words != 0) { 535 while (pending_words != 0) {
diff --git a/fs/block_dev.c b/fs/block_dev.c
index 470c10ceb0fb..10d8a0aa871a 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -931,8 +931,16 @@ static int do_open(struct block_device *bdev, struct file *file, int for_part)
931 struct gendisk *disk; 931 struct gendisk *disk;
932 int ret; 932 int ret;
933 int part; 933 int part;
934 int perm = 0;
934 935
935 ret = devcgroup_inode_permission(bdev->bd_inode, file->f_mode); 936 if (file->f_mode & FMODE_READ)
937 perm |= MAY_READ;
938 if (file->f_mode & FMODE_WRITE)
939 perm |= MAY_WRITE;
940 /*
941 * hooks: /n/, see "layering violations".
942 */
943 ret = devcgroup_inode_permission(bdev->bd_inode, perm);
936 if (ret != 0) 944 if (ret != 0)
937 return ret; 945 return ret;
938 946
diff --git a/fs/buffer.c b/fs/buffer.c
index a073f3f4f013..0f51c0f7c266 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -821,7 +821,7 @@ static int fsync_buffers_list(spinlock_t *lock, struct list_head *list)
821 * contents - it is a noop if I/O is still in 821 * contents - it is a noop if I/O is still in
822 * flight on potentially older contents. 822 * flight on potentially older contents.
823 */ 823 */
824 ll_rw_block(SWRITE, 1, &bh); 824 ll_rw_block(SWRITE_SYNC, 1, &bh);
825 brelse(bh); 825 brelse(bh);
826 spin_lock(lock); 826 spin_lock(lock);
827 } 827 }
@@ -2940,16 +2940,19 @@ void ll_rw_block(int rw, int nr, struct buffer_head *bhs[])
2940 for (i = 0; i < nr; i++) { 2940 for (i = 0; i < nr; i++) {
2941 struct buffer_head *bh = bhs[i]; 2941 struct buffer_head *bh = bhs[i];
2942 2942
2943 if (rw == SWRITE) 2943 if (rw == SWRITE || rw == SWRITE_SYNC)
2944 lock_buffer(bh); 2944 lock_buffer(bh);
2945 else if (test_set_buffer_locked(bh)) 2945 else if (test_set_buffer_locked(bh))
2946 continue; 2946 continue;
2947 2947
2948 if (rw == WRITE || rw == SWRITE) { 2948 if (rw == WRITE || rw == SWRITE || rw == SWRITE_SYNC) {
2949 if (test_clear_buffer_dirty(bh)) { 2949 if (test_clear_buffer_dirty(bh)) {
2950 bh->b_end_io = end_buffer_write_sync; 2950 bh->b_end_io = end_buffer_write_sync;
2951 get_bh(bh); 2951 get_bh(bh);
2952 submit_bh(WRITE, bh); 2952 if (rw == SWRITE_SYNC)
2953 submit_bh(WRITE_SYNC, bh);
2954 else
2955 submit_bh(WRITE, bh);
2953 continue; 2956 continue;
2954 } 2957 }
2955 } else { 2958 } else {
@@ -2978,7 +2981,7 @@ int sync_dirty_buffer(struct buffer_head *bh)
2978 if (test_clear_buffer_dirty(bh)) { 2981 if (test_clear_buffer_dirty(bh)) {
2979 get_bh(bh); 2982 get_bh(bh);
2980 bh->b_end_io = end_buffer_write_sync; 2983 bh->b_end_io = end_buffer_write_sync;
2981 ret = submit_bh(WRITE, bh); 2984 ret = submit_bh(WRITE_SYNC, bh);
2982 wait_on_buffer(bh); 2985 wait_on_buffer(bh);
2983 if (buffer_eopnotsupp(bh)) { 2986 if (buffer_eopnotsupp(bh)) {
2984 clear_buffer_eopnotsupp(bh); 2987 clear_buffer_eopnotsupp(bh);
diff --git a/fs/dcache.c b/fs/dcache.c
index 3ee588d5f585..6068c25b393c 100644
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -17,6 +17,7 @@
17#include <linux/syscalls.h> 17#include <linux/syscalls.h>
18#include <linux/string.h> 18#include <linux/string.h>
19#include <linux/mm.h> 19#include <linux/mm.h>
20#include <linux/fdtable.h>
20#include <linux/fs.h> 21#include <linux/fs.h>
21#include <linux/fsnotify.h> 22#include <linux/fsnotify.h>
22#include <linux/slab.h> 23#include <linux/slab.h>
@@ -106,9 +107,10 @@ static void dentry_lru_remove(struct dentry *dentry)
106/* 107/*
107 * Release the dentry's inode, using the filesystem 108 * Release the dentry's inode, using the filesystem
108 * d_iput() operation if defined. 109 * d_iput() operation if defined.
109 * Called with dcache_lock and per dentry lock held, drops both.
110 */ 110 */
111static void dentry_iput(struct dentry * dentry) 111static void dentry_iput(struct dentry * dentry)
112 __releases(dentry->d_lock)
113 __releases(dcache_lock)
112{ 114{
113 struct inode *inode = dentry->d_inode; 115 struct inode *inode = dentry->d_inode;
114 if (inode) { 116 if (inode) {
@@ -132,12 +134,13 @@ static void dentry_iput(struct dentry * dentry)
132 * d_kill - kill dentry and return parent 134 * d_kill - kill dentry and return parent
133 * @dentry: dentry to kill 135 * @dentry: dentry to kill
134 * 136 *
135 * Called with dcache_lock and d_lock, releases both. The dentry must 137 * The dentry must already be unhashed and removed from the LRU.
136 * already be unhashed and removed from the LRU.
137 * 138 *
138 * If this is the root of the dentry tree, return NULL. 139 * If this is the root of the dentry tree, return NULL.
139 */ 140 */
140static struct dentry *d_kill(struct dentry *dentry) 141static struct dentry *d_kill(struct dentry *dentry)
142 __releases(dentry->d_lock)
143 __releases(dcache_lock)
141{ 144{
142 struct dentry *parent; 145 struct dentry *parent;
143 146
@@ -383,11 +386,11 @@ restart:
383 * Try to prune ancestors as well. This is necessary to prevent 386 * Try to prune ancestors as well. This is necessary to prevent
384 * quadratic behavior of shrink_dcache_parent(), but is also expected 387 * quadratic behavior of shrink_dcache_parent(), but is also expected
385 * to be beneficial in reducing dentry cache fragmentation. 388 * to be beneficial in reducing dentry cache fragmentation.
386 *
387 * Called with dcache_lock, drops it and then regains.
388 * Called with dentry->d_lock held, drops it.
389 */ 389 */
390static void prune_one_dentry(struct dentry * dentry) 390static void prune_one_dentry(struct dentry * dentry)
391 __releases(dentry->d_lock)
392 __releases(dcache_lock)
393 __acquires(dcache_lock)
391{ 394{
392 __d_drop(dentry); 395 __d_drop(dentry);
393 dentry = d_kill(dentry); 396 dentry = d_kill(dentry);
@@ -1604,10 +1607,9 @@ static int d_isparent(struct dentry *p1, struct dentry *p2)
1604 * 1607 *
1605 * Note: If ever the locking in lock_rename() changes, then please 1608 * Note: If ever the locking in lock_rename() changes, then please
1606 * remember to update this too... 1609 * remember to update this too...
1607 *
1608 * On return, dcache_lock will have been unlocked.
1609 */ 1610 */
1610static struct dentry *__d_unalias(struct dentry *dentry, struct dentry *alias) 1611static struct dentry *__d_unalias(struct dentry *dentry, struct dentry *alias)
1612 __releases(dcache_lock)
1611{ 1613{
1612 struct mutex *m1 = NULL, *m2 = NULL; 1614 struct mutex *m1 = NULL, *m2 = NULL;
1613 struct dentry *ret; 1615 struct dentry *ret;
@@ -1743,11 +1745,9 @@ out_nolock:
1743shouldnt_be_hashed: 1745shouldnt_be_hashed:
1744 spin_unlock(&dcache_lock); 1746 spin_unlock(&dcache_lock);
1745 BUG(); 1747 BUG();
1746 goto shouldnt_be_hashed;
1747} 1748}
1748 1749
1749static int prepend(char **buffer, int *buflen, const char *str, 1750static int prepend(char **buffer, int *buflen, const char *str, int namelen)
1750 int namelen)
1751{ 1751{
1752 *buflen -= namelen; 1752 *buflen -= namelen;
1753 if (*buflen < 0) 1753 if (*buflen < 0)
@@ -1757,8 +1757,13 @@ static int prepend(char **buffer, int *buflen, const char *str,
1757 return 0; 1757 return 0;
1758} 1758}
1759 1759
1760static int prepend_name(char **buffer, int *buflen, struct qstr *name)
1761{
1762 return prepend(buffer, buflen, name->name, name->len);
1763}
1764
1760/** 1765/**
1761 * d_path - return the path of a dentry 1766 * __d_path - return the path of a dentry
1762 * @path: the dentry/vfsmount to report 1767 * @path: the dentry/vfsmount to report
1763 * @root: root vfsmnt/dentry (may be modified by this function) 1768 * @root: root vfsmnt/dentry (may be modified by this function)
1764 * @buffer: buffer to return value in 1769 * @buffer: buffer to return value in
@@ -1779,9 +1784,10 @@ char *__d_path(const struct path *path, struct path *root,
1779{ 1784{
1780 struct dentry *dentry = path->dentry; 1785 struct dentry *dentry = path->dentry;
1781 struct vfsmount *vfsmnt = path->mnt; 1786 struct vfsmount *vfsmnt = path->mnt;
1782 char * end = buffer+buflen; 1787 char *end = buffer + buflen;
1783 char * retval; 1788 char *retval;
1784 1789
1790 spin_lock(&vfsmount_lock);
1785 prepend(&end, &buflen, "\0", 1); 1791 prepend(&end, &buflen, "\0", 1);
1786 if (!IS_ROOT(dentry) && d_unhashed(dentry) && 1792 if (!IS_ROOT(dentry) && d_unhashed(dentry) &&
1787 (prepend(&end, &buflen, " (deleted)", 10) != 0)) 1793 (prepend(&end, &buflen, " (deleted)", 10) != 0))
@@ -1800,38 +1806,37 @@ char *__d_path(const struct path *path, struct path *root,
1800 break; 1806 break;
1801 if (dentry == vfsmnt->mnt_root || IS_ROOT(dentry)) { 1807 if (dentry == vfsmnt->mnt_root || IS_ROOT(dentry)) {
1802 /* Global root? */ 1808 /* Global root? */
1803 spin_lock(&vfsmount_lock);
1804 if (vfsmnt->mnt_parent == vfsmnt) { 1809 if (vfsmnt->mnt_parent == vfsmnt) {
1805 spin_unlock(&vfsmount_lock);
1806 goto global_root; 1810 goto global_root;
1807 } 1811 }
1808 dentry = vfsmnt->mnt_mountpoint; 1812 dentry = vfsmnt->mnt_mountpoint;
1809 vfsmnt = vfsmnt->mnt_parent; 1813 vfsmnt = vfsmnt->mnt_parent;
1810 spin_unlock(&vfsmount_lock);
1811 continue; 1814 continue;
1812 } 1815 }
1813 parent = dentry->d_parent; 1816 parent = dentry->d_parent;
1814 prefetch(parent); 1817 prefetch(parent);
1815 if ((prepend(&end, &buflen, dentry->d_name.name, 1818 if ((prepend_name(&end, &buflen, &dentry->d_name) != 0) ||
1816 dentry->d_name.len) != 0) ||
1817 (prepend(&end, &buflen, "/", 1) != 0)) 1819 (prepend(&end, &buflen, "/", 1) != 0))
1818 goto Elong; 1820 goto Elong;
1819 retval = end; 1821 retval = end;
1820 dentry = parent; 1822 dentry = parent;
1821 } 1823 }
1822 1824
1825out:
1826 spin_unlock(&vfsmount_lock);
1823 return retval; 1827 return retval;
1824 1828
1825global_root: 1829global_root:
1826 retval += 1; /* hit the slash */ 1830 retval += 1; /* hit the slash */
1827 if (prepend(&retval, &buflen, dentry->d_name.name, 1831 if (prepend_name(&retval, &buflen, &dentry->d_name) != 0)
1828 dentry->d_name.len) != 0)
1829 goto Elong; 1832 goto Elong;
1830 root->mnt = vfsmnt; 1833 root->mnt = vfsmnt;
1831 root->dentry = dentry; 1834 root->dentry = dentry;
1832 return retval; 1835 goto out;
1836
1833Elong: 1837Elong:
1834 return ERR_PTR(-ENAMETOOLONG); 1838 retval = ERR_PTR(-ENAMETOOLONG);
1839 goto out;
1835} 1840}
1836 1841
1837/** 1842/**
@@ -1845,9 +1850,9 @@ Elong:
1845 * 1850 *
1846 * Returns the buffer or an error code if the path was too long. 1851 * Returns the buffer or an error code if the path was too long.
1847 * 1852 *
1848 * "buflen" should be positive. Caller holds the dcache_lock. 1853 * "buflen" should be positive.
1849 */ 1854 */
1850char *d_path(struct path *path, char *buf, int buflen) 1855char *d_path(const struct path *path, char *buf, int buflen)
1851{ 1856{
1852 char *res; 1857 char *res;
1853 struct path root; 1858 struct path root;
@@ -1915,16 +1920,11 @@ char *dentry_path(struct dentry *dentry, char *buf, int buflen)
1915 retval = end-1; 1920 retval = end-1;
1916 *retval = '/'; 1921 *retval = '/';
1917 1922
1918 for (;;) { 1923 while (!IS_ROOT(dentry)) {
1919 struct dentry *parent; 1924 struct dentry *parent = dentry->d_parent;
1920 if (IS_ROOT(dentry))
1921 break;
1922 1925
1923 parent = dentry->d_parent;
1924 prefetch(parent); 1926 prefetch(parent);
1925 1927 if ((prepend_name(&end, &buflen, &dentry->d_name) != 0) ||
1926 if ((prepend(&end, &buflen, dentry->d_name.name,
1927 dentry->d_name.len) != 0) ||
1928 (prepend(&end, &buflen, "/", 1) != 0)) 1928 (prepend(&end, &buflen, "/", 1) != 0))
1929 goto Elong; 1929 goto Elong;
1930 1930
@@ -1975,7 +1975,7 @@ asmlinkage long sys_getcwd(char __user *buf, unsigned long size)
1975 error = -ENOENT; 1975 error = -ENOENT;
1976 /* Has the current directory has been unlinked? */ 1976 /* Has the current directory has been unlinked? */
1977 spin_lock(&dcache_lock); 1977 spin_lock(&dcache_lock);
1978 if (pwd.dentry->d_parent == pwd.dentry || !d_unhashed(pwd.dentry)) { 1978 if (IS_ROOT(pwd.dentry) || !d_unhashed(pwd.dentry)) {
1979 unsigned long len; 1979 unsigned long len;
1980 struct path tmp = root; 1980 struct path tmp = root;
1981 char * cwd; 1981 char * cwd;
diff --git a/fs/ext4/resize.c b/fs/ext4/resize.c
index 9ecb92f68543..9ff7b1c04239 100644
--- a/fs/ext4/resize.c
+++ b/fs/ext4/resize.c
@@ -855,7 +855,8 @@ int ext4_group_add(struct super_block *sb, struct ext4_new_group_data *input)
855 */ 855 */
856 856
857 /* Update group descriptor block for new group */ 857 /* Update group descriptor block for new group */
858 gdp = (struct ext4_group_desc *)primary->b_data + gdb_off; 858 gdp = (struct ext4_group_desc *)((char *)primary->b_data +
859 gdb_off * EXT4_DESC_SIZE(sb));
859 860
860 ext4_block_bitmap_set(sb, gdp, input->block_bitmap); /* LV FIXME */ 861 ext4_block_bitmap_set(sb, gdp, input->block_bitmap); /* LV FIXME */
861 ext4_inode_bitmap_set(sb, gdp, input->inode_bitmap); /* LV FIXME */ 862 ext4_inode_bitmap_set(sb, gdp, input->inode_bitmap); /* LV FIXME */
diff --git a/fs/gfs2/bmap.c b/fs/gfs2/bmap.c
index c19184f2e70e..bec76b1c2bb0 100644
--- a/fs/gfs2/bmap.c
+++ b/fs/gfs2/bmap.c
@@ -246,15 +246,11 @@ static void find_metapath(const struct gfs2_sbd *sdp, u64 block,
246 246
247} 247}
248 248
249static inline unsigned int zero_metapath_length(const struct metapath *mp, 249static inline unsigned int metapath_branch_start(const struct metapath *mp)
250 unsigned height)
251{ 250{
252 unsigned int i; 251 if (mp->mp_list[0] == 0)
253 for (i = 0; i < height - 1; i++) { 252 return 2;
254 if (mp->mp_list[i] != 0) 253 return 1;
255 return i;
256 }
257 return height;
258} 254}
259 255
260/** 256/**
@@ -436,7 +432,7 @@ static int gfs2_bmap_alloc(struct inode *inode, const sector_t lblock,
436 struct gfs2_sbd *sdp = GFS2_SB(inode); 432 struct gfs2_sbd *sdp = GFS2_SB(inode);
437 struct buffer_head *dibh = mp->mp_bh[0]; 433 struct buffer_head *dibh = mp->mp_bh[0];
438 u64 bn, dblock = 0; 434 u64 bn, dblock = 0;
439 unsigned n, i, blks, alloced = 0, iblks = 0, zmpl = 0; 435 unsigned n, i, blks, alloced = 0, iblks = 0, branch_start = 0;
440 unsigned dblks = 0; 436 unsigned dblks = 0;
441 unsigned ptrs_per_blk; 437 unsigned ptrs_per_blk;
442 const unsigned end_of_metadata = height - 1; 438 const unsigned end_of_metadata = height - 1;
@@ -471,9 +467,8 @@ static int gfs2_bmap_alloc(struct inode *inode, const sector_t lblock,
471 /* Building up tree height */ 467 /* Building up tree height */
472 state = ALLOC_GROW_HEIGHT; 468 state = ALLOC_GROW_HEIGHT;
473 iblks = height - ip->i_height; 469 iblks = height - ip->i_height;
474 zmpl = zero_metapath_length(mp, height); 470 branch_start = metapath_branch_start(mp);
475 iblks -= zmpl; 471 iblks += (height - branch_start);
476 iblks += height;
477 } 472 }
478 } 473 }
479 474
@@ -509,13 +504,13 @@ static int gfs2_bmap_alloc(struct inode *inode, const sector_t lblock,
509 sizeof(struct gfs2_meta_header)); 504 sizeof(struct gfs2_meta_header));
510 *ptr = zero_bn; 505 *ptr = zero_bn;
511 state = ALLOC_GROW_DEPTH; 506 state = ALLOC_GROW_DEPTH;
512 for(i = zmpl; i < height; i++) { 507 for(i = branch_start; i < height; i++) {
513 if (mp->mp_bh[i] == NULL) 508 if (mp->mp_bh[i] == NULL)
514 break; 509 break;
515 brelse(mp->mp_bh[i]); 510 brelse(mp->mp_bh[i]);
516 mp->mp_bh[i] = NULL; 511 mp->mp_bh[i] = NULL;
517 } 512 }
518 i = zmpl; 513 i = branch_start;
519 } 514 }
520 if (n == 0) 515 if (n == 0)
521 break; 516 break;
diff --git a/fs/gfs2/rgrp.c b/fs/gfs2/rgrp.c
index 6387523a3153..3401628d742b 100644
--- a/fs/gfs2/rgrp.c
+++ b/fs/gfs2/rgrp.c
@@ -195,7 +195,7 @@ ulong_aligned:
195 depending on architecture. I've experimented with several ways 195 depending on architecture. I've experimented with several ways
196 of writing this section such as using an else before the goto 196 of writing this section such as using an else before the goto
197 but this one seems to be the fastest. */ 197 but this one seems to be the fastest. */
198 while ((unsigned char *)plong < end - 1) { 198 while ((unsigned char *)plong < end - sizeof(unsigned long)) {
199 prefetch(plong + 1); 199 prefetch(plong + 1);
200 if (((*plong) & LBITMASK) != lskipval) 200 if (((*plong) & LBITMASK) != lskipval)
201 break; 201 break;
diff --git a/fs/locks.c b/fs/locks.c
index 11dbf08651b7..dce8c747371c 100644
--- a/fs/locks.c
+++ b/fs/locks.c
@@ -561,9 +561,6 @@ static void locks_insert_lock(struct file_lock **pos, struct file_lock *fl)
561 /* insert into file's list */ 561 /* insert into file's list */
562 fl->fl_next = *pos; 562 fl->fl_next = *pos;
563 *pos = fl; 563 *pos = fl;
564
565 if (fl->fl_ops && fl->fl_ops->fl_insert)
566 fl->fl_ops->fl_insert(fl);
567} 564}
568 565
569/* 566/*
@@ -586,9 +583,6 @@ static void locks_delete_lock(struct file_lock **thisfl_p)
586 fl->fl_fasync = NULL; 583 fl->fl_fasync = NULL;
587 } 584 }
588 585
589 if (fl->fl_ops && fl->fl_ops->fl_remove)
590 fl->fl_ops->fl_remove(fl);
591
592 if (fl->fl_nspid) { 586 if (fl->fl_nspid) {
593 put_pid(fl->fl_nspid); 587 put_pid(fl->fl_nspid);
594 fl->fl_nspid = NULL; 588 fl->fl_nspid = NULL;
diff --git a/fs/namei.c b/fs/namei.c
index c7e43536c49a..01e67dddcc3d 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -581,15 +581,13 @@ static __always_inline int link_path_walk(const char *name, struct nameidata *nd
581 int result; 581 int result;
582 582
583 /* make sure the stuff we saved doesn't go away */ 583 /* make sure the stuff we saved doesn't go away */
584 dget(save.dentry); 584 path_get(&save);
585 mntget(save.mnt);
586 585
587 result = __link_path_walk(name, nd); 586 result = __link_path_walk(name, nd);
588 if (result == -ESTALE) { 587 if (result == -ESTALE) {
589 /* nd->path had been dropped */ 588 /* nd->path had been dropped */
590 nd->path = save; 589 nd->path = save;
591 dget(nd->path.dentry); 590 path_get(&nd->path);
592 mntget(nd->path.mnt);
593 nd->flags |= LOOKUP_REVAL; 591 nd->flags |= LOOKUP_REVAL;
594 result = __link_path_walk(name, nd); 592 result = __link_path_walk(name, nd);
595 } 593 }
@@ -1216,8 +1214,9 @@ int vfs_path_lookup(struct dentry *dentry, struct vfsmount *mnt,
1216 nd->flags = flags; 1214 nd->flags = flags;
1217 nd->depth = 0; 1215 nd->depth = 0;
1218 1216
1219 nd->path.mnt = mntget(mnt); 1217 nd->path.dentry = dentry;
1220 nd->path.dentry = dget(dentry); 1218 nd->path.mnt = mnt;
1219 path_get(&nd->path);
1221 1220
1222 retval = path_walk(name, nd); 1221 retval = path_walk(name, nd);
1223 if (unlikely(!retval && !audit_dummy_context() && nd->path.dentry && 1222 if (unlikely(!retval && !audit_dummy_context() && nd->path.dentry &&
@@ -2857,16 +2856,17 @@ int generic_readlink(struct dentry *dentry, char __user *buffer, int buflen)
2857{ 2856{
2858 struct nameidata nd; 2857 struct nameidata nd;
2859 void *cookie; 2858 void *cookie;
2859 int res;
2860 2860
2861 nd.depth = 0; 2861 nd.depth = 0;
2862 cookie = dentry->d_inode->i_op->follow_link(dentry, &nd); 2862 cookie = dentry->d_inode->i_op->follow_link(dentry, &nd);
2863 if (!IS_ERR(cookie)) { 2863 if (IS_ERR(cookie))
2864 int res = vfs_readlink(dentry, buffer, buflen, nd_get_link(&nd)); 2864 return PTR_ERR(cookie);
2865 if (dentry->d_inode->i_op->put_link) 2865
2866 dentry->d_inode->i_op->put_link(dentry, &nd, cookie); 2866 res = vfs_readlink(dentry, buffer, buflen, nd_get_link(&nd));
2867 cookie = ERR_PTR(res); 2867 if (dentry->d_inode->i_op->put_link)
2868 } 2868 dentry->d_inode->i_op->put_link(dentry, &nd, cookie);
2869 return PTR_ERR(cookie); 2869 return res;
2870} 2870}
2871 2871
2872int vfs_follow_link(struct nameidata *nd, const char *link) 2872int vfs_follow_link(struct nameidata *nd, const char *link)
diff --git a/fs/nfs/mount_clnt.c b/fs/nfs/mount_clnt.c
index 49c7cd0502cc..779d2eb649c5 100644
--- a/fs/nfs/mount_clnt.c
+++ b/fs/nfs/mount_clnt.c
@@ -130,10 +130,11 @@ static int xdr_decode_fhstatus3(struct rpc_rqst *req, __be32 *p,
130 struct mnt_fhstatus *res) 130 struct mnt_fhstatus *res)
131{ 131{
132 struct nfs_fh *fh = res->fh; 132 struct nfs_fh *fh = res->fh;
133 unsigned size;
133 134
134 if ((res->status = ntohl(*p++)) == 0) { 135 if ((res->status = ntohl(*p++)) == 0) {
135 int size = ntohl(*p++); 136 size = ntohl(*p++);
136 if (size <= NFS3_FHSIZE) { 137 if (size <= NFS3_FHSIZE && size != 0) {
137 fh->size = size; 138 fh->size = size;
138 memcpy(fh->data, p, size); 139 memcpy(fh->data, p, size);
139 } else 140 } else
diff --git a/fs/nfs/super.c b/fs/nfs/super.c
index 2a4a024a4e7b..614efeed5437 100644
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -1216,8 +1216,6 @@ static int nfs_validate_mount_data(void *options,
1216{ 1216{
1217 struct nfs_mount_data *data = (struct nfs_mount_data *)options; 1217 struct nfs_mount_data *data = (struct nfs_mount_data *)options;
1218 1218
1219 memset(args, 0, sizeof(*args));
1220
1221 if (data == NULL) 1219 if (data == NULL)
1222 goto out_no_data; 1220 goto out_no_data;
1223 1221
@@ -1251,13 +1249,13 @@ static int nfs_validate_mount_data(void *options,
1251 case 5: 1249 case 5:
1252 memset(data->context, 0, sizeof(data->context)); 1250 memset(data->context, 0, sizeof(data->context));
1253 case 6: 1251 case 6:
1254 if (data->flags & NFS_MOUNT_VER3) 1252 if (data->flags & NFS_MOUNT_VER3) {
1253 if (data->root.size > NFS3_FHSIZE || data->root.size == 0)
1254 goto out_invalid_fh;
1255 mntfh->size = data->root.size; 1255 mntfh->size = data->root.size;
1256 else 1256 } else
1257 mntfh->size = NFS2_FHSIZE; 1257 mntfh->size = NFS2_FHSIZE;
1258 1258
1259 if (mntfh->size > sizeof(mntfh->data))
1260 goto out_invalid_fh;
1261 1259
1262 memcpy(mntfh->data, data->root.data, mntfh->size); 1260 memcpy(mntfh->data, data->root.data, mntfh->size);
1263 if (mntfh->size < sizeof(mntfh->data)) 1261 if (mntfh->size < sizeof(mntfh->data))
@@ -1585,24 +1583,29 @@ static int nfs_get_sb(struct file_system_type *fs_type,
1585{ 1583{
1586 struct nfs_server *server = NULL; 1584 struct nfs_server *server = NULL;
1587 struct super_block *s; 1585 struct super_block *s;
1588 struct nfs_fh mntfh; 1586 struct nfs_parsed_mount_data *data;
1589 struct nfs_parsed_mount_data data; 1587 struct nfs_fh *mntfh;
1590 struct dentry *mntroot; 1588 struct dentry *mntroot;
1591 int (*compare_super)(struct super_block *, void *) = nfs_compare_super; 1589 int (*compare_super)(struct super_block *, void *) = nfs_compare_super;
1592 struct nfs_sb_mountdata sb_mntdata = { 1590 struct nfs_sb_mountdata sb_mntdata = {
1593 .mntflags = flags, 1591 .mntflags = flags,
1594 }; 1592 };
1595 int error; 1593 int error = -ENOMEM;
1594
1595 data = kzalloc(sizeof(*data), GFP_KERNEL);
1596 mntfh = kzalloc(sizeof(*mntfh), GFP_KERNEL);
1597 if (data == NULL || mntfh == NULL)
1598 goto out_free_fh;
1596 1599
1597 security_init_mnt_opts(&data.lsm_opts); 1600 security_init_mnt_opts(&data->lsm_opts);
1598 1601
1599 /* Validate the mount data */ 1602 /* Validate the mount data */
1600 error = nfs_validate_mount_data(raw_data, &data, &mntfh, dev_name); 1603 error = nfs_validate_mount_data(raw_data, data, mntfh, dev_name);
1601 if (error < 0) 1604 if (error < 0)
1602 goto out; 1605 goto out;
1603 1606
1604 /* Get a volume representation */ 1607 /* Get a volume representation */
1605 server = nfs_create_server(&data, &mntfh); 1608 server = nfs_create_server(data, mntfh);
1606 if (IS_ERR(server)) { 1609 if (IS_ERR(server)) {
1607 error = PTR_ERR(server); 1610 error = PTR_ERR(server);
1608 goto out; 1611 goto out;
@@ -1630,16 +1633,16 @@ static int nfs_get_sb(struct file_system_type *fs_type,
1630 1633
1631 if (!s->s_root) { 1634 if (!s->s_root) {
1632 /* initial superblock/root creation */ 1635 /* initial superblock/root creation */
1633 nfs_fill_super(s, &data); 1636 nfs_fill_super(s, data);
1634 } 1637 }
1635 1638
1636 mntroot = nfs_get_root(s, &mntfh); 1639 mntroot = nfs_get_root(s, mntfh);
1637 if (IS_ERR(mntroot)) { 1640 if (IS_ERR(mntroot)) {
1638 error = PTR_ERR(mntroot); 1641 error = PTR_ERR(mntroot);
1639 goto error_splat_super; 1642 goto error_splat_super;
1640 } 1643 }
1641 1644
1642 error = security_sb_set_mnt_opts(s, &data.lsm_opts); 1645 error = security_sb_set_mnt_opts(s, &data->lsm_opts);
1643 if (error) 1646 if (error)
1644 goto error_splat_root; 1647 goto error_splat_root;
1645 1648
@@ -1649,9 +1652,12 @@ static int nfs_get_sb(struct file_system_type *fs_type,
1649 error = 0; 1652 error = 0;
1650 1653
1651out: 1654out:
1652 kfree(data.nfs_server.hostname); 1655 kfree(data->nfs_server.hostname);
1653 kfree(data.mount_server.hostname); 1656 kfree(data->mount_server.hostname);
1654 security_free_mnt_opts(&data.lsm_opts); 1657 security_free_mnt_opts(&data->lsm_opts);
1658out_free_fh:
1659 kfree(mntfh);
1660 kfree(data);
1655 return error; 1661 return error;
1656 1662
1657out_err_nosb: 1663out_err_nosb:
@@ -1800,8 +1806,6 @@ static int nfs4_validate_mount_data(void *options,
1800 struct nfs4_mount_data *data = (struct nfs4_mount_data *)options; 1806 struct nfs4_mount_data *data = (struct nfs4_mount_data *)options;
1801 char *c; 1807 char *c;
1802 1808
1803 memset(args, 0, sizeof(*args));
1804
1805 if (data == NULL) 1809 if (data == NULL)
1806 goto out_no_data; 1810 goto out_no_data;
1807 1811
@@ -1959,26 +1963,31 @@ out_no_client_address:
1959static int nfs4_get_sb(struct file_system_type *fs_type, 1963static int nfs4_get_sb(struct file_system_type *fs_type,
1960 int flags, const char *dev_name, void *raw_data, struct vfsmount *mnt) 1964 int flags, const char *dev_name, void *raw_data, struct vfsmount *mnt)
1961{ 1965{
1962 struct nfs_parsed_mount_data data; 1966 struct nfs_parsed_mount_data *data;
1963 struct super_block *s; 1967 struct super_block *s;
1964 struct nfs_server *server; 1968 struct nfs_server *server;
1965 struct nfs_fh mntfh; 1969 struct nfs_fh *mntfh;
1966 struct dentry *mntroot; 1970 struct dentry *mntroot;
1967 int (*compare_super)(struct super_block *, void *) = nfs_compare_super; 1971 int (*compare_super)(struct super_block *, void *) = nfs_compare_super;
1968 struct nfs_sb_mountdata sb_mntdata = { 1972 struct nfs_sb_mountdata sb_mntdata = {
1969 .mntflags = flags, 1973 .mntflags = flags,
1970 }; 1974 };
1971 int error; 1975 int error = -ENOMEM;
1972 1976
1973 security_init_mnt_opts(&data.lsm_opts); 1977 data = kzalloc(sizeof(*data), GFP_KERNEL);
1978 mntfh = kzalloc(sizeof(*mntfh), GFP_KERNEL);
1979 if (data == NULL || mntfh == NULL)
1980 goto out_free_fh;
1981
1982 security_init_mnt_opts(&data->lsm_opts);
1974 1983
1975 /* Validate the mount data */ 1984 /* Validate the mount data */
1976 error = nfs4_validate_mount_data(raw_data, &data, dev_name); 1985 error = nfs4_validate_mount_data(raw_data, data, dev_name);
1977 if (error < 0) 1986 if (error < 0)
1978 goto out; 1987 goto out;
1979 1988
1980 /* Get a volume representation */ 1989 /* Get a volume representation */
1981 server = nfs4_create_server(&data, &mntfh); 1990 server = nfs4_create_server(data, mntfh);
1982 if (IS_ERR(server)) { 1991 if (IS_ERR(server)) {
1983 error = PTR_ERR(server); 1992 error = PTR_ERR(server);
1984 goto out; 1993 goto out;
@@ -2009,13 +2018,13 @@ static int nfs4_get_sb(struct file_system_type *fs_type,
2009 nfs4_fill_super(s); 2018 nfs4_fill_super(s);
2010 } 2019 }
2011 2020
2012 mntroot = nfs4_get_root(s, &mntfh); 2021 mntroot = nfs4_get_root(s, mntfh);
2013 if (IS_ERR(mntroot)) { 2022 if (IS_ERR(mntroot)) {
2014 error = PTR_ERR(mntroot); 2023 error = PTR_ERR(mntroot);
2015 goto error_splat_super; 2024 goto error_splat_super;
2016 } 2025 }
2017 2026
2018 error = security_sb_set_mnt_opts(s, &data.lsm_opts); 2027 error = security_sb_set_mnt_opts(s, &data->lsm_opts);
2019 if (error) 2028 if (error)
2020 goto error_splat_root; 2029 goto error_splat_root;
2021 2030
@@ -2025,10 +2034,13 @@ static int nfs4_get_sb(struct file_system_type *fs_type,
2025 error = 0; 2034 error = 0;
2026 2035
2027out: 2036out:
2028 kfree(data.client_address); 2037 kfree(data->client_address);
2029 kfree(data.nfs_server.export_path); 2038 kfree(data->nfs_server.export_path);
2030 kfree(data.nfs_server.hostname); 2039 kfree(data->nfs_server.hostname);
2031 security_free_mnt_opts(&data.lsm_opts); 2040 security_free_mnt_opts(&data->lsm_opts);
2041out_free_fh:
2042 kfree(mntfh);
2043 kfree(data);
2032 return error; 2044 return error;
2033 2045
2034out_free: 2046out_free:
diff --git a/fs/nfs/write.c b/fs/nfs/write.c
index 6d8ace3e3259..f333848fd3be 100644
--- a/fs/nfs/write.c
+++ b/fs/nfs/write.c
@@ -739,12 +739,13 @@ int nfs_updatepage(struct file *file, struct page *page,
739 } 739 }
740 740
741 status = nfs_writepage_setup(ctx, page, offset, count); 741 status = nfs_writepage_setup(ctx, page, offset, count);
742 __set_page_dirty_nobuffers(page); 742 if (status < 0)
743 nfs_set_pageerror(page);
744 else
745 __set_page_dirty_nobuffers(page);
743 746
744 dprintk("NFS: nfs_updatepage returns %d (isize %Ld)\n", 747 dprintk("NFS: nfs_updatepage returns %d (isize %Ld)\n",
745 status, (long long)i_size_read(inode)); 748 status, (long long)i_size_read(inode));
746 if (status < 0)
747 nfs_set_pageerror(page);
748 return status; 749 return status;
749} 750}
750 751
diff --git a/fs/pipe.c b/fs/pipe.c
index ec228bc9f882..700f4e0d9572 100644
--- a/fs/pipe.c
+++ b/fs/pipe.c
@@ -1003,8 +1003,7 @@ struct file *create_write_pipe(void)
1003void free_write_pipe(struct file *f) 1003void free_write_pipe(struct file *f)
1004{ 1004{
1005 free_pipe_info(f->f_dentry->d_inode); 1005 free_pipe_info(f->f_dentry->d_inode);
1006 dput(f->f_path.dentry); 1006 path_put(&f->f_path);
1007 mntput(f->f_path.mnt);
1008 put_filp(f); 1007 put_filp(f);
1009} 1008}
1010 1009
@@ -1015,8 +1014,8 @@ struct file *create_read_pipe(struct file *wrf)
1015 return ERR_PTR(-ENFILE); 1014 return ERR_PTR(-ENFILE);
1016 1015
1017 /* Grab pipe from the writer */ 1016 /* Grab pipe from the writer */
1018 f->f_path.mnt = mntget(wrf->f_path.mnt); 1017 f->f_path = wrf->f_path;
1019 f->f_path.dentry = dget(wrf->f_path.dentry); 1018 path_get(&wrf->f_path);
1020 f->f_mapping = wrf->f_path.dentry->d_inode->i_mapping; 1019 f->f_mapping = wrf->f_path.dentry->d_inode->i_mapping;
1021 1020
1022 f->f_pos = 0; 1021 f->f_pos = 0;
@@ -1068,8 +1067,7 @@ int do_pipe(int *fd)
1068 err_fdr: 1067 err_fdr:
1069 put_unused_fd(fdr); 1068 put_unused_fd(fdr);
1070 err_read_pipe: 1069 err_read_pipe:
1071 dput(fr->f_dentry); 1070 path_put(&fr->f_path);
1072 mntput(fr->f_vfsmnt);
1073 put_filp(fr); 1071 put_filp(fr);
1074 err_write_pipe: 1072 err_write_pipe:
1075 free_write_pipe(fw); 1073 free_write_pipe(fw);
diff --git a/fs/select.c b/fs/select.c
index 8dda969614a9..da0e88201c3a 100644
--- a/fs/select.c
+++ b/fs/select.c
@@ -249,7 +249,6 @@ int do_select(int n, fd_set_bits *fds, s64 *timeout)
249 retval++; 249 retval++;
250 } 250 }
251 } 251 }
252 cond_resched();
253 } 252 }
254 if (res_in) 253 if (res_in)
255 *rinp = res_in; 254 *rinp = res_in;
@@ -257,6 +256,7 @@ int do_select(int n, fd_set_bits *fds, s64 *timeout)
257 *routp = res_out; 256 *routp = res_out;
258 if (res_ex) 257 if (res_ex)
259 *rexp = res_ex; 258 *rexp = res_ex;
259 cond_resched();
260 } 260 }
261 wait = NULL; 261 wait = NULL;
262 if (retval || !*timeout || signal_pending(current)) 262 if (retval || !*timeout || signal_pending(current))
diff --git a/fs/udf/super.c b/fs/udf/super.c
index 7a5f69be6ac2..44cc702f96cc 100644
--- a/fs/udf/super.c
+++ b/fs/udf/super.c
@@ -682,38 +682,26 @@ static int udf_vrs(struct super_block *sb, int silent)
682/* 682/*
683 * Check whether there is an anchor block in the given block 683 * Check whether there is an anchor block in the given block
684 */ 684 */
685static int udf_check_anchor_block(struct super_block *sb, sector_t block, 685static int udf_check_anchor_block(struct super_block *sb, sector_t block)
686 bool varconv)
687{ 686{
688 struct buffer_head *bh = NULL; 687 struct buffer_head *bh;
689 tag *t;
690 uint16_t ident; 688 uint16_t ident;
691 uint32_t location;
692 689
693 if (varconv) { 690 if (UDF_QUERY_FLAG(sb, UDF_FLAG_VARCONV) &&
694 if (udf_fixed_to_variable(block) >= 691 udf_fixed_to_variable(block) >=
695 sb->s_bdev->bd_inode->i_size >> sb->s_blocksize_bits) 692 sb->s_bdev->bd_inode->i_size >> sb->s_blocksize_bits)
696 return 0; 693 return 0;
697 bh = sb_bread(sb, udf_fixed_to_variable(block));
698 }
699 else
700 bh = sb_bread(sb, block);
701 694
695 bh = udf_read_tagged(sb, block, block, &ident);
702 if (!bh) 696 if (!bh)
703 return 0; 697 return 0;
704
705 t = (tag *)bh->b_data;
706 ident = le16_to_cpu(t->tagIdent);
707 location = le32_to_cpu(t->tagLocation);
708 brelse(bh); 698 brelse(bh);
709 if (ident != TAG_IDENT_AVDP) 699
710 return 0; 700 return ident == TAG_IDENT_AVDP;
711 return location == block;
712} 701}
713 702
714/* Search for an anchor volume descriptor pointer */ 703/* Search for an anchor volume descriptor pointer */
715static sector_t udf_scan_anchors(struct super_block *sb, bool varconv, 704static sector_t udf_scan_anchors(struct super_block *sb, sector_t lastblock)
716 sector_t lastblock)
717{ 705{
718 sector_t last[6]; 706 sector_t last[6];
719 int i; 707 int i;
@@ -739,7 +727,7 @@ static sector_t udf_scan_anchors(struct super_block *sb, bool varconv,
739 sb->s_blocksize_bits) 727 sb->s_blocksize_bits)
740 continue; 728 continue;
741 729
742 if (udf_check_anchor_block(sb, last[i], varconv)) { 730 if (udf_check_anchor_block(sb, last[i])) {
743 sbi->s_anchor[0] = last[i]; 731 sbi->s_anchor[0] = last[i];
744 sbi->s_anchor[1] = last[i] - 256; 732 sbi->s_anchor[1] = last[i] - 256;
745 return last[i]; 733 return last[i];
@@ -748,17 +736,17 @@ static sector_t udf_scan_anchors(struct super_block *sb, bool varconv,
748 if (last[i] < 256) 736 if (last[i] < 256)
749 continue; 737 continue;
750 738
751 if (udf_check_anchor_block(sb, last[i] - 256, varconv)) { 739 if (udf_check_anchor_block(sb, last[i] - 256)) {
752 sbi->s_anchor[1] = last[i] - 256; 740 sbi->s_anchor[1] = last[i] - 256;
753 return last[i]; 741 return last[i];
754 } 742 }
755 } 743 }
756 744
757 if (udf_check_anchor_block(sb, sbi->s_session + 256, varconv)) { 745 if (udf_check_anchor_block(sb, sbi->s_session + 256)) {
758 sbi->s_anchor[0] = sbi->s_session + 256; 746 sbi->s_anchor[0] = sbi->s_session + 256;
759 return last[0]; 747 return last[0];
760 } 748 }
761 if (udf_check_anchor_block(sb, sbi->s_session + 512, varconv)) { 749 if (udf_check_anchor_block(sb, sbi->s_session + 512)) {
762 sbi->s_anchor[0] = sbi->s_session + 512; 750 sbi->s_anchor[0] = sbi->s_session + 512;
763 return last[0]; 751 return last[0];
764 } 752 }
@@ -780,23 +768,24 @@ static void udf_find_anchor(struct super_block *sb)
780 int i; 768 int i;
781 struct udf_sb_info *sbi = UDF_SB(sb); 769 struct udf_sb_info *sbi = UDF_SB(sb);
782 770
783 lastblock = udf_scan_anchors(sb, 0, sbi->s_last_block); 771 lastblock = udf_scan_anchors(sb, sbi->s_last_block);
784 if (lastblock) 772 if (lastblock)
785 goto check_anchor; 773 goto check_anchor;
786 774
787 /* No anchor found? Try VARCONV conversion of block numbers */ 775 /* No anchor found? Try VARCONV conversion of block numbers */
776 UDF_SET_FLAG(sb, UDF_FLAG_VARCONV);
788 /* Firstly, we try to not convert number of the last block */ 777 /* Firstly, we try to not convert number of the last block */
789 lastblock = udf_scan_anchors(sb, 1, 778 lastblock = udf_scan_anchors(sb,
790 udf_variable_to_fixed(sbi->s_last_block)); 779 udf_variable_to_fixed(sbi->s_last_block));
791 if (lastblock) { 780 if (lastblock)
792 UDF_SET_FLAG(sb, UDF_FLAG_VARCONV);
793 goto check_anchor; 781 goto check_anchor;
794 }
795 782
796 /* Secondly, we try with converted number of the last block */ 783 /* Secondly, we try with converted number of the last block */
797 lastblock = udf_scan_anchors(sb, 1, sbi->s_last_block); 784 lastblock = udf_scan_anchors(sb, sbi->s_last_block);
798 if (lastblock) 785 if (!lastblock) {
799 UDF_SET_FLAG(sb, UDF_FLAG_VARCONV); 786 /* VARCONV didn't help. Clear it. */
787 UDF_CLEAR_FLAG(sb, UDF_FLAG_VARCONV);
788 }
800 789
801check_anchor: 790check_anchor:
802 /* 791 /*
diff --git a/fs/utimes.c b/fs/utimes.c
index af059d5cb485..b6b664e7145e 100644
--- a/fs/utimes.c
+++ b/fs/utimes.c
@@ -40,14 +40,9 @@ asmlinkage long sys_utime(char __user *filename, struct utimbuf __user *times)
40 40
41#endif 41#endif
42 42
43static bool nsec_special(long nsec)
44{
45 return nsec == UTIME_OMIT || nsec == UTIME_NOW;
46}
47
48static bool nsec_valid(long nsec) 43static bool nsec_valid(long nsec)
49{ 44{
50 if (nsec_special(nsec)) 45 if (nsec == UTIME_OMIT || nsec == UTIME_NOW)
51 return true; 46 return true;
52 47
53 return nsec >= 0 && nsec <= 999999999; 48 return nsec >= 0 && nsec <= 999999999;
@@ -102,7 +97,11 @@ long do_utimes(int dfd, char __user *filename, struct timespec *times, int flags
102 if (error) 97 if (error)
103 goto dput_and_out; 98 goto dput_and_out;
104 99
105 /* Don't worry, the checks are done in inode_change_ok() */ 100 if (times && times[0].tv_nsec == UTIME_NOW &&
101 times[1].tv_nsec == UTIME_NOW)
102 times = NULL;
103
104 /* In most cases, the checks are done in inode_change_ok() */
106 newattrs.ia_valid = ATTR_CTIME | ATTR_MTIME | ATTR_ATIME; 105 newattrs.ia_valid = ATTR_CTIME | ATTR_MTIME | ATTR_ATIME;
107 if (times) { 106 if (times) {
108 error = -EPERM; 107 error = -EPERM;
@@ -124,28 +123,34 @@ long do_utimes(int dfd, char __user *filename, struct timespec *times, int flags
124 newattrs.ia_mtime.tv_nsec = times[1].tv_nsec; 123 newattrs.ia_mtime.tv_nsec = times[1].tv_nsec;
125 newattrs.ia_valid |= ATTR_MTIME_SET; 124 newattrs.ia_valid |= ATTR_MTIME_SET;
126 } 125 }
127 }
128 126
129 /* 127 /*
130 * If times is NULL or both times are either UTIME_OMIT or 128 * For the UTIME_OMIT/UTIME_NOW and UTIME_NOW/UTIME_OMIT
131 * UTIME_NOW, then need to check permissions, because 129 * cases, we need to make an extra check that is not done by
132 * inode_change_ok() won't do it. 130 * inode_change_ok().
133 */ 131 */
134 if (!times || (nsec_special(times[0].tv_nsec) && 132 if (((times[0].tv_nsec == UTIME_NOW &&
135 nsec_special(times[1].tv_nsec))) { 133 times[1].tv_nsec == UTIME_OMIT)
134 ||
135 (times[0].tv_nsec == UTIME_OMIT &&
136 times[1].tv_nsec == UTIME_NOW))
137 && !is_owner_or_cap(inode))
138 goto mnt_drop_write_and_out;
139 } else {
140
141 /*
142 * If times is NULL (or both times are UTIME_NOW),
143 * then we need to check permissions, because
144 * inode_change_ok() won't do it.
145 */
136 error = -EACCES; 146 error = -EACCES;
137 if (IS_IMMUTABLE(inode)) 147 if (IS_IMMUTABLE(inode))
138 goto mnt_drop_write_and_out; 148 goto mnt_drop_write_and_out;
139 149
140 if (!is_owner_or_cap(inode)) { 150 if (!is_owner_or_cap(inode)) {
141 if (f) { 151 error = permission(inode, MAY_WRITE, NULL);
142 if (!(f->f_mode & FMODE_WRITE)) 152 if (error)
143 goto mnt_drop_write_and_out; 153 goto mnt_drop_write_and_out;
144 } else {
145 error = vfs_permission(&nd, MAY_WRITE);
146 if (error)
147 goto mnt_drop_write_and_out;
148 }
149 } 154 }
150 } 155 }
151 mutex_lock(&inode->i_mutex); 156 mutex_lock(&inode->i_mutex);
@@ -169,14 +174,6 @@ asmlinkage long sys_utimensat(int dfd, char __user *filename, struct timespec __
169 if (utimes) { 174 if (utimes) {
170 if (copy_from_user(&tstimes, utimes, sizeof(tstimes))) 175 if (copy_from_user(&tstimes, utimes, sizeof(tstimes)))
171 return -EFAULT; 176 return -EFAULT;
172 if ((tstimes[0].tv_nsec == UTIME_OMIT ||
173 tstimes[0].tv_nsec == UTIME_NOW) &&
174 tstimes[0].tv_sec != 0)
175 return -EINVAL;
176 if ((tstimes[1].tv_nsec == UTIME_OMIT ||
177 tstimes[1].tv_nsec == UTIME_NOW) &&
178 tstimes[1].tv_sec != 0)
179 return -EINVAL;
180 177
181 /* Nothing to do, we must not even check the path. */ 178 /* Nothing to do, we must not even check the path. */
182 if (tstimes[0].tv_nsec == UTIME_OMIT && 179 if (tstimes[0].tv_nsec == UTIME_OMIT &&
diff --git a/include/asm-alpha/core_mcpcia.h b/include/asm-alpha/core_mcpcia.h
index 525b4f6a7ace..acf55b483472 100644
--- a/include/asm-alpha/core_mcpcia.h
+++ b/include/asm-alpha/core_mcpcia.h
@@ -261,7 +261,7 @@ struct el_MCPCIA_uncorrected_frame_mcheck {
261 } 261 }
262#endif 262#endif
263 263
264static inline int __mcpcia_is_mmio(unsigned long addr) 264extern inline int __mcpcia_is_mmio(unsigned long addr)
265{ 265{
266 return (addr & 0x80000000UL) == 0; 266 return (addr & 0x80000000UL) == 0;
267} 267}
diff --git a/include/asm-alpha/core_t2.h b/include/asm-alpha/core_t2.h
index 90e6b5d6c214..46bfff58f670 100644
--- a/include/asm-alpha/core_t2.h
+++ b/include/asm-alpha/core_t2.h
@@ -356,13 +356,13 @@ struct el_t2_frame_corrected {
356#define vip volatile int * 356#define vip volatile int *
357#define vuip volatile unsigned int * 357#define vuip volatile unsigned int *
358 358
359static inline u8 t2_inb(unsigned long addr) 359extern inline u8 t2_inb(unsigned long addr)
360{ 360{
361 long result = *(vip) ((addr << 5) + T2_IO + 0x00); 361 long result = *(vip) ((addr << 5) + T2_IO + 0x00);
362 return __kernel_extbl(result, addr & 3); 362 return __kernel_extbl(result, addr & 3);
363} 363}
364 364
365static inline void t2_outb(u8 b, unsigned long addr) 365extern inline void t2_outb(u8 b, unsigned long addr)
366{ 366{
367 unsigned long w; 367 unsigned long w;
368 368
@@ -371,13 +371,13 @@ static inline void t2_outb(u8 b, unsigned long addr)
371 mb(); 371 mb();
372} 372}
373 373
374static inline u16 t2_inw(unsigned long addr) 374extern inline u16 t2_inw(unsigned long addr)
375{ 375{
376 long result = *(vip) ((addr << 5) + T2_IO + 0x08); 376 long result = *(vip) ((addr << 5) + T2_IO + 0x08);
377 return __kernel_extwl(result, addr & 3); 377 return __kernel_extwl(result, addr & 3);
378} 378}
379 379
380static inline void t2_outw(u16 b, unsigned long addr) 380extern inline void t2_outw(u16 b, unsigned long addr)
381{ 381{
382 unsigned long w; 382 unsigned long w;
383 383
@@ -386,12 +386,12 @@ static inline void t2_outw(u16 b, unsigned long addr)
386 mb(); 386 mb();
387} 387}
388 388
389static inline u32 t2_inl(unsigned long addr) 389extern inline u32 t2_inl(unsigned long addr)
390{ 390{
391 return *(vuip) ((addr << 5) + T2_IO + 0x18); 391 return *(vuip) ((addr << 5) + T2_IO + 0x18);
392} 392}
393 393
394static inline void t2_outl(u32 b, unsigned long addr) 394extern inline void t2_outl(u32 b, unsigned long addr)
395{ 395{
396 *(vuip) ((addr << 5) + T2_IO + 0x18) = b; 396 *(vuip) ((addr << 5) + T2_IO + 0x18) = b;
397 mb(); 397 mb();
@@ -435,7 +435,7 @@ static inline void t2_outl(u32 b, unsigned long addr)
435 set_hae(msb); \ 435 set_hae(msb); \
436} 436}
437 437
438static DEFINE_SPINLOCK(t2_hae_lock); 438extern spinlock_t t2_hae_lock;
439 439
440/* 440/*
441 * NOTE: take T2_DENSE_MEM off in each readX/writeX routine, since 441 * NOTE: take T2_DENSE_MEM off in each readX/writeX routine, since
diff --git a/include/asm-alpha/io.h b/include/asm-alpha/io.h
index 38f18cf18c9d..e971ab000f95 100644
--- a/include/asm-alpha/io.h
+++ b/include/asm-alpha/io.h
@@ -35,7 +35,7 @@
35 * register not being up-to-date with respect to the hardware 35 * register not being up-to-date with respect to the hardware
36 * value. 36 * value.
37 */ 37 */
38static inline void __set_hae(unsigned long new_hae) 38extern inline void __set_hae(unsigned long new_hae)
39{ 39{
40 unsigned long flags; 40 unsigned long flags;
41 local_irq_save(flags); 41 local_irq_save(flags);
@@ -49,7 +49,7 @@ static inline void __set_hae(unsigned long new_hae)
49 local_irq_restore(flags); 49 local_irq_restore(flags);
50} 50}
51 51
52static inline void set_hae(unsigned long new_hae) 52extern inline void set_hae(unsigned long new_hae)
53{ 53{
54 if (new_hae != alpha_mv.hae_cache) 54 if (new_hae != alpha_mv.hae_cache)
55 __set_hae(new_hae); 55 __set_hae(new_hae);
@@ -176,7 +176,7 @@ REMAP2(u64, writeq, volatile)
176#undef REMAP1 176#undef REMAP1
177#undef REMAP2 177#undef REMAP2
178 178
179static inline void __iomem *generic_ioportmap(unsigned long a) 179extern inline void __iomem *generic_ioportmap(unsigned long a)
180{ 180{
181 return alpha_mv.mv_ioportmap(a); 181 return alpha_mv.mv_ioportmap(a);
182} 182}
diff --git a/include/asm-alpha/mmu_context.h b/include/asm-alpha/mmu_context.h
index 6a5be1f7debf..86c08a02d239 100644
--- a/include/asm-alpha/mmu_context.h
+++ b/include/asm-alpha/mmu_context.h
@@ -23,7 +23,7 @@
23#endif 23#endif
24 24
25 25
26extern inline unsigned long 26static inline unsigned long
27__reload_thread(struct pcb_struct *pcb) 27__reload_thread(struct pcb_struct *pcb)
28{ 28{
29 register unsigned long a0 __asm__("$16"); 29 register unsigned long a0 __asm__("$16");
@@ -114,7 +114,7 @@ extern unsigned long last_asn;
114#define __MMU_EXTERN_INLINE 114#define __MMU_EXTERN_INLINE
115#endif 115#endif
116 116
117static inline unsigned long 117extern inline unsigned long
118__get_new_mm_context(struct mm_struct *mm, long cpu) 118__get_new_mm_context(struct mm_struct *mm, long cpu)
119{ 119{
120 unsigned long asn = cpu_last_asn(cpu); 120 unsigned long asn = cpu_last_asn(cpu);
@@ -226,7 +226,7 @@ ev4_activate_mm(struct mm_struct *prev_mm, struct mm_struct *next_mm)
226# endif 226# endif
227#endif 227#endif
228 228
229extern inline int 229static inline int
230init_new_context(struct task_struct *tsk, struct mm_struct *mm) 230init_new_context(struct task_struct *tsk, struct mm_struct *mm)
231{ 231{
232 int i; 232 int i;
diff --git a/include/asm-alpha/percpu.h b/include/asm-alpha/percpu.h
index 48348fe34c19..3495e8e00d70 100644
--- a/include/asm-alpha/percpu.h
+++ b/include/asm-alpha/percpu.h
@@ -1,6 +1,78 @@
1#ifndef __ALPHA_PERCPU_H 1#ifndef __ALPHA_PERCPU_H
2#define __ALPHA_PERCPU_H 2#define __ALPHA_PERCPU_H
3#include <linux/compiler.h>
4#include <linux/threads.h>
3 5
4#include <asm-generic/percpu.h> 6/*
7 * Determine the real variable name from the name visible in the
8 * kernel sources.
9 */
10#define per_cpu_var(var) per_cpu__##var
11
12#ifdef CONFIG_SMP
13
14/*
15 * per_cpu_offset() is the offset that has to be added to a
16 * percpu variable to get to the instance for a certain processor.
17 */
18extern unsigned long __per_cpu_offset[NR_CPUS];
19
20#define per_cpu_offset(x) (__per_cpu_offset[x])
21
22#define __my_cpu_offset per_cpu_offset(raw_smp_processor_id())
23#ifdef CONFIG_DEBUG_PREEMPT
24#define my_cpu_offset per_cpu_offset(smp_processor_id())
25#else
26#define my_cpu_offset __my_cpu_offset
27#endif
28
29#ifndef MODULE
30#define SHIFT_PERCPU_PTR(var, offset) RELOC_HIDE(&per_cpu_var(var), (offset))
31#define PER_CPU_ATTRIBUTES
32#else
33/*
34 * To calculate addresses of locally defined variables, GCC uses 32-bit
35 * displacement from the GP. Which doesn't work for per cpu variables in
36 * modules, as an offset to the kernel per cpu area is way above 4G.
37 *
38 * This forces allocation of a GOT entry for per cpu variable using
39 * ldq instruction with a 'literal' relocation.
40 */
41#define SHIFT_PERCPU_PTR(var, offset) ({ \
42 extern int simple_identifier_##var(void); \
43 unsigned long __ptr, tmp_gp; \
44 asm ( "br %1, 1f \n\
45 1: ldgp %1, 0(%1) \n\
46 ldq %0, per_cpu__" #var"(%1)\t!literal" \
47 : "=&r"(__ptr), "=&r"(tmp_gp)); \
48 (typeof(&per_cpu_var(var)))(__ptr + (offset)); })
49
50#define PER_CPU_ATTRIBUTES __used
51
52#endif /* MODULE */
53
54/*
55 * A percpu variable may point to a discarded regions. The following are
56 * established ways to produce a usable pointer from the percpu variable
57 * offset.
58 */
59#define per_cpu(var, cpu) \
60 (*SHIFT_PERCPU_PTR(var, per_cpu_offset(cpu)))
61#define __get_cpu_var(var) \
62 (*SHIFT_PERCPU_PTR(var, my_cpu_offset))
63#define __raw_get_cpu_var(var) \
64 (*SHIFT_PERCPU_PTR(var, __my_cpu_offset))
65
66#else /* ! SMP */
67
68#define per_cpu(var, cpu) (*((void)(cpu), &per_cpu_var(var)))
69#define __get_cpu_var(var) per_cpu_var(var)
70#define __raw_get_cpu_var(var) per_cpu_var(var)
71
72#define PER_CPU_ATTRIBUTES
73
74#endif /* SMP */
75
76#define DECLARE_PER_CPU(type, name) extern __typeof__(type) per_cpu_var(name)
5 77
6#endif /* __ALPHA_PERCPU_H */ 78#endif /* __ALPHA_PERCPU_H */
diff --git a/include/asm-alpha/system.h b/include/asm-alpha/system.h
index ed221d6408fc..afe20fa58c99 100644
--- a/include/asm-alpha/system.h
+++ b/include/asm-alpha/system.h
@@ -184,7 +184,7 @@ enum amask_enum {
184 __amask; }) 184 __amask; })
185 185
186#define __CALL_PAL_R0(NAME, TYPE) \ 186#define __CALL_PAL_R0(NAME, TYPE) \
187static inline TYPE NAME(void) \ 187extern inline TYPE NAME(void) \
188{ \ 188{ \
189 register TYPE __r0 __asm__("$0"); \ 189 register TYPE __r0 __asm__("$0"); \
190 __asm__ __volatile__( \ 190 __asm__ __volatile__( \
@@ -196,7 +196,7 @@ static inline TYPE NAME(void) \
196} 196}
197 197
198#define __CALL_PAL_W1(NAME, TYPE0) \ 198#define __CALL_PAL_W1(NAME, TYPE0) \
199static inline void NAME(TYPE0 arg0) \ 199extern inline void NAME(TYPE0 arg0) \
200{ \ 200{ \
201 register TYPE0 __r16 __asm__("$16") = arg0; \ 201 register TYPE0 __r16 __asm__("$16") = arg0; \
202 __asm__ __volatile__( \ 202 __asm__ __volatile__( \
@@ -207,7 +207,7 @@ static inline void NAME(TYPE0 arg0) \
207} 207}
208 208
209#define __CALL_PAL_W2(NAME, TYPE0, TYPE1) \ 209#define __CALL_PAL_W2(NAME, TYPE0, TYPE1) \
210static inline void NAME(TYPE0 arg0, TYPE1 arg1) \ 210extern inline void NAME(TYPE0 arg0, TYPE1 arg1) \
211{ \ 211{ \
212 register TYPE0 __r16 __asm__("$16") = arg0; \ 212 register TYPE0 __r16 __asm__("$16") = arg0; \
213 register TYPE1 __r17 __asm__("$17") = arg1; \ 213 register TYPE1 __r17 __asm__("$17") = arg1; \
@@ -219,7 +219,7 @@ static inline void NAME(TYPE0 arg0, TYPE1 arg1) \
219} 219}
220 220
221#define __CALL_PAL_RW1(NAME, RTYPE, TYPE0) \ 221#define __CALL_PAL_RW1(NAME, RTYPE, TYPE0) \
222static inline RTYPE NAME(TYPE0 arg0) \ 222extern inline RTYPE NAME(TYPE0 arg0) \
223{ \ 223{ \
224 register RTYPE __r0 __asm__("$0"); \ 224 register RTYPE __r0 __asm__("$0"); \
225 register TYPE0 __r16 __asm__("$16") = arg0; \ 225 register TYPE0 __r16 __asm__("$16") = arg0; \
@@ -232,7 +232,7 @@ static inline RTYPE NAME(TYPE0 arg0) \
232} 232}
233 233
234#define __CALL_PAL_RW2(NAME, RTYPE, TYPE0, TYPE1) \ 234#define __CALL_PAL_RW2(NAME, RTYPE, TYPE0, TYPE1) \
235static inline RTYPE NAME(TYPE0 arg0, TYPE1 arg1) \ 235extern inline RTYPE NAME(TYPE0 arg0, TYPE1 arg1) \
236{ \ 236{ \
237 register RTYPE __r0 __asm__("$0"); \ 237 register RTYPE __r0 __asm__("$0"); \
238 register TYPE0 __r16 __asm__("$16") = arg0; \ 238 register TYPE0 __r16 __asm__("$16") = arg0; \
diff --git a/include/asm-alpha/vga.h b/include/asm-alpha/vga.h
index e8df1e7aae6b..c00106bac521 100644
--- a/include/asm-alpha/vga.h
+++ b/include/asm-alpha/vga.h
@@ -13,7 +13,7 @@
13#define VT_BUF_HAVE_MEMSETW 13#define VT_BUF_HAVE_MEMSETW
14#define VT_BUF_HAVE_MEMCPYW 14#define VT_BUF_HAVE_MEMCPYW
15 15
16extern inline void scr_writew(u16 val, volatile u16 *addr) 16static inline void scr_writew(u16 val, volatile u16 *addr)
17{ 17{
18 if (__is_ioaddr(addr)) 18 if (__is_ioaddr(addr))
19 __raw_writew(val, (volatile u16 __iomem *) addr); 19 __raw_writew(val, (volatile u16 __iomem *) addr);
@@ -21,7 +21,7 @@ extern inline void scr_writew(u16 val, volatile u16 *addr)
21 *addr = val; 21 *addr = val;
22} 22}
23 23
24extern inline u16 scr_readw(volatile const u16 *addr) 24static inline u16 scr_readw(volatile const u16 *addr)
25{ 25{
26 if (__is_ioaddr(addr)) 26 if (__is_ioaddr(addr))
27 return __raw_readw((volatile const u16 __iomem *) addr); 27 return __raw_readw((volatile const u16 __iomem *) addr);
@@ -29,7 +29,7 @@ extern inline u16 scr_readw(volatile const u16 *addr)
29 return *addr; 29 return *addr;
30} 30}
31 31
32extern inline void scr_memsetw(u16 *s, u16 c, unsigned int count) 32static inline void scr_memsetw(u16 *s, u16 c, unsigned int count)
33{ 33{
34 if (__is_ioaddr(s)) 34 if (__is_ioaddr(s))
35 memsetw_io((u16 __iomem *) s, c, count); 35 memsetw_io((u16 __iomem *) s, c, count);
diff --git a/include/asm-arm/arch-at91/at91_pmc.h b/include/asm-arm/arch-at91/at91_pmc.h
index c2b13c280155..2001e81f2267 100644
--- a/include/asm-arm/arch-at91/at91_pmc.h
+++ b/include/asm-arm/arch-at91/at91_pmc.h
@@ -39,10 +39,14 @@
39#define AT91_PMC_PCSR (AT91_PMC + 0x18) /* Peripheral Clock Status Register */ 39#define AT91_PMC_PCSR (AT91_PMC + 0x18) /* Peripheral Clock Status Register */
40 40
41#define AT91_CKGR_UCKR (AT91_PMC + 0x1C) /* UTMI Clock Register [SAM9RL, CAP9] */ 41#define AT91_CKGR_UCKR (AT91_PMC + 0x1C) /* UTMI Clock Register [SAM9RL, CAP9] */
42#define AT91_PMC_UPLLEN (1 << 16) /* UTMI PLL Enable */
43#define AT91_PMC_UPLLCOUNT (0xf << 20) /* UTMI PLL Start-up Time */
44#define AT91_PMC_BIASEN (1 << 24) /* UTMI BIAS Enable */
45#define AT91_PMC_BIASCOUNT (0xf << 28) /* UTMI PLL Start-up Time */
42 46
43#define AT91_CKGR_MOR (AT91_PMC + 0x20) /* Main Oscillator Register [not on SAM9RL] */ 47#define AT91_CKGR_MOR (AT91_PMC + 0x20) /* Main Oscillator Register [not on SAM9RL] */
44#define AT91_PMC_MOSCEN (1 << 0) /* Main Oscillator Enable */ 48#define AT91_PMC_MOSCEN (1 << 0) /* Main Oscillator Enable */
45#define AT91_PMC_OSCBYPASS (1 << 1) /* Oscillator Bypass [AT91SAM926x only] */ 49#define AT91_PMC_OSCBYPASS (1 << 1) /* Oscillator Bypass [SAM9x, CAP9] */
46#define AT91_PMC_OSCOUNT (0xff << 8) /* Main Oscillator Start-up Time */ 50#define AT91_PMC_OSCOUNT (0xff << 8) /* Main Oscillator Start-up Time */
47 51
48#define AT91_CKGR_MCFR (AT91_PMC + 0x24) /* Main Clock Frequency Register */ 52#define AT91_CKGR_MCFR (AT91_PMC + 0x24) /* Main Clock Frequency Register */
@@ -97,6 +101,7 @@
97#define AT91_PMC_LOCKA (1 << 1) /* PLLA Lock */ 101#define AT91_PMC_LOCKA (1 << 1) /* PLLA Lock */
98#define AT91_PMC_LOCKB (1 << 2) /* PLLB Lock */ 102#define AT91_PMC_LOCKB (1 << 2) /* PLLB Lock */
99#define AT91_PMC_MCKRDY (1 << 3) /* Master Clock */ 103#define AT91_PMC_MCKRDY (1 << 3) /* Master Clock */
104#define AT91_PMC_LOCKU (1 << 6) /* UPLL Lock [AT91CAP9 only] */
100#define AT91_PMC_PCK0RDY (1 << 8) /* Programmable Clock 0 */ 105#define AT91_PMC_PCK0RDY (1 << 8) /* Programmable Clock 0 */
101#define AT91_PMC_PCK1RDY (1 << 9) /* Programmable Clock 1 */ 106#define AT91_PMC_PCK1RDY (1 << 9) /* Programmable Clock 1 */
102#define AT91_PMC_PCK2RDY (1 << 10) /* Programmable Clock 2 */ 107#define AT91_PMC_PCK2RDY (1 << 10) /* Programmable Clock 2 */
diff --git a/include/asm-arm/arch-at91/at91cap9.h b/include/asm-arm/arch-at91/at91cap9.h
index bac83adb5050..6f14d9053ac7 100644
--- a/include/asm-arm/arch-at91/at91cap9.h
+++ b/include/asm-arm/arch-at91/at91cap9.h
@@ -118,7 +118,7 @@
118#define AT91CAP9_ROM_SIZE (32 * SZ_1K) /* Internal ROM size (32Kb) */ 118#define AT91CAP9_ROM_SIZE (32 * SZ_1K) /* Internal ROM size (32Kb) */
119 119
120#define AT91CAP9_LCDC_BASE 0x00500000 /* LCD Controller */ 120#define AT91CAP9_LCDC_BASE 0x00500000 /* LCD Controller */
121#define AT91CAP9_UDPHS_BASE 0x00600000 /* USB High Speed Device Port */ 121#define AT91CAP9_UDPHS_FIFO 0x00600000 /* USB High Speed Device Port */
122#define AT91CAP9_UHP_BASE 0x00700000 /* USB Host controller */ 122#define AT91CAP9_UHP_BASE 0x00700000 /* USB Host controller */
123 123
124#define CONFIG_DRAM_BASE AT91_CHIPSELECT_6 124#define CONFIG_DRAM_BASE AT91_CHIPSELECT_6
diff --git a/include/asm-arm/arch-at91/at91cap9_matrix.h b/include/asm-arm/arch-at91/at91cap9_matrix.h
index a641686b6c3d..ddbd4873c842 100644
--- a/include/asm-arm/arch-at91/at91cap9_matrix.h
+++ b/include/asm-arm/arch-at91/at91cap9_matrix.h
@@ -106,6 +106,11 @@
106#define AT91_MPBS0_SFR (AT91_MATRIX + 0x114) /* MPBlock Slave 0 Special Function Register */ 106#define AT91_MPBS0_SFR (AT91_MATRIX + 0x114) /* MPBlock Slave 0 Special Function Register */
107#define AT91_MPBS1_SFR (AT91_MATRIX + 0x11C) /* MPBlock Slave 1 Special Function Register */ 107#define AT91_MPBS1_SFR (AT91_MATRIX + 0x11C) /* MPBlock Slave 1 Special Function Register */
108 108
109#define AT91_MATRIX_UDPHS (AT91_MATRIX + 0x118) /* USBHS Special Function Register [AT91CAP9 only] */
110#define AT91_MATRIX_SELECT_UDPHS (0 << 31) /* select High Speed UDP */
111#define AT91_MATRIX_SELECT_UDP (1 << 31) /* select standard UDP */
112#define AT91_MATRIX_UDPHS_BYPASS_LOCK (1 << 30) /* bypass lock bit */
113
109#define AT91_MATRIX_EBICSA (AT91_MATRIX + 0x120) /* EBI Chip Select Assignment Register */ 114#define AT91_MATRIX_EBICSA (AT91_MATRIX + 0x120) /* EBI Chip Select Assignment Register */
110#define AT91_MATRIX_EBI_CS1A (1 << 1) /* Chip Select 1 Assignment */ 115#define AT91_MATRIX_EBI_CS1A (1 << 1) /* Chip Select 1 Assignment */
111#define AT91_MATRIX_EBI_CS1A_SMC (0 << 1) 116#define AT91_MATRIX_EBI_CS1A_SMC (0 << 1)
diff --git a/include/asm-arm/arch-at91/at91sam9260.h b/include/asm-arm/arch-at91/at91sam9260.h
index c8934fe34dc5..889872a3f2a9 100644
--- a/include/asm-arm/arch-at91/at91sam9260.h
+++ b/include/asm-arm/arch-at91/at91sam9260.h
@@ -6,6 +6,8 @@
6 * Common definitions. 6 * Common definitions.
7 * Based on AT91SAM9260 datasheet revision A (Preliminary). 7 * Based on AT91SAM9260 datasheet revision A (Preliminary).
8 * 8 *
9 * Includes also definitions for AT91SAM9XE and AT91SAM9G families
10 *
9 * This program is free software; you can redistribute it and/or modify 11 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by 12 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or 13 * the Free Software Foundation; either version 2 of the License, or
@@ -123,5 +125,14 @@
123#define AT91SAM9XE_FLASH_BASE 0x00200000 /* Internal FLASH base address */ 125#define AT91SAM9XE_FLASH_BASE 0x00200000 /* Internal FLASH base address */
124#define AT91SAM9XE_SRAM_BASE 0x00300000 /* Internal SRAM base address */ 126#define AT91SAM9XE_SRAM_BASE 0x00300000 /* Internal SRAM base address */
125 127
128#define AT91SAM9G20_ROM_BASE 0x00100000 /* Internal ROM base address */
129#define AT91SAM9G20_ROM_SIZE SZ_32K /* Internal ROM size (32Kb) */
130
131#define AT91SAM9G20_SRAM0_BASE 0x00200000 /* Internal SRAM 0 base address */
132#define AT91SAM9G20_SRAM0_SIZE SZ_16K /* Internal SRAM 0 size (16Kb) */
133#define AT91SAM9G20_SRAM1_BASE 0x00300000 /* Internal SRAM 1 base address */
134#define AT91SAM9G20_SRAM1_SIZE SZ_16K /* Internal SRAM 1 size (16Kb) */
135
136#define AT91SAM9G20_UHP_BASE 0x00500000 /* USB Host controller */
126 137
127#endif 138#endif
diff --git a/include/asm-arm/arch-at91/at91sam9rl.h b/include/asm-arm/arch-at91/at91sam9rl.h
index 16d2832f6c0a..622e56f81d42 100644
--- a/include/asm-arm/arch-at91/at91sam9rl.h
+++ b/include/asm-arm/arch-at91/at91sam9rl.h
@@ -110,6 +110,6 @@
110#define AT91SAM9RL_ROM_SIZE (2 * SZ_16K) /* Internal ROM size (32Kb) */ 110#define AT91SAM9RL_ROM_SIZE (2 * SZ_16K) /* Internal ROM size (32Kb) */
111 111
112#define AT91SAM9RL_LCDC_BASE 0x00500000 /* LCD Controller */ 112#define AT91SAM9RL_LCDC_BASE 0x00500000 /* LCD Controller */
113#define AT91SAM9RL_UDPHS_BASE 0x00600000 /* USB Device HS controller */ 113#define AT91SAM9RL_UDPHS_FIFO 0x00600000 /* USB Device HS controller */
114 114
115#endif 115#endif
diff --git a/include/asm-arm/arch-at91/board.h b/include/asm-arm/arch-at91/board.h
index dc189f01c5b3..94de788da76e 100644
--- a/include/asm-arm/arch-at91/board.h
+++ b/include/asm-arm/arch-at91/board.h
@@ -36,6 +36,7 @@
36#include <linux/i2c.h> 36#include <linux/i2c.h>
37#include <linux/leds.h> 37#include <linux/leds.h>
38#include <linux/spi/spi.h> 38#include <linux/spi/spi.h>
39#include <linux/usb/atmel_usba_udc.h>
39 40
40 /* USB Device */ 41 /* USB Device */
41struct at91_udc_data { 42struct at91_udc_data {
@@ -45,6 +46,9 @@ struct at91_udc_data {
45}; 46};
46extern void __init at91_add_device_udc(struct at91_udc_data *data); 47extern void __init at91_add_device_udc(struct at91_udc_data *data);
47 48
49 /* USB High Speed Device */
50extern void __init at91_add_device_usba(struct usba_platform_data *data);
51
48 /* Compact Flash */ 52 /* Compact Flash */
49struct at91_cf_data { 53struct at91_cf_data {
50 u8 irq_pin; /* I/O IRQ */ 54 u8 irq_pin; /* I/O IRQ */
@@ -73,7 +77,7 @@ struct at91_eth_data {
73}; 77};
74extern void __init at91_add_device_eth(struct at91_eth_data *data); 78extern void __init at91_add_device_eth(struct at91_eth_data *data);
75 79
76#if defined(CONFIG_ARCH_AT91SAM9260) || defined(CONFIG_ARCH_AT91SAM9263) || defined(CONFIG_ARCH_AT91CAP9) 80#if defined(CONFIG_ARCH_AT91SAM9260) || defined(CONFIG_ARCH_AT91SAM9263) || defined(CONFIG_ARCH_AT91SAM9G20) || defined(CONFIG_ARCH_AT91CAP9)
77#define eth_platform_data at91_eth_data 81#define eth_platform_data at91_eth_data
78#endif 82#endif
79 83
diff --git a/include/asm-arm/arch-at91/cpu.h b/include/asm-arm/arch-at91/cpu.h
index 7145166826a2..52df794205cb 100644
--- a/include/asm-arm/arch-at91/cpu.h
+++ b/include/asm-arm/arch-at91/cpu.h
@@ -21,6 +21,7 @@
21#define ARCH_ID_AT91SAM9260 0x019803a0 21#define ARCH_ID_AT91SAM9260 0x019803a0
22#define ARCH_ID_AT91SAM9261 0x019703a0 22#define ARCH_ID_AT91SAM9261 0x019703a0
23#define ARCH_ID_AT91SAM9263 0x019607a0 23#define ARCH_ID_AT91SAM9263 0x019607a0
24#define ARCH_ID_AT91SAM9G20 0x019905a0
24#define ARCH_ID_AT91SAM9RL64 0x019b03a0 25#define ARCH_ID_AT91SAM9RL64 0x019b03a0
25#define ARCH_ID_AT91CAP9 0x039A03A0 26#define ARCH_ID_AT91CAP9 0x039A03A0
26 27
@@ -63,6 +64,12 @@ static inline unsigned long at91_arch_identify(void)
63#define cpu_is_at91sam9260() (0) 64#define cpu_is_at91sam9260() (0)
64#endif 65#endif
65 66
67#ifdef CONFIG_ARCH_AT91SAM9G20
68#define cpu_is_at91sam9g20() (at91_cpu_identify() == ARCH_ID_AT91SAM9G20)
69#else
70#define cpu_is_at91sam9g20() (0)
71#endif
72
66#ifdef CONFIG_ARCH_AT91SAM9261 73#ifdef CONFIG_ARCH_AT91SAM9261
67#define cpu_is_at91sam9261() (at91_cpu_identify() == ARCH_ID_AT91SAM9261) 74#define cpu_is_at91sam9261() (at91_cpu_identify() == ARCH_ID_AT91SAM9261)
68#else 75#else
diff --git a/include/asm-arm/arch-at91/hardware.h b/include/asm-arm/arch-at91/hardware.h
index 2c826d8247a3..016a3a3f6633 100644
--- a/include/asm-arm/arch-at91/hardware.h
+++ b/include/asm-arm/arch-at91/hardware.h
@@ -18,7 +18,7 @@
18 18
19#if defined(CONFIG_ARCH_AT91RM9200) 19#if defined(CONFIG_ARCH_AT91RM9200)
20#include <asm/arch/at91rm9200.h> 20#include <asm/arch/at91rm9200.h>
21#elif defined(CONFIG_ARCH_AT91SAM9260) 21#elif defined(CONFIG_ARCH_AT91SAM9260) || defined(CONFIG_ARCH_AT91SAM9G20)
22#include <asm/arch/at91sam9260.h> 22#include <asm/arch/at91sam9260.h>
23#elif defined(CONFIG_ARCH_AT91SAM9261) 23#elif defined(CONFIG_ARCH_AT91SAM9261)
24#include <asm/arch/at91sam9261.h> 24#include <asm/arch/at91sam9261.h>
diff --git a/include/asm-arm/arch-at91/timex.h b/include/asm-arm/arch-at91/timex.h
index f1933b0fa43f..298d8313cdac 100644
--- a/include/asm-arm/arch-at91/timex.h
+++ b/include/asm-arm/arch-at91/timex.h
@@ -27,14 +27,29 @@
27 27
28#define CLOCK_TICK_RATE (AT91_SLOW_CLOCK) 28#define CLOCK_TICK_RATE (AT91_SLOW_CLOCK)
29 29
30#elif defined(CONFIG_ARCH_AT91SAM9260) || defined(CONFIG_ARCH_AT91SAM9261) 30#elif defined(CONFIG_ARCH_AT91SAM9260)
31
32#if defined(CONFIG_MACH_USB_A9260) || defined(CONFIG_MACH_QIL_A9260)
33#define AT91SAM9_MASTER_CLOCK 90000000
34#else
35#define AT91SAM9_MASTER_CLOCK 99300000
36#endif
37
38#define CLOCK_TICK_RATE (AT91SAM9_MASTER_CLOCK/16)
39
40#elif defined(CONFIG_ARCH_AT91SAM9261)
31 41
32#define AT91SAM9_MASTER_CLOCK 99300000 42#define AT91SAM9_MASTER_CLOCK 99300000
33#define CLOCK_TICK_RATE (AT91SAM9_MASTER_CLOCK/16) 43#define CLOCK_TICK_RATE (AT91SAM9_MASTER_CLOCK/16)
34 44
35#elif defined(CONFIG_ARCH_AT91SAM9263) 45#elif defined(CONFIG_ARCH_AT91SAM9263)
36 46
47#if defined(CONFIG_MACH_USB_A9263)
48#define AT91SAM9_MASTER_CLOCK 90000000
49#else
37#define AT91SAM9_MASTER_CLOCK 99959500 50#define AT91SAM9_MASTER_CLOCK 99959500
51#endif
52
38#define CLOCK_TICK_RATE (AT91SAM9_MASTER_CLOCK/16) 53#define CLOCK_TICK_RATE (AT91SAM9_MASTER_CLOCK/16)
39 54
40#elif defined(CONFIG_ARCH_AT91SAM9RL) 55#elif defined(CONFIG_ARCH_AT91SAM9RL)
@@ -42,6 +57,11 @@
42#define AT91SAM9_MASTER_CLOCK 100000000 57#define AT91SAM9_MASTER_CLOCK 100000000
43#define CLOCK_TICK_RATE (AT91SAM9_MASTER_CLOCK/16) 58#define CLOCK_TICK_RATE (AT91SAM9_MASTER_CLOCK/16)
44 59
60#elif defined(CONFIG_ARCH_AT91SAM9G20)
61
62#define AT91SAM9_MASTER_CLOCK 132096000
63#define CLOCK_TICK_RATE (AT91SAM9_MASTER_CLOCK/16)
64
45#elif defined(CONFIG_ARCH_AT91CAP9) 65#elif defined(CONFIG_ARCH_AT91CAP9)
46 66
47#define AT91CAP9_MASTER_CLOCK 100000000 67#define AT91CAP9_MASTER_CLOCK 100000000
diff --git a/include/asm-arm/arch-ebsa285/hardware.h b/include/asm-arm/arch-ebsa285/hardware.h
index daad8ee2d194..74610c2c63d4 100644
--- a/include/asm-arm/arch-ebsa285/hardware.h
+++ b/include/asm-arm/arch-ebsa285/hardware.h
@@ -14,7 +14,6 @@
14 14
15#include <asm/arch/memory.h> 15#include <asm/arch/memory.h>
16 16
17#ifdef CONFIG_ARCH_FOOTBRIDGE
18/* Virtual Physical Size 17/* Virtual Physical Size
19 * 0xff800000 0x40000000 1MB X-Bus 18 * 0xff800000 0x40000000 1MB X-Bus
20 * 0xff000000 0x7c000000 1MB PCI I/O space 19 * 0xff000000 0x7c000000 1MB PCI I/O space
@@ -50,31 +49,6 @@
50#define PCIMEM_SIZE 0x01000000 49#define PCIMEM_SIZE 0x01000000
51#define PCIMEM_BASE 0xf0000000 50#define PCIMEM_BASE 0xf0000000
52 51
53#elif defined(CONFIG_ARCH_CO285)
54/*
55 * This is the COEBSA285 cut-down mapping
56 */
57#define PCIMEM_SIZE 0x80000000
58#define PCIMEM_BASE 0x80000000
59
60#define WFLUSH_SIZE 0x01000000
61#define WFLUSH_BASE 0x7d000000
62
63#define ARMCSR_SIZE 0x00100000
64#define ARMCSR_BASE 0x7cf00000
65
66#define XBUS_SIZE 0x00020000
67#define XBUS_BASE 0x7cee0000
68
69#define PCIO_SIZE 0x00010000
70#define PCIO_BASE 0x7ced0000
71
72#else
73
74#error "Undefined footbridge architecture"
75
76#endif
77
78#define XBUS_LEDS ((volatile unsigned char *)(XBUS_BASE + 0x12000)) 52#define XBUS_LEDS ((volatile unsigned char *)(XBUS_BASE + 0x12000))
79#define XBUS_LED_AMBER (1 << 0) 53#define XBUS_LED_AMBER (1 << 0)
80#define XBUS_LED_GREEN (1 << 1) 54#define XBUS_LED_GREEN (1 << 1)
diff --git a/include/asm-arm/arch-ebsa285/memory.h b/include/asm-arm/arch-ebsa285/memory.h
index cbd7ae64bcc9..9019a3bf5ab9 100644
--- a/include/asm-arm/arch-ebsa285/memory.h
+++ b/include/asm-arm/arch-ebsa285/memory.h
@@ -42,8 +42,6 @@ extern unsigned long __bus_to_virt(unsigned long);
42 42
43#endif 43#endif
44 44
45#if defined(CONFIG_ARCH_FOOTBRIDGE)
46
47/* Task size and page offset at 3GB */ 45/* Task size and page offset at 3GB */
48#define TASK_SIZE UL(0xbf000000) 46#define TASK_SIZE UL(0xbf000000)
49#define PAGE_OFFSET UL(0xc0000000) 47#define PAGE_OFFSET UL(0xc0000000)
@@ -53,23 +51,6 @@ extern unsigned long __bus_to_virt(unsigned long);
53 */ 51 */
54#define FLUSH_BASE 0xf9000000 52#define FLUSH_BASE 0xf9000000
55 53
56#elif defined(CONFIG_ARCH_CO285)
57
58/* Task size and page offset at 1.5GB */
59#define TASK_SIZE UL(0x5f000000)
60#define PAGE_OFFSET UL(0x60000000)
61
62/*
63 * Cache flushing area.
64 */
65#define FLUSH_BASE 0x7e000000
66
67#else
68
69#error "Undefined footbridge architecture"
70
71#endif
72
73/* 54/*
74 * Physical DRAM offset. 55 * Physical DRAM offset.
75 */ 56 */
diff --git a/include/asm-arm/arch-ebsa285/vmalloc.h b/include/asm-arm/arch-ebsa285/vmalloc.h
index 02598200997d..e487d7e8c8a6 100644
--- a/include/asm-arm/arch-ebsa285/vmalloc.h
+++ b/include/asm-arm/arch-ebsa285/vmalloc.h
@@ -7,8 +7,4 @@
7 */ 7 */
8 8
9 9
10#ifdef CONFIG_ARCH_FOOTBRIDGE
11#define VMALLOC_END (PAGE_OFFSET + 0x30000000) 10#define VMALLOC_END (PAGE_OFFSET + 0x30000000)
12#else
13#define VMALLOC_END (PAGE_OFFSET + 0x20000000)
14#endif
diff --git a/include/asm-arm/arch-imx/imx-dma.h b/include/asm-arm/arch-imx/imx-dma.h
index 5b1066da4e1f..44d89c35539a 100644
--- a/include/asm-arm/arch-imx/imx-dma.h
+++ b/include/asm-arm/arch-imx/imx-dma.h
@@ -88,7 +88,7 @@ int imx_dma_request(imx_dmach_t dma_ch, const char *name);
88 88
89void imx_dma_free(imx_dmach_t dma_ch); 89void imx_dma_free(imx_dmach_t dma_ch);
90 90
91int imx_dma_request_by_prio(imx_dmach_t *pdma_ch, const char *name, imx_dma_prio prio); 91imx_dmach_t imx_dma_request_by_prio(const char *name, imx_dma_prio prio);
92 92
93 93
94#endif /* _ASM_ARCH_IMX_DMA_H */ 94#endif /* _ASM_ARCH_IMX_DMA_H */
diff --git a/include/asm-arm/arch-iop13xx/dma.h b/include/asm-arm/arch-iop13xx/dma.h
index 2e15da53ff79..d79846fbb394 100644
--- a/include/asm-arm/arch-iop13xx/dma.h
+++ b/include/asm-arm/arch-iop13xx/dma.h
@@ -1,3 +1,3 @@
1#ifndef _IOP13XX_DMA_H 1#ifndef _IOP13XX_DMA_H
2#define _IOP13XX_DMA_H_ 2#define _IOP13XX_DMA_H
3#endif 3#endif
diff --git a/include/asm-arm/arch-iop32x/gpio.h b/include/asm-arm/arch-iop32x/gpio.h
new file mode 100644
index 000000000000..708f4ec9db1d
--- /dev/null
+++ b/include/asm-arm/arch-iop32x/gpio.h
@@ -0,0 +1,6 @@
1#ifndef __ASM_ARCH_IOP32X_GPIO_H
2#define __ASM_ARCH_IOP32X_GPIO_H
3
4#include <asm/hardware/iop3xx-gpio.h>
5
6#endif
diff --git a/include/asm-arm/arch-iop33x/gpio.h b/include/asm-arm/arch-iop33x/gpio.h
new file mode 100644
index 000000000000..ddd55bba9bb9
--- /dev/null
+++ b/include/asm-arm/arch-iop33x/gpio.h
@@ -0,0 +1,6 @@
1#ifndef __ASM_ARCH_IOP33X_GPIO_H
2#define __ASM_ARCH_IOP33X_GPIO_H
3
4#include <asm/hardware/iop3xx-gpio.h>
5
6#endif
diff --git a/include/asm-arm/arch-ixp4xx/fsg.h b/include/asm-arm/arch-ixp4xx/fsg.h
new file mode 100644
index 000000000000..c0100cc7981c
--- /dev/null
+++ b/include/asm-arm/arch-ixp4xx/fsg.h
@@ -0,0 +1,50 @@
1/*
2 * include/asm-arm/arch-ixp4xx/fsg.h
3 *
4 * Freecom FSG-3 platform specific definitions
5 *
6 * Author: Rod Whitby <rod@whitby.id.au>
7 * Author: Tomasz Chmielewski <mangoo@wpkg.org>
8 * Maintainers: http://www.nslu2-linux.org
9 *
10 * Based on coyote.h by
11 * Copyright 2004 (c) MontaVista, Software, Inc.
12 *
13 * This file is licensed under the terms of the GNU General Public
14 * License version 2. This program is licensed "as is" without any
15 * warranty of any kind, whether express or implied.
16 */
17
18#ifndef __ASM_ARCH_HARDWARE_H__
19#error "Do not include this directly, instead #include <asm/hardware.h>"
20#endif
21
22#define FSG_SDA_PIN 12
23#define FSG_SCL_PIN 13
24
25/*
26 * FSG PCI IRQs
27 */
28#define FSG_PCI_MAX_DEV 3
29#define FSG_PCI_IRQ_LINES 3
30
31
32/* PCI controller GPIO to IRQ pin mappings */
33#define FSG_PCI_INTA_PIN 6
34#define FSG_PCI_INTB_PIN 7
35#define FSG_PCI_INTC_PIN 5
36
37/* Buttons */
38
39#define FSG_SB_GPIO 4 /* sync button */
40#define FSG_RB_GPIO 9 /* reset button */
41#define FSG_UB_GPIO 10 /* usb button */
42
43/* LEDs */
44
45#define FSG_LED_WLAN_BIT 0
46#define FSG_LED_WAN_BIT 1
47#define FSG_LED_SATA_BIT 2
48#define FSG_LED_USB_BIT 4
49#define FSG_LED_RING_BIT 5
50#define FSG_LED_SYNC_BIT 7
diff --git a/include/asm-arm/arch-ixp4xx/hardware.h b/include/asm-arm/arch-ixp4xx/hardware.h
index 73e8dc36f6a4..fa723a627854 100644
--- a/include/asm-arm/arch-ixp4xx/hardware.h
+++ b/include/asm-arm/arch-ixp4xx/hardware.h
@@ -45,5 +45,6 @@
45#include "nslu2.h" 45#include "nslu2.h"
46#include "nas100d.h" 46#include "nas100d.h"
47#include "dsmg600.h" 47#include "dsmg600.h"
48#include "fsg.h"
48 49
49#endif /* _ASM_ARCH_HARDWARE_H */ 50#endif /* _ASM_ARCH_HARDWARE_H */
diff --git a/include/asm-arm/arch-ixp4xx/irqs.h b/include/asm-arm/arch-ixp4xx/irqs.h
index 11801605047b..674af4a84147 100644
--- a/include/asm-arm/arch-ixp4xx/irqs.h
+++ b/include/asm-arm/arch-ixp4xx/irqs.h
@@ -128,4 +128,11 @@
128#define IRQ_DSMG600_PCI_INTE IRQ_IXP4XX_GPIO7 128#define IRQ_DSMG600_PCI_INTE IRQ_IXP4XX_GPIO7
129#define IRQ_DSMG600_PCI_INTF IRQ_IXP4XX_GPIO6 129#define IRQ_DSMG600_PCI_INTF IRQ_IXP4XX_GPIO6
130 130
131/*
132 * Freecom FSG-3 Board IRQs
133 */
134#define IRQ_FSG_PCI_INTA IRQ_IXP4XX_GPIO6
135#define IRQ_FSG_PCI_INTB IRQ_IXP4XX_GPIO7
136#define IRQ_FSG_PCI_INTC IRQ_IXP4XX_GPIO5
137
131#endif 138#endif
diff --git a/include/asm-arm/arch-kirkwood/debug-macro.S b/include/asm-arm/arch-kirkwood/debug-macro.S
new file mode 100644
index 000000000000..f55fb8ad9ee4
--- /dev/null
+++ b/include/asm-arm/arch-kirkwood/debug-macro.S
@@ -0,0 +1,20 @@
1/*
2 * include/asm-arm/arch-kirkwood/debug-macro.S
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 version 2 as
6 * published by the Free Software Foundation.
7*/
8
9#include <asm/arch/kirkwood.h>
10
11 .macro addruart,rx
12 mrc p15, 0, \rx, c1, c0
13 tst \rx, #1 @ MMU enabled?
14 ldreq \rx, =KIRKWOOD_REGS_PHYS_BASE
15 ldrne \rx, =KIRKWOOD_REGS_VIRT_BASE
16 orr \rx, \rx, #0x00012000
17 .endm
18
19#define UART_SHIFT 2
20#include <asm/hardware/debug-8250.S>
diff --git a/include/asm-arm/arch-kirkwood/dma.h b/include/asm-arm/arch-kirkwood/dma.h
new file mode 100644
index 000000000000..40a8c178f10d
--- /dev/null
+++ b/include/asm-arm/arch-kirkwood/dma.h
@@ -0,0 +1 @@
/* empty */
diff --git a/include/asm-arm/arch-kirkwood/entry-macro.S b/include/asm-arm/arch-kirkwood/entry-macro.S
new file mode 100644
index 000000000000..fc6a43d9355c
--- /dev/null
+++ b/include/asm-arm/arch-kirkwood/entry-macro.S
@@ -0,0 +1,40 @@
1/*
2 * include/asm-arm/arch-kirkwood/entry-macro.S
3 *
4 * Low-level IRQ helper macros for Marvell Kirkwood platforms
5 *
6 * This file is licensed under the terms of the GNU General Public
7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied.
9 */
10
11#include <asm/arch/kirkwood.h>
12
13 .macro disable_fiq
14 .endm
15
16 .macro arch_ret_to_user, tmp1, tmp2
17 .endm
18
19 .macro get_irqnr_preamble, base, tmp
20 ldr \base, =IRQ_VIRT_BASE
21 .endm
22
23 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
24 @ check low interrupts
25 ldr \irqstat, [\base, #IRQ_CAUSE_LOW_OFF]
26 ldr \tmp, [\base, #IRQ_MASK_LOW_OFF]
27 mov \irqnr, #31
28 ands \irqstat, \irqstat, \tmp
29 bne 1001f
30
31 @ if no low interrupts set, check high interrupts
32 ldr \irqstat, [\base, #IRQ_CAUSE_HIGH_OFF]
33 ldr \tmp, [\base, #IRQ_MASK_HIGH_OFF]
34 mov \irqnr, #63
35 ands \irqstat, \irqstat, \tmp
36
37 @ find first active interrupt source
381001: clzne \irqstat, \irqstat
39 subne \irqnr, \irqnr, \irqstat
40 .endm
diff --git a/include/asm-arm/arch-kirkwood/hardware.h b/include/asm-arm/arch-kirkwood/hardware.h
new file mode 100644
index 000000000000..e695719771a5
--- /dev/null
+++ b/include/asm-arm/arch-kirkwood/hardware.h
@@ -0,0 +1,21 @@
1/*
2 * include/asm-arm/arch-kirkwood/hardware.h
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 version 2 as
6 * published by the Free Software Foundation.
7 */
8
9#ifndef __ASM_ARCH_HARDWARE_H
10#define __ASM_ARCH_HARDWARE_H
11
12#include "kirkwood.h"
13
14#define pcibios_assign_all_busses() 1
15
16#define PCIBIOS_MIN_IO 0x00001000
17#define PCIBIOS_MIN_MEM 0x01000000
18#define PCIMEM_BASE KIRKWOOD_PCIE_MEM_PHYS_BASE /* mem base for VGA */
19
20
21#endif
diff --git a/include/asm-arm/arch-kirkwood/io.h b/include/asm-arm/arch-kirkwood/io.h
new file mode 100644
index 000000000000..0ef6e95f5d5b
--- /dev/null
+++ b/include/asm-arm/arch-kirkwood/io.h
@@ -0,0 +1,26 @@
1/*
2 * include/asm-arm/arch-kirkwood/io.h
3 *
4 * This file is licensed under the terms of the GNU General Public
5 * License version 2. This program is licensed "as is" without any
6 * warranty of any kind, whether express or implied.
7 */
8
9#ifndef __ASM_ARCH_IO_H
10#define __ASM_ARCH_IO_H
11
12#include "kirkwood.h"
13
14#define IO_SPACE_LIMIT 0xffffffff
15
16static inline void __iomem *__io(unsigned long addr)
17{
18 return (void __iomem *)((addr - KIRKWOOD_PCIE_IO_PHYS_BASE)
19 + KIRKWOOD_PCIE_IO_VIRT_BASE);
20}
21
22#define __io(a) __io(a)
23#define __mem_pci(a) (a)
24
25
26#endif
diff --git a/include/asm-arm/arch-kirkwood/irqs.h b/include/asm-arm/arch-kirkwood/irqs.h
new file mode 100644
index 000000000000..2e7b5da6335c
--- /dev/null
+++ b/include/asm-arm/arch-kirkwood/irqs.h
@@ -0,0 +1,63 @@
1/*
2 * include/asm-arm/arch-kirkwood/irqs.h
3 *
4 * IRQ definitions for Marvell Kirkwood SoCs
5 *
6 * This file is licensed under the terms of the GNU General Public
7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied.
9 */
10
11#ifndef __ASM_ARCH_IRQS_H
12#define __ASM_ARCH_IRQS_H
13
14#include "kirkwood.h" /* need GPIO_MAX */
15
16/*
17 * Low Interrupt Controller
18 */
19#define IRQ_KIRKWOOD_HIGH_SUM 0
20#define IRQ_KIRKWOOD_BRIDGE 1
21#define IRQ_KIRKWOOD_HOST2CPU 2
22#define IRQ_KIRKWOOD_CPU2HOST 3
23#define IRQ_KIRKWOOD_XOR_00 5
24#define IRQ_KIRKWOOD_XOR_01 6
25#define IRQ_KIRKWOOD_XOR_10 7
26#define IRQ_KIRKWOOD_XOR_11 8
27#define IRQ_KIRKWOOD_PCIE 9
28#define IRQ_KIRKWOOD_GE00_SUM 11
29#define IRQ_KIRKWOOD_GE01_SUM 15
30#define IRQ_KIRKWOOD_USB 19
31#define IRQ_KIRKWOOD_SATA 21
32#define IRQ_KIRKWOOD_CRYPTO 22
33#define IRQ_KIRKWOOD_SPI 23
34#define IRQ_KIRKWOOD_I2S 24
35#define IRQ_KIRKWOOD_TS_0 26
36#define IRQ_KIRKWOOD_SDIO 28
37#define IRQ_KIRKWOOD_TWSI 29
38#define IRQ_KIRKWOOD_AVB 30
39#define IRQ_KIRKWOOD_TDMI 31
40
41/*
42 * High Interrupt Controller
43 */
44#define IRQ_KIRKWOOD_UART_0 33
45#define IRQ_KIRKWOOD_UART_1 34
46#define IRQ_KIRKWOOD_GPIO_LOW_0_7 35
47#define IRQ_KIRKWOOD_GPIO_LOW_8_15 36
48#define IRQ_KIRKWOOD_GPIO_LOW_16_23 37
49#define IRQ_KIRKWOOD_GPIO_LOW_24_31 38
50#define IRQ_KIRKWOOD_GPIO_HIGH_0_7 39
51#define IRQ_KIRKWOOD_GPIO_HIGH_8_15 40
52#define IRQ_KIRKWOOD_GPIO_HIGH_16_23 41
53
54/*
55 * KIRKWOOD General Purpose Pins
56 */
57#define IRQ_KIRKWOOD_GPIO_START 64
58#define NR_GPIO_IRQS GPIO_MAX
59
60#define NR_IRQS (IRQ_KIRKWOOD_GPIO_START + NR_GPIO_IRQS)
61
62
63#endif
diff --git a/include/asm-arm/arch-kirkwood/kirkwood.h b/include/asm-arm/arch-kirkwood/kirkwood.h
new file mode 100644
index 000000000000..bb31b315c350
--- /dev/null
+++ b/include/asm-arm/arch-kirkwood/kirkwood.h
@@ -0,0 +1,100 @@
1/*
2 * include/asm-arm/arch-kirkwood/kirkwood.h
3 *
4 * Generic definitions for Marvell Kirkwood SoC flavors:
5 * 88F6180, 88F6192 and 88F6281.
6 *
7 * This file is licensed under the terms of the GNU General Public
8 * License version 2. This program is licensed "as is" without any
9 * warranty of any kind, whether express or implied.
10 */
11
12#ifndef __ASM_ARCH_KIRKWOOD_H
13#define __ASM_ARCH_KIRKWOOD_H
14
15/*
16 * Marvell Kirkwood address maps.
17 *
18 * phys
19 * e0000000 PCIe Memory space
20 * f1000000 on-chip peripheral registers
21 * f2000000 PCIe I/O space
22 * f3000000 NAND controller address window
23 *
24 * virt phys size
25 * fee00000 f1000000 1M on-chip peripheral registers
26 * fef00000 f2000000 1M PCIe I/O space
27 */
28
29#define KIRKWOOD_NAND_MEM_PHYS_BASE 0xf3000000
30#define KIRKWOOD_NAND_MEM_SIZE SZ_64K /* 1K is sufficient, but 64K
31 * is the minimal window size
32 */
33
34#define KIRKWOOD_PCIE_IO_PHYS_BASE 0xf2000000
35#define KIRKWOOD_PCIE_IO_VIRT_BASE 0xfef00000
36#define KIRKWOOD_PCIE_IO_BUS_BASE 0x00000000
37#define KIRKWOOD_PCIE_IO_SIZE SZ_1M
38
39#define KIRKWOOD_REGS_PHYS_BASE 0xf1000000
40#define KIRKWOOD_REGS_VIRT_BASE 0xfee00000
41#define KIRKWOOD_REGS_SIZE SZ_1M
42
43#define KIRKWOOD_PCIE_MEM_PHYS_BASE 0xe0000000
44#define KIRKWOOD_PCIE_MEM_SIZE SZ_128M
45
46/*
47 * MBUS bridge registers.
48 */
49#define BRIDGE_VIRT_BASE (KIRKWOOD_REGS_VIRT_BASE | 0x20000)
50#define CPU_CONTROL (BRIDGE_VIRT_BASE | 0x0104)
51#define CPU_RESET 0x00000002
52#define RSTOUTn_MASK (BRIDGE_VIRT_BASE | 0x0108)
53#define SOFT_RESET_OUT_EN 0x00000004
54#define SYSTEM_SOFT_RESET (BRIDGE_VIRT_BASE | 0x010c)
55#define SOFT_RESET 0x00000001
56#define BRIDGE_CAUSE (BRIDGE_VIRT_BASE | 0x0110)
57#define BRIDGE_MASK (BRIDGE_VIRT_BASE | 0x0114)
58#define BRIDGE_INT_TIMER0 0x0002
59#define BRIDGE_INT_TIMER1 0x0004
60#define BRIDGE_INT_TIMER1_CLR (~0x0004)
61#define IRQ_VIRT_BASE (BRIDGE_VIRT_BASE | 0x0200)
62#define IRQ_CAUSE_LOW_OFF 0x0000
63#define IRQ_MASK_LOW_OFF 0x0004
64#define IRQ_CAUSE_HIGH_OFF 0x0010
65#define IRQ_MASK_HIGH_OFF 0x0014
66#define TIMER_VIRT_BASE (BRIDGE_VIRT_BASE | 0x0300)
67#define L2_CONFIG_REG (BRIDGE_VIRT_BASE | 0x0128)
68#define L2_WRITETHROUGH 0x00000010
69
70/*
71 * Register Map
72 */
73#define DDR_VIRT_BASE (KIRKWOOD_REGS_VIRT_BASE | 0x00000)
74#define DDR_WINDOW_CPU_BASE (DDR_VIRT_BASE | 0x1500)
75
76#define DEV_BUS_PHYS_BASE (KIRKWOOD_REGS_PHYS_BASE | 0x10000)
77#define DEV_BUS_VIRT_BASE (KIRKWOOD_REGS_VIRT_BASE | 0x10000)
78#define SAMPLE_AT_RESET (DEV_BUS_VIRT_BASE | 0x0030)
79#define DEVICE_ID (DEV_BUS_VIRT_BASE | 0x0034)
80#define RTC_PHYS_BASE (DEV_BUS_PHYS_BASE | 0x0300)
81#define SPI_PHYS_BASE (DEV_BUS_PHYS_BASE | 0x0600)
82#define UART0_PHYS_BASE (DEV_BUS_PHYS_BASE | 0x2000)
83#define UART0_VIRT_BASE (DEV_BUS_VIRT_BASE | 0x2000)
84#define UART1_PHYS_BASE (DEV_BUS_PHYS_BASE | 0x2100)
85#define UART1_VIRT_BASE (DEV_BUS_VIRT_BASE | 0x2100)
86
87#define PCIE_VIRT_BASE (KIRKWOOD_REGS_VIRT_BASE | 0x40000)
88
89#define USB_PHYS_BASE (KIRKWOOD_REGS_PHYS_BASE | 0x50000)
90
91#define GE00_PHYS_BASE (KIRKWOOD_REGS_PHYS_BASE | 0x70000)
92#define GE01_PHYS_BASE (KIRKWOOD_REGS_PHYS_BASE | 0x74000)
93
94#define SATA_PHYS_BASE (KIRKWOOD_REGS_PHYS_BASE | 0x80000)
95
96
97#define GPIO_MAX 50
98
99
100#endif
diff --git a/include/asm-arm/arch-kirkwood/memory.h b/include/asm-arm/arch-kirkwood/memory.h
new file mode 100644
index 000000000000..e5108f408ce6
--- /dev/null
+++ b/include/asm-arm/arch-kirkwood/memory.h
@@ -0,0 +1,14 @@
1/*
2 * include/asm-arm/arch-kirkwood/memory.h
3 */
4
5#ifndef __ASM_ARCH_MEMORY_H
6#define __ASM_ARCH_MEMORY_H
7
8#define PHYS_OFFSET UL(0x00000000)
9
10#define __virt_to_bus(x) __virt_to_phys(x)
11#define __bus_to_virt(x) __phys_to_virt(x)
12
13
14#endif
diff --git a/include/asm-arm/arch-kirkwood/system.h b/include/asm-arm/arch-kirkwood/system.h
new file mode 100644
index 000000000000..8dde7e379855
--- /dev/null
+++ b/include/asm-arm/arch-kirkwood/system.h
@@ -0,0 +1,37 @@
1/*
2 * include/asm-arm/arch-kirkwood/system.h
3 *
4 * This file is licensed under the terms of the GNU General Public
5 * License version 2. This program is licensed "as is" without any
6 * warranty of any kind, whether express or implied.
7 */
8
9#ifndef __ASM_ARCH_SYSTEM_H
10#define __ASM_ARCH_SYSTEM_H
11
12#include <asm/arch/hardware.h>
13#include <asm/arch/kirkwood.h>
14
15static inline void arch_idle(void)
16{
17 cpu_do_idle();
18}
19
20static inline void arch_reset(char mode)
21{
22 /*
23 * Enable soft reset to assert RSTOUTn.
24 */
25 writel(SOFT_RESET_OUT_EN, RSTOUTn_MASK);
26
27 /*
28 * Assert soft reset.
29 */
30 writel(SOFT_RESET, SYSTEM_SOFT_RESET);
31
32 while (1)
33 ;
34}
35
36
37#endif
diff --git a/include/asm-arm/arch-kirkwood/timex.h b/include/asm-arm/arch-kirkwood/timex.h
new file mode 100644
index 000000000000..82122e134e3c
--- /dev/null
+++ b/include/asm-arm/arch-kirkwood/timex.h
@@ -0,0 +1,11 @@
1/*
2 * include/asm-arm/arch-kirkwood/timex.h
3 *
4 * This file is licensed under the terms of the GNU General Public
5 * License version 2. This program is licensed "as is" without any
6 * warranty of any kind, whether express or implied.
7 */
8
9#define CLOCK_TICK_RATE (100 * HZ)
10
11#define KIRKWOOD_TCLK 166666667
diff --git a/include/asm-arm/arch-kirkwood/uncompress.h b/include/asm-arm/arch-kirkwood/uncompress.h
new file mode 100644
index 000000000000..a9062b6d7680
--- /dev/null
+++ b/include/asm-arm/arch-kirkwood/uncompress.h
@@ -0,0 +1,47 @@
1/*
2 * include/asm-arm/arch-kirkwood/uncompress.h
3 *
4 * This file is licensed under the terms of the GNU General Public
5 * License version 2. This program is licensed "as is" without any
6 * warranty of any kind, whether express or implied.
7 */
8
9#include <linux/serial_reg.h>
10#include <asm/arch/kirkwood.h>
11
12#define SERIAL_BASE ((unsigned char *)UART0_PHYS_BASE)
13
14static void putc(const char c)
15{
16 unsigned char *base = SERIAL_BASE;
17 int i;
18
19 for (i = 0; i < 0x1000; i++) {
20 if (base[UART_LSR << 2] & UART_LSR_THRE)
21 break;
22 barrier();
23 }
24
25 base[UART_TX << 2] = c;
26}
27
28static void flush(void)
29{
30 unsigned char *base = SERIAL_BASE;
31 unsigned char mask;
32 int i;
33
34 mask = UART_LSR_TEMT | UART_LSR_THRE;
35
36 for (i = 0; i < 0x1000; i++) {
37 if ((base[UART_LSR << 2] & mask) == mask)
38 break;
39 barrier();
40 }
41}
42
43/*
44 * nothing to do
45 */
46#define arch_decomp_setup()
47#define arch_decomp_wdog()
diff --git a/include/asm-arm/arch-kirkwood/vmalloc.h b/include/asm-arm/arch-kirkwood/vmalloc.h
new file mode 100644
index 000000000000..41852c6e77f3
--- /dev/null
+++ b/include/asm-arm/arch-kirkwood/vmalloc.h
@@ -0,0 +1,5 @@
1/*
2 * include/asm-arm/arch-kirkwood/vmalloc.h
3 */
4
5#define VMALLOC_END 0xfe800000
diff --git a/include/asm-arm/arch-loki/debug-macro.S b/include/asm-arm/arch-loki/debug-macro.S
new file mode 100644
index 000000000000..585502e96513
--- /dev/null
+++ b/include/asm-arm/arch-loki/debug-macro.S
@@ -0,0 +1,20 @@
1/*
2 * include/asm-arm/arch-loki/debug-macro.S
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 version 2 as
6 * published by the Free Software Foundation.
7*/
8
9#include <asm/arch/loki.h>
10
11 .macro addruart,rx
12 mrc p15, 0, \rx, c1, c0
13 tst \rx, #1 @ MMU enabled?
14 ldreq \rx, =LOKI_REGS_PHYS_BASE
15 ldrne \rx, =LOKI_REGS_VIRT_BASE
16 orr \rx, \rx, #0x00012000
17 .endm
18
19#define UART_SHIFT 2
20#include <asm/hardware/debug-8250.S>
diff --git a/include/asm-arm/arch-loki/dma.h b/include/asm-arm/arch-loki/dma.h
new file mode 100644
index 000000000000..40a8c178f10d
--- /dev/null
+++ b/include/asm-arm/arch-loki/dma.h
@@ -0,0 +1 @@
/* empty */
diff --git a/include/asm-arm/arch-loki/entry-macro.S b/include/asm-arm/arch-loki/entry-macro.S
new file mode 100644
index 000000000000..693257cdbeb8
--- /dev/null
+++ b/include/asm-arm/arch-loki/entry-macro.S
@@ -0,0 +1,30 @@
1/*
2 * include/asm-arm/arch-loki/entry-macro.S
3 *
4 * Low-level IRQ helper macros for Marvell Loki (88RC8480) platforms
5 *
6 * This file is licensed under the terms of the GNU General Public
7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied.
9 */
10
11#include <asm/arch/loki.h>
12
13 .macro disable_fiq
14 .endm
15
16 .macro arch_ret_to_user, tmp1, tmp2
17 .endm
18
19 .macro get_irqnr_preamble, base, tmp
20 ldr \base, =IRQ_VIRT_BASE
21 .endm
22
23 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
24 ldr \irqstat, [\base, #IRQ_CAUSE_OFF]
25 ldr \tmp, [\base, #IRQ_MASK_OFF]
26 mov \irqnr, #0
27 ands \irqstat, \irqstat, \tmp
28 clzne \irqnr, \irqstat
29 rsbne \irqnr, \irqnr, #31
30 .endm
diff --git a/include/asm-arm/arch-loki/hardware.h b/include/asm-arm/arch-loki/hardware.h
new file mode 100644
index 000000000000..f65b01c733b6
--- /dev/null
+++ b/include/asm-arm/arch-loki/hardware.h
@@ -0,0 +1,15 @@
1/*
2 * include/asm-arm/arch-loki/hardware.h
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 version 2 as
6 * published by the Free Software Foundation.
7 */
8
9#ifndef __ASM_ARCH_HARDWARE_H
10#define __ASM_ARCH_HARDWARE_H
11
12#include "loki.h"
13
14
15#endif
diff --git a/include/asm-arm/arch-loki/io.h b/include/asm-arm/arch-loki/io.h
new file mode 100644
index 000000000000..e7418a915e75
--- /dev/null
+++ b/include/asm-arm/arch-loki/io.h
@@ -0,0 +1,26 @@
1/*
2 * include/asm-arm/arch-loki/io.h
3 *
4 * This file is licensed under the terms of the GNU General Public
5 * License version 2. This program is licensed "as is" without any
6 * warranty of any kind, whether express or implied.
7 */
8
9#ifndef __ASM_ARCH_IO_H
10#define __ASM_ARCH_IO_H
11
12#include "loki.h"
13
14#define IO_SPACE_LIMIT 0xffffffff
15
16static inline void __iomem *__io(unsigned long addr)
17{
18 return (void __iomem *)((addr - LOKI_PCIE0_IO_PHYS_BASE)
19 + LOKI_PCIE0_IO_VIRT_BASE);
20}
21
22#define __io(a) __io(a)
23#define __mem_pci(a) (a)
24
25
26#endif
diff --git a/include/asm-arm/arch-loki/irqs.h b/include/asm-arm/arch-loki/irqs.h
new file mode 100644
index 000000000000..7e4971438072
--- /dev/null
+++ b/include/asm-arm/arch-loki/irqs.h
@@ -0,0 +1,58 @@
1/*
2 * include/asm-arm/arch-loki/irqs.h
3 *
4 * IRQ definitions for Marvell Loki (88RC8480) SoCs
5 *
6 * This file is licensed under the terms of the GNU General Public
7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied.
9 */
10
11#ifndef __ASM_ARCH_IRQS_H
12#define __ASM_ARCH_IRQS_H
13
14#include "loki.h" /* need GPIO_MAX */
15
16/*
17 * Interrupt Controller
18 */
19#define IRQ_LOKI_PCIE_A_CPU_DRBL 0
20#define IRQ_LOKI_CPU_PCIE_A_DRBL 1
21#define IRQ_LOKI_PCIE_B_CPU_DRBL 2
22#define IRQ_LOKI_CPU_PCIE_B_DRBL 3
23#define IRQ_LOKI_COM_A_ERR 6
24#define IRQ_LOKI_COM_A_IN 7
25#define IRQ_LOKI_COM_A_OUT 8
26#define IRQ_LOKI_COM_B_ERR 9
27#define IRQ_LOKI_COM_B_IN 10
28#define IRQ_LOKI_COM_B_OUT 11
29#define IRQ_LOKI_DMA_A 12
30#define IRQ_LOKI_DMA_B 13
31#define IRQ_LOKI_SAS_A 14
32#define IRQ_LOKI_SAS_B 15
33#define IRQ_LOKI_DDR 16
34#define IRQ_LOKI_XOR 17
35#define IRQ_LOKI_BRIDGE 18
36#define IRQ_LOKI_PCIE_A_ERR 20
37#define IRQ_LOKI_PCIE_A_INT 21
38#define IRQ_LOKI_PCIE_B_ERR 22
39#define IRQ_LOKI_PCIE_B_INT 23
40#define IRQ_LOKI_GBE_A_INT 24
41#define IRQ_LOKI_GBE_B_INT 25
42#define IRQ_LOKI_DEV_ERR 26
43#define IRQ_LOKI_UART0 27
44#define IRQ_LOKI_UART1 28
45#define IRQ_LOKI_TWSI 29
46#define IRQ_LOKI_GPIO_23_0 30
47#define IRQ_LOKI_GPIO_25_24 31
48
49/*
50 * Loki General Purpose Pins
51 */
52#define IRQ_LOKI_GPIO_START 32
53#define NR_GPIO_IRQS GPIO_MAX
54
55#define NR_IRQS (IRQ_LOKI_GPIO_START + NR_GPIO_IRQS)
56
57
58#endif
diff --git a/include/asm-arm/arch-loki/loki.h b/include/asm-arm/arch-loki/loki.h
new file mode 100644
index 000000000000..5dd05ee0a4e6
--- /dev/null
+++ b/include/asm-arm/arch-loki/loki.h
@@ -0,0 +1,97 @@
1/*
2 * include/asm-arm/arch-loki/loki.h
3 *
4 * Generic definitions for Marvell Loki (88RC8480) SoC flavors
5 *
6 * This file is licensed under the terms of the GNU General Public
7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied.
9 */
10
11#ifndef __ASM_ARCH_LOKI_H
12#define __ASM_ARCH_LOKI_H
13
14/*
15 * Marvell Loki (88RC8480) address maps.
16 *
17 * phys
18 * d0000000 on-chip peripheral registers
19 * e0000000 PCIe 0 Memory space
20 * e8000000 PCIe 1 Memory space
21 * f0000000 PCIe 0 I/O space
22 * f0100000 PCIe 1 I/O space
23 *
24 * virt phys size
25 * fed00000 d0000000 1M on-chip peripheral registers
26 * fee00000 f0000000 64K PCIe 0 I/O space
27 * fef00000 f0100000 64K PCIe 1 I/O space
28 */
29
30#define LOKI_REGS_PHYS_BASE 0xd0000000
31#define LOKI_REGS_VIRT_BASE 0xfed00000
32#define LOKI_REGS_SIZE SZ_1M
33
34#define LOKI_PCIE0_IO_PHYS_BASE 0xf0000000
35#define LOKI_PCIE0_IO_VIRT_BASE 0xfee00000
36#define LOKI_PCIE0_IO_BUS_BASE 0x00000000
37#define LOKI_PCIE0_IO_SIZE SZ_64K
38
39#define LOKI_PCIE1_IO_PHYS_BASE 0xf0100000
40#define LOKI_PCIE1_IO_VIRT_BASE 0xfef00000
41#define LOKI_PCIE1_IO_BUS_BASE 0x00000000
42#define LOKI_PCIE1_IO_SIZE SZ_64K
43
44#define LOKI_PCIE0_MEM_PHYS_BASE 0xe0000000
45#define LOKI_PCIE0_MEM_SIZE SZ_128M
46
47#define LOKI_PCIE1_MEM_PHYS_BASE 0xe8000000
48#define LOKI_PCIE1_MEM_SIZE SZ_128M
49
50/*
51 * Register Map
52 */
53#define DEV_BUS_PHYS_BASE (LOKI_REGS_PHYS_BASE | 0x10000)
54#define DEV_BUS_VIRT_BASE (LOKI_REGS_VIRT_BASE | 0x10000)
55#define UART0_PHYS_BASE (DEV_BUS_PHYS_BASE | 0x2000)
56#define UART0_VIRT_BASE (DEV_BUS_VIRT_BASE | 0x2000)
57#define UART1_PHYS_BASE (DEV_BUS_PHYS_BASE | 0x2100)
58#define UART1_VIRT_BASE (DEV_BUS_VIRT_BASE | 0x2100)
59
60#define BRIDGE_VIRT_BASE (LOKI_REGS_VIRT_BASE | 0x20000)
61#define BRIDGE_REG(x) (BRIDGE_VIRT_BASE | (x))
62#define RSTOUTn_MASK (BRIDGE_VIRT_BASE | 0x0108)
63#define SOFT_RESET_OUT_EN 0x00000004
64#define SYSTEM_SOFT_RESET (BRIDGE_VIRT_BASE | 0x010c)
65#define SOFT_RESET 0x00000001
66#define BRIDGE_CAUSE (BRIDGE_VIRT_BASE | 0x0110)
67#define BRIDGE_MASK (BRIDGE_VIRT_BASE | 0x0114)
68#define BRIDGE_INT_TIMER0 0x0002
69#define BRIDGE_INT_TIMER1 0x0004
70#define BRIDGE_INT_TIMER1_CLR 0x0004
71#define IRQ_VIRT_BASE (BRIDGE_VIRT_BASE | 0x0200)
72#define IRQ_CAUSE_OFF 0x0000
73#define IRQ_MASK_OFF 0x0004
74#define TIMER_VIRT_BASE (BRIDGE_VIRT_BASE | 0x0300)
75
76#define PCIE0_VIRT_BASE (LOKI_REGS_VIRT_BASE | 0x30000)
77
78#define PCIE1_VIRT_BASE (LOKI_REGS_VIRT_BASE | 0x40000)
79
80#define SAS0_PHYS_BASE (LOKI_REGS_PHYS_BASE | 0x80000)
81
82#define SAS1_PHYS_BASE (LOKI_REGS_PHYS_BASE | 0x90000)
83
84#define GE0_PHYS_BASE (LOKI_REGS_PHYS_BASE | 0xa0000)
85#define GE0_VIRT_BASE (LOKI_REGS_VIRT_BASE | 0xa0000)
86
87#define GE1_PHYS_BASE (LOKI_REGS_PHYS_BASE | 0xb0000)
88#define GE1_VIRT_BASE (LOKI_REGS_VIRT_BASE | 0xb0000)
89
90#define DDR_VIRT_BASE (LOKI_REGS_VIRT_BASE | 0xf0000)
91#define DDR_REG(x) (DDR_VIRT_BASE | (x))
92
93
94#define GPIO_MAX 8
95
96
97#endif
diff --git a/include/asm-arm/arch-loki/memory.h b/include/asm-arm/arch-loki/memory.h
new file mode 100644
index 000000000000..835101e49875
--- /dev/null
+++ b/include/asm-arm/arch-loki/memory.h
@@ -0,0 +1,14 @@
1/*
2 * include/asm-arm/arch-loki/memory.h
3 */
4
5#ifndef __ASM_ARCH_MEMORY_H
6#define __ASM_ARCH_MEMORY_H
7
8#define PHYS_OFFSET UL(0x00000000)
9
10#define __virt_to_bus(x) __virt_to_phys(x)
11#define __bus_to_virt(x) __phys_to_virt(x)
12
13
14#endif
diff --git a/include/asm-arm/arch-loki/system.h b/include/asm-arm/arch-loki/system.h
new file mode 100644
index 000000000000..a3568ac8ec35
--- /dev/null
+++ b/include/asm-arm/arch-loki/system.h
@@ -0,0 +1,37 @@
1/*
2 * include/asm-arm/arch-loki/system.h
3 *
4 * This file is licensed under the terms of the GNU General Public
5 * License version 2. This program is licensed "as is" without any
6 * warranty of any kind, whether express or implied.
7 */
8
9#ifndef __ASM_ARCH_SYSTEM_H
10#define __ASM_ARCH_SYSTEM_H
11
12#include <asm/arch/hardware.h>
13#include <asm/arch/loki.h>
14
15static inline void arch_idle(void)
16{
17 cpu_do_idle();
18}
19
20static inline void arch_reset(char mode)
21{
22 /*
23 * Enable soft reset to assert RSTOUTn.
24 */
25 writel(SOFT_RESET_OUT_EN, RSTOUTn_MASK);
26
27 /*
28 * Assert soft reset.
29 */
30 writel(SOFT_RESET, SYSTEM_SOFT_RESET);
31
32 while (1)
33 ;
34}
35
36
37#endif
diff --git a/include/asm-arm/arch-loki/timex.h b/include/asm-arm/arch-loki/timex.h
new file mode 100644
index 000000000000..940014f97cae
--- /dev/null
+++ b/include/asm-arm/arch-loki/timex.h
@@ -0,0 +1,11 @@
1/*
2 * include/asm-arm/arch-loki/timex.h
3 *
4 * This file is licensed under the terms of the GNU General Public
5 * License version 2. This program is licensed "as is" without any
6 * warranty of any kind, whether express or implied.
7 */
8
9#define CLOCK_TICK_RATE (100 * HZ)
10
11#define LOKI_TCLK 180000000
diff --git a/include/asm-arm/arch-loki/uncompress.h b/include/asm-arm/arch-loki/uncompress.h
new file mode 100644
index 000000000000..89a0cf88d3a5
--- /dev/null
+++ b/include/asm-arm/arch-loki/uncompress.h
@@ -0,0 +1,47 @@
1/*
2 * include/asm-arm/arch-loki/uncompress.h
3 *
4 * This file is licensed under the terms of the GNU General Public
5 * License version 2. This program is licensed "as is" without any
6 * warranty of any kind, whether express or implied.
7 */
8
9#include <linux/serial_reg.h>
10#include <asm/arch/loki.h>
11
12#define SERIAL_BASE ((unsigned char *)UART0_PHYS_BASE)
13
14static void putc(const char c)
15{
16 unsigned char *base = SERIAL_BASE;
17 int i;
18
19 for (i = 0; i < 0x1000; i++) {
20 if (base[UART_LSR << 2] & UART_LSR_THRE)
21 break;
22 barrier();
23 }
24
25 base[UART_TX << 2] = c;
26}
27
28static void flush(void)
29{
30 unsigned char *base = SERIAL_BASE;
31 unsigned char mask;
32 int i;
33
34 mask = UART_LSR_TEMT | UART_LSR_THRE;
35
36 for (i = 0; i < 0x1000; i++) {
37 if ((base[UART_LSR << 2] & mask) == mask)
38 break;
39 barrier();
40 }
41}
42
43/*
44 * nothing to do
45 */
46#define arch_decomp_setup()
47#define arch_decomp_wdog()
diff --git a/include/asm-arm/arch-loki/vmalloc.h b/include/asm-arm/arch-loki/vmalloc.h
new file mode 100644
index 000000000000..f5be06220491
--- /dev/null
+++ b/include/asm-arm/arch-loki/vmalloc.h
@@ -0,0 +1,5 @@
1/*
2 * include/asm-arm/arch-loki/vmalloc.h
3 */
4
5#define VMALLOC_END 0xfe800000
diff --git a/include/asm-arm/arch-msm/irqs.h b/include/asm-arm/arch-msm/irqs.h
index 565430cfaa7e..e62a108b1857 100644
--- a/include/asm-arm/arch-msm/irqs.h
+++ b/include/asm-arm/arch-msm/irqs.h
@@ -15,6 +15,7 @@
15 */ 15 */
16 16
17#ifndef __ASM_ARCH_MSM_IRQS_H 17#ifndef __ASM_ARCH_MSM_IRQS_H
18#define __ASM_ARCH_MSM_IRQS_H
18 19
19/* MSM ARM11 Interrupt Numbers */ 20/* MSM ARM11 Interrupt Numbers */
20/* See 80-VE113-1 A, pp219-221 */ 21/* See 80-VE113-1 A, pp219-221 */
diff --git a/include/asm-arm/arch-msm/timex.h b/include/asm-arm/arch-msm/timex.h
index 154b23fb3599..8724487ab4c9 100644
--- a/include/asm-arm/arch-msm/timex.h
+++ b/include/asm-arm/arch-msm/timex.h
@@ -14,6 +14,7 @@
14 */ 14 */
15 15
16#ifndef __ASM_ARCH_MSM_TIMEX_H 16#ifndef __ASM_ARCH_MSM_TIMEX_H
17#define __ASM_ARCH_MSM_TIMEX_H
17 18
18#define CLOCK_TICK_RATE 1000000 19#define CLOCK_TICK_RATE 1000000
19 20
diff --git a/include/asm-arm/arch-mv78xx0/debug-macro.S b/include/asm-arm/arch-mv78xx0/debug-macro.S
new file mode 100644
index 000000000000..d0595bd645e5
--- /dev/null
+++ b/include/asm-arm/arch-mv78xx0/debug-macro.S
@@ -0,0 +1,20 @@
1/*
2 * include/asm-arm/arch-mv78xx0/debug-macro.S
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 version 2 as
6 * published by the Free Software Foundation.
7*/
8
9#include <asm/arch/mv78xx0.h>
10
11 .macro addruart,rx
12 mrc p15, 0, \rx, c1, c0
13 tst \rx, #1 @ MMU enabled?
14 ldreq \rx, =MV78XX0_REGS_PHYS_BASE
15 ldrne \rx, =MV78XX0_REGS_VIRT_BASE
16 orr \rx, \rx, #0x00012000
17 .endm
18
19#define UART_SHIFT 2
20#include <asm/hardware/debug-8250.S>
diff --git a/include/asm-arm/arch-mv78xx0/dma.h b/include/asm-arm/arch-mv78xx0/dma.h
new file mode 100644
index 000000000000..40a8c178f10d
--- /dev/null
+++ b/include/asm-arm/arch-mv78xx0/dma.h
@@ -0,0 +1 @@
/* empty */
diff --git a/include/asm-arm/arch-mv78xx0/entry-macro.S b/include/asm-arm/arch-mv78xx0/entry-macro.S
new file mode 100644
index 000000000000..e9a606b12669
--- /dev/null
+++ b/include/asm-arm/arch-mv78xx0/entry-macro.S
@@ -0,0 +1,39 @@
1/*
2 * include/asm-arm/arch-mv78xx0/entry-macro.S
3 *
4 * Low-level IRQ helper macros for Marvell MV78xx0 platforms
5 *
6 * This file is licensed under the terms of the GNU General Public
7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied.
9 */
10
11#include <asm/arch/mv78xx0.h>
12
13 .macro disable_fiq
14 .endm
15
16 .macro arch_ret_to_user, tmp1, tmp2
17 .endm
18
19 .macro get_irqnr_preamble, base, tmp
20 ldr \base, =IRQ_VIRT_BASE
21 .endm
22
23 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
24 @ check low interrupts
25 ldr \irqstat, [\base, #IRQ_CAUSE_LOW_OFF]
26 ldr \tmp, [\base, #IRQ_MASK_LOW_OFF]
27 mov \irqnr, #31
28 ands \irqstat, \irqstat, \tmp
29
30 @ if no low interrupts set, check high interrupts
31 ldreq \irqstat, [\base, #IRQ_CAUSE_HIGH_OFF]
32 ldreq \tmp, [\base, #IRQ_MASK_HIGH_OFF]
33 moveq \irqnr, #63
34 andeqs \irqstat, \irqstat, \tmp
35
36 @ find first active interrupt source
37 clzne \irqstat, \irqstat
38 subne \irqnr, \irqnr, \irqstat
39 .endm
diff --git a/include/asm-arm/arch-mv78xx0/hardware.h b/include/asm-arm/arch-mv78xx0/hardware.h
new file mode 100644
index 000000000000..8e17926086c6
--- /dev/null
+++ b/include/asm-arm/arch-mv78xx0/hardware.h
@@ -0,0 +1,21 @@
1/*
2 * include/asm-arm/arch-mv78xx0/hardware.h
3 *
4 * This file is licensed under the terms of the GNU General Public
5 * License version 2. This program is licensed "as is" without any
6 * warranty of any kind, whether express or implied.
7 */
8
9#ifndef __ASM_ARCH_HARDWARE_H
10#define __ASM_ARCH_HARDWARE_H
11
12#include "mv78xx0.h"
13
14#define pcibios_assign_all_busses() 1
15
16#define PCIBIOS_MIN_IO 0x00001000
17#define PCIBIOS_MIN_MEM 0x01000000
18#define PCIMEM_BASE MV78XX0_PCIE_MEM_PHYS_BASE /* mem base for VGA */
19
20
21#endif
diff --git a/include/asm-arm/arch-mv78xx0/io.h b/include/asm-arm/arch-mv78xx0/io.h
new file mode 100644
index 000000000000..415d4c98e3d1
--- /dev/null
+++ b/include/asm-arm/arch-mv78xx0/io.h
@@ -0,0 +1,26 @@
1/*
2 * include/asm-arm/arch-mv78xx0/io.h
3 *
4 * This file is licensed under the terms of the GNU General Public
5 * License version 2. This program is licensed "as is" without any
6 * warranty of any kind, whether express or implied.
7 */
8
9#ifndef __ASM_ARCH_IO_H
10#define __ASM_ARCH_IO_H
11
12#include "mv78xx0.h"
13
14#define IO_SPACE_LIMIT 0xffffffff
15
16static inline void __iomem *__io(unsigned long addr)
17{
18 return (void __iomem *)((addr - MV78XX0_PCIE_IO_PHYS_BASE(0))
19 + MV78XX0_PCIE_IO_VIRT_BASE(0));
20}
21
22#define __io(a) __io(a)
23#define __mem_pci(a) (a)
24
25
26#endif
diff --git a/include/asm-arm/arch-mv78xx0/irqs.h b/include/asm-arm/arch-mv78xx0/irqs.h
new file mode 100644
index 000000000000..75930450cd65
--- /dev/null
+++ b/include/asm-arm/arch-mv78xx0/irqs.h
@@ -0,0 +1,91 @@
1/*
2 * include/asm-arm/arch-mv78xx0/irqs.h
3 *
4 * IRQ definitions for Marvell MV78xx0 SoCs
5 *
6 * This file is licensed under the terms of the GNU General Public
7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied.
9 */
10
11#ifndef __ASM_ARCH_IRQS_H
12#define __ASM_ARCH_IRQS_H
13
14#include "mv78xx0.h" /* need GPIO_MAX */
15
16/*
17 * MV78xx0 Low Interrupt Controller
18 */
19#define IRQ_MV78XX0_ERR 0
20#define IRQ_MV78XX0_SPI 1
21#define IRQ_MV78XX0_I2C_0 2
22#define IRQ_MV78XX0_I2C_1 3
23#define IRQ_MV78XX0_IDMA_0 4
24#define IRQ_MV78XX0_IDMA_1 5
25#define IRQ_MV78XX0_IDMA_2 6
26#define IRQ_MV78XX0_IDMA_3 7
27#define IRQ_MV78XX0_TIMER_0 8
28#define IRQ_MV78XX0_TIMER_1 9
29#define IRQ_MV78XX0_TIMER_2 10
30#define IRQ_MV78XX0_TIMER_3 11
31#define IRQ_MV78XX0_UART_0 12
32#define IRQ_MV78XX0_UART_1 13
33#define IRQ_MV78XX0_UART_2 14
34#define IRQ_MV78XX0_UART_3 15
35#define IRQ_MV78XX0_USB_0 16
36#define IRQ_MV78XX0_USB_1 17
37#define IRQ_MV78XX0_USB_2 18
38#define IRQ_MV78XX0_CRYPTO 19
39#define IRQ_MV78XX0_SDIO_0 20
40#define IRQ_MV78XX0_SDIO_1 21
41#define IRQ_MV78XX0_XOR_0 22
42#define IRQ_MV78XX0_XOR_1 23
43#define IRQ_MV78XX0_I2S_0 24
44#define IRQ_MV78XX0_I2S_1 25
45#define IRQ_MV78XX0_SATA 26
46#define IRQ_MV78XX0_TDMI 27
47
48/*
49 * MV78xx0 High Interrupt Controller
50 */
51#define IRQ_MV78XX0_PCIE_00 32
52#define IRQ_MV78XX0_PCIE_01 33
53#define IRQ_MV78XX0_PCIE_02 34
54#define IRQ_MV78XX0_PCIE_03 35
55#define IRQ_MV78XX0_PCIE_10 36
56#define IRQ_MV78XX0_PCIE_11 37
57#define IRQ_MV78XX0_PCIE_12 38
58#define IRQ_MV78XX0_PCIE_13 39
59#define IRQ_MV78XX0_GE00_SUM 40
60#define IRQ_MV78XX0_GE00_RX 41
61#define IRQ_MV78XX0_GE00_TX 42
62#define IRQ_MV78XX0_GE00_MISC 43
63#define IRQ_MV78XX0_GE01_SUM 44
64#define IRQ_MV78XX0_GE01_RX 45
65#define IRQ_MV78XX0_GE01_TX 46
66#define IRQ_MV78XX0_GE01_MISC 47
67#define IRQ_MV78XX0_GE10_SUM 48
68#define IRQ_MV78XX0_GE10_RX 49
69#define IRQ_MV78XX0_GE10_TX 50
70#define IRQ_MV78XX0_GE10_MISC 51
71#define IRQ_MV78XX0_GE11_SUM 52
72#define IRQ_MV78XX0_GE11_RX 53
73#define IRQ_MV78XX0_GE11_TX 54
74#define IRQ_MV78XX0_GE11_MISC 55
75#define IRQ_MV78XX0_GPIO_0_7 56
76#define IRQ_MV78XX0_GPIO_8_15 57
77#define IRQ_MV78XX0_GPIO_16_23 58
78#define IRQ_MV78XX0_GPIO_24_31 59
79#define IRQ_MV78XX0_DB_IN 60
80#define IRQ_MV78XX0_DB_OUT 61
81
82/*
83 * MV78XX0 General Purpose Pins
84 */
85#define IRQ_MV78XX0_GPIO_START 64
86#define NR_GPIO_IRQS GPIO_MAX
87
88#define NR_IRQS (IRQ_MV78XX0_GPIO_START + NR_GPIO_IRQS)
89
90
91#endif
diff --git a/include/asm-arm/arch-mv78xx0/memory.h b/include/asm-arm/arch-mv78xx0/memory.h
new file mode 100644
index 000000000000..721a6b185b91
--- /dev/null
+++ b/include/asm-arm/arch-mv78xx0/memory.h
@@ -0,0 +1,14 @@
1/*
2 * include/asm-arm/arch-mv78xx0/memory.h
3 */
4
5#ifndef __ASM_ARCH_MEMORY_H
6#define __ASM_ARCH_MEMORY_H
7
8#define PHYS_OFFSET UL(0x00000000)
9
10#define __virt_to_bus(x) __virt_to_phys(x)
11#define __bus_to_virt(x) __phys_to_virt(x)
12
13
14#endif
diff --git a/include/asm-arm/arch-mv78xx0/mv78xx0.h b/include/asm-arm/arch-mv78xx0/mv78xx0.h
new file mode 100644
index 000000000000..9f5d83c73faa
--- /dev/null
+++ b/include/asm-arm/arch-mv78xx0/mv78xx0.h
@@ -0,0 +1,126 @@
1/*
2 * include/asm-arm/arch-mv78xx0/mv78xx0.h
3 *
4 * Generic definitions for Marvell MV78xx0 SoC flavors:
5 * MV781x0 and MV782x0.
6 *
7 * This file is licensed under the terms of the GNU General Public
8 * License version 2. This program is licensed "as is" without any
9 * warranty of any kind, whether express or implied.
10 */
11
12#ifndef __ASM_ARCH_MV78XX0_H
13#define __ASM_ARCH_MV78XX0_H
14
15/*
16 * Marvell MV78xx0 address maps.
17 *
18 * phys
19 * c0000000 PCIe Memory space
20 * f0800000 PCIe #0 I/O space
21 * f0900000 PCIe #1 I/O space
22 * f0a00000 PCIe #2 I/O space
23 * f0b00000 PCIe #3 I/O space
24 * f0c00000 PCIe #4 I/O space
25 * f0d00000 PCIe #5 I/O space
26 * f0e00000 PCIe #6 I/O space
27 * f0f00000 PCIe #7 I/O space
28 * f1000000 on-chip peripheral registers
29 *
30 * virt phys size
31 * fe400000 f102x000 16K core-specific peripheral registers
32 * fe700000 f0800000 1M PCIe #0 I/O space
33 * fe800000 f0900000 1M PCIe #1 I/O space
34 * fe900000 f0a00000 1M PCIe #2 I/O space
35 * fea00000 f0b00000 1M PCIe #3 I/O space
36 * feb00000 f0c00000 1M PCIe #4 I/O space
37 * fec00000 f0d00000 1M PCIe #5 I/O space
38 * fed00000 f0e00000 1M PCIe #6 I/O space
39 * fee00000 f0f00000 1M PCIe #7 I/O space
40 * fef00000 f1000000 1M on-chip peripheral registers
41 */
42#define MV78XX0_CORE0_REGS_PHYS_BASE 0xf1020000
43#define MV78XX0_CORE1_REGS_PHYS_BASE 0xf1024000
44#define MV78XX0_CORE_REGS_VIRT_BASE 0xfe400000
45#define MV78XX0_CORE_REGS_SIZE SZ_16K
46
47#define MV78XX0_PCIE_IO_PHYS_BASE(i) (0xf0800000 + ((i) << 20))
48#define MV78XX0_PCIE_IO_VIRT_BASE(i) (0xfe700000 + ((i) << 20))
49#define MV78XX0_PCIE_IO_SIZE SZ_1M
50
51#define MV78XX0_REGS_PHYS_BASE 0xf1000000
52#define MV78XX0_REGS_VIRT_BASE 0xfef00000
53#define MV78XX0_REGS_SIZE SZ_1M
54
55#define MV78XX0_PCIE_MEM_PHYS_BASE 0xc0000000
56#define MV78XX0_PCIE_MEM_SIZE 0x30000000
57
58/*
59 * Core-specific peripheral registers.
60 */
61#define BRIDGE_VIRT_BASE (MV78XX0_CORE_REGS_VIRT_BASE)
62#define CPU_CONTROL (BRIDGE_VIRT_BASE | 0x0104)
63#define L2_WRITETHROUGH 0x00020000
64#define RSTOUTn_MASK (BRIDGE_VIRT_BASE | 0x0108)
65#define SOFT_RESET_OUT_EN 0x00000004
66#define SYSTEM_SOFT_RESET (BRIDGE_VIRT_BASE | 0x010c)
67#define SOFT_RESET 0x00000001
68#define BRIDGE_CAUSE (BRIDGE_VIRT_BASE | 0x0110)
69#define BRIDGE_MASK (BRIDGE_VIRT_BASE | 0x0114)
70#define BRIDGE_INT_TIMER0 0x0002
71#define BRIDGE_INT_TIMER1 0x0004
72#define BRIDGE_INT_TIMER1_CLR (~0x0004)
73#define IRQ_VIRT_BASE (BRIDGE_VIRT_BASE | 0x0200)
74#define IRQ_CAUSE_LOW_OFF 0x0004
75#define IRQ_CAUSE_HIGH_OFF 0x0008
76#define IRQ_MASK_LOW_OFF 0x0010
77#define IRQ_MASK_HIGH_OFF 0x0014
78#define TIMER_VIRT_BASE (BRIDGE_VIRT_BASE | 0x0300)
79
80/*
81 * Register Map
82 */
83#define DDR_VIRT_BASE (MV78XX0_REGS_VIRT_BASE | 0x00000)
84#define DDR_WINDOW_CPU0_BASE (DDR_VIRT_BASE | 0x1500)
85#define DDR_WINDOW_CPU1_BASE (DDR_VIRT_BASE | 0x1700)
86
87#define DEV_BUS_PHYS_BASE (MV78XX0_REGS_PHYS_BASE | 0x10000)
88#define DEV_BUS_VIRT_BASE (MV78XX0_REGS_VIRT_BASE | 0x10000)
89#define SAMPLE_AT_RESET_LOW (DEV_BUS_VIRT_BASE | 0x0030)
90#define SAMPLE_AT_RESET_HIGH (DEV_BUS_VIRT_BASE | 0x0034)
91#define UART0_PHYS_BASE (DEV_BUS_PHYS_BASE | 0x2000)
92#define UART0_VIRT_BASE (DEV_BUS_VIRT_BASE | 0x2000)
93#define UART1_PHYS_BASE (DEV_BUS_PHYS_BASE | 0x2100)
94#define UART1_VIRT_BASE (DEV_BUS_VIRT_BASE | 0x2100)
95#define UART2_PHYS_BASE (DEV_BUS_PHYS_BASE | 0x2200)
96#define UART2_VIRT_BASE (DEV_BUS_VIRT_BASE | 0x2200)
97#define UART3_PHYS_BASE (DEV_BUS_PHYS_BASE | 0x2300)
98#define UART3_VIRT_BASE (DEV_BUS_VIRT_BASE | 0x2300)
99
100#define GE10_PHYS_BASE (MV78XX0_REGS_PHYS_BASE | 0x30000)
101#define GE11_PHYS_BASE (MV78XX0_REGS_PHYS_BASE | 0x34000)
102
103#define PCIE00_VIRT_BASE (MV78XX0_REGS_VIRT_BASE | 0x40000)
104#define PCIE01_VIRT_BASE (MV78XX0_REGS_VIRT_BASE | 0x44000)
105#define PCIE02_VIRT_BASE (MV78XX0_REGS_VIRT_BASE | 0x48000)
106#define PCIE03_VIRT_BASE (MV78XX0_REGS_VIRT_BASE | 0x4c000)
107
108#define USB0_PHYS_BASE (MV78XX0_REGS_PHYS_BASE | 0x50000)
109#define USB1_PHYS_BASE (MV78XX0_REGS_PHYS_BASE | 0x51000)
110#define USB2_PHYS_BASE (MV78XX0_REGS_PHYS_BASE | 0x52000)
111
112#define GE00_PHYS_BASE (MV78XX0_REGS_PHYS_BASE | 0x70000)
113#define GE01_PHYS_BASE (MV78XX0_REGS_PHYS_BASE | 0x74000)
114
115#define PCIE10_VIRT_BASE (MV78XX0_REGS_VIRT_BASE | 0x80000)
116#define PCIE11_VIRT_BASE (MV78XX0_REGS_VIRT_BASE | 0x84000)
117#define PCIE12_VIRT_BASE (MV78XX0_REGS_VIRT_BASE | 0x88000)
118#define PCIE13_VIRT_BASE (MV78XX0_REGS_VIRT_BASE | 0x8c000)
119
120#define SATA_PHYS_BASE (MV78XX0_REGS_PHYS_BASE | 0xa0000)
121
122
123#define GPIO_MAX 32
124
125
126#endif
diff --git a/include/asm-arm/arch-mv78xx0/system.h b/include/asm-arm/arch-mv78xx0/system.h
new file mode 100644
index 000000000000..7eb47d376db9
--- /dev/null
+++ b/include/asm-arm/arch-mv78xx0/system.h
@@ -0,0 +1,37 @@
1/*
2 * include/asm-arm/arch-mv78xx0/system.h
3 *
4 * This file is licensed under the terms of the GNU General Public
5 * License version 2. This program is licensed "as is" without any
6 * warranty of any kind, whether express or implied.
7 */
8
9#ifndef __ASM_ARCH_SYSTEM_H
10#define __ASM_ARCH_SYSTEM_H
11
12#include <asm/arch/hardware.h>
13#include <asm/arch/mv78xx0.h>
14
15static inline void arch_idle(void)
16{
17 cpu_do_idle();
18}
19
20static inline void arch_reset(char mode)
21{
22 /*
23 * Enable soft reset to assert RSTOUTn.
24 */
25 writel(SOFT_RESET_OUT_EN, RSTOUTn_MASK);
26
27 /*
28 * Assert soft reset.
29 */
30 writel(SOFT_RESET, SYSTEM_SOFT_RESET);
31
32 while (1)
33 ;
34}
35
36
37#endif
diff --git a/include/asm-arm/arch-mv78xx0/timex.h b/include/asm-arm/arch-mv78xx0/timex.h
new file mode 100644
index 000000000000..a854b1ccbd01
--- /dev/null
+++ b/include/asm-arm/arch-mv78xx0/timex.h
@@ -0,0 +1,9 @@
1/*
2 * include/asm-arm/arch-mv78xx0/timex.h
3 *
4 * This file is licensed under the terms of the GNU General Public
5 * License version 2. This program is licensed "as is" without any
6 * warranty of any kind, whether express or implied.
7 */
8
9#define CLOCK_TICK_RATE (100 * HZ)
diff --git a/include/asm-arm/arch-mv78xx0/uncompress.h b/include/asm-arm/arch-mv78xx0/uncompress.h
new file mode 100644
index 000000000000..3bfe0a293ef7
--- /dev/null
+++ b/include/asm-arm/arch-mv78xx0/uncompress.h
@@ -0,0 +1,47 @@
1/*
2 * include/asm-arm/arch-mv78xx0/uncompress.h
3 *
4 * This file is licensed under the terms of the GNU General Public
5 * License version 2. This program is licensed "as is" without any
6 * warranty of any kind, whether express or implied.
7 */
8
9#include <linux/serial_reg.h>
10#include <asm/arch/mv78xx0.h>
11
12#define SERIAL_BASE ((unsigned char *)UART0_PHYS_BASE)
13
14static void putc(const char c)
15{
16 unsigned char *base = SERIAL_BASE;
17 int i;
18
19 for (i = 0; i < 0x1000; i++) {
20 if (base[UART_LSR << 2] & UART_LSR_THRE)
21 break;
22 barrier();
23 }
24
25 base[UART_TX << 2] = c;
26}
27
28static void flush(void)
29{
30 unsigned char *base = SERIAL_BASE;
31 unsigned char mask;
32 int i;
33
34 mask = UART_LSR_TEMT | UART_LSR_THRE;
35
36 for (i = 0; i < 0x1000; i++) {
37 if ((base[UART_LSR << 2] & mask) == mask)
38 break;
39 barrier();
40 }
41}
42
43/*
44 * nothing to do
45 */
46#define arch_decomp_setup()
47#define arch_decomp_wdog()
diff --git a/include/asm-arm/arch-mv78xx0/vmalloc.h b/include/asm-arm/arch-mv78xx0/vmalloc.h
new file mode 100644
index 000000000000..f2c512197579
--- /dev/null
+++ b/include/asm-arm/arch-mv78xx0/vmalloc.h
@@ -0,0 +1,5 @@
1/*
2 * include/asm-arm/arch-mv78xx0/vmalloc.h
3 */
4
5#define VMALLOC_END 0xfe000000
diff --git a/include/asm-arm/arch-ns9xxx/hardware.h b/include/asm-arm/arch-ns9xxx/hardware.h
index 0b7b34603f1c..0dca11ce21fc 100644
--- a/include/asm-arm/arch-ns9xxx/hardware.h
+++ b/include/asm-arm/arch-ns9xxx/hardware.h
@@ -66,13 +66,13 @@
66 __REGGET(var, reg ## _ ## field) / __REGSHIFT(reg ## _ ## field) 66 __REGGET(var, reg ## _ ## field) / __REGSHIFT(reg ## _ ## field)
67 67
68# define REGGETIM_IDX(var, reg, field, idx) \ 68# define REGGETIM_IDX(var, reg, field, idx) \
69 __REGGET(var, reg ## _ ## field((idx))) / \ 69 __REGGET(var, reg ## _ ## field((idx))) / \
70 __REGSHIFT(reg ## _ ## field((idx))) 70 __REGSHIFT(reg ## _ ## field((idx)))
71 71
72#else 72#else
73 73
74# define __REG(x) io_p2v(x) 74# define __REG(x) io_p2v(x)
75# define __REG2(x, y) io_p2v((x) + (y)) 75# define __REG2(x, y) io_p2v((x) + 4 * (y))
76 76
77#endif 77#endif
78 78
diff --git a/include/asm-arm/arch-omap/board-2430sdp.h b/include/asm-arm/arch-omap/board-2430sdp.h
index e9c65ce3cb12..c7db9004ec31 100644
--- a/include/asm-arm/arch-omap/board-2430sdp.h
+++ b/include/asm-arm/arch-omap/board-2430sdp.h
@@ -36,9 +36,4 @@
36 36
37#define TWL4030_IRQNUM INT_24XX_SYS_NIRQ 37#define TWL4030_IRQNUM INT_24XX_SYS_NIRQ
38 38
39/* TWL4030 Primary Interrupt Handler (PIH) interrupts */
40#define IH_TWL4030_BASE IH_BOARD_BASE
41#define IH_TWL4030_END (IH_TWL4030_BASE+8)
42#define NR_IRQS (IH_TWL4030_END)
43
44#endif /* __ASM_ARCH_OMAP_2430SDP_H */ 39#endif /* __ASM_ARCH_OMAP_2430SDP_H */
diff --git a/include/asm-arm/arch-omap/board-h3.h b/include/asm-arm/arch-omap/board-h3.h
index 0f6404435ea8..c5d0f32a40ac 100644
--- a/include/asm-arm/arch-omap/board-h3.h
+++ b/include/asm-arm/arch-omap/board-h3.h
@@ -30,12 +30,6 @@
30/* In OMAP1710 H3 the Ethernet is directly connected to CS1 */ 30/* In OMAP1710 H3 the Ethernet is directly connected to CS1 */
31#define OMAP1710_ETHR_START 0x04000300 31#define OMAP1710_ETHR_START 0x04000300
32 32
33#define MAXIRQNUM (IH_BOARD_BASE)
34#define MAXFIQNUM MAXIRQNUM
35#define MAXSWINUM MAXIRQNUM
36
37#define NR_IRQS (MAXIRQNUM + 1)
38
39extern void h3_mmc_init(void); 33extern void h3_mmc_init(void);
40extern void h3_mmc_slot_cover_handler(void *arg, int state); 34extern void h3_mmc_slot_cover_handler(void *arg, int state);
41 35
diff --git a/include/asm-arm/arch-omap/board-innovator.h b/include/asm-arm/arch-omap/board-innovator.h
index 56d2c98e143c..9ca03dec9d36 100644
--- a/include/asm-arm/arch-omap/board-innovator.h
+++ b/include/asm-arm/arch-omap/board-innovator.h
@@ -36,9 +36,6 @@
36#define OMAP1510P1_EMIFS_PRI_VALUE 0x00 36#define OMAP1510P1_EMIFS_PRI_VALUE 0x00
37#define OMAP1510P1_EMIFF_PRI_VALUE 0x00 37#define OMAP1510P1_EMIFF_PRI_VALUE 0x00
38 38
39#define NR_FPGA_IRQS 24
40#define NR_IRQS (IH_BOARD_BASE + NR_FPGA_IRQS)
41
42#ifndef __ASSEMBLY__ 39#ifndef __ASSEMBLY__
43void fpga_write(unsigned char val, int reg); 40void fpga_write(unsigned char val, int reg);
44unsigned char fpga_read(int reg); 41unsigned char fpga_read(int reg);
diff --git a/include/asm-arm/arch-omap/board-perseus2.h b/include/asm-arm/arch-omap/board-perseus2.h
index eb74420cb439..d7429cb0f726 100644
--- a/include/asm-arm/arch-omap/board-perseus2.h
+++ b/include/asm-arm/arch-omap/board-perseus2.h
@@ -36,10 +36,4 @@
36#define OMAP_SDRAM_DEVICE D256M_1X16_4B 36#define OMAP_SDRAM_DEVICE D256M_1X16_4B
37#endif 37#endif
38 38
39#define MAXIRQNUM IH_BOARD_BASE
40#define MAXFIQNUM MAXIRQNUM
41#define MAXSWINUM MAXIRQNUM
42
43#define NR_IRQS (MAXIRQNUM + 1)
44
45#endif 39#endif
diff --git a/include/asm-arm/arch-omap/clock.h b/include/asm-arm/arch-omap/clock.h
index 12a5e4de9518..4c7b3514f71a 100644
--- a/include/asm-arm/arch-omap/clock.h
+++ b/include/asm-arm/arch-omap/clock.h
@@ -33,12 +33,24 @@ struct dpll_data {
33 void __iomem *mult_div1_reg; 33 void __iomem *mult_div1_reg;
34 u32 mult_mask; 34 u32 mult_mask;
35 u32 div1_mask; 35 u32 div1_mask;
36 u16 last_rounded_m;
37 u8 last_rounded_n;
38 unsigned long last_rounded_rate;
39 unsigned int rate_tolerance;
40 u16 max_multiplier;
41 u8 max_divider;
42 u32 max_tolerance;
36# if defined(CONFIG_ARCH_OMAP3) 43# if defined(CONFIG_ARCH_OMAP3)
44 u8 modes;
37 void __iomem *control_reg; 45 void __iomem *control_reg;
38 u32 enable_mask; 46 u32 enable_mask;
39 u8 auto_recal_bit; 47 u8 auto_recal_bit;
40 u8 recal_en_bit; 48 u8 recal_en_bit;
41 u8 recal_st_bit; 49 u8 recal_st_bit;
50 void __iomem *autoidle_reg;
51 u32 autoidle_mask;
52 void __iomem *idlest_reg;
53 u8 idlest_bit;
42# endif 54# endif
43}; 55};
44 56
@@ -66,11 +78,14 @@ struct clk {
66 void __iomem *clksel_reg; 78 void __iomem *clksel_reg;
67 u32 clksel_mask; 79 u32 clksel_mask;
68 const struct clksel *clksel; 80 const struct clksel *clksel;
69 const struct dpll_data *dpll_data; 81 struct dpll_data *dpll_data;
70#else 82#else
71 __u8 rate_offset; 83 __u8 rate_offset;
72 __u8 src_offset; 84 __u8 src_offset;
73#endif 85#endif
86#if defined(CONFIG_PM_DEBUG) && defined(CONFIG_DEBUG_FS)
87 struct dentry *dent; /* For visible tree hierarchy */
88#endif
74}; 89};
75 90
76struct cpufreq_frequency_table; 91struct cpufreq_frequency_table;
diff --git a/include/asm-arm/arch-omap/common.h b/include/asm-arm/arch-omap/common.h
index 36a3b62d4d8d..8ac03071f60c 100644
--- a/include/asm-arm/arch-omap/common.h
+++ b/include/asm-arm/arch-omap/common.h
@@ -47,8 +47,23 @@ static inline int omap_register_i2c_bus(int bus_id, u32 clkrate,
47} 47}
48#endif 48#endif
49 49
50/* IO bases for various OMAP processors */
51struct omap_globals {
52 void __iomem *tap; /* Control module ID code */
53 void __iomem *sdrc; /* SDRAM Controller */
54 void __iomem *sms; /* SDRAM Memory Scheduler */
55 void __iomem *ctrl; /* System Control Module */
56 void __iomem *prm; /* Power and Reset Management */
57 void __iomem *cm; /* Clock Management */
58};
59
50void omap2_set_globals_242x(void); 60void omap2_set_globals_242x(void);
51void omap2_set_globals_243x(void); 61void omap2_set_globals_243x(void);
52void omap2_set_globals_343x(void); 62void omap2_set_globals_343x(void);
53 63
64/* These get called from omap2_set_globals_xxxx(), do not call these */
65void omap2_set_globals_memory(struct omap_globals *);
66void omap2_set_globals_control(struct omap_globals *);
67void omap2_set_globals_prcm(struct omap_globals *);
68
54#endif /* __ARCH_ARM_MACH_OMAP_COMMON_H */ 69#endif /* __ARCH_ARM_MACH_OMAP_COMMON_H */
diff --git a/include/asm-arm/arch-omap/control.h b/include/asm-arm/arch-omap/control.h
index 59c0686f8be7..987553e3eeb9 100644
--- a/include/asm-arm/arch-omap/control.h
+++ b/include/asm-arm/arch-omap/control.h
@@ -167,8 +167,7 @@
167 167
168#ifndef __ASSEMBLY__ 168#ifndef __ASSEMBLY__
169#if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3) 169#if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3)
170extern void omap_ctrl_base_set(u32 base); 170extern void __iomem *omap_ctrl_base_get(void);
171extern u32 omap_ctrl_base_get(void);
172extern u8 omap_ctrl_readb(u16 offset); 171extern u8 omap_ctrl_readb(u16 offset);
173extern u16 omap_ctrl_readw(u16 offset); 172extern u16 omap_ctrl_readw(u16 offset);
174extern u32 omap_ctrl_readl(u16 offset); 173extern u32 omap_ctrl_readl(u16 offset);
@@ -176,7 +175,6 @@ extern void omap_ctrl_writeb(u8 val, u16 offset);
176extern void omap_ctrl_writew(u16 val, u16 offset); 175extern void omap_ctrl_writew(u16 val, u16 offset);
177extern void omap_ctrl_writel(u32 val, u16 offset); 176extern void omap_ctrl_writel(u32 val, u16 offset);
178#else 177#else
179#define omap_ctrl_base_set(x) WARN_ON(1)
180#define omap_ctrl_base_get() 0 178#define omap_ctrl_base_get() 0
181#define omap_ctrl_readb(x) 0 179#define omap_ctrl_readb(x) 0
182#define omap_ctrl_readw(x) 0 180#define omap_ctrl_readw(x) 0
diff --git a/include/asm-arm/arch-omap/cpu.h b/include/asm-arm/arch-omap/cpu.h
index e8a4cf52778b..52db09f83281 100644
--- a/include/asm-arm/arch-omap/cpu.h
+++ b/include/asm-arm/arch-omap/cpu.h
@@ -3,7 +3,7 @@
3 * 3 *
4 * OMAP cpu type detection 4 * OMAP cpu type detection
5 * 5 *
6 * Copyright (C) 2004 Nokia Corporation 6 * Copyright (C) 2004, 2008 Nokia Corporation
7 * 7 *
8 * Written by Tony Lindgren <tony.lindgren@nokia.com> 8 * Written by Tony Lindgren <tony.lindgren@nokia.com>
9 * 9 *
@@ -26,6 +26,12 @@
26#ifndef __ASM_ARCH_OMAP_CPU_H 26#ifndef __ASM_ARCH_OMAP_CPU_H
27#define __ASM_ARCH_OMAP_CPU_H 27#define __ASM_ARCH_OMAP_CPU_H
28 28
29struct omap_chip_id {
30 u8 oc;
31};
32
33#define OMAP_CHIP_INIT(x) { .oc = x }
34
29extern unsigned int system_rev; 35extern unsigned int system_rev;
30 36
31#define omap2_cpu_rev() ((system_rev >> 12) & 0x0f) 37#define omap2_cpu_rev() ((system_rev >> 12) & 0x0f)
@@ -345,6 +351,33 @@ IS_OMAP_TYPE(3430, 0x3430)
345#define OMAP2430_REV_ES1_0 0x24300000 351#define OMAP2430_REV_ES1_0 0x24300000
346#define OMAP3430_REV_ES1_0 0x34300000 352#define OMAP3430_REV_ES1_0 0x34300000
347#define OMAP3430_REV_ES2_0 0x34301000 353#define OMAP3430_REV_ES2_0 0x34301000
354#define OMAP3430_REV_ES2_1 0x34302000
355#define OMAP3430_REV_ES2_2 0x34303000
356
357/*
358 * omap_chip bits
359 *
360 * CHIP_IS_OMAP{2420,2430,3430} indicate that a particular structure is
361 * valid on all chips of that type. CHIP_IS_OMAP3430ES{1,2} indicates
362 * something that is only valid on that particular ES revision.
363 *
364 * These bits may be ORed together to indicate structures that are
365 * available on multiple chip types.
366 *
367 * To test whether a particular structure matches the current OMAP chip type,
368 * use omap_chip_is().
369 *
370 */
371#define CHIP_IS_OMAP2420 (1 << 0)
372#define CHIP_IS_OMAP2430 (1 << 1)
373#define CHIP_IS_OMAP3430 (1 << 2)
374#define CHIP_IS_OMAP3430ES1 (1 << 3)
375#define CHIP_IS_OMAP3430ES2 (1 << 4)
376
377#define CHIP_IS_OMAP24XX (CHIP_IS_OMAP2420 | CHIP_IS_OMAP2430)
378
379int omap_chip_is(struct omap_chip_id oci);
380
348 381
349/* 382/*
350 * Macro to detect device type i.e. EMU/HS/TST/GP/BAD 383 * Macro to detect device type i.e. EMU/HS/TST/GP/BAD
@@ -362,6 +395,8 @@ IS_OMAP_TYPE(3430, 0x3430)
362#define is_device_type_gp() (get_device_type() == DEVICE_TYPE_GP) 395#define is_device_type_gp() (get_device_type() == DEVICE_TYPE_GP)
363#define is_device_type_bad() (get_device_type() == DEVICE_TYPE_BAD) 396#define is_device_type_bad() (get_device_type() == DEVICE_TYPE_BAD)
364 397
365#endif 398void omap2_check_revision(void);
399
400#endif /* defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3) */
366 401
367#endif 402#endif
diff --git a/include/asm-arm/arch-omap/dma.h b/include/asm-arm/arch-omap/dma.h
index 24acf090030d..f4dcb9587869 100644
--- a/include/asm-arm/arch-omap/dma.h
+++ b/include/asm-arm/arch-omap/dma.h
@@ -22,108 +22,128 @@
22#define __ASM_ARCH_DMA_H 22#define __ASM_ARCH_DMA_H
23 23
24/* Hardware registers for omap1 */ 24/* Hardware registers for omap1 */
25#define OMAP_DMA_BASE (0xfffed800) 25#define OMAP1_DMA_BASE (0xfffed800)
26#define OMAP_DMA_GCR (OMAP_DMA_BASE + 0x400) 26
27#define OMAP_DMA_GSCR (OMAP_DMA_BASE + 0x404) 27#define OMAP1_DMA_GCR 0x400
28#define OMAP_DMA_GRST (OMAP_DMA_BASE + 0x408) 28#define OMAP1_DMA_GSCR 0x404
29#define OMAP_DMA_HW_ID (OMAP_DMA_BASE + 0x442) 29#define OMAP1_DMA_GRST 0x408
30#define OMAP_DMA_PCH2_ID (OMAP_DMA_BASE + 0x444) 30#define OMAP1_DMA_HW_ID 0x442
31#define OMAP_DMA_PCH0_ID (OMAP_DMA_BASE + 0x446) 31#define OMAP1_DMA_PCH2_ID 0x444
32#define OMAP_DMA_PCH1_ID (OMAP_DMA_BASE + 0x448) 32#define OMAP1_DMA_PCH0_ID 0x446
33#define OMAP_DMA_PCHG_ID (OMAP_DMA_BASE + 0x44a) 33#define OMAP1_DMA_PCH1_ID 0x448
34#define OMAP_DMA_PCHD_ID (OMAP_DMA_BASE + 0x44c) 34#define OMAP1_DMA_PCHG_ID 0x44a
35#define OMAP_DMA_CAPS_0_U (OMAP_DMA_BASE + 0x44e) 35#define OMAP1_DMA_PCHD_ID 0x44c
36#define OMAP_DMA_CAPS_0_L (OMAP_DMA_BASE + 0x450) 36#define OMAP1_DMA_CAPS_0_U 0x44e
37#define OMAP_DMA_CAPS_1_U (OMAP_DMA_BASE + 0x452) 37#define OMAP1_DMA_CAPS_0_L 0x450
38#define OMAP_DMA_CAPS_1_L (OMAP_DMA_BASE + 0x454) 38#define OMAP1_DMA_CAPS_1_U 0x452
39#define OMAP_DMA_CAPS_2 (OMAP_DMA_BASE + 0x456) 39#define OMAP1_DMA_CAPS_1_L 0x454
40#define OMAP_DMA_CAPS_3 (OMAP_DMA_BASE + 0x458) 40#define OMAP1_DMA_CAPS_2 0x456
41#define OMAP_DMA_CAPS_4 (OMAP_DMA_BASE + 0x45a) 41#define OMAP1_DMA_CAPS_3 0x458
42#define OMAP_DMA_PCH2_SR (OMAP_DMA_BASE + 0x460) 42#define OMAP1_DMA_CAPS_4 0x45a
43#define OMAP_DMA_PCH0_SR (OMAP_DMA_BASE + 0x480) 43#define OMAP1_DMA_PCH2_SR 0x460
44#define OMAP_DMA_PCH1_SR (OMAP_DMA_BASE + 0x482) 44#define OMAP1_DMA_PCH0_SR 0x480
45#define OMAP_DMA_PCHD_SR (OMAP_DMA_BASE + 0x4c0) 45#define OMAP1_DMA_PCH1_SR 0x482
46 46#define OMAP1_DMA_PCHD_SR 0x4c0
47/* Hardware registers for omap2 */ 47
48#if defined(CONFIG_ARCH_OMAP3) 48/* Hardware registers for omap2 and omap3 */
49#define OMAP_DMA4_BASE (L4_34XX_BASE + 0x56000) 49#define OMAP24XX_DMA4_BASE (L4_24XX_BASE + 0x56000)
50#else /* CONFIG_ARCH_OMAP2 */ 50#define OMAP34XX_DMA4_BASE (L4_34XX_BASE + 0x56000)
51#define OMAP_DMA4_BASE (L4_24XX_BASE + 0x56000) 51
52#endif 52#define OMAP_DMA4_REVISION 0x00
53 53#define OMAP_DMA4_GCR 0x78
54#define OMAP_DMA4_REVISION (OMAP_DMA4_BASE + 0x00) 54#define OMAP_DMA4_IRQSTATUS_L0 0x08
55#define OMAP_DMA4_GCR_REG (OMAP_DMA4_BASE + 0x78) 55#define OMAP_DMA4_IRQSTATUS_L1 0x0c
56#define OMAP_DMA4_IRQSTATUS_L0 (OMAP_DMA4_BASE + 0x08) 56#define OMAP_DMA4_IRQSTATUS_L2 0x10
57#define OMAP_DMA4_IRQSTATUS_L1 (OMAP_DMA4_BASE + 0x0c) 57#define OMAP_DMA4_IRQSTATUS_L3 0x14
58#define OMAP_DMA4_IRQSTATUS_L2 (OMAP_DMA4_BASE + 0x10) 58#define OMAP_DMA4_IRQENABLE_L0 0x18
59#define OMAP_DMA4_IRQSTATUS_L3 (OMAP_DMA4_BASE + 0x14) 59#define OMAP_DMA4_IRQENABLE_L1 0x1c
60#define OMAP_DMA4_IRQENABLE_L0 (OMAP_DMA4_BASE + 0x18) 60#define OMAP_DMA4_IRQENABLE_L2 0x20
61#define OMAP_DMA4_IRQENABLE_L1 (OMAP_DMA4_BASE + 0x1c) 61#define OMAP_DMA4_IRQENABLE_L3 0x24
62#define OMAP_DMA4_IRQENABLE_L2 (OMAP_DMA4_BASE + 0x20) 62#define OMAP_DMA4_SYSSTATUS 0x28
63#define OMAP_DMA4_IRQENABLE_L3 (OMAP_DMA4_BASE + 0x24) 63#define OMAP_DMA4_OCP_SYSCONFIG 0x2c
64#define OMAP_DMA4_SYSSTATUS (OMAP_DMA4_BASE + 0x28) 64#define OMAP_DMA4_CAPS_0 0x64
65#define OMAP_DMA4_OCP_SYSCONFIG (OMAP_DMA4_BASE + 0x2c) 65#define OMAP_DMA4_CAPS_2 0x6c
66#define OMAP_DMA4_CAPS_0 (OMAP_DMA4_BASE + 0x64) 66#define OMAP_DMA4_CAPS_3 0x70
67#define OMAP_DMA4_CAPS_2 (OMAP_DMA4_BASE + 0x6c) 67#define OMAP_DMA4_CAPS_4 0x74
68#define OMAP_DMA4_CAPS_3 (OMAP_DMA4_BASE + 0x70) 68
69#define OMAP_DMA4_CAPS_4 (OMAP_DMA4_BASE + 0x74) 69#define OMAP1_LOGICAL_DMA_CH_COUNT 17
70 70#define OMAP_DMA4_LOGICAL_DMA_CH_COUNT 32 /* REVISIT: Is this 32 + 2? */
71#ifdef CONFIG_ARCH_OMAP1
72
73#define OMAP_LOGICAL_DMA_CH_COUNT 17
74 71
75/* Common channel specific registers for omap1 */ 72/* Common channel specific registers for omap1 */
76#define OMAP_DMA_CSDP_REG(n) __REG16(OMAP_DMA_BASE + 0x40 * (n) + 0x00) 73#define OMAP1_DMA_CH_BASE(n) (0x40 * (n) + 0x00)
77#define OMAP_DMA_CCR_REG(n) __REG16(OMAP_DMA_BASE + 0x40 * (n) + 0x02) 74#define OMAP1_DMA_CSDP(n) (0x40 * (n) + 0x00)
78#define OMAP_DMA_CICR_REG(n) __REG16(OMAP_DMA_BASE + 0x40 * (n) + 0x04) 75#define OMAP1_DMA_CCR(n) (0x40 * (n) + 0x02)
79#define OMAP_DMA_CSR_REG(n) __REG16(OMAP_DMA_BASE + 0x40 * (n) + 0x06) 76#define OMAP1_DMA_CICR(n) (0x40 * (n) + 0x04)
80#define OMAP_DMA_CEN_REG(n) __REG16(OMAP_DMA_BASE + 0x40 * (n) + 0x10) 77#define OMAP1_DMA_CSR(n) (0x40 * (n) + 0x06)
81#define OMAP_DMA_CFN_REG(n) __REG16(OMAP_DMA_BASE + 0x40 * (n) + 0x12) 78#define OMAP1_DMA_CEN(n) (0x40 * (n) + 0x10)
82#define OMAP_DMA_CSFI_REG(n) __REG16(OMAP_DMA_BASE + 0x40 * (n) + 0x14) 79#define OMAP1_DMA_CFN(n) (0x40 * (n) + 0x12)
83#define OMAP_DMA_CSEI_REG(n) __REG16(OMAP_DMA_BASE + 0x40 * (n) + 0x16) 80#define OMAP1_DMA_CSFI(n) (0x40 * (n) + 0x14)
84#define OMAP_DMA_CSAC_REG(n) __REG16(OMAP_DMA_BASE + 0x40 * (n) + 0x18) 81#define OMAP1_DMA_CSEI(n) (0x40 * (n) + 0x16)
85#define OMAP_DMA_CDAC_REG(n) __REG16(OMAP_DMA_BASE + 0x40 * (n) + 0x1a) 82#define OMAP1_DMA_CPC(n) (0x40 * (n) + 0x18) /* 15xx only */
86#define OMAP_DMA_CDEI_REG(n) __REG16(OMAP_DMA_BASE + 0x40 * (n) + 0x1c) 83#define OMAP1_DMA_CSAC(n) (0x40 * (n) + 0x18)
87#define OMAP_DMA_CDFI_REG(n) __REG16(OMAP_DMA_BASE + 0x40 * (n) + 0x1e) 84#define OMAP1_DMA_CDAC(n) (0x40 * (n) + 0x1a)
88#define OMAP_DMA_CLNK_CTRL_REG(n) __REG16(OMAP_DMA_BASE + 0x40 * (n) + 0x28) 85#define OMAP1_DMA_CDEI(n) (0x40 * (n) + 0x1c)
89 86#define OMAP1_DMA_CDFI(n) (0x40 * (n) + 0x1e)
90#else 87#define OMAP1_DMA_CLNK_CTRL(n) (0x40 * (n) + 0x28)
91
92#define OMAP_LOGICAL_DMA_CH_COUNT 32 /* REVISIT: Is this 32 + 2? */
93 88
94/* Common channel specific registers for omap2 */ 89/* Common channel specific registers for omap2 */
95#define OMAP_DMA_CCR_REG(n) __REG32(OMAP_DMA4_BASE + 0x60 * (n) + 0x80) 90#define OMAP_DMA4_CH_BASE(n) (0x60 * (n) + 0x80)
96#define OMAP_DMA_CLNK_CTRL_REG(n) __REG32(OMAP_DMA4_BASE + 0x60 * (n) + 0x84) 91#define OMAP_DMA4_CCR(n) (0x60 * (n) + 0x80)
97#define OMAP_DMA_CICR_REG(n) __REG32(OMAP_DMA4_BASE + 0x60 * (n) + 0x88) 92#define OMAP_DMA4_CLNK_CTRL(n) (0x60 * (n) + 0x84)
98#define OMAP_DMA_CSR_REG(n) __REG32(OMAP_DMA4_BASE + 0x60 * (n) + 0x8c) 93#define OMAP_DMA4_CICR(n) (0x60 * (n) + 0x88)
99#define OMAP_DMA_CSDP_REG(n) __REG32(OMAP_DMA4_BASE + 0x60 * (n) + 0x90) 94#define OMAP_DMA4_CSR(n) (0x60 * (n) + 0x8c)
100#define OMAP_DMA_CEN_REG(n) __REG32(OMAP_DMA4_BASE + 0x60 * (n) + 0x94) 95#define OMAP_DMA4_CSDP(n) (0x60 * (n) + 0x90)
101#define OMAP_DMA_CFN_REG(n) __REG32(OMAP_DMA4_BASE + 0x60 * (n) + 0x98) 96#define OMAP_DMA4_CEN(n) (0x60 * (n) + 0x94)
102#define OMAP_DMA_CSEI_REG(n) __REG32(OMAP_DMA4_BASE + 0x60 * (n) + 0xa4) 97#define OMAP_DMA4_CFN(n) (0x60 * (n) + 0x98)
103#define OMAP_DMA_CSFI_REG(n) __REG32(OMAP_DMA4_BASE + 0x60 * (n) + 0xa8) 98#define OMAP_DMA4_CSEI(n) (0x60 * (n) + 0xa4)
104#define OMAP_DMA_CDEI_REG(n) __REG32(OMAP_DMA4_BASE + 0x60 * (n) + 0xac) 99#define OMAP_DMA4_CSFI(n) (0x60 * (n) + 0xa8)
105#define OMAP_DMA_CDFI_REG(n) __REG32(OMAP_DMA4_BASE + 0x60 * (n) + 0xb0) 100#define OMAP_DMA4_CDEI(n) (0x60 * (n) + 0xac)
106#define OMAP_DMA_CSAC_REG(n) __REG32(OMAP_DMA4_BASE + 0x60 * (n) + 0xb4) 101#define OMAP_DMA4_CDFI(n) (0x60 * (n) + 0xb0)
107#define OMAP_DMA_CDAC_REG(n) __REG32(OMAP_DMA4_BASE + 0x60 * (n) + 0xb8) 102#define OMAP_DMA4_CSAC(n) (0x60 * (n) + 0xb4)
108 103#define OMAP_DMA4_CDAC(n) (0x60 * (n) + 0xb8)
109#endif
110 104
111/* Channel specific registers only on omap1 */ 105/* Channel specific registers only on omap1 */
112#define OMAP1_DMA_CSSA_L_REG(n) __REG16(OMAP_DMA_BASE + 0x40 * (n) + 0x08) 106#define OMAP1_DMA_CSSA_L(n) (0x40 * (n) + 0x08)
113#define OMAP1_DMA_CSSA_U_REG(n) __REG16(OMAP_DMA_BASE + 0x40 * (n) + 0x0a) 107#define OMAP1_DMA_CSSA_U(n) (0x40 * (n) + 0x0a)
114#define OMAP1_DMA_CDSA_L_REG(n) __REG16(OMAP_DMA_BASE + 0x40 * (n) + 0x0c) 108#define OMAP1_DMA_CDSA_L(n) (0x40 * (n) + 0x0c)
115#define OMAP1_DMA_CDSA_U_REG(n) __REG16(OMAP_DMA_BASE + 0x40 * (n) + 0x0e) 109#define OMAP1_DMA_CDSA_U(n) (0x40 * (n) + 0x0e)
116#define OMAP1_DMA_COLOR_L_REG(n) __REG16(OMAP_DMA_BASE + 0x40 * (n) + 0x20) 110#define OMAP1_DMA_COLOR_L(n) (0x40 * (n) + 0x20)
117#define OMAP1_DMA_CCR2_REG(n) __REG16(OMAP_DMA_BASE + 0x40 * (n) + 0x24) 111#define OMAP1_DMA_COLOR_U(n) (0x40 * (n) + 0x22)
118#define OMAP1_DMA_COLOR_U_REG(n) __REG16(OMAP_DMA_BASE + 0x40 * (n) + 0x22) 112#define OMAP1_DMA_CCR2(n) (0x40 * (n) + 0x24)
119#define OMAP1_DMA_LCH_CTRL_REG(n) __REG16(OMAP_DMA_BASE + 0x40 * (n) + 0x2a) 113#define OMAP1_DMA_LCH_CTRL(n) (0x40 * (n) + 0x2a) /* not on 15xx */
114#define OMAP1_DMA_CCEN(n) 0
115#define OMAP1_DMA_CCFN(n) 0
120 116
121/* Channel specific registers only on omap2 */ 117/* Channel specific registers only on omap2 */
122#define OMAP2_DMA_CSSA_REG(n) __REG32(OMAP_DMA4_BASE + 0x60 * (n) + 0x9c) 118#define OMAP_DMA4_CSSA(n) (0x60 * (n) + 0x9c)
123#define OMAP2_DMA_CDSA_REG(n) __REG32(OMAP_DMA4_BASE + 0x60 * (n) + 0xa0) 119#define OMAP_DMA4_CDSA(n) (0x60 * (n) + 0xa0)
124#define OMAP2_DMA_CCEN_REG(n) __REG32(OMAP_DMA4_BASE + 0x60 * (n) + 0xbc) 120#define OMAP_DMA4_CCEN(n) (0x60 * (n) + 0xbc)
125#define OMAP2_DMA_CCFN_REG(n) __REG32(OMAP_DMA4_BASE + 0x60 * (n) + 0xc0) 121#define OMAP_DMA4_CCFN(n) (0x60 * (n) + 0xc0)
126#define OMAP2_DMA_COLOR_REG(n) __REG32(OMAP_DMA4_BASE + 0x60 * (n) + 0xc4) 122#define OMAP_DMA4_COLOR(n) (0x60 * (n) + 0xc4)
123
124/* Dummy defines to keep multi-omap compiles happy */
125#define OMAP1_DMA_REVISION 0
126#define OMAP1_DMA_IRQSTATUS_L0 0
127#define OMAP1_DMA_IRQENABLE_L0 0
128#define OMAP1_DMA_OCP_SYSCONFIG 0
129#define OMAP_DMA4_HW_ID 0
130#define OMAP_DMA4_CAPS_0_L 0
131#define OMAP_DMA4_CAPS_0_U 0
132#define OMAP_DMA4_CAPS_1_L 0
133#define OMAP_DMA4_CAPS_1_U 0
134#define OMAP_DMA4_GSCR 0
135#define OMAP_DMA4_CPC(n) 0
136
137#define OMAP_DMA4_LCH_CTRL(n) 0
138#define OMAP_DMA4_COLOR_L(n) 0
139#define OMAP_DMA4_COLOR_U(n) 0
140#define OMAP_DMA4_CCR2(n) 0
141#define OMAP1_DMA_CSSA(n) 0
142#define OMAP1_DMA_CDSA(n) 0
143#define OMAP_DMA4_CSSA_L(n) 0
144#define OMAP_DMA4_CSSA_U(n) 0
145#define OMAP_DMA4_CDSA_L(n) 0
146#define OMAP_DMA4_CDSA_U(n) 0
127 147
128/*----------------------------------------------------------------------------*/ 148/*----------------------------------------------------------------------------*/
129 149
@@ -196,63 +216,98 @@
196#define OMAP24XX_DMA_GPMC 4 /* S_DMA_3 */ 216#define OMAP24XX_DMA_GPMC 4 /* S_DMA_3 */
197#define OMAP24XX_DMA_GFX 5 /* S_DMA_4 */ 217#define OMAP24XX_DMA_GFX 5 /* S_DMA_4 */
198#define OMAP24XX_DMA_DSS 6 /* S_DMA_5 */ 218#define OMAP24XX_DMA_DSS 6 /* S_DMA_5 */
199#define OMAP24XX_DMA_VLYNQ_TX 7 /* S_DMA_6 */ 219#define OMAP242X_DMA_VLYNQ_TX 7 /* S_DMA_6 */
220#define OMAP24XX_DMA_EXT_DMAREQ2 7 /* S_DMA_6 */
200#define OMAP24XX_DMA_CWT 8 /* S_DMA_7 */ 221#define OMAP24XX_DMA_CWT 8 /* S_DMA_7 */
201#define OMAP24XX_DMA_AES_TX 9 /* S_DMA_8 */ 222#define OMAP24XX_DMA_AES_TX 9 /* S_DMA_8 */
202#define OMAP24XX_DMA_AES_RX 10 /* S_DMA_9 */ 223#define OMAP24XX_DMA_AES_RX 10 /* S_DMA_9 */
203#define OMAP24XX_DMA_DES_TX 11 /* S_DMA_10 */ 224#define OMAP24XX_DMA_DES_TX 11 /* S_DMA_10 */
204#define OMAP24XX_DMA_DES_RX 12 /* S_DMA_11 */ 225#define OMAP24XX_DMA_DES_RX 12 /* S_DMA_11 */
205#define OMAP24XX_DMA_SHA1MD5_RX 13 /* S_DMA_12 */ 226#define OMAP24XX_DMA_SHA1MD5_RX 13 /* S_DMA_12 */
206#define OMAP24XX_DMA_EXT_DMAREQ2 14 /* S_DMA_13 */ 227#define OMAP34XX_DMA_SHA2MD5_RX 13 /* S_DMA_12 */
207#define OMAP24XX_DMA_EXT_DMAREQ3 15 /* S_DMA_14 */ 228#define OMAP242X_DMA_EXT_DMAREQ2 14 /* S_DMA_13 */
208#define OMAP24XX_DMA_EXT_DMAREQ4 16 /* S_DMA_15 */ 229#define OMAP242X_DMA_EXT_DMAREQ3 15 /* S_DMA_14 */
209#define OMAP24XX_DMA_EAC_AC_RD 17 /* S_DMA_16 */ 230#define OMAP242X_DMA_EXT_DMAREQ4 16 /* S_DMA_15 */
210#define OMAP24XX_DMA_EAC_AC_WR 18 /* S_DMA_17 */ 231#define OMAP242X_DMA_EAC_AC_RD 17 /* S_DMA_16 */
211#define OMAP24XX_DMA_EAC_MD_UL_RD 19 /* S_DMA_18 */ 232#define OMAP242X_DMA_EAC_AC_WR 18 /* S_DMA_17 */
212#define OMAP24XX_DMA_EAC_MD_UL_WR 20 /* S_DMA_19 */ 233#define OMAP242X_DMA_EAC_MD_UL_RD 19 /* S_DMA_18 */
213#define OMAP24XX_DMA_EAC_MD_DL_RD 21 /* S_DMA_20 */ 234#define OMAP242X_DMA_EAC_MD_UL_WR 20 /* S_DMA_19 */
214#define OMAP24XX_DMA_EAC_MD_DL_WR 22 /* S_DMA_21 */ 235#define OMAP242X_DMA_EAC_MD_DL_RD 21 /* S_DMA_20 */
215#define OMAP24XX_DMA_EAC_BT_UL_RD 23 /* S_DMA_22 */ 236#define OMAP242X_DMA_EAC_MD_DL_WR 22 /* S_DMA_21 */
216#define OMAP24XX_DMA_EAC_BT_UL_WR 24 /* S_DMA_23 */ 237#define OMAP242X_DMA_EAC_BT_UL_RD 23 /* S_DMA_22 */
217#define OMAP24XX_DMA_EAC_BT_DL_RD 25 /* S_DMA_24 */ 238#define OMAP242X_DMA_EAC_BT_UL_WR 24 /* S_DMA_23 */
218#define OMAP24XX_DMA_EAC_BT_DL_WR 26 /* S_DMA_25 */ 239#define OMAP242X_DMA_EAC_BT_DL_RD 25 /* S_DMA_24 */
240#define OMAP242X_DMA_EAC_BT_DL_WR 26 /* S_DMA_25 */
241#define OMAP243X_DMA_EXT_DMAREQ3 14 /* S_DMA_13 */
242#define OMAP24XX_DMA_SPI3_TX0 15 /* S_DMA_14 */
243#define OMAP24XX_DMA_SPI3_RX0 16 /* S_DMA_15 */
244#define OMAP24XX_DMA_MCBSP3_TX 17 /* S_DMA_16 */
245#define OMAP24XX_DMA_MCBSP3_RX 18 /* S_DMA_17 */
246#define OMAP24XX_DMA_MCBSP4_TX 19 /* S_DMA_18 */
247#define OMAP24XX_DMA_MCBSP4_RX 20 /* S_DMA_19 */
248#define OMAP24XX_DMA_MCBSP5_TX 21 /* S_DMA_20 */
249#define OMAP24XX_DMA_MCBSP5_RX 22 /* S_DMA_21 */
250#define OMAP24XX_DMA_SPI3_TX1 23 /* S_DMA_22 */
251#define OMAP24XX_DMA_SPI3_RX1 24 /* S_DMA_23 */
252#define OMAP243X_DMA_EXT_DMAREQ4 25 /* S_DMA_24 */
253#define OMAP243X_DMA_EXT_DMAREQ5 26 /* S_DMA_25 */
254#define OMAP34XX_DMA_I2C3_TX 25 /* S_DMA_24 */
255#define OMAP34XX_DMA_I2C3_RX 26 /* S_DMA_25 */
219#define OMAP24XX_DMA_I2C1_TX 27 /* S_DMA_26 */ 256#define OMAP24XX_DMA_I2C1_TX 27 /* S_DMA_26 */
220#define OMAP24XX_DMA_I2C1_RX 28 /* S_DMA_27 */ 257#define OMAP24XX_DMA_I2C1_RX 28 /* S_DMA_27 */
221#define OMAP24XX_DMA_I2C2_TX 29 /* S_DMA_28 */ 258#define OMAP24XX_DMA_I2C2_TX 29 /* S_DMA_28 */
222#define OMAP24XX_DMA_I2C2_RX 30 /* S_DMA_29 */ 259#define OMAP24XX_DMA_I2C2_RX 30 /* S_DMA_29 */
223#define OMAP24XX_DMA_MCBSP1_TX 31 /* SDMA_30 */ 260#define OMAP24XX_DMA_MCBSP1_TX 31 /* S_DMA_30 */
224#define OMAP24XX_DMA_MCBSP1_RX 32 /* SDMA_31 */ 261#define OMAP24XX_DMA_MCBSP1_RX 32 /* S_DMA_31 */
225#define OMAP24XX_DMA_MCBSP2_TX 33 /* SDMA_32 */ 262#define OMAP24XX_DMA_MCBSP2_TX 33 /* S_DMA_32 */
226#define OMAP24XX_DMA_MCBSP2_RX 34 /* SDMA_33 */ 263#define OMAP24XX_DMA_MCBSP2_RX 34 /* S_DMA_33 */
227#define OMAP24XX_DMA_SPI1_TX0 35 /* SDMA_34 */ 264#define OMAP24XX_DMA_SPI1_TX0 35 /* S_DMA_34 */
228#define OMAP24XX_DMA_SPI1_RX0 36 /* SDMA_35 */ 265#define OMAP24XX_DMA_SPI1_RX0 36 /* S_DMA_35 */
229#define OMAP24XX_DMA_SPI1_TX1 37 /* SDMA_36 */ 266#define OMAP24XX_DMA_SPI1_TX1 37 /* S_DMA_36 */
230#define OMAP24XX_DMA_SPI1_RX1 38 /* SDMA_37 */ 267#define OMAP24XX_DMA_SPI1_RX1 38 /* S_DMA_37 */
231#define OMAP24XX_DMA_SPI1_TX2 39 /* SDMA_38 */ 268#define OMAP24XX_DMA_SPI1_TX2 39 /* S_DMA_38 */
232#define OMAP24XX_DMA_SPI1_RX2 40 /* SDMA_39 */ 269#define OMAP24XX_DMA_SPI1_RX2 40 /* S_DMA_39 */
233#define OMAP24XX_DMA_SPI1_TX3 41 /* SDMA_40 */ 270#define OMAP24XX_DMA_SPI1_TX3 41 /* S_DMA_40 */
234#define OMAP24XX_DMA_SPI1_RX3 42 /* SDMA_41 */ 271#define OMAP24XX_DMA_SPI1_RX3 42 /* S_DMA_41 */
235#define OMAP24XX_DMA_SPI2_TX0 43 /* SDMA_42 */ 272#define OMAP24XX_DMA_SPI2_TX0 43 /* S_DMA_42 */
236#define OMAP24XX_DMA_SPI2_RX0 44 /* SDMA_43 */ 273#define OMAP24XX_DMA_SPI2_RX0 44 /* S_DMA_43 */
237#define OMAP24XX_DMA_SPI2_TX1 45 /* SDMA_44 */ 274#define OMAP24XX_DMA_SPI2_TX1 45 /* S_DMA_44 */
238#define OMAP24XX_DMA_SPI2_RX1 46 /* SDMA_45 */ 275#define OMAP24XX_DMA_SPI2_RX1 46 /* S_DMA_45 */
239 276#define OMAP24XX_DMA_MMC2_TX 47 /* S_DMA_46 */
240#define OMAP24XX_DMA_UART1_TX 49 /* SDMA_48 */ 277#define OMAP24XX_DMA_MMC2_RX 48 /* S_DMA_47 */
241#define OMAP24XX_DMA_UART1_RX 50 /* SDMA_49 */ 278#define OMAP24XX_DMA_UART1_TX 49 /* S_DMA_48 */
242#define OMAP24XX_DMA_UART2_TX 51 /* SDMA_50 */ 279#define OMAP24XX_DMA_UART1_RX 50 /* S_DMA_49 */
243#define OMAP24XX_DMA_UART2_RX 52 /* SDMA_51 */ 280#define OMAP24XX_DMA_UART2_TX 51 /* S_DMA_50 */
244#define OMAP24XX_DMA_UART3_TX 53 /* SDMA_52 */ 281#define OMAP24XX_DMA_UART2_RX 52 /* S_DMA_51 */
245#define OMAP24XX_DMA_UART3_RX 54 /* SDMA_53 */ 282#define OMAP24XX_DMA_UART3_TX 53 /* S_DMA_52 */
246#define OMAP24XX_DMA_USB_W2FC_TX0 55 /* SDMA_54 */ 283#define OMAP24XX_DMA_UART3_RX 54 /* S_DMA_53 */
247#define OMAP24XX_DMA_USB_W2FC_RX0 56 /* SDMA_55 */ 284#define OMAP24XX_DMA_USB_W2FC_TX0 55 /* S_DMA_54 */
248#define OMAP24XX_DMA_USB_W2FC_TX1 57 /* SDMA_56 */ 285#define OMAP24XX_DMA_USB_W2FC_RX0 56 /* S_DMA_55 */
249#define OMAP24XX_DMA_USB_W2FC_RX1 58 /* SDMA_57 */ 286#define OMAP24XX_DMA_USB_W2FC_TX1 57 /* S_DMA_56 */
250#define OMAP24XX_DMA_USB_W2FC_TX2 59 /* SDMA_58 */ 287#define OMAP24XX_DMA_USB_W2FC_RX1 58 /* S_DMA_57 */
251#define OMAP24XX_DMA_USB_W2FC_RX2 60 /* SDMA_59 */ 288#define OMAP24XX_DMA_USB_W2FC_TX2 59 /* S_DMA_58 */
252#define OMAP24XX_DMA_MMC1_TX 61 /* SDMA_60 */ 289#define OMAP24XX_DMA_USB_W2FC_RX2 60 /* S_DMA_59 */
253#define OMAP24XX_DMA_MMC1_RX 62 /* SDMA_61 */ 290#define OMAP24XX_DMA_MMC1_TX 61 /* S_DMA_60 */
254#define OMAP24XX_DMA_MS 63 /* SDMA_62 */ 291#define OMAP24XX_DMA_MMC1_RX 62 /* S_DMA_61 */
255#define OMAP24XX_DMA_EXT_DMAREQ5 64 /* S_DMA_63 */ 292#define OMAP24XX_DMA_MS 63 /* S_DMA_62 */
293#define OMAP242X_DMA_EXT_DMAREQ5 64 /* S_DMA_63 */
294#define OMAP243X_DMA_EXT_DMAREQ6 64 /* S_DMA_63 */
295#define OMAP34XX_DMA_EXT_DMAREQ3 64 /* S_DMA_63 */
296#define OMAP34XX_DMA_AES2_TX 65 /* S_DMA_64 */
297#define OMAP34XX_DMA_AES2_RX 66 /* S_DMA_65 */
298#define OMAP34XX_DMA_DES2_TX 67 /* S_DMA_66 */
299#define OMAP34XX_DMA_DES2_RX 68 /* S_DMA_67 */
300#define OMAP34XX_DMA_SHA1MD5_RX 69 /* S_DMA_68 */
301#define OMAP34XX_DMA_SPI4_TX0 70 /* S_DMA_69 */
302#define OMAP34XX_DMA_SPI4_RX0 71 /* S_DMA_70 */
303#define OMAP34XX_DSS_DMA0 72 /* S_DMA_71 */
304#define OMAP34XX_DSS_DMA1 73 /* S_DMA_72 */
305#define OMAP34XX_DSS_DMA2 74 /* S_DMA_73 */
306#define OMAP34XX_DSS_DMA3 75 /* S_DMA_74 */
307#define OMAP34XX_DMA_MMC3_TX 77 /* S_DMA_76 */
308#define OMAP34XX_DMA_MMC3_RX 78 /* S_DMA_77 */
309#define OMAP34XX_DMA_USIM_TX 79 /* S_DMA_78 */
310#define OMAP34XX_DMA_USIM_RX 80 /* S_DMA_79 */
256 311
257/*----------------------------------------------------------------------------*/ 312/*----------------------------------------------------------------------------*/
258 313
@@ -358,6 +413,11 @@ enum omap_dma_burst_mode {
358 OMAP_DMA_DATA_BURST_16, 413 OMAP_DMA_DATA_BURST_16,
359}; 414};
360 415
416enum end_type {
417 OMAP_DMA_LITTLE_ENDIAN = 0,
418 OMAP_DMA_BIG_ENDIAN
419};
420
361enum omap_dma_color_mode { 421enum omap_dma_color_mode {
362 OMAP_DMA_COLOR_DIS = 0, 422 OMAP_DMA_COLOR_DIS = 0,
363 OMAP_DMA_CONSTANT_FILL, 423 OMAP_DMA_CONSTANT_FILL,
@@ -370,24 +430,34 @@ enum omap_dma_write_mode {
370 OMAP_DMA_WRITE_LAST_NON_POSTED 430 OMAP_DMA_WRITE_LAST_NON_POSTED
371}; 431};
372 432
433enum omap_dma_channel_mode {
434 OMAP_DMA_LCH_2D = 0,
435 OMAP_DMA_LCH_G,
436 OMAP_DMA_LCH_P,
437 OMAP_DMA_LCH_PD
438};
439
373struct omap_dma_channel_params { 440struct omap_dma_channel_params {
374 int data_type; /* data type 8,16,32 */ 441 int data_type; /* data type 8,16,32 */
375 int elem_count; /* number of elements in a frame */ 442 int elem_count; /* number of elements in a frame */
376 int frame_count; /* number of frames in a element */ 443 int frame_count; /* number of frames in a element */
377 444
378 int src_port; /* Only on OMAP1 REVISIT: Is this needed? */ 445 int src_port; /* Only on OMAP1 REVISIT: Is this needed? */
379 int src_amode; /* constant , post increment, indexed , double indexed */ 446 int src_amode; /* constant, post increment, indexed,
447 double indexed */
380 unsigned long src_start; /* source address : physical */ 448 unsigned long src_start; /* source address : physical */
381 int src_ei; /* source element index */ 449 int src_ei; /* source element index */
382 int src_fi; /* source frame index */ 450 int src_fi; /* source frame index */
383 451
384 int dst_port; /* Only on OMAP1 REVISIT: Is this needed? */ 452 int dst_port; /* Only on OMAP1 REVISIT: Is this needed? */
385 int dst_amode; /* constant , post increment, indexed , double indexed */ 453 int dst_amode; /* constant, post increment, indexed,
454 double indexed */
386 unsigned long dst_start; /* source address : physical */ 455 unsigned long dst_start; /* source address : physical */
387 int dst_ei; /* source element index */ 456 int dst_ei; /* source element index */
388 int dst_fi; /* source frame index */ 457 int dst_fi; /* source frame index */
389 458
390 int trigger; /* trigger attached if the channel is synchronized */ 459 int trigger; /* trigger attached if the channel is
460 synchronized */
391 int sync_mode; /* sycn on element, frame , block or packet */ 461 int sync_mode; /* sycn on element, frame , block or packet */
392 int src_or_dst_synch; /* source synch(1) or destination synch(0) */ 462 int src_or_dst_synch; /* source synch(1) or destination synch(0) */
393 463
@@ -404,8 +474,8 @@ struct omap_dma_channel_params {
404 474
405extern void omap_set_dma_priority(int lch, int dst_port, int priority); 475extern void omap_set_dma_priority(int lch, int dst_port, int priority);
406extern int omap_request_dma(int dev_id, const char *dev_name, 476extern int omap_request_dma(int dev_id, const char *dev_name,
407 void (* callback)(int lch, u16 ch_status, void *data), 477 void (*callback)(int lch, u16 ch_status, void *data),
408 void *data, int *dma_ch); 478 void *data, int *dma_ch);
409extern void omap_enable_dma_irq(int ch, u16 irq_bits); 479extern void omap_enable_dma_irq(int ch, u16 irq_bits);
410extern void omap_disable_dma_irq(int ch, u16 irq_bits); 480extern void omap_disable_dma_irq(int ch, u16 irq_bits);
411extern void omap_free_dma(int ch); 481extern void omap_free_dma(int ch);
@@ -418,6 +488,7 @@ extern void omap_set_dma_transfer_params(int lch, int data_type,
418extern void omap_set_dma_color_mode(int lch, enum omap_dma_color_mode mode, 488extern void omap_set_dma_color_mode(int lch, enum omap_dma_color_mode mode,
419 u32 color); 489 u32 color);
420extern void omap_set_dma_write_mode(int lch, enum omap_dma_write_mode mode); 490extern void omap_set_dma_write_mode(int lch, enum omap_dma_write_mode mode);
491extern void omap_set_dma_channel_mode(int lch, enum omap_dma_channel_mode mode);
421 492
422extern void omap_set_dma_src_params(int lch, int src_port, int src_amode, 493extern void omap_set_dma_src_params(int lch, int src_port, int src_amode,
423 unsigned long src_start, 494 unsigned long src_start,
@@ -436,23 +507,26 @@ extern void omap_set_dma_dest_burst_mode(int lch,
436 enum omap_dma_burst_mode burst_mode); 507 enum omap_dma_burst_mode burst_mode);
437 508
438extern void omap_set_dma_params(int lch, 509extern void omap_set_dma_params(int lch,
439 struct omap_dma_channel_params * params); 510 struct omap_dma_channel_params *params);
440 511
441extern void omap_dma_link_lch (int lch_head, int lch_queue); 512extern void omap_dma_link_lch(int lch_head, int lch_queue);
442extern void omap_dma_unlink_lch (int lch_head, int lch_queue); 513extern void omap_dma_unlink_lch(int lch_head, int lch_queue);
443 514
444extern int omap_set_dma_callback(int lch, 515extern int omap_set_dma_callback(int lch,
445 void (* callback)(int lch, u16 ch_status, void *data), 516 void (*callback)(int lch, u16 ch_status, void *data),
446 void *data); 517 void *data);
447extern dma_addr_t omap_get_dma_src_pos(int lch); 518extern dma_addr_t omap_get_dma_src_pos(int lch);
448extern dma_addr_t omap_get_dma_dst_pos(int lch); 519extern dma_addr_t omap_get_dma_dst_pos(int lch);
449extern int omap_get_dma_src_addr_counter(int lch);
450extern void omap_clear_dma(int lch); 520extern void omap_clear_dma(int lch);
521extern int omap_get_dma_active_status(int lch);
451extern int omap_dma_running(void); 522extern int omap_dma_running(void);
452extern void omap_dma_set_global_params(int arb_rate, int max_fifo_depth, 523extern void omap_dma_set_global_params(int arb_rate, int max_fifo_depth,
453 int tparams); 524 int tparams);
454extern int omap_dma_set_prio_lch(int lch, unsigned char read_prio, 525extern int omap_dma_set_prio_lch(int lch, unsigned char read_prio,
455 unsigned char write_prio); 526 unsigned char write_prio);
527extern void omap_set_dma_dst_endian_type(int lch, enum end_type etype);
528extern void omap_set_dma_src_endian_type(int lch, enum end_type etype);
529extern int omap_get_dma_index(int lch, int *ei, int *fi);
456 530
457/* Chaining APIs */ 531/* Chaining APIs */
458#ifndef CONFIG_ARCH_OMAP1 532#ifndef CONFIG_ARCH_OMAP1
@@ -478,7 +552,7 @@ extern int omap_dma_chain_status(int chain_id);
478#endif 552#endif
479 553
480/* LCD DMA functions */ 554/* LCD DMA functions */
481extern int omap_request_lcd_dma(void (* callback)(u16 status, void *data), 555extern int omap_request_lcd_dma(void (*callback)(u16 status, void *data),
482 void *data); 556 void *data);
483extern void omap_free_lcd_dma(void); 557extern void omap_free_lcd_dma(void);
484extern void omap_setup_lcd_dma(void); 558extern void omap_setup_lcd_dma(void);
diff --git a/include/asm-arm/arch-omap/dmtimer.h b/include/asm-arm/arch-omap/dmtimer.h
index fefb276ed402..02b29e8437ae 100644
--- a/include/asm-arm/arch-omap/dmtimer.h
+++ b/include/asm-arm/arch-omap/dmtimer.h
@@ -66,6 +66,7 @@ void omap_dm_timer_stop(struct omap_dm_timer *timer);
66 66
67void omap_dm_timer_set_source(struct omap_dm_timer *timer, int source); 67void omap_dm_timer_set_source(struct omap_dm_timer *timer, int source);
68void omap_dm_timer_set_load(struct omap_dm_timer *timer, int autoreload, unsigned int value); 68void omap_dm_timer_set_load(struct omap_dm_timer *timer, int autoreload, unsigned int value);
69void omap_dm_timer_set_load_start(struct omap_dm_timer *timer, int autoreload, unsigned int value);
69void omap_dm_timer_set_match(struct omap_dm_timer *timer, int enable, unsigned int match); 70void omap_dm_timer_set_match(struct omap_dm_timer *timer, int enable, unsigned int match);
70void omap_dm_timer_set_pwm(struct omap_dm_timer *timer, int def_on, int toggle, int trigger); 71void omap_dm_timer_set_pwm(struct omap_dm_timer *timer, int def_on, int toggle, int trigger);
71void omap_dm_timer_set_prescaler(struct omap_dm_timer *timer, int prescaler); 72void omap_dm_timer_set_prescaler(struct omap_dm_timer *timer, int prescaler);
diff --git a/include/asm-arm/arch-omap/fpga.h b/include/asm-arm/arch-omap/fpga.h
index 6a883e0bdbb8..f420881d2a3b 100644
--- a/include/asm-arm/arch-omap/fpga.h
+++ b/include/asm-arm/arch-omap/fpga.h
@@ -169,30 +169,29 @@ struct h2p2_dbg_fpga {
169#define OMAP1510_INT_FPGA (IH_GPIO_BASE + 13) 169#define OMAP1510_INT_FPGA (IH_GPIO_BASE + 13)
170 170
171/* IRQ Numbers for interrupts muxed through the FPGA */ 171/* IRQ Numbers for interrupts muxed through the FPGA */
172#define OMAP1510_IH_FPGA_BASE IH_BOARD_BASE 172#define OMAP1510_INT_FPGA_ATN (OMAP_FPGA_IRQ_BASE + 0)
173#define OMAP1510_INT_FPGA_ATN (OMAP1510_IH_FPGA_BASE + 0) 173#define OMAP1510_INT_FPGA_ACK (OMAP_FPGA_IRQ_BASE + 1)
174#define OMAP1510_INT_FPGA_ACK (OMAP1510_IH_FPGA_BASE + 1) 174#define OMAP1510_INT_FPGA2 (OMAP_FPGA_IRQ_BASE + 2)
175#define OMAP1510_INT_FPGA2 (OMAP1510_IH_FPGA_BASE + 2) 175#define OMAP1510_INT_FPGA3 (OMAP_FPGA_IRQ_BASE + 3)
176#define OMAP1510_INT_FPGA3 (OMAP1510_IH_FPGA_BASE + 3) 176#define OMAP1510_INT_FPGA4 (OMAP_FPGA_IRQ_BASE + 4)
177#define OMAP1510_INT_FPGA4 (OMAP1510_IH_FPGA_BASE + 4) 177#define OMAP1510_INT_FPGA5 (OMAP_FPGA_IRQ_BASE + 5)
178#define OMAP1510_INT_FPGA5 (OMAP1510_IH_FPGA_BASE + 5) 178#define OMAP1510_INT_FPGA6 (OMAP_FPGA_IRQ_BASE + 6)
179#define OMAP1510_INT_FPGA6 (OMAP1510_IH_FPGA_BASE + 6) 179#define OMAP1510_INT_FPGA7 (OMAP_FPGA_IRQ_BASE + 7)
180#define OMAP1510_INT_FPGA7 (OMAP1510_IH_FPGA_BASE + 7) 180#define OMAP1510_INT_FPGA8 (OMAP_FPGA_IRQ_BASE + 8)
181#define OMAP1510_INT_FPGA8 (OMAP1510_IH_FPGA_BASE + 8) 181#define OMAP1510_INT_FPGA9 (OMAP_FPGA_IRQ_BASE + 9)
182#define OMAP1510_INT_FPGA9 (OMAP1510_IH_FPGA_BASE + 9) 182#define OMAP1510_INT_FPGA10 (OMAP_FPGA_IRQ_BASE + 10)
183#define OMAP1510_INT_FPGA10 (OMAP1510_IH_FPGA_BASE + 10) 183#define OMAP1510_INT_FPGA11 (OMAP_FPGA_IRQ_BASE + 11)
184#define OMAP1510_INT_FPGA11 (OMAP1510_IH_FPGA_BASE + 11) 184#define OMAP1510_INT_FPGA12 (OMAP_FPGA_IRQ_BASE + 12)
185#define OMAP1510_INT_FPGA12 (OMAP1510_IH_FPGA_BASE + 12) 185#define OMAP1510_INT_ETHER (OMAP_FPGA_IRQ_BASE + 13)
186#define OMAP1510_INT_ETHER (OMAP1510_IH_FPGA_BASE + 13) 186#define OMAP1510_INT_FPGAUART1 (OMAP_FPGA_IRQ_BASE + 14)
187#define OMAP1510_INT_FPGAUART1 (OMAP1510_IH_FPGA_BASE + 14) 187#define OMAP1510_INT_FPGAUART2 (OMAP_FPGA_IRQ_BASE + 15)
188#define OMAP1510_INT_FPGAUART2 (OMAP1510_IH_FPGA_BASE + 15) 188#define OMAP1510_INT_FPGA_TS (OMAP_FPGA_IRQ_BASE + 16)
189#define OMAP1510_INT_FPGA_TS (OMAP1510_IH_FPGA_BASE + 16) 189#define OMAP1510_INT_FPGA17 (OMAP_FPGA_IRQ_BASE + 17)
190#define OMAP1510_INT_FPGA17 (OMAP1510_IH_FPGA_BASE + 17) 190#define OMAP1510_INT_FPGA_CAM (OMAP_FPGA_IRQ_BASE + 18)
191#define OMAP1510_INT_FPGA_CAM (OMAP1510_IH_FPGA_BASE + 18) 191#define OMAP1510_INT_FPGA_RTC_A (OMAP_FPGA_IRQ_BASE + 19)
192#define OMAP1510_INT_FPGA_RTC_A (OMAP1510_IH_FPGA_BASE + 19) 192#define OMAP1510_INT_FPGA_RTC_B (OMAP_FPGA_IRQ_BASE + 20)
193#define OMAP1510_INT_FPGA_RTC_B (OMAP1510_IH_FPGA_BASE + 20) 193#define OMAP1510_INT_FPGA_CD (OMAP_FPGA_IRQ_BASE + 21)
194#define OMAP1510_INT_FPGA_CD (OMAP1510_IH_FPGA_BASE + 21) 194#define OMAP1510_INT_FPGA22 (OMAP_FPGA_IRQ_BASE + 22)
195#define OMAP1510_INT_FPGA22 (OMAP1510_IH_FPGA_BASE + 22) 195#define OMAP1510_INT_FPGA23 (OMAP_FPGA_IRQ_BASE + 23)
196#define OMAP1510_INT_FPGA23 (OMAP1510_IH_FPGA_BASE + 23)
197 196
198#endif 197#endif
diff --git a/include/asm-arm/arch-omap/hardware.h b/include/asm-arm/arch-omap/hardware.h
index 91d85b3417b7..45fdfccbd5d4 100644
--- a/include/asm-arm/arch-omap/hardware.h
+++ b/include/asm-arm/arch-omap/hardware.h
@@ -284,6 +284,7 @@
284#include "omap1510.h" 284#include "omap1510.h"
285#include "omap24xx.h" 285#include "omap24xx.h"
286#include "omap16xx.h" 286#include "omap16xx.h"
287#include "omap34xx.h"
287 288
288#ifndef __ASSEMBLER__ 289#ifndef __ASSEMBLER__
289 290
diff --git a/include/asm-arm/arch-omap/io.h b/include/asm-arm/arch-omap/io.h
index 160578e1f557..0b13557fd30b 100644
--- a/include/asm-arm/arch-omap/io.h
+++ b/include/asm-arm/arch-omap/io.h
@@ -60,6 +60,7 @@
60#define IO_SIZE 0x40000 60#define IO_SIZE 0x40000
61#define IO_VIRT (IO_PHYS - IO_OFFSET) 61#define IO_VIRT (IO_PHYS - IO_OFFSET)
62#define IO_ADDRESS(pa) ((pa) - IO_OFFSET) 62#define IO_ADDRESS(pa) ((pa) - IO_OFFSET)
63#define OMAP1_IO_ADDRESS(pa) ((pa) - IO_OFFSET)
63#define io_p2v(pa) ((pa) - IO_OFFSET) 64#define io_p2v(pa) ((pa) - IO_OFFSET)
64#define io_v2p(va) ((va) + IO_OFFSET) 65#define io_v2p(va) ((va) + IO_OFFSET)
65 66
@@ -91,6 +92,7 @@
91 92
92#define IO_OFFSET 0x90000000 93#define IO_OFFSET 0x90000000
93#define IO_ADDRESS(pa) ((pa) + IO_OFFSET) /* Works for L3 and L4 */ 94#define IO_ADDRESS(pa) ((pa) + IO_OFFSET) /* Works for L3 and L4 */
95#define OMAP2_IO_ADDRESS(pa) ((pa) + IO_OFFSET) /* Works for L3 and L4 */
94#define io_p2v(pa) ((pa) + IO_OFFSET) /* Works for L3 and L4 */ 96#define io_p2v(pa) ((pa) + IO_OFFSET) /* Works for L3 and L4 */
95#define io_v2p(va) ((va) - IO_OFFSET) /* Works for L3 and L4 */ 97#define io_v2p(va) ((va) - IO_OFFSET) /* Works for L3 and L4 */
96 98
@@ -148,6 +150,7 @@
148 150
149#define IO_OFFSET 0x90000000 151#define IO_OFFSET 0x90000000
150#define IO_ADDRESS(pa) ((pa) + IO_OFFSET)/* Works for L3 and L4 */ 152#define IO_ADDRESS(pa) ((pa) + IO_OFFSET)/* Works for L3 and L4 */
153#define OMAP2_IO_ADDRESS(pa) ((pa) + IO_OFFSET)/* Works for L3 and L4 */
151#define io_p2v(pa) ((pa) + IO_OFFSET)/* Works for L3 and L4 */ 154#define io_p2v(pa) ((pa) + IO_OFFSET)/* Works for L3 and L4 */
152#define io_v2p(va) ((va) - IO_OFFSET)/* Works for L3 and L4 */ 155#define io_v2p(va) ((va) - IO_OFFSET)/* Works for L3 and L4 */
153 156
@@ -183,35 +186,12 @@
183#define omap_writew(v,a) (*(volatile unsigned short *)IO_ADDRESS(a) = (v)) 186#define omap_writew(v,a) (*(volatile unsigned short *)IO_ADDRESS(a) = (v))
184#define omap_writel(v,a) (*(volatile unsigned int *)IO_ADDRESS(a) = (v)) 187#define omap_writel(v,a) (*(volatile unsigned int *)IO_ADDRESS(a) = (v))
185 188
186/* 16 bit uses LDRH/STRH, base +/- offset_8 */
187typedef struct { volatile u16 offset[256]; } __regbase16;
188#define __REGV16(vaddr) ((__regbase16 *)((vaddr)&~0xff)) \
189 ->offset[((vaddr)&0xff)>>1]
190#define __REG16(paddr) __REGV16(io_p2v(paddr))
191
192/* 8/32 bit uses LDR/STR, base +/- offset_12 */
193typedef struct { volatile u8 offset[4096]; } __regbase8;
194#define __REGV8(vaddr) ((__regbase8 *)((vaddr)&~4095)) \
195 ->offset[((vaddr)&4095)>>0]
196#define __REG8(paddr) __REGV8(io_p2v(paddr))
197
198typedef struct { volatile u32 offset[4096]; } __regbase32;
199#define __REGV32(vaddr) ((__regbase32 *)((vaddr)&~4095)) \
200 ->offset[((vaddr)&4095)>>2]
201#define __REG32(paddr) __REGV32(io_p2v(paddr))
202
203extern void omap1_map_common_io(void); 189extern void omap1_map_common_io(void);
204extern void omap1_init_common_hw(void); 190extern void omap1_init_common_hw(void);
205 191
206extern void omap2_map_common_io(void); 192extern void omap2_map_common_io(void);
207extern void omap2_init_common_hw(void); 193extern void omap2_init_common_hw(void);
208 194
209#else
210
211#define __REG8(paddr) io_p2v(paddr)
212#define __REG16(paddr) io_p2v(paddr)
213#define __REG32(paddr) io_p2v(paddr)
214
215#endif 195#endif
216 196
217#endif 197#endif
diff --git a/include/asm-arm/arch-omap/irqs.h b/include/asm-arm/arch-omap/irqs.h
index 87973654e625..7464c694859b 100644
--- a/include/asm-arm/arch-omap/irqs.h
+++ b/include/asm-arm/arch-omap/irqs.h
@@ -285,7 +285,41 @@
285#define OMAP_MAX_GPIO_LINES 192 285#define OMAP_MAX_GPIO_LINES 192
286#define IH_GPIO_BASE (128 + IH2_BASE) 286#define IH_GPIO_BASE (128 + IH2_BASE)
287#define IH_MPUIO_BASE (OMAP_MAX_GPIO_LINES + IH_GPIO_BASE) 287#define IH_MPUIO_BASE (OMAP_MAX_GPIO_LINES + IH_GPIO_BASE)
288#define IH_BOARD_BASE (16 + IH_MPUIO_BASE) 288#define OMAP_IRQ_END (IH_MPUIO_BASE + 16)
289
290/* External FPGA handles interrupts on Innovator boards */
291#define OMAP_FPGA_IRQ_BASE (OMAP_IRQ_END)
292#ifdef CONFIG_MACH_OMAP_INNOVATOR
293#define OMAP_FPGA_NR_IRQS 24
294#else
295#define OMAP_FPGA_NR_IRQS 0
296#endif
297#define OMAP_FPGA_IRQ_END (OMAP_FPGA_IRQ_BASE + OMAP_FPGA_NR_IRQS)
298
299/* External TWL4030 can handle interrupts on 2430 and 34xx boards */
300#define TWL4030_IRQ_BASE (OMAP_FPGA_IRQ_END)
301#ifdef CONFIG_TWL4030_CORE
302#define TWL4030_BASE_NR_IRQS 8
303#define TWL4030_PWR_NR_IRQS 8
304#else
305#define TWL4030_BASE_NR_IRQS 0
306#define TWL4030_PWR_NR_IRQS 0
307#endif
308#define TWL4030_IRQ_END (TWL4030_IRQ_BASE + TWL4030_BASE_NR_IRQS)
309#define TWL4030_PWR_IRQ_BASE TWL4030_IRQ_END
310#define TWL4030_PWR_IRQ_END (TWL4030_PWR_IRQ_BASE + TWL4030_PWR_NR_IRQS)
311
312/* External TWL4030 gpio interrupts are optional */
313#define TWL4030_GPIO_IRQ_BASE TWL4030_PWR_IRQ_END
314#ifdef CONFIG_TWL4030_GPIO
315#define TWL4030_GPIO_NR_IRQS 18
316#else
317#define TWL4030_GPIO_NR_IRQS 0
318#endif
319#define TWL4030_GPIO_IRQ_END (TWL4030_GPIO_IRQ_BASE + TWL4030_GPIO_NR_IRQS)
320
321/* Total number of interrupts depends on the enabled blocks above */
322#define NR_IRQS TWL4030_GPIO_IRQ_END
289 323
290#define OMAP_IRQ_BIT(irq) (1 << ((irq) % 32)) 324#define OMAP_IRQ_BIT(irq) (1 << ((irq) % 32))
291 325
@@ -293,14 +327,6 @@
293extern void omap_init_irq(void); 327extern void omap_init_irq(void);
294#endif 328#endif
295 329
296/*
297 * The definition of NR_IRQS is in board-specific header file, which is
298 * included via hardware.h
299 */
300#include <asm/hardware.h> 330#include <asm/hardware.h>
301 331
302#ifndef NR_IRQS
303#define NR_IRQS IH_BOARD_BASE
304#endif
305
306#endif 332#endif
diff --git a/include/asm-arm/arch-omap/mcbsp.h b/include/asm-arm/arch-omap/mcbsp.h
index c7a0cc1c4e93..26c78f67dc8e 100644
--- a/include/asm-arm/arch-omap/mcbsp.h
+++ b/include/asm-arm/arch-omap/mcbsp.h
@@ -24,7 +24,11 @@
24#ifndef __ASM_ARCH_OMAP_MCBSP_H 24#ifndef __ASM_ARCH_OMAP_MCBSP_H
25#define __ASM_ARCH_OMAP_MCBSP_H 25#define __ASM_ARCH_OMAP_MCBSP_H
26 26
27#include <linux/completion.h>
28#include <linux/spinlock.h>
29
27#include <asm/hardware.h> 30#include <asm/hardware.h>
31#include <asm/arch/clock.h>
28 32
29#define OMAP730_MCBSP1_BASE 0xfffb1000 33#define OMAP730_MCBSP1_BASE 0xfffb1000
30#define OMAP730_MCBSP2_BASE 0xfffb1800 34#define OMAP730_MCBSP2_BASE 0xfffb1800
@@ -40,6 +44,9 @@
40#define OMAP24XX_MCBSP1_BASE 0x48074000 44#define OMAP24XX_MCBSP1_BASE 0x48074000
41#define OMAP24XX_MCBSP2_BASE 0x48076000 45#define OMAP24XX_MCBSP2_BASE 0x48076000
42 46
47#define OMAP34XX_MCBSP1_BASE 0x48074000
48#define OMAP34XX_MCBSP2_BASE 0x49022000
49
43#if defined(CONFIG_ARCH_OMAP15XX) || defined(CONFIG_ARCH_OMAP16XX) || defined(CONFIG_ARCH_OMAP730) 50#if defined(CONFIG_ARCH_OMAP15XX) || defined(CONFIG_ARCH_OMAP16XX) || defined(CONFIG_ARCH_OMAP730)
44 51
45#define OMAP_MCBSP_REG_DRR2 0x00 52#define OMAP_MCBSP_REG_DRR2 0x00
@@ -74,7 +81,8 @@
74#define OMAP_MCBSP_REG_XCERG 0x3A 81#define OMAP_MCBSP_REG_XCERG 0x3A
75#define OMAP_MCBSP_REG_XCERH 0x3C 82#define OMAP_MCBSP_REG_XCERH 0x3C
76 83
77#define OMAP_MAX_MCBSP_COUNT 3 84#define OMAP_MAX_MCBSP_COUNT 3
85#define MAX_MCBSP_CLOCKS 3
78 86
79#define AUDIO_MCBSP_DATAWRITE (OMAP1510_MCBSP1_BASE + OMAP_MCBSP_REG_DXR1) 87#define AUDIO_MCBSP_DATAWRITE (OMAP1510_MCBSP1_BASE + OMAP_MCBSP_REG_DXR1)
80#define AUDIO_MCBSP_DATAREAD (OMAP1510_MCBSP1_BASE + OMAP_MCBSP_REG_DRR1) 88#define AUDIO_MCBSP_DATAREAD (OMAP1510_MCBSP1_BASE + OMAP_MCBSP_REG_DRR1)
@@ -117,7 +125,8 @@
117#define OMAP_MCBSP_REG_XCERG 0x74 125#define OMAP_MCBSP_REG_XCERG 0x74
118#define OMAP_MCBSP_REG_XCERH 0x78 126#define OMAP_MCBSP_REG_XCERH 0x78
119 127
120#define OMAP_MAX_MCBSP_COUNT 2 128#define OMAP_MAX_MCBSP_COUNT 2
129#define MAX_MCBSP_CLOCKS 2
121 130
122#define AUDIO_MCBSP_DATAWRITE (OMAP24XX_MCBSP2_BASE + OMAP_MCBSP_REG_DXR1) 131#define AUDIO_MCBSP_DATAWRITE (OMAP24XX_MCBSP2_BASE + OMAP_MCBSP_REG_DXR1)
123#define AUDIO_MCBSP_DATAREAD (OMAP24XX_MCBSP2_BASE + OMAP_MCBSP_REG_DRR1) 132#define AUDIO_MCBSP_DATAREAD (OMAP24XX_MCBSP2_BASE + OMAP_MCBSP_REG_DRR1)
@@ -298,6 +307,55 @@ struct omap_mcbsp_spi_cfg {
298 omap_mcbsp_word_length word_length; 307 omap_mcbsp_word_length word_length;
299}; 308};
300 309
310/* Platform specific configuration */
311struct omap_mcbsp_ops {
312 void (*request)(unsigned int);
313 void (*free)(unsigned int);
314 int (*check)(unsigned int);
315};
316
317struct omap_mcbsp_platform_data {
318 u32 virt_base;
319 u8 dma_rx_sync, dma_tx_sync;
320 u16 rx_irq, tx_irq;
321 struct omap_mcbsp_ops *ops;
322 char const *clk_name;
323};
324
325struct omap_mcbsp {
326 struct device *dev;
327 u32 io_base;
328 u8 id;
329 u8 free;
330 omap_mcbsp_word_length rx_word_length;
331 omap_mcbsp_word_length tx_word_length;
332
333 omap_mcbsp_io_type_t io_type; /* IRQ or poll */
334 /* IRQ based TX/RX */
335 int rx_irq;
336 int tx_irq;
337
338 /* DMA stuff */
339 u8 dma_rx_sync;
340 short dma_rx_lch;
341 u8 dma_tx_sync;
342 short dma_tx_lch;
343
344 /* Completion queues */
345 struct completion tx_irq_completion;
346 struct completion rx_irq_completion;
347 struct completion tx_dma_completion;
348 struct completion rx_dma_completion;
349
350 /* Protect the field .free, while checking if the mcbsp is in use */
351 spinlock_t lock;
352 struct omap_mcbsp_platform_data *pdata;
353 struct clk *clk;
354};
355
356int omap_mcbsp_init(void);
357void omap_mcbsp_register_board_cfg(struct omap_mcbsp_platform_data *config,
358 int size);
301void omap_mcbsp_config(unsigned int id, const struct omap_mcbsp_reg_cfg * config); 359void omap_mcbsp_config(unsigned int id, const struct omap_mcbsp_reg_cfg * config);
302int omap_mcbsp_request(unsigned int id); 360int omap_mcbsp_request(unsigned int id);
303void omap_mcbsp_free(unsigned int id); 361void omap_mcbsp_free(unsigned int id);
diff --git a/include/asm-arm/arch-omap/omap34xx.h b/include/asm-arm/arch-omap/omap34xx.h
new file mode 100644
index 000000000000..aa30c6d10abd
--- /dev/null
+++ b/include/asm-arm/arch-omap/omap34xx.h
@@ -0,0 +1,72 @@
1/*
2 * include/asm-arm/arch-omap/omap34xx.h
3 *
4 * This file contains the processor specific definitions of the TI OMAP34XX.
5 *
6 * Copyright (C) 2007 Texas Instruments.
7 * Copyright (C) 2007 Nokia Corporation.
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 */
23
24#ifndef __ASM_ARCH_OMAP34XX_H
25#define __ASM_ARCH_OMAP34XX_H
26
27/*
28 * Please place only base defines here and put the rest in device
29 * specific headers.
30 */
31
32#define L4_34XX_BASE 0x48000000
33#define L4_WK_34XX_BASE 0x48300000
34#define L4_WK_OMAP_BASE L4_WK_34XX_BASE
35#define L4_PER_34XX_BASE 0x49000000
36#define L4_PER_OMAP_BASE L4_PER_34XX_BASE
37#define L4_EMU_34XX_BASE 0x54000000
38#define L4_EMU_BASE L4_EMU_34XX_BASE
39#define L3_34XX_BASE 0x68000000
40#define L3_OMAP_BASE L3_34XX_BASE
41
42#define OMAP3430_32KSYNCT_BASE 0x48320000
43#define OMAP3430_CM_BASE 0x48004800
44#define OMAP3430_PRM_BASE 0x48306800
45#define OMAP343X_SMS_BASE 0x6C000000
46#define OMAP343X_SDRC_BASE 0x6D000000
47#define OMAP34XX_GPMC_BASE 0x6E000000
48#define OMAP343X_SCM_BASE 0x48002000
49#define OMAP343X_CTRL_BASE OMAP343X_SCM_BASE
50
51#define OMAP34XX_IC_BASE 0x48200000
52#define OMAP34XX_IVA_INTC_BASE 0x40000000
53#define OMAP34XX_HSUSB_OTG_BASE (L4_34XX_BASE + 0xAB000)
54#define OMAP34XX_HSUSB_HOST_BASE (L4_34XX_BASE + 0x64000)
55#define OMAP34XX_USBTLL_BASE (L4_34XX_BASE + 0x62000)
56
57
58#if defined(CONFIG_ARCH_OMAP3430)
59
60#define OMAP2_32KSYNCT_BASE OMAP3430_32KSYNCT_BASE
61#define OMAP2_CM_BASE OMAP3430_CM_BASE
62#define OMAP2_PRM_BASE OMAP3430_PRM_BASE
63#define OMAP2_VA_IC_BASE IO_ADDRESS(OMAP34XX_IC_BASE)
64
65#endif
66
67#define OMAP34XX_DSP_BASE 0x58000000
68#define OMAP34XX_DSP_MEM_BASE (OMAP34XX_DSP_BASE + 0x0)
69#define OMAP34XX_DSP_IPI_BASE (OMAP34XX_DSP_BASE + 0x1000000)
70#define OMAP34XX_DSP_MMU_BASE (OMAP34XX_DSP_BASE + 0x2000000)
71#endif /* __ASM_ARCH_OMAP34XX_H */
72
diff --git a/include/asm-arm/arch-omap/sram.h b/include/asm-arm/arch-omap/sram.h
index bb9bb3fd532f..be59f4a9828b 100644
--- a/include/asm-arm/arch-omap/sram.h
+++ b/include/asm-arm/arch-omap/sram.h
@@ -11,6 +11,7 @@
11#ifndef __ARCH_ARM_OMAP_SRAM_H 11#ifndef __ARCH_ARM_OMAP_SRAM_H
12#define __ARCH_ARM_OMAP_SRAM_H 12#define __ARCH_ARM_OMAP_SRAM_H
13 13
14extern int __init omap_sram_init(void);
14extern void * omap_sram_push(void * start, unsigned long size); 15extern void * omap_sram_push(void * start, unsigned long size);
15extern void omap_sram_reprogram_clock(u32 dpllctl, u32 ckctl); 16extern void omap_sram_reprogram_clock(u32 dpllctl, u32 ckctl);
16 17
@@ -21,17 +22,35 @@ extern void omap2_sram_reprogram_sdrc(u32 perf_level, u32 dll_val,
21extern u32 omap2_set_prcm(u32 dpll_ctrl_val, u32 sdrc_rfr_val, int bypass); 22extern u32 omap2_set_prcm(u32 dpll_ctrl_val, u32 sdrc_rfr_val, int bypass);
22 23
23/* Do not use these */ 24/* Do not use these */
24extern void sram_reprogram_clock(u32 ckctl, u32 dpllctl); 25extern void omap1_sram_reprogram_clock(u32 ckctl, u32 dpllctl);
25extern unsigned long sram_reprogram_clock_sz; 26extern unsigned long omap1_sram_reprogram_clock_sz;
26 27
27extern void sram_ddr_init(u32 *slow_dll_ctrl, u32 fast_dll_ctrl, 28extern void omap24xx_sram_reprogram_clock(u32 ckctl, u32 dpllctl);
28 u32 base_cs, u32 force_unlock); 29extern unsigned long omap24xx_sram_reprogram_clock_sz;
29extern unsigned long sram_ddr_init_sz;
30 30
31extern u32 sram_set_prcm(u32 dpll_ctrl_val, u32 sdrc_rfr_val, int bypass); 31extern void omap242x_sram_ddr_init(u32 *slow_dll_ctrl, u32 fast_dll_ctrl,
32extern unsigned long sram_set_prcm_sz; 32 u32 base_cs, u32 force_unlock);
33extern unsigned long omap242x_sram_ddr_init_sz;
33 34
34extern void sram_reprogram_sdrc(u32 perf_level, u32 dll_val, u32 mem_type); 35extern u32 omap242x_sram_set_prcm(u32 dpll_ctrl_val, u32 sdrc_rfr_val,
35extern unsigned long sram_reprogram_sdrc_sz; 36 int bypass);
37extern unsigned long omap242x_sram_set_prcm_sz;
38
39extern void omap242x_sram_reprogram_sdrc(u32 perf_level, u32 dll_val,
40 u32 mem_type);
41extern unsigned long omap242x_sram_reprogram_sdrc_sz;
42
43
44extern void omap243x_sram_ddr_init(u32 *slow_dll_ctrl, u32 fast_dll_ctrl,
45 u32 base_cs, u32 force_unlock);
46extern unsigned long omap243x_sram_ddr_init_sz;
47
48extern u32 omap243x_sram_set_prcm(u32 dpll_ctrl_val, u32 sdrc_rfr_val,
49 int bypass);
50extern unsigned long omap243x_sram_set_prcm_sz;
51
52extern void omap243x_sram_reprogram_sdrc(u32 perf_level, u32 dll_val,
53 u32 mem_type);
54extern unsigned long omap243x_sram_reprogram_sdrc_sz;
36 55
37#endif 56#endif
diff --git a/include/asm-arm/arch-omap/tc.h b/include/asm-arm/arch-omap/tc.h
index 8ded218cbea5..65a9c82d3bf7 100644
--- a/include/asm-arm/arch-omap/tc.h
+++ b/include/asm-arm/arch-omap/tc.h
@@ -75,16 +75,14 @@
75#ifndef __ASSEMBLER__ 75#ifndef __ASSEMBLER__
76 76
77/* EMIF Slow Interface Configuration Register */ 77/* EMIF Slow Interface Configuration Register */
78#define OMAP_EMIFS_CONFIG_REG __REG32(EMIFS_CONFIG)
79
80#define OMAP_EMIFS_CONFIG_FR (1 << 4) 78#define OMAP_EMIFS_CONFIG_FR (1 << 4)
81#define OMAP_EMIFS_CONFIG_PDE (1 << 3) 79#define OMAP_EMIFS_CONFIG_PDE (1 << 3)
82#define OMAP_EMIFS_CONFIG_PWD_EN (1 << 2) 80#define OMAP_EMIFS_CONFIG_PWD_EN (1 << 2)
83#define OMAP_EMIFS_CONFIG_BM (1 << 1) 81#define OMAP_EMIFS_CONFIG_BM (1 << 1)
84#define OMAP_EMIFS_CONFIG_WP (1 << 0) 82#define OMAP_EMIFS_CONFIG_WP (1 << 0)
85 83
86#define EMIFS_CCS(n) __REG32(EMIFS_CS0_CONFIG + (4 * (n))) 84#define EMIFS_CCS(n) (EMIFS_CS0_CONFIG + (4 * (n)))
87#define EMIFS_ACS(n) __REG32(EMIFS_ACS0 + (4 * (n))) 85#define EMIFS_ACS(n) (EMIFS_ACS0 + (4 * (n)))
88 86
89/* Almost all documentation for chip and board memory maps assumes 87/* Almost all documentation for chip and board memory maps assumes
90 * BM is clear. Most devel boards have a switch to control booting 88 * BM is clear. Most devel boards have a switch to control booting
@@ -93,13 +91,13 @@
93 */ 91 */
94static inline u32 omap_cs0_phys(void) 92static inline u32 omap_cs0_phys(void)
95{ 93{
96 return (OMAP_EMIFS_CONFIG_REG & OMAP_EMIFS_CONFIG_BM) 94 return (omap_readl(EMIFS_CONFIG) & OMAP_EMIFS_CONFIG_BM)
97 ? OMAP_CS3_PHYS : 0; 95 ? OMAP_CS3_PHYS : 0;
98} 96}
99 97
100static inline u32 omap_cs3_phys(void) 98static inline u32 omap_cs3_phys(void)
101{ 99{
102 return (OMAP_EMIFS_CONFIG_REG & OMAP_EMIFS_CONFIG_BM) 100 return (omap_readl(EMIFS_CONFIG) & OMAP_EMIFS_CONFIG_BM)
103 ? 0 : OMAP_CS3_PHYS; 101 ? 0 : OMAP_CS3_PHYS;
104} 102}
105 103
diff --git a/include/asm-arm/arch-omap/usb.h b/include/asm-arm/arch-omap/usb.h
index 2147d18aaeae..ddf1861e6df9 100644
--- a/include/asm-arm/arch-omap/usb.h
+++ b/include/asm-arm/arch-omap/usb.h
@@ -34,11 +34,8 @@
34/* 34/*
35 * OTG and transceiver registers, for OMAPs starting with ARM926 35 * OTG and transceiver registers, for OMAPs starting with ARM926
36 */ 36 */
37#define OTG_REG32(offset) __REG32(OTG_BASE + (offset)) 37#define OTG_REV (OTG_BASE + 0x00)
38#define OTG_REG16(offset) __REG16(OTG_BASE + (offset)) 38#define OTG_SYSCON_1 (OTG_BASE + 0x04)
39
40#define OTG_REV_REG OTG_REG32(0x00)
41#define OTG_SYSCON_1_REG OTG_REG32(0x04)
42# define USB2_TRX_MODE(w) (((w)>>24)&0x07) 39# define USB2_TRX_MODE(w) (((w)>>24)&0x07)
43# define USB1_TRX_MODE(w) (((w)>>20)&0x07) 40# define USB1_TRX_MODE(w) (((w)>>20)&0x07)
44# define USB0_TRX_MODE(w) (((w)>>16)&0x07) 41# define USB0_TRX_MODE(w) (((w)>>16)&0x07)
@@ -47,7 +44,7 @@
47# define DEV_IDLE_EN (1 << 13) 44# define DEV_IDLE_EN (1 << 13)
48# define OTG_RESET_DONE (1 << 2) 45# define OTG_RESET_DONE (1 << 2)
49# define OTG_SOFT_RESET (1 << 1) 46# define OTG_SOFT_RESET (1 << 1)
50#define OTG_SYSCON_2_REG OTG_REG32(0x08) 47#define OTG_SYSCON_2 (OTG_BASE + 0x08)
51# define OTG_EN (1 << 31) 48# define OTG_EN (1 << 31)
52# define USBX_SYNCHRO (1 << 30) 49# define USBX_SYNCHRO (1 << 30)
53# define OTG_MST16 (1 << 29) 50# define OTG_MST16 (1 << 29)
@@ -65,7 +62,7 @@
65# define HMC_TLLSPEED (1 << 7) 62# define HMC_TLLSPEED (1 << 7)
66# define HMC_TLLATTACH (1 << 6) 63# define HMC_TLLATTACH (1 << 6)
67# define OTG_HMC(w) (((w)>>0)&0x3f) 64# define OTG_HMC(w) (((w)>>0)&0x3f)
68#define OTG_CTRL_REG OTG_REG32(0x0c) 65#define OTG_CTRL (OTG_BASE + 0x0c)
69# define OTG_USB2_EN (1 << 29) 66# define OTG_USB2_EN (1 << 29)
70# define OTG_USB2_DP (1 << 28) 67# define OTG_USB2_DP (1 << 28)
71# define OTG_USB2_DM (1 << 27) 68# define OTG_USB2_DM (1 << 27)
@@ -92,7 +89,7 @@
92# define OTG_PD_VBUS (1 << 2) 89# define OTG_PD_VBUS (1 << 2)
93# define OTG_PU_VBUS (1 << 1) 90# define OTG_PU_VBUS (1 << 1)
94# define OTG_PU_ID (1 << 0) 91# define OTG_PU_ID (1 << 0)
95#define OTG_IRQ_EN_REG OTG_REG16(0x10) 92#define OTG_IRQ_EN (OTG_BASE + 0x10) /* 16-bit */
96# define DRIVER_SWITCH (1 << 15) 93# define DRIVER_SWITCH (1 << 15)
97# define A_VBUS_ERR (1 << 13) 94# define A_VBUS_ERR (1 << 13)
98# define A_REQ_TMROUT (1 << 12) 95# define A_REQ_TMROUT (1 << 12)
@@ -102,9 +99,9 @@
102# define B_SRP_DONE (1 << 8) 99# define B_SRP_DONE (1 << 8)
103# define B_SRP_STARTED (1 << 7) 100# define B_SRP_STARTED (1 << 7)
104# define OPRT_CHG (1 << 0) 101# define OPRT_CHG (1 << 0)
105#define OTG_IRQ_SRC_REG OTG_REG16(0x14) 102#define OTG_IRQ_SRC (OTG_BASE + 0x14) /* 16-bit */
106 // same bits as in IRQ_EN 103 // same bits as in IRQ_EN
107#define OTG_OUTCTRL_REG OTG_REG16(0x18) 104#define OTG_OUTCTRL (OTG_BASE + 0x18) /* 16-bit */
108# define OTGVPD (1 << 14) 105# define OTGVPD (1 << 14)
109# define OTGVPU (1 << 13) 106# define OTGVPU (1 << 13)
110# define OTGPUID (1 << 12) 107# define OTGPUID (1 << 12)
@@ -117,13 +114,13 @@
117# define USB0VDR (1 << 2) 114# define USB0VDR (1 << 2)
118# define USB0PDEN (1 << 1) 115# define USB0PDEN (1 << 1)
119# define USB0PUEN (1 << 0) 116# define USB0PUEN (1 << 0)
120#define OTG_TEST_REG OTG_REG16(0x20) 117#define OTG_TEST (OTG_BASE + 0x20) /* 16-bit */
121#define OTG_VENDOR_CODE_REG OTG_REG32(0xfc) 118#define OTG_VENDOR_CODE (OTG_BASE + 0xfc) /* 16-bit */
122 119
123/*-------------------------------------------------------------------------*/ 120/*-------------------------------------------------------------------------*/
124 121
125/* OMAP1 */ 122/* OMAP1 */
126#define USB_TRANSCEIVER_CTRL_REG __REG32(0xfffe1000 + 0x0064) 123#define USB_TRANSCEIVER_CTRL (0xfffe1000 + 0x0064)
127# define CONF_USB2_UNI_R (1 << 8) 124# define CONF_USB2_UNI_R (1 << 8)
128# define CONF_USB1_UNI_R (1 << 7) 125# define CONF_USB1_UNI_R (1 << 7)
129# define CONF_USB_PORT0_R(x) (((x)>>4)&0x7) 126# define CONF_USB_PORT0_R(x) (((x)>>4)&0x7)
diff --git a/include/asm-arm/arch-orion5x/io.h b/include/asm-arm/arch-orion5x/io.h
index 50f8c8802206..59f1bc96a23b 100644
--- a/include/asm-arm/arch-orion5x/io.h
+++ b/include/asm-arm/arch-orion5x/io.h
@@ -14,7 +14,6 @@
14#include "orion5x.h" 14#include "orion5x.h"
15 15
16#define IO_SPACE_LIMIT 0xffffffff 16#define IO_SPACE_LIMIT 0xffffffff
17#define IO_SPACE_REMAP ORION5X_PCI_SYS_IO_BASE
18 17
19static inline void __iomem * 18static inline void __iomem *
20__arch_ioremap(unsigned long paddr, size_t size, unsigned int mtype) 19__arch_ioremap(unsigned long paddr, size_t size, unsigned int mtype)
@@ -53,15 +52,12 @@ static inline void __iomem *__io(unsigned long addr)
53/***************************************************************************** 52/*****************************************************************************
54 * Helpers to access Orion registers 53 * Helpers to access Orion registers
55 ****************************************************************************/ 54 ****************************************************************************/
56#define orion5x_read(r) __raw_readl(r)
57#define orion5x_write(r, val) __raw_writel(val, r)
58
59/* 55/*
60 * These are not preempt-safe. Locks, if needed, must be taken 56 * These are not preempt-safe. Locks, if needed, must be taken
61 * care of by the caller. 57 * care of by the caller.
62 */ 58 */
63#define orion5x_setbits(r, mask) orion5x_write((r), orion5x_read(r) | (mask)) 59#define orion5x_setbits(r, mask) writel(readl(r) | (mask), (r))
64#define orion5x_clrbits(r, mask) orion5x_write((r), orion5x_read(r) & ~(mask)) 60#define orion5x_clrbits(r, mask) writel(readl(r) & ~(mask), (r))
65 61
66 62
67#endif 63#endif
diff --git a/include/asm-arm/arch-orion5x/orion5x.h b/include/asm-arm/arch-orion5x/orion5x.h
index 206ddd71e193..10257f5c5e9e 100644
--- a/include/asm-arm/arch-orion5x/orion5x.h
+++ b/include/asm-arm/arch-orion5x/orion5x.h
@@ -2,7 +2,7 @@
2 * include/asm-arm/arch-orion5x/orion5x.h 2 * include/asm-arm/arch-orion5x/orion5x.h
3 * 3 *
4 * Generic definitions of Orion SoC flavors: 4 * Generic definitions of Orion SoC flavors:
5 * Orion-1, Orion-NAS, Orion-VoIP, and Orion-2. 5 * Orion-1, Orion-VoIP, Orion-NAS, and Orion-2.
6 * 6 *
7 * Maintainer: Tzachi Perelstein <tzachi@marvell.com> 7 * Maintainer: Tzachi Perelstein <tzachi@marvell.com>
8 * 8 *
@@ -63,9 +63,11 @@
63/******************************************************************************* 63/*******************************************************************************
64 * Supported Devices & Revisions 64 * Supported Devices & Revisions
65 ******************************************************************************/ 65 ******************************************************************************/
66/* Orion-1 (88F5181) */ 66/* Orion-1 (88F5181) and Orion-VoIP (88F5181L) */
67#define MV88F5181_DEV_ID 0x5181 67#define MV88F5181_DEV_ID 0x5181
68#define MV88F5181_REV_B1 3 68#define MV88F5181_REV_B1 3
69#define MV88F5181L_REV_A0 8
70#define MV88F5181L_REV_A1 9
69/* Orion-NAS (88F5182) */ 71/* Orion-NAS (88F5182) */
70#define MV88F5182_DEV_ID 0x5182 72#define MV88F5182_DEV_ID 0x5182
71#define MV88F5182_REV_A2 2 73#define MV88F5182_REV_A2 2
@@ -152,6 +154,7 @@
152#define BRIDGE_MASK ORION5X_BRIDGE_REG(0x114) 154#define BRIDGE_MASK ORION5X_BRIDGE_REG(0x114)
153#define BRIDGE_INT_TIMER0 0x0002 155#define BRIDGE_INT_TIMER0 0x0002
154#define BRIDGE_INT_TIMER1 0x0004 156#define BRIDGE_INT_TIMER1 0x0004
157#define BRIDGE_INT_TIMER1_CLR (~0x0004)
155#define MAIN_IRQ_CAUSE ORION5X_BRIDGE_REG(0x200) 158#define MAIN_IRQ_CAUSE ORION5X_BRIDGE_REG(0x200)
156#define MAIN_IRQ_MASK ORION5X_BRIDGE_REG(0x204) 159#define MAIN_IRQ_MASK ORION5X_BRIDGE_REG(0x204)
157 160
diff --git a/include/asm-arm/arch-orion5x/uncompress.h b/include/asm-arm/arch-orion5x/uncompress.h
index 5c13d4fafb4e..7548cedf2d76 100644
--- a/include/asm-arm/arch-orion5x/uncompress.h
+++ b/include/asm-arm/arch-orion5x/uncompress.h
@@ -8,23 +8,38 @@
8 * warranty of any kind, whether express or implied. 8 * warranty of any kind, whether express or implied.
9 */ 9 */
10 10
11#include <linux/serial_reg.h>
11#include <asm/arch/orion5x.h> 12#include <asm/arch/orion5x.h>
12 13
13#define MV_UART_THR ((volatile unsigned char *)(UART0_PHYS_BASE + 0x0)) 14#define SERIAL_BASE ((unsigned char *)UART0_PHYS_BASE)
14#define MV_UART_LSR ((volatile unsigned char *)(UART0_PHYS_BASE + 0x14))
15
16#define LSR_THRE 0x20
17 15
18static void putc(const char c) 16static void putc(const char c)
19{ 17{
20 int j = 0x1000; 18 unsigned char *base = SERIAL_BASE;
21 while (--j && !(*MV_UART_LSR & LSR_THRE)) 19 int i;
20
21 for (i = 0; i < 0x1000; i++) {
22 if (base[UART_LSR << 2] & UART_LSR_THRE)
23 break;
22 barrier(); 24 barrier();
23 *MV_UART_THR = c; 25 }
26
27 base[UART_TX << 2] = c;
24} 28}
25 29
26static void flush(void) 30static void flush(void)
27{ 31{
32 unsigned char *base = SERIAL_BASE;
33 unsigned char mask;
34 int i;
35
36 mask = UART_LSR_TEMT | UART_LSR_THRE;
37
38 for (i = 0; i < 0x1000; i++) {
39 if ((base[UART_LSR << 2] & mask) == mask)
40 break;
41 barrier();
42 }
28} 43}
29 44
30/* 45/*
diff --git a/include/asm-arm/arch-s3c2410/gpio.h b/include/asm-arm/arch-s3c2410/gpio.h
index 7583895fd336..18e10d2c35ea 100644
--- a/include/asm-arm/arch-s3c2410/gpio.h
+++ b/include/asm-arm/arch-s3c2410/gpio.h
@@ -1,68 +1,18 @@
1/* 1/* linux/include/asm-arm/arch-s3c2410/gpio.h
2 * linux/include/asm-arm/arch-s3c2410/gpio.h
3 * 2 *
4 * S3C2410 GPIO wrappers for arch-neutral GPIO calls 3 * Copyright (c) 2008 Simtec Electronics
4 * http://armlinux.simtec.co.uk/
5 * Ben Dooks <ben@simtec.co.uk>
5 * 6 *
6 * Written by Philipp Zabel <philipp.zabel@gmail.com> 7 * S3C2410 - GPIO lib support
7 * 8 *
8 * This program is free software; you can redistribute it and/or modify 9 * 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 * it under the terms of the GNU General Public License version 2 as
10 * the Free Software Foundation; either version 2 of the License, or 11 * published by the Free Software Foundation.
11 * (at your option) any later version. 12*/
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 *
22 */
23
24#ifndef __ASM_ARCH_S3C2410_GPIO_H
25#define __ASM_ARCH_S3C2410_GPIO_H
26
27#include <asm/irq.h>
28#include <asm/hardware.h>
29#include <asm/arch/regs-gpio.h>
30
31static inline int gpio_request(unsigned gpio, const char *label)
32{
33 return 0;
34}
35
36static inline void gpio_free(unsigned gpio)
37{
38 return;
39}
40
41static inline int gpio_direction_input(unsigned gpio)
42{
43 s3c2410_gpio_cfgpin(gpio, S3C2410_GPIO_INPUT);
44 return 0;
45}
46
47static inline int gpio_direction_output(unsigned gpio, int value)
48{
49 s3c2410_gpio_cfgpin(gpio, S3C2410_GPIO_OUTPUT);
50 /* REVISIT can we write the value first, to avoid glitching? */
51 s3c2410_gpio_setpin(gpio, value);
52 return 0;
53}
54
55#define gpio_get_value(gpio) s3c2410_gpio_getpin(gpio)
56#define gpio_set_value(gpio,value) s3c2410_gpio_setpin(gpio, value)
57
58#include <asm-generic/gpio.h> /* cansleep wrappers */
59
60#ifdef CONFIG_CPU_S3C2400
61#define gpio_to_irq(gpio) s3c2400_gpio_getirq(gpio)
62#else
63#define gpio_to_irq(gpio) s3c2410_gpio_getirq(gpio)
64#endif
65 13
66/* FIXME implement irq_to_gpio() */ 14#define gpio_get_value __gpio_get_value
15#define gpio_set_value __gpio_set_value
16#define gpio_cansleep __gpio_cansleep
67 17
68#endif 18#include <asm-generic/gpio.h>
diff --git a/include/asm-arm/arch-s3c2410/regs-clock.h b/include/asm-arm/arch-s3c2410/regs-clock.h
index ecae9e7f5e45..37661358b42b 100644
--- a/include/asm-arm/arch-s3c2410/regs-clock.h
+++ b/include/asm-arm/arch-s3c2410/regs-clock.h
@@ -189,6 +189,8 @@ s3c2410_get_pll(unsigned int pllval, unsigned int baseclk)
189#define S3C2412_CLKSRC_I2SCLK_MPLL (1<<9) 189#define S3C2412_CLKSRC_I2SCLK_MPLL (1<<9)
190#define S3C2412_CLKSRC_USBCLK_HCLK (1<<10) 190#define S3C2412_CLKSRC_USBCLK_HCLK (1<<10)
191#define S3C2412_CLKSRC_CAMCLK_HCLK (1<<11) 191#define S3C2412_CLKSRC_CAMCLK_HCLK (1<<11)
192#define S3C2412_CLKSRC_UREFCLK_EXTCLK (1<<12)
193#define S3C2412_CLKSRC_EREFCLK_EXTCLK (1<<14)
192 194
193#endif /* CONFIG_CPU_S3C2412 | CONFIG_CPU_S3C2413 */ 195#endif /* CONFIG_CPU_S3C2412 | CONFIG_CPU_S3C2413 */
194 196
diff --git a/include/asm-arm/assembler.h b/include/asm-arm/assembler.h
index fce832820825..911393b2c6f0 100644
--- a/include/asm-arm/assembler.h
+++ b/include/asm-arm/assembler.h
@@ -56,6 +56,21 @@
56#endif 56#endif
57 57
58/* 58/*
59 * This can be used to enable code to cacheline align the destination
60 * pointer when bulk writing to memory. Experiments on StrongARM and
61 * XScale didn't show this a worthwhile thing to do when the cache is not
62 * set to write-allocate (this would need further testing on XScale when WA
63 * is used).
64 *
65 * On Feroceon there is much to gain however, regardless of cache mode.
66 */
67#ifdef CONFIG_CPU_FEROCEON
68#define CALGN(code...) code
69#else
70#define CALGN(code...)
71#endif
72
73/*
59 * Enable and disable interrupts 74 * Enable and disable interrupts
60 */ 75 */
61#if __LINUX_ARM_ARCH__ >= 6 76#if __LINUX_ARM_ARCH__ >= 6
diff --git a/include/asm-arm/cacheflush.h b/include/asm-arm/cacheflush.h
index 759a97b56eed..70b0fe724b62 100644
--- a/include/asm-arm/cacheflush.h
+++ b/include/asm-arm/cacheflush.h
@@ -95,11 +95,7 @@
95#endif 95#endif
96 96
97#if defined(CONFIG_CPU_FEROCEON) 97#if defined(CONFIG_CPU_FEROCEON)
98# ifdef _CACHE 98# define MULTI_CACHE 1
99# define MULTI_CACHE 1
100# else
101# define _CACHE feroceon
102# endif
103#endif 99#endif
104 100
105#if defined(CONFIG_CPU_V6) 101#if defined(CONFIG_CPU_V6)
@@ -410,6 +406,13 @@ extern void flush_dcache_page(struct page *);
410 406
411extern void __flush_dcache_page(struct address_space *mapping, struct page *page); 407extern void __flush_dcache_page(struct address_space *mapping, struct page *page);
412 408
409static inline void __flush_icache_all(void)
410{
411 asm("mcr p15, 0, %0, c7, c5, 0 @ invalidate I-cache\n"
412 :
413 : "r" (0));
414}
415
413#define ARCH_HAS_FLUSH_ANON_PAGE 416#define ARCH_HAS_FLUSH_ANON_PAGE
414static inline void flush_anon_page(struct vm_area_struct *vma, 417static inline void flush_anon_page(struct vm_area_struct *vma,
415 struct page *page, unsigned long vmaddr) 418 struct page *page, unsigned long vmaddr)
diff --git a/include/asm-arm/dyntick.h b/include/asm-arm/dyntick.h
deleted file mode 100644
index 19fab2d2b760..000000000000
--- a/include/asm-arm/dyntick.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef _ASMARM_DYNTICK_H
2#define _ASMARM_DYNTICK_H
3
4#include <asm/mach/time.h>
5
6#endif /* _ASMARM_DYNTICK_H */
diff --git a/include/asm-arm/hardware/iop3xx-gpio.h b/include/asm-arm/hardware/iop3xx-gpio.h
new file mode 100644
index 000000000000..0c9331f9ac24
--- /dev/null
+++ b/include/asm-arm/hardware/iop3xx-gpio.h
@@ -0,0 +1,73 @@
1/*
2 * linux/include/asm-arm/hardware/iop3xx-gpio.h
3 *
4 * IOP3xx GPIO wrappers
5 *
6 * Copyright (c) 2008 Arnaud Patard <arnaud.patard@rtp-net.org>
7 * Based on IXP4XX gpio.h file
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 *
23 */
24
25#ifndef __ASM_ARM_HARDWARE_IOP3XX_GPIO_H
26#define __ASM_ARM_HARDWARE_IOP3XX_GPIO_H
27
28#include <asm/hardware.h>
29#include <asm-generic/gpio.h>
30
31#define IOP3XX_N_GPIOS 8
32
33static inline int gpio_get_value(unsigned gpio)
34{
35 if (gpio > IOP3XX_N_GPIOS)
36 return __gpio_get_value(gpio);
37
38 return gpio_line_get(gpio);
39}
40
41static inline void gpio_set_value(unsigned gpio, int value)
42{
43 if (gpio > IOP3XX_N_GPIOS) {
44 __gpio_set_value(gpio, value);
45 return;
46 }
47 gpio_line_set(gpio, value);
48}
49
50static inline int gpio_cansleep(unsigned gpio)
51{
52 if (gpio < IOP3XX_N_GPIOS)
53 return 0;
54 else
55 return __gpio_cansleep(gpio);
56}
57
58/*
59 * The GPIOs are not generating any interrupt
60 * Note : manuals are not clear about this
61 */
62static inline int gpio_to_irq(int gpio)
63{
64 return -EINVAL;
65}
66
67static inline int irq_to_gpio(int gpio)
68{
69 return -EINVAL;
70}
71
72#endif
73
diff --git a/include/asm-arm/hw_irq.h b/include/asm-arm/hw_irq.h
index 98d594a973d6..f1a08a500604 100644
--- a/include/asm-arm/hw_irq.h
+++ b/include/asm-arm/hw_irq.h
@@ -6,15 +6,4 @@
6 6
7#include <asm/mach/irq.h> 7#include <asm/mach/irq.h>
8 8
9#if defined(CONFIG_NO_IDLE_HZ)
10# include <asm/dyntick.h>
11# define handle_dynamic_tick(action) \
12 if (!(action->flags & IRQF_TIMER) && system_timer->dyn_tick) { \
13 write_seqlock(&xtime_lock); \
14 if (system_timer->dyn_tick->state & DYN_TICK_ENABLED) \
15 system_timer->dyn_tick->handler(irq, NULL); \
16 write_sequnlock(&xtime_lock); \
17 }
18#endif
19
20#endif 9#endif
diff --git a/include/asm-arm/kexec.h b/include/asm-arm/kexec.h
index 47fe34d692da..c8986bb99ed5 100644
--- a/include/asm-arm/kexec.h
+++ b/include/asm-arm/kexec.h
@@ -14,8 +14,6 @@
14 14
15#define KEXEC_ARCH KEXEC_ARCH_ARM 15#define KEXEC_ARCH KEXEC_ARCH_ARM
16 16
17#define KEXEC_BOOT_PARAMS_SIZE 1536
18
19#define KEXEC_ARM_ATAGS_OFFSET 0x1000 17#define KEXEC_ARM_ATAGS_OFFSET 0x1000
20#define KEXEC_ARM_ZIMAGE_OFFSET 0x8000 18#define KEXEC_ARM_ZIMAGE_OFFSET 0x8000
21 19
diff --git a/include/asm-arm/mach/time.h b/include/asm-arm/mach/time.h
index 5dc357013b79..2fd36ea0130d 100644
--- a/include/asm-arm/mach/time.h
+++ b/include/asm-arm/mach/time.h
@@ -41,30 +41,8 @@ struct sys_timer {
41#ifndef CONFIG_GENERIC_TIME 41#ifndef CONFIG_GENERIC_TIME
42 unsigned long (*offset)(void); 42 unsigned long (*offset)(void);
43#endif 43#endif
44
45#ifdef CONFIG_NO_IDLE_HZ
46 struct dyn_tick_timer *dyn_tick;
47#endif
48};
49
50#ifdef CONFIG_NO_IDLE_HZ
51
52#define DYN_TICK_ENABLED (1 << 1)
53
54struct dyn_tick_timer {
55 spinlock_t lock;
56 unsigned int state; /* Current state */
57 int (*enable)(void); /* Enables dynamic tick */
58 int (*disable)(void); /* Disables dynamic tick */
59 void (*reprogram)(unsigned long); /* Reprograms the timer */
60 int (*handler)(int, void *);
61}; 44};
62 45
63void timer_dyn_reprogram(void);
64#else
65#define timer_dyn_reprogram() do { } while (0)
66#endif
67
68extern struct sys_timer *system_timer; 46extern struct sys_timer *system_timer;
69extern void timer_tick(void); 47extern void timer_tick(void);
70 48
diff --git a/include/asm-arm/mmu_context.h b/include/asm-arm/mmu_context.h
index 6913d02ca5d6..91b9dfdfed52 100644
--- a/include/asm-arm/mmu_context.h
+++ b/include/asm-arm/mmu_context.h
@@ -97,6 +97,11 @@ switch_mm(struct mm_struct *prev, struct mm_struct *next,
97#ifdef CONFIG_MMU 97#ifdef CONFIG_MMU
98 unsigned int cpu = smp_processor_id(); 98 unsigned int cpu = smp_processor_id();
99 99
100#ifdef CONFIG_SMP
101 /* check for possible thread migration */
102 if (!cpus_empty(next->cpu_vm_mask) && !cpu_isset(cpu, next->cpu_vm_mask))
103 __flush_icache_all();
104#endif
100 if (!cpu_test_and_set(cpu, next->cpu_vm_mask) || prev != next) { 105 if (!cpu_test_and_set(cpu, next->cpu_vm_mask) || prev != next) {
101 check_context(next); 106 check_context(next);
102 cpu_switch_mm(next->pgd, next); 107 cpu_switch_mm(next->pgd, next);
diff --git a/include/asm-arm/plat-orion/cache-feroceon-l2.h b/include/asm-arm/plat-orion/cache-feroceon-l2.h
new file mode 100644
index 000000000000..ba4e016d3ec0
--- /dev/null
+++ b/include/asm-arm/plat-orion/cache-feroceon-l2.h
@@ -0,0 +1,11 @@
1/*
2 * include/asm-arm/plat-orion/cache-feroceon-l2.h
3 *
4 * Copyright (C) 2008 Marvell Semiconductor
5 *
6 * This file is licensed under the terms of the GNU General Public
7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied.
9 */
10
11extern void __init feroceon_l2_init(int l2_wt_override);
diff --git a/include/asm-arm/plat-orion/orion_nand.h b/include/asm-arm/plat-orion/orion_nand.h
index ffd3852a0dd7..ad4ce94c1998 100644
--- a/include/asm-arm/plat-orion/orion_nand.h
+++ b/include/asm-arm/plat-orion/orion_nand.h
@@ -18,6 +18,7 @@ struct orion_nand_data {
18 u8 ale; /* address line number connected to ALE */ 18 u8 ale; /* address line number connected to ALE */
19 u8 cle; /* address line number connected to CLE */ 19 u8 cle; /* address line number connected to CLE */
20 u8 width; /* buswidth */ 20 u8 width; /* buswidth */
21 u8 chip_delay;
21}; 22};
22 23
23 24
diff --git a/include/asm-arm/plat-orion/pcie.h b/include/asm-arm/plat-orion/pcie.h
index 6434ac685d21..e61b7bd97af5 100644
--- a/include/asm-arm/plat-orion/pcie.h
+++ b/include/asm-arm/plat-orion/pcie.h
@@ -14,6 +14,7 @@
14u32 orion_pcie_dev_id(void __iomem *base); 14u32 orion_pcie_dev_id(void __iomem *base);
15u32 orion_pcie_rev(void __iomem *base); 15u32 orion_pcie_rev(void __iomem *base);
16int orion_pcie_link_up(void __iomem *base); 16int orion_pcie_link_up(void __iomem *base);
17int orion_pcie_x4_mode(void __iomem *base);
17int orion_pcie_get_local_bus_nr(void __iomem *base); 18int orion_pcie_get_local_bus_nr(void __iomem *base);
18void orion_pcie_set_local_bus_nr(void __iomem *base, int nr); 19void orion_pcie_set_local_bus_nr(void __iomem *base, int nr);
19void orion_pcie_setup(void __iomem *base, 20void orion_pcie_setup(void __iomem *base,
diff --git a/include/asm-arm/plat-s3c/regs-timer.h b/include/asm-arm/plat-s3c/regs-timer.h
index 8b0d594397b1..b5bc692f3489 100644
--- a/include/asm-arm/plat-s3c/regs-timer.h
+++ b/include/asm-arm/plat-s3c/regs-timer.h
@@ -65,6 +65,15 @@
65#define S3C2410_TCFG1_MUX0_TCLK0 (4<<0) 65#define S3C2410_TCFG1_MUX0_TCLK0 (4<<0)
66#define S3C2410_TCFG1_MUX0_MASK (15<<0) 66#define S3C2410_TCFG1_MUX0_MASK (15<<0)
67 67
68#define S3C2410_TCFG1_MUX_DIV2 (0<<0)
69#define S3C2410_TCFG1_MUX_DIV4 (1<<0)
70#define S3C2410_TCFG1_MUX_DIV8 (2<<0)
71#define S3C2410_TCFG1_MUX_DIV16 (3<<0)
72#define S3C2410_TCFG1_MUX_TCLK (4<<0)
73#define S3C2410_TCFG1_MUX_MASK (15<<0)
74
75#define S3C2410_TCFG1_SHIFT(x) ((x) * 4)
76
68/* for each timer, we have an count buffer, an compare buffer and 77/* for each timer, we have an count buffer, an compare buffer and
69 * an observation buffer 78 * an observation buffer
70*/ 79*/
diff --git a/include/asm-arm/plat-s3c24xx/devs.h b/include/asm-arm/plat-s3c24xx/devs.h
index f9d6f0317bc1..badaac9d64a8 100644
--- a/include/asm-arm/plat-s3c24xx/devs.h
+++ b/include/asm-arm/plat-s3c24xx/devs.h
@@ -21,6 +21,8 @@ extern struct s3c24xx_uart_resources s3c2410_uart_resources[];
21extern struct platform_device *s3c24xx_uart_devs[]; 21extern struct platform_device *s3c24xx_uart_devs[];
22extern struct platform_device *s3c24xx_uart_src[]; 22extern struct platform_device *s3c24xx_uart_src[];
23 23
24extern struct platform_device s3c_device_timer[];
25
24extern struct platform_device s3c_device_usb; 26extern struct platform_device s3c_device_usb;
25extern struct platform_device s3c_device_lcd; 27extern struct platform_device s3c_device_lcd;
26extern struct platform_device s3c_device_wdt; 28extern struct platform_device s3c_device_wdt;
@@ -36,11 +38,6 @@ extern struct platform_device s3c_device_spi1;
36 38
37extern struct platform_device s3c_device_nand; 39extern struct platform_device s3c_device_nand;
38 40
39extern struct platform_device s3c_device_timer0;
40extern struct platform_device s3c_device_timer1;
41extern struct platform_device s3c_device_timer2;
42extern struct platform_device s3c_device_timer3;
43
44extern struct platform_device s3c_device_usbgadget; 41extern struct platform_device s3c_device_usbgadget;
45 42
46/* s3c2440 specific devices */ 43/* s3c2440 specific devices */
diff --git a/include/asm-arm/rtc.h b/include/asm-arm/rtc.h
deleted file mode 100644
index 1a5c9232a91e..000000000000
--- a/include/asm-arm/rtc.h
+++ /dev/null
@@ -1,43 +0,0 @@
1/*
2 * linux/include/asm-arm/rtc.h
3 *
4 * Copyright (C) 2003 Deep Blue Solutions Ltd.
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#ifndef ASMARM_RTC_H
11#define ASMARM_RTC_H
12
13struct module;
14
15struct rtc_ops {
16 struct module *owner;
17 int (*open)(void);
18 void (*release)(void);
19 int (*ioctl)(unsigned int, unsigned long);
20
21 int (*read_time)(struct rtc_time *);
22 int (*set_time)(struct rtc_time *);
23 int (*read_alarm)(struct rtc_wkalrm *);
24 int (*set_alarm)(struct rtc_wkalrm *);
25 int (*proc)(char *buf);
26};
27
28void rtc_next_alarm_time(struct rtc_time *, struct rtc_time *, struct rtc_time *);
29void rtc_update(unsigned long, unsigned long);
30int register_rtc(struct rtc_ops *);
31void unregister_rtc(struct rtc_ops *);
32
33static inline int rtc_periodic_alarm(struct rtc_time *tm)
34{
35 return (tm->tm_year == -1) ||
36 ((unsigned)tm->tm_mon >= 12) ||
37 ((unsigned)(tm->tm_mday - 1) >= 31) ||
38 ((unsigned)tm->tm_hour > 23) ||
39 ((unsigned)tm->tm_min > 59) ||
40 ((unsigned)tm->tm_sec > 59);
41}
42
43#endif
diff --git a/include/asm-arm/tlbflush.h b/include/asm-arm/tlbflush.h
index 8c6bc1bb9d1a..909656c747ef 100644
--- a/include/asm-arm/tlbflush.h
+++ b/include/asm-arm/tlbflush.h
@@ -39,6 +39,7 @@
39#define TLB_V6_D_ASID (1 << 17) 39#define TLB_V6_D_ASID (1 << 17)
40#define TLB_V6_I_ASID (1 << 18) 40#define TLB_V6_I_ASID (1 << 18)
41 41
42#define TLB_L2CLEAN_FR (1 << 29) /* Feroceon */
42#define TLB_DCLEAN (1 << 30) 43#define TLB_DCLEAN (1 << 30)
43#define TLB_WB (1 << 31) 44#define TLB_WB (1 << 31)
44 45
@@ -51,6 +52,7 @@
51 * v4 - ARMv4 without write buffer 52 * v4 - ARMv4 without write buffer
52 * v4wb - ARMv4 with write buffer without I TLB flush entry instruction 53 * v4wb - ARMv4 with write buffer without I TLB flush entry instruction
53 * v4wbi - ARMv4 with write buffer with I TLB flush entry instruction 54 * v4wbi - ARMv4 with write buffer with I TLB flush entry instruction
55 * fr - Feroceon (v4wbi with non-outer-cacheable page table walks)
54 * v6wbi - ARMv6 with write buffer with I TLB flush entry instruction 56 * v6wbi - ARMv6 with write buffer with I TLB flush entry instruction
55 */ 57 */
56#undef _TLB 58#undef _TLB
@@ -103,6 +105,23 @@
103# define v4wbi_always_flags (-1UL) 105# define v4wbi_always_flags (-1UL)
104#endif 106#endif
105 107
108#define fr_tlb_flags (TLB_WB | TLB_DCLEAN | TLB_L2CLEAN_FR | \
109 TLB_V4_I_FULL | TLB_V4_D_FULL | \
110 TLB_V4_I_PAGE | TLB_V4_D_PAGE)
111
112#ifdef CONFIG_CPU_TLB_FEROCEON
113# define fr_possible_flags fr_tlb_flags
114# define fr_always_flags fr_tlb_flags
115# ifdef _TLB
116# define MULTI_TLB 1
117# else
118# define _TLB v4wbi
119# endif
120#else
121# define fr_possible_flags 0
122# define fr_always_flags (-1UL)
123#endif
124
106#define v4wb_tlb_flags (TLB_WB | TLB_DCLEAN | \ 125#define v4wb_tlb_flags (TLB_WB | TLB_DCLEAN | \
107 TLB_V4_I_FULL | TLB_V4_D_FULL | \ 126 TLB_V4_I_FULL | TLB_V4_D_FULL | \
108 TLB_V4_D_PAGE) 127 TLB_V4_D_PAGE)
@@ -245,12 +264,14 @@ extern struct cpu_tlb_fns cpu_tlb;
245#define possible_tlb_flags (v3_possible_flags | \ 264#define possible_tlb_flags (v3_possible_flags | \
246 v4_possible_flags | \ 265 v4_possible_flags | \
247 v4wbi_possible_flags | \ 266 v4wbi_possible_flags | \
267 fr_possible_flags | \
248 v4wb_possible_flags | \ 268 v4wb_possible_flags | \
249 v6wbi_possible_flags) 269 v6wbi_possible_flags)
250 270
251#define always_tlb_flags (v3_always_flags & \ 271#define always_tlb_flags (v3_always_flags & \
252 v4_always_flags & \ 272 v4_always_flags & \
253 v4wbi_always_flags & \ 273 v4wbi_always_flags & \
274 fr_always_flags & \
254 v4wb_always_flags & \ 275 v4wb_always_flags & \
255 v6wbi_always_flags) 276 v6wbi_always_flags)
256 277
@@ -417,6 +438,11 @@ static inline void flush_pmd_entry(pmd_t *pmd)
417 if (tlb_flag(TLB_DCLEAN)) 438 if (tlb_flag(TLB_DCLEAN))
418 asm("mcr p15, 0, %0, c7, c10, 1 @ flush_pmd" 439 asm("mcr p15, 0, %0, c7, c10, 1 @ flush_pmd"
419 : : "r" (pmd) : "cc"); 440 : : "r" (pmd) : "cc");
441
442 if (tlb_flag(TLB_L2CLEAN_FR))
443 asm("mcr p15, 1, %0, c15, c9, 1 @ L2 flush_pmd"
444 : : "r" (pmd) : "cc");
445
420 if (tlb_flag(TLB_WB)) 446 if (tlb_flag(TLB_WB))
421 dsb(); 447 dsb();
422} 448}
@@ -428,6 +454,10 @@ static inline void clean_pmd_entry(pmd_t *pmd)
428 if (tlb_flag(TLB_DCLEAN)) 454 if (tlb_flag(TLB_DCLEAN))
429 asm("mcr p15, 0, %0, c7, c10, 1 @ flush_pmd" 455 asm("mcr p15, 0, %0, c7, c10, 1 @ flush_pmd"
430 : : "r" (pmd) : "cc"); 456 : : "r" (pmd) : "cc");
457
458 if (tlb_flag(TLB_L2CLEAN_FR))
459 asm("mcr p15, 1, %0, c15, c9, 1 @ L2 flush_pmd"
460 : : "r" (pmd) : "cc");
431} 461}
432 462
433#undef tlb_flag 463#undef tlb_flag
diff --git a/include/asm-generic/Kbuild.asm b/include/asm-generic/Kbuild.asm
index 92a6d91d0c1a..7cd25b8e7c9a 100644
--- a/include/asm-generic/Kbuild.asm
+++ b/include/asm-generic/Kbuild.asm
@@ -1,6 +1,6 @@
1header-y += kvm.h 1header-y += kvm.h
2 2
3ifeq ($(wildcard include/asm-$(SRCARCH)/a.out.h),include/asm-$(SRCARCH)/a.out.h) 3ifneq ($(wildcard $(srctree)/include/asm-$(SRCARCH)/a.out.h),)
4unifdef-y += a.out.h 4unifdef-y += a.out.h
5endif 5endif
6unifdef-y += auxvec.h 6unifdef-y += auxvec.h
diff --git a/include/asm-powerpc/Kbuild b/include/asm-powerpc/Kbuild
index 7381916dfcbb..bca352e033c3 100644
--- a/include/asm-powerpc/Kbuild
+++ b/include/asm-powerpc/Kbuild
@@ -1,6 +1,5 @@
1include include/asm-generic/Kbuild.asm 1include include/asm-generic/Kbuild.asm
2 2
3header-y += a.out.h
4header-y += auxvec.h 3header-y += auxvec.h
5header-y += ioctls.h 4header-y += ioctls.h
6header-y += mman.h 5header-y += mman.h
diff --git a/include/asm-x86/kvm_host.h b/include/asm-x86/kvm_host.h
index 1d8cd01fa514..844f2a89afbc 100644
--- a/include/asm-x86/kvm_host.h
+++ b/include/asm-x86/kvm_host.h
@@ -18,6 +18,7 @@
18#include <linux/kvm_para.h> 18#include <linux/kvm_para.h>
19#include <linux/kvm_types.h> 19#include <linux/kvm_types.h>
20 20
21#include <asm/pvclock-abi.h>
21#include <asm/desc.h> 22#include <asm/desc.h>
22 23
23#define KVM_MAX_VCPUS 16 24#define KVM_MAX_VCPUS 16
@@ -282,7 +283,8 @@ struct kvm_vcpu_arch {
282 struct x86_emulate_ctxt emulate_ctxt; 283 struct x86_emulate_ctxt emulate_ctxt;
283 284
284 gpa_t time; 285 gpa_t time;
285 struct kvm_vcpu_time_info hv_clock; 286 struct pvclock_vcpu_time_info hv_clock;
287 unsigned int hv_clock_tsc_khz;
286 unsigned int time_offset; 288 unsigned int time_offset;
287 struct page *time_page; 289 struct page *time_page;
288}; 290};
diff --git a/include/asm-x86/kvm_para.h b/include/asm-x86/kvm_para.h
index 509845942070..bfd9900742bf 100644
--- a/include/asm-x86/kvm_para.h
+++ b/include/asm-x86/kvm_para.h
@@ -48,24 +48,6 @@ struct kvm_mmu_op_release_pt {
48#ifdef __KERNEL__ 48#ifdef __KERNEL__
49#include <asm/processor.h> 49#include <asm/processor.h>
50 50
51/* xen binary-compatible interface. See xen headers for details */
52struct kvm_vcpu_time_info {
53 uint32_t version;
54 uint32_t pad0;
55 uint64_t tsc_timestamp;
56 uint64_t system_time;
57 uint32_t tsc_to_system_mul;
58 int8_t tsc_shift;
59 int8_t pad[3];
60} __attribute__((__packed__)); /* 32 bytes */
61
62struct kvm_wall_clock {
63 uint32_t wc_version;
64 uint32_t wc_sec;
65 uint32_t wc_nsec;
66} __attribute__((__packed__));
67
68
69extern void kvmclock_init(void); 51extern void kvmclock_init(void);
70 52
71 53
diff --git a/include/asm-x86/msr.h b/include/asm-x86/msr.h
index 3707650a169b..2b5f2c91db25 100644
--- a/include/asm-x86/msr.h
+++ b/include/asm-x86/msr.h
@@ -18,7 +18,7 @@ static inline unsigned long long native_read_tscp(unsigned int *aux)
18 unsigned long low, high; 18 unsigned long low, high;
19 asm volatile(".byte 0x0f,0x01,0xf9" 19 asm volatile(".byte 0x0f,0x01,0xf9"
20 : "=a" (low), "=d" (high), "=c" (*aux)); 20 : "=a" (low), "=d" (high), "=c" (*aux));
21 return low | ((u64)high >> 32); 21 return low | ((u64)high << 32);
22} 22}
23 23
24/* 24/*
diff --git a/include/asm-x86/pvclock-abi.h b/include/asm-x86/pvclock-abi.h
new file mode 100644
index 000000000000..6857f840b243
--- /dev/null
+++ b/include/asm-x86/pvclock-abi.h
@@ -0,0 +1,42 @@
1#ifndef _ASM_X86_PVCLOCK_ABI_H_
2#define _ASM_X86_PVCLOCK_ABI_H_
3#ifndef __ASSEMBLY__
4
5/*
6 * These structs MUST NOT be changed.
7 * They are the ABI between hypervisor and guest OS.
8 * Both Xen and KVM are using this.
9 *
10 * pvclock_vcpu_time_info holds the system time and the tsc timestamp
11 * of the last update. So the guest can use the tsc delta to get a
12 * more precise system time. There is one per virtual cpu.
13 *
14 * pvclock_wall_clock references the point in time when the system
15 * time was zero (usually boot time), thus the guest calculates the
16 * current wall clock by adding the system time.
17 *
18 * Protocol for the "version" fields is: hypervisor raises it (making
19 * it uneven) before it starts updating the fields and raises it again
20 * (making it even) when it is done. Thus the guest can make sure the
21 * time values it got are consistent by checking the version before
22 * and after reading them.
23 */
24
25struct pvclock_vcpu_time_info {
26 u32 version;
27 u32 pad0;
28 u64 tsc_timestamp;
29 u64 system_time;
30 u32 tsc_to_system_mul;
31 s8 tsc_shift;
32 u8 pad[3];
33} __attribute__((__packed__)); /* 32 bytes */
34
35struct pvclock_wall_clock {
36 u32 version;
37 u32 sec;
38 u32 nsec;
39} __attribute__((__packed__));
40
41#endif /* __ASSEMBLY__ */
42#endif /* _ASM_X86_PVCLOCK_ABI_H_ */
diff --git a/include/asm-x86/pvclock.h b/include/asm-x86/pvclock.h
new file mode 100644
index 000000000000..85b1bba8e0a3
--- /dev/null
+++ b/include/asm-x86/pvclock.h
@@ -0,0 +1,13 @@
1#ifndef _ASM_X86_PVCLOCK_H_
2#define _ASM_X86_PVCLOCK_H_
3
4#include <linux/clocksource.h>
5#include <asm/pvclock-abi.h>
6
7/* some helper functions for xen and kvm pv clock sources */
8cycle_t pvclock_clocksource_read(struct pvclock_vcpu_time_info *src);
9void pvclock_read_wallclock(struct pvclock_wall_clock *wall,
10 struct pvclock_vcpu_time_info *vcpu,
11 struct timespec *ts);
12
13#endif /* _ASM_X86_PVCLOCK_H_ */
diff --git a/include/asm-x86/xen/page.h b/include/asm-x86/xen/page.h
index baf3a4dce28c..e11f24038b1d 100644
--- a/include/asm-x86/xen/page.h
+++ b/include/asm-x86/xen/page.h
@@ -150,13 +150,9 @@ static inline pte_t __pte_ma(pteval_t x)
150 return (pte_t) { .pte = x }; 150 return (pte_t) { .pte = x };
151} 151}
152 152
153#ifdef CONFIG_X86_PAE
154#define pmd_val_ma(v) ((v).pmd) 153#define pmd_val_ma(v) ((v).pmd)
155#define pud_val_ma(v) ((v).pgd.pgd) 154#define pud_val_ma(v) ((v).pgd.pgd)
156#define __pmd_ma(x) ((pmd_t) { (x) } ) 155#define __pmd_ma(x) ((pmd_t) { (x) } )
157#else /* !X86_PAE */
158#define pmd_val_ma(v) ((v).pud.pgd.pgd)
159#endif /* CONFIG_X86_PAE */
160 156
161#define pgd_val_ma(x) ((x).pgd) 157#define pgd_val_ma(x) ((x).pgd)
162 158
diff --git a/include/linux/Kbuild b/include/linux/Kbuild
index b6fbb2573e88..71d70d1fbce2 100644
--- a/include/linux/Kbuild
+++ b/include/linux/Kbuild
@@ -166,7 +166,7 @@ unifdef-y += acct.h
166unifdef-y += adb.h 166unifdef-y += adb.h
167unifdef-y += adfs_fs.h 167unifdef-y += adfs_fs.h
168unifdef-y += agpgart.h 168unifdef-y += agpgart.h
169ifeq ($(wildcard include/asm-$(SRCARCH)/a.out.h),include/asm-$(SRCARCH)/a.out.h) 169ifneq ($(wildcard $(srctree)/include/asm-$(SRCARCH)/a.out.h),)
170unifdef-y += a.out.h 170unifdef-y += a.out.h
171endif 171endif
172unifdef-y += apm_bios.h 172unifdef-y += apm_bios.h
diff --git a/include/linux/audit.h b/include/linux/audit.h
index 63c3bb98558f..8b82974bdc12 100644
--- a/include/linux/audit.h
+++ b/include/linux/audit.h
@@ -571,7 +571,7 @@ extern void audit_log_lost(const char *message);
571extern int audit_update_lsm_rules(void); 571extern int audit_update_lsm_rules(void);
572 572
573 /* Private API (for audit.c only) */ 573 /* Private API (for audit.c only) */
574extern int audit_filter_user(struct netlink_skb_parms *cb, int type); 574extern int audit_filter_user(struct netlink_skb_parms *cb);
575extern int audit_filter_type(int type); 575extern int audit_filter_type(int type);
576extern int audit_receive_filter(int type, int pid, int uid, int seq, 576extern int audit_receive_filter(int type, int pid, int uid, int seq,
577 void *data, size_t datasz, uid_t loginuid, 577 void *data, size_t datasz, uid_t loginuid,
diff --git a/include/linux/bootmem.h b/include/linux/bootmem.h
index 6a5dbdc8a7dc..686895bacd9d 100644
--- a/include/linux/bootmem.h
+++ b/include/linux/bootmem.h
@@ -94,7 +94,7 @@ extern unsigned long init_bootmem_node(pg_data_t *pgdat,
94 unsigned long freepfn, 94 unsigned long freepfn,
95 unsigned long startpfn, 95 unsigned long startpfn,
96 unsigned long endpfn); 96 unsigned long endpfn);
97extern void reserve_bootmem_node(pg_data_t *pgdat, 97extern int reserve_bootmem_node(pg_data_t *pgdat,
98 unsigned long physaddr, 98 unsigned long physaddr,
99 unsigned long size, 99 unsigned long size,
100 int flags); 100 int flags);
diff --git a/include/linux/dcache.h b/include/linux/dcache.h
index 2a6639407c80..d982eb89c77d 100644
--- a/include/linux/dcache.h
+++ b/include/linux/dcache.h
@@ -300,7 +300,7 @@ extern int d_validate(struct dentry *, struct dentry *);
300extern char *dynamic_dname(struct dentry *, char *, int, const char *, ...); 300extern char *dynamic_dname(struct dentry *, char *, int, const char *, ...);
301 301
302extern char *__d_path(const struct path *path, struct path *root, char *, int); 302extern char *__d_path(const struct path *path, struct path *root, char *, int);
303extern char *d_path(struct path *, char *, int); 303extern char *d_path(const struct path *, char *, int);
304extern char *dentry_path(struct dentry *, char *, int); 304extern char *dentry_path(struct dentry *, char *, int);
305 305
306/* Allocation counts.. */ 306/* Allocation counts.. */
diff --git a/include/linux/fs.h b/include/linux/fs.h
index d490779f18d9..d8e2762ed14d 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -83,6 +83,7 @@ extern int dir_notify_enable;
83#define READ_SYNC (READ | (1 << BIO_RW_SYNC)) 83#define READ_SYNC (READ | (1 << BIO_RW_SYNC))
84#define READ_META (READ | (1 << BIO_RW_META)) 84#define READ_META (READ | (1 << BIO_RW_META))
85#define WRITE_SYNC (WRITE | (1 << BIO_RW_SYNC)) 85#define WRITE_SYNC (WRITE | (1 << BIO_RW_SYNC))
86#define SWRITE_SYNC (SWRITE | (1 << BIO_RW_SYNC))
86#define WRITE_BARRIER ((1 << BIO_RW) | (1 << BIO_RW_BARRIER)) 87#define WRITE_BARRIER ((1 << BIO_RW) | (1 << BIO_RW_BARRIER))
87 88
88#define SEL_IN 1 89#define SEL_IN 1
@@ -894,8 +895,6 @@ static inline int file_check_writeable(struct file *filp)
894typedef struct files_struct *fl_owner_t; 895typedef struct files_struct *fl_owner_t;
895 896
896struct file_lock_operations { 897struct file_lock_operations {
897 void (*fl_insert)(struct file_lock *); /* lock insertion callback */
898 void (*fl_remove)(struct file_lock *); /* lock removal callback */
899 void (*fl_copy_lock)(struct file_lock *, struct file_lock *); 898 void (*fl_copy_lock)(struct file_lock *, struct file_lock *);
900 void (*fl_release_private)(struct file_lock *); 899 void (*fl_release_private)(struct file_lock *);
901}; 900};
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index fb9af6a0fe9c..8dc730132192 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -171,7 +171,7 @@ struct i2c_client {
171 struct i2c_adapter *adapter; /* the adapter we sit on */ 171 struct i2c_adapter *adapter; /* the adapter we sit on */
172 struct i2c_driver *driver; /* and our access routines */ 172 struct i2c_driver *driver; /* and our access routines */
173 struct device dev; /* the device structure */ 173 struct device dev; /* the device structure */
174 int irq; /* irq issued by device (or -1) */ 174 int irq; /* irq issued by device */
175 struct list_head list; /* DEPRECATED */ 175 struct list_head list; /* DEPRECATED */
176 struct completion released; 176 struct completion released;
177}; 177};
diff --git a/include/linux/inet_lro.h b/include/linux/inet_lro.h
index 80335b7d77c5..c4335faebb63 100644
--- a/include/linux/inet_lro.h
+++ b/include/linux/inet_lro.h
@@ -84,7 +84,11 @@ struct net_lro_mgr {
84 from received packets and eth protocol 84 from received packets and eth protocol
85 is still ETH_P_8021Q */ 85 is still ETH_P_8021Q */
86 86
87 u32 ip_summed; /* Set in non generated SKBs in page mode */ 87 /*
88 * Set for generated SKBs that are not added to
89 * the frag list in fragmented mode
90 */
91 u32 ip_summed;
88 u32 ip_summed_aggr; /* Set in aggregated SKBs: CHECKSUM_UNNECESSARY 92 u32 ip_summed_aggr; /* Set in aggregated SKBs: CHECKSUM_UNNECESSARY
89 * or CHECKSUM_NONE */ 93 * or CHECKSUM_NONE */
90 94
diff --git a/include/linux/input.h b/include/linux/input.h
index e075c4b762fb..d150c57e5f0a 100644
--- a/include/linux/input.h
+++ b/include/linux/input.h
@@ -534,8 +534,8 @@ struct input_absinfo {
534 534
535#define KEY_FRAMEBACK 0x1b4 /* Consumer - transport controls */ 535#define KEY_FRAMEBACK 0x1b4 /* Consumer - transport controls */
536#define KEY_FRAMEFORWARD 0x1b5 536#define KEY_FRAMEFORWARD 0x1b5
537
538#define KEY_CONTEXT_MENU 0x1b6 /* GenDesc - system context menu */ 537#define KEY_CONTEXT_MENU 0x1b6 /* GenDesc - system context menu */
538#define KEY_MEDIA_REPEAT 0x1b7 /* Consumer - transport control */
539 539
540#define KEY_DEL_EOL 0x1c0 540#define KEY_DEL_EOL 0x1c0
541#define KEY_DEL_EOS 0x1c1 541#define KEY_DEL_EOS 0x1c1
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index 092b1b25291d..de9d1df4bba2 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -33,6 +33,7 @@
33#define KVM_REQ_REPORT_TPR_ACCESS 2 33#define KVM_REQ_REPORT_TPR_ACCESS 2
34#define KVM_REQ_MMU_RELOAD 3 34#define KVM_REQ_MMU_RELOAD 3
35#define KVM_REQ_TRIPLE_FAULT 4 35#define KVM_REQ_TRIPLE_FAULT 4
36#define KVM_REQ_PENDING_TIMER 5
36 37
37struct kvm_vcpu; 38struct kvm_vcpu;
38extern struct kmem_cache *kvm_vcpu_cache; 39extern struct kmem_cache *kvm_vcpu_cache;
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index f27fd2009334..25f87102ab66 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -88,6 +88,8 @@ struct wireless_dev;
88#define NETDEV_TX_BUSY 1 /* driver tx path was busy*/ 88#define NETDEV_TX_BUSY 1 /* driver tx path was busy*/
89#define NETDEV_TX_LOCKED -1 /* driver tx lock was already taken */ 89#define NETDEV_TX_LOCKED -1 /* driver tx lock was already taken */
90 90
91#ifdef __KERNEL__
92
91/* 93/*
92 * Compute the worst case header length according to the protocols 94 * Compute the worst case header length according to the protocols
93 * used. 95 * used.
@@ -114,6 +116,8 @@ struct wireless_dev;
114#define MAX_HEADER (LL_MAX_HEADER + 48) 116#define MAX_HEADER (LL_MAX_HEADER + 48)
115#endif 117#endif
116 118
119#endif /* __KERNEL__ */
120
117struct net_device_subqueue 121struct net_device_subqueue
118{ 122{
119 /* Give a control state for each queue. This struct may contain 123 /* Give a control state for each queue. This struct may contain
diff --git a/include/linux/thermal.h b/include/linux/thermal.h
index 06d3e6eb9ca8..917707e6151d 100644
--- a/include/linux/thermal.h
+++ b/include/linux/thermal.h
@@ -66,8 +66,7 @@ struct thermal_cooling_device {
66 ((long)t-2732+5)/10 : ((long)t-2732-5)/10) 66 ((long)t-2732+5)/10 : ((long)t-2732-5)/10)
67#define CELSIUS_TO_KELVIN(t) ((t)*10+2732) 67#define CELSIUS_TO_KELVIN(t) ((t)*10+2732)
68 68
69#if defined(CONFIG_HWMON) || \ 69#if defined(CONFIG_THERMAL_HWMON)
70 (defined(CONFIG_HWMON_MODULE) && defined(CONFIG_THERMAL_MODULE))
71/* thermal zone devices with the same type share one hwmon device */ 70/* thermal zone devices with the same type share one hwmon device */
72struct thermal_hwmon_device { 71struct thermal_hwmon_device {
73 char type[THERMAL_NAME_LENGTH]; 72 char type[THERMAL_NAME_LENGTH];
@@ -94,8 +93,7 @@ struct thermal_zone_device {
94 struct idr idr; 93 struct idr idr;
95 struct mutex lock; /* protect cooling devices list */ 94 struct mutex lock; /* protect cooling devices list */
96 struct list_head node; 95 struct list_head node;
97#if defined(CONFIG_HWMON) || \ 96#if defined(CONFIG_THERMAL_HWMON)
98 (defined(CONFIG_HWMON_MODULE) && defined(CONFIG_THERMAL_MODULE))
99 struct list_head hwmon_node; 97 struct list_head hwmon_node;
100 struct thermal_hwmon_device *hwmon; 98 struct thermal_hwmon_device *hwmon;
101 struct thermal_hwmon_attr temp_input; /* hwmon sys attr */ 99 struct thermal_hwmon_attr temp_input; /* hwmon sys attr */
diff --git a/include/linux/tty_driver.h b/include/linux/tty_driver.h
index 59f1c0bd8f9c..d2a003586761 100644
--- a/include/linux/tty_driver.h
+++ b/include/linux/tty_driver.h
@@ -27,8 +27,7 @@
27 * This routine is called by the kernel to write a series of 27 * This routine is called by the kernel to write a series of
28 * characters to the tty device. The characters may come from 28 * characters to the tty device. The characters may come from
29 * user space or kernel space. This routine will return the 29 * user space or kernel space. This routine will return the
30 * number of characters actually accepted for writing. This 30 * number of characters actually accepted for writing.
31 * routine is mandatory.
32 * 31 *
33 * Optional: Required for writable devices. 32 * Optional: Required for writable devices.
34 * 33 *
@@ -134,7 +133,7 @@
134 * This routine notifies the tty driver that it should hangup the 133 * This routine notifies the tty driver that it should hangup the
135 * tty device. 134 * tty device.
136 * 135 *
137 * Required: 136 * Optional:
138 * 137 *
139 * void (*break_ctl)(struct tty_stuct *tty, int state); 138 * void (*break_ctl)(struct tty_stuct *tty, int state);
140 * 139 *
diff --git a/include/media/cx25840.h b/include/media/cx25840.h
index cd599ad29fb2..db431d513f2f 100644
--- a/include/media/cx25840.h
+++ b/include/media/cx25840.h
@@ -32,12 +32,16 @@ enum cx25840_video_input {
32 CX25840_COMPOSITE7, 32 CX25840_COMPOSITE7,
33 CX25840_COMPOSITE8, 33 CX25840_COMPOSITE8,
34 34
35 /* S-Video inputs consist of one luma input (In1-In4) ORed with one 35 /* S-Video inputs consist of one luma input (In1-In8) ORed with one
36 chroma input (In5-In8) */ 36 chroma input (In5-In8) */
37 CX25840_SVIDEO_LUMA1 = 0x10, 37 CX25840_SVIDEO_LUMA1 = 0x10,
38 CX25840_SVIDEO_LUMA2 = 0x20, 38 CX25840_SVIDEO_LUMA2 = 0x20,
39 CX25840_SVIDEO_LUMA3 = 0x30, 39 CX25840_SVIDEO_LUMA3 = 0x30,
40 CX25840_SVIDEO_LUMA4 = 0x40, 40 CX25840_SVIDEO_LUMA4 = 0x40,
41 CX25840_SVIDEO_LUMA5 = 0x50,
42 CX25840_SVIDEO_LUMA6 = 0x60,
43 CX25840_SVIDEO_LUMA7 = 0x70,
44 CX25840_SVIDEO_LUMA8 = 0x80,
41 CX25840_SVIDEO_CHROMA4 = 0x400, 45 CX25840_SVIDEO_CHROMA4 = 0x400,
42 CX25840_SVIDEO_CHROMA5 = 0x500, 46 CX25840_SVIDEO_CHROMA5 = 0x500,
43 CX25840_SVIDEO_CHROMA6 = 0x600, 47 CX25840_SVIDEO_CHROMA6 = 0x600,
diff --git a/include/media/ir-common.h b/include/media/ir-common.h
index bfee8be5d63f..b8e8aa91905a 100644
--- a/include/media/ir-common.h
+++ b/include/media/ir-common.h
@@ -146,6 +146,7 @@ extern IR_KEYTAB_TYPE ir_codes_behold_columbus[IR_KEYTAB_SIZE];
146extern IR_KEYTAB_TYPE ir_codes_pinnacle_pctv_hd[IR_KEYTAB_SIZE]; 146extern IR_KEYTAB_TYPE ir_codes_pinnacle_pctv_hd[IR_KEYTAB_SIZE];
147extern IR_KEYTAB_TYPE ir_codes_genius_tvgo_a11mce[IR_KEYTAB_SIZE]; 147extern IR_KEYTAB_TYPE ir_codes_genius_tvgo_a11mce[IR_KEYTAB_SIZE];
148extern IR_KEYTAB_TYPE ir_codes_powercolor_real_angel[IR_KEYTAB_SIZE]; 148extern IR_KEYTAB_TYPE ir_codes_powercolor_real_angel[IR_KEYTAB_SIZE];
149extern IR_KEYTAB_TYPE ir_codes_avermedia_a16d[IR_KEYTAB_SIZE];
149 150
150#endif 151#endif
151 152
diff --git a/include/media/v4l2-dev.h b/include/media/v4l2-dev.h
index 33f01ae08f76..859f7a6f6f67 100644
--- a/include/media/v4l2-dev.h
+++ b/include/media/v4l2-dev.h
@@ -40,9 +40,9 @@
40#define VFL_TYPE_VTX 3 40#define VFL_TYPE_VTX 3
41 41
42/* Video standard functions */ 42/* Video standard functions */
43extern char *v4l2_norm_to_name(v4l2_std_id id); 43extern const char *v4l2_norm_to_name(v4l2_std_id id);
44extern int v4l2_video_std_construct(struct v4l2_standard *vs, 44extern int v4l2_video_std_construct(struct v4l2_standard *vs,
45 int id, char *name); 45 int id, const char *name);
46/* Prints the ioctl in a human-readable format */ 46/* Prints the ioctl in a human-readable format */
47extern void v4l_printk_ioctl(unsigned int cmd); 47extern void v4l_printk_ioctl(unsigned int cmd);
48 48
diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index e0a612bc9c4e..f422f7218e1c 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -367,6 +367,12 @@ static inline int ipv6_addr_any(const struct in6_addr *a)
367 a->s6_addr32[2] | a->s6_addr32[3] ) == 0); 367 a->s6_addr32[2] | a->s6_addr32[3] ) == 0);
368} 368}
369 369
370static inline int ipv6_addr_loopback(const struct in6_addr *a)
371{
372 return ((a->s6_addr32[0] | a->s6_addr32[1] |
373 a->s6_addr32[2] | (a->s6_addr32[3] ^ htonl(1))) == 0);
374}
375
370static inline int ipv6_addr_v4mapped(const struct in6_addr *a) 376static inline int ipv6_addr_v4mapped(const struct in6_addr *a)
371{ 377{
372 return ((a->s6_addr32[0] | a->s6_addr32[1] | 378 return ((a->s6_addr32[0] | a->s6_addr32[1] |
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index dae3f9ec1154..bcd1623245cb 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -595,6 +595,15 @@ enum ieee80211_key_alg {
595 ALG_CCMP, 595 ALG_CCMP,
596}; 596};
597 597
598/**
599 * enum ieee80211_key_len - key length
600 * @WEP40: WEP 5 byte long key
601 * @WEP104: WEP 13 byte long key
602 */
603enum ieee80211_key_len {
604 LEN_WEP40 = 5,
605 LEN_WEP104 = 13,
606};
598 607
599/** 608/**
600 * enum ieee80211_key_flags - key flags 609 * enum ieee80211_key_flags - key flags
diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h
index aa540e6be502..d9dd0f707296 100644
--- a/include/net/net_namespace.h
+++ b/include/net/net_namespace.h
@@ -95,6 +95,11 @@ extern struct list_head net_namespace_list;
95#ifdef CONFIG_NET_NS 95#ifdef CONFIG_NET_NS
96extern void __put_net(struct net *net); 96extern void __put_net(struct net *net);
97 97
98static inline int net_alive(struct net *net)
99{
100 return net && atomic_read(&net->count);
101}
102
98static inline struct net *get_net(struct net *net) 103static inline struct net *get_net(struct net *net)
99{ 104{
100 atomic_inc(&net->count); 105 atomic_inc(&net->count);
@@ -125,6 +130,12 @@ int net_eq(const struct net *net1, const struct net *net2)
125 return net1 == net2; 130 return net1 == net2;
126} 131}
127#else 132#else
133
134static inline int net_alive(struct net *net)
135{
136 return 1;
137}
138
128static inline struct net *get_net(struct net *net) 139static inline struct net *get_net(struct net *net)
129{ 140{
130 return net; 141 return net;
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
index ab502ec1c61c..a87fc0312edc 100644
--- a/include/net/sch_generic.h
+++ b/include/net/sch_generic.h
@@ -178,7 +178,7 @@ extern struct Qdisc *qdisc_alloc(struct net_device *dev, struct Qdisc_ops *ops);
178extern struct Qdisc *qdisc_create_dflt(struct net_device *dev, 178extern struct Qdisc *qdisc_create_dflt(struct net_device *dev,
179 struct Qdisc_ops *ops, u32 parentid); 179 struct Qdisc_ops *ops, u32 parentid);
180extern void tcf_destroy(struct tcf_proto *tp); 180extern void tcf_destroy(struct tcf_proto *tp);
181extern void tcf_destroy_chain(struct tcf_proto *fl); 181extern void tcf_destroy_chain(struct tcf_proto **fl);
182 182
183static inline int __qdisc_enqueue_tail(struct sk_buff *skb, struct Qdisc *sch, 183static inline int __qdisc_enqueue_tail(struct sk_buff *skb, struct Qdisc *sch,
184 struct sk_buff_head *list) 184 struct sk_buff_head *list)
diff --git a/include/xen/interface/xen.h b/include/xen/interface/xen.h
index 9b018da48cf3..819a0331cda9 100644
--- a/include/xen/interface/xen.h
+++ b/include/xen/interface/xen.h
@@ -10,6 +10,7 @@
10#define __XEN_PUBLIC_XEN_H__ 10#define __XEN_PUBLIC_XEN_H__
11 11
12#include <asm/xen/interface.h> 12#include <asm/xen/interface.h>
13#include <asm/pvclock-abi.h>
13 14
14/* 15/*
15 * XEN "SYSTEM CALLS" (a.k.a. HYPERCALLS). 16 * XEN "SYSTEM CALLS" (a.k.a. HYPERCALLS).
@@ -336,7 +337,7 @@ struct vcpu_info {
336 uint8_t evtchn_upcall_mask; 337 uint8_t evtchn_upcall_mask;
337 unsigned long evtchn_pending_sel; 338 unsigned long evtchn_pending_sel;
338 struct arch_vcpu_info arch; 339 struct arch_vcpu_info arch;
339 struct vcpu_time_info time; 340 struct pvclock_vcpu_time_info time;
340}; /* 64 bytes (x86) */ 341}; /* 64 bytes (x86) */
341 342
342/* 343/*
@@ -384,9 +385,7 @@ struct shared_info {
384 * Wallclock time: updated only by control software. Guests should base 385 * Wallclock time: updated only by control software. Guests should base
385 * their gettimeofday() syscall on this wallclock-base value. 386 * their gettimeofday() syscall on this wallclock-base value.
386 */ 387 */
387 uint32_t wc_version; /* Version counter: see vcpu_time_info_t. */ 388 struct pvclock_wall_clock wc;
388 uint32_t wc_sec; /* Secs 00:00:00 UTC, Jan 1, 1970. */
389 uint32_t wc_nsec; /* Nsecs 00:00:00 UTC, Jan 1, 1970. */
390 389
391 struct arch_shared_info arch; 390 struct arch_shared_info arch;
392 391
diff --git a/kernel/audit.c b/kernel/audit.c
index e8692a5748c2..e092f1c0ce30 100644
--- a/kernel/audit.c
+++ b/kernel/audit.c
@@ -738,7 +738,7 @@ static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
738 if (!audit_enabled && msg_type != AUDIT_USER_AVC) 738 if (!audit_enabled && msg_type != AUDIT_USER_AVC)
739 return 0; 739 return 0;
740 740
741 err = audit_filter_user(&NETLINK_CB(skb), msg_type); 741 err = audit_filter_user(&NETLINK_CB(skb));
742 if (err == 1) { 742 if (err == 1) {
743 err = 0; 743 err = 0;
744 if (msg_type == AUDIT_USER_TTY) { 744 if (msg_type == AUDIT_USER_TTY) {
@@ -779,7 +779,7 @@ static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
779 } 779 }
780 /* fallthrough */ 780 /* fallthrough */
781 case AUDIT_LIST: 781 case AUDIT_LIST:
782 err = audit_receive_filter(nlh->nlmsg_type, NETLINK_CB(skb).pid, 782 err = audit_receive_filter(msg_type, NETLINK_CB(skb).pid,
783 uid, seq, data, nlmsg_len(nlh), 783 uid, seq, data, nlmsg_len(nlh),
784 loginuid, sessionid, sid); 784 loginuid, sessionid, sid);
785 break; 785 break;
@@ -798,7 +798,7 @@ static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
798 } 798 }
799 /* fallthrough */ 799 /* fallthrough */
800 case AUDIT_LIST_RULES: 800 case AUDIT_LIST_RULES:
801 err = audit_receive_filter(nlh->nlmsg_type, NETLINK_CB(skb).pid, 801 err = audit_receive_filter(msg_type, NETLINK_CB(skb).pid,
802 uid, seq, data, nlmsg_len(nlh), 802 uid, seq, data, nlmsg_len(nlh),
803 loginuid, sessionid, sid); 803 loginuid, sessionid, sid);
804 break; 804 break;
diff --git a/kernel/auditfilter.c b/kernel/auditfilter.c
index 0e0bd27e6512..98c50cc671bb 100644
--- a/kernel/auditfilter.c
+++ b/kernel/auditfilter.c
@@ -1544,6 +1544,7 @@ static void audit_log_rule_change(uid_t loginuid, u32 sessionid, u32 sid,
1544 * @data: payload data 1544 * @data: payload data
1545 * @datasz: size of payload data 1545 * @datasz: size of payload data
1546 * @loginuid: loginuid of sender 1546 * @loginuid: loginuid of sender
1547 * @sessionid: sessionid for netlink audit message
1547 * @sid: SE Linux Security ID of sender 1548 * @sid: SE Linux Security ID of sender
1548 */ 1549 */
1549int audit_receive_filter(int type, int pid, int uid, int seq, void *data, 1550int audit_receive_filter(int type, int pid, int uid, int seq, void *data,
@@ -1720,7 +1721,7 @@ static int audit_filter_user_rules(struct netlink_skb_parms *cb,
1720 return 1; 1721 return 1;
1721} 1722}
1722 1723
1723int audit_filter_user(struct netlink_skb_parms *cb, int type) 1724int audit_filter_user(struct netlink_skb_parms *cb)
1724{ 1725{
1725 enum audit_state state = AUDIT_DISABLED; 1726 enum audit_state state = AUDIT_DISABLED;
1726 struct audit_entry *e; 1727 struct audit_entry *e;
diff --git a/kernel/futex.c b/kernel/futex.c
index 449def8074fe..7d1136e97c14 100644
--- a/kernel/futex.c
+++ b/kernel/futex.c
@@ -1096,21 +1096,64 @@ static void unqueue_me_pi(struct futex_q *q)
1096 * private futexes. 1096 * private futexes.
1097 */ 1097 */
1098static int fixup_pi_state_owner(u32 __user *uaddr, struct futex_q *q, 1098static int fixup_pi_state_owner(u32 __user *uaddr, struct futex_q *q,
1099 struct task_struct *newowner) 1099 struct task_struct *newowner,
1100 struct rw_semaphore *fshared)
1100{ 1101{
1101 u32 newtid = task_pid_vnr(newowner) | FUTEX_WAITERS; 1102 u32 newtid = task_pid_vnr(newowner) | FUTEX_WAITERS;
1102 struct futex_pi_state *pi_state = q->pi_state; 1103 struct futex_pi_state *pi_state = q->pi_state;
1104 struct task_struct *oldowner = pi_state->owner;
1103 u32 uval, curval, newval; 1105 u32 uval, curval, newval;
1104 int ret; 1106 int ret, attempt = 0;
1105 1107
1106 /* Owner died? */ 1108 /* Owner died? */
1109 if (!pi_state->owner)
1110 newtid |= FUTEX_OWNER_DIED;
1111
1112 /*
1113 * We are here either because we stole the rtmutex from the
1114 * pending owner or we are the pending owner which failed to
1115 * get the rtmutex. We have to replace the pending owner TID
1116 * in the user space variable. This must be atomic as we have
1117 * to preserve the owner died bit here.
1118 *
1119 * Note: We write the user space value _before_ changing the
1120 * pi_state because we can fault here. Imagine swapped out
1121 * pages or a fork, which was running right before we acquired
1122 * mmap_sem, that marked all the anonymous memory readonly for
1123 * cow.
1124 *
1125 * Modifying pi_state _before_ the user space value would
1126 * leave the pi_state in an inconsistent state when we fault
1127 * here, because we need to drop the hash bucket lock to
1128 * handle the fault. This might be observed in the PID check
1129 * in lookup_pi_state.
1130 */
1131retry:
1132 if (get_futex_value_locked(&uval, uaddr))
1133 goto handle_fault;
1134
1135 while (1) {
1136 newval = (uval & FUTEX_OWNER_DIED) | newtid;
1137
1138 curval = cmpxchg_futex_value_locked(uaddr, uval, newval);
1139
1140 if (curval == -EFAULT)
1141 goto handle_fault;
1142 if (curval == uval)
1143 break;
1144 uval = curval;
1145 }
1146
1147 /*
1148 * We fixed up user space. Now we need to fix the pi_state
1149 * itself.
1150 */
1107 if (pi_state->owner != NULL) { 1151 if (pi_state->owner != NULL) {
1108 spin_lock_irq(&pi_state->owner->pi_lock); 1152 spin_lock_irq(&pi_state->owner->pi_lock);
1109 WARN_ON(list_empty(&pi_state->list)); 1153 WARN_ON(list_empty(&pi_state->list));
1110 list_del_init(&pi_state->list); 1154 list_del_init(&pi_state->list);
1111 spin_unlock_irq(&pi_state->owner->pi_lock); 1155 spin_unlock_irq(&pi_state->owner->pi_lock);
1112 } else 1156 }
1113 newtid |= FUTEX_OWNER_DIED;
1114 1157
1115 pi_state->owner = newowner; 1158 pi_state->owner = newowner;
1116 1159
@@ -1118,26 +1161,35 @@ static int fixup_pi_state_owner(u32 __user *uaddr, struct futex_q *q,
1118 WARN_ON(!list_empty(&pi_state->list)); 1161 WARN_ON(!list_empty(&pi_state->list));
1119 list_add(&pi_state->list, &newowner->pi_state_list); 1162 list_add(&pi_state->list, &newowner->pi_state_list);
1120 spin_unlock_irq(&newowner->pi_lock); 1163 spin_unlock_irq(&newowner->pi_lock);
1164 return 0;
1121 1165
1122 /* 1166 /*
1123 * We own it, so we have to replace the pending owner 1167 * To handle the page fault we need to drop the hash bucket
1124 * TID. This must be atomic as we have preserve the 1168 * lock here. That gives the other task (either the pending
1125 * owner died bit here. 1169 * owner itself or the task which stole the rtmutex) the
1170 * chance to try the fixup of the pi_state. So once we are
1171 * back from handling the fault we need to check the pi_state
1172 * after reacquiring the hash bucket lock and before trying to
1173 * do another fixup. When the fixup has been done already we
1174 * simply return.
1126 */ 1175 */
1127 ret = get_futex_value_locked(&uval, uaddr); 1176handle_fault:
1177 spin_unlock(q->lock_ptr);
1128 1178
1129 while (!ret) { 1179 ret = futex_handle_fault((unsigned long)uaddr, fshared, attempt++);
1130 newval = (uval & FUTEX_OWNER_DIED) | newtid;
1131 1180
1132 curval = cmpxchg_futex_value_locked(uaddr, uval, newval); 1181 spin_lock(q->lock_ptr);
1133 1182
1134 if (curval == -EFAULT) 1183 /*
1135 ret = -EFAULT; 1184 * Check if someone else fixed it for us:
1136 if (curval == uval) 1185 */
1137 break; 1186 if (pi_state->owner != oldowner)
1138 uval = curval; 1187 return 0;
1139 } 1188
1140 return ret; 1189 if (ret)
1190 return ret;
1191
1192 goto retry;
1141} 1193}
1142 1194
1143/* 1195/*
@@ -1507,7 +1559,7 @@ static int futex_lock_pi(u32 __user *uaddr, struct rw_semaphore *fshared,
1507 * that case: 1559 * that case:
1508 */ 1560 */
1509 if (q.pi_state->owner != curr) 1561 if (q.pi_state->owner != curr)
1510 ret = fixup_pi_state_owner(uaddr, &q, curr); 1562 ret = fixup_pi_state_owner(uaddr, &q, curr, fshared);
1511 } else { 1563 } else {
1512 /* 1564 /*
1513 * Catch the rare case, where the lock was released 1565 * Catch the rare case, where the lock was released
@@ -1539,7 +1591,8 @@ static int futex_lock_pi(u32 __user *uaddr, struct rw_semaphore *fshared,
1539 int res; 1591 int res;
1540 1592
1541 owner = rt_mutex_owner(&q.pi_state->pi_mutex); 1593 owner = rt_mutex_owner(&q.pi_state->pi_mutex);
1542 res = fixup_pi_state_owner(uaddr, &q, owner); 1594 res = fixup_pi_state_owner(uaddr, &q, owner,
1595 fshared);
1543 1596
1544 /* propagate -EFAULT, if the fixup failed */ 1597 /* propagate -EFAULT, if the fixup failed */
1545 if (res) 1598 if (res)
diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c
index 421be5fe5cc7..543d9ca9b4f4 100644
--- a/kernel/hrtimer.c
+++ b/kernel/hrtimer.c
@@ -1078,7 +1078,7 @@ ktime_t hrtimer_get_remaining(const struct hrtimer *timer)
1078} 1078}
1079EXPORT_SYMBOL_GPL(hrtimer_get_remaining); 1079EXPORT_SYMBOL_GPL(hrtimer_get_remaining);
1080 1080
1081#if defined(CONFIG_NO_IDLE_HZ) || defined(CONFIG_NO_HZ) 1081#ifdef CONFIG_NO_HZ
1082/** 1082/**
1083 * hrtimer_get_next_event - get the time until next expiry event 1083 * hrtimer_get_next_event - get the time until next expiry event
1084 * 1084 *
diff --git a/kernel/kgdb.c b/kernel/kgdb.c
index 79e3c90113c2..3ec23c3ec97f 100644
--- a/kernel/kgdb.c
+++ b/kernel/kgdb.c
@@ -1499,7 +1499,8 @@ int kgdb_nmicallback(int cpu, void *regs)
1499 return 1; 1499 return 1;
1500} 1500}
1501 1501
1502void kgdb_console_write(struct console *co, const char *s, unsigned count) 1502static void kgdb_console_write(struct console *co, const char *s,
1503 unsigned count)
1503{ 1504{
1504 unsigned long flags; 1505 unsigned long flags;
1505 1506
diff --git a/kernel/rcuclassic.c b/kernel/rcuclassic.c
index f4ffbd0f306f..a38895a5b8e2 100644
--- a/kernel/rcuclassic.c
+++ b/kernel/rcuclassic.c
@@ -89,8 +89,22 @@ static void force_quiescent_state(struct rcu_data *rdp,
89 /* 89 /*
90 * Don't send IPI to itself. With irqs disabled, 90 * Don't send IPI to itself. With irqs disabled,
91 * rdp->cpu is the current cpu. 91 * rdp->cpu is the current cpu.
92 *
93 * cpu_online_map is updated by the _cpu_down()
94 * using stop_machine_run(). Since we're in irqs disabled
95 * section, stop_machine_run() is not exectuting, hence
96 * the cpu_online_map is stable.
97 *
98 * However, a cpu might have been offlined _just_ before
99 * we disabled irqs while entering here.
100 * And rcu subsystem might not yet have handled the CPU_DEAD
101 * notification, leading to the offlined cpu's bit
102 * being set in the rcp->cpumask.
103 *
104 * Hence cpumask = (rcp->cpumask & cpu_online_map) to prevent
105 * sending smp_reschedule() to an offlined CPU.
92 */ 106 */
93 cpumask = rcp->cpumask; 107 cpus_and(cpumask, rcp->cpumask, cpu_online_map);
94 cpu_clear(rdp->cpu, cpumask); 108 cpu_clear(rdp->cpu, cpumask);
95 for_each_cpu_mask(cpu, cpumask) 109 for_each_cpu_mask(cpu, cpumask)
96 smp_send_reschedule(cpu); 110 smp_send_reschedule(cpu);
diff --git a/kernel/sched.c b/kernel/sched.c
index b048ad8a11af..94ead43eda62 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -4398,22 +4398,20 @@ do_wait_for_common(struct completion *x, long timeout, int state)
4398 signal_pending(current)) || 4398 signal_pending(current)) ||
4399 (state == TASK_KILLABLE && 4399 (state == TASK_KILLABLE &&
4400 fatal_signal_pending(current))) { 4400 fatal_signal_pending(current))) {
4401 __remove_wait_queue(&x->wait, &wait); 4401 timeout = -ERESTARTSYS;
4402 return -ERESTARTSYS; 4402 break;
4403 } 4403 }
4404 __set_current_state(state); 4404 __set_current_state(state);
4405 spin_unlock_irq(&x->wait.lock); 4405 spin_unlock_irq(&x->wait.lock);
4406 timeout = schedule_timeout(timeout); 4406 timeout = schedule_timeout(timeout);
4407 spin_lock_irq(&x->wait.lock); 4407 spin_lock_irq(&x->wait.lock);
4408 if (!timeout) { 4408 } while (!x->done && timeout);
4409 __remove_wait_queue(&x->wait, &wait);
4410 return timeout;
4411 }
4412 } while (!x->done);
4413 __remove_wait_queue(&x->wait, &wait); 4409 __remove_wait_queue(&x->wait, &wait);
4410 if (!x->done)
4411 return timeout;
4414 } 4412 }
4415 x->done--; 4413 x->done--;
4416 return timeout; 4414 return timeout ?: 1;
4417} 4415}
4418 4416
4419static long __sched 4417static long __sched
@@ -5889,6 +5887,7 @@ static void migrate_dead_tasks(unsigned int dead_cpu)
5889 next = pick_next_task(rq, rq->curr); 5887 next = pick_next_task(rq, rq->curr);
5890 if (!next) 5888 if (!next)
5891 break; 5889 break;
5890 next->sched_class->put_prev_task(rq, next);
5892 migrate_dead(dead_cpu, next); 5891 migrate_dead(dead_cpu, next);
5893 5892
5894 } 5893 }
@@ -8503,6 +8502,9 @@ int sched_group_set_rt_period(struct task_group *tg, long rt_period_us)
8503 rt_period = (u64)rt_period_us * NSEC_PER_USEC; 8502 rt_period = (u64)rt_period_us * NSEC_PER_USEC;
8504 rt_runtime = tg->rt_bandwidth.rt_runtime; 8503 rt_runtime = tg->rt_bandwidth.rt_runtime;
8505 8504
8505 if (rt_period == 0)
8506 return -EINVAL;
8507
8506 return tg_set_bandwidth(tg, rt_period, rt_runtime); 8508 return tg_set_bandwidth(tg, rt_period, rt_runtime);
8507} 8509}
8508 8510
diff --git a/kernel/sched_rt.c b/kernel/sched_rt.c
index 1dad5bbb59b6..0f3c19197fa4 100644
--- a/kernel/sched_rt.c
+++ b/kernel/sched_rt.c
@@ -250,7 +250,8 @@ static int do_sched_rt_period_timer(struct rt_bandwidth *rt_b, int overrun)
250 if (rt_rq->rt_time || rt_rq->rt_nr_running) 250 if (rt_rq->rt_time || rt_rq->rt_nr_running)
251 idle = 0; 251 idle = 0;
252 spin_unlock(&rt_rq->rt_runtime_lock); 252 spin_unlock(&rt_rq->rt_runtime_lock);
253 } 253 } else if (rt_rq->rt_nr_running)
254 idle = 0;
254 255
255 if (enqueue) 256 if (enqueue)
256 sched_rt_rq_enqueue(rt_rq); 257 sched_rt_rq_enqueue(rt_rq);
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index 29116652dca8..f6d2e57b99a0 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -132,8 +132,6 @@ extern int sysctl_userprocess_debug;
132extern int spin_retry; 132extern int spin_retry;
133#endif 133#endif
134 134
135extern int sysctl_hz_timer;
136
137#ifdef CONFIG_BSD_PROCESS_ACCT 135#ifdef CONFIG_BSD_PROCESS_ACCT
138extern int acct_parm[]; 136extern int acct_parm[];
139#endif 137#endif
@@ -563,16 +561,6 @@ static struct ctl_table kern_table[] = {
563 .proc_handler = &proc_dointvec, 561 .proc_handler = &proc_dointvec,
564 }, 562 },
565#endif 563#endif
566#ifdef CONFIG_NO_IDLE_HZ
567 {
568 .ctl_name = KERN_HZ_TIMER,
569 .procname = "hz_timer",
570 .data = &sysctl_hz_timer,
571 .maxlen = sizeof(int),
572 .mode = 0644,
573 .proc_handler = &proc_dointvec,
574 },
575#endif
576 { 564 {
577 .ctl_name = KERN_S390_USER_DEBUG_LOGGING, 565 .ctl_name = KERN_S390_USER_DEBUG_LOGGING,
578 .procname = "userprocess_debug", 566 .procname = "userprocess_debug",
diff --git a/kernel/timer.c b/kernel/timer.c
index ceacc6626572..ef3fa6906e8f 100644
--- a/kernel/timer.c
+++ b/kernel/timer.c
@@ -812,7 +812,7 @@ static inline void __run_timers(struct tvec_base *base)
812 spin_unlock_irq(&base->lock); 812 spin_unlock_irq(&base->lock);
813} 813}
814 814
815#if defined(CONFIG_NO_IDLE_HZ) || defined(CONFIG_NO_HZ) 815#ifdef CONFIG_NO_HZ
816/* 816/*
817 * Find out when the next timer event is due to happen. This 817 * Find out when the next timer event is due to happen. This
818 * is used on S/390 to stop all activity when a cpus is idle. 818 * is used on S/390 to stop all activity when a cpus is idle.
@@ -947,14 +947,6 @@ unsigned long get_next_timer_interrupt(unsigned long now)
947 947
948 return cmp_next_hrtimer_event(now, expires); 948 return cmp_next_hrtimer_event(now, expires);
949} 949}
950
951#ifdef CONFIG_NO_IDLE_HZ
952unsigned long next_timer_interrupt(void)
953{
954 return get_next_timer_interrupt(jiffies);
955}
956#endif
957
958#endif 950#endif
959 951
960#ifndef CONFIG_VIRT_CPU_ACCOUNTING 952#ifndef CONFIG_VIRT_CPU_ACCOUNTING
diff --git a/lib/debugobjects.c b/lib/debugobjects.c
index a76a5e122ae1..85b18d79be89 100644
--- a/lib/debugobjects.c
+++ b/lib/debugobjects.c
@@ -68,6 +68,7 @@ static int fill_pool(void)
68{ 68{
69 gfp_t gfp = GFP_ATOMIC | __GFP_NORETRY | __GFP_NOWARN; 69 gfp_t gfp = GFP_ATOMIC | __GFP_NORETRY | __GFP_NOWARN;
70 struct debug_obj *new; 70 struct debug_obj *new;
71 unsigned long flags;
71 72
72 if (likely(obj_pool_free >= ODEBUG_POOL_MIN_LEVEL)) 73 if (likely(obj_pool_free >= ODEBUG_POOL_MIN_LEVEL))
73 return obj_pool_free; 74 return obj_pool_free;
@@ -81,10 +82,10 @@ static int fill_pool(void)
81 if (!new) 82 if (!new)
82 return obj_pool_free; 83 return obj_pool_free;
83 84
84 spin_lock(&pool_lock); 85 spin_lock_irqsave(&pool_lock, flags);
85 hlist_add_head(&new->node, &obj_pool); 86 hlist_add_head(&new->node, &obj_pool);
86 obj_pool_free++; 87 obj_pool_free++;
87 spin_unlock(&pool_lock); 88 spin_unlock_irqrestore(&pool_lock, flags);
88 } 89 }
89 return obj_pool_free; 90 return obj_pool_free;
90} 91}
@@ -110,16 +111,13 @@ static struct debug_obj *lookup_object(void *addr, struct debug_bucket *b)
110} 111}
111 112
112/* 113/*
113 * Allocate a new object. If the pool is empty and no refill possible, 114 * Allocate a new object. If the pool is empty, switch off the debugger.
114 * switch off the debugger.
115 */ 115 */
116static struct debug_obj * 116static struct debug_obj *
117alloc_object(void *addr, struct debug_bucket *b, struct debug_obj_descr *descr) 117alloc_object(void *addr, struct debug_bucket *b, struct debug_obj_descr *descr)
118{ 118{
119 struct debug_obj *obj = NULL; 119 struct debug_obj *obj = NULL;
120 int retry = 0;
121 120
122repeat:
123 spin_lock(&pool_lock); 121 spin_lock(&pool_lock);
124 if (obj_pool.first) { 122 if (obj_pool.first) {
125 obj = hlist_entry(obj_pool.first, typeof(*obj), node); 123 obj = hlist_entry(obj_pool.first, typeof(*obj), node);
@@ -141,9 +139,6 @@ repeat:
141 } 139 }
142 spin_unlock(&pool_lock); 140 spin_unlock(&pool_lock);
143 141
144 if (fill_pool() && !obj && !retry++)
145 goto repeat;
146
147 return obj; 142 return obj;
148} 143}
149 144
@@ -261,6 +256,8 @@ __debug_object_init(void *addr, struct debug_obj_descr *descr, int onstack)
261 struct debug_obj *obj; 256 struct debug_obj *obj;
262 unsigned long flags; 257 unsigned long flags;
263 258
259 fill_pool();
260
264 db = get_bucket((unsigned long) addr); 261 db = get_bucket((unsigned long) addr);
265 262
266 spin_lock_irqsave(&db->lock, flags); 263 spin_lock_irqsave(&db->lock, flags);
diff --git a/lib/ts_bm.c b/lib/ts_bm.c
index d90822c378a4..4a7fce72898e 100644
--- a/lib/ts_bm.c
+++ b/lib/ts_bm.c
@@ -63,7 +63,7 @@ static unsigned int bm_find(struct ts_config *conf, struct ts_state *state)
63 struct ts_bm *bm = ts_config_priv(conf); 63 struct ts_bm *bm = ts_config_priv(conf);
64 unsigned int i, text_len, consumed = state->offset; 64 unsigned int i, text_len, consumed = state->offset;
65 const u8 *text; 65 const u8 *text;
66 int shift = bm->patlen, bs; 66 int shift = bm->patlen - 1, bs;
67 67
68 for (;;) { 68 for (;;) {
69 text_len = conf->get_next_block(consumed, &text, conf, state); 69 text_len = conf->get_next_block(consumed, &text, conf, state);
diff --git a/mm/bootmem.c b/mm/bootmem.c
index e8fb927392b9..8d9f60e06f62 100644
--- a/mm/bootmem.c
+++ b/mm/bootmem.c
@@ -442,15 +442,17 @@ unsigned long __init init_bootmem_node(pg_data_t *pgdat, unsigned long freepfn,
442 return init_bootmem_core(pgdat, freepfn, startpfn, endpfn); 442 return init_bootmem_core(pgdat, freepfn, startpfn, endpfn);
443} 443}
444 444
445void __init reserve_bootmem_node(pg_data_t *pgdat, unsigned long physaddr, 445int __init reserve_bootmem_node(pg_data_t *pgdat, unsigned long physaddr,
446 unsigned long size, int flags) 446 unsigned long size, int flags)
447{ 447{
448 int ret; 448 int ret;
449 449
450 ret = can_reserve_bootmem_core(pgdat->bdata, physaddr, size, flags); 450 ret = can_reserve_bootmem_core(pgdat->bdata, physaddr, size, flags);
451 if (ret < 0) 451 if (ret < 0)
452 return; 452 return -ENOMEM;
453 reserve_bootmem_core(pgdat->bdata, physaddr, size, flags); 453 reserve_bootmem_core(pgdat->bdata, physaddr, size, flags);
454
455 return 0;
454} 456}
455 457
456void __init free_bootmem_node(pg_data_t *pgdat, unsigned long physaddr, 458void __init free_bootmem_node(pg_data_t *pgdat, unsigned long physaddr,
diff --git a/mm/memory.c b/mm/memory.c
index 9aefaae46858..d14b251a25a6 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -1045,6 +1045,26 @@ no_page_table:
1045 return page; 1045 return page;
1046} 1046}
1047 1047
1048/* Can we do the FOLL_ANON optimization? */
1049static inline int use_zero_page(struct vm_area_struct *vma)
1050{
1051 /*
1052 * We don't want to optimize FOLL_ANON for make_pages_present()
1053 * when it tries to page in a VM_LOCKED region. As to VM_SHARED,
1054 * we want to get the page from the page tables to make sure
1055 * that we serialize and update with any other user of that
1056 * mapping.
1057 */
1058 if (vma->vm_flags & (VM_LOCKED | VM_SHARED))
1059 return 0;
1060 /*
1061 * And if we have a fault or a nopfn routine, it's not an
1062 * anonymous region.
1063 */
1064 return !vma->vm_ops ||
1065 (!vma->vm_ops->fault && !vma->vm_ops->nopfn);
1066}
1067
1048int get_user_pages(struct task_struct *tsk, struct mm_struct *mm, 1068int get_user_pages(struct task_struct *tsk, struct mm_struct *mm,
1049 unsigned long start, int len, int write, int force, 1069 unsigned long start, int len, int write, int force,
1050 struct page **pages, struct vm_area_struct **vmas) 1070 struct page **pages, struct vm_area_struct **vmas)
@@ -1119,8 +1139,7 @@ int get_user_pages(struct task_struct *tsk, struct mm_struct *mm,
1119 foll_flags = FOLL_TOUCH; 1139 foll_flags = FOLL_TOUCH;
1120 if (pages) 1140 if (pages)
1121 foll_flags |= FOLL_GET; 1141 foll_flags |= FOLL_GET;
1122 if (!write && !(vma->vm_flags & VM_LOCKED) && 1142 if (!write && use_zero_page(vma))
1123 (!vma->vm_ops || !vma->vm_ops->fault))
1124 foll_flags |= FOLL_ANON; 1143 foll_flags |= FOLL_ANON;
1125 1144
1126 do { 1145 do {
@@ -1766,7 +1785,6 @@ gotten:
1766 page_table = pte_offset_map_lock(mm, pmd, address, &ptl); 1785 page_table = pte_offset_map_lock(mm, pmd, address, &ptl);
1767 if (likely(pte_same(*page_table, orig_pte))) { 1786 if (likely(pte_same(*page_table, orig_pte))) {
1768 if (old_page) { 1787 if (old_page) {
1769 page_remove_rmap(old_page, vma);
1770 if (!PageAnon(old_page)) { 1788 if (!PageAnon(old_page)) {
1771 dec_mm_counter(mm, file_rss); 1789 dec_mm_counter(mm, file_rss);
1772 inc_mm_counter(mm, anon_rss); 1790 inc_mm_counter(mm, anon_rss);
@@ -1788,6 +1806,32 @@ gotten:
1788 lru_cache_add_active(new_page); 1806 lru_cache_add_active(new_page);
1789 page_add_new_anon_rmap(new_page, vma, address); 1807 page_add_new_anon_rmap(new_page, vma, address);
1790 1808
1809 if (old_page) {
1810 /*
1811 * Only after switching the pte to the new page may
1812 * we remove the mapcount here. Otherwise another
1813 * process may come and find the rmap count decremented
1814 * before the pte is switched to the new page, and
1815 * "reuse" the old page writing into it while our pte
1816 * here still points into it and can be read by other
1817 * threads.
1818 *
1819 * The critical issue is to order this
1820 * page_remove_rmap with the ptp_clear_flush above.
1821 * Those stores are ordered by (if nothing else,)
1822 * the barrier present in the atomic_add_negative
1823 * in page_remove_rmap.
1824 *
1825 * Then the TLB flush in ptep_clear_flush ensures that
1826 * no process can access the old page before the
1827 * decremented mapcount is visible. And the old page
1828 * cannot be reused until after the decremented
1829 * mapcount is visible. So transitively, TLBs to
1830 * old page will be flushed before it can be reused.
1831 */
1832 page_remove_rmap(old_page, vma);
1833 }
1834
1791 /* Free the old page.. */ 1835 /* Free the old page.. */
1792 new_page = old_page; 1836 new_page = old_page;
1793 ret |= VM_FAULT_WRITE; 1837 ret |= VM_FAULT_WRITE;
diff --git a/mm/slab.c b/mm/slab.c
index 06236e4ddc1b..046607f05f3e 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -3263,9 +3263,12 @@ retry:
3263 3263
3264 if (cpuset_zone_allowed_hardwall(zone, flags) && 3264 if (cpuset_zone_allowed_hardwall(zone, flags) &&
3265 cache->nodelists[nid] && 3265 cache->nodelists[nid] &&
3266 cache->nodelists[nid]->free_objects) 3266 cache->nodelists[nid]->free_objects) {
3267 obj = ____cache_alloc_node(cache, 3267 obj = ____cache_alloc_node(cache,
3268 flags | GFP_THISNODE, nid); 3268 flags | GFP_THISNODE, nid);
3269 if (obj)
3270 break;
3271 }
3269 } 3272 }
3270 3273
3271 if (!obj) { 3274 if (!obj) {
diff --git a/net/core/dev.c b/net/core/dev.c
index 68d8df0992ab..fca23a3bf12c 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -454,7 +454,7 @@ static int netdev_boot_setup_add(char *name, struct ifmap *map)
454 for (i = 0; i < NETDEV_BOOT_SETUP_MAX; i++) { 454 for (i = 0; i < NETDEV_BOOT_SETUP_MAX; i++) {
455 if (s[i].name[0] == '\0' || s[i].name[0] == ' ') { 455 if (s[i].name[0] == '\0' || s[i].name[0] == ' ') {
456 memset(s[i].name, 0, sizeof(s[i].name)); 456 memset(s[i].name, 0, sizeof(s[i].name));
457 strcpy(s[i].name, name); 457 strlcpy(s[i].name, name, IFNAMSIZ);
458 memcpy(&s[i].map, map, sizeof(s[i].map)); 458 memcpy(&s[i].map, map, sizeof(s[i].map));
459 break; 459 break;
460 } 460 }
@@ -479,7 +479,7 @@ int netdev_boot_setup_check(struct net_device *dev)
479 479
480 for (i = 0; i < NETDEV_BOOT_SETUP_MAX; i++) { 480 for (i = 0; i < NETDEV_BOOT_SETUP_MAX; i++) {
481 if (s[i].name[0] != '\0' && s[i].name[0] != ' ' && 481 if (s[i].name[0] != '\0' && s[i].name[0] != ' ' &&
482 !strncmp(dev->name, s[i].name, strlen(s[i].name))) { 482 !strcmp(dev->name, s[i].name)) {
483 dev->irq = s[i].map.irq; 483 dev->irq = s[i].map.irq;
484 dev->base_addr = s[i].map.base_addr; 484 dev->base_addr = s[i].map.base_addr;
485 dev->mem_start = s[i].map.mem_start; 485 dev->mem_start = s[i].map.mem_start;
@@ -2077,6 +2077,10 @@ int netif_receive_skb(struct sk_buff *skb)
2077 2077
2078 rcu_read_lock(); 2078 rcu_read_lock();
2079 2079
2080 /* Don't receive packets in an exiting network namespace */
2081 if (!net_alive(dev_net(skb->dev)))
2082 goto out;
2083
2080#ifdef CONFIG_NET_CLS_ACT 2084#ifdef CONFIG_NET_CLS_ACT
2081 if (skb->tc_verd & TC_NCLS) { 2085 if (skb->tc_verd & TC_NCLS) {
2082 skb->tc_verd = CLR_TC_NCLS(skb->tc_verd); 2086 skb->tc_verd = CLR_TC_NCLS(skb->tc_verd);
@@ -2969,7 +2973,7 @@ EXPORT_SYMBOL(dev_unicast_delete);
2969/** 2973/**
2970 * dev_unicast_add - add a secondary unicast address 2974 * dev_unicast_add - add a secondary unicast address
2971 * @dev: device 2975 * @dev: device
2972 * @addr: address to delete 2976 * @addr: address to add
2973 * @alen: length of @addr 2977 * @alen: length of @addr
2974 * 2978 *
2975 * Add a secondary unicast address to the device or increase 2979 * Add a secondary unicast address to the device or increase
diff --git a/net/core/fib_rules.c b/net/core/fib_rules.c
index e3e9ab0f74e3..277a2302eb3a 100644
--- a/net/core/fib_rules.c
+++ b/net/core/fib_rules.c
@@ -226,7 +226,7 @@ static int fib_nl_newrule(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg)
226 226
227 ops = lookup_rules_ops(net, frh->family); 227 ops = lookup_rules_ops(net, frh->family);
228 if (ops == NULL) { 228 if (ops == NULL) {
229 err = EAFNOSUPPORT; 229 err = -EAFNOSUPPORT;
230 goto errout; 230 goto errout;
231 } 231 }
232 232
@@ -365,7 +365,7 @@ static int fib_nl_delrule(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg)
365 365
366 ops = lookup_rules_ops(net, frh->family); 366 ops = lookup_rules_ops(net, frh->family);
367 if (ops == NULL) { 367 if (ops == NULL) {
368 err = EAFNOSUPPORT; 368 err = -EAFNOSUPPORT;
369 goto errout; 369 goto errout;
370 } 370 }
371 371
diff --git a/net/core/filter.c b/net/core/filter.c
index 4f8369729a4e..df3744355839 100644
--- a/net/core/filter.c
+++ b/net/core/filter.c
@@ -68,7 +68,6 @@ static inline void *load_pointer(struct sk_buff *skb, int k,
68 * sk_filter - run a packet through a socket filter 68 * sk_filter - run a packet through a socket filter
69 * @sk: sock associated with &sk_buff 69 * @sk: sock associated with &sk_buff
70 * @skb: buffer to filter 70 * @skb: buffer to filter
71 * @needlock: set to 1 if the sock is not locked by caller.
72 * 71 *
73 * Run the filter code and then cut skb->data to correct size returned by 72 * Run the filter code and then cut skb->data to correct size returned by
74 * sk_run_filter. If pkt_len is 0 we toss packet. If skb->len is smaller 73 * sk_run_filter. If pkt_len is 0 we toss packet. If skb->len is smaller
diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c
index 72b4c184dd84..7c52fe277b62 100644
--- a/net/core/net_namespace.c
+++ b/net/core/net_namespace.c
@@ -140,6 +140,9 @@ static void cleanup_net(struct work_struct *work)
140 struct pernet_operations *ops; 140 struct pernet_operations *ops;
141 struct net *net; 141 struct net *net;
142 142
143 /* Be very certain incoming network packets will not find us */
144 rcu_barrier();
145
143 net = container_of(work, struct net, work); 146 net = container_of(work, struct net, work);
144 147
145 mutex_lock(&net_mutex); 148 mutex_lock(&net_mutex);
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 1e556d312117..366621610e76 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -1292,12 +1292,14 @@ static int __skb_splice_bits(struct sk_buff *skb, unsigned int *offset,
1292{ 1292{
1293 unsigned int nr_pages = spd->nr_pages; 1293 unsigned int nr_pages = spd->nr_pages;
1294 unsigned int poff, plen, len, toff, tlen; 1294 unsigned int poff, plen, len, toff, tlen;
1295 int headlen, seg; 1295 int headlen, seg, error = 0;
1296 1296
1297 toff = *offset; 1297 toff = *offset;
1298 tlen = *total_len; 1298 tlen = *total_len;
1299 if (!tlen) 1299 if (!tlen) {
1300 error = 1;
1300 goto err; 1301 goto err;
1302 }
1301 1303
1302 /* 1304 /*
1303 * if the offset is greater than the linear part, go directly to 1305 * if the offset is greater than the linear part, go directly to
@@ -1339,7 +1341,8 @@ static int __skb_splice_bits(struct sk_buff *skb, unsigned int *offset,
1339 * just jump directly to update and return, no point 1341 * just jump directly to update and return, no point
1340 * in going over fragments when the output is full. 1342 * in going over fragments when the output is full.
1341 */ 1343 */
1342 if (spd_fill_page(spd, virt_to_page(p), plen, poff, skb)) 1344 error = spd_fill_page(spd, virt_to_page(p), plen, poff, skb);
1345 if (error)
1343 goto done; 1346 goto done;
1344 1347
1345 tlen -= plen; 1348 tlen -= plen;
@@ -1369,7 +1372,8 @@ map_frag:
1369 if (!plen) 1372 if (!plen)
1370 break; 1373 break;
1371 1374
1372 if (spd_fill_page(spd, f->page, plen, poff, skb)) 1375 error = spd_fill_page(spd, f->page, plen, poff, skb);
1376 if (error)
1373 break; 1377 break;
1374 1378
1375 tlen -= plen; 1379 tlen -= plen;
@@ -1382,7 +1386,10 @@ done:
1382 return 0; 1386 return 0;
1383 } 1387 }
1384err: 1388err:
1385 return 1; 1389 /* update the offset to reflect the linear part skip, if any */
1390 if (!error)
1391 *offset = toff;
1392 return error;
1386} 1393}
1387 1394
1388/* 1395/*
diff --git a/net/ipv4/inet_fragment.c b/net/ipv4/inet_fragment.c
index 4ed429bd5951..0546a0bc97ea 100644
--- a/net/ipv4/inet_fragment.c
+++ b/net/ipv4/inet_fragment.c
@@ -192,14 +192,21 @@ EXPORT_SYMBOL(inet_frag_evictor);
192 192
193static struct inet_frag_queue *inet_frag_intern(struct netns_frags *nf, 193static struct inet_frag_queue *inet_frag_intern(struct netns_frags *nf,
194 struct inet_frag_queue *qp_in, struct inet_frags *f, 194 struct inet_frag_queue *qp_in, struct inet_frags *f,
195 unsigned int hash, void *arg) 195 void *arg)
196{ 196{
197 struct inet_frag_queue *qp; 197 struct inet_frag_queue *qp;
198#ifdef CONFIG_SMP 198#ifdef CONFIG_SMP
199 struct hlist_node *n; 199 struct hlist_node *n;
200#endif 200#endif
201 unsigned int hash;
201 202
202 write_lock(&f->lock); 203 write_lock(&f->lock);
204 /*
205 * While we stayed w/o the lock other CPU could update
206 * the rnd seed, so we need to re-calculate the hash
207 * chain. Fortunatelly the qp_in can be used to get one.
208 */
209 hash = f->hashfn(qp_in);
203#ifdef CONFIG_SMP 210#ifdef CONFIG_SMP
204 /* With SMP race we have to recheck hash table, because 211 /* With SMP race we have to recheck hash table, because
205 * such entry could be created on other cpu, while we 212 * such entry could be created on other cpu, while we
@@ -247,7 +254,7 @@ static struct inet_frag_queue *inet_frag_alloc(struct netns_frags *nf,
247} 254}
248 255
249static struct inet_frag_queue *inet_frag_create(struct netns_frags *nf, 256static struct inet_frag_queue *inet_frag_create(struct netns_frags *nf,
250 struct inet_frags *f, void *arg, unsigned int hash) 257 struct inet_frags *f, void *arg)
251{ 258{
252 struct inet_frag_queue *q; 259 struct inet_frag_queue *q;
253 260
@@ -255,7 +262,7 @@ static struct inet_frag_queue *inet_frag_create(struct netns_frags *nf,
255 if (q == NULL) 262 if (q == NULL)
256 return NULL; 263 return NULL;
257 264
258 return inet_frag_intern(nf, q, f, hash, arg); 265 return inet_frag_intern(nf, q, f, arg);
259} 266}
260 267
261struct inet_frag_queue *inet_frag_find(struct netns_frags *nf, 268struct inet_frag_queue *inet_frag_find(struct netns_frags *nf,
@@ -264,7 +271,6 @@ struct inet_frag_queue *inet_frag_find(struct netns_frags *nf,
264 struct inet_frag_queue *q; 271 struct inet_frag_queue *q;
265 struct hlist_node *n; 272 struct hlist_node *n;
266 273
267 read_lock(&f->lock);
268 hlist_for_each_entry(q, n, &f->hash[hash], list) { 274 hlist_for_each_entry(q, n, &f->hash[hash], list) {
269 if (q->net == nf && f->match(q, key)) { 275 if (q->net == nf && f->match(q, key)) {
270 atomic_inc(&q->refcnt); 276 atomic_inc(&q->refcnt);
@@ -274,6 +280,6 @@ struct inet_frag_queue *inet_frag_find(struct netns_frags *nf,
274 } 280 }
275 read_unlock(&f->lock); 281 read_unlock(&f->lock);
276 282
277 return inet_frag_create(nf, f, key, hash); 283 return inet_frag_create(nf, f, key);
278} 284}
279EXPORT_SYMBOL(inet_frag_find); 285EXPORT_SYMBOL(inet_frag_find);
diff --git a/net/ipv4/inet_lro.c b/net/ipv4/inet_lro.c
index 4a4d49fca1f2..cfd034a2b96e 100644
--- a/net/ipv4/inet_lro.c
+++ b/net/ipv4/inet_lro.c
@@ -383,8 +383,7 @@ static int __lro_proc_skb(struct net_lro_mgr *lro_mgr, struct sk_buff *skb,
383out2: /* send aggregated SKBs to stack */ 383out2: /* send aggregated SKBs to stack */
384 lro_flush(lro_mgr, lro_desc); 384 lro_flush(lro_mgr, lro_desc);
385 385
386out: /* Original SKB has to be posted to stack */ 386out:
387 skb->ip_summed = lro_mgr->ip_summed;
388 return 1; 387 return 1;
389} 388}
390 389
diff --git a/net/ipv4/ip_fragment.c b/net/ipv4/ip_fragment.c
index cd6ce6ac6358..37221f659159 100644
--- a/net/ipv4/ip_fragment.c
+++ b/net/ipv4/ip_fragment.c
@@ -229,6 +229,8 @@ static inline struct ipq *ip_find(struct net *net, struct iphdr *iph, u32 user)
229 229
230 arg.iph = iph; 230 arg.iph = iph;
231 arg.user = user; 231 arg.user = user;
232
233 read_lock(&ip4_frags.lock);
232 hash = ipqhashfn(iph->id, iph->saddr, iph->daddr, iph->protocol); 234 hash = ipqhashfn(iph->id, iph->saddr, iph->daddr, iph->protocol);
233 235
234 q = inet_frag_find(&net->ipv4.frags, &ip4_frags, &arg, hash); 236 q = inet_frag_find(&net->ipv4.frags, &ip4_frags, &arg, hash);
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index fc54a48fde1e..850825dc86e6 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -260,6 +260,8 @@
260#include <linux/socket.h> 260#include <linux/socket.h>
261#include <linux/random.h> 261#include <linux/random.h>
262#include <linux/bootmem.h> 262#include <linux/bootmem.h>
263#include <linux/highmem.h>
264#include <linux/swap.h>
263#include <linux/cache.h> 265#include <linux/cache.h>
264#include <linux/err.h> 266#include <linux/err.h>
265#include <linux/crypto.h> 267#include <linux/crypto.h>
@@ -2620,7 +2622,7 @@ __setup("thash_entries=", set_thash_entries);
2620void __init tcp_init(void) 2622void __init tcp_init(void)
2621{ 2623{
2622 struct sk_buff *skb = NULL; 2624 struct sk_buff *skb = NULL;
2623 unsigned long limit; 2625 unsigned long nr_pages, limit;
2624 int order, i, max_share; 2626 int order, i, max_share;
2625 2627
2626 BUILD_BUG_ON(sizeof(struct tcp_skb_cb) > sizeof(skb->cb)); 2628 BUILD_BUG_ON(sizeof(struct tcp_skb_cb) > sizeof(skb->cb));
@@ -2689,8 +2691,9 @@ void __init tcp_init(void)
2689 * is up to 1/2 at 256 MB, decreasing toward zero with the amount of 2691 * is up to 1/2 at 256 MB, decreasing toward zero with the amount of
2690 * memory, with a floor of 128 pages. 2692 * memory, with a floor of 128 pages.
2691 */ 2693 */
2692 limit = min(nr_all_pages, 1UL<<(28-PAGE_SHIFT)) >> (20-PAGE_SHIFT); 2694 nr_pages = totalram_pages - totalhigh_pages;
2693 limit = (limit * (nr_all_pages >> (20-PAGE_SHIFT))) >> (PAGE_SHIFT-11); 2695 limit = min(nr_pages, 1UL<<(28-PAGE_SHIFT)) >> (20-PAGE_SHIFT);
2696 limit = (limit * (nr_pages >> (20-PAGE_SHIFT))) >> (PAGE_SHIFT-11);
2694 limit = max(limit, 128UL); 2697 limit = max(limit, 128UL);
2695 sysctl_tcp_mem[0] = limit / 4 * 3; 2698 sysctl_tcp_mem[0] = limit / 4 * 3;
2696 sysctl_tcp_mem[1] = limit; 2699 sysctl_tcp_mem[1] = limit;
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index 12695be2c255..ffe869ac1bcf 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -2291,7 +2291,7 @@ static void get_tcp4_sock(struct sock *sk, struct seq_file *f, int i, int *len)
2291 } 2291 }
2292 2292
2293 seq_printf(f, "%4d: %08X:%04X %08X:%04X %02X %08X:%08X %02X:%08lX " 2293 seq_printf(f, "%4d: %08X:%04X %08X:%04X %02X %08X:%08X %02X:%08lX "
2294 "%08X %5d %8d %lu %d %p %u %u %u %u %d%n", 2294 "%08X %5d %8d %lu %d %p %lu %lu %u %u %d%n",
2295 i, src, srcp, dest, destp, sk->sk_state, 2295 i, src, srcp, dest, destp, sk->sk_state,
2296 tp->write_seq - tp->snd_una, 2296 tp->write_seq - tp->snd_una,
2297 sk->sk_state == TCP_LISTEN ? sk->sk_ack_backlog : 2297 sk->sk_state == TCP_LISTEN ? sk->sk_ack_backlog :
@@ -2303,8 +2303,8 @@ static void get_tcp4_sock(struct sock *sk, struct seq_file *f, int i, int *len)
2303 icsk->icsk_probes_out, 2303 icsk->icsk_probes_out,
2304 sock_i_ino(sk), 2304 sock_i_ino(sk),
2305 atomic_read(&sk->sk_refcnt), sk, 2305 atomic_read(&sk->sk_refcnt), sk,
2306 icsk->icsk_rto, 2306 jiffies_to_clock_t(icsk->icsk_rto),
2307 icsk->icsk_ack.ato, 2307 jiffies_to_clock_t(icsk->icsk_ack.ato),
2308 (icsk->icsk_ack.quick << 1) | icsk->icsk_ack.pingpong, 2308 (icsk->icsk_ack.quick << 1) | icsk->icsk_ack.pingpong,
2309 tp->snd_cwnd, 2309 tp->snd_cwnd,
2310 tp->snd_ssthresh >= 0xFFFF ? -1 : tp->snd_ssthresh, 2310 tp->snd_ssthresh >= 0xFFFF ? -1 : tp->snd_ssthresh,
diff --git a/net/ipv6/ip6_input.c b/net/ipv6/ip6_input.c
index 4e5c8615832c..17eb48b8e329 100644
--- a/net/ipv6/ip6_input.c
+++ b/net/ipv6/ip6_input.c
@@ -102,6 +102,15 @@ int ipv6_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt
102 if (hdr->version != 6) 102 if (hdr->version != 6)
103 goto err; 103 goto err;
104 104
105 /*
106 * RFC4291 2.5.3
107 * A packet received on an interface with a destination address
108 * of loopback must be dropped.
109 */
110 if (!(dev->flags & IFF_LOOPBACK) &&
111 ipv6_addr_loopback(&hdr->daddr))
112 goto err;
113
105 skb->transport_header = skb->network_header + sizeof(*hdr); 114 skb->transport_header = skb->network_header + sizeof(*hdr);
106 IP6CB(skb)->nhoff = offsetof(struct ipv6hdr, nexthdr); 115 IP6CB(skb)->nhoff = offsetof(struct ipv6hdr, nexthdr);
107 116
diff --git a/net/ipv6/ipv6_sockglue.c b/net/ipv6/ipv6_sockglue.c
index c042ce19bd14..86e28a75267f 100644
--- a/net/ipv6/ipv6_sockglue.c
+++ b/net/ipv6/ipv6_sockglue.c
@@ -345,18 +345,21 @@ static int do_ipv6_setsockopt(struct sock *sk, int level, int optname,
345 case IPV6_DSTOPTS: 345 case IPV6_DSTOPTS:
346 { 346 {
347 struct ipv6_txoptions *opt; 347 struct ipv6_txoptions *opt;
348
349 /* remove any sticky options header with a zero option
350 * length, per RFC3542.
351 */
348 if (optlen == 0) 352 if (optlen == 0)
349 optval = NULL; 353 optval = NULL;
354 else if (optlen < sizeof(struct ipv6_opt_hdr) ||
355 optlen & 0x7 || optlen > 8 * 255)
356 goto e_inval;
350 357
351 /* hop-by-hop / destination options are privileged option */ 358 /* hop-by-hop / destination options are privileged option */
352 retv = -EPERM; 359 retv = -EPERM;
353 if (optname != IPV6_RTHDR && !capable(CAP_NET_RAW)) 360 if (optname != IPV6_RTHDR && !capable(CAP_NET_RAW))
354 break; 361 break;
355 362
356 if (optlen < sizeof(struct ipv6_opt_hdr) ||
357 optlen & 0x7 || optlen > 8 * 255)
358 goto e_inval;
359
360 opt = ipv6_renew_options(sk, np->opt, optname, 363 opt = ipv6_renew_options(sk, np->opt, optname,
361 (struct ipv6_opt_hdr __user *)optval, 364 (struct ipv6_opt_hdr __user *)optval,
362 optlen); 365 optlen);
diff --git a/net/ipv6/netfilter/ip6table_mangle.c b/net/ipv6/netfilter/ip6table_mangle.c
index 27a5e8b48d93..f405cea21a8b 100644
--- a/net/ipv6/netfilter/ip6table_mangle.c
+++ b/net/ipv6/netfilter/ip6table_mangle.c
@@ -129,7 +129,7 @@ static struct nf_hook_ops ip6t_ops[] __read_mostly = {
129 .priority = NF_IP6_PRI_MANGLE, 129 .priority = NF_IP6_PRI_MANGLE,
130 }, 130 },
131 { 131 {
132 .hook = ip6t_local_hook, 132 .hook = ip6t_route_hook,
133 .owner = THIS_MODULE, 133 .owner = THIS_MODULE,
134 .pf = PF_INET6, 134 .pf = PF_INET6,
135 .hooknum = NF_INET_LOCAL_IN, 135 .hooknum = NF_INET_LOCAL_IN,
diff --git a/net/ipv6/netfilter/nf_conntrack_reasm.c b/net/ipv6/netfilter/nf_conntrack_reasm.c
index e65e26e210ee..cf20bc4fd60d 100644
--- a/net/ipv6/netfilter/nf_conntrack_reasm.c
+++ b/net/ipv6/netfilter/nf_conntrack_reasm.c
@@ -207,9 +207,10 @@ fq_find(__be32 id, struct in6_addr *src, struct in6_addr *dst)
207 arg.id = id; 207 arg.id = id;
208 arg.src = src; 208 arg.src = src;
209 arg.dst = dst; 209 arg.dst = dst;
210
211 read_lock_bh(&nf_frags.lock);
210 hash = ip6qhashfn(id, src, dst); 212 hash = ip6qhashfn(id, src, dst);
211 213
212 local_bh_disable();
213 q = inet_frag_find(&nf_init_frags, &nf_frags, &arg, hash); 214 q = inet_frag_find(&nf_init_frags, &nf_frags, &arg, hash);
214 local_bh_enable(); 215 local_bh_enable();
215 if (q == NULL) 216 if (q == NULL)
diff --git a/net/ipv6/reassembly.c b/net/ipv6/reassembly.c
index 798cabc7535b..a60d7d129713 100644
--- a/net/ipv6/reassembly.c
+++ b/net/ipv6/reassembly.c
@@ -247,6 +247,8 @@ fq_find(struct net *net, __be32 id, struct in6_addr *src, struct in6_addr *dst,
247 arg.id = id; 247 arg.id = id;
248 arg.src = src; 248 arg.src = src;
249 arg.dst = dst; 249 arg.dst = dst;
250
251 read_lock(&ip6_frags.lock);
250 hash = ip6qhashfn(id, src, dst); 252 hash = ip6qhashfn(id, src, dst);
251 253
252 q = inet_frag_find(&net->ipv6.frags, &ip6_frags, &arg, hash); 254 q = inet_frag_find(&net->ipv6.frags, &ip6_frags, &arg, hash);
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index d1f3e19b06c7..7ff687020fa9 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -240,7 +240,7 @@ static inline int rt6_need_strict(struct in6_addr *daddr)
240static inline struct rt6_info *rt6_device_match(struct net *net, 240static inline struct rt6_info *rt6_device_match(struct net *net,
241 struct rt6_info *rt, 241 struct rt6_info *rt,
242 int oif, 242 int oif,
243 int strict) 243 int flags)
244{ 244{
245 struct rt6_info *local = NULL; 245 struct rt6_info *local = NULL;
246 struct rt6_info *sprt; 246 struct rt6_info *sprt;
@@ -253,7 +253,7 @@ static inline struct rt6_info *rt6_device_match(struct net *net,
253 if (dev->flags & IFF_LOOPBACK) { 253 if (dev->flags & IFF_LOOPBACK) {
254 if (sprt->rt6i_idev == NULL || 254 if (sprt->rt6i_idev == NULL ||
255 sprt->rt6i_idev->dev->ifindex != oif) { 255 sprt->rt6i_idev->dev->ifindex != oif) {
256 if (strict && oif) 256 if (flags & RT6_LOOKUP_F_IFACE && oif)
257 continue; 257 continue;
258 if (local && (!oif || 258 if (local && (!oif ||
259 local->rt6i_idev->dev->ifindex == oif)) 259 local->rt6i_idev->dev->ifindex == oif))
@@ -266,7 +266,7 @@ static inline struct rt6_info *rt6_device_match(struct net *net,
266 if (local) 266 if (local)
267 return local; 267 return local;
268 268
269 if (strict) 269 if (flags & RT6_LOOKUP_F_IFACE)
270 return net->ipv6.ip6_null_entry; 270 return net->ipv6.ip6_null_entry;
271 } 271 }
272 return rt; 272 return rt;
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
index cb46749d4c32..40ea9c36d24b 100644
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -2036,7 +2036,7 @@ static void get_tcp6_sock(struct seq_file *seq, struct sock *sp, int i)
2036 2036
2037 seq_printf(seq, 2037 seq_printf(seq,
2038 "%4d: %08X%08X%08X%08X:%04X %08X%08X%08X%08X:%04X " 2038 "%4d: %08X%08X%08X%08X:%04X %08X%08X%08X%08X:%04X "
2039 "%02X %08X:%08X %02X:%08lX %08X %5d %8d %lu %d %p %u %u %u %u %d\n", 2039 "%02X %08X:%08X %02X:%08lX %08X %5d %8d %lu %d %p %lu %lu %u %u %d\n",
2040 i, 2040 i,
2041 src->s6_addr32[0], src->s6_addr32[1], 2041 src->s6_addr32[0], src->s6_addr32[1],
2042 src->s6_addr32[2], src->s6_addr32[3], srcp, 2042 src->s6_addr32[2], src->s6_addr32[3], srcp,
@@ -2052,8 +2052,8 @@ static void get_tcp6_sock(struct seq_file *seq, struct sock *sp, int i)
2052 icsk->icsk_probes_out, 2052 icsk->icsk_probes_out,
2053 sock_i_ino(sp), 2053 sock_i_ino(sp),
2054 atomic_read(&sp->sk_refcnt), sp, 2054 atomic_read(&sp->sk_refcnt), sp,
2055 icsk->icsk_rto, 2055 jiffies_to_clock_t(icsk->icsk_rto),
2056 icsk->icsk_ack.ato, 2056 jiffies_to_clock_t(icsk->icsk_ack.ato),
2057 (icsk->icsk_ack.quick << 1 ) | icsk->icsk_ack.pingpong, 2057 (icsk->icsk_ack.quick << 1 ) | icsk->icsk_ack.pingpong,
2058 tp->snd_cwnd, tp->snd_ssthresh>=0xFFFF?-1:tp->snd_ssthresh 2058 tp->snd_cwnd, tp->snd_ssthresh>=0xFFFF?-1:tp->snd_ssthresh
2059 ); 2059 );
diff --git a/net/mac80211/key.c b/net/mac80211/key.c
index 150d66dbda9d..220e83be3ef4 100644
--- a/net/mac80211/key.c
+++ b/net/mac80211/key.c
@@ -380,6 +380,15 @@ void ieee80211_key_free(struct ieee80211_key *key)
380 if (!key) 380 if (!key)
381 return; 381 return;
382 382
383 if (!key->sdata) {
384 /* The key has not been linked yet, simply free it
385 * and don't Oops */
386 if (key->conf.alg == ALG_CCMP)
387 ieee80211_aes_key_free(key->u.ccmp.tfm);
388 kfree(key);
389 return;
390 }
391
383 spin_lock_irqsave(&key->sdata->local->key_lock, flags); 392 spin_lock_irqsave(&key->sdata->local->key_lock, flags);
384 __ieee80211_key_free(key); 393 __ieee80211_key_free(key);
385 spin_unlock_irqrestore(&key->sdata->local->key_lock, flags); 394 spin_unlock_irqrestore(&key->sdata->local->key_lock, flags);
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index 28d8bd53bd3a..c80d5899f279 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -1132,7 +1132,7 @@ static int ieee80211_tx(struct net_device *dev, struct sk_buff *skb,
1132 ieee80211_tx_handler *handler; 1132 ieee80211_tx_handler *handler;
1133 struct ieee80211_tx_data tx; 1133 struct ieee80211_tx_data tx;
1134 ieee80211_tx_result res = TX_DROP, res_prepare; 1134 ieee80211_tx_result res = TX_DROP, res_prepare;
1135 int ret, i; 1135 int ret, i, retries = 0;
1136 1136
1137 WARN_ON(__ieee80211_queue_pending(local, control->queue)); 1137 WARN_ON(__ieee80211_queue_pending(local, control->queue));
1138 1138
@@ -1216,6 +1216,13 @@ retry:
1216 if (!__ieee80211_queue_stopped(local, control->queue)) { 1216 if (!__ieee80211_queue_stopped(local, control->queue)) {
1217 clear_bit(IEEE80211_LINK_STATE_PENDING, 1217 clear_bit(IEEE80211_LINK_STATE_PENDING,
1218 &local->state[control->queue]); 1218 &local->state[control->queue]);
1219 retries++;
1220 /*
1221 * Driver bug, it's rejecting packets but
1222 * not stopping queues.
1223 */
1224 if (WARN_ON_ONCE(retries > 5))
1225 goto drop;
1219 goto retry; 1226 goto retry;
1220 } 1227 }
1221 memcpy(&store->control, control, 1228 memcpy(&store->control, control,
diff --git a/net/mac80211/wext.c b/net/mac80211/wext.c
index 6106cb79060c..e8404212ad57 100644
--- a/net/mac80211/wext.c
+++ b/net/mac80211/wext.c
@@ -95,6 +95,13 @@ static int ieee80211_set_encryption(struct net_device *dev, u8 *sta_addr,
95 } 95 }
96 } 96 }
97 97
98 if (alg == ALG_WEP &&
99 key_len != LEN_WEP40 && key_len != LEN_WEP104) {
100 ieee80211_key_free(key);
101 err = -EINVAL;
102 goto out_unlock;
103 }
104
98 ieee80211_key_link(key, sdata, sta); 105 ieee80211_key_link(key, sdata, sta);
99 106
100 if (set_tx_key || (!sta && !sdata->default_key && key)) 107 if (set_tx_key || (!sta && !sdata->default_key && key))
diff --git a/net/mac80211/wme.c b/net/mac80211/wme.c
index 635b996c8c35..5d09e8698b57 100644
--- a/net/mac80211/wme.c
+++ b/net/mac80211/wme.c
@@ -323,8 +323,7 @@ static void wme_qdiscop_destroy(struct Qdisc* qd)
323 struct ieee80211_hw *hw = &local->hw; 323 struct ieee80211_hw *hw = &local->hw;
324 int queue; 324 int queue;
325 325
326 tcf_destroy_chain(q->filter_list); 326 tcf_destroy_chain(&q->filter_list);
327 q->filter_list = NULL;
328 327
329 for (queue=0; queue < hw->queues; queue++) { 328 for (queue=0; queue < hw->queues; queue++) {
330 skb_queue_purge(&q->requeued[queue]); 329 skb_queue_purge(&q->requeued[queue]);
diff --git a/net/netfilter/nf_conntrack_proto_tcp.c b/net/netfilter/nf_conntrack_proto_tcp.c
index ba94004fe323..271cd01d57ae 100644
--- a/net/netfilter/nf_conntrack_proto_tcp.c
+++ b/net/netfilter/nf_conntrack_proto_tcp.c
@@ -331,12 +331,13 @@ static unsigned int get_conntrack_index(const struct tcphdr *tcph)
331 331
332 I. Upper bound for valid data: seq <= sender.td_maxend 332 I. Upper bound for valid data: seq <= sender.td_maxend
333 II. Lower bound for valid data: seq + len >= sender.td_end - receiver.td_maxwin 333 II. Lower bound for valid data: seq + len >= sender.td_end - receiver.td_maxwin
334 III. Upper bound for valid ack: sack <= receiver.td_end 334 III. Upper bound for valid (s)ack: sack <= receiver.td_end
335 IV. Lower bound for valid ack: ack >= receiver.td_end - MAXACKWINDOW 335 IV. Lower bound for valid (s)ack: sack >= receiver.td_end - MAXACKWINDOW
336 336
337 where sack is the highest right edge of sack block found in the packet. 337 where sack is the highest right edge of sack block found in the packet
338 or ack in the case of packet without SACK option.
338 339
339 The upper bound limit for a valid ack is not ignored - 340 The upper bound limit for a valid (s)ack is not ignored -
340 we doesn't have to deal with fragments. 341 we doesn't have to deal with fragments.
341*/ 342*/
342 343
@@ -606,12 +607,12 @@ static bool tcp_in_window(const struct nf_conn *ct,
606 before(seq, sender->td_maxend + 1), 607 before(seq, sender->td_maxend + 1),
607 after(end, sender->td_end - receiver->td_maxwin - 1), 608 after(end, sender->td_end - receiver->td_maxwin - 1),
608 before(sack, receiver->td_end + 1), 609 before(sack, receiver->td_end + 1),
609 after(ack, receiver->td_end - MAXACKWINDOW(sender))); 610 after(sack, receiver->td_end - MAXACKWINDOW(sender) - 1));
610 611
611 if (before(seq, sender->td_maxend + 1) && 612 if (before(seq, sender->td_maxend + 1) &&
612 after(end, sender->td_end - receiver->td_maxwin - 1) && 613 after(end, sender->td_end - receiver->td_maxwin - 1) &&
613 before(sack, receiver->td_end + 1) && 614 before(sack, receiver->td_end + 1) &&
614 after(ack, receiver->td_end - MAXACKWINDOW(sender))) { 615 after(sack, receiver->td_end - MAXACKWINDOW(sender) - 1)) {
615 /* 616 /*
616 * Take into account window scaling (RFC 1323). 617 * Take into account window scaling (RFC 1323).
617 */ 618 */
diff --git a/net/netlabel/netlabel_unlabeled.c b/net/netlabel/netlabel_unlabeled.c
index 0099da5b2591..52b2611a6eb6 100644
--- a/net/netlabel/netlabel_unlabeled.c
+++ b/net/netlabel/netlabel_unlabeled.c
@@ -1534,7 +1534,7 @@ static int netlbl_unlabel_staticlistdef(struct sk_buff *skb,
1534 } 1534 }
1535 } 1535 }
1536 list_for_each_entry_rcu(addr6, &iface->addr6_list, list) { 1536 list_for_each_entry_rcu(addr6, &iface->addr6_list, list) {
1537 if (addr6->valid || iter_addr6++ < skip_addr6) 1537 if (!addr6->valid || iter_addr6++ < skip_addr6)
1538 continue; 1538 continue;
1539 if (netlbl_unlabel_staticlist_gen(NLBL_UNLABEL_C_STATICLISTDEF, 1539 if (netlbl_unlabel_staticlist_gen(NLBL_UNLABEL_C_STATICLISTDEF,
1540 iface, 1540 iface,
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
index 9b97f8006c9c..349aba189558 100644
--- a/net/netlink/af_netlink.c
+++ b/net/netlink/af_netlink.c
@@ -886,7 +886,7 @@ retry:
886 return netlink_unicast_kernel(sk, skb); 886 return netlink_unicast_kernel(sk, skb);
887 887
888 if (sk_filter(sk, skb)) { 888 if (sk_filter(sk, skb)) {
889 int err = skb->len; 889 err = skb->len;
890 kfree_skb(skb); 890 kfree_skb(skb);
891 sock_put(sk); 891 sock_put(sk);
892 return err; 892 return err;
diff --git a/net/netlink/attr.c b/net/netlink/attr.c
index 47bbf45ae5d7..2d106cfe1d27 100644
--- a/net/netlink/attr.c
+++ b/net/netlink/attr.c
@@ -132,6 +132,7 @@ errout:
132 * @maxtype: maximum attribute type to be expected 132 * @maxtype: maximum attribute type to be expected
133 * @head: head of attribute stream 133 * @head: head of attribute stream
134 * @len: length of attribute stream 134 * @len: length of attribute stream
135 * @policy: validation policy
135 * 136 *
136 * Parses a stream of attributes and stores a pointer to each attribute in 137 * Parses a stream of attributes and stores a pointer to each attribute in
137 * the tb array accessable via the attribute type. Attributes with a type 138 * the tb array accessable via the attribute type. Attributes with a type
@@ -194,7 +195,7 @@ struct nlattr *nla_find(struct nlattr *head, int len, int attrtype)
194/** 195/**
195 * nla_strlcpy - Copy string attribute payload into a sized buffer 196 * nla_strlcpy - Copy string attribute payload into a sized buffer
196 * @dst: where to copy the string to 197 * @dst: where to copy the string to
197 * @src: attribute to copy the string from 198 * @nla: attribute to copy the string from
198 * @dstsize: size of destination buffer 199 * @dstsize: size of destination buffer
199 * 200 *
200 * Copies at most dstsize - 1 bytes into the destination buffer. 201 * Copies at most dstsize - 1 bytes into the destination buffer.
@@ -340,9 +341,9 @@ struct nlattr *nla_reserve(struct sk_buff *skb, int attrtype, int attrlen)
340} 341}
341 342
342/** 343/**
343 * nla_reserve - reserve room for attribute without header 344 * nla_reserve_nohdr - reserve room for attribute without header
344 * @skb: socket buffer to reserve room on 345 * @skb: socket buffer to reserve room on
345 * @len: length of attribute payload 346 * @attrlen: length of attribute payload
346 * 347 *
347 * Reserves room for attribute payload without a header. 348 * Reserves room for attribute payload without a header.
348 * 349 *
diff --git a/net/sched/Kconfig b/net/sched/Kconfig
index 82adfe6447d7..9437b27ff84d 100644
--- a/net/sched/Kconfig
+++ b/net/sched/Kconfig
@@ -106,17 +106,6 @@ config NET_SCH_PRIO
106 To compile this code as a module, choose M here: the 106 To compile this code as a module, choose M here: the
107 module will be called sch_prio. 107 module will be called sch_prio.
108 108
109config NET_SCH_RR
110 tristate "Multi Band Round Robin Queuing (RR)"
111 select NET_SCH_PRIO
112 ---help---
113 Say Y here if you want to use an n-band round robin packet
114 scheduler.
115
116 The module uses sch_prio for its framework and is aliased as
117 sch_rr, so it will load sch_prio, although it is referred
118 to using sch_rr.
119
120config NET_SCH_RED 109config NET_SCH_RED
121 tristate "Random Early Detection (RED)" 110 tristate "Random Early Detection (RED)"
122 ---help--- 111 ---help---
diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c
index c40773cdbe45..10f01ad04380 100644
--- a/net/sched/sch_api.c
+++ b/net/sched/sch_api.c
@@ -1252,12 +1252,12 @@ void tcf_destroy(struct tcf_proto *tp)
1252 kfree(tp); 1252 kfree(tp);
1253} 1253}
1254 1254
1255void tcf_destroy_chain(struct tcf_proto *fl) 1255void tcf_destroy_chain(struct tcf_proto **fl)
1256{ 1256{
1257 struct tcf_proto *tp; 1257 struct tcf_proto *tp;
1258 1258
1259 while ((tp = fl) != NULL) { 1259 while ((tp = *fl) != NULL) {
1260 fl = tp->next; 1260 *fl = tp->next;
1261 tcf_destroy(tp); 1261 tcf_destroy(tp);
1262 } 1262 }
1263} 1263}
diff --git a/net/sched/sch_atm.c b/net/sched/sch_atm.c
index 335273416384..db0e23ae85f8 100644
--- a/net/sched/sch_atm.c
+++ b/net/sched/sch_atm.c
@@ -160,7 +160,7 @@ static void atm_tc_put(struct Qdisc *sch, unsigned long cl)
160 *prev = flow->next; 160 *prev = flow->next;
161 pr_debug("atm_tc_put: qdisc %p\n", flow->q); 161 pr_debug("atm_tc_put: qdisc %p\n", flow->q);
162 qdisc_destroy(flow->q); 162 qdisc_destroy(flow->q);
163 tcf_destroy_chain(flow->filter_list); 163 tcf_destroy_chain(&flow->filter_list);
164 if (flow->sock) { 164 if (flow->sock) {
165 pr_debug("atm_tc_put: f_count %d\n", 165 pr_debug("atm_tc_put: f_count %d\n",
166 file_count(flow->sock->file)); 166 file_count(flow->sock->file));
@@ -586,10 +586,11 @@ static void atm_tc_destroy(struct Qdisc *sch)
586 struct atm_flow_data *flow; 586 struct atm_flow_data *flow;
587 587
588 pr_debug("atm_tc_destroy(sch %p,[qdisc %p])\n", sch, p); 588 pr_debug("atm_tc_destroy(sch %p,[qdisc %p])\n", sch, p);
589 for (flow = p->flows; flow; flow = flow->next)
590 tcf_destroy_chain(&flow->filter_list);
591
589 /* races ? */ 592 /* races ? */
590 while ((flow = p->flows)) { 593 while ((flow = p->flows)) {
591 tcf_destroy_chain(flow->filter_list);
592 flow->filter_list = NULL;
593 if (flow->ref > 1) 594 if (flow->ref > 1)
594 printk(KERN_ERR "atm_destroy: %p->ref = %d\n", flow, 595 printk(KERN_ERR "atm_destroy: %p->ref = %d\n", flow,
595 flow->ref); 596 flow->ref);
diff --git a/net/sched/sch_cbq.c b/net/sched/sch_cbq.c
index 09969c1fbc08..2a3c97f7dc63 100644
--- a/net/sched/sch_cbq.c
+++ b/net/sched/sch_cbq.c
@@ -1704,7 +1704,7 @@ static void cbq_destroy_class(struct Qdisc *sch, struct cbq_class *cl)
1704 1704
1705 BUG_TRAP(!cl->filters); 1705 BUG_TRAP(!cl->filters);
1706 1706
1707 tcf_destroy_chain(cl->filter_list); 1707 tcf_destroy_chain(&cl->filter_list);
1708 qdisc_destroy(cl->q); 1708 qdisc_destroy(cl->q);
1709 qdisc_put_rtab(cl->R_tab); 1709 qdisc_put_rtab(cl->R_tab);
1710 gen_kill_estimator(&cl->bstats, &cl->rate_est); 1710 gen_kill_estimator(&cl->bstats, &cl->rate_est);
@@ -1728,10 +1728,8 @@ cbq_destroy(struct Qdisc* sch)
1728 * be bound to classes which have been destroyed already. --TGR '04 1728 * be bound to classes which have been destroyed already. --TGR '04
1729 */ 1729 */
1730 for (h = 0; h < 16; h++) { 1730 for (h = 0; h < 16; h++) {
1731 for (cl = q->classes[h]; cl; cl = cl->next) { 1731 for (cl = q->classes[h]; cl; cl = cl->next)
1732 tcf_destroy_chain(cl->filter_list); 1732 tcf_destroy_chain(&cl->filter_list);
1733 cl->filter_list = NULL;
1734 }
1735 } 1733 }
1736 for (h = 0; h < 16; h++) { 1734 for (h = 0; h < 16; h++) {
1737 struct cbq_class *next; 1735 struct cbq_class *next;
diff --git a/net/sched/sch_dsmark.c b/net/sched/sch_dsmark.c
index 64465bacbe79..c4c1317cd47d 100644
--- a/net/sched/sch_dsmark.c
+++ b/net/sched/sch_dsmark.c
@@ -416,7 +416,7 @@ static void dsmark_destroy(struct Qdisc *sch)
416 416
417 pr_debug("dsmark_destroy(sch %p,[qdisc %p])\n", sch, p); 417 pr_debug("dsmark_destroy(sch %p,[qdisc %p])\n", sch, p);
418 418
419 tcf_destroy_chain(p->filter_list); 419 tcf_destroy_chain(&p->filter_list);
420 qdisc_destroy(p->q); 420 qdisc_destroy(p->q);
421 kfree(p->mask); 421 kfree(p->mask);
422} 422}
diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c
index d355e5e47fe3..13afa7214392 100644
--- a/net/sched/sch_generic.c
+++ b/net/sched/sch_generic.c
@@ -468,7 +468,7 @@ struct Qdisc *qdisc_alloc(struct net_device *dev, struct Qdisc_ops *ops)
468 468
469 return sch; 469 return sch;
470errout: 470errout:
471 return ERR_PTR(-err); 471 return ERR_PTR(err);
472} 472}
473 473
474struct Qdisc * qdisc_create_dflt(struct net_device *dev, struct Qdisc_ops *ops, 474struct Qdisc * qdisc_create_dflt(struct net_device *dev, struct Qdisc_ops *ops,
diff --git a/net/sched/sch_hfsc.c b/net/sched/sch_hfsc.c
index fdfaa3fcc16d..e817aa00441d 100644
--- a/net/sched/sch_hfsc.c
+++ b/net/sched/sch_hfsc.c
@@ -1123,7 +1123,7 @@ hfsc_destroy_class(struct Qdisc *sch, struct hfsc_class *cl)
1123{ 1123{
1124 struct hfsc_sched *q = qdisc_priv(sch); 1124 struct hfsc_sched *q = qdisc_priv(sch);
1125 1125
1126 tcf_destroy_chain(cl->filter_list); 1126 tcf_destroy_chain(&cl->filter_list);
1127 qdisc_destroy(cl->qdisc); 1127 qdisc_destroy(cl->qdisc);
1128 gen_kill_estimator(&cl->bstats, &cl->rate_est); 1128 gen_kill_estimator(&cl->bstats, &cl->rate_est);
1129 if (cl != &q->root) 1129 if (cl != &q->root)
@@ -1541,6 +1541,10 @@ hfsc_destroy_qdisc(struct Qdisc *sch)
1541 unsigned int i; 1541 unsigned int i;
1542 1542
1543 for (i = 0; i < HFSC_HSIZE; i++) { 1543 for (i = 0; i < HFSC_HSIZE; i++) {
1544 list_for_each_entry(cl, &q->clhash[i], hlist)
1545 tcf_destroy_chain(&cl->filter_list);
1546 }
1547 for (i = 0; i < HFSC_HSIZE; i++) {
1544 list_for_each_entry_safe(cl, next, &q->clhash[i], hlist) 1548 list_for_each_entry_safe(cl, next, &q->clhash[i], hlist)
1545 hfsc_destroy_class(sch, cl); 1549 hfsc_destroy_class(sch, cl);
1546 } 1550 }
diff --git a/net/sched/sch_htb.c b/net/sched/sch_htb.c
index 6807c97985a5..3fb58f428f72 100644
--- a/net/sched/sch_htb.c
+++ b/net/sched/sch_htb.c
@@ -1238,7 +1238,7 @@ static void htb_destroy_class(struct Qdisc *sch, struct htb_class *cl)
1238 qdisc_put_rtab(cl->rate); 1238 qdisc_put_rtab(cl->rate);
1239 qdisc_put_rtab(cl->ceil); 1239 qdisc_put_rtab(cl->ceil);
1240 1240
1241 tcf_destroy_chain(cl->filter_list); 1241 tcf_destroy_chain(&cl->filter_list);
1242 1242
1243 while (!list_empty(&cl->children)) 1243 while (!list_empty(&cl->children))
1244 htb_destroy_class(sch, list_entry(cl->children.next, 1244 htb_destroy_class(sch, list_entry(cl->children.next,
@@ -1267,7 +1267,7 @@ static void htb_destroy(struct Qdisc *sch)
1267 and surprisingly it worked in 2.4. But it must precede it 1267 and surprisingly it worked in 2.4. But it must precede it
1268 because filter need its target class alive to be able to call 1268 because filter need its target class alive to be able to call
1269 unbind_filter on it (without Oops). */ 1269 unbind_filter on it (without Oops). */
1270 tcf_destroy_chain(q->filter_list); 1270 tcf_destroy_chain(&q->filter_list);
1271 1271
1272 while (!list_empty(&q->root)) 1272 while (!list_empty(&q->root))
1273 htb_destroy_class(sch, list_entry(q->root.next, 1273 htb_destroy_class(sch, list_entry(q->root.next,
diff --git a/net/sched/sch_ingress.c b/net/sched/sch_ingress.c
index 274b1ddb160c..956c80ad5965 100644
--- a/net/sched/sch_ingress.c
+++ b/net/sched/sch_ingress.c
@@ -104,7 +104,7 @@ static void ingress_destroy(struct Qdisc *sch)
104{ 104{
105 struct ingress_qdisc_data *p = qdisc_priv(sch); 105 struct ingress_qdisc_data *p = qdisc_priv(sch);
106 106
107 tcf_destroy_chain(p->filter_list); 107 tcf_destroy_chain(&p->filter_list);
108} 108}
109 109
110static int ingress_dump(struct Qdisc *sch, struct sk_buff *skb) 110static int ingress_dump(struct Qdisc *sch, struct sk_buff *skb)
diff --git a/net/sched/sch_prio.c b/net/sched/sch_prio.c
index 4aa2b45dad0a..5532f1031ab5 100644
--- a/net/sched/sch_prio.c
+++ b/net/sched/sch_prio.c
@@ -219,7 +219,7 @@ prio_destroy(struct Qdisc* sch)
219 int prio; 219 int prio;
220 struct prio_sched_data *q = qdisc_priv(sch); 220 struct prio_sched_data *q = qdisc_priv(sch);
221 221
222 tcf_destroy_chain(q->filter_list); 222 tcf_destroy_chain(&q->filter_list);
223 for (prio=0; prio<q->bands; prio++) 223 for (prio=0; prio<q->bands; prio++)
224 qdisc_destroy(q->queues[prio]); 224 qdisc_destroy(q->queues[prio]);
225} 225}
diff --git a/net/sched/sch_sfq.c b/net/sched/sch_sfq.c
index f0463d757a98..6a97afbfb952 100644
--- a/net/sched/sch_sfq.c
+++ b/net/sched/sch_sfq.c
@@ -520,7 +520,7 @@ static void sfq_destroy(struct Qdisc *sch)
520{ 520{
521 struct sfq_sched_data *q = qdisc_priv(sch); 521 struct sfq_sched_data *q = qdisc_priv(sch);
522 522
523 tcf_destroy_chain(q->filter_list); 523 tcf_destroy_chain(&q->filter_list);
524 q->perturb_period = 0; 524 q->perturb_period = 0;
525 del_timer_sync(&q->perturb_timer); 525 del_timer_sync(&q->perturb_timer);
526} 526}
diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index e7e3baf7009e..0dbcde6758ea 100644
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -4401,7 +4401,9 @@ static int sctp_getsockopt_local_addrs_old(struct sock *sk, int len,
4401 if (copy_from_user(&getaddrs, optval, len)) 4401 if (copy_from_user(&getaddrs, optval, len))
4402 return -EFAULT; 4402 return -EFAULT;
4403 4403
4404 if (getaddrs.addr_num <= 0) return -EINVAL; 4404 if (getaddrs.addr_num <= 0 ||
4405 getaddrs.addr_num >= (INT_MAX / sizeof(union sctp_addr)))
4406 return -EINVAL;
4405 /* 4407 /*
4406 * For UDP-style sockets, id specifies the association to query. 4408 * For UDP-style sockets, id specifies the association to query.
4407 * If the id field is set to the value '0' then the locally bound 4409 * If the id field is set to the value '0' then the locally bound
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index 657835f227d3..783317dacd30 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -487,8 +487,8 @@ static int unix_socketpair(struct socket *, struct socket *);
487static int unix_accept(struct socket *, struct socket *, int); 487static int unix_accept(struct socket *, struct socket *, int);
488static int unix_getname(struct socket *, struct sockaddr *, int *, int); 488static int unix_getname(struct socket *, struct sockaddr *, int *, int);
489static unsigned int unix_poll(struct file *, struct socket *, poll_table *); 489static unsigned int unix_poll(struct file *, struct socket *, poll_table *);
490static unsigned int unix_datagram_poll(struct file *, struct socket *, 490static unsigned int unix_dgram_poll(struct file *, struct socket *,
491 poll_table *); 491 poll_table *);
492static int unix_ioctl(struct socket *, unsigned int, unsigned long); 492static int unix_ioctl(struct socket *, unsigned int, unsigned long);
493static int unix_shutdown(struct socket *, int); 493static int unix_shutdown(struct socket *, int);
494static int unix_stream_sendmsg(struct kiocb *, struct socket *, 494static int unix_stream_sendmsg(struct kiocb *, struct socket *,
@@ -534,7 +534,7 @@ static const struct proto_ops unix_dgram_ops = {
534 .socketpair = unix_socketpair, 534 .socketpair = unix_socketpair,
535 .accept = sock_no_accept, 535 .accept = sock_no_accept,
536 .getname = unix_getname, 536 .getname = unix_getname,
537 .poll = unix_datagram_poll, 537 .poll = unix_dgram_poll,
538 .ioctl = unix_ioctl, 538 .ioctl = unix_ioctl,
539 .listen = sock_no_listen, 539 .listen = sock_no_listen,
540 .shutdown = unix_shutdown, 540 .shutdown = unix_shutdown,
@@ -555,7 +555,7 @@ static const struct proto_ops unix_seqpacket_ops = {
555 .socketpair = unix_socketpair, 555 .socketpair = unix_socketpair,
556 .accept = unix_accept, 556 .accept = unix_accept,
557 .getname = unix_getname, 557 .getname = unix_getname,
558 .poll = unix_datagram_poll, 558 .poll = unix_dgram_poll,
559 .ioctl = unix_ioctl, 559 .ioctl = unix_ioctl,
560 .listen = unix_listen, 560 .listen = unix_listen,
561 .shutdown = unix_shutdown, 561 .shutdown = unix_shutdown,
@@ -1994,29 +1994,13 @@ static unsigned int unix_poll(struct file * file, struct socket *sock, poll_tabl
1994 return mask; 1994 return mask;
1995} 1995}
1996 1996
1997static unsigned int unix_datagram_poll(struct file *file, struct socket *sock, 1997static unsigned int unix_dgram_poll(struct file *file, struct socket *sock,
1998 poll_table *wait) 1998 poll_table *wait)
1999{ 1999{
2000 struct sock *sk = sock->sk, *peer; 2000 struct sock *sk = sock->sk, *other;
2001 unsigned int mask; 2001 unsigned int mask, writable;
2002 2002
2003 poll_wait(file, sk->sk_sleep, wait); 2003 poll_wait(file, sk->sk_sleep, wait);
2004
2005 peer = unix_peer_get(sk);
2006 if (peer) {
2007 if (peer != sk) {
2008 /*
2009 * Writability of a connected socket additionally
2010 * depends on the state of the receive queue of the
2011 * peer.
2012 */
2013 poll_wait(file, &unix_sk(peer)->peer_wait, wait);
2014 } else {
2015 sock_put(peer);
2016 peer = NULL;
2017 }
2018 }
2019
2020 mask = 0; 2004 mask = 0;
2021 2005
2022 /* exceptional events? */ 2006 /* exceptional events? */
@@ -2042,14 +2026,26 @@ static unsigned int unix_datagram_poll(struct file *file, struct socket *sock,
2042 } 2026 }
2043 2027
2044 /* writable? */ 2028 /* writable? */
2045 if (unix_writable(sk) && !(peer && unix_recvq_full(peer))) 2029 writable = unix_writable(sk);
2030 if (writable) {
2031 other = unix_peer_get(sk);
2032 if (other) {
2033 if (unix_peer(other) != sk) {
2034 poll_wait(file, &unix_sk(other)->peer_wait,
2035 wait);
2036 if (unix_recvq_full(other))
2037 writable = 0;
2038 }
2039
2040 sock_put(other);
2041 }
2042 }
2043
2044 if (writable)
2046 mask |= POLLOUT | POLLWRNORM | POLLWRBAND; 2045 mask |= POLLOUT | POLLWRNORM | POLLWRBAND;
2047 else 2046 else
2048 set_bit(SOCK_ASYNC_NOSPACE, &sk->sk_socket->flags); 2047 set_bit(SOCK_ASYNC_NOSPACE, &sk->sk_socket->flags);
2049 2048
2050 if (peer)
2051 sock_put(peer);
2052
2053 return mask; 2049 return mask;
2054} 2050}
2055 2051
diff --git a/net/wireless/reg.c b/net/wireless/reg.c
index 185488da2466..855bff4b3250 100644
--- a/net/wireless/reg.c
+++ b/net/wireless/reg.c
@@ -80,6 +80,23 @@ static const struct ieee80211_channel_range ieee80211_JP_channels[] = {
80 IEEE80211_CHAN_RADAR), 80 IEEE80211_CHAN_RADAR),
81}; 81};
82 82
83static const struct ieee80211_channel_range ieee80211_EU_channels[] = {
84 /* IEEE 802.11b/g, channels 1..13 */
85 RANGE_PWR(2412, 2472, 20, 6, 0),
86 /* IEEE 802.11a, channel 36*/
87 RANGE_PWR(5180, 5180, 23, 6, IEEE80211_CHAN_PASSIVE_SCAN),
88 /* IEEE 802.11a, channel 40*/
89 RANGE_PWR(5200, 5200, 23, 6, IEEE80211_CHAN_PASSIVE_SCAN),
90 /* IEEE 802.11a, channel 44*/
91 RANGE_PWR(5220, 5220, 23, 6, IEEE80211_CHAN_PASSIVE_SCAN),
92 /* IEEE 802.11a, channels 48..64 */
93 RANGE_PWR(5240, 5320, 23, 6, IEEE80211_CHAN_NO_IBSS |
94 IEEE80211_CHAN_RADAR),
95 /* IEEE 802.11a, channels 100..140 */
96 RANGE_PWR(5500, 5700, 30, 6, IEEE80211_CHAN_NO_IBSS |
97 IEEE80211_CHAN_RADAR),
98};
99
83#define REGDOM(_code) \ 100#define REGDOM(_code) \
84 { \ 101 { \
85 .code = __stringify(_code), \ 102 .code = __stringify(_code), \
@@ -90,6 +107,7 @@ static const struct ieee80211_channel_range ieee80211_JP_channels[] = {
90static const struct ieee80211_regdomain ieee80211_regdoms[] = { 107static const struct ieee80211_regdomain ieee80211_regdoms[] = {
91 REGDOM(US), 108 REGDOM(US),
92 REGDOM(JP), 109 REGDOM(JP),
110 REGDOM(EU),
93}; 111};
94 112
95 113
diff --git a/sound/isa/sb/sb_mixer.c b/sound/isa/sb/sb_mixer.c
index 91d14224f6b3..73d4572d136b 100644
--- a/sound/isa/sb/sb_mixer.c
+++ b/sound/isa/sb/sb_mixer.c
@@ -925,7 +925,7 @@ static unsigned char als4000_saved_regs[] = {
925static void save_mixer(struct snd_sb *chip, unsigned char *regs, int num_regs) 925static void save_mixer(struct snd_sb *chip, unsigned char *regs, int num_regs)
926{ 926{
927 unsigned char *val = chip->saved_regs; 927 unsigned char *val = chip->saved_regs;
928 snd_assert(num_regs > ARRAY_SIZE(chip->saved_regs), return); 928 snd_assert(num_regs <= ARRAY_SIZE(chip->saved_regs), return);
929 for (; num_regs; num_regs--) 929 for (; num_regs; num_regs--)
930 *val++ = snd_sbmixer_read(chip, *regs++); 930 *val++ = snd_sbmixer_read(chip, *regs++);
931} 931}
@@ -933,7 +933,7 @@ static void save_mixer(struct snd_sb *chip, unsigned char *regs, int num_regs)
933static void restore_mixer(struct snd_sb *chip, unsigned char *regs, int num_regs) 933static void restore_mixer(struct snd_sb *chip, unsigned char *regs, int num_regs)
934{ 934{
935 unsigned char *val = chip->saved_regs; 935 unsigned char *val = chip->saved_regs;
936 snd_assert(num_regs > ARRAY_SIZE(chip->saved_regs), return); 936 snd_assert(num_regs <= ARRAY_SIZE(chip->saved_regs), return);
937 for (; num_regs; num_regs--) 937 for (; num_regs; num_regs--)
938 snd_sbmixer_write(chip, *regs++, *val++); 938 snd_sbmixer_write(chip, *regs++, *val++);
939} 939}
diff --git a/sound/pci/aw2/aw2-alsa.c b/sound/pci/aw2/aw2-alsa.c
index 56f87cd33c19..3f00ddf450f8 100644
--- a/sound/pci/aw2/aw2-alsa.c
+++ b/sound/pci/aw2/aw2-alsa.c
@@ -316,6 +316,8 @@ static int __devinit snd_aw2_create(struct snd_card *card,
316 return -ENOMEM; 316 return -ENOMEM;
317 } 317 }
318 318
319 /* (2) initialization of the chip hardware */
320 snd_aw2_saa7146_setup(&chip->saa7146, chip->iobase_virt);
319 321
320 if (request_irq(pci->irq, snd_aw2_saa7146_interrupt, 322 if (request_irq(pci->irq, snd_aw2_saa7146_interrupt,
321 IRQF_SHARED, "Audiowerk2", chip)) { 323 IRQF_SHARED, "Audiowerk2", chip)) {
@@ -329,8 +331,6 @@ static int __devinit snd_aw2_create(struct snd_card *card,
329 } 331 }
330 chip->irq = pci->irq; 332 chip->irq = pci->irq;
331 333
332 /* (2) initialization of the chip hardware */
333 snd_aw2_saa7146_setup(&chip->saa7146, chip->iobase_virt);
334 err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops); 334 err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops);
335 if (err < 0) { 335 if (err < 0) {
336 free_irq(chip->irq, (void *)chip); 336 free_irq(chip->irq, (void *)chip);
diff --git a/sound/soc/at91/at91-ssc.c b/sound/soc/at91/at91-ssc.c
index bc35d00a38f8..1a4260950142 100644
--- a/sound/soc/at91/at91-ssc.c
+++ b/sound/soc/at91/at91-ssc.c
@@ -41,7 +41,7 @@
41#define DBG(x...) 41#define DBG(x...)
42#endif 42#endif
43 43
44#if defined(CONFIG_ARCH_AT91SAM9260) 44#if defined(CONFIG_ARCH_AT91SAM9260) || defined(CONFIG_ARCH_AT91SAM9G20)
45#define NUM_SSC_DEVICES 1 45#define NUM_SSC_DEVICES 1
46#else 46#else
47#define NUM_SSC_DEVICES 3 47#define NUM_SSC_DEVICES 3
diff --git a/virt/kvm/ioapic.c b/virt/kvm/ioapic.c
index 98778cb69c6e..1dcf9f3d1107 100644
--- a/virt/kvm/ioapic.c
+++ b/virt/kvm/ioapic.c
@@ -269,28 +269,9 @@ void kvm_ioapic_set_irq(struct kvm_ioapic *ioapic, int irq, int level)
269 } 269 }
270} 270}
271 271
272static int get_eoi_gsi(struct kvm_ioapic *ioapic, int vector) 272static void __kvm_ioapic_update_eoi(struct kvm_ioapic *ioapic, int gsi)
273{ 273{
274 int i;
275
276 for (i = 0; i < IOAPIC_NUM_PINS; i++)
277 if (ioapic->redirtbl[i].fields.vector == vector)
278 return i;
279 return -1;
280}
281
282void kvm_ioapic_update_eoi(struct kvm *kvm, int vector)
283{
284 struct kvm_ioapic *ioapic = kvm->arch.vioapic;
285 union ioapic_redir_entry *ent; 274 union ioapic_redir_entry *ent;
286 int gsi;
287
288 gsi = get_eoi_gsi(ioapic, vector);
289 if (gsi == -1) {
290 printk(KERN_WARNING "Can't find redir item for %d EOI\n",
291 vector);
292 return;
293 }
294 275
295 ent = &ioapic->redirtbl[gsi]; 276 ent = &ioapic->redirtbl[gsi];
296 ASSERT(ent->fields.trig_mode == IOAPIC_LEVEL_TRIG); 277 ASSERT(ent->fields.trig_mode == IOAPIC_LEVEL_TRIG);
@@ -300,6 +281,16 @@ void kvm_ioapic_update_eoi(struct kvm *kvm, int vector)
300 ioapic_deliver(ioapic, gsi); 281 ioapic_deliver(ioapic, gsi);
301} 282}
302 283
284void kvm_ioapic_update_eoi(struct kvm *kvm, int vector)
285{
286 struct kvm_ioapic *ioapic = kvm->arch.vioapic;
287 int i;
288
289 for (i = 0; i < IOAPIC_NUM_PINS; i++)
290 if (ioapic->redirtbl[i].fields.vector == vector)
291 __kvm_ioapic_update_eoi(ioapic, i);
292}
293
303static int ioapic_in_range(struct kvm_io_device *this, gpa_t addr) 294static int ioapic_in_range(struct kvm_io_device *this, gpa_t addr)
304{ 295{
305 struct kvm_ioapic *ioapic = (struct kvm_ioapic *)this->private; 296 struct kvm_ioapic *ioapic = (struct kvm_ioapic *)this->private;